Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-2-2
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-2-2
Commits
4598f227
Commit
4598f227
authored
Aug 14, 2006
by
Gildas Bazin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
* modules/packetizer/h264.c: insert an SPS and PPS before each keyframe.
parent
c72c4815
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
35 additions
and
25 deletions
+35
-25
modules/packetizer/h264.c
modules/packetizer/h264.c
+35
-25
No files found.
modules/packetizer/h264.c
View file @
4598f227
...
...
@@ -284,7 +284,7 @@ static block_t *Packetize( decoder_t *p_dec, block_t **pp_block )
switch
(
p_sys
->
i_state
)
{
case
STATE_NOSYNC
:
/* Skip until
l
3 byte startcode 0 0 1 */
/* Skip until 3 byte startcode 0 0 1 */
if
(
block_FindStartcodeFromOffset
(
&
p_sys
->
bytestream
,
&
p_sys
->
i_offset
,
p_sys
->
startcode
+
1
,
3
)
==
VLC_SUCCESS
)
{
...
...
@@ -354,7 +354,7 @@ static block_t *Packetize( decoder_t *p_dec, block_t **pp_block )
/****************************************************************************
* PacketizeAVC1: Takes VCL blocks of data and creates annexe B type NAL stream
* Will always use 4 byte 0 0 0 1 startcodes
*
Should prepend the SPS and PPS to the front of the stream
*
Will prepend a SPS and PPS before each keyframe
****************************************************************************/
static
block_t
*
PacketizeAVC1
(
decoder_t
*
p_dec
,
block_t
**
pp_block
)
{
...
...
@@ -368,22 +368,6 @@ static block_t *PacketizeAVC1( decoder_t *p_dec, block_t **pp_block )
p_block
=
*
pp_block
;
*
pp_block
=
NULL
;
#if 0
if( //(p_block->i_flags & BLOCK_FLAG_TYPE_I) &&
p_sys->p_sps && p_sys->p_pps )
{
block_t *p_pic;
block_t *p_sps = block_Duplicate( p_sys->p_sps );
block_t *p_pps = block_Duplicate( p_sys->p_pps );
p_sps->i_dts = p_pps->i_dts = p_block->i_dts;
p_sps->i_pts = p_pps->i_pts = p_block->i_pts;
p_pic = ParseNALBlock( p_dec, p_sps );
if( p_pic ) block_ChainAppend( &p_ret, p_pic );
p_pic = ParseNALBlock( p_dec, p_pps );
if( p_pic ) block_ChainAppend( &p_ret, p_pic );
}
#endif
for
(
p
=
p_block
->
p_buffer
;
p
<
&
p_block
->
p_buffer
[
p_block
->
i_buffer
];
)
{
block_t
*
p_pic
;
...
...
@@ -490,12 +474,24 @@ static block_t *ParseNALBlock( decoder_t *p_dec, block_t *p_frag )
const
int
i_nal_type
=
p_frag
->
p_buffer
[
4
]
&
0x1f
;
#define OUTPUT \
do { \
p_pic = block_ChainGather( p_sys->p_frame ); \
p_pic->i_length = 0;
/* FIXME */
\
\
p_sys->p_frame = NULL; \
p_sys->b_slice = VLC_FALSE; \
do { \
p_pic = block_ChainGather( p_sys->p_frame ); \
p_pic->i_length = 0;
/* FIXME */
\
\
p_sys->p_frame = NULL; \
p_sys->b_slice = VLC_FALSE; \
\
if( ( p_pic->i_flags & BLOCK_FLAG_TYPE_I ) && \
p_sys->p_sps && p_sys->p_pps ) \
{ \
block_t *p_sps = block_Duplicate( p_sys->p_sps ); \
block_t *p_pps = block_Duplicate( p_sys->p_pps ); \
p_sps->i_dts = p_pps->i_dts = p_pic->i_dts; \
p_sps->i_pts = p_pps->i_pts = p_pic->i_pts; \
block_ChainAppend( &p_sps, p_pps ); \
block_ChainAppend( &p_sps, p_pic ); \
p_pic = block_ChainGather( p_sps ); \
} \
} while(0)
...
...
@@ -549,6 +545,7 @@ static block_t *ParseNALBlock( decoder_t *p_dec, block_t *p_frag )
i_pic_flags
=
BLOCK_FLAG_TYPE_I
;
break
;
}
p_frag
->
i_flags
|=
i_pic_flags
;
/* pic_parameter_set_id */
bs_read_ue
(
&
s
);
...
...
@@ -709,8 +706,14 @@ static block_t *ParseNALBlock( decoder_t *p_dec, block_t *p_frag )
free
(
dec
);
if
(
p_sys
->
b_slice
)
OUTPUT
;
/* We have a new SPS */
if
(
p_sys
->
p_sps
)
block_Release
(
p_sys
->
p_sps
);
p_sys
->
p_sps
=
p_frag
;
/* Do not append the SPS because we will insert it on keyframes */
return
p_pic
;
}
else
if
(
i_nal_type
==
NAL_PPS
)
{
...
...
@@ -723,6 +726,13 @@ static block_t *ParseNALBlock( decoder_t *p_dec, block_t *p_frag )
/* TODO */
if
(
p_sys
->
b_slice
)
OUTPUT
;
/* We have a new PPS */
if
(
p_sys
->
p_pps
)
block_Release
(
p_sys
->
p_pps
);
p_sys
->
p_pps
=
p_frag
;
/* Do not append the PPS because we will insert it on keyframes */
return
p_pic
;
}
else
if
(
i_nal_type
==
NAL_AU_DELIMITER
||
i_nal_type
==
NAL_SEI
||
...
...
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