summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authorCarl-Anton Ingmarsson <ca.ingmarsson@gmail.com>2009-03-27 17:11:04 +0100
committerJan Schmidt <thaytan@noraisin.net>2009-06-20 15:21:22 +0100
commit584b000583c7050689d7a93e5d6dc7083bbdfcbd (patch)
tree4a95820a42bdd0c2f79737ba01332af624e98d0b /sys
parent29d0c5bdd8beeb2b1ed25e8bf37eec9a135c5422 (diff)
downloadgst-plugins-bad-584b000583c7050689d7a93e5d6dc7083bbdfcbd.tar.gz
gst-plugins-bad-584b000583c7050689d7a93e5d6dc7083bbdfcbd.tar.bz2
gst-plugins-bad-584b000583c7050689d7a93e5d6dc7083bbdfcbd.zip
vdpau: store vdpau function pointers in a local structure
Diffstat (limited to 'sys')
-rw-r--r--sys/vdpau/Makefile.am1
-rw-r--r--sys/vdpau/gstvdpaudecoder.c40
-rw-r--r--sys/vdpau/gstvdpaudecoder.h17
-rw-r--r--sys/vdpau/vdpauvariables.h46
4 files changed, 43 insertions, 61 deletions
diff --git a/sys/vdpau/Makefile.am b/sys/vdpau/Makefile.am
index f66c4aa4..b786be0d 100644
--- a/sys/vdpau/Makefile.am
+++ b/sys/vdpau/Makefile.am
@@ -12,7 +12,6 @@ libgstvdpau_la_LIBTOOLFLAGS = --tag=disable-static
noinst_HEADERS = \
gstvdpaudecoder.h \
- vdpauvariables.h \
gstvdpaumpegdecoder.h \
mpegutil.h
diff --git a/sys/vdpau/gstvdpaudecoder.c b/sys/vdpau/gstvdpaudecoder.c
index 7d4ecb39..007837f4 100644
--- a/sys/vdpau/gstvdpaudecoder.c
+++ b/sys/vdpau/gstvdpaudecoder.c
@@ -29,7 +29,6 @@
#include <X11/Xlib.h>
#include <vdpau/vdpau_x11.h>
-#include "vdpauvariables.h"
#include "gstvdpaudecoder.h"
GST_DEBUG_CATEGORY_STATIC (gst_vdpaudecoder_debug);
@@ -71,6 +70,10 @@ gboolean
gst_vdpaudecoder_push_video_surface (GstVdpauDecoder * dec,
VdpVideoSurface surface)
{
+ VdpauFunctions *f;
+
+ f = dec->functions;
+
switch (dec->format) {
case GST_MAKE_FOURCC ('Y', 'V', '1', '2'):
{
@@ -92,7 +95,7 @@ gst_vdpaudecoder_push_video_surface (GstVdpauDecoder * dec,
data[2] = data[1] + dec->height * dec->width / 4;
status =
- vdp_video_surface_get_bits_ycbcr (surface, VDP_YCBCR_FORMAT_YV12,
+ f->vdp_video_surface_get_bits_ycbcr (surface, VDP_YCBCR_FORMAT_YV12,
(void *) data, NULL);
if (G_UNLIKELY (status != VDP_STATUS_OK))
return FALSE;
@@ -151,9 +154,12 @@ static VdpauFormats formats[6] = {
static GstCaps *
gst_vdpaudecoder_get_vdpau_support (GstVdpauDecoder * dec)
{
+ VdpauFunctions *f;
GstCaps *caps;
gint i;
+ f = dec->functions;
+
caps = gst_caps_new_empty ();
for (i = 0; i < 3; i++) {
@@ -161,7 +167,8 @@ gst_vdpaudecoder_get_vdpau_support (GstVdpauDecoder * dec)
VdpBool is_supported;
guint32 max_w, max_h;
- status = vdp_video_surface_query_capabilities (dec->device, chroma_types[i],
+ status =
+ f->vdp_video_surface_query_capabilities (dec->device, chroma_types[i],
&is_supported, &max_w, &max_h);
if (status != VDP_STATUS_OK && status != VDP_STATUS_INVALID_CHROMA_TYPE) {
@@ -179,7 +186,7 @@ gst_vdpaudecoder_get_vdpau_support (GstVdpauDecoder * dec)
continue;
status =
- vdp_video_surface_query_ycbcr_capabilities (dec->device,
+ f->vdp_video_surface_query_ycbcr_capabilities (dec->device,
formats[j].chroma_type, formats[j].format, &is_supported);
if (status != VDP_STATUS_OK
&& status != VDP_STATUS_INVALID_Y_CB_CR_FORMAT) {
@@ -215,6 +222,7 @@ gst_vdpaudecoder_init_vdpau (GstVdpauDecoder * dec)
{
Display *display;
int screen;
+ VdpauFunctions *f;
VdpStatus status;
GstCaps *caps;
@@ -226,10 +234,12 @@ gst_vdpaudecoder_init_vdpau (GstVdpauDecoder * dec)
return FALSE;
}
+ f = dec->functions;
+
screen = DefaultScreen (display);
status =
vdp_device_create_x11 (display, screen, &dec->device,
- &vdp_get_proc_address);
+ &f->vdp_get_proc_address);
if (status != VDP_STATUS_OK) {
GST_ELEMENT_ERROR (dec, RESOURCE, READ, ("Could not initialise VDPAU"),
("Could not create VDPAU device"));
@@ -239,21 +249,21 @@ gst_vdpaudecoder_init_vdpau (GstVdpauDecoder * dec)
}
XCloseDisplay (display);
- vdp_get_proc_address (dec->device,
+ f->vdp_get_proc_address (dec->device,
VDP_FUNC_ID_VIDEO_SURFACE_QUERY_CAPABILITIES,
- (void **) &vdp_video_surface_query_capabilities);
- vdp_get_proc_address (dec->device,
+ (void **) &f->vdp_video_surface_query_capabilities);
+ f->vdp_get_proc_address (dec->device,
VDP_FUNC_ID_VIDEO_SURFACE_QUERY_GET_PUT_BITS_Y_CB_CR_CAPABILITIES,
- (void **) &vdp_video_surface_query_ycbcr_capabilities);
- vdp_get_proc_address (dec->device,
- VDP_FUNC_ID_DEVICE_DESTROY, (void **) &vdp_device_destroy);
- vdp_get_proc_address (dec->device,
+ (void **) &f->vdp_video_surface_query_ycbcr_capabilities);
+ f->vdp_get_proc_address (dec->device,
+ VDP_FUNC_ID_DEVICE_DESTROY, (void **) &f->vdp_device_destroy);
+ f->vdp_get_proc_address (dec->device,
VDP_FUNC_ID_VIDEO_SURFACE_GET_BITS_Y_CB_CR,
- (void **) &vdp_video_surface_get_bits_ycbcr);
+ (void **) &f->vdp_video_surface_get_bits_ycbcr);
caps = gst_vdpaudecoder_get_vdpau_support (dec);
if (!caps) {
- vdp_device_destroy (dec->device);
+ f->vdp_device_destroy (dec->device);
dec->device = 0;
return FALSE;
}
@@ -402,6 +412,8 @@ gst_vdpaudecoder_init (GstVdpauDecoder * dec, GstVdpauDecoderClass * klass)
dec->width = 0;
dec->format = 0;
+ dec->functions = g_slice_new0 (VdpauFunctions);
+
dec->src = gst_pad_new_from_static_template (&src_template, "src");
gst_pad_set_getcaps_function (dec->src, gst_vdpaudecoder_src_getcaps);
gst_element_add_pad (GST_ELEMENT (dec), dec->src);
diff --git a/sys/vdpau/gstvdpaudecoder.h b/sys/vdpau/gstvdpaudecoder.h
index d8b8aa33..2c1a274f 100644
--- a/sys/vdpau/gstvdpaudecoder.h
+++ b/sys/vdpau/gstvdpaudecoder.h
@@ -38,6 +38,7 @@ G_BEGIN_DECLS
typedef struct _GstVdpauDecoder GstVdpauDecoder;
typedef struct _GstVdpauDecoderClass GstVdpauDecoderClass;
+typedef struct _VdpauFunctions VdpauFunctions;
struct _GstVdpauDecoder {
GstElement element;
@@ -45,6 +46,8 @@ struct _GstVdpauDecoder {
gchar *display;
VdpDevice device;
+ VdpauFunctions *functions;
+
GstPad *src;
GstPad *sink;
@@ -62,6 +65,20 @@ struct _GstVdpauDecoderClass {
gboolean (*set_caps) (GstVdpauDecoder *dec, GstCaps *caps);
};
+struct _VdpauFunctions {
+ VdpGetProcAddress *vdp_get_proc_address;
+
+ VdpVideoSurfaceQueryCapabilities *vdp_video_surface_query_capabilities;
+ VdpVideoSurfaceQueryGetPutBitsYCbCrCapabilities *vdp_video_surface_query_ycbcr_capabilities;
+ VdpVideoSurfaceGetBitsYCbCr *vdp_video_surface_get_bits_ycbcr;
+
+ VdpDeviceDestroy *vdp_device_destroy;
+
+ VdpDecoderCreate *vdp_decoder_create;
+ VdpDecoderDestroy *vdp_decoder_destroy;
+ VdpDecoderRender *vdp_decoder_render;
+};
+
GType gst_vdpaudecoder_get_type (void);
gboolean gst_vdpaudecoder_push_video_surface (GstVdpauDecoder * dec, VdpVideoSurface surface);
diff --git a/sys/vdpau/vdpauvariables.h b/sys/vdpau/vdpauvariables.h
deleted file mode 100644
index c0f7bb4f..00000000
--- a/sys/vdpau/vdpauvariables.h
+++ /dev/null
@@ -1,46 +0,0 @@
-#include <vdpau/vdpau.h>
-
-static VdpVideoSurfaceQueryCapabilities *vdp_video_surface_query_capabilities;
-static VdpVideoSurfaceQueryGetPutBitsYCbCrCapabilities *vdp_video_surface_query_ycbcr_capabilities;
-static VdpVideoSurfaceGetBitsYCbCr *vdp_video_surface_get_bits_ycbcr;
-
-static VdpGetProcAddress *vdp_get_proc_address;
-static VdpDeviceDestroy *vdp_device_destroy;
-
-#if 0
-static VdpVideoSurfaceCreate *vdp_video_surface_create;
-static VdpVideoSurfaceDestroy *vdp_video_surface_destroy;
-
-static VdpGetErrorString *vdp_get_error_string;
-
-static VdpVideoSurfacePutBitsYCbCr *vdp_video_surface_put_bits_y_cb_cr;
-static VdpOutputSurfacePutBitsNative *vdp_output_surface_put_bits_native;
-
-static VdpOutputSurfaceCreate *vdp_output_surface_create;
-static VdpOutputSurfaceDestroy *vdp_output_surface_destroy;
-
-static VdpVideoMixerCreate *vdp_video_mixer_create;
-static VdpVideoMixerDestroy *vdp_video_mixer_destroy;
-static VdpVideoMixerRender *vdp_video_mixer_render;
-static VdpVideoMixerSetFeatureEnables *vdp_video_mixer_set_feature_enables;
-static VdpVideoMixerSetAttributeValues *vdp_video_mixer_set_attribute_values;
-
-static VdpPresentationQueueTargetDestroy *vdp_presentation_queue_target_destroy;
-static VdpPresentationQueueCreate *vdp_presentation_queue_create;
-static VdpPresentationQueueDestroy *vdp_presentation_queue_destroy;
-static VdpPresentationQueueDisplay *vdp_presentation_queue_display;
-static VdpPresentationQueueBlockUntilSurfaceIdle *vdp_presentation_queue_block_until_surface_idle;
-static VdpPresentationQueueTargetCreateX11 *vdp_presentation_queue_target_create_x11;
-
-static VdpOutputSurfaceRenderOutputSurface *vdp_output_surface_render_output_surface;
-static VdpOutputSurfacePutBitsIndexed *vdp_output_surface_put_bits_indexed;
-static VdpOutputSurfaceRenderBitmapSurface *vdp_output_surface_render_bitmap_surface;
-
-static VdpBitmapSurfaceCreate *vdp_bitmap_surface_create;
-static VdpBitmapSurfaceDestroy *vdp_bitmap_surface_destroy;
-static VdpBitmapSurfacePutBitsNative *vdp_bitmap_surface_putbits_native;
-
-static VdpDecoderCreate *vdp_decoder_create;
-static VdpDecoderDestroy *vdp_decoder_destroy;
-static VdpDecoderRender *vdp_decoder_render;
-#endif \ No newline at end of file