1
0
Fork 0
mirror of https://github.com/ossrs/srs.git synced 2025-03-09 15:49:59 +00:00

for #316, add stream codec info. 2.0.135

This commit is contained in:
winlin 2015-03-08 18:33:35 +08:00
parent 885b9af122
commit 2e9f2753c9
6 changed files with 109 additions and 17 deletions

View file

@ -121,6 +121,46 @@ SrsAacProfile srs_codec_aac_rtmp2ts(SrsAacObjectType object_type)
}
}
string srs_codec_avc_profile2str(SrsAvcProfile profile)
{
switch (profile) {
case SrsAvcProfileBaseline: return "Baseline";
case SrsAvcProfileConstrainedBaseline: return "Baseline(Constrained)";
case SrsAvcProfileMain: return "Main";
case SrsAvcProfileExtended: return "Extended";
case SrsAvcProfileHigh: return "High";
case SrsAvcProfileHigh10: return "High(10)";
case SrsAvcProfileHigh10Intra: return "High(10+Intra)";
case SrsAvcProfileHigh422: return "High(422)";
case SrsAvcProfileHigh422Intra: return "High(422+Intra)";
case SrsAvcProfileHigh444: return "High(444)";
case SrsAvcProfileHigh444Predictive: return "High(444+Predictive)";
case SrsAvcProfileHigh444Intra: return "High(444+Intra)";
default: return "Other";
}
}
string srs_codec_avc_level2str(SrsAvcLevel level)
{
switch (level) {
case SrsAvcLevel_1: return "1";
case SrsAvcLevel_11: return "1.1";
case SrsAvcLevel_12: return "1.2";
case SrsAvcLevel_13: return "1.3";
case SrsAvcLevel_2: return "2";
case SrsAvcLevel_21: return "2.1";
case SrsAvcLevel_22: return "2.2";
case SrsAvcLevel_3: return "3";
case SrsAvcLevel_31: return "3.1";
case SrsAvcLevel_32: return "3.2";
case SrsAvcLevel_4: return "4";
case SrsAvcLevel_41: return "4.1";
case SrsAvcLevel_5: return "5";
case SrsAvcLevel_51: return "5.1";
default: return "Other";
}
}
/**
* the public data, event HLS disable, others can use it.
*/
@ -292,8 +332,8 @@ SrsAvcAacCodec::SrsAvcAacCodec()
audio_data_rate = 0;
audio_codec_id = 0;
avc_profile = 0;
avc_level = 0;
avc_profile = SrsAvcProfileReserved;
avc_level = SrsAvcLevelReserved;
aac_object = SrsAacObjectTypeReserved;
aac_sample_rate = __SRS_AAC_SAMPLE_RATE_UNSET; // sample rate ignored
aac_channels = 0;
@ -651,11 +691,11 @@ int SrsAvcAacCodec::avc_demux_sps_pps(SrsStream* stream)
//int8_t configurationVersion = stream->read_1bytes();
stream->read_1bytes();
//int8_t AVCProfileIndication = stream->read_1bytes();
avc_profile = stream->read_1bytes();
avc_profile = (SrsAvcProfile)stream->read_1bytes();
//int8_t profile_compatibility = stream->read_1bytes();
stream->read_1bytes();
//int8_t AVCLevelIndication = stream->read_1bytes();
avc_level = stream->read_1bytes();
avc_level = (SrsAvcLevel)stream->read_1bytes();
// parse the NALU size.
int8_t lengthSizeMinusOne = stream->read_1bytes();

View file

@ -416,6 +416,57 @@ SrsAacObjectType srs_codec_aac_ts2rtmp(SrsAacProfile profile);
// RTMP sequence header object type to ts/hls/adts audio header profile.
SrsAacProfile srs_codec_aac_rtmp2ts(SrsAacObjectType object_type);
/**
* the profile for avc/h.264.
* @see Annex A Profiles and levels, H.264-AVC-ISO_IEC_14496-10.pdf, page 205.
*/
enum SrsAvcProfile
{
SrsAvcProfileReserved = 0,
// @see ffmpeg, libavcodec/avcodec.h:2713
SrsAvcProfileBaseline = 66,
// FF_PROFILE_H264_CONSTRAINED (1<<9) // 8+1; constraint_set1_flag
// FF_PROFILE_H264_CONSTRAINED_BASELINE (66|FF_PROFILE_H264_CONSTRAINED)
SrsAvcProfileConstrainedBaseline = 578,
SrsAvcProfileMain = 77,
SrsAvcProfileExtended = 88,
SrsAvcProfileHigh = 100,
SrsAvcProfileHigh10 = 110,
SrsAvcProfileHigh10Intra = 2158,
SrsAvcProfileHigh422 = 122,
SrsAvcProfileHigh422Intra = 2170,
SrsAvcProfileHigh444 = 144,
SrsAvcProfileHigh444Predictive = 244,
SrsAvcProfileHigh444Intra = 2192,
};
std::string srs_codec_avc_profile2str(SrsAvcProfile profile);
/**
* the level for avc/h.264.
* @see Annex A Profiles and levels, H.264-AVC-ISO_IEC_14496-10.pdf, page 207.
*/
enum SrsAvcLevel
{
SrsAvcLevelReserved = 0,
SrsAvcLevel_1 = 10,
SrsAvcLevel_11 = 11,
SrsAvcLevel_12 = 12,
SrsAvcLevel_13 = 13,
SrsAvcLevel_2 = 20,
SrsAvcLevel_21 = 21,
SrsAvcLevel_22 = 22,
SrsAvcLevel_3 = 30,
SrsAvcLevel_31 = 31,
SrsAvcLevel_32 = 32,
SrsAvcLevel_4 = 40,
SrsAvcLevel_41 = 41,
SrsAvcLevel_5 = 50,
SrsAvcLevel_51 = 51,
};
std::string srs_codec_avc_level2str(SrsAvcLevel level);
/**
* the h264/avc and aac codec, for media stream.
*
@ -453,9 +504,9 @@ public:
* video specified
*/
// profile_idc, H.264-AVC-ISO_IEC_14496-10.pdf, page 45.
u_int8_t avc_profile;
SrsAvcProfile avc_profile;
// level_idc, H.264-AVC-ISO_IEC_14496-10.pdf, page 45.
u_int8_t avc_level;
SrsAvcLevel avc_level;
// lengthSizeMinusOne, H.264-AVC-ISO_IEC_14496-15.pdf, page 16
int8_t NAL_unit_length;
u_int16_t sequenceParameterSetLength;