summaryrefslogtreecommitdiffstats
path: root/gst-libs/gst/play/play.c
diff options
context:
space:
mode:
Diffstat (limited to 'gst-libs/gst/play/play.c')
-rw-r--r--gst-libs/gst/play/play.c68
1 files changed, 35 insertions, 33 deletions
diff --git a/gst-libs/gst/play/play.c b/gst-libs/gst/play/play.c
index 8e0c9754..d79e06f3 100644
--- a/gst-libs/gst/play/play.c
+++ b/gst-libs/gst/play/play.c
@@ -20,6 +20,7 @@
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
+#include <string.h>
#include "gstplay.h"
@@ -919,40 +920,41 @@ gst_play_get_sink_element (GstPlay *play,
}
else {
/* If not a src pad checking caps */
- GstCaps *caps;
+ const GstCaps *caps;
+ GstStructure *structure;
+ gboolean has_video_cap = FALSE;
+ gboolean has_audio_cap = FALSE;
+
caps = gst_pad_get_caps (GST_PAD (pads->data));
- while (caps) {
- gboolean has_video_cap = FALSE, has_audio_cap = FALSE;
- if (g_ascii_strcasecmp (gst_caps_get_mime (caps),
- "audio/x-raw-int") == 0) {
- has_audio_cap = TRUE;
- }
-
- if ((g_ascii_strcasecmp (gst_caps_get_mime (caps),
- "video/x-raw-yuv") == 0) ||
- (g_ascii_strcasecmp (gst_caps_get_mime (caps),
- "video/x-raw-rgb") == 0)) {
- has_video_cap = TRUE;
- }
-
- switch (sink_type) {
- case GST_PLAY_SINK_TYPE_AUDIO:
- if (has_audio_cap)
- has_correct_type = TRUE;
- break;;
- case GST_PLAY_SINK_TYPE_VIDEO:
- if (has_video_cap)
- has_correct_type = TRUE;
- break;;
- case GST_PLAY_SINK_TYPE_ANY:
- if ((has_video_cap) || (has_audio_cap))
- has_correct_type = TRUE;
- break;;
- default:
- has_correct_type = FALSE;
- }
-
- caps = caps->next;
+ structure = gst_caps_get_structure (caps, 0);
+
+ if (strcmp (gst_structure_get_name (structure),
+ "audio/x-raw-int") == 0) {
+ has_audio_cap = TRUE;
+ }
+
+ if (strcmp (gst_structure_get_name (structure),
+ "video/x-raw-yuv") == 0 ||
+ strcmp (gst_structure_get_name (structure),
+ "video/x-raw-rgb") == 0) {
+ has_video_cap = TRUE;
+ }
+
+ switch (sink_type) {
+ case GST_PLAY_SINK_TYPE_AUDIO:
+ if (has_audio_cap)
+ has_correct_type = TRUE;
+ break;;
+ case GST_PLAY_SINK_TYPE_VIDEO:
+ if (has_video_cap)
+ has_correct_type = TRUE;
+ break;;
+ case GST_PLAY_SINK_TYPE_ANY:
+ if ((has_video_cap) || (has_audio_cap))
+ has_correct_type = TRUE;
+ break;;
+ default:
+ has_correct_type = FALSE;
}
}