* commit 'e3e158e81f0666b8fe66be9ce1cad63a535920e0': vdpau: add av_vdpau_bind_context() Conflicts: doc/APIchanges libavcodec/vdpau.h libavcodec/version.h
Unified · Split
| @@ -15,6 +15,10 @@ libavutil: 2014-08-09 · 14 unmodified lines | ||
| 15 | 15 | |
| 16 | 16 | API changes, most recent first: |
| 17 | 17 | |
| 18 | +2014-09-xx - xxxxxxx - lavc 56.2.0 - vdpau.h | |
| 19 | + Add av_vdpau_bind_context(). This function should now be used for creating | |
| 20 | + (or resetting) a AVVDPAUContext instead of av_vdpau_alloc_context(). | |
| 21 | + | |
| 18 | 22 | 2014-10-02 - xxxxxxx - lavc 56.2.100 - avcodec.h |
| 19 | 23 | 2014-10-02 - xxxxxxx - lavu 54.9.100 - frame.h |
| 20 | 24 | Add AV_FRAME_DATA_SKIP_SAMPLES. Add lavc CODEC_FLAG2_SKIP_MANUAL and |
| @@ -85,6 +85,7 @@ int ff_vdpau_common_init(AVCodecContext *avctx, VdpDecoderProfile profile, · 84 unmodified lines | ||
| 85 | 85 | |
| 86 | 86 | vdctx->width = UINT32_MAX; |
| 87 | 87 | vdctx->height = UINT32_MAX; |
| 88 | + hwctx->reset = 0; | |
| 88 | 89 | |
| 89 | 90 | if (!hwctx) { |
| 90 | 91 | vdctx->device = VDP_INVALID_HANDLE; |
| @@ -151,12 +152,13 @@ int ff_vdpau_common_uninit(AVCodecContext *avctx) · 60 unmodified lines | ||
| 151 | 152 | |
| 152 | 153 | static int ff_vdpau_common_reinit(AVCodecContext *avctx) |
| 153 | 154 | { |
| 155 | + VDPAUHWContext *hwctx = avctx->hwaccel_context; | |
| 154 | 156 | VDPAUContext *vdctx = avctx->internal->hwaccel_priv_data; |
| 155 | 157 | |
| 156 | 158 | if (vdctx->device == VDP_INVALID_HANDLE) |
| 157 | 159 | return 0; /* Decoder created by user */ |
| 158 | 160 | if (avctx->coded_width == vdctx->width && |
| 159 | − avctx->coded_height == vdctx->height) | |
| 161 | + avctx->coded_height == vdctx->height && !hwctx->reset) | |
| 160 | 162 | return 0; |
| 161 | 163 | |
| 162 | 164 | avctx->hwaccel->uninit(avctx); |
| @@ -639,4 +641,22 @@ AVVDPAUContext *av_vdpau_alloc_context(void) · 476 unmodified lines | ||
| 639 | 641 | return av_mallocz(sizeof(AVVDPAUContext)); |
| 640 | 642 | } |
| 641 | 643 | |
| 644 | +int av_vdpau_bind_context(AVCodecContext *avctx, VdpDevice device, | |
| 645 | + VdpGetProcAddress *get_proc, unsigned flags) | |
| 646 | +{ | |
| 647 | + VDPAUHWContext *hwctx; | |
| 648 | + | |
| 649 | + if (av_reallocp(&avctx->hwaccel_context, sizeof(*hwctx))) | |
| 650 | + return AVERROR(ENOMEM); | |
| 651 | + | |
| 652 | + hwctx = avctx->hwaccel_context; | |
| 653 | + | |
| 654 | + memset(hwctx, 0, sizeof(*hwctx)); | |
| 655 | + hwctx->context.decoder = VDP_INVALID_HANDLE; | |
| 656 | + hwctx->device = device; | |
| 657 | + hwctx->get_proc_address = get_proc; | |
| 658 | + hwctx->reset = 1; | |
| 659 | + return 0; | |
| 660 | +} | |
| 661 | + | |
| 642 | 662 | /* @}*/ |
| @@ -149,6 +149,26 @@ AVVDPAUContext *av_alloc_vdpaucontext(void); · 148 unmodified lines | ||
| 149 | 149 | AVVDPAU_Render2 av_vdpau_hwaccel_get_render2(const AVVDPAUContext *); |
| 150 | 150 | void av_vdpau_hwaccel_set_render2(AVVDPAUContext *, AVVDPAU_Render2); |
| 151 | 151 | |
| 152 | +/** | |
| 153 | + * Associate a VDPAU device with a codec context for hardware acceleration. | |
| 154 | + * This function is meant to be called from the get_format() codec callback, | |
| 155 | + * or earlier. It can also be called after avcodec_flush_buffers() to change | |
| 156 | + * the underlying VDPAU device mid-stream (e.g. to recover from non-transparent | |
| 157 | + * display preemption). | |
| 158 | + * | |
| 159 | + * @note get_format() must return AV_PIX_FMT_VDPAU if this function completes | |
| 160 | + * succesfully. | |
| 161 | + * | |
| 162 | + * @param avctx decoding context whose get_format() callback is invoked | |
| 163 | + * @param device VDPAU device handle to use for hardware acceleration | |
| 164 | + * @param get_proc_address VDPAU device driver | |
| 165 | + * @param flags for future use, must be zero | |
| 166 | + * | |
| 167 | + * @return 0 on success, an AVERROR code on failure. | |
| 168 | + */ | |
| 169 | +int av_vdpau_bind_context(AVCodecContext *avctx, VdpDevice device, | |
| 170 | + VdpGetProcAddress *get_proc_address, unsigned flags); | |
| 171 | + | |
| 152 | 172 | /** |
| 153 | 173 | * Allocate an AVVDPAUContext. |
| 154 | 174 | * |
| @@ -59,6 +59,7 @@ typedef struct VDPAUHWContext { · 58 unmodified lines | ||
| 59 | 59 | AVVDPAUContext context; |
| 60 | 60 | VdpDevice device; |
| 61 | 61 | VdpGetProcAddress *get_proc_address; |
| 62 | + char reset; | |
| 62 | 63 | } VDPAUHWContext; |
| 63 | 64 | |
| 64 | 65 | typedef struct VDPAUContext { |
| @@ -29,8 +29,8 @@ · 28 unmodified lines | ||
| 29 | 29 | #include "libavutil/version.h" |
| 30 | 30 | |
| 31 | 31 | #define LIBAVCODEC_VERSION_MAJOR 56 |
| 32 | −#define LIBAVCODEC_VERSION_MINOR 2 | |
| 33 | −#define LIBAVCODEC_VERSION_MICRO 101 | |
| 32 | +#define LIBAVCODEC_VERSION_MINOR 3 | |
| 33 | +#define LIBAVCODEC_VERSION_MICRO 100 | |
| 34 | 34 | |
| 35 | 35 | #define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \ |
| 36 | 36 | LIBAVCODEC_VERSION_MINOR, \ |