michael@0: /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-*/ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this file, michael@0: * You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #ifndef ISOTrackMetadata_h_ michael@0: #define ISOTrackMetadata_h_ michael@0: michael@0: #include "TrackMetadataBase.h" michael@0: michael@0: namespace mozilla { michael@0: michael@0: class AACTrackMetadata : public AudioTrackMetadata { michael@0: public: michael@0: // AudioTrackMetadata members michael@0: uint32_t GetAudioFrameDuration() MOZ_OVERRIDE { return mFrameDuration; } michael@0: uint32_t GetAudioFrameSize() MOZ_OVERRIDE { return mFrameSize; } michael@0: uint32_t GetAudioSampleRate() MOZ_OVERRIDE { return mSampleRate; } michael@0: uint32_t GetAudioChannels() MOZ_OVERRIDE { return mChannels; } michael@0: michael@0: // TrackMetadataBase member michael@0: MetadataKind GetKind() const MOZ_OVERRIDE { return METADATA_AAC; } michael@0: michael@0: // AACTrackMetadata members michael@0: AACTrackMetadata() michael@0: : mSampleRate(0) michael@0: , mFrameDuration(0) michael@0: , mFrameSize(0) michael@0: , mChannels(0) { michael@0: MOZ_COUNT_CTOR(AACTrackMetadata); michael@0: } michael@0: ~AACTrackMetadata() { MOZ_COUNT_DTOR(AACTrackMetadata); } michael@0: michael@0: uint32_t mSampleRate; // From 14496-3 table 1.16, it could be 7350 ~ 96000. michael@0: uint32_t mFrameDuration; // Audio frame duration based on SampleRate. michael@0: uint32_t mFrameSize; // Audio frame size, 0 is variant size. michael@0: uint32_t mChannels; // Channel number, it should be 1 or 2. michael@0: }; michael@0: michael@0: // AVC clock rate is 90k Hz. michael@0: #define AVC_CLOCK_RATE 90000 michael@0: michael@0: class AVCTrackMetadata : public VideoTrackMetadata { michael@0: public: michael@0: // VideoTrackMetadata members michael@0: uint32_t GetVideoHeight() MOZ_OVERRIDE { return mHeight; } michael@0: uint32_t GetVideoWidth() MOZ_OVERRIDE {return mWidth; } michael@0: uint32_t GetVideoDisplayHeight() MOZ_OVERRIDE { return mDisplayHeight; } michael@0: uint32_t GetVideoDisplayWidth() MOZ_OVERRIDE { return mDisplayWidth; } michael@0: uint32_t GetVideoClockRate() MOZ_OVERRIDE { return AVC_CLOCK_RATE; } michael@0: uint32_t GetVideoFrameRate() MOZ_OVERRIDE { return mFrameRate; } michael@0: michael@0: // TrackMetadataBase member michael@0: MetadataKind GetKind() const MOZ_OVERRIDE { return METADATA_AVC; } michael@0: michael@0: // AVCTrackMetadata michael@0: AVCTrackMetadata() michael@0: : mHeight(0) michael@0: , mWidth(0) michael@0: , mDisplayHeight(0) michael@0: , mDisplayWidth(0) michael@0: , mFrameRate(0) { michael@0: MOZ_COUNT_CTOR(AVCTrackMetadata); michael@0: } michael@0: ~AVCTrackMetadata() { MOZ_COUNT_DTOR(AVCTrackMetadata); } michael@0: michael@0: uint32_t mHeight; michael@0: uint32_t mWidth; michael@0: uint32_t mDisplayHeight; michael@0: uint32_t mDisplayWidth; michael@0: uint32_t mFrameRate; // frames per second michael@0: }; michael@0: michael@0: michael@0: // AMR sample rate is 8000 samples/s. michael@0: #define AMR_SAMPLE_RATE 8000 michael@0: michael@0: // Channel number is always 1. michael@0: #define AMR_CHANNELS 1 michael@0: michael@0: // AMR speech codec, 3GPP TS 26.071. Encoder and continer support AMR-NB only michael@0: // currently. michael@0: class AMRTrackMetadata : public AudioTrackMetadata { michael@0: public: michael@0: // AudioTrackMetadata members michael@0: // michael@0: // The number of sample sets generates by encoder is variant. So the michael@0: // frame duration and frame size are both 0. michael@0: uint32_t GetAudioFrameDuration() MOZ_OVERRIDE { return 0; } michael@0: uint32_t GetAudioFrameSize() MOZ_OVERRIDE { return 0; } michael@0: uint32_t GetAudioSampleRate() MOZ_OVERRIDE { return AMR_SAMPLE_RATE; } michael@0: uint32_t GetAudioChannels() MOZ_OVERRIDE { return AMR_CHANNELS; } michael@0: michael@0: // TrackMetadataBase member michael@0: MetadataKind GetKind() const MOZ_OVERRIDE { return METADATA_AMR; } michael@0: michael@0: // AMRTrackMetadata members michael@0: AMRTrackMetadata() { MOZ_COUNT_CTOR(AMRTrackMetadata); } michael@0: ~AMRTrackMetadata() { MOZ_COUNT_DTOR(AMRTrackMetadata); } michael@0: }; michael@0: michael@0: } michael@0: michael@0: #endif // ISOTrackMetadata_h_