/* Generic code for now, requires changes in future when we * add hardware query for supported formats, Framerate control etc */ static GstCaps * gst_msdkvpp_transform_caps (GstBaseTransform * trans, GstPadDirection direction, GstCaps * caps, GstCaps * filter) { GstCaps *out_caps; GST_DEBUG_OBJECT (trans, "Transforming caps %" GST_PTR_FORMAT " in direction %s", caps, (direction == GST_PAD_SINK) ? "sink" : "src"); if (direction == GST_PAD_SRC) out_caps = gst_static_pad_template_get_caps (&gst_msdkvpp_sink_factory); else out_caps = gst_static_pad_template_get_caps (&gst_msdkvpp_src_factory); if (out_caps && filter) { GstCaps *intersection; intersection = gst_caps_intersect_full (out_caps, filter, GST_CAPS_INTERSECT_FIRST); gst_caps_unref (out_caps); out_caps = intersection; } GST_DEBUG_OBJECT (trans, "returning caps: %" GST_PTR_FORMAT, out_caps); return out_caps; }
static GstCaps * gst_gl_filter_transform_caps (GstBaseTransform * bt, GstPadDirection direction, GstCaps * caps, GstCaps * filter) { GstCaps *newcaps, *result; if (direction == GST_PAD_SINK) newcaps = gst_static_pad_template_get_caps (&gst_gl_filter_src_pad_template); else if (direction == GST_PAD_SRC) newcaps = gst_static_pad_template_get_caps (&gst_gl_filter_sink_pad_template); else newcaps = gst_caps_new_any (); if (filter) { result = gst_caps_intersect_full (filter, newcaps, GST_CAPS_INTERSECT_FIRST); gst_caps_unref (newcaps); newcaps = result; } GST_DEBUG_OBJECT (bt, "returning caps: %" GST_PTR_FORMAT, newcaps); return newcaps; }
static GstCaps * gst_alpha_color_transform_caps (GstBaseTransform * btrans, GstPadDirection direction, GstCaps * caps, GstCaps * filter) { GstCaps *tmpl_caps = NULL; GstCaps *result = NULL, *local_caps = NULL; guint i; local_caps = gst_caps_new_empty (); for (i = 0; i < gst_caps_get_size (caps); i++) { GstStructure *structure = gst_structure_copy (gst_caps_get_structure (caps, i)); /* Remove any specific parameter from the structure */ gst_structure_remove_field (structure, "format"); gst_structure_remove_field (structure, "colorimetry"); gst_structure_remove_field (structure, "chroma-site"); gst_structure_set_name (structure, "video/x-raw"); gst_caps_append_structure (local_caps, structure); } /* Get the appropriate template */ if (direction == GST_PAD_SINK) { tmpl_caps = gst_static_pad_template_get_caps (&src_template); } else if (direction == GST_PAD_SRC) { tmpl_caps = gst_static_pad_template_get_caps (&sink_template); } /* Intersect with our template caps */ result = gst_caps_intersect (local_caps, tmpl_caps); gst_caps_unref (tmpl_caps); gst_caps_unref (local_caps); result = gst_caps_simplify (result); GST_LOG_OBJECT (btrans, "transformed %" GST_PTR_FORMAT " to %" GST_PTR_FORMAT, caps, result); if (filter) { GstCaps *intersection; GST_DEBUG_OBJECT (btrans, "Using filter caps %" GST_PTR_FORMAT, filter); intersection = gst_caps_intersect_full (filter, result, GST_CAPS_INTERSECT_FIRST); gst_caps_unref (result); result = intersection; GST_DEBUG_OBJECT (btrans, "Intersection %" GST_PTR_FORMAT, result); } return result; }
static gboolean gst_srt_enc_event (GstPad * pad, GstObject * parent, GstEvent * event) { GstSrtEnc *srtenc = GST_SRT_ENC (parent); gboolean ret; switch (GST_EVENT_TYPE (event)) { case GST_EVENT_CAPS: { GstCaps *caps; caps = gst_static_pad_template_get_caps (&src_template); gst_pad_set_caps (srtenc->srcpad, caps); gst_caps_unref (caps); gst_event_unref (event); ret = TRUE; break; } default: ret = gst_pad_event_default (pad, parent, event); break; } return ret; }
static gboolean gst_dvd_sub_parse_event (GstPad * pad, GstObject * parent, GstEvent * event) { GstDvdSubParse *parse; gboolean ret; parse = GST_DVD_SUB_PARSE (parent); switch (GST_EVENT_TYPE (event)) { case GST_EVENT_CAPS: { GstCaps *caps; gst_event_unref (event); caps = gst_static_pad_template_get_caps (&src_template); gst_pad_push_event (parse->srcpad, gst_event_new_caps (caps)); gst_caps_unref (caps); ret = TRUE; break; } case GST_EVENT_FLUSH_STOP: gst_dvd_sub_parse_reset (parse); /* fall-through */ default: ret = gst_pad_event_default (pad, parent, event); break; } return ret; }
static GstCaps * gst_aspect_ratio_crop_get_caps (GstPad * pad) { GstPad *peer; GstAspectRatioCrop *aspect_ratio_crop; GstCaps *return_caps; aspect_ratio_crop = GST_ASPECT_RATIO_CROP (gst_pad_get_parent (pad)); g_mutex_lock (aspect_ratio_crop->crop_lock); peer = gst_pad_get_peer (aspect_ratio_crop->sink); if (peer == NULL) { return_caps = gst_static_pad_template_get_caps (&src_template); gst_caps_ref (return_caps); } else { GstCaps *peer_caps; peer_caps = gst_pad_get_caps (peer); return_caps = gst_aspect_ratio_crop_transform_caps (aspect_ratio_crop, peer_caps); gst_caps_unref (peer_caps); gst_object_unref (peer); } g_mutex_unlock (aspect_ratio_crop->crop_lock); gst_object_unref (aspect_ratio_crop); return return_caps; }
/* Get the intersection of parser caps and available (sorted) decoders */ static GstCaps * get_parser_caps_filter (GstDecodebin3 * dbin, GstCaps * caps) { GList *tmp; GstCaps *filter_caps = gst_caps_new_empty (); g_mutex_lock (&dbin->factories_lock); gst_decode_bin_update_factories_list (dbin); for (tmp = dbin->decoder_factories; tmp; tmp = tmp->next) { GstElementFactory *factory = (GstElementFactory *) tmp->data; GstCaps *tcaps, *intersection; const GList *tmps; GST_LOG ("Trying factory %s", gst_plugin_feature_get_name (GST_PLUGIN_FEATURE (factory))); for (tmps = gst_element_factory_get_static_pad_templates (factory); tmps; tmps = tmps->next) { GstStaticPadTemplate *st = (GstStaticPadTemplate *) tmps->data; if (st->direction != GST_PAD_SINK || st->presence != GST_PAD_ALWAYS) continue; tcaps = gst_static_pad_template_get_caps (st); intersection = gst_caps_intersect_full (tcaps, caps, GST_CAPS_INTERSECT_FIRST); filter_caps = gst_caps_merge (filter_caps, intersection); gst_caps_unref (tcaps); } } g_mutex_unlock (&dbin->factories_lock); GST_DEBUG_OBJECT (dbin, "Got filter caps %" GST_PTR_FORMAT, filter_caps); return filter_caps; }
static GstCaps * smart_encoder_sink_getcaps (GstPad * pad, GstCaps * filter) { GstCaps *peer, *tmpl, *res; GstSmartEncoder *smart_encoder = GST_SMART_ENCODER (gst_pad_get_parent (pad)); /* Use computed caps */ if (smart_encoder->available_caps) tmpl = gst_caps_ref (smart_encoder->available_caps); else tmpl = gst_static_pad_template_get_caps (&src_template); /* Try getting it from downstream */ peer = gst_pad_peer_query_caps (smart_encoder->srcpad, tmpl); if (peer == NULL) { res = tmpl; } else { res = peer; gst_caps_unref (tmpl); } gst_object_unref (smart_encoder); return res; }
static gboolean check_parser_caps_filter (GstDecodebin3 * dbin, GstCaps * caps) { GList *tmp; gboolean res = FALSE; g_mutex_lock (&dbin->factories_lock); gst_decode_bin_update_factories_list (dbin); for (tmp = dbin->decoder_factories; tmp; tmp = tmp->next) { GstElementFactory *factory = (GstElementFactory *) tmp->data; GstCaps *tcaps; const GList *tmps; GST_LOG ("Trying factory %s", gst_plugin_feature_get_name (GST_PLUGIN_FEATURE (factory))); for (tmps = gst_element_factory_get_static_pad_templates (factory); tmps; tmps = tmps->next) { GstStaticPadTemplate *st = (GstStaticPadTemplate *) tmps->data; if (st->direction != GST_PAD_SINK || st->presence != GST_PAD_ALWAYS) continue; tcaps = gst_static_pad_template_get_caps (st); if (gst_caps_can_intersect (tcaps, caps)) { res = TRUE; gst_caps_unref (tcaps); goto beach; } gst_caps_unref (tcaps); } } beach: g_mutex_unlock (&dbin->factories_lock); GST_DEBUG_OBJECT (dbin, "Can intersect : %d", res); return res; }
static GstCaps * gst_vdp_sink_get_allowed_caps (GstVdpDevice * device, GValue * par) { GstCaps *templ_caps, *allowed_caps, *caps; gint i; allowed_caps = gst_vdp_output_buffer_get_allowed_caps (device); templ_caps = gst_static_pad_template_get_caps (&sink_template); caps = gst_caps_intersect (allowed_caps, templ_caps); gst_caps_unref (allowed_caps); gst_caps_unref (templ_caps); if (!par) par = gst_vdp_sink_calculate_par (device->display); for (i = 0; i < gst_caps_get_size (caps); i++) { GstStructure *structure; structure = gst_caps_get_structure (caps, i); gst_structure_set_value (structure, "pixel-aspect-ratio", par); } return caps; }
/* initialize the new element * instantiate pads and add them to element * set functions * initialize structure */ static void gst_kate_dec_init (GstKateDec * dec) { GST_DEBUG_OBJECT (dec, "gst_kate_dec_init"); dec->sinkpad = gst_pad_new_from_static_template (&sink_factory, "sink"); gst_pad_set_chain_function (dec->sinkpad, GST_DEBUG_FUNCPTR (gst_kate_dec_chain)); gst_pad_set_query_function (dec->sinkpad, GST_DEBUG_FUNCPTR (gst_kate_dec_sink_query)); gst_pad_set_event_function (dec->sinkpad, GST_DEBUG_FUNCPTR (gst_kate_dec_sink_event)); gst_pad_use_fixed_caps (dec->sinkpad); gst_pad_set_caps (dec->sinkpad, gst_static_pad_template_get_caps (&sink_factory)); gst_element_add_pad (GST_ELEMENT (dec), dec->sinkpad); dec->srcpad = gst_pad_new_from_static_template (&src_factory, "src"); gst_pad_set_getcaps_function (dec->srcpad, GST_DEBUG_FUNCPTR (gst_kate_dec_src_get_caps)); gst_element_add_pad (GST_ELEMENT (dec), dec->srcpad); gst_kate_util_decode_base_init (&dec->decoder, TRUE); dec->src_caps = NULL; dec->remove_markup = FALSE; }
static void gst_a2dp_sink_init(GstA2dpSink *self, GstA2dpSinkClass *klass) { self->sink = NULL; self->fakesink = NULL; self->rtp = NULL; self->device = NULL; self->autoconnect = DEFAULT_AUTOCONNECT; self->capsfilter = NULL; self->newseg_event = NULL; self->taglist = NULL; self->ghostpad = NULL; self->sink_is_in_bin = FALSE; self->cb_mutex = g_mutex_new(); /* we initialize our capsfilter */ gst_a2dp_sink_init_caps_filter(self); g_object_set(self->capsfilter, "caps", gst_static_pad_template_get_caps(&gst_a2dp_sink_factory), NULL); gst_a2dp_sink_init_fakesink(self); gst_a2dp_sink_init_ghost_pad(self); }
static GstCaps * gst_mill_color_transform_caps (GstBaseTransform * btrans, GstPadDirection direction, GstCaps * caps) { const GstCaps *tmpl_caps = NULL; GstCaps *result = NULL, *local_caps = NULL; guint i; local_caps = gst_caps_copy (caps); for (i = 0; i < gst_caps_get_size (local_caps); i++) { GstStructure *structure = gst_caps_get_structure (local_caps, i); /* Throw away the structure name and set it to transformed format */ if (direction == GST_PAD_SINK) { gst_structure_set_name (structure, "video/x-raw-yuv"); } else if (direction == GST_PAD_SRC) { gst_structure_set_name (structure, "video/x-raw-rgb"); } /* Remove any specific parameter from the structure */ gst_structure_remove_field (structure, "format"); gst_structure_remove_field (structure, "endianness"); gst_structure_remove_field (structure, "depth"); gst_structure_remove_field (structure, "bpp"); gst_structure_remove_field (structure, "red_mask"); gst_structure_remove_field (structure, "green_mask"); gst_structure_remove_field (structure, "blue_mask"); gst_structure_remove_field (structure, "alpha_mask"); } /* Get the appropriate template */ if (direction == GST_PAD_SINK) { tmpl_caps = gst_static_pad_template_get_caps (&src_template); } else if (direction == GST_PAD_SRC) { tmpl_caps = gst_static_pad_template_get_caps (&sink_template); } /* Intersect with our template caps */ result = gst_caps_intersect (local_caps, tmpl_caps); gst_caps_unref (local_caps); gst_caps_do_simplify (result); GST_LOG ("transformed %" GST_PTR_FORMAT " to %" GST_PTR_FORMAT, caps, result); return result; }
static gboolean gst_msdkh264enc_set_format (GstMsdkEnc * encoder) { GstMsdkH264Enc *thiz = GST_MSDKH264ENC (encoder); GstCaps *template_caps; GstCaps *allowed_caps = NULL; thiz->profile = 0; thiz->level = 0; template_caps = gst_static_pad_template_get_caps (&src_factory); allowed_caps = gst_pad_get_allowed_caps (GST_VIDEO_ENCODER_SRC_PAD (encoder)); /* If downstream has ANY caps let encoder decide profile and level */ if (allowed_caps == template_caps) { GST_INFO_OBJECT (thiz, "downstream has ANY caps, profile/level set to auto"); } else if (allowed_caps) { GstStructure *s; const gchar *profile; const gchar *level; if (gst_caps_is_empty (allowed_caps)) { gst_caps_unref (allowed_caps); gst_caps_unref (template_caps); return FALSE; } allowed_caps = gst_caps_make_writable (allowed_caps); allowed_caps = gst_caps_fixate (allowed_caps); s = gst_caps_get_structure (allowed_caps, 0); profile = gst_structure_get_string (s, "profile"); if (profile) { if (!strcmp (profile, "high")) { thiz->profile = MFX_PROFILE_AVC_HIGH; } else if (!strcmp (profile, "main")) { thiz->profile = MFX_PROFILE_AVC_MAIN; } else if (!strcmp (profile, "baseline")) { thiz->profile = MFX_PROFILE_AVC_BASELINE; } else if (!strcmp (profile, "constrained-baseline")) { thiz->profile = MFX_PROFILE_AVC_CONSTRAINED_BASELINE; } else { g_assert_not_reached (); } } level = gst_structure_get_string (s, "level"); if (level) { thiz->level = gst_codec_utils_h264_get_level_idc (level); } gst_caps_unref (allowed_caps); } gst_caps_unref (template_caps); return TRUE; }
static GstCaps * gst_aml_asink_getcaps (GstBaseSink * bsink) { GstAmlAsink *amlasink = GST_AMLASINK (bsink); GstCaps *caps; GST_DEBUG_OBJECT(amlasink, "%s", __FUNCTION__); caps = gst_static_pad_template_get_caps (&sink_factory); // aml_dump_caps(caps); return gst_caps_copy(caps); }
static void gst_id3demux_add_container_format (GstTagList * tags) { GstCaps *sink_caps; sink_caps = gst_static_pad_template_get_caps (&sink_factory); gst_pb_utils_add_codec_description_to_tag_list (tags, GST_TAG_CONTAINER_FORMAT, sink_caps); gst_caps_unref (sink_caps); }
/* initialize the new element * instantiate pads and add them to element * set functions * initialize structure */ static void gst_kate_tiger_init (GstKateTiger * tiger, GstKateTigerClass * gclass) { GST_DEBUG_OBJECT (tiger, "gst_kate_tiger_init"); tiger->mutex = g_mutex_new (); tiger->katesinkpad = gst_pad_new_from_static_template (&kate_sink_factory, "subtitle_sink"); gst_pad_set_chain_function (tiger->katesinkpad, GST_DEBUG_FUNCPTR (gst_kate_tiger_kate_chain)); gst_pad_set_query_function (tiger->katesinkpad, GST_DEBUG_FUNCPTR (gst_kate_tiger_kate_sink_query)); gst_pad_set_event_function (tiger->katesinkpad, GST_DEBUG_FUNCPTR (gst_kate_tiger_kate_event)); gst_element_add_pad (GST_ELEMENT (tiger), tiger->katesinkpad); tiger->videosinkpad = gst_pad_new_from_static_template (&video_sink_factory, "video_sink"); gst_pad_set_chain_function (tiger->videosinkpad, GST_DEBUG_FUNCPTR (gst_kate_tiger_video_chain)); //gst_pad_set_query_function (tiger->videosinkpad, GST_DEBUG_FUNCPTR (gst_kate_tiger_video_sink_query)); gst_pad_use_fixed_caps (tiger->videosinkpad); gst_pad_set_caps (tiger->videosinkpad, gst_static_pad_template_get_caps (&video_sink_factory)); gst_pad_set_setcaps_function (tiger->videosinkpad, GST_DEBUG_FUNCPTR (gst_kate_tiger_video_set_caps)); gst_element_add_pad (GST_ELEMENT (tiger), tiger->videosinkpad); tiger->srcpad = gst_pad_new_from_static_template (&src_factory, "src"); gst_pad_set_event_function (tiger->srcpad, gst_kate_tiger_source_event); gst_element_add_pad (GST_ELEMENT (tiger), tiger->srcpad); gst_kate_util_decode_base_init (&tiger->decoder); tiger->tr = NULL; tiger->default_font_desc = NULL; tiger->quality = -1.0; tiger->default_font_effect = tiger_font_plain; tiger->default_font_effect_strength = 0.5; tiger->default_font_r = 255; tiger->default_font_g = 255; tiger->default_font_b = 255; tiger->default_font_a = 255; tiger->default_background_r = 0; tiger->default_background_g = 0; tiger->default_background_b = 0; tiger->default_background_a = 0; tiger->video_width = 0; tiger->video_height = 0; }
static gboolean gst_msdkvp8enc_set_format (GstMsdkEnc * encoder) { GstMsdkVP8Enc *thiz = GST_MSDKVP8ENC (encoder); GstCaps *template_caps; GstCaps *allowed_caps = NULL; thiz->profile = 0; template_caps = gst_static_pad_template_get_caps (&src_factory); allowed_caps = gst_pad_get_allowed_caps (GST_VIDEO_ENCODER_SRC_PAD (encoder)); /* If downstream has ANY caps let encoder decide profile and level */ if (allowed_caps == template_caps) { GST_INFO_OBJECT (thiz, "downstream has ANY caps, profile/level set to auto"); } else if (allowed_caps) { GstStructure *s; const gchar *profile; if (gst_caps_is_empty (allowed_caps)) { gst_caps_unref (allowed_caps); gst_caps_unref (template_caps); return FALSE; } allowed_caps = gst_caps_make_writable (allowed_caps); allowed_caps = gst_caps_fixate (allowed_caps); s = gst_caps_get_structure (allowed_caps, 0); profile = gst_structure_get_string (s, "profile"); if (profile) { if (!strcmp (profile, "3")) { thiz->profile = MFX_PROFILE_VP8_3; } else if (!strcmp (profile, "2")) { thiz->profile = MFX_PROFILE_VP8_2; } else if (!strcmp (profile, "1")) { thiz->profile = MFX_PROFILE_VP8_1; } else if (!strcmp (profile, "0")) { thiz->profile = MFX_PROFILE_VP8_0; } else { g_assert_not_reached (); } } gst_caps_unref (allowed_caps); } gst_caps_unref (template_caps); return TRUE; }
static GstCaps * gst_vaapidecode_get_caps(GstPad *pad) { GstVaapiDecode * const decode = GST_VAAPIDECODE(GST_OBJECT_PARENT(pad)); if (!decode->is_ready) return gst_static_pad_template_get_caps(&gst_vaapidecode_sink_factory); if (!gst_vaapidecode_ensure_allowed_caps(decode)) return gst_caps_new_empty(); return gst_caps_ref(decode->allowed_caps); }
static gboolean ensure_allowed_sinkpad_caps (GstMfxPostproc * vpp) { if (vpp->allowed_sinkpad_caps) return TRUE; vpp->allowed_sinkpad_caps = gst_static_pad_template_get_caps (&gst_mfxpostproc_sink_factory); if (!vpp->allowed_sinkpad_caps) { GST_ERROR_OBJECT (vpp, "failed to create MFX sink caps"); return FALSE; } return TRUE; }
static GstCaps *gst_a2dp_sink_get_caps(GstPad *pad) { GstCaps *caps; GstCaps *caps_aux; GstA2dpSink *self = GST_A2DP_SINK(GST_PAD_PARENT(pad)); if (self->sink == NULL) { GST_DEBUG_OBJECT(self, "a2dpsink isn't initialized " "returning template caps"); caps = gst_static_pad_template_get_caps( &gst_a2dp_sink_factory); } else { GST_LOG_OBJECT(self, "Getting device caps"); caps = gst_a2dp_sink_get_device_caps(self); if (caps == NULL) caps = gst_static_pad_template_get_caps( &gst_a2dp_sink_factory); } caps_aux = gst_caps_copy(caps); g_object_set(self->capsfilter, "caps", caps_aux, NULL); gst_caps_unref(caps_aux); return caps; }
static GstStateChangeReturn gst_smart_encoder_find_elements (GstSmartEncoder * smart_encoder) { guint i, n; GstCaps *tmpl, *st, *res; GstElementFactory *dec, *enc; GstStateChangeReturn ret = GST_STATE_CHANGE_SUCCESS; if (G_UNLIKELY (smart_encoder->available_caps)) goto beach; /* Iterate over all pad template caps and see if we have both an * encoder and a decoder for those media types */ tmpl = gst_static_pad_template_get_caps (&src_template); res = gst_caps_new_empty (); n = gst_caps_get_size (tmpl); for (i = 0; i < n; i++) { st = gst_caps_copy_nth (tmpl, i); GST_DEBUG_OBJECT (smart_encoder, "Checking for available decoder and encoder for %" GST_PTR_FORMAT, st); if (!(dec = get_decoder_factory (st))) { gst_caps_unref (st); continue; } gst_object_unref (dec); if (!(enc = get_encoder_factory (st))) { gst_caps_unref (st); continue; } gst_object_unref (enc); GST_DEBUG_OBJECT (smart_encoder, "OK"); gst_caps_append (res, st); } gst_caps_unref (tmpl); if (gst_caps_is_empty (res)) { gst_caps_unref (res); ret = GST_STATE_CHANGE_FAILURE; } else smart_encoder->available_caps = res; GST_DEBUG_OBJECT (smart_encoder, "Done, available_caps:%" GST_PTR_FORMAT, smart_encoder->available_caps); beach: return ret; }
static gboolean ensure_allowed_srcpad_caps (GstMfxPostproc * vpp) { if (vpp->allowed_srcpad_caps) return TRUE; /* Create initial caps from pad template */ vpp->allowed_srcpad_caps = gst_static_pad_template_get_caps (&gst_mfxpostproc_src_factory); if (!vpp->allowed_srcpad_caps) { GST_ERROR_OBJECT (vpp, "failed to create MFX src caps"); return FALSE; } return TRUE; }
static GstCaps * gst_vdp_sink_getcaps (GstBaseSink * bsink) { VdpSink *vdp_sink; GstCaps *caps; vdp_sink = GST_VDP_SINK (bsink); if (vdp_sink->caps) caps = gst_caps_copy (vdp_sink->caps); else caps = gst_static_pad_template_get_caps (&sink_template); return caps; }
static GstCaps * gst_a2dp_sink_get_caps (GstA2dpSink * self) { GstCaps *caps = NULL; if (self->sink != NULL) { GST_LOG_OBJECT (self, "Getting device caps"); caps = gst_a2dp_sink_get_device_caps (self); } if (!caps) caps = gst_static_pad_template_get_caps (&gst_a2dp_sink_factory); return caps; }
static gboolean gst_gsmenc_set_format (GstAudioEncoder * benc, GstAudioInfo * info) { GstCaps *srccaps; srccaps = gst_static_pad_template_get_caps (&gsmenc_src_template); gst_audio_encoder_set_output_format (GST_AUDIO_ENCODER (benc), srccaps); /* report needs to base class */ gst_audio_encoder_set_frame_samples_min (benc, 160); gst_audio_encoder_set_frame_samples_max (benc, 160); gst_audio_encoder_set_frame_max (benc, 1); return TRUE; }
static gboolean gst_siren_enc_sink_setcaps (GstPad * pad, GstCaps * caps) { GstSirenEnc *enc; gboolean res; GstCaps *outcaps; enc = GST_SIREN_ENC (GST_PAD_PARENT (pad)); outcaps = gst_static_pad_template_get_caps (&srctemplate); res = gst_pad_set_caps (enc->srcpad, outcaps); gst_caps_unref (outcaps); return res; }
static gboolean gst_gsmenc_setcaps (GstPad * pad, GstCaps * caps) { GstGSMEnc *gsmenc; GstCaps *srccaps; gsmenc = GST_GSMENC (gst_pad_get_parent (pad)); srccaps = gst_static_pad_template_get_caps (&gsmenc_src_template); gst_pad_set_caps (gsmenc->srcpad, srccaps); gst_object_unref (gsmenc); return TRUE; }
static GstCaps * gst_vdp_vpp_sink_getcaps (GstPad * pad) { GstVdpVideoPostProcess *vpp = GST_VDP_VIDEO_POST_PROCESS (gst_pad_get_parent (pad)); GstCaps *caps; if (vpp->device) caps = gst_vdp_video_buffer_get_allowed_video_caps (vpp->device); else caps = gst_static_pad_template_get_caps (&sink_template); gst_object_unref (vpp); return caps; }
/*** * !reimp */ QStringList Backend::availableMimeTypes() const { QStringList availableMimeTypes; if (!isValid()) return availableMimeTypes; GstElementFactory *mpegFactory; // Add mp3 as a separate mime type as people are likely to look for it. if ((mpegFactory = gst_element_factory_find ("ffmpeg")) || (mpegFactory = gst_element_factory_find ("mad"))) { availableMimeTypes << QLatin1String("audio/x-mp3"); gst_object_unref(GST_OBJECT(mpegFactory)); } // Iterate over all audio and video decoders and extract mime types from sink caps GList* factoryList = gst_registry_get_feature_list(gst_registry_get_default (), GST_TYPE_ELEMENT_FACTORY); for (GList* iter = g_list_first(factoryList) ; iter != NULL ; iter = g_list_next(iter)) { GstPluginFeature *feature = GST_PLUGIN_FEATURE(iter->data); QString klass = gst_element_factory_get_klass(GST_ELEMENT_FACTORY(feature)); if (klass == QLatin1String("Codec/Decoder/Audio") || klass == QLatin1String("Codec/Decoder/Video")) { const GList *static_templates; GstElementFactory *factory = GST_ELEMENT_FACTORY(feature); static_templates = gst_element_factory_get_static_pad_templates(factory); for (; static_templates != NULL ; static_templates = static_templates->next) { GstStaticPadTemplate *padTemplate = (GstStaticPadTemplate *) static_templates->data; if (padTemplate && padTemplate->direction == GST_PAD_SINK) { GstCaps *caps = gst_static_pad_template_get_caps (padTemplate); if (caps) { const GstStructure* capsStruct = gst_caps_get_structure (caps, 0); QString mime = QString::fromUtf8(gst_structure_get_name (capsStruct)); if (!availableMimeTypes.contains(mime)) availableMimeTypes.append(mime); } } } } } g_list_free(factoryList); availableMimeTypes.sort(); return availableMimeTypes; }