MCPcopy Create free account
hub / github.com/FFmpeg/FFmpeg / reget_buffer_internal

Function reget_buffer_internal

libavcodec/decode.c:1827–1867  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1825}
1826
1827static int reget_buffer_internal(AVCodecContext *avctx, AVFrame *frame, int flags)
1828{
1829 AVFrame *tmp;
1830 int ret;
1831
1832 av_assert0(avctx->codec_type == AVMEDIA_TYPE_VIDEO);
1833
1834 // make sure the discard flag does not persist
1835 frame->flags &= ~AV_FRAME_FLAG_DISCARD;
1836
1837 if (frame->data[0] && (frame->width != avctx->width || frame->height != avctx->height || frame->format != avctx->pix_fmt)) {
1838 av_log(avctx, AV_LOG_WARNING, "Picture changed from size:%dx%d fmt:%s to size:%dx%d fmt:%s in reget buffer()\n",
1839 frame->width, frame->height, av_get_pix_fmt_name(frame->format), avctx->width, avctx->height, av_get_pix_fmt_name(avctx->pix_fmt));
1840 av_frame_unref(frame);
1841 }
1842
1843 if (!frame->data[0])
1844 return ff_get_buffer(avctx, frame, AV_GET_BUFFER_FLAG_REF);
1845
1846 av_frame_side_data_free(&frame->side_data, &frame->nb_side_data);
1847
1848 if ((flags & FF_REGET_BUFFER_FLAG_READONLY) || av_frame_is_writable(frame))
1849 return ff_decode_frame_props(avctx, frame);
1850
1851 tmp = av_frame_alloc();
1852 if (!tmp)
1853 return AVERROR(ENOMEM);
1854
1855 av_frame_move_ref(tmp, frame);
1856
1857 ret = ff_get_buffer(avctx, frame, AV_GET_BUFFER_FLAG_REF);
1858 if (ret < 0) {
1859 av_frame_free(&tmp);
1860 return ret;
1861 }
1862
1863 av_frame_copy(frame, tmp);
1864 av_frame_free(&tmp);
1865
1866 return 0;
1867}
1868
1869int ff_reget_buffer(AVCodecContext *avctx, AVFrame *frame, int flags)
1870{

Callers 1

ff_reget_bufferFunction · 0.85

Calls 11

av_logFunction · 0.85
av_get_pix_fmt_nameFunction · 0.85
av_frame_unrefFunction · 0.85
ff_get_bufferFunction · 0.85
av_frame_side_data_freeFunction · 0.85
av_frame_is_writableFunction · 0.85
ff_decode_frame_propsFunction · 0.85
av_frame_allocFunction · 0.85
av_frame_move_refFunction · 0.85
av_frame_freeFunction · 0.85
av_frame_copyFunction · 0.85

Tested by

no test coverage detected