New mimetypes gone into effect today - this commit changes all old mimetypes over to the new mimetypes spec as descri...

Original commit message from CVS:
New mimetypes gone into effect today - this commit changes all old mimetypes over to the new mimetypes spec as described in the previous commit's document. Note: some plugins will break, some pipelines will break, expect HEAD to be broken or at least not 100% working for a few days, but don't forget to report bugs
This commit is contained in:
Ronald S. Bultje 2003-07-06 20:49:50 +00:00
parent efbd8d977d
commit ed2362149a
20 changed files with 795 additions and 505 deletions

View file

@ -409,34 +409,35 @@ dnl FIXME: add check if this platform can support linking to a
dnl non-PIC libXv, if not then don not use Xv.
dnl FIXME: perhaps warn user if they have a shared libXv since
dnl this is an error until XFree86 starts shipping one
translit(dnm, m, l) AM_CONDITIONAL(USE_XVIDEO, true)
GST_CHECK_FEATURE(XVIDEO, [X11 XVideo extensions], xvideosink, [
if test -z $X_DISPLAY_MISSING; then
HAVE_XVIDEO=yes
translit(dnm, m, l) AM_CONDITIONAL(USE_XFREE, true)
GST_CHECK_FEATURE(XFREE, [X11 XFree86], xvideosink-X, [
if test "-DX_DISPLAY_MISSING" = "$X_CFLAGS"; then
HAVE_XFREE=no
else
HAVE_XVIDEO=no
HAVE_XFREE=yes
fi
])
dnl Check for Xv extension
if test x$HAVE_XVIDEO = xyes; then
AC_CHECK_LIB(Xv_pic, XvQueryExtension, HAVE_XV="yes", HAVE_XV="no", $X_LIBS $X_PRE_LIBS -lXext -lX11 $X_EXTRA_LIBS)
if test x$HAVE_XV = xyes; then
AC_DEFINE(HAVE_XV, 1, [Define if Xv extension is available])
translit(dnm, m, l) AM_CONDITIONAL(USE_XVIDEO, true)
GST_CHECK_FEATURE(XVIDEO, [X11 XVideo extensions], xvideosink-Xv, [
if test x$HAVE_XFREE = xyes; then
AC_CHECK_LIB(Xv_pic, XvQueryExtension,
HAVE_XVIDEO="yes", HAVE_XVIDEO="no",
$X_LIBS $X_PRE_LIBS -lXext -lX11 $X_EXTRA_LIBS)
XVIDEO_LIBS="-lXv_pic -lXext"
AC_SUBST(XVIDEO_LIBS)
else
AC_CHECK_LIB(Xv, XvQueryExtension, HAVE_XVIDEO="yes", HAVE_XVIDEO="no", $X_LIBS $X_PRE_LIBS -lXext -lX11 $X_EXTRA_LIBS)
if test x$HAVE_XV = xyes; then
AC_DEFINE(HAVE_XV, 1, [Define if Xv extension is available])
dnl try again using something else if we didn't find it first
if test x$HAVE_XVIDEO = xno; then
AC_CHECK_LIB(Xv, XvQueryExtension,
HAVE_XVIDEO="yes", HAVE_XVIDEO="no",
$X_LIBS $X_PRE_LIBS -lXext -lX11 $X_EXTRA_LIBS)
XVIDEO_LIBS="-lXv -lXext"
fi
AC_SUBST(XVIDEO_LIBS)
fi
fi
fi
])
dnl Next, check for the optional libraries:
dnl These are all libraries used in building plug-ins

View file

@ -86,12 +86,7 @@ GST_PAD_TEMPLATE_FACTORY (sink_factory,
GST_PAD_ALWAYS,
GST_CAPS_NEW (
"a52dec_sink",
"audio/a52",
NULL
),
GST_CAPS_NEW (
"ac3dec_sink",
"audio/ac3",
"audio/x-ac3",
NULL
)
);
@ -102,9 +97,7 @@ GST_PAD_TEMPLATE_FACTORY (src_factory,
GST_PAD_ALWAYS,
GST_CAPS_NEW (
"a52dec_src",
"audio/raw",
"format", GST_PROPS_STRING ("int"),
"law", GST_PROPS_INT (0),
"audio/x-raw-int",
"endianness", GST_PROPS_INT (G_BYTE_ORDER),
"signed", GST_PROPS_BOOLEAN (TRUE),
"width", GST_PROPS_INT (16),
@ -372,9 +365,7 @@ gst_a52dec_reneg (GstPad * pad, int channels, int rate)
if (gst_pad_try_set_caps (pad,
GST_CAPS_NEW ("a52dec_src_caps",
"audio/raw",
"format", GST_PROPS_STRING ("int"),
"law", GST_PROPS_INT (0),
"audio/x-raw-int",
"endianness", GST_PROPS_INT (G_BYTE_ORDER),
"signed", GST_PROPS_BOOLEAN (TRUE),
"width", GST_PROPS_INT (16),

View file

@ -41,9 +41,7 @@ GST_PAD_TEMPLATE_FACTORY (gst_lame_sink_factory,
GST_PAD_ALWAYS,
GST_CAPS_NEW (
"gstlame_sink",
"audio/raw",
"format", GST_PROPS_STRING ("int"),
"law", GST_PROPS_INT (0),
"audio/x-raw-int",
"endianness", GST_PROPS_INT (G_BYTE_ORDER),
"signed", GST_PROPS_BOOLEAN (TRUE),
"width", GST_PROPS_INT (16),
@ -69,8 +67,20 @@ GST_PAD_TEMPLATE_FACTORY (gst_lame_src_factory,
GST_PAD_ALWAYS,
GST_CAPS_NEW (
"gstlame_src",
"audio/x-mp3",
NULL
"audio/mpeg",
"layer", GST_PROPS_INT (3),
"rate", GST_PROPS_LIST (
GST_PROPS_INT (8000),
GST_PROPS_INT (11025),
GST_PROPS_INT (12000),
GST_PROPS_INT (16000),
GST_PROPS_INT (22050),
GST_PROPS_INT (24000),
GST_PROPS_INT (32000),
GST_PROPS_INT (44100),
GST_PROPS_INT (48000)
),
"channels", GST_PROPS_INT_RANGE (1, 2)
)
)
@ -358,7 +368,13 @@ gst_lame_sinkconnect (GstPad *pad, GstCaps *caps)
return GST_PAD_LINK_REFUSED;
}
return GST_PAD_LINK_OK;
caps = GST_CAPS_NEW ("lame_src_caps",
"audio/mpeg",
"layer", GST_PROPS_INT (3),
"channels", GST_PROPS_INT (lame->num_channels),
"rate", GST_PROPS_INT (lame->samplerate));
return gst_pad_try_set_caps (lame->srcpad, caps);
}
static void
@ -446,7 +462,7 @@ gst_lame_add_metadata (GstLame *lame, GstCaps *caps)
prop = (GstPropsEntry*)(props->data);
props = g_list_next(props);
if (gst_props_entry_get_type (prop) == GST_PROPS_STRING_TYPE) {
if (gst_props_entry_get_props_type (prop) == GST_PROPS_STRING_TYPE) {
const gchar *name = gst_props_entry_get_name (prop);
const gchar *value;

View file

@ -120,9 +120,7 @@ GST_PAD_TEMPLATE_FACTORY (mad_src_template_factory,
GST_PAD_ALWAYS,
GST_CAPS_NEW (
"mad_src",
"audio/raw",
"format", GST_PROPS_STRING ("int"),
"law", GST_PROPS_INT (0),
"audio/x-raw-int",
"endianness", GST_PROPS_INT (G_BYTE_ORDER),
"signed", GST_PROPS_BOOLEAN (TRUE),
"width", GST_PROPS_INT (16),
@ -138,8 +136,9 @@ GST_PAD_TEMPLATE_FACTORY (mad_sink_template_factory,
GST_PAD_ALWAYS,
GST_CAPS_NEW (
"mad_sink",
"audio/x-mp3",
NULL
"audio/mpeg",
/* we don't need channel/rate ... */
"layer", GST_PROPS_INT_RANGE (1, 3)
)
)
@ -1236,10 +1235,8 @@ gst_mad_chain (GstPad *pad, GstBuffer *buffer)
if (gst_pad_try_set_caps (mad->srcpad,
gst_caps_new (
"mad_src",
"audio/raw",
"audio/x-raw-int",
gst_props_new (
"format", GST_PROPS_STRING ("int"),
"law", GST_PROPS_INT (0),
"endianness", GST_PROPS_INT (G_BYTE_ORDER),
"signed", GST_PROPS_BOOLEAN (TRUE),
"width", GST_PROPS_INT (16),

View file

@ -55,21 +55,16 @@ GST_PAD_TEMPLATE_FACTORY (src_template_factory,
GST_PAD_ALWAYS,
GST_CAPS_NEW (
"mpeg2dec_src",
"video/raw",
"format", GST_PROPS_FOURCC (GST_MAKE_FOURCC ('Y','V','1','2')),
"width", GST_PROPS_INT_RANGE (16, 4096),
"height", GST_PROPS_INT_RANGE (16, 4096),
"pixel_width", GST_PROPS_INT_RANGE (1, 255),
"pixel_height", GST_PROPS_INT_RANGE (1, 255)
"video/x-raw-yuv",
"format", GST_PROPS_LIST (
GST_PROPS_FOURCC (GST_MAKE_FOURCC ('Y','V','1','2')),
GST_PROPS_FOURCC (GST_MAKE_FOURCC ('I','4','2','0'))
),
GST_CAPS_NEW (
"mpeg2dec_src",
"video/raw",
"format", GST_PROPS_FOURCC (GST_MAKE_FOURCC ('I','4','2','0')),
"width", GST_PROPS_INT_RANGE (16, 4096),
"height", GST_PROPS_INT_RANGE (16, 4096),
"pixel_width", GST_PROPS_INT_RANGE (1, 255),
"pixel_height", GST_PROPS_INT_RANGE (1, 255)
"pixel_height", GST_PROPS_INT_RANGE (1, 255),
"framerate", GST_PROPS_FLOAT_RANGE (0, G_MAXFLOAT)
)
);
@ -91,6 +86,7 @@ GST_PAD_TEMPLATE_FACTORY (sink_template_factory,
GST_CAPS_NEW (
"mpeg2dec_sink",
"video/mpeg",
/* width/height/framerate not needed */
"mpegversion", GST_PROPS_INT_RANGE (1, 2),
"systemstream", GST_PROPS_BOOLEAN (FALSE)
)
@ -316,18 +312,19 @@ gst_mpeg2dec_negotiate_format (GstMpeg2dec *mpeg2dec)
if (!allowed) {
allowed = GST_CAPS_NEW (
"mpeg2dec_negotiate",
"video/raw",
"video/x-raw-yuv",
"format", GST_PROPS_FOURCC (GST_STR_FOURCC ("I420"))
);
}
to_intersect = GST_CAPS_NEW (
"mpeg2dec_negotiate",
"video/raw",
"video/x-raw-yuv",
"width", GST_PROPS_INT (mpeg2dec->width),
"height", GST_PROPS_INT (mpeg2dec->height),
"pixel_width", GST_PROPS_INT (mpeg2dec->pixel_width),
"pixel_height", GST_PROPS_INT (mpeg2dec->pixel_height)
"pixel_height", GST_PROPS_INT (mpeg2dec->pixel_height),
"framerate", GST_PROPS_FLOAT (1. * GST_SECOND / mpeg2dec->frame_period)
);
/* try to fix our height */

View file

@ -38,7 +38,7 @@ static GstCaps* sid_typefind (GstBuffer *buf, gpointer priv);
/* typefactory for 'sid' */
static GstTypeDefinition siddefinition = {
"siddec_audio/sid",
"audio/sid",
"audio/x-sid",
".sid",
sid_typefind,
};
@ -72,7 +72,7 @@ GST_PAD_TEMPLATE_FACTORY (sink_templ,
GST_PAD_ALWAYS,
GST_CAPS_NEW (
"siddecoder_sink",
"audio/sid",
"audio/x-sid",
NULL
)
)
@ -83,9 +83,7 @@ GST_PAD_TEMPLATE_FACTORY (src_templ,
GST_PAD_ALWAYS,
GST_CAPS_NEW (
"src_audio",
"audio/raw",
"format", GST_PROPS_STRING ("int"),
"law", GST_PROPS_INT (0),
"audio/x-raw-int",
"endianness", GST_PROPS_INT (G_BYTE_ORDER),
"signed", GST_PROPS_LIST (
GST_PROPS_BOOLEAN (TRUE),
@ -196,7 +194,7 @@ sid_typefind (GstBuffer *buf, gpointer priv)
if (strncmp ((const char *)data, "PSID", 4))
return NULL;
newcaps = gst_caps_new ("sid_typefind","audio/sid", NULL);
newcaps = gst_caps_new ("sid_typefind","audio/x-sid", NULL);
return newcaps;
}
@ -371,9 +369,7 @@ siddec_negotiate (GstSidDec *siddec)
if (!gst_pad_try_set_caps (siddec->srcpad,
GST_CAPS_NEW (
"siddec_src",
"audio/raw",
"format", GST_PROPS_STRING ("int"),
"law", GST_PROPS_INT (0),
"audio/x-raw-int",
"endianness", GST_PROPS_INT (G_BYTE_ORDER),
"signed", GST_PROPS_BOOLEAN (sign),
"width", GST_PROPS_INT (siddec->config->bitsPerSample),

View file

@ -52,8 +52,6 @@
#define GST_AUDIO_INT_PAD_TEMPLATE_PROPS \
gst_props_new (\
"format", GST_PROPS_STRING ("int"),\
"law", GST_PROPS_INT (0),\
"endianness", GST_PROPS_INT (G_BYTE_ORDER),\
"signed", GST_PROPS_LIST (\
GST_PROPS_BOOLEAN (TRUE),\
@ -70,8 +68,6 @@
#define GST_AUDIO_INT_MONO_PAD_TEMPLATE_PROPS \
gst_props_new (\
"format", GST_PROPS_STRING ("int"),\
"law", GST_PROPS_INT (0),\
"endianness", GST_PROPS_INT (G_BYTE_ORDER),\
"signed", GST_PROPS_LIST (\
GST_PROPS_BOOLEAN (TRUE),\
@ -88,8 +84,8 @@
#define GST_AUDIO_FLOAT_MONO_PAD_TEMPLATE_PROPS \
gst_props_new (\
"format", GST_PROPS_STRING ("float"),\
"layout", GST_PROPS_STRING ("gfloat"),\
"depth", GST_PROPS_INT (32),\
"endianness", GST_PROPS_INT (G_BYTE_ORDER),\
"intercept", GST_PROPS_FLOAT (0.0),\
"slope", GST_PROPS_FLOAT (1.0),\
"rate", GST_PROPS_INT_RANGE (GST_AUDIO_MIN_RATE, \

View file

@ -20,31 +20,36 @@
#include "video.h"
#define NUM_UNITS 1000000000
/* This is simply a convenience function, nothing more or less */
gdouble
gfloat
gst_video_frame_rate (GstPad *pad)
{
GstFormat dest_format = GST_FORMAT_DEFAULT;
gint64 dest_value = 0;
gdouble fps;
gfloat fps = 0.;
GstCaps *caps;
/* do a convert request on the source pad */
if (!gst_pad_convert(pad,
GST_FORMAT_TIME, GST_SECOND * NUM_UNITS,
&dest_format, &dest_value))
{
g_warning("gstvideo: pad %s:%s failed to convert time to unit!\n",
GST_ELEMENT_NAME(gst_pad_get_parent (pad)), GST_PAD_NAME(pad));
/* get pad caps */
caps = GST_PAD_CAPS (pad);
if (caps == NULL) {
g_warning ("gstvideo: failed to get caps of pad %s:%s",
GST_ELEMENT_NAME (gst_pad_get_parent (pad)),
GST_PAD_NAME(pad));
return 0.;
}
fps = ((gdouble) dest_value) / NUM_UNITS;
if (!gst_caps_has_property_typed (caps, "framerate",
GST_PROPS_FLOAT_TYPE)) {
g_warning ("gstvideo: failed to get framerate property of pad %s:%s",
GST_ELEMENT_NAME (gst_pad_get_parent (pad)),
GST_PAD_NAME (pad));
return 0.;
}
GST_DEBUG ("Framerate request on pad %s:%s - %f fps",
GST_ELEMENT_NAME(gst_pad_get_parent (pad)), GST_PAD_NAME(pad), fps);
gst_caps_get_float (caps, "framerate", &fps);
GST_DEBUG ("Framerate request on pad %s:%s: %f",
GST_ELEMENT_NAME (gst_pad_get_parent (pad)),
GST_PAD_NAME(pad), fps);
return fps;
}
@ -56,28 +61,37 @@ gst_video_get_size (GstPad *pad,
{
GstCaps *caps;
g_return_val_if_fail(pad != NULL, FALSE);
g_return_val_if_fail (pad != NULL, FALSE);
caps = GST_PAD_CAPS(pad);
if (!caps) {
g_warning("gstvideo: failed to get caps of pad %s:%s",
GST_ELEMENT_NAME(gst_pad_get_parent (pad)), GST_PAD_NAME(pad));
caps = GST_PAD_CAPS (pad);
if (caps == NULL) {
g_warning ("gstvideo: failed to get caps of pad %s:%s",
GST_ELEMENT_NAME (gst_pad_get_parent (pad)),
GST_PAD_NAME(pad));
return FALSE;
}
if (!gst_caps_has_property(caps, "width") ||
!gst_caps_has_property(caps, "height")) {
g_warning("gstvideo: resulting caps doesn't have width/height properties");
if (!gst_caps_has_property_typed (caps, "width",
GST_PROPS_INT_TYPE) ||
!gst_caps_has_property_typed (caps, "height",
GST_PROPS_FLOAT_TYPE)) {
g_warning ("gstvideo: failed to get size properties on pad %s:%s",
GST_ELEMENT_NAME (gst_pad_get_parent (pad)),
GST_PAD_NAME(pad));
return FALSE;
}
if (width)
gst_caps_get_int(caps, "width", width);
gst_caps_get_int (caps, "width", width);
if (height)
gst_caps_get_int(caps, "height", height);
gst_caps_get_int (caps, "height", height);
GST_DEBUG ("size request on pad %s:%s: %dx%d",
GST_ELEMENT_NAME(gst_pad_get_parent (pad)), GST_PAD_NAME(pad),
width?*width:0, height?*height:0);
GST_ELEMENT_NAME (gst_pad_get_parent (pad)),
GST_PAD_NAME (pad),
width ? *width : -1,
height ? *height : -1);
return TRUE;
}

View file

@ -23,7 +23,155 @@
#include <gst/gst.h>
gdouble gst_video_frame_rate (GstPad *pad);
#if (G_BYTE_ORDER == G_BIG_ENDIAN)
#define R_MASK_32 0xff000000
#define G_MASK_32 0x00ff0000
#define B_MASK_32 0x0000ff00
#define R_MASK_24 0xff0000
#define G_MASK_24 0x00ff00
#define B_MASK_24 0x0000ff
#else
#define R_MASK_32 0x000000ff
#define G_MASK_32 0x0000ff00
#define B_MASK_32 0x00ff0000
#define R_MASK_24 0x0000ff
#define G_MASK_24 0x00ff00
#define B_MASK_24 0xff0000
#endif
#define R_MASK_16 0xf800
#define G_MASK_16 0x07e0
#define B_MASK_16 0x001f
#define R_MASK_15 0x8c00
#define G_MASK_15 0x03e0
#define B_MASK_15 0x001f
#define SIZE_RANGE GST_PROPS_INT_RANGE (16, 4096)
#define FPS_RANGE GST_PROPS_FLOAT_RANGE (0, G_MAXFLOAT)
/* properties for pad templates */
#define GST_VIDEO_RGB_PAD_TEMPLATE_PROPS_24_32 \
gst_props_new ( \
"bpp", GST_PROPS_LIST ( \
GST_PROPS_INT (24), \
GST_PROPS_INT (32) \
), \
"depth", GST_PROPS_LIST ( \
GST_PROPS_INT (24), \
GST_PROPS_INT (32) \
), \
"endianness", GST_PROPS_INT (G_BIG_ENDIAN), \
"red_mask", GST_PROPS_LIST ( \
GST_PROPS_INT (R_MASK_32), \
GST_PROPS_INT (R_MASK_24) \
), \
"green_mask", GST_PROPS_LIST ( \
GST_PROPS_INT (G_MASK_32), \
GST_PROPS_INT (G_MASK_24) \
), \
"blue_mask", GST_PROPS_LIST ( \
GST_PROPS_INT (B_MASK_32), \
GST_PROPS_INT (B_MASK_24) \
), \
"width", SIZE_RANGE, \
"height", SIZE_RANGE, \
"framerate", FPS_RANGE, \
NULL)
#define GST_VIDEO_RGB_PAD_TEMPLATE_PROPS_32 \
gst_props_new ( \
"bpp", GST_PROPS_INT (32), \
"depth", GST_PROPS_INT (32), \
"endianness", GST_PROPS_INT (G_BIG_ENDIAN), \
"red_mask", GST_PROPS_INT (R_MASK_32), \
"green_mask", GST_PROPS_INT (G_MASK_32), \
"blue_mask", GST_PROPS_INT (B_MASK_32), \
"width", SIZE_RANGE, \
"height", SIZE_RANGE, \
"framerate", FPS_RANGE, \
NULL)
#define GST_VIDEO_RGB_PAD_TEMPLATE_PROPS_24 \
gst_props_new ( \
"bpp", GST_PROPS_INT (24), \
"depth", GST_PROPS_INT (24), \
"endianness", GST_PROPS_INT (G_BIG_ENDIAN), \
"red_mask", GST_PROPS_INT (R_MASK_24), \
"green_mask", GST_PROPS_INT (G_MASK_24), \
"blue_mask", GST_PROPS_INT (B_MASK_24), \
"width", SIZE_RANGE, \
"height", SIZE_RANGE, \
"framerate", FPS_RANGE, \
NULL)
#define GST_VIDEO_RGB_PAD_TEMPLATE_PROPS_15_16 \
gst_props_new ( \
"bpp", GST_PROPS_INT (16), \
"depth", GST_PROPS_LIST ( \
GST_PROPS_INT (15), \
GST_PROPS_INT (16) \
), \
"endianness", GST_PROPS_INT (G_BYTE_ORDER), \
"red_mask", GST_PROPS_LIST ( \
GST_PROPS_INT (R_MASK_15), \
GST_PROPS_INT (R_MASK_16) \
), \
"green_mask", GST_PROPS_LIST ( \
GST_PROPS_INT (G_MASK_15), \
GST_PROPS_INT (G_MASK_16) \
), \
"blue_mask", GST_PROPS_LIST ( \
GST_PROPS_INT (B_MASK_15), \
GST_PROPS_INT (B_MASK_16) \
), \
"width", SIZE_RANGE, \
"height", SIZE_RANGE, \
"framerate", FPS_RANGE, \
NULL)
#define GST_VIDEO_RGB_PAD_TEMPLATE_PROPS_16 \
gst_props_new ( \
"bpp", GST_PROPS_INT (16), \
"depth", GST_PROPS_INT (16), \
"endianness", GST_PROPS_INT (G_BYTE_ORDER), \
"red_mask", GST_PROPS_INT (R_MASK_16), \
"green_mask", GST_PROPS_INT (G_MASK_16), \
"blue_mask", GST_PROPS_INT (B_MASK_16), \
"width", SIZE_RANGE, \
"height", SIZE_RANGE, \
"framerate", FPS_RANGE, \
NULL)
#define GST_VIDEO_RGB_PAD_TEMPLATE_PROPS_15 \
gst_props_new ( \
"bpp", GST_PROPS_INT (15), \
"depth", GST_PROPS_INT (15), \
"endianness", GST_PROPS_INT (G_BYTE_ORDER), \
"red_mask", GST_PROPS_INT (R_MASK_15), \
"green_mask", GST_PROPS_INT (G_MASK_15), \
"blue_mask", GST_PROPS_INT (B_MASK_15), \
"width", SIZE_RANGE, \
"height", SIZE_RANGE, \
"framerate", FPS_RANGE, \
NULL)
#define GST_VIDEO_YUV_PAD_TEMPLATE_PROPS(fourcc) \
gst_props_new (\
"format", fourcc, \
"width", SIZE_RANGE, \
"height", SIZE_RANGE, \
"framerate", FPS_RANGE, \
NULL)
/* functions */
gfloat gst_video_frame_rate (GstPad *pad);
gboolean gst_video_get_size (GstPad *pad,
gint *width,
gint *height);

View file

@ -95,49 +95,44 @@ enum {
/* FILL ME */
};
static GstPadTemplate*
src_factory (void)
{
return
gst_pad_template_new (
GST_PAD_TEMPLATE_FACTORY (src_factory,
"src",
GST_PAD_SRC,
GST_PAD_ALWAYS,
gst_caps_new (
"ac3parse_src",
GST_CAPS_NEW ("ac3parse_src",
"audio/ac3",
gst_props_new (
"framed", GST_PROPS_BOOLEAN (TRUE),
NULL)),
NULL);
}
"channels", GST_PROPS_INT_RANGE (1, 6),
"rate", GST_PROPS_INT_RANGE (32000, 48000)
)
);
static GstPadTemplate*
sink_factory (void)
{
return
gst_pad_template_new (
GST_PAD_TEMPLATE_FACTORY (sink_factory,
"sink",
GST_PAD_SINK,
GST_PAD_ALWAYS,
gst_caps_new (
"ac3parse_sink",
"audio/ac3",
gst_props_new (
"framed", GST_PROPS_BOOLEAN (FALSE),
NULL)),
NULL);
}
GST_CAPS_NEW ("ac3parse_sink",
"audio/x-ac3",
NULL
)
);
static void gst_ac3parse_class_init (GstAc3ParseClass *klass);
static void gst_ac3parse_init (GstAc3Parse *ac3parse);
static void gst_ac3parse_chain (GstPad *pad,GstBuffer *buf);
static void gst_ac3parse_chain (GstPad *pad,
GstBuffer *buf);
static void gst_ac3parse_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec);
static void gst_ac3parse_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec);
static void gst_ac3parse_set_property (GObject *object,
guint prop_id,
const GValue *value,
GParamSpec *pspec);
static void gst_ac3parse_get_property (GObject *object,
guint prop_id,
GValue *value,
GParamSpec *pspec);
static GstPadTemplate *src_template, *sink_template;
static GstElementStateReturn
gst_ac3parse_change_state (GstElement *element);
static GstElementClass *parent_class = NULL;
/*static guint gst_ac3parse_signals[LAST_SIGNAL] = { 0 };*/
@ -181,20 +176,25 @@ gst_ac3parse_class_init (GstAc3ParseClass *klass)
gobject_class->set_property = gst_ac3parse_set_property;
gobject_class->get_property = gst_ac3parse_get_property;
gstelement_class->change_state = gst_ac3parse_change_state;
}
static void
gst_ac3parse_init (GstAc3Parse *ac3parse)
{
ac3parse->sinkpad = gst_pad_new_from_template (sink_template, "sink");
ac3parse->sinkpad = gst_pad_new_from_template (
GST_PAD_TEMPLATE_GET(sink_factory), "sink");
gst_element_add_pad (GST_ELEMENT (ac3parse), ac3parse->sinkpad);
gst_pad_set_chain_function (ac3parse->sinkpad, gst_ac3parse_chain);
ac3parse->srcpad = gst_pad_new_from_template (src_template, "src");
ac3parse->srcpad = gst_pad_new_from_template (
GST_PAD_TEMPLATE_GET(src_factory), "src");
gst_element_add_pad (GST_ELEMENT (ac3parse), ac3parse->srcpad);
ac3parse->partialbuf = NULL;
ac3parse->skip = 0;
ac3parse->sample_rate = ac3parse->channels = -1;
}
static void
@ -203,9 +203,11 @@ gst_ac3parse_chain (GstPad *pad, GstBuffer *buf)
GstAc3Parse *ac3parse;
guchar *data;
glong size,offset = 0;
unsigned short header;
guint16 header;
guint8 channeldata, acmod, mask;
GstBuffer *outbuf = NULL;
gint bpf;
guint sample_rate = -1, channels = -1;
g_return_if_fail(pad != NULL);
g_return_if_fail(GST_IS_PAD(pad));
@ -229,14 +231,20 @@ gst_ac3parse_chain (GstPad *pad, GstBuffer *buf)
data = GST_BUFFER_DATA(ac3parse->partialbuf);
size = GST_BUFFER_SIZE(ac3parse->partialbuf);
/* while we still have bytes left -2 for the header */
while (offset < size-2) {
/* we're searching for at least 7 bytes. first the
* syncinfo, where 2 bytes are for the syncword
* (header ID, 0x0b77), 2 bytes crc1 (checksum) and 1 byte
* fscod+fmrsizecod (framerate/bitrate) and then the
* bitstreaminfo bsid (version), bsmod (data type) and
* acmod (channel info, 3 bits). Then some "maybe"
* bits, and then the LFE indicator (subwoofer bit) */
while (offset < size-6) {
int skipped = 0;
GST_DEBUG ("ac3parse: offset %ld, size %ld ",offset, size);
/* search for a possible start byte */
for (;((data[offset] != 0x0b) && (offset < size));offset++) skipped++ ;
for (;((data[offset] != 0x0b) && (offset < size-6));offset++) skipped++ ;
if (skipped) {
fprintf(stderr, "ac3parse: **** now at %ld skipped %d bytes (FIXME?)\n",offset,skipped);
}
@ -249,15 +257,91 @@ gst_ac3parse_chain (GstPad *pad, GstBuffer *buf)
/* g_print("AC3PARSE: found sync at %d\n",offset); */
/* get the bits we're interested in */
rate = (data[offset+4] >> 6) & 0x3;
switch (rate) {
case 0x0: /* 00b */
sample_rate = 48000;
break;
case 0x1: /* 01b */
sample_rate = 44100;
break;
case 0x2: /* 10b */
sample_rate = 32000;
break;
case 0x3: /* 11b */
default:
/* reserved. if this happens, we're screwed */
g_assert (0);
break;
}
fsize = data[offset+4] & 0x3f;
/* calculate the bpf of the frame */
bpf = frmsizecod_tbl[fsize].frm_size[rate] * 2;
/* calculate number of channels */
channeldata = data[offset+6]; /* skip bsid/bsmod */
acmod = (channeldata >> 5) & 0x7;
switch (acmod) {
case 0x1: /* 001b = 1 channel */
channels = 1;
break;
case 0x0: /* 000b = 2 independent channels*/
case 0x2: /* 010b = 2x front (stereo) */
channels = 2;
break;
case 0x3: /* 011b = 3 front */
case 0x4: /* 100b = 2 front, 1 rear */
channels = 3;
break;
case 0x5: /* 101b = 3 front, 1 rear */
case 0x6: /* 110b = 2 front, 2 rear */
channels = 4;
break;
case 0x7: /* 111b = 3 front, 2 rear */
channels = 5;
break;
default:
/* whaaaaaaaaaaaaaa!!!!!!!!!!! */
g_assert (0);
}
/* fetch LFE bit (subwoofer) */
mask = 0x10;
if (acmod & 0x1 && acmod != 0x1) /* 3 front speakers? */
mask >>= 2;
if (acmod & 0x4) /* surround channel? */
mask >>= 2;
if (acmod == 0x2) /* 2/0 mode? */
mask >>= 2;
if (channeldata & mask) /* LFE: do we have a subwoofer channel? */
channels++;
/* if we don't have the whole frame... */
if ((size - offset) < bpf) {
GST_DEBUG ("ac3parse: partial buffer needed %ld < %d ",size-offset, bpf);
break;
} else {
outbuf = gst_buffer_create_sub(ac3parse->partialbuf,offset,bpf);
gboolean need_capsnego = FALSE;
outbuf = gst_buffer_create_sub (ac3parse->partialbuf,offset,bpf);
/* make sure our properties still match */
if (channels > 0 && ac3parse->channels != channels) {
ac3parse->channels = channels;
need_capsnego = TRUE;
}
if (sample_rate > 0 && ac3parse->sample_rate != sample_rate) {
ac3parse->sample_rate = sample_rate;
need_capsnego = TRUE;
}
if (need_capsnego) {
GstCaps *newcaps;
newcaps = GST_CAPS_NEW ("ac3parse_src",
"audio/x-ac3",
"channels", GST_PROPS_INT (channels),
"rate", GST_PROPS_INT (sample_rate));
if (gst_pad_try_set_caps (ac3parse->srcpad, newcaps) <= 0) {
gst_element_error (GST_ELEMENT (ac3parse),
"Ac3parse: failed to negotiate format with next element");
return;
}
}
offset += bpf;
if (ac3parse->skip == 0 && GST_PAD_IS_LINKED(ac3parse->srcpad)) {
@ -323,6 +407,24 @@ gst_ac3parse_get_property (GObject *object, guint prop_id, GValue *value, GParam
}
}
static GstElementStateReturn
gst_ac3parse_change_state (GstElement *element)
{
GstAc3Parse *ac3parse = GST_AC3PARSE(element);
switch (GST_STATE_TRANSITION (element)) {
case GST_STATE_PAUSED_TO_READY:
/* reset stream info */
ac3parse->channels = ac3parse->sample_rate = -1;
break;
}
if (GST_ELEMENT_CLASS (parent_class)->change_state)
return GST_ELEMENT_CLASS (parent_class)->change_state (element);
return GST_STATE_SUCCESS;
}
static gboolean
plugin_init (GModule *module, GstPlugin *plugin)
{
@ -334,11 +436,10 @@ plugin_init (GModule *module, GstPlugin *plugin)
g_return_val_if_fail(factory != NULL, FALSE);
gst_element_factory_set_rank (factory, GST_ELEMENT_RANK_SECONDARY);
src_template = src_factory ();
gst_element_factory_add_pad_template (factory, src_template);
sink_template = sink_factory ();
gst_element_factory_add_pad_template (factory, sink_template);
gst_element_factory_add_pad_template (factory,
GST_PAD_TEMPLATE_GET(src_factory));
gst_element_factory_add_pad_template (factory,
GST_PAD_TEMPLATE_GET(sink_factory));
gst_plugin_add_feature (plugin, GST_PLUGIN_FEATURE (factory));

View file

@ -54,6 +54,10 @@ struct _GstAc3Parse {
guint lastframebytes; /* bytes in previous of last frame so far */
guint lastframesize; /* total length of last frame */
guint skip; /* number of frames to skip */
/* some stream parameters */
gint sample_rate;
gint channels;
};
struct _GstAc3ParseClass {

View file

@ -160,107 +160,9 @@ GST_PAD_TEMPLATE_FACTORY (sink_factory,
GST_PAD_SINK,
GST_PAD_ALWAYS,
GST_CAPS_NEW ("asf_asf_demux_sink",
"video/x-ms-asf",
"asfversion", GST_PROPS_INT_RANGE (1, 1)
),
GST_CAPS_NEW ("asf_wma_demux_sink",
"video/x-ms-wma",
"asfversion", GST_PROPS_INT_RANGE (1, 1)
),
GST_CAPS_NEW ("asf_wax_demux_sink",
"video/x-ms-wax",
"asfversion", GST_PROPS_INT_RANGE (1, 1)
),
GST_CAPS_NEW ("asf_wmv_demux_sink",
"video/x-ms-wmv",
"asfversion", GST_PROPS_INT_RANGE (1, 1)
),
GST_CAPS_NEW ("asf_wvx_demux_sink",
"video/x-ms-wvx",
"asfversion", GST_PROPS_INT_RANGE (1, 1)
),
GST_CAPS_NEW ("asf_wm_demux_sink",
"video/x-ms-wm",
"asfversion", GST_PROPS_INT_RANGE (1, 1)
)
);
GST_PAD_TEMPLATE_FACTORY (audio_factory,
"audio_%02d",
GST_PAD_SRC,
GST_PAD_SOMETIMES,
GST_CAPS_NEW ("asf_demux_audio",
"video/avi",
"format", GST_PROPS_STRING ("strf_auds")
),
GST_CAPS_NEW (
"asfdemux_src_audio",
"audio/raw",
"format", GST_PROPS_STRING ("int"),
"law", GST_PROPS_INT (0),
"endianness", GST_PROPS_INT (G_BYTE_ORDER),
"signed", GST_PROPS_LIST (
GST_PROPS_BOOLEAN (TRUE),
GST_PROPS_BOOLEAN (FALSE)
),
"width", GST_PROPS_LIST (
GST_PROPS_INT (8),
GST_PROPS_INT (16)
),
"depth", GST_PROPS_LIST (
GST_PROPS_INT (8),
GST_PROPS_INT (16)
),
"rate", GST_PROPS_INT_RANGE (11025, 44100),
"channels", GST_PROPS_INT_RANGE (1, 2)
),
GST_CAPS_NEW (
"asfdemux_src_audio",
"audio/x-mp3",
NULL
),
GST_CAPS_NEW (
"asfdemux_src_audio",
"audio/a52",
NULL
),
GST_CAPS_NEW (
"asfdemux_src_audio",
"application/x-ogg",
NULL
)
);
GST_PAD_TEMPLATE_FACTORY (video_factory,
"video_%02d",
GST_PAD_SRC,
GST_PAD_SOMETIMES,
GST_CAPS_NEW ("asf_demux_src_video",
"video/avi",
"format", GST_PROPS_LIST (
GST_PROPS_STRING ("strf_vids")
),
"width", GST_PROPS_INT_RANGE (16, 4096),
"height", GST_PROPS_INT_RANGE (16, 4096),
NULL
),
GST_CAPS_NEW (
"asf_demux_src_video",
"video/raw",
"format", GST_PROPS_LIST (
GST_PROPS_FOURCC (GST_MAKE_FOURCC('Y','U','Y','2')),
GST_PROPS_FOURCC (GST_MAKE_FOURCC('I','4','2','0'))
),
"width", GST_PROPS_INT_RANGE (16, 4096),
"height", GST_PROPS_INT_RANGE (16, 4096)
),
GST_CAPS_NEW (
"asf_demux_src_video",
"video/jpeg",
"width", GST_PROPS_INT_RANGE (16, 4096),
"height", GST_PROPS_INT_RANGE (16, 4096)
)
);
"video/x-asf",
NULL)
);
static void gst_asf_demux_class_init (GstASFDemuxClass *klass);
static void gst_asf_demux_init (GstASFDemux *asf_demux);
@ -301,6 +203,7 @@ static gboolean gst_asf_demux_setup_pad (GstASFDemux *asf_demu
static GstElementStateReturn gst_asf_demux_change_state (GstElement *element);
static GstPadTemplate *videosrctempl, *audiosrctempl;
static GstElementClass *parent_class = NULL;
GType
@ -1377,93 +1280,148 @@ gst_asf_demux_identify_guid (GstASFDemux *asf_demux,
* Stream and pad setup code
*/
#define GST_ASF_AUD_CAPS_NEW(name, mimetype, props...) \
(audio != NULL) ? \
GST_CAPS_NEW (name, \
mimetype, \
"rate", GST_PROPS_INT ( \
GUINT32_FROM_LE (audio->byte_rate)), \
"channels", GST_PROPS_INT ( \
GUINT16_FROM_LE (audio->channels)), \
##props) \
: \
GST_CAPS_NEW (name, \
mimetype, \
"rate", GST_PROPS_INT_RANGE (8000, 96000), \
"channels", GST_PROPS_INT_RANGE (1, 2), \
##props)
static GstCaps *
gst_asf_demux_audio_caps (guint16 codec_id,
asf_stream_audio *audio)
{
GstCaps *caps = NULL;
switch (codec_id) {
case GST_RIFF_WAVE_FORMAT_MPEGL3: /* mp3 */
caps = GST_ASF_AUD_CAPS_NEW ("asf_demux_audio_src_mp3",
"audio/mpeg",
"layer", GST_PROPS_INT (3));
break;
case GST_RIFF_WAVE_FORMAT_MPEGL12: /* mp1 or mp2 */
caps = GST_ASF_AUD_CAPS_NEW ("asf_demux_audio_src_mp12",
"audio/mpeg",
"layer", GST_PROPS_INT (2));
break;
case GST_RIFF_WAVE_FORMAT_PCM: /* PCM/wav */ {
GstPropsEntry *width, *depth, *signedness;
if (audio != NULL) {
gint ba = GUINT16_FROM_LE (audio->block_align);
gint ch = GUINT16_FROM_LE (audio->channels);
gint ws = GUINT16_FROM_LE (audio->word_size);
width = gst_props_entry_new ("width",
GST_PROPS_INT (ba * 8 / ch));
depth = gst_props_entry_new ("depth",
GST_PROPS_INT (ws));
signedness = gst_props_entry_new ("signedness",
GST_PROPS_BOOLEAN (ws != 8));
} else {
signedness = gst_props_entry_new ("signed",
GST_PROPS_LIST (
GST_PROPS_BOOLEAN (TRUE),
GST_PROPS_BOOLEAN (FALSE)));
width = gst_props_entry_new ("width",
GST_PROPS_LIST (
GST_PROPS_INT (8),
GST_PROPS_INT (16)));
depth = gst_props_entry_new ("depth",
GST_PROPS_LIST (
GST_PROPS_INT (8),
GST_PROPS_INT (16)));
}
caps = GST_ASF_AUD_CAPS_NEW ("asf_demux_audio_src_pcm",
"audio/x-raw-int",
"endianness",
GST_PROPS_INT (G_LITTLE_ENDIAN));
gst_props_add_entry (caps->properties, width);
gst_props_add_entry (caps->properties, depth);
gst_props_add_entry (caps->properties, signedness);
}
break;
case GST_RIFF_WAVE_FORMAT_VORBIS1: /* vorbis mode 1 */
case GST_RIFF_WAVE_FORMAT_VORBIS2: /* vorbis mode 2 */
case GST_RIFF_WAVE_FORMAT_VORBIS3: /* vorbis mode 3 */
case GST_RIFF_WAVE_FORMAT_VORBIS1PLUS: /* vorbis mode 1+ */
case GST_RIFF_WAVE_FORMAT_VORBIS2PLUS: /* vorbis mode 2+ */
case GST_RIFF_WAVE_FORMAT_VORBIS3PLUS: /* vorbis mode 3+ */
caps = GST_ASF_AUD_CAPS_NEW ("asf_demux_audio_src_vorbis",
"audio/x-vorbis",
NULL);
break;
case GST_RIFF_WAVE_FORMAT_A52:
caps = GST_ASF_AUD_CAPS_NEW ("asf_demux_audio_src_ac3",
"audio/x-ac3",
NULL);
break;
case GST_RIFF_WAVE_FORMAT_DIVX_WMAV1:
caps = GST_ASF_AUD_CAPS_NEW ("asf_demux_audio_src_wmav1",
"audio/x-wma",
"wmaversion", GST_PROPS_INT (1));
break;
case GST_RIFF_WAVE_FORMAT_DIVX_WMAV2:
caps = GST_ASF_AUD_CAPS_NEW ("asf_demux_audio_src_wmav2",
"audio/x-wma",
"wmaversion", GST_PROPS_INT (2));
break;
case GST_RIFF_WAVE_FORMAT_WMAV9:
caps = GST_ASF_AUD_CAPS_NEW ("asf_demux_audio_src_wmav9",
"audio/x-wma",
"wmaversion", GST_PROPS_INT (9));
break;
default:
g_warning ("asfdemux: unkown audio format 0x%04x",
codec_id);
break;
}
return caps;
}
static gboolean
gst_asf_demux_add_audio_stream (GstASFDemux *asf_demux,
asf_stream_audio *audio,
guint16 id)
{
GstPad *src_pad;
GstCaps *new_caps = NULL;
GstCaps *caps_list = NULL;
GstCaps *caps;
gchar *name = NULL;
GstPadTemplate *new_template = NULL;
guint16 size_left = 0;
size_left = GUINT16_FROM_LE(audio->size);
/* Create the audio pad */
name = g_strdup_printf ("audio_%02d", asf_demux->num_audio_streams);
new_template = GST_PAD_TEMPLATE_GET (audio_factory);
src_pad = gst_pad_new_from_template (
GST_PAD_TEMPLATE_GET (audio_factory), name);
src_pad = gst_pad_new_from_template (audiosrctempl, name);
g_free (name);
/* Now set up the standard propertis from the header info */
caps_list = gst_caps_append(NULL, GST_CAPS_NEW (
"asf_demux_audio_src",
"video/avi",
"format", GST_PROPS_STRING ("strf_auds"),
"fmt", GST_PROPS_INT (GUINT16_FROM_LE (audio->codec_tag)),
"channels", GST_PROPS_INT (GUINT16_FROM_LE (audio->channels)),
"rate", GST_PROPS_INT (GUINT32_FROM_LE (audio->sample_rate)),
"av_bps", GST_PROPS_INT (GUINT32_FROM_LE (audio->byte_rate)),
"blockalign", GST_PROPS_INT (GUINT16_FROM_LE (audio->block_align)),
"size", GST_PROPS_INT (GUINT16_FROM_LE (audio->word_size))
));
caps = gst_asf_demux_audio_caps (GUINT16_FROM_LE(audio->codec_tag),
audio);
/* Now try some gstreamer formatted MIME types (from gst_avi_demux_strf_auds) */
switch (GUINT16_FROM_LE(audio->codec_tag)) {
case GST_RIFF_WAVE_FORMAT_MPEGL3:
case GST_RIFF_WAVE_FORMAT_MPEGL12: /* mp3 */
new_caps = gst_caps_new ("asf_demux_audio_src",
"audio/x-mp3",
NULL);
break;
case GST_RIFF_WAVE_FORMAT_PCM: /* PCM/wav */
new_caps = gst_caps_new ("asf_demux_audio_src",
"audio/raw",
gst_props_new (
"format", GST_PROPS_STRING ("int"),
"law", GST_PROPS_INT (0),
"endianness", GST_PROPS_INT (G_BYTE_ORDER),
"signed", GST_PROPS_BOOLEAN ((GUINT16_FROM_LE (audio->word_size) != 8)),
"width", GST_PROPS_INT ((GUINT16_FROM_LE (audio->block_align)*8) /
GUINT16_FROM_LE (audio->channels)),
"depth", GST_PROPS_INT (GUINT16_FROM_LE (audio->word_size)),
"rate", GST_PROPS_INT (GUINT32_FROM_LE (audio->byte_rate)),
"channels", GST_PROPS_INT (GUINT16_FROM_LE (audio->channels)),
NULL
));
break;
case GST_RIFF_WAVE_FORMAT_VORBIS1: /* ogg/vorbis mode 1 */
case GST_RIFF_WAVE_FORMAT_VORBIS2: /* ogg/vorbis mode 2 */
case GST_RIFF_WAVE_FORMAT_VORBIS3: /* ogg/vorbis mode 3 */
case GST_RIFF_WAVE_FORMAT_VORBIS1PLUS: /* ogg/vorbis mode 1+ */
case GST_RIFF_WAVE_FORMAT_VORBIS2PLUS: /* ogg/vorbis mode 2+ */
case GST_RIFF_WAVE_FORMAT_VORBIS3PLUS: /* ogg/vorbis mode 3+ */
new_caps = gst_caps_new ("asf_demux_audio_src",
"application/x-ogg",
NULL);
break;
case GST_RIFF_WAVE_FORMAT_A52:
new_caps = gst_caps_new ("asf_demux_audio_src",
"audio/a52",
NULL);
break;
case GST_RIFF_WAVE_FORMAT_DIVX_WMAV1:
case GST_RIFF_WAVE_FORMAT_DIVX_WMAV2:
case GST_RIFF_WAVE_FORMAT_WMAV9:
new_caps = gst_caps_new ("asf_demux_audio_src",
"unknown/unknown",
NULL);
break;
default:
g_warning ("asfdemux: unkown audio format %d", GUINT16_FROM_LE(audio->codec_tag));
break;
}
if (new_caps) caps_list = gst_caps_append(caps_list, new_caps);
GST_INFO ( "Adding audio stream %u codec %u (0x%x)", asf_demux->num_video_streams, GUINT16_FROM_LE(audio->codec_tag), GUINT16_FROM_LE(audio->codec_tag));
GST_INFO ("Adding audio stream %u codec %u (0x%x)",
asf_demux->num_video_streams,
GUINT16_FROM_LE(audio->codec_tag),
GUINT16_FROM_LE(audio->codec_tag));
asf_demux->num_audio_streams++;
@ -1473,82 +1431,125 @@ gst_asf_demux_add_audio_stream (GstASFDemux *asf_demux,
gst_bytestream_flush (asf_demux->bs, size_left);
}
return gst_asf_demux_setup_pad (asf_demux, src_pad, caps_list, id);
return gst_asf_demux_setup_pad (asf_demux, src_pad, caps, id);
}
#define GST_ASF_VID_CAPS_NEW(name, mimetype, props...) \
(video != NULL) ? \
GST_CAPS_NEW (name, \
mimetype, \
"width", GST_PROPS_INT (width), \
"height", GST_PROPS_INT (height), \
"framerate", GST_PROPS_FLOAT (0),/* FIXME */ \
##props) \
: \
GST_CAPS_NEW (name, \
mimetype, \
"width", GST_PROPS_INT_RANGE (16, 4096), \
"height", GST_PROPS_INT_RANGE (16, 4096), \
"framerate", GST_PROPS_FLOAT_RANGE (0, G_MAXFLOAT), \
##props)
static GstCaps *
gst_asf_demux_video_caps (guint32 codec_fcc,
asf_stream_video_format *video)
{
GstCaps *caps = NULL;
gint width = 0, height = 0;
if (video != NULL) {
width = GUINT32_FROM_LE (video->width);
height = GUINT32_FROM_LE (video->height);
}
switch (codec_fcc) {
case GST_MAKE_FOURCC('I','4','2','0'):
case GST_MAKE_FOURCC('Y','U','Y','2'):
caps = GST_ASF_VID_CAPS_NEW ("asf_demux_video_src_raw",
"video/x-raw-yuv",
"format", GST_PROPS_FOURCC (codec_fcc));
break;
case GST_MAKE_FOURCC('M','J','P','G'):
case GST_MAKE_FOURCC('J','P','E','G'):
case GST_MAKE_FOURCC('P','I','X','L'):
case GST_MAKE_FOURCC('V','I','X','L'):
caps = GST_ASF_VID_CAPS_NEW ("asf_demux_video_src_jpeg",
"video/x-jpeg",
NULL);
break;
case GST_MAKE_FOURCC('D','V','S','D'):
case GST_MAKE_FOURCC('d','v','s','d'):
caps = GST_ASF_VID_CAPS_NEW ("asf_demux_video_src_dv",
"video/x-dv",
"systemstream", GST_PROPS_BOOLEAN (FALSE));
break;
case GST_MAKE_FOURCC('W','M','V','1'):
caps = GST_ASF_VID_CAPS_NEW ("asf_demux_video_src_wmv1",
"video/x-wmv",
"wmvversion", GST_PROPS_INT (1));
break;
case GST_MAKE_FOURCC('W','M','V','2'):
caps = GST_ASF_VID_CAPS_NEW ("asf_demux_video_src_wmv2",
"video/x-wmv",
"wmvversion", GST_PROPS_INT (2));
break;
case GST_MAKE_FOURCC('M','P','G','4'):
caps = GST_ASF_VID_CAPS_NEW ("asf_demux_video_src_msmpeg41",
"video/x-msmpeg",
"msmpegversion", GST_PROPS_INT (41));
break;
case GST_MAKE_FOURCC('M','P','4','2'):
caps = GST_ASF_VID_CAPS_NEW ("asf_demux_video_src_msmpeg42",
"video/x-msmpeg",
"msmpegversion", GST_PROPS_INT (42));
break;
case GST_MAKE_FOURCC('M','P','4','3'):
caps = GST_ASF_VID_CAPS_NEW ("asf_demux_video_src_msmpeg43",
"video/x-msmpeg",
"msmpegversion", GST_PROPS_INT (43));
break;
default:
g_warning ("asfdemux: unkown video format " GST_FOURCC_FORMAT "(0x%08x)",
GST_FOURCC_ARGS(codec_fcc), codec_fcc);
break;
}
return caps;
}
static gboolean
gst_asf_demux_add_video_stream (GstASFDemux *asf_demux,
asf_stream_video_format *video_format,
asf_stream_video_format *video,
guint16 id) {
GstPad *src_pad;
GstCaps *new_caps = NULL;
GstCaps *caps_list = NULL;
GstCaps *caps;
gchar *name = NULL;
GstPadTemplate *new_template = NULL;
/* Create the audio pad */
name = g_strdup_printf ("video_%02d", asf_demux->num_video_streams);
new_template = GST_PAD_TEMPLATE_GET (video_factory);
src_pad = gst_pad_new_from_template (
GST_PAD_TEMPLATE_GET (video_factory), name);
caps_list = gst_caps_append(NULL, GST_CAPS_NEW (
"asf_demux_video_src",
"video/avi",
"format", GST_PROPS_STRING ("strf_vids"),
"size", GST_PROPS_INT (GUINT32_FROM_LE (video_format->size)),
"width",GST_PROPS_INT (GUINT32_FROM_LE (video_format->width)),
"height", GST_PROPS_INT (GUINT32_FROM_LE (video_format->height)),
"planes", GST_PROPS_INT (GUINT16_FROM_LE (video_format->planes)),
"bit_cnt", GST_PROPS_INT (GUINT16_FROM_LE (video_format->depth)),
"compression", GST_PROPS_FOURCC (GUINT32_FROM_LE (video_format->tag)),
"image_size", GST_PROPS_INT (GUINT32_FROM_LE (video_format->image_size)),
"xpels_meter", GST_PROPS_INT (GUINT32_FROM_LE (video_format->xpels_meter)),
"ypels_meter", GST_PROPS_INT (GUINT32_FROM_LE (video_format->ypels_meter)),
"num_colors", GST_PROPS_INT (GUINT32_FROM_LE (video_format->num_colors)),
"imp_colors", GST_PROPS_INT (GUINT32_FROM_LE (video_format->imp_colors))
));
src_pad = gst_pad_new_from_template (videosrctempl, name);
g_free (name);
/* Now try some gstreamer formatted MIME types (from gst_avi_demux_strf_vids) */
switch (GUINT32_FROM_LE(video_format->tag)) {
case GST_MAKE_FOURCC('I','4','2','0'):
case GST_MAKE_FOURCC('Y','U','Y','2'):
new_caps = GST_CAPS_NEW (
"asf_demux_video_src",
"video/raw",
"format", GST_PROPS_FOURCC(GUINT32_FROM_LE(video_format->tag)),
"width", GST_PROPS_INT(video_format->width),
"height", GST_PROPS_INT(video_format->height)
);
break;
case GST_MAKE_FOURCC('M','J','P','G'):
new_caps = GST_CAPS_NEW (
"asf_demux_video_src",
"video/jpeg",
"width", GST_PROPS_INT(video_format->width),
"height", GST_PROPS_INT(video_format->height)
);
break;
case GST_MAKE_FOURCC('d','v','s','d'):
new_caps = GST_CAPS_NEW (
"asf_demux_video_src",
"video/dv",
"format", GST_PROPS_STRING("NTSC"), /* FIXME??? */
"width", GST_PROPS_INT(video_format->width),
"height", GST_PROPS_INT(video_format->height)
);
break;
}
if (new_caps) caps_list = gst_caps_append(caps_list, new_caps);
GST_INFO ( "Adding video stream %u", asf_demux->num_video_streams);
caps = gst_asf_demux_video_caps (GUINT32_FROM_LE(video->tag),
video);
GST_INFO ("Adding video stream %u codec " GST_FOURCC_FORMAT " (0x%08x)",
asf_demux->num_video_streams,
GST_FOURCC_ARGS(GUINT32_FROM_LE(video->tag)),
GUINT32_FROM_LE(video->tag));
asf_demux->num_video_streams++;
return gst_asf_demux_setup_pad (asf_demux, src_pad, caps_list, id);
return gst_asf_demux_setup_pad (asf_demux, src_pad, caps, id);
}
@ -1576,7 +1577,8 @@ gst_asf_demux_setup_pad (GstASFDemux *asf_demux,
gst_pad_set_element_private (src_pad, stream);
GST_INFO ( "Adding pad for stream %u", asf_demux->num_streams);
GST_INFO ("Adding pad for stream %u",
asf_demux->num_streams);
asf_demux->num_streams++;
@ -1593,6 +1595,30 @@ plugin_init (GModule *module, GstPlugin *plugin)
{
GstElementFactory *factory;
gint i = 0;
GstCaps *audcaps = NULL, *vidcaps = NULL, *temp;
guint32 vid_list[] = {
GST_MAKE_FOURCC('I','4','2','0'),
GST_MAKE_FOURCC('Y','U','Y','2'),
GST_MAKE_FOURCC('M','J','P','G'),
GST_MAKE_FOURCC('D','V','S','D'),
GST_MAKE_FOURCC('W','M','V','1'),
GST_MAKE_FOURCC('W','M','V','2'),
GST_MAKE_FOURCC('M','P','G','4'),
GST_MAKE_FOURCC('M','P','4','2'),
GST_MAKE_FOURCC('M','P','4','3'),
0 /* end */
};
gint aud_list[] = {
GST_RIFF_WAVE_FORMAT_MPEGL3,
GST_RIFF_WAVE_FORMAT_MPEGL12,
GST_RIFF_WAVE_FORMAT_PCM,
GST_RIFF_WAVE_FORMAT_VORBIS1,
GST_RIFF_WAVE_FORMAT_A52,
GST_RIFF_WAVE_FORMAT_DIVX_WMAV1,
GST_RIFF_WAVE_FORMAT_DIVX_WMAV2,
GST_RIFF_WAVE_FORMAT_WMAV9,
-1 /* end */
};
/* this filter needs bytestream */
if (!gst_library_load ("gstbytestream")) {
@ -1615,9 +1641,26 @@ plugin_init (GModule *module, GstPlugin *plugin)
g_return_val_if_fail (factory != NULL, FALSE);
gst_element_factory_set_rank (factory, GST_ELEMENT_RANK_NONE);
gst_element_factory_add_pad_template (factory, GST_PAD_TEMPLATE_GET (audio_factory));
gst_element_factory_add_pad_template (factory, GST_PAD_TEMPLATE_GET (video_factory));
gst_element_factory_add_pad_template (factory, GST_PAD_TEMPLATE_GET (sink_factory));
for (i = 0; aud_list[i] != -1; i++) {
temp = gst_asf_demux_audio_caps (aud_list[i], NULL);
audcaps = gst_caps_append (audcaps, temp);
}
audiosrctempl = gst_pad_template_new ("audio_%02d",
GST_PAD_SRC,
GST_PAD_SOMETIMES,
audcaps, NULL);
for (i = 0; vid_list[i] != 0; i++) {
temp = gst_asf_demux_video_caps (vid_list[i], NULL);
vidcaps = gst_caps_append (vidcaps, temp);
}
videosrctempl = gst_pad_template_new ("video_%02d",
GST_PAD_SRC,
GST_PAD_SOMETIMES,
vidcaps, NULL);
gst_element_factory_add_pad_template (factory, audiosrctempl);
gst_element_factory_add_pad_template (factory, videosrctempl);
gst_element_factory_add_pad_template (factory,
GST_PAD_TEMPLATE_GET (sink_factory));
gst_plugin_add_feature (plugin, GST_PLUGIN_FEATURE (factory));

View file

@ -41,10 +41,8 @@ static GstCaps*
raw_caps_factory (void)
{
return gst_caps_new ("monkey_raw",
"audio/raw",
"audio/x-raw-int",
gst_props_new (
"format", GST_PROPS_STRING ("int"),
"law", GST_PROPS_INT (0),
"endianness", GST_PROPS_INT (G_LITTLE_ENDIAN),
"signed", GST_PROPS_BOOLEAN (TRUE),
"width", GST_PROPS_INT (16),

View file

@ -397,9 +397,7 @@ gst_monkeydec_loop (GstElement *element)
gst_pad_try_set_caps (monkeydec->srcpad,
GST_CAPS_NEW (
"monkeydec_caps",
"audio/raw",
"format", GST_PROPS_STRING ("int"),
"law", GST_PROPS_INT (0),
"audio/x-raw-int",
"endianness", GST_PROPS_INT (G_LITTLE_ENDIAN),
"signed", GST_PROPS_BOOLEAN (TRUE),
"width", GST_PROPS_INT (monkeydec->depth),

View file

@ -46,13 +46,11 @@ mp3_src_factory (void)
gst_caps_new (
"mp3parse_src",
"audio/x-mp3",
/*
gst_props_new (
"layer", GST_PROPS_INT_RANGE (1, 3),
"bitrate", GST_PROPS_INT_RANGE (8, 320),
"framed", GST_PROPS_BOOLEAN (TRUE),
*/
NULL),
"rate", GST_PROPS_INT_RANGE (8000, 48000),
"channels", GST_PROPS_INT_RANGE (1, 2),
NULL)),
NULL);
}
@ -89,13 +87,14 @@ static GstPadTemplate *sink_temp, *src_temp;
static void gst_mp3parse_class_init (GstMPEGAudioParseClass *klass);
static void gst_mp3parse_init (GstMPEGAudioParse *mp3parse);
static void gst_mp3parse_loop (GstElement *element);
static void gst_mp3parse_chain (GstPad *pad,GstBuffer *buf);
static long bpf_from_header (GstMPEGAudioParse *parse, unsigned long header);
static int head_check (unsigned long head);
static void gst_mp3parse_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec);
static void gst_mp3parse_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec);
static GstElementStateReturn
gst_mp3parse_change_state (GstElement *element);
static GstElementClass *parent_class = NULL;
/*static guint gst_mp3parse_signals[LAST_SIGNAL] = { 0 }; */
@ -133,13 +132,15 @@ gst_mp3parse_class_init (GstMPEGAudioParseClass *klass)
g_param_spec_int("skip","skip","skip",
G_MININT,G_MAXINT,0,G_PARAM_READWRITE)); /* CHECKME */
g_object_class_install_property(G_OBJECT_CLASS(klass), ARG_BIT_RATE,
g_param_spec_int("bit_rate","bit_rate","bit_rate",
g_param_spec_int("bitrate","Bitrate","Bit Rate",
G_MININT,G_MAXINT,0,G_PARAM_READABLE)); /* CHECKME */
parent_class = g_type_class_ref(GST_TYPE_ELEMENT);
gobject_class->set_property = gst_mp3parse_set_property;
gobject_class->get_property = gst_mp3parse_get_property;
gstelement_class->change_state = gst_mp3parse_change_state;
}
static void
@ -148,11 +149,8 @@ gst_mp3parse_init (GstMPEGAudioParse *mp3parse)
mp3parse->sinkpad = gst_pad_new_from_template(sink_temp, "sink");
gst_element_add_pad(GST_ELEMENT(mp3parse),mp3parse->sinkpad);
gst_element_set_loop_function (GST_ELEMENT(mp3parse),gst_mp3parse_loop);
#if 1 /* set this to one to use the old chaining code */
gst_pad_set_chain_function(mp3parse->sinkpad,gst_mp3parse_chain);
gst_element_set_loop_function (GST_ELEMENT(mp3parse),NULL);
#endif
mp3parse->srcpad = gst_pad_new_from_template(src_temp, "src");
gst_element_add_pad(GST_ELEMENT(mp3parse),mp3parse->srcpad);
@ -161,6 +159,8 @@ gst_mp3parse_init (GstMPEGAudioParse *mp3parse)
mp3parse->partialbuf = NULL;
mp3parse->skip = 0;
mp3parse->in_flush = FALSE;
mp3parse->rate = mp3parse->channels = mp3parse->layer = -1;
}
static guint32
@ -170,7 +170,6 @@ gst_mp3parse_next_header (guchar *buf,guint32 len,guint32 start)
int f = 0;
while (offset < (len - 4)) {
fprintf(stderr,"%02x ",buf[offset]);
if (buf[offset] == 0xff)
f = 1;
else if (f && ((buf[offset] >> 4) == 0x0f))
@ -182,52 +181,6 @@ gst_mp3parse_next_header (guchar *buf,guint32 len,guint32 start)
return -1;
}
static void
gst_mp3parse_loop (GstElement *element)
{
GstMPEGAudioParse *parse = GST_MP3PARSE(element);
GstBuffer *inbuf, *outbuf;
guint32 size, offset;
guchar *data;
guint32 start;
guint32 header;
gint bpf;
while (1) {
/* get a new buffer */
inbuf = gst_pad_pull (parse->sinkpad);
size = GST_BUFFER_SIZE (inbuf);
data = GST_BUFFER_DATA (inbuf);
offset = 0;
fprintf(stderr, "have buffer of %d bytes\n",size);
/* loop through it and find all the frames */
while (offset < (size - 4)) {
start = gst_mp3parse_next_header (data,size,offset);
fprintf(stderr, "skipped %d bytes searching for the next header\n",start-offset);
header = GUINT32_FROM_BE(*((guint32 *)(data+start)));
fprintf(stderr, "header is 0x%08x\n",header);
/* figure out how big the frame is supposed to be */
bpf = bpf_from_header (parse, header);
/* see if there are enough bytes in this buffer for the whole frame */
if ((start + bpf) <= size) {
outbuf = gst_buffer_create_sub (inbuf,start,bpf);
fprintf(stderr, "sending buffer of %d bytes\n",bpf);
gst_pad_push (parse->srcpad, outbuf);
offset = start + bpf;
/* if not, we have to deal with it somehow */
} else {
fprintf(stderr,"don't have enough data for this frame\n");
break;
}
}
}
}
static void
gst_mp3parse_chain (GstPad *pad, GstBuffer *buf)
{
@ -337,7 +290,13 @@ gst_mp3parse_chain (GstPad *pad, GstBuffer *buf)
mp3parse->in_flush = FALSE;
}
GST_BUFFER_TIMESTAMP(outbuf) = last_ts;
if (GST_PAD_CAPS (mp3parse->srcpad) != NULL) {
gst_pad_push(mp3parse->srcpad,outbuf);
} else {
GST_DEBUG ("No capsnego yet, delaying buffer push");
gst_buffer_unref (outbuf);
}
}
else {
GST_DEBUG ("mp3parse: skipping buffer of %d bytes",GST_BUFFER_SIZE(outbuf));
@ -382,8 +341,9 @@ static long mp3parse_freqs[9] =
static long
bpf_from_header (GstMPEGAudioParse *parse, unsigned long header)
{
int layer_index,layer,lsf,samplerate_index,padding;
int layer_index,layer,lsf,samplerate_index,padding,mode;
long bpf;
gint channels, rate;
/*mpegver = (header >> 19) & 0x3; // don't need this for bpf */
layer_index = (header >> 17) & 0x3;
@ -392,6 +352,7 @@ bpf_from_header (GstMPEGAudioParse *parse, unsigned long header)
parse->bit_rate = mp3parse_tabsel[lsf][layer - 1][((header >> 12) & 0xf)];
samplerate_index = (header >> 10) & 0x3;
padding = (header >> 9) & 0x1;
mode = (header >> 6) & 0x3;
if (layer == 1) {
bpf = parse->bit_rate * 12000;
@ -403,6 +364,26 @@ bpf_from_header (GstMPEGAudioParse *parse, unsigned long header)
bpf += padding;
}
channels = (mode == 3) ? 1 : 2;
rate = mp3parse_freqs[samplerate_index];
if (channels != parse->channels ||
rate != parse->rate ||
layer != parse->layer) {
GstCaps *caps = GST_CAPS_NEW ("mp3parse_src",
"audio/mpeg",
"layer", GST_PROPS_INT (layer),
"channels", GST_PROPS_INT (channels),
"rate", GST_PROPS_INT (rate));
if (gst_pad_try_set_caps(parse->srcpad, caps) <= 0) {
gst_element_error (GST_ELEMENT (parse),
"mp3parse: failed to negotiate format with next element");
}
parse->channels = channels;
parse->layer = layer;
parse->rate = rate;
}
/*g_print("%08x: layer %d lsf %d bitrate %d samplerate_index %d padding %d - bpf %d\n", */
/*header,layer,lsf,bitrate,samplerate_index,padding,bpf); */
@ -478,6 +459,28 @@ gst_mp3parse_get_property (GObject *object, guint prop_id, GValue *value, GParam
}
}
static GstElementStateReturn
gst_mp3parse_change_state (GstElement *element)
{
GstMPEGAudioParse *src;
g_return_val_if_fail(GST_IS_MP3PARSE(element), GST_STATE_FAILURE);
src = GST_MP3PARSE(element);
switch (GST_STATE_TRANSITION (element)) {
case GST_STATE_PAUSED_TO_READY:
src->channels = -1; src->rate = -1; src->layer = -1;
break;
default:
break;
}
if (GST_ELEMENT_CLASS(parent_class)->change_state)
return GST_ELEMENT_CLASS(parent_class)->change_state(element);
return GST_STATE_SUCCESS;
}
static gboolean
plugin_init (GModule *module, GstPlugin *plugin)
{

View file

@ -53,6 +53,7 @@ struct _GstMPEGAudioParse {
GstBuffer *partialbuf; /* previous buffer (if carryover) */
guint skip; /* number of frames to skip */
guint bit_rate;
gint channels, rate, layer;
gboolean in_flush;
};

View file

@ -67,7 +67,7 @@ GST_PAD_TEMPLATE_FACTORY (audio_factory,
GST_PAD_SOMETIMES,
GST_CAPS_NEW (
"mpeg_demux_audio",
"audio/x-mp3",
"audio/mpeg",
NULL
)
);
@ -103,7 +103,7 @@ GST_PAD_TEMPLATE_FACTORY (private1_factory,
GST_PAD_SOMETIMES,
GST_CAPS_NEW (
"mpeg_demux_private1",
"audio/a52",
"audio/x-ac3",
NULL
)
);
@ -112,11 +112,7 @@ GST_PAD_TEMPLATE_FACTORY (private2_factory,
"private_stream_2",
GST_PAD_SRC,
GST_PAD_SOMETIMES,
GST_CAPS_NEW (
"mpeg_demux_private2",
"unknown/unknown",
NULL
)
);
GST_PAD_TEMPLATE_FACTORY (pcm_factory,
@ -125,9 +121,7 @@ GST_PAD_TEMPLATE_FACTORY (pcm_factory,
GST_PAD_SOMETIMES,
GST_CAPS_NEW (
"mpeg_demux_pcm",
"audio/raw",
"format", GST_PROPS_STRING ("int"),
"law", GST_PROPS_INT (0),
"audio/x-raw-int",
"endianness", GST_PROPS_INT (G_BIG_ENDIAN),
"signed", GST_PROPS_BOOLEAN (TRUE),
"width", GST_PROPS_LIST (
@ -152,11 +146,7 @@ GST_PAD_TEMPLATE_FACTORY (subtitle_factory,
"subtitle_stream_%d",
GST_PAD_SRC,
GST_PAD_SOMETIMES,
GST_CAPS_NEW (
"mpeg_demux_subtitle",
"video/mpeg",
NULL
)
NULL /* FIXME! */
);
static void gst_mpeg_demux_class_init (GstMPEGDemuxClass *klass);
@ -1000,9 +990,7 @@ gst_mpeg_demux_lpcm_set_caps (GstPad *pad, guint8 sample_info)
caps = GST_CAPS_NEW (
"mpeg_demux_pcm",
"audio/raw",
"format", GST_PROPS_STRING ("int"),
"law", GST_PROPS_INT (0),
"audio/x-raw-int",
"endianness", GST_PROPS_INT (G_BIG_ENDIAN),
"signed", GST_PROPS_BOOLEAN (TRUE),
"width", GST_PROPS_INT (width),

View file

@ -77,8 +77,7 @@ GST_PAD_TEMPLATE_FACTORY (src_factory,
"mpeg_parse_src",
"video/mpeg",
"mpegversion", GST_PROPS_INT_RANGE (1, 2),
"systemstream", GST_PROPS_BOOLEAN (TRUE),
"parsed", GST_PROPS_BOOLEAN (TRUE)
"systemstream", GST_PROPS_BOOLEAN (TRUE)
)
);

View file

@ -91,8 +91,8 @@ static GstCaps* realmedia_type_find (GstBuffer *buf, gpointer private);
static GstTypeDefinition realmediadefinition = {
"rmdemux_video/realmedia",
"application/vnd.rn-realmedia",
".ram",
"video/x-pn-realvideo",
".ram .rm .ra",
realmedia_type_find,
};
@ -110,7 +110,7 @@ GST_PAD_TEMPLATE_FACTORY (sink_templ,
GST_PAD_ALWAYS,
GST_CAPS_NEW (
"rmdemux_sink",
"application/vnd.rn-realmedia",
"video/x-pn-realvideo",
NULL
)
)

View file

@ -46,7 +46,7 @@ struct _GstSynaesthesia {
gint16 datain[2][512];
/* video state */
gint fps;
gfloat fps;
gint width;
gint height;
gboolean first_buffer;
@ -90,8 +90,7 @@ GST_PAD_TEMPLATE_FACTORY (src_template,
GST_PAD_ALWAYS,
GST_CAPS_NEW (
"synaesthesiasrc",
"video/raw",
"format", GST_PROPS_FOURCC (GST_STR_FOURCC ("RGB ")),
"video/x-raw-rgb",
"bpp", GST_PROPS_INT (32),
"depth", GST_PROPS_INT (32),
"endianness", GST_PROPS_INT (G_BYTE_ORDER),
@ -99,7 +98,8 @@ GST_PAD_TEMPLATE_FACTORY (src_template,
"green_mask", GST_PROPS_INT (0xff00),
"blue_mask", GST_PROPS_INT (0xff),
"width", GST_PROPS_INT_RANGE (16, 4096),
"height", GST_PROPS_INT_RANGE (16, 4096)
"height", GST_PROPS_INT_RANGE (16, 4096),
"framerate", GST_PROPS_FLOAT_RANGE (0, G_MAXFLOAT)
)
)
@ -109,10 +109,8 @@ GST_PAD_TEMPLATE_FACTORY (sink_template,
GST_PAD_ALWAYS, /* ALWAYS/SOMETIMES */
GST_CAPS_NEW (
"synaesthesiasink", /* the name of the caps */
"audio/raw", /* the mime type of the caps */
"audio/x-raw-int", /* the mime type of the caps */
/* Properties follow: */
"format", GST_PROPS_STRING ("int"),
"law", GST_PROPS_INT (0),
"endianness", GST_PROPS_INT (G_BYTE_ORDER),
"signed", GST_PROPS_BOOLEAN (TRUE),
"width", GST_PROPS_INT (16),
@ -181,8 +179,8 @@ gst_synaesthesia_class_init(GstSynaesthesiaClass *klass)
g_param_spec_int ("height","Height","The height",
1, 2048, 320, G_PARAM_READWRITE));
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_FPS,
g_param_spec_int ("fps","FPS","Frames per second",
1, 100, 25, G_PARAM_READWRITE));
g_param_spec_float ("fps","FPS","Frames per second",
0., G_MAXFLOAT, 25., G_PARAM_READWRITE));
gobject_class->set_property = gst_synaesthesia_set_property;
gobject_class->get_property = gst_synaesthesia_get_property;
@ -209,7 +207,7 @@ gst_synaesthesia_init (GstSynaesthesia *synaesthesia)
/* reset the initial video state */
synaesthesia->width = 320;
synaesthesia->height = 200;
synaesthesia->fps = 25; /* desired frame rate */
synaesthesia->fps = 25.; /* desired frame rate */
}
@ -291,7 +289,8 @@ gst_synaesthesia_chain (GstPad *pad, GstBuffer *bufin)
"green_mask", GST_PROPS_INT (0x00ff00),
"blue_mask", GST_PROPS_INT (0x0000ff),
"width", GST_PROPS_INT (synaesthesia->width),
"height", GST_PROPS_INT (synaesthesia->height)
"height", GST_PROPS_INT (synaesthesia->height),
"framerate", GST_PROPS_FLOAT (synaesthesia->fps)
);
if (gst_pad_try_set_caps (synaesthesia->srcpad, caps) <= 0) {
@ -334,7 +333,7 @@ gst_synaesthesia_set_property (GObject *object, guint prop_id, const GValue *val
synaesthesia->height = g_value_get_int (value);
break;
case ARG_FPS:
synaesthesia->fps = g_value_get_int (value);
synaesthesia->fps = g_value_get_float (value);
break;
default:
break;
@ -358,7 +357,7 @@ gst_synaesthesia_get_property (GObject *object, guint prop_id, GValue *value, GP
g_value_set_int (value, synaesthesia->height);
break;
case ARG_FPS:
g_value_set_int (value, synaesthesia->fps);
g_value_set_float (value, synaesthesia->fps);
break;
default:
break;