History

Merge commit '502cde409ca5ee97ef70c2cdede88b9101746ff6'

* commit '502cde409ca5ee97ef70c2cdede88b9101746ff6': vdpau: force reinitialization when output resolution changes Conflicts: libavcodec/vdpau.c

Michael Niedermayer committed 12 years ago

Commit 067d11b2 parents ec6a855 502cde42 files · +32 −0Browse files

Unified · Split

2 files
  1. libavcodec/vdpau.c +29 −0
  2. libavcodec/vdpau_internal.h +3 −0
libavcodec/vdpau.c+29−0
@@ -83,6 +83,9 @@ int ff_vdpau_common_init(AVCodecContext *avctx, VdpDecoderProfile profile, · 82 unmodified lines
83 uint32_t width = (avctx->coded_width + 1) & ~1;83 uint32_t width = (avctx->coded_width + 1) & ~1;
84 uint32_t height = (avctx->coded_height + 3) & ~3;84 uint32_t height = (avctx->coded_height + 3) & ~3;
85 85
86 vdctx->width = UINT32_MAX;
87 vdctx->height = UINT32_MAX;
88
86 if (!hwctx) {89 if (!hwctx) {
87 vdctx->device = VDP_INVALID_HANDLE;90 vdctx->device = VDP_INVALID_HANDLE;
88 av_log(avctx, AV_LOG_WARNING, "hwaccel_context has not been setup by the user application, cannot initialize\n");91 av_log(avctx, AV_LOG_WARNING, "hwaccel_context has not been setup by the user application, cannot initialize\n");
@@ -115,6 +118,11 @@ int ff_vdpau_common_init(AVCodecContext *avctx, VdpDecoderProfile profile, · 26 unmodified lines
115 118
116 status = create(vdctx->device, profile, width, height, avctx->refs,119 status = create(vdctx->device, profile, width, height, avctx->refs,
117 &vdctx->decoder);120 &vdctx->decoder);
121 if (status == VDP_STATUS_OK) {
122 vdctx->width = avctx->coded_width;
123 vdctx->height = avctx->coded_height;
124 }
125
118 return vdpau_error(status);126 return vdpau_error(status);
119}127}
120 128
@@ -127,6 +135,8 @@ int ff_vdpau_common_uninit(AVCodecContext *avctx) · 6 unmodified lines
127 135
128 if (vdctx->device == VDP_INVALID_HANDLE)136 if (vdctx->device == VDP_INVALID_HANDLE)
129 return 0; /* Decoder created and destroyed by user */137 return 0; /* Decoder created and destroyed by user */
138 if (vdctx->width == UINT32_MAX && vdctx->height == UINT32_MAX)
139 return 0;
130 140
131 status = vdctx->get_proc_address(vdctx->device,141 status = vdctx->get_proc_address(vdctx->device,
132 VDP_FUNC_ID_DECODER_DESTROY, &func);142 VDP_FUNC_ID_DECODER_DESTROY, &func);
@@ -139,6 +149,20 @@ int ff_vdpau_common_uninit(AVCodecContext *avctx) · 6 unmodified lines
139 return vdpau_error(status);149 return vdpau_error(status);
140}150}
141 151
152static int ff_vdpau_common_reinit(AVCodecContext *avctx)
153{
154 VDPAUContext *vdctx = avctx->internal->hwaccel_priv_data;
155
156 if (vdctx->device == VDP_INVALID_HANDLE)
157 return 0; /* Decoder created by user */
158 if (avctx->coded_width == vdctx->width &&
159 avctx->coded_height == vdctx->height)
160 return 0;
161
162 avctx->hwaccel->uninit(avctx);
163 return avctx->hwaccel->init(avctx);
164}
165
142int ff_vdpau_common_start_frame(struct vdpau_picture_context *pic_ctx,166int ff_vdpau_common_start_frame(struct vdpau_picture_context *pic_ctx,
143 av_unused const uint8_t *buffer,167 av_unused const uint8_t *buffer,
144 av_unused uint32_t size)168 av_unused uint32_t size)
@@ -156,6 +180,11 @@ int ff_vdpau_common_end_frame(AVCodecContext *avctx, AVFrame *frame, · 11 unmodified lines
156 AVVDPAUContext *hwctx = avctx->hwaccel_context;180 AVVDPAUContext *hwctx = avctx->hwaccel_context;
157 VdpVideoSurface surf = ff_vdpau_get_surface_id(frame);181 VdpVideoSurface surf = ff_vdpau_get_surface_id(frame);
158 VdpStatus status;182 VdpStatus status;
183 int val;
184
185 val = ff_vdpau_common_reinit(avctx);
186 if (val < 0)
187 return val;
159 188
160#if FF_API_BUFS_VDPAU189#if FF_API_BUFS_VDPAU
161FF_DISABLE_DEPRECATION_WARNINGS190FF_DISABLE_DEPRECATION_WARNINGS
libavcodec/vdpau_internal.h+3−0
@@ -81,6 +81,9 @@ typedef struct VDPAUContext { · 80 unmodified lines
81 * VDPAU decoder render callback81 * VDPAU decoder render callback
82 */82 */
83 VdpDecoderRender *render;83 VdpDecoderRender *render;
84
85 uint32_t width;
86 uint32_t height;
84} VDPAUContext;87} VDPAUContext;
85 88
86struct vdpau_picture_context {89struct vdpau_picture_context {

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