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
146int ff_vdpau_common_end_frame(AVCodecContext *avctx, AVFrame *frame,146int ff_vdpau_common_end_frame(AVCodecContext *avctx, AVFrame *frame,
147 struct vdpau_picture_context *pic_ctx)147 struct vdpau_picture_context *pic_ctx)
148{148{
149 VDPAUContext *vdctx = avctx->internal->hwaccel_priv_data;
149 AVVDPAUContext *hwctx = avctx->hwaccel_context;150 AVVDPAUContext *hwctx = avctx->hwaccel_context;
150 VdpVideoSurface surf = ff_vdpau_get_surface_id(frame);151 VdpVideoSurface surf = ff_vdpau_get_surface_id(frame);
151 VdpStatus status;152 VdpStatus status;
@@ -163,7 +164,7 @@ FF_ENABLE_DEPRECATION_WARNINGS · 11 unmodified lines
163 status = hwctx->render2(avctx, frame, (void *)&pic_ctx->info,164 status = hwctx->render2(avctx, frame, (void *)&pic_ctx->info,
164 pic_ctx->bitstream_buffers_used, pic_ctx->bitstream_buffers);165 pic_ctx->bitstream_buffers_used, pic_ctx->bitstream_buffers);
165 } else166 } else
166 status = hwctx->render(hwctx->decoder, surf, (void *)&pic_ctx->info,167 status = vdctx->render(vdctx->decoder, surf, (void *)&pic_ctx->info,
167 pic_ctx->bitstream_buffers_used,168 pic_ctx->bitstream_buffers_used,
168 pic_ctx->bitstream_buffers);169 pic_ctx->bitstream_buffers);
169 170
libavcodec/vdpau_h264.c+30−0
@@ -24,6 +24,7 @@ · 23 unmodified lines
24#include <vdpau/vdpau.h>24#include <vdpau/vdpau.h>
25 25
26#include "avcodec.h"26#include "avcodec.h"
27#include "internal.h"
27#include "h264.h"28#include "h264.h"
28#include "mpegutils.h"29#include "mpegutils.h"
29#include "vdpau.h"30#include "vdpau.h"
@@ -202,6 +203,32 @@ static int vdpau_h264_end_frame(AVCodecContext *avctx) · 172 unmodified lines
202 return 0;203 return 0;
203}204}
204 205
206static 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
205AVHWAccel ff_h264_vdpau_hwaccel = {232AVHWAccel ff_h264_vdpau_hwaccel = {
206 .name = "h264_vdpau",233 .name = "h264_vdpau",
207 .type = AVMEDIA_TYPE_VIDEO,234 .type = AVMEDIA_TYPE_VIDEO,
@@ -211,4 +238,7 @@ AVHWAccel ff_h264_vdpau_hwaccel = { · 3 unmodified lines
211 .end_frame = vdpau_h264_end_frame,238 .end_frame = vdpau_h264_end_frame,
212 .decode_slice = vdpau_h264_decode_slice,239 .decode_slice = vdpau_h264_decode_slice,
213 .frame_priv_data_size = sizeof(struct vdpau_picture_context),240 .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),
214};244};
libavcodec/vdpau_mpeg12.c+30−0
@@ -95,6 +95,12 @@ static int vdpau_mpeg_decode_slice(AVCodecContext *avctx, · 94 unmodified lines
95}95}
96 96
97#if CONFIG_MPEG1_VDPAU_HWACCEL97#if CONFIG_MPEG1_VDPAU_HWACCEL
98static 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
98AVHWAccel ff_mpeg1_vdpau_hwaccel = {104AVHWAccel ff_mpeg1_vdpau_hwaccel = {
99 .name = "mpeg1_vdpau",105 .name = "mpeg1_vdpau",
100 .type = AVMEDIA_TYPE_VIDEO,106 .type = AVMEDIA_TYPE_VIDEO,
@@ -104,10 +110,31 @@ AVHWAccel ff_mpeg1_vdpau_hwaccel = { · 3 unmodified lines
104 .end_frame = ff_vdpau_mpeg_end_frame,110 .end_frame = ff_vdpau_mpeg_end_frame,
105 .decode_slice = vdpau_mpeg_decode_slice,111 .decode_slice = vdpau_mpeg_decode_slice,
106 .frame_priv_data_size = sizeof(struct vdpau_picture_context),112 .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),
107};116};
108#endif117#endif
109 118
110#if CONFIG_MPEG2_VDPAU_HWACCEL119#if CONFIG_MPEG2_VDPAU_HWACCEL
120static 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
111AVHWAccel ff_mpeg2_vdpau_hwaccel = {138AVHWAccel ff_mpeg2_vdpau_hwaccel = {
112 .name = "mpeg2_vdpau",139 .name = "mpeg2_vdpau",
113 .type = AVMEDIA_TYPE_VIDEO,140 .type = AVMEDIA_TYPE_VIDEO,
@@ -117,5 +144,8 @@ AVHWAccel ff_mpeg2_vdpau_hwaccel = { · 3 unmodified lines
117 .end_frame = ff_vdpau_mpeg_end_frame,144 .end_frame = ff_vdpau_mpeg_end_frame,
118 .decode_slice = vdpau_mpeg_decode_slice,145 .decode_slice = vdpau_mpeg_decode_slice,
119 .frame_priv_data_size = sizeof(struct vdpau_picture_context),146 .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),
120};150};
121#endif151#endif
libavcodec/vdpau_mpeg4.c+30−0
@@ -89,6 +89,12 @@ static int vdpau_mpeg4_decode_slice(av_unused AVCodecContext *avctx, · 88 unmodified lines
89}89}
90 90
91#if CONFIG_H263_VDPAU_HWACCEL91#if CONFIG_H263_VDPAU_HWACCEL
92static 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
92AVHWAccel ff_h263_vdpau_hwaccel = {98AVHWAccel ff_h263_vdpau_hwaccel = {
93 .name = "h263_vdpau",99 .name = "h263_vdpau",
94 .type = AVMEDIA_TYPE_VIDEO,100 .type = AVMEDIA_TYPE_VIDEO,
@@ -98,10 +104,31 @@ AVHWAccel ff_h263_vdpau_hwaccel = { · 3 unmodified lines
98 .end_frame = ff_vdpau_mpeg_end_frame,104 .end_frame = ff_vdpau_mpeg_end_frame,
99 .decode_slice = vdpau_mpeg4_decode_slice,105 .decode_slice = vdpau_mpeg4_decode_slice,
100 .frame_priv_data_size = sizeof(struct vdpau_picture_context),106 .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),
101};110};
102#endif111#endif
103 112
104#if CONFIG_MPEG4_VDPAU_HWACCEL113#if CONFIG_MPEG4_VDPAU_HWACCEL
114static 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
105AVHWAccel ff_mpeg4_vdpau_hwaccel = {132AVHWAccel ff_mpeg4_vdpau_hwaccel = {
106 .name = "mpeg4_vdpau",133 .name = "mpeg4_vdpau",
107 .type = AVMEDIA_TYPE_VIDEO,134 .type = AVMEDIA_TYPE_VIDEO,
@@ -111,5 +138,8 @@ AVHWAccel ff_mpeg4_vdpau_hwaccel = { · 3 unmodified lines
111 .end_frame = ff_vdpau_mpeg_end_frame,138 .end_frame = ff_vdpau_mpeg_end_frame,
112 .decode_slice = vdpau_mpeg4_decode_slice,139 .decode_slice = vdpau_mpeg4_decode_slice,
113 .frame_priv_data_size = sizeof(struct vdpau_picture_context),140 .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),
114};144};
115#endif145#endif
libavcodec/vdpau_vc1.c+27−0
@@ -113,6 +113,27 @@ static int vdpau_vc1_decode_slice(AVCodecContext *avctx, · 112 unmodified lines
113 return 0;113 return 0;
114}114}
115 115
116static 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
116#if CONFIG_WMV3_VDPAU_HWACCEL137#if CONFIG_WMV3_VDPAU_HWACCEL
117AVHWAccel ff_wmv3_vdpau_hwaccel = {138AVHWAccel ff_wmv3_vdpau_hwaccel = {
118 .name = "wm3_vdpau",139 .name = "wm3_vdpau",
@@ -123,6 +144,9 @@ AVHWAccel ff_wmv3_vdpau_hwaccel = { · 4 unmodified lines
123 .end_frame = ff_vdpau_mpeg_end_frame,144 .end_frame = ff_vdpau_mpeg_end_frame,
124 .decode_slice = vdpau_vc1_decode_slice,145 .decode_slice = vdpau_vc1_decode_slice,
125 .frame_priv_data_size = sizeof(struct vdpau_picture_context),146 .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),
126};150};
127#endif151#endif
128 152
@@ -135,4 +159,7 @@ AVHWAccel ff_vc1_vdpau_hwaccel = { · 6 unmodified lines
135 .end_frame = ff_vdpau_mpeg_end_frame,159 .end_frame = ff_vdpau_mpeg_end_frame,
136 .decode_slice = vdpau_vc1_decode_slice,160 .decode_slice = vdpau_vc1_decode_slice,
137 .frame_priv_data_size = sizeof(struct vdpau_picture_context),161 .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),
138};165};

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