summaryrefslogtreecommitdiffstats
path: root/libvo
diff options
context:
space:
mode:
authorUoti Urpala <uau@glyph.nonexistent.invalid>2009-05-06 00:32:09 +0300
committerUoti Urpala <uau@glyph.nonexistent.invalid>2009-08-29 20:22:39 +0300
commit72527eea10a4a4c2a03627cbd97dfc60bff4fd34 (patch)
treeaeb1d91da74dab758e66c6005842051207cca0fa /libvo
parentdc44507f2ad9d6301557d32d41a87cee6e6ae934 (diff)
downloadmpv-72527eea10a4a4c2a03627cbd97dfc60bff4fd34.tar.bz2
mpv-72527eea10a4a4c2a03627cbd97dfc60bff4fd34.tar.xz
vo_vdpau: Move VDPAU interface pointers into one struct
Replace a bunch of vdp_* function pointer variables with one struct. A variable that was before named "vdp_xyz" is now the struct field "vdp.xyz".
Diffstat (limited to 'libvo')
-rw-r--r--libvo/vo_vdpau.c108
1 files changed, 55 insertions, 53 deletions
diff --git a/libvo/vo_vdpau.c b/libvo/vo_vdpau.c
index 5e1c6a937c..c924389509 100644
--- a/libvo/vo_vdpau.c
+++ b/libvo/vo_vdpau.c
@@ -59,14 +59,14 @@
#define CHECK_ST_ERROR(message) \
if (vdp_st != VDP_STATUS_OK) { \
mp_msg(MSGT_VO, MSGL_ERR, "[vdpau] %s: %s\n", \
- message, vdp_get_error_string(vdp_st)); \
+ message, vdp.get_error_string(vdp_st)); \
return -1; \
}
#define CHECK_ST_WARNING(message) \
if (vdp_st != VDP_STATUS_OK) \
mp_msg(MSGT_VO, MSGL_WARN, "[vdpau] %s: %s\n", \
- message, vdp_get_error_string(vdp_st));
+ message, vdp.get_error_string(vdp_st));
/* number of video and output surfaces */
#define NUM_OUTPUT_SURFACES 2
@@ -92,9 +92,11 @@ static VdpGetProcAddress *vdp_get_proc_address;
static VdpPresentationQueueTarget vdp_flip_target;
static VdpPresentationQueue vdp_flip_queue;
-#define VDP_FUNCTION(vdp_type, _, mp_name) static vdp_type *vdp_##mp_name;
+struct vdp_functions {
+#define VDP_FUNCTION(vdp_type, _, mp_name) vdp_type *mp_name;
#include "vdpau_template.c"
#undef VDP_FUNCTION
+} vdp;
static void *vdpau_lib_handle;
/* output_surfaces[NUM_OUTPUT_SURFACES] is misused for OSD. */
@@ -199,12 +201,12 @@ static void video_to_output_surface(struct vo *vo)
VDP_VIDEO_MIXER_PICTURE_STRUCTURE_BOTTOM_FIELD:
VDP_VIDEO_MIXER_PICTURE_STRUCTURE_TOP_FIELD;
output_surface = output_surfaces[surface_num];
- vdp_st = vdp_presentation_queue_block_until_surface_idle(vdp_flip_queue,
+ vdp_st = vdp.presentation_queue_block_until_surface_idle(vdp_flip_queue,
output_surface,
&dummy);
- CHECK_ST_WARNING("Error when calling vdp_presentation_queue_block_until_surface_idle")
+ CHECK_ST_WARNING("Error when calling vdp.presentation_queue_block_until_surface_idle")
- vdp_st = vdp_video_mixer_render(video_mixer, VDP_INVALID_HANDLE, 0,
+ vdp_st = vdp.video_mixer_render(video_mixer, VDP_INVALID_HANDLE, 0,
field, 2, deint_surfaces + 1,
deint_surfaces[0],
1, &surface_render[vid_surface_num].surface,
@@ -253,11 +255,11 @@ static void resize(struct vo *vo)
// Creation of output_surfaces
for (i = 0; i <= NUM_OUTPUT_SURFACES; i++) {
if (output_surfaces[i] != VDP_INVALID_HANDLE)
- vdp_output_surface_destroy(output_surfaces[i]);
- vdp_st = vdp_output_surface_create(vdp_device, VDP_RGBA_FORMAT_B8G8R8A8,
+ vdp.output_surface_destroy(output_surfaces[i]);
+ vdp_st = vdp.output_surface_create(vdp_device, VDP_RGBA_FORMAT_B8G8R8A8,
output_surface_width, output_surface_height,
&output_surfaces[i]);
- CHECK_ST_WARNING("Error when calling vdp_output_surface_create")
+ CHECK_ST_WARNING("Error when calling vdp.output_surface_create")
mp_msg(MSGT_VO, MSGL_DBG2, "OUT CREATE: %u\n", output_surfaces[i]);
}
}
@@ -280,7 +282,7 @@ static int win_x11_init_vdpau_procs(struct vo *vo)
const struct vdp_function *dsc;
static const struct vdp_function vdp_func[] = {
-#define VDP_FUNCTION(_, macro_name, mp_name) {macro_name, &vdp_##mp_name},
+#define VDP_FUNCTION(_, macro_name, mp_name) {macro_name, &vdp.mp_name},
#include "vdpau_template.c"
#undef VDP_FUNCTION
{0, NULL}
@@ -293,11 +295,11 @@ static int win_x11_init_vdpau_procs(struct vo *vo)
return -1;
}
- vdp_get_error_string = NULL;
+ vdp.get_error_string = NULL;
for (dsc = vdp_func; dsc->pointer; dsc++) {
vdp_st = vdp_get_proc_address(vdp_device, dsc->id, dsc->pointer);
if (vdp_st != VDP_STATUS_OK) {
- mp_msg(MSGT_VO, MSGL_ERR, "[vdpau] Error when calling vdp_get_proc_address(function id %d): %s\n", dsc->id, vdp_get_error_string ? vdp_get_error_string(vdp_st) : "?");
+ mp_msg(MSGT_VO, MSGL_ERR, "[vdpau] Error when calling vdp_get_proc_address(function id %d): %s\n", dsc->id, vdp.get_error_string ? vdp.get_error_string(vdp_st) : "?");
return -1;
}
}
@@ -310,13 +312,13 @@ static int win_x11_init_vdpau_flip_queue(struct vo *vo)
struct vo_x11_state *x11 = vo->x11;
VdpStatus vdp_st;
- vdp_st = vdp_presentation_queue_target_create_x11(vdp_device, x11->window,
+ vdp_st = vdp.presentation_queue_target_create_x11(vdp_device, x11->window,
&vdp_flip_target);
- CHECK_ST_ERROR("Error when calling vdp_presentation_queue_target_create_x11")
+ CHECK_ST_ERROR("Error when calling vdp.presentation_queue_target_create_x11")
- vdp_st = vdp_presentation_queue_create(vdp_device, vdp_flip_target,
+ vdp_st = vdp.presentation_queue_create(vdp_device, vdp_flip_target,
&vdp_flip_queue);
- CHECK_ST_ERROR("Error when calling vdp_presentation_queue_create")
+ CHECK_ST_ERROR("Error when calling vdp.presentation_queue_create")
return 0;
}
@@ -356,7 +358,7 @@ static int create_vdp_mixer(VdpChromaType vdp_chroma_type) {
if (sharpen)
features[feature_count++] = VDP_VIDEO_MIXER_FEATURE_SHARPNESS;
- vdp_st = vdp_video_mixer_create(vdp_device, feature_count, features,
+ vdp_st = vdp.video_mixer_create(vdp_device, feature_count, features,
VDP_NUM_MIXER_PARAMETER,
parameters, parameter_values,
&video_mixer);
@@ -366,13 +368,13 @@ static int create_vdp_mixer(VdpChromaType vdp_chroma_type) {
if (deint < 3)
feature_enables[0] = VDP_FALSE;
if (feature_count)
- vdp_video_mixer_set_feature_enables(video_mixer, feature_count, features, feature_enables);
+ vdp.video_mixer_set_feature_enables(video_mixer, feature_count, features, feature_enables);
if (denoise)
- vdp_video_mixer_set_attribute_values(video_mixer, 1, denoise_attrib, denoise_value);
+ vdp.video_mixer_set_attribute_values(video_mixer, 1, denoise_attrib, denoise_value);
if (sharpen)
- vdp_video_mixer_set_attribute_values(video_mixer, 1, sharpen_attrib, sharpen_value);
+ vdp.video_mixer_set_attribute_values(video_mixer, 1, sharpen_attrib, sharpen_value);
if (!chroma_deint)
- vdp_video_mixer_set_attribute_values(video_mixer, 1, skip_chroma_attrib, skip_chroma_value_ptr);
+ vdp.video_mixer_set_attribute_values(video_mixer, 1, skip_chroma_attrib, skip_chroma_value_ptr);
return 0;
}
@@ -383,7 +385,7 @@ static void free_video_specific(void) {
VdpStatus vdp_st;
if (decoder != VDP_INVALID_HANDLE)
- vdp_decoder_destroy(decoder);
+ vdp.decoder_destroy(decoder);
decoder = VDP_INVALID_HANDLE;
decoder_max_refs = -1;
@@ -398,14 +400,14 @@ static void free_video_specific(void) {
for (i = 0; i < MAX_VIDEO_SURFACES; i++) {
if (surface_render[i].surface != VDP_INVALID_HANDLE) {
- vdp_st = vdp_video_surface_destroy(surface_render[i].surface);
+ vdp_st = vdp.video_surface_destroy(surface_render[i].surface);
CHECK_ST_WARNING("Error when calling vdp_video_surface_destroy")
}
surface_render[i].surface = VDP_INVALID_HANDLE;
}
if (video_mixer != VDP_INVALID_HANDLE) {
- vdp_st = vdp_video_mixer_destroy(video_mixer);
+ vdp_st = vdp.video_mixer_destroy(video_mixer);
CHECK_ST_WARNING("Error when calling vdp_video_mixer_destroy")
}
video_mixer = VDP_INVALID_HANDLE;
@@ -416,7 +418,7 @@ static int create_vdp_decoder(int max_refs)
VdpStatus vdp_st;
VdpDecoderProfile vdp_decoder_profile;
if (decoder != VDP_INVALID_HANDLE)
- vdp_decoder_destroy(decoder);
+ vdp.decoder_destroy(decoder);
switch (image_format) {
case IMGFMT_VDPAU_MPEG1:
vdp_decoder_profile = VDP_DECODER_PROFILE_MPEG1;
@@ -435,7 +437,7 @@ static int create_vdp_decoder(int max_refs)
vdp_decoder_profile = VDP_DECODER_PROFILE_VC1_ADVANCED;
break;
}
- vdp_st = vdp_decoder_create(vdp_device, vdp_decoder_profile,
+ vdp_st = vdp.decoder_create(vdp_device, vdp_decoder_profile,
vid_width, vid_height, max_refs, &decoder);
CHECK_ST_WARNING("Failed creating VDPAU decoder");
if (vdp_st != VDP_STATUS_OK) {
@@ -558,11 +560,11 @@ static void check_events(struct vo *vo)
if (visible_buf) {
/* redraw the last visible buffer */
VdpStatus vdp_st;
- vdp_st = vdp_presentation_queue_display(vdp_flip_queue,
+ vdp_st = vdp.presentation_queue_display(vdp_flip_queue,
output_surfaces[surface_num],
vo->dwidth, vo->dheight,
0);
- CHECK_ST_WARNING("Error when calling vdp_presentation_queue_display")
+ CHECK_ST_WARNING("Error when calling vdp.presentation_queue_display")
}
}
}
@@ -602,14 +604,14 @@ static void draw_osd_I8A8(void *ctx, int x0, int y0, int w, int h,
pitch = w*2;
// write source_data to osd_surface.
- vdp_st = vdp_output_surface_put_bits_indexed(osd_surface,
+ vdp_st = vdp.output_surface_put_bits_indexed(osd_surface,
VDP_INDEXED_FORMAT_I8A8,
(const void *const*)&index_data,
&pitch,
&output_indexed_rect_vid,
VDP_COLOR_TABLE_FORMAT_B8G8R8X8,
(void *)palette);
- CHECK_ST_WARNING("Error when calling vdp_output_surface_put_bits_indexed")
+ CHECK_ST_WARNING("Error when calling vdp.output_surface_put_bits_indexed")
blend_state.struct_version = VDP_OUTPUT_SURFACE_RENDER_BLEND_STATE_VERSION;
blend_state.blend_factor_source_color = VDP_OUTPUT_SURFACE_RENDER_BLEND_FACTOR_ONE;
@@ -619,14 +621,14 @@ static void draw_osd_I8A8(void *ctx, int x0, int y0, int w, int h,
blend_state.blend_equation_color = VDP_OUTPUT_SURFACE_RENDER_BLEND_EQUATION_ADD;
blend_state.blend_equation_alpha = VDP_OUTPUT_SURFACE_RENDER_BLEND_EQUATION_ADD;
- vdp_st = vdp_output_surface_render_output_surface(output_surface,
+ vdp_st = vdp.output_surface_render_output_surface(output_surface,
&output_indexed_rect_vid,
osd_surface,
&output_indexed_rect_vid,
NULL,
&blend_state,
VDP_OUTPUT_SURFACE_RENDER_ROTATE_0);
- CHECK_ST_WARNING("Error when calling vdp_output_surface_render_output_surface")
+ CHECK_ST_WARNING("Error when calling vdp.output_surface_render_output_surface")
}
static void draw_eosd(void) {
@@ -644,7 +646,7 @@ static void draw_eosd(void) {
blend_state.blend_equation_alpha = VDP_OUTPUT_SURFACE_RENDER_BLEND_EQUATION_ADD;
for (i=0; i<eosd_render_count; i++) {
- vdp_st = vdp_output_surface_render_bitmap_surface(
+ vdp_st = vdp.output_surface_render_bitmap_surface(
output_surface, &eosd_targets[i].dest,
eosd_targets[i].surface, &eosd_targets[i].source,
&eosd_targets[i].color, &blend_state,
@@ -689,7 +691,7 @@ static void generate_eosd(mp_eosd_images_t *imgs) {
for (j=0; j<eosd_surface_count; j++) {
if (!eosd_surfaces[j].in_use) {
if (eosd_surfaces[j].surface != VDP_INVALID_HANDLE)
- vdp_bitmap_surface_destroy(eosd_surfaces[j].surface);
+ vdp.bitmap_surface_destroy(eosd_surfaces[j].surface);
found = j;
break;
}
@@ -705,7 +707,7 @@ static void generate_eosd(mp_eosd_images_t *imgs) {
eosd_surfaces[j].in_use = 0;
}
}
- vdp_st = vdp_bitmap_surface_create(vdp_device, VDP_RGBA_FORMAT_A8,
+ vdp_st = vdp.bitmap_surface_create(vdp_device, VDP_RGBA_FORMAT_A8,
i->w, i->h, VDP_TRUE, &eosd_surfaces[found].surface);
CHECK_ST_WARNING("EOSD: error when creating surface")
eosd_surfaces[found].w = i->w;
@@ -717,7 +719,7 @@ static void generate_eosd(mp_eosd_images_t *imgs) {
destRect.y0 = 0;
destRect.x1 = i->w;
destRect.y1 = i->h;
- vdp_st = vdp_bitmap_surface_put_bits_native(eosd_targets[eosd_render_count].surface,
+ vdp_st = vdp.bitmap_surface_put_bits_native(eosd_targets[eosd_render_count].surface,
(const void *) &i->bitmap, &i->stride, &destRect);
CHECK_ST_WARNING("EOSD: putbits failed")
eosd_render_count++;
@@ -758,10 +760,10 @@ static void flip_page(struct vo *vo)
mp_msg(MSGT_VO, MSGL_DBG2, "\nFLIP_PAGE VID:%u -> OUT:%u\n",
surface_render[vid_surface_num].surface, output_surfaces[surface_num]);
- vdp_st = vdp_presentation_queue_display(vdp_flip_queue, output_surfaces[surface_num],
+ vdp_st = vdp.presentation_queue_display(vdp_flip_queue, output_surfaces[surface_num],
vo->dwidth, vo->dheight,
0);
- CHECK_ST_WARNING("Error when calling vdp_presentation_queue_display")
+ CHECK_ST_WARNING("Error when calling vdp.presentation_queue_display")
surface_num = (surface_num + 1) % NUM_OUTPUT_SURFACES;
visible_buf = 1;
@@ -779,7 +781,7 @@ static int draw_slice(struct vo *vo, uint8_t *image[], int stride[], int w,
&& !create_vdp_decoder(max_refs))
return VO_FALSE;
- vdp_st = vdp_decoder_render(decoder, rndr->surface, (void *)&rndr->info, rndr->bitstream_buffers_used, rndr->bitstream_buffers);
+ vdp_st = vdp.decoder_render(decoder, rndr->surface, (void *)&rndr->info, rndr->bitstream_buffers_used, rndr->bitstream_buffers);
CHECK_ST_WARNING("Failed VDPAU decoder rendering");
return VO_TRUE;
}
@@ -796,7 +798,7 @@ static struct vdpau_render_state *get_surface(int number)
return NULL;
if (surface_render[number].surface == VDP_INVALID_HANDLE) {
VdpStatus vdp_st;
- vdp_st = vdp_video_surface_create(vdp_device, vdp_chroma_type,
+ vdp_st = vdp.video_surface_create(vdp_device, vdp_chroma_type,
vid_width, vid_height,
&surface_render[number].surface);
CHECK_ST_WARNING("Error when calling vdp_video_surface_create")
@@ -827,7 +829,7 @@ static uint32_t draw_image(struct vo *vo, mp_image_t *mpi)
vid_surface_num = rndr - surface_render;
if (image_format == IMGFMT_NV12)
destdata[1] = destdata[2];
- vdp_st = vdp_video_surface_put_bits_y_cb_cr(rndr->surface,
+ vdp_st = vdp.video_surface_put_bits_y_cb_cr(rndr->surface,
vdp_pixel_format,
(const void *const*)destdata,
mpi->stride); // pitch
@@ -894,27 +896,27 @@ static void DestroyVdpauObjects(void)
free_video_specific();
- vdp_st = vdp_presentation_queue_destroy(vdp_flip_queue);
- CHECK_ST_WARNING("Error when calling vdp_presentation_queue_destroy")
+ vdp_st = vdp.presentation_queue_destroy(vdp_flip_queue);
+ CHECK_ST_WARNING("Error when calling vdp.presentation_queue_destroy")
- vdp_st = vdp_presentation_queue_target_destroy(vdp_flip_target);
- CHECK_ST_WARNING("Error when calling vdp_presentation_queue_target_destroy")
+ vdp_st = vdp.presentation_queue_target_destroy(vdp_flip_target);
+ CHECK_ST_WARNING("Error when calling vdp.presentation_queue_target_destroy")
for (i = 0; i <= NUM_OUTPUT_SURFACES; i++) {
- vdp_st = vdp_output_surface_destroy(output_surfaces[i]);
+ vdp_st = vdp.output_surface_destroy(output_surfaces[i]);
output_surfaces[i] = VDP_INVALID_HANDLE;
- CHECK_ST_WARNING("Error when calling vdp_output_surface_destroy")
+ CHECK_ST_WARNING("Error when calling vdp.output_surface_destroy")
}
for (i = 0; i<eosd_surface_count; i++) {
if (eosd_surfaces[i].surface != VDP_INVALID_HANDLE) {
- vdp_st = vdp_bitmap_surface_destroy(eosd_surfaces[i].surface);
- CHECK_ST_WARNING("Error when calling vdp_bitmap_surface_destroy")
+ vdp_st = vdp.bitmap_surface_destroy(eosd_surfaces[i].surface);
+ CHECK_ST_WARNING("Error when calling vdp.bitmap_surface_destroy")
}
eosd_surfaces[i].surface = VDP_INVALID_HANDLE;
}
- vdp_st = vdp_device_destroy(vdp_device);
+ vdp_st = vdp.device_destroy(vdp_device);
CHECK_ST_WARNING("Error when calling vdp_device_destroy")
}
@@ -1071,10 +1073,10 @@ static int set_equalizer(const char *name, int value) {
else
return VO_NOTIMPL;
- vdp_st = vdp_generate_csc_matrix(&procamp, VDP_COLOR_STANDARD_ITUR_BT_601,
+ vdp_st = vdp.generate_csc_matrix(&procamp, VDP_COLOR_STANDARD_ITUR_BT_601,
&matrix);
CHECK_ST_WARNING("Error when generating CSC matrix")
- vdp_st = vdp_video_mixer_set_attribute_values(video_mixer, 1, attributes,
+ vdp_st = vdp.video_mixer_set_attribute_values(video_mixer, 1, attributes,
attribute_values);
CHECK_ST_WARNING("Error when setting CSC matrix")
return VO_TRUE;
@@ -1097,7 +1099,7 @@ static int control(struct vo *vo, uint32_t request, void *data)
VDP_VIDEO_MIXER_FEATURE_DEINTERLACE_TEMPORAL :
VDP_VIDEO_MIXER_FEATURE_DEINTERLACE_TEMPORAL_SPATIAL};
VdpBool feature_enables[1] = {deint ? VDP_TRUE : VDP_FALSE};
- vdp_st = vdp_video_mixer_set_feature_enables(video_mixer, 1,
+ vdp_st = vdp.video_mixer_set_feature_enables(video_mixer, 1,
features,
feature_enables);
CHECK_ST_WARNING("Error changing deinterlacing settings")