Fri, 16 Jan 2015 04:50:19 +0100
Replace accessor implementation with direct member state manipulation, by
request https://trac.torproject.org/projects/tor/ticket/9701#comment:32
michael@0 | 1 | /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-*/ |
michael@0 | 2 | /* This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 3 | * License, v. 2.0. If a copy of the MPL was not distributed with this file, |
michael@0 | 4 | * You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 5 | |
michael@0 | 6 | #ifndef TrackMetadataBase_h_ |
michael@0 | 7 | #define TrackMetadataBase_h_ |
michael@0 | 8 | |
michael@0 | 9 | #include "nsTArray.h" |
michael@0 | 10 | #include "nsCOMPtr.h" |
michael@0 | 11 | namespace mozilla { |
michael@0 | 12 | |
michael@0 | 13 | // A class represent meta data for various codec format. Only support one track information. |
michael@0 | 14 | class TrackMetadataBase |
michael@0 | 15 | { |
michael@0 | 16 | public: |
michael@0 | 17 | NS_INLINE_DECL_THREADSAFE_REFCOUNTING(TrackMetadataBase) |
michael@0 | 18 | enum MetadataKind { |
michael@0 | 19 | METADATA_OPUS, // Represent the Opus metadata |
michael@0 | 20 | METADATA_VP8, |
michael@0 | 21 | METADATA_VORBIS, |
michael@0 | 22 | METADATA_AVC, |
michael@0 | 23 | METADATA_AAC, |
michael@0 | 24 | METADATA_AMR, |
michael@0 | 25 | METADATA_UNKNOWN // Metadata Kind not set |
michael@0 | 26 | }; |
michael@0 | 27 | // Return the specific metadata kind |
michael@0 | 28 | virtual MetadataKind GetKind() const = 0; |
michael@0 | 29 | |
michael@0 | 30 | protected: |
michael@0 | 31 | // Protected destructor, to discourage deletion outside of Release(): |
michael@0 | 32 | virtual ~TrackMetadataBase() {} |
michael@0 | 33 | }; |
michael@0 | 34 | |
michael@0 | 35 | // The base class for audio metadata. |
michael@0 | 36 | class AudioTrackMetadata : public TrackMetadataBase { |
michael@0 | 37 | public: |
michael@0 | 38 | // The duration of each sample set generated by encoder. (counted by samples) |
michael@0 | 39 | // If the duration is variant, this value should return 0. |
michael@0 | 40 | virtual uint32_t GetAudioFrameDuration() = 0; |
michael@0 | 41 | |
michael@0 | 42 | // The size of each sample set generated by encoder. (counted by byte) |
michael@0 | 43 | // If the size is variant, this value should return 0. |
michael@0 | 44 | virtual uint32_t GetAudioFrameSize() = 0; |
michael@0 | 45 | |
michael@0 | 46 | // AudioSampleRate is the number of audio sample per second. |
michael@0 | 47 | virtual uint32_t GetAudioSampleRate() = 0; |
michael@0 | 48 | |
michael@0 | 49 | virtual uint32_t GetAudioChannels() = 0; |
michael@0 | 50 | }; |
michael@0 | 51 | |
michael@0 | 52 | // The base class for video metadata. |
michael@0 | 53 | class VideoTrackMetadata : public TrackMetadataBase { |
michael@0 | 54 | public: |
michael@0 | 55 | // VideoHeight and VideoWidth are the frame size of the elementary stream. |
michael@0 | 56 | virtual uint32_t GetVideoHeight() = 0; |
michael@0 | 57 | virtual uint32_t GetVideoWidth() = 0; |
michael@0 | 58 | |
michael@0 | 59 | // VideoDisplayHeight and VideoDisplayWidth are the display frame size. |
michael@0 | 60 | virtual uint32_t GetVideoDisplayHeight() = 0; |
michael@0 | 61 | virtual uint32_t GetVideoDisplayWidth() = 0; |
michael@0 | 62 | |
michael@0 | 63 | // VideoClockRate is the number of samples per second in video frame's |
michael@0 | 64 | // timestamp. |
michael@0 | 65 | // For example, if VideoClockRate is 90k Hz and VideoFrameRate is |
michael@0 | 66 | // 30 fps, each frame's sample duration will be 3000 Hz. |
michael@0 | 67 | virtual uint32_t GetVideoClockRate() = 0; |
michael@0 | 68 | |
michael@0 | 69 | // VideoFrameRate is numner of frames per second. |
michael@0 | 70 | virtual uint32_t GetVideoFrameRate() = 0; |
michael@0 | 71 | }; |
michael@0 | 72 | |
michael@0 | 73 | } |
michael@0 | 74 | #endif |