static void *codec_mutex;
static void *avformat_mutex;
-void *av_fast_realloc(void *ptr, unsigned int *size, size_t min_size)
+#if FF_API_FAST_MALLOC && CONFIG_SHARED && HAVE_SYMVER
+FF_SYMVER(void*, av_fast_realloc, (void *ptr, unsigned int *size, size_t min_size), "LIBAVCODEC_55")
{
- if (min_size < *size)
- return ptr;
-
- min_size = FFMAX(17 * min_size / 16 + 32, min_size);
-
- ptr = av_realloc(ptr, min_size);
- /* we could set this to the unmodified min_size but this is safer
- * if the user lost the ptr and uses NULL now
- */
- if (!ptr)
- min_size = 0;
-
- *size = min_size;
-
- return ptr;
+ return av_fast_realloc(ptr, size, min_size);
}
-void av_fast_malloc(void *ptr, unsigned int *size, size_t min_size)
+FF_SYMVER(void, av_fast_malloc, (void *ptr, unsigned int *size, size_t min_size), "LIBAVCODEC_55")
{
- void **p = ptr;
- if (min_size < *size)
- return;
- min_size = FFMAX(17 * min_size / 16 + 32, min_size);
- av_free(*p);
- *p = av_malloc(min_size);
- if (!*p)
- min_size = 0;
- *size = min_size;
+ av_fast_malloc(ptr, size, min_size);
}
+#endif
void av_fast_padded_malloc(void *ptr, unsigned int *size, size_t min_size)
{
frame->extended_data = frame->data;
}
+#if FF_API_AVFRAME_LAVC
AVFrame *avcodec_alloc_frame(void)
{
AVFrame *frame = av_mallocz(sizeof(AVFrame));
return frame;
}
+#endif
void avcodec_free_frame(AVFrame **frame)
{
AVFrame *frame = NULL;
int ret;
- if (!(frame = avcodec_alloc_frame()))
+ if (!(frame = av_frame_alloc()))
return AVERROR(ENOMEM);
frame->format = src->format;
emms_c(); //needed to avoid an emms_c() call before every return;
- if (ret < 0 && picture->data[0])
+ if (ret < 0 && picture->buf[0])
av_frame_unref(picture);
if (*got_picture_ptr) {
} else
ret = 0;
- /* many decoders assign whole AVFrames, thus overwriting extended_data;
- * make sure it's set correctly */
- picture->extended_data = picture->data;
-
return ret;
}
AVPacket *avpkt)
{
AVCodecInternal *avci = avctx->internal;
- int planar, channels;
int ret = 0;
*got_frame_ptr = 0;
av_frame_unref(frame);
}
- /* many decoders assign whole AVFrames, thus overwriting extended_data;
- * make sure it's set correctly; assume decoders that actually use
- * extended_data are doing it correctly */
- planar = av_sample_fmt_is_planar(frame->format);
- channels = av_get_channel_layout_nb_channels(frame->channel_layout);
- if (!(planar && channels > AV_NUM_DATA_POINTERS))
- frame->extended_data = frame->data;
return ret;
}