[FFmpeg-devel] [PATCH 2/6] lavc/libx264: mark disposable frames

John Stebbins jstebbins at jetheaddev.com
Sun Nov 19 22:46:31 EET 2017


Used by movenc to fill sdtp box
---
 libavcodec/libx264.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/libavcodec/libx264.c b/libavcodec/libx264.c
index 9c67c91f33..1831f9b30e 100644
--- a/libavcodec/libx264.c
+++ b/libavcodec/libx264.c
@@ -116,6 +116,7 @@ static int encode_nals(AVCodecContext *ctx, AVPacket *pkt,
     X264Context *x4 = ctx->priv_data;
     uint8_t *p;
     int i, size = x4->sei_size, ret;
+    int disposable;
 
     if (!nnal)
         return 0;
@@ -140,10 +141,14 @@ static int encode_nals(AVCodecContext *ctx, AVPacket *pkt,
         av_freep(&x4->sei);
     }
 
+    disposable = AV_PKT_FLAG_DISPOSABLE;
     for (i = 0; i < nnal; i++){
         memcpy(p, nals[i].p_payload, nals[i].i_payload);
         p += nals[i].i_payload;
+        if (nals[i].i_ref_idc != NAL_PRIORITY_DISPOSABLE)
+            disposable = 0;
     }
+    pkt->flags |= disposable;
 
     return 1;
 }
-- 
2.13.6



More information about the ffmpeg-devel mailing list