fourcc: remove fourcc

Remove fourcc in caps.
Fix pbutils descriptions.
Add more video macros
Fix some unit test
This commit is contained in:
Wim Taymans 2011-08-22 12:22:02 +02:00
parent 5f359600ce
commit c81c62d03a
8 changed files with 120 additions and 129 deletions

View file

@ -1415,12 +1415,14 @@ setup_ogmaudio_mapper (GstOggStream * pad, ogg_packet * packet)
{ {
guint8 *data = packet->packet; guint8 *data = packet->packet;
guint32 fourcc; guint32 fourcc;
gchar *fstr;
pad->granulerate_n = GST_READ_UINT64_LE (data + 25); pad->granulerate_n = GST_READ_UINT64_LE (data + 25);
pad->granulerate_d = 1; pad->granulerate_d = 1;
fourcc = GST_READ_UINT32_LE (data + 9); fourcc = GST_READ_UINT32_LE (data + 9);
GST_DEBUG ("fourcc: %" GST_FOURCC_FORMAT, GST_FOURCC_ARGS (fourcc)); fstr = g_strdup_printf ("%" GST_FOURCC_FORMAT, GST_FOURCC_ARGS (fourcc));
GST_DEBUG ("fourcc: %s", fstr);
pad->caps = gst_riff_create_audio_caps (fourcc, NULL, NULL, NULL, NULL, NULL); pad->caps = gst_riff_create_audio_caps (fourcc, NULL, NULL, NULL, NULL, NULL);
@ -1433,9 +1435,10 @@ setup_ogmaudio_mapper (GstOggStream * pad, ogg_packet * packet)
"rate", G_TYPE_INT, pad->granulerate_n, NULL); "rate", G_TYPE_INT, pad->granulerate_n, NULL);
} else { } else {
pad->caps = gst_caps_new_simple ("audio/x-ogm-unknown", pad->caps = gst_caps_new_simple ("audio/x-ogm-unknown",
"fourcc", GST_TYPE_FOURCC, fourcc, "fourcc", G_TYPE_STRING, fstr,
"rate", G_TYPE_INT, pad->granulerate_n, NULL); "rate", G_TYPE_INT, pad->granulerate_n, NULL);
} }
g_free (fstr);
pad->n_header_packets = 1; pad->n_header_packets = 1;
pad->is_ogm = TRUE; pad->is_ogm = TRUE;
@ -1450,6 +1453,7 @@ setup_ogmvideo_mapper (GstOggStream * pad, ogg_packet * packet)
guint32 fourcc; guint32 fourcc;
int width, height; int width, height;
gint64 time_unit; gint64 time_unit;
gchar *fstr;
GST_DEBUG ("time unit %d", GST_READ_UINT32_LE (data + 16)); GST_DEBUG ("time unit %d", GST_READ_UINT32_LE (data + 16));
GST_DEBUG ("samples per unit %d", GST_READ_UINT32_LE (data + 24)); GST_DEBUG ("samples per unit %d", GST_READ_UINT32_LE (data + 24));
@ -1469,13 +1473,14 @@ setup_ogmvideo_mapper (GstOggStream * pad, ogg_packet * packet)
fourcc = GST_READ_UINT32_LE (data + 9); fourcc = GST_READ_UINT32_LE (data + 9);
width = GST_READ_UINT32_LE (data + 45); width = GST_READ_UINT32_LE (data + 45);
height = GST_READ_UINT32_LE (data + 49); height = GST_READ_UINT32_LE (data + 49);
GST_DEBUG ("fourcc: %" GST_FOURCC_FORMAT, GST_FOURCC_ARGS (fourcc)); fstr = g_strdup_printf ("%" GST_FOURCC_FORMAT, GST_FOURCC_ARGS (fourcc));
GST_DEBUG ("fourcc: %s", fstr);
pad->caps = gst_riff_create_video_caps (fourcc, NULL, NULL, NULL, NULL, NULL); pad->caps = gst_riff_create_video_caps (fourcc, NULL, NULL, NULL, NULL, NULL);
if (pad->caps == NULL) { if (pad->caps == NULL) {
pad->caps = gst_caps_new_simple ("video/x-ogm-unknown", pad->caps = gst_caps_new_simple ("video/x-ogm-unknown",
"fourcc", GST_TYPE_FOURCC, fourcc, "fourcc", G_TYPE_STRING, fstr,
"framerate", GST_TYPE_FRACTION, pad->granulerate_n, "framerate", GST_TYPE_FRACTION, pad->granulerate_n,
pad->granulerate_d, NULL); pad->granulerate_d, NULL);
} else { } else {
@ -1485,6 +1490,7 @@ setup_ogmvideo_mapper (GstOggStream * pad, ogg_packet * packet)
"width", G_TYPE_INT, width, "height", G_TYPE_INT, height, NULL); "width", G_TYPE_INT, width, "height", G_TYPE_INT, height, NULL);
} }
GST_DEBUG ("caps: %" GST_PTR_FORMAT, pad->caps); GST_DEBUG ("caps: %" GST_PTR_FORMAT, pad->caps);
g_free (fstr);
pad->n_header_packets = 1; pad->n_header_packets = 1;
pad->frame_size = 1; pad->frame_size = 1;

View file

@ -585,7 +585,7 @@ gst_ogm_parse_stream_header (GstOgmParse * ogm, const guint8 * data, guint size)
GST_WARNING_OBJECT (ogm, "could not find video caps for fourcc %" GST_WARNING_OBJECT (ogm, "could not find video caps for fourcc %"
GST_FOURCC_FORMAT, GST_FOURCC_ARGS (fourcc)); GST_FOURCC_FORMAT, GST_FOURCC_ARGS (fourcc));
caps = gst_caps_new_simple ("video/x-ogm-unknown", "fourcc", caps = gst_caps_new_simple ("video/x-ogm-unknown", "fourcc",
GST_TYPE_FOURCC, fourcc, NULL); G_TYPE_STRING, ogm->hdr.subtype, NULL);
break; break;
} }

View file

@ -47,6 +47,7 @@ EXTRA_DIST = pbutils-marshal.list
libgstpbutils_@GST_MAJORMINOR@_la_LIBADD = \ libgstpbutils_@GST_MAJORMINOR@_la_LIBADD = \
$(top_builddir)/gst-libs/gst/video/libgstvideo-@GST_MAJORMINOR@.la \ $(top_builddir)/gst-libs/gst/video/libgstvideo-@GST_MAJORMINOR@.la \
$(top_builddir)/gst-libs/gst/audio/libgstaudio-@GST_MAJORMINOR@.la \
$(GST_LIBS) $(GST_LIBS)
libgstpbutils_@GST_MAJORMINOR@_la_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_CFLAGS) libgstpbutils_@GST_MAJORMINOR@_la_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_CFLAGS)
libgstpbutils_@GST_MAJORMINOR@_la_LDFLAGS = $(GST_LIB_LDFLAGS) $(GST_ALL_LDFLAGS) $(GST_LT_LDFLAGS) libgstpbutils_@GST_MAJORMINOR@_la_LDFLAGS = $(GST_LIB_LDFLAGS) $(GST_ALL_LDFLAGS) $(GST_LT_LDFLAGS)

View file

@ -42,6 +42,9 @@
#include "gst/gst-i18n-plugin.h" #include "gst/gst-i18n-plugin.h"
#include <gst/audio/audio.h>
#include <gst/video/video.h>
#include "pbutils.h" #include "pbutils.h"
#include "pbutils-private.h" #include "pbutils-private.h"
@ -184,7 +187,6 @@ static const FormatInfo formats[] = {
{"video/x-nut", "NUT", FLAG_CONTAINER}, {"video/x-nut", "NUT", FLAG_CONTAINER},
{"video/x-nuv", "MythTV NuppelVideo (NUV)", FLAG_CONTAINER}, {"video/x-nuv", "MythTV NuppelVideo (NUV)", FLAG_CONTAINER},
{"video/x-qdrw", "Apple QuickDraw", 0}, {"video/x-qdrw", "Apple QuickDraw", 0},
{"video/x-raw-gray", N_("Uncompressed Gray Image"), 0},
{"video/x-smc", "Apple SMC", 0}, {"video/x-smc", "Apple SMC", 0},
{"video/x-smoke", "Smoke", 0}, {"video/x-smoke", "Smoke", 0},
{"video/x-tarkin", "Tarkin", 0}, {"video/x-tarkin", "Tarkin", 0},
@ -251,8 +253,7 @@ static const FormatInfo formats[] = {
{"audio/x-adpcm", NULL, 0}, {"audio/x-adpcm", NULL, 0},
{"audio/x-mace", NULL, 0}, {"audio/x-mace", NULL, 0},
{"audio/x-pn-realaudio", NULL, 0}, {"audio/x-pn-realaudio", NULL, 0},
{"audio/x-raw-int", NULL, 0}, {"audio/x-raw", NULL, 0},
{"audio/x-raw-float", NULL, 0},
{"audio/x-wma", NULL, 0}, {"audio/x-wma", NULL, 0},
{"video/mpeg", NULL, FLAG_CONTAINER | FLAG_SYSTEMSTREAM}, {"video/mpeg", NULL, FLAG_CONTAINER | FLAG_SYSTEMSTREAM},
{"video/mpeg", NULL, 0}, {"video/mpeg", NULL, 0},
@ -274,14 +275,13 @@ static const FormatInfo formats[] = {
{"audio/x-pn-multirate-realaudio-live", NULL, 0}, {"audio/x-pn-multirate-realaudio-live", NULL, 0},
#endif #endif
{"video/x-truemotion", NULL, 0}, {"video/x-truemotion", NULL, 0},
{"video/x-raw-rgb", NULL, 0}, {"video/x-raw", NULL, 0},
{"video/x-raw-yuv", NULL, 0},
{"video/x-svq", NULL, 0}, {"video/x-svq", NULL, 0},
{"video/x-wmv", NULL, 0}, {"video/x-wmv", NULL, 0},
{"video/x-xan", NULL, 0} {"video/x-xan", NULL, 0}
}; };
/* returns static descriptions and dynamic ones (such as video/x-raw-yuv), /* returns static descriptions and dynamic ones (such as video/x-raw),
* or NULL if caps aren't known at all */ * or NULL if caps aren't known at all */
static gchar * static gchar *
format_info_get_desc (const FormatInfo * info, const GstCaps * caps) format_info_get_desc (const FormatInfo * info, const GstCaps * caps)
@ -295,63 +295,61 @@ format_info_get_desc (const FormatInfo * info, const GstCaps * caps)
s = gst_caps_get_structure (caps, 0); s = gst_caps_get_structure (caps, 0);
if (strcmp (info->type, "video/x-raw-yuv") == 0) { if (strcmp (info->type, "video/x-raw") == 0) {
const gchar *ret = NULL; gchar *ret = NULL;
guint32 fourcc = 0; const gchar *str = 0;
GstVideoFormat format;
const GstVideoFormatInfo *finfo;
gst_structure_get_fourcc (s, "format", &fourcc); str = gst_structure_get_string (s, "format");
switch (fourcc) { format = gst_video_format_from_string (str);
case GST_MAKE_FOURCC ('I', '4', '2', '0'): if (format == GST_VIDEO_FORMAT_UNKNOWN)
ret = _("Uncompressed planar YUV 4:2:0"); return g_strdup (_("Uncompressed video"));
break;
case GST_MAKE_FOURCC ('Y', 'V', '1', '2'):
ret = _("Uncompressed planar YVU 4:2:0");
break;
case GST_MAKE_FOURCC ('Y', 'U', 'Y', '2'):
ret = _("Uncompressed packed YUV 4:2:2");
break;
case GST_MAKE_FOURCC ('Y', 'U', 'V', '9'):
ret = _("Uncompressed packed YUV 4:1:0");
break;
case GST_MAKE_FOURCC ('Y', 'V', 'U', '9'):
ret = _("Uncompressed packed YVU 4:1:0");
break;
case GST_MAKE_FOURCC ('Y', 'V', 'Y', 'U'):
case GST_MAKE_FOURCC ('U', 'Y', 'V', 'Y'):
ret = _("Uncompressed packed YUV 4:2:2");
break;
case GST_MAKE_FOURCC ('Y', '4', '1', 'P'):
ret = _("Uncompressed packed YUV 4:1:1");
break;
case GST_MAKE_FOURCC ('I', 'Y', 'U', '2'):
ret = _("Uncompressed packed YUV 4:4:4");
break;
case GST_MAKE_FOURCC ('Y', '4', '2', 'B'):
ret = _("Uncompressed planar YUV 4:2:2");
break;
case GST_MAKE_FOURCC ('Y', '4', '1', 'B'):
ret = _("Uncompressed planar YUV 4:1:1");
break;
case GST_MAKE_FOURCC ('Y', '8', '0', '0'):
ret = _("Uncompressed black and white Y-plane");
break;
default:
ret = _("Uncompressed YUV");
break;
}
return g_strdup (ret);
} else if (strcmp (info->type, "video/x-raw-rgb") == 0) {
const gchar *rgb_str;
gint depth = 0;
gst_structure_get_int (s, "depth", &depth); finfo = gst_video_format_get_info (format);
rgb_str = gst_structure_has_field (s, "alpha_mask") ? "RGBA" : "RGB";
if (gst_structure_has_field (s, "paletted_data")) { if (GST_VIDEO_FORMAT_INFO_IS_GRAY (finfo)) {
return g_strdup_printf (_("Uncompressed palettized %d-bit %s"), depth, ret = g_strdup (_("Uncompressed gray"));
rgb_str); } else if (GST_VIDEO_FORMAT_INFO_IS_YUV (finfo)) {
const gchar *layout;
const gchar *subs;
gint w_sub, h_sub;
w_sub = GST_VIDEO_FORMAT_INFO_W_SUB (finfo, 1);
h_sub = GST_VIDEO_FORMAT_INFO_H_SUB (finfo, 1);
if (GST_VIDEO_FORMAT_INFO_N_PLANES (finfo) == 1) {
layout = "planar";
} else {
layout = "packed";
}
if (w_sub == 1 && h_sub == 1) {
subs = "4:4:4";
} else if (w_sub == 2 && h_sub == 1) {
subs = "4:2:2";
} else if (w_sub == 2 && h_sub == 2) {
subs = "4:2:0";
} else if (w_sub == 4 && h_sub == 1) {
subs = "4:1:1";
} else {
subs = "";
}
ret = g_strdup_printf (_("Uncompressed %s YUV %s"), layout, subs);
} else if (GST_VIDEO_FORMAT_INFO_IS_RGB (finfo)) {
gboolean alpha, palette;
gint bits;
alpha = GST_VIDEO_FORMAT_INFO_HAS_ALPHA (finfo);
palette = GST_VIDEO_FORMAT_INFO_HAS_PALETTE (finfo);
bits = GST_VIDEO_FORMAT_INFO_BITS (finfo);
ret = g_strdup_printf (_("Uncompressed %s%d-bit %s"),
palette ? "palettized " : "", bits, alpha ? "RGBA" : "RGB");
} else { } else {
return g_strdup_printf ("Uncompressed %d-bit %s", depth, rgb_str); ret = g_strdup (_("Uncompressed video"));
} }
return ret;
} else if (strcmp (info->type, "video/x-h263") == 0) { } else if (strcmp (info->type, "video/x-h263") == 0) {
const gchar *variant, *ret; const gchar *variant, *ret;
@ -610,26 +608,25 @@ format_info_get_desc (const FormatInfo * info, const GstCaps * caps)
} }
} }
return g_strdup ("MPEG Video"); return g_strdup ("MPEG Video");
} else if (strcmp (info->type, "audio/x-raw-int") == 0) { } else if (strcmp (info->type, "audio/x-raw") == 0) {
gint bitdepth = 0; gint depth = 0;
gboolean is_float;
const gchar *str;
GstAudioFormat format;
const GstAudioFormatInfo *finfo;
/* 8-bit pcm might not have depth field (?) */ str = gst_structure_get_string (s, "format");
if (!gst_structure_get_int (s, "depth", &bitdepth)) format = gst_audio_format_from_string (str);
gst_structure_get_int (s, "width", &bitdepth); if (format == GST_AUDIO_FORMAT_UNKNOWN)
if (bitdepth != 0) return g_strdup (_("Uncompressed audio"));
return g_strdup_printf (_("Raw %d-bit PCM audio"), bitdepth);
else
return g_strdup (_("Raw PCM audio"));
} else if (strcmp (info->type, "audio/x-raw-float") == 0) {
gint bitdepth = 0;
gst_structure_get_int (s, "width", &bitdepth); finfo = gst_audio_format_get_info (format);
if (bitdepth != 0) depth = GST_AUDIO_FORMAT_INFO_DEPTH (finfo);
return g_strdup_printf (_("Raw %d-bit floating-point audio"), bitdepth); is_float = GST_AUDIO_FORMAT_INFO_IS_FLOAT (finfo);
else
return g_strdup (_("Raw floating-point audio")); return g_strdup_printf (_("Raw %d-bit %s audio"), depth,
is_float ? "floating-point" : "PCM");
} }
return NULL; return NULL;
} }

View file

@ -68,21 +68,14 @@ gst_riff_create_video_caps (guint32 codec_fcc,
if (strf) { if (strf) {
if (bpp == 8) { if (bpp == 8) {
caps = gst_caps_new_simple ("video/x-raw-rgb", caps = gst_caps_new_simple ("video/x-raw",
"bpp", G_TYPE_INT, 8, "depth", G_TYPE_INT, 8, "format", G_TYPE_STRING, "RGB8_PALETTED", NULL);
"endianness", G_TYPE_INT, G_BYTE_ORDER, NULL);
} else if (bpp == 24) { } else if (bpp == 24) {
caps = gst_caps_new_simple ("video/x-raw-rgb", caps = gst_caps_new_simple ("video/x-raw",
"bpp", G_TYPE_INT, 24, "depth", G_TYPE_INT, 24, "format", G_TYPE_STRING, "BGR", NULL);
"endianness", G_TYPE_INT, G_BIG_ENDIAN,
"red_mask", G_TYPE_INT, 0xff, "green_mask", G_TYPE_INT, 0xff00,
"blue_mask", G_TYPE_INT, 0xff0000, NULL);
} else if (bpp == 32) { } else if (bpp == 32) {
caps = gst_caps_new_simple ("video/x-raw-rgb", caps = gst_caps_new_simple ("video/x-raw",
"bpp", G_TYPE_INT, 32, "depth", G_TYPE_INT, 24, "format", G_TYPE_STRING, "BGRx", NULL);
"endianness", G_TYPE_INT, G_BIG_ENDIAN,
"red_mask", G_TYPE_INT, 0xff00, "green_mask", G_TYPE_INT,
0xff0000, "blue_mask", G_TYPE_INT, 0xff000000, NULL);
} else { } else {
GST_WARNING ("Unhandled DIB RGB depth: %d", bpp); GST_WARNING ("Unhandled DIB RGB depth: %d", bpp);
return NULL; return NULL;
@ -90,8 +83,8 @@ gst_riff_create_video_caps (guint32 codec_fcc,
} else { } else {
/* for template */ /* for template */
caps = caps =
gst_caps_from_string ("video/x-raw-rgb, bpp = (int) { 8, 24, 32 }, " gst_caps_from_string ("video/x-raw, format = (string) "
"depth = (int) { 8, 24}"); "{ RGB8_PALETTED, BGR, BGRx }");
} }
palette = strf_data; palette = strf_data;
@ -105,40 +98,38 @@ gst_riff_create_video_caps (guint32 codec_fcc,
break; break;
} }
case GST_MAKE_FOURCC ('I', '4', '2', '0'): case GST_MAKE_FOURCC ('I', '4', '2', '0'):
caps = gst_caps_new_simple ("video/x-raw-yuv", caps = gst_caps_new_simple ("video/x-raw",
"format", GST_TYPE_FOURCC, codec_fcc, NULL); "format", G_TYPE_STRING, "I420", NULL);
if (codec_name) if (codec_name)
*codec_name = g_strdup ("Uncompressed planar YUV 4:2:0"); *codec_name = g_strdup ("Uncompressed planar YUV 4:2:0");
break; break;
case GST_MAKE_FOURCC ('Y', 'U', 'Y', '2'): case GST_MAKE_FOURCC ('Y', 'U', 'Y', '2'):
case GST_MAKE_FOURCC ('Y', 'U', 'N', 'V'): case GST_MAKE_FOURCC ('Y', 'U', 'N', 'V'):
caps = gst_caps_new_simple ("video/x-raw-yuv", caps = gst_caps_new_simple ("video/x-raw",
"format", GST_TYPE_FOURCC, GST_MAKE_FOURCC ('Y', 'U', 'Y', '2'), "format", G_TYPE_STRING, "YUY2", NULL);
NULL);
if (codec_name) if (codec_name)
*codec_name = g_strdup ("Uncompressed packed YUV 4:2:2"); *codec_name = g_strdup ("Uncompressed packed YUV 4:2:2");
break; break;
case GST_MAKE_FOURCC ('Y', 'V', 'U', '9'): case GST_MAKE_FOURCC ('Y', 'V', 'U', '9'):
caps = gst_caps_new_simple ("video/x-raw-yuv", caps = gst_caps_new_simple ("video/x-raw",
"format", GST_TYPE_FOURCC, codec_fcc, NULL); "format", G_TYPE_STRING, "YVU9", NULL);
if (codec_name) if (codec_name)
*codec_name = g_strdup ("Uncompressed packed YVU 4:1:0"); *codec_name = g_strdup ("Uncompressed packed YVU 4:1:0");
break; break;
case GST_MAKE_FOURCC ('U', 'Y', 'V', 'Y'): case GST_MAKE_FOURCC ('U', 'Y', 'V', 'Y'):
case GST_MAKE_FOURCC ('2', 'v', 'u', 'y'): case GST_MAKE_FOURCC ('2', 'v', 'u', 'y'):
caps = gst_caps_new_simple ("video/x-raw-yuv", caps = gst_caps_new_simple ("video/x-raw",
"format", GST_TYPE_FOURCC, GST_MAKE_FOURCC ('U', 'Y', 'V', 'Y'), "format", G_TYPE_STRING, "UYVY", NULL);
NULL);
if (codec_name) if (codec_name)
*codec_name = g_strdup ("Uncompressed packed YUV 4:2:2"); *codec_name = g_strdup ("Uncompressed packed YUV 4:2:2");
break; break;
case GST_MAKE_FOURCC ('Y', 'V', '1', '2'): case GST_MAKE_FOURCC ('Y', 'V', '1', '2'):
caps = gst_caps_new_simple ("video/x-raw-yuv", caps = gst_caps_new_simple ("video/x-raw",
"format", GST_TYPE_FOURCC, codec_fcc, NULL); "format", G_TYPE_STRING, "YV12", NULL);
if (codec_name) if (codec_name)
*codec_name = g_strdup ("Uncompressed packed YVU 4:2:2"); *codec_name = g_strdup ("Uncompressed packed YVU 4:2:2");
break; break;
@ -547,16 +538,14 @@ gst_riff_create_video_caps (guint32 codec_fcc,
case GST_MAKE_FOURCC ('W', 'M', 'V', 'A'): case GST_MAKE_FOURCC ('W', 'M', 'V', 'A'):
caps = gst_caps_new_simple ("video/x-wmv", caps = gst_caps_new_simple ("video/x-wmv",
"wmvversion", G_TYPE_INT, 3, "format", GST_TYPE_FOURCC, "wmvversion", G_TYPE_INT, 3, "format", G_TYPE_STRING, "WMVA", NULL);
codec_fcc, NULL);
if (codec_name) if (codec_name)
*codec_name = g_strdup ("Microsoft Windows Media Advanced Profile"); *codec_name = g_strdup ("Microsoft Windows Media Advanced Profile");
break; break;
case GST_MAKE_FOURCC ('W', 'V', 'C', '1'): case GST_MAKE_FOURCC ('W', 'V', 'C', '1'):
caps = gst_caps_new_simple ("video/x-wmv", caps = gst_caps_new_simple ("video/x-wmv",
"wmvversion", G_TYPE_INT, 3, "format", GST_TYPE_FOURCC, "wmvversion", G_TYPE_INT, 3, "format", G_TYPE_STRING, "WVC1", NULL);
codec_fcc, NULL);
if (codec_name) if (codec_name)
*codec_name = g_strdup ("Microsoft Windows Media VC-1"); *codec_name = g_strdup ("Microsoft Windows Media VC-1");
break; break;

View file

@ -261,8 +261,12 @@ struct _GstVideoFormatInfo {
#define GST_VIDEO_FORMAT_INFO_IS_RGB(info) ((info)->flags & GST_VIDEO_FORMAT_FLAG_RGB) #define GST_VIDEO_FORMAT_INFO_IS_RGB(info) ((info)->flags & GST_VIDEO_FORMAT_FLAG_RGB)
#define GST_VIDEO_FORMAT_INFO_IS_GRAY(info) ((info)->flags & GST_VIDEO_FORMAT_FLAG_GRAY) #define GST_VIDEO_FORMAT_INFO_IS_GRAY(info) ((info)->flags & GST_VIDEO_FORMAT_FLAG_GRAY)
#define GST_VIDEO_FORMAT_INFO_HAS_ALPHA(info) ((info)->flags & GST_VIDEO_FORMAT_FLAG_ALPHA) #define GST_VIDEO_FORMAT_INFO_HAS_ALPHA(info) ((info)->flags & GST_VIDEO_FORMAT_FLAG_ALPHA)
#define GST_VIDEO_FORMAT_INFO_IS_LE(info) ((info)->flags & GST_VIDEO_FORMAT_FLAG_LE)
#define GST_VIDEO_FORMAT_INFO_HAS_PALETTE(info) ((info)->flags & GST_VIDEO_FORMAT_FLAG_PALETTE)
#define GST_VIDEO_FORMAT_INFO_BITS(info) ((info)->bits)
#define GST_VIDEO_FORMAT_INFO_N_COMPONENTS(info) ((info)->n_components) #define GST_VIDEO_FORMAT_INFO_N_COMPONENTS(info) ((info)->n_components)
#define GST_VIDEO_FORMAT_INFO_SHIFT(info,c) ((info)->shift[c])
#define GST_VIDEO_FORMAT_INFO_DEPTH(info,c) ((info)->depth[c]) #define GST_VIDEO_FORMAT_INFO_DEPTH(info,c) ((info)->depth[c])
#define GST_VIDEO_FORMAT_INFO_PSTRIDE(info,c) ((info)->pixel_stride[c]) #define GST_VIDEO_FORMAT_INFO_PSTRIDE(info,c) ((info)->pixel_stride[c])
#define GST_VIDEO_FORMAT_INFO_N_PLANES(info) ((info)->n_planes) #define GST_VIDEO_FORMAT_INFO_N_PLANES(info) ((info)->n_planes)

View file

@ -131,10 +131,7 @@ check_PROGRAMS = \
libs/xmpwriter \ libs/xmpwriter \
$(cxx_checks) \ $(cxx_checks) \
$(check_orc) \ $(check_orc) \
pipelines/simple-launch-lines \ pipelines/simple-launch-lines
pipelines/streamheader \
pipelines/basetime \
pipelines/capsfilter-renegotiation
# TORTURE_TO_FIX = \ # TORTURE_TO_FIX = \
# elements/adder # elements/adder
@ -146,6 +143,9 @@ VALGRIND_TO_FIX = \
# FIXME 0.11: these tests don't even build at the moment # FIXME 0.11: these tests don't even build at the moment
ZERO_11_TO_PORT = \ ZERO_11_TO_PORT = \
pipelines/streamheader \
pipelines/basetime \
pipelines/capsfilter-renegotiation \
elements/appsink \ elements/appsink \
elements/appsrc \ elements/appsrc \
elements/audiorate \ elements/audiorate \

View file

@ -222,13 +222,13 @@ static gboolean test_mpeg_audio_parse_check_valid_frame (GstBaseParse * parse,
static GstFlowReturn test_mpeg_audio_parse_parse_frame (GstBaseParse * parse, static GstFlowReturn test_mpeg_audio_parse_parse_frame (GstBaseParse * parse,
GstBaseParseFrame * frame); GstBaseParseFrame * frame);
GST_BOILERPLATE (TestMpegAudioParse, test_mpeg_audio_parse, GstBaseParse, G_DEFINE_TYPE (TestMpegAudioParse, test_mpeg_audio_parse, GST_TYPE_BASE_PARSE);
GST_TYPE_BASE_PARSE);
static void static void
test_mpeg_audio_parse_base_init (gpointer klass) test_mpeg_audio_parse_class_init (TestMpegAudioParseClass * klass)
{ {
GstElementClass *element_class = GST_ELEMENT_CLASS (klass); GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
GstBaseParseClass *parse_class = GST_BASE_PARSE_CLASS (klass);
gst_element_class_add_pad_template (element_class, gst_element_class_add_pad_template (element_class,
gst_static_pad_template_get (&sink_template)); gst_static_pad_template_get (&sink_template));
@ -238,12 +238,6 @@ test_mpeg_audio_parse_base_init (gpointer klass)
gst_element_class_set_details_simple (element_class, "MPEG1 Audio Parser", gst_element_class_set_details_simple (element_class, "MPEG1 Audio Parser",
"Codec/Parser/Audio", "Pretends to parse mpeg1 audio stream", "Codec/Parser/Audio", "Pretends to parse mpeg1 audio stream",
"Foo Bar <foo@bar.com>"); "Foo Bar <foo@bar.com>");
}
static void
test_mpeg_audio_parse_class_init (TestMpegAudioParseClass * klass)
{
GstBaseParseClass *parse_class = GST_BASE_PARSE_CLASS (klass);
parse_class->start = test_mpeg_audio_parse_start; parse_class->start = test_mpeg_audio_parse_start;
parse_class->stop = test_mpeg_audio_parse_stop; parse_class->stop = test_mpeg_audio_parse_stop;
@ -254,8 +248,7 @@ test_mpeg_audio_parse_class_init (TestMpegAudioParseClass * klass)
static gint num_parse_instances = 0; static gint num_parse_instances = 0;
static void static void
test_mpeg_audio_parse_init (TestMpegAudioParse * mp3parse, test_mpeg_audio_parse_init (TestMpegAudioParse * mp3parse)
TestMpegAudioParseClass * klass)
{ {
/* catch decodebin plugging parsers in a loop early */ /* catch decodebin plugging parsers in a loop early */
fail_unless (++num_parse_instances < 10); fail_unless (++num_parse_instances < 10);
@ -278,7 +271,9 @@ static gboolean
test_mpeg_audio_parse_check_valid_frame (GstBaseParse * parse, test_mpeg_audio_parse_check_valid_frame (GstBaseParse * parse,
GstBaseParseFrame * frame, guint * framesize, gint * skipsize) GstBaseParseFrame * frame, guint * framesize, gint * skipsize)
{ {
const guint8 *data = GST_BUFFER_DATA (frame->buffer); guint8 data[2];
gst_buffer_extract (frame->buffer, 0, data, 2);
if ((GST_READ_UINT16_BE (data) & 0xffe0) == 0xffe0) { if ((GST_READ_UINT16_BE (data) & 0xffe0) == 0xffe0) {
/* this framesize is hard-coded for ../test.mp3 */ /* this framesize is hard-coded for ../test.mp3 */
@ -300,7 +295,6 @@ test_mpeg_audio_parse_parse_frame (GstBaseParse * parse,
caps = gst_caps_new_simple ("audio/mpeg", "mpegversion", G_TYPE_INT, 1, caps = gst_caps_new_simple ("audio/mpeg", "mpegversion", G_TYPE_INT, 1,
"mpegaudioversion", G_TYPE_INT, 1, "layer", G_TYPE_INT, 3, "mpegaudioversion", G_TYPE_INT, 1, "layer", G_TYPE_INT, 3,
"rate", G_TYPE_INT, 44100, "channels", G_TYPE_INT, 2, NULL); "rate", G_TYPE_INT, 44100, "channels", G_TYPE_INT, 2, NULL);
gst_buffer_set_caps (frame->buffer, caps);
gst_pad_set_caps (GST_BASE_PARSE_SRC_PAD (parse), caps); gst_pad_set_caps (GST_BASE_PARSE_SRC_PAD (parse), caps);
gst_caps_unref (caps); gst_caps_unref (caps);
} }