[vlc-commits] packetizer: avparser: set proper frame flags

Francois Cartegnie git at videolan.org
Wed Apr 7 08:10:59 UTC 2021


vlc/vlc-3.0 | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Tue Apr  6 18:21:05 2021 +0200| [b620b2c3b07982a608f26a31a62de33d9b85c0a7] | committer: Francois Cartegnie

packetizer: avparser: set proper frame flags

(cherry picked from commit 0b94015abe92f2e2380bafe4232dc84c66585b9c)

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

 modules/packetizer/avparser.c | 22 ++++++++++++++++++++--
 1 file changed, 20 insertions(+), 2 deletions(-)

diff --git a/modules/packetizer/avparser.c b/modules/packetizer/avparser.c
index 033c71ab29..44131f9382 100644
--- a/modules/packetizer/avparser.c
+++ b/modules/packetizer/avparser.c
@@ -195,11 +195,29 @@ static block_t *Packetize ( decoder_t *p_dec, block_t **pp_block )
     memcpy( p_ret->p_buffer, p_outdata, i_outlen );
     p_ret->i_pts = p_block->i_pts;
     p_ret->i_dts = p_block->i_dts;
+    p_block->i_pts = p_block->i_dts = VLC_TS_INVALID;
+
+    if( p_dec->fmt_in.i_cat == VIDEO_ES )
+    {
+        switch ( p_sys->p_parser_ctx->pict_type )
+        {
+        case AV_PICTURE_TYPE_I:
+            p_ret->i_flags |= BLOCK_FLAG_TYPE_I;
+            break;
+        case AV_PICTURE_TYPE_P:
+            p_ret->i_flags |= BLOCK_FLAG_TYPE_P;
+            break;
+        case AV_PICTURE_TYPE_B:
+            p_ret->i_flags |= BLOCK_FLAG_TYPE_B;
+            break;
+        default:
+            break;
+        }
+    }
+
     if( p_sys->p_parser_ctx->key_frame == 1 )
         p_ret->i_flags |= BLOCK_FLAG_TYPE_I;
 
-    p_block->i_pts = p_block->i_dts = VLC_TS_INVALID;
-
     return p_ret;
 
 out:



More information about the vlc-commits mailing list