diff options
author | Carl-Anton Ingmarsson <ca.ingmarsson@gmail.com> | 2009-03-23 21:36:55 +0100 |
---|---|---|
committer | Jan Schmidt <thaytan@noraisin.net> | 2009-06-20 15:21:20 +0100 |
commit | 3a48982235b6e97af21986e427dcaffa636acfb8 (patch) | |
tree | 90e2acfa51a6b804e1636332ffff22a13407ea10 /sys/vdpau | |
parent | 24dfc72e89e73a7b6fa6015a1b9f61038a223c02 (diff) | |
download | gst-plugins-bad-3a48982235b6e97af21986e427dcaffa636acfb8.tar.gz gst-plugins-bad-3a48982235b6e97af21986e427dcaffa636acfb8.tar.bz2 gst-plugins-bad-3a48982235b6e97af21986e427dcaffa636acfb8.zip |
vdpau: init vdpau in GST_STATE_CHANGE_NULL_TO_READY add gst_vdpaudecoder_push_video_surface to vdpaudecoder.h
Diffstat (limited to 'sys/vdpau')
-rw-r--r-- | sys/vdpau/gstvdpaudecoder.c | 36 | ||||
-rw-r--r-- | sys/vdpau/gstvdpaudecoder.h | 2 | ||||
-rw-r--r-- | sys/vdpau/vdpauvariables.h | 4 |
3 files changed, 35 insertions, 7 deletions
diff --git a/sys/vdpau/gstvdpaudecoder.c b/sys/vdpau/gstvdpaudecoder.c index bea707f5..932490b9 100644 --- a/sys/vdpau/gstvdpaudecoder.c +++ b/sys/vdpau/gstvdpaudecoder.c @@ -71,7 +71,7 @@ static void gst_vdpaudecoder_set_property (GObject * object, guint prop_id, static void gst_vdpaudecoder_get_property (GObject * object, guint prop_id, GValue * value, GParamSpec * pspec); -static gboolean +gboolean gst_vdpaudecoder_push_video_surface (GstVdpauDecoder * dec, VdpVideoSurface * surface) { @@ -82,6 +82,8 @@ gst_vdpaudecoder_push_video_surface (GstVdpauDecoder * dec, default: break; } + + return TRUE; } typedef struct @@ -201,7 +203,7 @@ gst_vdpaudecoder_init_vdpau (GstVdpauDecoder * dec) if (!display) { GST_ELEMENT_ERROR (dec, RESOURCE, READ, ("Could not initialise VDPAU"), ("Could not open display")); - return GST_STATE_CHANGE_FAILURE; + return FALSE; } screen = DefaultScreen (display); @@ -223,16 +225,40 @@ gst_vdpaudecoder_init_vdpau (GstVdpauDecoder * dec) 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); caps = gst_vdpaudecoder_get_vdpau_support (dec); - if (!caps) + if (!caps) { + vdp_device_destroy (dec->device); + dec->device = 0; return FALSE; + } dec->src_caps = caps; return TRUE; } +static GstStateChangeReturn +gst_vdpaudecoder_change_state (GstElement * element, GstStateChange transition) +{ + GstVdpauDecoder *dec; + + dec = GST_VDPAU_DECODER (element); + + switch (transition) { + case GST_STATE_CHANGE_NULL_TO_READY: + if (!gst_vdpaudecoder_init_vdpau (dec)) + return GST_STATE_CHANGE_FAILURE; + break; + default: + break; + } + + return GST_STATE_CHANGE_SUCCESS; +} + static gboolean gst_vdpaudecoder_sink_set_caps (GstPad * pad, GstCaps * caps) { @@ -329,6 +355,8 @@ gst_vdpaudecoder_class_init (GstVdpauDecoderClass * klass) g_object_class_install_property (gobject_class, PROP_SILENT, g_param_spec_boolean ("silent", "Silent", "Produce verbose output ?", FALSE, G_PARAM_READWRITE | GST_PARAM_CONTROLLABLE)); + + gstelement_class->change_state = gst_vdpaudecoder_change_state; } static void @@ -347,8 +375,6 @@ gst_vdpaudecoder_init (GstVdpauDecoder * dec, GstVdpauDecoderClass * klass) (GST_ELEMENT_CLASS (klass), "sink"), "sink"); gst_pad_set_setcaps_function (dec->sink, gst_vdpaudecoder_sink_set_caps); gst_element_add_pad (GST_ELEMENT (dec), dec->sink); - - gst_vdpaudecoder_init_vdpau (dec); } static void diff --git a/sys/vdpau/gstvdpaudecoder.h b/sys/vdpau/gstvdpaudecoder.h index 7d59f2e2..2c8b11f7 100644 --- a/sys/vdpau/gstvdpaudecoder.h +++ b/sys/vdpau/gstvdpaudecoder.h @@ -65,6 +65,8 @@ struct _GstVdpauDecoderClass { GType gst_vdpaudecoder_get_type (void); +gboolean gst_vdpaudecoder_push_video_surface (GstVdpauDecoder * dec, VdpVideoSurface * surface); + G_END_DECLS #endif /* __GST_VDPAU_DECODER_H__ */ diff --git a/sys/vdpau/vdpauvariables.h b/sys/vdpau/vdpauvariables.h index ab274aa8..b93a75be 100644 --- a/sys/vdpau/vdpauvariables.h +++ b/sys/vdpau/vdpauvariables.h @@ -4,9 +4,9 @@ static VdpVideoSurfaceQueryCapabilities *vdp_video_surface_query_capabilities; static VdpVideoSurfaceQueryGetPutBitsYCbCrCapabilities *vdp_video_surface_query_ycbcr_capabilities; static VdpGetProcAddress *vdp_get_proc_address; -#if 0 - static VdpDeviceDestroy *vdp_device_destroy; + +#if 0 static VdpVideoSurfaceCreate *vdp_video_surface_create; static VdpVideoSurfaceDestroy *vdp_video_surface_destroy; |