vdpau: init vdpau in GST_STATE_CHANGE_NULL_TO_READY add gst_vdpaudecoder_push_video_surface to vdpaudecoder.h

This commit is contained in:
Carl-Anton Ingmarsson 2009-03-23 21:36:55 +01:00 committed by Jan Schmidt
parent 24dfc72e89
commit 3a48982235
3 changed files with 35 additions and 7 deletions

View file

@ -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

View file

@ -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__ */

View file

@ -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;