]> git.sesse.net Git - ffmpeg/commitdiff
lavc: move AVCodecContext.pkt to AVCodecInternal
authorAnton Khirnov <anton@khirnov.net>
Sun, 27 Oct 2013 12:12:53 +0000 (13:12 +0100)
committerAnton Khirnov <anton@khirnov.net>
Mon, 4 Nov 2013 07:51:26 +0000 (08:51 +0100)
It's a private field, not meant to be accessed from outside lavc.

libavcodec/avcodec.h
libavcodec/internal.h
libavcodec/pthread_frame.c
libavcodec/rawdec.c
libavcodec/utils.c
libavcodec/version.h

index 47fda6905e8f87b4ac6b22cabd4fe7a5ea1f4e81..d42febf6c485f5488c4d5616b8691cf28d87076f 100644 (file)
@@ -2672,14 +2672,13 @@ typedef struct AVCodecContext {
      */
     int error_rate;
 
+#if FF_API_CODEC_PKT
     /**
-     * Current packet as passed into the decoder, to avoid having
-     * to pass the packet into every function. Currently only valid
-     * inside lavc and get/release_buffer callbacks.
-     * - decoding: set by avcodec_decode_*, read by get_buffer() for setting pkt_pts
-     * - encoding: unused
+     * @deprecated this field is not supposed to be accessed from outside lavc
      */
+    attribute_deprecated
     AVPacket *pkt;
+#endif
 
     /**
      * VBV delay coded in the last frame (in periods of a 27 MHz clock).
index 9a57209c69c4b45795db836d5af7eaf63f5788f8..4648c02e094bb86200d153dc0b2303d0ac87cc04 100644 (file)
@@ -88,6 +88,12 @@ typedef struct AVCodecInternal {
     FramePool *pool;
 
     void *thread_ctx;
+
+    /**
+     * Current packet as passed into the decoder, to avoid having to pass the
+     * packet into every function.
+     */
+    AVPacket *pkt;
 } AVCodecInternal;
 
 struct AVCodecDefault {
index c2d12c854fb52d580ebf5758c85312988c63ed1c..3dff9608f9a8184331b5f5b8ee4e14ab0c0c0f72 100644 (file)
@@ -608,7 +608,6 @@ int ff_frame_thread_init(AVCodecContext *avctx)
         }
 
         *copy = *src;
-        copy->pkt = &p->avpkt;
 
         copy->internal = av_malloc(sizeof(AVCodecInternal));
         if (!copy->internal) {
@@ -617,6 +616,7 @@ int ff_frame_thread_init(AVCodecContext *avctx)
         }
         *copy->internal = *src->internal;
         copy->internal->thread_ctx = p;
+        copy->internal->pkt = &p->avpkt;
 
         if (!i) {
             src = copy;
index 24d06f3087f95758a86c9d6ecbc65e5e4449b018..a8227c7ae8f59f15302bba29ddc04ac52235598a 100644 (file)
@@ -25,6 +25,7 @@
  */
 
 #include "avcodec.h"
+#include "internal.h"
 #include "raw.h"
 #include "libavutil/buffer.h"
 #include "libavutil/common.h"
@@ -150,7 +151,7 @@ static int raw_decode(AVCodecContext *avctx, void *data, int *got_frame,
     frame->pict_type        = AV_PICTURE_TYPE_I;
     frame->key_frame        = 1;
     frame->reordered_opaque = avctx->reordered_opaque;
-    frame->pkt_pts          = avctx->pkt->pts;
+    frame->pkt_pts          = avctx->internal->pkt->pts;
 
     if (buf_size < context->frame_size - (avctx->pix_fmt == AV_PIX_FMT_PAL8 ?
                                           AVPALETTE_SIZE : 0))
index 7b5c796b2a273f97787d534edb71bcbd6357bfc3..da519b5eb6e5723e8bf993713851057801c8715b 100644 (file)
@@ -613,7 +613,7 @@ int ff_get_buffer(AVCodecContext *avctx, AVFrame *frame, int flags)
     default: return AVERROR(EINVAL);
     }
 
-    frame->pkt_pts = avctx->pkt ? avctx->pkt->pts : AV_NOPTS_VALUE;
+    frame->pkt_pts = avctx->internal->pkt ? avctx->internal->pkt->pts : AV_NOPTS_VALUE;
     frame->reordered_opaque = avctx->reordered_opaque;
 
 #if FF_API_GET_BUFFER
@@ -1402,7 +1402,7 @@ int attribute_align_arg avcodec_decode_video2(AVCodecContext *avctx, AVFrame *pi
     if ((avctx->coded_width || avctx->coded_height) && av_image_check_size(avctx->coded_width, avctx->coded_height, 0, avctx))
         return -1;
 
-    avctx->pkt = avpkt;
+    avctx->internal->pkt = avpkt;
     ret = apply_param_change(avctx, avpkt);
     if (ret < 0) {
         av_log(avctx, AV_LOG_ERROR, "Error applying parameter changes.\n");
@@ -1467,7 +1467,7 @@ int attribute_align_arg avcodec_decode_audio4(AVCodecContext *avctx,
 
     *got_frame_ptr = 0;
 
-    avctx->pkt = avpkt;
+    avctx->internal->pkt = avpkt;
 
     if (!avpkt->data && avpkt->size) {
         av_log(avctx, AV_LOG_ERROR, "invalid packet: NULL data, size != 0\n");
@@ -1522,7 +1522,7 @@ int avcodec_decode_subtitle2(AVCodecContext *avctx, AVSubtitle *sub,
 {
     int ret;
 
-    avctx->pkt = avpkt;
+    avctx->internal->pkt = avpkt;
     *got_sub_ptr = 0;
     ret = avctx->codec->decode(avctx, sub, got_sub_ptr, avpkt);
     if (*got_sub_ptr)
index eac9ee4c4a8fb2a36237134ee348c2067e9816c0..5e87841610e6deee9fa64eb4cb42d0bc147480b5 100644 (file)
@@ -91,5 +91,8 @@
 #ifndef FF_API_THREAD_OPAQUE
 #define FF_API_THREAD_OPAQUE     (LIBAVCODEC_VERSION_MAJOR < 56)
 #endif
+#ifndef FF_API_CODEC_PKT
+#define FF_API_CODEC_PKT         (LIBAVCODEC_VERSION_MAJOR < 56)
+#endif
 
 #endif /* AVCODEC_VERSION_H */