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
2013-11-17 23:34:36 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
89332789d1688cfb8be200515b8925587813c383
89332789
1 parent
611d2a7e
update ts_info, parse header, adaption field and PAT
隐藏空白字符变更
内嵌
并排对比
正在显示
1 个修改的文件
包含
29 行增加
和
15 行删除
trunk/research/ts_info.cpp
trunk/research/ts_info.cpp
查看文件 @
8933278
...
...
@@ -117,7 +117,7 @@ struct TSPacket
return
ret
;
}
}
header
;
}
*
header
;
// variant ts packet adation field.
struct
AdaptionField
...
...
@@ -334,7 +334,7 @@ struct TSPacket
return
ret
;
}
}
adaption_field
;
}
*
adaption_field
;
// variant ts packet payload.
// PES packet or PSI table.
...
...
@@ -384,7 +384,7 @@ struct TSPacket
{
int
ret
=
0
;
size
=
ppkt
->
payload
.
size
-
ppkt
->
payload
.
pointer_field_size
;
size
=
ppkt
->
payload
->
size
-
ppkt
->
payload
->
pointer_field_size
;
// not parsed bytes.
if
(
size
>
0
)
{
...
...
@@ -526,12 +526,12 @@ struct TSPacket
{
int
ret
=
0
;
if
(
ppkt
->
header
.
payload_unit_start_indicator
)
{
if
(
ppkt
->
header
->
payload_unit_start_indicator
)
{
pointer_field
=
*
p
++
;
pointer_field_size
=
1
;
}
if
(
ppkt
->
header
.
pid
==
PID_PAT
)
{
if
(
ppkt
->
header
->
pid
==
PID_PAT
)
{
type
=
TypePAT
;
pat
=
new
PAT
();
return
pat
->
demux
(
ppkt
,
start
,
last
,
p
);
...
...
@@ -546,29 +546,43 @@ struct TSPacket
return
ret
;
}
}
payload
;
}
*
payload
;
TSPacket
()
{
header
=
new
Header
();
adaption_field
=
new
AdaptionField
();
payload
=
new
Payload
();
}
virtual
~
TSPacket
()
{
srs_freep
(
header
);
srs_freep
(
adaption_field
);
srs_freep
(
payload
);
}
int
demux
(
u_int8_t
*
start
,
u_int8_t
*
last
,
u_int8_t
*&
p
)
{
int
ret
=
0
;
if
((
ret
=
header
.
demux
(
this
,
start
,
last
,
p
))
!=
0
)
{
if
((
ret
=
header
->
demux
(
this
,
start
,
last
,
p
))
!=
0
)
{
return
ret
;
}
if
(
header
.
adaption_field_control
==
AFC_ADAPTION_ONLY
||
header
.
adaption_field_control
==
AFC_BOTH
)
{
if
((
ret
=
adaption_field
.
demux
(
this
,
start
,
last
,
p
))
!=
0
)
{
if
(
header
->
adaption_field_control
==
AFC_ADAPTION_ONLY
||
header
->
adaption_field_control
==
AFC_BOTH
)
{
if
((
ret
=
adaption_field
->
demux
(
this
,
start
,
last
,
p
))
!=
0
)
{
trace
(
"ts+header af(adaption field) decode error. ret=%d"
,
ret
);
return
ret
;
}
trace
(
"ts+header af(adaption field decoded."
);
trace
(
"ts+header af(adaption field
)
decoded."
);
}
// calc the user defined data size for payload.
payload
.
size
=
TS_PACKET_SIZE
-
header
.
get_size
()
-
adaption_field
.
get_size
();
payload
->
size
=
TS_PACKET_SIZE
-
header
->
get_size
()
-
adaption_field
->
get_size
();
if
(
header
.
adaption_field_control
==
AFC_PAYLOAD_ONLY
||
header
.
adaption_field_control
==
AFC_BOTH
)
{
if
((
ret
=
payload
.
demux
(
this
,
start
,
last
,
p
))
!=
0
)
{
if
(
header
->
adaption_field_control
==
AFC_PAYLOAD_ONLY
||
header
->
adaption_field_control
==
AFC_BOTH
)
{
if
((
ret
=
payload
->
demux
(
this
,
start
,
last
,
p
))
!=
0
)
{
trace
(
"ts+header payload decode error. ret=%d"
,
ret
);
return
ret
;
}
...
...
@@ -576,8 +590,8 @@ struct TSPacket
}
trace
(
"ts+header parsed finished. parsed: %d left: %d header: %d payload: %d(%d+%d)"
,
(
int
)(
p
-
start
),
(
int
)(
last
-
p
),
header
.
get_size
(),
payload
.
size
,
payload
.
pointer_field_size
,
payload
.
size
-
payload
.
pointer_field_size
);
(
int
)(
p
-
start
),
(
int
)(
last
-
p
),
header
->
get_size
(),
payload
->
size
,
payload
->
pointer_field_size
,
payload
->
size
-
payload
->
pointer_field_size
);
return
finish
();
}
...
...
请
注册
或
登录
后发表评论