winlin

refine the hls codec, add comments.

@@ -48,12 +48,12 @@ class SrsStream; @@ -48,12 +48,12 @@ class SrsStream;
48 enum SrsCodecAudioSampleRate 48 enum SrsCodecAudioSampleRate
49 { 49 {
50 // set to the max value to reserved, for array map. 50 // set to the max value to reserved, for array map.
51 - SrsCodecAudioSampleRateReserved = 4, 51 + SrsCodecAudioSampleRateReserved = 4,
52 52
53 SrsCodecAudioSampleRate5512 = 0, 53 SrsCodecAudioSampleRate5512 = 0,
54 - SrsCodecAudioSampleRate11025 = 1,  
55 - SrsCodecAudioSampleRate22050 = 2,  
56 - SrsCodecAudioSampleRate44100 = 3, 54 + SrsCodecAudioSampleRate11025 = 1,
  55 + SrsCodecAudioSampleRate22050 = 2,
  56 + SrsCodecAudioSampleRate44100 = 3,
57 }; 57 };
58 58
59 /** 59 /**
@@ -67,10 +67,10 @@ enum SrsCodecAudioSampleRate @@ -67,10 +67,10 @@ enum SrsCodecAudioSampleRate
67 enum SrsCodecAudioSampleSize 67 enum SrsCodecAudioSampleSize
68 { 68 {
69 // set to the max value to reserved, for array map. 69 // set to the max value to reserved, for array map.
70 - SrsCodecAudioSampleSizeReserved = 2, 70 + SrsCodecAudioSampleSizeReserved = 2,
71 71
72 SrsCodecAudioSampleSize8bit = 0, 72 SrsCodecAudioSampleSize8bit = 0,
73 - SrsCodecAudioSampleSize16bit = 1, 73 + SrsCodecAudioSampleSize16bit = 1,
74 }; 74 };
75 75
76 /** 76 /**
@@ -82,10 +82,10 @@ enum SrsCodecAudioSampleSize @@ -82,10 +82,10 @@ enum SrsCodecAudioSampleSize
82 enum SrsCodecAudioSoundType 82 enum SrsCodecAudioSoundType
83 { 83 {
84 // set to the max value to reserved, for array map. 84 // set to the max value to reserved, for array map.
85 - SrsCodecAudioSoundTypeReserved = 2, 85 + SrsCodecAudioSoundTypeReserved = 2,
86 86
87 - SrsCodecAudioSoundTypeMono = 0,  
88 - SrsCodecAudioSoundTypeStereo = 1, 87 + SrsCodecAudioSoundTypeMono = 0,
  88 + SrsCodecAudioSoundTypeStereo = 1,
89 }; 89 };
90 90
91 /** 91 /**
@@ -134,6 +134,9 @@ public: @@ -134,6 +134,9 @@ public:
134 int nb_sample_units; 134 int nb_sample_units;
135 SrsCodecSampleUnit sample_units[SRS_MAX_CODEC_SAMPLE]; 135 SrsCodecSampleUnit sample_units[SRS_MAX_CODEC_SAMPLE];
136 public: 136 public:
  137 + /**
  138 + * whether the sample is video sample which demux from video packet.
  139 + */
137 bool is_video; 140 bool is_video;
138 /** 141 /**
139 * CompositionTime, video_file_format_spec_v10_1.pdf, page 78. 142 * CompositionTime, video_file_format_spec_v10_1.pdf, page 78.
@@ -191,50 +194,54 @@ private: @@ -191,50 +194,54 @@ private:
191 SrsStream* stream; 194 SrsStream* stream;
192 public: 195 public:
193 /** 196 /**
194 - * video specified 197 + * metadata specified
195 */ 198 */
  199 + int duration;
  200 + int width;
  201 + int height;
  202 + int frame_rate;
196 // @see: SrsCodecVideo 203 // @see: SrsCodecVideo
197 - int video_codec_id; 204 + int video_codec_id;
  205 + int video_data_rate; // in bps
  206 + // @see: SrsCod ecAudioType
  207 + int audio_codec_id;
  208 + int audio_data_rate; // in bps
  209 +public:
  210 + /**
  211 + * video specified
  212 + */
198 // profile_idc, H.264-AVC-ISO_IEC_14496-10.pdf, page 45. 213 // profile_idc, H.264-AVC-ISO_IEC_14496-10.pdf, page 45.
199 - u_int8_t avc_profile; 214 + u_int8_t avc_profile;
200 // level_idc, H.264-AVC-ISO_IEC_14496-10.pdf, page 45. 215 // level_idc, H.264-AVC-ISO_IEC_14496-10.pdf, page 45.
201 - u_int8_t avc_level;  
202 - int width;  
203 - int height;  
204 - int video_data_rate; // in bps  
205 - int frame_rate;  
206 - int duration; 216 + u_int8_t avc_level;
207 // lengthSizeMinusOne, H.264-AVC-ISO_IEC_14496-15.pdf, page 16 217 // lengthSizeMinusOne, H.264-AVC-ISO_IEC_14496-15.pdf, page 16
208 - int8_t NAL_unit_length;  
209 - u_int16_t sequenceParameterSetLength;  
210 - char* sequenceParameterSetNALUnit;  
211 - u_int16_t pictureParameterSetLength;  
212 - char* pictureParameterSetNALUnit; 218 + int8_t NAL_unit_length;
  219 + u_int16_t sequenceParameterSetLength;
  220 + char* sequenceParameterSetNALUnit;
  221 + u_int16_t pictureParameterSetLength;
  222 + char* pictureParameterSetNALUnit;
213 public: 223 public:
214 /** 224 /**
215 * audio specified 225 * audio specified
216 */ 226 */
217 - // @see: SrsCodecAudioType  
218 - int audio_codec_id;  
219 - int audio_data_rate; // in bps  
220 // 1.6.2.1 AudioSpecificConfig, in aac-mp4a-format-ISO_IEC_14496-3+2001.pdf, page 33. 227 // 1.6.2.1 AudioSpecificConfig, in aac-mp4a-format-ISO_IEC_14496-3+2001.pdf, page 33.
221 // audioObjectType, value defines in 7.1 Profiles, aac-iso-13818-7.pdf, page 40. 228 // audioObjectType, value defines in 7.1 Profiles, aac-iso-13818-7.pdf, page 40.
222 - u_int8_t aac_profile; 229 + u_int8_t aac_profile;
223 // samplingFrequencyIndex 230 // samplingFrequencyIndex
224 - u_int8_t aac_sample_rate; 231 + u_int8_t aac_sample_rate;
225 // channelConfiguration 232 // channelConfiguration
226 - u_int8_t aac_channels; 233 + u_int8_t aac_channels;
227 public: 234 public:
228 // the avc extra data, the AVC sequence header, 235 // the avc extra data, the AVC sequence header,
229 // without the flv codec header, 236 // without the flv codec header,
230 // @see: ffmpeg, AVCodecContext::extradata 237 // @see: ffmpeg, AVCodecContext::extradata
231 - int avc_extra_size;  
232 - char* avc_extra_data; 238 + int avc_extra_size;
  239 + char* avc_extra_data;
233 // the aac extra data, the AAC sequence header, 240 // the aac extra data, the AAC sequence header,
234 // without the flv codec header, 241 // without the flv codec header,
235 // @see: ffmpeg, AVCodecContext::extradata 242 // @see: ffmpeg, AVCodecContext::extradata
236 - int aac_extra_size;  
237 - char* aac_extra_data; 243 + int aac_extra_size;
  244 + char* aac_extra_data;
238 public: 245 public:
239 SrsAvcAacCodec(); 246 SrsAvcAacCodec();
240 virtual ~SrsAvcAacCodec(); 247 virtual ~SrsAvcAacCodec();