static gboolean sink_setcaps(GstPad *pad, GstCaps *caps) { GstDspVpp *self; GstDspBase *base; GstCaps *out_caps; gboolean ret; self = GST_DSP_VPP(GST_PAD_PARENT(pad)); base = GST_DSP_BASE(self); { gchar *str = gst_caps_to_string(caps); pr_info(self, "sink caps: %s", str); g_free(str); } base->codec = &td_vpp_codec; du_port_alloc_buffers(base->ports[0], 4); du_port_alloc_buffers(base->ports[1], 4); out_caps = gst_caps_new_empty(); configure_caps(self, caps, out_caps); base->tmp_caps = out_caps; ret = gst_pad_set_caps(pad, caps); if (!ret) return FALSE; return TRUE; }
static gboolean sink_setcaps(GstPad *pad, GstCaps *caps) { GstDspADec *self; GstDspBase *base; GstStructure *in_struc; const char *name; GstCaps *out_caps; self = GST_DSP_ADEC(GST_PAD_PARENT(pad)); base = GST_DSP_BASE(self); { gchar *str = gst_caps_to_string(caps); pr_info(self, "sink caps: %s", str); g_free(str); } in_struc = gst_caps_get_structure(caps, 0); name = gst_structure_get_name(in_struc); if (strcmp(name, "audio/mpeg") == 0) { int version = 1; gst_structure_get_int(in_struc, "mpegversion", &version); if (version == 2 || version == 4) { base->alg = GSTDSP_AACDEC; base->codec = &td_aacdec_codec; } } du_port_alloc_buffers(base->ports[0], 4); du_port_alloc_buffers(base->ports[1], 4); out_caps = gst_caps_new_empty(); configure_caps(self, caps, out_caps); base->tmp_caps = out_caps; return TRUE; }