mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
refine the hls codec, add comments.
This commit is contained in:
parent
a4d3283cdd
commit
e50968f404
1 changed files with 40 additions and 33 deletions
|
@ -48,12 +48,12 @@ class SrsStream;
|
||||||
enum SrsCodecAudioSampleRate
|
enum SrsCodecAudioSampleRate
|
||||||
{
|
{
|
||||||
// set to the max value to reserved, for array map.
|
// set to the max value to reserved, for array map.
|
||||||
SrsCodecAudioSampleRateReserved = 4,
|
SrsCodecAudioSampleRateReserved = 4,
|
||||||
|
|
||||||
SrsCodecAudioSampleRate5512 = 0,
|
SrsCodecAudioSampleRate5512 = 0,
|
||||||
SrsCodecAudioSampleRate11025 = 1,
|
SrsCodecAudioSampleRate11025 = 1,
|
||||||
SrsCodecAudioSampleRate22050 = 2,
|
SrsCodecAudioSampleRate22050 = 2,
|
||||||
SrsCodecAudioSampleRate44100 = 3,
|
SrsCodecAudioSampleRate44100 = 3,
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -67,10 +67,10 @@ enum SrsCodecAudioSampleRate
|
||||||
enum SrsCodecAudioSampleSize
|
enum SrsCodecAudioSampleSize
|
||||||
{
|
{
|
||||||
// set to the max value to reserved, for array map.
|
// set to the max value to reserved, for array map.
|
||||||
SrsCodecAudioSampleSizeReserved = 2,
|
SrsCodecAudioSampleSizeReserved = 2,
|
||||||
|
|
||||||
SrsCodecAudioSampleSize8bit = 0,
|
SrsCodecAudioSampleSize8bit = 0,
|
||||||
SrsCodecAudioSampleSize16bit = 1,
|
SrsCodecAudioSampleSize16bit = 1,
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -82,10 +82,10 @@ enum SrsCodecAudioSampleSize
|
||||||
enum SrsCodecAudioSoundType
|
enum SrsCodecAudioSoundType
|
||||||
{
|
{
|
||||||
// set to the max value to reserved, for array map.
|
// set to the max value to reserved, for array map.
|
||||||
SrsCodecAudioSoundTypeReserved = 2,
|
SrsCodecAudioSoundTypeReserved = 2,
|
||||||
|
|
||||||
SrsCodecAudioSoundTypeMono = 0,
|
SrsCodecAudioSoundTypeMono = 0,
|
||||||
SrsCodecAudioSoundTypeStereo = 1,
|
SrsCodecAudioSoundTypeStereo = 1,
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -134,6 +134,9 @@ public:
|
||||||
int nb_sample_units;
|
int nb_sample_units;
|
||||||
SrsCodecSampleUnit sample_units[SRS_MAX_CODEC_SAMPLE];
|
SrsCodecSampleUnit sample_units[SRS_MAX_CODEC_SAMPLE];
|
||||||
public:
|
public:
|
||||||
|
/**
|
||||||
|
* whether the sample is video sample which demux from video packet.
|
||||||
|
*/
|
||||||
bool is_video;
|
bool is_video;
|
||||||
/**
|
/**
|
||||||
* CompositionTime, video_file_format_spec_v10_1.pdf, page 78.
|
* CompositionTime, video_file_format_spec_v10_1.pdf, page 78.
|
||||||
|
@ -189,52 +192,56 @@ class SrsAvcAacCodec
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
SrsStream* stream;
|
SrsStream* stream;
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
* metadata specified
|
||||||
|
*/
|
||||||
|
int duration;
|
||||||
|
int width;
|
||||||
|
int height;
|
||||||
|
int frame_rate;
|
||||||
|
// @see: SrsCodecVideo
|
||||||
|
int video_codec_id;
|
||||||
|
int video_data_rate; // in bps
|
||||||
|
// @see: SrsCod ecAudioType
|
||||||
|
int audio_codec_id;
|
||||||
|
int audio_data_rate; // in bps
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
* video specified
|
* video specified
|
||||||
*/
|
*/
|
||||||
// @see: SrsCodecVideo
|
|
||||||
int video_codec_id;
|
|
||||||
// profile_idc, H.264-AVC-ISO_IEC_14496-10.pdf, page 45.
|
// profile_idc, H.264-AVC-ISO_IEC_14496-10.pdf, page 45.
|
||||||
u_int8_t avc_profile;
|
u_int8_t avc_profile;
|
||||||
// level_idc, H.264-AVC-ISO_IEC_14496-10.pdf, page 45.
|
// level_idc, H.264-AVC-ISO_IEC_14496-10.pdf, page 45.
|
||||||
u_int8_t avc_level;
|
u_int8_t avc_level;
|
||||||
int width;
|
|
||||||
int height;
|
|
||||||
int video_data_rate; // in bps
|
|
||||||
int frame_rate;
|
|
||||||
int duration;
|
|
||||||
// lengthSizeMinusOne, H.264-AVC-ISO_IEC_14496-15.pdf, page 16
|
// lengthSizeMinusOne, H.264-AVC-ISO_IEC_14496-15.pdf, page 16
|
||||||
int8_t NAL_unit_length;
|
int8_t NAL_unit_length;
|
||||||
u_int16_t sequenceParameterSetLength;
|
u_int16_t sequenceParameterSetLength;
|
||||||
char* sequenceParameterSetNALUnit;
|
char* sequenceParameterSetNALUnit;
|
||||||
u_int16_t pictureParameterSetLength;
|
u_int16_t pictureParameterSetLength;
|
||||||
char* pictureParameterSetNALUnit;
|
char* pictureParameterSetNALUnit;
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
* audio specified
|
* audio specified
|
||||||
*/
|
*/
|
||||||
// @see: SrsCodecAudioType
|
|
||||||
int audio_codec_id;
|
|
||||||
int audio_data_rate; // in bps
|
|
||||||
// 1.6.2.1 AudioSpecificConfig, in aac-mp4a-format-ISO_IEC_14496-3+2001.pdf, page 33.
|
// 1.6.2.1 AudioSpecificConfig, in aac-mp4a-format-ISO_IEC_14496-3+2001.pdf, page 33.
|
||||||
// audioObjectType, value defines in 7.1 Profiles, aac-iso-13818-7.pdf, page 40.
|
// audioObjectType, value defines in 7.1 Profiles, aac-iso-13818-7.pdf, page 40.
|
||||||
u_int8_t aac_profile;
|
u_int8_t aac_profile;
|
||||||
// samplingFrequencyIndex
|
// samplingFrequencyIndex
|
||||||
u_int8_t aac_sample_rate;
|
u_int8_t aac_sample_rate;
|
||||||
// channelConfiguration
|
// channelConfiguration
|
||||||
u_int8_t aac_channels;
|
u_int8_t aac_channels;
|
||||||
public:
|
public:
|
||||||
// the avc extra data, the AVC sequence header,
|
// the avc extra data, the AVC sequence header,
|
||||||
// without the flv codec header,
|
// without the flv codec header,
|
||||||
// @see: ffmpeg, AVCodecContext::extradata
|
// @see: ffmpeg, AVCodecContext::extradata
|
||||||
int avc_extra_size;
|
int avc_extra_size;
|
||||||
char* avc_extra_data;
|
char* avc_extra_data;
|
||||||
// the aac extra data, the AAC sequence header,
|
// the aac extra data, the AAC sequence header,
|
||||||
// without the flv codec header,
|
// without the flv codec header,
|
||||||
// @see: ffmpeg, AVCodecContext::extradata
|
// @see: ffmpeg, AVCodecContext::extradata
|
||||||
int aac_extra_size;
|
int aac_extra_size;
|
||||||
char* aac_extra_data;
|
char* aac_extra_data;
|
||||||
public:
|
public:
|
||||||
SrsAvcAacCodec();
|
SrsAvcAacCodec();
|
||||||
virtual ~SrsAvcAacCodec();
|
virtual ~SrsAvcAacCodec();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue