Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc
Commits
02650b60
Commit
02650b60
authored
Feb 19, 2010
by
Jean-Paul Saman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
packetizer/h264.c: improve SPS/PPS detection for frames
parent
b8b84564
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
52 additions
and
11 deletions
+52
-11
modules/packetizer/h264.c
modules/packetizer/h264.c
+52
-11
No files found.
modules/packetizer/h264.c
View file @
02650b60
...
...
@@ -92,10 +92,12 @@ struct decoder_sys_t
/* */
bool
b_slice
;
block_t
*
p_frame
;
bool
b_frame_sps
;
bool
b_frame_pps
;
bool
b_header
;
bool
b_sps
;
bool
b_pps
;
bool
b_header
;
bool
b_sps
;
bool
b_pps
;
block_t
*
pp_sps
[
SPS_MAX
];
block_t
*
pp_pps
[
PPS_MAX
];
...
...
@@ -151,6 +153,8 @@ enum nal_priority_e
NAL_PRIORITY_HIGHEST
=
3
,
};
#define BLOCK_FLAG_PRIVATE_AUD (1 << BLOCK_FLAG_PRIVATE_SHIFT)
static
block_t
*
Packetize
(
decoder_t
*
,
block_t
**
);
static
block_t
*
PacketizeAVC1
(
decoder_t
*
,
block_t
**
);
static
block_t
*
GetCc
(
decoder_t
*
p_dec
,
bool
pb_present
[
4
]
);
...
...
@@ -209,6 +213,8 @@ static int Open( vlc_object_t *p_this )
p_sys
->
b_slice
=
false
;
p_sys
->
p_frame
=
NULL
;
p_sys
->
b_frame_sps
=
false
;
p_sys
->
b_frame_pps
=
false
;
p_sys
->
b_header
=
false
;
p_sys
->
b_sps
=
false
;
p_sys
->
b_pps
=
false
;
...
...
@@ -506,6 +512,8 @@ static void PacketizeReset( void *p_private, bool b_broken )
if
(
p_sys
->
p_frame
)
block_ChainRelease
(
p_sys
->
p_frame
);
p_sys
->
p_frame
=
NULL
;
p_sys
->
b_frame_sps
=
false
;
p_sys
->
b_frame_pps
=
false
;
p_sys
->
slice
.
i_frame_type
=
0
;
p_sys
->
b_slice
=
false
;
}
...
...
@@ -645,6 +653,7 @@ static block_t *ParseNALBlock( decoder_t *p_dec, bool *pb_used_ts, block_t *p_fr
{
if
(
p_sys
->
b_slice
)
p_pic
=
OutputPicture
(
p_dec
);
p_sys
->
b_frame_sps
=
true
;
PutSPS
(
p_dec
,
p_frag
);
...
...
@@ -655,6 +664,7 @@ static block_t *ParseNALBlock( decoder_t *p_dec, bool *pb_used_ts, block_t *p_fr
{
if
(
p_sys
->
b_slice
)
p_pic
=
OutputPicture
(
p_dec
);
p_sys
->
b_frame_pps
=
true
;
PutPPS
(
p_dec
,
p_frag
);
...
...
@@ -670,7 +680,21 @@ static block_t *ParseNALBlock( decoder_t *p_dec, bool *pb_used_ts, block_t *p_fr
/* Parse SEI for CC support */
if
(
i_nal_type
==
NAL_SEI
)
{
ParseSei
(
p_dec
,
p_frag
);
}
else
if
(
i_nal_type
==
NAL_AU_DELIMITER
)
{
if
(
p_sys
->
p_frame
&&
(
p_sys
->
p_frame
->
i_flags
&
BLOCK_FLAG_PRIVATE_AUD
)
)
{
block_Release
(
p_frag
);
p_frag
=
NULL
;
}
else
{
p_frag
->
i_flags
|=
BLOCK_FLAG_PRIVATE_AUD
;
}
}
}
/* Append the block */
...
...
@@ -695,26 +719,40 @@ static block_t *OutputPicture( decoder_t *p_dec )
if
(
!
p_sys
->
b_header
&&
p_sys
->
slice
.
i_frame_type
!=
BLOCK_FLAG_TYPE_I
)
return
NULL
;
if
(
p_sys
->
slice
.
i_frame_type
==
BLOCK_FLAG_TYPE_I
&&
p_sys
->
b_sps
&&
p_sys
->
b_pps
)
const
bool
b_sps_pps_i
=
p_sys
->
slice
.
i_frame_type
==
BLOCK_FLAG_TYPE_I
&&
p_sys
->
b_sps
&&
p_sys
->
b_pps
;
if
(
b_sps_pps_i
||
p_sys
->
b_frame_sps
||
p_sys
->
b_frame_pps
)
{
block_t
*
p_list
=
NULL
;
int
i
;
block_t
*
p_head
=
NULL
;
if
(
p_sys
->
p_frame
->
i_flags
&
BLOCK_FLAG_PRIVATE_AUD
)
{
p_head
=
p_sys
->
p_frame
;
p_sys
->
p_frame
=
p_sys
->
p_frame
->
p_next
;
}
for
(
i
=
0
;
i
<
SPS_MAX
;
i
++
)
block_t
*
p_list
=
NULL
;
for
(
int
i
=
0
;
i
<
SPS_MAX
&&
(
b_sps_pps_i
||
p_sys
->
b_frame_sps
);
i
++
)
{
if
(
p_sys
->
pp_sps
[
i
]
)
block_ChainAppend
(
&
p_list
,
block_Duplicate
(
p_sys
->
pp_sps
[
i
]
)
);
}
for
(
i
=
0
;
i
<
PPS_MAX
;
i
++
)
for
(
int
i
=
0
;
i
<
PPS_MAX
&&
(
b_sps_pps_i
||
p_sys
->
b_frame_pps
);
i
++
)
{
if
(
p_sys
->
pp_pps
[
i
]
)
block_ChainAppend
(
&
p_list
,
block_Duplicate
(
p_sys
->
pp_pps
[
i
]
)
);
}
if
(
p_list
)
if
(
b_sps_pps_i
&&
p_list
)
p_sys
->
b_header
=
true
;
block_ChainAppend
(
&
p_list
,
p_sys
->
p_frame
);
p_pic
=
block_ChainGather
(
p_list
);
if
(
p_head
)
p_head
->
p_next
=
p_list
;
else
p_head
=
p_list
;
block_ChainAppend
(
&
p_head
,
p_sys
->
p_frame
);
p_pic
=
block_ChainGather
(
p_head
);
}
else
{
...
...
@@ -724,9 +762,12 @@ static block_t *OutputPicture( decoder_t *p_dec )
p_pic
->
i_pts
=
p_sys
->
i_frame_pts
;
p_pic
->
i_length
=
0
;
/* FIXME */
p_pic
->
i_flags
|=
p_sys
->
slice
.
i_frame_type
;
p_pic
->
i_flags
&=
~
BLOCK_FLAG_PRIVATE_AUD
;
p_sys
->
slice
.
i_frame_type
=
0
;
p_sys
->
p_frame
=
NULL
;
p_sys
->
b_frame_sps
=
false
;
p_sys
->
b_frame_pps
=
false
;
p_sys
->
i_frame_dts
=
-
1
;
p_sys
->
i_frame_pts
=
-
1
;
p_sys
->
b_slice
=
false
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment