[rygel-gst-0-10-media-engine] Fix containerless transcoders
- From: Jens Georg <jensgeorg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [rygel-gst-0-10-media-engine] Fix containerless transcoders
- Date: Wed, 13 Feb 2013 15:25:15 +0000 (UTC)
commit e1678432329020a113377c73b0e63e195c97ade3
Author: Jens Georg <jensg openismus com>
Date: Wed Feb 13 14:24:14 2013 +0100
Fix containerless transcoders
src/rygel-audio-transcoder.c | 16 +++++-----------
src/rygel-gst-utils.c | 22 ++++++++++++++++++++++
src/rygel-gst-utils.h | 3 +++
src/rygel-video-transcoder.c | 7 +++++--
4 files changed, 35 insertions(+), 13 deletions(-)
---
diff --git a/src/rygel-audio-transcoder.c b/src/rygel-audio-transcoder.c
index 3cdc79c..66d1378 100644
--- a/src/rygel-audio-transcoder.c
+++ b/src/rygel-audio-transcoder.c
@@ -23,6 +23,7 @@
*/
#include "rygel-audio-transcoder.h"
+#include "rygel-gst-utils.h"
/**
* Base class for all transcoders that handle audio.
@@ -106,23 +107,16 @@ rygel_audio_transcoder_set_property (GObject *object,
if (priv->audio_codec_format) {
gst_caps_unref (priv->audio_codec_format);
}
- str = g_value_get_string (value);
- if (!str) {
- str = "NULL";
- }
- priv->audio_codec_format = gst_caps_from_string (str);
+
+ priv->audio_codec_format = rygel_gst_utils_caps_from_gvalue (value);
break;
case RYGEL_AUDIO_TRANSCODER_CONTAINER_CAPS:
if (priv->container_format) {
gst_caps_unref (priv->container_format);
- priv->container_format = NULL;
}
- str = g_value_get_string (value);
- if (!str) {
- str = "NULL";
- }
- priv->container_format = gst_caps_from_string (str);
+
+ priv->container_format = rygel_gst_utils_caps_from_gvalue (value);
break;
default:
diff --git a/src/rygel-gst-utils.c b/src/rygel-gst-utils.c
index 6fad5e5..af51661 100644
--- a/src/rygel-gst-utils.c
+++ b/src/rygel-gst-utils.c
@@ -168,3 +168,25 @@ rygel_gst_utils_get_rtp_depayloader (GstCaps *caps) {
return element;
}
}
+
+/**
+ * rygel_gst_utils_caps_from_gvalue:
+ * Convert a #GValue holding a string to #GstCaps or return %NULL if the
+ * #GValue holds a %NULL string or no string at all.
+ **/
+GstCaps *
+rygel_gst_utils_caps_from_gvalue (const GValue *value)
+{
+ const gchar *str;
+
+ if (!G_VALUE_HOLDS (value, G_TYPE_STRING)) {
+ return NULL;
+ }
+
+ str = g_value_get_string (value);
+ if (str == NULL) {
+ return NULL;
+ }
+
+ return gst_caps_from_string (str);
+}
diff --git a/src/rygel-gst-utils.h b/src/rygel-gst-utils.h
index 098eaf5..5680011 100644
--- a/src/rygel-gst-utils.h
+++ b/src/rygel-gst-utils.h
@@ -41,6 +41,9 @@ rygel_gst_utils_dump_encoding_profile (GstEncodingProfile *profile,
GstElement *
rygel_gst_utils_get_rtp_depayloader (GstCaps *caps);
+GstCaps *
+rygel_gst_utils_caps_from_gvalue (const GValue *value);
+
G_END_DECLS
#endif /* __RYGEL_GST_0_10_MEDIA_ENGINE_GST_UTILS_H__ */
diff --git a/src/rygel-video-transcoder.c b/src/rygel-video-transcoder.c
index 52c8b32..f637e09 100644
--- a/src/rygel-video-transcoder.c
+++ b/src/rygel-video-transcoder.c
@@ -22,6 +22,7 @@
*/
#include "rygel-video-transcoder.h"
+#include "rygel-gst-utils.h"
/**
* Base class for all transcoders that handle video.
@@ -201,14 +202,16 @@ rygel_video_transcoder_set_property (GObject *object,
if (priv->video_codec_format) {
gst_caps_unref (priv->video_codec_format);
}
- priv->video_codec_format = gst_caps_from_string (g_value_get_string (value));
+
+ priv->video_codec_format = rygel_gst_utils_caps_from_gvalue (value);
break;
case RYGEL_VIDEO_TRANSCODER_VIDEO_RESTRICTIONS:
if (priv->video_restrictions) {
gst_caps_unref (priv->video_restrictions);
}
- priv->video_restrictions = gst_caps_from_string (g_value_get_string (value));
+
+ priv->video_restrictions = rygel_gst_utils_caps_from_gvalue (value);
break;
default:
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]