diff options
author | Alessandro Decina <alessandro.d@gmail.com> | 2016-02-09 14:07:54 +1100 |
---|---|---|
committer | Alessandro Decina <alessandro.d@gmail.com> | 2016-02-09 14:13:26 +1100 |
commit | 99f29ec56eb07c15ea682de67b1c2e23afa90922 (patch) | |
tree | cf176619ab50d696a7f8e699bf1e2e18a67a58b3 /sys | |
parent | 915124b3633bd56f5d787440cb557f677299a341 (diff) | |
download | gstreamer-plugins-bad-99f29ec56eb07c15ea682de67b1c2e23afa90922.tar.gz |
applemedia: vtdec: implement GstElement::set_context
Diffstat (limited to 'sys')
-rw-r--r-- | sys/applemedia/vtdec.c | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/sys/applemedia/vtdec.c b/sys/applemedia/vtdec.c index 14ff3475d..86df2ab56 100644 --- a/sys/applemedia/vtdec.c +++ b/sys/applemedia/vtdec.c @@ -88,6 +88,7 @@ static gboolean compute_h264_decode_picture_buffer_length (GstVtdec * vtdec, static gboolean gst_vtdec_compute_reorder_queue_length (GstVtdec * vtdec, CMVideoCodecType cm_format, GstBuffer * codec_data); static void gst_vtdec_set_latency (GstVtdec * vtdec); +static void gst_vtdec_set_context (GstElement * element, GstContext * context); static GstStaticPadTemplate gst_vtdec_sink_template = GST_STATIC_PAD_TEMPLATE ("sink", @@ -120,17 +121,18 @@ static void gst_vtdec_class_init (GstVtdecClass * klass) { GObjectClass *gobject_class = G_OBJECT_CLASS (klass); + GstElementClass *element_class = GST_ELEMENT_CLASS (klass); GstVideoDecoderClass *video_decoder_class = GST_VIDEO_DECODER_CLASS (klass); /* Setting up pads and setting metadata should be moved to base_class_init if you intend to subclass this class. */ - gst_element_class_add_pad_template (GST_ELEMENT_CLASS (klass), + gst_element_class_add_pad_template (element_class, gst_static_pad_template_get (&gst_vtdec_sink_template)); - gst_element_class_add_pad_template (GST_ELEMENT_CLASS (klass), + gst_element_class_add_pad_template (element_class, gst_pad_template_new ("src", GST_PAD_SRC, GST_PAD_ALWAYS, gst_caps_from_string (VIDEO_SRC_CAPS))); - gst_element_class_set_static_metadata (GST_ELEMENT_CLASS (klass), + gst_element_class_set_static_metadata (element_class, "Apple VideoToolbox decoder", "Codec/Decoder/Video", "Apple VideoToolbox Decoder", @@ -138,6 +140,7 @@ gst_vtdec_class_init (GstVtdecClass * klass) "Alessandro Decina <alessandro.d@gmail.com>"); gobject_class->finalize = gst_vtdec_finalize; + element_class->set_context = gst_vtdec_set_context; video_decoder_class->start = GST_DEBUG_FUNCPTR (gst_vtdec_start); video_decoder_class->stop = GST_DEBUG_FUNCPTR (gst_vtdec_stop); video_decoder_class->negotiate = GST_DEBUG_FUNCPTR (gst_vtdec_negotiate); @@ -975,6 +978,18 @@ gst_vtdec_set_latency (GstVtdec * vtdec) gst_video_decoder_set_latency (GST_VIDEO_DECODER (vtdec), latency, latency); } +static void +gst_vtdec_set_context (GstElement * element, GstContext * context) +{ + GstVtdec *vtdec = GST_VTDEC (element); + + GST_INFO_OBJECT (element, "setting context %s", + gst_context_get_context_type (context)); + gst_gl_handle_set_context (element, context, + &vtdec->ctxh->display, &vtdec->ctxh->other_context); + GST_ELEMENT_CLASS (gst_vtdec_parent_class)->set_context (element, context); +} + #ifndef HAVE_IOS #define GST_TYPE_VTDEC_HW (gst_vtdec_hw_get_type()) #define GST_VTDEC_HW(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_VTDEC_HW,GstVtdecHw)) |