History

Merge commit '89ac99ba5f2dc9f69ad3bc294753930eb0b3e4a4'

* commit '89ac99ba5f2dc9f69ad3bc294753930eb0b3e4a4': vdpau: pass codec-specific parameters from hwaccel Conflicts: libavcodec/vdpau.c

Michael Niedermayer committed 12 years ago

Commit 0ba887b2 parents 8df4197 89ac99b5 files · +119 −1Browse files

Unified · Split

5 files
  1. libavcodec/vdpau.c +2 −1
  2. libavcodec/vdpau_h264.c +30 −0
  3. libavcodec/vdpau_mpeg12.c +30 −0
  4. libavcodec/vdpau_mpeg4.c +30 −0
  5. libavcodec/vdpau_vc1.c +27 −0
libavcodec/vdpau.c+2−1
@@ -146,6 +146,7 @@ int ff_vdpau_common_start_frame(struct vdpau_picture_context *pic_ctx, · 145 unmodified lines
146146 int ff_vdpau_common_end_frame(AVCodecContext *avctx, AVFrame *frame,
147147 struct vdpau_picture_context *pic_ctx)
148148 {
149+ VDPAUContext *vdctx = avctx->internal->hwaccel_priv_data;
149150 AVVDPAUContext *hwctx = avctx->hwaccel_context;
150151 VdpVideoSurface surf = ff_vdpau_get_surface_id(frame);
151152 VdpStatus status;
@@ -163,7 +164,7 @@ FF_ENABLE_DEPRECATION_WARNINGS · 11 unmodified lines
163164 status = hwctx->render2(avctx, frame, (void *)&pic_ctx->info,
164165 pic_ctx->bitstream_buffers_used, pic_ctx->bitstream_buffers);
165166 } else
166− status = hwctx->render(hwctx->decoder, surf, (void *)&pic_ctx->info,
167+ status = vdctx->render(vdctx->decoder, surf, (void *)&pic_ctx->info,
167168 pic_ctx->bitstream_buffers_used,
168169 pic_ctx->bitstream_buffers);
169170
libavcodec/vdpau_h264.c+30−0
@@ -24,6 +24,7 @@ · 23 unmodified lines
2424 #include <vdpau/vdpau.h>
2525
2626 #include "avcodec.h"
27+#include "internal.h"
2728 #include "h264.h"
2829 #include "mpegutils.h"
2930 #include "vdpau.h"
@@ -202,6 +203,32 @@ static int vdpau_h264_end_frame(AVCodecContext *avctx) · 172 unmodified lines
202203 return 0;
203204 }
204205
206+static int vdpau_h264_init(AVCodecContext *avctx)
207+{
208+ VdpDecoderProfile profile;
209+ uint32_t level = avctx->level;
210+
211+ switch (avctx->profile & ~FF_PROFILE_H264_INTRA) {
212+ case FF_PROFILE_H264_CONSTRAINED_BASELINE:
213+ case FF_PROFILE_H264_BASELINE:
214+ profile = VDP_DECODER_PROFILE_H264_BASELINE;
215+ break;
216+ case FF_PROFILE_H264_MAIN:
217+ profile = VDP_DECODER_PROFILE_H264_MAIN;
218+ break;
219+ case FF_PROFILE_H264_HIGH:
220+ profile = VDP_DECODER_PROFILE_H264_HIGH;
221+ break;
222+ default:
223+ return AVERROR(ENOTSUP);
224+ }
225+
226+ if ((avctx->profile & FF_PROFILE_H264_INTRA) && avctx->level == 11)
227+ level = VDP_DECODER_LEVEL_H264_1b;
228+
229+ return ff_vdpau_common_init(avctx, profile, level);
230+}
231+
205232 AVHWAccel ff_h264_vdpau_hwaccel = {
206233 .name = "h264_vdpau",
207234 .type = AVMEDIA_TYPE_VIDEO,
@@ -211,4 +238,7 @@ AVHWAccel ff_h264_vdpau_hwaccel = { · 3 unmodified lines
211238 .end_frame = vdpau_h264_end_frame,
212239 .decode_slice = vdpau_h264_decode_slice,
213240 .frame_priv_data_size = sizeof(struct vdpau_picture_context),
241+ .init = vdpau_h264_init,
242+ .uninit = ff_vdpau_common_uninit,
243+ .priv_data_size = sizeof(VDPAUContext),
214244 };
libavcodec/vdpau_mpeg12.c+30−0
@@ -95,6 +95,12 @@ static int vdpau_mpeg_decode_slice(AVCodecContext *avctx, · 94 unmodified lines
9595 }
9696
9797 #if CONFIG_MPEG1_VDPAU_HWACCEL
98+static int vdpau_mpeg1_init(AVCodecContext *avctx)
99+{
100+ return ff_vdpau_common_init(avctx, VDP_DECODER_PROFILE_MPEG1,
101+ VDP_DECODER_LEVEL_MPEG1_NA);
102+}
103+
98104 AVHWAccel ff_mpeg1_vdpau_hwaccel = {
99105 .name = "mpeg1_vdpau",
100106 .type = AVMEDIA_TYPE_VIDEO,
@@ -104,10 +110,31 @@ AVHWAccel ff_mpeg1_vdpau_hwaccel = { · 3 unmodified lines
104110 .end_frame = ff_vdpau_mpeg_end_frame,
105111 .decode_slice = vdpau_mpeg_decode_slice,
106112 .frame_priv_data_size = sizeof(struct vdpau_picture_context),
113+ .init = vdpau_mpeg1_init,
114+ .uninit = ff_vdpau_common_uninit,
115+ .priv_data_size = sizeof(VDPAUContext),
107116 };
108117 #endif
109118
110119 #if CONFIG_MPEG2_VDPAU_HWACCEL
120+static int vdpau_mpeg2_init(AVCodecContext *avctx)
121+{
122+ VdpDecoderProfile profile;
123+
124+ switch (avctx->profile) {
125+ case FF_PROFILE_MPEG2_MAIN:
126+ profile = VDP_DECODER_PROFILE_MPEG2_MAIN;
127+ break;
128+ case FF_PROFILE_MPEG2_SIMPLE:
129+ profile = VDP_DECODER_PROFILE_MPEG2_SIMPLE;
130+ break;
131+ default:
132+ return AVERROR(EINVAL);
133+ }
134+
135+ return ff_vdpau_common_init(avctx, profile, VDP_DECODER_LEVEL_MPEG2_HL);
136+}
137+
111138 AVHWAccel ff_mpeg2_vdpau_hwaccel = {
112139 .name = "mpeg2_vdpau",
113140 .type = AVMEDIA_TYPE_VIDEO,
@@ -117,5 +144,8 @@ AVHWAccel ff_mpeg2_vdpau_hwaccel = { · 3 unmodified lines
117144 .end_frame = ff_vdpau_mpeg_end_frame,
118145 .decode_slice = vdpau_mpeg_decode_slice,
119146 .frame_priv_data_size = sizeof(struct vdpau_picture_context),
147+ .init = vdpau_mpeg2_init,
148+ .uninit = ff_vdpau_common_uninit,
149+ .priv_data_size = sizeof(VDPAUContext),
120150 };
121151 #endif
libavcodec/vdpau_mpeg4.c+30−0
@@ -89,6 +89,12 @@ static int vdpau_mpeg4_decode_slice(av_unused AVCodecContext *avctx, · 88 unmodified lines
8989 }
9090
9191 #if CONFIG_H263_VDPAU_HWACCEL
92+static int vdpau_h263_init(AVCodecContext *avctx)
93+{
94+ return ff_vdpau_common_init(avctx, VDP_DECODER_PROFILE_MPEG4_PART2_ASP,
95+ VDP_DECODER_LEVEL_MPEG4_PART2_ASP_L5);
96+}
97+
9298 AVHWAccel ff_h263_vdpau_hwaccel = {
9399 .name = "h263_vdpau",
94100 .type = AVMEDIA_TYPE_VIDEO,
@@ -98,10 +104,31 @@ AVHWAccel ff_h263_vdpau_hwaccel = { · 3 unmodified lines
98104 .end_frame = ff_vdpau_mpeg_end_frame,
99105 .decode_slice = vdpau_mpeg4_decode_slice,
100106 .frame_priv_data_size = sizeof(struct vdpau_picture_context),
107+ .init = vdpau_h263_init,
108+ .uninit = ff_vdpau_common_uninit,
109+ .priv_data_size = sizeof(VDPAUContext),
101110 };
102111 #endif
103112
104113 #if CONFIG_MPEG4_VDPAU_HWACCEL
114+static int vdpau_mpeg4_init(AVCodecContext *avctx)
115+{
116+ VdpDecoderProfile profile;
117+
118+ switch (avctx->profile) {
119+ case FF_PROFILE_MPEG4_SIMPLE:
120+ profile = VDP_DECODER_PROFILE_MPEG4_PART2_SP;
121+ break;
122+ case FF_PROFILE_MPEG4_ADVANCED_SIMPLE:
123+ profile = VDP_DECODER_PROFILE_MPEG4_PART2_ASP;
124+ break;
125+ default:
126+ return AVERROR(ENOTSUP);
127+ }
128+
129+ return ff_vdpau_common_init(avctx, profile, avctx->level);
130+}
131+
105132 AVHWAccel ff_mpeg4_vdpau_hwaccel = {
106133 .name = "mpeg4_vdpau",
107134 .type = AVMEDIA_TYPE_VIDEO,
@@ -111,5 +138,8 @@ AVHWAccel ff_mpeg4_vdpau_hwaccel = { · 3 unmodified lines
111138 .end_frame = ff_vdpau_mpeg_end_frame,
112139 .decode_slice = vdpau_mpeg4_decode_slice,
113140 .frame_priv_data_size = sizeof(struct vdpau_picture_context),
141+ .init = vdpau_mpeg4_init,
142+ .uninit = ff_vdpau_common_uninit,
143+ .priv_data_size = sizeof(VDPAUContext),
114144 };
115145 #endif
libavcodec/vdpau_vc1.c+27−0
@@ -113,6 +113,27 @@ static int vdpau_vc1_decode_slice(AVCodecContext *avctx, · 112 unmodified lines
113113 return 0;
114114 }
115115
116+static int vdpau_vc1_init(AVCodecContext *avctx)
117+{
118+ VdpDecoderProfile profile;
119+
120+ switch (avctx->profile) {
121+ case FF_PROFILE_VC1_SIMPLE:
122+ profile = VDP_DECODER_PROFILE_VC1_SIMPLE;
123+ break;
124+ case FF_PROFILE_VC1_MAIN:
125+ profile = VDP_DECODER_PROFILE_VC1_MAIN;
126+ break;
127+ case FF_PROFILE_VC1_ADVANCED:
128+ profile = VDP_DECODER_PROFILE_VC1_ADVANCED;
129+ break;
130+ default:
131+ return AVERROR(ENOTSUP);
132+ }
133+
134+ return ff_vdpau_common_init(avctx, profile, avctx->level);
135+}
136+
116137 #if CONFIG_WMV3_VDPAU_HWACCEL
117138 AVHWAccel ff_wmv3_vdpau_hwaccel = {
118139 .name = "wm3_vdpau",
@@ -123,6 +144,9 @@ AVHWAccel ff_wmv3_vdpau_hwaccel = { · 4 unmodified lines
123144 .end_frame = ff_vdpau_mpeg_end_frame,
124145 .decode_slice = vdpau_vc1_decode_slice,
125146 .frame_priv_data_size = sizeof(struct vdpau_picture_context),
147+ .init = vdpau_vc1_init,
148+ .uninit = ff_vdpau_common_uninit,
149+ .priv_data_size = sizeof(VDPAUContext),
126150 };
127151 #endif
128152
@@ -135,4 +159,7 @@ AVHWAccel ff_vc1_vdpau_hwaccel = { · 6 unmodified lines
135159 .end_frame = ff_vdpau_mpeg_end_frame,
136160 .decode_slice = vdpau_vc1_decode_slice,
137161 .frame_priv_data_size = sizeof(struct vdpau_picture_context),
162+ .init = vdpau_vc1_init,
163+ .uninit = ff_vdpau_common_uninit,
164+ .priv_data_size = sizeof(VDPAUContext),
138165 };

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