summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim-Philipp Müller <tim@centricular.com>2015-02-15 20:08:36 +0000
committerTim-Philipp Müller <tim@centricular.com>2015-02-15 20:08:36 +0000
commit6af7b7016216ea9e92c23ec1baf827ffce72a645 (patch)
treeb7370438769b54d6cf90bee8b9934bbb1e4e2919
parent4e1a43d4eafaa3966f5a57c61ad4c6d960f30515 (diff)
pbutils: description: move some code into utility function
-rw-r--r--gst-libs/gst/pbutils/descriptions.c58
1 files changed, 22 insertions, 36 deletions
diff --git a/gst-libs/gst/pbutils/descriptions.c b/gst-libs/gst/pbutils/descriptions.c
index f6fe9dbe6..006b57a20 100644
--- a/gst-libs/gst/pbutils/descriptions.c
+++ b/gst-libs/gst/pbutils/descriptions.c
@@ -330,6 +330,25 @@ static const FormatInfo formats[] = {
};
static const gchar *
+pbutils_desc_get_profile_name_from_nick (const gchar * map, gsize map_len,
+ const gchar * nick)
+{
+ const gchar *end = map + map_len;
+ const gchar *p;
+
+ p = map;
+ while (*p != '\0' && p < end) {
+ guint len = strlen (p);
+
+ if (strcmp (p, nick) == 0)
+ return p + len + 1;
+ p += len + 1;
+ p += strlen (p) + 1;
+ }
+ return NULL;
+}
+
+static const gchar *
pbutils_desc_get_mpeg4v_profile_name_from_nick (const gchar * nick)
{
const gchar map[] = "simple\000Simple\000"
@@ -352,19 +371,8 @@ pbutils_desc_get_mpeg4v_profile_name_from_nick (const gchar * nick)
"fine-granularity-scalable\000Fine Granularity Scalable\000"
"basic-animated-texture\000Basic Animated Texture\000"
"baseline\000Baseline Profile\000";
- const gchar *end = map + sizeof (map);
- const gchar *p;
-
- p = map;
- while (*p != '\0' && p < end) {
- guint len = strlen (p);
- if (strcmp (p, nick) == 0)
- return p + len + 1;
- p += len + 1;
- p += strlen (p) + 1;
- }
- return NULL;
+ return pbutils_desc_get_profile_name_from_nick (map, sizeof (map), nick);
}
static const gchar *
@@ -387,19 +395,8 @@ pbutils_desc_get_h264_profile_name_from_nick (const gchar * nick)
"scalable-constrained-baseline\000Scalable Constrained Baseline\000"
"scalable-baseline\000Scalable Baseline\000"
"scalable-high\000Scalable High\000";
- const gchar *end = map + sizeof (map);
- const gchar *p;
-
- p = map;
- while (*p != '\0' && p < end) {
- guint len = strlen (p);
- if (strcmp (p, nick) == 0)
- return p + len + 1;
- p += len + 1;
- p += strlen (p) + 1;
- }
- return NULL;
+ return pbutils_desc_get_profile_name_from_nick (map, sizeof (map), nick);
}
static const gchar *
@@ -415,19 +412,8 @@ pbutils_desc_get_h265_profile_name_from_nick (const gchar * nick)
"main-4:4:4-12\000Main 4:4:4 12\000"
"main-4:4:4-16-intra\000Main 4:4:4 16 Intra\000"
"main-still-picture\000Main Still Picture\000";
- const gchar *end = map + sizeof (map);
- const gchar *p;
-
- p = map;
- while (*p != '\0' && p < end) {
- guint len = strlen (p);
- if (strcmp (p, nick) == 0)
- return p + len + 1;
- p += len + 1;
- p += strlen (p) + 1;
- }
- return NULL;
+ return pbutils_desc_get_profile_name_from_nick (map, sizeof (map), nick);
}
/* returns static descriptions and dynamic ones (such as video/x-raw),