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 TrackMetadataBase_h_ michael@0: #define TrackMetadataBase_h_ michael@0: michael@0: #include "nsTArray.h" michael@0: #include "nsCOMPtr.h" michael@0: namespace mozilla { michael@0: michael@0: // A class represent meta data for various codec format. Only support one track information. michael@0: class TrackMetadataBase michael@0: { michael@0: public: michael@0: NS_INLINE_DECL_THREADSAFE_REFCOUNTING(TrackMetadataBase) michael@0: enum MetadataKind { michael@0: METADATA_OPUS, // Represent the Opus metadata michael@0: METADATA_VP8, michael@0: METADATA_VORBIS, michael@0: METADATA_AVC, michael@0: METADATA_AAC, michael@0: METADATA_AMR, michael@0: METADATA_UNKNOWN // Metadata Kind not set michael@0: }; michael@0: // Return the specific metadata kind michael@0: virtual MetadataKind GetKind() const = 0; michael@0: michael@0: protected: michael@0: // Protected destructor, to discourage deletion outside of Release(): michael@0: virtual ~TrackMetadataBase() {} michael@0: }; michael@0: michael@0: // The base class for audio metadata. michael@0: class AudioTrackMetadata : public TrackMetadataBase { michael@0: public: michael@0: // The duration of each sample set generated by encoder. (counted by samples) michael@0: // If the duration is variant, this value should return 0. michael@0: virtual uint32_t GetAudioFrameDuration() = 0; michael@0: michael@0: // The size of each sample set generated by encoder. (counted by byte) michael@0: // If the size is variant, this value should return 0. michael@0: virtual uint32_t GetAudioFrameSize() = 0; michael@0: michael@0: // AudioSampleRate is the number of audio sample per second. michael@0: virtual uint32_t GetAudioSampleRate() = 0; michael@0: michael@0: virtual uint32_t GetAudioChannels() = 0; michael@0: }; michael@0: michael@0: // The base class for video metadata. michael@0: class VideoTrackMetadata : public TrackMetadataBase { michael@0: public: michael@0: // VideoHeight and VideoWidth are the frame size of the elementary stream. michael@0: virtual uint32_t GetVideoHeight() = 0; michael@0: virtual uint32_t GetVideoWidth() = 0; michael@0: michael@0: // VideoDisplayHeight and VideoDisplayWidth are the display frame size. michael@0: virtual uint32_t GetVideoDisplayHeight() = 0; michael@0: virtual uint32_t GetVideoDisplayWidth() = 0; michael@0: michael@0: // VideoClockRate is the number of samples per second in video frame's michael@0: // timestamp. michael@0: // For example, if VideoClockRate is 90k Hz and VideoFrameRate is michael@0: // 30 fps, each frame's sample duration will be 3000 Hz. michael@0: virtual uint32_t GetVideoClockRate() = 0; michael@0: michael@0: // VideoFrameRate is numner of frames per second. michael@0: virtual uint32_t GetVideoFrameRate() = 0; michael@0: }; michael@0: michael@0: } michael@0: #endif