Bug 646333 - Make video constants consistently const T. r=cpearce

This commit is contained in:
Martin Richard 2011-09-15 07:39:50 +12:00
parent 9fc16861d4
commit 398b044837
13 changed files with 44 additions and 51 deletions

View File

@ -141,17 +141,17 @@ PRBool SamplesToUsecs(PRInt64 aSamples, PRUint32 aRate, PRInt64& aOutUsecs);
PRBool UsecsToSamples(PRInt64 aUsecs, PRUint32 aRate, PRInt64& aOutSamples);
// Number of microseconds per second. 1e6.
#define USECS_PER_S 1000000
static const PRInt64 USECS_PER_S = 1000000;
// Number of microseconds per millisecond.
#define USECS_PER_MS 1000
static const PRInt64 USECS_PER_MS = 1000;
// The maximum height and width of the video. Used for
// sanitizing the memory allocation of the RGB buffer.
// The maximum resolution we anticipate encountering in the
// wild is 2160p - 3840x2160 pixels.
#define MAX_VIDEO_WIDTH 4000
#define MAX_VIDEO_HEIGHT 3000
static const PRInt32 MAX_VIDEO_WIDTH = 4000;
static const PRInt32 MAX_VIDEO_HEIGHT = 3000;
// Scales the display rect aDisplay by aspect ratio aAspectRatio.
// Note that aDisplay must be validated by nsVideoInfo::ValidateVideoRegion()

View File

@ -41,7 +41,7 @@
#include "nsAudioAvailableEventManager.h"
#include "VideoUtils.h"
#define MAX_PENDING_EVENTS 100
static const nsTArray< nsCOMPtr<nsIRunnable> >::size_type MAX_PENDING_EVENTS = 100;
using namespace mozilla;

View File

@ -78,7 +78,7 @@ using mozilla::TimeStamp;
PRLogModuleInfo* gAudioStreamLog = nsnull;
#endif
#define FAKE_BUFFER_SIZE 176400
static const PRUint32 FAKE_BUFFER_SIZE = 176400;
class nsAudioStreamLocal : public nsAudioStream
{

View File

@ -59,7 +59,7 @@ extern PRLogModuleInfo* gBuiltinDecoderLog;
// Wait this number of seconds when buffering, then leave and play
// as best as we can if the required amount of data hasn't been
// retrieved.
#define BUFFERING_WAIT 30
static const PRUint32 BUFFERING_WAIT = 30;
// The amount of data to retrieve during buffering is computed based
// on the download rate. BUFFERING_MIN_RATE is the minimum download

View File

@ -57,10 +57,10 @@
using namespace mozilla;
// Number of milliseconds between progress events as defined by spec
#define PROGRESS_MS 350
static const PRUint32 PROGRESS_MS = 350;
// Number of milliseconds of no data before a stall event is fired as defined by spec
#define STALL_MS 3000
static const PRUint32 STALL_MS = 3000;
// Number of estimated seconds worth of data we need to have buffered
// ahead of the current playback position before we allow the media decoder
@ -68,7 +68,7 @@ using namespace mozilla;
// catching up with the download. Having this margin make the
// nsMediaDecoder::CanPlayThrough() calculation more stable in the case of
// fluctuating bitrates.
#define CAN_PLAY_THROUGH_MARGIN 10
static const PRInt64 CAN_PLAY_THROUGH_MARGIN = 10;
nsMediaDecoder::nsMediaDecoder() :
mElement(0),

View File

@ -59,12 +59,12 @@ class nsTimeRanges;
// The size to use for audio data frames in MozAudioAvailable events.
// This value is per channel, and is chosen to give ~43 fps of events,
// for example, 44100 with 2 channels, 2*1024 = 2048.
#define FRAMEBUFFER_LENGTH_PER_CHANNEL 1024
static const PRUint32 FRAMEBUFFER_LENGTH_PER_CHANNEL = 1024;
// The total size of the framebuffer used for MozAudioAvailable events
// has to be within the following range.
#define FRAMEBUFFER_LENGTH_MIN 512
#define FRAMEBUFFER_LENGTH_MAX 16384
static const PRUint32 FRAMEBUFFER_LENGTH_MIN = 512;
static const PRUint32 FRAMEBUFFER_LENGTH_MAX = 16384;
// All methods of nsMediaDecoder must be called from the main thread only
// with the exception of GetImageContainer, SetVideoData and GetStatistics,

View File

@ -62,8 +62,8 @@
#include "mozilla/Util.h" // for DebugOnly
#include "nsContentUtils.h"
#define HTTP_OK_CODE 200
#define HTTP_PARTIAL_RESPONSE_CODE 206
static const PRUint32 HTTP_OK_CODE = 200;
static const PRUint32 HTTP_PARTIAL_RESPONSE_CODE = 206;
using namespace mozilla;

View File

@ -51,9 +51,9 @@
// For HTTP seeking, if number of bytes needing to be
// seeked forward is less than this value then a read is
// done rather than a byte range request.
#define SEEK_VS_READ_THRESHOLD (32*1024)
static const PRInt64 SEEK_VS_READ_THRESHOLD = 32*1024;
#define HTTP_REQUESTED_RANGE_NOT_SATISFIABLE_CODE 416
static const PRUint32 HTTP_REQUESTED_RANGE_NOT_SATISFIABLE_CODE = 416;
class nsMediaDecoder;

View File

@ -773,34 +773,34 @@ nsSkeletonState::~nsSkeletonState()
// http://wiki.xiph.org/Ogg_Skeleton_4
// Minimum length in bytes of a Skeleton header packet.
#define SKELETON_MIN_HEADER_LEN 28
#define SKELETON_4_0_MIN_HEADER_LEN 80
static const long SKELETON_MIN_HEADER_LEN = 28;
static const long SKELETON_4_0_MIN_HEADER_LEN = 80;
// Minimum length in bytes of a Skeleton 4.0 index packet.
#define SKELETON_4_0_MIN_INDEX_LEN 42
static const long SKELETON_4_0_MIN_INDEX_LEN = 42;
// Minimum possible size of a compressed index keypoint.
#define MIN_KEY_POINT_SIZE 2
static const size_t MIN_KEY_POINT_SIZE = 2;
// Byte offset of the major and minor version numbers in the
// Ogg Skeleton 4.0 header packet.
#define SKELETON_VERSION_MAJOR_OFFSET 8
#define SKELETON_VERSION_MINOR_OFFSET 10
static const size_t SKELETON_VERSION_MAJOR_OFFSET = 8;
static const size_t SKELETON_VERSION_MINOR_OFFSET = 10;
// Byte-offsets of the presentation time numerator and denominator
#define SKELETON_PRESENTATION_TIME_NUMERATOR_OFFSET 12
#define SKELETON_PRESENTATION_TIME_DENOMINATOR_OFFSET 20
static const size_t SKELETON_PRESENTATION_TIME_NUMERATOR_OFFSET = 12;
static const size_t SKELETON_PRESENTATION_TIME_DENOMINATOR_OFFSET = 20;
// Byte-offsets of the length of file field in the Skeleton 4.0 header packet.
#define SKELETON_FILE_LENGTH_OFFSET 64
static const size_t SKELETON_FILE_LENGTH_OFFSET = 64;
// Byte-offsets of the fields in the Skeleton index packet.
#define INDEX_SERIALNO_OFFSET 6
#define INDEX_NUM_KEYPOINTS_OFFSET 10
#define INDEX_TIME_DENOM_OFFSET 18
#define INDEX_FIRST_NUMER_OFFSET 26
#define INDEX_LAST_NUMER_OFFSET 34
#define INDEX_KEYPOINT_OFFSET 42
static const size_t INDEX_SERIALNO_OFFSET = 6;
static const size_t INDEX_NUM_KEYPOINTS_OFFSET = 10;
static const size_t INDEX_TIME_DENOM_OFFSET = 18;
static const size_t INDEX_FIRST_NUMER_OFFSET = 26;
static const size_t INDEX_LAST_NUMER_OFFSET = 34;
static const size_t INDEX_KEYPOINT_OFFSET = 42;
static PRBool IsSkeletonBOS(ogg_packet* aPacket)
{

View File

@ -63,20 +63,13 @@ extern PRLogModuleInfo* gBuiltinDecoderLog;
#define SEEK_LOG(type, msg)
#endif
// If we don't have a Theora video stream, then during seeking, if a seek
// target is less than SEEK_DECODE_MARGIN ahead of the current playback
// position, we'll just decode forwards rather than performing a bisection
// search. If we have Theora video we use the maximum keyframe interval as
// this value, rather than SEEK_DECODE_MARGIN. This makes small seeks faster.
#define SEEK_DECODE_MARGIN 2000000
// The number of microseconds of "fuzz" we use in a bisection search over
// HTTP. When we're seeking with fuzz, we'll stop the search if a bisection
// lands between the seek target and SEEK_FUZZ_USECS microseconds before the
// seek target. This is becaue it's usually quicker to just keep downloading
// from an exisiting connection than to do another bisection inside that
// small range, which would open a new HTTP connetion.
#define SEEK_FUZZ_USECS 500000
static const PRUint32 SEEK_FUZZ_USECS = 500000;
enum PageSyncResult {
PAGE_SYNC_ERROR = 1,

View File

@ -43,7 +43,7 @@
#include "nsRawDecoder.h"
#include "VideoUtils.h"
#define RAW_ID 0x595556
static const PRUint24 RAW_ID = 0x595556;
nsRawReader::nsRawReader(nsBuiltinDecoder* aDecoder)
: nsBuiltinDecoderReader(aDecoder),

View File

@ -62,27 +62,27 @@ extern PRLogModuleInfo* gBuiltinDecoderLog;
#endif
// Magic values that identify RIFF chunks we're interested in.
#define RIFF_CHUNK_MAGIC 0x52494646
#define WAVE_CHUNK_MAGIC 0x57415645
#define FRMT_CHUNK_MAGIC 0x666d7420
#define DATA_CHUNK_MAGIC 0x64617461
static const PRUint32 RIFF_CHUNK_MAGIC = 0x52494646;
static const PRUint32 WAVE_CHUNK_MAGIC = 0x57415645;
static const PRUint32 FRMT_CHUNK_MAGIC = 0x666d7420;
static const PRUint32 DATA_CHUNK_MAGIC = 0x64617461;
// Size of RIFF chunk header. 4 byte chunk header type and 4 byte size field.
#define RIFF_CHUNK_HEADER_SIZE 8
static const PRUint16 RIFF_CHUNK_HEADER_SIZE = 8;
// Size of RIFF header. RIFF chunk and 4 byte RIFF type.
#define RIFF_INITIAL_SIZE (RIFF_CHUNK_HEADER_SIZE + 4)
static const PRUint16 RIFF_INITIAL_SIZE = RIFF_CHUNK_HEADER_SIZE + 4;
// Size of required part of format chunk. Actual format chunks may be
// extended (for non-PCM encodings), but we skip any extended data.
#define WAVE_FORMAT_CHUNK_SIZE 16
static const PRUint16 WAVE_FORMAT_CHUNK_SIZE = 16;
// PCM encoding type from format chunk. Linear PCM is the only encoding
// supported by nsAudioStream.
#define WAVE_FORMAT_ENCODING_PCM 1
static const PRUint16 WAVE_FORMAT_ENCODING_PCM = 1;
// Maximum number of channels supported
#define MAX_CHANNELS 2
static const PRUint8 MAX_CHANNELS = 2;
namespace {
PRUint32

View File

@ -177,7 +177,7 @@ private:
PRBool aBOS,
PRBool aEOS,
PRInt64 aGranulepos);
// Decode a nestegg packet of audio data. Push the audio data on the
// audio queue. Returns PR_TRUE when there's more audio to decode,
// PR_FALSE if the audio is finished, end of file has been reached,