Toggle navigation
Toggle navigation
此项目
正在载入...
Sign in
胡斌
/
srs
转到一个项目
Toggle navigation
项目
群组
代码片段
帮助
Toggle navigation pinning
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
winlin
2015-03-08 18:33:35 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
2e9f2753c91894e809a6a59a744baa078580f5b8
2e9f2753
1 parent
885b9af1
for #316, add stream codec info. 2.0.135
隐藏空白字符变更
内嵌
并排对比
正在显示
6 个修改的文件
包含
109 行增加
和
17 行删除
trunk/src/app/srs_app_source.cpp
trunk/src/app/srs_app_statistic.cpp
trunk/src/app/srs_app_statistic.hpp
trunk/src/core/srs_core.hpp
trunk/src/kernel/srs_kernel_codec.cpp
trunk/src/kernel/srs_kernel_codec.hpp
trunk/src/app/srs_app_source.cpp
查看文件 @
2e9f275
...
...
@@ -1531,9 +1531,10 @@ int SrsSource::on_video(SrsCommonMessage* __video)
}
srs_trace
(
"%dB video sh, "
"codec(%d, profile=%
d, level=%d
, %dx%d, %dkbps, %dfps, %ds)"
,
"codec(%d, profile=%
s, level=%s
, %dx%d, %dkbps, %dfps, %ds)"
,
msg
.
size
,
codec
.
video_codec_id
,
codec
.
avc_profile
,
codec
.
avc_level
,
codec
.
width
,
codec
.
height
,
srs_codec_avc_profile2str
(
codec
.
avc_profile
).
c_str
(),
srs_codec_avc_level2str
(
codec
.
avc_level
).
c_str
(),
codec
.
width
,
codec
.
height
,
codec
.
video_data_rate
/
1000
,
codec
.
frame_rate
,
codec
.
duration
);
return
ret
;
}
...
...
trunk/src/app/srs_app_statistic.cpp
查看文件 @
2e9f275
...
...
@@ -53,8 +53,8 @@ SrsStatisticStream::SrsStatisticStream()
has_video
=
false
;
vcodec
=
SrsCodecVideoReserved
;
avc_profile
=
0
;
avc_level
=
0
;
avc_profile
=
SrsAvcProfileReserved
;
avc_level
=
SrsAvcLevelReserved
;
has_audio
=
false
;
acodec
=
SrsCodecAudioReserved1
;
...
...
@@ -111,7 +111,7 @@ SrsStatistic* SrsStatistic::instance()
}
int
SrsStatistic
::
on_video_info
(
SrsRequest
*
req
,
SrsCodecVideo
vcodec
,
u_int8_t
avc_profile
,
u_int8_t
avc_level
SrsCodecVideo
vcodec
,
SrsAvcProfile
avc_profile
,
SrsAvcLevel
avc_level
)
{
int
ret
=
ERROR_SUCCESS
;
...
...
@@ -243,8 +243,8 @@ int SrsStatistic::dumps_streams(stringstream& ss)
ss
<<
__SRS_JFIELD_NAME
(
"video"
)
<<
__SRS_JOBJECT_START
<<
__SRS_JFIELD_STR
(
"codec"
,
srs_codec_video2str
(
stream
->
vcodec
))
<<
__SRS_JFIELD_CONT
<<
__SRS_JFIELD_ORG
(
"profile"
,
(
int
)
stream
->
avc_profile
)
<<
__SRS_JFIELD_CONT
<<
__SRS_JFIELD_ORG
(
"level"
,
(
int
)
stream
->
avc_level
)
<<
__SRS_JFIELD_STR
(
"profile"
,
srs_codec_avc_profile2str
(
stream
->
avc_profile
))
<<
__SRS_JFIELD_CONT
<<
__SRS_JFIELD_ORG
(
"level"
,
srs_codec_avc_level2str
(
stream
->
avc_level
))
<<
__SRS_JOBJECT_END
<<
__SRS_JFIELD_CONT
;
}
...
...
trunk/src/app/srs_app_statistic.hpp
查看文件 @
2e9f275
...
...
@@ -59,9 +59,9 @@ public:
bool
has_video
;
SrsCodecVideo
vcodec
;
// 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
;
public
:
bool
has_audio
;
SrsCodecAudio
acodec
;
...
...
@@ -113,7 +113,7 @@ public:
* when got video info for stream.
*/
virtual
int
on_video_info
(
SrsRequest
*
req
,
SrsCodecVideo
vcodec
,
u_int8_t
avc_profile
,
u_int8_t
avc_level
SrsCodecVideo
vcodec
,
SrsAvcProfile
avc_profile
,
SrsAvcLevel
avc_level
);
/**
* when got audio info for stream.
...
...
trunk/src/core/srs_core.hpp
查看文件 @
2e9f275
...
...
@@ -31,7 +31,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// current release version
#define VERSION_MAJOR 2
#define VERSION_MINOR 0
#define VERSION_REVISION 13
4
#define VERSION_REVISION 13
5
// server info.
#define RTMP_SIG_SRS_KEY "SRS"
...
...
trunk/src/kernel/srs_kernel_codec.cpp
查看文件 @
2e9f275
...
...
@@ -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
();
...
...
trunk/src/kernel/srs_kernel_codec.hpp
查看文件 @
2e9f275
...
...
@@ -417,6 +417,57 @@ SrsAacObjectType srs_codec_aac_ts2rtmp(SrsAacProfile 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.
*
* to demux the FLV/RTMP video/audio packet to sample,
...
...
@@ -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
;
...
...
请
注册
或
登录
后发表评论