diff options
author | Thibault Saunier <thibault.saunier@collabora.com> | 2011-09-29 14:37:59 -0300 |
---|---|---|
committer | Thibault Saunier <thibault.saunier@collabora.com> | 2011-11-28 21:25:34 -0300 |
commit | 5555b5fa9db3612abc804a6c86802d21906cf4af (patch) | |
tree | 58c0c3264d0b7778873d2acf121da2a991633d07 /gst/videoparsers | |
parent | 48ad76e53844d54bb7ab23887c72813a29079624 (diff) | |
download | gstreamer-plugins-bad-5555b5fa9db3612abc804a6c86802d21906cf4af.tar.gz |
mpeg4videoparse: Properly handle profile and level in caps
Fix #660234
Diffstat (limited to 'gst/videoparsers')
-rw-r--r-- | gst/videoparsers/Makefile.am | 3 | ||||
-rw-r--r-- | gst/videoparsers/gstmpeg4videoparse.c | 20 | ||||
-rw-r--r-- | gst/videoparsers/gstmpeg4videoparse.h | 3 |
3 files changed, 15 insertions, 11 deletions
diff --git a/gst/videoparsers/Makefile.am b/gst/videoparsers/Makefile.am index bc1c279c9..5be1563d9 100644 --- a/gst/videoparsers/Makefile.am +++ b/gst/videoparsers/Makefile.am @@ -12,7 +12,8 @@ libgstvideoparsersbad_la_CFLAGS = \ $(GST_BASE_CFLAGS) $(GST_CFLAGS) libgstvideoparsersbad_la_LIBADD = $(GST_PLUGINS_BASE_LIBS) \ $(top_builddir)/gst-libs/gst/codecparsers/libgstcodecparsers-$(GST_MAJORMINOR).la \ - $(GST_BASE_LIBS) $(GST_LIBS) + $(GST_BASE_LIBS) -lgstpbutils-$(GST_MAJORMINOR) \ + $(GST_LIBS) libgstvideoparsersbad_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS) libgstvideoparsersbad_la_LIBTOOLFLAGS = --tag=disable-static diff --git a/gst/videoparsers/gstmpeg4videoparse.c b/gst/videoparsers/gstmpeg4videoparse.c index 6170ae166..d159ce8f0 100644 --- a/gst/videoparsers/gstmpeg4videoparse.c +++ b/gst/videoparsers/gstmpeg4videoparse.c @@ -30,6 +30,8 @@ #include <string.h> #include <gst/base/gstbytereader.h> +#include <gst/pbutils/codec-utils.h> + #include "gstmpeg4videoparse.h" GST_DEBUG_CATEGORY (mpeg4v_parse_debug); @@ -193,8 +195,9 @@ static void gst_mpeg4vparse_reset (GstMpeg4VParse * mp4vparse) { gst_mpeg4vparse_reset_frame (mp4vparse); - mp4vparse->profile = 0; mp4vparse->update_caps = TRUE; + mp4vparse->profile = NULL; + mp4vparse->level = NULL; gst_buffer_replace (&mp4vparse->config, NULL); memset (&mp4vparse->vol, 0, sizeof (mp4vparse->vol)); @@ -325,6 +328,10 @@ gst_mpeg4vparse_process_sc (GstMpeg4VParse * mp4vparse, GstMpeg4Packet * packet, case GST_MPEG4_VISUAL_OBJ_SEQ_START: GST_LOG_OBJECT (mp4vparse, "Visual Sequence Start"); mp4vparse->vo_found = TRUE; + mp4vparse->profile = gst_codec_utils_mpeg4video_get_profile (packet->data + + packet->offset + 1, packet->offset); + mp4vparse->level = gst_codec_utils_mpeg4video_get_level (packet->data + + packet->offset + 1, packet->offset); break; case GST_MPEG4_VISUAL_OBJ: GST_LOG_OBJECT (mp4vparse, "Visual Object"); @@ -489,14 +496,9 @@ gst_mpeg4vparse_update_src_caps (GstMpeg4VParse * mp4vparse) gst_caps_set_simple (caps, "systemstream", G_TYPE_BOOLEAN, FALSE, "parsed", G_TYPE_BOOLEAN, TRUE, NULL); - if (mp4vparse->profile != 0) { - gchar *profile = NULL; - - /* FIXME does it make sense to expose the profile in the caps ? */ - profile = g_strdup_printf ("%d", mp4vparse->profile); - gst_caps_set_simple (caps, "profile-level-id", - G_TYPE_STRING, profile, NULL); - g_free (profile); + if (mp4vparse->profile && mp4vparse->level) { + gst_caps_set_simple (caps, "profile", G_TYPE_STRING, mp4vparse->profile, + "level", G_TYPE_STRING, mp4vparse->level, NULL); } if (mp4vparse->config != NULL) { diff --git a/gst/videoparsers/gstmpeg4videoparse.h b/gst/videoparsers/gstmpeg4videoparse.h index d76435f41..30368535a 100644 --- a/gst/videoparsers/gstmpeg4videoparse.h +++ b/gst/videoparsers/gstmpeg4videoparse.h @@ -55,9 +55,10 @@ struct _GstMpeg4VParse { gboolean update_caps; GstBuffer *config; - guint8 profile; GstMpeg4VideoObjectLayer vol; gboolean vol_offset; + const gchar *profile; + const gchar *level; /* properties */ gboolean drop; |