]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/decode.c
avutil/buffer: Switch AVBuffer API to size_t
[ffmpeg] / libavcodec / decode.c
index 1a7c37043eee570e0f71501a2538036d78966732..cd98c98a9739221ae66db61f48c0d2eecbde016d 100644 (file)
@@ -67,7 +67,7 @@ typedef struct FramePool {
 static int apply_param_change(AVCodecContext *avctx, const AVPacket *avpkt)
 {
     int ret;
-    buffer_size_t size;
+    size_t size;
     const uint8_t *data;
     uint32_t flags;
     int64_t val;
@@ -344,7 +344,7 @@ static inline int decode_simple_internal(AVCodecContext *avctx, AVFrame *frame,
             got_frame = 0;
     } else if (avctx->codec->type == AVMEDIA_TYPE_AUDIO) {
         uint8_t *side;
-        buffer_size_t side_size;
+        size_t side_size;
         uint32_t discard_padding = 0;
         uint8_t skip_reason = 0;
         uint8_t discard_reason = 0;
@@ -1425,8 +1425,7 @@ static int video_get_buffer(AVCodecContext *s, AVFrame *pic)
         pic->data[i] = NULL;
         pic->linesize[i] = 0;
     }
-    if (desc->flags & AV_PIX_FMT_FLAG_PAL ||
-        ((desc->flags & FF_PSEUDOPAL) && pic->data[1]))
+    if (desc->flags & AV_PIX_FMT_FLAG_PAL)
         avpriv_set_systematic_pal2((uint32_t *)pic->data[1], pic->format);
 
     if (s->debug & FF_DEBUG_BUFFERS)
@@ -1464,7 +1463,7 @@ int avcodec_default_get_buffer2(AVCodecContext *avctx, AVFrame *frame, int flags
 
 static int add_metadata_from_side_data(const AVPacket *avpkt, AVFrame *frame)
 {
-    buffer_size_t size;
+    size_t size;
     const uint8_t *side_metadata;
 
     AVDictionary **frame_md = &frame->metadata;
@@ -1503,7 +1502,7 @@ int ff_decode_frame_props(AVCodecContext *avctx, AVFrame *frame)
     frame->pkt_size     = pkt->size;
 
     for (int i = 0; i < FF_ARRAY_ELEMS(sd); i++) {
-        buffer_size_t size;
+        size_t size;
         uint8_t *packet_sd = av_packet_get_side_data(pkt, sd[i].packet, &size);
         if (packet_sd) {
             AVFrameSideData *frame_sd = av_frame_new_side_data(frame,
@@ -1589,8 +1588,6 @@ static void validate_avframe_allocation(AVCodecContext *avctx, AVFrame *frame)
         int flags = desc ? desc->flags : 0;
         if (num_planes == 1 && (flags & AV_PIX_FMT_FLAG_PAL))
             num_planes = 2;
-        if ((flags & FF_PSEUDOPAL) && frame->data[1])
-            num_planes = 2;
         for (i = 0; i < num_planes; i++) {
             av_assert0(frame->data[i]);
         }
@@ -1844,14 +1841,15 @@ FF_ENABLE_DEPRECATION_WARNINGS
 
 int ff_copy_palette(void *dst, const AVPacket *src, void *logctx)
 {
-    buffer_size_t size;
+    size_t size;
     const void *pal = av_packet_get_side_data(src, AV_PKT_DATA_PALETTE, &size);
 
     if (pal && size == AVPALETTE_SIZE) {
         memcpy(dst, pal, AVPALETTE_SIZE);
         return 1;
     } else if (pal) {
-        av_log(logctx, AV_LOG_ERROR, "Palette size %d is wrong\n", size);
+        av_log(logctx, AV_LOG_ERROR,
+               "Palette size %"SIZE_SPECIFIER" is wrong\n", size);
     }
     return 0;
 }