History

Merge commit 'ebc29519d1634bfeb386c20a5d8a52837aae2436'

* commit 'ebc29519d1634bfeb386c20a5d8a52837aae2436': hwaccel: Support specific frame allocators Conflicts: libavcodec/utils.c

Michael Niedermayer committed 12 years ago

Commit c4fe50b2 parents fa0f7c0 ebc29512 files · +14 −2Browse files

Unified · Split

2 files
  1. libavcodec/avcodec.h +5 −0
  2. libavcodec/utils.c +9 −2
libavcodec/avcodec.h+5−0
@@ -3242,6 +3242,11 @@ typedef struct AVHWAccel { · 3241 unmodified lines
32423242 */
32433243 struct AVHWAccel *next;
32443244
3245+ /**
3246+ * Allocate a custom buffer
3247+ */
3248+ int (*alloc_frame)(AVCodecContext *avctx, AVFrame *frame);
3249+
32453250 /**
32463251 * Called at the beginning of each frame or field picture.
32473252 *
libavcodec/utils.c+9−2
@@ -850,6 +850,7 @@ int ff_decode_frame_props(AVCodecContext *avctx, AVFrame *frame) · 849 unmodified lines
850850
851851 static int get_buffer_internal(AVCodecContext *avctx, AVFrame *frame, int flags)
852852 {
853+ const AVHWAccel *hwaccel = avctx->hwaccel;
853854 int override_dimensions = 1;
854855 int ret;
855856
@@ -872,6 +873,11 @@ static int get_buffer_internal(AVCodecContext *avctx, AVFrame *frame, int flags) · 16 unmodified lines
872873 if ((ret = ff_init_buffer_info(avctx, frame)) < 0)
873874 return ret;
874875
876+ if (hwaccel && hwaccel->alloc_frame) {
877+ ret = hwaccel->alloc_frame(avctx, frame);
878+ goto end;
879+ }
880+
875881 #if FF_API_GET_BUFFER
876882 FF_DISABLE_DEPRECATION_WARNINGS
877883 /*
@@ -898,7 +904,7 @@ FF_DISABLE_DEPRECATION_WARNINGS · 20 unmodified lines
898904 * avcodec_default_get_buffer
899905 */
900906 if (frame->buf[0])
901− goto end;
907+ goto end0;
902908
903909 priv = av_mallocz(sizeof(*priv));
904910 if (!priv) {
@@ -974,7 +980,7 @@ do { \ · 69 unmodified lines
974980
975981 av_buffer_unref(&dummy_buf);
976982
977−end:
983+end0:
978984 frame->width = avctx->width;
979985 frame->height = avctx->height;
980986
@@ -991,6 +997,7 @@ FF_ENABLE_DEPRECATION_WARNINGS · 10 unmodified lines
991997
992998 ret = avctx->get_buffer2(avctx, frame, flags);
993999
1000+end:
9941001 if (avctx->codec_type == AVMEDIA_TYPE_VIDEO && !override_dimensions) {
9951002 frame->width = avctx->width;
9961003 frame->height = avctx->height;

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t