[vlc-commits] packetizer: add startcode helper to packetizer's

Francois Cartegnie git at videolan.org
Tue Jan 5 19:19:52 CET 2016


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Tue Jan  5 16:33:10 2016 +0100| [0aebb95c33df24ff4d76f7935f03aa9be01187d1] | committer: Francois Cartegnie

packetizer: add startcode helper to packetizer's

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=0aebb95c33df24ff4d76f7935f03aa9be01187d1
---

 modules/packetizer/h264.c              |    2 +-
 modules/packetizer/hevc.c              |    2 +-
 modules/packetizer/mpeg4video.c        |    2 +-
 modules/packetizer/mpegvideo.c         |    2 +-
 modules/packetizer/packetizer_helper.h |    9 +++++++--
 modules/packetizer/vc1.c               |    2 +-
 6 files changed, 12 insertions(+), 7 deletions(-)

diff --git a/modules/packetizer/h264.c b/modules/packetizer/h264.c
index d6f19e3..c0c1cc0 100644
--- a/modules/packetizer/h264.c
+++ b/modules/packetizer/h264.c
@@ -195,7 +195,7 @@ static int Open( vlc_object_t *p_this )
     }
 
     packetizer_Init( &p_sys->packetizer,
-                     p_h264_startcode, sizeof(p_h264_startcode),
+                     p_h264_startcode, sizeof(p_h264_startcode), NULL,
                      p_h264_startcode, 1, 5,
                      PacketizeReset, PacketizeParse, PacketizeValidate, p_dec );
 
diff --git a/modules/packetizer/hevc.c b/modules/packetizer/hevc.c
index 3403638..2edfdb4 100644
--- a/modules/packetizer/hevc.c
+++ b/modules/packetizer/hevc.c
@@ -100,7 +100,7 @@ static int Open(vlc_object_t *p_this)
     p_sys->pp_frame_last = &p_sys->p_frame;
 
     packetizer_Init(&p_dec->p_sys->packetizer,
-                    p_hevc_startcode, sizeof(p_hevc_startcode),
+                    p_hevc_startcode, sizeof(p_hevc_startcode), NULL,
                     p_hevc_startcode, 1, 5,
                     PacketizeReset, PacketizeParse, PacketizeValidate, p_dec);
 
diff --git a/modules/packetizer/mpeg4video.c b/modules/packetizer/mpeg4video.c
index 3d2a99b..71e1548 100644
--- a/modules/packetizer/mpeg4video.c
+++ b/modules/packetizer/mpeg4video.c
@@ -142,7 +142,7 @@ static int Open( vlc_object_t *p_this )
 
     /* Misc init */
     packetizer_Init( &p_sys->packetizer,
-                     p_mp4v_startcode, sizeof(p_mp4v_startcode),
+                     p_mp4v_startcode, sizeof(p_mp4v_startcode), NULL,
                      NULL, 0, 4,
                      PacketizeReset, PacketizeParse, PacketizeValidate, p_dec );
 
diff --git a/modules/packetizer/mpegvideo.c b/modules/packetizer/mpegvideo.c
index f936e1e..84f9798 100644
--- a/modules/packetizer/mpegvideo.c
+++ b/modules/packetizer/mpegvideo.c
@@ -168,7 +168,7 @@ static int Open( vlc_object_t *p_this )
 
     /* Misc init */
     packetizer_Init( &p_sys->packetizer,
-                     p_mp2v_startcode, sizeof(p_mp2v_startcode),
+                     p_mp2v_startcode, sizeof(p_mp2v_startcode), NULL,
                      NULL, 0, 4,
                      PacketizeReset, PacketizeParse, PacketizeValidate, p_dec );
 
diff --git a/modules/packetizer/packetizer_helper.h b/modules/packetizer/packetizer_helper.h
index 7503ed1..9e6841c 100644
--- a/modules/packetizer/packetizer_helper.h
+++ b/modules/packetizer/packetizer_helper.h
@@ -49,6 +49,7 @@ typedef struct
 
     int i_startcode;
     const uint8_t *p_startcode;
+    block_startcode_helper_t pf_startcode_helper;
 
     int i_au_prepend;
     const uint8_t *p_au_prepend;
@@ -64,6 +65,7 @@ typedef struct
 
 static inline void packetizer_Init( packetizer_t *p_pack,
                                     const uint8_t *p_startcode, int i_startcode,
+                                    block_startcode_helper_t pf_start_helper,
                                     const uint8_t *p_au_prepend, int i_au_prepend,
                                     unsigned i_au_min_size,
                                     packetizer_reset_t pf_reset,
@@ -82,6 +84,7 @@ static inline void packetizer_Init( packetizer_t *p_pack,
 
     p_pack->i_startcode = i_startcode;
     p_pack->p_startcode = p_startcode;
+    p_pack->pf_startcode_helper = pf_start_helper;
     p_pack->pf_reset = pf_reset;
     p_pack->pf_parse = pf_parse;
     p_pack->pf_validate = pf_validate;
@@ -132,7 +135,8 @@ static inline block_t *packetizer_Packetize( packetizer_t *p_pack, block_t **pp_
         case STATE_NOSYNC:
             /* Find a startcode */
             if( !block_FindStartcodeFromOffset( &p_pack->bytestream, &p_pack->i_offset,
-                                                p_pack->p_startcode, p_pack->i_startcode, NULL ) )
+                                                p_pack->p_startcode, p_pack->i_startcode,
+                                                p_pack->pf_startcode_helper ) )
                 p_pack->i_state = STATE_NEXT_SYNC;
 
             if( p_pack->i_offset )
@@ -150,7 +154,8 @@ static inline block_t *packetizer_Packetize( packetizer_t *p_pack, block_t **pp_
         case STATE_NEXT_SYNC:
             /* Find the next startcode */
             if( block_FindStartcodeFromOffset( &p_pack->bytestream, &p_pack->i_offset,
-                                               p_pack->p_startcode, p_pack->i_startcode, NULL ) )
+                                               p_pack->p_startcode, p_pack->i_startcode,
+                                               p_pack->pf_startcode_helper ) )
             {
                 if( !p_pack->b_flushing || !p_pack->bytestream.p_chain )
                     return NULL; /* Need more data */
diff --git a/modules/packetizer/vc1.c b/modules/packetizer/vc1.c
index 74735ce..cb250f9 100644
--- a/modules/packetizer/vc1.c
+++ b/modules/packetizer/vc1.c
@@ -155,7 +155,7 @@ static int Open( vlc_object_t *p_this )
         return VLC_ENOMEM;
 
     packetizer_Init( &p_sys->packetizer,
-                     p_vc1_startcode, sizeof(p_vc1_startcode),
+                     p_vc1_startcode, sizeof(p_vc1_startcode), NULL,
                      NULL, 0, 4,
                      PacketizeReset, PacketizeParse, PacketizeValidate, p_dec );
 



More information about the vlc-commits mailing list