[vlc-devel] commit: Added and used a packetizer_Header for packetizers. (Laurent Aimar )
git version control
git at videolan.org
Tue Apr 28 22:32:20 CEST 2009
vlc | branch: master | Laurent Aimar <fenrir at videolan.org> | Tue Apr 28 21:46:37 2009 +0200| [d813da5e18facf3287555fdc5ea22b3d516578b1] | committer: Laurent Aimar
Added and used a packetizer_Header for packetizers.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=d813da5e18facf3287555fdc5ea22b3d516578b1
---
modules/packetizer/h264.c | 15 ++-------------
modules/packetizer/packetizer_helper.h | 14 ++++++++++++++
modules/packetizer/vc1.c | 12 ++----------
3 files changed, 18 insertions(+), 23 deletions(-)
diff --git a/modules/packetizer/h264.c b/modules/packetizer/h264.c
index d1f7f88..534ee7b 100644
--- a/modules/packetizer/h264.c
+++ b/modules/packetizer/h264.c
@@ -355,19 +355,8 @@ static int Open( vlc_object_t *p_this )
/* */
if( p_dec->fmt_in.i_extra > 0 )
- {
- block_t *p_init = block_New( p_dec, p_dec->fmt_in.i_extra );
- block_t *p_pic;
-
- memcpy( p_init->p_buffer, p_dec->fmt_in.p_extra,
- p_dec->fmt_in.i_extra );
-
- while( ( p_pic = Packetize( p_dec, &p_init ) ) )
- {
- /* Should not occur because we should only receive SPS/PPS */
- block_Release( p_pic );
- }
- }
+ packetizer_Header( &p_sys->packetizer,
+ p_dec->fmt_in.p_extra, p_dec->fmt_in.i_extra );
}
return VLC_SUCCESS;
diff --git a/modules/packetizer/packetizer_helper.h b/modules/packetizer/packetizer_helper.h
index 33e9c77..1128a4d 100644
--- a/modules/packetizer/packetizer_helper.h
+++ b/modules/packetizer/packetizer_helper.h
@@ -182,5 +182,19 @@ static inline block_t *packetizer_Packetize( packetizer_t *p_pack, block_t **pp_
}
}
+static inline void packetizer_Header( packetizer_t *p_pack,
+ const uint8_t *p_header, int i_header )
+{
+ block_t *p_init = block_Alloc( i_header );
+ if( !p_init )
+ return;
+
+ memcpy( p_init->p_buffer, p_header, i_header );
+
+ block_t *p_pic;
+ while( ( p_pic = packetizer_Packetize( p_pack, &p_init ) ) )
+ block_Release( p_pic ); /* Should not happen (only sequence header) */
+}
+
#endif
diff --git a/modules/packetizer/vc1.c b/modules/packetizer/vc1.c
index 2cd4bc8..f8edd3a 100644
--- a/modules/packetizer/vc1.c
+++ b/modules/packetizer/vc1.c
@@ -165,16 +165,8 @@ static int Open( vlc_object_t *p_this )
/* */
if( p_dec->fmt_out.i_extra > 0 )
- {
- block_t *p_init = block_New( p_dec, p_dec->fmt_out.i_extra );
-
- memcpy( p_init->p_buffer, p_dec->fmt_out.p_extra,
- p_dec->fmt_out.i_extra );
-
- block_t *p_pic;
- while( ( p_pic = Packetize( p_dec, &p_init ) ) )
- block_Release( p_pic ); /* Should not happen (only sequence header) */
- }
+ packetizer_Header( &p_sys->packetizer,
+ p_dec->fmt_out.p_extra, p_dec->fmt_out.i_extra );
}
return VLC_SUCCESS;
More information about the vlc-devel
mailing list