|
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 ISOTrackMetadata_h_ |
|
7 #define ISOTrackMetadata_h_ |
|
8 |
|
9 #include "TrackMetadataBase.h" |
|
10 |
|
11 namespace mozilla { |
|
12 |
|
13 class AACTrackMetadata : public AudioTrackMetadata { |
|
14 public: |
|
15 // AudioTrackMetadata members |
|
16 uint32_t GetAudioFrameDuration() MOZ_OVERRIDE { return mFrameDuration; } |
|
17 uint32_t GetAudioFrameSize() MOZ_OVERRIDE { return mFrameSize; } |
|
18 uint32_t GetAudioSampleRate() MOZ_OVERRIDE { return mSampleRate; } |
|
19 uint32_t GetAudioChannels() MOZ_OVERRIDE { return mChannels; } |
|
20 |
|
21 // TrackMetadataBase member |
|
22 MetadataKind GetKind() const MOZ_OVERRIDE { return METADATA_AAC; } |
|
23 |
|
24 // AACTrackMetadata members |
|
25 AACTrackMetadata() |
|
26 : mSampleRate(0) |
|
27 , mFrameDuration(0) |
|
28 , mFrameSize(0) |
|
29 , mChannels(0) { |
|
30 MOZ_COUNT_CTOR(AACTrackMetadata); |
|
31 } |
|
32 ~AACTrackMetadata() { MOZ_COUNT_DTOR(AACTrackMetadata); } |
|
33 |
|
34 uint32_t mSampleRate; // From 14496-3 table 1.16, it could be 7350 ~ 96000. |
|
35 uint32_t mFrameDuration; // Audio frame duration based on SampleRate. |
|
36 uint32_t mFrameSize; // Audio frame size, 0 is variant size. |
|
37 uint32_t mChannels; // Channel number, it should be 1 or 2. |
|
38 }; |
|
39 |
|
40 // AVC clock rate is 90k Hz. |
|
41 #define AVC_CLOCK_RATE 90000 |
|
42 |
|
43 class AVCTrackMetadata : public VideoTrackMetadata { |
|
44 public: |
|
45 // VideoTrackMetadata members |
|
46 uint32_t GetVideoHeight() MOZ_OVERRIDE { return mHeight; } |
|
47 uint32_t GetVideoWidth() MOZ_OVERRIDE {return mWidth; } |
|
48 uint32_t GetVideoDisplayHeight() MOZ_OVERRIDE { return mDisplayHeight; } |
|
49 uint32_t GetVideoDisplayWidth() MOZ_OVERRIDE { return mDisplayWidth; } |
|
50 uint32_t GetVideoClockRate() MOZ_OVERRIDE { return AVC_CLOCK_RATE; } |
|
51 uint32_t GetVideoFrameRate() MOZ_OVERRIDE { return mFrameRate; } |
|
52 |
|
53 // TrackMetadataBase member |
|
54 MetadataKind GetKind() const MOZ_OVERRIDE { return METADATA_AVC; } |
|
55 |
|
56 // AVCTrackMetadata |
|
57 AVCTrackMetadata() |
|
58 : mHeight(0) |
|
59 , mWidth(0) |
|
60 , mDisplayHeight(0) |
|
61 , mDisplayWidth(0) |
|
62 , mFrameRate(0) { |
|
63 MOZ_COUNT_CTOR(AVCTrackMetadata); |
|
64 } |
|
65 ~AVCTrackMetadata() { MOZ_COUNT_DTOR(AVCTrackMetadata); } |
|
66 |
|
67 uint32_t mHeight; |
|
68 uint32_t mWidth; |
|
69 uint32_t mDisplayHeight; |
|
70 uint32_t mDisplayWidth; |
|
71 uint32_t mFrameRate; // frames per second |
|
72 }; |
|
73 |
|
74 |
|
75 // AMR sample rate is 8000 samples/s. |
|
76 #define AMR_SAMPLE_RATE 8000 |
|
77 |
|
78 // Channel number is always 1. |
|
79 #define AMR_CHANNELS 1 |
|
80 |
|
81 // AMR speech codec, 3GPP TS 26.071. Encoder and continer support AMR-NB only |
|
82 // currently. |
|
83 class AMRTrackMetadata : public AudioTrackMetadata { |
|
84 public: |
|
85 // AudioTrackMetadata members |
|
86 // |
|
87 // The number of sample sets generates by encoder is variant. So the |
|
88 // frame duration and frame size are both 0. |
|
89 uint32_t GetAudioFrameDuration() MOZ_OVERRIDE { return 0; } |
|
90 uint32_t GetAudioFrameSize() MOZ_OVERRIDE { return 0; } |
|
91 uint32_t GetAudioSampleRate() MOZ_OVERRIDE { return AMR_SAMPLE_RATE; } |
|
92 uint32_t GetAudioChannels() MOZ_OVERRIDE { return AMR_CHANNELS; } |
|
93 |
|
94 // TrackMetadataBase member |
|
95 MetadataKind GetKind() const MOZ_OVERRIDE { return METADATA_AMR; } |
|
96 |
|
97 // AMRTrackMetadata members |
|
98 AMRTrackMetadata() { MOZ_COUNT_CTOR(AMRTrackMetadata); } |
|
99 ~AMRTrackMetadata() { MOZ_COUNT_DTOR(AMRTrackMetadata); } |
|
100 }; |
|
101 |
|
102 } |
|
103 |
|
104 #endif // ISOTrackMetadata_h_ |