diff options
-rw-r--r-- | sys/vdpau/gstvdp/gstvdpdecoder.c | 100 | ||||
-rw-r--r-- | sys/vdpau/gstvdp/gstvdpdecoder.h | 4 | ||||
-rw-r--r-- | sys/vdpau/gstvdp/gstvdpvideosrcpad.c | 175 | ||||
-rw-r--r-- | sys/vdpau/gstvdp/gstvdpvideosrcpad.h | 2 | ||||
-rw-r--r-- | sys/vdpau/h264/gstvdph264dec.c | 5 | ||||
-rw-r--r-- | sys/vdpau/mpeg/gstvdpmpegdec.c | 5 |
6 files changed, 135 insertions, 156 deletions
diff --git a/sys/vdpau/gstvdp/gstvdpdecoder.c b/sys/vdpau/gstvdp/gstvdpdecoder.c index a87ea6a3c..8870398b2 100644 --- a/sys/vdpau/gstvdp/gstvdpdecoder.c +++ b/sys/vdpau/gstvdp/gstvdpdecoder.c | |||
@@ -102,23 +102,6 @@ gst_vdp_decoder_alloc_buffer (GstVdpDecoder * vdp_decoder, | |||
102 | return ret; | 102 | return ret; |
103 | } | 103 | } |
104 | 104 | ||
105 | static GstFlowReturn | ||
106 | gst_vdp_decoder_get_device (GstVdpDecoder * vdp_decoder, GstVdpDevice ** device) | ||
107 | { | ||
108 | GstVdpVideoSrcPad *vdp_pad; | ||
109 | |||
110 | GstFlowReturn ret; | ||
111 | GError *err = NULL; | ||
112 | |||
113 | vdp_pad = (GstVdpVideoSrcPad *) GST_BASE_VIDEO_DECODER_SRC_PAD (vdp_decoder); | ||
114 | |||
115 | ret = gst_vdp_video_src_pad_get_device (vdp_pad, device, &err); | ||
116 | if (ret == GST_FLOW_ERROR) | ||
117 | gst_vdp_decoder_post_error (vdp_decoder, err); | ||
118 | |||
119 | return ret; | ||
120 | } | ||
121 | |||
122 | GstFlowReturn | 105 | GstFlowReturn |
123 | gst_vdp_decoder_render (GstVdpDecoder * vdp_decoder, VdpPictureInfo * info, | 106 | gst_vdp_decoder_render (GstVdpDecoder * vdp_decoder, VdpPictureInfo * info, |
124 | guint n_bufs, VdpBitstreamBuffer * bufs, GstVdpVideoBuffer ** video_buf) | 107 | guint n_bufs, VdpBitstreamBuffer * bufs, GstVdpVideoBuffer ** video_buf) |
@@ -158,15 +141,12 @@ GstFlowReturn | |||
158 | gst_vdp_decoder_init_decoder (GstVdpDecoder * vdp_decoder, | 141 | gst_vdp_decoder_init_decoder (GstVdpDecoder * vdp_decoder, |
159 | VdpDecoderProfile profile, guint32 max_references) | 142 | VdpDecoderProfile profile, guint32 max_references) |
160 | { | 143 | { |
161 | GstFlowReturn ret; | ||
162 | GstVdpDevice *device; | 144 | GstVdpDevice *device; |
163 | 145 | ||
164 | VdpStatus status; | 146 | VdpStatus status; |
165 | GstVideoState state; | 147 | GstVideoState state; |
166 | 148 | ||
167 | ret = gst_vdp_decoder_get_device (vdp_decoder, &device); | 149 | device = vdp_decoder->device; |
168 | if (ret != GST_FLOW_OK) | ||
169 | return ret; | ||
170 | 150 | ||
171 | if (vdp_decoder->decoder != VDP_INVALID_HANDLE) { | 151 | if (vdp_decoder->decoder != VDP_INVALID_HANDLE) { |
172 | status = device->vdp_decoder_destroy (vdp_decoder->decoder); | 152 | status = device->vdp_decoder_destroy (vdp_decoder->decoder); |
@@ -201,6 +181,55 @@ create_decoder_error: | |||
201 | return GST_FLOW_ERROR; | 181 | return GST_FLOW_ERROR; |
202 | } | 182 | } |
203 | 183 | ||
184 | static gboolean | ||
185 | gst_vdp_decoder_start (GstBaseVideoDecoder * base_video_decoder) | ||
186 | { | ||
187 | GstVdpDecoder *vdp_decoder = GST_VDP_DECODER (base_video_decoder); | ||
188 | |||
189 | GstVdpVideoSrcPad *vdp_pad; | ||
190 | |||
191 | vdp_decoder->device = gst_vdp_get_device (vdp_decoder->display); | ||
192 | if (G_UNLIKELY (!vdp_decoder->device)) | ||
193 | goto device_error; | ||
194 | |||
195 | vdp_pad = | ||
196 | (GstVdpVideoSrcPad *) GST_BASE_VIDEO_DECODER_SRC_PAD (base_video_decoder); | ||
197 | g_object_set (G_OBJECT (vdp_pad), "device", vdp_decoder->device, NULL); | ||
198 | |||
199 | vdp_decoder->decoder = VDP_INVALID_HANDLE; | ||
200 | |||
201 | return TRUE; | ||
202 | |||
203 | device_error: | ||
204 | GST_ELEMENT_ERROR (vdp_decoder, RESOURCE, OPEN_READ, | ||
205 | ("Couldn't create GstVdpDevice"), (NULL)); | ||
206 | return FALSE; | ||
207 | } | ||
208 | |||
209 | static gboolean | ||
210 | gst_vdp_decoder_stop (GstBaseVideoDecoder * base_video_decoder) | ||
211 | { | ||
212 | GstVdpDecoder *vdp_decoder = GST_VDP_DECODER (base_video_decoder); | ||
213 | |||
214 | if (vdp_decoder->decoder != VDP_INVALID_HANDLE) { | ||
215 | GstVdpDevice *device = vdp_decoder->device; | ||
216 | VdpStatus status; | ||
217 | |||
218 | status = device->vdp_decoder_destroy (vdp_decoder->decoder); | ||
219 | if (status != VDP_STATUS_OK) { | ||
220 | GST_ELEMENT_ERROR (vdp_decoder, RESOURCE, READ, | ||
221 | ("Could not destroy vdpau decoder"), | ||
222 | ("Error returned from vdpau was: %s", | ||
223 | device->vdp_get_error_string (status))); | ||
224 | return FALSE; | ||
225 | } | ||
226 | } | ||
227 | |||
228 | g_object_unref (vdp_decoder->device); | ||
229 | |||
230 | return TRUE; | ||
231 | } | ||
232 | |||
204 | static void | 233 | static void |
205 | gst_vdp_decoder_get_property (GObject * object, guint prop_id, | 234 | gst_vdp_decoder_get_property (GObject * object, guint prop_id, |
206 | GValue * value, GParamSpec * pspec) | 235 | GValue * value, GParamSpec * pspec) |
@@ -209,10 +238,9 @@ gst_vdp_decoder_get_property (GObject * object, guint prop_id, | |||
209 | 238 | ||
210 | switch (prop_id) { | 239 | switch (prop_id) { |
211 | case PROP_DISPLAY: | 240 | case PROP_DISPLAY: |
212 | g_object_get_property | 241 | g_value_set_string (value, vdp_decoder->display); |
213 | (G_OBJECT (GST_BASE_VIDEO_DECODER_SRC_PAD (vdp_decoder)), "display", | ||
214 | value); | ||
215 | break; | 242 | break; |
243 | |||
216 | default: | 244 | default: |
217 | G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); | 245 | G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); |
218 | break; | 246 | break; |
@@ -227,10 +255,10 @@ gst_vdp_decoder_set_property (GObject * object, guint prop_id, | |||
227 | 255 | ||
228 | switch (prop_id) { | 256 | switch (prop_id) { |
229 | case PROP_DISPLAY: | 257 | case PROP_DISPLAY: |
230 | g_object_set_property | 258 | g_free (vdp_decoder->display); |
231 | (G_OBJECT (GST_BASE_VIDEO_DECODER_SRC_PAD (vdp_decoder)), "display", | 259 | vdp_decoder->display = g_value_dup_string (value); |
232 | value); | ||
233 | break; | 260 | break; |
261 | |||
234 | default: | 262 | default: |
235 | G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); | 263 | G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); |
236 | break; | 264 | break; |
@@ -238,6 +266,16 @@ gst_vdp_decoder_set_property (GObject * object, guint prop_id, | |||
238 | } | 266 | } |
239 | 267 | ||
240 | static void | 268 | static void |
269 | gst_vdp_decoder_finalize (GObject * object) | ||
270 | { | ||
271 | GstVdpDecoder *vdp_decoder = GST_VDP_DECODER (object); | ||
272 | |||
273 | g_free (vdp_decoder->display); | ||
274 | |||
275 | G_OBJECT_CLASS (parent_class)->finalize (object); | ||
276 | } | ||
277 | |||
278 | static void | ||
241 | gst_vdp_decoder_base_init (gpointer g_class) | 279 | gst_vdp_decoder_base_init (gpointer g_class) |
242 | { | 280 | { |
243 | GstElementClass *element_class = GST_ELEMENT_CLASS (g_class); | 281 | GstElementClass *element_class = GST_ELEMENT_CLASS (g_class); |
@@ -253,9 +291,9 @@ gst_vdp_decoder_base_init (gpointer g_class) | |||
253 | } | 291 | } |
254 | 292 | ||
255 | static void | 293 | static void |
256 | gst_vdp_decoder_init (GstVdpDecoder * decoder, GstVdpDecoderClass * klass) | 294 | gst_vdp_decoder_init (GstVdpDecoder * vdp_decoder, GstVdpDecoderClass * klass) |
257 | { | 295 | { |
258 | decoder->decoder = VDP_INVALID_HANDLE; | 296 | vdp_decoder->display = NULL; |
259 | } | 297 | } |
260 | 298 | ||
261 | static void | 299 | static void |
@@ -269,6 +307,10 @@ gst_vdp_decoder_class_init (GstVdpDecoderClass * klass) | |||
269 | 307 | ||
270 | object_class->get_property = gst_vdp_decoder_get_property; | 308 | object_class->get_property = gst_vdp_decoder_get_property; |
271 | object_class->set_property = gst_vdp_decoder_set_property; | 309 | object_class->set_property = gst_vdp_decoder_set_property; |
310 | object_class->finalize = gst_vdp_decoder_finalize; | ||
311 | |||
312 | base_video_decoder_class->start = gst_vdp_decoder_start; | ||
313 | base_video_decoder_class->stop = gst_vdp_decoder_stop; | ||
272 | 314 | ||
273 | base_video_decoder_class->create_srcpad = gst_vdp_decoder_create_srcpad; | 315 | base_video_decoder_class->create_srcpad = gst_vdp_decoder_create_srcpad; |
274 | base_video_decoder_class->shape_output = gst_vdp_decoder_shape_output; | 316 | base_video_decoder_class->shape_output = gst_vdp_decoder_shape_output; |
diff --git a/sys/vdpau/gstvdp/gstvdpdecoder.h b/sys/vdpau/gstvdp/gstvdpdecoder.h index a8ef888db..9ccf24379 100644 --- a/sys/vdpau/gstvdp/gstvdpdecoder.h +++ b/sys/vdpau/gstvdp/gstvdpdecoder.h | |||
@@ -43,7 +43,11 @@ typedef struct _GstVdpDecoderClass GstVdpDecoderClass; | |||
43 | struct _GstVdpDecoder { | 43 | struct _GstVdpDecoder { |
44 | GstBaseVideoDecoder base_video_decoder; | 44 | GstBaseVideoDecoder base_video_decoder; |
45 | 45 | ||
46 | GstVdpDevice *device; | ||
46 | VdpDecoder decoder; | 47 | VdpDecoder decoder; |
48 | |||
49 | /* properties */ | ||
50 | gchar *display; | ||
47 | }; | 51 | }; |
48 | 52 | ||
49 | struct _GstVdpDecoderClass { | 53 | struct _GstVdpDecoderClass { |
diff --git a/sys/vdpau/gstvdp/gstvdpvideosrcpad.c b/sys/vdpau/gstvdp/gstvdpvideosrcpad.c index 59c6d5f65..d2cc9bed8 100644 --- a/sys/vdpau/gstvdp/gstvdpvideosrcpad.c +++ b/sys/vdpau/gstvdp/gstvdpvideosrcpad.c | |||
@@ -28,7 +28,7 @@ GST_DEBUG_CATEGORY_STATIC (gst_vdp_video_src_pad_debug); | |||
28 | enum | 28 | enum |
29 | { | 29 | { |
30 | PROP_0, | 30 | PROP_0, |
31 | PROP_DISPLAY | 31 | PROP_DEVICE |
32 | }; | 32 | }; |
33 | 33 | ||
34 | struct _GstVdpVideoSrcPad | 34 | struct _GstVdpVideoSrcPad |
@@ -36,14 +36,13 @@ struct _GstVdpVideoSrcPad | |||
36 | GstPad pad; | 36 | GstPad pad; |
37 | 37 | ||
38 | GstCaps *caps; | 38 | GstCaps *caps; |
39 | GstVdpDevice *device; | ||
40 | 39 | ||
41 | gboolean yuv_output; | 40 | gboolean yuv_output; |
42 | gint width, height; | 41 | gint width, height; |
43 | guint32 fourcc; | 42 | guint32 fourcc; |
44 | 43 | ||
45 | /* properties */ | 44 | /* properties */ |
46 | gchar *display; | 45 | GstVdpDevice *device; |
47 | }; | 46 | }; |
48 | 47 | ||
49 | struct _GstVdpVideoSrcPadClass | 48 | struct _GstVdpVideoSrcPadClass |
@@ -57,6 +56,16 @@ GST_DEBUG_CATEGORY_INIT (gst_vdp_video_src_pad_debug, "vdpvideosrcpad", 0, "GstV | |||
57 | G_DEFINE_TYPE_WITH_CODE (GstVdpVideoSrcPad, gst_vdp_video_src_pad, GST_TYPE_PAD, | 56 | G_DEFINE_TYPE_WITH_CODE (GstVdpVideoSrcPad, gst_vdp_video_src_pad, GST_TYPE_PAD, |
58 | DEBUG_INIT ()); | 57 | DEBUG_INIT ()); |
59 | 58 | ||
59 | GstVdpVideoSrcPad * | ||
60 | gst_vdp_video_src_pad_new (GstPadTemplate * templ, const gchar * name) | ||
61 | { | ||
62 | g_return_val_if_fail (GST_IS_PAD_TEMPLATE (templ), NULL); | ||
63 | g_return_val_if_fail ((templ->direction == GST_PAD_SRC), NULL); | ||
64 | |||
65 | return g_object_new (GST_TYPE_VDP_VIDEO_SRC_PAD, | ||
66 | "name", name, "direction", templ->direction, "template", templ, NULL); | ||
67 | } | ||
68 | |||
60 | GstFlowReturn | 69 | GstFlowReturn |
61 | gst_vdp_video_src_pad_push (GstVdpVideoSrcPad * vdp_pad, | 70 | gst_vdp_video_src_pad_push (GstVdpVideoSrcPad * vdp_pad, |
62 | GstVdpVideoBuffer * video_buf) | 71 | GstVdpVideoBuffer * video_buf) |
@@ -124,41 +133,6 @@ gst_vdp_video_src_pad_push (GstVdpVideoSrcPad * vdp_pad, | |||
124 | return gst_pad_push (pad, out_buf); | 133 | return gst_pad_push (pad, out_buf); |
125 | } | 134 | } |
126 | 135 | ||
127 | static void | ||
128 | gst_vdp_video_src_pad_update_caps (GstVdpVideoSrcPad * vdp_pad) | ||
129 | { | ||
130 | GstCaps *caps; | ||
131 | const GstCaps *templ_caps; | ||
132 | |||
133 | if (vdp_pad->caps) | ||
134 | gst_caps_unref (vdp_pad->caps); | ||
135 | |||
136 | caps = gst_vdp_video_buffer_get_allowed_caps (vdp_pad->device); | ||
137 | |||
138 | if ((templ_caps = gst_pad_get_pad_template_caps (GST_PAD (vdp_pad)))) { | ||
139 | vdp_pad->caps = gst_caps_intersect (caps, templ_caps); | ||
140 | gst_caps_unref (caps); | ||
141 | } else | ||
142 | vdp_pad->caps = caps; | ||
143 | } | ||
144 | |||
145 | static gboolean | ||
146 | gst_vdp_video_src_pad_open_device (GstVdpVideoSrcPad * vdp_pad, GError ** error) | ||
147 | { | ||
148 | GstVdpDevice *device; | ||
149 | |||
150 | vdp_pad->device = device = gst_vdp_get_device (vdp_pad->display); | ||
151 | if (G_UNLIKELY (!vdp_pad->device)) | ||
152 | goto device_error; | ||
153 | |||
154 | return TRUE; | ||
155 | |||
156 | device_error: | ||
157 | g_set_error (error, GST_RESOURCE_ERROR, GST_RESOURCE_ERROR_OPEN_READ, | ||
158 | "Couldn't create GstVdpDevice"); | ||
159 | return FALSE; | ||
160 | } | ||
161 | |||
162 | static GstFlowReturn | 136 | static GstFlowReturn |
163 | gst_vdp_video_src_pad_alloc_with_caps (GstVdpVideoSrcPad * vdp_pad, | 137 | gst_vdp_video_src_pad_alloc_with_caps (GstVdpVideoSrcPad * vdp_pad, |
164 | GstCaps * caps, GstVdpVideoBuffer ** video_buf, GError ** error) | 138 | GstCaps * caps, GstVdpVideoBuffer ** video_buf, GError ** error) |
@@ -205,32 +179,18 @@ gst_vdp_video_src_pad_alloc_buffer (GstVdpVideoSrcPad * vdp_pad, | |||
205 | return GST_FLOW_NOT_NEGOTIATED; | 179 | return GST_FLOW_NOT_NEGOTIATED; |
206 | 180 | ||
207 | if (vdp_pad->yuv_output) { | 181 | if (vdp_pad->yuv_output) { |
208 | GstVdpDevice *device; | 182 | GstVdpDevice *device = vdp_pad->device; |
209 | |||
210 | if (G_UNLIKELY (!vdp_pad->device)) { | ||
211 | if (!gst_vdp_video_src_pad_open_device (vdp_pad, error)) | ||
212 | return GST_FLOW_ERROR; | ||
213 | |||
214 | gst_vdp_video_src_pad_update_caps (vdp_pad); | ||
215 | } | ||
216 | device = vdp_pad->device; | ||
217 | 183 | ||
218 | *video_buf = gst_vdp_video_buffer_new (device, VDP_CHROMA_TYPE_420, | 184 | *video_buf = gst_vdp_video_buffer_new (device, VDP_CHROMA_TYPE_420, |
219 | vdp_pad->width, vdp_pad->height); | 185 | vdp_pad->width, vdp_pad->height); |
220 | if (!*video_buf) | 186 | if (!*video_buf) |
221 | goto video_buf_error; | 187 | goto video_buf_error; |
188 | |||
222 | } else { | 189 | } else { |
223 | ret = gst_vdp_video_src_pad_alloc_with_caps (vdp_pad, caps, video_buf, | 190 | ret = gst_vdp_video_src_pad_alloc_with_caps (vdp_pad, caps, video_buf, |
224 | error); | 191 | error); |
225 | if (ret != GST_FLOW_OK) | 192 | if (ret != GST_FLOW_OK) |
226 | return ret; | 193 | return ret; |
227 | |||
228 | if (G_UNLIKELY (!vdp_pad->device)) { | ||
229 | vdp_pad->device = | ||
230 | g_object_ref (GST_VDP_VIDEO_BUFFER (*video_buf)->device); | ||
231 | |||
232 | gst_vdp_video_src_pad_update_caps (vdp_pad); | ||
233 | } | ||
234 | } | 194 | } |
235 | 195 | ||
236 | return GST_FLOW_OK; | 196 | return GST_FLOW_OK; |
@@ -270,42 +230,6 @@ gst_vdp_video_src_pad_setcaps (GstPad * pad, GstCaps * caps) | |||
270 | return TRUE; | 230 | return TRUE; |
271 | } | 231 | } |
272 | 232 | ||
273 | GstFlowReturn | ||
274 | gst_vdp_video_src_pad_get_device (GstVdpVideoSrcPad * vdp_pad, | ||
275 | GstVdpDevice ** device, GError ** error) | ||
276 | { | ||
277 | g_return_val_if_fail (GST_IS_VDP_VIDEO_SRC_PAD (vdp_pad), FALSE); | ||
278 | |||
279 | if (!GST_PAD_CAPS (vdp_pad)) | ||
280 | return GST_FLOW_NOT_NEGOTIATED; | ||
281 | |||
282 | if (G_UNLIKELY (!vdp_pad->device)) { | ||
283 | |||
284 | if (vdp_pad->yuv_output) { | ||
285 | if (!gst_vdp_video_src_pad_open_device (vdp_pad, error)) | ||
286 | return GST_FLOW_ERROR; | ||
287 | } | ||
288 | |||
289 | else { | ||
290 | GstFlowReturn ret; | ||
291 | GstVdpVideoBuffer *buf; | ||
292 | |||
293 | ret = gst_vdp_video_src_pad_alloc_with_caps (vdp_pad, | ||
294 | GST_PAD_CAPS (vdp_pad), &buf, error); | ||
295 | if (ret != GST_FLOW_OK) | ||
296 | return ret; | ||
297 | |||
298 | vdp_pad->device = g_object_ref (buf->device); | ||
299 | gst_buffer_unref (GST_BUFFER (buf)); | ||
300 | } | ||
301 | |||
302 | gst_vdp_video_src_pad_update_caps (vdp_pad); | ||
303 | } | ||
304 | |||
305 | *device = vdp_pad->device; | ||
306 | return GST_FLOW_OK; | ||
307 | } | ||
308 | |||
309 | static GstCaps * | 233 | static GstCaps * |
310 | gst_vdp_video_src_pad_getcaps (GstPad * pad) | 234 | gst_vdp_video_src_pad_getcaps (GstPad * pad) |
311 | { | 235 | { |
@@ -325,29 +249,37 @@ gst_vdp_video_src_pad_getcaps (GstPad * pad) | |||
325 | static gboolean | 249 | static gboolean |
326 | gst_vdp_video_src_pad_activate_push (GstPad * pad, gboolean active) | 250 | gst_vdp_video_src_pad_activate_push (GstPad * pad, gboolean active) |
327 | { | 251 | { |
328 | GstVdpVideoSrcPad *vdp_pad = GST_VDP_VIDEO_SRC_PAD (pad); | 252 | GstVdpVideoSrcPad *vdp_pad = (GstVdpVideoSrcPad *) pad; |
329 | 253 | ||
330 | if (!active) { | 254 | if (!active) { |
331 | if (vdp_pad->device) | ||
332 | g_object_unref (vdp_pad->device); | ||
333 | vdp_pad->device = NULL; | ||
334 | |||
335 | if (vdp_pad->caps) | 255 | if (vdp_pad->caps) |
336 | gst_caps_unref (vdp_pad->caps); | 256 | gst_caps_unref (vdp_pad->caps); |
337 | vdp_pad->caps = NULL; | 257 | vdp_pad->caps = NULL; |
258 | |||
259 | if (vdp_pad->device) | ||
260 | gst_object_unref (vdp_pad->device); | ||
261 | vdp_pad->device = NULL; | ||
338 | } | 262 | } |
339 | 263 | ||
340 | return TRUE; | 264 | return TRUE; |
341 | } | 265 | } |
342 | 266 | ||
343 | GstVdpVideoSrcPad * | 267 | static void |
344 | gst_vdp_video_src_pad_new (GstPadTemplate * templ, const gchar * name) | 268 | gst_vdp_video_src_pad_update_caps (GstVdpVideoSrcPad * vdp_pad) |
345 | { | 269 | { |
346 | g_return_val_if_fail (GST_IS_PAD_TEMPLATE (templ), NULL); | 270 | GstCaps *caps; |
347 | g_return_val_if_fail ((templ->direction == GST_PAD_SRC), NULL); | 271 | const GstCaps *templ_caps; |
348 | 272 | ||
349 | return g_object_new (GST_TYPE_VDP_VIDEO_SRC_PAD, | 273 | if (vdp_pad->caps) |
350 | "name", name, "direction", templ->direction, "template", templ, NULL); | 274 | gst_caps_unref (vdp_pad->caps); |
275 | |||
276 | caps = gst_vdp_video_buffer_get_allowed_caps (vdp_pad->device); | ||
277 | |||
278 | if ((templ_caps = gst_pad_get_pad_template_caps (GST_PAD (vdp_pad)))) { | ||
279 | vdp_pad->caps = gst_caps_intersect (caps, templ_caps); | ||
280 | gst_caps_unref (caps); | ||
281 | } else | ||
282 | vdp_pad->caps = caps; | ||
351 | } | 283 | } |
352 | 284 | ||
353 | static void | 285 | static void |
@@ -357,9 +289,10 @@ gst_vdp_video_src_pad_get_property (GObject * object, guint prop_id, | |||
357 | GstVdpVideoSrcPad *vdp_pad = (GstVdpVideoSrcPad *) object; | 289 | GstVdpVideoSrcPad *vdp_pad = (GstVdpVideoSrcPad *) object; |
358 | 290 | ||
359 | switch (prop_id) { | 291 | switch (prop_id) { |
360 | case PROP_DISPLAY: | 292 | case PROP_DEVICE: |
361 | g_value_set_string (value, vdp_pad->display); | 293 | g_value_set_object (value, vdp_pad->device); |
362 | break; | 294 | break; |
295 | |||
363 | default: | 296 | default: |
364 | G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); | 297 | G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); |
365 | break; | 298 | break; |
@@ -373,9 +306,13 @@ gst_vdp_video_src_pad_set_property (GObject * object, guint prop_id, | |||
373 | GstVdpVideoSrcPad *vdp_pad = (GstVdpVideoSrcPad *) object; | 306 | GstVdpVideoSrcPad *vdp_pad = (GstVdpVideoSrcPad *) object; |
374 | 307 | ||
375 | switch (prop_id) { | 308 | switch (prop_id) { |
376 | case PROP_DISPLAY: | 309 | case PROP_DEVICE: |
377 | vdp_pad->display = g_value_dup_string (value); | 310 | if (vdp_pad->device) |
311 | g_object_unref (vdp_pad->device); | ||
312 | vdp_pad->device = g_value_dup_object (value); | ||
313 | gst_vdp_video_src_pad_update_caps (vdp_pad); | ||
378 | break; | 314 | break; |
315 | |||
379 | default: | 316 | default: |
380 | G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); | 317 | G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); |
381 | break; | 318 | break; |
@@ -383,16 +320,6 @@ gst_vdp_video_src_pad_set_property (GObject * object, guint prop_id, | |||
383 | } | 320 | } |
384 | 321 | ||
385 | static void | 322 | static void |
386 | gst_vdp_video_src_pad_finalize (GObject * object) | ||
387 | { | ||
388 | GstVdpVideoSrcPad *vdp_pad = (GstVdpVideoSrcPad *) object; | ||
389 | |||
390 | g_free (vdp_pad->display); | ||
391 | |||
392 | G_OBJECT_CLASS (gst_vdp_video_src_pad_parent_class)->finalize (object); | ||
393 | } | ||
394 | |||
395 | static void | ||
396 | gst_vdp_video_src_pad_init (GstVdpVideoSrcPad * vdp_pad) | 323 | gst_vdp_video_src_pad_init (GstVdpVideoSrcPad * vdp_pad) |
397 | { | 324 | { |
398 | GstPad *pad = GST_PAD (vdp_pad); | 325 | GstPad *pad = GST_PAD (vdp_pad); |
@@ -400,8 +327,6 @@ gst_vdp_video_src_pad_init (GstVdpVideoSrcPad * vdp_pad) | |||
400 | vdp_pad->device = NULL; | 327 | vdp_pad->device = NULL; |
401 | vdp_pad->caps = NULL; | 328 | vdp_pad->caps = NULL; |
402 | 329 | ||
403 | vdp_pad->display = NULL; | ||
404 | |||
405 | gst_pad_set_getcaps_function (pad, | 330 | gst_pad_set_getcaps_function (pad, |
406 | GST_DEBUG_FUNCPTR (gst_vdp_video_src_pad_getcaps)); | 331 | GST_DEBUG_FUNCPTR (gst_vdp_video_src_pad_getcaps)); |
407 | gst_pad_set_setcaps_function (pad, | 332 | gst_pad_set_setcaps_function (pad, |
@@ -417,9 +342,17 @@ gst_vdp_video_src_pad_class_init (GstVdpVideoSrcPadClass * klass) | |||
417 | 342 | ||
418 | object_class->get_property = gst_vdp_video_src_pad_get_property; | 343 | object_class->get_property = gst_vdp_video_src_pad_get_property; |
419 | object_class->set_property = gst_vdp_video_src_pad_set_property; | 344 | object_class->set_property = gst_vdp_video_src_pad_set_property; |
420 | object_class->finalize = gst_vdp_video_src_pad_finalize; | ||
421 | 345 | ||
422 | g_object_class_install_property (object_class, PROP_DISPLAY, | 346 | /** |
423 | g_param_spec_string ("display", "Display", "X Display name", | 347 | * GstVdpVideoSrcPad:device: |
424 | NULL, G_PARAM_READWRITE | G_PARAM_CONSTRUCT)); | 348 | * |
349 | * The #GstVdpDevice this pool is bound to. | ||
350 | */ | ||
351 | g_object_class_install_property | ||
352 | (object_class, | ||
353 | PROP_DEVICE, | ||
354 | g_param_spec_object ("device", | ||
355 | "Device", | ||
356 | "The GstVdpDevice the pad should use", | ||
357 | GST_TYPE_VDP_DEVICE, G_PARAM_READWRITE)); | ||
425 | } | 358 | } |
diff --git a/sys/vdpau/gstvdp/gstvdpvideosrcpad.h b/sys/vdpau/gstvdp/gstvdpvideosrcpad.h index 135f18c22..e8ba3312b 100644 --- a/sys/vdpau/gstvdp/gstvdpvideosrcpad.h +++ b/sys/vdpau/gstvdp/gstvdpvideosrcpad.h | |||
@@ -41,8 +41,6 @@ typedef struct _GstVdpVideoSrcPadClass GstVdpVideoSrcPadClass; | |||
41 | GstFlowReturn gst_vdp_video_src_pad_push (GstVdpVideoSrcPad *vdp_pad, GstVdpVideoBuffer *video_buf); | 41 | GstFlowReturn gst_vdp_video_src_pad_push (GstVdpVideoSrcPad *vdp_pad, GstVdpVideoBuffer *video_buf); |
42 | GstFlowReturn gst_vdp_video_src_pad_alloc_buffer (GstVdpVideoSrcPad *vdp_pad, GstVdpVideoBuffer **video_buf, GError ** error); | 42 | GstFlowReturn gst_vdp_video_src_pad_alloc_buffer (GstVdpVideoSrcPad *vdp_pad, GstVdpVideoBuffer **video_buf, GError ** error); |
43 | 43 | ||
44 | GstFlowReturn gst_vdp_video_src_pad_get_device (GstVdpVideoSrcPad * vdp_pad, GstVdpDevice ** device, GError ** error); | ||
45 | |||
46 | GstCaps *gst_vdp_video_src_pad_get_template_caps (); | 44 | GstCaps *gst_vdp_video_src_pad_get_template_caps (); |
47 | 45 | ||
48 | GstVdpVideoSrcPad * gst_vdp_video_src_pad_new (GstPadTemplate * templ, const gchar * name); | 46 | GstVdpVideoSrcPad * gst_vdp_video_src_pad_new (GstPadTemplate * templ, const gchar * name); |
diff --git a/sys/vdpau/h264/gstvdph264dec.c b/sys/vdpau/h264/gstvdph264dec.c index d95a25bdd..a3310a354 100644 --- a/sys/vdpau/h264/gstvdph264dec.c +++ b/sys/vdpau/h264/gstvdph264dec.c | |||
@@ -821,7 +821,8 @@ gst_vdp_h264_dec_start (GstBaseVideoDecoder * base_video_decoder) | |||
821 | gst_h264_dpb_set_output_func (h264_dec->dpb, gst_vdp_h264_dec_output, | 821 | gst_h264_dpb_set_output_func (h264_dec->dpb, gst_vdp_h264_dec_output, |
822 | h264_dec); | 822 | h264_dec); |
823 | 823 | ||
824 | return TRUE; | 824 | return GST_BASE_VIDEO_DECODER_CLASS |
825 | (parent_class)->start (base_video_decoder); | ||
825 | } | 826 | } |
826 | 827 | ||
827 | static gboolean | 828 | static gboolean |
@@ -832,7 +833,7 @@ gst_vdp_h264_dec_stop (GstBaseVideoDecoder * base_video_decoder) | |||
832 | g_object_unref (h264_dec->parser); | 833 | g_object_unref (h264_dec->parser); |
833 | g_object_unref (h264_dec->dpb); | 834 | g_object_unref (h264_dec->dpb); |
834 | 835 | ||
835 | return TRUE; | 836 | return GST_BASE_VIDEO_DECODER_CLASS (parent_class)->stop (base_video_decoder); |
836 | } | 837 | } |
837 | 838 | ||
838 | static void | 839 | static void |
diff --git a/sys/vdpau/mpeg/gstvdpmpegdec.c b/sys/vdpau/mpeg/gstvdpmpegdec.c index 72bda52cf..16fb4dc2e 100644 --- a/sys/vdpau/mpeg/gstvdpmpegdec.c +++ b/sys/vdpau/mpeg/gstvdpmpegdec.c | |||
@@ -589,7 +589,8 @@ gst_vdp_mpeg_dec_start (GstBaseVideoDecoder * base_video_decoder) | |||
589 | 589 | ||
590 | memset (&mpeg_dec->stream_info, 0, sizeof (GstVdpMpegStreamInfo)); | 590 | memset (&mpeg_dec->stream_info, 0, sizeof (GstVdpMpegStreamInfo)); |
591 | 591 | ||
592 | return TRUE; | 592 | return GST_BASE_VIDEO_DECODER_CLASS |
593 | (parent_class)->start (base_video_decoder); | ||
593 | } | 594 | } |
594 | 595 | ||
595 | static gboolean | 596 | static gboolean |
@@ -604,7 +605,7 @@ gst_vdp_mpeg_dec_stop (GstBaseVideoDecoder * base_video_decoder) | |||
604 | 605 | ||
605 | mpeg_dec->state = GST_VDP_MPEG_DEC_STATE_NEED_SEQUENCE; | 606 | mpeg_dec->state = GST_VDP_MPEG_DEC_STATE_NEED_SEQUENCE; |
606 | 607 | ||
607 | return TRUE; | 608 | return GST_BASE_VIDEO_DECODER_CLASS (parent_class)->stop (base_video_decoder); |
608 | } | 609 | } |
609 | 610 | ||
610 | static void | 611 | static void |