From 4fd57bbe3fef59592a8664dcc9fa2ab32ae99c69 Mon Sep 17 00:00:00 2001 From: Thomas Vander Stichele Date: Mon, 15 Mar 2004 19:32:27 +0000 Subject: don't mix tabs and spaces Original commit message from CVS: don't mix tabs and spaces --- ext/arts/gst_arts.c | 25 +- ext/arts/gst_artsio_impl.cc | 56 ++-- ext/artsd/gstartsdsink.c | 41 +-- ext/audiofile/gstafparse.c | 119 ++++---- ext/audiofile/gstafsink.c | 51 ++-- ext/audiofile/gstafsrc.c | 55 ++-- ext/cdaudio/gstcdaudio.c | 118 +++---- ext/divx/gstdivxdec.c | 49 +-- ext/divx/gstdivxenc.c | 39 +-- ext/faac/gstfaac.c | 174 +++++------ ext/faad/gstfaad.c | 132 ++++---- ext/gsm/gstgsm.c | 2 +- ext/gsm/gstgsmdec.c | 31 +- ext/gsm/gstgsmenc.c | 25 +- ext/hermes/gsthermescolorspace.c | 255 ++++++++-------- ext/ivorbis/vorbis.c | 2 +- ext/ivorbis/vorbisfile.c | 508 ++++++++++++++++--------------- ext/jack/gstjack.c | 115 +++---- ext/jack/gstjackbin.c | 209 ++++++------- ext/ladspa/gstladspa.c | 226 +++++++------- ext/ladspa/load.c | 64 ++-- ext/ladspa/search.c | 16 +- ext/lcs/gstcolorspace.c | 63 ++-- ext/libfame/gstlibfame.c | 152 ++++----- ext/mpeg2enc/gstmpeg2enc.cc | 33 +- ext/mpeg2enc/gstmpeg2encoptions.cc | 220 ++++++------- ext/mpeg2enc/gstmpeg2encpicturereader.cc | 21 +- ext/mplex/gstmplex.cc | 86 +++--- ext/mplex/gstmplexibitstream.cc | 18 +- ext/mplex/gstmplexjob.cc | 37 +-- ext/musicbrainz/gsttrm.c | 37 +-- ext/nas/nassink.c | 223 +++++++------- ext/sdl/sdlvideosink.c | 96 +++--- ext/shout/gstshout.c | 131 ++++---- ext/smoothwave/gstsmoothwave.c | 23 +- ext/snapshot/gstsnapshot.c | 33 +- ext/sndfile/gstsf.c | 237 +++++++------- ext/swfdec/gstswfdec.c | 208 ++++++------- ext/tarkin/gsttarkin.c | 4 +- ext/tarkin/gsttarkindec.c | 86 +++--- ext/tarkin/gsttarkinenc.c | 34 +-- ext/tarkin/info.c | 152 ++++----- ext/tarkin/mem.c | 15 +- ext/tarkin/tarkin.c | 60 ++-- ext/tarkin/wavelet.c | 2 +- ext/tarkin/wavelet_coeff.c | 80 ++--- ext/tarkin/wavelet_xform.c | 98 +++--- ext/xine/xine.c | 4 +- ext/xine/xineaudiodec.c | 91 +++--- ext/xine/xineaudiosink.c | 94 +++--- ext/xine/xineinput.c | 44 +-- ext/xvid/gstxvid.c | 262 ++++++++-------- ext/xvid/gstxviddec.c | 45 +-- ext/xvid/gstxvidenc.c | 63 ++-- 54 files changed, 2559 insertions(+), 2505 deletions(-) (limited to 'ext') diff --git a/ext/arts/gst_arts.c b/ext/arts/gst_arts.c index 16906e69..0eff0852 100644 --- a/ext/arts/gst_arts.c +++ b/ext/arts/gst_arts.c @@ -42,21 +42,21 @@ static GstStaticPadTemplate sink_temp = GST_STATIC_PAD_TEMPLATE ("sink", GST_PAD_SINK, GST_PAD_ALWAYS, GST_STATIC_CAPS ("audio/x-raw-int, " - "depth = (int) 16, " - "width = (int) 16, " - "signed = (boolean) true, " - "channels = (int) 2, " "endianness = (int) byte_order") + "depth = (int) 16, " + "width = (int) 16, " + "signed = (boolean) true, " + "channels = (int) 2, " "endianness = (int) byte_order") ); static GstStaticPadTemplate src_temp = GST_STATIC_PAD_TEMPLATE ("src", GST_PAD_SRC, GST_PAD_ALWAYS, GST_STATIC_CAPS ("audio/x-raw-int, " - "depth = (int) 16, " - "width = (int) 16, " - "signed = (boolean) true, " - "channels = (int) 2, " - "rate = (int) 44100, " "endianness = (int) byte_order") + "depth = (int) 16, " + "width = (int) 16, " + "signed = (boolean) true, " + "channels = (int) 2, " + "rate = (int) 44100, " "endianness = (int) byte_order") ); enum @@ -93,8 +93,9 @@ gst_arts_get_type (void) 0, (GInstanceInitFunc) gst_arts_init, }; + gst_arts_type = - g_type_register_static (GST_TYPE_ELEMENT, "GstArts", &gst_arts_info, 0); + g_type_register_static (GST_TYPE_ELEMENT, "GstArts", &gst_arts_info, 0); } return gst_arts_type; } @@ -128,12 +129,12 @@ gst_arts_init (GstARTS * arts) { arts->sinkpad = gst_pad_new_from_template (gst_element_get_pad_template (GST_ELEMENT - (arts), "sink"), "sink"); + (arts), "sink"), "sink"); gst_element_add_pad (GST_ELEMENT (arts), arts->sinkpad); arts->srcpad = gst_pad_new_from_template (gst_element_get_pad_template (GST_ELEMENT - (arts), "src"), "src"); + (arts), "src"), "src"); gst_element_add_pad (GST_ELEMENT (arts), arts->srcpad); gst_element_set_loop_function (GST_ELEMENT (arts), gst_arts_loop); diff --git a/ext/arts/gst_artsio_impl.cc b/ext/arts/gst_artsio_impl.cc index b08aa93a..18d099ea 100644 --- a/ext/arts/gst_artsio_impl.cc +++ b/ext/arts/gst_artsio_impl.cc @@ -44,40 +44,40 @@ namespace Gst while (fulfilled < samples) { - if (remainingsamples == 0) { + if (remainingsamples == 0) { //fprintf(stderr,"need to get a buffer\n"); - if (inbuf) { - gst_data_unref (inbuf); - inbuf = NULL; - } - // start by pulling a buffer from GStreamer - inbuf = gst_pad_pull (sinkpad); - - while (GST_IS_EVENT (inbuf)) { - switch (GST_EVENT_TYPE (inbuf)) { - case GST_EVENT_EOS: - gst_element_set_eos (GST_PAD_PARENT (sinkpad)); - default: - break; - } - gst_pad_event_default (srcpad, GST_EVENT (inbuf)); - inbuf = gst_pad_pull (sinkpad); - } - - dataptr = GST_BUFFER_DATA (GST_BUFFER (inbuf)); - remainingsamples = GST_BUFFER_SIZE (GST_BUFFER (inbuf)) / 4; + if (inbuf) { + gst_data_unref (inbuf); + inbuf = NULL; + } + // start by pulling a buffer from GStreamer + inbuf = gst_pad_pull (sinkpad); + + while (GST_IS_EVENT (inbuf)) { + switch (GST_EVENT_TYPE (inbuf)) { + case GST_EVENT_EOS: + gst_element_set_eos (GST_PAD_PARENT (sinkpad)); + default: + break; + } + gst_pad_event_default (srcpad, GST_EVENT (inbuf)); + inbuf = gst_pad_pull (sinkpad); + } + + dataptr = GST_BUFFER_DATA (GST_BUFFER (inbuf)); + remainingsamples = GST_BUFFER_SIZE (GST_BUFFER (inbuf)) / 4; //fprintf(stderr,"got a buffer with %d samples\n",remainingsamples); - } + } - unsigned long count = MIN (remainingsamples, samples - fulfilled); + unsigned long count = MIN (remainingsamples, samples - fulfilled); //fprintf(stderr,"have %d samples left, can fill %d\n",remainingsamples,count); - convert_stereo_i16le_2float (count, dataptr, outleft, outright); + convert_stereo_i16le_2float (count, dataptr, outleft, outright); //s = (gint16 *)dataptr; //fprintf(stderr,"samples in are %d and %d, out are %f and %f\n",s[0],s[1],outleft[0],outright[0]); - remainingsamples -= count; - dataptr += 4 * count; - fulfilled += count; + remainingsamples -= count; + dataptr += 4 * count; + fulfilled += count; } } @@ -112,7 +112,7 @@ namespace Gst GST_BUFFER_SIZE (outbuf) = samples * 4; memset (GST_BUFFER_DATA (outbuf), 0, samples * 4); convert_stereo_2float_i16le (samples, inleft, inright, - GST_BUFFER_DATA (outbuf)); + GST_BUFFER_DATA (outbuf)); //s = (gint16 *)GST_BUFFER_DATA(outbuf); //fprintf(stderr,"samples in are %f and %f, out are %d and %d\n",inleft[0],inright[0],s[0],s[1]); gst_pad_push (srcpad, GST_DATA (outbuf)); diff --git a/ext/artsd/gstartsdsink.c b/ext/artsd/gstartsdsink.c index 8a2f7a32..16a72699 100644 --- a/ext/artsd/gstartsdsink.c +++ b/ext/artsd/gstartsdsink.c @@ -91,9 +91,10 @@ gst_artsdsink_get_type (void) 0, (GInstanceInitFunc) gst_artsdsink_init, }; + artsdsink_type = - g_type_register_static (GST_TYPE_ELEMENT, "GstArtsdsink", - &artsdsink_info, 0); + g_type_register_static (GST_TYPE_ELEMENT, "GstArtsdsink", + &artsdsink_info, 0); } return artsdsink_type; } @@ -119,9 +120,9 @@ gst_artsdsink_class_init (GstArtsdsinkClass * klass) parent_class = g_type_class_ref (GST_TYPE_ELEMENT); - g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_MUTE, g_param_spec_boolean ("mute", "mute", "mute", TRUE, G_PARAM_READWRITE)); /* CHECKME */ + g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_MUTE, g_param_spec_boolean ("mute", "mute", "mute", TRUE, G_PARAM_READWRITE)); /* CHECKME */ - g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_NAME, g_param_spec_string ("name", "name", "name", NULL, G_PARAM_READWRITE)); /* CHECKME */ + g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_NAME, g_param_spec_string ("name", "name", "name", NULL, G_PARAM_READWRITE)); /* CHECKME */ gobject_class->set_property = gst_artsdsink_set_property; gobject_class->get_property = gst_artsdsink_get_property; @@ -134,7 +135,7 @@ gst_artsdsink_init (GstArtsdsink * artsdsink) { artsdsink->sinkpad = gst_pad_new_from_template (gst_element_get_pad_template (GST_ELEMENT - (artsdsink), "sink"), "sink"); + (artsdsink), "sink"), "sink"); gst_element_add_pad (GST_ELEMENT (artsdsink), artsdsink->sinkpad); gst_pad_set_chain_function (artsdsink->sinkpad, gst_artsdsink_chain); gst_pad_set_link_function (artsdsink->sinkpad, gst_artsdsink_link); @@ -190,24 +191,24 @@ gst_artsdsink_chain (GstPad * pad, GstData * _data) if (GST_BUFFER_DATA (buf) != NULL) { gst_trace_add_entry (NULL, 0, GPOINTER_TO_INT (buf), - "artsdsink: writing to server"); + "artsdsink: writing to server"); if (!artsdsink->mute && artsdsink->connected) { int bytes; void *bufptr = GST_BUFFER_DATA (buf); int bufsize = GST_BUFFER_SIZE (buf); GST_DEBUG ("artsdsink: stream=%p data=%p size=%d", - artsdsink->stream, GST_BUFFER_DATA (buf), GST_BUFFER_SIZE (buf)); + artsdsink->stream, GST_BUFFER_DATA (buf), GST_BUFFER_SIZE (buf)); do { - bytes = arts_write (artsdsink->stream, bufptr, bufsize); - if (bytes < 0) { - fprintf (stderr, "arts_write error: %s\n", arts_error_text (bytes)); - gst_buffer_unref (buf); - return; - } - bufptr += bytes; - bufsize -= bytes; + bytes = arts_write (artsdsink->stream, bufptr, bufsize); + if (bytes < 0) { + fprintf (stderr, "arts_write error: %s\n", arts_error_text (bytes)); + gst_buffer_unref (buf); + return; + } + bufptr += bytes; + bufsize -= bytes; } while (bufsize > 0); } } @@ -230,11 +231,11 @@ gst_artsdsink_set_property (GObject * object, guint prop_id, break; case ARG_NAME: if (artsdsink->connect_name != NULL) - g_free (artsdsink->connect_name); + g_free (artsdsink->connect_name); if (g_value_get_string (value) == NULL) - artsdsink->connect_name = NULL; + artsdsink->connect_name = NULL; else - artsdsink->connect_name = g_strdup (g_value_get_string (value)); + artsdsink->connect_name = g_strdup (g_value_get_string (value)); break; default: break; @@ -268,7 +269,7 @@ static gboolean plugin_init (GstPlugin * plugin) { if (!gst_element_register (plugin, "artsdsink", GST_RANK_NONE, - GST_TYPE_ARTSDSINK)) + GST_TYPE_ARTSDSINK)) return FALSE; return TRUE; @@ -337,7 +338,7 @@ gst_artsdsink_change_state (GstElement * element) } else { if (!GST_FLAG_IS_SET (element, GST_ARTSDSINK_OPEN)) { if (!gst_artsdsink_open_audio (GST_ARTSDSINK (element))) - return GST_STATE_FAILURE; + return GST_STATE_FAILURE; } } diff --git a/ext/audiofile/gstafparse.c b/ext/audiofile/gstafparse.c index 00c9fd81..ddc61e0c 100644 --- a/ext/audiofile/gstafparse.c +++ b/ext/audiofile/gstafparse.c @@ -57,13 +57,13 @@ GST_STATIC_PAD_TEMPLATE ("src", GST_PAD_SRC, GST_PAD_ALWAYS, GST_STATIC_CAPS ("audio/x-raw-int, " - "rate = (int) [ 1, MAX ], " - "channels = (int) [ 1, MAX ], " - "endianness = (int) BYTE_ORDER, " - "width = (int) { 8, 16 }, " - "depth = (int) { 8, 16 }, " - "signed = (boolean) { true, false }, " - "buffer-frames = (int) [ 1, MAX ]") + "rate = (int) [ 1, MAX ], " + "channels = (int) [ 1, MAX ], " + "endianness = (int) BYTE_ORDER, " + "width = (int) { 8, 16 }, " + "depth = (int) { 8, 16 }, " + "signed = (boolean) { true, false }, " + "buffer-frames = (int) [ 1, MAX ]") ); static GstStaticPadTemplate afparse_sink_factory = @@ -112,9 +112,10 @@ gst_afparse_get_type (void) 0, (GInstanceInitFunc) gst_afparse_init, }; + afparse_type = - g_type_register_static (GST_TYPE_ELEMENT, "GstAFParse", &afparse_info, - 0); + g_type_register_static (GST_TYPE_ELEMENT, "GstAFParse", &afparse_info, + 0); } return afparse_type; } @@ -151,13 +152,13 @@ gst_afparse_init (GstAFParse * afparse) { afparse->srcpad = gst_pad_new_from_template (gst_element_get_pad_template (GST_ELEMENT - (afparse), "src"), "src"); + (afparse), "src"), "src"); gst_pad_use_explicit_caps (afparse->srcpad); gst_element_add_pad (GST_ELEMENT (afparse), afparse->srcpad); afparse->sinkpad = gst_pad_new_from_template (gst_element_get_pad_template (GST_ELEMENT - (afparse), "sink"), "sink"); + (afparse), "sink"), "sink"); gst_element_add_pad (GST_ELEMENT (afparse), afparse->sinkpad); gst_element_set_loop_function (GST_ELEMENT (afparse), gst_afparse_loop); @@ -217,8 +218,8 @@ gst_afparse_loop (GstElement * element) &v_width); if (afGetCompression != AF_COMPRESSION_NONE || afGetByteOrder (afparse->file, - AF_DEFAULT_TRACK) != afGetVirtualByteOrder (afparse->file, - AF_DEFAULT_TRACK) || s_format != v_format || s_width != v_width) { + AF_DEFAULT_TRACK) != afGetVirtualByteOrder (afparse->file, + AF_DEFAULT_TRACK) || s_format != v_format || s_width != v_width) { bypass_afread = FALSE; } @@ -241,24 +242,24 @@ gst_afparse_loop (GstElement * element) got_bytes = gst_bytestream_read (bs, &buf, bytes_per_read); if (got_bytes == 0) { - /* we need to check for an event. */ - gst_bytestream_get_status (bs, &waiting, &event); - if (event && GST_EVENT_TYPE (event) == GST_EVENT_EOS) { - gst_pad_push (afparse->srcpad, - GST_DATA (gst_event_new (GST_EVENT_EOS))); - gst_element_set_eos (GST_ELEMENT (afparse)); - break; - } + /* we need to check for an event. */ + gst_bytestream_get_status (bs, &waiting, &event); + if (event && GST_EVENT_TYPE (event) == GST_EVENT_EOS) { + gst_pad_push (afparse->srcpad, + GST_DATA (gst_event_new (GST_EVENT_EOS))); + gst_element_set_eos (GST_ELEMENT (afparse)); + break; + } } else { - GST_BUFFER_TIMESTAMP (buf) = afparse->timestamp; - gst_pad_push (afparse->srcpad, GST_DATA (buf)); - if (got_bytes != bytes_per_read) { - /* this shouldn't happen very often */ - /* FIXME calculate the timestamps based on the fewer bytes received */ - - } else { - afparse->timestamp += frames_per_read * 1E9 / afparse->rate; - } + GST_BUFFER_TIMESTAMP (buf) = afparse->timestamp; + gst_pad_push (afparse->srcpad, GST_DATA (buf)); + if (got_bytes != bytes_per_read) { + /* this shouldn't happen very often */ + /* FIXME calculate the timestamps based on the fewer bytes received */ + + } else { + afparse->timestamp += frames_per_read * 1E9 / afparse->rate; + } } } while (TRUE); @@ -269,17 +270,17 @@ gst_afparse_loop (GstElement * element) GST_BUFFER_TIMESTAMP (buf) = afparse->timestamp; data = GST_BUFFER_DATA (buf); numframes = - afReadFrames (afparse->file, AF_DEFAULT_TRACK, data, frames_per_read); + afReadFrames (afparse->file, AF_DEFAULT_TRACK, data, frames_per_read); /* events are handled in gst_afparse_vf_read so if there are no * frames it must be EOS */ if (numframes < 1) { - gst_buffer_unref (buf); + gst_buffer_unref (buf); - gst_pad_push (afparse->srcpad, - GST_DATA (gst_event_new (GST_EVENT_EOS))); - gst_element_set_eos (GST_ELEMENT (afparse)); - break; + gst_pad_push (afparse->srcpad, + GST_DATA (gst_event_new (GST_EVENT_EOS))); + gst_element_set_eos (GST_ELEMENT (afparse)); + break; } GST_BUFFER_SIZE (buf) = numframes * frames_to_bytes; gst_pad_push (afparse->srcpad, GST_DATA (buf)); @@ -334,7 +335,7 @@ gst_afparse_plugin_init (GstPlugin * plugin) return FALSE; if (!gst_element_register (plugin, "afparse", GST_RANK_NONE, - GST_TYPE_AFPARSE)) + GST_TYPE_AFPARSE)) return FALSE; return TRUE; @@ -363,35 +364,35 @@ gst_afparse_open_file (GstAFParse * afparse) afparse->channels = afGetChannels (afparse->file, AF_DEFAULT_TRACK); afGetSampleFormat (afparse->file, AF_DEFAULT_TRACK, - &sampleFormat, &sampleWidth); + &sampleFormat, &sampleWidth); switch (sampleFormat) { case AF_SAMPFMT_TWOSCOMP: - afparse->is_signed = TRUE; - break; + afparse->is_signed = TRUE; + break; case AF_SAMPFMT_UNSIGNED: - afparse->is_signed = FALSE; - break; + afparse->is_signed = FALSE; + break; case AF_SAMPFMT_FLOAT: case AF_SAMPFMT_DOUBLE: - GST_DEBUG ("ERROR: float data not supported yet !\n"); + GST_DEBUG ("ERROR: float data not supported yet !\n"); } afparse->rate = (guint) afGetRate (afparse->file, AF_DEFAULT_TRACK); afparse->width = sampleWidth; GST_DEBUG ("input file: %d channels, %d width, %d rate, signed %s\n", - afparse->channels, afparse->width, afparse->rate, - afparse->is_signed ? "yes" : "no"); + afparse->channels, afparse->width, afparse->rate, + afparse->is_signed ? "yes" : "no"); } /* set caps on src */ /*FIXME: add all the possible formats, especially float ! */ gst_pad_set_explicit_caps (afparse->srcpad, gst_caps_new_simple ("audio/x-raw-int", - "endianness", G_TYPE_INT, G_BYTE_ORDER, - "signed", G_TYPE_BOOLEAN, afparse->is_signed, - "width", G_TYPE_INT, afparse->width, - "depth", G_TYPE_INT, afparse->width, - "rate", G_TYPE_INT, afparse->rate, - "channels", G_TYPE_INT, afparse->channels, NULL)); + "endianness", G_TYPE_INT, G_BYTE_ORDER, + "signed", G_TYPE_BOOLEAN, afparse->is_signed, + "width", G_TYPE_INT, afparse->width, + "depth", G_TYPE_INT, afparse->width, + "rate", G_TYPE_INT, afparse->rate, + "channels", G_TYPE_INT, afparse->channels, NULL)); GST_FLAG_SET (afparse, GST_AFPARSE_OPEN); @@ -433,17 +434,17 @@ gst_afparse_vf_read (AFvirtualfile * vfile, void *data, size_t nbytes) } switch (GST_EVENT_TYPE (event)) { case GST_EVENT_EOS: - return 0; + return 0; case GST_EVENT_FLUSH: - GST_DEBUG ("flush"); - break; + GST_DEBUG ("flush"); + break; case GST_EVENT_DISCONTINUOUS: - GST_DEBUG ("seek done"); - got_bytes = gst_bytestream_peek_bytes (bs, &bytes, nbytes); - break; + GST_DEBUG ("seek done"); + got_bytes = gst_bytestream_peek_bytes (bs, &bytes, nbytes); + break; default: - g_warning ("unknown event %d", GST_EVENT_TYPE (event)); - got_bytes = gst_bytestream_peek_bytes (bs, &bytes, nbytes); + g_warning ("unknown event %d", GST_EVENT_TYPE (event)); + got_bytes = gst_bytestream_peek_bytes (bs, &bytes, nbytes); } } diff --git a/ext/audiofile/gstafsink.c b/ext/audiofile/gstafsink.c index eeac509f..a24991d1 100644 --- a/ext/audiofile/gstafsink.c +++ b/ext/audiofile/gstafsink.c @@ -65,13 +65,13 @@ GST_STATIC_PAD_TEMPLATE ("sink", GST_PAD_SINK, GST_PAD_ALWAYS, GST_STATIC_CAPS ("audio/x-raw-int, " - "rate = (int) [ 1, MAX ], " - "channels = (int) [ 1, 2 ], " - "endianness = (int) BYTE_ORDER, " - "width = (int) { 8, 16 }, " - "depth = (int) { 8, 16 }, " - "signed = (boolean) { true, false }, " - "buffer-frames = (int) [ 1, MAX ]") + "rate = (int) [ 1, MAX ], " + "channels = (int) [ 1, 2 ], " + "endianness = (int) BYTE_ORDER, " + "width = (int) { 8, 16 }, " + "depth = (int) { 8, 16 }, " + "signed = (boolean) { true, false }, " + "buffer-frames = (int) [ 1, MAX ]") ); /* we use an enum for the output type arg */ @@ -93,7 +93,7 @@ gst_afsink_types_get_type (void) if (!afsink_types_type) { afsink_types_type = - g_enum_register_static ("GstAudiosinkTypes", afsink_types); + g_enum_register_static ("GstAudiosinkTypes", afsink_types); } return afsink_types_type; } @@ -136,8 +136,9 @@ gst_afsink_get_type (void) 0, (GInstanceInitFunc) gst_afsink_init, }; + afsink_type = - g_type_register_static (GST_TYPE_ELEMENT, "GstAFSink", &afsink_info, 0); + g_type_register_static (GST_TYPE_ELEMENT, "GstAFSink", &afsink_info, 0); } return afsink_type; } @@ -166,8 +167,8 @@ gst_afsink_class_init (GstAFSinkClass * klass) gst_element_class_install_std_props (GST_ELEMENT_CLASS (klass), "location", ARG_LOCATION, G_PARAM_READWRITE, NULL); - g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_TYPE, g_param_spec_enum ("type", "type", "type", GST_TYPE_AFSINK_TYPES, 0, G_PARAM_READWRITE)); /* CHECKME! */ - g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_OUTPUT_ENDIANNESS, g_param_spec_int ("endianness", "endianness", "endianness", G_MININT, G_MAXINT, 0, G_PARAM_READWRITE)); /* CHECKME */ + g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_TYPE, g_param_spec_enum ("type", "type", "type", GST_TYPE_AFSINK_TYPES, 0, G_PARAM_READWRITE)); /* CHECKME! */ + g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_OUTPUT_ENDIANNESS, g_param_spec_int ("endianness", "endianness", "endianness", G_MININT, G_MAXINT, 0, G_PARAM_READWRITE)); /* CHECKME */ gst_afsink_signals[SIGNAL_HANDOFF] = g_signal_new ("handoff", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST, @@ -188,7 +189,7 @@ gst_afsink_init (GstAFSink * afsink) afsink->sinkpad = gst_pad_new_from_template (gst_element_get_pad_template (GST_ELEMENT - (afsink), "sink"), "sink"); + (afsink), "sink"), "sink"); gst_element_add_pad (GST_ELEMENT (afsink), afsink->sinkpad); gst_pad_set_chain_function (afsink->sinkpad, gst_afsink_chain); @@ -217,14 +218,14 @@ gst_afsink_set_property (GObject * object, guint prop_id, const GValue * value, case ARG_LOCATION: /* the element must be stopped or paused in order to do this */ g_return_if_fail ((GST_STATE (sink) < GST_STATE_PLAYING) - || (GST_STATE (sink) == GST_STATE_PAUSED)); + || (GST_STATE (sink) == GST_STATE_PAUSED)); if (sink->filename) - g_free (sink->filename); + g_free (sink->filename); sink->filename = g_strdup (g_value_get_string (value)); if ((GST_STATE (sink) == GST_STATE_PAUSED) - && (sink->filename != NULL)) { - gst_afsink_close_file (sink); - gst_afsink_open_file (sink); + && (sink->filename != NULL)) { + gst_afsink_close_file (sink); + gst_afsink_open_file (sink); } break; @@ -236,7 +237,7 @@ gst_afsink_set_property (GObject * object, guint prop_id, const GValue * value, int end = g_value_get_int (value); if (end == 1234 || end == 4321) - sink->endianness_output = end; + sink->endianness_output = end; } break; default: @@ -291,8 +292,8 @@ gst_afsink_open_file (GstAFSink * sink) AFfilesetup outfilesetup; const GstCaps *caps; GstStructure *structure; - int sample_format; /* audiofile's sample format, look in audiofile.h */ - int byte_order = 0; /* audiofile's byte order defines */ + int sample_format; /* audiofile's sample format, look in audiofile.h */ + int byte_order = 0; /* audiofile's byte order defines */ g_return_val_if_fail (!GST_FLAG_IS_SET (sink, GST_AFSINK_OPEN), FALSE); @@ -342,8 +343,8 @@ gst_afsink_open_file (GstAFSink * sink) sink->file = afOpenFile (sink->filename, "w", outfilesetup); if (sink->file == AF_NULL_FILEHANDLE) { GST_ELEMENT_ERROR (sink, RESOURCE, OPEN_WRITE, - (_("Could not open file \"%s\" for writing."), sink->filename), - ("system error: %s", strerror (errno))); + (_("Could not open file \"%s\" for writing."), sink->filename), + ("system error: %s", strerror (errno))); return FALSE; } @@ -364,7 +365,7 @@ gst_afsink_close_file (GstAFSink * sink) /* if (fclose (sink->file) != 0) */ if (afCloseFile (sink->file) != 0) { GST_ELEMENT_ERROR (sink, RESOURCE, CLOSE, - (_("Error closing file \"%s\"."), sink->filename), GST_ERROR_SYSTEM); + (_("Error closing file \"%s\"."), sink->filename), GST_ERROR_SYSTEM); } else { GST_FLAG_UNSET (sink, GST_AFSINK_OPEN); } @@ -417,10 +418,10 @@ gst_afsink_chain (GstPad * pad, GstData * _data) int frameCount = 0; frameCount = - GST_BUFFER_SIZE (buf) / ((afsink->width / 8) * afsink->channels); + GST_BUFFER_SIZE (buf) / ((afsink->width / 8) * afsink->channels); /* g_print ("DEBUG: writing %d frames ", frameCount); */ ret = afWriteFrames (afsink->file, AF_DEFAULT_TRACK, - GST_BUFFER_DATA (buf), frameCount); + GST_BUFFER_DATA (buf), frameCount); if (ret == AF_BAD_WRITE || ret == AF_BAD_LSEEK) { printf ("afsink : Warning : afWriteFrames returned an error (%d)\n", ret); } diff --git a/ext/audiofile/gstafsrc.c b/ext/audiofile/gstafsrc.c index 98a2d38b..d0ce73f9 100644 --- a/ext/audiofile/gstafsrc.c +++ b/ext/audiofile/gstafsrc.c @@ -62,13 +62,13 @@ static GstStaticPadTemplate afsrc_src_factory = GST_STATIC_PAD_TEMPLATE ("src", GST_PAD_SRC, GST_PAD_ALWAYS, GST_STATIC_CAPS ("audio/x-raw-int, " - "rate = (int) [ 1, MAX ], " - "channels = (int) [ 1, MAX ], " - "endianness = (int) BYTE_ORDER, " - "width = (int) { 8, 16 }, " - "depth = (int) { 8, 16 }, " - "signed = (boolean) { true, false }, " - "buffer-frames = (int) [ 1, MAX ]") + "rate = (int) [ 1, MAX ], " + "channels = (int) [ 1, MAX ], " + "endianness = (int) BYTE_ORDER, " + "width = (int) { 8, 16 }, " + "depth = (int) { 8, 16 }, " + "signed = (boolean) { true, false }, " + "buffer-frames = (int) [ 1, MAX ]") ); /* we use an enum for the output type arg */ @@ -133,8 +133,9 @@ gst_afsrc_get_type (void) 0, (GInstanceInitFunc) gst_afsrc_init, }; + afsrc_type = - g_type_register_static (GST_TYPE_ELEMENT, "GstAFSrc", &afsrc_info, 0); + g_type_register_static (GST_TYPE_ELEMENT, "GstAFSrc", &afsrc_info, 0); } return afsrc_type; } @@ -181,7 +182,7 @@ gst_afsrc_init (GstAFSrc * afsrc) /* no need for a template, caps are set based on file, right ? */ afsrc->srcpad = gst_pad_new_from_template (gst_element_get_pad_template (GST_ELEMENT - (afsrc), "src"), "src"); + (afsrc), "src"), "src"); gst_element_add_pad (GST_ELEMENT (afsrc), afsrc->srcpad); gst_pad_use_explicit_caps (afsrc->srcpad); gst_pad_set_get_function (afsrc->srcpad, gst_afsrc_get); @@ -258,7 +259,7 @@ gst_afsrc_set_property (GObject * object, guint prop_id, const GValue * value, switch (prop_id) { case ARG_LOCATION: if (src->filename) - g_free (src->filename); + g_free (src->filename); src->filename = g_strdup (g_value_get_string (value)); break; default: @@ -316,8 +317,8 @@ gst_afsrc_open_file (GstAFSrc * src) src->file = afOpenFile (src->filename, "r", AF_NULL_FILESETUP); if (src->file == AF_NULL_FILEHANDLE) { GST_ELEMENT_ERROR (src, RESOURCE, OPEN_READ, - (_("Could not open file \"%s\" for reading."), src->filename), - ("system error: %s", strerror (errno))); + (_("Could not open file \"%s\" for reading."), src->filename), + ("system error: %s", strerror (errno))); return FALSE; } @@ -327,33 +328,33 @@ gst_afsrc_open_file (GstAFSrc * src) src->channels = afGetChannels (src->file, AF_DEFAULT_TRACK); afGetSampleFormat (src->file, AF_DEFAULT_TRACK, - &sampleFormat, &sampleWidth); + &sampleFormat, &sampleWidth); switch (sampleFormat) { case AF_SAMPFMT_TWOSCOMP: - src->is_signed = TRUE; - break; + src->is_signed = TRUE; + break; case AF_SAMPFMT_UNSIGNED: - src->is_signed = FALSE; - break; + src->is_signed = FALSE; + break; case AF_SAMPFMT_FLOAT: case AF_SAMPFMT_DOUBLE: - GST_DEBUG ("ERROR: float data not supported yet !\n"); + GST_DEBUG ("ERROR: float data not supported yet !\n"); } src->rate = (guint) afGetRate (src->file, AF_DEFAULT_TRACK); src->width = sampleWidth; GST_DEBUG ("input file: %d channels, %d width, %d rate, signed %s\n", - src->channels, src->width, src->rate, src->is_signed ? "yes" : "no"); + src->channels, src->width, src->rate, src->is_signed ? "yes" : "no"); } /* set caps on src */ gst_pad_set_explicit_caps (src->srcpad, gst_caps_new_simple ("audio/x-raw-int", - "endianness", G_TYPE_INT, G_BYTE_ORDER, - "signed", G_TYPE_BOOLEAN, src->is_signed, - "width", G_TYPE_INT, src->width, - "depth", G_TYPE_INT, src->width, - "rate", G_TYPE_INT, src->rate, - "channels", G_TYPE_INT, src->channels, NULL)); + "endianness", G_TYPE_INT, G_BYTE_ORDER, + "signed", G_TYPE_BOOLEAN, src->is_signed, + "width", G_TYPE_INT, src->width, + "depth", G_TYPE_INT, src->width, + "rate", G_TYPE_INT, src->rate, + "channels", G_TYPE_INT, src->channels, NULL)); GST_FLAG_SET (src, GST_AFSRC_OPEN); @@ -369,7 +370,7 @@ gst_afsrc_close_file (GstAFSrc * src) /* if (fclose (src->file) != 0) */ if (afCloseFile (src->file) != 0) { GST_ELEMENT_ERROR (src, RESOURCE, CLOSE, - (_("Error closing file \"%s\"."), src->filename), GST_ERROR_SYSTEM); + (_("Error closing file \"%s\"."), src->filename), GST_ERROR_SYSTEM); } else { GST_FLAG_UNSET (src, GST_AFSRC_OPEN); } @@ -393,7 +394,7 @@ gst_afsrc_change_state (GstElement * element) /* g_print ("DEBUG: GST_AFSRC_OPEN not set\n"); */ if (!gst_afsrc_open_file (GST_AFSRC (element))) { /* g_print ("DEBUG: element tries to open file\n"); */ - return GST_STATE_FAILURE; + return GST_STATE_FAILURE; } } } diff --git a/ext/cdaudio/gstcdaudio.c b/ext/cdaudio/gstcdaudio.c index 95bd30d0..f622d5e4 100644 --- a/ext/cdaudio/gstcdaudio.c +++ b/ext/cdaudio/gstcdaudio.c @@ -134,9 +134,10 @@ gst_cdaudio_get_type (void) (GInstanceInitFunc) gst_cdaudio_init, NULL }; + gst_cdaudio_type = - g_type_register_static (GST_TYPE_BIN, "GstCDAudio", &gst_cdaudio_info, - 0); + g_type_register_static (GST_TYPE_BIN, "GstCDAudio", &gst_cdaudio_info, + 0); track_format = gst_format_register ("track", "CD track"); sector_format = gst_format_register ("sector", "CD sector"); @@ -163,22 +164,22 @@ gst_cdaudio_class_init (GstCDAudioClass * klass) g_object_class_install_property (gobject_klass, ARG_DEVICE, g_param_spec_string ("device", "Device", "CDROM device", - NULL, G_PARAM_READWRITE)); + NULL, G_PARAM_READWRITE)); g_object_class_install_property (gobject_klass, ARG_DISCID, g_param_spec_ulong ("discid", "Disc ID", "CDDB Disc ID", - 0, G_MAXULONG, 0, G_PARAM_READABLE)); + 0, G_MAXULONG, 0, G_PARAM_READABLE)); g_object_class_install_property (gobject_klass, ARG_VOLUME_FL, g_param_spec_int ("volume_fl", "Volume fl", "Front left volume", - 0, 255, 255, G_PARAM_READWRITE)); + 0, 255, 255, G_PARAM_READWRITE)); g_object_class_install_property (gobject_klass, ARG_VOLUME_FR, g_param_spec_int ("volume_fr", "Volume fr", "Front right volume", - 0, 255, 255, G_PARAM_READWRITE)); + 0, 255, 255, G_PARAM_READWRITE)); g_object_class_install_property (gobject_klass, ARG_VOLUME_BL, g_param_spec_int ("volume_bl", "Volume bl", "Back left volume", - 0, 255, 255, G_PARAM_READWRITE)); + 0, 255, 255, G_PARAM_READWRITE)); g_object_class_install_property (gobject_klass, ARG_VOLUME_BR, g_param_spec_int ("volume_br", "Volume br", "Back right volume", - 0, 255, 255, G_PARAM_READWRITE)); + 0, 255, 255, G_PARAM_READWRITE)); gst_cdaudio_signals[TRACK_CHANGE] = g_signal_new ("track-change", G_TYPE_FROM_CLASS (klass), @@ -290,10 +291,10 @@ print_track_info (GstCDAudio * cdaudio) for (i = 0; i < cdaudio->info.disc_total_tracks; i++) { g_print ("%d %d %d %d:%02d\n", i, - cdaudio->info.disc_track[i].track_length.frames, - cdaudio->info.disc_track[i].track_pos.frames, - cdaudio->info.disc_track[i].track_length.minutes, - cdaudio->info.disc_track[i].track_length.seconds); + cdaudio->info.disc_track[i].track_length.frames, + cdaudio->info.disc_track[i].track_pos.frames, + cdaudio->info.disc_track[i].track_length.minutes, + cdaudio->info.disc_track[i].track_length.seconds); } } @@ -310,14 +311,14 @@ gst_cdaudio_change_state (GstElement * element) case GST_STATE_READY_TO_PAUSED: cdaudio->cd_desc = cd_init_device (cdaudio->device); if (cdaudio->cd_desc < 0) - return GST_STATE_FAILURE; + return GST_STATE_FAILURE; /* close tray */ if (cd_close (cdaudio->cd_desc) < 0) - return GST_STATE_FAILURE; + return GST_STATE_FAILURE; if (cd_stat (cdaudio->cd_desc, &cdaudio->info) < 0) - return GST_STATE_FAILURE; + return GST_STATE_FAILURE; print_track_info (cdaudio); @@ -331,12 +332,12 @@ gst_cdaudio_change_state (GstElement * element) gint res; if (cdaudio->was_playing) - res = cd_resume (cdaudio->cd_desc); + res = cd_resume (cdaudio->cd_desc); else - res = cd_play (cdaudio->cd_desc, 1); + res = cd_play (cdaudio->cd_desc, 1); if (res < 0) - return GST_STATE_FAILURE; + return GST_STATE_FAILURE; cdaudio->was_playing = TRUE; g_timer_start (cdaudio->timer); @@ -344,14 +345,14 @@ gst_cdaudio_change_state (GstElement * element) } case GST_STATE_PLAYING_TO_PAUSED: if (cd_pause (cdaudio->cd_desc) < 0) - return GST_STATE_FAILURE; + return GST_STATE_FAILURE; g_timer_stop (cdaudio->timer); break; case GST_STATE_PAUSED_TO_READY: if (cd_stop (cdaudio->cd_desc) < 0) - return GST_STATE_FAILURE; + return GST_STATE_FAILURE; if (cd_finish (cdaudio->cd_desc) < 0) - return GST_STATE_FAILURE; + return GST_STATE_FAILURE; break; case GST_STATE_READY_TO_NULL: break; @@ -386,15 +387,15 @@ gst_cdaudio_send_event (GstElement * element, GstEvent * event) switch (GST_EVENT_TYPE (event)) { case GST_EVENT_SEEK: switch (GST_EVENT_SEEK_FORMAT (event)) { - case GST_FORMAT_TIME: - { - cd_play_pos (cdaudio->cd_desc, 1, - GST_EVENT_SEEK_OFFSET (event) / (60 * GST_SECOND)); - break; - } - default: - res = FALSE; - break; + case GST_FORMAT_TIME: + { + cd_play_pos (cdaudio->cd_desc, 1, + GST_EVENT_SEEK_OFFSET (event) / (60 * GST_SECOND)); + break; + } + default: + res = FALSE; + break; } break; default: @@ -412,8 +413,8 @@ gst_cdaudio_get_formats (GstElement * element) GST_FORMAT_TIME, GST_FORMAT_BYTES, GST_FORMAT_DEFAULT, - 0, /* fillted below */ - 0, /* fillted below */ + 0, /* fillted below */ + 0, /* fillted below */ 0, }; @@ -441,6 +442,7 @@ gst_cdaudio_get_query_types (GstElement * element) GST_QUERY_SEGMENT_END, 0 }; + return query_types; } @@ -465,36 +467,36 @@ gst_cdaudio_query (GstElement * element, GstQueryType type, switch (type) { case GST_QUERY_TOTAL: switch (*format) { - case GST_FORMAT_TIME: - *value = (cdaudio->info.disc_length.minutes * 60 + - cdaudio->info.disc_length.seconds) * GST_SECOND; - break; - default: - { - if (*format == track_format) { - *value = cdaudio->info.disc_total_tracks; - } else { - res = FALSE; - } - break; - } + case GST_FORMAT_TIME: + *value = (cdaudio->info.disc_length.minutes * 60 + + cdaudio->info.disc_length.seconds) * GST_SECOND; + break; + default: + { + if (*format == track_format) { + *value = cdaudio->info.disc_total_tracks; + } else { + res = FALSE; + } + break; + } } break; case GST_QUERY_POSITION: switch (*format) { - case GST_FORMAT_TIME: - *value = (cdaudio->info.disc_time.minutes * 60 + - cdaudio->info.disc_time.seconds) * GST_SECOND; - break; - default: - { - if (*format == track_format) { - *value = cdaudio->info.disc_current_track; - } else { - res = FALSE; - } - break; - } + case GST_FORMAT_TIME: + *value = (cdaudio->info.disc_time.minutes * 60 + + cdaudio->info.disc_time.seconds) * GST_SECOND; + break; + default: + { + if (*format == track_format) { + *value = cdaudio->info.disc_current_track; + } else { + res = FALSE; + } + break; + } } break; default: diff --git a/ext/divx/gstdivxdec.c b/ext/divx/gstdivxdec.c index 737a14ec..d4aa4602 100644 --- a/ext/divx/gstdivxdec.c +++ b/ext/divx/gstdivxdec.c @@ -37,16 +37,16 @@ static GstStaticPadTemplate sink_template = GST_STATIC_PAD_TEMPLATE ("sink", GST_PAD_SINK, GST_PAD_ALWAYS, GST_STATIC_CAPS ("video/x-divx, " - "divxversion = (int) [ 3, 5 ], " - "width = (int) [ 16, 4096 ], " - "height = (int) [ 16, 4096 ], " "framerate = (double) [ 0, MAX ]") + "divxversion = (int) [ 3, 5 ], " + "width = (int) [ 16, 4096 ], " + "height = (int) [ 16, 4096 ], " "framerate = (double) [ 0, MAX ]") ); static GstStaticPadTemplate src_template = GST_STATIC_PAD_TEMPLATE ("src", GST_PAD_SRC, GST_PAD_ALWAYS, GST_STATIC_CAPS (GST_VIDEO_CAPS_YUV ("{ I420, YUY2, YV12, UYVY }") - /* FIXME: 15/16/24/32bpp RGB */ + /* FIXME: 15/16/24/32bpp RGB */ ) ); @@ -125,8 +125,9 @@ gst_divxdec_get_type (void) 0, (GInstanceInitFunc) gst_divxdec_init, }; + divxdec_type = g_type_register_static (GST_TYPE_ELEMENT, - "GstDivxDec", &divxdec_info, 0); + "GstDivxDec", &divxdec_info, 0); } return divxdec_type; } @@ -222,7 +223,7 @@ gst_divxdec_setup (GstDivxDec * divxdec) } if ((ret = decore (&handle, DEC_OPT_INIT, &xinit, NULL)) != 0) { GST_ELEMENT_ERROR (divxdec, LIBRARY, INIT, (NULL), - ("divx library error: %s (%d)", gst_divxdec_error (ret), ret)); + ("divx library error: %s (%d)", gst_divxdec_error (ret), ret)); return FALSE; } @@ -239,7 +240,7 @@ gst_divxdec_setup (GstDivxDec * divxdec) if ((ret = decore (divxdec->handle, DEC_OPT_SETOUT, &output, NULL)) != 0) { GST_ELEMENT_ERROR (divxdec, LIBRARY, SETTINGS, (NULL), - ("error setting output: %s (%d)", gst_divxdec_error (ret), ret)); + ("error setting output: %s (%d)", gst_divxdec_error (ret), ret)); gst_divxdec_unset (divxdec); return FALSE; } @@ -275,7 +276,7 @@ gst_divxdec_chain (GstPad * pad, GstData * _data) if (!divxdec->handle) { if (gst_divxdec_negotiate (divxdec) <= 0) { GST_ELEMENT_ERROR (divxdec, CORE, TOO_LAZY, (NULL), - ("No format set - aborting")); + ("No format set - aborting")); gst_buffer_unref (buf); return; } @@ -296,7 +297,7 @@ gst_divxdec_chain (GstPad * pad, GstData * _data) if ((ret = decore (divxdec->handle, DEC_OPT_FRAME, &xframe, NULL))) { GST_ELEMENT_ERROR (divxdec, STREAM, DECODE, (NULL), - ("Error decoding divx frame: %s (%d)", gst_divxdec_error (ret), ret)); + ("Error decoding divx frame: %s (%d)", gst_divxdec_error (ret), ret)); gst_buffer_unref (buf); return; } @@ -395,16 +396,22 @@ gst_divxdec_negotiate (GstDivxDec * divxdec) gint depth, bpp; guint32 csp; gint bitcnt; - } fmt_list[] = { + } + fmt_list[] = + { { GST_MAKE_FOURCC ('Y', 'U', 'Y', '2'), 16, 16, - GST_MAKE_FOURCC ('Y', 'U', 'Y', '2'), 0}, { + GST_MAKE_FOURCC ('Y', 'U', 'Y', '2'), 0} + , { GST_MAKE_FOURCC ('U', 'Y', 'V', 'Y'), 16, 16, - GST_MAKE_FOURCC ('U', 'Y', 'V', 'Y'), 0}, { + GST_MAKE_FOURCC ('U', 'Y', 'V', 'Y'), 0} + , { GST_MAKE_FOURCC ('I', '4', '2', '0'), 12, 12, - GST_MAKE_FOURCC ('I', '4', '2', '0'), 0}, { + GST_MAKE_FOURCC ('I', '4', '2', '0'), 0} + , { GST_MAKE_FOURCC ('Y', 'V', '1', '2'), 12, 12, - GST_MAKE_FOURCC ('Y', 'V', '1', '2'), 0}, { + GST_MAKE_FOURCC ('Y', 'V', '1', '2'), 0} + , { 0, 0, 0, 0, 0} }; gint i; @@ -413,13 +420,13 @@ gst_divxdec_negotiate (GstDivxDec * divxdec) divxdec->csp = fmt_list[i].csp; caps = gst_caps_new_simple ("video/x-raw-yuv", - "width", G_TYPE_INT, divxdec->width, - "height", G_TYPE_INT, divxdec->height, - "framerate", G_TYPE_DOUBLE, divxdec->fps, - "format", GST_TYPE_FOURCC, fmt_list[i].fourcc, NULL); + "width", G_TYPE_INT, divxdec->width, + "height", G_TYPE_INT, divxdec->height, + "framerate", G_TYPE_DOUBLE, divxdec->fps, + "format", GST_TYPE_FOURCC, fmt_list[i].fourcc, NULL); if (gst_divxdec_setup (divxdec) && - gst_pad_set_explicit_caps (divxdec->srcpad, caps)) { + gst_pad_set_explicit_caps (divxdec->srcpad, caps)) { divxdec->csp = fmt_list[i].csp; divxdec->bpp = fmt_list[i].bpp; divxdec->bitcnt = fmt_list[i].bitcnt; @@ -468,8 +475,8 @@ plugin_init (GstPlugin * plugin) lib_version = decore (NULL, DEC_OPT_VERSION, 0, 0); if (lib_version != DECORE_VERSION) { g_warning ("Version mismatch! This plugin was compiled for " - "DivX version %d, while your library has version %d!", - DECORE_VERSION, lib_version); + "DivX version %d, while your library has version %d!", + DECORE_VERSION, lib_version); return FALSE; } diff --git a/ext/divx/gstdivxenc.c b/ext/divx/gstdivxenc.c index 6d294bb8..3def13d1 100644 --- a/ext/divx/gstdivxenc.c +++ b/ext/divx/gstdivxenc.c @@ -38,7 +38,7 @@ static GstStaticPadTemplate sink_template = GST_STATIC_PAD_TEMPLATE ("sink", GST_PAD_SINK, GST_PAD_ALWAYS, GST_STATIC_CAPS (GST_VIDEO_CAPS_YUV ("{ I420, YUY2, YV12, YVYU, UYVY }") - /* FIXME: 15/16/24/32bpp RGB */ + /* FIXME: 15/16/24/32bpp RGB */ ) ); @@ -46,9 +46,9 @@ static GstStaticPadTemplate src_template = GST_STATIC_PAD_TEMPLATE ("src", GST_PAD_SRC, GST_PAD_ALWAYS, GST_STATIC_CAPS ("video/x-divx, " - "divxversion = (int) 5, " - "width = (int) [ 16, 4096 ], " - "height = (int) [ 16, 4096 ], " "framerate = (double) [ 0, MAX ]") + "divxversion = (int) 5, " + "width = (int) [ 16, 4096 ], " + "height = (int) [ 16, 4096 ], " "framerate = (double) [ 0, MAX ]") ); @@ -137,8 +137,9 @@ gst_divxenc_get_type (void) 0, (GInstanceInitFunc) gst_divxenc_init, }; + divxenc_type = g_type_register_static (GST_TYPE_ELEMENT, - "GstDivxEnc", &divxenc_info, 0); + "GstDivxEnc", &divxenc_info, 0); } return divxenc_type; } @@ -171,20 +172,20 @@ gst_divxenc_class_init (GstDivxEncClass * klass) g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_BITRATE, g_param_spec_ulong ("bitrate", "Bitrate", - "Target video bitrate", 0, G_MAXULONG, 0, G_PARAM_READWRITE)); + "Target video bitrate", 0, G_MAXULONG, 0, G_PARAM_READWRITE)); g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_MAXKEYINTERVAL, g_param_spec_int ("max_key_interval", "Max. Key Interval", - "Maximum number of frames between two keyframes", - 0, G_MAXINT, 0, G_PARAM_READWRITE)); + "Maximum number of frames between two keyframes", + 0, G_MAXINT, 0, G_PARAM_READWRITE)); g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_BUFSIZE, g_param_spec_ulong ("buffer_size", "Buffer Size", - "Size of the video buffers", 0, G_MAXULONG, 0, G_PARAM_READABLE)); + "Size of the video buffers", 0, G_MAXULONG, 0, G_PARAM_READABLE)); g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_QUALITY, g_param_spec_int ("quality", "Quality", - "Amount of Motion Estimation", 1, 5, 3, G_PARAM_READWRITE)); + "Amount of Motion Estimation", 1, 5, 3, G_PARAM_READWRITE)); gobject_class->set_property = gst_divxenc_set_property; gobject_class->get_property = gst_divxenc_get_property; @@ -221,7 +222,7 @@ gst_divxenc_init (GstDivxEnc * divxenc) /* bitrate, etc. */ divxenc->width = divxenc->height = divxenc->csp = divxenc->bitcnt = -1; divxenc->bitrate = 512 * 1024; - divxenc->max_key_interval = -1; /* default - 2*fps */ + divxenc->max_key_interval = -1; /* default - 2*fps */ divxenc->buffer_size = 512 * 1024; divxenc->quality = 3; @@ -279,8 +280,8 @@ gst_divxenc_setup (GstDivxEnc * divxenc) if ((ret = encore (&handle, ENC_OPT_INIT, &input, &output))) { GST_ELEMENT_ERROR (divxenc, LIBRARY, SETTINGS, (NULL), - ("Error setting up divx encoder: %s (%d)", - gst_divxenc_error (ret), ret)); + ("Error setting up divx encoder: %s (%d)", + gst_divxenc_error (ret), ret)); return FALSE; } @@ -339,7 +340,7 @@ gst_divxenc_chain (GstPad * pad, GstData * _data) if ((ret = encore (divxenc->handle, ENC_OPT_ENCODE, &xframe, &xres))) { GST_ELEMENT_ERROR (divxenc, LIBRARY, ENCODE, (NULL), - ("Error encoding divx frame: %s (%d)", gst_divxenc_error (ret), ret)); + ("Error encoding divx frame: %s (%d)", gst_divxenc_error (ret), ret)); gst_buffer_unref (buf); return; } @@ -427,9 +428,9 @@ gst_divxenc_connect (GstPad * pad, const GstCaps * caps) GstCaps *new_caps; new_caps = gst_caps_new_simple ("video/x-divx", - "divxversion", G_TYPE_INT, 5, - "width", G_TYPE_INT, w, - "height", G_TYPE_INT, h, "framerate", G_TYPE_DOUBLE, fps, NULL); + "divxversion", G_TYPE_INT, 5, + "width", G_TYPE_INT, w, + "height", G_TYPE_INT, h, "framerate", G_TYPE_DOUBLE, fps, NULL); ret = gst_pad_set_explicit_caps (divxenc->srcpad, new_caps); if (ret <= 0) { @@ -509,8 +510,8 @@ plugin_init (GstPlugin * plugin) lib_version = encore (NULL, ENC_OPT_VERSION, 0, 0); if (lib_version != ENCORE_VERSION) { g_warning ("Version mismatch! This plugin was compiled for " - "DivX version %d, while your library has version %d!", - ENCORE_VERSION, lib_version); + "DivX version %d, while your library has version %d!", + ENCORE_VERSION, lib_version); return FALSE; } diff --git a/ext/faac/gstfaac.c b/ext/faac/gstfaac.c index 2241014b..cc66fd97 100644 --- a/ext/faac/gstfaac.c +++ b/ext/faac/gstfaac.c @@ -27,15 +27,15 @@ static GstStaticPadTemplate src_template = GST_STATIC_PAD_TEMPLATE ("src", GST_PAD_SRC, GST_PAD_ALWAYS, GST_STATIC_CAPS ("audio/mpeg, " - "mpegversion = (int) { 4, 2 }, " - "channels = (int) [ 1, 6 ], " "rate = (int) [ 8000, 96000 ]") + "mpegversion = (int) { 4, 2 }, " + "channels = (int) [ 1, 6 ], " "rate = (int) [ 8000, 96000 ]") ); static GstStaticPadTemplate sink_template = GST_STATIC_PAD_TEMPLATE ("sink", GST_PAD_SINK, GST_PAD_ALWAYS, - GST_STATIC_CAPS ("audio/x-raw-int, " "endianness = (int) BYTE_ORDER, " "signed = (boolean) TRUE, " "width = (int) 16, " "depth = (int) 16, " "rate = (int) [ 8000, 96000 ], " "channels = (int) [ 1, 6]; " "audio/x-raw-int, " "endianness = (int) BYTE_ORDER, " "signed = (boolean) TRUE, " "width = (int) 32, " "depth = (int) 24, " "rate = (int) [ 8000, 96000], " "channels = (int) [ 1, 6]; " "audio/x-raw-float, " "endianness = (int) BYTE_ORDER, " "depth = (int) 32, " /* sizeof (gfloat) */ - "rate = (int) [ 8000, 96000], " "channels = (int) [ 1, 6]") + GST_STATIC_CAPS ("audio/x-raw-int, " "endianness = (int) BYTE_ORDER, " "signed = (boolean) TRUE, " "width = (int) 16, " "depth = (int) 16, " "rate = (int) [ 8000, 96000 ], " "channels = (int) [ 1, 6]; " "audio/x-raw-int, " "endianness = (int) BYTE_ORDER, " "signed = (boolean) TRUE, " "width = (int) 32, " "depth = (int) 24, " "rate = (int) [ 8000, 96000], " "channels = (int) [ 1, 6]; " "audio/x-raw-float, " "endianness = (int) BYTE_ORDER, " "depth = (int) 32, " /* sizeof (gfloat) */ + "rate = (int) [ 8000, 96000], " "channels = (int) [ 1, 6]") ); enum @@ -88,7 +88,7 @@ gst_faac_get_type (void) }; gst_faac_type = g_type_register_static (GST_TYPE_ELEMENT, - "GstFaac", &gst_faac_info, 0); + "GstFaac", &gst_faac_info, 0); } return gst_faac_type; @@ -129,7 +129,7 @@ gst_faac_profile_get_type (void) }; gst_faac_profile_type = g_enum_register_static ("GstFaacProfile", - gst_faac_profile); + gst_faac_profile); } return gst_faac_profile_type; @@ -150,7 +150,7 @@ gst_faac_shortctl_get_type (void) }; gst_faac_shortctl_type = g_enum_register_static ("GstFaacShortCtl", - gst_faac_shortctl); + gst_faac_shortctl); } return gst_faac_shortctl_type; @@ -167,20 +167,20 @@ gst_faac_class_init (GstFaacClass * klass) /* properties */ g_object_class_install_property (gobject_class, ARG_BITRATE, g_param_spec_int ("bitrate", "Bitrate (bps)", "Bitrate in bits/sec", - 8 * 1024, 320 * 1024, 128 * 1024, G_PARAM_READWRITE)); + 8 * 1024, 320 * 1024, 128 * 1024, G_PARAM_READWRITE)); g_object_class_install_property (gobject_class, ARG_PROFILE, g_param_spec_enum ("profile", "Profile", "MPEG/AAC encoding profile", - GST_TYPE_FAAC_PROFILE, MAIN, G_PARAM_READWRITE)); + GST_TYPE_FAAC_PROFILE, MAIN, G_PARAM_READWRITE)); g_object_class_install_property (gobject_class, ARG_TNS, g_param_spec_boolean ("tns", "TNS", "Use temporal noise shaping", - FALSE, G_PARAM_READWRITE)); + FALSE, G_PARAM_READWRITE)); g_object_class_install_property (gobject_class, ARG_MIDSIDE, g_param_spec_boolean ("midside", "Midside", "Allow mid/side encoding", - TRUE, G_PARAM_READWRITE)); + TRUE, G_PARAM_READWRITE)); g_object_class_install_property (gobject_class, ARG_SHORTCTL, g_param_spec_enum ("shortctl", "Block type", - "Block type encorcing", - GST_TYPE_FAAC_SHORTCTL, MAIN, G_PARAM_READWRITE)); + "Block type encorcing", + GST_TYPE_FAAC_SHORTCTL, MAIN, G_PARAM_READWRITE)); /* virtual functions */ gstelement_class->change_state = gst_faac_change_state; @@ -257,11 +257,11 @@ gst_faac_sinkconnect (GstPad * pad, const GstCaps * caps) bps = 2; break; case 24: - fmt = FAAC_INPUT_32BIT; /* 24-in-32, actually */ + fmt = FAAC_INPUT_32BIT; /* 24-in-32, actually */ bps = 4; break; case 32: - fmt = FAAC_INPUT_FLOAT; /* see template, this is right */ + fmt = FAAC_INPUT_FLOAT; /* see template, this is right */ bps = 4; break; } @@ -282,7 +282,7 @@ gst_faac_sinkconnect (GstPad * pad, const GstCaps * caps) /* if the other side was already set-up, redo that */ if (GST_PAD_CAPS (faac->srcpad)) return gst_faac_srcconnect (faac->srcpad, - gst_pad_get_allowed_caps (faac->srcpad)); + gst_pad_get_allowed_caps (faac->srcpad)); /* else, that'll be done later */ return GST_PAD_LINK_OK; @@ -335,7 +335,7 @@ gst_faac_srcconnect (GstPad * pad, const GstCaps * caps) * that (that the next element is filesink or any element * that does want ADTS headers). */ - conf->outputFormat = 0; /* raw, no ADTS headers */ + conf->outputFormat = 0; /* raw, no ADTS headers */ conf->shortctl = faac->shortctl; if (!faacEncSetConfiguration (faac->handle, conf)) { GST_WARNING ("Faac doesn't support the current conf"); @@ -343,19 +343,19 @@ gst_faac_srcconnect (GstPad * pad, const GstCaps * caps) } newcaps = gst_caps_new_simple ("audio/mpeg", - "mpegversion", G_TYPE_INT, mpegversion, - "channels", G_TYPE_INT, faac->channels, - "rate", G_TYPE_INT, faac->samplerate, NULL); + "mpegversion", G_TYPE_INT, mpegversion, + "channels", G_TYPE_INT, faac->channels, + "rate", G_TYPE_INT, faac->samplerate, NULL); ret = gst_pad_try_set_caps (faac->srcpad, newcaps); switch (ret) { case GST_PAD_LINK_OK: case GST_PAD_LINK_DONE: - return GST_PAD_LINK_DONE; + return GST_PAD_LINK_DONE; case GST_PAD_LINK_DELAYED: - return GST_PAD_LINK_DELAYED; + return GST_PAD_LINK_DELAYED; default: - break; + break; } } @@ -374,33 +374,33 @@ gst_faac_chain (GstPad * pad, GstData * data) switch (GST_EVENT_TYPE (event)) { case GST_EVENT_EOS: - /* flush first */ - while (1) { - outbuf = gst_buffer_new_and_alloc (faac->bytes); - if ((ret_size = faacEncEncode (faac->handle, - NULL, 0, GST_BUFFER_DATA (outbuf), faac->bytes)) < 0) { - GST_ELEMENT_ERROR (faac, LIBRARY, ENCODE, (NULL), (NULL)); - gst_event_unref (event); - gst_buffer_unref (outbuf); - return; - } - - if (ret_size > 0) { - GST_BUFFER_SIZE (outbuf) = ret_size; - GST_BUFFER_TIMESTAMP (outbuf) = 0; - GST_BUFFER_DURATION (outbuf) = 0; - gst_pad_push (faac->srcpad, GST_DATA (outbuf)); - } else { - break; - } - } - - gst_element_set_eos (GST_ELEMENT (faac)); - gst_pad_push (faac->srcpad, data); - return; + /* flush first */ + while (1) { + outbuf = gst_buffer_new_and_alloc (faac->bytes); + if ((ret_size = faacEncEncode (faac->handle, + NULL, 0, GST_BUFFER_DATA (outbuf), faac->bytes)) < 0) { + GST_ELEMENT_ERROR (faac, LIBRARY, ENCODE, (NULL), (NULL)); + gst_event_unref (event); + gst_buffer_unref (outbuf); + return; + } + + if (ret_size > 0) { + GST_BUFFER_SIZE (outbuf) = ret_size; + GST_BUFFER_TIMESTAMP (outbuf) = 0; + GST_BUFFER_DURATION (outbuf) = 0; + gst_pad_push (faac->srcpad, GST_DATA (outbuf)); + } else { + break; + } + } + + gst_element_set_eos (GST_ELEMENT (faac)); + gst_pad_push (faac->srcpad, data); + return; default: - gst_pad_event_default (pad, event); - return; + gst_pad_event_default (pad, event); + return; } } @@ -408,16 +408,16 @@ gst_faac_chain (GstPad * pad, GstData * data) if (!faac->handle) { GST_ELEMENT_ERROR (faac, CORE, NEGOTIATION, (NULL), - ("format wasn't negotiated before chain function")); + ("format wasn't negotiated before chain function")); gst_buffer_unref (inbuf); return; } if (!GST_PAD_CAPS (faac->srcpad)) { if (gst_faac_srcconnect (faac->srcpad, - gst_pad_get_allowed_caps (faac->srcpad)) <= 0) { + gst_pad_get_allowed_caps (faac->srcpad)) <= 0) { GST_ELEMENT_ERROR (faac, CORE, NEGOTIATION, (NULL), - ("failed to negotiate MPEG/AAC format with next element")); + ("failed to negotiate MPEG/AAC format with next element")); gst_buffer_unref (inbuf); return; } @@ -433,27 +433,27 @@ gst_faac_chain (GstPad * pad, GstData * data) /* do we have enough data for one frame? */ if (in_size / faac->bps < faac->samples) { if (in_size > size) { - GstBuffer *merge; - - /* this is panic! we got a buffer, but still don't have enough - * data. Merge them and retry in the next cycle... */ - merge = gst_buffer_merge (faac->cache, inbuf); - gst_buffer_unref (faac->cache); - gst_buffer_unref (inbuf); - faac->cache = merge; + GstBuffer *merge; + + /* this is panic! we got a buffer, but still don't have enough + * data. Merge them and retry in the next cycle... */ + merge = gst_buffer_merge (faac->cache, inbuf); + gst_buffer_unref (faac->cache); + gst_buffer_unref (inbuf); + faac->cache = merge; } else if (in_size == size) { - /* this shouldn't happen, but still... */ - faac->cache = inbuf; + /* this shouldn't happen, but still... */ + faac->cache = inbuf; } else if (in_size > 0) { - faac->cache = gst_buffer_create_sub (inbuf, size - in_size, in_size); - GST_BUFFER_DURATION (faac->cache) = - GST_BUFFER_DURATION (inbuf) * GST_BUFFER_SIZE (faac->cache) / size; - GST_BUFFER_TIMESTAMP (faac->cache) = - GST_BUFFER_TIMESTAMP (inbuf) + (GST_BUFFER_DURATION (inbuf) * - (size - in_size) / size); - gst_buffer_unref (inbuf); + faac->cache = gst_buffer_create_sub (inbuf, size - in_size, in_size); + GST_BUFFER_DURATION (faac->cache) = + GST_BUFFER_DURATION (inbuf) * GST_BUFFER_SIZE (faac->cache) / size; + GST_BUFFER_TIMESTAMP (faac->cache) = + GST_BUFFER_TIMESTAMP (inbuf) + (GST_BUFFER_DURATION (inbuf) * + (size - in_size) / size); + gst_buffer_unref (inbuf); } else { - gst_buffer_unref (inbuf); + gst_buffer_unref (inbuf); } return; @@ -466,7 +466,7 @@ gst_faac_chain (GstPad * pad, GstData * data) /* merge */ subbuf = gst_buffer_create_sub (inbuf, 0, frame_size - (in_size - size)); GST_BUFFER_DURATION (subbuf) = - GST_BUFFER_DURATION (inbuf) * GST_BUFFER_SIZE (subbuf) / size; + GST_BUFFER_DURATION (inbuf) * GST_BUFFER_SIZE (subbuf) / size; merge = gst_buffer_merge (faac->cache, subbuf); gst_buffer_unref (faac->cache); gst_buffer_unref (subbuf); @@ -475,17 +475,17 @@ gst_faac_chain (GstPad * pad, GstData * data) } else { subbuf = gst_buffer_create_sub (inbuf, size - in_size, frame_size); GST_BUFFER_DURATION (subbuf) = - GST_BUFFER_DURATION (inbuf) * GST_BUFFER_SIZE (subbuf) / size; + GST_BUFFER_DURATION (inbuf) * GST_BUFFER_SIZE (subbuf) / size; GST_BUFFER_TIMESTAMP (subbuf) = - GST_BUFFER_TIMESTAMP (inbuf) + (GST_BUFFER_DURATION (inbuf) * - (size - in_size) / size); + GST_BUFFER_TIMESTAMP (inbuf) + (GST_BUFFER_DURATION (inbuf) * + (size - in_size) / size); } outbuf = gst_buffer_new_and_alloc (faac->bytes); if ((ret_size = faacEncEncode (faac->handle, - (gint32 *) GST_BUFFER_DATA (subbuf), - GST_BUFFER_SIZE (subbuf) / faac->bps, - GST_BUFFER_DATA (outbuf), faac->bytes)) < 0) { + (gint32 *) GST_BUFFER_DATA (subbuf), + GST_BUFFER_SIZE (subbuf) / faac->bps, + GST_BUFFER_DATA (outbuf), faac->bytes)) < 0) { GST_ELEMENT_ERROR (faac, LIBRARY, ENCODE, (NULL), (NULL)); gst_buffer_unref (inbuf); gst_buffer_unref (subbuf); @@ -495,14 +495,14 @@ gst_faac_chain (GstPad * pad, GstData * data) if (ret_size > 0) { GST_BUFFER_SIZE (outbuf) = ret_size; if (faac->cache_time != GST_CLOCK_TIME_NONE) { - GST_BUFFER_TIMESTAMP (outbuf) = faac->cache_time; - faac->cache_time = GST_CLOCK_TIME_NONE; + GST_BUFFER_TIMESTAMP (outbuf) = faac->cache_time; + faac->cache_time = GST_CLOCK_TIME_NONE; } else - GST_BUFFER_TIMESTAMP (outbuf) = GST_BUFFER_TIMESTAMP (subbuf); + GST_BUFFER_TIMESTAMP (outbuf) = GST_BUFFER_TIMESTAMP (subbuf); GST_BUFFER_DURATION (outbuf) = GST_BUFFER_DURATION (subbuf); if (faac->cache_duration) { - GST_BUFFER_DURATION (outbuf) += faac->cache_duration; - faac->cache_duration = 0; + GST_BUFFER_DURATION (outbuf) += faac->cache_duration; + faac->cache_duration = 0; } gst_pad_push (faac->srcpad, GST_DATA (outbuf)); } else { @@ -516,7 +516,7 @@ gst_faac_chain (GstPad * pad, GstData * data) gst_buffer_unref (outbuf); if (faac->cache_time != GST_CLOCK_TIME_NONE) - faac->cache_time = GST_BUFFER_TIMESTAMP (subbuf); + faac->cache_time = GST_BUFFER_TIMESTAMP (subbuf); faac->cache_duration += GST_BUFFER_DURATION (subbuf); } @@ -589,12 +589,12 @@ gst_faac_change_state (GstElement * element) switch (GST_STATE_TRANSITION (element)) { case GST_STATE_PAUSED_TO_READY: if (faac->handle) { - faacEncClose (faac->handle); - faac->handle = NULL; + faacEncClose (faac->handle); + faac->handle = NULL; } if (faac->cache) { - gst_buffer_unref (faac->cache); - faac->cache = NULL; + gst_buffer_unref (faac->cache); + faac->cache = NULL; } faac->cache_time = GST_CLOCK_TIME_NONE; faac->cache_duration = 0; diff --git a/ext/faad/gstfaad.c b/ext/faad/gstfaad.c index 4ddc5ae7..719fb89d 100644 --- a/ext/faad/gstfaad.c +++ b/ext/faad/gstfaad.c @@ -29,23 +29,23 @@ GstStaticPadTemplate sink_template = GST_STATIC_PAD_TEMPLATE ("sink", GST_PAD_SINK, GST_PAD_ALWAYS, GST_STATIC_CAPS ("audio/mpeg, " - "systemstream = (bool) FALSE, " "mpegversion = { (int) 2, (int) 4 }") + "systemstream = (bool) FALSE, " "mpegversion = { (int) 2, (int) 4 }") ); GstStaticPadTemplate src_template = GST_STATIC_PAD_TEMPLATE ("src", GST_PAD_SRC, GST_PAD_ALWAYS, GST_STATIC_CAPS ("audio/x-raw-int, " - "endianness = (int) BYTE_ORDER, " - "signed = (bool) TRUE, " - "width = (int) { 16, 24, 32 }, " - "depth = (int) { 16, 24, 32 }, " - "rate = (int) [ 8000, 96000 ], " - "channels = (int) [ 1, 6 ]; " - "audio/x-raw-float, " - "endianness = (int) BYTE_ORDER, " - "depth = (int) { 32, 64 }, " - "rate = (int) [ 8000, 96000 ], " "channels = (int) [ 1, 6 ]") + "endianness = (int) BYTE_ORDER, " + "signed = (bool) TRUE, " + "width = (int) { 16, 24, 32 }, " + "depth = (int) { 16, 24, 32 }, " + "rate = (int) [ 8000, 96000 ], " + "channels = (int) [ 1, 6 ]; " + "audio/x-raw-float, " + "endianness = (int) BYTE_ORDER, " + "depth = (int) { 32, 64 }, " + "rate = (int) [ 8000, 96000 ], " "channels = (int) [ 1, 6 ]") ); static void gst_faad_base_init (GstFaadClass * klass); @@ -83,7 +83,7 @@ gst_faad_get_type (void) }; gst_faad_type = g_type_register_static (GST_TYPE_ELEMENT, - "GstFaad", &gst_faad_info, 0); + "GstFaad", &gst_faad_info, 0); } return gst_faad_type; @@ -171,46 +171,46 @@ gst_faad_srcgetcaps (GstPad * pad) for (n = 0; fmt[n] != -1; n++) { switch (n) { - case FAAD_FMT_16BIT: - str = gst_structure_new ("audio/x-raw-int", - "signed", G_TYPE_BOOLEAN, TRUE, - "width", G_TYPE_INT, 16, "depth", G_TYPE_INT, 16, NULL); - break; - case FAAD_FMT_24BIT: - str = gst_structure_new ("audio/x-raw-int", - "signed", G_TYPE_BOOLEAN, TRUE, - "width", G_TYPE_INT, 24, "depth", G_TYPE_INT, 24, NULL); - break; - case FAAD_FMT_32BIT: - str = gst_structure_new ("audio/x-raw-int", - "signed", G_TYPE_BOOLEAN, TRUE, - "width", G_TYPE_INT, 32, "depth", G_TYPE_INT, 32, NULL); - break; - case FAAD_FMT_FLOAT: - str = gst_structure_new ("audio/x-raw-float", - "depth", G_TYPE_INT, 32, NULL); - break; - case FAAD_FMT_DOUBLE: - str = gst_structure_new ("audio/x-raw-float", - "depth", G_TYPE_INT, 64, NULL); - break; - default: - str = NULL; - break; + case FAAD_FMT_16BIT: + str = gst_structure_new ("audio/x-raw-int", + "signed", G_TYPE_BOOLEAN, TRUE, + "width", G_TYPE_INT, 16, "depth", G_TYPE_INT, 16, NULL); + break; + case FAAD_FMT_24BIT: + str = gst_structure_new ("audio/x-raw-int", + "signed", G_TYPE_BOOLEAN, TRUE, + "width", G_TYPE_INT, 24, "depth", G_TYPE_INT, 24, NULL); + break; + case FAAD_FMT_32BIT: + str = gst_structure_new ("audio/x-raw-int", + "signed", G_TYPE_BOOLEAN, TRUE, + "width", G_TYPE_INT, 32, "depth", G_TYPE_INT, 32, NULL); + break; + case FAAD_FMT_FLOAT: + str = gst_structure_new ("audio/x-raw-float", + "depth", G_TYPE_INT, 32, NULL); + break; + case FAAD_FMT_DOUBLE: + str = gst_structure_new ("audio/x-raw-float", + "depth", G_TYPE_INT, 64, NULL); + break; + default: + str = NULL; + break; } if (!str) - continue; + continue; if (faad->samplerate != -1) { - gst_structure_set (str, "rate", G_TYPE_INT, faad->samplerate, NULL); + gst_structure_set (str, "rate", G_TYPE_INT, faad->samplerate, NULL); } else { - gst_structure_set (str, "rate", GST_TYPE_INT_RANGE, 8000, 96000, NULL); + gst_structure_set (str, "rate", GST_TYPE_INT_RANGE, 8000, 96000, NULL); } if (faad->channels != -1) { - gst_structure_set (str, "channels", G_TYPE_INT, faad->channels, NULL); + gst_structure_set (str, "channels", G_TYPE_INT, faad->channels, NULL); } else { - gst_structure_set (str, "channels", GST_TYPE_INT_RANGE, 1, 6, NULL); + gst_structure_set (str, "channels", GST_TYPE_INT_RANGE, 1, 6, NULL); } gst_structure_set (str, "endianness", G_TYPE_INT, G_BYTE_ORDER, NULL); @@ -252,21 +252,21 @@ gst_faad_srcconnect (GstPad * pad, const GstCaps * caps) gint width; if (!gst_structure_get_int (structure, "depth", &depth) || - !gst_structure_get_int (structure, "width", &width)) + !gst_structure_get_int (structure, "width", &width)) return GST_PAD_LINK_REFUSED; if (depth != width) return GST_PAD_LINK_REFUSED; switch (depth) { case 16: - fmt = FAAD_FMT_16BIT; - break; + fmt = FAAD_FMT_16BIT; + break; case 24: - fmt = FAAD_FMT_24BIT; - break; + fmt = FAAD_FMT_24BIT; + break; case 32: - fmt = FAAD_FMT_32BIT; - break; + fmt = FAAD_FMT_32BIT; + break; } } else { if (!gst_structure_get_int (structure, "depth", &depth)) @@ -274,11 +274,11 @@ gst_faad_srcconnect (GstPad * pad, const GstCaps * caps) switch (depth) { case 32: - fmt = FAAD_FMT_FLOAT; - break; + fmt = FAAD_FMT_FLOAT; + break; case 64: - fmt = FAAD_FMT_DOUBLE; - break; + fmt = FAAD_FMT_DOUBLE; + break; } } @@ -310,12 +310,12 @@ gst_faad_chain (GstPad * pad, GstData * data) switch (GST_EVENT_TYPE (event)) { case GST_EVENT_EOS: - gst_element_set_eos (GST_ELEMENT (faad)); - gst_pad_push (faad->srcpad, data); - return; + gst_element_set_eos (GST_ELEMENT (faad)); + gst_pad_push (faad->srcpad, data); + return; default: - gst_pad_event_default (pad, event); - return; + gst_pad_event_default (pad, event); + return; } } @@ -327,7 +327,7 @@ gst_faad_chain (GstPad * pad, GstData * data) guchar channels; faacDecInit (faad->handle, - GST_BUFFER_DATA (buf), GST_BUFFER_SIZE (buf), &samplerate, &channels); + GST_BUFFER_DATA (buf), GST_BUFFER_SIZE (buf), &samplerate, &channels); faad->samplerate = samplerate; faad->channels = channels; ret = gst_pad_renegotiate (faad->srcpad); @@ -342,7 +342,7 @@ gst_faad_chain (GstPad * pad, GstData * data) GST_BUFFER_DATA (buf), GST_BUFFER_SIZE (buf)); if (info.error) { GST_ELEMENT_ERROR (faad, STREAM, DECODE, (NULL), - ("Failed to decode buffer: %s", faacDecGetErrorMessage (info.error))); + ("Failed to decode buffer: %s", faacDecGetErrorMessage (info.error))); gst_buffer_unref (buf); return; } @@ -384,13 +384,13 @@ gst_faad_change_state (GstElement * element) switch (GST_STATE_TRANSITION (element)) { case GST_STATE_NULL_TO_READY: if (!(faad->handle = faacDecOpen ())) - return GST_STATE_FAILURE; + return GST_STATE_FAILURE; else { - faacDecConfiguration *conf; + faacDecConfiguration *conf; - conf = faacDecGetCurrentConfiguration (faad->handle); - conf->defObjectType = LC; - faacDecSetConfiguration (faad->handle, conf); + conf = faacDecGetCurrentConfiguration (faad->handle); + conf->defObjectType = LC; + faacDecSetConfiguration (faad->handle, conf); } break; case GST_STATE_PAUSED_TO_READY: diff --git a/ext/gsm/gstgsm.c b/ext/gsm/gstgsm.c index 25ee7c93..1f536e2d 100644 --- a/ext/gsm/gstgsm.c +++ b/ext/gsm/gstgsm.c @@ -30,7 +30,7 @@ plugin_init (GstPlugin * plugin) if (!gst_element_register (plugin, "gsmenc", GST_RANK_NONE, GST_TYPE_GSMENC)) return FALSE; if (!gst_element_register (plugin, "gsmdec", GST_RANK_PRIMARY, - GST_TYPE_GSMDEC)) + GST_TYPE_GSMDEC)) return FALSE; return TRUE; diff --git a/ext/gsm/gstgsmdec.c b/ext/gsm/gstgsmdec.c index 0391a403..1b845a64 100644 --- a/ext/gsm/gstgsmdec.c +++ b/ext/gsm/gstgsmdec.c @@ -75,8 +75,9 @@ gst_gsmdec_get_type (void) 0, (GInstanceInitFunc) gst_gsmdec_init, }; + gsmdec_type = - g_type_register_static (GST_TYPE_ELEMENT, "GstGSMDec", &gsmdec_info, 0); + g_type_register_static (GST_TYPE_ELEMENT, "GstGSMDec", &gsmdec_info, 0); } return gsmdec_type; } @@ -86,7 +87,7 @@ GST_STATIC_PAD_TEMPLATE ("sink", GST_PAD_SINK, GST_PAD_ALWAYS, GST_STATIC_CAPS ("audio/x-gsm, " - "rate = (int) [ 1000, 48000 ], " "channels = (int) 1") + "rate = (int) [ 1000, 48000 ], " "channels = (int) 1") ); static GstStaticPadTemplate gsmdec_src_template = @@ -94,11 +95,11 @@ GST_STATIC_PAD_TEMPLATE ("src", GST_PAD_SRC, GST_PAD_ALWAYS, GST_STATIC_CAPS ("audio/x-raw-int, " - "endianness = (int) BYTE_ORDER, " - "signed = (boolean) true, " - "width = (int) 16, " - "depth = (int) 16, " - "rate = (int) [ 1000, 48000 ], " "channels = (int) 1") + "endianness = (int) BYTE_ORDER, " + "signed = (boolean) true, " + "width = (int) 16, " + "depth = (int) 16, " + "rate = (int) [ 1000, 48000 ], " "channels = (int) 1") ); static void @@ -158,12 +159,12 @@ gst_gsmdec_sinkconnect (GstPad * pad, const GstCaps * caps) gst_structure_get_int (structure, "rate", &rate); if (gst_pad_try_set_caps (gsmdec->srcpad, - gst_caps_new_simple ("audio/x-raw-int", - "endianness", G_TYPE_INT, G_BYTE_ORDER, - "signed", G_TYPE_BOOLEAN, TRUE, - "width", G_TYPE_INT, 16, - "depth", G_TYPE_INT, 16, - "rate", G_TYPE_INT, rate, "channels", G_TYPE_INT, 1, NULL)) > 0) { + gst_caps_new_simple ("audio/x-raw-int", + "endianness", G_TYPE_INT, G_BYTE_ORDER, + "signed", G_TYPE_BOOLEAN, TRUE, + "width", G_TYPE_INT, 16, + "depth", G_TYPE_INT, 16, + "rate", G_TYPE_INT, rate, "channels", G_TYPE_INT, 1, NULL)) > 0) { return GST_PAD_LINK_OK; } return GST_PAD_LINK_REFUSED; @@ -191,14 +192,14 @@ gst_gsmdec_chain (GstPad * pad, GstData * _data) GstBuffer *outbuf; memcpy (gsmdec->buffer + gsmdec->bufsize, data, - (33 - gsmdec->bufsize) * sizeof (gsm_byte)); + (33 - gsmdec->bufsize) * sizeof (gsm_byte)); outbuf = gst_buffer_new (); GST_BUFFER_DATA (outbuf) = g_malloc (160 * sizeof (gsm_signal)); GST_BUFFER_SIZE (outbuf) = 160 * sizeof (gsm_signal); gsm_decode (gsmdec->state, gsmdec->buffer, - (gsm_signal *) GST_BUFFER_DATA (outbuf)); + (gsm_signal *) GST_BUFFER_DATA (outbuf)); gst_pad_push (gsmdec->srcpad, GST_DATA (outbuf)); diff --git a/ext/gsm/gstgsmenc.c b/ext/gsm/gstgsmenc.c index c59a7c82..90c90852 100644 --- a/ext/gsm/gstgsmenc.c +++ b/ext/gsm/gstgsmenc.c @@ -75,8 +75,9 @@ gst_gsmenc_get_type (void) 0, (GInstanceInitFunc) gst_gsmenc_init, }; + gsmenc_type = - g_type_register_static (GST_TYPE_ELEMENT, "GstGSMEnc", &gsmenc_info, 0); + g_type_register_static (GST_TYPE_ELEMENT, "GstGSMEnc", &gsmenc_info, 0); } return gsmenc_type; } @@ -86,7 +87,7 @@ GST_STATIC_PAD_TEMPLATE ("src", GST_PAD_SRC, GST_PAD_ALWAYS, GST_STATIC_CAPS ("audio/x-gsm, " - "rate = (int) [ 1000, 48000 ], " "channels = (int) 1") + "rate = (int) [ 1000, 48000 ], " "channels = (int) 1") ); static GstStaticPadTemplate gsmenc_sink_template = @@ -94,11 +95,11 @@ GST_STATIC_PAD_TEMPLATE ("sink", GST_PAD_SINK, GST_PAD_ALWAYS, GST_STATIC_CAPS ("audio/x-raw-int, " - "endianness = (int) BYTE_ORDER, " - "signed = (boolean) true, " - "width = (int) 16, " - "depth = (int) 16, " - "rate = (int) [ 1000, 48000 ], " "channels = (int) 1") + "endianness = (int) BYTE_ORDER, " + "signed = (boolean) true, " + "width = (int) 16, " + "depth = (int) 16, " + "rate = (int) [ 1000, 48000 ], " "channels = (int) 1") ); static void @@ -164,9 +165,9 @@ gst_gsmenc_sinkconnect (GstPad * pad, const GstCaps * caps) structure = gst_caps_get_structure (caps, 0); gst_structure_get_int (structure, "rate", &gsmenc->rate); if (gst_pad_try_set_caps (gsmenc->srcpad, - gst_caps_new_simple ("audio/x-gsm", - "rate", G_TYPE_INT, gsmenc->rate, - "channels", G_TYPE_INT, 1, NULL)) > 0) { + gst_caps_new_simple ("audio/x-gsm", + "rate", G_TYPE_INT, gsmenc->rate, + "channels", G_TYPE_INT, 1, NULL)) > 0) { return GST_PAD_LINK_OK; } return GST_PAD_LINK_REFUSED; @@ -194,14 +195,14 @@ gst_gsmenc_chain (GstPad * pad, GstData * _data) GstBuffer *outbuf; memcpy (gsmenc->buffer + gsmenc->bufsize, data, - (160 - gsmenc->bufsize) * sizeof (gsm_signal)); + (160 - gsmenc->bufsize) * sizeof (gsm_signal)); outbuf = gst_buffer_new (); GST_BUFFER_DATA (outbuf) = g_malloc (33 * sizeof (gsm_byte)); GST_BUFFER_SIZE (outbuf) = 33 * sizeof (gsm_byte); gsm_encode (gsmenc->state, gsmenc->buffer, - (gsm_byte *) GST_BUFFER_DATA (outbuf)); + (gsm_byte *) GST_BUFFER_DATA (outbuf)); GST_BUFFER_TIMESTAMP (outbuf) = gsmenc->next_ts; gst_pad_push (gsmenc->srcpad, GST_DATA (outbuf)); diff --git a/ext/hermes/gsthermescolorspace.c b/ext/hermes/gsthermescolorspace.c index d6cbe965..03ea4dfe 100644 --- a/ext/hermes/gsthermescolorspace.c +++ b/ext/hermes/gsthermescolorspace.c @@ -48,7 +48,8 @@ typedef enum GST_HERMES_COLORSPACE_RGB32_I420, GST_HERMES_COLORSPACE_RGB32_YV12, GST_HERMES_COLORSPACE_420_SWAP, -} GstColorSpaceConverterType; +} +GstColorSpaceConverterType; struct _GstHermesColorspace { @@ -85,7 +86,8 @@ typedef struct _GstHermesColorspaceFormat { GstStaticCaps caps; -} GstHermesColorspaceFormat; +} +GstHermesColorspaceFormat; static GstHermesColorspaceFormat gst_hermes_colorspace_formats[] = { {GST_STATIC_CAPS (GST_VIDEO_CAPS_xRGB)}, @@ -174,125 +176,125 @@ colorspace_setup_converter (GstHermesColorspace * space, GstCaps * from_caps, gst_structure_get_int (from_struct, "bpp", &from_bpp); switch (to_space) { - case GST_MAKE_FOURCC ('R', 'G', 'B', ' '): + case GST_MAKE_FOURCC ('R', 'G', 'B', ' '): #ifdef HAVE_HERMES - { - gint to_bpp; - - gst_structure_get_int (to_struct, "bpp", &to_bpp); - - gst_structure_get_int (from_struct, "red_mask", &space->source.r); - gst_structure_get_int (from_struct, "green_mask", &space->source.g); - gst_structure_get_int (from_struct, "blue_mask", &space->source.b); - space->source.a = 0; - space->srcbpp = space->source.bits = from_bpp; - space->source.indexed = 0; - space->source.has_colorkey = 0; - - GST_INFO ("source red mask %08x", space->source.r); - GST_INFO ("source green mask %08x", space->source.g); - GST_INFO ("source blue mask %08x", space->source.b); - GST_INFO ("source bpp %08x", space->srcbpp); - - gst_structure_get_int (to_struct, "red_mask", &space->dest.r); - gst_structure_get_int (to_struct, "green_mask", &space->dest.g); - gst_structure_get_int (to_struct, "blue_mask", &space->dest.b); - space->dest.a = 0; - space->destbpp = space->dest.bits = to_bpp; - space->dest.indexed = 0; - space->dest.has_colorkey = 0; - - GST_INFO ("dest red mask %08x", space->dest.r); - GST_INFO ("dest green mask %08x", space->dest.g); - GST_INFO ("dest blue mask %08x", space->dest.b); - GST_INFO ("dest bpp %08x", space->destbpp); - - if (!Hermes_ConverterRequest (space->h_handle, &space->source, - &space->dest)) { - g_warning ("Hermes: could not get converter\n"); - return FALSE; - } - GST_INFO ("converter set up"); - space->type = GST_HERMES_COLORSPACE_HERMES; - return TRUE; - } + { + gint to_bpp; + + gst_structure_get_int (to_struct, "bpp", &to_bpp); + + gst_structure_get_int (from_struct, "red_mask", &space->source.r); + gst_structure_get_int (from_struct, "green_mask", &space->source.g); + gst_structure_get_int (from_struct, "blue_mask", &space->source.b); + space->source.a = 0; + space->srcbpp = space->source.bits = from_bpp; + space->source.indexed = 0; + space->source.has_colorkey = 0; + + GST_INFO ("source red mask %08x", space->source.r); + GST_INFO ("source green mask %08x", space->source.g); + GST_INFO ("source blue mask %08x", space->source.b); + GST_INFO ("source bpp %08x", space->srcbpp); + + gst_structure_get_int (to_struct, "red_mask", &space->dest.r); + gst_structure_get_int (to_struct, "green_mask", &space->dest.g); + gst_structure_get_int (to_struct, "blue_mask", &space->dest.b); + space->dest.a = 0; + space->destbpp = space->dest.bits = to_bpp; + space->dest.indexed = 0; + space->dest.has_colorkey = 0; + + GST_INFO ("dest red mask %08x", space->dest.r); + GST_INFO ("dest green mask %08x", space->dest.g); + GST_INFO ("dest blue mask %08x", space->dest.b); + GST_INFO ("dest bpp %08x", space->destbpp); + + if (!Hermes_ConverterRequest (space->h_handle, &space->source, + &space->dest)) { + g_warning ("Hermes: could not get converter\n"); + return FALSE; + } + GST_INFO ("converter set up"); + space->type = GST_HERMES_COLORSPACE_HERMES; + return TRUE; + } #else - g_warning ("colorspace: compiled without hermes!"); - return FALSE; + g_warning ("colorspace: compiled without hermes!"); + return FALSE; #endif - case GST_MAKE_FOURCC ('Y', 'V', '1', '2'): - if (from_bpp == 32) { - space->type = GST_HERMES_COLORSPACE_RGB32_YV12; - space->destbpp = 12; - return TRUE; - } - case GST_MAKE_FOURCC ('I', '4', '2', '0'): - if (from_bpp == 32) { - space->type = GST_HERMES_COLORSPACE_RGB32_I420; - space->destbpp = 12; - return TRUE; - } - case GST_MAKE_FOURCC ('Y', 'U', 'Y', '2'): - GST_INFO ("colorspace: RGB to YUV with bpp %d not implemented!!", - from_bpp); - return FALSE; + case GST_MAKE_FOURCC ('Y', 'V', '1', '2'): + if (from_bpp == 32) { + space->type = GST_HERMES_COLORSPACE_RGB32_YV12; + space->destbpp = 12; + return TRUE; + } + case GST_MAKE_FOURCC ('I', '4', '2', '0'): + if (from_bpp == 32) { + space->type = GST_HERMES_COLORSPACE_RGB32_I420; + space->destbpp = 12; + return TRUE; + } + case GST_MAKE_FOURCC ('Y', 'U', 'Y', '2'): + GST_INFO ("colorspace: RGB to YUV with bpp %d not implemented!!", + from_bpp); + return FALSE; } break; } case GST_MAKE_FOURCC ('I', '4', '2', '0'): switch (to_space) { - case GST_MAKE_FOURCC ('R', 'G', 'B', ' '): - GST_INFO ("colorspace: YUV to RGB"); - - gst_structure_get_int (to_struct, "bpp", &space->destbpp); - space->converter = - gst_hermes_colorspace_yuv2rgb_get_converter (from_caps, to_caps); - space->type = GST_HERMES_COLORSPACE_YUV_RGB; - return TRUE; - case GST_MAKE_FOURCC ('I', '4', '2', '0'): - space->type = GST_HERMES_COLORSPACE_NONE; - space->destbpp = 12; - return TRUE; - case GST_MAKE_FOURCC ('Y', 'V', '1', '2'): - space->type = GST_HERMES_COLORSPACE_420_SWAP; - space->destbpp = 12; - return TRUE; + case GST_MAKE_FOURCC ('R', 'G', 'B', ' '): + GST_INFO ("colorspace: YUV to RGB"); + + gst_structure_get_int (to_struct, "bpp", &space->destbpp); + space->converter = + gst_hermes_colorspace_yuv2rgb_get_converter (from_caps, to_caps); + space->type = GST_HERMES_COLORSPACE_YUV_RGB; + return TRUE; + case GST_MAKE_FOURCC ('I', '4', '2', '0'): + space->type = GST_HERMES_COLORSPACE_NONE; + space->destbpp = 12; + return TRUE; + case GST_MAKE_FOURCC ('Y', 'V', '1', '2'): + space->type = GST_HERMES_COLORSPACE_420_SWAP; + space->destbpp = 12; + return TRUE; } break; case GST_MAKE_FOURCC ('Y', 'U', 'Y', '2'): switch (to_space) { - case GST_MAKE_FOURCC ('I', '4', '2', '0'): - space->type = GST_HERMES_COLORSPACE_YUY2_I420; - space->destbpp = 12; - return TRUE; - case GST_MAKE_FOURCC ('Y', 'U', 'Y', '2'): - space->type = GST_HERMES_COLORSPACE_NONE; - space->destbpp = 16; - return TRUE; - case GST_MAKE_FOURCC ('R', 'G', 'B', ' '): - GST_INFO ("colorspace: YUY2 to RGB not implemented!!"); - return FALSE; + case GST_MAKE_FOURCC ('I', '4', '2', '0'): + space->type = GST_HERMES_COLORSPACE_YUY2_I420; + space->destbpp = 12; + return TRUE; + case GST_MAKE_FOURCC ('Y', 'U', 'Y', '2'): + space->type = GST_HERMES_COLORSPACE_NONE; + space->destbpp = 16; + return TRUE; + case GST_MAKE_FOURCC ('R', 'G', 'B', ' '): + GST_INFO ("colorspace: YUY2 to RGB not implemented!!"); + return FALSE; } break; case GST_MAKE_FOURCC ('Y', 'V', '1', '2'): switch (to_space) { - case GST_MAKE_FOURCC ('R', 'G', 'B', ' '): - GST_INFO ("colorspace: YV12 to RGB"); - - gst_structure_get_int (to_struct, "bpp", &space->destbpp); - space->converter = - gst_hermes_colorspace_yuv2rgb_get_converter (from_caps, to_caps); - space->type = GST_HERMES_COLORSPACE_YUV_RGB; - return TRUE; - case GST_MAKE_FOURCC ('I', '4', '2', '0'): - space->type = GST_HERMES_COLORSPACE_420_SWAP; - space->destbpp = 12; - return TRUE; - case GST_MAKE_FOURCC ('Y', 'V', '1', '2'): - space->type = GST_HERMES_COLORSPACE_NONE; - space->destbpp = 12; - return TRUE; + case GST_MAKE_FOURCC ('R', 'G', 'B', ' '): + GST_INFO ("colorspace: YV12 to RGB"); + + gst_structure_get_int (to_struct, "bpp", &space->destbpp); + space->converter = + gst_hermes_colorspace_yuv2rgb_get_converter (from_caps, to_caps); + space->type = GST_HERMES_COLORSPACE_YUV_RGB; + return TRUE; + case GST_MAKE_FOURCC ('I', '4', '2', '0'): + space->type = GST_HERMES_COLORSPACE_420_SWAP; + space->destbpp = 12; + return TRUE; + case GST_MAKE_FOURCC ('Y', 'V', '1', '2'): + space->type = GST_HERMES_COLORSPACE_NONE; + space->destbpp = 12; + return TRUE; } break; } @@ -387,8 +389,8 @@ gst_hermes_colorspace_link (GstPad * pad, const GstCaps * caps) GstCaps *fcaps; fcaps = - gst_caps_copy (gst_static_caps_get (&gst_hermes_colorspace_formats[i]. - caps)); + gst_caps_copy (gst_static_caps_get (&gst_hermes_colorspace_formats[i]. + caps)); icaps = gst_caps_intersect (caps, fcaps); if (!gst_caps_is_empty (icaps)) { @@ -413,8 +415,8 @@ gst_hermes_colorspace_link (GstPad * pad, const GstCaps * caps) othercaps = gst_caps_copy (gst_pad_get_negotiated_caps (otherpad)); gst_caps_set_simple (othercaps, - "width", G_TYPE_INT, width, - "height", G_TYPE_INT, height, "framerate", G_TYPE_DOUBLE, fps, NULL); + "width", G_TYPE_INT, width, + "height", G_TYPE_INT, height, "framerate", G_TYPE_DOUBLE, fps, NULL); link_ret = gst_pad_try_set_caps (otherpad, othercaps); if (link_ret != GST_PAD_LINK_OK) { @@ -425,11 +427,11 @@ gst_hermes_colorspace_link (GstPad * pad, const GstCaps * caps) if (pad == space->srcpad) { space->src_format_index = i; gst_hermes_colorspace_structure_to_hermes_format (&space->src_format, - structure); + structure); } else { space->sink_format_index = i; gst_hermes_colorspace_structure_to_hermes_format (&space->sink_format, - structure); + structure); } space->sink_stride = width * (space->sink_format.bits / 8); @@ -442,7 +444,7 @@ gst_hermes_colorspace_link (GstPad * pad, const GstCaps * caps) if (gst_pad_is_negotiated (otherpad)) { if (!Hermes_ConverterRequest (space->h_handle, &space->sink_format, - &space->src_format)) { + &space->src_format)) { g_warning ("Hermes: could not get converter\n"); return GST_PAD_LINK_REFUSED; } @@ -469,9 +471,10 @@ gst_hermes_colorspace_get_type (void) 0, (GInstanceInitFunc) gst_hermes_colorspace_init, }; + colorspace_type = - g_type_register_static (GST_TYPE_ELEMENT, "GstHermesColorspace", - &colorspace_info, 0); + g_type_register_static (GST_TYPE_ELEMENT, "GstHermesColorspace", + &colorspace_info, 0); } return colorspace_type; } @@ -481,12 +484,12 @@ static GstStaticPadTemplate gst_hermes_colorspace_src_pad_template = GST_PAD_SRC, GST_PAD_ALWAYS, GST_STATIC_CAPS (GST_VIDEO_CAPS_xRGB "; " - GST_VIDEO_CAPS_RGBx "; " - GST_VIDEO_CAPS_BGRx "; " - GST_VIDEO_CAPS_xBGR "; " - GST_VIDEO_CAPS_BGR "; " - GST_VIDEO_CAPS_RGB "; " - GST_VIDEO_CAPS_RGB_16 "; " GST_VIDEO_CAPS_RGB_15) + GST_VIDEO_CAPS_RGBx "; " + GST_VIDEO_CAPS_BGRx "; " + GST_VIDEO_CAPS_xBGR "; " + GST_VIDEO_CAPS_BGR "; " + GST_VIDEO_CAPS_RGB "; " + GST_VIDEO_CAPS_RGB_16 "; " GST_VIDEO_CAPS_RGB_15) ); static GstStaticPadTemplate gst_hermes_colorspace_sink_pad_template = @@ -494,12 +497,12 @@ static GstStaticPadTemplate gst_hermes_colorspace_sink_pad_template = GST_PAD_SINK, GST_PAD_ALWAYS, GST_STATIC_CAPS (GST_VIDEO_CAPS_xRGB "; " - GST_VIDEO_CAPS_RGBx "; " - GST_VIDEO_CAPS_BGRx "; " - GST_VIDEO_CAPS_xBGR "; " - GST_VIDEO_CAPS_BGR "; " - GST_VIDEO_CAPS_RGB "; " - GST_VIDEO_CAPS_RGB_16 "; " GST_VIDEO_CAPS_RGB_15) + GST_VIDEO_CAPS_RGBx "; " + GST_VIDEO_CAPS_BGRx "; " + GST_VIDEO_CAPS_xBGR "; " + GST_VIDEO_CAPS_BGR "; " + GST_VIDEO_CAPS_RGB "; " + GST_VIDEO_CAPS_RGB_16 "; " GST_VIDEO_CAPS_RGB_15) ); static void @@ -654,7 +657,7 @@ plugin_init (GstPlugin * plugin) g_return_val_if_fail (hermes_res != 0, FALSE); if (!gst_element_register (plugin, "hermescolorspace", GST_RANK_PRIMARY, - GST_TYPE_COLORSPACE)) + GST_TYPE_COLORSPACE)) return FALSE; return TRUE; diff --git a/ext/ivorbis/vorbis.c b/ext/ivorbis/vorbis.c index 774687d6..7980f99a 100644 --- a/ext/ivorbis/vorbis.c +++ b/ext/ivorbis/vorbis.c @@ -33,7 +33,7 @@ plugin_init (GstPlugin * plugin) return FALSE; if (!gst_element_register (plugin, "tremor", GST_RANK_PRIMARY, - ivorbisfile_get_type ())) + ivorbisfile_get_type ())) return FALSE; return TRUE; diff --git a/ext/ivorbis/vorbisfile.c b/ext/ivorbis/vorbisfile.c index 2f4f6503..9f84a8eb 100644 --- a/ext/ivorbis/vorbisfile.c +++ b/ext/ivorbis/vorbisfile.c @@ -152,13 +152,13 @@ ivorbisfile_get_type (void) }; ivorbisfile_type = g_type_register_static (GST_TYPE_ELEMENT, "Ivorbisfile", - &ivorbisfile_info, 0); + &ivorbisfile_info, 0); logical_stream_format = - gst_format_register ("logical_stream", "The logical stream"); + gst_format_register ("logical_stream", "The logical stream"); GST_DEBUG_CATEGORY_INIT (ivorbisfile_debug, "ivorbisfile", 0, - "vorbis in ogg decoding element (integer arithmetic)"); + "vorbis in ogg decoding element (integer arithmetic)"); } return ivorbisfile_type; } @@ -232,10 +232,10 @@ gst_ivorbisfile_class_init (IvorbisfileClass * klass) g_object_class_install_property (gobject_class, ARG_METADATA, g_param_spec_boxed ("metadata", "Metadata", "(logical) Stream metadata", - GST_TYPE_CAPS, G_PARAM_READABLE)); + GST_TYPE_CAPS, G_PARAM_READABLE)); g_object_class_install_property (gobject_class, ARG_STREAMINFO, g_param_spec_boxed ("streaminfo", "stream", - "(logical) Stream information", GST_TYPE_CAPS, G_PARAM_READABLE)); + "(logical) Stream information", GST_TYPE_CAPS, G_PARAM_READABLE)); gobject_class->get_property = gst_ivorbisfile_get_property; gobject_class->set_property = gst_ivorbisfile_set_property; @@ -311,25 +311,25 @@ gst_ivorbisfile_read (void *ptr, size_t size, size_t nmemb, void *datasource) gst_bytestream_get_status (ivorbisfile->bs, &avail, &event); switch (GST_EVENT_TYPE (event)) { - case GST_EVENT_EOS: - GST_DEBUG ("eos"); - ivorbisfile->eos = TRUE; - if (avail == 0) { - gst_event_unref (event); - return 0; - } - break; - case GST_EVENT_DISCONTINUOUS: - GST_DEBUG ("discont"); - ivorbisfile->need_discont = TRUE; - default: - break; + case GST_EVENT_EOS: + GST_DEBUG ("eos"); + ivorbisfile->eos = TRUE; + if (avail == 0) { + gst_event_unref (event); + return 0; + } + break; + case GST_EVENT_DISCONTINUOUS: + GST_DEBUG ("discont"); + ivorbisfile->need_discont = TRUE; + default: + break; } gst_event_unref (event); if (avail > 0) - got_bytes = gst_bytestream_peek_bytes (ivorbisfile->bs, &data, avail); + got_bytes = gst_bytestream_peek_bytes (ivorbisfile->bs, &data, avail); else - got_bytes = 0; + got_bytes = 0; } } @@ -539,13 +539,13 @@ gst_ivorbisfile_loop (GstElement * element) ivorbisfile->total_bytes = 0; ivorbisfile->may_eos = FALSE; ivorbisfile->vf.seekable = gst_bytestream_seek (ivorbisfile->bs, 0, - GST_SEEK_METHOD_SET); + GST_SEEK_METHOD_SET); GST_DEBUG ("ivorbisfile: seekable: %s\n", - ivorbisfile->vf.seekable ? "yes" : "no"); + ivorbisfile->vf.seekable ? "yes" : "no"); /* open our custom ivorbisfile data object with the callbacks we provide */ if (ov_open_callbacks (ivorbisfile, &ivorbisfile->vf, NULL, 0, - ivorbisfile_ov_callbacks) < 0) { + ivorbisfile_ov_callbacks) < 0) { GST_ELEMENT_ERROR (element, STREAM, DECODE, (NULL), (NULL)); return; } @@ -560,45 +560,45 @@ gst_ivorbisfile_loop (GstElement * element) switch (ivorbisfile->seek_format) { case GST_FORMAT_TIME: { - gdouble seek_to = (gdouble) ivorbisfile->seek_value / GST_SECOND; - - if (ivorbisfile->seek_accurate) { - if (ov_time_seek (&ivorbisfile->vf, seek_to) == 0) { - ivorbisfile->need_discont = TRUE; - } - } else { - if (ov_time_seek_page (&ivorbisfile->vf, seek_to) == 0) { - ivorbisfile->need_discont = TRUE; - } - } - break; + gdouble seek_to = (gdouble) ivorbisfile->seek_value / GST_SECOND; + + if (ivorbisfile->seek_accurate) { + if (ov_time_seek (&ivorbisfile->vf, seek_to) == 0) { + ivorbisfile->need_discont = TRUE; + } + } else { + if (ov_time_seek_page (&ivorbisfile->vf, seek_to) == 0) { + ivorbisfile->need_discont = TRUE; + } + } + break; } case GST_FORMAT_DEFAULT: - if (ivorbisfile->seek_accurate) { - if (ov_pcm_seek (&ivorbisfile->vf, ivorbisfile->seek_value) == 0) { - ivorbisfile->need_discont = TRUE; - } - } else { - if (ov_pcm_seek_page (&ivorbisfile->vf, ivorbisfile->seek_value) == 0) { - ivorbisfile->need_discont = TRUE; - } - } - break; + if (ivorbisfile->seek_accurate) { + if (ov_pcm_seek (&ivorbisfile->vf, ivorbisfile->seek_value) == 0) { + ivorbisfile->need_discont = TRUE; + } + } else { + if (ov_pcm_seek_page (&ivorbisfile->vf, ivorbisfile->seek_value) == 0) { + ivorbisfile->need_discont = TRUE; + } + } + break; default: - if (ivorbisfile->seek_format == logical_stream_format) { - gint64 seek_to; - - seek_to = ivorbisfile->vf.offsets[ivorbisfile->seek_value]; - - if (ov_raw_seek (&ivorbisfile->vf, seek_to) == 0) { - ivorbisfile->need_discont = TRUE; - ivorbisfile->current_link = -1; - } else { - g_warning ("raw seek failed"); - } - } else - g_warning ("unknown seek method, implement me !"); - break; + if (ivorbisfile->seek_format == logical_stream_format) { + gint64 seek_to; + + seek_to = ivorbisfile->vf.offsets[ivorbisfile->seek_value]; + + if (ov_raw_seek (&ivorbisfile->vf, seek_to) == 0) { + ivorbisfile->need_discont = TRUE; + ivorbisfile->current_link = -1; + } else { + g_warning ("raw seek failed"); + } + } else + g_warning ("unknown seek method, implement me !"); + break; } ivorbisfile->seek_pending = FALSE; } @@ -630,7 +630,7 @@ gst_ivorbisfile_loop (GstElement * element) /* if the pad is not usable, don't push it out */ if (GST_PAD_IS_USABLE (ivorbisfile->srcpad)) { gst_pad_push (ivorbisfile->srcpad, - GST_DATA (gst_event_new (GST_EVENT_EOS))); + GST_DATA (gst_event_new (GST_EVENT_EOS))); } gst_element_set_eos (element); return; @@ -646,13 +646,13 @@ gst_ivorbisfile_loop (GstElement * element) /* if the pad is not usable, don't push it out */ if (GST_PAD_IS_USABLE (ivorbisfile->srcpad)) { - /* get stream stats */ - samples = (gint64) (ov_pcm_tell (&ivorbisfile->vf)); + /* get stream stats */ + samples = (gint64) (ov_pcm_tell (&ivorbisfile->vf)); - discont = gst_event_new_discontinuous (FALSE, GST_FORMAT_TIME, time, - GST_FORMAT_DEFAULT, samples, NULL); + discont = gst_event_new_discontinuous (FALSE, GST_FORMAT_TIME, time, + GST_FORMAT_DEFAULT, samples, NULL); - gst_pad_push (ivorbisfile->srcpad, GST_DATA (discont)); + gst_pad_push (ivorbisfile->srcpad, GST_DATA (discont)); } } @@ -714,90 +714,90 @@ gst_ivorbisfile_src_convert (GstPad * pad, switch (src_format) { case GST_FORMAT_BYTES: switch (*dest_format) { - case GST_FORMAT_DEFAULT: - *dest_value = src_value / (vi->channels * 2); - break; - case GST_FORMAT_TIME: - { - gint byterate = bytes_per_sample * vi->rate; - - if (byterate == 0) - return FALSE; - *dest_value = src_value * GST_SECOND / byterate; - break; - } - default: - res = FALSE; + case GST_FORMAT_DEFAULT: + *dest_value = src_value / (vi->channels * 2); + break; + case GST_FORMAT_TIME: + { + gint byterate = bytes_per_sample * vi->rate; + + if (byterate == 0) + return FALSE; + *dest_value = src_value * GST_SECOND / byterate; + break; + } + default: + res = FALSE; } case GST_FORMAT_DEFAULT: switch (*dest_format) { - case GST_FORMAT_BYTES: - *dest_value = src_value * bytes_per_sample; - break; - case GST_FORMAT_TIME: - if (vi->rate == 0) - return FALSE; - *dest_value = src_value * GST_SECOND / vi->rate; - break; - default: - res = FALSE; + case GST_FORMAT_BYTES: + *dest_value = src_value * bytes_per_sample; + break; + case GST_FORMAT_TIME: + if (vi->rate == 0) + return FALSE; + *dest_value = src_value * GST_SECOND / vi->rate; + break; + default: + res = FALSE; } break; case GST_FORMAT_TIME: switch (*dest_format) { - case GST_FORMAT_BYTES: - scale = bytes_per_sample; - case GST_FORMAT_DEFAULT: - *dest_value = src_value * scale * vi->rate / GST_SECOND; - break; - default: - res = FALSE; + case GST_FORMAT_BYTES: + scale = bytes_per_sample; + case GST_FORMAT_DEFAULT: + *dest_value = src_value * scale * vi->rate / GST_SECOND; + break; + default: + res = FALSE; } break; default: if (src_format == logical_stream_format) { - /* because we need to convert relative from 0, we have to add - * all pcm totals */ - gint i; - gint64 count = 0; - - switch (*dest_format) { - case GST_FORMAT_BYTES: - res = FALSE; - break; - case GST_FORMAT_DEFAULT: - if (src_value > ivorbisfile->vf.links) { - src_value = ivorbisfile->vf.links; - } - for (i = 0; i < src_value; i++) { - vi = ov_info (&ivorbisfile->vf, i); - - count += ov_pcm_total (&ivorbisfile->vf, i); - } - *dest_value = count; - break; - case GST_FORMAT_TIME: - { - if (src_value > ivorbisfile->vf.links) { - src_value = ivorbisfile->vf.links; - } - for (i = 0; i < src_value; i++) { - vi = ov_info (&ivorbisfile->vf, i); - if (vi->rate) - count += - ov_pcm_total (&ivorbisfile->vf, i) * GST_SECOND / vi->rate; - else - count += ov_time_total (&ivorbisfile->vf, i) * GST_SECOND; - } - /* we use the pcm totals to get the total time, it's more accurate */ - *dest_value = count; - break; - } - default: - res = FALSE; - } + /* because we need to convert relative from 0, we have to add + * all pcm totals */ + gint i; + gint64 count = 0; + + switch (*dest_format) { + case GST_FORMAT_BYTES: + res = FALSE; + break; + case GST_FORMAT_DEFAULT: + if (src_value > ivorbisfile->vf.links) { + src_value = ivorbisfile->vf.links; + } + for (i = 0; i < src_value; i++) { + vi = ov_info (&ivorbisfile->vf, i); + + count += ov_pcm_total (&ivorbisfile->vf, i); + } + *dest_value = count; + break; + case GST_FORMAT_TIME: + { + if (src_value > ivorbisfile->vf.links) { + src_value = ivorbisfile->vf.links; + } + for (i = 0; i < src_value; i++) { + vi = ov_info (&ivorbisfile->vf, i); + if (vi->rate) + count += + ov_pcm_total (&ivorbisfile->vf, i) * GST_SECOND / vi->rate; + else + count += ov_time_total (&ivorbisfile->vf, i) * GST_SECOND; + } + /* we use the pcm totals to get the total time, it's more accurate */ + *dest_value = count; + break; + } + default: + res = FALSE; + } } else - res = FALSE; + res = FALSE; break; } return res; @@ -816,34 +816,34 @@ gst_ivorbisfile_sink_convert (GstPad * pad, switch (src_format) { case GST_FORMAT_BYTES: switch (*dest_format) { - case GST_FORMAT_TIME: - break; - default: - if (*dest_format == logical_stream_format) { - } else - res = FALSE; + case GST_FORMAT_TIME: + break; + default: + if (*dest_format == logical_stream_format) { + } else + res = FALSE; } case GST_FORMAT_TIME: switch (*dest_format) { - case GST_FORMAT_BYTES: - break; - default: - if (*dest_format == logical_stream_format) { - } else - res = FALSE; + case GST_FORMAT_BYTES: + break; + default: + if (*dest_format == logical_stream_format) { + } else + res = FALSE; } default: if (src_format == logical_stream_format) { - switch (*dest_format) { - case GST_FORMAT_TIME: - break; - case GST_FORMAT_BYTES: - break; - default: - res = FALSE; - } + switch (*dest_format) { + case GST_FORMAT_TIME: + break; + case GST_FORMAT_BYTES: + break; + default: + res = FALSE; + } } else - res = FALSE; + res = FALSE; break; } @@ -858,6 +858,7 @@ gst_ivorbisfile_get_query_types (GstPad * pad) GST_QUERY_POSITION, 0 }; + return types; } @@ -878,67 +879,67 @@ gst_ivorbisfile_src_query (GstPad * pad, GstQueryType type, case GST_QUERY_TOTAL: { switch (*format) { - case GST_FORMAT_DEFAULT: - if (ivorbisfile->vf.seekable) - *value = ov_pcm_total (&ivorbisfile->vf, -1); - else - return FALSE; - break; - case GST_FORMAT_BYTES: - if (ivorbisfile->vf.seekable) - *value = ov_pcm_total (&ivorbisfile->vf, -1) * vi->channels * 2; - else - return FALSE; - break; - case GST_FORMAT_TIME: - if (ivorbisfile->vf.seekable) - *value = - (gint64) (ov_time_total (&ivorbisfile->vf, -1) * GST_SECOND); - else - return FALSE; - break; - default: - if (*format == logical_stream_format) { - if (ivorbisfile->vf.seekable) - *value = ivorbisfile->vf.links; - else - return FALSE; - } else - res = FALSE; - break; + case GST_FORMAT_DEFAULT: + if (ivorbisfile->vf.seekable) + *value = ov_pcm_total (&ivorbisfile->vf, -1); + else + return FALSE; + break; + case GST_FORMAT_BYTES: + if (ivorbisfile->vf.seekable) + *value = ov_pcm_total (&ivorbisfile->vf, -1) * vi->channels * 2; + else + return FALSE; + break; + case GST_FORMAT_TIME: + if (ivorbisfile->vf.seekable) + *value = + (gint64) (ov_time_total (&ivorbisfile->vf, -1) * GST_SECOND); + else + return FALSE; + break; + default: + if (*format == logical_stream_format) { + if (ivorbisfile->vf.seekable) + *value = ivorbisfile->vf.links; + else + return FALSE; + } else + res = FALSE; + break; } break; } case GST_QUERY_POSITION: switch (*format) { - case GST_FORMAT_TIME: - if (ivorbisfile->vf.seekable) - *value = (gint64) (ov_time_tell (&ivorbisfile->vf) * GST_SECOND); - else - *value = ivorbisfile->total_bytes * GST_SECOND - / (vi->rate * vi->channels * 2); - break; - case GST_FORMAT_BYTES: - if (ivorbisfile->vf.seekable) - *value = ov_pcm_tell (&ivorbisfile->vf) * vi->channels * 2; - else - *value = ivorbisfile->total_bytes; - break; - case GST_FORMAT_DEFAULT: - if (ivorbisfile->vf.seekable) - *value = ov_pcm_tell (&ivorbisfile->vf); - else - *value = ivorbisfile->total_bytes / (vi->channels * 2); - break; - default: - if (*format == logical_stream_format) { - if (ivorbisfile->vf.seekable) - *value = ivorbisfile->current_link; - else - return FALSE; - } else - res = FALSE; - break; + case GST_FORMAT_TIME: + if (ivorbisfile->vf.seekable) + *value = (gint64) (ov_time_tell (&ivorbisfile->vf) * GST_SECOND); + else + *value = ivorbisfile->total_bytes * GST_SECOND + / (vi->rate * vi->channels * 2); + break; + case GST_FORMAT_BYTES: + if (ivorbisfile->vf.seekable) + *value = ov_pcm_tell (&ivorbisfile->vf) * vi->channels * 2; + else + *value = ivorbisfile->total_bytes; + break; + case GST_FORMAT_DEFAULT: + if (ivorbisfile->vf.seekable) + *value = ov_pcm_tell (&ivorbisfile->vf); + else + *value = ivorbisfile->total_bytes / (vi->channels * 2); + break; + default: + if (*format == logical_stream_format) { + if (ivorbisfile->vf.seekable) + *value = ivorbisfile->current_link; + else + return FALSE; + } else + res = FALSE; + break; } break; default: @@ -956,6 +957,7 @@ gst_ivorbisfile_get_event_masks (GstPad * pad) {GST_EVENT_SEEK, GST_SEEK_METHOD_SET | GST_SEEK_FLAG_ACCURATE}, {0,} }; + return masks; } @@ -976,52 +978,52 @@ gst_ivorbisfile_src_event (GstPad * pad, GstEvent * event) GstFormat format; GST_DEBUG ("ivorbisfile: handling seek event on pad %s:%s", - GST_DEBUG_PAD_NAME (pad)); + GST_DEBUG_PAD_NAME (pad)); if (!ivorbisfile->vf.seekable) { - gst_event_unref (event); - GST_DEBUG ("vorbis stream is not seekable"); - return FALSE; + gst_event_unref (event); + GST_DEBUG ("vorbis stream is not seekable"); + return FALSE; } offset = GST_EVENT_SEEK_OFFSET (event); format = GST_EVENT_SEEK_FORMAT (event); switch (format) { - case GST_FORMAT_TIME: - ivorbisfile->seek_pending = TRUE; - ivorbisfile->seek_value = offset; - ivorbisfile->seek_format = format; - ivorbisfile->seek_accurate = GST_EVENT_SEEK_FLAGS (event) - & GST_SEEK_FLAG_ACCURATE; - break; - case GST_FORMAT_BYTES: - vi = ov_info (&ivorbisfile->vf, -1); - if (vi->channels == 0) { - GST_DEBUG ("vorbis stream has 0 channels ?"); - res = FALSE; - goto done; - } - offset /= vi->channels * 2; - /* fallthrough */ - case GST_FORMAT_DEFAULT: - ivorbisfile->seek_pending = TRUE; - ivorbisfile->seek_value = offset; - ivorbisfile->seek_format = format; - ivorbisfile->seek_accurate = GST_EVENT_SEEK_FLAGS (event) - & GST_SEEK_FLAG_ACCURATE; - break; - default: - if (format == logical_stream_format) { - ivorbisfile->seek_pending = TRUE; - ivorbisfile->seek_value = offset; - ivorbisfile->seek_format = format; - ivorbisfile->seek_accurate = GST_EVENT_SEEK_FLAGS (event) - & GST_SEEK_FLAG_ACCURATE; - } else { - GST_DEBUG ("unhandled seek format"); - res = FALSE; - } - break; + case GST_FORMAT_TIME: + ivorbisfile->seek_pending = TRUE; + ivorbisfile->seek_value = offset; + ivorbisfile->seek_format = format; + ivorbisfile->seek_accurate = GST_EVENT_SEEK_FLAGS (event) + & GST_SEEK_FLAG_ACCURATE; + break; + case GST_FORMAT_BYTES: + vi = ov_info (&ivorbisfile->vf, -1); + if (vi->channels == 0) { + GST_DEBUG ("vorbis stream has 0 channels ?"); + res = FALSE; + goto done; + } + offset /= vi->channels * 2; + /* fallthrough */ + case GST_FORMAT_DEFAULT: + ivorbisfile->seek_pending = TRUE; + ivorbisfile->seek_value = offset; + ivorbisfile->seek_format = format; + ivorbisfile->seek_accurate = GST_EVENT_SEEK_FLAGS (event) + & GST_SEEK_FLAG_ACCURATE; + break; + default: + if (format == logical_stream_format) { + ivorbisfile->seek_pending = TRUE; + ivorbisfile->seek_value = offset; + ivorbisfile->seek_format = format; + ivorbisfile->seek_accurate = GST_EVENT_SEEK_FLAGS (event) + & GST_SEEK_FLAG_ACCURATE; + } else { + GST_DEBUG ("unhandled seek format"); + res = FALSE; + } + break; } break; } diff --git a/ext/jack/gstjack.c b/ext/jack/gstjack.c index 41f078bc..643896a8 100644 --- a/ext/jack/gstjack.c +++ b/ext/jack/gstjack.c @@ -106,8 +106,9 @@ gst_jack_get_type (void) 0, NULL, }; + jack_type = - g_type_register_static (GST_TYPE_ELEMENT, "GstJack", &jack_info, 0); + g_type_register_static (GST_TYPE_ELEMENT, "GstJack", &jack_info, 0); } return jack_type; } @@ -129,8 +130,9 @@ gst_jack_sink_get_type (void) 0, (GInstanceInitFunc) gst_jack_init, }; + jack_type = - g_type_register_static (GST_TYPE_JACK, "GstJackSink", &jack_info, 0); + g_type_register_static (GST_TYPE_JACK, "GstJackSink", &jack_info, 0); } return jack_type; } @@ -152,8 +154,9 @@ gst_jack_src_get_type (void) 0, (GInstanceInitFunc) gst_jack_init, }; + jack_type = - g_type_register_static (GST_TYPE_JACK, "GstJackSrc", &jack_info, 0); + g_type_register_static (GST_TYPE_JACK, "GstJackSrc", &jack_info, 0); } return jack_type; } @@ -240,7 +243,7 @@ gst_jack_set_property (GObject * object, guint prop_id, const GValue * value, switch (prop_id) { case ARG_PORT_NAME_PREFIX: if (this->port_name_prefix) - g_free (this->port_name_prefix); + g_free (this->port_name_prefix); this->port_name_prefix = g_strdup (g_value_get_string (value)); break; default: @@ -318,8 +321,8 @@ gst_jack_request_new_pad (GstElement * element, GstPadTemplate * templ, l = *pad_list; while (l) { if (strcmp (GST_JACK_PAD (l)->name, name) == 0) { - g_warning ("requested port name %s already in use.", name); - return NULL; + g_warning ("requested port name %s already in use.", name); + return NULL; } l = l->next; } @@ -338,7 +341,7 @@ gst_jack_request_new_pad (GstElement * element, GstPadTemplate * templ, count = GPOINTER_TO_INT (g_hash_table_lookup (port_name_counts, - this->port_name_prefix)); + this->port_name_prefix)); g_hash_table_insert (port_name_counts, g_strdup (this->port_name_prefix), GINT_TO_POINTER (count + 1)); @@ -377,26 +380,26 @@ gst_jack_change_state (GstElement * element) JACK_DEBUG ("%s: READY", GST_OBJECT_NAME (GST_OBJECT (this))); if (!this->bin) { - if (!(this->bin = (GstJackBin *) gst_element_get_managing_bin (element)) - || !GST_IS_JACK_BIN (this->bin)) { - this->bin = NULL; - g_warning ("jack element %s needs to be contained in a jack bin.", - GST_OBJECT_NAME (element)); - return GST_STATE_FAILURE; - } - - /* fixme: verify that all names are unique */ - l = this->pads; - pads = - (this->direction == - GST_PAD_SRC) ? &this->bin->src_pads : &this->bin->sink_pads; - while (l) { - pad = GST_JACK_PAD (l); - JACK_DEBUG ("%s: appending pad %s:%s to list", GST_OBJECT_NAME (this), - pad->name, pad->peer_name); - *pads = g_list_append (*pads, pad); - l = g_list_next (l); - } + if (!(this->bin = (GstJackBin *) gst_element_get_managing_bin (element)) + || !GST_IS_JACK_BIN (this->bin)) { + this->bin = NULL; + g_warning ("jack element %s needs to be contained in a jack bin.", + GST_OBJECT_NAME (element)); + return GST_STATE_FAILURE; + } + + /* fixme: verify that all names are unique */ + l = this->pads; + pads = + (this->direction == + GST_PAD_SRC) ? &this->bin->src_pads : &this->bin->sink_pads; + while (l) { + pad = GST_JACK_PAD (l); + JACK_DEBUG ("%s: appending pad %s:%s to list", GST_OBJECT_NAME (this), + pad->name, pad->peer_name); + *pads = g_list_append (*pads, pad); + l = g_list_next (l); + } } break; @@ -404,18 +407,18 @@ gst_jack_change_state (GstElement * element) JACK_DEBUG ("%s: PAUSED", GST_OBJECT_NAME (GST_OBJECT (this))); if (GST_STATE (element) == GST_STATE_READY) { - /* we're in READY->PAUSED */ - l = this->pads; - while (l) { - pad = GST_JACK_PAD (l); - caps = gst_caps_copy (gst_pad_get_negotiated_caps (pad->pad)); - gst_caps_set_simple (caps, - "rate", G_TYPE_INT, (int) this->bin->rate, - "buffer-frames", G_TYPE_INT, (gint) this->bin->nframes, NULL); - if (gst_pad_try_set_caps (pad->pad, caps) <= 0) - return GST_STATE_FAILURE; - l = g_list_next (l); - } + /* we're in READY->PAUSED */ + l = this->pads; + while (l) { + pad = GST_JACK_PAD (l); + caps = gst_caps_copy (gst_pad_get_negotiated_caps (pad->pad)); + gst_caps_set_simple (caps, + "rate", G_TYPE_INT, (int) this->bin->rate, + "buffer-frames", G_TYPE_INT, (gint) this->bin->nframes, NULL); + if (gst_pad_try_set_caps (pad->pad, caps) <= 0) + return GST_STATE_FAILURE; + l = g_list_next (l); + } } break; case GST_STATE_PLAYING: @@ -444,7 +447,7 @@ gst_jack_link (GstPad * pad, const GstCaps * caps) gst_structure_get_int (structure, "rate", &rate); gst_structure_get_int (structure, "buffer-frames", &buffer_frames); if (this->bin && (rate != this->bin->rate || - buffer_frames != this->bin->nframes)) + buffer_frames != this->bin->nframes)) return GST_PAD_LINK_REFUSED; return GST_PAD_LINK_OK; @@ -471,17 +474,17 @@ gst_jack_loop (GstElement * element) buffer = GST_BUFFER (gst_pad_pull (pad->pad)); if (GST_IS_EVENT (buffer)) { - GstEvent *event = GST_EVENT (buffer); - - switch (GST_EVENT_TYPE (buffer)) { - case GST_EVENT_EOS: - gst_element_set_eos (element); - gst_event_unref (event); - return; - default: - gst_pad_event_default (pad->pad, event); - return; - } + GstEvent *event = GST_EVENT (buffer); + + switch (GST_EVENT_TYPE (buffer)) { + case GST_EVENT_EOS: + gst_element_set_eos (element); + gst_event_unref (event); + return; + default: + gst_pad_event_default (pad->pad, event); + return; + } } /* if the other plugins only give out buffer-frames or less (as @@ -490,8 +493,8 @@ gst_jack_loop (GstElement * element) next */ memcpy (pad->data, GST_BUFFER_DATA (buffer), GST_BUFFER_SIZE (buffer)); if (len != GST_BUFFER_SIZE (buffer)) - memset (pad->data + GST_BUFFER_SIZE (buffer), 0, - len - GST_BUFFER_SIZE (buffer)); + memset (pad->data + GST_BUFFER_SIZE (buffer), 0, + len - GST_BUFFER_SIZE (buffer)); gst_buffer_unref (buffer); } else { @@ -509,15 +512,15 @@ static gboolean plugin_init (GstPlugin * plugin) { if (!gst_element_register (plugin, "jackbin", GST_RANK_NONE, - GST_TYPE_JACK_BIN)) + GST_TYPE_JACK_BIN)) return FALSE; if (!gst_element_register (plugin, "jacksrc", GST_RANK_NONE, - GST_TYPE_JACK_SRC)) + GST_TYPE_JACK_SRC)) return FALSE; if (!gst_element_register (plugin, "jacksink", GST_RANK_NONE, - GST_TYPE_JACK_SINK)) + GST_TYPE_JACK_SINK)) return FALSE; return TRUE; diff --git a/ext/jack/gstjackbin.c b/ext/jack/gstjackbin.c index 9be6e915..c2c49570 100644 --- a/ext/jack/gstjackbin.c +++ b/ext/jack/gstjackbin.c @@ -64,8 +64,9 @@ gst_jack_bin_get_type (void) 0, (GInstanceInitFunc) gst_jack_bin_init, }; + jack_bin_type = - g_type_register_static (GST_TYPE_BIN, "GstJackBin", &jack_bin_info, 0); + g_type_register_static (GST_TYPE_BIN, "GstJackBin", &jack_bin_info, 0); } return jack_bin_type; } @@ -111,17 +112,17 @@ gst_jack_bin_change_state (GstElement * element) case GST_STATE_NULL: JACK_DEBUG ("jackbin: NULL state"); if (this->client) { - JACK_DEBUG ("jackbin: closing client"); - jack_client_close (this->client); - this->client = NULL; + JACK_DEBUG ("jackbin: closing client"); + jack_client_close (this->client); + this->client = NULL; } if (_jackbin) - signal (SIGHUP, SIG_DFL); + signal (SIGHUP, SIG_DFL); _jackbin = NULL; if (GST_ELEMENT_CLASS (parent_class)->change_state) - return GST_ELEMENT_CLASS (parent_class)->change_state (element); + return GST_ELEMENT_CLASS (parent_class)->change_state (element); break; case GST_STATE_READY: @@ -131,116 +132,116 @@ gst_jack_bin_change_state (GstElement * element) signal (SIGHUP, sighup_handler); if (!this->client) { - if (!(this->client = jack_client_new ("gst-jack"))) { - g_warning ("jack server not running?"); - return GST_STATE_FAILURE; - } - - gst_scheduler_setup (GST_ELEMENT_SCHED (this)); - - jack_set_process_callback (this->client, process, this); - jack_set_sample_rate_callback (this->client, sample_rate, this); - jack_set_buffer_size_callback (this->client, buffer_size, this); - this->nframes = jack_get_buffer_size (this->client); - jack_on_shutdown (this->client, shutdown, this); + if (!(this->client = jack_client_new ("gst-jack"))) { + g_warning ("jack server not running?"); + return GST_STATE_FAILURE; + } + + gst_scheduler_setup (GST_ELEMENT_SCHED (this)); + + jack_set_process_callback (this->client, process, this); + jack_set_sample_rate_callback (this->client, sample_rate, this); + jack_set_buffer_size_callback (this->client, buffer_size, this); + this->nframes = jack_get_buffer_size (this->client); + jack_on_shutdown (this->client, shutdown, this); } if (GST_FLAG_IS_SET (GST_OBJECT (this), GST_JACK_OPEN)) { - l = this->src_pads; - while (l) { - JACK_DEBUG ("jackbin: unregistering pad %s:%s", - GST_JACK_PAD (l)->name, GST_JACK_PAD (l)->peer_name); - jack_port_unregister (this->client, GST_JACK_PAD (l)->port); - l = g_list_next (l); - } - l = this->sink_pads; - while (l) { - JACK_DEBUG ("jackbin: unregistering pad %s:%s", - GST_JACK_PAD (l)->name, GST_JACK_PAD (l)->peer_name); - jack_port_unregister (this->client, GST_JACK_PAD (l)->port); - l = g_list_next (l); - } - GST_FLAG_UNSET (GST_OBJECT (this), GST_JACK_OPEN); - - if (GST_FLAG_IS_SET (GST_OBJECT (this), GST_JACK_ACTIVE)) { - JACK_DEBUG ("jackbin: deactivating client"); - jack_deactivate (this->client); - GST_FLAG_UNSET (GST_OBJECT (this), GST_JACK_ACTIVE); - } + l = this->src_pads; + while (l) { + JACK_DEBUG ("jackbin: unregistering pad %s:%s", + GST_JACK_PAD (l)->name, GST_JACK_PAD (l)->peer_name); + jack_port_unregister (this->client, GST_JACK_PAD (l)->port); + l = g_list_next (l); + } + l = this->sink_pads; + while (l) { + JACK_DEBUG ("jackbin: unregistering pad %s:%s", + GST_JACK_PAD (l)->name, GST_JACK_PAD (l)->peer_name); + jack_port_unregister (this->client, GST_JACK_PAD (l)->port); + l = g_list_next (l); + } + GST_FLAG_UNSET (GST_OBJECT (this), GST_JACK_OPEN); + + if (GST_FLAG_IS_SET (GST_OBJECT (this), GST_JACK_ACTIVE)) { + JACK_DEBUG ("jackbin: deactivating client"); + jack_deactivate (this->client); + GST_FLAG_UNSET (GST_OBJECT (this), GST_JACK_ACTIVE); + } } if (GST_ELEMENT_CLASS (parent_class)->change_state) - return GST_ELEMENT_CLASS (parent_class)->change_state (element); + return GST_ELEMENT_CLASS (parent_class)->change_state (element); break; case GST_STATE_PAUSED: JACK_DEBUG ("jackbin: PAUSED"); if (!GST_FLAG_IS_SET (GST_OBJECT (this), GST_JACK_OPEN)) { - l = this->src_pads; - while (l) { - pad = GST_JACK_PAD (l); - JACK_DEBUG ("jackbin: registering input port %s (peer %s)", pad->name, - pad->peer_name); - pad->port = - jack_port_register (this->client, pad->name, - JACK_DEFAULT_AUDIO_TYPE, JackPortIsInput | JackPortIsTerminal, 0); - l = g_list_next (l); - } - l = this->sink_pads; - while (l) { - pad = GST_JACK_PAD (l); - JACK_DEBUG ("jackbin: registering output port %s (peer %s)", - pad->name, pad->peer_name); - pad->port = - jack_port_register (this->client, pad->name, - JACK_DEFAULT_AUDIO_TYPE, JackPortIsOutput | JackPortIsTerminal, - 0); - l = g_list_next (l); - } - - /* must activate before connecting */ - if (!GST_FLAG_IS_SET (GST_OBJECT (this), GST_JACK_ACTIVE)) { - JACK_DEBUG ("jackbin: activating client"); - jack_activate (this->client); - GST_FLAG_SET (GST_OBJECT (this), GST_JACK_ACTIVE); - } - - l = this->src_pads; - while (l) { - pad = GST_JACK_PAD (l); - JACK_DEBUG ("connecting jack port %s to gst jack port %s", - pad->peer_name, jack_port_name (pad->port)); - if (jack_connect (this->client, pad->peer_name, - jack_port_name (pad->port))) { - g_warning ("jackbin: could not connect %s and %s", pad->peer_name, - jack_port_name (pad->port)); - return GST_STATE_FAILURE; - } - l = g_list_next (l); - } - l = this->sink_pads; - while (l) { - pad = GST_JACK_PAD (l); - JACK_DEBUG ("connecting gst jack port %s to jack port %s", - jack_port_name (pad->port), pad->peer_name); - if (jack_connect (this->client, jack_port_name (pad->port), - pad->peer_name)) { - g_warning ("jackbin: could not connect %s and %s", pad->peer_name, - jack_port_name (pad->port)); - return GST_STATE_FAILURE; - } - l = g_list_next (l); - } - - JACK_DEBUG ("jackbin: setting OPEN flag"); - GST_FLAG_SET (GST_OBJECT (this), GST_JACK_OPEN); - - if (GST_ELEMENT_CLASS (parent_class)->change_state) - return GST_ELEMENT_CLASS (parent_class)->change_state (element); + l = this->src_pads; + while (l) { + pad = GST_JACK_PAD (l); + JACK_DEBUG ("jackbin: registering input port %s (peer %s)", pad->name, + pad->peer_name); + pad->port = + jack_port_register (this->client, pad->name, + JACK_DEFAULT_AUDIO_TYPE, JackPortIsInput | JackPortIsTerminal, 0); + l = g_list_next (l); + } + l = this->sink_pads; + while (l) { + pad = GST_JACK_PAD (l); + JACK_DEBUG ("jackbin: registering output port %s (peer %s)", + pad->name, pad->peer_name); + pad->port = + jack_port_register (this->client, pad->name, + JACK_DEFAULT_AUDIO_TYPE, JackPortIsOutput | JackPortIsTerminal, + 0); + l = g_list_next (l); + } + + /* must activate before connecting */ + if (!GST_FLAG_IS_SET (GST_OBJECT (this), GST_JACK_ACTIVE)) { + JACK_DEBUG ("jackbin: activating client"); + jack_activate (this->client); + GST_FLAG_SET (GST_OBJECT (this), GST_JACK_ACTIVE); + } + + l = this->src_pads; + while (l) { + pad = GST_JACK_PAD (l); + JACK_DEBUG ("connecting jack port %s to gst jack port %s", + pad->peer_name, jack_port_name (pad->port)); + if (jack_connect (this->client, pad->peer_name, + jack_port_name (pad->port))) { + g_warning ("jackbin: could not connect %s and %s", pad->peer_name, + jack_port_name (pad->port)); + return GST_STATE_FAILURE; + } + l = g_list_next (l); + } + l = this->sink_pads; + while (l) { + pad = GST_JACK_PAD (l); + JACK_DEBUG ("connecting gst jack port %s to jack port %s", + jack_port_name (pad->port), pad->peer_name); + if (jack_connect (this->client, jack_port_name (pad->port), + pad->peer_name)) { + g_warning ("jackbin: could not connect %s and %s", pad->peer_name, + jack_port_name (pad->port)); + return GST_STATE_FAILURE; + } + l = g_list_next (l); + } + + JACK_DEBUG ("jackbin: setting OPEN flag"); + GST_FLAG_SET (GST_OBJECT (this), GST_JACK_OPEN); + + if (GST_ELEMENT_CLASS (parent_class)->change_state) + return GST_ELEMENT_CLASS (parent_class)->change_state (element); } else { - if (GST_ELEMENT_CLASS (parent_class)->change_state) - return GST_ELEMENT_CLASS (parent_class)->change_state (element); + if (GST_ELEMENT_CLASS (parent_class)->change_state) + return GST_ELEMENT_CLASS (parent_class)->change_state (element); } break; @@ -248,7 +249,7 @@ gst_jack_bin_change_state (GstElement * element) JACK_DEBUG ("jackbin: PLAYING"); if (GST_ELEMENT_CLASS (parent_class)->change_state) - return GST_ELEMENT_CLASS (parent_class)->change_state (element); + return GST_ELEMENT_CLASS (parent_class)->change_state (element); break; } diff --git a/ext/ladspa/gstladspa.c b/ext/ladspa/gstladspa.c index 4f6c1f0c..37417fb6 100644 --- a/ext/ladspa/gstladspa.c +++ b/ext/ladspa/gstladspa.c @@ -28,8 +28,8 @@ #include #include "gstladspa.h" -#include /* main ladspa sdk include file */ -#include "utils.h" /* ladspa sdk utility functions */ +#include /* main ladspa sdk include file */ +#include "utils.h" /* ladspa sdk utility functions */ /* 1.0 and the 1.1 preliminary headers don't define a version, but 1.1 final does */ @@ -107,13 +107,13 @@ gst_ladspa_base_init (GstLADSPAClass * klass) /* the factories take ownership of the name */ if (LADSPA_IS_PORT_INPUT (desc->PortDescriptors[j])) { - templ = gst_pad_template_new (name, GST_PAD_SINK, GST_PAD_ALWAYS, - gst_caps_copy (gst_static_caps_get (&ladspa_pad_caps))); - klass->numsinkpads++; + templ = gst_pad_template_new (name, GST_PAD_SINK, GST_PAD_ALWAYS, + gst_caps_copy (gst_static_caps_get (&ladspa_pad_caps))); + klass->numsinkpads++; } else { - templ = gst_pad_template_new (name, GST_PAD_SRC, GST_PAD_ALWAYS, - gst_caps_copy (gst_static_caps_get (&ladspa_pad_caps))); - klass->numsrcpads++; + templ = gst_pad_template_new (name, GST_PAD_SRC, GST_PAD_ALWAYS, + gst_caps_copy (gst_static_caps_get (&ladspa_pad_caps))); + klass->numsrcpads++; } gst_element_class_add_pad_template (element_class, templ); @@ -132,7 +132,7 @@ gst_ladspa_base_init (GstLADSPAClass * klass) else if ((klass->numsinkpads > 0) && (klass->numsrcpads == 0)) details->klass = "Sink/Audio/LADSPA"; else - details->klass = "Filter/Effect/Audio/LADSPA"; /* whatever this is */ + details->klass = "Filter/Effect/Audio/LADSPA"; /* whatever this is */ gst_element_class_set_details (element_class, details); klass->srcpad_portnums = g_new0 (gint, klass->numsrcpads); @@ -144,9 +144,9 @@ gst_ladspa_base_init (GstLADSPAClass * klass) for (j = 0; j < desc->PortCount; j++) { if (LADSPA_IS_PORT_AUDIO (desc->PortDescriptors[j])) { if (LADSPA_IS_PORT_INPUT (desc->PortDescriptors[j])) - klass->sinkpad_portnums[sinkcount++] = j; + klass->sinkpad_portnums[sinkcount++] = j; else - klass->srcpad_portnums[srccount++] = j; + klass->srcpad_portnums[srccount++] = j; } } @@ -185,7 +185,7 @@ gst_ladspa_class_init (GstLADSPAClass * klass) /* walk through the ports, count the input, output and control ports */ for (i = 0; i < desc->PortCount; i++) { if (!LADSPA_IS_PORT_AUDIO (desc->PortDescriptors[i]) && - LADSPA_IS_PORT_INPUT (desc->PortDescriptors[i])) + LADSPA_IS_PORT_INPUT (desc->PortDescriptors[i])) klass->numcontrols++; } @@ -199,7 +199,7 @@ gst_ladspa_class_init (GstLADSPAClass * klass) /* walk through the ports, note the portnums for control params */ for (i = 0; i < desc->PortCount; i++) { if (!LADSPA_IS_PORT_AUDIO (desc->PortDescriptors[i]) && - LADSPA_IS_PORT_INPUT (desc->PortDescriptors[i])) + LADSPA_IS_PORT_INPUT (desc->PortDescriptors[i])) klass->control_portnums[controlcount++] = i; } @@ -232,27 +232,27 @@ gst_ladspa_class_init (GstLADSPAClass * klass) if (LADSPA_IS_HINT_BOUNDED_BELOW (hintdesc)) { klass->control_info[i].lower = TRUE; klass->control_info[i].lowerbound = - desc->PortRangeHints[current_portnum].LowerBound; + desc->PortRangeHints[current_portnum].LowerBound; } else { if (argtype == G_TYPE_INT) - klass->control_info[i].lowerbound = (gfloat) G_MININT; + klass->control_info[i].lowerbound = (gfloat) G_MININT; if (argtype == G_TYPE_FLOAT) - klass->control_info[i].lowerbound = -G_MAXFLOAT; + klass->control_info[i].lowerbound = -G_MAXFLOAT; } if (LADSPA_IS_HINT_BOUNDED_ABOVE (hintdesc)) { klass->control_info[i].upper = TRUE; klass->control_info[i].upperbound = - desc->PortRangeHints[current_portnum].UpperBound; + desc->PortRangeHints[current_portnum].UpperBound; if (LADSPA_IS_HINT_SAMPLE_RATE (hintdesc)) { - klass->control_info[i].samplerate = TRUE; - klass->control_info[i].upperbound *= 44100; /* FIXME? */ + klass->control_info[i].samplerate = TRUE; + klass->control_info[i].upperbound *= 44100; /* FIXME? */ } } else { if (argtype == G_TYPE_INT) - klass->control_info[i].upperbound = (gfloat) G_MAXINT; + klass->control_info[i].upperbound = (gfloat) G_MAXINT; if (argtype == G_TYPE_FLOAT) - klass->control_info[i].upperbound = G_MAXFLOAT; + klass->control_info[i].upperbound = G_MAXFLOAT; } /* use the lowerbound as the default value */ @@ -262,49 +262,49 @@ gst_ladspa_class_init (GstLADSPAClass * klass) /* figure out the defaults */ if (LADSPA_IS_HINT_HAS_DEFAULT (hintdesc)) { if (LADSPA_IS_HINT_DEFAULT_MINIMUM (hintdesc)) - klass->control_info[i].def = klass->control_info[i].lowerbound; + klass->control_info[i].def = klass->control_info[i].lowerbound; else if (LADSPA_IS_HINT_DEFAULT_LOW (hintdesc)) - if (LADSPA_IS_HINT_LOGARITHMIC (hintdesc)) - klass->control_info[i].def = - exp (0.75 * log (klass->control_info[i].lowerbound) + - 0.25 * log (klass->control_info[i].upperbound)); - else - klass->control_info[i].def = - (0.75 * klass->control_info[i].lowerbound + - 0.25 * klass->control_info[i].upperbound); + if (LADSPA_IS_HINT_LOGARITHMIC (hintdesc)) + klass->control_info[i].def = + exp (0.75 * log (klass->control_info[i].lowerbound) + + 0.25 * log (klass->control_info[i].upperbound)); + else + klass->control_info[i].def = + (0.75 * klass->control_info[i].lowerbound + + 0.25 * klass->control_info[i].upperbound); else if (LADSPA_IS_HINT_DEFAULT_MIDDLE (hintdesc)) - if (LADSPA_IS_HINT_LOGARITHMIC (hintdesc)) - klass->control_info[i].def = - exp (0.5 * log (klass->control_info[i].lowerbound) + - 0.5 * log (klass->control_info[i].upperbound)); - else - klass->control_info[i].def = - (0.5 * klass->control_info[i].lowerbound + - 0.5 * klass->control_info[i].upperbound); + if (LADSPA_IS_HINT_LOGARITHMIC (hintdesc)) + klass->control_info[i].def = + exp (0.5 * log (klass->control_info[i].lowerbound) + + 0.5 * log (klass->control_info[i].upperbound)); + else + klass->control_info[i].def = + (0.5 * klass->control_info[i].lowerbound + + 0.5 * klass->control_info[i].upperbound); else if (LADSPA_IS_HINT_DEFAULT_HIGH (hintdesc)) - if (LADSPA_IS_HINT_LOGARITHMIC (hintdesc)) - klass->control_info[i].def = - exp (0.25 * log (klass->control_info[i].lowerbound) + - 0.75 * log (klass->control_info[i].upperbound)); - else - klass->control_info[i].def = - (0.25 * klass->control_info[i].lowerbound + - 0.75 * klass->control_info[i].upperbound); + if (LADSPA_IS_HINT_LOGARITHMIC (hintdesc)) + klass->control_info[i].def = + exp (0.25 * log (klass->control_info[i].lowerbound) + + 0.75 * log (klass->control_info[i].upperbound)); + else + klass->control_info[i].def = + (0.25 * klass->control_info[i].lowerbound + + 0.75 * klass->control_info[i].upperbound); else if (LADSPA_IS_HINT_DEFAULT_MAXIMUM (hintdesc)) - klass->control_info[i].def = klass->control_info[i].upperbound; + klass->control_info[i].def = klass->control_info[i].upperbound; else if (LADSPA_IS_HINT_DEFAULT_0 (hintdesc)) - klass->control_info[i].def = 0.0; + klass->control_info[i].def = 0.0; else if (LADSPA_IS_HINT_DEFAULT_1 (hintdesc)) - klass->control_info[i].def = 1.0; + klass->control_info[i].def = 1.0; else if (LADSPA_IS_HINT_DEFAULT_100 (hintdesc)) - klass->control_info[i].def = 100.0; + klass->control_info[i].def = 100.0; else if (LADSPA_IS_HINT_DEFAULT_440 (hintdesc)) - klass->control_info[i].def = 440.0; + klass->control_info[i].def = 440.0; } #endif /* LADSPA_IS_HINT_HAS_DEFAULT */ klass->control_info[i].def = CLAMP (klass->control_info[i].def, - klass->control_info[i].lowerbound, klass->control_info[i].upperbound); + klass->control_info[i].lowerbound, klass->control_info[i].upperbound); if (LADSPA_IS_PORT_INPUT (desc->PortDescriptors[current_portnum])) { argperms = G_PARAM_READWRITE; @@ -326,7 +326,7 @@ gst_ladspa_class_init (GstLADSPAClass * klass) g_strcanon (argname, G_CSET_A_2_Z G_CSET_a_2_z G_CSET_DIGITS "-", '-'); /* satisfy glib2 (argname[0] must be [A-Za-z]) */ if (!((argname[0] >= 'a' && argname[0] <= 'z') || (argname[0] >= 'A' - && argname[0] <= 'Z'))) { + && argname[0] <= 'Z'))) { tempstr = argname; argname = g_strconcat ("param-", argname, NULL); g_free (tempstr); @@ -338,9 +338,9 @@ gst_ladspa_class_init (GstLADSPAClass * klass) gchar *numargname = g_strdup_printf ("%s_%d", argname, numarg++); while (g_object_class_find_property (G_OBJECT_CLASS (klass), - numargname) != NULL) { - g_free (numargname); - numargname = g_strdup_printf ("%s_%d", argname, numarg++); + numargname) != NULL) { + g_free (numargname); + numargname = g_strdup_printf ("%s_%d", argname, numarg++); } argname = numargname; } @@ -351,19 +351,19 @@ gst_ladspa_class_init (GstLADSPAClass * klass) if (argtype == G_TYPE_BOOLEAN) { paramspec = - g_param_spec_boolean (argname, argname, argname, FALSE, argperms); + g_param_spec_boolean (argname, argname, argname, FALSE, argperms); } else if (argtype == G_TYPE_INT) { paramspec = g_param_spec_int (argname, argname, argname, - (gint) klass->control_info[i].lowerbound, - (gint) klass->control_info[i].upperbound, - (gint) klass->control_info[i].def, argperms); + (gint) klass->control_info[i].lowerbound, + (gint) klass->control_info[i].upperbound, + (gint) klass->control_info[i].def, argperms); } else if (klass->control_info[i].samplerate) { paramspec = g_param_spec_float (argname, argname, argname, - 0.0, G_MAXFLOAT, 0.0, argperms); + 0.0, G_MAXFLOAT, 0.0, argperms); } else { paramspec = g_param_spec_float (argname, argname, argname, - klass->control_info[i].lowerbound, klass->control_info[i].upperbound, - klass->control_info[i].def, argperms); + klass->control_info[i].lowerbound, klass->control_info[i].upperbound, + klass->control_info[i].def, argperms); } /* properties have an offset of 1 */ @@ -395,7 +395,7 @@ gst_ladspa_init (GstLADSPA * ladspa) srccount = 0; for (l = GST_ELEMENT_CLASS (oclass)->padtemplates; l; l = l->next) { GstPad *pad = gst_pad_new_from_template (GST_PAD_TEMPLATE (l->data), - GST_PAD_TEMPLATE_NAME_TEMPLATE (l->data)); + GST_PAD_TEMPLATE_NAME_TEMPLATE (l->data)); gst_pad_set_link_function (pad, gst_ladspa_link); gst_element_add_pad ((GstElement *) ladspa, pad); @@ -413,32 +413,32 @@ gst_ladspa_init (GstLADSPA * ladspa) ladspa->controls[i] = cinfo.def; if (cinfo.toggled) { - gst_dpman_add_required_dparam_callback (ladspa->dpman, - g_param_spec_int (cinfo.param_name, cinfo.name, cinfo.name, - 0, 1, (gint) (ladspa->controls[i]), G_PARAM_READWRITE), - "int", gst_ladspa_update_int, &(ladspa->controls[i]) - ); + gst_dpman_add_required_dparam_callback (ladspa->dpman, + g_param_spec_int (cinfo.param_name, cinfo.name, cinfo.name, + 0, 1, (gint) (ladspa->controls[i]), G_PARAM_READWRITE), + "int", gst_ladspa_update_int, &(ladspa->controls[i]) + ); } else if (cinfo.integer) { - gst_dpman_add_required_dparam_callback (ladspa->dpman, - g_param_spec_int (cinfo.param_name, cinfo.name, cinfo.name, - (gint) cinfo.lowerbound, (gint) cinfo.upperbound, - (gint) ladspa->controls[i], G_PARAM_READWRITE), - "int", gst_ladspa_update_int, &(ladspa->controls[i]) - ); + gst_dpman_add_required_dparam_callback (ladspa->dpman, + g_param_spec_int (cinfo.param_name, cinfo.name, cinfo.name, + (gint) cinfo.lowerbound, (gint) cinfo.upperbound, + (gint) ladspa->controls[i], G_PARAM_READWRITE), + "int", gst_ladspa_update_int, &(ladspa->controls[i]) + ); } else if (cinfo.samplerate) { - gst_dpman_add_required_dparam_direct (ladspa->dpman, - g_param_spec_float (cinfo.param_name, cinfo.name, cinfo.name, - cinfo.lowerbound, cinfo.upperbound, - ladspa->controls[i], G_PARAM_READWRITE), - "hertz-rate-bound", &(ladspa->controls[i]) - ); + gst_dpman_add_required_dparam_direct (ladspa->dpman, + g_param_spec_float (cinfo.param_name, cinfo.name, cinfo.name, + cinfo.lowerbound, cinfo.upperbound, + ladspa->controls[i], G_PARAM_READWRITE), + "hertz-rate-bound", &(ladspa->controls[i]) + ); } else { - gst_dpman_add_required_dparam_direct (ladspa->dpman, - g_param_spec_float (cinfo.param_name, cinfo.name, cinfo.name, - cinfo.lowerbound, cinfo.upperbound, - ladspa->controls[i], G_PARAM_READWRITE), - "float", &(ladspa->controls[i]) - ); + gst_dpman_add_required_dparam_direct (ladspa->dpman, + g_param_spec_float (cinfo.param_name, cinfo.name, cinfo.name, + cinfo.lowerbound, cinfo.upperbound, + ladspa->controls[i], G_PARAM_READWRITE), + "float", &(ladspa->controls[i]) + ); } } } @@ -446,7 +446,7 @@ gst_ladspa_init (GstLADSPA * ladspa) /* nonzero default needed to instantiate() some plugins */ ladspa->samplerate = 44100; - ladspa->buffer_frames = 0; /* should be set with caps */ + ladspa->buffer_frames = 0; /* should be set with caps */ ladspa->activated = FALSE; ladspa->inplace_broken = LADSPA_IS_INPLACE_BROKEN (ladspa->descriptor->Properties); @@ -464,7 +464,7 @@ gst_ladspa_init (GstLADSPA * ladspa) } else if (sinkcount > 1) { /* more than one sink pad needs loop mode */ DEBUG_OBJ (ladspa, "loop mode with %d sink pads and %d src pads", sinkcount, - srccount); + srccount); gst_element_set_loop_function (GST_ELEMENT (ladspa), gst_ladspa_loop); } else if (sinkcount == 0 && srccount == 0) { @@ -472,7 +472,7 @@ gst_ladspa_init (GstLADSPA * ladspa) * it for now */ } else { g_warning ("%d sink pads, %d src pads not yet supported", sinkcount, - srccount); + srccount); } gst_ladspa_instantiate (ladspa); @@ -500,7 +500,7 @@ gst_ladspa_link (GstPad * pad, const GstCaps * caps) for (l = gst_element_get_pad_list (element); l; l = l->next) if (pad != (GstPad *) l->data) if (gst_pad_try_set_caps ((GstPad *) l->data, caps) <= 0) - return GST_PAD_LINK_REFUSED; + return GST_PAD_LINK_REFUSED; /* we assume that the ladspa plugin can handle any sample rate, so this check gets put last */ @@ -523,7 +523,7 @@ static void gst_ladspa_force_src_caps (GstLADSPA * ladspa, GstPad * pad) { if (!ladspa->buffer_frames) { - ladspa->buffer_frames = 256; /* 5 ms at 44100 kHz (just a default...) */ + ladspa->buffer_frames = 256; /* 5 ms at 44100 kHz (just a default...) */ } DEBUG_OBJ (ladspa, "forcing caps with rate=%d, buffer-frames=%d", @@ -531,12 +531,12 @@ gst_ladspa_force_src_caps (GstLADSPA * ladspa, GstPad * pad) gst_pad_try_set_caps (pad, gst_caps_new ("ladspa_src_caps", - "audio/x-raw-float", - gst_props_new ("width", G_TYPE_INT (32), - "endianness", G_TYPE_INT (G_BYTE_ORDER), - "rate", G_TYPE_INT (ladspa->samplerate), - "buffer-frames", G_TYPE_INT (ladspa->buffer_frames), - "channels", G_TYPE_INT (1), NULL))); + "audio/x-raw-float", + gst_props_new ("width", G_TYPE_INT (32), + "endianness", G_TYPE_INT (G_BYTE_ORDER), + "rate", G_TYPE_INT (ladspa->samplerate), + "buffer-frames", G_TYPE_INT (ladspa->buffer_frames), + "channels", G_TYPE_INT (1), NULL))); } #endif @@ -629,7 +629,7 @@ gst_ladspa_instantiate (GstLADSPA * ladspa) /* connect the control ports */ for (i = 0; i < oclass->numcontrols; i++) desc->connect_port (ladspa->handle, - oclass->control_portnums[i], &(ladspa->controls[i])); + oclass->control_portnums[i], &(ladspa->controls[i])); /* reactivate if it was activated before the reinstantiation */ if (was_activated) @@ -731,13 +731,13 @@ gst_ladspa_loop (GstElement * element) /* push it out on all pads */ gst_data_ref_by_count ((GstData *) buffers_in[i], numsrcpads); for (j = 0; j < numsrcpads; j++) - gst_pad_push (ladspa->srcpads[j], GST_DATA (buffers_in[i])); + gst_pad_push (ladspa->srcpads[j], GST_DATA (buffers_in[i])); if (GST_EVENT_TYPE (buffers_in[i]) == GST_EVENT_EOS) { - /* shut down */ - gst_element_set_eos (element); - return; + /* shut down */ + gst_element_set_eos (element); + return; } else { - goto get_buffer; + goto get_buffer; } } @@ -745,8 +745,8 @@ gst_ladspa_loop (GstElement * element) largest_buffer = GST_BUFFER_SIZE (buffers_in[i]) / sizeof (gfloat); else largest_buffer = - MIN (GST_BUFFER_SIZE (buffers_in[i]) / sizeof (gfloat), - largest_buffer); + MIN (GST_BUFFER_SIZE (buffers_in[i]) / sizeof (gfloat), + largest_buffer); data_in[i] = (LADSPA_Data *) GST_BUFFER_DATA (buffers_in[i]); GST_BUFFER_TIMESTAMP (buffers_in[i]) = ladspa->timestamp; } @@ -761,7 +761,7 @@ gst_ladspa_loop (GstElement * element) } for (; i < numsrcpads; i++) { buffers_out[i] = - gst_buffer_new_and_alloc (ladspa->buffer_frames * sizeof (gfloat)); + gst_buffer_new_and_alloc (ladspa->buffer_frames * sizeof (gfloat)); GST_BUFFER_TIMESTAMP (buffers_out[i]) = ladspa->timestamp; data_out[i] = (LADSPA_Data *) GST_BUFFER_DATA (buffers_out[i]); } @@ -778,10 +778,10 @@ gst_ladspa_loop (GstElement * element) for (i = 0; i < numsinkpads; i++) desc->connect_port (ladspa->handle, oclass->sinkpad_portnums[i], - data_in[i]); + data_in[i]); for (i = 0; i < numsrcpads; i++) desc->connect_port (ladspa->handle, oclass->srcpad_portnums[i], - data_out[i]); + data_out[i]); desc->run (ladspa->handle, num_to_process); @@ -874,7 +874,7 @@ gst_ladspa_chain (GstPad * pad, GstData * _data) desc->connect_port (ladspa->handle, oclass->sinkpad_portnums[0], data_in); for (i = 0; i < numsrcpads; i++) desc->connect_port (ladspa->handle, oclass->srcpad_portnums[i], - data_out[i]); + data_out[i]); desc->run (ladspa->handle, num_to_process); @@ -891,7 +891,7 @@ gst_ladspa_chain (GstPad * pad, GstData * _data) if (numsrcpads) { for (i = 0; i < numsrcpads; i++) { DEBUG_OBJ (ladspa, "pushing buffer (%p, length %u bytes) on src pad %d", - buffers_out[i], GST_BUFFER_SIZE (buffers_out[i]), i); + buffers_out[i], GST_BUFFER_SIZE (buffers_out[i]), i); gst_pad_push (ladspa->srcpads[i], GST_DATA (buffers_out[i])); } @@ -979,7 +979,7 @@ ladspa_describe_plugin (const char *pcFullFilename, /* base-init temp alloc */ g_hash_table_insert (ladspa_descriptors, - GINT_TO_POINTER (0), (gpointer) desc); + GINT_TO_POINTER (0), (gpointer) desc); /* create the type now */ type = g_type_register_static (GST_TYPE_ELEMENT, type_name, &typeinfo, 0); @@ -988,7 +988,7 @@ ladspa_describe_plugin (const char *pcFullFilename, /* add this plugin to the hash */ g_hash_table_insert (ladspa_descriptors, - GINT_TO_POINTER (type), (gpointer) desc); + GINT_TO_POINTER (type), (gpointer) desc); } g_hash_table_remove (ladspa_descriptors, GINT_TO_POINTER (0)); diff --git a/ext/ladspa/load.c b/ext/ladspa/load.c index 98337f58..5ea3714b 100644 --- a/ext/ladspa/load.c +++ b/ext/ladspa/load.c @@ -63,36 +63,36 @@ dlopenLADSPA (const char *pcFilename, int iFlag) */ pcLADSPAPath = g_strdup_printf ("%s:/usr/lib/ladspa:/usr/local/lib/ladspa", - getenv ("LADSPA_PATH")); + getenv ("LADSPA_PATH")); if (pcLADSPAPath) { pcStart = pcLADSPAPath; while (*pcStart != '\0') { - pcEnd = pcStart; - while (*pcEnd != ':' && *pcEnd != '\0') - pcEnd++; - - pcBuffer = malloc (iFilenameLength + 2 + (pcEnd - pcStart)); - if (pcEnd > pcStart) - strncpy (pcBuffer, pcStart, pcEnd - pcStart); - iNeedSlash = 0; - if (pcEnd > pcStart) - if (*(pcEnd - 1) != '/') { - iNeedSlash = 1; - pcBuffer[pcEnd - pcStart] = '/'; - } - strcpy (pcBuffer + iNeedSlash + (pcEnd - pcStart), pcFilename); - - pvResult = dlopen (pcBuffer, iFlag); - - free (pcBuffer); - if (pvResult != NULL) - return pvResult; - - pcStart = pcEnd; - if (*pcStart == ':') - pcStart++; + pcEnd = pcStart; + while (*pcEnd != ':' && *pcEnd != '\0') + pcEnd++; + + pcBuffer = malloc (iFilenameLength + 2 + (pcEnd - pcStart)); + if (pcEnd > pcStart) + strncpy (pcBuffer, pcStart, pcEnd - pcStart); + iNeedSlash = 0; + if (pcEnd > pcStart) + if (*(pcEnd - 1) != '/') { + iNeedSlash = 1; + pcBuffer[pcEnd - pcStart] = '/'; + } + strcpy (pcBuffer + iNeedSlash + (pcEnd - pcStart), pcFilename); + + pvResult = dlopen (pcBuffer, iFlag); + + free (pcBuffer); + if (pvResult != NULL) + return pvResult; + + pcStart = pcEnd; + if (*pcStart == ':') + pcStart++; } } } @@ -134,7 +134,7 @@ loadLADSPAPluginLibrary (const char *pcPluginFilename) pvPluginHandle = dlopenLADSPA (pcPluginFilename, RTLD_NOW); if (!pvPluginHandle) { fprintf (stderr, - "Failed to load plugin \"%s\": %s\n", pcPluginFilename, dlerror ()); + "Failed to load plugin \"%s\": %s\n", pcPluginFilename, dlerror ()); exit (1); } @@ -169,10 +169,10 @@ findLADSPAPluginDescriptor (void *pvLADSPAPluginLibrary, if (pcError) { fprintf (stderr, - "Unable to find ladspa_descriptor() function in plugin " - "library file \"%s\": %s.\n" - "Are you sure this is a LADSPA plugin file?\n", - pcPluginLibraryFilename, pcError); + "Unable to find ladspa_descriptor() function in plugin " + "library file \"%s\": %s.\n" + "Are you sure this is a LADSPA plugin file?\n", + pcPluginLibraryFilename, pcError); exit (1); } } @@ -181,8 +181,8 @@ findLADSPAPluginDescriptor (void *pvLADSPAPluginLibrary, psDescriptor = pfDescriptorFunction (lPluginIndex); if (psDescriptor == NULL) { fprintf (stderr, - "Unable to find label \"%s\" in plugin library file \"%s\".\n", - pcPluginLabel, pcPluginLibraryFilename); + "Unable to find label \"%s\" in plugin library file \"%s\".\n", + pcPluginLabel, pcPluginLibraryFilename); exit (1); } if (strcmp (psDescriptor->Label, pcPluginLabel) == 0) diff --git a/ext/ladspa/search.c b/ext/ladspa/search.c index 0f690275..0e481a36 100644 --- a/ext/ladspa/search.c +++ b/ext/ladspa/search.c @@ -61,7 +61,7 @@ static void } pcFilename = malloc (lDirLength + strlen (psDirectoryEntry->d_name) - + 1 + iNeedSlash); + + 1 + iNeedSlash); strcpy (pcFilename, pcDirectory); if (iNeedSlash) strcat (pcFilename, "/"); @@ -73,15 +73,15 @@ static void dlerror (); fDescriptorFunction - = (LADSPA_Descriptor_Function) dlsym (pvPluginHandle, - "ladspa_descriptor"); + = (LADSPA_Descriptor_Function) dlsym (pvPluginHandle, + "ladspa_descriptor"); if (dlerror () == NULL && fDescriptorFunction) { - /* We've successfully found a ladspa_descriptor function. Pass - it to the callback function. */ - fCallbackFunction (pcFilename, pvPluginHandle, fDescriptorFunction); + /* We've successfully found a ladspa_descriptor function. Pass + it to the callback function. */ + fCallbackFunction (pcFilename, pvPluginHandle, fDescriptorFunction); } else { - /* It was a library, but not a LADSPA one. Unload it. */ - dlclose (pcFilename); + /* It was a library, but not a LADSPA one. Unload it. */ + dlclose (pcFilename); } } free (pcFilename); diff --git a/ext/lcs/gstcolorspace.c b/ext/lcs/gstcolorspace.c index 064e52ca..403e53b0 100644 --- a/ext/lcs/gstcolorspace.c +++ b/ext/lcs/gstcolorspace.c @@ -106,15 +106,15 @@ static GstStaticPadTemplate gst_colorspace_src_template = GST_PAD_SRC, GST_PAD_ALWAYS, GST_STATIC_CAPS (GST_VIDEO_CAPS_RGB "; " - GST_VIDEO_CAPS_BGR "; " - GST_VIDEO_CAPS_RGBx "; " - GST_VIDEO_CAPS_xRGB "; " - GST_VIDEO_CAPS_BGRx "; " - GST_VIDEO_CAPS_xBGR "; " - GST_VIDEO_CAPS_RGB_16 "; " - GST_VIDEO_CAPS_RGB_15 "; " - GST_VIDEO_CAPS_YUV ("{ I420, YV12, YUY2, YVYU, UYVY, YUV9, YVU9, " - "Y800, Y41P, Y41B, Y42B, IUY2 }") + GST_VIDEO_CAPS_BGR "; " + GST_VIDEO_CAPS_RGBx "; " + GST_VIDEO_CAPS_xRGB "; " + GST_VIDEO_CAPS_BGRx "; " + GST_VIDEO_CAPS_xBGR "; " + GST_VIDEO_CAPS_RGB_16 "; " + GST_VIDEO_CAPS_RGB_15 "; " + GST_VIDEO_CAPS_YUV ("{ I420, YV12, YUY2, YVYU, UYVY, YUV9, YVU9, " + "Y800, Y41P, Y41B, Y42B, IUY2 }") ) ); @@ -123,15 +123,15 @@ static GstStaticPadTemplate gst_colorspace_sink_template = GST_PAD_SINK, GST_PAD_ALWAYS, GST_STATIC_CAPS (GST_VIDEO_CAPS_RGB "; " - GST_VIDEO_CAPS_BGR "; " - GST_VIDEO_CAPS_RGBx "; " - GST_VIDEO_CAPS_xRGB "; " - GST_VIDEO_CAPS_BGRx "; " - GST_VIDEO_CAPS_xBGR "; " - GST_VIDEO_CAPS_RGB_16 "; " - GST_VIDEO_CAPS_RGB_15 "; " - GST_VIDEO_CAPS_YUV ("{ I420, YV12, YUY2, YVYU, UYVY, YUV9, YVU9, " - "Y800, Y41P, Y41B, Y42B, IUY2 }") + GST_VIDEO_CAPS_BGR "; " + GST_VIDEO_CAPS_RGBx "; " + GST_VIDEO_CAPS_xRGB "; " + GST_VIDEO_CAPS_BGRx "; " + GST_VIDEO_CAPS_xBGR "; " + GST_VIDEO_CAPS_RGB_16 "; " + GST_VIDEO_CAPS_RGB_15 "; " + GST_VIDEO_CAPS_YUV ("{ I420, YV12, YUY2, YVYU, UYVY, YUV9, YVU9, " + "Y800, Y41P, Y41B, Y42B, IUY2 }") ) ); @@ -154,16 +154,16 @@ colorspace_find_lcs_format (const GstCaps * caps) ((LCSFormat *) rgb_fmt)->type = LCS_FORMAT_RGB_PACKED; gst_structure_get_int (structure, "bpp", - &((LCSFormat *) rgb_fmt)->bits_per_pixel); + &((LCSFormat *) rgb_fmt)->bits_per_pixel); gst_structure_get_int (structure, "red_mask", &mask); lcs_utils_mask_to_shift (mask, &rgb_fmt->bits_per_component[LCS_R], - &rgb_fmt->component_bit_offset[LCS_R]); + &rgb_fmt->component_bit_offset[LCS_R]); gst_structure_get_int (structure, "green_mask", &mask); lcs_utils_mask_to_shift (mask, &rgb_fmt->bits_per_component[LCS_G], - &rgb_fmt->component_bit_offset[LCS_G]); + &rgb_fmt->component_bit_offset[LCS_G]); gst_structure_get_int (structure, "blue_mask", &mask); lcs_utils_mask_to_shift (mask, &rgb_fmt->bits_per_component[LCS_B], - &rgb_fmt->component_bit_offset[LCS_B]); + &rgb_fmt->component_bit_offset[LCS_B]); rgb_fmt->bits_per_component[LCS_A] = 0; rgb_fmt->component_bit_offset[LCS_A] = 0; gst_structure_get_int (structure, "endianness", &endianness); @@ -224,7 +224,7 @@ colorspace_setup_converter (GstColorspace * space, const GstCaps * from_caps, if (space->converter) { GST_DEBUG ("trying from " GST_FOURCC_FORMAT " to " GST_FOURCC_FORMAT, - GST_FOURCC_ARGS (from_space), GST_FOURCC_ARGS (to_space)); + GST_FOURCC_ARGS (from_space), GST_FOURCC_ARGS (to_space)); space->disabled = FALSE; return TRUE; } @@ -290,9 +290,9 @@ gst_colorspace_link (GstPad * pad, const GstCaps * caps) othercaps = gst_caps_copy (gst_pad_get_negotiated_caps (otherpad)); gst_caps_set_simple (othercaps, - "width", G_TYPE_INT, width, - "height", G_TYPE_INT, height, - "framerate", G_TYPE_DOUBLE, framerate, NULL); + "width", G_TYPE_INT, width, + "height", G_TYPE_INT, height, + "framerate", G_TYPE_DOUBLE, framerate, NULL); ret = gst_pad_try_set_caps (otherpad, othercaps); if (!GST_PAD_LINK_SUCCESSFUL (ret)) { @@ -329,9 +329,10 @@ gst_colorspace_get_type (void) 0, (GInstanceInitFunc) gst_colorspace_init, }; + colorspace_type = - g_type_register_static (GST_TYPE_ELEMENT, "GstColorspaceLCS", - &colorspace_info, 0); + g_type_register_static (GST_TYPE_ELEMENT, "GstColorspaceLCS", + &colorspace_info, 0); } return colorspace_type; } @@ -407,13 +408,13 @@ gst_colorspace_chain (GstPad * pad, GstData * _data) unsigned long size; lcs_format_buffer_size (lcs_converter_get_dest_format (space->converter), - space->width, space->height, &size); + space->width, space->height, &size); outbuf = gst_pad_alloc_buffer (space->srcpad, GST_BUFFER_OFFSET_NONE, size); lcs_convert_auto (space->converter, - GST_BUFFER_DATA (buf), - GST_BUFFER_DATA (outbuf), space->width, space->height); + GST_BUFFER_DATA (buf), + GST_BUFFER_DATA (outbuf), space->width, space->height); GST_BUFFER_TIMESTAMP (outbuf) = GST_BUFFER_TIMESTAMP (buf); GST_BUFFER_DURATION (outbuf) = GST_BUFFER_DURATION (buf); diff --git a/ext/libfame/gstlibfame.c b/ext/libfame/gstlibfame.c index 43e0e487..d438a61c 100644 --- a/ext/libfame/gstlibfame.c +++ b/ext/libfame/gstlibfame.c @@ -66,23 +66,23 @@ static GstStaticPadTemplate sink_template = GST_STATIC_PAD_TEMPLATE ("sink", GST_PAD_SINK, GST_PAD_ALWAYS, GST_STATIC_CAPS ("video/x-raw-yuv, " - "format = (fourcc) I420, " - "width = (int) [ 16, 4096 ], " - "height = (int) [ 16, 4096 ], " - "framerate = (double) { 23.976024, 24.0, 25.0, 29.970030, 30.0, " - " 50.0, 59.940060, 60.0 }") + "format = (fourcc) I420, " + "width = (int) [ 16, 4096 ], " + "height = (int) [ 16, 4096 ], " + "framerate = (double) { 23.976024, 24.0, 25.0, 29.970030, 30.0, " + " 50.0, 59.940060, 60.0 }") ); static GstStaticPadTemplate src_template = GST_STATIC_PAD_TEMPLATE ("src", GST_PAD_SRC, GST_PAD_ALWAYS, GST_STATIC_CAPS ("video/mpeg, " - "mpegversion = (int) { 1, 4 }, " - "systemstream = (boolean) FALSE, " - "width = (int) [ 16, 4096 ], " - "height = (int) [ 16, 4096 ], " - "framerate = (double) { 23.976024, 24.0, 25.0, 29.970030, 30.0, " - " 50.0, 59.940060, 60.0 }") + "mpegversion = (int) { 1, 4 }, " + "systemstream = (boolean) FALSE, " + "width = (int) [ 16, 4096 ], " + "height = (int) [ 16, 4096 ], " + "framerate = (double) { 23.976024, 24.0, 25.0, 29.970030, 30.0, " + " 50.0, 59.940060, 60.0 }") ); #define MAX_FRAME_RATES 9 @@ -90,7 +90,8 @@ typedef struct { gint num; gint den; -} frame_rate_entry; +} +frame_rate_entry; static const frame_rate_entry frame_rates[] = { {0, 0}, @@ -115,12 +116,12 @@ framerate_to_index (gfloat fps) idx = i; } else { gfloat old_diff = fabs ((1. * frame_rates[idx].num / - frame_rates[idx].den) - fps), - new_diff = fabs ((1. * frame_rates[i].num / - frame_rates[i].den) - fps); + frame_rates[idx].den) - fps), + new_diff = fabs ((1. * frame_rates[i].num / + frame_rates[i].den) - fps); if (new_diff < old_diff) { - idx = i; + idx = i; } } } @@ -161,8 +162,9 @@ gst_fameenc_get_type (void) 0, (GInstanceInitFunc) gst_fameenc_init, }; + fameenc_type = g_type_register_static (GST_TYPE_ELEMENT, - "GstFameEnc", &fameenc_info, 0); + "GstFameEnc", &fameenc_info, 0); } return fameenc_type; } @@ -214,8 +216,8 @@ gst_fameenc_class_init (GstFameEncClass * klass) walk = context->type_list; while (walk) { props = - g_list_insert_sorted (props, walk, - (GCompareFunc) gst_fameenc_item_compare); + g_list_insert_sorted (props, walk, + (GCompareFunc) gst_fameenc_item_compare); walk = walk->next; } @@ -239,21 +241,21 @@ gst_fameenc_class_init (GstFameEncClass * klass) do { if (strstr (walk->type, "/")) { - GEnumValue value; + GEnumValue value; - if (current_default == walk->item) - default_index = current_value; + if (current_default == walk->item) + default_index = current_value; - value.value = current_value++; - value.value_name = g_strdup (walk->type); - value.value_nick = g_strdup (walk->item->name); + value.value = current_value++; + value.value_name = g_strdup (walk->type); + value.value_nick = g_strdup (walk->item->name); - g_array_append_val (array, value); + g_array_append_val (array, value); } props_walk = g_list_next (props_walk); if (props_walk) - walk = (fame_list_t *) props_walk->data; + walk = (fame_list_t *) props_walk->data; } while (props_walk && !strncmp (walk->type, current_type, current_len)); @@ -262,43 +264,43 @@ gst_fameenc_class_init (GstFameEncClass * klass) GParamSpec *pspec; type = - g_enum_register_static (g_strdup_printf ("GstFameEnc_%s", - current_type), (GEnumValue *) array->data); + g_enum_register_static (g_strdup_printf ("GstFameEnc_%s", + current_type), (GEnumValue *) array->data); pspec = - g_param_spec_enum (current_type, current_type, - g_strdup_printf ("The FAME \"%s\" object", current_type), type, - default_index, G_PARAM_READWRITE); + g_param_spec_enum (current_type, current_type, + g_strdup_printf ("The FAME \"%s\" object", current_type), type, + default_index, G_PARAM_READWRITE); g_param_spec_set_qdata (pspec, fame_object_name, (gpointer) current_type); g_object_class_install_property (G_OBJECT_CLASS (klass), current_prop++, - pspec); + pspec); } } g_object_class_install_property (gobject_class, ARG_BITRATE, g_param_spec_int ("bitrate", "Bitrate", "Target bitrate (0 = VBR)", - 0, 5000000, 0, G_PARAM_READWRITE)); + 0, 5000000, 0, G_PARAM_READWRITE)); g_object_class_install_property (gobject_class, ARG_QUALITY, g_param_spec_int ("quality", "Quality", - "Percentage of quality of compression (versus size)", 0, 100, 75, - G_PARAM_READWRITE)); + "Percentage of quality of compression (versus size)", 0, 100, 75, + G_PARAM_READWRITE)); g_object_class_install_property (gobject_class, ARG_PATTERN, g_param_spec_string ("pattern", "Pattern", - "Encoding pattern of I, P, and B frames", "IPPPPPPPPPPP", - G_PARAM_READWRITE)); + "Encoding pattern of I, P, and B frames", "IPPPPPPPPPPP", + G_PARAM_READWRITE)); g_object_class_install_property (gobject_class, ARG_FRAMES_PER_SEQUENCE, g_param_spec_int ("frames_per_sequence", "Frames Per Sequence", - "The number of frames in one sequence", 1, G_MAXINT, 12, - G_PARAM_READWRITE)); + "The number of frames in one sequence", 1, G_MAXINT, 12, + G_PARAM_READWRITE)); g_object_class_install_property (gobject_class, ARG_FAME_VERBOSE, g_param_spec_boolean ("fame_verbose", "Fame Verbose", - "Make FAME produce verbose output", FALSE, G_PARAM_READWRITE)); + "Make FAME produce verbose output", FALSE, G_PARAM_READWRITE)); g_object_class_install_property (gobject_class, ARG_BUFFER_SIZE, g_param_spec_int ("buffer_size", "Buffer Size", - "Set the decoding output buffer size", 0, 1024 * 1024, - FAMEENC_BUFFER_SIZE, G_PARAM_READWRITE)); + "Set the decoding output buffer size", 0, 1024 * 1024, + FAMEENC_BUFFER_SIZE, G_PARAM_READWRITE)); } static GstPadLinkReturn @@ -386,13 +388,13 @@ gst_fameenc_init (GstFameEnc * fameenc) fameenc->fp.bitrate = 0; fameenc->fp.quality = 75; fameenc->fp.frame_rate_num = 25; - fameenc->fp.frame_rate_den = 1; /* avoid floating point exceptions */ + fameenc->fp.frame_rate_den = 1; /* avoid floating point exceptions */ fameenc->fp.frames_per_sequence = 12; fameenc->pattern = g_strdup ("IPPPPPPPPPP"); /* allocate space for the buffer */ - fameenc->buffer_size = FAMEENC_BUFFER_SIZE; /* FIXME */ + fameenc->buffer_size = FAMEENC_BUFFER_SIZE; /* FIXME */ fameenc->buffer = (unsigned char *) g_malloc (fameenc->buffer_size); fameenc->next_time = 0; @@ -454,12 +456,12 @@ gst_fameenc_chain (GstPad * pad, GstData * _data) /* FIXME: safeguard, remove me when a better way is found */ if (length > FAMEENC_BUFFER_SIZE) g_warning - ("FAMEENC_BUFFER_SIZE is defined too low, encoded slice has size %d !\n", - length); + ("FAMEENC_BUFFER_SIZE is defined too low, encoded slice has size %d !\n", + length); if (!fameenc->time_interval) { fameenc->time_interval = - GST_SECOND * fameenc->fp.frame_rate_den / fameenc->fp.frame_rate_num; + GST_SECOND * fameenc->fp.frame_rate_den / fameenc->fp.frame_rate_num; } fameenc->next_time += fameenc->time_interval; @@ -471,7 +473,7 @@ gst_fameenc_chain (GstPad * pad, GstData * _data) GST_BUFFER_TIMESTAMP (outbuf) = GST_BUFFER_TIMESTAMP (buf); GST_DEBUG ("gst_fameenc_chain: pushing buffer of size %d", - GST_BUFFER_SIZE (outbuf)); + GST_BUFFER_SIZE (outbuf)); gst_pad_push (fameenc->srcpad, GST_DATA (outbuf)); } @@ -492,7 +494,7 @@ gst_fameenc_set_property (GObject * object, guint prop_id, if (fameenc->initialized) { GST_DEBUG - ("error: fameenc encoder already initialized, cannot set properties !"); + ("error: fameenc encoder already initialized, cannot set properties !"); return; } @@ -518,17 +520,17 @@ gst_fameenc_set_property (GObject * object, guint prop_id, break; default: if (prop_id >= ARG_FAME_PROPS_START) { - gchar *name; - gint index = g_value_get_enum (value); - GEnumValue *values; + gchar *name; + gint index = g_value_get_enum (value); + GEnumValue *values; - values = G_ENUM_CLASS (g_type_class_ref (pspec->value_type))->values; - name = (gchar *) g_param_spec_get_qdata (pspec, fame_object_name); + values = G_ENUM_CLASS (g_type_class_ref (pspec->value_type))->values; + name = (gchar *) g_param_spec_get_qdata (pspec, fame_object_name); - fame_register (fameenc->fc, name, fame_get_object (fameenc->fc, - values[index].value_name)); + fame_register (fameenc->fc, name, fame_get_object (fameenc->fc, + values[index].value_name)); } else - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; } } @@ -563,23 +565,23 @@ gst_fameenc_get_property (GObject * object, guint prop_id, break; default: if (prop_id >= ARG_FAME_PROPS_START) { - gchar *name; - gint index = 0; - GEnumValue *values; - fame_object_t *f_object; - - values = G_ENUM_CLASS (g_type_class_ref (pspec->value_type))->values; - name = (gchar *) g_param_spec_get_qdata (pspec, fame_object_name); - - f_object = fame_get_object (fameenc->fc, name); - - while (values[index].value_name) { - if (!strcmp (values[index].value_nick, f_object->name)) { - g_value_set_enum (value, index); - return; - } - index++; - } + gchar *name; + gint index = 0; + GEnumValue *values; + fame_object_t *f_object; + + values = G_ENUM_CLASS (g_type_class_ref (pspec->value_type))->values; + name = (gchar *) g_param_spec_get_qdata (pspec, fame_object_name); + + f_object = fame_get_object (fameenc->fc, name); + + while (values[index].value_name) { + if (!strcmp (values[index].value_nick, f_object->name)) { + g_value_set_enum (value, index); + return; + } + index++; + } } G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; diff --git a/ext/mpeg2enc/gstmpeg2enc.cc b/ext/mpeg2enc/gstmpeg2enc.cc index 1f6e582a..ee64d420 100644 --- a/ext/mpeg2enc/gstmpeg2enc.cc +++ b/ext/mpeg2enc/gstmpeg2enc.cc @@ -33,7 +33,8 @@ static void add_fps (GstCaps * caps) { GstStructure *structure = gst_caps_get_structure (caps, 0); - GValue list = { 0 }, fps = { + GValue list = { 0 }, fps = + { 0}; gdouble fpss[] = { 24.0 / 1.001, 24.0, 25.0, 30.0 / 1.001, 30.0, 50.0, @@ -61,10 +62,10 @@ sink_templ (void) GstCaps *caps; caps = gst_caps_new_simple ("video/x-raw-yuv", - "format", GST_TYPE_FOURCC, - GST_MAKE_FOURCC ('I', '4', '2', '0'), - "width", GST_TYPE_INT_RANGE, 16, 4096, - "height", GST_TYPE_INT_RANGE, 16, 4096, NULL); + "format", GST_TYPE_FOURCC, + GST_MAKE_FOURCC ('I', '4', '2', '0'), + "width", GST_TYPE_INT_RANGE, 16, 4096, + "height", GST_TYPE_INT_RANGE, 16, 4096, NULL); add_fps (caps); templ = gst_pad_template_new ("sink", GST_PAD_SINK, GST_PAD_ALWAYS, caps); @@ -82,10 +83,10 @@ src_templ (void) GstCaps *caps; caps = gst_caps_new_simple ("video/mpeg", - "systemstream", G_TYPE_BOOLEAN, FALSE, - "mpegversion", GST_TYPE_INT_RANGE, 1, 2, - "width", GST_TYPE_INT_RANGE, 16, 4096, - "height", GST_TYPE_INT_RANGE, 16, 4096, NULL); + "systemstream", G_TYPE_BOOLEAN, FALSE, + "mpegversion", GST_TYPE_INT_RANGE, 1, 2, + "width", GST_TYPE_INT_RANGE, 16, 4096, + "height", GST_TYPE_INT_RANGE, 16, 4096, NULL); add_fps (caps); templ = gst_pad_template_new ("src", GST_PAD_SRC, GST_PAD_ALWAYS, caps); @@ -132,8 +133,8 @@ gst_mpeg2enc_get_type (void) }; gst_mpeg2enc_type = - g_type_register_static (GST_TYPE_ELEMENT, - "GstMpeg2enc", &gst_mpeg2enc_info, (GTypeFlags) 0); + g_type_register_static (GST_TYPE_ELEMENT, + "GstMpeg2enc", &gst_mpeg2enc_info, (GTypeFlags) 0); } return gst_mpeg2enc_type; @@ -147,7 +148,7 @@ gst_mpeg2enc_base_init (GstMpeg2encClass * klass) "Codec/Video/Encoder", "High-quality MPEG-1/2 video encoder", "Andrew Stevens \n" - "Ronald Bultje " + "Ronald Bultje " }; GstElementClass *element_class = GST_ELEMENT_CLASS (klass); @@ -199,13 +200,13 @@ gst_mpeg2enc_init (GstMpeg2enc * enc) enc->sinkpad = gst_pad_new_from_template (gst_element_class_get_pad_template (klass, - "sink"), "sink"); + "sink"), "sink"); gst_pad_set_link_function (enc->sinkpad, gst_mpeg2enc_sink_link); gst_element_add_pad (element, enc->sinkpad); enc->srcpad = gst_pad_new_from_template (gst_element_class_get_pad_template (klass, - "src"), "src"); + "src"), "src"); gst_pad_use_explicit_caps (enc->srcpad); gst_element_add_pad (element, enc->srcpad); @@ -232,13 +233,13 @@ gst_mpeg2enc_loop (GstElement * element) if (!(caps = GST_PAD_CAPS (enc->sinkpad))) { GST_ELEMENT_ERROR (element, CORE, NEGOTIATION, (NULL), - ("format wasn't negotiated before loop function")); + ("format wasn't negotiated before loop function")); return; } /* create new encoder with these settings */ enc->encoder = new GstMpeg2Encoder (enc->options, enc->sinkpad, - caps, enc->srcpad); + caps, enc->srcpad); /* and set caps on other side */ othercaps = enc->encoder->getFormat (); diff --git a/ext/mpeg2enc/gstmpeg2encoptions.cc b/ext/mpeg2enc/gstmpeg2encoptions.cc index 8b6e7765..0d48ed29 100644 --- a/ext/mpeg2enc/gstmpeg2encoptions.cc +++ b/ext/mpeg2enc/gstmpeg2encoptions.cc @@ -96,7 +96,7 @@ gst_mpeg2enc_format_get_type (void) }; mpeg2enc_format_type = - g_enum_register_static ("GstMpeg2encFormat", mpeg2enc_formats); + g_enum_register_static ("GstMpeg2encFormat", mpeg2enc_formats); } return mpeg2enc_format_type; @@ -125,7 +125,7 @@ gst_mpeg2enc_framerate_get_type (void) }; mpeg2enc_framerate_type = - g_enum_register_static ("GstMpeg2encFramerate", mpeg2enc_framerates); + g_enum_register_static ("GstMpeg2encFramerate", mpeg2enc_framerates); } return mpeg2enc_framerate_type; @@ -150,7 +150,7 @@ gst_mpeg2enc_aspect_get_type (void) }; mpeg2enc_aspect_type = - g_enum_register_static ("GstMpeg2encAspect", mpeg2enc_aspects); + g_enum_register_static ("GstMpeg2encAspect", mpeg2enc_aspects); } return mpeg2enc_aspect_type; @@ -174,8 +174,8 @@ gst_mpeg2enc_interlace_mode_get_type (void) }; mpeg2enc_interlace_mode_type = - g_enum_register_static ("GstMpeg2encInterlaceMode", - mpeg2enc_interlace_modes); + g_enum_register_static ("GstMpeg2encInterlaceMode", + mpeg2enc_interlace_modes); } return mpeg2enc_interlace_mode_type; @@ -197,19 +197,19 @@ gst_mpeg2enc_quantisation_matrix_get_type (void) if (!mpeg2enc_quantisation_matrix_type) { static const GEnumValue mpeg2enc_quantisation_matrixes[] = { {GST_MPEG2ENC_QUANTISATION_MATRIX_DEFAULT, - "0", "Default"}, + "0", "Default"}, {GST_MPEG2ENC_QUANTISATION_MATRIX_HI_RES, - "1", "High resolution"}, + "1", "High resolution"}, {GST_MPEG2ENC_QUANTISATION_MATRIX_KVCD, - "2", "KVCD"}, + "2", "KVCD"}, {GST_MPEG2ENC_QUANTISATION_MATRIX_TMPGENC, - "3", "TMPGEnc"}, + "3", "TMPGEnc"}, {0, NULL, NULL}, }; mpeg2enc_quantisation_matrix_type = - g_enum_register_static ("GstMpeg2encQuantisationMatrix", - mpeg2enc_quantisation_matrixes); + g_enum_register_static ("GstMpeg2encQuantisationMatrix", + mpeg2enc_quantisation_matrixes); } return mpeg2enc_quantisation_matrix_type; @@ -233,7 +233,7 @@ gst_mpeg2enc_video_norm_get_type (void) }; mpeg2enc_video_norm_type = - g_enum_register_static ("GstMpeg2encVideoNorm", mpeg2enc_video_norms); + g_enum_register_static ("GstMpeg2encVideoNorm", mpeg2enc_video_norms); } return mpeg2enc_video_norm_type; @@ -256,8 +256,8 @@ gst_mpeg2enc_playback_field_order_get_type (void) }; mpeg2enc_playback_field_order_type = - g_enum_register_static ("GstMpeg2encPlaybackFieldOrders", - mpeg2enc_playback_field_orders); + g_enum_register_static ("GstMpeg2encPlaybackFieldOrders", + mpeg2enc_playback_field_orders); } return mpeg2enc_playback_field_order_type; @@ -288,160 +288,160 @@ GstMpeg2EncOptions::initProperties (GObjectClass * klass) /* encoding profile */ g_object_class_install_property (klass, ARG_FORMAT, g_param_spec_enum ("format", "Format", "Encoding profile format", - GST_TYPE_MPEG2ENC_FORMAT, 0, (GParamFlags) G_PARAM_READWRITE)); + GST_TYPE_MPEG2ENC_FORMAT, 0, (GParamFlags) G_PARAM_READWRITE)); /* input/output stream overrides */ g_object_class_install_property (klass, ARG_FRAMERATE, g_param_spec_enum ("framerate", "Framerate", "Output framerate", - GST_TYPE_MPEG2ENC_FRAMERATE, 0, (GParamFlags) G_PARAM_READWRITE)); + GST_TYPE_MPEG2ENC_FRAMERATE, 0, (GParamFlags) G_PARAM_READWRITE)); g_object_class_install_property (klass, ARG_ASPECT, g_param_spec_enum ("aspect", "Aspect", "Display aspect ratio", - GST_TYPE_MPEG2ENC_ASPECT, 0, (GParamFlags) G_PARAM_READWRITE)); + GST_TYPE_MPEG2ENC_ASPECT, 0, (GParamFlags) G_PARAM_READWRITE)); g_object_class_install_property (klass, ARG_INTERLACE_MODE, g_param_spec_enum ("interlace-mode", "Interlace mode", - "MPEG-2 motion estimation and encoding modes", - GST_TYPE_MPEG2ENC_INTERLACE_MODE, 0, - (GParamFlags) G_PARAM_READWRITE)); + "MPEG-2 motion estimation and encoding modes", + GST_TYPE_MPEG2ENC_INTERLACE_MODE, 0, + (GParamFlags) G_PARAM_READWRITE)); /* general encoding stream options */ g_object_class_install_property (klass, ARG_BITRATE, g_param_spec_int ("bitrate", "Bitrate", "Compressed video bitrate (kbps)", - 0, 10 * 1024, 1125, (GParamFlags) G_PARAM_READWRITE)); + 0, 10 * 1024, 1125, (GParamFlags) G_PARAM_READWRITE)); g_object_class_install_property (klass, ARG_NONVIDEO_BITRATE, g_param_spec_int ("non-video-bitrate", "Non-video bitrate", - "Assumed bitrate of non-video for sequence splitting (kbps)", - 0, 10 * 1024, 0, (GParamFlags) G_PARAM_READWRITE)); + "Assumed bitrate of non-video for sequence splitting (kbps)", + 0, 10 * 1024, 0, (GParamFlags) G_PARAM_READWRITE)); g_object_class_install_property (klass, ARG_QUANTISATION, g_param_spec_int ("quantisation", "Quantisation", - "Quantisation factor (0=default, 1=best, 31=worst)", - 0, 31, 0, (GParamFlags) G_PARAM_READWRITE)); + "Quantisation factor (0=default, 1=best, 31=worst)", + 0, 31, 0, (GParamFlags) G_PARAM_READWRITE)); /* stills options */ g_object_class_install_property (klass, ARG_VCD_STILL_SIZE, g_param_spec_int ("vcd-still-size", "VCD stills size", - "Size of VCD stills (in kB)", - 0, 512, 0, (GParamFlags) G_PARAM_READWRITE)); + "Size of VCD stills (in kB)", + 0, 512, 0, (GParamFlags) G_PARAM_READWRITE)); /* motion estimation options */ g_object_class_install_property (klass, ARG_MOTION_SEARCH_RADIUS, g_param_spec_int ("motion-search-radius", "Motion search radius", - "Motion compensation search radius", - 0, 32, 16, (GParamFlags) G_PARAM_READWRITE)); + "Motion compensation search radius", + 0, 32, 16, (GParamFlags) G_PARAM_READWRITE)); g_object_class_install_property (klass, ARG_REDUCTION_4_4, g_param_spec_int ("reduction-4x4", "4x4 reduction", - "Reduction factor for 4x4 subsampled candidate motion estimates" - " (1=max. quality, 4=max. speed)", - 1, 4, 2, (GParamFlags) G_PARAM_READWRITE)); + "Reduction factor for 4x4 subsampled candidate motion estimates" + " (1=max. quality, 4=max. speed)", + 1, 4, 2, (GParamFlags) G_PARAM_READWRITE)); g_object_class_install_property (klass, ARG_REDUCTION_2_2, g_param_spec_int ("reduction-2x2", "2x2 reduction", - "Reduction factor for 2x2 subsampled candidate motion estimates" - " (1=max. quality, 4=max. speed)", - 1, 4, 3, (GParamFlags) G_PARAM_READWRITE)); + "Reduction factor for 2x2 subsampled candidate motion estimates" + " (1=max. quality, 4=max. speed)", + 1, 4, 3, (GParamFlags) G_PARAM_READWRITE)); g_object_class_install_property (klass, ARG_UNIT_COEFF_ELIM, g_param_spec_int ("unit-coeff-elim", "Unit coefficience elimination", - "How agressively small-unit picture blocks should be skipped", - -40, 40, 0, (GParamFlags) G_PARAM_READWRITE)); + "How agressively small-unit picture blocks should be skipped", + -40, 40, 0, (GParamFlags) G_PARAM_READWRITE)); /* GOP options */ g_object_class_install_property (klass, ARG_MIN_GOP_SIZE, g_param_spec_int ("min-gop-size", "Min. GOP size", - "Minimal size per Group-of-Pictures (-1=default)", - -1, 250, 0, (GParamFlags) G_PARAM_READWRITE)); + "Minimal size per Group-of-Pictures (-1=default)", + -1, 250, 0, (GParamFlags) G_PARAM_READWRITE)); g_object_class_install_property (klass, ARG_MAX_GOP_SIZE, g_param_spec_int ("max-gop-size", "Max. GOP size", - "Maximal size per Group-of-Pictures (-1=default)", - -1, 250, 0, (GParamFlags) G_PARAM_READWRITE)); + "Maximal size per Group-of-Pictures (-1=default)", + -1, 250, 0, (GParamFlags) G_PARAM_READWRITE)); g_object_class_install_property (klass, ARG_CLOSED_GOP, g_param_spec_boolean ("closed-gop", "Closed GOP", - "All Group-of-Pictures are closed (for multi-angle DVDs)", - FALSE, (GParamFlags) G_PARAM_READWRITE)); + "All Group-of-Pictures are closed (for multi-angle DVDs)", + FALSE, (GParamFlags) G_PARAM_READWRITE)); g_object_class_install_property (klass, ARG_FORCE_B_B_P, g_param_spec_boolean ("force-b-b-p", "Force B-B-P", - "Force two B frames between I/P frames when closing GOP boundaries", - FALSE, (GParamFlags) G_PARAM_READWRITE)); + "Force two B frames between I/P frames when closing GOP boundaries", + FALSE, (GParamFlags) G_PARAM_READWRITE)); g_object_class_install_property (klass, ARG_B_PER_REFFRAME, g_param_spec_int ("b-per-refframe", "B per ref. frame", - "Number of B frames between each I/P frame", - 0, 2, 2, (GParamFlags) G_PARAM_READWRITE)); + "Number of B frames between each I/P frame", + 0, 2, 2, (GParamFlags) G_PARAM_READWRITE)); /* quantisation options */ g_object_class_install_property (klass, ARG_QUANTISATION_REDUCTION, g_param_spec_float ("quantisation-reduction", "Quantisation reduction", - "Max. quantisation reduction for highly active blocks", - -4., 10., 0., (GParamFlags) G_PARAM_READWRITE)); + "Max. quantisation reduction for highly active blocks", + -4., 10., 0., (GParamFlags) G_PARAM_READWRITE)); g_object_class_install_property (klass, ARG_QUANT_REDUCTION_MAX_VAR, g_param_spec_float ("quant-reduction-max-var", - "Max. quant. reduction variance", - "Maximal luma variance below which quantisation boost is used", 0., - 2500., 0., (GParamFlags) G_PARAM_READWRITE)); + "Max. quant. reduction variance", + "Maximal luma variance below which quantisation boost is used", 0., + 2500., 0., (GParamFlags) G_PARAM_READWRITE)); g_object_class_install_property (klass, ARG_INTRA_DC_PRECISION, g_param_spec_int ("intra-dc-prec", "Intra. DC precision", - "Number of bits precision for DC (base colour) in MPEG-2 blocks", 8, - 11, 9, (GParamFlags) G_PARAM_READWRITE)); + "Number of bits precision for DC (base colour) in MPEG-2 blocks", 8, + 11, 9, (GParamFlags) G_PARAM_READWRITE)); g_object_class_install_property (klass, ARG_REDUCE_HF, g_param_spec_float ("reduce-hf", "Reduce HF", - "How much to reduce high-frequency resolution (by increasing quantisation)", - 0., 2., 0., (GParamFlags) G_PARAM_READWRITE)); + "How much to reduce high-frequency resolution (by increasing quantisation)", + 0., 2., 0., (GParamFlags) G_PARAM_READWRITE)); g_object_class_install_property (klass, ARG_KEEP_HF, g_param_spec_boolean ("keep-hf", "Keep HF", - "Maximize high-frequency resolution (for high-quality sources)", - FALSE, (GParamFlags) G_PARAM_READWRITE)); + "Maximize high-frequency resolution (for high-quality sources)", + FALSE, (GParamFlags) G_PARAM_READWRITE)); g_object_class_install_property (klass, ARG_QUANTISATION_MATRIX, g_param_spec_enum ("quant-matrix", "Quant. matrix", - "Quantisation matrix to use for encoding", - GST_TYPE_MPEG2ENC_QUANTISATION_MATRIX, 0, - (GParamFlags) G_PARAM_READWRITE)); + "Quantisation matrix to use for encoding", + GST_TYPE_MPEG2ENC_QUANTISATION_MATRIX, 0, + (GParamFlags) G_PARAM_READWRITE)); /* general options */ g_object_class_install_property (klass, ARG_BUFSIZE, g_param_spec_int ("bufsize", "Decoder buf. size", - "Target decoders video buffer size (kB)", - 20, 4000, 46, (GParamFlags) G_PARAM_READWRITE)); + "Target decoders video buffer size (kB)", + 20, 4000, 46, (GParamFlags) G_PARAM_READWRITE)); /* header flag settings */ g_object_class_install_property (klass, ARG_VIDEO_NORM, g_param_spec_enum ("norm", "Norm", - "Tag output for specific video norm", - GST_TYPE_MPEG2ENC_VIDEO_NORM, 0, (GParamFlags) G_PARAM_READWRITE)); + "Tag output for specific video norm", + GST_TYPE_MPEG2ENC_VIDEO_NORM, 0, (GParamFlags) G_PARAM_READWRITE)); g_object_class_install_property (klass, ARG_SEQUENCE_LENGTH, g_param_spec_int ("sequence-length", "Sequence length", - "Place a sequence boundary after each MB (0=disable)", - 0, 10 * 1024, 0, (GParamFlags) G_PARAM_READWRITE)); + "Place a sequence boundary after each MB (0=disable)", + 0, 10 * 1024, 0, (GParamFlags) G_PARAM_READWRITE)); g_object_class_install_property (klass, ARG_3_2_PULLDOWN, g_param_spec_boolean ("pulldown-3-2", "3-2 pull down", - "Generate header flags for 3-2 pull down 24fps movies", - FALSE, (GParamFlags) G_PARAM_READWRITE)); + "Generate header flags for 3-2 pull down 24fps movies", + FALSE, (GParamFlags) G_PARAM_READWRITE)); g_object_class_install_property (klass, ARG_SEQUENCE_HEADER_EVERY_GOP, g_param_spec_boolean ("sequence-header-every-gop", - "Sequence hdr. every GOP", - "Include a sequence header in every GOP", - FALSE, (GParamFlags) G_PARAM_READWRITE)); + "Sequence hdr. every GOP", + "Include a sequence header in every GOP", + FALSE, (GParamFlags) G_PARAM_READWRITE)); g_object_class_install_property (klass, ARG_DUMMY_SVCD_SOF, g_param_spec_boolean ("dummy-svcd-sof", "Dummy SVCD SOF", - "Generate dummy SVCD scan-data (for vcdimager)", - TRUE, (GParamFlags) G_PARAM_READWRITE)); + "Generate dummy SVCD scan-data (for vcdimager)", + TRUE, (GParamFlags) G_PARAM_READWRITE)); g_object_class_install_property (klass, ARG_PLAYBACK_FIELD_ORDER, g_param_spec_enum ("playback-field-order", "Playback field order", - "Force specific playback field order", - GST_TYPE_MPEG2ENC_PLAYBACK_FIELD_ORDER, Y4M_UNKNOWN, - (GParamFlags) G_PARAM_READWRITE)); + "Force specific playback field order", + GST_TYPE_MPEG2ENC_PLAYBACK_FIELD_ORDER, Y4M_UNKNOWN, + (GParamFlags) G_PARAM_READWRITE)); g_object_class_install_property (klass, ARG_CORRECT_SVCD_HDS, g_param_spec_boolean ("correct-svcd-hds", "Correct SVCD hor. size", - "Force SVCD width to 480 instead of 540/720", - FALSE, (GParamFlags) G_PARAM_READWRITE)); + "Force SVCD width to 480 instead of 540/720", + FALSE, (GParamFlags) G_PARAM_READWRITE)); g_object_class_install_property (klass, ARG_ALTSCAN_MPEG2, g_param_spec_boolean ("altscan-mpeg2", "Alt. MPEG-2 scan", - "Alternate MPEG-2 block scanning. Disabling this might " - "make buggy players play SVCD streams", - TRUE, (GParamFlags) G_PARAM_READWRITE)); + "Alternate MPEG-2 block scanning. Disabling this might " + "make buggy players play SVCD streams", + TRUE, (GParamFlags) G_PARAM_READWRITE)); #if 0 "--dxr2-hack" #endif /* dangerous/experimental stuff */ g_object_class_install_property (klass, ARG_CONSTRAINTS, g_param_spec_boolean ("constraints", "Constraints", - "Use strict video resolution and bitrate checks", - TRUE, (GParamFlags) G_PARAM_READWRITE)); + "Use strict video resolution and bitrate checks", + TRUE, (GParamFlags) G_PARAM_READWRITE)); } /* @@ -520,18 +520,18 @@ GstMpeg2EncOptions::getProperty (guint prop_id, GValue * value) break; case ARG_QUANTISATION_MATRIX: switch (hf_quant) { - case 0: - g_value_set_enum (value, GST_MPEG2ENC_QUANTISATION_MATRIX_DEFAULT); - break; - case 2: - g_value_set_enum (value, GST_MPEG2ENC_QUANTISATION_MATRIX_HI_RES); - break; - case 3: - g_value_set_enum (value, GST_MPEG2ENC_QUANTISATION_MATRIX_KVCD); - break; - case 4: - g_value_set_enum (value, GST_MPEG2ENC_QUANTISATION_MATRIX_TMPGENC); - break; + case 0: + g_value_set_enum (value, GST_MPEG2ENC_QUANTISATION_MATRIX_DEFAULT); + break; + case 2: + g_value_set_enum (value, GST_MPEG2ENC_QUANTISATION_MATRIX_HI_RES); + break; + case 3: + g_value_set_enum (value, GST_MPEG2ENC_QUANTISATION_MATRIX_KVCD); + break; + case 4: + g_value_set_enum (value, GST_MPEG2ENC_QUANTISATION_MATRIX_TMPGENC); + break; } break; case ARG_BUFSIZE: @@ -636,26 +636,26 @@ GstMpeg2EncOptions::setProperty (guint prop_id, const GValue * value) case ARG_REDUCE_HF: hf_q_boost = g_value_get_float (value); if (hf_quant == 0 && hf_q_boost != 0.) - hf_quant = 1; + hf_quant = 1; break; case ARG_KEEP_HF: hf_quant = g_value_get_boolean (value) ? 2 : 0; break; case ARG_QUANTISATION_MATRIX: switch (g_value_get_enum (value)) { - case GST_MPEG2ENC_QUANTISATION_MATRIX_DEFAULT: - hf_quant = 0; - hf_q_boost = 0; - break; - case GST_MPEG2ENC_QUANTISATION_MATRIX_HI_RES: - hf_quant = 2; - break; - case GST_MPEG2ENC_QUANTISATION_MATRIX_KVCD: - hf_quant = 3; - break; - case GST_MPEG2ENC_QUANTISATION_MATRIX_TMPGENC: - hf_quant = 4; - break; + case GST_MPEG2ENC_QUANTISATION_MATRIX_DEFAULT: + hf_quant = 0; + hf_q_boost = 0; + break; + case GST_MPEG2ENC_QUANTISATION_MATRIX_HI_RES: + hf_quant = 2; + break; + case GST_MPEG2ENC_QUANTISATION_MATRIX_KVCD: + hf_quant = 3; + break; + case GST_MPEG2ENC_QUANTISATION_MATRIX_TMPGENC: + hf_quant = 4; + break; } break; case ARG_BUFSIZE: diff --git a/ext/mpeg2enc/gstmpeg2encpicturereader.cc b/ext/mpeg2enc/gstmpeg2encpicturereader.cc index be8789ee..9ed8afc0 100644 --- a/ext/mpeg2enc/gstmpeg2encpicturereader.cc +++ b/ext/mpeg2enc/gstmpeg2encpicturereader.cc @@ -85,7 +85,9 @@ bool GstMpeg2EncPictureReader::LoadFrame () GstData * data; GstBuffer * - buf = NULL; + buf = + NULL; + gint i, x, @@ -93,10 +95,15 @@ bool GstMpeg2EncPictureReader::LoadFrame () n; guint8 * frame; + GstFormat - fmt = GST_FORMAT_DEFAULT; + fmt = + GST_FORMAT_DEFAULT; gint64 - pos = 0, tot = 0; + pos = + 0, + tot = + 0; gst_pad_query (GST_PAD_PEER (pad), GST_QUERY_POSITION, &fmt, &pos); gst_pad_query (GST_PAD_PEER (pad), GST_QUERY_TOTAL, &fmt, &tot); @@ -106,16 +113,16 @@ bool GstMpeg2EncPictureReader::LoadFrame () gst_pad_set_element_private (pad, NULL); } else if (!(data = gst_pad_pull (pad))) { GST_ELEMENT_ERROR (gst_pad_get_parent (pad), RESOURCE, READ, - (NULL), (NULL)); + (NULL), (NULL)); return true; } if (GST_IS_EVENT (data)) { if (GST_EVENT_TYPE (data) == GST_EVENT_EOS) { - gst_event_unref (GST_EVENT (data)); - return true; + gst_event_unref (GST_EVENT (data)); + return true; } else { - gst_pad_event_default (pad, GST_EVENT (data)); + gst_pad_event_default (pad, GST_EVENT (data)); } } else { buf = GST_BUFFER (data); diff --git a/ext/mplex/gstmplex.cc b/ext/mplex/gstmplex.cc index 8f2c9385..9ec4a931 100644 --- a/ext/mplex/gstmplex.cc +++ b/ext/mplex/gstmplex.cc @@ -39,7 +39,7 @@ GST_STATIC_PAD_TEMPLATE ("video_%d", GST_PAD_SINK, GST_PAD_REQUEST, GST_STATIC_CAPS ("video/mpeg, " - "mpegversion = (int) [ 1, 2 ], " "systemstream = (boolean) false") + "mpegversion = (int) [ 1, 2 ], " "systemstream = (boolean) false") ); static GstStaticPadTemplate audio_sink_templ = @@ -47,16 +47,16 @@ static GstStaticPadTemplate audio_sink_templ = GST_PAD_SINK, GST_PAD_REQUEST, GST_STATIC_CAPS ("audio/mpeg, " - "mpegversion = (int) 1, " - "layer = (int) [ 1, 2 ]; " - "audio/x-ac3; " - "audio/x-dts; " - "audio/x-raw-int, " - "endianness = (int) BYTE_ORDER, " - "signed = (boolean) TRUE, " - "width = (int) { 16, 20, 24 }, " - "depth = (int) { 16, 20, 24 }, " - "rate = (int) { 48000, 96000 }, " "channels = (int) [ 1, 6 ]") + "mpegversion = (int) 1, " + "layer = (int) [ 1, 2 ]; " + "audio/x-ac3; " + "audio/x-dts; " + "audio/x-raw-int, " + "endianness = (int) BYTE_ORDER, " + "signed = (boolean) TRUE, " + "width = (int) { 16, 20, 24 }, " + "depth = (int) { 16, 20, 24 }, " + "rate = (int) { 48000, 96000 }, " "channels = (int) [ 1, 6 ]") ); /* FIXME: subtitles */ @@ -99,8 +99,8 @@ gst_mplex_get_type (void) }; gst_mplex_type = - g_type_register_static (GST_TYPE_ELEMENT, - "GstMplex", &gst_mplex_info, (GTypeFlags) 0); + g_type_register_static (GST_TYPE_ELEMENT, + "GstMplex", &gst_mplex_info, (GTypeFlags) 0); } return gst_mplex_type; @@ -114,7 +114,7 @@ gst_mplex_base_init (GstMplexClass * klass) "Codec/Muxer", "High-quality MPEG/DVD/SVCD/VCD video/audio multiplexer", "Andrew Stevens \n" - "Ronald Bultje " + "Ronald Bultje " }; GstElementClass *element_class = GST_ELEMENT_CLASS (klass); @@ -191,7 +191,7 @@ gst_mplex_loop (GstElement * element) const GList *item; for (item = gst_element_get_pad_list (element); - item != NULL; item = item->next) { + item != NULL; item = item->next) { StreamKind type; GstMplexIBitStream *inputstream; JobStream *jobstream; @@ -202,16 +202,16 @@ gst_mplex_loop (GstElement * element) /* skip our source pad */ if (GST_PAD_DIRECTION (pad) == GST_PAD_SRC) - continue; + continue; /* create inputstream, assure we've got caps */ inputstream = new GstMplexIBitStream (pad); /* skip unnegotiated pads */ if (!(caps = GST_PAD_CAPS (pad))) { - delete inputstream; + delete inputstream; - continue; + continue; } /* get format */ @@ -219,41 +219,41 @@ gst_mplex_loop (GstElement * element) mime = gst_structure_get_name (structure); if (!strcmp (mime, "video/mpeg")) { - VideoParams *params; + VideoParams *params; - type = MPEG_VIDEO; + type = MPEG_VIDEO; - params = VideoParams::Default (mplex->job->mux_format); - mplex->job->video_param.push_back (params); - mplex->job->video_tracks++; + params = VideoParams::Default (mplex->job->mux_format); + mplex->job->video_param.push_back (params); + mplex->job->video_tracks++; } else if (!strcmp (mime, "audio/mpeg")) { - type = MPEG_AUDIO; - mplex->job->audio_tracks++; + type = MPEG_AUDIO; + mplex->job->audio_tracks++; } else if (!strcmp (mime, "audio/x-ac3")) { - type = AC3_AUDIO; - mplex->job->audio_tracks++; + type = AC3_AUDIO; + mplex->job->audio_tracks++; } else if (!strcmp (mime, "audio/x-dts")) { - type = DTS_AUDIO; - mplex->job->audio_tracks++; + type = DTS_AUDIO; + mplex->job->audio_tracks++; } else if (!strcmp (mime, "audio/x-raw-int")) { - LpcmParams *params; - gint bits, chans, rate; + LpcmParams *params; + gint bits, chans, rate; - type = LPCM_AUDIO; + type = LPCM_AUDIO; - /* set LPCM params */ - gst_structure_get_int (structure, "depth", &bits); - gst_structure_get_int (structure, "rate", &rate); - gst_structure_get_int (structure, "channels", &chans); - params = LpcmParams::Checked (rate, chans, bits); + /* set LPCM params */ + gst_structure_get_int (structure, "depth", &bits); + gst_structure_get_int (structure, "rate", &rate); + gst_structure_get_int (structure, "channels", &chans); + params = LpcmParams::Checked (rate, chans, bits); - mplex->job->lpcm_param.push_back (params); - mplex->job->audio_tracks++; - mplex->job->lpcm_tracks++; + mplex->job->lpcm_param.push_back (params); + mplex->job->audio_tracks++; + mplex->job->lpcm_tracks++; } else { - delete inputstream; + delete inputstream; - continue; + continue; } jobstream = new JobStream (inputstream, type); @@ -262,7 +262,7 @@ gst_mplex_loop (GstElement * element) if (!mplex->job->video_tracks && !mplex->job->audio_tracks) { GST_ELEMENT_ERROR (element, CORE, NEGOTIATION, (NULL), - ("no input video or audio tracks set up before loop function")); + ("no input video or audio tracks set up before loop function")); return; } diff --git a/ext/mplex/gstmplexibitstream.cc b/ext/mplex/gstmplexibitstream.cc index 612866f5..d749fe2a 100644 --- a/ext/mplex/gstmplexibitstream.cc +++ b/ext/mplex/gstmplexibitstream.cc @@ -53,7 +53,7 @@ IBitStream () if (!ReadIntoBuffer () && buffered == 0) { GST_ELEMENT_ERROR (gst_pad_get_parent (_pad), RESOURCE, READ, (NULL), - ("Failed to read from input pad %s", gst_pad_get_name (pad))); + ("Failed to read from input pad %s", gst_pad_get_name (pad))); } } @@ -70,6 +70,7 @@ size_t GstMplexIBitStream::ReadStreamBytes (uint8_t * buf, size_t size) { guint8 * data; + guint read; @@ -78,18 +79,19 @@ size_t GstMplexIBitStream::ReadStreamBytes (uint8_t * buf, size_t size) if ((read = gst_bytestream_peek_bytes (bs, &data, size)) != size) { GstEvent * - event; + event; + guint - pending; + pending; gst_bytestream_get_status (bs, &pending, &event); if (event) { switch (GST_EVENT_TYPE (event)) { - case GST_EVENT_EOS: - eos = TRUE; - break; - default: - break; + case GST_EVENT_EOS: + eos = TRUE; + break; + default: + break; } gst_event_unref (event); } diff --git a/ext/mplex/gstmplexjob.cc b/ext/mplex/gstmplexjob.cc index 8ff23bda..f13aa36a 100644 --- a/ext/mplex/gstmplexjob.cc +++ b/ext/mplex/gstmplexjob.cc @@ -68,7 +68,7 @@ gst_mplex_format_get_type (void) }; mplex_format_type = - g_enum_register_static ("GstMplexFormat", mplex_formats); + g_enum_register_static ("GstMplexFormat", mplex_formats); } return mplex_format_type; @@ -94,52 +94,53 @@ GstMplexJob::initProperties (GObjectClass * klass) /* encoding profile */ g_object_class_install_property (klass, ARG_FORMAT, g_param_spec_enum ("format", "Format", "Encoding profile format", - GST_TYPE_MPLEX_FORMAT, 0, (GParamFlags) G_PARAM_READWRITE)); + GST_TYPE_MPLEX_FORMAT, 0, (GParamFlags) G_PARAM_READWRITE)); /* total stream datarate. Normally, this shouldn't be needed, but * some DVD/VCD/SVCD players really need strict values to handle * the created files correctly. */ g_object_class_install_property (klass, ARG_MUX_BITRATE, g_param_spec_int ("mux-bitrate", "Mux. bitrate", - "Bitrate of output stream in kbps (0 = autodetect)", - 0, 15 * 1024, 0, (GParamFlags) G_PARAM_READWRITE)); + "Bitrate of output stream in kbps (0 = autodetect)", + 0, 15 * 1024, 0, (GParamFlags) G_PARAM_READWRITE)); #if 0 { - "video-buffer", 1, 0, 'b'}, + "video-buffer", 1, 0, 'b'} + , #endif /* some boolean stuff for headers */ g_object_class_install_property (klass, ARG_VBR, g_param_spec_boolean ("vbr", "VBR", - "Whether the input video stream is variable bitrate", - FALSE, (GParamFlags) G_PARAM_READWRITE)); + "Whether the input video stream is variable bitrate", + FALSE, (GParamFlags) G_PARAM_READWRITE)); g_object_class_install_property (klass, ARG_SYSTEM_HEADERS, g_param_spec_boolean ("system-headers", "System headers", - "Create system header in every pack for generic formats", - FALSE, (GParamFlags) G_PARAM_READWRITE)); + "Create system header in every pack for generic formats", + FALSE, (GParamFlags) G_PARAM_READWRITE)); g_object_class_install_property (klass, ARG_SPLIT_SEQUENCE, g_param_spec_boolean ("split-sequence", "Split sequence", - "Simply split a sequence across files " - "(rather than building run-out/run-in)", - FALSE, (GParamFlags) G_PARAM_READWRITE)); + "Simply split a sequence across files " + "(rather than building run-out/run-in)", + FALSE, (GParamFlags) G_PARAM_READWRITE)); /* size of a segment (followed by EOS) */ g_object_class_install_property (klass, ARG_SEGMENT_SIZE, g_param_spec_int ("max-segment-size", "Max. segment size", - "Max. size per segment/file in MB (0 = unlimited)", - 0, 10 * 1024, 0, (GParamFlags) G_PARAM_READWRITE)); + "Max. size per segment/file in MB (0 = unlimited)", + 0, 10 * 1024, 0, (GParamFlags) G_PARAM_READWRITE)); /* packets per pack (generic formats) */ g_object_class_install_property (klass, ARG_PACKETS_PER_PACK, g_param_spec_int ("packets-per-pack", "Packets per pack", - "Number of packets per pack for generic formats", - 1, 100, 1, (GParamFlags) G_PARAM_READWRITE)); + "Number of packets per pack for generic formats", + 1, 100, 1, (GParamFlags) G_PARAM_READWRITE)); /* size of one sector */ g_object_class_install_property (klass, ARG_SECTOR_SIZE, g_param_spec_int ("sector-size", "Sector size", - "Specify sector size in bytes for generic formats", - 256, 16384, 2048, (GParamFlags) G_PARAM_READWRITE)); + "Specify sector size in bytes for generic formats", + 256, 16384, 2048, (GParamFlags) G_PARAM_READWRITE)); } /* diff --git a/ext/musicbrainz/gsttrm.c b/ext/musicbrainz/gsttrm.c index 484be50f..cd5920ee 100644 --- a/ext/musicbrainz/gsttrm.c +++ b/ext/musicbrainz/gsttrm.c @@ -46,11 +46,11 @@ GstStaticPadTemplate src_template = GST_STATIC_PAD_TEMPLATE ("src", GST_PAD_SRC, GST_PAD_ALWAYS, GST_STATIC_CAPS ("audio/x-raw-int, " - "endianness = (int) BYTE_ORDER, " - "signed = (bool) TRUE, " - "width = (int) { 8, 16 }, " - "depth = (int) { 8, 16 }, " - "rate = (int) [ 8000, 96000 ], " "channels = (int) [ 1, 2 ]") + "endianness = (int) BYTE_ORDER, " + "signed = (bool) TRUE, " + "width = (int) { 8, 16 }, " + "depth = (int) { 8, 16 }, " + "rate = (int) [ 8000, 96000 ], " "channels = (int) [ 1, 2 ]") ); @@ -58,11 +58,11 @@ GstStaticPadTemplate sink_template = GST_STATIC_PAD_TEMPLATE ("sink", GST_PAD_SINK, GST_PAD_ALWAYS, GST_STATIC_CAPS ("audio/x-raw-int, " - "endianness = (int) BYTE_ORDER, " - "signed = (bool) TRUE, " - "width = (int) { 8, 16 }, " - "depth = (int) { 8, 16 }, " - "rate = (int) [ 8000, 96000 ], " "channels = (int) [ 1, 2 ]") + "endianness = (int) BYTE_ORDER, " + "signed = (bool) TRUE, " + "width = (int) { 8, 16 }, " + "depth = (int) { 8, 16 }, " + "rate = (int) [ 8000, 96000 ], " "channels = (int) [ 1, 2 ]") ); @@ -102,8 +102,9 @@ gst_musicbrainz_get_type (void) 0, (GInstanceInitFunc) gst_musicbrainz_init, }; + musicbrainz_type = g_type_register_static (GST_TYPE_ELEMENT, - "GstMusicBrainz", &musicbrainz_info, 0); + "GstMusicBrainz", &musicbrainz_info, 0); } return musicbrainz_type; } @@ -143,10 +144,10 @@ gst_musicbrainz_class_init (GstMusicBrainzClass * klass) g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_SIGNATURE, g_param_spec_string ("signature", "signature", "signature", - NULL, G_PARAM_READABLE)); + NULL, G_PARAM_READABLE)); g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_ASCII_SIGNATURE, g_param_spec_string ("ascii_signature", "ascii_signature", - "ascii_signature", NULL, G_PARAM_READABLE)); + "ascii_signature", NULL, G_PARAM_READABLE)); gobject_class->set_property = gst_musicbrainz_set_property; gobject_class->get_property = gst_musicbrainz_get_property; @@ -154,7 +155,7 @@ gst_musicbrainz_class_init (GstMusicBrainzClass * klass) gst_musicbrainz_signals[SIGNAL_SIGNATURE_AVAILABLE] = g_signal_new ("signature-available", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (GstMusicBrainzClass, - signature_available), NULL, NULL, g_cclosure_marshal_VOID__VOID, + signature_available), NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0); gstelement_class->change_state = gst_musicbrainz_change_state; @@ -251,7 +252,7 @@ gst_musicbrainz_chain (GstPad * pad, GstData * data) if (musicbrainz->linked && !musicbrainz->data_available) if (gst_pad_query (gst_pad_get_peer (pad), GST_QUERY_TOTAL, &format, - &nanos)) { + &nanos)) { musicbrainz->total_time = nanos / GST_SECOND; trm_SetSongLength (musicbrainz->trm, musicbrainz->total_time); musicbrainz->data_available = TRUE; @@ -261,16 +262,16 @@ gst_musicbrainz_chain (GstPad * pad, GstData * data) if (!musicbrainz->signature_available && trm_GenerateSignature (musicbrainz->trm, GST_BUFFER_DATA (buf), - GST_BUFFER_SIZE (buf))) { + GST_BUFFER_SIZE (buf))) { GST_DEBUG ("Signature"); trm_FinalizeSignature (musicbrainz->trm, musicbrainz->signature, NULL); trm_ConvertSigToASCII (musicbrainz->trm, musicbrainz->signature, - musicbrainz->ascii_signature); + musicbrainz->ascii_signature); g_print ("Signature : %s\n", musicbrainz->ascii_signature); musicbrainz->signature_available = TRUE; g_signal_emit (G_OBJECT (musicbrainz), - gst_musicbrainz_signals[SIGNAL_SIGNATURE_AVAILABLE], 0); + gst_musicbrainz_signals[SIGNAL_SIGNATURE_AVAILABLE], 0); GST_DEBUG ("Signature : %s", musicbrainz->ascii_signature); diff --git a/ext/nas/nassink.c b/ext/nas/nassink.c index 6fd0d86c..7c3a10ac 100644 --- a/ext/nas/nassink.c +++ b/ext/nas/nassink.c @@ -51,17 +51,17 @@ static GstStaticPadTemplate sink_factory = GST_STATIC_PAD_TEMPLATE ("sink", GST_PAD_SINK, GST_PAD_ALWAYS, GST_STATIC_CAPS ("audio/x-raw-int, " - "endianess = (int) BYTE_ORDER, " - "signed = (boolean) TRUE, " - "width = (int) 16, " - "depth = (int) 16, " - "rate = (int) [ 1000, 96000 ], " - "channels = (int) [ 1, 2 ]; " - "audio/x-raw-int, " - "signed = (boolean) FALSE, " - "width = (int) 8, " - "depth = (int) 8, " - "rate = (int) [ 1000, 96000 ], " "channels = (int) [ 1, 2 ]") + "endianess = (int) BYTE_ORDER, " + "signed = (boolean) TRUE, " + "width = (int) 16, " + "depth = (int) 16, " + "rate = (int) [ 1000, 96000 ], " + "channels = (int) [ 1, 2 ]; " + "audio/x-raw-int, " + "signed = (boolean) FALSE, " + "width = (int) 8, " + "depth = (int) 8, " + "rate = (int) [ 1000, 96000 ], " "channels = (int) [ 1, 2 ]") ); static void gst_nassink_base_init (gpointer g_class); @@ -111,9 +111,10 @@ gst_nassink_get_type (void) 0, (GInstanceInitFunc) gst_nassink_init, }; + nassink_type = - g_type_register_static (GST_TYPE_ELEMENT, "GstNassink", &nassink_info, - 0); + g_type_register_static (GST_TYPE_ELEMENT, "GstNassink", &nassink_info, + 0); } return nassink_type; @@ -127,7 +128,7 @@ gst_nassink_base_init (gpointer g_class) "Sink/Audio", "Plays audio to a Network Audio Server", "Laurent Vivier , " - "Arwed v. Merkatz " + "Arwed v. Merkatz " }; GstElementClass *element_class = GST_ELEMENT_CLASS (g_class); @@ -152,8 +153,8 @@ gst_nassink_class_init (GstNassinkClass * klass) gobject_class->set_property = gst_nassink_set_property; gobject_class->get_property = gst_nassink_get_property; - g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_MUTE, g_param_spec_boolean ("mute", "mute", "mute", TRUE, G_PARAM_READWRITE)); /* CHECKME */ - g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_HOST, g_param_spec_string ("host", "host", "host", NULL, G_PARAM_READWRITE)); /* CHECKME */ + g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_MUTE, g_param_spec_boolean ("mute", "mute", "mute", TRUE, G_PARAM_READWRITE)); /* CHECKME */ + g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_HOST, g_param_spec_string ("host", "host", "host", NULL, G_PARAM_READWRITE)); /* CHECKME */ gstelement_class->change_state = gst_nassink_change_state; } @@ -203,7 +204,7 @@ gst_nassink_getcaps (GstPad * pad) GstStructure *structure = gst_caps_get_structure (templatecaps, i); gst_structure_set (structure, "rate", GST_TYPE_INT_RANGE, - AuServerMinSampleRate (server), AuServerMaxSampleRate (server), NULL); + AuServerMinSampleRate (server), AuServerMaxSampleRate (server), NULL); } caps = gst_caps_intersect (templatecaps, gst_pad_get_pad_template_caps (pad)); gst_caps_free (templatecaps); @@ -291,28 +292,28 @@ gst_nassink_chain (GstPad * pad, GstData * _data) remaining = GST_BUFFER_SIZE (buf); while ((nassink->flow != AuNone) && (remaining > 0)) { - /* number of bytes we can copy to buffer */ + /* number of bytes we can copy to buffer */ - available = remaining > nassink->size - nassink->pos ? - nassink->size - nassink->pos : remaining; + available = remaining > nassink->size - nassink->pos ? + nassink->size - nassink->pos : remaining; - /* fill the buffer */ + /* fill the buffer */ - memcpy (nassink->buf + nassink->pos, GST_BUFFER_DATA (buf) + pos, - available); + memcpy (nassink->buf + nassink->pos, GST_BUFFER_DATA (buf) + pos, + available); - nassink->pos += available; - pos += available; + nassink->pos += available; + pos += available; - remaining -= available; + remaining -= available; - /* if we have more bytes, need to flush the buffer */ + /* if we have more bytes, need to flush the buffer */ - if (remaining > 0) { - while ((nassink->flow != AuNone) && (nassink->pos == nassink->size)) { - NAS_flush (nassink); - } - } + if (remaining > 0) { + while ((nassink->flow != AuNone) && (nassink->pos == nassink->size)) { + NAS_flush (nassink); + } + } } /* give some time to event handler */ @@ -340,11 +341,11 @@ gst_nassink_set_property (GObject * object, guint prop_id, const GValue * value, break; case ARG_HOST: if (nassink->host != NULL) - g_free (nassink->host); + g_free (nassink->host); if (g_value_get_string (value) == NULL) - nassink->host = NULL; + nassink->host = NULL; else - nassink->host = g_strdup (g_value_get_string (value)); + nassink->host = g_strdup (g_value_get_string (value)); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); @@ -379,7 +380,7 @@ static gboolean plugin_init (GstPlugin * plugin) { if (!gst_element_register (plugin, "nassink", GST_RANK_NONE, - GST_TYPE_NASSINK)) { + GST_TYPE_NASSINK)) { return FALSE; } @@ -460,17 +461,17 @@ gst_nassink_change_state (GstElement * element) switch (GST_STATE_PENDING (element)) { case GST_STATE_NULL: if (GST_FLAG_IS_SET (element, GST_NASSINK_OPEN)) - gst_nassink_close_audio (nassink); + gst_nassink_close_audio (nassink); break; case GST_STATE_READY: if (!GST_FLAG_IS_SET (element, GST_NASSINK_OPEN)) - gst_nassink_open_audio (nassink); + gst_nassink_open_audio (nassink); break; case GST_STATE_PAUSED: while (nassink->pos && nassink->buf) - NAS_flush (nassink); + NAS_flush (nassink); break; case GST_STATE_PLAYING: @@ -498,7 +499,7 @@ NAS_sendData (GstNassink * sink, AuUint32 numBytes) if (numBytes < (sink->pos)) { AuWriteElement (sink->audio, sink->flow, 0, - numBytes, sink->buf, AuFalse, NULL); + numBytes, sink->buf, AuFalse, NULL); memmove (sink->buf, sink->buf + numBytes, sink->pos - numBytes); @@ -506,7 +507,7 @@ NAS_sendData (GstNassink * sink, AuUint32 numBytes) } else { AuWriteElement (sink->audio, sink->flow, 0, - sink->pos, sink->buf, (numBytes > sink->pos), NULL); + sink->pos, sink->buf, (numBytes > sink->pos), NULL); sink->pos = 0; } } @@ -525,49 +526,49 @@ NAS_EventHandler (AuServer * aud, AuEvent * ev, AuEventHandlerRec * handler) switch (notify->kind) { - case AuElementNotifyKindLowWater: - NAS_sendData (sink, notify->num_bytes); - break; + case AuElementNotifyKindLowWater: + NAS_sendData (sink, notify->num_bytes); + break; - case AuElementNotifyKindState: + case AuElementNotifyKindState: - switch (notify->cur_state) { + switch (notify->cur_state) { - case AuStateStop: + case AuStateStop: - if (sink->flow != AuNone) { - if (notify->reason == AuReasonEOF) - AuStopFlow (handler->aud, sink->flow, NULL); - AuReleaseScratchFlow (handler->aud, sink->flow, NULL); - sink->flow = AuNone; - } - AuUnregisterEventHandler (handler->aud, handler); - break; + if (sink->flow != AuNone) { + if (notify->reason == AuReasonEOF) + AuStopFlow (handler->aud, sink->flow, NULL); + AuReleaseScratchFlow (handler->aud, sink->flow, NULL); + sink->flow = AuNone; + } + AuUnregisterEventHandler (handler->aud, handler); + break; - case AuStatePause: + case AuStatePause: - switch (notify->reason) { - case AuReasonUnderrun: - case AuReasonOverrun: - case AuReasonEOF: - case AuReasonWatermark: + switch (notify->reason) { + case AuReasonUnderrun: + case AuReasonOverrun: + case AuReasonEOF: + case AuReasonWatermark: - NAS_sendData (sink, notify->num_bytes); + NAS_sendData (sink, notify->num_bytes); - break; + break; - case AuReasonHardware: + case AuReasonHardware: - if (AuSoundRestartHardwarePauses) - AuStartFlow (handler->aud, sink->flow, NULL); - else - AuStopFlow (handler->aud, sink->flow, NULL); + if (AuSoundRestartHardwarePauses) + AuStartFlow (handler->aud, sink->flow, NULL); + else + AuStopFlow (handler->aud, sink->flow, NULL); - break; - } - break; - } - break; + break; + } + break; + } + break; } break; } @@ -582,8 +583,8 @@ NAS_getDevice (AuServer * aud, int numTracks) for (i = 0; i < AuServerNumDevices (aud); i++) { if ((AuDeviceKind (AuServerDevice (aud, i)) - == AuComponentKindPhysicalOutput) && - (AuDeviceNumTracks (AuServerDevice (aud, i)) == numTracks)) { + == AuComponentKindPhysicalOutput) && + (AuDeviceNumTracks (AuServerDevice (aud, i)) == numTracks)) { return AuDeviceIdentifier (AuServerDevice (aud, i)); @@ -631,18 +632,18 @@ NAS_createFlow (GstNassink * sink, unsigned char format, unsigned short rate, AuElement *oldelems; oldelems = - AuGetElements (sink->audio, sink->flow, &clocked, &num_elements, - &status); + AuGetElements (sink->audio, sink->flow, &clocked, &num_elements, + &status); if (num_elements > 0) { GST_CAT_DEBUG (NAS, "GetElements status: %i", status); if (oldelems) - AuFreeElements (sink->audio, num_elements, oldelems); + AuFreeElements (sink->audio, num_elements, oldelems); gst_nassink_close_audio (sink); gst_nassink_open_audio (sink); sink->flow = AuGetScratchFlow (sink->audio, NULL); if (sink->flow == 0) { - GST_CAT_DEBUG (NAS, "couldn't get flow"); - return -1; + GST_CAT_DEBUG (NAS, "couldn't get flow"); + return -1; } } } @@ -655,18 +656,18 @@ NAS_createFlow (GstNassink * sink, unsigned char format, unsigned short rate, AuElement *oldelems; oldelems = - AuGetElements (sink->audio, sink->flow, &clocked, &num_elements, - &status); + AuGetElements (sink->audio, sink->flow, &clocked, &num_elements, + &status); if (num_elements > 0) { GST_CAT_DEBUG (NAS, "GetElements status: %i", status); if (oldelems) - AuFreeElements (sink->audio, num_elements, oldelems); + AuFreeElements (sink->audio, num_elements, oldelems); gst_nassink_close_audio (sink); gst_nassink_open_audio (sink); sink->flow = AuGetScratchFlow (sink->audio, NULL); if (sink->flow == 0) { - GST_CAT_DEBUG (NAS, "couldn't get flow"); - return -1; + GST_CAT_DEBUG (NAS, "couldn't get flow"); + return -1; } } } @@ -674,38 +675,38 @@ NAS_createFlow (GstNassink * sink, unsigned char format, unsigned short rate, buf_samples = rate * NAS_SOUND_PORT_DURATION; - AuMakeElementImportClient (&elements[0], /* element */ - rate, /* rate */ - format, /* format */ - numTracks, /* number of tracks */ - AuTrue, /* discart */ - buf_samples, /* max samples */ + AuMakeElementImportClient (&elements[0], /* element */ + rate, /* rate */ + format, /* format */ + numTracks, /* number of tracks */ + AuTrue, /* discart */ + buf_samples, /* max samples */ (AuUint32) (buf_samples / 100 * AuSoundPortLowWaterMark), /* low water mark */ - 0, /* num actions */ + 0, /* num actions */ NULL); - AuMakeElementExportDevice (&elements[1], /* element */ - 0, /* input */ - sink->device, /* device */ - rate, /* rate */ - AuUnlimitedSamples, /* num samples */ - 0, /* num actions */ - NULL); /* actions */ - - AuSetElements (sink->audio, /* server */ - sink->flow, /* flow ID */ - AuTrue, /* clocked */ - 2, /* num elements */ - elements, /* elements */ + AuMakeElementExportDevice (&elements[1], /* element */ + 0, /* input */ + sink->device, /* device */ + rate, /* rate */ + AuUnlimitedSamples, /* num samples */ + 0, /* num actions */ + NULL); /* actions */ + + AuSetElements (sink->audio, /* server */ + sink->flow, /* flow ID */ + AuTrue, /* clocked */ + 2, /* num elements */ + elements, /* elements */ NULL); - AuRegisterEventHandler (sink->audio, /* server */ - AuEventHandlerIDMask, /* value mask */ - 0, /* type */ - sink->flow, /* flow ID */ - NAS_EventHandler, /* callback */ - (AuPointer) sink); /* data */ + AuRegisterEventHandler (sink->audio, /* server */ + AuEventHandlerIDMask, /* value mask */ + 0, /* type */ + sink->flow, /* flow ID */ + NAS_EventHandler, /* callback */ + (AuPointer) sink); /* data */ sink->size = buf_samples * numTracks * AuSizeofFormat (format); diff --git a/ext/sdl/sdlvideosink.c b/ext/sdl/sdlvideosink.c index f5d46a4f..3bbd0750 100644 --- a/ext/sdl/sdlvideosink.c +++ b/ext/sdl/sdlvideosink.c @@ -108,11 +108,11 @@ gst_sdlvideosink_get_type (void) }; sdlvideosink_type = g_type_register_static (GST_TYPE_VIDEOSINK, - "GstSDLVideoSink", &sdlvideosink_info, 0); + "GstSDLVideoSink", &sdlvideosink_info, 0); g_type_add_interface_static (sdlvideosink_type, - GST_TYPE_IMPLEMENTS_INTERFACE, &iface_info); + GST_TYPE_IMPLEMENTS_INTERFACE, &iface_info); g_type_add_interface_static (sdlvideosink_type, GST_TYPE_X_OVERLAY, - &xoverlay_info); + &xoverlay_info); } return sdlvideosink_type; @@ -135,11 +135,11 @@ gst_sdlvideosink_base_init (gpointer g_class) capslist = gst_caps_new_empty (); for (i = 0; i < 5; i++) { gst_caps_append_structure (capslist, - gst_structure_new ("video/x-raw-yuv", - "format", GST_TYPE_FOURCC, format[i], - "width", GST_TYPE_INT_RANGE, 1, G_MAXINT, - "height", GST_TYPE_INT_RANGE, 1, G_MAXINT, - "framerate", GST_TYPE_DOUBLE_RANGE, 0.0, G_MAXDOUBLE, NULL)); + gst_structure_new ("video/x-raw-yuv", + "format", GST_TYPE_FOURCC, format[i], + "width", GST_TYPE_INT_RANGE, 1, G_MAXINT, + "height", GST_TYPE_INT_RANGE, 1, G_MAXINT, + "framerate", GST_TYPE_DOUBLE_RANGE, 0.0, G_MAXDOUBLE, NULL)); } sink_template = gst_pad_template_new ("sink", @@ -207,7 +207,7 @@ gst_sdlvideosink_buffer_new (GstBufferPool * pool, if (sdlvideosink->format == SDL_YV12_OVERLAY || sdlvideosink->format == SDL_IYUV_OVERLAY) { GST_BUFFER_SIZE (buffer) = - sdlvideosink->width * sdlvideosink->height * 3 / 2; + sdlvideosink->width * sdlvideosink->height * 3 / 2; } else { GST_BUFFER_SIZE (buffer) = sdlvideosink->width * sdlvideosink->height * 2; } @@ -271,9 +271,9 @@ gst_sdlvideosink_init (GstSDLVideoSink * sdlvideosink) sdlvideosink->lock = g_mutex_new (); #if 0 - sdlvideosink->bufferpool = gst_buffer_pool_new (NULL, /* free */ - NULL, /* copy */ - (GstBufferPoolBufferNewFunction) gst_sdlvideosink_buffer_new, NULL, /* buffer copy, the default is fine */ + sdlvideosink->bufferpool = gst_buffer_pool_new (NULL, /* free */ + NULL, /* copy */ + (GstBufferPoolBufferNewFunction) gst_sdlvideosink_buffer_new, NULL, /* buffer copy, the default is fine */ (GstBufferPoolBufferFreeFunction) gst_sdlvideosink_buffer_free, sdlvideosink); #endif @@ -354,7 +354,7 @@ gst_sdlvideosink_lock (GstSDLVideoSink * sdlvideosink) /* assure that we've got a screen */ if (!sdlvideosink->screen || !sdlvideosink->overlay) { GST_ELEMENT_ERROR (sdlvideosink, LIBRARY, TOO_LAZY, (NULL), - ("Tried to lock screen without being set-up")); + ("Tried to lock screen without being set-up")); return FALSE; } @@ -362,13 +362,13 @@ gst_sdlvideosink_lock (GstSDLVideoSink * sdlvideosink) if (SDL_MUSTLOCK (sdlvideosink->screen)) { if (SDL_LockSurface (sdlvideosink->screen) < 0) { GST_ELEMENT_ERROR (sdlvideosink, LIBRARY, TOO_LAZY, (NULL), - ("SDL: couldn't lock the SDL video window: %s", SDL_GetError ())); + ("SDL: couldn't lock the SDL video window: %s", SDL_GetError ())); return FALSE; } } if (SDL_LockYUVOverlay (sdlvideosink->overlay) < 0) { GST_ELEMENT_ERROR (sdlvideosink, LIBRARY, TOO_LAZY, (NULL), - ("SDL: couldn\'t lock the SDL YUV overlay: %s", SDL_GetError ())); + ("SDL: couldn\'t lock the SDL YUV overlay: %s", SDL_GetError ())); return FALSE; } @@ -413,7 +413,7 @@ gst_sdlvideosink_initsdl (GstSDLVideoSink * sdlvideosink) /* Initialize the SDL library */ if (SDL_Init (SDL_INIT_VIDEO | SDL_INIT_NOPARACHUTE) < 0) { GST_ELEMENT_ERROR (sdlvideosink, LIBRARY, INIT, (NULL), - ("Couldn't initialize SDL: %s", SDL_GetError ())); + ("Couldn't initialize SDL: %s", SDL_GetError ())); return FALSE; } @@ -449,8 +449,8 @@ gst_sdlvideosink_create (GstSDLVideoSink * sdlvideosink) GST_VIDEOSINK_HEIGHT (sdlvideosink), 0, SDL_HWSURFACE | SDL_RESIZABLE); if (sdlvideosink->screen == NULL) { GST_ELEMENT_ERROR (sdlvideosink, LIBRARY, TOO_LAZY, (NULL), - ("SDL: Couldn't set %dx%d: %s", GST_VIDEOSINK_WIDTH (sdlvideosink), - GST_VIDEOSINK_HEIGHT (sdlvideosink), SDL_GetError ())); + ("SDL: Couldn't set %dx%d: %s", GST_VIDEOSINK_WIDTH (sdlvideosink), + GST_VIDEOSINK_HEIGHT (sdlvideosink), SDL_GetError ())); return FALSE; } @@ -459,16 +459,16 @@ gst_sdlvideosink_create (GstSDLVideoSink * sdlvideosink) sdlvideosink->height, sdlvideosink->format, sdlvideosink->screen); if (sdlvideosink->overlay == NULL) { GST_ELEMENT_ERROR (sdlvideosink, LIBRARY, TOO_LAZY, (NULL), - ("SDL: Couldn't create SDL YUV overlay (%dx%d \'" GST_FOURCC_FORMAT - "\'): %s", sdlvideosink->width, sdlvideosink->height, - GST_FOURCC_ARGS (sdlvideosink->format), SDL_GetError ())); + ("SDL: Couldn't create SDL YUV overlay (%dx%d \'" GST_FOURCC_FORMAT + "\'): %s", sdlvideosink->width, sdlvideosink->height, + GST_FOURCC_ARGS (sdlvideosink->format), SDL_GetError ())); return FALSE; } else { GST_DEBUG ("Using a %dx%d %dbpp SDL screen with a %dx%d \'" - GST_FOURCC_FORMAT "\' YUV overlay", GST_VIDEOSINK_WIDTH (sdlvideosink), - GST_VIDEOSINK_HEIGHT (sdlvideosink), - sdlvideosink->screen->format->BitsPerPixel, sdlvideosink->width, - sdlvideosink->height, GST_FOURCC_ARGS (sdlvideosink->format)); + GST_FOURCC_FORMAT "\' YUV overlay", GST_VIDEOSINK_WIDTH (sdlvideosink), + GST_VIDEOSINK_HEIGHT (sdlvideosink), + sdlvideosink->screen->format->BitsPerPixel, sdlvideosink->width, + sdlvideosink->height, GST_FOURCC_ARGS (sdlvideosink->format)); } sdlvideosink->rect.x = 0; @@ -505,7 +505,7 @@ gst_sdlvideosink_fixate (GstPad * pad, const GstCaps * caps) return newcaps; } if (gst_caps_structure_fixate_field_nearest_double (structure, "framerate", - 30.0)) { + 30.0)) { return newcaps; } @@ -555,13 +555,13 @@ gst_sdlvideosink_chain (GstPad * pad, GstData * _data) switch (GST_EVENT_TYPE (event)) { case GST_EVENT_DISCONTINUOUS: - offset = GST_EVENT_DISCONT_OFFSET (event, 0).value; - /*gst_clock_handle_discont (sdlvideosink->clock, - (guint64) GST_EVENT_DISCONT_OFFSET (event, 0).value); */ - break; + offset = GST_EVENT_DISCONT_OFFSET (event, 0).value; + /*gst_clock_handle_discont (sdlvideosink->clock, + (guint64) GST_EVENT_DISCONT_OFFSET (event, 0).value); */ + break; default: - gst_pad_event_default (pad, event); - return; + gst_pad_event_default (pad, event); + return; } gst_event_unref (event); return; @@ -578,19 +578,19 @@ gst_sdlvideosink_chain (GstPad * pad, GstData * _data) /* buf->yuv - FIXME: bufferpool! */ if (sdlvideosink->format == SDL_IYUV_OVERLAY || - sdlvideosink->format == SDL_YV12_OVERLAY) { + sdlvideosink->format == SDL_YV12_OVERLAY) { memcpy (sdlvideosink->overlay->pixels[0], GST_BUFFER_DATA (buf), - sdlvideosink->width * sdlvideosink->height); + sdlvideosink->width * sdlvideosink->height); memcpy (sdlvideosink->overlay->pixels[1], - GST_BUFFER_DATA (buf) + sdlvideosink->width * sdlvideosink->height, - sdlvideosink->width * sdlvideosink->height / 4); + GST_BUFFER_DATA (buf) + sdlvideosink->width * sdlvideosink->height, + sdlvideosink->width * sdlvideosink->height / 4); memcpy (sdlvideosink->overlay->pixels[2], - GST_BUFFER_DATA (buf) + - sdlvideosink->width * sdlvideosink->height * 5 / 4, - sdlvideosink->width * sdlvideosink->height / 4); + GST_BUFFER_DATA (buf) + + sdlvideosink->width * sdlvideosink->height * 5 / 4, + sdlvideosink->width * sdlvideosink->height / 4); } else { memcpy (sdlvideosink->overlay->pixels[0], GST_BUFFER_DATA (buf), - sdlvideosink->width * sdlvideosink->height * 2); + sdlvideosink->width * sdlvideosink->height * 2); } gst_sdlvideosink_unlock (sdlvideosink); @@ -604,11 +604,11 @@ gst_sdlvideosink_chain (GstPad * pad, GstData * _data) while (SDL_PollEvent (&sdl_event)) { switch (sdl_event.type) { case SDL_VIDEORESIZE: - /* create a SDL window of the size requested by the user */ - GST_VIDEOSINK_WIDTH (sdlvideosink) = sdl_event.resize.w; - GST_VIDEOSINK_HEIGHT (sdlvideosink) = sdl_event.resize.h; - gst_sdlvideosink_create (sdlvideosink); - break; + /* create a SDL window of the size requested by the user */ + GST_VIDEOSINK_WIDTH (sdlvideosink) = sdl_event.resize.w; + GST_VIDEOSINK_HEIGHT (sdlvideosink) = sdl_event.resize.h; + gst_sdlvideosink_create (sdlvideosink); + break; } } } @@ -661,7 +661,7 @@ gst_sdlvideosink_change_state (GstElement * element) switch (GST_STATE_TRANSITION (element)) { case GST_STATE_NULL_TO_READY: if (!gst_sdlvideosink_initsdl (sdlvideosink)) - return GST_STATE_FAILURE; + return GST_STATE_FAILURE; GST_FLAG_SET (sdlvideosink, GST_SDLVIDEOSINK_OPEN); break; case GST_STATE_PAUSED_TO_READY: @@ -671,7 +671,7 @@ gst_sdlvideosink_change_state (GstElement * element) gst_sdlvideosink_deinitsdl (sdlvideosink); GST_FLAG_UNSET (sdlvideosink, GST_SDLVIDEOSINK_OPEN); break; - default: /* do nothing */ + default: /* do nothing */ break; } @@ -690,7 +690,7 @@ plugin_init (GstPlugin * plugin) return FALSE; if (!gst_element_register (plugin, "sdlvideosink", GST_RANK_NONE, - GST_TYPE_SDLVIDEOSINK)) + GST_TYPE_SDLVIDEOSINK)) return FALSE; return TRUE; diff --git a/ext/shout/gstshout.c b/ext/shout/gstshout.c index 3deb8cc6..5f546dee 100644 --- a/ext/shout/gstshout.c +++ b/ext/shout/gstshout.c @@ -50,19 +50,19 @@ enum enum { ARG_0, - ARG_IP, /* the ip of the server */ - ARG_PORT, /* the encoder port number on the server */ - ARG_PASSWORD, /* the encoder password on the server */ - ARG_PUBLIC, /* is this stream public? */ - ARG_NAME, /* Name of the stream */ - ARG_DESCRIPTION, /* Description of the stream */ - ARG_GENRE, /* Genre of the stream */ - ARG_MOUNT, /* mountpoint of stream (icecast only) */ - ARG_DUMPFILE, /* Dumpfile on the server for this stream (icecast only) */ - ARG_ICY, /* use icy headers for login? (for use with shoutcast) */ - ARG_AIM, /* AIM number (shoutcast only) */ - ARG_ICQ, /* ICQ number (shoutcast only) */ - ARG_IRC, /* IRC server (shoutcast only) */ + ARG_IP, /* the ip of the server */ + ARG_PORT, /* the encoder port number on the server */ + ARG_PASSWORD, /* the encoder password on the server */ + ARG_PUBLIC, /* is this stream public? */ + ARG_NAME, /* Name of the stream */ + ARG_DESCRIPTION, /* Description of the stream */ + ARG_GENRE, /* Genre of the stream */ + ARG_MOUNT, /* mountpoint of stream (icecast only) */ + ARG_DUMPFILE, /* Dumpfile on the server for this stream (icecast only) */ + ARG_ICY, /* use icy headers for login? (for use with shoutcast) */ + ARG_AIM, /* AIM number (shoutcast only) */ + ARG_ICQ, /* ICQ number (shoutcast only) */ + ARG_IRC, /* IRC server (shoutcast only) */ }; static GstStaticPadTemplate sink_template_factory = @@ -70,7 +70,7 @@ GST_STATIC_PAD_TEMPLATE ("sink", GST_PAD_SINK, GST_PAD_ALWAYS, GST_STATIC_CAPS ("audio/mpeg, " - "mpegversion = (int) 1, " "layer = (int) [ 1, 3 ]") + "mpegversion = (int) 1, " "layer = (int) [ 1, 3 ]") ); static void gst_icecastsend_class_init (GstIcecastSendClass * klass); @@ -104,9 +104,10 @@ gst_icecastsend_get_type (void) sizeof (GstIcecastSend), 0, (GInstanceInitFunc) gst_icecastsend_init, }; + icecastsend_type = - g_type_register_static (GST_TYPE_ELEMENT, "GstIcecastSend", - &icecastsend_info, 0); + g_type_register_static (GST_TYPE_ELEMENT, "GstIcecastSend", + &icecastsend_info, 0); } return icecastsend_type; } @@ -132,33 +133,33 @@ gst_icecastsend_class_init (GstIcecastSendClass * klass) parent_class = g_type_class_ref (GST_TYPE_ELEMENT); - g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_IP, g_param_spec_string ("ip", "ip", "ip", NULL, G_PARAM_READWRITE)); /* CHECKME */ - g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_PORT, g_param_spec_int ("port", "port", "port", G_MININT, G_MAXINT, 0, G_PARAM_READWRITE)); /* CHECKME */ + g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_IP, g_param_spec_string ("ip", "ip", "ip", NULL, G_PARAM_READWRITE)); /* CHECKME */ + g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_PORT, g_param_spec_int ("port", "port", "port", G_MININT, G_MAXINT, 0, G_PARAM_READWRITE)); /* CHECKME */ - g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_PASSWORD, g_param_spec_string ("password", "password", "password", NULL, G_PARAM_READWRITE)); /* CHECKME */ + g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_PASSWORD, g_param_spec_string ("password", "password", "password", NULL, G_PARAM_READWRITE)); /* CHECKME */ - g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_PUBLIC, g_param_spec_boolean ("public", "public", "public", TRUE, G_PARAM_READWRITE)); /* CHECKME */ + g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_PUBLIC, g_param_spec_boolean ("public", "public", "public", TRUE, G_PARAM_READWRITE)); /* CHECKME */ /* metadata */ - g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_NAME, g_param_spec_string ("name", "name", "name", NULL, G_PARAM_READWRITE)); /* CHECKME */ + g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_NAME, g_param_spec_string ("name", "name", "name", NULL, G_PARAM_READWRITE)); /* CHECKME */ - g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_DESCRIPTION, g_param_spec_string ("description", "description", "description", NULL, G_PARAM_READWRITE)); /* CHECKME */ + g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_DESCRIPTION, g_param_spec_string ("description", "description", "description", NULL, G_PARAM_READWRITE)); /* CHECKME */ - g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_GENRE, g_param_spec_string ("genre", "genre", "genre", NULL, G_PARAM_READWRITE)); /* CHECKME */ + g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_GENRE, g_param_spec_string ("genre", "genre", "genre", NULL, G_PARAM_READWRITE)); /* CHECKME */ /* icecast only */ - g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_MOUNT, g_param_spec_string ("mount", "mount", "mount", NULL, G_PARAM_READWRITE)); /* CHECKME */ + g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_MOUNT, g_param_spec_string ("mount", "mount", "mount", NULL, G_PARAM_READWRITE)); /* CHECKME */ - g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_DUMPFILE, g_param_spec_string ("dumpfile", "dumpfile", "dumpfile", NULL, G_PARAM_READWRITE)); /* CHECKME */ + g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_DUMPFILE, g_param_spec_string ("dumpfile", "dumpfile", "dumpfile", NULL, G_PARAM_READWRITE)); /* CHECKME */ /* shoutcast only */ - g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_ICY, g_param_spec_boolean ("icy", "icy", "icy", FALSE, G_PARAM_READWRITE)); /* CHECKME */ + g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_ICY, g_param_spec_boolean ("icy", "icy", "icy", FALSE, G_PARAM_READWRITE)); /* CHECKME */ - g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_AIM, g_param_spec_string ("aim", "aim", "aim", NULL, G_PARAM_READWRITE)); /* CHECKME */ + g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_AIM, g_param_spec_string ("aim", "aim", "aim", NULL, G_PARAM_READWRITE)); /* CHECKME */ - g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_ICQ, g_param_spec_string ("icq", "icq", "icq", NULL, G_PARAM_READWRITE)); /* CHECKME */ + g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_ICQ, g_param_spec_string ("icq", "icq", "icq", NULL, G_PARAM_READWRITE)); /* CHECKME */ - g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_IRC, g_param_spec_string ("irc", "irc", "irc", NULL, G_PARAM_READWRITE)); /* CHECKME */ + g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_IRC, g_param_spec_string ("irc", "irc", "irc", NULL, G_PARAM_READWRITE)); /* CHECKME */ gobject_class->set_property = gst_icecastsend_set_property; @@ -174,7 +175,7 @@ gst_icecastsend_init (GstIcecastSend * icecastsend) icecastsend->sinkpad = gst_pad_new_from_template (gst_element_class_get_pad_template (klass, - "sink"), "sink"); + "sink"), "sink"); gst_element_add_pad (GST_ELEMENT (icecastsend), icecastsend->sinkpad); gst_pad_set_chain_function (icecastsend->sinkpad, gst_icecastsend_chain); @@ -232,7 +233,7 @@ gst_icecastsend_set_property (GObject * object, guint prop_id, switch (prop_id) { case ARG_IP: if (icecastsend->ip) - g_free (icecastsend->ip); + g_free (icecastsend->ip); icecastsend->ip = g_strdup (g_value_get_string (value)); break; case ARG_PORT: @@ -240,64 +241,64 @@ gst_icecastsend_set_property (GObject * object, guint prop_id, break; case ARG_PASSWORD: if (icecastsend->password) - g_free (icecastsend->password); + g_free (icecastsend->password); icecastsend->password = g_strdup (g_value_get_string (value)); break; - case ARG_PUBLIC: /* is this stream public? */ + case ARG_PUBLIC: /* is this stream public? */ icecastsend->public = g_value_get_boolean (value); break; - case ARG_NAME: /* Name of the stream */ + case ARG_NAME: /* Name of the stream */ if (icecastsend->name) - g_free (icecastsend->name); + g_free (icecastsend->name); icecastsend->name = g_strdup (g_value_get_string (value)); break; - case ARG_DESCRIPTION: /* Description of the stream */ + case ARG_DESCRIPTION: /* Description of the stream */ if (icecastsend->description) - g_free (icecastsend->description); + g_free (icecastsend->description); icecastsend->description = g_strdup (g_value_get_string (value)); break; - case ARG_GENRE: /* Genre of the stream */ + case ARG_GENRE: /* Genre of the stream */ if (icecastsend->genre) - g_free (icecastsend->genre); + g_free (icecastsend->genre); icecastsend->genre = g_strdup (g_value_get_string (value)); break; - case ARG_MOUNT: /* mountpoint of stream (icecast only) */ + case ARG_MOUNT: /* mountpoint of stream (icecast only) */ if (icecastsend->mount) - g_free (icecastsend->mount); + g_free (icecastsend->mount); icecastsend->mount = g_strdup (g_value_get_string (value)); break; - case ARG_DUMPFILE: /* Dumpfile on the server for this stream (icecast only) */ + case ARG_DUMPFILE: /* Dumpfile on the server for this stream (icecast only) */ if (icecastsend->dumpfile) - g_free (icecastsend->dumpfile); + g_free (icecastsend->dumpfile); icecastsend->dumpfile = g_strdup (g_value_get_string (value)); break; - case ARG_ICY: /* use icy headers for login? (for use with shoutcast) */ + case ARG_ICY: /* use icy headers for login? (for use with shoutcast) */ icecastsend->icy = g_value_get_boolean (value); break; - case ARG_AIM: /* AIM number (shoutcast only) */ + case ARG_AIM: /* AIM number (shoutcast only) */ if (icecastsend->aim) - g_free (icecastsend->aim); + g_free (icecastsend->aim); icecastsend->aim = g_strdup (g_value_get_string (value)); break; - case ARG_ICQ: /* ICQ number (shoutcast only) */ + case ARG_ICQ: /* ICQ number (shoutcast only) */ if (icecastsend->icq) - g_free (icecastsend->icq); + g_free (icecastsend->icq); icecastsend->icq = g_strdup (g_value_get_string (value)); break; - case ARG_IRC: /* IRC server (shoutcast only) */ + case ARG_IRC: /* IRC server (shoutcast only) */ if (icecastsend->irc) - g_free (icecastsend->irc); + g_free (icecastsend->irc); icecastsend->irc = g_strdup (g_value_get_string (value)); break; @@ -326,43 +327,43 @@ gst_icecastsend_get_property (GObject * object, guint prop_id, GValue * value, case ARG_PASSWORD: g_value_set_string (value, icecastsend->password); break; - case ARG_PUBLIC: /* is this stream public? */ + case ARG_PUBLIC: /* is this stream public? */ g_value_set_boolean (value, icecastsend->public); break; - case ARG_NAME: /* Name of the stream */ + case ARG_NAME: /* Name of the stream */ g_value_set_string (value, icecastsend->name); break; - case ARG_DESCRIPTION: /* Description of the stream */ + case ARG_DESCRIPTION: /* Description of the stream */ g_value_set_string (value, icecastsend->description); break; - case ARG_GENRE: /* Genre of the stream */ + case ARG_GENRE: /* Genre of the stream */ g_value_set_string (value, icecastsend->genre); break; - case ARG_MOUNT: /* mountpoint of stream (icecast only) */ + case ARG_MOUNT: /* mountpoint of stream (icecast only) */ g_value_set_string (value, icecastsend->mount); break; - case ARG_DUMPFILE: /* Dumpfile on the server for this stream (icecast only) */ + case ARG_DUMPFILE: /* Dumpfile on the server for this stream (icecast only) */ g_value_set_string (value, icecastsend->dumpfile); break; - case ARG_ICY: /* use icy headers for login? (for use with shoutcast) */ + case ARG_ICY: /* use icy headers for login? (for use with shoutcast) */ g_value_set_boolean (value, icecastsend->icy); break; - case ARG_AIM: /* AIM number (shoutcast only) */ + case ARG_AIM: /* AIM number (shoutcast only) */ g_value_set_string (value, icecastsend->aim); break; - case ARG_ICQ: /* ICQ number (shoutcast only) */ + case ARG_ICQ: /* ICQ number (shoutcast only) */ g_value_set_string (value, icecastsend->icq); break; - case ARG_IRC: /* IRC server (shoutcast only) */ + case ARG_IRC: /* IRC server (shoutcast only) */ g_value_set_string (value, icecastsend->irc); break; @@ -407,12 +408,12 @@ gst_icecastsend_change_state (GstElement * element) icecastsend->conn.irc = icecastsend->irc; */ if (shout_connect (&icecastsend->conn)) { - g_print ("connected to server...\n"); + g_print ("connected to server...\n"); } else { - g_warning ("couldn't connect to server... (%i: %s)\n", - icecastsend->conn.error, SHOUT_ERRORS[icecastsend->conn.error]); - shout_disconnect (&icecastsend->conn); - return GST_STATE_FAILURE; + g_warning ("couldn't connect to server... (%i: %s)\n", + icecastsend->conn.error, SHOUT_ERRORS[icecastsend->conn.error]); + shout_disconnect (&icecastsend->conn); + return GST_STATE_FAILURE; } break; case GST_STATE_PAUSED_TO_READY: diff --git a/ext/smoothwave/gstsmoothwave.c b/ext/smoothwave/gstsmoothwave.c index 2abbdec2..9775e3d0 100644 --- a/ext/smoothwave/gstsmoothwave.c +++ b/ext/smoothwave/gstsmoothwave.c @@ -80,9 +80,10 @@ gst_smoothwave_get_type (void) 0, (GInstanceInitFunc) gst_smoothwave_init, }; + smoothwave_type = - g_type_register_static (GST_TYPE_ELEMENT, "GstSmoothWave", - &smoothwave_info, 0); + g_type_register_static (GST_TYPE_ELEMENT, "GstSmoothWave", + &smoothwave_info, 0); } return smoothwave_type; } @@ -106,9 +107,9 @@ gst_smoothwave_class_init (GstSmoothWaveClass * klass) parent_class = g_type_class_ref (GST_TYPE_ELEMENT); - g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_WIDTH, g_param_spec_int ("width", "width", "width", G_MININT, G_MAXINT, 0, G_PARAM_READWRITE)); /* CHECKME */ - g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_HEIGHT, g_param_spec_int ("height", "height", "height", G_MININT, G_MAXINT, 0, G_PARAM_READWRITE)); /* CHECKME */ - g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_WIDGET, g_param_spec_object ("widget", "widget", "widget", GTK_TYPE_WIDGET, G_PARAM_READABLE)); /* CHECKME! */ + g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_WIDTH, g_param_spec_int ("width", "width", "width", G_MININT, G_MAXINT, 0, G_PARAM_READWRITE)); /* CHECKME */ + g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_HEIGHT, g_param_spec_int ("height", "height", "height", G_MININT, G_MAXINT, 0, G_PARAM_READWRITE)); /* CHECKME */ + g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_WIDGET, g_param_spec_object ("widget", "widget", "widget", GTK_TYPE_WIDGET, G_PARAM_READABLE)); /* CHECKME! */ gobject_class->set_property = gst_smoothwave_set_property; gobject_class->get_property = gst_smoothwave_get_property; @@ -192,7 +193,7 @@ gst_smoothwave_chain (GstPad * pad, GstData * _data) for (i = 0; i < MAX (smoothwave->width, samplecount); i++) { gint16 y1 = (gint32) (samples[i * 2] * qheight) / 32768 + qheight; gint16 y2 = (gint32) (samples[(i * 2) + 1] * qheight) / 32768 + - (qheight * 3); + (qheight * 3); smoothwave->imagebuffer[y1 * smoothwave->width + i] = 0xff; smoothwave->imagebuffer[y2 * smoothwave->width + i] = 0xff; /* smoothwave->imagebuffer[i+(smoothwave->width*5)] = i; */ @@ -246,16 +247,16 @@ gst_smoothwave_set_property (GObject * object, guint prop_id, case ARG_WIDTH: smoothwave->width = g_value_get_int (value); gtk_drawing_area_size (GTK_DRAWING_AREA (smoothwave->image), - smoothwave->width, smoothwave->height); + smoothwave->width, smoothwave->height); gtk_widget_set_usize (GTK_WIDGET (smoothwave->image), - smoothwave->width, smoothwave->height); + smoothwave->width, smoothwave->height); break; case ARG_HEIGHT: smoothwave->height = g_value_get_int (value); gtk_drawing_area_size (GTK_DRAWING_AREA (smoothwave->image), - smoothwave->width, smoothwave->height); + smoothwave->width, smoothwave->height); gtk_widget_set_usize (GTK_WIDGET (smoothwave->image), - smoothwave->width, smoothwave->height); + smoothwave->width, smoothwave->height); break; default: break; @@ -297,7 +298,7 @@ static gboolean plugin_init (GstPlugin * plugin) { if (!gst_element_register (plugin, "smoothwave", GST_RANK_NONE, - GST_TYPE_SMOOTHWAVE)) + GST_TYPE_SMOOTHWAVE)) return FALSE; return TRUE; diff --git a/ext/snapshot/gstsnapshot.c b/ext/snapshot/gstsnapshot.c index 66c505bc..231cdce3 100644 --- a/ext/snapshot/gstsnapshot.c +++ b/ext/snapshot/gstsnapshot.c @@ -112,9 +112,10 @@ gst_snapshot_get_type (void) 0, (GInstanceInitFunc) gst_snapshot_init, }; + snapshot_type = - g_type_register_static (GST_TYPE_ELEMENT, "GstSnapshot", &snapshot_info, - 0); + g_type_register_static (GST_TYPE_ELEMENT, "GstSnapshot", &snapshot_info, + 0); } return snapshot_type; } @@ -145,10 +146,10 @@ gst_snapshot_class_init (GstSnapshotClass * klass) g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_FRAME, g_param_spec_long ("frame", "frame", "frame", - 0, G_MAXLONG, 0, G_PARAM_READWRITE)); + 0, G_MAXLONG, 0, G_PARAM_READWRITE)); g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_LOCATION, g_param_spec_string ("location", "location", "location", - 0, G_PARAM_READWRITE)); + 0, G_PARAM_READWRITE)); gst_snapshot_signals[SNAPSHOT_SIGNAL] = g_signal_new ("snapshot", G_TYPE_FROM_CLASS (klass), @@ -257,30 +258,30 @@ gst_snapshot_chain (GstPad * pad, GstData * _data) g_warning (" Can not open %s\n", snapshot->location); else { png_set_filter (snapshot->png_struct_ptr, 0, - PNG_FILTER_NONE | PNG_FILTER_VALUE_NONE); + PNG_FILTER_NONE | PNG_FILTER_VALUE_NONE); png_init_io (snapshot->png_struct_ptr, fp); png_set_compression_level (snapshot->png_struct_ptr, 9); png_set_IHDR (snapshot->png_struct_ptr, - snapshot->png_info_ptr, - snapshot->width, - snapshot->height, - snapshot->to_bpp / 3, - PNG_COLOR_TYPE_RGB, - PNG_INTERLACE_NONE, - PNG_COMPRESSION_TYPE_DEFAULT, PNG_FILTER_TYPE_DEFAULT); + snapshot->png_info_ptr, + snapshot->width, + snapshot->height, + snapshot->to_bpp / 3, + PNG_COLOR_TYPE_RGB, + PNG_INTERLACE_NONE, + PNG_COMPRESSION_TYPE_DEFAULT, PNG_FILTER_TYPE_DEFAULT); for (i = 0; i < snapshot->height; i++) - row_pointers[i] = data + (snapshot->width * i * snapshot->to_bpp / 8); + row_pointers[i] = data + (snapshot->width * i * snapshot->to_bpp / 8); png_write_info (snapshot->png_struct_ptr, snapshot->png_info_ptr); png_write_image (snapshot->png_struct_ptr, row_pointers); png_write_end (snapshot->png_struct_ptr, NULL); png_destroy_info_struct (snapshot->png_struct_ptr, - &snapshot->png_info_ptr); + &snapshot->png_info_ptr); png_destroy_write_struct (&snapshot->png_struct_ptr, (png_infopp) NULL); fclose (fp); g_signal_emit (G_OBJECT (snapshot), - gst_snapshot_signals[SNAPSHOT_SIGNAL], 0); + gst_snapshot_signals[SNAPSHOT_SIGNAL], 0); } @@ -337,7 +338,7 @@ static gboolean plugin_init (GstPlugin * plugin) { if (!gst_element_register (plugin, "snapshot", GST_RANK_NONE, - GST_TYPE_SNAPSHOT)) + GST_TYPE_SNAPSHOT)) return FALSE; return TRUE; diff --git a/ext/sndfile/gstsf.c b/ext/sndfile/gstsf.c index f9e88623..d48e2d4f 100644 --- a/ext/sndfile/gstsf.c +++ b/ext/sndfile/gstsf.c @@ -85,7 +85,7 @@ gst_sf_major_types_get_type (void) for (k = 0; k < count; k++) { format_info.format = k; sf_command (NULL, SFC_GET_FORMAT_MAJOR, &format_info, - sizeof (format_info)); + sizeof (format_info)); sf_major_types[k].value = format_info.format; sf_major_types[k].value_name = g_strdup (format_info.name); sf_major_types[k].value_nick = g_strdup (format_info.extension); @@ -94,19 +94,19 @@ gst_sf_major_types_get_type (void) just hope that sndfile gives us the list in alphabetical order, as it currently does. */ if (k > 0 - && strcmp (sf_major_types[k].value_nick, - sf_major_types[k - 1].value_nick) == 0) { - g_free (sf_major_types[k].value_nick); - sf_major_types[k].value_nick = - g_strconcat (sf_major_types[k - 1].value_nick, "-", - sf_major_types[k].value_name, NULL); - g_strcanon (sf_major_types[k].value_nick, - G_CSET_A_2_Z G_CSET_a_2_z G_CSET_DIGITS "-", '-'); + && strcmp (sf_major_types[k].value_nick, + sf_major_types[k - 1].value_nick) == 0) { + g_free (sf_major_types[k].value_nick); + sf_major_types[k].value_nick = + g_strconcat (sf_major_types[k - 1].value_nick, "-", + sf_major_types[k].value_name, NULL); + g_strcanon (sf_major_types[k].value_nick, + G_CSET_A_2_Z G_CSET_a_2_z G_CSET_DIGITS "-", '-'); } } sf_major_types_type = - g_enum_register_static ("GstSndfileMajorTypes", sf_major_types); + g_enum_register_static ("GstSndfileMajorTypes", sf_major_types); } return sf_major_types_type; } @@ -129,16 +129,16 @@ gst_sf_minor_types_get_type (void) for (k = 0; k < count; k++) { format_info.format = k; sf_command (NULL, SFC_GET_FORMAT_SUBTYPE, &format_info, - sizeof (format_info)); + sizeof (format_info)); sf_minor_types[k].value = format_info.format; sf_minor_types[k].value_name = g_strdup (format_info.name); sf_minor_types[k].value_nick = g_ascii_strdown (format_info.name, -1); g_strcanon (sf_minor_types[k].value_nick, G_CSET_a_2_z G_CSET_DIGITS "-", - '-'); + '-'); } sf_minor_types_type = - g_enum_register_static ("GstSndfileMinorTypes", sf_minor_types); + g_enum_register_static ("GstSndfileMinorTypes", sf_minor_types); } return sf_minor_types_type; } @@ -186,13 +186,14 @@ gst_sf_get_type (void) static const GTypeInfo sf_info = { sizeof (GstSFClass), NULL, NULL, - (GClassInitFunc) NULL, /* don't even initialize the class */ + (GClassInitFunc) NULL, /* don't even initialize the class */ NULL, NULL, sizeof (GstSF), 0, - (GInstanceInitFunc) NULL /* abstract base class */ + (GInstanceInitFunc) NULL /* abstract base class */ }; + sf_type = g_type_register_static (GST_TYPE_ELEMENT, "GstSF", &sf_info, 0); } return sf_type; @@ -215,8 +216,9 @@ gst_sfsrc_get_type (void) 0, (GInstanceInitFunc) gst_sf_init, }; + sfsrc_type = - g_type_register_static (GST_TYPE_SF, "GstSFSrc", &sfsrc_info, 0); + g_type_register_static (GST_TYPE_SF, "GstSFSrc", &sfsrc_info, 0); } return sfsrc_type; } @@ -238,8 +240,9 @@ gst_sfsink_get_type (void) 0, (GInstanceInitFunc) gst_sf_init, }; + sfsink_type = - g_type_register_static (GST_TYPE_SF, "GstSFSink", &sfsink_info, 0); + g_type_register_static (GST_TYPE_SF, "GstSFSink", &sfsink_info, 0); } return sfsink_type; } @@ -291,12 +294,12 @@ gst_sf_class_init (GstSFClass * klass) if (G_TYPE_FROM_CLASS (klass) == GST_TYPE_SFSRC) { pspec = g_param_spec_boolean ("loop", "Loop?", "Loop the output?", - FALSE, G_PARAM_READWRITE | G_PARAM_CONSTRUCT); + FALSE, G_PARAM_READWRITE | G_PARAM_CONSTRUCT); g_object_class_install_property (gobject_class, ARG_LOOP, pspec); pspec = - g_param_spec_boolean ("create-pads", "Create pads?", - "Create one pad for each channel in the sound file?", TRUE, - G_PARAM_READWRITE | G_PARAM_CONSTRUCT); + g_param_spec_boolean ("create-pads", "Create pads?", + "Create one pad for each channel in the sound file?", TRUE, + G_PARAM_READWRITE | G_PARAM_CONSTRUCT); g_object_class_install_property (gobject_class, ARG_CREATE_PADS, pspec); } @@ -338,17 +341,17 @@ gst_sf_set_property (GObject * object, guint prop_id, const GValue * value, switch (prop_id) { case ARG_LOCATION: if (GST_FLAG_IS_SET (object, GST_SF_OPEN)) - gst_sf_close_file (this); + gst_sf_close_file (this); if (this->filename) - g_free (this->filename); + g_free (this->filename); if (g_value_get_string (value)) - this->filename = g_strdup (g_value_get_string (value)); + this->filename = g_strdup (g_value_get_string (value)); else - this->filename = NULL; + this->filename = NULL; if (this->filename) - gst_sf_open_file (this); + gst_sf_open_file (this); break; case ARG_MAJOR_TYPE: @@ -366,10 +369,10 @@ gst_sf_set_property (GObject * object, guint prop_id, const GValue * value, case ARG_CREATE_PADS: this->create_pads = g_value_get_boolean (value); if (this->file && this->create_pads) { - int i; + int i; - for (i = g_list_length (this->channels); i < this->numchannels; i++) - gst_element_get_request_pad ((GstElement *) this, "src%d"); + for (i = g_list_length (this->channels); i < this->numchannels; i++) + gst_element_get_request_pad ((GstElement *) this, "src%d"); } break; @@ -450,13 +453,13 @@ gst_sf_change_state (GstElement * element) break; case GST_STATE_PLAYING_TO_PAUSED: gst_audio_clock_set_active (GST_AUDIO_CLOCK (this->provided_clock), - FALSE); + FALSE); break; case GST_STATE_PAUSED_TO_READY: break; case GST_STATE_READY_TO_NULL: if (GST_FLAG_IS_SET (this, GST_SF_OPEN)) - gst_sf_close_file (this); + gst_sf_close_file (this); break; } @@ -514,7 +517,7 @@ gst_sf_release_request_pad (GstElement * element, GstPad * pad) if (GST_STATE (element) == GST_STATE_PLAYING) { g_warning - ("You can't release a request pad if the element is PLAYING, sorry."); + ("You can't release a request pad if the element is PLAYING, sorry."); return; } @@ -557,9 +560,9 @@ gst_sf_link (GstPad * pad, const GstCaps * caps) if (this->buffer) g_free (this->buffer); this->buffer = - g_malloc (this->numchannels * this->buffer_frames * sizeof (float)); + g_malloc (this->numchannels * this->buffer_frames * sizeof (float)); memset (this->buffer, 0, - this->numchannels * this->buffer_frames * sizeof (float)); + this->numchannels * this->buffer_frames * sizeof (float)); } return GST_PAD_LINK_OK; } @@ -576,7 +579,7 @@ gst_sf_open_file (GstSF * this) if (!this->filename) { GST_ELEMENT_ERROR (this, RESOURCE, NOT_FOUND, - (_("No filename specified.")), (NULL)); + (_("No filename specified.")), (NULL)); return FALSE; } @@ -586,11 +589,11 @@ gst_sf_open_file (GstSF * this) } else { if (!this->rate) { INFO_OBJ (this, "Not opening %s yet because caps are not set", - this->filename); + this->filename); return FALSE; } else if (!this->numchannels) { INFO_OBJ (this, "Not opening %s yet because we have no input channels", - this->filename); + this->filename); return FALSE; } @@ -601,12 +604,12 @@ gst_sf_open_file (GstSF * this) info.format = this->format; INFO_OBJ (this, "Opening %s with rate %d, %d channels, format 0x%x", - this->filename, info.samplerate, info.channels, info.format); + this->filename, info.samplerate, info.channels, info.format); if (!sf_format_check (&info)) { GST_ELEMENT_ERROR (this, STREAM, ENCODE, (NULL), - ("Input parameters (rate:%d, channels:%d, format:0x%x) invalid", - info.samplerate, info.channels, info.format)); + ("Input parameters (rate:%d, channels:%d, format:0x%x) invalid", + info.samplerate, info.channels, info.format)); return FALSE; } } @@ -615,8 +618,8 @@ gst_sf_open_file (GstSF * this) if (!this->file) { GST_ELEMENT_ERROR (this, RESOURCE, OPEN_WRITE, - (_("Could not open file \"%s\" for writing."), this->filename), - ("soundfile error: %s", sf_strerror (NULL))); + (_("Could not open file \"%s\" for writing."), this->filename), + ("soundfile error: %s", sf_strerror (NULL))); return FALSE; } @@ -632,7 +635,7 @@ gst_sf_open_file (GstSF * this) int i; for (i = g_list_length (this->channels); i < this->numchannels; i++) - gst_element_get_request_pad ((GstElement *) this, "src%d"); + gst_element_get_request_pad ((GstElement *) this, "src%d"); } for (l = this->channels; l; l = l->next) @@ -656,8 +659,8 @@ gst_sf_close_file (GstSF * this) if ((err = sf_close (this->file))) GST_ELEMENT_ERROR (this, RESOURCE, CLOSE, - ("Could not close file file \"%s\".", this->filename), - ("soundfile error: %s", strerror (err))); + ("Could not close file file \"%s\".", this->filename), + ("soundfile error: %s", strerror (err))); else GST_FLAG_UNSET (this, GST_SF_OPEN); @@ -677,7 +680,7 @@ gst_sf_loop (GstElement * element) if (this->channels == NULL) { GST_ELEMENT_ERROR (element, CORE, PAD, (NULL), - ("You must connect at least one pad to sndfile elements.")); + ("You must connect at least one pad to sndfile elements.")); return; } @@ -694,7 +697,7 @@ gst_sf_loop (GstElement * element) if (!GST_FLAG_IS_SET (this, GST_SF_OPEN)) if (!gst_sf_open_file (this)) - return; /* we've already set gst_element_error */ + return; /* we've already set gst_element_error */ if (buffer_frames == 0) { /* we have to set the caps later */ @@ -702,9 +705,9 @@ gst_sf_loop (GstElement * element) } if (buf == NULL) { buf = this->buffer = - g_malloc (this->numchannels * this->buffer_frames * sizeof (float)); + g_malloc (this->numchannels * this->buffer_frames * sizeof (float)); memset (this->buffer, 0, - this->numchannels * this->buffer_frames * sizeof (float)); + this->numchannels * this->buffer_frames * sizeof (float)); } read = sf_readf_float (this->file, buf, buffer_frames); @@ -713,51 +716,51 @@ gst_sf_loop (GstElement * element) if (read) for (i = 0, l = this->channels; l; l = l->next, i++) { - channel = GST_SF_CHANNEL (l); - - /* don't push on disconnected pads -- useful for ::create-pads=TRUE */ - if (!GST_PAD_PEER (channel->pad)) - continue; - - if (!channel->caps_set) { - GstCaps *caps = - gst_caps_copy (GST_PAD_CAPS (GST_SF_CHANNEL (l)->pad)); - if (!caps) - caps = gst_caps_copy - (GST_PAD_TEMPLATE_CAPS (GST_PAD_PAD_TEMPLATE (GST_SF_CHANNEL - (l)->pad))); - gst_caps_set_simple (caps, "rate", G_TYPE_INT, this->rate, - "buffer-frames", G_TYPE_INT, this->buffer_frames, NULL); - if (!gst_pad_try_set_caps (GST_SF_CHANNEL (l)->pad, caps)) { - GST_ELEMENT_ERROR (this, CORE, NEGOTIATION, (NULL), - ("Opened file with sample rate %d, but could not set caps", - this->rate)); - gst_sf_close_file (this); - return; - } - channel->caps_set = TRUE; - } - - out = gst_buffer_new_and_alloc (read * sizeof (float)); - data = (gfloat *) GST_BUFFER_DATA (out); - for (j = 0; j < read; j++) - data[j] = buf[j * nchannels + i % nchannels]; - gst_pad_push (channel->pad, GST_DATA (out)); + channel = GST_SF_CHANNEL (l); + + /* don't push on disconnected pads -- useful for ::create-pads=TRUE */ + if (!GST_PAD_PEER (channel->pad)) + continue; + + if (!channel->caps_set) { + GstCaps *caps = + gst_caps_copy (GST_PAD_CAPS (GST_SF_CHANNEL (l)->pad)); + if (!caps) + caps = gst_caps_copy + (GST_PAD_TEMPLATE_CAPS (GST_PAD_PAD_TEMPLATE (GST_SF_CHANNEL + (l)->pad))); + gst_caps_set_simple (caps, "rate", G_TYPE_INT, this->rate, + "buffer-frames", G_TYPE_INT, this->buffer_frames, NULL); + if (!gst_pad_try_set_caps (GST_SF_CHANNEL (l)->pad, caps)) { + GST_ELEMENT_ERROR (this, CORE, NEGOTIATION, (NULL), + ("Opened file with sample rate %d, but could not set caps", + this->rate)); + gst_sf_close_file (this); + return; + } + channel->caps_set = TRUE; + } + + out = gst_buffer_new_and_alloc (read * sizeof (float)); + data = (gfloat *) GST_BUFFER_DATA (out); + for (j = 0; j < read; j++) + data[j] = buf[j * nchannels + i % nchannels]; + gst_pad_push (channel->pad, GST_DATA (out)); } this->time += read * (GST_SECOND / this->rate); gst_audio_clock_update_time ((GstAudioClock *) this->provided_clock, - this->time); + this->time); if (eos) { if (this->loop) { - sf_seek (this->file, (sf_count_t) 0, SEEK_SET); - eos = 0; + sf_seek (this->file, (sf_count_t) 0, SEEK_SET); + eos = 0; } else { - for (l = this->channels; l; l = l->next) - gst_pad_push (GST_SF_CHANNEL (l)->pad, - GST_DATA (gst_event_new (GST_EVENT_EOS))); - gst_element_set_eos (element); + for (l = this->channels; l; l = l->next) + gst_pad_push (GST_SF_CHANNEL (l)->pad, + GST_DATA (gst_event_new (GST_EVENT_EOS))); + gst_element_set_eos (element); } } } else { @@ -777,7 +780,7 @@ gst_sf_loop (GstElement * element) num_to_write = buffer_frames; INFO_OBJ (this, "looping, buffer_frames=%d, nchannels=%d", buffer_frames, - nchannels); + nchannels); for (i = 0, l = this->channels; l; l = l->next, i++) { channel = GST_SF_CHANNEL (l); @@ -786,40 +789,40 @@ gst_sf_loop (GstElement * element) in = GST_BUFFER (gst_pad_pull (channel->pad)); if (buffer_frames == 0) { - /* pulling a buffer from the pad should have caused capsnego to occur, - which then would set this->buffer_frames to a new value */ - buffer_frames = this->buffer_frames; - if (buffer_frames == 0) { - GST_ELEMENT_ERROR (element, CORE, NEGOTIATION, (NULL), - ("format wasn't negotiated before chain function")); - return; - } - buf = this->buffer; - num_to_write = buffer_frames; + /* pulling a buffer from the pad should have caused capsnego to occur, + which then would set this->buffer_frames to a new value */ + buffer_frames = this->buffer_frames; + if (buffer_frames == 0) { + GST_ELEMENT_ERROR (element, CORE, NEGOTIATION, (NULL), + ("format wasn't negotiated before chain function")); + return; + } + buf = this->buffer; + num_to_write = buffer_frames; } if (!GST_FLAG_IS_SET (this, GST_SF_OPEN)) - if (!gst_sf_open_file (this)) - return; /* we've already set gst_element_error */ + if (!gst_sf_open_file (this)) + return; /* we've already set gst_element_error */ if (GST_IS_EVENT (in)) { - switch (GST_EVENT_TYPE (in)) { - case GST_EVENT_EOS: - case GST_EVENT_INTERRUPT: - num_to_write = 0; - break; - default: - goto pull_again; - break; - } + switch (GST_EVENT_TYPE (in)) { + case GST_EVENT_EOS: + case GST_EVENT_INTERRUPT: + num_to_write = 0; + break; + default: + goto pull_again; + break; + } } if (num_to_write) { - data = (gfloat *) GST_BUFFER_DATA (in); - num_to_write = - MIN (num_to_write, GST_BUFFER_SIZE (in) / sizeof (gfloat)); - for (j = 0; j < num_to_write; j++) - buf[j * nchannels + i % nchannels] = data[j]; + data = (gfloat *) GST_BUFFER_DATA (in); + num_to_write = + MIN (num_to_write, GST_BUFFER_SIZE (in) / sizeof (gfloat)); + for (j = 0; j < num_to_write; j++) + buf[j * nchannels + i % nchannels] = data[j]; } gst_data_unref ((GstData *) in); @@ -828,14 +831,14 @@ gst_sf_loop (GstElement * element) if (num_to_write) { written = sf_writef_float (this->file, buf, num_to_write); if (written != num_to_write) - GST_ELEMENT_ERROR (element, RESOURCE, WRITE, - (_("Could not write to file \"%s\"."), this->filename), - ("soundfile error: %s", sf_strerror (this->file))); + GST_ELEMENT_ERROR (element, RESOURCE, WRITE, + (_("Could not write to file \"%s\"."), this->filename), + ("soundfile error: %s", sf_strerror (this->file))); } this->time += num_to_write * (GST_SECOND / this->rate); gst_audio_clock_update_time ((GstAudioClock *) this->provided_clock, - this->time); + this->time); if (num_to_write != buffer_frames) gst_element_set_eos (element); diff --git a/ext/swfdec/gstswfdec.c b/ext/swfdec/gstswfdec.c index 06723d1e..b7c3c3db 100644 --- a/ext/swfdec/gstswfdec.c +++ b/ext/swfdec/gstswfdec.c @@ -57,12 +57,12 @@ GST_STATIC_PAD_TEMPLATE ("audio_00", GST_PAD_SRC, GST_PAD_ALWAYS, GST_STATIC_CAPS ("audio/x-raw-int, " - "rate = (int) 44100, " - "channels = (int) 2, " - "endianness = (int) BYTE_ORDER, " - "width = (int) 16, " - "depth = (int) 16, " - "signed = (boolean) true, " "buffer-frames = (int) [ 1, MAX ]") + "rate = (int) 44100, " + "channels = (int) 2, " + "endianness = (int) BYTE_ORDER, " + "width = (int) 16, " + "depth = (int) 16, " + "signed = (boolean) true, " "buffer-frames = (int) [ 1, MAX ]") ); static GstStaticPadTemplate sink_template_factory = @@ -118,8 +118,9 @@ gst_swfdec_get_type (void) 0, (GInstanceInitFunc) gst_swfdec_init, }; + swfdec_type = - g_type_register_static (GST_TYPE_ELEMENT, "GstSwfdec", &swfdec_info, 0); + g_type_register_static (GST_TYPE_ELEMENT, "GstSwfdec", &swfdec_info, 0); } return swfdec_type; } @@ -167,7 +168,7 @@ gst_swfdec_video_getcaps (GstPad * pad) caps = gst_caps_copy (gst_pad_get_pad_template_caps (pad)); if (swfdec->have_format) { gst_caps_set_simple (caps, - "framerate", G_TYPE_DOUBLE, swfdec->frame_rate, NULL); + "framerate", G_TYPE_DOUBLE, swfdec->frame_rate, NULL); } return caps; @@ -247,20 +248,20 @@ gst_swfdec_loop (GstElement * element) buf = GST_BUFFER (gst_pad_pull (swfdec->sinkpad)); if (GST_IS_EVENT (buf)) { switch (GST_EVENT_TYPE (buf)) { - case GST_EVENT_EOS: - GST_DEBUG ("got eos"); - break; - default: - GST_DEBUG ("got event"); - break; + case GST_EVENT_EOS: + GST_DEBUG ("got eos"); + break; + default: + GST_DEBUG ("got event"); + break; } } else { if (!GST_BUFFER_DATA (buf)) { - GST_DEBUG ("expected non-null buffer"); + GST_DEBUG ("expected non-null buffer"); } ret = swfdec_decoder_addbits (swfdec->state, - GST_BUFFER_DATA (buf), GST_BUFFER_SIZE (buf)); + GST_BUFFER_DATA (buf), GST_BUFFER_SIZE (buf)); } } @@ -269,16 +270,16 @@ gst_swfdec_loop (GstElement * element) GstPadLinkReturn link_ret; swfdec_decoder_get_image_size (swfdec->state, - &swfdec->width, &swfdec->height); + &swfdec->width, &swfdec->height); swfdec_decoder_get_rate (swfdec->state, &swfdec->rate); swfdec->interval = GST_SECOND / swfdec->rate; caps = gst_caps_copy (gst_pad_get_pad_template_caps (swfdec->videopad)); swfdec_decoder_get_rate (swfdec->state, &swfdec->frame_rate); gst_caps_set_simple (caps, - "framerate", G_TYPE_DOUBLE, swfdec->frame_rate, - "height", G_TYPE_INT, swfdec->height, - "width", G_TYPE_INT, swfdec->width, NULL); + "framerate", G_TYPE_DOUBLE, swfdec->frame_rate, + "height", G_TYPE_INT, swfdec->height, + "width", G_TYPE_INT, swfdec->width, NULL); link_ret = gst_pad_try_set_caps (swfdec->videopad, caps); if (GST_PAD_LINK_SUCCESSFUL (link_ret)) { /* good */ @@ -301,7 +302,7 @@ gst_swfdec_loop (GstElement * element) //GST_BUFFER_SIZE(newbuf) = swfdec->width * swfdec->height * 3; newbuf = gst_pad_alloc_buffer (swfdec->videopad, GST_BUFFER_OFFSET_NONE, - swfdec->width * 4 * swfdec->height); + swfdec->width * 4 * swfdec->height); swfdec_decoder_get_image (swfdec->state, &data); copy_image (GST_BUFFER_DATA (newbuf), data, swfdec->width, swfdec->height); @@ -398,16 +399,16 @@ gst_swfdec_convert_sink (GstPad * pad, GstFormat src_format, gint64 src_value, switch (src_format) { case GST_FORMAT_BYTES: switch (*dest_format) { - case GST_FORMAT_TIME: - default: - res = FALSE; + case GST_FORMAT_TIME: + default: + res = FALSE; } break; case GST_FORMAT_TIME: switch (*dest_format) { - case GST_FORMAT_BYTES: - default: - res = FALSE; + case GST_FORMAT_BYTES: + default: + res = FALSE; } break; default: @@ -430,43 +431,43 @@ gst_swfdec_convert_src (GstPad * pad, GstFormat src_format, gint64 src_value, switch (src_format) { case GST_FORMAT_BYTES: switch (*dest_format) { - case GST_FORMAT_TIME: - default: - res = FALSE; + case GST_FORMAT_TIME: + default: + res = FALSE; } break; case GST_FORMAT_TIME: switch (*dest_format) { - case GST_FORMAT_BYTES: - *dest_value = src_value * 6 * (swfdec->width * swfdec->height >> 2) * - video_rates[swfdec->decoder->frame_rate_code] / GST_SECOND; - break; - case GST_FORMAT_DEFAULT: - *dest_value = - src_value * video_rates[swfdec->decoder->frame_rate_code] / - GST_SECOND; - break; - default: - res = FALSE; + case GST_FORMAT_BYTES: + *dest_value = src_value * 6 * (swfdec->width * swfdec->height >> 2) * + video_rates[swfdec->decoder->frame_rate_code] / GST_SECOND; + break; + case GST_FORMAT_DEFAULT: + *dest_value = + src_value * video_rates[swfdec->decoder->frame_rate_code] / + GST_SECOND; + break; + default: + res = FALSE; } break; case GST_FORMAT_DEFAULT: switch (*dest_format) { - case GST_FORMAT_TIME: - if (video_rates[swfdec->decoder->frame_rate_code] != 0.0) { - *dest_value = src_value * GST_SECOND / - video_rates[swfdec->decoder->frame_rate_code]; - } else - res = FALSE; - break; - case GST_FORMAT_BYTES: - *dest_value = src_value * 6 * (swfdec->width * swfdec->height >> 2); - break; - case GST_FORMAT_DEFAULT: - *dest_value = src_value; - break; - default: - res = FALSE; + case GST_FORMAT_TIME: + if (video_rates[swfdec->decoder->frame_rate_code] != 0.0) { + *dest_value = src_value * GST_SECOND / + video_rates[swfdec->decoder->frame_rate_code]; + } else + res = FALSE; + break; + case GST_FORMAT_BYTES: + *dest_value = src_value * 6 * (swfdec->width * swfdec->height >> 2); + break; + case GST_FORMAT_DEFAULT: + *dest_value = src_value; + break; + default: + res = FALSE; } break; default: @@ -489,31 +490,31 @@ gst_swfdec_src_query (GstPad * pad, GstQueryType type, case GST_QUERY_TOTAL: { switch (*format) { - case GST_FORMAT_TIME: - { - int n_frames; - int ret; - - res = FALSE; - ret = swfdec_decoder_get_n_frames (swfdec->state, &n_frames); - if (ret == SWF_OK) { - *value = n_frames * swfdec->interval; - res = TRUE; - } - break; - } - default: - res = FALSE; - break; + case GST_FORMAT_TIME: + { + int n_frames; + int ret; + + res = FALSE; + ret = swfdec_decoder_get_n_frames (swfdec->state, &n_frames); + if (ret == SWF_OK) { + *value = n_frames * swfdec->interval; + res = TRUE; + } + break; + } + default: + res = FALSE; + break; } break; } case GST_QUERY_POSITION: { switch (*format) { - default: - res = FALSE; - break; + default: + res = FALSE; + break; } break; } @@ -532,7 +533,8 @@ gst_swfdec_src_event (GstPad * pad, GstEvent * event) gboolean res = TRUE; GstSwfdec *swfdec; static const GstFormat formats[] = { GST_FORMAT_TIME, GST_FORMAT_BYTES }; -#define MAX_SEEK_FORMATS 1 /* we can only do time seeking for now */ + +#define MAX_SEEK_FORMATS 1 /* we can only do time seeking for now */ gint i; swfdec = GST_SWFDEC (gst_pad_get_parent (pad)); @@ -549,11 +551,11 @@ gst_swfdec_src_event (GstPad * pad, GstEvent * event) /* first bring the src_format to TIME */ if (!gst_pad_convert (pad, - GST_EVENT_SEEK_FORMAT (event), GST_EVENT_SEEK_OFFSET (event), - &format, &src_offset)) { - /* didn't work, probably unsupported seek format then */ - res = FALSE; - break; + GST_EVENT_SEEK_FORMAT (event), GST_EVENT_SEEK_OFFSET (event), + &format, &src_offset)) { + /* didn't work, probably unsupported seek format then */ + res = FALSE; + break; } /* shave off the flush flag, we'll need it later */ @@ -564,26 +566,26 @@ gst_swfdec_src_event (GstPad * pad, GstEvent * event) /* while we did not exhaust our seek formats without result */ for (i = 0; i < MAX_SEEK_FORMATS && !res; i++) { - gint64 desired_offset; - - format = formats[i]; - - /* try to convert requested format to one we can seek with on the sinkpad */ - if (gst_pad_convert (swfdec->sinkpad, GST_FORMAT_TIME, src_offset, - &format, &desired_offset)) { - GstEvent *seek_event; - - /* conversion succeeded, create the seek */ - seek_event = - gst_event_new_seek (formats[i] | GST_SEEK_METHOD_SET | flush, - desired_offset); - /* do the seekk */ - if (gst_pad_send_event (GST_PAD_PEER (swfdec->sinkpad), seek_event)) { - /* seek worked, we're done, loop will exit */ - res = TRUE; - } - } - /* at this point, either the seek worked or res == FALSE */ + gint64 desired_offset; + + format = formats[i]; + + /* try to convert requested format to one we can seek with on the sinkpad */ + if (gst_pad_convert (swfdec->sinkpad, GST_FORMAT_TIME, src_offset, + &format, &desired_offset)) { + GstEvent *seek_event; + + /* conversion succeeded, create the seek */ + seek_event = + gst_event_new_seek (formats[i] | GST_SEEK_METHOD_SET | flush, + desired_offset); + /* do the seekk */ + if (gst_pad_send_event (GST_PAD_PEER (swfdec->sinkpad), seek_event)) { + /* seek worked, we're done, loop will exit */ + res = TRUE; + } + } + /* at this point, either the seek worked or res == FALSE */ } break; } @@ -630,8 +632,8 @@ gst_swfdec_change_state (GstElement * element) /* if we are not closed by an EOS event do so now, this cen send a few frames but * we are prepared to not really send them (see above) */ if (!swfdec->closed) { - /*swf_close (swfdec->decoder); */ - swfdec->closed = TRUE; + /*swf_close (swfdec->decoder); */ + swfdec->closed = TRUE; } //gst_swfdec_vo_destroy (swfdec); break; diff --git a/ext/tarkin/gsttarkin.c b/ext/tarkin/gsttarkin.c index a87575d9..0e8d859a 100644 --- a/ext/tarkin/gsttarkin.c +++ b/ext/tarkin/gsttarkin.c @@ -28,11 +28,11 @@ static gboolean plugin_init (GstPlugin * plugin) { if (!gst_element_register (plugin, "tarkinenc", GST_RANK_NONE, - GST_TYPE_TARKINENC)) + GST_TYPE_TARKINENC)) return FALSE; if (!gst_element_register (plugin, "tarkindec", GST_RANK_NONE, - GST_TYPE_TARKINDEC)) + GST_TYPE_TARKINDEC)) return FALSE; return TRUE; diff --git a/ext/tarkin/gsttarkindec.c b/ext/tarkin/gsttarkindec.c index b9f98784..a40c5319 100644 --- a/ext/tarkin/gsttarkindec.c +++ b/ext/tarkin/gsttarkindec.c @@ -85,8 +85,8 @@ tarkindec_get_type (void) }; tarkindec_type = - g_type_register_static (GST_TYPE_ELEMENT, "TarkinDec", &tarkindec_info, - 0); + g_type_register_static (GST_TYPE_ELEMENT, "TarkinDec", &tarkindec_info, + 0); } return tarkindec_type; } @@ -145,7 +145,7 @@ gst_tarkindec_class_init (TarkinDecClass * klass) g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_BITRATE, g_param_spec_int ("bitrate", "bitrate", "bitrate", - G_MININT, G_MAXINT, 3000, G_PARAM_READWRITE)); + G_MININT, G_MAXINT, 3000, G_PARAM_READWRITE)); parent_class = g_type_class_ref (GST_TYPE_ELEMENT); @@ -200,7 +200,7 @@ gst_tarkindec_chain (GstPad * pad, GstData * _data) if (!tarkindec->setup) { GST_ELEMENT_ERROR (tarkindec, CORE, NEGOTATION, (NULL), - ("decoder not initialized (input is not tarkin?)")); + ("decoder not initialized (input is not tarkin?)")); if (GST_IS_BUFFER (buf)) gst_buffer_unref (buf); else @@ -212,8 +212,8 @@ gst_tarkindec_chain (GstPad * pad, GstData * _data) switch (GST_EVENT_TYPE (buf)) { case GST_EVENT_EOS: default: - gst_pad_event_default (pad, GST_EVENT (buf)); - break; + gst_pad_event_default (pad, GST_EVENT (buf)); + break; } } else { gchar *data; @@ -235,43 +235,43 @@ gst_tarkindec_chain (GstPad * pad, GstData * _data) ogg_stream_pagein (&tarkindec->os, &tarkindec->og); while (ogg_stream_packetout (&tarkindec->os, &tarkindec->op)) { - if (tarkindec->op.e_o_s) - break; - if (tarkindec->nheader < 3) { /* 3 first packets to headerin */ - tarkin_synthesis_headerin (&tarkindec->ti, &tarkindec->tc, - &tarkindec->op); - - if (tarkindec->nheader == 2) { - tarkin_synthesis_init (tarkindec->tarkin_stream, &tarkindec->ti); - } - tarkindec->nheader++; - } else { - tarkin_synthesis_packetin (tarkindec->tarkin_stream, &tarkindec->op); - - while (tarkin_synthesis_frameout (tarkindec->tarkin_stream, &rgb, 0, - &date) == 0) { - GstBuffer *outbuf; - - layer = &tarkindec->tarkin_stream->layer->desc; - - if (!GST_PAD_CAPS (tarkindec->srcpad)) { - if (gst_pad_try_set_caps (tarkindec->srcpad, GST_CAPS_NEW ("tarkin_raw", "video/x-raw-rgb", "bpp", GST_PROPS_INT (24), "depth", GST_PROPS_INT (24), "endianness", GST_PROPS_INT (G_BYTE_ORDER), "red_mask", GST_PROPS_INT (0xff0000), "green_mask", GST_PROPS_INT (0xff00), "blue_mask", GST_PROPS_INT (0xff), "width", GST_PROPS_INT (layer->width), "height", GST_PROPS_INT (layer->height), "framerate", GST_PROPS_FLOAT (0.) /* FIXME!!! */ - )) <= 0) { - GST_ELEMENT_ERROR (tarkindec, CORE, NEGOTATION, (NULL), - ("could not output format")); - gst_buffer_unref (buf); - return; - } - } - outbuf = gst_buffer_new (); - GST_BUFFER_DATA (outbuf) = rgb; - GST_BUFFER_SIZE (outbuf) = layer->width * layer->height * 3; - GST_BUFFER_FLAG_SET (outbuf, GST_BUFFER_DONTFREE); - gst_pad_push (tarkindec->srcpad, GST_DATA (outbuf)); - - tarkin_synthesis_freeframe (tarkindec->tarkin_stream, rgb); - } - } + if (tarkindec->op.e_o_s) + break; + if (tarkindec->nheader < 3) { /* 3 first packets to headerin */ + tarkin_synthesis_headerin (&tarkindec->ti, &tarkindec->tc, + &tarkindec->op); + + if (tarkindec->nheader == 2) { + tarkin_synthesis_init (tarkindec->tarkin_stream, &tarkindec->ti); + } + tarkindec->nheader++; + } else { + tarkin_synthesis_packetin (tarkindec->tarkin_stream, &tarkindec->op); + + while (tarkin_synthesis_frameout (tarkindec->tarkin_stream, &rgb, 0, + &date) == 0) { + GstBuffer *outbuf; + + layer = &tarkindec->tarkin_stream->layer->desc; + + if (!GST_PAD_CAPS (tarkindec->srcpad)) { + if (gst_pad_try_set_caps (tarkindec->srcpad, GST_CAPS_NEW ("tarkin_raw", "video/x-raw-rgb", "bpp", GST_PROPS_INT (24), "depth", GST_PROPS_INT (24), "endianness", GST_PROPS_INT (G_BYTE_ORDER), "red_mask", GST_PROPS_INT (0xff0000), "green_mask", GST_PROPS_INT (0xff00), "blue_mask", GST_PROPS_INT (0xff), "width", GST_PROPS_INT (layer->width), "height", GST_PROPS_INT (layer->height), "framerate", GST_PROPS_FLOAT (0.) /* FIXME!!! */ + )) <= 0) { + GST_ELEMENT_ERROR (tarkindec, CORE, NEGOTATION, (NULL), + ("could not output format")); + gst_buffer_unref (buf); + return; + } + } + outbuf = gst_buffer_new (); + GST_BUFFER_DATA (outbuf) = rgb; + GST_BUFFER_SIZE (outbuf) = layer->width * layer->height * 3; + GST_BUFFER_FLAG_SET (outbuf, GST_BUFFER_DONTFREE); + gst_pad_push (tarkindec->srcpad, GST_DATA (outbuf)); + + tarkin_synthesis_freeframe (tarkindec->tarkin_stream, rgb); + } + } } } gst_buffer_unref (buf); diff --git a/ext/tarkin/gsttarkinenc.c b/ext/tarkin/gsttarkinenc.c index 4c62303d..f1d3853d 100644 --- a/ext/tarkin/gsttarkinenc.c +++ b/ext/tarkin/gsttarkinenc.c @@ -86,8 +86,8 @@ tarkinenc_get_type (void) }; tarkinenc_type = - g_type_register_static (GST_TYPE_ELEMENT, "TarkinEnc", &tarkinenc_info, - 0); + g_type_register_static (GST_TYPE_ELEMENT, "TarkinEnc", &tarkinenc_info, + 0); } return tarkinenc_type; } @@ -146,15 +146,15 @@ gst_tarkinenc_class_init (TarkinEncClass * klass) g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_BITRATE, g_param_spec_int ("bitrate", "bitrate", "bitrate", - G_MININT, G_MAXINT, 3000, G_PARAM_READWRITE)); + G_MININT, G_MAXINT, 3000, G_PARAM_READWRITE)); g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_S_MOMENTS, g_param_spec_int ("s_moments", "Synthesis Moments", - "Number of vanishing moments for the synthesis filter", - 1, 4, 2, G_PARAM_READWRITE)); + "Number of vanishing moments for the synthesis filter", + 1, 4, 2, G_PARAM_READWRITE)); g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_A_MOMENTS, g_param_spec_int ("a_moments", "Analysis Moments", - "Number of vanishing moments for the analysis filter", - 1, 4, 2, G_PARAM_READWRITE)); + "Number of vanishing moments for the analysis filter", + 1, 4, 2, G_PARAM_READWRITE)); parent_class = g_type_class_ref (GST_TYPE_ELEMENT); @@ -313,7 +313,7 @@ gst_tarkinenc_chain (GstPad * pad, GstData * _data) if (!tarkinenc->setup) { GST_ELEMENT_ERROR (tarkinenc, CORE, NEGOTIATION, (NULL), - ("encoder not initialized (input is not tarkin?)")); + ("encoder not initialized (input is not tarkin?)")); if (GST_IS_BUFFER (buf)) gst_buffer_unref (buf); else @@ -324,12 +324,12 @@ gst_tarkinenc_chain (GstPad * pad, GstData * _data) if (GST_IS_EVENT (buf)) { switch (GST_EVENT_TYPE (buf)) { case GST_EVENT_EOS: - tarkin_analysis_framein (tarkinenc->tarkin_stream, NULL, 0, NULL); /* EOS */ - tarkin_comment_clear (&tarkinenc->tc); - tarkin_stream_destroy (tarkinenc->tarkin_stream); + tarkin_analysis_framein (tarkinenc->tarkin_stream, NULL, 0, NULL); /* EOS */ + tarkin_comment_clear (&tarkinenc->tc); + tarkin_stream_destroy (tarkinenc->tarkin_stream); default: - gst_pad_event_default (pad, GST_EVENT (buf)); - break; + gst_pad_event_default (pad, GST_EVENT (buf)); + break; } } else { gchar *data; @@ -396,9 +396,9 @@ gst_tarkinenc_set_property (GObject * object, guint prop_id, s_moments = g_value_get_int (value); if (s_moments != 1 || s_moments != 2 || s_moments != 4) { - g_warning ("tarkinenc: s_moments must be 1, 2 or 4"); + g_warning ("tarkinenc: s_moments must be 1, 2 or 4"); } else { - tarkinenc->s_moments = s_moments; + tarkinenc->s_moments = s_moments; } break; } @@ -408,9 +408,9 @@ gst_tarkinenc_set_property (GObject * object, guint prop_id, a_moments = g_value_get_int (value); if (a_moments != 1 || a_moments != 2 || a_moments != 4) { - g_warning ("tarkinenc: a_moments must be 1, 2 or 4"); + g_warning ("tarkinenc: a_moments must be 1, 2 or 4"); } else { - tarkinenc->a_moments = a_moments; + tarkinenc->a_moments = a_moments; } break; } diff --git a/ext/tarkin/info.c b/ext/tarkin/info.c index 3b0871a3..83fe1bae 100644 --- a/ext/tarkin/info.c +++ b/ext/tarkin/info.c @@ -71,7 +71,7 @@ tarkin_comment_add (TarkinComment * vc, char *comment) void tarkin_comment_add_tag (TarkinComment * vc, char *tag, char *contents) { - char *comment = alloca (strlen (tag) + strlen (contents) + 2); /* +2 for = and \0 */ + char *comment = alloca (strlen (tag) + strlen (contents) + 2); /* +2 for = and \0 */ strcpy (comment, tag); strcat (comment, "="); @@ -99,7 +99,7 @@ tarkin_comment_query (TarkinComment * vc, char *tag, int count) { long i; int found = 0; - int taglen = strlen (tag) + 1; /* +1 for the = we append */ + int taglen = strlen (tag) + 1; /* +1 for the = we append */ char *fulltag = alloca (taglen + 1); strcpy (fulltag, tag); @@ -108,20 +108,20 @@ tarkin_comment_query (TarkinComment * vc, char *tag, int count) for (i = 0; i < vc->comments; i++) { if (!tagcompare (vc->user_comments[i], fulltag, taglen)) { if (count == found) - /* We return a pointer to the data, not a copy */ - return vc->user_comments[i] + taglen; + /* We return a pointer to the data, not a copy */ + return vc->user_comments[i] + taglen; else - found++; + found++; } } - return NULL; /* didn't find anything */ + return NULL; /* didn't find anything */ } int tarkin_comment_query_count (TarkinComment * vc, char *tag) { int i, count = 0; - int taglen = strlen (tag) + 1; /* +1 for the = we append */ + int taglen = strlen (tag) + 1; /* +1 for the = we append */ char *fulltag = alloca (taglen + 1); strcpy (fulltag, tag); @@ -143,7 +143,7 @@ tarkin_comment_clear (TarkinComment * vc) for (i = 0; i < vc->comments; i++) if (vc->user_comments[i]) - FREE (vc->user_comments[i]); + FREE (vc->user_comments[i]); if (vc->user_comments) FREE (vc->user_comments); if (vc->comment_lengths) @@ -200,7 +200,7 @@ _tarkin_unpack_info (TarkinInfo * vi, oggpack_buffer * opb) goto err_out; if (oggpack_read (opb, 1) != 1) - goto err_out; /* EOP check */ + goto err_out; /* EOP check */ #ifdef DBG_OGG printf ("Success\n"); @@ -245,7 +245,7 @@ _tarkin_unpack_comment (TarkinComment * vc, oggpack_buffer * opb) _v_readstring (opb, vc->user_comments[i], len); } if (oggpack_read (opb, 1) != 1) - goto err_out; /* EOP check */ + goto err_out; /* EOP check */ #ifdef DBG_OGG printf ("Success, read %d comments\n", vc->comments); @@ -284,55 +284,55 @@ _tarkin_unpack_layer_desc (TarkinInfo * vi, oggpack_buffer * opb) switch (layer->desc.format) { case TARKIN_GRAYSCALE: - layer->n_comp = 1; - layer->color_fwd_xform = grayscale_to_y; - layer->color_inv_xform = y_to_grayscale; - break; + layer->n_comp = 1; + layer->color_fwd_xform = grayscale_to_y; + layer->color_inv_xform = y_to_grayscale; + break; case TARKIN_RGB24: - layer->n_comp = 3; - layer->color_fwd_xform = rgb24_to_yuv; - layer->color_inv_xform = yuv_to_rgb24; - break; + layer->n_comp = 3; + layer->color_fwd_xform = rgb24_to_yuv; + layer->color_inv_xform = yuv_to_rgb24; + break; case TARKIN_RGB32: - layer->n_comp = 3; - layer->color_fwd_xform = rgb32_to_yuv; - layer->color_inv_xform = yuv_to_rgb32; - break; + layer->n_comp = 3; + layer->color_fwd_xform = rgb32_to_yuv; + layer->color_inv_xform = yuv_to_rgb32; + break; case TARKIN_RGBA: - layer->n_comp = 4; - layer->color_fwd_xform = rgba_to_yuv; - layer->color_inv_xform = yuv_to_rgba; - break; + layer->n_comp = 4; + layer->color_fwd_xform = rgba_to_yuv; + layer->color_inv_xform = yuv_to_rgba; + break; default: - return -TARKIN_INVALID_COLOR_FORMAT; + return -TARKIN_INVALID_COLOR_FORMAT; }; layer->waveletbuf = (Wavelet3DBuf **) CALLOC (layer->n_comp, - sizeof (Wavelet3DBuf *)); + sizeof (Wavelet3DBuf *)); layer->packet = MALLOC (layer->n_comp * sizeof (*layer->packet)); memset (layer->packet, 0, layer->n_comp * sizeof (*layer->packet)); for (j = 0; j < layer->n_comp; j++) { layer->waveletbuf[j] = wavelet_3d_buf_new (layer->desc.width, - layer->desc.height, layer->desc.frames_per_buf); + layer->desc.height, layer->desc.frames_per_buf); layer->packet[j].data = MALLOC (layer->desc.bitstream_len); layer->packet[j].storage = layer->desc.bitstream_len; } - vi->max_bitstream_len += layer->desc.bitstream_len + 2 * 10 * sizeof (uint32_t) * layer->n_comp; /* truncation tables */ + vi->max_bitstream_len += layer->desc.bitstream_len + 2 * 10 * sizeof (uint32_t) * layer->n_comp; /* truncation tables */ #ifdef DBG_OGG printf - ("\n layer%d: size %dx%dx%d, format %d, a_m %d, s_m %d, %d fpb\n", - i, layer->desc.width, layer->desc.height, layer->n_comp, - layer->desc.format, layer->desc.a_moments, layer->desc.s_moments, - layer->desc.frames_per_buf); + ("\n layer%d: size %dx%dx%d, format %d, a_m %d, s_m %d, %d fpb\n", + i, layer->desc.width, layer->desc.height, layer->n_comp, + layer->desc.format, layer->desc.a_moments, layer->desc.s_moments, + layer->desc.frames_per_buf); #endif - } /* for each layer */ + } /* for each layer */ if (oggpack_read (opb, 1) != 1) - goto err_out; /* EOP check */ + goto err_out; /* EOP check */ #ifdef DBG_OGG printf ("Success\n"); @@ -369,42 +369,42 @@ tarkin_synthesis_headerin (TarkinInfo * vi, TarkinComment * vc, ogg_packet * op) memset (buffer, 0, 6); _v_readstring (&opb, buffer, 6); if (memcmp (buffer, "tarkin", 6)) { - /* not a tarkin header */ - return (-TARKIN_NOT_TARKIN); + /* not a tarkin header */ + return (-TARKIN_NOT_TARKIN); } switch (packtype) { - case 0x01: /* least significant *bit* is read first */ - if (!op->b_o_s) { - /* Not the initial packet */ - return (-TARKIN_BAD_HEADER); - } - if (vi->inter.numerator != 0) { - /* previously initialized info header */ - return (-TARKIN_BAD_HEADER); - } - - return (_tarkin_unpack_info (vi, &opb)); - - case 0x03: /* least significant *bit* is read first */ - if (vi->inter.denominator == 0) { - /* um... we didn't get the initial header */ - return (-TARKIN_BAD_HEADER); - } - - return (_tarkin_unpack_comment (vc, &opb)); - - case 0x05: /* least significant *bit* is read first */ - if (vi->inter.numerator == 0 || vc->vendor == NULL) { - /* um... we didn;t get the initial header or comments yet */ - return (-TARKIN_BAD_HEADER); - } - - return (_tarkin_unpack_layer_desc (vi, &opb)); - - default: - /* Not a valid tarkin header type */ - return (-TARKIN_BAD_HEADER); - break; + case 0x01: /* least significant *bit* is read first */ + if (!op->b_o_s) { + /* Not the initial packet */ + return (-TARKIN_BAD_HEADER); + } + if (vi->inter.numerator != 0) { + /* previously initialized info header */ + return (-TARKIN_BAD_HEADER); + } + + return (_tarkin_unpack_info (vi, &opb)); + + case 0x03: /* least significant *bit* is read first */ + if (vi->inter.denominator == 0) { + /* um... we didn't get the initial header */ + return (-TARKIN_BAD_HEADER); + } + + return (_tarkin_unpack_comment (vc, &opb)); + + case 0x05: /* least significant *bit* is read first */ + if (vi->inter.numerator == 0 || vc->vendor == NULL) { + /* um... we didn;t get the initial header or comments yet */ + return (-TARKIN_BAD_HEADER); + } + + return (_tarkin_unpack_layer_desc (vi, &opb)); + + default: + /* Not a valid tarkin header type */ + return (-TARKIN_BAD_HEADER); + break; } } } @@ -462,10 +462,10 @@ _tarkin_pack_comment (oggpack_buffer * opb, TarkinComment * vc) for (i = 0; i < vc->comments; i++) { if (vc->user_comments[i]) { - oggpack_write (opb, vc->comment_lengths[i], 32); - _v_writestring (opb, vc->user_comments[i], vc->comment_lengths[i]); + oggpack_write (opb, vc->comment_lengths[i], 32); + _v_writestring (opb, vc->user_comments[i], vc->comment_lengths[i]); } else { - oggpack_write (opb, 0, 32); + oggpack_write (opb, 0, 32); } } } @@ -503,9 +503,9 @@ _tarkin_pack_layer_desc (oggpack_buffer * opb, TarkinInfo * vi) #ifdef DBG_OGG printf (" res. %dx%d, format %d, a_m %d, s_m %d, fpb %d\n", - layer->desc.width, layer->desc.height, layer->desc.format, - layer->desc.a_moments, layer->desc.s_moments, - layer->desc.frames_per_buf); + layer->desc.width, layer->desc.height, layer->desc.format, + layer->desc.a_moments, layer->desc.s_moments, + layer->desc.frames_per_buf); #endif } diff --git a/ext/tarkin/mem.c b/ext/tarkin/mem.c index 6b337ef3..5ef59f2f 100644 --- a/ext/tarkin/mem.c +++ b/ext/tarkin/mem.c @@ -16,7 +16,8 @@ typedef struct char *allocated_in_func; char *allocated_in_file; unsigned int allocated_in_line; -} MemDesc; +} +MemDesc; static int initialized = 0; @@ -38,8 +39,8 @@ dbg_memleaks_done (int exitcode, void *dummy) MemDesc *d = &alloc_list[i]; fprintf (stderr, "chunk %p allocated in %s (%s: %u) not free'd !!\n", - d->mem, d->allocated_in_func, d->allocated_in_file, - d->allocated_in_line); + d->mem, d->allocated_in_func, d->allocated_in_file, + d->allocated_in_line); } free (alloc_list); } @@ -114,9 +115,9 @@ dbg_realloc (char *file, int line, char *func, char *what, if (mem != NULL) { fprintf (stderr, - "%s: trying to reallocate unknown chunk %p (%s)\n" - " in %s (%s: %u) !!!\n", - __FUNCTION__, mem, what, func, file, line); + "%s: trying to reallocate unknown chunk %p (%s)\n" + " in %s (%s: %u) !!!\n", + __FUNCTION__, mem, what, func, file, line); exit (-1); } @@ -137,7 +138,7 @@ dbg_free (char *file, int line, char *func, char *what, void *mem) free (mem); alloc_count--; memmove (&alloc_list[i], &alloc_list[i + 1], - (alloc_count - i) * sizeof (MemDesc)); + (alloc_count - i) * sizeof (MemDesc)); return; } } diff --git a/ext/tarkin/tarkin.c b/ext/tarkin/tarkin.c index b15b5512..70bfefc0 100644 --- a/ext/tarkin/tarkin.c +++ b/ext/tarkin/tarkin.c @@ -42,8 +42,8 @@ tarkin_stream_destroy (TarkinStream * s) for (i = 0; i < s->n_layers; i++) { if (s->layer[i].waveletbuf) { for (j = 0; j < s->layer[i].n_comp; j++) { - wavelet_3d_buf_destroy (s->layer[i].waveletbuf[j]); - FREE (s->layer[i].packet[j].data); + wavelet_3d_buf_destroy (s->layer[i].waveletbuf[j]); + FREE (s->layer[i].packet[j].data); } FREE (s->layer[i].waveletbuf); FREE (s->layer[i].packet); @@ -141,7 +141,7 @@ tarkin_analysis_add_layer (TarkinStream * s, TarkinVideoLayerDesc * tvld) for (i = 0; i < layer->n_comp; i++) { layer->waveletbuf[i] = wavelet_3d_buf_new (layer->desc.width, - layer->desc.height, layer->desc.frames_per_buf); + layer->desc.height, layer->desc.frames_per_buf); layer->packet[i].data = MALLOC (layer->desc.bitstream_len); layer->packet[i].storage = layer->desc.bitstream_len; } @@ -165,7 +165,7 @@ _analysis_packetout (TarkinStream * s, uint32_t layer_id, uint32_t comp) data_len = s->layer[layer_id].packet[comp].data_len; oggpack_writeinit (&opb); - oggpack_write (&opb, 0, 8); /* No feature flags for now */ + oggpack_write (&opb, 0, 8); /* No feature flags for now */ oggpack_write (&opb, layer_id, 12); oggpack_write (&opb, comp, 12); for (i = 0; i < data_len; i++) @@ -180,7 +180,7 @@ _analysis_packetout (TarkinStream * s, uint32_t layer_id, uint32_t comp) printf ("dbg_ogg: writing packet layer %d, comp %d, data_len %d %s\n", layer_id, comp, data_len, op.e_o_s ? "eos" : ""); #endif - s->layer[layer_id].packet[comp].data_len = 0; /* so direct call => eos */ + s->layer[layer_id].packet[comp].data_len = 0; /* so direct call => eos */ return (s->packet_out (s, &op)); } @@ -198,31 +198,31 @@ _stream_flush (TarkinStream * s) uint32_t comp_bitstream_len; TarkinPacket *packet = layer->packet + j; - /** + /** * implicit 6:1:1 subsampling */ if (j == 0) - comp_bitstream_len = - 6 * layer->desc.bitstream_len / (layer->n_comp + 5); + comp_bitstream_len = + 6 * layer->desc.bitstream_len / (layer->n_comp + 5); else - comp_bitstream_len = layer->desc.bitstream_len / (layer->n_comp + 5); + comp_bitstream_len = layer->desc.bitstream_len / (layer->n_comp + 5); if (packet->storage < comp_bitstream_len) { - packet->storage = comp_bitstream_len; - packet->data = REALLOC (packet->data, comp_bitstream_len); + packet->storage = comp_bitstream_len; + packet->data = REALLOC (packet->data, comp_bitstream_len); } wavelet_3d_buf_dump ("color-%d-%03d.pgm", - s->current_frame, j, layer->waveletbuf[j], j == 0 ? 0 : 128); + s->current_frame, j, layer->waveletbuf[j], j == 0 ? 0 : 128); wavelet_3d_buf_fwd_xform (layer->waveletbuf[j], - layer->desc.a_moments, layer->desc.s_moments); + layer->desc.a_moments, layer->desc.s_moments); wavelet_3d_buf_dump ("coeff-%d-%03d.pgm", - s->current_frame, j, layer->waveletbuf[j], 128); + s->current_frame, j, layer->waveletbuf[j], 128); packet->data_len = wavelet_3d_buf_encode_coeff (layer->waveletbuf[j], - packet->data, comp_bitstream_len); + packet->data, comp_bitstream_len); _analysis_packetout (s, i, j); } @@ -237,7 +237,7 @@ tarkin_analysis_framein (TarkinStream * s, uint8_t * frame, TarkinVideoLayer *layer; if (!frame) - return (_analysis_packetout (s, 0, 0)); /* eos */ + return (_analysis_packetout (s, 0, 0)); /* eos */ if ((layer_id >= s->n_layers) || (date->denominator == 0)) return (TARKIN_FAULT); @@ -286,7 +286,7 @@ TarkinError tarkin_synthesis_init (TarkinStream * s, TarkinInfo * ti) { s->ti = ti; - s->layer = ti->layer; /* It was malloc()ed by headerin() */ + s->layer = ti->layer; /* It was malloc()ed by headerin() */ s->n_layers = ti->n_layers; return (TARKIN_OK); } @@ -307,17 +307,17 @@ tarkin_synthesis_packetin (TarkinStream * s, ogg_packet * op) #endif oggpack_readinit (&opb, op->packet, op->bytes); flags = oggpack_read (&opb, 8); - layer_id = oggpack_read (&opb, 12); /* Theses are required for */ - comp = oggpack_read (&opb, 12); /* data hole handling (or maybe - * packetno would be enough ?) */ + layer_id = oggpack_read (&opb, 12); /* Theses are required for */ + comp = oggpack_read (&opb, 12); /* data hole handling (or maybe + * packetno would be enough ?) */ nread = 4; - if (flags) { /* This is void "infinite future features" feature ;) */ + if (flags) { /* This is void "infinite future features" feature ;) */ if (flags & 1 << 7) { junk = flags; while (junk & 1 << 7) - junk = oggpack_read (&opb, 8); /* allow for many future flags - that must be correctly ordonned. */ + junk = oggpack_read (&opb, 8); /* allow for many future flags + that must be correctly ordonned. */ } /* This shows how to get a feature's data: if (flags & TARKIN_FLAGS_EXAMPLE){ @@ -326,7 +326,7 @@ tarkin_synthesis_packetin (TarkinStream * s, ogg_packet * op) tp->example &= 0x4fffffff; } */ - for (junk = 1 << 31; junk & 1 << 31;) /* and many future data */ + for (junk = 1 << 31; junk & 1 << 31;) /* and many future data */ while ((junk = oggpack_read (&opb, 32)) & 1 << 30); /* That is, feature data comes in 30 bit chunks. We also have * 31 potentially usefull bits in last chunk. */ @@ -343,7 +343,7 @@ tarkin_synthesis_packetin (TarkinStream * s, ogg_packet * op) /* We now have for shure our data. */ packet = &s->layer[layer_id].packet[comp]; if (packet->data_len) - return (-TARKIN_UNUSED); /* Previous data wasn't used */ + return (-TARKIN_UNUSED); /* Previous data wasn't used */ if (packet->storage < data_len) { packet->storage = data_len + 255; @@ -371,19 +371,19 @@ tarkin_synthesis_frameout (TarkinStream * s, TarkinPacket *packet = layer->packet + j; if (packet->data_len == 0) - goto err_out; + goto err_out; wavelet_3d_buf_decode_coeff (layer->waveletbuf[j], packet->data, - packet->data_len); + packet->data_len); wavelet_3d_buf_dump ("rcoeff-%d-%03d.pgm", - s->current_frame, j, layer->waveletbuf[j], 128); + s->current_frame, j, layer->waveletbuf[j], 128); wavelet_3d_buf_inv_xform (layer->waveletbuf[j], - layer->desc.a_moments, layer->desc.s_moments); + layer->desc.a_moments, layer->desc.s_moments); wavelet_3d_buf_dump ("rcolor-%d-%03d.pgm", - s->current_frame, j, layer->waveletbuf[j], j == 0 ? 0 : 128); + s->current_frame, j, layer->waveletbuf[j], j == 0 ? 0 : 128); } /* We did successfylly read a block from this layer, acknowledge it. */ diff --git a/ext/tarkin/wavelet.c b/ext/tarkin/wavelet.c index cecce80a..77ce9a4c 100644 --- a/ext/tarkin/wavelet.c +++ b/ext/tarkin/wavelet.c @@ -118,7 +118,7 @@ wavelet_3d_buf_dump (char *fmt, snprintf (fname, 256, fmt, id, first_frame_in_buf + f); write_pgm16 (fname, buf->data + f * buf->width * buf->height, - buf->width, buf->height, offset); + buf->width, buf->height, offset); } } #endif diff --git a/ext/tarkin/wavelet_coeff.c b/ext/tarkin/wavelet_coeff.c index 95da5cad..fbe08f78 100644 --- a/ext/tarkin/wavelet_coeff.c +++ b/ext/tarkin/wavelet_coeff.c @@ -104,15 +104,15 @@ skip_0coeffs (Wavelet3DBuf * buf, uint32_t runlength = ENTROPY_CODER_RUNLENGTH (&s_stream[i]); if (i == 0) - runlength /= 2; /* sign bits are in this bitplane ... */ + runlength /= 2; /* sign bits are in this bitplane ... */ if (skip > runlength) - skip = runlength; + skip = runlength; if (skip <= 2) - return 0; + return 0; } } - ENTROPY_CODER_SKIP (&s_stream[0], 2 * skip); /* kill sign+significance bits */ + ENTROPY_CODER_SKIP (&s_stream[0], 2 * skip); /* kill sign+significance bits */ for (i = 1; i < TYPE_BITS; i++) ENTROPY_CODER_SKIP (&s_stream[i], skip); @@ -134,11 +134,11 @@ encode_quadrant (const Wavelet3DBuf * buf, for (z = 0; z < f; z++) { for (y = 0; y < h; y++) { for (x = 0; x < w; x++) { - unsigned int index = buf->offset[level][quadrant] - + z * buf->width * buf->height + y * buf->width + x; + unsigned int index = buf->offset[level][quadrant] + + z * buf->width * buf->height + y * buf->width + x; - encode_coeff (significand_bitstream, insignificand_bitstream, - buf->data[index]); + encode_coeff (significand_bitstream, insignificand_bitstream, + buf->data[index]); } } } @@ -194,28 +194,28 @@ decode_quadrant (Wavelet3DBuf * buf, do { x = 0; do { - uint32_t skip; - uint32_t index = buf->offset[level][quadrant] - + z * buf->width * buf->height + y * buf->width + x; - - buf->data[index] = decode_coeff (s_stream, i_stream); - - skip = skip_0coeffs (buf, s_stream, i_stream, - (w - x - 1) + (h - y - 1) * w + (f - z - 1) * w * h); - if (skip > 0) { - x += skip; - while (x >= w) { - y++; - x -= w; - while (y >= h) { - z++; - y -= h; - if (z >= f) - return; - } - } - } - x++; + uint32_t skip; + uint32_t index = buf->offset[level][quadrant] + + z * buf->width * buf->height + y * buf->width + x; + + buf->data[index] = decode_coeff (s_stream, i_stream); + + skip = skip_0coeffs (buf, s_stream, i_stream, + (w - x - 1) + (h - y - 1) * w + (f - z - 1) * w * h); + if (skip > 0) { + x += skip; + while (x >= w) { + y++; + x -= w; + while (y >= h) { + z++; + y -= h; + if (z >= f) + return; + } + } + } + x++; } while (x < w); y++; } while (y < h); @@ -285,7 +285,7 @@ decode_coefficients (Wavelet3DBuf * buf, buf->data[i] = decode_coeff (s_stream, i_stream); skip = skip_0coeffs (buf, s_stream, i_stream, - buf->width * buf->height * buf->frames - i); + buf->width * buf->height * buf->frames - i); i += skip; } } @@ -304,10 +304,10 @@ setup_limittabs (ENTROPY_CODER significand_bitstream[], uint32_t byte_count; int i; - assert (limit > 2 * TYPE_BITS * sizeof (uint32_t)); /* limit too small */ + assert (limit > 2 * TYPE_BITS * sizeof (uint32_t)); /* limit too small */ printf ("%s: limit == %u\n", __FUNCTION__, limit); - byte_count = 2 * TYPE_BITS * sizeof (uint32_t); /* 2 binary coded limittabs */ + byte_count = 2 * TYPE_BITS * sizeof (uint32_t); /* 2 binary coded limittabs */ limit -= byte_count; printf ("%s: rem. limit == %u\n", __FUNCTION__, limit); @@ -342,9 +342,9 @@ setup_limittabs (ENTROPY_CODER significand_bitstream[], byte_count += insignificand_limittab[i]; printf ("insignificand_limittab[%i] == %u / %u\n", - i, insignificand_limittab[i], i_bytes); + i, insignificand_limittab[i], i_bytes); printf (" significand_limittab[%i] == %u / %u\n", - i, significand_limittab[i], s_bytes); + i, significand_limittab[i], s_bytes); significand_limit -= significand_limittab[i]; insignificand_limit -= insignificand_limittab[i]; @@ -394,7 +394,7 @@ read_limittabs (uint8_t * bitstream, for (i = 0; i < TYPE_BITS; i++) { insignificand_limittab[i] = *(uint32_t *) bitstream; printf ("insignificand_limittab[%i] == %u\n", i, - insignificand_limittab[i]); + insignificand_limittab[i]); bitstream += 4; } @@ -415,16 +415,16 @@ merge_bitstreams (uint8_t * bitstream, for (i = TYPE_BITS - 1; i >= 0; i--) { memcpy (bitstream, - ENTROPY_CODER_BITSTREAM (&significand_bitstream[i]), - significand_limittab[i]); + ENTROPY_CODER_BITSTREAM (&significand_bitstream[i]), + significand_limittab[i]); bitstream += significand_limittab[i]; } for (i = TYPE_BITS - 1; i >= 0; i--) { memcpy (bitstream, - ENTROPY_CODER_BITSTREAM (&insignificand_bitstream[i]), - insignificand_limittab[i]); + ENTROPY_CODER_BITSTREAM (&insignificand_bitstream[i]), + insignificand_limittab[i]); bitstream += insignificand_limittab[i]; } diff --git a/ext/tarkin/wavelet_xform.c b/ext/tarkin/wavelet_xform.c index fda5f59d..c6eed791 100644 --- a/ext/tarkin/wavelet_xform.c +++ b/ext/tarkin/wavelet_xform.c @@ -61,13 +61,13 @@ fwd_analyze_2 (const TYPE * x, TYPE * d, int stride, int n) if (n & 1) { for (i = 0; i < k; i++) d[i] = - x[(2 * i + 1) * stride] - (x[2 * i * stride] + x[(2 * i + - 2) * stride]) / 2; + x[(2 * i + 1) * stride] - (x[2 * i * stride] + x[(2 * i + + 2) * stride]) / 2; } else { for (i = 0; i < k - 1; i++) d[i] = - x[(2 * i + 1) * stride] - (x[2 * i * stride] + x[(2 * i + - 2) * stride]) / 2; + x[(2 * i + 1) * stride] - (x[2 * i * stride] + x[(2 * i + + 2) * stride]) / 2; d[k - 1] = x[(n - 1) * stride] - x[(n - 2) * stride]; } } @@ -95,11 +95,11 @@ inv_analyze_2 (TYPE * x, const TYPE * d, int stride, int n) if (n & 1) { for (i = 0; i < k; i++) x[(2 * i + 1) * stride] = - d[i] + (x[2 * i * stride] + x[(2 * i + 2) * stride]) / 2; + d[i] + (x[2 * i * stride] + x[(2 * i + 2) * stride]) / 2; } else { for (i = 0; i < k - 1; i++) x[(2 * i + 1) * stride] = - d[i] + (x[2 * i * stride] + x[(2 * i + 2) * stride]) / 2; + d[i] + (x[2 * i * stride] + x[(2 * i + 2) * stride]) / 2; x[(n - 1) * stride] = d[k - 1] + x[(n - 2) * stride]; } } @@ -129,20 +129,20 @@ fwd_analyze_4 (const TYPE * x, TYPE * d, int stride, int n) if (n & 1) { for (i = 1; i < k - 1; i++) d[i] = x[(2 * i + 1) * stride] - - ((uint32_t) 9 * (x[2 * i * stride] + x[(2 * i + 2) * stride]) - - (x[(2 * i - 2) * stride] + x[(2 * i + 4) * stride])) / 16; + - ((uint32_t) 9 * (x[2 * i * stride] + x[(2 * i + 2) * stride]) + - (x[(2 * i - 2) * stride] + x[(2 * i + 4) * stride])) / 16; if (k > 1) d[k - 1] = - x[(2 * k - 1) * stride] - (x[(2 * k - 2) * stride] + - x[2 * k * stride]) / 2; + x[(2 * k - 1) * stride] - (x[(2 * k - 2) * stride] + + x[2 * k * stride]) / 2; } else { for (i = 1; i < k - 2; i++) d[i] = x[(2 * i + 1) * stride] - - ((uint32_t) 9 * (x[2 * i * stride] + x[(2 * i + 2) * stride]) - - (x[(2 * i - 2) * stride] + x[(2 * i + 4) * stride])) / 16; + - ((uint32_t) 9 * (x[2 * i * stride] + x[(2 * i + 2) * stride]) + - (x[(2 * i - 2) * stride] + x[(2 * i + 4) * stride])) / 16; if (k > 2) d[k - 2] = x[(2 * k - 3) * stride] - (x[(2 * k - 4) * stride] - + x[(2 * k - 2) * stride]) / 2; + + x[(2 * k - 2) * stride]) / 2; if (k > 1) d[k - 1] = x[(n - 1) * stride] - x[(n - 2) * stride]; } @@ -159,7 +159,7 @@ fwd_synthesize_4 (const TYPE * x, TYPE * s, const TYPE * d, int stride, int n) s[stride] = x[2 * stride] + (d[0] + d[1]) / 4; for (i = 2; i < k - 1; i++) s[i * stride] = x[2 * i * stride] - + ((uint32_t) 9 * (d[i - 1] + d[i]) - (d[i - 2] + d[i + 1])) / 32; + + ((uint32_t) 9 * (d[i - 1] + d[i]) - (d[i - 2] + d[i + 1])) / 32; if (k > 2) s[(k - 1) * stride] = x[(2 * k - 2) * stride] + (d[k - 2] + d[k - 1]) / 4; if (n & 1) @@ -177,19 +177,19 @@ inv_analyze_4 (TYPE * x, const TYPE * d, int stride, int n) if (n & 1) { for (i = 1; i < k - 1; i++) x[(2 * i + 1) * stride] = d[i] - + ((uint32_t) 9 * (x[2 * i * stride] + x[(2 * i + 2) * stride]) - - (x[(2 * i - 2) * stride] + x[(2 * i + 4) * stride])) / 16; + + ((uint32_t) 9 * (x[2 * i * stride] + x[(2 * i + 2) * stride]) + - (x[(2 * i - 2) * stride] + x[(2 * i + 4) * stride])) / 16; if (k > 1) x[(2 * k - 1) * stride] = - d[k - 1] + (x[(2 * k - 2) * stride] + x[2 * k * stride]) / 2; + d[k - 1] + (x[(2 * k - 2) * stride] + x[2 * k * stride]) / 2; } else { for (i = 1; i < k - 2; i++) x[(2 * i + 1) * stride] = d[i] - + (9 * (x[2 * i * stride] + x[(2 * i + 2) * stride]) - - (x[(2 * i - 2) * stride] + x[(2 * i + 4) * stride])) / 16; + + (9 * (x[2 * i * stride] + x[(2 * i + 2) * stride]) + - (x[(2 * i - 2) * stride] + x[(2 * i + 4) * stride])) / 16; if (k > 2) x[(2 * k - 3) * stride] = d[k - 2] + (x[(2 * k - 4) * stride] - + x[(2 * k - 2) * stride]) / 2; + + x[(2 * k - 2) * stride]) / 2; if (k > 1) x[(n - 1) * stride] = d[k - 1] + x[(n - 2) * stride]; } @@ -206,7 +206,7 @@ inv_synthesize_4 (TYPE * x, const TYPE * s, const TYPE * d, int stride, int n) x[2 * stride] = s[1] - (d[0] + d[1]) / 4; for (i = 2; i < k - 1; i++) x[2 * i * stride] = s[i] - ((uint32_t) 9 * (d[i - 1] + d[i]) - - (d[i - 2] + d[i + 1])) / 32; + - (d[i - 2] + d[i + 1])) / 32; if (k > 2) x[(2 * k - 2) * stride] = s[k - 1] - (d[k - 2] + d[k - 1]) / 4; if (n & 1) @@ -333,11 +333,11 @@ wavelet_3d_buf_fwd_xform (Wavelet3DBuf * buf, int a_moments, int s_moments) int row, frame; for (frame = 0; frame < f; frame++) { - for (row = 0; row < h; row++) { - TYPE *data = buf->data + (frame * buf->height + row) * buf->width; + for (row = 0; row < h; row++) { + TYPE *data = buf->data + (frame * buf->height + row) * buf->width; - fwd_xform (buf->scratchbuf, data, 1, w, a_moments, s_moments); - } + fwd_xform (buf->scratchbuf, data, 1, w, a_moments, s_moments); + } } } @@ -345,12 +345,12 @@ wavelet_3d_buf_fwd_xform (Wavelet3DBuf * buf, int a_moments, int s_moments) int col, frame; for (frame = 0; frame < f; frame++) { - for (col = 0; col < w; col++) { - TYPE *data = buf->data + frame * buf->width * buf->height + col; + for (col = 0; col < w; col++) { + TYPE *data = buf->data + frame * buf->width * buf->height + col; - fwd_xform (buf->scratchbuf, data, buf->width, h, - a_moments, s_moments); - } + fwd_xform (buf->scratchbuf, data, buf->width, h, + a_moments, s_moments); + } } } @@ -358,12 +358,12 @@ wavelet_3d_buf_fwd_xform (Wavelet3DBuf * buf, int a_moments, int s_moments) int i, j; for (j = 0; j < h; j++) { - for (i = 0; i < w; i++) { - TYPE *data = buf->data + j * buf->width + i; + for (i = 0; i < w; i++) { + TYPE *data = buf->data + j * buf->width + i; - fwd_xform (buf->scratchbuf, data, buf->width * buf->height, f, - a_moments, s_moments); - } + fwd_xform (buf->scratchbuf, data, buf->width * buf->height, f, + a_moments, s_moments); + } } } } @@ -384,12 +384,12 @@ wavelet_3d_buf_inv_xform (Wavelet3DBuf * buf, int a_moments, int s_moments) int i, j; for (j = 0; j < h; j++) { - for (i = 0; i < w; i++) { - TYPE *data = buf->data + j * buf->width + i; + for (i = 0; i < w; i++) { + TYPE *data = buf->data + j * buf->width + i; - inv_xform (buf->scratchbuf, data, buf->width * buf->height, f, - a_moments, s_moments); - } + inv_xform (buf->scratchbuf, data, buf->width * buf->height, f, + a_moments, s_moments); + } } } @@ -397,12 +397,12 @@ wavelet_3d_buf_inv_xform (Wavelet3DBuf * buf, int a_moments, int s_moments) int col, frame; for (frame = 0; frame < f; frame++) { - for (col = 0; col < w; col++) { - TYPE *data = buf->data + frame * buf->width * buf->height + col; + for (col = 0; col < w; col++) { + TYPE *data = buf->data + frame * buf->width * buf->height + col; - inv_xform (buf->scratchbuf, data, buf->width, h, - a_moments, s_moments); - } + inv_xform (buf->scratchbuf, data, buf->width, h, + a_moments, s_moments); + } } } @@ -410,11 +410,11 @@ wavelet_3d_buf_inv_xform (Wavelet3DBuf * buf, int a_moments, int s_moments) int row, frame; for (frame = 0; frame < f; frame++) { - for (row = 0; row < h; row++) { - TYPE *data = buf->data + (frame * buf->height + row) * buf->width; + for (row = 0; row < h; row++) { + TYPE *data = buf->data + (frame * buf->height + row) * buf->width; - inv_xform (buf->scratchbuf, data, 1, w, a_moments, s_moments); - } + inv_xform (buf->scratchbuf, data, 1, w, a_moments, s_moments); + } } } } diff --git a/ext/xine/xine.c b/ext/xine/xine.c index f1dbb399..8357ff56 100644 --- a/ext/xine/xine.c +++ b/ext/xine/xine.c @@ -72,7 +72,7 @@ gst_xine_change_state (GstElement * element) break; case GST_STATE_READY_TO_NULL: if (xine->stream != NULL) - gst_xine_free_stream (xine); + gst_xine_free_stream (xine); break; default: GST_ERROR_OBJECT (element, "invalid state change"); @@ -107,7 +107,7 @@ gst_xine_get_stream (GstXine * xine) xine->audio_driver = klass->create_audio_driver (xine); xine->video_driver = klass->create_video_driver (xine); xine->stream = - xine_stream_new (klass->xine, xine->audio_driver, xine->video_driver); + xine_stream_new (klass->xine, xine->audio_driver, xine->video_driver); /* FIXME: fail gracefully */ g_assert (xine->stream); diff --git a/ext/xine/xineaudiodec.c b/ext/xine/xineaudiodec.c index 869c3b4d..1d5288bd 100644 --- a/ext/xine/xineaudiodec.c +++ b/ext/xine/xineaudiodec.c @@ -67,7 +67,8 @@ typedef struct xine_ao_driver_t driver; GstXineAudioDec *xine; gboolean open; -} GstXineAudioDriver; +} +GstXineAudioDriver; static guint32 _driver_get_capabilities (xine_ao_driver_t * driver) @@ -152,19 +153,19 @@ _driver_status (xine_ao_driver_t * driver, xine_stream_t * stream, return 0; structure = gst_caps_get_structure (caps, 0); - *bits = 0; /* FIXME */ + *bits = 0; /* FIXME */ if (!gst_structure_get_int (structure, "rate", &temp)) { - g_assert_not_reached (); /* may never happen with negotiated caps */ + g_assert_not_reached (); /* may never happen with negotiated caps */ return 0; } *rate = temp; if (!gst_structure_get_int (structure, "channels", &temp)) { - g_assert_not_reached (); /* may never happen with negotiated caps */ + g_assert_not_reached (); /* may never happen with negotiated caps */ return 0; } *mode = (temp == 2) ? AO_CAP_MODE_STEREO : AO_CAP_MODE_MONO; if (!gst_structure_get_int (structure, "width", &temp)) { - g_assert_not_reached (); /* may never happen with negotiated caps */ + g_assert_not_reached (); /* may never happen with negotiated caps */ return 0; } if (temp == 8) @@ -233,11 +234,11 @@ GST_BOILERPLATE (GstXineAudioDec, gst_xine_audio_dec, GstXine, GST_TYPE_XINE) static void gst_xine_audio_dec_chain (GstPad * pad, GstData * in); static GstElementStateReturn - gst_xine_audio_dec_change_state (GstElement * element); + gst_xine_audio_dec_change_state (GstElement * element); /* this function handles the link with other plug-ins */ static GstPadLinkReturn - gst_xine_audio_dec_sink_link (GstPad * pad, const GstCaps * caps) + gst_xine_audio_dec_sink_link (GstPad * pad, const GstCaps * caps) { guint temp; GstStructure *structure; @@ -255,7 +256,7 @@ GST_BOILERPLATE (GstXineAudioDec, gst_xine_audio_dec, GstXine, GST_TYPE_XINE) xine->wave.nChannels = temp; if (gst_structure_get_int (structure, "rate", &temp)) xine->wave.nSamplesPerSec = temp; - xine->wave.wBitsPerSample = 16; /* FIXME: how do we figure this thing out? */ + xine->wave.wBitsPerSample = 16; /* FIXME: how do we figure this thing out? */ /* FIXME: fill wave header better */ return GST_PAD_LINK_OK; @@ -304,7 +305,7 @@ gst_xine_audio_dec_chain (GstPad * pad, GstData * in) if (xine->format == 0) { /* no caps yet */ GST_ELEMENT_ERROR (xine, CORE, NEGOTIATION, (NULL), - ("buffer sent before doing caps nego")); + ("buffer sent before doing caps nego")); gst_data_unref (in); return; } @@ -329,7 +330,7 @@ gst_xine_audio_dec_chain (GstPad * pad, GstData * in) /* FIXME: qdm2 only right now */ g_assert (gst_pad_get_negotiated_caps (xine->sinkpad)); structure = - gst_caps_get_structure (gst_pad_get_negotiated_caps (xine->sinkpad), 0); + gst_caps_get_structure (gst_pad_get_negotiated_caps (xine->sinkpad), 0); *((guint32 *) & stsd[56]) = GUINT32_TO_BE (12); memcpy (&stsd[60], "frmaQDM2", 8); *((guint32 *) & stsd[68]) = GUINT32_TO_BE (36); @@ -409,7 +410,7 @@ gst_xine_audio_dec_change_state (GstElement * element) case GST_STATE_NULL_TO_READY: xine->decoder = _load_decoder (xine); if (!xine->decoder) - return GST_STATE_FAILURE; + return GST_STATE_FAILURE; break; case GST_STATE_READY_TO_PAUSED: break; @@ -422,7 +423,7 @@ gst_xine_audio_dec_change_state (GstElement * element) case GST_STATE_READY_TO_NULL: xine->setup = FALSE; _x_free_audio_decoder (gst_xine_get_stream (GST_XINE (xine)), - xine->decoder); + xine->decoder); break; default: GST_ERROR_OBJECT (element, "invalid state change"); @@ -439,17 +440,17 @@ static GstStaticPadTemplate src_template = GST_STATIC_PAD_TEMPLATE ("src", GST_PAD_SRC, GST_PAD_ALWAYS, GST_STATIC_CAPS ("audio/x-raw-int, " - "endianness = (int) BYTE_ORDER, " - "signed = (boolean) TRUE, " - "width = (int) 16, " - "depth = (int) 16, " - "rate = (int) [ 1, MAX ], " - "channels = (int) [ 1, 2 ]; " - "audio/x-raw-int, " - "signed = (boolean) FALSE, " - "width = (int) 8, " - "depth = (int) 8, " - "rate = (int) [ 1, MAX ], " "channels = (int) [ 1, 2 ]") + "endianness = (int) BYTE_ORDER, " + "signed = (boolean) TRUE, " + "width = (int) 16, " + "depth = (int) 16, " + "rate = (int) [ 1, MAX ], " + "channels = (int) [ 1, 2 ]; " + "audio/x-raw-int, " + "signed = (boolean) FALSE, " + "width = (int) 8, " + "depth = (int) 8, " + "rate = (int) [ 1, MAX ], " "channels = (int) [ 1, 2 ]") ); static void @@ -483,7 +484,7 @@ gst_xine_audio_dec_subclass_init (gpointer g_class, gpointer class_data) while (dec->supported_types[i] != 0) { const gchar *type_str = - gst_xine_get_caps_for_format (dec->supported_types[i]); + gst_xine_get_caps_for_format (dec->supported_types[i]); if (type_str) { gst_caps_append (caps, gst_caps_from_string (type_str)); } @@ -501,14 +502,14 @@ gst_xine_audio_dec_sub_init (GTypeInstance * instance, gpointer g_class) xine->sinkpad = gst_pad_new_from_template (gst_element_class_get_pad_template (klass, - "sink"), "sink"); + "sink"), "sink"); gst_pad_set_link_function (xine->sinkpad, gst_xine_audio_dec_sink_link); gst_pad_set_chain_function (xine->sinkpad, gst_xine_audio_dec_chain); gst_element_add_pad (GST_ELEMENT (xine), xine->sinkpad); xine->srcpad = gst_pad_new_from_template (gst_element_class_get_pad_template (klass, - "src"), "src"); + "src"), "src"); gst_pad_use_explicit_caps (xine->srcpad); gst_element_add_pad (GST_ELEMENT (xine), xine->srcpad); } @@ -545,26 +546,26 @@ gst_xine_audio_dec_init_plugin (GstPlugin * plugin) dec = node->info->special_info; while (dec->supported_types[format] != 0) { const gchar *caps = - gst_xine_get_caps_for_format (dec->supported_types[format]); + gst_xine_get_caps_for_format (dec->supported_types[format]); if (caps) { - gchar *plugin_name = - g_strdup_printf ("xineaudiodec_%s", node->info->id); - gchar *type_name = - g_strdup_printf ("GstXineAudioDec%s", node->info->id); - GType type; - - plugin_info.class_data = node; - type = - g_type_register_static (GST_TYPE_XINE_AUDIO_DEC, type_name, - &plugin_info, 0); - g_free (type_name); - if (!gst_element_register (plugin, plugin_name, - MAX (GST_RANK_MARGINAL, - GST_RANK_MARGINAL * dec->priority / 10 + 1), type)) { - g_free (plugin_name); - return FALSE; - } - g_free (plugin_name); + gchar *plugin_name = + g_strdup_printf ("xineaudiodec_%s", node->info->id); + gchar *type_name = + g_strdup_printf ("GstXineAudioDec%s", node->info->id); + GType type; + + plugin_info.class_data = node; + type = + g_type_register_static (GST_TYPE_XINE_AUDIO_DEC, type_name, + &plugin_info, 0); + g_free (type_name); + if (!gst_element_register (plugin, plugin_name, + MAX (GST_RANK_MARGINAL, + GST_RANK_MARGINAL * dec->priority / 10 + 1), type)) { + g_free (plugin_name); + return FALSE; + } + g_free (plugin_name); } format++; } diff --git a/ext/xine/xineaudiosink.c b/ext/xine/xineaudiosink.c index 4638526d..64c5e6f8 100644 --- a/ext/xine/xineaudiosink.c +++ b/ext/xine/xineaudiosink.c @@ -48,7 +48,7 @@ struct _GstXineAudioSink GstPad *sinkpad; ao_driver_t *driver; - guint open; /* number of bytes per sample or 0 if driver not open */ + guint open; /* number of bytes per sample or 0 if driver not open */ }; struct _GstXineAudioSinkClass @@ -63,7 +63,7 @@ struct _GstXineAudioSinkClass GST_BOILERPLATE (GstXineAudioSink, gst_xine_audio_sink, GstXine, GST_TYPE_XINE) static GstElementStateReturn - gst_xine_audio_sink_change_state (GstElement * element); + gst_xine_audio_sink_change_state (GstElement * element); static void gst_xine_audio_sink_base_init (gpointer g_class) { @@ -89,7 +89,7 @@ gst_xine_audio_sink_chain (GstPad * pad, GstData * data) GST_XINE_AUDIO_SINK (gst_object_get_parent (GST_OBJECT (pad))); while (xine->driver->write (xine->driver, (guint16 *) GST_BUFFER_DATA (data), - GST_BUFFER_SIZE (data) / xine->open) == 0); + GST_BUFFER_SIZE (data) / xine->open) == 0); gst_data_unref (GST_DATA (data)); } @@ -104,22 +104,22 @@ gst_xine_audio_sink_change_state (GstElement * element) switch (GST_STATE_TRANSITION (element)) { case GST_STATE_NULL_TO_READY: if (driver == NULL) { - xine_audio_port_t *port = - xine_open_audio_driver (GST_XINE_GET_CLASS (xine)->xine, - GST_XINE_AUDIO_SINK_GET_CLASS (xine)->plugin_node->info->id, NULL); - - if (!port) - return GST_STATE_FAILURE; - port->exit (port); - driver = - (audio_driver_class_t *) GST_XINE_AUDIO_SINK_GET_CLASS (xine)-> - plugin_node->plugin_class; - if (driver == NULL) - return GST_STATE_FAILURE; + xine_audio_port_t *port = + xine_open_audio_driver (GST_XINE_GET_CLASS (xine)->xine, + GST_XINE_AUDIO_SINK_GET_CLASS (xine)->plugin_node->info->id, NULL); + + if (!port) + return GST_STATE_FAILURE; + port->exit (port); + driver = + (audio_driver_class_t *) GST_XINE_AUDIO_SINK_GET_CLASS (xine)-> + plugin_node->plugin_class; + if (driver == NULL) + return GST_STATE_FAILURE; } xine->driver = driver->open_plugin (driver, NULL); if (!xine->driver) - return GST_STATE_FAILURE; + return GST_STATE_FAILURE; break; case GST_STATE_READY_TO_PAUSED: break; @@ -129,7 +129,7 @@ gst_xine_audio_sink_change_state (GstElement * element) break; case GST_STATE_PAUSED_TO_READY: if (xine->open != 0) - xine->driver->close (xine->driver); + xine->driver->close (xine->driver); xine->open = 0; break; case GST_STATE_READY_TO_NULL: @@ -169,31 +169,31 @@ _xine_audio_sink_get_caps (GstPad * pad) do { if (capa & AO_CAP_8BITS) { caps = gst_caps_from_string ("audio/x-raw-int, " - "signed = (boolean) FALSE, " - "width = (int) 8, " - "depth = (int) 8, " "rate = (int) [ 8000, 192000 ]"); + "signed = (boolean) FALSE, " + "width = (int) 8, " + "depth = (int) 8, " "rate = (int) [ 8000, 192000 ]"); capa &= ~AO_CAP_8BITS; } else { caps = gst_caps_from_string ("audio/x-raw-int, " - "endianness = (int) BYTE_ORDER, " - "signed = (boolean) TRUE, " - "width = (int) 16, " - "depth = (int) 16, " "rate = (int) [ 8000, 192000 ]"); + "endianness = (int) BYTE_ORDER, " + "signed = (boolean) TRUE, " + "width = (int) 16, " + "depth = (int) 16, " "rate = (int) [ 8000, 192000 ]"); capa = -1; } switch (channels) { case AO_CAP_MODE_MONO | AO_CAP_MODE_STEREO: - gst_caps_set_simple (caps, "channels", GST_TYPE_INT_RANGE, 1, 2, NULL); - break; + gst_caps_set_simple (caps, "channels", GST_TYPE_INT_RANGE, 1, 2, NULL); + break; case AO_CAP_MODE_MONO: - gst_caps_set_simple (caps, "channels", G_TYPE_INT, 1, NULL); - break; + gst_caps_set_simple (caps, "channels", G_TYPE_INT, 1, NULL); + break; case AO_CAP_MODE_STEREO: - gst_caps_set_simple (caps, "channels", G_TYPE_INT, 2, NULL); - break; + gst_caps_set_simple (caps, "channels", G_TYPE_INT, 2, NULL); + break; default: - g_assert_not_reached (); - break; + g_assert_not_reached (); + break; } gst_caps_append (ret, caps); } while (capa != -1); @@ -229,7 +229,7 @@ _xine_audio_sink_link (GstPad * pad, const GstCaps * caps) if (temp != rate) { /* FIXME? */ GST_WARNING_OBJECT (xine, "rates don't match (requested: %u, got %u)", rate, - temp); + temp); } return GST_PAD_LINK_OK; @@ -241,17 +241,17 @@ static GstStaticPadTemplate sink_template = GST_STATIC_PAD_TEMPLATE ("sink", GST_PAD_SINK, GST_PAD_ALWAYS, GST_STATIC_CAPS ("audio/x-raw-int, " - "signed = (boolean) FALSE, " - "width = (int) 8, " - "depth = (int) 8, " - "rate = (int) [ 8000, 192000 ], " - "channels = (int) [1, 2]; " - "audio/x-raw-int, " - "endianness = (int) BYTE_ORDER, " - "signed = (boolean) TRUE, " - "width = (int) 16, " - "depth = (int) 16, " - "rate = (int) [ 8000, 192000 ], " "channels = (int) [1, 2]") + "signed = (boolean) FALSE, " + "width = (int) 8, " + "depth = (int) 8, " + "rate = (int) [ 8000, 192000 ], " + "channels = (int) [1, 2]; " + "audio/x-raw-int, " + "endianness = (int) BYTE_ORDER, " + "signed = (boolean) TRUE, " + "width = (int) 16, " + "depth = (int) 16, " + "rate = (int) [ 8000, 192000 ], " "channels = (int) [1, 2]") ); static void @@ -286,7 +286,7 @@ gst_xine_audio_sink_sub_init (GTypeInstance * instance, gpointer g_class) xine->sinkpad = gst_pad_new_from_template (gst_element_class_get_pad_template (klass, - "sink"), "sink"); + "sink"), "sink"); gst_pad_set_chain_function (xine->sinkpad, gst_xine_audio_sink_chain); gst_pad_set_getcaps_function (xine->sinkpad, _xine_audio_sink_get_caps); gst_pad_set_link_function (xine->sinkpad, _xine_audio_sink_link); @@ -320,8 +320,8 @@ gst_xine_audio_sink_init_plugin (GstPlugin * plugin) plugin_info.class_data = node; type = - g_type_register_static (GST_TYPE_XINE_AUDIO_SINK, type_name, - &plugin_info, 0); + g_type_register_static (GST_TYPE_XINE_AUDIO_SINK, type_name, + &plugin_info, 0); g_free (type_name); if (!gst_element_register (plugin, plugin_name, GST_RANK_MARGINAL, type)) { g_free (plugin_name); diff --git a/ext/xine/xineinput.c b/ext/xine/xineinput.c index 19a4bbbe..35aa1dca 100644 --- a/ext/xine/xineinput.c +++ b/ext/xine/xineinput.c @@ -75,7 +75,7 @@ GST_BOILERPLATE (GstXineInput, gst_xine_input, GstXine, GST_TYPE_XINE) static void gst_xine_input_get_property (GObject * object, guint prop_id, GValue * value, GParamSpec * pspec); static GstElementStateReturn - gst_xine_input_change_state (GstElement * element); + gst_xine_input_change_state (GstElement * element); static void gst_xine_input_base_init (gpointer g_class) { @@ -95,7 +95,7 @@ gst_xine_input_class_init (GstXineInputClass * klass) g_object_class_install_property (object, ARG_LOCATION, g_param_spec_string ("location", "location", "location", - NULL, G_PARAM_READWRITE)); + NULL, G_PARAM_READWRITE)); } static void @@ -123,9 +123,9 @@ gst_xine_input_set_property (GObject * object, guint prop_id, switch (prop_id) { case ARG_LOCATION: if (gst_element_get_state (GST_ELEMENT (xine)) != GST_STATE_NULL) - return; + return; if (xine->location) - g_free (xine->location); + g_free (xine->location); xine->location = g_strdup (g_value_get_string (value)); break; default: @@ -150,7 +150,7 @@ gst_xine_input_get_property (GObject * object, guint prop_id, GValue * value, } } -#define BUFFER_SIZE 4096 /* FIXME: what size? */ +#define BUFFER_SIZE 4096 /* FIXME: what size? */ static GstData * gst_xine_input_get (GstPad * pad) { @@ -176,7 +176,7 @@ gst_xine_input_get (GstPad * pad) GST_BUFFER_SIZE (buf) = real_size; if (real_size < 0) { GST_ELEMENT_ERROR (xine, RESOURCE, READ, (NULL), ("error %d reading data", - real_size)); + real_size)); gst_data_unref (GST_DATA (buf)); return NULL; } else if (real_size == 0) { @@ -184,8 +184,8 @@ gst_xine_input_get (GstPad * pad) if (xine->input->get_capabilities (xine->input) & INPUT_CAP_BLOCK) element = - xine->input->read_block (xine->input, - gst_xine_get_stream (GST_XINE (xine))->audio_fifo, xine->blocksize); + xine->input->read_block (xine->input, + gst_xine_get_stream (GST_XINE (xine))->audio_fifo, xine->blocksize); if (element == NULL) { /* FIXME: is this EOS? */ gst_element_set_eos (GST_ELEMENT (xine)); @@ -213,15 +213,15 @@ gst_xine_input_change_state (GstElement * element) switch (GST_STATE_TRANSITION (element)) { case GST_STATE_NULL_TO_READY: xine->input = - input->get_instance (input, gst_xine_get_stream (GST_XINE (xine)), - xine->location); + input->get_instance (input, gst_xine_get_stream (GST_XINE (xine)), + xine->location); if (!xine->input) - return GST_STATE_FAILURE; + return GST_STATE_FAILURE; if (xine->input->open (xine->input) == 0) - return GST_STATE_FAILURE; + return GST_STATE_FAILURE; xine->blocksize = xine->input->get_blocksize (xine->input); if (xine->blocksize == 0) - xine->blocksize = BUFFER_SIZE; + xine->blocksize = BUFFER_SIZE; break; case GST_STATE_READY_TO_PAUSED: break; @@ -256,10 +256,10 @@ static GstStaticPadTemplate cdda_template = GST_STATIC_PAD_TEMPLATE ("src", GST_PAD_SRC, GST_PAD_ALWAYS, GST_STATIC_CAPS ("audio/x-raw-int, " - "endianness = (int) LITTLE_ENDIAN, " - "signed = (boolean) true, " - "width = (int) 16, " - "depth = (int) 16, " "rate = (int) 44100, " "channels = (int) 2") + "endianness = (int) LITTLE_ENDIAN, " + "signed = (boolean) true, " + "width = (int) 16, " + "depth = (int) 16, " "rate = (int) 44100, " "channels = (int) 2") ); static void @@ -285,10 +285,10 @@ gst_xine_input_subclass_init (gpointer g_class, gpointer class_data) /* FIXME: this is pretty hackish, anyone knows a better idea (xine doesn't) */ if (strcmp (input->get_identifier (input), "cdda") == 0) { gst_element_class_add_pad_template (element_class, - gst_static_pad_template_get (&cdda_template)); + gst_static_pad_template_get (&cdda_template)); } else { gst_element_class_add_pad_template (element_class, - gst_static_pad_template_get (&any_template)); + gst_static_pad_template_get (&any_template)); } } @@ -300,7 +300,7 @@ gst_xine_input_sub_init (GTypeInstance * instance, gpointer g_class) xine->srcpad = gst_pad_new_from_template (gst_element_class_get_pad_template (klass, - "src"), "src"); + "src"), "src"); gst_pad_set_get_function (xine->srcpad, gst_xine_input_get); gst_element_add_pad (GST_ELEMENT (xine), xine->srcpad); } @@ -332,8 +332,8 @@ gst_xine_input_init_plugin (GstPlugin * plugin) plugin_info.class_data = node; type = - g_type_register_static (GST_TYPE_XINE_INPUT, type_name, &plugin_info, - 0); + g_type_register_static (GST_TYPE_XINE_INPUT, type_name, &plugin_info, + 0); g_free (type_name); if (!gst_element_register (plugin, plugin_name, GST_RANK_MARGINAL, type)) { g_free (plugin_name); diff --git a/ext/xvid/gstxvid.c b/ext/xvid/gstxvid.c index 1e22dbfd..d09489eb 100644 --- a/ext/xvid/gstxvid.c +++ b/ext/xvid/gstxvid.c @@ -99,30 +99,30 @@ gst_xvid_structure_to_csp (GstStructure * structure, gst_structure_get_fourcc (structure, "format", &fourcc); switch (fourcc) { case GST_MAKE_FOURCC ('I', '4', '2', '0'): - xvid_cs = XVID_CSP_I420; - stride = w; - bpp = 12; - break; + xvid_cs = XVID_CSP_I420; + stride = w; + bpp = 12; + break; case GST_MAKE_FOURCC ('Y', 'U', 'Y', '2'): - xvid_cs = XVID_CSP_YUY2; - stride = w * 2; - bpp = 16; - break; + xvid_cs = XVID_CSP_YUY2; + stride = w * 2; + bpp = 16; + break; case GST_MAKE_FOURCC ('Y', 'V', '1', '2'): - xvid_cs = XVID_CSP_YV12; - stride = w; - bpp = 12; - break; + xvid_cs = XVID_CSP_YV12; + stride = w; + bpp = 12; + break; case GST_MAKE_FOURCC ('U', 'Y', 'V', 'Y'): - xvid_cs = XVID_CSP_UYVY; - stride = w * 2; - bpp = 16; - break; + xvid_cs = XVID_CSP_UYVY; + stride = w * 2; + bpp = 16; + break; case GST_MAKE_FOURCC ('Y', 'V', 'Y', 'U'): - xvid_cs = XVID_CSP_YVYU; - stride = w * 2; - bpp = 16; - break; + xvid_cs = XVID_CSP_YVYU; + stride = w * 2; + bpp = 16; + break; } } else { gint depth, r_mask; @@ -133,35 +133,35 @@ gst_xvid_structure_to_csp (GstStructure * structure, switch (depth) { case 15: - xvid_cs = XVID_CSP_RGB555; - break; + xvid_cs = XVID_CSP_RGB555; + break; case 16: - xvid_cs = XVID_CSP_RGB565; - break; + xvid_cs = XVID_CSP_RGB565; + break; case 24: - if (bpp == 24) { - xvid_cs = XVID_CSP_BGR; - } else { - switch (r_mask) { - case 0xff000000: - xvid_cs = XVID_CSP_RGBA; - break; + if (bpp == 24) { + xvid_cs = XVID_CSP_BGR; + } else { + switch (r_mask) { + case 0xff000000: + xvid_cs = XVID_CSP_RGBA; + break; #ifdef XVID_CSP_ARGB - case 0x00ff0000: - xvid_cs = XVID_CSP_ARGB; - break; + case 0x00ff0000: + xvid_cs = XVID_CSP_ARGB; + break; #endif - case 0x0000ff00: - xvid_cs = XVID_CSP_BGRA; - break; - case 0x000000ff: - xvid_cs = XVID_CSP_ABGR; - break; - } - } - break; + case 0x0000ff00: + xvid_cs = XVID_CSP_BGRA; + break; + case 0x000000ff: + xvid_cs = XVID_CSP_ABGR; + break; + } + } + break; default: - break; + break; } stride = w * bpp / 8; @@ -191,79 +191,79 @@ gst_xvid_csp_to_caps (gint csp, gint w, gint h, gdouble fps) #endif case XVID_CSP_RGBA:{ gint r_mask = 0, b_mask = 0, g_mask = 0, - endianness = 0, bpp = 0, depth = 0; + endianness = 0, bpp = 0, depth = 0; switch (csp) { - case XVID_CSP_RGB555: - r_mask = GST_VIDEO_RED_MASK_15_INT; - g_mask = GST_VIDEO_GREEN_MASK_15_INT; - b_mask = GST_VIDEO_BLUE_MASK_15_INT; - endianness = G_BYTE_ORDER; - depth = 15; - bpp = 16; - break; - case XVID_CSP_RGB565: - r_mask = GST_VIDEO_RED_MASK_16_INT; - g_mask = GST_VIDEO_GREEN_MASK_16_INT; - b_mask = GST_VIDEO_BLUE_MASK_16_INT; - endianness = G_BYTE_ORDER; - depth = 16; - bpp = 16; - break; - case XVID_CSP_BGR: - r_mask = 0x0000ff; - g_mask = 0x00ff00; - b_mask = 0xff0000; - endianness = G_BIG_ENDIAN; - depth = 24; - bpp = 24; - break; - case XVID_CSP_ABGR: - r_mask = 0x000000ff; - g_mask = 0x0000ff00; - b_mask = 0x00ff0000; - endianness = G_BIG_ENDIAN; - depth = 24; - bpp = 32; - break; - case XVID_CSP_BGRA: - r_mask = 0x0000ff00; - g_mask = 0x00ff0000; - b_mask = 0xff000000; - endianness = G_BIG_ENDIAN; - depth = 24; - bpp = 32; - break; + case XVID_CSP_RGB555: + r_mask = GST_VIDEO_RED_MASK_15_INT; + g_mask = GST_VIDEO_GREEN_MASK_15_INT; + b_mask = GST_VIDEO_BLUE_MASK_15_INT; + endianness = G_BYTE_ORDER; + depth = 15; + bpp = 16; + break; + case XVID_CSP_RGB565: + r_mask = GST_VIDEO_RED_MASK_16_INT; + g_mask = GST_VIDEO_GREEN_MASK_16_INT; + b_mask = GST_VIDEO_BLUE_MASK_16_INT; + endianness = G_BYTE_ORDER; + depth = 16; + bpp = 16; + break; + case XVID_CSP_BGR: + r_mask = 0x0000ff; + g_mask = 0x00ff00; + b_mask = 0xff0000; + endianness = G_BIG_ENDIAN; + depth = 24; + bpp = 24; + break; + case XVID_CSP_ABGR: + r_mask = 0x000000ff; + g_mask = 0x0000ff00; + b_mask = 0x00ff0000; + endianness = G_BIG_ENDIAN; + depth = 24; + bpp = 32; + break; + case XVID_CSP_BGRA: + r_mask = 0x0000ff00; + g_mask = 0x00ff0000; + b_mask = 0xff000000; + endianness = G_BIG_ENDIAN; + depth = 24; + bpp = 32; + break; #ifdef XVID_CSP_ARGB - case XVID_CSP_ARGB: - r_mask = 0x00ff0000; - g_mask = 0x0000ff00; - b_mask = 0x000000ff; - endianness = G_BIG_ENDIAN; - depth = 24; - bpp = 32; - break; + case XVID_CSP_ARGB: + r_mask = 0x00ff0000; + g_mask = 0x0000ff00; + b_mask = 0x000000ff; + endianness = G_BIG_ENDIAN; + depth = 24; + bpp = 32; + break; #endif - case XVID_CSP_RGBA: - r_mask = 0xff000000; - g_mask = 0x00ff0000; - b_mask = 0x0000ff00; - endianness = G_BIG_ENDIAN; - depth = 24; - bpp = 32; - break; + case XVID_CSP_RGBA: + r_mask = 0xff000000; + g_mask = 0x00ff0000; + b_mask = 0x0000ff00; + endianness = G_BIG_ENDIAN; + depth = 24; + bpp = 32; + break; } caps = gst_caps_new_simple ("video/x-raw-rgb", - "width", G_TYPE_INT, w, - "height", G_TYPE_INT, h, - "depth", G_TYPE_INT, depth, - "bpp", G_TYPE_INT, bpp, - "endianness", G_TYPE_INT, endianness, - "red_mask", G_TYPE_INT, r_mask, - "green_mask", G_TYPE_INT, g_mask, - "blue_mask", G_TYPE_INT, b_mask, - "framerate", G_TYPE_DOUBLE, fps, NULL); + "width", G_TYPE_INT, w, + "height", G_TYPE_INT, h, + "depth", G_TYPE_INT, depth, + "bpp", G_TYPE_INT, bpp, + "endianness", G_TYPE_INT, endianness, + "red_mask", G_TYPE_INT, r_mask, + "green_mask", G_TYPE_INT, g_mask, + "blue_mask", G_TYPE_INT, b_mask, + "framerate", G_TYPE_DOUBLE, fps, NULL); break; } @@ -275,28 +275,28 @@ gst_xvid_csp_to_caps (gint csp, gint w, gint h, gdouble fps) guint32 fourcc = 0; switch (csp) { - case XVID_CSP_YUY2: - fourcc = GST_MAKE_FOURCC ('Y', 'U', 'Y', '2'); - break; - case XVID_CSP_YVYU: - fourcc = GST_MAKE_FOURCC ('Y', 'V', 'Y', 'U'); - break; - case XVID_CSP_UYVY: - fourcc = GST_MAKE_FOURCC ('U', 'Y', 'V', 'Y'); - break; - case XVID_CSP_I420: - fourcc = GST_MAKE_FOURCC ('I', '4', '2', '0'); - break; - case XVID_CSP_YV12: - fourcc = GST_MAKE_FOURCC ('Y', 'V', '1', '2'); - break; + case XVID_CSP_YUY2: + fourcc = GST_MAKE_FOURCC ('Y', 'U', 'Y', '2'); + break; + case XVID_CSP_YVYU: + fourcc = GST_MAKE_FOURCC ('Y', 'V', 'Y', 'U'); + break; + case XVID_CSP_UYVY: + fourcc = GST_MAKE_FOURCC ('U', 'Y', 'V', 'Y'); + break; + case XVID_CSP_I420: + fourcc = GST_MAKE_FOURCC ('I', '4', '2', '0'); + break; + case XVID_CSP_YV12: + fourcc = GST_MAKE_FOURCC ('Y', 'V', '1', '2'); + break; } caps = gst_caps_new_simple ("video/x-raw-yuv", - "width", G_TYPE_INT, w, - "height", G_TYPE_INT, h, - "format", GST_TYPE_FOURCC, fourcc, - "framerate", G_TYPE_DOUBLE, fps, NULL); + "width", G_TYPE_INT, w, + "height", G_TYPE_INT, h, + "format", GST_TYPE_FOURCC, fourcc, + "framerate", G_TYPE_DOUBLE, fps, NULL); break; } } @@ -309,9 +309,9 @@ static gboolean plugin_init (GstPlugin * plugin) { return (gst_element_register (plugin, "xvidenc", - GST_RANK_NONE, GST_TYPE_XVIDENC) && + GST_RANK_NONE, GST_TYPE_XVIDENC) && gst_element_register (plugin, "xviddec", - GST_RANK_SECONDARY, GST_TYPE_XVIDDEC)); + GST_RANK_SECONDARY, GST_TYPE_XVIDDEC)); } GST_PLUGIN_DEFINE (GST_VERSION_MAJOR, diff --git a/ext/xvid/gstxviddec.c b/ext/xvid/gstxviddec.c index cab1a027..49c9d6ef 100644 --- a/ext/xvid/gstxviddec.c +++ b/ext/xvid/gstxviddec.c @@ -39,20 +39,20 @@ static GstStaticPadTemplate sink_template = GST_STATIC_PAD_TEMPLATE ("sink", GST_PAD_SINK, GST_PAD_ALWAYS, GST_STATIC_CAPS ("video/x-xvid, " - "width = (int) [ 0, MAX ], " - "height = (int) [ 0, MAX ], " "framerate = (double) [ 0, MAX ]") + "width = (int) [ 0, MAX ], " + "height = (int) [ 0, MAX ], " "framerate = (double) [ 0, MAX ]") ); static GstStaticPadTemplate src_template = GST_STATIC_PAD_TEMPLATE ("src", GST_PAD_SRC, GST_PAD_ALWAYS, GST_STATIC_CAPS (GST_VIDEO_CAPS_YUV ("{ I420, YUY2, YV12, YVYU, UYVY }") - "; " RGB_24_32_STATIC_CAPS (32, 0x00ff0000, 0x0000ff00, - 0x000000ff) "; " RGB_24_32_STATIC_CAPS (32, 0xff000000, 0x00ff0000, - 0x0000ff00) "; " RGB_24_32_STATIC_CAPS (32, 0x0000ff00, 0x00ff0000, - 0xff000000) "; " RGB_24_32_STATIC_CAPS (32, 0x000000ff, 0x0000ff00, - 0x00ff0000) "; " RGB_24_32_STATIC_CAPS (24, 0x0000ff, 0x00ff00, - 0xff0000) "; " GST_VIDEO_CAPS_RGB_15 "; " GST_VIDEO_CAPS_RGB_16) + "; " RGB_24_32_STATIC_CAPS (32, 0x00ff0000, 0x0000ff00, + 0x000000ff) "; " RGB_24_32_STATIC_CAPS (32, 0xff000000, 0x00ff0000, + 0x0000ff00) "; " RGB_24_32_STATIC_CAPS (32, 0x0000ff00, 0x00ff0000, + 0xff000000) "; " RGB_24_32_STATIC_CAPS (32, 0x000000ff, 0x0000ff00, + 0x00ff0000) "; " RGB_24_32_STATIC_CAPS (24, 0x0000ff, 0x00ff00, + 0xff0000) "; " GST_VIDEO_CAPS_RGB_15 "; " GST_VIDEO_CAPS_RGB_16) ); @@ -103,8 +103,9 @@ gst_xviddec_get_type (void) 0, (GInstanceInitFunc) gst_xviddec_init, }; + xviddec_type = g_type_register_static (GST_TYPE_ELEMENT, - "GstXvidDec", &xviddec_info, 0); + "GstXvidDec", &xviddec_info, 0); } return xviddec_type; } @@ -187,9 +188,9 @@ gst_xviddec_setup (GstXvidDec * xviddec) if ((ret = xvid_decore (NULL, XVID_DEC_CREATE, &xdec, NULL)) < 0) { GST_ELEMENT_ERROR (xviddec, LIBRARY, SETTINGS, (NULL), - ("Setting parameters %dx%d@%d failed: %s (%d)", - xviddec->width, xviddec->height, xviddec->csp, - gst_xvid_error (ret), ret)); + ("Setting parameters %dx%d@%d failed: %s (%d)", + xviddec->width, xviddec->height, xviddec->csp, + gst_xvid_error (ret), ret)); return FALSE; } @@ -213,7 +214,7 @@ gst_xviddec_chain (GstPad * pad, GstData * _data) if (!xviddec->handle) { GST_ELEMENT_ERROR (xviddec, CORE, NEGOTIATION, (NULL), - ("format wasn't negotiated before chain function")); + ("format wasn't negotiated before chain function")); gst_buffer_unref (buf); return; } @@ -234,9 +235,9 @@ gst_xviddec_chain (GstPad * pad, GstData * _data) if (xviddec->width == xviddec->stride) { xframe.output.plane[0] = GST_BUFFER_DATA (outbuf); xframe.output.plane[1] = - xframe.output.plane[0] + (xviddec->width * xviddec->height); + xframe.output.plane[0] + (xviddec->width * xviddec->height); xframe.output.plane[2] = - xframe.output.plane[1] + (xviddec->width * xviddec->height / 4); + xframe.output.plane[1] + (xviddec->width * xviddec->height / 4); xframe.output.stride[0] = xviddec->width; xframe.output.stride[1] = xviddec->width / 2; xframe.output.stride[2] = xviddec->width / 2; @@ -247,7 +248,7 @@ gst_xviddec_chain (GstPad * pad, GstData * _data) if ((ret = xvid_decore (xviddec->handle, XVID_DEC_DECODE, &xframe, NULL)) < 0) { GST_ELEMENT_ERROR (xviddec, STREAM, DECODE, (NULL), - ("Error decoding xvid frame: %s (%d)\n", gst_xvid_error (ret), ret)); + ("Error decoding xvid frame: %s (%d)\n", gst_xvid_error (ret), ret)); gst_buffer_unref (buf); gst_buffer_unref (outbuf); return; @@ -289,7 +290,7 @@ gst_xviddec_src_getcaps (GstPad * pad) caps = gst_caps_new_empty (); for (i = 0; csp[i] != 0; i++) { GstCaps *one = gst_xvid_csp_to_caps (csp[i], xviddec->width, - xviddec->height, xviddec->fps); + xviddec->height, xviddec->fps); gst_caps_append (caps, one); } @@ -350,13 +351,13 @@ gst_xviddec_sink_link (GstPad * pad, const GstCaps * vscaps) for (i = 0; i < gst_caps_get_size (vscaps); i++) { csp = gst_xvid_structure_to_csp (gst_caps_get_structure (vscaps, i), - 0, NULL, NULL); + 0, NULL, NULL); new = - gst_xvid_csp_to_caps (csp, xviddec->width, xviddec->height, - xviddec->fps); + gst_xvid_csp_to_caps (csp, xviddec->width, xviddec->height, + xviddec->fps); ret = gst_pad_try_set_caps (xviddec->srcpad, new); if (ret != GST_PAD_LINK_REFUSED) - return ret; + return ret; } return GST_PAD_LINK_REFUSED; @@ -373,7 +374,7 @@ gst_xviddec_change_state (GstElement * element) switch (GST_STATE_PENDING (element)) { case GST_STATE_PAUSED_TO_READY: if (xviddec->handle) { - gst_xviddec_unset (xviddec); + gst_xviddec_unset (xviddec); } break; default: diff --git a/ext/xvid/gstxvidenc.c b/ext/xvid/gstxvidenc.c index 5a9b34ba..db9d1add 100644 --- a/ext/xvid/gstxvidenc.c +++ b/ext/xvid/gstxvidenc.c @@ -40,20 +40,20 @@ static GstStaticPadTemplate sink_template = GST_STATIC_PAD_TEMPLATE ("sink", GST_PAD_SINK, GST_PAD_ALWAYS, GST_STATIC_CAPS (GST_VIDEO_CAPS_YUV ("{ I420, YUY2, YV12, YVYU, UYVY }") - "; " RGB_24_32_STATIC_CAPS (32, 0x00ff0000, 0x0000ff00, - 0x000000ff) "; " RGB_24_32_STATIC_CAPS (32, 0xff000000, 0x00ff0000, - 0x0000ff00) "; " RGB_24_32_STATIC_CAPS (32, 0x0000ff00, 0x00ff0000, - 0xff000000) "; " RGB_24_32_STATIC_CAPS (32, 0x000000ff, 0x0000ff00, - 0x00ff0000) "; " RGB_24_32_STATIC_CAPS (24, 0x0000ff, 0x00ff00, - 0xff0000) "; " GST_VIDEO_CAPS_RGB_15 "; " GST_VIDEO_CAPS_RGB_16) + "; " RGB_24_32_STATIC_CAPS (32, 0x00ff0000, 0x0000ff00, + 0x000000ff) "; " RGB_24_32_STATIC_CAPS (32, 0xff000000, 0x00ff0000, + 0x0000ff00) "; " RGB_24_32_STATIC_CAPS (32, 0x0000ff00, 0x00ff0000, + 0xff000000) "; " RGB_24_32_STATIC_CAPS (32, 0x000000ff, 0x0000ff00, + 0x00ff0000) "; " RGB_24_32_STATIC_CAPS (24, 0x0000ff, 0x00ff00, + 0xff0000) "; " GST_VIDEO_CAPS_RGB_15 "; " GST_VIDEO_CAPS_RGB_16) ); static GstStaticPadTemplate src_template = GST_STATIC_PAD_TEMPLATE ("src", GST_PAD_SRC, GST_PAD_ALWAYS, GST_STATIC_CAPS ("video/x-xvid, " - "width = (int) [ 0, MAX ], " - "height = (int) [ 0, MAX ], " "framerate = (double) [ 0.0, MAX ]") + "width = (int) [ 0, MAX ], " + "height = (int) [ 0, MAX ], " "framerate = (double) [ 0.0, MAX ]") ); @@ -111,13 +111,13 @@ gst_xvidenc_profile_get_type (void) {XVID_PROFILE_S_L2, "S_L2", "Simple profile, L2"}, {XVID_PROFILE_S_L3, "S_L3", "Simple profile, L3"}, {XVID_PROFILE_ARTS_L1, "ARTS_L1", - "Advanced real-time simple profile, L1"}, + "Advanced real-time simple profile, L1"}, {XVID_PROFILE_ARTS_L2, "ARTS_L2", - "Advanced real-time simple profile, L2"}, + "Advanced real-time simple profile, L2"}, {XVID_PROFILE_ARTS_L3, "ARTS_L3", - "Advanced real-time simple profile, L3"}, + "Advanced real-time simple profile, L3"}, {XVID_PROFILE_ARTS_L4, "ARTS_L4", - "Advanced real-time simple profile, L4"}, + "Advanced real-time simple profile, L4"}, {XVID_PROFILE_AS_L0, "AS_L0", "Advanced simple profile, L0"}, {XVID_PROFILE_AS_L1, "AS_L1", "Advanced simple profile, L1"}, {XVID_PROFILE_AS_L2, "AS_L2", "Advanced simple profile, L2"}, @@ -127,7 +127,7 @@ gst_xvidenc_profile_get_type (void) }; xvidenc_profile_type = - g_enum_register_static ("GstXvidEncProfiles", xvidenc_profiles); + g_enum_register_static ("GstXvidEncProfiles", xvidenc_profiles); } return xvidenc_profile_type; @@ -150,8 +150,9 @@ gst_xvidenc_get_type (void) 0, (GInstanceInitFunc) gst_xvidenc_init, }; + xvidenc_type = g_type_register_static (GST_TYPE_ELEMENT, - "GstXvidEnc", &xvidenc_info, 0); + "GstXvidEnc", &xvidenc_info, 0); } return xvidenc_type; } @@ -182,22 +183,22 @@ gst_xvidenc_class_init (GstXvidEncClass * klass) /* encoding profile */ g_object_class_install_property (gobject_class, ARG_PROFILE, g_param_spec_enum ("profile", "Profile", "XviD/MPEG-4 encoding profile", - GST_TYPE_XVIDENC_PROFILE, XVID_PROFILE_S_L0, G_PARAM_READWRITE)); + GST_TYPE_XVIDENC_PROFILE, XVID_PROFILE_S_L0, G_PARAM_READWRITE)); /* bitrate */ g_object_class_install_property (gobject_class, ARG_BITRATE, g_param_spec_int ("bitrate", "Bitrate", - "Target video bitrate (kbps)", 0, G_MAXINT, 512, G_PARAM_READWRITE)); + "Target video bitrate (kbps)", 0, G_MAXINT, 512, G_PARAM_READWRITE)); /* keyframe interval */ g_object_class_install_property (gobject_class, ARG_MAXKEYINTERVAL, g_param_spec_int ("max_key_interval", "Max. Key Interval", - "Maximum number of frames between two keyframes", - 0, G_MAXINT, 0, G_PARAM_READWRITE)); + "Maximum number of frames between two keyframes", + 0, G_MAXINT, 0, G_PARAM_READWRITE)); g_object_class_install_property (gobject_class, ARG_BUFSIZE, g_param_spec_ulong ("buffer_size", "Buffer Size", - "Size of the video buffers", 0, G_MAXULONG, 0, G_PARAM_READWRITE)); + "Size of the video buffers", 0, G_MAXULONG, 0, G_PARAM_READWRITE)); gobject_class->set_property = gst_xvidenc_set_property; gobject_class->get_property = gst_xvidenc_get_property; @@ -236,7 +237,7 @@ gst_xvidenc_init (GstXvidEnc * xvidenc) xvidenc->profile = XVID_PROFILE_S_L0; xvidenc->bitrate = 512; xvidenc->max_b_frames = 2; - xvidenc->max_key_interval = -1; /* default - 2*fps */ + xvidenc->max_key_interval = -1; /* default - 2*fps */ xvidenc->buffer_size = 512; /* set xvid handle to NULL */ @@ -281,7 +282,7 @@ gst_xvidenc_setup (GstXvidEnc * xvidenc) if ((ret = xvid_encore (NULL, XVID_ENC_CREATE, &xenc, NULL)) < 0) { GST_ELEMENT_ERROR (xvidenc, LIBRARY, INIT, (NULL), - ("Error setting up xvid encoder: %s (%d)", gst_xvid_error (ret), ret)); + ("Error setting up xvid encoder: %s (%d)", gst_xvid_error (ret), ret)); return FALSE; } @@ -318,9 +319,9 @@ gst_xvidenc_chain (GstPad * pad, GstData * _data) if (xvidenc->width == xvidenc->stride) { xframe.input.plane[0] = GST_BUFFER_DATA (buf); xframe.input.plane[1] = - xframe.input.plane[0] + (xvidenc->width * xvidenc->height); + xframe.input.plane[0] + (xvidenc->width * xvidenc->height); xframe.input.plane[2] = - xframe.input.plane[1] + (xvidenc->width * xvidenc->height / 4); + xframe.input.plane[1] + (xvidenc->width * xvidenc->height / 4); xframe.input.stride[0] = xvidenc->width; xframe.input.stride[1] = xvidenc->width / 2; xframe.input.stride[2] = xvidenc->width / 2; @@ -334,9 +335,9 @@ gst_xvidenc_chain (GstPad * pad, GstData * _data) gst_xvid_init_struct (xstats); if ((ret = xvid_encore (xvidenc->handle, XVID_ENC_ENCODE, - &xframe, &xstats)) < 0) { + &xframe, &xstats)) < 0) { GST_ELEMENT_ERROR (xvidenc, LIBRARY, ENCODE, (NULL), - ("Error encoding xvid frame: %s (%d)", gst_xvid_error (ret), ret)); + ("Error encoding xvid frame: %s (%d)", gst_xvid_error (ret), ret)); gst_buffer_unref (buf); gst_buffer_unref (outbuf); return; @@ -397,13 +398,13 @@ gst_xvidenc_link (GstPad * pad, const GstCaps * vscaps) GstCaps *new_caps; new_caps = gst_caps_new_simple ("video/x-xvid", - "width", G_TYPE_INT, w, - "height", G_TYPE_INT, h, "framerate", G_TYPE_DOUBLE, fps, NULL); + "width", G_TYPE_INT, w, + "height", G_TYPE_INT, h, "framerate", G_TYPE_DOUBLE, fps, NULL); ret = gst_pad_try_set_caps (xvidenc->srcpad, new_caps); if (GST_PAD_LINK_FAILED (ret)) { if (xvidenc->handle) { - xvid_encore (xvidenc->handle, XVID_ENC_DESTROY, NULL, NULL); - xvidenc->handle = NULL; + xvid_encore (xvidenc->handle, XVID_ENC_DESTROY, NULL, NULL); + xvidenc->handle = NULL; } } @@ -482,8 +483,8 @@ gst_xvidenc_change_state (GstElement * element) switch (GST_STATE_PENDING (element)) { case GST_STATE_PAUSED_TO_READY: if (xvidenc->handle) { - xvid_encore (xvidenc->handle, XVID_ENC_DESTROY, NULL, NULL); - xvidenc->handle = NULL; + xvid_encore (xvidenc->handle, XVID_ENC_DESTROY, NULL, NULL); + xvidenc->handle = NULL; } break; default: -- cgit v1.2.1