[vlc-devel] commit: Fixed closed captions in h264 packetizer. (Laurent Aimar )
git version control
git at videolan.org
Mon Feb 9 22:24:33 CET 2009
vlc | branch: master | Laurent Aimar <fenrir at videolan.org> | Mon Feb 9 22:18:16 2009 +0100| [9ff86452d36944a0a6d373119487cbf43ff9eed1] | committer: Laurent Aimar
Fixed closed captions in h264 packetizer.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=9ff86452d36944a0a6d373119487cbf43ff9eed1
---
modules/packetizer/h264.c | 26 +++++++++++++++-----------
1 files changed, 15 insertions(+), 11 deletions(-)
diff --git a/modules/packetizer/h264.c b/modules/packetizer/h264.c
index b8ffeaf..e1cf4dd 100644
--- a/modules/packetizer/h264.c
+++ b/modules/packetizer/h264.c
@@ -125,11 +125,12 @@ struct decoder_sys_t
mtime_t i_frame_dts;
/* */
- bool b_cc_reset;
uint32_t i_cc_flags;
mtime_t i_cc_pts;
mtime_t i_cc_dts;
cc_data_t cc;
+
+ cc_data_t cc_next;
};
enum
@@ -349,11 +350,11 @@ static int Open( vlc_object_t *p_this )
p_dec->pf_get_cc = GetCc;
/* */
- p_sys->b_cc_reset = false;
p_sys->i_cc_pts = 0;
p_sys->i_cc_dts = 0;
p_sys->i_cc_flags = 0;
cc_Init( &p_sys->cc );
+ cc_Init( &p_sys->cc_next );
/* */
if( p_dec->fmt_in.i_extra > 0 )
@@ -398,7 +399,10 @@ static void Close( vlc_object_t *p_this )
}
block_BytestreamRelease( &p_sys->bytestream );
if( p_dec->pf_get_cc )
+ {
+ cc_Exit( &p_sys->cc_next );
cc_Exit( &p_sys->cc );
+ }
free( p_sys );
}
@@ -702,7 +706,7 @@ static block_t *ParseNALBlock( decoder_t *p_dec, bool *pb_used_ts, block_t *p_fr
p_sys->slice.i_frame_type = 0;
p_sys->p_frame = NULL;
p_sys->b_slice = false;
- p_sys->b_cc_reset = true;
+ cc_Flush( &p_sys->cc_next );
}
if( ( !p_sys->b_sps || !p_sys->b_pps ) &&
@@ -757,12 +761,6 @@ static block_t *ParseNALBlock( decoder_t *p_dec, bool *pb_used_ts, block_t *p_fr
ParseSei( p_dec, p_frag );
}
- if( !p_pic && p_sys->b_cc_reset )
- {
- p_sys->b_cc_reset = false;
- cc_Flush( &p_sys->cc );
- }
-
/* Append the block */
if( p_frag )
block_ChainAppend( &p_sys->p_frame, p_frag );
@@ -822,11 +820,17 @@ static block_t *OutputPicture( decoder_t *p_dec )
p_sys->b_slice = false;
/* CC */
- p_sys->b_cc_reset = true;
p_sys->i_cc_pts = p_pic->i_pts;
p_sys->i_cc_dts = p_pic->i_dts;
p_sys->i_cc_flags = p_pic->i_flags;
+ /* Swap cc buffer */
+ cc_data_t cc_tmp = p_sys->cc;
+ p_sys->cc = p_sys->cc_next;
+ p_sys->cc_next = cc_tmp;
+
+ cc_Flush( &p_sys->cc_next );
+
return p_pic;
}
@@ -1213,7 +1217,7 @@ static void ParseSei( decoder_t *p_dec, block_t *p_frag )
if( i_t35 >= 5 &&
!memcmp( p_t35, p_dvb1_data_start_code, sizeof(p_dvb1_data_start_code) ) )
{
- cc_Extract( &p_sys->cc, &p_t35[3], i_t35 - 3 );
+ cc_Extract( &p_sys->cc_next, &p_t35[3], i_t35 - 3 );
}
}
i_used += i_size;
More information about the vlc-devel
mailing list