rtsp-media: use element metadata to find payloader

Use the element metadata to find the payloader instead of checking
for the base class.

Fixes https://bugzilla.gnome.org/show_bug.cgi?id=712396
This commit is contained in:
Wim Taymans 2013-11-22 11:16:20 +01:00
parent e5332535a7
commit 7b5763179a

View file

@ -67,8 +67,6 @@
#include <gst/app/gstappsrc.h> #include <gst/app/gstappsrc.h>
#include <gst/app/gstappsink.h> #include <gst/app/gstappsink.h>
#include <gst/rtp/gstrtpbasepayload.h>
#include "rtsp-media.h" #include "rtsp-media.h"
#define GST_RTSP_MEDIA_GET_PRIVATE(obj) \ #define GST_RTSP_MEDIA_GET_PRIVATE(obj) \
@ -1536,13 +1534,19 @@ find_payload_element (GstElement * payloader)
{ {
GValue item = { 0 }; GValue item = { 0 };
GstIterator *iter; GstIterator *iter;
GstElement *element;
GstElement *pay = NULL; GstElement *pay = NULL;
iter = gst_bin_iterate_recurse (GST_BIN (payloader)); iter = gst_bin_iterate_recurse (GST_BIN (payloader));
while (gst_iterator_next (iter, &item) == GST_ITERATOR_OK) { while (gst_iterator_next (iter, &item) == GST_ITERATOR_OK) {
element = (GstElement *) g_value_get_object (&item); GstElement *element = (GstElement *) g_value_get_object (&item);
if (GST_IS_RTP_BASE_PAYLOAD (element)) { GstElementClass *eclass = GST_ELEMENT_GET_CLASS (element);
const gchar *klass;
klass = gst_element_class_get_metadata (eclass, GST_ELEMENT_METADATA_KLASS);
if (klass == NULL)
continue;
if (strstr (klass, "Payloader") && strstr (klass, "RTP")) {
pay = gst_object_ref (element); pay = gst_object_ref (element);
g_value_unset (&item); g_value_unset (&item);
break; break;