mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-23 18:21:04 +00:00
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:
parent
d4d7574625
commit
b005531324
24 changed files with 496 additions and 315 deletions
39
configure.ac
39
configure.ac
|
@ -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"
|
||||
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
|
||||
|
|
|
@ -1006,7 +1006,7 @@ gst_alsa_src_set_caps (GstAlsaSrc *src, gboolean aggressive)
|
|||
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);
|
||||
|
||||
|
@ -1022,9 +1022,7 @@ gst_alsa_src_set_caps (GstAlsaSrc *src, gboolean aggressive)
|
|||
}
|
||||
|
||||
/* 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),
|
||||
|
@ -1037,13 +1035,12 @@ gst_alsa_src_set_caps (GstAlsaSrc *src, gboolean aggressive)
|
|||
/* 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));
|
||||
|
@ -1057,8 +1054,8 @@ gst_alsa_src_set_caps (GstAlsaSrc *src, gboolean aggressive)
|
|||
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);
|
||||
|
||||
|
@ -1234,25 +1231,23 @@ found_channel:
|
|||
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;
|
||||
|
@ -1268,33 +1263,13 @@ gst_alsa_get_format (GstCaps *caps)
|
|||
}
|
||||
|
||||
/* 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))
|
||||
|
@ -1303,7 +1278,7 @@ gst_alsa_get_format (GstCaps *caps)
|
|||
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) {
|
||||
|
@ -1311,7 +1286,7 @@ gst_alsa_get_format (GstCaps *caps)
|
|||
} 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) {
|
||||
|
@ -1322,7 +1297,11 @@ gst_alsa_get_format (GstCaps *caps)
|
|||
} 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,
|
||||
|
@ -1347,18 +1326,22 @@ gst_alsa_formats_match (GstAlsaFormat *one, GstAlsaFormat *two)
|
|||
(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),
|
||||
|
@ -1387,16 +1370,17 @@ gst_alsa_get_props (snd_pcm_format_t format)
|
|||
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;
|
||||
|
@ -1433,23 +1417,24 @@ gst_alsa_caps (snd_pcm_format_t format, gint rate, gint channels)
|
|||
|
||||
if (format != SND_PCM_FORMAT_UNKNOWN) {
|
||||
/* there are some caps set already */
|
||||
GstProps *props = gst_alsa_get_props (format);
|
||||
/* we can never use a format we can't set caps for */
|
||||
g_assert (props != NULL);
|
||||
ret_caps = gst_alsa_get_caps_internal (format);
|
||||
|
||||
add_channels (props, rate, -1, channels, -1);
|
||||
ret_caps = gst_caps_new (g_strdup (snd_pcm_format_name (format)), "audio/raw", props);
|
||||
/* we can never use a format we can't set caps for */
|
||||
g_assert (ret_caps != NULL);
|
||||
g_assert (ret_caps->properties != NULL);
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1485,18 +1470,18 @@ gst_alsa_get_caps (GstPad *pad, GstCaps *caps)
|
|||
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);
|
||||
|
|
|
@ -60,9 +60,7 @@ GST_PAD_TEMPLATE_FACTORY (cdparanoia_src_factory,
|
|||
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),
|
||||
|
|
|
@ -36,7 +36,7 @@ vorbis_caps_factory (void)
|
|||
return
|
||||
gst_caps_new (
|
||||
"vorbis_vorbis",
|
||||
"application/x-ogg",
|
||||
"application/ogg",
|
||||
NULL);
|
||||
}
|
||||
|
||||
|
@ -46,10 +46,8 @@ raw_caps_factory (void)
|
|||
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),
|
||||
|
@ -65,10 +63,12 @@ raw_caps2_factory (void)
|
|||
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));
|
||||
|
@ -76,7 +76,7 @@ raw_caps2_factory (void)
|
|||
|
||||
static GstTypeDefinition vorbisdefinition = {
|
||||
"vorbis_audio/x-ogg",
|
||||
"application/x-ogg",
|
||||
"application/ogg",
|
||||
".ogg",
|
||||
vorbis_type_find,
|
||||
};
|
||||
|
@ -98,7 +98,7 @@ vorbis_type_find (GstBuffer *buf, gpointer private)
|
|||
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 */
|
||||
|
@ -110,7 +110,7 @@ vorbis_type_find (GstBuffer *buf, gpointer private)
|
|||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -148,7 +148,7 @@ gst_vorbisenc_class_init (VorbisEncClass * klass)
|
|||
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));
|
||||
|
|
|
@ -467,9 +467,7 @@ gst_vorbisfile_new_link (VorbisFile *vorbisfile, gint link)
|
|||
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),
|
||||
|
|
|
@ -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, \
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -58,9 +58,9 @@ GST_PAD_TEMPLATE_FACTORY (gst_adder_src_template_factory,
|
|||
"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)
|
||||
);
|
||||
|
||||
|
@ -68,9 +68,9 @@ GST_PAD_TEMPLATE_FACTORY (gst_adder_sink_template_factory,
|
|||
"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)
|
||||
);
|
||||
|
||||
|
@ -111,29 +111,27 @@ gst_adder_get_type (void) {
|
|||
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);
|
||||
|
@ -142,7 +140,7 @@ gst_adder_parse_caps (GstAdder *adder, GstCaps *caps)
|
|||
} 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;
|
||||
|
||||
|
@ -179,7 +177,7 @@ gst_adder_parse_caps (GstAdder *adder, GstCaps *caps)
|
|||
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);
|
||||
|
@ -200,9 +198,6 @@ gst_adder_parse_caps (GstAdder *adder, GstCaps *caps)
|
|||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -526,13 +521,11 @@ gst_adder_loop (GstElement *element)
|
|||
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));
|
||||
|
@ -623,4 +616,3 @@ GstPluginDesc plugin_desc = {
|
|||
"adder",
|
||||
plugin_init
|
||||
};
|
||||
|
||||
|
|
|
@ -127,9 +127,7 @@ GST_PAD_TEMPLATE_FACTORY (audio_convert_src_template_factory,
|
|||
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)
|
||||
|
@ -155,9 +153,7 @@ GST_PAD_TEMPLATE_FACTORY (audio_convert_sink_template_factory,
|
|||
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)
|
||||
|
@ -403,9 +399,7 @@ make_caps (gint endianness, gboolean sign, gint depth, gint width, gint rate, gi
|
|||
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),
|
||||
|
@ -415,9 +409,7 @@ make_caps (gint endianness, gboolean sign, gint depth, gint width, gint rate, gi
|
|||
} 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),
|
||||
|
|
|
@ -54,37 +54,23 @@ enum {
|
|||
/* FILL ME */
|
||||
};
|
||||
|
||||
static GstPadTemplate *
|
||||
sink_template (void)
|
||||
{
|
||||
static GstPadTemplate *template = NULL;
|
||||
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)
|
||||
);
|
||||
|
||||
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 (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
|
||||
|
@ -211,12 +197,14 @@ gst_audioscale_init (Audioscale *audioscale)
|
|||
{
|
||||
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);
|
||||
|
||||
|
@ -331,6 +319,10 @@ plugin_init (GModule *module, GstPlugin *plugin)
|
|||
/* 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 */
|
||||
|
|
|
@ -65,9 +65,7 @@ GST_PAD_TEMPLATE_FACTORY (sinesrc_src_factory,
|
|||
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),
|
||||
|
@ -423,9 +421,7 @@ gst_sinesrc_force_caps (GstSineSrc *src) {
|
|||
|
||||
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),
|
||||
|
|
|
@ -135,11 +135,23 @@ gst_videoscale_src_template_factory(void)
|
|||
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);
|
||||
}
|
||||
|
@ -152,11 +164,23 @@ gst_videoscale_sink_template_factory(void)
|
|||
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));
|
||||
"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_SINK, GST_PAD_ALWAYS, caps);
|
||||
}
|
||||
|
@ -190,7 +214,7 @@ gst_videoscale_getcaps (GstPad *pad, GstCaps *caps)
|
|||
GstVideoscale *videoscale;
|
||||
GstCaps *capslist = NULL;
|
||||
GstCaps *peercaps;
|
||||
GstCaps *sizecaps;
|
||||
GstCaps *sizecaps1, *sizecaps2;
|
||||
int i;
|
||||
|
||||
GST_DEBUG ("gst_videoscale_src_link");
|
||||
|
@ -216,12 +240,22 @@ gst_videoscale_getcaps (GstPad *pad, GstCaps *caps)
|
|||
}
|
||||
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));
|
||||
"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(caps, gst_videoscale_get_capslist ());
|
||||
gst_caps_unref (sizecaps);
|
||||
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;
|
||||
}
|
||||
|
|
|
@ -74,9 +74,7 @@ struct videoscale_format_struct videoscale_formats[] = {
|
|||
/* 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 },
|
||||
|
@ -102,8 +100,7 @@ videoscale_get_caps(struct videoscale_format_struct *format)
|
|||
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),
|
||||
|
@ -111,7 +108,7 @@ videoscale_get_caps(struct videoscale_format_struct *format)
|
|||
"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));
|
||||
}
|
||||
|
||||
|
|
|
@ -86,11 +86,23 @@ videotestsrc_src_template_factory(void)
|
|||
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));
|
||||
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(caps, gst_videotestsrc_get_capslist ());
|
||||
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);
|
||||
}
|
||||
|
@ -158,8 +170,8 @@ gst_videotestsrc_class_init (GstVideotestsrcClass * klass)
|
|||
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));
|
||||
|
@ -232,6 +244,7 @@ gst_videotestsrc_srcconnect (GstPad * pad, GstCaps * caps)
|
|||
|
||||
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;
|
||||
|
||||
|
@ -305,13 +318,25 @@ gst_videotestsrc_getcaps (GstPad * pad, GstCaps * caps)
|
|||
}
|
||||
|
||||
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));
|
||||
"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),
|
||||
"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));
|
||||
"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),
|
||||
"framerate", GST_PROPS_FLOAT_RANGE(0, G_MAXFLOAT)));
|
||||
}
|
||||
|
||||
/* ref intersection and return it */
|
||||
|
@ -341,7 +366,7 @@ gst_videotestsrc_reset (GstVideotestsrc *videotestsrc)
|
|||
videotestsrc->sync = TRUE;
|
||||
videotestsrc->width = 640;
|
||||
videotestsrc->height = 480;
|
||||
videotestsrc->rate = 30;
|
||||
videotestsrc->rate = 30.;
|
||||
videotestsrc->timestamp = 0;
|
||||
videotestsrc->interval = GST_SECOND / videotestsrc->rate;
|
||||
}
|
||||
|
@ -453,7 +478,7 @@ gst_videotestsrc_set_property (GObject * object, guint prop_id, const GValue * v
|
|||
}
|
||||
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:
|
||||
|
@ -487,7 +512,7 @@ gst_videotestsrc_get_property (GObject * object, guint prop_id, GValue * value,
|
|||
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);
|
||||
|
|
|
@ -65,7 +65,7 @@ struct _GstVideotestsrc {
|
|||
gint64 timestamp;
|
||||
gint64 interval;
|
||||
gint bpp;
|
||||
int rate;
|
||||
gfloat rate;
|
||||
int type;
|
||||
GstClock *clock;
|
||||
|
||||
|
|
|
@ -339,8 +339,6 @@ struct fourcc_list_struct fourcc_list[] = {
|
|||
{"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 */
|
||||
|
@ -356,8 +354,6 @@ struct fourcc_list_struct fourcc_list[] = {
|
|||
/* 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 }, */
|
||||
|
||||
|
@ -442,8 +438,7 @@ GstCaps *paint_get_caps(struct fourcc_list_struct *format)
|
|||
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),
|
||||
|
@ -480,8 +475,7 @@ GstCaps *paint_get_caps(struct fourcc_list_struct *format)
|
|||
}
|
||||
|
||||
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),
|
||||
|
@ -491,7 +485,7 @@ GstCaps *paint_get_caps(struct fourcc_list_struct *format)
|
|||
#endif
|
||||
}else{
|
||||
caps = GST_CAPS_NEW ("videotestsrc_filter",
|
||||
"video/raw",
|
||||
"video/x-raw-yuv",
|
||||
"format", GST_PROPS_FOURCC (fourcc));
|
||||
}
|
||||
|
||||
|
|
|
@ -57,27 +57,20 @@ GST_PAD_TEMPLATE_FACTORY (volume_sink_factory,
|
|||
"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)
|
||||
)
|
||||
);
|
||||
|
||||
|
@ -85,27 +78,20 @@ GST_PAD_TEMPLATE_FACTORY (volume_src_factory,
|
|||
"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)
|
||||
)
|
||||
);
|
||||
|
||||
|
@ -165,19 +151,19 @@ volume_connect (GstPad *pad, GstCaps *caps)
|
|||
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;
|
||||
}
|
||||
|
|
|
@ -34,7 +34,7 @@ else
|
|||
VCD_DIR=
|
||||
endif
|
||||
|
||||
if USE_XVIDEO
|
||||
if USE_XFREE
|
||||
XVIDEO_DIR=xvideo
|
||||
else
|
||||
XVIDEO_DIR=
|
||||
|
|
16
sys/v4l/TODO
16
sys/v4l/TODO
|
@ -1,3 +1,19 @@
|
|||
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...)
|
||||
|
|
|
@ -483,10 +483,11 @@ plugin_init (GModule *module,
|
|||
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);
|
||||
|
|
|
@ -253,11 +253,11 @@ gst_v4lmjpegsrc_init (GstV4lMjpegSrc *v4lmjpegsrc)
|
|||
}
|
||||
|
||||
|
||||
static gdouble
|
||||
static gfloat
|
||||
gst_v4lmjpegsrc_get_fps (GstV4lMjpegSrc *v4lmjpegsrc)
|
||||
{
|
||||
gint norm;
|
||||
gdouble fps;
|
||||
gfloat fps;
|
||||
|
||||
if (!v4lmjpegsrc->use_fixed_fps &&
|
||||
v4lmjpegsrc->clock != NULL &&
|
||||
|
@ -366,6 +366,7 @@ gst_v4lmjpegsrc_srcconnect (GstPad *pad,
|
|||
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 */
|
||||
|
@ -381,7 +382,7 @@ gst_v4lmjpegsrc_srcconnect (GstPad *pad,
|
|||
|
||||
/* 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 */
|
||||
|
||||
|
@ -464,10 +465,11 @@ gst_v4lmjpegsrc_srcconnect (GstPad *pad,
|
|||
|
||||
/* 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;
|
||||
|
@ -603,11 +605,12 @@ gst_v4lmjpegsrc_getcaps (GstPad *pad,
|
|||
}
|
||||
|
||||
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;
|
||||
|
@ -857,10 +860,11 @@ plugin_init (GModule *module, GstPlugin *plugin)
|
|||
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);
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
#include <string.h>
|
||||
#include <sys/time.h>
|
||||
#include "v4lsrc_calls.h"
|
||||
#include <gst/video/video.h>
|
||||
|
||||
/* elementfactory information */
|
||||
static GstElementDetails gst_v4lsrc_details = {
|
||||
|
@ -209,11 +210,11 @@ gst_v4lsrc_init (GstV4lSrc *v4lsrc)
|
|||
}
|
||||
|
||||
|
||||
static gdouble
|
||||
static gfloat
|
||||
gst_v4lsrc_get_fps (GstV4lSrc *v4lsrc)
|
||||
{
|
||||
gint norm;
|
||||
gdouble fps;
|
||||
gfloat fps;
|
||||
|
||||
if (!v4lsrc->use_fixed_fps &&
|
||||
v4lsrc->clock != NULL &&
|
||||
|
@ -286,7 +287,8 @@ gst_v4lsrc_srcconvert (GstPad *pad,
|
|||
static GstCaps *
|
||||
gst_v4lsrc_palette_to_caps (int palette,
|
||||
GstPropsEntry *width,
|
||||
GstPropsEntry *height)
|
||||
GstPropsEntry *height,
|
||||
GstPropsEntry *fps)
|
||||
{
|
||||
guint32 fourcc;
|
||||
GstCaps *caps;
|
||||
|
@ -316,25 +318,25 @@ gst_v4lsrc_palette_to_caps (int palette,
|
|||
}
|
||||
|
||||
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();
|
||||
|
@ -342,8 +344,7 @@ gst_v4lsrc_palette_to_caps (int palette,
|
|||
}
|
||||
|
||||
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),
|
||||
|
@ -353,23 +354,26 @@ gst_v4lsrc_palette_to_caps (int palette,
|
|||
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, \
|
||||
|
@ -378,7 +382,10 @@ gst_v4lsrc_palette_to_caps (int 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) \
|
||||
|
@ -415,7 +422,11 @@ gst_v4lsrc_srcconnect (GstPad *pad,
|
|||
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);
|
||||
|
@ -490,7 +501,8 @@ gst_v4lsrc_srcconnect (GstPad *pad,
|
|||
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");
|
||||
|
||||
|
|
Loading…
Reference in a new issue