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

Francois Cartegnie git at videolan.org
Thu Oct 4 17:20:54 CEST 2018


vlc/vlc-3.0 | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Fri Sep 28 16:46:10 2018 +0200| [bb447e5bfcb77e7abd7d692ac153f4709bda3c47] | committer: Tristan Matthews

demux: mp4: add AV1 missing temporal delimiters

(cherry picked from commit 0d5de3730835d84ae435cd949344631c850bb69f)

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

 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 a85a5d3d2b..69c5f5bdb0 100644
--- a/modules/demux/mp4/mp4.c
+++ b/modules/demux/mp4/mp4.c
@@ -410,6 +410,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 */
@@ -566,6 +582,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