History

hwaccel: Support specific frame allocators

It would reduce the boilerplate code users have to write.

Luca Barbato committed 12 years ago

Commit ebc29511 parent a871ef02 files · +12 −0Browse files

Unified · Split

2 files
  1. libavcodec/avcodec.h +5 −0
  2. libavcodec/utils.c +7 −0
libavcodec/avcodec.h+5−0
@@ -2946,6 +2946,11 @@ typedef struct AVHWAccel { · 2945 unmodified lines
2946 */2946 */
2947 struct AVHWAccel *next;2947 struct AVHWAccel *next;
2948 2948
2949 /**
2950 * Allocate a custom buffer
2951 */
2952 int (*alloc_frame)(AVCodecContext *avctx, AVFrame *frame);
2953
2949 /**2954 /**
2950 * Called at the beginning of each frame or field picture.2955 * Called at the beginning of each frame or field picture.
2951 *2956 *
libavcodec/utils.c+7−0
@@ -604,6 +604,7 @@ int ff_decode_frame_props(AVCodecContext *avctx, AVFrame *frame) · 603 unmodified lines
604 604
605int ff_get_buffer(AVCodecContext *avctx, AVFrame *frame, int flags)605int ff_get_buffer(AVCodecContext *avctx, AVFrame *frame, int flags)
606{606{
607 const AVHWAccel *hwaccel = avctx->hwaccel;
607 int override_dimensions = 1;608 int override_dimensions = 1;
608 int ret;609 int ret;
609 610
@@ -657,6 +658,11 @@ int ff_get_buffer(AVCodecContext *avctx, AVFrame *frame, int flags) · 47 unmodified lines
657 if (ret < 0)658 if (ret < 0)
658 return ret;659 return ret;
659 660
661 if (hwaccel && hwaccel->alloc_frame) {
662 ret = hwaccel->alloc_frame(avctx, frame);
663 goto end;
664 }
665
660#if FF_API_GET_BUFFER666#if FF_API_GET_BUFFER
661FF_DISABLE_DEPRECATION_WARNINGS667FF_DISABLE_DEPRECATION_WARNINGS
662 /*668 /*
@@ -775,6 +781,7 @@ FF_ENABLE_DEPRECATION_WARNINGS · 112 unmodified lines
775 781
776 ret = avctx->get_buffer2(avctx, frame, flags);782 ret = avctx->get_buffer2(avctx, frame, flags);
777 783
784end:
778 if (avctx->codec_type == AVMEDIA_TYPE_VIDEO && !override_dimensions) {785 if (avctx->codec_type == AVMEDIA_TYPE_VIDEO && !override_dimensions) {
779 frame->width = avctx->width;786 frame->width = avctx->width;
780 frame->height = avctx->height;787 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