content/media/encoder/TrackMetadataBase.h

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

mercurial