<div dir="ltr">Hi,<div>Is there a way for an element to get the caps of a pad?</div><div><br></div><div>More specific, I need to know the "media-type" of the video-track in a matroskademux.</div><div><br></div><div>What I have done so far is to let the user of the matroskademux extract the caps and from the caps get the media-type, e.g. image/jpeg or video/x-h264 (see code-snippet below).</div><div>I have added a media-type property in the matroskademux that is set by the user of the matroskademuxer. </div><div><br></div><div>All this is done in the context of the pad-added signal callback function. Then I can use the media-type property, in the matroskademux, to make certain decisions. </div><div><br></div><div>All this feels a bit cumbersome. What I would like to do is to make the matroskademuxer get the media-type from its caps, but I can not seem to figure out how to do that.</div><div><br></div><div>Cheers</div><div><br></div><div>/Mats<br clear="all"><div><br></div><div><br></div><div><div> /* Get the media type, e.g. image/jpeg or video/x-h264, from the demuxer</div><div> * caps. Use the media type to set the demuxer video-encoding-format</div><div> * property.</div><div> */</div><div> GstStructure *demux_caps_struct = gst_caps_get_structure (demux_caps, 0);</div><div> if (demux_caps_struct != NULL) {</div><div> const gchar *media_type = gst_structure_get_name (demux_caps_struct);</div><div> if (media_type != NULL) {</div><div> /* Dig out the matroskademux from the recordingdemuxbin. */</div><div> GstElement *demux = gst_bin_get_by_name (GST_BIN (self), "matroskademux");</div><div> if (demux != NULL) {</div><div> g_object_set (G_OBJECT (demux), "video-encoding-format",</div><div> media_type, NULL);</div><div><br></div><div> /* Clean up */</div><div> gst_object_unref (demux);</div><div> g_free (media_type);</div><div> } else {</div><div> GST_DEBUG ("could not set matroskademux video-encoding-fromat property");</div><div> /* Clean up */</div><div> g_free (media_type);</div><div> }</div><div> }</div><div> }</div></div><div><br></div><div><br></div>-- <br><div class="gmail_signature"><div dir="ltr">Mvh<div><br></div><div>/Mats</div></div></div>
</div></div>