mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-05 05:52:37 +00:00
Changed to the new props API
Original commit message from CVS: Changed to the new props API Other small tuff.
This commit is contained in:
parent
588431fc1d
commit
23d2a4198b
11 changed files with 140 additions and 81 deletions
|
@ -432,6 +432,14 @@ GST_CHECK_FEATURE(HTTP, [http plugins], gsthttpsrc, [
|
||||||
AC_SUBST(GST_HTTPSRC_GET_TYPE)
|
AC_SUBST(GST_HTTPSRC_GET_TYPE)
|
||||||
])
|
])
|
||||||
|
|
||||||
|
dnl *** Jack ***
|
||||||
|
translit(dnm, m, l) AM_CONDITIONAL(USE_LCS, true)
|
||||||
|
GST_CHECK_FEATURE(LCS, Lcs, lcs, [
|
||||||
|
PKG_CHECK_MODULES(LCS, lcs, HAVE_LCS="yes", HAVE_LCS="no")
|
||||||
|
AC_SUBST(LCS_CFLAGS)
|
||||||
|
AC_SUBST(LCS_LIBS)
|
||||||
|
])
|
||||||
|
|
||||||
dnl *** Jack ***
|
dnl *** Jack ***
|
||||||
translit(dnm, m, l) AM_CONDITIONAL(USE_JACK, true)
|
translit(dnm, m, l) AM_CONDITIONAL(USE_JACK, true)
|
||||||
GST_CHECK_FEATURE(JACK, Jack, jack, [
|
GST_CHECK_FEATURE(JACK, Jack, jack, [
|
||||||
|
@ -796,6 +804,7 @@ ext/hermes/Makefile
|
||||||
ext/http/Makefile
|
ext/http/Makefile
|
||||||
ext/jack/Makefile
|
ext/jack/Makefile
|
||||||
ext/jpeg/Makefile
|
ext/jpeg/Makefile
|
||||||
|
ext/lcs/Makefile
|
||||||
ext/ladspa/Makefile
|
ext/ladspa/Makefile
|
||||||
ext/lame/Makefile
|
ext/lame/Makefile
|
||||||
ext/mad/Makefile
|
ext/mad/Makefile
|
||||||
|
|
|
@ -318,7 +318,7 @@ gst_alsa_request_new_pad (GstElement *element, GstPadTemplate *templ, const gcha
|
||||||
GList *l;
|
GList *l;
|
||||||
GstAlsaPad *pad;
|
GstAlsaPad *pad;
|
||||||
|
|
||||||
g_return_val_if_fail (this = GST_ALSA(element), NULL);
|
g_return_val_if_fail ((this = GST_ALSA(element)), NULL);
|
||||||
|
|
||||||
/* you can't request a pad if the non-request pad is connected */
|
/* you can't request a pad if the non-request pad is connected */
|
||||||
g_return_val_if_fail (this->data_interleaved == FALSE ||
|
g_return_val_if_fail (this->data_interleaved == FALSE ||
|
||||||
|
@ -510,22 +510,22 @@ gst_alsa_change_state(GstElement *element)
|
||||||
static gboolean
|
static gboolean
|
||||||
gst_alsa_parse_caps (GstAlsa *this, GstCaps *caps)
|
gst_alsa_parse_caps (GstAlsa *this, GstCaps *caps)
|
||||||
{
|
{
|
||||||
gint law, endianness, width, depth;
|
gint law, endianness, width, depth, channels;
|
||||||
gboolean sign;
|
gboolean sign;
|
||||||
gint format = -1;
|
gint format = -1;
|
||||||
const gchar* format_name;
|
const gchar* format_name;
|
||||||
|
|
||||||
format_name = gst_caps_get_string(caps, "format");
|
gst_caps_get_string(caps, "format", &format_name);
|
||||||
|
|
||||||
if (format_name == NULL) {
|
if (format_name == NULL) {
|
||||||
return FALSE;
|
return FALSE;
|
||||||
} else if (strcmp(format_name, "int")==0) {
|
} else if (strcmp(format_name, "int")==0) {
|
||||||
width = gst_caps_get_int (caps, "width");
|
gst_caps_get_int (caps, "width", &width);
|
||||||
depth = gst_caps_get_int (caps, "depth");
|
gst_caps_get_int (caps, "depth", &depth);
|
||||||
|
|
||||||
law = gst_caps_get_int (caps, "law");
|
gst_caps_get_int (caps, "law", &law);
|
||||||
endianness = gst_caps_get_int (caps, "endianness");
|
gst_caps_get_int (caps, "endianness", &endianness);
|
||||||
sign = gst_caps_get_boolean (caps, "signed");
|
gst_caps_get_boolean (caps, "signed", &sign);
|
||||||
|
|
||||||
if (law == 0) {
|
if (law == 0) {
|
||||||
if (width == 8) {
|
if (width == 8) {
|
||||||
|
@ -585,7 +585,11 @@ gst_alsa_parse_caps (GstAlsa *this, GstCaps *caps)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
} else if (strcmp(format_name, "float")==0) {
|
} else if (strcmp(format_name, "float")==0) {
|
||||||
if (strcmp(gst_caps_get_string(caps, "layout"), "gfloat")==0) {
|
const gchar *layout;
|
||||||
|
|
||||||
|
gst_caps_get_string(caps, "layout", &layout);
|
||||||
|
|
||||||
|
if (strcmp(layout, "gfloat")==0) {
|
||||||
format = SND_PCM_FORMAT_FLOAT;
|
format = SND_PCM_FORMAT_FLOAT;
|
||||||
} else {
|
} else {
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
@ -597,10 +601,12 @@ gst_alsa_parse_caps (GstAlsa *this, GstCaps *caps)
|
||||||
}
|
}
|
||||||
|
|
||||||
this->format = format;
|
this->format = format;
|
||||||
this->rate = gst_caps_get_int(caps, "rate");
|
gst_caps_get_int(caps, "rate", &this->rate);
|
||||||
|
gst_caps_get_int(caps, "channels", &channels);
|
||||||
|
|
||||||
if (this->data_interleaved)
|
if (this->data_interleaved)
|
||||||
this->channels = gst_caps_get_int(caps, "channels");
|
this->channels = channels;
|
||||||
else if (gst_caps_get_int(caps, "channels") != 1)
|
else if (channels != 1)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
|
@ -119,8 +119,8 @@ gst_vorbisenc_sinkconnect (GstPad * pad, GstCaps * caps)
|
||||||
if (!GST_CAPS_IS_FIXED (caps))
|
if (!GST_CAPS_IS_FIXED (caps))
|
||||||
return GST_PAD_CONNECT_DELAYED;
|
return GST_PAD_CONNECT_DELAYED;
|
||||||
|
|
||||||
vorbisenc->channels = gst_caps_get_int (caps, "channels");
|
gst_caps_get_int (caps, "channels", &vorbisenc->channels);
|
||||||
vorbisenc->frequency = gst_caps_get_int (caps, "rate");
|
gst_caps_get_int (caps, "rate", &vorbisenc->frequency);
|
||||||
|
|
||||||
gst_vorbisenc_setup (vorbisenc);
|
gst_vorbisenc_setup (vorbisenc);
|
||||||
|
|
||||||
|
@ -165,8 +165,10 @@ gst_vorbisenc_setup (VorbisEnc * vorbisenc)
|
||||||
/* add a comment */
|
/* add a comment */
|
||||||
vorbis_comment_init (&vorbisenc->vc);
|
vorbis_comment_init (&vorbisenc->vc);
|
||||||
vorbis_comment_add (&vorbisenc->vc, (gchar *)comment);
|
vorbis_comment_add (&vorbisenc->vc, (gchar *)comment);
|
||||||
|
/*
|
||||||
gst_element_send_event (GST_ELEMENT (vorbisenc),
|
gst_element_send_event (GST_ELEMENT (vorbisenc),
|
||||||
gst_event_new_info ("comment", GST_PROPS_STRING (comment), NULL));
|
gst_event_new_info ("comment", GST_PROPS_STRING (comment), NULL));
|
||||||
|
*/
|
||||||
|
|
||||||
/* set up the analysis state and auxiliary encoding storage */
|
/* set up the analysis state and auxiliary encoding storage */
|
||||||
vorbis_analysis_init (&vorbisenc->vd, &vorbisenc->vi);
|
vorbis_analysis_init (&vorbisenc->vd, &vorbisenc->vi);
|
||||||
|
|
|
@ -40,8 +40,8 @@ gst_audio_frame_byte_size (GstPad* pad)
|
||||||
/* ERROR: could not get caps of pad */
|
/* ERROR: could not get caps of pad */
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
width = gst_caps_get_int (caps, "width");
|
gst_caps_get_int (caps, "width", &width);
|
||||||
channels = gst_caps_get_int (caps, "channels");
|
gst_caps_get_int (caps, "channels", &channels);
|
||||||
return (width / 8) * channels;
|
return (width / 8) * channels;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -73,6 +73,7 @@ gst_audio_frame_rate (GstPad *pad)
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
GstCaps *caps = NULL;
|
GstCaps *caps = NULL;
|
||||||
|
gint rate;
|
||||||
|
|
||||||
/* get caps of pad */
|
/* get caps of pad */
|
||||||
caps = GST_PAD_CAPS (pad);
|
caps = GST_PAD_CAPS (pad);
|
||||||
|
@ -80,8 +81,10 @@ gst_audio_frame_rate (GstPad *pad)
|
||||||
if (caps == NULL)
|
if (caps == NULL)
|
||||||
/* ERROR: could not get caps of pad */
|
/* ERROR: could not get caps of pad */
|
||||||
return 0;
|
return 0;
|
||||||
else
|
else {
|
||||||
return gst_caps_get_int (caps, "rate");
|
gst_caps_get_int (caps, "rate", &rate);
|
||||||
|
return rate;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
double
|
double
|
||||||
|
@ -95,7 +98,7 @@ gst_audio_length (GstPad* pad, GstBuffer* buf)
|
||||||
long bytes = 0;
|
long bytes = 0;
|
||||||
int width = 0;
|
int width = 0;
|
||||||
int channels = 0;
|
int channels = 0;
|
||||||
long rate = 0L;
|
int rate = 0;
|
||||||
|
|
||||||
double length;
|
double length;
|
||||||
|
|
||||||
|
@ -111,9 +114,9 @@ gst_audio_length (GstPad* pad, GstBuffer* buf)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
bytes = GST_BUFFER_SIZE (buf);
|
bytes = GST_BUFFER_SIZE (buf);
|
||||||
width = gst_caps_get_int (caps, "width");
|
gst_caps_get_int (caps, "width", &width);
|
||||||
channels = gst_caps_get_int (caps, "channels");
|
gst_caps_get_int (caps, "channels", &channels);
|
||||||
rate = gst_caps_get_int (caps, "rate");
|
gst_caps_get_int (caps, "rate", &rate);
|
||||||
|
|
||||||
length = (bytes * 8.0) / (double) (rate * channels * width);
|
length = (bytes * 8.0) / (double) (rate * channels * width);
|
||||||
}
|
}
|
||||||
|
@ -134,8 +137,10 @@ gst_audio_highest_sample_value (GstPad* pad)
|
||||||
/* FIXME : Please change this to a better warning method ! */
|
/* FIXME : Please change this to a better warning method ! */
|
||||||
if (caps == NULL)
|
if (caps == NULL)
|
||||||
printf ("WARNING: gstaudio: could not get caps of pad !\n");
|
printf ("WARNING: gstaudio: could not get caps of pad !\n");
|
||||||
width = gst_caps_get_int (caps, "width");
|
|
||||||
is_signed = gst_caps_get_boolean (caps, "signed");
|
gst_caps_get_int (caps, "width", &width);
|
||||||
|
gst_caps_get_boolean (caps, "signed", &is_signed);
|
||||||
|
|
||||||
if (is_signed) --width;
|
if (is_signed) --width;
|
||||||
/* example : 16 bit, signed : samples between -32768 and 32767 */
|
/* example : 16 bit, signed : samples between -32768 and 32767 */
|
||||||
return ((long) (1 << width));
|
return ((long) (1 << width));
|
||||||
|
|
|
@ -141,39 +141,52 @@ gst_adder_get_type(void) {
|
||||||
static gboolean
|
static gboolean
|
||||||
gst_adder_parse_caps (GstAdder *adder, GstCaps *caps)
|
gst_adder_parse_caps (GstAdder *adder, GstCaps *caps)
|
||||||
{
|
{
|
||||||
const gchar *format = gst_caps_get_string (caps, "format");
|
const gchar *format;
|
||||||
|
|
||||||
|
gst_caps_get_string (caps, "format", &format);
|
||||||
|
|
||||||
if (adder->format == GST_ADDER_FORMAT_UNSET) {
|
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 caps haven't been set yet at all, so we need to go ahead and set all
|
||||||
the relevant values. */
|
the relevant values. */
|
||||||
if (strcmp (format, "int") == 0) {
|
if (strcmp (format, "int") == 0) {
|
||||||
adder->format = GST_ADDER_FORMAT_INT;
|
adder->format = GST_ADDER_FORMAT_INT;
|
||||||
adder->width = gst_caps_get_int (caps, "width");
|
gst_caps_get_int (caps, "width", &adder->width);
|
||||||
adder->depth = gst_caps_get_int (caps, "depth");
|
gst_caps_get_int (caps, "depth", &adder->depth);
|
||||||
adder->law = gst_caps_get_int (caps, "law");
|
gst_caps_get_int (caps, "law", &adder->law);
|
||||||
adder->endianness = gst_caps_get_int (caps, "endianness");
|
gst_caps_get_int (caps, "endianness", &adder->endianness);
|
||||||
adder->is_signed = gst_caps_get_int (caps, "signed");
|
gst_caps_get_boolean (caps, "signed", &adder->is_signed);
|
||||||
adder->channels = gst_caps_get_int (caps, "channels");
|
gst_caps_get_int (caps, "channels", &adder->channels);
|
||||||
} else if (strcmp (format, "float") == 0) {
|
} else if (strcmp (format, "float") == 0) {
|
||||||
adder->format = GST_ADDER_FORMAT_FLOAT;
|
adder->format = GST_ADDER_FORMAT_FLOAT;
|
||||||
adder->layout = gst_caps_get_string (caps, "layout");
|
gst_caps_get_string (caps, "layout", &adder->layout);
|
||||||
adder->intercept = gst_caps_get_float (caps, "intercept");
|
gst_caps_get_float (caps, "intercept", &adder->intercept);
|
||||||
adder->slope = gst_caps_get_float (caps, "slope");
|
gst_caps_get_float (caps, "slope", &adder->slope);
|
||||||
adder->channels = gst_caps_get_int (caps, "channels");
|
gst_caps_get_int (caps, "channels", &adder->channels);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
/* otherwise, a previously-connected pad has set all the values. we should
|
/* otherwise, a previously-connected pad has set all the values. we should
|
||||||
barf if some of the attempted new values don't match. */
|
barf if some of the attempted new values don't match. */
|
||||||
if (strcmp (format, "int") == 0) {
|
if (strcmp (format, "int") == 0) {
|
||||||
|
gint width, channels;
|
||||||
|
gboolean is_signed;
|
||||||
|
|
||||||
|
gst_caps_get_int (caps, "width", &width);
|
||||||
|
gst_caps_get_int (caps, "channels", &channels);
|
||||||
|
gst_caps_get_boolean (caps, "signed", &is_signed);
|
||||||
|
|
||||||
if ((adder->format != GST_ADDER_FORMAT_INT) ||
|
if ((adder->format != GST_ADDER_FORMAT_INT) ||
|
||||||
(adder->width != gst_caps_get_int (caps, "width")) ||
|
(adder->width != width) ||
|
||||||
(adder->channels != gst_caps_get_int (caps, "channels")) ||
|
(adder->channels != channels) ||
|
||||||
(adder->is_signed != gst_caps_get_int (caps, "signed"))) {
|
(adder->is_signed != is_signed)) {
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
} else if (strcmp (format, "float") == 0) {
|
} else if (strcmp (format, "float") == 0) {
|
||||||
|
gint channels;
|
||||||
|
|
||||||
|
gst_caps_get_int (caps, "channels", &channels);
|
||||||
|
|
||||||
if ((adder->format != GST_ADDER_FORMAT_FLOAT) ||
|
if ((adder->format != GST_ADDER_FORMAT_FLOAT) ||
|
||||||
(adder->channels != gst_caps_get_int (caps, "channels"))) {
|
(adder->channels != channels)) {
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -166,12 +166,15 @@ gst_audioscale_sinkconnect (GstPad * pad, GstCaps * caps)
|
||||||
{
|
{
|
||||||
Audioscale *audioscale;
|
Audioscale *audioscale;
|
||||||
resample_t *r;
|
resample_t *r;
|
||||||
|
gint rate;
|
||||||
|
|
||||||
audioscale = GST_AUDIOSCALE (gst_pad_get_parent (pad));
|
audioscale = GST_AUDIOSCALE (gst_pad_get_parent (pad));
|
||||||
r = audioscale->resample;
|
r = audioscale->resample;
|
||||||
|
|
||||||
r->i_rate = gst_caps_get_int (caps, "rate");
|
gst_caps_get_int (caps, "rate", &rate);
|
||||||
r->channels = gst_caps_get_int (caps, "channels");
|
gst_caps_get_int (caps, "channels", &r->channels);
|
||||||
|
|
||||||
|
r->i_rate = rate;
|
||||||
|
|
||||||
resample_reinit(r);
|
resample_reinit(r);
|
||||||
/*g_print("audioscale: unsupported scaling method %d\n", audioscale->method); */
|
/*g_print("audioscale: unsupported scaling method %d\n", audioscale->method); */
|
||||||
|
|
|
@ -10,7 +10,7 @@ libgstsinesrc_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
|
||||||
noinst_HEADERS = gstsinesrc.h
|
noinst_HEADERS = gstsinesrc.h
|
||||||
|
|
||||||
if HAVE_GTK
|
if HAVE_GTK
|
||||||
noinst_PROGRAMS = demo-dparams
|
noinst_PROGRAMS = demo_dparams
|
||||||
endif
|
endif
|
||||||
|
|
||||||
demo_dparams_SOURCES = demo-dparams.c
|
demo_dparams_SOURCES = demo-dparams.c
|
||||||
|
|
|
@ -191,9 +191,9 @@ gst_videoscale_sinkconnect (GstPad *pad, GstCaps *caps)
|
||||||
return GST_PAD_CONNECT_DELAYED;
|
return GST_PAD_CONNECT_DELAYED;
|
||||||
}
|
}
|
||||||
|
|
||||||
videoscale->width = gst_caps_get_int (caps, "width");
|
gst_caps_get_int (caps, "width", &videoscale->width);
|
||||||
videoscale->height = gst_caps_get_int (caps, "height");
|
gst_caps_get_int (caps, "height", &videoscale->height);
|
||||||
videoscale->format = gst_caps_get_int (caps, "format");
|
gst_caps_get_int (caps, "format", &videoscale->format);
|
||||||
|
|
||||||
gst_videoscale_setup(videoscale);
|
gst_videoscale_setup(videoscale);
|
||||||
|
|
||||||
|
@ -256,7 +256,7 @@ gst_videoscale_chain (GstPad *pad, GstBuffer *buf)
|
||||||
size = GST_BUFFER_SIZE(buf);
|
size = GST_BUFFER_SIZE(buf);
|
||||||
|
|
||||||
if(!videoscale->scale_cc){
|
if(!videoscale->scale_cc){
|
||||||
videoscale->format = gst_caps_get_int (gst_pad_get_caps(pad), "format");
|
gst_caps_get_int (gst_pad_get_caps(pad), "format", &videoscale->format);
|
||||||
gst_videoscale_setup(videoscale);
|
gst_videoscale_setup(videoscale);
|
||||||
}
|
}
|
||||||
GST_DEBUG (0,"gst_videoscale_chain: got buffer of %ld bytes in '%s'",size,
|
GST_DEBUG (0,"gst_videoscale_chain: got buffer of %ld bytes in '%s'",size,
|
||||||
|
|
|
@ -137,18 +137,19 @@ volume_parse_caps (GstVolume *filter, GstCaps *caps)
|
||||||
g_return_val_if_fail(filter!=NULL,-1);
|
g_return_val_if_fail(filter!=NULL,-1);
|
||||||
g_return_val_if_fail(caps!=NULL,-1);
|
g_return_val_if_fail(caps!=NULL,-1);
|
||||||
|
|
||||||
format = gst_caps_get_string(caps, "format");
|
gst_caps_get_string (caps, "format", &format);
|
||||||
|
|
||||||
filter->rate = gst_caps_get_int (caps, "rate");
|
gst_caps_get_int (caps, "rate", &filter->rate);
|
||||||
filter->channels = gst_caps_get_int (caps, "channels");
|
gst_caps_get_int (caps, "channels", &filter->channels);
|
||||||
|
|
||||||
if (strcmp(format, "int")==0) {
|
if (strcmp(format, "int")==0) {
|
||||||
filter->format = GST_VOLUME_FORMAT_INT;
|
filter->format = GST_VOLUME_FORMAT_INT;
|
||||||
filter->width = gst_caps_get_int (caps, "width");
|
gst_caps_get_int (caps, "width", &filter->width);
|
||||||
filter->depth = gst_caps_get_int (caps, "depth");
|
gst_caps_get_int (caps, "depth", &filter->depth);
|
||||||
filter->law = gst_caps_get_int (caps, "law");
|
gst_caps_get_int (caps, "law", &filter->law);
|
||||||
filter->endianness = gst_caps_get_int (caps, "endianness");
|
gst_caps_get_int (caps, "endianness", &filter->endianness);
|
||||||
filter->is_signed = gst_caps_get_int (caps, "signed");
|
gst_caps_get_int (caps, "signed", &filter->is_signed);
|
||||||
|
|
||||||
if (!filter->silent) {
|
if (!filter->silent) {
|
||||||
g_print ("Volume : channels %d, rate %d\n",
|
g_print ("Volume : channels %d, rate %d\n",
|
||||||
filter->channels, filter->rate);
|
filter->channels, filter->rate);
|
||||||
|
@ -157,9 +158,10 @@ volume_parse_caps (GstVolume *filter, GstCaps *caps)
|
||||||
}
|
}
|
||||||
} else if (strcmp(format, "float")==0) {
|
} else if (strcmp(format, "float")==0) {
|
||||||
filter->format = GST_VOLUME_FORMAT_FLOAT;
|
filter->format = GST_VOLUME_FORMAT_FLOAT;
|
||||||
filter->layout = gst_caps_get_string(caps, "layout");
|
gst_caps_get_string (caps, "layout", &filter->layout);
|
||||||
filter->intercept = gst_caps_get_float(caps, "intercept");
|
gst_caps_get_float (caps, "intercept", &filter->intercept);
|
||||||
filter->slope = gst_caps_get_float(caps, "slope");
|
gst_caps_get_float (caps, "slope", &filter->slope);
|
||||||
|
|
||||||
if (!filter->silent) {
|
if (!filter->silent) {
|
||||||
g_print ("Volume : channels %d, rate %d\n",
|
g_print ("Volume : channels %d, rate %d\n",
|
||||||
filter->channels, filter->rate);
|
filter->channels, filter->rate);
|
||||||
|
|
|
@ -191,8 +191,8 @@ gst_v4lmjpegsink_sinkconnect (GstPad *pad,
|
||||||
|
|
||||||
for (caps = vscapslist; caps != NULL; caps = vscapslist = vscapslist->next)
|
for (caps = vscapslist; caps != NULL; caps = vscapslist = vscapslist->next)
|
||||||
{
|
{
|
||||||
v4lmjpegsink->width = gst_caps_get_int (caps, "width");
|
gst_caps_get_int (caps, "width", &v4lmjpegsink->width);
|
||||||
v4lmjpegsink->height = gst_caps_get_int (caps, "height");
|
gst_caps_get_int (caps, "height", &v4lmjpegsink->height);
|
||||||
|
|
||||||
if (!gst_v4lmjpegsink_set_playback(v4lmjpegsink,
|
if (!gst_v4lmjpegsink_set_playback(v4lmjpegsink,
|
||||||
v4lmjpegsink->width, v4lmjpegsink->height,
|
v4lmjpegsink->width, v4lmjpegsink->height,
|
||||||
|
|
|
@ -187,53 +187,62 @@ gst_v4lsrc_srcconnect (GstPad *pad,
|
||||||
/* TODO: caps = gst_caps_normalize(capslist); */
|
/* TODO: caps = gst_caps_normalize(capslist); */
|
||||||
for (caps = vscapslist ; caps != NULL ; caps = vscapslist = vscapslist->next)
|
for (caps = vscapslist ; caps != NULL ; caps = vscapslist = vscapslist->next)
|
||||||
{
|
{
|
||||||
|
guint32 fourcc;
|
||||||
|
gint depth;
|
||||||
|
|
||||||
|
gst_caps_get_fourcc_int (caps, "format", &fourcc);
|
||||||
|
|
||||||
if (v4lsrc->palette > 0)
|
if (v4lsrc->palette > 0)
|
||||||
{
|
{
|
||||||
switch (v4lsrc->palette)
|
switch (v4lsrc->palette)
|
||||||
{
|
{
|
||||||
case VIDEO_PALETTE_YUV420P:
|
case VIDEO_PALETTE_YUV420P:
|
||||||
if (gst_caps_get_fourcc_int (caps, "format") != GST_MAKE_FOURCC('I','4','2','0') &&
|
if (fourcc != GST_MAKE_FOURCC('I','4','2','0') &&
|
||||||
gst_caps_get_fourcc_int (caps, "format") != GST_MAKE_FOURCC('I','Y','U','V'))
|
fourcc != GST_MAKE_FOURCC('I','Y','U','V'))
|
||||||
goto try_next;
|
goto try_next;
|
||||||
v4lsrc->buffer_size = v4lsrc->width * v4lsrc->height * 1.5;
|
v4lsrc->buffer_size = v4lsrc->width * v4lsrc->height * 1.5;
|
||||||
goto try_caps;
|
goto try_caps;
|
||||||
case VIDEO_PALETTE_YUV422:
|
case VIDEO_PALETTE_YUV422:
|
||||||
case VIDEO_PALETTE_YUYV:
|
case VIDEO_PALETTE_YUYV:
|
||||||
if (gst_caps_get_fourcc_int (caps, "format") != GST_MAKE_FOURCC('Y','U','Y','2'))
|
if (fourcc != GST_MAKE_FOURCC('Y','U','Y','2'))
|
||||||
goto try_next;
|
goto try_next;
|
||||||
v4lsrc->buffer_size = v4lsrc->width * v4lsrc->height * 2;
|
v4lsrc->buffer_size = v4lsrc->width * v4lsrc->height * 2;
|
||||||
goto try_caps;
|
goto try_caps;
|
||||||
case VIDEO_PALETTE_UYVY:
|
case VIDEO_PALETTE_UYVY:
|
||||||
if (gst_caps_get_fourcc_int (caps, "format") != GST_MAKE_FOURCC('U','Y','V','Y'))
|
if (fourcc != GST_MAKE_FOURCC('U','Y','V','Y'))
|
||||||
goto try_next;
|
goto try_next;
|
||||||
v4lsrc->buffer_size = v4lsrc->width * v4lsrc->height * 2;
|
v4lsrc->buffer_size = v4lsrc->width * v4lsrc->height * 2;
|
||||||
goto try_caps;
|
goto try_caps;
|
||||||
case VIDEO_PALETTE_YUV411:
|
case VIDEO_PALETTE_YUV411:
|
||||||
if (gst_caps_get_fourcc_int (caps, "format") != GST_MAKE_FOURCC('Y','4','1','P'))
|
if (fourcc != GST_MAKE_FOURCC('Y','4','1','P'))
|
||||||
goto try_next;
|
goto try_next;
|
||||||
v4lsrc->buffer_size = v4lsrc->width * v4lsrc->height * 1.5;
|
v4lsrc->buffer_size = v4lsrc->width * v4lsrc->height * 1.5;
|
||||||
goto try_caps;
|
goto try_caps;
|
||||||
case VIDEO_PALETTE_RGB555:
|
case VIDEO_PALETTE_RGB555:
|
||||||
if (gst_caps_get_fourcc_int (caps, "format") != GST_MAKE_FOURCC('R','G','B',' ') ||
|
depth = gst_caps_get_int (caps, "depth", &depth);
|
||||||
gst_caps_get_int(caps, "depth") != 15)
|
if (fourcc != GST_MAKE_FOURCC('R','G','B',' ') ||
|
||||||
|
depth != 15)
|
||||||
goto try_next;
|
goto try_next;
|
||||||
v4lsrc->buffer_size = v4lsrc->width * v4lsrc->height * 2;
|
v4lsrc->buffer_size = v4lsrc->width * v4lsrc->height * 2;
|
||||||
goto try_caps;
|
goto try_caps;
|
||||||
case VIDEO_PALETTE_RGB565:
|
case VIDEO_PALETTE_RGB565:
|
||||||
if (gst_caps_get_fourcc_int (caps, "format") != GST_MAKE_FOURCC('R','G','B',' ') ||
|
depth = gst_caps_get_int (caps, "depth", &depth);
|
||||||
gst_caps_get_int(caps, "depth") != 16)
|
if (fourcc != GST_MAKE_FOURCC('R','G','B',' ') ||
|
||||||
|
depth != 16)
|
||||||
goto try_next;
|
goto try_next;
|
||||||
v4lsrc->buffer_size = v4lsrc->width * v4lsrc->height * 2;
|
v4lsrc->buffer_size = v4lsrc->width * v4lsrc->height * 2;
|
||||||
goto try_caps;
|
goto try_caps;
|
||||||
case VIDEO_PALETTE_RGB24:
|
case VIDEO_PALETTE_RGB24:
|
||||||
if (gst_caps_get_fourcc_int (caps, "format") != GST_MAKE_FOURCC('R','G','B',' ') ||
|
depth = gst_caps_get_int (caps, "depth", &depth);
|
||||||
gst_caps_get_int(caps, "depth") != 24)
|
if (fourcc != GST_MAKE_FOURCC('R','G','B',' ') ||
|
||||||
|
depth != 24)
|
||||||
goto try_next;
|
goto try_next;
|
||||||
v4lsrc->buffer_size = v4lsrc->width * v4lsrc->height * 3;
|
v4lsrc->buffer_size = v4lsrc->width * v4lsrc->height * 3;
|
||||||
goto try_caps;
|
goto try_caps;
|
||||||
case VIDEO_PALETTE_RGB32:
|
case VIDEO_PALETTE_RGB32:
|
||||||
if (gst_caps_get_fourcc_int (caps, "format") != GST_MAKE_FOURCC('R','G','B',' ') ||
|
depth = gst_caps_get_int (caps, "depth", &depth);
|
||||||
gst_caps_get_int(caps, "depth") != 32)
|
if (fourcc != GST_MAKE_FOURCC('R','G','B',' ') ||
|
||||||
|
depth != 32)
|
||||||
goto try_next;
|
goto try_next;
|
||||||
v4lsrc->buffer_size = v4lsrc->width * v4lsrc->height * 4;
|
v4lsrc->buffer_size = v4lsrc->width * v4lsrc->height * 4;
|
||||||
goto try_caps;
|
goto try_caps;
|
||||||
|
@ -243,7 +252,7 @@ gst_v4lsrc_srcconnect (GstPad *pad,
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
switch (gst_caps_get_fourcc_int(caps, "format"))
|
switch (fourcc)
|
||||||
{
|
{
|
||||||
case GST_MAKE_FOURCC('I','4','2','0'):
|
case GST_MAKE_FOURCC('I','4','2','0'):
|
||||||
case GST_MAKE_FOURCC('I','Y','U','V'):
|
case GST_MAKE_FOURCC('I','Y','U','V'):
|
||||||
|
@ -263,7 +272,8 @@ gst_v4lsrc_srcconnect (GstPad *pad,
|
||||||
v4lsrc->buffer_size = v4lsrc->width * v4lsrc->height * 1.5;
|
v4lsrc->buffer_size = v4lsrc->width * v4lsrc->height * 1.5;
|
||||||
goto try_caps;
|
goto try_caps;
|
||||||
case GST_MAKE_FOURCC('R','G','B',' '):
|
case GST_MAKE_FOURCC('R','G','B',' '):
|
||||||
switch (gst_caps_get_int(caps, "depth"))
|
depth = gst_caps_get_int (caps, "depth", &depth);
|
||||||
|
switch (depth)
|
||||||
{
|
{
|
||||||
case 15:
|
case 15:
|
||||||
palette = VIDEO_PALETTE_RGB555;
|
palette = VIDEO_PALETTE_RGB555;
|
||||||
|
@ -301,24 +311,32 @@ gst_v4lsrc_srcconnect (GstPad *pad,
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
/* try to connect the pad/caps with the actual width/height */
|
/* try to connect the pad/caps with the actual width/height */
|
||||||
if (palette >= VIDEO_PALETTE_RGB565 && palette <= VIDEO_PALETTE_RGB555)
|
if (palette >= VIDEO_PALETTE_RGB565 && palette <= VIDEO_PALETTE_RGB555) {
|
||||||
|
gint depth;
|
||||||
|
gint bpp;
|
||||||
|
|
||||||
|
gst_caps_get_int(caps, "bpp", &bpp),
|
||||||
|
gst_caps_get_int(caps, "depth", &depth),
|
||||||
|
|
||||||
newcaps = gst_caps_new("v4lsrc_caps",
|
newcaps = gst_caps_new("v4lsrc_caps",
|
||||||
"video/raw",
|
"video/raw",
|
||||||
gst_props_new(
|
gst_props_new(
|
||||||
"format", GST_PROPS_FOURCC(gst_caps_get_fourcc_int(caps, "format")),
|
"format", GST_PROPS_FOURCC(fourcc),
|
||||||
"width", GST_PROPS_INT(v4lsrc->width),
|
"width", GST_PROPS_INT(v4lsrc->width),
|
||||||
"height", GST_PROPS_INT(v4lsrc->height),
|
"height", GST_PROPS_INT(v4lsrc->height),
|
||||||
"bpp", GST_PROPS_INT(gst_caps_get_int(caps, "bpp")),
|
"bpp", GST_PROPS_INT(bpp),
|
||||||
"depth", GST_PROPS_INT(gst_caps_get_int(caps, "depth")),
|
"depth", GST_PROPS_INT(depth),
|
||||||
NULL ) );
|
NULL ) );
|
||||||
else
|
}
|
||||||
|
else {
|
||||||
newcaps = gst_caps_new("v4lsrc_caps",
|
newcaps = gst_caps_new("v4lsrc_caps",
|
||||||
"video/raw",
|
"video/raw",
|
||||||
gst_props_new(
|
gst_props_new(
|
||||||
"format", GST_PROPS_FOURCC(gst_caps_get_fourcc_int(caps, "format")),
|
"format", GST_PROPS_FOURCC(fourcc),
|
||||||
"width", GST_PROPS_INT(v4lsrc->width),
|
"width", GST_PROPS_INT(v4lsrc->width),
|
||||||
"height", GST_PROPS_INT(v4lsrc->height),
|
"height", GST_PROPS_INT(v4lsrc->height),
|
||||||
NULL ) );
|
NULL ) );
|
||||||
|
}
|
||||||
|
|
||||||
gst_caps_debug (newcaps, "new caps to set on v4lsrc's src pad");
|
gst_caps_debug (newcaps, "new caps to set on v4lsrc's src pad");
|
||||||
|
|
||||||
|
@ -442,7 +460,6 @@ static GstElementStateReturn
|
||||||
gst_v4lsrc_change_state (GstElement *element)
|
gst_v4lsrc_change_state (GstElement *element)
|
||||||
{
|
{
|
||||||
GstV4lSrc *v4lsrc;
|
GstV4lSrc *v4lsrc;
|
||||||
GstElementStateReturn parent_value;
|
|
||||||
gint transition = GST_STATE_TRANSITION (element);
|
gint transition = GST_STATE_TRANSITION (element);
|
||||||
guint32 fourcc;
|
guint32 fourcc;
|
||||||
gint depth=0, bpp=0;
|
gint depth=0, bpp=0;
|
||||||
|
@ -491,6 +508,8 @@ gst_v4lsrc_change_state (GstElement *element)
|
||||||
case VIDEO_PALETTE_UYVY:
|
case VIDEO_PALETTE_UYVY:
|
||||||
fourcc = GST_MAKE_FOURCC('U','Y','V','Y');
|
fourcc = GST_MAKE_FOURCC('U','Y','V','Y');
|
||||||
break;
|
break;
|
||||||
|
default:
|
||||||
|
return GST_STATE_FAILURE;
|
||||||
}
|
}
|
||||||
if (bpp && depth)
|
if (bpp && depth)
|
||||||
caps = gst_caps_new("v4lsrc_caps",
|
caps = gst_caps_new("v4lsrc_caps",
|
||||||
|
|
Loading…
Reference in a new issue