[vlc-commits] packetizer: add AnyAnnexB helper

Francois Cartegnie git at videolan.org
Wed Oct 5 14:19:47 CEST 2016


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Tue Oct  4 23:20:57 2016 +0200| [5170e6373d2de737c7cad56ae99546986fc49a55] | committer: Francois Cartegnie

packetizer: add AnyAnnexB helper

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

 modules/packetizer/startcode_helper.h | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/modules/packetizer/startcode_helper.h b/modules/packetizer/startcode_helper.h
index 94696a7..04d79a2 100644
--- a/modules/packetizer/startcode_helper.h
+++ b/modules/packetizer/startcode_helper.h
@@ -143,6 +143,23 @@ static inline const uint8_t * startcode_FindAnnexB( const uint8_t *p, const uint
     return NULL;
 }
 
+/* Special variation to return on prefix only and no data */
+static inline const uint8_t * startcode_FindAnyAnnexB( const uint8_t *p, const uint8_t *end )
+{
+    size_t i_size = end - p;
+    if( i_size <= 4 )
+    {
+        if( i_size == 4 )
+        {
+            TRY_MATCH(p, 0);
+        }
+        else  if ( i_size == 3 && p[0] == 0 && p[1] == 0 && p[2] == 1 )
+             return p;
+        return NULL;
+    }
+    else return startcode_FindAnnexB( p, end );
+}
+
 #undef TRY_MATCH
 
 #endif



More information about the vlc-commits mailing list