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"
- AC_SUBST(XVIDEO_LIBS)
fi
+
+ AC_SUBST(XVIDEO_LIBS)
fi
-fi
+])
dnl Next, check for the optional libraries:
dnl These are all libraries used in building plug-ins
GstCaps *all_caps, *caps, *walk;
gint channels, min_channels, max_channels;
gint rate, min_rate, max_rate;
- gint i, law, endian, width, depth;
+ gint i, endian, width, depth;
gboolean sign;
GstAlsa *this = GST_ALSA (src);
}
/* construct caps */
- caps = GST_CAPS_NEW ("alsasrc caps", "audio/raw",
- "format", GST_PROPS_STRING ("int"),
- "law", GST_PROPS_INT (0),
+ caps = GST_CAPS_NEW ("alsasrc caps", "audio/x-raw-int",
"endianness", GST_PROPS_INT (G_BYTE_ORDER),
"signed", GST_PROPS_BOOLEAN (TRUE),
"width", GST_PROPS_INT (16),
/* now try to find the best match */
walk = all_caps;
while (walk) {
- gst_caps_get (walk, "law", &law, "signed", &sign, "width", &width, "depth", &depth, NULL);
+ gst_caps_get (walk, "signed", &sign, "width", &width, "depth", &depth, NULL);
if (gst_caps_has_property (walk, "endianness")) {
gst_caps_get_int (walk, "endianness", &endian);
} else {
endian = G_BYTE_ORDER;
}
- gst_caps_set (caps, "law", GST_PROPS_INT (law));
gst_caps_set (caps, "endianness", GST_PROPS_INT (endian));
gst_caps_set (caps, "width", GST_PROPS_INT (width));
gst_caps_set (caps, "depth", GST_PROPS_INT (depth));
gst_caps_set (caps, "rate", GST_PROPS_INT (rate));
for (channels = aggressive ? max_channels : MIN (max_channels, 2); channels >= min_channels; channels--) {
gst_caps_set (caps, "channels", GST_PROPS_INT (channels));
- GST_DEBUG ("trying new caps: law %d, %ssigned, endianness: %d, width %d, depth %d, channels %d, rate %d\n",
- law, sign ? "" : "un", endian, width, depth, channels, rate);
+ GST_DEBUG ("trying new caps: %ssigned, endianness: %d, width %d, depth %d, channels %d, rate %d\n",
+ sign ? "" : "un", endian, width, depth, channels, rate);
if (gst_pad_try_set_caps (this->pad[0], caps) != GST_PAD_LINK_REFUSED)
gst_alsa_link (this->pad[0], caps);
static GstAlsaFormat *
gst_alsa_get_format (GstCaps *caps)
{
- const gchar *format_name;
+ const gchar *mimetype;
GstAlsaFormat *ret;
if (!(ret = g_new (GstAlsaFormat, 1)))
return NULL;
/* we have to differentiate between int and float formats */
- if (!gst_caps_get_string (caps, "format", &format_name))
- goto error;
+ mimetype = gst_caps_get_mime (caps);
- if (strncmp (format_name, "int", 3) == 0) {
+ if (strcmp (mimetype, "audio/x-raw-int") == 0) {
gboolean sign;
- gint width, depth, endianness, law;
+ gint width, depth, endianness;
/* extract the needed information from the caps */
if (!gst_caps_get (caps,
"width", &width,
"depth", &depth,
- "law", &law,
"signed", &sign,
NULL))
goto error;
}
/* find corresponding alsa format */
- switch (law) {
- case 0:
- ret->format = snd_pcm_build_linear_format (depth, width, sign ? 0 : 1, endianness == G_LITTLE_ENDIAN ? 0 : 1);
- break;
- case 1:
- if (width == 8 && depth == 8 && sign == FALSE) {
- ret->format = SND_PCM_FORMAT_MU_LAW;
- break;
- } else {
- goto error;
- }
- case 2:
- if (width == 8 && depth == 8 && sign == FALSE) {
- ret->format = SND_PCM_FORMAT_A_LAW;
- break;
- } else {
- goto error;
- }
- default:
- goto error;
- }
- } else if (strncmp (format_name, "float", 5) == 0) {
- gchar *layout;
+ ret->format = snd_pcm_build_linear_format (depth, width, sign ? 0 : 1, endianness == G_LITTLE_ENDIAN ? 0 : 1);
+ } else if (strcmp (mimetype, "audio/x-raw-float") == 0) {
+ gint depth;
gfloat intercept, slope;
/* get layout */
- if (!gst_caps_get (caps, "layout", &layout,
+ if (!gst_caps_get (caps, "depth", &depth,
"intercept", &intercept,
"slope", &slope,
NULL))
goto error;
}
/* match layout to format wrt to endianness */
- if (strncmp (layout, "gfloat", 6) == 0) {
+ if (depth == 32) {
if (G_BYTE_ORDER == G_LITTLE_ENDIAN) {
ret->format = SND_PCM_FORMAT_FLOAT_LE;
} else if (G_BYTE_ORDER == G_BIG_ENDIAN) {
} else {
ret->format = SND_PCM_FORMAT_FLOAT;
}
- } else if (strncmp (layout, "gdouble", 7) == 0) {
+ } else if (depth == 64) {
if (G_BYTE_ORDER == G_LITTLE_ENDIAN) {
ret->format = SND_PCM_FORMAT_FLOAT64_LE;
} else if (G_BYTE_ORDER == G_BIG_ENDIAN) {
} else {
goto error;
}
- }
+ } else if (!strcmp (mimetype, "audio/x-alaw")) {
+ ret->format = SND_PCM_FORMAT_A_LAW;
+ } else if (!strcmp (mimetype, "audio/x-mulaw")) {
+ ret->format = SND_PCM_FORMAT_MU_LAW;
+ }
/* get rate and channels */
if (!gst_caps_get (caps, "rate", &ret->rate,
(one->channels == two->channels);
}
/* get props for a spec */
-static GstProps *
-gst_alsa_get_props (snd_pcm_format_t format)
+static GstCaps *
+gst_alsa_get_caps_internal (snd_pcm_format_t format)
{
+ gchar *name = snd_pcm_format_name (format);
+
if (format == SND_PCM_FORMAT_A_LAW) {
- return gst_props_new ("format", GST_PROPS_STRING ("int"),
+ return GST_CAPS_NEW (name, "audio/x-alaw",
+ "format", GST_PROPS_STRING ("int"),
"law", GST_PROPS_INT(2),
"width", GST_PROPS_INT(8),
"depth", GST_PROPS_INT(8),
"signed", GST_PROPS_BOOLEAN (FALSE),
NULL);
} else if (format == SND_PCM_FORMAT_MU_LAW) {
- return gst_props_new ("format", GST_PROPS_STRING ("int"),
+ return GST_CAPS_NEW (name, "audio/x-mulaw",
+ "format", GST_PROPS_STRING ("int"),
"law", GST_PROPS_INT(1),
"width", GST_PROPS_INT(8),
"depth", GST_PROPS_INT(8),
break;
}
}
- return props;
+ return GST_CAPS_NEW (name, "audio/x-raw-int", props);
} else if (snd_pcm_format_float (format)) {
/* no float with non-platform endianness */
if (!snd_pcm_format_cpu_endian (format))
return NULL;
- return gst_props_new ("format", GST_PROPS_STRING ("float"),
- "layout", GST_PROPS_STRING (snd_pcm_format_width (format) == 64 ? "gdouble" : "gfloat"),
- "intercept", GST_PROPS_FLOAT (0),
- "slope", GST_PROPS_FLOAT (1),
+ return GST_CAPS_NEW (name, "audio/x-raw-float",
+ "depth", GST_PROPS_INT (snd_pcm_format_width (format)),
+ "endianness", GST_PROPS_INT (G_BYTE_ORDER),
+ "intercept", GST_PROPS_FLOAT (0.),
+ "slope", GST_PROPS_FLOAT (1.),
NULL);
}
return NULL;
if (format != SND_PCM_FORMAT_UNKNOWN) {
/* there are some caps set already */
- GstProps *props = gst_alsa_get_props (format);
+ ret_caps = gst_alsa_get_caps_internal (format);
+
/* we can never use a format we can't set caps for */
- g_assert (props != NULL);
+ g_assert (ret_caps != NULL);
+ g_assert (ret_caps->properties != NULL);
- add_channels (props, rate, -1, channels, -1);
- ret_caps = gst_caps_new (g_strdup (snd_pcm_format_name (format)), "audio/raw", props);
+ add_channels (ret_caps->properties, rate, -1, channels, -1);
} else {
int i;
- GstProps *props;
+ GstCaps *temp;
for (i = 0; i <= SND_PCM_FORMAT_LAST; i++) {
- props = gst_alsa_get_props (i);
+ temp = gst_alsa_get_caps_internal (i);
+
/* can be NULL, because not all alsa formats can be specified as caps */
- if (props != NULL) {
- add_channels (props, rate, -1, channels, -1);
- ret_caps = gst_caps_append (ret_caps, gst_caps_new (g_strdup (snd_pcm_format_name (i)),
- "audio/raw", props));
+ if (temp != NULL && temp->properties != NULL) {
+ add_channels (temp->props, rate, -1, channels, -1);
+ ret_caps = gst_caps_append (ret_caps, temp);
}
}
}
max_channels = -1;
} else {
ERROR_CHECK (snd_pcm_hw_params_get_channels_min (hw_params, &min_rate),
- "Coulödn't get minimum channel count for device %s: %s", this->device);
+ "Coulödn't get minimum channel count for device %s: %s", this->device);
ERROR_CHECK (snd_pcm_hw_params_get_channels_max (hw_params, &max_rate),
- "Coulödn't get maximum channel count for device %s: %s", this->device);
+ "Coulödn't get maximum channel count for device %s: %s", this->device);
min_channels = min_rate;
max_channels = max_rate > GST_ALSA_MAX_CHANNELS ? GST_ALSA_MAX_CHANNELS : max_rate;
}
ERROR_CHECK (snd_pcm_hw_params_get_rate_min (hw_params, &min_rate, &i),
- "Coulödn't get minimum rate for device %s: %s", this->device);
+ "Coulödn't get minimum rate for device %s: %s", this->device);
min_rate = min_rate < GST_ALSA_MIN_RATE ? GST_ALSA_MIN_RATE : min_rate + i;
ERROR_CHECK (snd_pcm_hw_params_get_rate_max (hw_params, &max_rate, &i),
- "Coulödn't get maximum rate for device %s: %s", this->device);
+ "Coulödn't get maximum rate for device %s: %s", this->device);
max_rate = max_rate > GST_ALSA_MAX_RATE ? GST_ALSA_MAX_RATE : max_rate + i;
snd_pcm_format_mask_alloca (&mask);
GST_PAD_ALWAYS,
GST_CAPS_NEW (
"cdparanoia_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),
return
gst_caps_new (
"vorbis_vorbis",
- "application/x-ogg",
+ "application/ogg",
NULL);
}
return
gst_caps_new (
"vorbis_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_BYTE_ORDER),
"signed", GST_PROPS_BOOLEAN (TRUE),
"width", GST_PROPS_INT (16),
return
gst_caps_new (
"vorbis_raw_float",
- "audio/raw",
+ "audio/x-raw-float",
gst_props_new (
- "format", GST_PROPS_STRING ("float"),
- "layout", GST_PROPS_STRING ("IEEE"),
+ "depth", GST_PROPS_INT (32),
+ "endianness", GST_PROPS_INT (G_BYTE_ORDER),
+ "slope", GST_PROPS_FLOAT (1.),
+ "intercept", GST_PROPS_FLOAT (0.),
"rate", GST_PROPS_INT_RANGE (11025, 48000),
"channels", GST_PROPS_INT (2),
NULL));
static GstTypeDefinition vorbisdefinition = {
"vorbis_audio/x-ogg",
- "application/x-ogg",
+ "application/ogg",
".ogg",
vorbis_type_find,
};
head = GUINT32_FROM_BE (*((guint32 *)data));
if (head == 0x4F676753) {
- return gst_caps_new ("vorbis_type_find", "application/x-ogg", NULL);
+ return gst_caps_new ("vorbis_type_find", "application/ogg", NULL);
} else {
/* checks for existance of vorbis identification header in case
* there's an ID3 tag */
data[offset+4] == 'b' &&
data[offset+5] == 'i' &&
data[offset+6] == 's' ) {
- return gst_caps_new ("vorbis_type_find", "application/x-ogg", NULL);
+ return gst_caps_new ("vorbis_type_find", "application/ogg", NULL);
}
}
}
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_QUALITY,
g_param_spec_float ("quality", "Quality",
"Specify quality instead of specifying a particular bitrate.",
- -1.0, 10.0, QUALITY_DEFAULT, G_PARAM_READWRITE));
+ 0.0, 1.0, QUALITY_DEFAULT, G_PARAM_READWRITE));
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_SERIAL,
g_param_spec_int ("serial", "Serial", "Specify a serial number for the stream. (-1 is random)",
-1, G_MAXINT, -1, G_PARAM_READWRITE));
gst_vorbisfile_update_streaminfo (vorbisfile, link);
caps = GST_CAPS_NEW ("vorbisdec_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),
#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),\
#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),\
#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, \
#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;
-
- /* 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));
+ gfloat fps = 0.;
+ GstCaps *caps;
+
+ /* 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.;
+ }
+
+ 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.;
}
- fps = ((gdouble) dest_value) / NUM_UNITS;
+ gst_caps_get_float (caps, "framerate", &fps);
- GST_DEBUG ("Framerate request on pad %s:%s - %f fps",
- GST_ELEMENT_NAME(gst_pad_get_parent (pad)), GST_PAD_NAME(pad), 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;
}
{
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;
}
#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);
"src",
GST_PAD_SRC,
GST_PAD_ALWAYS,
- gst_caps_new ("int_src", "audio/raw",
+ gst_caps_new ("int_src", "audio/x-raw-int",
GST_AUDIO_INT_PAD_TEMPLATE_PROPS),
- gst_caps_new ("float_src", "audio/raw",
+ gst_caps_new ("float_src", "audio/x-raw-float",
GST_AUDIO_FLOAT_MONO_PAD_TEMPLATE_PROPS)
);
"sink%d",
GST_PAD_SINK,
GST_PAD_REQUEST,
- gst_caps_new ("int_sink", "audio/raw",
+ gst_caps_new ("int_sink", "audio/x-raw-int",
GST_AUDIO_INT_PAD_TEMPLATE_PROPS),
- gst_caps_new ("float_sink", "audio/raw",
+ gst_caps_new ("float_sink", "audio/x-raw-float",
GST_AUDIO_FLOAT_MONO_PAD_TEMPLATE_PROPS)
);
static gboolean
gst_adder_parse_caps (GstAdder *adder, GstCaps *caps)
{
- const gchar *format;
+ const gchar *mimetype;
GstElement *el = GST_ELEMENT (adder);
- gst_caps_get_string (caps, "format", &format);
+ mimetype = gst_caps_get_mime (caps);
if (adder->format == GST_ADDER_FORMAT_UNSET) {
/* the caps haven't been set yet at all,
* so we need to go ahead and set all
the relevant values. */
- if (strcmp (format, "int") == 0) {
+ if (strcmp (mimetype, "audio/x-raw-int") == 0) {
GST_DEBUG ("parse_caps sets adder to format int");
adder->format = GST_ADDER_FORMAT_INT;
gst_caps_get_int (caps, "width", &adder->width);
gst_caps_get_int (caps, "depth", &adder->depth);
- gst_caps_get_int (caps, "law", &adder->law);
gst_caps_get_int (caps, "endianness", &adder->endianness);
gst_caps_get_boolean (caps, "signed", &adder->is_signed);
gst_caps_get_int (caps, "channels", &adder->channels);
gst_caps_get_int (caps, "rate", &adder->rate);
- } else if (strcmp (format, "float") == 0) {
+ } else if (strcmp (mimetype, "audio/x-raw-float") == 0) {
GST_DEBUG ("parse_caps sets adder to format float");
adder->format = GST_ADDER_FORMAT_FLOAT;
- gst_caps_get_string (caps, "layout", &adder->layout);
gst_caps_get_float (caps, "intercept", &adder->intercept);
gst_caps_get_float (caps, "slope", &adder->slope);
gst_caps_get_int (caps, "channels", &adder->channels);
} else {
/* otherwise, a previously-linked pad has set all the values. we should
barf if some of the attempted new values don't match. */
- if (strcmp (format, "int") == 0) {
+ if (strcmp (mimetype, "audio/x-raw-int") == 0) {
gint width, channels, rate;
gboolean is_signed;
is_signed ? "" : "un");
return FALSE;
}
- } else if (strcmp (format, "float") == 0) {
+ } else if (strcmp (mimetype, "audio/x-raw-float") == 0) {
gint channels, rate;
gst_caps_get_int (caps, "channels", &channels);
gst_element_error (el, "can't link %d Hz pad with %d Hz adder",
rate, adder->rate);
return FALSE;
- } else {
- /* whoa, we don't know what's trying to link with us ! barf ! */
- return FALSE;
}
}
}
GstCaps *caps =
gst_caps_new ("default_adder_caps",
- "audio/raw",
- gst_props_new ("format", GST_PROPS_STRING ("int"),
- "width", GST_PROPS_INT (16),
+ "audio/x-raw-int",
+ gst_props_new ("width", GST_PROPS_INT (16),
"depth", GST_PROPS_INT (16),
"rate", GST_PROPS_INT (44100),
"channels", GST_PROPS_INT (2),
- "law", GST_PROPS_INT (0),
"endianness", GST_PROPS_INT (G_BYTE_ORDER),
"signed", GST_PROPS_BOOLEAN (TRUE),
NULL));
"adder",
plugin_init
};
-
GST_PAD_ALWAYS,
GST_CAPS_NEW (
"audio_convert_src",
- "audio/raw",
- "format", GST_PROPS_STRING ("int"),
- "law", GST_PROPS_INT (0),
+ "audio/x-raw-int",
"endianness", GST_PROPS_LIST (
GST_PROPS_INT (G_LITTLE_ENDIAN),
GST_PROPS_INT (G_BIG_ENDIAN)
GST_PAD_ALWAYS,
GST_CAPS_NEW (
"audio_convert_sink",
- "audio/raw",
- "format", GST_PROPS_STRING ("int"),
- "law", GST_PROPS_INT (0),
+ "audio/x-raw-int",
"endianness", GST_PROPS_LIST (
GST_PROPS_INT (G_LITTLE_ENDIAN),
GST_PROPS_INT (G_BIG_ENDIAN)
if (width == 1) {
return GST_CAPS_NEW (
"audio_convert_caps",
- "audio/raw",
- "format", GST_PROPS_STRING ("int"),
- "law", GST_PROPS_INT (0),
+ "audio/x-raw-int",
"signed", GST_PROPS_BOOLEAN (sign),
"depth", GST_PROPS_INT (depth),
"width", GST_PROPS_INT (width * 8),
} else {
return GST_CAPS_NEW (
"audio_convert_caps",
- "audio/raw",
- "format", GST_PROPS_STRING ("int"),
- "law", GST_PROPS_INT (0),
+ "audio/x-raw-int",
"endianness", GST_PROPS_INT (endianness),
"signed", GST_PROPS_BOOLEAN (sign),
"depth", GST_PROPS_INT (depth),
/* FILL ME */
};
-static GstPadTemplate *
-sink_template (void)
-{
- static GstPadTemplate *template = NULL;
-
- if (!template) {
- template = gst_pad_template_new ("sink",
- GST_PAD_SINK,
- GST_PAD_ALWAYS,
- gst_caps_new
- ("audioscale_sink",
- "audio/raw", GST_AUDIO_INT_PAD_TEMPLATE_PROPS), NULL);
- }
- return template;
-}
-
-static GstPadTemplate *
-src_template (void)
-{
- static GstPadTemplate *template = NULL;
-
- if (!template) {
- template = gst_pad_template_new ("src",
- GST_PAD_SRC,
- GST_PAD_ALWAYS,
- gst_caps_new
- ("audioscale_src",
- "audio/raw", GST_AUDIO_INT_PAD_TEMPLATE_PROPS), NULL);
- }
- return template;
-}
+GST_PAD_TEMPLATE_FACTORY (sink_factory,
+ "sink",
+ GST_PAD_SINK,
+ GST_PAD_ALWAYS,
+ gst_caps_new ("audioscale_sink",
+ "audio/x-raw-int",
+ GST_AUDIO_INT_PAD_TEMPLATE_PROPS)
+);
+
+GST_PAD_TEMPLATE_FACTORY (src_factory,
+ "src",
+ GST_PAD_SRC,
+ GST_PAD_ALWAYS,
+ gst_caps_new ("audioscale_src",
+ "audio/x-raw-int",
+ GST_AUDIO_INT_PAD_TEMPLATE_PROPS)
+);
#define GST_TYPE_AUDIOSCALE_METHOD (gst_audioscale_method_get_type())
static GType
{
resample_t *r;
- audioscale->sinkpad = gst_pad_new_from_template (GST_PAD_TEMPLATE_GET (sink_template), "sink");
+ audioscale->sinkpad = gst_pad_new_from_template (
+ GST_PAD_TEMPLATE_GET (sink_factory), "sink");
gst_element_add_pad(GST_ELEMENT(audioscale),audioscale->sinkpad);
gst_pad_set_chain_function(audioscale->sinkpad,gst_audioscale_chain);
gst_pad_set_link_function (audioscale->sinkpad, gst_audioscale_sinkconnect);
- audioscale->srcpad = gst_pad_new_from_template (GST_PAD_TEMPLATE_GET (src_template), "src");
+ audioscale->srcpad = gst_pad_new_from_template (
+ GST_PAD_TEMPLATE_GET (src_factory), "src");
gst_element_add_pad(GST_ELEMENT(audioscale),audioscale->srcpad);
/* create an elementfactory for the audioscale element */
factory = gst_element_factory_new ("audioscale", GST_TYPE_AUDIOSCALE, &audioscale_details);
g_return_val_if_fail(factory != NULL, FALSE);
+ 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));
/* load support library */
GST_PAD_ALWAYS,
GST_CAPS_NEW (
"sinesrc_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),
caps = GST_CAPS_NEW (
"sinesrc_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),
static GstPadTemplate *templ = NULL;
if(!templ){
- GstCaps *caps = GST_CAPS_NEW("src","video/raw",
+ GstCaps *caps;
+ GstCaps *caps1 = GST_CAPS_NEW("src","video/x-raw-yuv",
"width", GST_PROPS_INT_RANGE (0, G_MAXINT),
- "height", GST_PROPS_INT_RANGE (0, G_MAXINT));
+ "height", GST_PROPS_INT_RANGE (0, G_MAXINT),
+ "framerate", GST_PROPS_FLOAT_RANGE (0, G_MAXFLOAT));
+ GstCaps *caps2 = GST_CAPS_NEW("src","video/x-raw-rgb",
+ "width", GST_PROPS_INT_RANGE (0, G_MAXINT),
+ "height", GST_PROPS_INT_RANGE (0, G_MAXINT),
+ "framerate", GST_PROPS_FLOAT_RANGE (0, G_MAXFLOAT));
- caps = gst_caps_intersect(caps, gst_videoscale_get_capslist ());
+ caps = gst_caps_intersect(caps1, gst_videoscale_get_capslist ());
+ gst_caps_unref (caps1);
+ caps1 = caps;
+ caps = gst_caps_intersect(caps2, gst_videoscale_get_capslist ());
+ gst_caps_unref (caps2);
+ caps2 = caps;
+ caps = gst_caps_append(caps1, caps2);
templ = GST_PAD_TEMPLATE_NEW("src", GST_PAD_SRC, GST_PAD_ALWAYS, caps);
}
static GstPadTemplate *templ = NULL;
if(!templ){
- GstCaps *caps = GST_CAPS_NEW("sink","video/raw",
+ GstCaps *caps;
+ GstCaps *caps1 = GST_CAPS_NEW("src","video/x-raw-yuv",
+ "width", GST_PROPS_INT_RANGE (0, G_MAXINT),
+ "height", GST_PROPS_INT_RANGE (0, G_MAXINT),
+ "framerate", GST_PROPS_FLOAT_RANGE (0, G_MAXFLOAT));
+ GstCaps *caps2 = GST_CAPS_NEW("src","video/x-raw-rgb",
"width", GST_PROPS_INT_RANGE (0, G_MAXINT),
- "height", GST_PROPS_INT_RANGE (0, G_MAXINT));
+ "height", GST_PROPS_INT_RANGE (0, G_MAXINT),
+ "framerate", GST_PROPS_FLOAT_RANGE (0, G_MAXFLOAT));
- caps = gst_caps_intersect(caps, gst_videoscale_get_capslist ());
+ caps = gst_caps_intersect(caps1, gst_videoscale_get_capslist ());
+ gst_caps_unref (caps1);
+ caps1 = caps;
+ caps = gst_caps_intersect(caps2, gst_videoscale_get_capslist ());
+ gst_caps_unref (caps2);
+ caps2 = caps;
+ caps = gst_caps_append(caps1, caps2);
templ = GST_PAD_TEMPLATE_NEW("src", GST_PAD_SINK, GST_PAD_ALWAYS, caps);
}
GstVideoscale *videoscale;
GstCaps *capslist = NULL;
GstCaps *peercaps;
- GstCaps *sizecaps;
+ GstCaps *sizecaps1, *sizecaps2;
int i;
GST_DEBUG ("gst_videoscale_src_link");
}
gst_caps_unref (peercaps);
- sizecaps = GST_CAPS_NEW("videoscale_size","video/raw",
+ sizecaps1 = GST_CAPS_NEW("src","video/x-raw-yuv",
"width", GST_PROPS_INT_RANGE (0, G_MAXINT),
- "height", GST_PROPS_INT_RANGE (0, G_MAXINT));
-
- caps = gst_caps_intersect(caps, gst_videoscale_get_capslist ());
- gst_caps_unref (sizecaps);
+ "height", GST_PROPS_INT_RANGE (0, G_MAXINT),
+ "framerate", GST_PROPS_FLOAT_RANGE (0, G_MAXFLOAT));
+ sizecaps2 = GST_CAPS_NEW("src","video/x-raw-rgb",
+ "width", GST_PROPS_INT_RANGE (0, G_MAXINT),
+ "height", GST_PROPS_INT_RANGE (0, G_MAXINT),
+ "framerate", GST_PROPS_FLOAT_RANGE (0, G_MAXFLOAT));
+
+ caps = gst_caps_intersect(sizecaps1, gst_videoscale_get_capslist ());
+ gst_caps_unref (sizecaps1);
+ sizecaps1 = caps;
+ caps = gst_caps_intersect(sizecaps2, gst_videoscale_get_capslist ());
+ gst_caps_unref (sizecaps2);
+ sizecaps2 = caps;
+ caps = gst_caps_append(sizecaps1, sizecaps2);
return caps;
}
/* planar */
{ "YV12", 12, gst_videoscale_planar411, },
{ "I420", 12, gst_videoscale_planar411, },
- { "IYUV", 12, gst_videoscale_planar411, },
{ "Y800", 8, gst_videoscale_planar400, },
- { "Y8 ", 8, gst_videoscale_planar400, },
/* RGB */
{ "RGB ", 32, gst_videoscale_32bit, 24, G_BIG_ENDIAN, 0x00ff0000, 0x0000ff00, 0x000000ff },
{ "RGB ", 32, gst_videoscale_32bit, 24, G_BIG_ENDIAN, 0x000000ff, 0x0000ff00, 0x00ff0000 },
fourcc = GST_MAKE_FOURCC(format->fourcc[0],format->fourcc[1],format->fourcc[2],format->fourcc[3]);
if(format->bpp){
- caps = GST_CAPS_NEW ("videoscale", "video/raw",
- "format", GST_PROPS_FOURCC (fourcc),
+ caps = GST_CAPS_NEW ("videoscale", "video/x-raw-rgb",
"depth", GST_PROPS_INT(format->bpp),
"bpp", GST_PROPS_INT(format->depth),
"endianness", GST_PROPS_INT(format->endianness),
"green_mask", GST_PROPS_INT(format->green_mask),
"blue_mask", GST_PROPS_INT(format->blue_mask));
}else{
- caps = GST_CAPS_NEW ("videoscale", "video/raw",
+ caps = GST_CAPS_NEW ("videoscale", "video/x-raw-yuv",
"format", GST_PROPS_FOURCC (fourcc));
}
static GstPadTemplate *templ = NULL;
if(!templ){
- GstCaps *caps = GST_CAPS_NEW("src","video/raw",
- "width", GST_PROPS_INT_RANGE (0, G_MAXINT),
- "height", GST_PROPS_INT_RANGE (0, G_MAXINT));
-
- caps = gst_caps_intersect(caps, gst_videotestsrc_get_capslist ());
+ GstCaps *caps;
+ GstCaps *caps1 = GST_CAPS_NEW("src","video/x-raw-yuv",
+ "width", GST_PROPS_INT_RANGE (0, G_MAXINT),
+ "height", GST_PROPS_INT_RANGE (0, G_MAXINT),
+ "framerate", GST_PROPS_FLOAT_RANGE (0, G_MAXFLOAT));
+ GstCaps *caps2 = GST_CAPS_NEW("src","video/x-raw-rgb",
+ "width", GST_PROPS_INT_RANGE (0, G_MAXINT),
+ "height", GST_PROPS_INT_RANGE (0, G_MAXINT),
+ "framerate", GST_PROPS_FLOAT_RANGE (0, G_MAXFLOAT));
+
+ caps = gst_caps_intersect(caps1, gst_videotestsrc_get_capslist ());
+ gst_caps_unref (caps1);
+ caps1 = caps;
+ caps = gst_caps_intersect(caps2, gst_videotestsrc_get_capslist ());
+ gst_caps_unref (caps2);
+ caps2 = caps;
+ caps = gst_caps_append(caps1, caps2);
templ = GST_PAD_TEMPLATE_NEW("src", GST_PAD_SRC, GST_PAD_ALWAYS, caps);
}
g_param_spec_string ("fourcc", "fourcc", "fourcc",
NULL, G_PARAM_READWRITE));
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_RATE,
- g_param_spec_int ("rate", "Rate", "Frame rate",
- 1, 100, 30, G_PARAM_READWRITE));
+ g_param_spec_float ("fps", "FPS", "Frame rate",
+ 0., G_MAXFLOAT, 30., G_PARAM_READWRITE));
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_TYPE,
g_param_spec_enum ("pattern", "Pattern", "Type of test pattern to generate",
GST_TYPE_VIDEOTESTSRC_PATTERN, 1, G_PARAM_READWRITE));
gst_caps_get_int (caps, "width", &videotestsrc->width);
gst_caps_get_int (caps, "height", &videotestsrc->height);
+ gst_caps_get_float (caps, "framerate", &videotestsrc->rate);
videotestsrc->bpp = videotestsrc->fourcc->bitspp;
}
if(vts->width){
- caps2 = GST_CAPS_NEW("ack","video/raw",
+ caps2 = gst_caps_append(
+ GST_CAPS_NEW("ack","video/x-raw-yuv",
+ "width",GST_PROPS_INT(vts->width),
+ "height",GST_PROPS_INT(vts->height),
+ "framerate", GST_PROPS_FLOAT(vts->rate)),
+ GST_CAPS_NEW("ack","video/x-raw-rgb",
"width",GST_PROPS_INT(vts->width),
- "height",GST_PROPS_INT(vts->height));
+ "height",GST_PROPS_INT(vts->height),
+ "framerate", GST_PROPS_FLOAT(vts->rate)));
}else{
- caps2 = GST_CAPS_NEW("ack","video/raw",
+ caps2 = gst_caps_append(
+ GST_CAPS_NEW("ack","video/x-raw-yuv",
+ "width",GST_PROPS_INT_RANGE(16,4096),
+ "height",GST_PROPS_INT_RANGE(16,4096),
+ "framerate", GST_PROPS_FLOAT_RANGE(0, G_MAXFLOAT)),
+ GST_CAPS_NEW("ack","video/x-raw-rgb",
"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)));
}
/* ref intersection and return it */
videotestsrc->sync = TRUE;
videotestsrc->width = 640;
videotestsrc->height = 480;
- videotestsrc->rate = 30;
+ videotestsrc->rate = 30.;
videotestsrc->timestamp = 0;
videotestsrc->interval = GST_SECOND / videotestsrc->rate;
}
}
break;
case ARG_RATE:
- src->rate = g_value_get_int (value);
+ src->rate = g_value_get_float (value);
src->interval = GST_SECOND/src->rate;
break;
case ARG_TYPE:
g_value_set_string (value, src->forced_format);
break;
case ARG_RATE:
- g_value_set_int (value, src->rate);
+ g_value_set_float (value, src->rate);
break;
case ARG_TYPE:
g_value_set_enum (value, src->type);
gint64 timestamp;
gint64 interval;
gint bpp;
- int rate;
+ gfloat rate;
int type;
GstClock *clock;
{"YV12", "YV12", 12, paint_setup_YV12, paint_hline_I420},
/* I420 */
{"I420", "I420", 12, paint_setup_I420, paint_hline_I420},
- /* IYUV (same as I420) */
- {"IYUV", "IYUV", 12, paint_setup_I420, paint_hline_I420},
/* NV12 */
/* NV21 */
/* IMC1 */
/* Y42B */
/* Y800 grayscale */
{"Y800", "Y800", 8, paint_setup_Y800, paint_hline_Y800},
- /* Y8 same as Y800 */
- {"Y8 ", "Y8 ", 8, paint_setup_Y800, paint_hline_Y800},
/*{ "IYU2", 24, paint_setup_YVYU, paint_hline_YUY2 }, */
if(format->ext_caps){
#if GST_VERSION_MINOR > 6
caps = GST_CAPS_NEW ("videotestsrc_filter",
- "video/raw",
- "format", GST_PROPS_FOURCC (fourcc),
+ "video/x-raw-rgb",
"bpp", GST_PROPS_INT(format->bitspp),
"endianness", GST_PROPS_INT(G_BIG_ENDIAN),
"depth", GST_PROPS_INT(format->depth),
}
caps = GST_CAPS_NEW ("videotestsrc_filter",
- "video/raw",
- "format", GST_PROPS_FOURCC (fourcc),
+ "video/x-raw-rgb",
"bpp", GST_PROPS_INT(format->bitspp),
"endianness", GST_PROPS_INT(endianness),
"depth", GST_PROPS_INT(format->depth),
#endif
}else{
caps = GST_CAPS_NEW ("videotestsrc_filter",
- "video/raw",
+ "video/x-raw-yuv",
"format", GST_PROPS_FOURCC (fourcc));
}
"sink",
GST_PAD_SINK,
GST_PAD_ALWAYS,
- GST_CAPS_NEW (
+ gst_caps_new (
"volume_float_sink",
- "audio/raw",
- "rate", GST_PROPS_INT_RANGE (1, G_MAXINT),
- "format", GST_PROPS_STRING ("float"),
- "layout", GST_PROPS_STRING ("gfloat"),
- "intercept", GST_PROPS_FLOAT(0.0),
- "slope", GST_PROPS_FLOAT(1.0),
- "channels", GST_PROPS_INT (1)
+ "audio/x-raw-float",
+ GST_AUDIO_FLOAT_MONO_PAD_TEMPLATE_PROPS
),
GST_CAPS_NEW (
"volume_int_sink",
- "audio/raw",
- "format", GST_PROPS_STRING ("int"),
- "channels", GST_PROPS_INT_RANGE (1, G_MAXINT),
- "rate", GST_PROPS_INT_RANGE (1, G_MAXINT),
- "law", GST_PROPS_INT (0),
- "endianness", GST_PROPS_INT (G_BYTE_ORDER),
- "width", GST_PROPS_INT (16),
- "depth", GST_PROPS_INT (16),
- "signed", GST_PROPS_BOOLEAN (TRUE)
+ "audio/x-raw-int",
+ "channels", GST_PROPS_INT_RANGE (1, G_MAXINT),
+ "rate", GST_PROPS_INT_RANGE (1, G_MAXINT),
+ "endianness", GST_PROPS_INT (G_BYTE_ORDER),
+ "width", GST_PROPS_INT (16),
+ "depth", GST_PROPS_INT (16),
+ "signed", GST_PROPS_BOOLEAN (TRUE)
)
);
"src",
GST_PAD_SRC,
GST_PAD_ALWAYS,
- GST_CAPS_NEW (
+ gst_caps_new (
"volume_float_src",
- "audio/raw",
- "rate", GST_PROPS_INT_RANGE (1, G_MAXINT),
- "format", GST_PROPS_STRING ("float"),
- "layout", GST_PROPS_STRING ("gfloat"),
- "intercept", GST_PROPS_FLOAT(0.0),
- "slope", GST_PROPS_FLOAT(1.0),
- "channels", GST_PROPS_INT (1)
+ "audio/x-raw-float",
+ GST_AUDIO_FLOAT_MONO_PAD_TEMPLATE_PROPS
),
GST_CAPS_NEW (
"volume_int_src",
- "audio/raw",
- "format", GST_PROPS_STRING ("int"),
- "channels", GST_PROPS_INT_RANGE (1, G_MAXINT),
- "rate", GST_PROPS_INT_RANGE (1, G_MAXINT),
- "law", GST_PROPS_INT (0),
- "endianness", GST_PROPS_INT (G_BYTE_ORDER),
- "width", GST_PROPS_INT (16),
- "depth", GST_PROPS_INT (16),
- "signed", GST_PROPS_BOOLEAN (TRUE)
+ "audio/x-raw-int",
+ "channels", GST_PROPS_INT_RANGE (1, G_MAXINT),
+ "rate", GST_PROPS_INT_RANGE (1, G_MAXINT),
+ "endianness", GST_PROPS_INT (G_BYTE_ORDER),
+ "width", GST_PROPS_INT (16),
+ "depth", GST_PROPS_INT (16),
+ "signed", GST_PROPS_BOOLEAN (TRUE)
)
);
static gboolean
volume_parse_caps (GstVolume *filter, GstCaps *caps)
{
- const gchar *format;
+ const gchar *mimetype;
g_return_val_if_fail(filter!=NULL,FALSE);
g_return_val_if_fail(caps!=NULL,FALSE);
- gst_caps_get_string (caps, "format", &format);
+ mimetype = gst_caps_get_mime (caps);
- if (strcmp(format, "int")==0) {
+ if (strcmp(mimetype, "audio/x-raw-int")==0) {
gst_pad_set_chain_function(filter->sinkpad,volume_chain_int16);
return TRUE;
}
- if (strcmp(format, "float")==0) {
+ if (strcmp(mimetype, "audio/x-raw-float")==0) {
gst_pad_set_chain_function(filter->sinkpad,volume_chain_float);
return TRUE;
}
VCD_DIR=
endif
-if USE_XVIDEO
+if USE_XFREE
XVIDEO_DIR=xvideo
else
XVIDEO_DIR=
+REMOVE list (HEAD)
+==================
+* xmms (depends on glib-1.2)
+* avifile (ffmpeg)
+* openquicktime (qtdemux)
+* stereo2mono/mono2stereo/int2float/float2int (audioconvert)
+* hermes (lcs)
+* mjpegtools (jpeg does the same, make it depend on libjpegmmx instead)
+* modplug (mikmod)
+* vga (unmaintained, not-working)
+* videosink (xvideo)
+* aviaudiodecoder (useless)
+* monkeymedia (licensing issues)
+* wavparse/enc goes in same dir
+* mulaw/alaw become separate mimetypes
+
TODO list (short term):
=======================
* v4lsrc/v4lmjpegsrc/v4l2src: fix interlacing (not handled at all...)
g_return_val_if_fail(factory != NULL, FALSE);
caps = gst_caps_new ("v4lmjpegsink_caps",
- "video/jpeg",
+ "video/x-jpeg",
gst_props_new (
- "width", GST_PROPS_INT_RANGE (0, G_MAXINT),
- "height", GST_PROPS_INT_RANGE (0, G_MAXINT),
+ "width", GST_PROPS_INT_RANGE (0, G_MAXINT),
+ "height", GST_PROPS_INT_RANGE (0, G_MAXINT),
+ "framerate", GST_PROPS_FLOAT_RANGE (0, G_MAXFLOAT),
NULL )
);
capslist = gst_caps_append(capslist, caps);
}
-static gdouble
+static gfloat
gst_v4lmjpegsrc_get_fps (GstV4lMjpegSrc *v4lmjpegsrc)
{
gint norm;
- gdouble fps;
+ gfloat fps;
if (!v4lmjpegsrc->use_fixed_fps &&
v4lmjpegsrc->clock != NULL &&
gint max_w = GST_V4LELEMENT(v4lmjpegsrc)->vcap.maxwidth,
max_h = GST_V4LELEMENT(v4lmjpegsrc)->vcap.maxheight;
gulong bufsize;
+ gfloat fps = gst_v4lmjpegsrc_get_fps(v4lmjpegsrc);
/* in case the buffers are active (which means that we already
* did capsnego before and didn't clean up), clean up anyways */
/* Note: basically, we don't give a damn about the opposite caps here.
* that might seem odd, but it isn't. we know that the opposite caps is
- * either NULL or has mime type video/jpeg, and in both cases, we'll set
+ * either NULL or has mime type video/x-jpeg, and in both cases, we'll set
* our own mime type back and it'll work. Other properties are to be set
* by the src, not by the opposite caps */
/* we now have an actual width/height - *set it* */
caps = gst_caps_new("v4lmjpegsrc_caps",
- "video/jpeg",
+ "video/x-jpeg",
gst_props_new(
- "width", GST_PROPS_INT(v4lmjpegsrc->end_width),
- "height", GST_PROPS_INT(v4lmjpegsrc->end_height),
+ "width", GST_PROPS_INT(v4lmjpegsrc->end_width),
+ "height", GST_PROPS_INT(v4lmjpegsrc->end_height),
+ "framerate", GST_PROPS_FLOAT(fps),
NULL ) );
if ((ret_val = gst_pad_try_set_caps(v4lmjpegsrc->srcpad, caps)) == GST_PAD_LINK_REFUSED)
return GST_PAD_LINK_REFUSED;
}
caps = GST_CAPS_NEW("v4lmjpegsrc_jpeg_caps",
- "video/jpeg",
+ "video/x-jpeg",
"width", GST_PROPS_INT_RANGE(vcap->maxwidth/4,
vcap->maxwidth),
"height", GST_PROPS_INT_RANGE(vcap->maxheight/4,
vcap->maxheight),
+ "framerate", GST_PROPS_FLOAT_RANGE(0, G_MAXFLOAT),
NULL);
return caps;
g_return_val_if_fail(factory != NULL, FALSE);
caps = gst_caps_new ("v4lmjpegsrc_caps",
- "video/jpeg",
+ "video/x-jpeg",
gst_props_new (
- "width", GST_PROPS_INT_RANGE (0, G_MAXINT),
- "height", GST_PROPS_INT_RANGE (0, G_MAXINT),
+ "width", GST_PROPS_INT_RANGE (0, G_MAXINT),
+ "height", GST_PROPS_INT_RANGE (0, G_MAXINT),
+ "framerate", GST_PROPS_FLOAT_RANGE (0, G_MAXFLOAT),
NULL )
);
capslist = gst_caps_append(capslist, caps);
#include <string.h>
#include <sys/time.h>
#include "v4lsrc_calls.h"
+#include <gst/video/video.h>
/* elementfactory information */
static GstElementDetails gst_v4lsrc_details = {
}
-static gdouble
+static gfloat
gst_v4lsrc_get_fps (GstV4lSrc *v4lsrc)
{
gint norm;
- gdouble fps;
+ gfloat fps;
if (!v4lsrc->use_fixed_fps &&
v4lsrc->clock != NULL &&
static GstCaps *
gst_v4lsrc_palette_to_caps (int palette,
GstPropsEntry *width,
- GstPropsEntry *height)
+ GstPropsEntry *height,
+ GstPropsEntry *fps)
{
guint32 fourcc;
GstCaps *caps;
}
if (fourcc == GST_MAKE_FOURCC('R','G','B',' ')) {
- gint depth = 0;
+ gint depth = 0, endianness = 0;
guint32 r_mask = 0, g_mask = 0, b_mask = 0;
switch (palette) {
case VIDEO_PALETTE_RGB555:
- depth = 15;
+ depth = 15; endianness = G_BYTE_ORDER;
r_mask = 0x7c00; g_mask = 0x03e0; b_mask = 0x001f;
break;
case VIDEO_PALETTE_RGB565:
- depth = 16;
+ depth = 16; endianness = G_BYTE_ORDER;
r_mask = 0xf800; g_mask = 0x07f0; b_mask = 0x001f;
break;
case VIDEO_PALETTE_RGB24:
- depth = 24;
- r_mask = 0xff0000; g_mask = 0x00ff00; b_mask = 0x0000ff;
+ depth = 24; endianness = G_BIG_ENDIAN;
+ r_mask = R_MASK_24; g_mask = G_MASK_24; b_mask = B_MASK_24;
break;
case VIDEO_PALETTE_RGB32:
- depth = 32;
- r_mask = 0x00ff0000; g_mask = 0x0000ff00; b_mask = 0x000000ff;
+ depth = 32; endianness = G_BIG_ENDIAN;
+ r_mask = R_MASK_32; g_mask = G_MASK_32; b_mask = B_MASK_32;
break;
default:
g_assert_not_reached();
}
caps = GST_CAPS_NEW("v4lsrc_rgb_caps",
- "video/raw",
- "format", GST_PROPS_FOURCC(fourcc),
+ "video/x-raw-rgb",
"bpp", GST_PROPS_INT((depth+1) & ~1),
"depth", GST_PROPS_INT(depth),
"endianness", GST_PROPS_INT(G_BYTE_ORDER),
NULL);
} else {
caps = GST_CAPS_NEW("v4lsrc_yuv_caps",
- "video/raw",
+ "video/x-raw-yuv",
"format", GST_PROPS_FOURCC(fourcc),
NULL);
}
gst_props_add_entry(caps->properties, width);
gst_props_add_entry(caps->properties, height);
+ gst_props_add_entry(caps->properties, fps);
return caps;
}
-#define gst_v4lsrc_palette_to_caps_fixed(palette, width, height) \
+#define gst_v4lsrc_palette_to_caps_fixed(palette, width, height, fps) \
gst_v4lsrc_palette_to_caps(palette, \
gst_props_entry_new("width", \
GST_PROPS_INT(width)), \
gst_props_entry_new("height", \
- GST_PROPS_INT(height)) \
+ GST_PROPS_INT(height)), \
+ gst_props_entry_new("framerate", \
+ GST_PROPS_FLOAT(fps)) \
)
#define gst_v4lsrc_palette_to_caps_range(palette, min_w, max_w, min_h, max_h) \
gst_v4lsrc_palette_to_caps(palette, \
max_w)), \
gst_props_entry_new("height", \
GST_PROPS_INT_RANGE(min_h, \
- max_h)) \
+ max_h)), \
+ gst_props_entry_new("framerate", \
+ GST_PROPS_FLOAT_RANGE(0., \
+ G_MAXFLOAT)) \
)
#define gst_caps_get_int_range(caps, name, min, max) \
guint32 fourcc;
gint depth, w, h;
- gst_caps_get_fourcc_int (caps, "format", &fourcc);
+ if (!strcmp(gst_caps_get_mime(caps), "video/x-raw-yuv"))
+ gst_caps_get_fourcc_int (caps, "format", &fourcc);
+ else
+ fourcc = GST_MAKE_FOURCC('R','G','B',' ');
+
if (gst_caps_has_property(caps, "width")) {
if (gst_caps_has_fixed_property(caps, "width")) {
gst_caps_get_int(caps, "width", &w);
continue;
/* try to connect the pad/caps with the actual width/height */
- newcaps = gst_v4lsrc_palette_to_caps_fixed(palette, w, h);
+ newcaps = gst_v4lsrc_palette_to_caps_fixed(palette, w, h,
+ gst_v4lsrc_get_fps(v4lsrc));
gst_caps_debug (newcaps, "new caps to set on v4lsrc's src pad");