From 6cc1c73d2baa95c46edc04f57cbe9ed690dc2f21 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 --- ChangeLog | 4 + examples/capsfilter/capsfilter1.c | 2 +- examples/dynparams/filter.c | 98 +- examples/gstplay/player.c | 2 +- examples/indexing/indexmpeg.c | 29 +- examples/seeking/cdparanoia.c | 24 +- examples/seeking/cdplayer.c | 19 +- examples/seeking/seek.c | 51 +- examples/seeking/spider_seek.c | 25 +- examples/seeking/vorbisfile.c | 24 +- examples/stats/mp2ogg.c | 18 +- ext/aalib/gstaasink.c | 57 +- ext/dv/demo-play.c | 2 +- ext/dv/gstdvdec.c | 311 ++--- ext/esd/esdmon.c | 65 +- ext/esd/esdsink.c | 85 +- ext/flac/gstflac.c | 6 +- ext/flac/gstflacdec.c | 196 +-- ext/flac/gstflacenc.c | 208 +-- ext/flac/gstflactag.c | 113 +- ext/gdk_pixbuf/gst_loader.c | 29 +- ext/gdk_pixbuf/gstgdkanimation.c | 122 +- ext/gdk_pixbuf/gstgdkpixbuf.c | 89 +- ext/jpeg/gstjpeg.c | 4 +- ext/jpeg/gstjpegdec.c | 25 +- ext/jpeg/gstjpegenc.c | 25 +- ext/ladspa/gstladspa.c | 226 ++-- ext/ladspa/load.c | 64 +- ext/ladspa/search.c | 16 +- ext/libcaca/gstcacasink.c | 30 +- ext/libpng/gstpngenc.c | 6 +- ext/mikmod/gstmikmod.c | 85 +- ext/mikmod/mikmod_types.c | 4 +- ext/pango/gsttextoverlay.c | 133 +- ext/pango/gsttimeoverlay.c | 13 +- ext/raw1394/gst1394.c | 2 +- ext/raw1394/gstdv1394src.c | 177 +-- ext/shout2/gstshout2.c | 206 +-- ext/speex/gstspeex.c | 4 +- ext/speex/gstspeexdec.c | 29 +- ext/speex/gstspeexenc.c | 37 +- gst/audiofx/audiowsincband.c | 44 +- gst/audiofx/audiowsinclimit.c | 26 +- gst/auparse/gstauparse.c | 65 +- gst/avi/gstavi.c | 4 +- gst/avi/gstavidecoder.c | 67 +- gst/avi/gstavidemux.c | 545 ++++---- gst/avi/gstavimux.c | 225 ++-- gst/cutter/gstcutter.c | 49 +- gst/debug/efence.c | 9 +- gst/debug/gstnavigationtest.c | 13 +- gst/effectv/gstaging.c | 46 +- gst/effectv/gstdice.c | 99 +- gst/effectv/gstedge.c | 24 +- gst/effectv/gsteffectv.c | 2 +- gst/effectv/gstquark.c | 44 +- gst/effectv/gstrev.c | 12 +- gst/effectv/gstshagadelic.c | 20 +- gst/effectv/gstvertigo.c | 22 +- gst/effectv/gstwarp.c | 17 +- gst/flx/gstflxdec.c | 185 +-- gst/goom/filters.c | 246 ++-- gst/goom/goom_core.c | 306 ++--- gst/goom/gstgoom.c | 33 +- gst/goom/lines.c | 48 +- gst/law/alaw-decode.c | 5 +- gst/law/alaw-encode.c | 5 +- gst/law/alaw.c | 4 +- gst/law/mulaw-conversion.c | 12 +- gst/law/mulaw-decode.c | 5 +- gst/law/mulaw-encode.c | 5 +- gst/law/mulaw.c | 4 +- gst/level/gstlevel.c | 89 +- gst/level/plot.c | 10 +- gst/matroska/ebml-read.c | 154 +-- gst/matroska/ebml-write.c | 14 +- gst/matroska/matroska-demux.c | 2351 +++++++++++++++++---------------- gst/matroska/matroska-mux.c | 210 +-- gst/median/gstmedian.c | 31 +- gst/monoscope/convolve.c | 43 +- gst/monoscope/gstmonoscope.c | 9 +- gst/monoscope/monoscope.c | 20 +- gst/qtdemux/qtdemux.c | 739 +++++------ gst/rtp/gstrtpL16depay.c | 20 +- gst/rtp/gstrtpL16enc.c | 26 +- gst/rtp/gstrtpL16parse.c | 20 +- gst/rtp/gstrtpL16pay.c | 26 +- gst/rtp/gstrtpgsmdepay.c | 6 +- gst/rtp/gstrtpgsmenc.c | 16 +- gst/rtp/gstrtpgsmparse.c | 6 +- gst/rtp/gstrtpgsmpay.c | 16 +- gst/smoothwave/gstsmoothwave.c | 23 +- gst/smpte/barboxwipes.c | 702 +++++----- gst/smpte/gstsmpte.c | 53 +- gst/smpte/paint.c | 36 +- gst/spectrum/gstspectrum.c | 7 +- gst/udp/gstudp.c | 2 +- gst/udp/gstudpsink.c | 64 +- gst/udp/gstudpsrc.c | 146 +- gst/videocrop/gstvideocrop.c | 17 +- gst/videofilter/gstgamma.c | 25 +- gst/videofilter/gstvideobalance.c | 32 +- gst/videofilter/gstvideofilter.c | 39 +- gst/videofilter/gstvideoflip.c | 58 +- gst/videofilter/gstvideotemplate.c | 9 +- gst/videoflip/gstvideoflip.c | 18 +- gst/videoflip/videoflip.c | 60 +- gst/wavenc/gstwavenc.c | 106 +- gst/wavparse/gstwavparse.c | 612 ++++----- sys/oss/gstossaudio.c | 6 +- sys/oss/gstosselement.c | 276 ++-- sys/oss/gstossmixer.c | 119 +- sys/oss/gstosssink.c | 155 +-- sys/oss/gstosssrc.c | 62 +- sys/v4l2/gstv4l2.c | 4 +- sys/v4l2/gstv4l2colorbalance.c | 8 +- sys/v4l2/gstv4l2element.c | 132 +- sys/v4l2/gstv4l2src.c | 557 ++++---- sys/v4l2/gstv4l2tuner.c | 18 +- sys/v4l2/gstv4l2xoverlay.c | 4 +- sys/v4l2/v4l2-overlay_calls.c | 10 +- sys/v4l2/v4l2_calls.c | 232 ++-- sys/v4l2/v4l2src_calls.c | 82 +- tests/examples/spectrum/demo-osssrc.c | 2 +- 124 files changed, 6236 insertions(+), 6102 deletions(-) diff --git a/ChangeLog b/ChangeLog index 7f1b9d32..1f2de023 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2004-03-15 Thomas Vander Stichele + + * *.c, *.cc: don't mix tabs and spaces + 2004-03-15 Thomas Vander Stichele * gst-libs/gst/play/play.c: (gst_play_pipeline_setup): diff --git a/examples/capsfilter/capsfilter1.c b/examples/capsfilter/capsfilter1.c index 46e127a2..5948d601 100644 --- a/examples/capsfilter/capsfilter1.c +++ b/examples/capsfilter/capsfilter1.c @@ -72,7 +72,7 @@ main (gint argc, gchar * argv[]) /* force RGB data passing between colorspace and xvideosink */ res = gst_element_link_filtered (colorspace, "src", xvideosink, "sink", GST_CAPS_NEW ("filtercaps", - "video/raw", "format", GST_PROPS_FOURCC (GST_STR_FOURCC ("RGB ")) + "video/raw", "format", GST_PROPS_FOURCC (GST_STR_FOURCC ("RGB ")) )); if (!res) { g_print ("could not connect colorspace and xvideosink\n"); diff --git a/examples/dynparams/filter.c b/examples/dynparams/filter.c index 982a4c7a..5178d28b 100644 --- a/examples/dynparams/filter.c +++ b/examples/dynparams/filter.c @@ -15,17 +15,17 @@ /* filter UI data */ struct _filter_ui { - GtkWidget *window; /* top-level interface window */ + GtkWidget *window; /* top-level interface window */ - GtkWidget *buttons; /* all of the control buttons */ - GtkWidget *parse, *play, *stop; /* control buttons */ + GtkWidget *buttons; /* all of the control buttons */ + GtkWidget *parse, *play, *stop; /* control buttons */ - GtkWidget *feedback; /* here's where we'll tell you stuff */ - GtkTextBuffer *fb_buffer; /* feedback buffer */ - GtkWidget *selection; /* the place to input element stuff */ - GtkWidget *input, *filter, *output; /* the selection widgets */ + GtkWidget *feedback; /* here's where we'll tell you stuff */ + GtkTextBuffer *fb_buffer; /* feedback buffer */ + GtkWidget *selection; /* the place to input element stuff */ + GtkWidget *input, *filter, *output; /* the selection widgets */ - GtkWidget *control; /* the dynamically generated control UI */ + GtkWidget *control; /* the dynamically generated control UI */ }; typedef struct _filter_ui _filter_ui_t; @@ -33,13 +33,13 @@ typedef struct _filter_ui _filter_ui_t; /* back-end data */ struct _filter_data { - _filter_ui_t *ui; /* the UI data */ + _filter_ui_t *ui; /* the UI data */ gchar *input_pipe, *output_pipe, *filter_element; gchar *pipe_string; GList *filter_choices; gboolean playing; - GstElement *input, *output; /* these are in and out bins */ + GstElement *input, *output; /* these are in and out bins */ GstElement *pipeline; GstElement *filter; }; @@ -75,21 +75,21 @@ gst_bin_find_unconnected_pad (GstBin * bin, GstPadDirection direction, while (pads) { /* check if the direction matches */ if (GST_PAD_DIRECTION (GST_PAD (pads->data)) == direction) { - if (GST_PAD_PEER (GST_PAD (pads->data)) == NULL) { - /* found it ! */ - g_print ("DEBUG: found an unconnected pad !\n"); - pad = GST_PAD (pads->data); - } + if (GST_PAD_PEER (GST_PAD (pads->data)) == NULL) { + /* found it ! */ + g_print ("DEBUG: found an unconnected pad !\n"); + pad = GST_PAD (pads->data); + } } if (pad) - break; /* found one already */ + break; /* found one already */ pads = g_list_next (pads); } elements = g_list_next (elements); } g_print ("DEBUG: find_unconnected stop\n"); - if (pad == NULL) /* we didn't find it at all */ + if (pad == NULL) /* we didn't find it at all */ return NULL; pad = gst_ghost_pad_new (name, pad); @@ -157,37 +157,37 @@ ui_control_create (GstElement * element, GtkWidget * control, _filter_ui_t * ui) gtk_container_add (GTK_CONTAINER (hbox), widget); gtk_widget_show (widget); switch (G_PARAM_SPEC_VALUE_TYPE (specs[i])) { - case G_TYPE_INT64: - widget = gtk_hscale_new_with_range ( - (gdouble) (((GParamSpecInt64 *) specs[i])->minimum), - (gdouble) (((GParamSpecInt64 *) specs[i])->maximum), 1.0); - gtk_range_set_value (GTK_RANGE (widget), - (gdouble) ((GParamSpecInt64 *) specs[i])->default_value); - break; - - case G_TYPE_INT: - widget = gtk_hscale_new_with_range ( - (gdouble) (((GParamSpecInt *) specs[i])->minimum), - (gdouble) (((GParamSpecInt *) specs[i])->maximum), 1.0); - gtk_range_set_value (GTK_RANGE (widget), - (gdouble) ((GParamSpecInt *) specs[i])->default_value); - break; - case G_TYPE_FLOAT: - widget = gtk_hscale_new_with_range ( - (gdouble) (((GParamSpecFloat *) specs[i])->minimum), - (gdouble) (((GParamSpecFloat *) specs[i])->maximum), 0.00001); - gtk_range_set_value (GTK_RANGE (widget), - (gdouble) ((GParamSpecFloat *) specs[i])->default_value); - break; + case G_TYPE_INT64: + widget = gtk_hscale_new_with_range ( + (gdouble) (((GParamSpecInt64 *) specs[i])->minimum), + (gdouble) (((GParamSpecInt64 *) specs[i])->maximum), 1.0); + gtk_range_set_value (GTK_RANGE (widget), + (gdouble) ((GParamSpecInt64 *) specs[i])->default_value); + break; + + case G_TYPE_INT: + widget = gtk_hscale_new_with_range ( + (gdouble) (((GParamSpecInt *) specs[i])->minimum), + (gdouble) (((GParamSpecInt *) specs[i])->maximum), 1.0); + gtk_range_set_value (GTK_RANGE (widget), + (gdouble) ((GParamSpecInt *) specs[i])->default_value); + break; + case G_TYPE_FLOAT: + widget = gtk_hscale_new_with_range ( + (gdouble) (((GParamSpecFloat *) specs[i])->minimum), + (gdouble) (((GParamSpecFloat *) specs[i])->maximum), 0.00001); + gtk_range_set_value (GTK_RANGE (widget), + (gdouble) ((GParamSpecFloat *) specs[i])->default_value); + break; } /* create the dparam object */ dparam = gst_dpsmooth_new (G_PARAM_SPEC_VALUE_TYPE (specs[i])); g_object_set (G_OBJECT (dparam), "update_period", 2000000LL, NULL); g_assert (gst_dpman_attach_dparam (dpman, - (gchar *) g_param_spec_get_name (specs[i]), dparam)); + (gchar *) g_param_spec_get_name (specs[i]), dparam)); gst_dpman_set_mode (dpman, "asynchronous"); g_signal_connect (widget, "value-changed", - G_CALLBACK (cb_dynparm_value_changed), dparam); + G_CALLBACK (cb_dynparm_value_changed), dparam); cb_dynparm_value_changed (GTK_RANGE (widget), dparam); gtk_container_add (GTK_CONTAINER (hbox), widget); @@ -315,7 +315,7 @@ cb_parse_clicked (GtkButton * button, gpointer * user_data) fd->input = GST_ELEMENT (gst_parse_launch (fd->input_pipe, &error)); if (error) { ui_feedback_add (fd->ui, "Error : parsing input pipeline : %s\n", - error->message); + error->message); g_error_free (error); return; } @@ -329,7 +329,7 @@ cb_parse_clicked (GtkButton * button, gpointer * user_data) fd->output = GST_ELEMENT (gst_parse_launch (fd->output_pipe, &error)); if (error) { ui_feedback_add (fd->ui, "Error : parsing output pipeline : %s\n", - error->message); + error->message); g_error_free (error); return; } @@ -340,7 +340,7 @@ cb_parse_clicked (GtkButton * button, gpointer * user_data) fd->filter = gst_element_factory_make (fd->filter_element, "filter"); if (fd->filter == NULL) { ui_feedback_add (fd->ui, "Error : could not create element %s\n", - fd->filter_element); + fd->filter_element); return; } @@ -359,14 +359,14 @@ cb_parse_clicked (GtkButton * button, gpointer * user_data) "source"); if (src_pad == NULL) { ui_feedback_add (fd->ui, - "Error : could not find an unconnected source pad !\n"); + "Error : could not find an unconnected source pad !\n"); return; } sink_pad = gst_bin_find_unconnected_pad (GST_BIN (fd->output), GST_PAD_SINK, "sink"); if (sink_pad == NULL) { ui_feedback_add (fd->ui, - "Error : could not find an unconnected sink pad !\n"); + "Error : could not find an unconnected sink pad !\n"); return; } gst_element_add_pad (fd->input, src_pad); @@ -417,8 +417,8 @@ init_data (_filter_data_t * fd) void create_ui (_filter_ui_t * fui, _filter_data_t * fd) { - GtkWidget *widget; /* temporary widget */ - GtkWidget *vbox; /* temporary vbox */ + GtkWidget *widget; /* temporary widget */ + GtkWidget *vbox; /* temporary vbox */ g_print ("DEBUG: creating top-level window\n"); fui->window = gtk_window_new (GTK_WINDOW_TOPLEVEL); @@ -480,7 +480,7 @@ create_ui (_filter_ui_t * fui, _filter_data_t * fd) widget = gtk_label_new ("Output Pipe"); gtk_container_add (GTK_CONTAINER (vbox), widget); fui->output = gtk_entry_new (); - gtk_entry_set_text (GTK_ENTRY (fui->output), "osssink fragment=1572872"); /* fixme: gconf default ? */ + gtk_entry_set_text (GTK_ENTRY (fui->output), "osssink fragment=1572872"); /* fixme: gconf default ? */ gtk_container_add (GTK_CONTAINER (vbox), fui->output); gtk_container_add (GTK_CONTAINER (fui->selection), vbox); g_signal_connect (G_OBJECT (fui->output), "activate", diff --git a/examples/gstplay/player.c b/examples/gstplay/player.c index 3272778b..a23d3a01 100644 --- a/examples/gstplay/player.c +++ b/examples/gstplay/player.c @@ -36,7 +36,7 @@ print_tag (const GstTagList * list, const gchar * tag, gpointer unused) g_assert (gst_tag_list_get_string_index (list, tag, i, &str)); } else { str = - g_strdup_value_contents (gst_tag_list_get_value_index (list, tag, i)); + g_strdup_value_contents (gst_tag_list_get_value_index (list, tag, i)); } if (i == 0) { diff --git a/examples/indexing/indexmpeg.c b/examples/indexing/indexmpeg.c index 48a7ca23..5c129609 100644 --- a/examples/indexing/indexmpeg.c +++ b/examples/indexing/indexmpeg.c @@ -29,21 +29,21 @@ entry_added (GstIndex * index, GstIndexEntry * entry) switch (entry->type) { case GST_INDEX_ENTRY_ID: g_print ("id %d describes writer %s\n", entry->id, - GST_INDEX_ID_DESCRIPTION (entry)); + GST_INDEX_ID_DESCRIPTION (entry)); break; case GST_INDEX_ENTRY_FORMAT: g_print ("%d: registered format %d for %s\n", entry->id, - GST_INDEX_FORMAT_FORMAT (entry), GST_INDEX_FORMAT_KEY (entry)); + GST_INDEX_FORMAT_FORMAT (entry), GST_INDEX_FORMAT_KEY (entry)); break; case GST_INDEX_ENTRY_ASSOCIATION: { gint i; g_print ("%p, %d: %08x ", entry, entry->id, - GST_INDEX_ASSOC_FLAGS (entry)); + GST_INDEX_ASSOC_FLAGS (entry)); for (i = 0; i < GST_INDEX_NASSOCS (entry); i++) { - g_print ("%d %lld ", GST_INDEX_ASSOC_FORMAT (entry, i), - GST_INDEX_ASSOC_VALUE (entry, i)); + g_print ("%d %lld ", GST_INDEX_ASSOC_FORMAT (entry, i), + GST_INDEX_ASSOC_VALUE (entry, i)); } g_print ("\n"); break; @@ -60,7 +60,8 @@ typedef struct GstElement *bin; GstElement *pipeline; GstIndex *index; -} dyn_link; +} +dyn_link; static void dynamic_link (GstPadTemplate * templ, GstPad * newpad, gpointer data) @@ -205,18 +206,18 @@ main (gint argc, gchar * argv[]) GstElement *sink; struct poptOption options[] = { {"verbose", 'v', POPT_ARG_NONE | POPT_ARGFLAG_STRIP, &verbose, 0, - "Print index entries", NULL}, + "Print index entries", NULL}, {"quiet", 'q', POPT_ARG_NONE | POPT_ARGFLAG_STRIP, &quiet, 0, - "don't print progress bar", NULL}, + "don't print progress bar", NULL}, POPT_TABLEEND }; if (!gst_init_check_with_popt_table (&argc, &argv, options) || argc < 3) { g_print ("usage: %s [-v] \n" - " type can be: 0 mpeg_systems\n" - " 1 mpeg_decoder\n" - " -v : report added index entries\n" - " -q : don't print progress\n", argv[0]); + " type can be: 0 mpeg_systems\n" + " 1 mpeg_decoder\n" + " -v : report added index entries\n" + " -q : don't print progress\n", argv[0]); return -1; } @@ -225,7 +226,7 @@ main (gint argc, gchar * argv[]) if (index) { if (verbose) g_signal_connect (G_OBJECT (index), "entry_added", - G_CALLBACK (entry_added), NULL); + G_CALLBACK (entry_added), NULL); g_object_set (G_OBJECT (index), "resolver", 1, NULL); } @@ -284,7 +285,7 @@ main (gint argc, gchar * argv[]) gst_index_get_writer_id (index, GST_OBJECT (src), &id); entry = gst_index_get_assoc_entry (index, id, GST_INDEX_LOOKUP_BEFORE, 0, - GST_FORMAT_TIME, G_MAXINT64); + GST_FORMAT_TIME, G_MAXINT64); g_assert (entry); gst_index_entry_assoc_map (entry, GST_FORMAT_TIME, &result); total_tm = result * 60 / GST_SECOND; diff --git a/examples/seeking/cdparanoia.c b/examples/seeking/cdparanoia.c index e750f346..c4a58cf8 100644 --- a/examples/seeking/cdparanoia.c +++ b/examples/seeking/cdparanoia.c @@ -29,7 +29,7 @@ get_position_info (GstElement * cdparanoia) if (format == GST_FORMAT_TIME) { position /= GST_SECOND; g_print ("%s: %lld:%02lld", definition->nick, position / 60, - position % 60); + position % 60); } else { g_print ("%s: %lld", definition->nick, position); } @@ -72,16 +72,16 @@ get_track_info (GstElement * cdparanoia) res = gst_pad_query (pad, GST_QUERY_TOTAL, &format, &total); if (res) { if (format == GST_FORMAT_TIME) { - total /= GST_SECOND; - g_print ("%s total: %lld:%02lld\n", definition->nick, total / 60, - total % 60); + total /= GST_SECOND; + g_print ("%s total: %lld:%02lld\n", definition->nick, total / 60, + total % 60); } else - g_print ("%s total: %lld\n", definition->nick, total); + g_print ("%s total: %lld\n", definition->nick, total); if (format == track_format) - total_tracks = total; + total_tracks = total; else if (format == GST_FORMAT_TIME) - total_time = total; + total_time = total; } else g_print ("failed to get %s total\n", definition->nick); @@ -110,12 +110,12 @@ get_track_info (GstElement * cdparanoia) /* for the first track (i==0) we wait until we have the * time of the next track */ if (i > 0) { - gint64 length = time - time_count; + gint64 length = time - time_count; - g_print ("track %d: %lld:%02lld -> %lld:%02lld, length: %lld:%02lld\n", - i - 1, - time_count / 60, time_count % 60, - time / 60, time % 60, length / 60, length % 60); + g_print ("track %d: %lld:%02lld -> %lld:%02lld, length: %lld:%02lld\n", + i - 1, + time_count / 60, time_count % 60, + time / 60, time % 60, length / 60, length % 60); } } else { g_print ("could not get time for track %d\n", i); diff --git a/examples/seeking/cdplayer.c b/examples/seeking/cdplayer.c index 1e823cc5..d83c78e6 100644 --- a/examples/seeking/cdplayer.c +++ b/examples/seeking/cdplayer.c @@ -47,7 +47,8 @@ typedef struct { const gchar *name; const GstFormat format; -} seek_format; +} +seek_format; static seek_format seek_formats[] = { {"tim", GST_FORMAT_TIME}, @@ -76,9 +77,9 @@ query_durations () format = seek_formats[i].format; res = gst_element_query (element, GST_QUERY_TOTAL, &format, &value); if (res) { - g_print ("%s %13lld | ", seek_formats[i].name, value); + g_print ("%s %13lld | ", seek_formats[i].name, value); } else { - g_print ("%s %13.13s | ", seek_formats[i].name, "*NA*"); + g_print ("%s %13.13s | ", seek_formats[i].name, "*NA*"); } i++; } @@ -105,9 +106,9 @@ query_positions () format = seek_formats[i].format; res = gst_element_query (element, GST_QUERY_POSITION, &format, &value); if (res) { - g_print ("%s %13lld | ", seek_formats[i].name, value); + g_print ("%s %13lld | ", seek_formats[i].name, value); } else { - g_print ("%s %13.13s | ", seek_formats[i].name, "*NA*"); + g_print ("%s %13.13s | ", seek_formats[i].name, "*NA*"); } i++; } @@ -137,7 +138,7 @@ update_scale (gpointer data) if (stats) { if (clock) g_print ("clock: %13llu (%s)\n", position, - gst_object_get_name (GST_OBJECT (clock))); + gst_object_get_name (GST_OBJECT (clock))); query_durations (); query_positions (); } @@ -184,7 +185,7 @@ stop_seek (GtkWidget * widget, GdkEventButton * event, gpointer user_data) g_print ("seek to %lld on element %s\n", real, GST_ELEMENT_NAME (seekable)); s_event = gst_event_new_seek (GST_FORMAT_TIME | - GST_SEEK_METHOD_SET | GST_SEEK_FLAG_FLUSH, real); + GST_SEEK_METHOD_SET | GST_SEEK_FLAG_FLUSH, real); res = gst_element_send_event (seekable, s_event); @@ -208,7 +209,7 @@ play_cb (GtkButton * button, gpointer data) if (!GST_FLAG_IS_SET (pipeline, GST_BIN_SELF_SCHEDULABLE)) gtk_idle_add ((GtkFunction) iterate, pipeline); update_id = - gtk_timeout_add (UPDATE_INTERVAL, (GtkFunction) update_scale, pipeline); + gtk_timeout_add (UPDATE_INTERVAL, (GtkFunction) update_scale, pipeline); } } @@ -237,7 +238,7 @@ main (int argc, char **argv) *play_button, *pause_button, *stop_button, *hscale; struct poptOption options[] = { {"stats", 's', POPT_ARG_NONE | POPT_ARGFLAG_STRIP, &stats, 0, - "Show element stats", NULL}, + "Show element stats", NULL}, POPT_TABLEEND }; diff --git a/examples/seeking/seek.c b/examples/seeking/seek.c index 34a6958d..e8d6bc04 100644 --- a/examples/seeking/seek.c +++ b/examples/seeking/seek.c @@ -28,7 +28,8 @@ typedef struct const gchar *padname; GstPad *target; GstElement *bin; -} dyn_link; +} +dyn_link; static GstElement * gst_element_factory_make_or_warn (gchar * type, gchar * name) @@ -372,7 +373,7 @@ make_avi_pipeline (const gchar * location) gst_element_set_state (audio_bin, GST_STATE_PAUSED); setup_dynamic_link (demux, "audio_00", gst_element_get_pad (a_decoder, - "sink"), audio_bin); + "sink"), audio_bin); seekable = gst_element_get_pad (a_queue, "src"); seekable_pads = g_list_prepend (seekable_pads, seekable); @@ -400,7 +401,7 @@ make_avi_pipeline (const gchar * location) gst_element_set_state (video_bin, GST_STATE_PAUSED); setup_dynamic_link (demux, "video_00", gst_element_get_pad (v_decoder, - "sink"), video_bin); + "sink"), video_bin); seekable = gst_element_get_pad (v_queue, "src"); seekable_pads = g_list_prepend (seekable_pads, seekable); @@ -448,7 +449,7 @@ make_mpeg_pipeline (const gchar * location) gst_bin_add (GST_BIN (audio_thread), audiosink); setup_dynamic_link (demux, "audio_00", gst_element_get_pad (a_decoder, - "sink"), audio_bin); + "sink"), audio_bin); seekable = gst_element_get_pad (a_queue, "src"); seekable_pads = g_list_prepend (seekable_pads, seekable); @@ -470,7 +471,7 @@ make_mpeg_pipeline (const gchar * location) gst_bin_add_many (GST_BIN (video_thread), v_queue, v_filter, videosink, NULL); setup_dynamic_link (demux, "video_00", gst_element_get_pad (v_decoder, - "sink"), video_bin); + "sink"), video_bin); seekable = gst_element_get_pad (v_queue, "src"); seekable_pads = g_list_prepend (seekable_pads, seekable); @@ -519,7 +520,7 @@ make_mpegnt_pipeline (const gchar * location) gst_bin_add (GST_BIN (audio_thread), audiosink); setup_dynamic_link (demux, "audio_00", gst_element_get_pad (a_decoder, - "sink"), audio_bin); + "sink"), audio_bin); seekable = gst_element_get_pad (a_queue, "src"); seekable_pads = g_list_prepend (seekable_pads, seekable); @@ -536,7 +537,7 @@ make_mpegnt_pipeline (const gchar * location) gst_bin_add_many (GST_BIN (video_bin), v_decoder, v_filter, videosink, NULL); setup_dynamic_link (demux, "video_00", gst_element_get_pad (v_decoder, - "sink"), video_bin); + "sink"), video_bin); seekable = gst_element_get_pad (v_decoder, "src"); seekable_pads = g_list_prepend (seekable_pads, seekable); @@ -572,7 +573,8 @@ typedef struct { const gchar *name; const GstFormat format; -} seek_format; +} +seek_format; static seek_format seek_formats[] = { {"tim", GST_FORMAT_TIME}, @@ -599,9 +601,9 @@ query_rates (void) format = seek_formats[i].format; if (gst_pad_convert (pad, GST_FORMAT_TIME, GST_SECOND, &format, &value)) { - g_print ("%s %13lld | ", seek_formats[i].name, value); + g_print ("%s %13lld | ", seek_formats[i].name, value); } else { - g_print ("%s %13.13s | ", seek_formats[i].name, "*NA*"); + g_print ("%s %13.13s | ", seek_formats[i].name, "*NA*"); } i++; @@ -630,9 +632,9 @@ query_durations () format = seek_formats[i].format; res = gst_pad_query (pad, GST_QUERY_TOTAL, &format, &value); if (res) { - g_print ("%s %13lld | ", seek_formats[i].name, value); + g_print ("%s %13lld | ", seek_formats[i].name, value); } else { - g_print ("%s %13.13s | ", seek_formats[i].name, "*NA*"); + g_print ("%s %13.13s | ", seek_formats[i].name, "*NA*"); } i++; } @@ -660,9 +662,9 @@ query_positions () format = seek_formats[i].format; res = gst_pad_query (pad, GST_QUERY_POSITION, &format, &value); if (res) { - g_print ("%s %13lld | ", seek_formats[i].name, value); + g_print ("%s %13lld | ", seek_formats[i].name, value); } else { - g_print ("%s %13.13s | ", seek_formats[i].name, "*NA*"); + g_print ("%s %13.13s | ", seek_formats[i].name, "*NA*"); } i++; } @@ -691,7 +693,7 @@ update_scale (gpointer data) if (stats) { g_print ("clock: %13llu (%s)\n", position, - gst_object_get_name (GST_OBJECT (clock))); + gst_object_get_name (GST_OBJECT (clock))); query_durations (); query_positions (); query_rates (); @@ -740,10 +742,10 @@ stop_seek (GtkWidget * widget, GdkEventButton * event, gpointer user_data) GstPad *seekable = GST_PAD (walk->data); g_print ("seek to %lld on pad %s:%s\n", real, - GST_DEBUG_PAD_NAME (seekable)); + GST_DEBUG_PAD_NAME (seekable)); s_event = - gst_event_new_seek (GST_FORMAT_TIME | GST_SEEK_METHOD_SET | - GST_SEEK_FLAG_FLUSH, real); + gst_event_new_seek (GST_FORMAT_TIME | GST_SEEK_METHOD_SET | + GST_SEEK_FLAG_FLUSH, real); res = gst_pad_send_event (seekable, s_event); @@ -756,10 +758,10 @@ stop_seek (GtkWidget * widget, GdkEventButton * event, gpointer user_data) GstElement *seekable = GST_ELEMENT (walk->data); g_print ("seek to %lld on element %s\n", real, - gst_element_get_name (seekable)); + gst_element_get_name (seekable)); s_event = - gst_event_new_seek (GST_FORMAT_TIME | GST_SEEK_METHOD_SET | - GST_SEEK_FLAG_FLUSH, real); + gst_event_new_seek (GST_FORMAT_TIME | GST_SEEK_METHOD_SET | + GST_SEEK_FLAG_FLUSH, real); res = gst_element_send_event (seekable, s_event); @@ -782,7 +784,7 @@ play_cb (GtkButton * button, gpointer data) gst_element_set_state (pipeline, GST_STATE_PLAYING); gtk_idle_add ((GtkFunction) iterate, pipeline); update_id = - gtk_timeout_add (UPDATE_INTERVAL, (GtkFunction) update_scale, pipeline); + gtk_timeout_add (UPDATE_INTERVAL, (GtkFunction) update_scale, pipeline); } } @@ -808,7 +810,8 @@ typedef struct { gchar *name; GstElement *(*func) (const gchar * location); -} Pipeline; +} +Pipeline; static Pipeline pipelines[] = { {"mp3", make_mp3_pipeline}, @@ -848,7 +851,7 @@ main (int argc, char **argv) *play_button, *pause_button, *stop_button, *hscale; struct poptOption options[] = { {"stats", 's', POPT_ARG_NONE | POPT_ARGFLAG_STRIP, &stats, 0, - "Show pad stats", NULL}, + "Show pad stats", NULL}, POPT_TABLEEND }; gint type; diff --git a/examples/seeking/spider_seek.c b/examples/seeking/spider_seek.c index d2c2c6b2..dc9ddfd6 100644 --- a/examples/seeking/spider_seek.c +++ b/examples/seeking/spider_seek.c @@ -91,7 +91,8 @@ typedef struct { const gchar *name; const GstFormat format; -} seek_format; +} +seek_format; static seek_format seek_formats[] = { {"tim", GST_FORMAT_TIME}, @@ -118,9 +119,9 @@ query_rates (void) format = seek_formats[i].format; if (gst_pad_convert (pad, GST_FORMAT_TIME, GST_SECOND, &format, &value)) { - g_print ("%s %13lld | ", seek_formats[i].name, value); + g_print ("%s %13lld | ", seek_formats[i].name, value); } else { - g_print ("%s %13.13s | ", seek_formats[i].name, "*NA*"); + g_print ("%s %13.13s | ", seek_formats[i].name, "*NA*"); } i++; @@ -149,9 +150,9 @@ query_durations () format = seek_formats[i].format; res = gst_element_query (element, GST_QUERY_TOTAL, &format, &value); if (res) { - g_print ("%s %13lld | ", seek_formats[i].name, value); + g_print ("%s %13lld | ", seek_formats[i].name, value); } else { - g_print ("%s %13.13s | ", seek_formats[i].name, "*NA*"); + g_print ("%s %13.13s | ", seek_formats[i].name, "*NA*"); } i++; } @@ -178,9 +179,9 @@ query_positions () format = seek_formats[i].format; res = gst_element_query (element, GST_QUERY_POSITION, &format, &value); if (res) { - g_print ("%s %13lld | ", seek_formats[i].name, value); + g_print ("%s %13lld | ", seek_formats[i].name, value); } else { - g_print ("%s %13.13s | ", seek_formats[i].name, "*NA*"); + g_print ("%s %13.13s | ", seek_formats[i].name, "*NA*"); } i++; } @@ -208,7 +209,7 @@ update_scale (gpointer data) if (stats) { g_print ("clock: %13llu (%s)\n", position, - gst_object_get_name (GST_OBJECT (clock))); + gst_object_get_name (GST_OBJECT (clock))); query_durations (); query_positions (); query_rates (); @@ -255,7 +256,7 @@ stop_seek (GtkWidget * widget, GdkEventButton * event, gpointer user_data) g_print ("seek to %lld on element %s\n", real, GST_ELEMENT_NAME (seekable)); s_event = gst_event_new_seek (GST_FORMAT_TIME | - GST_SEEK_METHOD_SET | GST_SEEK_FLAG_FLUSH, real); + GST_SEEK_METHOD_SET | GST_SEEK_FLAG_FLUSH, real); res = gst_element_send_event (seekable, s_event); @@ -279,7 +280,7 @@ play_cb (GtkButton * button, gpointer data) if (!GST_FLAG_IS_SET (pipeline, GST_BIN_SELF_SCHEDULABLE)) gtk_idle_add ((GtkFunction) iterate, pipeline); update_id = - gtk_timeout_add (UPDATE_INTERVAL, (GtkFunction) update_scale, pipeline); + gtk_timeout_add (UPDATE_INTERVAL, (GtkFunction) update_scale, pipeline); } } @@ -309,9 +310,9 @@ main (int argc, char **argv) gboolean threaded = FALSE; struct poptOption options[] = { {"threaded", 't', POPT_ARG_NONE | POPT_ARGFLAG_STRIP, &threaded, 0, - "Run the pipeline in a toplevel thread", NULL}, + "Run the pipeline in a toplevel thread", NULL}, {"stats", 's', POPT_ARG_NONE | POPT_ARGFLAG_STRIP, &stats, 0, - "Show element stats", NULL}, + "Show element stats", NULL}, POPT_TABLEEND }; diff --git a/examples/seeking/vorbisfile.c b/examples/seeking/vorbisfile.c index ec6844a0..afb4ecc4 100644 --- a/examples/seeking/vorbisfile.c +++ b/examples/seeking/vorbisfile.c @@ -65,20 +65,20 @@ print_lbs_info (struct probe_context *context, gint stream) /* get start and end position of this stream */ res = gst_pad_convert (context->pad, - context->ls_format, stream, &format, &value_start); + context->ls_format, stream, &format, &value_start); res &= gst_pad_convert (context->pad, - context->ls_format, stream + 1, &format, &value_end); + context->ls_format, stream + 1, &format, &value_end); if (res) { /* substract to get the length */ value_end -= value_start; if (format == GST_FORMAT_TIME) { - value_end /= (GST_SECOND / 100); - g_print (" %s: %lld:%02lld.%02lld\n", definition->nick, - value_end / 6000, (value_end / 100) % 60, (value_end % 100)); + value_end /= (GST_SECOND / 100); + g_print (" %s: %lld:%02lld.%02lld\n", definition->nick, + value_end / 6000, (value_end / 100) % 60, (value_end % 100)); } else { - g_print (" %s: %lld\n", definition->nick, value_end); + g_print (" %s: %lld\n", definition->nick, value_end); } } else g_print (" could not get logical stream %s\n", definition->nick); @@ -180,13 +180,13 @@ collect_stream_properties (struct probe_context *context) if (res) { if (format == GST_FORMAT_TIME) { - value /= (GST_SECOND / 100); - g_print (" total %s: %lld:%02lld.%02lld\n", definition->nick, - value / 6000, (value / 100) % 60, (value % 100)); + value /= (GST_SECOND / 100); + g_print (" total %s: %lld:%02lld.%02lld\n", definition->nick, + value / 6000, (value / 100) % 60, (value % 100)); } else { - if (format == context->ls_format) - context->total_ls = value; - g_print (" total %s: %lld\n", definition->nick, value); + if (format == context->ls_format) + context->total_ls = value; + g_print (" total %s: %lld\n", definition->nick, value); } } } diff --git a/examples/stats/mp2ogg.c b/examples/stats/mp2ogg.c index 55d79e90..3fb437fe 100644 --- a/examples/stats/mp2ogg.c +++ b/examples/stats/mp2ogg.c @@ -47,7 +47,7 @@ main (gint argc, gchar * argv[]) if (!pipeline) { if (error) g_print ("ERROR: pipeline could not be constructed: %s\n", - error->message); + error->message); else g_print ("ERROR: pipeline could not be constructed\n"); return -1; @@ -80,18 +80,18 @@ main (gint argc, gchar * argv[]) format = GST_FORMAT_BYTES; /* see how many bytes are genereated per 8 seconds (== bitrate) */ gst_pad_convert (enc_src, GST_FORMAT_TIME, 8 * GST_SECOND, - &format, &bitrate_enc); + &format, &bitrate_enc); gst_pad_convert (dec_sink, GST_FORMAT_TIME, 8 * GST_SECOND, - &format, &bitrate_dec); + &format, &bitrate_dec); g_print ("[%2dm %.2ds] of [%2dm %.2ds], " - "src avg bitrate: %lld, dest avg birate: %lld, ratio [%02.2f] \r", - (gint) (position / (GST_SECOND * 60)), - (gint) (position / (GST_SECOND)) % 60, - (gint) (duration / (GST_SECOND * 60)), - (gint) (duration / (GST_SECOND)) % 60, - bitrate_dec, bitrate_enc, (gfloat) bitrate_dec / bitrate_enc); + "src avg bitrate: %lld, dest avg birate: %lld, ratio [%02.2f] \r", + (gint) (position / (GST_SECOND * 60)), + (gint) (position / (GST_SECOND)) % 60, + (gint) (duration / (GST_SECOND * 60)), + (gint) (duration / (GST_SECOND)) % 60, + bitrate_dec, bitrate_enc, (gfloat) bitrate_dec / bitrate_enc); } g_print ("\n"); diff --git a/ext/aalib/gstaasink.c b/ext/aalib/gstaasink.c index e34bcf03..2713eb93 100644 --- a/ext/aalib/gstaasink.c +++ b/ext/aalib/gstaasink.c @@ -100,8 +100,9 @@ gst_aasink_get_type (void) 0, (GInstanceInitFunc) gst_aasink_init, }; + aasink_type = - g_type_register_static (GST_TYPE_ELEMENT, "GstAASink", &aasink_info, 0); + g_type_register_static (GST_TYPE_ELEMENT, "GstAASink", &aasink_info, 0); } return aasink_type; } @@ -191,17 +192,17 @@ gst_aasink_class_init (GstAASinkClass * 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_DRIVER, g_param_spec_enum ("driver", "driver", "driver", GST_TYPE_AADRIVERS, 0, G_PARAM_READWRITE)); /* CHECKME! */ - g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_DITHER, g_param_spec_enum ("dither", "dither", "dither", GST_TYPE_AADITHER, 0, G_PARAM_READWRITE)); /* CHECKME! */ - g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_BRIGHTNESS, g_param_spec_int ("brightness", "brightness", "brightness", G_MININT, G_MAXINT, 0, G_PARAM_READWRITE)); /* CHECKME */ - g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_CONTRAST, g_param_spec_int ("contrast", "contrast", "contrast", G_MININT, G_MAXINT, 0, G_PARAM_READWRITE)); /* CHECKME */ - g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_GAMMA, g_param_spec_float ("gamma", "gamma", "gamma", 0.0, 5.0, 1.0, G_PARAM_READWRITE)); /* CHECKME */ - g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_INVERSION, g_param_spec_boolean ("inversion", "inversion", "inversion", TRUE, G_PARAM_READWRITE)); /* CHECKME */ - g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_RANDOMVAL, g_param_spec_int ("randomval", "randomval", "randomval", G_MININT, G_MAXINT, 0, G_PARAM_READWRITE)); /* CHECKME */ - g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_FRAMES_DISPLAYED, g_param_spec_int ("frames_displayed", "frames_displayed", "frames_displayed", G_MININT, G_MAXINT, 0, G_PARAM_READABLE)); /* CHECKME */ - g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_FRAME_TIME, g_param_spec_int ("frame_time", "frame_time", "frame_time", G_MININT, G_MAXINT, 0, 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_DRIVER, g_param_spec_enum ("driver", "driver", "driver", GST_TYPE_AADRIVERS, 0, G_PARAM_READWRITE)); /* CHECKME! */ + g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_DITHER, g_param_spec_enum ("dither", "dither", "dither", GST_TYPE_AADITHER, 0, G_PARAM_READWRITE)); /* CHECKME! */ + g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_BRIGHTNESS, g_param_spec_int ("brightness", "brightness", "brightness", G_MININT, G_MAXINT, 0, G_PARAM_READWRITE)); /* CHECKME */ + g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_CONTRAST, g_param_spec_int ("contrast", "contrast", "contrast", G_MININT, G_MAXINT, 0, G_PARAM_READWRITE)); /* CHECKME */ + g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_GAMMA, g_param_spec_float ("gamma", "gamma", "gamma", 0.0, 5.0, 1.0, G_PARAM_READWRITE)); /* CHECKME */ + g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_INVERSION, g_param_spec_boolean ("inversion", "inversion", "inversion", TRUE, G_PARAM_READWRITE)); /* CHECKME */ + g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_RANDOMVAL, g_param_spec_int ("randomval", "randomval", "randomval", G_MININT, G_MAXINT, 0, G_PARAM_READWRITE)); /* CHECKME */ + g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_FRAMES_DISPLAYED, g_param_spec_int ("frames_displayed", "frames_displayed", "frames_displayed", G_MININT, G_MAXINT, 0, G_PARAM_READABLE)); /* CHECKME */ + g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_FRAME_TIME, g_param_spec_int ("frame_time", "frame_time", "frame_time", G_MININT, G_MAXINT, 0, G_PARAM_READABLE)); /* CHECKME */ gobject_class->set_property = gst_aasink_set_property; gobject_class->get_property = gst_aasink_get_property; @@ -238,7 +239,7 @@ gst_aasink_fixate (GstPad * pad, const GstCaps * caps) return newcaps; } if (gst_caps_structure_fixate_field_nearest_double (structure, "framerate", - 30.0)) { + 30.0)) { return newcaps; } @@ -282,7 +283,7 @@ gst_aasink_init (GstAASink * aasink) { aasink->sinkpad = gst_pad_new_from_template (gst_element_get_pad_template (GST_ELEMENT - (aasink), "sink"), "sink"); + (aasink), "sink"), "sink"); gst_element_add_pad (GST_ELEMENT (aasink), aasink->sinkpad); gst_pad_set_chain_function (aasink->sinkpad, gst_aasink_chain); gst_pad_set_link_function (aasink->sinkpad, gst_aasink_sinkconnect); @@ -330,12 +331,12 @@ gst_aasink_scale (GstAASink * aasink, gchar * src, gchar * dest, guchar *srcp = src; for (x = dw; x; x--) { - while (xpos >= 0x10000L) { - srcp++; - xpos -= 0x10000L; - } - *destp++ = *srcp; - xpos += xinc; + while (xpos >= 0x10000L) { + srcp++; + xpos -= 0x10000L; + } + *destp++ = *srcp; + xpos += xinc; } } dest += dw; @@ -355,12 +356,12 @@ gst_aasink_chain (GstPad * pad, GstData * _data) aasink = GST_AASINK (gst_pad_get_parent (pad)); - gst_aasink_scale (aasink, GST_BUFFER_DATA (buf), /* src */ - aa_image (aasink->context), /* dest */ - aasink->width, /* sw */ - aasink->height, /* sh */ - aa_imgwidth (aasink->context), /* dw */ - aa_imgheight (aasink->context)); /* dh */ + gst_aasink_scale (aasink, GST_BUFFER_DATA (buf), /* src */ + aa_image (aasink->context), /* dest */ + aasink->width, /* sw */ + aasink->height, /* sh */ + aa_imgwidth (aasink->context), /* dw */ + aa_imgheight (aasink->context)); /* dh */ GST_DEBUG ("videosink: clock wait: %" G_GUINT64_FORMAT, GST_BUFFER_TIMESTAMP (buf)); @@ -503,7 +504,7 @@ gst_aasink_open (GstAASink * aasink) aasink->context = aa_autoinit (&aasink->ascii_surf); if (aasink->context == NULL) { GST_ELEMENT_ERROR (GST_ELEMENT (aasink), LIBRARY, TOO_LAZY, (NULL), - ("error opening aalib context")); + ("error opening aalib context")); return FALSE; } aa_autoinitkbd (aasink->context, 0); @@ -535,7 +536,7 @@ gst_aasink_change_state (GstElement * element) } else { if (!GST_FLAG_IS_SET (element, GST_AASINK_OPEN)) { if (!gst_aasink_open (GST_AASINK (element))) - return GST_STATE_FAILURE; + return GST_STATE_FAILURE; } } diff --git a/ext/dv/demo-play.c b/ext/dv/demo-play.c index 7fb427a0..cf27283e 100644 --- a/ext/dv/demo-play.c +++ b/ext/dv/demo-play.c @@ -38,7 +38,7 @@ main (int argc, char *argv[]) } else { src = gst_element_factory_make ("filesrc", "src"); g_object_set (G_OBJECT (src), "location", argv[1], "bytesperread", 480, - NULL); + NULL); } dvdec = gst_element_factory_make ("dvdec", "decoder"); if (!dvdec) diff --git a/ext/dv/gstdvdec.c b/ext/dv/gstdvdec.c index 17dc45e2..5625237d 100644 --- a/ext/dv/gstdvdec.c +++ b/ext/dv/gstdvdec.c @@ -81,54 +81,54 @@ static GstStaticPadTemplate video_src_temp = GST_STATIC_PAD_TEMPLATE ("video", GST_PAD_SRC, GST_PAD_ALWAYS, GST_STATIC_CAPS ("video/x-raw-yuv, " - "format = (fourcc) YUY2, " - "width = (int) 720, " - "height = (int) { " - G_STRINGIFY (NTSC_HEIGHT) ", " G_STRINGIFY (PAL_HEIGHT) - " }, " - "framerate = (double) { " - G_STRINGIFY (PAL_FRAMERATE) ", " G_STRINGIFY (NTSC_FRAMERATE) - " }; " - "video/x-raw-rgb, " - "bpp = (int) 32, " - "depth = (int) 32, " - "endianness = (int) " G_STRINGIFY (G_BIG_ENDIAN) ", " - "red_mask = (int) 0x000000ff, " - "green_mask = (int) 0x0000ff00, " - "blue_mask = (int) 0x00ff0000, " - "width = (int) 720, " - "height = (int) { " - G_STRINGIFY (NTSC_HEIGHT) ", " G_STRINGIFY (PAL_HEIGHT) - " }, " - "framerate = (double) { " - G_STRINGIFY (PAL_FRAMERATE) ", " G_STRINGIFY (NTSC_FRAMERATE) - " }; " - "video/x-raw-rgb, " - "bpp = (int) 24, " - "depth = (int) 24, " - "endianness = (int) " G_STRINGIFY (G_BIG_ENDIAN) ", " - "red_mask = (int) 0x000000ff, " - "green_mask = (int) 0x0000ff00, " - "blue_mask = (int) 0x00ff0000, " - "width = (int) 720, " - "height = (int) { " - G_STRINGIFY (NTSC_HEIGHT) ", " G_STRINGIFY (PAL_HEIGHT) - " }, " - "framerate = (double) { " - G_STRINGIFY (PAL_FRAMERATE) ", " G_STRINGIFY (NTSC_FRAMERATE) - " }") + "format = (fourcc) YUY2, " + "width = (int) 720, " + "height = (int) { " + G_STRINGIFY (NTSC_HEIGHT) ", " G_STRINGIFY (PAL_HEIGHT) + " }, " + "framerate = (double) { " + G_STRINGIFY (PAL_FRAMERATE) ", " G_STRINGIFY (NTSC_FRAMERATE) + " }; " + "video/x-raw-rgb, " + "bpp = (int) 32, " + "depth = (int) 32, " + "endianness = (int) " G_STRINGIFY (G_BIG_ENDIAN) ", " + "red_mask = (int) 0x000000ff, " + "green_mask = (int) 0x0000ff00, " + "blue_mask = (int) 0x00ff0000, " + "width = (int) 720, " + "height = (int) { " + G_STRINGIFY (NTSC_HEIGHT) ", " G_STRINGIFY (PAL_HEIGHT) + " }, " + "framerate = (double) { " + G_STRINGIFY (PAL_FRAMERATE) ", " G_STRINGIFY (NTSC_FRAMERATE) + " }; " + "video/x-raw-rgb, " + "bpp = (int) 24, " + "depth = (int) 24, " + "endianness = (int) " G_STRINGIFY (G_BIG_ENDIAN) ", " + "red_mask = (int) 0x000000ff, " + "green_mask = (int) 0x0000ff00, " + "blue_mask = (int) 0x00ff0000, " + "width = (int) 720, " + "height = (int) { " + G_STRINGIFY (NTSC_HEIGHT) ", " G_STRINGIFY (PAL_HEIGHT) + " }, " + "framerate = (double) { " + G_STRINGIFY (PAL_FRAMERATE) ", " G_STRINGIFY (NTSC_FRAMERATE) + " }") ); static GstStaticPadTemplate audio_src_temp = GST_STATIC_PAD_TEMPLATE ("audio", 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, " - "endianness = (int) " G_STRINGIFY (G_LITTLE_ENDIAN) ", " - "rate = (int) [ 4000, 48000 ]") + "depth = (int) 16, " + "width = (int) 16, " + "signed = (boolean) TRUE, " + "channels = (int) 2, " + "endianness = (int) " G_STRINGIFY (G_LITTLE_ENDIAN) ", " + "rate = (int) [ 4000, 48000 ]") ); #define GST_TYPE_DVDEC_QUALITY (gst_dvdec_quality_get_type()) @@ -144,6 +144,7 @@ gst_dvdec_quality_get_type (void) {DV_QUALITY_AC_2, "DV_QUALITY_AC_2", "AC 2 something"}, {0, NULL, NULL} }; + qtype = g_flags_register_static ("GstDVDecQualityFlags", values); } return qtype; @@ -211,8 +212,9 @@ gst_dvdec_get_type (void) 0, (GInstanceInitFunc) gst_dvdec_init, }; + dvdec_type = - g_type_register_static (GST_TYPE_ELEMENT, "GstDVDec", &dvdec_info, 0); + g_type_register_static (GST_TYPE_ELEMENT, "GstDVDec", &dvdec_info, 0); } return dvdec_type; } @@ -261,13 +263,13 @@ gst_dvdec_class_init (GstDVDecClass * klass) g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_CLAMP_LUMA, g_param_spec_boolean ("clamp_luma", "Clamp luma", "Clamp luma", - FALSE, G_PARAM_READWRITE)); + FALSE, G_PARAM_READWRITE)); g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_CLAMP_CHROMA, g_param_spec_boolean ("clamp_chroma", "Clamp chroma", "Clamp chroma", - FALSE, G_PARAM_READWRITE)); + FALSE, G_PARAM_READWRITE)); g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_QUALITY, g_param_spec_flags ("quality", "Quality", "Decoding quality", - GST_TYPE_DVDEC_QUALITY, DV_QUALITY_BEST, G_PARAM_READWRITE)); + GST_TYPE_DVDEC_QUALITY, DV_QUALITY_BEST, G_PARAM_READWRITE)); gobject_class->set_property = gst_dvdec_set_property; gobject_class->get_property = gst_dvdec_get_property; @@ -355,7 +357,7 @@ gst_dvdec_init (GstDVDec * dvdec) for (i = 0; i < 4; i++) { dvdec->audio_buffers[i] = - (gint16 *) g_malloc (DV_AUDIO_MAX_SAMPLES * sizeof (gint16)); + (gint16 *) g_malloc (DV_AUDIO_MAX_SAMPLES * sizeof (gint16)); } } @@ -396,29 +398,29 @@ gst_dvdec_src_convert (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: - if (pad == dvdec->videosrcpad) - scale = 720 * dvdec->height * dvdec->bpp; - else if (pad == dvdec->audiosrcpad) - scale = dvdec->decoder->audio->num_channels * 2; - /* fallthrough */ - case GST_FORMAT_DEFAULT: - if (pad == dvdec->videosrcpad) - *dest_value = src_value * dvdec->framerate * scale / GST_SECOND; - else if (pad == dvdec->audiosrcpad) - *dest_value = - src_value * dvdec->decoder->audio->frequency * scale / - GST_SECOND; - break; - default: - res = FALSE; + case GST_FORMAT_BYTES: + if (pad == dvdec->videosrcpad) + scale = 720 * dvdec->height * dvdec->bpp; + else if (pad == dvdec->audiosrcpad) + scale = dvdec->decoder->audio->num_channels * 2; + /* fallthrough */ + case GST_FORMAT_DEFAULT: + if (pad == dvdec->videosrcpad) + *dest_value = src_value * dvdec->framerate * scale / GST_SECOND; + else if (pad == dvdec->audiosrcpad) + *dest_value = + src_value * dvdec->decoder->audio->frequency * scale / + GST_SECOND; + break; + default: + res = FALSE; } break; default: @@ -442,34 +444,34 @@ gst_dvdec_sink_convert (GstPad * pad, GstFormat src_format, gint64 src_value, switch (src_format) { case GST_FORMAT_BYTES: switch (*dest_format) { - case GST_FORMAT_TIME: - { - guint64 frame; - - /* get frame number */ - frame = src_value / dvdec->length; - - *dest_value = (frame * GST_SECOND) / dvdec->framerate; - break; - } - default: - res = FALSE; + case GST_FORMAT_TIME: + { + guint64 frame; + + /* get frame number */ + frame = src_value / dvdec->length; + + *dest_value = (frame * GST_SECOND) / dvdec->framerate; + break; + } + default: + res = FALSE; } break; case GST_FORMAT_TIME: switch (*dest_format) { - case GST_FORMAT_BYTES: - { - guint64 frame; - - /* calculate the frame */ - frame = src_value * dvdec->framerate / GST_SECOND; - /* calculate the offset */ - *dest_value = frame * dvdec->length; - break; - } - default: - res = FALSE; + case GST_FORMAT_BYTES: + { + guint64 frame; + + /* calculate the frame */ + frame = src_value * dvdec->framerate / GST_SECOND; + /* calculate the offset */ + *dest_value = frame * dvdec->length; + break; + } + default: + res = FALSE; } break; default: @@ -486,6 +488,7 @@ gst_dvdec_get_src_query_types (GstPad * pad) GST_QUERY_POSITION, 0 }; + return src_query_types; } @@ -501,31 +504,31 @@ gst_dvdec_src_query (GstPad * pad, GstQueryType type, switch (type) { case GST_QUERY_TOTAL: switch (*format) { - default: - { - guint64 len; - GstFormat tmp_format; - - len = gst_bytestream_length (dvdec->bs); - tmp_format = GST_FORMAT_TIME; - if (len == -1 || !gst_pad_convert (dvdec->sinkpad, - GST_FORMAT_BYTES, len, &tmp_format, value)) { - return FALSE; - } - if (!gst_pad_convert (pad, GST_FORMAT_TIME, *value, format, value)) { - return FALSE; - } - break; - } + default: + { + guint64 len; + GstFormat tmp_format; + + len = gst_bytestream_length (dvdec->bs); + tmp_format = GST_FORMAT_TIME; + if (len == -1 || !gst_pad_convert (dvdec->sinkpad, + GST_FORMAT_BYTES, len, &tmp_format, value)) { + return FALSE; + } + if (!gst_pad_convert (pad, GST_FORMAT_TIME, *value, format, value)) { + return FALSE; + } + break; + } } break; case GST_QUERY_POSITION: switch (*format) { - default: - res = - gst_pad_convert (pad, GST_FORMAT_TIME, dvdec->next_ts, format, - value); - break; + default: + res = + gst_pad_convert (pad, GST_FORMAT_TIME, dvdec->next_ts, format, + value); + break; } break; default: @@ -575,17 +578,17 @@ gst_dvdec_handle_sink_event (GstDVDec * dvdec) format = GST_FORMAT_TIME; /* try to get a timestamp from the discont formats */ for (i = 0; i < GST_EVENT_DISCONT_OFFSET_LEN (event); i++) { - if (gst_pad_convert (dvdec->sinkpad, - GST_EVENT_DISCONT_OFFSET (event, i).format, - GST_EVENT_DISCONT_OFFSET (event, i).value, - &format, &dvdec->next_ts)) { - found = TRUE; - break; - } + if (gst_pad_convert (dvdec->sinkpad, + GST_EVENT_DISCONT_OFFSET (event, i).format, + GST_EVENT_DISCONT_OFFSET (event, i).value, + &format, &dvdec->next_ts)) { + found = TRUE; + break; + } } /* assume 0 then */ if (!found) { - dvdec->next_ts = 0LL; + dvdec->next_ts = 0LL; } dvdec->need_discont = TRUE; break; @@ -615,11 +618,11 @@ gst_dvdec_handle_src_event (GstPad * pad, GstEvent * event) /* first bring the format to time */ format = GST_FORMAT_TIME; if (!gst_pad_convert (pad, - GST_EVENT_SEEK_FORMAT (event), - GST_EVENT_SEEK_ENDOFFSET (event), &format, &position)) { - /* could not convert seek format to time offset */ - res = FALSE; - break; + GST_EVENT_SEEK_FORMAT (event), + GST_EVENT_SEEK_ENDOFFSET (event), &format, &position)) { + /* could not convert seek format to time offset */ + res = FALSE; + break; } dvdec->end_position = position; @@ -633,27 +636,27 @@ gst_dvdec_handle_src_event (GstPad * pad, GstEvent * event) /* first bring the format to time */ format = GST_FORMAT_TIME; if (!gst_pad_convert (pad, - GST_EVENT_SEEK_FORMAT (event), - GST_EVENT_SEEK_OFFSET (event), &format, &position)) { - /* could not convert seek format to time offset */ - res = FALSE; - break; + GST_EVENT_SEEK_FORMAT (event), + GST_EVENT_SEEK_OFFSET (event), &format, &position)) { + /* could not convert seek format to time offset */ + res = FALSE; + break; } dvdec->next_ts = position; /* then try to figure out the byteoffset for this time */ format = GST_FORMAT_BYTES; if (!gst_pad_convert (dvdec->sinkpad, GST_FORMAT_TIME, position, - &format, &position)) { - /* could not convert seek format to byte offset */ - res = FALSE; - break; + &format, &position)) { + /* could not convert seek format to byte offset */ + res = FALSE; + break; } /* seek to offset */ if (!gst_bytestream_seek (dvdec->bs, position, GST_SEEK_METHOD_SET)) { - res = FALSE; + res = FALSE; } if (GST_EVENT_TYPE (event) != GST_EVENT_SEEK_SEGMENT) - dvdec->end_position = -1; + dvdec->end_position = -1; break; } default: @@ -683,8 +686,8 @@ gst_dvdec_video_getcaps (GstPad * pad) GstStructure *structure = gst_caps_get_structure (caps, i); gst_structure_set (structure, - "height", G_TYPE_INT, dvdec->height, - "framerate", G_TYPE_DOUBLE, dvdec->framerate, NULL); + "height", G_TYPE_INT, dvdec->height, + "framerate", G_TYPE_DOUBLE, dvdec->framerate, NULL); } } @@ -827,21 +830,21 @@ gst_dvdec_loop (GstElement * element) gint i, j; dv_decode_full_audio (dvdec->decoder, GST_BUFFER_DATA (buf), - dvdec->audio_buffers); + dvdec->audio_buffers); if ((dvdec->decoder->audio->frequency != dvdec->frequency) || - (dvdec->decoder->audio->num_channels != dvdec->channels)) { + (dvdec->decoder->audio->num_channels != dvdec->channels)) { if (!gst_pad_set_explicit_caps (dvdec->audiosrcpad, - gst_caps_new_simple ("audio/x-raw-int", - "rate", G_TYPE_INT, dvdec->decoder->audio->frequency, - "depth", G_TYPE_INT, 16, - "width", G_TYPE_INT, 16, - "signed", G_TYPE_BOOLEAN, TRUE, - "channels", G_TYPE_INT, dvdec->decoder->audio->num_channels, - "endianness", G_TYPE_INT, G_LITTLE_ENDIAN, NULL))) { - gst_buffer_unref (buf); - GST_ELEMENT_ERROR (dvdec, CORE, NEGOTIATION, (NULL), (NULL)); - return; + gst_caps_new_simple ("audio/x-raw-int", + "rate", G_TYPE_INT, dvdec->decoder->audio->frequency, + "depth", G_TYPE_INT, 16, + "width", G_TYPE_INT, 16, + "signed", G_TYPE_BOOLEAN, TRUE, + "channels", G_TYPE_INT, dvdec->decoder->audio->num_channels, + "endianness", G_TYPE_INT, G_LITTLE_ENDIAN, NULL))) { + gst_buffer_unref (buf); + GST_ELEMENT_ERROR (dvdec, CORE, NEGOTIATION, (NULL), (NULL)); + return; } dvdec->frequency = dvdec->decoder->audio->frequency; @@ -850,14 +853,14 @@ gst_dvdec_loop (GstElement * element) outbuf = gst_buffer_new (); GST_BUFFER_SIZE (outbuf) = dvdec->decoder->audio->samples_this_frame * - sizeof (gint16) * dvdec->decoder->audio->num_channels; + sizeof (gint16) * dvdec->decoder->audio->num_channels; GST_BUFFER_DATA (outbuf) = g_malloc (GST_BUFFER_SIZE (outbuf)); a_ptr = (gint16 *) GST_BUFFER_DATA (outbuf); for (i = 0; i < dvdec->decoder->audio->samples_this_frame; i++) { for (j = 0; j < dvdec->decoder->audio->num_channels; j++) { - *(a_ptr++) = dvdec->audio_buffers[j][i]; + *(a_ptr++) = dvdec->audio_buffers[j][i]; } } gst_dvdec_push (dvdec, outbuf, dvdec->audiosrcpad, ts); @@ -885,7 +888,7 @@ gst_dvdec_loop (GstElement * element) } dv_decode_full_frame (dvdec->decoder, GST_BUFFER_DATA (buf), - dvdec->space, outframe_ptrs, outframe_pitches); + dvdec->space, outframe_ptrs, outframe_pitches); gst_dvdec_push (dvdec, outbuf, dvdec->videosrcpad, ts); } @@ -913,7 +916,7 @@ gst_dvdec_change_state (GstElement * element) case GST_STATE_READY_TO_PAUSED: dvdec->bs = gst_bytestream_new (dvdec->sinkpad); dvdec->decoder = - dv_decoder_new (0, dvdec->clamp_luma, dvdec->clamp_chroma); + dv_decoder_new (0, dvdec->clamp_luma, dvdec->clamp_chroma); dvdec->decoder->quality = dvdec->quality; break; case GST_STATE_PAUSED_TO_PLAYING: @@ -1006,7 +1009,7 @@ plugin_init (GstPlugin * plugin) return FALSE; if (!gst_element_register (plugin, "dvdec", GST_RANK_PRIMARY, - gst_dvdec_get_type ())) + gst_dvdec_get_type ())) return FALSE; return TRUE; diff --git a/ext/esd/esdmon.c b/ext/esd/esdmon.c index 4a7f4ca1..d06af758 100644 --- a/ext/esd/esdmon.c +++ b/ext/esd/esdmon.c @@ -58,16 +58,16 @@ static GstStaticPadTemplate src_factory = GST_STATIC_PAD_TEMPLATE ("src", GST_PAD_SRC, GST_PAD_ALWAYS, GST_STATIC_CAPS ("audio/x-raw-int, " - "endianness = (int) " G_STRINGIFY (G_BYTE_ORDER) ", " - "signed = (boolean) TRUE, " - "width = (int) 16, " - "depth = (int) 16, " - "rate = [ 8000, 96000 ], " - "channels = [ 1, 2 ]; " - "audio/x-raw-int, " - "signed = (boolean) FALSE, " - "width = (int) 8, " - "depth = (int) 8, " "rate = [ 8000, 96000 ], " "channels = [ 1, 2 ]") + "endianness = (int) " G_STRINGIFY (G_BYTE_ORDER) ", " + "signed = (boolean) TRUE, " + "width = (int) 16, " + "depth = (int) 16, " + "rate = [ 8000, 96000 ], " + "channels = [ 1, 2 ]; " + "audio/x-raw-int, " + "signed = (boolean) FALSE, " + "width = (int) 8, " + "depth = (int) 8, " "rate = [ 8000, 96000 ], " "channels = [ 1, 2 ]") ); static void gst_esdmon_base_init (gpointer g_class); @@ -96,9 +96,10 @@ gst_esdmon_depths_get_type (void) {16, "16", "16 Bits"}, {0, NULL, NULL}, }; + if (!esdmon_depths_type) { esdmon_depths_type = - g_enum_register_static ("GstEsdmonDepths", esdmon_depths); + g_enum_register_static ("GstEsdmonDepths", esdmon_depths); } return esdmon_depths_type; } @@ -113,9 +114,10 @@ gst_esdmon_channels_get_type (void) {2, "2", "Stereo"}, {0, NULL, NULL}, }; + if (!esdmon_channels_type) { esdmon_channels_type = - g_enum_register_static ("GstEsdmonChannels", esdmon_channels); + g_enum_register_static ("GstEsdmonChannels", esdmon_channels); } return esdmon_channels_type; } @@ -142,8 +144,9 @@ gst_esdmon_get_type (void) 0, gst_esdmon_init, }; + esdmon_type = - g_type_register_static (GST_TYPE_ELEMENT, "GstEsdmon", &esdmon_info, 0); + g_type_register_static (GST_TYPE_ELEMENT, "GstEsdmon", &esdmon_info, 0); } return esdmon_type; } @@ -166,12 +169,12 @@ gst_esdmon_class_init (gpointer g_class, gpointer class_data) parent_class = g_type_class_peek_parent (g_class); - g_object_class_install_property (gobject_class, ARG_BYTESPERREAD, g_param_spec_ulong ("bytes_per_read", "bytes_per_read", "bytes_per_read", 0, G_MAXULONG, 0, G_PARAM_READWRITE)); /* CHECKME */ - g_object_class_install_property (gobject_class, ARG_CUROFFSET, g_param_spec_ulong ("curoffset", "curoffset", "curoffset", 0, G_MAXULONG, 0, G_PARAM_READABLE)); /* CHECKME */ - g_object_class_install_property (gobject_class, ARG_DEPTH, g_param_spec_enum ("depth", "depth", "depth", GST_TYPE_ESDMON_DEPTHS, 16, G_PARAM_READWRITE)); /* CHECKME! */ - g_object_class_install_property (gobject_class, ARG_CHANNELS, g_param_spec_enum ("channels", "channels", "channels", GST_TYPE_ESDMON_CHANNELS, 2, G_PARAM_READWRITE)); /* CHECKME! */ - g_object_class_install_property (gobject_class, ARG_RATE, g_param_spec_int ("frequency", "frequency", "frequency", G_MININT, G_MAXINT, 0, G_PARAM_READWRITE)); /* CHECKME */ - g_object_class_install_property (gobject_class, ARG_HOST, g_param_spec_string ("host", "host", "host", NULL, G_PARAM_READWRITE)); /* CHECKME */ + g_object_class_install_property (gobject_class, ARG_BYTESPERREAD, g_param_spec_ulong ("bytes_per_read", "bytes_per_read", "bytes_per_read", 0, G_MAXULONG, 0, G_PARAM_READWRITE)); /* CHECKME */ + g_object_class_install_property (gobject_class, ARG_CUROFFSET, g_param_spec_ulong ("curoffset", "curoffset", "curoffset", 0, G_MAXULONG, 0, G_PARAM_READABLE)); /* CHECKME */ + g_object_class_install_property (gobject_class, ARG_DEPTH, g_param_spec_enum ("depth", "depth", "depth", GST_TYPE_ESDMON_DEPTHS, 16, G_PARAM_READWRITE)); /* CHECKME! */ + g_object_class_install_property (gobject_class, ARG_CHANNELS, g_param_spec_enum ("channels", "channels", "channels", GST_TYPE_ESDMON_CHANNELS, 2, G_PARAM_READWRITE)); /* CHECKME! */ + g_object_class_install_property (gobject_class, ARG_RATE, g_param_spec_int ("frequency", "frequency", "frequency", G_MININT, G_MAXINT, 0, G_PARAM_READWRITE)); /* CHECKME */ + g_object_class_install_property (gobject_class, ARG_HOST, g_param_spec_string ("host", "host", "host", NULL, G_PARAM_READWRITE)); /* CHECKME */ gobject_class->set_property = gst_esdmon_set_property; gobject_class->get_property = gst_esdmon_get_property; @@ -246,13 +249,13 @@ gst_esdmon_get (GstPad * pad) /* set caps on src pad */ if (gst_pad_set_explicit_caps (esdmon->srcpad, - gst_caps_new_simple ("audio/x-raw-int", - "endianness", G_TYPE_INT, G_BYTE_ORDER, - "signed", G_TYPE_BOOLEAN, sign, - "width", G_TYPE_INT, esdmon->depth, - "depth", G_TYPE_INT, esdmon->depth, - "rate", G_TYPE_INT, esdmon->frequency, - "channels", G_TYPE_INT, esdmon->channels)) <= 0) { + gst_caps_new_simple ("audio/x-raw-int", + "endianness", G_TYPE_INT, G_BYTE_ORDER, + "signed", G_TYPE_BOOLEAN, sign, + "width", G_TYPE_INT, esdmon->depth, + "depth", G_TYPE_INT, esdmon->depth, + "rate", G_TYPE_INT, esdmon->frequency, + "channels", G_TYPE_INT, esdmon->channels)) <= 0) { GST_ELEMENT_ERROR (esdmon, CORE, NEGOTIATION, (NULL), (NULL)); return NULL; } @@ -300,7 +303,7 @@ gst_esdmon_set_property (GObject * object, guint prop_id, const GValue * value, case ARG_RATE: /* Preserve the timestamps */ esdmon->basetime = - esdmon->samples_since_basetime * GST_SECOND / esdmon->frequency; + esdmon->samples_since_basetime * GST_SECOND / esdmon->frequency; esdmon->samples_since_basetime = 0; /* Set the new frequency */ @@ -309,11 +312,11 @@ gst_esdmon_set_property (GObject * object, guint prop_id, const GValue * value, break; case ARG_HOST: if (esdmon->host != NULL) - g_free (esdmon->host); + g_free (esdmon->host); if (g_value_get_string (value) == NULL) - esdmon->host = NULL; + esdmon->host = NULL; else - esdmon->host = g_strdup (g_value_get_string (value)); + esdmon->host = g_strdup (g_value_get_string (value)); break; default: break; @@ -432,7 +435,7 @@ gst_esdmon_change_state (GstElement * element) } else { if (!GST_FLAG_IS_SET (element, GST_ESDMON_OPEN)) { if (!gst_esdmon_open_audio (GST_ESDMON (element))) - return GST_STATE_FAILURE; + return GST_STATE_FAILURE; } } diff --git a/ext/esd/esdsink.c b/ext/esd/esdsink.c index ce7045e7..c6c5be4d 100644 --- a/ext/esd/esdsink.c +++ b/ext/esd/esdsink.c @@ -59,10 +59,10 @@ static GstStaticPadTemplate sink_factory = GST_STATIC_PAD_TEMPLATE ("sink", GST_PAD_SINK, GST_PAD_ALWAYS, GST_STATIC_CAPS ("audio/x-raw-int, " - "endianness = (int) " G_STRINGIFY (G_BYTE_ORDER) ", " - "signed = (boolean) TRUE, " - "width = (int) 16, " - "depth = (int) 16, " "rate = 44100, " "channels = 2") + "endianness = (int) " G_STRINGIFY (G_BYTE_ORDER) ", " + "signed = (boolean) TRUE, " + "width = (int) 16, " + "depth = (int) 16, " "rate = 44100, " "channels = 2") ); static void gst_esdsink_base_init (gpointer g_class); @@ -104,9 +104,10 @@ gst_esdsink_get_type (void) 0, gst_esdsink_init, }; + esdsink_type = - g_type_register_static (GST_TYPE_ELEMENT, "GstEsdsink", &esdsink_info, - 0); + g_type_register_static (GST_TYPE_ELEMENT, "GstEsdsink", &esdsink_info, + 0); } return esdsink_type; } @@ -129,17 +130,17 @@ gst_esdsink_class_init (gpointer g_class, gpointer class_data) parent_class = g_type_class_peek_parent (g_class); - g_object_class_install_property (gobject_class, ARG_MUTE, g_param_spec_boolean ("mute", "mute", "mute", TRUE, G_PARAM_READWRITE)); /* CHECKME */ - g_object_class_install_property (gobject_class, ARG_HOST, g_param_spec_string ("host", "host", "host", NULL, G_PARAM_READWRITE)); /* CHECKME */ + g_object_class_install_property (gobject_class, ARG_MUTE, g_param_spec_boolean ("mute", "mute", "mute", TRUE, G_PARAM_READWRITE)); /* CHECKME */ + g_object_class_install_property (gobject_class, ARG_HOST, g_param_spec_string ("host", "host", "host", NULL, G_PARAM_READWRITE)); /* CHECKME */ g_object_class_install_property (gobject_class, ARG_SYNC, g_param_spec_boolean ("sync", "sync", "Synchronize output to clock", - TRUE, G_PARAM_READWRITE)); + TRUE, G_PARAM_READWRITE)); #if 0 /* This option is disabled because it is dumb in GStreamer's architecture. */ g_object_class_install_property (gobject_class, ARG_FALLBACK, g_param_spec_boolean ("fallback", "fallback", - "Fall back to using OSS if Esound daemon is not present", FALSE, - G_PARAM_READWRITE)); + "Fall back to using OSS if Esound daemon is not present", FALSE, + G_PARAM_READWRITE)); #endif gobject_class->set_property = gst_esdsink_set_property; @@ -255,7 +256,7 @@ gst_esdsink_chain (GstPad * pad, GstData * _data) if (!esdsink->negotiated) { GST_ELEMENT_ERROR (esdsink, CORE, NEGOTIATION, (NULL), - ("element wasn't negotiated before chain function")); + ("element wasn't negotiated before chain function")); goto done; } @@ -264,13 +265,13 @@ gst_esdsink_chain (GstPad * pad, GstData * _data) switch (GST_EVENT_TYPE (event)) { case GST_EVENT_EOS: - gst_audio_clock_set_active (GST_AUDIO_CLOCK (esdsink->provided_clock), - FALSE); - gst_pad_event_default (pad, event); - return; + gst_audio_clock_set_active (GST_AUDIO_CLOCK (esdsink->provided_clock), + FALSE); + gst_pad_event_default (pad, event); + return; default: - gst_pad_event_default (pad, event); - return; + gst_pad_event_default (pad, event); + return; } gst_event_unref (event); return; @@ -285,22 +286,22 @@ gst_esdsink_chain (GstPad * pad, GstData * _data) to_write = size; GST_LOG ("fd=%d data=%p size=%d", - esdsink->fd, GST_BUFFER_DATA (buf), GST_BUFFER_SIZE (buf)); + esdsink->fd, GST_BUFFER_DATA (buf), GST_BUFFER_SIZE (buf)); while (to_write > 0) { - int done; + int done; - done = write (esdsink->fd, data, to_write); + done = write (esdsink->fd, data, to_write); - if (done < 0) { - if (errno == EINTR) { - goto done; - } - g_assert_not_reached (); - } + if (done < 0) { + if (errno == EINTR) { + goto done; + } + g_assert_not_reached (); + } - to_write -= done; - data += done; - esdsink->handled += done / esdsink->bytes_per_sample; + to_write -= done; + data += done; + esdsink->handled += done / esdsink->bytes_per_sample; } } @@ -330,9 +331,9 @@ gst_esdsink_set_property (GObject * object, guint prop_id, const GValue * value, case ARG_HOST: g_free (esdsink->host); if (g_value_get_string (value) == NULL) - esdsink->host = NULL; + esdsink->host = NULL; else - esdsink->host = g_strdup (g_value_get_string (value)); + esdsink->host = g_strdup (g_value_get_string (value)); break; case ARG_SYNC: esdsink->sync = g_value_get_boolean (value); @@ -376,7 +377,7 @@ gboolean gst_esdsink_factory_init (GstPlugin * plugin) { if (!gst_element_register (plugin, "esdsink", GST_RANK_NONE, - GST_TYPE_ESDSINK)) + GST_TYPE_ESDSINK)) return FALSE; return TRUE; @@ -399,7 +400,7 @@ gst_esdsink_open_audio (GstEsdsink * sink) esdformat |= ESD_BITS8; else { GST_ELEMENT_ERROR (sink, STREAM, FORMAT, (NULL), - ("invalid bit depth (%d)", sink->depth)); + ("invalid bit depth (%d)", sink->depth)); return FALSE; } @@ -409,22 +410,22 @@ gst_esdsink_open_audio (GstEsdsink * sink) esdformat |= ESD_MONO; else { GST_ELEMENT_ERROR (sink, STREAM, FORMAT, (NULL), - ("invalid number of channels (%d)", sink->channels)); + ("invalid number of channels (%d)", sink->channels)); return FALSE; } GST_INFO ("attempting to open connection to esound server"); if (sink->fallback) { sink->fd = - esd_play_stream_fallback (esdformat, sink->frequency, sink->host, - connname); + esd_play_stream_fallback (esdformat, sink->frequency, sink->host, + connname); } else { sink->fd = - esd_play_stream (esdformat, sink->frequency, sink->host, connname); + esd_play_stream (esdformat, sink->frequency, sink->host, connname); } if (sink->fd < 0) { GST_ELEMENT_ERROR (sink, RESOURCE, OPEN_WRITE, (NULL), - ("can't open connection to esound server")); + ("can't open connection to esound server")); return FALSE; } GST_INFO ("successfully opened connection to esound server"); @@ -454,18 +455,18 @@ gst_esdsink_change_state (GstElement * element) switch (GST_STATE_TRANSITION (element)) { case GST_STATE_NULL_TO_READY: if (!gst_esdsink_open_audio (GST_ESDSINK (element))) { - return GST_STATE_FAILURE; + return GST_STATE_FAILURE; } break; case GST_STATE_READY_TO_PAUSED: break; case GST_STATE_PAUSED_TO_PLAYING: gst_audio_clock_set_active (GST_AUDIO_CLOCK (esdsink->provided_clock), - TRUE); + TRUE); break; case GST_STATE_PLAYING_TO_PAUSED: gst_audio_clock_set_active (GST_AUDIO_CLOCK (esdsink->provided_clock), - FALSE); + FALSE); esdsink->resync = TRUE; break; case GST_STATE_PAUSED_TO_READY: diff --git a/ext/flac/gstflac.c b/ext/flac/gstflac.c index c1dba934..9432713f 100644 --- a/ext/flac/gstflac.c +++ b/ext/flac/gstflac.c @@ -38,15 +38,15 @@ plugin_init (GstPlugin * plugin) return FALSE; if (!gst_element_register (plugin, "flacenc", GST_RANK_NONE, - GST_TYPE_FLACENC)) + GST_TYPE_FLACENC)) return FALSE; if (!gst_element_register (plugin, "flacdec", GST_RANK_PRIMARY, - GST_TYPE_FLACDEC)) + GST_TYPE_FLACDEC)) return FALSE; if (!gst_element_register (plugin, "flactag", GST_RANK_PRIMARY, - gst_flac_tag_get_type ())) + gst_flac_tag_get_type ())) return FALSE; return TRUE; diff --git a/ext/flac/gstflacdec.c b/ext/flac/gstflacdec.c index 3882df1a..af5e8b97 100644 --- a/ext/flac/gstflacdec.c +++ b/ext/flac/gstflacdec.c @@ -112,8 +112,9 @@ flacdec_get_type (void) 0, (GInstanceInitFunc) gst_flacdec_init, }; + flacdec_type = - g_type_register_static (GST_TYPE_ELEMENT, "FlacDec", &flacdec_info, 0); + g_type_register_static (GST_TYPE_ELEMENT, "FlacDec", &flacdec_info, 0); } return flacdec_type; } @@ -212,9 +213,9 @@ gst_flacdec_init (FlacDec * flacdec) #else FLAC__seekable_stream_decoder_set_write_callback (flacdec->decoder, (FLAC__StreamDecoderWriteStatus (*) - (const FLAC__SeekableStreamDecoder * decoder, - const FLAC__Frame * frame, - const FLAC__int32 * buffer[], void *client_data)) + (const FLAC__SeekableStreamDecoder * decoder, + const FLAC__Frame * frame, + const FLAC__int32 * buffer[], void *client_data)) (gst_flacdec_write)); #endif FLAC__seekable_stream_decoder_set_metadata_respond (flacdec->decoder, @@ -394,29 +395,29 @@ gst_flacdec_read (const FLAC__SeekableStreamDecoder * decoder, gst_bytestream_get_status (flacdec->bs, &avail, &event); switch (GST_EVENT_TYPE (event)) { - case GST_EVENT_EOS: - GST_DEBUG ("eos"); - flacdec->eos = TRUE; - gst_event_unref (event); - if (avail == 0) { - return 0; - } - break; - case GST_EVENT_DISCONTINUOUS: - GST_DEBUG ("discont"); - - /* we are not yet sending the discont, we'll do that in the next write operation */ - flacdec->need_discont = TRUE; - gst_event_unref (event); - break; - default: - gst_pad_event_default (flacdec->sinkpad, event); - break; + case GST_EVENT_EOS: + GST_DEBUG ("eos"); + flacdec->eos = TRUE; + gst_event_unref (event); + if (avail == 0) { + return 0; + } + break; + case GST_EVENT_DISCONTINUOUS: + GST_DEBUG ("discont"); + + /* we are not yet sending the discont, we'll do that in the next write operation */ + flacdec->need_discont = TRUE; + gst_event_unref (event); + break; + default: + gst_pad_event_default (flacdec->sinkpad, event); + break; } if (avail > 0) - insize = gst_bytestream_peek_bytes (flacdec->bs, &indata, avail); + insize = gst_bytestream_peek_bytes (flacdec->bs, &indata, avail); else - insize = 0; + insize = 0; } } @@ -450,36 +451,36 @@ gst_flacdec_write (const FLAC__SeekableStreamDecoder * decoder, if (!GST_PAD_CAPS (flacdec->srcpad)) { if (flacdec->seek_pending) { - flacdec->total_samples = flacdec->seek_value; + flacdec->total_samples = flacdec->seek_value; } if (GST_PAD_IS_USABLE (flacdec->srcpad)) { - GST_DEBUG ("send discont"); - - format = GST_FORMAT_TIME; - gst_pad_convert (flacdec->srcpad, GST_FORMAT_DEFAULT, - flacdec->total_samples, &format, &time); - format = GST_FORMAT_BYTES; - gst_pad_convert (flacdec->srcpad, GST_FORMAT_DEFAULT, - flacdec->total_samples, &format, &bytes); - discont = gst_event_new_discontinuous (FALSE, GST_FORMAT_TIME, time, - GST_FORMAT_BYTES, bytes, - GST_FORMAT_DEFAULT, flacdec->total_samples, NULL); - - gst_pad_push (flacdec->srcpad, GST_DATA (discont)); + GST_DEBUG ("send discont"); + + format = GST_FORMAT_TIME; + gst_pad_convert (flacdec->srcpad, GST_FORMAT_DEFAULT, + flacdec->total_samples, &format, &time); + format = GST_FORMAT_BYTES; + gst_pad_convert (flacdec->srcpad, GST_FORMAT_DEFAULT, + flacdec->total_samples, &format, &bytes); + discont = gst_event_new_discontinuous (FALSE, GST_FORMAT_TIME, time, + GST_FORMAT_BYTES, bytes, + GST_FORMAT_DEFAULT, flacdec->total_samples, NULL); + + gst_pad_push (flacdec->srcpad, GST_DATA (discont)); } } } if (!GST_PAD_CAPS (flacdec->srcpad)) { gst_pad_set_explicit_caps (flacdec->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, depth, - "depth", G_TYPE_INT, depth, - "rate", G_TYPE_INT, frame->header.sample_rate, - "channels", G_TYPE_INT, channels, NULL)); + gst_caps_new_simple ("audio/x-raw-int", + "endianness", G_TYPE_INT, G_BYTE_ORDER, + "signed", G_TYPE_BOOLEAN, TRUE, + "width", G_TYPE_INT, depth, + "depth", G_TYPE_INT, depth, + "rate", G_TYPE_INT, frame->header.sample_rate, + "channels", G_TYPE_INT, channels, NULL)); flacdec->depth = depth; flacdec->channels = channels; @@ -491,23 +492,23 @@ gst_flacdec_write (const FLAC__SeekableStreamDecoder * decoder, GST_BUFFER_SIZE (outbuf) = samples * channels * ((depth + 7) >> 3); GST_BUFFER_DATA (outbuf) = g_malloc (GST_BUFFER_SIZE (outbuf)); GST_BUFFER_TIMESTAMP (outbuf) = - flacdec->total_samples * GST_SECOND / frame->header.sample_rate; + flacdec->total_samples * GST_SECOND / frame->header.sample_rate; if (depth == 8) { guint8 *outbuffer = (guint8 *) GST_BUFFER_DATA (outbuf); for (i = 0; i < samples; i++) { - for (j = 0; j < channels; j++) { - *outbuffer++ = (guint8) buffer[j][i]; - } + for (j = 0; j < channels; j++) { + *outbuffer++ = (guint8) buffer[j][i]; + } } } else if (depth == 16) { guint16 *outbuffer = (guint16 *) GST_BUFFER_DATA (outbuf); for (i = 0; i < samples; i++) { - for (j = 0; j < channels; j++) { - *outbuffer++ = (guint16) buffer[j][i]; - } + for (j = 0; j < channels; j++) { + *outbuffer++ = (guint16) buffer[j][i]; + } } } else { g_warning ("flacdec: invalid depth %d found\n", depth); @@ -536,7 +537,7 @@ gst_flacdec_loop (GstElement * element) res = FLAC__seekable_stream_decoder_init (flacdec->decoder); if (res != FLAC__SEEKABLE_STREAM_DECODER_OK) { GST_ELEMENT_ERROR (flacdec, LIBRARY, INIT, (NULL), - (FLAC__SeekableStreamDecoderStateString[res])); + (FLAC__SeekableStreamDecoderStateString[res])); return; } /* FLAC__seekable_stream_decoder_process_metadata (flacdec->decoder); */ @@ -547,7 +548,7 @@ gst_flacdec_loop (GstElement * element) GST_DEBUG ("perform seek to sample %" G_GINT64_FORMAT, flacdec->seek_value); if (FLAC__seekable_stream_decoder_seek_absolute (flacdec->decoder, - flacdec->seek_value)) { + flacdec->seek_value)) { flacdec->total_samples = flacdec->seek_value; GST_DEBUG ("seek done"); } else { @@ -585,6 +586,7 @@ gst_flacdec_get_src_formats (GstPad * pad) GST_FORMAT_TIME, 0, }; + return formats; } @@ -602,47 +604,47 @@ gst_flacdec_convert_src (GstPad * pad, GstFormat src_format, gint64 src_value, switch (src_format) { case GST_FORMAT_BYTES: switch (*dest_format) { - case GST_FORMAT_DEFAULT: - if (bytes_per_sample == 0) - return FALSE; - *dest_value = src_value / bytes_per_sample; - break; - case GST_FORMAT_TIME: - { - gint byterate = bytes_per_sample * flacdec->frequency; - - if (byterate == 0) - return FALSE; - *dest_value = src_value * GST_SECOND / byterate; - break; - } - default: - res = FALSE; + case GST_FORMAT_DEFAULT: + if (bytes_per_sample == 0) + return FALSE; + *dest_value = src_value / bytes_per_sample; + break; + case GST_FORMAT_TIME: + { + gint byterate = bytes_per_sample * flacdec->frequency; + + if (byterate == 0) + return FALSE; + *dest_value = src_value * GST_SECOND / byterate; + break; + } + default: + res = FALSE; } break; case GST_FORMAT_DEFAULT: switch (*dest_format) { - case GST_FORMAT_BYTES: - *dest_value = src_value * bytes_per_sample; - break; - case GST_FORMAT_TIME: - if (flacdec->frequency == 0) - return FALSE; - *dest_value = src_value * GST_SECOND / flacdec->frequency; - break; - default: - res = FALSE; + case GST_FORMAT_BYTES: + *dest_value = src_value * bytes_per_sample; + break; + case GST_FORMAT_TIME: + if (flacdec->frequency == 0) + return FALSE; + *dest_value = src_value * GST_SECOND / flacdec->frequency; + 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 * flacdec->frequency / GST_SECOND; - break; - default: - res = FALSE; + case GST_FORMAT_BYTES: + scale = bytes_per_sample; + case GST_FORMAT_DEFAULT: + *dest_value = src_value * scale * flacdec->frequency / GST_SECOND; + break; + default: + res = FALSE; } break; default: @@ -659,6 +661,7 @@ gst_flacdec_get_src_query_types (GstPad * pad) GST_QUERY_POSITION, 0, }; + return types; } @@ -675,17 +678,17 @@ gst_flacdec_src_query (GstPad * pad, GstQueryType type, guint64 samples; if (flacdec->stream_samples == 0) - samples = flacdec->total_samples; + samples = flacdec->total_samples; else - samples = flacdec->stream_samples; + samples = flacdec->stream_samples; gst_pad_convert (flacdec->srcpad, - GST_FORMAT_DEFAULT, samples, format, value); + GST_FORMAT_DEFAULT, samples, format, value); break; } case GST_QUERY_POSITION: gst_pad_convert (flacdec->srcpad, - GST_FORMAT_DEFAULT, flacdec->total_samples, format, value); + GST_FORMAT_DEFAULT, flacdec->total_samples, format, value); break; default: res = FALSE; @@ -702,6 +705,7 @@ gst_flacdec_get_src_event_masks (GstPad * pad) {GST_EVENT_SEEK, GST_SEEK_FLAG_ACCURATE}, {0, 0}, }; + return masks; } @@ -717,11 +721,11 @@ gst_flacdec_src_event (GstPad * pad, GstEvent * event) format = GST_FORMAT_DEFAULT; if (gst_pad_convert (flacdec->srcpad, - GST_EVENT_SEEK_FORMAT (event), - GST_EVENT_SEEK_OFFSET (event), &format, &flacdec->seek_value)) - flacdec->seek_pending = TRUE; + GST_EVENT_SEEK_FORMAT (event), + GST_EVENT_SEEK_OFFSET (event), &format, &flacdec->seek_value)) + flacdec->seek_pending = TRUE; else - res = FALSE; + res = FALSE; break; default: res = FALSE; @@ -744,7 +748,7 @@ gst_flacdec_change_state (GstElement * element) flacdec->total_samples = 0; flacdec->eos = FALSE; if (flacdec->init == FALSE) { - FLAC__seekable_stream_decoder_reset (flacdec->decoder); + FLAC__seekable_stream_decoder_reset (flacdec->decoder); } break; case GST_STATE_PAUSED_TO_PLAYING: diff --git a/ext/flac/gstflacenc.c b/ext/flac/gstflacenc.c index 7e658047..1463a1fa 100644 --- a/ext/flac/gstflacenc.c +++ b/ext/flac/gstflacenc.c @@ -117,9 +117,9 @@ flacenc_get_type (void) }; flacenc_type = - g_type_register_static (GST_TYPE_ELEMENT, "FlacEnc", &flacenc_info, 0); + g_type_register_static (GST_TYPE_ELEMENT, "FlacEnc", &flacenc_info, 0); g_type_add_interface_static (flacenc_type, GST_TYPE_TAG_SETTER, - &tag_setter_info); + &tag_setter_info); } return flacenc_type; } @@ -137,7 +137,8 @@ typedef struct guint rice_parameter_search_dist; guint max_lpc_order; guint blocksize; -} FlacEncParams; +} +FlacEncParams; static const FlacEncParams flacenc_params[] = { {FALSE, FALSE, FALSE, FALSE, 0, FALSE, 2, 2, 0, 0, 1152}, @@ -174,6 +175,7 @@ gst_flacenc_quality_get_type (void) {9, "9", "9 - Insane"}, {0, NULL, NULL} }; + qtype = g_enum_register_static ("FlacEncQuality", values); } return qtype; @@ -235,78 +237,78 @@ gst_flacenc_class_init (FlacEncClass * klass) g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_QUALITY, g_param_spec_enum ("quality", - "Quality", - "Speed versus compression tradeoff", - GST_TYPE_FLACENC_QUALITY, DEFAULT_QUALITY, G_PARAM_READWRITE)); + "Quality", + "Speed versus compression tradeoff", + GST_TYPE_FLACENC_QUALITY, DEFAULT_QUALITY, G_PARAM_READWRITE)); g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_STREAMABLE_SUBSET, g_param_spec_boolean ("streamable_subset", - "Streamable subset", - "true to limit encoder to generating a Subset stream, else false", - TRUE, G_PARAM_READWRITE)); + "Streamable subset", + "true to limit encoder to generating a Subset stream, else false", + TRUE, G_PARAM_READWRITE)); g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_MID_SIDE_STEREO, g_param_spec_boolean ("mid_side_stereo", "Do mid side stereo", - "Do mid side stereo (only for stereo input)", - flacenc_params[DEFAULT_QUALITY].mid_side, G_PARAM_READWRITE)); + "Do mid side stereo (only for stereo input)", + flacenc_params[DEFAULT_QUALITY].mid_side, G_PARAM_READWRITE)); g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_LOOSE_MID_SIDE_STEREO, g_param_spec_boolean ("loose_mid_side_stereo", - "Loose mid side stereo", "Loose mid side stereo", - flacenc_params[DEFAULT_QUALITY].loose_mid_side, G_PARAM_READWRITE)); + "Loose mid side stereo", "Loose mid side stereo", + flacenc_params[DEFAULT_QUALITY].loose_mid_side, G_PARAM_READWRITE)); g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_BLOCKSIZE, g_param_spec_uint ("blocksize", "Blocksize", "Blocksize in samples", - FLAC__MIN_BLOCK_SIZE, FLAC__MAX_BLOCK_SIZE, - flacenc_params[DEFAULT_QUALITY].blocksize, G_PARAM_READWRITE)); + FLAC__MIN_BLOCK_SIZE, FLAC__MAX_BLOCK_SIZE, + flacenc_params[DEFAULT_QUALITY].blocksize, G_PARAM_READWRITE)); g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_MAX_LPC_ORDER, g_param_spec_uint ("max_lpc_order", "Max LPC order", - "Max LPC order; 0 => use only fixed predictors", 0, - FLAC__MAX_LPC_ORDER, flacenc_params[DEFAULT_QUALITY].max_lpc_order, - G_PARAM_READWRITE)); + "Max LPC order; 0 => use only fixed predictors", 0, + FLAC__MAX_LPC_ORDER, flacenc_params[DEFAULT_QUALITY].max_lpc_order, + G_PARAM_READWRITE)); g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_QLP_COEFF_PRECISION, g_param_spec_uint ("qlp_coeff_precision", - "QLP coefficients precision", - "Precision in bits of quantized linear-predictor coefficients; 0 = automatic", - 0, 32, flacenc_params[DEFAULT_QUALITY].qlp_coeff_precision, - G_PARAM_READWRITE)); + "QLP coefficients precision", + "Precision in bits of quantized linear-predictor coefficients; 0 = automatic", + 0, 32, flacenc_params[DEFAULT_QUALITY].qlp_coeff_precision, + G_PARAM_READWRITE)); g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_QLP_COEFF_PREC_SEARCH, g_param_spec_boolean ("qlp_coeff_prec_search", - "Do QLP coefficients precision search", - "false = use qlp_coeff_precision, " - "true = search around qlp_coeff_precision, take best", - flacenc_params[DEFAULT_QUALITY].qlp_coeff_prec_search, - G_PARAM_READWRITE)); + "Do QLP coefficients precision search", + "false = use qlp_coeff_precision, " + "true = search around qlp_coeff_precision, take best", + flacenc_params[DEFAULT_QUALITY].qlp_coeff_prec_search, + G_PARAM_READWRITE)); g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_ESCAPE_CODING, g_param_spec_boolean ("escape_coding", "Do Escape coding", - "search for escape codes in the entropy coding stage " - "for slightly better compression", - flacenc_params[DEFAULT_QUALITY].escape_coding, G_PARAM_READWRITE)); + "search for escape codes in the entropy coding stage " + "for slightly better compression", + flacenc_params[DEFAULT_QUALITY].escape_coding, G_PARAM_READWRITE)); g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_EXHAUSTIVE_MODEL_SEARCH, g_param_spec_boolean ("exhaustive_model_search", - "Do exhaustive model search", - "do exhaustive search of LP coefficient quantization (expensive!)", - flacenc_params[DEFAULT_QUALITY].exhaustive_model_search, - G_PARAM_READWRITE)); + "Do exhaustive model search", + "do exhaustive search of LP coefficient quantization (expensive!)", + flacenc_params[DEFAULT_QUALITY].exhaustive_model_search, + G_PARAM_READWRITE)); g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_MIN_RESIDUAL_PARTITION_ORDER, g_param_spec_uint ("min_residual_partition_order", - "Min residual partition order", - "Min residual partition order (above 4 doesn't usually help much)", 0, - 16, flacenc_params[DEFAULT_QUALITY].min_residual_partition_order, - G_PARAM_READWRITE)); + "Min residual partition order", + "Min residual partition order (above 4 doesn't usually help much)", 0, + 16, flacenc_params[DEFAULT_QUALITY].min_residual_partition_order, + G_PARAM_READWRITE)); g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_MAX_RESIDUAL_PARTITION_ORDER, g_param_spec_uint ("max_residual_partition_order", - "Max residual partition order", - "Max residual partition order (above 4 doesn't usually help much)", 0, - 16, flacenc_params[DEFAULT_QUALITY].max_residual_partition_order, - G_PARAM_READWRITE)); + "Max residual partition order", + "Max residual partition order (above 4 doesn't usually help much)", 0, + 16, flacenc_params[DEFAULT_QUALITY].max_residual_partition_order, + G_PARAM_READWRITE)); g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_RICE_PARAMETER_SEARCH_DIST, g_param_spec_uint ("rice_parameter_search_dist", - "rice_parameter_search_dist", - "0 = try only calc'd parameter k; else try all [k-dist..k+dist] " - "parameters, use best", 0, FLAC__MAX_RICE_PARTITION_ORDER, - flacenc_params[DEFAULT_QUALITY].rice_parameter_search_dist, - G_PARAM_READWRITE)); + "rice_parameter_search_dist", + "0 = try only calc'd parameter k; else try all [k-dist..k+dist] " + "parameters, use best", 0, FLAC__MAX_RICE_PARTITION_ORDER, + flacenc_params[DEFAULT_QUALITY].rice_parameter_search_dist, + G_PARAM_READWRITE)); gstelement_class->change_state = gst_flacenc_change_state; } @@ -434,7 +436,7 @@ gst_flacenc_seek_callback (const FLAC__SeekableStreamEncoder * encoder, event = gst_event_new_seek ((GstSeekType) (int) (GST_FORMAT_BYTES | - GST_SEEK_METHOD_SET), absolute_byte_offset); + GST_SEEK_METHOD_SET), absolute_byte_offset); if (event) gst_pad_push (flacenc->srcpad, GST_DATA (event)); @@ -484,8 +486,8 @@ add_one_tag (const GstTagList * list, const gchar * tag, gpointer user_data) commment_entry.length = strlen (it->data); commment_entry.entry = it->data; FLAC__metadata_object_vorbiscomment_insert_comment (flacenc->meta[0], - flacenc->meta[0]->data.vorbis_comment.num_comments, - commment_entry, TRUE); + flacenc->meta[0]->data.vorbis_comment.num_comments, + commment_entry, TRUE); g_free (it->data); } g_list_free (comments); @@ -511,7 +513,7 @@ gst_flacenc_set_metadata (FlacEnc * flacenc) gst_tag_list_foreach (copy, add_one_tag, flacenc); if (FLAC__seekable_stream_encoder_set_metadata (flacenc->encoder, - flacenc->meta, 1) != true) + flacenc->meta, 1) != true) g_warning ("Dude, i'm already initialized!"); gst_tag_list_free (copy); } @@ -537,18 +539,18 @@ gst_flacenc_chain (GstPad * pad, GstData * _data) switch (GST_EVENT_TYPE (event)) { case GST_EVENT_EOS: - FLAC__seekable_stream_encoder_finish (flacenc->encoder); - break; + FLAC__seekable_stream_encoder_finish (flacenc->encoder); + break; case GST_EVENT_TAG: - if (flacenc->tags) { - gst_tag_list_insert (flacenc->tags, gst_event_tag_get_list (event), - GST_TAG_MERGE_REPLACE); - } else { - g_assert_not_reached (); - } - break; + if (flacenc->tags) { + gst_tag_list_insert (flacenc->tags, gst_event_tag_get_list (event), + GST_TAG_MERGE_REPLACE); + } else { + g_assert_not_reached (); + } + break; default: - break; + break; } gst_pad_event_default (pad, event); return; @@ -556,7 +558,7 @@ gst_flacenc_chain (GstPad * pad, GstData * _data) if (!flacenc->negotiated) { GST_ELEMENT_ERROR (flacenc, CORE, NEGOTIATION, (NULL), - ("format wasn't negotiated before chain function")); + ("format wasn't negotiated before chain function")); return; } @@ -570,9 +572,9 @@ gst_flacenc_chain (GstPad * pad, GstData * _data) FLAC__SeekableStreamEncoderState state; FLAC__seekable_stream_encoder_set_write_callback (flacenc->encoder, - gst_flacenc_write_callback); + gst_flacenc_write_callback); FLAC__seekable_stream_encoder_set_seek_callback (flacenc->encoder, - gst_flacenc_seek_callback); + gst_flacenc_seek_callback); FLAC__seekable_stream_encoder_set_client_data (flacenc->encoder, flacenc); @@ -580,7 +582,7 @@ gst_flacenc_chain (GstPad * pad, GstData * _data) state = FLAC__seekable_stream_encoder_init (flacenc->encoder); if (state != FLAC__STREAM_ENCODER_OK) { GST_ELEMENT_ERROR (flacenc, LIBRARY, INIT, (NULL), - ("could not initialize encoder (wrong parameters?)")); + ("could not initialize encoder (wrong parameters?)")); return; } } @@ -630,51 +632,51 @@ gst_flacenc_set_property (GObject * object, guint prop_id, break; case ARG_STREAMABLE_SUBSET: FLAC__seekable_stream_encoder_set_streamable_subset (this->encoder, - g_value_get_boolean (value)); + g_value_get_boolean (value)); break; case ARG_MID_SIDE_STEREO: FLAC__seekable_stream_encoder_set_do_mid_side_stereo (this->encoder, - g_value_get_boolean (value)); + g_value_get_boolean (value)); break; case ARG_LOOSE_MID_SIDE_STEREO: FLAC__seekable_stream_encoder_set_loose_mid_side_stereo (this->encoder, - g_value_get_boolean (value)); + g_value_get_boolean (value)); break; case ARG_BLOCKSIZE: FLAC__seekable_stream_encoder_set_blocksize (this->encoder, - g_value_get_uint (value)); + g_value_get_uint (value)); break; case ARG_MAX_LPC_ORDER: FLAC__seekable_stream_encoder_set_max_lpc_order (this->encoder, - g_value_get_uint (value)); + g_value_get_uint (value)); break; case ARG_QLP_COEFF_PRECISION: FLAC__seekable_stream_encoder_set_qlp_coeff_precision (this->encoder, - g_value_get_uint (value)); + g_value_get_uint (value)); break; case ARG_QLP_COEFF_PREC_SEARCH: FLAC__seekable_stream_encoder_set_do_qlp_coeff_prec_search (this->encoder, - g_value_get_boolean (value)); + g_value_get_boolean (value)); break; case ARG_ESCAPE_CODING: FLAC__seekable_stream_encoder_set_do_escape_coding (this->encoder, - g_value_get_boolean (value)); + g_value_get_boolean (value)); break; case ARG_EXHAUSTIVE_MODEL_SEARCH: FLAC__seekable_stream_encoder_set_do_exhaustive_model_search (this-> - encoder, g_value_get_boolean (value)); + encoder, g_value_get_boolean (value)); break; case ARG_MIN_RESIDUAL_PARTITION_ORDER: FLAC__seekable_stream_encoder_set_min_residual_partition_order (this-> - encoder, g_value_get_uint (value)); + encoder, g_value_get_uint (value)); break; case ARG_MAX_RESIDUAL_PARTITION_ORDER: FLAC__seekable_stream_encoder_set_max_residual_partition_order (this-> - encoder, g_value_get_uint (value)); + encoder, g_value_get_uint (value)); break; case ARG_RICE_PARAMETER_SEARCH_DIST: FLAC__seekable_stream_encoder_set_rice_parameter_search_dist (this-> - encoder, g_value_get_uint (value)); + encoder, g_value_get_uint (value)); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); @@ -696,58 +698,58 @@ gst_flacenc_get_property (GObject * object, guint prop_id, break; case ARG_STREAMABLE_SUBSET: g_value_set_boolean (value, - FLAC__seekable_stream_encoder_get_streamable_subset (this->encoder)); + FLAC__seekable_stream_encoder_get_streamable_subset (this->encoder)); break; case ARG_MID_SIDE_STEREO: g_value_set_boolean (value, - FLAC__seekable_stream_encoder_get_do_mid_side_stereo (this->encoder)); + FLAC__seekable_stream_encoder_get_do_mid_side_stereo (this->encoder)); break; case ARG_LOOSE_MID_SIDE_STEREO: g_value_set_boolean (value, - FLAC__seekable_stream_encoder_get_loose_mid_side_stereo (this-> - encoder)); + FLAC__seekable_stream_encoder_get_loose_mid_side_stereo (this-> + encoder)); break; case ARG_BLOCKSIZE: g_value_set_uint (value, - FLAC__seekable_stream_encoder_get_blocksize (this->encoder)); + FLAC__seekable_stream_encoder_get_blocksize (this->encoder)); break; case ARG_MAX_LPC_ORDER: g_value_set_uint (value, - FLAC__seekable_stream_encoder_get_max_lpc_order (this->encoder)); + FLAC__seekable_stream_encoder_get_max_lpc_order (this->encoder)); break; case ARG_QLP_COEFF_PRECISION: g_value_set_uint (value, - FLAC__seekable_stream_encoder_get_qlp_coeff_precision (this-> - encoder)); + FLAC__seekable_stream_encoder_get_qlp_coeff_precision (this-> + encoder)); break; case ARG_QLP_COEFF_PREC_SEARCH: g_value_set_boolean (value, - FLAC__seekable_stream_encoder_get_do_qlp_coeff_prec_search (this-> - encoder)); + FLAC__seekable_stream_encoder_get_do_qlp_coeff_prec_search (this-> + encoder)); break; case ARG_ESCAPE_CODING: g_value_set_boolean (value, - FLAC__seekable_stream_encoder_get_do_escape_coding (this->encoder)); + FLAC__seekable_stream_encoder_get_do_escape_coding (this->encoder)); break; case ARG_EXHAUSTIVE_MODEL_SEARCH: g_value_set_boolean (value, - FLAC__seekable_stream_encoder_get_do_exhaustive_model_search (this-> - encoder)); + FLAC__seekable_stream_encoder_get_do_exhaustive_model_search (this-> + encoder)); break; case ARG_MIN_RESIDUAL_PARTITION_ORDER: g_value_set_uint (value, - FLAC__seekable_stream_encoder_get_min_residual_partition_order (this-> - encoder)); + FLAC__seekable_stream_encoder_get_min_residual_partition_order (this-> + encoder)); break; case ARG_MAX_RESIDUAL_PARTITION_ORDER: g_value_set_uint (value, - FLAC__seekable_stream_encoder_get_max_residual_partition_order (this-> - encoder)); + FLAC__seekable_stream_encoder_get_max_residual_partition_order (this-> + encoder)); break; case ARG_RICE_PARAMETER_SEARCH_DIST: g_value_set_uint (value, - FLAC__seekable_stream_encoder_get_rice_parameter_search_dist (this-> - encoder)); + FLAC__seekable_stream_encoder_get_rice_parameter_search_dist (this-> + encoder)); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); @@ -771,20 +773,20 @@ gst_flacenc_change_state (GstElement * element) break; case GST_STATE_PAUSED_TO_READY: if (FLAC__seekable_stream_encoder_get_state (flacenc->encoder) != - FLAC__STREAM_ENCODER_UNINITIALIZED) { - flacenc->stopped = TRUE; - FLAC__seekable_stream_encoder_finish (flacenc->encoder); + FLAC__STREAM_ENCODER_UNINITIALIZED) { + flacenc->stopped = TRUE; + FLAC__seekable_stream_encoder_finish (flacenc->encoder); } flacenc->negotiated = FALSE; if (flacenc->first_buf) - gst_buffer_unref (flacenc->first_buf); + gst_buffer_unref (flacenc->first_buf); flacenc->first_buf = NULL; g_free (flacenc->data); flacenc->data = NULL; if (flacenc->meta) { - FLAC__metadata_object_delete (flacenc->meta[0]); - g_free (flacenc->meta); - flacenc->meta = NULL; + FLAC__metadata_object_delete (flacenc->meta[0]); + g_free (flacenc->meta); + flacenc->meta = NULL; } break; case GST_STATE_READY_TO_NULL: diff --git a/ext/flac/gstflactag.c b/ext/flac/gstflactag.c index c931f41c..50697b7b 100644 --- a/ext/flac/gstflactag.c +++ b/ext/flac/gstflactag.c @@ -56,7 +56,8 @@ typedef enum GST_FLAC_TAG_STATE_VC_METADATA_BLOCK, GST_FLAC_TAG_STATE_ADD_VORBIS_COMMENT, GST_FLAC_TAG_STATE_AUDIO_DATA -} GstFlacTagState; +} +GstFlacTagState; struct _GstFlacTag @@ -157,11 +158,11 @@ gst_flac_tag_get_type (void) }; flac_tag_type = - g_type_register_static (GST_TYPE_ELEMENT, "GstFlacTag", &flac_tag_info, - 0); + g_type_register_static (GST_TYPE_ELEMENT, "GstFlacTag", &flac_tag_info, + 0); g_type_add_interface_static (flac_tag_type, GST_TYPE_TAG_SETTER, - &tag_setter_info); + &tag_setter_info); } return flac_tag_type; @@ -189,8 +190,8 @@ send_eos (GstFlacTag * tag) gst_pad_push (tag->srcpad, GST_DATA (gst_event_new (GST_EVENT_EOS))); /* Seek to end of sink stream */ if (gst_pad_send_event (GST_PAD_PEER (tag->sinkpad), - gst_event_new_seek (GST_FORMAT_BYTES | GST_SEEK_METHOD_END | - GST_SEEK_FLAG_FLUSH, 0))) { + gst_event_new_seek (GST_FORMAT_BYTES | GST_SEEK_METHOD_END | + GST_SEEK_FLAG_FLUSH, 0))) { } else { g_warning ("Couldn't seek to eos on sinkpad\n"); } @@ -209,8 +210,8 @@ caps_nego (GstFlacTag * tag) GST_LOG_OBJECT (tag, "normal operation, using audio/x-flac output"); } else { if (gst_pad_try_set_caps (tag->srcpad, - gst_caps_new_simple ("application/x-gst-tags", NULL)) - != GST_PAD_LINK_REFUSED) { + gst_caps_new_simple ("application/x-gst-tags", NULL)) + != GST_PAD_LINK_REFUSED) { tag->only_output_tags = TRUE; GST_LOG_OBJECT (tag, "fast operation, just outputting tags"); printf ("output tags only\n"); @@ -295,7 +296,7 @@ gst_flac_tag_chain (GstPad * pad, GstData * data) } if (strncmp (GST_BUFFER_DATA (tag->buffer), FLAC_MAGIC, - FLAC_MAGIC_SIZE) == 0) { + FLAC_MAGIC_SIZE) == 0) { GstBuffer *sub; tag->state = GST_FLAC_TAG_STATE_METADATA_BLOCKS; @@ -303,8 +304,8 @@ gst_flac_tag_chain (GstPad * pad, GstData * data) gst_pad_push (tag->srcpad, GST_DATA (sub)); sub = - gst_buffer_create_sub (tag->buffer, FLAC_MAGIC_SIZE, - GST_BUFFER_SIZE (tag->buffer) - FLAC_MAGIC_SIZE); + gst_buffer_create_sub (tag->buffer, FLAC_MAGIC_SIZE, + GST_BUFFER_SIZE (tag->buffer) - FLAC_MAGIC_SIZE); gst_buffer_unref (tag->buffer); /* We do a copy because we need a writable buffer, and _create_sub * sets the buffer it uses to read-only @@ -347,8 +348,8 @@ gst_flac_tag_chain (GstPad * pad, GstData * data) type = (GST_BUFFER_DATA (tag->buffer)[0]) & 0x7F; size = ((GST_BUFFER_DATA (tag->buffer)[1]) << 16) - | ((GST_BUFFER_DATA (tag->buffer)[2]) << 8) - | (GST_BUFFER_DATA (tag->buffer)[3]); + | ((GST_BUFFER_DATA (tag->buffer)[2]) << 8) + | (GST_BUFFER_DATA (tag->buffer)[3]); /* The 4 bytes long header isn't included in the metadata size */ tag->metadata_bytes_remaining = size + 4; @@ -372,7 +373,7 @@ gst_flac_tag_chain (GstPad * pad, GstData * data) g_assert (tag->metadata_bytes_remaining != 0); bytes_to_push = min (tag->metadata_bytes_remaining, - GST_BUFFER_SIZE (tag->buffer)); + GST_BUFFER_SIZE (tag->buffer)); sub = gst_buffer_create_sub (tag->buffer, 0, bytes_to_push); @@ -380,14 +381,14 @@ gst_flac_tag_chain (GstPad * pad, GstData * data) gst_pad_push (tag->srcpad, GST_DATA (sub)); } else { if (tag->vorbiscomment == NULL) { - tag->vorbiscomment = sub; + tag->vorbiscomment = sub; } else { - GstBuffer *merge; + GstBuffer *merge; - merge = gst_buffer_merge (tag->vorbiscomment, sub); - gst_buffer_unref (tag->vorbiscomment); - gst_buffer_unref (sub); - tag->vorbiscomment = merge; + merge = gst_buffer_merge (tag->vorbiscomment, sub); + gst_buffer_unref (tag->vorbiscomment); + gst_buffer_unref (sub); + tag->vorbiscomment = merge; } } @@ -397,7 +398,7 @@ gst_flac_tag_chain (GstPad * pad, GstData * data) GstBuffer *sub; sub = gst_buffer_create_sub (tag->buffer, bytes_to_push, - GST_BUFFER_SIZE (tag->buffer) - bytes_to_push); + GST_BUFFER_SIZE (tag->buffer) - bytes_to_push); gst_buffer_unref (tag->buffer); /* We make a copy because we need a writable buffer, and _create_sub @@ -431,17 +432,17 @@ gst_flac_tag_chain (GstPad * pad, GstData * data) * that we encoutered some tags */ tag->tags = gst_tag_list_from_vorbiscomment_buffer (tag->vorbiscomment, - GST_BUFFER_DATA (tag->vorbiscomment), 4, NULL); + GST_BUFFER_DATA (tag->vorbiscomment), 4, NULL); if (tag->tags != NULL) { - gst_element_found_tags (GST_ELEMENT (tag), tag->tags); + gst_element_found_tags (GST_ELEMENT (tag), tag->tags); } gst_buffer_unref (tag->vorbiscomment); tag->vorbiscomment = NULL; if (tag->only_output_tags) { - send_eos (tag); - return; + send_eos (tag); + return; } } @@ -450,13 +451,13 @@ gst_flac_tag_chain (GstPad * pad, GstData * data) tag->state = GST_FLAC_TAG_STATE_METADATA_BLOCKS; } else { if (tag->only_output_tags) { - /* If we finished parsing the metadata blocks, we will never find any - * metadata, so just stop now - */ - send_eos (tag); - return; + /* If we finished parsing the metadata blocks, we will never find any + * metadata, so just stop now + */ + send_eos (tag); + return; } else { - tag->state = GST_FLAC_TAG_STATE_ADD_VORBIS_COMMENT; + tag->state = GST_FLAC_TAG_STATE_ADD_VORBIS_COMMENT; } } } @@ -475,7 +476,7 @@ gst_flac_tag_chain (GstPad * pad, GstData * data) user_tags = gst_tag_setter_get_list (GST_TAG_SETTER (tag)); merged_tags = gst_tag_list_merge (tag->tags, user_tags, - gst_tag_setter_get_merge_mode (GST_TAG_SETTER (tag))); + gst_tag_setter_get_merge_mode (GST_TAG_SETTER (tag))); if (merged_tags == NULL) { /* If we get a NULL list of tags, we must generate a padding block @@ -485,37 +486,37 @@ gst_flac_tag_chain (GstPad * pad, GstData * data) g_warning ("No tags found\n"); buffer = gst_buffer_new_and_alloc (12); if (buffer == NULL) { - GST_ELEMENT_ERROR (tag, CORE, TOO_LAZY, (NULL), - ("Error creating 12-byte buffer for padding block")); + GST_ELEMENT_ERROR (tag, CORE, TOO_LAZY, (NULL), + ("Error creating 12-byte buffer for padding block")); } memset (GST_BUFFER_DATA (buffer), 0, GST_BUFFER_SIZE (buffer)); - GST_BUFFER_DATA (buffer)[0] = 0x81; /* 0x80 = Last metadata block, - * 0x01 = padding block - */ + GST_BUFFER_DATA (buffer)[0] = 0x81; /* 0x80 = Last metadata block, + * 0x01 = padding block + */ } else { guchar header[4]; memset (header, 0, sizeof (header)); - header[0] = 0x84; /* 0x80 = Last metadata block, - * 0x04 = vorbiscomment block - */ + header[0] = 0x84; /* 0x80 = Last metadata block, + * 0x04 = vorbiscomment block + */ buffer = gst_tag_list_to_vorbiscomment_buffer (merged_tags, header, - sizeof (header), NULL); + sizeof (header), NULL); gst_tag_list_free (merged_tags); if (buffer == NULL) { - GST_ELEMENT_ERROR (tag, CORE, TAG, (NULL), - ("Error converting tag list to vorbiscomment buffer")); - return; + GST_ELEMENT_ERROR (tag, CORE, TAG, (NULL), + ("Error converting tag list to vorbiscomment buffer")); + return; } size = GST_BUFFER_SIZE (buffer) - 4; if ((size > 0xFFFFFF) || (size < 0)) { - /* FLAC vorbis comment blocks are limited to 2^24 bytes, - * while the vorbis specs allow more than that. Shouldn't - * be a real world problem though - */ - GST_ELEMENT_ERROR (tag, CORE, TAG, (NULL), - ("Vorbis comment of size %d too long", size)); - return; + /* FLAC vorbis comment blocks are limited to 2^24 bytes, + * while the vorbis specs allow more than that. Shouldn't + * be a real world problem though + */ + GST_ELEMENT_ERROR (tag, CORE, TAG, (NULL), + ("Vorbis comment of size %d too long", size)); + return; } } @@ -559,15 +560,15 @@ gst_flac_tag_change_state (GstElement * element) break; case GST_STATE_PAUSED_TO_READY: if (tag->buffer) { - gst_buffer_unref (tag->buffer); - tag->buffer = NULL; + gst_buffer_unref (tag->buffer); + tag->buffer = NULL; } if (tag->vorbiscomment) { - gst_buffer_unref (tag->vorbiscomment); - tag->vorbiscomment = NULL; + gst_buffer_unref (tag->vorbiscomment); + tag->vorbiscomment = NULL; } if (tag->tags) { - gst_tag_list_free (tag->tags); + gst_tag_list_free (tag->tags); } tag->state = GST_FLAC_TAG_STATE_INIT; break; diff --git a/ext/gdk_pixbuf/gst_loader.c b/ext/gdk_pixbuf/gst_loader.c index 95fd5af7..f10c90b0 100644 --- a/ext/gdk_pixbuf/gst_loader.c +++ b/ext/gdk_pixbuf/gst_loader.c @@ -41,7 +41,8 @@ typedef struct /* our own stuff - we're much better at keeping fields small :p */ GstGdkAnimation *ani; gboolean initialized; -} GstLoaderContext; +} +GstLoaderContext; GST_DEBUG_CATEGORY_STATIC (gst_loader_debug); #define GST_CAT_DEFAULT gst_loader_debug @@ -56,13 +57,13 @@ gst_loader_init (GError ** error) if (!g_thread_supported ()) { g_set_error (error, GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR_FAILED, - "The GStreamer loader requires threading support."); + "The GStreamer loader requires threading support."); return FALSE; } if (!gst_init_check (0, NULL)) { g_set_error (error, GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR_FAILED, - "GStreamer could not be initialized."); + "GStreamer could not be initialized."); return FALSE; } @@ -119,15 +120,15 @@ gst_loader_load_increment (gpointer context_pointer, const guchar * buf, gst_gdk_animation_add_data (context->ani, buf, size); if (!context->initialized && (iter = - gdk_pixbuf_animation_get_iter (GDK_PIXBUF_ANIMATION (context->ani), - NULL)) != NULL) { + gdk_pixbuf_animation_get_iter (GDK_PIXBUF_ANIMATION (context->ani), + NULL)) != NULL) { int width = - gdk_pixbuf_animation_get_width (GDK_PIXBUF_ANIMATION (context->ani)); + gdk_pixbuf_animation_get_width (GDK_PIXBUF_ANIMATION (context->ani)); int height = - gdk_pixbuf_animation_get_height (GDK_PIXBUF_ANIMATION (context->ani)); + gdk_pixbuf_animation_get_height (GDK_PIXBUF_ANIMATION (context->ani)); GdkPixbuf *pixbuf = - gdk_pixbuf_animation_get_static_image (GDK_PIXBUF_ANIMATION (context-> - ani)); + gdk_pixbuf_animation_get_static_image (GDK_PIXBUF_ANIMATION (context-> + ani)); g_object_unref (iter); GST_LOG_OBJECT (context->ani, "initializing loader"); @@ -138,9 +139,9 @@ gst_loader_load_increment (gpointer context_pointer, const guchar * buf, if (context->prepared_func) { GST_LOG_OBJECT (context->ani, "calling prepared_func %p", - context->prepared_func); + context->prepared_func); context->prepared_func (pixbuf, GDK_PIXBUF_ANIMATION (context->ani), - context->user_data); + context->user_data); } context->initialized = TRUE; @@ -187,7 +188,7 @@ gst_loader_load_animation (FILE * f, GError ** error) g_free (filename); if (iter == NULL) { g_set_error (error, GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR_CORRUPT_IMAGE, - "could not create an image"); + "could not create an image"); g_object_unref (ani); GST_INFO ("could not create an image"); return NULL; @@ -211,7 +212,7 @@ gst_loader_load (FILE * f, GError ** error) GST_ERROR_OBJECT (ani, "Could not get an image in _pixbuf_load"); g_object_unref (ani); g_set_error (error, GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR_CORRUPT_IMAGE, - "Could not get an image from file."); + "Could not get an image from file."); return NULL; } @@ -250,7 +251,7 @@ fill_info (GdkPixbufFormat * info) {" free", "xxxx ", 80}, /* ASF */ {"\060\046\262\165\216\146\317\021\246\331 \252 \142\316\154", - " z z ", 100}, + " z z ", 100}, {NULL, NULL, 0} }; diff --git a/ext/gdk_pixbuf/gstgdkanimation.c b/ext/gdk_pixbuf/gstgdkanimation.c index df58c5be..202ead64 100644 --- a/ext/gdk_pixbuf/gstgdkanimation.c +++ b/ext/gdk_pixbuf/gstgdkanimation.c @@ -54,18 +54,18 @@ gst_gdk_animation_get_type (void) NULL, NULL, gst_gdk_animation_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ + NULL, /* class_finalize */ + NULL, /* class_data */ sizeof (GstGdkAnimation), - 0, /* n_preallocs */ + 0, /* n_preallocs */ NULL, }; object_type = g_type_register_static (GDK_TYPE_PIXBUF_ANIMATION, - "GstGdkAnimation", &object_info, 0); + "GstGdkAnimation", &object_info, 0); GST_DEBUG_CATEGORY_INIT (gst_gdk_animation_debug, "gstloader_animation", 0, - "GStreamer GdkPixbuf loader - GdkAnimation class"); + "GStreamer GdkPixbuf loader - GdkAnimation class"); } return object_type; @@ -179,15 +179,15 @@ gst_gdk_animation_iter_get_type (void) NULL, NULL, gst_gdk_animation_iter_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ + NULL, /* class_finalize */ + NULL, /* class_data */ sizeof (GstGdkAnimationIter), - 0, /* n_preallocs */ + 0, /* n_preallocs */ gst_gdk_animation_iter_init, }; object_type = g_type_register_static (GDK_TYPE_PIXBUF_ANIMATION_ITER, - "GdkPixbufAniAnimIter", &object_info, 0); + "GdkPixbufAniAnimIter", &object_info, 0); } return object_type; @@ -266,12 +266,12 @@ gst_gdk_animation_iter_create_pipeline (GstGdkAnimationIter * iter) ); gst_caps_append (caps, GST_CAPS_NEW ("pixbuf_filter24", - "video/x-raw-rgb", - "endianness", GST_PROPS_INT (G_BIG_ENDIAN), - "bpp", GST_PROPS_INT (24), - "red_mask", GST_PROPS_INT (0xFF0000), - "green_mask", GST_PROPS_INT (0x00FF00), - "blue_mask", GST_PROPS_INT (0x0000FF) + "video/x-raw-rgb", + "endianness", GST_PROPS_INT (G_BIG_ENDIAN), + "bpp", GST_PROPS_INT (24), + "red_mask", GST_PROPS_INT (0xFF0000), + "green_mask", GST_PROPS_INT (0x00FF00), + "blue_mask", GST_PROPS_INT (0x0000FF) )); iter->pipeline = gst_element_factory_make ("pipeline", "main_pipeline"); @@ -323,7 +323,7 @@ gst_gdk_animation_iter_create_pipeline (GstGdkAnimationIter * iter) if (!gst_element_link_filtered (colorspace, sink, caps)) goto error; if (gst_element_set_state (iter->pipeline, - GST_STATE_PLAYING) != GST_STATE_SUCCESS) + GST_STATE_PLAYING) != GST_STATE_SUCCESS) goto error; return TRUE; @@ -346,7 +346,7 @@ gst_gdk_animation_iter_may_advance (GstGdkAnimationIter * iter) data_amount = lseek (iter->ani->temp_fd, 0, SEEK_CUR); g_assert (data_amount >= 0); g_assert (gst_element_query (gst_bin_get_by_name (GST_BIN (iter->pipeline), - "source"), GST_QUERY_POSITION, &bytes, &offset)); + "source"), GST_QUERY_POSITION, &bytes, &offset)); if (data_amount - offset > GST_GDK_BUFFER_SIZE) return TRUE; @@ -394,7 +394,7 @@ gst_gdk_animation_iter_create_pixbuf (GstGdkAnimationIter * iter) GstPad *pad; GstCaps *caps; GstElement *fakesink = - gst_bin_get_by_name (GST_BIN (iter->pipeline), "sink"); + gst_bin_get_by_name (GST_BIN (iter->pipeline), "sink"); g_assert (fakesink); pad = gst_element_get_pad (fakesink, "sink"); g_assert (pad); @@ -402,13 +402,13 @@ gst_gdk_animation_iter_create_pixbuf (GstGdkAnimationIter * iter) g_assert (caps); g_assert (GST_CAPS_IS_FIXED (caps)); g_assert (gst_caps_has_fixed_property (caps, "bpp") && - gst_caps_has_fixed_property (caps, "width") && - gst_caps_has_fixed_property (caps, "height")); + gst_caps_has_fixed_property (caps, "width") && + gst_caps_has_fixed_property (caps, "height")); gst_caps_get_int (caps, "width", &ani->width); gst_caps_get_int (caps, "height", &ani->height); gst_caps_get_int (caps, "bpp", &ani->bpp); GST_DEBUG_OBJECT (ani, "found format (width %d, height %d, bpp %d)", - ani->width, ani->height, ani->bpp); + ani->width, ani->height, ani->bpp); } g_assert (GST_BUFFER_SIZE (buf) == ani->width * ani->height * ani->bpp / 8); if (ani->bpp == 32) { @@ -473,12 +473,12 @@ gst_gdk_animation_iter_advance (GdkPixbufAnimationIter * anim_iter, ((GstClockTime) current_time->tv_sec - iter->start.tv_sec) * GST_SECOND; if (iter->start.tv_usec > current_time->tv_usec) { offset -= - ((GstClockTime) iter->start.tv_usec - - current_time->tv_usec) * GST_SECOND / G_USEC_PER_SEC; + ((GstClockTime) iter->start.tv_usec - + current_time->tv_usec) * GST_SECOND / G_USEC_PER_SEC; } else { offset += - ((GstClockTime) current_time->tv_usec - - iter->start.tv_usec) * GST_SECOND / G_USEC_PER_SEC; + ((GstClockTime) current_time->tv_usec - + iter->start.tv_usec) * GST_SECOND / G_USEC_PER_SEC; } GST_DEBUG_OBJECT (iter, "advancing to %ld:%ld (started at %ld:%ld) need offset %" @@ -487,18 +487,18 @@ gst_gdk_animation_iter_advance (GdkPixbufAnimationIter * anim_iter, if (!iter->just_seeked && offset - iter->last_timestamp > GST_GDK_MAX_DELAY_TO_SEEK) { GST_INFO_OBJECT (iter, - "current pipeline timestamp is too old (%" G_GUINT64_FORMAT " vs %" - G_GUINT64_FORMAT "), seeking there", iter->last_timestamp, offset); + "current pipeline timestamp is too old (%" G_GUINT64_FORMAT " vs %" + G_GUINT64_FORMAT "), seeking there", iter->last_timestamp, offset); if (gst_element_send_event (gst_bin_get_by_name (GST_BIN (iter->pipeline), - "sink"), - gst_event_new_seek (GST_FORMAT_TIME | GST_SEEK_METHOD_SET | - GST_SEEK_FLAG_FLUSH | GST_SEEK_FLAG_ACCURATE, offset))) { + "sink"), + gst_event_new_seek (GST_FORMAT_TIME | GST_SEEK_METHOD_SET | + GST_SEEK_FLAG_FLUSH | GST_SEEK_FLAG_ACCURATE, offset))) { iter->last_timestamp = offset; iter->just_seeked = TRUE; } else { GST_WARNING_OBJECT (iter, - "seek to %" G_GUINT64_FORMAT " didn't work. Iterating there...", - offset); + "seek to %" G_GUINT64_FORMAT " didn't work. Iterating there...", + offset); } } else if (iter->just_seeked) { iter->just_seeked = FALSE; @@ -507,17 +507,17 @@ gst_gdk_animation_iter_advance (GdkPixbufAnimationIter * anim_iter, while (TRUE) { if (g_queue_is_empty (iter->buffers)) { if (iter->eos) - return FALSE; + return FALSE; if (gst_gdk_animation_get_more_buffers (iter)) - continue; + continue; break; } if (GST_BUFFER_TIMESTAMP (g_queue_peek_head (iter->buffers)) > offset) break; if (buffer) { GST_LOG_OBJECT (iter, "unreffing buffer %p, because timestamp too low (%" - G_GUINT64_FORMAT " vs %" G_GUINT64_FORMAT ")", - buffer, GST_BUFFER_TIMESTAMP (buffer), offset); + G_GUINT64_FORMAT " vs %" G_GUINT64_FORMAT ")", + buffer, GST_BUFFER_TIMESTAMP (buffer), offset); gst_data_unref (GST_DATA (buffer)); } buffer = GST_BUFFER (g_queue_pop_head (iter->buffers)); @@ -547,7 +547,7 @@ gst_gdk_animation_iter_get_delay_time (GdkPixbufAnimationIter * anim_iter) return -1; } if (!gst_gdk_animation_get_more_buffers (iter)) - return -1; /* FIXME? */ + return -1; /* FIXME? */ } delay = @@ -593,52 +593,52 @@ gst_gdk_animation_get_static_image (GdkPixbufAnimation * animation) GST_LOG_OBJECT (ani, "trying to create pixbuf"); g_get_current_time (&tv); iter = - GST_GDK_ANIMATION_ITER (gdk_pixbuf_animation_get_iter (animation, &tv)); + GST_GDK_ANIMATION_ITER (gdk_pixbuf_animation_get_iter (animation, &tv)); if (iter) { guint64 offset; GstBuffer *buf; GstFormat time = GST_FORMAT_TIME; if (!gst_element_query (gst_bin_get_by_name (GST_BIN (iter->pipeline), - "sink"), GST_QUERY_TOTAL, &time, &offset)) { - offset = 0; + "sink"), GST_QUERY_TOTAL, &time, &offset)) { + offset = 0; } if (offset > 120 * GST_SECOND) { - offset = 120 * GST_SECOND; + offset = 120 * GST_SECOND; } else if (offset < 120 * GST_SECOND && offset >= 10 * GST_SECOND) { - offset = offset / 2; + offset = offset / 2; } g_assert (time == GST_FORMAT_TIME); GST_LOG_OBJECT (ani, - "using time offset %" G_GUINT64_FORMAT " for creating static image", - offset); + "using time offset %" G_GUINT64_FORMAT " for creating static image", + offset); while ((buf = g_queue_pop_head (iter->buffers)) != NULL) { - gst_data_unref (GST_DATA (buf)); + gst_data_unref (GST_DATA (buf)); } /* now we do evil stuff, be sure to get rid of the iterator afterwards */ if (!gst_element_send_event (gst_bin_get_by_name (GST_BIN (iter-> - pipeline), "sink"), - gst_event_new_seek (GST_FORMAT_TIME | GST_SEEK_METHOD_SET | - GST_SEEK_FLAG_FLUSH | GST_SEEK_FLAG_ACCURATE, offset))) { - GST_INFO_OBJECT (ani, "seeking didn't work. Using next image"); + pipeline), "sink"), + gst_event_new_seek (GST_FORMAT_TIME | GST_SEEK_METHOD_SET | + GST_SEEK_FLAG_FLUSH | GST_SEEK_FLAG_ACCURATE, offset))) { + GST_INFO_OBJECT (ani, "seeking didn't work. Using next image"); } do { - if (g_queue_is_empty (iter->buffers)) { - if (iter->eos) - return FALSE; - if (gst_gdk_animation_get_more_buffers (iter)) - continue; - } + if (g_queue_is_empty (iter->buffers)) { + if (iter->eos) + return FALSE; + if (gst_gdk_animation_get_more_buffers (iter)) + continue; + } } while (FALSE); if (!g_queue_is_empty (iter->buffers)) { - gst_gdk_animation_iter_create_pixbuf (iter); - ani->pixbuf = - gst_gdk_animation_iter_get_pixbuf (GDK_PIXBUF_ANIMATION_ITER - (iter)); - g_object_ref (ani->pixbuf); + gst_gdk_animation_iter_create_pixbuf (iter); + ani->pixbuf = + gst_gdk_animation_iter_get_pixbuf (GDK_PIXBUF_ANIMATION_ITER + (iter)); + g_object_ref (ani->pixbuf); } else { - g_assert (ani->pixbuf == NULL); + g_assert (ani->pixbuf == NULL); } /* DiE iterator, DiE */ g_object_unref (iter); diff --git a/ext/gdk_pixbuf/gstgdkpixbuf.c b/ext/gdk_pixbuf/gstgdkpixbuf.c index 9691782d..6670a368 100644 --- a/ext/gdk_pixbuf/gstgdkpixbuf.c +++ b/ext/gdk_pixbuf/gstgdkpixbuf.c @@ -58,22 +58,22 @@ static GstStaticPadTemplate gst_gdk_pixbuf_sink_template = GST_PAD_SINK, GST_PAD_ALWAYS, GST_STATIC_CAPS ("image/png; " - "image/jpeg; " - "image/gif; " - "image/x-icon; " - "application/x-navi-animation; " - "image/x-cmu-raster; " - "image/x-sun-raster; " - "image/x-pixmap; " - "image/tiff; " - "image/x-portable-anymap; " - "image/x-portable-bitmap; " - "image/x-portable-graymap; " - "image/x-portable-pixmap; " - "image/bmp; " - "image/x-bmp; " - "image/x-MS-bmp; " - "image/vnd.wap.wbmp; " "image/x-bitmap; " "image/x-tga") + "image/jpeg; " + "image/gif; " + "image/x-icon; " + "application/x-navi-animation; " + "image/x-cmu-raster; " + "image/x-sun-raster; " + "image/x-pixmap; " + "image/tiff; " + "image/x-portable-anymap; " + "image/x-portable-bitmap; " + "image/x-portable-graymap; " + "image/x-portable-pixmap; " + "image/bmp; " + "image/x-bmp; " + "image/x-MS-bmp; " + "image/vnd.wap.wbmp; " "image/x-bitmap; " "image/x-tga") ); static GstStaticPadTemplate gst_gdk_pixbuf_src_template = @@ -125,7 +125,7 @@ static GstCaps * gst_gdk_pixbuf_get_capslist (void) { return gst_caps_copy (gst_static_caps_get (&gst_gdk_pixbuf_sink_template. - static_caps)); + static_caps)); } #else static GstCaps * @@ -184,8 +184,9 @@ gst_gdk_pixbuf_get_type (void) 0, (GInstanceInitFunc) gst_gdk_pixbuf_init, }; + plugin_type = g_type_register_static (GST_TYPE_ELEMENT, - "GstGdkPixbuf", &plugin_info, 0); + "GstGdkPixbuf", &plugin_info, 0); } return plugin_type; } @@ -216,7 +217,7 @@ gst_gdk_pixbuf_class_init (GstGdkPixbufClass * klass) g_object_class_install_property (gobject_class, ARG_SILENT, g_param_spec_boolean ("silent", "Silent", "Produce verbose output ?", - FALSE, G_PARAM_READWRITE)); + FALSE, G_PARAM_READWRITE)); gobject_class->set_property = gst_gdk_pixbuf_set_property; gobject_class->get_property = gst_gdk_pixbuf_get_property; @@ -266,15 +267,15 @@ gst_gdk_pixbuf_chain (GstPad * pad, GstData * _data) switch (GST_EVENT_TYPE (event)) { case GST_EVENT_EOS: - push_buffer = TRUE; - got_eos = TRUE; - break; + push_buffer = TRUE; + got_eos = TRUE; + break; case GST_EVENT_DISCONTINUOUS: - dump_buffer = TRUE; - break; + dump_buffer = TRUE; + break; default: - gst_pad_event_default (pad, event); - return; + gst_pad_event_default (pad, event); + return; } } @@ -289,37 +290,37 @@ gst_gdk_pixbuf_chain (GstPad * pad, GstData * _data) GError *error = NULL; if (!gdk_pixbuf_loader_close (filter->pixbuf_loader, &error)) { - GST_ELEMENT_ERROR (filter, LIBRARY, SHUTDOWN, (NULL), (error->message)); - g_error_free (error); - return; + GST_ELEMENT_ERROR (filter, LIBRARY, SHUTDOWN, (NULL), (error->message)); + g_error_free (error); + return; } pixbuf = gdk_pixbuf_loader_get_pixbuf (filter->pixbuf_loader); if (filter->image_size == 0) { - GstCaps *caps; + GstCaps *caps; - filter->width = gdk_pixbuf_get_width (pixbuf); - filter->height = gdk_pixbuf_get_height (pixbuf); - filter->rowstride = gdk_pixbuf_get_rowstride (pixbuf); - filter->image_size = filter->rowstride * filter->height; + filter->width = gdk_pixbuf_get_width (pixbuf); + filter->height = gdk_pixbuf_get_height (pixbuf); + filter->rowstride = gdk_pixbuf_get_rowstride (pixbuf); + filter->image_size = filter->rowstride * filter->height; - caps = gst_caps_copy (gst_pad_get_pad_template_caps (filter->srcpad)); - gst_caps_set_simple (caps, - "width", G_TYPE_INT, filter->width, - "height", G_TYPE_INT, filter->height, - "framerate", G_TYPE_DOUBLE, filter->framerate, NULL); + caps = gst_caps_copy (gst_pad_get_pad_template_caps (filter->srcpad)); + gst_caps_set_simple (caps, + "width", G_TYPE_INT, filter->width, + "height", G_TYPE_INT, filter->height, + "framerate", G_TYPE_DOUBLE, filter->framerate, NULL); - gst_pad_set_explicit_caps (filter->srcpad, caps); + gst_pad_set_explicit_caps (filter->srcpad, caps); } outbuf = gst_pad_alloc_buffer (filter->srcpad, GST_BUFFER_OFFSET_NONE, - filter->image_size); + filter->image_size); GST_BUFFER_TIMESTAMP (outbuf) = GST_BUFFER_TIMESTAMP (buf); GST_BUFFER_DURATION (outbuf) = GST_BUFFER_DURATION (buf); memcpy (GST_BUFFER_DATA (outbuf), gdk_pixbuf_get_pixels (pixbuf), - filter->image_size); + filter->image_size); gst_pad_push (filter->srcpad, GST_DATA (outbuf)); @@ -344,7 +345,7 @@ gst_gdk_pixbuf_chain (GstPad * pad, GstData * _data) } gdk_pixbuf_loader_write (filter->pixbuf_loader, GST_BUFFER_DATA (buf), - GST_BUFFER_SIZE (buf), &error); + GST_BUFFER_SIZE (buf), &error); gst_buffer_unref (buf); } @@ -450,7 +451,7 @@ plugin_init (GstPlugin * plugin) "gdk pixbuf loader"); if (!gst_element_register (plugin, "gdkpixbufdec", GST_RANK_NONE, - GST_TYPE_GDK_PIXBUF)) + GST_TYPE_GDK_PIXBUF)) return FALSE; #ifdef enable_typefind diff --git a/ext/jpeg/gstjpeg.c b/ext/jpeg/gstjpeg.c index add7435e..cf8af9fc 100644 --- a/ext/jpeg/gstjpeg.c +++ b/ext/jpeg/gstjpeg.c @@ -27,11 +27,11 @@ static gboolean plugin_init (GstPlugin * plugin) { if (!gst_element_register (plugin, "jpegenc", GST_RANK_NONE, - GST_TYPE_JPEGENC)) + GST_TYPE_JPEGENC)) return FALSE; if (!gst_element_register (plugin, "jpegdec", GST_RANK_PRIMARY, - GST_TYPE_JPEGDEC)) + GST_TYPE_JPEGDEC)) return FALSE; return TRUE; diff --git a/ext/jpeg/gstjpegdec.c b/ext/jpeg/gstjpegdec.c index 10156559..a7bdb8fa 100644 --- a/ext/jpeg/gstjpegdec.c +++ b/ext/jpeg/gstjpegdec.c @@ -76,9 +76,10 @@ gst_jpegdec_get_type (void) 0, (GInstanceInitFunc) gst_jpegdec_init, }; + jpegdec_type = - g_type_register_static (GST_TYPE_ELEMENT, "GstJpegDec", &jpegdec_info, - 0); + g_type_register_static (GST_TYPE_ELEMENT, "GstJpegDec", &jpegdec_info, + 0); } return jpegdec_type; } @@ -95,8 +96,8 @@ GST_STATIC_PAD_TEMPLATE ("sink", GST_PAD_SINK, GST_PAD_ALWAYS, GST_STATIC_CAPS ("image/jpeg, " - "width = (int) [ 16, 4096 ], " - "height = (int) [ 16, 4096 ], " "framerate = (double) [ 1, MAX ]") + "width = (int) [ 16, 4096 ], " + "height = (int) [ 16, 4096 ], " "framerate = (double) [ 1, MAX ]") ); static void @@ -417,10 +418,10 @@ gst_jpegdec_chain (GstPad * pad, GstData * _data) jpegdec->height = height; caps = gst_caps_new_simple ("video/x-raw-yuv", - "format", GST_TYPE_FOURCC, GST_MAKE_FOURCC ('I', '4', '2', '0'), - "width", G_TYPE_INT, width, - "height", G_TYPE_INT, height, - "framerate", G_TYPE_DOUBLE, jpegdec->fps, NULL); + "format", GST_TYPE_FOURCC, GST_MAKE_FOURCC ('I', '4', '2', '0'), + "width", G_TYPE_INT, width, + "height", G_TYPE_INT, height, + "framerate", G_TYPE_DOUBLE, jpegdec->fps, NULL); gst_pad_set_explicit_caps (jpegdec->srcpad, caps); gst_caps_free (caps); } @@ -439,14 +440,14 @@ gst_jpegdec_chain (GstPad * pad, GstData * _data) jpegdec->line[0][j] = base[0]; base[0] += width; if (r_v == 2) { - jpegdec->line[0][j + 1] = base[0]; - base[0] += width; + jpegdec->line[0][j + 1] = base[0]; + base[0] += width; } jpegdec->line[1][k] = base[1]; jpegdec->line[2][k] = base[2]; if (r_v == 2 || k & 1) { - base[1] += width2; - base[2] += width2; + base[1] += width2; + base[2] += width2; } } /*g_print ("%d\n", jpegdec->cinfo.output_scanline); */ diff --git a/ext/jpeg/gstjpegenc.c b/ext/jpeg/gstjpegenc.c index 44941719..f8657013 100644 --- a/ext/jpeg/gstjpegenc.c +++ b/ext/jpeg/gstjpegenc.c @@ -84,9 +84,10 @@ gst_jpegenc_get_type (void) 0, (GInstanceInitFunc) gst_jpegenc_init, }; + jpegenc_type = - g_type_register_static (GST_TYPE_ELEMENT, "GstJpegEnc", &jpegenc_info, - 0); + g_type_register_static (GST_TYPE_ELEMENT, "GstJpegEnc", &jpegenc_info, + 0); } return jpegenc_type; } @@ -103,8 +104,8 @@ GST_STATIC_PAD_TEMPLATE ("src", GST_PAD_SRC, GST_PAD_ALWAYS, GST_STATIC_CAPS ("image/jpeg, " - "width = (int) [ 16, 4096 ], " - "height = (int) [ 16, 4096 ], " "framerate = (double) [ 1, MAX ]") + "width = (int) [ 16, 4096 ], " + "height = (int) [ 16, 4096 ], " "framerate = (double) [ 1, MAX ]") ); static void @@ -137,12 +138,12 @@ gst_jpegenc_class_init (GstJpegEnc * klass) g_object_class_install_property (gobject_class, ARG_QUALITY, g_param_spec_int ("quality", "Quality", "Quality of encoding", - 0, 100, 85, G_PARAM_READWRITE)); + 0, 100, 85, G_PARAM_READWRITE)); #if 0 /* disabled, since it doesn't seem to work */ g_object_class_install_property (gobject_class, ARG_SMOOTHING, g_param_spec_int ("smoothing", "Smoothing", "Smoothing factor", - 0, 100, 0, G_PARAM_READWRITE)); + 0, 100, 0, G_PARAM_READWRITE)); #endif gobject_class->set_property = gst_jpegenc_set_property; @@ -314,12 +315,12 @@ gst_jpegenc_resync (GstJpegEnc * jpegenc) jpegenc->cinfo.comp_info[2].v_samp_factor = 1; if (height != -1) { - jpegenc->line[0] = - g_realloc (jpegenc->line[0], height * sizeof (char *)); - jpegenc->line[1] = - g_realloc (jpegenc->line[1], height * sizeof (char *) / 2); - jpegenc->line[2] = - g_realloc (jpegenc->line[2], height * sizeof (char *) / 2); + jpegenc->line[0] = + g_realloc (jpegenc->line[0], height * sizeof (char *)); + jpegenc->line[1] = + g_realloc (jpegenc->line[1], height * sizeof (char *) / 2); + jpegenc->line[2] = + g_realloc (jpegenc->line[2], height * sizeof (char *) / 2); } GST_DEBUG ("gst_jpegenc_resync: setting format done"); 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/libcaca/gstcacasink.c b/ext/libcaca/gstcacasink.c index 4cb64e4b..f8448ab3 100644 --- a/ext/libcaca/gstcacasink.c +++ b/ext/libcaca/gstcacasink.c @@ -55,7 +55,7 @@ static GstStaticPadTemplate sink_template = GST_STATIC_PAD_TEMPLATE ("sink", GST_PAD_SINK, GST_PAD_ALWAYS, GST_STATIC_CAPS (GST_VIDEO_CAPS_RGB ";" GST_VIDEO_CAPS_RGBx ";" - GST_VIDEO_CAPS_RGB_16 ";" GST_VIDEO_CAPS_RGB_15) + GST_VIDEO_CAPS_RGB_16 ";" GST_VIDEO_CAPS_RGB_15) ); static void gst_cacasink_base_init (gpointer g_class); @@ -111,13 +111,13 @@ gst_cacasink_get_type (void) }; cacasink_type = - g_type_register_static (GST_TYPE_VIDEOSINK, "GstCACASink", - &cacasink_info, 0); + g_type_register_static (GST_TYPE_VIDEOSINK, "GstCACASink", + &cacasink_info, 0); g_type_add_interface_static (cacasink_type, GST_TYPE_IMPLEMENTS_INTERFACE, - &iface_info); + &iface_info); g_type_add_interface_static (cacasink_type, GST_TYPE_NAVIGATION, - &navigation_info); + &navigation_info); } return cacasink_type; } @@ -177,14 +177,14 @@ gst_cacasink_class_init (GstCACASinkClass * klass) parent_class = g_type_class_ref (GST_TYPE_ELEMENT); - g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_SCREEN_WIDTH, g_param_spec_int ("screen_width", "screen_width", "screen_width", G_MININT, G_MAXINT, 0, G_PARAM_READABLE)); /* CHECKME */ - g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_SCREEN_HEIGHT, g_param_spec_int ("screen_height", "screen_height", "screen_height", G_MININT, G_MAXINT, 0, G_PARAM_READABLE)); /* CHECKME */ + g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_SCREEN_WIDTH, g_param_spec_int ("screen_width", "screen_width", "screen_width", G_MININT, G_MAXINT, 0, G_PARAM_READABLE)); /* CHECKME */ + g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_SCREEN_HEIGHT, g_param_spec_int ("screen_height", "screen_height", "screen_height", G_MININT, G_MAXINT, 0, G_PARAM_READABLE)); /* CHECKME */ g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_DITHER, g_param_spec_enum ("dither", "Dither Type", "Set type of Dither", - GST_TYPE_CACADITHER, 0, G_PARAM_READWRITE)); + GST_TYPE_CACADITHER, 0, G_PARAM_READWRITE)); g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_ANTIALIASING, g_param_spec_boolean ("anti_aliasing", "Anti-Aliasing", - "Enables Anti-Aliasing", TRUE, G_PARAM_READWRITE)); + "Enables Anti-Aliasing", TRUE, G_PARAM_READWRITE)); gobject_class->set_property = gst_cacasink_set_property; gobject_class->get_property = gst_cacasink_get_property; @@ -333,8 +333,8 @@ gst_cacasink_chain (GstPad * pad, GstData * _data) if (cacasink->id && GST_CLOCK_TIME_IS_VALID (time)) { GST_DEBUG ("videosink: clock %s wait: %" G_GUINT64_FORMAT " %u", - GST_OBJECT_NAME (GST_VIDEOSINK_CLOCK (cacasink)), - time, GST_BUFFER_SIZE (buf)); + GST_OBJECT_NAME (GST_VIDEOSINK_CLOCK (cacasink)), + time, GST_BUFFER_SIZE (buf)); gst_element_wait (GST_ELEMENT (cacasink), GST_BUFFER_TIMESTAMP (buf)); } @@ -388,11 +388,11 @@ gst_cacasink_set_property (GObject * object, guint prop_id, case ARG_ANTIALIASING:{ cacasink->antialiasing = g_value_get_boolean (value); if (cacasink->antialiasing) { - caca_set_feature (CACA_ANTIALIASING_MAX); + caca_set_feature (CACA_ANTIALIASING_MAX); } else { - caca_set_feature (CACA_ANTIALIASING_MIN); + caca_set_feature (CACA_ANTIALIASING_MIN); } break; } @@ -463,7 +463,7 @@ gst_cacasink_change_state (GstElement * element) } else { if (!GST_FLAG_IS_SET (element, GST_CACASINK_OPEN)) { if (!gst_cacasink_open (GST_CACASINK (element))) - return GST_STATE_FAILURE; + return GST_STATE_FAILURE; } } @@ -481,7 +481,7 @@ plugin_init (GstPlugin * plugin) return FALSE; if (!gst_element_register (plugin, "cacasink", GST_RANK_NONE, - GST_TYPE_CACASINK)) + GST_TYPE_CACASINK)) return FALSE; return TRUE; diff --git a/ext/libpng/gstpngenc.c b/ext/libpng/gstpngenc.c index 78055cce..a0df5e1f 100644 --- a/ext/libpng/gstpngenc.c +++ b/ext/libpng/gstpngenc.c @@ -90,7 +90,7 @@ gst_pngenc_get_type (void) }; pngenc_type = g_type_register_static (GST_TYPE_ELEMENT, "GstPngEnc", - &pngenc_info, 0); + &pngenc_info, 0); } return pngenc_type; } @@ -245,7 +245,7 @@ gst_pngenc_chain (GstPad * pad, GstData * _data) pngenc->png_info_ptr = png_create_info_struct (pngenc->png_struct_ptr); if (!pngenc->png_info_ptr) { png_destroy_read_struct (&(pngenc->png_struct_ptr), (png_infopp) NULL, - (png_infopp) NULL); + (png_infopp) NULL); } /* non-0 return is from a longjmp inside of libpng */ @@ -273,7 +273,7 @@ gst_pngenc_chain (GstPad * pad, GstData * _data) for (row_index = 0; row_index < pngenc->height; row_index++) row_pointers[row_index] = GST_BUFFER_DATA (buf) + - (pngenc->width * row_index * pngenc->bpp / 8); + (pngenc->width * row_index * pngenc->bpp / 8); png_write_info (pngenc->png_struct_ptr, pngenc->png_info_ptr); png_write_image (pngenc->png_struct_ptr, row_pointers); diff --git a/ext/mikmod/gstmikmod.c b/ext/mikmod/gstmikmod.c index 89e057c1..e7f90748 100644 --- a/ext/mikmod/gstmikmod.c +++ b/ext/mikmod/gstmikmod.c @@ -68,18 +68,18 @@ static GstStaticPadTemplate mikmod_src_factory = 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) { 8000, 11025, 22050, 44100 }, " - "channels = (int) [ 1, 2 ]; " - "audio/x-raw-int, " - "signed = (boolean) FALSE, " - "width = (int) 8, " - "depth = (int) 8, " - "rate = (int) { 8000, 11025, 22050, 44100 }, " - "channels = (int) [ 1, 2 ]") + "endianness = (int) BYTE_ORDER, " + "signed = (boolean) TRUE, " + "width = (int) 16, " + "depth = (int) 16, " + "rate = (int) { 8000, 11025, 22050, 44100 }, " + "channels = (int) [ 1, 2 ]; " + "audio/x-raw-int, " + "signed = (boolean) FALSE, " + "width = (int) 8, " + "depth = (int) 8, " + "rate = (int) { 8000, 11025, 22050, 44100 }, " + "channels = (int) [ 1, 2 ]") ); static GstStaticPadTemplate mikmod_sink_factory = @@ -123,8 +123,9 @@ gst_mikmod_get_type (void) 0, (GInstanceInitFunc) gst_mikmod_init, }; + mikmod_type = - g_type_register_static (GST_TYPE_ELEMENT, "GstMikmod", &mikmod_info, 0); + g_type_register_static (GST_TYPE_ELEMENT, "GstMikmod", &mikmod_info, 0); } return mikmod_type; } @@ -154,44 +155,44 @@ gst_mikmod_class_init (GstMikModClass * klass) g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_SONGNAME, g_param_spec_string ("songname", "songname", "songname", - NULL, G_PARAM_READABLE)); + NULL, G_PARAM_READABLE)); g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_MODTYPE, g_param_spec_string ("modtype", "modtype", "modtype", - NULL, G_PARAM_READABLE)); + NULL, G_PARAM_READABLE)); g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_MUSICVOLUME, g_param_spec_int ("musicvolume", "musivolume", "musicvolume", - 0, 128, 128, G_PARAM_READWRITE)); + 0, 128, 128, G_PARAM_READWRITE)); g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_PANSEP, g_param_spec_int ("pansep", "pansep", "pansep", - 0, 128, 128, G_PARAM_READWRITE)); + 0, 128, 128, G_PARAM_READWRITE)); g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_REVERB, g_param_spec_int ("reverb", "reverb", "reverb", - 0, 15, 0, G_PARAM_READWRITE)); + 0, 15, 0, G_PARAM_READWRITE)); g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_SNDFXVOLUME, g_param_spec_int ("sndfxvolume", "sndfxvolume", "sndfxvolume", - 0, 128, 128, G_PARAM_READWRITE)); + 0, 128, 128, G_PARAM_READWRITE)); g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_VOLUME, g_param_spec_int ("volume", "volume", "volume", - 0, 128, 96, G_PARAM_READWRITE)); + 0, 128, 96, G_PARAM_READWRITE)); g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_INTERP, g_param_spec_boolean ("interp", "interp", "interp", - FALSE, G_PARAM_READWRITE)); + FALSE, G_PARAM_READWRITE)); g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_REVERSE, g_param_spec_boolean ("reverse", "reverse", "reverse", - FALSE, G_PARAM_READWRITE)); + FALSE, G_PARAM_READWRITE)); g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_SURROUND, g_param_spec_boolean ("surround", "surround", "surround", - TRUE, G_PARAM_READWRITE)); + TRUE, G_PARAM_READWRITE)); g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_HQMIXER, g_param_spec_boolean ("hqmixer", "hqmixer", "hqmixer", - FALSE, G_PARAM_READWRITE)); + FALSE, G_PARAM_READWRITE)); g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_SOFT_MUSIC, g_param_spec_boolean ("soft_music", "soft_music", "soft_music", - TRUE, G_PARAM_READWRITE)); + TRUE, G_PARAM_READWRITE)); g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_SOFT_SNDFX, g_param_spec_boolean ("soft_sndfx", "soft_sndfx", "soft_sndfx", - TRUE, G_PARAM_READWRITE)); + TRUE, G_PARAM_READWRITE)); gobject_class->set_property = gst_mikmod_set_property; @@ -296,28 +297,28 @@ gst_mikmod_loop (GstElement * element) if (!mikmod->initialized) { while ((buffer_in = GST_BUFFER (gst_pad_pull (mikmod->sinkpad)))) { if (GST_IS_EVENT (buffer_in)) { - GstEvent *event = GST_EVENT (buffer_in); + GstEvent *event = GST_EVENT (buffer_in); - if (GST_EVENT_TYPE (event) == GST_EVENT_EOS) - break; + if (GST_EVENT_TYPE (event) == GST_EVENT_EOS) + break; } else { - if (mikmod->Buffer) { - GstBuffer *merge; - - merge = gst_buffer_merge (mikmod->Buffer, buffer_in); - gst_buffer_unref (buffer_in); - gst_buffer_unref (mikmod->Buffer); - mikmod->Buffer = merge; - } else { - mikmod->Buffer = buffer_in; - } + if (mikmod->Buffer) { + GstBuffer *merge; + + merge = gst_buffer_merge (mikmod->Buffer, buffer_in); + gst_buffer_unref (buffer_in); + gst_buffer_unref (mikmod->Buffer); + mikmod->Buffer = merge; + } else { + mikmod->Buffer = buffer_in; + } } } if (!GST_PAD_CAPS (mikmod->srcpad)) { if (GST_PAD_LINK_SUCCESSFUL (gst_pad_renegotiate (mikmod->srcpad))) { - GST_ELEMENT_ERROR (mikmod, CORE, NEGOTIATION, (NULL), (NULL)); - return; + GST_ELEMENT_ERROR (mikmod, CORE, NEGOTIATION, (NULL), (NULL)); + return; } } @@ -541,7 +542,7 @@ static gboolean plugin_init (GstPlugin * plugin) { if (!gst_element_register (plugin, "mikmod", GST_RANK_SECONDARY, - GST_TYPE_MIKMOD)) + GST_TYPE_MIKMOD)) return FALSE; return TRUE; diff --git a/ext/mikmod/mikmod_types.c b/ext/mikmod/mikmod_types.c index 370f59cb..27b2cfff 100644 --- a/ext/mikmod/mikmod_types.c +++ b/ext/mikmod/mikmod_types.c @@ -23,8 +23,8 @@ #include #include "mikmod_types.h" -#include /* memcmp */ -#include /* isdigit */ +#include /* memcmp */ +#include /* isdigit */ #define MODULEHEADERSIZE 0x438 diff --git a/ext/pango/gsttextoverlay.c b/ext/pango/gsttextoverlay.c index d0b40294..17f5eca7 100644 --- a/ext/pango/gsttextoverlay.c +++ b/ext/pango/gsttextoverlay.c @@ -34,8 +34,8 @@ GST_STATIC_PAD_TEMPLATE ("src", GST_PAD_SRC, GST_PAD_ALWAYS, GST_STATIC_CAPS ("video/x-raw-yuv, " - "format = (fourcc) I420, " - "width = (int) [ 1, MAX ], " "height = (int) [ 1, MAX ]") + "format = (fourcc) I420, " + "width = (int) [ 1, MAX ], " "height = (int) [ 1, MAX ]") ); static GstStaticPadTemplate video_sink_template_factory = @@ -43,8 +43,8 @@ GST_STATIC_PAD_TEMPLATE ("video_sink", GST_PAD_SINK, GST_PAD_ALWAYS, GST_STATIC_CAPS ("video/x-raw-yuv, " - "format = (fourcc) I420, " - "width = (int) [ 1, MAX ], " "height = (int) [ 1, MAX ]") + "format = (fourcc) I420, " + "width = (int) [ 1, MAX ], " "height = (int) [ 1, MAX ]") ); static GstStaticPadTemplate text_sink_template_factory = @@ -88,9 +88,10 @@ gst_textoverlay_get_type (void) 0, (GInstanceInitFunc) gst_textoverlay_init, }; + textoverlay_type = - g_type_register_static (GST_TYPE_ELEMENT, "GstTextOverlay", - &textoverlay_info, 0); + g_type_register_static (GST_TYPE_ELEMENT, "GstTextOverlay", + &textoverlay_info, 0); } return textoverlay_type; } @@ -129,35 +130,35 @@ gst_textoverlay_class_init (GstTextOverlayClass * klass) klass->pango_context = pango_ft2_get_context (72, 72); g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_TEXT, g_param_spec_string ("text", "text", - "Text to be display," - " in pango markup format.", "", G_PARAM_WRITABLE)); + "Text to be display," + " in pango markup format.", "", G_PARAM_WRITABLE)); g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_VALIGN, g_param_spec_string ("valign", "vertical alignment", - "Vertical alignment of the text. " - "Can be either 'baseline', 'bottom', or 'top'", - "baseline", G_PARAM_WRITABLE)); + "Vertical alignment of the text. " + "Can be either 'baseline', 'bottom', or 'top'", + "baseline", G_PARAM_WRITABLE)); g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_HALIGN, g_param_spec_string ("halign", "horizontal alignment", - "Horizontal alignment of the text. " - "Can be either 'left', 'right', or 'center'", - "center", G_PARAM_WRITABLE)); + "Horizontal alignment of the text. " + "Can be either 'left', 'right', or 'center'", + "center", G_PARAM_WRITABLE)); g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_X0, g_param_spec_int ("x0", "X position", - "Initial X position." - " Horizontal aligment takes this point" - " as reference.", G_MININT, G_MAXINT, 0, G_PARAM_WRITABLE)); + "Initial X position." + " Horizontal aligment takes this point" + " as reference.", G_MININT, G_MAXINT, 0, G_PARAM_WRITABLE)); g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_Y0, g_param_spec_int ("y0", "Y position", - "Initial Y position." - " Vertical aligment takes this point" - " as reference.", G_MININT, G_MAXINT, 0, G_PARAM_WRITABLE)); + "Initial Y position." + " Vertical aligment takes this point" + " as reference.", G_MININT, G_MAXINT, 0, G_PARAM_WRITABLE)); g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_FONT_DESC, g_param_spec_string ("font-desc", "font description", - "Pango font description of font " - "to be used for rendering. " - "See documentation of " - "pango_font_description_from_string" - " for syntax.", "", G_PARAM_WRITABLE)); + "Pango font description of font " + "to be used for rendering. " + "See documentation of " + "pango_font_description_from_string" + " for syntax.", "", G_PARAM_WRITABLE)); } @@ -231,22 +232,22 @@ static void gst_text_overlay_blit_yuv420 (GstTextOverlay * overlay, FT_Bitmap * bitmap, guchar * pixbuf, int x0, int y0) { - int y; /* text bitmap coordinates */ - int x1, y1; /* video buffer coordinates */ + int y; /* text bitmap coordinates */ + int x1, y1; /* video buffer coordinates */ int rowinc, bit_rowinc, uv_rowinc; guchar *p, *bitp, *u_p; int video_width = overlay->width, video_height = overlay->height; - int bitmap_x0 = x0 < 1 ? -(x0 - 1) : 1; /* 1 pixel border */ - int bitmap_y0 = y0 < 1 ? -(y0 - 1) : 1; /* 1 pixel border */ + int bitmap_x0 = x0 < 1 ? -(x0 - 1) : 1; /* 1 pixel border */ + int bitmap_y0 = y0 < 1 ? -(y0 - 1) : 1; /* 1 pixel border */ int bitmap_width = bitmap->width - bitmap_x0; int bitmap_height = bitmap->rows - bitmap_y0; int u_plane_size; int skip_y, skip_x; guchar v; - if (x0 + bitmap_x0 + bitmap_width > video_width - 1) /* 1 pixel border */ + if (x0 + bitmap_x0 + bitmap_width > video_width - 1) /* 1 pixel border */ bitmap_width -= x0 + bitmap_x0 + bitmap_width - video_width + 1; - if (y0 + bitmap_y0 + bitmap_height > video_height - 1) /* 1 pixel border */ + if (y0 + bitmap_y0 + bitmap_height > video_height - 1) /* 1 pixel border */ bitmap_height -= y0 + bitmap_y0 + bitmap_height - video_height + 1; rowinc = video_width - bitmap_width; @@ -264,10 +265,10 @@ gst_text_overlay_blit_yuv420 (GstTextOverlay * overlay, FT_Bitmap * bitmap, for (n = bitmap_width; n > 0; --n) { v = *bitp; if (v) { - p[-1] = CLAMP (p[-1] - v, 0, 255); - p[1] = CLAMP (p[1] - v, 0, 255); - p[-video_width] = CLAMP (p[-video_width] - v, 0, 255); - p[video_width] = CLAMP (p[video_width] - v, 0, 255); + p[-1] = CLAMP (p[-1] - v, 0, 255); + p[1] = CLAMP (p[1] - v, 0, 255); + p[-video_width] = CLAMP (p[-video_width] - v, 0, 255); + p[video_width] = CLAMP (p[video_width] - v, 0, 255); } p++; bitp++; @@ -295,15 +296,15 @@ gst_text_overlay_blit_yuv420 (GstTextOverlay * overlay, FT_Bitmap * bitmap, for (n = bitmap_width; n > 0; --n) { v = *bitp; if (v) { - *p = v; - if (!skip_y) { - u_p[0] = u_p[u_plane_size] = 0x80; - } + *p = v; + if (!skip_y) { + u_p[0] = u_p[u_plane_size] = 0x80; + } } if (!skip_y) { - skip_x = !skip_x; - if (!skip_x) - u_p++; + skip_x = !skip_x; + if (!skip_x) + u_p++; } p++; bitp++; @@ -414,7 +415,7 @@ gst_textoverlay_loop (GstElement * element) if (overlay->next_buffer && (GST_BUFFER_TIMESTAMP (overlay->next_buffer) <= now || - GST_BUFFER_TIMESTAMP (overlay->next_buffer) == GST_CLOCK_TIME_NONE)) { + GST_BUFFER_TIMESTAMP (overlay->next_buffer) == GST_CLOCK_TIME_NONE)) { GST_DEBUG ("using new buffer"); if (overlay->current_buffer) { @@ -424,11 +425,11 @@ gst_textoverlay_loop (GstElement * element) overlay->next_buffer = NULL; GST_DEBUG ("rendering '%*s'", - GST_BUFFER_SIZE (overlay->current_buffer), - GST_BUFFER_DATA (overlay->current_buffer)); + GST_BUFFER_SIZE (overlay->current_buffer), + GST_BUFFER_DATA (overlay->current_buffer)); pango_layout_set_markup (overlay->layout, - GST_BUFFER_DATA (overlay->current_buffer), - GST_BUFFER_SIZE (overlay->current_buffer)); + GST_BUFFER_DATA (overlay->current_buffer), + GST_BUFFER_SIZE (overlay->current_buffer)); render_text (overlay); overlay->need_render = FALSE; } @@ -445,7 +446,7 @@ gst_textoverlay_loop (GstElement * element) if (overlay->need_render) { GST_DEBUG ("rendering '%s'", overlay->default_text); pango_layout_set_markup (overlay->layout, - overlay->default_text, strlen (overlay->default_text)); + overlay->default_text, strlen (overlay->default_text)); render_text (overlay); overlay->need_render = FALSE; @@ -547,7 +548,7 @@ gst_textoverlay_set_property (GObject * object, guint prop_id, case ARG_TEXT: if (overlay->default_text) { - g_free (overlay->default_text); + g_free (overlay->default_text); } overlay->default_text = g_strdup (g_value_get_string (value)); overlay->need_render = TRUE; @@ -555,26 +556,26 @@ gst_textoverlay_set_property (GObject * object, guint prop_id, case ARG_VALIGN: if (strcasecmp (g_value_get_string (value), "baseline") == 0) - overlay->valign = GST_TEXT_OVERLAY_VALIGN_BASELINE; + overlay->valign = GST_TEXT_OVERLAY_VALIGN_BASELINE; else if (strcasecmp (g_value_get_string (value), "bottom") == 0) - overlay->valign = GST_TEXT_OVERLAY_VALIGN_BOTTOM; + overlay->valign = GST_TEXT_OVERLAY_VALIGN_BOTTOM; else if (strcasecmp (g_value_get_string (value), "top") == 0) - overlay->valign = GST_TEXT_OVERLAY_VALIGN_TOP; + overlay->valign = GST_TEXT_OVERLAY_VALIGN_TOP; else - g_warning ("Invalid 'valign' property value: %s", - g_value_get_string (value)); + g_warning ("Invalid 'valign' property value: %s", + g_value_get_string (value)); break; case ARG_HALIGN: if (strcasecmp (g_value_get_string (value), "left") == 0) - overlay->halign = GST_TEXT_OVERLAY_HALIGN_LEFT; + overlay->halign = GST_TEXT_OVERLAY_HALIGN_LEFT; else if (strcasecmp (g_value_get_string (value), "right") == 0) - overlay->halign = GST_TEXT_OVERLAY_HALIGN_RIGHT; + overlay->halign = GST_TEXT_OVERLAY_HALIGN_RIGHT; else if (strcasecmp (g_value_get_string (value), "center") == 0) - overlay->halign = GST_TEXT_OVERLAY_HALIGN_CENTER; + overlay->halign = GST_TEXT_OVERLAY_HALIGN_CENTER; else - g_warning ("Invalid 'halign' property value: %s", - g_value_get_string (value)); + g_warning ("Invalid 'halign' property value: %s", + g_value_get_string (value)); break; case ARG_X0: @@ -591,13 +592,13 @@ gst_textoverlay_set_property (GObject * object, guint prop_id, desc = pango_font_description_from_string (g_value_get_string (value)); if (desc) { - g_message ("font description set: %s", g_value_get_string (value)); - pango_layout_set_font_description (overlay->layout, desc); - pango_font_description_free (desc); - render_text (overlay); + g_message ("font description set: %s", g_value_get_string (value)); + pango_layout_set_font_description (overlay->layout, desc); + pango_font_description_free (desc); + render_text (overlay); } else - g_warning ("font description parse failed: %s", - g_value_get_string (value)); + g_warning ("font description parse failed: %s", + g_value_get_string (value)); break; } @@ -627,7 +628,7 @@ static gboolean plugin_init (GstPlugin * plugin) { if (!gst_element_register (plugin, "textoverlay", GST_RANK_PRIMARY, - GST_TYPE_TEXTOVERLAY)) + GST_TYPE_TEXTOVERLAY)) return FALSE; /*texttestsrc_plugin_init(module, plugin); */ diff --git a/ext/pango/gsttimeoverlay.c b/ext/pango/gsttimeoverlay.c index 9ce5c897..3ec20bcb 100644 --- a/ext/pango/gsttimeoverlay.c +++ b/ext/pango/gsttimeoverlay.c @@ -87,8 +87,9 @@ gst_timeoverlay_get_type (void) 0, gst_timeoverlay_init, }; + timeoverlay_type = g_type_register_static (GST_TYPE_VIDEOFILTER, - "GstTimeoverlay", &timeoverlay_info, 0); + "GstTimeoverlay", &timeoverlay_info, 0); } return timeoverlay_type; } @@ -114,7 +115,7 @@ gst_timeoverlay_base_init (gpointer g_class) for (i = 0; i < G_N_ELEMENTS (gst_timeoverlay_formats); i++) { gst_videofilter_class_add_format (videofilter_class, - gst_timeoverlay_formats + i); + gst_timeoverlay_formats + i); } gst_videofilter_class_add_pad_templates (GST_VIDEOFILTER_CLASS (g_class)); @@ -132,8 +133,8 @@ gst_timeoverlay_class_init (gpointer g_class, gpointer class_data) #if 0 g_object_class_install_property (gobject_class, ARG_METHOD, g_param_spec_enum ("method", "method", "method", - GST_TYPE_TIMEOVERLAY_METHOD, GST_TIMEOVERLAY_METHOD_1, - G_PARAM_READWRITE)); + GST_TYPE_TIMEOVERLAY_METHOD, GST_TIMEOVERLAY_METHOD_1, + G_PARAM_READWRITE)); #endif gobject_class->set_property = gst_timeoverlay_set_property; @@ -293,7 +294,7 @@ gst_timeoverlay_planar411 (GstVideofilter * videofilter, void *dest, void *src) layout = pango_layout_new (timeoverlay->context); string = gst_timeoverlay_print_smpte_time (GST_BUFFER_TIMESTAMP (videofilter-> - in_buf)); + in_buf)); pango_layout_set_text (layout, string, strlen (string)); g_free (string); @@ -314,7 +315,7 @@ gst_timeoverlay_planar411 (GstVideofilter * videofilter, void *dest, void *src) for (i = 0; i < b_height / 2; i++) { memset (dest + width * height + i * (width / 2), 128, b_width / 2); memset (dest + width * height + (width / 2) * (height / 2) + - i * (width / 2), 128, b_width / 2); + i * (width / 2), 128, b_width / 2); } bitmap.rows = b_height; bitmap.width = b_width; diff --git a/ext/raw1394/gst1394.c b/ext/raw1394/gst1394.c index 250a5764..cd89d9f5 100644 --- a/ext/raw1394/gst1394.c +++ b/ext/raw1394/gst1394.c @@ -30,7 +30,7 @@ static gboolean plugin_init (GstPlugin * plugin) { if (!gst_element_register (plugin, "dv1394src", GST_RANK_NONE, - GST_TYPE_DV1394SRC)) + GST_TYPE_DV1394SRC)) return FALSE; return TRUE; diff --git a/ext/raw1394/gstdv1394src.c b/ext/raw1394/gstdv1394src.c index 9509ea2c..fcc93729 100644 --- a/ext/raw1394/gstdv1394src.c +++ b/ext/raw1394/gstdv1394src.c @@ -60,14 +60,14 @@ gst_dv1394src_factory (void) if (!template) { template = gst_pad_template_new ("src", - GST_PAD_SRC, - GST_PAD_ALWAYS, - GST_STATIC_CAPS ("dv1394src", - "video/dv", - gst_props_new ("format", GST_PROPS_LIST (G_TYPE_STRING ("NTSC"), - G_TYPE_STRING ("PAL") - ), NULL) - ), NULL); + GST_PAD_SRC, + GST_PAD_ALWAYS, + GST_STATIC_CAPS ("dv1394src", + "video/dv", + gst_props_new ("format", GST_PROPS_LIST (G_TYPE_STRING ("NTSC"), + G_TYPE_STRING ("PAL") + ), NULL) + ), NULL); } return template; } @@ -107,9 +107,10 @@ gst_dv1394src_get_type (void) 0, (GInstanceInitFunc) gst_dv1394src_init, }; + gst_dv1394src_type = - g_type_register_static (GST_TYPE_ELEMENT, "DV1394Src", - &gst_dv1394src_info, 0); + g_type_register_static (GST_TYPE_ELEMENT, "DV1394Src", + &gst_dv1394src_info, 0); } return gst_dv1394src_type; } @@ -133,14 +134,14 @@ gst_dv1394src_class_init (GstDV1394SrcClass * klass) g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_CONSECUTIVE, g_param_spec_int ("consecutive", "consecutive frames", - "send n consecutive frames after skipping", 1, G_MAXINT, 1, - G_PARAM_READWRITE)); + "send n consecutive frames after skipping", 1, G_MAXINT, 1, + G_PARAM_READWRITE)); g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_SKIP, g_param_spec_int ("skip", "skip frames", "skip n frames", 0, G_MAXINT, 1, - G_PARAM_READWRITE)); + G_PARAM_READWRITE)); g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_DROP_INCOMPLETE, g_param_spec_boolean ("drop_incomplete", "drop_incomplete", - "drop incomplete frames", TRUE, G_PARAM_READWRITE)); + "drop incomplete frames", TRUE, G_PARAM_READWRITE)); parent_class = g_type_class_ref (GST_TYPE_ELEMENT); @@ -235,58 +236,58 @@ gst_dv1394src_iso_receive (raw1394handle_t handle, int channel, size_t len, the following code taken from kino-0.51 (Dan Dennedy/Charles Yates) */ unsigned char *p = (unsigned char *) &data[3]; - int section_type = p[0] >> 5; /* section type is in bits 5 - 7 */ - int dif_sequence = p[1] >> 4; /* dif sequence number is in bits 4 - 7 */ + int section_type = p[0] >> 5; /* section type is in bits 5 - 7 */ + int dif_sequence = p[1] >> 4; /* dif sequence number is in bits 4 - 7 */ int dif_block = p[2]; /* if we are at the beginning of a frame, we set buf=frame, and alloc a new buffer for frame */ - if (section_type == 0 && dif_sequence == 0) { // dif header + if (section_type == 0 && dif_sequence == 0) { // dif header if (!dv1394src->negotiated) { - // figure format (NTSC/PAL) - if (p[3] & 0x80) { - // PAL - dv1394src->frameSize = PAL_FRAMESIZE; - GST_DEBUG ("PAL data"); - if (gst_pad_try_set_caps (dv1394src->srcpad, - gst_caps_new_simple ("video/dv", - "format", G_TYPE_STRING, "PAL", NULL)) <= 0) { - GST_ELEMENT_ERROR (dv1394src, CORE, NEGOTIATION, (NULL), - ("Could not set source caps for PAL")); - return 0; - } - } else { - // NTSC (untested) - dv1394src->frameSize = NTSC_FRAMESIZE; - GST_DEBUG - ("NTSC data [untested] - please report success/failure to "); - if (gst_pad_try_set_caps (dv1394src->srcpad, - gst_caps_new_simple ("video/dv", "format", G_TYPE_STRING, - "NTSC", NULL)) <= 0) { - GST_ELEMENT_ERROR (dv1394src, CORE, NEGOTIATION, (NULL), - ("Could not set source caps for NTSC")); - return 0; - } - } - dv1394src->negotiated = TRUE; + // figure format (NTSC/PAL) + if (p[3] & 0x80) { + // PAL + dv1394src->frameSize = PAL_FRAMESIZE; + GST_DEBUG ("PAL data"); + if (gst_pad_try_set_caps (dv1394src->srcpad, + gst_caps_new_simple ("video/dv", + "format", G_TYPE_STRING, "PAL", NULL)) <= 0) { + GST_ELEMENT_ERROR (dv1394src, CORE, NEGOTIATION, (NULL), + ("Could not set source caps for PAL")); + return 0; + } + } else { + // NTSC (untested) + dv1394src->frameSize = NTSC_FRAMESIZE; + GST_DEBUG + ("NTSC data [untested] - please report success/failure to "); + if (gst_pad_try_set_caps (dv1394src->srcpad, + gst_caps_new_simple ("video/dv", "format", G_TYPE_STRING, + "NTSC", NULL)) <= 0) { + GST_ELEMENT_ERROR (dv1394src, CORE, NEGOTIATION, (NULL), + ("Could not set source caps for NTSC")); + return 0; + } + } + dv1394src->negotiated = TRUE; } // drop last frame when not complete if (!dv1394src->drop_incomplete - || dv1394src->bytesInFrame == dv1394src->frameSize) { - dv1394src->buf = dv1394src->frame; + || dv1394src->bytesInFrame == dv1394src->frameSize) { + dv1394src->buf = dv1394src->frame; } else { - GST_INFO_OBJECT (GST_ELEMENT (dv1394src), "incomplete frame dropped"); + GST_INFO_OBJECT (GST_ELEMENT (dv1394src), "incomplete frame dropped"); } dv1394src->frame = NULL; dv1394src->frameSequence++; if (dv1394src->frameSequence % (dv1394src->skip + - dv1394src->consecutive) < dv1394src->consecutive) { - dv1394src->frame = gst_buffer_new_and_alloc (dv1394src->frameSize); + dv1394src->consecutive) < dv1394src->consecutive) { + dv1394src->frame = gst_buffer_new_and_alloc (dv1394src->frameSize); } dv1394src->bytesInFrame = 0; } @@ -296,33 +297,33 @@ gst_dv1394src_iso_receive (raw1394handle_t handle, int channel, size_t len, switch (section_type) { - case 0: /* 1 Header block */ - /* p[3] |= 0x80; // hack to force PAL data */ - memcpy (data + dif_sequence * 150 * 80, p, 480); - break; - - case 1: /* 2 Subcode blocks */ - memcpy (data + dif_sequence * 150 * 80 + (1 + dif_block) * 80, p, - 480); - break; - - case 2: /* 3 VAUX blocks */ - memcpy (data + dif_sequence * 150 * 80 + (3 + dif_block) * 80, p, - 480); - break; - - case 3: /* 9 Audio blocks interleaved with video */ - memcpy (data + dif_sequence * 150 * 80 + (6 + dif_block * 16) * 80, p, - 480); - break; - - case 4: /* 135 Video blocks interleaved with audio */ - memcpy (data + dif_sequence * 150 * 80 + (7 + (dif_block / 15) + - dif_block) * 80, p, 480); - break; - - default: /* we can´t handle any other data */ - break; + case 0: /* 1 Header block */ + /* p[3] |= 0x80; // hack to force PAL data */ + memcpy (data + dif_sequence * 150 * 80, p, 480); + break; + + case 1: /* 2 Subcode blocks */ + memcpy (data + dif_sequence * 150 * 80 + (1 + dif_block) * 80, p, + 480); + break; + + case 2: /* 3 VAUX blocks */ + memcpy (data + dif_sequence * 150 * 80 + (3 + dif_block) * 80, p, + 480); + break; + + case 3: /* 9 Audio blocks interleaved with video */ + memcpy (data + dif_sequence * 150 * 80 + (6 + dif_block * 16) * 80, p, + 480); + break; + + case 4: /* 135 Video blocks interleaved with audio */ + memcpy (data + dif_sequence * 150 * 80 + (7 + (dif_block / 15) + + dif_block) * 80, p, 480); + break; + + default: /* we can´t handle any other data */ + break; } dv1394src->bytesInFrame += 480; } @@ -362,35 +363,35 @@ gst_dv1394src_change_state (GstElement * element) switch (GST_STATE_TRANSITION (element)) { case GST_STATE_NULL_TO_READY: if ((dv1394src->handle = raw1394_new_handle ()) == NULL) { - GST_INFO_OBJECT (dv1394src, "can't get raw1394 handle"); - return GST_STATE_FAILURE; + GST_INFO_OBJECT (dv1394src, "can't get raw1394 handle"); + return GST_STATE_FAILURE; } raw1394_set_userdata (dv1394src->handle, dv1394src); dv1394src->numcards = - raw1394_get_port_info (dv1394src->handle, dv1394src->pinfo, 16); + raw1394_get_port_info (dv1394src->handle, dv1394src->pinfo, 16); if (dv1394src->numcards == 0) { - GST_INFO_OBJECT (dv1394src, "no cards available for raw1394"); - return GST_STATE_FAILURE; + GST_INFO_OBJECT (dv1394src, "no cards available for raw1394"); + return GST_STATE_FAILURE; } if (dv1394src->pinfo[dv1394src->card].nodes <= 1) { - GST_INFO_OBJECT (dv1394src, "there are no nodes on the 1394 bus"); - return GST_STATE_FAILURE; + GST_INFO_OBJECT (dv1394src, "there are no nodes on the 1394 bus"); + return GST_STATE_FAILURE; } if (raw1394_set_port (dv1394src->handle, dv1394src->port) < 0) { - GST_INFO_OBJECT (dv1394src, "can't set 1394 port %d", dv1394src->port); - return GST_STATE_FAILURE; + GST_INFO_OBJECT (dv1394src, "can't set 1394 port %d", dv1394src->port); + return GST_STATE_FAILURE; } raw1394_set_iso_handler (dv1394src->handle, dv1394src->channel, - gst_dv1394src_iso_receive); + gst_dv1394src_iso_receive); raw1394_set_bus_reset_handler (dv1394src->handle, - gst_dv1394src_bus_reset); + gst_dv1394src_bus_reset); dv1394src->started = FALSE; GST_DEBUG ("successfully opened up 1394 connection"); break; case GST_STATE_PAUSED_TO_PLAYING: if (raw1394_start_iso_rcv (dv1394src->handle, dv1394src->channel) < 0) { - GST_INFO_OBJECT (dv1394src, "can't start 1394 iso receive"); - return GST_STATE_FAILURE; + GST_INFO_OBJECT (dv1394src, "can't start 1394 iso receive"); + return GST_STATE_FAILURE; } break; case GST_STATE_PLAYING_TO_PAUSED: diff --git a/ext/shout2/gstshout2.c b/ext/shout2/gstshout2.c index 4a1d4a1e..99416760 100644 --- a/ext/shout2/gstshout2.c +++ b/ext/shout2/gstshout2.c @@ -44,18 +44,18 @@ 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_PROTOCOL, /* Protocol to connect with */ - - ARG_MOUNT, /* mountpoint of stream (icecast only) */ - ARG_URL, /* Url of stream (I'm guessing) */ + 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_PROTOCOL, /* Protocol to connect with */ + + ARG_MOUNT, /* mountpoint of stream (icecast only) */ + ARG_URL, /* Url of stream (I'm guessing) */ }; static GstPadTemplate * @@ -65,15 +65,15 @@ sink_template_factory (void) if (!template) { template = gst_pad_template_new ("sink", - GST_PAD_SINK, - GST_PAD_ALWAYS, - gst_caps_new ("shout2send_sink", - "application/ogg", - NULL), - gst_caps_new ("shout2send_sink", - "audio/mpeg", - gst_props_new ("mpegversion", GST_PROPS_INT (1), - "layer", GST_PROPS_INT_RANGE (1, 3), NULL)), NULL); + GST_PAD_SINK, + GST_PAD_ALWAYS, + gst_caps_new ("shout2send_sink", + "application/ogg", + NULL), + gst_caps_new ("shout2send_sink", + "audio/mpeg", + gst_props_new ("mpegversion", GST_PROPS_INT (1), + "layer", GST_PROPS_INT_RANGE (1, 3), NULL)), NULL); } return template; @@ -105,14 +105,15 @@ gst_shout2send_protocol_get_type (void) static GEnumValue shout2send_protocol[] = { {SHOUT2SEND_PROTOCOL_ICE, "1", "Ice Protocol"}, {SHOUT2SEND_PROTOCOL_XAUDIOCAST, "2", - "Xaudiocast Protocol (icecast 1.3.x)"}, + "Xaudiocast Protocol (icecast 1.3.x)"}, {SHOUT2SEND_PROTOCOL_ICY, "3", "Icy Protocol (ShoutCast)"}, {SHOUT2SEND_PROTOCOL_HTTP, "4", "Http Protocol (icecast 2.x)"}, {0, NULL, NULL}, }; + if (!shout2send_protocol_type) { shout2send_protocol_type = - g_enum_register_static ("GstShout2SendProtocol", shout2send_protocol); + g_enum_register_static ("GstShout2SendProtocol", shout2send_protocol); } return shout2send_protocol_type; } @@ -134,9 +135,10 @@ gst_shout2send_get_type (void) 0, (GInstanceInitFunc) gst_shout2send_init, }; + shout2send_type = - g_type_register_static (GST_TYPE_ELEMENT, "GstShout2send", - &shout2send_info, 0); + g_type_register_static (GST_TYPE_ELEMENT, "GstShout2send", + &shout2send_info, 0); } return shout2send_type; } @@ -161,28 +163,28 @@ gst_shout2send_class_init (GstShout2sendClass * 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", 1, G_MAXUSHORT, 8000, 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", 1, G_MAXUSHORT, 8000, 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 */ /* 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 */ g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_PROTOCOL, g_param_spec_enum ("protocol", "protocol", "Connection Protocol to use", - GST_TYPE_SHOUT_PROTOCOL, SHOUT2SEND_PROTOCOL_HTTP, - G_PARAM_READWRITE)); + GST_TYPE_SHOUT_PROTOCOL, SHOUT2SEND_PROTOCOL_HTTP, + G_PARAM_READWRITE)); /* 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_URL, g_param_spec_string ("url", "url", "url", NULL, G_PARAM_READWRITE)); /* CHECKME */ + g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_URL, g_param_spec_string ("url", "url", "url", NULL, G_PARAM_READWRITE)); /* CHECKME */ @@ -254,7 +256,7 @@ gst_shout2send_set_property (GObject * object, guint prop_id, case ARG_IP: if (shout2send->ip) - g_free (shout2send->ip); + g_free (shout2send->ip); shout2send->ip = g_strdup (g_value_get_string (value)); break; @@ -264,41 +266,41 @@ gst_shout2send_set_property (GObject * object, guint prop_id, case ARG_PASSWORD: if (shout2send->password) - g_free (shout2send->password); + g_free (shout2send->password); shout2send->password = g_strdup (g_value_get_string (value)); break; - case ARG_NAME: /* Name of the stream */ + case ARG_NAME: /* Name of the stream */ if (shout2send->name) - g_free (shout2send->name); + g_free (shout2send->name); shout2send->name = g_strdup (g_value_get_string (value)); break; - case ARG_DESCRIPTION: /* Description of the stream */ + case ARG_DESCRIPTION: /* Description of the stream */ if (shout2send->description) - g_free (shout2send->description); + g_free (shout2send->description); shout2send->description = g_strdup (g_value_get_string (value)); break; - case ARG_GENRE: /* Genre of the stream */ + case ARG_GENRE: /* Genre of the stream */ if (shout2send->genre) - g_free (shout2send->genre); + g_free (shout2send->genre); shout2send->genre = g_strdup (g_value_get_string (value)); break; - case ARG_PROTOCOL: /* protocol to connect with */ + case ARG_PROTOCOL: /* protocol to connect with */ shout2send->protocol = g_value_get_enum (value); break; - case ARG_MOUNT: /* mountpoint of stream (icecast only) */ + case ARG_MOUNT: /* mountpoint of stream (icecast only) */ if (shout2send->mount) - g_free (shout2send->mount); + g_free (shout2send->mount); shout2send->mount = g_strdup (g_value_get_string (value)); break; - case ARG_URL: /* Url of the stream (I'm guessing) */ + case ARG_URL: /* Url of the stream (I'm guessing) */ if (shout2send->url) - g_free (shout2send->url); + g_free (shout2send->url); shout2send->url = g_strdup (g_value_get_string (value)); break; @@ -329,27 +331,27 @@ gst_shout2send_get_property (GObject * object, guint prop_id, GValue * value, g_value_set_string (value, shout2send->password); break; - case ARG_NAME: /* Name of the stream */ + case ARG_NAME: /* Name of the stream */ g_value_set_string (value, shout2send->name); break; - case ARG_DESCRIPTION: /* Description of the stream */ + case ARG_DESCRIPTION: /* Description of the stream */ g_value_set_string (value, shout2send->description); break; - case ARG_GENRE: /* Genre of the stream */ + case ARG_GENRE: /* Genre of the stream */ g_value_set_string (value, shout2send->genre); break; - case ARG_PROTOCOL: /* protocol to connect with */ + case ARG_PROTOCOL: /* protocol to connect with */ g_value_set_enum (value, shout2send->protocol); break; - case ARG_MOUNT: /* mountpoint of stream (icecast only) */ + case ARG_MOUNT: /* mountpoint of stream (icecast only) */ g_value_set_string (value, shout2send->mount); break; - case ARG_URL: /* Url of stream (I'm guessing) */ + case ARG_URL: /* Url of stream (I'm guessing) */ g_value_set_string (value, shout2send->url); break; @@ -400,23 +402,23 @@ gst_shout2send_change_state (GstElement * element) shout2send->conn = shout_new (); switch (shout2send->protocol) { - case SHOUT2SEND_PROTOCOL_ICE: - proto = SHOUT_PROTOCOL_ICE; - break; - case SHOUT2SEND_PROTOCOL_XAUDIOCAST: - proto = SHOUT_PROTOCOL_XAUDIOCAST; - break; - case SHOUT2SEND_PROTOCOL_ICY: - proto = SHOUT_PROTOCOL_ICY; - break; - case SHOUT2SEND_PROTOCOL_HTTP: - proto = SHOUT_PROTOCOL_HTTP; - break; + case SHOUT2SEND_PROTOCOL_ICE: + proto = SHOUT_PROTOCOL_ICE; + break; + case SHOUT2SEND_PROTOCOL_XAUDIOCAST: + proto = SHOUT_PROTOCOL_XAUDIOCAST; + break; + case SHOUT2SEND_PROTOCOL_ICY: + proto = SHOUT_PROTOCOL_ICY; + break; + case SHOUT2SEND_PROTOCOL_HTTP: + proto = SHOUT_PROTOCOL_HTTP; + break; } if (shout_set_protocol (shout2send->conn, proto) != SHOUTERR_SUCCESS) { - g_error ("Error setting protocol: %s\n", - shout_get_error (shout2send->conn)); + g_error ("Error setting protocol: %s\n", + shout_get_error (shout2send->conn)); } /* --- FIXME: shout requires an ip, and fails if it is given a host. */ @@ -424,61 +426,61 @@ gst_shout2send_change_state (GstElement * element) if (shout_set_host (shout2send->conn, shout2send->ip) != SHOUTERR_SUCCESS) { - g_error ("Error setting host: %s\n", - shout_get_error (shout2send->conn)); + g_error ("Error setting host: %s\n", + shout_get_error (shout2send->conn)); } /* --- */ if (shout_set_port (shout2send->conn, - shout2send->port) != SHOUTERR_SUCCESS) { - g_error ("Error setting port: %s\n", - shout_get_error (shout2send->conn)); + shout2send->port) != SHOUTERR_SUCCESS) { + g_error ("Error setting port: %s\n", + shout_get_error (shout2send->conn)); } if (shout_set_password (shout2send->conn, - shout2send->password) != SHOUTERR_SUCCESS) { - g_error ("Error setting password: %s\n", - shout_get_error (shout2send->conn)); + shout2send->password) != SHOUTERR_SUCCESS) { + g_error ("Error setting password: %s\n", + shout_get_error (shout2send->conn)); } if (shout_set_name (shout2send->conn, - shout2send->name) != SHOUTERR_SUCCESS) { - g_error ("Error setting name: %s\n", - shout_get_error (shout2send->conn)); + shout2send->name) != SHOUTERR_SUCCESS) { + g_error ("Error setting name: %s\n", + shout_get_error (shout2send->conn)); } if (shout_set_description (shout2send->conn, - shout2send->description) != SHOUTERR_SUCCESS) { - g_error ("Error setting name: %s\n", - shout_get_error (shout2send->conn)); + shout2send->description) != SHOUTERR_SUCCESS) { + g_error ("Error setting name: %s\n", + shout_get_error (shout2send->conn)); } if (shout_set_genre (shout2send->conn, - shout2send->genre) != SHOUTERR_SUCCESS) { - g_error ("Error setting name: %s\n", - shout_get_error (shout2send->conn)); + shout2send->genre) != SHOUTERR_SUCCESS) { + g_error ("Error setting name: %s\n", + shout_get_error (shout2send->conn)); } if (shout_set_mount (shout2send->conn, - shout2send->mount) != SHOUTERR_SUCCESS) { - g_error ("Error setting mount point: %s\n", - shout_get_error (shout2send->conn)); + shout2send->mount) != SHOUTERR_SUCCESS) { + g_error ("Error setting mount point: %s\n", + shout_get_error (shout2send->conn)); } if (shout_set_user (shout2send->conn, "source") != SHOUTERR_SUCCESS) { - g_error ("Error setting user: %s\n", - shout_get_error (shout2send->conn)); + g_error ("Error setting user: %s\n", + shout_get_error (shout2send->conn)); } gst_version (&major, &minor, µ); version_string = - g_strdup_printf ("GStreamer %d.%d.%d", major, minor, micro); + g_strdup_printf ("GStreamer %d.%d.%d", major, minor, micro); if (shout_set_agent (shout2send->conn, - version_string) != SHOUTERR_SUCCESS) { - g_error ("Error setting agent: %s\n", - shout_get_error (shout2send->conn)); + version_string) != SHOUTERR_SUCCESS) { + g_error ("Error setting agent: %s\n", + shout_get_error (shout2send->conn)); } g_free (version_string); @@ -492,18 +494,18 @@ gst_shout2send_change_state (GstElement * element) we are being given as input. */ if (shout_set_format (shout2send->conn, audio_format) != SHOUTERR_SUCCESS) { - g_error ("Error setting connection format: %s\n", - shout_get_error (shout2send->conn)); + g_error ("Error setting connection format: %s\n", + shout_get_error (shout2send->conn)); } if (shout_open (shout2send->conn) == SHOUTERR_SUCCESS) { - g_print ("connected to server...\n"); + g_print ("connected to server...\n"); } else { - g_warning ("Couldn't connect to server: %s", - shout_get_error (shout2send->conn)); - shout_close (shout2send->conn); - shout_free (shout2send->conn); - return GST_STATE_FAILURE; + g_warning ("Couldn't connect to server: %s", + shout_get_error (shout2send->conn)); + shout_close (shout2send->conn); + shout_free (shout2send->conn); + return GST_STATE_FAILURE; } break; case GST_STATE_PAUSED_TO_READY: diff --git a/ext/speex/gstspeex.c b/ext/speex/gstspeex.c index 0b0de0bf..cde74576 100644 --- a/ext/speex/gstspeex.c +++ b/ext/speex/gstspeex.c @@ -27,11 +27,11 @@ static gboolean plugin_init (GstPlugin * plugin) { if (!gst_element_register (plugin, "speexenc", GST_RANK_NONE, - GST_TYPE_SPEEXENC)) + GST_TYPE_SPEEXENC)) return FALSE; if (!gst_element_register (plugin, "speexdec", GST_RANK_PRIMARY, - GST_TYPE_SPEEXDEC)) + GST_TYPE_SPEEXDEC)) return FALSE; return TRUE; diff --git a/ext/speex/gstspeexdec.c b/ext/speex/gstspeexdec.c index 364ae669..2338f348 100644 --- a/ext/speex/gstspeexdec.c +++ b/ext/speex/gstspeexdec.c @@ -77,9 +77,10 @@ gst_speexdec_get_type (void) 0, (GInstanceInitFunc) gst_speexdec_init, }; + speexdec_type = - g_type_register_static (GST_TYPE_ELEMENT, "GstSpeexDec", &speexdec_info, - 0); + g_type_register_static (GST_TYPE_ELEMENT, "GstSpeexDec", &speexdec_info, + 0); } return speexdec_type; } @@ -89,18 +90,18 @@ GST_STATIC_PAD_TEMPLATE ("sink", GST_PAD_SINK, GST_PAD_ALWAYS, GST_STATIC_CAPS ("audio/x-speex, " - "rate = (int) [ 1000, 48000 ], " "channels = (int) 1") + "rate = (int) [ 1000, 48000 ], " "channels = (int) 1") ); static GstStaticPadTemplate speex_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) [ 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 @@ -157,12 +158,12 @@ gst_speexdec_sinkconnect (GstPad * pad, const GstCaps * caps) gst_structure_get_int (structure, "rate", &rate); if (gst_pad_set_explicit_caps (speexdec->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))) { + 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))) { return GST_PAD_LINK_OK; } return GST_PAD_LINK_REFUSED; diff --git a/ext/speex/gstspeexenc.c b/ext/speex/gstspeexenc.c index d1b4ae39..d33a1d9c 100644 --- a/ext/speex/gstspeexenc.c +++ b/ext/speex/gstspeexenc.c @@ -77,9 +77,10 @@ gst_speexenc_get_type (void) 0, (GInstanceInitFunc) gst_speexenc_init, }; + speexenc_type = - g_type_register_static (GST_TYPE_ELEMENT, "GstSpeexEnc", &speexenc_info, - 0); + g_type_register_static (GST_TYPE_ELEMENT, "GstSpeexEnc", &speexenc_info, + 0); } return speexenc_type; } @@ -89,18 +90,18 @@ 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 GstStaticPadTemplate speex_src_template = GST_STATIC_PAD_TEMPLATE ("src", GST_PAD_SRC, GST_PAD_ALWAYS, GST_STATIC_CAPS ("audio/x-speex, " - "rate = (int) [ 1000, 48000 ], " "channels = (int) 1") + "rate = (int) [ 1000, 48000 ], " "channels = (int) 1") ); static void @@ -165,15 +166,15 @@ gst_speexenc_sinkconnect (GstPad * pad, const GstCaps * caps) structure = gst_caps_get_structure (caps, 0); gst_structure_get_int (structure, "rate", &speexenc->rate); if (gst_pad_try_set_caps (speexenc->srcpad, - gst_caps_new_simple ("audio/x-speex", - "rate", G_TYPE_INT, speexenc->rate, - "channels", G_TYPE_INT, 1, NULL))) { + gst_caps_new_simple ("audio/x-speex", + "rate", G_TYPE_INT, speexenc->rate, + "channels", G_TYPE_INT, 1, NULL))) { speex_init_header (&speexenc->header, speexenc->rate, 1, speexenc->mode); speexenc->header.frames_per_packet = speexenc->n_packets; speexenc->state = speex_encoder_init (speexenc->mode); speex_encoder_ctl (speexenc->state, SPEEX_GET_FRAME_SIZE, - &speexenc->frame_size); + &speexenc->frame_size); return GST_PAD_LINK_OK; } @@ -203,9 +204,9 @@ gst_speexenc_chain (GstPad * pad, GstData * _data) if (!GST_PAD_CAPS (speexenc->srcpad)) { if (!gst_pad_try_set_caps (speexenc->srcpad, - gst_caps_new_simple ("audio/x-speex", - "rate", G_TYPE_INT, speexenc->rate, - "channels", G_TYPE_INT, 1, NULL))) { + gst_caps_new_simple ("audio/x-speex", + "rate", G_TYPE_INT, speexenc->rate, + "channels", G_TYPE_INT, 1, NULL))) { GST_ELEMENT_ERROR (speexenc, CORE, NEGOTIATION, (NULL), (NULL)); return; } @@ -228,7 +229,7 @@ gst_speexenc_chain (GstPad * pad, GstData * _data) if (speexenc->bufsize && (speexenc->bufsize + size >= frame_size)) { memcpy (speexenc->buffer + speexenc->bufsize, data, - (frame_size - speexenc->bufsize) * sizeof (gint16)); + (frame_size - speexenc->bufsize) * sizeof (gint16)); for (i = 0; i < frame_size; i++) input[i] = speexenc->buffer[i]; @@ -241,7 +242,7 @@ gst_speexenc_chain (GstPad * pad, GstData * _data) outbuf = gst_buffer_new_and_alloc (frame_size * speexenc->n_packets); GST_BUFFER_SIZE (outbuf) = speex_bits_write (&speexenc->bits, - GST_BUFFER_DATA (outbuf), GST_BUFFER_SIZE (outbuf)); + GST_BUFFER_DATA (outbuf), GST_BUFFER_SIZE (outbuf)); GST_BUFFER_TIMESTAMP (outbuf) = speexenc->next_ts; speex_bits_reset (&speexenc->bits); @@ -267,7 +268,7 @@ gst_speexenc_chain (GstPad * pad, GstData * _data) outbuf = gst_buffer_new_and_alloc (frame_size * speexenc->n_packets); GST_BUFFER_SIZE (outbuf) = speex_bits_write (&speexenc->bits, - GST_BUFFER_DATA (outbuf), GST_BUFFER_SIZE (outbuf)); + GST_BUFFER_DATA (outbuf), GST_BUFFER_SIZE (outbuf)); GST_BUFFER_TIMESTAMP (outbuf) = speexenc->next_ts; speex_bits_reset (&speexenc->bits); diff --git a/gst/audiofx/audiowsincband.c b/gst/audiofx/audiowsincband.c index a848cc26..ba0f2d67 100644 --- a/gst/audiofx/audiowsincband.c +++ b/gst/audiofx/audiowsincband.c @@ -35,8 +35,8 @@ #endif #include #include "gstfilter.h" -#include /* M_PI */ -#include /* memmove */ +#include /* M_PI */ +#include /* memmove */ /* elementfactory information */ static GstElementDetails gst_bpwsinc_details = GST_ELEMENT_DETAILS ("BPWSinc", @@ -80,10 +80,10 @@ struct _GstBPWSinc double frequency; double lower_frequency, upper_frequency; - int wing_size; /* length of a "wing" of the filter; - actual length is 2 * wing_size + 1 */ + int wing_size; /* length of a "wing" of the filter; + actual length is 2 * wing_size + 1 */ - gfloat *residue; /* buffer for left-over samples from previous buffer */ + gfloat *residue; /* buffer for left-over samples from previous buffer */ double *kernel; }; @@ -125,7 +125,7 @@ gst_bpwsinc_get_type (void) }; bpwsinc_type = g_type_register_static (GST_TYPE_ELEMENT, "GstBPWSinc", - &bpwsinc_info, 0); + &bpwsinc_info, 0); } return bpwsinc_type; } @@ -157,16 +157,16 @@ gst_bpwsinc_class_init (GstBPWSincClass * klass) g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_LOWER_FREQUENCY, g_param_spec_double ("lower-frequency", "Lower Frequency", - "Cut-off lower frequency (relative to sample rate)", - 0.0, 0.5, 0, G_PARAM_READWRITE)); + "Cut-off lower frequency (relative to sample rate)", + 0.0, 0.5, 0, G_PARAM_READWRITE)); g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_UPPER_FREQUENCY, g_param_spec_double ("upper-frequency", "Upper Frequency", - "Cut-off upper frequency (relative to sample rate)", - 0.0, 0.5, 0, G_PARAM_READWRITE)); + "Cut-off upper frequency (relative to sample rate)", + 0.0, 0.5, 0, G_PARAM_READWRITE)); g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_LENGTH, g_param_spec_int ("length", "Length", - "N such that the filter length = 2N + 1", - 1, G_MAXINT, 1, G_PARAM_READWRITE)); + "N such that the filter length = 2N + 1", + 1, G_MAXINT, 1, G_PARAM_READWRITE)); gobject_class->set_property = gst_bpwsinc_set_property; gobject_class->get_property = gst_bpwsinc_get_property; @@ -213,17 +213,17 @@ gst_bpwsinc_sink_connect (GstPad * pad, const GstCaps * caps) len = filter->wing_size; /* fill the lp kernel */ GST_DEBUG ("bpwsinc: initializing LP kernel of length %d with cut-off %f", - len * 2 + 1, filter->lower_frequency); + len * 2 + 1, filter->lower_frequency); kernel_lp = (double *) g_malloc (sizeof (double) * (2 * len + 1)); for (i = 0; i <= len * 2; ++i) { if (i == len) - kernel_lp[i] = 2 * M_PI * filter->lower_frequency; + kernel_lp[i] = 2 * M_PI * filter->lower_frequency; else - kernel_lp[i] = sin (2 * M_PI * filter->lower_frequency * (i - len)) - / (i - len); + kernel_lp[i] = sin (2 * M_PI * filter->lower_frequency * (i - len)) + / (i - len); /* Blackman windowing */ kernel_lp[i] *= (0.42 - 0.5 * cos (M_PI * i / len) - + 0.08 * cos (2 * M_PI * i / len)); + + 0.08 * cos (2 * M_PI * i / len)); } /* normalize for unity gain at DC @@ -236,17 +236,17 @@ gst_bpwsinc_sink_connect (GstPad * pad, const GstCaps * caps) /* fill the hp kernel */ GST_DEBUG ("bpwsinc: initializing HP kernel of length %d with cut-off %f", - len * 2 + 1, filter->upper_frequency); + len * 2 + 1, filter->upper_frequency); kernel_hp = (double *) g_malloc (sizeof (double) * (2 * len + 1)); for (i = 0; i <= len * 2; ++i) { if (i == len) - kernel_hp[i] = 2 * M_PI * filter->upper_frequency; + kernel_hp[i] = 2 * M_PI * filter->upper_frequency; else - kernel_hp[i] = sin (2 * M_PI * filter->upper_frequency * (i - len)) - / (i - len); + kernel_hp[i] = sin (2 * M_PI * filter->upper_frequency * (i - len)) + / (i - len); /* Blackman windowing */ kernel_hp[i] *= (0.42 - 0.5 * cos (M_PI * i / len) - + 0.08 * cos (2 * M_PI * i / len)); + + 0.08 * cos (2 * M_PI * i / len)); } /* normalize for unity gain at DC diff --git a/gst/audiofx/audiowsinclimit.c b/gst/audiofx/audiowsinclimit.c index 0ce33b32..285c2edb 100644 --- a/gst/audiofx/audiowsinclimit.c +++ b/gst/audiofx/audiowsinclimit.c @@ -35,8 +35,8 @@ #endif #include #include "gstfilter.h" -#include /* M_PI */ -#include /* memmove */ +#include /* M_PI */ +#include /* memmove */ static GstElementDetails gst_lpwsinc_details = GST_ELEMENT_DETAILS ("LPWSinc", "Filter/Effect/Audio", @@ -77,10 +77,10 @@ struct _GstLPWSinc GstPad *sinkpad, *srcpad; double frequency; - int wing_size; /* length of a "wing" of the filter; - actual length is 2 * wing_size + 1 */ + int wing_size; /* length of a "wing" of the filter; + actual length is 2 * wing_size + 1 */ - gfloat *residue; /* buffer for left-over samples from previous buffer */ + gfloat *residue; /* buffer for left-over samples from previous buffer */ double *kernel; }; @@ -122,7 +122,7 @@ gst_lpwsinc_get_type (void) }; lpwsinc_type = g_type_register_static (GST_TYPE_ELEMENT, "GstLPWSinc", - &lpwsinc_info, 0); + &lpwsinc_info, 0); } return lpwsinc_type; } @@ -154,12 +154,12 @@ gst_lpwsinc_class_init (GstLPWSincClass * klass) g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_FREQUENCY, g_param_spec_double ("frequency", "Frequency", - "Cut-off Frequency relative to sample rate)", - 0.0, 0.5, 0, G_PARAM_READWRITE)); + "Cut-off Frequency relative to sample rate)", + 0.0, 0.5, 0, G_PARAM_READWRITE)); g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_LENGTH, g_param_spec_int ("length", "Length", - "N such that the filter length = 2N + 1", - 1, G_MAXINT, 1, G_PARAM_READWRITE)); + "N such that the filter length = 2N + 1", + 1, G_MAXINT, 1, G_PARAM_READWRITE)); gobject_class->set_property = gst_lpwsinc_set_property; gobject_class->get_property = gst_lpwsinc_get_property; @@ -210,10 +210,10 @@ gst_lpwsinc_sink_connect (GstPad * pad, const GstCaps * caps) for (i = 0; i <= len * 2; ++i) { if (i == len) - filter->kernel[i] = 2 * M_PI * filter->frequency; + filter->kernel[i] = 2 * M_PI * filter->frequency; else - filter->kernel[i] = sin (2 * M_PI * filter->frequency * (i - len)) - / (i - len); + filter->kernel[i] = sin (2 * M_PI * filter->frequency * (i - len)) + / (i - len); /* windowing */ filter->kernel[i] *= (0.54 - 0.46 * cos (M_PI * i / len)); } diff --git a/gst/auparse/gstauparse.c b/gst/auparse/gstauparse.c index d7ffe68f..c11bb4b3 100644 --- a/gst/auparse/gstauparse.c +++ b/gst/auparse/gstauparse.c @@ -50,8 +50,8 @@ static GstStaticPadTemplate gst_auparse_src_template = GST_PAD_SRC, GST_PAD_ALWAYS, GST_STATIC_CAPS (GST_AUDIO_INT_PAD_TEMPLATE_CAPS "; " - "audio/x-alaw, " - "rate = (int) [ 8000, 48000 ], " "channels = (int) [ 1, 2 ]") + "audio/x-alaw, " + "rate = (int) [ 8000, 48000 ], " "channels = (int) [ 1, 2 ]") ); /* AuParse signals and args */ @@ -94,9 +94,10 @@ gst_auparse_get_type (void) 0, (GInstanceInitFunc) gst_auparse_init, }; + auparse_type = - g_type_register_static (GST_TYPE_ELEMENT, "GstAuParse", &auparse_info, - 0); + g_type_register_static (GST_TYPE_ELEMENT, "GstAuParse", &auparse_info, + 0); } return auparse_type; } @@ -213,46 +214,46 @@ gst_auparse_chain (GstPad * pad, GstData * _data) } g_print - ("offset %ld, size %ld, encoding %ld, frequency %ld, channels %ld\n", - auparse->offset, auparse->size, auparse->encoding, auparse->frequency, - auparse->channels); + ("offset %ld, size %ld, encoding %ld, frequency %ld, channels %ld\n", + auparse->offset, auparse->size, auparse->encoding, auparse->frequency, + auparse->channels); GST_DEBUG - ("offset %ld, size %ld, encoding %ld, frequency %ld, channels %ld", - auparse->offset, auparse->size, auparse->encoding, auparse->frequency, - auparse->channels); + ("offset %ld, size %ld, encoding %ld, frequency %ld, channels %ld", + auparse->offset, auparse->size, auparse->encoding, auparse->frequency, + auparse->channels); switch (auparse->encoding) { case 1: - law = 1; - depth = 8; - sign = FALSE; - break; + law = 1; + depth = 8; + sign = FALSE; + break; case 2: - law = 0; - depth = 8; - sign = FALSE; - break; + law = 0; + depth = 8; + sign = FALSE; + break; case 3: - law = 0; - depth = 16; - sign = TRUE; - break; + law = 0; + depth = 16; + sign = TRUE; + break; default: - g_warning ("help!, dont know how to deal with this format yet\n"); - return; + g_warning ("help!, dont know how to deal with this format yet\n"); + return; } if (law) { tempcaps = gst_caps_new_simple ("audio/x-alaw", - "rate", G_TYPE_INT, auparse->frequency, - "channels", G_TYPE_INT, auparse->channels, NULL); + "rate", G_TYPE_INT, auparse->frequency, + "channels", G_TYPE_INT, auparse->channels, NULL); } else { tempcaps = gst_caps_new_simple ("audio/x-raw-int", - "endianness", G_TYPE_INT, G_BIG_ENDIAN, - "rate", G_TYPE_INT, auparse->frequency, - "channels", G_TYPE_INT, auparse->channels, - "depth", G_TYPE_INT, depth, - "width", G_TYPE_INT, depth, "signed", G_TYPE_BOOLEAN, sign, NULL); + "endianness", G_TYPE_INT, G_BIG_ENDIAN, + "rate", G_TYPE_INT, auparse->frequency, + "channels", G_TYPE_INT, auparse->channels, + "depth", G_TYPE_INT, depth, + "width", G_TYPE_INT, depth, "signed", G_TYPE_BOOLEAN, sign, NULL); } if (!gst_pad_set_explicit_caps (auparse->srcpad, tempcaps)) { @@ -279,7 +280,7 @@ static gboolean plugin_init (GstPlugin * plugin) { if (!gst_element_register (plugin, "auparse", GST_RANK_SECONDARY, - GST_TYPE_AUPARSE)) { + GST_TYPE_AUPARSE)) { return FALSE; } diff --git a/gst/avi/gstavi.c b/gst/avi/gstavi.c index dbdc7859..4ab32d7b 100644 --- a/gst/avi/gstavi.c +++ b/gst/avi/gstavi.c @@ -40,8 +40,8 @@ plugin_init (GstPlugin * plugin) #endif /* ENABLE_NLS */ return (gst_element_register (plugin, "avidemux", - GST_RANK_PRIMARY, - GST_TYPE_AVI_DEMUX) && + GST_RANK_PRIMARY, + GST_TYPE_AVI_DEMUX) && gst_element_register (plugin, "avimux", GST_RANK_NONE, GST_TYPE_AVIMUX)); } diff --git a/gst/avi/gstavidecoder.c b/gst/avi/gstavidecoder.c index d4cb493f..dc5afd9d 100644 --- a/gst/avi/gstavidecoder.c +++ b/gst/avi/gstavidecoder.c @@ -66,7 +66,7 @@ GST_PADTEMPLATE_FACTORY (sink_templ, GST_PAD_SINK, GST_PAD_ALWAYS, GST_CAPS_NEW ("avidecoder_sink", - "video/avi", "RIFF", GST_PROPS_STRING ("AVI") + "video/avi", "RIFF", GST_PROPS_STRING ("AVI") ) ) @@ -75,12 +75,12 @@ GST_PADTEMPLATE_FACTORY (sink_templ, GST_PAD_SRC, GST_PAD_ALWAYS, GST_CAPS_NEW ("wincodec_src", - "video/raw", - "format", GST_PROPS_LIST (GST_PROPS_FOURCC (GST_MAKE_FOURCC ('Y', 'U', 'Y', - '2')), GST_PROPS_FOURCC (GST_MAKE_FOURCC ('I', '4', '2', '0')), - GST_PROPS_FOURCC (GST_MAKE_FOURCC ('R', 'G', 'B', ' ')) - ), "width", GST_PROPS_INT_RANGE (16, 4096), "height", - GST_PROPS_INT_RANGE (16, 4096) + "video/raw", + "format", GST_PROPS_LIST (GST_PROPS_FOURCC (GST_MAKE_FOURCC ('Y', 'U', 'Y', + '2')), GST_PROPS_FOURCC (GST_MAKE_FOURCC ('I', '4', '2', '0')), + GST_PROPS_FOURCC (GST_MAKE_FOURCC ('R', 'G', 'B', ' ')) + ), "width", GST_PROPS_INT_RANGE (16, 4096), "height", + GST_PROPS_INT_RANGE (16, 4096) ) ) @@ -89,17 +89,17 @@ GST_PADTEMPLATE_FACTORY (sink_templ, GST_PAD_SRC, GST_PAD_ALWAYS, GST_CAPS_NEW ("src_audio", - "audio/raw", - "format", GST_PROPS_STRING ("int"), - "law", GST_PROPS_INT (0), - "endianness", GST_PROPS_INT (G_BYTE_ORDER), - "signed", GST_PROPS_LIST (GST_PROPS_BOOLEAN (TRUE), - GST_PROPS_BOOLEAN (FALSE) - ), "width", GST_PROPS_LIST (GST_PROPS_INT (8), GST_PROPS_INT (16) - ), "depth", GST_PROPS_LIST (GST_PROPS_INT (8), GST_PROPS_INT (16) - ), - "rate", GST_PROPS_INT_RANGE (11025, 48000), - "channels", GST_PROPS_INT_RANGE (1, 2) + "audio/raw", + "format", GST_PROPS_STRING ("int"), + "law", GST_PROPS_INT (0), + "endianness", GST_PROPS_INT (G_BYTE_ORDER), + "signed", GST_PROPS_LIST (GST_PROPS_BOOLEAN (TRUE), + GST_PROPS_BOOLEAN (FALSE) + ), "width", GST_PROPS_LIST (GST_PROPS_INT (8), GST_PROPS_INT (16) + ), "depth", GST_PROPS_LIST (GST_PROPS_INT (8), GST_PROPS_INT (16) + ), + "rate", GST_PROPS_INT_RANGE (11025, 48000), + "channels", GST_PROPS_INT_RANGE (1, 2) ) ) @@ -132,9 +132,10 @@ gst_avi_decoder_get_type (void) 0, (GInstanceInitFunc) gst_avi_decoder_init, }; + avi_decoder_type = - g_type_register_static (GST_TYPE_BIN, "GstAviDecoder", - &avi_decoder_info, 0); + g_type_register_static (GST_TYPE_BIN, "GstAviDecoder", + &avi_decoder_info, 0); } return avi_decoder_type; } @@ -148,9 +149,9 @@ gst_avi_decoder_class_init (GstAviDecoderClass * klass) gobject_class = (GObjectClass *) klass; gstelement_class = (GstElementClass *) klass; - g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_BITRATE, g_param_spec_long ("bitrate", "bitrate", "bitrate", G_MINLONG, G_MAXLONG, 0, G_PARAM_READABLE)); /* CHECKME */ - g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_MEDIA_TIME, g_param_spec_long ("media_time", "media_time", "media_time", G_MINLONG, G_MAXLONG, 0, G_PARAM_READABLE)); /* CHECKME */ - g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_CURRENT_TIME, g_param_spec_long ("current_time", "current_time", "current_time", G_MINLONG, G_MAXLONG, 0, G_PARAM_READABLE)); /* CHECKME */ + g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_BITRATE, g_param_spec_long ("bitrate", "bitrate", "bitrate", G_MINLONG, G_MAXLONG, 0, G_PARAM_READABLE)); /* CHECKME */ + g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_MEDIA_TIME, g_param_spec_long ("media_time", "media_time", "media_time", G_MINLONG, G_MAXLONG, 0, G_PARAM_READABLE)); /* CHECKME */ + g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_CURRENT_TIME, g_param_spec_long ("current_time", "current_time", "current_time", G_MINLONG, G_MAXLONG, 0, G_PARAM_READABLE)); /* CHECKME */ parent_class = g_type_class_ref (GST_TYPE_BIN); @@ -182,17 +183,17 @@ gst_avi_decoder_new_pad (GstElement * element, GstPad * pad, if (!strcmp (format, "strf_vids")) { targetcaps = - gst_padtemplate_get_caps (GST_PADTEMPLATE_GET (src_video_templ)); + gst_padtemplate_get_caps (GST_PADTEMPLATE_GET (src_video_templ)); media_type = AVI_TYPE_VIDEO; gpadname = g_strdup_printf ("video_%02d", avi_decoder->video_count++); } else if (!strcmp (format, "strf_auds")) { targetcaps = - gst_padtemplate_get_caps (GST_PADTEMPLATE_GET (src_audio_templ)); + gst_padtemplate_get_caps (GST_PADTEMPLATE_GET (src_audio_templ)); media_type = AVI_TYPE_AUDIO; gpadname = g_strdup_printf ("audio_%02d", avi_decoder->audio_count++); } else if (!strcmp (format, "strf_iavs")) { targetcaps = - gst_padtemplate_get_caps (GST_PADTEMPLATE_GET (src_video_templ)); + gst_padtemplate_get_caps (GST_PADTEMPLATE_GET (src_video_templ)); media_type = AVI_TYPE_VIDEO; gpadname = g_strdup_printf ("video_%02d", avi_decoder->video_count++); } else { @@ -219,7 +220,7 @@ gst_avi_decoder_new_pad (GstElement * element, GstPad * pad, if (gst_caps_is_always_compatible (caps, targetcaps)) { gst_element_add_ghost_pad (GST_ELEMENT (avi_decoder), - gst_element_get_pad (type, "src"), gpadname); + gst_element_get_pad (type, "src"), gpadname); avi_decoder->count++; goto done; @@ -247,11 +248,11 @@ gst_avi_decoder_new_pad (GstElement * element, GstPad * pad, if (new_element) { gst_pad_connect (pad, gst_element_get_pad (new_element, "sink")); gst_element_set_name (new_element, g_strdup_printf ("element%d", - avi_decoder->count)); + avi_decoder->count)); gst_bin_add (GST_BIN (avi_decoder), new_element); gst_element_add_ghost_pad (GST_ELEMENT (avi_decoder), - gst_element_get_pad (new_element, padname), gpadname); + gst_element_get_pad (new_element, padname), gpadname); avi_decoder->count++; } else { @@ -271,10 +272,10 @@ gst_avi_decoder_init (GstAviDecoder * avi_decoder) gst_bin_add (GST_BIN (avi_decoder), avi_decoder->demuxer); gst_element_add_ghost_pad (GST_ELEMENT (avi_decoder), - gst_element_get_pad (avi_decoder->demuxer, "sink"), "sink"); + gst_element_get_pad (avi_decoder->demuxer, "sink"), "sink"); g_signal_connect (G_OBJECT (avi_decoder->demuxer), "new_pad", - G_CALLBACK (gst_avi_decoder_new_pad), avi_decoder); + G_CALLBACK (gst_avi_decoder_new_pad), avi_decoder); } else { g_warning ("wow!, no avi demuxer found. help me\n"); } @@ -317,11 +318,11 @@ gst_avi_decoder_get_property (GObject * object, guint prop_id, GValue * value, break; case ARG_MEDIA_TIME: g_value_set_long (value, gst_util_get_long_arg (G_OBJECT (src->demuxer), - "media_time")); + "media_time")); break; case ARG_CURRENT_TIME: g_value_set_long (value, gst_util_get_long_arg (G_OBJECT (src->demuxer), - "current_time")); + "current_time")); break; default: break; diff --git a/gst/avi/gstavidemux.c b/gst/avi/gstavidemux.c index 03403488..1c03ef2c 100644 --- a/gst/avi/gstavidemux.c +++ b/gst/avi/gstavidemux.c @@ -99,8 +99,8 @@ gst_avi_demux_get_type (void) }; avi_demux_type = - g_type_register_static (GST_TYPE_RIFF_READ, - "GstAviDemux", &avi_demux_info, 0); + g_type_register_static (GST_TYPE_RIFF_READ, + "GstAviDemux", &avi_demux_info, 0); } return avi_demux_type; @@ -147,7 +147,7 @@ gst_avi_demux_class_init (GstAviDemuxClass * klass) g_object_class_install_property (gobject_class, ARG_STREAMINFO, g_param_spec_boxed ("streaminfo", "Streaminfo", "Streaminfo", - GST_TYPE_CAPS, G_PARAM_READABLE)); + GST_TYPE_CAPS, G_PARAM_READABLE)); GST_DEBUG_CATEGORY_INIT (avidemux_debug, "avidemux", 0, "Demuxer for AVI streams"); @@ -347,38 +347,38 @@ gst_avi_demux_src_convert (GstPad * pad, switch (src_format) { case GST_FORMAT_TIME: switch (*dest_format) { - case GST_FORMAT_BYTES: - *dest_value = src_value * stream->strh->rate / - (stream->strh->scale * GST_SECOND); - break; - case GST_FORMAT_DEFAULT: - *dest_value = src_value * stream->strh->rate / - (stream->strh->scale * GST_SECOND); - break; - default: - res = FALSE; - break; + case GST_FORMAT_BYTES: + *dest_value = src_value * stream->strh->rate / + (stream->strh->scale * GST_SECOND); + break; + case GST_FORMAT_DEFAULT: + *dest_value = src_value * stream->strh->rate / + (stream->strh->scale * GST_SECOND); + break; + default: + res = FALSE; + break; } break; case GST_FORMAT_BYTES: switch (*dest_format) { - case GST_FORMAT_TIME: - *dest_value = ((gfloat) src_value) * GST_SECOND / stream->strh->rate; - break; - default: - res = FALSE; - break; + case GST_FORMAT_TIME: + *dest_value = ((gfloat) src_value) * GST_SECOND / stream->strh->rate; + break; + default: + res = FALSE; + break; } break; case GST_FORMAT_DEFAULT: switch (*dest_format) { - case GST_FORMAT_TIME: - *dest_value = ((((gfloat) src_value) * stream->strh->scale) / - stream->strh->rate) * GST_SECOND; - break; - default: - res = FALSE; - break; + case GST_FORMAT_TIME: + *dest_value = ((((gfloat) src_value) * stream->strh->scale) / + stream->strh->rate) * GST_SECOND; + break; + default: + res = FALSE; + break; } break; default: @@ -412,54 +412,54 @@ gst_avi_demux_handle_src_query (GstPad * pad, switch (type) { case GST_QUERY_TOTAL: switch (*format) { - case GST_FORMAT_TIME: - *value = (((gfloat) stream->strh->scale) * stream->strh->length / - stream->strh->rate) * GST_SECOND; - break; - case GST_FORMAT_BYTES: - if (stream->strh->type == GST_RIFF_FCC_auds) { - *value = stream->total_bytes; - } else - res = FALSE; - break; - case GST_FORMAT_DEFAULT: - if (stream->strh->type == GST_RIFF_FCC_auds) - *value = stream->strh->length * stream->strh->samplesize; - else if (stream->strh->type == GST_RIFF_FCC_vids) - *value = stream->strh->length; - else - res = FALSE; - break; - default: - res = FALSE; - break; + case GST_FORMAT_TIME: + *value = (((gfloat) stream->strh->scale) * stream->strh->length / + stream->strh->rate) * GST_SECOND; + break; + case GST_FORMAT_BYTES: + if (stream->strh->type == GST_RIFF_FCC_auds) { + *value = stream->total_bytes; + } else + res = FALSE; + break; + case GST_FORMAT_DEFAULT: + if (stream->strh->type == GST_RIFF_FCC_auds) + *value = stream->strh->length * stream->strh->samplesize; + else if (stream->strh->type == GST_RIFF_FCC_vids) + *value = stream->strh->length; + else + res = FALSE; + break; + default: + res = FALSE; + break; } break; case GST_QUERY_POSITION: switch (*format) { - case GST_FORMAT_TIME: - if (stream->strh->samplesize && - stream->strh->type == GST_RIFF_FCC_auds) { - *value = ((gfloat) stream->current_byte) * GST_SECOND / - stream->strh->rate; - } else { - *value = (((gfloat) stream->current_frame) * stream->strh->scale / - stream->strh->rate) * GST_SECOND; - } - break; - case GST_FORMAT_BYTES: - *value = stream->current_byte; - break; - case GST_FORMAT_DEFAULT: - if (stream->strh->samplesize && - stream->strh->type == GST_RIFF_FCC_auds) - *value = stream->current_byte * stream->strh->samplesize; - else - *value = stream->current_frame; - break; - default: - res = FALSE; - break; + case GST_FORMAT_TIME: + if (stream->strh->samplesize && + stream->strh->type == GST_RIFF_FCC_auds) { + *value = ((gfloat) stream->current_byte) * GST_SECOND / + stream->strh->rate; + } else { + *value = (((gfloat) stream->current_frame) * stream->strh->scale / + stream->strh->rate) * GST_SECOND; + } + break; + case GST_FORMAT_BYTES: + *value = stream->current_byte; + break; + case GST_FORMAT_DEFAULT: + if (stream->strh->samplesize && + stream->strh->type == GST_RIFF_FCC_auds) + *value = stream->current_byte * stream->strh->samplesize; + else + *value = stream->current_frame; + break; + default: + res = FALSE; + break; } break; default: @@ -492,7 +492,7 @@ gst_avi_demux_sync_streams (GstAviDemux * avi, guint64 time) GST_DEBUG ("finding %d for time %" G_GINT64_FORMAT, i, time); entry = gst_avi_demux_index_entry_for_time (avi, stream->num, time, - GST_RIFF_IF_KEYFRAME); + GST_RIFF_IF_KEYFRAME); if (entry) { min_index = MIN (entry->index_nr, min_index); } @@ -510,7 +510,7 @@ gst_avi_demux_sync_streams (GstAviDemux * avi, guint64 time) next_entry = gst_avi_demux_index_next (avi, stream->num, min_index, 0); /* next entry with keyframe */ entry = gst_avi_demux_index_next (avi, stream->num, min_index, - GST_RIFF_IF_KEYFRAME); + GST_RIFF_IF_KEYFRAME); stream->current_byte = next_entry->bytes_before; stream->current_frame = next_entry->frames_before; @@ -539,9 +539,9 @@ gst_avi_demux_send_event (GstElement * element, GstEvent * event) * failed on this pad */ gst_event_ref (event); if (gst_avi_demux_handle_src_event (pad, event)) { - gst_event_unref (event); + gst_event_unref (event); - return TRUE; + return TRUE; } } @@ -576,56 +576,56 @@ gst_avi_demux_handle_src_event (GstPad * pad, GstEvent * event) switch (GST_EVENT_TYPE (event)) { case GST_EVENT_SEEK: GST_DEBUG ("seek format %d, %08x", GST_EVENT_SEEK_FORMAT (event), - stream->strh->type); + stream->strh->type); switch (GST_EVENT_SEEK_FORMAT (event)) { - case GST_FORMAT_BYTES: - case GST_FORMAT_DEFAULT: - case GST_FORMAT_TIME:{ - gst_avi_index_entry *seek_entry, *entry = NULL; - gint64 desired_offset = GST_EVENT_SEEK_OFFSET (event); - guint32 flags; - guint64 min_index; - - /* no seek on audio yet */ - if (stream->strh->type == GST_RIFF_FCC_auds) { - res = FALSE; - goto done; - } - GST_DEBUG ("seeking to %" G_GINT64_FORMAT, desired_offset); - - flags = GST_RIFF_IF_KEYFRAME; - switch (GST_EVENT_SEEK_FORMAT (event)) { - case GST_FORMAT_BYTES: - entry = gst_avi_demux_index_entry_for_byte (avi, stream->num, - desired_offset, flags); - break; - case GST_FORMAT_DEFAULT: - entry = gst_avi_demux_index_entry_for_frame (avi, stream->num, - desired_offset, flags); - break; - case GST_FORMAT_TIME: - entry = gst_avi_demux_index_entry_for_time (avi, stream->num, - desired_offset, flags); - break; - } - - if (entry) { - min_index = gst_avi_demux_sync_streams (avi, entry->ts); - seek_entry = &avi->index_entries[min_index]; - - avi->seek_offset = seek_entry->offset + avi->index_offset; - avi->last_seek = entry->ts; - } else { - GST_DEBUG ("no index entry found for format=%d value=%" - G_GINT64_FORMAT, GST_EVENT_SEEK_FORMAT (event), desired_offset); - res = FALSE; - } - break; - } - default: - res = FALSE; - break; + case GST_FORMAT_BYTES: + case GST_FORMAT_DEFAULT: + case GST_FORMAT_TIME:{ + gst_avi_index_entry *seek_entry, *entry = NULL; + gint64 desired_offset = GST_EVENT_SEEK_OFFSET (event); + guint32 flags; + guint64 min_index; + + /* no seek on audio yet */ + if (stream->strh->type == GST_RIFF_FCC_auds) { + res = FALSE; + goto done; + } + GST_DEBUG ("seeking to %" G_GINT64_FORMAT, desired_offset); + + flags = GST_RIFF_IF_KEYFRAME; + switch (GST_EVENT_SEEK_FORMAT (event)) { + case GST_FORMAT_BYTES: + entry = gst_avi_demux_index_entry_for_byte (avi, stream->num, + desired_offset, flags); + break; + case GST_FORMAT_DEFAULT: + entry = gst_avi_demux_index_entry_for_frame (avi, stream->num, + desired_offset, flags); + break; + case GST_FORMAT_TIME: + entry = gst_avi_demux_index_entry_for_time (avi, stream->num, + desired_offset, flags); + break; + } + + if (entry) { + min_index = gst_avi_demux_sync_streams (avi, entry->ts); + seek_entry = &avi->index_entries[min_index]; + + avi->seek_offset = seek_entry->offset + avi->index_offset; + avi->last_seek = entry->ts; + } else { + GST_DEBUG ("no index entry found for format=%d value=%" + G_GINT64_FORMAT, GST_EVENT_SEEK_FORMAT (event), desired_offset); + res = FALSE; + } + break; + } + default: + res = FALSE; + break; } break; default: @@ -682,7 +682,7 @@ gst_avi_demux_stream_avih (GstAviDemux * avi, } if (GST_BUFFER_SIZE (buf) < sizeof (gst_riff_avih)) { g_warning ("Too small avih (%d available, %d needed)", - GST_BUFFER_SIZE (buf), (int) sizeof (gst_riff_avih)); + GST_BUFFER_SIZE (buf), (int) sizeof (gst_riff_avih)); gst_buffer_unref (buf); return FALSE; } @@ -751,7 +751,8 @@ gst_avi_demux_add_stream (GstAviDemux * avi) gst_riff_strf_vids *vids; gst_riff_strf_auds *auds; gst_riff_strf_iavs *iavs; - } strf; + } + strf; /* the stream starts with a 'strh' header */ if (!(tag = gst_riff_peek_tag (riff, NULL))) @@ -768,25 +769,25 @@ gst_avi_demux_add_stream (GstAviDemux * avi) return FALSE; if (tag != GST_RIFF_TAG_strf) { GST_ELEMENT_ERROR (avi, STREAM, DEMUX, (NULL), - ("Invalid AVI header (no strf as second tag)")); + ("Invalid AVI header (no strf as second tag)")); goto skip_stream; } switch (strh->type) { case GST_RIFF_FCC_vids: if (!gst_riff_read_strf_vids (riff, &strf.vids)) - return FALSE; + return FALSE; break; case GST_RIFF_FCC_auds: if (!gst_riff_read_strf_auds (riff, &strf.auds)) - return FALSE; + return FALSE; break; case GST_RIFF_FCC_iavs: if (!gst_riff_read_strf_iavs (riff, &strf.iavs)) - return FALSE; + return FALSE; break; default: g_warning ("Unknown stream type " GST_FOURCC_FORMAT, - GST_FOURCC_ARGS (strh->type)); + GST_FOURCC_ARGS (strh->type)); goto skip_stream; } @@ -801,22 +802,22 @@ gst_avi_demux_add_stream (GstAviDemux * avi) switch (tag) { case GST_RIFF_TAG_strn: - if (name) - g_free (name); - if (!gst_riff_read_ascii (riff, &tag, &name)) - return FALSE; - break; + if (name) + g_free (name); + if (!gst_riff_read_ascii (riff, &tag, &name)) + return FALSE; + break; default: - GST_WARNING ("Unknown tag " GST_FOURCC_FORMAT " in AVI header", - GST_FOURCC_ARGS (tag)); - /* fall-through */ + GST_WARNING ("Unknown tag " GST_FOURCC_FORMAT " in AVI header", + GST_FOURCC_ARGS (tag)); + /* fall-through */ - case GST_RIFF_TAG_strd: /* what is this? */ + case GST_RIFF_TAG_strd: /* what is this? */ case GST_RIFF_TAG_JUNK: - if (!gst_riff_read_skip (riff)) - return FALSE; - break; + if (!gst_riff_read_skip (riff)) + return FALSE; + break; } if (avi->level_up) { @@ -835,13 +836,13 @@ gst_avi_demux_add_stream (GstAviDemux * avi) padname = g_strdup_printf ("video_%02d", avi->num_v_streams); templ = gst_element_class_get_pad_template (klass, "video_%02d"); caps = gst_riff_create_video_caps (strf.vids->compression, strh, - strf.vids, &codec_name); + strf.vids, &codec_name); gst_tag_list_add (list, GST_TAG_MERGE_APPEND, GST_TAG_VIDEO_CODEC, - codec_name, NULL); + codec_name, NULL); gst_element_found_tags (GST_ELEMENT (avi), list); gst_tag_list_free (list); if (codec_name) - g_free (codec_name); + g_free (codec_name); g_free (strf.vids); avi->num_v_streams++; break; @@ -854,13 +855,13 @@ gst_avi_demux_add_stream (GstAviDemux * avi) padname = g_strdup_printf ("audio_%02d", avi->num_a_streams); templ = gst_element_class_get_pad_template (klass, "audio_%02d"); caps = gst_riff_create_audio_caps (strf.auds->format, strh, strf.auds, - &codec_name); + &codec_name); gst_tag_list_add (list, GST_TAG_MERGE_APPEND, GST_TAG_AUDIO_CODEC, - codec_name, NULL); + codec_name, NULL); gst_element_found_tags (GST_ELEMENT (avi), list); gst_tag_list_free (list); if (codec_name) - g_free (codec_name); + g_free (codec_name); g_free (strf.auds); avi->num_a_streams++; break; @@ -873,13 +874,13 @@ gst_avi_demux_add_stream (GstAviDemux * avi) padname = g_strdup_printf ("video_%02d", avi->num_v_streams); templ = gst_element_class_get_pad_template (klass, "video_%02d"); caps = gst_riff_create_iavs_caps (strh->fcc_handler, strh, strf.iavs, - &codec_name); + &codec_name); gst_tag_list_add (list, GST_TAG_MERGE_APPEND, GST_TAG_VIDEO_CODEC, - codec_name, NULL); + codec_name, NULL); gst_element_found_tags (GST_ELEMENT (avi), list); gst_tag_list_free (list); if (codec_name) - g_free (codec_name); + g_free (codec_name); g_free (strf.iavs); avi->num_v_streams++; break; @@ -935,7 +936,7 @@ skip_stream: /* add a "NULL" stream */ avi->num_streams++; - return TRUE; /* recoverable */ + return TRUE; /* recoverable */ } /* @@ -959,37 +960,37 @@ gst_avi_demux_stream_odml (GstAviDemux * avi) switch (tag) { case GST_RIFF_TAG_dmlh:{ - gst_riff_dmlh dmlh, *_dmlh; - GstBuffer *buf; - - if (!gst_riff_read_data (riff, &tag, &buf)) - return FALSE; - if (GST_BUFFER_SIZE (buf) < sizeof (gst_riff_dmlh)) { - g_warning ("DMLH entry is too small (%d bytes, %d needed)", - GST_BUFFER_SIZE (buf), (int) sizeof (gst_riff_dmlh)); - gst_buffer_unref (buf); - break; - } - _dmlh = (gst_riff_dmlh *) GST_BUFFER_DATA (buf); - dmlh.totalframes = GUINT32_FROM_LE (_dmlh->totalframes); - - GST_INFO ("dmlh tag found:"); - GST_INFO (" totalframes: %u", dmlh.totalframes); - - avi->num_frames = dmlh.totalframes; - gst_buffer_unref (buf); - break; + gst_riff_dmlh dmlh, *_dmlh; + GstBuffer *buf; + + if (!gst_riff_read_data (riff, &tag, &buf)) + return FALSE; + if (GST_BUFFER_SIZE (buf) < sizeof (gst_riff_dmlh)) { + g_warning ("DMLH entry is too small (%d bytes, %d needed)", + GST_BUFFER_SIZE (buf), (int) sizeof (gst_riff_dmlh)); + gst_buffer_unref (buf); + break; + } + _dmlh = (gst_riff_dmlh *) GST_BUFFER_DATA (buf); + dmlh.totalframes = GUINT32_FROM_LE (_dmlh->totalframes); + + GST_INFO ("dmlh tag found:"); + GST_INFO (" totalframes: %u", dmlh.totalframes); + + avi->num_frames = dmlh.totalframes; + gst_buffer_unref (buf); + break; } default: - GST_WARNING ("Unknown tag " GST_FOURCC_FORMAT " in AVI header", - GST_FOURCC_ARGS (tag)); - /* fall-through */ + GST_WARNING ("Unknown tag " GST_FOURCC_FORMAT " in AVI header", + GST_FOURCC_ARGS (tag)); + /* fall-through */ case GST_RIFF_TAG_JUNK: - if (!gst_riff_read_skip (riff)) - return FALSE; - break; + if (!gst_riff_read_skip (riff)) + return FALSE; + break; } if (avi->level_up) { @@ -1036,7 +1037,7 @@ gst_avi_demux_stream_index (GstAviDemux * avi) return FALSE; if (tag != GST_RIFF_TAG_idx1) { g_warning ("No index after data, but " GST_FOURCC_FORMAT, - GST_FOURCC_ARGS (tag)); + GST_FOURCC_ARGS (tag)); goto end; } @@ -1081,9 +1082,9 @@ gst_avi_demux_stream_index (GstAviDemux * avi) /* figure out if the index is 0 based or relative to the MOVI start */ if (i == 0) { if (target->offset < pos_before) - avi->index_offset = pos_before + 8; + avi->index_offset = pos_before + 8; else - avi->index_offset = 0; + avi->index_offset = 0; } target->bytes_before = stream->total_bytes; @@ -1098,11 +1099,11 @@ gst_avi_demux_stream_index (GstAviDemux * avi) if (stream->strh->samplesize && stream->strh->type == GST_RIFF_FCC_auds) { /* constant rate stream */ gst_pad_convert (stream->pad, GST_FORMAT_BYTES, - stream->total_bytes, &format, &target->ts); + stream->total_bytes, &format, &target->ts); } else { /* VBR stream */ gst_pad_convert (stream->pad, GST_FORMAT_DEFAULT, - stream->total_frames, &format, &target->ts); + stream->total_frames, &format, &target->ts); } stream->total_bytes += target->size; @@ -1115,7 +1116,7 @@ gst_avi_demux_stream_index (GstAviDemux * avi) stream = &avi->stream[i]; GST_DEBUG ("stream %u: %u frames, %" G_GINT64_FORMAT " bytes", - i, stream->total_frames, stream->total_bytes); + i, stream->total_frames, stream->total_bytes); } end: @@ -1159,16 +1160,16 @@ gst_avi_demux_stream_header (GstAviDemux * avi) return FALSE; if (tag != GST_RIFF_TAG_LIST) { GST_ELEMENT_ERROR (avi, STREAM, DEMUX, (NULL), - ("Invalid AVI header (no LIST at start): " - GST_FOURCC_FORMAT, GST_FOURCC_ARGS (tag))); + ("Invalid AVI header (no LIST at start): " + GST_FOURCC_FORMAT, GST_FOURCC_ARGS (tag))); return FALSE; } if (!gst_riff_read_list (riff, &tag)) return FALSE; if (tag != GST_RIFF_LIST_hdrl) { GST_ELEMENT_ERROR (avi, STREAM, DEMUX, (NULL), - ("Invalid AVI header (no hdrl at start): " - GST_FOURCC_FORMAT, GST_FOURCC_ARGS (tag))); + ("Invalid AVI header (no hdrl at start): " + GST_FOURCC_FORMAT, GST_FOURCC_ARGS (tag))); return FALSE; } @@ -1177,8 +1178,8 @@ gst_avi_demux_stream_header (GstAviDemux * avi) return FALSE; if (tag != GST_RIFF_TAG_avih) { GST_ELEMENT_ERROR (avi, STREAM, DEMUX, (NULL), - ("Invalid AVI header (no avih at start): " - GST_FOURCC_FORMAT, GST_FOURCC_ARGS (tag))); + ("Invalid AVI header (no avih at start): " + GST_FOURCC_FORMAT, GST_FOURCC_ARGS (tag))); return FALSE; } if (!gst_avi_demux_stream_avih (avi, &flags, &streams)) @@ -1195,44 +1196,44 @@ gst_avi_demux_stream_header (GstAviDemux * avi) switch (tag) { case GST_RIFF_TAG_LIST: - if (!(tag = gst_riff_peek_list (riff))) - return FALSE; - - switch (tag) { - case GST_RIFF_LIST_strl: - if (!gst_riff_read_list (riff, &tag) || - !gst_avi_demux_add_stream (avi)) - return FALSE; - break; - - case GST_RIFF_LIST_odml: - if (!gst_riff_read_list (riff, &tag) || - !gst_avi_demux_stream_odml (avi)) - return FALSE; - break; - - default: - GST_WARNING ("Unknown list " GST_FOURCC_FORMAT " in AVI header", - GST_FOURCC_ARGS (tag)); - /* fall-through */ - - case GST_RIFF_TAG_JUNK: - if (!gst_riff_read_skip (riff)) - return FALSE; - break; - } - - break; + if (!(tag = gst_riff_peek_list (riff))) + return FALSE; + + switch (tag) { + case GST_RIFF_LIST_strl: + if (!gst_riff_read_list (riff, &tag) || + !gst_avi_demux_add_stream (avi)) + return FALSE; + break; + + case GST_RIFF_LIST_odml: + if (!gst_riff_read_list (riff, &tag) || + !gst_avi_demux_stream_odml (avi)) + return FALSE; + break; + + default: + GST_WARNING ("Unknown list " GST_FOURCC_FORMAT " in AVI header", + GST_FOURCC_ARGS (tag)); + /* fall-through */ + + case GST_RIFF_TAG_JUNK: + if (!gst_riff_read_skip (riff)) + return FALSE; + break; + } + + break; default: - GST_WARNING ("Unknown tag " GST_FOURCC_FORMAT " in AVI header", - GST_FOURCC_ARGS (tag)); - /* fall-through */ + GST_WARNING ("Unknown tag " GST_FOURCC_FORMAT " in AVI header", + GST_FOURCC_ARGS (tag)); + /* fall-through */ case GST_RIFF_TAG_JUNK: - if (!gst_riff_read_skip (riff)) - return FALSE; - break; + if (!gst_riff_read_skip (riff)) + return FALSE; + break; } if (avi->level_up) { @@ -1243,7 +1244,7 @@ gst_avi_demux_stream_header (GstAviDemux * avi) if (avi->num_streams != streams) { g_warning ("Stream header mentioned %d streams, but %d available", - streams, avi->num_streams); + streams, avi->num_streams); } /* we've got streaminfo now */ @@ -1255,17 +1256,17 @@ gst_avi_demux_stream_header (GstAviDemux * avi) return FALSE; if (tag != GST_RIFF_TAG_LIST) { if (!gst_riff_read_skip (riff)) - return FALSE; + return FALSE; continue; } if (!(tag = gst_riff_peek_list (riff))) return FALSE; if (tag != GST_RIFF_LIST_movi) { if (tag == GST_RIFF_LIST_INFO) { - if (!gst_riff_read_list (riff, &tag) || !gst_riff_read_info (riff)) - return FALSE; + if (!gst_riff_read_list (riff, &tag) || !gst_riff_read_info (riff)) + return FALSE; } else if (!gst_riff_read_skip (riff)) { - return FALSE; + return FALSE; } continue; } @@ -1307,7 +1308,7 @@ gst_avi_demux_handle_seek (GstAviDemux * avi) if (GST_PAD_IS_USABLE (stream->pad)) { event = gst_event_new_discontinuous (FALSE, GST_FORMAT_TIME, - avi->last_seek + stream->delay, NULL); + avi->last_seek + stream->delay, NULL); gst_pad_push (stream->pad, GST_DATA (event)); } } @@ -1347,40 +1348,40 @@ gst_avi_demux_stream_data (GstAviDemux * avi) switch (tag) { case GST_RIFF_TAG_LIST: - if (!(tag = gst_riff_peek_list (riff))) - return FALSE; - - switch (tag) { - case GST_RIFF_LIST_AVIX: - case GST_RIFF_LIST_movi: - if (!gst_riff_read_list (riff, &tag)) - return FALSE; - /* we're now going to read buffers! */ - break; - - default: - GST_WARNING ("Unknown list " GST_FOURCC_FORMAT " before AVI data", - GST_FOURCC_ARGS (tag)); - /* fall-through */ - - case GST_RIFF_TAG_JUNK: - if (!gst_riff_read_skip (riff)) - return FALSE; - break; - } - - break; + if (!(tag = gst_riff_peek_list (riff))) + return FALSE; + + switch (tag) { + case GST_RIFF_LIST_AVIX: + case GST_RIFF_LIST_movi: + if (!gst_riff_read_list (riff, &tag)) + return FALSE; + /* we're now going to read buffers! */ + break; + + default: + GST_WARNING ("Unknown list " GST_FOURCC_FORMAT " before AVI data", + GST_FOURCC_ARGS (tag)); + /* fall-through */ + + case GST_RIFF_TAG_JUNK: + if (!gst_riff_read_skip (riff)) + return FALSE; + break; + } + + break; default: - GST_WARNING ("Unknown tag " GST_FOURCC_FORMAT " before AVI data", - GST_FOURCC_ARGS (tag)); - /* fall-through */ + GST_WARNING ("Unknown tag " GST_FOURCC_FORMAT " before AVI data", + GST_FOURCC_ARGS (tag)); + /* fall-through */ case GST_RIFF_TAG_idx1: case GST_RIFF_TAG_JUNK: - if (!gst_riff_read_skip (riff)) - return FALSE; - break; + if (!gst_riff_read_skip (riff)) + return FALSE; + break; } } @@ -1391,7 +1392,7 @@ gst_avi_demux_stream_data (GstAviDemux * avi) if (stream_nr < 0 || stream_nr >= avi->num_streams) { /* recoverable */ g_warning ("Invalid stream ID %d (" GST_FOURCC_FORMAT ")", - stream_nr, GST_FOURCC_ARGS (tag)); + stream_nr, GST_FOURCC_ARGS (tag)); if (!gst_riff_read_skip (riff)) return FALSE; } else { @@ -1407,11 +1408,11 @@ gst_avi_demux_stream_data (GstAviDemux * avi) /* get time of this buffer */ stream = &avi->stream[stream_nr]; entry = gst_avi_demux_index_next (avi, stream_nr, - stream->current_entry + 1, 0); + stream->current_entry + 1, 0); if (entry) { stream->current_entry = entry->index_nr; if (entry->flags & GST_RIFF_IF_KEYFRAME) { - GST_BUFFER_FLAG_SET (buf, GST_BUFFER_KEY_UNIT); + GST_BUFFER_FLAG_SET (buf, GST_BUFFER_KEY_UNIT); } } format = GST_FORMAT_TIME; @@ -1419,7 +1420,7 @@ gst_avi_demux_stream_data (GstAviDemux * avi) /* set delay (if any) */ if (stream->strh->init_frames == stream->current_frame && - stream->delay == 0) + stream->delay == 0) stream->delay = next_ts; stream->current_frame++; @@ -1431,15 +1432,15 @@ gst_avi_demux_stream_data (GstAviDemux * avi) gst_buffer_unref (buf); } else { if (!stream->pad || !GST_PAD_IS_USABLE (stream->pad)) { - gst_buffer_unref (buf); + gst_buffer_unref (buf); } else { - GstClockTime dur_ts; + GstClockTime dur_ts; - GST_BUFFER_TIMESTAMP (buf) = next_ts; - gst_pad_query (stream->pad, GST_QUERY_POSITION, &format, &dur_ts); - GST_BUFFER_DURATION (buf) = dur_ts - next_ts; + GST_BUFFER_TIMESTAMP (buf) = next_ts; + gst_pad_query (stream->pad, GST_QUERY_POSITION, &format, &dur_ts); + GST_BUFFER_DURATION (buf) = dur_ts - next_ts; - gst_pad_push (stream->pad, GST_DATA (buf)); + gst_pad_push (stream->pad, GST_DATA (buf)); } } } @@ -1455,19 +1456,19 @@ gst_avi_demux_loop (GstElement * element) switch (avi->state) { case GST_AVI_DEMUX_START: if (!gst_avi_demux_stream_init (avi)) - return; + return; avi->state = GST_AVI_DEMUX_HEADER; /* fall-through */ case GST_AVI_DEMUX_HEADER: if (!gst_avi_demux_stream_header (avi)) - return; + return; avi->state = GST_AVI_DEMUX_MOVI; /* fall-through */ case GST_AVI_DEMUX_MOVI: if (!gst_avi_demux_stream_data (avi)) - return; + return; break; default: diff --git a/gst/avi/gstavimux.c b/gst/avi/gstavimux.c index f5287db0..d613d0cc 100644 --- a/gst/avi/gstavimux.c +++ b/gst/avi/gstavimux.c @@ -68,40 +68,40 @@ static GstStaticPadTemplate video_sink_factory = GST_PAD_SINK, GST_PAD_REQUEST, GST_STATIC_CAPS ("video/x-raw-yuv, " - "format = (fourcc) { YUY2, I420 }, " - "width = (int) [ 16, 4096 ], " - "height = (int) [ 16, 4096 ]; " - "video/x-jpeg, " - "width = (int) [ 16, 4096 ], " - "height = (int) [ 16, 4096 ]; " - "video/x-divx, " - "width = (int) [ 16, 4096 ], " - "height = (int) [ 16, 4096 ], " - "divxversion = (int) [ 3, 5 ]; " - "video/x-xvid, " - "width = (int) [ 16, 4096 ], " - "height = (int) [ 16, 4096 ]; " - "video/x-3ivx, " - "width = (int) [ 16, 4096 ], " - "height = (int) [ 16, 4096 ]; " - "video/x-msmpeg, " - "width = (int) [ 16, 4096 ], " - "height = (int) [ 16, 4096 ], " - "msmpegversion = (int) [ 41, 43 ]; " - "video/mpeg, " - "width = (int) [ 16, 4096 ], " - "height = (int) [ 16, 4096 ], " - "mpegversion = (int) 1, " - "systemstream = (boolean) FALSE; " - "video/x-h263, " - "width = (int) [ 16, 4096 ], " - "height = (int) [ 16, 4096 ]; " - "video/x-dv, " - "width = (int) 720, " - "height = (int) { 576, 480 }, " - "systemstream = (boolean) FALSE; " - "video/x-huffyuv, " - "width = (int) [ 16, 4096 ], " "height = (int) [ 16, 4096 ]") + "format = (fourcc) { YUY2, I420 }, " + "width = (int) [ 16, 4096 ], " + "height = (int) [ 16, 4096 ]; " + "video/x-jpeg, " + "width = (int) [ 16, 4096 ], " + "height = (int) [ 16, 4096 ]; " + "video/x-divx, " + "width = (int) [ 16, 4096 ], " + "height = (int) [ 16, 4096 ], " + "divxversion = (int) [ 3, 5 ]; " + "video/x-xvid, " + "width = (int) [ 16, 4096 ], " + "height = (int) [ 16, 4096 ]; " + "video/x-3ivx, " + "width = (int) [ 16, 4096 ], " + "height = (int) [ 16, 4096 ]; " + "video/x-msmpeg, " + "width = (int) [ 16, 4096 ], " + "height = (int) [ 16, 4096 ], " + "msmpegversion = (int) [ 41, 43 ]; " + "video/mpeg, " + "width = (int) [ 16, 4096 ], " + "height = (int) [ 16, 4096 ], " + "mpegversion = (int) 1, " + "systemstream = (boolean) FALSE; " + "video/x-h263, " + "width = (int) [ 16, 4096 ], " + "height = (int) [ 16, 4096 ]; " + "video/x-dv, " + "width = (int) 720, " + "height = (int) { 576, 480 }, " + "systemstream = (boolean) FALSE; " + "video/x-huffyuv, " + "width = (int) [ 16, 4096 ], " "height = (int) [ 16, 4096 ]") ); static GstStaticPadTemplate audio_sink_factory = @@ -109,22 +109,22 @@ static GstStaticPadTemplate audio_sink_factory = GST_PAD_SINK, GST_PAD_REQUEST, GST_STATIC_CAPS ("audio/x-raw-int, " - "endianness = (int) LITTLE_ENDIAN, " - "signed = (boolean) { TRUE, FALSE }, " - "width = (int) { 8, 16 }, " - "depth = (int) { 8, 16 }, " - "rate = (int) [ 1000, 96000 ], " - "channels = (int) [ 1, 2 ]; " - "audio/mpeg, " - "mpegversion = (int) 1, " - "layer = (int) [ 1, 3 ], " - "rate = (int) [ 1000, 96000 ], " - "channels = (int) [ 1, 2 ]; " - "audio/x-vorbis, " - "rate = (int) [ 1000, 96000 ], " - "channels = (int) [ 1, 2 ]; " - "audio/x-ac3, " - "rate = (int) [ 1000, 96000 ], " "channels = (int) [ 1, 2 ]") + "endianness = (int) LITTLE_ENDIAN, " + "signed = (boolean) { TRUE, FALSE }, " + "width = (int) { 8, 16 }, " + "depth = (int) { 8, 16 }, " + "rate = (int) [ 1000, 96000 ], " + "channels = (int) [ 1, 2 ]; " + "audio/mpeg, " + "mpegversion = (int) 1, " + "layer = (int) [ 1, 3 ], " + "rate = (int) [ 1000, 96000 ], " + "channels = (int) [ 1, 2 ]; " + "audio/x-vorbis, " + "rate = (int) [ 1000, 96000 ], " + "channels = (int) [ 1, 2 ]; " + "audio/x-ac3, " + "rate = (int) [ 1000, 96000 ], " "channels = (int) [ 1, 2 ]") ); @@ -163,8 +163,9 @@ gst_avimux_get_type (void) 0, (GInstanceInitFunc) gst_avimux_init, }; + avimux_type = - g_type_register_static (GST_TYPE_ELEMENT, "GstAviMux", &avimux_info, 0); + g_type_register_static (GST_TYPE_ELEMENT, "GstAviMux", &avimux_info, 0); } return avimux_type; } @@ -202,7 +203,7 @@ gst_avimux_class_init (GstAviMuxClass * klass) g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_BIGFILE, g_param_spec_boolean ("bigfile", "Bigfile Support", - "Support for openDML-2.0 (big) AVI files", 0, G_PARAM_READWRITE)); + "Support for openDML-2.0 (big) AVI files", 0, G_PARAM_READWRITE)); gstelement_class->request_new_pad = gst_avimux_request_new_pad; @@ -230,7 +231,7 @@ gst_avimux_init (GstAviMux * avimux) avimux->srcpad = gst_pad_new_from_template (gst_element_class_get_pad_template (klass, - "src"), "src"); + "src"), "src"); gst_element_add_pad (GST_ELEMENT (avimux), avimux->srcpad); GST_FLAG_SET (GST_ELEMENT (avimux), GST_ELEMENT_EVENT_AWARE); @@ -303,11 +304,11 @@ gst_avimux_vidsinkconnect (GstPad * pad, const GstCaps * vscaps) avimux->vids.compression = format; switch (format) { case GST_MAKE_FOURCC ('Y', 'U', 'Y', '2'): - avimux->vids.bit_cnt = 16; - break; + avimux->vids.bit_cnt = 16; + break; case GST_MAKE_FOURCC ('I', '4', '2', '0'): - avimux->vids.bit_cnt = 12; - break; + avimux->vids.bit_cnt = 12; + break; } } else { avimux->vids.bit_cnt = 24; @@ -323,15 +324,15 @@ gst_avimux_vidsinkconnect (GstPad * pad, const GstCaps * vscaps) gst_structure_get_int (structure, "divxversion", &divxversion); switch (divxversion) { - case 3: - avimux->vids.compression = GST_MAKE_FOURCC ('D', 'I', 'V', '3'); - break; - case 4: - avimux->vids.compression = GST_MAKE_FOURCC ('D', 'I', 'V', 'X'); - break; - case 5: - avimux->vids.compression = GST_MAKE_FOURCC ('D', 'X', '5', '0'); - break; + case 3: + avimux->vids.compression = GST_MAKE_FOURCC ('D', 'I', 'V', '3'); + break; + case 4: + avimux->vids.compression = GST_MAKE_FOURCC ('D', 'I', 'V', 'X'); + break; + case 5: + avimux->vids.compression = GST_MAKE_FOURCC ('D', 'X', '5', '0'); + break; } } else if (!strcmp (mimetype, "video/x-xvid")) { avimux->vids.compression = GST_MAKE_FOURCC ('X', 'V', 'I', 'D'); @@ -342,15 +343,15 @@ gst_avimux_vidsinkconnect (GstPad * pad, const GstCaps * vscaps) gst_structure_get_int (structure, "msmpegversion", &msmpegversion); switch (msmpegversion) { - case 41: - avimux->vids.compression = GST_MAKE_FOURCC ('M', 'P', 'G', '4'); - break; - case 42: - avimux->vids.compression = GST_MAKE_FOURCC ('M', 'P', '4', '2'); - break; - case 43: - avimux->vids.compression = GST_MAKE_FOURCC ('M', 'P', '4', '3'); - break; + case 41: + avimux->vids.compression = GST_MAKE_FOURCC ('M', 'P', 'G', '4'); + break; + case 42: + avimux->vids.compression = GST_MAKE_FOURCC ('M', 'P', '4', '2'); + break; + case 43: + avimux->vids.compression = GST_MAKE_FOURCC ('M', 'P', '4', '3'); + break; } } else if (!strcmp (mimetype, "video/x-dv")) { avimux->vids.compression = GST_MAKE_FOURCC ('D', 'V', 'S', 'D'); @@ -417,13 +418,13 @@ gst_avimux_audsinkconnect (GstPad * pad, const GstCaps * vscaps) gst_structure_get_int (structure, "layer", &layer); switch (layer) { - case 3: - avimux->auds.format = GST_RIFF_WAVE_FORMAT_MPEGL3; - break; - case 1: - case 2: - avimux->auds.format = GST_RIFF_WAVE_FORMAT_MPEGL12; - break; + case 3: + avimux->auds.format = GST_RIFF_WAVE_FORMAT_MPEGL3; + break; + case 1: + case 2: + avimux->auds.format = GST_RIFF_WAVE_FORMAT_MPEGL12; + break; } } else if (!strcmp (mimetype, "audio/x-vorbis")) { avimux->auds.format = GST_RIFF_WAVE_FORMAT_VORBIS3; @@ -544,17 +545,17 @@ gst_avimux_riff_get_avi_header (GstAviMux * avimux) /* first, let's see what actually needs to be in the buffer */ GST_BUFFER_SIZE (buffer) = 0; - GST_BUFFER_SIZE (buffer) += 32 + sizeof (gst_riff_avih); /* avi header */ - if (avimux->video_pad_connected) { /* we have video */ - GST_BUFFER_SIZE (buffer) += 28 + sizeof (gst_riff_strh) + sizeof (gst_riff_strf_vids); /* vid hdr */ - GST_BUFFER_SIZE (buffer) += 24; /* odml header */ + GST_BUFFER_SIZE (buffer) += 32 + sizeof (gst_riff_avih); /* avi header */ + if (avimux->video_pad_connected) { /* we have video */ + GST_BUFFER_SIZE (buffer) += 28 + sizeof (gst_riff_strh) + sizeof (gst_riff_strf_vids); /* vid hdr */ + GST_BUFFER_SIZE (buffer) += 24; /* odml header */ } - if (avimux->audio_pad_connected) { /* we have audio */ - GST_BUFFER_SIZE (buffer) += 28 + sizeof (gst_riff_strh) + sizeof (gst_riff_strf_auds); /* aud hdr */ + if (avimux->audio_pad_connected) { /* we have audio */ + GST_BUFFER_SIZE (buffer) += 28 + sizeof (gst_riff_strh) + sizeof (gst_riff_strf_auds); /* aud hdr */ } /* this is the "riff size" */ avimux->header_size = GST_BUFFER_SIZE (buffer); - GST_BUFFER_SIZE (buffer) += 12; /* avi data header */ + GST_BUFFER_SIZE (buffer) += 12; /* avi data header */ /* allocate the buffer */ buffdata = GST_BUFFER_DATA (buffer) = g_malloc (GST_BUFFER_SIZE (buffer)); @@ -630,8 +631,8 @@ gst_avimux_riff_get_avi_header (GstAviMux * avimux) memcpy (buffdata, "LIST", 4); buffdata += 4; temp32 = - LE_FROM_GUINT32 (sizeof (gst_riff_strh) + sizeof (gst_riff_strf_vids) + - 4 * 5); + LE_FROM_GUINT32 (sizeof (gst_riff_strh) + sizeof (gst_riff_strf_vids) + + 4 * 5); memcpy (buffdata, &temp32, 4); buffdata += 4; memcpy (buffdata, "strl", 4); @@ -726,8 +727,8 @@ gst_avimux_riff_get_avi_header (GstAviMux * avimux) memcpy (buffdata, "LIST", 4); buffdata += 4; temp32 = - LE_FROM_GUINT32 (sizeof (gst_riff_strh) + sizeof (gst_riff_strf_auds) + - 4 * 5); + LE_FROM_GUINT32 (sizeof (gst_riff_strh) + sizeof (gst_riff_strf_auds) + + 4 * 5); memcpy (buffdata, &temp32, 4); buffdata += 4; memcpy (buffdata, "strl", 4); @@ -901,8 +902,8 @@ gst_avimux_add_index (GstAviMux * avimux, guchar * code, guint32 flags, if (avimux->idx_index == avimux->idx_count) { avimux->idx_count += 256; avimux->idx = - realloc (avimux->idx, - avimux->idx_count * sizeof (gst_riff_index_entry)); + realloc (avimux->idx, + avimux->idx_count * sizeof (gst_riff_index_entry)); } memcpy (&(avimux->idx[avimux->idx_index].id), code, 4); avimux->idx[avimux->idx_index].flags = LE_FROM_GUINT32 (flags); @@ -928,7 +929,7 @@ gst_avimux_write_index (GstAviMux * avimux) buffer = gst_buffer_new (); GST_BUFFER_SIZE (buffer) = avimux->idx_index * sizeof (gst_riff_index_entry); GST_BUFFER_DATA (buffer) = (unsigned char *) avimux->idx; - avimux->idx = NULL; /* will be free()'ed by gst_buffer_unref() */ + avimux->idx = NULL; /* will be free()'ed by gst_buffer_unref() */ avimux->total_data += GST_BUFFER_SIZE (buffer); gst_pad_push (avimux->srcpad, GST_DATA (buffer)); @@ -947,7 +948,7 @@ gst_avimux_bigfile (GstAviMux * avimux, gboolean last) if (avimux->is_bigfile) { /* sarch back */ event = gst_event_new_seek (GST_FORMAT_BYTES | - GST_SEEK_METHOD_SET | GST_SEEK_FLAG_FLUSH, avimux->avix_start); + GST_SEEK_METHOD_SET | GST_SEEK_FLAG_FLUSH, avimux->avix_start); /* if the event succeeds */ gst_pad_push (avimux->srcpad, GST_DATA (event)); @@ -957,7 +958,7 @@ gst_avimux_bigfile (GstAviMux * avimux, gboolean last) /* go back to current location */ event = gst_event_new_seek (GST_FORMAT_BYTES | - GST_SEEK_METHOD_SET | GST_SEEK_FLAG_FLUSH, avimux->total_data); + GST_SEEK_METHOD_SET | GST_SEEK_FLAG_FLUSH, avimux->total_data); gst_pad_push (avimux->srcpad, GST_DATA (event)); } avimux->avix_start = avimux->total_data; @@ -983,7 +984,7 @@ gst_avimux_start_file (GstAviMux * avimux) avimux->total_data = 0; avimux->total_frames = 0; - avimux->data_size = 4; /* ? */ + avimux->data_size = 4; /* ? */ avimux->datax_size = 0; avimux->num_frames = 0; avimux->numx_frames = 0; @@ -992,7 +993,7 @@ gst_avimux_start_file (GstAviMux * avimux) avimux->avix_start = 0; avimux->idx_index = 0; - avimux->idx_offset = 0; /* see 10 lines below */ + avimux->idx_offset = 0; /* see 10 lines below */ avimux->idx_size = 0; avimux->idx_count = 0; avimux->idx = NULL; @@ -1035,7 +1036,7 @@ gst_avimux_stop_file (GstAviMux * avimux) } if (avimux->audio_pad_connected) { avimux->auds_hdr.length = - (avimux->audio_time * avimux->auds.rate) / GST_SECOND; + (avimux->audio_time * avimux->auds.rate) / GST_SECOND; } /* set rate and everything having to do with that */ @@ -1044,13 +1045,13 @@ gst_avimux_stop_file (GstAviMux * avimux) /* calculate bps if needed */ if (!avimux->auds.av_bps) { if (avimux->audio_time) { - avimux->auds_hdr.rate = - (GST_SECOND * avimux->audio_size) / avimux->audio_time; + avimux->auds_hdr.rate = + (GST_SECOND * avimux->audio_size) / avimux->audio_time; } else { - GST_ELEMENT_ERROR (avimux, STREAM, MUX, - (_("No or invalid input audio, AVI stream will be corrupt.")), - (NULL)); - avimux->auds_hdr.rate = 0; + GST_ELEMENT_ERROR (avimux, STREAM, MUX, + (_("No or invalid input audio, AVI stream will be corrupt.")), + (NULL)); + avimux->auds_hdr.rate = 0; } avimux->auds.av_bps = avimux->auds_hdr.rate * avimux->auds_hdr.scale; } @@ -1058,7 +1059,7 @@ gst_avimux_stop_file (GstAviMux * avimux) } if (avimux->video_pad_connected) { avimux->avi_hdr.max_bps += ((avimux->vids.bit_cnt + 7) / 8) * - (1000000. / avimux->avi_hdr.us_frame) * avimux->vids.image_size; + (1000000. / avimux->avi_hdr.us_frame) * avimux->vids.image_size; } /* seek and rewrite the header */ @@ -1101,11 +1102,11 @@ gst_avimux_handle_event (GstPad * pad, GstEvent * event) case GST_EVENT_EOS: /* is this allright? */ if (pad == avimux->videosinkpad) { - avimux->video_pad_eos = TRUE; + avimux->video_pad_eos = TRUE; } else if (pad == avimux->audiosinkpad) { - avimux->audio_pad_eos = TRUE; + avimux->audio_pad_eos = TRUE; } else { - g_warning ("Unknown pad for EOS!"); + g_warning ("Unknown pad for EOS!"); } break; default: @@ -1256,7 +1257,7 @@ gst_avimux_do_one_buffer (GstAviMux * avimux) { if (avimux->video_buffer_queue && avimux->audio_buffer_queue) { if (GST_BUFFER_TIMESTAMP (avimux->video_buffer_queue) <= - GST_BUFFER_TIMESTAMP (avimux->audio_buffer_queue)) + GST_BUFFER_TIMESTAMP (avimux->audio_buffer_queue)) gst_avimux_do_video_buffer (avimux); else gst_avimux_do_audio_buffer (avimux); diff --git a/gst/cutter/gstcutter.c b/gst/cutter/gstcutter.c index 9b82b057..89a5723b 100644 --- a/gst/cutter/gstcutter.c +++ b/gst/cutter/gstcutter.c @@ -57,7 +57,7 @@ static GstStaticPadTemplate cutter_src_factory = GST_STATIC_PAD_TEMPLATE ("src", GST_PAD_SRC, GST_PAD_ALWAYS, GST_STATIC_CAPS (GST_AUDIO_INT_PAD_TEMPLATE_CAPS "; " - GST_AUDIO_FLOAT_PAD_TEMPLATE_CAPS) + GST_AUDIO_FLOAT_PAD_TEMPLATE_CAPS) ); static GstStaticPadTemplate cutter_sink_factory = @@ -65,7 +65,7 @@ static GstStaticPadTemplate cutter_sink_factory = GST_PAD_SINK, GST_PAD_ALWAYS, GST_STATIC_CAPS (GST_AUDIO_INT_PAD_TEMPLATE_CAPS "; " - GST_AUDIO_FLOAT_PAD_TEMPLATE_CAPS) + GST_AUDIO_FLOAT_PAD_TEMPLATE_CAPS) ); static void gst_cutter_base_init (gpointer g_class); @@ -101,8 +101,9 @@ gst_cutter_get_type (void) sizeof (GstCutter), 0, (GInstanceInitFunc) gst_cutter_init, }; + cutter_type = g_type_register_static (GST_TYPE_ELEMENT, "GstCutter", - &cutter_info, 0); + &cutter_info, 0); } return cutter_type; } @@ -146,24 +147,24 @@ gst_cutter_class_init (GstCutterClass * klass) g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_THRESHOLD, g_param_spec_double ("threshold", "Threshold", - "Volume threshold before trigger", - -G_MAXDOUBLE, G_MAXDOUBLE, 0.0, G_PARAM_READWRITE)); + "Volume threshold before trigger", + -G_MAXDOUBLE, G_MAXDOUBLE, 0.0, G_PARAM_READWRITE)); g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_THRESHOLD_DB, g_param_spec_double ("threshold_dB", "Threshold (dB)", - "Volume threshold before trigger (in dB)", - -G_MAXDOUBLE, G_MAXDOUBLE, 0.0, G_PARAM_READWRITE)); + "Volume threshold before trigger (in dB)", + -G_MAXDOUBLE, G_MAXDOUBLE, 0.0, G_PARAM_READWRITE)); g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_RUN_LENGTH, g_param_spec_double ("runlength", "Runlength", - "Length of drop below threshold before cut_stop (seconds)", - 0.0, G_MAXDOUBLE, 0.0, G_PARAM_READWRITE)); + "Length of drop below threshold before cut_stop (seconds)", + 0.0, G_MAXDOUBLE, 0.0, G_PARAM_READWRITE)); g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_PRE_LENGTH, g_param_spec_double ("prelength", "prelength", - "Length of pre-recording buffer (seconds)", - 0.0, G_MAXDOUBLE, 0.0, G_PARAM_READWRITE)); + "Length of pre-recording buffer (seconds)", + 0.0, G_MAXDOUBLE, 0.0, G_PARAM_READWRITE)); g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_LEAKY, g_param_spec_boolean ("leaky", "Leaky", - "do we leak buffers when below threshold ?", - FALSE, G_PARAM_READWRITE)); + "do we leak buffers when below threshold ?", + FALSE, G_PARAM_READWRITE)); gst_cutter_signals[CUT_START] = g_signal_new ("cut-start", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_FIRST, @@ -214,10 +215,10 @@ gst_cutter_chain (GstPad * pad, GstData * _data) GstBuffer *buf = GST_BUFFER (_data); GstCutter *filter; gint16 *in_data; - double RMS = 0.0; /* RMS of signal in buffer */ - double ms = 0.0; /* mean square value of buffer */ - static gboolean silent_prev = FALSE; /* previous value of silent */ - GstBuffer *prebuf; /* pointer to a prebuffer element */ + double RMS = 0.0; /* RMS of signal in buffer */ + double ms = 0.0; /* mean square value of buffer */ + static gboolean silent_prev = FALSE; /* previous value of silent */ + GstBuffer *prebuf; /* pointer to a prebuffer element */ g_return_if_fail (pad != NULL); g_return_if_fail (GST_IS_PAD (pad)); @@ -247,7 +248,7 @@ gst_cutter_chain (GstPad * pad, GstData * _data) default: /* this shouldn't happen */ g_print ("WARNING: no mean square function for width %d\n", - filter->width); + filter->width); break; } @@ -285,10 +286,10 @@ gst_cutter_chain (GstPad * pad, GstData * _data) g_signal_emit (G_OBJECT (filter), gst_cutter_signals[CUT_START], 0); GST_DEBUG ("flushing buffer of length %.3f", filter->pre_run_length); while (filter->pre_buffer) { - prebuf = (g_list_first (filter->pre_buffer))->data; - filter->pre_buffer = g_list_remove (filter->pre_buffer, prebuf); - gst_pad_push (filter->srcpad, GST_DATA (prebuf)); - ++count; + prebuf = (g_list_first (filter->pre_buffer))->data; + filter->pre_buffer = g_list_remove (filter->pre_buffer, prebuf); + gst_pad_push (filter->srcpad, GST_DATA (prebuf)); + ++count; } GST_DEBUG ("flushed %d buffers", count); filter->pre_run_length = 0.0; @@ -313,7 +314,7 @@ gst_cutter_chain (GstPad * pad, GstData * _data) filter->pre_run_length -= gst_audio_length (filter->srcpad, prebuf); /* only pass buffers if we don't leak */ if (!filter->leaky) - gst_pad_push (filter->srcpad, GST_DATA (prebuf)); + gst_pad_push (filter->srcpad, GST_DATA (prebuf)); /* we unref it after getting it out of the pre_buffer */ gst_buffer_unref (prebuf); } @@ -327,7 +328,7 @@ gst_cutter_16bit_ms (gint16 * data, guint num_samples) static double inline gst_cutter_8bit_ms (gint8 * data, guint num_samples) #include "filter.func" static void - gst_cutter_set_property (GObject * object, guint prop_id, + gst_cutter_set_property (GObject * object, guint prop_id, const GValue * value, GParamSpec * pspec) { GstCutter *filter; diff --git a/gst/debug/efence.c b/gst/debug/efence.c index f6e576e3..e44e8dc6 100644 --- a/gst/debug/efence.c +++ b/gst/debug/efence.c @@ -122,8 +122,9 @@ gst_gst_efence_get_type (void) 0, (GInstanceInitFunc) gst_efence_init, }; + plugin_type = g_type_register_static (GST_TYPE_ELEMENT, - "GstEFence", &plugin_info, 0); + "GstEFence", &plugin_info, 0); } return plugin_type; } @@ -154,7 +155,7 @@ gst_efence_class_init (GstEFenceClass * klass) g_object_class_install_property (gobject_class, ARG_FENCE_TOP, g_param_spec_boolean ("fence_top", "Fence Top", - "Align buffers with top of fenced region", TRUE, G_PARAM_READWRITE)); + "Align buffers with top of fenced region", TRUE, G_PARAM_READWRITE)); gobject_class->set_property = gst_efence_set_property; gobject_class->get_property = gst_efence_get_property; @@ -350,11 +351,11 @@ gst_fenced_buffer_default_free (GstData * data) if (!GST_BUFFER_FLAG_IS_SET (buffer, GST_BUFFER_DONTFREE) && GST_BUFFER_DATA (buffer)) { GST_DEBUG ("free region %p %d", fenced_buffer->region, - fenced_buffer->length); + fenced_buffer->length); munmap (fenced_buffer->region, fenced_buffer->length); } else { GST_DEBUG ("not freeing region %p %d %p", fenced_buffer->region, - GST_BUFFER_FLAGS (buffer), GST_BUFFER_DATA (buffer)); + GST_BUFFER_FLAGS (buffer), GST_BUFFER_DATA (buffer)); } /* set to safe values */ diff --git a/gst/debug/gstnavigationtest.c b/gst/debug/gstnavigationtest.c index e1b7486f..4bc934b3 100644 --- a/gst/debug/gstnavigationtest.c +++ b/gst/debug/gstnavigationtest.c @@ -79,8 +79,9 @@ gst_navigationtest_get_type (void) 0, gst_navigationtest_init, }; + navigationtest_type = g_type_register_static (GST_TYPE_VIDEOFILTER, - "GstNavigationtest", &navigationtest_info, 0); + "GstNavigationtest", &navigationtest_info, 0); } return navigationtest_type; } @@ -106,7 +107,7 @@ gst_navigationtest_base_init (gpointer g_class) for (i = 0; i < G_N_ELEMENTS (gst_navigationtest_formats); i++) { gst_videofilter_class_add_format (videofilter_class, - gst_navigationtest_formats + i); + gst_navigationtest_formats + i); } gst_videofilter_class_add_pad_templates (GST_VIDEOFILTER_CLASS (g_class)); @@ -124,8 +125,8 @@ gst_navigationtest_class_init (gpointer g_class, gpointer class_data) #if 0 g_object_class_install_property (gobject_class, ARG_METHOD, g_param_spec_enum ("method", "method", "method", - GST_TYPE_NAVIGATIONTEST_METHOD, GST_NAVIGATIONTEST_METHOD_1, - G_PARAM_READWRITE)); + GST_TYPE_NAVIGATIONTEST_METHOD, GST_NAVIGATIONTEST_METHOD_1, + G_PARAM_READWRITE)); #endif gobject_class->set_property = gst_navigationtest_set_property; @@ -161,9 +162,9 @@ gst_navigationtest_handle_src_event (GstPad * pad, GstEvent * event) switch (GST_EVENT_TYPE (event)) { case GST_EVENT_NAVIGATION: gst_structure_get_double (event->event_data.structure.structure, - "pointer_x", &navigationtest->x); + "pointer_x", &navigationtest->x); gst_structure_get_double (event->event_data.structure.structure, - "pointer_y", &navigationtest->y); + "pointer_y", &navigationtest->y); break; default: break; diff --git a/gst/effectv/gstaging.c b/gst/effectv/gstaging.c index 44683546..ee264119 100644 --- a/gst/effectv/gstaging.c +++ b/gst/effectv/gstaging.c @@ -60,7 +60,8 @@ typedef struct _scratch gint x; gint dx; gint init; -} scratch; +} +scratch; static int dx[8] = { 1, 1, 0, -1, -1, -1, 0, 1 }; static int dy[8] = { 0, -1, -1, -1, 0, 1, 1, 1 }; @@ -129,8 +130,9 @@ gst_agingtv_get_type (void) 0, gst_agingtv_init, }; + agingtv_type = g_type_register_static (GST_TYPE_VIDEOFILTER, - "GstAgingTV", &agingtv_info, 0); + "GstAgingTV", &agingtv_info, 0); } return agingtv_type; } @@ -155,7 +157,7 @@ gst_agingtv_base_init (gpointer g_class) for (i = 0; i < G_N_ELEMENTS (gst_agingtv_formats); i++) { gst_videofilter_class_add_format (videofilter_class, - gst_agingtv_formats + i); + gst_agingtv_formats + i); } gst_videofilter_class_add_pad_templates (GST_VIDEOFILTER_CLASS (g_class)); @@ -173,7 +175,7 @@ gst_agingtv_class_init (gpointer g_class, gpointer class_data) #if 0 g_object_class_install_property (gobject_class, ARG_METHOD, g_param_spec_enum ("method", "method", "method", - GST_TYPE_AGINGTV_METHOD, GST_AGINGTV_METHOD_1, G_PARAM_READWRITE)); + GST_TYPE_AGINGTV_METHOD, GST_AGINGTV_METHOD_1, G_PARAM_READWRITE)); #endif gobject_class->set_property = gst_agingtv_set_property; @@ -249,35 +251,35 @@ scratching (scratch * scratches, gint scratch_lines, guint32 * dest, gint width, scratch->x = scratch->x + scratch->dx; if (scratch->x < 0 || scratch->x > width * 256) { - scratch->life = 0; - break; + scratch->life = 0; + break; } p = dest + (scratch->x >> 8); if (scratch->init) { - y1 = scratch->init; - scratch->init = 0; + y1 = scratch->init; + scratch->init = 0; } else { - y1 = 0; + y1 = 0; } scratch->life--; if (scratch->life) { - y2 = height; + y2 = height; } else { - y2 = fastrand () % height; + y2 = fastrand () % height; } for (y = y1; y < y2; y++) { - a = *p & 0xfefeff; - a += 0x202020; - b = a & 0x1010100; - *p = a | (b - (b >> 8)); - p += width; + a = *p & 0xfefeff; + a += 0x202020; + b = a & 0x1010100; + *p = a | (b - (b >> 8)); + p += width; } } else { if ((fastrand () & 0xf0000000) == 0) { - scratch->life = 2 + (fastrand () >> 27); - scratch->x = fastrand () % (width * 256); - scratch->dx = ((int) fastrand ()) >> 23; - scratch->init = (fastrand () % (height - 1)) + 1; + scratch->life = 2 + (fastrand () >> 27); + scratch->x = fastrand () % (width * 256); + scratch->dx = ((int) fastrand ()) >> 23; + scratch->init = (fastrand () % (height - 1)) + 1; } } } @@ -311,7 +313,7 @@ dusts (guint32 * dest, gint width, gint height, gint dust_interval, x += dx[d]; if (y >= height || x >= width) - break; + break; d = (d + fastrand () % 3 - 1) & 7; } @@ -350,7 +352,7 @@ pits (guint32 * dest, gint width, gint height, gint area_scale, y = y + fastrand () % 3 - 1; if (y >= height || x >= width) - break; + break; dest[y * width + x] = 0xc0c0c0; } diff --git a/gst/effectv/gstdice.c b/gst/effectv/gstdice.c index a7cbbc36..f77a4539 100644 --- a/gst/effectv/gstdice.c +++ b/gst/effectv/gstdice.c @@ -41,7 +41,8 @@ typedef enum _dice_dir DICE_RIGHT = 1, DICE_DOWN = 2, DICE_LEFT = 3 -} DiceDir; +} +DiceDir; struct _GstDiceTV { @@ -112,8 +113,8 @@ gst_dicetv_get_type (void) }; dicetv_type = - g_type_register_static (GST_TYPE_VIDEOFILTER, "GstDiceTV", &dicetv_info, - 0); + g_type_register_static (GST_TYPE_VIDEOFILTER, "GstDiceTV", &dicetv_info, + 0); } return dicetv_type; } @@ -146,7 +147,7 @@ gst_dicetv_base_init (gpointer g_class) for (i = 0; i < G_N_ELEMENTS (gst_dicetv_formats); i++) { gst_videofilter_class_add_format (videofilter_class, - gst_dicetv_formats + i); + gst_dicetv_formats + i); } gst_videofilter_class_add_pad_templates (GST_VIDEOFILTER_CLASS (g_class)); @@ -174,7 +175,7 @@ gst_dicetv_class_init (gpointer g_class, gpointer class_data) g_object_class_install_property (gobject_class, ARG_CUBE_BITS, g_param_spec_int ("square_bits", "Square Bits", "The size of the Squares", - MIN_CUBE_BITS, MAX_CUBE_BITS, DEFAULT_CUBE_BITS, G_PARAM_READWRITE)); + MIN_CUBE_BITS, MAX_CUBE_BITS, DEFAULT_CUBE_BITS, G_PARAM_READWRITE)); gobject_class->set_property = gst_dicetv_set_property; gobject_class->get_property = gst_dicetv_get_property; @@ -255,50 +256,50 @@ gst_dicetv_draw (GstVideofilter * videofilter, void *d, void *s) base = (map_y << g_cube_bits) * video_width + (map_x << g_cube_bits); switch (filter->dicemap[map_i]) { - case DICE_UP: - for (dy = 0; dy < g_cube_size; dy++) { - i = base + dy * video_width; - for (dx = 0; dx < g_cube_size; dx++) { - dest[i] = src[i]; - i++; - } - } - break; - case DICE_LEFT: - for (dy = 0; dy < g_cube_size; dy++) { - i = base + dy * video_width; - - for (dx = 0; dx < g_cube_size; dx++) { - di = base + (dx * video_width) + (g_cube_size - dy - 1); - dest[di] = src[i]; - i++; - } - } - break; - case DICE_DOWN: - for (dy = 0; dy < g_cube_size; dy++) { - di = base + dy * video_width; - i = base + (g_cube_size - dy - 1) * video_width + g_cube_size; - for (dx = 0; dx < g_cube_size; dx++) { - i--; - dest[di] = src[i]; - di++; - } - } - break; - case DICE_RIGHT: - for (dy = 0; dy < g_cube_size; dy++) { - i = base + (dy * video_width); - for (dx = 0; dx < g_cube_size; dx++) { - di = base + dy + (g_cube_size - dx - 1) * video_width; - dest[di] = src[i]; - i++; - } - } - break; - default: - g_assert_not_reached (); - break; + case DICE_UP: + for (dy = 0; dy < g_cube_size; dy++) { + i = base + dy * video_width; + for (dx = 0; dx < g_cube_size; dx++) { + dest[i] = src[i]; + i++; + } + } + break; + case DICE_LEFT: + for (dy = 0; dy < g_cube_size; dy++) { + i = base + dy * video_width; + + for (dx = 0; dx < g_cube_size; dx++) { + di = base + (dx * video_width) + (g_cube_size - dy - 1); + dest[di] = src[i]; + i++; + } + } + break; + case DICE_DOWN: + for (dy = 0; dy < g_cube_size; dy++) { + di = base + dy * video_width; + i = base + (g_cube_size - dy - 1) * video_width + g_cube_size; + for (dx = 0; dx < g_cube_size; dx++) { + i--; + dest[di] = src[i]; + di++; + } + } + break; + case DICE_RIGHT: + for (dy = 0; dy < g_cube_size; dy++) { + i = base + (dy * video_width); + for (dx = 0; dx < g_cube_size; dx++) { + di = base + dy + (g_cube_size - dx - 1) * video_width; + dest[di] = src[i]; + i++; + } + } + break; + default: + g_assert_not_reached (); + break; } map_i++; } diff --git a/gst/effectv/gstedge.c b/gst/effectv/gstedge.c index 1e9002bf..6f07153a 100644 --- a/gst/effectv/gstedge.c +++ b/gst/effectv/gstedge.c @@ -102,8 +102,8 @@ gst_edgetv_get_type (void) }; edgetv_type = - g_type_register_static (GST_TYPE_VIDEOFILTER, "GstEdgeTV", &edgetv_info, - 0); + g_type_register_static (GST_TYPE_VIDEOFILTER, "GstEdgeTV", &edgetv_info, + 0); } return edgetv_type; } @@ -130,7 +130,7 @@ gst_edgetv_base_init (gpointer g_class) for (i = 0; i < G_N_ELEMENTS (gst_edgetv_formats); i++) { gst_videofilter_class_add_format (videofilter_class, - gst_edgetv_formats + i); + gst_edgetv_formats + i); } gst_videofilter_class_add_pad_templates (GST_VIDEOFILTER_CLASS (g_class)); @@ -214,15 +214,15 @@ gst_edgetv_rgb32 (GstVideofilter * videofilter, void *d, void *s) r *= r; g *= g; b *= b; - r = r >> 5; /* To lack the lower bit for saturated addition, */ - g = g >> 5; /* devide the value with 32, instead of 16. It is */ - b = b >> 4; /* same as `v2 &= 0xfefeff' */ + r = r >> 5; /* To lack the lower bit for saturated addition, */ + g = g >> 5; /* devide the value with 32, instead of 16. It is */ + b = b >> 4; /* same as `v2 &= 0xfefeff' */ if (r > 127) - r = 127; + r = 127; if (g > 127) - g = 127; + g = 127; if (b > 255) - b = 255; + b = 255; v2 = (r << 17) | (g << 9) | b; /* difference between the current pixel and upper neighbor. */ @@ -237,11 +237,11 @@ gst_edgetv_rgb32 (GstVideofilter * videofilter, void *d, void *s) g = g >> 5; b = b >> 4; if (r > 127) - r = 127; + r = 127; if (g > 127) - g = 127; + g = 127; if (b > 255) - b = 255; + b = 255; v3 = (r << 17) | (g << 9) | b; v0 = filter->map[(y - 1) * filter->map_width * 2 + x * 2]; diff --git a/gst/effectv/gsteffectv.c b/gst/effectv/gsteffectv.c index 71f51c55..c05e151c 100644 --- a/gst/effectv/gsteffectv.c +++ b/gst/effectv/gsteffectv.c @@ -73,7 +73,7 @@ plugin_init (GstPlugin * plugin) while (_elements[i].name) { if (!gst_element_register (plugin, _elements[i].name, - GST_RANK_NONE, (_elements[i].type) ())) + GST_RANK_NONE, (_elements[i].type) ())) return FALSE; i++; } diff --git a/gst/effectv/gstquark.c b/gst/effectv/gstquark.c index 42683212..fc73aa3d 100644 --- a/gst/effectv/gstquark.c +++ b/gst/effectv/gstquark.c @@ -128,8 +128,8 @@ gst_quarktv_get_type (void) }; quarktv_type = - g_type_register_static (GST_TYPE_ELEMENT, "GstQuarkTV", &quarktv_info, - 0); + g_type_register_static (GST_TYPE_ELEMENT, "GstQuarkTV", &quarktv_info, + 0); } return quarktv_type; } @@ -160,7 +160,7 @@ gst_quarktv_class_init (GstQuarkTVClass * klass) g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_PLANES, g_param_spec_int ("planes", "Planes", "Number of frames in the buffer", - 1, 32, PLANES, G_PARAM_READWRITE)); + 1, 32, PLANES, G_PARAM_READWRITE)); gobject_class->set_property = gst_quarktv_set_property; gobject_class->get_property = gst_quarktv_get_property; @@ -258,8 +258,8 @@ gst_quarktv_chain (GstPad * pad, GstData * _data) /* pick a random buffer */ rand = - filter->planetable[(filter->current_plane + - (fastrand () >> 24)) & (filter->planes - 1)]; + filter->planetable[(filter->current_plane + + (fastrand () >> 24)) & (filter->planes - 1)]; dest[area] = (rand ? ((guint32 *) GST_BUFFER_DATA (rand))[area] : 0); } @@ -283,9 +283,9 @@ gst_quarktv_change_state (GstElement * element) gint i; for (i = 0; i < filter->planes; i++) { - if (filter->planetable[i]) - gst_buffer_unref (filter->planetable[i]); - filter->planetable[i] = NULL; + if (filter->planetable[i]) + gst_buffer_unref (filter->planetable[i]); + filter->planetable[i] = NULL; } g_free (filter->planetable); filter->planetable = NULL; @@ -319,20 +319,20 @@ gst_quarktv_set_property (GObject * object, guint prop_id, const GValue * value, /* If the number of planes changed, copy across any existing planes */ if (new_n_planes != filter->planes) { - new_planetable = - (GstBuffer **) g_malloc (new_n_planes * sizeof (GstBuffer *)); - - for (i = 0; (i < new_n_planes) && (i < filter->planes); i++) { - new_planetable[i] = filter->planetable[i]; - } - for (; i < filter->planes; i++) { - if (filter->planetable[i]) - gst_buffer_unref (filter->planetable[i]); - } - g_free (filter->planetable); - filter->planetable = new_planetable; - filter->current_plane = filter->planes - 1; - filter->planes = new_n_planes; + new_planetable = + (GstBuffer **) g_malloc (new_n_planes * sizeof (GstBuffer *)); + + for (i = 0; (i < new_n_planes) && (i < filter->planes); i++) { + new_planetable[i] = filter->planetable[i]; + } + for (; i < filter->planes; i++) { + if (filter->planetable[i]) + gst_buffer_unref (filter->planetable[i]); + } + g_free (filter->planetable); + filter->planetable = new_planetable; + filter->current_plane = filter->planes - 1; + filter->planes = new_n_planes; } } break; diff --git a/gst/effectv/gstrev.c b/gst/effectv/gstrev.c index 32752107..fb953d34 100644 --- a/gst/effectv/gstrev.c +++ b/gst/effectv/gstrev.c @@ -129,8 +129,8 @@ gst_revtv_get_type (void) }; revtv_type = - g_type_register_static (GST_TYPE_VIDEOFILTER, "GstRevTV", &revtv_info, - 0); + g_type_register_static (GST_TYPE_VIDEOFILTER, "GstRevTV", &revtv_info, + 0); } return revtv_type; } @@ -173,13 +173,13 @@ gst_revtv_class_init (gpointer klass, gpointer class_data) g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_DELAY, g_param_spec_int ("delay", "Delay", "Delay in frames between updates", - 1, 100, 1, G_PARAM_READWRITE)); + 1, 100, 1, G_PARAM_READWRITE)); g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_LINESPACE, g_param_spec_int ("linespace", "Linespace", "Control line spacing", - 1, 100, 6, G_PARAM_READWRITE)); + 1, 100, 6, G_PARAM_READWRITE)); g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_GAIN, g_param_spec_int ("gain", "Gain", "Control gain", - 1, 200, 50, G_PARAM_READWRITE)); + 1, 200, 50, G_PARAM_READWRITE)); gobject_class->set_property = gst_revtv_set_property; gobject_class->get_property = gst_revtv_get_property; @@ -243,7 +243,7 @@ gst_revtv_rgb32 (GstVideofilter * videofilter, void *d, void *s) yval = y - ((short) (R + G + B) / filter->vscale); if (yval > 0) { - dest[x + (yval * width)] = THE_COLOR; + dest[x + (yval * width)] = THE_COLOR; } } } diff --git a/gst/effectv/gstshagadelic.c b/gst/effectv/gstshagadelic.c index 345f2762..14de2572 100644 --- a/gst/effectv/gstshagadelic.c +++ b/gst/effectv/gstshagadelic.c @@ -111,8 +111,8 @@ gst_shagadelictv_get_type (void) }; shagadelictv_type = - g_type_register_static (GST_TYPE_VIDEOFILTER, "GstShagadelicTV", - &shagadelictv_info, 0); + g_type_register_static (GST_TYPE_VIDEOFILTER, "GstShagadelicTV", + &shagadelictv_info, 0); } return shagadelictv_type; } @@ -140,7 +140,7 @@ gst_shagadelictv_base_init (gpointer g_class) for (i = 0; i < G_N_ELEMENTS (gst_shagadelictv_formats); i++) { gst_videofilter_class_add_format (videofilter_class, - gst_shagadelictv_formats + i); + gst_shagadelictv_formats + i); } gst_videofilter_class_add_pad_templates (GST_VIDEOFILTER_CLASS (g_class)); @@ -237,13 +237,13 @@ gst_shagadelic_initialize (GstShagadelicTV * filter) xx = x - filter->width / 2; #ifdef PS2 filter->spiral[i++] = ((unsigned int) - ((atan2f (xx, - yy) / ((float) M_PI) * 256 * 9) + (sqrtf (xx * xx + - yy * yy) * 5))) & 255; + ((atan2f (xx, + yy) / ((float) M_PI) * 256 * 9) + (sqrtf (xx * xx + + yy * yy) * 5))) & 255; #else filter->spiral[i++] = ((unsigned int) - ((atan2 (xx, yy) / M_PI * 256 * 9) + (sqrt (xx * xx + - yy * yy) * 5))) & 255; + ((atan2 (xx, yy) / M_PI * 256 * 9) + (sqrt (xx * xx + + yy * yy) * 5))) & 255; #endif /* Here is another Swinger! * ((atan2(xx, yy)/M_PI*256) + (sqrt(xx*xx+yy*yy)*10))&255; @@ -289,10 +289,10 @@ gst_shagadelictv_rgb32 (GstVideofilter * videofilter, void *d, void *s) * *dest++ = v & ((r<<16)|(g<<8)|b); */ r = (gchar) (filter->ripple[(filter->ry + y) * width * 2 + filter->rx + - x] + filter->phase * 2) >> 7; + x] + filter->phase * 2) >> 7; g = (gchar) (filter->spiral[y * width + x] + filter->phase * 3) >> 7; b = (gchar) (filter->ripple[(filter->by + y) * width * 2 + filter->bx + - x] - filter->phase) >> 7; + x] - filter->phase) >> 7; *dest++ = v & ((r << 16) | (g << 8) | b); } } diff --git a/gst/effectv/gstvertigo.c b/gst/effectv/gstvertigo.c index 6faa8cb2..eba0df88 100644 --- a/gst/effectv/gstvertigo.c +++ b/gst/effectv/gstvertigo.c @@ -116,8 +116,8 @@ gst_vertigotv_get_type (void) }; vertigotv_type = - g_type_register_static (GST_TYPE_VIDEOFILTER, "GstVertigoTV", - &vertigotv_info, 0); + g_type_register_static (GST_TYPE_VIDEOFILTER, "GstVertigoTV", + &vertigotv_info, 0); } return vertigotv_type; } @@ -143,7 +143,7 @@ gst_vertigotv_base_init (gpointer g_class) for (i = 0; i < G_N_ELEMENTS (gst_vertigotv_formats); i++) { gst_videofilter_class_add_format (videofilter_class, - gst_vertigotv_formats + i); + gst_vertigotv_formats + i); } gst_videofilter_class_add_pad_templates (GST_VIDEOFILTER_CLASS (g_class)); @@ -171,10 +171,10 @@ gst_vertigotv_class_init (GstVertigoTVClass * klass, gpointer class_data) g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_SPEED, g_param_spec_float ("speed", "Speed", "Control the speed of movement", - 0.01, 100.0, 0.02, G_PARAM_READWRITE)); + 0.01, 100.0, 0.02, G_PARAM_READWRITE)); g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_ZOOM_SPEED, g_param_spec_float ("zoom_speed", "Zoom Speed", - "Control the rate of zooming", 1.01, 1.1, 1.01, G_PARAM_READWRITE)); + "Control the rate of zooming", 1.01, 1.1, 1.01, G_PARAM_READWRITE)); gobject_class->set_property = gst_vertigotv_set_property; gobject_class->get_property = gst_vertigotv_get_property; @@ -246,22 +246,22 @@ gst_vertigotv_set_parms (GstVertigoTV * filter) if (filter->width > filter->height) { if (dizz >= 0) { if (dizz > x) - dizz = x; + dizz = x; vx = (x * (x - dizz) + y * y) / t; } else { if (dizz < -x) - dizz = -x; + dizz = -x; vx = (x * (x + dizz) + y * y) / t; } vy = (dizz * y) / t; } else { if (dizz >= 0) { if (dizz > y) - dizz = y; + dizz = y; vx = (x * x + y * (y - dizz)) / t; } else { if (dizz < -y) - dizz = -y; + dizz = -y; vx = (x * x + y * (y + dizz)) / t; } vy = (dizz * x) / t; @@ -307,9 +307,9 @@ gst_vertigotv_rgb32 (GstVideofilter * videofilter, void *d, void *s) for (x = width; x > 0; x--) { i = (oy >> 16) * width + (ox >> 16); if (i < 0) - i = 0; + i = 0; if (i >= area) - i = area; + i = area; v = filter->current_buffer[i] & 0xfcfcff; v = (v * 3) + ((*src++) & 0xfcfcff); diff --git a/gst/effectv/gstwarp.c b/gst/effectv/gstwarp.c index 4eb81a65..e056b893 100644 --- a/gst/effectv/gstwarp.c +++ b/gst/effectv/gstwarp.c @@ -125,8 +125,9 @@ gst_warptv_get_type (void) 0, gst_warptv_init, }; + warptv_type = g_type_register_static (GST_TYPE_VIDEOFILTER, - "GstWarpTV", &warptv_info, 0); + "GstWarpTV", &warptv_info, 0); } return warptv_type; } @@ -157,7 +158,7 @@ gst_warptv_base_init (gpointer g_class) for (i = 0; i < G_N_ELEMENTS (gst_warptv_formats); i++) { gst_videofilter_class_add_format (videofilter_class, - gst_warptv_formats + i); + gst_warptv_formats + i); } gst_videofilter_class_add_pad_templates (GST_VIDEOFILTER_CLASS (g_class)); @@ -175,7 +176,7 @@ gst_warptv_class_init (gpointer g_class, gpointer class_data) #if 0 g_object_class_install_property (gobject_class, ARG_METHOD, g_param_spec_enum ("method", "method", "method", - GST_TYPE_WARPTV_METHOD, GST_WARPTV_METHOD_1, G_PARAM_READWRITE)); + GST_TYPE_WARPTV_METHOD, GST_WARPTV_METHOD_1, G_PARAM_READWRITE)); #endif gobject_class->set_property = gst_warptv_set_property; @@ -351,7 +352,7 @@ gst_warptv_rgb32 (GstVideofilter * videofilter, void *d, void *s) sintable = warptv->sintable; ctable = warptv->ctable; - skip = 0; /* video_width*sizeof(RGB32)/4 - video_width;; */ + skip = 0; /* video_width*sizeof(RGB32)/4 - video_width;; */ c = 0; for (x = 0; x < 512; x++) { @@ -370,14 +371,14 @@ gst_warptv_rgb32 (GstVideofilter * videofilter, void *d, void *s) dy = ctable[i] + y; if (dx < 0) - dx = 0; + dx = 0; else if (dx > maxx) - dx = maxx; + dx = maxx; if (dy < 0) - dy = 0; + dy = 0; else if (dy > maxy) - dy = maxy; + dy = maxy; *dest++ = src[warptv->offstable[dy] + dx]; } dest += skip; diff --git a/gst/flx/gstflxdec.c b/gst/flx/gstflxdec.c index a84ce2d2..b2694962 100644 --- a/gst/flx/gstflxdec.c +++ b/gst/flx/gstflxdec.c @@ -103,8 +103,9 @@ gst_flxdec_get_type (void) 0, (GInstanceInitFunc) gst_flxdec_init, }; + flxdec_type = - g_type_register_static (GST_TYPE_ELEMENT, "GstFlxDec", &flxdec_info, 0); + g_type_register_static (GST_TYPE_ELEMENT, "GstFlxDec", &flxdec_info, 0); } return flxdec_type; } @@ -172,44 +173,44 @@ flx_decode_chunks (GstFlxDec * flxdec, gulong count, gchar * data, gchar * dest) switch (hdr->id) { case FLX_COLOR64: - flx_decode_color (flxdec, data, dest, 2); - data += rndalign (hdr->size) - FlxFrameChunkSize; - break; + flx_decode_color (flxdec, data, dest, 2); + data += rndalign (hdr->size) - FlxFrameChunkSize; + break; case FLX_COLOR256: - flx_decode_color (flxdec, data, dest, 0); - data += rndalign (hdr->size) - FlxFrameChunkSize; - break; + flx_decode_color (flxdec, data, dest, 0); + data += rndalign (hdr->size) - FlxFrameChunkSize; + break; case FLX_BRUN: - flx_decode_brun (flxdec, data, dest); - data += rndalign (hdr->size) - FlxFrameChunkSize; - break; + flx_decode_brun (flxdec, data, dest); + data += rndalign (hdr->size) - FlxFrameChunkSize; + break; case FLX_LC: - flx_decode_delta_fli (flxdec, data, dest); - data += rndalign (hdr->size) - FlxFrameChunkSize; - break; + flx_decode_delta_fli (flxdec, data, dest); + data += rndalign (hdr->size) - FlxFrameChunkSize; + break; case FLX_SS2: - flx_decode_delta_flc (flxdec, data, dest); - data += rndalign (hdr->size) - FlxFrameChunkSize; - break; + flx_decode_delta_flc (flxdec, data, dest); + data += rndalign (hdr->size) - FlxFrameChunkSize; + break; case FLX_BLACK: - memset (dest, 0, flxdec->size); - break; + memset (dest, 0, flxdec->size); + break; case FLX_MINI: - data += rndalign (hdr->size) - FlxFrameChunkSize; - break; + data += rndalign (hdr->size) - FlxFrameChunkSize; + break; default: - g_print ("GstFlxDec: Unimplented chunk type: 0x%02x size: %d\n", - hdr->id, hdr->size); - g_print ("GstFlxDec: Skipping...\n"); - data += rndalign (hdr->size) - FlxFrameChunkSize; - break; + g_print ("GstFlxDec: Unimplented chunk type: 0x%02x size: %d\n", + hdr->id, hdr->size); + g_print ("GstFlxDec: Skipping...\n"); + data += rndalign (hdr->size) - FlxFrameChunkSize; + break; } } } @@ -266,20 +267,20 @@ flx_decode_brun (GstFlxDec * flxdec, guchar * data, guchar * dest) count = *data++; if (count > 0x7f) { - /* literal run */ - count = 0x100 - count; - row -= count; + /* literal run */ + count = 0x100 - count; + row -= count; - while (count--) - *dest++ = *data++; + while (count--) + *dest++ = *data++; } else { - /* replicate run */ - row -= count; - x = *data++; + /* replicate run */ + row -= count; + x = *data++; - while (count--) - *dest++ = x; + while (count--) + *dest++ = x; } } } @@ -320,17 +321,17 @@ flx_decode_delta_fli (GstFlxDec * flxdec, guchar * data, guchar * dest) count = *data++; if (count > 0x7f) { - /* literal run */ - count = 0x100 - count; - x = *data++; + /* literal run */ + count = 0x100 - count; + x = *data++; - while (count--) - *dest++ = x; + while (count--) + *dest++ = x; } else { - /* replicate run */ - while (count--) - *dest++ = *data++; + /* replicate run */ + while (count--) + *dest++ = *data++; } } start_p += flxdec->hdr.width; @@ -365,13 +366,13 @@ flx_decode_delta_flc (GstFlxDec * flxdec, guchar * data, guchar * dest) while ((opcode = (data[0] + (data[1] << 8))) & 0xc000) { data += 2; if ((opcode & 0xc000) == 0xc000) { - /* skip count */ - start_l += (0x10000 - opcode); - dest += flxdec->hdr.width * (0x10000 - opcode); + /* skip count */ + start_l += (0x10000 - opcode); + dest += flxdec->hdr.width * (0x10000 - opcode); } else { - /* last pixel */ - dest += flxdec->hdr.width; - *dest++ = (opcode & 0xff); + /* last pixel */ + dest += flxdec->hdr.width; + *dest++ = (opcode & 0xff); } } data += 2; @@ -385,19 +386,19 @@ flx_decode_delta_flc (GstFlxDec * flxdec, guchar * data, guchar * dest) count = *data++; if (count > 0x7f) { - /* replicate word run */ - count = 0x100 - count; - while (count--) { - *dest++ = data[0]; - *dest++ = data[1]; - } - data += 2; + /* replicate word run */ + count = 0x100 - count; + while (count--) { + *dest++ = data[0]; + *dest++ = data[1]; + } + data += 2; } else { - /* literal word run */ - while (count--) { - *dest++ = *data++; - *dest++ = *data++; - } + /* literal word run */ + while (count--) { + *dest++ = *data++; + *dest++ = *data++; + } } } lines--; @@ -462,9 +463,9 @@ gst_flxdec_loop (GstElement * element) /* check header */ if (flxh->type != FLX_MAGICHDR_FLI && - flxh->type != FLX_MAGICHDR_FLC && flxh->type != FLX_MAGICHDR_FLX) { + flxh->type != FLX_MAGICHDR_FLC && flxh->type != FLX_MAGICHDR_FLX) { GST_ELEMENT_ERROR (element, STREAM, WRONG_TYPE, (NULL), - ("not a flx file (type %d)\n", flxh->type)); + ("not a flx file (type %d)\n", flxh->type)); return; } @@ -486,13 +487,13 @@ gst_flxdec_loop (GstElement * element) caps = gst_caps_from_string (GST_VIDEO_CAPS_xRGB_HOST_ENDIAN); gst_caps_set_simple (caps, - "width", G_TYPE_INT, flxh->width, - "height", G_TYPE_INT, flxh->height, - "framerate", G_TYPE_DOUBLE, GST_SECOND / flxdec->frame_time, NULL); + "width", G_TYPE_INT, flxh->width, + "height", G_TYPE_INT, flxh->height, + "framerate", G_TYPE_DOUBLE, GST_SECOND / flxdec->frame_time, NULL); if (flxh->depth <= 8) flxdec->converter = - flx_colorspace_converter_new (flxh->width, flxh->height); + flx_colorspace_converter_new (flxh->width, flxh->height); if (flxh->type == FLX_MAGICHDR_FLC || flxh->type == FLX_MAGICHDR_FLX) { g_print ("GstFlxDec: (FLC) aspect_dx : %d\n", flxh->aspect_dx); @@ -523,41 +524,41 @@ gst_flxdec_loop (GstElement * element) switch (flxfh->id) { case FLX_FRAME_TYPE: - buf = flx_get_data (flxdec, flxfh->size - FlxFrameChunkSize); + buf = flx_get_data (flxdec, flxfh->size - FlxFrameChunkSize); - chunk = GST_BUFFER_DATA (buf); + chunk = GST_BUFFER_DATA (buf); - if (((FlxFrameType *) chunk)->chunks == 0) - break; + if (((FlxFrameType *) chunk)->chunks == 0) + break; - /* create 32 bits output frame */ - out = gst_buffer_new (); - GST_BUFFER_DATA (out) = g_malloc (flxdec->size * 4); - GST_BUFFER_SIZE (out) = flxdec->size * 4; + /* create 32 bits output frame */ + out = gst_buffer_new (); + GST_BUFFER_DATA (out) = g_malloc (flxdec->size * 4); + GST_BUFFER_SIZE (out) = flxdec->size * 4; - /* decode chunks */ - flx_decode_chunks (flxdec, - ((FlxFrameType *) chunk)->chunks, - GST_BUFFER_DATA (buf) + FlxFrameTypeSize, - GST_BUFFER_DATA (flxdec->frame)); + /* decode chunks */ + flx_decode_chunks (flxdec, + ((FlxFrameType *) chunk)->chunks, + GST_BUFFER_DATA (buf) + FlxFrameTypeSize, + GST_BUFFER_DATA (flxdec->frame)); - /* destroy input buffer */ - gst_buffer_unref (buf); + /* destroy input buffer */ + gst_buffer_unref (buf); - /* save copy of the current frame for possible delta. */ - memcpy (GST_BUFFER_DATA (flxdec->delta), - GST_BUFFER_DATA (flxdec->frame), GST_BUFFER_SIZE (flxdec->delta)); + /* save copy of the current frame for possible delta. */ + memcpy (GST_BUFFER_DATA (flxdec->delta), + GST_BUFFER_DATA (flxdec->frame), GST_BUFFER_SIZE (flxdec->delta)); - /* convert current frame. */ - flx_colorspace_convert (flxdec->converter, - GST_BUFFER_DATA (flxdec->frame), GST_BUFFER_DATA (out)); + /* convert current frame. */ + flx_colorspace_convert (flxdec->converter, + GST_BUFFER_DATA (flxdec->frame), GST_BUFFER_DATA (out)); - GST_BUFFER_TIMESTAMP (out) = flxdec->next_time; - flxdec->next_time += flxdec->frame_time; + GST_BUFFER_TIMESTAMP (out) = flxdec->next_time; + flxdec->next_time += flxdec->frame_time; - gst_pad_push (flxdec->srcpad, GST_DATA (out)); + gst_pad_push (flxdec->srcpad, GST_DATA (out)); - break; + break; } /* destroy header buffer */ diff --git a/gst/goom/filters.c b/gst/goom/filters.c index 14bd7ec6..9fadf2f6 100644 --- a/gst/goom/filters.c +++ b/gst/goom/filters.c @@ -55,8 +55,8 @@ unsigned int ppcsize4; #endif /* PowerPC */ unsigned int *coeffs = 0, *freecoeffs = 0; -guint32 *expix1 = 0; /* pointeur exporte vers p1 */ -guint32 *expix2 = 0; /* pointeur exporte vers p2 */ +guint32 *expix1 = 0; /* pointeur exporte vers p1 */ +guint32 *expix2 = 0; /* pointeur exporte vers p2 */ guint32 zoom_width; #endif /* ASM */ @@ -141,33 +141,33 @@ calculatePXandPY (int x, int y, int *px, int *py) switch (theMode) { case WAVE_MODE: - dist = - ShiftRight (vx, 9) * ShiftRight (vx, 9) + ShiftRight (vy, - 9) * ShiftRight (vy, 9); - fvitesse *= - 1024 + - ShiftRight (sintable[(unsigned short) (0xffff * dist * - EFFECT_DISTORS)], 6); - fvitesse /= 1024; - break; + dist = + ShiftRight (vx, 9) * ShiftRight (vx, 9) + ShiftRight (vy, + 9) * ShiftRight (vy, 9); + fvitesse *= + 1024 + + ShiftRight (sintable[(unsigned short) (0xffff * dist * + EFFECT_DISTORS)], 6); + fvitesse /= 1024; + break; case CRYSTAL_BALL_MODE: - dist = - ShiftRight (vx, 9) * ShiftRight (vx, 9) + ShiftRight (vy, - 9) * ShiftRight (vy, 9); - fvitesse += (dist * EFFECT_DISTORS >> 10); - break; + dist = + ShiftRight (vx, 9) * ShiftRight (vx, 9) + ShiftRight (vy, + 9) * ShiftRight (vy, 9); + fvitesse += (dist * EFFECT_DISTORS >> 10); + break; case AMULETTE_MODE: - dist = - ShiftRight (vx, 9) * ShiftRight (vx, 9) + ShiftRight (vy, - 9) * ShiftRight (vy, 9); - fvitesse -= (dist * EFFECT_DISTORS >> 4); - break; + dist = + ShiftRight (vx, 9) * ShiftRight (vx, 9) + ShiftRight (vy, + 9) * ShiftRight (vy, 9); + fvitesse -= (dist * EFFECT_DISTORS >> 4); + break; case SCRUNCH_MODE: - dist = - ShiftRight (vx, 9) * ShiftRight (vx, 9) + ShiftRight (vy, - 9) * ShiftRight (vy, 9); - fvitesse -= (dist * EFFECT_DISTORS >> 9); - break; + dist = + ShiftRight (vx, 9) * ShiftRight (vx, 9) + ShiftRight (vy, + 9) * ShiftRight (vy, 9); + fvitesse -= (dist * EFFECT_DISTORS >> 9); + break; } if (vx < 0) *px = (middleX << 4) - (-(vx * fvitesse) >> 16); @@ -285,7 +285,7 @@ zoomFilterFastRGB (Uint * pix1, { static guint32 prevX = 0, prevY = 0; - static char reverse = 0; /*vitesse inversé..(zoom out) */ + static char reverse = 0; /*vitesse inversé..(zoom out) */ /* static int perte = 100; // 100 = normal */ static unsigned char pertedec = 8; @@ -361,7 +361,7 @@ zoomFilterFastRGB (Uint * pix1, firstTime = 0; #ifdef USE_ASM freecoeffs = (unsigned int *) - malloc (resx * resy * 2 * sizeof (unsigned int) + 128); + malloc (resx * resy * 2 * sizeof (unsigned int) + 128); coeffs = (guint32 *) ((1 + ((unsigned int) (freecoeffs)) / 128) * 128); #else @@ -372,49 +372,49 @@ zoomFilterFastRGB (Uint * pix1, c4 = (unsigned int *) malloc (resx * resy * sizeof (unsigned int)); #endif for (us = 0; us < 0xffff; us++) { - sintable[us] = (int) (1024.0f * sin (us * 2 * 3.31415f / 0xffff)); + sintable[us] = (int) (1024.0f * sin (us * 2 * 3.31415f / 0xffff)); } { - int loopv; - firedec = (int *) malloc (prevY * sizeof (int)); - for (loopv = prevY; loopv != 0;) { - static int decc = 0; - static int spdc = 0; - static int accel = 0; - - loopv--; - firedec[loopv] = decc; - decc += spdc / 10; - spdc += RAND () % 3; - spdc -= RAND () % 3; - - if (decc > 4) - spdc -= 1; - if (decc < -4) - spdc += 1; - - if (spdc > 30) - spdc = spdc - RAND () % 3 + accel / 10; - if (spdc < -30) - spdc = spdc + RAND () % 3 + accel / 10; - - if (decc > 8 && spdc > 1) - spdc -= RAND () % 3 - 2; - - if (decc < -8 && spdc < -1) - spdc += RAND () % 3 + 2; - - if (decc > 8 || decc < -8) - decc = decc * 8 / 9; - - accel += RAND () % 2; - accel -= RAND () % 2; - if (accel > 20) - accel -= 2; - if (accel < -20) - accel += 2; - } + int loopv; + firedec = (int *) malloc (prevY * sizeof (int)); + for (loopv = prevY; loopv != 0;) { + static int decc = 0; + static int spdc = 0; + static int accel = 0; + + loopv--; + firedec[loopv] = decc; + decc += spdc / 10; + spdc += RAND () % 3; + spdc -= RAND () % 3; + + if (decc > 4) + spdc -= 1; + if (decc < -4) + spdc += 1; + + if (spdc > 30) + spdc = spdc - RAND () % 3 + accel / 10; + if (spdc < -30) + spdc = spdc + RAND () % 3 + accel / 10; + + if (decc > 8 && spdc > 1) + spdc -= RAND () % 3 - 2; + + if (decc < -8 && spdc < -1) + spdc += RAND () % 3 + 2; + + if (decc > 8 || decc < -8) + decc = decc * 8 / 9; + + accel += RAND () % 2; + accel -= RAND () % 2; + if (accel > 20) + accel -= 2; + if (accel < -20) + accel += 2; + } } } @@ -422,67 +422,67 @@ zoomFilterFastRGB (Uint * pix1, /* generation du buffer */ for (y = 0; y < prevY; y++) for (x = 0; x < prevX; x++) { - int px, py; - unsigned char coefv, coefh; - - /* calculer px et py en fonction de */ - /* x,y,middleX,middleY et theMode */ - calculatePXandPY (x, y, &px, &py); - if ((px == x << 4) && (py == y << 4)) - py += 8; - - if ((py < 0) || (px < 0) || - (py >= (prevY - 1) * sqrtperte) || - (px >= (prevX - 1) * sqrtperte)) { + int px, py; + unsigned char coefv, coefh; + + /* calculer px et py en fonction de */ + /* x,y,middleX,middleY et theMode */ + calculatePXandPY (x, y, &px, &py); + if ((px == x << 4) && (py == y << 4)) + py += 8; + + if ((py < 0) || (px < 0) || + (py >= (prevY - 1) * sqrtperte) || + (px >= (prevX - 1) * sqrtperte)) { #ifdef USE_ASM - coeffs[(y * prevX + x) * 2] = 0; - coeffs[(y * prevX + x) * 2 + 1] = 0; + coeffs[(y * prevX + x) * 2] = 0; + coeffs[(y * prevX + x) * 2 + 1] = 0; #else - pos10[y * prevX + x] = 0; - c1[y * prevX + x] = 0; - c2[y * prevX + x] = 0; - c3[y * prevX + x] = 0; - c4[y * prevX + x] = 0; + pos10[y * prevX + x] = 0; + c1[y * prevX + x] = 0; + c2[y * prevX + x] = 0; + c3[y * prevX + x] = 0; + c4[y * prevX + x] = 0; #endif - } else { - int npx10; - int npy10; - int pos; + } else { + int npx10; + int npy10; + int pos; - npx10 = (px / sqrtperte); - npy10 = (py / sqrtperte); + npx10 = (px / sqrtperte); + npy10 = (py / sqrtperte); /* if (npx10 >= prevX) fprintf(stderr,"error npx:%d",npx10); if (npy10 >= prevY) fprintf(stderr,"error npy:%d",npy10); */ - coefh = px % sqrtperte; - coefv = py % sqrtperte; + coefh = px % sqrtperte; + coefv = py % sqrtperte; #ifdef USE_ASM - pos = (y * prevX + x) * 2; - coeffs[pos] = (npx10 + prevX * npy10) * 4; + pos = (y * prevX + x) * 2; + coeffs[pos] = (npx10 + prevX * npy10) * 4; - if (!(coefh || coefv)) - coeffs[pos + 1] = (sqrtperte * sqrtperte - 1); - else - coeffs[pos + 1] = ((sqrtperte - coefh) * (sqrtperte - coefv)); + if (!(coefh || coefv)) + coeffs[pos + 1] = (sqrtperte * sqrtperte - 1); + else + coeffs[pos + 1] = ((sqrtperte - coefh) * (sqrtperte - coefv)); - coeffs[pos + 1] |= (coefh * (sqrtperte - coefv)) << 8; - coeffs[pos + 1] |= ((sqrtperte - coefh) * coefv) << 16; - coeffs[pos + 1] |= (coefh * coefv) << 24; + coeffs[pos + 1] |= (coefh * (sqrtperte - coefv)) << 8; + coeffs[pos + 1] |= ((sqrtperte - coefh) * coefv) << 16; + coeffs[pos + 1] |= (coefh * coefv) << 24; #else - pos = y * prevX + x; - pos10[pos] = npx10 + prevX * npy10; + pos = y * prevX + x; + pos10[pos] = npx10 + prevX * npy10; - if (!(coefh || coefv)) - c1[pos] = sqrtperte * sqrtperte - 1; - else - c1[pos] = (sqrtperte - coefh) * (sqrtperte - coefv); + if (!(coefh || coefv)) + c1[pos] = sqrtperte * sqrtperte - 1; + else + c1[pos] = (sqrtperte - coefh) * (sqrtperte - coefv); - c2[pos] = coefh * (sqrtperte - coefv); - c3[pos] = (sqrtperte - coefh) * coefv; - c4[pos] = coefh * coefv; + c2[pos] = coefh * (sqrtperte - coefv); + c3[pos] = (sqrtperte - coefh) * coefv; + c4[pos] = coefh * coefv; #endif - } + } } } #ifdef USE_ASM @@ -511,21 +511,21 @@ zoomFilterFastRGB (Uint * pix1, getPixelRGB_ (pix1, pos10[position] + prevX + 1, &col4); couleur.r = col1.r * c1[position] - + col2.r * c2[position] - + col3.r * c3[position] - + col4.r * c4[position]; + + col2.r * c2[position] + + col3.r * c3[position] + + col4.r * c4[position]; couleur.r >>= pertedec; couleur.v = col1.v * c1[position] - + col2.v * c2[position] - + col3.v * c3[position] - + col4.v * c4[position]; + + col2.v * c2[position] + + col3.v * c3[position] + + col4.v * c4[position]; couleur.v >>= pertedec; couleur.b = col1.b * c1[position] - + col2.b * c2[position] - + col3.b * c3[position] - + col4.b * c4[position]; + + col2.b * c2[position] + + col3.b * c3[position] + + col4.b * c4[position]; couleur.b >>= pertedec; setPixelRGB_ (pix2, position, couleur); diff --git a/gst/goom/goom_core.c b/gst/goom/goom_core.c index 5c4a75a3..644ff0a6 100644 --- a/gst/goom/goom_core.c +++ b/gst/goom/goom_core.c @@ -67,21 +67,21 @@ goom_set_resolution (guint32 resx, guint32 resy) guint32 * goom_update (gint16 data[2][512]) { - static int lockvar = 0; /* pour empecher de nouveaux changements */ - static int goomvar = 0; /* boucle des gooms */ - static int totalgoom = 0; /* nombre de gooms par seconds */ - static int agoom = 0; /* un goom a eu lieu.. */ - static int loopvar = 0; /* mouvement des points */ - static int speedvar = 0; /* vitesse des particules */ - static int lineMode = 0; /* l'effet lineaire a dessiner */ + static int lockvar = 0; /* pour empecher de nouveaux changements */ + static int goomvar = 0; /* boucle des gooms */ + static int totalgoom = 0; /* nombre de gooms par seconds */ + static int agoom = 0; /* un goom a eu lieu.. */ + static int loopvar = 0; /* mouvement des points */ + static int speedvar = 0; /* vitesse des particules */ + static int lineMode = 0; /* l'effet lineaire a dessiner */ guint32 *return_val; guint32 pointWidth; guint32 pointHeight; - int incvar; /* volume du son */ - int accelvar; /* acceleration des particules */ + int incvar; /* volume du son */ + int accelvar; /* acceleration des particules */ int i; - float largfactor; /* elargissement de l'intervalle d'évolution des points */ - static char goomlimit = 2; /* sensibilité du goom */ + float largfactor; /* elargissement de l'intervalle d'évolution des points */ + static char goomlimit = 2; /* sensibilité du goom */ static ZoomFilterData zfd = { 128, 8, 16, 1, 1, 0, WAVE_MODE, @@ -128,26 +128,26 @@ goom_update (gint16 data[2][512]) loopvar += speedvar + 1; pointFilter (p1, - YELLOW, - ((pointWidth - 6.0f) * largfactor + 5.0f), - ((pointHeight - 6.0f) * largfactor + 5.0f), - i * 152.0f, 128.0f, loopvar + i * 2032); + YELLOW, + ((pointWidth - 6.0f) * largfactor + 5.0f), + ((pointHeight - 6.0f) * largfactor + 5.0f), + i * 152.0f, 128.0f, loopvar + i * 2032); pointFilter (p1, ORANGE, - ((pointWidth / 2) * largfactor) / i + 10.0f * i, - ((pointHeight / 2) * largfactor) / i + 10.0f * i, - 96.0f, i * 80.0f, loopvar / i); + ((pointWidth / 2) * largfactor) / i + 10.0f * i, + ((pointHeight / 2) * largfactor) / i + 10.0f * i, + 96.0f, i * 80.0f, loopvar / i); pointFilter (p1, VIOLET, - ((pointHeight / 3 + 5.0f) * largfactor) / i + 10.0f * i, - ((pointHeight / 3 + 5.0f) * largfactor) / i + 10.0f * i, - i + 122.0f, 134.0f, loopvar / i); + ((pointHeight / 3 + 5.0f) * largfactor) / i + 10.0f * i, + ((pointHeight / 3 + 5.0f) * largfactor) / i + 10.0f * i, + i + 122.0f, 134.0f, loopvar / i); pointFilter (p1, BLACK, - ((pointHeight / 3) * largfactor + 20.0f), - ((pointHeight / 3) * largfactor + 20.0f), - 58.0f, i * 66.0f, loopvar / i); + ((pointHeight / 3) * largfactor + 20.0f), + ((pointHeight / 3) * largfactor + 20.0f), + 58.0f, i * 66.0f, loopvar / i); pointFilter (p1, WHITE, - (pointHeight * largfactor + 10.0f * i) / i, - (pointHeight * largfactor + 10.0f * i) / i, - 66.0f, 74.0f, loopvar + i * 500); + (pointHeight * largfactor + 10.0f * i) / i, + (pointHeight * largfactor + 10.0f * i) / i, + 66.0f, 74.0f, loopvar + i * 500); } /* par défaut pas de changement de zoom */ @@ -167,33 +167,33 @@ goom_update (gint16 data[2][512]) if ((accelvar > goomlimit) || (accelvar < -goomlimit)) { /* UN GOOM !!! YAHOO ! */ totalgoom++; - agoom = 20; /* mais pdt 20 cycles, il n'y en aura plus. */ - lineMode = (lineMode + 1) % 20; /* Tous les 10 gooms on change de mode lineaire */ + agoom = 20; /* mais pdt 20 cycles, il n'y en aura plus. */ + lineMode = (lineMode + 1) % 20; /* Tous les 10 gooms on change de mode lineaire */ /* changement eventuel de mode */ switch (iRAND (10)) { case 0: case 1: case 2: - zfd.mode = WAVE_MODE; - zfd.vitesse = STOP_SPEED - 1; - zfd.reverse = 0; - break; + zfd.mode = WAVE_MODE; + zfd.vitesse = STOP_SPEED - 1; + zfd.reverse = 0; + break; case 3: case 4: - zfd.mode = CRYSTAL_BALL_MODE; - break; + zfd.mode = CRYSTAL_BALL_MODE; + break; case 5: - zfd.mode = AMULETTE_MODE; - break; + zfd.mode = AMULETTE_MODE; + break; case 6: - zfd.mode = WATER_MODE; - break; + zfd.mode = WATER_MODE; + break; case 7: - zfd.mode = SCRUNCH_MODE; - break; + zfd.mode = SCRUNCH_MODE; + break; default: - zfd.mode = NORMAL_MODE; + zfd.mode = NORMAL_MODE; } } @@ -205,113 +205,113 @@ goom_update (gint16 data[2][512]) goomvar++; /*if (goomvar % 1 == 0) */ { - guint32 vtmp; - guint32 newvit; - - newvit = STOP_SPEED - speedvar / 2; - /* retablir le zoom avant.. */ - if ((zfd.reverse) && (!(cycle % 12)) && (rand () % 3 == 0)) { - zfd.reverse = 0; - zfd.vitesse = STOP_SPEED - 2; - lockvar = 50; - } - if (iRAND (10) == 0) { - zfd.reverse = 1; - lockvar = 100; - } - - /* changement de milieu.. */ - switch (iRAND (20)) { - case 0: - zfd.middleY = resoly - 1; - zfd.middleX = resolx / 2; - break; - case 1: - zfd.middleX = resolx - 1; - break; - case 2: - zfd.middleX = 1; - break; - default: - zfd.middleY = resoly / 2; - zfd.middleX = resolx / 2; - } - - if (zfd.mode == WATER_MODE) { - zfd.middleX = resolx / 2; - zfd.middleY = resoly / 2; - } - - switch (vtmp = (iRAND (27))) { - case 0: - zfd.vPlaneEffect = iRAND (3); - zfd.vPlaneEffect -= iRAND (3); - zfd.hPlaneEffect = iRAND (3); - zfd.hPlaneEffect -= iRAND (3); - break; - case 3: - zfd.vPlaneEffect = 0; - zfd.hPlaneEffect = iRAND (8); - zfd.hPlaneEffect -= iRAND (8); - break; - case 4: - case 5: - case 6: - case 7: - zfd.vPlaneEffect = iRAND (5); - zfd.vPlaneEffect -= iRAND (5); - zfd.hPlaneEffect = -zfd.vPlaneEffect; - break; - case 8: - zfd.hPlaneEffect = 5 + iRAND (8); - zfd.vPlaneEffect = -zfd.hPlaneEffect; - break; - case 9: - zfd.vPlaneEffect = 5 + iRAND (8); - zfd.hPlaneEffect = -zfd.hPlaneEffect; - break; - case 13: - zfd.hPlaneEffect = 0; - zfd.vPlaneEffect = iRAND (10); - zfd.vPlaneEffect -= iRAND (10); - break; - default: - if (vtmp < 10) { - zfd.vPlaneEffect = 0; - zfd.hPlaneEffect = 0; - } - } - - if (iRAND (3) != 0) - zfd.noisify = 0; - else { - zfd.noisify = iRAND (3) + 2; - lockvar *= 3; - } - - if (zfd.mode == AMULETTE_MODE) { - zfd.vPlaneEffect = 0; - zfd.hPlaneEffect = 0; - zfd.noisify = 0; - } - - if ((zfd.middleX == 1) || (zfd.middleX == resolx - 1)) { - zfd.vPlaneEffect = 0; - zfd.hPlaneEffect = iRAND (2) ? 0 : zfd.hPlaneEffect; - } - - if (newvit < zfd.vitesse) { /* on accelere */ - pzfd = &zfd; - if (((newvit < STOP_SPEED - 7) && - (zfd.vitesse < STOP_SPEED - 6) && - (cycle % 3 == 0)) || (iRAND (40) == 0)) { - zfd.vitesse = STOP_SPEED - 1; - zfd.reverse = !zfd.reverse; - } else { - zfd.vitesse = (newvit + zfd.vitesse * 4) / 5; - } - lockvar += 50; - } + guint32 vtmp; + guint32 newvit; + + newvit = STOP_SPEED - speedvar / 2; + /* retablir le zoom avant.. */ + if ((zfd.reverse) && (!(cycle % 12)) && (rand () % 3 == 0)) { + zfd.reverse = 0; + zfd.vitesse = STOP_SPEED - 2; + lockvar = 50; + } + if (iRAND (10) == 0) { + zfd.reverse = 1; + lockvar = 100; + } + + /* changement de milieu.. */ + switch (iRAND (20)) { + case 0: + zfd.middleY = resoly - 1; + zfd.middleX = resolx / 2; + break; + case 1: + zfd.middleX = resolx - 1; + break; + case 2: + zfd.middleX = 1; + break; + default: + zfd.middleY = resoly / 2; + zfd.middleX = resolx / 2; + } + + if (zfd.mode == WATER_MODE) { + zfd.middleX = resolx / 2; + zfd.middleY = resoly / 2; + } + + switch (vtmp = (iRAND (27))) { + case 0: + zfd.vPlaneEffect = iRAND (3); + zfd.vPlaneEffect -= iRAND (3); + zfd.hPlaneEffect = iRAND (3); + zfd.hPlaneEffect -= iRAND (3); + break; + case 3: + zfd.vPlaneEffect = 0; + zfd.hPlaneEffect = iRAND (8); + zfd.hPlaneEffect -= iRAND (8); + break; + case 4: + case 5: + case 6: + case 7: + zfd.vPlaneEffect = iRAND (5); + zfd.vPlaneEffect -= iRAND (5); + zfd.hPlaneEffect = -zfd.vPlaneEffect; + break; + case 8: + zfd.hPlaneEffect = 5 + iRAND (8); + zfd.vPlaneEffect = -zfd.hPlaneEffect; + break; + case 9: + zfd.vPlaneEffect = 5 + iRAND (8); + zfd.hPlaneEffect = -zfd.hPlaneEffect; + break; + case 13: + zfd.hPlaneEffect = 0; + zfd.vPlaneEffect = iRAND (10); + zfd.vPlaneEffect -= iRAND (10); + break; + default: + if (vtmp < 10) { + zfd.vPlaneEffect = 0; + zfd.hPlaneEffect = 0; + } + } + + if (iRAND (3) != 0) + zfd.noisify = 0; + else { + zfd.noisify = iRAND (3) + 2; + lockvar *= 3; + } + + if (zfd.mode == AMULETTE_MODE) { + zfd.vPlaneEffect = 0; + zfd.hPlaneEffect = 0; + zfd.noisify = 0; + } + + if ((zfd.middleX == 1) || (zfd.middleX == resolx - 1)) { + zfd.vPlaneEffect = 0; + zfd.hPlaneEffect = iRAND (2) ? 0 : zfd.hPlaneEffect; + } + + if (newvit < zfd.vitesse) { /* on accelere */ + pzfd = &zfd; + if (((newvit < STOP_SPEED - 7) && + (zfd.vitesse < STOP_SPEED - 6) && + (cycle % 3 == 0)) || (iRAND (40) == 0)) { + zfd.vitesse = STOP_SPEED - 1; + zfd.reverse = !zfd.reverse; + } else { + zfd.vitesse = (newvit + zfd.vitesse * 4) / 5; + } + lockvar += 50; + } } } /* mode mega-lent */ @@ -370,9 +370,9 @@ goom_update (gint16 data[2][512]) /* si on est dans un goom : afficher les lignes... */ if (agoom > 15) goom_lines - (data, ((zfd.middleX == resolx / 2) && (zfd.middleY == resoly / 2) - && (zfd.mode != WATER_MODE)) - ? (lineMode / 10) : 0, p2, agoom - 15); + (data, ((zfd.middleX == resolx / 2) && (zfd.middleY == resoly / 2) + && (zfd.mode != WATER_MODE)) + ? (lineMode / 10) : 0, p2, agoom - 15); return_val = p2; tmp = p1; @@ -390,7 +390,7 @@ goom_update (gint16 data[2][512]) goomlimit++; } else { if ((totalgoom == 0) && (goomlimit > 1)) - goomlimit--; + goomlimit--; } totalgoom = 0; } diff --git a/gst/goom/gstgoom.c b/gst/goom/gstgoom.c index b5ad63a5..a4716c99 100644 --- a/gst/goom/gstgoom.c +++ b/gst/goom/gstgoom.c @@ -88,15 +88,15 @@ static GstStaticPadTemplate src_template = GST_STATIC_PAD_TEMPLATE ("src", GST_STATIC_CAPS (GST_VIDEO_CAPS_xRGB_HOST_ENDIAN) ); -static GstStaticPadTemplate sink_template = GST_STATIC_PAD_TEMPLATE ("sink", /* the name of the pads */ - GST_PAD_SINK, /* type of the pad */ - GST_PAD_ALWAYS, /* ALWAYS/SOMETIMES */ +static GstStaticPadTemplate sink_template = GST_STATIC_PAD_TEMPLATE ("sink", /* the name of the pads */ + GST_PAD_SINK, /* type of the pad */ + GST_PAD_ALWAYS, /* ALWAYS/SOMETIMES */ 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, 2 ]") + "endianness = (int) BYTE_ORDER, " + "signed = (boolean) TRUE, " + "width = (int) 16, " + "depth = (int) 16, " + "rate = (int) [ 8000, 96000 ], " "channels = (int) [ 1, 2 ]") ); @@ -134,6 +134,7 @@ gst_goom_get_type (void) 0, (GInstanceInitFunc) gst_goom_init, }; + type = g_type_register_static (GST_TYPE_ELEMENT, "GstGOOM", &info, 0); } return type; @@ -190,7 +191,7 @@ gst_goom_init (GstGOOM * goom) goom->width = 320; goom->height = 200; - goom->fps = 25.; /* desired frame rate */ + goom->fps = 25.; /* desired frame rate */ goom->channels = 0; /* set to something */ goom_init (50, 50); @@ -258,7 +259,7 @@ gst_goom_src_fixate (GstPad * pad, const GstCaps * caps) return newcaps; } if (gst_caps_structure_fixate_field_nearest_double (structure, "framerate", - 30.0)) { + 30.0)) { return newcaps; } @@ -287,22 +288,22 @@ gst_goom_chain (GstPad * pad, GstData * _data) switch (GST_EVENT_TYPE (event)) { case GST_EVENT_DISCONTINUOUS: { - gint64 value = 0; + gint64 value = 0; - gst_event_discont_get_value (event, GST_FORMAT_TIME, &value); + gst_event_discont_get_value (event, GST_FORMAT_TIME, &value); - goom->next_time = value; + goom->next_time = value; } default: - gst_pad_event_default (pad, event); - break; + gst_pad_event_default (pad, event); + break; } return; } if (goom->channels == 0) { GST_ELEMENT_ERROR (goom, CORE, NEGOTIATION, (NULL), - ("format wasn't negotiated before chain function")); + ("format wasn't negotiated before chain function")); goto done; } diff --git a/gst/goom/lines.c b/gst/goom/lines.c index 611f9a52..e497b5eb 100644 --- a/gst/goom/lines.c +++ b/gst/goom/lines.c @@ -35,14 +35,14 @@ goom_lines (gint16 data[2][512], unsigned int ID, unsigned int *p, unsigned char *color = 1 + (unsigned char *) &color1; switch (ID) { - case 0: /* Horizontal stereo lines */ + case 0: /* Horizontal stereo lines */ { color1 = 0x0000AA00; color2 = 0x00AA0000; break; } - case 1: /* Stereo circles */ + case 1: /* Stereo circles */ { color1 = 0x00AA33DD; color2 = 0x00AA33DD; @@ -62,24 +62,24 @@ goom_lines (gint16 data[2][512], unsigned int ID, unsigned int *p, *color = lighten (*color, power); switch (ID) { - case 0: /* Horizontal stereo lines */ + case 0: /* Horizontal stereo lines */ { unsigned int i; for (i = 0; i < 512; i++) { - guint32 plot; + guint32 plot; - plot = i * resolx / 512 + (resoly / 4 + data[0][i] / 1600) * resolx; - p[plot] = color1; - p[plot + 1] = color1; - plot = i * resolx / 512 + (resoly * 3 / 4 - data[1][i] / 1600) * resolx; - p[plot] = color2; - p[plot + 1] = color2; + plot = i * resolx / 512 + (resoly / 4 + data[0][i] / 1600) * resolx; + p[plot] = color1; + p[plot + 1] = color1; + plot = i * resolx / 512 + (resoly * 3 / 4 - data[1][i] / 1600) * resolx; + p[plot] = color2; + p[plot + 1] = color2; } break; } - case 1: /* Stereo circles */ + case 1: /* Stereo circles */ { float z; unsigned int monX = resolx / 2; @@ -87,19 +87,19 @@ goom_lines (gint16 data[2][512], unsigned int ID, unsigned int *p, float monY2 = resoly / 2; for (z = 0; z < 6.2832f; z += 1.0f / monY) { - /* float offset1 = 128+data[1][(unsigned int)(z*81.33f)])/200000; */ - p[monX + (unsigned int) ((monY + ((float) resoly) * (128 + - data[1][(unsigned int) (z * 81.33f)]) / 200000) * - cos (z) + resolx * (unsigned int) (monY2 + (monY + - ((float) resoly) * (128 + - data[1][(unsigned int) (z * 81.33f)]) / 400000) * - sin (z)))] = color1; - p[monX + (unsigned int) ((monY - ((float) resoly) * (128 + - data[0][(unsigned int) (z * 81.33f)]) / 200000) * - cos (z) + resolx * (unsigned int) (monY2 + (monY - - ((float) resoly) * (128 + - data[0][(unsigned int) (z * 81.33f)]) / 400000) * - sin (z)))] = color2; + /* float offset1 = 128+data[1][(unsigned int)(z*81.33f)])/200000; */ + p[monX + (unsigned int) ((monY + ((float) resoly) * (128 + + data[1][(unsigned int) (z * 81.33f)]) / 200000) * + cos (z) + resolx * (unsigned int) (monY2 + (monY + + ((float) resoly) * (128 + + data[1][(unsigned int) (z * 81.33f)]) / 400000) * + sin (z)))] = color1; + p[monX + (unsigned int) ((monY - ((float) resoly) * (128 + + data[0][(unsigned int) (z * 81.33f)]) / 200000) * + cos (z) + resolx * (unsigned int) (monY2 + (monY - + ((float) resoly) * (128 + + data[0][(unsigned int) (z * 81.33f)]) / 400000) * + sin (z)))] = color2; } break; } diff --git a/gst/law/alaw-decode.c b/gst/law/alaw-decode.c index 4bae398e..2bf176c2 100644 --- a/gst/law/alaw-decode.c +++ b/gst/law/alaw-decode.c @@ -129,9 +129,10 @@ gst_alawdec_get_type (void) 0, (GInstanceInitFunc) gst_alawdec_init, }; + alawdec_type = - g_type_register_static (GST_TYPE_ELEMENT, "GstALawDec", &alawdec_info, - 0); + g_type_register_static (GST_TYPE_ELEMENT, "GstALawDec", &alawdec_info, + 0); } return alawdec_type; } diff --git a/gst/law/alaw-encode.c b/gst/law/alaw-encode.c index 052f2e00..6a6708ab 100644 --- a/gst/law/alaw-encode.c +++ b/gst/law/alaw-encode.c @@ -171,9 +171,10 @@ gst_alawenc_get_type (void) 0, (GInstanceInitFunc) gst_alawenc_init, }; + alawenc_type = - g_type_register_static (GST_TYPE_ELEMENT, "GstALawEnc", &alawenc_info, - 0); + g_type_register_static (GST_TYPE_ELEMENT, "GstALawEnc", &alawenc_info, + 0); } return alawenc_type; } diff --git a/gst/law/alaw.c b/gst/law/alaw.c index 05ac2d23..d85dd9aa 100644 --- a/gst/law/alaw.c +++ b/gst/law/alaw.c @@ -46,9 +46,9 @@ plugin_init (GstPlugin * plugin) gst_pad_template_new ("sink", GST_PAD_SINK, GST_PAD_ALWAYS, alaw_caps); if (!gst_element_register (plugin, "alawenc", - GST_RANK_NONE, GST_TYPE_ALAWENC) || + GST_RANK_NONE, GST_TYPE_ALAWENC) || !gst_element_register (plugin, "alawdec", - GST_RANK_PRIMARY, GST_TYPE_ALAWENC)) + GST_RANK_PRIMARY, GST_TYPE_ALAWENC)) return FALSE; return TRUE; diff --git a/gst/law/mulaw-conversion.c b/gst/law/mulaw-conversion.c index fa4db3cb..a05d7bdc 100644 --- a/gst/law/mulaw-conversion.c +++ b/gst/law/mulaw-conversion.c @@ -25,8 +25,8 @@ #include -#define ZEROTRAP /* turn on the trap as per the MIL-STD */ -#define BIAS 0x84 /* define the add-in bias for 16 bit samples */ +#define ZEROTRAP /* turn on the trap as per the MIL-STD */ +#define BIAS 0x84 /* define the add-in bias for 16 bit samples */ #define CLIP 32635 void @@ -56,11 +56,11 @@ mulaw_encode (gint16 * in, guint8 * out, gint numsamples) for (i = 0; i < numsamples; i++) { sample = in[i]; /** get the sample into sign-magnitude **/ - sign = (sample >> 8) & 0x80; /* set aside the sign */ + sign = (sample >> 8) & 0x80; /* set aside the sign */ if (sign != 0) - sample = -sample; /* get magnitude */ + sample = -sample; /* get magnitude */ if (sample > CLIP) - sample = CLIP; /* clip the magnitude */ + sample = CLIP; /* clip the magnitude */ /** convert from 16 bit linear to ulaw **/ sample = sample + BIAS; exponent = exp_lut[(sample >> 7) & 0xFF]; @@ -68,7 +68,7 @@ mulaw_encode (gint16 * in, guint8 * out, gint numsamples) ulawbyte = ~(sign | (exponent << 4) | mantissa); #ifdef ZEROTRAP if (ulawbyte == 0) - ulawbyte = 0x02; /* optional CCITT trap */ + ulawbyte = 0x02; /* optional CCITT trap */ #endif out[i] = ulawbyte; } diff --git a/gst/law/mulaw-decode.c b/gst/law/mulaw-decode.c index 6a8f9e81..807dd280 100644 --- a/gst/law/mulaw-decode.c +++ b/gst/law/mulaw-decode.c @@ -106,9 +106,10 @@ gst_mulawdec_get_type (void) 0, (GInstanceInitFunc) gst_mulawdec_init, }; + mulawdec_type = - g_type_register_static (GST_TYPE_ELEMENT, "GstMuLawDec", &mulawdec_info, - 0); + g_type_register_static (GST_TYPE_ELEMENT, "GstMuLawDec", &mulawdec_info, + 0); } return mulawdec_type; } diff --git a/gst/law/mulaw-encode.c b/gst/law/mulaw-encode.c index db65e169..0c002c5d 100644 --- a/gst/law/mulaw-encode.c +++ b/gst/law/mulaw-encode.c @@ -104,9 +104,10 @@ gst_mulawenc_get_type (void) 0, (GInstanceInitFunc) gst_mulawenc_init, }; + mulawenc_type = - g_type_register_static (GST_TYPE_ELEMENT, "GstMuLawEnc", &mulawenc_info, - 0); + g_type_register_static (GST_TYPE_ELEMENT, "GstMuLawEnc", &mulawenc_info, + 0); } return mulawenc_type; } diff --git a/gst/law/mulaw.c b/gst/law/mulaw.c index 3702aaa6..7b7d222d 100644 --- a/gst/law/mulaw.c +++ b/gst/law/mulaw.c @@ -46,9 +46,9 @@ plugin_init (GstPlugin * plugin) gst_pad_template_new ("sink", GST_PAD_SINK, GST_PAD_ALWAYS, mulaw_caps); if (!gst_element_register (plugin, "mulawenc", - GST_RANK_NONE, GST_TYPE_MULAWENC) || + GST_RANK_NONE, GST_TYPE_MULAWENC) || !gst_element_register (plugin, "mulawdec", - GST_RANK_PRIMARY, GST_TYPE_MULAWDEC)) + GST_RANK_PRIMARY, GST_TYPE_MULAWDEC)) return FALSE; return TRUE; diff --git a/gst/level/gstlevel.c b/gst/level/gstlevel.c index 9a822436..391863d0 100644 --- a/gst/level/gstlevel.c +++ b/gst/level/gstlevel.c @@ -98,8 +98,9 @@ gst_level_get_type (void) sizeof (GstLevel), 0, (GInstanceInitFunc) gst_level_init }; + level_type = g_type_register_static (GST_TYPE_ELEMENT, "GstLevel", - &level_info, 0); + &level_info, 0); } return level_type; } @@ -160,8 +161,8 @@ gst_level_link (GstPad * pad, const GstCaps * caps) for (i = 0; i < filter->channels; ++i) { filter->CS[i] = filter->peak[i] = filter->last_peak[i] = - filter->decay_peak[i] = filter->decay_peak_age[i] = - filter->MS[i] = filter->RMS_dB[i] = 0.0; + filter->decay_peak[i] = filter->decay_peak_age[i] = + filter->MS[i] = filter->RMS_dB[i] = 0.0; } filter->inited = TRUE; @@ -174,7 +175,7 @@ gst_level_fast_16bit_chain (gint16 * in, guint num, gint channels, gint resolution, double *CS, double *peak) #include "filter.func" static void inline - gst_level_fast_8bit_chain (gint8 * in, guint num, gint channels, + gst_level_fast_8bit_chain (gint8 * in, guint num, gint channels, gint resolution, double *CS, double *peak) #include "filter.func" static void gst_level_chain (GstPad * pad, GstData * _data) @@ -203,18 +204,18 @@ gst_level_fast_16bit_chain (gint16 * in, guint num, gint channels, num_samples = GST_BUFFER_SIZE (buf) / (filter->width / 8); if (num_samples % filter->channels != 0) g_warning - ("WARNING: level: programming error, data not properly interleaved"); + ("WARNING: level: programming error, data not properly interleaved"); for (i = 0; i < filter->channels; ++i) { switch (filter->width) { case 16: - gst_level_fast_16bit_chain (in_data + i, num_samples, - filter->channels, filter->width - 1, &CS, &filter->peak[i]); - break; + gst_level_fast_16bit_chain (in_data + i, num_samples, + filter->channels, filter->width - 1, &CS, &filter->peak[i]); + break; case 8: - gst_level_fast_8bit_chain (((gint8 *) in_data) + i, num_samples, - filter->channels, filter->width - 1, &CS, &filter->peak[i]); - break; + gst_level_fast_8bit_chain (((gint8 *) in_data) + i, num_samples, + filter->channels, filter->width - 1, &CS, &filter->peak[i]); + break; } /* g_print ("DEBUG: CS %f, peak %f\n", CS, filter->peak[i]); */ filter->CS[i] += CS; @@ -240,20 +241,20 @@ gst_level_fast_16bit_chain (gint16 * in, guint num, gint channels, } else { /* make decay peak fall off if too old */ if (filter->decay_peak_age[i] > filter->rate * filter->decay_peak_ttl) { - double falloff_dB; - double falloff; - double length; /* length of buffer in seconds */ + double falloff_dB; + double falloff; + double length; /* length of buffer in seconds */ - length = (double) num_samples / (filter->channels * filter->rate); - falloff_dB = filter->decay_peak_falloff * length; - falloff = pow (10, falloff_dB / -20.0); + length = (double) num_samples / (filter->channels * filter->rate); + falloff_dB = filter->decay_peak_falloff * length; + falloff = pow (10, falloff_dB / -20.0); - /* g_print ("falloff: length %f, dB falloff %f, falloff factor %e\n", - length, falloff_dB, falloff); */ - filter->decay_peak[i] *= falloff; - /* g_print ("peak is %f samples old, decayed with factor %e to %f\n", - filter->decay_peak_age[i], falloff, filter->decay_peak[i]); */ + /* g_print ("falloff: length %f, dB falloff %f, falloff factor %e\n", + length, falloff_dB, falloff); */ + filter->decay_peak[i] *= falloff; + /* g_print ("peak is %f samples old, decayed with factor %e to %f\n", + filter->decay_peak_age[i], falloff, filter->decay_peak[i]); */ } } } @@ -265,19 +266,19 @@ gst_level_fast_16bit_chain (gint16 * in, guint num, gint channels, gdouble RMS, peak, endtime; for (i = 0; i < filter->channels; ++i) { - RMS = sqrt (filter->CS[i] / (filter->num_samples / filter->channels)); - peak = filter->last_peak[i]; - num_samples = GST_BUFFER_SIZE (buf) / (filter->width / 8); - endtime = (double) GST_BUFFER_TIMESTAMP (buf) / GST_SECOND - + (double) num_samples / (double) filter->rate; - - g_signal_emit (G_OBJECT (filter), gst_filter_signals[SIGNAL_LEVEL], 0, - endtime, i, - 20 * log10 (RMS), 20 * log10 (filter->last_peak[i]), - 20 * log10 (filter->decay_peak[i])); - /* we emitted, so reset cumulative and normal peak */ - filter->CS[i] = 0.0; - filter->last_peak[i] = 0.0; + RMS = sqrt (filter->CS[i] / (filter->num_samples / filter->channels)); + peak = filter->last_peak[i]; + num_samples = GST_BUFFER_SIZE (buf) / (filter->width / 8); + endtime = (double) GST_BUFFER_TIMESTAMP (buf) / GST_SECOND + + (double) num_samples / (double) filter->rate; + + g_signal_emit (G_OBJECT (filter), gst_filter_signals[SIGNAL_LEVEL], 0, + endtime, i, + 20 * log10 (RMS), 20 * log10 (filter->last_peak[i]), + 20 * log10 (filter->decay_peak[i])); + /* we emitted, so reset cumulative and normal peak */ + filter->CS[i] = 0.0; + filter->last_peak[i] = 0.0; } } filter->num_samples = 0; @@ -292,7 +293,7 @@ gst_level_change_state (GstElement * element) switch (GST_STATE_TRANSITION (element)) { case GST_STATE_PAUSED_TO_PLAYING: if (!filter->inited) - return GST_STATE_FAILURE; + return GST_STATE_FAILURE; break; default: break; @@ -384,19 +385,19 @@ gst_level_class_init (GstLevelClass * klass) parent_class = g_type_class_ref (GST_TYPE_ELEMENT); g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_SIGNAL_LEVEL, g_param_spec_boolean ("signal", "Signal", - "Emit level signals for each interval", TRUE, G_PARAM_READWRITE)); + "Emit level signals for each interval", TRUE, G_PARAM_READWRITE)); g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_SIGNAL_INTERVAL, g_param_spec_double ("interval", "Interval", - "Interval between emissions (in seconds)", - 0.01, 100.0, 0.1, G_PARAM_READWRITE)); + "Interval between emissions (in seconds)", + 0.01, 100.0, 0.1, G_PARAM_READWRITE)); g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_PEAK_TTL, g_param_spec_double ("peak_ttl", "Peak TTL", - "Time To Live of decay peak before it falls back", - 0, 100.0, 0.3, G_PARAM_READWRITE)); + "Time To Live of decay peak before it falls back", + 0, 100.0, 0.3, G_PARAM_READWRITE)); g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_PEAK_FALLOFF, g_param_spec_double ("peak_falloff", "Peak Falloff", - "Decay rate of decay peak after TTL (in dB/sec)", - 0.0, G_MAXDOUBLE, 10.0, G_PARAM_READWRITE)); + "Decay rate of decay peak after TTL (in dB/sec)", + 0.0, G_MAXDOUBLE, 10.0, G_PARAM_READWRITE)); gobject_class->set_property = gst_level_set_property; gobject_class->get_property = gst_level_get_property; @@ -437,7 +438,7 @@ gst_level_init (GstLevel * filter) filter->interval = 0.1; filter->decay_peak_ttl = 0.4; - filter->decay_peak_falloff = 10.0; /* dB falloff (/sec) */ + filter->decay_peak_falloff = 10.0; /* dB falloff (/sec) */ } static gboolean diff --git a/gst/level/plot.c b/gst/level/plot.c index ad6d70d7..187be8b1 100644 --- a/gst/level/plot.c +++ b/gst/level/plot.c @@ -28,10 +28,10 @@ #include #include -gboolean got_channel[2] = { FALSE, FALSE }; /* to see if we got the signal for this one yet */ -gint channels = 0; /* guess at how many channels there are */ -gdouble last_time = 0.0; /* time of last signal */ -gdouble values[2][3]; /* array of levels from which to print */ +gboolean got_channel[2] = { FALSE, FALSE }; /* to see if we got the signal for this one yet */ +gint channels = 0; /* guess at how many channels there are */ +gdouble last_time = 0.0; /* time of last signal */ +gdouble values[2][3]; /* array of levels from which to print */ static void level_callback (GstElement * element, gdouble time, gint channel, @@ -66,7 +66,7 @@ level_callback (GstElement * element, gdouble time, gint channel, g_print ("%f ", time); for (i = 0; i < channels; ++i) for (j = 0; j < 3; ++j) - g_print ("%f ", values[i][j]); + g_print ("%f ", values[i][j]); g_print ("\n"); } } diff --git a/gst/matroska/ebml-read.c b/gst/matroska/ebml-read.c index 6fa53565..064d5e1e 100644 --- a/gst/matroska/ebml-read.c +++ b/gst/matroska/ebml-read.c @@ -59,8 +59,8 @@ gst_ebml_read_get_type (void) }; gst_ebml_read_type = - g_type_register_static (GST_TYPE_ELEMENT, "GstEbmlRead", - &gst_ebml_read_info, 0); + g_type_register_static (GST_TYPE_ELEMENT, "GstEbmlRead", + &gst_ebml_read_info, 0); } return gst_ebml_read_type; @@ -92,16 +92,16 @@ gst_ebml_read_change_state (GstElement * element) switch (GST_STATE_TRANSITION (element)) { case GST_STATE_READY_TO_PAUSED: if (!ebml->sinkpad) - return GST_STATE_FAILURE; + return GST_STATE_FAILURE; ebml->bs = gst_bytestream_new (ebml->sinkpad); break; case GST_STATE_PAUSED_TO_READY: gst_bytestream_destroy (ebml->bs); while (ebml->level) { - GstEbmlLevel *level = ebml->level->data; + GstEbmlLevel *level = ebml->level->data; - ebml->level = g_list_remove (ebml->level, level); - g_free (level); + ebml->level = g_list_remove (ebml->level, level); + g_free (level); } break; default: @@ -167,7 +167,7 @@ gst_ebml_read_element_id (GstEbmlRead * ebml, guint32 * id, guint * level_up) gst_event_unref (event); GST_ELEMENT_ERROR (ebml, RESOURCE, READ, (NULL), - ("Read error at position %llu (0x%llx)", pos, pos)); + ("Read error at position %llu (0x%llx)", pos, pos)); return -1; } } @@ -180,8 +180,8 @@ gst_ebml_read_element_id (GstEbmlRead * ebml, guint32 * id, guint * level_up) guint64 pos = gst_bytestream_tell (ebml->bs); GST_ELEMENT_ERROR (ebml, STREAM, DEMUX, (NULL), - ("Invalid EBML ID size tag (0x%x) at position %llu (0x%llx)", - data[0], pos, pos)); + ("Invalid EBML ID size tag (0x%x) at position %llu (0x%llx)", + data[0], pos, pos)); return -1; } @@ -189,7 +189,7 @@ gst_ebml_read_element_id (GstEbmlRead * ebml, guint32 * id, guint * level_up) guint64 pos = gst_bytestream_tell (ebml->bs); GST_ELEMENT_ERROR (ebml, RESOURCE, READ, (NULL), - ("Read error at position %llu (0x%llx)", pos, pos)); + ("Read error at position %llu (0x%llx)", pos, pos)); return -1; } while (n < read) @@ -220,7 +220,7 @@ gst_ebml_read_element_length (GstEbmlRead * ebml, guint64 * length) guint64 pos = gst_bytestream_tell (ebml->bs); GST_ELEMENT_ERROR (ebml, RESOURCE, READ, (NULL), - ("Read error at position %llu (0x%llx)", pos, pos)); + ("Read error at position %llu (0x%llx)", pos, pos)); return -1; } total = data[0]; @@ -232,8 +232,8 @@ gst_ebml_read_element_length (GstEbmlRead * ebml, guint64 * length) guint64 pos = gst_bytestream_tell (ebml->bs); GST_ELEMENT_ERROR (ebml, STREAM, DEMUX, (NULL), - ("Invalid EBML length size tag (0x%x) at position %llu (0x%llx)", - data[0], pos, pos)); + ("Invalid EBML length size tag (0x%x) at position %llu (0x%llx)", + data[0], pos, pos)); return -1; } @@ -243,7 +243,7 @@ gst_ebml_read_element_length (GstEbmlRead * ebml, guint64 * length) guint64 pos = gst_bytestream_tell (ebml->bs); GST_ELEMENT_ERROR (ebml, RESOURCE, READ, (NULL), - ("Read error at position %llu (0x%llx)", pos, pos)); + ("Read error at position %llu (0x%llx)", pos, pos)); return -1; } while (n < read) { @@ -275,7 +275,7 @@ gst_ebml_read_element_data (GstEbmlRead * ebml, guint64 length) guint64 pos = gst_bytestream_tell (ebml->bs); GST_ELEMENT_ERROR (ebml, RESOURCE, READ, (NULL), - ("Read error at position %llu (0x%llx)", pos, pos)); + ("Read error at position %llu (0x%llx)", pos, pos)); if (buf) gst_buffer_unref (buf); return NULL; @@ -328,7 +328,7 @@ gst_ebml_read_seek (GstEbmlRead * ebml, guint64 offset) /* now seek */ if (!gst_bytestream_seek (ebml->bs, offset, GST_SEEK_METHOD_SET)) { GST_ELEMENT_ERROR (ebml, RESOURCE, SEEK, (NULL), - ("Seek to position %llu (0x%llx) failed", offset, offset)); + ("Seek to position %llu (0x%llx) failed", offset, offset)); return NULL; } @@ -385,7 +385,7 @@ gst_ebml_read_skip (GstEbmlRead * ebml) return gst_bytestream_flush (ebml->bs, length); if (!(event = gst_ebml_read_seek (ebml, - gst_bytestream_tell (ebml->bs) + length))) + gst_bytestream_tell (ebml->bs) + length))) return FALSE; gst_event_unref (event); @@ -432,8 +432,8 @@ gst_ebml_read_uint (GstEbmlRead * ebml, guint32 * id, guint64 * num) size = GST_BUFFER_SIZE (buf); if (size < 1 || size > 8) { GST_ELEMENT_ERROR (ebml, STREAM, DEMUX, (NULL), - ("Invalid integer element size %d at position %llu (0x%llu)", - size, GST_BUFFER_OFFSET (buf), GST_BUFFER_OFFSET (buf))); + ("Invalid integer element size %d at position %llu (0x%llu)", + size, GST_BUFFER_OFFSET (buf), GST_BUFFER_OFFSET (buf))); gst_buffer_unref (buf); return FALSE; } @@ -466,8 +466,8 @@ gst_ebml_read_sint (GstEbmlRead * ebml, guint32 * id, gint64 * num) size = GST_BUFFER_SIZE (buf); if (size < 1 || size > 8) { GST_ELEMENT_ERROR (ebml, STREAM, DEMUX, (NULL), - ("Invalid integer element size %d at position %llu (0x%llx)", - size, GST_BUFFER_OFFSET (buf), GST_BUFFER_OFFSET (buf))); + ("Invalid integer element size %d at position %llu (0x%llx)", + size, GST_BUFFER_OFFSET (buf), GST_BUFFER_OFFSET (buf))); gst_buffer_unref (buf); return FALSE; } @@ -509,15 +509,15 @@ gst_ebml_read_float (GstEbmlRead * ebml, guint32 * id, gdouble * num) if (size != 4 && size != 8 && size != 10) { GST_ELEMENT_ERROR (ebml, STREAM, DEMUX, (NULL), - ("Invalid float element size %d at position %llu (0x%llx)", - size, GST_BUFFER_OFFSET (buf), GST_BUFFER_OFFSET (buf))); + ("Invalid float element size %d at position %llu (0x%llx)", + size, GST_BUFFER_OFFSET (buf), GST_BUFFER_OFFSET (buf))); gst_buffer_unref (buf); return FALSE; } if (size == 10) { GST_ELEMENT_ERROR (ebml, CORE, NOT_IMPLEMENTED, (NULL), - ("FIXME! 10-byte floats unimplemented")); + ("FIXME! 10-byte floats unimplemented")); gst_buffer_unref (buf); return FALSE; } @@ -682,79 +682,79 @@ gst_ebml_read_header (GstEbmlRead * ebml, gchar ** doctype, guint * version) break; switch (id) { - /* is our read version uptodate? */ + /* is our read version uptodate? */ case GST_EBML_ID_EBMLREADVERSION:{ - guint64 num; - - if (!gst_ebml_read_uint (ebml, &id, &num)) - return FALSE; - g_assert (id == GST_EBML_ID_EBMLREADVERSION); - if (num != GST_EBML_VERSION) - return FALSE; - break; + guint64 num; + + if (!gst_ebml_read_uint (ebml, &id, &num)) + return FALSE; + g_assert (id == GST_EBML_ID_EBMLREADVERSION); + if (num != GST_EBML_VERSION) + return FALSE; + break; } - /* we only handle 8 byte lengths at max */ + /* we only handle 8 byte lengths at max */ case GST_EBML_ID_EBMLMAXSIZELENGTH:{ - guint64 num; - - if (!gst_ebml_read_uint (ebml, &id, &num)) - return FALSE; - g_assert (id == GST_EBML_ID_EBMLMAXSIZELENGTH); - if (num != sizeof (guint64)) - return FALSE; - break; + guint64 num; + + if (!gst_ebml_read_uint (ebml, &id, &num)) + return FALSE; + g_assert (id == GST_EBML_ID_EBMLMAXSIZELENGTH); + if (num != sizeof (guint64)) + return FALSE; + break; } - /* we handle 4 byte IDs at max */ + /* we handle 4 byte IDs at max */ case GST_EBML_ID_EBMLMAXIDLENGTH:{ - guint64 num; - - if (!gst_ebml_read_uint (ebml, &id, &num)) - return FALSE; - g_assert (id == GST_EBML_ID_EBMLMAXIDLENGTH); - if (num != sizeof (guint32)) - return FALSE; - break; + guint64 num; + + if (!gst_ebml_read_uint (ebml, &id, &num)) + return FALSE; + g_assert (id == GST_EBML_ID_EBMLMAXIDLENGTH); + if (num != sizeof (guint32)) + return FALSE; + break; } case GST_EBML_ID_DOCTYPE:{ - gchar *text; - - if (!gst_ebml_read_ascii (ebml, &id, &text)) - return FALSE; - g_assert (id == GST_EBML_ID_DOCTYPE); - if (doctype) { - if (doctype) - g_free (*doctype); - *doctype = text; - } else - g_free (text); - break; + gchar *text; + + if (!gst_ebml_read_ascii (ebml, &id, &text)) + return FALSE; + g_assert (id == GST_EBML_ID_DOCTYPE); + if (doctype) { + if (doctype) + g_free (*doctype); + *doctype = text; + } else + g_free (text); + break; } case GST_EBML_ID_DOCTYPEREADVERSION:{ - guint64 num; - - if (!gst_ebml_read_uint (ebml, &id, &num)) - return FALSE; - g_assert (id == GST_EBML_ID_DOCTYPEREADVERSION); - if (version) - *version = num; - break; + guint64 num; + + if (!gst_ebml_read_uint (ebml, &id, &num)) + return FALSE; + g_assert (id == GST_EBML_ID_DOCTYPEREADVERSION); + if (version) + *version = num; + break; } default: - GST_WARNING ("Unknown data type 0x%x in EBML header (ignored)", id); - /* pass-through */ + GST_WARNING ("Unknown data type 0x%x in EBML header (ignored)", id); + /* pass-through */ - /* we ignore these two, as they don't tell us anything we care about */ + /* we ignore these two, as they don't tell us anything we care about */ case GST_EBML_ID_VOID: case GST_EBML_ID_EBMLVERSION: case GST_EBML_ID_DOCTYPEVERSION: - if (!gst_ebml_read_skip (ebml)) - return FALSE; - break; + if (!gst_ebml_read_skip (ebml)) + return FALSE; + break; } } diff --git a/gst/matroska/ebml-write.c b/gst/matroska/ebml-write.c index d136a8d4..302d4898 100644 --- a/gst/matroska/ebml-write.c +++ b/gst/matroska/ebml-write.c @@ -59,8 +59,8 @@ gst_ebml_write_get_type (void) }; gst_ebml_write_type = - g_type_register_static (GST_TYPE_ELEMENT, "GstEbmlWrite", - &gst_ebml_write_info, 0); + g_type_register_static (GST_TYPE_ELEMENT, "GstEbmlWrite", + &gst_ebml_write_info, 0); } return gst_ebml_write_type; @@ -292,13 +292,13 @@ gst_ebml_write_seek (GstEbmlWrite * ebml, guint64 pos) if (ebml->cache) { /* within bounds? */ if (pos >= GST_BUFFER_OFFSET (ebml->cache) && - pos < - GST_BUFFER_OFFSET (ebml->cache) + GST_BUFFER_MAXSIZE (ebml->cache)) { + pos < + GST_BUFFER_OFFSET (ebml->cache) + GST_BUFFER_MAXSIZE (ebml->cache)) { GST_BUFFER_SIZE (ebml->cache) = pos - GST_BUFFER_OFFSET (ebml->cache); if (ebml->pos > pos) - ebml->handled -= ebml->pos - pos; + ebml->handled -= ebml->pos - pos; else - ebml->handled += pos - ebml->pos; + ebml->handled += pos - ebml->pos; ebml->pos = pos; } else { GST_LOG ("Seek outside cache range. Clearing..."); @@ -414,7 +414,7 @@ gst_ebml_write_float (GstEbmlWrite * ebml, guint32 id, gdouble num) void gst_ebml_write_ascii (GstEbmlWrite * ebml, guint32 id, const gchar * str) { - gint len = strlen (str) + 1; /* add trailing '\0' */ + gint len = strlen (str) + 1; /* add trailing '\0' */ GstBuffer *buf = gst_ebml_write_element_new (ebml, len); gst_ebml_write_element_id (buf, id); diff --git a/gst/matroska/matroska-demux.c b/gst/matroska/matroska-demux.c index 383ec020..f0acf6f9 100644 --- a/gst/matroska/matroska-demux.c +++ b/gst/matroska/matroska-demux.c @@ -125,8 +125,8 @@ gst_matroska_demux_get_type (void) }; gst_matroska_demux_type = - g_type_register_static (GST_TYPE_EBML_READ, - "GstMatroskaDemux", &gst_matroska_demux_info, 0); + g_type_register_static (GST_TYPE_EBML_READ, + "GstMatroskaDemux", &gst_matroska_demux_info, 0); } return gst_matroska_demux_type; @@ -162,10 +162,10 @@ gst_matroska_demux_class_init (GstMatroskaDemuxClass * klass) g_object_class_install_property (gobject_class, ARG_METADATA, g_param_spec_boxed ("metadata", "Metadata", "Metadata", - GST_TYPE_STRUCTURE, G_PARAM_READABLE)); + GST_TYPE_STRUCTURE, G_PARAM_READABLE)); g_object_class_install_property (gobject_class, ARG_STREAMINFO, g_param_spec_boxed ("streaminfo", "Streaminfo", "Streaminfo", - GST_TYPE_STRUCTURE, G_PARAM_READABLE)); + GST_TYPE_STRUCTURE, G_PARAM_READABLE)); parent_class = g_type_class_ref (GST_TYPE_EBML_READ); @@ -186,7 +186,7 @@ gst_matroska_demux_init (GstMatroskaDemux * demux) demux->sinkpad = gst_pad_new_from_template (gst_element_class_get_pad_template (klass, - "sink"), "sink"); + "sink"), "sink"); gst_element_add_pad (GST_ELEMENT (demux), demux->sinkpad); GST_EBML_READ (demux)->sinkpad = demux->sinkpad; @@ -217,7 +217,7 @@ gst_matroska_demux_reset (GstElement * element) for (i = 0; i < GST_MATROSKA_DEMUX_MAX_STREAMS; i++) { if (demux->src[i] != NULL) { if (demux->src[i]->pad != NULL) { - gst_element_remove_pad (GST_ELEMENT (demux), demux->src[i]->pad); + gst_element_remove_pad (GST_ELEMENT (demux), demux->src[i]->pad); } g_free (demux->src[i]->codec_id); g_free (demux->src[i]->codec_name); @@ -316,8 +316,8 @@ gst_matroska_demux_add_stream (GstMatroskaDemux * demux) if (demux->num_streams >= GST_MATROSKA_DEMUX_MAX_STREAMS) { GST_WARNING ("Maximum number of streams (%d) exceeded, skipping", - GST_MATROSKA_DEMUX_MAX_STREAMS); - return gst_ebml_read_skip (ebml); /* skip-and-continue */ + GST_MATROSKA_DEMUX_MAX_STREAMS); + return gst_ebml_read_skip (ebml); /* skip-and-continue */ } /* allocate generic... if we know the type, we'll g_renew() @@ -325,7 +325,7 @@ gst_matroska_demux_add_stream (GstMatroskaDemux * demux) context = g_new0 (GstMatroskaTrackContext, 1); demux->src[demux->num_streams] = context; context->index = demux->num_streams; - context->type = 0; /* no type yet */ + context->type = 0; /* no type yet */ demux->num_streams++; /* start with the master */ @@ -343,474 +343,474 @@ gst_matroska_demux_add_stream (GstMatroskaDemux * demux) } switch (id) { - /* track number (unique stream ID) */ + /* track number (unique stream ID) */ case GST_MATROSKA_ID_TRACKNUMBER:{ - guint64 num; - - if (!gst_ebml_read_uint (ebml, &id, &num)) { - res = FALSE; - break; - } - context->num = num; - break; + guint64 num; + + if (!gst_ebml_read_uint (ebml, &id, &num)) { + res = FALSE; + break; + } + context->num = num; + break; } - /* track UID (unique identifier) */ + /* track UID (unique identifier) */ case GST_MATROSKA_ID_TRACKUID:{ - guint64 num; - - if (!gst_ebml_read_uint (ebml, &id, &num)) { - res = FALSE; - break; - } - context->uid = num; - break; + guint64 num; + + if (!gst_ebml_read_uint (ebml, &id, &num)) { + res = FALSE; + break; + } + context->uid = num; + break; } - /* track type (video, audio, combined, subtitle, etc.) */ + /* track type (video, audio, combined, subtitle, etc.) */ case GST_MATROSKA_ID_TRACKTYPE:{ - guint64 num; - - if (context->type != 0) { - GST_WARNING - ("More than one tracktype defined in a trackentry - skipping"); - break; - } - if (!gst_ebml_read_uint (ebml, &id, &num)) { - res = FALSE; - break; - } - context->type = num; - - /* ok, so we're actually going to reallocate this thing */ - switch (context->type) { - case GST_MATROSKA_TRACK_TYPE_VIDEO: - context = (GstMatroskaTrackContext *) - g_renew (GstMatroskaTrackVideoContext, context, 1); - break; - case GST_MATROSKA_TRACK_TYPE_AUDIO: - context = (GstMatroskaTrackContext *) - g_renew (GstMatroskaTrackAudioContext, context, 1); - /* defaults */ - ((GstMatroskaTrackAudioContext *) context)->channels = 1; - ((GstMatroskaTrackAudioContext *) context)->samplerate = 8000; - break; - case GST_MATROSKA_TRACK_TYPE_COMPLEX: - context = (GstMatroskaTrackContext *) - g_renew (GstMatroskaTrackComplexContext, context, 1); - break; - case GST_MATROSKA_TRACK_TYPE_SUBTITLE: - context = (GstMatroskaTrackContext *) - g_renew (GstMatroskaTrackSubtitleContext, context, 1); - break; - case GST_MATROSKA_TRACK_TYPE_LOGO: - case GST_MATROSKA_TRACK_TYPE_CONTROL: - default: - GST_WARNING ("Unknown or unsupported track type 0x%x", - context->type); - context->type = 0; - break; - } - demux->src[demux->num_streams - 1] = context; - break; + guint64 num; + + if (context->type != 0) { + GST_WARNING + ("More than one tracktype defined in a trackentry - skipping"); + break; + } + if (!gst_ebml_read_uint (ebml, &id, &num)) { + res = FALSE; + break; + } + context->type = num; + + /* ok, so we're actually going to reallocate this thing */ + switch (context->type) { + case GST_MATROSKA_TRACK_TYPE_VIDEO: + context = (GstMatroskaTrackContext *) + g_renew (GstMatroskaTrackVideoContext, context, 1); + break; + case GST_MATROSKA_TRACK_TYPE_AUDIO: + context = (GstMatroskaTrackContext *) + g_renew (GstMatroskaTrackAudioContext, context, 1); + /* defaults */ + ((GstMatroskaTrackAudioContext *) context)->channels = 1; + ((GstMatroskaTrackAudioContext *) context)->samplerate = 8000; + break; + case GST_MATROSKA_TRACK_TYPE_COMPLEX: + context = (GstMatroskaTrackContext *) + g_renew (GstMatroskaTrackComplexContext, context, 1); + break; + case GST_MATROSKA_TRACK_TYPE_SUBTITLE: + context = (GstMatroskaTrackContext *) + g_renew (GstMatroskaTrackSubtitleContext, context, 1); + break; + case GST_MATROSKA_TRACK_TYPE_LOGO: + case GST_MATROSKA_TRACK_TYPE_CONTROL: + default: + GST_WARNING ("Unknown or unsupported track type 0x%x", + context->type); + context->type = 0; + break; + } + demux->src[demux->num_streams - 1] = context; + break; } - /* tracktype specific stuff for video */ + /* tracktype specific stuff for video */ case GST_MATROSKA_ID_TRACKVIDEO:{ - GstMatroskaTrackVideoContext *videocontext; - - if (context->type != GST_MATROSKA_TRACK_TYPE_VIDEO) { - GST_WARNING - ("trackvideo EBML entry in non-video track - ignoring track"); - res = FALSE; - break; - } else if (!gst_ebml_read_master (ebml, &id)) { - res = FALSE; - break; - } - videocontext = (GstMatroskaTrackVideoContext *) context; - - while (res) { - if (!(id = gst_ebml_peek_id (ebml, &demux->level_up))) { - res = FALSE; - break; - } else if (demux->level_up > 0) { - demux->level_up--; - break; - } - - switch (id) { - /* fixme, this should be one-up, but I get it here (?) */ - case GST_MATROSKA_ID_TRACKDEFAULTDURATION:{ - guint64 num; - - if (!gst_ebml_read_uint (ebml, &id, &num)) { - res = FALSE; - break; - } - context->default_duration = num; - break; - } - - /* video framerate */ - case GST_MATROSKA_ID_VIDEOFRAMERATE:{ - gdouble num; - - if (!gst_ebml_read_float (ebml, &id, &num)) { - res = FALSE; - break; - } - context->default_duration = GST_SECOND * (1. / num); - break; - } - - /* width of the size to display the video at */ - case GST_MATROSKA_ID_VIDEODISPLAYWIDTH:{ - guint64 num; - - if (!gst_ebml_read_uint (ebml, &id, &num)) { - res = FALSE; - break; - } - videocontext->display_width = num; - break; - } - - /* height of the size to display the video at */ - case GST_MATROSKA_ID_VIDEODISPLAYHEIGHT:{ - guint64 num; - - if (!gst_ebml_read_uint (ebml, &id, &num)) { - res = FALSE; - break; - } - videocontext->display_height = num; - break; - } - - /* width of the video in the file */ - case GST_MATROSKA_ID_VIDEOPIXELWIDTH:{ - guint64 num; - - if (!gst_ebml_read_uint (ebml, &id, &num)) { - res = FALSE; - break; - } - videocontext->pixel_width = num; - break; - } - - /* height of the video in the file */ - case GST_MATROSKA_ID_VIDEOPIXELHEIGHT:{ - guint64 num; - - if (!gst_ebml_read_uint (ebml, &id, &num)) { - res = FALSE; - break; - } - videocontext->pixel_height = num; - break; - } - - /* whether the video is interlaced */ - case GST_MATROSKA_ID_VIDEOFLAGINTERLACED:{ - guint64 num; - - if (!gst_ebml_read_uint (ebml, &id, &num)) { - res = FALSE; - break; - } - if (num) - context->flags |= GST_MATROSKA_VIDEOTRACK_INTERLACED; - else - context->flags &= ~GST_MATROSKA_VIDEOTRACK_INTERLACED; - break; - } - - /* stereo mode (whether the video has two streams, where - * one is for the left eye and the other for the right eye, - * which creates a 3D-like effect) */ - case GST_MATROSKA_ID_VIDEOSTEREOMODE:{ - guint64 num; - - if (!gst_ebml_read_uint (ebml, &id, &num)) { - res = FALSE; - break; - } - if (num != GST_MATROSKA_EYE_MODE_MONO && - num != GST_MATROSKA_EYE_MODE_LEFT && - num != GST_MATROSKA_EYE_MODE_RIGHT && - num != GST_MATROSKA_EYE_MODE_BOTH) { - GST_WARNING ("Unknown eye mode 0x%x - ignoring", (guint) num); - break; - } - videocontext->eye_mode = num; - break; - } - - /* aspect ratio behaviour */ - case GST_MATROSKA_ID_VIDEOASPECTRATIO:{ - guint64 num; - - if (!gst_ebml_read_uint (ebml, &id, &num)) { - res = FALSE; - break; - } - if (num != GST_MATROSKA_ASPECT_RATIO_MODE_FREE && - num != GST_MATROSKA_ASPECT_RATIO_MODE_KEEP && - num != GST_MATROSKA_ASPECT_RATIO_MODE_FIXED) { - GST_WARNING ("Unknown aspect ratio mode 0x%x - ignoring", - (guint) num); - break; - } - videocontext->asr_mode = num; - break; - } - - /* colourspace (only matters for raw video) fourcc */ - case GST_MATROSKA_ID_VIDEOCOLOURSPACE:{ - guint64 num; - - if (!gst_ebml_read_uint (ebml, &id, &num)) { - res = FALSE; - break; - } - videocontext->fourcc = num; - break; - } - - default: - GST_WARNING ("Unknown video track header entry 0x%x - ignoring", - id); - /* pass-through */ - - case GST_EBML_ID_VOID: - if (!gst_ebml_read_skip (ebml)) - res = FALSE; - break; - } - - if (demux->level_up) { - demux->level_up--; - break; - } - } - break; + GstMatroskaTrackVideoContext *videocontext; + + if (context->type != GST_MATROSKA_TRACK_TYPE_VIDEO) { + GST_WARNING + ("trackvideo EBML entry in non-video track - ignoring track"); + res = FALSE; + break; + } else if (!gst_ebml_read_master (ebml, &id)) { + res = FALSE; + break; + } + videocontext = (GstMatroskaTrackVideoContext *) context; + + while (res) { + if (!(id = gst_ebml_peek_id (ebml, &demux->level_up))) { + res = FALSE; + break; + } else if (demux->level_up > 0) { + demux->level_up--; + break; + } + + switch (id) { + /* fixme, this should be one-up, but I get it here (?) */ + case GST_MATROSKA_ID_TRACKDEFAULTDURATION:{ + guint64 num; + + if (!gst_ebml_read_uint (ebml, &id, &num)) { + res = FALSE; + break; + } + context->default_duration = num; + break; + } + + /* video framerate */ + case GST_MATROSKA_ID_VIDEOFRAMERATE:{ + gdouble num; + + if (!gst_ebml_read_float (ebml, &id, &num)) { + res = FALSE; + break; + } + context->default_duration = GST_SECOND * (1. / num); + break; + } + + /* width of the size to display the video at */ + case GST_MATROSKA_ID_VIDEODISPLAYWIDTH:{ + guint64 num; + + if (!gst_ebml_read_uint (ebml, &id, &num)) { + res = FALSE; + break; + } + videocontext->display_width = num; + break; + } + + /* height of the size to display the video at */ + case GST_MATROSKA_ID_VIDEODISPLAYHEIGHT:{ + guint64 num; + + if (!gst_ebml_read_uint (ebml, &id, &num)) { + res = FALSE; + break; + } + videocontext->display_height = num; + break; + } + + /* width of the video in the file */ + case GST_MATROSKA_ID_VIDEOPIXELWIDTH:{ + guint64 num; + + if (!gst_ebml_read_uint (ebml, &id, &num)) { + res = FALSE; + break; + } + videocontext->pixel_width = num; + break; + } + + /* height of the video in the file */ + case GST_MATROSKA_ID_VIDEOPIXELHEIGHT:{ + guint64 num; + + if (!gst_ebml_read_uint (ebml, &id, &num)) { + res = FALSE; + break; + } + videocontext->pixel_height = num; + break; + } + + /* whether the video is interlaced */ + case GST_MATROSKA_ID_VIDEOFLAGINTERLACED:{ + guint64 num; + + if (!gst_ebml_read_uint (ebml, &id, &num)) { + res = FALSE; + break; + } + if (num) + context->flags |= GST_MATROSKA_VIDEOTRACK_INTERLACED; + else + context->flags &= ~GST_MATROSKA_VIDEOTRACK_INTERLACED; + break; + } + + /* stereo mode (whether the video has two streams, where + * one is for the left eye and the other for the right eye, + * which creates a 3D-like effect) */ + case GST_MATROSKA_ID_VIDEOSTEREOMODE:{ + guint64 num; + + if (!gst_ebml_read_uint (ebml, &id, &num)) { + res = FALSE; + break; + } + if (num != GST_MATROSKA_EYE_MODE_MONO && + num != GST_MATROSKA_EYE_MODE_LEFT && + num != GST_MATROSKA_EYE_MODE_RIGHT && + num != GST_MATROSKA_EYE_MODE_BOTH) { + GST_WARNING ("Unknown eye mode 0x%x - ignoring", (guint) num); + break; + } + videocontext->eye_mode = num; + break; + } + + /* aspect ratio behaviour */ + case GST_MATROSKA_ID_VIDEOASPECTRATIO:{ + guint64 num; + + if (!gst_ebml_read_uint (ebml, &id, &num)) { + res = FALSE; + break; + } + if (num != GST_MATROSKA_ASPECT_RATIO_MODE_FREE && + num != GST_MATROSKA_ASPECT_RATIO_MODE_KEEP && + num != GST_MATROSKA_ASPECT_RATIO_MODE_FIXED) { + GST_WARNING ("Unknown aspect ratio mode 0x%x - ignoring", + (guint) num); + break; + } + videocontext->asr_mode = num; + break; + } + + /* colourspace (only matters for raw video) fourcc */ + case GST_MATROSKA_ID_VIDEOCOLOURSPACE:{ + guint64 num; + + if (!gst_ebml_read_uint (ebml, &id, &num)) { + res = FALSE; + break; + } + videocontext->fourcc = num; + break; + } + + default: + GST_WARNING ("Unknown video track header entry 0x%x - ignoring", + id); + /* pass-through */ + + case GST_EBML_ID_VOID: + if (!gst_ebml_read_skip (ebml)) + res = FALSE; + break; + } + + if (demux->level_up) { + demux->level_up--; + break; + } + } + break; } - /* tracktype specific stuff for audio */ + /* tracktype specific stuff for audio */ case GST_MATROSKA_ID_TRACKAUDIO:{ - GstMatroskaTrackAudioContext *audiocontext; - - if (context->type != GST_MATROSKA_TRACK_TYPE_AUDIO) { - GST_WARNING - ("trackaudio EBML entry in non-audio track - ignoring track"); - res = FALSE; - break; - } else if (!gst_ebml_read_master (ebml, &id)) { - res = FALSE; - break; - } - audiocontext = (GstMatroskaTrackAudioContext *) context; - - while (res) { - if (!(id = gst_ebml_peek_id (ebml, &demux->level_up))) { - res = FALSE; - break; - } else if (demux->level_up > 0) { - demux->level_up--; - break; - } - - switch (id) { - /* samplerate */ - case GST_MATROSKA_ID_AUDIOSAMPLINGFREQ:{ - gdouble num; - - if (!gst_ebml_read_float (ebml, &id, &num)) { - res = FALSE; - break; - } - audiocontext->samplerate = num; - break; - } - - /* bitdepth */ - case GST_MATROSKA_ID_AUDIOBITDEPTH:{ - guint64 num; - - if (!gst_ebml_read_uint (ebml, &id, &num)) { - res = FALSE; - break; - } - audiocontext->bitdepth = num; - break; - } - - /* channels */ - case GST_MATROSKA_ID_AUDIOCHANNELS:{ - guint64 num; - - if (!gst_ebml_read_uint (ebml, &id, &num)) { - res = FALSE; - break; - } - audiocontext->channels = num; - break; - } - - default: - GST_WARNING ("Unknown audio track header entry 0x%x - ignoring", - id); - /* pass-through */ - - case GST_EBML_ID_VOID: - if (!gst_ebml_read_skip (ebml)) - res = FALSE; - break; - } - - if (demux->level_up) { - demux->level_up--; - break; - } - } - break; + GstMatroskaTrackAudioContext *audiocontext; + + if (context->type != GST_MATROSKA_TRACK_TYPE_AUDIO) { + GST_WARNING + ("trackaudio EBML entry in non-audio track - ignoring track"); + res = FALSE; + break; + } else if (!gst_ebml_read_master (ebml, &id)) { + res = FALSE; + break; + } + audiocontext = (GstMatroskaTrackAudioContext *) context; + + while (res) { + if (!(id = gst_ebml_peek_id (ebml, &demux->level_up))) { + res = FALSE; + break; + } else if (demux->level_up > 0) { + demux->level_up--; + break; + } + + switch (id) { + /* samplerate */ + case GST_MATROSKA_ID_AUDIOSAMPLINGFREQ:{ + gdouble num; + + if (!gst_ebml_read_float (ebml, &id, &num)) { + res = FALSE; + break; + } + audiocontext->samplerate = num; + break; + } + + /* bitdepth */ + case GST_MATROSKA_ID_AUDIOBITDEPTH:{ + guint64 num; + + if (!gst_ebml_read_uint (ebml, &id, &num)) { + res = FALSE; + break; + } + audiocontext->bitdepth = num; + break; + } + + /* channels */ + case GST_MATROSKA_ID_AUDIOCHANNELS:{ + guint64 num; + + if (!gst_ebml_read_uint (ebml, &id, &num)) { + res = FALSE; + break; + } + audiocontext->channels = num; + break; + } + + default: + GST_WARNING ("Unknown audio track header entry 0x%x - ignoring", + id); + /* pass-through */ + + case GST_EBML_ID_VOID: + if (!gst_ebml_read_skip (ebml)) + res = FALSE; + break; + } + + if (demux->level_up) { + demux->level_up--; + break; + } + } + break; } - /* codec identifier */ + /* codec identifier */ case GST_MATROSKA_ID_CODECID:{ - gchar *text; - - if (!gst_ebml_read_ascii (ebml, &id, &text)) { - res = FALSE; - break; - } - context->codec_id = text; - break; + gchar *text; + + if (!gst_ebml_read_ascii (ebml, &id, &text)) { + res = FALSE; + break; + } + context->codec_id = text; + break; } - /* codec private data */ + /* codec private data */ case GST_MATROSKA_ID_CODECPRIVATE:{ - guint8 *data; - guint64 size; - - if (!gst_ebml_read_binary (ebml, &id, &data, &size)) { - res = FALSE; - break; - } - context->codec_priv = data; - context->codec_priv_size = size; - break; + guint8 *data; + guint64 size; + + if (!gst_ebml_read_binary (ebml, &id, &data, &size)) { + res = FALSE; + break; + } + context->codec_priv = data; + context->codec_priv_size = size; + break; } - /* name of the codec */ + /* name of the codec */ case GST_MATROSKA_ID_CODECNAME:{ - gchar *text; - - if (!gst_ebml_read_utf8 (ebml, &id, &text)) { - res = FALSE; - break; - } - context->codec_name = text; - break; + gchar *text; + + if (!gst_ebml_read_utf8 (ebml, &id, &text)) { + res = FALSE; + break; + } + context->codec_name = text; + break; } - /* name of this track */ + /* name of this track */ case GST_MATROSKA_ID_TRACKNAME:{ - gchar *text; - - if (!gst_ebml_read_utf8 (ebml, &id, &text)) { - res = FALSE; - break; - } - context->name = text; - break; + gchar *text; + + if (!gst_ebml_read_utf8 (ebml, &id, &text)) { + res = FALSE; + break; + } + context->name = text; + break; } - /* language (matters for audio/subtitles, mostly) */ + /* language (matters for audio/subtitles, mostly) */ case GST_MATROSKA_ID_TRACKLANGUAGE:{ - gchar *text; - - if (!gst_ebml_read_utf8 (ebml, &id, &text)) { - res = FALSE; - break; - } - context->language = text; - break; + gchar *text; + + if (!gst_ebml_read_utf8 (ebml, &id, &text)) { + res = FALSE; + break; + } + context->language = text; + break; } - /* whether this is actually used */ + /* whether this is actually used */ case GST_MATROSKA_ID_TRACKFLAGENABLED:{ - guint64 num; - - if (!gst_ebml_read_uint (ebml, &id, &num)) { - res = FALSE; - break; - } - if (num) - context->flags |= GST_MATROSKA_TRACK_ENABLED; - else - context->flags &= ~GST_MATROSKA_TRACK_ENABLED; - break; + guint64 num; + + if (!gst_ebml_read_uint (ebml, &id, &num)) { + res = FALSE; + break; + } + if (num) + context->flags |= GST_MATROSKA_TRACK_ENABLED; + else + context->flags &= ~GST_MATROSKA_TRACK_ENABLED; + break; } - /* whether it's the default for this track type */ + /* whether it's the default for this track type */ case GST_MATROSKA_ID_TRACKFLAGDEFAULT:{ - guint64 num; - - if (!gst_ebml_read_uint (ebml, &id, &num)) { - res = FALSE; - break; - } - if (num) - context->flags |= GST_MATROSKA_TRACK_DEFAULT; - else - context->flags &= ~GST_MATROSKA_TRACK_DEFAULT; - break; + guint64 num; + + if (!gst_ebml_read_uint (ebml, &id, &num)) { + res = FALSE; + break; + } + if (num) + context->flags |= GST_MATROSKA_TRACK_DEFAULT; + else + context->flags &= ~GST_MATROSKA_TRACK_DEFAULT; + break; } - /* lacing (like MPEG, where blocks don't end/start on frame - * boundaries) */ + /* lacing (like MPEG, where blocks don't end/start on frame + * boundaries) */ case GST_MATROSKA_ID_TRACKFLAGLACING:{ - guint64 num; - - if (!gst_ebml_read_uint (ebml, &id, &num)) { - res = FALSE; - break; - } - if (num) - context->flags |= GST_MATROSKA_TRACK_LACING; - else - context->flags &= ~GST_MATROSKA_TRACK_LACING; - break; + guint64 num; + + if (!gst_ebml_read_uint (ebml, &id, &num)) { + res = FALSE; + break; + } + if (num) + context->flags |= GST_MATROSKA_TRACK_LACING; + else + context->flags &= ~GST_MATROSKA_TRACK_LACING; + break; } - /* default length (in time) of one data block in this track */ + /* default length (in time) of one data block in this track */ case GST_MATROSKA_ID_TRACKDEFAULTDURATION:{ - guint64 num; - - if (!gst_ebml_read_uint (ebml, &id, &num)) { - res = FALSE; - break; - } - context->default_duration = num; - break; + guint64 num; + + if (!gst_ebml_read_uint (ebml, &id, &num)) { + res = FALSE; + break; + } + context->default_duration = num; + break; } default: - GST_WARNING ("Unknown track header entry 0x%x - ignoring", id); - /* pass-through */ + GST_WARNING ("Unknown track header entry 0x%x - ignoring", id); + /* pass-through */ - /* we ignore these because they're nothing useful (i.e. crap). */ + /* we ignore these because they're nothing useful (i.e. crap). */ case GST_MATROSKA_ID_CODECINFOURL: case GST_MATROSKA_ID_CODECDOWNLOADURL: case GST_MATROSKA_ID_TRACKMINCACHE: case GST_MATROSKA_ID_TRACKMAXCACHE: case GST_EBML_ID_VOID: - if (!gst_ebml_read_skip (ebml)) - res = FALSE; - break; + if (!gst_ebml_read_skip (ebml)) + res = FALSE; + break; } if (demux->level_up) { @@ -841,43 +841,43 @@ gst_matroska_demux_add_stream (GstMatroskaDemux * demux) switch (context->type) { case GST_MATROSKA_TRACK_TYPE_VIDEO:{ GstMatroskaTrackVideoContext *videocontext = - (GstMatroskaTrackVideoContext *) context; + (GstMatroskaTrackVideoContext *) context; padname = g_strdup_printf ("video_%02d", demux->num_v_streams++); templ = gst_element_class_get_pad_template (klass, "video_%02d"); caps = gst_matroska_demux_video_caps (videocontext, - context->codec_id, - context->codec_priv, context->codec_priv_size, demux); + context->codec_id, + context->codec_priv, context->codec_priv_size, demux); break; } case GST_MATROSKA_TRACK_TYPE_AUDIO:{ GstMatroskaTrackAudioContext *audiocontext = - (GstMatroskaTrackAudioContext *) context; + (GstMatroskaTrackAudioContext *) context; padname = g_strdup_printf ("audio_%02d", demux->num_a_streams++); templ = gst_element_class_get_pad_template (klass, "audio_%02d"); caps = gst_matroska_demux_audio_caps (audiocontext, - context->codec_id, - context->codec_priv, context->codec_priv_size, demux); + context->codec_id, + context->codec_priv, context->codec_priv_size, demux); break; } case GST_MATROSKA_TRACK_TYPE_COMPLEX:{ GstMatroskaTrackComplexContext *complexcontext = - (GstMatroskaTrackComplexContext *) context; + (GstMatroskaTrackComplexContext *) context; padname = g_strdup_printf ("video_%02d", demux->num_v_streams++); templ = gst_element_class_get_pad_template (klass, "video_%02d"); caps = gst_matroska_demux_complex_caps (complexcontext, - context->codec_id, context->codec_priv, context->codec_priv_size); + context->codec_id, context->codec_priv, context->codec_priv_size); break; } case GST_MATROSKA_TRACK_TYPE_SUBTITLE:{ GstMatroskaTrackSubtitleContext *subtitlecontext = - (GstMatroskaTrackSubtitleContext *) context; + (GstMatroskaTrackSubtitleContext *) context; padname = g_strdup_printf ("subtitle_%02d", demux->num_t_streams++); templ = gst_element_class_get_pad_template (klass, "subtitle_%02d"); caps = gst_matroska_demux_subtitle_caps (subtitlecontext, - context->codec_id, context->codec_priv, context->codec_priv_size); + context->codec_id, context->codec_priv, context->codec_priv_size); break; } @@ -953,29 +953,29 @@ gst_matroska_demux_handle_src_query (GstPad * pad, switch (type) { case GST_QUERY_TOTAL: switch (*format) { - case GST_FORMAT_DEFAULT: - *format = GST_FORMAT_TIME; - /* fall through */ - case GST_FORMAT_TIME: - *value = demux->duration; - break; - default: - res = FALSE; - break; + case GST_FORMAT_DEFAULT: + *format = GST_FORMAT_TIME; + /* fall through */ + case GST_FORMAT_TIME: + *value = demux->duration; + break; + default: + res = FALSE; + break; } break; case GST_QUERY_POSITION: switch (*format) { - case GST_FORMAT_DEFAULT: - *format = GST_FORMAT_TIME; - /* fall through */ - case GST_FORMAT_TIME: - *value = demux->pos; - break; - default: - res = FALSE; - break; + case GST_FORMAT_DEFAULT: + *format = GST_FORMAT_TIME; + /* fall through */ + case GST_FORMAT_TIME: + *value = demux->pos; + break; + default: + res = FALSE; + break; } break; @@ -1002,10 +1002,10 @@ gst_matroskademux_seek (GstMatroskaDemux * demux) entry = n; } else { gfloat diff_old = fabs (1. * (demux->index[entry].time - offset)), - diff_new = fabs (1. * (demux->index[n].time - offset)); + diff_new = fabs (1. * (demux->index[n].time - offset)); if (diff_new < diff_old) { - entry = n; + entry = n; } } } @@ -1026,14 +1026,14 @@ gst_matroska_demux_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: - demux->seek_pending = GST_EVENT_SEEK_OFFSET (event); - break; - - default: - GST_WARNING ("Only time seek is supported"); - res = FALSE; - break; + case GST_FORMAT_TIME: + demux->seek_pending = GST_EVENT_SEEK_OFFSET (event); + break; + + default: + GST_WARNING ("Only time seek is supported"); + res = FALSE; + break; } break; @@ -1053,9 +1053,9 @@ gst_matroska_demux_get_event_mask (GstPad * pad) { static const GstEventMask masks[] = { {GST_EVENT_SEEK, (GstEventFlag) ((gint) GST_SEEK_METHOD_SET | - (gint) GST_SEEK_FLAG_KEY_UNIT)}, + (gint) GST_SEEK_FLAG_KEY_UNIT)}, {GST_EVENT_SEEK_SEGMENT, (GstEventFlag) ((gint) GST_SEEK_METHOD_SET | - (gint) GST_SEEK_FLAG_KEY_UNIT)}, + (gint) GST_SEEK_FLAG_KEY_UNIT)}, {(GstEventType) 0, (GstEventFlag) 0} }; @@ -1098,7 +1098,7 @@ gst_matroska_demux_handle_seek_event (GstMatroskaDemux * demux) /* seek (relative to segment) */ if (!(event = gst_ebml_read_seek (ebml, entry->pos + demux->segment_start))) return FALSE; - gst_event_unref (event); /* byte - we want time */ + gst_event_unref (event); /* byte - we want time */ event = gst_event_new_discontinuous (FALSE, GST_FORMAT_TIME, entry->time); /* forward to all src pads */ @@ -1127,15 +1127,15 @@ gst_matroska_demux_init_stream (GstMatroskaDemux * demux) if (!doctype || strcmp (doctype, "matroska") != 0) { GST_ELEMENT_ERROR (demux, STREAM, WRONG_TYPE, (NULL), - ("Input is not a matroska stream (doctype=%s)", - doctype ? doctype : "none")); + ("Input is not a matroska stream (doctype=%s)", + doctype ? doctype : "none")); g_free (doctype); return FALSE; } g_free (doctype); if (version > 1) { GST_ELEMENT_ERROR (demux, STREAM, DEMUX, (NULL), - ("Demuxer version (1) is too old to read stream version %d", version)); + ("Demuxer version (1) is too old to read stream version %d", version)); return FALSE; } @@ -1151,7 +1151,7 @@ gst_matroska_demux_init_stream (GstMatroskaDemux * demux) /* oi! */ GST_WARNING ("Expected a Segment ID (0x%x), but received 0x%x!", - GST_MATROSKA_ID_SEGMENT, id); + GST_MATROSKA_ID_SEGMENT, id); if (!gst_ebml_read_skip (ebml)) return FALSE; } @@ -1183,20 +1183,20 @@ gst_matroska_demux_parse_tracks (GstMatroskaDemux * demux) } switch (id) { - /* one track within the "all-tracks" header */ + /* one track within the "all-tracks" header */ case GST_MATROSKA_ID_TRACKENTRY: - if (!gst_matroska_demux_add_stream (demux)) - res = FALSE; - break; + if (!gst_matroska_demux_add_stream (demux)) + res = FALSE; + break; default: - GST_WARNING ("Unknown entry 0x%x in track header", id); - /* fall-through */ + GST_WARNING ("Unknown entry 0x%x in track header", id); + /* fall-through */ case GST_EBML_ID_VOID: - if (!gst_ebml_read_skip (ebml)) - res = FALSE; - break; + if (!gst_ebml_read_skip (ebml)) + res = FALSE; + break; } if (demux->level_up) { @@ -1237,147 +1237,147 @@ gst_matroska_demux_parse_index (GstMatroskaDemux * demux, gboolean prevent_eos) } switch (id) { - /* one single index entry ('point') */ + /* one single index entry ('point') */ case GST_MATROSKA_ID_POINTENTRY: - if (!gst_ebml_read_master (ebml, &id)) { - res = FALSE; - break; - } - - /* in the end, we hope to fill one entry with a - * timestamp, a file position and a tracknum */ - idx.pos = (guint64) - 1; - idx.time = (guint64) - 1; - idx.track = (guint16) - 1; - - while (res) { - if (prevent_eos && length == gst_bytestream_tell (ebml->bs)) { - res = FALSE; - break; - } else if (!(id = gst_ebml_peek_id (ebml, &demux->level_up))) { - res = FALSE; - break; - } else if (demux->level_up) { - demux->level_up--; - break; - } - - switch (id) { - /* one single index entry ('point') */ - case GST_MATROSKA_ID_CUETIME:{ - gint64 time; - - if (!gst_ebml_read_uint (ebml, &id, &time)) { - res = FALSE; - break; - } - idx.time = time * demux->time_scale; - break; - } - - /* position in the file + track to which it belongs */ - case GST_MATROSKA_ID_CUETRACKPOSITION: - if (!gst_ebml_read_master (ebml, &id)) { - res = FALSE; - break; - } - - while (res) { - if (prevent_eos && length == gst_bytestream_tell (ebml->bs)) { - res = FALSE; - break; - } else if (!(id = gst_ebml_peek_id (ebml, &demux->level_up))) { - res = FALSE; - break; - } else if (demux->level_up) { - demux->level_up--; - break; - } - - switch (id) { - /* track number */ - case GST_MATROSKA_ID_CUETRACK:{ - guint64 num; - - if (!gst_ebml_read_uint (ebml, &id, &num)) { - res = FALSE; - break; - } - idx.track = num; - break; - } - - /* position in file */ - case GST_MATROSKA_ID_CUECLUSTERPOSITION:{ - guint64 num; - - if (!gst_ebml_read_uint (ebml, &id, &num)) { - res = FALSE; - break; - } - idx.pos = num; - break; - } - - default: - GST_WARNING ("Unknown entry 0x%x in CuesTrackPositions", - id); - /* fall-through */ - - case GST_EBML_ID_VOID: - if (!gst_ebml_read_skip (ebml)) - res = FALSE; - break; - } - - if (demux->level_up) { - demux->level_up--; - break; - } - } - - break; - - default: - GST_WARNING ("Unknown entry 0x%x in cuespoint index", id); - /* fall-through */ - - case GST_EBML_ID_VOID: - if (!gst_ebml_read_skip (ebml)) - res = FALSE; - break; - } - - if (demux->level_up) { - demux->level_up--; - break; - } - } - - /* so let's see if we got what we wanted */ - if (idx.pos != (guint64) - 1 && - idx.time != (guint64) - 1 && idx.track != (guint16) - 1) { - if (demux->num_indexes % 32 == 0) { - /* re-allocate bigger index */ - demux->index = g_renew (GstMatroskaIndex, demux->index, - demux->num_indexes + 32); - } - demux->index[demux->num_indexes].pos = idx.pos; - demux->index[demux->num_indexes].time = idx.time; - demux->index[demux->num_indexes].track = idx.track; - demux->num_indexes++; - } - - break; + if (!gst_ebml_read_master (ebml, &id)) { + res = FALSE; + break; + } + + /* in the end, we hope to fill one entry with a + * timestamp, a file position and a tracknum */ + idx.pos = (guint64) - 1; + idx.time = (guint64) - 1; + idx.track = (guint16) - 1; + + while (res) { + if (prevent_eos && length == gst_bytestream_tell (ebml->bs)) { + res = FALSE; + break; + } else if (!(id = gst_ebml_peek_id (ebml, &demux->level_up))) { + res = FALSE; + break; + } else if (demux->level_up) { + demux->level_up--; + break; + } + + switch (id) { + /* one single index entry ('point') */ + case GST_MATROSKA_ID_CUETIME:{ + gint64 time; + + if (!gst_ebml_read_uint (ebml, &id, &time)) { + res = FALSE; + break; + } + idx.time = time * demux->time_scale; + break; + } + + /* position in the file + track to which it belongs */ + case GST_MATROSKA_ID_CUETRACKPOSITION: + if (!gst_ebml_read_master (ebml, &id)) { + res = FALSE; + break; + } + + while (res) { + if (prevent_eos && length == gst_bytestream_tell (ebml->bs)) { + res = FALSE; + break; + } else if (!(id = gst_ebml_peek_id (ebml, &demux->level_up))) { + res = FALSE; + break; + } else if (demux->level_up) { + demux->level_up--; + break; + } + + switch (id) { + /* track number */ + case GST_MATROSKA_ID_CUETRACK:{ + guint64 num; + + if (!gst_ebml_read_uint (ebml, &id, &num)) { + res = FALSE; + break; + } + idx.track = num; + break; + } + + /* position in file */ + case GST_MATROSKA_ID_CUECLUSTERPOSITION:{ + guint64 num; + + if (!gst_ebml_read_uint (ebml, &id, &num)) { + res = FALSE; + break; + } + idx.pos = num; + break; + } + + default: + GST_WARNING ("Unknown entry 0x%x in CuesTrackPositions", + id); + /* fall-through */ + + case GST_EBML_ID_VOID: + if (!gst_ebml_read_skip (ebml)) + res = FALSE; + break; + } + + if (demux->level_up) { + demux->level_up--; + break; + } + } + + break; + + default: + GST_WARNING ("Unknown entry 0x%x in cuespoint index", id); + /* fall-through */ + + case GST_EBML_ID_VOID: + if (!gst_ebml_read_skip (ebml)) + res = FALSE; + break; + } + + if (demux->level_up) { + demux->level_up--; + break; + } + } + + /* so let's see if we got what we wanted */ + if (idx.pos != (guint64) - 1 && + idx.time != (guint64) - 1 && idx.track != (guint16) - 1) { + if (demux->num_indexes % 32 == 0) { + /* re-allocate bigger index */ + demux->index = g_renew (GstMatroskaIndex, demux->index, + demux->num_indexes + 32); + } + demux->index[demux->num_indexes].pos = idx.pos; + demux->index[demux->num_indexes].time = idx.time; + demux->index[demux->num_indexes].track = idx.track; + demux->num_indexes++; + } + + break; default: - GST_WARNING ("Unknown entry 0x%x in cues header", id); - /* fall-through */ + GST_WARNING ("Unknown entry 0x%x in cues header", id); + /* fall-through */ case GST_EBML_ID_VOID: - if (!gst_ebml_read_skip (ebml)) - res = FALSE; - break; + if (!gst_ebml_read_skip (ebml)) + res = FALSE; + break; } if (demux->level_up) { @@ -1406,70 +1406,70 @@ gst_matroska_demux_parse_info (GstMatroskaDemux * demux) } switch (id) { - /* cluster timecode */ + /* cluster timecode */ case GST_MATROSKA_ID_TIMECODESCALE:{ - guint64 num; - - if (!gst_ebml_read_uint (ebml, &id, &num)) { - res = FALSE; - break; - } - demux->time_scale = num; - break; + guint64 num; + + if (!gst_ebml_read_uint (ebml, &id, &num)) { + res = FALSE; + break; + } + demux->time_scale = num; + break; } case GST_MATROSKA_ID_DURATION:{ - gdouble num; - - if (!gst_ebml_read_float (ebml, &id, &num)) { - res = FALSE; - break; - } - demux->duration = num * demux->time_scale; - break; + gdouble num; + + if (!gst_ebml_read_float (ebml, &id, &num)) { + res = FALSE; + break; + } + demux->duration = num * demux->time_scale; + break; } case GST_MATROSKA_ID_WRITINGAPP:{ - gchar *text; - - if (!gst_ebml_read_utf8 (ebml, &id, &text)) { - res = FALSE; - break; - } - demux->writing_app = text; - break; + gchar *text; + + if (!gst_ebml_read_utf8 (ebml, &id, &text)) { + res = FALSE; + break; + } + demux->writing_app = text; + break; } case GST_MATROSKA_ID_MUXINGAPP:{ - gchar *text; - - if (!gst_ebml_read_utf8 (ebml, &id, &text)) { - res = FALSE; - break; - } - demux->muxing_app = text; - break; + gchar *text; + + if (!gst_ebml_read_utf8 (ebml, &id, &text)) { + res = FALSE; + break; + } + demux->muxing_app = text; + break; } case GST_MATROSKA_ID_DATEUTC:{ - gint64 time; - - if (!gst_ebml_read_date (ebml, &id, &time)) { - res = FALSE; - break; - } - demux->created = time; - break; + gint64 time; + + if (!gst_ebml_read_date (ebml, &id, &time)) { + res = FALSE; + break; + } + demux->created = time; + break; } default: - GST_WARNING ("Unknown entry 0x%x in info header", id); - /* fall-through */ + GST_WARNING ("Unknown entry 0x%x in info header", id); + /* fall-through */ case GST_EBML_ID_VOID: - if (!gst_ebml_read_skip (ebml)) - res = FALSE; - break; + if (!gst_ebml_read_skip (ebml)) + res = FALSE; + break; } if (demux->level_up) { @@ -1511,13 +1511,13 @@ gst_matroska_demux_parse_metadata (GstMatroskaDemux * demux, switch (id) { default: - GST_WARNING ("metadata unimplemented"); - /* fall-through */ + GST_WARNING ("metadata unimplemented"); + /* fall-through */ case GST_EBML_ID_VOID: - if (!gst_ebml_read_skip (ebml)) - res = FALSE; - break; + if (!gst_ebml_read_skip (ebml)) + res = FALSE; + break; } if (demux->level_up) { @@ -1611,178 +1611,178 @@ gst_matroska_demux_parse_blockgroup (GstMatroskaDemux * demux, } switch (id) { - /* one block inside the group. Note, block parsing is one - * of the harder things, so this code is a bit complicated. - * See http://www.matroska.org/ for documentation. */ + /* one block inside the group. Note, block parsing is one + * of the harder things, so this code is a bit complicated. + * See http://www.matroska.org/ for documentation. */ case GST_MATROSKA_ID_BLOCK:{ - GstBuffer *buf; - guint8 *data; - gint64 time; - guint size, *lace_size = NULL; - gint n, stream, flags, laces = 0; - guint64 num; - - if (!gst_ebml_read_buffer (ebml, &id, &buf)) { - res = FALSE; - break; - } - data = GST_BUFFER_DATA (buf); - size = GST_BUFFER_SIZE (buf); - - /* first byte(s): blocknum */ - if ((n = gst_matroska_ebmlnum_uint (data, size, &num)) < 0) { - GST_ELEMENT_ERROR (demux, STREAM, DEMUX, (NULL), ("Data error")); - gst_buffer_unref (buf); - res = FALSE; - break; - } - data += n; - size -= n; - - /* fetch stream from num */ - stream = gst_matroska_demux_stream_from_num (demux, num); - if (size <= 3 || stream < 0 || stream >= demux->num_streams) { - gst_buffer_unref (buf); - GST_WARNING ("Invalid stream %d or size %u", stream, size); - break; - } - if (!GST_PAD_IS_USABLE (demux->src[stream]->pad)) { - gst_buffer_unref (buf); - break; - } - - /* time (relative to cluster time) */ - time = (GINT16_FROM_BE (*(gint16 *) data)) * demux->time_scale; - data += 2; - size -= 2; - flags = *(guint8 *) data; - data += 1; - size -= 1; - switch ((flags & 0x06) >> 1) { - case 0x0: /* no lacing */ - laces = 1; - lace_size = g_new (gint, 1); - lace_size[0] = size; - break; - - case 0x1: /* xiph lacing */ - case 0x2: /* fixed-size lacing */ - case 0x3: /* EBML lacing */ - if (size == 0) { - res = FALSE; - break; - } - laces = (*(guint8 *) data) + 1; - data += 1; - size -= 1; - lace_size = g_new0 (gint, laces); - - switch ((flags & 0x06) >> 1) { - case 0x1: /* xiph lacing */ { - guint temp, total = 0; - - for (n = 0; res && n < laces - 1; n++) { - while (1) { - if (size == 0) { - res = FALSE; - break; - } - temp = *(guint8 *) data; - lace_size[n] += temp; - data += 1; - size -= 1; - if (temp != 0xff) - break; - } - total += lace_size[n]; - } - lace_size[n] = size - total; - break; - } - - case 0x2: /* fixed-size lacing */ - for (n = 0; n < laces; n++) - lace_size[n] = size / laces; - break; - - case 0x3: /* EBML lacing */ { - guint total; - - if ((n = gst_matroska_ebmlnum_uint (data, size, &num)) < 0) { - GST_ELEMENT_ERROR (demux, STREAM, DEMUX, (NULL), - ("Data error")); - res = FALSE; - break; - } - data += n; - size -= n; - total = lace_size[0] = num; - for (n = 1; res && n < laces - 1; n++) { - gint64 snum; - gint r; - - if ((r = gst_matroska_ebmlnum_sint (data, size, &snum)) < 0) { - GST_ELEMENT_ERROR (demux, STREAM, DEMUX, (NULL), - ("Data error")); - res = FALSE; - break; - } - data += r; - size -= r; - lace_size[n] = lace_size[n - 1] + snum; - total += lace_size[n]; - } - lace_size[n] = size - total; - break; - } - } - break; - } - - if (res) { - for (n = 0; n < laces; n++) { - GstBuffer *sub = gst_buffer_create_sub (buf, - GST_BUFFER_SIZE (buf) - size, - lace_size[n]); - - if (cluster_time != GST_CLOCK_TIME_NONE) { - if (time < 0 && (-time) > cluster_time) - GST_BUFFER_TIMESTAMP (sub) = cluster_time; - else - GST_BUFFER_TIMESTAMP (sub) = cluster_time + time; - } - /* FIXME: duration */ - - gst_pad_push (demux->src[stream]->pad, GST_DATA (sub)); - - size -= lace_size[n]; - } - } - - g_free (lace_size); - gst_buffer_unref (buf); - break; + GstBuffer *buf; + guint8 *data; + gint64 time; + guint size, *lace_size = NULL; + gint n, stream, flags, laces = 0; + guint64 num; + + if (!gst_ebml_read_buffer (ebml, &id, &buf)) { + res = FALSE; + break; + } + data = GST_BUFFER_DATA (buf); + size = GST_BUFFER_SIZE (buf); + + /* first byte(s): blocknum */ + if ((n = gst_matroska_ebmlnum_uint (data, size, &num)) < 0) { + GST_ELEMENT_ERROR (demux, STREAM, DEMUX, (NULL), ("Data error")); + gst_buffer_unref (buf); + res = FALSE; + break; + } + data += n; + size -= n; + + /* fetch stream from num */ + stream = gst_matroska_demux_stream_from_num (demux, num); + if (size <= 3 || stream < 0 || stream >= demux->num_streams) { + gst_buffer_unref (buf); + GST_WARNING ("Invalid stream %d or size %u", stream, size); + break; + } + if (!GST_PAD_IS_USABLE (demux->src[stream]->pad)) { + gst_buffer_unref (buf); + break; + } + + /* time (relative to cluster time) */ + time = (GINT16_FROM_BE (*(gint16 *) data)) * demux->time_scale; + data += 2; + size -= 2; + flags = *(guint8 *) data; + data += 1; + size -= 1; + switch ((flags & 0x06) >> 1) { + case 0x0: /* no lacing */ + laces = 1; + lace_size = g_new (gint, 1); + lace_size[0] = size; + break; + + case 0x1: /* xiph lacing */ + case 0x2: /* fixed-size lacing */ + case 0x3: /* EBML lacing */ + if (size == 0) { + res = FALSE; + break; + } + laces = (*(guint8 *) data) + 1; + data += 1; + size -= 1; + lace_size = g_new0 (gint, laces); + + switch ((flags & 0x06) >> 1) { + case 0x1: /* xiph lacing */ { + guint temp, total = 0; + + for (n = 0; res && n < laces - 1; n++) { + while (1) { + if (size == 0) { + res = FALSE; + break; + } + temp = *(guint8 *) data; + lace_size[n] += temp; + data += 1; + size -= 1; + if (temp != 0xff) + break; + } + total += lace_size[n]; + } + lace_size[n] = size - total; + break; + } + + case 0x2: /* fixed-size lacing */ + for (n = 0; n < laces; n++) + lace_size[n] = size / laces; + break; + + case 0x3: /* EBML lacing */ { + guint total; + + if ((n = gst_matroska_ebmlnum_uint (data, size, &num)) < 0) { + GST_ELEMENT_ERROR (demux, STREAM, DEMUX, (NULL), + ("Data error")); + res = FALSE; + break; + } + data += n; + size -= n; + total = lace_size[0] = num; + for (n = 1; res && n < laces - 1; n++) { + gint64 snum; + gint r; + + if ((r = gst_matroska_ebmlnum_sint (data, size, &snum)) < 0) { + GST_ELEMENT_ERROR (demux, STREAM, DEMUX, (NULL), + ("Data error")); + res = FALSE; + break; + } + data += r; + size -= r; + lace_size[n] = lace_size[n - 1] + snum; + total += lace_size[n]; + } + lace_size[n] = size - total; + break; + } + } + break; + } + + if (res) { + for (n = 0; n < laces; n++) { + GstBuffer *sub = gst_buffer_create_sub (buf, + GST_BUFFER_SIZE (buf) - size, + lace_size[n]); + + if (cluster_time != GST_CLOCK_TIME_NONE) { + if (time < 0 && (-time) > cluster_time) + GST_BUFFER_TIMESTAMP (sub) = cluster_time; + else + GST_BUFFER_TIMESTAMP (sub) = cluster_time + time; + } + /* FIXME: duration */ + + gst_pad_push (demux->src[stream]->pad, GST_DATA (sub)); + + size -= lace_size[n]; + } + } + + g_free (lace_size); + gst_buffer_unref (buf); + break; } case GST_MATROSKA_ID_BLOCKDURATION:{ - guint64 num; - - if (!gst_ebml_read_uint (ebml, &id, &num)) { - res = FALSE; - break; - } - GST_WARNING ("FIXME: implement support for BlockDuration"); - break; + guint64 num; + + if (!gst_ebml_read_uint (ebml, &id, &num)) { + res = FALSE; + break; + } + GST_WARNING ("FIXME: implement support for BlockDuration"); + break; } default: - GST_WARNING ("Unknown entry 0x%x in blockgroup data", id); - /* fall-through */ + GST_WARNING ("Unknown entry 0x%x in blockgroup data", id); + /* fall-through */ case GST_EBML_ID_VOID: - if (!gst_ebml_read_skip (ebml)) - res = FALSE; - break; + if (!gst_ebml_read_skip (ebml)) + res = FALSE; + break; } if (demux->level_up) { @@ -1820,35 +1820,35 @@ gst_matroska_demux_parse_cluster (GstMatroskaDemux * demux) } switch (id) { - /* cluster timecode */ + /* cluster timecode */ case GST_MATROSKA_ID_CLUSTERTIMECODE:{ - guint64 num; - - if (!gst_ebml_read_uint (ebml, &id, &num)) { - res = FALSE; - break; - } - cluster_time = num * demux->time_scale; - break; + guint64 num; + + if (!gst_ebml_read_uint (ebml, &id, &num)) { + res = FALSE; + break; + } + cluster_time = num * demux->time_scale; + break; } - /* a group of blocks inside a cluster */ + /* a group of blocks inside a cluster */ case GST_MATROSKA_ID_BLOCKGROUP: - if (!gst_ebml_read_master (ebml, &id)) { - res = FALSE; - break; - } - res = gst_matroska_demux_parse_blockgroup (demux, cluster_time); - break; + if (!gst_ebml_read_master (ebml, &id)) { + res = FALSE; + break; + } + res = gst_matroska_demux_parse_blockgroup (demux, cluster_time); + break; default: - GST_WARNING ("Unknown entry 0x%x in cluster data", id); - /* fall-through */ + GST_WARNING ("Unknown entry 0x%x in cluster data", id); + /* fall-through */ case GST_EBML_ID_VOID: - if (!gst_ebml_read_skip (ebml)) - res = FALSE; - break; + if (!gst_ebml_read_skip (ebml)) + res = FALSE; + break; } if (demux->level_up) { @@ -1878,162 +1878,162 @@ gst_matroska_demux_parse_contents (GstMatroskaDemux * demux) switch (id) { case GST_MATROSKA_ID_SEEKENTRY:{ - guint32 seek_id = 0; - guint64 seek_pos = (guint64) - 1, t; - - if (!gst_ebml_read_master (ebml, &id)) { - res = FALSE; - break; - } - - while (res) { - if (!(id = gst_ebml_peek_id (ebml, &demux->level_up))) { - res = FALSE; - break; - } else if (demux->level_up) { - demux->level_up--; - break; - } - - switch (id) { - case GST_MATROSKA_ID_SEEKID: - if (!gst_ebml_read_uint (ebml, &id, &t)) - res = FALSE; - seek_id = t; - break; - - case GST_MATROSKA_ID_SEEKPOSITION: - if (!gst_ebml_read_uint (ebml, &id, &seek_pos)) - res = FALSE; - break; - - default: - GST_WARNING ("Unknown seekhead ID 0x%x", id); - /* fall-through */ - - case GST_EBML_ID_VOID: - if (!gst_ebml_read_skip (ebml)) - res = FALSE; - break; - } - - if (demux->level_up) { - demux->level_up--; - break; - } - } - - if (!seek_id || seek_pos == (guint64) - 1) { - GST_WARNING ("Incomplete seekhead entry (0x%x/%" - G_GUINT64_FORMAT ")", seek_id, seek_pos); - break; - } - - switch (seek_id) { - case GST_MATROSKA_ID_CUES: - case GST_MATROSKA_ID_TAGS:{ - guint level_up = demux->level_up; - guint64 before_pos, length; - GstEbmlLevel *level; - GstEvent *event; - - /* remember */ - length = gst_bytestream_length (ebml->bs); - before_pos = gst_bytestream_tell (ebml->bs); - - /* check for validity */ - if (seek_pos + demux->segment_start + 12 >= length) { - g_warning ("Seekhead reference lies outside file!"); - break; - } - - /* seek */ - if (!(event = gst_ebml_read_seek (ebml, - seek_pos + demux->segment_start))) - return FALSE; - gst_event_unref (event); - - /* we don't want to lose our seekhead level, so we add - * a dummy. This is a crude hack. */ - level = g_new (GstEbmlLevel, 1); - level->start = 0; - level->length = G_MAXUINT64; - ebml->level = g_list_append (ebml->level, level); - - /* check ID */ - if (!(id = gst_ebml_peek_id (ebml, &demux->level_up))) { - res = FALSE; - break; - } - if (id != seek_id) { - g_warning ("We looked for ID=0x%x but got ID=0x%x (pos=%llu)", - seek_id, id, seek_pos + demux->segment_start); - goto finish; - } - - /* read master + parse */ - switch (id) { - case GST_MATROSKA_ID_CUES: - if (!gst_ebml_read_master (ebml, &id)) - res = FALSE; - else if (!gst_matroska_demux_parse_index (demux, TRUE) && - gst_bytestream_length (ebml->bs) != - gst_bytestream_tell (ebml->bs)) - res = FALSE; - else - demux->index_parsed = TRUE; - break; - case GST_MATROSKA_ID_TAGS: - if (!gst_ebml_read_master (ebml, &id)) - res = FALSE; - else if (!gst_matroska_demux_parse_metadata (demux, TRUE) && - gst_bytestream_length (ebml->bs) != - gst_bytestream_tell (ebml->bs)) - res = FALSE; - else - demux->metadata_parsed = TRUE; - break; - } - if (!res) - break; - - finish: - /* remove dummy level */ - while (ebml->level) { - guint64 length; - - level = g_list_last (ebml->level)->data; - ebml->level = g_list_remove (ebml->level, level); - length = level->length; - g_free (level); - if (length == G_MAXUINT64) - break; - } - - /* seek back */ - if (!(event = gst_ebml_read_seek (ebml, before_pos))) - return FALSE; - gst_event_unref (event); - demux->level_up = level_up; - break; - } - - default: - GST_INFO ("Ignoring seekhead entry for ID=0x%x", seek_id); - break; - } - - break; + guint32 seek_id = 0; + guint64 seek_pos = (guint64) - 1, t; + + if (!gst_ebml_read_master (ebml, &id)) { + res = FALSE; + break; + } + + while (res) { + if (!(id = gst_ebml_peek_id (ebml, &demux->level_up))) { + res = FALSE; + break; + } else if (demux->level_up) { + demux->level_up--; + break; + } + + switch (id) { + case GST_MATROSKA_ID_SEEKID: + if (!gst_ebml_read_uint (ebml, &id, &t)) + res = FALSE; + seek_id = t; + break; + + case GST_MATROSKA_ID_SEEKPOSITION: + if (!gst_ebml_read_uint (ebml, &id, &seek_pos)) + res = FALSE; + break; + + default: + GST_WARNING ("Unknown seekhead ID 0x%x", id); + /* fall-through */ + + case GST_EBML_ID_VOID: + if (!gst_ebml_read_skip (ebml)) + res = FALSE; + break; + } + + if (demux->level_up) { + demux->level_up--; + break; + } + } + + if (!seek_id || seek_pos == (guint64) - 1) { + GST_WARNING ("Incomplete seekhead entry (0x%x/%" + G_GUINT64_FORMAT ")", seek_id, seek_pos); + break; + } + + switch (seek_id) { + case GST_MATROSKA_ID_CUES: + case GST_MATROSKA_ID_TAGS:{ + guint level_up = demux->level_up; + guint64 before_pos, length; + GstEbmlLevel *level; + GstEvent *event; + + /* remember */ + length = gst_bytestream_length (ebml->bs); + before_pos = gst_bytestream_tell (ebml->bs); + + /* check for validity */ + if (seek_pos + demux->segment_start + 12 >= length) { + g_warning ("Seekhead reference lies outside file!"); + break; + } + + /* seek */ + if (!(event = gst_ebml_read_seek (ebml, + seek_pos + demux->segment_start))) + return FALSE; + gst_event_unref (event); + + /* we don't want to lose our seekhead level, so we add + * a dummy. This is a crude hack. */ + level = g_new (GstEbmlLevel, 1); + level->start = 0; + level->length = G_MAXUINT64; + ebml->level = g_list_append (ebml->level, level); + + /* check ID */ + if (!(id = gst_ebml_peek_id (ebml, &demux->level_up))) { + res = FALSE; + break; + } + if (id != seek_id) { + g_warning ("We looked for ID=0x%x but got ID=0x%x (pos=%llu)", + seek_id, id, seek_pos + demux->segment_start); + goto finish; + } + + /* read master + parse */ + switch (id) { + case GST_MATROSKA_ID_CUES: + if (!gst_ebml_read_master (ebml, &id)) + res = FALSE; + else if (!gst_matroska_demux_parse_index (demux, TRUE) && + gst_bytestream_length (ebml->bs) != + gst_bytestream_tell (ebml->bs)) + res = FALSE; + else + demux->index_parsed = TRUE; + break; + case GST_MATROSKA_ID_TAGS: + if (!gst_ebml_read_master (ebml, &id)) + res = FALSE; + else if (!gst_matroska_demux_parse_metadata (demux, TRUE) && + gst_bytestream_length (ebml->bs) != + gst_bytestream_tell (ebml->bs)) + res = FALSE; + else + demux->metadata_parsed = TRUE; + break; + } + if (!res) + break; + + finish: + /* remove dummy level */ + while (ebml->level) { + guint64 length; + + level = g_list_last (ebml->level)->data; + ebml->level = g_list_remove (ebml->level, level); + length = level->length; + g_free (level); + if (length == G_MAXUINT64) + break; + } + + /* seek back */ + if (!(event = gst_ebml_read_seek (ebml, before_pos))) + return FALSE; + gst_event_unref (event); + demux->level_up = level_up; + break; + } + + default: + GST_INFO ("Ignoring seekhead entry for ID=0x%x", seek_id); + break; + } + + break; } default: - GST_WARNING ("Unknown seekhead ID 0x%x", id); - /* fall-through */ + GST_WARNING ("Unknown seekhead ID 0x%x", id); + /* fall-through */ case GST_EBML_ID_VOID: - if (!gst_ebml_read_skip (ebml)) - res = FALSE; - break; + if (!gst_ebml_read_skip (ebml)) + res = FALSE; + break; } if (demux->level_up) { @@ -2063,88 +2063,88 @@ gst_matroska_demux_loop_stream (GstMatroskaDemux * demux) } switch (id) { - /* stream info */ + /* stream info */ case GST_MATROSKA_ID_INFO:{ - if (!gst_ebml_read_master (ebml, &id)) { - res = FALSE; - break; - } - res = gst_matroska_demux_parse_info (demux); - break; + if (!gst_ebml_read_master (ebml, &id)) { + res = FALSE; + break; + } + res = gst_matroska_demux_parse_info (demux); + break; } - /* track info headers */ + /* track info headers */ case GST_MATROSKA_ID_TRACKS:{ - if (!gst_ebml_read_master (ebml, &id)) { - res = FALSE; - break; - } - res = gst_matroska_demux_parse_tracks (demux); - break; + if (!gst_ebml_read_master (ebml, &id)) { + res = FALSE; + break; + } + res = gst_matroska_demux_parse_tracks (demux); + break; } - /* stream index */ + /* stream index */ case GST_MATROSKA_ID_CUES:{ - if (!demux->index_parsed) { - if (!gst_ebml_read_master (ebml, &id)) { - res = FALSE; - break; - } - res = gst_matroska_demux_parse_index (demux, FALSE); - } else - res = gst_ebml_read_skip (ebml); - break; + if (!demux->index_parsed) { + if (!gst_ebml_read_master (ebml, &id)) { + res = FALSE; + break; + } + res = gst_matroska_demux_parse_index (demux, FALSE); + } else + res = gst_ebml_read_skip (ebml); + break; } - /* metadata */ + /* metadata */ case GST_MATROSKA_ID_TAGS:{ - if (!demux->index_parsed) { - if (!gst_ebml_read_master (ebml, &id)) { - res = FALSE; - break; - } - res = gst_matroska_demux_parse_metadata (demux, FALSE); - } else - res = gst_ebml_read_skip (ebml); - break; + if (!demux->index_parsed) { + if (!gst_ebml_read_master (ebml, &id)) { + res = FALSE; + break; + } + res = gst_matroska_demux_parse_metadata (demux, FALSE); + } else + res = gst_ebml_read_skip (ebml); + break; } - /* file index (if seekable, seek to Cues/Tags to parse it) */ + /* file index (if seekable, seek to Cues/Tags to parse it) */ case GST_MATROSKA_ID_SEEKHEAD:{ - if (!gst_ebml_read_master (ebml, &id)) { - res = FALSE; - break; - } - res = gst_matroska_demux_parse_contents (demux); - break; + if (!gst_ebml_read_master (ebml, &id)) { + res = FALSE; + break; + } + res = gst_matroska_demux_parse_contents (demux); + break; } case GST_MATROSKA_ID_CLUSTER:{ - if (!gst_ebml_read_master (ebml, &id)) { - res = FALSE; - break; - } - /* The idea is that we parse one cluster per loop and - * then break out of the loop here. In the next call - * of the loopfunc, we will get back here with the - * next cluster. If an error occurs, we didn't - * actually push a buffer, but we still want to break - * out of the loop to handle a possible error. We'll - * get back here if it's recoverable. */ - gst_matroska_demux_parse_cluster (demux); - demux->state = GST_MATROSKA_DEMUX_STATE_DATA; - res = FALSE; - break; + if (!gst_ebml_read_master (ebml, &id)) { + res = FALSE; + break; + } + /* The idea is that we parse one cluster per loop and + * then break out of the loop here. In the next call + * of the loopfunc, we will get back here with the + * next cluster. If an error occurs, we didn't + * actually push a buffer, but we still want to break + * out of the loop to handle a possible error. We'll + * get back here if it's recoverable. */ + gst_matroska_demux_parse_cluster (demux); + demux->state = GST_MATROSKA_DEMUX_STATE_DATA; + res = FALSE; + break; } default: - GST_WARNING ("Unknown matroska file header ID 0x%x", id); - /* fall-through */ + GST_WARNING ("Unknown matroska file header ID 0x%x", id); + /* fall-through */ case GST_EBML_ID_VOID: - if (!gst_ebml_read_skip (ebml)) - res = FALSE; - break; + if (!gst_ebml_read_skip (ebml)) + res = FALSE; + break; } if (demux->level_up) { @@ -2190,13 +2190,13 @@ gst_matroska_demux_video_caps (GstMatroskaTrackVideoContext * videocontext, /* assure size is big enough */ if (size < 24) { - GST_WARNING ("Too small BITMAPINFOHEADER (%d bytes)", size); - return NULL; + GST_WARNING ("Too small BITMAPINFOHEADER (%d bytes)", size); + return NULL; } if (size < sizeof (gst_riff_strf_vids)) { - vids = - (gst_riff_strf_vids *) g_realloc (vids, - sizeof (gst_riff_strf_vids)); + vids = + (gst_riff_strf_vids *) g_realloc (vids, + sizeof (gst_riff_strf_vids)); } /* little-endian -> byte-order */ @@ -2213,14 +2213,14 @@ gst_matroska_demux_video_caps (GstMatroskaTrackVideoContext * videocontext, vids->imp_colors = GUINT32_FROM_LE (vids->imp_colors); caps = gst_riff_create_video_caps (vids->compression, NULL, vids, - &codec_name); + &codec_name); gst_tag_list_add (list, GST_TAG_MERGE_APPEND, GST_TAG_VIDEO_CODEC, - codec_name, NULL); + codec_name, NULL); if (GST_IS_ELEMENT (demux)) - gst_element_found_tags (GST_ELEMENT (demux), list); + gst_element_found_tags (GST_ELEMENT (demux), list); gst_tag_list_free (list); if (codec_name) - g_free (codec_name); + g_free (codec_name); } else { caps = gst_riff_create_video_template_caps (); } @@ -2230,39 +2230,39 @@ gst_matroska_demux_video_caps (GstMatroskaTrackVideoContext * videocontext, guint32 fourcc = 0; switch (videocontext->fourcc) { - case GST_MAKE_FOURCC ('I', '4', '2', '0'): - case GST_MAKE_FOURCC ('Y', 'U', 'Y', '2'): - fourcc = videocontext->fourcc; - break; - - default: - GST_DEBUG ("Unknown fourcc " GST_FOURCC_FORMAT, - GST_FOURCC_ARGS (videocontext->fourcc)); - return NULL; + case GST_MAKE_FOURCC ('I', '4', '2', '0'): + case GST_MAKE_FOURCC ('Y', 'U', 'Y', '2'): + fourcc = videocontext->fourcc; + break; + + default: + GST_DEBUG ("Unknown fourcc " GST_FOURCC_FORMAT, + GST_FOURCC_ARGS (videocontext->fourcc)); + return NULL; } caps = gst_caps_new_simple ("video/x-raw-yuv", - "format", GST_TYPE_FOURCC, fourcc, NULL); + "format", GST_TYPE_FOURCC, fourcc, NULL); } else { caps = gst_caps_from_string ("video/x-raw-yuv, " - "format = (fourcc) { I420, YUY2, YV12 }"); + "format = (fourcc) { I420, YUY2, YV12 }"); } } else if (!strcmp (codec_id, GST_MATROSKA_CODEC_ID_VIDEO_MPEG4_SP)) { caps = gst_caps_new_simple ("video/x-divx", - "divxversion", G_TYPE_INT, 4, NULL); + "divxversion", G_TYPE_INT, 4, NULL); } else if (!strcmp (codec_id, GST_MATROSKA_CODEC_ID_VIDEO_MPEG4_ASP) || !strcmp (codec_id, GST_MATROSKA_CODEC_ID_VIDEO_MPEG4_AP)) { caps = gst_caps_new_full (gst_structure_new ("video/x-divx", - "divxversion", G_TYPE_INT, 5, NULL), - gst_structure_new ("video/x-xvid", NULL), - gst_structure_new ("video/mpeg", - "mpegversion", G_TYPE_INT, 4, - "systemstream", G_TYPE_BOOLEAN, FALSE, NULL), NULL); + "divxversion", G_TYPE_INT, 5, NULL), + gst_structure_new ("video/x-xvid", NULL), + gst_structure_new ("video/mpeg", + "mpegversion", G_TYPE_INT, 4, + "systemstream", G_TYPE_BOOLEAN, FALSE, NULL), NULL); } else if (!strcmp (codec_id, GST_MATROSKA_CODEC_ID_VIDEO_MSMPEG4V3)) { caps = gst_caps_new_full (gst_structure_new ("video/x-divx", - "divxversion", G_TYPE_INT, 3, NULL), - gst_structure_new ("video/x-msmpeg", - "msmpegversion", G_TYPE_INT, 43, NULL), NULL); + "divxversion", G_TYPE_INT, 3, NULL), + gst_structure_new ("video/x-msmpeg", + "msmpegversion", G_TYPE_INT, 43, NULL), NULL); } else if (!strcmp (codec_id, GST_MATROSKA_CODEC_ID_VIDEO_MPEG1) || !strcmp (codec_id, GST_MATROSKA_CODEC_ID_VIDEO_MPEG2)) { gint mpegversion = -1; @@ -2275,8 +2275,8 @@ gst_matroska_demux_video_caps (GstMatroskaTrackVideoContext * videocontext, g_assert (0); caps = gst_caps_new_simple ("video/mpeg", - "systemstream", G_TYPE_BOOLEAN, FALSE, - "mpegversion", G_TYPE_INT, mpegversion, NULL); + "systemstream", G_TYPE_BOOLEAN, FALSE, + "mpegversion", G_TYPE_INT, mpegversion, NULL); } else if (!strcmp (codec_id, GST_MATROSKA_CODEC_ID_VIDEO_MJPEG)) { caps = gst_caps_new_simple ("video/x-jpeg", NULL); } else { @@ -2291,46 +2291,46 @@ gst_matroska_demux_video_caps (GstMatroskaTrackVideoContext * videocontext, for (i = 0; i < gst_caps_get_size (caps); i++) { structure = gst_caps_get_structure (caps, i); if (videocontext != NULL) { - if (videocontext->pixel_width > 0 && videocontext->pixel_height > 0) { - gint w = videocontext->pixel_width; - gint h = videocontext->pixel_height; - - gst_structure_set (structure, - "width", G_TYPE_INT, w, "height", G_TYPE_INT, h, NULL); - } else { - gst_structure_set (structure, - "width", GST_TYPE_INT_RANGE, 16, 4096, - "height", GST_TYPE_INT_RANGE, 16, 4096, NULL); - } + if (videocontext->pixel_width > 0 && videocontext->pixel_height > 0) { + gint w = videocontext->pixel_width; + gint h = videocontext->pixel_height; + + gst_structure_set (structure, + "width", G_TYPE_INT, w, "height", G_TYPE_INT, h, NULL); + } else { + gst_structure_set (structure, + "width", GST_TYPE_INT_RANGE, 16, 4096, + "height", GST_TYPE_INT_RANGE, 16, 4096, NULL); + } #if 0 - if (videocontext->display_width > 0 && videocontext->display_height > 0) { - gint w = - 100 * videocontext->display_width / videocontext->pixel_width; - gint h = - 100 * videocontext->display_height / videocontext->pixel_height; - - gst_structure_set (structure, - "pixel_width", G_TYPE_INT, w, - "pixel_height", G_TYPE_INT, h, NULL); - } + if (videocontext->display_width > 0 && videocontext->display_height > 0) { + gint w = + 100 * videocontext->display_width / videocontext->pixel_width; + gint h = + 100 * videocontext->display_height / videocontext->pixel_height; + + gst_structure_set (structure, + "pixel_width", G_TYPE_INT, w, + "pixel_height", G_TYPE_INT, h, NULL); + } #endif - if (context->default_duration > 0) { - gfloat framerate = 1. * GST_SECOND / context->default_duration; - - gst_structure_set (structure, - "framerate", G_TYPE_DOUBLE, framerate, NULL); - } else { - /* sort of a hack to get most codecs to support, - * even if the default_duration is missing */ - gst_structure_set (structure, "framerate", G_TYPE_DOUBLE, 25.0, NULL); - } + if (context->default_duration > 0) { + gfloat framerate = 1. * GST_SECOND / context->default_duration; + + gst_structure_set (structure, + "framerate", G_TYPE_DOUBLE, framerate, NULL); + } else { + /* sort of a hack to get most codecs to support, + * even if the default_duration is missing */ + gst_structure_set (structure, "framerate", G_TYPE_DOUBLE, 25.0, NULL); + } } else { - gst_structure_set (structure, - "width", GST_TYPE_INT_RANGE, 16, 4096, - "height", GST_TYPE_INT_RANGE, 16, 4096, - "pixel_width", GST_TYPE_INT_RANGE, 0, 255, - "pixel_height", GST_TYPE_INT_RANGE, 0, 255, - "framerate", GST_TYPE_DOUBLE_RANGE, 0.0, G_MAXDOUBLE, NULL); + gst_structure_set (structure, + "width", GST_TYPE_INT_RANGE, 16, 4096, + "height", GST_TYPE_INT_RANGE, 16, 4096, + "pixel_width", GST_TYPE_INT_RANGE, 0, 255, + "pixel_height", GST_TYPE_INT_RANGE, 0, 255, + "framerate", GST_TYPE_DOUBLE_RANGE, 0.0, G_MAXDOUBLE, NULL); } } } @@ -2360,7 +2360,7 @@ gst_matroska_demux_audio_caps (GstMatroskaTrackAudioContext * audiocontext, g_assert (0); caps = gst_caps_new_simple ("audio/mpeg", - "mpegversion", G_TYPE_INT, 1, "layer", G_TYPE_INT, layer, NULL); + "mpegversion", G_TYPE_INT, 1, "layer", G_TYPE_INT, layer, NULL); } else if (!strcmp (codec_id, GST_MATROSKA_CODEC_ID_AUDIO_PCM_INT_BE) || !strcmp (codec_id, GST_MATROSKA_CODEC_ID_AUDIO_PCM_INT_LE)) { gint endianness = -1; @@ -2374,22 +2374,22 @@ gst_matroska_demux_audio_caps (GstMatroskaTrackAudioContext * audiocontext, if (context != NULL) { caps = gst_caps_new_simple ("audio/x-raw-int", - "width", G_TYPE_INT, audiocontext->bitdepth, - "depth", G_TYPE_INT, audiocontext->bitdepth, - "signed", G_TYPE_BOOLEAN, audiocontext->bitdepth == 8, NULL); + "width", G_TYPE_INT, audiocontext->bitdepth, + "depth", G_TYPE_INT, audiocontext->bitdepth, + "signed", G_TYPE_BOOLEAN, audiocontext->bitdepth == 8, NULL); } else { caps = gst_caps_from_string ("audio/x-raw-int, " - "signed = (boolean) { TRUE, FALSE }, " - "depth = (int) { 8, 16 }, " "width = (int) { 8, 16 }"); + "signed = (boolean) { TRUE, FALSE }, " + "depth = (int) { 8, 16 }, " "width = (int) { 8, 16 }"); } gst_caps_set_simple (caps, "endianness", G_TYPE_INT, endianness, NULL); } else if (!strcmp (codec_id, GST_MATROSKA_CODEC_ID_AUDIO_PCM_FLOAT)) { caps = gst_caps_new_simple ("audio/x-raw-float", - "endianness", G_TYPE_INT, G_BYTE_ORDER, - "buffer-frames", GST_TYPE_INT_RANGE, 1, G_MAXINT, NULL); + "endianness", G_TYPE_INT, G_BYTE_ORDER, + "buffer-frames", GST_TYPE_INT_RANGE, 1, G_MAXINT, NULL); if (audiocontext != NULL) { gst_caps_set_simple (caps, - "width", G_TYPE_INT, audiocontext->bitdepth, NULL); + "width", G_TYPE_INT, audiocontext->bitdepth, NULL); } else { gst_caps_set_simple (caps, "width", GST_TYPE_INT_RANGE, 32, 64, NULL); } @@ -2417,32 +2417,32 @@ gst_matroska_demux_audio_caps (GstMatroskaTrackAudioContext * audiocontext, caps = gst_riff_create_audio_caps (auds->format, NULL, auds, &codec_name); gst_tag_list_add (list, GST_TAG_MERGE_APPEND, GST_TAG_AUDIO_CODEC, - codec_name, NULL); + codec_name, NULL); if (GST_IS_ELEMENT (demux)) - gst_element_found_tags (GST_ELEMENT (demux), list); + gst_element_found_tags (GST_ELEMENT (demux), list); gst_tag_list_free (list); if (codec_name) - g_free (codec_name); + g_free (codec_name); } else { caps = gst_riff_create_audio_template_caps (); } } else if (!strncmp (codec_id, GST_MATROSKA_CODEC_ID_AUDIO_MPEG2, - strlen (GST_MATROSKA_CODEC_ID_AUDIO_MPEG2)) || + strlen (GST_MATROSKA_CODEC_ID_AUDIO_MPEG2)) || !strncmp (codec_id, GST_MATROSKA_CODEC_ID_AUDIO_MPEG4, - strlen (GST_MATROSKA_CODEC_ID_AUDIO_MPEG4))) { + strlen (GST_MATROSKA_CODEC_ID_AUDIO_MPEG4))) { gint mpegversion = -1; if (!strncmp (codec_id, GST_MATROSKA_CODEC_ID_AUDIO_MPEG2, - strlen (GST_MATROSKA_CODEC_ID_AUDIO_MPEG2))) + strlen (GST_MATROSKA_CODEC_ID_AUDIO_MPEG2))) mpegversion = 2; else if (!strncmp (codec_id, GST_MATROSKA_CODEC_ID_AUDIO_MPEG4, - strlen (GST_MATROSKA_CODEC_ID_AUDIO_MPEG4))) + strlen (GST_MATROSKA_CODEC_ID_AUDIO_MPEG4))) mpegversion = 4; else g_assert (0); caps = gst_caps_new_simple ("audio/mpeg", - "mpegversion", G_TYPE_INT, mpegversion, NULL); + "mpegversion", G_TYPE_INT, mpegversion, NULL); } else { GST_WARNING ("Unknown codec '%s', cannot build Caps", codec_id); return NULL; @@ -2455,15 +2455,15 @@ gst_matroska_demux_audio_caps (GstMatroskaTrackAudioContext * audiocontext, for (i = 0; i < gst_caps_get_size (caps); i++) { structure = gst_caps_get_structure (caps, i); if (audiocontext != NULL) { - if (audiocontext->samplerate > 0 && audiocontext->channels > 0) { - gst_structure_set (structure, - "channels", G_TYPE_INT, audiocontext->channels, - "rate", G_TYPE_INT, audiocontext->samplerate, NULL); - } + if (audiocontext->samplerate > 0 && audiocontext->channels > 0) { + gst_structure_set (structure, + "channels", G_TYPE_INT, audiocontext->channels, + "rate", G_TYPE_INT, audiocontext->samplerate, NULL); + } } else { - gst_structure_set (structure, - "channels", GST_TYPE_INT_RANGE, 1, 6, - "rate", GST_TYPE_INT_RANGE, 4000, 96000, NULL); + gst_structure_set (structure, + "channels", GST_TYPE_INT_RANGE, 1, 6, + "rate", GST_TYPE_INT_RANGE, 4000, 96000, NULL); } } } @@ -2551,27 +2551,30 @@ gst_matroska_demux_plugin_init (GstPlugin * plugin) /* TODO: Real/Quicktime */ /* FILLME */ NULL, - }, *audio_id[] = { + }, *audio_id[] = + { GST_MATROSKA_CODEC_ID_AUDIO_MPEG1_L1, - GST_MATROSKA_CODEC_ID_AUDIO_MPEG1_L2, - GST_MATROSKA_CODEC_ID_AUDIO_MPEG1_L3, - GST_MATROSKA_CODEC_ID_AUDIO_PCM_INT_BE, - GST_MATROSKA_CODEC_ID_AUDIO_PCM_INT_LE, - GST_MATROSKA_CODEC_ID_AUDIO_PCM_FLOAT, - GST_MATROSKA_CODEC_ID_AUDIO_AC3, - GST_MATROSKA_CODEC_ID_AUDIO_ACM, - GST_MATROSKA_CODEC_ID_AUDIO_VORBIS, - GST_MATROSKA_CODEC_ID_AUDIO_MPEG2, GST_MATROSKA_CODEC_ID_AUDIO_MPEG4, - /* TODO: AC3-9/10, Real, Musepack, Quicktime */ - /* FILLME */ - NULL,}, *complex_id[] = { + GST_MATROSKA_CODEC_ID_AUDIO_MPEG1_L2, + GST_MATROSKA_CODEC_ID_AUDIO_MPEG1_L3, + GST_MATROSKA_CODEC_ID_AUDIO_PCM_INT_BE, + GST_MATROSKA_CODEC_ID_AUDIO_PCM_INT_LE, + GST_MATROSKA_CODEC_ID_AUDIO_PCM_FLOAT, + GST_MATROSKA_CODEC_ID_AUDIO_AC3, + GST_MATROSKA_CODEC_ID_AUDIO_ACM, + GST_MATROSKA_CODEC_ID_AUDIO_VORBIS, + GST_MATROSKA_CODEC_ID_AUDIO_MPEG2, GST_MATROSKA_CODEC_ID_AUDIO_MPEG4, + /* TODO: AC3-9/10, Real, Musepack, Quicktime */ + /* FILLME */ + NULL,} + , *complex_id[] = { /* FILLME */ - NULL,}, *subtitle_id[] = { + NULL,} + , *subtitle_id[] = { /* FILLME */ NULL,}; /* this filter needs the riff parser */ - if (!gst_library_load ("gstbytestream") || !gst_library_load ("riff")) /* for fourcc stuff */ + if (!gst_library_load ("gstbytestream") || !gst_library_load ("riff")) /* for fourcc stuff */ return FALSE; /* video src template */ @@ -2607,7 +2610,7 @@ gst_matroska_demux_plugin_init (GstPlugin * plugin) /* create an elementfactory for the matroska_demux element */ if (!gst_element_register (plugin, "matroskademux", - GST_RANK_PRIMARY, GST_TYPE_MATROSKA_DEMUX)) + GST_RANK_PRIMARY, GST_TYPE_MATROSKA_DEMUX)) return FALSE; return TRUE; diff --git a/gst/matroska/matroska-mux.c b/gst/matroska/matroska-mux.c index ebaff887..67eae139 100644 --- a/gst/matroska/matroska-mux.c +++ b/gst/matroska/matroska-mux.c @@ -58,19 +58,19 @@ static GstStaticPadTemplate videosink_templ = GST_PAD_SINK, GST_PAD_REQUEST, GST_STATIC_CAPS ("video/mpeg, " - "mpegversion = (int) { 1, 2, 4 }, " - "systemstream = (boolean) false, " - COMMON_VIDEO_CAPS "; " - "video/x-divx, " - COMMON_VIDEO_CAPS "; " - "video/x-xvid, " - COMMON_VIDEO_CAPS "; " - "video/x-msmpeg, " - COMMON_VIDEO_CAPS "; " - "video/x-jpeg, " - COMMON_VIDEO_CAPS "; " - "video/x-raw-yuv, " - "format = (fourcc) { YUY2, I420 }, " COMMON_VIDEO_CAPS) + "mpegversion = (int) { 1, 2, 4 }, " + "systemstream = (boolean) false, " + COMMON_VIDEO_CAPS "; " + "video/x-divx, " + COMMON_VIDEO_CAPS "; " + "video/x-xvid, " + COMMON_VIDEO_CAPS "; " + "video/x-msmpeg, " + COMMON_VIDEO_CAPS "; " + "video/x-jpeg, " + COMMON_VIDEO_CAPS "; " + "video/x-raw-yuv, " + "format = (fourcc) { YUY2, I420 }, " COMMON_VIDEO_CAPS) ); #define COMMON_AUDIO_CAPS \ @@ -86,19 +86,19 @@ static GstStaticPadTemplate audiosink_templ = GST_PAD_SINK, GST_PAD_REQUEST, GST_STATIC_CAPS ("audio/mpeg, " - "mpegversion = (int) 1, " - "layer = (int) [ 1, 3 ], " - COMMON_AUDIO_CAPS "; " - "audio/mpeg, " - "mpegversion = (int) { 2, 4 }, " - COMMON_AUDIO_CAPS "; " - "audio/x-ac3, " - COMMON_AUDIO_CAPS "; " - "audio/x-raw-int, " - "width = (int) { 8, 16, 24 }, " - "depth = (int) { 8, 16, 24 }, " - "endianness = (int) { BIG_ENDIAN, LITTLE_ENDIAN }, " - "signed = (boolean) { true, false }, " COMMON_AUDIO_CAPS) + "mpegversion = (int) 1, " + "layer = (int) [ 1, 3 ], " + COMMON_AUDIO_CAPS "; " + "audio/mpeg, " + "mpegversion = (int) { 2, 4 }, " + COMMON_AUDIO_CAPS "; " + "audio/x-ac3, " + COMMON_AUDIO_CAPS "; " + "audio/x-raw-int, " + "width = (int) { 8, 16, 24 }, " + "depth = (int) { 8, 16, 24 }, " + "endianness = (int) { BIG_ENDIAN, LITTLE_ENDIAN }, " + "signed = (boolean) { true, false }, " COMMON_AUDIO_CAPS) ); static GstStaticPadTemplate subtitlesink_templ = @@ -155,8 +155,8 @@ gst_matroska_mux_get_type (void) }; gst_matroska_mux_type = - g_type_register_static (GST_TYPE_EBML_WRITE, - "GstMatroskaMmux", &gst_matroska_mux_info, 0); + g_type_register_static (GST_TYPE_EBML_WRITE, + "GstMatroskaMmux", &gst_matroska_mux_info, 0); } return gst_matroska_mux_type; @@ -195,7 +195,7 @@ gst_matroska_mux_class_init (GstMatroskaMuxClass * klass) g_object_class_install_property (gobject_class, ARG_METADATA, g_param_spec_boxed ("metadata", "Metadata", "Metadata", - GST_TYPE_CAPS, G_PARAM_READWRITE)); + GST_TYPE_CAPS, G_PARAM_READWRITE)); parent_class = g_type_class_ref (GST_TYPE_EBML_WRITE); @@ -214,7 +214,7 @@ gst_matroska_mux_init (GstMatroskaMux * mux) mux->srcpad = gst_pad_new_from_template (gst_element_class_get_pad_template (klass, - "src"), "src"); + "src"), "src"); gst_element_add_pad (GST_ELEMENT (mux), mux->srcpad); GST_EBML_WRITE (mux)->srcpad = mux->srcpad; @@ -244,7 +244,7 @@ gst_matroska_mux_reset (GstElement * element) for (i = 0; i < GST_MATROSKA_MUX_MAX_STREAMS; i++) { if (mux->sink[i].track != NULL) { if (mux->sink[i].track->pad != NULL) { - gst_element_remove_pad (GST_ELEMENT (mux), mux->sink[i].track->pad); + gst_element_remove_pad (GST_ELEMENT (mux), mux->sink[i].track->pad); } g_free (mux->sink[i].track->codec_id); g_free (mux->sink[i].track->codec_name); @@ -268,7 +268,7 @@ gst_matroska_mux_reset (GstElement * element) /* reset media info (to default) */ gst_caps_replace (&mux->metadata, gst_caps_new_simple ("application/x-gst-metadata", - "application", G_TYPE_STRING, "", "date", G_TYPE_STRING, "", NULL)); + "application", G_TYPE_STRING, "", "date", G_TYPE_STRING, "", NULL)); /* reset indexes */ mux->num_indexes = 0; @@ -295,7 +295,7 @@ gst_matroska_mux_video_pad_link (GstPad * pad, const GstCaps * caps) /* find context */ for (i = 0; i < mux->num_streams; i++) { if (mux->sink[i].track && mux->sink[i].track->pad && - mux->sink[i].track->pad == pad) { + mux->sink[i].track->pad == pad) { context = mux->sink[i].track; break; } @@ -356,14 +356,14 @@ gst_matroska_mux_video_pad_link (GstPad * pad, const GstCaps * caps) gst_structure_get_int (structure, "divxversion", &divxversion); switch (divxversion) { case 3: - context->codec_id = g_strdup (GST_MATROSKA_CODEC_ID_VIDEO_MSMPEG4V3); - break; + context->codec_id = g_strdup (GST_MATROSKA_CODEC_ID_VIDEO_MSMPEG4V3); + break; case 4: - context->codec_id = g_strdup (GST_MATROSKA_CODEC_ID_VIDEO_MPEG4_SP); - break; + context->codec_id = g_strdup (GST_MATROSKA_CODEC_ID_VIDEO_MPEG4_SP); + break; case 5: - context->codec_id = g_strdup (GST_MATROSKA_CODEC_ID_VIDEO_MPEG4_ASP); - break; + context->codec_id = g_strdup (GST_MATROSKA_CODEC_ID_VIDEO_MPEG4_ASP); + break; } return GST_PAD_LINK_OK; @@ -377,14 +377,14 @@ gst_matroska_mux_video_pad_link (GstPad * pad, const GstCaps * caps) gst_structure_get_int (structure, "mpegversion", &mpegversion); switch (mpegversion) { case 1: - context->codec_id = g_strdup (GST_MATROSKA_CODEC_ID_VIDEO_MPEG1); - break; + context->codec_id = g_strdup (GST_MATROSKA_CODEC_ID_VIDEO_MPEG1); + break; case 2: - context->codec_id = g_strdup (GST_MATROSKA_CODEC_ID_VIDEO_MPEG2); - break; + context->codec_id = g_strdup (GST_MATROSKA_CODEC_ID_VIDEO_MPEG2); + break; case 3: - context->codec_id = g_strdup (GST_MATROSKA_CODEC_ID_VIDEO_MPEG4_ASP); - break; + context->codec_id = g_strdup (GST_MATROSKA_CODEC_ID_VIDEO_MPEG4_ASP); + break; } return GST_PAD_LINK_OK; @@ -410,7 +410,7 @@ gst_matroska_mux_audio_pad_link (GstPad * pad, const GstCaps * caps) /* find context */ for (i = 0; i < mux->num_streams; i++) { if (mux->sink[i].track && mux->sink[i].track->pad && - mux->sink[i].track->pad == pad) { + mux->sink[i].track->pad == pad) { context = mux->sink[i].track; break; } @@ -436,28 +436,28 @@ gst_matroska_mux_audio_pad_link (GstPad * pad, const GstCaps * caps) gst_structure_get_int (structure, "mpegversion", &mpegversion); switch (mpegversion) { case 1:{ - gint layer; - - gst_structure_get_int (structure, "layer", &layer); - switch (layer) { - case 1: - context->codec_id = g_strdup (GST_MATROSKA_CODEC_ID_AUDIO_MPEG1_L1); - break; - case 2: - context->codec_id = g_strdup (GST_MATROSKA_CODEC_ID_AUDIO_MPEG1_L2); - break; - case 3: - context->codec_id = g_strdup (GST_MATROSKA_CODEC_ID_AUDIO_MPEG1_L3); - break; - } - break; + gint layer; + + gst_structure_get_int (structure, "layer", &layer); + switch (layer) { + case 1: + context->codec_id = g_strdup (GST_MATROSKA_CODEC_ID_AUDIO_MPEG1_L1); + break; + case 2: + context->codec_id = g_strdup (GST_MATROSKA_CODEC_ID_AUDIO_MPEG1_L2); + break; + case 3: + context->codec_id = g_strdup (GST_MATROSKA_CODEC_ID_AUDIO_MPEG1_L3); + break; + } + break; } case 2: - context->codec_id = g_strdup (GST_MATROSKA_CODEC_ID_AUDIO_MPEG2 "MAIN"); - break; + context->codec_id = g_strdup (GST_MATROSKA_CODEC_ID_AUDIO_MPEG2 "MAIN"); + break; case 4: - context->codec_id = g_strdup (GST_MATROSKA_CODEC_ID_AUDIO_MPEG4 "MAIN"); - break; + context->codec_id = g_strdup (GST_MATROSKA_CODEC_ID_AUDIO_MPEG4 "MAIN"); + break; } return GST_PAD_LINK_OK; @@ -470,7 +470,7 @@ gst_matroska_mux_audio_pad_link (GstPad * pad, const GstCaps * caps) gst_structure_get_int (structure, "depth", &depth); gst_structure_get_int (structure, "signed", &signedness); if (width != depth || - (width == 8 && signedness) || (width == 16 && !signedness)) + (width == 8 && signedness) || (width == 16 && !signedness)) return GST_PAD_LINK_REFUSED; audiocontext->bitdepth = depth; @@ -518,21 +518,21 @@ gst_matroska_mux_request_new_pad (GstElement * element, name = g_strdup_printf ("audio_%d", mux->num_a_streams++); linkfunc = gst_matroska_mux_audio_pad_link; context = (GstMatroskaTrackContext *) - g_new0 (GstMatroskaTrackAudioContext, 1); + g_new0 (GstMatroskaTrackAudioContext, 1); context->type = GST_MATROSKA_TRACK_TYPE_AUDIO; context->name = g_strdup ("Audio"); } else if (templ == gst_element_class_get_pad_template (klass, "video_%d")) { name = g_strdup_printf ("video_%d", mux->num_v_streams++); linkfunc = gst_matroska_mux_video_pad_link; context = (GstMatroskaTrackContext *) - g_new0 (GstMatroskaTrackVideoContext, 1); + g_new0 (GstMatroskaTrackVideoContext, 1); context->type = GST_MATROSKA_TRACK_TYPE_VIDEO; context->name = g_strdup ("Video"); } else if (templ == gst_element_class_get_pad_template (klass, "subtitle_%d")) { name = g_strdup_printf ("subtitle_%d", mux->num_t_streams++); linkfunc = gst_matroska_mux_subtitle_pad_link; context = (GstMatroskaTrackContext *) - g_new0 (GstMatroskaTrackSubtitleContext, 1); + g_new0 (GstMatroskaTrackSubtitleContext, 1); context->type = GST_MATROSKA_TRACK_TYPE_SUBTITLE; context->name = g_strdup ("Subtitle"); } else { @@ -567,30 +567,30 @@ gst_matroska_mux_track_header (GstMatroskaMux * mux, switch (context->type) { case GST_MATROSKA_TRACK_TYPE_VIDEO:{ GstMatroskaTrackVideoContext *videocontext = - (GstMatroskaTrackVideoContext *) context; + (GstMatroskaTrackVideoContext *) context; /* framerate, but not in the video part */ gst_ebml_write_uint (ebml, GST_MATROSKA_ID_TRACKDEFAULTDURATION, - context->default_duration); + context->default_duration); master = gst_ebml_write_master_start (ebml, GST_MATROSKA_ID_TRACKVIDEO); gst_ebml_write_uint (ebml, GST_MATROSKA_ID_VIDEOPIXELWIDTH, - videocontext->pixel_width); + videocontext->pixel_width); gst_ebml_write_uint (ebml, GST_MATROSKA_ID_VIDEOPIXELHEIGHT, - videocontext->pixel_height); + videocontext->pixel_height); if (videocontext->display_width && videocontext->display_height) { - gst_ebml_write_uint (ebml, GST_MATROSKA_ID_VIDEODISPLAYWIDTH, - videocontext->display_width); - gst_ebml_write_uint (ebml, GST_MATROSKA_ID_VIDEODISPLAYHEIGHT, - videocontext->display_height); + gst_ebml_write_uint (ebml, GST_MATROSKA_ID_VIDEODISPLAYWIDTH, + videocontext->display_width); + gst_ebml_write_uint (ebml, GST_MATROSKA_ID_VIDEODISPLAYHEIGHT, + videocontext->display_height); } if (context->flags & GST_MATROSKA_VIDEOTRACK_INTERLACED) - gst_ebml_write_uint (ebml, GST_MATROSKA_ID_VIDEOFLAGINTERLACED, 1); + gst_ebml_write_uint (ebml, GST_MATROSKA_ID_VIDEOFLAGINTERLACED, 1); if (videocontext->fourcc) { - guint32 fcc_le = GUINT32_TO_LE (videocontext->fourcc); + guint32 fcc_le = GUINT32_TO_LE (videocontext->fourcc); - gst_ebml_write_binary (ebml, GST_MATROSKA_ID_VIDEOCOLOURSPACE, - (gpointer) & fcc_le, 4); + gst_ebml_write_binary (ebml, GST_MATROSKA_ID_VIDEOCOLOURSPACE, + (gpointer) & fcc_le, 4); } gst_ebml_write_master_finish (ebml, master); @@ -599,18 +599,18 @@ gst_matroska_mux_track_header (GstMatroskaMux * mux, case GST_MATROSKA_TRACK_TYPE_AUDIO:{ GstMatroskaTrackAudioContext *audiocontext = - (GstMatroskaTrackAudioContext *) context; + (GstMatroskaTrackAudioContext *) context; master = gst_ebml_write_master_start (ebml, GST_MATROSKA_ID_TRACKAUDIO); if (audiocontext->samplerate != 8000) - gst_ebml_write_float (ebml, GST_MATROSKA_ID_AUDIOSAMPLINGFREQ, - audiocontext->samplerate); + gst_ebml_write_float (ebml, GST_MATROSKA_ID_AUDIOSAMPLINGFREQ, + audiocontext->samplerate); if (audiocontext->channels != 1) - gst_ebml_write_uint (ebml, GST_MATROSKA_ID_AUDIOCHANNELS, - audiocontext->channels); + gst_ebml_write_uint (ebml, GST_MATROSKA_ID_AUDIOCHANNELS, + audiocontext->channels); if (audiocontext->bitdepth) { - gst_ebml_write_uint (ebml, GST_MATROSKA_ID_AUDIOBITDEPTH, - audiocontext->bitdepth); + gst_ebml_write_uint (ebml, GST_MATROSKA_ID_AUDIOBITDEPTH, + audiocontext->bitdepth); } gst_ebml_write_master_finish (ebml, master); @@ -625,7 +625,7 @@ gst_matroska_mux_track_header (GstMatroskaMux * mux, gst_ebml_write_ascii (ebml, GST_MATROSKA_ID_CODECID, context->codec_id); if (context->codec_priv) gst_ebml_write_binary (ebml, GST_MATROSKA_ID_CODECPRIVATE, - context->codec_priv, context->codec_priv_size); + context->codec_priv, context->codec_priv_size); /* FIXME: until we have a nice way of getting the codecname * out of the caps, I'm not going to enable this. Too much * (useless, double, boring) work... */ @@ -681,11 +681,11 @@ gst_matroska_mux_start (GstMatroskaMux * mux) gst_ebml_write_utf8 (ebml, GST_MATROSKA_ID_MUXINGAPP, "GStreamer"); if (mux->metadata && gst_structure_has_field (gst_caps_get_structure (mux->metadata, 0), - "application")) { + "application")) { const gchar *app; app = gst_structure_get_string (gst_caps_get_structure (mux->metadata, 0), - "application"); + "application"); if (app && app[0]) { gst_ebml_write_utf8 (ebml, GST_MATROSKA_ID_WRITINGAPP, app); } @@ -730,14 +730,14 @@ gst_matroska_mux_finish (GstMatroskaMux * mux) GstMatroskaIndex *idx = &mux->index[n]; pointentry_master = gst_ebml_write_master_start (ebml, - GST_MATROSKA_ID_POINTENTRY); + GST_MATROSKA_ID_POINTENTRY); gst_ebml_write_date (ebml, GST_MATROSKA_ID_CUETIME, - idx->time / mux->time_scale); + idx->time / mux->time_scale); trackpos_master = gst_ebml_write_master_start (ebml, - GST_MATROSKA_ID_CUETRACKPOSITION); + GST_MATROSKA_ID_CUETRACKPOSITION); gst_ebml_write_uint (ebml, GST_MATROSKA_ID_CUETRACK, idx->track); gst_ebml_write_uint (ebml, GST_MATROSKA_ID_CUECLUSTERPOSITION, - idx->pos - mux->segment_master); + idx->pos - mux->segment_master); gst_ebml_write_master_finish (ebml, trackpos_master); gst_ebml_write_master_finish (ebml, pointentry_master); } @@ -764,7 +764,7 @@ gst_matroska_mux_finish (GstMatroskaMux * mux) mux->tracks_pos - mux->segment_master); if (mux->index != NULL) { gst_ebml_replace_uint (ebml, mux->seekhead_pos + 88, - mux->cues_pos - mux->segment_master); + mux->cues_pos - mux->segment_master); } else { /* void'ify */ guint64 my_pos = ebml->pos; @@ -796,24 +796,24 @@ gst_matroska_mux_prepare_data (GstMatroskaMux * mux) for (i = 0; i < mux->num_streams; i++) { while (!mux->sink[i].eos && !mux->sink[i].buffer && - mux->sink[i].track->num > 0 && - GST_PAD_IS_USABLE (mux->sink[i].track->pad)) { + mux->sink[i].track->num > 0 && + GST_PAD_IS_USABLE (mux->sink[i].track->pad)) { GstData *data; data = gst_pad_pull (mux->sink[i].track->pad); if (GST_IS_EVENT (data)) { - if (GST_EVENT_TYPE (GST_EVENT (data)) == GST_EVENT_EOS) - mux->sink[i].eos = TRUE; - gst_event_unref (GST_EVENT (data)); + if (GST_EVENT_TYPE (GST_EVENT (data)) == GST_EVENT_EOS) + mux->sink[i].eos = TRUE; + gst_event_unref (GST_EVENT (data)); } else { - mux->sink[i].buffer = GST_BUFFER (data); + mux->sink[i].buffer = GST_BUFFER (data); } } if (mux->sink[i].buffer) { if (first < 0 || GST_BUFFER_TIMESTAMP (mux->sink[i].buffer) < - GST_BUFFER_TIMESTAMP (mux->sink[first].buffer)) - first = i; + GST_BUFFER_TIMESTAMP (mux->sink[first].buffer)) + first = i; } } @@ -854,7 +854,7 @@ gst_matroska_mux_write_data (GstMatroskaMux * mux) if (mux->num_indexes % 32 == 0) { mux->index = g_renew (GstMatroskaIndex, mux->index, - mux->num_indexes + 32); + mux->num_indexes + 32); } idx = &mux->index[mux->num_indexes++]; diff --git a/gst/median/gstmedian.c b/gst/median/gstmedian.c index 9ce8430a..db8fa455 100644 --- a/gst/median/gstmedian.c +++ b/gst/median/gstmedian.c @@ -98,8 +98,9 @@ gst_median_get_type (void) 0, (GInstanceInitFunc) gst_median_init, }; + median_type = - g_type_register_static (GST_TYPE_ELEMENT, "GstMedian", &median_info, 0); + g_type_register_static (GST_TYPE_ELEMENT, "GstMedian", &median_info, 0); } return median_type; } @@ -127,9 +128,9 @@ gst_median_class_init (GstMedianClass * klass) parent_class = g_type_class_ref (GST_TYPE_ELEMENT); - g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_ACTIVE, g_param_spec_boolean ("active", "active", "active", TRUE, G_PARAM_READWRITE)); /* CHECKME */ - g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_FILTERSIZE, g_param_spec_int ("filtersize", "filtersize", "filtersize", G_MININT, G_MAXINT, 0, G_PARAM_READWRITE)); /* CHECKME */ - g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_LUM_ONLY, g_param_spec_boolean ("lum_only", "lum_only", "lum_only", TRUE, G_PARAM_READWRITE)); /* CHECKME */ + g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_ACTIVE, g_param_spec_boolean ("active", "active", "active", TRUE, G_PARAM_READWRITE)); /* CHECKME */ + g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_FILTERSIZE, g_param_spec_int ("filtersize", "filtersize", "filtersize", G_MININT, G_MAXINT, 0, G_PARAM_READWRITE)); /* CHECKME */ + g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_LUM_ONLY, g_param_spec_boolean ("lum_only", "lum_only", "lum_only", TRUE, G_PARAM_READWRITE)); /* CHECKME */ gobject_class->set_property = gst_median_set_property; gobject_class->get_property = gst_median_get_property; @@ -333,25 +334,25 @@ gst_median_chain (GstPad * pad, GstData * _data) median_5 (data, GST_BUFFER_DATA (outbuf), median->width, median->height); if (!median->lum_only) { median_5 (data + lumsize, GST_BUFFER_DATA (outbuf) + lumsize, - median->width / 2, median->height / 2); + median->width / 2, median->height / 2); median_5 (data + lumsize + chromsize, - GST_BUFFER_DATA (outbuf) + lumsize + chromsize, median->width / 2, - median->height / 2); + GST_BUFFER_DATA (outbuf) + lumsize + chromsize, median->width / 2, + median->height / 2); } else { memcpy (GST_BUFFER_DATA (outbuf) + lumsize, data + lumsize, - chromsize * 2); + chromsize * 2); } } else { median_9 (data, GST_BUFFER_DATA (outbuf), median->width, median->height); if (!median->lum_only) { median_9 (data + lumsize, GST_BUFFER_DATA (outbuf) + lumsize, - median->width / 2, median->height / 2); + median->width / 2, median->height / 2); median_9 (data + lumsize + chromsize, - GST_BUFFER_DATA (outbuf) + lumsize + chromsize, median->width / 2, - median->height / 2); + GST_BUFFER_DATA (outbuf) + lumsize + chromsize, median->width / 2, + median->height / 2); } else { memcpy (GST_BUFFER_DATA (outbuf) + lumsize, data + lumsize, - chromsize * 2); + chromsize * 2); } } GST_BUFFER_TIMESTAMP (outbuf) = GST_BUFFER_TIMESTAMP (buf); @@ -376,10 +377,10 @@ gst_median_set_property (GObject * object, guint prop_id, const GValue * value, case ARG_FILTERSIZE: argvalue = g_value_get_int (value); if (argvalue != 5 && argvalue != 9) { - g_warning ("median: invalid filtersize (%d), must be 5 or 9\n", - argvalue); + g_warning ("median: invalid filtersize (%d), must be 5 or 9\n", + argvalue); } else { - median->filtersize = argvalue; + median->filtersize = argvalue; } break; case ARG_ACTIVE: diff --git a/gst/monoscope/convolve.c b/gst/monoscope/convolve.c index 6b8cdd50..fc4f90b6 100644 --- a/gst/monoscope/convolve.c +++ b/gst/monoscope/convolve.c @@ -68,13 +68,16 @@ typedef union stack_entry_s { const double *left, *right; double *out; - } v; + } + v; struct { double *main, *null; - } b; + } + b; -} stack_entry; +} +stack_entry; #define STACK_SIZE (CONVOLVE_DEPTH * 3) @@ -175,11 +178,11 @@ convolve_run (stack_entry * top, unsigned size, double *scratch) /* Create the intermediate factors. */ for (i = 0; i < size; i++) { - double l = left[i] + left[i + size]; - double r = right[i] + right[i + size]; + double l = left[i] + left[i + size]; + double r = right[i] + right[i + size]; - s_left[i + size] = r; - s_left[i] = l; + s_left[i + size] = r; + s_left[i] = l; } /* Push the combine entry onto the stack. */ @@ -227,15 +230,15 @@ convolve_run (stack_entry * top, unsigned size, double *scratch) top++; out[size * 2 - 1] = 0; for (i = 0; i < size - 1; i++) { - double lo; - double hi; - - lo = mid[0] - (out[0] + out[2 * size]) + out[size]; - hi = mid[size] - (out[size] + out[3 * size]) + out[2 * size]; - out[size] = lo; - out[2 * size] = hi; - out++; - mid++; + double lo; + double hi; + + lo = mid[0] - (out[0] + out[2 * size]) + out[size]; + hi = mid[size] - (out[size] + out[3 * size]) + out[2 * size]; + out[size] = lo; + out[2 * size] = hi; + out++; + mid++; } size <<= 1; } while (top->b.null == NULL); @@ -281,7 +284,7 @@ convolve_match (const int *lastchoice, for (i = 0; i < 256; i++) right[i] -= avg; /* End-of-stack marker. */ -#if 0 /* The following line produces a CRASH, need to figure out why?!! */ +#if 0 /* The following line produces a CRASH, need to figure out why?!! */ top[1].b.null = scratch; #endif top[1].b.main = NULL; @@ -327,11 +330,11 @@ convolve_match (const int *lastchoice, unsigned int j; for (j = 0; j < 256; j++) - tot += ((double) input[i + j]) * ((double) lastchoice[j] - avg); + tot += ((double) input[i + j]) * ((double) lastchoice[j] - avg); if (tot > best) - printf ("(%i)", i); + printf ("(%i)", i); if (tot != left[i + 255]) - printf ("!"); + printf ("!"); } printf ("%i\n", p); diff --git a/gst/monoscope/gstmonoscope.c b/gst/monoscope/gstmonoscope.c index f8e82b2f..4582e5bc 100644 --- a/gst/monoscope/gstmonoscope.c +++ b/gst/monoscope/gstmonoscope.c @@ -126,6 +126,7 @@ gst_monoscope_get_type (void) 0, (GInstanceInitFunc) gst_monoscope_init, }; + type = g_type_register_static (GST_TYPE_ELEMENT, "GstMonoscope", &info, 0); } return type; @@ -177,7 +178,7 @@ gst_monoscope_init (GstMonoscope * monoscope) monoscope->first_buffer = TRUE; monoscope->width = 256; monoscope->height = 128; - monoscope->fps = 25.; /* desired frame rate */ + monoscope->fps = 25.; /* desired frame rate */ } static GstPadLinkReturn @@ -216,7 +217,7 @@ gst_monoscope_chain (GstPad * pad, GstData * _data) /* FIXME: should really select the first 1024 samples after the timestamp. */ if (GST_BUFFER_TIMESTAMP (bufin) < monoscope->next_time || samples_in < 1024) { GST_DEBUG ("timestamp is %" G_GUINT64_FORMAT ": want >= %" G_GUINT64_FORMAT, - GST_BUFFER_TIMESTAMP (bufin), monoscope->next_time); + GST_BUFFER_TIMESTAMP (bufin), monoscope->next_time); gst_buffer_unref (bufin); return; } @@ -233,8 +234,8 @@ gst_monoscope_chain (GstPad * pad, GstData * _data) GST_DEBUG ("making new pad"); if (!gst_pad_is_negotiated (monoscope->srcpad)) { if (gst_pad_renegotiate (monoscope->srcpad) <= 0) { - GST_ELEMENT_ERROR (monoscope, CORE, NEGOTIATION, (NULL), (NULL)); - return; + GST_ELEMENT_ERROR (monoscope, CORE, NEGOTIATION, (NULL), (NULL)); + return; } } monoscope->first_buffer = FALSE; diff --git a/gst/monoscope/monoscope.c b/gst/monoscope/monoscope.c index 20a68099..356237e9 100644 --- a/gst/monoscope/monoscope.c +++ b/gst/monoscope/monoscope.c @@ -87,7 +87,7 @@ monoscope_update (struct monoscope_state * stateptr, gint16 data[512]) } stateptr->avgMax += max - (stateptr->avgMax >> 8); if (stateptr->avgMax < max) - stateptr->avgMax = max; /* Avoid overflow */ + stateptr->avgMax = max; /* Avoid overflow */ factor = 0x7fffffff / stateptr->avgMax; /* Keep the scaling sensible. */ if (factor > (1 << 18)) @@ -106,15 +106,15 @@ monoscope_update (struct monoscope_state * stateptr, gint16 data[512]) if ((bar > 0) && (bar < (256 * 128))) { loc = stateptr->display + bar; if (foo < 0) { - for (h = 0; h <= (-foo); h++) { - *loc = stateptr->colors[h]; - loc += 256; - } + for (h = 0; h <= (-foo); h++) { + *loc = stateptr->colors[h]; + loc += 256; + } } else { - for (h = 0; h <= foo; h++) { - *loc = stateptr->colors[h]; - loc -= 256; - } + for (h = 0; h <= foo; h++) { + *loc = stateptr->colors[h]; + loc -= 256; + } } } } @@ -124,7 +124,7 @@ monoscope_update (struct monoscope_state * stateptr, gint16 data[512]) for (h = 0; h < 256; h += 2) { stateptr->display[(i << 8) + h] = stateptr->colors[63]; if (i == 64) - stateptr->display[(i << 8) + h + 1] = stateptr->colors[63]; + stateptr->display[(i << 8) + h + 1] = stateptr->colors[63]; } } for (i = 16; i < 256; i += 16) { diff --git a/gst/qtdemux/qtdemux.c b/gst/qtdemux/qtdemux.c index f7914e24..ad1e3232 100644 --- a/gst/qtdemux/qtdemux.c +++ b/gst/qtdemux/qtdemux.c @@ -173,9 +173,10 @@ gst_qtdemux_get_type (void) NULL, NULL, sizeof (GstQTDemux), 0, (GInstanceInitFunc) gst_qtdemux_init, }; + qtdemux_type = - g_type_register_static (GST_TYPE_ELEMENT, "GstQTDemux", &qtdemux_info, - 0); + g_type_register_static (GST_TYPE_ELEMENT, "GstQTDemux", &qtdemux_info, + 0); } return qtdemux_type; } @@ -254,35 +255,35 @@ gst_qtdemux_src_convert (GstPad * pad, GstFormat src_format, gint64 src_value, switch (src_format) { case GST_FORMAT_TIME: switch (*dest_format) { - case GST_FORMAT_BYTES: - *dest_value = src_value * 1; /* FIXME */ - break; - case GST_FORMAT_DEFAULT: - *dest_value = src_value * 1; /* FIXME */ - break; - default: - res = FALSE; - break; + case GST_FORMAT_BYTES: + *dest_value = src_value * 1; /* FIXME */ + break; + case GST_FORMAT_DEFAULT: + *dest_value = src_value * 1; /* FIXME */ + break; + default: + res = FALSE; + break; } break; case GST_FORMAT_BYTES: switch (*dest_format) { - case GST_FORMAT_TIME: - *dest_value = src_value * 1; /* FIXME */ - break; - default: - res = FALSE; - break; + case GST_FORMAT_TIME: + *dest_value = src_value * 1; /* FIXME */ + break; + default: + res = FALSE; + break; } break; case GST_FORMAT_DEFAULT: switch (*dest_format) { - case GST_FORMAT_TIME: - *dest_value = src_value * 1; /* FIXME */ - break; - default: - res = FALSE; - break; + case GST_FORMAT_TIME: + *dest_value = src_value * 1; /* FIXME */ + break; + default: + res = FALSE; + break; } break; default: @@ -326,34 +327,34 @@ gst_qtdemux_handle_src_query (GstPad * pad, GstQueryType type, switch (type) { case GST_QUERY_TOTAL: switch (*format) { - case GST_FORMAT_TIME: - *value = 0; /* FIXME */ - break; - case GST_FORMAT_BYTES: - *value = 0; /* FIXME */ - break; - case GST_FORMAT_DEFAULT: - *value = 0; /* FIXME */ - break; - default: - res = FALSE; - break; + case GST_FORMAT_TIME: + *value = 0; /* FIXME */ + break; + case GST_FORMAT_BYTES: + *value = 0; /* FIXME */ + break; + case GST_FORMAT_DEFAULT: + *value = 0; /* FIXME */ + break; + default: + res = FALSE; + break; } break; case GST_QUERY_POSITION: switch (*format) { - case GST_FORMAT_TIME: - *value = 0; /* FIXME */ - break; - case GST_FORMAT_BYTES: - *value = 0; /* FIXME */ - break; - case GST_FORMAT_DEFAULT: - *value = 0; /* FIXME */ - break; - default: - res = FALSE; - break; + case GST_FORMAT_TIME: + *value = 0; /* FIXME */ + break; + case GST_FORMAT_BYTES: + *value = 0; /* FIXME */ + break; + case GST_FORMAT_DEFAULT: + *value = 0; /* FIXME */ + break; + default: + res = FALSE; + break; } break; default: @@ -376,19 +377,19 @@ gst_qtdemux_handle_src_event (GstPad * pad, GstEvent * event) GST_DEBUG ("seek format %d", GST_EVENT_SEEK_FORMAT (event)); switch (GST_EVENT_SEEK_FORMAT (event)) { - case GST_FORMAT_BYTES: - case GST_FORMAT_DEFAULT: - case GST_FORMAT_TIME: - { - gint64 desired_offset = GST_EVENT_SEEK_OFFSET (event); - - GST_DEBUG ("seeking to %" G_GINT64_FORMAT, desired_offset); - - res = FALSE; - } - default: - res = FALSE; - break; + case GST_FORMAT_BYTES: + case GST_FORMAT_DEFAULT: + case GST_FORMAT_TIME: + { + gint64 desired_offset = GST_EVENT_SEEK_OFFSET (event); + + GST_DEBUG ("seeking to %" G_GINT64_FORMAT, desired_offset); + + res = FALSE; + } + default: + res = FALSE; + break; } default: res = FALSE; @@ -509,14 +510,14 @@ gst_qtdemux_loop_header (GstElement * element) case QTDEMUX_STATE_HEADER: { do { - ret = gst_bytestream_peek_bytes (qtdemux->bs, &data, 16); - if (ret < 16) { - if (!gst_qtdemux_handle_sink_event (qtdemux)) { - return; - } - } else { - break; - } + ret = gst_bytestream_peek_bytes (qtdemux->bs, &data, 16); + if (ret < 16) { + if (!gst_qtdemux_handle_sink_event (qtdemux)) { + return; + } + } else { + break; + } } while (1); length = GUINT32_FROM_BE (*(guint32 *) data); @@ -525,58 +526,58 @@ gst_qtdemux_loop_header (GstElement * element) GST_DEBUG ("fourcc " GST_FOURCC_FORMAT, GST_FOURCC_ARGS (fourcc)); if (length == 0) { - length = gst_bytestream_length (qtdemux->bs) - cur_offset; + length = gst_bytestream_length (qtdemux->bs) - cur_offset; } if (length == 1) { - guint32 length1, length2; + guint32 length1, length2; - length1 = GUINT32_FROM_BE (*(guint32 *) (data + 8)); - GST_DEBUG ("length1 %08x", length1); - length2 = GUINT32_FROM_BE (*(guint32 *) (data + 12)); - GST_DEBUG ("length2 %08x", length2); + length1 = GUINT32_FROM_BE (*(guint32 *) (data + 8)); + GST_DEBUG ("length1 %08x", length1); + length2 = GUINT32_FROM_BE (*(guint32 *) (data + 12)); + GST_DEBUG ("length2 %08x", length2); - length = length2; + length = length2; } switch (fourcc) { - case GST_MAKE_FOURCC ('m', 'd', 'a', 't'): - case GST_MAKE_FOURCC ('f', 'r', 'e', 'e'): - case GST_MAKE_FOURCC ('w', 'i', 'd', 'e'): - case GST_MAKE_FOURCC ('P', 'I', 'C', 'T'): - case GST_MAKE_FOURCC ('p', 'n', 'o', 't'): - break; - case GST_MAKE_FOURCC ('m', 'o', 'o', 'v'): - { - GstBuffer *moov; - - do { - ret = gst_bytestream_read (qtdemux->bs, &moov, length); - if (ret < length) { - GST_DEBUG ("read failed (%d < %d)", ret, length); - if (!gst_qtdemux_handle_sink_event (qtdemux)) { - return; - } - } else { - break; - } - } while (1); - - qtdemux_parse_moov (qtdemux, GST_BUFFER_DATA (moov), length); - if (1) - qtdemux_node_dump (qtdemux, qtdemux->moov_node); - qtdemux_parse_tree (qtdemux); - qtdemux->state = QTDEMUX_STATE_MOVIE; - break; - } - default: - { - GST_LOG ("unknown %08x '" GST_FOURCC_FORMAT "' at %d\n", - fourcc, GST_FOURCC_ARGS (fourcc), cur_offset); - break; - } + case GST_MAKE_FOURCC ('m', 'd', 'a', 't'): + case GST_MAKE_FOURCC ('f', 'r', 'e', 'e'): + case GST_MAKE_FOURCC ('w', 'i', 'd', 'e'): + case GST_MAKE_FOURCC ('P', 'I', 'C', 'T'): + case GST_MAKE_FOURCC ('p', 'n', 'o', 't'): + break; + case GST_MAKE_FOURCC ('m', 'o', 'o', 'v'): + { + GstBuffer *moov; + + do { + ret = gst_bytestream_read (qtdemux->bs, &moov, length); + if (ret < length) { + GST_DEBUG ("read failed (%d < %d)", ret, length); + if (!gst_qtdemux_handle_sink_event (qtdemux)) { + return; + } + } else { + break; + } + } while (1); + + qtdemux_parse_moov (qtdemux, GST_BUFFER_DATA (moov), length); + if (1) + qtdemux_node_dump (qtdemux, qtdemux->moov_node); + qtdemux_parse_tree (qtdemux); + qtdemux->state = QTDEMUX_STATE_MOVIE; + break; + } + default: + { + GST_LOG ("unknown %08x '" GST_FOURCC_FORMAT "' at %d\n", + fourcc, GST_FOURCC_ARGS (fourcc), cur_offset); + break; + } } ret = gst_bytestream_seek (qtdemux->bs, cur_offset + length, - GST_SEEK_METHOD_SET); + GST_SEEK_METHOD_SET); qtdemux->offset = cur_offset + length; GST_DEBUG ("seek returned %d\n", ret); break; @@ -586,14 +587,14 @@ gst_qtdemux_loop_header (GstElement * element) guint8 *data; do { - ret = gst_bytestream_peek_bytes (qtdemux->bs, &data, 1); - if (ret < 1) { - if (!gst_qtdemux_handle_sink_event (qtdemux)) { - return; - } - } else { - break; - } + ret = gst_bytestream_peek_bytes (qtdemux->bs, &data, 1); + if (ret < 1) { + if (!gst_qtdemux_handle_sink_event (qtdemux)) { + return; + } + } else { + break; + } } while (TRUE); gst_element_set_eos (element); @@ -612,25 +613,25 @@ gst_qtdemux_loop_header (GstElement * element) min_time = G_MAXUINT64; for (i = 0; i < qtdemux->n_streams; i++) { - stream = qtdemux->streams[i]; + stream = qtdemux->streams[i]; - if (stream->sample_index < stream->n_samples && - stream->samples[stream->sample_index].timestamp < min_time) { - min_time = stream->samples[stream->sample_index].timestamp; - index = i; - } + if (stream->sample_index < stream->n_samples && + stream->samples[stream->sample_index].timestamp < min_time) { + min_time = stream->samples[stream->sample_index].timestamp; + index = i; + } } if (index == -1) { - for (i = 0; i < qtdemux->n_streams; i++) { - gst_pad_push (qtdemux->streams[i]->pad, - GST_DATA (gst_event_new (GST_EVENT_EOS))); - } - ret = gst_bytestream_seek (qtdemux->bs, 0, GST_SEEK_METHOD_END); - GST_DEBUG ("seek returned %d", ret); - - qtdemux->state = QTDEMUX_STATE_SEEKING_EOS; - return; + for (i = 0; i < qtdemux->n_streams; i++) { + gst_pad_push (qtdemux->streams[i]->pad, + GST_DATA (gst_event_new (GST_EVENT_EOS))); + } + ret = gst_bytestream_seek (qtdemux->bs, 0, GST_SEEK_METHOD_END); + GST_DEBUG ("seek returned %d", ret); + + qtdemux->state = QTDEMUX_STATE_SEEKING_EOS; + return; } stream = qtdemux->streams[index]; @@ -639,53 +640,53 @@ gst_qtdemux_loop_header (GstElement * element) size = stream->samples[stream->sample_index].size; GST_INFO - ("pushing from stream %d, sample_index=%d offset=%d size=%d timestamp=%lld", - index, stream->sample_index, offset, size, - stream->samples[stream->sample_index].timestamp); + ("pushing from stream %d, sample_index=%d offset=%d size=%d timestamp=%lld", + index, stream->sample_index, offset, size, + stream->samples[stream->sample_index].timestamp); cur_offset = gst_bytestream_tell (qtdemux->bs); if (offset != cur_offset) { - GST_DEBUG ("seeking to offset %d", offset); - GST_LOG ("seeking to offset %d\n", offset); - ret = gst_bytestream_seek (qtdemux->bs, offset, GST_SEEK_METHOD_SET); - GST_DEBUG ("seek returned %d", ret); - return; + GST_DEBUG ("seeking to offset %d", offset); + GST_LOG ("seeking to offset %d\n", offset); + ret = gst_bytestream_seek (qtdemux->bs, offset, GST_SEEK_METHOD_SET); + GST_DEBUG ("seek returned %d", ret); + return; } GST_DEBUG ("reading %d bytes\n", size); buf = NULL; do { - ret = gst_bytestream_read (qtdemux->bs, &buf, size); - if (ret < size) { - GST_DEBUG ("read failed (%d < %d)", ret, size); - if (!gst_qtdemux_handle_sink_event (qtdemux)) { - return; - } - } else { - break; - } + ret = gst_bytestream_read (qtdemux->bs, &buf, size); + if (ret < size) { + GST_DEBUG ("read failed (%d < %d)", ret, size); + if (!gst_qtdemux_handle_sink_event (qtdemux)) { + return; + } + } else { + break; + } } while (TRUE); if (buf) { - /* hum... */ - if (stream->subtype == GST_MAKE_FOURCC ('v', 'i', 'd', 'e')) { - float fps = - 1. * GST_SECOND / stream->samples[stream->sample_index].duration; - if (fps != stream->fps) { - gst_caps_set_simple (stream->caps, "framerate", G_TYPE_DOUBLE, fps, - NULL); - stream->fps = fps; - gst_pad_set_explicit_caps (stream->pad, stream->caps); - } - } - - GST_BUFFER_TIMESTAMP (buf) = - stream->samples[stream->sample_index].timestamp; - GST_BUFFER_DURATION (buf) = - stream->samples[stream->sample_index].duration; - gst_pad_push (stream->pad, GST_DATA (buf)); - - GST_DEBUG ("pushing buffer on %" GST_PTR_FORMAT, stream->pad); + /* hum... */ + if (stream->subtype == GST_MAKE_FOURCC ('v', 'i', 'd', 'e')) { + float fps = + 1. * GST_SECOND / stream->samples[stream->sample_index].duration; + if (fps != stream->fps) { + gst_caps_set_simple (stream->caps, "framerate", G_TYPE_DOUBLE, fps, + NULL); + stream->fps = fps; + gst_pad_set_explicit_caps (stream->pad, stream->caps); + } + } + + GST_BUFFER_TIMESTAMP (buf) = + stream->samples[stream->sample_index].timestamp; + GST_BUFFER_DURATION (buf) = + stream->samples[stream->sample_index].duration; + gst_pad_push (stream->pad, GST_DATA (buf)); + + GST_DEBUG ("pushing buffer on %" GST_PTR_FORMAT, stream->pad); } stream->sample_index++; break; @@ -704,28 +705,28 @@ gst_qtdemux_add_stream (GstQTDemux * qtdemux, QtDemuxStream * stream) gchar *name = g_strdup_printf ("video_%02d", qtdemux->n_video_streams); stream->pad = - gst_pad_new_from_template (gst_static_pad_template_get - (&gst_qtdemux_videosrc_template), name); + gst_pad_new_from_template (gst_static_pad_template_get + (&gst_qtdemux_videosrc_template), name); g_free (name); stream->fps = 1. * GST_SECOND / stream->samples[0].duration; if (stream->caps) { gst_caps_set_simple (stream->caps, - "width", G_TYPE_INT, stream->width, - "height", G_TYPE_INT, stream->height, - "framerate", G_TYPE_DOUBLE, stream->fps, NULL); + "width", G_TYPE_INT, stream->width, + "height", G_TYPE_INT, stream->height, + "framerate", G_TYPE_DOUBLE, stream->fps, NULL); } qtdemux->n_video_streams++; } else { gchar *name = g_strdup_printf ("audio_%02d", qtdemux->n_audio_streams); stream->pad = - gst_pad_new_from_template (gst_static_pad_template_get - (&gst_qtdemux_audiosrc_template), name); + gst_pad_new_from_template (gst_static_pad_template_get + (&gst_qtdemux_audiosrc_template), name); g_free (name); if (stream->caps) { gst_caps_set_simple (stream->caps, - "rate", G_TYPE_INT, (int) stream->rate, - "channels", G_TYPE_INT, stream->n_channels, NULL); + "rate", G_TYPE_INT, (int) stream->rate, + "channels", G_TYPE_INT, stream->n_channels, NULL); } qtdemux->n_audio_streams++; } @@ -819,7 +820,7 @@ QtNodeType qt_node_types[] = { qtdemux_dump_mvhd}, {FOURCC_clip, "clipping", QT_CONTAINER,}, {FOURCC_trak, "track", QT_CONTAINER,}, - {FOURCC_udta, "user data", 0,}, /* special container */ + {FOURCC_udta, "user data", 0,}, /* special container */ {FOURCC_ctab, "color table", 0,}, {FOURCC_tkhd, "track header", 0, qtdemux_dump_tkhd}, @@ -832,7 +833,7 @@ QtNodeType qt_node_types[] = { {FOURCC_load, "track load settings", 0,}, {FOURCC_tref, "track reference", QT_CONTAINER,}, {FOURCC_imap, "track input map", QT_CONTAINER,}, - {FOURCC___in, "track input", 0,}, /* special container */ + {FOURCC___in, "track input", 0,}, /* special container */ {FOURCC___ty, "input type", 0,}, {FOURCC_mdia, "media", QT_CONTAINER}, {FOURCC_mdhd, "media header", 0, @@ -940,7 +941,7 @@ qtdemux_parse_moov (GstQTDemux * qtdemux, void *buffer, int length) cmvd = qtdemux_tree_get_child_by_type (cmov, FOURCC_cmvd); if (QTDEMUX_FOURCC_GET (dcom->data + 8) == GST_MAKE_FOURCC ('z', 'l', 'i', - 'b')) { + 'b')) { int uncompressed_length; int compressed_length; void *buf; @@ -950,7 +951,7 @@ qtdemux_parse_moov (GstQTDemux * qtdemux, void *buffer, int length) GST_LOG ("length = %d\n", uncompressed_length); buf = qtdemux_inflate (cmvd->data + 12, compressed_length, - uncompressed_length); + uncompressed_length); qtdemux->moov_node_compressed = qtdemux->moov_node; qtdemux->moov_node = g_node_new (buf); @@ -990,8 +991,8 @@ qtdemux_parse (GstQTDemux * qtdemux, GNode * node, void *buffer, int length) GNode *child; if (buf + 8 >= end) { - /* FIXME: get annoyed */ - GST_LOG ("buffer overrun\n"); + /* FIXME: get annoyed */ + GST_LOG ("buffer overrun\n"); } len = QTDEMUX_GUINT32_GET (buf); @@ -1011,24 +1012,24 @@ qtdemux_parse (GstQTDemux * qtdemux, GNode * node, void *buffer, int length) GST_LOG ("length = %d\n", uncompressed_length); buf = - qtdemux_inflate (buffer + 12, node_length - 12, uncompressed_length); + qtdemux_inflate (buffer + 12, node_length - 12, uncompressed_length); end = buf + uncompressed_length; while (buf < end) { - GNode *child; - guint32 len; + GNode *child; + guint32 len; - if (buf + 8 >= end) { - /* FIXME: get annoyed */ - GST_LOG ("buffer overrun\n"); - } - len = QTDEMUX_GUINT32_GET (buf); + if (buf + 8 >= end) { + /* FIXME: get annoyed */ + GST_LOG ("buffer overrun\n"); + } + len = QTDEMUX_GUINT32_GET (buf); - child = g_node_new (buf); - g_node_append (node, child); - qtdemux_parse (qtdemux, child, buf, len); + child = g_node_new (buf); + g_node_append (node, child); + qtdemux_parse (qtdemux, child, buf, len); - buf += len; + buf += len; } } #endif @@ -1150,11 +1151,11 @@ qtdemux_dump_elst (GstQTDemux * qtdemux, void *buffer, int depth) n = QTDEMUX_GUINT32_GET (buffer + 12); for (i = 0; i < n; i++) { GST_LOG ("%*s track dur: %u\n", depth, "", - QTDEMUX_GUINT32_GET (buffer + 16 + i * 12)); + QTDEMUX_GUINT32_GET (buffer + 16 + i * 12)); GST_LOG ("%*s media time: %u\n", depth, "", - QTDEMUX_GUINT32_GET (buffer + 20 + i * 12)); + QTDEMUX_GUINT32_GET (buffer + 20 + i * 12)); GST_LOG ("%*s media rate: %g\n", depth, "", - QTDEMUX_FP32_GET (buffer + 24 + i * 12)); + QTDEMUX_FP32_GET (buffer + 24 + i * 12)); } } @@ -1222,9 +1223,9 @@ qtdemux_dump_dref (GstQTDemux * qtdemux, void *buffer, int depth) offset = 16; for (i = 0; i < n; i++) { GST_LOG ("%*s size: %u\n", depth, "", - QTDEMUX_GUINT32_GET (buffer + offset)); + QTDEMUX_GUINT32_GET (buffer + offset)); GST_LOG ("%*s type: " GST_FOURCC_FORMAT "\n", depth, "", - GST_FOURCC_ARGS (QTDEMUX_FOURCC_GET (buffer + offset + 4))); + GST_FOURCC_ARGS (QTDEMUX_FOURCC_GET (buffer + offset + 4))); offset += QTDEMUX_GUINT32_GET (buffer + offset); } } @@ -1244,39 +1245,39 @@ qtdemux_dump_stsd (GstQTDemux * qtdemux, void *buffer, int depth) offset = 16; for (i = 0; i < n; i++) { GST_LOG ("%*s size: %u\n", depth, "", - QTDEMUX_GUINT32_GET (buffer + offset)); + QTDEMUX_GUINT32_GET (buffer + offset)); GST_LOG ("%*s type: " GST_FOURCC_FORMAT "\n", depth, "", - GST_FOURCC_ARGS (QTDEMUX_FOURCC_GET (buffer + offset + 4))); + GST_FOURCC_ARGS (QTDEMUX_FOURCC_GET (buffer + offset + 4))); GST_LOG ("%*s data reference:%d\n", depth, "", - QTDEMUX_GUINT16_GET (buffer + offset + 14)); + QTDEMUX_GUINT16_GET (buffer + offset + 14)); GST_LOG ("%*s version/rev.: %08x\n", depth, "", - QTDEMUX_GUINT32_GET (buffer + offset + 16)); + QTDEMUX_GUINT32_GET (buffer + offset + 16)); GST_LOG ("%*s vendor: " GST_FOURCC_FORMAT "\n", depth, "", - GST_FOURCC_ARGS (QTDEMUX_FOURCC_GET (buffer + offset + 20))); + GST_FOURCC_ARGS (QTDEMUX_FOURCC_GET (buffer + offset + 20))); GST_LOG ("%*s temporal qual: %u\n", depth, "", - QTDEMUX_GUINT32_GET (buffer + offset + 24)); + QTDEMUX_GUINT32_GET (buffer + offset + 24)); GST_LOG ("%*s spatial qual: %u\n", depth, "", - QTDEMUX_GUINT32_GET (buffer + offset + 28)); + QTDEMUX_GUINT32_GET (buffer + offset + 28)); GST_LOG ("%*s width: %u\n", depth, "", - QTDEMUX_GUINT16_GET (buffer + offset + 32)); + QTDEMUX_GUINT16_GET (buffer + offset + 32)); GST_LOG ("%*s height: %u\n", depth, "", - QTDEMUX_GUINT16_GET (buffer + offset + 34)); + QTDEMUX_GUINT16_GET (buffer + offset + 34)); GST_LOG ("%*s horiz. resol: %g\n", depth, "", - QTDEMUX_FP32_GET (buffer + offset + 36)); + QTDEMUX_FP32_GET (buffer + offset + 36)); GST_LOG ("%*s vert. resol.: %g\n", depth, "", - QTDEMUX_FP32_GET (buffer + offset + 40)); + QTDEMUX_FP32_GET (buffer + offset + 40)); GST_LOG ("%*s data size: %u\n", depth, "", - QTDEMUX_GUINT32_GET (buffer + offset + 44)); + QTDEMUX_GUINT32_GET (buffer + offset + 44)); GST_LOG ("%*s frame count: %u\n", depth, "", - QTDEMUX_GUINT16_GET (buffer + offset + 48)); + QTDEMUX_GUINT16_GET (buffer + offset + 48)); GST_LOG ("%*s compressor: %*s\n", depth, "", - QTDEMUX_GUINT8_GET (buffer + offset + 49), - (char *) (buffer + offset + 51)); + QTDEMUX_GUINT8_GET (buffer + offset + 49), + (char *) (buffer + offset + 51)); GST_LOG ("%*s depth: %u\n", depth, "", - QTDEMUX_GUINT16_GET (buffer + offset + 82)); + QTDEMUX_GUINT16_GET (buffer + offset + 82)); GST_LOG ("%*s color table ID:%u\n", depth, "", - QTDEMUX_GUINT16_GET (buffer + offset + 84)); + QTDEMUX_GUINT16_GET (buffer + offset + 84)); offset += QTDEMUX_GUINT32_GET (buffer + offset); } @@ -1297,9 +1298,9 @@ qtdemux_dump_stts (GstQTDemux * qtdemux, void *buffer, int depth) offset = 16; for (i = 0; i < n; i++) { GST_LOG ("%*s count: %u\n", depth, "", - QTDEMUX_GUINT32_GET (buffer + offset)); + QTDEMUX_GUINT32_GET (buffer + offset)); GST_LOG ("%*s duration: %u\n", depth, "", - QTDEMUX_GUINT32_GET (buffer + offset + 4)); + QTDEMUX_GUINT32_GET (buffer + offset + 4)); offset += 8; } @@ -1320,7 +1321,7 @@ qtdemux_dump_stss (GstQTDemux * qtdemux, void *buffer, int depth) offset = 16; for (i = 0; i < n; i++) { GST_LOG ("%*s sample: %u\n", depth, "", - QTDEMUX_GUINT32_GET (buffer + offset)); + QTDEMUX_GUINT32_GET (buffer + offset)); offset += 4; } @@ -1341,11 +1342,11 @@ qtdemux_dump_stsc (GstQTDemux * qtdemux, void *buffer, int depth) offset = 16; for (i = 0; i < n; i++) { GST_LOG ("%*s first chunk: %u\n", depth, "", - QTDEMUX_GUINT32_GET (buffer + offset)); + QTDEMUX_GUINT32_GET (buffer + offset)); GST_LOG ("%*s sample per ch: %u\n", depth, "", - QTDEMUX_GUINT32_GET (buffer + offset + 4)); + QTDEMUX_GUINT32_GET (buffer + offset + 4)); GST_LOG ("%*s sample desc id:%08x\n", depth, "", - QTDEMUX_GUINT32_GET (buffer + offset + 8)); + QTDEMUX_GUINT32_GET (buffer + offset + 8)); offset += 12; } @@ -1366,12 +1367,12 @@ qtdemux_dump_stsz (GstQTDemux * qtdemux, void *buffer, int depth) sample_size = QTDEMUX_GUINT32_GET (buffer + 12); if (sample_size == 0) { GST_LOG ("%*s n entries: %d\n", depth, "", - QTDEMUX_GUINT32_GET (buffer + 16)); + QTDEMUX_GUINT32_GET (buffer + 16)); n = QTDEMUX_GUINT32_GET (buffer + 16); offset = 20; for (i = 0; i < n; i++) { GST_LOG ("%*s sample size: %u\n", depth, "", - QTDEMUX_GUINT32_GET (buffer + offset)); + QTDEMUX_GUINT32_GET (buffer + offset)); offset += 4; } @@ -1393,7 +1394,7 @@ qtdemux_dump_stco (GstQTDemux * qtdemux, void *buffer, int depth) offset = 16; for (i = 0; i < n; i++) { GST_LOG ("%*s chunk offset: %u\n", depth, "", - QTDEMUX_GUINT32_GET (buffer + offset)); + QTDEMUX_GUINT32_GET (buffer + offset)); offset += 4; } @@ -1414,7 +1415,7 @@ qtdemux_dump_co64 (GstQTDemux * qtdemux, void *buffer, int depth) offset = 16; for (i = 0; i < n; i++) { GST_LOG ("%*s chunk offset: %" G_GUINT64_FORMAT "\n", depth, "", - QTDEMUX_GUINT64_GET (buffer + offset)); + QTDEMUX_GUINT64_GET (buffer + offset)); offset += 8; } @@ -1569,58 +1570,58 @@ qtdemux_parse_trak (GstQTDemux * qtdemux, GNode * trak) if (stream->subtype == FOURCC_vide) { offset = 16; GST_LOG ("st type: " GST_FOURCC_FORMAT "\n", - GST_FOURCC_ARGS (QTDEMUX_FOURCC_GET (stsd->data + offset + 4))); + GST_FOURCC_ARGS (QTDEMUX_FOURCC_GET (stsd->data + offset + 4))); stream->width = QTDEMUX_GUINT16_GET (stsd->data + offset + 32); stream->height = QTDEMUX_GUINT16_GET (stsd->data + offset + 34); - stream->fps = 0.; /* this is filled in later */ + stream->fps = 0.; /* this is filled in later */ GST_LOG ("frame count: %u\n", - QTDEMUX_GUINT16_GET (stsd->data + offset + 48)); + QTDEMUX_GUINT16_GET (stsd->data + offset + 48)); stream->caps = qtdemux_video_caps (qtdemux, - QTDEMUX_FOURCC_GET (stsd->data + offset + 4), stsd->data); + QTDEMUX_FOURCC_GET (stsd->data + offset + 4), stsd->data); GST_INFO ("type " GST_FOURCC_FORMAT " caps %" GST_PTR_FORMAT "\n", - GST_FOURCC_ARGS (QTDEMUX_FOURCC_GET (stsd->data + offset + 4)), - stream->caps); + GST_FOURCC_ARGS (QTDEMUX_FOURCC_GET (stsd->data + offset + 4)), + stream->caps); } else if (stream->subtype == FOURCC_soun) { int version, samplesize; GST_LOG ("st type: " GST_FOURCC_FORMAT "\n", - GST_FOURCC_ARGS (QTDEMUX_FOURCC_GET (stsd->data + 16 + 4))); + GST_FOURCC_ARGS (QTDEMUX_FOURCC_GET (stsd->data + 16 + 4))); offset = 32; GST_LOG ("version/rev: %08x\n", - QTDEMUX_GUINT32_GET (stsd->data + offset)); + QTDEMUX_GUINT32_GET (stsd->data + offset)); version = QTDEMUX_GUINT32_GET (stsd->data + offset); GST_LOG ("vendor: %08x\n", - QTDEMUX_GUINT32_GET (stsd->data + offset + 4)); + QTDEMUX_GUINT32_GET (stsd->data + offset + 4)); GST_LOG ("n_channels: %d\n", - QTDEMUX_GUINT16_GET (stsd->data + offset + 8)); + QTDEMUX_GUINT16_GET (stsd->data + offset + 8)); stream->n_channels = QTDEMUX_GUINT16_GET (stsd->data + offset + 8); GST_LOG ("sample_size: %d\n", - QTDEMUX_GUINT16_GET (stsd->data + offset + 10)); + QTDEMUX_GUINT16_GET (stsd->data + offset + 10)); samplesize = QTDEMUX_GUINT16_GET (stsd->data + offset + 10); GST_LOG ("compression_id: %d\n", - QTDEMUX_GUINT16_GET (stsd->data + offset + 12)); + QTDEMUX_GUINT16_GET (stsd->data + offset + 12)); GST_LOG ("packet size: %d\n", - QTDEMUX_GUINT16_GET (stsd->data + offset + 14)); + QTDEMUX_GUINT16_GET (stsd->data + offset + 14)); GST_LOG ("sample rate: %g\n", - QTDEMUX_FP32_GET (stsd->data + offset + 16)); + QTDEMUX_FP32_GET (stsd->data + offset + 16)); stream->rate = QTDEMUX_FP32_GET (stsd->data + offset + 16); offset = 52; if (version == 0x00010000) { GST_LOG ("samples/packet: %d\n", - QTDEMUX_GUINT32_GET (stsd->data + offset)); + QTDEMUX_GUINT32_GET (stsd->data + offset)); stream->samples_per_packet = QTDEMUX_GUINT32_GET (stsd->data + offset); GST_LOG ("bytes/packet: %d\n", - QTDEMUX_GUINT32_GET (stsd->data + offset + 4)); + QTDEMUX_GUINT32_GET (stsd->data + offset + 4)); GST_LOG ("bytes/frame: %d\n", - QTDEMUX_GUINT32_GET (stsd->data + offset + 8)); + QTDEMUX_GUINT32_GET (stsd->data + offset + 8)); stream->bytes_per_frame = QTDEMUX_GUINT32_GET (stsd->data + offset + 8); GST_LOG ("bytes/sample: %d\n", - QTDEMUX_GUINT32_GET (stsd->data + offset + 12)); + QTDEMUX_GUINT32_GET (stsd->data + offset + 12)); offset = 68; } else { stream->bytes_per_frame = stream->n_channels * samplesize / 8; @@ -1628,12 +1629,12 @@ qtdemux_parse_trak (GstQTDemux * qtdemux, GNode * trak) } stream->caps = qtdemux_audio_caps (qtdemux, - QTDEMUX_FOURCC_GET (stsd->data + 16 + 4), - (QTDEMUX_GUINT32_GET (stsd->data) > - offset) ? stsd->data + offset : NULL); + QTDEMUX_FOURCC_GET (stsd->data + 16 + 4), + (QTDEMUX_GUINT32_GET (stsd->data) > + offset) ? stsd->data + offset : NULL); GST_INFO ("type " GST_FOURCC_FORMAT " caps %" GST_PTR_FORMAT "\n", - GST_FOURCC_ARGS (QTDEMUX_FOURCC_GET (stsd->data + 16 + 4)), - stream->caps); + GST_FOURCC_ARGS (QTDEMUX_FOURCC_GET (stsd->data + 16 + 4)), + stream->caps); } else { GST_LOG ("unknown subtype\n"); return; @@ -1672,28 +1673,28 @@ qtdemux_parse_trak (GstQTDemux * qtdemux, GNode * trak) first_chunk = QTDEMUX_GUINT32_GET (stsc->data + 16 + i * 12 + 0) - 1; if (i == n_samples_per_chunk - 1) { - last_chunk = INT_MAX; + last_chunk = INT_MAX; } else { - last_chunk = QTDEMUX_GUINT32_GET (stsc->data + 16 + i * 12 + 12) - 1; + last_chunk = QTDEMUX_GUINT32_GET (stsc->data + 16 + i * 12 + 12) - 1; } samples_per_chunk = QTDEMUX_GUINT32_GET (stsc->data + 16 + i * 12 + 4); for (j = first_chunk; j < last_chunk; j++) { - int chunk_offset; - - if (stco) { - chunk_offset = QTDEMUX_GUINT32_GET (stco->data + 16 + j * 4); - } else { - chunk_offset = QTDEMUX_GUINT64_GET (co64->data + 16 + j * 8); - } - for (k = 0; k < samples_per_chunk; k++) { - samples[index].chunk = j; - samples[index].offset = chunk_offset; - chunk_offset += samples[index].size; - index++; - if (index >= n_samples) - goto done; - } + int chunk_offset; + + if (stco) { + chunk_offset = QTDEMUX_GUINT32_GET (stco->data + 16 + j * 4); + } else { + chunk_offset = QTDEMUX_GUINT64_GET (co64->data + 16 + j * 8); + } + for (k = 0; k < samples_per_chunk; k++) { + samples[index].chunk = j; + samples[index].offset = chunk_offset; + chunk_offset += samples[index].size; + index++; + if (index >= n_samples) + goto done; + } } } done: @@ -1710,11 +1711,11 @@ qtdemux_parse_trak (GstQTDemux * qtdemux, GNode * trak) duration = QTDEMUX_GUINT32_GET (stts->data + 16 + 8 * i + 4); time = (GST_SECOND * duration) / stream->timescale; for (j = 0; j < n; j++) { - //GST_INFO("moo %lld", timestamp); - samples[index].timestamp = timestamp; - samples[index].duration = time; - timestamp += time; - index++; + //GST_INFO("moo %lld", timestamp); + samples[index].timestamp = timestamp; + samples[index].duration = time; + timestamp += time; + index++; } } } else { @@ -1744,40 +1745,40 @@ qtdemux_parse_trak (GstQTDemux * qtdemux, GNode * trak) first_chunk = QTDEMUX_GUINT32_GET (stsc->data + 16 + i * 12 + 0) - 1; if (i == n_samples - 1) { - last_chunk = INT_MAX; + last_chunk = INT_MAX; } else { - last_chunk = QTDEMUX_GUINT32_GET (stsc->data + 16 + i * 12 + 12) - 1; + last_chunk = QTDEMUX_GUINT32_GET (stsc->data + 16 + i * 12 + 12) - 1; } samples_per_chunk = QTDEMUX_GUINT32_GET (stsc->data + 16 + i * 12 + 4); for (j = first_chunk; j < last_chunk; j++) { - int chunk_offset; - - if (j >= n_samples) - goto done2; - if (stco) { - chunk_offset = QTDEMUX_GUINT32_GET (stco->data + 16 + j * 4); - } else { - chunk_offset = QTDEMUX_GUINT64_GET (co64->data + 16 + j * 8); - } - samples[j].chunk = j; - samples[j].offset = chunk_offset; - samples[j].size = - samples_per_chunk * stream->bytes_per_frame / - stream->samples_per_packet; - samples[j].duration = - samples_per_chunk * GST_SECOND / (stream->rate / 2); - samples[j].timestamp = timestamp; - timestamp += (samples_per_chunk * GST_SECOND) / stream->rate; + int chunk_offset; + + if (j >= n_samples) + goto done2; + if (stco) { + chunk_offset = QTDEMUX_GUINT32_GET (stco->data + 16 + j * 4); + } else { + chunk_offset = QTDEMUX_GUINT64_GET (co64->data + 16 + j * 8); + } + samples[j].chunk = j; + samples[j].offset = chunk_offset; + samples[j].size = + samples_per_chunk * stream->bytes_per_frame / + stream->samples_per_packet; + samples[j].duration = + samples_per_chunk * GST_SECOND / (stream->rate / 2); + samples[j].timestamp = timestamp; + timestamp += (samples_per_chunk * GST_SECOND) / stream->rate; #if 0 - GST_INFO ("moo samples_per_chunk=%d rate=%d dur=%lld %lld", - (int) samples_per_chunk, - (int) stream->rate, - (long long) ((samples_per_chunk * GST_SECOND) / stream->rate), - (long long) timestamp); + GST_INFO ("moo samples_per_chunk=%d rate=%d dur=%lld %lld", + (int) samples_per_chunk, + (int) stream->rate, + (long long) ((samples_per_chunk * GST_SECOND) / stream->rate), + (long long) timestamp); #endif - samples[j].sample_index = sample_index; - sample_index += samples_per_chunk; + samples[j].sample_index = sample_index; + sample_index += samples_per_chunk; } } /* @@ -1809,8 +1810,8 @@ done2: #if 0 for (i = 0; i < n_samples; i++) { GST_LOG ("%d: %d %d %d %d %" G_GUINT64_FORMAT "\n", i, - samples[i].sample_index, samples[i].chunk, - samples[i].offset, samples[i].size, samples[i].timestamp); + samples[i].sample_index, samples[i].chunk, + samples[i].offset, samples[i].size, samples[i].timestamp); if (i > 10) break; } @@ -1836,53 +1837,53 @@ qtdemux_video_caps (GstQTDemux * qtdemux, guint32 fourcc, return gst_caps_from_string ("image/jpeg"); case GST_MAKE_FOURCC ('S', 'V', 'Q', '3'): if (stsd_data != NULL) { - gst_getbits_t gb; - gint halfpel_flag; - gint thirdpel_flag; - gint unknown_svq3_flag; - gint low_delay; - gint size; + gst_getbits_t gb; + gint halfpel_flag; + gint thirdpel_flag; + gint unknown_svq3_flag; + gint low_delay; + gint size; - size = QTDEMUX_GUINT32_GET (stsd_data + 16); + size = QTDEMUX_GUINT32_GET (stsd_data + 16); - gst_getbits_init (&gb, NULL, NULL); - gst_getbits_newbuf (&gb, (unsigned char *) stsd_data + 98 + 16 + 4, - (size - 102 + 16)); + gst_getbits_init (&gb, NULL, NULL); + gst_getbits_newbuf (&gb, (unsigned char *) stsd_data + 98 + 16 + 4, + (size - 102 + 16)); - /* Infos ripped from ffmpeg see libavcodec/svq3.c */ + /* Infos ripped from ffmpeg see libavcodec/svq3.c */ - /* 'frame size code' and optional 'width, height' */ - if (gst_getbitsn (&gb, 3) == 7) { - gst_getbitsn (&gb, 12); - gst_getbitsn (&gb, 12); - } + /* 'frame size code' and optional 'width, height' */ + if (gst_getbitsn (&gb, 3) == 7) { + gst_getbitsn (&gb, 12); + gst_getbitsn (&gb, 12); + } - halfpel_flag = gst_get1bit (&gb); - thirdpel_flag = gst_get1bit (&gb); + halfpel_flag = gst_get1bit (&gb); + thirdpel_flag = gst_get1bit (&gb); - /* unknown fields */ - gst_get1bit (&gb); - gst_get1bit (&gb); - gst_get1bit (&gb); - gst_get1bit (&gb); + /* unknown fields */ + gst_get1bit (&gb); + gst_get1bit (&gb); + gst_get1bit (&gb); + gst_get1bit (&gb); - low_delay = gst_get1bit (&gb); + low_delay = gst_get1bit (&gb); - /* unknown field */ - gst_get1bit (&gb); + /* unknown field */ + gst_get1bit (&gb); - while (gst_get1bit (&gb)) { - gst_getbitsn (&gb, 8); - } + while (gst_get1bit (&gb)) { + gst_getbitsn (&gb, 8); + } - unknown_svq3_flag = gst_get1bit (&gb); + unknown_svq3_flag = gst_get1bit (&gb); - return gst_caps_new_simple ("video/x-svq", - "svqversion", G_TYPE_INT, 3, - "halfpel_flag", G_TYPE_INT, halfpel_flag, - "thirdpel_flag", G_TYPE_INT, thirdpel_flag, - "low_delay", G_TYPE_INT, low_delay, - "unknown_svq3_flag", G_TYPE_INT, unknown_svq3_flag, NULL); + return gst_caps_new_simple ("video/x-svq", + "svqversion", G_TYPE_INT, 3, + "halfpel_flag", G_TYPE_INT, halfpel_flag, + "thirdpel_flag", G_TYPE_INT, thirdpel_flag, + "low_delay", G_TYPE_INT, low_delay, + "unknown_svq3_flag", G_TYPE_INT, unknown_svq3_flag, NULL); } return gst_caps_from_string ("video/x-svq, " "svqversion = (int) 3"); case GST_MAKE_FOURCC ('s', 'v', 'q', 'i'): @@ -1891,7 +1892,7 @@ qtdemux_video_caps (GstQTDemux * qtdemux, guint32 fourcc, case GST_MAKE_FOURCC ('r', 'a', 'w', ' '): /* uncompressed RGB */ return gst_caps_from_string ("video/x-raw-rgb, " - "endianness = (int) BIG_ENDIAN"); + "endianness = (int) BIG_ENDIAN"); /*"bpp", GST_PROPS_INT(x), "depth", GST_PROPS_INT(x), "red_mask", GST_PROPS_INT(x), @@ -1900,11 +1901,11 @@ qtdemux_video_caps (GstQTDemux * qtdemux, guint32 fourcc, case GST_MAKE_FOURCC ('Y', 'u', 'v', '2'): /* uncompressed YUV2 */ return gst_caps_from_string ("video/x-raw-yuv, " - "format = (fourcc) YUY2"); + "format = (fourcc) YUY2"); case GST_MAKE_FOURCC ('m', 'p', 'e', 'g'): /* MPEG */ return gst_caps_from_string ("video/mpeg, " - "systemstream = (boolean) false, " "mpegversion = (int) 1"); + "systemstream = (boolean) false, " "mpegversion = (int) 1"); case GST_MAKE_FOURCC ('g', 'i', 'f', ' '): return gst_caps_from_string ("image/gif"); case GST_MAKE_FOURCC ('h', '2', '6', '3'): @@ -1914,7 +1915,7 @@ qtdemux_video_caps (GstQTDemux * qtdemux, guint32 fourcc, case GST_MAKE_FOURCC ('m', 'p', '4', 'v'): /* MPEG-4 */ return gst_caps_from_string ("video/mpeg, " - "mpegversion = (int) 4, " "systemstream = (boolean) false"); + "mpegversion = (int) 4, " "systemstream = (boolean) false"); case GST_MAKE_FOURCC ('3', 'I', 'V', '1'): return gst_caps_from_string ("video/x-3ivx"); case GST_MAKE_FOURCC ('c', 'v', 'i', 'd'): @@ -1927,7 +1928,7 @@ qtdemux_video_caps (GstQTDemux * qtdemux, guint32 fourcc, case GST_MAKE_FOURCC ('k', 'p', 'c', 'd'): default: g_critical ("Don't know how to convert fourcc '" GST_FOURCC_FORMAT - "' to caps\n", GST_FOURCC_ARGS (fourcc)); + "' to caps\n", GST_FOURCC_ARGS (fourcc)); return NULL; } } @@ -1937,41 +1938,41 @@ qtdemux_audio_caps (GstQTDemux * qtdemux, guint32 fourcc, const guint8 * data) { switch (fourcc) { case GST_MAKE_FOURCC ('N', 'O', 'N', 'E'): - return NULL; /*gst_caps_from_string ("audio/raw"); */ + return NULL; /*gst_caps_from_string ("audio/raw"); */ case GST_MAKE_FOURCC ('r', 'a', 'w', ' '): /* FIXME */ return gst_caps_from_string ("audio/x-raw-int, " - "width = (int) 8, " "depth = (int) 8, " "signed = (boolean) true"); + "width = (int) 8, " "depth = (int) 8, " "signed = (boolean) true"); case GST_MAKE_FOURCC ('t', 'w', 'o', 's'): /* FIXME */ return gst_caps_from_string ("audio/x-raw-int, " - "width = (int) 16, " - "depth = (int) 16, " - "endianness = (int) G_BIG_ENDIAN, " "signed = (boolean) true"); + "width = (int) 16, " + "depth = (int) 16, " + "endianness = (int) G_BIG_ENDIAN, " "signed = (boolean) true"); case GST_MAKE_FOURCC ('s', 'o', 'w', 't'): /* FIXME */ return gst_caps_from_string ("audio/x-raw-int, " - "width = (int) 16, " - "depth = (int) 16, " - "endianness = (int) G_LITTLE_ENDIAN, " "signed = (boolean) true"); + "width = (int) 16, " + "depth = (int) 16, " + "endianness = (int) G_LITTLE_ENDIAN, " "signed = (boolean) true"); case GST_MAKE_FOURCC ('f', 'l', '6', '4'): return gst_caps_from_string ("audio/x-raw-float, " - "width = (int) 64, " "endianness = (int) G_BIG_ENDIAN"); + "width = (int) 64, " "endianness = (int) G_BIG_ENDIAN"); case GST_MAKE_FOURCC ('f', 'l', '3', '2'): return gst_caps_from_string ("audio/x-raw-float, " - "width = (int) 32, " "endianness = (int) G_BIG_ENDIAN"); + "width = (int) 32, " "endianness = (int) G_BIG_ENDIAN"); case GST_MAKE_FOURCC ('i', 'n', '2', '4'): /* FIXME */ return gst_caps_from_string ("audio/x-raw-int, " - "width = (int) 24, " - "depth = (int) 32, " - "endianness = (int) G_BIG_ENDIAN, " "signed = (boolean) true"); + "width = (int) 24, " + "depth = (int) 32, " + "endianness = (int) G_BIG_ENDIAN, " "signed = (boolean) true"); case GST_MAKE_FOURCC ('i', 'n', '3', '2'): /* FIXME */ return gst_caps_from_string ("audio/x-raw-int, " - "width = (int) 32, " - "depth = (int) 32, " - "endianness = (int) G_BIG_ENDIAN, " "signed = (boolean) true"); + "width = (int) 32, " + "depth = (int) 32, " + "endianness = (int) G_BIG_ENDIAN, " "signed = (boolean) true"); case GST_MAKE_FOURCC ('u', 'l', 'a', 'w'): /* FIXME */ return gst_caps_from_string ("audio/x-mulaw"); @@ -1981,18 +1982,18 @@ qtdemux_audio_caps (GstQTDemux * qtdemux, guint32 fourcc, const guint8 * data) case 0x6d730002: /* Microsoft ADPCM-ACM code 2 */ return gst_caps_from_string ("audio/x-adpcm, " - "layout = (string) microsoft"); + "layout = (string) microsoft"); case 0x6d730011: /* FIXME DVI/Intel IMA ADPCM/ACM code 17 */ return gst_caps_from_string ("audio/x-adpcm, " - "layout = (string) quicktime"); + "layout = (string) quicktime"); case 0x6d730055: /* MPEG layer 3, CBR only (pre QT4.1) */ case 0x5500736d: case GST_MAKE_FOURCC ('.', 'm', 'p', '3'): /* MPEG layer 3, CBR & VBR (QT4.1 and later) */ return gst_caps_from_string ("audio/mpeg, " - "layer = (int) 3, " "mpegversion = (int) 1"); + "layer = (int) 3, " "mpegversion = (int) 1"); case GST_MAKE_FOURCC ('M', 'A', 'C', '3'): /* MACE 3:1 */ return gst_caps_from_string ("audio/x-mace, " "maceversion = (int) 3"); @@ -2011,11 +2012,11 @@ qtdemux_audio_caps (GstQTDemux * qtdemux, guint32 fourcc, const guint8 * data) case GST_MAKE_FOURCC ('Q', 'D', 'M', '2'): /* FIXME: QDesign music version 2 (no constant) */ if (QTDEMUX_GUINT32_GET (data) <= 100) { - gst_util_dump_mem ((guint8 *) data, 100); - return gst_caps_new_simple ("audio/x-qdm2", - "framesize", G_TYPE_INT, QTDEMUX_GUINT32_GET (data + 52), - "bitrate", G_TYPE_INT, QTDEMUX_GUINT32_GET (data + 40), - "blocksize", G_TYPE_INT, QTDEMUX_GUINT32_GET (data + 44), NULL); + gst_util_dump_mem ((guint8 *) data, 100); + return gst_caps_new_simple ("audio/x-qdm2", + "framesize", G_TYPE_INT, QTDEMUX_GUINT32_GET (data + 52), + "bitrate", G_TYPE_INT, QTDEMUX_GUINT32_GET (data + 40), + "blocksize", G_TYPE_INT, QTDEMUX_GUINT32_GET (data + 44), NULL); } case GST_MAKE_FOURCC ('q', 't', 'v', 'r'): /* ? */ @@ -2029,7 +2030,7 @@ qtdemux_audio_caps (GstQTDemux * qtdemux, guint32 fourcc, const guint8 * data) /* ? */ default: g_critical ("Don't know how to convert fourcc '" GST_FOURCC_FORMAT - "' to caps\n", GST_FOURCC_ARGS (fourcc)); + "' to caps\n", GST_FOURCC_ARGS (fourcc)); return NULL; } } diff --git a/gst/rtp/gstrtpL16depay.c b/gst/rtp/gstrtpL16depay.c index 07bfb6a0..7d997084 100644 --- a/gst/rtp/gstrtpL16depay.c +++ b/gst/rtp/gstrtpL16depay.c @@ -46,11 +46,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, 2 ]") + "endianness = (int) BYTE_ORDER, " + "signed = (boolean) true, " + "width = (int) 16, " + "depth = (int) 16, " + "rate = (int) [ 1000, 48000 ], " "channels = (int) [ 1, 2 ]") ); static GstStaticPadTemplate gst_rtpL16parse_sink_template = @@ -94,8 +94,8 @@ gst_rtpL16parse_get_type (void) }; rtpL16parse_type = - g_type_register_static (GST_TYPE_ELEMENT, "GstRtpL16Parse", - &rtpL16parse_info, 0); + g_type_register_static (GST_TYPE_ELEMENT, "GstRtpL16Parse", + &rtpL16parse_info, 0); } return rtpL16parse_type; } @@ -125,10 +125,10 @@ gst_rtpL16parse_class_init (GstRtpL16ParseClass * klass) g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_PAYLOAD_TYPE, g_param_spec_int ("payload_type", "payload_type", "payload type", - G_MININT, G_MAXINT, PAYLOAD_L16_STEREO, G_PARAM_READABLE)); + G_MININT, G_MAXINT, PAYLOAD_L16_STEREO, G_PARAM_READABLE)); g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_FREQUENCY, g_param_spec_int ("frequency", "frequency", "frequency", - G_MININT, G_MAXINT, 44100, G_PARAM_READWRITE)); + G_MININT, G_MAXINT, 44100, G_PARAM_READWRITE)); gobject_class->set_property = gst_rtpL16parse_set_property; gobject_class->get_property = gst_rtpL16parse_get_property; @@ -176,7 +176,7 @@ gst_rtpL16_caps_nego (GstRtpL16Parse * rtpL16parse) caps = gst_caps_copy (gst_static_caps_get (&gst_rtpL16parse_src_template. - static_caps)); + static_caps)); gst_caps_set_simple (caps, "rate", G_TYPE_INT, rtpL16parse->frequency, diff --git a/gst/rtp/gstrtpL16enc.c b/gst/rtp/gstrtpL16enc.c index 0914d2fb..12602200 100644 --- a/gst/rtp/gstrtpL16enc.c +++ b/gst/rtp/gstrtpL16enc.c @@ -49,11 +49,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, 2 ]") + "endianness = (int) BYTE_ORDER, " + "signed = (boolean) true, " + "width = (int) 16, " + "depth = (int) 16, " + "rate = (int) [ 1000, 48000 ], " "channels = (int) [ 1, 2 ]") ); static GstStaticPadTemplate gst_rtpL16enc_src_template = @@ -96,8 +96,8 @@ gst_rtpL16enc_get_type (void) }; rtpL16enc_type = - g_type_register_static (GST_TYPE_ELEMENT, "GstRtpL16Enc", - &rtpL16enc_info, 0); + g_type_register_static (GST_TYPE_ELEMENT, "GstRtpL16Enc", + &rtpL16enc_info, 0); } return rtpL16enc_type; } @@ -216,13 +216,13 @@ gst_rtpL16enc_chain (GstPad * pad, GstData * _data) switch (GST_EVENT_TYPE (event)) { case GST_EVENT_DISCONTINUOUS: - GST_DEBUG ("discont"); - rtpL16enc->next_time = 0; - gst_pad_event_default (pad, event); - return; + GST_DEBUG ("discont"); + rtpL16enc->next_time = 0; + gst_pad_event_default (pad, event); + return; default: - gst_pad_event_default (pad, event); - return; + gst_pad_event_default (pad, event); + return; } } diff --git a/gst/rtp/gstrtpL16parse.c b/gst/rtp/gstrtpL16parse.c index 07bfb6a0..7d997084 100644 --- a/gst/rtp/gstrtpL16parse.c +++ b/gst/rtp/gstrtpL16parse.c @@ -46,11 +46,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, 2 ]") + "endianness = (int) BYTE_ORDER, " + "signed = (boolean) true, " + "width = (int) 16, " + "depth = (int) 16, " + "rate = (int) [ 1000, 48000 ], " "channels = (int) [ 1, 2 ]") ); static GstStaticPadTemplate gst_rtpL16parse_sink_template = @@ -94,8 +94,8 @@ gst_rtpL16parse_get_type (void) }; rtpL16parse_type = - g_type_register_static (GST_TYPE_ELEMENT, "GstRtpL16Parse", - &rtpL16parse_info, 0); + g_type_register_static (GST_TYPE_ELEMENT, "GstRtpL16Parse", + &rtpL16parse_info, 0); } return rtpL16parse_type; } @@ -125,10 +125,10 @@ gst_rtpL16parse_class_init (GstRtpL16ParseClass * klass) g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_PAYLOAD_TYPE, g_param_spec_int ("payload_type", "payload_type", "payload type", - G_MININT, G_MAXINT, PAYLOAD_L16_STEREO, G_PARAM_READABLE)); + G_MININT, G_MAXINT, PAYLOAD_L16_STEREO, G_PARAM_READABLE)); g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_FREQUENCY, g_param_spec_int ("frequency", "frequency", "frequency", - G_MININT, G_MAXINT, 44100, G_PARAM_READWRITE)); + G_MININT, G_MAXINT, 44100, G_PARAM_READWRITE)); gobject_class->set_property = gst_rtpL16parse_set_property; gobject_class->get_property = gst_rtpL16parse_get_property; @@ -176,7 +176,7 @@ gst_rtpL16_caps_nego (GstRtpL16Parse * rtpL16parse) caps = gst_caps_copy (gst_static_caps_get (&gst_rtpL16parse_src_template. - static_caps)); + static_caps)); gst_caps_set_simple (caps, "rate", G_TYPE_INT, rtpL16parse->frequency, diff --git a/gst/rtp/gstrtpL16pay.c b/gst/rtp/gstrtpL16pay.c index 0914d2fb..12602200 100644 --- a/gst/rtp/gstrtpL16pay.c +++ b/gst/rtp/gstrtpL16pay.c @@ -49,11 +49,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, 2 ]") + "endianness = (int) BYTE_ORDER, " + "signed = (boolean) true, " + "width = (int) 16, " + "depth = (int) 16, " + "rate = (int) [ 1000, 48000 ], " "channels = (int) [ 1, 2 ]") ); static GstStaticPadTemplate gst_rtpL16enc_src_template = @@ -96,8 +96,8 @@ gst_rtpL16enc_get_type (void) }; rtpL16enc_type = - g_type_register_static (GST_TYPE_ELEMENT, "GstRtpL16Enc", - &rtpL16enc_info, 0); + g_type_register_static (GST_TYPE_ELEMENT, "GstRtpL16Enc", + &rtpL16enc_info, 0); } return rtpL16enc_type; } @@ -216,13 +216,13 @@ gst_rtpL16enc_chain (GstPad * pad, GstData * _data) switch (GST_EVENT_TYPE (event)) { case GST_EVENT_DISCONTINUOUS: - GST_DEBUG ("discont"); - rtpL16enc->next_time = 0; - gst_pad_event_default (pad, event); - return; + GST_DEBUG ("discont"); + rtpL16enc->next_time = 0; + gst_pad_event_default (pad, event); + return; default: - gst_pad_event_default (pad, event); - return; + gst_pad_event_default (pad, event); + return; } } diff --git a/gst/rtp/gstrtpgsmdepay.c b/gst/rtp/gstrtpgsmdepay.c index 55b96945..e6ea8406 100644 --- a/gst/rtp/gstrtpgsmdepay.c +++ b/gst/rtp/gstrtpgsmdepay.c @@ -90,8 +90,8 @@ gst_rtpgsmparse_get_type (void) }; rtpgsmparse_type = - g_type_register_static (GST_TYPE_ELEMENT, "GstRtpGSMParse", - &rtpgsmparse_info, 0); + g_type_register_static (GST_TYPE_ELEMENT, "GstRtpGSMParse", + &rtpgsmparse_info, 0); } return rtpgsmparse_type; } @@ -121,7 +121,7 @@ gst_rtpgsmparse_class_init (GstRtpGSMParseClass * klass) g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_FREQUENCY, g_param_spec_int ("frequency", "frequency", "frequency", - G_MININT, G_MAXINT, 8000, G_PARAM_READWRITE)); + G_MININT, G_MAXINT, 8000, G_PARAM_READWRITE)); gobject_class->set_property = gst_rtpgsmparse_set_property; gobject_class->get_property = gst_rtpgsmparse_get_property; diff --git a/gst/rtp/gstrtpgsmenc.c b/gst/rtp/gstrtpgsmenc.c index 6301dd8c..2310d0e3 100644 --- a/gst/rtp/gstrtpgsmenc.c +++ b/gst/rtp/gstrtpgsmenc.c @@ -93,8 +93,8 @@ gst_rtpgsmenc_get_type (void) }; rtpgsmenc_type = - g_type_register_static (GST_TYPE_ELEMENT, "GstRtpGSMEnc", - &rtpgsmenc_info, 0); + g_type_register_static (GST_TYPE_ELEMENT, "GstRtpGSMEnc", + &rtpgsmenc_info, 0); } return rtpgsmenc_type; } @@ -209,13 +209,13 @@ gst_rtpgsmenc_chain (GstPad * pad, GstData * _data) switch (GST_EVENT_TYPE (event)) { case GST_EVENT_DISCONTINUOUS: - GST_DEBUG ("discont"); - rtpgsmenc->next_time = 0; - gst_pad_event_default (pad, event); - return; + GST_DEBUG ("discont"); + rtpgsmenc->next_time = 0; + gst_pad_event_default (pad, event); + return; default: - gst_pad_event_default (pad, event); - return; + gst_pad_event_default (pad, event); + return; } } diff --git a/gst/rtp/gstrtpgsmparse.c b/gst/rtp/gstrtpgsmparse.c index 55b96945..e6ea8406 100644 --- a/gst/rtp/gstrtpgsmparse.c +++ b/gst/rtp/gstrtpgsmparse.c @@ -90,8 +90,8 @@ gst_rtpgsmparse_get_type (void) }; rtpgsmparse_type = - g_type_register_static (GST_TYPE_ELEMENT, "GstRtpGSMParse", - &rtpgsmparse_info, 0); + g_type_register_static (GST_TYPE_ELEMENT, "GstRtpGSMParse", + &rtpgsmparse_info, 0); } return rtpgsmparse_type; } @@ -121,7 +121,7 @@ gst_rtpgsmparse_class_init (GstRtpGSMParseClass * klass) g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_FREQUENCY, g_param_spec_int ("frequency", "frequency", "frequency", - G_MININT, G_MAXINT, 8000, G_PARAM_READWRITE)); + G_MININT, G_MAXINT, 8000, G_PARAM_READWRITE)); gobject_class->set_property = gst_rtpgsmparse_set_property; gobject_class->get_property = gst_rtpgsmparse_get_property; diff --git a/gst/rtp/gstrtpgsmpay.c b/gst/rtp/gstrtpgsmpay.c index 6301dd8c..2310d0e3 100644 --- a/gst/rtp/gstrtpgsmpay.c +++ b/gst/rtp/gstrtpgsmpay.c @@ -93,8 +93,8 @@ gst_rtpgsmenc_get_type (void) }; rtpgsmenc_type = - g_type_register_static (GST_TYPE_ELEMENT, "GstRtpGSMEnc", - &rtpgsmenc_info, 0); + g_type_register_static (GST_TYPE_ELEMENT, "GstRtpGSMEnc", + &rtpgsmenc_info, 0); } return rtpgsmenc_type; } @@ -209,13 +209,13 @@ gst_rtpgsmenc_chain (GstPad * pad, GstData * _data) switch (GST_EVENT_TYPE (event)) { case GST_EVENT_DISCONTINUOUS: - GST_DEBUG ("discont"); - rtpgsmenc->next_time = 0; - gst_pad_event_default (pad, event); - return; + GST_DEBUG ("discont"); + rtpgsmenc->next_time = 0; + gst_pad_event_default (pad, event); + return; default: - gst_pad_event_default (pad, event); - return; + gst_pad_event_default (pad, event); + return; } } diff --git a/gst/smoothwave/gstsmoothwave.c b/gst/smoothwave/gstsmoothwave.c index 2abbdec2..9775e3d0 100644 --- a/gst/smoothwave/gstsmoothwave.c +++ b/gst/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/gst/smpte/barboxwipes.c b/gst/smpte/barboxwipes.c index 2508adf4..b843c97b 100644 --- a/gst/smpte/barboxwipes.c +++ b/gst/smpte/barboxwipes.c @@ -108,117 +108,117 @@ static gint box_clock_2b[][2 * 10] = { static gint box_clock_4b[][4 * 10] = { #define WIPE_B4_201 0 {BOX_CLOCK, 1, 1, 0, 1, 0, 0, 2, 1, 1, - BOX_CLOCK, 1, 1, 0, 2, 1, 1, 1, 2, 2, - BOX_CLOCK, 1, 1, 0, 1, 2, 2, 0, 1, 3, + BOX_CLOCK, 1, 1, 0, 2, 1, 1, 1, 2, 2, + BOX_CLOCK, 1, 1, 0, 1, 2, 2, 0, 1, 3, BOX_CLOCK, 1, 1, 0, 0, 1, 3, 1, 0, 4}, #define WIPE_B4_202 1 {BOX_CLOCK, 1, 1, 0, 1, 0, 3, 2, 1, 4, - BOX_CLOCK, 1, 1, 0, 2, 1, 0, 1, 2, 1, - BOX_CLOCK, 1, 1, 0, 1, 2, 1, 0, 1, 2, + BOX_CLOCK, 1, 1, 0, 2, 1, 0, 1, 2, 1, + BOX_CLOCK, 1, 1, 0, 1, 2, 1, 0, 1, 2, BOX_CLOCK, 1, 1, 0, 0, 1, 2, 1, 0, 3}, #define WIPE_B4_203 2 {BOX_CLOCK, 1, 1, 0, 1, 0, 2, 2, 1, 3, - BOX_CLOCK, 1, 1, 0, 2, 1, 3, 1, 2, 4, - BOX_CLOCK, 1, 1, 0, 1, 2, 0, 0, 1, 1, + BOX_CLOCK, 1, 1, 0, 2, 1, 3, 1, 2, 4, + BOX_CLOCK, 1, 1, 0, 1, 2, 0, 0, 1, 1, BOX_CLOCK, 1, 1, 0, 0, 1, 1, 1, 0, 2}, #define WIPE_B4_204 3 {BOX_CLOCK, 1, 1, 0, 1, 0, 1, 2, 1, 2, - BOX_CLOCK, 1, 1, 0, 2, 1, 2, 1, 2, 3, - BOX_CLOCK, 1, 1, 0, 1, 2, 3, 0, 1, 4, + BOX_CLOCK, 1, 1, 0, 2, 1, 2, 1, 2, 3, + BOX_CLOCK, 1, 1, 0, 1, 2, 3, 0, 1, 4, BOX_CLOCK, 1, 1, 0, 0, 1, 0, 1, 0, 1}, #define WIPE_B4_205 4 {BOX_CLOCK, 1, 1, 0, 1, 0, 0, 2, 1, 1, - BOX_CLOCK, 1, 1, 0, 2, 1, 1, 1, 2, 2, - BOX_CLOCK, 1, 1, 0, 1, 2, 0, 0, 1, 1, + BOX_CLOCK, 1, 1, 0, 2, 1, 1, 1, 2, 2, + BOX_CLOCK, 1, 1, 0, 1, 2, 0, 0, 1, 1, BOX_CLOCK, 1, 1, 0, 0, 1, 1, 1, 0, 2}, #define WIPE_B4_206 5 {BOX_CLOCK, 1, 1, 0, 1, 0, 1, 2, 1, 2, - BOX_CLOCK, 1, 1, 0, 2, 1, 0, 1, 2, 1, - BOX_CLOCK, 1, 1, 0, 1, 2, 1, 0, 1, 2, + BOX_CLOCK, 1, 1, 0, 2, 1, 0, 1, 2, 1, + BOX_CLOCK, 1, 1, 0, 1, 2, 1, 0, 1, 2, BOX_CLOCK, 1, 1, 0, 0, 1, 0, 1, 0, 1}, #define WIPE_B4_207 6 {BOX_CLOCK, 1, 1, 0, 1, 0, 0, 2, 1, 1, - BOX_CLOCK, 1, 1, 0, 2, 1, 0, 1, 2, 1, - BOX_CLOCK, 1, 1, 0, 1, 2, 0, 0, 1, 1, + BOX_CLOCK, 1, 1, 0, 2, 1, 0, 1, 2, 1, + BOX_CLOCK, 1, 1, 0, 1, 2, 0, 0, 1, 1, BOX_CLOCK, 1, 1, 0, 0, 1, 0, 1, 0, 1}, #define WIPE_B4_211 7 {BOX_CLOCK, 1, 1, 0, 1, 0, 0, 2, 1, 1, - BOX_CLOCK, 1, 1, 0, 2, 1, 1, 1, 2, 2, - BOX_CLOCK, 1, 1, 0, 1, 0, 0, 0, 1, 1, + BOX_CLOCK, 1, 1, 0, 2, 1, 1, 1, 2, 2, + BOX_CLOCK, 1, 1, 0, 1, 0, 0, 0, 1, 1, BOX_CLOCK, 1, 1, 0, 0, 1, 1, 1, 2, 2}, #define WIPE_B4_212 8 {BOX_CLOCK, 1, 1, 0, 2, 1, 0, 1, 0, 1, - BOX_CLOCK, 1, 1, 0, 1, 0, 1, 0, 1, 2, - BOX_CLOCK, 1, 1, 0, 2, 1, 0, 1, 2, 1, + BOX_CLOCK, 1, 1, 0, 1, 0, 1, 0, 1, 2, + BOX_CLOCK, 1, 1, 0, 2, 1, 0, 1, 2, 1, BOX_CLOCK, 1, 1, 0, 1, 2, 1, 0, 1, 2}, #define WIPE_B4_213 9 {BOX_CLOCK, 1, 1, 0, 1, 0, 0, 2, 1, 1, - BOX_CLOCK, 1, 1, 0, 1, 0, 0, 0, 1, 1, - BOX_CLOCK, 1, 1, 0, 1, 2, 0, 2, 1, 1, + BOX_CLOCK, 1, 1, 0, 1, 0, 0, 0, 1, 1, + BOX_CLOCK, 1, 1, 0, 1, 2, 0, 2, 1, 1, BOX_CLOCK, 1, 1, 0, 1, 2, 0, 0, 1, 1}, #define WIPE_B4_214 10 {BOX_CLOCK, 1, 1, 0, 2, 1, 0, 1, 0, 1, - BOX_CLOCK, 1, 1, 0, 2, 1, 0, 1, 2, 1, - BOX_CLOCK, 1, 1, 0, 0, 1, 0, 1, 0, 1, + BOX_CLOCK, 1, 1, 0, 2, 1, 0, 1, 2, 1, + BOX_CLOCK, 1, 1, 0, 0, 1, 0, 1, 0, 1, BOX_CLOCK, 1, 1, 0, 0, 1, 0, 1, 2, 1}, #define WIPE_B4_227 11 {BOX_CLOCK, 1, 0, 0, 2, 0, 0, 1, 1, 1, - BOX_CLOCK, 1, 0, 0, 1, 1, 1, 0, 0, 2, - BOX_CLOCK, 1, 2, 0, 2, 2, 0, 1, 1, 1, + BOX_CLOCK, 1, 0, 0, 1, 1, 1, 0, 0, 2, + BOX_CLOCK, 1, 2, 0, 2, 2, 0, 1, 1, 1, BOX_CLOCK, 1, 2, 0, 1, 1, 1, 0, 2, 2}, #define WIPE_B4_228 12 {BOX_CLOCK, 0, 1, 0, 0, 0, 0, 1, 1, 1, - BOX_CLOCK, 0, 1, 0, 1, 1, 1, 0, 2, 2, - BOX_CLOCK, 2, 1, 0, 2, 0, 0, 1, 1, 1, + BOX_CLOCK, 0, 1, 0, 1, 1, 1, 0, 2, 2, + BOX_CLOCK, 2, 1, 0, 2, 0, 0, 1, 1, 1, BOX_CLOCK, 2, 1, 0, 1, 1, 1, 2, 2, 2}, #define WIPE_B4_235 13 {BOX_CLOCK, 1, 0, 0, 1, 1, 0, 0, 0, 1, - BOX_CLOCK, 1, 0, 0, 1, 1, 0, 2, 0, 1, - BOX_CLOCK, 1, 2, 0, 1, 1, 0, 2, 2, 1, + BOX_CLOCK, 1, 0, 0, 1, 1, 0, 2, 0, 1, + BOX_CLOCK, 1, 2, 0, 1, 1, 0, 2, 2, 1, BOX_CLOCK, 1, 2, 0, 1, 1, 0, 0, 2, 1}, #define WIPE_B4_236 14 {BOX_CLOCK, 0, 1, 0, 1, 1, 0, 0, 0, 1, - BOX_CLOCK, 0, 1, 0, 1, 1, 0, 0, 2, 1, - BOX_CLOCK, 2, 1, 0, 1, 1, 0, 2, 0, 1, + BOX_CLOCK, 0, 1, 0, 1, 1, 0, 0, 2, 1, + BOX_CLOCK, 2, 1, 0, 1, 1, 0, 2, 0, 1, BOX_CLOCK, 2, 1, 0, 1, 1, 0, 2, 2, 1}, }; static gint box_clock_8b[][8 * 10] = { #define WIPE_B8_261 0 {BOX_CLOCK, 2, 1, 0, 2, 2, 0, 4, 1, 1, - BOX_CLOCK, 2, 1, 0, 4, 1, 1, 2, 0, 2, - BOX_CLOCK, 2, 1, 0, 2, 0, 2, 0, 1, 3, - BOX_CLOCK, 2, 1, 0, 0, 1, 3, 2, 2, 4, - BOX_CLOCK, 2, 3, 0, 2, 2, 0, 4, 3, 1, - BOX_CLOCK, 2, 3, 0, 4, 3, 1, 2, 4, 2, - BOX_CLOCK, 2, 3, 0, 2, 4, 2, 0, 3, 3, + BOX_CLOCK, 2, 1, 0, 4, 1, 1, 2, 0, 2, + BOX_CLOCK, 2, 1, 0, 2, 0, 2, 0, 1, 3, + BOX_CLOCK, 2, 1, 0, 0, 1, 3, 2, 2, 4, + BOX_CLOCK, 2, 3, 0, 2, 2, 0, 4, 3, 1, + BOX_CLOCK, 2, 3, 0, 4, 3, 1, 2, 4, 2, + BOX_CLOCK, 2, 3, 0, 2, 4, 2, 0, 3, 3, BOX_CLOCK, 2, 3, 0, 0, 3, 3, 2, 2, 4}, #define WIPE_B8_262 1 {BOX_CLOCK, 1, 2, 0, 2, 2, 0, 1, 0, 1, - BOX_CLOCK, 1, 2, 0, 1, 0, 1, 0, 2, 2, - BOX_CLOCK, 1, 2, 0, 0, 2, 2, 1, 4, 3, - BOX_CLOCK, 1, 2, 0, 1, 4, 3, 2, 2, 4, - BOX_CLOCK, 3, 2, 0, 2, 2, 0, 3, 0, 1, - BOX_CLOCK, 3, 2, 0, 3, 0, 1, 4, 2, 2, - BOX_CLOCK, 3, 2, 0, 4, 2, 2, 3, 4, 3, + BOX_CLOCK, 1, 2, 0, 1, 0, 1, 0, 2, 2, + BOX_CLOCK, 1, 2, 0, 0, 2, 2, 1, 4, 3, + BOX_CLOCK, 1, 2, 0, 1, 4, 3, 2, 2, 4, + BOX_CLOCK, 3, 2, 0, 2, 2, 0, 3, 0, 1, + BOX_CLOCK, 3, 2, 0, 3, 0, 1, 4, 2, 2, + BOX_CLOCK, 3, 2, 0, 4, 2, 2, 3, 4, 3, BOX_CLOCK, 3, 2, 0, 3, 4, 3, 2, 2, 4}, #define WIPE_B8_263 2 {BOX_CLOCK, 2, 1, 0, 2, 0, 0, 4, 1, 1, - BOX_CLOCK, 2, 1, 0, 4, 1, 1, 2, 2, 2, - BOX_CLOCK, 2, 1, 0, 2, 0, 0, 0, 1, 1, - BOX_CLOCK, 2, 1, 0, 0, 1, 1, 2, 2, 2, - BOX_CLOCK, 2, 3, 0, 2, 4, 0, 4, 3, 1, - BOX_CLOCK, 2, 3, 0, 4, 3, 1, 2, 2, 2, - BOX_CLOCK, 2, 3, 0, 2, 4, 0, 0, 3, 1, + BOX_CLOCK, 2, 1, 0, 4, 1, 1, 2, 2, 2, + BOX_CLOCK, 2, 1, 0, 2, 0, 0, 0, 1, 1, + BOX_CLOCK, 2, 1, 0, 0, 1, 1, 2, 2, 2, + BOX_CLOCK, 2, 3, 0, 2, 4, 0, 4, 3, 1, + BOX_CLOCK, 2, 3, 0, 4, 3, 1, 2, 2, 2, + BOX_CLOCK, 2, 3, 0, 2, 4, 0, 0, 3, 1, BOX_CLOCK, 2, 3, 0, 0, 3, 1, 2, 2, 2}, #define WIPE_B8_264 3 {BOX_CLOCK, 1, 2, 0, 0, 2, 0, 1, 0, 1, - BOX_CLOCK, 1, 2, 0, 1, 0, 1, 2, 2, 2, - BOX_CLOCK, 1, 2, 0, 0, 2, 0, 1, 4, 1, - BOX_CLOCK, 1, 2, 0, 1, 4, 1, 2, 2, 2, - BOX_CLOCK, 3, 2, 0, 4, 2, 0, 3, 0, 1, - BOX_CLOCK, 3, 2, 0, 3, 0, 1, 2, 2, 2, - BOX_CLOCK, 3, 2, 0, 4, 2, 0, 3, 4, 1, + BOX_CLOCK, 1, 2, 0, 1, 0, 1, 2, 2, 2, + BOX_CLOCK, 1, 2, 0, 0, 2, 0, 1, 4, 1, + BOX_CLOCK, 1, 2, 0, 1, 4, 1, 2, 2, 2, + BOX_CLOCK, 3, 2, 0, 4, 2, 0, 3, 0, 1, + BOX_CLOCK, 3, 2, 0, 3, 0, 1, 2, 2, 2, + BOX_CLOCK, 3, 2, 0, 4, 2, 0, 3, 4, 1, BOX_CLOCK, 3, 2, 0, 3, 4, 1, 2, 2, 2}, }; @@ -260,67 +260,67 @@ static gint triangles_3t[][3 * 9] = { /* 23 -> 26 */ #define WIPE_T3_23 0 {0, 0, 1, 1, 0, 0, 0, 2, 1, - 1, 0, 0, 0, 2, 1, 2, 2, 1, + 1, 0, 0, 0, 2, 1, 2, 2, 1, 1, 0, 0, 2, 0, 1, 2, 2, 1}, #define WIPE_T3_24 1 {0, 0, 1, 2, 0, 1, 2, 1, 0, - 0, 0, 1, 2, 1, 0, 0, 2, 1, + 0, 0, 1, 2, 1, 0, 0, 2, 1, 2, 1, 0, 0, 2, 1, 2, 2, 1}, #define WIPE_T3_25 2 {0, 0, 1, 0, 2, 1, 1, 2, 0, - 0, 0, 1, 2, 0, 1, 1, 2, 0, + 0, 0, 1, 2, 0, 1, 1, 2, 0, 2, 0, 1, 1, 2, 0, 2, 2, 1}, #define WIPE_T3_26 3 {0, 0, 1, 2, 0, 1, 0, 1, 0, - 2, 0, 1, 0, 1, 0, 2, 2, 1, + 2, 0, 1, 0, 1, 0, 2, 2, 1, 0, 1, 0, 0, 2, 1, 2, 2, 1}, }; static gint triangles_4t[][4 * 9] = { #define WIPE_T4_61 0 {0, 0, 1, 1, 0, 0, 1, 2, 1, - 0, 0, 1, 0, 2, 2, 1, 2, 1, - 1, 0, 0, 2, 0, 1, 1, 2, 1, + 0, 0, 1, 0, 2, 2, 1, 2, 1, + 1, 0, 0, 2, 0, 1, 1, 2, 1, 2, 0, 1, 1, 2, 1, 2, 2, 2}, #define WIPE_T4_62 1 {0, 0, 2, 2, 0, 1, 0, 1, 1, - 2, 0, 1, 0, 1, 1, 2, 1, 0, - 0, 1, 1, 2, 1, 0, 2, 2, 1, + 2, 0, 1, 0, 1, 1, 2, 1, 0, + 0, 1, 1, 2, 1, 0, 2, 2, 1, 0, 1, 1, 0, 2, 2, 2, 2, 1}, #define WIPE_T4_63 2 {0, 0, 2, 1, 0, 1, 0, 2, 1, - 1, 0, 1, 0, 2, 1, 1, 2, 0, - 1, 0, 1, 1, 2, 0, 2, 2, 1, + 1, 0, 1, 0, 2, 1, 1, 2, 0, + 1, 0, 1, 1, 2, 0, 2, 2, 1, 1, 0, 1, 2, 0, 2, 2, 2, 1}, #define WIPE_T4_64 3 {0, 0, 1, 2, 0, 2, 2, 1, 1, - 0, 0, 1, 0, 1, 0, 2, 1, 1, - 0, 1, 0, 2, 1, 1, 0, 2, 1, + 0, 0, 1, 0, 1, 0, 2, 1, 1, + 0, 1, 0, 2, 1, 1, 0, 2, 1, 2, 1, 1, 0, 2, 1, 2, 2, 2}, #define WIPE_T4_65 4 {0, 0, 0, 1, 0, 1, 1, 2, 0, - 0, 0, 0, 0, 2, 1, 1, 2, 0, - 1, 0, 1, 2, 0, 0, 1, 2, 0, + 0, 0, 0, 0, 2, 1, 1, 2, 0, + 1, 0, 1, 2, 0, 0, 1, 2, 0, 2, 0, 0, 1, 2, 0, 2, 2, 1}, #define WIPE_T4_66 5 {0, 0, 1, 2, 0, 0, 0, 1, 0, - 2, 0, 0, 0, 1, 0, 2, 1, 1, - 0, 1, 0, 2, 1, 1, 2, 2, 0, + 2, 0, 0, 0, 1, 0, 2, 1, 1, + 0, 1, 0, 2, 1, 1, 2, 2, 0, 0, 1, 0, 0, 2, 1, 2, 2, 0}, #define WIPE_T4_67 6 {0, 0, 1, 1, 0, 0, 0, 2, 0, - 1, 0, 0, 0, 2, 0, 1, 2, 1, - 1, 0, 0, 1, 2, 1, 2, 2, 0, + 1, 0, 0, 0, 2, 0, 1, 2, 1, + 1, 0, 0, 1, 2, 1, 2, 2, 0, 1, 0, 0, 2, 0, 1, 2, 2, 0}, #define WIPE_T4_68 7 {0, 0, 0, 2, 0, 1, 2, 1, 0, - 0, 0, 0, 0, 1, 1, 2, 1, 0, - 0, 1, 1, 2, 1, 0, 0, 2, 0, + 0, 0, 0, 0, 1, 1, 2, 1, 0, + 0, 1, 1, 2, 1, 0, 0, 2, 0, 2, 1, 0, 0, 2, 0, 2, 2, 1}, #define WIPE_T4_101 8 {0, 0, 1, 2, 0, 1, 1, 1, 0, - 0, 0, 1, 1, 1, 0, 0, 2, 1, - 1, 1, 0, 0, 2, 1, 2, 2, 1, + 0, 0, 1, 1, 1, 0, 0, 2, 1, + 1, 1, 0, 0, 2, 1, 2, 2, 1, 2, 0, 1, 1, 1, 0, 2, 2, 1}, }; @@ -328,48 +328,48 @@ static gint triangles_8t[][8 * 9] = { /* 7 */ #define WIPE_T8_7 0 {0, 0, 0, 1, 0, 1, 1, 1, 1, - 1, 0, 1, 2, 0, 0, 1, 1, 1, - 2, 0, 0, 1, 1, 1, 2, 1, 1, - 1, 1, 1, 2, 1, 1, 2, 2, 0, - 1, 1, 1, 1, 2, 1, 2, 2, 0, - 1, 1, 1, 0, 2, 0, 1, 2, 1, - 0, 1, 1, 1, 1, 1, 0, 2, 0, + 1, 0, 1, 2, 0, 0, 1, 1, 1, + 2, 0, 0, 1, 1, 1, 2, 1, 1, + 1, 1, 1, 2, 1, 1, 2, 2, 0, + 1, 1, 1, 1, 2, 1, 2, 2, 0, + 1, 1, 1, 0, 2, 0, 1, 2, 1, + 0, 1, 1, 1, 1, 1, 0, 2, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1}, #define WIPE_T8_43 1 {0, 0, 1, 1, 0, 0, 1, 1, 1, - 1, 0, 0, 2, 0, 1, 1, 1, 1, - 2, 0, 1, 1, 1, 1, 2, 1, 2, - 1, 1, 1, 2, 1, 2, 2, 2, 1, - 1, 1, 1, 1, 2, 0, 2, 2, 1, - 1, 1, 1, 0, 2, 1, 1, 2, 0, - 0, 1, 2, 1, 1, 1, 0, 2, 1, + 1, 0, 0, 2, 0, 1, 1, 1, 1, + 2, 0, 1, 1, 1, 1, 2, 1, 2, + 1, 1, 1, 2, 1, 2, 2, 2, 1, + 1, 1, 1, 1, 2, 0, 2, 2, 1, + 1, 1, 1, 0, 2, 1, 1, 2, 0, + 0, 1, 2, 1, 1, 1, 0, 2, 1, 0, 0, 1, 0, 1, 2, 1, 1, 1}, #define WIPE_T8_44 2 {0, 0, 1, 1, 0, 2, 1, 1, 1, - 1, 0, 2, 2, 0, 1, 1, 1, 1, - 2, 0, 1, 1, 1, 1, 2, 1, 0, - 1, 1, 1, 2, 1, 0, 2, 2, 1, - 1, 1, 1, 1, 2, 2, 2, 2, 1, - 1, 1, 1, 0, 2, 1, 1, 2, 2, - 0, 1, 0, 1, 1, 1, 0, 2, 1, + 1, 0, 2, 2, 0, 1, 1, 1, 1, + 2, 0, 1, 1, 1, 1, 2, 1, 0, + 1, 1, 1, 2, 1, 0, 2, 2, 1, + 1, 1, 1, 1, 2, 2, 2, 2, 1, + 1, 1, 1, 0, 2, 1, 1, 2, 2, + 0, 1, 0, 1, 1, 1, 0, 2, 1, 0, 0, 1, 0, 1, 0, 1, 1, 1}, #define WIPE_T8_47 3 {0, 0, 0, 1, 0, 1, 1, 1, 0, - 1, 0, 1, 2, 0, 0, 1, 1, 0, - 2, 0, 0, 1, 1, 0, 2, 1, 1, - 1, 1, 0, 2, 1, 1, 2, 2, 0, - 1, 1, 0, 1, 2, 1, 2, 2, 0, - 1, 1, 0, 0, 2, 0, 1, 2, 1, - 0, 1, 1, 1, 1, 0, 0, 2, 0, + 1, 0, 1, 2, 0, 0, 1, 1, 0, + 2, 0, 0, 1, 1, 0, 2, 1, 1, + 1, 1, 0, 2, 1, 1, 2, 2, 0, + 1, 1, 0, 1, 2, 1, 2, 2, 0, + 1, 1, 0, 0, 2, 0, 1, 2, 1, + 0, 1, 1, 1, 1, 0, 0, 2, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0}, #define WIPE_T8_48 4 {0, 0, 1, 1, 0, 0, 0, 1, 0, - 1, 0, 0, 0, 1, 0, 1, 1, 1, - 1, 0, 0, 2, 0, 1, 2, 1, 0, - 1, 0, 0, 1, 1, 1, 2, 1, 0, - 0, 1, 0, 1, 1, 1, 1, 2, 0, - 0, 1, 0, 0, 2, 1, 1, 2, 0, - 1, 1, 1, 2, 1, 0, 1, 2, 0, + 1, 0, 0, 0, 1, 0, 1, 1, 1, + 1, 0, 0, 2, 0, 1, 2, 1, 0, + 1, 0, 0, 1, 1, 1, 2, 1, 0, + 0, 1, 0, 1, 1, 1, 1, 2, 0, + 0, 1, 0, 0, 2, 1, 1, 2, 0, + 1, 1, 1, 2, 1, 0, 1, 2, 0, 2, 1, 0, 1, 2, 0, 2, 2, 1}, }; @@ -377,20 +377,20 @@ static gint triangles_16t[][16 * 9] = { /* 8 */ #define WIPE_T16_8 0 {0, 0, 1, 2, 0, 1, 1, 1, 0, - 2, 0, 1, 1, 1, 0, 2, 2, 1, - 1, 1, 0, 0, 2, 1, 2, 2, 1, - 0, 0, 1, 1, 1, 0, 0, 2, 1, - 2, 0, 1, 4, 0, 1, 3, 1, 0, - 4, 0, 1, 3, 1, 0, 4, 2, 1, - 3, 1, 0, 2, 2, 1, 4, 2, 1, - 2, 0, 1, 3, 1, 0, 2, 2, 1, - 0, 2, 1, 2, 2, 1, 1, 3, 0, - 2, 2, 1, 1, 3, 0, 2, 4, 1, - 1, 3, 0, 0, 4, 1, 2, 4, 1, - 0, 2, 1, 1, 3, 0, 0, 4, 1, - 2, 2, 1, 4, 2, 1, 3, 3, 0, - 4, 2, 1, 3, 3, 0, 4, 4, 1, - 3, 3, 0, 2, 4, 1, 4, 4, 1, + 2, 0, 1, 1, 1, 0, 2, 2, 1, + 1, 1, 0, 0, 2, 1, 2, 2, 1, + 0, 0, 1, 1, 1, 0, 0, 2, 1, + 2, 0, 1, 4, 0, 1, 3, 1, 0, + 4, 0, 1, 3, 1, 0, 4, 2, 1, + 3, 1, 0, 2, 2, 1, 4, 2, 1, + 2, 0, 1, 3, 1, 0, 2, 2, 1, + 0, 2, 1, 2, 2, 1, 1, 3, 0, + 2, 2, 1, 1, 3, 0, 2, 4, 1, + 1, 3, 0, 0, 4, 1, 2, 4, 1, + 0, 2, 1, 1, 3, 0, 0, 4, 1, + 2, 2, 1, 4, 2, 1, 3, 3, 0, + 4, 2, 1, 3, 3, 0, 4, 4, 1, + 3, 3, 0, 2, 4, 1, 4, 4, 1, 2, 2, 1, 3, 3, 0, 2, 4, 1} }; @@ -407,148 +407,148 @@ struct _GstWipeConfig static GstWipeConfig wipe_config[] = { #define WIPE_CONFIG_1 0 - {boxes_1b[WIPE_B1_1], 1, 0, 0, 0}, /* 1 */ + {boxes_1b[WIPE_B1_1], 1, 0, 0, 0}, /* 1 */ #define WIPE_CONFIG_2 WIPE_CONFIG_1+1 - {boxes_1b[WIPE_B1_2], 1, 0, 0, 0}, /* 2 */ + {boxes_1b[WIPE_B1_2], 1, 0, 0, 0}, /* 2 */ #define WIPE_CONFIG_3 WIPE_CONFIG_2+1 - {triangles_2t[WIPE_T2_3], 2, 0, 0, 0}, /* 3 */ + {triangles_2t[WIPE_T2_3], 2, 0, 0, 0}, /* 3 */ #define WIPE_CONFIG_4 WIPE_CONFIG_3+1 - {triangles_2t[WIPE_T2_4], 2, 0, 0, 0}, /* 4 */ + {triangles_2t[WIPE_T2_4], 2, 0, 0, 0}, /* 4 */ #define WIPE_CONFIG_5 WIPE_CONFIG_4+1 - {triangles_2t[WIPE_T2_5], 2, 0, 0, 0}, /* 5 */ + {triangles_2t[WIPE_T2_5], 2, 0, 0, 0}, /* 5 */ #define WIPE_CONFIG_6 WIPE_CONFIG_5+1 - {triangles_2t[WIPE_T2_6], 2, 0, 0, 0}, /* 6 */ + {triangles_2t[WIPE_T2_6], 2, 0, 0, 0}, /* 6 */ #define WIPE_CONFIG_7 WIPE_CONFIG_6+1 - {triangles_8t[WIPE_T8_7], 8, 1, 1, 0}, /* 7 */ + {triangles_8t[WIPE_T8_7], 8, 1, 1, 0}, /* 7 */ #define WIPE_CONFIG_8 WIPE_CONFIG_7+1 - {triangles_16t[WIPE_T16_8], 16, 2, 2, 0}, /* 8 */ + {triangles_16t[WIPE_T16_8], 16, 2, 2, 0}, /* 8 */ #define WIPE_CONFIG_21 WIPE_CONFIG_8+1 - {boxes_2b[WIPE_B2_21], 2, 1, 1, 0}, /* 21 */ + {boxes_2b[WIPE_B2_21], 2, 1, 1, 0}, /* 21 */ #define WIPE_CONFIG_22 WIPE_CONFIG_21+1 - {boxes_2b[WIPE_B2_22], 2, 1, 1, 0}, /* 22 */ + {boxes_2b[WIPE_B2_22], 2, 1, 1, 0}, /* 22 */ #define WIPE_CONFIG_23 WIPE_CONFIG_22+1 - {triangles_3t[WIPE_T3_23], 3, 1, 1, 0}, /* 23 */ + {triangles_3t[WIPE_T3_23], 3, 1, 1, 0}, /* 23 */ #define WIPE_CONFIG_24 WIPE_CONFIG_23+1 - {triangles_3t[WIPE_T3_24], 3, 1, 1, 0}, /* 24 */ + {triangles_3t[WIPE_T3_24], 3, 1, 1, 0}, /* 24 */ #define WIPE_CONFIG_25 WIPE_CONFIG_24+1 - {triangles_3t[WIPE_T3_23], 3, 1, 1, 0}, /* 25 */ + {triangles_3t[WIPE_T3_23], 3, 1, 1, 0}, /* 25 */ #define WIPE_CONFIG_26 WIPE_CONFIG_25+1 - {triangles_3t[WIPE_T3_26], 3, 1, 1, 0}, /* 26 */ + {triangles_3t[WIPE_T3_26], 3, 1, 1, 0}, /* 26 */ #define WIPE_CONFIG_41 WIPE_CONFIG_26+1 - {triangles_2t[WIPE_T2_41], 2, 0, 0, 1}, /* 41 */ + {triangles_2t[WIPE_T2_41], 2, 0, 0, 1}, /* 41 */ #define WIPE_CONFIG_42 WIPE_CONFIG_41+1 - {triangles_2t[WIPE_T2_42], 2, 0, 0, 1}, /* 42 */ + {triangles_2t[WIPE_T2_42], 2, 0, 0, 1}, /* 42 */ #define WIPE_CONFIG_43 WIPE_CONFIG_42+1 - {triangles_8t[WIPE_T8_43], 8, 1, 1, 1}, /* 43 */ + {triangles_8t[WIPE_T8_43], 8, 1, 1, 1}, /* 43 */ #define WIPE_CONFIG_44 WIPE_CONFIG_43+1 - {triangles_8t[WIPE_T8_44], 8, 1, 1, 1}, /* 44 */ + {triangles_8t[WIPE_T8_44], 8, 1, 1, 1}, /* 44 */ #define WIPE_CONFIG_45 WIPE_CONFIG_44+1 - {triangles_2t[WIPE_T2_45], 2, 0, 0, 0}, /* 45 */ + {triangles_2t[WIPE_T2_45], 2, 0, 0, 0}, /* 45 */ #define WIPE_CONFIG_46 WIPE_CONFIG_45+1 - {triangles_2t[WIPE_T2_46], 2, 0, 0, 0}, /* 46 */ + {triangles_2t[WIPE_T2_46], 2, 0, 0, 0}, /* 46 */ #define WIPE_CONFIG_47 WIPE_CONFIG_46+1 - {triangles_8t[WIPE_T8_47], 8, 1, 1, 0}, /* 47 */ + {triangles_8t[WIPE_T8_47], 8, 1, 1, 0}, /* 47 */ #define WIPE_CONFIG_48 WIPE_CONFIG_47+1 - {triangles_8t[WIPE_T8_48], 8, 1, 1, 0}, /* 48 */ + {triangles_8t[WIPE_T8_48], 8, 1, 1, 0}, /* 48 */ #define WIPE_CONFIG_61 WIPE_CONFIG_48+1 - {triangles_4t[WIPE_T4_61], 4, 1, 1, 1}, /* 61 */ + {triangles_4t[WIPE_T4_61], 4, 1, 1, 1}, /* 61 */ #define WIPE_CONFIG_62 WIPE_CONFIG_61+1 - {triangles_4t[WIPE_T4_62], 4, 1, 1, 1}, /* 62 */ + {triangles_4t[WIPE_T4_62], 4, 1, 1, 1}, /* 62 */ #define WIPE_CONFIG_63 WIPE_CONFIG_62+1 - {triangles_4t[WIPE_T4_63], 4, 1, 1, 1}, /* 63 */ + {triangles_4t[WIPE_T4_63], 4, 1, 1, 1}, /* 63 */ #define WIPE_CONFIG_64 WIPE_CONFIG_63+1 - {triangles_4t[WIPE_T4_64], 4, 1, 1, 1}, /* 64 */ + {triangles_4t[WIPE_T4_64], 4, 1, 1, 1}, /* 64 */ #define WIPE_CONFIG_65 WIPE_CONFIG_64+1 - {triangles_4t[WIPE_T4_65], 4, 1, 1, 0}, /* 65 */ + {triangles_4t[WIPE_T4_65], 4, 1, 1, 0}, /* 65 */ #define WIPE_CONFIG_66 WIPE_CONFIG_65+1 - {triangles_4t[WIPE_T4_66], 4, 1, 1, 0}, /* 66 */ + {triangles_4t[WIPE_T4_66], 4, 1, 1, 0}, /* 66 */ #define WIPE_CONFIG_67 WIPE_CONFIG_66+1 - {triangles_4t[WIPE_T4_67], 4, 1, 1, 0}, /* 67 */ + {triangles_4t[WIPE_T4_67], 4, 1, 1, 0}, /* 67 */ #define WIPE_CONFIG_68 WIPE_CONFIG_67+1 - {triangles_4t[WIPE_T4_68], 4, 1, 1, 0}, /* 68 */ + {triangles_4t[WIPE_T4_68], 4, 1, 1, 0}, /* 68 */ #define WIPE_CONFIG_101 WIPE_CONFIG_68+1 - {triangles_4t[WIPE_T4_101], 4, 1, 1, 0}, /* 101 */ + {triangles_4t[WIPE_T4_101], 4, 1, 1, 0}, /* 101 */ #define WIPE_CONFIG_201 WIPE_CONFIG_101+1 - {box_clock_4b[WIPE_B4_201], 4, 1, 1, 2}, /* 201 */ + {box_clock_4b[WIPE_B4_201], 4, 1, 1, 2}, /* 201 */ #define WIPE_CONFIG_202 WIPE_CONFIG_201+1 - {box_clock_4b[WIPE_B4_202], 4, 1, 1, 2}, /* 202 */ + {box_clock_4b[WIPE_B4_202], 4, 1, 1, 2}, /* 202 */ #define WIPE_CONFIG_203 WIPE_CONFIG_202+1 - {box_clock_4b[WIPE_B4_203], 4, 1, 1, 2}, /* 203 */ + {box_clock_4b[WIPE_B4_203], 4, 1, 1, 2}, /* 203 */ #define WIPE_CONFIG_204 WIPE_CONFIG_203+1 - {box_clock_4b[WIPE_B4_204], 4, 1, 1, 2}, /* 204 */ + {box_clock_4b[WIPE_B4_204], 4, 1, 1, 2}, /* 204 */ #define WIPE_CONFIG_205 WIPE_CONFIG_204+1 - {box_clock_4b[WIPE_B4_205], 4, 1, 1, 1}, /* 205 */ + {box_clock_4b[WIPE_B4_205], 4, 1, 1, 1}, /* 205 */ #define WIPE_CONFIG_206 WIPE_CONFIG_205+1 - {box_clock_4b[WIPE_B4_206], 4, 1, 1, 1}, /* 206 */ + {box_clock_4b[WIPE_B4_206], 4, 1, 1, 1}, /* 206 */ #define WIPE_CONFIG_207 WIPE_CONFIG_206+1 - {box_clock_4b[WIPE_B4_207], 4, 1, 1, 0}, /* 207 */ + {box_clock_4b[WIPE_B4_207], 4, 1, 1, 0}, /* 207 */ #define WIPE_CONFIG_211 WIPE_CONFIG_207+1 - {box_clock_4b[WIPE_B4_211], 4, 1, 1, 1}, /* 211 */ + {box_clock_4b[WIPE_B4_211], 4, 1, 1, 1}, /* 211 */ #define WIPE_CONFIG_212 WIPE_CONFIG_211+1 - {box_clock_4b[WIPE_B4_212], 4, 1, 1, 1}, /* 212 */ + {box_clock_4b[WIPE_B4_212], 4, 1, 1, 1}, /* 212 */ #define WIPE_CONFIG_213 WIPE_CONFIG_212+1 - {box_clock_4b[WIPE_B4_213], 4, 1, 1, 0}, /* 213 */ + {box_clock_4b[WIPE_B4_213], 4, 1, 1, 0}, /* 213 */ #define WIPE_CONFIG_214 WIPE_CONFIG_213+1 - {box_clock_4b[WIPE_B4_214], 4, 1, 1, 0}, /* 214 */ + {box_clock_4b[WIPE_B4_214], 4, 1, 1, 0}, /* 214 */ #define WIPE_CONFIG_221 WIPE_CONFIG_214+1 - {box_clock_2b[WIPE_B2_221], 2, 1, 1, 1}, /* 221 */ + {box_clock_2b[WIPE_B2_221], 2, 1, 1, 1}, /* 221 */ #define WIPE_CONFIG_222 WIPE_CONFIG_221+1 - {box_clock_2b[WIPE_B2_222], 2, 1, 1, 1}, /* 222 */ + {box_clock_2b[WIPE_B2_222], 2, 1, 1, 1}, /* 222 */ #define WIPE_CONFIG_223 WIPE_CONFIG_222+1 - {box_clock_2b[WIPE_B2_223], 2, 1, 1, 1}, /* 223 */ + {box_clock_2b[WIPE_B2_223], 2, 1, 1, 1}, /* 223 */ #define WIPE_CONFIG_224 WIPE_CONFIG_223+1 - {box_clock_2b[WIPE_B2_224], 2, 1, 1, 1}, /* 224 */ + {box_clock_2b[WIPE_B2_224], 2, 1, 1, 1}, /* 224 */ #define WIPE_CONFIG_225 WIPE_CONFIG_224+1 - {box_clock_2b[WIPE_B2_225], 2, 1, 1, 0}, /* 225 */ + {box_clock_2b[WIPE_B2_225], 2, 1, 1, 0}, /* 225 */ #define WIPE_CONFIG_226 WIPE_CONFIG_225+1 - {box_clock_2b[WIPE_B2_226], 2, 1, 1, 0}, /* 226 */ + {box_clock_2b[WIPE_B2_226], 2, 1, 1, 0}, /* 226 */ #define WIPE_CONFIG_227 WIPE_CONFIG_226+1 - {box_clock_4b[WIPE_B4_227], 4, 1, 1, 1}, /* 227 */ + {box_clock_4b[WIPE_B4_227], 4, 1, 1, 1}, /* 227 */ #define WIPE_CONFIG_228 WIPE_CONFIG_227+1 - {box_clock_4b[WIPE_B4_228], 4, 1, 1, 1}, /* 228 */ + {box_clock_4b[WIPE_B4_228], 4, 1, 1, 1}, /* 228 */ #define WIPE_CONFIG_231 WIPE_CONFIG_228+1 - {box_clock_2b[WIPE_B2_231], 2, 1, 1, 0}, /* 231 */ + {box_clock_2b[WIPE_B2_231], 2, 1, 1, 0}, /* 231 */ #define WIPE_CONFIG_232 WIPE_CONFIG_231+1 - {box_clock_2b[WIPE_B2_232], 2, 1, 1, 0}, /* 232 */ + {box_clock_2b[WIPE_B2_232], 2, 1, 1, 0}, /* 232 */ #define WIPE_CONFIG_233 WIPE_CONFIG_232+1 - {box_clock_2b[WIPE_B2_233], 2, 1, 1, 0}, /* 233 */ + {box_clock_2b[WIPE_B2_233], 2, 1, 1, 0}, /* 233 */ #define WIPE_CONFIG_234 WIPE_CONFIG_233+1 - {box_clock_2b[WIPE_B2_234], 2, 1, 1, 0}, /* 234 */ + {box_clock_2b[WIPE_B2_234], 2, 1, 1, 0}, /* 234 */ #define WIPE_CONFIG_235 WIPE_CONFIG_234+1 - {box_clock_4b[WIPE_B4_235], 4, 1, 1, 0}, /* 235 */ + {box_clock_4b[WIPE_B4_235], 4, 1, 1, 0}, /* 235 */ #define WIPE_CONFIG_236 WIPE_CONFIG_235+1 - {box_clock_4b[WIPE_B4_236], 4, 1, 1, 0}, /* 236 */ + {box_clock_4b[WIPE_B4_236], 4, 1, 1, 0}, /* 236 */ #define WIPE_CONFIG_241 WIPE_CONFIG_236+1 - {box_clock_1b[WIPE_B1_241], 1, 0, 0, 0}, /* 241 */ + {box_clock_1b[WIPE_B1_241], 1, 0, 0, 0}, /* 241 */ #define WIPE_CONFIG_242 WIPE_CONFIG_241+1 - {box_clock_1b[WIPE_B1_242], 1, 0, 0, 0}, /* 242 */ + {box_clock_1b[WIPE_B1_242], 1, 0, 0, 0}, /* 242 */ #define WIPE_CONFIG_243 WIPE_CONFIG_242+1 - {box_clock_1b[WIPE_B1_243], 1, 0, 0, 0}, /* 243 */ + {box_clock_1b[WIPE_B1_243], 1, 0, 0, 0}, /* 243 */ #define WIPE_CONFIG_244 WIPE_CONFIG_243+1 - {box_clock_1b[WIPE_B1_244], 1, 0, 0, 0}, /* 244 */ + {box_clock_1b[WIPE_B1_244], 1, 0, 0, 0}, /* 244 */ #define WIPE_CONFIG_245 WIPE_CONFIG_244+1 - {triangles_2t[WIPE_T2_245], 2, 1, 1, 0}, /* 245 */ + {triangles_2t[WIPE_T2_245], 2, 1, 1, 0}, /* 245 */ #define WIPE_CONFIG_246 WIPE_CONFIG_245+1 - {triangles_2t[WIPE_T2_246], 2, 1, 1, 0}, /* 246 */ + {triangles_2t[WIPE_T2_246], 2, 1, 1, 0}, /* 246 */ #define WIPE_CONFIG_251 WIPE_CONFIG_246+1 - {box_clock_2b[WIPE_B2_251], 2, 1, 1, 0}, /* 251 */ + {box_clock_2b[WIPE_B2_251], 2, 1, 1, 0}, /* 251 */ #define WIPE_CONFIG_252 WIPE_CONFIG_251+1 - {box_clock_2b[WIPE_B2_252], 2, 1, 1, 0}, /* 252 */ + {box_clock_2b[WIPE_B2_252], 2, 1, 1, 0}, /* 252 */ #define WIPE_CONFIG_253 WIPE_CONFIG_252+1 - {box_clock_2b[WIPE_B2_253], 2, 1, 1, 0}, /* 253 */ + {box_clock_2b[WIPE_B2_253], 2, 1, 1, 0}, /* 253 */ #define WIPE_CONFIG_254 WIPE_CONFIG_253+1 - {box_clock_2b[WIPE_B2_254], 2, 1, 1, 0}, /* 254 */ + {box_clock_2b[WIPE_B2_254], 2, 1, 1, 0}, /* 254 */ #define WIPE_CONFIG_261 WIPE_CONFIG_254+1 - {box_clock_8b[WIPE_B8_261], 8, 2, 2, 2}, /* 261 */ + {box_clock_8b[WIPE_B8_261], 8, 2, 2, 2}, /* 261 */ #define WIPE_CONFIG_262 WIPE_CONFIG_261+1 - {box_clock_8b[WIPE_B8_262], 8, 2, 2, 2}, /* 262 */ + {box_clock_8b[WIPE_B8_262], 8, 2, 2, 2}, /* 262 */ #define WIPE_CONFIG_263 WIPE_CONFIG_262+1 - {box_clock_8b[WIPE_B8_263], 8, 2, 2, 1}, /* 263 */ + {box_clock_8b[WIPE_B8_263], 8, 2, 2, 1}, /* 263 */ #define WIPE_CONFIG_264 WIPE_CONFIG_263+1 - {box_clock_8b[WIPE_B8_264], 8, 2, 2, 1}, /* 264 */ + {box_clock_8b[WIPE_B8_264], 8, 2, 2, 1}, /* 264 */ }; static void @@ -565,24 +565,24 @@ gst_wipe_boxes_draw (GstMask * mask) for (i = 0; i < config->nobjects; i++) { switch (impacts[0]) { case BOX_VERTICAL: - gst_smpte_paint_vbox (mask->data, mask->width, - impacts[1] * width, impacts[2] * height, impacts[3] * depth, - impacts[4] * width, impacts[5] * height, impacts[6] * depth); - impacts += 7; - break; + gst_smpte_paint_vbox (mask->data, mask->width, + impacts[1] * width, impacts[2] * height, impacts[3] * depth, + impacts[4] * width, impacts[5] * height, impacts[6] * depth); + impacts += 7; + break; case BOX_HORIZONTAL: - gst_smpte_paint_hbox (mask->data, mask->width, - impacts[1] * width, impacts[2] * height, impacts[3] * depth, - impacts[4] * width, impacts[5] * height, impacts[6] * depth); - impacts += 7; + gst_smpte_paint_hbox (mask->data, mask->width, + impacts[1] * width, impacts[2] * height, impacts[3] * depth, + impacts[4] * width, impacts[5] * height, impacts[6] * depth); + impacts += 7; case BOX_CLOCK: - gst_smpte_paint_box_clock (mask->data, mask->width, - impacts[1] * width, impacts[2] * height, impacts[3] * depth, - impacts[4] * width, impacts[5] * height, impacts[6] * depth, - impacts[7] * width, impacts[8] * height, impacts[9] * depth); - impacts += 10; + gst_smpte_paint_box_clock (mask->data, mask->width, + impacts[1] * width, impacts[2] * height, impacts[3] * depth, + impacts[4] * width, impacts[5] * height, impacts[6] * depth, + impacts[7] * width, impacts[8] * height, impacts[9] * depth); + impacts += 10; default: - break; + break; } } } @@ -599,9 +599,9 @@ gst_wipe_triangles_clock_draw (GstMask * mask) for (i = 0; i < config->nobjects; i++) { gst_smpte_paint_triangle_clock (mask->data, mask->width, - impacts[0] * width, impacts[1] * height, impacts[2] * depth, - impacts[3] * width, impacts[4] * height, impacts[5] * depth, - impacts[6] * width, impacts[7] * height, impacts[8] * depth); + impacts[0] * width, impacts[1] * height, impacts[2] * depth, + impacts[3] * width, impacts[4] * height, impacts[5] * depth, + impacts[6] * width, impacts[7] * height, impacts[8] * depth); impacts += 9; } } @@ -619,293 +619,293 @@ gst_wipe_triangles_draw (GstMask * mask) for (i = 0; i < config->nobjects; i++) { gst_smpte_paint_triangle_linear (mask->data, mask->width, - impacts[0] * width, impacts[1] * height, impacts[2] * depth, - impacts[3] * width, impacts[4] * height, impacts[5] * depth, - impacts[6] * width, impacts[7] * height, impacts[8] * depth); + impacts[0] * width, impacts[1] * height, impacts[2] * depth, + impacts[3] * width, impacts[4] * height, impacts[5] * depth, + impacts[6] * width, impacts[7] * height, impacts[8] * depth); impacts += 9; } } static GstMaskDefinition definitions[] = { {1, "bar_wipe_lr", - "A bar moves from left to right", - gst_wipe_boxes_draw, _gst_mask_default_destroy, + "A bar moves from left to right", + gst_wipe_boxes_draw, _gst_mask_default_destroy, &wipe_config[WIPE_CONFIG_1]}, {2, "bar_wipe_tb", - "A bar moves from top to bottom", - gst_wipe_boxes_draw, _gst_mask_default_destroy, + "A bar moves from top to bottom", + gst_wipe_boxes_draw, _gst_mask_default_destroy, &wipe_config[WIPE_CONFIG_2]}, {3, "box_wipe_tl", - "A box expands from the upper-left corner to the lower-right corner", - gst_wipe_triangles_draw, _gst_mask_default_destroy, + "A box expands from the upper-left corner to the lower-right corner", + gst_wipe_triangles_draw, _gst_mask_default_destroy, &wipe_config[WIPE_CONFIG_3]}, {4, "box_wipe_tr", - "A box expands from the upper-right corner to the lower-left corner", - gst_wipe_triangles_draw, _gst_mask_default_destroy, + "A box expands from the upper-right corner to the lower-left corner", + gst_wipe_triangles_draw, _gst_mask_default_destroy, &wipe_config[WIPE_CONFIG_4]}, {5, "box_wipe_br", - "A box expands from the lower-right corner to the upper-left corner", - gst_wipe_triangles_draw, _gst_mask_default_destroy, + "A box expands from the lower-right corner to the upper-left corner", + gst_wipe_triangles_draw, _gst_mask_default_destroy, &wipe_config[WIPE_CONFIG_5]}, {6, "box_wipe_bl", - "A box expands from the lower-left corner to the upper-right corner", - gst_wipe_triangles_draw, _gst_mask_default_destroy, + "A box expands from the lower-left corner to the upper-right corner", + gst_wipe_triangles_draw, _gst_mask_default_destroy, &wipe_config[WIPE_CONFIG_6]}, {7, "four_box_wipe_ci", - "A box shape expands from each of the four corners toward the center", - gst_wipe_triangles_draw, _gst_mask_default_destroy, + "A box shape expands from each of the four corners toward the center", + gst_wipe_triangles_draw, _gst_mask_default_destroy, &wipe_config[WIPE_CONFIG_7]}, {8, "four_box_wipe_co", - "A box shape expands from the center of each quadrant toward the corners of each quadrant", - gst_wipe_triangles_draw, _gst_mask_default_destroy, + "A box shape expands from the center of each quadrant toward the corners of each quadrant", + gst_wipe_triangles_draw, _gst_mask_default_destroy, &wipe_config[WIPE_CONFIG_8]}, {21, "barndoor_v", - "A central, vertical line splits and expands toward the left and right edges", - gst_wipe_boxes_draw, _gst_mask_default_destroy, + "A central, vertical line splits and expands toward the left and right edges", + gst_wipe_boxes_draw, _gst_mask_default_destroy, &wipe_config[WIPE_CONFIG_21]}, {22, "barndoor_h", - "A central, horizontal line splits and expands toward the top and bottom edges", - gst_wipe_boxes_draw, _gst_mask_default_destroy, + "A central, horizontal line splits and expands toward the top and bottom edges", + gst_wipe_boxes_draw, _gst_mask_default_destroy, &wipe_config[WIPE_CONFIG_22]}, {23, "box_wipe_tc", - "A box expands from the top edge's midpoint to the bottom corners", - gst_wipe_triangles_draw, _gst_mask_default_destroy, + "A box expands from the top edge's midpoint to the bottom corners", + gst_wipe_triangles_draw, _gst_mask_default_destroy, &wipe_config[WIPE_CONFIG_23]}, {24, "box_wipe_rc", - "A box expands from the right edge's midpoint to the left corners", - gst_wipe_triangles_draw, _gst_mask_default_destroy, + "A box expands from the right edge's midpoint to the left corners", + gst_wipe_triangles_draw, _gst_mask_default_destroy, &wipe_config[WIPE_CONFIG_24]}, {25, "box_wipe_bc", - "A box expands from the bottom edge's midpoint to the top corners", - gst_wipe_triangles_draw, _gst_mask_default_destroy, + "A box expands from the bottom edge's midpoint to the top corners", + gst_wipe_triangles_draw, _gst_mask_default_destroy, &wipe_config[WIPE_CONFIG_25]}, {26, "box_wipe_lc", - "A box expands from the left edge's midpoint to the right corners", - gst_wipe_triangles_draw, _gst_mask_default_destroy, + "A box expands from the left edge's midpoint to the right corners", + gst_wipe_triangles_draw, _gst_mask_default_destroy, &wipe_config[WIPE_CONFIG_26]}, {41, "diagonal_tl", - "A diagonal line moves from the upper-left corner to the lower-right corner", - gst_wipe_triangles_draw, _gst_mask_default_destroy, + "A diagonal line moves from the upper-left corner to the lower-right corner", + gst_wipe_triangles_draw, _gst_mask_default_destroy, &wipe_config[WIPE_CONFIG_41]}, {42, "diagonal_tr", - "A diagonal line moves from the upper right corner to the lower-left corner", - gst_wipe_triangles_draw, _gst_mask_default_destroy, + "A diagonal line moves from the upper right corner to the lower-left corner", + gst_wipe_triangles_draw, _gst_mask_default_destroy, &wipe_config[WIPE_CONFIG_42]}, {43, "bowtie_v", - "Two wedge shapes slide in from the top and bottom edges toward the center", - gst_wipe_triangles_draw, _gst_mask_default_destroy, + "Two wedge shapes slide in from the top and bottom edges toward the center", + gst_wipe_triangles_draw, _gst_mask_default_destroy, &wipe_config[WIPE_CONFIG_43]}, {44, "bowtie_h", - "Two wedge shapes slide in from the left and right edges toward the center", - gst_wipe_triangles_draw, _gst_mask_default_destroy, + "Two wedge shapes slide in from the left and right edges toward the center", + gst_wipe_triangles_draw, _gst_mask_default_destroy, &wipe_config[WIPE_CONFIG_44]}, {45, "barndoor_dbl", - "A diagonal line from the lower-left to upper-right corners splits and expands toward the opposite corners", - gst_wipe_triangles_draw, _gst_mask_default_destroy, + "A diagonal line from the lower-left to upper-right corners splits and expands toward the opposite corners", + gst_wipe_triangles_draw, _gst_mask_default_destroy, &wipe_config[WIPE_CONFIG_45]}, {46, "barndoor_dtl", - "A diagonal line from upper-left to lower-right corners splits and expands toward the opposite corners", - gst_wipe_triangles_draw, _gst_mask_default_destroy, + "A diagonal line from upper-left to lower-right corners splits and expands toward the opposite corners", + gst_wipe_triangles_draw, _gst_mask_default_destroy, &wipe_config[WIPE_CONFIG_46]}, {47, "misc_diagonal_dbd", - "Four wedge shapes split from the center and retract toward the four edges", - gst_wipe_triangles_draw, _gst_mask_default_destroy, + "Four wedge shapes split from the center and retract toward the four edges", + gst_wipe_triangles_draw, _gst_mask_default_destroy, &wipe_config[WIPE_CONFIG_47]}, {48, "misc_diagonal_dd", - "A diamond connecting the four edge midpoints simultaneously contracts toward the center and expands toward the edges", - gst_wipe_triangles_draw, _gst_mask_default_destroy, + "A diamond connecting the four edge midpoints simultaneously contracts toward the center and expands toward the edges", + gst_wipe_triangles_draw, _gst_mask_default_destroy, &wipe_config[WIPE_CONFIG_48]}, {61, "vee_d", - "A wedge shape moves from top to bottom", - gst_wipe_triangles_draw, _gst_mask_default_destroy, + "A wedge shape moves from top to bottom", + gst_wipe_triangles_draw, _gst_mask_default_destroy, &wipe_config[WIPE_CONFIG_61]}, {62, "vee_l", - "A wedge shape moves from right to left", - gst_wipe_triangles_draw, _gst_mask_default_destroy, + "A wedge shape moves from right to left", + gst_wipe_triangles_draw, _gst_mask_default_destroy, &wipe_config[WIPE_CONFIG_62]}, {63, "vee_u", - "A wedge shape moves from bottom to top", - gst_wipe_triangles_draw, _gst_mask_default_destroy, + "A wedge shape moves from bottom to top", + gst_wipe_triangles_draw, _gst_mask_default_destroy, &wipe_config[WIPE_CONFIG_63]}, {64, "vee_r", - "A wedge shape moves from left to right", - gst_wipe_triangles_draw, _gst_mask_default_destroy, + "A wedge shape moves from left to right", + gst_wipe_triangles_draw, _gst_mask_default_destroy, &wipe_config[WIPE_CONFIG_64]}, {65, "barnvee_d", - "A 'V' shape extending from the bottom edge's midpoint to the opposite corners contracts toward the center and expands toward the edges", - gst_wipe_triangles_draw, _gst_mask_default_destroy, + "A 'V' shape extending from the bottom edge's midpoint to the opposite corners contracts toward the center and expands toward the edges", + gst_wipe_triangles_draw, _gst_mask_default_destroy, &wipe_config[WIPE_CONFIG_65]}, {66, "barnvee_l", - "A 'V' shape extending from the left edge's midpoint to the opposite corners contracts toward the center and expands toward the edges", - gst_wipe_triangles_draw, _gst_mask_default_destroy, + "A 'V' shape extending from the left edge's midpoint to the opposite corners contracts toward the center and expands toward the edges", + gst_wipe_triangles_draw, _gst_mask_default_destroy, &wipe_config[WIPE_CONFIG_66]}, {67, "barnvee_u", - "A 'V' shape extending from the top edge's midpoint to the opposite corners contracts toward the center and expands toward the edges", - gst_wipe_triangles_draw, _gst_mask_default_destroy, + "A 'V' shape extending from the top edge's midpoint to the opposite corners contracts toward the center and expands toward the edges", + gst_wipe_triangles_draw, _gst_mask_default_destroy, &wipe_config[WIPE_CONFIG_67]}, {68, "barnvee_r", - "A 'V' shape extending from the right edge's midpoint to the opposite corners contracts toward the center and expands toward the edges", - gst_wipe_triangles_draw, _gst_mask_default_destroy, + "A 'V' shape extending from the right edge's midpoint to the opposite corners contracts toward the center and expands toward the edges", + gst_wipe_triangles_draw, _gst_mask_default_destroy, &wipe_config[WIPE_CONFIG_68]}, {101, "iris_rect", - "A rectangle expands from the center.", - gst_wipe_triangles_draw, _gst_mask_default_destroy, + "A rectangle expands from the center.", + gst_wipe_triangles_draw, _gst_mask_default_destroy, &wipe_config[WIPE_CONFIG_101]}, {201, "clock_cw12", - "A radial hand sweeps clockwise from the twelve o'clock position", - gst_wipe_boxes_draw, _gst_mask_default_destroy, + "A radial hand sweeps clockwise from the twelve o'clock position", + gst_wipe_boxes_draw, _gst_mask_default_destroy, &wipe_config[WIPE_CONFIG_201]}, {202, "clock_cw3", - "A radial hand sweeps clockwise from the three o'clock position", - gst_wipe_boxes_draw, _gst_mask_default_destroy, + "A radial hand sweeps clockwise from the three o'clock position", + gst_wipe_boxes_draw, _gst_mask_default_destroy, &wipe_config[WIPE_CONFIG_202]}, {203, "clock_cw6", - "A radial hand sweeps clockwise from the six o'clock position", - gst_wipe_boxes_draw, _gst_mask_default_destroy, + "A radial hand sweeps clockwise from the six o'clock position", + gst_wipe_boxes_draw, _gst_mask_default_destroy, &wipe_config[WIPE_CONFIG_203]}, {204, "clock_cw9", - "A radial hand sweeps clockwise from the nine o'clock position", - gst_wipe_boxes_draw, _gst_mask_default_destroy, + "A radial hand sweeps clockwise from the nine o'clock position", + gst_wipe_boxes_draw, _gst_mask_default_destroy, &wipe_config[WIPE_CONFIG_204]}, {205, "pinwheel_tbv", - "Two radial hands sweep clockwise from the twelve and six o'clock positions", - gst_wipe_boxes_draw, _gst_mask_default_destroy, + "Two radial hands sweep clockwise from the twelve and six o'clock positions", + gst_wipe_boxes_draw, _gst_mask_default_destroy, &wipe_config[WIPE_CONFIG_205]}, {206, "pinwheel_tbh", - "Two radial hands sweep clockwise from the nine and three o'clock positions", - gst_wipe_boxes_draw, _gst_mask_default_destroy, + "Two radial hands sweep clockwise from the nine and three o'clock positions", + gst_wipe_boxes_draw, _gst_mask_default_destroy, &wipe_config[WIPE_CONFIG_206]}, {207, "pinwheel_fb", - "Four radial hands sweep clockwise", - gst_wipe_boxes_draw, _gst_mask_default_destroy, + "Four radial hands sweep clockwise", + gst_wipe_boxes_draw, _gst_mask_default_destroy, &wipe_config[WIPE_CONFIG_207]}, {211, "fan_ct", - "A fan unfolds from the top edge, the fan axis at the center", - gst_wipe_boxes_draw, _gst_mask_default_destroy, + "A fan unfolds from the top edge, the fan axis at the center", + gst_wipe_boxes_draw, _gst_mask_default_destroy, &wipe_config[WIPE_CONFIG_211]}, {212, "fan_cr", - "A fan unfolds from the right edge, the fan axis at the center", - gst_wipe_boxes_draw, _gst_mask_default_destroy, + "A fan unfolds from the right edge, the fan axis at the center", + gst_wipe_boxes_draw, _gst_mask_default_destroy, &wipe_config[WIPE_CONFIG_212]}, {213, "doublefan_fov", - "Two fans, their axes at the center, unfold from the top and bottom", - gst_wipe_boxes_draw, _gst_mask_default_destroy, + "Two fans, their axes at the center, unfold from the top and bottom", + gst_wipe_boxes_draw, _gst_mask_default_destroy, &wipe_config[WIPE_CONFIG_213]}, {214, "doublefan_foh", - "Two fans, their axes at the center, unfold from the left and right", - gst_wipe_boxes_draw, _gst_mask_default_destroy, + "Two fans, their axes at the center, unfold from the left and right", + gst_wipe_boxes_draw, _gst_mask_default_destroy, &wipe_config[WIPE_CONFIG_214]}, {221, "singlesweep_cwt", - "A radial hand sweeps clockwise from the top edge's midpoint", - gst_wipe_boxes_draw, _gst_mask_default_destroy, + "A radial hand sweeps clockwise from the top edge's midpoint", + gst_wipe_boxes_draw, _gst_mask_default_destroy, &wipe_config[WIPE_CONFIG_221]}, {222, "singlesweep_cwr", - "A radial hand sweeps clockwise from the right edge's midpoint", - gst_wipe_boxes_draw, _gst_mask_default_destroy, + "A radial hand sweeps clockwise from the right edge's midpoint", + gst_wipe_boxes_draw, _gst_mask_default_destroy, &wipe_config[WIPE_CONFIG_222]}, {223, "singlesweep_cwb", - "A radial hand sweeps clockwise from the bottom edge's midpoint", - gst_wipe_boxes_draw, _gst_mask_default_destroy, + "A radial hand sweeps clockwise from the bottom edge's midpoint", + gst_wipe_boxes_draw, _gst_mask_default_destroy, &wipe_config[WIPE_CONFIG_223]}, {224, "singlesweep_cwl", - "A radial hand sweeps clockwise from the left edge's midpoint", - gst_wipe_boxes_draw, _gst_mask_default_destroy, + "A radial hand sweeps clockwise from the left edge's midpoint", + gst_wipe_boxes_draw, _gst_mask_default_destroy, &wipe_config[WIPE_CONFIG_224]}, {225, "doublesweep_pv", - "Two radial hands sweep clockwise and counter-clockwise from the top and bottom edges' midpoints", - gst_wipe_boxes_draw, _gst_mask_default_destroy, + "Two radial hands sweep clockwise and counter-clockwise from the top and bottom edges' midpoints", + gst_wipe_boxes_draw, _gst_mask_default_destroy, &wipe_config[WIPE_CONFIG_225]}, {226, "doublesweep_pd", - "Two radial hands sweep clockwise and counter-clockwise from the left and right edges' midpoints", - gst_wipe_boxes_draw, _gst_mask_default_destroy, + "Two radial hands sweep clockwise and counter-clockwise from the left and right edges' midpoints", + gst_wipe_boxes_draw, _gst_mask_default_destroy, &wipe_config[WIPE_CONFIG_226]}, {227, "doublesweep_ov", - "Two radial hands attached at the top and bottom edges' midpoints sweep from right to left", - gst_wipe_boxes_draw, _gst_mask_default_destroy, + "Two radial hands attached at the top and bottom edges' midpoints sweep from right to left", + gst_wipe_boxes_draw, _gst_mask_default_destroy, &wipe_config[WIPE_CONFIG_227]}, {228, "doublesweep_oh", - "Two radial hands attached at the left and right edges' midpoints sweep from top to bottom", - gst_wipe_boxes_draw, _gst_mask_default_destroy, + "Two radial hands attached at the left and right edges' midpoints sweep from top to bottom", + gst_wipe_boxes_draw, _gst_mask_default_destroy, &wipe_config[WIPE_CONFIG_228]}, {231, "fan_t", - "A fan unfolds from the bottom, the fan axis at the top edge's midpoint", - gst_wipe_boxes_draw, _gst_mask_default_destroy, + "A fan unfolds from the bottom, the fan axis at the top edge's midpoint", + gst_wipe_boxes_draw, _gst_mask_default_destroy, &wipe_config[WIPE_CONFIG_231]}, {232, "fan_r", - "A fan unfolds from the left, the fan axis at the right edge's midpoint", - gst_wipe_boxes_draw, _gst_mask_default_destroy, + "A fan unfolds from the left, the fan axis at the right edge's midpoint", + gst_wipe_boxes_draw, _gst_mask_default_destroy, &wipe_config[WIPE_CONFIG_232]}, {233, "fan_b", - "A fan unfolds from the top, the fan axis at the bottom edge's midpoint", - gst_wipe_boxes_draw, _gst_mask_default_destroy, + "A fan unfolds from the top, the fan axis at the bottom edge's midpoint", + gst_wipe_boxes_draw, _gst_mask_default_destroy, &wipe_config[WIPE_CONFIG_233]}, {234, "fan_l", - "A fan unfolds from the right, the fan axis at the left edge's midpoint", - gst_wipe_boxes_draw, _gst_mask_default_destroy, + "A fan unfolds from the right, the fan axis at the left edge's midpoint", + gst_wipe_boxes_draw, _gst_mask_default_destroy, &wipe_config[WIPE_CONFIG_234]}, {235, "doublefan_fiv", - "Two fans, their axes at the top and bottom, unfold from the center", - gst_wipe_boxes_draw, _gst_mask_default_destroy, + "Two fans, their axes at the top and bottom, unfold from the center", + gst_wipe_boxes_draw, _gst_mask_default_destroy, &wipe_config[WIPE_CONFIG_235]}, {236, "doublefan_fih", - "Two fans, their axes at the left and right, unfold from the center", - gst_wipe_boxes_draw, _gst_mask_default_destroy, + "Two fans, their axes at the left and right, unfold from the center", + gst_wipe_boxes_draw, _gst_mask_default_destroy, &wipe_config[WIPE_CONFIG_236]}, {241, "singlesweep_cwtl", - "A radial hand sweeps clockwise from the upper-left corner", - gst_wipe_boxes_draw, _gst_mask_default_destroy, + "A radial hand sweeps clockwise from the upper-left corner", + gst_wipe_boxes_draw, _gst_mask_default_destroy, &wipe_config[WIPE_CONFIG_241]}, {242, "singlesweep_cwbl", - "A radial hand sweeps counter-clockwise from the lower-left corner.", - gst_wipe_boxes_draw, _gst_mask_default_destroy, + "A radial hand sweeps counter-clockwise from the lower-left corner.", + gst_wipe_boxes_draw, _gst_mask_default_destroy, &wipe_config[WIPE_CONFIG_242]}, {243, "singlesweep_cwbr", - "A radial hand sweeps clockwise from the lower-right corner", - gst_wipe_boxes_draw, _gst_mask_default_destroy, + "A radial hand sweeps clockwise from the lower-right corner", + gst_wipe_boxes_draw, _gst_mask_default_destroy, &wipe_config[WIPE_CONFIG_243]}, {244, "singlesweep_cwtr", - "A radial hand sweeps counter-clockwise from the upper-right corner", - gst_wipe_boxes_draw, _gst_mask_default_destroy, + "A radial hand sweeps counter-clockwise from the upper-right corner", + gst_wipe_boxes_draw, _gst_mask_default_destroy, &wipe_config[WIPE_CONFIG_244]}, {245, "doublesweep_pdtl", - "Two radial hands attached at the upper-left and lower-right corners sweep down and up", - gst_wipe_triangles_clock_draw, _gst_mask_default_destroy, + "Two radial hands attached at the upper-left and lower-right corners sweep down and up", + gst_wipe_triangles_clock_draw, _gst_mask_default_destroy, &wipe_config[WIPE_CONFIG_245]}, {246, "doublesweep_pdbl", - "Two radial hands attached at the lower-left and upper-right corners sweep down and up", - gst_wipe_triangles_clock_draw, _gst_mask_default_destroy, + "Two radial hands attached at the lower-left and upper-right corners sweep down and up", + gst_wipe_triangles_clock_draw, _gst_mask_default_destroy, &wipe_config[WIPE_CONFIG_246]}, {251, "saloondoor_t", - "Two radial hands attached at the upper-left and upper-right corners sweep down", - gst_wipe_boxes_draw, _gst_mask_default_destroy, + "Two radial hands attached at the upper-left and upper-right corners sweep down", + gst_wipe_boxes_draw, _gst_mask_default_destroy, &wipe_config[WIPE_CONFIG_251]}, {252, "saloondoor_l", - "Two radial hands attached at the upper-left and lower-left corners sweep to the right", - gst_wipe_boxes_draw, _gst_mask_default_destroy, + "Two radial hands attached at the upper-left and lower-left corners sweep to the right", + gst_wipe_boxes_draw, _gst_mask_default_destroy, &wipe_config[WIPE_CONFIG_252]}, {253, "saloondoor_b", - "Two radial hands attached at the lower-left and lower-right corners sweep up", - gst_wipe_boxes_draw, _gst_mask_default_destroy, + "Two radial hands attached at the lower-left and lower-right corners sweep up", + gst_wipe_boxes_draw, _gst_mask_default_destroy, &wipe_config[WIPE_CONFIG_253]}, {254, "saloondoor_r", - "Two radial hands attached at the upper-right and lower-right corners sweep to the left", - gst_wipe_boxes_draw, _gst_mask_default_destroy, + "Two radial hands attached at the upper-right and lower-right corners sweep to the left", + gst_wipe_boxes_draw, _gst_mask_default_destroy, &wipe_config[WIPE_CONFIG_254]}, {261, "windshield_r", - "Two radial hands attached at the midpoints of the top and bottom halves sweep from right to left", - gst_wipe_boxes_draw, _gst_mask_default_destroy, + "Two radial hands attached at the midpoints of the top and bottom halves sweep from right to left", + gst_wipe_boxes_draw, _gst_mask_default_destroy, &wipe_config[WIPE_CONFIG_261]}, {262, "windshield_u", - "Two radial hands attached at the midpoints of the left and right halves sweep from top to bottom", - gst_wipe_boxes_draw, _gst_mask_default_destroy, + "Two radial hands attached at the midpoints of the left and right halves sweep from top to bottom", + gst_wipe_boxes_draw, _gst_mask_default_destroy, &wipe_config[WIPE_CONFIG_262]}, {263, "windshield_v", - "Two sets of radial hands attached at the midpoints of the top and bottom halves sweep from top to bottom and bottom to top", - gst_wipe_boxes_draw, _gst_mask_default_destroy, + "Two sets of radial hands attached at the midpoints of the top and bottom halves sweep from top to bottom and bottom to top", + gst_wipe_boxes_draw, _gst_mask_default_destroy, &wipe_config[WIPE_CONFIG_263]}, {264, "windshield_h", - "Two sets of radial hands attached at the midpoints of the left and right halves sweep from left to right and right to left", - gst_wipe_boxes_draw, _gst_mask_default_destroy, + "Two sets of radial hands attached at the midpoints of the left and right halves sweep from left to right and right to left", + gst_wipe_boxes_draw, _gst_mask_default_destroy, &wipe_config[WIPE_CONFIG_264]}, {0, NULL, NULL, NULL} }; diff --git a/gst/smpte/gstsmpte.c b/gst/smpte/gstsmpte.c index 91b91d9d..c948ad17 100644 --- a/gst/smpte/gstsmpte.c +++ b/gst/smpte/gstsmpte.c @@ -87,7 +87,7 @@ gst_smpte_transition_type_get_type (void) definitions = gst_mask_get_definitions (); smpte_transitions = - g_new0 (GEnumValue, g_list_length ((GList *) definitions) + 1); + g_new0 (GEnumValue, g_list_length ((GList *) definitions) + 1); while (definitions) { GstMaskDefinition *definition = (GstMaskDefinition *) definitions->data; @@ -102,7 +102,7 @@ gst_smpte_transition_type_get_type (void) } smpte_transition_type = - g_enum_register_static ("GstSMPTETransitionType", smpte_transitions); + g_enum_register_static ("GstSMPTETransitionType", smpte_transitions); } return smpte_transition_type; } @@ -140,8 +140,9 @@ gst_smpte_get_type (void) 0, (GInstanceInitFunc) gst_smpte_init, }; + smpte_type = - g_type_register_static (GST_TYPE_ELEMENT, "GstSMPTE", &smpte_info, 0); + g_type_register_static (GST_TYPE_ELEMENT, "GstSMPTE", &smpte_info, 0); } return smpte_type; } @@ -178,18 +179,18 @@ gst_smpte_class_init (GstSMPTEClass * klass) g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_TYPE, g_param_spec_enum ("type", "Type", "The type of transition to use", - GST_TYPE_SMPTE_TRANSITION_TYPE, 1, G_PARAM_READWRITE)); + GST_TYPE_SMPTE_TRANSITION_TYPE, 1, G_PARAM_READWRITE)); g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_FPS, g_param_spec_float ("fps", "FPS", - "Frames per second if no input files are given", 0., G_MAXFLOAT, 25., - G_PARAM_READWRITE)); + "Frames per second if no input files are given", 0., G_MAXFLOAT, 25., + G_PARAM_READWRITE)); g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_BORDER, g_param_spec_int ("border", "Border", - "The border width of the transition", 0, G_MAXINT, 0, - G_PARAM_READWRITE)); + "The border width of the transition", 0, G_MAXINT, 0, + G_PARAM_READWRITE)); g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_DEPTH, g_param_spec_int ("depth", "Depth", "Depth of the mask in bits", 1, 24, - 16, G_PARAM_READWRITE)); + 16, G_PARAM_READWRITE)); } /* wht yel cya grn mag red blu blk -I Q */ @@ -324,8 +325,8 @@ gst_smpte_blend_i420 (guint8 * in1, guint8 * in2, guint8 * out, GstMask * mask, *out++ = ((*in1++ * value) + (*in2++ * (256 - value))) >> 8; if (!(i & 1) && !(j & 1)) { - *outu++ = ((*in1u++ * value) + (*in2u++ * (256 - value))) >> 8; - *outv++ = ((*in1v++ * value) + (*in2v++ * (256 - value))) >> 8; + *outu++ = ((*in1u++ * value) + (*in2u++ * (256 - value))) >> 8; + *outv++ = ((*in1v++ * value) + (*in2v++ * (256 - value))) >> 8; } } } @@ -376,25 +377,25 @@ gst_smpte_loop (GstElement * element) GstCaps *caps; caps = - gst_caps_copy (gst_static_caps_get (&gst_smpte_src_template. - static_caps)); + gst_caps_copy (gst_static_caps_get (&gst_smpte_src_template. + static_caps)); gst_caps_set_simple (caps, "width", G_TYPE_INT, smpte->width, "height", - G_TYPE_INT, smpte->height, "framerate", G_TYPE_DOUBLE, smpte->fps, - NULL); + G_TYPE_INT, smpte->height, "framerate", G_TYPE_DOUBLE, smpte->fps, + NULL); if (!gst_pad_try_set_caps (smpte->srcpad, caps)) { - GST_ELEMENT_ERROR (smpte, CORE, NEGOTIATION, (NULL), (NULL)); - return; + GST_ELEMENT_ERROR (smpte, CORE, NEGOTIATION, (NULL), (NULL)); + return; } } gst_smpte_blend_i420 (GST_BUFFER_DATA (in1), - GST_BUFFER_DATA (in2), - GST_BUFFER_DATA (outbuf), - smpte->mask, smpte->width, smpte->height, - smpte->border, - ((1 << smpte->depth) + smpte->border) * - smpte->position / smpte->duration); + GST_BUFFER_DATA (in2), + GST_BUFFER_DATA (outbuf), + smpte->mask, smpte->width, smpte->height, + smpte->border, + ((1 << smpte->depth) + smpte->border) * + smpte->position / smpte->duration); } else { outbuf = in2; gst_buffer_ref (in2); @@ -425,7 +426,7 @@ gst_smpte_set_property (GObject * object, guint prop_id, gint type = g_value_get_enum (value); gst_smpte_update_mask (smpte, type, smpte->depth, - smpte->width, smpte->height); + smpte->width, smpte->height); break; } case ARG_BORDER: @@ -439,7 +440,7 @@ gst_smpte_set_property (GObject * object, guint prop_id, gint depth = g_value_get_int (value); gst_smpte_update_mask (smpte, smpte->type, depth, - smpte->width, smpte->height); + smpte->width, smpte->height); break; } default: @@ -459,7 +460,7 @@ gst_smpte_get_property (GObject * object, guint prop_id, switch (prop_id) { case ARG_TYPE: if (smpte->mask) { - g_value_set_enum (value, smpte->mask->type); + g_value_set_enum (value, smpte->mask->type); } break; case ARG_FPS: diff --git a/gst/smpte/paint.c b/gst/smpte/paint.c index fdff77e5..f4f64829 100644 --- a/gst/smpte/paint.c +++ b/gst/smpte/paint.c @@ -189,22 +189,22 @@ gst_smpte_paint_triangle_linear (guint32 * dest, gint stride, e += sign; for (j = s; j != e; j += sign) { - dest[j] = (ec * (j - s) + sc * (e - j)) / (e - s); + dest[j] = (ec * (j - s) + sc * (e - j)) / (e - s); } while (pyr == i) { - STEP_3D_LINE (dxrabs, dyrabs, dcrabs, sdxr, sdyr, sdcr, - xrr, yrr, crr, pxr, pyr, pcr); + STEP_3D_LINE (dxrabs, dyrabs, dcrabs, sdxr, sdyr, sdcr, + xrr, yrr, crr, pxr, pyr, pcr); } while (pyl == i) { - STEP_3D_LINE (dxlabs, dylabs, dclabs, sdxl, sdyl, sdcl, - xrl, yrl, crl, pxl, pyl, pcl); + STEP_3D_LINE (dxlabs, dylabs, dclabs, sdxl, sdyl, sdcl, + xrl, yrl, crl, pxl, pyl, pcl); } dest += stride; } PREPARE_3D_LINE (x1, y1, c1, x2, y2, c2, - dxrabs, dyrabs, dcrabs, sdxr, sdyr, sdcr, xrr, yrr, crr, pxr, pyr, pcr); + dxrabs, dyrabs, dcrabs, sdxr, sdyr, sdcr, xrr, yrr, crr, pxr, pyr, pcr); seg_start = y1; seg_end = y2; @@ -265,7 +265,7 @@ gst_smpte_paint_triangle_clock (guint32 * dest, gint stride, angle_s = 0.0; angle_e = acos (((x1 - x0) * (x2 - x0) + (y1 - y0) * (y2 - y0)) / (sqrt ((x1 - x0) * (x1 - x0) + (y1 - y0) * (y1 - y0)) * - sqrt ((x2 - x0) * (x2 - x0) + (y2 - y0) * (y2 - y0)))); + sqrt ((x2 - x0) * (x2 - x0) + (y2 - y0) * (y2 - y0)))); len1 = sqrt ((x1 - x0) * (x1 - x0) + (y1 - y0) * (y1 - y0)); @@ -274,28 +274,28 @@ gst_smpte_paint_triangle_clock (guint32 * dest, gint stride, for (i = y1; i != (y2 + sign); i += sign) { if (y1 == i) - angle = 0; + angle = 0; else - angle = acos (((x1 - x0) * (x2 - x0) + (y1 - y0) * (i - y0)) / - (len1 * sqrt ((x1 - x0) * (x1 - x0) + (i - y0) * (i - - y0)))) / angle_e; + angle = acos (((x1 - x0) * (x2 - x0) + (y1 - y0) * (i - y0)) / + (len1 * sqrt ((x1 - x0) * (x1 - x0) + (i - y0) * (i - + y0)))) / angle_e; draw_bresenham_line (dest, stride, - x0, y0, x1, i, (c2 * angle + c1 * (1.0 - angle))); + x0, y0, x1, i, (c2 * angle + c1 * (1.0 - angle))); } } else if (y1 == y2) { sign = SIGN (x2 - x1); for (i = x1; i != (x2 + sign); i += sign) { if (x1 == i) - angle = 0; + angle = 0; else - angle = acos (((x1 - x0) * (i - x0) + (y1 - y0) * (y2 - y0)) / - (len1 * sqrt ((i - x0) * (i - x0) + (y2 - y0) * (y2 - - y0)))) / angle_e; + angle = acos (((x1 - x0) * (i - x0) + (y1 - y0) * (y2 - y0)) / + (len1 * sqrt ((i - x0) * (i - x0) + (y2 - y0) * (y2 - + y0)))) / angle_e; draw_bresenham_line (dest, stride, - x0, y0, i, y1, (c2 * angle + c1 * (1.0 - angle))); + x0, y0, i, y1, (c2 * angle + c1 * (1.0 - angle))); } } } @@ -321,7 +321,7 @@ gst_smpte_paint_box_clock (guint32 * dest, gint stride, angle_m = 2 * acos (((x1 - x0) * (xv - x0) + (y1 - y0) * (yv - y0)) / (sqrt ((x1 - x0) * (x1 - x0) + (y1 - y0) * (y1 - y0)) * - sqrt ((xv - x0) * (xv - x0) + (yv - y0) * (yv - y0)))) / M_PI; + sqrt ((xv - x0) * (xv - x0) + (yv - y0) * (yv - y0)))) / M_PI; col_m = c2 * angle_m + c1 * (1.0 - angle_m); diff --git a/gst/spectrum/gstspectrum.c b/gst/spectrum/gstspectrum.c index aa309f1c..b87763cb 100644 --- a/gst/spectrum/gstspectrum.c +++ b/gst/spectrum/gstspectrum.c @@ -82,9 +82,10 @@ gst_spectrum_get_type (void) 0, (GInstanceInitFunc) gst_spectrum_init, }; + spectrum_type = - g_type_register_static (GST_TYPE_ELEMENT, "GstSpectrum", &spectrum_info, - 0); + g_type_register_static (GST_TYPE_ELEMENT, "GstSpectrum", &spectrum_info, + 0); } return spectrum_type; } @@ -105,7 +106,7 @@ gst_spectrum_class_init (GstSpectrumClass * 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_WRITABLE)); /* 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_WRITABLE)); /* CHECKME */ gobject_class->set_property = gst_spectrum_set_property; } diff --git a/gst/udp/gstudp.c b/gst/udp/gstudp.c index 1192f6d7..5d67e436 100644 --- a/gst/udp/gstudp.c +++ b/gst/udp/gstudp.c @@ -28,7 +28,7 @@ static gboolean plugin_init (GstPlugin * plugin) { if (!gst_element_register (plugin, "udpsink", GST_RANK_NONE, - GST_TYPE_UDPSINK)) + GST_TYPE_UDPSINK)) return FALSE; if (!gst_element_register (plugin, "udpsrc", GST_RANK_NONE, GST_TYPE_UDPSRC)) diff --git a/gst/udp/gstudpsink.c b/gst/udp/gstudpsink.c index af365613..de2a652b 100644 --- a/gst/udp/gstudpsink.c +++ b/gst/udp/gstudpsink.c @@ -63,9 +63,10 @@ gst_udpsink_control_get_type (void) {CONTROL_TCP, "3", "tcp"}, {CONTROL_ZERO, NULL, NULL}, }; + if (!udpsink_control_type) { udpsink_control_type = - g_enum_register_static ("GstUDPSinkControl", udpsink_control); + g_enum_register_static ("GstUDPSinkControl", udpsink_control); } return udpsink_control_type; } @@ -107,9 +108,10 @@ gst_udpsink_get_type (void) (GInstanceInitFunc) gst_udpsink_init, NULL }; + udpsink_type = - g_type_register_static (GST_TYPE_ELEMENT, "GstUDPSink", &udpsink_info, - 0); + g_type_register_static (GST_TYPE_ELEMENT, "GstUDPSink", &udpsink_info, + 0); } return udpsink_type; } @@ -135,15 +137,15 @@ gst_udpsink_class_init (GstUDPSink * klass) g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_HOST, g_param_spec_string ("host", "host", - "The host/IP/Multicast group to send the packets to", - UDP_DEFAULT_HOST, G_PARAM_READWRITE)); + "The host/IP/Multicast group to send the packets to", + UDP_DEFAULT_HOST, G_PARAM_READWRITE)); g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_PORT, g_param_spec_int ("port", "port", "The port to send the packets to", - 0, 32768, UDP_DEFAULT_PORT, G_PARAM_READWRITE)); + 0, 32768, UDP_DEFAULT_PORT, G_PARAM_READWRITE)); g_object_class_install_property (gobject_class, ARG_CONTROL, g_param_spec_enum ("control", "control", "The type of control", - GST_TYPE_UDPSINK_CONTROL, CONTROL_UDP, G_PARAM_READWRITE)); - g_object_class_install_property (gobject_class, ARG_MTU, g_param_spec_int ("mtu", "mtu", "maximun transmit unit", G_MININT, G_MAXINT, 0, G_PARAM_READWRITE)); /* CHECKME */ + GST_TYPE_UDPSINK_CONTROL, CONTROL_UDP, G_PARAM_READWRITE)); + g_object_class_install_property (gobject_class, ARG_MTU, g_param_spec_int ("mtu", "mtu", "maximun transmit unit", G_MININT, G_MAXINT, 0, G_PARAM_READWRITE)); /* CHECKME */ gobject_class->set_property = gst_udpsink_set_property; gobject_class->get_property = gst_udpsink_get_property; @@ -192,8 +194,8 @@ gst_udpsink_sink_link (GstPad * pad, const GstCaps * caps) switch (udpsink->control) { case CONTROL_UDP: if ((fd = socket (AF_INET, SOCK_DGRAM, IPPROTO_UDP)) == -1) { - perror ("socket"); - return GST_PAD_LINK_REFUSED; + perror ("socket"); + return GST_PAD_LINK_REFUSED; } /* We can only do broadcast in udp */ @@ -203,22 +205,22 @@ gst_udpsink_sink_link (GstPad * pad, const GstCaps * caps) xmlDocDumpMemory (doc, &buf, &buf_size); if (sendto (fd, buf, buf_size, 0, (struct sockaddr *) &serv_addr, - sizeof (serv_addr)) == -1) { - perror ("sending"); - return GST_PAD_LINK_REFUSED; + sizeof (serv_addr)) == -1) { + perror ("sending"); + return GST_PAD_LINK_REFUSED; } close (fd); break; case CONTROL_TCP: if ((fd = socket (AF_INET, SOCK_STREAM, IPPROTO_TCP)) == -1) { - perror ("socket"); - return GST_PAD_LINK_REFUSED; + perror ("socket"); + return GST_PAD_LINK_REFUSED; } if (connect (fd, (struct sockaddr *) &serv_addr, sizeof (serv_addr)) != 0) { - g_printerr ("udpsink: connect to %s port %d failed: %s\n", - udpsink->host, udpsink->port, g_strerror (errno)); - return GST_PAD_LINK_REFUSED; + g_printerr ("udpsink: connect to %s port %d failed: %s\n", + udpsink->host, udpsink->port, g_strerror (errno)); + return GST_PAD_LINK_REFUSED; } f = fdopen (dup (fd), "wb"); @@ -296,15 +298,15 @@ gst_udpsink_chain (GstPad * pad, GstData * _data) for (i = 0; i < GST_BUFFER_SIZE (buf); i += udpsink->mtu) { if (GST_BUFFER_SIZE (buf) - i > udpsink->mtu) { if (sendto (udpsink->sock, GST_BUFFER_DATA (buf) + i, - udpsink->mtu, 0, (struct sockaddr *) &udpsink->theiraddr, - tolen) == -1) { - perror ("sending"); + udpsink->mtu, 0, (struct sockaddr *) &udpsink->theiraddr, + tolen) == -1) { + perror ("sending"); } } else { if (sendto (udpsink->sock, GST_BUFFER_DATA (buf) + i, - GST_BUFFER_SIZE (buf) - i, 0, - (struct sockaddr *) &udpsink->theiraddr, tolen) == -1) { - perror ("sending"); + GST_BUFFER_SIZE (buf) - i, 0, + (struct sockaddr *) &udpsink->theiraddr, tolen) == -1) { + perror ("sending"); } } } @@ -325,11 +327,11 @@ gst_udpsink_set_property (GObject * object, guint prop_id, const GValue * value, switch (prop_id) { case ARG_HOST: if (udpsink->host != NULL) - g_free (udpsink->host); + g_free (udpsink->host); if (g_value_get_string (value) == NULL) - udpsink->host = NULL; + udpsink->host = NULL; else - udpsink->host = g_strdup (g_value_get_string (value)); + udpsink->host = g_strdup (g_value_get_string (value)); break; case ARG_PORT: udpsink->port = g_value_get_int (value); @@ -384,8 +386,8 @@ gst_udpsink_init_send (GstUDPSink * sink) guint bc_val; memset (&sink->theiraddr, 0, sizeof (sink->theiraddr)); - sink->theiraddr.sin_family = AF_INET; /* host byte order */ - sink->theiraddr.sin_port = htons (sink->port); /* short, network byte order */ + sink->theiraddr.sin_family = AF_INET; /* host byte order */ + sink->theiraddr.sin_port = htons (sink->port); /* short, network byte order */ /* if its an IP address */ if (inet_aton (sink->host, &addr)) { @@ -398,7 +400,7 @@ gst_udpsink_init_send (GstUDPSink * sink) /* Joining the multicast group */ setsockopt (sink->sock, IPPROTO_IP, IP_ADD_MEMBERSHIP, &sink->multi_addr, - sizeof (sink->multi_addr)); + sizeof (sink->multi_addr)); } else { @@ -454,7 +456,7 @@ gst_udpsink_change_state (GstElement * element) } else { if (!GST_FLAG_IS_SET (element, GST_UDPSINK_OPEN)) { if (!gst_udpsink_init_send (GST_UDPSINK (element))) - return GST_STATE_FAILURE; + return GST_STATE_FAILURE; } } diff --git a/gst/udp/gstudpsrc.c b/gst/udp/gstudpsrc.c index 48e00862..a4a8dd7d 100644 --- a/gst/udp/gstudpsrc.c +++ b/gst/udp/gstudpsrc.c @@ -62,9 +62,10 @@ gst_udpsrc_control_get_type (void) {CONTROL_TCP, "3", "tcp"}, {CONTROL_ZERO, NULL, NULL}, }; + if (!udpsrc_control_type) { udpsrc_control_type = - g_enum_register_static ("GstUDPSrcControl", udpsrc_control); + g_enum_register_static ("GstUDPSrcControl", udpsrc_control); } return udpsrc_control_type; } @@ -104,8 +105,9 @@ gst_udpsrc_get_type (void) (GInstanceInitFunc) gst_udpsrc_init, NULL }; + udpsrc_type = - g_type_register_static (GST_TYPE_ELEMENT, "GstUDPSrc", &udpsrc_info, 0); + g_type_register_static (GST_TYPE_ELEMENT, "GstUDPSrc", &udpsrc_info, 0); } return udpsrc_type; } @@ -131,14 +133,14 @@ gst_udpsrc_class_init (GstUDPSrc * klass) g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_PORT, g_param_spec_int ("port", "port", "The port to receive the packets from", - 0, 32768, UDP_DEFAULT_PORT, G_PARAM_READWRITE)); + 0, 32768, UDP_DEFAULT_PORT, G_PARAM_READWRITE)); g_object_class_install_property (gobject_class, ARG_CONTROL, g_param_spec_enum ("control", "control", "The type of control", - GST_TYPE_UDPSRC_CONTROL, CONTROL_UDP, G_PARAM_READWRITE)); + GST_TYPE_UDPSRC_CONTROL, CONTROL_UDP, G_PARAM_READWRITE)); g_object_class_install_property (gobject_class, ARG_MULTICAST_GROUP, g_param_spec_string ("multicast_group", "multicast_group", - "The Address of multicast group to join", - UDP_DEFAULT_MULTICAST_GROUP, G_PARAM_READWRITE)); + "The Address of multicast group to join", + UDP_DEFAULT_MULTICAST_GROUP, G_PARAM_READWRITE)); gobject_class->set_property = gst_udpsrc_set_property; gobject_class->get_property = gst_udpsrc_get_property; @@ -200,7 +202,7 @@ gst_udpsrc_get (GstPad * pad) if (select (max_sock + 1, &read_fds, NULL, NULL, NULL) > 0) { if ((udpsrc->control_sock != -1) && - FD_ISSET (udpsrc->control_sock, &read_fds)) { + FD_ISSET (udpsrc->control_sock, &read_fds)) { #ifndef GST_DISABLE_LOADSAVE guchar *buf; int ret; @@ -212,45 +214,45 @@ gst_udpsrc_get (GstPad * pad) buf = g_malloc (1024 * 10); switch (udpsrc->control) { - case CONTROL_TCP: - len = sizeof (struct sockaddr); - fdread = accept (udpsrc->control_sock, &addr, &len); - if (fdread < 0) { - perror ("accept"); - } - - ret = read (fdread, buf, 1024 * 10); - break; - case CONTROL_UDP: - len = sizeof (struct sockaddr); - ret = - recvfrom (udpsrc->control_sock, buf, 1024 * 10, 0, - (struct sockaddr *) &tmpaddr, &len); - if (ret < 0) { - perror ("recvfrom"); - } - break; - case CONTROL_NONE: - default: - g_free (buf); - return NULL; - break; + case CONTROL_TCP: + len = sizeof (struct sockaddr); + fdread = accept (udpsrc->control_sock, &addr, &len); + if (fdread < 0) { + perror ("accept"); + } + + ret = read (fdread, buf, 1024 * 10); + break; + case CONTROL_UDP: + len = sizeof (struct sockaddr); + ret = + recvfrom (udpsrc->control_sock, buf, 1024 * 10, 0, + (struct sockaddr *) &tmpaddr, &len); + if (ret < 0) { + perror ("recvfrom"); + } + break; + case CONTROL_NONE: + default: + g_free (buf); + return NULL; + break; } buf[ret] = '\0'; doc = xmlParseMemory (buf, ret); caps = gst_caps_load_thyself (doc->xmlRootNode); if (caps == NULL) { - return NULL; + return NULL; } /* foward the connect, we don't signal back the result here... */ if (gst_caps_is_fixed (caps)) { - gst_pad_try_set_caps (udpsrc->srcpad, caps); + gst_pad_try_set_caps (udpsrc->srcpad, caps); } else { - GST_ERROR ("caps %" GST_PTR_FORMAT, caps); - GST_ELEMENT_ERROR (udpsrc, CORE, NEGOTIATION, (NULL), - ("Got unfixed caps from peer")); + GST_ERROR ("caps %" GST_PTR_FORMAT, caps); + GST_ELEMENT_ERROR (udpsrc, CORE, NEGOTIATION, (NULL), + ("Got unfixed caps from peer")); } #endif @@ -262,37 +264,37 @@ gst_udpsrc_get (GstPad * pad) GST_BUFFER_SIZE (outbuf) = 24000; if (udpsrc->first_buf) { - if (udpsrc->clock) { - GstClockTime current_time; - GstEvent *discont; + if (udpsrc->clock) { + GstClockTime current_time; + GstEvent *discont; - current_time = gst_clock_get_time (udpsrc->clock); + current_time = gst_clock_get_time (udpsrc->clock); - GST_BUFFER_TIMESTAMP (outbuf) = current_time; + GST_BUFFER_TIMESTAMP (outbuf) = current_time; - discont = gst_event_new_discontinuous (FALSE, GST_FORMAT_TIME, - current_time, NULL); + discont = gst_event_new_discontinuous (FALSE, GST_FORMAT_TIME, + current_time, NULL); - gst_pad_push (udpsrc->srcpad, GST_DATA (discont)); - } + gst_pad_push (udpsrc->srcpad, GST_DATA (discont)); + } - udpsrc->first_buf = FALSE; + udpsrc->first_buf = FALSE; } else { - GST_BUFFER_TIMESTAMP (outbuf) = GST_CLOCK_TIME_NONE; + GST_BUFFER_TIMESTAMP (outbuf) = GST_CLOCK_TIME_NONE; } len = sizeof (struct sockaddr); numbytes = recvfrom (udpsrc->sock, GST_BUFFER_DATA (outbuf), - GST_BUFFER_SIZE (outbuf), 0, (struct sockaddr *) &tmpaddr, &len); + GST_BUFFER_SIZE (outbuf), 0, (struct sockaddr *) &tmpaddr, &len); if (numbytes != -1) { - GST_BUFFER_SIZE (outbuf) = numbytes; + GST_BUFFER_SIZE (outbuf) = numbytes; } else { - perror ("recvfrom"); - gst_buffer_unref (outbuf); - outbuf = NULL; + perror ("recvfrom"); + gst_buffer_unref (outbuf); + outbuf = NULL; } } @@ -322,9 +324,9 @@ gst_udpsrc_set_property (GObject * object, guint prop_id, const GValue * value, g_free (udpsrc->multi_group); if (g_value_get_string (value) == NULL) - udpsrc->multi_group = g_strdup (UDP_DEFAULT_MULTICAST_GROUP); + udpsrc->multi_group = g_strdup (UDP_DEFAULT_MULTICAST_GROUP); else - udpsrc->multi_group = g_strdup (g_value_get_string (value)); + udpsrc->multi_group = g_strdup (g_value_get_string (value)); break; case ARG_CONTROL: @@ -369,8 +371,8 @@ gst_udpsrc_init_receive (GstUDPSrc * src) gint reuse = 1; memset (&src->myaddr, 0, sizeof (src->myaddr)); - src->myaddr.sin_family = AF_INET; /* host byte order */ - src->myaddr.sin_port = htons (src->port); /* short, network byte order */ + src->myaddr.sin_family = AF_INET; /* host byte order */ + src->myaddr.sin_port = htons (src->port); /* short, network byte order */ src->myaddr.sin_addr.s_addr = INADDR_ANY; if ((src->sock = socket (AF_INET, SOCK_DGRAM, 0)) == -1) { @@ -379,13 +381,13 @@ gst_udpsrc_init_receive (GstUDPSrc * src) } if (setsockopt (src->sock, SOL_SOCKET, SO_REUSEADDR, &reuse, - sizeof (reuse)) == -1) { + sizeof (reuse)) == -1) { perror ("setsockopt"); return FALSE; } if (bind (src->sock, (struct sockaddr *) &src->myaddr, - sizeof (src->myaddr)) == -1) { + sizeof (src->myaddr)) == -1) { perror ("bind"); return FALSE; } @@ -394,7 +396,7 @@ gst_udpsrc_init_receive (GstUDPSrc * src) if (src->multi_addr.imr_multiaddr.s_addr) { src->multi_addr.imr_interface.s_addr = INADDR_ANY; setsockopt (src->sock, IPPROTO_IP, IP_ADD_MEMBERSHIP, &src->multi_addr, - sizeof (src->multi_addr)); + sizeof (src->multi_addr)); } } @@ -405,19 +407,19 @@ gst_udpsrc_init_receive (GstUDPSrc * src) switch (src->control) { case CONTROL_TCP: if ((src->control_sock = socket (AF_INET, SOCK_STREAM, 0)) == -1) { - perror ("control_socket"); - return FALSE; + perror ("control_socket"); + return FALSE; } if (bind (src->control_sock, (struct sockaddr *) &src->myaddr, - sizeof (src->myaddr)) == -1) { - perror ("control_bind"); - return FALSE; + sizeof (src->myaddr)) == -1) { + perror ("control_bind"); + return FALSE; } if (listen (src->control_sock, 5) == -1) { - perror ("listen"); - return FALSE; + perror ("listen"); + return FALSE; } fcntl (src->control_sock, F_SETFL, O_NONBLOCK); @@ -425,19 +427,19 @@ gst_udpsrc_init_receive (GstUDPSrc * src) break; case CONTROL_UDP: if ((src->control_sock = socket (AF_INET, SOCK_DGRAM, 0)) == -1) { - perror ("socket"); - return FALSE; + perror ("socket"); + return FALSE; } if (bind (src->control_sock, (struct sockaddr *) &src->myaddr, - sizeof (src->myaddr)) == -1) { - perror ("control_bind"); - return FALSE; + sizeof (src->myaddr)) == -1) { + perror ("control_bind"); + return FALSE; } /* We can only do broadcast in udp */ bc_val = 1; setsockopt (src->control_sock, SOL_SOCKET, SO_BROADCAST, &bc_val, - sizeof (bc_val)); + sizeof (bc_val)); break; case CONTROL_NONE: GST_FLAG_SET (src, GST_UDPSRC_OPEN); @@ -479,7 +481,7 @@ gst_udpsrc_change_state (GstElement * element) } else { if (!GST_FLAG_IS_SET (element, GST_UDPSRC_OPEN)) { if (!gst_udpsrc_init_receive (GST_UDPSRC (element))) - return GST_STATE_FAILURE; + return GST_STATE_FAILURE; } } diff --git a/gst/videocrop/gstvideocrop.c b/gst/videocrop/gstvideocrop.c index f13610bc..5e4c0b38 100644 --- a/gst/videocrop/gstvideocrop.c +++ b/gst/videocrop/gstvideocrop.c @@ -135,9 +135,10 @@ gst_video_crop_get_type (void) 0, (GInstanceInitFunc) gst_video_crop_init, }; + video_crop_type = - g_type_register_static (GST_TYPE_ELEMENT, "GstVideoCrop", - &video_crop_info, 0); + g_type_register_static (GST_TYPE_ELEMENT, "GstVideoCrop", + &video_crop_info, 0); } return video_crop_type; } @@ -167,16 +168,16 @@ gst_video_crop_class_init (GstVideoCropClass * klass) g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_LEFT, g_param_spec_int ("left", "Left", "Pixels to crop at left", - 0, G_MAXINT, 0, G_PARAM_READWRITE)); + 0, G_MAXINT, 0, G_PARAM_READWRITE)); g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_RIGHT, g_param_spec_int ("right", "Right", "Pixels to crop at right", - 0, G_MAXINT, 0, G_PARAM_READWRITE)); + 0, G_MAXINT, 0, G_PARAM_READWRITE)); g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_TOP, g_param_spec_int ("top", "Top", "Pixels to crop at top", - 0, G_MAXINT, 0, G_PARAM_READWRITE)); + 0, G_MAXINT, 0, G_PARAM_READWRITE)); g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_BOTTOM, g_param_spec_int ("bottom", "Bottom", "Pixels to crop at bottom", - 0, G_MAXINT, 0, G_PARAM_READWRITE)); + 0, G_MAXINT, 0, G_PARAM_READWRITE)); gobject_class->set_property = gst_video_crop_set_property; gobject_class->get_property = gst_video_crop_get_property; @@ -369,8 +370,8 @@ gst_video_crop_chain (GstPad * pad, GstData * _data) switch (GST_EVENT_TYPE (event)) { default: - gst_pad_event_default (pad, event); - break; + gst_pad_event_default (pad, event); + break; } return; } diff --git a/gst/videofilter/gstgamma.c b/gst/videofilter/gstgamma.c index 7cc2b0fd..118c99f4 100644 --- a/gst/videofilter/gstgamma.c +++ b/gst/videofilter/gstgamma.c @@ -119,8 +119,9 @@ gst_gamma_get_type (void) 0, gst_gamma_init, }; + gamma_type = g_type_register_static (GST_TYPE_VIDEOFILTER, - "GstGamma", &gamma_info, 0); + "GstGamma", &gamma_info, 0); } return gamma_type; } @@ -165,16 +166,16 @@ gst_gamma_class_init (gpointer g_class, gpointer class_data) g_object_class_install_property (gobject_class, ARG_GAMMA, g_param_spec_double ("gamma", "Gamma", "gamma", - 0.01, 10, 1, G_PARAM_READWRITE)); + 0.01, 10, 1, G_PARAM_READWRITE)); g_object_class_install_property (gobject_class, ARG_GAMMA_R, g_param_spec_double ("redgamma", "Gamma_r", - "gamma value for the red channel", 0.01, 10, 1, G_PARAM_READWRITE)); + "gamma value for the red channel", 0.01, 10, 1, G_PARAM_READWRITE)); g_object_class_install_property (gobject_class, ARG_GAMMA_G, g_param_spec_double ("greengamma", "Gamma_g", - "gamma value for the green channel", 0.01, 10, 1, G_PARAM_READWRITE)); + "gamma value for the green channel", 0.01, 10, 1, G_PARAM_READWRITE)); g_object_class_install_property (gobject_class, ARG_GAMMA_B, g_param_spec_double ("bluegamma", "Gamma_b", - "gamma value for the blue channel", 0.01, 10, 1, G_PARAM_READWRITE)); + "gamma value for the blue channel", 0.01, 10, 1, G_PARAM_READWRITE)); gobject_class->set_property = gst_gamma_set_property; gobject_class->get_property = gst_gamma_get_property; @@ -353,10 +354,10 @@ gst_gamma_planar411 (GstVideofilter * videofilter, void *dest, void *src) int x, y; for (y = 0; y < height; y++) { - for (x = 0; x < width; x++) { - cdest[y * width + x] = - gamma->gamma_table[(unsigned char) csrc[y * width + x]]; - } + for (x = 0; x < width; x++) { + cdest[y * width + x] = + gamma->gamma_table[(unsigned char) csrc[y * width + x]]; + } } } } @@ -421,10 +422,10 @@ gst_gamma_rgb32 (GstVideofilter * videofilter, void *dest, void *src) i = 0; while (i < width * height * 4) { if ((i % 4) != 3) - *cdest++ = gamma->gamma_table[*csrc++]; + *cdest++ = gamma->gamma_table[*csrc++]; else { - cdest++; - csrc++; + cdest++; + csrc++; } i++; } diff --git a/gst/videofilter/gstvideobalance.c b/gst/videofilter/gstvideobalance.c index 2acad7c3..083e5e8a 100644 --- a/gst/videofilter/gstvideobalance.c +++ b/gst/videofilter/gstvideobalance.c @@ -107,12 +107,12 @@ gst_videobalance_get_type (void) }; videobalance_type = g_type_register_static (GST_TYPE_VIDEOFILTER, - "GstVideobalance", &videobalance_info, 0); + "GstVideobalance", &videobalance_info, 0); g_type_add_interface_static (videobalance_type, - GST_TYPE_IMPLEMENTS_INTERFACE, &iface_info); + GST_TYPE_IMPLEMENTS_INTERFACE, &iface_info); g_type_add_interface_static (videobalance_type, GST_TYPE_COLOR_BALANCE, - &colorbalance_info); + &colorbalance_info); } return videobalance_type; } @@ -138,7 +138,7 @@ gst_videobalance_base_init (gpointer g_class) for (i = 0; i < G_N_ELEMENTS (gst_videobalance_formats); i++) { gst_videofilter_class_add_format (videofilter_class, - gst_videobalance_formats + i); + gst_videobalance_formats + i); } gst_videofilter_class_add_pad_templates (GST_VIDEOFILTER_CLASS (g_class)); @@ -189,15 +189,15 @@ gst_videobalance_class_init (gpointer g_class, gpointer class_data) g_object_class_install_property (gobject_class, ARG_CONTRAST, g_param_spec_double ("contrast", "Contrast", "contrast", - 0, 2, 1, G_PARAM_READWRITE)); + 0, 2, 1, G_PARAM_READWRITE)); g_object_class_install_property (gobject_class, ARG_BRIGHTNESS, g_param_spec_double ("brightness", "Brightness", "brightness", - -1, 1, 0, G_PARAM_READWRITE)); + -1, 1, 0, G_PARAM_READWRITE)); g_object_class_install_property (gobject_class, ARG_HUE, g_param_spec_double ("hue", "Hue", "hue", -1, 1, 0, G_PARAM_READWRITE)); g_object_class_install_property (gobject_class, ARG_SATURATION, g_param_spec_double ("saturation", "Saturation", "saturation", - 0, 2, 1, G_PARAM_READWRITE)); + 0, 2, 1, G_PARAM_READWRITE)); gobject_class->set_property = gst_videobalance_set_property; gobject_class->get_property = gst_videobalance_get_property; @@ -473,13 +473,13 @@ gst_videobalance_update_tables_planar411 (GstVideobalance * vb) u = 128 + ((i * hue_cos + j * hue_sin) * vb->saturation); v = 128 + ((-i * hue_sin + j * hue_cos) * vb->saturation); if (u < 0) - u = 0; + u = 0; else if (u > 255) - u = 255; + u = 255; if (v < 0) - v = 0; + v = 0; else if (v > 255) - v = 255; + v = 255; vb->tableu[i + 128][j + 128] = rint (u); vb->tablev[i + 128][j + 128] = rint (v); } @@ -526,7 +526,7 @@ gst_videobalance_planar411 (GstVideofilter * videofilter, void *dest, void *src) for (y = 0; y < height; y++) { tablelookup_u8 (cdest + y * width, 1, csrc + y * width, 1, - videobalance->tabley, 1, width); + videobalance->tabley, 1, width); } } @@ -542,10 +542,10 @@ gst_videobalance_planar411 (GstVideofilter * videofilter, void *dest, void *src) for (y = 0; y < height / 2; y++) { for (x = 0; x < width / 2; x++) { - u1 = usrc[y * (width / 2) + x]; - v1 = vsrc[y * (width / 2) + x]; - udest[y * (width / 2) + x] = videobalance->tableu[u1][v1]; - vdest[y * (width / 2) + x] = videobalance->tablev[u1][v1]; + u1 = usrc[y * (width / 2) + x]; + v1 = vsrc[y * (width / 2) + x]; + udest[y * (width / 2) + x] = videobalance->tableu[u1][v1]; + vdest[y * (width / 2) + x] = videobalance->tablev[u1][v1]; } } } diff --git a/gst/videofilter/gstvideofilter.c b/gst/videofilter/gstvideofilter.c index 590616bc..f46d69e7 100644 --- a/gst/videofilter/gstvideofilter.c +++ b/gst/videofilter/gstvideofilter.c @@ -74,8 +74,9 @@ gst_videofilter_get_type (void) 0, gst_videofilter_init, }; + videofilter_type = g_type_register_static (GST_TYPE_ELEMENT, - "GstVideofilter", &videofilter_info, G_TYPE_FLAG_ABSTRACT); + "GstVideofilter", &videofilter_info, G_TYPE_FLAG_ABSTRACT); } return videofilter_type; } @@ -129,15 +130,15 @@ gst_videofilter_format_get_structure (GstVideofilterFormat * format) if (format->depth) { structure = gst_structure_new ("video/x-raw-rgb", - "depth", G_TYPE_INT, format->depth, - "bpp", G_TYPE_INT, format->bpp, - "endianness", G_TYPE_INT, format->endianness, - "red_mask", G_TYPE_INT, format->red_mask, - "green_mask", G_TYPE_INT, format->green_mask, - "blue_mask", G_TYPE_INT, format->blue_mask, NULL); + "depth", G_TYPE_INT, format->depth, + "bpp", G_TYPE_INT, format->bpp, + "endianness", G_TYPE_INT, format->endianness, + "red_mask", G_TYPE_INT, format->red_mask, + "green_mask", G_TYPE_INT, format->green_mask, + "blue_mask", G_TYPE_INT, format->blue_mask, NULL); } else { structure = gst_structure_new ("video/x-raw-yuv", - "format", GST_TYPE_FOURCC, fourcc, NULL); + "format", GST_TYPE_FOURCC, fourcc, NULL); } gst_structure_set (structure, @@ -158,8 +159,8 @@ gst_videofilter_class_get_capslist (GstVideofilterClass * klass) caps = gst_caps_new_empty (); for (i = 0; i < klass->formats->len; i++) { structure = - gst_videofilter_format_get_structure (g_ptr_array_index (klass->formats, - i)); + gst_videofilter_format_get_structure (g_ptr_array_index (klass->formats, + i)); gst_caps_append_structure (caps, structure); } @@ -201,8 +202,8 @@ gst_videofilter_getcaps (GstPad * pad) GstCaps *fromcaps; fromcaps = - gst_caps_new_full (gst_videofilter_format_get_structure - (g_ptr_array_index (klass->formats, i)), NULL); + gst_caps_new_full (gst_videofilter_format_get_structure + (g_ptr_array_index (klass->formats, i)), NULL); icaps = gst_caps_intersect (fromcaps, peercaps); if (icaps != NULL) { @@ -342,7 +343,7 @@ gst_videofilter_chain (GstPad * pad, GstData * _data) if (size > videofilter->from_buf_size) { GST_INFO ("buffer size %ld larger than expected (%d)", - size, videofilter->from_buf_size); + size, videofilter->from_buf_size); } outbuf = gst_pad_alloc_buffer (videofilter->srcpad, GST_BUFFER_OFFSET_NONE, @@ -505,7 +506,7 @@ gst_videofilter_find_format_by_structure (GstVideofilter * videofilter, format = g_ptr_array_index (klass->formats, i); format_fourcc = GST_STR_FOURCC (format->fourcc); if (format->depth == 0 && format_fourcc == fourcc) { - return format; + return format; } } } else if (strcmp (gst_structure_get_name (structure), "video/x-raw-rgb") @@ -528,9 +529,9 @@ gst_videofilter_find_format_by_structure (GstVideofilter * videofilter, for (i = 0; i < klass->formats->len; i++) { format = g_ptr_array_index (klass->formats, i); if (format->bpp == bpp && format->depth == depth && - format->endianness == endianness && format->red_mask == red_mask && - format->green_mask == green_mask && format->blue_mask == blue_mask) { - return format; + format->endianness == endianness && format->red_mask == red_mask && + format->green_mask == green_mask && format->blue_mask == blue_mask) { + return format; } } } @@ -553,11 +554,11 @@ gst_videofilter_class_add_pad_templates (GstVideofilterClass * gst_element_class_add_pad_template (element_class, gst_pad_template_new ("src", GST_PAD_SRC, GST_PAD_ALWAYS, - gst_videofilter_class_get_capslist (videofilter_class))); + gst_videofilter_class_get_capslist (videofilter_class))); gst_element_class_add_pad_template (element_class, gst_pad_template_new ("sink", GST_PAD_SINK, GST_PAD_ALWAYS, - gst_videofilter_class_get_capslist (videofilter_class))); + gst_videofilter_class_get_capslist (videofilter_class))); } static gboolean diff --git a/gst/videofilter/gstvideoflip.c b/gst/videofilter/gstvideoflip.c index 32157b61..a434107a 100644 --- a/gst/videofilter/gstvideoflip.c +++ b/gst/videofilter/gstvideoflip.c @@ -72,14 +72,15 @@ gst_videoflip_method_get_type (void) {GST_VIDEOFLIP_METHOD_HORIZ, "4", "Flip horizontally"}, {GST_VIDEOFLIP_METHOD_VERT, "5", "Flip vertically"}, {GST_VIDEOFLIP_METHOD_TRANS, "6", - "Flip across upper left/lower right diagonal"}, + "Flip across upper left/lower right diagonal"}, {GST_VIDEOFLIP_METHOD_OTHER, "7", - "Flip across upper right/lower left diagonal"}, + "Flip across upper right/lower left diagonal"}, {0, NULL, NULL}, }; + if (!videoflip_method_type) { videoflip_method_type = g_enum_register_static ("GstVideoflipMethod", - videoflip_methods); + videoflip_methods); } return videoflip_method_type; } @@ -101,8 +102,9 @@ gst_videoflip_get_type (void) 0, gst_videoflip_init, }; + videoflip_type = g_type_register_static (GST_TYPE_VIDEOFILTER, - "GstVideoflip", &videoflip_info, 0); + "GstVideoflip", &videoflip_info, 0); } return videoflip_type; } @@ -130,7 +132,7 @@ gst_videoflip_base_init (gpointer g_class) for (i = 0; i < G_N_ELEMENTS (gst_videoflip_formats); i++) { gst_videofilter_class_add_format (videofilter_class, - gst_videoflip_formats + i); + gst_videoflip_formats + i); } gst_videofilter_class_add_pad_templates (GST_VIDEOFILTER_CLASS (g_class)); @@ -147,8 +149,8 @@ gst_videoflip_class_init (gpointer g_class, gpointer class_data) g_object_class_install_property (gobject_class, ARG_METHOD, g_param_spec_enum ("method", "method", "method", - GST_TYPE_VIDEOFLIP_METHOD, GST_VIDEOFLIP_METHOD_90R, - G_PARAM_READWRITE)); + GST_TYPE_VIDEOFLIP_METHOD, GST_VIDEOFLIP_METHOD_90R, + G_PARAM_READWRITE)); gobject_class->set_property = gst_videoflip_set_property; gobject_class->get_property = gst_videoflip_get_property; @@ -332,51 +334,51 @@ gst_videoflip_flip (GstVideoflip * videoflip, unsigned char *dest, switch (videoflip->method) { case GST_VIDEOFLIP_METHOD_90R: for (y = 0; y < dh; y++) { - for (x = 0; x < dw; x++) { - dest[y * dw + x] = src[(sh - 1 - x) * sw + y]; - } + for (x = 0; x < dw; x++) { + dest[y * dw + x] = src[(sh - 1 - x) * sw + y]; + } } break; case GST_VIDEOFLIP_METHOD_90L: for (y = 0; y < dh; y++) { - for (x = 0; x < dw; x++) { - dest[y * dw + x] = src[x * sw + (sw - 1 - y)]; - } + for (x = 0; x < dw; x++) { + dest[y * dw + x] = src[x * sw + (sw - 1 - y)]; + } } break; case GST_VIDEOFLIP_METHOD_180: for (y = 0; y < dh; y++) { - for (x = 0; x < dw; x++) { - dest[y * dw + x] = src[(sh - 1 - y) * sw + (sw - 1 - x)]; - } + for (x = 0; x < dw; x++) { + dest[y * dw + x] = src[(sh - 1 - y) * sw + (sw - 1 - x)]; + } } break; case GST_VIDEOFLIP_METHOD_HORIZ: for (y = 0; y < dh; y++) { - for (x = 0; x < dw; x++) { - dest[y * dw + x] = src[y * sw + (sw - 1 - x)]; - } + for (x = 0; x < dw; x++) { + dest[y * dw + x] = src[y * sw + (sw - 1 - x)]; + } } break; case GST_VIDEOFLIP_METHOD_VERT: for (y = 0; y < dh; y++) { - for (x = 0; x < dw; x++) { - dest[y * dw + x] = src[(sh - 1 - y) * sw + x]; - } + for (x = 0; x < dw; x++) { + dest[y * dw + x] = src[(sh - 1 - y) * sw + x]; + } } break; case GST_VIDEOFLIP_METHOD_TRANS: for (y = 0; y < dh; y++) { - for (x = 0; x < dw; x++) { - dest[y * dw + x] = src[x * sw + y]; - } + for (x = 0; x < dw; x++) { + dest[y * dw + x] = src[x * sw + y]; + } } break; case GST_VIDEOFLIP_METHOD_OTHER: for (y = 0; y < dh; y++) { - for (x = 0; x < dw; x++) { - dest[y * dw + x] = src[(sh - 1 - x) * sw + (sw - 1 - y)]; - } + for (x = 0; x < dw; x++) { + dest[y * dw + x] = src[(sh - 1 - x) * sw + (sw - 1 - y)]; + } } break; default: diff --git a/gst/videofilter/gstvideotemplate.c b/gst/videofilter/gstvideotemplate.c index abe699fe..aa64ef89 100644 --- a/gst/videofilter/gstvideotemplate.c +++ b/gst/videofilter/gstvideotemplate.c @@ -103,8 +103,9 @@ gst_videotemplate_get_type (void) 0, gst_videotemplate_init, }; + videotemplate_type = g_type_register_static (GST_TYPE_VIDEOFILTER, - "GstVideotemplate", &videotemplate_info, 0); + "GstVideotemplate", &videotemplate_info, 0); } return videotemplate_type; } @@ -130,7 +131,7 @@ gst_videotemplate_base_init (gpointer g_class) for (i = 0; i < G_N_ELEMENTS (gst_videotemplate_formats); i++) { gst_videofilter_class_add_format (videofilter_class, - gst_videotemplate_formats + i); + gst_videotemplate_formats + i); } gst_videofilter_class_add_pad_templates (GST_VIDEOFILTER_CLASS (g_class)); @@ -148,8 +149,8 @@ gst_videotemplate_class_init (gpointer g_class, gpointer class_data) #if 0 g_object_class_install_property (gobject_class, ARG_METHOD, g_param_spec_enum ("method", "method", "method", - GST_TYPE_VIDEOTEMPLATE_METHOD, GST_VIDEOTEMPLATE_METHOD_1, - G_PARAM_READWRITE)); + GST_TYPE_VIDEOTEMPLATE_METHOD, GST_VIDEOTEMPLATE_METHOD_1, + G_PARAM_READWRITE)); #endif gobject_class->set_property = gst_videotemplate_set_property; diff --git a/gst/videoflip/gstvideoflip.c b/gst/videoflip/gstvideoflip.c index 9c7816de..f0160675 100644 --- a/gst/videoflip/gstvideoflip.c +++ b/gst/videoflip/gstvideoflip.c @@ -77,14 +77,15 @@ gst_videoflip_method_get_type (void) {GST_VIDEOFLIP_METHOD_HORIZ, "4", "Flip horizontally"}, {GST_VIDEOFLIP_METHOD_VERT, "5", "Flip vertically"}, {GST_VIDEOFLIP_METHOD_TRANS, "6", - "Flip across upper left/lower right diagonal"}, + "Flip across upper left/lower right diagonal"}, {GST_VIDEOFLIP_METHOD_OTHER, "7", - "Flip across upper right/lower left diagonal"}, + "Flip across upper right/lower left diagonal"}, {0, NULL, NULL}, }; + if (!videoflip_method_type) { videoflip_method_type = g_enum_register_static ("GstVideoflipMethod", - videoflip_methods); + videoflip_methods); } return videoflip_method_type; } @@ -131,9 +132,10 @@ gst_videoflip_get_type (void) 0, (GInstanceInitFunc) gst_videoflip_init, }; + videoflip_type = - g_type_register_static (GST_TYPE_ELEMENT, "GstVideoflip", - &videoflip_info, 0); + g_type_register_static (GST_TYPE_ELEMENT, "GstVideoflip", + &videoflip_info, 0); } return videoflip_type; } @@ -161,8 +163,8 @@ gst_videoflip_class_init (GstVideoflipClass * klass) g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_METHOD, g_param_spec_enum ("method", "method", "method", - GST_TYPE_VIDEOFLIP_METHOD, GST_VIDEOFLIP_METHOD_90R, - G_PARAM_READWRITE)); + GST_TYPE_VIDEOFLIP_METHOD, GST_VIDEOFLIP_METHOD_90R, + G_PARAM_READWRITE)); parent_class = g_type_class_ref (GST_TYPE_ELEMENT); @@ -213,7 +215,7 @@ gst_videoflip_sink_getcaps (GstPad * pad) * the peer's formats. Create a list of them. */ for (i = 0; i < videoflip_n_formats; i++) { GstCaps *fromcaps = - gst_caps_new_full (videoflip_get_cap (videoflip_formats + i), NULL); + gst_caps_new_full (videoflip_get_cap (videoflip_formats + i), NULL); if (gst_caps_is_always_compatible (fromcaps, peercaps)) { gst_caps_append (capslist, fromcaps); } diff --git a/gst/videoflip/videoflip.c b/gst/videoflip/videoflip.c index 16db2102..d7307057 100644 --- a/gst/videoflip/videoflip.c +++ b/gst/videoflip/videoflip.c @@ -60,15 +60,15 @@ videoflip_get_cap (struct videoflip_format_struct *format) if (format->bpp) { structure = gst_structure_new ("video/x-raw-rgb", - "depth", G_TYPE_INT, format->bpp, - "bpp", G_TYPE_INT, format->depth, - "endianness", G_TYPE_INT, format->endianness, - "red_mask", G_TYPE_INT, format->red_mask, - "green_mask", G_TYPE_INT, format->green_mask, - "blue_mask", G_TYPE_INT, format->blue_mask, NULL); + "depth", G_TYPE_INT, format->bpp, + "bpp", G_TYPE_INT, format->depth, + "endianness", G_TYPE_INT, format->endianness, + "red_mask", G_TYPE_INT, format->red_mask, + "green_mask", G_TYPE_INT, format->green_mask, + "blue_mask", G_TYPE_INT, format->blue_mask, NULL); } else { structure = gst_structure_new ("video/x-raw-yuv", - "format", GST_TYPE_FOURCC, fourcc, NULL); + "format", GST_TYPE_FOURCC, fourcc, NULL); } return structure; @@ -89,8 +89,8 @@ videoflip_find_by_caps (const GstCaps * caps) c = gst_caps_new_full (videoflip_get_cap (videoflip_formats + i), NULL); if (c) { if (gst_caps_is_always_compatible (caps, c)) { - gst_caps_free (c); - return videoflip_formats + i; + gst_caps_free (c); + return videoflip_formats + i; } gst_caps_free (c); } @@ -184,51 +184,51 @@ gst_videoflip_flip (GstVideoflip * videoflip, unsigned char *dest, switch (videoflip->method) { case GST_VIDEOFLIP_METHOD_90R: for (y = 0; y < dh; y++) { - for (x = 0; x < dw; x++) { - dest[y * dw + x] = src[(sh - 1 - x) * sw + y]; - } + for (x = 0; x < dw; x++) { + dest[y * dw + x] = src[(sh - 1 - x) * sw + y]; + } } break; case GST_VIDEOFLIP_METHOD_90L: for (y = 0; y < dh; y++) { - for (x = 0; x < dw; x++) { - dest[y * dw + x] = src[x * sw + (sw - 1 - y)]; - } + for (x = 0; x < dw; x++) { + dest[y * dw + x] = src[x * sw + (sw - 1 - y)]; + } } break; case GST_VIDEOFLIP_METHOD_180: for (y = 0; y < dh; y++) { - for (x = 0; x < dw; x++) { - dest[y * dw + x] = src[(sh - 1 - y) * sw + (sw - 1 - x)]; - } + for (x = 0; x < dw; x++) { + dest[y * dw + x] = src[(sh - 1 - y) * sw + (sw - 1 - x)]; + } } break; case GST_VIDEOFLIP_METHOD_HORIZ: for (y = 0; y < dh; y++) { - for (x = 0; x < dw; x++) { - dest[y * dw + x] = src[y * sw + (sw - 1 - x)]; - } + for (x = 0; x < dw; x++) { + dest[y * dw + x] = src[y * sw + (sw - 1 - x)]; + } } break; case GST_VIDEOFLIP_METHOD_VERT: for (y = 0; y < dh; y++) { - for (x = 0; x < dw; x++) { - dest[y * dw + x] = src[(sh - 1 - y) * sw + x]; - } + for (x = 0; x < dw; x++) { + dest[y * dw + x] = src[(sh - 1 - y) * sw + x]; + } } break; case GST_VIDEOFLIP_METHOD_TRANS: for (y = 0; y < dh; y++) { - for (x = 0; x < dw; x++) { - dest[y * dw + x] = src[x * sw + y]; - } + for (x = 0; x < dw; x++) { + dest[y * dw + x] = src[x * sw + y]; + } } break; case GST_VIDEOFLIP_METHOD_OTHER: for (y = 0; y < dh; y++) { - for (x = 0; x < dw; x++) { - dest[y * dw + x] = src[(sh - 1 - x) * sw + (sw - 1 - y)]; - } + for (x = 0; x < dw; x++) { + dest[y * dw + x] = src[(sh - 1 - x) * sw + (sw - 1 - y)]; + } } break; default: diff --git a/gst/wavenc/gstwavenc.c b/gst/wavenc/gstwavenc.c index 757330f0..ea9324a8 100644 --- a/gst/wavenc/gstwavenc.c +++ b/gst/wavenc/gstwavenc.c @@ -44,9 +44,9 @@ static void gst_wavenc_chain (GstPad * pad, GstData * _data); struct riff_struct { - guint8 id[4]; /* RIFF */ + guint8 id[4]; /* RIFF */ guint32 len; - guint8 wav_id[4]; /* WAVE */ + guint8 wav_id[4]; /* WAVE */ }; struct chunk_struct @@ -62,7 +62,7 @@ struct common_struct guint32 dwSamplesPerSec; guint32 dwAvgBytesPerSec; guint16 wBlockAlign; - guint16 wBitsPerSample; /* Only for PCM */ + guint16 wBitsPerSample; /* Only for PCM */ }; struct wave_header @@ -83,11 +83,11 @@ static GstStaticPadTemplate sink_factory = 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, MAX ], " - "endianness = (int) LITTLE_ENDIAN, " - "width = (int) { 8, 16 }, " - "depth = (int) { 8, 16 }, " "signed = (boolean) true") + "rate = (int) [ 1, MAX ], " + "channels = (int) [ 1, MAX ], " + "endianness = (int) LITTLE_ENDIAN, " + "width = (int) { 8, 16 }, " + "depth = (int) { 8, 16 }, " "signed = (boolean) true") ); static GstStaticPadTemplate src_factory = GST_STATIC_PAD_TEMPLATE ("src", @@ -193,7 +193,7 @@ static gboolean gst_wavenc_setup (GstWavEnc * wavenc) { struct wave_header wave; - gint size = 0x7fffffff; /* Use a bogus size initially */ + gint size = 0x7fffffff; /* Use a bogus size initially */ wave.common.wChannels = wavenc->channels; wave.common.wBitsPerSample = wavenc->bits; @@ -283,14 +283,14 @@ gst_wavenc_init (GstWavEnc * wavenc) wavenc->sinkpad = gst_pad_new_from_template (gst_element_class_get_pad_template (klass, - "sink"), "sink"); + "sink"), "sink"); gst_element_add_pad (GST_ELEMENT (wavenc), wavenc->sinkpad); gst_pad_set_chain_function (wavenc->sinkpad, gst_wavenc_chain); gst_pad_set_link_function (wavenc->sinkpad, gst_wavenc_sinkconnect); wavenc->srcpad = gst_pad_new_from_template (gst_element_class_get_pad_template (klass, - "src"), "src"); + "src"), "src"); gst_element_add_pad (GST_ELEMENT (wavenc), wavenc->srcpad); wavenc->setup = FALSE; @@ -303,23 +303,39 @@ struct _maps { guint32 id; char *name; -} maps[] = { +} +maps[] = +{ { - GST_RIFF_INFO_IARL, "Location"}, { - GST_RIFF_INFO_IART, "Artist"}, { - GST_RIFF_INFO_ICMS, "Commissioner"}, { - GST_RIFF_INFO_ICMT, "Comment"}, { - GST_RIFF_INFO_ICOP, "Copyright"}, { - GST_RIFF_INFO_ICRD, "Creation Date"}, { - GST_RIFF_INFO_IENG, "Engineer"}, { - GST_RIFF_INFO_IGNR, "Genre"}, { - GST_RIFF_INFO_IKEY, "Keywords"}, { - GST_RIFF_INFO_INAM, "Title"}, /* Name */ + GST_RIFF_INFO_IARL, "Location"} + , { + GST_RIFF_INFO_IART, "Artist"} + , { + GST_RIFF_INFO_ICMS, "Commissioner"} + , { + GST_RIFF_INFO_ICMT, "Comment"} + , { + GST_RIFF_INFO_ICOP, "Copyright"} + , { + GST_RIFF_INFO_ICRD, "Creation Date"} + , { + GST_RIFF_INFO_IENG, "Engineer"} + , { + GST_RIFF_INFO_IGNR, "Genre"} + , { + GST_RIFF_INFO_IKEY, "Keywords"} + , { + GST_RIFF_INFO_INAM, "Title"} + , /* Name */ { - GST_RIFF_INFO_IPRD, "Product"}, { - GST_RIFF_INFO_ISBJ, "Subject"}, { - GST_RIFF_INFO_ISFT, "Software"}, { - GST_RIFF_INFO_ITCH, "Technician"}, { + GST_RIFF_INFO_IPRD, "Product"} + , { + GST_RIFF_INFO_ISBJ, "Subject"} + , { + GST_RIFF_INFO_ISFT, "Software"} + , { + GST_RIFF_INFO_ITCH, "Technician"} + , { 0, NULL} }; @@ -361,20 +377,20 @@ write_metadata (GstWavEnc * wavenc) char *tmp; int len, req, i; - need_to_write = TRUE; /* We've got at least one entry */ + need_to_write = TRUE; /* We've got at least one entry */ gst_props_entry_get_string (entry, &text); - len = strlen (text) + 1; /* The length in the file includes the \0 */ + len = strlen (text) + 1; /* The length in the file includes the \0 */ tmp = g_strdup_printf (GST_FOURCC_FORMAT "%d%s", GST_FOURCC_ARGS (id), - GUINT32_TO_LE (len), text); + GUINT32_TO_LE (len), text); g_string_append (info_str, tmp); g_free (tmp); /* Check that we end on an even boundary */ req = ((len + 8) + 1) & ~1; for (i = 0; i < req - len; i++) { - g_string_append_printf (info_str, "%c", 0); + g_string_append_printf (info_str, "%c", 0); } total += req; @@ -404,7 +420,7 @@ write_cues (GstWavEnc * wavenc) int num_cues, total = 4; if (gst_props_get (wavenc->metadata->properties, - "cues", &cue_list, NULL) == FALSE) { + "cues", &cue_list, NULL) == FALSE) { /* No cues, move along please, nothing to see here */ return; } @@ -472,13 +488,13 @@ write_labels (GstWavEnc * wavenc) #define LTXT_SIZE 28 ltxt = g_string_new ("ltxt "); - ltxt->str[8] = GUINT32_TO_LE (i); /* Identifier */ - ltxt->str[12] = GUINT32_TO_LE (0); /* Sample Length */ - ltxt->str[16] = GUINT32_TO_LE (0); /* FIXME: Don't save the purpose yet */ - ltxt->str[20] = GUINT16_TO_LE (0); /* Country */ - ltxt->str[22] = GUINT16_TO_LE (0); /* Language */ - ltxt->str[24] = GUINT16_TO_LE (0); /* Dialect */ - ltxt->str[26] = GUINT16_TO_LE (0); /* Code Page */ + ltxt->str[8] = GUINT32_TO_LE (i); /* Identifier */ + ltxt->str[12] = GUINT32_TO_LE (0); /* Sample Length */ + ltxt->str[16] = GUINT32_TO_LE (0); /* FIXME: Don't save the purpose yet */ + ltxt->str[20] = GUINT16_TO_LE (0); /* Country */ + ltxt->str[22] = GUINT16_TO_LE (0); /* Language */ + ltxt->str[24] = GUINT16_TO_LE (0); /* Dialect */ + ltxt->str[26] = GUINT16_TO_LE (0); /* Code Page */ g_string_append (ltxt, label); g_free (label); @@ -489,7 +505,7 @@ write_labels (GstWavEnc * wavenc) /* Check that we end on an even boundary */ req = ((len + 8) + 1) & ~1; for (j = 0; j < req - len; j++) { - g_string_append_printf (ltxt, "%c", 0); + g_string_append_printf (ltxt, "%c", 0); } total += req; @@ -525,7 +541,7 @@ write_labels (GstWavEnc * wavenc) /* Check our size */ req = ((len + 8) + 1) & ~1; for (j = 0; j < req - len; j++) { - g_string_append_printf (labl, "%c", 0); + g_string_append_printf (labl, "%c", 0); } total += req; @@ -561,7 +577,7 @@ write_labels (GstWavEnc * wavenc) /* Size check */ req = ((len + 8) + 1) & ~1; for (j = 0; j < req - len; j++) { - g_string_append_printf (note, "%c", 0); + g_string_append_printf (note, "%c", 0); } total += req; @@ -592,7 +608,7 @@ gst_wavenc_chain (GstPad * pad, GstData * _data) if (!wavenc->setup) { gst_buffer_unref (buf); GST_ELEMENT_ERROR (wavenc, CORE, NEGOTIATION, (NULL), - ("encoder not initialised (input is not audio?)")); + ("encoder not initialised (input is not audio?)")); return; } @@ -603,9 +619,9 @@ gst_wavenc_chain (GstPad * pad, GstData * _data) #if 0 /* Write our metadata if we have any */ if (wavenc->metadata) { - write_metadata (wavenc); - write_cues (wavenc); - write_labels (wavenc); + write_metadata (wavenc); + write_cues (wavenc); + write_labels (wavenc); } #endif diff --git a/gst/wavparse/gstwavparse.c b/gst/wavparse/gstwavparse.c index c2f6a00f..ef30fce3 100644 --- a/gst/wavparse/gstwavparse.c +++ b/gst/wavparse/gstwavparse.c @@ -65,22 +65,22 @@ static GstStaticPadTemplate src_template_factory = GST_PAD_SRC, GST_PAD_ALWAYS, GST_STATIC_CAPS ("audio/x-raw-int, " - "endianness = (int) little_endian, " - "signed = (boolean) { true, false }, " - "width = (int) { 8, 16 }, " - "depth = (int) { 8, 16 }, " - "rate = (int) [ 8000, 48000 ], " - "channels = (int) [ 1, 2 ]; " - "audio/mpeg, " - "mpegversion = (int) 1, " - "layer = (int) [ 1, 3 ], " - "rate = (int) [ 8000, 48000 ], " - "channels = (int) [ 1, 2 ]; " - "audio/x-alaw, " - "rate = (int) [ 8000, 48000 ], " - "channels = (int) [ 1, 2 ]; " - "audio/x-mulaw, " - "rate = (int) [ 8000, 48000 ], " "channels = (int) [ 1, 2 ]") + "endianness = (int) little_endian, " + "signed = (boolean) { true, false }, " + "width = (int) { 8, 16 }, " + "depth = (int) { 8, 16 }, " + "rate = (int) [ 8000, 48000 ], " + "channels = (int) [ 1, 2 ]; " + "audio/mpeg, " + "mpegversion = (int) 1, " + "layer = (int) [ 1, 3 ], " + "rate = (int) [ 8000, 48000 ], " + "channels = (int) [ 1, 2 ]; " + "audio/x-alaw, " + "rate = (int) [ 8000, 48000 ], " + "channels = (int) [ 1, 2 ]; " + "audio/x-mulaw, " + "rate = (int) [ 8000, 48000 ], " "channels = (int) [ 1, 2 ]") ); /* WavParse signals and args */ @@ -116,9 +116,10 @@ gst_wavparse_get_type (void) 0, (GInstanceInitFunc) gst_wavparse_init, }; + wavparse_type = - g_type_register_static (GST_TYPE_ELEMENT, "GstWavParse", &wavparse_info, - 0); + g_type_register_static (GST_TYPE_ELEMENT, "GstWavParse", &wavparse_info, + 0); } return wavparse_type; } @@ -225,7 +226,7 @@ gst_wavparse_parse_adtl (GstWavParse * wavparse, int len) while (len > 0) { got_bytes = - gst_bytestream_peek_bytes (bs, &tempdata, sizeof (gst_riff_chunk)); + gst_bytestream_peek_bytes (bs, &tempdata, sizeof (gst_riff_chunk)); if (got_bytes != sizeof (gst_riff_chunk)) { return; } @@ -242,146 +243,146 @@ gst_wavparse_parse_adtl (GstWavParse * wavparse, int len) switch (chunk.id) { case GST_RIFF_adtl_labl: - got_bytes = - gst_bytestream_peek_bytes (bs, &tempdata, - sizeof (struct _gst_riff_labl)); - if (got_bytes != sizeof (struct _gst_riff_labl)) { - return; - } + got_bytes = + gst_bytestream_peek_bytes (bs, &tempdata, + sizeof (struct _gst_riff_labl)); + if (got_bytes != sizeof (struct _gst_riff_labl)) { + return; + } - temp_labl = (struct _gst_riff_labl *) tempdata; - labl.id = GUINT32_FROM_LE (temp_labl->id); - labl.size = GUINT32_FROM_LE (temp_labl->size); - labl.identifier = GUINT32_FROM_LE (temp_labl->identifier); + temp_labl = (struct _gst_riff_labl *) tempdata; + labl.id = GUINT32_FROM_LE (temp_labl->id); + labl.size = GUINT32_FROM_LE (temp_labl->size); + labl.identifier = GUINT32_FROM_LE (temp_labl->identifier); - gst_bytestream_flush (bs, sizeof (struct _gst_riff_labl)); - len -= sizeof (struct _gst_riff_labl); + gst_bytestream_flush (bs, sizeof (struct _gst_riff_labl)); + len -= sizeof (struct _gst_riff_labl); - got_bytes = gst_bytestream_peek_bytes (bs, &tempdata, labl.size - 4); - if (got_bytes != labl.size - 4) { - return; - } + got_bytes = gst_bytestream_peek_bytes (bs, &tempdata, labl.size - 4); + if (got_bytes != labl.size - 4) { + return; + } - label_name = (char *) tempdata; + label_name = (char *) tempdata; - gst_bytestream_flush (bs, ((labl.size - 4) + 1) & ~1); - len -= (((labl.size - 4) + 1) & ~1); + gst_bytestream_flush (bs, ((labl.size - 4) + 1) & ~1); + len -= (((labl.size - 4) + 1) & ~1); - new_caps = gst_caps_new ("label", - "application/x-gst-metadata", - gst_props_new ("identifier", G_TYPE_INT (labl.identifier), - "name", G_TYPE_STRING (label_name), NULL)); + new_caps = gst_caps_new ("label", + "application/x-gst-metadata", + gst_props_new ("identifier", G_TYPE_INT (labl.identifier), + "name", G_TYPE_STRING (label_name), NULL)); - if (gst_props_get (props, "labels", &caps, NULL)) { - caps = g_list_append (caps, new_caps); - } else { - caps = g_list_append (NULL, new_caps); + if (gst_props_get (props, "labels", &caps, NULL)) { + caps = g_list_append (caps, new_caps); + } else { + caps = g_list_append (NULL, new_caps); - entry = gst_props_entry_new ("labels", GST_PROPS_GLIST (caps)); - gst_props_add_entry (props, entry); - } + entry = gst_props_entry_new ("labels", GST_PROPS_GLIST (caps)); + gst_props_add_entry (props, entry); + } - break; + break; case GST_RIFF_adtl_ltxt: - got_bytes = - gst_bytestream_peek_bytes (bs, &tempdata, - sizeof (struct _gst_riff_ltxt)); - if (got_bytes != sizeof (struct _gst_riff_ltxt)) { - return; - } - - temp_ltxt = (struct _gst_riff_ltxt *) tempdata; - ltxt.id = GUINT32_FROM_LE (temp_ltxt->id); - ltxt.size = GUINT32_FROM_LE (temp_ltxt->size); - ltxt.identifier = GUINT32_FROM_LE (temp_ltxt->identifier); - ltxt.length = GUINT32_FROM_LE (temp_ltxt->length); - ltxt.purpose = GUINT32_FROM_LE (temp_ltxt->purpose); - ltxt.country = GUINT16_FROM_LE (temp_ltxt->country); - ltxt.language = GUINT16_FROM_LE (temp_ltxt->language); - ltxt.dialect = GUINT16_FROM_LE (temp_ltxt->dialect); - ltxt.codepage = GUINT16_FROM_LE (temp_ltxt->codepage); - - gst_bytestream_flush (bs, sizeof (struct _gst_riff_ltxt)); - len -= sizeof (struct _gst_riff_ltxt); - - if (ltxt.size - 20 > 0) { - got_bytes = gst_bytestream_peek_bytes (bs, &tempdata, ltxt.size - 20); - if (got_bytes != ltxt.size - 20) { - return; - } - - gst_bytestream_flush (bs, ((ltxt.size - 20) + 1) & ~1); - len -= (((ltxt.size - 20) + 1) & ~1); - - label_name = (char *) tempdata; - } else { - label_name = ""; - } - - new_caps = gst_caps_new ("ltxt", - "application/x-gst-metadata", - gst_props_new ("identifier", G_TYPE_INT (ltxt.identifier), - "name", G_TYPE_STRING (label_name), - "length", G_TYPE_INT (ltxt.length), NULL)); - - if (gst_props_get (props, "ltxts", &caps, NULL)) { - caps = g_list_append (caps, new_caps); - } else { - caps = g_list_append (NULL, new_caps); - - entry = gst_props_entry_new ("ltxts", GST_PROPS_GLIST (caps)); - gst_props_add_entry (props, entry); - } - - break; + got_bytes = + gst_bytestream_peek_bytes (bs, &tempdata, + sizeof (struct _gst_riff_ltxt)); + if (got_bytes != sizeof (struct _gst_riff_ltxt)) { + return; + } + + temp_ltxt = (struct _gst_riff_ltxt *) tempdata; + ltxt.id = GUINT32_FROM_LE (temp_ltxt->id); + ltxt.size = GUINT32_FROM_LE (temp_ltxt->size); + ltxt.identifier = GUINT32_FROM_LE (temp_ltxt->identifier); + ltxt.length = GUINT32_FROM_LE (temp_ltxt->length); + ltxt.purpose = GUINT32_FROM_LE (temp_ltxt->purpose); + ltxt.country = GUINT16_FROM_LE (temp_ltxt->country); + ltxt.language = GUINT16_FROM_LE (temp_ltxt->language); + ltxt.dialect = GUINT16_FROM_LE (temp_ltxt->dialect); + ltxt.codepage = GUINT16_FROM_LE (temp_ltxt->codepage); + + gst_bytestream_flush (bs, sizeof (struct _gst_riff_ltxt)); + len -= sizeof (struct _gst_riff_ltxt); + + if (ltxt.size - 20 > 0) { + got_bytes = gst_bytestream_peek_bytes (bs, &tempdata, ltxt.size - 20); + if (got_bytes != ltxt.size - 20) { + return; + } + + gst_bytestream_flush (bs, ((ltxt.size - 20) + 1) & ~1); + len -= (((ltxt.size - 20) + 1) & ~1); + + label_name = (char *) tempdata; + } else { + label_name = ""; + } + + new_caps = gst_caps_new ("ltxt", + "application/x-gst-metadata", + gst_props_new ("identifier", G_TYPE_INT (ltxt.identifier), + "name", G_TYPE_STRING (label_name), + "length", G_TYPE_INT (ltxt.length), NULL)); + + if (gst_props_get (props, "ltxts", &caps, NULL)) { + caps = g_list_append (caps, new_caps); + } else { + caps = g_list_append (NULL, new_caps); + + entry = gst_props_entry_new ("ltxts", GST_PROPS_GLIST (caps)); + gst_props_add_entry (props, entry); + } + + break; case GST_RIFF_adtl_note: - got_bytes = - gst_bytestream_peek_bytes (bs, &tempdata, - sizeof (struct _gst_riff_note)); - if (got_bytes != sizeof (struct _gst_riff_note)) { - return; - } + got_bytes = + gst_bytestream_peek_bytes (bs, &tempdata, + sizeof (struct _gst_riff_note)); + if (got_bytes != sizeof (struct _gst_riff_note)) { + return; + } - temp_note = (struct _gst_riff_note *) tempdata; - note.id = GUINT32_FROM_LE (temp_note->id); - note.size = GUINT32_FROM_LE (temp_note->size); - note.identifier = GUINT32_FROM_LE (temp_note->identifier); + temp_note = (struct _gst_riff_note *) tempdata; + note.id = GUINT32_FROM_LE (temp_note->id); + note.size = GUINT32_FROM_LE (temp_note->size); + note.identifier = GUINT32_FROM_LE (temp_note->identifier); - gst_bytestream_flush (bs, sizeof (struct _gst_riff_note)); - len -= sizeof (struct _gst_riff_note); + gst_bytestream_flush (bs, sizeof (struct _gst_riff_note)); + len -= sizeof (struct _gst_riff_note); - got_bytes = gst_bytestream_peek_bytes (bs, &tempdata, note.size - 4); - if (got_bytes != note.size - 4) { - return; - } + got_bytes = gst_bytestream_peek_bytes (bs, &tempdata, note.size - 4); + if (got_bytes != note.size - 4) { + return; + } - gst_bytestream_flush (bs, ((note.size - 4) + 1) & ~1); - len -= (((note.size - 4) + 1) & ~1); + gst_bytestream_flush (bs, ((note.size - 4) + 1) & ~1); + len -= (((note.size - 4) + 1) & ~1); - label_name = (char *) tempdata; + label_name = (char *) tempdata; - new_caps = gst_caps_new ("note", - "application/x-gst-metadata", - gst_props_new ("identifier", G_TYPE_INT (note.identifier), - "name", G_TYPE_STRING (label_name), NULL)); + new_caps = gst_caps_new ("note", + "application/x-gst-metadata", + gst_props_new ("identifier", G_TYPE_INT (note.identifier), + "name", G_TYPE_STRING (label_name), NULL)); - if (gst_props_get (props, "notes", &caps, NULL)) { - caps = g_list_append (caps, new_caps); - } else { - caps = g_list_append (NULL, new_caps); + if (gst_props_get (props, "notes", &caps, NULL)) { + caps = g_list_append (caps, new_caps); + } else { + caps = g_list_append (NULL, new_caps); - entry = gst_props_entry_new ("notes", GST_PROPS_GLIST (caps)); - gst_props_add_entry (props, entry); - } + entry = gst_props_entry_new ("notes", GST_PROPS_GLIST (caps)); + gst_props_add_entry (props, entry); + } - break; + break; default: - g_print ("Unknown chunk: " GST_FOURCC_FORMAT "\n", - GST_FOURCC_ARGS (chunk.id)); - return; + g_print ("Unknown chunk: " GST_FOURCC_FORMAT "\n", + GST_FOURCC_ARGS (chunk.id)); + return; } } @@ -401,7 +402,7 @@ gst_wavparse_parse_info (GstWavParse * wavparse, int len) while (len > 0) { got_bytes = - gst_bytestream_peek_bytes (bs, &tempdata, sizeof (gst_riff_chunk)); + gst_bytestream_peek_bytes (bs, &tempdata, sizeof (gst_riff_chunk)); temp_chunk = (gst_riff_chunk *) tempdata; chunk.id = GUINT32_FROM_LE (temp_chunk->id); @@ -433,65 +434,65 @@ gst_wavparse_parse_info (GstWavParse * wavparse, int len) - find type */ switch (chunk.id) { case GST_RIFF_INFO_IARL: - type = "Location"; - break; + type = "Location"; + break; case GST_RIFF_INFO_IART: - type = "Artist"; - break; + type = "Artist"; + break; case GST_RIFF_INFO_ICMS: - type = "Commissioner"; - break; + type = "Commissioner"; + break; case GST_RIFF_INFO_ICMT: - type = "Comment"; - break; + type = "Comment"; + break; case GST_RIFF_INFO_ICOP: - type = "Copyright"; - break; + type = "Copyright"; + break; case GST_RIFF_INFO_ICRD: - type = "Creation Date"; - break; + type = "Creation Date"; + break; case GST_RIFF_INFO_IENG: - type = "Engineer"; - break; + type = "Engineer"; + break; case GST_RIFF_INFO_IGNR: - type = "Genre"; - break; + type = "Genre"; + break; case GST_RIFF_INFO_IKEY: - type = "Keywords"; - break; + type = "Keywords"; + break; case GST_RIFF_INFO_INAM: - type = "Title"; /* name */ - break; + type = "Title"; /* name */ + break; case GST_RIFF_INFO_IPRD: - type = "Product"; - break; + type = "Product"; + break; case GST_RIFF_INFO_ISBJ: - type = "Subject"; - break; + type = "Subject"; + break; case GST_RIFF_INFO_ISFT: - type = "Software"; - break; + type = "Software"; + break; case GST_RIFF_INFO_ITCH: - type = "Technician"; - break; + type = "Technician"; + break; default: - g_print ("Unknown: %4.4s\n", (char *) &chunk.id); - type = NULL; - break; + g_print ("Unknown: %4.4s\n", (char *) &chunk.id); + type = NULL; + break; } if (type) { @@ -523,8 +524,8 @@ gst_wavparse_parse_cues (GstWavParse * wavparse, int len) int required; got_bytes = - gst_bytestream_peek_bytes (bs, &tempdata, - sizeof (struct _gst_riff_cue)); + gst_bytestream_peek_bytes (bs, &tempdata, + sizeof (struct _gst_riff_cue)); temp_cue = (struct _gst_riff_cue *) tempdata; /* fixup for our big endian friends */ @@ -557,9 +558,9 @@ gst_wavparse_parse_cues (GstWavParse * wavparse, int len) GstCaps *caps; caps = gst_caps_new ("cues", - "application/x-gst-metadata", - gst_props_new ("identifier", G_TYPE_INT (points[i].identifier), - "position", G_TYPE_INT (points[i].offset), NULL)); + "application/x-gst-metadata", + gst_props_new ("identifier", G_TYPE_INT (points[i].identifier), + "position", G_TYPE_INT (points[i].offset), NULL)); cues = g_list_append (cues, caps); } @@ -597,45 +598,45 @@ gst_wavparse_parse_fmt (GstWavParse * wavparse, guint size) switch (wavparse->format) { case GST_RIFF_WAVE_FORMAT_ALAW: case GST_RIFF_WAVE_FORMAT_MULAW:{ - char *mime = (wavparse->format == GST_RIFF_WAVE_FORMAT_ALAW) ? - "audio/x-alaw" : "audio/x-mulaw"; - if (wavparse->width != 8) { - g_warning ("Ignoring invalid width %d", wavparse->width); - return; - } - - caps = gst_caps_new_simple (mime, - "rate", G_TYPE_INT, wavparse->rate, - "channels", G_TYPE_INT, wavparse->channels, NULL); + char *mime = (wavparse->format == GST_RIFF_WAVE_FORMAT_ALAW) ? + "audio/x-alaw" : "audio/x-mulaw"; + if (wavparse->width != 8) { + g_warning ("Ignoring invalid width %d", wavparse->width); + return; + } + + caps = gst_caps_new_simple (mime, + "rate", G_TYPE_INT, wavparse->rate, + "channels", G_TYPE_INT, wavparse->channels, NULL); } - break; + break; case GST_RIFF_WAVE_FORMAT_PCM: - caps = gst_caps_new_simple ("audio/x-raw-int", - "endianness", G_TYPE_INT, G_LITTLE_ENDIAN, - "signed", G_TYPE_BOOLEAN, (wavparse->width > 8) ? TRUE : FALSE, - "width", G_TYPE_INT, wavparse->width, - "depth", G_TYPE_INT, wavparse->width, - "rate", G_TYPE_INT, wavparse->rate, - "channels", G_TYPE_INT, wavparse->channels, NULL); - break; + caps = gst_caps_new_simple ("audio/x-raw-int", + "endianness", G_TYPE_INT, G_LITTLE_ENDIAN, + "signed", G_TYPE_BOOLEAN, (wavparse->width > 8) ? TRUE : FALSE, + "width", G_TYPE_INT, wavparse->width, + "depth", G_TYPE_INT, wavparse->width, + "rate", G_TYPE_INT, wavparse->rate, + "channels", G_TYPE_INT, wavparse->channels, NULL); + break; case GST_RIFF_WAVE_FORMAT_MPEGL12: case GST_RIFF_WAVE_FORMAT_MPEGL3:{ - int layer = (wavparse->format == GST_RIFF_WAVE_FORMAT_MPEGL12) ? 2 : 3; + int layer = (wavparse->format == GST_RIFF_WAVE_FORMAT_MPEGL12) ? 2 : 3; - caps = gst_caps_new_simple ("audio/mpeg", - "mpegversion", G_TYPE_INT, 1, - "layer", G_TYPE_INT, layer, - "rate", G_TYPE_INT, wavparse->rate, - "channels", G_TYPE_INT, wavparse->channels, NULL); + caps = gst_caps_new_simple ("audio/mpeg", + "mpegversion", G_TYPE_INT, 1, + "layer", G_TYPE_INT, layer, + "rate", G_TYPE_INT, wavparse->rate, + "channels", G_TYPE_INT, wavparse->channels, NULL); } - break; + break; default: - GST_ELEMENT_ERROR (wavparse, STREAM, NOT_IMPLEMENTED, (NULL), - ("format %d not handled", wavparse->format)); - return; + GST_ELEMENT_ERROR (wavparse, STREAM, NOT_IMPLEMENTED, (NULL), + ("format %d not handled", wavparse->format)); + return; } if (caps) { @@ -697,7 +698,7 @@ gst_wavparse_loop (GstElement * element) if (wavparse->seek_pending) { GST_DEBUG ("wavparse: seek pending to %" G_GINT64_FORMAT " %08llx", - wavparse->seek_offset, (unsigned long long) wavparse->seek_offset); + wavparse->seek_offset, (unsigned long long) wavparse->seek_offset); if (!gst_bytestream_seek (bs, wavparse->seek_offset, GST_SEEK_METHOD_SET)) { GST_INFO ("wavparse: Could not seek"); @@ -722,17 +723,17 @@ gst_wavparse_loop (GstElement * element) got_bytes = gst_bytestream_peek (bs, &buf, desired); if (got_bytes != desired) { - /* EOS? */ - GstEvent *event; - guint32 remaining; - - gst_bytestream_get_status (bs, &remaining, &event); - if (event && GST_EVENT_TYPE (event) == GST_EVENT_EOS) { - gst_pad_event_default (wavparse->sinkpad, event); - } else { - GST_ELEMENT_ERROR (element, RESOURCE, READ, (NULL), (NULL)); - } - return; + /* EOS? */ + GstEvent *event; + guint32 remaining; + + gst_bytestream_get_status (bs, &remaining, &event); + if (event && GST_EVENT_TYPE (event) == GST_EVENT_EOS) { + gst_pad_event_default (wavparse->sinkpad, event); + } else { + GST_ELEMENT_ERROR (element, RESOURCE, READ, (NULL), (NULL)); + } + return; } wavparse->dataleft -= got_bytes; @@ -755,15 +756,15 @@ gst_wavparse_loop (GstElement * element) /* read first two dwords to get chunktype and size */ while (TRUE) { got_bytes = - gst_bytestream_peek_bytes (bs, &tempdata, sizeof (gst_riff_chunk)); + gst_bytestream_peek_bytes (bs, &tempdata, sizeof (gst_riff_chunk)); temp_chunk = (gst_riff_riff *) tempdata; if (got_bytes < sizeof (gst_riff_chunk)) { - if (!gst_wavparse_handle_sink_event (wavparse)) { - return; - } + if (!gst_wavparse_handle_sink_event (wavparse)) { + return; + } } else { - break; + break; } } @@ -773,31 +774,31 @@ gst_wavparse_loop (GstElement * element) switch (chunk.id) { case GST_RIFF_TAG_RIFF: case GST_RIFF_TAG_LIST: - /* Read complete list chunk */ - while (TRUE) { - got_bytes = - gst_bytestream_peek_bytes (bs, &tempdata, sizeof (gst_riff_list)); - temp_chunk = (gst_riff_riff *) tempdata; - if (got_bytes < sizeof (gst_riff_list)) { - if (!gst_wavparse_handle_sink_event (wavparse)) { - return; - } - } else { - break; - } - } - - chunk.type = GUINT32_FROM_LE (temp_chunk->type); - skipsize = sizeof (gst_riff_list); - break; + /* Read complete list chunk */ + while (TRUE) { + got_bytes = + gst_bytestream_peek_bytes (bs, &tempdata, sizeof (gst_riff_list)); + temp_chunk = (gst_riff_riff *) tempdata; + if (got_bytes < sizeof (gst_riff_list)) { + if (!gst_wavparse_handle_sink_event (wavparse)) { + return; + } + } else { + break; + } + } + + chunk.type = GUINT32_FROM_LE (temp_chunk->type); + skipsize = sizeof (gst_riff_list); + break; case GST_RIFF_TAG_cue: - skipsize = 0; - break; + skipsize = 0; + break; default: - skipsize = sizeof (gst_riff_chunk); - break; + skipsize = sizeof (gst_riff_chunk); + break; } gst_bytestream_flush (bs, skipsize); } while (FALSE); @@ -808,9 +809,9 @@ gst_wavparse_loop (GstElement * element) switch (wavparse->state) { case GST_WAVPARSE_START: if (chunk.id != GST_RIFF_TAG_RIFF && chunk.type != GST_RIFF_RIFF_WAVE) { - GST_ELEMENT_ERROR (element, STREAM, WRONG_TYPE, (NULL), - ("chunk.id %08x chunk.type %08x", chunk.id, chunk.type)); - return; + GST_ELEMENT_ERROR (element, STREAM, WRONG_TYPE, (NULL), + ("chunk.id %08x chunk.type %08x", chunk.id, chunk.type)); + return; } wavparse->state = GST_WAVPARSE_OTHER; @@ -822,45 +823,45 @@ gst_wavparse_loop (GstElement * element) GST_DEBUG ("riff tag: %4.4s %08x", (char *) &chunk.id, chunk.size); switch (chunk.id) { - case GST_RIFF_TAG_data: - wavparse->state = GST_WAVPARSE_DATA; - wavparse->dataleft = chunk.size; - wavparse->byteoffset = 0; - flush = 0; - break; - - case GST_RIFF_TAG_fmt: - gst_wavparse_parse_fmt (wavparse, chunk.size); - flush = 0; - break; - - case GST_RIFF_TAG_cue: - //gst_wavparse_parse_cues (wavparse, chunk.size); - break; - - case GST_RIFF_TAG_LIST: - GST_DEBUG ("list type: %4.4s", (char *) &chunk.type); - switch (chunk.type) { - case GST_RIFF_LIST_INFO: - //gst_wavparse_parse_info (wavparse, chunk.size - 4); - //flush = 0; - - break; - - case GST_RIFF_LIST_adtl: - //gst_wavparse_parse_adtl (wavparse, chunk.size - 4); - //flush = 0; - break; - - default: - //flush = 0; - break; - } - - default: - GST_DEBUG (" ***** unknown chunkid %08x", chunk.id); - //flush = 0; - break; + case GST_RIFF_TAG_data: + wavparse->state = GST_WAVPARSE_DATA; + wavparse->dataleft = chunk.size; + wavparse->byteoffset = 0; + flush = 0; + break; + + case GST_RIFF_TAG_fmt: + gst_wavparse_parse_fmt (wavparse, chunk.size); + flush = 0; + break; + + case GST_RIFF_TAG_cue: + //gst_wavparse_parse_cues (wavparse, chunk.size); + break; + + case GST_RIFF_TAG_LIST: + GST_DEBUG ("list type: %4.4s", (char *) &chunk.type); + switch (chunk.type) { + case GST_RIFF_LIST_INFO: + //gst_wavparse_parse_info (wavparse, chunk.size - 4); + //flush = 0; + + break; + + case GST_RIFF_LIST_adtl: + //gst_wavparse_parse_adtl (wavparse, chunk.size - 4); + //flush = 0; + break; + + default: + //flush = 0; + break; + } + + default: + GST_DEBUG (" ***** unknown chunkid %08x", chunk.id); + //flush = 0; + break; } break; @@ -897,10 +898,11 @@ gst_wavparse_get_formats (GstPad * pad) static GstFormat formats[] = { GST_FORMAT_TIME, GST_FORMAT_BYTES, - GST_FORMAT_DEFAULT, /* a "frame", ie a set of samples per Hz */ + GST_FORMAT_DEFAULT, /* a "frame", ie a set of samples per Hz */ 0, 0 }; + return formats; } @@ -921,7 +923,7 @@ gst_wavparse_pad_convert (GstPad * pad, bytes_per_sample = wavparse->channels * wavparse->width / 8; if (bytes_per_sample == 0) { GST_DEBUG ("bytes_per_sample 0, probably an mp3 - channels %d, width %d", - wavparse->channels, wavparse->width); + wavparse->channels, wavparse->width); return FALSE; } byterate = (glong) (bytes_per_sample * wavparse->rate); @@ -951,33 +953,33 @@ gst_wavparse_pad_convert (GstPad * pad, switch (src_format) { case GST_FORMAT_BYTES: if (*dest_format == GST_FORMAT_DEFAULT) - *dest_value = src_value / bytes_per_sample; + *dest_value = src_value / bytes_per_sample; else if (*dest_format == GST_FORMAT_TIME) - *dest_value = src_value * GST_SECOND / byterate; + *dest_value = src_value * GST_SECOND / byterate; else { - GST_DEBUG ("can't convert from bytes to other than units/time"); - return FALSE; + GST_DEBUG ("can't convert from bytes to other than units/time"); + return FALSE; } break; case GST_FORMAT_DEFAULT: if (*dest_format == GST_FORMAT_BYTES) - *dest_value = src_value * bytes_per_sample; + *dest_value = src_value * bytes_per_sample; else if (*dest_format == GST_FORMAT_TIME) - *dest_value = src_value * GST_SECOND / wavparse->rate; + *dest_value = src_value * GST_SECOND / wavparse->rate; else { - GST_DEBUG ("can't convert from units to other than bytes/time"); - return FALSE; + GST_DEBUG ("can't convert from units to other than bytes/time"); + return FALSE; } break; case GST_FORMAT_TIME: if (*dest_format == GST_FORMAT_BYTES) - *dest_value = src_value * byterate / GST_SECOND; + *dest_value = src_value * byterate / GST_SECOND; else if (*dest_format == GST_FORMAT_DEFAULT) - *dest_value = src_value * wavparse->rate / GST_SECOND; + *dest_value = src_value * wavparse->rate / GST_SECOND; else { - GST_DEBUG ("can't convert from time to other than bytes/units"); - return FALSE; + GST_DEBUG ("can't convert from time to other than bytes/units"); + return FALSE; } *dest_value = *dest_value & ~(bytes_per_sample - 1); @@ -997,6 +999,7 @@ gst_wavparse_get_query_types (GstPad * pad) GST_QUERY_POSITION, 0 }; + return types; } @@ -1016,12 +1019,12 @@ gst_wavparse_pad_query (GstPad * pad, GstQueryType type, /* only support byte, time and unit queries */ wavparse = GST_WAVPARSE (gst_pad_get_parent (pad)); if (!gst_pad_query (GST_PAD_PEER (wavparse->sinkpad), type, - &peer_format, &peer_value)) { + &peer_format, &peer_value)) { GST_DEBUG ("Could not query sink pad's peer"); return FALSE; } if (!gst_pad_convert (wavparse->sinkpad, peer_format, peer_value, - format, value)) { + format, value)) { GST_DEBUG ("Could not convert sink pad's peer"); return FALSE; } @@ -1036,6 +1039,7 @@ gst_wavparse_get_event_masks (GstPad * pad) {GST_EVENT_SEEK, GST_SEEK_METHOD_SET | GST_SEEK_FLAG_FLUSH}, {0,} }; + return gst_wavparse_src_event_masks; } @@ -1056,7 +1060,7 @@ gst_wavparse_srcpad_event (GstPad * pad, GstEvent * event) /* we can only seek when in the DATA state */ if (wavparse->state != GST_WAVPARSE_DATA) { - return FALSE; + return FALSE; } format = GST_FORMAT_BYTES; @@ -1064,14 +1068,14 @@ gst_wavparse_srcpad_event (GstPad * pad, GstEvent * event) /* bring format to bytes for the peer element, * FIXME be smarter here */ res = gst_pad_convert (pad, - GST_EVENT_SEEK_FORMAT (event), - GST_EVENT_SEEK_OFFSET (event), &format, &byteoffset); + GST_EVENT_SEEK_FORMAT (event), + GST_EVENT_SEEK_OFFSET (event), &format, &byteoffset); if (res) { - /* ok, seek worked, update our state */ - wavparse->seek_offset = byteoffset; - wavparse->seek_pending = TRUE; - wavparse->need_discont = TRUE; + /* ok, seek worked, update our state */ + wavparse->seek_offset = byteoffset; + wavparse->seek_pending = TRUE; + wavparse->need_discont = TRUE; } break; } diff --git a/sys/oss/gstossaudio.c b/sys/oss/gstossaudio.c index ecbbd9bc..f34e78bc 100644 --- a/sys/oss/gstossaudio.c +++ b/sys/oss/gstossaudio.c @@ -38,11 +38,11 @@ plugin_init (GstPlugin * plugin) return FALSE; if (!gst_element_register (plugin, "ossmixer", GST_RANK_PRIMARY, - GST_TYPE_OSSELEMENT) || + GST_TYPE_OSSELEMENT) || !gst_element_register (plugin, "osssrc", GST_RANK_PRIMARY, - GST_TYPE_OSSSRC) || + GST_TYPE_OSSSRC) || !gst_element_register (plugin, "osssink", GST_RANK_PRIMARY, - GST_TYPE_OSSSINK)) { + GST_TYPE_OSSSINK)) { return FALSE; } diff --git a/sys/oss/gstosselement.c b/sys/oss/gstosselement.c index 56dd20da..ad609afc 100644 --- a/sys/oss/gstosselement.c +++ b/sys/oss/gstosselement.c @@ -105,13 +105,13 @@ gst_osselement_get_type (void) }; osselement_type = g_type_register_static (GST_TYPE_ELEMENT, - "GstOssElement", &osselement_info, 0); + "GstOssElement", &osselement_info, 0); g_type_add_interface_static (osselement_type, - GST_TYPE_IMPLEMENTS_INTERFACE, &ossiface_info); + GST_TYPE_IMPLEMENTS_INTERFACE, &ossiface_info); g_type_add_interface_static (osselement_type, - GST_TYPE_MIXER, &ossmixer_info); + GST_TYPE_MIXER, &ossmixer_info); g_type_add_interface_static (osselement_type, - GST_TYPE_PROPERTY_PROBE, &ossprobe_info); + GST_TYPE_PROPERTY_PROBE, &ossprobe_info); } return osselement_type; @@ -140,14 +140,14 @@ gst_osselement_class_init (GstOssElementClass * klass) g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_DEVICE, g_param_spec_string ("device", "Device", "OSS device (/dev/dspN usually)", - "default", G_PARAM_READWRITE)); + "default", G_PARAM_READWRITE)); g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_MIXERDEV, g_param_spec_string ("mixerdev", "Mixer device", - "OSS mixer device (/dev/mixerN usually)", - "default", G_PARAM_READWRITE)); + "OSS mixer device (/dev/mixerN usually)", + "default", G_PARAM_READWRITE)); g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_DEVICE_NAME, g_param_spec_string ("device_name", "Device name", "Name of the device", - NULL, G_PARAM_READABLE)); + NULL, G_PARAM_READABLE)); gobject_class->set_property = gst_osselement_set_property; gobject_class->get_property = gst_osselement_get_property; @@ -274,38 +274,38 @@ gst_osselement_class_probe_devices (GstOssElementClass * klass, gboolean check) gint fd; for (n = -1; n < MAX_OSS_DEVICES; n++) { - gchar *dsp = NULL; - gchar *mixer = NULL; - dev_t dsp_dev; - dev_t mixer_dev; - - gst_osselement_probe (dev_base[base][DSP], n, &dsp, &dsp_dev); - if (dsp == NULL) { - continue; - } - gst_osselement_probe (dev_base[base][MIXER], n, &mixer, &mixer_dev); - /* does the device exist (can we open them)? */ - - /* we just check the dsp. we assume the mixer always works. - * we don't need a mixer anyway (says OSS)... If we are a - * mixer element, we use the mixer anyway. */ - if ((fd = open (mixer ? mixer : - dsp, openmode | O_NONBLOCK)) > 0 || errno == EBUSY) { - GstOssDeviceCombination *combi; - - if (fd > 0) - close (fd); - - /* yay! \o/ */ - combi = g_new0 (GstOssDeviceCombination, 1); - combi->dsp = dsp; - combi->mixer = mixer; - device_combinations = device_combination_append (device_combinations, - combi); - } else { - g_free (dsp); - g_free (mixer); - } + gchar *dsp = NULL; + gchar *mixer = NULL; + dev_t dsp_dev; + dev_t mixer_dev; + + gst_osselement_probe (dev_base[base][DSP], n, &dsp, &dsp_dev); + if (dsp == NULL) { + continue; + } + gst_osselement_probe (dev_base[base][MIXER], n, &mixer, &mixer_dev); + /* does the device exist (can we open them)? */ + + /* we just check the dsp. we assume the mixer always works. + * we don't need a mixer anyway (says OSS)... If we are a + * mixer element, we use the mixer anyway. */ + if ((fd = open (mixer ? mixer : + dsp, openmode | O_NONBLOCK)) > 0 || errno == EBUSY) { + GstOssDeviceCombination *combi; + + if (fd > 0) + close (fd); + + /* yay! \o/ */ + combi = g_new0 (GstOssDeviceCombination, 1); + combi->dsp = dsp; + combi->mixer = mixer; + device_combinations = device_combination_append (device_combinations, + combi); + } else { + g_free (dsp); + g_free (mixer); + } } } @@ -463,30 +463,30 @@ gst_ossformat_get (gint law, gint endianness, gboolean sign, gint width, if (law == 0) { if (width == 16) { if (sign == TRUE) { - if (endianness == G_LITTLE_ENDIAN) { - *format = AFMT_S16_LE; - GST_DEBUG ("16 bit signed LE, no law (%d)", *format); - } else if (endianness == G_BIG_ENDIAN) { - *format = AFMT_S16_BE; - GST_DEBUG ("16 bit signed BE, no law (%d)", *format); - } + if (endianness == G_LITTLE_ENDIAN) { + *format = AFMT_S16_LE; + GST_DEBUG ("16 bit signed LE, no law (%d)", *format); + } else if (endianness == G_BIG_ENDIAN) { + *format = AFMT_S16_BE; + GST_DEBUG ("16 bit signed BE, no law (%d)", *format); + } } else { - if (endianness == G_LITTLE_ENDIAN) { - *format = AFMT_U16_LE; - GST_DEBUG ("16 bit unsigned LE, no law (%d)", *format); - } else if (endianness == G_BIG_ENDIAN) { - *format = AFMT_U16_BE; - GST_DEBUG ("16 bit unsigned BE, no law (%d)", *format); - } + if (endianness == G_LITTLE_ENDIAN) { + *format = AFMT_U16_LE; + GST_DEBUG ("16 bit unsigned LE, no law (%d)", *format); + } else if (endianness == G_BIG_ENDIAN) { + *format = AFMT_U16_BE; + GST_DEBUG ("16 bit unsigned BE, no law (%d)", *format); + } } *bps = 2; } else if (width == 8) { if (sign == TRUE) { - *format = AFMT_S8; - GST_DEBUG ("8 bit signed, no law (%d)", *format); + *format = AFMT_S8; + GST_DEBUG ("8 bit signed, no law (%d)", *format); } else { - *format = AFMT_U8; - GST_DEBUG ("8 bit unsigned, no law (%d)", *format); + *format = AFMT_U8; + GST_DEBUG ("8 bit unsigned, no law (%d)", *format); } *bps = 1; } @@ -523,7 +523,7 @@ gst_osselement_parse_caps (GstOssElement * oss, const GstCaps * caps) gst_structure_get_boolean (structure, "signed", &oss->sign); if (!gst_ossformat_get (oss->law, oss->endianness, oss->sign, - oss->width, oss->depth, &format, &bps)) { + oss->width, oss->depth, &format, &bps)) { GST_DEBUG ("could not get format"); return FALSE; } @@ -564,7 +564,7 @@ gst_osselement_merge_fixed_caps (GstOssElement * oss, GstCaps * caps) gst_structure_get_int (structure, "depth", &oss->depth); if (!gst_ossformat_get (oss->law, oss->endianness, oss->sign, - oss->width, oss->depth, &format, &bps)) { + oss->width, oss->depth, &format, &bps)) { return FALSE; } @@ -640,12 +640,12 @@ gst_osselement_sync_parms (GstOssElement * oss) target_channels != oss->channels || target_rate != oss->rate) { if (target_channels != oss->channels) g_warning - ("couldn't set the right number of channels (wanted %d, got %d), enjoy the tone difference", - target_channels, oss->channels); + ("couldn't set the right number of channels (wanted %d, got %d), enjoy the tone difference", + target_channels, oss->channels); if (target_rate != oss->rate) g_warning - ("couldn't set the right sample rate (wanted %d, got %d), enjoy the speed difference", - target_rate, oss->rate); + ("couldn't set the right sample rate (wanted %d, got %d), enjoy the speed difference", + target_rate, oss->rate); if (target_format != oss->format) g_warning ("couldn't set requested OSS format, enjoy the noise :)"); /* we could eventually return FALSE here, or just do some additional tests @@ -696,39 +696,39 @@ gst_osselement_open_audio (GstOssElement * oss) if (oss->fd < 0) { switch (errno) { case EBUSY: - GST_ELEMENT_ERROR (oss, RESOURCE, BUSY, - (_("OSS device \"%s\" is already in use by another program."), - oss->device), (NULL)); - break; + GST_ELEMENT_ERROR (oss, RESOURCE, BUSY, + (_("OSS device \"%s\" is already in use by another program."), + oss->device), (NULL)); + break; case EACCES: case ETXTBSY: - if (mode == GST_OSSELEMENT_WRITE) - GST_ELEMENT_ERROR (oss, RESOURCE, OPEN_WRITE, - (_("Could not access device \"%s\", check its permissions."), - oss->device), GST_ERROR_SYSTEM); - else - GST_ELEMENT_ERROR (oss, RESOURCE, OPEN_READ, - (_("Could not access device \"%s\", check its permissions."), - oss->device), GST_ERROR_SYSTEM); - break; + if (mode == GST_OSSELEMENT_WRITE) + GST_ELEMENT_ERROR (oss, RESOURCE, OPEN_WRITE, + (_("Could not access device \"%s\", check its permissions."), + oss->device), GST_ERROR_SYSTEM); + else + GST_ELEMENT_ERROR (oss, RESOURCE, OPEN_READ, + (_("Could not access device \"%s\", check its permissions."), + oss->device), GST_ERROR_SYSTEM); + break; case ENXIO: case ENODEV: case ENOENT: - GST_ELEMENT_ERROR (oss, RESOURCE, NOT_FOUND, - (_("Device \"%s\" does not exist."), oss->device), - GST_ERROR_SYSTEM); - break; + GST_ELEMENT_ERROR (oss, RESOURCE, NOT_FOUND, + (_("Device \"%s\" does not exist."), oss->device), + GST_ERROR_SYSTEM); + break; default: - /* FIXME: strerror is not threadsafe */ - if (mode == GST_OSSELEMENT_WRITE) - GST_ELEMENT_ERROR (oss, RESOURCE, OPEN_WRITE, - (_("Could not open device \"%s\" for writing."), oss->device), - GST_ERROR_SYSTEM); - else - GST_ELEMENT_ERROR (oss, RESOURCE, OPEN_READ, - (_("Could not open device \"%s\" for reading."), oss->device), - GST_ERROR_SYSTEM); - break; + /* FIXME: strerror is not threadsafe */ + if (mode == GST_OSSELEMENT_WRITE) + GST_ELEMENT_ERROR (oss, RESOURCE, OPEN_WRITE, + (_("Could not open device \"%s\" for writing."), oss->device), + GST_ERROR_SYSTEM); + else + GST_ELEMENT_ERROR (oss, RESOURCE, OPEN_READ, + (_("Could not open device \"%s\" for reading."), oss->device), + GST_ERROR_SYSTEM); + break; } return FALSE; } @@ -832,38 +832,38 @@ gst_osselement_convert (GstOssElement * oss, switch (src_format) { case GST_FORMAT_BYTES: switch (*dest_format) { - case GST_FORMAT_TIME: - *dest_value = src_value * GST_SECOND / oss->bps; - break; - case GST_FORMAT_DEFAULT: - *dest_value = src_value / (oss->width * oss->channels / 8); - break; - default: - res = FALSE; + case GST_FORMAT_TIME: + *dest_value = src_value * GST_SECOND / oss->bps; + break; + case GST_FORMAT_DEFAULT: + *dest_value = src_value / (oss->width * oss->channels / 8); + break; + default: + res = FALSE; } break; case GST_FORMAT_TIME: switch (*dest_format) { - case GST_FORMAT_BYTES: - *dest_value = src_value * oss->bps / GST_SECOND; - break; - case GST_FORMAT_DEFAULT: - *dest_value = src_value * oss->rate / GST_SECOND; - break; - default: - res = FALSE; + case GST_FORMAT_BYTES: + *dest_value = src_value * oss->bps / GST_SECOND; + break; + case GST_FORMAT_DEFAULT: + *dest_value = src_value * oss->rate / GST_SECOND; + break; + default: + res = FALSE; } break; case GST_FORMAT_DEFAULT: switch (*dest_format) { - case GST_FORMAT_TIME: - *dest_value = src_value * GST_SECOND / oss->rate; - break; - case GST_FORMAT_BYTES: - *dest_value = src_value * oss->width * oss->channels / 8; - break; - default: - res = FALSE; + case GST_FORMAT_TIME: + *dest_value = src_value * GST_SECOND / oss->rate; + break; + case GST_FORMAT_BYTES: + *dest_value = src_value * oss->width * oss->channels / 8; + break; + default: + res = FALSE; } break; default: @@ -884,34 +884,34 @@ gst_osselement_set_property (GObject * object, /* disallow changing the device while it is opened get_property("device") should return the right one */ if (gst_element_get_state (GST_ELEMENT (oss)) == GST_STATE_NULL) { - g_free (oss->device); - oss->device = g_strdup (g_value_get_string (value)); - - /* let's assume that if we have a device map for the mixer, - * we're allowed to do all that automagically here */ - if (GST_OSSELEMENT_GET_CLASS (oss)->device_combinations != NULL) { - GList *list = GST_OSSELEMENT_GET_CLASS (oss)->device_combinations; - - while (list) { - GstOssDeviceCombination *combi = list->data; - - if (!strcmp (combi->dsp, oss->device)) { - g_free (oss->mixer_dev); - oss->mixer_dev = g_strdup (combi->mixer); - break; - } - - list = list->next; - } - } + g_free (oss->device); + oss->device = g_strdup (g_value_get_string (value)); + + /* let's assume that if we have a device map for the mixer, + * we're allowed to do all that automagically here */ + if (GST_OSSELEMENT_GET_CLASS (oss)->device_combinations != NULL) { + GList *list = GST_OSSELEMENT_GET_CLASS (oss)->device_combinations; + + while (list) { + GstOssDeviceCombination *combi = list->data; + + if (!strcmp (combi->dsp, oss->device)) { + g_free (oss->mixer_dev); + oss->mixer_dev = g_strdup (combi->mixer); + break; + } + + list = list->next; + } + } } break; case ARG_MIXERDEV: /* disallow changing the device while it is opened get_property("mixerdev") should return the right one */ if (gst_element_get_state (GST_ELEMENT (oss)) == GST_STATE_NULL) { - g_free (oss->mixer_dev); - oss->mixer_dev = g_strdup (g_value_get_string (value)); + g_free (oss->mixer_dev); + oss->mixer_dev = g_strdup (g_value_get_string (value)); } break; default: @@ -949,7 +949,7 @@ gst_osselement_change_state (GstElement * element) switch (GST_STATE_TRANSITION (element)) { case GST_STATE_NULL_TO_READY: if (!gst_osselement_open_audio (oss)) { - return GST_STATE_FAILURE; + return GST_STATE_FAILURE; } GST_INFO ("osselement: opened sound device"); break; diff --git a/sys/oss/gstossmixer.c b/sys/oss/gstossmixer.c index a9e7222c..39b0d7c7 100644 --- a/sys/oss/gstossmixer.c +++ b/sys/oss/gstossmixer.c @@ -74,37 +74,64 @@ fill_labels (void) struct { gchar *given, *wanted; - } cases[] = { + } + cases[] = + { /* Note: this list is simply ripped from soundcard.h. For * some people, some values might be missing (3D surround, * etc.) - feel free to add them. That's the reason why * I'm doing this in such a horribly complicated way. */ { - "Vol ", _("Volume")}, { - "Bass ", _("Bass")}, { - "Trebl", _("Treble")}, { - "Synth", _("Synth")}, { - "Pcm ", _("PCM")}, { - "Spkr ", _("Speaker")}, { - "Line ", _("Line-in")}, { - "Mic ", _("Microphone")}, { - "CD ", _("CD")}, { - "Mix ", _("Mixer")}, { - "Pcm2 ", _("PCM-2")}, { - "Rec ", _("Record")}, { - "IGain", _("In-gain")}, { - "OGain", _("Out-gain")}, { - "Line1", _("Line-1")}, { - "Line2", _("Line-2")}, { - "Line3", _("Line-3")}, { - "Digital1", _("Digital-1")}, { - "Digital2", _("Digital-2")}, { - "Digital3", _("Digital-3")}, { - "PhoneIn", _("Phone-in")}, { - "PhoneOut", _("Phone-out")}, { - "Video", _("Video")}, { - "Radio", _("Radio")}, { - "Monitor", _("Monitor")}, { + "Vol ", _("Volume")} + , { + "Bass ", _("Bass")} + , { + "Trebl", _("Treble")} + , { + "Synth", _("Synth")} + , { + "Pcm ", _("PCM")} + , { + "Spkr ", _("Speaker")} + , { + "Line ", _("Line-in")} + , { + "Mic ", _("Microphone")} + , { + "CD ", _("CD")} + , { + "Mix ", _("Mixer")} + , { + "Pcm2 ", _("PCM-2")} + , { + "Rec ", _("Record")} + , { + "IGain", _("In-gain")} + , { + "OGain", _("Out-gain")} + , { + "Line1", _("Line-1")} + , { + "Line2", _("Line-2")} + , { + "Line3", _("Line-3")} + , { + "Digital1", _("Digital-1")} + , { + "Digital2", _("Digital-2")} + , { + "Digital3", _("Digital-3")} + , { + "PhoneIn", _("Phone-in")} + , { + "PhoneOut", _("Phone-out")} + , { + "Video", _("Video")} + , { + "Radio", _("Radio")} + , { + "Monitor", _("Monitor")} + , { NULL, NULL} }; @@ -113,8 +140,8 @@ fill_labels (void) for (i = 0; i < SOUND_MIXER_NRDEVICES; i++) { for (pos = 0; cases[pos].given != NULL; pos++) { if (!strcmp (cases[pos].given, origs[i])) { - labels[i] = g_strdup (cases[pos].wanted); - break; + labels[i] = g_strdup (cases[pos].wanted); + break; } } if (cases[pos].given == NULL) @@ -142,8 +169,8 @@ gst_ossmixer_track_get_type (void) }; gst_ossmixer_track_type = - g_type_register_static (GST_TYPE_MIXER_TRACK, - "GstOssMixerTrack", &ossmixer_track_info, 0); + g_type_register_static (GST_TYPE_MIXER_TRACK, + "GstOssMixerTrack", &ossmixer_track_info, 0); } return gst_ossmixer_track_type; @@ -185,7 +212,7 @@ gst_ossmixer_track_new (GstOssElement * oss, /* volume */ if (ioctl (oss->mixer_fd, MIXER_READ (osstrack->track_num), &volume) < 0) { g_warning ("Error getting device (%d) volume: %s", - osstrack->track_num, strerror (errno)); + osstrack->track_num, strerror (errno)); volume = 0; } osstrack->lvol = (volume & 0xff); @@ -263,7 +290,7 @@ gst_ossmixer_get_volume (GstMixer * mixer, /* get */ if (ioctl (oss->mixer_fd, MIXER_READ (osstrack->track_num), &volume) < 0) { g_warning ("Error getting recording device (%d) volume: %s", - osstrack->track_num, strerror (errno)); + osstrack->track_num, strerror (errno)); volume = 0; } @@ -296,7 +323,7 @@ gst_ossmixer_set_volume (GstMixer * mixer, /* set */ if (ioctl (oss->mixer_fd, MIXER_WRITE (osstrack->track_num), &volume) < 0) { g_warning ("Error setting recording device (%d) volume (0x%x): %s", - osstrack->track_num, volume, strerror (errno)); + osstrack->track_num, volume, strerror (errno)); return; } } @@ -329,7 +356,7 @@ gst_ossmixer_set_mute (GstMixer * mixer, GstMixerTrack * track, gboolean mute) if (ioctl (oss->mixer_fd, MIXER_WRITE (osstrack->track_num), &volume) < 0) { g_warning ("Error setting mixer recording device volume (0x%x): %s", - volume, strerror (errno)); + volume, strerror (errno)); return; } @@ -378,7 +405,7 @@ gst_ossmixer_set_record (GstMixer * mixer, /* set it to the device */ if (ioctl (oss->mixer_fd, SOUND_MIXER_WRITE_RECSRC, &oss->recdevs) < 0) { g_warning ("Error setting mixer recording devices (0x%x): %s", - oss->recdevs, strerror (errno)); + oss->recdevs, strerror (errno)); return; } @@ -406,7 +433,7 @@ gst_ossmixer_build_list (GstOssElement * oss) if (oss->mixer_fd == -1) { /* this is valid. OSS devices don't need to expose a mixer */ GST_DEBUG ("Failed to open mixer device %s, mixing disabled: %s", - oss->mixer_dev, strerror (errno)); + oss->mixer_dev, strerror (errno)); return; } @@ -441,7 +468,7 @@ gst_ossmixer_build_list (GstOssElement * oss) else if (devmask & SOUND_MASK_PCM) master = SOUND_MIXER_PCM; else if (devmask & SOUND_MASK_SPEAKER) - master = SOUND_MIXER_SPEAKER; /* doubtful... */ + master = SOUND_MIXER_SPEAKER; /* doubtful... */ /* else: no master, so we won't set any */ /* build track list */ @@ -452,23 +479,23 @@ gst_ossmixer_build_list (GstOssElement * oss) /* track exists, make up capabilities */ if (MASK_BIT_IS_SET (oss->stereomask, i)) - stereo = TRUE; + stereo = TRUE; if (MASK_BIT_IS_SET (oss->recmask, i)) - input = TRUE; + input = TRUE; if (MASK_BIT_IS_SET (oss->recdevs, i)) - record = TRUE; + record = TRUE; /* do we want this in our list? */ if ((dir == GST_PAD_SRC && input == FALSE) || - (dir == GST_PAD_SINK && i != SOUND_MIXER_PCM)) - continue; + (dir == GST_PAD_SINK && i != SOUND_MIXER_PCM)) + continue; /* add track to list */ track = gst_ossmixer_track_new (oss, i, stereo ? 2 : 1, - (record ? GST_MIXER_TRACK_RECORD : 0) | - (input ? GST_MIXER_TRACK_INPUT : - GST_MIXER_TRACK_OUTPUT) | - ((master != i) ? 0 : GST_MIXER_TRACK_MASTER)); + (record ? GST_MIXER_TRACK_RECORD : 0) | + (input ? GST_MIXER_TRACK_INPUT : + GST_MIXER_TRACK_OUTPUT) | + ((master != i) ? 0 : GST_MIXER_TRACK_MASTER)); oss->tracklist = g_list_append (oss->tracklist, track); } } diff --git a/sys/oss/gstosssink.c b/sys/oss/gstosssink.c index 053eba46..9d06b064 100644 --- a/sys/oss/gstosssink.c +++ b/sys/oss/gstosssink.c @@ -92,11 +92,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, FALSE }, " - "width = (int) { 8, 16 }, " - "depth = (int) { 8, 16 }, " - "rate = (int) [ 1000, 48000 ], " "channels = (int) [ 1, 2 ]") + "endianness = (int) BYTE_ORDER, " + "signed = (boolean) { TRUE, FALSE }, " + "width = (int) { 8, 16 }, " + "depth = (int) { 8, 16 }, " + "rate = (int) [ 1000, 48000 ], " "channels = (int) [ 1, 2 ]") ); static GstElementClass *parent_class = NULL; @@ -119,9 +119,10 @@ gst_osssink_get_type (void) 0, (GInstanceInitFunc) gst_osssink_init, }; + osssink_type = - g_type_register_static (GST_TYPE_OSSELEMENT, "GstOssSink", - &osssink_info, 0); + g_type_register_static (GST_TYPE_OSSELEMENT, "GstOssSink", + &osssink_info, 0); } return osssink_type; @@ -159,23 +160,23 @@ gst_osssink_class_init (GstOssSinkClass * klass) g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_MUTE, g_param_spec_boolean ("mute", "Mute", "Mute the audio", - FALSE, G_PARAM_READWRITE)); + FALSE, G_PARAM_READWRITE)); g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_SYNC, g_param_spec_boolean ("sync", "Sync", - "If syncing on timestamps should be enabled", TRUE, - G_PARAM_READWRITE)); + "If syncing on timestamps should be enabled", TRUE, + G_PARAM_READWRITE)); g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_FRAGMENT, g_param_spec_int ("fragment", "Fragment", - "The fragment as 0xMMMMSSSS (MMMM = total fragments, 2^SSSS = fragment size)", - 0, G_MAXINT, 6, G_PARAM_READWRITE)); + "The fragment as 0xMMMMSSSS (MMMM = total fragments, 2^SSSS = fragment size)", + 0, G_MAXINT, 6, G_PARAM_READWRITE)); g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_BUFFER_SIZE, g_param_spec_uint ("buffer_size", "Buffer size", - "Size of buffers in osssink's bufferpool (bytes)", 0, G_MAXINT, 4096, - G_PARAM_READWRITE)); + "Size of buffers in osssink's bufferpool (bytes)", 0, G_MAXINT, 4096, + G_PARAM_READWRITE)); g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_CHUNK_SIZE, g_param_spec_uint ("chunk_size", "Chunk size", - "Write data in chunk sized buffers", 0, G_MAXUINT, 4096, - G_PARAM_READWRITE)); + "Write data in chunk sized buffers", 0, G_MAXUINT, 4096, + G_PARAM_READWRITE)); gst_osssink_signals[SIGNAL_HANDOFF] = g_signal_new ("handoff", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST, @@ -367,17 +368,17 @@ gst_osssink_chain (GstPad * pad, GstData * _data) switch (GST_EVENT_TYPE (event)) { case GST_EVENT_EOS: - ioctl (GST_OSSELEMENT (osssink)->fd, SNDCTL_DSP_SYNC, 0); - gst_audio_clock_set_active (GST_AUDIO_CLOCK (osssink->provided_clock), - FALSE); - gst_pad_event_default (pad, event); - return; + ioctl (GST_OSSELEMENT (osssink)->fd, SNDCTL_DSP_SYNC, 0); + gst_audio_clock_set_active (GST_AUDIO_CLOCK (osssink->provided_clock), + FALSE); + gst_pad_event_default (pad, event); + return; case GST_EVENT_DISCONTINUOUS: - osssink->resync = TRUE; - /* pass-through */ + osssink->resync = TRUE; + /* pass-through */ default: - gst_pad_event_default (pad, event); - return; + gst_pad_event_default (pad, event); + return; } g_assert_not_reached (); } @@ -385,7 +386,7 @@ gst_osssink_chain (GstPad * pad, GstData * _data) if (!GST_OSSELEMENT (osssink)->bps) { gst_buffer_unref (buf); GST_ELEMENT_ERROR (osssink, CORE, NEGOTIATION, (NULL), - ("format wasn't negotiated before chain function")); + ("format wasn't negotiated before chain function")); return; } @@ -409,8 +410,8 @@ gst_osssink_chain (GstPad * pad, GstData * _data) if (MAX (buftime, soundtime) - MIN (buftime, soundtime) > (GST_SECOND / 10)) { /* we need to adjust to the buffers here */ GST_INFO_OBJECT (osssink, - "need sync: real %" G_GUINT64_FORMAT ", buffer: %" G_GUINT64_FORMAT, - soundtime, buftime); + "need sync: real %" G_GUINT64_FORMAT ", buffer: %" G_GUINT64_FORMAT, + soundtime, buftime); if (soundtime > buftime) { /* do *not* throw frames out. It's useless. The next frame will come in * too late. And the next one. And so on. We don't want to lose sound. @@ -418,34 +419,34 @@ gst_osssink_chain (GstPad * pad, GstData * _data) * sending events upstream to drop buffers. */ } else { guint64 to_handle = - (((buftime - - soundtime) * GST_OSSELEMENT (osssink)->bps / GST_SECOND) / - ((GST_OSSELEMENT (osssink)->width / 8) * - GST_OSSELEMENT (osssink)->channels)) * - (GST_OSSELEMENT (osssink)->width / 8) * - GST_OSSELEMENT (osssink)->channels; + (((buftime - + soundtime) * GST_OSSELEMENT (osssink)->bps / GST_SECOND) / + ((GST_OSSELEMENT (osssink)->width / 8) * + GST_OSSELEMENT (osssink)->channels)) * + (GST_OSSELEMENT (osssink)->width / 8) * + GST_OSSELEMENT (osssink)->channels; if (!osssink->resync) { - guint8 *buf = g_new (guint8, to_handle); - - memset (buf, (GST_OSSELEMENT (osssink)->width == 8) ? 0 : 128, - to_handle); - while (to_handle > 0) { - gint done = write (GST_OSSELEMENT (osssink)->fd, buf, - MIN (to_handle, osssink->chunk_size)); - - if (done == -1 && errno != EINTR) { - break; - } else { - to_handle -= done; - osssink->handled += done; - } - } - g_free (buf); + guint8 *buf = g_new (guint8, to_handle); + + memset (buf, (GST_OSSELEMENT (osssink)->width == 8) ? 0 : 128, + to_handle); + while (to_handle > 0) { + gint done = write (GST_OSSELEMENT (osssink)->fd, buf, + MIN (to_handle, osssink->chunk_size)); + + if (done == -1 && errno != EINTR) { + break; + } else { + to_handle -= done; + osssink->handled += done; + } + } + g_free (buf); } else { - /* Timestamps at start-of-stream (MPEG) or after seek (hey, - * again MPEG!) can be borken, therefore this hacklet. */ - osssink->handled += to_handle; + /* Timestamps at start-of-stream (MPEG) or after seek (hey, + * again MPEG!) can be borken, therefore this hacklet. */ + osssink->handled += to_handle; } } } @@ -454,17 +455,17 @@ gst_osssink_chain (GstPad * pad, GstData * _data) if (!osssink->mute) { while (to_write > 0) { - gint done = write (GST_OSSELEMENT (osssink)->fd, data, - MIN (to_write, osssink->chunk_size)); - - if (done == -1) { - if (errno != EINTR) - break; - } else { - to_write -= done; - data += done; - osssink->handled += done; - } + gint done = write (GST_OSSELEMENT (osssink)->fd, data, + MIN (to_write, osssink->chunk_size)); + + if (done == -1) { + if (errno != EINTR) + break; + } else { + to_write -= done; + data += done; + osssink->handled += done; + } } } else { g_warning ("muting osssinks unimplemented wrt clocks!"); @@ -486,6 +487,7 @@ gst_osssink_get_formats (GstPad * pad) GST_FORMAT_BYTES, 0 }; + return formats; } @@ -509,6 +511,7 @@ gst_osssink_get_query_types (GstPad * pad) GST_QUERY_POSITION, 0, }; + return query_types; } @@ -524,22 +527,22 @@ gst_osssink_sink_query (GstPad * pad, GstQueryType type, GstFormat * format, switch (type) { case GST_QUERY_LATENCY: if (!gst_osssink_convert (pad, - GST_FORMAT_BYTES, gst_osssink_get_delay (osssink), - format, value)) { - res = FALSE; + GST_FORMAT_BYTES, gst_osssink_get_delay (osssink), + format, value)) { + res = FALSE; } break; case GST_QUERY_POSITION: if (!gst_osssink_convert (pad, - GST_FORMAT_TIME, gst_element_get_time (GST_ELEMENT (osssink)), - format, value)) { - res = FALSE; + GST_FORMAT_TIME, gst_element_get_time (GST_ELEMENT (osssink)), + format, value)) { + res = FALSE; } break; default: res = - gst_pad_query (gst_pad_get_peer (osssink->sinkpad), type, format, - value); + gst_pad_query (gst_pad_get_peer (osssink->sinkpad), type, format, + value); break; } @@ -631,17 +634,17 @@ gst_osssink_change_state (GstElement * element) break; case GST_STATE_PAUSED_TO_PLAYING: gst_audio_clock_set_active (GST_AUDIO_CLOCK (osssink->provided_clock), - TRUE); + TRUE); break; case GST_STATE_PLAYING_TO_PAUSED: if (GST_FLAG_IS_SET (element, GST_OSSSINK_OPEN)) - ioctl (GST_OSSELEMENT (osssink)->fd, SNDCTL_DSP_RESET, 0); + ioctl (GST_OSSELEMENT (osssink)->fd, SNDCTL_DSP_RESET, 0); gst_audio_clock_set_active (GST_AUDIO_CLOCK (osssink->provided_clock), - FALSE); + FALSE); break; case GST_STATE_PAUSED_TO_READY: if (GST_FLAG_IS_SET (element, GST_OSSSINK_OPEN)) - ioctl (GST_OSSELEMENT (osssink)->fd, SNDCTL_DSP_RESET, 0); + ioctl (GST_OSSELEMENT (osssink)->fd, SNDCTL_DSP_RESET, 0); gst_osselement_reset (GST_OSSELEMENT (osssink)); osssink->handled = 0; osssink->resync = TRUE; diff --git a/sys/oss/gstosssrc.c b/sys/oss/gstosssrc.c index 5803865e..b35dbfc2 100644 --- a/sys/oss/gstosssrc.c +++ b/sys/oss/gstosssrc.c @@ -62,11 +62,11 @@ static GstStaticPadTemplate osssrc_src_factory = 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, FALSE }, " - "width = (int) { 8, 16 }, " - "depth = (int) { 8, 16 }, " - "rate = (int) [ 1000, 48000 ], " "channels = (int) [ 1, 2 ]") + "endianness = (int) BYTE_ORDER, " + "signed = (boolean) { TRUE, FALSE }, " + "width = (int) { 8, 16 }, " + "depth = (int) { 8, 16 }, " + "rate = (int) [ 1000, 48000 ], " "channels = (int) [ 1, 2 ]") ); static void gst_osssrc_base_init (gpointer g_class); @@ -121,9 +121,10 @@ gst_osssrc_get_type (void) 0, (GInstanceInitFunc) gst_osssrc_init, }; + osssrc_type = - g_type_register_static (GST_TYPE_OSSELEMENT, "GstOssSrc", &osssrc_info, - 0); + g_type_register_static (GST_TYPE_OSSELEMENT, "GstOssSrc", &osssrc_info, + 0); } return osssrc_type; } @@ -150,12 +151,12 @@ gst_osssrc_class_init (GstOssSrcClass * klass) g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_BUFFERSIZE, g_param_spec_ulong ("buffersize", "Buffer Size", - "The size of the buffers with samples", 0, G_MAXULONG, 0, - G_PARAM_READWRITE)); + "The size of the buffers with samples", 0, G_MAXULONG, 0, + G_PARAM_READWRITE)); g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_FRAGMENT, g_param_spec_int ("fragment", "Fragment", - "The fragment as 0xMMMMSSSS (MMMM = total fragments, 2^SSSS = fragment size)", - 0, G_MAXINT, 6, G_PARAM_READWRITE)); + "The fragment as 0xMMMMSSSS (MMMM = total fragments, 2^SSSS = fragment size)", + 0, G_MAXINT, 6, G_PARAM_READWRITE)); gobject_class->set_property = gst_osssrc_set_property; gobject_class->get_property = gst_osssrc_get_property; @@ -241,14 +242,14 @@ gst_osssrc_negotiate (GstPad * pad) /* set caps on src pad */ if (gst_pad_try_set_caps (src->srcpad, - gst_caps_new_simple ("audio/x-raw-int", - "endianness", G_TYPE_INT, GST_OSSELEMENT (src)->endianness, - "signed", G_TYPE_BOOLEAN, GST_OSSELEMENT (src)->sign, - "width", G_TYPE_INT, GST_OSSELEMENT (src)->width, - "depth", G_TYPE_INT, GST_OSSELEMENT (src)->depth, - "rate", G_TYPE_INT, GST_OSSELEMENT (src)->rate, - "channels", G_TYPE_INT, GST_OSSELEMENT (src)->channels, - NULL)) <= 0) { + gst_caps_new_simple ("audio/x-raw-int", + "endianness", G_TYPE_INT, GST_OSSELEMENT (src)->endianness, + "signed", G_TYPE_BOOLEAN, GST_OSSELEMENT (src)->sign, + "width", G_TYPE_INT, GST_OSSELEMENT (src)->width, + "depth", G_TYPE_INT, GST_OSSELEMENT (src)->depth, + "rate", G_TYPE_INT, GST_OSSELEMENT (src)->rate, + "channels", G_TYPE_INT, GST_OSSELEMENT (src)->channels, + NULL)) <= 0) { return FALSE; } return TRUE; @@ -319,7 +320,7 @@ gst_osssrc_get (GstPad * pad) if (GST_OSSELEMENT (src)->bps == 0) { gst_buffer_unref (buf); GST_ELEMENT_ERROR (src, CORE, NEGOTIATION, (NULL), - ("format wasn't negotiated before chain function")); + ("format wasn't negotiated before chain function")); return GST_DATA (gst_event_new (GST_EVENT_INTERRUPT)); } @@ -410,15 +411,15 @@ gst_osssrc_change_state (GstElement * element) break; case GST_STATE_PAUSED_TO_PLAYING: gst_audio_clock_set_active (GST_AUDIO_CLOCK (osssrc->provided_clock), - TRUE); + TRUE); break; case GST_STATE_PLAYING_TO_PAUSED: gst_audio_clock_set_active (GST_AUDIO_CLOCK (osssrc->provided_clock), - FALSE); + FALSE); break; case GST_STATE_PAUSED_TO_READY: if (GST_FLAG_IS_SET (element, GST_OSSSRC_OPEN)) - ioctl (GST_OSSELEMENT (osssrc)->fd, SNDCTL_DSP_RESET, 0); + ioctl (GST_OSSELEMENT (osssrc)->fd, SNDCTL_DSP_RESET, 0); break; default: break; @@ -439,6 +440,7 @@ gst_osssrc_get_formats (GstPad * pad) GST_FORMAT_BYTES, 0 }; + return formats; } @@ -462,6 +464,7 @@ gst_osssrc_get_event_masks (GstPad * pad) {GST_EVENT_SIZE, 0}, {0,} }; + return gst_osssrc_src_event_masks; } @@ -487,11 +490,11 @@ gst_osssrc_src_event (GstPad * pad, GstEvent * event) /* convert to bytes */ if (gst_osselement_convert (GST_OSSELEMENT (osssrc), - GST_EVENT_SIZE_FORMAT (event), - GST_EVENT_SIZE_VALUE (event), &format, &value)) { - osssrc->buffersize = GST_EVENT_SIZE_VALUE (event); - g_object_notify (G_OBJECT (osssrc), "buffersize"); - retval = TRUE; + GST_EVENT_SIZE_FORMAT (event), + GST_EVENT_SIZE_VALUE (event), &format, &value)) { + osssrc->buffersize = GST_EVENT_SIZE_VALUE (event); + g_object_notify (G_OBJECT (osssrc), "buffersize"); + retval = TRUE; } } default: @@ -516,6 +519,7 @@ gst_osssrc_get_query_types (GstPad * pad) GST_QUERY_POSITION, 0, }; + return query_types; } @@ -531,7 +535,7 @@ gst_osssrc_src_query (GstPad * pad, GstQueryType type, GstFormat * format, switch (type) { case GST_QUERY_POSITION: res = gst_osselement_convert (GST_OSSELEMENT (osssrc), - GST_FORMAT_BYTES, osssrc->curoffset, format, value); + GST_FORMAT_BYTES, osssrc->curoffset, format, value); break; default: break; diff --git a/sys/v4l2/gstv4l2.c b/sys/v4l2/gstv4l2.c index 633ce52e..194cb077 100644 --- a/sys/v4l2/gstv4l2.c +++ b/sys/v4l2/gstv4l2.c @@ -37,9 +37,9 @@ plugin_init (GstPlugin * plugin) return FALSE; if (!gst_element_register (plugin, "v4l2element", - GST_RANK_NONE, GST_TYPE_V4L2ELEMENT) || + GST_RANK_NONE, GST_TYPE_V4L2ELEMENT) || !gst_element_register (plugin, "v4l2src", - GST_RANK_NONE, GST_TYPE_V4L2SRC)) + GST_RANK_NONE, GST_TYPE_V4L2SRC)) return FALSE; #ifdef ENABLE_NLS diff --git a/sys/v4l2/gstv4l2colorbalance.c b/sys/v4l2/gstv4l2colorbalance.c index 274043d8..db53d7f9 100644 --- a/sys/v4l2/gstv4l2colorbalance.c +++ b/sys/v4l2/gstv4l2colorbalance.c @@ -62,8 +62,8 @@ gst_v4l2_color_balance_channel_get_type (void) }; gst_v4l2_color_balance_channel_type = - g_type_register_static (GST_TYPE_COLOR_BALANCE_CHANNEL, - "GstV4l2ColorBalanceChannel", &v4l2_tuner_channel_info, 0); + g_type_register_static (GST_TYPE_COLOR_BALANCE_CHANNEL, + "GstV4l2ColorBalanceChannel", &v4l2_tuner_channel_info, 0); } return gst_v4l2_color_balance_channel_type; @@ -123,7 +123,7 @@ gst_v4l2_color_balance_set_value (GstColorBalance * balance, /* assert that we're opened and that we're using a known item */ g_return_if_fail (GST_V4L2_IS_OPEN (v4l2element)); g_return_if_fail (gst_v4l2_color_balance_contains_channel (v4l2element, - v4l2channel)); + v4l2channel)); gst_v4l2_set_attribute (v4l2element, v4l2channel->index, value); } @@ -140,7 +140,7 @@ gst_v4l2_color_balance_get_value (GstColorBalance * balance, /* assert that we're opened and that we're using a known item */ g_return_val_if_fail (GST_V4L2_IS_OPEN (v4l2element), 0); g_return_val_if_fail (gst_v4l2_color_balance_contains_channel (v4l2element, - v4l2channel), 0); + v4l2channel), 0); if (!gst_v4l2_get_attribute (v4l2element, v4l2channel->index, &value)) return 0; diff --git a/sys/v4l2/gstv4l2element.c b/sys/v4l2/gstv4l2element.c index 246d4949..1595e87f 100644 --- a/sys/v4l2/gstv4l2element.c +++ b/sys/v4l2/gstv4l2element.c @@ -138,22 +138,22 @@ gst_v4l2_class_probe_devices (GstV4l2ElementClass * klass, gboolean check) /* detect /dev entries */ for (n = 0; n < 64; n++) { for (base = 0; dev_base[base] != NULL; base++) { - struct stat s; - gchar *device = g_strdup_printf ("%s%d", - dev_base[base], n); - - /* does the /dev/ entry exist at all? */ - if (stat (device, &s) == 0) { - /* yes: is a device attached? */ - if ((fd = open (device, O_RDONLY)) > 0 || errno == EBUSY) { - if (fd > 0) - close (fd); - - devices = g_list_append (devices, device); - break; - } - } - g_free (device); + struct stat s; + gchar *device = g_strdup_printf ("%s%d", + dev_base[base], n); + + /* does the /dev/ entry exist at all? */ + if (stat (device, &s) == 0) { + /* yes: is a device attached? */ + if ((fd = open (device, O_RDONLY)) > 0 || errno == EBUSY) { + if (fd > 0) + close (fd); + + devices = g_list_append (devices, device); + break; + } + } + g_free (device); } } @@ -301,19 +301,19 @@ gst_v4l2element_get_type (void) }; v4l2element_type = - g_type_register_static (GST_TYPE_ELEMENT, - "GstV4l2Element", &v4l2element_info, 0); + g_type_register_static (GST_TYPE_ELEMENT, + "GstV4l2Element", &v4l2element_info, 0); g_type_add_interface_static (v4l2element_type, - GST_TYPE_IMPLEMENTS_INTERFACE, &v4l2iface_info); + GST_TYPE_IMPLEMENTS_INTERFACE, &v4l2iface_info); g_type_add_interface_static (v4l2element_type, - GST_TYPE_TUNER, &v4l2_tuner_info); + GST_TYPE_TUNER, &v4l2_tuner_info); g_type_add_interface_static (v4l2element_type, - GST_TYPE_X_OVERLAY, &v4l2_xoverlay_info); + GST_TYPE_X_OVERLAY, &v4l2_xoverlay_info); g_type_add_interface_static (v4l2element_type, - GST_TYPE_COLOR_BALANCE, &v4l2_colorbalance_info); + GST_TYPE_COLOR_BALANCE, &v4l2_colorbalance_info); g_type_add_interface_static (v4l2element_type, - GST_TYPE_PROPERTY_PROBE, &v4l2_propertyprobe_info); + GST_TYPE_PROPERTY_PROBE, &v4l2_propertyprobe_info); } return v4l2element_type; @@ -329,20 +329,20 @@ gst_v4l2_device_get_type (void) if (v4l2_device_type == 0) { static const GFlagsValue values[] = { {V4L2_CAP_VIDEO_CAPTURE, "CAPTURE", - "Device can capture"}, + "Device can capture"}, {V4L2_CAP_VIDEO_OUTPUT, "PLAYBACK", - "Device can playback"}, + "Device can playback"}, {V4L2_CAP_VIDEO_OVERLAY, "OVERLAY", - "Device can do overlay"}, + "Device can do overlay"}, {V4L2_CAP_TUNER, "TUNER", - "Device has a tuner"}, + "Device has a tuner"}, {V4L2_CAP_AUDIO, "AUDIO", - "Device handles audio"}, + "Device handles audio"}, {0, NULL, NULL} }; v4l2_device_type = - g_flags_register_static ("GstV4l2DeviceTypeFlags", values); + g_flags_register_static ("GstV4l2DeviceTypeFlags", values); } return v4l2_device_type; @@ -368,22 +368,22 @@ gst_v4l2element_class_init (GstV4l2ElementClass * klass) g_object_class_install_property (gobject_class, ARG_DEVICE, g_param_spec_string ("device", "Device", "Device location", - NULL, G_PARAM_READWRITE)); + NULL, G_PARAM_READWRITE)); g_object_class_install_property (gobject_class, ARG_DEVICE_NAME, g_param_spec_string ("device_name", "Device name", - "Name of the device", NULL, G_PARAM_READABLE)); + "Name of the device", NULL, G_PARAM_READABLE)); g_object_class_install_property (gobject_class, ARG_FLAGS, g_param_spec_flags ("flags", "Flags", "Device type flags", - GST_TYPE_V4L2_DEVICE_FLAGS, 0, G_PARAM_READABLE)); + GST_TYPE_V4L2_DEVICE_FLAGS, 0, G_PARAM_READABLE)); g_object_class_install_property (gobject_class, ARG_NORM, g_param_spec_string ("norm", "norm", - "Norm to use", NULL, G_PARAM_READWRITE)); + "Norm to use", NULL, G_PARAM_READWRITE)); g_object_class_install_property (gobject_class, ARG_CHANNEL, g_param_spec_string ("channel", "channel", - "input/output to switch to", NULL, G_PARAM_READWRITE)); + "input/output to switch to", NULL, G_PARAM_READWRITE)); g_object_class_install_property (gobject_class, ARG_FREQUENCY, g_param_spec_ulong ("frequency", "frequency", - "frequency to tune to", 0, G_MAXULONG, 0, G_PARAM_READWRITE)); + "frequency to tune to", 0, G_MAXULONG, 0, G_PARAM_READWRITE)); /* signals */ gst_v4l2element_signals[SIGNAL_OPEN] = @@ -462,49 +462,49 @@ gst_v4l2element_set_property (GObject * object, switch (prop_id) { case ARG_DEVICE: if (!GST_V4L2_IS_OPEN (v4l2element)) { - if (v4l2element->device) - g_free (v4l2element->device); - v4l2element->device = g_value_dup_string (value); + if (v4l2element->device) + g_free (v4l2element->device); + v4l2element->device = g_value_dup_string (value); } break; case ARG_NORM: if (GST_V4L2_IS_OPEN (v4l2element)) { - GstTunerNorm *norm = gst_tuner_get_norm (tuner); + GstTunerNorm *norm = gst_tuner_get_norm (tuner); - if (norm) { - gst_tuner_set_norm (tuner, norm); - } + if (norm) { + gst_tuner_set_norm (tuner, norm); + } } else { - g_free (v4l2element->norm); - v4l2element->norm = g_value_dup_string (value); - g_object_notify (object, "norm"); + g_free (v4l2element->norm); + v4l2element->norm = g_value_dup_string (value); + g_object_notify (object, "norm"); } break; case ARG_CHANNEL: if (GST_V4L2_IS_OPEN (v4l2element)) { - GstTunerChannel *channel = gst_tuner_get_channel (tuner); + GstTunerChannel *channel = gst_tuner_get_channel (tuner); - if (channel) { - gst_tuner_set_channel (tuner, channel); - } + if (channel) { + gst_tuner_set_channel (tuner, channel); + } } else { - g_free (v4l2element->channel); - v4l2element->channel = g_value_dup_string (value); - g_object_notify (object, "channel"); + g_free (v4l2element->channel); + v4l2element->channel = g_value_dup_string (value); + g_object_notify (object, "channel"); } break; case ARG_FREQUENCY: if (GST_V4L2_IS_OPEN (v4l2element)) { - GstTunerChannel *channel; + GstTunerChannel *channel; - if (!v4l2element->channel) - return; - channel = gst_tuner_get_channel (tuner); - g_assert (channel); - gst_tuner_set_frequency (tuner, channel, g_value_get_ulong (value)); + if (!v4l2element->channel) + return; + channel = gst_tuner_get_channel (tuner); + g_assert (channel); + gst_tuner_set_frequency (tuner, channel, g_value_get_ulong (value)); } else { - v4l2element->frequency = g_value_get_ulong (value); - g_object_notify (object, "frequency"); + v4l2element->frequency = g_value_get_ulong (value); + g_object_notify (object, "frequency"); } break; default: @@ -532,7 +532,7 @@ gst_v4l2element_get_property (GObject * object, gchar *new = NULL; if (GST_V4L2_IS_OPEN (v4l2element)) - new = v4l2element->vcap.card; + new = v4l2element->vcap.card; g_value_set_string (value, new); break; } @@ -540,7 +540,7 @@ gst_v4l2element_get_property (GObject * object, guint flags = 0; if (GST_V4L2_IS_OPEN (v4l2element)) { - flags |= v4l2element->vcap.capabilities & 30007; + flags |= v4l2element->vcap.capabilities & 30007; } g_value_set_flags (value, flags); break; @@ -578,23 +578,23 @@ gst_v4l2element_change_state (GstElement * element) gst_v4l2_set_display (v4l2element); if (!gst_v4l2_open (v4l2element)) - return GST_STATE_FAILURE; + return GST_STATE_FAILURE; gst_v4l2_xoverlay_open (v4l2element); /* emit a signal! whoopie! */ g_signal_emit (G_OBJECT (v4l2element), - gst_v4l2element_signals[SIGNAL_OPEN], 0, v4l2element->device); + gst_v4l2element_signals[SIGNAL_OPEN], 0, v4l2element->device); break; case GST_STATE_READY_TO_NULL: gst_v4l2_xoverlay_close (v4l2element); if (!gst_v4l2_close (v4l2element)) - return GST_STATE_FAILURE; + return GST_STATE_FAILURE; /* emit yet another signal! wheehee! */ g_signal_emit (G_OBJECT (v4l2element), - gst_v4l2element_signals[SIGNAL_CLOSE], 0, v4l2element->device); + gst_v4l2element_signals[SIGNAL_CLOSE], 0, v4l2element->device); break; } diff --git a/sys/v4l2/gstv4l2src.c b/sys/v4l2/gstv4l2src.c index 5e5cdddc..bc9c66a2 100644 --- a/sys/v4l2/gstv4l2src.c +++ b/sys/v4l2/gstv4l2src.c @@ -58,34 +58,34 @@ enum guint32 gst_v4l2_formats[] = { /* from Linux 2.6.0 videodev2.h */ - V4L2_PIX_FMT_RGB332, /* 8 RGB-3-3-2 */ - V4L2_PIX_FMT_RGB555, /* 16 RGB-5-5-5 */ - V4L2_PIX_FMT_RGB565, /* 16 RGB-5-6-5 */ - V4L2_PIX_FMT_RGB555X, /* 16 RGB-5-5-5 BE */ - V4L2_PIX_FMT_RGB565X, /* 16 RGB-5-6-5 BE */ - V4L2_PIX_FMT_BGR24, /* 24 BGR-8-8-8 */ - V4L2_PIX_FMT_RGB24, /* 24 RGB-8-8-8 */ - V4L2_PIX_FMT_BGR32, /* 32 BGR-8-8-8-8 */ - V4L2_PIX_FMT_RGB32, /* 32 RGB-8-8-8-8 */ - V4L2_PIX_FMT_GREY, /* 8 Greyscale */ - V4L2_PIX_FMT_YVU410, /* 9 YVU 4:1:0 */ - V4L2_PIX_FMT_YVU420, /* 12 YVU 4:2:0 */ - V4L2_PIX_FMT_YUYV, /* 16 YUV 4:2:2 */ - V4L2_PIX_FMT_UYVY, /* 16 YUV 4:2:2 */ - V4L2_PIX_FMT_YUV422P, /* 16 YVU422 planar */ - V4L2_PIX_FMT_YUV411P, /* 16 YVU411 planar */ - V4L2_PIX_FMT_Y41P, /* 12 YUV 4:1:1 */ - V4L2_PIX_FMT_NV12, /* 12 Y/CbCr 4:2:0 */ - V4L2_PIX_FMT_NV21, /* 12 Y/CrCb 4:2:0 */ - V4L2_PIX_FMT_YUV410, /* 9 YUV 4:1:0 */ - V4L2_PIX_FMT_YUV420, /* 12 YUV 4:2:0 */ - V4L2_PIX_FMT_YYUV, /* 16 YUV 4:2:2 */ - V4L2_PIX_FMT_HI240, /* 8 8-bit color */ - V4L2_PIX_FMT_MJPEG, /* Motion-JPEG */ - V4L2_PIX_FMT_JPEG, /* JFIF JPEG */ - V4L2_PIX_FMT_DV, /* 1394 */ - V4L2_PIX_FMT_MPEG, /* MPEG */ - V4L2_PIX_FMT_WNVA /* Winnov hw compres */ + V4L2_PIX_FMT_RGB332, /* 8 RGB-3-3-2 */ + V4L2_PIX_FMT_RGB555, /* 16 RGB-5-5-5 */ + V4L2_PIX_FMT_RGB565, /* 16 RGB-5-6-5 */ + V4L2_PIX_FMT_RGB555X, /* 16 RGB-5-5-5 BE */ + V4L2_PIX_FMT_RGB565X, /* 16 RGB-5-6-5 BE */ + V4L2_PIX_FMT_BGR24, /* 24 BGR-8-8-8 */ + V4L2_PIX_FMT_RGB24, /* 24 RGB-8-8-8 */ + V4L2_PIX_FMT_BGR32, /* 32 BGR-8-8-8-8 */ + V4L2_PIX_FMT_RGB32, /* 32 RGB-8-8-8-8 */ + V4L2_PIX_FMT_GREY, /* 8 Greyscale */ + V4L2_PIX_FMT_YVU410, /* 9 YVU 4:1:0 */ + V4L2_PIX_FMT_YVU420, /* 12 YVU 4:2:0 */ + V4L2_PIX_FMT_YUYV, /* 16 YUV 4:2:2 */ + V4L2_PIX_FMT_UYVY, /* 16 YUV 4:2:2 */ + V4L2_PIX_FMT_YUV422P, /* 16 YVU422 planar */ + V4L2_PIX_FMT_YUV411P, /* 16 YVU411 planar */ + V4L2_PIX_FMT_Y41P, /* 12 YUV 4:1:1 */ + V4L2_PIX_FMT_NV12, /* 12 Y/CbCr 4:2:0 */ + V4L2_PIX_FMT_NV21, /* 12 Y/CrCb 4:2:0 */ + V4L2_PIX_FMT_YUV410, /* 9 YUV 4:1:0 */ + V4L2_PIX_FMT_YUV420, /* 12 YUV 4:2:0 */ + V4L2_PIX_FMT_YYUV, /* 16 YUV 4:2:2 */ + V4L2_PIX_FMT_HI240, /* 8 8-bit color */ + V4L2_PIX_FMT_MJPEG, /* Motion-JPEG */ + V4L2_PIX_FMT_JPEG, /* JFIF JPEG */ + V4L2_PIX_FMT_DV, /* 1394 */ + V4L2_PIX_FMT_MPEG, /* MPEG */ + V4L2_PIX_FMT_WNVA /* Winnov hw compres */ }; #define GST_V4L2_FORMAT_COUNT (G_N_ELEMENTS (gst_v4l2_formats)) @@ -150,8 +150,9 @@ gst_v4l2src_get_type (void) gst_v4l2src_init, NULL }; + v4l2src_type = g_type_register_static (GST_TYPE_V4L2ELEMENT, - "GstV4l2Src", &v4l2src_info, 0); + "GstV4l2Src", &v4l2src_info, 0); GST_DEBUG_CATEGORY_INIT (v4l2src_debug, "v4l2src", 0, "v4l2src element"); } return v4l2src_type; @@ -185,16 +186,16 @@ gst_v4l2src_class_init (gpointer g_class, gpointer class_data) g_object_class_install_property (gobject_class, ARG_NUMBUFS, g_param_spec_int ("num_buffers", "num_buffers", "num_buffers", - G_MININT, G_MAXINT, 0, G_PARAM_READWRITE)); + G_MININT, G_MAXINT, 0, G_PARAM_READWRITE)); g_object_class_install_property (gobject_class, ARG_BUFSIZE, g_param_spec_int ("buffer_size", "buffer_size", "buffer_size", - G_MININT, G_MAXINT, 0, G_PARAM_READABLE)); + G_MININT, G_MAXINT, 0, G_PARAM_READABLE)); g_object_class_install_property (gobject_class, ARG_USE_FIXED_FPS, g_param_spec_boolean ("use_fixed_fps", "Use Fixed FPS", - "Drop/Insert frames to reach a certain FPS (TRUE) " - "or adapt FPS to suit the number of frabbed frames", - TRUE, G_PARAM_READWRITE)); + "Drop/Insert frames to reach a certain FPS (TRUE) " + "or adapt FPS to suit the number of frabbed frames", + TRUE, G_PARAM_READWRITE)); /* signals */ gst_v4l2src_signals[SIGNAL_FRAME_CAPTURE] = @@ -280,7 +281,7 @@ gst_v4l2src_get_fps (GstV4l2Src * v4l2src) if (!v4l2src->use_fixed_fps && v4l2src->clock != NULL && v4l2src->handled > 0) { /* try to get time from clock master and calculate fps */ GstClockTime time = gst_clock_get_time (v4l2src->clock) - - v4l2src->substract_time; + v4l2src->substract_time; return v4l2src->handled * GST_SECOND / time; } @@ -317,21 +318,21 @@ gst_v4l2src_src_convert (GstPad * pad, switch (src_format) { case GST_FORMAT_TIME: switch (*dest_format) { - case GST_FORMAT_DEFAULT: - *dest_value = src_value * fps / GST_SECOND; - break; - default: - return FALSE; + case GST_FORMAT_DEFAULT: + *dest_value = src_value * fps / GST_SECOND; + break; + default: + return FALSE; } break; case GST_FORMAT_DEFAULT: switch (*dest_format) { - case GST_FORMAT_TIME: - *dest_value = src_value * GST_SECOND / fps; - break; - default: - return FALSE; + case GST_FORMAT_TIME: + *dest_value = src_value * GST_SECOND / fps; + break; + default: + return FALSE; } break; @@ -356,15 +357,15 @@ gst_v4l2src_src_query (GstPad * pad, switch (type) { case GST_QUERY_POSITION: switch (*format) { - case GST_FORMAT_TIME: - *value = v4l2src->handled * GST_SECOND / fps; - break; - case GST_FORMAT_DEFAULT: - *value = v4l2src->handled; - break; - default: - res = FALSE; - break; + case GST_FORMAT_TIME: + *value = v4l2src->handled * GST_SECOND / fps; + break; + case GST_FORMAT_DEFAULT: + *value = v4l2src->handled; + break; + default: + res = FALSE; + break; } break; default: @@ -381,8 +382,8 @@ gst_v4l2src_v4l2fourcc_to_caps (guint32 fourcc) GstStructure *structure = NULL; switch (fourcc) { - case V4L2_PIX_FMT_MJPEG: /* Motion-JPEG */ - case V4L2_PIX_FMT_JPEG: /* JFIF JPEG */ + case V4L2_PIX_FMT_MJPEG: /* Motion-JPEG */ + case V4L2_PIX_FMT_JPEG: /* JFIF JPEG */ structure = gst_structure_new ("video/x-jpeg", NULL); break; case V4L2_PIX_FMT_RGB332: @@ -399,84 +400,84 @@ gst_v4l2src_v4l2fourcc_to_caps (guint32 fourcc) guint32 r_mask = 0, b_mask = 0, g_mask = 0; switch (fourcc) { - case V4L2_PIX_FMT_RGB332: - bpp = depth = 8; - endianness = G_BYTE_ORDER; /* 'like, whatever' */ - r_mask = 0xe0; - g_mask = 0x1c; - b_mask = 0x03; - break; - case V4L2_PIX_FMT_RGB555: - case V4L2_PIX_FMT_RGB555X: - bpp = 16; - depth = 15; - endianness = - fourcc == V4L2_PIX_FMT_RGB555X ? G_BIG_ENDIAN : G_LITTLE_ENDIAN; - r_mask = 0x7c00; - g_mask = 0x03e0; - b_mask = 0x001f; - break; - case V4L2_PIX_FMT_RGB565: - case V4L2_PIX_FMT_RGB565X: - bpp = depth = 16; - endianness = - fourcc == V4L2_PIX_FMT_RGB565X ? G_BIG_ENDIAN : G_LITTLE_ENDIAN; - r_mask = 0xf800; - g_mask = 0x07e0; - b_mask = 0x001f; - case V4L2_PIX_FMT_RGB24: - bpp = depth = 24; - endianness = G_BIG_ENDIAN; - r_mask = 0xff0000; - g_mask = 0x00ff00; - b_mask = 0x0000ff; - break; - case V4L2_PIX_FMT_BGR24: - bpp = depth = 24; - endianness = G_BIG_ENDIAN; - r_mask = 0x0000ff; - g_mask = 0x00ff00; - b_mask = 0xff0000; - break; - case V4L2_PIX_FMT_RGB32: - bpp = depth = 32; - endianness = G_BIG_ENDIAN; - r_mask = 0xff000000; - g_mask = 0x00ff0000; - b_mask = 0x0000ff00; - break; - case V4L2_PIX_FMT_BGR32: - bpp = depth = 32; - endianness = G_BIG_ENDIAN; - r_mask = 0x000000ff; - g_mask = 0x0000ff00; - b_mask = 0x00ff0000; - break; - default: - g_assert_not_reached (); - break; + case V4L2_PIX_FMT_RGB332: + bpp = depth = 8; + endianness = G_BYTE_ORDER; /* 'like, whatever' */ + r_mask = 0xe0; + g_mask = 0x1c; + b_mask = 0x03; + break; + case V4L2_PIX_FMT_RGB555: + case V4L2_PIX_FMT_RGB555X: + bpp = 16; + depth = 15; + endianness = + fourcc == V4L2_PIX_FMT_RGB555X ? G_BIG_ENDIAN : G_LITTLE_ENDIAN; + r_mask = 0x7c00; + g_mask = 0x03e0; + b_mask = 0x001f; + break; + case V4L2_PIX_FMT_RGB565: + case V4L2_PIX_FMT_RGB565X: + bpp = depth = 16; + endianness = + fourcc == V4L2_PIX_FMT_RGB565X ? G_BIG_ENDIAN : G_LITTLE_ENDIAN; + r_mask = 0xf800; + g_mask = 0x07e0; + b_mask = 0x001f; + case V4L2_PIX_FMT_RGB24: + bpp = depth = 24; + endianness = G_BIG_ENDIAN; + r_mask = 0xff0000; + g_mask = 0x00ff00; + b_mask = 0x0000ff; + break; + case V4L2_PIX_FMT_BGR24: + bpp = depth = 24; + endianness = G_BIG_ENDIAN; + r_mask = 0x0000ff; + g_mask = 0x00ff00; + b_mask = 0xff0000; + break; + case V4L2_PIX_FMT_RGB32: + bpp = depth = 32; + endianness = G_BIG_ENDIAN; + r_mask = 0xff000000; + g_mask = 0x00ff0000; + b_mask = 0x0000ff00; + break; + case V4L2_PIX_FMT_BGR32: + bpp = depth = 32; + endianness = G_BIG_ENDIAN; + r_mask = 0x000000ff; + g_mask = 0x0000ff00; + b_mask = 0x00ff0000; + break; + default: + g_assert_not_reached (); + break; } structure = gst_structure_new ("video/x-raw-rgb", - "bpp", G_TYPE_INT, bpp, - "depth", G_TYPE_INT, depth, - "red_mask", G_TYPE_INT, r_mask, - "green_mask", G_TYPE_INT, g_mask, - "blue_mask", G_TYPE_INT, b_mask, - "endianness", G_TYPE_INT, endianness, NULL); + "bpp", G_TYPE_INT, bpp, + "depth", G_TYPE_INT, depth, + "red_mask", G_TYPE_INT, r_mask, + "green_mask", G_TYPE_INT, g_mask, + "blue_mask", G_TYPE_INT, b_mask, + "endianness", G_TYPE_INT, endianness, NULL); break; } - case V4L2_PIX_FMT_GREY: /* 8 Greyscale */ - case V4L2_PIX_FMT_YUV422P: /* 16 YVU422 planar */ - case V4L2_PIX_FMT_YUV411P: /* 16 YVU411 planar */ - case V4L2_PIX_FMT_NV12: /* 12 Y/CbCr 4:2:0 */ - case V4L2_PIX_FMT_NV21: /* 12 Y/CrCb 4:2:0 */ - case V4L2_PIX_FMT_YYUV: /* 16 YUV 4:2:2 */ - case V4L2_PIX_FMT_HI240: /* 8 8-bit color */ + case V4L2_PIX_FMT_GREY: /* 8 Greyscale */ + case V4L2_PIX_FMT_YUV422P: /* 16 YVU422 planar */ + case V4L2_PIX_FMT_YUV411P: /* 16 YVU411 planar */ + case V4L2_PIX_FMT_NV12: /* 12 Y/CbCr 4:2:0 */ + case V4L2_PIX_FMT_NV21: /* 12 Y/CrCb 4:2:0 */ + case V4L2_PIX_FMT_YYUV: /* 16 YUV 4:2:2 */ + case V4L2_PIX_FMT_HI240: /* 8 8-bit color */ /* FIXME: get correct fourccs here */ break; case V4L2_PIX_FMT_YVU410: case V4L2_PIX_FMT_YUV410: - case V4L2_PIX_FMT_YUV420: /* I420/IYUV */ + case V4L2_PIX_FMT_YUV420: /* I420/IYUV */ case V4L2_PIX_FMT_YUYV: case V4L2_PIX_FMT_YVU420: case V4L2_PIX_FMT_UYVY: @@ -484,48 +485,48 @@ gst_v4l2src_v4l2fourcc_to_caps (guint32 fourcc) guint32 fcc = 0; switch (fourcc) { - case V4L2_PIX_FMT_YVU410: - fcc = GST_MAKE_FOURCC ('Y', 'V', 'U', '9'); - break; - case V4L2_PIX_FMT_YUV410: - fcc = GST_MAKE_FOURCC ('Y', 'U', 'V', '9'); - break; - case V4L2_PIX_FMT_YUV420: - fcc = GST_MAKE_FOURCC ('I', '4', '2', '0'); - break; - case V4L2_PIX_FMT_YUYV: - fcc = GST_MAKE_FOURCC ('Y', 'U', 'Y', '2'); - break; - case V4L2_PIX_FMT_YVU420: - fcc = GST_MAKE_FOURCC ('Y', 'V', '1', '2'); - break; - case V4L2_PIX_FMT_UYVY: - fcc = GST_MAKE_FOURCC ('U', 'Y', 'V', 'Y'); - break; - case V4L2_PIX_FMT_Y41P: - fcc = GST_MAKE_FOURCC ('Y', '4', '1', 'B'); - break; - default: - g_assert_not_reached (); - break; + case V4L2_PIX_FMT_YVU410: + fcc = GST_MAKE_FOURCC ('Y', 'V', 'U', '9'); + break; + case V4L2_PIX_FMT_YUV410: + fcc = GST_MAKE_FOURCC ('Y', 'U', 'V', '9'); + break; + case V4L2_PIX_FMT_YUV420: + fcc = GST_MAKE_FOURCC ('I', '4', '2', '0'); + break; + case V4L2_PIX_FMT_YUYV: + fcc = GST_MAKE_FOURCC ('Y', 'U', 'Y', '2'); + break; + case V4L2_PIX_FMT_YVU420: + fcc = GST_MAKE_FOURCC ('Y', 'V', '1', '2'); + break; + case V4L2_PIX_FMT_UYVY: + fcc = GST_MAKE_FOURCC ('U', 'Y', 'V', 'Y'); + break; + case V4L2_PIX_FMT_Y41P: + fcc = GST_MAKE_FOURCC ('Y', '4', '1', 'B'); + break; + default: + g_assert_not_reached (); + break; } structure = gst_structure_new ("video/x-raw-yuv", - "format", GST_TYPE_FOURCC, fcc, NULL); + "format", GST_TYPE_FOURCC, fcc, NULL); break; } case V4L2_PIX_FMT_DV: structure = - gst_structure_new ("video/x-dv", "systemstream", G_TYPE_BOOLEAN, TRUE, - NULL); + gst_structure_new ("video/x-dv", "systemstream", G_TYPE_BOOLEAN, TRUE, + NULL); break; - case V4L2_PIX_FMT_MPEG: /* MPEG */ + case V4L2_PIX_FMT_MPEG: /* MPEG */ /* someone figure out the MPEG format used... */ break; - case V4L2_PIX_FMT_WNVA: /* Winnov hw compres */ + case V4L2_PIX_FMT_WNVA: /* Winnov hw compres */ break; default: GST_DEBUG ("Unknown fourcc 0x%08x " GST_FOURCC_FORMAT, - fourcc, GST_FOURCC_ARGS (fourcc)); + fourcc, GST_FOURCC_ARGS (fourcc)); break; } #if 0 @@ -552,8 +553,8 @@ gst_v4l2src_get_format_from_fourcc (GstV4l2Src * v4l2src, guint32 fourcc) return fmt; /* special case for jpeg */ if ((fmt->pixelformat == V4L2_PIX_FMT_MJPEG && fourcc == V4L2_PIX_FMT_JPEG) - || (fmt->pixelformat == V4L2_PIX_FMT_JPEG - && fourcc == V4L2_PIX_FMT_MJPEG)) { + || (fmt->pixelformat == V4L2_PIX_FMT_JPEG + && fourcc == V4L2_PIX_FMT_MJPEG)) { return fmt; } walk = g_slist_next (walk); @@ -578,48 +579,48 @@ gst_v4l2_fourcc_from_structure (GstStructure * structure) switch (fourcc) { case GST_MAKE_FOURCC ('I', '4', '2', '0'): case GST_MAKE_FOURCC ('I', 'Y', 'U', 'V'): - fourcc = V4L2_PIX_FMT_YUV420; - break; + fourcc = V4L2_PIX_FMT_YUV420; + break; case GST_MAKE_FOURCC ('Y', 'U', 'Y', '2'): - fourcc = V4L2_PIX_FMT_YUYV; - break; + fourcc = V4L2_PIX_FMT_YUYV; + break; case GST_MAKE_FOURCC ('Y', '4', '1', 'P'): - fourcc = V4L2_PIX_FMT_Y41P; - break; + fourcc = V4L2_PIX_FMT_Y41P; + break; case GST_MAKE_FOURCC ('U', 'Y', 'V', 'Y'): - fourcc = V4L2_PIX_FMT_UYVY; - break; + fourcc = V4L2_PIX_FMT_UYVY; + break; case GST_MAKE_FOURCC ('Y', 'V', '1', '2'): - fourcc = V4L2_PIX_FMT_YVU420; - break; + fourcc = V4L2_PIX_FMT_YVU420; + break; case GST_MAKE_FOURCC ('R', 'G', 'B', ' '):{ - gint depth, endianness, r_mask; - - gst_structure_get_int (structure, "depth", &depth); - gst_structure_get_int (structure, "endianness", &endianness); - gst_structure_get_int (structure, "red_mask", &r_mask); - - switch (depth) { - case 8: - fourcc = V4L2_PIX_FMT_RGB332; - break; - case 15: - fourcc = (endianness == G_LITTLE_ENDIAN) ? - V4L2_PIX_FMT_RGB555 : V4L2_PIX_FMT_RGB555X; - break; - case 16: - fourcc = (endianness == G_LITTLE_ENDIAN) ? - V4L2_PIX_FMT_RGB565 : V4L2_PIX_FMT_RGB565X; - break; - case 24: - fourcc = (r_mask == 0xFF) ? V4L2_PIX_FMT_BGR24 : V4L2_PIX_FMT_RGB24; - break; - case 32: - fourcc = (r_mask == 0xFF) ? V4L2_PIX_FMT_BGR32 : V4L2_PIX_FMT_RGB32; - break; - } + gint depth, endianness, r_mask; + + gst_structure_get_int (structure, "depth", &depth); + gst_structure_get_int (structure, "endianness", &endianness); + gst_structure_get_int (structure, "red_mask", &r_mask); + + switch (depth) { + case 8: + fourcc = V4L2_PIX_FMT_RGB332; + break; + case 15: + fourcc = (endianness == G_LITTLE_ENDIAN) ? + V4L2_PIX_FMT_RGB555 : V4L2_PIX_FMT_RGB555X; + break; + case 16: + fourcc = (endianness == G_LITTLE_ENDIAN) ? + V4L2_PIX_FMT_RGB565 : V4L2_PIX_FMT_RGB565X; + break; + case 24: + fourcc = (r_mask == 0xFF) ? V4L2_PIX_FMT_BGR24 : V4L2_PIX_FMT_RGB24; + break; + case 32: + fourcc = (r_mask == 0xFF) ? V4L2_PIX_FMT_BGR32 : V4L2_PIX_FMT_RGB32; + break; + } default: - break; + break; } } } else if (strcmp (mimetype, "video/x-dv") == 0) { @@ -651,12 +652,12 @@ gst_v4l2src_get_all_caps (void) for (i = 0; i < GST_V4L2_FORMAT_COUNT; i++) { structure = gst_v4l2src_v4l2fourcc_to_caps (gst_v4l2_formats[i]); if (structure) { - gst_structure_set (structure, - "width", GST_TYPE_INT_RANGE, 1, 4096, - "height", GST_TYPE_INT_RANGE, 1, 4096, - "framerate", GST_TYPE_DOUBLE_RANGE, (double) 0, G_MAXDOUBLE, NULL); + gst_structure_set (structure, + "width", GST_TYPE_INT_RANGE, 1, 4096, + "height", GST_TYPE_INT_RANGE, 1, 4096, + "framerate", GST_TYPE_DOUBLE_RANGE, (double) 0, G_MAXDOUBLE, NULL); - gst_caps_append_structure (caps, structure); + gst_caps_append_structure (caps, structure); } } } @@ -680,8 +681,8 @@ gst_v4l2src_fixate (GstPad * pad, const GstCaps * const_caps) for (i = 0; i < gst_caps_get_size (caps); i++) { structure = gst_caps_get_structure (caps, i); changed |= - gst_caps_structure_fixate_field_nearest_int (structure, "width", - G_MAXINT); + gst_caps_structure_fixate_field_nearest_int (structure, "width", + G_MAXINT); } if (changed) return caps; @@ -689,8 +690,8 @@ gst_v4l2src_fixate (GstPad * pad, const GstCaps * const_caps) for (i = 0; i < gst_caps_get_size (caps); i++) { structure = gst_caps_get_structure (caps, i); changed |= - gst_caps_structure_fixate_field_nearest_int (structure, "height", - G_MAXINT); + gst_caps_structure_fixate_field_nearest_int (structure, "height", + G_MAXINT); } if (changed) return caps; @@ -764,7 +765,7 @@ gst_v4l2src_getcaps (GstPad * pad) /* get size delimiters */ if (!gst_v4l2src_get_size_limits (v4l2src, format, - &min_w, &max_w, &min_h, &max_h)) { + &min_w, &max_w, &min_h, &max_h)) { continue; } @@ -773,9 +774,9 @@ gst_v4l2src_getcaps (GstPad * pad) if (structure) { gst_structure_set (structure, - "width", GST_TYPE_INT_RANGE, min_w, max_w, - "height", GST_TYPE_INT_RANGE, min_h, max_h, - "framerate", GST_TYPE_DOUBLE_RANGE, (double) 0, G_MAXDOUBLE, NULL); + "width", GST_TYPE_INT_RANGE, min_w, max_w, + "height", GST_TYPE_INT_RANGE, min_h, max_h, + "framerate", GST_TYPE_DOUBLE_RANGE, (double) 0, G_MAXDOUBLE, NULL); gst_caps_append_structure (caps, structure); } @@ -796,7 +797,7 @@ gst_v4l2src_get (GstPad * pad) if (v4l2src->use_fixed_fps && (fps = gst_v4l2src_get_fps (v4l2src)) == 0) { GST_ELEMENT_ERROR (v4l2src, RESOURCE, SETTINGS, (NULL), - ("could not get frame rate for element")); + ("could not get frame rate for element")); return NULL; } @@ -818,69 +819,69 @@ gst_v4l2src_get (GstPad * pad) gboolean have_frame = FALSE; do { - /* FIXME: isn't this v4l2 timestamp its own clock?! */ - /* by default, we use the frame once */ - v4l2src->need_writes = 1; - - g_assert (time >= v4l2src->substract_time); - time -= v4l2src->substract_time; - - /* first check whether we lost any frames according to the device */ - if (v4l2src->last_seq != 0) { - if (v4l2src->pool->buffers[num].buffer.sequence - v4l2src->last_seq > - 1) { - v4l2src->need_writes = - v4l2src->pool->buffers[num].buffer.sequence - v4l2src->last_seq; - g_signal_emit (G_OBJECT (v4l2src), - gst_v4l2src_signals[SIGNAL_FRAME_LOST], 0, - v4l2src->need_writes - 1); - } - } - v4l2src->last_seq = v4l2src->pool->buffers[num].buffer.sequence; - - /* decide how often we're going to write the frame - set - * v4lmjpegsrc->need_writes to (that-1) and have_frame to TRUE - * if we're going to write it - else, just continue. - * - * time is generally the system or audio clock. Let's - * say that we've written one second of audio, then we want - * to have written one second of video too, within the same - * timeframe. This means that if time - begin_time = X sec, - * we want to have written X*fps frames. If we've written - * more - drop, if we've written less - dup... */ - if (v4l2src->handled * (GST_SECOND / fps) - time > - 1.5 * (GST_SECOND / fps)) { - /* yo dude, we've got too many frames here! Drop! DROP! */ - v4l2src->need_writes--; /* -= (v4l2src->handled - (time / fps)); */ - g_signal_emit (G_OBJECT (v4l2src), - gst_v4l2src_signals[SIGNAL_FRAME_DROP], 0); - } else if (v4l2src->handled * (GST_SECOND / fps) - time < - -1.5 * (GST_SECOND / fps)) { - /* this means we're lagging far behind */ - v4l2src->need_writes++; /* += ((time / fps) - v4l2src->handled); */ - g_signal_emit (G_OBJECT (v4l2src), - gst_v4l2src_signals[SIGNAL_FRAME_INSERT], 0); - } - - if (v4l2src->need_writes > 0) { - have_frame = TRUE; - v4l2src->need_writes--; - } else { - if (!gst_v4l2src_queue_frame (v4l2src, num)) - return NULL; - num = gst_v4l2src_grab_frame (v4l2src); - if (num == -1) - return NULL; - } + /* FIXME: isn't this v4l2 timestamp its own clock?! */ + /* by default, we use the frame once */ + v4l2src->need_writes = 1; + + g_assert (time >= v4l2src->substract_time); + time -= v4l2src->substract_time; + + /* first check whether we lost any frames according to the device */ + if (v4l2src->last_seq != 0) { + if (v4l2src->pool->buffers[num].buffer.sequence - v4l2src->last_seq > + 1) { + v4l2src->need_writes = + v4l2src->pool->buffers[num].buffer.sequence - v4l2src->last_seq; + g_signal_emit (G_OBJECT (v4l2src), + gst_v4l2src_signals[SIGNAL_FRAME_LOST], 0, + v4l2src->need_writes - 1); + } + } + v4l2src->last_seq = v4l2src->pool->buffers[num].buffer.sequence; + + /* decide how often we're going to write the frame - set + * v4lmjpegsrc->need_writes to (that-1) and have_frame to TRUE + * if we're going to write it - else, just continue. + * + * time is generally the system or audio clock. Let's + * say that we've written one second of audio, then we want + * to have written one second of video too, within the same + * timeframe. This means that if time - begin_time = X sec, + * we want to have written X*fps frames. If we've written + * more - drop, if we've written less - dup... */ + if (v4l2src->handled * (GST_SECOND / fps) - time > + 1.5 * (GST_SECOND / fps)) { + /* yo dude, we've got too many frames here! Drop! DROP! */ + v4l2src->need_writes--; /* -= (v4l2src->handled - (time / fps)); */ + g_signal_emit (G_OBJECT (v4l2src), + gst_v4l2src_signals[SIGNAL_FRAME_DROP], 0); + } else if (v4l2src->handled * (GST_SECOND / fps) - time < + -1.5 * (GST_SECOND / fps)) { + /* this means we're lagging far behind */ + v4l2src->need_writes++; /* += ((time / fps) - v4l2src->handled); */ + g_signal_emit (G_OBJECT (v4l2src), + gst_v4l2src_signals[SIGNAL_FRAME_INSERT], 0); + } + + if (v4l2src->need_writes > 0) { + have_frame = TRUE; + v4l2src->need_writes--; + } else { + if (!gst_v4l2src_queue_frame (v4l2src, num)) + return NULL; + num = gst_v4l2src_grab_frame (v4l2src); + if (num == -1) + return NULL; + } } while (!have_frame); } g_assert (num != -1); GST_LOG_OBJECT (v4l2src, "buffer %d needs %d writes", num, - v4l2src->need_writes + 1); + v4l2src->need_writes + 1); i = v4l2src->pool->buffers[num].buffer.bytesused > - 0 ? v4l2src->pool->buffers[num].buffer.bytesused : v4l2src->pool-> - buffers[num].length; + 0 ? v4l2src->pool->buffers[num].buffer.bytesused : v4l2src->pool-> + buffers[num].length; /* check if this is the last buffer in the queue. If so do a memcpy to put it back asap to avoid framedrops and deadlocks because of stupid elements */ if (gst_atomic_int_read (&v4l2src->pool->refcount) == v4l2src->breq.count) { @@ -888,8 +889,8 @@ gst_v4l2src_get (GstPad * pad) buf = gst_buffer_new_and_alloc (i); memcpy (GST_BUFFER_DATA (buf), v4l2src->pool->buffers[num].start, i); if (!gst_v4l2src_queue_frame (v4l2src, num)) { - gst_data_unref (GST_DATA (buf)); - return NULL; + gst_data_unref (GST_DATA (buf)); + return NULL; } } else { GST_LOG_OBJECT (v4l2src, "using mmap'd buffer"); @@ -909,13 +910,13 @@ gst_v4l2src_get (GstPad * pad) } else { /* calculate time based on our own clock */ GST_BUFFER_TIMESTAMP (buf) = - GST_TIMEVAL_TO_TIME (v4l2src->pool->buffers[num].buffer.timestamp) - - v4l2src->substract_time; + GST_TIMEVAL_TO_TIME (v4l2src->pool->buffers[num].buffer.timestamp) - + v4l2src->substract_time; } if (v4l2src->need_writes > 0) { v4l2src->cached_buffer = buf; for (i = 0; i < v4l2src->need_writes; i++) { - gst_data_ref (GST_DATA (buf)); + gst_data_ref (GST_DATA (buf)); } } } @@ -939,13 +940,13 @@ gst_v4l2src_set_property (GObject * object, switch (prop_id) { case ARG_NUMBUFS: if (!GST_V4L2_IS_ACTIVE (GST_V4L2ELEMENT (v4l2src))) { - v4l2src->breq.count = g_value_get_int (value); + v4l2src->breq.count = g_value_get_int (value); } break; case ARG_USE_FIXED_FPS: if (!GST_V4L2_IS_ACTIVE (GST_V4L2ELEMENT (v4l2src))) { - v4l2src->use_fixed_fps = g_value_get_boolean (value); + v4l2src->use_fixed_fps = g_value_get_boolean (value); } break; @@ -1005,7 +1006,7 @@ gst_v4l2src_change_state (GstElement * element) switch (transition) { case GST_STATE_NULL_TO_READY: if (!gst_v4l2src_get_capture (v4l2src)) - return GST_STATE_FAILURE; + return GST_STATE_FAILURE; break; case GST_STATE_READY_TO_PAUSED: v4l2src->handled = 0; @@ -1016,24 +1017,24 @@ gst_v4l2src_change_state (GstElement * element) case GST_STATE_PAUSED_TO_PLAYING: /* queue all buffer, start streaming capture */ if (!gst_v4l2src_capture_start (v4l2src)) - return GST_STATE_FAILURE; + return GST_STATE_FAILURE; g_get_current_time (&time); v4l2src->substract_time = GST_TIMEVAL_TO_TIME (time) - - v4l2src->substract_time; + v4l2src->substract_time; v4l2src->last_seq = 0; break; case GST_STATE_PLAYING_TO_PAUSED: g_get_current_time (&time); v4l2src->substract_time = GST_TIMEVAL_TO_TIME (time) - - v4l2src->substract_time; + v4l2src->substract_time; /* de-queue all queued buffers */ if (!gst_v4l2src_capture_stop (v4l2src)) - return GST_STATE_FAILURE; + return GST_STATE_FAILURE; break; case GST_STATE_PAUSED_TO_READY: /* stop capturing, unmap all buffers */ if (!gst_v4l2src_capture_deinit (v4l2src)) - return GST_STATE_FAILURE; + return GST_STATE_FAILURE; break; case GST_STATE_READY_TO_NULL: break; diff --git a/sys/v4l2/gstv4l2tuner.c b/sys/v4l2/gstv4l2tuner.c index 5d5626f2..79e3214b 100644 --- a/sys/v4l2/gstv4l2tuner.c +++ b/sys/v4l2/gstv4l2tuner.c @@ -76,8 +76,8 @@ gst_v4l2_tuner_channel_get_type (void) }; gst_v4l2_tuner_channel_type = - g_type_register_static (GST_TYPE_TUNER_CHANNEL, - "GstV4l2TunerChannel", &v4l2_tuner_channel_info, 0); + g_type_register_static (GST_TYPE_TUNER_CHANNEL, + "GstV4l2TunerChannel", &v4l2_tuner_channel_info, 0); } return gst_v4l2_tuner_channel_type; @@ -117,8 +117,8 @@ gst_v4l2_tuner_norm_get_type (void) }; gst_v4l2_tuner_norm_type = - g_type_register_static (GST_TYPE_TUNER_NORM, - "GstV4l2TunerNorm", &v4l2_tuner_norm_info, 0); + g_type_register_static (GST_TYPE_TUNER_NORM, + "GstV4l2TunerNorm", &v4l2_tuner_norm_info, 0); } return gst_v4l2_tuner_norm_type; @@ -295,7 +295,7 @@ gst_v4l2_tuner_set_frequency (GstTuner * mixer, /* assert that we're opened and that we're using a known item */ g_return_if_fail (GST_V4L2_IS_OPEN (v4l2element)); g_return_if_fail (GST_TUNER_CHANNEL_HAS_FLAG (channel, - GST_TUNER_CHANNEL_FREQUENCY)); + GST_TUNER_CHANNEL_FREQUENCY)); g_return_if_fail (gst_v4l2_tuner_contains_channel (v4l2element, v4l2channel)); gst_v4l2_get_input (v4l2element, &chan); @@ -319,9 +319,9 @@ gst_v4l2_tuner_get_frequency (GstTuner * mixer, GstTunerChannel * channel) /* assert that we're opened and that we're using a known item */ g_return_val_if_fail (GST_V4L2_IS_OPEN (v4l2element), 0); g_return_val_if_fail (GST_TUNER_CHANNEL_HAS_FLAG (channel, - GST_TUNER_CHANNEL_FREQUENCY), 0); + GST_TUNER_CHANNEL_FREQUENCY), 0); g_return_val_if_fail (gst_v4l2_tuner_contains_channel (v4l2element, - v4l2channel), 0); + v4l2channel), 0); gst_v4l2_get_input (v4l2element, &chan); if (chan == GST_V4L2_TUNER_CHANNEL (channel)->index && @@ -343,9 +343,9 @@ gst_v4l2_tuner_signal_strength (GstTuner * mixer, GstTunerChannel * channel) /* assert that we're opened and that we're using a known item */ g_return_val_if_fail (GST_V4L2_IS_OPEN (v4l2element), 0); g_return_val_if_fail (GST_TUNER_CHANNEL_HAS_FLAG (channel, - GST_TUNER_CHANNEL_FREQUENCY), 0); + GST_TUNER_CHANNEL_FREQUENCY), 0); g_return_val_if_fail (gst_v4l2_tuner_contains_channel (v4l2element, - v4l2channel), 0); + v4l2channel), 0); gst_v4l2_get_input (v4l2element, &chan); if (chan == GST_V4L2_TUNER_CHANNEL (channel)->index && diff --git a/sys/v4l2/gstv4l2xoverlay.c b/sys/v4l2/gstv4l2xoverlay.c index 1af62cc1..515d8463 100644 --- a/sys/v4l2/gstv4l2xoverlay.c +++ b/sys/v4l2/gstv4l2xoverlay.c @@ -72,7 +72,7 @@ gst_v4l2_xoverlay_open (GstV4l2Element * v4l2element) xwin->display_name = g_strdup (v4l2element->display); if (v4l2element->xwindow_id != 0 && - xwin->display_name && xwin->display_name[0] == ':') { + xwin->display_name && xwin->display_name[0] == ':') { gst_x_window_listener_set_xid (xwin, v4l2element->xwindow_id); } } @@ -85,7 +85,7 @@ gst_v4l2_xoverlay_close (GstV4l2Element * v4l2element) if (xwin != NULL) { if (v4l2element->xwindow_id != 0 && - xwin->display_name && xwin->display_name[0] == ':') { + xwin->display_name && xwin->display_name[0] == ':') { gst_x_window_listener_set_xid (xwin, 0); } diff --git a/sys/v4l2/v4l2-overlay_calls.c b/sys/v4l2/v4l2-overlay_calls.c index d4a10ab7..0876879d 100644 --- a/sys/v4l2/v4l2-overlay_calls.c +++ b/sys/v4l2/v4l2-overlay_calls.c @@ -60,14 +60,14 @@ gst_v4l2_set_display (GstV4l2Element * v4l2element) switch (system (buff)) { case -1: GST_ELEMENT_ERROR (v4l2element, RESOURCE, FAILED, - (_("Could not start v4l-conf.")), GST_ERROR_SYSTEM); + (_("Could not start v4l-conf.")), GST_ERROR_SYSTEM); g_free (buff); return FALSE; case 0: break; default: GST_ELEMENT_ERROR (v4l2element, RESOURCE, FAILED, - (_("Executing v4l-conf failed.")), GST_ERROR_SYSTEM); + (_("Executing v4l-conf failed.")), GST_ERROR_SYSTEM); g_free (buff); return FALSE; } @@ -106,7 +106,7 @@ gst_v4l2_set_window (GstElement * element, if (ioctl (v4l2element->video_fd, VIDIOC_S_FMT, &fmt) < 0) { GST_ELEMENT_ERROR (v4l2element, RESOURCE, TOO_LAZY, (NULL), - ("Failed to set the video window: %s", g_strerror (errno))); + ("Failed to set the video window: %s", g_strerror (errno))); return FALSE; } @@ -131,8 +131,8 @@ gst_v4l2_enable_overlay (GstV4l2Element * v4l2element, gboolean enable) if (ioctl (v4l2element->video_fd, VIDIOC_OVERLAY, &doit) < 0) { GST_ELEMENT_ERROR (v4l2element, RESOURCE, TOO_LAZY, (NULL), - ("Failed to %s overlay display: %s", - enable ? "enable" : "disable", g_strerror (errno))); + ("Failed to %s overlay display: %s", + enable ? "enable" : "disable", g_strerror (errno))); return FALSE; } diff --git a/sys/v4l2/v4l2_calls.c b/sys/v4l2/v4l2_calls.c index f75ea550..92de8a42 100644 --- a/sys/v4l2/v4l2_calls.c +++ b/sys/v4l2/v4l2_calls.c @@ -56,8 +56,8 @@ gst_v4l2_get_capabilities (GstV4l2Element * v4l2element) if (ioctl (v4l2element->video_fd, VIDIOC_QUERYCAP, &(v4l2element->vcap)) < 0) { GST_ELEMENT_ERROR (v4l2element, RESOURCE, SETTINGS, (NULL), - ("Error getting %s capabilities: %s", - v4l2element->device, g_strerror (errno))); + ("Error getting %s capabilities: %s", + v4l2element->device, g_strerror (errno))); return FALSE; } @@ -94,14 +94,14 @@ gst_v4l2_fill_lists (GstV4l2Element * v4l2element) input.index = n; if (ioctl (v4l2element->video_fd, VIDIOC_ENUMINPUT, &input) < 0) { - if (errno == EINVAL) - break; /* end of enumeration */ - else { - GST_ELEMENT_ERROR (v4l2element, RESOURCE, SETTINGS, (NULL), - ("Failed to get %d in input enumeration for %s: %s", - n, v4l2element->device, g_strerror (errno))); - return FALSE; - } + if (errno == EINVAL) + break; /* end of enumeration */ + else { + GST_ELEMENT_ERROR (v4l2element, RESOURCE, SETTINGS, (NULL), + ("Failed to get %d in input enumeration for %s: %s", + n, v4l2element->device, g_strerror (errno))); + return FALSE; + } } v4l2channel = g_object_new (GST_TYPE_V4L2_TUNER_CHANNEL, NULL); @@ -110,34 +110,34 @@ gst_v4l2_fill_lists (GstV4l2Element * v4l2element) channel->flags = GST_TUNER_CHANNEL_INPUT; v4l2channel->index = n; if (input.type == V4L2_INPUT_TYPE_TUNER) { - struct v4l2_tuner vtun; - - v4l2channel->tuner = input.tuner; - channel->flags |= GST_TUNER_CHANNEL_FREQUENCY; - - vtun.index = input.tuner; - if (ioctl (v4l2element->video_fd, VIDIOC_G_TUNER, &vtun) < 0) { - GST_ELEMENT_ERROR (v4l2element, RESOURCE, SETTINGS, (NULL), - ("Failed to get tuner %d settings on %s: %s", - input.tuner, v4l2element->device, g_strerror (errno))); - g_object_unref (G_OBJECT (channel)); - return FALSE; - } - channel->min_frequency = vtun.rangelow; - channel->max_frequency = vtun.rangehigh; - channel->min_signal = 0; - channel->max_signal = 0xffff; + struct v4l2_tuner vtun; + + v4l2channel->tuner = input.tuner; + channel->flags |= GST_TUNER_CHANNEL_FREQUENCY; + + vtun.index = input.tuner; + if (ioctl (v4l2element->video_fd, VIDIOC_G_TUNER, &vtun) < 0) { + GST_ELEMENT_ERROR (v4l2element, RESOURCE, SETTINGS, (NULL), + ("Failed to get tuner %d settings on %s: %s", + input.tuner, v4l2element->device, g_strerror (errno))); + g_object_unref (G_OBJECT (channel)); + return FALSE; + } + channel->min_frequency = vtun.rangelow; + channel->max_frequency = vtun.rangehigh; + channel->min_signal = 0; + channel->max_signal = 0xffff; } if (input.audioset) { - /* we take the first. We don't care for - * the others for now */ - while (!(input.audioset & (1 << v4l2channel->audio))) - v4l2channel->audio++; - channel->flags |= GST_TUNER_CHANNEL_AUDIO; + /* we take the first. We don't care for + * the others for now */ + while (!(input.audioset & (1 << v4l2channel->audio))) + v4l2channel->audio++; + channel->flags |= GST_TUNER_CHANNEL_AUDIO; } v4l2element->channels = - g_list_append (v4l2element->channels, (gpointer) channel); + g_list_append (v4l2element->channels, (gpointer) channel); } } else { /* outputs */ @@ -148,14 +148,14 @@ gst_v4l2_fill_lists (GstV4l2Element * v4l2element) output.index = n; if (ioctl (v4l2element->video_fd, VIDIOC_ENUMOUTPUT, &output) < 0) { - if (errno == EINVAL) - break; /* end of enumeration */ - else { - GST_ELEMENT_ERROR (v4l2element, RESOURCE, SETTINGS, (NULL), - ("Failed to get %d in output enumeration for %s: %s", - n, v4l2element->device, g_strerror (errno))); - return FALSE; - } + if (errno == EINVAL) + break; /* end of enumeration */ + else { + GST_ELEMENT_ERROR (v4l2element, RESOURCE, SETTINGS, (NULL), + ("Failed to get %d in output enumeration for %s: %s", + n, v4l2element->device, g_strerror (errno))); + return FALSE; + } } v4l2channel = g_object_new (GST_TYPE_V4L2_TUNER_CHANNEL, NULL); @@ -164,15 +164,15 @@ gst_v4l2_fill_lists (GstV4l2Element * v4l2element) channel->flags = GST_TUNER_CHANNEL_OUTPUT; v4l2channel->index = n; if (output.audioset) { - /* we take the first. We don't care for - * the others for now */ - while (!(output.audioset & (1 << v4l2channel->audio))) - v4l2channel->audio++; - channel->flags |= GST_TUNER_CHANNEL_AUDIO; + /* we take the first. We don't care for + * the others for now */ + while (!(output.audioset & (1 << v4l2channel->audio))) + v4l2channel->audio++; + channel->flags |= GST_TUNER_CHANNEL_AUDIO; } v4l2element->channels = - g_list_append (v4l2element->channels, (gpointer) channel); + g_list_append (v4l2element->channels, (gpointer) channel); } } @@ -185,12 +185,12 @@ gst_v4l2_fill_lists (GstV4l2Element * v4l2element) standard.index = n; if (ioctl (v4l2element->video_fd, VIDIOC_ENUMSTD, &standard) < 0) { if (errno == EINVAL) - break; /* end of enumeration */ + break; /* end of enumeration */ else { - GST_ELEMENT_ERROR (v4l2element, RESOURCE, SETTINGS, (NULL), - ("Failed to get %d in norm enumeration for %s: %s", - n, v4l2element->device, g_strerror (errno))); - return FALSE; + GST_ELEMENT_ERROR (v4l2element, RESOURCE, SETTINGS, (NULL), + ("Failed to get %d in norm enumeration for %s: %s", + n, v4l2element->device, g_strerror (errno))); + return FALSE; } } @@ -198,7 +198,7 @@ gst_v4l2_fill_lists (GstV4l2Element * v4l2element) norm = GST_TUNER_NORM (v4l2norm); norm->label = g_strdup (standard.name); norm->fps = (gfloat) standard.frameperiod.denominator / - standard.frameperiod.numerator; + standard.frameperiod.numerator; v4l2norm->index = standard.id; v4l2element->norms = g_list_append (v4l2element->norms, (gpointer) norm); @@ -217,15 +217,15 @@ gst_v4l2_fill_lists (GstV4l2Element * v4l2element) control.id = n; if (ioctl (v4l2element->video_fd, VIDIOC_QUERYCTRL, &control) < 0) { if (errno == EINVAL) { - if (n < V4L2_CID_PRIVATE_BASE) - continue; - else - break; + if (n < V4L2_CID_PRIVATE_BASE) + continue; + else + break; } else { - GST_ELEMENT_ERROR (v4l2element, RESOURCE, SETTINGS, (NULL), - ("Failed to get %d in control enumeration for %s: %s", - n, v4l2element->device, g_strerror (errno))); - return FALSE; + GST_ELEMENT_ERROR (v4l2element, RESOURCE, SETTINGS, (NULL), + ("Failed to get %d in control enumeration for %s: %s", + n, v4l2element->device, g_strerror (errno))); + return FALSE; } } if (control.flags & V4L2_CTRL_FLAG_DISABLED) @@ -245,12 +245,12 @@ gst_v4l2_fill_lists (GstV4l2Element * v4l2element) case V4L2_CID_EXPOSURE: case V4L2_CID_AUTOGAIN: case V4L2_CID_GAIN: - /* we only handle these for now */ - break; + /* we only handle these for now */ + break; default: - DEBUG ("ControlID %s (%d) unhandled, FIXME", control.name, n); - control.id++; - break; + DEBUG ("ControlID %s (%d) unhandled, FIXME", control.name, n); + control.id++; + break; } if (n != control.id) continue; @@ -267,20 +267,20 @@ gst_v4l2_fill_lists (GstV4l2Element * v4l2element) menu.id = n; for (i = 0;; i++) { - menu.index = i; - if (ioctl (v4l2element->video_fd, VIDIOC_QUERYMENU, &menu) < 0) { - if (errno == EINVAL) - break; /* end of enumeration */ - else { - GST_ELEMENT_ERROR (v4l2element, RESOURCE, SETTINGS, (NULL), - ("Failed to get %d in menu enumeration for %s: %s", - n, v4l2element->device, g_strerror (errno))); - return FALSE; - } - } - mptr = g_malloc (sizeof (menu)); - memcpy (mptr, &menu, sizeof (menu)); - menus = g_list_append (menus, mptr); + menu.index = i; + if (ioctl (v4l2element->video_fd, VIDIOC_QUERYMENU, &menu) < 0) { + if (errno == EINVAL) + break; /* end of enumeration */ + else { + GST_ELEMENT_ERROR (v4l2element, RESOURCE, SETTINGS, (NULL), + ("Failed to get %d in menu enumeration for %s: %s", + n, v4l2element->device, g_strerror (errno))); + return FALSE; + } + } + mptr = g_malloc (sizeof (menu)); + memcpy (mptr, &menu, sizeof (menu)); + menus = g_list_append (menus, mptr); } } v4l2element->menus = g_list_append (v4l2element->menus, menus); @@ -288,20 +288,20 @@ gst_v4l2_fill_lists (GstV4l2Element * v4l2element) switch (control.type) { case V4L2_CTRL_TYPE_INTEGER: - channel->min_value = control.minimum; - channel->max_value = control.maximum; - break; + channel->min_value = control.minimum; + channel->max_value = control.maximum; + break; case V4L2_CTRL_TYPE_BOOLEAN: - channel->min_value = FALSE; - channel->max_value = TRUE; - break; + channel->min_value = FALSE; + channel->max_value = TRUE; + break; default: - channel->min_value = channel->max_value = 0; - break; + channel->min_value = channel->max_value = 0; + break; } v4l2element->colors = g_list_append (v4l2element->colors, - (gpointer) channel); + (gpointer) channel); } return TRUE; @@ -352,7 +352,7 @@ gst_v4l2_set_defaults (GstV4l2Element * v4l2element) gst_tuner_set_channel (tuner, channel); } else { channel = - GST_TUNER_CHANNEL (gst_tuner_get_channel (GST_TUNER (v4l2element))); + GST_TUNER_CHANNEL (gst_tuner_get_channel (GST_TUNER (v4l2element))); v4l2element->channel = g_strdup (channel->label); gst_tuner_channel_changed (tuner, channel); g_object_notify (G_OBJECT (v4l2element), "channel"); @@ -392,8 +392,8 @@ gst_v4l2_open (GstV4l2Element * v4l2element) v4l2element->video_fd = open (v4l2element->device, O_RDWR); if (!GST_V4L2_IS_OPEN (v4l2element)) { GST_ELEMENT_ERROR (v4l2element, RESOURCE, OPEN_READ_WRITE, - (_("Could not open device \"%s\" for reading and writing."), - v4l2element->device), GST_ERROR_SYSTEM); + (_("Could not open device \"%s\" for reading and writing."), + v4l2element->device), GST_ERROR_SYSTEM); goto error; } @@ -406,8 +406,8 @@ gst_v4l2_open (GstV4l2Element * v4l2element) if (GST_IS_V4L2SRC (v4l2element) && !(v4l2element->vcap.capabilities & V4L2_CAP_VIDEO_CAPTURE)) { GST_ELEMENT_ERROR (v4l2element, RESOURCE, NOT_FOUND, - (_("Device \"%s\" is not a capture device."), v4l2element->device), - ("Capabilities: 0x%x", v4l2element->vcap.capabilities)); + (_("Device \"%s\" is not a capture device."), v4l2element->device), + ("Capabilities: 0x%x", v4l2element->vcap.capabilities)); goto error; } @@ -474,8 +474,8 @@ gst_v4l2_get_norm (GstV4l2Element * v4l2element, v4l2_std_id * norm) if (ioctl (v4l2element->video_fd, VIDIOC_G_STD, norm) < 0) { GST_ELEMENT_ERROR (v4l2element, RESOURCE, SETTINGS, (NULL), - ("Failed to get the current norm for device %s: %s", - v4l2element->device, g_strerror (errno))); + ("Failed to get the current norm for device %s: %s", + v4l2element->device, g_strerror (errno))); return FALSE; } @@ -498,8 +498,8 @@ gst_v4l2_set_norm (GstV4l2Element * v4l2element, v4l2_std_id norm) if (ioctl (v4l2element->video_fd, VIDIOC_S_STD, &norm) < 0) { GST_ELEMENT_ERROR (v4l2element, RESOURCE, SETTINGS, (NULL), - ("Failed to set norm 0x%llx for device %s: %s", - norm, v4l2element->device, g_strerror (errno))); + ("Failed to set norm 0x%llx for device %s: %s", + norm, v4l2element->device, g_strerror (errno))); return FALSE; } @@ -523,8 +523,8 @@ gst_v4l2_get_input (GstV4l2Element * v4l2element, gint * input) if (ioctl (v4l2element->video_fd, VIDIOC_G_INPUT, &n) < 0) { GST_ELEMENT_ERROR (v4l2element, RESOURCE, SETTINGS, (NULL), - ("Failed to get current input on device %s: %s", - v4l2element->device, g_strerror (errno))); + ("Failed to get current input on device %s: %s", + v4l2element->device, g_strerror (errno))); return FALSE; } @@ -549,8 +549,8 @@ gst_v4l2_set_input (GstV4l2Element * v4l2element, gint input) if (ioctl (v4l2element->video_fd, VIDIOC_S_INPUT, &input) < 0) { GST_ELEMENT_ERROR (v4l2element, RESOURCE, SETTINGS, (NULL), - ("Failed to set input %d on device %s: %s", - input, v4l2element->device, g_strerror (errno))); + ("Failed to set input %d on device %s: %s", + input, v4l2element->device, g_strerror (errno))); return FALSE; } @@ -574,8 +574,8 @@ gst_v4l2_get_output (GstV4l2Element * v4l2element, gint * output) if (ioctl (v4l2element->video_fd, VIDIOC_G_OUTPUT, &n) < 0) { GST_ELEMENT_ERROR (v4l2element, RESOURCE, SETTINGS, (NULL), - ("Failed to get current output on device %s: %s", - v4l2element->device, g_strerror (errno))); + ("Failed to get current output on device %s: %s", + v4l2element->device, g_strerror (errno))); return FALSE; } @@ -600,8 +600,8 @@ gst_v4l2_set_output (GstV4l2Element * v4l2element, gint output) if (ioctl (v4l2element->video_fd, VIDIOC_S_OUTPUT, &output) < 0) { GST_ELEMENT_ERROR (v4l2element, RESOURCE, SETTINGS, (NULL), - ("Failed to set output %d on device %s: %s", - output, v4l2element->device, g_strerror (errno))); + ("Failed to set output %d on device %s: %s", + output, v4l2element->device, g_strerror (errno))); return FALSE; } @@ -627,8 +627,8 @@ gst_v4l2_get_frequency (GstV4l2Element * v4l2element, freq.tuner = tunernum; if (ioctl (v4l2element->video_fd, VIDIOC_G_FREQUENCY, &freq) < 0) { GST_ELEMENT_ERROR (v4l2element, RESOURCE, SETTINGS, (NULL), - ("Failed to get current tuner frequency for device %s: %s", - v4l2element->device, g_strerror (errno))); + ("Failed to get current tuner frequency for device %s: %s", + v4l2element->device, g_strerror (errno))); return FALSE; } @@ -661,8 +661,8 @@ gst_v4l2_set_frequency (GstV4l2Element * v4l2element, if (ioctl (v4l2element->video_fd, VIDIOC_S_FREQUENCY, &freq) < 0) { GST_ELEMENT_ERROR (v4l2element, RESOURCE, SETTINGS, (NULL), - ("Failed to set tuner frequency to %lu for device %s: %s", - frequency, v4l2element->device, g_strerror (errno))); + ("Failed to set tuner frequency to %lu for device %s: %s", + frequency, v4l2element->device, g_strerror (errno))); return FALSE; } @@ -688,8 +688,8 @@ gst_v4l2_signal_strength (GstV4l2Element * v4l2element, tuner.index = tunernum; if (ioctl (v4l2element->video_fd, VIDIOC_G_TUNER, &tuner) < 0) { GST_ELEMENT_ERROR (v4l2element, RESOURCE, SETTINGS, (NULL), - ("Failed to get signal strength for device %s: %s", - v4l2element->device, g_strerror (errno))); + ("Failed to get signal strength for device %s: %s", + v4l2element->device, g_strerror (errno))); return FALSE; } @@ -719,8 +719,8 @@ gst_v4l2_get_attribute (GstV4l2Element * v4l2element, if (ioctl (v4l2element->video_fd, VIDIOC_G_CTRL, &control) < 0) { GST_ELEMENT_ERROR (v4l2element, RESOURCE, SETTINGS, (NULL), - ("Failed to get value for control %d on device %s: %s", - attribute_num, v4l2element->device, g_strerror (errno))); + ("Failed to get value for control %d on device %s: %s", + attribute_num, v4l2element->device, g_strerror (errno))); return FALSE; } @@ -751,8 +751,8 @@ gst_v4l2_set_attribute (GstV4l2Element * v4l2element, if (ioctl (v4l2element->video_fd, VIDIOC_S_CTRL, &control) < 0) { GST_ELEMENT_ERROR (v4l2element, RESOURCE, SETTINGS, (NULL), - ("Failed to set value %d for control %d on device %s: %s", - value, attribute_num, v4l2element->device, g_strerror (errno))); + ("Failed to set value %d for control %d on device %s: %s", + value, attribute_num, v4l2element->device, g_strerror (errno))); return FALSE; } diff --git a/sys/v4l2/v4l2src_calls.c b/sys/v4l2/v4l2src_calls.c index 00d710eb..a2db4f2b 100644 --- a/sys/v4l2/v4l2src_calls.c +++ b/sys/v4l2/v4l2src_calls.c @@ -70,19 +70,19 @@ gst_v4l2src_fill_format_list (GstV4l2Src * v4l2src) format->index = n; format->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; if (ioctl (GST_V4L2ELEMENT (v4l2src)->video_fd, VIDIOC_ENUM_FMT, - format) < 0) { + format) < 0) { if (errno == EINVAL) { - break; /* end of enumeration */ + break; /* end of enumeration */ } else { - GST_ELEMENT_ERROR (v4l2src, RESOURCE, SETTINGS, (NULL), - ("failed to get number %d in pixelformat enumeration for %s: %s", - n, GST_V4L2ELEMENT (v4l2src)->device, g_strerror (errno))); - g_free (format); - return FALSE; + GST_ELEMENT_ERROR (v4l2src, RESOURCE, SETTINGS, (NULL), + ("failed to get number %d in pixelformat enumeration for %s: %s", + n, GST_V4L2ELEMENT (v4l2src)->device, g_strerror (errno))); + g_free (format); + return FALSE; } } GST_LOG_OBJECT (v4l2src, "got format" GST_FOURCC_FORMAT, - GST_FOURCC_ARGS (format->pixelformat)); + GST_FOURCC_ARGS (format->pixelformat)); v4l2src->formats = g_slist_prepend (v4l2src->formats, format); } @@ -118,11 +118,11 @@ gst_v4l2src_queue_frame (GstV4l2Src * v4l2src, guint i) GST_LOG_OBJECT (v4l2src, "queueing frame %u", i); if (ioctl (GST_V4L2ELEMENT (v4l2src)->video_fd, VIDIOC_QBUF, - &v4l2src->pool->buffers[i].buffer) < 0) { + &v4l2src->pool->buffers[i].buffer) < 0) { GST_ELEMENT_ERROR (v4l2src, RESOURCE, WRITE, - (_("Could not write to device \"%s\"."), - GST_V4L2ELEMENT (v4l2src)->device), - ("Error queueing buffer %u on device %s", i, g_strerror (errno))); + (_("Could not write to device \"%s\"."), + GST_V4L2ELEMENT (v4l2src)->device), + ("Error queueing buffer %u on device %s", i, g_strerror (errno))); return FALSE; } @@ -146,8 +146,8 @@ gst_v4l2src_grab_frame (GstV4l2Src * v4l2src) /* if the sync() got interrupted, we can retry */ if (errno != EINTR) { GST_ELEMENT_ERROR (v4l2src, RESOURCE, SYNC, (NULL), - ("could not sync on a buffer on device %s: %s", - GST_V4L2ELEMENT (v4l2src)->device, g_strerror (errno))); + ("could not sync on a buffer on device %s: %s", + GST_V4L2ELEMENT (v4l2src)->device, g_strerror (errno))); return -1; } GST_DEBUG_OBJECT (v4l2src, "grab got interrupted"); @@ -174,10 +174,10 @@ gst_v4l2src_get_capture (GstV4l2Src * v4l2src) v4l2src->format.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; if (ioctl (GST_V4L2ELEMENT (v4l2src)->video_fd, VIDIOC_G_FMT, - &v4l2src->format) < 0) { + &v4l2src->format) < 0) { GST_ELEMENT_ERROR (v4l2src, RESOURCE, SETTINGS, (NULL), - ("failed to get pixelformat for device %s: %s", - GST_V4L2ELEMENT (v4l2src)->device, g_strerror (errno))); + ("failed to get pixelformat for device %s: %s", + GST_V4L2ELEMENT (v4l2src)->device, g_strerror (errno))); return FALSE; } @@ -209,11 +209,11 @@ gst_v4l2src_set_capture (GstV4l2Src * v4l2src, v4l2src->format.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; if (ioctl (GST_V4L2ELEMENT (v4l2src)->video_fd, VIDIOC_S_FMT, - &v4l2src->format) < 0) { + &v4l2src->format) < 0) { GST_ELEMENT_ERROR (v4l2src, RESOURCE, SETTINGS, (NULL), - ("failed to set pixelformat to %s @ %dx%d for device %s: %s", - fmt->description, width, height, GST_V4L2ELEMENT (v4l2src)->device, - g_strerror (errno))); + ("failed to set pixelformat to %s @ %dx%d for device %s: %s", + fmt->description, width, height, GST_V4L2ELEMENT (v4l2src)->device, + g_strerror (errno))); return FALSE; } @@ -250,21 +250,21 @@ gst_v4l2src_capture_init (GstV4l2Src * v4l2src) v4l2src->breq.type = v4l2src->format.type; v4l2src->breq.memory = V4L2_MEMORY_MMAP; if (ioctl (GST_V4L2ELEMENT (v4l2src)->video_fd, VIDIOC_REQBUFS, - &v4l2src->breq) < 0) { + &v4l2src->breq) < 0) { GST_ELEMENT_ERROR (v4l2src, RESOURCE, READ, - (_("Could not get buffers from device \"%s\"."), - GST_V4L2ELEMENT (v4l2src)->device), - ("error requesting %d buffers: %s", v4l2src->breq.count, - g_strerror (errno))); + (_("Could not get buffers from device \"%s\"."), + GST_V4L2ELEMENT (v4l2src)->device), + ("error requesting %d buffers: %s", v4l2src->breq.count, + g_strerror (errno))); return FALSE; } if (v4l2src->breq.count < GST_V4L2_MIN_BUFFERS) { GST_ELEMENT_ERROR (v4l2src, RESOURCE, READ, - (_("Could not get enough buffers from device \"%s\"."), - GST_V4L2ELEMENT (v4l2src)->device), - ("we received %d, we want at least %d", v4l2src->breq.count, - GST_V4L2_MIN_BUFFERS)); + (_("Could not get enough buffers from device \"%s\"."), + GST_V4L2ELEMENT (v4l2src)->device), + ("we received %d, we want at least %d", v4l2src->breq.count, + GST_V4L2_MIN_BUFFERS)); v4l2src->breq.count = buffers; return FALSE; } @@ -292,19 +292,19 @@ gst_v4l2src_capture_init (GstV4l2Src * v4l2src) buffer->buffer.index = n; buffer->buffer.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; if (ioctl (GST_V4L2ELEMENT (v4l2src)->video_fd, VIDIOC_QUERYBUF, - &buffer->buffer) < 0) { + &buffer->buffer) < 0) { GST_ELEMENT_ERROR (v4l2src, RESOURCE, READ, (NULL), - ("Could not get buffer properties of buffer %d: %s", n, - g_strerror (errno))); + ("Could not get buffer properties of buffer %d: %s", n, + g_strerror (errno))); gst_v4l2src_capture_deinit (v4l2src); return FALSE; } buffer->start = - mmap (0, buffer->buffer.length, PROT_READ | PROT_WRITE, MAP_SHARED, - GST_V4L2ELEMENT (v4l2src)->video_fd, buffer->buffer.m.offset); + mmap (0, buffer->buffer.length, PROT_READ | PROT_WRITE, MAP_SHARED, + GST_V4L2ELEMENT (v4l2src)->video_fd, buffer->buffer.m.offset); if (buffer->start == MAP_FAILED) { GST_ELEMENT_ERROR (v4l2src, RESOURCE, READ, (NULL), - ("Could not mmap video buffer %d: %s", n, g_strerror (errno))); + ("Could not mmap video buffer %d: %s", n, g_strerror (errno))); buffer->start = 0; gst_v4l2src_capture_deinit (v4l2src); return FALSE; @@ -344,8 +344,8 @@ gst_v4l2src_capture_start (GstV4l2Src * v4l2src) if (ioctl (GST_V4L2ELEMENT (v4l2src)->video_fd, VIDIOC_STREAMON, &type) < 0) { GST_ELEMENT_ERROR (v4l2src, RESOURCE, OPEN_READ, (NULL), - ("Error starting streaming capture from device %s: %s", - GST_V4L2ELEMENT (v4l2src)->device, g_strerror (errno))); + ("Error starting streaming capture from device %s: %s", + GST_V4L2ELEMENT (v4l2src)->device, g_strerror (errno))); return FALSE; } @@ -372,8 +372,8 @@ gst_v4l2src_capture_stop (GstV4l2Src * v4l2src) * on the non-queued ones */ if (ioctl (GST_V4L2ELEMENT (v4l2src)->video_fd, VIDIOC_STREAMOFF, &type) < 0) { GST_ELEMENT_ERROR (v4l2src, RESOURCE, CLOSE, (NULL), - ("Error stopping streaming capture from device %s: %s", - GST_V4L2ELEMENT (v4l2src)->device, g_strerror (errno))); + ("Error stopping streaming capture from device %s: %s", + GST_V4L2ELEMENT (v4l2src)->device, g_strerror (errno))); return FALSE; } @@ -445,7 +445,7 @@ gst_v4l2src_capture_deinit (GstV4l2Src * v4l2src) buffer.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; if (ioctl (GST_V4L2ELEMENT (v4l2src)->video_fd, VIDIOC_DQBUF, &buffer) < 0) GST_WARNING_OBJECT (v4l2src, - "Could not dequeue buffer on uninitialization"); + "Could not dequeue buffer on uninitialization"); } if (gst_atomic_int_dec_and_test (&v4l2src->pool->refcount)) { /* we're last thing that used all this */ diff --git a/tests/examples/spectrum/demo-osssrc.c b/tests/examples/spectrum/demo-osssrc.c index 462fcf90..1bd2fa11 100644 --- a/tests/examples/spectrum/demo-osssrc.c +++ b/tests/examples/spectrum/demo-osssrc.c @@ -75,7 +75,7 @@ spectrum_chain (GstPad * pad, GstData * _data) TRUE, 0, 0, GST_BUFFER_SIZE (buf), 25); for (i = 0; i < GST_BUFFER_SIZE (buf); i++) { gdk_draw_rectangle (drawingarea->window, drawingarea->style->white_gc, - TRUE, i, 32 - data[i], 1, data[i]); + TRUE, i, 32 - data[i], 1, data[i]); } gst_buffer_unref (buf); } -- cgit