[vlc-commits] demux: mp4: add AV1 missing temporal delimiters

Francois Cartegnie git at videolan.org
Mon Oct 1 16:59:57 CEST 2018


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Fri Sep 28 16:46:10 2018 +0200| [0d5de3730835d84ae435cd949344631c850bb69f] | committer: Francois Cartegnie

demux: mp4: add AV1 missing temporal delimiters

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

 modules/demux/mp4/mp4.c | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/modules/demux/mp4/mp4.c b/modules/demux/mp4/mp4.c
index e9f5fd6049..ce282c80dd 100644
--- a/modules/demux/mp4/mp4.c
+++ b/modules/demux/mp4/mp4.c
@@ -490,6 +490,22 @@ static int CreateTracks( demux_t *p_demux, unsigned i_tracks )
     return VLC_SUCCESS;
 }
 
+static block_t * MP4_AV1_Convert( block_t *p_block )
+{
+    /* See av1-isobmff 2.4 */
+    if( (p_block->p_buffer[0] & 0x81) == 0 && /* reserved flags */
+        (p_block->p_buffer[0] & 0x7A) != 0x12 ) /* not TEMPORAL_DELIMITER */
+    {
+        p_block = block_Realloc( p_block, 2, p_block->i_buffer );
+        if( p_block )
+        {
+            p_block->p_buffer[0] = 0x12;
+            p_block->p_buffer[1] = 0x00;
+        }
+    }
+    return p_block;
+}
+
 static block_t * MP4_EIA608_Convert( block_t * p_block )
 {
     /* Rebuild codec data from encap */
@@ -646,6 +662,10 @@ static block_t * MP4_Block_Convert( demux_t *p_demux, const mp4_track_t *p_track
             break;
         }
     }
+    else if( p_track->fmt.i_codec == VLC_CODEC_AV1 )
+    {
+        p_block = MP4_AV1_Convert( p_block );
+    }
     else if( p_track->fmt.i_original_fourcc == ATOM_rrtp )
     {
         p_block = MP4_RTPHint_Convert( p_demux, p_block, p_track->fmt.i_codec );



More information about the vlc-commits mailing list