diff options
author | Thomas Vander Stichele <thomas@apestaart.org> | 2004-03-15 19:32:28 +0000 |
---|---|---|
committer | Thomas Vander Stichele <thomas@apestaart.org> | 2004-03-15 19:32:28 +0000 |
commit | f83cb187de417a9043b46edf710a54874ba917a3 (patch) | |
tree | 6344616f73e58bf46715879a44f2e7ed55560fb0 | |
parent | 8392245d807cf74a5020b0909ad72dc3bfbec356 (diff) |
don't mix tabs and spaces
Original commit message from CVS:
don't mix tabs and spaces
126 files changed, 5164 insertions, 5100 deletions
@@ -1,5 +1,9 @@ 2004-03-15 Thomas Vander Stichele <thomas at apestaart dot org> + * *.c, *.cc: don't mix tabs and spaces + +2004-03-15 Thomas Vander Stichele <thomas at apestaart dot org> + * gst-libs/gst/play/play.c: (gst_play_pipeline_setup): use the new ffmpegcolorspace * gst-plugins.spec.in: diff --git a/examples/capsfilter/capsfilter1.c b/examples/capsfilter/capsfilter1.c index 46e127a212..5948d60161 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 982a4c7ad1..5178d28bdc 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 3272778bf6..a23d3a0184 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 48a7ca2372..5c1296098d 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] <type> <filename> \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 e750f3468f..c4a58cf86a 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 1e823cc5b5..d83c78e648 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 34a6958dee..e8d6bc0455 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 d2c2c6b217..dc9ddfd676 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 ec6844a07a..afb4ecc4e2 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 55d79e90c7..3fb437febc 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/alsa/gstalsa.c b/ext/alsa/gstalsa.c index e1cd5da166..f4e75e5267 100644 --- a/ext/alsa/gstalsa.c +++ b/ext/alsa/gstalsa.c @@ -104,10 +104,10 @@ gst_alsa_get_type (void) }; alsa_type = - g_type_register_static (GST_TYPE_ELEMENT, "GstAlsa", &alsa_info, 0); + g_type_register_static (GST_TYPE_ELEMENT, "GstAlsa", &alsa_info, 0); g_type_add_interface_static (alsa_type, - GST_TYPE_PROPERTY_PROBE, &alsa_probe_info); + GST_TYPE_PROPERTY_PROBE, &alsa_probe_info); } return alsa_type; @@ -150,36 +150,36 @@ gst_alsa_class_init (gpointer g_class, gpointer class_data) g_object_class_install_property (object_class, ARG_DEVICE, g_param_spec_string ("device", "Device", - "ALSA device, as defined in an asoundrc", - "default", G_PARAM_READWRITE)); + "ALSA device, as defined in an asoundrc", + "default", G_PARAM_READWRITE)); g_object_class_install_property (object_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 (object_class, ARG_PERIODCOUNT, g_param_spec_int ("period-count", "Period count", - "Number of hardware buffers to use", - 2, 64, 2, G_PARAM_READWRITE | G_PARAM_CONSTRUCT)); + "Number of hardware buffers to use", + 2, 64, 2, G_PARAM_READWRITE | G_PARAM_CONSTRUCT)); g_object_class_install_property (object_class, ARG_PERIODSIZE, g_param_spec_int ("period-size", "Period size", - "Number of frames (samples on each channel) in one hardware period", - 2, 8192, 8192, G_PARAM_READWRITE | G_PARAM_CONSTRUCT)); + "Number of frames (samples on each channel) in one hardware period", + 2, 8192, 8192, G_PARAM_READWRITE | G_PARAM_CONSTRUCT)); g_object_class_install_property (object_class, ARG_BUFFERSIZE, g_param_spec_int ("buffer-size", "Buffer size", - "Number of frames the hardware buffer can hold", - 4, 65536, 16384, G_PARAM_READWRITE)); + "Number of frames the hardware buffer can hold", + 4, 65536, 16384, G_PARAM_READWRITE)); g_object_class_install_property (object_class, ARG_AUTORECOVER, g_param_spec_boolean ("autorecover", "Automatic xrun recovery", - "When TRUE tries to reduce processor load on xruns", - TRUE, G_PARAM_READWRITE | G_PARAM_CONSTRUCT)); + "When TRUE tries to reduce processor load on xruns", + TRUE, G_PARAM_READWRITE | G_PARAM_CONSTRUCT)); g_object_class_install_property (object_class, ARG_MMAP, g_param_spec_boolean ("mmap", "Use mmap'ed access", - "Wether to use mmap (faster) or standard read/write (more compatible)", - TRUE, G_PARAM_READWRITE | G_PARAM_CONSTRUCT)); + "Wether to use mmap (faster) or standard read/write (more compatible)", + TRUE, G_PARAM_READWRITE | G_PARAM_CONSTRUCT)); g_object_class_install_property (object_class, ARG_MAXDISCONT, g_param_spec_uint64 ("max-discont", "Maximum Discontinuity", - "GStreamer timeunits before the timestamp syncing starts dropping/inserting samples", - /* rounding errors */ 1000, GST_SECOND, GST_ALSA_DEFAULT_DISCONT, - G_PARAM_READWRITE | G_PARAM_CONSTRUCT)); + "GStreamer timeunits before the timestamp syncing starts dropping/inserting samples", + /* rounding errors */ 1000, GST_SECOND, GST_ALSA_DEFAULT_DISCONT, + G_PARAM_READWRITE | G_PARAM_CONSTRUCT)); element_class->change_state = GST_DEBUG_FUNCPTR (gst_alsa_change_state); element_class->query = GST_DEBUG_FUNCPTR (gst_alsa_query); @@ -221,7 +221,7 @@ gst_alsa_set_property (GObject * object, guint prop_id, const GValue * value, switch (prop_id) { case ARG_DEVICE: if (this->device) - g_free (this->device); + g_free (this->device); this->device = g_strdup (g_value_get_string (value)); break; case ARG_PERIODCOUNT: @@ -322,7 +322,7 @@ gst_alsa_class_probe_devices (GstAlsaClass * klass, gboolean check) * do function-wise look-ups. */ if (!init && !check) { -#define MAX_DEVICES 16 /* random number */ +#define MAX_DEVICES 16 /* random number */ gint num, res; gchar *dev; snd_pcm_t *pcm; @@ -331,13 +331,13 @@ gst_alsa_class_probe_devices (GstAlsaClass * klass, gboolean check) dev = g_strdup_printf ("hw:%d", num); if (!(res = snd_pcm_open (&pcm, dev, 0, SND_PCM_NONBLOCK)) || - res == -EBUSY) { - klass->devices = g_list_append (klass->devices, dev); + res == -EBUSY) { + klass->devices = g_list_append (klass->devices, dev); - if (res != -EBUSY) - snd_pcm_close (pcm); + if (res != -EBUSY) + snd_pcm_close (pcm); } else { - g_free (dev); + g_free (dev); } } @@ -447,7 +447,7 @@ gst_alsa_request_new_pad (GstElement * element, GstPadTemplate * templ, if (name) { /* locate the track number in the requested pad name. */ track = (gint) strtol (name + (strchr (templ->name_template, '%') - - templ->name_template), NULL, 0); + templ->name_template), NULL, 0); if (track < 1 || track >= GST_ALSA_MAX_TRACKS) { GST_INFO_OBJECT (this, "invalid track requested. (%d)", track); return NULL; @@ -464,7 +464,7 @@ gst_alsa_request_new_pad (GstElement * element, GstPadTemplate * templ, if (track == 0) { for (track = 1; track < GST_ALSA_MAX_TRACKS; track++) { if (this->pad[track] != NULL) - goto found_track; + goto found_track; } return NULL; } @@ -505,21 +505,21 @@ gst_alsa_get_format (const GstStructure * structure) /* extract the needed information from the cap */ if (!(gst_structure_get_int (structure, "width", &width) && - gst_structure_get_int (structure, "depth", &depth) && - gst_structure_get_boolean (structure, "signed", &sign))) + gst_structure_get_int (structure, "depth", &depth) && + gst_structure_get_boolean (structure, "signed", &sign))) goto error; /* extract endianness if needed */ if (width > 8) { if (!gst_structure_get_int (structure, "endianness", &endianness)) - goto error; + goto error; } else { endianness = G_BYTE_ORDER; } ret->format = - snd_pcm_build_linear_format (depth, width, sign ? 0 : 1, - endianness == G_LITTLE_ENDIAN ? 0 : 1); + snd_pcm_build_linear_format (depth, width, sign ? 0 : 1, + endianness == G_LITTLE_ENDIAN ? 0 : 1); } else if (!strncmp (mimetype, "audio/x-raw-float", 17)) { gint width; @@ -531,19 +531,19 @@ gst_alsa_get_format (const GstStructure * structure) /* match layout to format wrt to endianness */ if (width == 32) { if (G_BYTE_ORDER == G_LITTLE_ENDIAN) { - ret->format = SND_PCM_FORMAT_FLOAT_LE; + ret->format = SND_PCM_FORMAT_FLOAT_LE; } else if (G_BYTE_ORDER == G_BIG_ENDIAN) { - ret->format = SND_PCM_FORMAT_FLOAT_BE; + ret->format = SND_PCM_FORMAT_FLOAT_BE; } else { - ret->format = SND_PCM_FORMAT_FLOAT; + ret->format = SND_PCM_FORMAT_FLOAT; } } else if (width == 64) { if (G_BYTE_ORDER == G_LITTLE_ENDIAN) { - ret->format = SND_PCM_FORMAT_FLOAT64_LE; + ret->format = SND_PCM_FORMAT_FLOAT64_LE; } else if (G_BYTE_ORDER == G_BIG_ENDIAN) { - ret->format = SND_PCM_FORMAT_FLOAT64_BE; + ret->format = SND_PCM_FORMAT_FLOAT64_BE; } else { - ret->format = SND_PCM_FORMAT_FLOAT64; + ret->format = SND_PCM_FORMAT_FLOAT64; } } else { goto error; @@ -556,7 +556,7 @@ gst_alsa_get_format (const GstStructure * structure) /* get rate and channels */ if (!(gst_structure_get_int (structure, "rate", &ret->rate) && - gst_structure_get_int (structure, "channels", &ret->channels))) + gst_structure_get_int (structure, "channels", &ret->channels))) goto error; return ret; @@ -588,29 +588,29 @@ gst_alsa_get_caps_internal (snd_pcm_format_t format) } else if (snd_pcm_format_linear (format)) { /* int */ GstStructure *structure = gst_structure_new ("audio/x-raw-int", - "width", G_TYPE_INT, (gint) snd_pcm_format_physical_width (format), - "depth", G_TYPE_INT, (gint) snd_pcm_format_width (format), - "signed", G_TYPE_BOOLEAN, - snd_pcm_format_signed (format) == 1 ? TRUE : FALSE, - NULL); + "width", G_TYPE_INT, (gint) snd_pcm_format_physical_width (format), + "depth", G_TYPE_INT, (gint) snd_pcm_format_width (format), + "signed", G_TYPE_BOOLEAN, + snd_pcm_format_signed (format) == 1 ? TRUE : FALSE, + NULL); /* endianness */ if (snd_pcm_format_physical_width (format) > 8) { switch (snd_pcm_format_little_endian (format)) { - case 0: - gst_structure_set (structure, "endianness", G_TYPE_INT, G_BIG_ENDIAN, - NULL); - break; - case 1: - gst_structure_set (structure, "endianness", G_TYPE_INT, - G_LITTLE_ENDIAN, NULL); - break; - default: - GST_WARNING - ("Unknown byte order in sound driver. Continuing by assuming system byte order."); - gst_structure_set (structure, "endianness", G_TYPE_INT, G_BYTE_ORDER, - NULL); - break; + case 0: + gst_structure_set (structure, "endianness", G_TYPE_INT, G_BIG_ENDIAN, + NULL); + break; + case 1: + gst_structure_set (structure, "endianness", G_TYPE_INT, + G_LITTLE_ENDIAN, NULL); + break; + default: + GST_WARNING + ("Unknown byte order in sound driver. Continuing by assuming system byte order."); + gst_structure_set (structure, "endianness", G_TYPE_INT, G_BYTE_ORDER, + NULL); + break; } } return gst_caps_new_full (structure, NULL); @@ -620,8 +620,8 @@ gst_alsa_get_caps_internal (snd_pcm_format_t format) return NULL; return gst_caps_new_simple ("audio/x-raw-float", - "width", G_TYPE_INT, (gint) snd_pcm_format_width (format), - "endianness", G_TYPE_INT, G_BYTE_ORDER, NULL); + "width", G_TYPE_INT, (gint) snd_pcm_format_width (format), + "endianness", G_TYPE_INT, G_BYTE_ORDER, NULL); } return NULL; } @@ -638,7 +638,7 @@ add_channels (GstStructure * structure, gint min_rate, gint max_rate, gst_structure_set (structure, "rate", G_TYPE_INT, min_rate, NULL); } else { gst_structure_set (structure, "rate", GST_TYPE_INT_RANGE, min_rate, - max_rate, NULL); + max_rate, NULL); } if (min_channels < 0) { min_channels = 1; @@ -648,7 +648,7 @@ add_channels (GstStructure * structure, gint min_rate, gint max_rate, gst_structure_set (structure, "channels", G_TYPE_INT, min_channels, NULL); } else { gst_structure_set (structure, "channels", GST_TYPE_INT_RANGE, - min_channels, max_channels, NULL); + min_channels, max_channels, NULL); } } @@ -682,9 +682,9 @@ gst_alsa_caps (snd_pcm_format_t format, gint rate, gint channels) /* can be NULL, because not all alsa formats can be specified as caps */ if (temp != NULL) { - g_assert (gst_caps_get_size (temp) == 1); - add_channels (gst_caps_get_structure (temp, 0), rate, -1, channels, -1); - gst_caps_append (ret_caps, temp); + g_assert (gst_caps_get_size (temp) == 1); + add_channels (gst_caps_get_structure (temp, 0), rate, -1, channels, -1); + gst_caps_append (ret_caps, temp); } } } @@ -720,12 +720,12 @@ gst_alsa_get_caps (GstPad * pad) max_channels = -1; } else { ERROR_CHECK (snd_pcm_hw_params_get_channels_min (hw_params, &min_rate), - "Couldn't get minimum channel count for device %s: %s", this->device); + "Couldn't get minimum channel count for device %s: %s", this->device); ERROR_CHECK (snd_pcm_hw_params_get_channels_max (hw_params, &max_rate), - "Couldn't get maximum channel count for device %s: %s", this->device); + "Couldn't get maximum channel count for device %s: %s", this->device); min_channels = min_rate; max_channels = - max_rate > GST_ALSA_MAX_CHANNELS ? GST_ALSA_MAX_CHANNELS : max_rate; + max_rate > GST_ALSA_MAX_CHANNELS ? GST_ALSA_MAX_CHANNELS : max_rate; } ERROR_CHECK (snd_pcm_hw_params_get_rate_min (hw_params, &min_rate, &i), @@ -743,14 +743,14 @@ gst_alsa_get_caps (GstPad * pad) /* we can never use a format we can't set caps for */ if (caps != NULL) { - g_assert (gst_caps_get_size (caps) == 1); - add_channels (gst_caps_get_structure (caps, 0), min_rate, max_rate, - min_channels, max_channels); - if (ret) { - gst_caps_append (ret, caps); - } else { - ret = caps; - } + g_assert (gst_caps_get_size (caps) == 1); + add_channels (gst_caps_get_structure (caps, 0), min_rate, max_rate, + min_channels, max_channels); + if (ret) { + gst_caps_append (ret, caps); + } else { + ret = caps; + } } } } @@ -837,28 +837,28 @@ gst_alsa_link (GstPad * pad, const GstCaps * caps) for (i = 0; i < ((GstElement *) this)->numpads; i++) { g_assert (this->pad[i] != NULL); if (this->pad[i] == pad) - continue; + continue; if (gst_pad_try_set_caps (this->pad[i], caps) == GST_PAD_LINK_REFUSED) { - if (this->format) { - GstCaps *old = - gst_alsa_caps (this->format->format, this->format->rate, - this->format->channels); - - for (--i; i >= 0; i--) { - if (gst_pad_try_set_caps (this->pad[i], - old) == GST_PAD_LINK_REFUSED) { - GST_ELEMENT_ERROR (this, CORE, NEGOTIATION, (NULL), - ("could not reset caps to a sane value")); - gst_caps_free (old); - break; - } else { - /* FIXME: unset caps on pads somehow */ - } - } - gst_caps_free (old); - ret = GST_PAD_LINK_REFUSED; - goto out; - } + if (this->format) { + GstCaps *old = + gst_alsa_caps (this->format->format, this->format->rate, + this->format->channels); + + for (--i; i >= 0; i--) { + if (gst_pad_try_set_caps (this->pad[i], + old) == GST_PAD_LINK_REFUSED) { + GST_ELEMENT_ERROR (this, CORE, NEGOTIATION, (NULL), + ("could not reset caps to a sane value")); + gst_caps_free (old); + break; + } else { + /* FIXME: unset caps on pads somehow */ + } + } + gst_caps_free (old); + ret = GST_PAD_LINK_REFUSED; + goto out; + } } } @@ -897,53 +897,53 @@ gst_alsa_change_state (GstElement * element) switch (GST_STATE_TRANSITION (element)) { case GST_STATE_NULL_TO_READY: if (!(GST_FLAG_IS_SET (element, GST_ALSA_OPEN) || - gst_alsa_open_audio (this))) - return GST_STATE_FAILURE; + gst_alsa_open_audio (this))) + return GST_STATE_FAILURE; break; case GST_STATE_READY_TO_PAUSED: if (!(GST_FLAG_IS_SET (element, GST_ALSA_RUNNING) || - gst_alsa_start_audio (this))) - return GST_STATE_FAILURE; + gst_alsa_start_audio (this))) + return GST_STATE_FAILURE; this->transmitted = 0; break; case GST_STATE_PAUSED_TO_PLAYING: if (snd_pcm_state (this->handle) == SND_PCM_STATE_PAUSED) { - if ((err = snd_pcm_pause (this->handle, 0)) < 0) { - GST_ERROR_OBJECT (this, "Error unpausing sound: %s", - snd_strerror (err)); - return GST_STATE_FAILURE; - } + if ((err = snd_pcm_pause (this->handle, 0)) < 0) { + GST_ERROR_OBJECT (this, "Error unpausing sound: %s", + snd_strerror (err)); + return GST_STATE_FAILURE; + } } else if (!(GST_FLAG_IS_SET (element, GST_ALSA_RUNNING) || - gst_alsa_start_audio (this))) { - return GST_STATE_FAILURE; + gst_alsa_start_audio (this))) { + return GST_STATE_FAILURE; } gst_alsa_clock_start (this->clock); break; case GST_STATE_PLAYING_TO_PAUSED: if (GST_ALSA_CAPS_IS_SET (this, GST_ALSA_CAPS_PAUSE)) { - if (snd_pcm_state (this->handle) == SND_PCM_STATE_RUNNING) { - if ((err = snd_pcm_pause (this->handle, 1)) < 0) { - GST_ERROR_OBJECT (this, "Error pausing sound: %s", - snd_strerror (err)); - return GST_STATE_FAILURE; - } - } + if (snd_pcm_state (this->handle) == SND_PCM_STATE_RUNNING) { + if ((err = snd_pcm_pause (this->handle, 1)) < 0) { + GST_ERROR_OBJECT (this, "Error pausing sound: %s", + snd_strerror (err)); + return GST_STATE_FAILURE; + } + } } else { - /* if device doesn't know how to pause, we just stop */ - if (GST_FLAG_IS_SET (element, GST_ALSA_RUNNING)) - gst_alsa_stop_audio (this); + /* if device doesn't know how to pause, we just stop */ + if (GST_FLAG_IS_SET (element, GST_ALSA_RUNNING)) + gst_alsa_stop_audio (this); } gst_alsa_clock_stop (this->clock); break; case GST_STATE_PAUSED_TO_READY: if (GST_FLAG_IS_SET (element, GST_ALSA_RUNNING)) - gst_alsa_stop_audio (this); + gst_alsa_stop_audio (this); g_free (this->format); this->format = NULL; break; case GST_STATE_READY_TO_NULL: if (GST_FLAG_IS_SET (element, GST_ALSA_OPEN)) - gst_alsa_close_audio (this); + gst_alsa_close_audio (this); break; default: @@ -964,7 +964,7 @@ gst_alsa_get_clock (GstElement * element) static void gst_alsa_set_clock (GstElement * element, GstClock * clock) -{ /* we need this function just so everybody knows we use a clock */ +{ /* we need this function just so everybody knows we use a clock */ } /*** AUDIO PROCESSING *********************************************************/ @@ -979,7 +979,7 @@ gst_alsa_update_avail (GstAlsa * this) gst_alsa_xrun_recovery (this); } else { GST_WARNING_OBJECT (this, "unknown ALSA avail_update return value (%d)", - (int) avail); + (int) avail); } } return avail; @@ -994,18 +994,18 @@ gst_alsa_pcm_wait (GstAlsa * this) if (snd_pcm_state (this->handle) == SND_PCM_STATE_RUNNING) { if ((err = snd_pcm_wait (this->handle, 1000)) < 0) { if (err == EINTR) { - /* happens mostly when run under gdb, or when exiting due to a signal */ - GST_DEBUG ("got interrupted while waiting"); - if (gst_element_interrupt (GST_ELEMENT (this))) { - return TRUE; - } else { - return FALSE; - } + /* happens mostly when run under gdb, or when exiting due to a signal */ + GST_DEBUG ("got interrupted while waiting"); + if (gst_element_interrupt (GST_ELEMENT (this))) { + return TRUE; + } else { + return FALSE; + } } if (!gst_alsa_xrun_recovery (this)) { - GST_ERROR_OBJECT (this, "error waiting for alsa pcm: (%d: %s)", err, - snd_strerror (err)); - return FALSE; + GST_ERROR_OBJECT (this, "error waiting for alsa pcm: (%d: %s)", err, + snd_strerror (err)); + return FALSE; } } } @@ -1067,7 +1067,7 @@ gst_alsa_xrun_recovery (GstAlsa * this) snd_pcm_status_get_trigger_tstamp (status, &tstamp); timersub (&now, &tstamp, &diff); GST_INFO_OBJECT (this, "alsa: xrun of at least %.3f msecs", - diff.tv_sec * 1000 + diff.tv_usec / 1000.0); + diff.tv_sec * 1000 + diff.tv_usec / 1000.0); /* if we're allowed to recover, ... */ if (this->autorecover) { @@ -1075,17 +1075,17 @@ gst_alsa_xrun_recovery (GstAlsa * this) prevent further xruns (at the cost of increased latency and memory usage). */ if (this->period_count >= 4) { - this->period_size *= 2; - this->period_count /= 2; + this->period_size *= 2; + this->period_count /= 2; } else { - this->period_count *= 2; + this->period_count *= 2; } } } if (!(gst_alsa_stop_audio (this) && gst_alsa_start_audio (this))) { GST_ELEMENT_ERROR (this, RESOURCE, FAILED, (NULL), - ("Error restarting audio after xrun")); + ("Error restarting audio after xrun")); return FALSE; } @@ -1123,10 +1123,10 @@ gst_alsa_open_audio (GstAlsa * this) #endif if (snd_pcm_open (&this->handle, this->device, - GST_ALSA_GET_CLASS (this)->stream, SND_PCM_NONBLOCK) < 0) { + GST_ALSA_GET_CLASS (this)->stream, SND_PCM_NONBLOCK) < 0) { GST_ELEMENT_ERROR (GST_ELEMENT (this), RESOURCE, BUSY, - (_("Alsa device \"%s\" is already in use by another program."), - this->device), (NULL)); + (_("Alsa device \"%s\" is already in use by another program."), + this->device), (NULL)); return FALSE; } @@ -1157,7 +1157,7 @@ gst_alsa_probe_hw_params (GstAlsa * this, GstAlsaFormat * format) snd_pcm_hw_params_alloca (&hw_params); SIMPLE_ERROR_CHECK (snd_pcm_hw_params_any (this->handle, hw_params)); SIMPLE_ERROR_CHECK (snd_pcm_hw_params_set_periods_integer (this->handle, - hw_params)); + hw_params)); /* enable this for soundcard specific debugging */ /* snd_pcm_hw_params_dump (hw_params, this->out); */ @@ -1166,30 +1166,30 @@ gst_alsa_probe_hw_params (GstAlsa * this, GstAlsaFormat * format) snd_pcm_access_mask_none (mask); if (GST_ELEMENT (this)->numpads == 1) { snd_pcm_access_mask_set (mask, - this-> - mmap ? SND_PCM_ACCESS_MMAP_INTERLEAVED : SND_PCM_ACCESS_RW_INTERLEAVED); + this-> + mmap ? SND_PCM_ACCESS_MMAP_INTERLEAVED : SND_PCM_ACCESS_RW_INTERLEAVED); } else { snd_pcm_access_mask_set (mask, - this-> - mmap ? SND_PCM_ACCESS_MMAP_NONINTERLEAVED : - SND_PCM_ACCESS_RW_NONINTERLEAVED); + this-> + mmap ? SND_PCM_ACCESS_MMAP_NONINTERLEAVED : + SND_PCM_ACCESS_RW_NONINTERLEAVED); } SIMPLE_ERROR_CHECK (snd_pcm_hw_params_set_access_mask (this->handle, - hw_params, mask)); + hw_params, mask)); SIMPLE_ERROR_CHECK (snd_pcm_hw_params_set_format (this->handle, hw_params, - format->format)); + format->format)); SIMPLE_ERROR_CHECK (snd_pcm_hw_params_set_channels (this->handle, hw_params, - format->channels)); + format->channels)); SIMPLE_ERROR_CHECK (snd_pcm_hw_params_set_rate (this->handle, hw_params, - format->rate, 0)); + format->rate, 0)); period_count = this->period_count; SIMPLE_ERROR_CHECK (snd_pcm_hw_params_set_periods_near (this->handle, - hw_params, &period_count, 0)); + hw_params, &period_count, 0)); period_size = this->period_size; SIMPLE_ERROR_CHECK (snd_pcm_hw_params_set_period_size_near (this->handle, - hw_params, &period_size, 0)); + hw_params, &period_size, 0)); return TRUE; } @@ -1210,8 +1210,8 @@ gst_alsa_set_hw_params (GstAlsa * this) if (this->format) { GST_INFO ("Preparing format: %s %dHz, %d channels", - snd_pcm_format_name (this->format->format), this->format->rate, - this->format->channels); + snd_pcm_format_name (this->format->format), this->format->rate, + this->format->channels); } else { GST_INFO ("Preparing format: (none)"); } @@ -1229,35 +1229,35 @@ gst_alsa_set_hw_params (GstAlsa * this) snd_pcm_access_mask_none (mask); if (GST_ELEMENT (this)->numpads == 1) { snd_pcm_access_mask_set (mask, - this-> - mmap ? SND_PCM_ACCESS_MMAP_INTERLEAVED : SND_PCM_ACCESS_RW_INTERLEAVED); + this-> + mmap ? SND_PCM_ACCESS_MMAP_INTERLEAVED : SND_PCM_ACCESS_RW_INTERLEAVED); } else { snd_pcm_access_mask_set (mask, - this-> - mmap ? SND_PCM_ACCESS_MMAP_NONINTERLEAVED : - SND_PCM_ACCESS_RW_NONINTERLEAVED); + this-> + mmap ? SND_PCM_ACCESS_MMAP_NONINTERLEAVED : + SND_PCM_ACCESS_RW_NONINTERLEAVED); } ERROR_CHECK (snd_pcm_hw_params_set_access_mask (this->handle, hw_params, - mask), + mask), "The Gstreamer ALSA plugin does not support your hardware. Error: %s"); if (this->format) { ERROR_CHECK (snd_pcm_hw_params_set_format (this->handle, hw_params, - this->format->format), "Sample format (%s) not available: %s", - snd_pcm_format_name (this->format->format)); + this->format->format), "Sample format (%s) not available: %s", + snd_pcm_format_name (this->format->format)); ERROR_CHECK (snd_pcm_hw_params_set_channels (this->handle, hw_params, - this->format->channels), "Channels count (%d) not available: %s", - this->format->channels); + this->format->channels), "Channels count (%d) not available: %s", + this->format->channels); ERROR_CHECK (snd_pcm_hw_params_set_rate (this->handle, hw_params, - this->format->rate, 0), "error setting rate (%d): %s", - this->format->rate); + this->format->rate, 0), "error setting rate (%d): %s", + this->format->rate); } ERROR_CHECK (snd_pcm_hw_params_set_periods_near (this->handle, hw_params, - &this->period_count, 0), "error setting buffer size to %u: %s", + &this->period_count, 0), "error setting buffer size to %u: %s", (guint) this->period_count); ERROR_CHECK (snd_pcm_hw_params_set_period_size_near (this->handle, hw_params, - &this->period_size, 0), "error setting period size to %u frames: %s", + &this->period_size, 0), "error setting period size to %u frames: %s", (guint) this->period_size); ERROR_CHECK (snd_pcm_hw_params (this->handle, hw_params), @@ -1292,15 +1292,15 @@ gst_alsa_set_sw_params (GstAlsa * this) ERROR_CHECK (snd_pcm_sw_params_set_silence_size (this->handle, sw_params, 0), "could not set silence size: %s"); ERROR_CHECK (snd_pcm_sw_params_set_silence_threshold (this->handle, sw_params, - 0), "could not set silence threshold: %s"); + 0), "could not set silence threshold: %s"); ERROR_CHECK (snd_pcm_sw_params_set_avail_min (this->handle, sw_params, - this->period_size), "could not set avail min: %s"); + this->period_size), "could not set avail min: %s"); /* we start explicitly */ ERROR_CHECK (snd_pcm_sw_params_set_start_threshold (this->handle, sw_params, - this->period_size * this->period_count + 1), + this->period_size * this->period_count + 1), "could not set start mode: %s"); ERROR_CHECK (snd_pcm_sw_params_set_stop_threshold (this->handle, sw_params, - this->period_size * this->period_count), + this->period_size * this->period_count), "could not set stop mode: %s"); ERROR_CHECK (snd_pcm_sw_params_set_xfer_align (this->handle, sw_params, 1), "Unable to set transfer align for playback: %s"); @@ -1339,11 +1339,11 @@ gst_alsa_drain_audio (GstAlsa * this) case SND_PCM_STATE_PAUSED: /* snd_pcm_drain only works in blocking mode */ ERROR_CHECK (snd_pcm_nonblock (this->handle, 0), - "couldn't set blocking mode: %s"); + "couldn't set blocking mode: %s"); ERROR_CHECK (snd_pcm_drain (this->handle), - "couldn't stop and drain buffer: %s"); + "couldn't stop and drain buffer: %s"); ERROR_CHECK (snd_pcm_nonblock (this->handle, 1), - "couldn't set non-blocking mode: %s"); + "couldn't set non-blocking mode: %s"); break; default: break; @@ -1367,7 +1367,7 @@ gst_alsa_stop_audio (GstAlsa * this) /* fall through - clock is already stopped when paused */ case SND_PCM_STATE_PAUSED: ERROR_CHECK (snd_pcm_drop (this->handle), - "couldn't stop (dropping frames): %s"); + "couldn't stop (dropping frames): %s"); break; default: break; @@ -1438,46 +1438,46 @@ gst_alsa_convert (GstAlsa * this, GstFormat src_format, gint64 src_value, switch (src_format) { case GST_FORMAT_BYTES: switch (*dest_format) { - case GST_FORMAT_DEFAULT: - *dest_value = gst_alsa_bytes_to_samples (this, (guint) src_value); - break; - case GST_FORMAT_TIME: - *dest_value = gst_alsa_bytes_to_timestamp (this, (guint) src_value); - break; - default: - res = FALSE; - break; + case GST_FORMAT_DEFAULT: + *dest_value = gst_alsa_bytes_to_samples (this, (guint) src_value); + break; + case GST_FORMAT_TIME: + *dest_value = gst_alsa_bytes_to_timestamp (this, (guint) src_value); + break; + default: + res = FALSE; + break; } break; case GST_FORMAT_TIME: switch (*dest_format) { - case GST_FORMAT_DEFAULT: - *dest_value = - gst_alsa_timestamp_to_samples (this, (GstClockTime) src_value); - break; - case GST_FORMAT_BYTES: - *dest_value = - gst_alsa_timestamp_to_bytes (this, (GstClockTime) src_value); - break; - default: - res = FALSE; - break; + case GST_FORMAT_DEFAULT: + *dest_value = + gst_alsa_timestamp_to_samples (this, (GstClockTime) src_value); + break; + case GST_FORMAT_BYTES: + *dest_value = + gst_alsa_timestamp_to_bytes (this, (GstClockTime) src_value); + break; + default: + res = FALSE; + break; } break; case GST_FORMAT_DEFAULT: switch (*dest_format) { - case GST_FORMAT_TIME: - *dest_value = gst_alsa_samples_to_timestamp (this, (guint) src_value); - break; - case GST_FORMAT_BYTES: - *dest_value = gst_alsa_samples_to_bytes (this, (guint) src_value); - break; - case GST_FORMAT_DEFAULT: - g_assert_not_reached (); - /* fall through */ - default: - res = FALSE; - break; + case GST_FORMAT_TIME: + *dest_value = gst_alsa_samples_to_timestamp (this, (guint) src_value); + break; + case GST_FORMAT_BYTES: + *dest_value = gst_alsa_samples_to_bytes (this, (guint) src_value); + break; + case GST_FORMAT_DEFAULT: + g_assert_not_reached (); + /* fall through */ + default: + res = FALSE; + break; } break; default: @@ -1511,16 +1511,16 @@ gst_alsa_query_func (GstElement * element, GstQueryType type, snd_pcm_sframes_t delay; ERROR_CHECK (snd_pcm_delay (this->handle, &delay), - "Error getting delay: %s"); + "Error getting delay: %s"); res = - gst_alsa_convert (this, GST_FORMAT_DEFAULT, (gint64) delay, format, - value); + gst_alsa_convert (this, GST_FORMAT_DEFAULT, (gint64) delay, format, + value); break; } case GST_QUERY_POSITION: res = - gst_alsa_convert (this, GST_FORMAT_TIME, - gst_element_get_time (GST_ELEMENT (this)), format, value); + gst_alsa_convert (this, GST_FORMAT_TIME, + gst_element_get_time (GST_ELEMENT (this)), format, value); break; default: break; @@ -1554,7 +1554,7 @@ inline snd_pcm_uframes_t gst_alsa_timestamp_to_samples (GstAlsa * this, GstClockTime time) { return (snd_pcm_uframes_t) ((time * this->format->rate + - this->format->rate / 2) / GST_SECOND); + this->format->rate / 2) / GST_SECOND); } inline GstClockTime @@ -1581,12 +1581,12 @@ inline GstClockTime gst_alsa_bytes_to_timestamp (GstAlsa * this, guint bytes) { return gst_alsa_samples_to_timestamp (this, gst_alsa_bytes_to_samples (this, - bytes)); + bytes)); } inline guint gst_alsa_timestamp_to_bytes (GstAlsa * this, GstClockTime time) { return gst_alsa_samples_to_bytes (this, gst_alsa_timestamp_to_samples (this, - time)); + time)); } diff --git a/ext/alsa/gstalsaclock.c b/ext/alsa/gstalsaclock.c index 065f9f941d..0651b3c890 100644 --- a/ext/alsa/gstalsaclock.c +++ b/ext/alsa/gstalsaclock.c @@ -57,8 +57,9 @@ gst_alsa_clock_get_type (void) (GInstanceInitFunc) gst_alsa_clock_init, NULL }; + clock_type = g_type_register_static (GST_TYPE_CLOCK, "GstAlsaClock", - &clock_info, 0); + &clock_info, 0); } return clock_type; } @@ -116,7 +117,7 @@ gst_alsa_clock_start (GstAlsaClock * clock) if (clock->owner->format) { clock->start_time = gst_clock_get_event_time (GST_CLOCK (clock)) - - clock->get_time (clock->owner); + - clock->get_time (clock->owner); } else { clock->start_time = gst_clock_get_event_time (GST_CLOCK (clock)); } @@ -177,8 +178,8 @@ gst_alsa_clock_wait (GstClock * clock, GstClockEntry * entry) if (diff > clock->max_diff) { GST_INFO_OBJECT (this, - "GstAlsaClock: abnormal clock request diff: %" G_GINT64_FORMAT ") >" - " %" G_GINT64_FORMAT, diff, clock->max_diff); + "GstAlsaClock: abnormal clock request diff: %" G_GINT64_FORMAT ") >" + " %" G_GINT64_FORMAT, diff, clock->max_diff); return GST_CLOCK_ENTRY_EARLY; } @@ -192,7 +193,7 @@ gst_alsa_clock_wait (GstClock * clock, GstClockEntry * entry) while (gst_alsa_clock_get_internal_time (clock) < target && this->last_unlock < entry_time) { g_usleep (gst_alsa_clock_get_resolution (clock) * G_USEC_PER_SEC / - GST_SECOND); + GST_SECOND); } return entry->status; diff --git a/ext/alsa/gstalsamixer.c b/ext/alsa/gstalsamixer.c index 9d9f5b26b9..e2912f25bc 100644 --- a/ext/alsa/gstalsamixer.c +++ b/ext/alsa/gstalsamixer.c @@ -90,13 +90,13 @@ gst_alsa_mixer_get_type (void) }; alsa_mixer_type = - g_type_register_static (GST_TYPE_ALSA, "GstAlsaMixer", &alsa_mixer_info, - 0); + g_type_register_static (GST_TYPE_ALSA, "GstAlsaMixer", &alsa_mixer_info, + 0); g_type_add_interface_static (alsa_mixer_type, GST_TYPE_IMPLEMENTS_INTERFACE, - &alsa_iface_info); + &alsa_iface_info); g_type_add_interface_static (alsa_mixer_type, GST_TYPE_MIXER, - &alsa_mixer_iface_info); + &alsa_mixer_iface_info); } return alsa_mixer_type; @@ -145,7 +145,7 @@ gst_alsa_mixer_open (GstAlsaMixer * mixer) if ((err = snd_mixer_attach (mixer->mixer_handle, alsa->device)) < 0) { GST_ERROR_OBJECT (GST_OBJECT (mixer), - "Cannot attach mixer to sound device `%s'.", alsa->device); + "Cannot attach mixer to sound device `%s'.", alsa->device); goto error; } @@ -242,13 +242,13 @@ gst_alsa_mixer_build_list (GstAlsaMixer * mixer) /* find out if this element can be an input */ if (snd_mixer_selem_has_capture_channel (element, 0) || - snd_mixer_selem_has_capture_switch (element) || - snd_mixer_selem_is_capture_mono (element)) { + snd_mixer_selem_has_capture_switch (element) || + snd_mixer_selem_is_capture_mono (element)) { while (snd_mixer_selem_has_capture_channel (element, channels)) - channels++; + channels++; track = gst_alsa_mixer_track_new - (element, i, channels, GST_MIXER_TRACK_INPUT); + (element, i, channels, GST_MIXER_TRACK_INPUT); mixer->tracklist = g_list_append (mixer->tracklist, track); } @@ -257,13 +257,13 @@ gst_alsa_mixer_build_list (GstAlsaMixer * mixer) channels = 0; if (snd_mixer_selem_has_playback_channel (element, 0) || - snd_mixer_selem_has_playback_switch (element) || - snd_mixer_selem_is_playback_mono (element)) { + snd_mixer_selem_has_playback_switch (element) || + snd_mixer_selem_is_playback_mono (element)) { while (snd_mixer_selem_has_playback_channel (element, channels)) - channels++; + channels++; track = gst_alsa_mixer_track_new - (element, i, channels, GST_MIXER_TRACK_OUTPUT); + (element, i, channels, GST_MIXER_TRACK_OUTPUT); mixer->tracklist = g_list_append (mixer->tracklist, track); } @@ -294,7 +294,7 @@ gst_alsa_mixer_change_state (GstElement * element) switch (GST_STATE_TRANSITION (element)) { case GST_STATE_NULL_TO_READY: if (!gst_alsa_mixer_open (this)) - return GST_STATE_FAILURE; + return GST_STATE_FAILURE; gst_alsa_mixer_build_list (this); break; case GST_STATE_READY_TO_NULL: @@ -341,11 +341,11 @@ gst_alsa_mixer_get_volume (GstMixer * mixer, long tmp; if (snd_mixer_selem_has_playback_channel (alsa_track->element, i)) { - snd_mixer_selem_get_playback_volume (alsa_track->element, i, &tmp); - volumes[i] = (gint) tmp; + snd_mixer_selem_get_playback_volume (alsa_track->element, i, &tmp); + volumes[i] = (gint) tmp; } else if (snd_mixer_selem_has_capture_channel (alsa_track->element, i)) { - snd_mixer_selem_get_capture_volume (alsa_track->element, i, &tmp); - volumes[i] = (gint) tmp; + snd_mixer_selem_get_capture_volume (alsa_track->element, i, &tmp); + volumes[i] = (gint) tmp; } } } @@ -365,11 +365,11 @@ gst_alsa_mixer_set_volume (GstMixer * mixer, if (!(track->flags & GST_MIXER_TRACK_MUTE)) { for (i = 0; i < track->num_channels; i++) { if (snd_mixer_selem_has_playback_channel (alsa_track->element, i)) - snd_mixer_selem_set_playback_volume (alsa_track->element, i, - (long) volumes[i]); + snd_mixer_selem_set_playback_volume (alsa_track->element, i, + (long) volumes[i]); else if (snd_mixer_selem_has_capture_channel (alsa_track->element, i)) - snd_mixer_selem_set_capture_volume (alsa_track->element, i, - (long) volumes[i]); + snd_mixer_selem_set_capture_volume (alsa_track->element, i, + (long) volumes[i]); } } @@ -391,20 +391,20 @@ gst_alsa_mixer_set_mute (GstMixer * mixer, GstMixerTrack * track, gboolean mute) for (i = 0; i < track->num_channels; i++) { if (snd_mixer_selem_has_capture_channel (alsa_track->element, i)) - snd_mixer_selem_set_capture_volume (alsa_track->element, i, 0); + snd_mixer_selem_set_capture_volume (alsa_track->element, i, 0); else if (snd_mixer_selem_has_playback_channel (alsa_track->element, i)) - snd_mixer_selem_set_playback_volume (alsa_track->element, i, 0); + snd_mixer_selem_set_playback_volume (alsa_track->element, i, 0); } } else { track->flags &= ~GST_MIXER_TRACK_MUTE; for (i = 0; i < track->num_channels; i++) { if (snd_mixer_selem_has_capture_channel (alsa_track->element, i)) - snd_mixer_selem_set_capture_volume (alsa_track->element, i, - alsa_track->volumes[i]); + snd_mixer_selem_set_capture_volume (alsa_track->element, i, + alsa_track->volumes[i]); else if (snd_mixer_selem_has_playback_channel (alsa_track->element, i)) - snd_mixer_selem_set_playback_volume (alsa_track->element, i, - alsa_track->volumes[i]); + snd_mixer_selem_set_playback_volume (alsa_track->element, i, + alsa_track->volumes[i]); } } } diff --git a/ext/alsa/gstalsamixertrack.c b/ext/alsa/gstalsamixertrack.c index 84f075ec45..df3d2f1112 100644 --- a/ext/alsa/gstalsamixertrack.c +++ b/ext/alsa/gstalsamixertrack.c @@ -48,8 +48,8 @@ gst_alsa_mixer_track_get_type (void) }; track_type = - g_type_register_static (GST_TYPE_MIXER_TRACK, "GstAlsaMixerTrack", - &track_info, 0); + g_type_register_static (GST_TYPE_MIXER_TRACK, "GstAlsaMixerTrack", + &track_info, 0); } return track_type; diff --git a/ext/alsa/gstalsaplugin.c b/ext/alsa/gstalsaplugin.c index e57cd43377..ff07e2c92f 100644 --- a/ext/alsa/gstalsaplugin.c +++ b/ext/alsa/gstalsaplugin.c @@ -35,13 +35,13 @@ plugin_init (GstPlugin * plugin) GST_DEBUG_CATEGORY_INIT (alsa_debug, "alsa", 0, "alsa plugins"); if (!gst_element_register (plugin, "alsamixer", GST_RANK_NONE, - GST_TYPE_ALSA_MIXER)) + GST_TYPE_ALSA_MIXER)) return FALSE; if (!gst_element_register (plugin, "alsasrc", GST_RANK_NONE, - GST_TYPE_ALSA_SRC)) + GST_TYPE_ALSA_SRC)) return FALSE; if (!gst_element_register (plugin, "alsasink", GST_RANK_NONE, - GST_TYPE_ALSA_SINK)) + GST_TYPE_ALSA_SINK)) return FALSE; return TRUE; diff --git a/ext/alsa/gstalsasink.c b/ext/alsa/gstalsasink.c index f4c90b9e09..2fd4e572f5 100644 --- a/ext/alsa/gstalsasink.c +++ b/ext/alsa/gstalsasink.c @@ -59,7 +59,7 @@ gst_alsa_sink_pad_factory (void) if (!template) template = gst_pad_template_new ("sink", GST_PAD_SINK, GST_PAD_ALWAYS, - gst_alsa_caps (SND_PCM_FORMAT_UNKNOWN, -1, -1)); + gst_alsa_caps (SND_PCM_FORMAT_UNKNOWN, -1, -1)); return template; } @@ -70,8 +70,8 @@ gst_alsa_sink_request_pad_factory (void) if (!template) template = - gst_pad_template_new ("sink%d", GST_PAD_SINK, GST_PAD_REQUEST, - gst_alsa_caps (SND_PCM_FORMAT_UNKNOWN, -1, 1)); + gst_pad_template_new ("sink%d", GST_PAD_SINK, GST_PAD_REQUEST, + gst_alsa_caps (SND_PCM_FORMAT_UNKNOWN, -1, 1)); return template; } @@ -95,8 +95,8 @@ gst_alsa_sink_get_type (void) }; alsa_sink_type = - g_type_register_static (GST_TYPE_ALSA, "GstAlsaSink", &alsa_sink_info, - 0); + g_type_register_static (GST_TYPE_ALSA, "GstAlsaSink", &alsa_sink_info, + 0); } return alsa_sink_type; } @@ -163,7 +163,7 @@ gst_alsa_sink_flush_one_pad (GstAlsaSink * sink, gint i) switch (sink->behaviour[i]) { case 0: if (sink->buf[i]) - gst_data_unref (GST_DATA (sink->buf[i])); + gst_data_unref (GST_DATA (sink->buf[i])); sink->buf[i] = NULL; sink->data[i] = NULL; sink->behaviour[i] = 0; @@ -202,42 +202,42 @@ gst_alsa_sink_check_event (GstAlsaSink * sink, gint pad_nr) if (event) { switch (GST_EVENT_TYPE (event)) { case GST_EVENT_EOS: - gst_alsa_set_eos (this); - cont = FALSE; - break; + gst_alsa_set_eos (this); + cont = FALSE; + break; case GST_EVENT_INTERRUPT: - cont = FALSE; - break; + cont = FALSE; + break; case GST_EVENT_DISCONTINUOUS: { - GstClockTime value; - - /* only the first pad my seek */ - if (pad_nr != 0) { - break; - } - if (gst_event_discont_get_value (event, GST_FORMAT_TIME, &value)) { - gst_element_set_time (GST_ELEMENT (this), value); - } else if (gst_event_discont_get_value (event, GST_FORMAT_DEFAULT, - &value)) { - value = gst_alsa_samples_to_timestamp (this, value); - gst_element_set_time (GST_ELEMENT (this), value); - } else if (gst_event_discont_get_value (event, GST_FORMAT_BYTES, - &value)) { - value = gst_alsa_bytes_to_timestamp (this, value); - gst_element_set_time (GST_ELEMENT (this), value); - } else { - GST_ERROR_OBJECT (this, - "couldn't extract time from discont event. Bad things might happen!"); - } - - - break; + GstClockTime value; + + /* only the first pad my seek */ + if (pad_nr != 0) { + break; + } + if (gst_event_discont_get_value (event, GST_FORMAT_TIME, &value)) { + gst_element_set_time (GST_ELEMENT (this), value); + } else if (gst_event_discont_get_value (event, GST_FORMAT_DEFAULT, + &value)) { + value = gst_alsa_samples_to_timestamp (this, value); + gst_element_set_time (GST_ELEMENT (this), value); + } else if (gst_event_discont_get_value (event, GST_FORMAT_BYTES, + &value)) { + value = gst_alsa_bytes_to_timestamp (this, value); + gst_element_set_time (GST_ELEMENT (this), value); + } else { + GST_ERROR_OBJECT (this, + "couldn't extract time from discont event. Bad things might happen!"); + } + + + break; } default: - GST_INFO_OBJECT (this, "got an unknown event (Type: %d)", - GST_EVENT_TYPE (event)); - break; + GST_INFO_OBJECT (this, "got an unknown event (Type: %d)", + GST_EVENT_TYPE (event)); + break; } gst_event_unref (event); sink->buf[pad_nr] = NULL; @@ -281,8 +281,8 @@ gst_alsa_sink_mmap (GstAlsa * this, snd_pcm_sframes_t * avail) } if ((err = - snd_pcm_areas_copy (dst, offset, src, 0, this->format->channels, - *avail, this->format->format)) < 0) { + snd_pcm_areas_copy (dst, offset, src, 0, this->format->channels, + *avail, this->format->format)) < 0) { snd_pcm_mmap_commit (this->handle, offset, 0); GST_ERROR_OBJECT (this, "data copy failed: %s", snd_strerror (err)); return -1; @@ -327,7 +327,7 @@ gst_alsa_sink_loop (GstElement * element) snd_pcm_sframes_t avail, avail2, copied, sample_diff, max_discont; snd_pcm_uframes_t samplestamp, time_sample; gint i; - guint bytes; /* per channel */ + guint bytes; /* per channel */ GstAlsa *this = GST_ALSA (element); GstAlsaSink *sink = GST_ALSA_SINK (element); @@ -349,87 +349,87 @@ sink_restart: /* check how many bytes we still have in all our bytestreams */ /* initialize this value to a somewhat sane state, we might alloc this much data below (which would be a bug, but who knows)... */ - bytes = this->period_size * this->period_count * element->numpads * 8; /* must be > max sample size in bytes */ + bytes = this->period_size * this->period_count * element->numpads * 8; /* must be > max sample size in bytes */ for (i = 0; i < element->numpads; i++) { g_assert (this->pad[i] != NULL); while (sink->size[i] == 0) { - if (!sink->buf[i]) - sink->buf[i] = GST_BUFFER (gst_pad_pull (this->pad[i])); - if (GST_IS_EVENT (sink->buf[i])) { - if (gst_alsa_sink_check_event (sink, i)) - continue; - return; - } - /* caps nego failed somewhere */ - if (this->format == NULL) { - GST_ELEMENT_ERROR (this, CORE, NEGOTIATION, (NULL), - ("ALSA format not negotiated")); - } - samplestamp = - gst_alsa_timestamp_to_samples (this, - GST_BUFFER_TIMESTAMP (sink->buf[i])); - max_discont = gst_alsa_timestamp_to_samples (this, this->max_discont); - time_sample = - gst_alsa_timestamp_to_samples (this, - gst_element_get_time (GST_ELEMENT (this))); - snd_pcm_delay (this->handle, &sample_diff); - /* actual diff = buffer samplestamp - played - to_play */ - sample_diff = samplestamp - time_sample - sample_diff; - - if ((!GST_BUFFER_TIMESTAMP_IS_VALID (sink->buf[i])) || - (-max_discont <= sample_diff && sample_diff <= max_discont)) { - - /* difference between expected and current is < GST_ALSA_DEVIATION */ - no_difference: - sink->size[i] = sink->buf[i]->size; - sink->data[i] = sink->buf[i]->data; - sink->behaviour[i] = 0; - } else if (sample_diff > 0) { - /* there are empty samples in front of us, fill them with silence */ - int samples = MIN (bytes, sample_diff) * - (element->numpads == 1 ? this->format->channels : 1); - int size = - samples * snd_pcm_format_physical_width (this->format->format) / - 8; - GST_INFO_OBJECT (this, - "Allocating %d bytes (%ld samples) now to resync: sample %ld expected, but got %ld", - size, MIN (bytes, sample_diff), time_sample, samplestamp); - sink->data[i] = g_try_malloc (size); - if (!sink->data[i]) { - GST_WARNING_OBJECT (this, - "error allocating %d bytes, buffers unsynced now.", size); - goto no_difference; - } - sink->size[i] = size; - if (0 != snd_pcm_format_set_silence (this->format->format, - sink->data[i], samples)) { - GST_WARNING_OBJECT (this, - "error silencing buffer, enjoy the noise."); - } - sink->behaviour[i] = 1; - } else if (gst_alsa_samples_to_bytes (this, - -sample_diff) >= sink->buf[i]->size) { - GST_INFO_OBJECT (this, - "Skipping %lu samples to resync (complete buffer): sample %ld expected, but got %ld", - gst_alsa_bytes_to_samples (this, sink->buf[i]->size), time_sample, - samplestamp); - /* this buffer is way behind */ - gst_buffer_unref (sink->buf[i]); - sink->buf[i] = NULL; - continue; - } else if (sample_diff < 0) { - gint difference = gst_alsa_samples_to_bytes (this, -samplestamp); - - GST_INFO_OBJECT (this, - "Skipping %lu samples to resync: sample %ld expected, but got %ld", - (gulong) - sample_diff, time_sample, samplestamp); - /* this buffer is only a bit behind */ - sink->size[i] = sink->buf[i]->size - difference; - sink->data[i] = sink->buf[i]->data + difference; - sink->behaviour[i] = 0; - } else { - g_assert_not_reached (); - } + if (!sink->buf[i]) + sink->buf[i] = GST_BUFFER (gst_pad_pull (this->pad[i])); + if (GST_IS_EVENT (sink->buf[i])) { + if (gst_alsa_sink_check_event (sink, i)) + continue; + return; + } + /* caps nego failed somewhere */ + if (this->format == NULL) { + GST_ELEMENT_ERROR (this, CORE, NEGOTIATION, (NULL), + ("ALSA format not negotiated")); + } + samplestamp = + gst_alsa_timestamp_to_samples (this, + GST_BUFFER_TIMESTAMP (sink->buf[i])); + max_discont = gst_alsa_timestamp_to_samples (this, this->max_discont); + time_sample = + gst_alsa_timestamp_to_samples (this, + gst_element_get_time (GST_ELEMENT (this))); + snd_pcm_delay (this->handle, &sample_diff); + /* actual diff = buffer samplestamp - played - to_play */ + sample_diff = samplestamp - time_sample - sample_diff; + + if ((!GST_BUFFER_TIMESTAMP_IS_VALID (sink->buf[i])) || + (-max_discont <= sample_diff && sample_diff <= max_discont)) { + + /* difference between expected and current is < GST_ALSA_DEVIATION */ + no_difference: + sink->size[i] = sink->buf[i]->size; + sink->data[i] = sink->buf[i]->data; + sink->behaviour[i] = 0; + } else if (sample_diff > 0) { + /* there are empty samples in front of us, fill them with silence */ + int samples = MIN (bytes, sample_diff) * + (element->numpads == 1 ? this->format->channels : 1); + int size = + samples * snd_pcm_format_physical_width (this->format->format) / + 8; + GST_INFO_OBJECT (this, + "Allocating %d bytes (%ld samples) now to resync: sample %ld expected, but got %ld", + size, MIN (bytes, sample_diff), time_sample, samplestamp); + sink->data[i] = g_try_malloc (size); + if (!sink->data[i]) { + GST_WARNING_OBJECT (this, + "error allocating %d bytes, buffers unsynced now.", size); + goto no_difference; + } + sink->size[i] = size; + if (0 != snd_pcm_format_set_silence (this->format->format, + sink->data[i], samples)) { + GST_WARNING_OBJECT (this, + "error silencing buffer, enjoy the noise."); + } + sink->behaviour[i] = 1; + } else if (gst_alsa_samples_to_bytes (this, + -sample_diff) >= sink->buf[i]->size) { + GST_INFO_OBJECT (this, + "Skipping %lu samples to resync (complete buffer): sample %ld expected, but got %ld", + gst_alsa_bytes_to_samples (this, sink->buf[i]->size), time_sample, + samplestamp); + /* this buffer is way behind */ + gst_buffer_unref (sink->buf[i]); + sink->buf[i] = NULL; + continue; + } else if (sample_diff < 0) { + gint difference = gst_alsa_samples_to_bytes (this, -samplestamp); + + GST_INFO_OBJECT (this, + "Skipping %lu samples to resync: sample %ld expected, but got %ld", + (gulong) - sample_diff, time_sample, samplestamp); + /* this buffer is only a bit behind */ + sink->size[i] = sink->buf[i]->size - difference; + sink->data[i] = sink->buf[i]->data + difference; + sink->behaviour[i] = 0; + } else { + g_assert_not_reached (); + } } bytes = MIN (bytes, sink->size[i]); } @@ -438,17 +438,17 @@ sink_restart: /* wait until the hw buffer has enough space */ while (gst_element_get_state (element) == GST_STATE_PLAYING - && (avail2 = gst_alsa_update_avail (this)) < avail) { + && (avail2 = gst_alsa_update_avail (this)) < avail) { if (avail2 <= -EPIPE) - goto sink_restart; + goto sink_restart; if (avail2 < 0) - return; + return; if (avail2 < avail - && snd_pcm_state (this->handle) != SND_PCM_STATE_RUNNING) - if (!gst_alsa_start (this)) - return; + && snd_pcm_state (this->handle) != SND_PCM_STATE_RUNNING) + if (!gst_alsa_start (this)) + return; if (gst_alsa_pcm_wait (this) == FALSE) - return; + return; } /* FIXME: lotsa stuff can have happened while fetching data. Do we need to check something? */ @@ -462,12 +462,12 @@ sink_restart: bytes = gst_alsa_samples_to_bytes (this, copied); for (i = 0; i < element->numpads; i++) { if ((sink->size[i] -= bytes) == 0) { - gst_alsa_sink_flush_one_pad (sink, i); - continue; + gst_alsa_sink_flush_one_pad (sink, i); + continue; } g_assert (sink->size[i] > 0); if (sink->behaviour[i] != 1) - sink->data[i] += bytes; + sink->data[i] += bytes; } } @@ -514,7 +514,7 @@ gst_alsa_sink_get_time (GstAlsa * this) if (snd_pcm_delay (this->handle, &delay) == 0 && this->format) { return GST_SECOND * (GstClockTime) (this->transmitted > - delay ? this->transmitted - delay : 0) / this->format->rate; + delay ? this->transmitted - delay : 0) / this->format->rate; } else { return 0; } diff --git a/ext/alsa/gstalsasrc.c b/ext/alsa/gstalsasrc.c index 7085749972..1913715468 100644 --- a/ext/alsa/gstalsasrc.c +++ b/ext/alsa/gstalsasrc.c @@ -55,7 +55,7 @@ gst_alsa_src_pad_factory (void) if (!template) template = gst_pad_template_new ("src", GST_PAD_SRC, GST_PAD_ALWAYS, - gst_alsa_caps (SND_PCM_FORMAT_UNKNOWN, -1, -1)); + gst_alsa_caps (SND_PCM_FORMAT_UNKNOWN, -1, -1)); return template; } @@ -79,7 +79,7 @@ gst_alsa_src_get_type (void) }; alsa_src_type = - g_type_register_static (GST_TYPE_ALSA, "GstAlsaSrc", &alsa_src_info, 0); + g_type_register_static (GST_TYPE_ALSA, "GstAlsaSrc", &alsa_src_info, 0); } return alsa_src_type; } @@ -169,8 +169,8 @@ gst_alsa_src_mmap (GstAlsa * this, snd_pcm_sframes_t * avail) } if (*avail > 0 && (err = - snd_pcm_areas_copy (dst, 0, src, offset, this->format->channels, - *avail, this->format->format)) < 0) { + snd_pcm_areas_copy (dst, 0, src, offset, this->format->channels, + *avail, this->format->format)) < 0) { snd_pcm_mmap_commit (this->handle, offset, 0); GST_ERROR_OBJECT (this, "data copy failed: %s", snd_strerror (err)); return -1; @@ -243,10 +243,10 @@ gst_alsa_src_set_caps (GstAlsaSrc * src, gboolean aggressive) /* now intersect this with all caps of the peers... */ for (i = 0; i < GST_ELEMENT (src)->numpads; i++) { all_caps = - gst_caps_intersect (all_caps, gst_pad_get_allowed_caps (this->pad[i])); + gst_caps_intersect (all_caps, gst_pad_get_allowed_caps (this->pad[i])); if (all_caps == NULL) { GST_DEBUG ("No compatible caps found in alsasrc (%s)", - GST_ELEMENT_NAME (this)); + GST_ELEMENT_NAME (this)); return FALSE; } } @@ -260,8 +260,8 @@ gst_alsa_src_set_caps (GstAlsaSrc * src, gboolean aggressive) for (i = 0; i < gst_caps_get_size (all_caps); i++) { walk = gst_caps_get_structure (all_caps, i); if (!(gst_structure_get_int (walk, "signed", &sign) && - gst_structure_get_int (walk, "width", &width) && - gst_structure_get_int (walk, "depth", &depth))) { + gst_structure_get_int (walk, "width", &width) && + gst_structure_get_int (walk, "depth", &depth))) { GST_ERROR_OBJECT (src, "couldn't parse my own format. Huh?"); continue; } @@ -269,37 +269,37 @@ gst_alsa_src_set_caps (GstAlsaSrc * src, gboolean aggressive) endian = G_BYTE_ORDER; } gst_structure_set (structure, - "endianness", G_TYPE_INT, endian, - "width", G_TYPE_INT, width, - "depth", G_TYPE_INT, depth, "signed", G_TYPE_BOOLEAN, sign, NULL); + "endianness", G_TYPE_INT, endian, + "width", G_TYPE_INT, width, + "depth", G_TYPE_INT, depth, "signed", G_TYPE_BOOLEAN, sign, NULL); min_rate = - gst_value_get_int_range_min (gst_structure_get_value (walk, "rate")); + gst_value_get_int_range_min (gst_structure_get_value (walk, "rate")); max_rate = - gst_value_get_int_range_max (gst_structure_get_value (walk, "rate")); + gst_value_get_int_range_max (gst_structure_get_value (walk, "rate")); min_channels = - gst_value_get_int_range_min (gst_structure_get_value (walk, - "channels")); + gst_value_get_int_range_min (gst_structure_get_value (walk, + "channels")); max_channels = - gst_value_get_int_range_max (gst_structure_get_value (walk, - "channels")); + gst_value_get_int_range_max (gst_structure_get_value (walk, + "channels")); for (rate = max_rate;; rate--) { if ((rate = gst_alsa_src_adjust_rate (rate, aggressive)) < min_rate) - break; + break; gst_structure_set (structure, "rate", G_TYPE_INT, rate, NULL); for (channels = aggressive ? max_channels : MIN (max_channels, 2); - channels >= min_channels; channels--) { - gst_structure_set (structure, "channels", G_TYPE_INT, channels, NULL); - GST_DEBUG - ("trying new caps: %ssigned, endianness: %d, width %d, depth %d, channels %d, rate %d", - sign ? "" : "un", endian, width, depth, channels, rate); - if (gst_pad_try_set_caps (this->pad[0], caps) != GST_PAD_LINK_REFUSED) - gst_alsa_link (this->pad[0], caps); - - if (this->format) { - /* try to set caps here */ - return TRUE; - } + channels >= min_channels; channels--) { + gst_structure_set (structure, "channels", G_TYPE_INT, channels, NULL); + GST_DEBUG + ("trying new caps: %ssigned, endianness: %d, width %d, depth %d, channels %d, rate %d", + sign ? "" : "un", endian, width, depth, channels, rate); + if (gst_pad_try_set_caps (this->pad[0], caps) != GST_PAD_LINK_REFUSED) + gst_alsa_link (this->pad[0], caps); + + if (this->format) { + /* try to set caps here */ + return TRUE; + } } } } @@ -323,7 +323,7 @@ gst_alsa_src_loop (GstElement * element) if (!this->format) { if (!gst_alsa_src_set_caps (src, FALSE)) { GST_ELEMENT_ERROR (element, CORE, NEGOTIATION, (NULL), - ("ALSA format not negotiated")); + ("ALSA format not negotiated")); return; } } @@ -335,7 +335,7 @@ gst_alsa_src_loop (GstElement * element) return; if (snd_pcm_state (this->handle) != SND_PCM_STATE_RUNNING) { if (!gst_alsa_start (this)) - return; + return; continue; }; /* wait */ @@ -359,9 +359,9 @@ gst_alsa_src_loop (GstElement * element) if (copied != this->period_size) GST_BUFFER_SIZE (src->buf[i]) = gst_alsa_samples_to_bytes (this, copied); GST_BUFFER_TIMESTAMP (src->buf[i]) = - gst_alsa_samples_to_timestamp (this, this->transmitted); + gst_alsa_samples_to_timestamp (this, this->transmitted); GST_BUFFER_DURATION (src->buf[i]) = - gst_alsa_samples_to_timestamp (this, copied); + gst_alsa_samples_to_timestamp (this, copied); gst_pad_push (this->pad[i], GST_DATA (src->buf[i])); src->buf[i] = NULL; } diff --git a/ext/cdparanoia/gstcdparanoia.c b/ext/cdparanoia/gstcdparanoia.c index 67160b93e3..d75ff57862 100644 --- a/ext/cdparanoia/gstcdparanoia.c +++ b/ext/cdparanoia/gstcdparanoia.c @@ -38,9 +38,9 @@ #include "gst/gst-i18n-plugin.h" /* taken from linux/cdrom.h */ -#define CD_MSF_OFFSET 150 /* MSF numbering offset of first frame */ -#define CD_SECS 60 /* seconds per minute */ -#define CD_FRAMES 75 /* frames per second */ +#define CD_MSF_OFFSET 150 /* MSF numbering offset of first frame */ +#define CD_SECS 60 /* seconds per minute */ +#define CD_FRAMES 75 /* frames per second */ #include "gstcdparanoia.h" @@ -57,13 +57,13 @@ 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) 44100, " - "channels = (int) 2, " - "chunksize = (int) " G_STRINGIFY (CD_FRAMESIZE_RAW) + "endianness = (int) BYTE_ORDER, " + "signed = (boolean) true, " + "width = (int) 16, " + "depth = (int) 16, " + "rate = (int) 44100, " + "channels = (int) 2, " + "chunksize = (int) " G_STRINGIFY (CD_FRAMESIZE_RAW) ) ); @@ -83,7 +83,7 @@ gst_paranoia_mode_get_type (void) if (!paranoia_mode_type) { paranoia_mode_type = - g_enum_register_static ("GstParanoiaMode", paranoia_modes); + g_enum_register_static ("GstParanoiaMode", paranoia_modes); } return paranoia_mode_type; } @@ -101,7 +101,7 @@ gst_paranoia_endian_get_type (void) if (!paranoia_endian_type) { paranoia_endian_type = - g_enum_register_static ("GstParanoiaEndian", paranoia_endians); + g_enum_register_static ("GstParanoiaEndian", paranoia_endians); } return paranoia_endian_type; } @@ -185,8 +185,8 @@ cdparanoia_get_type (void) }; cdparanoia_type = - g_type_register_static (GST_TYPE_ELEMENT, "CDParanoia", - &cdparanoia_info, 0); + g_type_register_static (GST_TYPE_ELEMENT, "CDParanoia", + &cdparanoia_info, 0); /* Register the track format */ track_format = gst_format_register ("track", "CD track"); @@ -235,49 +235,49 @@ cdparanoia_class_init (CDParanoiaClass * klass) g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_LOCATION, g_param_spec_string ("location", "location", "location", - NULL, G_PARAM_READWRITE)); + NULL, G_PARAM_READWRITE)); g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_GENERIC_DEVICE, g_param_spec_string ("generic_device", "Generic device", - "Use specified generic scsi device", NULL, G_PARAM_READWRITE)); + "Use specified generic scsi device", NULL, G_PARAM_READWRITE)); g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_DEFAULT_SECTORS, g_param_spec_int ("default_sectors", "Default sectors", - "Force default number of sectors in read to n sectors", -1, 100, -1, - G_PARAM_READWRITE)); + "Force default number of sectors in read to n sectors", -1, 100, -1, + G_PARAM_READWRITE)); g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_SEARCH_OVERLAP, g_param_spec_int ("search_overlap", "Search overlap", - "Force minimum overlap search during verification to n sectors", -1, - 75, -1, G_PARAM_READWRITE)); + "Force minimum overlap search during verification to n sectors", -1, + 75, -1, G_PARAM_READWRITE)); g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_ENDIAN, g_param_spec_enum ("endian", "Endian", "Force endian on drive", - GST_TYPE_PARANOIA_ENDIAN, 0, G_PARAM_READWRITE)); + GST_TYPE_PARANOIA_ENDIAN, 0, G_PARAM_READWRITE)); g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_READ_SPEED, g_param_spec_int ("read_speed", "Read speed", - "Read from device at specified speed", G_MININT, G_MAXINT, 0, - G_PARAM_READWRITE)); + "Read from device at specified speed", G_MININT, G_MAXINT, 0, + G_PARAM_READWRITE)); g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_TOC_OFFSET, g_param_spec_int ("toc_offset", "TOC offset", - "Add <n> sectors to the values reported", G_MININT, G_MAXINT, 0, - G_PARAM_READWRITE)); + "Add <n> sectors to the values reported", G_MININT, G_MAXINT, 0, + G_PARAM_READWRITE)); g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_TOC_BIAS, g_param_spec_boolean ("toc_bias", "TOC bias", - "Assume that the beginning offset of track 1 as reported in the TOC " - "will be addressed as LBA 0. Necessary for some Toshiba drives to " - "get track boundaries", TRUE, G_PARAM_READWRITE)); + "Assume that the beginning offset of track 1 as reported in the TOC " + "will be addressed as LBA 0. Necessary for some Toshiba drives to " + "get track boundaries", TRUE, G_PARAM_READWRITE)); g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_NEVER_SKIP, g_param_spec_int ("never_skip", "Never skip", - "never accept any less than perfect data reconstruction (don't allow " - "'V's) but if [n] is given, skip after [n] retries without progress.", - 0, G_MAXINT, 0, G_PARAM_READWRITE)); + "never accept any less than perfect data reconstruction (don't allow " + "'V's) but if [n] is given, skip after [n] retries without progress.", + 0, G_MAXINT, 0, G_PARAM_READWRITE)); g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_ABORT_ON_SKIP, g_param_spec_boolean ("abort_on_skip", "Abort on skip", - "Abort on imperfect reads/skips", TRUE, G_PARAM_READWRITE)); + "Abort on imperfect reads/skips", TRUE, G_PARAM_READWRITE)); g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_PARANOIA_MODE, g_param_spec_enum ("paranoia_mode", "Paranoia mode", - "Type of checking to perform", GST_TYPE_PARANOIA_MODE, 0, - G_PARAM_READWRITE)); + "Type of checking to perform", GST_TYPE_PARANOIA_MODE, 0, + G_PARAM_READWRITE)); g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_DISCID, g_param_spec_string ("discid", "discid", "The dics id", NULL, - G_PARAM_READABLE)); + G_PARAM_READABLE)); gobject_class->set_property = cdparanoia_set_property; gobject_class->get_property = cdparanoia_get_property; @@ -336,24 +336,24 @@ cdparanoia_set_property (GObject * object, guint prop_id, const GValue * value, switch (prop_id) { case ARG_LOCATION: if (src->device) - g_free (src->device); + g_free (src->device); /* clear the filename if we get a NULL (is that possible?) */ if (!g_ascii_strcasecmp (g_value_get_string (value), "")) - src->device = NULL; + src->device = NULL; /* otherwise set the new filename */ else - src->device = g_strdup (g_value_get_string (value)); + src->device = g_strdup (g_value_get_string (value)); break; case ARG_GENERIC_DEVICE: if (src->generic_device) - g_free (src->generic_device); + g_free (src->generic_device); /* reset the device if we get a NULL (is that possible?) */ if (!g_ascii_strcasecmp (g_value_get_string (value), "")) - src->generic_device = NULL; + src->generic_device = NULL; /* otherwise set the new filename */ else - src->generic_device = g_strdup (g_value_get_string (value)); + src->generic_device = g_strdup (g_value_get_string (value)); break; case ARG_DEFAULT_SECTORS: src->default_sectors = g_value_get_int (value); @@ -440,8 +440,8 @@ cdparanoia_get_property (GObject * object, guint prop_id, GValue * value, * See cdparanoia/interface/common-interface.c:FixupTOC */ if (src->d && src->d->cd_extra) - g_warning - ("DiscID on multisession discs might be broken. Use at own risk."); + g_warning + ("DiscID on multisession discs might be broken. Use at own risk."); g_value_set_string (value, src->discid); break; default: @@ -535,7 +535,7 @@ lba_toc_to_msf_toc (TOC * lba_toc, toc_msf * msf_toc, gint tracks) for (i = 0; i <= tracks; i++) lba_to_msf (lba_toc[i].dwStartSector, &msf_toc[i].m, &msf_toc[i].s, - &msf_toc[i].f); + &msf_toc[i].f); } /* the cddb hash function */ @@ -596,18 +596,18 @@ add_index_associations (CDParanoia * src) sector = cdda_track_firstsector (src->d, i + 1); gst_index_add_association (src->index, src->index_id, - GST_ASSOCIATION_FLAG_KEY_UNIT, - track_format, i, - sector_format, sector, - GST_FORMAT_TIME, - (gint64) (((CD_FRAMESIZE_RAW >> 2) * sector * GST_SECOND) / 44100), - GST_FORMAT_BYTES, (gint64) (sector << 2), GST_FORMAT_DEFAULT, - (gint64) ((CD_FRAMESIZE_RAW >> 2) * sector), NULL); + GST_ASSOCIATION_FLAG_KEY_UNIT, + track_format, i, + sector_format, sector, + GST_FORMAT_TIME, + (gint64) (((CD_FRAMESIZE_RAW >> 2) * sector * GST_SECOND) / 44100), + GST_FORMAT_BYTES, (gint64) (sector << 2), GST_FORMAT_DEFAULT, + (gint64) ((CD_FRAMESIZE_RAW >> 2) * sector), NULL); #if 0 g_print ("Added association for track %d\n", i + 1); g_print ("Sector: %lld\n", sector); g_print ("Time: %lld\n", - (gint64) (((CD_FRAMESIZE_RAW >> 2) * sector * GST_SECOND) / 44100)); + (gint64) (((CD_FRAMESIZE_RAW >> 2) * sector * GST_SECOND) / 44100)); g_print ("Bytes: %lld\n", (gint64) (sector << 2)); g_print ("Units: %lld\n", (gint64) ((CD_FRAMESIZE_RAW >> 2) * sector)); g_print ("-----------\n"); @@ -640,7 +640,7 @@ cdparanoia_open (CDParanoia * src) /* fail if the device couldn't be found */ if (src->d == NULL) { GST_ELEMENT_ERROR (src, RESOURCE, OPEN_READ, - (_("Could not open CD device for reading.")), ("cdda_identify failed")); + (_("Could not open CD device for reading.")), ("cdda_identify failed")); return FALSE; } @@ -656,7 +656,7 @@ cdparanoia_open (CDParanoia * src) /* open the disc */ if (cdda_open (src->d)) { GST_ELEMENT_ERROR (src, RESOURCE, OPEN_READ, - (_("Could not open CD device for reading.")), ("cdda_open failed")); + (_("Could not open CD device for reading.")), ("cdda_open failed")); cdda_close (src->d); src->d = NULL; return FALSE; @@ -754,8 +754,8 @@ cdparanoia_change_state (GstElement * element) switch (GST_STATE_TRANSITION (element)) { case GST_STATE_NULL_TO_READY: if (!cdparanoia_open (CDPARANOIA (element))) { - g_warning ("cdparanoia: failed opening cd"); - return GST_STATE_FAILURE; + g_warning ("cdparanoia: failed opening cd"); + return GST_STATE_FAILURE; } cdparanoia->seq = 0; break; @@ -787,9 +787,9 @@ cdparanoia_get_event_mask (GstPad * pad) { static const GstEventMask masks[] = { {GST_EVENT_SEEK, GST_SEEK_METHOD_SET | - GST_SEEK_METHOD_CUR | GST_SEEK_METHOD_END | GST_SEEK_FLAG_FLUSH}, + GST_SEEK_METHOD_CUR | GST_SEEK_METHOD_END | GST_SEEK_FLAG_FLUSH}, {GST_EVENT_SEEK_SEGMENT, GST_SEEK_METHOD_SET | - GST_SEEK_METHOD_CUR | GST_SEEK_METHOD_END | GST_SEEK_FLAG_FLUSH}, + GST_SEEK_METHOD_CUR | GST_SEEK_METHOD_END | GST_SEEK_FLAG_FLUSH}, {0,} }; @@ -824,63 +824,63 @@ cdparanoia_event (GstPad * pad, GstEvent * event) /* we can only seek on sectors, so we convert the requested * offsets to sectors first */ if (offset != -1) { - res &= gst_pad_convert (src->srcpad, format, offset, - §or_format, &seg_start_sector); + res &= gst_pad_convert (src->srcpad, format, offset, + §or_format, &seg_start_sector); } if (endoffset != -1) { - res &= gst_pad_convert (src->srcpad, format, endoffset, - §or_format, &seg_end_sector); + res &= gst_pad_convert (src->srcpad, format, endoffset, + §or_format, &seg_end_sector); } if (!res) { - GST_DEBUG ("could not convert offsets to sectors"); - goto error; + GST_DEBUG ("could not convert offsets to sectors"); + goto error; } switch (GST_EVENT_SEEK_METHOD (event)) { - case GST_SEEK_METHOD_SET: - /* values are set for regular seek set */ - break; - case GST_SEEK_METHOD_CUR: - if (seg_start_sector != -1) { - seg_start_sector += src->cur_sector; - } - if (seg_end_sector != -1) { - seg_end_sector += src->cur_sector; - } - break; - case GST_SEEK_METHOD_END: - if (seg_start_sector != -1) { - seg_start_sector = src->last_sector - seg_start_sector; - } - if (seg_end_sector != -1) { - seg_end_sector = src->last_sector - seg_end_sector; - } - break; - default: - goto error; + case GST_SEEK_METHOD_SET: + /* values are set for regular seek set */ + break; + case GST_SEEK_METHOD_CUR: + if (seg_start_sector != -1) { + seg_start_sector += src->cur_sector; + } + if (seg_end_sector != -1) { + seg_end_sector += src->cur_sector; + } + break; + case GST_SEEK_METHOD_END: + if (seg_start_sector != -1) { + seg_start_sector = src->last_sector - seg_start_sector; + } + if (seg_end_sector != -1) { + seg_end_sector = src->last_sector - seg_end_sector; + } + break; + default: + goto error; } /* do we need to update the start sector? */ if (seg_start_sector != -1) { - seg_start_sector = CLAMP (seg_start_sector, - src->first_sector, src->last_sector); + seg_start_sector = CLAMP (seg_start_sector, + src->first_sector, src->last_sector); - if (paranoia_seek (src->p, seg_start_sector, SEEK_SET) > -1) { - GST_DEBUG ("seeked to %" G_GINT64_FORMAT, seg_start_sector); + if (paranoia_seek (src->p, seg_start_sector, SEEK_SET) > -1) { + GST_DEBUG ("seeked to %" G_GINT64_FORMAT, seg_start_sector); - src->segment_start_sector = seg_start_sector; - src->cur_sector = src->segment_start_sector; - } else { - goto error; - } + src->segment_start_sector = seg_start_sector; + src->cur_sector = src->segment_start_sector; + } else { + goto error; + } } if (seg_end_sector != -1) { - seg_end_sector = CLAMP (seg_end_sector, - src->first_sector, src->last_sector); - src->segment_end_sector = seg_end_sector; + seg_end_sector = CLAMP (seg_end_sector, + src->first_sector, src->last_sector); + src->segment_end_sector = seg_end_sector; } GST_DEBUG ("configured for %d -> %d sectors\n", - src->segment_start_sector, src->segment_end_sector); + src->segment_start_sector, src->segment_end_sector); break; } default: @@ -903,8 +903,8 @@ cdparanoia_get_formats (GstPad * pad) GST_FORMAT_TIME, GST_FORMAT_BYTES, GST_FORMAT_DEFAULT, - 0, /* filled later */ - 0, /* filled later */ + 0, /* filled later */ + 0, /* filled later */ 0 }; @@ -930,48 +930,48 @@ cdparanoia_convert (GstPad * pad, switch (src_format) { case GST_FORMAT_TIME: switch (*dest_format) { - case GST_FORMAT_BYTES: - src_value <<= 2; /* 4 bytes per sample */ - case GST_FORMAT_DEFAULT: - *dest_value = src_value * 44100 / GST_SECOND; - break; - default: - if (*dest_format == track_format || *dest_format == sector_format) { - gint sector = - (src_value * 44100) / ((CD_FRAMESIZE_RAW >> 2) * GST_SECOND); - - if (*dest_format == sector_format) { - *dest_value = sector; - } else { - *dest_value = cdda_sector_gettrack (src->d, sector) - 1; - } - } else - return FALSE; - break; + case GST_FORMAT_BYTES: + src_value <<= 2; /* 4 bytes per sample */ + case GST_FORMAT_DEFAULT: + *dest_value = src_value * 44100 / GST_SECOND; + break; + default: + if (*dest_format == track_format || *dest_format == sector_format) { + gint sector = + (src_value * 44100) / ((CD_FRAMESIZE_RAW >> 2) * GST_SECOND); + + if (*dest_format == sector_format) { + *dest_value = sector; + } else { + *dest_value = cdda_sector_gettrack (src->d, sector) - 1; + } + } else + return FALSE; + break; } break; case GST_FORMAT_BYTES: src_value >>= 2; case GST_FORMAT_DEFAULT: switch (*dest_format) { - case GST_FORMAT_BYTES: - *dest_value = src_value * 4; - break; - case GST_FORMAT_TIME: - *dest_value = src_value * GST_SECOND / 44100; - break; - default: - if (*dest_format == track_format || *dest_format == sector_format) { - gint sector = src_value / (CD_FRAMESIZE_RAW >> 2); - - if (*dest_format == track_format) { - *dest_value = cdda_sector_gettrack (src->d, sector) - 1; - } else { - *dest_value = sector; - } - } else - return FALSE; - break; + case GST_FORMAT_BYTES: + *dest_value = src_value * 4; + break; + case GST_FORMAT_TIME: + *dest_value = src_value * GST_SECOND / 44100; + break; + default: + if (*dest_format == track_format || *dest_format == sector_format) { + gint sector = src_value / (CD_FRAMESIZE_RAW >> 2); + + if (*dest_format == track_format) { + *dest_value = cdda_sector_gettrack (src->d, sector) - 1; + } else { + *dest_value = sector; + } + } else + return FALSE; + break; } break; default: @@ -979,39 +979,39 @@ cdparanoia_convert (GstPad * pad, gint sector; if (src_format == track_format) { - /* some sanity checks */ - if (src_value < 0 || src_value > src->d->tracks) - return FALSE; + /* some sanity checks */ + if (src_value < 0 || src_value > src->d->tracks) + return FALSE; - sector = cdda_track_firstsector (src->d, src_value + 1); + sector = cdda_track_firstsector (src->d, src_value + 1); } else if (src_format == sector_format) { - sector = src_value; + sector = src_value; } else { - return FALSE; + return FALSE; } switch (*dest_format) { - case GST_FORMAT_TIME: - *dest_value = ((CD_FRAMESIZE_RAW >> 2) * sector * GST_SECOND) / 44100; - break; - case GST_FORMAT_BYTES: - sector <<= 2; - case GST_FORMAT_DEFAULT: - *dest_value = (CD_FRAMESIZE_RAW >> 2) * sector; - break; - default: - if (*dest_format == sector_format) { - *dest_value = sector; - } else if (*dest_format == track_format) { - /* if we go past the last sector, make sure to report the last track */ - if (sector > src->last_sector) - *dest_value = cdda_sector_gettrack (src->d, src->last_sector); - else - *dest_value = cdda_sector_gettrack (src->d, sector) - 1; - } else { - return FALSE; - } - break; + case GST_FORMAT_TIME: + *dest_value = ((CD_FRAMESIZE_RAW >> 2) * sector * GST_SECOND) / 44100; + break; + case GST_FORMAT_BYTES: + sector <<= 2; + case GST_FORMAT_DEFAULT: + *dest_value = (CD_FRAMESIZE_RAW >> 2) * sector; + break; + default: + if (*dest_format == sector_format) { + *dest_value = sector; + } else if (*dest_format == track_format) { + /* if we go past the last sector, make sure to report the last track */ + if (sector > src->last_sector) + *dest_value = cdda_sector_gettrack (src->d, src->last_sector); + else + *dest_value = cdda_sector_gettrack (src->d, sector) - 1; + } else { + return FALSE; + } + break; } break; } @@ -1030,6 +1030,7 @@ cdparanoia_get_query_types (GstPad * pad) GST_QUERY_SEGMENT_END, 0 }; + return src_query_types; } @@ -1051,20 +1052,20 @@ cdparanoia_query (GstPad * pad, GstQueryType type, /* we take the last sector + 1 so that we also have the full * size of that last sector */ res = gst_pad_convert (src->srcpad, - sector_format, src->last_sector + 1, format, value); + sector_format, src->last_sector + 1, format, value); break; case GST_QUERY_POSITION: /* bring our current sector to the requested format */ res = gst_pad_convert (src->srcpad, - sector_format, src->cur_sector, format, value); + sector_format, src->cur_sector, format, value); break; case GST_QUERY_START: res = gst_pad_convert (src->srcpad, - sector_format, src->segment_start_sector, format, value); + sector_format, src->segment_start_sector, format, value); break; case GST_QUERY_SEGMENT_END: res = gst_pad_convert (src->srcpad, - sector_format, src->segment_end_sector, format, value); + sector_format, src->segment_end_sector, format, value); break; default: res = FALSE; @@ -1102,7 +1103,7 @@ static gboolean plugin_init (GstPlugin * plugin) { if (!gst_element_register (plugin, "cdparanoia", GST_RANK_NONE, - GST_TYPE_CDPARANOIA)) + GST_TYPE_CDPARANOIA)) return FALSE; return TRUE; diff --git a/ext/gnomevfs/gstgnomevfs.c b/ext/gnomevfs/gstgnomevfs.c index d8b50bf0ed..f71afd112a 100644 --- a/ext/gnomevfs/gstgnomevfs.c +++ b/ext/gnomevfs/gstgnomevfs.c @@ -32,9 +32,9 @@ static gboolean plugin_init (GstPlugin * plugin) { if (!gst_element_register (plugin, "gnomevfssrc", - GST_RANK_SECONDARY, gst_gnomevfssrc_get_type ()) || + GST_RANK_SECONDARY, gst_gnomevfssrc_get_type ()) || !gst_element_register (plugin, "gnomevfssink", - GST_RANK_SECONDARY, gst_gnomevfssink_get_type ())) { + GST_RANK_SECONDARY, gst_gnomevfssink_get_type ())) { return FALSE; } #ifdef ENABLE_NLS diff --git a/ext/gnomevfs/gstgnomevfssink.c b/ext/gnomevfs/gstgnomevfssink.c index 9eecfc7fae..0249464dde 100644 --- a/ext/gnomevfs/gstgnomevfssink.c +++ b/ext/gnomevfs/gstgnomevfssink.c @@ -56,7 +56,8 @@ typedef enum GST_GNOMEVFSSINK_OPEN = GST_ELEMENT_FLAG_LAST, GST_GNOMEVFSSINK_FLAG_LAST = GST_ELEMENT_FLAG_LAST + 2, -} GstGnomeVFSSinkFlags; +} +GstGnomeVFSSinkFlags; struct _GstGnomeVFSSink { @@ -144,9 +145,10 @@ gst_gnomevfssink_get_type (void) 0, (GInstanceInitFunc) gst_gnomevfssink_init, }; + gnomevfssink_type = - g_type_register_static (GST_TYPE_ELEMENT, "GstGnomeVFSSink", - &gnomevfssink_info, 0); + g_type_register_static (GST_TYPE_ELEMENT, "GstGnomeVFSSink", + &gnomevfssink_info, 0); } return gnomevfssink_type; } @@ -177,7 +179,7 @@ gst_gnomevfssink_class_init (GstGnomeVFSSinkClass * klass) g_object_class_install_property (gobject_class, ARG_HANDLE, g_param_spec_pointer ("handle", - "GnomeVFSHandle", "Handle for GnomeVFS", G_PARAM_READWRITE)); + "GnomeVFSHandle", "Handle for GnomeVFS", G_PARAM_READWRITE)); gst_gnomevfssink_signals[SIGNAL_HANDOFF] = g_signal_new ("handoff", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST, @@ -227,9 +229,9 @@ gst_gnomevfssink_set_property (GObject * object, guint prop_id, switch (prop_id) { case ARG_LOCATION: if (sink->filename) - g_free (sink->filename); + g_free (sink->filename); if (sink->uri) - g_free (sink->uri); + g_free (sink->uri); sink->filename = g_strdup (g_value_get_string (value)); sink->uri = gnome_vfs_uri_new (sink->filename); break; @@ -280,18 +282,18 @@ gst_gnomevfssink_open_file (GstGnomeVFSSink * sink) if (sink->filename) { /* open the file */ result = gnome_vfs_create_uri (&(sink->handle), sink->uri, - GNOME_VFS_OPEN_WRITE, sink->erase, - GNOME_VFS_PERM_USER_READ | GNOME_VFS_PERM_USER_WRITE - | GNOME_VFS_PERM_GROUP_READ); + GNOME_VFS_OPEN_WRITE, sink->erase, + GNOME_VFS_PERM_USER_READ | GNOME_VFS_PERM_USER_WRITE + | GNOME_VFS_PERM_GROUP_READ); GST_DEBUG ("open: %s", gnome_vfs_result_to_string (result)); if (result != GNOME_VFS_OK) { if (sink->erase == FALSE) { - g_signal_emit (G_OBJECT (sink), - gst_gnomevfssink_signals[SIGNAL_ERASE_ASK], 0, sink->erase); + g_signal_emit (G_OBJECT (sink), + gst_gnomevfssink_signals[SIGNAL_ERASE_ASK], 0, sink->erase); } GST_ELEMENT_ERROR (sink, RESOURCE, OPEN_WRITE, - (_("Could not open vfs file \"%s\" for writing."), sink->filename), - GST_ERROR_SYSTEM); + (_("Could not open vfs file \"%s\" for writing."), sink->filename), + GST_ERROR_SYSTEM); return FALSE; } } else @@ -315,8 +317,8 @@ gst_gnomevfssink_close_file (GstGnomeVFSSink * sink) if (result != GNOME_VFS_OK) GST_ELEMENT_ERROR (sink, RESOURCE, CLOSE, - (_("Could not close vfs file \"%s\"."), sink->filename), - GST_ERROR_SYSTEM); + (_("Could not close vfs file \"%s\"."), sink->filename), + GST_ERROR_SYSTEM); } GST_FLAG_UNSET (sink, GST_GNOMEVFSSINK_OPEN); @@ -345,14 +347,14 @@ gst_gnomevfssink_chain (GstPad * pad, GstData * _data) if (GST_FLAG_IS_SET (sink, GST_GNOMEVFSSINK_OPEN)) { result = - gnome_vfs_write (sink->handle, GST_BUFFER_DATA (buf), - GST_BUFFER_SIZE (buf), &bytes_written); + gnome_vfs_write (sink->handle, GST_BUFFER_DATA (buf), + GST_BUFFER_SIZE (buf), &bytes_written); GST_DEBUG ("write: %s, written_bytes: %" G_GUINT64_FORMAT, - gnome_vfs_result_to_string (result), bytes_written); + gnome_vfs_result_to_string (result), bytes_written); if (bytes_written < GST_BUFFER_SIZE (buf)) { printf ("gnomevfssink : Warning : %d bytes should be written, only %" - G_GUINT64_FORMAT " bytes written\n", GST_BUFFER_SIZE (buf), - bytes_written); + G_GUINT64_FORMAT " bytes written\n", GST_BUFFER_SIZE (buf), + bytes_written); } } gst_buffer_unref (buf); @@ -372,7 +374,7 @@ gst_gnomevfssink_change_state (GstElement * element) } else { if (!GST_FLAG_IS_SET (element, GST_GNOMEVFSSINK_OPEN)) { if (!gst_gnomevfssink_open_file (GST_GNOMEVFSSINK (element))) - return GST_STATE_FAILURE; + return GST_STATE_FAILURE; } } diff --git a/ext/gnomevfs/gstgnomevfssrc.c b/ext/gnomevfs/gstgnomevfssrc.c index 6af2debcaa..2c37ed0401 100644 --- a/ext/gnomevfs/gstgnomevfssrc.c +++ b/ext/gnomevfs/gstgnomevfssrc.c @@ -73,7 +73,8 @@ typedef enum GST_GNOMEVFSSRC_OPEN = GST_ELEMENT_FLAG_LAST, GST_GNOMEVFSSRC_FLAG_LAST = GST_ELEMENT_FLAG_LAST + 2, -} GstGnomeVFSSrcFlags; +} +GstGnomeVFSSrcFlags; typedef struct _GstGnomeVFSSrc GstGnomeVFSSrc; typedef struct _GstGnomeVFSSrcClass GstGnomeVFSSrcClass; @@ -96,8 +97,8 @@ struct _GstGnomeVFSSrc /* details for fallback synchronous read */ GnomeVFSFileSize size; - GnomeVFSFileOffset curoffset; /* current offset in file */ - gulong bytes_per_read; /* bytes per read */ + GnomeVFSFileOffset curoffset; /* current offset in file */ + gulong bytes_per_read; /* bytes per read */ gboolean new_seek; /* icecast/audiocast metadata extraction handling */ @@ -142,6 +143,7 @@ gst_gnomevfssrc_get_formats (GstPad * pad) GST_FORMAT_BYTES, 0, }; + return formats; } @@ -153,6 +155,7 @@ gst_gnomevfssrc_get_query_types (GstPad * pad) GST_QUERY_POSITION, 0, }; + return types; } @@ -161,11 +164,12 @@ gst_gnomevfssrc_get_event_mask (GstPad * pad) { static const GstEventMask masks[] = { {GST_EVENT_SEEK, GST_SEEK_METHOD_CUR | - GST_SEEK_METHOD_SET | GST_SEEK_METHOD_END | GST_SEEK_FLAG_FLUSH}, + GST_SEEK_METHOD_SET | GST_SEEK_METHOD_END | GST_SEEK_FLAG_FLUSH}, {GST_EVENT_FLUSH, 0}, {GST_EVENT_SIZE, 0}, {0, 0}, }; + return masks; } @@ -235,9 +239,10 @@ gst_gnomevfssrc_get_type (void) 0, (GInstanceInitFunc) gst_gnomevfssrc_init, }; + gnomevfssrc_type = - g_type_register_static (GST_TYPE_ELEMENT, - "GstGnomeVFSSrc", &gnomevfssrc_info, 0); + g_type_register_static (GST_TYPE_ELEMENT, + "GstGnomeVFSSrc", &gnomevfssrc_info, 0); } return gnomevfssrc_type; } @@ -270,37 +275,37 @@ gst_gnomevfssrc_class_init (GstGnomeVFSSrcClass * klass) g_object_class_install_property (gobject_class, ARG_HANDLE, g_param_spec_pointer ("handle", - "GnomeVFSHandle", "Handle for GnomeVFS", G_PARAM_READWRITE)); + "GnomeVFSHandle", "Handle for GnomeVFS", G_PARAM_READWRITE)); /* icecast stuff */ g_object_class_install_property (gobject_class, ARG_IRADIO_MODE, g_param_spec_boolean ("iradio-mode", - "iradio-mode", - "Enable internet radio mode (extraction of icecast/audiocast metadata)", - FALSE, G_PARAM_READWRITE)); + "iradio-mode", + "Enable internet radio mode (extraction of icecast/audiocast metadata)", + FALSE, G_PARAM_READWRITE)); g_object_class_install_property (gobject_class, ARG_IRADIO_NAME, g_param_spec_string ("iradio-name", - "iradio-name", "Name of the stream", NULL, G_PARAM_READABLE)); + "iradio-name", "Name of the stream", NULL, G_PARAM_READABLE)); g_object_class_install_property (gobject_class, ARG_IRADIO_GENRE, g_param_spec_string ("iradio-genre", - "iradio-genre", "Genre of the stream", NULL, G_PARAM_READABLE)); + "iradio-genre", "Genre of the stream", NULL, G_PARAM_READABLE)); g_object_class_install_property (gobject_class, ARG_IRADIO_URL, g_param_spec_string ("iradio-url", - "iradio-url", - "Homepage URL for radio stream", NULL, G_PARAM_READABLE)); + "iradio-url", + "Homepage URL for radio stream", NULL, G_PARAM_READABLE)); g_object_class_install_property (gobject_class, ARG_IRADIO_TITLE, g_param_spec_string ("iradio-title", - "iradio-title", - "Name of currently playing song", NULL, G_PARAM_READABLE)); + "iradio-title", + "Name of currently playing song", NULL, G_PARAM_READABLE)); g_object_class_install_property (gobject_class, ARG_SEEKABLE, g_param_spec_boolean ("seekable", - "seekable", "TRUE is stream is seekable", FALSE, G_PARAM_READABLE)); + "seekable", "TRUE is stream is seekable", FALSE, G_PARAM_READABLE)); gstelement_class->set_property = gst_gnomevfssrc_set_property; gstelement_class->get_property = gst_gnomevfssrc_get_property; @@ -393,37 +398,37 @@ gst_gnomevfssrc_set_property (GObject * object, guint prop_id, case ARG_LOCATION: /* the element must be stopped or paused in order to do this */ g_return_if_fail ((GST_STATE (src) < GST_STATE_PLAYING) - || (GST_STATE (src) == GST_STATE_PAUSED)); + || (GST_STATE (src) == GST_STATE_PAUSED)); g_free (src->filename); /* clear the filename if we get a NULL */ if (g_value_get_string (value) == NULL) { - gst_element_set_state (GST_ELEMENT (object), GST_STATE_NULL); - src->filename = NULL; + gst_element_set_state (GST_ELEMENT (object), GST_STATE_NULL); + src->filename = NULL; } else { - /* otherwise set the new filename */ - location = g_value_get_string (value); - /* if it's not a proper uri, default to file: -- this - * is a crude test */ - if (!strchr (location, ':')) { - gchar *newloc = gnome_vfs_escape_path_string (location); - - if (*newloc == '/') - src->filename = g_strdup_printf ("file://%s", newloc); - else - src->filename = - g_strdup_printf ("file://%s/%s", getcwd (cwd, PATH_MAX), - newloc); - g_free (newloc); - } else - src->filename = g_strdup (g_value_get_string (value)); + /* otherwise set the new filename */ + location = g_value_get_string (value); + /* if it's not a proper uri, default to file: -- this + * is a crude test */ + if (!strchr (location, ':')) { + gchar *newloc = gnome_vfs_escape_path_string (location); + + if (*newloc == '/') + src->filename = g_strdup_printf ("file://%s", newloc); + else + src->filename = + g_strdup_printf ("file://%s/%s", getcwd (cwd, PATH_MAX), + newloc); + g_free (newloc); + } else + src->filename = g_strdup (g_value_get_string (value)); } if ((GST_STATE (src) == GST_STATE_PAUSED) - && (src->filename != NULL)) { - gst_gnomevfssrc_close_file (src); - gst_gnomevfssrc_open_file (src); + && (src->filename != NULL)) { + gst_gnomevfssrc_close_file (src); + gst_gnomevfssrc_open_file (src); } break; case ARG_HANDLE: @@ -505,7 +510,7 @@ unicodify (const char *str, int len, ...) ret = g_locale_to_utf8 (str, len, &bytes_read, &bytes_written, NULL); else ret = g_convert (str, len, "UTF-8", cset, - &bytes_read, &bytes_written, NULL); + &bytes_read, &bytes_written, NULL); if (ret) break; } @@ -534,9 +539,9 @@ audiocast_init (GstGnomeVFSSrc * src) return TRUE; GST_DEBUG ("audiocast: registering listener"); if (audiocast_register_listener (&src->audiocast_port, - &src->audiocast_fd) < 0) { + &src->audiocast_fd) < 0) { GST_ELEMENT_ERROR (src, RESOURCE, OPEN_READ, (NULL), - ("Unable to listen on UDP port %d", src->audiocast_port)); + ("Unable to listen on UDP port %d", src->audiocast_port)); close (src->audiocast_fd); return FALSE; } @@ -553,7 +558,7 @@ audiocast_init (GstGnomeVFSSrc * src) g_thread_create ((GThreadFunc) audiocast_thread_run, src, TRUE, &error); if (error != NULL) { GST_ELEMENT_ERROR (src, RESOURCE, TOO_LAZY, (NULL), - ("Unable to create thread: %s", error->message)); + ("Unable to create thread: %s", error->message)); close (src->audiocast_fd); return FALSE; } @@ -644,8 +649,8 @@ audiocast_thread_run (GstGnomeVFSSrc * src) } GST_DEBUG ("audiocast thread: reading data"); len = - recvfrom (src->audiocast_fd, buf, sizeof (buf) - 1, 0, - (struct sockaddr *) &from, &fromlen); + recvfrom (src->audiocast_fd, buf, sizeof (buf) - 1, 0, + (struct sockaddr *) &from, &fromlen); if (len < 0 && errno == EAGAIN) continue; else if (len >= 0) { @@ -655,66 +660,66 @@ audiocast_thread_run (GstGnomeVFSSrc * src) buf[len] = '\0'; lines = g_strsplit (buf, "\n", 0); if (!lines) - continue; + continue; for (i = 0; lines[i]; i++) { - while ((lines[i][strlen (lines[i]) - 1] == '\n') || - (lines[i][strlen (lines[i]) - 1] == '\r')) - lines[i][strlen (lines[i]) - 1] = '\0'; - - valptr = strchr (lines[i], ':'); - - if (!valptr) - continue; - else - valptr++; - - g_strstrip (valptr); - if (!strlen (valptr)) - continue; - - value = gst_gnomevfssrc_unicodify (valptr); - if (!value) { - g_print ("Unable to convert \"%s\" to UTF-8!\n", valptr); - continue; - } - - if (!strncmp (lines[i], "x-audiocast-streamtitle", 23)) { - g_mutex_lock (src->audiocast_udpdata_mutex); - g_free (src->iradio_title); - src->iradio_title = value; - g_mutex_unlock (src->audiocast_udpdata_mutex); - - g_mutex_lock (src->audiocast_queue_mutex); - src->audiocast_notify_queue = - g_list_append (src->audiocast_notify_queue, "iradio-title"); - GST_DEBUG ("audiocast title: %s\n", src->iradio_title); - g_mutex_unlock (src->audiocast_queue_mutex); - } else if (!strncmp (lines[i], "x-audiocast-streamurl", 21)) { - g_mutex_lock (src->audiocast_udpdata_mutex); - g_free (src->iradio_url); - src->iradio_url = value; - g_mutex_unlock (src->audiocast_udpdata_mutex); - - g_mutex_lock (src->audiocast_queue_mutex); - src->audiocast_notify_queue = - g_list_append (src->audiocast_notify_queue, "iradio-url"); - GST_DEBUG ("audiocast url: %s\n", src->iradio_title); - g_mutex_unlock (src->audiocast_queue_mutex); - } else if (!strncmp (lines[i], "x-audiocast-udpseqnr", 20)) { - gchar outbuf[120]; - - sprintf (outbuf, "x-audiocast-ack: %ld \r\n", atol (value)); - g_free (value); - - if (sendto (src->audiocast_fd, outbuf, strlen (outbuf), 0, - (struct sockaddr *) &from, fromlen) <= 0) { - g_print ("Error sending response to server: %s\n", - strerror (errno)); - continue; - } - GST_DEBUG ("sent audiocast ack: %s\n", outbuf); - } + while ((lines[i][strlen (lines[i]) - 1] == '\n') || + (lines[i][strlen (lines[i]) - 1] == '\r')) + lines[i][strlen (lines[i]) - 1] = '\0'; + + valptr = strchr (lines[i], ':'); + + if (!valptr) + continue; + else + valptr++; + + g_strstrip (valptr); + if (!strlen (valptr)) + continue; + + value = gst_gnomevfssrc_unicodify (valptr); + if (!value) { + g_print ("Unable to convert \"%s\" to UTF-8!\n", valptr); + continue; + } + + if (!strncmp (lines[i], "x-audiocast-streamtitle", 23)) { + g_mutex_lock (src->audiocast_udpdata_mutex); + g_free (src->iradio_title); + src->iradio_title = value; + g_mutex_unlock (src->audiocast_udpdata_mutex); + + g_mutex_lock (src->audiocast_queue_mutex); + src->audiocast_notify_queue = + g_list_append (src->audiocast_notify_queue, "iradio-title"); + GST_DEBUG ("audiocast title: %s\n", src->iradio_title); + g_mutex_unlock (src->audiocast_queue_mutex); + } else if (!strncmp (lines[i], "x-audiocast-streamurl", 21)) { + g_mutex_lock (src->audiocast_udpdata_mutex); + g_free (src->iradio_url); + src->iradio_url = value; + g_mutex_unlock (src->audiocast_udpdata_mutex); + + g_mutex_lock (src->audiocast_queue_mutex); + src->audiocast_notify_queue = + g_list_append (src->audiocast_notify_queue, "iradio-url"); + GST_DEBUG ("audiocast url: %s\n", src->iradio_title); + g_mutex_unlock (src->audiocast_queue_mutex); + } else if (!strncmp (lines[i], "x-audiocast-udpseqnr", 20)) { + gchar outbuf[120]; + + sprintf (outbuf, "x-audiocast-ack: %ld \r\n", atol (value)); + g_free (value); + + if (sendto (src->audiocast_fd, outbuf, strlen (outbuf), 0, + (struct sockaddr *) &from, fromlen) <= 0) { + g_print ("Error sending response to server: %s\n", + strerror (errno)); + continue; + } + GST_DEBUG ("sent audiocast ack: %s\n", outbuf); + } } g_strfreev (lines); } @@ -788,11 +793,11 @@ gst_gnomevfssrc_received_headers_callback (gconstpointer in, continue; /* Icecast stuff */ - if (!strncmp (data, "icy-metaint:", 12)) { /* ugh */ + if (!strncmp (data, "icy-metaint:", 12)) { /* ugh */ sscanf (data + 12, "%d", &icy_metaint); src->icy_metaint = icy_metaint; GST_DEBUG ("got icy-metaint %d, killing audiocast thread", - src->icy_metaint); + src->icy_metaint); audiocast_thread_kill (src); continue; } @@ -809,17 +814,17 @@ gst_gnomevfssrc_received_headers_callback (gconstpointer in, g_free (src->iradio_name); src->iradio_name = gst_gnomevfssrc_unicodify (value); if (src->iradio_name) - g_object_notify (G_OBJECT (src), "iradio-name"); + g_object_notify (G_OBJECT (src), "iradio-name"); } else if (!strncmp (key, "genre", 5)) { g_free (src->iradio_genre); src->iradio_genre = gst_gnomevfssrc_unicodify (value); if (src->iradio_genre) - g_object_notify (G_OBJECT (src), "iradio-genre"); + g_object_notify (G_OBJECT (src), "iradio-genre"); } else if (!strncmp (key, "url", 3)) { g_free (src->iradio_url); src->iradio_url = gst_gnomevfssrc_unicodify (value); if (src->iradio_url) - g_object_notify (G_OBJECT (src), "iradio-url"); + g_object_notify (G_OBJECT (src), "iradio-url"); } } } @@ -884,7 +889,7 @@ gst_gnomevfssrc_get_icy_metadata (GstGnomeVFSSrc * src) while (pos - data < metadata_length) { res = gnome_vfs_read (src->handle, pos, - metadata_length - (pos - data), &length); + metadata_length - (pos - data), &length); /* FIXME: better error handling here? */ if (res != GNOME_VFS_OK) { g_free (data); @@ -902,22 +907,22 @@ gst_gnomevfssrc_get_icy_metadata (GstGnomeVFSSrc * src) g_free (src->iradio_title); src->iradio_title = gst_gnomevfssrc_unicodify (tags[i] + 13); if (src->iradio_title) { - GST_DEBUG ("sending notification on icecast title"); - g_object_notify (G_OBJECT (src), "iradio-title"); + GST_DEBUG ("sending notification on icecast title"); + g_object_notify (G_OBJECT (src), "iradio-title"); } else - g_print ("Unable to convert icecast title \"%s\" to UTF-8!\n", - tags[i] + 13); + g_print ("Unable to convert icecast title \"%s\" to UTF-8!\n", + tags[i] + 13); } if (!g_ascii_strncasecmp (tags[i], "StreamUrl=", 10)) { g_free (src->iradio_url); src->iradio_url = gst_gnomevfssrc_unicodify (tags[i] + 11); if (src->iradio_url) { - GST_DEBUG ("sending notification on icecast url"); - g_object_notify (G_OBJECT (src), "iradio-url"); + GST_DEBUG ("sending notification on icecast url"); + g_object_notify (G_OBJECT (src), "iradio-url"); } else - g_print ("Unable to convert icecast url \"%s\" to UTF-8!\n", - tags[i] + 11); + g_print ("Unable to convert icecast url \"%s\" to UTF-8!\n", + tags[i] + 11); } } @@ -966,7 +971,7 @@ gst_gnomevfssrc_get (GstPad * pad) GST_BUFFER_SIZE (buf) = 0; GST_DEBUG ("doing read: icy_count: %" G_GINT64_FORMAT, src->icy_count); result = gnome_vfs_read (src->handle, data, - src->icy_metaint - src->icy_count, &readbytes); + src->icy_metaint - src->icy_count, &readbytes); /* EOS? */ if (readbytes == 0) { @@ -1007,16 +1012,16 @@ gst_gnomevfssrc_get (GstPad * pad) src->new_seek = FALSE; GST_DEBUG ("gnomevfssrc sending discont"); event = - gst_event_new_discontinuous (FALSE, GST_FORMAT_BYTES, src->curoffset, - NULL); + gst_event_new_discontinuous (FALSE, GST_FORMAT_BYTES, src->curoffset, + NULL); return GST_DATA (event); } result = gnome_vfs_read (src->handle, GST_BUFFER_DATA (buf), - src->bytes_per_read, &readbytes); + src->bytes_per_read, &readbytes); GST_DEBUG ("read: %s, readbytes: %" G_GINT64_FORMAT, - gnome_vfs_result_to_string (result), readbytes); + gnome_vfs_result_to_string (result), readbytes); /* deal with EOS */ if (readbytes == 0) { gst_buffer_unref (buf); @@ -1051,8 +1056,8 @@ gst_gnomevfssrc_open_file (GstGnomeVFSSrc * src) src->uri = gnome_vfs_uri_new (src->filename); if (!src->uri) { GST_ELEMENT_ERROR (src, RESOURCE, OPEN_READ, - (_("Could not open vfs file \"%s\" for reading."), src->filename), - GST_ERROR_SYSTEM); + (_("Could not open vfs file \"%s\" for reading."), src->filename), + GST_ERROR_SYSTEM); return FALSE; } } @@ -1074,15 +1079,15 @@ gst_gnomevfssrc_open_file (GstGnomeVFSSrc * src) escaped = gnome_vfs_unescape_string_for_display (src->filename); GST_ELEMENT_ERROR (src, RESOURCE, OPEN_READ, - (_("Could not open vfs file \"%s\" for reading."), escaped), - (gnome_vfs_result_to_string (result))); + (_("Could not open vfs file \"%s\" for reading."), escaped), + (gnome_vfs_result_to_string (result))); g_free (escaped); return FALSE; } info = gnome_vfs_file_info_new (); if (gnome_vfs_get_file_info_from_handle (src->handle, info, - GNOME_VFS_FILE_INFO_DEFAULT) + GNOME_VFS_FILE_INFO_DEFAULT) == GNOME_VFS_OK) { if (info->valid_fields & GNOME_VFS_FILE_INFO_FIELDS_SIZE) src->size = info->size; @@ -1137,13 +1142,13 @@ gst_gnomevfssrc_change_state (GstElement * element) switch (GST_STATE_TRANSITION (element)) { case GST_STATE_READY_TO_PAUSED: if (!GST_FLAG_IS_SET (element, GST_GNOMEVFSSRC_OPEN)) { - if (!gst_gnomevfssrc_open_file (GST_GNOMEVFSSRC (element))) - return GST_STATE_FAILURE; + if (!gst_gnomevfssrc_open_file (GST_GNOMEVFSSRC (element))) + return GST_STATE_FAILURE; } break; case GST_STATE_PAUSED_TO_READY: if (GST_FLAG_IS_SET (element, GST_GNOMEVFSSRC_OPEN)) - gst_gnomevfssrc_close_file (GST_GNOMEVFSSRC (element)); + gst_gnomevfssrc_close_file (GST_GNOMEVFSSRC (element)); break; case GST_STATE_NULL_TO_READY: case GST_STATE_READY_TO_NULL: @@ -1166,22 +1171,22 @@ gst_gnomevfssrc_srcpad_query (GstPad * pad, GstQueryType type, switch (type) { case GST_QUERY_TOTAL: if (*format != GST_FORMAT_BYTES) { - return FALSE; + return FALSE; } *value = src->size; break; case GST_QUERY_POSITION: switch (*format) { - case GST_FORMAT_BYTES: - *value = src->curoffset; - break; - case GST_FORMAT_PERCENT: - if (src->size == 0) - return FALSE; - *value = src->curoffset * GST_FORMAT_PERCENT_MAX / src->size; - break; - default: - return FALSE; + case GST_FORMAT_BYTES: + *value = src->curoffset; + break; + case GST_FORMAT_PERCENT: + if (src->size == 0) + return FALSE; + *value = src->curoffset * GST_FORMAT_PERCENT_MAX / src->size; + break; + default: + return FALSE; } break; default: @@ -1203,32 +1208,32 @@ gst_gnomevfssrc_srcpad_event (GstPad * pad, GstEvent * event) GnomeVFSResult result; if (GST_EVENT_SEEK_FORMAT (event) != GST_FORMAT_BYTES) { - gst_event_unref (event); - return FALSE; + gst_event_unref (event); + return FALSE; } switch (GST_EVENT_SEEK_METHOD (event)) { - case GST_SEEK_METHOD_SET: - desired_offset = (guint64) GST_EVENT_SEEK_OFFSET (event); - break; - case GST_SEEK_METHOD_CUR: - desired_offset = src->curoffset + GST_EVENT_SEEK_OFFSET (event); - break; - case GST_SEEK_METHOD_END: - desired_offset = src->size - ABS (GST_EVENT_SEEK_OFFSET (event)); - break; - default: - gst_event_unref (event); - return FALSE; - break; + case GST_SEEK_METHOD_SET: + desired_offset = (guint64) GST_EVENT_SEEK_OFFSET (event); + break; + case GST_SEEK_METHOD_CUR: + desired_offset = src->curoffset + GST_EVENT_SEEK_OFFSET (event); + break; + case GST_SEEK_METHOD_END: + desired_offset = src->size - ABS (GST_EVENT_SEEK_OFFSET (event)); + break; + default: + gst_event_unref (event); + return FALSE; + break; } result = gnome_vfs_seek (src->handle, - GNOME_VFS_SEEK_START, desired_offset); + GNOME_VFS_SEEK_START, desired_offset); GST_DEBUG ("new_seek: %s", gnome_vfs_result_to_string (result)); if (result != GNOME_VFS_OK) { - gst_event_unref (event); - return FALSE; + gst_event_unref (event); + return FALSE; } src->curoffset = desired_offset; src->new_seek = TRUE; @@ -1237,8 +1242,8 @@ gst_gnomevfssrc_srcpad_event (GstPad * pad, GstEvent * event) } case GST_EVENT_SIZE: if (GST_EVENT_SIZE_FORMAT (event) != GST_FORMAT_BYTES) { - gst_event_unref (event); - return FALSE; + gst_event_unref (event); + return FALSE; } src->bytes_per_read = GST_EVENT_SIZE_VALUE (event); g_object_notify (G_OBJECT (src), "bytesperread"); diff --git a/ext/ogg/gstoggdemux.c b/ext/ogg/gstoggdemux.c index 19567afa88..998cf92f40 100644 --- a/ext/ogg/gstoggdemux.c +++ b/ext/ogg/gstoggdemux.c @@ -52,24 +52,26 @@ typedef enum GST_OGG_STATE_SEEK, /* normal playback */ GST_OGG_STATE_PLAY -} GstOggState; +} +GstOggState; /* all information needed for one ogg stream */ typedef struct { - GstPad *pad; /* reference for this pad is held by element we belong to */ + GstPad *pad; /* reference for this pad is held by element we belong to */ gint serial; ogg_stream_state stream; - guint64 offset; /* end offset of last buffer */ - guint64 known_offset; /* last known offset */ - gint64 packetno; /* number of next expected packet */ + guint64 offset; /* end offset of last buffer */ + guint64 known_offset; /* last known offset */ + gint64 packetno; /* number of next expected packet */ - guint64 length; /* length of stream or 0 */ - glong pages; /* number of pages in stream or 0 */ + guint64 length; /* length of stream or 0 */ + glong pages; /* number of pages in stream or 0 */ guint flags; -} GstOggPad; +} +GstOggPad; typedef enum { @@ -81,8 +83,9 @@ GstOggPadFlags; /* all information needed for one ogg chain (relevant for chained bitstreams) */ typedef struct { - GSList *pads; /* list of GstOggPad */ -} GstOggChain; + GSList *pads; /* list of GstOggPad */ +} +GstOggChain; #define CURRENT_CHAIN(ogg) (&g_array_index ((ogg)->chains, GstOggChain, (ogg)->current_chain)) #define FOR_PAD_IN_CURRENT_CHAIN(ogg, _pad, ...) G_STMT_START{ \ @@ -98,7 +101,8 @@ typedef enum GST_OGG_FLAG_BOS = GST_ELEMENT_FLAG_LAST, GST_OGG_FLAG_EOS, GST_OGG_FLAG_WAIT_FOR_DISCONT -} GstOggFlag; +} +GstOggFlag; struct _GstOggDemux { @@ -250,6 +254,7 @@ gst_ogg_demux_get_event_masks (GstPad * pad) {GST_EVENT_SEEK, GST_SEEK_METHOD_SET | GST_SEEK_FLAG_FLUSH}, {0,} }; + return gst_ogg_demux_src_event_masks; } static const GstQueryType * @@ -260,6 +265,7 @@ gst_ogg_demux_get_query_types (GstPad * pad) GST_QUERY_POSITION, 0 }; + return gst_ogg_demux_src_query_types; } @@ -295,15 +301,15 @@ gst_ogg_demux_src_query (GstPad * pad, GstQueryType type, switch (type) { case GST_QUERY_TOTAL:{ if (*format == GST_FORMAT_DEFAULT) { - *value = cur->length; - res = TRUE; + *value = cur->length; + res = TRUE; } break; } case GST_QUERY_POSITION: if (*format == GST_FORMAT_DEFAULT && cur->length != 0) { - *value = cur->known_offset; - res = TRUE; + *value = cur->known_offset; + res = TRUE; } break; default: @@ -337,40 +343,40 @@ gst_ogg_demux_src_event (GstPad * pad, GstEvent * event) gint64 offset; if (GST_EVENT_SEEK_FORMAT (event) != GST_FORMAT_DEFAULT) - goto error; + goto error; offset = GST_EVENT_SEEK_OFFSET (event); switch (GST_EVENT_SEEK_METHOD (event)) { - case GST_SEEK_METHOD_END: - if (cur->length == 0 || offset > 0) - goto error; - offset = cur->length + offset; - break; - case GST_SEEK_METHOD_CUR: - offset += cur->known_offset; - break; - case GST_SEEK_METHOD_SET: - break; - default: - g_warning ("invalid seek method in seek event"); - goto error; + case GST_SEEK_METHOD_END: + if (cur->length == 0 || offset > 0) + goto error; + offset = cur->length + offset; + break; + case GST_SEEK_METHOD_CUR: + offset += cur->known_offset; + break; + case GST_SEEK_METHOD_SET: + break; + default: + g_warning ("invalid seek method in seek event"); + goto error; } if (offset < cur->known_offset) { - GstEvent *restart = - gst_event_new_seek (GST_FORMAT_BYTES | GST_SEEK_METHOD_SET | - GST_EVENT_SEEK_FLAGS (event), 0); - if (!gst_pad_send_event (GST_PAD_PEER (ogg->sinkpad), restart)) - goto error; + GstEvent *restart = + gst_event_new_seek (GST_FORMAT_BYTES | GST_SEEK_METHOD_SET | + GST_EVENT_SEEK_FLAGS (event), 0); + if (!gst_pad_send_event (GST_PAD_PEER (ogg->sinkpad), restart)) + goto error; } else { - FOR_PAD_IN_CURRENT_CHAIN (ogg, pad, if (GST_PAD_IS_USABLE (pad->pad)) - gst_pad_push (pad->pad, - GST_DATA (gst_event_new (GST_EVENT_FLUSH)));); + FOR_PAD_IN_CURRENT_CHAIN (ogg, pad, if (GST_PAD_IS_USABLE (pad->pad)) + gst_pad_push (pad->pad, + GST_DATA (gst_event_new (GST_EVENT_FLUSH)));); } GST_OGG_SET_STATE (ogg, GST_OGG_STATE_SEEK); FOR_PAD_IN_CURRENT_CHAIN (ogg, pad, - pad->flags |= GST_OGG_PAD_NEEDS_DISCONT;); + pad->flags |= GST_OGG_PAD_NEEDS_DISCONT;); GST_DEBUG_OBJECT (ogg, "initiating seeking to offset %" G_GUINT64_FORMAT, - offset); + offset); ogg->seek_pad = cur; ogg->seek_to = offset; gst_event_unref (event); @@ -392,9 +398,9 @@ gst_ogg_start_playing (GstOggDemux * ogg) { GST_DEBUG_OBJECT (ogg, "got EOS in setup, changing to playback now"); if (!gst_pad_send_event (GST_PAD_PEER (ogg->sinkpad), - gst_event_new_seek (GST_FORMAT_BYTES | GST_SEEK_METHOD_SET, 0))) { + gst_event_new_seek (GST_FORMAT_BYTES | GST_SEEK_METHOD_SET, 0))) { GST_ELEMENT_ERROR (ogg, CORE, SEEK, (NULL), - ("cannot seek to start after EOS")); + ("cannot seek to start after EOS")); } ogg->current_chain = 0; GST_FLAG_UNSET (ogg, GST_OGG_FLAG_EOS); @@ -415,30 +421,30 @@ gst_ogg_demux_handle_event (GstPad * pad, GstEvent * event) gst_event_unref (event); GST_FLAG_UNSET (ogg, GST_OGG_FLAG_WAIT_FOR_DISCONT); FOR_PAD_IN_CURRENT_CHAIN (ogg, pad, - pad->flags |= GST_OGG_PAD_NEEDS_DISCONT;); + pad->flags |= GST_OGG_PAD_NEEDS_DISCONT;); break; case GST_EVENT_EOS: if (ogg->state == GST_OGG_STATE_SETUP) { - gst_ogg_start_playing (ogg); + gst_ogg_start_playing (ogg); } else { - guint i; - GSList *walk; - - GST_DEBUG_OBJECT (ogg, "got EOS"); - ogg->current_chain = -1; - for (i = 0; i < ogg->chains->len; i++) { - GstOggChain *chain = &g_array_index (ogg->chains, GstOggChain, i); - - for (walk = chain->pads; walk; walk = g_slist_next (walk)) { - GstOggPad *pad = (GstOggPad *) walk->data; - - if (pad->pad && GST_PAD_IS_USABLE (pad->pad)) { - gst_data_ref (GST_DATA (event)); - gst_pad_push (pad->pad, GST_DATA (event)); - } - } - } - gst_element_set_eos (GST_ELEMENT (ogg)); + guint i; + GSList *walk; + + GST_DEBUG_OBJECT (ogg, "got EOS"); + ogg->current_chain = -1; + for (i = 0; i < ogg->chains->len; i++) { + GstOggChain *chain = &g_array_index (ogg->chains, GstOggChain, i); + + for (walk = chain->pads; walk; walk = g_slist_next (walk)) { + GstOggPad *pad = (GstOggPad *) walk->data; + + if (pad->pad && GST_PAD_IS_USABLE (pad->pad)) { + gst_data_ref (GST_DATA (event)); + gst_pad_push (pad->pad, GST_DATA (event)); + } + } + } + gst_element_set_eos (GST_ELEMENT (ogg)); } gst_event_unref (event); break; @@ -505,7 +511,7 @@ gst_ogg_demux_chain (GstPad * pad, GstData * buffer) if (ogg_sync_wrote (&ogg->sync, GST_BUFFER_SIZE (buffer)) != 0) { gst_data_unref (buffer); GST_ELEMENT_ERROR (ogg, LIBRARY, TOO_LAZY, (NULL), - ("ogg_sync_wrote failed")); + ("ogg_sync_wrote failed")); return; } offset_end = GST_BUFFER_OFFSET_IS_VALID (buffer) ? @@ -517,99 +523,99 @@ gst_ogg_demux_chain (GstPad * pad, GstData * buffer) pageout_ret = ogg_sync_pageout (&ogg->sync, &page); switch (pageout_ret) { case -1: - /* FIXME: need some kind of discont here, we don't know any values to send though, - * we only have the END_OFFSET */ - break; + /* FIXME: need some kind of discont here, we don't know any values to send though, + * we only have the END_OFFSET */ + break; case 0: - if (ogg->state == GST_OGG_STATE_SETUP) { - guint64 length; - GstFormat format = GST_FORMAT_BYTES; - - if (!gst_pad_query (GST_PAD_PEER (ogg->sinkpad), GST_QUERY_TOTAL, - &format, &length)) - length = 0; - if (length <= offset_end) { - gst_ogg_start_playing (ogg); - goto out; - } - } - break; + if (ogg->state == GST_OGG_STATE_SETUP) { + guint64 length; + GstFormat format = GST_FORMAT_BYTES; + + if (!gst_pad_query (GST_PAD_PEER (ogg->sinkpad), GST_QUERY_TOTAL, + &format, &length)) + length = 0; + if (length <= offset_end) { + gst_ogg_start_playing (ogg); + goto out; + } + } + break; case 1: - GST_LOG_OBJECT (ogg, - "processing ogg page (serial %d, packet %ld, granule pos %llu", - ogg_page_serialno (&page), ogg_page_pageno (&page), - ogg_page_granulepos (&page)); - switch (ogg->state) { - case GST_OGG_STATE_SETUP: - if (ogg_page_eos (&page)) { - GstOggPad *cur = gst_ogg_pad_get_in_current_chain (ogg, - ogg_page_serialno (&page)); - - GST_FLAG_SET (ogg, GST_OGG_FLAG_EOS); - if (!cur) { - GST_ERROR_OBJECT (ogg, "unknown serial %d", - ogg_page_serialno (&page)); - } else { - cur->pages = ogg_page_pageno (&page); - cur->length = ogg_page_granulepos (&page); - } - } else { - if (GST_FLAG_IS_SET (ogg, GST_OGG_FLAG_EOS) - && ogg_page_bos (&page)) { - gst_ogg_add_chain (ogg); - } - GST_FLAG_UNSET (ogg, GST_OGG_FLAG_EOS); - } - if (ogg_page_bos (&page)) { - if (gst_ogg_pad_get_in_current_chain (ogg, - ogg_page_serialno (&page))) { - GST_ERROR_OBJECT (ogg, - "multiple BOS page for serial %d (page %ld)", - ogg_page_serialno (&page), ogg_page_pageno (&page)); - } else { - GstOggPad *pad = - gst_ogg_pad_new (ogg, ogg_page_serialno (&page)); - CURRENT_CHAIN (ogg)->pads = - g_slist_prepend (CURRENT_CHAIN (ogg)->pads, pad); - } - GST_FLAG_SET (ogg, GST_OGG_FLAG_BOS); - } else { - GST_FLAG_UNSET (ogg, GST_OGG_FLAG_BOS); - } - break; - case GST_OGG_STATE_START: - if (gst_pad_send_event (GST_PAD_PEER (ogg->sinkpad), - gst_event_new_seek (GST_FORMAT_BYTES | GST_SEEK_METHOD_END, - 0))) { - GST_OGG_SET_STATE (ogg, GST_OGG_STATE_SETUP); - GST_DEBUG_OBJECT (ogg, "stream can seek, try setup now"); - if (!gst_pad_send_event (GST_PAD_PEER (ogg->sinkpad), - gst_event_new_seek (GST_FORMAT_BYTES | - GST_SEEK_METHOD_SET, 0))) { - GST_ELEMENT_ERROR (ogg, CORE, SEEK, (NULL), - ("stream can seek to end, but not to start. Can't handle that.")); - } - gst_ogg_add_chain (ogg); - GST_FLAG_SET (ogg, GST_OGG_FLAG_WAIT_FOR_DISCONT); - goto out; - } - gst_ogg_add_chain (ogg); - GST_OGG_SET_STATE (ogg, GST_OGG_STATE_PLAY); - /* fall through */ - case GST_OGG_STATE_SEEK: - case GST_OGG_STATE_PLAY: - gst_ogg_demux_push (ogg, &page); - break; - default: - g_assert_not_reached (); - break; - } - break; + GST_LOG_OBJECT (ogg, + "processing ogg page (serial %d, packet %ld, granule pos %llu", + ogg_page_serialno (&page), ogg_page_pageno (&page), + ogg_page_granulepos (&page)); + switch (ogg->state) { + case GST_OGG_STATE_SETUP: + if (ogg_page_eos (&page)) { + GstOggPad *cur = gst_ogg_pad_get_in_current_chain (ogg, + ogg_page_serialno (&page)); + + GST_FLAG_SET (ogg, GST_OGG_FLAG_EOS); + if (!cur) { + GST_ERROR_OBJECT (ogg, "unknown serial %d", + ogg_page_serialno (&page)); + } else { + cur->pages = ogg_page_pageno (&page); + cur->length = ogg_page_granulepos (&page); + } + } else { + if (GST_FLAG_IS_SET (ogg, GST_OGG_FLAG_EOS) + && ogg_page_bos (&page)) { + gst_ogg_add_chain (ogg); + } + GST_FLAG_UNSET (ogg, GST_OGG_FLAG_EOS); + } + if (ogg_page_bos (&page)) { + if (gst_ogg_pad_get_in_current_chain (ogg, + ogg_page_serialno (&page))) { + GST_ERROR_OBJECT (ogg, + "multiple BOS page for serial %d (page %ld)", + ogg_page_serialno (&page), ogg_page_pageno (&page)); + } else { + GstOggPad *pad = + gst_ogg_pad_new (ogg, ogg_page_serialno (&page)); + CURRENT_CHAIN (ogg)->pads = + g_slist_prepend (CURRENT_CHAIN (ogg)->pads, pad); + } + GST_FLAG_SET (ogg, GST_OGG_FLAG_BOS); + } else { + GST_FLAG_UNSET (ogg, GST_OGG_FLAG_BOS); + } + break; + case GST_OGG_STATE_START: + if (gst_pad_send_event (GST_PAD_PEER (ogg->sinkpad), + gst_event_new_seek (GST_FORMAT_BYTES | GST_SEEK_METHOD_END, + 0))) { + GST_OGG_SET_STATE (ogg, GST_OGG_STATE_SETUP); + GST_DEBUG_OBJECT (ogg, "stream can seek, try setup now"); + if (!gst_pad_send_event (GST_PAD_PEER (ogg->sinkpad), + gst_event_new_seek (GST_FORMAT_BYTES | + GST_SEEK_METHOD_SET, 0))) { + GST_ELEMENT_ERROR (ogg, CORE, SEEK, (NULL), + ("stream can seek to end, but not to start. Can't handle that.")); + } + gst_ogg_add_chain (ogg); + GST_FLAG_SET (ogg, GST_OGG_FLAG_WAIT_FOR_DISCONT); + goto out; + } + gst_ogg_add_chain (ogg); + GST_OGG_SET_STATE (ogg, GST_OGG_STATE_PLAY); + /* fall through */ + case GST_OGG_STATE_SEEK: + case GST_OGG_STATE_PLAY: + gst_ogg_demux_push (ogg, &page); + break; + default: + g_assert_not_reached (); + break; + } + break; default: - GST_WARNING_OBJECT (ogg, - "unknown return value %d from ogg_sync_pageout", pageout_ret); - pageout_ret = 0; - break; + GST_WARNING_OBJECT (ogg, + "unknown return value %d from ogg_sync_pageout", pageout_ret); + pageout_ret = 0; + break; } } out: @@ -624,7 +630,7 @@ gst_ogg_pad_new (GstOggDemux * ogg, int serial) ret->serial = serial; if (ogg_stream_init (&ret->stream, serial) != 0) { GST_ERROR_OBJECT (ogg, - "Could not initialize ogg_stream struct for serial %d.", serial); + "Could not initialize ogg_stream struct for serial %d.", serial); g_free (ret); return NULL; } @@ -649,8 +655,8 @@ gst_ogg_pad_remove (GstOggDemux * ogg, GstOggPad * pad) } if (ogg_stream_clear (&pad->stream) != 0) GST_ERROR_OBJECT (ogg, - "ogg_stream_clear (serial %d) did not return 0, ignoring this error", - pad->serial); + "ogg_stream_clear (serial %d) did not return 0, ignoring this error", + pad->serial); GST_LOG_OBJECT (ogg, "free ogg src %p for stream with serial %d", pad, pad->serial); g_free (pad); @@ -674,53 +680,53 @@ br: if (ogg_page_bos (page)) { if (cur) { GST_DEBUG_OBJECT (ogg, - "ogg page declared as BOS while stream %d already existed." - "Possibly a seek happened.", cur->serial); + "ogg page declared as BOS while stream %d already existed." + "Possibly a seek happened.", cur->serial); } else if (cur) { GST_DEBUG_OBJECT (ogg, "reactivating deactivated stream %d.", - cur->serial); + cur->serial); } else { /* FIXME: monitor if we are still in creation stage? */ cur = gst_ogg_pad_new (ogg, ogg_page_serialno (page)); if (!cur) { - GST_ELEMENT_ERROR (ogg, LIBRARY, TOO_LAZY, (NULL), - ("Creating ogg_stream struct failed.")); - return; + GST_ELEMENT_ERROR (ogg, LIBRARY, TOO_LAZY, (NULL), + ("Creating ogg_stream struct failed.")); + return; } if (ogg->current_chain == -1) { - /* add new one at the end */ - gst_ogg_add_chain (ogg); + /* add new one at the end */ + gst_ogg_add_chain (ogg); } CURRENT_CHAIN (ogg)->pads = - g_slist_prepend (CURRENT_CHAIN (ogg)->pads, cur); + g_slist_prepend (CURRENT_CHAIN (ogg)->pads, cur); } } if (cur == NULL) { GST_ELEMENT_ERROR (ogg, STREAM, DECODE, (NULL), - ("invalid ogg stream serial no")); + ("invalid ogg stream serial no")); return; } if (ogg_stream_pagein (&cur->stream, page) != 0) { GST_WARNING_OBJECT (ogg, - "ogg stream choked on page (serial %d), resetting stream", cur->serial); + "ogg stream choked on page (serial %d), resetting stream", cur->serial); gst_ogg_pad_reset (ogg, cur); return; } switch (ogg->state) { case GST_OGG_STATE_SEEK: GST_LOG_OBJECT (ogg, - "in seek - offset now: %" G_GUINT64_FORMAT - " (pad %d) - desired offset %" G_GUINT64_FORMAT " (pad %d)", - cur->known_offset, cur->serial, ogg->seek_to, ogg->seek_pad->serial); + "in seek - offset now: %" G_GUINT64_FORMAT + " (pad %d) - desired offset %" G_GUINT64_FORMAT " (pad %d)", + cur->known_offset, cur->serial, ogg->seek_to, ogg->seek_pad->serial); if (cur == ogg->seek_pad) { - if (ogg_page_granulepos (page) > ogg->seek_to) { - GST_OGG_SET_STATE (ogg, GST_OGG_STATE_PLAY); - GST_DEBUG_OBJECT (ogg, - "ended seek at offset %" G_GUINT64_FORMAT " (requested %" - G_GUINT64_FORMAT, cur->known_offset, ogg->seek_to); - ogg->seek_pad = NULL; - ogg->seek_to = 0; - } + if (ogg_page_granulepos (page) > ogg->seek_to) { + GST_OGG_SET_STATE (ogg, GST_OGG_STATE_PLAY); + GST_DEBUG_OBJECT (ogg, + "ended seek at offset %" G_GUINT64_FORMAT " (requested %" + G_GUINT64_FORMAT, cur->known_offset, ogg->seek_to); + ogg->seek_pad = NULL; + ogg->seek_to = 0; + } } /* fallthrough */ case GST_OGG_STATE_PLAY: @@ -733,7 +739,7 @@ br: } if (ogg_page_eos (page)) { GST_DEBUG_OBJECT (ogg, "got EOS for stream with serial %d, sending EOS now", - cur->serial); + cur->serial); #if 0 /* Removing pads while PLAYING doesn't work with current schedulers */ /* remove from list, as this will never be called again */ @@ -755,74 +761,74 @@ gst_ogg_pad_push (GstOggDemux * ogg, GstOggPad * pad) ret = ogg_stream_packetout (&pad->stream, &packet); switch (ret) { case 0: - return; + return; case -1: - gst_ogg_pad_reset (ogg, pad); - break; + gst_ogg_pad_reset (ogg, pad); + break; case 1:{ - /* only push data when playing, not during seek or similar */ - if (ogg->state != GST_OGG_STATE_PLAY) - continue; - if (!pad->pad) { - GstCaps *caps = gst_ogg_type_find (&packet); - gchar *name = g_strdup_printf ("serial_%d", pad->serial); - - if (caps == NULL) { - GST_WARNING_OBJECT (ogg, - "couldn't find caps for stream with serial %d", pad->serial); - caps = gst_caps_new_simple ("application/octet-stream", NULL); - } - pad->pad = - gst_pad_new_from_template (gst_static_pad_template_get - (&ogg_demux_src_template_factory), name); - g_free (name); - gst_pad_set_event_function (pad->pad, - GST_DEBUG_FUNCPTR (gst_ogg_demux_src_event)); - gst_pad_set_event_mask_function (pad->pad, - GST_DEBUG_FUNCPTR (gst_ogg_demux_get_event_masks)); - gst_pad_set_query_function (pad->pad, - GST_DEBUG_FUNCPTR (gst_ogg_demux_src_query)); - gst_pad_set_query_type_function (pad->pad, - GST_DEBUG_FUNCPTR (gst_ogg_demux_get_query_types)); - gst_pad_use_explicit_caps (pad->pad); - gst_pad_set_explicit_caps (pad->pad, caps); - gst_pad_set_active (pad->pad, TRUE); - gst_element_add_pad (GST_ELEMENT (ogg), pad->pad); - } - /* check for discont */ - if (packet.packetno != pad->packetno++) { - pad->flags |= GST_OGG_PAD_NEEDS_DISCONT; - pad->packetno = packet.packetno + 1; - } - /* send discont if needed */ - if ((pad->flags & GST_OGG_PAD_NEEDS_DISCONT) - && GST_PAD_IS_USABLE (pad->pad)) { - GstEvent *event = gst_event_new_discontinuous (FALSE, - GST_FORMAT_DEFAULT, pad->known_offset); /* FIXME: this might be wrong because we can only use the last known offset */ - - gst_pad_push (pad->pad, GST_DATA (event)); - pad->flags &= (~GST_OGG_PAD_NEEDS_DISCONT); - }; - /* optimization: use a bufferpool containing the ogg packet? */ - buf = - gst_pad_alloc_buffer (pad->pad, GST_BUFFER_OFFSET_NONE, - packet.bytes); - memcpy (buf->data, packet.packet, packet.bytes); - if (pad->offset != -1) - GST_BUFFER_OFFSET (buf) = pad->offset; - if (packet.granulepos != -1) - GST_BUFFER_OFFSET_END (buf) = packet.granulepos; - pad->offset = packet.granulepos; - if (GST_PAD_IS_USABLE (pad->pad)) - gst_pad_push (pad->pad, GST_DATA (buf)); - break; + /* only push data when playing, not during seek or similar */ + if (ogg->state != GST_OGG_STATE_PLAY) + continue; + if (!pad->pad) { + GstCaps *caps = gst_ogg_type_find (&packet); + gchar *name = g_strdup_printf ("serial_%d", pad->serial); + + if (caps == NULL) { + GST_WARNING_OBJECT (ogg, + "couldn't find caps for stream with serial %d", pad->serial); + caps = gst_caps_new_simple ("application/octet-stream", NULL); + } + pad->pad = + gst_pad_new_from_template (gst_static_pad_template_get + (&ogg_demux_src_template_factory), name); + g_free (name); + gst_pad_set_event_function (pad->pad, + GST_DEBUG_FUNCPTR (gst_ogg_demux_src_event)); + gst_pad_set_event_mask_function (pad->pad, + GST_DEBUG_FUNCPTR (gst_ogg_demux_get_event_masks)); + gst_pad_set_query_function (pad->pad, + GST_DEBUG_FUNCPTR (gst_ogg_demux_src_query)); + gst_pad_set_query_type_function (pad->pad, + GST_DEBUG_FUNCPTR (gst_ogg_demux_get_query_types)); + gst_pad_use_explicit_caps (pad->pad); + gst_pad_set_explicit_caps (pad->pad, caps); + gst_pad_set_active (pad->pad, TRUE); + gst_element_add_pad (GST_ELEMENT (ogg), pad->pad); + } + /* check for discont */ + if (packet.packetno != pad->packetno++) { + pad->flags |= GST_OGG_PAD_NEEDS_DISCONT; + pad->packetno = packet.packetno + 1; + } + /* send discont if needed */ + if ((pad->flags & GST_OGG_PAD_NEEDS_DISCONT) + && GST_PAD_IS_USABLE (pad->pad)) { + GstEvent *event = gst_event_new_discontinuous (FALSE, + GST_FORMAT_DEFAULT, pad->known_offset); /* FIXME: this might be wrong because we can only use the last known offset */ + + gst_pad_push (pad->pad, GST_DATA (event)); + pad->flags &= (~GST_OGG_PAD_NEEDS_DISCONT); + }; + /* optimization: use a bufferpool containing the ogg packet? */ + buf = + gst_pad_alloc_buffer (pad->pad, GST_BUFFER_OFFSET_NONE, + packet.bytes); + memcpy (buf->data, packet.packet, packet.bytes); + if (pad->offset != -1) + GST_BUFFER_OFFSET (buf) = pad->offset; + if (packet.granulepos != -1) + GST_BUFFER_OFFSET_END (buf) = packet.granulepos; + pad->offset = packet.granulepos; + if (GST_PAD_IS_USABLE (pad->pad)) + gst_pad_push (pad->pad, GST_DATA (buf)); + break; } default: - GST_ERROR_OBJECT (ogg, - "invalid return value %d for ogg_stream_packetout, resetting stream", - ret); - gst_ogg_pad_reset (ogg, pad); - break; + GST_ERROR_OBJECT (ogg, + "invalid return value %d for ogg_stream_packetout, resetting stream", + ret); + gst_ogg_pad_reset (ogg, pad); + break; } } } @@ -897,7 +903,8 @@ typedef struct ogg_packet *packet; guint best_probability; GstCaps *caps; -} OggTypeFind; +} +OggTypeFind; static guint8 * ogg_find_peek (gpointer data, gint64 offset, guint size) { @@ -975,7 +982,7 @@ GST_PLUGIN_DEFINE (GST_VERSION_MAJOR, GstOggChain *chain = &g_array_index (ogg->chains, GstOggChain, i); GST_INFO_OBJECT (ogg, "chain %d (%u streams):", i, - g_slist_length (chain->pads)); + g_slist_length (chain->pads)); for (walk = chain->pads; walk; walk = g_slist_next (walk)) { GstOggPad *pad = (GstOggPad *) walk->data; diff --git a/ext/pango/gsttextoverlay.c b/ext/pango/gsttextoverlay.c index d0b40294b8..17f5eca73a 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 9ce5c89760..3ec20bcbb6 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/theora/theoradec.c b/ext/theora/theoradec.c index 128f3106be..b937d610a2 100644 --- a/ext/theora/theoradec.c +++ b/ext/theora/theoradec.c @@ -73,9 +73,9 @@ GST_STATIC_PAD_TEMPLATE ("src", GST_PAD_SRC, GST_PAD_ALWAYS, GST_STATIC_CAPS ("video/x-raw-yuv, " - "format = (fourcc) I420, " - "framerate = (double) [0, MAX], " - "width = (int) [ 1, MAX ], " "height = (int) [ 1, MAX ]") + "format = (fourcc) I420, " + "framerate = (double) [0, MAX], " + "width = (int) [ 1, MAX ], " "height = (int) [ 1, MAX ]") ); static GstStaticPadTemplate theora_dec_sink_factory = @@ -165,8 +165,8 @@ theora_dec_from_granulepos (GstTheoraDec * dec, GstFormat format, guint64 from, switch (format) { case GST_FORMAT_TIME: *to = framecount = - from * GST_SECOND * dec->info.fps_denominator / - dec->info.fps_numerator; + from * GST_SECOND * dec->info.fps_denominator / + dec->info.fps_numerator; break; case GST_FORMAT_DEFAULT: *to = framecount; @@ -193,8 +193,8 @@ theora_dec_to_granulepos (GstTheoraDec * dec, GstFormat format, guint64 from, switch (format) { case GST_FORMAT_TIME: framecount = - from * dec->info.fps_numerator / (GST_SECOND * - dec->info.fps_denominator); + from * dec->info.fps_numerator / (GST_SECOND * + dec->info.fps_denominator); break; case GST_FORMAT_DEFAULT: framecount = from; @@ -218,7 +218,7 @@ theora_dec_src_query (GstPad * pad, GstQueryType query, GstFormat * format, GstFormat my_format = GST_FORMAT_DEFAULT; if (!gst_pad_query (GST_PAD_PEER (dec->sinkpad), query, &my_format, - &granulepos)) + &granulepos)) return FALSE; if (!theora_dec_from_granulepos (dec, *format, granulepos, value)) @@ -243,14 +243,14 @@ theora_dec_src_event (GstPad * pad, GstEvent * event) guint64 value; res = theora_dec_to_granulepos (dec, GST_EVENT_SEEK_FORMAT (event), - GST_EVENT_SEEK_OFFSET (event), &value); + GST_EVENT_SEEK_OFFSET (event), &value); if (res) { - GstEvent *real_seek = gst_event_new_seek ( - (GST_EVENT_SEEK_TYPE (event) & ~GST_SEEK_FORMAT_MASK) | - GST_FORMAT_DEFAULT, - value); + GstEvent *real_seek = gst_event_new_seek ( + (GST_EVENT_SEEK_TYPE (event) & ~GST_SEEK_FORMAT_MASK) | + GST_FORMAT_DEFAULT, + value); - res = gst_pad_send_event (GST_PAD_PEER (dec->sinkpad), real_seek); + res = gst_pad_send_event (GST_PAD_PEER (dec->sinkpad), real_seek); } gst_event_unref (event); break; @@ -272,39 +272,39 @@ theora_dec_event (GstTheoraDec * dec, GstEvent * event) switch (GST_EVENT_TYPE (event)) { case GST_EVENT_DISCONTINUOUS: if (gst_event_discont_get_value (event, GST_FORMAT_DEFAULT, &value)) { - dec->granulepos = value; - GST_DEBUG_OBJECT (dec, - "setting granuleposition to %" G_GUINT64_FORMAT " after discont\n", - value); + dec->granulepos = value; + GST_DEBUG_OBJECT (dec, + "setting granuleposition to %" G_GUINT64_FORMAT " after discont\n", + value); } else { - GST_WARNING_OBJECT (dec, - "discont event didn't include offset, we might set it wrong now"); + GST_WARNING_OBJECT (dec, + "discont event didn't include offset, we might set it wrong now"); } if (dec->packetno < 3) { - if (dec->granulepos != 0) - GST_ELEMENT_ERROR (dec, STREAM, DECODE, (NULL), - ("can't handle discont before parsing first 3 packets")); - dec->packetno = 0; - gst_pad_push (dec->srcpad, GST_DATA (gst_event_new_discontinuous (FALSE, - GST_FORMAT_TIME, (guint64) 0, GST_FORMAT_DEFAULT, - (guint64) 0, GST_FORMAT_BYTES, (guint64) 0, 0))); + if (dec->granulepos != 0) + GST_ELEMENT_ERROR (dec, STREAM, DECODE, (NULL), + ("can't handle discont before parsing first 3 packets")); + dec->packetno = 0; + gst_pad_push (dec->srcpad, GST_DATA (gst_event_new_discontinuous (FALSE, + GST_FORMAT_TIME, (guint64) 0, GST_FORMAT_DEFAULT, + (guint64) 0, GST_FORMAT_BYTES, (guint64) 0, 0))); } else { - dec->packetno = 3; - /* if one of them works, all of them work */ - if (theora_dec_from_granulepos (dec, GST_FORMAT_TIME, dec->granulepos, - &time) - && theora_dec_from_granulepos (dec, GST_FORMAT_DEFAULT, - dec->granulepos, &value) - && theora_dec_from_granulepos (dec, GST_FORMAT_BYTES, - dec->granulepos, &bytes)) { - gst_pad_push (dec->srcpad, - GST_DATA (gst_event_new_discontinuous (FALSE, GST_FORMAT_TIME, - time, GST_FORMAT_DEFAULT, value, GST_FORMAT_BYTES, bytes, - 0))); - } else { - GST_ERROR_OBJECT (dec, - "failed to parse data for DISCONT event, not sending any"); - } + dec->packetno = 3; + /* if one of them works, all of them work */ + if (theora_dec_from_granulepos (dec, GST_FORMAT_TIME, dec->granulepos, + &time) + && theora_dec_from_granulepos (dec, GST_FORMAT_DEFAULT, + dec->granulepos, &value) + && theora_dec_from_granulepos (dec, GST_FORMAT_BYTES, + dec->granulepos, &bytes)) { + gst_pad_push (dec->srcpad, + GST_DATA (gst_event_new_discontinuous (FALSE, GST_FORMAT_TIME, + time, GST_FORMAT_DEFAULT, value, GST_FORMAT_BYTES, bytes, + 0))); + } else { + GST_ERROR_OBJECT (dec, + "failed to parse data for DISCONT event, not sending any"); + } } break; default: @@ -339,27 +339,27 @@ theora_dec_chain (GstPad * pad, GstData * data) /* header packet */ if (theora_decode_header (&dec->info, &dec->comment, &packet)) { GST_ELEMENT_ERROR (GST_ELEMENT (dec), STREAM, DECODE, - (NULL), ("couldn't read header packet")); + (NULL), ("couldn't read header packet")); gst_data_unref (data); return; } if (packet.packetno == 1) { gchar *encoder = NULL; GstTagList *list = - gst_tag_list_from_vorbiscomment_buffer (buf, "\201theora", 7, - &encoder); + gst_tag_list_from_vorbiscomment_buffer (buf, "\201theora", 7, + &encoder); if (!list) { - GST_ERROR_OBJECT (dec, "failed to parse tags"); - list = gst_tag_list_new (); + GST_ERROR_OBJECT (dec, "failed to parse tags"); + list = gst_tag_list_new (); } if (encoder) { - gst_tag_list_add (list, GST_TAG_MERGE_REPLACE, - GST_TAG_ENCODER, encoder, NULL); - g_free (encoder); + gst_tag_list_add (list, GST_TAG_MERGE_REPLACE, + GST_TAG_ENCODER, encoder, NULL); + g_free (encoder); } gst_tag_list_add (list, GST_TAG_MERGE_REPLACE, - GST_TAG_ENCODER_VERSION, dec->info.version_major, NULL); + GST_TAG_ENCODER_VERSION, dec->info.version_major, NULL); gst_element_found_tags_for_pad (GST_ELEMENT (dec), dec->srcpad, 0, list); } else if (packet.packetno == 2) { GstCaps *caps; @@ -367,11 +367,11 @@ theora_dec_chain (GstPad * pad, GstData * data) /* done */ theora_decode_init (&dec->state, &dec->info); caps = gst_caps_new_simple ("video/x-raw-yuv", - "format", GST_TYPE_FOURCC, GST_MAKE_FOURCC ('I', '4', '2', '0'), - "framerate", G_TYPE_DOUBLE, - ((gdouble) dec->info.fps_numerator) / dec->info.fps_denominator, - "width", G_TYPE_INT, dec->info.width, "height", G_TYPE_INT, - dec->info.height, NULL); + "format", GST_TYPE_FOURCC, GST_MAKE_FOURCC ('I', '4', '2', '0'), + "framerate", G_TYPE_DOUBLE, + ((gdouble) dec->info.fps_numerator) / dec->info.fps_denominator, + "width", G_TYPE_INT, dec->info.width, "height", G_TYPE_INT, + dec->info.height, NULL); gst_pad_set_explicit_caps (dec->srcpad, caps); gst_caps_free (caps); } @@ -391,43 +391,43 @@ theora_dec_chain (GstPad * pad, GstData * data) time = GST_TIMEVAL_TO_TIME (tv); #endif if (theora_decode_packetin (&dec->state, &packet)) { - GST_ELEMENT_ERROR (GST_ELEMENT (dec), STREAM, DECODE, - (NULL), ("theora decoder did not read data packet")); - gst_data_unref (data); - return; + GST_ELEMENT_ERROR (GST_ELEMENT (dec), STREAM, DECODE, + (NULL), ("theora decoder did not read data packet")); + gst_data_unref (data); + return; } if (theora_decode_YUVout (&dec->state, &yuv) < 0) { - GST_ELEMENT_ERROR (GST_ELEMENT (dec), STREAM, DECODE, - (NULL), ("couldn't read out YUV image")); - gst_data_unref (data); - return; + GST_ELEMENT_ERROR (GST_ELEMENT (dec), STREAM, DECODE, + (NULL), ("couldn't read out YUV image")); + gst_data_unref (data); + return; } g_return_if_fail (yuv.y_width == dec->info.width); g_return_if_fail (yuv.y_height == dec->info.height); out = gst_pad_alloc_buffer (dec->srcpad, GST_BUFFER_OFFSET_NONE, - yuv.y_width * yuv.y_height * 12 / 8); + yuv.y_width * yuv.y_height * 12 / 8); y = GST_BUFFER_DATA (out); u = y + yuv.y_width * yuv.y_height; v = u + yuv.y_width * yuv.y_height / 4; for (i = 0; i < yuv.y_height; i++) { - memcpy (y + i * yuv.y_width, yuv.y + i * yuv.y_stride, yuv.y_width); + memcpy (y + i * yuv.y_width, yuv.y + i * yuv.y_stride, yuv.y_width); } for (i = 0; i < yuv.y_height / 2; i++) { - memcpy (u + i * yuv.uv_width, yuv.u + i * yuv.uv_stride, yuv.uv_width); - memcpy (v + i * yuv.uv_width, yuv.v + i * yuv.uv_stride, yuv.uv_width); + memcpy (u + i * yuv.uv_width, yuv.u + i * yuv.uv_stride, yuv.uv_width); + memcpy (v + i * yuv.uv_width, yuv.v + i * yuv.uv_stride, yuv.uv_width); } GST_BUFFER_OFFSET (out) = dec->packetno - 4; GST_BUFFER_OFFSET_END (out) = dec->packetno - 3; GST_BUFFER_DURATION (out) = - GST_SECOND * ((gdouble) dec->info.fps_denominator) / - dec->info.fps_numerator; + GST_SECOND * ((gdouble) dec->info.fps_denominator) / + dec->info.fps_numerator; GST_BUFFER_TIMESTAMP (out) = - GST_BUFFER_OFFSET (out) * GST_BUFFER_DURATION (out); + GST_BUFFER_OFFSET (out) * GST_BUFFER_DURATION (out); #if 0 g_get_current_time (&tv); time = GST_TIMEVAL_TO_TIME (tv) - time; if (time > 10000000) - g_print ("w00t, you're sl0000w!! - %llu\n", time); + g_print ("w00t, you're sl0000w!! - %llu\n", time); } #endif gst_pad_push (dec->srcpad, GST_DATA (out)); @@ -475,7 +475,7 @@ plugin_init (GstPlugin * plugin) return FALSE; if (!gst_element_register (plugin, "theoradec", GST_RANK_SECONDARY, - gst_theora_dec_get_type ())) + gst_theora_dec_get_type ())) return FALSE; return TRUE; diff --git a/ext/vorbis/vorbis.c b/ext/vorbis/vorbis.c index 879a73b93a..2369d26f27 100644 --- a/ext/vorbis/vorbis.c +++ b/ext/vorbis/vorbis.c @@ -36,11 +36,11 @@ plugin_init (GstPlugin * plugin) return FALSE; if (!gst_element_register (plugin, "vorbisenc", GST_RANK_NONE, - GST_TYPE_VORBISENC)) + GST_TYPE_VORBISENC)) return FALSE; if (!gst_element_register (plugin, "vorbisdec", GST_RANK_PRIMARY, - gst_vorbis_dec_get_type ())) + gst_vorbis_dec_get_type ())) return FALSE; GST_DEBUG_CATEGORY_INIT (vorbisdec_debug, "vorbisdec", 0, diff --git a/ext/vorbis/vorbisdec.c b/ext/vorbis/vorbisdec.c index 961a851570..a9b86e27b7 100644 --- a/ext/vorbis/vorbisdec.c +++ b/ext/vorbis/vorbisdec.c @@ -52,14 +52,14 @@ GST_STATIC_PAD_TEMPLATE ("src", GST_PAD_SRC, GST_PAD_ALWAYS, GST_STATIC_CAPS ("audio/x-raw-float, " - "rate = (int) [ 11025, 48000 ], " - "channels = (int) [ 1, 2 ], " "endianness = (int) BYTE_ORDER, " + "rate = (int) [ 11025, 48000 ], " + "channels = (int) [ 1, 2 ], " "endianness = (int) BYTE_ORDER, " /* no ifdef in macros, please #ifdef GST_VORBIS_DEC_SEQUENTIAL "layout = \"sequential\", " #endif */ - "width = (int) 32, " "buffer-frames = (int) 0") + "width = (int) 32, " "buffer-frames = (int) 0") ); static GstStaticPadTemplate vorbis_dec_sink_factory = @@ -114,6 +114,7 @@ vorbis_dec_get_formats (GstPad * pad) GST_FORMAT_TIME, 0 }; + return (GST_PAD_IS_SRC (pad) ? src_formats : sink_formats); } @@ -224,7 +225,7 @@ vorbis_dec_src_query (GstPad * pad, GstQueryType query, GstFormat * format, GstFormat my_format = GST_FORMAT_DEFAULT; if (!gst_pad_query (GST_PAD_PEER (dec->sinkpad), query, &my_format, - &granulepos)) + &granulepos)) return FALSE; if (!vorbis_dec_from_granulepos (dec, *format, granulepos, value)) @@ -247,14 +248,14 @@ vorbis_dec_src_event (GstPad * pad, GstEvent * event) guint64 value; res = vorbis_dec_to_granulepos (dec, GST_EVENT_SEEK_FORMAT (event), - GST_EVENT_SEEK_OFFSET (event), &value); + GST_EVENT_SEEK_OFFSET (event), &value); if (res) { - GstEvent *real_seek = gst_event_new_seek ( - (GST_EVENT_SEEK_TYPE (event) & ~GST_SEEK_FORMAT_MASK) | - GST_FORMAT_DEFAULT, - value); + GstEvent *real_seek = gst_event_new_seek ( + (GST_EVENT_SEEK_TYPE (event) & ~GST_SEEK_FORMAT_MASK) | + GST_FORMAT_DEFAULT, + value); - res = gst_pad_send_event (GST_PAD_PEER (dec->sinkpad), real_seek); + res = gst_pad_send_event (GST_PAD_PEER (dec->sinkpad), real_seek); } gst_event_unref (event); break; @@ -275,41 +276,41 @@ vorbis_dec_event (GstVorbisDec * dec, GstEvent * event) switch (GST_EVENT_TYPE (event)) { case GST_EVENT_DISCONTINUOUS: if (gst_event_discont_get_value (event, GST_FORMAT_DEFAULT, &value)) { - dec->granulepos = value; - GST_DEBUG_OBJECT (dec, - "setting granuleposition to %" G_GUINT64_FORMAT " after discont", - value); + dec->granulepos = value; + GST_DEBUG_OBJECT (dec, + "setting granuleposition to %" G_GUINT64_FORMAT " after discont", + value); } else { - GST_WARNING_OBJECT (dec, - "discont event didn't include offset, we might set it wrong now"); + GST_WARNING_OBJECT (dec, + "discont event didn't include offset, we might set it wrong now"); } if (dec->packetno < 3) { - if (dec->granulepos != 0) - GST_ELEMENT_ERROR (dec, STREAM, DECODE, (NULL), - ("can't handle discont before parsing first 3 packets")); - dec->packetno = 0; - gst_pad_push (dec->srcpad, GST_DATA (gst_event_new_discontinuous (FALSE, - GST_FORMAT_TIME, (guint64) 0, GST_FORMAT_DEFAULT, - (guint64) 0, GST_FORMAT_BYTES, (guint64) 0, 0))); + if (dec->granulepos != 0) + GST_ELEMENT_ERROR (dec, STREAM, DECODE, (NULL), + ("can't handle discont before parsing first 3 packets")); + dec->packetno = 0; + gst_pad_push (dec->srcpad, GST_DATA (gst_event_new_discontinuous (FALSE, + GST_FORMAT_TIME, (guint64) 0, GST_FORMAT_DEFAULT, + (guint64) 0, GST_FORMAT_BYTES, (guint64) 0, 0))); } else { - dec->packetno = 3; - /* if one of them works, all of them work */ - if (vorbis_dec_from_granulepos (dec, GST_FORMAT_TIME, dec->granulepos, - &time) - && vorbis_dec_from_granulepos (dec, GST_FORMAT_DEFAULT, - dec->granulepos, &value) - && vorbis_dec_from_granulepos (dec, GST_FORMAT_BYTES, - dec->granulepos, &bytes)) { - gst_pad_push (dec->srcpad, - GST_DATA (gst_event_new_discontinuous (FALSE, GST_FORMAT_TIME, - time, GST_FORMAT_DEFAULT, value, GST_FORMAT_BYTES, bytes, - 0))); - } else { - GST_ERROR_OBJECT (dec, - "failed to parse data for DISCONT event, not sending any"); - } + dec->packetno = 3; + /* if one of them works, all of them work */ + if (vorbis_dec_from_granulepos (dec, GST_FORMAT_TIME, dec->granulepos, + &time) + && vorbis_dec_from_granulepos (dec, GST_FORMAT_DEFAULT, + dec->granulepos, &value) + && vorbis_dec_from_granulepos (dec, GST_FORMAT_BYTES, + dec->granulepos, &bytes)) { + gst_pad_push (dec->srcpad, + GST_DATA (gst_event_new_discontinuous (FALSE, GST_FORMAT_TIME, + time, GST_FORMAT_DEFAULT, value, GST_FORMAT_BYTES, bytes, + 0))); + } else { + GST_ERROR_OBJECT (dec, + "failed to parse data for DISCONT event, not sending any"); + } #ifdef HAVE_VORBIS_SYNTHESIS_RESTART - vorbis_synthesis_restart (&dec->vd); + vorbis_synthesis_restart (&dec->vd); #endif } break; @@ -324,7 +325,7 @@ vorbis_dec_chain (GstPad * pad, GstData * data) { GstBuffer *buf; GstVorbisDec *vd; - ogg_packet packet; /* lol */ + ogg_packet packet; /* lol */ vd = GST_VORBIS_DEC (gst_pad_get_parent (pad)); if (GST_IS_EVENT (data)) { @@ -344,50 +345,50 @@ vorbis_dec_chain (GstPad * pad, GstData * data) if (packet.packet[0] / 2 != packet.packetno) { /* FIXME: just skip? */ GST_ELEMENT_ERROR (GST_ELEMENT (vd), STREAM, DECODE, - (NULL), ("unexpected packet type %d, expected %d", - (gint) packet.packet[0], (gint) packet.packetno)); + (NULL), ("unexpected packet type %d, expected %d", + (gint) packet.packet[0], (gint) packet.packetno)); gst_data_unref (data); return; } if (vorbis_synthesis_headerin (&vd->vi, &vd->vc, &packet)) { GST_ELEMENT_ERROR (GST_ELEMENT (vd), STREAM, DECODE, - (NULL), ("couldn't read header packet")); + (NULL), ("couldn't read header packet")); gst_data_unref (data); return; } if (packet.packetno == 1) { gchar *encoder = NULL; GstTagList *list = - gst_tag_list_from_vorbiscomment_buffer (buf, "\003vorbis", 7, - &encoder); + gst_tag_list_from_vorbiscomment_buffer (buf, "\003vorbis", 7, + &encoder); if (!list) { - GST_ERROR_OBJECT (vd, "couldn't decode comments"); - list = gst_tag_list_new (); + GST_ERROR_OBJECT (vd, "couldn't decode comments"); + list = gst_tag_list_new (); } if (encoder) { - gst_tag_list_add (list, GST_TAG_MERGE_REPLACE, - GST_TAG_ENCODER, encoder, NULL); - g_free (encoder); + gst_tag_list_add (list, GST_TAG_MERGE_REPLACE, + GST_TAG_ENCODER, encoder, NULL); + g_free (encoder); } gst_tag_list_add (list, GST_TAG_MERGE_REPLACE, - GST_TAG_ENCODER_VERSION, vd->vi.version, NULL); + GST_TAG_ENCODER_VERSION, vd->vi.version, NULL); if (vd->vi.bitrate_upper > 0) - gst_tag_list_add (list, GST_TAG_MERGE_REPLACE, - GST_TAG_MAXIMUM_BITRATE, (guint) vd->vi.bitrate_upper, NULL); + gst_tag_list_add (list, GST_TAG_MERGE_REPLACE, + GST_TAG_MAXIMUM_BITRATE, (guint) vd->vi.bitrate_upper, NULL); if (vd->vi.bitrate_nominal > 0) - gst_tag_list_add (list, GST_TAG_MERGE_REPLACE, - GST_TAG_NOMINAL_BITRATE, (guint) vd->vi.bitrate_nominal, NULL); + gst_tag_list_add (list, GST_TAG_MERGE_REPLACE, + GST_TAG_NOMINAL_BITRATE, (guint) vd->vi.bitrate_nominal, NULL); if (vd->vi.bitrate_lower > 0) - gst_tag_list_add (list, GST_TAG_MERGE_REPLACE, - GST_TAG_MINIMUM_BITRATE, (guint) vd->vi.bitrate_lower, NULL); + gst_tag_list_add (list, GST_TAG_MERGE_REPLACE, + GST_TAG_MINIMUM_BITRATE, (guint) vd->vi.bitrate_lower, NULL); gst_element_found_tags_for_pad (GST_ELEMENT (vd), vd->srcpad, 0, list); } else if (packet.packetno == 2) { /* done */ vorbis_synthesis_init (&vd->vd, &vd->vi); vorbis_block_init (&vd->vd, &vd->vb); if (gst_pad_is_linked (vd->srcpad)) - gst_pad_renegotiate (vd->srcpad); + gst_pad_renegotiate (vd->srcpad); } } else { float **pcm; @@ -396,13 +397,13 @@ vorbis_dec_chain (GstPad * pad, GstData * data) /* normal data packet */ if (vorbis_synthesis (&vd->vb, &packet)) { GST_ELEMENT_ERROR (GST_ELEMENT (vd), STREAM, DECODE, - (NULL), ("couldn't read data packet")); + (NULL), ("couldn't read data packet")); gst_data_unref (data); return; } if (vorbis_synthesis_blockin (&vd->vd, &vd->vb) < 0) { GST_ELEMENT_ERROR (GST_ELEMENT (vd), STREAM, DECODE, - (NULL), ("vorbis decoder did not accept data packet")); + (NULL), ("vorbis decoder did not accept data packet")); gst_data_unref (data); return; } @@ -410,20 +411,20 @@ vorbis_dec_chain (GstPad * pad, GstData * data) if (sample_count > 0) { int i, j; GstBuffer *out = gst_pad_alloc_buffer (vd->srcpad, GST_BUFFER_OFFSET_NONE, - sample_count * vd->vi.channels * sizeof (float)); + sample_count * vd->vi.channels * sizeof (float)); float *out_data = (float *) GST_BUFFER_DATA (out); #ifdef GST_VORBIS_DEC_SEQUENTIAL for (i = 0; i < vd->vi.channels; i++) { - memcpy (out_data, pcm[i], sample_count * sizeof (float)); - out_data += sample_count; + memcpy (out_data, pcm[i], sample_count * sizeof (float)); + out_data += sample_count; } #else for (j = 0; j < sample_count; j++) { - for (i = 0; i < vd->vi.channels; i++) { - *out_data = pcm[i][j]; - out_data++; - } + for (i = 0; i < vd->vi.channels; i++) { + *out_data = pcm[i][j]; + out_data++; + } } #endif GST_BUFFER_OFFSET (out) = vd->granulepos; diff --git a/ext/vorbis/vorbisenc.c b/ext/vorbis/vorbisenc.c index ddb7673d7e..50cafb599c 100644 --- a/ext/vorbis/vorbisenc.c +++ b/ext/vorbis/vorbisenc.c @@ -123,11 +123,11 @@ vorbisenc_get_type (void) }; vorbisenc_type = - g_type_register_static (GST_TYPE_ELEMENT, "VorbisEnc", &vorbisenc_info, - 0); + g_type_register_static (GST_TYPE_ELEMENT, "VorbisEnc", &vorbisenc_info, + 0); g_type_add_interface_static (vorbisenc_type, GST_TYPE_TAG_SETTER, - &tag_setter_info); + &tag_setter_info); } return vorbisenc_type; } @@ -182,30 +182,30 @@ gst_vorbisenc_class_init (VorbisEncClass * klass) g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_MAX_BITRATE, g_param_spec_int ("max_bitrate", "Max bitrate", - " Specify a minimum bitrate (in bps). Useful for encoding for a fixed-size channel", - -1, G_MAXINT, MAX_BITRATE_DEFAULT, G_PARAM_READWRITE)); + " Specify a minimum bitrate (in bps). Useful for encoding for a fixed-size channel", + -1, G_MAXINT, MAX_BITRATE_DEFAULT, G_PARAM_READWRITE)); g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_BITRATE, g_param_spec_int ("bitrate", "Bitrate", "Choose a bitrate to encode at. " - "Attempt to encode at a bitrate averaging this. Takes an argument in kbps.", - -1, G_MAXINT, BITRATE_DEFAULT, G_PARAM_READWRITE)); + "Attempt to encode at a bitrate averaging this. Takes an argument in kbps.", + -1, G_MAXINT, BITRATE_DEFAULT, G_PARAM_READWRITE)); g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_MIN_BITRATE, g_param_spec_int ("min_bitrate", "Min bitrate", - "Specify a maximum bitrate in bps. Useful for streaming applications.", - -1, G_MAXINT, MIN_BITRATE_DEFAULT, G_PARAM_READWRITE)); + "Specify a maximum bitrate in bps. Useful for streaming applications.", + -1, G_MAXINT, MIN_BITRATE_DEFAULT, G_PARAM_READWRITE)); g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_QUALITY, g_param_spec_float ("quality", "Quality", - "Specify quality instead of specifying a particular bitrate.", - 0.0, 1.0, QUALITY_DEFAULT, G_PARAM_READWRITE)); + "Specify quality instead of specifying a particular bitrate.", + 0.0, 1.0, QUALITY_DEFAULT, G_PARAM_READWRITE)); g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_SERIAL, g_param_spec_int ("serial", "Serial", - "Specify a serial number for the stream. (-1 is random)", -1, - G_MAXINT, -1, G_PARAM_READWRITE)); + "Specify a serial number for the stream. (-1 is random)", -1, + G_MAXINT, -1, G_PARAM_READWRITE)); g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_MANAGED, g_param_spec_boolean ("managed", "Managed", - "Enable bitrate management engine", FALSE, G_PARAM_READWRITE)); + "Enable bitrate management engine", FALSE, G_PARAM_READWRITE)); g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_LAST_MESSAGE, g_param_spec_string ("last-message", "last-message", - "The last status message", NULL, G_PARAM_READABLE)); + "The last status message", NULL, G_PARAM_READABLE)); parent_class = g_type_class_ref (GST_TYPE_ELEMENT); @@ -254,20 +254,20 @@ gst_vorbisenc_convert_src (GstPad * pad, GstFormat src_format, gint64 src_value, switch (src_format) { case GST_FORMAT_BYTES: switch (*dest_format) { - case GST_FORMAT_TIME: - *dest_value = src_value * GST_SECOND / avg; - break; - default: - res = FALSE; + case GST_FORMAT_TIME: + *dest_value = src_value * GST_SECOND / avg; + break; + default: + res = FALSE; } break; case GST_FORMAT_TIME: switch (*dest_format) { - case GST_FORMAT_BYTES: - *dest_value = src_value * avg / GST_SECOND; - break; - default: - res = FALSE; + case GST_FORMAT_BYTES: + *dest_value = src_value * avg / GST_SECOND; + break; + default: + res = FALSE; } break; default: @@ -292,48 +292,48 @@ gst_vorbisenc_convert_sink (GstPad * pad, GstFormat src_format, 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 * vorbisenc->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 * vorbisenc->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 (vorbisenc->frequency == 0) - return FALSE; - *dest_value = src_value * GST_SECOND / vorbisenc->frequency; - break; - default: - res = FALSE; + case GST_FORMAT_BYTES: + *dest_value = src_value * bytes_per_sample; + break; + case GST_FORMAT_TIME: + if (vorbisenc->frequency == 0) + return FALSE; + *dest_value = src_value * GST_SECOND / vorbisenc->frequency; + break; + default: + res = FALSE; } break; case GST_FORMAT_TIME: switch (*dest_format) { - case GST_FORMAT_BYTES: - scale = bytes_per_sample; - /* fallthrough */ - case GST_FORMAT_DEFAULT: - *dest_value = src_value * scale * vorbisenc->frequency / GST_SECOND; - break; - default: - res = FALSE; + case GST_FORMAT_BYTES: + scale = bytes_per_sample; + /* fallthrough */ + case GST_FORMAT_DEFAULT: + *dest_value = src_value * scale * vorbisenc->frequency / GST_SECOND; + break; + default: + res = FALSE; } break; default: @@ -350,6 +350,7 @@ gst_vorbisenc_get_query_types (GstPad * pad) GST_QUERY_POSITION, 0 }; + return gst_vorbisenc_src_query_types; } @@ -366,53 +367,53 @@ gst_vorbisenc_src_query (GstPad * pad, GstQueryType type, case GST_QUERY_TOTAL: { switch (*format) { - case GST_FORMAT_BYTES: - case GST_FORMAT_TIME: - { - gint64 peer_value; - const GstFormat *peer_formats; - - res = FALSE; - - peer_formats = - gst_pad_get_formats (GST_PAD_PEER (vorbisenc->sinkpad)); - - while (peer_formats && *peer_formats && !res) { - - GstFormat peer_format = *peer_formats; - - /* do the probe */ - if (gst_pad_query (GST_PAD_PEER (vorbisenc->sinkpad), - GST_QUERY_TOTAL, &peer_format, &peer_value)) { - GstFormat conv_format; - - /* convert to TIME */ - conv_format = GST_FORMAT_TIME; - res = gst_pad_convert (vorbisenc->sinkpad, - peer_format, peer_value, &conv_format, value); - /* and to final format */ - res &= gst_pad_convert (pad, - GST_FORMAT_TIME, *value, format, value); - } - peer_formats++; - } - break; - } - default: - res = FALSE; - break; + case GST_FORMAT_BYTES: + case GST_FORMAT_TIME: + { + gint64 peer_value; + const GstFormat *peer_formats; + + res = FALSE; + + peer_formats = + gst_pad_get_formats (GST_PAD_PEER (vorbisenc->sinkpad)); + + while (peer_formats && *peer_formats && !res) { + + GstFormat peer_format = *peer_formats; + + /* do the probe */ + if (gst_pad_query (GST_PAD_PEER (vorbisenc->sinkpad), + GST_QUERY_TOTAL, &peer_format, &peer_value)) { + GstFormat conv_format; + + /* convert to TIME */ + conv_format = GST_FORMAT_TIME; + res = gst_pad_convert (vorbisenc->sinkpad, + peer_format, peer_value, &conv_format, value); + /* and to final format */ + res &= gst_pad_convert (pad, + GST_FORMAT_TIME, *value, format, value); + } + peer_formats++; + } + break; + } + default: + res = FALSE; + break; } break; } case GST_QUERY_POSITION: switch (*format) { - default: - { - /* we only know about our samples, convert to requested format */ - res = gst_pad_convert (pad, - GST_FORMAT_BYTES, vorbisenc->bytes_out, format, value); - break; - } + default: + { + /* we only know about our samples, convert to requested format */ + res = gst_pad_convert (pad, + GST_FORMAT_BYTES, vorbisenc->bytes_out, format, value); + break; + } } break; default: @@ -497,8 +498,8 @@ gst_vorbisenc_get_tag_value (const GstTagList * list, const gchar * tag, g_assert (gst_tag_list_get_uint_index (list, tag, index, &u)); date = g_date_new_julian (u); vorbisvalue = - g_strdup_printf ("%04d-%02d-%02d", (gint) g_date_get_year (date), - (gint) g_date_get_month (date), (gint) g_date_get_day (date)); + g_strdup_printf ("%04d-%02d-%02d", (gint) g_date_get_year (date), + (gint) g_date_get_month (date), (gint) g_date_get_day (date)); g_date_free (date); } else if (gst_tag_get_type (tag) == G_TYPE_STRING) { g_assert (gst_tag_list_get_string_index (list, tag, index, &vorbisvalue)); @@ -579,33 +580,33 @@ update_start_message (VorbisEnc * vorbisenc) if (vorbisenc->managed) { constraints = get_constraints_string (vorbisenc); vorbisenc->last_message = - g_strdup_printf ("encoding at average bitrate %d bps %s", - vorbisenc->bitrate, constraints); + g_strdup_printf ("encoding at average bitrate %d bps %s", + vorbisenc->bitrate, constraints); g_free (constraints); } else { vorbisenc->last_message = - g_strdup_printf - ("encoding at approximate bitrate %d bps (VBR encoding enabled)", - vorbisenc->bitrate); + g_strdup_printf + ("encoding at approximate bitrate %d bps (VBR encoding enabled)", + vorbisenc->bitrate); } } else { if (vorbisenc->quality_set) { if (vorbisenc->managed) { - constraints = get_constraints_string (vorbisenc); - vorbisenc->last_message = - g_strdup_printf - ("encoding at quality level %2.2f using constrained VBR %s", - vorbisenc->quality, constraints); - g_free (constraints); + constraints = get_constraints_string (vorbisenc); + vorbisenc->last_message = + g_strdup_printf + ("encoding at quality level %2.2f using constrained VBR %s", + vorbisenc->quality, constraints); + g_free (constraints); } else { - vorbisenc->last_message = - g_strdup_printf ("encoding at quality level %2.2f", - vorbisenc->quality); + vorbisenc->last_message = + g_strdup_printf ("encoding at quality level %2.2f", + vorbisenc->quality); } } else { constraints = get_constraints_string (vorbisenc); vorbisenc->last_message = - g_strdup_printf ("encoding using bitrate management %s", constraints); + g_strdup_printf ("encoding using bitrate management %s", constraints); g_free (constraints); } } @@ -631,9 +632,9 @@ gst_vorbisenc_setup (VorbisEnc * vorbisenc) if (vorbisenc->quality_set) { if (vorbis_encode_setup_vbr (&vorbisenc->vi, - vorbisenc->channels, vorbisenc->frequency, vorbisenc->quality)) { + vorbisenc->channels, vorbisenc->frequency, vorbisenc->quality)) { g_warning - ("vorbisenc: initialisation failed: invalid parameters for quality"); + ("vorbisenc: initialisation failed: invalid parameters for quality"); vorbis_info_clear (&vorbisenc->vi); return FALSE; } @@ -653,13 +654,13 @@ gst_vorbisenc_setup (VorbisEnc * vorbisenc) } } else { if (vorbis_encode_setup_managed (&vorbisenc->vi, - vorbisenc->channels, - vorbisenc->frequency, - vorbisenc->max_bitrate > 0 ? vorbisenc->max_bitrate : -1, - vorbisenc->bitrate, - vorbisenc->min_bitrate > 0 ? vorbisenc->min_bitrate : -1)) { + vorbisenc->channels, + vorbisenc->frequency, + vorbisenc->max_bitrate > 0 ? vorbisenc->max_bitrate : -1, + vorbisenc->bitrate, + vorbisenc->min_bitrate > 0 ? vorbisenc->min_bitrate : -1)) { g_warning - ("vorbisenc: initialisation failed: invalid parameters for bitrate\n"); + ("vorbisenc: initialisation failed: invalid parameters for bitrate\n"); vorbis_info_clear (&vorbisenc->vi); return FALSE; } @@ -733,25 +734,25 @@ gst_vorbisenc_chain (GstPad * pad, GstData * _data) switch (GST_EVENT_TYPE (event)) { case GST_EVENT_EOS: - /* end of file. this can be done implicitly in the mainline, - but it's easier to see here in non-clever fashion. - Tell the library we're at end of stream so that it can handle - the last frame and mark end of stream in the output properly */ - vorbis_analysis_wrote (&vorbisenc->vd, 0); - gst_event_unref (event); - break; + /* end of file. this can be done implicitly in the mainline, + but it's easier to see here in non-clever fashion. + Tell the library we're at end of stream so that it can handle + the last frame and mark end of stream in the output properly */ + vorbis_analysis_wrote (&vorbisenc->vd, 0); + gst_event_unref (event); + break; case GST_EVENT_TAG: - if (vorbisenc->tags) { - gst_tag_list_insert (vorbisenc->tags, gst_event_tag_get_list (event), - gst_tag_setter_get_merge_mode (GST_TAG_SETTER (vorbisenc))); - } else { - g_assert_not_reached (); - } - gst_pad_event_default (pad, event); - return; + if (vorbisenc->tags) { + gst_tag_list_insert (vorbisenc->tags, gst_event_tag_get_list (event), + gst_tag_setter_get_merge_mode (GST_TAG_SETTER (vorbisenc))); + } else { + g_assert_not_reached (); + } + gst_pad_event_default (pad, event); + return; default: - gst_pad_event_default (pad, event); - return; + gst_pad_event_default (pad, event); + return; } } else { gint16 *data; @@ -762,7 +763,7 @@ gst_vorbisenc_chain (GstPad * pad, GstData * _data) if (!vorbisenc->setup) { gst_buffer_unref (buf); GST_ELEMENT_ERROR (vorbisenc, CORE, NEGOTIATION, (NULL), - ("encoder not initialized (input is not audio?)")); + ("encoder not initialized (input is not audio?)")); return; } @@ -781,13 +782,13 @@ gst_vorbisenc_chain (GstPad * pad, GstData * _data) gst_vorbisenc_set_metadata (vorbisenc); vorbis_analysis_headerout (&vorbisenc->vd, &vorbisenc->vc, &header, - &header_comm, &header_code); - ogg_stream_packetin (&vorbisenc->os, &header); /* automatically placed in its own page */ + &header_comm, &header_code); + ogg_stream_packetin (&vorbisenc->os, &header); /* automatically placed in its own page */ ogg_stream_packetin (&vorbisenc->os, &header_comm); ogg_stream_packetin (&vorbisenc->os, &header_code); while ((result = ogg_stream_flush (&vorbisenc->os, &vorbisenc->og))) { - gst_vorbisenc_write_page (vorbisenc, &vorbisenc->og); + gst_vorbisenc_write_page (vorbisenc, &vorbisenc->og); } vorbisenc->header_sent = TRUE; } @@ -802,7 +803,7 @@ gst_vorbisenc_chain (GstPad * pad, GstData * _data) /* uninterleave samples */ for (i = 0; i < size; i++) { for (j = 0; j < vorbisenc->channels; j++) { - buffer[j][i] = data[i * vorbisenc->channels + j] / 32768.f; + buffer[j][i] = data[i * vorbisenc->channels + j] / 32768.f; } } @@ -830,18 +831,18 @@ gst_vorbisenc_chain (GstPad * pad, GstData * _data) /* write out pages (if any) */ while (!vorbisenc->eos) { - int result = ogg_stream_pageout (&vorbisenc->os, &vorbisenc->og); + int result = ogg_stream_pageout (&vorbisenc->os, &vorbisenc->og); - if (result == 0) - break; + if (result == 0) + break; - gst_vorbisenc_write_page (vorbisenc, &vorbisenc->og); + gst_vorbisenc_write_page (vorbisenc, &vorbisenc->og); - /* this could be set above, but for illustrative purposes, I do - it here (to show that vorbis does know where the stream ends) */ - if (ogg_page_eos (&vorbisenc->og)) { - vorbisenc->eos = 1; - } + /* this could be set above, but for illustrative purposes, I do + it here (to show that vorbis does know where the stream ends) */ + if (ogg_page_eos (&vorbisenc->og)) { + vorbisenc->eos = 1; + } } } } @@ -914,12 +915,12 @@ gst_vorbisenc_set_property (GObject * object, guint prop_id, vorbisenc->max_bitrate = g_value_get_int (value); if (vorbisenc->min_bitrate > 0 && vorbisenc->max_bitrate > 0) - vorbisenc->managed = TRUE; + vorbisenc->managed = TRUE; else - vorbisenc->managed = FALSE; + vorbisenc->managed = FALSE; if (old_value != vorbisenc->managed) - g_object_notify (object, "managed"); + g_object_notify (object, "managed"); break; } case ARG_BITRATE: @@ -931,20 +932,20 @@ gst_vorbisenc_set_property (GObject * object, guint prop_id, vorbisenc->min_bitrate = g_value_get_int (value); if (vorbisenc->min_bitrate > 0 && vorbisenc->max_bitrate > 0) - vorbisenc->managed = TRUE; + vorbisenc->managed = TRUE; else - vorbisenc->managed = FALSE; + vorbisenc->managed = FALSE; if (old_value != vorbisenc->managed) - g_object_notify (object, "managed"); + g_object_notify (object, "managed"); break; } case ARG_QUALITY: vorbisenc->quality = g_value_get_float (value); if (vorbisenc->quality >= 0.0) - vorbisenc->quality_set = TRUE; + vorbisenc->quality_set = TRUE; else - vorbisenc->quality_set = FALSE; + vorbisenc->quality_set = FALSE; break; case ARG_SERIAL: vorbisenc->serial = g_value_get_int (value); diff --git a/gst-libs/gst/audio/audio.c b/gst-libs/gst/audio/audio.c index 10a00142e6..ae0571faad 100644 --- a/gst-libs/gst/audio/audio.c +++ b/gst-libs/gst/audio/audio.c @@ -46,7 +46,7 @@ gst_audio_frame_byte_size (GstPad * pad) if (caps == NULL) { /* ERROR: could not get caps of pad */ g_warning ("gstaudio: could not get caps of pad %s:%s\n", - GST_ELEMENT_NAME (gst_pad_get_parent (pad)), GST_PAD_NAME (pad)); + GST_ELEMENT_NAME (gst_pad_get_parent (pad)), GST_PAD_NAME (pad)); return 0; } @@ -94,7 +94,7 @@ gst_audio_frame_rate (GstPad * pad) if (caps == NULL) { /* ERROR: could not get caps of pad */ g_warning ("gstaudio: could not get caps of pad %s:%s\n", - GST_ELEMENT_NAME (gst_pad_get_parent (pad)), GST_PAD_NAME (pad)); + GST_ELEMENT_NAME (gst_pad_get_parent (pad)), GST_PAD_NAME (pad)); return 0; } else { structure = gst_caps_get_structure (caps, 0); @@ -127,7 +127,7 @@ gst_audio_length (GstPad * pad, GstBuffer * buf) if (caps == NULL) { /* ERROR: could not get caps of pad */ g_warning ("gstaudio: could not get caps of pad %s:%s\n", - GST_ELEMENT_NAME (gst_pad_get_parent (pad)), GST_PAD_NAME (pad)); + GST_ELEMENT_NAME (gst_pad_get_parent (pad)), GST_PAD_NAME (pad)); length = 0.0; } else { structure = gst_caps_get_structure (caps, 0); @@ -160,7 +160,7 @@ gst_audio_highest_sample_value (GstPad * pad) caps = GST_PAD_CAPS (pad); if (caps == NULL) { g_warning ("gstaudio: could not get caps of pad %s:%s\n", - GST_ELEMENT_NAME (gst_pad_get_parent (pad)), GST_PAD_NAME (pad)); + GST_ELEMENT_NAME (gst_pad_get_parent (pad)), GST_PAD_NAME (pad)); } structure = gst_caps_get_structure (caps, 0); @@ -218,19 +218,19 @@ _gst_audio_structure_set_list (GstStructure * structure, switch (type) { case G_TYPE_INT: - i = va_arg (varargs, int); + i = va_arg (varargs, int); - g_value_init (&list_value, G_TYPE_INT); - g_value_set_int (&list_value, i); - break; + g_value_init (&list_value, G_TYPE_INT); + g_value_set_int (&list_value, i); + break; case G_TYPE_BOOLEAN: - b = va_arg (varargs, gboolean); - g_value_init (&list_value, G_TYPE_BOOLEAN); - g_value_set_boolean (&list_value, b); - break; + b = va_arg (varargs, gboolean); + g_value_init (&list_value, G_TYPE_BOOLEAN); + g_value_set_boolean (&list_value, b); + break; default: - g_warning - ("_gst_audio_structure_set_list: LIST of given type not implemented."); + g_warning + ("_gst_audio_structure_set_list: LIST of given type not implemented."); } g_array_append_val (array, list_value); @@ -244,24 +244,24 @@ gst_audio_structure_set_int (GstStructure * structure, GstAudioFieldFlag flag) { if (flag & GST_AUDIO_FIELD_RATE) gst_structure_set (structure, "rate", GST_TYPE_INT_RANGE, 1, G_MAXINT, - NULL); + NULL); if (flag & GST_AUDIO_FIELD_CHANNELS) gst_structure_set (structure, "channels", GST_TYPE_INT_RANGE, 1, G_MAXINT, - NULL); + NULL); if (flag & GST_AUDIO_FIELD_ENDIANNESS) _gst_audio_structure_set_list (structure, "endianness", G_TYPE_INT, 2, - G_LITTLE_ENDIAN, G_BIG_ENDIAN, NULL); + G_LITTLE_ENDIAN, G_BIG_ENDIAN, NULL); if (flag & GST_AUDIO_FIELD_WIDTH) _gst_audio_structure_set_list (structure, "width", G_TYPE_INT, 3, 8, 16, 32, - NULL); + NULL); if (flag & GST_AUDIO_FIELD_DEPTH) gst_structure_set (structure, "depth", GST_TYPE_INT_RANGE, 1, 32, NULL); if (flag & GST_AUDIO_FIELD_SIGNED) _gst_audio_structure_set_list (structure, "signed", G_TYPE_BOOLEAN, 2, TRUE, - FALSE, NULL); + FALSE, NULL); if (flag & GST_AUDIO_FIELD_BUFFER_FRAMES) gst_structure_set (structure, "buffer-frames", GST_TYPE_INT_RANGE, 1, - G_MAXINT, NULL); + G_MAXINT, NULL); } static gboolean diff --git a/gst-libs/gst/audio/audioclock.c b/gst-libs/gst/audio/audioclock.c index d6d1da45e1..f66f4eba68 100644 --- a/gst-libs/gst/audio/audioclock.c +++ b/gst-libs/gst/audio/audioclock.c @@ -57,8 +57,9 @@ gst_audio_clock_get_type (void) (GInstanceInitFunc) gst_audio_clock_init, NULL }; + clock_type = g_type_register_static (GST_TYPE_SYSTEM_CLOCK, "GstAudioClock", - &clock_info, 0); + &clock_info, 0); } return clock_type; } @@ -162,7 +163,7 @@ gst_audio_clock_update_time (GstAudioClock * aclock, GstClockTime time) entry->func ((GstClock *) aclock, time, entry, entry->user_data); aclock->async_entries = g_slist_delete_link (aclock->async_entries, - aclock->async_entries); + aclock->async_entries); /* do I need to free the entry? */ } } diff --git a/gst-libs/gst/audio/gstaudiofilter.c b/gst-libs/gst/audio/gstaudiofilter.c index ad491bb6ad..179c1d358a 100644 --- a/gst-libs/gst/audio/gstaudiofilter.c +++ b/gst-libs/gst/audio/gstaudiofilter.c @@ -73,8 +73,9 @@ gst_audiofilter_get_type (void) 0, gst_audiofilter_init, }; + audiofilter_type = g_type_register_static (GST_TYPE_ELEMENT, - "GstAudiofilter", &audiofilter_info, G_TYPE_FLAG_ABSTRACT); + "GstAudiofilter", &audiofilter_info, G_TYPE_FLAG_ABSTRACT); } return audiofilter_type; } @@ -141,7 +142,7 @@ gst_audiofilter_link (GstPad * pad, const GstCaps * caps) ret = gst_structure_get_int (structure, "depth", &audiofilter->depth); ret &= gst_structure_get_int (structure, "width", &audiofilter->width); ret &= - gst_structure_get_int (structure, "channels", &audiofilter->channels); + gst_structure_get_int (structure, "channels", &audiofilter->channels); } else if (strcmp (gst_structure_get_name (structure), "audio/x-raw-float") == 0) { @@ -236,7 +237,7 @@ gst_audiofilter_chain (GstPad * pad, GstData * data) (audiofilter_class->filter) (audiofilter, outbuf, inbuf); } else { memcpy (GST_BUFFER_DATA (outbuf), GST_BUFFER_DATA (inbuf), - GST_BUFFER_SIZE (inbuf)); + GST_BUFFER_SIZE (inbuf)); (audiofilter_class->filter_inplace) (audiofilter, outbuf); } @@ -290,11 +291,11 @@ gst_audiofilter_class_add_pad_templates (GstAudiofilterClass * gst_element_class_add_pad_template (element_class, gst_pad_template_new ("src", GST_PAD_SRC, GST_PAD_ALWAYS, - gst_caps_copy (caps))); + gst_caps_copy (caps))); gst_element_class_add_pad_template (element_class, gst_pad_template_new ("sink", GST_PAD_SINK, GST_PAD_ALWAYS, - gst_caps_copy (caps))); + gst_caps_copy (caps))); } static gboolean diff --git a/gst-libs/gst/audio/gstaudiofiltertemplate.c b/gst-libs/gst/audio/gstaudiofiltertemplate.c index 994fdc59d5..f641a6f239 100644 --- a/gst-libs/gst/audio/gstaudiofiltertemplate.c +++ b/gst-libs/gst/audio/gstaudiofiltertemplate.c @@ -107,8 +107,9 @@ gst_audiofilter_template_get_type (void) 0, NULL, }; + audiofilter_template_type = g_type_register_static (GST_TYPE_AUDIOFILTER, - "GstAudiofilterTemplate", &audiofilter_template_info, 0); + "GstAudiofilterTemplate", &audiofilter_template_info, 0); } return audiofilter_template_type; } @@ -147,8 +148,8 @@ gst_audiofilter_template_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_AUDIOTEMPLATE_METHOD, GST_AUDIOTEMPLATE_METHOD_1, - G_PARAM_READWRITE)); + GST_TYPE_AUDIOTEMPLATE_METHOD, GST_AUDIOTEMPLATE_METHOD_1, + G_PARAM_READWRITE)); #endif gobject_class->set_property = gst_audiofilter_template_set_property; diff --git a/gst-libs/gst/colorbalance/colorbalance.c b/gst-libs/gst/colorbalance/colorbalance.c index fbf1858181..ac6e511ebe 100644 --- a/gst-libs/gst/colorbalance/colorbalance.c +++ b/gst-libs/gst/colorbalance/colorbalance.c @@ -56,9 +56,9 @@ gst_color_balance_get_type (void) }; gst_color_balance_type = g_type_register_static (G_TYPE_INTERFACE, - "GstColorBalance", &gst_color_balance_info, 0); + "GstColorBalance", &gst_color_balance_info, 0); g_type_interface_add_prerequisite (gst_color_balance_type, - GST_TYPE_IMPLEMENTS_INTERFACE); + GST_TYPE_IMPLEMENTS_INTERFACE); } return gst_color_balance_type; @@ -71,12 +71,12 @@ gst_color_balance_class_init (GstColorBalanceClass * klass) if (!initialized) { gst_color_balance_signals[VALUE_CHANGED] = - g_signal_new ("value-changed", - GST_TYPE_COLOR_BALANCE, G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (GstColorBalanceClass, value_changed), - NULL, NULL, - gst_color_balance_marshal_VOID__OBJECT_INT, - G_TYPE_NONE, 2, GST_TYPE_COLOR_BALANCE_CHANNEL, G_TYPE_INT); + g_signal_new ("value-changed", + GST_TYPE_COLOR_BALANCE, G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (GstColorBalanceClass, value_changed), + NULL, NULL, + gst_color_balance_marshal_VOID__OBJECT_INT, + G_TYPE_NONE, 2, GST_TYPE_COLOR_BALANCE_CHANNEL, G_TYPE_INT); initialized = TRUE; } diff --git a/gst-libs/gst/colorbalance/colorbalancechannel.c b/gst-libs/gst/colorbalance/colorbalancechannel.c index 7812ed9303..4fd0ea8887 100644 --- a/gst-libs/gst/colorbalance/colorbalancechannel.c +++ b/gst-libs/gst/colorbalance/colorbalancechannel.c @@ -60,8 +60,8 @@ gst_color_balance_channel_get_type (void) }; gst_color_balance_channel_type = - g_type_register_static (G_TYPE_OBJECT, - "GstColorBalanceChannel", &color_balance_channel_info, 0); + g_type_register_static (G_TYPE_OBJECT, + "GstColorBalanceChannel", &color_balance_channel_info, 0); } return gst_color_balance_channel_type; @@ -78,7 +78,7 @@ gst_color_balance_channel_class_init (GstColorBalanceChannelClass * klass) g_signal_new ("value-changed", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (GstColorBalanceChannelClass, - value_changed), + value_changed), NULL, NULL, g_cclosure_marshal_VOID__INT, G_TYPE_NONE, 1, G_TYPE_INT); object_klass->dispose = gst_color_balance_channel_dispose; diff --git a/gst-libs/gst/gconf/gconf.c b/gst-libs/gst/gconf/gconf.c index 1887b7184d..d68ffe43f9 100644 --- a/gst-libs/gst/gconf/gconf.c +++ b/gst-libs/gst/gconf/gconf.c @@ -31,7 +31,7 @@ #error "GST_GCONF_DIR is not defined !" #endif -static GConfClient *_gst_gconf_client = NULL; /* GConf connection */ +static GConfClient *_gst_gconf_client = NULL; /* GConf connection */ /* internal functions */ @@ -63,13 +63,13 @@ 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 ! */ - pad = GST_PAD (pads->data); - } + if (GST_PAD_PEER (GST_PAD (pads->data)) == NULL) { + /* found it ! */ + 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); @@ -149,7 +149,7 @@ gst_gconf_render_bin_from_description (const gchar * description) g_free (desc); if (error) { g_print ("DEBUG: gstgconf: error parsing pipeline %s\n%s\n", - description, error->message); + description, error->message); g_error_free (error); return NULL; } @@ -308,7 +308,7 @@ gst_gconf_get_default_visualization_element (void) if (!ret) g_warning - ("No GConf default visualization plugin key and goom doesn't work"); + ("No GConf default visualization plugin key and goom doesn't work"); else g_print ("GConf visualization plugin not found, using goom\n"); } diff --git a/gst-libs/gst/idct/fastintidct.c b/gst-libs/gst/idct/fastintidct.c index 9bb1436dff..d4caaf3828 100644 --- a/gst-libs/gst/idct/fastintidct.c +++ b/gst-libs/gst/idct/fastintidct.c @@ -45,17 +45,17 @@ /* this code assumes >> to be a two's-complement arithmetic */ /* right shift: (-2)>>1 == -1 , (-3)>>1 == -2 */ -#define W1 2841 /* 2048*sqrt(2)*cos(1*pi/16) */ -#define W2 2676 /* 2048*sqrt(2)*cos(2*pi/16) */ -#define W3 2408 /* 2048*sqrt(2)*cos(3*pi/16) */ -#define W5 1609 /* 2048*sqrt(2)*cos(5*pi/16) */ -#define W6 1108 /* 2048*sqrt(2)*cos(6*pi/16) */ -#define W7 565 /* 2048*sqrt(2)*cos(7*pi/16) */ +#define W1 2841 /* 2048*sqrt(2)*cos(1*pi/16) */ +#define W2 2676 /* 2048*sqrt(2)*cos(2*pi/16) */ +#define W3 2408 /* 2048*sqrt(2)*cos(3*pi/16) */ +#define W5 1609 /* 2048*sqrt(2)*cos(5*pi/16) */ +#define W6 1108 /* 2048*sqrt(2)*cos(6*pi/16) */ +#define W7 565 /* 2048*sqrt(2)*cos(7*pi/16) */ #include "dct.h" /* private data */ -static short iclip[1024]; /* clipping table */ +static short iclip[1024]; /* clipping table */ static short *iclp; /* private prototypes */ @@ -80,13 +80,13 @@ idctrow (blk) /* shortcut */ if (!((x1 = blk[4] << 11) | (x2 = blk[6]) | (x3 = blk[2]) | - (x4 = blk[1]) | (x5 = blk[7]) | (x6 = blk[5]) | (x7 = blk[3]))) { + (x4 = blk[1]) | (x5 = blk[7]) | (x6 = blk[5]) | (x7 = blk[3]))) { blk[0] = blk[1] = blk[2] = blk[3] = blk[4] = blk[5] = blk[6] = blk[7] = - blk[0] << 3; + blk[0] << 3; return; } - x0 = (blk[0] << 11) + 128; /* for proper rounding in the fourth stage */ + x0 = (blk[0] << 11) + 128; /* for proper rounding in the fourth stage */ /* first stage */ x8 = W7 * (x4 + x5); @@ -143,10 +143,10 @@ idctcol (blk) /* shortcut */ if (!((x1 = (blk[8 * 4] << 8)) | (x2 = blk[8 * 6]) | (x3 = blk[8 * 2]) | - (x4 = blk[8 * 1]) | (x5 = blk[8 * 7]) | (x6 = blk[8 * 5]) | (x7 = - blk[8 * 3]))) { + (x4 = blk[8 * 1]) | (x5 = blk[8 * 7]) | (x6 = blk[8 * 5]) | (x7 = + blk[8 * 3]))) { blk[8 * 0] = blk[8 * 1] = blk[8 * 2] = blk[8 * 3] = blk[8 * 4] = - blk[8 * 5] = blk[8 * 6] = blk[8 * 7] = iclp[(blk[8 * 0] + 32) >> 6]; + blk[8 * 5] = blk[8 * 6] = blk[8 * 7] = iclp[(blk[8 * 0] + 32) >> 6]; return; } diff --git a/gst-libs/gst/idct/floatidct.c b/gst-libs/gst/idct/floatidct.c index 0fa1e83009..65e01d407c 100644 --- a/gst-libs/gst/idct/floatidct.c +++ b/gst-libs/gst/idct/floatidct.c @@ -66,7 +66,7 @@ gst_idct_init_float_idct () scale = (freq == 0) ? sqrt (0.125) : 0.5; for (time = 0; time < 8; time++) gst_idct_float_c[freq][time] = - scale * cos ((PI / 8.0) * freq * (time + 0.5)); + scale * cos ((PI / 8.0) * freq * (time + 0.5)); } } @@ -85,7 +85,7 @@ gst_idct_float_idct (block) partial_product = 0.0; for (k = 0; k < 8; k++) - partial_product += gst_idct_float_c[k][j] * block[8 * i + k]; + partial_product += gst_idct_float_c[k][j] * block[8 * i + k]; tmp[8 * i + j] = partial_product; } @@ -98,7 +98,7 @@ gst_idct_float_idct (block) partial_product = 0.0; for (k = 0; k < 8; k++) - partial_product += gst_idct_float_c[k][i] * tmp[8 * k + j]; + partial_product += gst_idct_float_c[k][i] * tmp[8 * k + j]; v = (int) floor (partial_product + 0.5); block[8 * i + j] = (v < -256) ? -256 : ((v > 255) ? 255 : v); diff --git a/gst-libs/gst/idct/ieeetest.c b/gst-libs/gst/idct/ieeetest.c index d26181c1a6..7af101e66e 100644 --- a/gst-libs/gst/idct/ieeetest.c +++ b/gst-libs/gst/idct/ieeetest.c @@ -52,10 +52,10 @@ main (int argc, char **argv) int i, j; double max, total; int method; - DCTELEM block[DCTSIZE2]; /* random source data */ - DCTELEM refcoefs[DCTSIZE2]; /* coefs from reference FDCT */ - DCTELEM refout[DCTSIZE2]; /* output from reference IDCT */ - DCTELEM testout[DCTSIZE2]; /* output from test IDCT */ + DCTELEM block[DCTSIZE2]; /* random source data */ + DCTELEM refcoefs[DCTSIZE2]; /* coefs from reference FDCT */ + DCTELEM refout[DCTSIZE2]; /* output from reference IDCT */ + DCTELEM testout[DCTSIZE2]; /* output from test IDCT */ GstIDCT *idct; guint64 tscstart, tscmin = ~0, tscmax = 0; guint64 tscstop; @@ -96,9 +96,9 @@ main (int argc, char **argv) /* clip */ for (i = 0; i < DCTSIZE2; i++) { if (refcoefs[i] < -2048) - refcoefs[i] = -2048; + refcoefs[i] = -2048; else if (refcoefs[i] > 2047) - refcoefs[i] = 2047; + refcoefs[i] = 2047; } /* perform reference IDCT */ @@ -107,17 +107,17 @@ main (int argc, char **argv) /* clip */ for (i = 0; i < DCTSIZE2; i++) { if (refout[i] < -256) - refout[i] = -256; + refout[i] = -256; else if (refout[i] > 255) - refout[i] = 255; + refout[i] = 255; } /* perform test IDCT */ if (GST_IDCT_TRANSPOSE (idct)) { for (j = 0; j < DCTSIZE; j++) { - for (i = 0; i < DCTSIZE; i++) { - testout[i * DCTSIZE + j] = refcoefs[j * DCTSIZE + i]; - } + for (i = 0; i < DCTSIZE; i++) { + testout[i * DCTSIZE + j] = refcoefs[j * DCTSIZE + i]; + } } } else { memcpy (testout, refcoefs, sizeof (DCTELEM) * DCTSIZE2); @@ -135,9 +135,9 @@ main (int argc, char **argv) /* clip */ for (i = 0; i < DCTSIZE2; i++) { if (testout[i] < -256) - testout[i] = -256; + testout[i] = -256; else if (testout[i] > 255) - testout[i] = 255; + testout[i] = 255; } /* accumulate error stats */ @@ -147,9 +147,9 @@ main (int argc, char **argv) sumerrs[i] += err; sumsqerrs[i] += err * err; if (err < 0) - err = -err; + err = -err; if (maxerr[i] < err) - maxerr[i] = err; + maxerr[i] = err; } if (curiter % 100 == 99) { @@ -290,7 +290,7 @@ dct_init (void) for (b = 0; b < 8; b++) { tmp = cos ((double) ((a + a + 1) * b) * (3.14159265358979323846 / 16.0)); if (b == 0) - tmp /= sqrt (2.0); + tmp /= sqrt (2.0); coslu[a][b] = tmp * 0.5; } } @@ -307,11 +307,11 @@ ref_fdct (DCTELEM block[8][8]) for (u = 0; u < 8; u++) { tmp = 0.0; for (y = 0; y < 8; y++) { - tmp2 = 0.0; - for (x = 0; x < 8; x++) { - tmp2 += (double) block[y][x] * coslu[x][u]; - } - tmp += coslu[y][v] * tmp2; + tmp2 = 0.0; + for (x = 0; x < 8; x++) { + tmp2 += (double) block[y][x] * coslu[x][u]; + } + tmp += coslu[y][v] * tmp2; } res[v][u] = tmp; } @@ -321,9 +321,9 @@ ref_fdct (DCTELEM block[8][8]) for (u = 0; u < 8; u++) { tmp = res[v][u]; if (tmp < 0.0) { - x = -((int) (0.5 - tmp)); + x = -((int) (0.5 - tmp)); } else { - x = (int) (tmp + 0.5); + x = (int) (tmp + 0.5); } block[v][u] = (DCTELEM) x; } @@ -342,11 +342,11 @@ ref_idct (DCTELEM block[8][8]) for (x = 0; x < 8; x++) { tmp = 0.0; for (v = 0; v < 8; v++) { - tmp2 = 0.0; - for (u = 0; u < 8; u++) { - tmp2 += (double) block[v][u] * coslu[x][u]; - } - tmp += coslu[y][v] * tmp2; + tmp2 = 0.0; + for (u = 0; u < 8; u++) { + tmp2 += (double) block[v][u] * coslu[x][u]; + } + tmp += coslu[y][v] * tmp2; } res[y][x] = tmp; } @@ -356,9 +356,9 @@ ref_idct (DCTELEM block[8][8]) for (u = 0; u < 8; u++) { tmp = res[v][u]; if (tmp < 0.0) { - x = -((int) (0.5 - tmp)); + x = -((int) (0.5 - tmp)); } else { - x = (int) (tmp + 0.5); + x = (int) (tmp + 0.5); } block[v][u] = (DCTELEM) x; } diff --git a/gst-libs/gst/idct/intidct.c b/gst-libs/gst/idct/intidct.c index 42f0ac842d..d2945348e1 100644 --- a/gst-libs/gst/idct/intidct.c +++ b/gst-libs/gst/idct/intidct.c @@ -51,7 +51,7 @@ */ #if DCTSIZE != 8 -Sorry, this code only copes with 8 x8 DCTs. /* deliberate syntax err */ +Sorry, this code only copes with 8 x8 DCTs. /* deliberate syntax err */ #endif /* * A 2-D IDCT can be done by 1-D IDCT on each row followed by 1-D IDCT @@ -93,7 +93,7 @@ Sorry, this code only copes with 8 x8 DCTs. /* deliberate syntax err */ #define PASS1_BITS 2 #else #define CONST_BITS 13 -#define PASS1_BITS 1 /* lose a little precision to avoid overflow */ +#define PASS1_BITS 1 /* lose a little precision to avoid overflow */ #endif #define ONE ((INT32) 1) #define CONST_SCALE (ONE << CONST_BITS) @@ -106,18 +106,18 @@ Sorry, this code only copes with 8 x8 DCTs. /* deliberate syntax err */ * (With a reasonable C compiler, you can just rely on the FIX() macro...) */ #if CONST_BITS == 13 -#define FIX_0_298631336 ((INT32) 2446) /* FIX(0.298631336) */ -#define FIX_0_390180644 ((INT32) 3196) /* FIX(0.390180644) */ -#define FIX_0_541196100 ((INT32) 4433) /* FIX(0.541196100) */ -#define FIX_0_765366865 ((INT32) 6270) /* FIX(0.765366865) */ -#define FIX_0_899976223 ((INT32) 7373) /* FIX(0.899976223) */ -#define FIX_1_175875602 ((INT32) 9633) /* FIX(1.175875602) */ -#define FIX_1_501321110 ((INT32) 12299) /* FIX(1.501321110) */ -#define FIX_1_847759065 ((INT32) 15137) /* FIX(1.847759065) */ -#define FIX_1_961570560 ((INT32) 16069) /* FIX(1.961570560) */ -#define FIX_2_053119869 ((INT32) 16819) /* FIX(2.053119869) */ -#define FIX_2_562915447 ((INT32) 20995) /* FIX(2.562915447) */ -#define FIX_3_072711026 ((INT32) 25172) /* FIX(3.072711026) */ +#define FIX_0_298631336 ((INT32) 2446) /* FIX(0.298631336) */ +#define FIX_0_390180644 ((INT32) 3196) /* FIX(0.390180644) */ +#define FIX_0_541196100 ((INT32) 4433) /* FIX(0.541196100) */ +#define FIX_0_765366865 ((INT32) 6270) /* FIX(0.765366865) */ +#define FIX_0_899976223 ((INT32) 7373) /* FIX(0.899976223) */ +#define FIX_1_175875602 ((INT32) 9633) /* FIX(1.175875602) */ +#define FIX_1_501321110 ((INT32) 12299) /* FIX(1.501321110) */ +#define FIX_1_847759065 ((INT32) 15137) /* FIX(1.847759065) */ +#define FIX_1_961570560 ((INT32) 16069) /* FIX(1.961570560) */ +#define FIX_2_053119869 ((INT32) 16819) /* FIX(2.053119869) */ +#define FIX_2_562915447 ((INT32) 20995) /* FIX(2.562915447) */ +#define FIX_3_072711026 ((INT32) 25172) /* FIX(3.072711026) */ #else #define FIX_0_298631336 FIX(0.298631336) #define FIX_0_390180644 FIX(0.390180644) @@ -148,14 +148,14 @@ Sorry, this code only copes with 8 x8 DCTs. /* deliberate syntax err */ * NB: for 12-bit samples, a full 32-bit multiplication will be needed. */ #ifdef EIGHT_BIT_SAMPLES -#ifdef SHORTxSHORT_32 /* may work if 'int' is 32 bits */ +#ifdef SHORTxSHORT_32 /* may work if 'int' is 32 bits */ #define MULTIPLY(var,const) (((INT16) (var)) * ((INT16) (const))) #endif -#ifdef SHORTxLCONST_32 /* known to work with Microsoft C 6.0 */ +#ifdef SHORTxLCONST_32 /* known to work with Microsoft C 6.0 */ #define MULTIPLY(var,const) (((INT16) (var)) * ((INT32) (const))) #endif #endif -#ifndef MULTIPLY /* default definition */ +#ifndef MULTIPLY /* default definition */ #define MULTIPLY(var,const) ((var) * (const)) #endif /* @@ -186,7 +186,7 @@ gst_idct_int_idct (DCTBLOCK data) */ if ((dataptr[1] | dataptr[2] | dataptr[3] | dataptr[4] | - dataptr[5] | dataptr[6] | dataptr[7]) == 0) { + dataptr[5] | dataptr[6] | dataptr[7]) == 0) { /* AC terms all zero */ DCTELEM dcval = (DCTELEM) (dataptr[0] << PASS1_BITS); @@ -199,7 +199,7 @@ gst_idct_int_idct (DCTBLOCK data) dataptr[6] = dcval; dataptr[7] = dcval; - dataptr += DCTSIZE; /* advance pointer to next row */ + dataptr += DCTSIZE; /* advance pointer to next row */ continue; } @@ -234,16 +234,16 @@ gst_idct_int_idct (DCTBLOCK data) z2 = tmp1 + tmp2; z3 = tmp0 + tmp2; z4 = tmp1 + tmp3; - z5 = MULTIPLY (z3 + z4, FIX_1_175875602); /* sqrt(2) * c3 */ + z5 = MULTIPLY (z3 + z4, FIX_1_175875602); /* sqrt(2) * c3 */ - tmp0 = MULTIPLY (tmp0, FIX_0_298631336); /* sqrt(2) * (-c1+c3+c5-c7) */ - tmp1 = MULTIPLY (tmp1, FIX_2_053119869); /* sqrt(2) * ( c1+c3-c5+c7) */ - tmp2 = MULTIPLY (tmp2, FIX_3_072711026); /* sqrt(2) * ( c1+c3+c5-c7) */ - tmp3 = MULTIPLY (tmp3, FIX_1_501321110); /* sqrt(2) * ( c1+c3-c5-c7) */ - z1 = MULTIPLY (z1, -FIX_0_899976223); /* sqrt(2) * (c7-c3) */ - z2 = MULTIPLY (z2, -FIX_2_562915447); /* sqrt(2) * (-c1-c3) */ - z3 = MULTIPLY (z3, -FIX_1_961570560); /* sqrt(2) * (-c3-c5) */ - z4 = MULTIPLY (z4, -FIX_0_390180644); /* sqrt(2) * (c5-c3) */ + tmp0 = MULTIPLY (tmp0, FIX_0_298631336); /* sqrt(2) * (-c1+c3+c5-c7) */ + tmp1 = MULTIPLY (tmp1, FIX_2_053119869); /* sqrt(2) * ( c1+c3-c5+c7) */ + tmp2 = MULTIPLY (tmp2, FIX_3_072711026); /* sqrt(2) * ( c1+c3+c5-c7) */ + tmp3 = MULTIPLY (tmp3, FIX_1_501321110); /* sqrt(2) * ( c1+c3-c5-c7) */ + z1 = MULTIPLY (z1, -FIX_0_899976223); /* sqrt(2) * (c7-c3) */ + z2 = MULTIPLY (z2, -FIX_2_562915447); /* sqrt(2) * (-c1-c3) */ + z3 = MULTIPLY (z3, -FIX_1_961570560); /* sqrt(2) * (-c3-c5) */ + z4 = MULTIPLY (z4, -FIX_0_390180644); /* sqrt(2) * (c5-c3) */ z3 += z5; z4 += z5; @@ -264,7 +264,7 @@ gst_idct_int_idct (DCTBLOCK data) dataptr[3] = (DCTELEM) DESCALE (tmp13 + tmp0, CONST_BITS - PASS1_BITS); dataptr[4] = (DCTELEM) DESCALE (tmp13 - tmp0, CONST_BITS - PASS1_BITS); - dataptr += DCTSIZE; /* advance pointer to next row */ + dataptr += DCTSIZE; /* advance pointer to next row */ } /* Pass 2: process columns. */ @@ -283,8 +283,8 @@ gst_idct_int_idct (DCTBLOCK data) #ifndef NO_ZERO_COLUMN_TEST if ((dataptr[DCTSIZE * 1] | dataptr[DCTSIZE * 2] | dataptr[DCTSIZE * 3] | - dataptr[DCTSIZE * 4] | dataptr[DCTSIZE * 5] | dataptr[DCTSIZE * 6] | - dataptr[DCTSIZE * 7]) == 0) { + dataptr[DCTSIZE * 4] | dataptr[DCTSIZE * 5] | dataptr[DCTSIZE * 6] | + dataptr[DCTSIZE * 7]) == 0) { /* AC terms all zero */ DCTELEM dcval = (DCTELEM) DESCALE ((INT32) dataptr[0], PASS1_BITS + 3); @@ -297,7 +297,7 @@ gst_idct_int_idct (DCTBLOCK data) dataptr[DCTSIZE * 6] = dcval; dataptr[DCTSIZE * 7] = dcval; - dataptr++; /* advance pointer to next column */ + dataptr++; /* advance pointer to next column */ continue; } #endif @@ -313,11 +313,11 @@ gst_idct_int_idct (DCTBLOCK data) tmp3 = z1 + MULTIPLY (z2, FIX_0_765366865); tmp0 = - ((INT32) dataptr[DCTSIZE * 0] + - (INT32) dataptr[DCTSIZE * 4]) << CONST_BITS; + ((INT32) dataptr[DCTSIZE * 0] + + (INT32) dataptr[DCTSIZE * 4]) << CONST_BITS; tmp1 = - ((INT32) dataptr[DCTSIZE * 0] - - (INT32) dataptr[DCTSIZE * 4]) << CONST_BITS; + ((INT32) dataptr[DCTSIZE * 0] - + (INT32) dataptr[DCTSIZE * 4]) << CONST_BITS; tmp10 = tmp0 + tmp3; tmp13 = tmp0 - tmp3; @@ -337,16 +337,16 @@ gst_idct_int_idct (DCTBLOCK data) z2 = tmp1 + tmp2; z3 = tmp0 + tmp2; z4 = tmp1 + tmp3; - z5 = MULTIPLY (z3 + z4, FIX_1_175875602); /* sqrt(2) * c3 */ + z5 = MULTIPLY (z3 + z4, FIX_1_175875602); /* sqrt(2) * c3 */ - tmp0 = MULTIPLY (tmp0, FIX_0_298631336); /* sqrt(2) * (-c1+c3+c5-c7) */ - tmp1 = MULTIPLY (tmp1, FIX_2_053119869); /* sqrt(2) * ( c1+c3-c5+c7) */ - tmp2 = MULTIPLY (tmp2, FIX_3_072711026); /* sqrt(2) * ( c1+c3+c5-c7) */ - tmp3 = MULTIPLY (tmp3, FIX_1_501321110); /* sqrt(2) * ( c1+c3-c5-c7) */ - z1 = MULTIPLY (z1, -FIX_0_899976223); /* sqrt(2) * (c7-c3) */ - z2 = MULTIPLY (z2, -FIX_2_562915447); /* sqrt(2) * (-c1-c3) */ - z3 = MULTIPLY (z3, -FIX_1_961570560); /* sqrt(2) * (-c3-c5) */ - z4 = MULTIPLY (z4, -FIX_0_390180644); /* sqrt(2) * (c5-c3) */ + tmp0 = MULTIPLY (tmp0, FIX_0_298631336); /* sqrt(2) * (-c1+c3+c5-c7) */ + tmp1 = MULTIPLY (tmp1, FIX_2_053119869); /* sqrt(2) * ( c1+c3-c5+c7) */ + tmp2 = MULTIPLY (tmp2, FIX_3_072711026); /* sqrt(2) * ( c1+c3+c5-c7) */ + tmp3 = MULTIPLY (tmp3, FIX_1_501321110); /* sqrt(2) * ( c1+c3-c5-c7) */ + z1 = MULTIPLY (z1, -FIX_0_899976223); /* sqrt(2) * (c7-c3) */ + z2 = MULTIPLY (z2, -FIX_2_562915447); /* sqrt(2) * (-c1-c3) */ + z3 = MULTIPLY (z3, -FIX_1_961570560); /* sqrt(2) * (-c3-c5) */ + z4 = MULTIPLY (z4, -FIX_0_390180644); /* sqrt(2) * (c5-c3) */ z3 += z5; z4 += z5; @@ -359,22 +359,22 @@ gst_idct_int_idct (DCTBLOCK data) /* Final output stage: inputs are tmp10..tmp13, tmp0..tmp3 */ dataptr[DCTSIZE * 0] = (DCTELEM) DESCALE (tmp10 + tmp3, - CONST_BITS + PASS1_BITS + 3); + CONST_BITS + PASS1_BITS + 3); dataptr[DCTSIZE * 7] = (DCTELEM) DESCALE (tmp10 - tmp3, - CONST_BITS + PASS1_BITS + 3); + CONST_BITS + PASS1_BITS + 3); dataptr[DCTSIZE * 1] = (DCTELEM) DESCALE (tmp11 + tmp2, - CONST_BITS + PASS1_BITS + 3); + CONST_BITS + PASS1_BITS + 3); dataptr[DCTSIZE * 6] = (DCTELEM) DESCALE (tmp11 - tmp2, - CONST_BITS + PASS1_BITS + 3); + CONST_BITS + PASS1_BITS + 3); dataptr[DCTSIZE * 2] = (DCTELEM) DESCALE (tmp12 + tmp1, - CONST_BITS + PASS1_BITS + 3); + CONST_BITS + PASS1_BITS + 3); dataptr[DCTSIZE * 5] = (DCTELEM) DESCALE (tmp12 - tmp1, - CONST_BITS + PASS1_BITS + 3); + CONST_BITS + PASS1_BITS + 3); dataptr[DCTSIZE * 3] = (DCTELEM) DESCALE (tmp13 + tmp0, - CONST_BITS + PASS1_BITS + 3); + CONST_BITS + PASS1_BITS + 3); dataptr[DCTSIZE * 4] = (DCTELEM) DESCALE (tmp13 - tmp0, - CONST_BITS + PASS1_BITS + 3); + CONST_BITS + PASS1_BITS + 3); - dataptr++; /* advance pointer to next column */ + dataptr++; /* advance pointer to next column */ } } diff --git a/gst-libs/gst/idct/mmx32idct.c b/gst-libs/gst/idct/mmx32idct.c index cd191f0c6d..d5bbbdb983 100644 --- a/gst-libs/gst/idct/mmx32idct.c +++ b/gst-libs/gst/idct/mmx32idct.c @@ -117,15 +117,15 @@ qword ptr equ mword ptr */ #endif #include <mmx.h>
-#define BITS_INV_ACC 4 /*; 4 or 5 for IEEE
*/ +#define BITS_INV_ACC 4 /*; 4 or 5 for IEEE
*/ /* 5 yields higher accuracy, but lessens dynamic range on the input matrix
*/ #define SHIFT_INV_ROW (16 - BITS_INV_ACC)
-#define SHIFT_INV_COL (1 + BITS_INV_ACC +14 ) /* changed from Intel's val)
*/ +#define SHIFT_INV_COL (1 + BITS_INV_ACC +14 ) /* changed from Intel's val)
*/ /*#define SHIFT_INV_COL (1 + BITS_INV_ACC )
*/ #define RND_INV_ROW (1 << (SHIFT_INV_ROW-1))
#define RND_INV_COL (1 << (SHIFT_INV_COL-1))
-#define RND_INV_CORR (RND_INV_COL - 1) /*; correction -1.0 and round
*/ +#define RND_INV_CORR (RND_INV_COL - 1) /*; correction -1.0 and round
*/ /*#define RND_INV_ROW (1024 * (6 - BITS_INV_ACC)) //; 1 << (SHIFT_INV_ROW-1)
*/ /*#define RND_INV_COL (16 * (BITS_INV_ACC - 3)) //; 1 << (SHIFT_INV_COL-1)
*/ @@ -158,12 +158,12 @@ const static long r_inv_row[2] = { RND_INV_ROW, RND_INV_ROW }; /*const static short ocos_4_16[4] = {23170, 23170, 23170, 23170 }; //cos * (2<<15) + 0.5
*/ /*concatenated table, for forward DCT transformation
*/ -const static short tg_all_16[] = {
13036, 13036, 13036, 13036, /* tg * (2<<16) + 0.5
*/ - 27146, 27146, 27146, 27146, /*tg * (2<<16) + 0.5
*/ - -21746, -21746, -21746, -21746, /* tg * (2<<16) + 0.5
*/ - -19195, -19195, -19195, -19195, /*cos * (2<<16) + 0.5
*/ +const static short tg_all_16[] = {
13036, 13036, 13036, 13036, /* tg * (2<<16) + 0.5
*/ + 27146, 27146, 27146, 27146, /*tg * (2<<16) + 0.5
*/ + -21746, -21746, -21746, -21746, /* tg * (2<<16) + 0.5
*/ + -19195, -19195, -19195, -19195, /*cos * (2<<16) + 0.5
*/ 23170, 23170, 23170, 23170 -}; /*cos * (2<<15) + 0.5
*/ +}; /*cos * (2<<15) + 0.5
*/ #define tg_1_16 (tg_all_16 + 0)
@@ -233,51 +233,51 @@ IF _MMX ; MMX code ;=============================================================================
/*; Table for rows 0,4 - constants are multiplied by cos_4_16
*/ -const short tab_i_04[] = {
16384, 16384, 16384, -16384, /* ; movq-> w06 w04 w02 w00
*/ - 21407, 8867, 8867, -21407, /* w07 w05 w03 w01
*/ - 16384, -16384, 16384, 16384, /*; w14 w12 w10 w08
*/ - -8867, 21407, -21407, -8867, /*; w15 w13 w11 w09
*/ - 22725, 12873, 19266, -22725, /*; w22 w20 w18 w16
*/ - 19266, 4520, -4520, -12873, /*; w23 w21 w19 w17
*/ - 12873, 4520, 4520, 19266, /*; w30 w28 w26 w24
*/ +const short tab_i_04[] = {
16384, 16384, 16384, -16384, /* ; movq-> w06 w04 w02 w00
*/ + 21407, 8867, 8867, -21407, /* w07 w05 w03 w01
*/ + 16384, -16384, 16384, 16384, /*; w14 w12 w10 w08
*/ + -8867, 21407, -21407, -8867, /*; w15 w13 w11 w09
*/ + 22725, 12873, 19266, -22725, /*; w22 w20 w18 w16
*/ + 19266, 4520, -4520, -12873, /*; w23 w21 w19 w17
*/ + 12873, 4520, 4520, 19266, /*; w30 w28 w26 w24
*/ -22725, 19266, -12873, -22725 -}; /*w31 w29 w27 w25
*/ +}; /*w31 w29 w27 w25
*/ /*; Table for rows 1,7 - constants are multiplied by cos_1_16
*/ -const short tab_i_17[] = {
22725, 22725, 22725, -22725, /* ; movq-> w06 w04 w02 w00
*/ - 29692, 12299, 12299, -29692, /* ; w07 w05 w03 w01
*/ - 22725, -22725, 22725, 22725, /*; w14 w12 w10 w08
*/ - -12299, 29692, -29692, -12299, /*; w15 w13 w11 w09
*/ - 31521, 17855, 26722, -31521, /*; w22 w20 w18 w16
*/ - 26722, 6270, -6270, -17855, /*; w23 w21 w19 w17
*/ - 17855, 6270, 6270, 26722, /*; w30 w28 w26 w24
*/ +const short tab_i_17[] = {
22725, 22725, 22725, -22725, /* ; movq-> w06 w04 w02 w00
*/ + 29692, 12299, 12299, -29692, /* ; w07 w05 w03 w01
*/ + 22725, -22725, 22725, 22725, /*; w14 w12 w10 w08
*/ + -12299, 29692, -29692, -12299, /*; w15 w13 w11 w09
*/ + 31521, 17855, 26722, -31521, /*; w22 w20 w18 w16
*/ + 26722, 6270, -6270, -17855, /*; w23 w21 w19 w17
*/ + 17855, 6270, 6270, 26722, /*; w30 w28 w26 w24
*/ -31521, 26722, -17855, -31521 -}; /* w31 w29 w27 w25
*/ +}; /* w31 w29 w27 w25
*/ /*; Table for rows 2,6 - constants are multiplied by cos_2_16
*/ -const short tab_i_26[] = {
21407, 21407, 21407, -21407, /* ; movq-> w06 w04 w02 w00
*/ - 27969, 11585, 11585, -27969, /* ; w07 w05 w03 w01
*/ - 21407, -21407, 21407, 21407, /* ; w14 w12 w10 w08
*/ - -11585, 27969, -27969, -11585, /* ;w15 w13 w11 w09
*/ - 29692, 16819, 25172, -29692, /* ;w22 w20 w18 w16
*/ - 25172, 5906, -5906, -16819, /* ;w23 w21 w19 w17
*/ - 16819, 5906, 5906, 25172, /* ;w30 w28 w26 w24
*/ +const short tab_i_26[] = {
21407, 21407, 21407, -21407, /* ; movq-> w06 w04 w02 w00
*/ + 27969, 11585, 11585, -27969, /* ; w07 w05 w03 w01
*/ + 21407, -21407, 21407, 21407, /* ; w14 w12 w10 w08
*/ + -11585, 27969, -27969, -11585, /* ;w15 w13 w11 w09
*/ + 29692, 16819, 25172, -29692, /* ;w22 w20 w18 w16
*/ + 25172, 5906, -5906, -16819, /* ;w23 w21 w19 w17
*/ + 16819, 5906, 5906, 25172, /* ;w30 w28 w26 w24
*/ -29692, 25172, -16819, -29692 -}; /* ;w31 w29 w27 w25
*/ +}; /* ;w31 w29 w27 w25
*/ /*; Table for rows 3,5 - constants are multiplied by cos_3_16
*/ -const short tab_i_35[] = {
19266, 19266, 19266, -19266, /*; movq-> w06 w04 w02 w00
*/ - 25172, 10426, 10426, -25172, /*; w07 w05 w03 w01
*/ - 19266, -19266, 19266, 19266, /*; w14 w12 w10 w08
*/ - -10426, 25172, -25172, -10426, /*; w15 w13 w11 w09
*/ - 26722, 15137, 22654, -26722, /*; w22 w20 w18 w16
*/ - 22654, 5315, -5315, -15137, /*; w23 w21 w19 w17
*/ - 15137, 5315, 5315, 22654, /*; w30 w28 w26 w24
*/ +const short tab_i_35[] = {
19266, 19266, 19266, -19266, /*; movq-> w06 w04 w02 w00
*/ + 25172, 10426, 10426, -25172, /*; w07 w05 w03 w01
*/ + 19266, -19266, 19266, 19266, /*; w14 w12 w10 w08
*/ + -10426, 25172, -25172, -10426, /*; w15 w13 w11 w09
*/ + 26722, 15137, 22654, -26722, /*; w22 w20 w18 w16
*/ + 22654, 5315, -5315, -15137, /*; w23 w21 w19 w17
*/ + 15137, 5315, 5315, 22654, /*; w30 w28 w26 w24
*/ -26722, 22654, -15137, -26722 -}; /*; w31 w29 w27 w25
*/ +}; /*; w31 w29 w27 w25
*/ */
/* CONCATENATED TABLE, rows 0,1,2,3,4,5,6,7 (in order )
*/ @@ -286,109 +286,109 @@ const short tab_i_35[] = {
19266, 19266, 19266, -19266, /*; movq-> w06 w04 w02 /*
*/ static const short tab_i_01234567[] = {
/*row0, this row is required
*/ - 16384, 16384, 16384, -16384, /* ; movq-> w06 w04 w02 w00
*/ - 21407, 8867, 8867, -21407, /* w07 w05 w03 w01
*/ - 16384, -16384, 16384, 16384, /*; w14 w12 w10 w08
*/ - -8867, 21407, -21407, -8867, /*; w15 w13 w11 w09
*/ - 22725, 12873, 19266, -22725, /*; w22 w20 w18 w16
*/ - 19266, 4520, -4520, -12873, /*; w23 w21 w19 w17
*/ - 12873, 4520, 4520, 19266, /*; w30 w28 w26 w24
*/ - -22725, 19266, -12873, -22725, /*w31 w29 w27 w25
*/ + 16384, 16384, 16384, -16384, /* ; movq-> w06 w04 w02 w00
*/ + 21407, 8867, 8867, -21407, /* w07 w05 w03 w01
*/ + 16384, -16384, 16384, 16384, /*; w14 w12 w10 w08
*/ + -8867, 21407, -21407, -8867, /*; w15 w13 w11 w09
*/ + 22725, 12873, 19266, -22725, /*; w22 w20 w18 w16
*/ + 19266, 4520, -4520, -12873, /*; w23 w21 w19 w17
*/ + 12873, 4520, 4520, 19266, /*; w30 w28 w26 w24
*/ + -22725, 19266, -12873, -22725, /*w31 w29 w27 w25
*/ /* the rest of these rows (1-7), aren't used !
*/ /*row1
*/ - 22725, 22725, 22725, -22725, /* ; movq-> w06 w04 w02 w00
*/ - 29692, 12299, 12299, -29692, /* ; w07 w05 w03 w01
*/ - 22725, -22725, 22725, 22725, /*; w14 w12 w10 w08
*/ - -12299, 29692, -29692, -12299, /*; w15 w13 w11 w09
*/ - 31521, 17855, 26722, -31521, /*; w22 w20 w18 w16
*/ - 26722, 6270, -6270, -17855, /*; w23 w21 w19 w17
*/ - 17855, 6270, 6270, 26722, /*; w30 w28 w26 w24
*/ - -31521, 26722, -17855, -31521, /* w31 w29 w27 w25
*/ + 22725, 22725, 22725, -22725, /* ; movq-> w06 w04 w02 w00
*/ + 29692, 12299, 12299, -29692, /* ; w07 w05 w03 w01
*/ + 22725, -22725, 22725, 22725, /*; w14 w12 w10 w08
*/ + -12299, 29692, -29692, -12299, /*; w15 w13 w11 w09
*/ + 31521, 17855, 26722, -31521, /*; w22 w20 w18 w16
*/ + 26722, 6270, -6270, -17855, /*; w23 w21 w19 w17
*/ + 17855, 6270, 6270, 26722, /*; w30 w28 w26 w24
*/ + -31521, 26722, -17855, -31521, /* w31 w29 w27 w25
*/ /*row2
*/ - 21407, 21407, 21407, -21407, /* ; movq-> w06 w04 w02 w00
*/ - 27969, 11585, 11585, -27969, /* ; w07 w05 w03 w01
*/ - 21407, -21407, 21407, 21407, /* ; w14 w12 w10 w08
*/ - -11585, 27969, -27969, -11585, /* ;w15 w13 w11 w09
*/ - 29692, 16819, 25172, -29692, /* ;w22 w20 w18 w16
*/ - 25172, 5906, -5906, -16819, /* ;w23 w21 w19 w17
*/ - 16819, 5906, 5906, 25172, /* ;w30 w28 w26 w24
*/ - -29692, 25172, -16819, -29692, /* ;w31 w29 w27 w25
*/ + 21407, 21407, 21407, -21407, /* ; movq-> w06 w04 w02 w00
*/ + 27969, 11585, 11585, -27969, /* ; w07 w05 w03 w01
*/ + 21407, -21407, 21407, 21407, /* ; w14 w12 w10 w08
*/ + -11585, 27969, -27969, -11585, /* ;w15 w13 w11 w09
*/ + 29692, 16819, 25172, -29692, /* ;w22 w20 w18 w16
*/ + 25172, 5906, -5906, -16819, /* ;w23 w21 w19 w17
*/ + 16819, 5906, 5906, 25172, /* ;w30 w28 w26 w24
*/ + -29692, 25172, -16819, -29692, /* ;w31 w29 w27 w25
*/ /*row3
*/ - 19266, 19266, 19266, -19266, /*; movq-> w06 w04 w02 w00
*/ - 25172, 10426, 10426, -25172, /*; w07 w05 w03 w01
*/ - 19266, -19266, 19266, 19266, /*; w14 w12 w10 w08
*/ - -10426, 25172, -25172, -10426, /*; w15 w13 w11 w09
*/ - 26722, 15137, 22654, -26722, /*; w22 w20 w18 w16
*/ - 22654, 5315, -5315, -15137, /*; w23 w21 w19 w17
*/ - 15137, 5315, 5315, 22654, /*; w30 w28 w26 w24
*/ - -26722, 22654, -15137, -26722, /*; w31 w29 w27 w25
*/ + 19266, 19266, 19266, -19266, /*; movq-> w06 w04 w02 w00
*/ + 25172, 10426, 10426, -25172, /*; w07 w05 w03 w01
*/ + 19266, -19266, 19266, 19266, /*; w14 w12 w10 w08
*/ + -10426, 25172, -25172, -10426, /*; w15 w13 w11 w09
*/ + 26722, 15137, 22654, -26722, /*; w22 w20 w18 w16
*/ + 22654, 5315, -5315, -15137, /*; w23 w21 w19 w17
*/ + 15137, 5315, 5315, 22654, /*; w30 w28 w26 w24
*/ + -26722, 22654, -15137, -26722, /*; w31 w29 w27 w25
*/ /*row4
*/ - 16384, 16384, 16384, -16384, /* ; movq-> w06 w04 w02 w00
*/ - 21407, 8867, 8867, -21407, /* w07 w05 w03 w01
*/ - 16384, -16384, 16384, 16384, /*; w14 w12 w10 w08
*/ - -8867, 21407, -21407, -8867, /*; w15 w13 w11 w09
*/ - 22725, 12873, 19266, -22725, /*; w22 w20 w18 w16
*/ - 19266, 4520, -4520, -12873, /*; w23 w21 w19 w17
*/ - 12873, 4520, 4520, 19266, /*; w30 w28 w26 w24
*/ - -22725, 19266, -12873, -22725, /*w31 w29 w27 w25
*/ + 16384, 16384, 16384, -16384, /* ; movq-> w06 w04 w02 w00
*/ + 21407, 8867, 8867, -21407, /* w07 w05 w03 w01
*/ + 16384, -16384, 16384, 16384, /*; w14 w12 w10 w08
*/ + -8867, 21407, -21407, -8867, /*; w15 w13 w11 w09
*/ + 22725, 12873, 19266, -22725, /*; w22 w20 w18 w16
*/ + 19266, 4520, -4520, -12873, /*; w23 w21 w19 w17
*/ + 12873, 4520, 4520, 19266, /*; w30 w28 w26 w24
*/ + -22725, 19266, -12873, -22725, /*w31 w29 w27 w25
*/ /*row5
*/ - 19266, 19266, 19266, -19266, /*; movq-> w06 w04 w02 w00
*/ - 25172, 10426, 10426, -25172, /*; w07 w05 w03 w01
*/ - 19266, -19266, 19266, 19266, /*; w14 w12 w10 w08
*/ - -10426, 25172, -25172, -10426, /*; w15 w13 w11 w09
*/ - 26722, 15137, 22654, -26722, /*; w22 w20 w18 w16
*/ - 22654, 5315, -5315, -15137, /*; w23 w21 w19 w17
*/ - 15137, 5315, 5315, 22654, /*; w30 w28 w26 w24
*/ - -26722, 22654, -15137, -26722, /*; w31 w29 w27 w25
*/ + 19266, 19266, 19266, -19266, /*; movq-> w06 w04 w02 w00
*/ + 25172, 10426, 10426, -25172, /*; w07 w05 w03 w01
*/ + 19266, -19266, 19266, 19266, /*; w14 w12 w10 w08
*/ + -10426, 25172, -25172, -10426, /*; w15 w13 w11 w09
*/ + 26722, 15137, 22654, -26722, /*; w22 w20 w18 w16
*/ + 22654, 5315, -5315, -15137, /*; w23 w21 w19 w17
*/ + 15137, 5315, 5315, 22654, /*; w30 w28 w26 w24
*/ + -26722, 22654, -15137, -26722, /*; w31 w29 w27 w25
*/ /*row6
*/ - 21407, 21407, 21407, -21407, /* ; movq-> w06 w04 w02 w00
*/ - 27969, 11585, 11585, -27969, /* ; w07 w05 w03 w01
*/ - 21407, -21407, 21407, 21407, /* ; w14 w12 w10 w08
*/ - -11585, 27969, -27969, -11585, /* ;w15 w13 w11 w09
*/ - 29692, 16819, 25172, -29692, /* ;w22 w20 w18 w16
*/ - 25172, 5906, -5906, -16819, /* ;w23 w21 w19 w17
*/ - 16819, 5906, 5906, 25172, /* ;w30 w28 w26 w24
*/ - -29692, 25172, -16819, -29692, /* ;w31 w29 w27 w25
*/ + 21407, 21407, 21407, -21407, /* ; movq-> w06 w04 w02 w00
*/ + 27969, 11585, 11585, -27969, /* ; w07 w05 w03 w01
*/ + 21407, -21407, 21407, 21407, /* ; w14 w12 w10 w08
*/ + -11585, 27969, -27969, -11585, /* ;w15 w13 w11 w09
*/ + 29692, 16819, 25172, -29692, /* ;w22 w20 w18 w16
*/ + 25172, 5906, -5906, -16819, /* ;w23 w21 w19 w17
*/ + 16819, 5906, 5906, 25172, /* ;w30 w28 w26 w24
*/ + -29692, 25172, -16819, -29692, /* ;w31 w29 w27 w25
*/ /*row7
*/ - 22725, 22725, 22725, -22725, /* ; movq-> w06 w04 w02 w00
*/ - 29692, 12299, 12299, -29692, /* ; w07 w05 w03 w01
*/ - 22725, -22725, 22725, 22725, /*; w14 w12 w10 w08
*/ - -12299, 29692, -29692, -12299, /*; w15 w13 w11 w09
*/ - 31521, 17855, 26722, -31521, /*; w22 w20 w18 w16
*/ - 26722, 6270, -6270, -17855, /*; w23 w21 w19 w17
*/ - 17855, 6270, 6270, 26722, /*; w30 w28 w26 w24
*/ + 22725, 22725, 22725, -22725, /* ; movq-> w06 w04 w02 w00
*/ + 29692, 12299, 12299, -29692, /* ; w07 w05 w03 w01
*/ + 22725, -22725, 22725, 22725, /*; w14 w12 w10 w08
*/ + -12299, 29692, -29692, -12299, /*; w15 w13 w11 w09
*/ + 31521, 17855, 26722, -31521, /*; w22 w20 w18 w16
*/ + 26722, 6270, -6270, -17855, /*; w23 w21 w19 w17
*/ + 17855, 6270, 6270, 26722, /*; w30 w28 w26 w24
*/ -31521, 26722, -17855, -31521 -}; /* w31 w29 w27 w25
*/ +}; /* w31 w29 w27 w25
*/ -#define INP eax /* pointer to (short *blk)
*/ -#define OUT ecx /* pointer to output (temporary store space qwTemp[])
*/ -#define TABLE ebx /* pointer to tab_i_01234567[]
*/ +#define INP eax /* pointer to (short *blk)
*/ +#define OUT ecx /* pointer to output (temporary store space qwTemp[])
*/ +#define TABLE ebx /* pointer to tab_i_01234567[]
*/ #define round_inv_row edx
#define round_inv_col edx
-#define ROW_STRIDE 8 /* for 8x8 matrix transposer
*/ +#define ROW_STRIDE 8 /* for 8x8 matrix transposer
*/ /* private variables and functions
*/ /*temporary storage space, 8x8 of shorts
*/ -
__inline static void idct_mmx32_rows (short *blk); /* transform rows
*/ -__inline static void idct_mmx32_cols (short *blk); /* transform "columns"
*/ +
__inline static void idct_mmx32_rows (short *blk); /* transform rows
*/ +__inline static void idct_mmx32_cols (short *blk); /* transform "columns"
*/ - /* the "column" transform actually transforms rows, it is
*/ - /* identical to the row-transform except for the ROUNDING
*/ - /* and SHIFTING coefficients.
*/ + /* the "column" transform actually transforms rows, it is
*/ + /* identical to the row-transform except for the ROUNDING
*/ + /* and SHIFTING coefficients.
*/
static void
idct_mmx32_rows (short *blk) -{ /* transform all 8 rows of 8x8 iDCT block
*/ +{ /* transform all 8 rows of 8x8 iDCT block
*/
int x;
short qwTemp[64];
short *out = &qwTemp[0]; @@ -402,58 +402,58 @@ idct_mmx32_rows (short *blk) /*
*/ /* 2) transpose the matrix (which was stored in qwTemp[])
*/ /* qwTemp[] -> [8x8 matrix transpose] -> blk[]
*/ -
for (x = 0; x < 8; x++) { /* transform one row per iteration
*/ - movq_m2r (*(inptr), mm0); /* 0 ; x3 x2 x1 x0
*/ -
movq_m2r (*(inptr + 4), mm1); /* 1 ; x7 x6 x5 x4
*/ - movq_r2r (mm0, mm2); /* 2 ; x3 x2 x1 x0
*/ -
movq_m2r (*(tab_i_01234567), mm3); /* 3 ; w06 w04 w02 w00
*/ - punpcklwd_r2r (mm1, mm0); /* x5 x1 x4 x0
*/ +
for (x = 0; x < 8; x++) { /* transform one row per iteration
*/ + movq_m2r (*(inptr), mm0); /* 0 ; x3 x2 x1 x0
*/ +
movq_m2r (*(inptr + 4), mm1); /* 1 ; x7 x6 x5 x4
*/ + movq_r2r (mm0, mm2); /* 2 ; x3 x2 x1 x0
*/ +
movq_m2r (*(tab_i_01234567), mm3); /* 3 ; w06 w04 w02 w00
*/ + punpcklwd_r2r (mm1, mm0); /* x5 x1 x4 x0
*/ - /* ----------
*/ - movq_r2r (mm0, mm5); /* 5 ; x5 x1 x4 x0
*/ - punpckldq_r2r (mm0, mm0); /* x4 x0 x4 x0
*/ -
movq_m2r (*(tab_i_01234567 + 4), mm4); /* 4 ; w07 w05 w03 w01
*/ - punpckhwd_r2r (mm1, mm2); /* 1 ; x7 x3 x6 x2
*/ -
pmaddwd_r2r (mm0, mm3); /* x4*w06+x0*w04 x4*w02+x0*w00
*/ - movq_r2r (mm2, mm6); /* 6 ; x7 x3 x6 x2
*/ -
movq_m2r (*(tab_i_01234567 + 16), mm1); /* 1 ; w22 w20 w18 w16
*/ - punpckldq_r2r (mm2, mm2); /* x6 x2 x6 x2
*/ -
pmaddwd_r2r (mm2, mm4); /* x6*w07+x2*w05 x6*w03+x2*w01
*/ - punpckhdq_r2r (mm5, mm5); /* x5 x1 x5 x1
*/ -
pmaddwd_m2r (*(tab_i_01234567 + 8), mm0); /* x4*w14+x0*w12 x4*w10+x0*w08
*/ - punpckhdq_r2r (mm6, mm6); /* x7 x3 x7 x3
*/ -
movq_m2r (*(tab_i_01234567 + 20), mm7); /* 7 ; w23 w21 w19 w17
*/ - pmaddwd_r2r (mm5, mm1); /* x5*w22+x1*w20 x5*w18+x1*w16
*/ -
paddd_m2r (*(r_inv_row), mm3); /* +rounder
*/ - pmaddwd_r2r (mm6, mm7); /* x7*w23+x3*w21 x7*w19+x3*w17
*/ -
pmaddwd_m2r (*(tab_i_01234567 + 12), mm2); /* x6*w15+x2*w13 x6*w11+x2*w09
*/ - paddd_r2r (mm4, mm3); /* 4 ; a1=sum(even1) a0=sum(even0)
*/ -
pmaddwd_m2r (*(tab_i_01234567 + 24), mm5); /* x5*w30+x1*w28 x5*w26+x1*w24
*/ - movq_r2r (mm3, mm4); /* 4 ; a1 a0
*/ -
pmaddwd_m2r (*(tab_i_01234567 + 28), mm6); /* x7*w31+x3*w29 x7*w27+x3*w25
*/ - paddd_r2r (mm7, mm1); /* 7 ; b1=sum(odd1) b0=sum(odd0)
*/ -
paddd_m2r (*(r_inv_row), mm0); /* +rounder
*/ - psubd_r2r (mm1, mm3); /* a1-b1 a0-b0
*/ -
psrad_i2r (SHIFT_INV_ROW, mm3); /* y6=a1-b1 y7=a0-b0
*/ - paddd_r2r (mm4, mm1); /* 4 ; a1+b1 a0+b0
*/ -
paddd_r2r (mm2, mm0); /* 2 ; a3=sum(even3) a2=sum(even2)
*/ - psrad_i2r (SHIFT_INV_ROW, mm1); /* y1=a1+b1 y0=a0+b0
*/ -
paddd_r2r (mm6, mm5); /* 6 ; b3=sum(odd3) b2=sum(odd2)
*/ - movq_r2r (mm0, mm4); /* 4 ; a3 a2
*/ -
paddd_r2r (mm5, mm0); /* a3+b3 a2+b2
*/ - psubd_r2r (mm5, mm4); /* 5 ; a3-b3 a2-b2
*/ -
psrad_i2r (SHIFT_INV_ROW, mm4); /* y4=a3-b3 y5=a2-b2
*/ - psrad_i2r (SHIFT_INV_ROW, mm0); /* y3=a3+b3 y2=a2+b2
*/ -
packssdw_r2r (mm3, mm4); /* 3 ; y6 y7 y4 y5
*/ -
packssdw_r2r (mm0, mm1); /* 0 ; y3 y2 y1 y0
*/ - movq_r2r (mm4, mm7); /* 7 ; y6 y7 y4 y5
*/ -
psrld_i2r (16, mm4); /* 0 y6 0 y4
*/ -
movq_r2m (mm1, *(out)); /* 1 ; save y3 y2 y1 y0
*/ - pslld_i2r (16, mm7); /* y7 0 y5 0
*/ -
por_r2r (mm4, mm7); /* 4 ; y7 y6 y5 y4
*/ + /* ----------
*/ + movq_r2r (mm0, mm5); /* 5 ; x5 x1 x4 x0
*/ + punpckldq_r2r (mm0, mm0); /* x4 x0 x4 x0
*/ +
movq_m2r (*(tab_i_01234567 + 4), mm4); /* 4 ; w07 w05 w03 w01
*/ + punpckhwd_r2r (mm1, mm2); /* 1 ; x7 x3 x6 x2
*/ +
pmaddwd_r2r (mm0, mm3); /* x4*w06+x0*w04 x4*w02+x0*w00
*/ + movq_r2r (mm2, mm6); /* 6 ; x7 x3 x6 x2
*/ +
movq_m2r (*(tab_i_01234567 + 16), mm1); /* 1 ; w22 w20 w18 w16
*/ + punpckldq_r2r (mm2, mm2); /* x6 x2 x6 x2
*/ +
pmaddwd_r2r (mm2, mm4); /* x6*w07+x2*w05 x6*w03+x2*w01
*/ + punpckhdq_r2r (mm5, mm5); /* x5 x1 x5 x1
*/ +
pmaddwd_m2r (*(tab_i_01234567 + 8), mm0); /* x4*w14+x0*w12 x4*w10+x0*w08
*/ + punpckhdq_r2r (mm6, mm6); /* x7 x3 x7 x3
*/ +
movq_m2r (*(tab_i_01234567 + 20), mm7); /* 7 ; w23 w21 w19 w17
*/ + pmaddwd_r2r (mm5, mm1); /* x5*w22+x1*w20 x5*w18+x1*w16
*/ +
paddd_m2r (*(r_inv_row), mm3); /* +rounder
*/ + pmaddwd_r2r (mm6, mm7); /* x7*w23+x3*w21 x7*w19+x3*w17
*/ +
pmaddwd_m2r (*(tab_i_01234567 + 12), mm2); /* x6*w15+x2*w13 x6*w11+x2*w09
*/ + paddd_r2r (mm4, mm3); /* 4 ; a1=sum(even1) a0=sum(even0)
*/ +
pmaddwd_m2r (*(tab_i_01234567 + 24), mm5); /* x5*w30+x1*w28 x5*w26+x1*w24
*/ + movq_r2r (mm3, mm4); /* 4 ; a1 a0
*/ +
pmaddwd_m2r (*(tab_i_01234567 + 28), mm6); /* x7*w31+x3*w29 x7*w27+x3*w25
*/ + paddd_r2r (mm7, mm1); /* 7 ; b1=sum(odd1) b0=sum(odd0)
*/ +
paddd_m2r (*(r_inv_row), mm0); /* +rounder
*/ + psubd_r2r (mm1, mm3); /* a1-b1 a0-b0
*/ +
psrad_i2r (SHIFT_INV_ROW, mm3); /* y6=a1-b1 y7=a0-b0
*/ + paddd_r2r (mm4, mm1); /* 4 ; a1+b1 a0+b0
*/ +
paddd_r2r (mm2, mm0); /* 2 ; a3=sum(even3) a2=sum(even2)
*/ + psrad_i2r (SHIFT_INV_ROW, mm1); /* y1=a1+b1 y0=a0+b0
*/ +
paddd_r2r (mm6, mm5); /* 6 ; b3=sum(odd3) b2=sum(odd2)
*/ + movq_r2r (mm0, mm4); /* 4 ; a3 a2
*/ +
paddd_r2r (mm5, mm0); /* a3+b3 a2+b2
*/ + psubd_r2r (mm5, mm4); /* 5 ; a3-b3 a2-b2
*/ +
psrad_i2r (SHIFT_INV_ROW, mm4); /* y4=a3-b3 y5=a2-b2
*/ + psrad_i2r (SHIFT_INV_ROW, mm0); /* y3=a3+b3 y2=a2+b2
*/ +
packssdw_r2r (mm3, mm4); /* 3 ; y6 y7 y4 y5
*/ +
packssdw_r2r (mm0, mm1); /* 0 ; y3 y2 y1 y0
*/ + movq_r2r (mm4, mm7); /* 7 ; y6 y7 y4 y5
*/ +
psrld_i2r (16, mm4); /* 0 y6 0 y4
*/ +
movq_r2m (mm1, *(out)); /* 1 ; save y3 y2 y1 y0
*/ + pslld_i2r (16, mm7); /* y7 0 y5 0
*/ +
por_r2r (mm4, mm7); /* 4 ; y7 y6 y5 y4
*/ - /* begin processing row 1
*/ - movq_r2m (mm7, *(out + 4)); /* 7 ; save y7 y6 y5 y4
*/ + /* begin processing row 1
*/ + movq_r2m (mm7, *(out + 4)); /* 7 ; save y7 y6 y5 y4
*/
inptr += 8;
out += 8;
} @@ -477,31 +477,31 @@ idct_mmx32_rows (short *blk) out = &qwTemp[0];
movq_m2r (*(out + ROW_STRIDE * 0), mm0);
movq_m2r (*(out + ROW_STRIDE * 1), mm1); -
movq_r2r (mm0, mm4); /* mm4 = copy of row1[A B C D]
*/ +
movq_r2r (mm0, mm4); /* mm4 = copy of row1[A B C D]
*/
movq_m2r (*(out + ROW_STRIDE * 2), mm2); -
punpcklwd_r2r (mm1, mm0); /* mm0 = [ 0 4 1 5]
*/ +
punpcklwd_r2r (mm1, mm0); /* mm0 = [ 0 4 1 5]
*/
movq_m2r (*(out + ROW_STRIDE * 3), mm3); -
punpckhwd_r2r (mm1, mm4); /* mm4 = [ 2 6 3 7]
*/ +
punpckhwd_r2r (mm1, mm4); /* mm4 = [ 2 6 3 7]
*/
movq_r2r (mm2, mm6); -
punpcklwd_r2r (mm3, mm2); /* mm2 = [ 8 12 9 13]
*/ -
punpckhwd_r2r (mm3, mm6); /* mm6 = 10 14 11 15]
*/ - movq_r2r (mm0, mm1); /* mm1 = [ 0 4 1 5]
*/ +
punpcklwd_r2r (mm3, mm2); /* mm2 = [ 8 12 9 13]
*/ +
punpckhwd_r2r (mm3, mm6); /* mm6 = 10 14 11 15]
*/ + movq_r2r (mm0, mm1); /* mm1 = [ 0 4 1 5]
*/
inptr = blk; -
punpckldq_r2r (mm2, mm0); /* final result mm0 = row1 [0 4 8 12]
*/ -
movq_r2r (mm4, mm3); /* mm3 = [ 2 6 3 7]
*/ - punpckhdq_r2r (mm2, mm1); /* mm1 = final result mm1 = row2 [1 5 9 13]
*/ -
movq_r2m (mm0, *(inptr + ROW_STRIDE * 0)); /* store row 1
*/ - punpckldq_r2r (mm6, mm4); /* final result mm4 = row3 [2 6 10 14]
*/ +
punpckldq_r2r (mm2, mm0); /* final result mm0 = row1 [0 4 8 12]
*/ +
movq_r2r (mm4, mm3); /* mm3 = [ 2 6 3 7]
*/ + punpckhdq_r2r (mm2, mm1); /* mm1 = final result mm1 = row2 [1 5 9 13]
*/ +
movq_r2m (mm0, *(inptr + ROW_STRIDE * 0)); /* store row 1
*/ + punpckldq_r2r (mm6, mm4); /* final result mm4 = row3 [2 6 10 14]
*/ /* begin reading next quadrant (lower-right)
*/ movq_m2r (*(out + ROW_STRIDE * 4 + 4), mm0); -
punpckhdq_r2r (mm6, mm3); /* final result mm3 = row4 [3 7 11 15]
*/ -
movq_r2m (mm4, *(inptr + ROW_STRIDE * 2)); /* store row 3
*/ - movq_r2r (mm0, mm4); /* mm4 = copy of row1[A B C D]
*/ -
movq_r2m (mm1, *(inptr + ROW_STRIDE * 1)); /* store row 2
*/ +
punpckhdq_r2r (mm6, mm3); /* final result mm3 = row4 [3 7 11 15]
*/ +
movq_r2m (mm4, *(inptr + ROW_STRIDE * 2)); /* store row 3
*/ + movq_r2r (mm0, mm4); /* mm4 = copy of row1[A B C D]
*/ +
movq_r2m (mm1, *(inptr + ROW_STRIDE * 1)); /* store row 2
*/
movq_m2r (*(out + ROW_STRIDE * 5 + 4), mm1); -
movq_r2m (mm3, *(inptr + ROW_STRIDE * 3)); /* store row 4
*/ - punpcklwd_r2r (mm1, mm0); /* mm0 = [ 0 4 1 5]
*/ +
movq_r2m (mm3, *(inptr + ROW_STRIDE * 3)); /* store row 4
*/ + punpcklwd_r2r (mm1, mm0); /* mm0 = [ 0 4 1 5]
*/ /* 2) transpose lower-right quadrant
*/ @@ -512,28 +512,28 @@ idct_mmx32_rows (short *blk)
movq_m2r (*(out + ROW_STRIDE * 6 + 4), mm2); /* punpcklwd mm0, mm1; // mm0 = [ 0 4 1 5]
*/ - punpckhwd_r2r (mm1, mm4); /* mm4 = [ 2 6 3 7]
*/ + punpckhwd_r2r (mm1, mm4); /* mm4 = [ 2 6 3 7]
*/
movq_m2r (*(out + ROW_STRIDE * 7 + 4), mm3);
movq_r2r (mm2, mm6); -
punpcklwd_r2r (mm3, mm2); /* mm2 = [ 8 12 9 13]
*/ - movq_r2r (mm0, mm1); /* mm1 = [ 0 4 1 5]
*/ -
punpckhwd_r2r (mm3, mm6); /* mm6 = 10 14 11 15]
*/ - movq_r2r (mm4, mm3); /* mm3 = [ 2 6 3 7]
*/ -
punpckldq_r2r (mm2, mm0); /* final result mm0 = row1 [0 4 8 12]
*/ -
punpckhdq_r2r (mm2, mm1); /* mm1 = final result mm1 = row2 [1 5 9 13]
*/ - ; /* slot
*/ -
movq_r2m (mm0, *(inptr + ROW_STRIDE * 4 + 4)); /* store row 1
*/ - punpckldq_r2r (mm6, mm4); /* final result mm4 = row3 [2 6 10 14]
*/ +
punpcklwd_r2r (mm3, mm2); /* mm2 = [ 8 12 9 13]
*/ + movq_r2r (mm0, mm1); /* mm1 = [ 0 4 1 5]
*/ +
punpckhwd_r2r (mm3, mm6); /* mm6 = 10 14 11 15]
*/ + movq_r2r (mm4, mm3); /* mm3 = [ 2 6 3 7]
*/ +
punpckldq_r2r (mm2, mm0); /* final result mm0 = row1 [0 4 8 12]
*/ +
punpckhdq_r2r (mm2, mm1); /* mm1 = final result mm1 = row2 [1 5 9 13]
*/ + ; /* slot
*/ +
movq_r2m (mm0, *(inptr + ROW_STRIDE * 4 + 4)); /* store row 1
*/ + punpckldq_r2r (mm6, mm4); /* final result mm4 = row3 [2 6 10 14]
*/
movq_m2r (*(out + ROW_STRIDE * 4), mm0); -
punpckhdq_r2r (mm6, mm3); /* final result mm3 = row4 [3 7 11 15]
*/ -
movq_r2m (mm4, *(inptr + ROW_STRIDE * 6 + 4)); /* store row 3
*/ - movq_r2r (mm0, mm4); /* mm4 = copy of row1[A B C D]
*/ -
movq_r2m (mm1, *(inptr + ROW_STRIDE * 5 + 4)); /* store row 2
*/ - ; /* slot
*/ +
punpckhdq_r2r (mm6, mm3); /* final result mm3 = row4 [3 7 11 15]
*/ +
movq_r2m (mm4, *(inptr + ROW_STRIDE * 6 + 4)); /* store row 3
*/ + movq_r2r (mm0, mm4); /* mm4 = copy of row1[A B C D]
*/ +
movq_r2m (mm1, *(inptr + ROW_STRIDE * 5 + 4)); /* store row 2
*/ + ; /* slot
*/
movq_m2r (*(out + ROW_STRIDE * 5), mm1); -
; /* slot
*/ -
movq_r2m (mm3, *(inptr + ROW_STRIDE * 7 + 4)); /* store row 4
*/ - punpcklwd_r2r (mm1, mm0); /* mm0 = [ 0 4 1 5]
*/ +
; /* slot
*/ +
movq_r2m (mm3, *(inptr + ROW_STRIDE * 7 + 4)); /* store row 4
*/ + punpcklwd_r2r (mm1, mm0); /* mm0 = [ 0 4 1 5]
*/ /* 3) transpose lower-left
*/ /* movq mm0, qword ptr [OUT + ROW_STRIDE * 4 ]
*/ @@ -543,28 +543,28 @@ idct_mmx32_rows (short *blk)
movq_m2r (*(out + ROW_STRIDE * 6), mm2); /* punpcklwd mm0, mm1; // mm0 = [ 0 4 1 5]
*/ - punpckhwd_r2r (mm1, mm4); /* mm4 = [ 2 6 3 7]
*/ + punpckhwd_r2r (mm1, mm4); /* mm4 = [ 2 6 3 7]
*/
movq_m2r (*(out + ROW_STRIDE * 7), mm3);
movq_r2r (mm2, mm6); -
punpcklwd_r2r (mm3, mm2); /* mm2 = [ 8 12 9 13]
*/ - movq_r2r (mm0, mm1); /* mm1 = [ 0 4 1 5]
*/ -
punpckhwd_r2r (mm3, mm6); /* mm6 = 10 14 11 15]
*/ - movq_r2r (mm4, mm3); /* mm3 = [ 2 6 3 7]
*/ -
punpckldq_r2r (mm2, mm0); /* final result mm0 = row1 [0 4 8 12]
*/ -
punpckhdq_r2r (mm2, mm1); /* mm1 = final result mm1 = row2 [1 5 9 13]
*/ - ; /*slot
*/ -
movq_r2m (mm0, *(inptr + ROW_STRIDE * 0 + 4)); /* store row 1
*/ - punpckldq_r2r (mm6, mm4); /* final result mm4 = row3 [2 6 10 14]
*/ +
punpcklwd_r2r (mm3, mm2); /* mm2 = [ 8 12 9 13]
*/ + movq_r2r (mm0, mm1); /* mm1 = [ 0 4 1 5]
*/ +
punpckhwd_r2r (mm3, mm6); /* mm6 = 10 14 11 15]
*/ + movq_r2r (mm4, mm3); /* mm3 = [ 2 6 3 7]
*/ +
punpckldq_r2r (mm2, mm0); /* final result mm0 = row1 [0 4 8 12]
*/ +
punpckhdq_r2r (mm2, mm1); /* mm1 = final result mm1 = row2 [1 5 9 13]
*/ + ; /*slot
*/ +
movq_r2m (mm0, *(inptr + ROW_STRIDE * 0 + 4)); /* store row 1
*/ + punpckldq_r2r (mm6, mm4); /* final result mm4 = row3 [2 6 10 14]
*/ /* begin reading next quadrant (upper-right)
*/ movq_m2r (*(out + ROW_STRIDE * 0 + 4), mm0); -
punpckhdq_r2r (mm6, mm3); /* final result mm3 = row4 [3 7 11 15]
*/ -
movq_r2m (mm4, *(inptr + ROW_STRIDE * 2 + 4)); /* store row 3
*/ - movq_r2r (mm0, mm4); /* mm4 = copy of row1[A B C D]
*/ -
movq_r2m (mm1, *(inptr + ROW_STRIDE * 1 + 4)); /* store row 2
*/ +
punpckhdq_r2r (mm6, mm3); /* final result mm3 = row4 [3 7 11 15]
*/ +
movq_r2m (mm4, *(inptr + ROW_STRIDE * 2 + 4)); /* store row 3
*/ + movq_r2r (mm0, mm4); /* mm4 = copy of row1[A B C D]
*/ +
movq_r2m (mm1, *(inptr + ROW_STRIDE * 1 + 4)); /* store row 2
*/ movq_m2r (*(out + ROW_STRIDE * 1 + 4), mm1); -
movq_r2m (mm3, *(inptr + ROW_STRIDE * 3 + 4)); /* store row 4
*/ - punpcklwd_r2r (mm1, mm0); /* mm0 = [ 0 4 1 5]
*/ +
movq_r2m (mm3, *(inptr + ROW_STRIDE * 3 + 4)); /* store row 4
*/ + punpcklwd_r2r (mm1, mm0); /* mm0 = [ 0 4 1 5]
*/ /* 2) transpose lower-right quadrant
*/ @@ -575,28 +575,28 @@ idct_mmx32_rows (short *blk)
movq_m2r (*(out + ROW_STRIDE * 2 + 4), mm2); /* punpcklwd mm0, mm1; // mm0 = [ 0 4 1 5]
*/ - punpckhwd_r2r (mm1, mm4); /* mm4 = [ 2 6 3 7]
*/ + punpckhwd_r2r (mm1, mm4); /* mm4 = [ 2 6 3 7]
*/
movq_m2r (*(out + ROW_STRIDE * 3 + 4), mm3);
movq_r2r (mm2, mm6); -
punpcklwd_r2r (mm3, mm2); /* mm2 = [ 8 12 9 13]
*/ - movq_r2r (mm0, mm1); /* mm1 = [ 0 4 1 5]
*/ -
punpckhwd_r2r (mm3, mm6); /* mm6 = 10 14 11 15]
*/ - movq_r2r (mm4, mm3); /* mm3 = [ 2 6 3 7]
*/ -
punpckldq_r2r (mm2, mm0); /* final result mm0 = row1 [0 4 8 12]
*/ -
punpckhdq_r2r (mm2, mm1); /* mm1 = final result mm1 = row2 [1 5 9 13]
*/ - ; /* slot
*/ -
movq_r2m (mm0, *(inptr + ROW_STRIDE * 4)); /* store row 1
*/ - punpckldq_r2r (mm6, mm4); /* final result mm4 = row3 [2 6 10 14]
*/ -
movq_r2m (mm1, *(inptr + ROW_STRIDE * 5)); /* store row 2
*/ - punpckhdq_r2r (mm6, mm3); /* final result mm3 = row4 [3 7 11 15]
*/ -
movq_r2m (mm4, *(inptr + ROW_STRIDE * 6)); /* store row 3
*/ - ; /* slot
*/ -
movq_r2m (mm3, *(inptr + ROW_STRIDE * 7)); /* store row 4
*/ - ; /* slot
*/ +
punpcklwd_r2r (mm3, mm2); /* mm2 = [ 8 12 9 13]
*/ + movq_r2r (mm0, mm1); /* mm1 = [ 0 4 1 5]
*/ +
punpckhwd_r2r (mm3, mm6); /* mm6 = 10 14 11 15]
*/ + movq_r2r (mm4, mm3); /* mm3 = [ 2 6 3 7]
*/ +
punpckldq_r2r (mm2, mm0); /* final result mm0 = row1 [0 4 8 12]
*/ +
punpckhdq_r2r (mm2, mm1); /* mm1 = final result mm1 = row2 [1 5 9 13]
*/ + ; /* slot
*/ +
movq_r2m (mm0, *(inptr + ROW_STRIDE * 4)); /* store row 1
*/ + punpckldq_r2r (mm6, mm4); /* final result mm4 = row3 [2 6 10 14]
*/ +
movq_r2m (mm1, *(inptr + ROW_STRIDE * 5)); /* store row 2
*/ + punpckhdq_r2r (mm6, mm3); /* final result mm3 = row4 [3 7 11 15]
*/ +
movq_r2m (mm4, *(inptr + ROW_STRIDE * 6)); /* store row 3
*/ + ; /* slot
*/ +
movq_r2m (mm3, *(inptr + ROW_STRIDE * 7)); /* store row 4
*/ + ; /* slot
*/
}
static void
idct_mmx32_cols (short *blk) -{ /* transform all 8 cols of 8x8 iDCT block
*/ +{ /* transform all 8 cols of 8x8 iDCT block
*/
int x;
short *inptr = blk; @@ -612,58 +612,58 @@ idct_mmx32_cols (short *blk) /*
*/ /* 2) transpose the matrix (which was stored in qwTemp[])
*/ /* qwTemp[] -> [8x8 matrix transpose] -> blk[]
*/ -
for (x = 0; x < 8; x++) { /* transform one row per iteration
*/ -
movq_m2r (*(inptr), mm0); /* 0 ; x3 x2 x1 x0
*/ -
movq_m2r (*(inptr + 4), mm1); /* 1 ; x7 x6 x5 x4
*/ - movq_r2r (mm0, mm2); /* 2 ; x3 x2 x1 x0
*/ -
movq_m2r (*(tab_i_01234567), mm3); /* 3 ; w06 w04 w02 w00
*/ - punpcklwd_r2r (mm1, mm0); /* x5 x1 x4 x0
*/ +
for (x = 0; x < 8; x++) { /* transform one row per iteration
*/ +
movq_m2r (*(inptr), mm0); /* 0 ; x3 x2 x1 x0
*/ +
movq_m2r (*(inptr + 4), mm1); /* 1 ; x7 x6 x5 x4
*/ + movq_r2r (mm0, mm2); /* 2 ; x3 x2 x1 x0
*/ +
movq_m2r (*(tab_i_01234567), mm3); /* 3 ; w06 w04 w02 w00
*/ + punpcklwd_r2r (mm1, mm0); /* x5 x1 x4 x0
*/ /* ----------
*/ - movq_r2r (mm0, mm5); /* 5 ; x5 x1 x4 x0
*/ - punpckldq_r2r (mm0, mm0); /* x4 x0 x4 x0
*/ -
movq_m2r (*(tab_i_01234567 + 4), mm4); /* 4 ; w07 w05 w03 w01
*/ - punpckhwd_r2r (mm1, mm2); /* 1 ; x7 x3 x6 x2
*/ -
pmaddwd_r2r (mm0, mm3); /* x4*w06+x0*w04 x4*w02+x0*w00
*/ - movq_r2r (mm2, mm6); /* 6 ; x7 x3 x6 x2
*/ -
movq_m2r (*(tab_i_01234567 + 16), mm1); /* 1 ; w22 w20 w18 w16
*/ - punpckldq_r2r (mm2, mm2); /* x6 x2 x6 x2
*/ -
pmaddwd_r2r (mm2, mm4); /* x6*w07+x2*w05 x6*w03+x2*w01
*/ - punpckhdq_r2r (mm5, mm5); /* x5 x1 x5 x1
*/ -
pmaddwd_m2r (*(tab_i_01234567 + 8), mm0); /* x4*w14+x0*w12 x4*w10+x0*w08
*/ - punpckhdq_r2r (mm6, mm6); /* x7 x3 x7 x3
*/ -
movq_m2r (*(tab_i_01234567 + 20), mm7); /* 7 ; w23 w21 w19 w17
*/ - pmaddwd_r2r (mm5, mm1); /* x5*w22+x1*w20 x5*w18+x1*w16
*/ -
paddd_m2r (*(r_inv_col), mm3); /* +rounder
*/ - pmaddwd_r2r (mm6, mm7); /* x7*w23+x3*w21 x7*w19+x3*w17
*/ -
pmaddwd_m2r (*(tab_i_01234567 + 12), mm2); /* x6*w15+x2*w13 x6*w11+x2*w09
*/ - paddd_r2r (mm4, mm3); /* 4 ; a1=sum(even1) a0=sum(even0)
*/ -
pmaddwd_m2r (*(tab_i_01234567 + 24), mm5); /* x5*w30+x1*w28 x5*w26+x1*w24
*/ - movq_r2r (mm3, mm4); /* 4 ; a1 a0
*/ -
pmaddwd_m2r (*(tab_i_01234567 + 28), mm6); /* x7*w31+x3*w29 x7*w27+x3*w25
*/ - paddd_r2r (mm7, mm1); /* 7 ; b1=sum(odd1) b0=sum(odd0)
*/ -
paddd_m2r (*(r_inv_col), mm0); /* +rounder
*/ - psubd_r2r (mm1, mm3); /* a1-b1 a0-b0
*/ -
psrad_i2r (SHIFT_INV_COL, mm3); /* y6=a1-b1 y7=a0-b0
*/ - paddd_r2r (mm4, mm1); /* 4 ; a1+b1 a0+b0
*/ -
paddd_r2r (mm2, mm0); /* 2 ; a3=sum(even3) a2=sum(even2)
*/ - psrad_i2r (SHIFT_INV_COL, mm1); /* y1=a1+b1 y0=a0+b0
*/ -
paddd_r2r (mm6, mm5); /* 6 ; b3=sum(odd3) b2=sum(odd2)
*/ - movq_r2r (mm0, mm4); /* 4 ; a3 a2
*/ -
paddd_r2r (mm5, mm0); /* a3+b3 a2+b2
*/ - psubd_r2r (mm5, mm4); /* 5 ; a3-b3 a2-b2
*/ -
psrad_i2r (SHIFT_INV_COL, mm4); /* y4=a3-b3 y5=a2-b2
*/ - psrad_i2r (SHIFT_INV_COL, mm0); /* y3=a3+b3 y2=a2+b2
*/ -
packssdw_r2r (mm3, mm4); /* 3 ; y6 y7 y4 y5
*/ -
packssdw_r2r (mm0, mm1); /* 0 ; y3 y2 y1 y0
*/ - movq_r2r (mm4, mm7); /* 7 ; y6 y7 y4 y5
*/ -
psrld_i2r (16, mm4); /* 0 y6 0 y4
*/ -
movq_r2m (mm1, *(inptr)); /* 1 ; save y3 y2 y1 y0
*/ - pslld_i2r (16, mm7); /* y7 0 y5 0
*/ -
por_r2r (mm4, mm7); /* 4 ; y7 y6 y5 y4
*/ + movq_r2r (mm0, mm5); /* 5 ; x5 x1 x4 x0
*/ + punpckldq_r2r (mm0, mm0); /* x4 x0 x4 x0
*/ +
movq_m2r (*(tab_i_01234567 + 4), mm4); /* 4 ; w07 w05 w03 w01
*/ + punpckhwd_r2r (mm1, mm2); /* 1 ; x7 x3 x6 x2
*/ +
pmaddwd_r2r (mm0, mm3); /* x4*w06+x0*w04 x4*w02+x0*w00
*/ + movq_r2r (mm2, mm6); /* 6 ; x7 x3 x6 x2
*/ +
movq_m2r (*(tab_i_01234567 + 16), mm1); /* 1 ; w22 w20 w18 w16
*/ + punpckldq_r2r (mm2, mm2); /* x6 x2 x6 x2
*/ +
pmaddwd_r2r (mm2, mm4); /* x6*w07+x2*w05 x6*w03+x2*w01
*/ + punpckhdq_r2r (mm5, mm5); /* x5 x1 x5 x1
*/ +
pmaddwd_m2r (*(tab_i_01234567 + 8), mm0); /* x4*w14+x0*w12 x4*w10+x0*w08
*/ + punpckhdq_r2r (mm6, mm6); /* x7 x3 x7 x3
*/ +
movq_m2r (*(tab_i_01234567 + 20), mm7); /* 7 ; w23 w21 w19 w17
*/ + pmaddwd_r2r (mm5, mm1); /* x5*w22+x1*w20 x5*w18+x1*w16
*/ +
paddd_m2r (*(r_inv_col), mm3); /* +rounder
*/ + pmaddwd_r2r (mm6, mm7); /* x7*w23+x3*w21 x7*w19+x3*w17
*/ +
pmaddwd_m2r (*(tab_i_01234567 + 12), mm2); /* x6*w15+x2*w13 x6*w11+x2*w09
*/ + paddd_r2r (mm4, mm3); /* 4 ; a1=sum(even1) a0=sum(even0)
*/ +
pmaddwd_m2r (*(tab_i_01234567 + 24), mm5); /* x5*w30+x1*w28 x5*w26+x1*w24
*/ + movq_r2r (mm3, mm4); /* 4 ; a1 a0
*/ +
pmaddwd_m2r (*(tab_i_01234567 + 28), mm6); /* x7*w31+x3*w29 x7*w27+x3*w25
*/ + paddd_r2r (mm7, mm1); /* 7 ; b1=sum(odd1) b0=sum(odd0)
*/ +
paddd_m2r (*(r_inv_col), mm0); /* +rounder
*/ + psubd_r2r (mm1, mm3); /* a1-b1 a0-b0
*/ +
psrad_i2r (SHIFT_INV_COL, mm3); /* y6=a1-b1 y7=a0-b0
*/ + paddd_r2r (mm4, mm1); /* 4 ; a1+b1 a0+b0
*/ +
paddd_r2r (mm2, mm0); /* 2 ; a3=sum(even3) a2=sum(even2)
*/ + psrad_i2r (SHIFT_INV_COL, mm1); /* y1=a1+b1 y0=a0+b0
*/ +
paddd_r2r (mm6, mm5); /* 6 ; b3=sum(odd3) b2=sum(odd2)
*/ + movq_r2r (mm0, mm4); /* 4 ; a3 a2
*/ +
paddd_r2r (mm5, mm0); /* a3+b3 a2+b2
*/ + psubd_r2r (mm5, mm4); /* 5 ; a3-b3 a2-b2
*/ +
psrad_i2r (SHIFT_INV_COL, mm4); /* y4=a3-b3 y5=a2-b2
*/ + psrad_i2r (SHIFT_INV_COL, mm0); /* y3=a3+b3 y2=a2+b2
*/ +
packssdw_r2r (mm3, mm4); /* 3 ; y6 y7 y4 y5
*/ +
packssdw_r2r (mm0, mm1); /* 0 ; y3 y2 y1 y0
*/ + movq_r2r (mm4, mm7); /* 7 ; y6 y7 y4 y5
*/ +
psrld_i2r (16, mm4); /* 0 y6 0 y4
*/ +
movq_r2m (mm1, *(inptr)); /* 1 ; save y3 y2 y1 y0
*/ + pslld_i2r (16, mm7); /* y7 0 y5 0
*/ +
por_r2r (mm4, mm7); /* 4 ; y7 y6 y5 y4
*/ - /* begin processing row 1
*/ - movq_r2m (mm7, *(inptr + 4)); /* 7 ; save y7 y6 y5 y4
*/ + /* begin processing row 1
*/ + movq_r2m (mm7, *(inptr + 4)); /* 7 ; save y7 y6 y5 y4
*/
inptr += 8;
} @@ -679,10 +679,12 @@ gst_idct_mmx32_idct (short *blk) { /* 1) iDCT row transformation
*/ - idct_mmx32_rows (blk); /* 1) transform iDCT row, and transpose
*/ + idct_mmx32_rows (blk); /* 1) transform iDCT row, and transpose
*/ /* 2) iDCT column transformation
*/ - idct_mmx32_cols (blk); /* 2) transform iDCT row, and transpose
*/ -
emms (); /* restore processor state
*/ + idct_mmx32_cols (blk); /* 2) transform iDCT row, and transpose
*/ +
emms (); /* restore processor state
*/ /* all done
*/ -}
+} + +
diff --git a/gst-libs/gst/interfaces/colorbalance.c b/gst-libs/gst/interfaces/colorbalance.c index fbf1858181..ac6e511ebe 100644 --- a/gst-libs/gst/interfaces/colorbalance.c +++ b/gst-libs/gst/interfaces/colorbalance.c @@ -56,9 +56,9 @@ gst_color_balance_get_type (void) }; gst_color_balance_type = g_type_register_static (G_TYPE_INTERFACE, - "GstColorBalance", &gst_color_balance_info, 0); + "GstColorBalance", &gst_color_balance_info, 0); g_type_interface_add_prerequisite (gst_color_balance_type, - GST_TYPE_IMPLEMENTS_INTERFACE); + GST_TYPE_IMPLEMENTS_INTERFACE); } return gst_color_balance_type; @@ -71,12 +71,12 @@ gst_color_balance_class_init (GstColorBalanceClass * klass) if (!initialized) { gst_color_balance_signals[VALUE_CHANGED] = - g_signal_new ("value-changed", - GST_TYPE_COLOR_BALANCE, G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (GstColorBalanceClass, value_changed), - NULL, NULL, - gst_color_balance_marshal_VOID__OBJECT_INT, - G_TYPE_NONE, 2, GST_TYPE_COLOR_BALANCE_CHANNEL, G_TYPE_INT); + g_signal_new ("value-changed", + GST_TYPE_COLOR_BALANCE, G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (GstColorBalanceClass, value_changed), + NULL, NULL, + gst_color_balance_marshal_VOID__OBJECT_INT, + G_TYPE_NONE, 2, GST_TYPE_COLOR_BALANCE_CHANNEL, G_TYPE_INT); initialized = TRUE; } diff --git a/gst-libs/gst/interfaces/colorbalancechannel.c b/gst-libs/gst/interfaces/colorbalancechannel.c index 7812ed9303..4fd0ea8887 100644 --- a/gst-libs/gst/interfaces/colorbalancechannel.c +++ b/gst-libs/gst/interfaces/colorbalancechannel.c @@ -60,8 +60,8 @@ gst_color_balance_channel_get_type (void) }; gst_color_balance_channel_type = - g_type_register_static (G_TYPE_OBJECT, - "GstColorBalanceChannel", &color_balance_channel_info, 0); + g_type_register_static (G_TYPE_OBJECT, + "GstColorBalanceChannel", &color_balance_channel_info, 0); } return gst_color_balance_channel_type; @@ -78,7 +78,7 @@ gst_color_balance_channel_class_init (GstColorBalanceChannelClass * klass) g_signal_new ("value-changed", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (GstColorBalanceChannelClass, - value_changed), + value_changed), NULL, NULL, g_cclosure_marshal_VOID__INT, G_TYPE_NONE, 1, G_TYPE_INT); object_klass->dispose = gst_color_balance_channel_dispose; diff --git a/gst-libs/gst/interfaces/mixer.c b/gst-libs/gst/interfaces/mixer.c index a9034f608c..1db3d6a3ca 100644 --- a/gst-libs/gst/interfaces/mixer.c +++ b/gst-libs/gst/interfaces/mixer.c @@ -57,9 +57,9 @@ gst_mixer_get_type (void) }; gst_mixer_type = g_type_register_static (G_TYPE_INTERFACE, - "GstMixer", &gst_mixer_info, 0); + "GstMixer", &gst_mixer_info, 0); g_type_interface_add_prerequisite (gst_mixer_type, - GST_TYPE_IMPLEMENTS_INTERFACE); + GST_TYPE_IMPLEMENTS_INTERFACE); } return gst_mixer_type; @@ -72,26 +72,26 @@ gst_mixer_class_init (GstMixerClass * klass) if (!initialized) { gst_mixer_signals[RECORD_TOGGLED] = - g_signal_new ("record-toggled", - GST_TYPE_MIXER, G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (GstMixerClass, record_toggled), - NULL, NULL, - gst_mixer_marshal_VOID__OBJECT_BOOLEAN, G_TYPE_NONE, 2, - GST_TYPE_MIXER_TRACK, G_TYPE_BOOLEAN); + g_signal_new ("record-toggled", + GST_TYPE_MIXER, G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (GstMixerClass, record_toggled), + NULL, NULL, + gst_mixer_marshal_VOID__OBJECT_BOOLEAN, G_TYPE_NONE, 2, + GST_TYPE_MIXER_TRACK, G_TYPE_BOOLEAN); gst_mixer_signals[MUTE_TOGGLED] = - g_signal_new ("mute-toggled", - GST_TYPE_MIXER, G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (GstMixerClass, mute_toggled), - NULL, NULL, - gst_mixer_marshal_VOID__OBJECT_BOOLEAN, G_TYPE_NONE, 2, - GST_TYPE_MIXER_TRACK, G_TYPE_BOOLEAN); + g_signal_new ("mute-toggled", + GST_TYPE_MIXER, G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (GstMixerClass, mute_toggled), + NULL, NULL, + gst_mixer_marshal_VOID__OBJECT_BOOLEAN, G_TYPE_NONE, 2, + GST_TYPE_MIXER_TRACK, G_TYPE_BOOLEAN); gst_mixer_signals[VOLUME_CHANGED] = - g_signal_new ("volume-changed", - GST_TYPE_MIXER, G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (GstMixerClass, volume_changed), - NULL, NULL, - gst_mixer_marshal_VOID__OBJECT_POINTER, G_TYPE_NONE, 2, - GST_TYPE_MIXER_TRACK, G_TYPE_POINTER); + g_signal_new ("volume-changed", + GST_TYPE_MIXER, G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (GstMixerClass, volume_changed), + NULL, NULL, + gst_mixer_marshal_VOID__OBJECT_POINTER, G_TYPE_NONE, 2, + GST_TYPE_MIXER_TRACK, G_TYPE_POINTER); initialized = TRUE; } diff --git a/gst-libs/gst/interfaces/mixertrack.c b/gst-libs/gst/interfaces/mixertrack.c index af52aec8cb..ae8976f156 100644 --- a/gst-libs/gst/interfaces/mixertrack.c +++ b/gst-libs/gst/interfaces/mixertrack.c @@ -61,8 +61,8 @@ gst_mixer_track_get_type (void) }; gst_mixer_track_type = - g_type_register_static (G_TYPE_OBJECT, - "GstMixerTrack", &mixer_track_info, 0); + g_type_register_static (G_TYPE_OBJECT, + "GstMixerTrack", &mixer_track_info, 0); } return gst_mixer_track_type; @@ -79,21 +79,21 @@ gst_mixer_track_class_init (GstMixerTrackClass * klass) g_signal_new ("record_toggled", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (GstMixerTrackClass, - record_toggled), + record_toggled), NULL, NULL, g_cclosure_marshal_VOID__BOOLEAN, G_TYPE_NONE, 1, G_TYPE_BOOLEAN); signals[SIGNAL_MUTE_TOGGLED] = g_signal_new ("mute_toggled", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (GstMixerTrackClass, - mute_toggled), + mute_toggled), NULL, NULL, g_cclosure_marshal_VOID__BOOLEAN, G_TYPE_NONE, 1, G_TYPE_BOOLEAN); signals[SIGNAL_VOLUME_CHANGED] = g_signal_new ("volume_changed", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (GstMixerTrackClass, - volume_changed), + volume_changed), NULL, NULL, g_cclosure_marshal_VOID__POINTER, G_TYPE_NONE, 1, G_TYPE_POINTER); diff --git a/gst-libs/gst/interfaces/navigation.c b/gst-libs/gst/interfaces/navigation.c index 35ae2ba5fe..32510ffaef 100644 --- a/gst-libs/gst/interfaces/navigation.c +++ b/gst-libs/gst/interfaces/navigation.c @@ -46,7 +46,7 @@ gst_navigation_get_type (void) }; gst_navigation_type = g_type_register_static (G_TYPE_INTERFACE, - "GstNavigation", &gst_navigation_info, 0); + "GstNavigation", &gst_navigation_info, 0); } return gst_navigation_type; @@ -75,7 +75,7 @@ gst_navigation_send_key_event (GstNavigation * navigation, const char *event, { gst_navigation_send_event (navigation, gst_structure_new ("application/x-gst-navigation", "event", G_TYPE_STRING, - event, "key", G_TYPE_STRING, key, NULL)); + event, "key", G_TYPE_STRING, key, NULL)); } void @@ -84,6 +84,6 @@ gst_navigation_send_mouse_event (GstNavigation * navigation, const char *event, { gst_navigation_send_event (navigation, gst_structure_new ("application/x-gst-navigation", "event", G_TYPE_STRING, - event, "button", G_TYPE_INT, button, "pointer_x", G_TYPE_DOUBLE, x, - "pointer_y", G_TYPE_DOUBLE, y, NULL)); + event, "button", G_TYPE_INT, button, "pointer_x", G_TYPE_DOUBLE, x, + "pointer_y", G_TYPE_DOUBLE, y, NULL)); } diff --git a/gst-libs/gst/interfaces/propertyprobe.c b/gst-libs/gst/interfaces/propertyprobe.c index 05dd3f8fdc..730151e977 100644 --- a/gst-libs/gst/interfaces/propertyprobe.c +++ b/gst-libs/gst/interfaces/propertyprobe.c @@ -56,8 +56,8 @@ gst_property_probe_get_type (void) }; gst_property_probe_type = - g_type_register_static (G_TYPE_INTERFACE, - "GstPropertyProbe", &gst_property_probe_info, 0); + g_type_register_static (G_TYPE_INTERFACE, + "GstPropertyProbe", &gst_property_probe_info, 0); } return gst_property_probe_type; @@ -70,10 +70,10 @@ gst_property_probe_iface_init (GstPropertyProbeInterface * iface) if (!initialized) { gst_property_probe_signals[SIGNAL_PROBE_NEEDED] = - g_signal_new ("probe-needed", G_TYPE_FROM_CLASS (iface), - G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (GstPropertyProbeInterface, - probe_needed), NULL, NULL, g_cclosure_marshal_VOID__POINTER, - G_TYPE_NONE, 1, G_TYPE_POINTER); + g_signal_new ("probe-needed", G_TYPE_FROM_CLASS (iface), + G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (GstPropertyProbeInterface, + probe_needed), NULL, NULL, g_cclosure_marshal_VOID__POINTER, + G_TYPE_NONE, 1, G_TYPE_POINTER); initialized = TRUE; } diff --git a/gst-libs/gst/interfaces/tuner.c b/gst-libs/gst/interfaces/tuner.c index fd1c354f00..5bfe1ae7b1 100644 --- a/gst-libs/gst/interfaces/tuner.c +++ b/gst-libs/gst/interfaces/tuner.c @@ -60,9 +60,9 @@ gst_tuner_get_type (void) }; gst_tuner_type = g_type_register_static (G_TYPE_INTERFACE, - "GstTuner", &gst_tuner_info, 0); + "GstTuner", &gst_tuner_info, 0); g_type_interface_add_prerequisite (gst_tuner_type, - GST_TYPE_IMPLEMENTS_INTERFACE); + GST_TYPE_IMPLEMENTS_INTERFACE); } return gst_tuner_type; @@ -75,32 +75,32 @@ gst_tuner_class_init (GstTunerClass * klass) if (!initialized) { gst_tuner_signals[NORM_CHANGED] = - g_signal_new ("norm-changed", - GST_TYPE_TUNER, G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (GstTunerClass, norm_changed), - NULL, NULL, - g_cclosure_marshal_VOID__OBJECT, G_TYPE_NONE, 1, GST_TYPE_TUNER_NORM); + g_signal_new ("norm-changed", + GST_TYPE_TUNER, G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (GstTunerClass, norm_changed), + NULL, NULL, + g_cclosure_marshal_VOID__OBJECT, G_TYPE_NONE, 1, GST_TYPE_TUNER_NORM); gst_tuner_signals[CHANNEL_CHANGED] = - g_signal_new ("channel-changed", - GST_TYPE_TUNER, G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (GstTunerClass, channel_changed), - NULL, NULL, - g_cclosure_marshal_VOID__OBJECT, G_TYPE_NONE, 1, - GST_TYPE_TUNER_CHANNEL); + g_signal_new ("channel-changed", + GST_TYPE_TUNER, G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (GstTunerClass, channel_changed), + NULL, NULL, + g_cclosure_marshal_VOID__OBJECT, G_TYPE_NONE, 1, + GST_TYPE_TUNER_CHANNEL); gst_tuner_signals[FREQUENCY_CHANGED] = - g_signal_new ("frequency-changed", - GST_TYPE_TUNER, G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (GstTunerClass, frequency_changed), - NULL, NULL, - gst_tuner_marshal_VOID__OBJECT_ULONG, G_TYPE_NONE, 2, - GST_TYPE_TUNER_CHANNEL, G_TYPE_ULONG); + g_signal_new ("frequency-changed", + GST_TYPE_TUNER, G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (GstTunerClass, frequency_changed), + NULL, NULL, + gst_tuner_marshal_VOID__OBJECT_ULONG, G_TYPE_NONE, 2, + GST_TYPE_TUNER_CHANNEL, G_TYPE_ULONG); gst_tuner_signals[SIGNAL_CHANGED] = - g_signal_new ("signal-changed", - GST_TYPE_TUNER, G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (GstTunerClass, signal_changed), - NULL, NULL, - gst_tuner_marshal_VOID__OBJECT_INT, G_TYPE_NONE, 2, - GST_TYPE_TUNER_CHANNEL, G_TYPE_INT); + g_signal_new ("signal-changed", + GST_TYPE_TUNER, G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (GstTunerClass, signal_changed), + NULL, NULL, + gst_tuner_marshal_VOID__OBJECT_INT, G_TYPE_NONE, 2, + GST_TYPE_TUNER_CHANNEL, G_TYPE_INT); initialized = TRUE; } @@ -262,7 +262,7 @@ gst_tuner_set_frequency (GstTuner * tuner, GstTunerClass *klass = GST_TUNER_GET_CLASS (tuner); g_return_if_fail (GST_TUNER_CHANNEL_HAS_FLAG (channel, - GST_TUNER_CHANNEL_FREQUENCY)); + GST_TUNER_CHANNEL_FREQUENCY)); if (klass->set_frequency) { klass->set_frequency (tuner, channel, frequency); @@ -286,7 +286,7 @@ gst_tuner_get_frequency (GstTuner * tuner, GstTunerChannel * channel) GstTunerClass *klass = GST_TUNER_GET_CLASS (tuner); g_return_val_if_fail (GST_TUNER_CHANNEL_HAS_FLAG (channel, - GST_TUNER_CHANNEL_FREQUENCY), 0); + GST_TUNER_CHANNEL_FREQUENCY), 0); if (klass->get_frequency) { return klass->get_frequency (tuner, channel); @@ -315,7 +315,7 @@ gst_tuner_signal_strength (GstTuner * tuner, GstTunerChannel * channel) GstTunerClass *klass = GST_TUNER_GET_CLASS (tuner); g_return_val_if_fail (GST_TUNER_CHANNEL_HAS_FLAG (channel, - GST_TUNER_CHANNEL_FREQUENCY), 0); + GST_TUNER_CHANNEL_FREQUENCY), 0); if (klass->signal_strength) { return klass->signal_strength (tuner, channel); diff --git a/gst-libs/gst/interfaces/tunerchannel.c b/gst-libs/gst/interfaces/tunerchannel.c index af93f56842..de0be2e433 100644 --- a/gst-libs/gst/interfaces/tunerchannel.c +++ b/gst-libs/gst/interfaces/tunerchannel.c @@ -60,8 +60,8 @@ gst_tuner_channel_get_type (void) }; gst_tuner_channel_type = - g_type_register_static (G_TYPE_OBJECT, - "GstTunerChannel", &tuner_channel_info, 0); + g_type_register_static (G_TYPE_OBJECT, + "GstTunerChannel", &tuner_channel_info, 0); } return gst_tuner_channel_type; @@ -78,13 +78,13 @@ gst_tuner_channel_class_init (GstTunerChannelClass * klass) g_signal_new ("frequency-changed", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (GstTunerChannelClass, - frequency_changed), + frequency_changed), NULL, NULL, g_cclosure_marshal_VOID__ULONG, G_TYPE_NONE, 1, G_TYPE_ULONG); signals[SIGNAL_SIGNAL_CHANGED] = g_signal_new ("signal-changed", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (GstTunerChannelClass, - signal_changed), + signal_changed), NULL, NULL, g_cclosure_marshal_VOID__INT, G_TYPE_NONE, 1, G_TYPE_INT); object_klass->dispose = gst_tuner_channel_dispose; diff --git a/gst-libs/gst/interfaces/tunernorm.c b/gst-libs/gst/interfaces/tunernorm.c index 41927d2b1e..8fb98db7d4 100644 --- a/gst-libs/gst/interfaces/tunernorm.c +++ b/gst-libs/gst/interfaces/tunernorm.c @@ -59,8 +59,8 @@ gst_tuner_norm_get_type (void) }; gst_tuner_norm_type = - g_type_register_static (G_TYPE_OBJECT, - "GstTunerNorm", &tuner_norm_info, 0); + g_type_register_static (G_TYPE_OBJECT, + "GstTunerNorm", &tuner_norm_info, 0); } return gst_tuner_norm_type; diff --git a/gst-libs/gst/interfaces/xoverlay.c b/gst-libs/gst/interfaces/xoverlay.c index c1014eb179..f4d1e1cf1d 100644 --- a/gst-libs/gst/interfaces/xoverlay.c +++ b/gst-libs/gst/interfaces/xoverlay.c @@ -55,9 +55,9 @@ gst_x_overlay_get_type (void) }; gst_x_overlay_type = g_type_register_static (G_TYPE_INTERFACE, - "GstXOverlay", &gst_x_overlay_info, 0); + "GstXOverlay", &gst_x_overlay_info, 0); g_type_interface_add_prerequisite (gst_x_overlay_type, - GST_TYPE_IMPLEMENTS_INTERFACE); + GST_TYPE_IMPLEMENTS_INTERFACE); } return gst_x_overlay_type; @@ -76,16 +76,16 @@ gst_x_overlay_base_init (gpointer g_class) if (!initialized) { gst_x_overlay_signals[HAVE_XWINDOW_ID] = - g_signal_new ("have-xwindow-id", - GST_TYPE_X_OVERLAY, G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (GstXOverlayClass, have_xwindow_id), - NULL, NULL, g_cclosure_marshal_VOID__INT, G_TYPE_NONE, 1, G_TYPE_INT); + g_signal_new ("have-xwindow-id", + GST_TYPE_X_OVERLAY, G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (GstXOverlayClass, have_xwindow_id), + NULL, NULL, g_cclosure_marshal_VOID__INT, G_TYPE_NONE, 1, G_TYPE_INT); gst_x_overlay_signals[DESIRED_SIZE] = - g_signal_new ("desired-size-changed", - GST_TYPE_X_OVERLAY, G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (GstXOverlayClass, desired_size), - NULL, NULL, - gst_marshal_VOID__INT_INT, G_TYPE_NONE, 2, G_TYPE_INT, G_TYPE_INT); + g_signal_new ("desired-size-changed", + GST_TYPE_X_OVERLAY, G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (GstXOverlayClass, desired_size), + NULL, NULL, + gst_marshal_VOID__INT_INT, G_TYPE_NONE, 2, G_TYPE_INT, G_TYPE_INT); initialized = TRUE; } @@ -155,7 +155,7 @@ gst_x_overlay_get_desired_size (GstXOverlay * overlay, guint * width, /* this ensures that elements don't need to check width and height for NULL but apps may use NULL */ klass->get_desired_size (overlay, width ? width : &width_tmp, - height ? height : &height_tmp); + height ? height : &height_tmp); } else { if (width) *width = 0; diff --git a/gst-libs/gst/media-info/media-info-priv.c b/gst-libs/gst/media-info/media-info-priv.c index fb0122093c..22ac6c45f7 100644 --- a/gst-libs/gst/media-info/media-info-priv.c +++ b/gst-libs/gst/media-info/media-info-priv.c @@ -104,11 +104,11 @@ have_type_callback (GstElement * typefind, guint probability, GstCaps * type, /* FIXME: signal error */ g_warning ("Couldn't create id3tag"); if (!gst_element_link_many (priv->source, priv->decontainer, priv->typefind, - NULL)); + NULL)); g_warning ("Couldn't link in id3tag"); if (gst_element_set_state (priv->pipeline, GST_STATE_PLAYING) - == GST_STATE_FAILURE) + == GST_STATE_FAILURE) g_warning ("Couldn't set to playing"); } #endif @@ -139,8 +139,8 @@ deep_notify_callback (GObject * object, GstObject * origin, GST_DEBUG ("caps: %" GST_PTR_FORMAT, priv->format); } else GST_DEBUG ("ignoring caps on object %s:%s", - gst_object_get_name (gst_object_get_parent (origin)), - gst_object_get_name (origin)); + gst_object_get_name (gst_object_get_parent (origin)), + gst_object_get_name (origin)); } else if (strcmp (pspec->name, "offset") == 0) { /* we REALLY ignore offsets, we hate them */ } @@ -151,7 +151,8 @@ typedef struct { guint meta; guint encoded; -} TagFlagScore; +} +TagFlagScore; static void tag_flag_score (const GstTagList * list, const gchar * tag, gpointer user_data) @@ -323,7 +324,7 @@ gmi_seek_to_track (GstMediaInfo * info, long track) res = gst_pad_send_event (info->priv->decoder_pad, event); if (!res) { g_warning ("seek to logical track on pad %s:%s failed", - GST_DEBUG_PAD_NAME (info->priv->decoder_pad)); + GST_DEBUG_PAD_NAME (info->priv->decoder_pad)); return FALSE; } /* clear structs because of the seek */ @@ -350,37 +351,37 @@ gmi_set_mime (GstMediaInfo * info, const char *mime) if ((strcmp (mime, "application/x-ogg") == 0) || (strcmp (mime, "application/ogg") == 0)) desc = - g_strdup_printf - ("%s name=source ! oggdemux ! vorbisdec name=decoder ! fakesink name=sink", - priv->source_name); + g_strdup_printf + ("%s name=source ! oggdemux ! vorbisdec name=decoder ! fakesink name=sink", + priv->source_name); else if ((strcmp (mime, "audio/mpeg") == 0) || (strcmp (mime, "audio/x-mp3") == 0) || (strcmp (mime, "audio/mp3") == 0) || (strcmp (mime, "application/x-id3") == 0) || (strcmp (mime, "audio/x-id3") == 0)) desc = - g_strdup_printf - ("%s name=source ! id3tag ! mad name=decoder ! audio/x-raw-int ! fakesink name=sink", - priv->source_name); + g_strdup_printf + ("%s name=source ! id3tag ! mad name=decoder ! audio/x-raw-int ! fakesink name=sink", + priv->source_name); else if ((strcmp (mime, "application/x-flac") == 0) || (strcmp (mime, "audio/x-flac") == 0)) desc = - g_strdup_printf - ("%s name=source ! flacdec name=decoder ! audio/x-raw-int ! fakesink name=sink", - priv->source_name); + g_strdup_printf + ("%s name=source ! flacdec name=decoder ! audio/x-raw-int ! fakesink name=sink", + priv->source_name); else if ((strcmp (mime, "audio/wav") == 0) || (strcmp (mime, "audio/x-wav") == 0)) desc = - g_strdup_printf - ("%s ! wavparse name=decoder ! audio/x-raw-int ! fakesink name=sink", - priv->source_name); + g_strdup_printf + ("%s ! wavparse name=decoder ! audio/x-raw-int ! fakesink name=sink", + priv->source_name); else if (strcmp (mime, "audio/x-mod") == 0 || strcmp (mime, "audio/x-s3m") == 0 || strcmp (mime, "audio/x-xm") == 0 || strcmp (mime, "audio/x-it") == 0) desc = - g_strdup_printf - ("%s name=source ! modplug name=decoder ! audio/x-raw-int ! fakesink name=sink", - priv->source_name); + g_strdup_printf + ("%s name=source ! modplug name=decoder ! audio/x-raw-int ! fakesink name=sink", + priv->source_name); else return FALSE; @@ -409,7 +410,7 @@ gmi_set_mime (GstMediaInfo * info, const char *mime) g_assert (GST_IS_PAD (priv->decoder_pad)); GST_DEBUG ("decoder pad: %s:%s", gst_object_get_name (gst_object_get_parent (GST_OBJECT (priv-> - decoder_pad))), gst_pad_get_name (priv->decoder_pad)); + decoder_pad))), gst_pad_get_name (priv->decoder_pad)); /* attach notify handler */ g_signal_connect (G_OBJECT (info->priv->pipeline), "deep_notify", @@ -557,21 +558,21 @@ gmip_find_stream_post (GstMediaInfoPriv * priv) if (res) { switch (format) { - case GST_FORMAT_TIME: - stream->length_time = value; - GST_DEBUG (" total %s: %lld", definition->nick, value); - break; - case GST_FORMAT_DEFAULT: - case GST_FORMAT_BYTES: - break; - default: - /* separation is necessary because track_format doesn't resolve to - * int */ - if (format == track_format) { - stream->length_tracks = value; - GST_DEBUG (" total %s: %lld", definition->nick, value); - } else - GST_DEBUG ("unhandled format %s", definition->nick); + case GST_FORMAT_TIME: + stream->length_time = value; + GST_DEBUG (" total %s: %lld", definition->nick, value); + break; + case GST_FORMAT_DEFAULT: + case GST_FORMAT_BYTES: + break; + default: + /* separation is necessary because track_format doesn't resolve to + * int */ + if (format == track_format) { + stream->length_tracks = value; + GST_DEBUG (" total %s: %lld", definition->nick, value); + } else + GST_DEBUG ("unhandled format %s", definition->nick); } } else GST_DEBUG ("query didn't return result for %s", definition->nick); @@ -597,7 +598,7 @@ gmip_find_stream_post (GstMediaInfoPriv * priv) stream->bitrate = (long) (bits / seconds); } GST_DEBUG ("moving to STATE_METADATA\n"); - priv->state = GST_MEDIA_INFO_STATE_METADATA; /* metadata of first track */ + priv->state = GST_MEDIA_INFO_STATE_METADATA; /* metadata of first track */ return TRUE; } @@ -694,23 +695,23 @@ gmip_find_track_streaminfo_post (GstMediaInfoPriv * priv) gboolean res; res = gst_pad_query (priv->decoder_pad, GST_QUERY_POSITION, - &track_format, &value_start); + &track_format, &value_start); if (res) { format = GST_FORMAT_TIME; track_num = value_start; GST_DEBUG ("we are currently at %ld", track_num); res = gst_pad_convert (priv->decoder_pad, - track_format, track_num, &format, &value_start); + track_format, track_num, &format, &value_start); res &= gst_pad_convert (priv->decoder_pad, - track_format, track_num + 1, &format, &value_end); + track_format, track_num + 1, &format, &value_end); if (res) { - /* substract to get the length */ - GST_DEBUG ("start %lld, end %lld", value_start, value_end); - value_end -= value_start; - /* FIXME: check units; this is in seconds */ + /* substract to get the length */ + GST_DEBUG ("start %lld, end %lld", value_start, value_end); + value_end -= value_start; + /* FIXME: check units; this is in seconds */ - gst_tag_list_add (priv->streaminfo, GST_TAG_MERGE_REPLACE, - GST_TAG_DURATION, (int) (value_end / 1E6), NULL); + gst_tag_list_add (priv->streaminfo, GST_TAG_MERGE_REPLACE, + GST_TAG_DURATION, (int) (value_end / 1E6), NULL); } } } diff --git a/gst-libs/gst/media-info/media-info-test.c b/gst-libs/gst/media-info/media-info-test.c index 67a16cdc23..e0778d9f44 100644 --- a/gst-libs/gst/media-info/media-info-test.c +++ b/gst-libs/gst/media-info/media-info-test.c @@ -18,7 +18,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/gst-libs/gst/media-info/media-info.c b/gst-libs/gst/media-info/media-info.c index 4f99535945..16a6625029 100644 --- a/gst-libs/gst/media-info/media-info.c +++ b/gst-libs/gst/media-info/media-info.c @@ -113,8 +113,9 @@ gst_media_info_get_type (void) (GInstanceInitFunc) gst_media_info_instance_init, NULL }; + gst_media_info_type = g_type_register_static (G_TYPE_OBJECT, - "GstMediaInfo", &gst_media_info_info, 0); + "GstMediaInfo", &gst_media_info_info, 0); } return gst_media_info_type; } @@ -192,7 +193,7 @@ gst_media_info_new (GError ** error) info->priv->error = NULL; } else { g_warning ("Error creating GstMediaInfo object.\n%s", - info->priv->error->message); + info->priv->error->message); g_error_free (info->priv->error); } } @@ -222,7 +223,7 @@ gst_media_info_read_with_idler (GstMediaInfo * info, const char *location, { GstMediaInfoPriv *priv = info->priv; - gmip_reset (info->priv); /* reset all structs */ + gmip_reset (info->priv); /* reset all structs */ priv->location = g_strdup (location); priv->flags = flags; } @@ -251,9 +252,9 @@ gst_media_info_read_idler (GstMediaInfo * info, GstMediaInfoStream ** streamp, case GST_MEDIA_INFO_STATE_NULL: /* make sure we have a source */ if (!priv->source_name) { - *error = g_error_new (GST_MEDIA_INFO_ERROR, 0, - "No source set on media info."); - return FALSE; + *error = g_error_new (GST_MEDIA_INFO_ERROR, 0, + "No source set on media info."); + return FALSE; } /* need to find type */ @@ -266,26 +267,26 @@ gst_media_info_read_idler (GstMediaInfo * info, GstMediaInfoStream ** streamp, GST_LOG ("STATE_TYPEFIND"); if ((priv->type == NULL) && gst_bin_iterate (GST_BIN (priv->pipeline))) { - GST_DEBUG ("iterating while in STATE_TYPEFIND"); - GMI_DEBUG ("?"); - return TRUE; + GST_DEBUG ("iterating while in STATE_TYPEFIND"); + GMI_DEBUG ("?"); + return TRUE; } if (priv->type == NULL) { - g_warning ("Couldn't find type\n"); - return FALSE; + g_warning ("Couldn't find type\n"); + return FALSE; } /* do the state transition */ GST_DEBUG ("doing find_type_post"); gmip_find_type_post (priv); GST_DEBUG ("finding out mime type"); mime = - g_strdup (gst_structure_get_name (gst_caps_get_structure (priv->type, - 0))); + g_strdup (gst_structure_get_name (gst_caps_get_structure (priv->type, + 0))); GST_DEBUG ("found out mime type: %s", mime); if (!gmi_set_mime (info, mime)) { - /* FIXME: pop up error */ - GST_DEBUG ("no decoder pipeline found for mime %s", mime); - return FALSE; + /* FIXME: pop up error */ + GST_DEBUG ("no decoder pipeline found for mime %s", mime); + return FALSE; } priv->stream = gmi_stream_new (); GST_DEBUG ("new stream: %p", priv->stream); @@ -298,12 +299,12 @@ gst_media_info_read_idler (GstMediaInfo * info, GstMediaInfoStream ** streamp, { GST_LOG ("STATE_STREAM"); if ((priv->format == NULL) && gst_bin_iterate (GST_BIN (priv->pipeline))) { - GMI_DEBUG ("?"); - return TRUE; + GMI_DEBUG ("?"); + return TRUE; } if (priv->format == NULL) { - g_warning ("Couldn't find format\n"); - return FALSE; + g_warning ("Couldn't find format\n"); + return FALSE; } /* do state transition; stream -> first track metadata */ priv->current_track_num = 0; @@ -316,21 +317,21 @@ gst_media_info_read_idler (GstMediaInfo * info, GstMediaInfoStream ** streamp, case GST_MEDIA_INFO_STATE_METADATA: { if ((priv->metadata == NULL) && - gst_bin_iterate (GST_BIN (priv->pipeline)) && - priv->metadata_iters < MAX_METADATA_ITERS) { - GMI_DEBUG ("?"); - priv->metadata_iters++; - return TRUE; + gst_bin_iterate (GST_BIN (priv->pipeline)) && + priv->metadata_iters < MAX_METADATA_ITERS) { + GMI_DEBUG ("?"); + priv->metadata_iters++; + return TRUE; } if (priv->metadata_iters == MAX_METADATA_ITERS) - g_print ("iterated a few times, didn't find metadata\n"); + g_print ("iterated a few times, didn't find metadata\n"); if (priv->metadata == NULL) { - /* this is not a permanent failure */ - GST_DEBUG ("Couldn't find metadata"); + /* this is not a permanent failure */ + GST_DEBUG ("Couldn't find metadata"); } GST_DEBUG ("found metadata of track %ld", priv->current_track_num); if (!gmip_find_track_metadata_post (priv)) - return FALSE; + return FALSE; GST_DEBUG ("METADATA: going to STREAMINFO\n"); priv->state = GST_MEDIA_INFO_STATE_STREAMINFO; return gmip_find_track_streaminfo_pre (priv); @@ -338,50 +339,50 @@ gst_media_info_read_idler (GstMediaInfo * info, GstMediaInfoStream ** streamp, case GST_MEDIA_INFO_STATE_STREAMINFO: { if ((priv->streaminfo == NULL) && - gst_bin_iterate (GST_BIN (priv->pipeline))) { - GMI_DEBUG ("?"); - return TRUE; + gst_bin_iterate (GST_BIN (priv->pipeline))) { + GMI_DEBUG ("?"); + return TRUE; } if (priv->streaminfo == NULL) { - /* this is not a permanent failure */ - GST_DEBUG ("Couldn't find streaminfo"); + /* this is not a permanent failure */ + GST_DEBUG ("Couldn't find streaminfo"); } else - GST_DEBUG ("found streaminfo of track %ld", priv->current_track_num); + GST_DEBUG ("found streaminfo of track %ld", priv->current_track_num); if (!gmip_find_track_streaminfo_post (priv)) - return FALSE; + return FALSE; priv->state = GST_MEDIA_INFO_STATE_FORMAT; return gmip_find_track_format_pre (priv); } case GST_MEDIA_INFO_STATE_FORMAT: { if ((priv->format == NULL) && gst_bin_iterate (GST_BIN (priv->pipeline))) { - GMI_DEBUG ("?"); - return TRUE; + GMI_DEBUG ("?"); + return TRUE; } if (priv->format == NULL) { - g_warning ("Couldn't find format\n"); - return FALSE; + g_warning ("Couldn't find format\n"); + return FALSE; } GST_DEBUG ("found format of track %ld", priv->current_track_num); if (!gmip_find_track_format_post (priv)) - return FALSE; + return FALSE; /* save the track info */ priv->stream->tracks = g_list_append (priv->stream->tracks, - priv->current_track); + priv->current_track); /* these alloc'd data types have been handed off */ priv->current_track = NULL; priv->location = NULL; /* now see if we need to seek to a next track or not */ priv->current_track_num++; if (priv->current_track_num < priv->stream->length_tracks) { - gmi_seek_to_track (info, priv->current_track_num); - priv->current_track = gmi_track_new (); - if (!gmip_find_track_metadata_pre (priv)) { - g_free (priv->current_track); - return FALSE; - } - priv->state = GST_MEDIA_INFO_STATE_METADATA; - return TRUE; + gmi_seek_to_track (info, priv->current_track_num); + priv->current_track = gmi_track_new (); + if (!gmip_find_track_metadata_pre (priv)) { + g_free (priv->current_track); + return FALSE; + } + priv->state = GST_MEDIA_INFO_STATE_METADATA; + return TRUE; } priv->state = GST_MEDIA_INFO_STATE_DONE; gmi_clear_decoder (info); diff --git a/gst-libs/gst/mixer/mixer.c b/gst-libs/gst/mixer/mixer.c index a9034f608c..1db3d6a3ca 100644 --- a/gst-libs/gst/mixer/mixer.c +++ b/gst-libs/gst/mixer/mixer.c @@ -57,9 +57,9 @@ gst_mixer_get_type (void) }; gst_mixer_type = g_type_register_static (G_TYPE_INTERFACE, - "GstMixer", &gst_mixer_info, 0); + "GstMixer", &gst_mixer_info, 0); g_type_interface_add_prerequisite (gst_mixer_type, - GST_TYPE_IMPLEMENTS_INTERFACE); + GST_TYPE_IMPLEMENTS_INTERFACE); } return gst_mixer_type; @@ -72,26 +72,26 @@ gst_mixer_class_init (GstMixerClass * klass) if (!initialized) { gst_mixer_signals[RECORD_TOGGLED] = - g_signal_new ("record-toggled", - GST_TYPE_MIXER, G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (GstMixerClass, record_toggled), - NULL, NULL, - gst_mixer_marshal_VOID__OBJECT_BOOLEAN, G_TYPE_NONE, 2, - GST_TYPE_MIXER_TRACK, G_TYPE_BOOLEAN); + g_signal_new ("record-toggled", + GST_TYPE_MIXER, G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (GstMixerClass, record_toggled), + NULL, NULL, + gst_mixer_marshal_VOID__OBJECT_BOOLEAN, G_TYPE_NONE, 2, + GST_TYPE_MIXER_TRACK, G_TYPE_BOOLEAN); gst_mixer_signals[MUTE_TOGGLED] = - g_signal_new ("mute-toggled", - GST_TYPE_MIXER, G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (GstMixerClass, mute_toggled), - NULL, NULL, - gst_mixer_marshal_VOID__OBJECT_BOOLEAN, G_TYPE_NONE, 2, - GST_TYPE_MIXER_TRACK, G_TYPE_BOOLEAN); + g_signal_new ("mute-toggled", + GST_TYPE_MIXER, G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (GstMixerClass, mute_toggled), + NULL, NULL, + gst_mixer_marshal_VOID__OBJECT_BOOLEAN, G_TYPE_NONE, 2, + GST_TYPE_MIXER_TRACK, G_TYPE_BOOLEAN); gst_mixer_signals[VOLUME_CHANGED] = - g_signal_new ("volume-changed", - GST_TYPE_MIXER, G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (GstMixerClass, volume_changed), - NULL, NULL, - gst_mixer_marshal_VOID__OBJECT_POINTER, G_TYPE_NONE, 2, - GST_TYPE_MIXER_TRACK, G_TYPE_POINTER); + g_signal_new ("volume-changed", + GST_TYPE_MIXER, G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (GstMixerClass, volume_changed), + NULL, NULL, + gst_mixer_marshal_VOID__OBJECT_POINTER, G_TYPE_NONE, 2, + GST_TYPE_MIXER_TRACK, G_TYPE_POINTER); initialized = TRUE; } diff --git a/gst-libs/gst/mixer/mixertrack.c b/gst-libs/gst/mixer/mixertrack.c index af52aec8cb..ae8976f156 100644 --- a/gst-libs/gst/mixer/mixertrack.c +++ b/gst-libs/gst/mixer/mixertrack.c @@ -61,8 +61,8 @@ gst_mixer_track_get_type (void) }; gst_mixer_track_type = - g_type_register_static (G_TYPE_OBJECT, - "GstMixerTrack", &mixer_track_info, 0); + g_type_register_static (G_TYPE_OBJECT, + "GstMixerTrack", &mixer_track_info, 0); } return gst_mixer_track_type; @@ -79,21 +79,21 @@ gst_mixer_track_class_init (GstMixerTrackClass * klass) g_signal_new ("record_toggled", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (GstMixerTrackClass, - record_toggled), + record_toggled), NULL, NULL, g_cclosure_marshal_VOID__BOOLEAN, G_TYPE_NONE, 1, G_TYPE_BOOLEAN); signals[SIGNAL_MUTE_TOGGLED] = g_signal_new ("mute_toggled", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (GstMixerTrackClass, - mute_toggled), + mute_toggled), NULL, NULL, g_cclosure_marshal_VOID__BOOLEAN, G_TYPE_NONE, 1, G_TYPE_BOOLEAN); signals[SIGNAL_VOLUME_CHANGED] = g_signal_new ("volume_changed", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (GstMixerTrackClass, - volume_changed), + volume_changed), NULL, NULL, g_cclosure_marshal_VOID__POINTER, G_TYPE_NONE, 1, G_TYPE_POINTER); diff --git a/gst-libs/gst/navigation/navigation.c b/gst-libs/gst/navigation/navigation.c index 35ae2ba5fe..32510ffaef 100644 --- a/gst-libs/gst/navigation/navigation.c +++ b/gst-libs/gst/navigation/navigation.c @@ -46,7 +46,7 @@ gst_navigation_get_type (void) }; gst_navigation_type = g_type_register_static (G_TYPE_INTERFACE, - "GstNavigation", &gst_navigation_info, 0); + "GstNavigation", &gst_navigation_info, 0); } return gst_navigation_type; @@ -75,7 +75,7 @@ gst_navigation_send_key_event (GstNavigation * navigation, const char *event, { gst_navigation_send_event (navigation, gst_structure_new ("application/x-gst-navigation", "event", G_TYPE_STRING, - event, "key", G_TYPE_STRING, key, NULL)); + event, "key", G_TYPE_STRING, key, NULL)); } void @@ -84,6 +84,6 @@ gst_navigation_send_mouse_event (GstNavigation * navigation, const char *event, { gst_navigation_send_event (navigation, gst_structure_new ("application/x-gst-navigation", "event", G_TYPE_STRING, - event, "button", G_TYPE_INT, button, "pointer_x", G_TYPE_DOUBLE, x, - "pointer_y", G_TYPE_DOUBLE, y, NULL)); + event, "button", G_TYPE_INT, button, "pointer_x", G_TYPE_DOUBLE, x, + "pointer_y", G_TYPE_DOUBLE, y, NULL)); } diff --git a/gst-libs/gst/play/play.c b/gst-libs/gst/play/play.c index 01ba1f6388..ba24eb865a 100644 --- a/gst-libs/gst/play/play.c +++ b/gst-libs/gst/play/play.c @@ -45,8 +45,8 @@ struct _GstPlayPrivate gint get_length_attempt; - gint tick_unblock_remaining; /* how many msecs left - to unblock due to seeking */ + gint tick_unblock_remaining; /* how many msecs left + to unblock due to seeking */ guint tick_id; guint length_id; @@ -171,7 +171,7 @@ gst_play_pipeline_setup (GstPlay * play, GError ** error) /* Make sure we convert audio to the needed format */ GST_PLAY_MAKE_OR_ERROR (audioconvert, "audioconvert", "audioconvert", - error); + error); g_hash_table_insert (play->priv->elements, "audioconvert", audioconvert); /* Duplicate audio signal to audio sink and visualization thread */ @@ -183,7 +183,7 @@ gst_play_pipeline_setup (GstPlay * play, GError ** error) g_hash_table_insert (play->priv->elements, "tee", tee); gst_bin_add_many (GST_BIN (work_thread), source, autoplugger, audioconvert, - tee, NULL); + tee, NULL); if (!gst_element_link_many (source, autoplugger, audioconvert, tee, NULL)) GST_PLAY_ERROR_RETURN (error, "Could not link source thread elements"); @@ -194,13 +194,13 @@ gst_play_pipeline_setup (GstPlay * play, GError ** error) identity_cs = gst_element_factory_make ("ffcolorspace", "identity_cs"); if (!GST_IS_ELEMENT (identity_cs)) { identity_cs = - gst_element_factory_make ("ffmpegcolorspace", "identity_cs"); + gst_element_factory_make ("ffmpegcolorspace", "identity_cs"); if (!GST_IS_ELEMENT (identity_cs)) { - identity_cs = gst_element_factory_make ("colorspace", "identity_cs"); - if (!GST_IS_ELEMENT (identity_cs)) { - gst_play_error_plugin ("colorspace", error); - return FALSE; - } + identity_cs = gst_element_factory_make ("colorspace", "identity_cs"); + if (!GST_IS_ELEMENT (identity_cs)) { + gst_play_error_plugin ("colorspace", error); + return FALSE; + } } } g_hash_table_insert (play->priv->elements, "identity_cs", identity_cs); @@ -232,11 +232,11 @@ gst_play_pipeline_setup (GstPlay * play, GError ** error) if (!GST_IS_ELEMENT (vis_cs)) { vis_cs = gst_element_factory_make ("ffmpegcolorspace", "vis_cs"); if (!GST_IS_ELEMENT (vis_cs)) { - vis_cs = gst_element_factory_make ("colorspace", "vis_cs"); - if (!GST_IS_ELEMENT (vis_cs)) { - gst_play_error_plugin ("colorspace", error); - return FALSE; - } + vis_cs = gst_element_factory_make ("colorspace", "vis_cs"); + if (!GST_IS_ELEMENT (vis_cs)) { + gst_play_error_plugin ("colorspace", error); + return FALSE; + } } } @@ -245,9 +245,9 @@ gst_play_pipeline_setup (GstPlay * play, GError ** error) gst_bin_add_many (GST_BIN (vis_bin), vis_queue, vis_element, vis_cs, NULL); if (!gst_element_link_many (vis_queue, vis_element, vis_cs, NULL)) GST_PLAY_ERROR_RETURN (error, - "Could not link visualisation thread elements"); + "Could not link visualisation thread elements"); gst_element_add_ghost_pad (vis_bin, gst_element_get_pad (vis_cs, "src"), - "src"); + "src"); } /* Creating our video output bin */ { @@ -267,18 +267,18 @@ gst_play_pipeline_setup (GstPlay * play, GError ** error) if (!GST_IS_ELEMENT (video_cs)) { video_cs = gst_element_factory_make ("ffmpegcolorspace", "video_cs"); if (!GST_IS_ELEMENT (video_cs)) { - video_cs = gst_element_factory_make ("colorspace", "video_cs"); - if (!GST_IS_ELEMENT (video_cs)) { - gst_play_error_plugin ("colorspace", error); - return FALSE; - } + video_cs = gst_element_factory_make ("colorspace", "video_cs"); + if (!GST_IS_ELEMENT (video_cs)) { + gst_play_error_plugin ("colorspace", error); + return FALSE; + } } } g_hash_table_insert (play->priv->elements, "video_cs", video_cs); /* Software colorbalance */ GST_PLAY_MAKE_OR_ERROR (video_balance, "videobalance", "video_balance", - error); + error); g_hash_table_insert (play->priv->elements, "video_balance", video_balance); /* Colorspace conversion */ @@ -286,11 +286,11 @@ gst_play_pipeline_setup (GstPlay * play, GError ** error) if (!GST_IS_ELEMENT (balance_cs)) { balance_cs = gst_element_factory_make ("ffmpegcolorspace", "balance_cs"); if (!GST_IS_ELEMENT (balance_cs)) { - balance_cs = gst_element_factory_make ("colorspace", "balance_cs"); - if (!GST_IS_ELEMENT (balance_cs)) { - gst_play_error_plugin ("colorspace", error); - return FALSE; - } + balance_cs = gst_element_factory_make ("colorspace", "balance_cs"); + if (!GST_IS_ELEMENT (balance_cs)) { + gst_play_error_plugin ("colorspace", error); + return FALSE; + } } } g_hash_table_insert (play->priv->elements, "balance_cs", balance_cs); @@ -299,38 +299,38 @@ gst_play_pipeline_setup (GstPlay * play, GError ** error) GST_PLAY_MAKE_OR_ERROR (video_scaler, "videoscale", "video_scaler", error); g_hash_table_insert (play->priv->elements, "video_scaler", video_scaler); g_signal_connect (gst_element_get_pad (video_scaler, "src"), "fixate", - G_CALLBACK (gst_play_video_fixate), play); + G_CALLBACK (gst_play_video_fixate), play); /* Placeholder for future video sink bin */ GST_PLAY_MAKE_OR_ERROR (video_sink, "fakesink", "video_sink", error); g_hash_table_insert (play->priv->elements, "video_sink", video_sink); gst_bin_add_many (GST_BIN (video_thread), video_queue, video_switch, - video_cs, video_balance, balance_cs, video_scaler, video_sink, NULL); + video_cs, video_balance, balance_cs, video_scaler, video_sink, NULL); /* break down linking so we can figure out what might be failing */ if (!gst_element_link (video_queue, video_switch)) GST_PLAY_ERROR_RETURN (error, - "Could not link video output thread (queue and switch)"); + "Could not link video output thread (queue and switch)"); if (!gst_element_link (video_switch, video_cs)) GST_PLAY_ERROR_RETURN (error, - "Could not link video output thread (switch and cs)"); + "Could not link video output thread (switch and cs)"); if (!gst_element_link (video_cs, video_balance)) GST_PLAY_ERROR_RETURN (error, - "Could not link video output thread (cs and balance)"); + "Could not link video output thread (cs and balance)"); if (!gst_element_link (video_balance, balance_cs)) GST_PLAY_ERROR_RETURN (error, - "Could not link video output thread (balance and balance_cs)"); + "Could not link video output thread (balance and balance_cs)"); if (!gst_element_link (balance_cs, video_scaler)) GST_PLAY_ERROR_RETURN (error, - "Could not link video output thread (balance_cs and scaler)"); + "Could not link video output thread (balance_cs and scaler)"); if (!gst_element_link (video_scaler, video_sink)) GST_PLAY_ERROR_RETURN (error, - "Could not link video output thread (balance_cs and scaler)"); + "Could not link video output thread (balance_cs and scaler)"); gst_element_add_ghost_pad (video_thread, gst_element_get_pad (video_queue, - "sink"), "sink"); + "sink"), "sink"); if (!gst_element_link (identity_cs, video_thread)) GST_PLAY_ERROR_RETURN (error, - "Could not link video output thread elements"); + "Could not link video output thread elements"); } /* Creating our audio output bin { queue ! fakesink } */ @@ -347,19 +347,19 @@ gst_play_pipeline_setup (GstPlay * play, GError ** error) GST_PLAY_MAKE_OR_ERROR (volume, "volume", "volume", error); g_hash_table_insert (play->priv->elements, "volume", volume); g_signal_connect (gst_element_get_pad (volume, "src"), "fixate", - G_CALLBACK (gst_play_audio_fixate), play); + G_CALLBACK (gst_play_audio_fixate), play); /* Placeholder for future audio sink bin */ GST_PLAY_MAKE_OR_ERROR (audio_sink, "fakesink", "audio_sink", error); g_hash_table_insert (play->priv->elements, "audio_sink", audio_sink); gst_bin_add_many (GST_BIN (audio_thread), audio_queue, volume, audio_sink, - NULL); + NULL); if (!gst_element_link_many (audio_queue, volume, audio_sink, NULL)) GST_PLAY_ERROR_RETURN (error, - "Could not link audio output thread elements"); + "Could not link audio output thread elements"); gst_element_add_ghost_pad (audio_thread, gst_element_get_pad (audio_queue, - "sink"), "sink"); + "sink"), "sink"); gst_pad_link (tee_pad2, gst_element_get_pad (audio_queue, "sink")); } @@ -408,7 +408,7 @@ gst_play_tick_callback (GstPlay * play) if (q) g_signal_emit (G_OBJECT (play), gst_play_signals[TIME_TICK], - 0, play->priv->time_nanos); + 0, play->priv->time_nanos); if (GST_STATE (GST_ELEMENT (play)) == GST_STATE_PLAYING) return TRUE; @@ -443,15 +443,15 @@ gst_play_get_length_callback (GstPlay * play) /* Audio first and then Video */ if (GST_IS_ELEMENT (audio_sink_element)) q = gst_element_query (audio_sink_element, GST_QUERY_TOTAL, &format, - &value); + &value); if ((!q) && (GST_IS_ELEMENT (video_sink_element))) q = gst_element_query (video_sink_element, GST_QUERY_TOTAL, &format, - &value); + &value); if (q) { play->priv->length_nanos = value; g_signal_emit (G_OBJECT (play), gst_play_signals[STREAM_LENGTH], - 0, play->priv->length_nanos); + 0, play->priv->length_nanos); play->priv->length_id = 0; return FALSE; } @@ -487,7 +487,7 @@ gst_play_video_fixate (GstPad * pad, const GstCaps * caps, gpointer user_data) return newcaps; } if (gst_caps_structure_fixate_field_nearest_double (structure, "framerate", - 30.0)) { + 30.0)) { return newcaps; } @@ -545,7 +545,7 @@ gst_play_state_change (GstElement * element, GstElementState old, } play->priv->tick_id = g_timeout_add (TICK_INTERVAL_MSEC, - (GSourceFunc) gst_play_tick_callback, play); + (GSourceFunc) gst_play_tick_callback, play); play->priv->get_length_attempt = 0; @@ -555,7 +555,7 @@ gst_play_state_change (GstElement * element, GstElementState old, } play->priv->length_id = g_timeout_add (TICK_INTERVAL_MSEC, - (GSourceFunc) gst_play_get_length_callback, play); + (GSourceFunc) gst_play_get_length_callback, play); } else { if (play->priv->tick_id) { g_source_remove (play->priv->tick_id); @@ -632,7 +632,7 @@ gst_play_init (GstPlay * play) if (!gst_play_pipeline_setup (play, &play->priv->error)) { g_warning ("libgstplay: failed initializing pipeline, error: %s", - play->priv->error->message); + play->priv->error->message); } } @@ -793,10 +793,10 @@ gst_play_seek_to_time (GstPlay * play, gint64 time_nanos) play->priv->tick_unblock_remaining = 500; s = gst_element_seek (video_seek_element, GST_FORMAT_TIME | - GST_SEEK_METHOD_SET | GST_SEEK_FLAG_FLUSH, time_nanos); + GST_SEEK_METHOD_SET | GST_SEEK_FLAG_FLUSH, time_nanos); if (!s) { s = gst_element_seek (audio_seek_element, GST_FORMAT_TIME | - GST_SEEK_METHOD_SET | GST_SEEK_FLAG_FLUSH, time_nanos); + GST_SEEK_METHOD_SET | GST_SEEK_FLAG_FLUSH, time_nanos); } if (s) { @@ -804,11 +804,11 @@ gst_play_seek_to_time (GstPlay * play, gint64 time_nanos) gboolean q = FALSE; q = gst_element_query (audio_sink_element, GST_QUERY_POSITION, &format, - &(play->priv->time_nanos)); + &(play->priv->time_nanos)); if (q) - g_signal_emit (G_OBJECT (play), gst_play_signals[TIME_TICK], - 0, play->priv->time_nanos); + g_signal_emit (G_OBJECT (play), gst_play_signals[TIME_TICK], + 0, play->priv->time_nanos); } } @@ -907,10 +907,10 @@ gst_play_set_video_sink (GstPlay * play, GstElement * video_sink) GST_PLAY_SINK_TYPE_VIDEO); if (GST_IS_ELEMENT (video_sink_element)) { g_hash_table_replace (play->priv->elements, "video_sink_element", - video_sink_element); + video_sink_element); if (GST_IS_X_OVERLAY (video_sink_element)) { g_signal_connect (G_OBJECT (video_sink_element), - "desired_size_changed", G_CALLBACK (gst_play_have_video_size), play); + "desired_size_changed", G_CALLBACK (gst_play_have_video_size), play); } } @@ -966,7 +966,7 @@ gst_play_set_audio_sink (GstPlay * play, GstElement * audio_sink) GST_PLAY_SINK_TYPE_AUDIO); if (GST_IS_ELEMENT (audio_sink_element)) { g_hash_table_replace (play->priv->elements, "audio_sink_element", - audio_sink_element); + audio_sink_element); } gst_element_set_state (audio_sink, GST_STATE (GST_ELEMENT (play))); @@ -1114,7 +1114,7 @@ gst_play_connect_visualization (GstPlay * play, gboolean connect) /* Adding, linking */ play->priv->handoff_hid = g_signal_connect (G_OBJECT (identity), - "handoff", G_CALLBACK (gst_play_identity_handoff), play); + "handoff", G_CALLBACK (gst_play_identity_handoff), play); gst_bin_add (GST_BIN (video_thread), vis_bin); gst_pad_link (tee_pad1, vis_queue_pad); gst_element_link (vis_bin, video_switch); @@ -1168,64 +1168,64 @@ gst_play_get_sink_element (GstPlay * play, if (GST_IS_BIN (element)) { element = gst_play_get_sink_element (play, element, sink_type); if (GST_IS_ELEMENT (element)) - return element; + return element; } else { pads = gst_element_get_pad_list (element); has_src = FALSE; has_correct_type = FALSE; while (pads) { - /* check for src pad */ - if (GST_PAD_DIRECTION (GST_PAD (pads->data)) == GST_PAD_SRC) { - has_src = TRUE; - break; - } else { - /* If not a src pad checking caps */ - GstCaps *caps; - GstStructure *structure; - gboolean has_video_cap = FALSE; - gboolean has_audio_cap = FALSE; - - caps = gst_pad_get_caps (GST_PAD (pads->data)); - structure = gst_caps_get_structure (caps, 0); - - if (strcmp (gst_structure_get_name (structure), - "audio/x-raw-int") == 0) { - has_audio_cap = TRUE; - } - - if (strcmp (gst_structure_get_name (structure), - "video/x-raw-yuv") == 0 || - strcmp (gst_structure_get_name (structure), - "video/x-raw-rgb") == 0) { - has_video_cap = TRUE; - } - - gst_caps_free (caps); - - switch (sink_type) { - case GST_PLAY_SINK_TYPE_AUDIO: - if (has_audio_cap) - has_correct_type = TRUE; - break; - case GST_PLAY_SINK_TYPE_VIDEO: - if (has_video_cap) - has_correct_type = TRUE; - break; - case GST_PLAY_SINK_TYPE_ANY: - if ((has_video_cap) || (has_audio_cap)) - has_correct_type = TRUE; - break; - default: - has_correct_type = FALSE; - } - } - - pads = g_list_next (pads); + /* check for src pad */ + if (GST_PAD_DIRECTION (GST_PAD (pads->data)) == GST_PAD_SRC) { + has_src = TRUE; + break; + } else { + /* If not a src pad checking caps */ + GstCaps *caps; + GstStructure *structure; + gboolean has_video_cap = FALSE; + gboolean has_audio_cap = FALSE; + + caps = gst_pad_get_caps (GST_PAD (pads->data)); + structure = gst_caps_get_structure (caps, 0); + + if (strcmp (gst_structure_get_name (structure), + "audio/x-raw-int") == 0) { + has_audio_cap = TRUE; + } + + if (strcmp (gst_structure_get_name (structure), + "video/x-raw-yuv") == 0 || + strcmp (gst_structure_get_name (structure), + "video/x-raw-rgb") == 0) { + has_video_cap = TRUE; + } + + gst_caps_free (caps); + + switch (sink_type) { + case GST_PLAY_SINK_TYPE_AUDIO: + if (has_audio_cap) + has_correct_type = TRUE; + break; + case GST_PLAY_SINK_TYPE_VIDEO: + if (has_video_cap) + has_correct_type = TRUE; + break; + case GST_PLAY_SINK_TYPE_ANY: + if ((has_video_cap) || (has_audio_cap)) + has_correct_type = TRUE; + break; + default: + has_correct_type = FALSE; + } + } + + pads = g_list_next (pads); } if ((!has_src) && (has_correct_type)) - return element; + return element; } elements = g_list_next (elements); @@ -1247,7 +1247,7 @@ gst_play_new (GError ** error) play->priv->error = NULL; } else { g_warning ("Error creating GstPlay object.\n%s", - play->priv->error->message); + play->priv->error->message); g_error_free (play->priv->error); } } @@ -1280,7 +1280,7 @@ gst_play_get_type (void) }; play_type = g_type_register_static (GST_TYPE_PIPELINE, "GstPlay", - &play_info, 0); + &play_info, 0); } return play_type; diff --git a/gst-libs/gst/propertyprobe/propertyprobe.c b/gst-libs/gst/propertyprobe/propertyprobe.c index 05dd3f8fdc..730151e977 100644 --- a/gst-libs/gst/propertyprobe/propertyprobe.c +++ b/gst-libs/gst/propertyprobe/propertyprobe.c @@ -56,8 +56,8 @@ gst_property_probe_get_type (void) }; gst_property_probe_type = - g_type_register_static (G_TYPE_INTERFACE, - "GstPropertyProbe", &gst_property_probe_info, 0); + g_type_register_static (G_TYPE_INTERFACE, + "GstPropertyProbe", &gst_property_probe_info, 0); } return gst_property_probe_type; @@ -70,10 +70,10 @@ gst_property_probe_iface_init (GstPropertyProbeInterface * iface) if (!initialized) { gst_property_probe_signals[SIGNAL_PROBE_NEEDED] = - g_signal_new ("probe-needed", G_TYPE_FROM_CLASS (iface), - G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (GstPropertyProbeInterface, - probe_needed), NULL, NULL, g_cclosure_marshal_VOID__POINTER, - G_TYPE_NONE, 1, G_TYPE_POINTER); + g_signal_new ("probe-needed", G_TYPE_FROM_CLASS (iface), + G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (GstPropertyProbeInterface, + probe_needed), NULL, NULL, g_cclosure_marshal_VOID__POINTER, + G_TYPE_NONE, 1, G_TYPE_POINTER); initialized = TRUE; } diff --git a/gst-libs/gst/resample/dtos.c b/gst-libs/gst/resample/dtos.c index 98e8f6a6d1..f1e2278e2e 100644 --- a/gst-libs/gst/resample/dtos.c +++ b/gst-libs/gst/resample/dtos.c @@ -108,7 +108,8 @@ static union { int i[4]; float f[4]; -} av_tmp __attribute__ ((__aligned__ (16))); +} +av_tmp __attribute__ ((__aligned__ (16))); void conv_double_short_altivec (double *dest, short *src, int n) @@ -122,7 +123,7 @@ conv_double_short_altivec (double *dest, short *src, int n) av_tmp.i[3] = src[3]; asm (" lvx 0,0,%0\n" " vcfsx 1,0,0\n" " stvx 1,0,%0\n": :"r" (&av_tmp) - ); + ); dest[0] = av_tmp.f[0]; dest[1] = av_tmp.f[1]; diff --git a/gst-libs/gst/resample/resample.c b/gst-libs/gst/resample/resample.c index cd409d239b..cc413e2409 100644 --- a/gst-libs/gst/resample/resample.c +++ b/gst-libs/gst/resample/resample.c @@ -100,33 +100,33 @@ gst_resample_reinit (gst_resample_t * r) switch (r->method) { default: case GST_RESAMPLE_NEAREST: - r->scale = gst_resample_nearest_s16; - break; + r->scale = gst_resample_nearest_s16; + break; case GST_RESAMPLE_BILINEAR: - r->scale = gst_resample_bilinear_s16; - break; + r->scale = gst_resample_bilinear_s16; + break; case GST_RESAMPLE_SINC_SLOW: - r->scale = gst_resample_sinc_s16; - break; + r->scale = gst_resample_sinc_s16; + break; case GST_RESAMPLE_SINC: - r->scale = gst_resample_sinc_ft_s16; - break; + r->scale = gst_resample_sinc_ft_s16; + break; } } else if (r->format == GST_RESAMPLE_FLOAT) { switch (r->method) { default: case GST_RESAMPLE_NEAREST: - r->scale = gst_resample_nearest_float; - break; + r->scale = gst_resample_nearest_float; + break; case GST_RESAMPLE_BILINEAR: - r->scale = gst_resample_bilinear_float; - break; + r->scale = gst_resample_bilinear_float; + break; case GST_RESAMPLE_SINC_SLOW: - r->scale = gst_resample_sinc_float; - break; + r->scale = gst_resample_sinc_float; + break; case GST_RESAMPLE_SINC: - r->scale = gst_resample_sinc_ft_float; - break; + r->scale = gst_resample_sinc_ft_float; + break; } } else { fprintf (stderr, "gst_resample: Unexpected format \"%d\"\n", r->format); @@ -170,9 +170,9 @@ gst_resample_scale (gst_resample_t * r, void *i_buf, unsigned int i_size) if (r->verbose) { printf ("gst_resample_scale: i_buf=%p i_size=%d\n", i_buf, i_size); printf ("gst_resample_scale: i_samples=%d o_samples=%d i_inc=%g o_buf=%p\n", - r->i_samples, r->o_samples, r->i_inc, r->o_buf); + r->i_samples, r->o_samples, r->i_inc, r->o_buf); printf ("gst_resample_scale: i_start=%g i_end=%g o_start=%g\n", - r->i_start, r->i_end, r->o_start); + r->i_start, r->i_end, r->o_start); } if ((r->filter_length + r->i_samples) * sizeof (double) * 2 > r->buffer_len) { @@ -191,20 +191,20 @@ gst_resample_scale (gst_resample_t * r, void *i_buf, unsigned int i_size) if (r->format == GST_RESAMPLE_S16) { if (r->channels == 2) { conv_double_short (r->buffer + r->filter_length * sizeof (double) * 2, - r->i_buf, r->i_samples * 2); + r->i_buf, r->i_samples * 2); } else { conv_double_short_dstr (r->buffer + - r->filter_length * sizeof (double) * 2, r->i_buf, r->i_samples, - sizeof (double) * 2); + r->filter_length * sizeof (double) * 2, r->i_buf, r->i_samples, + sizeof (double) * 2); } } else if (r->format == GST_RESAMPLE_FLOAT) { if (r->channels == 2) { conv_double_float (r->buffer + r->filter_length * sizeof (double) * 2, - r->i_buf, r->i_samples * 2); + r->i_buf, r->i_samples * 2); } else { conv_double_float_dstr (r->buffer + - r->filter_length * sizeof (double) * 2, r->i_buf, r->i_samples, - sizeof (double) * 2); + r->filter_length * sizeof (double) * 2, r->i_buf, r->i_samples, + sizeof (double) * 2); } } @@ -358,15 +358,15 @@ gst_resample_sinc_slow_s16 (gst_resample_t * r) c0 = 0; c1 = 0; for (j = 0; j < r->filter_length; j++) { - weight = (x == 0) ? 1 : (sinx / x); + weight = (x == 0) ? 1 : (sinx / x); /*printf("j %d sin %g cos %g\n",j,sinx,cosx); */ /*printf("j %d sin %g x %g sinc %g\n",j,sinx,x,weight); */ - c0 += weight * GETBUF ((start + j), 0); - c1 += weight * GETBUF ((start + j), 1); - t = cosx * cosd - sinx * sind; - sinx = cosx * sind + sinx * cosd; - cosx = t; - x += d; + c0 += weight * GETBUF ((start + j), 0); + c1 += weight * GETBUF ((start + j), 1); + t = cosx * cosd - sinx * sind; + sinx = cosx * sind + sinx * cosd; + cosx = t; + x += d; } o_ptr[0] = rint (c0); o_ptr[1] = rint (c1); @@ -494,7 +494,7 @@ gst_resample_sinc_ft_s16 (gst_resample_t * r) double scale; int n = 4; - scale = r->i_inc; /* cutoff at 22050 */ + scale = r->i_inc; /* cutoff at 22050 */ /*scale = 1.0; // cutoff at 24000 */ /*scale = r->i_inc * 0.5; // cutoff at 11025 */ @@ -546,7 +546,7 @@ gst_resample_sinc_ft_s16 (gst_resample_t * r) } #else functable_fir2 (ft, - &c0, &c1, x, n, ptr + (start + r->filter_length) * 2, r->filter_length); + &c0, &c1, x, n, ptr + (start + r->filter_length) * 2, r->filter_length); c0 *= scale; c1 *= scale; #endif @@ -566,7 +566,7 @@ gst_resample_sinc_ft_s16 (gst_resample_t * r) conv_short_double (r->o_buf, out_tmp, 2 * r->o_samples); } else { conv_short_double_sstr (r->o_buf, out_tmp, r->o_samples, - 2 * sizeof (double)); + 2 * sizeof (double)); } } @@ -711,15 +711,15 @@ gst_resample_sinc_slow_float (gst_resample_t * r) c0 = 0; c1 = 0; for (j = 0; j < r->filter_length; j++) { - weight = (x == 0) ? 1 : (sinx / x); + weight = (x == 0) ? 1 : (sinx / x); /*printf("j %d sin %g cos %g\n",j,sinx,cosx); */ /*printf("j %d sin %g x %g sinc %g\n",j,sinx,x,weight); */ - c0 += weight * GETBUF ((start + j), 0); - c1 += weight * GETBUF ((start + j), 1); - t = cosx * cosd - sinx * sind; - sinx = cosx * sind + sinx * cosd; - cosx = t; - x += d; + c0 += weight * GETBUF ((start + j), 0); + c1 += weight * GETBUF ((start + j), 1); + t = cosx * cosd - sinx * sind; + sinx = cosx * sind + sinx * cosd; + cosx = t; + x += d; } o_ptr[0] = c0; o_ptr[1] = c1; @@ -806,7 +806,7 @@ gst_resample_sinc_ft_float (gst_resample_t * r) double scale; int n = 4; - scale = r->i_inc; /* cutoff at 22050 */ + scale = r->i_inc; /* cutoff at 22050 */ /*scale = 1.0; // cutoff at 24000 */ /*scale = r->i_inc * 0.5; // cutoff at 11025 */ @@ -858,7 +858,7 @@ gst_resample_sinc_ft_float (gst_resample_t * r) } #else functable_fir2 (ft, - &c0, &c1, x, n, ptr + (start + r->filter_length) * 2, r->filter_length); + &c0, &c1, x, n, ptr + (start + r->filter_length) * 2, r->filter_length); c0 *= scale; c1 *= scale; #endif @@ -878,7 +878,7 @@ gst_resample_sinc_ft_float (gst_resample_t * r) conv_float_double (r->o_buf, out_tmp, 2 * r->o_samples); } else { conv_float_double_sstr (r->o_buf, out_tmp, r->o_samples, - 2 * sizeof (double)); + 2 * sizeof (double)); } } diff --git a/gst-libs/gst/resample/test.c b/gst-libs/gst/resample/test.c index 152d12a6f1..d6785aef82 100644 --- a/gst-libs/gst/resample/test.c +++ b/gst-libs/gst/resample/test.c @@ -123,7 +123,7 @@ test_res1 (void) f = AMP * test_func ((double) i / O_RATE); /*f = rint(AMP*test_func((double)i/O_RATE)); */ fprintf (out, "%d %d %d %g %g\n", i, - o_buf[2 * i + 0], o_buf[2 * i + 1], f, o_buf[2 * i + 0] - f); + o_buf[2 * i + 0], o_buf[2 * i + 1], f, o_buf[2 * i + 0] - f); } sum10k = 0; @@ -206,7 +206,7 @@ test_res3 (void) for (i = 0; i < 1000 * n; i++) { x = -50.0 + 0.1 / n * i; f1 = functable_sinc (NULL, t->scale * x) * - functable_window_std (NULL, t->scale2 * x); + functable_window_std (NULL, t->scale2 * x); f2 = functable_eval (t, x); fprintf (out, "%d %g %g %g\n", i, f1, f2, f2 - f1); } @@ -224,7 +224,7 @@ sinc_poly (double x) return 1 - x2 * INV3FAC + x2 * x2 * INV5FAC - x2 * x2 * x2 * INV7FAC; /*+ x2 * x2 * x2 * x2 * INV9FAC */ - /*- x2 * x2 * x2 * x2 * x2 * INV11FAC; */ + /*- x2 * x2 * x2 * x2 * x2 * INV11FAC; */ } void diff --git a/gst-libs/gst/riff/riff-media.c b/gst-libs/gst/riff/riff-media.c index b51b4fb500..042651a9ea 100644 --- a/gst-libs/gst/riff/riff-media.c +++ b/gst-libs/gst/riff/riff-media.c @@ -35,175 +35,175 @@ gst_riff_create_video_caps (guint32 codec_fcc, switch (codec_fcc) { case GST_MAKE_FOURCC ('I', '4', '2', '0'): caps = gst_caps_new_simple ("video/x-raw-yuv", - "format", GST_TYPE_FOURCC, codec_fcc, NULL); + "format", GST_TYPE_FOURCC, codec_fcc, NULL); if (codec_name) - *codec_name = g_strdup ("Raw, uncompressed I420"); + *codec_name = g_strdup ("Raw, uncompressed I420"); break; case GST_MAKE_FOURCC ('Y', 'U', 'Y', '2'): caps = gst_caps_new_simple ("video/x-raw-yuv", - "format", GST_TYPE_FOURCC, codec_fcc, NULL); + "format", GST_TYPE_FOURCC, codec_fcc, NULL); if (codec_name) - *codec_name = g_strdup ("Raw, uncompressed YUV 4:2:2"); + *codec_name = g_strdup ("Raw, uncompressed YUV 4:2:2"); break; - case GST_MAKE_FOURCC ('M', 'J', 'P', 'G'): /* YUY2 MJPEG */ + case GST_MAKE_FOURCC ('M', 'J', 'P', 'G'): /* YUY2 MJPEG */ caps = gst_caps_new_simple ("video/x-jpeg", NULL); if (codec_name) - *codec_name = g_strdup ("Motion JPEG"); + *codec_name = g_strdup ("Motion JPEG"); break; - case GST_MAKE_FOURCC ('J', 'P', 'E', 'G'): /* generic (mostly RGB) MJPEG */ + case GST_MAKE_FOURCC ('J', 'P', 'E', 'G'): /* generic (mostly RGB) MJPEG */ caps = gst_caps_new_simple ("video/x-jpeg", NULL); if (codec_name) - *codec_name = g_strdup ("JPEG Still Image"); + *codec_name = g_strdup ("JPEG Still Image"); break; - case GST_MAKE_FOURCC ('P', 'I', 'X', 'L'): /* Miro/Pinnacle fourccs */ - case GST_MAKE_FOURCC ('V', 'I', 'X', 'L'): /* Miro/Pinnacle fourccs */ + case GST_MAKE_FOURCC ('P', 'I', 'X', 'L'): /* Miro/Pinnacle fourccs */ + case GST_MAKE_FOURCC ('V', 'I', 'X', 'L'): /* Miro/Pinnacle fourccs */ caps = gst_caps_new_simple ("video/x-jpeg", NULL); if (codec_name) - *codec_name = g_strdup ("Miro/Pinnacle Video XL"); + *codec_name = g_strdup ("Miro/Pinnacle Video XL"); break; case GST_MAKE_FOURCC ('H', 'F', 'Y', 'U'): caps = gst_caps_new_simple ("video/x-huffyuv", NULL); if (codec_name) - *codec_name = g_strdup ("Huffman Lossless Codec"); + *codec_name = g_strdup ("Huffman Lossless Codec"); break; case GST_MAKE_FOURCC ('M', 'P', 'E', 'G'): case GST_MAKE_FOURCC ('M', 'P', 'G', 'I'): caps = gst_caps_new_simple ("video/mpeg", - "systemstream", G_TYPE_BOOLEAN, FALSE, - "mpegversion", G_TYPE_BOOLEAN, 1, NULL); + "systemstream", G_TYPE_BOOLEAN, FALSE, + "mpegversion", G_TYPE_BOOLEAN, 1, NULL); if (codec_name) - *codec_name = g_strdup ("MPEG video"); + *codec_name = g_strdup ("MPEG video"); break; case GST_MAKE_FOURCC ('H', '2', '6', '3'): caps = gst_caps_new_simple ("video/x-h263", NULL); if (codec_name) - *codec_name = g_strdup ("ITU H.26n"); + *codec_name = g_strdup ("ITU H.26n"); break; case GST_MAKE_FOURCC ('i', '2', '6', '3'): caps = gst_caps_new_simple ("video/x-h263", NULL); if (codec_name) - *codec_name = g_strdup ("ITU H.263"); + *codec_name = g_strdup ("ITU H.263"); break; case GST_MAKE_FOURCC ('L', '2', '6', '3'): caps = gst_caps_new_simple ("video/x-h263", NULL); if (codec_name) - *codec_name = g_strdup ("Lead H.263"); + *codec_name = g_strdup ("Lead H.263"); break; case GST_MAKE_FOURCC ('M', '2', '6', '3'): caps = gst_caps_new_simple ("video/x-h263", NULL); if (codec_name) - *codec_name = g_strdup ("Microsoft H.263"); + *codec_name = g_strdup ("Microsoft H.263"); break; case GST_MAKE_FOURCC ('V', 'D', 'O', 'W'): caps = gst_caps_new_simple ("video/x-h263", NULL); if (codec_name) - *codec_name = g_strdup ("VDOLive"); + *codec_name = g_strdup ("VDOLive"); break; case GST_MAKE_FOURCC ('V', 'I', 'V', 'O'): caps = gst_caps_new_simple ("video/x-h263", NULL); if (codec_name) - *codec_name = g_strdup ("Vivo H.263"); + *codec_name = g_strdup ("Vivo H.263"); break; case GST_MAKE_FOURCC ('x', '2', '6', '3'): caps = gst_caps_new_simple ("video/x-h263", NULL); if (codec_name) - *codec_name = g_strdup ("Xirlink H.263"); + *codec_name = g_strdup ("Xirlink H.263"); break; case GST_MAKE_FOURCC ('D', 'I', 'V', '3'): caps = gst_caps_new_simple ("video/x-divx", - "divxversion", G_TYPE_INT, 3, NULL); + "divxversion", G_TYPE_INT, 3, NULL); if (codec_name) - *codec_name = g_strdup ("DivX MPEG-4 Version 3"); + *codec_name = g_strdup ("DivX MPEG-4 Version 3"); break; case GST_MAKE_FOURCC ('D', 'I', 'V', '4'): caps = gst_caps_new_simple ("video/x-divx", - "divxversion", G_TYPE_INT, 4, NULL); + "divxversion", G_TYPE_INT, 4, NULL); if (codec_name) - *codec_name = g_strdup ("DivX MPEG-4 Version 4"); + *codec_name = g_strdup ("DivX MPEG-4 Version 4"); break; case GST_MAKE_FOURCC ('d', 'i', 'v', 'x'): case GST_MAKE_FOURCC ('D', 'I', 'V', 'X'): case GST_MAKE_FOURCC ('D', 'X', '5', '0'): case GST_MAKE_FOURCC ('D', 'I', 'V', '5'): caps = gst_caps_new_simple ("video/x-divx", - "divxversion", G_TYPE_INT, 5, NULL); + "divxversion", G_TYPE_INT, 5, NULL); if (codec_name) - *codec_name = g_strdup ("DivX MPEG-4 Version 5"); + *codec_name = g_strdup ("DivX MPEG-4 Version 5"); break; case GST_MAKE_FOURCC ('X', 'V', 'I', 'D'): case GST_MAKE_FOURCC ('x', 'v', 'i', 'd'): caps = gst_caps_new_simple ("video/x-xvid", NULL); if (codec_name) - *codec_name = g_strdup ("XVID MPEG-4"); + *codec_name = g_strdup ("XVID MPEG-4"); break; case GST_MAKE_FOURCC ('M', 'P', 'G', '4'): caps = gst_caps_new_simple ("video/x-msmpeg", - "msmpegversion", G_TYPE_INT, 41, NULL); + "msmpegversion", G_TYPE_INT, 41, NULL); if (codec_name) - *codec_name = g_strdup ("Microsoft MPEG-4 4.1"); + *codec_name = g_strdup ("Microsoft MPEG-4 4.1"); break; case GST_MAKE_FOURCC ('M', 'P', '4', '2'): caps = gst_caps_new_simple ("video/x-msmpeg", - "msmpegversion", G_TYPE_INT, 42, NULL); + "msmpegversion", G_TYPE_INT, 42, NULL); if (codec_name) - *codec_name = g_strdup ("Microsoft MPEG-4 4.2"); + *codec_name = g_strdup ("Microsoft MPEG-4 4.2"); break; case GST_MAKE_FOURCC ('M', 'P', '4', '3'): caps = gst_caps_new_simple ("video/x-msmpeg", - "msmpegversion", G_TYPE_INT, 43, NULL); + "msmpegversion", G_TYPE_INT, 43, NULL); if (codec_name) - *codec_name = g_strdup ("Microsoft MPEG-4 4.3"); + *codec_name = g_strdup ("Microsoft MPEG-4 4.3"); break; case GST_MAKE_FOURCC ('3', 'I', 'V', '1'): case GST_MAKE_FOURCC ('3', 'I', 'V', '2'): caps = gst_caps_new_simple ("video/x-3ivx", NULL); if (codec_name) - *codec_name = g_strdup ("3ivx"); + *codec_name = g_strdup ("3ivx"); break; case GST_MAKE_FOURCC ('D', 'V', 'S', 'D'): case GST_MAKE_FOURCC ('d', 'v', 's', 'd'): caps = gst_caps_new_simple ("video/x-dv", - "systemstream", G_TYPE_BOOLEAN, FALSE, NULL); + "systemstream", G_TYPE_BOOLEAN, FALSE, NULL); if (codec_name) - *codec_name = g_strdup ("Generic DV"); + *codec_name = g_strdup ("Generic DV"); break; case GST_MAKE_FOURCC ('W', 'M', 'V', '1'): caps = gst_caps_new_simple ("video/x-wmv", - "wmvversion", G_TYPE_INT, 1, NULL); + "wmvversion", G_TYPE_INT, 1, NULL); if (codec_name) - *codec_name = g_strdup ("Windows Media Video 7"); + *codec_name = g_strdup ("Windows Media Video 7"); break; case GST_MAKE_FOURCC ('W', 'M', 'V', '2'): caps = gst_caps_new_simple ("video/x-wmv", - "wmvversion", G_TYPE_INT, 2, NULL); + "wmvversion", G_TYPE_INT, 2, NULL); if (codec_name) - *codec_name = g_strdup ("Windows Media Video 8"); + *codec_name = g_strdup ("Windows Media Video 8"); break; case GST_MAKE_FOURCC ('W', 'M', 'V', '3'): caps = gst_caps_new_simple ("video/x-wmv", - "wmvversion", G_TYPE_INT, 3, NULL); + "wmvversion", G_TYPE_INT, 3, NULL); if (codec_name) - *codec_name = g_strdup ("Windows Media Video 9"); + *codec_name = g_strdup ("Windows Media Video 9"); break; default: GST_WARNING ("Unkown video fourcc " GST_FOURCC_FORMAT, - GST_FOURCC_ARGS (codec_fcc)); + GST_FOURCC_ARGS (codec_fcc)); return NULL; } @@ -213,17 +213,17 @@ gst_riff_create_video_caps (guint32 codec_fcc, gst_caps_set_simple (caps, "framerate", G_TYPE_DOUBLE, fps, NULL); } else { gst_caps_set_simple (caps, - "framerate", GST_TYPE_DOUBLE_RANGE, 0., G_MAXDOUBLE, NULL); + "framerate", GST_TYPE_DOUBLE_RANGE, 0., G_MAXDOUBLE, NULL); } if (strf != NULL) { gst_caps_set_simple (caps, - "width", G_TYPE_INT, strf->width, - "height", G_TYPE_INT, strf->height, NULL); + "width", G_TYPE_INT, strf->width, + "height", G_TYPE_INT, strf->height, NULL); } else { gst_caps_set_simple (caps, - "width", GST_TYPE_INT_RANGE, 16, 4096, - "height", GST_TYPE_INT_RANGE, 16, 4096, NULL); + "width", GST_TYPE_INT_RANGE, 16, 4096, + "height", GST_TYPE_INT_RANGE, 16, 4096, NULL); } return caps; @@ -236,75 +236,75 @@ gst_riff_create_audio_caps (guint16 codec_id, GstCaps *caps = NULL; switch (codec_id) { - case GST_RIFF_WAVE_FORMAT_MPEGL3: /* mp3 */ + case GST_RIFF_WAVE_FORMAT_MPEGL3: /* mp3 */ caps = gst_caps_new_simple ("audio/mpeg", - "mpegversion", G_TYPE_INT, 1, "layer", G_TYPE_INT, 3, NULL); + "mpegversion", G_TYPE_INT, 1, "layer", G_TYPE_INT, 3, NULL); if (codec_name) - *codec_name = g_strdup ("MPEG 1 layer 3"); + *codec_name = g_strdup ("MPEG 1 layer 3"); break; - case GST_RIFF_WAVE_FORMAT_MPEGL12: /* mp1 or mp2 */ + case GST_RIFF_WAVE_FORMAT_MPEGL12: /* mp1 or mp2 */ caps = gst_caps_new_simple ("audio/mpeg", - "mpegversion", G_TYPE_INT, 1, "layer", G_TYPE_INT, 2, NULL); + "mpegversion", G_TYPE_INT, 1, "layer", G_TYPE_INT, 2, NULL); if (codec_name) - *codec_name = g_strdup ("MPEG 1 layer 2"); + *codec_name = g_strdup ("MPEG 1 layer 2"); break; - case GST_RIFF_WAVE_FORMAT_PCM: /* PCM/wav */ + case GST_RIFF_WAVE_FORMAT_PCM: /* PCM/wav */ if (strf != NULL) { - gint ba = GUINT16_FROM_LE (strf->blockalign); - gint ch = GUINT16_FROM_LE (strf->channels); - gint ws = GUINT16_FROM_LE (strf->size); - - caps = gst_caps_new_simple ("audio/x-raw-int", - "endianness", G_TYPE_INT, G_LITTLE_ENDIAN, - "width", G_TYPE_INT, (int) (ba * 8 / ch), - "depth", G_TYPE_INT, ws, "signed", G_TYPE_BOOLEAN, ws != 8, NULL); + gint ba = GUINT16_FROM_LE (strf->blockalign); + gint ch = GUINT16_FROM_LE (strf->channels); + gint ws = GUINT16_FROM_LE (strf->size); + + caps = gst_caps_new_simple ("audio/x-raw-int", + "endianness", G_TYPE_INT, G_LITTLE_ENDIAN, + "width", G_TYPE_INT, (int) (ba * 8 / ch), + "depth", G_TYPE_INT, ws, "signed", G_TYPE_BOOLEAN, ws != 8, NULL); } else { - caps = gst_caps_from_string ("audio/x-raw-int, " - "endianness = (int) LITTLE_ENDIAN, " - "signed = (boolean) { true, false }, " - "width = (int) { 8, 16 }, " "height = (int) { 8, 16 }"); + caps = gst_caps_from_string ("audio/x-raw-int, " + "endianness = (int) LITTLE_ENDIAN, " + "signed = (boolean) { true, false }, " + "width = (int) { 8, 16 }, " "height = (int) { 8, 16 }"); } if (codec_name) - *codec_name = g_strdup ("PCM WAV"); + *codec_name = g_strdup ("PCM WAV"); break; case GST_RIFF_WAVE_FORMAT_MULAW: if (strf != NULL && strf->size != 8) { - GST_WARNING ("invalid depth (%d) of mulaw audio, overwriting.", - strf->size); + GST_WARNING ("invalid depth (%d) of mulaw audio, overwriting.", + strf->size); } caps = gst_caps_new_simple ("audio/x-mulaw", NULL); if (codec_name) - *codec_name = g_strdup ("Mulaw"); + *codec_name = g_strdup ("Mulaw"); break; case GST_RIFF_WAVE_FORMAT_ALAW: if (strf != NULL && strf->size != 8) { - GST_WARNING ("invalid depth (%d) of alaw audio, overwriting.", - strf->size); + GST_WARNING ("invalid depth (%d) of alaw audio, overwriting.", + strf->size); } caps = gst_caps_new_simple ("audio/x-alaw", NULL); if (codec_name) - *codec_name = g_strdup ("Alaw"); + *codec_name = g_strdup ("Alaw"); break; - case GST_RIFF_WAVE_FORMAT_VORBIS1: /* ogg/vorbis mode 1 */ - case GST_RIFF_WAVE_FORMAT_VORBIS2: /* ogg/vorbis mode 2 */ - case GST_RIFF_WAVE_FORMAT_VORBIS3: /* ogg/vorbis mode 3 */ - case GST_RIFF_WAVE_FORMAT_VORBIS1PLUS: /* ogg/vorbis mode 1+ */ - case GST_RIFF_WAVE_FORMAT_VORBIS2PLUS: /* ogg/vorbis mode 2+ */ - case GST_RIFF_WAVE_FORMAT_VORBIS3PLUS: /* ogg/vorbis mode 3+ */ + case GST_RIFF_WAVE_FORMAT_VORBIS1: /* ogg/vorbis mode 1 */ + case GST_RIFF_WAVE_FORMAT_VORBIS2: /* ogg/vorbis mode 2 */ + case GST_RIFF_WAVE_FORMAT_VORBIS3: /* ogg/vorbis mode 3 */ + case GST_RIFF_WAVE_FORMAT_VORBIS1PLUS: /* ogg/vorbis mode 1+ */ + case GST_RIFF_WAVE_FORMAT_VORBIS2PLUS: /* ogg/vorbis mode 2+ */ + case GST_RIFF_WAVE_FORMAT_VORBIS3PLUS: /* ogg/vorbis mode 3+ */ caps = gst_caps_new_simple ("audio/x-vorbis", NULL); if (codec_name) - *codec_name = g_strdup ("Vorbis"); + *codec_name = g_strdup ("Vorbis"); break; case GST_RIFF_WAVE_FORMAT_A52: caps = gst_caps_new_simple ("audio/x-ac3", NULL); if (codec_name) - *codec_name = g_strdup ("AC3"); + *codec_name = g_strdup ("AC3"); break; default: @@ -314,12 +314,12 @@ gst_riff_create_audio_caps (guint16 codec_id, if (strf != NULL) { gst_caps_set_simple (caps, - "rate", G_TYPE_INT, strf->rate, - "channels", G_TYPE_INT, strf->channels, NULL); + "rate", G_TYPE_INT, strf->rate, + "channels", G_TYPE_INT, strf->channels, NULL); } else { gst_caps_set_simple (caps, - "rate", GST_TYPE_INT_RANGE, 8000, 96000, - "channels", GST_TYPE_INT_RANGE, 1, 2, NULL); + "rate", GST_TYPE_INT_RANGE, 8000, 96000, + "channels", GST_TYPE_INT_RANGE, 1, 2, NULL); } return caps; @@ -336,13 +336,13 @@ gst_riff_create_iavs_caps (guint32 codec_fcc, case GST_MAKE_FOURCC ('D', 'V', 'S', 'D'): case GST_MAKE_FOURCC ('d', 'v', 's', 'd'): caps = gst_caps_new_simple ("video/x-dv", - "systemstream", G_TYPE_BOOLEAN, TRUE, NULL); + "systemstream", G_TYPE_BOOLEAN, TRUE, NULL); if (codec_name) - *codec_name = g_strdup ("Generic DV"); + *codec_name = g_strdup ("Generic DV"); default: GST_WARNING ("Unkown IAVS fourcc " GST_FOURCC_FORMAT, - GST_FOURCC_ARGS (codec_fcc)); + GST_FOURCC_ARGS (codec_fcc)); return NULL; } diff --git a/gst-libs/gst/riff/riff-read.c b/gst-libs/gst/riff/riff-read.c index c8c5b634ec..0eed6242b4 100644 --- a/gst-libs/gst/riff/riff-read.c +++ b/gst-libs/gst/riff/riff-read.c @@ -61,8 +61,8 @@ gst_riff_read_get_type (void) }; gst_riff_read_type = - g_type_register_static (GST_TYPE_ELEMENT, "GstRiffRead", - &gst_riff_read_info, 0); + g_type_register_static (GST_TYPE_ELEMENT, "GstRiffRead", + &gst_riff_read_info, 0); } return gst_riff_read_type; @@ -94,16 +94,16 @@ gst_riff_read_change_state (GstElement * element) switch (GST_STATE_TRANSITION (element)) { case GST_STATE_READY_TO_PAUSED: if (!riff->sinkpad) - return GST_STATE_FAILURE; + return GST_STATE_FAILURE; riff->bs = gst_bytestream_new (riff->sinkpad); break; case GST_STATE_PAUSED_TO_READY: gst_bytestream_destroy (riff->bs); while (riff->level) { - GstRiffLevel *level = riff->level->data; + GstRiffLevel *level = riff->level->data; - riff->level = g_list_remove (riff->level, level); - g_free (level); + riff->level = g_list_remove (riff->level, level); + g_free (level); } break; default: @@ -165,7 +165,7 @@ gst_riff_peek_head (GstRiffRead * riff, if (GST_IS_EVENT (event)) { gst_pad_event_default (riff->sinkpad, event); if (GST_EVENT_TYPE (event) == GST_EVENT_EOS) - return FALSE; + return FALSE; } else { GST_ELEMENT_ERROR (riff, RESOURCE, READ, (NULL), (NULL)); return FALSE; @@ -257,7 +257,7 @@ gst_riff_read_seek (GstRiffRead * riff, guint64 offset) } else if (GST_EVENT_TYPE (event) != GST_EVENT_DISCONTINUOUS) { gst_pad_event_default (riff->sinkpad, event); if (GST_EVENT_TYPE (event) == GST_EVENT_EOS) - return NULL; + return NULL; event = NULL; } } @@ -341,7 +341,7 @@ gst_riff_read_skip (GstRiffRead * riff) /* no */ if (!(event = gst_riff_read_seek (riff, - gst_bytestream_tell (riff->bs) + length))) + gst_bytestream_tell (riff->bs) + length))) return FALSE; gst_event_unref (event); @@ -407,7 +407,7 @@ gst_riff_read_strh (GstRiffRead * riff, gst_riff_strh ** header) } if (GST_BUFFER_SIZE (buf) < sizeof (gst_riff_strh)) { g_warning ("Too small strh (%d available, %d needed)", - GST_BUFFER_SIZE (buf), (int) sizeof (gst_riff_strh)); + GST_BUFFER_SIZE (buf), (int) sizeof (gst_riff_strh)); gst_buffer_unref (buf); return FALSE; } @@ -474,7 +474,7 @@ gst_riff_read_strf_vids (GstRiffRead * riff, gst_riff_strf_vids ** header) } if (GST_BUFFER_SIZE (buf) < sizeof (gst_riff_strf_vids)) { g_warning ("Too small strf_vids (%d available, %d needed)", - GST_BUFFER_SIZE (buf), (int) sizeof (gst_riff_strf_vids)); + GST_BUFFER_SIZE (buf), (int) sizeof (gst_riff_strf_vids)); gst_buffer_unref (buf); return FALSE; } @@ -498,7 +498,7 @@ gst_riff_read_strf_vids (GstRiffRead * riff, gst_riff_strf_vids ** header) /* size checking */ if (strf->size > GST_BUFFER_SIZE (buf)) { g_warning ("strf_vids header gave %d bytes data, only %d available", - strf->size, GST_BUFFER_SIZE (buf)); + strf->size, GST_BUFFER_SIZE (buf)); strf->size = GST_BUFFER_SIZE (buf); } @@ -541,7 +541,7 @@ gst_riff_read_strf_auds (GstRiffRead * riff, gst_riff_strf_auds ** header) } if (GST_BUFFER_SIZE (buf) < sizeof (gst_riff_strf_auds)) { g_warning ("Too small strf_auds (%d available, %d needed)", - GST_BUFFER_SIZE (buf), (int) sizeof (gst_riff_strf_auds)); + GST_BUFFER_SIZE (buf), (int) sizeof (gst_riff_strf_auds)); gst_buffer_unref (buf); return FALSE; } @@ -564,7 +564,7 @@ gst_riff_read_strf_auds (GstRiffRead * riff, gst_riff_strf_auds ** header) GST_INFO (" rate %d", strf->rate); GST_INFO (" av_bps %d", strf->av_bps); GST_INFO (" blockalign %d", strf->blockalign); - GST_INFO (" size %d", strf->size); /* wordsize, not extrasize! */ + GST_INFO (" size %d", strf->size); /* wordsize, not extrasize! */ gst_buffer_unref (buf); @@ -590,7 +590,7 @@ gst_riff_read_strf_iavs (GstRiffRead * riff, gst_riff_strf_iavs ** header) } if (GST_BUFFER_SIZE (buf) < sizeof (gst_riff_strf_iavs)) { g_warning ("Too small strf_iavs (%d available, %d needed)", - GST_BUFFER_SIZE (buf), (int) sizeof (gst_riff_strf_iavs)); + GST_BUFFER_SIZE (buf), (int) sizeof (gst_riff_strf_iavs)); gst_buffer_unref (buf); return FALSE; } @@ -694,102 +694,103 @@ gst_riff_read_info (GstRiffRead * riff) /* find out the type of metadata */ switch (tag) { case GST_RIFF_INFO_IARL: - type = GST_TAG_LOCATION; - break; + type = GST_TAG_LOCATION; + break; case GST_RIFF_INFO_IART: - type = GST_TAG_ARTIST; - break; + type = GST_TAG_ARTIST; + break; case GST_RIFF_INFO_ICMS: - type = NULL; /*"Commissioner"; */ - break; + type = NULL; /*"Commissioner"; */ + break; case GST_RIFF_INFO_ICMT: - type = GST_TAG_COMMENT; - break; + type = GST_TAG_COMMENT; + break; case GST_RIFF_INFO_ICOP: - type = GST_TAG_COPYRIGHT; - break; + type = GST_TAG_COPYRIGHT; + break; case GST_RIFF_INFO_ICRD: - type = GST_TAG_DATE; - break; + type = GST_TAG_DATE; + break; case GST_RIFF_INFO_ICRP: - type = NULL; /*"Cropped"; */ - break; + type = NULL; /*"Cropped"; */ + break; case GST_RIFF_INFO_IDIM: - type = NULL; /*"Dimensions"; */ - break; + type = NULL; /*"Dimensions"; */ + break; case GST_RIFF_INFO_IDPI: - type = NULL; /*"Dots per Inch"; */ - break; + type = NULL; /*"Dots per Inch"; */ + break; case GST_RIFF_INFO_IENG: - type = NULL; /*"Engineer"; */ - break; + type = NULL; /*"Engineer"; */ + break; case GST_RIFF_INFO_IGNR: - type = GST_TAG_GENRE; - break; + type = GST_TAG_GENRE; + break; case GST_RIFF_INFO_IKEY: - type = NULL; /*"Keywords"; */ ; - break; + type = NULL; /*"Keywords"; */ ; + break; case GST_RIFF_INFO_ILGT: - type = NULL; /*"Lightness"; */ - break; + type = NULL; /*"Lightness"; */ + break; case GST_RIFF_INFO_IMED: - type = NULL; /*"Medium"; */ - break; + type = NULL; /*"Medium"; */ + break; case GST_RIFF_INFO_INAM: - type = GST_TAG_TITLE; - break; + type = GST_TAG_TITLE; + break; case GST_RIFF_INFO_IPLT: - type = NULL; /*"Palette"; */ - break; + type = NULL; /*"Palette"; */ + break; case GST_RIFF_INFO_IPRD: - type = NULL; /*"Product"; */ - break; + type = NULL; /*"Product"; */ + break; case GST_RIFF_INFO_ISBJ: - type = NULL; /*"Subject"; */ - break; + type = NULL; /*"Subject"; */ + break; case GST_RIFF_INFO_ISFT: - type = GST_TAG_ENCODER; - break; + type = GST_TAG_ENCODER; + break; case GST_RIFF_INFO_ISHP: - type = NULL; /*"Sharpness"; */ - break; + type = NULL; /*"Sharpness"; */ + break; case GST_RIFF_INFO_ISRC: - type = GST_TAG_ISRC; - break; + type = GST_TAG_ISRC; + break; case GST_RIFF_INFO_ISRF: - type = NULL; /*"Source Form"; */ - break; + type = NULL; /*"Source Form"; */ + break; case GST_RIFF_INFO_ITCH: - type = NULL; /*"Technician"; */ - break; + type = NULL; /*"Technician"; */ + break; default: - type = NULL; - GST_WARNING ("Unknown INFO (metadata) tag entry " GST_FOURCC_FORMAT, - GST_FOURCC_ARGS (tag)); - break; + type = NULL; + GST_WARNING ("Unknown INFO (metadata) tag entry " GST_FOURCC_FORMAT, + GST_FOURCC_ARGS (tag)); + break; } if (type) { name = NULL; if (!gst_riff_read_ascii (riff, &tag, &name)) { - return FALSE; + return FALSE; } if (name && name[0] != '\0') { - GValue src = { 0 } - , dest = { - 0}; - GType dest_type = gst_tag_get_type (type); - - have_tags = TRUE; - g_value_init (&src, G_TYPE_STRING); - g_value_set_string (&src, name); - g_value_init (&dest, dest_type); - g_value_transform (&src, &dest); - g_value_unset (&src); - gst_tag_list_add_values (taglist, GST_TAG_MERGE_APPEND, - type, &dest, NULL); - g_value_unset (&dest); + GValue src = { 0 } + , dest = + { + 0}; + GType dest_type = gst_tag_get_type (type); + + have_tags = TRUE; + g_value_init (&src, G_TYPE_STRING); + g_value_set_string (&src, name); + g_value_init (&dest, dest_type); + g_value_transform (&src, &dest); + g_value_unset (&src); + gst_tag_list_add_values (taglist, GST_TAG_MERGE_APPEND, + type, &dest, NULL); + g_value_unset (&dest); } g_free (name); } else { @@ -804,10 +805,10 @@ gst_riff_read_info (GstRiffRead * riff) /* let the world know about this wonderful thing */ for (padlist = gst_element_get_pad_list (element); - padlist != NULL; padlist = padlist->next) { + padlist != NULL; padlist = padlist->next) { if (GST_PAD_IS_SRC (padlist->data) && GST_PAD_IS_USABLE (padlist->data)) { - gst_event_ref (event); - gst_pad_push (GST_PAD (padlist->data), GST_DATA (event)); + gst_event_ref (event); + gst_pad_push (GST_PAD (padlist->data), GST_DATA (event)); } } gst_event_unref (event); diff --git a/gst-libs/gst/tuner/tuner.c b/gst-libs/gst/tuner/tuner.c index fd1c354f00..5bfe1ae7b1 100644 --- a/gst-libs/gst/tuner/tuner.c +++ b/gst-libs/gst/tuner/tuner.c @@ -60,9 +60,9 @@ gst_tuner_get_type (void) }; gst_tuner_type = g_type_register_static (G_TYPE_INTERFACE, - "GstTuner", &gst_tuner_info, 0); + "GstTuner", &gst_tuner_info, 0); g_type_interface_add_prerequisite (gst_tuner_type, - GST_TYPE_IMPLEMENTS_INTERFACE); + GST_TYPE_IMPLEMENTS_INTERFACE); } return gst_tuner_type; @@ -75,32 +75,32 @@ gst_tuner_class_init (GstTunerClass * klass) if (!initialized) { gst_tuner_signals[NORM_CHANGED] = - g_signal_new ("norm-changed", - GST_TYPE_TUNER, G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (GstTunerClass, norm_changed), - NULL, NULL, - g_cclosure_marshal_VOID__OBJECT, G_TYPE_NONE, 1, GST_TYPE_TUNER_NORM); + g_signal_new ("norm-changed", + GST_TYPE_TUNER, G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (GstTunerClass, norm_changed), + NULL, NULL, + g_cclosure_marshal_VOID__OBJECT, G_TYPE_NONE, 1, GST_TYPE_TUNER_NORM); gst_tuner_signals[CHANNEL_CHANGED] = - g_signal_new ("channel-changed", - GST_TYPE_TUNER, G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (GstTunerClass, channel_changed), - NULL, NULL, - g_cclosure_marshal_VOID__OBJECT, G_TYPE_NONE, 1, - GST_TYPE_TUNER_CHANNEL); + g_signal_new ("channel-changed", + GST_TYPE_TUNER, G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (GstTunerClass, channel_changed), + NULL, NULL, + g_cclosure_marshal_VOID__OBJECT, G_TYPE_NONE, 1, + GST_TYPE_TUNER_CHANNEL); gst_tuner_signals[FREQUENCY_CHANGED] = - g_signal_new ("frequency-changed", - GST_TYPE_TUNER, G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (GstTunerClass, frequency_changed), - NULL, NULL, - gst_tuner_marshal_VOID__OBJECT_ULONG, G_TYPE_NONE, 2, - GST_TYPE_TUNER_CHANNEL, G_TYPE_ULONG); + g_signal_new ("frequency-changed", + GST_TYPE_TUNER, G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (GstTunerClass, frequency_changed), + NULL, NULL, + gst_tuner_marshal_VOID__OBJECT_ULONG, G_TYPE_NONE, 2, + GST_TYPE_TUNER_CHANNEL, G_TYPE_ULONG); gst_tuner_signals[SIGNAL_CHANGED] = - g_signal_new ("signal-changed", - GST_TYPE_TUNER, G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (GstTunerClass, signal_changed), - NULL, NULL, - gst_tuner_marshal_VOID__OBJECT_INT, G_TYPE_NONE, 2, - GST_TYPE_TUNER_CHANNEL, G_TYPE_INT); + g_signal_new ("signal-changed", + GST_TYPE_TUNER, G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (GstTunerClass, signal_changed), + NULL, NULL, + gst_tuner_marshal_VOID__OBJECT_INT, G_TYPE_NONE, 2, + GST_TYPE_TUNER_CHANNEL, G_TYPE_INT); initialized = TRUE; } @@ -262,7 +262,7 @@ gst_tuner_set_frequency (GstTuner * tuner, GstTunerClass *klass = GST_TUNER_GET_CLASS (tuner); g_return_if_fail (GST_TUNER_CHANNEL_HAS_FLAG (channel, - GST_TUNER_CHANNEL_FREQUENCY)); + GST_TUNER_CHANNEL_FREQUENCY)); if (klass->set_frequency) { klass->set_frequency (tuner, channel, frequency); @@ -286,7 +286,7 @@ gst_tuner_get_frequency (GstTuner * tuner, GstTunerChannel * channel) GstTunerClass *klass = GST_TUNER_GET_CLASS (tuner); g_return_val_if_fail (GST_TUNER_CHANNEL_HAS_FLAG (channel, - GST_TUNER_CHANNEL_FREQUENCY), 0); + GST_TUNER_CHANNEL_FREQUENCY), 0); if (klass->get_frequency) { return klass->get_frequency (tuner, channel); @@ -315,7 +315,7 @@ gst_tuner_signal_strength (GstTuner * tuner, GstTunerChannel * channel) GstTunerClass *klass = GST_TUNER_GET_CLASS (tuner); g_return_val_if_fail (GST_TUNER_CHANNEL_HAS_FLAG (channel, - GST_TUNER_CHANNEL_FREQUENCY), 0); + GST_TUNER_CHANNEL_FREQUENCY), 0); if (klass->signal_strength) { return klass->signal_strength (tuner, channel); diff --git a/gst-libs/gst/tuner/tunerchannel.c b/gst-libs/gst/tuner/tunerchannel.c index af93f56842..de0be2e433 100644 --- a/gst-libs/gst/tuner/tunerchannel.c +++ b/gst-libs/gst/tuner/tunerchannel.c @@ -60,8 +60,8 @@ gst_tuner_channel_get_type (void) }; gst_tuner_channel_type = - g_type_register_static (G_TYPE_OBJECT, - "GstTunerChannel", &tuner_channel_info, 0); + g_type_register_static (G_TYPE_OBJECT, + "GstTunerChannel", &tuner_channel_info, 0); } return gst_tuner_channel_type; @@ -78,13 +78,13 @@ gst_tuner_channel_class_init (GstTunerChannelClass * klass) g_signal_new ("frequency-changed", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (GstTunerChannelClass, - frequency_changed), + frequency_changed), NULL, NULL, g_cclosure_marshal_VOID__ULONG, G_TYPE_NONE, 1, G_TYPE_ULONG); signals[SIGNAL_SIGNAL_CHANGED] = g_signal_new ("signal-changed", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (GstTunerChannelClass, - signal_changed), + signal_changed), NULL, NULL, g_cclosure_marshal_VOID__INT, G_TYPE_NONE, 1, G_TYPE_INT); object_klass->dispose = gst_tuner_channel_dispose; diff --git a/gst-libs/gst/tuner/tunernorm.c b/gst-libs/gst/tuner/tunernorm.c index 41927d2b1e..8fb98db7d4 100644 --- a/gst-libs/gst/tuner/tunernorm.c +++ b/gst-libs/gst/tuner/tunernorm.c @@ -59,8 +59,8 @@ gst_tuner_norm_get_type (void) }; gst_tuner_norm_type = - g_type_register_static (G_TYPE_OBJECT, - "GstTunerNorm", &tuner_norm_info, 0); + g_type_register_static (G_TYPE_OBJECT, + "GstTunerNorm", &tuner_norm_info, 0); } return gst_tuner_norm_type; diff --git a/gst-libs/gst/video/gstvideofilter.c b/gst-libs/gst/video/gstvideofilter.c index 590616bccd..f46d69e7a5 100644 --- a/gst-libs/gst/video/gstvideofilter.c +++ b/gst-libs/gst/video/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-libs/gst/video/gstvideosink.c b/gst-libs/gst/video/gstvideosink.c index 2acf7e573f..45ed37268c 100644 --- a/gst-libs/gst/video/gstvideosink.c +++ b/gst-libs/gst/video/gstvideosink.c @@ -83,7 +83,7 @@ gst_videosink_get_type (void) }; videosink_type = g_type_register_static (GST_TYPE_ELEMENT, - "GstVideoSink", &videosink_info, 0); + "GstVideoSink", &videosink_info, 0); } return videosink_type; diff --git a/gst-libs/gst/video/video.c b/gst-libs/gst/video/video.c index 8fed1e76b7..6e942112b5 100644 --- a/gst-libs/gst/video/video.c +++ b/gst-libs/gst/video/video.c @@ -37,14 +37,14 @@ gst_video_frame_rate (GstPad * pad) caps = GST_PAD_CAPS (pad); if (caps == NULL) { g_warning ("gstvideo: failed to get caps of pad %s:%s", - GST_ELEMENT_NAME (gst_pad_get_parent (pad)), GST_PAD_NAME (pad)); + GST_ELEMENT_NAME (gst_pad_get_parent (pad)), GST_PAD_NAME (pad)); return 0.; } structure = gst_caps_get_structure (caps, 0); if (!gst_structure_get_double (structure, "framerate", &fps)) { g_warning ("gstvideo: failed to get framerate property of pad %s:%s", - GST_ELEMENT_NAME (gst_pad_get_parent (pad)), GST_PAD_NAME (pad)); + GST_ELEMENT_NAME (gst_pad_get_parent (pad)), GST_PAD_NAME (pad)); return 0.; } @@ -69,7 +69,7 @@ gst_video_get_size (GstPad * pad, gint * width, gint * height) if (caps == NULL) { g_warning ("gstvideo: failed to get caps of pad %s:%s", - GST_ELEMENT_NAME (gst_pad_get_parent (pad)), GST_PAD_NAME (pad)); + GST_ELEMENT_NAME (gst_pad_get_parent (pad)), GST_PAD_NAME (pad)); return FALSE; } @@ -79,7 +79,7 @@ gst_video_get_size (GstPad * pad, gint * width, gint * height) if (!ret) { g_warning ("gstvideo: failed to get size properties on pad %s:%s", - GST_ELEMENT_NAME (gst_pad_get_parent (pad)), GST_PAD_NAME (pad)); + GST_ELEMENT_NAME (gst_pad_get_parent (pad)), GST_PAD_NAME (pad)); return FALSE; } diff --git a/gst-libs/gst/xoverlay/xoverlay.c b/gst-libs/gst/xoverlay/xoverlay.c index c1014eb179..f4d1e1cf1d 100644 --- a/gst-libs/gst/xoverlay/xoverlay.c +++ b/gst-libs/gst/xoverlay/xoverlay.c @@ -55,9 +55,9 @@ gst_x_overlay_get_type (void) }; gst_x_overlay_type = g_type_register_static (G_TYPE_INTERFACE, - "GstXOverlay", &gst_x_overlay_info, 0); + "GstXOverlay", &gst_x_overlay_info, 0); g_type_interface_add_prerequisite (gst_x_overlay_type, - GST_TYPE_IMPLEMENTS_INTERFACE); + GST_TYPE_IMPLEMENTS_INTERFACE); } return gst_x_overlay_type; @@ -76,16 +76,16 @@ gst_x_overlay_base_init (gpointer g_class) if (!initialized) { gst_x_overlay_signals[HAVE_XWINDOW_ID] = - g_signal_new ("have-xwindow-id", - GST_TYPE_X_OVERLAY, G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (GstXOverlayClass, have_xwindow_id), - NULL, NULL, g_cclosure_marshal_VOID__INT, G_TYPE_NONE, 1, G_TYPE_INT); + g_signal_new ("have-xwindow-id", + GST_TYPE_X_OVERLAY, G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (GstXOverlayClass, have_xwindow_id), + NULL, NULL, g_cclosure_marshal_VOID__INT, G_TYPE_NONE, 1, G_TYPE_INT); gst_x_overlay_signals[DESIRED_SIZE] = - g_signal_new ("desired-size-changed", - GST_TYPE_X_OVERLAY, G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (GstXOverlayClass, desired_size), - NULL, NULL, - gst_marshal_VOID__INT_INT, G_TYPE_NONE, 2, G_TYPE_INT, G_TYPE_INT); + g_signal_new ("desired-size-changed", + GST_TYPE_X_OVERLAY, G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (GstXOverlayClass, desired_size), + NULL, NULL, + gst_marshal_VOID__INT_INT, G_TYPE_NONE, 2, G_TYPE_INT, G_TYPE_INT); initialized = TRUE; } @@ -155,7 +155,7 @@ gst_x_overlay_get_desired_size (GstXOverlay * overlay, guint * width, /* this ensures that elements don't need to check width and height for NULL but apps may use NULL */ klass->get_desired_size (overlay, width ? width : &width_tmp, - height ? height : &height_tmp); + height ? height : &height_tmp); } else { if (width) *width = 0; diff --git a/gst-libs/gst/xwindowlistener/xwindowlistener.c b/gst-libs/gst/xwindowlistener/xwindowlistener.c index dc289854d5..63cfdd2d94 100644 --- a/gst-libs/gst/xwindowlistener/xwindowlistener.c +++ b/gst-libs/gst/xwindowlistener/xwindowlistener.c @@ -57,8 +57,8 @@ gst_x_window_listener_get_type (void) }; x_window_listener_type = - g_type_register_static (G_TYPE_OBJECT, - "GstXWindowListener", &x_window_listener_info, 0); + g_type_register_static (G_TYPE_OBJECT, + "GstXWindowListener", &x_window_listener_info, 0); } return x_window_listener_type; @@ -183,7 +183,7 @@ gst_xwin_refresh (gpointer data) if (!xwin->ov_move && xwin->ov_map && xwin->ov_visibility == VisibilityUnobscured) { g_mutex_unlock (xwin->main_lock); - return FALSE; /* skip */ + return FALSE; /* skip */ } if (xwin->ov_map && xwin->ov_visibility != VisibilityFullyObscured) { @@ -307,17 +307,17 @@ gst_xwin_window (GstXWindowListener * xwin) if (xwin->ov_conf) { xwin->set_window_func (xwin->private_data, - xwin->x, xwin->y, xwin->w, xwin->h, xwin->clips, xwin->num_clips); + xwin->x, xwin->y, xwin->w, xwin->h, xwin->clips, xwin->num_clips); if (!xwin->ov_visible) - gst_xwin_set_overlay (xwin, TRUE); + gst_xwin_set_overlay (xwin, TRUE); g_mutex_lock (xwin->main_lock); if (xwin->ov_refresh_id) - g_source_remove (xwin->ov_refresh_id); + g_source_remove (xwin->ov_refresh_id); xwin->ov_refresh_id = - g_timeout_add (200, (GSourceFunc) gst_xwin_refresh, (gpointer) xwin); + g_timeout_add (200, (GSourceFunc) gst_xwin_refresh, (gpointer) xwin); xwin->ov_conf = FALSE; @@ -331,9 +331,9 @@ gst_xwin_window (GstXWindowListener * xwin) g_mutex_lock (xwin->main_lock); if (xwin->ov_refresh_id) - g_source_remove (xwin->ov_refresh_id); + g_source_remove (xwin->ov_refresh_id); xwin->ov_refresh_id = - g_timeout_add (200, (GSourceFunc) gst_xwin_refresh, (gpointer) xwin); + g_timeout_add (200, (GSourceFunc) gst_xwin_refresh, (gpointer) xwin); xwin->ov_conf = FALSE; @@ -355,7 +355,7 @@ gst_xwin_configure (GstXWindowListener * xwin) * in the main thread instead of here. */ if (!xwin->ov_conf_id) xwin->ov_conf_id = - g_idle_add ((GSourceFunc) gst_rec_xoverlay_window, (gpointer) xwin); + g_idle_add ((GSourceFunc) gst_rec_xoverlay_window, (gpointer) xwin); #endif gst_xwin_window ((gpointer) xwin); @@ -473,89 +473,89 @@ gst_xwin_thread (gpointer data) break; if ((event.type == ConfigureNotify && - event.xconfigure.window == xwin->xwindow_id) || - (event.type == MapNotify && - event.xmap.window == xwin->xwindow_id) || - (event.type == UnmapNotify && - event.xunmap.window == xwin->xwindow_id)) { + event.xconfigure.window == xwin->xwindow_id) || + (event.type == MapNotify && + event.xmap.window == xwin->xwindow_id) || + (event.type == UnmapNotify && + event.xunmap.window == xwin->xwindow_id)) { /* the 'parent' window, i.e. the widget provided by client */ switch (event.type) { - case MapNotify: - xwin->ov_map = TRUE; - xwin->ov_conf = TRUE; - gst_xwin_configure (xwin); - break; - - case UnmapNotify: - xwin->ov_map = FALSE; - xwin->ov_conf = TRUE; - gst_xwin_configure (xwin); - break; - - case ConfigureNotify: - gst_xwin_resize (xwin); - break; - - default: - /* nothing */ - break; + case MapNotify: + xwin->ov_map = TRUE; + xwin->ov_conf = TRUE; + gst_xwin_configure (xwin); + break; + + case UnmapNotify: + xwin->ov_map = FALSE; + xwin->ov_conf = TRUE; + gst_xwin_configure (xwin); + break; + + case ConfigureNotify: + gst_xwin_resize (xwin); + break; + + default: + /* nothing */ + break; } } else if (event.xany.window == xwin->child) { /* our own private window */ switch (event.type) { - case Expose: - if (!event.xexpose.count) { - if (xwin->ov_refresh) { - xwin->ov_refresh = FALSE; - } else { - xwin->ov_conf = TRUE; - gst_xwin_configure (xwin); - } - } - break; - - case VisibilityNotify: - xwin->ov_visibility = event.xvisibility.state; - if (xwin->ov_refresh) { - if (event.xvisibility.state != VisibilityFullyObscured) - xwin->ov_refresh = FALSE; - } else { - xwin->ov_conf = TRUE; - gst_xwin_configure (xwin); - } - break; - - default: - /* nothing */ - break; + case Expose: + if (!event.xexpose.count) { + if (xwin->ov_refresh) { + xwin->ov_refresh = FALSE; + } else { + xwin->ov_conf = TRUE; + gst_xwin_configure (xwin); + } + } + break; + + case VisibilityNotify: + xwin->ov_visibility = event.xvisibility.state; + if (xwin->ov_refresh) { + if (event.xvisibility.state != VisibilityFullyObscured) + xwin->ov_refresh = FALSE; + } else { + xwin->ov_conf = TRUE; + gst_xwin_configure (xwin); + } + break; + + default: + /* nothing */ + break; } } else { /* root window */ switch (event.type) { - case MapNotify: - case UnmapNotify: - /* are we still visible? */ - if (!xwin->ov_refresh) { - XWindowAttributes attr; - gboolean on; - - XGetWindowAttributes (xwin->display, xwin->xwindow_id, &attr); - on = (attr.map_state == IsViewable); - xwin->ov_wmmap = on; - xwin->ov_conf = TRUE; - gst_xwin_configure (xwin); - } - break; - - case ConfigureNotify: - if (!xwin->ov_refresh) { - gst_xwin_resize (xwin); - } - break; - - default: - /* nothing */ - break; + case MapNotify: + case UnmapNotify: + /* are we still visible? */ + if (!xwin->ov_refresh) { + XWindowAttributes attr; + gboolean on; + + XGetWindowAttributes (xwin->display, xwin->xwindow_id, &attr); + on = (attr.map_state == IsViewable); + xwin->ov_wmmap = on; + xwin->ov_conf = TRUE; + gst_xwin_configure (xwin); + } + break; + + case ConfigureNotify: + if (!xwin->ov_refresh) { + gst_xwin_resize (xwin); + } + break; + + default: + /* nothing */ + break; } } } diff --git a/gst/adder/gstadder.c b/gst/adder/gstadder.c index fcdb788bc8..b2f14d40b8 100644 --- a/gst/adder/gstadder.c +++ b/gst/adder/gstadder.c @@ -27,7 +27,7 @@ #endif #include "gstadder.h" #include <gst/audio/audio.h> -#include <string.h> /* strcmp */ +#include <string.h> /* strcmp */ #define GST_ADDER_BUFFER_SIZE 4096 #define GST_ADDER_NUM_BUFFERS 8 @@ -57,7 +57,7 @@ static GstStaticPadTemplate gst_adder_src_template = GST_PAD_SRC, GST_PAD_ALWAYS, GST_STATIC_CAPS (GST_AUDIO_INT_PAD_TEMPLATE_CAPS "; " - GST_AUDIO_FLOAT_STANDARD_PAD_TEMPLATE_CAPS) + GST_AUDIO_FLOAT_STANDARD_PAD_TEMPLATE_CAPS) ); static GstStaticPadTemplate gst_adder_sink_template = @@ -65,7 +65,7 @@ static GstStaticPadTemplate gst_adder_sink_template = GST_PAD_SINK, GST_PAD_REQUEST, GST_STATIC_CAPS (GST_AUDIO_INT_PAD_TEMPLATE_CAPS "; " - GST_AUDIO_FLOAT_STANDARD_PAD_TEMPLATE_CAPS) + GST_AUDIO_FLOAT_STANDARD_PAD_TEMPLATE_CAPS) ); static void gst_adder_class_init (GstAdderClass * klass); @@ -97,8 +97,9 @@ gst_adder_get_type (void) sizeof (GstAdder), 0, (GInstanceInitFunc) gst_adder_init, }; + adder_type = g_type_register_static (GST_TYPE_ELEMENT, "GstAdder", - &adder_info, 0); + &adder_info, 0); } return adder_type; } @@ -126,7 +127,7 @@ gst_adder_link (GstPad * pad, const GstCaps * caps) if (otherpad != pad) { ret = gst_pad_try_set_caps (otherpad, caps); if (GST_PAD_LINK_FAILED (ret)) { - return ret; + return ret; } } pads = g_list_next (pads); @@ -140,7 +141,7 @@ gst_adder_link (GstPad * pad, const GstCaps * caps) if (otherpad != pad) { ret = gst_pad_try_set_caps (otherpad, caps); if (GST_PAD_LINK_FAILED (ret)) { - return ret; + return ret; } } pads = g_list_next (pads); @@ -187,7 +188,7 @@ gst_adder_class_init (GstAdderClass * klass) g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_NUM_PADS, g_param_spec_int ("num_pads", "number of pads", "Number Of Pads", - 0, G_MAXINT, 0, G_PARAM_READABLE)); + 0, G_MAXINT, 0, G_PARAM_READABLE)); gobject_class->get_property = gst_adder_get_property; @@ -310,7 +311,7 @@ gst_adder_loop (GstElement * element) if (buf_out == NULL) { GST_ELEMENT_ERROR (adder, CORE, TOO_LAZY, (NULL), - ("could not get new output buffer")); + ("could not get new output buffer")); return; } @@ -335,14 +336,14 @@ gst_adder_loop (GstElement * element) if (!GST_PAD_IS_USABLE (input->sinkpad)) { GST_DEBUG ("adder ignoring pad %s:%s", - GST_DEBUG_PAD_NAME (input->sinkpad)); + GST_DEBUG_PAD_NAME (input->sinkpad)); continue; } /* Get data from the bytestream of each input channel. We need to check for events before passing on the data to the output buffer. */ got_bytes = gst_bytestream_peek_bytes (input->bytestream, &raw_in, - GST_BUFFER_SIZE (buf_out)); + GST_BUFFER_SIZE (buf_out)); /* FIXME we should do something with the data if got_bytes > 0 */ if (got_bytes < GST_BUFFER_SIZE (buf_out)) { @@ -353,80 +354,80 @@ gst_adder_loop (GstElement * element) gst_bytestream_get_status (input->bytestream, &waiting, &event); if (event) { - switch (GST_EVENT_TYPE (event)) { - case GST_EVENT_EOS: - /* if we get an EOS event from one of our sink pads, we assume that - pad's finished handling data. just skip this pad. */ - GST_DEBUG ("got an EOS event"); - gst_event_unref (event); - continue; - case GST_EVENT_INTERRUPT: - gst_event_unref (event); - GST_DEBUG ("got an interrupt event"); - /* we have to call interrupt here, the scheduler will switch out - this element ASAP or returns TRUE if we need to exit the loop */ - if (gst_element_interrupt (GST_ELEMENT (adder))) { - gst_buffer_unref (buf_out); - return; - } - default: - break; - } + switch (GST_EVENT_TYPE (event)) { + case GST_EVENT_EOS: + /* if we get an EOS event from one of our sink pads, we assume that + pad's finished handling data. just skip this pad. */ + GST_DEBUG ("got an EOS event"); + gst_event_unref (event); + continue; + case GST_EVENT_INTERRUPT: + gst_event_unref (event); + GST_DEBUG ("got an interrupt event"); + /* we have to call interrupt here, the scheduler will switch out + this element ASAP or returns TRUE if we need to exit the loop */ + if (gst_element_interrupt (GST_ELEMENT (adder))) { + gst_buffer_unref (buf_out); + return; + } + default: + break; + } } } else { /* here's where the data gets copied. */ GST_DEBUG ("copying %d bytes from channel %p to output data %p " - "in buffer %p", - GST_BUFFER_SIZE (buf_out), input, GST_BUFFER_DATA (buf_out), buf_out); + "in buffer %p", + GST_BUFFER_SIZE (buf_out), input, GST_BUFFER_DATA (buf_out), buf_out); if (adder->format == GST_ADDER_FORMAT_INT) { - if (adder->width == 32) { - gint32 *in = (gint32 *) raw_in; - gint32 *out = (gint32 *) GST_BUFFER_DATA (buf_out); - - for (i = 0; i < GST_BUFFER_SIZE (buf_out) / 4; i++) - out[i] = CLAMP (out[i] + in[i], 0x80000000, 0x7fffffff); - } else if (adder->width == 16) { - gint16 *in = (gint16 *) raw_in; - gint16 *out = (gint16 *) GST_BUFFER_DATA (buf_out); - - for (i = 0; i < GST_BUFFER_SIZE (buf_out) / 2; i++) - out[i] = CLAMP (out[i] + in[i], 0x8000, 0x7fff); - } else if (adder->width == 8) { - gint8 *in = (gint8 *) raw_in; - gint8 *out = (gint8 *) GST_BUFFER_DATA (buf_out); - - for (i = 0; i < GST_BUFFER_SIZE (buf_out); i++) - out[i] = CLAMP (out[i] + in[i], 0x80, 0x7f); - } else { - GST_ELEMENT_ERROR (adder, STREAM, FORMAT, (NULL), - ("invalid width (%u) for integer audio in gstadder", - adder->width)); - return; - } + if (adder->width == 32) { + gint32 *in = (gint32 *) raw_in; + gint32 *out = (gint32 *) GST_BUFFER_DATA (buf_out); + + for (i = 0; i < GST_BUFFER_SIZE (buf_out) / 4; i++) + out[i] = CLAMP (out[i] + in[i], 0x80000000, 0x7fffffff); + } else if (adder->width == 16) { + gint16 *in = (gint16 *) raw_in; + gint16 *out = (gint16 *) GST_BUFFER_DATA (buf_out); + + for (i = 0; i < GST_BUFFER_SIZE (buf_out) / 2; i++) + out[i] = CLAMP (out[i] + in[i], 0x8000, 0x7fff); + } else if (adder->width == 8) { + gint8 *in = (gint8 *) raw_in; + gint8 *out = (gint8 *) GST_BUFFER_DATA (buf_out); + + for (i = 0; i < GST_BUFFER_SIZE (buf_out); i++) + out[i] = CLAMP (out[i] + in[i], 0x80, 0x7f); + } else { + GST_ELEMENT_ERROR (adder, STREAM, FORMAT, (NULL), + ("invalid width (%u) for integer audio in gstadder", + adder->width)); + return; + } } else if (adder->format == GST_ADDER_FORMAT_FLOAT) { - if (adder->width == 64) { - gdouble *in = (gdouble *) raw_in; - gdouble *out = (gdouble *) GST_BUFFER_DATA (buf_out); - - for (i = 0; i < GST_BUFFER_SIZE (buf_out) / sizeof (gdouble); i++) - out[i] = CLAMP (out[i] + in[i], -1.0, 1.0); - } else if (adder->width == 32) { - gfloat *in = (gfloat *) raw_in; - gfloat *out = (gfloat *) GST_BUFFER_DATA (buf_out); - - for (i = 0; i < GST_BUFFER_SIZE (buf_out) / sizeof (gfloat); i++) - out[i] = CLAMP (out[i] + in[i], -1.0, 1.0); - } else { - GST_ELEMENT_ERROR (adder, STREAM, FORMAT, (NULL), - ("invalid width (%u) for float audio in gstadder", adder->width)); - return; - } + if (adder->width == 64) { + gdouble *in = (gdouble *) raw_in; + gdouble *out = (gdouble *) GST_BUFFER_DATA (buf_out); + + for (i = 0; i < GST_BUFFER_SIZE (buf_out) / sizeof (gdouble); i++) + out[i] = CLAMP (out[i] + in[i], -1.0, 1.0); + } else if (adder->width == 32) { + gfloat *in = (gfloat *) raw_in; + gfloat *out = (gfloat *) GST_BUFFER_DATA (buf_out); + + for (i = 0; i < GST_BUFFER_SIZE (buf_out) / sizeof (gfloat); i++) + out[i] = CLAMP (out[i] + in[i], -1.0, 1.0); + } else { + GST_ELEMENT_ERROR (adder, STREAM, FORMAT, (NULL), + ("invalid width (%u) for float audio in gstadder", adder->width)); + return; + } } else { - GST_ELEMENT_ERROR (adder, STREAM, FORMAT, (NULL), - ("invalid audio format (%d) in gstadder", adder->format)); - return; + GST_ELEMENT_ERROR (adder, STREAM, FORMAT, (NULL), + ("invalid audio format (%d) in gstadder", adder->format)); + return; } gst_bytestream_flush (input->bytestream, GST_BUFFER_SIZE (buf_out)); @@ -438,10 +439,10 @@ gst_adder_loop (GstElement * element) GST_BUFFER_TIMESTAMP (buf_out) = adder->timestamp; if (adder->format == GST_ADDER_FORMAT_FLOAT) adder->offset += - GST_BUFFER_SIZE (buf_out) / sizeof (gfloat) / adder->channels; + GST_BUFFER_SIZE (buf_out) / sizeof (gfloat) / adder->channels; else adder->offset += - GST_BUFFER_SIZE (buf_out) * 8 / adder->width / adder->channels; + GST_BUFFER_SIZE (buf_out) * 8 / adder->width / adder->channels; adder->timestamp = adder->offset * GST_SECOND / adder->rate; /* send it out */ diff --git a/gst/audioconvert/gstaudioconvert.c b/gst/audioconvert/gstaudioconvert.c index 9589863648..7df5825231 100644 --- a/gst/audioconvert/gstaudioconvert.c +++ b/gst/audioconvert/gstaudioconvert.c @@ -239,7 +239,7 @@ gst_audio_convert_chain (GstPad * pad, GstData * data) if (!gst_pad_is_negotiated (this->sink)) { GST_ELEMENT_ERROR (this, CORE, NEGOTIATION, (NULL), - ("Sink pad not negotiated before chain function")); + ("Sink pad not negotiated before chain function")); return; } if (!gst_pad_is_negotiated (this->src)) { @@ -327,13 +327,13 @@ gst_audio_convert_parse_caps (const GstCaps * gst_caps, || !gst_structure_get_int (structure, "width", &caps->width) || !gst_structure_get_int (structure, "rate", &caps->rate) || (caps->is_int - && (!gst_structure_get_boolean (structure, "signed", &caps->sign) - || !gst_structure_get_int (structure, "depth", &caps->depth) - || (caps->width != 8 - && !gst_structure_get_int (structure, "endianness", - &caps->endianness)))) || (!caps->is_int - && !gst_structure_get_int (structure, "buffer-frames", - &caps->buffer_frames))) { + && (!gst_structure_get_boolean (structure, "signed", &caps->sign) + || !gst_structure_get_int (structure, "depth", &caps->depth) + || (caps->width != 8 + && !gst_structure_get_int (structure, "endianness", + &caps->endianness)))) || (!caps->is_int + && !gst_structure_get_int (structure, "buffer-frames", + &caps->buffer_frames))) { GST_DEBUG ("could not get some values from structure"); return FALSE; } @@ -379,10 +379,10 @@ gst_audio_convert_link (GstPad * pad, const GstCaps * caps) gst_structure_set (structure, "rate", G_TYPE_INT, ac_caps.rate, NULL); if (strcmp (gst_structure_get_name (structure), "audio/x-raw-float") == 0) { if (!ac_caps.is_int) { - gst_structure_set (structure, "buffer-frames", G_TYPE_INT, - ac_caps.buffer_frames, NULL); + gst_structure_set (structure, "buffer-frames", G_TYPE_INT, + ac_caps.buffer_frames, NULL); } else { - gst_structure_set (structure, "buffer-frames", G_TYPE_INT, 0, NULL); + gst_structure_set (structure, "buffer-frames", G_TYPE_INT, 0, NULL); } } } @@ -393,7 +393,7 @@ gst_audio_convert_link (GstPad * pad, const GstCaps * caps) /* woohoo, got it */ if (!gst_audio_convert_parse_caps (gst_pad_get_negotiated_caps (otherpad), - &other_ac_caps)) { + &other_ac_caps)) { g_critical ("internal negotiation error"); return GST_PAD_LINK_REFUSED; } @@ -446,15 +446,15 @@ gst_audio_convert_get_buffer (GstBuffer * buf, guint size) gst_buffer_ref (buf); buf->size = size; GST_LOG - ("returning same buffer with adjusted values. data: %p - size: %u - maxsize: %u", - buf->data, buf->size, buf->maxsize); + ("returning same buffer with adjusted values. data: %p - size: %u - maxsize: %u", + buf->data, buf->size, buf->maxsize); return buf; } else { ret = gst_buffer_new_and_alloc (size); g_assert (ret); gst_buffer_stamp (ret, buf); GST_LOG ("returning new buffer. data: %p - size: %u - maxsize: %u", - ret->data, ret->size, ret->maxsize); + ret->data, ret->size, ret->maxsize); return ret; } } @@ -496,48 +496,48 @@ gst_audio_convert_buffer_to_default_format (GstAudioConvert * this, if (this->sinkcaps.is_int) { if (this->sinkcaps.width == 32 && this->sinkcaps.depth == 32 && - this->sinkcaps.endianness == G_BYTE_ORDER - && this->sinkcaps.sign == TRUE) + this->sinkcaps.endianness == G_BYTE_ORDER + && this->sinkcaps.sign == TRUE) return buf; ret = - gst_audio_convert_get_buffer (buf, - buf->size * 32 / this->sinkcaps.width); + gst_audio_convert_get_buffer (buf, + buf->size * 32 / this->sinkcaps.width); count = ret->size / 4; src = buf->data + (count - 1) * (this->sinkcaps.width / 8); dest = (gint32 *) ret->data; for (i = count - 1; i >= 0; i--) { switch (this->sinkcaps.width) { - case 8: - if (this->sinkcaps.sign) { - CONVERT_TO (cur, src, gint8, this->sinkcaps.sign, - this->sinkcaps.endianness, GINT8_IDENTITY, GINT8_IDENTITY); - } else { - CONVERT_TO (cur, src, guint8, this->sinkcaps.sign, - this->sinkcaps.endianness, GUINT8_IDENTITY, GUINT8_IDENTITY); - } - break; - case 16: - if (this->sinkcaps.sign) { - CONVERT_TO (cur, src, gint16, this->sinkcaps.sign, - this->sinkcaps.endianness, GINT16_FROM_LE, GINT16_FROM_BE); - } else { - CONVERT_TO (cur, src, guint16, this->sinkcaps.sign, - this->sinkcaps.endianness, GUINT16_FROM_LE, GUINT16_FROM_BE); - } - break; - case 32: - if (this->sinkcaps.sign) { - CONVERT_TO (cur, src, gint32, this->sinkcaps.sign, - this->sinkcaps.endianness, GINT32_FROM_LE, GINT32_FROM_BE); - } else { - CONVERT_TO (cur, src, guint32, this->sinkcaps.sign, - this->sinkcaps.endianness, GUINT32_FROM_LE, GUINT32_FROM_BE); - } - break; - default: - g_assert_not_reached (); + case 8: + if (this->sinkcaps.sign) { + CONVERT_TO (cur, src, gint8, this->sinkcaps.sign, + this->sinkcaps.endianness, GINT8_IDENTITY, GINT8_IDENTITY); + } else { + CONVERT_TO (cur, src, guint8, this->sinkcaps.sign, + this->sinkcaps.endianness, GUINT8_IDENTITY, GUINT8_IDENTITY); + } + break; + case 16: + if (this->sinkcaps.sign) { + CONVERT_TO (cur, src, gint16, this->sinkcaps.sign, + this->sinkcaps.endianness, GINT16_FROM_LE, GINT16_FROM_BE); + } else { + CONVERT_TO (cur, src, guint16, this->sinkcaps.sign, + this->sinkcaps.endianness, GUINT16_FROM_LE, GUINT16_FROM_BE); + } + break; + case 32: + if (this->sinkcaps.sign) { + CONVERT_TO (cur, src, gint32, this->sinkcaps.sign, + this->sinkcaps.endianness, GINT32_FROM_LE, GINT32_FROM_BE); + } else { + CONVERT_TO (cur, src, guint32, this->sinkcaps.sign, + this->sinkcaps.endianness, GUINT32_FROM_LE, GUINT32_FROM_BE); + } + break; + default: + g_assert_not_reached (); } cur = cur * ((gint64) 1 << (32 - this->sinkcaps.depth)); cur = CLAMP (cur, -((gint64) 1 << 32), (gint64) 0x7FFFFFFF); @@ -608,10 +608,10 @@ gst_audio_convert_buffer_from_default_format (GstAudioConvert * this, if (this->srccaps.is_int) { guint8 *dest; - count = buf->size / 4; /* size is undefined after gst_audio_convert_get_buffer! */ + count = buf->size / 4; /* size is undefined after gst_audio_convert_get_buffer! */ ret = - gst_audio_convert_get_buffer (buf, - buf->size * this->srccaps.width / 32); + gst_audio_convert_get_buffer (buf, + buf->size * this->srccaps.width / 32); dest = ret->data; src = (gint32 *) buf->data; @@ -621,29 +621,29 @@ gst_audio_convert_buffer_from_default_format (GstAudioConvert * this, src++; switch (this->srccaps.width) { - case 8: - if (this->srccaps.sign) { - POPULATE (gint8, GINT8_IDENTITY, GINT8_IDENTITY); - } else { - POPULATE (guint8, GUINT8_IDENTITY, GUINT8_IDENTITY); - } - break; - case 16: - if (this->srccaps.sign) { - POPULATE (gint16, GINT16_TO_BE, GINT16_TO_LE); - } else { - POPULATE (guint16, GUINT16_TO_BE, GUINT16_TO_LE); - } - break; - case 32: - if (this->srccaps.sign) { - POPULATE (gint32, GINT32_TO_BE, GINT32_TO_LE); - } else { - POPULATE (guint32, GUINT32_TO_BE, GUINT32_TO_LE); - } - break; - default: - g_assert_not_reached (); + case 8: + if (this->srccaps.sign) { + POPULATE (gint8, GINT8_IDENTITY, GINT8_IDENTITY); + } else { + POPULATE (guint8, GUINT8_IDENTITY, GUINT8_IDENTITY); + } + break; + case 16: + if (this->srccaps.sign) { + POPULATE (gint16, GINT16_TO_BE, GINT16_TO_LE); + } else { + POPULATE (guint16, GUINT16_TO_BE, GUINT16_TO_LE); + } + break; + case 32: + if (this->srccaps.sign) { + POPULATE (gint32, GINT32_TO_BE, GINT32_TO_LE); + } else { + POPULATE (guint32, GUINT32_TO_BE, GUINT32_TO_LE); + } + break; + default: + g_assert_not_reached (); } } } else { @@ -651,10 +651,10 @@ gst_audio_convert_buffer_from_default_format (GstAudioConvert * this, /* 1 / (2^31-1) * i */ #define INT2FLOAT(i) (4.6566128752457969e-10 * ((gfloat)i)) - count = buf->size / 4; /* size is undefined after gst_audio_convert_get_buffer! */ + count = buf->size / 4; /* size is undefined after gst_audio_convert_get_buffer! */ ret = - gst_audio_convert_get_buffer (buf, - buf->size * this->srccaps.width / 32); + gst_audio_convert_get_buffer (buf, + buf->size * this->srccaps.width / 32); dest = (gfloat *) ret->data; src = (gint32 *) buf->data; @@ -708,7 +708,7 @@ static gboolean plugin_init (GstPlugin * plugin) { if (!gst_element_register (plugin, "audioconvert", GST_RANK_PRIMARY, - GST_TYPE_AUDIO_CONVERT)) + GST_TYPE_AUDIO_CONVERT)) return FALSE; return TRUE; diff --git a/gst/audioscale/gstaudioscale.c b/gst/audioscale/gstaudioscale.c index 382cb679ce..52f250ae05 100644 --- a/gst/audioscale/gstaudioscale.c +++ b/gst/audioscale/gstaudioscale.c @@ -77,9 +77,10 @@ gst_audioscale_method_get_type (void) {GST_RESAMPLE_SINC, "2", "Sinc"}, {0, NULL, NULL}, }; + if (!audioscale_method_type) { audioscale_method_type = g_enum_register_static ("GstAudioscaleMethod", - audioscale_methods); + audioscale_methods); } return audioscale_method_type; } @@ -116,9 +117,10 @@ audioscale_get_type (void) 0, (GInstanceInitFunc) gst_audioscale_init, }; + audioscale_type = - g_type_register_static (GST_TYPE_ELEMENT, "Audioscale", - &audioscale_info, 0); + g_type_register_static (GST_TYPE_ELEMENT, "Audioscale", + &audioscale_info, 0); } return audioscale_type; } @@ -150,12 +152,12 @@ gst_audioscale_class_init (AudioscaleClass * klass) g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_FILTERLEN, g_param_spec_int ("filter_length", "filter_length", "filter_length", - 0, G_MAXINT, 16, G_PARAM_READWRITE | G_PARAM_CONSTRUCT)); + 0, G_MAXINT, 16, G_PARAM_READWRITE | G_PARAM_CONSTRUCT)); g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_METHOD, g_param_spec_enum ("method", "method", "method", - GST_TYPE_AUDIOSCALE_METHOD, GST_RESAMPLE_SINC, - G_PARAM_READWRITE | G_PARAM_CONSTRUCT)); + GST_TYPE_AUDIOSCALE_METHOD, GST_RESAMPLE_SINC, + G_PARAM_READWRITE | G_PARAM_CONSTRUCT)); parent_class = g_type_class_ref (GST_TYPE_ELEMENT); } @@ -203,7 +205,7 @@ gst_audioscale_getcaps (GstPad * pad) } gst_structure_set (structure, "rate", GST_TYPE_INT_RANGE, rate_min, - rate_max, NULL); + rate_max, NULL); } return caps; @@ -247,8 +249,8 @@ gst_audioscale_link (GstPad * pad, const GstCaps * caps) GstCaps *trycaps = gst_caps_copy (caps); gst_caps_set_simple (trycaps, - "rate", G_TYPE_INT, - (int) ((pad == audioscale->srcpad) ? r->i_rate : r->o_rate), NULL); + "rate", G_TYPE_INT, + (int) ((pad == audioscale->srcpad) ? r->i_rate : r->o_rate), NULL); link_ret = gst_pad_try_set_caps (otherpad, trycaps); if (GST_PAD_LINK_FAILED (link_ret)) { return link_ret; @@ -368,7 +370,7 @@ gst_audioscale_set_property (GObject * object, guint prop_id, case ARG_FILTERLEN: r->filter_length = g_value_get_int (value); GST_DEBUG_OBJECT (GST_ELEMENT (src), "new filter length %d\n", - r->filter_length); + r->filter_length); break; case ARG_METHOD: r->method = g_value_get_enum (value); @@ -413,7 +415,7 @@ plugin_init (GstPlugin * plugin) return FALSE; if (!gst_element_register (plugin, "audioscale", GST_RANK_NONE, - GST_TYPE_AUDIOSCALE)) { + GST_TYPE_AUDIOSCALE)) { return FALSE; } diff --git a/gst/ffmpegcolorspace/gstffmpegcodecmap.c b/gst/ffmpegcolorspace/gstffmpegcodecmap.c index 9eb886aa92..3f1cf9901c 100644 --- a/gst/ffmpegcolorspace/gstffmpegcodecmap.c +++ b/gst/ffmpegcolorspace/gstffmpegcodecmap.c @@ -126,15 +126,15 @@ gst_ffmpeg_pixfmt_to_caps (enum PixelFormat pix_fmt) if (bpp != 0) { caps = GST_FF_VID_CAPS_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); } else if (fmt) { caps = GST_FF_VID_CAPS_NEW ("video/x-raw-yuv", - "format", GST_TYPE_FOURCC, fmt, NULL); + "format", GST_TYPE_FOURCC, fmt, NULL); } if (caps != NULL) { @@ -198,61 +198,61 @@ gst_ffmpeg_caps_to_pix_fmt (const GstCaps * caps, if (gst_structure_get_fourcc (structure, "format", &fourcc)) { switch (fourcc) { - case GST_MAKE_FOURCC ('Y', 'U', 'Y', '2'): - pix_fmt = PIX_FMT_YUV422; - break; - case GST_MAKE_FOURCC ('I', '4', '2', '0'): - pix_fmt = PIX_FMT_YUV420P; - break; - case GST_MAKE_FOURCC ('Y', '4', '1', 'B'): - pix_fmt = PIX_FMT_YUV411P; - break; - case GST_MAKE_FOURCC ('Y', '4', '2', 'B'): - pix_fmt = PIX_FMT_YUV422P; - break; - case GST_MAKE_FOURCC ('Y', 'U', 'V', '9'): - pix_fmt = PIX_FMT_YUV410P; - break; + case GST_MAKE_FOURCC ('Y', 'U', 'Y', '2'): + pix_fmt = PIX_FMT_YUV422; + break; + case GST_MAKE_FOURCC ('I', '4', '2', '0'): + pix_fmt = PIX_FMT_YUV420P; + break; + case GST_MAKE_FOURCC ('Y', '4', '1', 'B'): + pix_fmt = PIX_FMT_YUV411P; + break; + case GST_MAKE_FOURCC ('Y', '4', '2', 'B'): + pix_fmt = PIX_FMT_YUV422P; + break; + case GST_MAKE_FOURCC ('Y', 'U', 'V', '9'): + pix_fmt = PIX_FMT_YUV410P; + break; #if 0 - case FIXME: - pix_fmt = PIX_FMT_YUV444P; - break; + case FIXME: + pix_fmt = PIX_FMT_YUV444P; + break; #endif } } } else if (strcmp (gst_structure_get_name (structure), - "video/x-raw-rgb") == 0) { + "video/x-raw-rgb") == 0) { gint bpp = 0, rmask = 0, endianness = 0; if (gst_structure_get_int (structure, "bpp", &bpp) && - gst_structure_get_int (structure, "endianness", &endianness) && - gst_structure_get_int (structure, "red_mask", &rmask)) { + gst_structure_get_int (structure, "endianness", &endianness) && + gst_structure_get_int (structure, "red_mask", &rmask)) { switch (bpp) { - case 32: + case 32: #if (G_BYTE_ORDER == G_BIG_ENDIAN) - if (rmask == 0x00ff0000) + if (rmask == 0x00ff0000) #else - if (rmask == 0x0000ff00) + if (rmask == 0x0000ff00) #endif - pix_fmt = PIX_FMT_RGBA32; - break; - case 24: - if (rmask == 0x0000FF) - pix_fmt = PIX_FMT_BGR24; - else - pix_fmt = PIX_FMT_RGB24; - break; - case 16: - if (endianness == G_BYTE_ORDER) - pix_fmt = PIX_FMT_RGB565; - break; - case 15: - if (endianness == G_BYTE_ORDER) - pix_fmt = PIX_FMT_RGB555; - break; - default: - /* nothing */ - break; + pix_fmt = PIX_FMT_RGBA32; + break; + case 24: + if (rmask == 0x0000FF) + pix_fmt = PIX_FMT_BGR24; + else + pix_fmt = PIX_FMT_RGB24; + break; + case 16: + if (endianness == G_BYTE_ORDER) + pix_fmt = PIX_FMT_RGB565; + break; + case 15: + if (endianness == G_BYTE_ORDER) + pix_fmt = PIX_FMT_RGB555; + break; + default: + /* nothing */ + break; } } } diff --git a/gst/ffmpegcolorspace/gstffmpegcolorspace.c b/gst/ffmpegcolorspace/gstffmpegcolorspace.c index 6ddd8d8001..738ee4b913 100644 --- a/gst/ffmpegcolorspace/gstffmpegcolorspace.c +++ b/gst/ffmpegcolorspace/gstffmpegcolorspace.c @@ -199,9 +199,9 @@ gst_ffmpegcolorspace_pad_link (GstPad * pad, const GstCaps * caps) GstCaps *caps = gst_caps_copy (othercaps); gst_caps_set_simple (caps, - "width", G_TYPE_INT, width, - "height", G_TYPE_INT, height, - "framerate", G_TYPE_DOUBLE, framerate, NULL); + "width", G_TYPE_INT, width, + "height", G_TYPE_INT, height, + "framerate", G_TYPE_DOUBLE, framerate, NULL); ret = gst_pad_try_set_caps (otherpad, caps); if (GST_PAD_LINK_FAILED (ret)) { return ret; @@ -239,7 +239,7 @@ gst_ffmpegcolorspace_get_type (void) }; ffmpegcolorspace_type = g_type_register_static (GST_TYPE_ELEMENT, - "GstFFMpegColorspace", &ffmpegcolorspace_info, 0); + "GstFFMpegColorspace", &ffmpegcolorspace_info, 0); } return ffmpegcolorspace_type; @@ -316,19 +316,19 @@ gst_ffmpegcolorspace_chain (GstPad * pad, GstData * data) } else { /* use bufferpool here */ guint size = avpicture_get_size (space->to_pixfmt, - space->width, - space->height); + space->width, + space->height); outbuf = gst_pad_alloc_buffer (space->srcpad, GST_BUFFER_OFFSET_NONE, size); /* convert */ avpicture_fill ((AVPicture *) & space->from_frame, GST_BUFFER_DATA (inbuf), - space->from_pixfmt, space->width, space->height); + space->from_pixfmt, space->width, space->height); avpicture_fill ((AVPicture *) & space->to_frame, GST_BUFFER_DATA (outbuf), - space->to_pixfmt, space->width, space->height); + space->to_pixfmt, space->width, space->height); img_convert ((AVPicture *) & space->to_frame, space->to_pixfmt, - (AVPicture *) & space->from_frame, space->from_pixfmt, - space->width, space->height); + (AVPicture *) & space->from_frame, space->from_pixfmt, + space->width, space->height); GST_BUFFER_TIMESTAMP (outbuf) = GST_BUFFER_TIMESTAMP (inbuf); GST_BUFFER_DURATION (outbuf) = GST_BUFFER_DURATION (inbuf); diff --git a/gst/ffmpegcolorspace/imgconvert.c b/gst/ffmpegcolorspace/imgconvert.c index a85e0f0a27..13248f3e78 100644 --- a/gst/ffmpegcolorspace/imgconvert.c +++ b/gst/ffmpegcolorspace/imgconvert.c @@ -45,25 +45,25 @@ #define xglue(x, y) x ## y #define glue(x, y) xglue(x, y) -#define FF_COLOR_RGB 0 /* RGB color space */ -#define FF_COLOR_GRAY 1 /* gray color space */ -#define FF_COLOR_YUV 2 /* YUV color space. 16 <= Y <= 235, 16 <= U, V <= 240 */ -#define FF_COLOR_YUV_JPEG 3 /* YUV color space. 0 <= Y <= 255, 0 <= U, V <= 255 */ +#define FF_COLOR_RGB 0 /* RGB color space */ +#define FF_COLOR_GRAY 1 /* gray color space */ +#define FF_COLOR_YUV 2 /* YUV color space. 16 <= Y <= 235, 16 <= U, V <= 240 */ +#define FF_COLOR_YUV_JPEG 3 /* YUV color space. 0 <= Y <= 255, 0 <= U, V <= 255 */ -#define FF_PIXEL_PLANAR 0 /* each channel has one component in AVPicture */ -#define FF_PIXEL_PACKED 1 /* only one components containing all the channels */ -#define FF_PIXEL_PALETTE 2 /* one components containing indexes for a palette */ +#define FF_PIXEL_PLANAR 0 /* each channel has one component in AVPicture */ +#define FF_PIXEL_PACKED 1 /* only one components containing all the channels */ +#define FF_PIXEL_PALETTE 2 /* one components containing indexes for a palette */ typedef struct PixFmtInfo { const char *name; - uint8_t nb_channels; /* number of channels (including alpha) */ - uint8_t color_type; /* color type (see FF_COLOR_xxx constants) */ - uint8_t pixel_type; /* pixel storage type (see FF_PIXEL_xxx constants) */ - uint8_t is_alpha:1; /* true if alpha can be specified */ - uint8_t x_chroma_shift; /* X chroma subsampling factor is 2 ^ shift */ - uint8_t y_chroma_shift; /* Y chroma subsampling factor is 2 ^ shift */ - uint8_t depth; /* bit depth of the color components */ + uint8_t nb_channels; /* number of channels (including alpha) */ + uint8_t color_type; /* color type (see FF_COLOR_xxx constants) */ + uint8_t pixel_type; /* pixel storage type (see FF_PIXEL_xxx constants) */ + uint8_t is_alpha:1; /* true if alpha can be specified */ + uint8_t x_chroma_shift; /* X chroma subsampling factor is 2 ^ shift */ + uint8_t y_chroma_shift; /* Y chroma subsampling factor is 2 ^ shift */ + uint8_t depth; /* bit depth of the color components */ } PixFmtInfo; @@ -71,152 +71,152 @@ PixFmtInfo; static PixFmtInfo pix_fmt_info[PIX_FMT_NB] = { /* YUV formats */ [PIX_FMT_YUV420P] = { - .name = "yuv420p", - .nb_channels = 3, - .color_type = FF_COLOR_YUV, - .pixel_type = FF_PIXEL_PLANAR, - .depth = 8, - .x_chroma_shift = 1,.y_chroma_shift = 1, + .name = "yuv420p", + .nb_channels = 3, + .color_type = FF_COLOR_YUV, + .pixel_type = FF_PIXEL_PLANAR, + .depth = 8, + .x_chroma_shift = 1,.y_chroma_shift = 1, }, [PIX_FMT_YUV422P] = { - .name = "yuv422p", - .nb_channels = 3, - .color_type = FF_COLOR_YUV, - .pixel_type = FF_PIXEL_PLANAR, - .depth = 8, - .x_chroma_shift = 1,.y_chroma_shift = 0, + .name = "yuv422p", + .nb_channels = 3, + .color_type = FF_COLOR_YUV, + .pixel_type = FF_PIXEL_PLANAR, + .depth = 8, + .x_chroma_shift = 1,.y_chroma_shift = 0, }, [PIX_FMT_YUV444P] = { - .name = "yuv444p", - .nb_channels = 3, - .color_type = FF_COLOR_YUV, - .pixel_type = FF_PIXEL_PLANAR, - .depth = 8, - .x_chroma_shift = 0,.y_chroma_shift = 0, + .name = "yuv444p", + .nb_channels = 3, + .color_type = FF_COLOR_YUV, + .pixel_type = FF_PIXEL_PLANAR, + .depth = 8, + .x_chroma_shift = 0,.y_chroma_shift = 0, }, [PIX_FMT_YUV422] = { - .name = "yuv422", - .nb_channels = 1, - .color_type = FF_COLOR_YUV, - .pixel_type = FF_PIXEL_PACKED, - .depth = 8, - .x_chroma_shift = 1,.y_chroma_shift = 0, + .name = "yuv422", + .nb_channels = 1, + .color_type = FF_COLOR_YUV, + .pixel_type = FF_PIXEL_PACKED, + .depth = 8, + .x_chroma_shift = 1,.y_chroma_shift = 0, }, [PIX_FMT_YUV410P] = { - .name = "yuv410p", - .nb_channels = 3, - .color_type = FF_COLOR_YUV, - .pixel_type = FF_PIXEL_PLANAR, - .depth = 8, - .x_chroma_shift = 2,.y_chroma_shift = 2, + .name = "yuv410p", + .nb_channels = 3, + .color_type = FF_COLOR_YUV, + .pixel_type = FF_PIXEL_PLANAR, + .depth = 8, + .x_chroma_shift = 2,.y_chroma_shift = 2, }, [PIX_FMT_YUV411P] = { - .name = "yuv411p", - .nb_channels = 3, - .color_type = FF_COLOR_YUV, - .pixel_type = FF_PIXEL_PLANAR, - .depth = 8, - .x_chroma_shift = 2,.y_chroma_shift = 0, + .name = "yuv411p", + .nb_channels = 3, + .color_type = FF_COLOR_YUV, + .pixel_type = FF_PIXEL_PLANAR, + .depth = 8, + .x_chroma_shift = 2,.y_chroma_shift = 0, }, /* JPEG YUV */ [PIX_FMT_YUVJ420P] = { - .name = "yuvj420p", - .nb_channels = 3, - .color_type = FF_COLOR_YUV_JPEG, - .pixel_type = FF_PIXEL_PLANAR, - .depth = 8, - .x_chroma_shift = 1,.y_chroma_shift = 1, + .name = "yuvj420p", + .nb_channels = 3, + .color_type = FF_COLOR_YUV_JPEG, + .pixel_type = FF_PIXEL_PLANAR, + .depth = 8, + .x_chroma_shift = 1,.y_chroma_shift = 1, }, [PIX_FMT_YUVJ422P] = { - .name = "yuvj422p", - .nb_channels = 3, - .color_type = FF_COLOR_YUV_JPEG, - .pixel_type = FF_PIXEL_PLANAR, - .depth = 8, - .x_chroma_shift = 1,.y_chroma_shift = 0, + .name = "yuvj422p", + .nb_channels = 3, + .color_type = FF_COLOR_YUV_JPEG, + .pixel_type = FF_PIXEL_PLANAR, + .depth = 8, + .x_chroma_shift = 1,.y_chroma_shift = 0, }, [PIX_FMT_YUVJ444P] = { - .name = "yuvj444p", - .nb_channels = 3, - .color_type = FF_COLOR_YUV_JPEG, - .pixel_type = FF_PIXEL_PLANAR, - .depth = 8, - .x_chroma_shift = 0,.y_chroma_shift = 0, + .name = "yuvj444p", + .nb_channels = 3, + .color_type = FF_COLOR_YUV_JPEG, + .pixel_type = FF_PIXEL_PLANAR, + .depth = 8, + .x_chroma_shift = 0,.y_chroma_shift = 0, }, /* RGB formats */ [PIX_FMT_RGB24] = { - .name = "rgb24", - .nb_channels = 3, - .color_type = FF_COLOR_RGB, - .pixel_type = FF_PIXEL_PACKED, - .depth = 8, - .x_chroma_shift = 0,.y_chroma_shift = 0, + .name = "rgb24", + .nb_channels = 3, + .color_type = FF_COLOR_RGB, + .pixel_type = FF_PIXEL_PACKED, + .depth = 8, + .x_chroma_shift = 0,.y_chroma_shift = 0, }, [PIX_FMT_BGR24] = { - .name = "bgr24", - .nb_channels = 3, - .color_type = FF_COLOR_RGB, - .pixel_type = FF_PIXEL_PACKED, - .depth = 8, - .x_chroma_shift = 0,.y_chroma_shift = 0, + .name = "bgr24", + .nb_channels = 3, + .color_type = FF_COLOR_RGB, + .pixel_type = FF_PIXEL_PACKED, + .depth = 8, + .x_chroma_shift = 0,.y_chroma_shift = 0, }, [PIX_FMT_RGBA32] = { - .name = "rgba32", - .nb_channels = 4,.is_alpha = 1, - .color_type = FF_COLOR_RGB, - .pixel_type = FF_PIXEL_PACKED, - .depth = 8, - .x_chroma_shift = 0,.y_chroma_shift = 0, + .name = "rgba32", + .nb_channels = 4,.is_alpha = 1, + .color_type = FF_COLOR_RGB, + .pixel_type = FF_PIXEL_PACKED, + .depth = 8, + .x_chroma_shift = 0,.y_chroma_shift = 0, }, [PIX_FMT_RGB565] = { - .name = "rgb565", - .nb_channels = 3, - .color_type = FF_COLOR_RGB, - .pixel_type = FF_PIXEL_PACKED, - .depth = 5, - .x_chroma_shift = 0,.y_chroma_shift = 0, + .name = "rgb565", + .nb_channels = 3, + .color_type = FF_COLOR_RGB, + .pixel_type = FF_PIXEL_PACKED, + .depth = 5, + .x_chroma_shift = 0,.y_chroma_shift = 0, }, [PIX_FMT_RGB555] = { - .name = "rgb555", - .nb_channels = 4,.is_alpha = 1, - .color_type = FF_COLOR_RGB, - .pixel_type = FF_PIXEL_PACKED, - .depth = 5, - .x_chroma_shift = 0,.y_chroma_shift = 0, + .name = "rgb555", + .nb_channels = 4,.is_alpha = 1, + .color_type = FF_COLOR_RGB, + .pixel_type = FF_PIXEL_PACKED, + .depth = 5, + .x_chroma_shift = 0,.y_chroma_shift = 0, }, /* gray / mono formats */ [PIX_FMT_GRAY8] = { - .name = "gray", - .nb_channels = 1, - .color_type = FF_COLOR_GRAY, - .pixel_type = FF_PIXEL_PLANAR, - .depth = 8, + .name = "gray", + .nb_channels = 1, + .color_type = FF_COLOR_GRAY, + .pixel_type = FF_PIXEL_PLANAR, + .depth = 8, }, [PIX_FMT_MONOWHITE] = { - .name = "monow", - .nb_channels = 1, - .color_type = FF_COLOR_GRAY, - .pixel_type = FF_PIXEL_PLANAR, - .depth = 1, + .name = "monow", + .nb_channels = 1, + .color_type = FF_COLOR_GRAY, + .pixel_type = FF_PIXEL_PLANAR, + .depth = 1, }, [PIX_FMT_MONOBLACK] = { - .name = "monob", - .nb_channels = 1, - .color_type = FF_COLOR_GRAY, - .pixel_type = FF_PIXEL_PLANAR, - .depth = 1, + .name = "monob", + .nb_channels = 1, + .color_type = FF_COLOR_GRAY, + .pixel_type = FF_PIXEL_PLANAR, + .depth = 1, }, /* paletted formats */ [PIX_FMT_PAL8] = { - .name = "pal8", - .nb_channels = 4,.is_alpha = 1, - .color_type = FF_COLOR_RGB, - .pixel_type = FF_PIXEL_PALETTE, - .depth = 8, + .name = "pal8", + .nb_channels = 4,.is_alpha = 1, + .color_type = FF_COLOR_RGB, + .pixel_type = FF_PIXEL_PALETTE, + .depth = 8, }, }; @@ -313,7 +313,7 @@ avpicture_fill (AVPicture * picture, uint8_t * ptr, case PIX_FMT_PAL8: size2 = (size + 3) & ~3; picture->data[0] = ptr; - picture->data[1] = ptr + size2; /* palette is stored here as 256 32 bit words */ + picture->data[1] = ptr + size2; /* palette is stored here as 256 32 bit words */ picture->data[2] = NULL; picture->linesize[0] = width; picture->linesize[1] = 4; @@ -341,7 +341,7 @@ avpicture_layout (const AVPicture * src, int pix_fmt, int width, int height, if (pf->pixel_type == FF_PIXEL_PACKED || pf->pixel_type == FF_PIXEL_PALETTE) { if (pix_fmt == PIX_FMT_YUV422 || pix_fmt == PIX_FMT_RGB565 || - pix_fmt == PIX_FMT_RGB555) + pix_fmt == PIX_FMT_RGB555) w = width * 2; else if (pix_fmt == PIX_FMT_PAL8) w = width; @@ -371,7 +371,7 @@ avpicture_layout (const AVPicture * src, int pix_fmt, int width, int height, if (pf->pixel_type == FF_PIXEL_PALETTE) memcpy ((unsigned char *) (((size_t) dest + 3) & ~3), src->data[1], - 256 * 4); + 256 * 4); return size; } @@ -408,25 +408,25 @@ avcodec_get_pix_fmt_loss (int dst_pix_fmt, int src_pix_fmt, int has_alpha) switch (pf->color_type) { case FF_COLOR_RGB: if (ps->color_type != FF_COLOR_RGB && ps->color_type != FF_COLOR_GRAY) - loss |= FF_LOSS_COLORSPACE; + loss |= FF_LOSS_COLORSPACE; break; case FF_COLOR_GRAY: if (ps->color_type != FF_COLOR_GRAY) - loss |= FF_LOSS_COLORSPACE; + loss |= FF_LOSS_COLORSPACE; break; case FF_COLOR_YUV: if (ps->color_type != FF_COLOR_YUV) - loss |= FF_LOSS_COLORSPACE; + loss |= FF_LOSS_COLORSPACE; break; case FF_COLOR_YUV_JPEG: if (ps->color_type != FF_COLOR_YUV_JPEG && - ps->color_type != FF_COLOR_YUV && ps->color_type != FF_COLOR_GRAY) - loss |= FF_LOSS_COLORSPACE; + ps->color_type != FF_COLOR_YUV && ps->color_type != FF_COLOR_GRAY) + loss |= FF_LOSS_COLORSPACE; break; default: /* fail safe test */ if (ps->color_type != pf->color_type) - loss |= FF_LOSS_COLORSPACE; + loss |= FF_LOSS_COLORSPACE; break; } if (pf->color_type == FF_COLOR_GRAY && ps->color_type != FF_COLOR_GRAY) @@ -449,22 +449,22 @@ avg_bits_per_pixel (int pix_fmt) switch (pf->pixel_type) { case FF_PIXEL_PACKED: switch (pix_fmt) { - case PIX_FMT_YUV422: - case PIX_FMT_RGB565: - case PIX_FMT_RGB555: - bits = 16; - break; - default: - bits = pf->depth * pf->nb_channels; - break; + case PIX_FMT_YUV422: + case PIX_FMT_RGB565: + case PIX_FMT_RGB555: + bits = 16; + break; + default: + bits = pf->depth * pf->nb_channels; + break; } break; case FF_PIXEL_PLANAR: if (pf->x_chroma_shift == 0 && pf->y_chroma_shift == 0) { - bits = pf->depth * pf->nb_channels; + bits = pf->depth * pf->nb_channels; } else { - bits = pf->depth + ((2 * pf->depth) >> - (pf->x_chroma_shift + pf->y_chroma_shift)); + bits = pf->depth + ((2 * pf->depth) >> + (pf->x_chroma_shift + pf->y_chroma_shift)); } break; case FF_PIXEL_PALETTE: @@ -490,11 +490,11 @@ avcodec_find_best_pix_fmt1 (int pix_fmt_mask, if (pix_fmt_mask & (1 << i)) { loss = avcodec_get_pix_fmt_loss (i, src_pix_fmt, has_alpha) & loss_mask; if (loss == 0) { - dist = avg_bits_per_pixel (i); - if (dist < min_dist) { - min_dist = dist; - dst_pix_fmt = i; - } + dist = avg_bits_per_pixel (i); + if (dist < min_dist) { + min_dist = dist; + dst_pix_fmt = i; + } } } } @@ -510,7 +510,7 @@ avcodec_find_best_pix_fmt (int pix_fmt_mask, int src_pix_fmt, { int dst_pix_fmt, loss_mask, i; static const int loss_mask_order[] = { - ~0, /* no loss first */ + ~0, /* no loss first */ ~FF_LOSS_ALPHA, ~FF_LOSS_RESOLUTION, ~(FF_LOSS_COLORSPACE | FF_LOSS_RESOLUTION), @@ -524,7 +524,7 @@ avcodec_find_best_pix_fmt (int pix_fmt_mask, int src_pix_fmt, for (;;) { loss_mask = loss_mask_order[i++]; dst_pix_fmt = avcodec_find_best_pix_fmt1 (pix_fmt_mask, src_pix_fmt, - has_alpha, loss_mask); + has_alpha, loss_mask); if (dst_pix_fmt >= 0) goto found; if (loss_mask == 0) @@ -562,40 +562,40 @@ img_copy (AVPicture * dst, const AVPicture * src, switch (pf->pixel_type) { case FF_PIXEL_PACKED: switch (pix_fmt) { - case PIX_FMT_YUV422: - case PIX_FMT_RGB565: - case PIX_FMT_RGB555: - bits = 16; - break; - default: - bits = pf->depth * pf->nb_channels; - break; + case PIX_FMT_YUV422: + case PIX_FMT_RGB565: + case PIX_FMT_RGB555: + bits = 16; + break; + default: + bits = pf->depth * pf->nb_channels; + break; } bwidth = (width * bits + 7) >> 3; img_copy_plane (dst->data[0], dst->linesize[0], - src->data[0], src->linesize[0], bwidth, height); + src->data[0], src->linesize[0], bwidth, height); break; case FF_PIXEL_PLANAR: for (i = 0; i < pf->nb_channels; i++) { - int w, h; - - w = width; - h = height; - if (i == 1 || i == 2) { - w >>= pf->x_chroma_shift; - h >>= pf->y_chroma_shift; - } - bwidth = (w * pf->depth + 7) >> 3; - img_copy_plane (dst->data[i], dst->linesize[i], - src->data[i], src->linesize[i], bwidth, h); + int w, h; + + w = width; + h = height; + if (i == 1 || i == 2) { + w >>= pf->x_chroma_shift; + h >>= pf->y_chroma_shift; + } + bwidth = (w * pf->depth + 7) >> 3; + img_copy_plane (dst->data[i], dst->linesize[i], + src->data[i], src->linesize[i], bwidth, h); } break; case FF_PIXEL_PALETTE: img_copy_plane (dst->data[0], dst->linesize[0], - src->data[0], src->linesize[0], width, height); + src->data[0], src->linesize[0], width, height); /* copy the palette */ img_copy_plane (dst->data[1], dst->linesize[1], - src->data[1], src->linesize[1], 4, 256); + src->data[1], src->linesize[1], 4, 256); break; } } @@ -643,13 +643,13 @@ yuv422_to_yuv420p (AVPicture * dst, const AVPicture * src, p = p1; lum = lum1; for (w = width; w >= 2; w -= 2) { - lum[0] = p[0]; - lum[1] = p[2]; - p += 4; - lum += 2; + lum[0] = p[0]; + lum[1] = p[2]; + p += 4; + lum += 2; } if (w) { - lum[0] = p[0]; + lum[0] = p[0]; } p1 += src->linesize[0]; lum1 += dst->linesize[0]; @@ -780,7 +780,7 @@ static inline int C_JPEG_TO_CCIR (int y) { y = (((y - 128) * FIX (112.0 / 127.0) + (ONE_HALF + - (128 << SCALEBITS))) >> SCALEBITS); + (128 << SCALEBITS))) >> SCALEBITS); if (y < 16) y = 16; return y; @@ -997,9 +997,9 @@ shrink44 (uint8_t * dst, int dst_wrap, d = dst; for (w = width; w > 0; w--) { d[0] = (s1[0] + s1[1] + s1[2] + s1[3] + - s2[0] + s2[1] + s2[2] + s2[3] + - s3[0] + s3[1] + s3[2] + s3[3] + - s4[0] + s4[1] + s4[2] + s4[3] + 8) >> 4; + s2[0] + s2[1] + s2[2] + s2[3] + + s3[0] + s3[1] + s3[2] + s3[3] + + s4[0] + s4[1] + s4[2] + s4[3] + 8) >> 4; s1 += 4; s2 += 4; s3 += 4; @@ -1159,8 +1159,8 @@ build_rgb_palette (uint8_t * palette, int has_alpha) for (r = 0; r < 6; r++) { for (g = 0; g < 6; g++) { for (b = 0; b < 6; b++) { - pal[i++] = (0xff << 24) | (pal_value[r] << 16) | - (pal_value[g] << 8) | pal_value[b]; + pal[i++] = (0xff << 24) | (pal_value[r] << 16) | + (pal_value[g] << 8) | pal_value[b]; } } } @@ -1344,9 +1344,9 @@ mono_to_gray (AVPicture * dst, const AVPicture * src, if (w > 0) { v = *p++ ^ xor_mask; do { - q[0] = -((v >> 7) & 1); - q++; - v <<= 1; + q[0] = -((v >> 7) & 1); + q++; + v <<= 1; } while (--w); } p += src_wrap; @@ -1388,9 +1388,9 @@ gray_to_mono (AVPicture * dst, const AVPicture * src, while (n >= 8) { v = 0; for (j = 0; j < 8; j++) { - b = s[0]; - s++; - v = (v << 1) | (b >> 7); + b = s[0]; + s++; + v = (v << 1) | (b >> 7); } d[0] = v ^ xor_mask; d++; @@ -1400,10 +1400,10 @@ gray_to_mono (AVPicture * dst, const AVPicture * src, n1 = n; v = 0; while (n > 0) { - b = s[0]; - s++; - v = (v << 1) | (b >> 7); - n--; + b = s[0]; + s++; + v = (v << 1) | (b >> 7); + n--; } d[0] = (v << (8 - (n1 & 7))) ^ xor_mask; d++; @@ -1453,146 +1453,146 @@ ConvertEntry; */ static ConvertEntry convert_table[PIX_FMT_NB][PIX_FMT_NB] = { [PIX_FMT_YUV420P] = { - [PIX_FMT_RGB555] = { - .convert = yuv420p_to_rgb555}, - [PIX_FMT_RGB565] = { - .convert = yuv420p_to_rgb565}, - [PIX_FMT_BGR24] = { - .convert = yuv420p_to_bgr24}, - [PIX_FMT_RGB24] = { - .convert = yuv420p_to_rgb24}, - [PIX_FMT_RGBA32] = { - .convert = yuv420p_to_rgba32}, + [PIX_FMT_RGB555] = { + .convert = yuv420p_to_rgb555}, + [PIX_FMT_RGB565] = { + .convert = yuv420p_to_rgb565}, + [PIX_FMT_BGR24] = { + .convert = yuv420p_to_bgr24}, + [PIX_FMT_RGB24] = { + .convert = yuv420p_to_rgb24}, + [PIX_FMT_RGBA32] = { + .convert = yuv420p_to_rgba32}, }, [PIX_FMT_YUV422P] = { - [PIX_FMT_YUV422] = { - .convert = yuv422p_to_yuv422, - }, + [PIX_FMT_YUV422] = { + .convert = yuv422p_to_yuv422, + }, }, [PIX_FMT_YUV444P] = { - [PIX_FMT_RGB24] = { - .convert = yuv444p_to_rgb24}, + [PIX_FMT_RGB24] = { + .convert = yuv444p_to_rgb24}, }, [PIX_FMT_YUVJ420P] = { - [PIX_FMT_RGB555] = { - .convert = yuvj420p_to_rgb555}, - [PIX_FMT_RGB565] = { - .convert = yuvj420p_to_rgb565}, - [PIX_FMT_BGR24] = { - .convert = yuvj420p_to_bgr24}, - [PIX_FMT_RGB24] = { - .convert = yuvj420p_to_rgb24}, - [PIX_FMT_RGBA32] = { - .convert = yuvj420p_to_rgba32}, + [PIX_FMT_RGB555] = { + .convert = yuvj420p_to_rgb555}, + [PIX_FMT_RGB565] = { + .convert = yuvj420p_to_rgb565}, + [PIX_FMT_BGR24] = { + .convert = yuvj420p_to_bgr24}, + [PIX_FMT_RGB24] = { + .convert = yuvj420p_to_rgb24}, + [PIX_FMT_RGBA32] = { + .convert = yuvj420p_to_rgba32}, }, [PIX_FMT_YUVJ444P] = { - [PIX_FMT_RGB24] = { - .convert = yuvj444p_to_rgb24}, + [PIX_FMT_RGB24] = { + .convert = yuvj444p_to_rgb24}, }, [PIX_FMT_YUV422] = { - [PIX_FMT_YUV420P] = { - .convert = yuv422_to_yuv420p, - }, - [PIX_FMT_YUV422P] = { - .convert = yuv422_to_yuv422p, - }, + [PIX_FMT_YUV420P] = { + .convert = yuv422_to_yuv420p, + }, + [PIX_FMT_YUV422P] = { + .convert = yuv422_to_yuv422p, + }, }, [PIX_FMT_RGB24] = { - [PIX_FMT_YUV420P] = { - .convert = rgb24_to_yuv420p}, - [PIX_FMT_RGB565] = { - .convert = rgb24_to_rgb565}, - [PIX_FMT_RGB555] = { - .convert = rgb24_to_rgb555}, - [PIX_FMT_RGBA32] = { - .convert = rgb24_to_rgba32}, - [PIX_FMT_BGR24] = { - .convert = rgb24_to_bgr24}, - [PIX_FMT_GRAY8] = { - .convert = rgb24_to_gray}, - [PIX_FMT_PAL8] = { - .convert = rgb24_to_pal8}, - [PIX_FMT_YUV444P] = { - .convert = rgb24_to_yuv444p}, - [PIX_FMT_YUVJ420P] = { - .convert = rgb24_to_yuvj420p}, - [PIX_FMT_YUVJ444P] = { - .convert = rgb24_to_yuvj444p}, + [PIX_FMT_YUV420P] = { + .convert = rgb24_to_yuv420p}, + [PIX_FMT_RGB565] = { + .convert = rgb24_to_rgb565}, + [PIX_FMT_RGB555] = { + .convert = rgb24_to_rgb555}, + [PIX_FMT_RGBA32] = { + .convert = rgb24_to_rgba32}, + [PIX_FMT_BGR24] = { + .convert = rgb24_to_bgr24}, + [PIX_FMT_GRAY8] = { + .convert = rgb24_to_gray}, + [PIX_FMT_PAL8] = { + .convert = rgb24_to_pal8}, + [PIX_FMT_YUV444P] = { + .convert = rgb24_to_yuv444p}, + [PIX_FMT_YUVJ420P] = { + .convert = rgb24_to_yuvj420p}, + [PIX_FMT_YUVJ444P] = { + .convert = rgb24_to_yuvj444p}, }, [PIX_FMT_RGBA32] = { - [PIX_FMT_RGB24] = { - .convert = rgba32_to_rgb24}, - [PIX_FMT_RGB555] = { - .convert = rgba32_to_rgb555}, - [PIX_FMT_PAL8] = { - .convert = rgba32_to_pal8}, - [PIX_FMT_YUV420P] = { - .convert = rgba32_to_yuv420p}, - [PIX_FMT_GRAY8] = { - .convert = rgba32_to_gray}, + [PIX_FMT_RGB24] = { + .convert = rgba32_to_rgb24}, + [PIX_FMT_RGB555] = { + .convert = rgba32_to_rgb555}, + [PIX_FMT_PAL8] = { + .convert = rgba32_to_pal8}, + [PIX_FMT_YUV420P] = { + .convert = rgba32_to_yuv420p}, + [PIX_FMT_GRAY8] = { + .convert = rgba32_to_gray}, }, [PIX_FMT_BGR24] = { - [PIX_FMT_RGB24] = { - .convert = bgr24_to_rgb24}, - [PIX_FMT_YUV420P] = { - .convert = bgr24_to_yuv420p}, - [PIX_FMT_GRAY8] = { - .convert = bgr24_to_gray}, + [PIX_FMT_RGB24] = { + .convert = bgr24_to_rgb24}, + [PIX_FMT_YUV420P] = { + .convert = bgr24_to_yuv420p}, + [PIX_FMT_GRAY8] = { + .convert = bgr24_to_gray}, }, [PIX_FMT_RGB555] = { - [PIX_FMT_RGB24] = { - .convert = rgb555_to_rgb24}, - [PIX_FMT_RGBA32] = { - .convert = rgb555_to_rgba32}, - [PIX_FMT_YUV420P] = { - .convert = rgb555_to_yuv420p}, - [PIX_FMT_GRAY8] = { - .convert = rgb555_to_gray}, + [PIX_FMT_RGB24] = { + .convert = rgb555_to_rgb24}, + [PIX_FMT_RGBA32] = { + .convert = rgb555_to_rgba32}, + [PIX_FMT_YUV420P] = { + .convert = rgb555_to_yuv420p}, + [PIX_FMT_GRAY8] = { + .convert = rgb555_to_gray}, }, [PIX_FMT_RGB565] = { - [PIX_FMT_RGB24] = { - .convert = rgb565_to_rgb24}, - [PIX_FMT_YUV420P] = { - .convert = rgb565_to_yuv420p}, - [PIX_FMT_GRAY8] = { - .convert = rgb565_to_gray}, + [PIX_FMT_RGB24] = { + .convert = rgb565_to_rgb24}, + [PIX_FMT_YUV420P] = { + .convert = rgb565_to_yuv420p}, + [PIX_FMT_GRAY8] = { + .convert = rgb565_to_gray}, }, [PIX_FMT_GRAY8] = { - [PIX_FMT_RGB555] = { - .convert = gray_to_rgb555}, - [PIX_FMT_RGB565] = { - .convert = gray_to_rgb565}, - [PIX_FMT_RGB24] = { - .convert = gray_to_rgb24}, - [PIX_FMT_BGR24] = { - .convert = gray_to_bgr24}, - [PIX_FMT_RGBA32] = { - .convert = gray_to_rgba32}, - [PIX_FMT_MONOWHITE] = { - .convert = gray_to_monowhite}, - [PIX_FMT_MONOBLACK] = { - .convert = gray_to_monoblack}, + [PIX_FMT_RGB555] = { + .convert = gray_to_rgb555}, + [PIX_FMT_RGB565] = { + .convert = gray_to_rgb565}, + [PIX_FMT_RGB24] = { + .convert = gray_to_rgb24}, + [PIX_FMT_BGR24] = { + .convert = gray_to_bgr24}, + [PIX_FMT_RGBA32] = { + .convert = gray_to_rgba32}, + [PIX_FMT_MONOWHITE] = { + .convert = gray_to_monowhite}, + [PIX_FMT_MONOBLACK] = { + .convert = gray_to_monoblack}, }, [PIX_FMT_MONOWHITE] = { - [PIX_FMT_GRAY8] = { - .convert = monowhite_to_gray}, + [PIX_FMT_GRAY8] = { + .convert = monowhite_to_gray}, }, [PIX_FMT_MONOBLACK] = { - [PIX_FMT_GRAY8] = { - .convert = monoblack_to_gray}, + [PIX_FMT_GRAY8] = { + .convert = monoblack_to_gray}, }, [PIX_FMT_PAL8] = { - [PIX_FMT_RGB555] = { - .convert = pal8_to_rgb555}, - [PIX_FMT_RGB565] = { - .convert = pal8_to_rgb565}, - [PIX_FMT_BGR24] = { - .convert = pal8_to_bgr24}, - [PIX_FMT_RGB24] = { - .convert = pal8_to_rgb24}, - [PIX_FMT_RGBA32] = { - .convert = pal8_to_rgba32}, + [PIX_FMT_RGB555] = { + .convert = pal8_to_rgb555}, + [PIX_FMT_RGB565] = { + .convert = pal8_to_rgb565}, + [PIX_FMT_BGR24] = { + .convert = pal8_to_bgr24}, + [PIX_FMT_RGB24] = { + .convert = pal8_to_rgb24}, + [PIX_FMT_RGBA32] = { + .convert = pal8_to_rgba32}, }, }; @@ -1674,11 +1674,11 @@ img_convert (AVPicture * dst, int dst_pix_fmt, if (dst_pix->color_type == FF_COLOR_YUV_JPEG) { img_copy_plane (dst->data[0], dst->linesize[0], - src->data[0], src->linesize[0], dst_width, dst_height); + src->data[0], src->linesize[0], dst_width, dst_height); } else { img_apply_table (dst->data[0], dst->linesize[0], - src->data[0], src->linesize[0], - dst_width, dst_height, y_jpeg_to_ccir); + src->data[0], src->linesize[0], + dst_width, dst_height, y_jpeg_to_ccir); } /* fill U and V with 128 */ w = dst_width; @@ -1688,8 +1688,8 @@ img_convert (AVPicture * dst, int dst_pix_fmt, for (i = 1; i <= 2; i++) { d = dst->data[i]; for (y = 0; y < h; y++) { - memset (d, 128, w); - d += dst->linesize[i]; + memset (d, 128, w); + d += dst->linesize[i]; } } return 0; @@ -1699,11 +1699,11 @@ img_convert (AVPicture * dst, int dst_pix_fmt, if (is_yuv_planar (src_pix) && dst_pix_fmt == PIX_FMT_GRAY8) { if (src_pix->color_type == FF_COLOR_YUV_JPEG) { img_copy_plane (dst->data[0], dst->linesize[0], - src->data[0], src->linesize[0], dst_width, dst_height); + src->data[0], src->linesize[0], dst_width, dst_height); } else { img_apply_table (dst->data[0], dst->linesize[0], - src->data[0], src->linesize[0], - dst_width, dst_height, y_ccir_to_jpeg); + src->data[0], src->linesize[0], + dst_width, dst_height, y_ccir_to_jpeg); } return 0; } @@ -1712,7 +1712,7 @@ img_convert (AVPicture * dst, int dst_pix_fmt, if (is_yuv_planar (dst_pix) && is_yuv_planar (src_pix)) { int x_shift, y_shift, w, h, xy_shift; void (*resize_func) (uint8_t * dst, int dst_wrap, - const uint8_t * src, int src_wrap, int width, int height); + const uint8_t * src, int src_wrap, int width, int height); /* compute chroma size of the smallest dimensions */ w = dst_width; @@ -1733,71 +1733,71 @@ img_convert (AVPicture * dst, int dst_pix_fmt, YUV444 format */ switch (xy_shift) { case 0x00: - resize_func = img_copy_plane; - break; + resize_func = img_copy_plane; + break; case 0x10: - resize_func = shrink21; - break; + resize_func = shrink21; + break; case 0x20: - resize_func = shrink41; - break; + resize_func = shrink41; + break; case 0x01: - resize_func = shrink12; - break; + resize_func = shrink12; + break; case 0x11: - resize_func = shrink22; - break; + resize_func = shrink22; + break; case 0x22: - resize_func = shrink44; - break; + resize_func = shrink44; + break; case 0xf0: - resize_func = grow21; - break; + resize_func = grow21; + break; case 0xe0: - resize_func = grow41; - break; + resize_func = grow41; + break; case 0xff: - resize_func = grow22; - break; + resize_func = grow22; + break; case 0xee: - resize_func = grow44; - break; + resize_func = grow44; + break; case 0xf1: - resize_func = conv411; - break; + resize_func = conv411; + break; default: - /* currently not handled */ - goto no_chroma_filter; + /* currently not handled */ + goto no_chroma_filter; } img_copy_plane (dst->data[0], dst->linesize[0], - src->data[0], src->linesize[0], dst_width, dst_height); + src->data[0], src->linesize[0], dst_width, dst_height); for (i = 1; i <= 2; i++) resize_func (dst->data[i], dst->linesize[i], - src->data[i], src->linesize[i], - dst_width >> dst_pix->x_chroma_shift, - dst_height >> dst_pix->y_chroma_shift); + src->data[i], src->linesize[i], + dst_width >> dst_pix->x_chroma_shift, + dst_height >> dst_pix->y_chroma_shift); /* if yuv color space conversion is needed, we do it here on the destination image */ if (dst_pix->color_type != src_pix->color_type) { const uint8_t *y_table, *c_table; if (dst_pix->color_type == FF_COLOR_YUV) { - y_table = y_jpeg_to_ccir; - c_table = c_jpeg_to_ccir; + y_table = y_jpeg_to_ccir; + c_table = c_jpeg_to_ccir; } else { - y_table = y_ccir_to_jpeg; - c_table = c_ccir_to_jpeg; + y_table = y_ccir_to_jpeg; + c_table = c_ccir_to_jpeg; } img_apply_table (dst->data[0], dst->linesize[0], - dst->data[0], dst->linesize[0], dst_width, dst_height, y_table); + dst->data[0], dst->linesize[0], dst_width, dst_height, y_table); for (i = 1; i <= 2; i++) - img_apply_table (dst->data[i], dst->linesize[i], - dst->data[i], dst->linesize[i], - dst_width >> dst_pix->x_chroma_shift, - dst_height >> dst_pix->y_chroma_shift, c_table); + img_apply_table (dst->data[i], dst->linesize[i], + dst->data[i], dst->linesize[i], + dst_width >> dst_pix->x_chroma_shift, + dst_height >> dst_pix->y_chroma_shift, c_table); } return 0; } @@ -1808,19 +1808,19 @@ no_chroma_filter: /* specific case: convert to YUV422P first */ int_pix_fmt = PIX_FMT_YUV422P; } else if ((src_pix->color_type == FF_COLOR_GRAY && - src_pix_fmt != PIX_FMT_GRAY8) || + src_pix_fmt != PIX_FMT_GRAY8) || (dst_pix->color_type == FF_COLOR_GRAY && dst_pix_fmt != PIX_FMT_GRAY8)) { /* gray8 is the normalized format */ int_pix_fmt = PIX_FMT_GRAY8; } else if ((is_yuv_planar (src_pix) && - src_pix_fmt != PIX_FMT_YUV444P && src_pix_fmt != PIX_FMT_YUVJ444P)) { + src_pix_fmt != PIX_FMT_YUV444P && src_pix_fmt != PIX_FMT_YUVJ444P)) { /* yuv444 is the normalized format */ if (src_pix->color_type == FF_COLOR_YUV_JPEG) int_pix_fmt = PIX_FMT_YUVJ444P; else int_pix_fmt = PIX_FMT_YUV444P; } else if ((is_yuv_planar (dst_pix) && - dst_pix_fmt != PIX_FMT_YUV444P && dst_pix_fmt != PIX_FMT_YUVJ444P)) { + dst_pix_fmt != PIX_FMT_YUV444P && dst_pix_fmt != PIX_FMT_YUVJ444P)) { /* yuv444 is the normalized format */ if (dst_pix->color_type == FF_COLOR_YUV_JPEG) int_pix_fmt = PIX_FMT_YUVJ444P; @@ -1837,10 +1837,10 @@ no_chroma_filter: return -1; ret = -1; if (img_convert (tmp, int_pix_fmt, - src, src_pix_fmt, src_width, src_height) < 0) + src, src_pix_fmt, src_width, src_height) < 0) goto fail1; if (img_convert (dst, dst_pix_fmt, - tmp, int_pix_fmt, dst_width, dst_height) < 0) + tmp, int_pix_fmt, dst_width, dst_height) < 0) goto fail1; ret = 0; fail1: @@ -1864,9 +1864,9 @@ get_alpha_info_pal8 (const AVPicture * src, int width, int height) for (x = 0; x < width; x++) { a = palette[p[0]] >> 24; if (a == 0x00) { - ret |= FF_ALPHA_TRANSP; + ret |= FF_ALPHA_TRANSP; } else if (a != 0xff) { - ret |= FF_ALPHA_SEMI_TRANSP; + ret |= FF_ALPHA_SEMI_TRANSP; } p++; } @@ -2124,26 +2124,26 @@ avpicture_deinterlace (AVPicture * dst, const AVPicture * src, for (i = 0; i < 3; i++) { if (i == 1) { switch (pix_fmt) { - case PIX_FMT_YUV420P: - width >>= 1; - height >>= 1; - break; - case PIX_FMT_YUV422P: - width >>= 1; - break; - case PIX_FMT_YUV411P: - width >>= 2; - break; - default: - break; + case PIX_FMT_YUV420P: + width >>= 1; + height >>= 1; + break; + case PIX_FMT_YUV422P: + width >>= 1; + break; + case PIX_FMT_YUV411P: + width >>= 2; + break; + default: + break; } } if (src == dst) { deinterlace_bottom_field_inplace (dst->data[i], dst->linesize[i], - width, height); + width, height); } else { deinterlace_bottom_field (dst->data[i], dst->linesize[i], - src->data[i], src->linesize[i], width, height); + src->data[i], src->linesize[i], width, height); } } #ifdef HAVE_MMX diff --git a/gst/sine/gstsinesrc.c b/gst/sine/gstsinesrc.c index 06baf3eca3..17ac7e1f77 100644 --- a/gst/sine/gstsinesrc.c +++ b/gst/sine/gstsinesrc.c @@ -62,11 +62,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) [ 8000, 48000 ], " "channels = (int) 1") + "endianness = (int) BYTE_ORDER, " + "signed = (boolean) true, " + "width = (int) 16, " + "depth = (int) 16, " + "rate = (int) [ 8000, 48000 ], " "channels = (int) 1") ); static void gst_sinesrc_class_init (GstSineSrcClass * klass); @@ -109,8 +109,9 @@ gst_sinesrc_get_type (void) sizeof (GstSineSrc), 0, (GInstanceInitFunc) gst_sinesrc_init, }; + sinesrc_type = g_type_register_static (GST_TYPE_ELEMENT, "GstSineSrc", - &sinesrc_info, 0); + &sinesrc_info, 0); } return sinesrc_type; } @@ -138,21 +139,21 @@ gst_sinesrc_class_init (GstSineSrcClass * klass) g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_TABLESIZE, g_param_spec_int ("tablesize", "tablesize", "tablesize", - 1, G_MAXINT, 1024, G_PARAM_READWRITE)); + 1, G_MAXINT, 1024, G_PARAM_READWRITE)); g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_SAMPLES_PER_BUFFER, g_param_spec_int ("samplesperbuffer", "Samples per buffer", - "Number of samples in each outgoing buffer", - 1, G_MAXINT, 1024, G_PARAM_READWRITE)); + "Number of samples in each outgoing buffer", + 1, G_MAXINT, 1024, G_PARAM_READWRITE)); g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_FREQ, g_param_spec_double ("freq", "Frequency", "Frequency of sine source", - 0.0, 20000.0, 440.0, G_PARAM_READWRITE)); + 0.0, 20000.0, 440.0, G_PARAM_READWRITE)); g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_VOLUME, g_param_spec_double ("volume", "Volume", "Volume", - 0.0, 1.0, 0.8, G_PARAM_READWRITE)); + 0.0, 1.0, 0.8, G_PARAM_READWRITE)); g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_SYNC, g_param_spec_boolean ("sync", "Sync", "Synchronize to clock", - FALSE, G_PARAM_READWRITE)); + FALSE, G_PARAM_READWRITE)); gobject_class->set_property = gst_sinesrc_set_property; gobject_class->get_property = gst_sinesrc_get_property; @@ -192,12 +193,12 @@ gst_sinesrc_init (GstSineSrc * src) gst_dpman_add_required_dparam_callback (src->dpman, g_param_spec_double ("freq", "Frequency (Hz)", "Frequency of the tone", - 10.0, 10000.0, 350.0, G_PARAM_READWRITE), + 10.0, 10000.0, 350.0, G_PARAM_READWRITE), "hertz", gst_sinesrc_update_freq, src); gst_dpman_add_required_dparam_direct (src->dpman, g_param_spec_double ("volume", "Volume", "Volume of the tone", - 0.0, 1.0, 0.8, G_PARAM_READWRITE), "scalar", &(src->volume) + 0.0, 1.0, 0.8, G_PARAM_READWRITE), "scalar", &(src->volume) ); gst_dpman_set_rate (src->dpman, src->samplerate); @@ -289,20 +290,20 @@ gst_sinesrc_src_query (GstPad * pad, switch (type) { case GST_QUERY_POSITION: switch (*format) { - case GST_FORMAT_TIME: - *value = src->timestamp; - res = TRUE; - break; - case GST_FORMAT_DEFAULT: /* samples */ - *value = src->offset / 2; /* 16bpp audio */ - res = TRUE; - break; - case GST_FORMAT_BYTES: - *value = src->offset; - res = TRUE; - break; - default: - break; + case GST_FORMAT_TIME: + *value = src->timestamp; + res = TRUE; + break; + case GST_FORMAT_DEFAULT: /* samples */ + *value = src->offset / 2; /* 16bpp audio */ + res = TRUE; + break; + case GST_FORMAT_BYTES: + *value = src->offset; + res = TRUE; + break; + default: + break; } break; default: @@ -332,7 +333,7 @@ gst_sinesrc_get (GstPad * pad) taglist = gst_tag_list_new (); gst_tag_list_add (taglist, GST_TAG_MERGE_APPEND, - GST_TAG_DESCRIPTION, "sine wave", NULL); + GST_TAG_DESCRIPTION, "sine wave", NULL); gst_element_found_tags (GST_ELEMENT (src), taglist); event = gst_event_new_tag (taglist); @@ -371,8 +372,8 @@ gst_sinesrc_get (GstPad * pad) if (src->table_lookup_next >= src->table_size) { src->table_lookup_next -= src->table_size; if (src->table_lookup >= src->table_size) { - src->table_lookup -= src->table_size; - src->table_pos -= src->table_size; + src->table_lookup -= src->table_size; + src->table_pos -= src->table_size; } } @@ -384,10 +385,10 @@ gst_sinesrc_get (GstPad * pad) /*linear interpolation */ samples[i] = ((src->table_interp * (src->table_data[src->table_lookup_next] - - src->table_data[src->table_lookup] - ) - ) + src->table_data[src->table_lookup] - ) * src->volume * 32767.0; + - src->table_data[src->table_lookup] + ) + ) + src->table_data[src->table_lookup] + ) * src->volume * 32767.0; #endif src->accumulator += 2 * M_PI * src->freq / src->samplerate; if (src->accumulator >= 2 * M_PI) { @@ -400,7 +401,7 @@ gst_sinesrc_get (GstPad * pad) if (!GST_PAD_CAPS (src->srcpad)) { if (gst_sinesrc_link (src->srcpad, - gst_pad_get_allowed_caps (src->srcpad)) <= 0) { + gst_pad_get_allowed_caps (src->srcpad)) <= 0) { GST_ELEMENT_ERROR (src, CORE, NEGOTIATION, (NULL), (NULL)); return NULL; } diff --git a/gst/tags/gstid3tag.c b/gst/tags/gstid3tag.c index 279047ad6e..64db2eac95 100644 --- a/gst/tags/gstid3tag.c +++ b/gst/tags/gstid3tag.c @@ -253,11 +253,11 @@ gst_tag_extract (GstTagList * list, const gchar * tag, const gchar * start, if (bytes_read != size) { g_free (conv); conv = - g_convert (start, size, "UTF-8", "ISO-8859-1", &bytes_read, NULL, - NULL); + g_convert (start, size, "UTF-8", "ISO-8859-1", &bytes_read, NULL, + NULL); if (bytes_read != size) { - g_free (conv); - return; + g_free (conv); + return; } } conv = g_strchomp (conv); @@ -305,13 +305,13 @@ gst_tag_list_new_from_id3v1 (const guint8 * data) if (data[125] == 0) { gst_tag_extract (list, GST_TAG_COMMENT, &data[97], 28); gst_tag_list_add (list, GST_TAG_MERGE_REPLACE, GST_TAG_TRACK_NUMBER, - (guint) data[126], NULL); + (guint) data[126], NULL); } else { gst_tag_extract (list, GST_TAG_COMMENT, &data[97], 30); } if (data[127] < gst_tag_id3_genre_count ()) { gst_tag_list_add (list, GST_TAG_MERGE_REPLACE, GST_TAG_GENRE, - gst_tag_id3_genre_get (data[127]), NULL); + gst_tag_id3_genre_get (data[127]), NULL); } return list; diff --git a/gst/tags/gsttagediting.c b/gst/tags/gsttagediting.c index ef5554c728..e02dce3c35 100644 --- a/gst/tags/gsttagediting.c +++ b/gst/tags/gsttagediting.c @@ -30,7 +30,7 @@ static gboolean plugin_init (GstPlugin * plugin) { if (!gst_element_register (plugin, "vorbistag", - GST_RANK_PRIMARY, gst_vorbis_tag_get_type ())) { + GST_RANK_PRIMARY, gst_vorbis_tag_get_type ())) { return FALSE; } diff --git a/gst/tags/gstvorbistag.c b/gst/tags/gstvorbistag.c index 60c28ce5dd..fb75e64631 100644 --- a/gst/tags/gstvorbistag.c +++ b/gst/tags/gstvorbistag.c @@ -128,14 +128,14 @@ gst_vorbis_tag_get_type (void) }; vorbis_tag_type = - g_type_register_static (GST_TYPE_ELEMENT, "GstVorbisTag", - &vorbis_tag_info, 0); + g_type_register_static (GST_TYPE_ELEMENT, "GstVorbisTag", + &vorbis_tag_info, 0); g_type_add_interface_static (vorbis_tag_type, GST_TYPE_TAG_SETTER, - &tag_setter_info); + &tag_setter_info); GST_DEBUG_CATEGORY_INIT (gst_vorbis_tag_debug, "vorbistag", 0, - "vorbis tagging element"); + "vorbis tagging element"); } return vorbis_tag_type; } @@ -267,56 +267,56 @@ gst_vorbis_tag_add (GstTagList * list, const gchar * tag, const gchar * value) switch (gst_tag_get_type (gst_tag)) { case G_TYPE_UINT: if (strcmp (gst_tag, GST_TAG_DATE) == 0) { - GDate *date; - guint y, d = 1, m = 1; - gchar *check = (gchar *) value; - - y = strtoul (check, &check, 10); - if (*check == '-') { - check++; - m = strtoul (check, &check, 10); - if (*check == '-') { - check++; - d = strtoul (check, &check, 10); - } - } - if (*check != '\0') - break; - if (y == 0) - break; - date = g_date_new_dmy (d, m, y); - y = g_date_get_julian (date); - g_date_free (date); - gst_tag_list_add (list, GST_TAG_MERGE_APPEND, gst_tag, y, NULL); - break; + GDate *date; + guint y, d = 1, m = 1; + gchar *check = (gchar *) value; + + y = strtoul (check, &check, 10); + if (*check == '-') { + check++; + m = strtoul (check, &check, 10); + if (*check == '-') { + check++; + d = strtoul (check, &check, 10); + } + } + if (*check != '\0') + break; + if (y == 0) + break; + date = g_date_new_dmy (d, m, y); + y = g_date_get_julian (date); + g_date_free (date); + gst_tag_list_add (list, GST_TAG_MERGE_APPEND, gst_tag, y, NULL); + break; } else { - guint tmp; - gchar *check; - gboolean is_track_number_tag; - gboolean is_disc_number_tag; - - is_track_number_tag = (strcmp (gst_tag, GST_TAG_TRACK_NUMBER) == 0); - is_disc_number_tag = - (strcmp (gst_tag, GST_TAG_ALBUM_VOLUME_NUMBER) == 0); - tmp = strtoul (value, &check, 10); - if (*check == '/' && (is_track_number_tag || is_disc_number_tag)) { - guint count; - - check++; - count = strtoul (check, &check, 10); - if (*check != '\0' || count == 0) - break; - if (is_track_number_tag) { - gst_tag_list_add (list, GST_TAG_MERGE_APPEND, GST_TAG_TRACK_COUNT, - count, NULL); - } else { - gst_tag_list_add (list, GST_TAG_MERGE_APPEND, - GST_TAG_ALBUM_VOLUME_COUNT, count, NULL); - } - } - if (*check != '\0') - break; - gst_tag_list_add (list, GST_TAG_MERGE_APPEND, gst_tag, tmp, NULL); + guint tmp; + gchar *check; + gboolean is_track_number_tag; + gboolean is_disc_number_tag; + + is_track_number_tag = (strcmp (gst_tag, GST_TAG_TRACK_NUMBER) == 0); + is_disc_number_tag = + (strcmp (gst_tag, GST_TAG_ALBUM_VOLUME_NUMBER) == 0); + tmp = strtoul (value, &check, 10); + if (*check == '/' && (is_track_number_tag || is_disc_number_tag)) { + guint count; + + check++; + count = strtoul (check, &check, 10); + if (*check != '\0' || count == 0) + break; + if (is_track_number_tag) { + gst_tag_list_add (list, GST_TAG_MERGE_APPEND, GST_TAG_TRACK_COUNT, + count, NULL); + } else { + gst_tag_list_add (list, GST_TAG_MERGE_APPEND, + GST_TAG_ALBUM_VOLUME_COUNT, count, NULL); + } + } + if (*check != '\0') + break; + gst_tag_list_add (list, GST_TAG_MERGE_APPEND, gst_tag, tmp, NULL); } break; case G_TYPE_STRING: @@ -324,7 +324,7 @@ gst_vorbis_tag_add (GstTagList * list, const gchar * tag, const gchar * value) break; case G_TYPE_DOUBLE: gst_tag_list_add (list, GST_TAG_MERGE_APPEND, gst_tag, g_strtod (value, - NULL), NULL); + NULL), NULL); break; default: break; @@ -415,7 +415,8 @@ typedef struct guint count; guint data_count; GList *entries; -} MyForEach; +} +MyForEach; GList * gst_tag_to_vorbis_comments (const GstTagList * list, const gchar * tag) @@ -430,41 +431,41 @@ gst_tag_to_vorbis_comments (const GstTagList * list, const gchar * tag) for (i = 0; i < gst_tag_list_get_tag_size (list, tag); i++) { switch (gst_tag_get_type (tag)) { case G_TYPE_UINT: - if (strcmp (tag, GST_TAG_DATE) == 0) { - GDate *date; - guint u; - - g_assert (gst_tag_list_get_uint_index (list, tag, i, &u)); - date = g_date_new_julian (u); - /* vorbis suggests using ISO date formats */ - result = - g_strdup_printf ("%s=%04d-%02d-%02d", vorbis_tag, - (gint) g_date_get_year (date), (gint) g_date_get_month (date), - (gint) g_date_get_day (date)); - g_date_free (date); - } else { - guint u; - - g_assert (gst_tag_list_get_uint_index (list, tag, i, &u)); - result = g_strdup_printf ("%s=%u", vorbis_tag, u); - } - break; + if (strcmp (tag, GST_TAG_DATE) == 0) { + GDate *date; + guint u; + + g_assert (gst_tag_list_get_uint_index (list, tag, i, &u)); + date = g_date_new_julian (u); + /* vorbis suggests using ISO date formats */ + result = + g_strdup_printf ("%s=%04d-%02d-%02d", vorbis_tag, + (gint) g_date_get_year (date), (gint) g_date_get_month (date), + (gint) g_date_get_day (date)); + g_date_free (date); + } else { + guint u; + + g_assert (gst_tag_list_get_uint_index (list, tag, i, &u)); + result = g_strdup_printf ("%s=%u", vorbis_tag, u); + } + break; case G_TYPE_STRING:{ - gchar *str; + gchar *str; - g_assert (gst_tag_list_get_string_index (list, tag, i, &str)); - result = g_strdup_printf ("%s=%s", vorbis_tag, str); - break; + g_assert (gst_tag_list_get_string_index (list, tag, i, &str)); + result = g_strdup_printf ("%s=%s", vorbis_tag, str); + break; } case G_TYPE_DOUBLE:{ - gdouble value; + gdouble value; - g_assert (gst_tag_list_get_double_index (list, tag, i, &value)); - result = g_strdup_printf ("%s=%f", vorbis_tag, value); + g_assert (gst_tag_list_get_double_index (list, tag, i, &value)); + result = g_strdup_printf ("%s=%f", vorbis_tag, value); } default: - GST_DEBUG ("Couldn't write tag %s", tag); - continue; + GST_DEBUG ("Couldn't write tag %s", tag); + continue; } l = g_list_prepend (l, result); } @@ -567,44 +568,44 @@ gst_vorbis_tag_chain (GstPad * pad, GstData * data) /* caps nego */ do { if (gst_pad_try_set_caps (tag->srcpad, - gst_caps_new_simple ("audio/x-vorbis", NULL)) >= 0) { - tag->output = OUTPUT_DATA; + gst_caps_new_simple ("audio/x-vorbis", NULL)) >= 0) { + tag->output = OUTPUT_DATA; } else if (gst_pad_try_set_caps (tag->srcpad, - gst_caps_new_simple ("application/x-gst-tags", NULL)) >= 0) { - tag->output = OUTPUT_TAGS; + gst_caps_new_simple ("application/x-gst-tags", NULL)) >= 0) { + tag->output = OUTPUT_TAGS; } else { - const GstCaps *caps = - gst_static_caps_get (&gst_vorbis_tag_src_template.static_caps); - if (gst_pad_recover_caps_error (tag->srcpad, caps)) - continue; - return; + const GstCaps *caps = + gst_static_caps_get (&gst_vorbis_tag_src_template.static_caps); + if (gst_pad_recover_caps_error (tag->srcpad, caps)) + continue; + return; } } while (FALSE); } if (GST_BUFFER_SIZE (buffer) == 0) GST_ELEMENT_ERROR (tag, CORE, TAG, (NULL), - ("empty buffers are not allowed in vorbis data")); + ("empty buffers are not allowed in vorbis data")); if (GST_BUFFER_DATA (buffer)[0] == 3) { gchar *vendor; GstTagList *list = - gst_tag_list_from_vorbiscomment_buffer (buffer, "\003vorbis", 7, - &vendor); + gst_tag_list_from_vorbiscomment_buffer (buffer, "\003vorbis", 7, + &vendor); gst_data_unref (data); if (list == NULL) { GST_ELEMENT_ERROR (tag, CORE, TAG, (NULL), - ("invalid data in vorbis comments")); + ("invalid data in vorbis comments")); return; } gst_element_found_tags_for_pad (GST_ELEMENT (tag), tag->srcpad, 0, - gst_tag_list_copy (list)); + gst_tag_list_copy (list)); gst_tag_list_merge (list, gst_tag_setter_get_list (GST_TAG_SETTER (tag)), - gst_tag_setter_get_merge_mode (GST_TAG_SETTER (tag))); + gst_tag_setter_get_merge_mode (GST_TAG_SETTER (tag))); data = - GST_DATA (gst_tag_list_to_vorbiscomment_buffer (list, "\003vorbis", 7, - vendor)); + GST_DATA (gst_tag_list_to_vorbiscomment_buffer (list, "\003vorbis", 7, + vendor)); gst_tag_list_free (list); g_free (vendor); } diff --git a/gst/tcp/gsttcp.c b/gst/tcp/gsttcp.c index adb69263c7..ace1a3495e 100644 --- a/gst/tcp/gsttcp.c +++ b/gst/tcp/gsttcp.c @@ -28,7 +28,7 @@ static gboolean plugin_init (GstPlugin * plugin) { if (!gst_element_register (plugin, "tcpsink", GST_RANK_NONE, - GST_TYPE_TCPSINK)) + GST_TYPE_TCPSINK)) return FALSE; if (!gst_element_register (plugin, "tcpsrc", GST_RANK_NONE, GST_TYPE_TCPSRC)) diff --git a/gst/tcp/gsttcpplugin.c b/gst/tcp/gsttcpplugin.c index adb69263c7..ace1a3495e 100644 --- a/gst/tcp/gsttcpplugin.c +++ b/gst/tcp/gsttcpplugin.c @@ -28,7 +28,7 @@ static gboolean plugin_init (GstPlugin * plugin) { if (!gst_element_register (plugin, "tcpsink", GST_RANK_NONE, - GST_TYPE_TCPSINK)) + GST_TYPE_TCPSINK)) return FALSE; if (!gst_element_register (plugin, "tcpsrc", GST_RANK_NONE, GST_TYPE_TCPSRC)) diff --git a/gst/tcp/gsttcpsink.c b/gst/tcp/gsttcpsink.c index 10e98f9598..0f77692669 100644 --- a/gst/tcp/gsttcpsink.c +++ b/gst/tcp/gsttcpsink.c @@ -60,9 +60,10 @@ gst_tcpsink_control_get_type (void) {CONTROL_TCP, "2", "tcp"}, {CONTROL_ZERO, NULL, NULL} }; + if (!tcpsink_control_type) { tcpsink_control_type = - g_enum_register_static ("GstTCPSinkControl", tcpsink_control); + g_enum_register_static ("GstTCPSinkControl", tcpsink_control); } return tcpsink_control_type; } @@ -105,9 +106,10 @@ gst_tcpsink_get_type (void) (GInstanceInitFunc) gst_tcpsink_init, NULL }; + tcpsink_type = - g_type_register_static (GST_TYPE_ELEMENT, "GstTCPSink", &tcpsink_info, - 0); + g_type_register_static (GST_TYPE_ELEMENT, "GstTCPSink", &tcpsink_info, + 0); } return tcpsink_type; } @@ -133,14 +135,14 @@ gst_tcpsink_class_init (GstTCPSink * klass) g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_HOST, g_param_spec_string ("host", "host", "The host/IP to send the packets to", - TCP_DEFAULT_HOST, G_PARAM_READWRITE)); + TCP_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, TCP_DEFAULT_PORT, G_PARAM_READWRITE)); + 0, 32768, TCP_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_TCPSINK_CONTROL, CONTROL_TCP, G_PARAM_READWRITE)); - g_object_class_install_property (gobject_class, ARG_MTU, g_param_spec_int ("mtu", "mtu", "mtu", G_MININT, G_MAXINT, 0, G_PARAM_READWRITE)); /* CHECKME */ + GST_TYPE_TCPSINK_CONTROL, CONTROL_TCP, G_PARAM_READWRITE)); + g_object_class_install_property (gobject_class, ARG_MTU, g_param_spec_int ("mtu", "mtu", "mtu", G_MININT, G_MAXINT, 0, G_PARAM_READWRITE)); /* CHECKME */ gobject_class->set_property = gst_tcpsink_set_property; gobject_class->get_property = gst_tcpsink_get_property; @@ -170,24 +172,24 @@ gst_tcpsink_sink_link (GstPad * pad, const GstCaps * caps) /* if its an IP address */ if (inet_aton (tcpsink->host, &addr)) { - memmove (&(serv_addr.sin_addr), &addr, sizeof (struct in_addr)); + memmove (&(serv_addr.sin_addr), &addr, sizeof (struct in_addr)); } /* we dont need to lookup for localhost */ else if (strcmp (tcpsink->host, TCP_DEFAULT_HOST) == 0) { - if (inet_aton ("127.0.0.1", &addr)) { - memmove (&(serv_addr.sin_addr), &addr, sizeof (struct in_addr)); - } + if (inet_aton ("127.0.0.1", &addr)) { + memmove (&(serv_addr.sin_addr), &addr, sizeof (struct in_addr)); + } } /* if its a hostname */ else if ((he = gethostbyname (tcpsink->host))) { - memmove (&(serv_addr.sin_addr), he->h_addr, he->h_length); + memmove (&(serv_addr.sin_addr), he->h_addr, he->h_length); } else { - perror ("hostname lookup error?"); - return GST_PAD_LINK_REFUSED; + perror ("hostname lookup error?"); + return GST_PAD_LINK_REFUSED; } serv_addr.sin_family = AF_INET; @@ -199,14 +201,14 @@ gst_tcpsink_sink_link (GstPad * pad, const GstCaps * caps) gst_caps_save_thyself (caps, doc->xmlRootNode); 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 ("tcpsink: connect to %s port %d failed: %s\n", - tcpsink->host, tcpsink->port + 1, g_strerror (errno)); - return GST_PAD_LINK_REFUSED; + g_printerr ("tcpsink: connect to %s port %d failed: %s\n", + tcpsink->host, tcpsink->port + 1, g_strerror (errno)); + return GST_PAD_LINK_REFUSED; } f = fdopen (dup (fd), "wb"); @@ -291,11 +293,11 @@ gst_tcpsink_set_property (GObject * object, guint prop_id, const GValue * value, switch (prop_id) { case ARG_HOST: if (tcpsink->host != NULL) - g_free (tcpsink->host); + g_free (tcpsink->host); if (g_value_get_string (value) == NULL) - tcpsink->host = NULL; + tcpsink->host = NULL; else - tcpsink->host = g_strdup (g_value_get_string (value)); + tcpsink->host = g_strdup (g_value_get_string (value)); break; case ARG_PORT: tcpsink->port = g_value_get_int (value); @@ -349,8 +351,8 @@ gst_tcpsink_init_send (GstTCPSink * sink) struct in_addr addr; 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)) { @@ -380,7 +382,7 @@ gst_tcpsink_init_send (GstTCPSink * sink) } if (connect (sink->sock, (struct sockaddr *) &(sink->theiraddr), - sizeof (sink->theiraddr)) != 0) { + sizeof (sink->theiraddr)) != 0) { perror ("stream connect"); return FALSE; } @@ -409,7 +411,7 @@ gst_tcpsink_change_state (GstElement * element) } else { if (!GST_FLAG_IS_SET (element, GST_TCPSINK_OPEN)) { if (!gst_tcpsink_init_send (GST_TCPSINK (element))) - return GST_STATE_FAILURE; + return GST_STATE_FAILURE; } } diff --git a/gst/tcp/gsttcpsrc.c b/gst/tcp/gsttcpsrc.c index 4c1a612741..e76214e6c6 100644 --- a/gst/tcp/gsttcpsrc.c +++ b/gst/tcp/gsttcpsrc.c @@ -60,9 +60,10 @@ gst_tcpsrc_control_get_type (void) {CONTROL_TCP, "2", "tcp"}, {CONTROL_ZERO, NULL, NULL} }; + if (!tcpsrc_control_type) { tcpsrc_control_type = - g_enum_register_static ("GstTCPSrcControl", tcpsrc_control); + g_enum_register_static ("GstTCPSrcControl", tcpsrc_control); } return tcpsrc_control_type; } @@ -103,8 +104,9 @@ gst_tcpsrc_get_type (void) (GInstanceInitFunc) gst_tcpsrc_init, NULL }; + tcpsrc_type = - g_type_register_static (GST_TYPE_ELEMENT, "GstTCPSrc", &tcpsrc_info, 0); + g_type_register_static (GST_TYPE_ELEMENT, "GstTCPSrc", &tcpsrc_info, 0); } return tcpsrc_type; } @@ -130,10 +132,10 @@ gst_tcpsrc_class_init (GstTCPSrc * 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, TCP_DEFAULT_PORT, G_PARAM_READWRITE)); + 0, 32768, TCP_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_TCPSRC_CONTROL, CONTROL_TCP, G_PARAM_READWRITE)); + GST_TYPE_TCPSRC_CONTROL, CONTROL_TCP, G_PARAM_READWRITE)); /* g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_SOCKET_OPTIONS, g_param_spec_boolean ("socketop", "socketop", "Enable or disable socket options REUSEADDR and KEEPALIVE", @@ -213,45 +215,45 @@ gst_tcpsrc_get (GstPad * pad) if (select (max_sock + 1, &read_fds, NULL, NULL, NULL) > 0) { if ((tcpsrc->control_sock != -1) - && FD_ISSET (tcpsrc->control_sock, &read_fds)) { + && FD_ISSET (tcpsrc->control_sock, &read_fds)) { guchar *buf = NULL; xmlDocPtr doc; GstCaps *caps; switch (tcpsrc->control) { - case CONTROL_TCP: + case CONTROL_TCP: #ifndef GST_DISABLE_LOADSAVE - buf = g_malloc (1024 * 10); + buf = g_malloc (1024 * 10); - len = sizeof (struct sockaddr); - client_sock = accept (tcpsrc->control_sock, &client_addr, &len); + len = sizeof (struct sockaddr); + client_sock = accept (tcpsrc->control_sock, &client_addr, &len); - if (client_sock <= 0) { - perror ("control_sock accept"); - } + if (client_sock <= 0) { + perror ("control_sock accept"); + } - else if ((ret = read (client_sock, buf, 1024 * 10)) <= 0) { - perror ("control_sock read"); - } + else if ((ret = read (client_sock, buf, 1024 * 10)) <= 0) { + perror ("control_sock read"); + } - else { - buf[ret] = '\0'; - doc = xmlParseMemory (buf, ret); - caps = gst_caps_load_thyself (doc->xmlRootNode); + else { + buf[ret] = '\0'; + doc = xmlParseMemory (buf, ret); + caps = gst_caps_load_thyself (doc->xmlRootNode); - /* foward the connect, we don't signal back the result here... */ - gst_pad_try_set_caps (tcpsrc->srcpad, caps); - } + /* foward the connect, we don't signal back the result here... */ + gst_pad_try_set_caps (tcpsrc->srcpad, caps); + } - g_free (buf); + g_free (buf); #endif - break; - case CONTROL_NONE: - default: - g_free (buf); - return NULL; - break; + break; + case CONTROL_NONE: + default: + g_free (buf); + return NULL; + break; } outbuf = NULL; @@ -261,57 +263,57 @@ gst_tcpsrc_get (GstPad * pad) GST_BUFFER_SIZE (outbuf) = 24000; if (GST_FLAG_IS_SET (tcpsrc, GST_TCPSRC_1ST_BUF)) { - if (tcpsrc->clock) { - GstClockTime current_time; - GstEvent *discont; + if (tcpsrc->clock) { + GstClockTime current_time; + GstEvent *discont; - current_time = gst_clock_get_time (tcpsrc->clock); + current_time = gst_clock_get_time (tcpsrc->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 (tcpsrc->srcpad, GST_DATA (discont)); - } + gst_pad_push (tcpsrc->srcpad, GST_DATA (discont)); + } - GST_FLAG_UNSET (tcpsrc, GST_TCPSRC_1ST_BUF); + GST_FLAG_UNSET (tcpsrc, GST_TCPSRC_1ST_BUF); } else { - GST_BUFFER_TIMESTAMP (outbuf) = GST_CLOCK_TIME_NONE; + GST_BUFFER_TIMESTAMP (outbuf) = GST_CLOCK_TIME_NONE; } if (!GST_FLAG_IS_SET (tcpsrc, GST_TCPSRC_CONNECTED)) { - tcpsrc->client_sock = accept (tcpsrc->sock, &client_addr, &len); + tcpsrc->client_sock = accept (tcpsrc->sock, &client_addr, &len); - if (tcpsrc->client_sock <= 0) { - perror ("accept"); - } + if (tcpsrc->client_sock <= 0) { + perror ("accept"); + } - else { - GST_FLAG_SET (tcpsrc, GST_TCPSRC_CONNECTED); - } + else { + GST_FLAG_SET (tcpsrc, GST_TCPSRC_CONNECTED); + } } numbytes = - read (tcpsrc->client_sock, GST_BUFFER_DATA (outbuf), - GST_BUFFER_SIZE (outbuf)); + read (tcpsrc->client_sock, GST_BUFFER_DATA (outbuf), + GST_BUFFER_SIZE (outbuf)); if (numbytes > 0) { - GST_BUFFER_SIZE (outbuf) = numbytes; + GST_BUFFER_SIZE (outbuf) = numbytes; } else { - if (numbytes == -1) { - perror ("read"); - } else - g_print ("End of Stream reached\n"); - gst_buffer_unref (outbuf); - outbuf = NULL; - close (tcpsrc->client_sock); - tcpsrc->client_sock = -1; - GST_FLAG_UNSET (tcpsrc, GST_TCPSRC_CONNECTED); + if (numbytes == -1) { + perror ("read"); + } else + g_print ("End of Stream reached\n"); + gst_buffer_unref (outbuf); + outbuf = NULL; + close (tcpsrc->client_sock); + tcpsrc->client_sock = -1; + GST_FLAG_UNSET (tcpsrc, GST_TCPSRC_CONNECTED); } } } @@ -383,8 +385,8 @@ gst_tcpsrc_init_receive (GstTCPSrc * src) guint val = 0; 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_STREAM, 0)) == -1) { @@ -408,7 +410,7 @@ gst_tcpsrc_init_receive (GstTCPSrc * src) /* } */ if (bind (src->sock, (struct sockaddr *) &src->myaddr, - sizeof (src->myaddr)) == -1) { + sizeof (src->myaddr)) == -1) { perror ("stream_sock bind"); return FALSE; } @@ -423,20 +425,20 @@ gst_tcpsrc_init_receive (GstTCPSrc * 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; } src->myaddr.sin_port = htons (src->port + 1); 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 ("control listen"); - return FALSE; + perror ("control listen"); + return FALSE; } fcntl (src->control_sock, F_SETFL, O_NONBLOCK); @@ -484,7 +486,7 @@ gst_tcpsrc_change_state (GstElement * element) } else { if (!GST_FLAG_IS_SET (element, GST_TCPSRC_OPEN)) { if (!gst_tcpsrc_init_receive (GST_TCPSRC (element))) - return GST_STATE_FAILURE; + return GST_STATE_FAILURE; } } diff --git a/gst/typefind/gsttypefindfunctions.c b/gst/typefind/gsttypefindfunctions.c index 30177c63c2..001ff823be 100644 --- a/gst/typefind/gsttypefindfunctions.c +++ b/gst/typefind/gsttypefindfunctions.c @@ -47,9 +47,9 @@ utf8_type_find (GstTypeFind * tf, gpointer unused) guint8 *data; /* randomly decided values */ - guint size = 1024; /* starting size */ - guint probability = 95; /* starting probability */ - guint step = 10; /* how much we reduce probability in each iteration */ + guint size = 1024; /* starting size */ + guint probability = 95; /* starting probability */ + guint step = 10; /* how much we reduce probability in each iteration */ while (probability > step) { data = gst_type_find_peek (tf, 0, size); @@ -57,8 +57,8 @@ utf8_type_find (GstTypeFind * tf, gpointer unused) gchar *end; gchar *start = (gchar *) data; - if (g_utf8_validate (start, size, (const gchar **) &end) || (end - start + 4 > size)) { /* allow last char to be cut off */ - gst_type_find_suggest (tf, probability, UTF8_CAPS); + if (g_utf8_validate (start, size, (const gchar **) &end) || (end - start + 4 > size)) { /* allow last char to be cut off */ + gst_type_find_suggest (tf, probability, UTF8_CAPS); } return; } @@ -72,7 +72,7 @@ utf8_type_find (GstTypeFind * tf, gpointer unused) static GstStaticCaps uri_caps = GST_STATIC_CAPS ("text/uri-list"); #define URI_CAPS (gst_static_caps_get(&uri_caps)) -#define BUFFER_SIZE 16 /* If the string is < 16 bytes we're screwed */ +#define BUFFER_SIZE 16 /* If the string is < 16 bytes we're screwed */ #define INC_BUFFER { \ pos++; \ if (pos == BUFFER_SIZE) { \ @@ -96,7 +96,7 @@ uri_type_find (GstTypeFind * tf, gpointer unused) while (*data == '#') { /* Goto end of line */ while (*data != '\n') { - INC_BUFFER; + INC_BUFFER; } INC_BUFFER; @@ -144,9 +144,9 @@ flx_type_find (GstTypeFind * tf, gpointer unused) if (data) { /* check magic and the frame type of the first frame */ if ((data[4] == 0x11 || data[4] == 0x12 || - data[4] == 0x30 || data[4] == 0x44) && - data[5] == 0xaf && - ((data[132] == 0x00 || data[132] == 0xfa) && data[133] == 0xf1)) { + data[4] == 0x30 || data[4] == 0x44) && + data[5] == 0xaf && + ((data[132] == 0x00 || data[132] == 0xfa) && data[133] == 0xf1)) { gst_type_find_suggest (tf, GST_TYPE_FIND_MAXIMUM, FLX_CAPS); } return; @@ -155,7 +155,7 @@ flx_type_find (GstTypeFind * tf, gpointer unused) if (data) { /* check magic only */ if ((data[4] == 0x11 || data[4] == 0x12 || - data[4] == 0x30 || data[4] == 0x44) && data[5] == 0xaf) { + data[4] == 0x30 || data[4] == 0x44) && data[5] == 0xaf) { gst_type_find_suggest (tf, GST_TYPE_FIND_LIKELY, FLX_CAPS); } return; @@ -176,9 +176,9 @@ id3_type_find (GstTypeFind * tf, gpointer unused) if (data) { /* detect valid header */ if (memcmp (data, "ID3", 3) == 0 && - data[3] != 0xFF && data[4] != 0xFF && - (data[6] & 0x80) == 0 && (data[7] & 0x80) == 0 && - (data[8] & 0x80) == 0 && (data[9] & 0x80) == 0) { + data[3] != 0xFF && data[4] != 0xFF && + (data[6] & 0x80) == 0 && (data[7] & 0x80) == 0 && + (data[8] & 0x80) == 0 && (data[9] & 0x80) == 0) { gst_type_find_suggest (tf, GST_TYPE_FIND_MAXIMUM, ID3_CAPS); return; } @@ -283,7 +283,7 @@ mp3_type_frame_length_from_header (guint32 header, guint * put_layer, length = ((12000 * bitrate / samplerate) + length) * 4; } else { length += ((layer == 3 - && version != 3) ? 72000 : 144000) * bitrate / samplerate; + && version != 3) ? 72000 : 144000) * bitrate / samplerate; } GST_LOG ("mp3typefind: alculated mp3 frame length of %u bytes", length); @@ -314,7 +314,7 @@ static GstStaticCaps mp3_caps = GST_STATIC_CAPS ("audio/mpeg, " * / TRY_SYNC) */ #define GST_MP3_TYPEFIND_TRY_HEADERS 5 -#define GST_MP3_TYPEFIND_TRY_SYNC (GST_TYPE_FIND_MAXIMUM * 100) /* 10kB */ +#define GST_MP3_TYPEFIND_TRY_SYNC (GST_TYPE_FIND_MAXIMUM * 100) /* 10kB */ #define GST_MP3_TYPEFIND_SYNC_SIZE 2048 static void @@ -328,80 +328,80 @@ mp3_type_find (GstTypeFind * tf, gpointer unused) if (size <= 0) { data = gst_type_find_peek (tf, skipped, GST_MP3_TYPEFIND_SYNC_SIZE); if (!data) - break; + break; size = GST_MP3_TYPEFIND_SYNC_SIZE; } if (*data == 0xFF) { guint8 *head_data = NULL; guint layer, bitrate, samplerate, channels; - guint found = 0; /* number of valid headers found */ + guint found = 0; /* number of valid headers found */ guint64 offset = skipped; while (found < GST_MP3_TYPEFIND_TRY_HEADERS) { - guint32 head; - guint length; - guint prev_layer = 0, prev_bitrate = 0, - prev_channels = 0, prev_samplerate = 0; - - if (offset + 4 <= skipped + size) { - head_data = data + offset - skipped; - } else { - head_data = gst_type_find_peek (tf, offset, 4); - } - if (!head_data) - break; - head = GUINT32_FROM_BE (*((guint32 *) head_data)); - if (!(length = mp3_type_frame_length_from_header (head, &layer, - &channels, &bitrate, &samplerate))) { - GST_LOG ("%d. header at offset %" G_GUINT64_FORMAT - " was not an mp3 header", found + 1, offset); - break; - } - if ((prev_layer && prev_layer != layer) || - /* (prev_bitrate && prev_bitrate != bitrate) || <-- VBR */ - (prev_samplerate && prev_samplerate != samplerate) || - (prev_channels && prev_channels != channels)) { - /* this means an invalid property, or a change, which might mean - * that this is not a mp3 but just a random bytestream. It could - * be a freaking funky encoded mp3 though. We'll just not count - * this header*/ - prev_layer = layer; - prev_bitrate = bitrate; - prev_channels = channels; - prev_samplerate = samplerate; - } else { - found++; - } - offset += length; + guint32 head; + guint length; + guint prev_layer = 0, prev_bitrate = 0, + prev_channels = 0, prev_samplerate = 0; + + if (offset + 4 <= skipped + size) { + head_data = data + offset - skipped; + } else { + head_data = gst_type_find_peek (tf, offset, 4); + } + if (!head_data) + break; + head = GUINT32_FROM_BE (*((guint32 *) head_data)); + if (!(length = mp3_type_frame_length_from_header (head, &layer, + &channels, &bitrate, &samplerate))) { + GST_LOG ("%d. header at offset %" G_GUINT64_FORMAT + " was not an mp3 header", found + 1, offset); + break; + } + if ((prev_layer && prev_layer != layer) || + /* (prev_bitrate && prev_bitrate != bitrate) || <-- VBR */ + (prev_samplerate && prev_samplerate != samplerate) || + (prev_channels && prev_channels != channels)) { + /* this means an invalid property, or a change, which might mean + * that this is not a mp3 but just a random bytestream. It could + * be a freaking funky encoded mp3 though. We'll just not count + * this header*/ + prev_layer = layer; + prev_bitrate = bitrate; + prev_channels = channels; + prev_samplerate = samplerate; + } else { + found++; + } + offset += length; } g_assert (found <= GST_MP3_TYPEFIND_TRY_HEADERS); if (found == GST_MP3_TYPEFIND_TRY_HEADERS || head_data == NULL) { - /* we can make a valid guess */ - guint probability = found * GST_TYPE_FIND_MAXIMUM * - (GST_MP3_TYPEFIND_TRY_SYNC - skipped) / - GST_MP3_TYPEFIND_TRY_HEADERS / GST_MP3_TYPEFIND_TRY_SYNC; - if (probability < GST_TYPE_FIND_MINIMUM) - probability = GST_TYPE_FIND_MINIMUM; - - /* make sure we're not id3 tagged */ - head_data = gst_type_find_peek (tf, -128, 3); - if (!head_data) { - probability = probability * 4 / 5; - } else if (memcmp (head_data, "TAG", 3) == 0) { - probability = 0; - } - g_assert (probability <= GST_TYPE_FIND_MAXIMUM); - if (probability > 0) { - GstCaps *caps; - - g_assert (layer > 0); - caps = gst_caps_copy (MP3_CAPS); - gst_structure_set (gst_caps_get_structure (caps, 0), "layer", - G_TYPE_INT, layer, 0); - gst_type_find_suggest (tf, probability, caps); - gst_caps_free (caps); - } - return; + /* we can make a valid guess */ + guint probability = found * GST_TYPE_FIND_MAXIMUM * + (GST_MP3_TYPEFIND_TRY_SYNC - skipped) / + GST_MP3_TYPEFIND_TRY_HEADERS / GST_MP3_TYPEFIND_TRY_SYNC; + if (probability < GST_TYPE_FIND_MINIMUM) + probability = GST_TYPE_FIND_MINIMUM; + + /* make sure we're not id3 tagged */ + head_data = gst_type_find_peek (tf, -128, 3); + if (!head_data) { + probability = probability * 4 / 5; + } else if (memcmp (head_data, "TAG", 3) == 0) { + probability = 0; + } + g_assert (probability <= GST_TYPE_FIND_MAXIMUM); + if (probability > 0) { + GstCaps *caps; + + g_assert (layer > 0); + caps = gst_caps_copy (MP3_CAPS); + gst_structure_set (gst_caps_get_structure (caps, 0), "layer", + G_TYPE_INT, layer, 0); + gst_type_find_suggest (tf, probability, caps); + gst_caps_free (caps); + } + return; } } data++; @@ -438,13 +438,13 @@ mpeg2_sys_type_find (GstTypeFind * tf, gpointer unused) GstCaps *caps = gst_caps_copy (MPEG_SYS_CAPS); gst_structure_set (gst_caps_get_structure (caps, 0), "mpegversion", - G_TYPE_INT, 2, 0); + G_TYPE_INT, 2, 0); gst_type_find_suggest (tf, GST_TYPE_FIND_MAXIMUM, caps); } else if ((data[4] & 0xF0) == 0x20) { GstCaps *caps = gst_caps_copy (MPEG_SYS_CAPS); gst_structure_set (gst_caps_get_structure (caps, 0), "mpegversion", - G_TYPE_INT, 1, 0); + G_TYPE_INT, 1, 0); gst_type_find_suggest (tf, GST_TYPE_FIND_MAXIMUM, caps); gst_caps_free (caps); } @@ -473,56 +473,56 @@ mpeg1_parse_header (GstTypeFind * tf, guint64 offset) offset += 4; switch (data[3]) { - case 0xBA: /* pack header */ + case 0xBA: /* pack header */ data = gst_type_find_peek (tf, offset, 8); if (!data) { - GST_LOG ("couldn't get MPEG pack header bytes"); - return 1; + GST_LOG ("couldn't get MPEG pack header bytes"); + return 1; } size = 12; /* check marker bits */ if ((data[0] & 0xF1) != 0x21 || - (data[2] & 0x01) != 0x01 || - (data[4] & 0x01) != 0x01 || - (data[5] & 0x80) != 0x80 || (data[7] & 0x01) != 0x01) - return 0; + (data[2] & 0x01) != 0x01 || + (data[4] & 0x01) != 0x01 || + (data[5] & 0x80) != 0x80 || (data[7] & 0x01) != 0x01) + return 0; break; - case 0xB9: /* ISO end code */ + case 0xB9: /* ISO end code */ size = 4; break; - case 0xBB: /* system header */ + case 0xBB: /* system header */ data = gst_type_find_peek (tf, offset, 2); if (!data) { - GST_LOG ("couldn't get MPEG pack header bytes"); - return 1; + GST_LOG ("couldn't get MPEG pack header bytes"); + return 1; } size = GUINT16_FROM_BE (*(guint16 *) data) + 6; offset += 2; data = gst_type_find_peek (tf, offset, size - 6); if (!data) { - GST_LOG ("couldn't get MPEG pack header bytes"); - return 1; + GST_LOG ("couldn't get MPEG pack header bytes"); + return 1; } /* check marker bits */ if ((data[0] & 0x80) != 0x80 || - (data[2] & 0x01) != 0x01 || (data[4] & 0x20) != 0x20) - return 0; + (data[2] & 0x01) != 0x01 || (data[4] & 0x20) != 0x20) + return 0; /* check stream marker bits */ for (offset = 6; offset < (size - 6); offset += 3) { - if (data[offset] <= 0xBB || (data[offset + 1] & 0xC0) != 0xC0) - return 0; + if (data[offset] <= 0xBB || (data[offset + 1] & 0xC0) != 0xC0) + return 0; } break; default: if (data[3] < 0xB9) - return 0; + return 0; data = gst_type_find_peek (tf, offset, 2); if (!data) { - GST_LOG ("couldn't get MPEG pack header bytes"); - return 1; + GST_LOG ("couldn't get MPEG pack header bytes"); + return 1; } size = GUINT16_FROM_BE (*(guint16 *) data) + 6; /* FIXME: we could check PTS/DTS marker bits here... (bit overkill) */ @@ -544,7 +544,7 @@ mpeg1_parse_header (GstTypeFind * tf, guint64 offset) * = <some_number> */ #define GST_MPEG_TYPEFIND_TRY_HEADERS 4 -#define GST_MPEG_TYPEFIND_TRY_SYNC (100 * 1024) /* 100kB */ +#define GST_MPEG_TYPEFIND_TRY_SYNC (100 * 1024) /* 100kB */ #define GST_MPEG_TYPEFIND_SYNC_SIZE 2048 static void mpeg1_sys_type_find (GstTypeFind * tf, gpointer unused) @@ -558,7 +558,7 @@ mpeg1_sys_type_find (GstTypeFind * tf, gpointer unused) if (size < 4) { data = gst_type_find_peek (tf, skipped, GST_MPEG_TYPEFIND_SYNC_SIZE); if (!data) - break; + break; size = GST_MPEG_TYPEFIND_SYNC_SIZE; } if (IS_MPEG_HEADER (data)) { @@ -568,20 +568,20 @@ mpeg1_sys_type_find (GstTypeFind * tf, gpointer unused) guint64 offset = skipped; while (found < GST_MPEG_TYPEFIND_TRY_HEADERS) { - packet_size = mpeg1_parse_header (tf, offset); - if (packet_size <= 1) - break; - offset += packet_size; - found++; + packet_size = mpeg1_parse_header (tf, offset); + if (packet_size <= 1) + break; + offset += packet_size; + found++; } g_assert (found <= GST_MPEG_TYPEFIND_TRY_HEADERS); if (found == GST_MPEG_TYPEFIND_TRY_HEADERS || packet_size == 1) { - caps = gst_caps_copy (MPEG_SYS_CAPS); - gst_structure_set (gst_caps_get_structure (caps, 0), "mpegversion", - G_TYPE_INT, 1, 0); - gst_type_find_suggest (tf, GST_TYPE_FIND_MAXIMUM - 1, caps); - gst_caps_free (caps); - return; + caps = gst_caps_copy (MPEG_SYS_CAPS); + gst_structure_set (gst_caps_get_structure (caps, 0), "mpegversion", + G_TYPE_INT, 1, 0); + gst_type_find_suggest (tf, GST_TYPE_FIND_MAXIMUM - 1, caps); + gst_caps_free (caps); + return; } } data++; @@ -607,7 +607,7 @@ mpeg_video_type_find (GstTypeFind * tf, gpointer unused) GstCaps *caps = gst_caps_copy (MPEG_VIDEO_CAPS); gst_structure_set (gst_caps_get_structure (caps, 0), "mpegversion", - G_TYPE_INT, 1, 0); + G_TYPE_INT, 1, 0); gst_type_find_suggest (tf, GST_TYPE_FIND_MAXIMUM - 1, caps); gst_caps_free (caps); } @@ -623,7 +623,7 @@ mpeg_video_type_find (GstTypeFind * tf, gpointer unused) */ #define GST_MPEGVID_TYPEFIND_TRY_PICTURES 6 -#define GST_MPEGVID_TYPEFIND_TRY_SYNC (100 * 1024) /* 100 kB */ +#define GST_MPEGVID_TYPEFIND_TRY_SYNC (100 * 1024) /* 100 kB */ #define GST_MPEGVID_TYPEFIND_SYNC_SIZE 2048 static void @@ -638,7 +638,7 @@ mpeg_video_stream_type_find (GstTypeFind * tf, gpointer unused) GstCaps *caps = gst_caps_copy (MPEG_VIDEO_CAPS); gst_structure_set (gst_caps_get_structure (caps, 0), "mpegversion", - G_TYPE_INT, 1, 0); + G_TYPE_INT, 1, 0); gst_type_find_suggest (tf, GST_TYPE_FIND_MAXIMUM - 2, caps); gst_caps_free (caps); return; @@ -650,23 +650,23 @@ mpeg_video_stream_type_find (GstTypeFind * tf, gpointer unused) if (size < 4) { data = gst_type_find_peek (tf, skipped, GST_MPEGVID_TYPEFIND_SYNC_SIZE); if (!data) - break; + break; size = GST_MPEGVID_TYPEFIND_SYNC_SIZE; } /* are we a sequence (0xB3) or GOP (0xB8) header? */ if (data[0] == 0x0 && data[1] == 0x0 && data[2] == 0x1 && - (data[3] == 0xB3 || data[3] == 0xB8)) { + (data[3] == 0xB3 || data[3] == 0xB8)) { size -= 8; data += 8; skipped += 8; if (data[3] == 0xB3) - continue; + continue; else if (size < 4) { - data = gst_type_find_peek (tf, skipped, GST_MPEGVID_TYPEFIND_SYNC_SIZE); - size = GST_MPEGVID_TYPEFIND_SYNC_SIZE; - if (!data) - break; + data = gst_type_find_peek (tf, skipped, GST_MPEGVID_TYPEFIND_SYNC_SIZE); + size = GST_MPEGVID_TYPEFIND_SYNC_SIZE; + if (!data) + break; } /* else, we should now see an image */ } @@ -677,20 +677,20 @@ mpeg_video_stream_type_find (GstTypeFind * tf, gpointer unused) data += 8; skipped += 8; if (size < 5) { - data = gst_type_find_peek (tf, skipped, GST_MPEGVID_TYPEFIND_SYNC_SIZE); - size = GST_MPEGVID_TYPEFIND_SYNC_SIZE; - if (!data) - break; + data = gst_type_find_peek (tf, skipped, GST_MPEGVID_TYPEFIND_SYNC_SIZE); + size = GST_MPEGVID_TYPEFIND_SYNC_SIZE; + if (!data) + break; } if ((data[0] == 0x0 && data[1] == 0x0 && - data[2] == 0x1 && data[3] == 0x1) || - (data[1] == 0x0 && data[2] == 0x0 && - data[3] == 0x1 && data[4] == 0x1)) { - size -= 4; - data += 4; - skipped += 4; - found += 1; - continue; + data[2] == 0x1 && data[3] == 0x1) || + (data[1] == 0x0 && data[2] == 0x0 && + data[3] == 0x1 && data[4] == 0x1)) { + size -= 4; + data += 4; + skipped += 4; + found += 1; + continue; } } @@ -714,12 +714,12 @@ qt_type_find (GstTypeFind * tf, gpointer unused) while ((data = gst_type_find_peek (tf, offset, 8)) != NULL) { if (strncmp (&data[4], "wide", 4) != 0 && - strncmp (&data[4], "moov", 4) != 0 && - strncmp (&data[4], "mdat", 4) != 0 && - strncmp (&data[4], "pnot", 4) != 0 && - strncmp (&data[4], "PICT", 4) != 0 && - strncmp (&data[4], "ftyp", 4) != 0 && - strncmp (&data[4], "free", 4) != 0) { + strncmp (&data[4], "moov", 4) != 0 && + strncmp (&data[4], "mdat", 4) != 0 && + strncmp (&data[4], "pnot", 4) != 0 && + strncmp (&data[4], "PICT", 4) != 0 && + strncmp (&data[4], "ftyp", 4) != 0 && + strncmp (&data[4], "free", 4) != 0) { tip = 0; break; } @@ -802,19 +802,19 @@ mod_type_find (GstTypeFind * tf, gpointer unused) if ((data = gst_type_find_peek (tf, 1080, 4)) != NULL) { /* Protracker and variants */ if ((memcmp (data, "M.K.", 4) == 0) || (memcmp (data, "M!K!", 4) == 0) || - /* Star Tracker */ - (memcmp (data, "FLT", 3) == 0 && isdigit (data[3])) || - (memcmp (data, "EXO", 3) == 0 && isdigit (data[3])) || - /* Oktalyzer (Amiga) */ - (memcmp (data, "OKTA", 4) == 0) || - /* Oktalyser (Atari) */ - (memcmp (data, "CD81", 4) == 0) || - /* Fasttracker */ - (memcmp (data + 1, "CHN", 3) == 0 && isdigit (data[0])) || - /* Fasttracker or Taketracker */ - (memcmp (data + 2, "CH", 2) == 0 && isdigit (data[0]) - && isdigit (data[1])) || (memcmp (data + 2, "CN", 2) == 0 - && isdigit (data[0]) && isdigit (data[1]))) { + /* Star Tracker */ + (memcmp (data, "FLT", 3) == 0 && isdigit (data[3])) || + (memcmp (data, "EXO", 3) == 0 && isdigit (data[3])) || + /* Oktalyzer (Amiga) */ + (memcmp (data, "OKTA", 4) == 0) || + /* Oktalyser (Atari) */ + (memcmp (data, "CD81", 4) == 0) || + /* Fasttracker */ + (memcmp (data + 1, "CHN", 3) == 0 && isdigit (data[0])) || + /* Fasttracker or Taketracker */ + (memcmp (data + 2, "CH", 2) == 0 && isdigit (data[0]) + && isdigit (data[1])) || (memcmp (data + 2, "CN", 2) == 0 + && isdigit (data[0]) && isdigit (data[1]))) { gst_type_find_suggest (tf, GST_TYPE_FIND_MAXIMUM, MOD_CAPS); return; } @@ -841,12 +841,12 @@ mod_type_find (GstTypeFind * tf, gpointer unused) } /* AMF */ if ((memcmp (data, "AMF", 3) == 0 && data[3] > 10 && data[3] < 14) || - /* IT */ - (memcmp (data, "IMPM", 4) == 0) || - /* MED */ - (memcmp (data, "MMD0", 4) == 0) || (memcmp (data, "MMD1", 4) == 0) || - /* MTM */ - (memcmp (data, "MTM", 3) == 0)) { + /* IT */ + (memcmp (data, "IMPM", 4) == 0) || + /* MED */ + (memcmp (data, "MMD0", 4) == 0) || (memcmp (data, "MMD1", 4) == 0) || + /* MTM */ + (memcmp (data, "MTM", 3) == 0)) { gst_type_find_suggest (tf, GST_TYPE_FIND_MAXIMUM, MOD_CAPS); return; } @@ -855,10 +855,10 @@ mod_type_find (GstTypeFind * tf, gpointer unused) guint8 *data2 = gst_type_find_peek (tf, 8, 4); if (data2) { - if (memcmp (data2, "DSMF", 4) == 0) { - gst_type_find_suggest (tf, GST_TYPE_FIND_MAXIMUM, MOD_CAPS); - return; - } + if (memcmp (data2, "DSMF", 4) == 0) { + gst_type_find_suggest (tf, GST_TYPE_FIND_MAXIMUM, MOD_CAPS); + return; + } } } /* FAM */ @@ -866,13 +866,13 @@ mod_type_find (GstTypeFind * tf, gpointer unused) guint8 *data2 = gst_type_find_peek (tf, 44, 3); if (data2) { - if (memcmp (data2, "compare", 3) == 0) { - gst_type_find_suggest (tf, GST_TYPE_FIND_MAXIMUM, MOD_CAPS); - return; - } + if (memcmp (data2, "compare", 3) == 0) { + gst_type_find_suggest (tf, GST_TYPE_FIND_MAXIMUM, MOD_CAPS); + return; + } } else { - gst_type_find_suggest (tf, GST_TYPE_FIND_LIKELY, MOD_CAPS); - return; + gst_type_find_suggest (tf, GST_TYPE_FIND_LIKELY, MOD_CAPS); + return; } } /* GDM */ @@ -880,13 +880,13 @@ mod_type_find (GstTypeFind * tf, gpointer unused) guint8 *data2 = gst_type_find_peek (tf, 71, 4); if (data2) { - if (memcmp (data2, "GMFS", 4) == 0) { - gst_type_find_suggest (tf, GST_TYPE_FIND_MAXIMUM, MOD_CAPS); - return; - } + if (memcmp (data2, "GMFS", 4) == 0) { + gst_type_find_suggest (tf, GST_TYPE_FIND_MAXIMUM, MOD_CAPS); + return; + } } else { - gst_type_find_suggest (tf, GST_TYPE_FIND_LIKELY, MOD_CAPS); - return; + gst_type_find_suggest (tf, GST_TYPE_FIND_LIKELY, MOD_CAPS); + return; } } } @@ -956,9 +956,9 @@ bmp_type_find (GstTypeFind * tf, gpointer unused) if (data && memcmp (data, "BM", 2) == 0) { if ((data[14] == 0x0C || - data[14] == 0x28 || - data[14] == 0xF0) && - data[15] == 0 && data[16] == 0 && data[17] == 0) { + data[14] == 0x28 || + data[14] == 0xF0) && + data[15] == 0 && data[16] == 0 && data[17] == 0) { gst_type_find_suggest (tf, GST_TYPE_FIND_MAXIMUM, BMP_CAPS); } } @@ -1062,7 +1062,7 @@ dv_type_find (GstTypeFind * tf, gpointer private) format = "NTSC"; } gst_structure_set (gst_caps_get_structure (caps, 0), "format", - G_TYPE_STRING, format, NULL); + G_TYPE_STRING, format, NULL); gst_type_find_suggest (tf, GST_TYPE_FIND_MAXIMUM, caps); gst_caps_free (caps); @@ -1122,7 +1122,7 @@ static GstStaticCaps theora_caps = GST_STATIC_CAPS ("video/x-theora"); static void theora_type_find (GstTypeFind * tf, gpointer private) { - guint8 *data = gst_type_find_peek (tf, 0, 7); //42); + guint8 *data = gst_type_find_peek (tf, 0, 7); //42); if (data) { if (data[0] != 0x80) @@ -1178,7 +1178,8 @@ typedef struct guint size; guint probability; GstCaps *caps; -} GstTypeFindData; +} +GstTypeFindData; static void start_with_type_find (GstTypeFind * tf, gpointer private) { diff --git a/gst/videoscale/gstvideoscale.c b/gst/videoscale/gstvideoscale.c index ad4be87856..d2bc540f26 100644 --- a/gst/videoscale/gstvideoscale.c +++ b/gst/videoscale/gstvideoscale.c @@ -61,9 +61,10 @@ gst_videoscale_method_get_type (void) {GST_VIDEOSCALE_BICUBIC, "3", "Bicubic"}, {0, NULL, NULL}, }; + if (!videoscale_method_type) { videoscale_method_type = - g_enum_register_static ("GstVideoscaleMethod", videoscale_methods); + g_enum_register_static ("GstVideoscaleMethod", videoscale_methods); } return videoscale_method_type; } @@ -77,7 +78,7 @@ gst_videoscale_get_capslist (void) caps = gst_caps_new_empty (); for (i = 0; i < videoscale_n_formats; i++) { gst_caps_append_structure (caps, - videoscale_get_structure (videoscale_formats + i)); + videoscale_get_structure (videoscale_formats + i)); } return caps; @@ -132,9 +133,10 @@ gst_videoscale_get_type (void) 0, (GInstanceInitFunc) gst_videoscale_init, }; + videoscale_type = - g_type_register_static (GST_TYPE_ELEMENT, "GstVideoscale", - &videoscale_info, 0); + g_type_register_static (GST_TYPE_ELEMENT, "GstVideoscale", + &videoscale_info, 0); } return videoscale_type; } @@ -160,7 +162,7 @@ gst_videoscale_class_init (GstVideoscaleClass * klass) gobject_class = (GObjectClass *) klass; gstelement_class = (GstElementClass *) klass; - g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_METHOD, g_param_spec_enum ("method", "method", "method", GST_TYPE_VIDEOSCALE_METHOD, 0, G_PARAM_READWRITE)); /* CHECKME! */ + g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_METHOD, g_param_spec_enum ("method", "method", "method", GST_TYPE_VIDEOSCALE_METHOD, 0, G_PARAM_READWRITE)); /* CHECKME! */ parent_class = g_type_class_ref (GST_TYPE_ELEMENT); @@ -192,8 +194,8 @@ gst_videoscale_getcaps (GstPad * pad) GstStructure *structure = gst_caps_get_structure (caps, i); gst_structure_set (structure, - "width", GST_TYPE_INT_RANGE, 16, G_MAXINT, - "height", GST_TYPE_INT_RANGE, 16, G_MAXINT, NULL); + "width", GST_TYPE_INT_RANGE, 16, G_MAXINT, + "height", GST_TYPE_INT_RANGE, 16, G_MAXINT, NULL); } GST_DEBUG ("returning caps: %" GST_PTR_FORMAT, caps); @@ -247,12 +249,12 @@ gst_videoscale_link (GstPad * pad, const GstCaps * caps) if (pad == videoscale->srcpad) { gst_caps_set_simple (newcaps, - "width", G_TYPE_INT, videoscale->from_width, - "height", G_TYPE_INT, videoscale->from_height, NULL); + "width", G_TYPE_INT, videoscale->from_width, + "height", G_TYPE_INT, videoscale->from_height, NULL); } else { gst_caps_set_simple (newcaps, - "width", G_TYPE_INT, videoscale->to_width, - "height", G_TYPE_INT, videoscale->to_height, NULL); + "width", G_TYPE_INT, videoscale->to_width, + "height", G_TYPE_INT, videoscale->to_height, NULL); } ret = gst_pad_try_set_caps (otherpad, newcaps); if (GST_PAD_LINK_FAILED (ret)) { @@ -319,14 +321,14 @@ gst_videoscale_handle_src_event (GstPad * pad, GstEvent * event) case GST_EVENT_NAVIGATION: structure = gst_structure_copy (event->event_data.structure.structure); if (gst_structure_get_double (event->event_data.structure.structure, - "pointer_x", &a)) { - gst_structure_set (structure, "pointer_x", G_TYPE_DOUBLE, - a * videoscale->from_width / videoscale->to_width, NULL); + "pointer_x", &a)) { + gst_structure_set (structure, "pointer_x", G_TYPE_DOUBLE, + a * videoscale->from_width / videoscale->to_width, NULL); } if (gst_structure_get_double (event->event_data.structure.structure, - "pointer_y", &a)) { - gst_structure_set (structure, "pointer_y", G_TYPE_DOUBLE, - a * videoscale->from_height / videoscale->to_height, NULL); + "pointer_y", &a)) { + gst_structure_set (structure, "pointer_y", G_TYPE_DOUBLE, + a * videoscale->from_height / videoscale->to_height, NULL); } gst_event_unref (event); new_event = gst_event_new (GST_EVENT_NAVIGATION); @@ -361,7 +363,7 @@ gst_videoscale_chain (GstPad * pad, GstData * _data) if (videoscale->passthru) { GST_LOG_OBJECT (videoscale, "passing through buffer of %ld bytes in '%s'", - size, GST_OBJECT_NAME (videoscale)); + size, GST_OBJECT_NAME (videoscale)); gst_pad_push (videoscale->srcpad, GST_DATA (buf)); return; } @@ -441,7 +443,7 @@ static gboolean plugin_init (GstPlugin * plugin) { if (!gst_element_register (plugin, "videoscale", GST_RANK_NONE, - GST_TYPE_VIDEOSCALE)) + GST_TYPE_VIDEOSCALE)) return FALSE; GST_DEBUG_CATEGORY_INIT (videoscale_debug, "videoscale", 0, diff --git a/gst/videoscale/videoscale.c b/gst/videoscale/videoscale.c index 9ca0d90b93..0f31f3558e 100644 --- a/gst/videoscale/videoscale.c +++ b/gst/videoscale/videoscale.c @@ -129,15 +129,15 @@ videoscale_get_structure (struct videoscale_format_struct *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, format->fourcc, NULL); + "format", GST_TYPE_FOURCC, format->fourcc, NULL); } gst_structure_set (structure, @@ -168,7 +168,7 @@ videoscale_find_by_structure (GstStructure * structure) for (i = 0; i < videoscale_n_formats; i++) { format = videoscale_formats + i; if (format->depth == 0 && format->fourcc == fourcc) { - return format; + return format; } } } else { @@ -190,9 +190,9 @@ videoscale_find_by_structure (GstStructure * structure) for (i = 0; i < videoscale_n_formats; i++) { format = videoscale_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; } } } @@ -216,8 +216,8 @@ gst_videoscale_setup (GstVideoscale * videoscale) if (videoscale->to_width == 0 || videoscale->to_height == 0 || videoscale->from_width == 0 || videoscale->from_height == 0) { g_critical ("bad sizes %dx%d %dx%d", - videoscale->from_width, videoscale->from_height, - videoscale->to_width, videoscale->to_height); + videoscale->from_width, videoscale->from_height, + videoscale->to_width, videoscale->to_height); return; } @@ -419,7 +419,7 @@ gst_videoscale_bilinear (unsigned char *src, double x, double y, int sw, int sh) color = rint (dest); if (color < 0) - color = abs (color); /* cannot have negative values ! */ + color = abs (color); /* cannot have negative values ! */ /*if (color<0) color=0; // cannot have negative values ! */ if (color > 255) color = 255; @@ -464,7 +464,7 @@ gst_videoscale_bicubic (unsigned char *src, double x, double y, int sw, int sh) color = rint (dest); if (color < 0) - color = abs (color); /* cannot have negative values ! */ + color = abs (color); /* cannot have negative values ! */ if (color > 255) color = 255; @@ -489,15 +489,15 @@ gst_videoscale_scale_plane_slow (GstVideoscale * scale, unsigned char *src, xr = ((double) x) / zoomx; GST_DEBUG_OBJECT (scale, "scale plane slow %g %g %p", xr, yr, - (src + (int) (x) + (int) ((y) * sw))); + (src + (int) (x) + (int) ((y) * sw))); if (floor (xr) == xr && floor (yr) == yr) { - GST_DEBUG_OBJECT (scale, "scale plane %g %g %p %p", xr, yr, - (src + (int) (x) + (int) ((y) * sw)), dest); - *dest++ = RC (xr, yr); + GST_DEBUG_OBJECT (scale, "scale plane %g %g %p %p", xr, yr, + (src + (int) (x) + (int) ((y) * sw)), dest); + *dest++ = RC (xr, yr); } else { - *dest++ = scale->filter (src, xr, yr, sw, sh); - /**dest++ = gst_videoscale_bicubic(src, xr, yr, sw, sh); */ + *dest++ = scale->filter (src, xr, yr, sw, sh); + /**dest++ = gst_videoscale_bicubic(src, xr, yr, sw, sh); */ } } } @@ -536,15 +536,15 @@ gst_videoscale_scale_point_sample (GstVideoscale * scale, unsigned char *src, xcount = 0; sum = 0; while (xpos >= 0x10000L) { - loop = ycount; - srcp2 = srcp; - while (loop--) { - sum += *srcp2; - srcp2 += sw; - } - srcp++; - xcount++; - xpos -= 0x10000L; + loop = ycount; + srcp2 = srcp; + while (loop--) { + sum += *srcp2; + srcp2 += sw; + } + srcp++; + xcount++; + xpos -= 0x10000L; } *dest++ = sum / (xcount * ycount); xpos += xinc; @@ -585,8 +585,8 @@ gst_videoscale_scale_nearest (GstVideoscale * scale, for (x = dw; x; x--) { while (xpos >= 0x10000L) { - srcp++; - xpos -= 0x10000L; + srcp++; + xpos -= 0x10000L; } *destp++ = *srcp; xpos += xinc; @@ -627,8 +627,8 @@ gst_videoscale_scale_nearest_str2 (GstVideoscale * scale, for (x = dw; x; x--) { while (xpos >= 0x10000L) { - srcp += 2; - xpos -= 0x10000L; + srcp += 2; + xpos -= 0x10000L; } *destp = *srcp; destp += 2; @@ -670,8 +670,8 @@ gst_videoscale_scale_nearest_str4 (GstVideoscale * scale, for (x = dw; x; x--) { while (xpos >= 0x10000L) { - srcp += 4; - xpos -= 0x10000L; + srcp += 4; + xpos -= 0x10000L; } *destp = *srcp; destp += 4; @@ -713,8 +713,8 @@ gst_videoscale_scale_nearest_32bit (GstVideoscale * scale, for (x = dw; x; x--) { while (xpos >= 0x10000L) { - srcp += 4; - xpos -= 0x10000L; + srcp += 4; + xpos -= 0x10000L; } *(guint32 *) destp = *(guint32 *) srcp; destp += 4; @@ -756,8 +756,8 @@ gst_videoscale_scale_nearest_24bit (GstVideoscale * scale, for (x = dw; x; x--) { while (xpos >= 0x10000L) { - srcp += 3; - xpos -= 0x10000L; + srcp += 3; + xpos -= 0x10000L; } destp[0] = srcp[0]; destp[1] = srcp[1]; @@ -801,8 +801,8 @@ gst_videoscale_scale_nearest_16bit (GstVideoscale * scale, for (x = dw; x; x--) { while (xpos >= 0x10000L) { - srcp += 2; - xpos -= 0x10000L; + srcp += 2; + xpos -= 0x10000L; } destp[0] = srcp[0]; destp[1] = srcp[1]; diff --git a/gst/videoscale/videoscale_x86.c b/gst/videoscale/videoscale_x86.c index 3e895de983..f2c7ef0b58 100644 --- a/gst/videoscale/videoscale_x86.c +++ b/gst/videoscale/videoscale_x86.c @@ -68,7 +68,7 @@ gst_videoscale_generate_rowbytes_x86 (unsigned char *copy_row, int src_w, for (i = 0; i < dst_w; ++i) { while (pos >= 0x10000L) { if (bpp == 2) { - *eip++ = PREFIX16; + *eip++ = PREFIX16; } *eip++ = load; pos -= 0x10000L; diff --git a/gst/videotestsrc/gstvideotestsrc.c b/gst/videotestsrc/gstvideotestsrc.c index b1904b5918..ccecdd4daf 100644 --- a/gst/videotestsrc/gstvideotestsrc.c +++ b/gst/videotestsrc/gstvideotestsrc.c @@ -111,8 +111,8 @@ gst_videotestsrc_get_type (void) }; videotestsrc_type = - g_type_register_static (GST_TYPE_ELEMENT, "GstVideotestsrc", - &videotestsrc_info, 0); + g_type_register_static (GST_TYPE_ELEMENT, "GstVideotestsrc", + &videotestsrc_info, 0); } return videotestsrc_type; } @@ -131,7 +131,7 @@ gst_videotestsrc_pattern_get_type (void) if (!videotestsrc_pattern_type) { videotestsrc_pattern_type = - g_enum_register_static ("GstVideotestsrcPattern", pattern_types); + g_enum_register_static ("GstVideotestsrcPattern", pattern_types); } return videotestsrc_pattern_type; } @@ -157,11 +157,11 @@ gst_videotestsrc_class_init (GstVideotestsrcClass * klass) g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_TYPE, g_param_spec_enum ("pattern", "Pattern", - "Type of test pattern to generate", GST_TYPE_VIDEOTESTSRC_PATTERN, 1, - G_PARAM_READWRITE)); + "Type of test pattern to generate", GST_TYPE_VIDEOTESTSRC_PATTERN, 1, + G_PARAM_READWRITE)); g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_SYNC, g_param_spec_boolean ("sync", "Sync", "Synchronize to clock", TRUE, - G_PARAM_READWRITE)); + G_PARAM_READWRITE)); parent_class = g_type_class_ref (GST_TYPE_ELEMENT); @@ -203,7 +203,7 @@ gst_videotestsrc_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; } @@ -290,9 +290,9 @@ gst_videotestsrc_get_capslist (void) for (i = 0; i < n_fourccs; i++) { structure = paint_get_structure (fourcc_list + i); gst_structure_set (structure, - "width", GST_TYPE_INT_RANGE, 1, G_MAXINT, - "height", GST_TYPE_INT_RANGE, 1, G_MAXINT, - "framerate", GST_TYPE_DOUBLE_RANGE, 0.0, G_MAXDOUBLE, NULL); + "width", GST_TYPE_INT_RANGE, 1, G_MAXINT, + "height", GST_TYPE_INT_RANGE, 1, G_MAXINT, + "framerate", GST_TYPE_DOUBLE_RANGE, 0.0, G_MAXDOUBLE, NULL); gst_caps_append_structure (caps, structure); } @@ -311,8 +311,8 @@ gst_videotestsrc_get_capslist_size (int width, int height, double rate) for (i = 0; i < n_fourccs; i++) { structure = paint_get_structure (fourcc_list + i); gst_structure_set (structure, - "width", G_TYPE_INT, width, - "height", G_TYPE_INT, height, "framerate", G_TYPE_INT, rate, NULL); + "width", G_TYPE_INT, width, + "height", G_TYPE_INT, height, "framerate", G_TYPE_INT, rate, NULL); gst_caps_append_structure (caps, structure); } @@ -377,17 +377,17 @@ gst_videotestsrc_src_query (GstPad * pad, switch (type) { case GST_QUERY_POSITION: switch (*format) { - case GST_FORMAT_TIME: - *value = - videotestsrc->n_frames * GST_SECOND / (double) videotestsrc->rate; - res = TRUE; - break; - case GST_FORMAT_DEFAULT: /* frames */ - *value = videotestsrc->n_frames; - res = TRUE; - break; - default: - break; + case GST_FORMAT_TIME: + *value = + videotestsrc->n_frames * GST_SECOND / (double) videotestsrc->rate; + res = TRUE; + break; + case GST_FORMAT_DEFAULT: /* frames */ + *value = videotestsrc->n_frames; + res = TRUE; + break; + default: + break; } break; default: @@ -414,7 +414,7 @@ gst_videotestsrc_get (GstPad * pad) if (videotestsrc->fourcc == NULL) { GST_ELEMENT_ERROR (videotestsrc, CORE, NEGOTIATION, (NULL), - ("format wasn't negotiated before get function")); + ("format wasn't negotiated before get function")); return NULL; } @@ -433,7 +433,7 @@ gst_videotestsrc_get (GstPad * pad) if (videotestsrc->sync) { GST_BUFFER_TIMESTAMP (buf) = videotestsrc->timestamp_offset + - (videotestsrc->n_frames * GST_SECOND) / (double) videotestsrc->rate; + (videotestsrc->n_frames * GST_SECOND) / (double) videotestsrc->rate; videotestsrc->n_frames++; /* FIXME this is not correct if we do QoS */ @@ -442,7 +442,7 @@ gst_videotestsrc_get (GstPad * pad) } } else { GST_BUFFER_TIMESTAMP (buf) = videotestsrc->timestamp_offset + - (videotestsrc->n_frames * GST_SECOND) / (double) videotestsrc->rate; + (videotestsrc->n_frames * GST_SECOND) / (double) videotestsrc->rate; videotestsrc->n_frames++; } GST_BUFFER_DURATION (buf) = GST_SECOND / (double) videotestsrc->rate; diff --git a/gst/videotestsrc/videotestsrc.c b/gst/videotestsrc/videotestsrc.c index 2d7cb0007e..00b576693c 100644 --- a/gst/videotestsrc/videotestsrc.c +++ b/gst/videotestsrc/videotestsrc.c @@ -303,7 +303,7 @@ struct fourcc_list_struct fourcc_list[] = { {"YUY2", "YUY2", 16, paint_setup_YUY2, paint_hline_YUY2}, {"UYVY", "UYVY", 16, paint_setup_UYVY, paint_hline_YUY2}, {"Y422", "Y422", 16, paint_setup_UYVY, paint_hline_YUY2}, - {"UYNV", "UYNV", 16, paint_setup_UYVY, paint_hline_YUY2}, /* FIXME: UYNV? */ + {"UYNV", "UYNV", 16, paint_setup_UYVY, paint_hline_YUY2}, /* FIXME: UYNV? */ {"YVYU", "YVYU", 16, paint_setup_YVYU, paint_hline_YUY2}, /* interlaced */ @@ -394,7 +394,7 @@ paintinfo_find_by_structure (const GstStructure * structure) //g_print("testing " GST_FOURCC_FORMAT " and %s\n", GST_FOURCC_ARGS(format), s); fourcc = GST_MAKE_FOURCC (s[0], s[1], s[2], s[3]); if (fourcc == format) { - return fourcc_list + i; + return fourcc_list + i; } } } else if (strcmp (media_type, "video/x-raw-rgb") == 0) { @@ -412,11 +412,11 @@ paintinfo_find_by_structure (const GstStructure * structure) for (i = 0; i < n_fourccs; i++) { if (strcmp (fourcc_list[i].fourcc, "RGB ") == 0 && - fourcc_list[i].red_mask == red_mask && - fourcc_list[i].green_mask == green_mask && - fourcc_list[i].blue_mask == blue_mask && - fourcc_list[i].depth == depth && fourcc_list[i].bitspp == bpp) { - return fourcc_list + i; + fourcc_list[i].red_mask == red_mask && + fourcc_list[i].green_mask == green_mask && + fourcc_list[i].blue_mask == blue_mask && + fourcc_list[i].depth == depth && fourcc_list[i].bitspp == bpp) { + return fourcc_list + i; } } @@ -442,7 +442,7 @@ paintrect_find_fourcc (int find_fourcc) if (find_fourcc == fourcc) { /* If YUV format, it's good */ if (!fourcc_list[i].ext_caps) { - return fourcc_list + i; + return fourcc_list + i; } return fourcc_list + i; @@ -485,15 +485,15 @@ paint_get_structure (struct fourcc_list_struct * format) endianness = G_BIG_ENDIAN; } return gst_structure_new ("video/x-raw-rgb", - "bpp", G_TYPE_INT, format->bitspp, - "endianness", G_TYPE_INT, endianness, - "depth", G_TYPE_INT, format->depth, - "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); + "bpp", G_TYPE_INT, format->bitspp, + "endianness", G_TYPE_INT, endianness, + "depth", G_TYPE_INT, format->depth, + "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 { return gst_structure_new ("video/x-raw-yuv", - "format", GST_TYPE_FOURCC, fourcc, NULL); + "format", GST_TYPE_FOURCC, fourcc, NULL); } } @@ -612,12 +612,12 @@ gst_videotestsrc_smpte (GstVideotestsrc * v, unsigned char *dest, int w, int h) for (i = x1; i < w; i++) { for (j = y2; j < h; j++) { - /* FIXME not strictly correct */ - color.Y = random_char (); - color.R = color.Y; - color.G = color.Y; - color.B = color.Y; - p->paint_hline (p, i, j, 1); + /* FIXME not strictly correct */ + color.Y = random_char (); + color.R = color.Y; + color.G = color.Y; + color.B = color.Y; + p->paint_hline (p, i, j, 1); } } diff --git a/gst/volume/gstvolume.c b/gst/volume/gstvolume.c index daabfb1842..83c230b7c7 100644 --- a/gst/volume/gstvolume.c +++ b/gst/volume/gstvolume.c @@ -32,9 +32,9 @@ /* the volume factor is a range from 0.0 to (arbitrary) 4.0 * we map 1.0 to VOLUME_UNITY_INT */ -#define VOLUME_UNITY_INT 8192 /* internal int for unity */ -#define VOLUME_UNITY_BIT_SHIFT 13 /* number of bits to shift - for unity */ +#define VOLUME_UNITY_INT 8192 /* internal int for unity */ +#define VOLUME_UNITY_BIT_SHIFT 13 /* number of bits to shift + for unity */ #define VOLUME_MAX_DOUBLE 4.0 #define VOLUME_MAX_INT16 32767 #define VOLUME_MIN_INT16 -32768 @@ -70,32 +70,32 @@ static GstStaticPadTemplate volume_sink_factory = GST_PAD_SINK, GST_PAD_ALWAYS, GST_STATIC_CAPS ("audio/x-raw-float, " - "rate = (int) [ 1, MAX ], " - "channels = (int) [ 1, MAX ], " - "endianness = (int) BYTE_ORDER, " - "width = (int) 32, " - "buffer-frames = (int) [ 1, MAX]; " - "audio/x-raw-int, " - "channels = (int) [ 1, MAX ], " - "rate = (int) [ 1, MAX ], " - "endianness = (int) BYTE_ORDER, " - "width = (int) 16, " "depth = (int) 16, " "signed = (bool) TRUE") + "rate = (int) [ 1, MAX ], " + "channels = (int) [ 1, MAX ], " + "endianness = (int) BYTE_ORDER, " + "width = (int) 32, " + "buffer-frames = (int) [ 1, MAX]; " + "audio/x-raw-int, " + "channels = (int) [ 1, MAX ], " + "rate = (int) [ 1, MAX ], " + "endianness = (int) BYTE_ORDER, " + "width = (int) 16, " "depth = (int) 16, " "signed = (bool) TRUE") ); static GstStaticPadTemplate volume_src_factory = GST_STATIC_PAD_TEMPLATE ("src", GST_PAD_SRC, GST_PAD_ALWAYS, GST_STATIC_CAPS ("audio/x-raw-float, " - "rate = (int) [ 1, MAX ], " - "channels = (int) [ 1, MAX ], " - "endianness = (int) BYTE_ORDER, " - "width = (int) 32, " - "buffer-frames = (int) [ 1, MAX]; " - "audio/x-raw-int, " - "channels = (int) [ 1, MAX ], " - "rate = (int) [ 1, MAX ], " - "endianness = (int) BYTE_ORDER, " - "width = (int) 16, " "depth = (int) 16, " "signed = (bool) TRUE") + "rate = (int) [ 1, MAX ], " + "channels = (int) [ 1, MAX ], " + "endianness = (int) BYTE_ORDER, " + "width = (int) 32, " + "buffer-frames = (int) [ 1, MAX]; " + "audio/x-raw-int, " + "channels = (int) [ 1, MAX ], " + "rate = (int) [ 1, MAX ], " + "endianness = (int) BYTE_ORDER, " + "width = (int) 16, " "depth = (int) 16, " "signed = (bool) TRUE") ); static void volume_base_init (gpointer g_class); @@ -311,9 +311,9 @@ gst_volume_get_type (void) }; volume_type = - g_type_register_static (GST_TYPE_ELEMENT, "GstVolume", &volume_info, 0); + g_type_register_static (GST_TYPE_ELEMENT, "GstVolume", &volume_info, 0); g_type_add_interface_static (volume_type, GST_TYPE_IMPLEMENTS_INTERFACE, - &voliface_info); + &voliface_info); g_type_add_interface_static (volume_type, GST_TYPE_MIXER, &volmixer_info); } return volume_type; @@ -345,7 +345,7 @@ volume_class_init (GstVolumeClass * klass) g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_VOLUME, g_param_spec_double ("volume", "volume", "volume", - 0.0, VOLUME_MAX_DOUBLE, 1.0, G_PARAM_READWRITE)); + 0.0, VOLUME_MAX_DOUBLE, 1.0, G_PARAM_READWRITE)); gobject_class->set_property = volume_set_property; gobject_class->get_property = volume_get_property; @@ -384,10 +384,10 @@ volume_init (GstVolume * filter) filter->dpman = gst_dpman_new ("volume_dpman", GST_ELEMENT (filter)); gst_dpman_add_required_dparam_callback (filter->dpman, g_param_spec_int ("mute", "Mute", "Mute the audio", - 0, 1, 0, G_PARAM_READWRITE), "int", volume_update_mute, filter); + 0, 1, 0, G_PARAM_READWRITE), "int", volume_update_mute, filter); gst_dpman_add_required_dparam_callback (filter->dpman, g_param_spec_double ("volume", "Volume", "Volume of the audio", - 0.0, VOLUME_MAX_DOUBLE, 1.0, G_PARAM_READWRITE), + 0.0, VOLUME_MAX_DOUBLE, 1.0, G_PARAM_READWRITE), "scalar", volume_update_volume, filter); track = g_object_new (GST_TYPE_MIXER_TRACK, NULL); @@ -461,20 +461,20 @@ volume_chain_int16 (GstPad * pad, GstData * _data) /* only clamp if the gain is greater than 1.0 */ if (filter->real_vol_i > VOLUME_UNITY_INT) { while (i < GST_DPMAN_NEXT_UPDATE_FRAME (filter->dpman)) { - /* we use bitshifting instead of dividing by UNITY_INT for speed */ - data[i] = - (gint16) CLAMP ((filter->real_vol_i * - (gint) data[i]) >> VOLUME_UNITY_BIT_SHIFT, VOLUME_MIN_INT16, - VOLUME_MAX_INT16); - i++; + /* we use bitshifting instead of dividing by UNITY_INT for speed */ + data[i] = + (gint16) CLAMP ((filter->real_vol_i * + (gint) data[i]) >> VOLUME_UNITY_BIT_SHIFT, VOLUME_MIN_INT16, + VOLUME_MAX_INT16); + i++; } } else { while (i < GST_DPMAN_NEXT_UPDATE_FRAME (filter->dpman)) { - /* we use bitshifting instead of dividing by UNITY_INT for speed */ - data[i] = - (gint16) ((filter->real_vol_i * - (gint) data[i]) >> VOLUME_UNITY_BIT_SHIFT); - i++; + /* we use bitshifting instead of dividing by UNITY_INT for speed */ + data[i] = + (gint16) ((filter->real_vol_i * + (gint) data[i]) >> VOLUME_UNITY_BIT_SHIFT); + i++; } } } diff --git a/sys/v4l/gstv4l.c b/sys/v4l/gstv4l.c index ec0aaf43cb..b3f9c5011d 100644 --- a/sys/v4l/gstv4l.c +++ b/sys/v4l/gstv4l.c @@ -39,13 +39,13 @@ plugin_init (GstPlugin * plugin) return FALSE; if (!gst_element_register (plugin, "v4lelement", - GST_RANK_NONE, GST_TYPE_V4LELEMENT) || + GST_RANK_NONE, GST_TYPE_V4LELEMENT) || !gst_element_register (plugin, "v4lsrc", - GST_RANK_NONE, GST_TYPE_V4LSRC) || + GST_RANK_NONE, GST_TYPE_V4LSRC) || !gst_element_register (plugin, "v4lmjpegsrc", - GST_RANK_NONE, GST_TYPE_V4LMJPEGSRC) || + GST_RANK_NONE, GST_TYPE_V4LMJPEGSRC) || !gst_element_register (plugin, "v4lmjpegsink", - GST_RANK_NONE, GST_TYPE_V4LMJPEGSINK)) + GST_RANK_NONE, GST_TYPE_V4LMJPEGSINK)) return FALSE; #ifdef ENABLE_NLS diff --git a/sys/v4l/gstv4lcolorbalance.c b/sys/v4l/gstv4lcolorbalance.c index 55d8b3e018..a224120adb 100644 --- a/sys/v4l/gstv4lcolorbalance.c +++ b/sys/v4l/gstv4lcolorbalance.c @@ -62,8 +62,8 @@ gst_v4l_color_balance_channel_get_type (void) }; gst_v4l_color_balance_channel_type = - g_type_register_static (GST_TYPE_COLOR_BALANCE_CHANNEL, - "GstV4lColorBalanceChannel", &v4l_tuner_channel_info, 0); + g_type_register_static (GST_TYPE_COLOR_BALANCE_CHANNEL, + "GstV4lColorBalanceChannel", &v4l_tuner_channel_info, 0); } return gst_v4l_color_balance_channel_type; @@ -123,7 +123,7 @@ gst_v4l_color_balance_set_value (GstColorBalance * balance, /* assert that we're opened and that we're using a known item */ g_return_if_fail (GST_V4L_IS_OPEN (v4lelement)); g_return_if_fail (gst_v4l_color_balance_contains_channel (v4lelement, - v4lchannel)); + v4lchannel)); gst_v4l_set_picture (v4lelement, v4lchannel->index, value); } @@ -140,7 +140,7 @@ gst_v4l_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_V4L_IS_OPEN (v4lelement), 0); g_return_val_if_fail (gst_v4l_color_balance_contains_channel (v4lelement, - v4lchannel), 0); + v4lchannel), 0); if (!gst_v4l_get_picture (v4lelement, v4lchannel->index, &value)) return 0; diff --git a/sys/v4l/gstv4lelement.c b/sys/v4l/gstv4lelement.c index c3f707a43b..f06c02e71d 100644 --- a/sys/v4l/gstv4lelement.c +++ b/sys/v4l/gstv4lelement.c @@ -131,21 +131,21 @@ gst_v4l_class_probe_devices (GstV4lElementClass * 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); } } @@ -317,18 +317,18 @@ gst_v4lelement_get_type (void) }; v4lelement_type = g_type_register_static (GST_TYPE_ELEMENT, - "GstV4lElement", &v4lelement_info, 0); + "GstV4lElement", &v4lelement_info, 0); g_type_add_interface_static (v4lelement_type, - GST_TYPE_IMPLEMENTS_INTERFACE, &v4liface_info); + GST_TYPE_IMPLEMENTS_INTERFACE, &v4liface_info); g_type_add_interface_static (v4lelement_type, - GST_TYPE_TUNER, &v4l_tuner_info); + GST_TYPE_TUNER, &v4l_tuner_info); g_type_add_interface_static (v4lelement_type, - GST_TYPE_X_OVERLAY, &v4l_xoverlay_info); + GST_TYPE_X_OVERLAY, &v4l_xoverlay_info); g_type_add_interface_static (v4lelement_type, - GST_TYPE_COLOR_BALANCE, &v4l_colorbalance_info); + GST_TYPE_COLOR_BALANCE, &v4l_colorbalance_info); g_type_add_interface_static (v4lelement_type, - GST_TYPE_PROPERTY_PROBE, &v4l_propertyprobe_info); + GST_TYPE_PROPERTY_PROBE, &v4l_propertyprobe_info); } return v4lelement_type; @@ -359,13 +359,13 @@ gst_v4lelement_class_init (GstV4lElementClass * klass) g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_DEVICE, g_param_spec_string ("device", "Device", "Device location", - NULL, G_PARAM_READWRITE)); + NULL, 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)); g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_FLAGS, g_param_spec_flags ("flags", "Flags", "Device type flags", - GST_TYPE_V4L_DEVICE_FLAGS, 0, G_PARAM_READABLE)); + GST_TYPE_V4L_DEVICE_FLAGS, 0, G_PARAM_READABLE)); /* signals */ gst_v4lelement_signals[SIGNAL_OPEN] = @@ -438,7 +438,7 @@ gst_v4lelement_set_property (GObject * object, switch (prop_id) { case ARG_DEVICE: if (v4lelement->videodev) - g_free (v4lelement->videodev); + g_free (v4lelement->videodev); v4lelement->videodev = g_strdup (g_value_get_string (value)); break; default: @@ -466,7 +466,7 @@ gst_v4lelement_get_property (GObject * object, gchar *new = NULL; if (GST_V4L_IS_OPEN (v4lelement)) - new = v4lelement->vcap.name; + new = v4lelement->vcap.name; g_value_set_string (value, new); break; } @@ -474,9 +474,9 @@ gst_v4lelement_get_property (GObject * object, guint flags = 0; if (GST_V4L_IS_OPEN (v4lelement)) { - flags |= v4lelement->vcap.type & 0x3C0B; - if (v4lelement->vcap.audios) - flags |= 0x10000; + flags |= v4lelement->vcap.type & 0x3C0B; + if (v4lelement->vcap.audios) + flags |= 0x10000; } g_value_set_flags (value, flags); break; @@ -505,22 +505,22 @@ gst_v4lelement_change_state (GstElement * element) gst_v4l_set_overlay (v4lelement); if (!gst_v4l_open (v4lelement)) - return GST_STATE_FAILURE; + return GST_STATE_FAILURE; gst_v4l_xoverlay_open (v4lelement); g_signal_emit (G_OBJECT (v4lelement), - gst_v4lelement_signals[SIGNAL_OPEN], 0, v4lelement->videodev); + gst_v4lelement_signals[SIGNAL_OPEN], 0, v4lelement->videodev); break; case GST_STATE_READY_TO_NULL: gst_v4l_xoverlay_close (v4lelement); if (!gst_v4l_close (v4lelement)) - return GST_STATE_FAILURE; + return GST_STATE_FAILURE; g_signal_emit (G_OBJECT (v4lelement), - gst_v4lelement_signals[SIGNAL_CLOSE], 0, v4lelement->videodev); + gst_v4lelement_signals[SIGNAL_CLOSE], 0, v4lelement->videodev); break; } diff --git a/sys/v4l/gstv4lmjpegsink.c b/sys/v4l/gstv4lmjpegsink.c index 722cb880c1..999dfe5b24 100644 --- a/sys/v4l/gstv4lmjpegsink.c +++ b/sys/v4l/gstv4lmjpegsink.c @@ -92,9 +92,10 @@ gst_v4lmjpegsink_get_type (void) 0, (GInstanceInitFunc) gst_v4lmjpegsink_init, }; + v4lmjpegsink_type = - g_type_register_static (GST_TYPE_V4LELEMENT, "GstV4lMjpegSink", - &v4lmjpegsink_info, 0); + g_type_register_static (GST_TYPE_V4LELEMENT, "GstV4lMjpegSink", + &v4lmjpegsink_info, 0); } return v4lmjpegsink_type; } @@ -106,8 +107,8 @@ gst_v4lmjpegsink_base_init (gpointer g_class) GST_PAD_SINK, GST_PAD_ALWAYS, GST_STATIC_CAPS ("video/x-jpeg, " - "width = (int) [ 1, MAX ], " - "height = (int) [ 1, MAX ], " "framerate = (double) [ 0, MAX ]") + "width = (int) [ 1, MAX ], " + "height = (int) [ 1, MAX ], " "framerate = (double) [ 0, MAX ]") ); GstElementClass *gstelement_class = GST_ELEMENT_CLASS (g_class); @@ -129,24 +130,24 @@ gst_v4lmjpegsink_class_init (GstV4lMjpegSinkClass * klass) g_object_class_install_property (G_OBJECT_CLASS (klass), 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 (G_OBJECT_CLASS (klass), ARG_BUFSIZE, g_param_spec_int ("buffer_size", "buffer_size", "buffer_size", - G_MININT, G_MAXINT, 0, G_PARAM_READWRITE)); + G_MININT, G_MAXINT, 0, G_PARAM_READWRITE)); g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_X_OFFSET, g_param_spec_int ("x_offset", "x_offset", "x_offset", - G_MININT, G_MAXINT, 0, G_PARAM_WRITABLE)); + G_MININT, G_MAXINT, 0, G_PARAM_WRITABLE)); g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_Y_OFFSET, g_param_spec_int ("y_offset", "y_offset", "y_offset", - G_MININT, G_MAXINT, 0, G_PARAM_WRITABLE)); + G_MININT, G_MAXINT, 0, G_PARAM_WRITABLE)); 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)); + "frames_displayed", G_MININT, G_MAXINT, 0, G_PARAM_READABLE)); 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)); + G_MAXINT, 0, G_PARAM_READABLE)); gobject_class->set_property = gst_v4lmjpegsink_set_property; gobject_class->get_property = gst_v4lmjpegsink_get_property; @@ -154,7 +155,7 @@ gst_v4lmjpegsink_class_init (GstV4lMjpegSinkClass * klass) gst_v4lmjpegsink_signals[SIGNAL_FRAME_DISPLAYED] = g_signal_new ("frame-displayed", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (GstV4lMjpegSinkClass, - frame_displayed), NULL, NULL, g_cclosure_marshal_VOID__VOID, + frame_displayed), NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0); gstelement_class->change_state = gst_v4lmjpegsink_change_state; @@ -169,7 +170,7 @@ gst_v4lmjpegsink_init (GstV4lMjpegSink * v4lmjpegsink) v4lmjpegsink->sinkpad = gst_pad_new_from_template (gst_element_class_get_pad_template (klass, - "sink"), "sink"); + "sink"), "sink"); gst_element_add_pad (GST_ELEMENT (v4lmjpegsink), v4lmjpegsink->sinkpad); gst_pad_set_chain_function (v4lmjpegsink->sinkpad, gst_v4lmjpegsink_chain); @@ -210,12 +211,12 @@ gst_v4lmjpegsink_sinkconnect (GstPad * pad, const GstCaps * vscapslist) gst_structure_get_int (structure, "width", &v4lmjpegsink->width); gst_structure_get_int (structure, "height", &v4lmjpegsink->height); - if (!gst_v4lmjpegsink_set_playback (v4lmjpegsink, v4lmjpegsink->width, v4lmjpegsink->height, v4lmjpegsink->x_offset, v4lmjpegsink->y_offset, GST_V4LELEMENT (v4lmjpegsink)->vchan.norm, 0)) /* TODO: interlacing */ + if (!gst_v4lmjpegsink_set_playback (v4lmjpegsink, v4lmjpegsink->width, v4lmjpegsink->height, v4lmjpegsink->x_offset, v4lmjpegsink->y_offset, GST_V4LELEMENT (v4lmjpegsink)->vchan.norm, 0)) /* TODO: interlacing */ return GST_PAD_LINK_REFUSED; /* set buffer info */ if (!gst_v4lmjpegsink_set_buffer (v4lmjpegsink, - v4lmjpegsink->numbufs, v4lmjpegsink->bufsize)) + v4lmjpegsink->numbufs, v4lmjpegsink->bufsize)) return GST_PAD_LINK_REFUSED; if (!gst_v4lmjpegsink_playback_init (v4lmjpegsink)) return GST_PAD_LINK_REFUSED; @@ -249,7 +250,7 @@ gst_v4lmjpegsink_chain (GstPad * pad, GstData * _data) if (v4lmjpegsink->clock) { GST_DEBUG ("videosink: clock wait: %" G_GUINT64_FORMAT, - GST_BUFFER_TIMESTAMP (buf)); + GST_BUFFER_TIMESTAMP (buf)); gst_element_wait (GST_ELEMENT (v4lmjpegsink), GST_BUFFER_TIMESTAMP (buf)); } @@ -262,15 +263,15 @@ gst_v4lmjpegsink_chain (GstPad * pad, GstData * _data) /* check size */ if (GST_BUFFER_SIZE (buf) > v4lmjpegsink->breq.size) { GST_ELEMENT_ERROR (v4lmjpegsink, RESOURCE, WRITE, (NULL), - ("Buffer too big (%d KB), max. buffersize is %ld KB", - GST_BUFFER_SIZE (buf) / 1024, v4lmjpegsink->breq.size / 1024)); + ("Buffer too big (%d KB), max. buffersize is %ld KB", + GST_BUFFER_SIZE (buf) / 1024, v4lmjpegsink->breq.size / 1024)); return; } /* put JPEG data to the device */ gst_v4lmjpegsink_wait_frame (v4lmjpegsink, &num); memcpy (gst_v4lmjpegsink_get_buffer (v4lmjpegsink, num), - GST_BUFFER_DATA (buf), GST_BUFFER_SIZE (buf)); + GST_BUFFER_DATA (buf), GST_BUFFER_SIZE (buf)); gst_v4lmjpegsink_play_frame (v4lmjpegsink, num); #if 0 } @@ -297,7 +298,7 @@ gst_v4lmjpegsink_buffer_new (GstBufferPool * pool, return NULL; if (v4lmjpegsink->breq.size < size) { GST_DEBUG ("Requested buffer size is too large (%d > %ld)", - size, v4lmjpegsink->breq.size); + size, v4lmjpegsink->breq.size); return NULL; } if (!gst_v4lmjpegsink_wait_frame (v4lmjpegsink, &num)) @@ -398,17 +399,17 @@ gst_v4lmjpegsink_change_state (GstElement * element) case GST_STATE_PAUSED_TO_PLAYING: /* start */ if (!gst_v4lmjpegsink_playback_start (v4lmjpegsink)) - return GST_STATE_FAILURE; + return GST_STATE_FAILURE; break; case GST_STATE_PLAYING_TO_PAUSED: /* de-queue all queued buffers */ if (!gst_v4lmjpegsink_playback_stop (v4lmjpegsink)) - return GST_STATE_FAILURE; + return GST_STATE_FAILURE; break; case GST_STATE_PAUSED_TO_READY: /* stop playback, unmap all buffers */ if (!gst_v4lmjpegsink_playback_deinit (v4lmjpegsink)) - return GST_STATE_FAILURE; + return GST_STATE_FAILURE; break; } diff --git a/sys/v4l/gstv4lmjpegsrc.c b/sys/v4l/gstv4lmjpegsrc.c index c1b90ca4bb..a0c7d28e07 100644 --- a/sys/v4l/gstv4lmjpegsrc.c +++ b/sys/v4l/gstv4lmjpegsrc.c @@ -121,9 +121,10 @@ gst_v4lmjpegsrc_get_type (void) (GInstanceInitFunc) gst_v4lmjpegsrc_init, NULL }; + v4lmjpegsrc_type = - g_type_register_static (GST_TYPE_V4LELEMENT, "GstV4lMjpegSrc", - &v4lmjpegsrc_info, 0); + g_type_register_static (GST_TYPE_V4LELEMENT, "GstV4lMjpegSrc", + &v4lmjpegsrc_info, 0); } return v4lmjpegsrc_type; } @@ -136,8 +137,8 @@ gst_v4lmjpegsrc_base_init (gpointer g_class) GST_PAD_SRC, GST_PAD_ALWAYS, GST_STATIC_CAPS ("video/x-jpeg, " - "width = (int) [ 0, MAX ], " - "height = (int) [ 0, MAX ], " "framerate = (double) [ 0, MAX ]") + "width = (int) [ 0, MAX ], " + "height = (int) [ 0, MAX ], " "framerate = (double) [ 0, MAX ]") ); GstElementClass *gstelement_class = GST_ELEMENT_CLASS (g_class); @@ -160,34 +161,34 @@ gst_v4lmjpegsrc_class_init (GstV4lMjpegSrcClass * klass) #if 0 g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_X_OFFSET, g_param_spec_int ("x_offset", "x_offset", "x_offset", - G_MININT, G_MAXINT, 0, G_PARAM_WRITABLE)); + G_MININT, G_MAXINT, 0, G_PARAM_WRITABLE)); g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_Y_OFFSET, g_param_spec_int ("y_offset", "y_offset", "y_offset", - G_MININT, G_MAXINT, 0, G_PARAM_WRITABLE)); + G_MININT, G_MAXINT, 0, G_PARAM_WRITABLE)); g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_F_WIDTH, g_param_spec_int ("frame_width", "frame_width", "frame_width", - G_MININT, G_MAXINT, 0, G_PARAM_WRITABLE)); + G_MININT, G_MAXINT, 0, G_PARAM_WRITABLE)); g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_F_HEIGHT, g_param_spec_int ("frame_height", "frame_height", "frame_height", - G_MININT, G_MAXINT, 0, G_PARAM_WRITABLE)); + G_MININT, G_MAXINT, 0, G_PARAM_WRITABLE)); #endif g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_QUALITY, g_param_spec_int ("quality", "Quality", "JPEG frame quality", - 1, 100, 50, G_PARAM_READWRITE)); + 1, 100, 50, G_PARAM_READWRITE)); g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_NUMBUFS, g_param_spec_int ("num_buffers", "Num Buffers", "Number of Buffers", - 1, 256, 64, G_PARAM_READWRITE)); + 1, 256, 64, G_PARAM_READWRITE)); g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_BUFSIZE, g_param_spec_int ("buffer_size", "Buffer Size", "Size of buffers", - 0, 512 * 1024, 128 * 1024, G_PARAM_READABLE)); + 0, 512 * 1024, 128 * 1024, G_PARAM_READABLE)); g_object_class_install_property (G_OBJECT_CLASS (klass), 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_v4lmjpegsrc_signals[SIGNAL_FRAME_CAPTURE] = @@ -225,7 +226,7 @@ gst_v4lmjpegsrc_init (GstV4lMjpegSrc * v4lmjpegsrc) v4lmjpegsrc->srcpad = gst_pad_new_from_template (gst_element_class_get_pad_template (klass, - "src"), "src"); + "src"), "src"); gst_element_add_pad (GST_ELEMENT (v4lmjpegsrc), v4lmjpegsrc->srcpad); gst_pad_set_get_function (v4lmjpegsrc->srcpad, gst_v4lmjpegsrc_get); @@ -268,7 +269,7 @@ gst_v4lmjpegsrc_get_fps (GstV4lMjpegSrc * v4lmjpegsrc) v4lmjpegsrc->clock != NULL && v4lmjpegsrc->handled > 0) { /* try to get time from clock master and calculate fps */ GstClockTime time = - gst_clock_get_time (v4lmjpegsrc->clock) - v4lmjpegsrc->substract_time; + gst_clock_get_time (v4lmjpegsrc->clock) - v4lmjpegsrc->substract_time; return v4lmjpegsrc->handled * GST_SECOND / time; } @@ -304,21 +305,21 @@ gst_v4lmjpegsrc_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; @@ -343,15 +344,15 @@ gst_v4lmjpegsrc_src_query (GstPad * pad, switch (type) { case GST_QUERY_POSITION: switch (*format) { - case GST_FORMAT_TIME: - *value = v4lmjpegsrc->handled * GST_SECOND / fps; - break; - case GST_FORMAT_DEFAULT: - *value = v4lmjpegsrc->handled; - break; - default: - res = FALSE; - break; + case GST_FORMAT_TIME: + *value = v4lmjpegsrc->handled * GST_SECOND / fps; + break; + case GST_FORMAT_DEFAULT: + *value = v4lmjpegsrc->handled; + break; + default: + res = FALSE; + break; } break; default: @@ -439,12 +440,12 @@ gst_v4lmjpegsrc_srcconnect (GstPad * pad, const GstCaps * caps) /* set capture parameters and mmap the buffers */ if (hor_dec == ver_dec) { if (!gst_v4lmjpegsrc_set_capture (v4lmjpegsrc, - hor_dec, v4lmjpegsrc->quality)) { + hor_dec, v4lmjpegsrc->quality)) { return GST_PAD_LINK_REFUSED; } } else { if (!gst_v4lmjpegsrc_set_capture_m (v4lmjpegsrc, - 0, 0, max_w, max_h, hor_dec, ver_dec, v4lmjpegsrc->quality)) { + 0, 0, max_w, max_h, hor_dec, ver_dec, v4lmjpegsrc->quality)) { return GST_PAD_LINK_REFUSED; } } @@ -453,14 +454,14 @@ gst_v4lmjpegsrc_srcconnect (GstPad * pad, const GstCaps * caps) v4lmjpegsrc->x_offset < 0 && v4lmjpegsrc->y_offset < 0 && v4lmjpegsrc->horizontal_decimation == v4lmjpegsrc->vertical_decimation) { if (!gst_v4lmjpegsrc_set_capture (v4lmjpegsrc, - v4lmjpegsrc->horizontal_decimation, v4lmjpegsrc->quality)) + v4lmjpegsrc->horizontal_decimation, v4lmjpegsrc->quality)) return GST_PAD_LINK_REFUSED; } else { if (!gst_v4lmjpegsrc_set_capture_m (v4lmjpegsrc, - v4lmjpegsrc->x_offset, v4lmjpegsrc->y_offset, - v4lmjpegsrc->frame_width, v4lmjpegsrc->frame_height, - v4lmjpegsrc->horizontal_decimation, - v4lmjpegsrc->vertical_decimation, v4lmjpegsrc->quality)) + v4lmjpegsrc->x_offset, v4lmjpegsrc->y_offset, + v4lmjpegsrc->frame_width, v4lmjpegsrc->frame_height, + v4lmjpegsrc->horizontal_decimation, + v4lmjpegsrc->vertical_decimation, v4lmjpegsrc->quality)) return GST_PAD_LINK_REFUSED; } #endif @@ -499,22 +500,22 @@ gst_v4lmjpegsrc_get (GstPad * pad) /* grab a frame from the device */ if (!gst_v4lmjpegsrc_grab_frame (v4lmjpegsrc, &num, - &v4lmjpegsrc->last_size)) - return NULL; + &v4lmjpegsrc->last_size)) + return NULL; v4lmjpegsrc->last_frame = num; time = GST_TIMEVAL_TO_TIME (v4lmjpegsrc->bsync.timestamp) - - v4lmjpegsrc->substract_time; + v4lmjpegsrc->substract_time; /* first check whether we lost any frames according to the device */ if (v4lmjpegsrc->last_seq != 0) { - if (v4lmjpegsrc->bsync.seq - v4lmjpegsrc->last_seq > 1) { - v4lmjpegsrc->need_writes = - v4lmjpegsrc->bsync.seq - v4lmjpegsrc->last_seq; - g_signal_emit (G_OBJECT (v4lmjpegsrc), - gst_v4lmjpegsrc_signals[SIGNAL_FRAME_LOST], 0, - v4lmjpegsrc->bsync.seq - v4lmjpegsrc->last_seq - 1); - } + if (v4lmjpegsrc->bsync.seq - v4lmjpegsrc->last_seq > 1) { + v4lmjpegsrc->need_writes = + v4lmjpegsrc->bsync.seq - v4lmjpegsrc->last_seq; + g_signal_emit (G_OBJECT (v4lmjpegsrc), + gst_v4lmjpegsrc_signals[SIGNAL_FRAME_LOST], 0, + v4lmjpegsrc->bsync.seq - v4lmjpegsrc->last_seq - 1); + } } v4lmjpegsrc->last_seq = v4lmjpegsrc->bsync.seq; @@ -529,31 +530,31 @@ gst_v4lmjpegsrc_get (GstPad * pad) * we want to have written X*fps frames. If we've written * more - drop, if we've written less - dup... */ if (v4lmjpegsrc->handled * (GST_SECOND / fps) - time > - 1.5 * (GST_SECOND / fps)) { - /* yo dude, we've got too many frames here! Drop! DROP! */ - v4lmjpegsrc->need_writes--; /* -= (v4lmjpegsrc->handled - (time / fps)); */ - g_signal_emit (G_OBJECT (v4lmjpegsrc), - gst_v4lmjpegsrc_signals[SIGNAL_FRAME_DROP], 0); + 1.5 * (GST_SECOND / fps)) { + /* yo dude, we've got too many frames here! Drop! DROP! */ + v4lmjpegsrc->need_writes--; /* -= (v4lmjpegsrc->handled - (time / fps)); */ + g_signal_emit (G_OBJECT (v4lmjpegsrc), + gst_v4lmjpegsrc_signals[SIGNAL_FRAME_DROP], 0); } else if (v4lmjpegsrc->handled * (GST_SECOND / fps) - time < - -1.5 * (GST_SECOND / fps)) { - /* this means we're lagging far behind */ - v4lmjpegsrc->need_writes++; /* += ((time / fps) - v4lmjpegsrc->handled); */ - g_signal_emit (G_OBJECT (v4lmjpegsrc), - gst_v4lmjpegsrc_signals[SIGNAL_FRAME_INSERT], 0); + -1.5 * (GST_SECOND / fps)) { + /* this means we're lagging far behind */ + v4lmjpegsrc->need_writes++; /* += ((time / fps) - v4lmjpegsrc->handled); */ + g_signal_emit (G_OBJECT (v4lmjpegsrc), + gst_v4lmjpegsrc_signals[SIGNAL_FRAME_INSERT], 0); } if (v4lmjpegsrc->need_writes > 0) { - have_frame = TRUE; - v4lmjpegsrc->use_num_times[num] = v4lmjpegsrc->need_writes; - v4lmjpegsrc->need_writes--; + have_frame = TRUE; + v4lmjpegsrc->use_num_times[num] = v4lmjpegsrc->need_writes; + v4lmjpegsrc->need_writes--; } else { - gst_v4lmjpegsrc_requeue_frame (v4lmjpegsrc, num); + gst_v4lmjpegsrc_requeue_frame (v4lmjpegsrc, num); } } while (!have_frame); } else { /* grab a frame from the device */ if (!gst_v4lmjpegsrc_grab_frame (v4lmjpegsrc, &num, - &v4lmjpegsrc->last_size)) + &v4lmjpegsrc->last_size)) return NULL; v4lmjpegsrc->use_num_times[num] = 1; @@ -568,10 +569,10 @@ gst_v4lmjpegsrc_get (GstPad * pad) GST_BUFFER_FLAG_SET (buf, GST_BUFFER_READONLY | GST_BUFFER_DONTFREE); if (v4lmjpegsrc->use_fixed_fps) GST_BUFFER_TIMESTAMP (buf) = v4lmjpegsrc->handled * GST_SECOND / fps; - else /* calculate time based on our own clock */ + else /* calculate time based on our own clock */ GST_BUFFER_TIMESTAMP (buf) = - GST_TIMEVAL_TO_TIME (v4lmjpegsrc->bsync.timestamp) - - v4lmjpegsrc->substract_time; + GST_TIMEVAL_TO_TIME (v4lmjpegsrc->bsync.timestamp) - + v4lmjpegsrc->substract_time; v4lmjpegsrc->handled++; g_signal_emit (G_OBJECT (v4lmjpegsrc), @@ -630,7 +631,7 @@ gst_v4lmjpegsrc_set_property (GObject * object, break; case ARG_USE_FIXED_FPS: if (!GST_V4L_IS_ACTIVE (GST_V4LELEMENT (v4lmjpegsrc))) { - v4lmjpegsrc->use_fixed_fps = g_value_get_boolean (value); + v4lmjpegsrc->use_fixed_fps = g_value_get_boolean (value); } break; default: @@ -669,9 +670,9 @@ gst_v4lmjpegsrc_get_property (GObject * object, break; case ARG_NUMBUFS: if (GST_V4L_IS_ACTIVE (GST_V4LELEMENT (v4lmjpegsrc))) - g_value_set_int (value, v4lmjpegsrc->breq.count); + g_value_set_int (value, v4lmjpegsrc->breq.count); else - g_value_set_int (value, v4lmjpegsrc->numbufs); + g_value_set_int (value, v4lmjpegsrc->numbufs); break; case ARG_BUFSIZE: g_value_set_int (value, v4lmjpegsrc->breq.size); @@ -708,24 +709,24 @@ gst_v4lmjpegsrc_change_state (GstElement * element) case GST_STATE_PAUSED_TO_PLAYING: /* queue all buffer, start streaming capture */ if (!gst_v4lmjpegsrc_capture_start (v4lmjpegsrc)) - return GST_STATE_FAILURE; + return GST_STATE_FAILURE; g_get_current_time (&time); v4lmjpegsrc->substract_time = GST_TIMEVAL_TO_TIME (time) - - v4lmjpegsrc->substract_time; + v4lmjpegsrc->substract_time; v4lmjpegsrc->last_seq = 0; break; case GST_STATE_PLAYING_TO_PAUSED: g_get_current_time (&time); v4lmjpegsrc->substract_time = GST_TIMEVAL_TO_TIME (time) - - v4lmjpegsrc->substract_time; + v4lmjpegsrc->substract_time; /* de-queue all queued buffers */ if (!gst_v4lmjpegsrc_capture_stop (v4lmjpegsrc)) - return GST_STATE_FAILURE; + return GST_STATE_FAILURE; break; case GST_STATE_PAUSED_TO_READY: /* stop capturing, unmap all buffers */ if (!gst_v4lmjpegsrc_capture_deinit (v4lmjpegsrc)) - return GST_STATE_FAILURE; + return GST_STATE_FAILURE; break; } @@ -773,18 +774,18 @@ gst_v4lmjpegsrc_buffer_free (GstBuffer * buf) int n; if (gst_element_get_state (GST_ELEMENT (v4lmjpegsrc)) != GST_STATE_PLAYING) - return; /* we've already cleaned up ourselves */ + return; /* we've already cleaned up ourselves */ for (n = 0; n < v4lmjpegsrc->breq.count; n++) if (GST_BUFFER_DATA (buf) == gst_v4lmjpegsrc_get_buffer (v4lmjpegsrc, n)) { v4lmjpegsrc->use_num_times[n]--; if (v4lmjpegsrc->use_num_times[n] <= 0) { - gst_v4lmjpegsrc_requeue_frame (v4lmjpegsrc, n); + gst_v4lmjpegsrc_requeue_frame (v4lmjpegsrc, n); } break; } if (n == v4lmjpegsrc->breq.count) GST_ELEMENT_ERROR (v4lmjpegsrc, RESOURCE, TOO_LAZY, (NULL), - ("Couldn't find the buffer")); + ("Couldn't find the buffer")); } diff --git a/sys/v4l/gstv4lsrc.c b/sys/v4l/gstv4lsrc.c index 58d1f0ea74..4406f34525 100644 --- a/sys/v4l/gstv4lsrc.c +++ b/sys/v4l/gstv4lsrc.c @@ -115,9 +115,10 @@ gst_v4lsrc_get_type (void) (GInstanceInitFunc) gst_v4lsrc_init, NULL }; + v4lsrc_type = - g_type_register_static (GST_TYPE_V4LELEMENT, "GstV4lSrc", &v4lsrc_info, - 0); + g_type_register_static (GST_TYPE_V4LELEMENT, "GstV4lSrc", &v4lsrc_info, + 0); } return v4lsrc_type; } @@ -151,15 +152,15 @@ gst_v4lsrc_class_init (GstV4lSrcClass * klass) g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_NUMBUFS, g_param_spec_int ("num_buffers", "Num Buffers", "Number of buffers", - G_MININT, G_MAXINT, 0, G_PARAM_READABLE)); + G_MININT, G_MAXINT, 0, G_PARAM_READABLE)); g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_BUFSIZE, g_param_spec_int ("buffer_size", "Buffer Size", "Size of buffers", - G_MININT, G_MAXINT, 0, G_PARAM_READABLE)); + G_MININT, G_MAXINT, 0, G_PARAM_READABLE)); g_object_class_install_property (G_OBJECT_CLASS (klass), 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_v4lsrc_signals[SIGNAL_FRAME_CAPTURE] = @@ -196,7 +197,7 @@ gst_v4lsrc_init (GstV4lSrc * v4lsrc) v4lsrc->srcpad = gst_pad_new_from_template (gst_element_class_get_pad_template (klass, - "src"), "src"); + "src"), "src"); gst_element_add_pad (GST_ELEMENT (v4lsrc), v4lsrc->srcpad); gst_pad_set_get_function (v4lsrc->srcpad, gst_v4lsrc_get); @@ -245,7 +246,7 @@ gst_v4lsrc_open (GstElement * element, const gchar * device) if (!gst_v4lsrc_try_palette (v4lsrc, palette[i])) continue; v4lsrc->colourspaces = g_list_append (v4lsrc->colourspaces, - GINT_TO_POINTER (palette[i])); + GINT_TO_POINTER (palette[i])); } } @@ -267,7 +268,7 @@ gst_v4lsrc_get_fps (GstV4lSrc * v4lsrc) if (!v4lsrc->use_fixed_fps && v4lsrc->clock != NULL && v4lsrc->handled > 0) { /* try to get time from clock master and calculate fps */ GstClockTime time = - gst_clock_get_time (v4lsrc->clock) - v4lsrc->substract_time; + gst_clock_get_time (v4lsrc->clock) - v4lsrc->substract_time; return v4lsrc->handled * GST_SECOND / time; } @@ -303,21 +304,21 @@ gst_v4lsrc_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; @@ -342,15 +343,15 @@ gst_v4lsrc_src_query (GstPad * pad, switch (type) { case GST_QUERY_POSITION: switch (*format) { - case GST_FORMAT_TIME: - *value = v4lsrc->handled * GST_SECOND / fps; - break; - case GST_FORMAT_DEFAULT: - *value = v4lsrc->handled; - break; - default: - res = FALSE; - break; + case GST_FORMAT_TIME: + *value = v4lsrc->handled * GST_SECOND / fps; + break; + case GST_FORMAT_DEFAULT: + *value = v4lsrc->handled; + break; + default: + res = FALSE; + break; } break; default: @@ -403,42 +404,42 @@ gst_v4lsrc_palette_to_caps (int palette) if (fourcc == GST_MAKE_FOURCC ('R', 'G', 'B', ' ')) { switch (palette) { case VIDEO_PALETTE_RGB555: - caps = gst_caps_from_string ("video/x-raw-rgb, " - "bpp = (int) 16, " - "depth = (int) 15, " - "endianness = (int) BYTE_ORDER, " - "red_mask = 0x7c00, " "green_mask = 0x03e0, " "blue_mask = 0x001f"); - break; + caps = gst_caps_from_string ("video/x-raw-rgb, " + "bpp = (int) 16, " + "depth = (int) 15, " + "endianness = (int) BYTE_ORDER, " + "red_mask = 0x7c00, " "green_mask = 0x03e0, " "blue_mask = 0x001f"); + break; case VIDEO_PALETTE_RGB565: - caps = gst_caps_from_string ("video/x-raw-rgb, " - "bpp = (int) 16, " - "depth = (int) 16, " - "endianness = (int) BYTE_ORDER, " - "red_mask = 0xf800, " "green_mask = 0x07f0, " "blue_mask = 0x001f"); - break; + caps = gst_caps_from_string ("video/x-raw-rgb, " + "bpp = (int) 16, " + "depth = (int) 16, " + "endianness = (int) BYTE_ORDER, " + "red_mask = 0xf800, " "green_mask = 0x07f0, " "blue_mask = 0x001f"); + break; case VIDEO_PALETTE_RGB24: - caps = gst_caps_from_string ("video/x-raw-rgb, " - "bpp = (int) 24, " - "depth = (int) 24, " - "endianness = (int) BIG_ENDIAN, " - "red_mask = 0xFF0000, " - "green_mask = 0x00FF00, " "blue_mask = 0x0000FF"); - break; + caps = gst_caps_from_string ("video/x-raw-rgb, " + "bpp = (int) 24, " + "depth = (int) 24, " + "endianness = (int) BIG_ENDIAN, " + "red_mask = 0xFF0000, " + "green_mask = 0x00FF00, " "blue_mask = 0x0000FF"); + break; case VIDEO_PALETTE_RGB32: - caps = gst_caps_from_string ("video/x-raw-rgb, " - "bpp = (int) 24, " - "depth = (int) 32, " - "endianness = (int) BIG_ENDIAN, " - "red_mask = 0xFF000000, " - "green_mask = 0x00FF0000, " "blue_mask = 0x0000FF00"); - break; + caps = gst_caps_from_string ("video/x-raw-rgb, " + "bpp = (int) 24, " + "depth = (int) 32, " + "endianness = (int) BIG_ENDIAN, " + "red_mask = 0xFF000000, " + "green_mask = 0x00FF0000, " "blue_mask = 0x0000FF00"); + break; default: - g_assert_not_reached (); - return NULL; + g_assert_not_reached (); + return NULL; } } else { caps = gst_caps_new_simple ("video/x-raw-yuv", - "format", GST_TYPE_FOURCC, fourcc, NULL); + "format", GST_TYPE_FOURCC, fourcc, NULL); } return caps; @@ -463,7 +464,7 @@ gst_v4lsrc_srcconnect (GstPad * pad, const GstCaps * vscapslist) if (GST_V4L_IS_ACTIVE (GST_V4LELEMENT (v4lsrc))) { if (was_capturing) { if (!gst_v4lsrc_capture_stop (v4lsrc)) - return GST_PAD_LINK_REFUSED; + return GST_PAD_LINK_REFUSED; } if (!gst_v4lsrc_capture_deinit (v4lsrc)) return GST_PAD_LINK_REFUSED; @@ -514,31 +515,31 @@ gst_v4lsrc_srcconnect (GstPad * pad, const GstCaps * vscapslist) case GST_MAKE_FOURCC ('R', 'G', 'B', ' '): gst_structure_get_int (structure, "depth", &depth); switch (depth) { - case 15: - palette = VIDEO_PALETTE_RGB555; - v4lsrc->buffer_size = w * h * 2; - break; - case 16: - palette = VIDEO_PALETTE_RGB565; - v4lsrc->buffer_size = w * h * 2; - break; - case 24: - gst_structure_get_int (structure, "bpp", &bpp); - switch (bpp) { - case 24: - palette = VIDEO_PALETTE_RGB24; - v4lsrc->buffer_size = w * h * 3; - break; - case 32: - palette = VIDEO_PALETTE_RGB32; - v4lsrc->buffer_size = w * h * 4; - break; - default: - break; - } - break; - default: - break; + case 15: + palette = VIDEO_PALETTE_RGB555; + v4lsrc->buffer_size = w * h * 2; + break; + case 16: + palette = VIDEO_PALETTE_RGB565; + v4lsrc->buffer_size = w * h * 2; + break; + case 24: + gst_structure_get_int (structure, "bpp", &bpp); + switch (bpp) { + case 24: + palette = VIDEO_PALETTE_RGB24; + v4lsrc->buffer_size = w * h * 3; + break; + case 32: + palette = VIDEO_PALETTE_RGB32; + v4lsrc->buffer_size = w * h * 4; + break; + default: + break; + } + break; + default: + break; } break; default: @@ -583,9 +584,9 @@ gst_v4lsrc_getcaps (GstPad * pad) if (!one) g_print ("Palette %d gave no caps\n", GPOINTER_TO_INT (item->data)); gst_caps_set_simple (one, - "width", GST_TYPE_INT_RANGE, vcap->minwidth, vcap->maxwidth, - "height", GST_TYPE_INT_RANGE, vcap->minheight, vcap->maxheight, - "framerate", G_TYPE_DOUBLE, gst_v4lsrc_get_fps (v4lsrc), NULL); + "width", GST_TYPE_INT_RANGE, vcap->minwidth, vcap->maxwidth, + "height", GST_TYPE_INT_RANGE, vcap->minheight, vcap->maxheight, + "framerate", G_TYPE_DOUBLE, gst_v4lsrc_get_fps (v4lsrc), NULL); gst_caps_append (list, one); } @@ -622,7 +623,7 @@ gst_v4lsrc_get (GstPad * pad) /* grab a frame from the device */ if (!gst_v4lsrc_grab_frame (v4lsrc, &num)) - return NULL; + return NULL; v4lsrc->last_frame = num; time = v4lsrc->timestamp_sync - v4lsrc->substract_time; @@ -638,25 +639,25 @@ gst_v4lsrc_get (GstPad * pad) * we want to have written X*fps frames. If we've written * more - drop, if we've written less - dup... */ if (v4lsrc->handled * (GST_SECOND / fps) - time > - 1.5 * (GST_SECOND / fps)) { - /* yo dude, we've got too many frames here! Drop! DROP! */ - v4lsrc->need_writes--; /* -= (v4lsrc->handled - (time / fps)); */ - g_signal_emit (G_OBJECT (v4lsrc), - gst_v4lsrc_signals[SIGNAL_FRAME_DROP], 0); + 1.5 * (GST_SECOND / fps)) { + /* yo dude, we've got too many frames here! Drop! DROP! */ + v4lsrc->need_writes--; /* -= (v4lsrc->handled - (time / fps)); */ + g_signal_emit (G_OBJECT (v4lsrc), + gst_v4lsrc_signals[SIGNAL_FRAME_DROP], 0); } else if (v4lsrc->handled * (GST_SECOND / fps) - time < - -1.5 * (GST_SECOND / fps)) { - /* this means we're lagging far behind */ - v4lsrc->need_writes++; /* += ((time / fps) - v4lsrc->handled); */ - g_signal_emit (G_OBJECT (v4lsrc), - gst_v4lsrc_signals[SIGNAL_FRAME_INSERT], 0); + -1.5 * (GST_SECOND / fps)) { + /* this means we're lagging far behind */ + v4lsrc->need_writes++; /* += ((time / fps) - v4lsrc->handled); */ + g_signal_emit (G_OBJECT (v4lsrc), + gst_v4lsrc_signals[SIGNAL_FRAME_INSERT], 0); } if (v4lsrc->need_writes > 0) { - have_frame = TRUE; - v4lsrc->use_num_times[num] = v4lsrc->need_writes; - v4lsrc->need_writes--; + have_frame = TRUE; + v4lsrc->use_num_times[num] = v4lsrc->need_writes; + v4lsrc->need_writes--; } else { - gst_v4lsrc_requeue_frame (v4lsrc, num); + gst_v4lsrc_requeue_frame (v4lsrc, num); } } while (!have_frame); } else { @@ -669,16 +670,16 @@ gst_v4lsrc_get (GstPad * pad) buf = gst_buffer_new (); GST_BUFFER_FREE_DATA_FUNC (buf) = gst_v4lsrc_buffer_free; - GST_BUFFER_PRIVATE (buf) = v4lsrc; /* hack to re-queue buffer on free */ + GST_BUFFER_PRIVATE (buf) = v4lsrc; /* hack to re-queue buffer on free */ GST_BUFFER_FLAG_SET (buf, GST_BUFFER_READONLY | GST_BUFFER_DONTFREE); GST_BUFFER_DATA (buf) = gst_v4lsrc_get_buffer (v4lsrc, num); GST_BUFFER_MAXSIZE (buf) = v4lsrc->mbuf.size / v4lsrc->mbuf.frames; GST_BUFFER_SIZE (buf) = v4lsrc->buffer_size; if (v4lsrc->use_fixed_fps) GST_BUFFER_TIMESTAMP (buf) = v4lsrc->handled * GST_SECOND / fps; - else /* calculate time based on our own clock */ + else /* calculate time based on our own clock */ GST_BUFFER_TIMESTAMP (buf) = - v4lsrc->timestamp_sync - v4lsrc->substract_time; + v4lsrc->timestamp_sync - v4lsrc->substract_time; v4lsrc->handled++; g_signal_emit (G_OBJECT (v4lsrc), @@ -700,7 +701,7 @@ gst_v4lsrc_set_property (GObject * object, switch (prop_id) { case ARG_USE_FIXED_FPS: if (!GST_V4L_IS_ACTIVE (GST_V4LELEMENT (v4lsrc))) { - v4lsrc->use_fixed_fps = g_value_get_boolean (value); + v4lsrc->use_fixed_fps = g_value_get_boolean (value); } break; @@ -727,10 +728,10 @@ gst_v4lsrc_get_property (GObject * object, case ARG_BUFSIZE: if (v4lsrc->mbuf.frames == 0) - g_value_set_int (value, 0); + g_value_set_int (value, 0); else - g_value_set_int (value, - v4lsrc->mbuf.size / (v4lsrc->mbuf.frames * 1024)); + g_value_set_int (value, + v4lsrc->mbuf.size / (v4lsrc->mbuf.frames * 1024)); break; case ARG_USE_FIXED_FPS: @@ -769,23 +770,23 @@ gst_v4lsrc_change_state (GstElement * element) case GST_STATE_PAUSED_TO_PLAYING: /* queue all buffer, start streaming capture */ if (!gst_v4lsrc_capture_start (v4lsrc)) - return GST_STATE_FAILURE; + return GST_STATE_FAILURE; g_get_current_time (&time); v4lsrc->substract_time = - GST_TIMEVAL_TO_TIME (time) - v4lsrc->substract_time; + GST_TIMEVAL_TO_TIME (time) - v4lsrc->substract_time; break; case GST_STATE_PLAYING_TO_PAUSED: /* de-queue all queued buffers */ if (!gst_v4lsrc_capture_stop (v4lsrc)) - return GST_STATE_FAILURE; + return GST_STATE_FAILURE; g_get_current_time (&time); v4lsrc->substract_time = - GST_TIMEVAL_TO_TIME (time) - v4lsrc->substract_time; + GST_TIMEVAL_TO_TIME (time) - v4lsrc->substract_time; break; case GST_STATE_PAUSED_TO_READY: /* stop capturing, unmap all buffers */ if (!gst_v4lsrc_capture_deinit (v4lsrc)) - return GST_STATE_FAILURE; + return GST_STATE_FAILURE; break; case GST_STATE_READY_TO_NULL: break; @@ -829,20 +830,20 @@ gst_v4lsrc_buffer_free (GstBuffer * buf) int n; if (gst_element_get_state (GST_ELEMENT (v4lsrc)) != GST_STATE_PLAYING) - return; /* we've already cleaned up ourselves */ + return; /* we've already cleaned up ourselves */ for (n = 0; n < v4lsrc->mbuf.frames; n++) if (GST_BUFFER_DATA (buf) == gst_v4lsrc_get_buffer (v4lsrc, n)) { v4lsrc->use_num_times[n]--; if (v4lsrc->use_num_times[n] <= 0) { - gst_v4lsrc_requeue_frame (v4lsrc, n); + gst_v4lsrc_requeue_frame (v4lsrc, n); } break; } if (n == v4lsrc->mbuf.frames) GST_ELEMENT_ERROR (v4lsrc, RESOURCE, TOO_LAZY, (NULL), - ("Couldn\'t find the buffer")); + ("Couldn\'t find the buffer")); } diff --git a/sys/v4l/gstv4ltuner.c b/sys/v4l/gstv4ltuner.c index 254d588aad..616a56f6d8 100644 --- a/sys/v4l/gstv4ltuner.c +++ b/sys/v4l/gstv4ltuner.c @@ -75,8 +75,8 @@ gst_v4l_tuner_channel_get_type (void) }; gst_v4l_tuner_channel_type = - g_type_register_static (GST_TYPE_TUNER_CHANNEL, - "GstV4lTunerChannel", &v4l_tuner_channel_info, 0); + g_type_register_static (GST_TYPE_TUNER_CHANNEL, + "GstV4lTunerChannel", &v4l_tuner_channel_info, 0); } return gst_v4l_tuner_channel_type; @@ -116,8 +116,8 @@ gst_v4l_tuner_norm_get_type (void) }; gst_v4l_tuner_norm_type = - g_type_register_static (GST_TYPE_TUNER_NORM, - "GstV4lTunerNorm", &v4l_tuner_norm_info, 0); + g_type_register_static (GST_TYPE_TUNER_NORM, + "GstV4lTunerNorm", &v4l_tuner_norm_info, 0); } return gst_v4l_tuner_norm_type; @@ -271,7 +271,7 @@ gst_v4l_tuner_set_frequency (GstTuner * tuner, /* assert that we're opened and that we're using a known item */ g_return_if_fail (GST_V4L_IS_OPEN (v4lelement)); g_return_if_fail (GST_TUNER_CHANNEL_HAS_FLAG (channel, - GST_TUNER_CHANNEL_FREQUENCY)); + GST_TUNER_CHANNEL_FREQUENCY)); g_return_if_fail (gst_v4l_tuner_contains_channel (v4lelement, v4lchannel)); gst_v4l_get_chan_norm (v4lelement, &chan, NULL); @@ -291,9 +291,9 @@ gst_v4l_tuner_get_frequency (GstTuner * tuner, GstTunerChannel * channel) /* assert that we're opened and that we're using a known item */ g_return_val_if_fail (GST_V4L_IS_OPEN (v4lelement), 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_v4l_tuner_contains_channel (v4lelement, - v4lchannel), 0); + v4lchannel), 0); gst_v4l_get_chan_norm (v4lelement, &chan, NULL); if (chan == GST_V4L_TUNER_CHANNEL (channel)->index) { @@ -314,9 +314,9 @@ gst_v4l_tuner_signal_strength (GstTuner * tuner, GstTunerChannel * channel) /* assert that we're opened and that we're using a known item */ g_return_val_if_fail (GST_V4L_IS_OPEN (v4lelement), 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_v4l_tuner_contains_channel (v4lelement, - v4lchannel), 0); + v4lchannel), 0); gst_v4l_get_chan_norm (v4lelement, &chan, NULL); if (chan == GST_V4L_TUNER_CHANNEL (channel)->index && diff --git a/sys/v4l/gstv4lxoverlay.c b/sys/v4l/gstv4lxoverlay.c index a1d1b12084..1bf5c2eefb 100644 --- a/sys/v4l/gstv4lxoverlay.c +++ b/sys/v4l/gstv4lxoverlay.c @@ -72,7 +72,7 @@ gst_v4l_xoverlay_open (GstV4lElement * v4lelement) xwin->display_name = g_strdup (v4lelement->display); if (v4lelement->xwindow_id != 0 && - xwin->display_name && xwin->display_name[0] == ':') { + xwin->display_name && xwin->display_name[0] == ':') { gst_x_window_listener_set_xid (xwin, v4lelement->xwindow_id); } } @@ -85,7 +85,7 @@ gst_v4l_xoverlay_close (GstV4lElement * v4lelement) if (xwin != NULL) { if (v4lelement->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/v4l/v4l-overlay_calls.c b/sys/v4l/v4l-overlay_calls.c index 61684a6e2e..b8de5bf42c 100644 --- a/sys/v4l/v4l-overlay_calls.c +++ b/sys/v4l/v4l-overlay_calls.c @@ -65,14 +65,14 @@ gst_v4l_set_overlay (GstV4lElement * v4lelement) switch (system (buff)) { case -1: GST_ELEMENT_ERROR (v4lelement, 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 (v4lelement, RESOURCE, FAILED, - (_("Executing v4l-conf failed.")), GST_ERROR_SYSTEM); + (_("Executing v4l-conf failed.")), GST_ERROR_SYSTEM); g_free (buff); return FALSE; } @@ -108,7 +108,7 @@ gst_v4l_set_window (GstElement * element, if (clips && !(v4lelement->vcap.type & VID_TYPE_CLIPPING)) { DEBUG ("Device \'%s\' doesn't do clipping", - v4lelement->videodev ? v4lelement->videodev : "/dev/video"); + v4lelement->videodev ? v4lelement->videodev : "/dev/video"); vwin.clips = 0; } else { vwin.clips = clips; @@ -117,7 +117,7 @@ gst_v4l_set_window (GstElement * element, if (ioctl (v4lelement->video_fd, VIDIOCSWIN, &vwin) < 0) { GST_ELEMENT_ERROR (v4lelement, 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; } @@ -142,8 +142,8 @@ gst_v4l_enable_overlay (GstV4lElement * v4lelement, gboolean enable) if (ioctl (v4lelement->video_fd, VIDIOCCAPTURE, &doit) < 0) { GST_ELEMENT_ERROR (v4lelement, 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/v4l/v4l_calls.c b/sys/v4l/v4l_calls.c index 60fd6f717e..a007f622de 100644 --- a/sys/v4l/v4l_calls.c +++ b/sys/v4l/v4l_calls.c @@ -84,8 +84,8 @@ gst_v4l_get_capabilities (GstV4lElement * v4lelement) if (ioctl (v4lelement->video_fd, VIDIOCGCAP, &(v4lelement->vcap)) < 0) { GST_ELEMENT_ERROR (v4lelement, RESOURCE, SETTINGS, (NULL), - ("error getting capabilities %s of from device %s", - g_strerror (errno), v4lelement->videodev)); + ("error getting capabilities %s of from device %s", + g_strerror (errno), v4lelement->videodev)); return FALSE; } @@ -111,7 +111,7 @@ gst_v4l_open (GstV4lElement * v4lelement) /* be sure we have a device */ if (!v4lelement->videodev) { GST_ELEMENT_ERROR (v4lelement, RESOURCE, NOT_FOUND, - (_("No device specified.")), (NULL)); + (_("No device specified.")), (NULL)); return FALSE; } @@ -119,8 +119,8 @@ gst_v4l_open (GstV4lElement * v4lelement) v4lelement->video_fd = open (v4lelement->videodev, O_RDWR); if (!GST_V4L_IS_OPEN (v4lelement)) { GST_ELEMENT_ERROR (v4lelement, RESOURCE, OPEN_READ_WRITE, - (_("Could not open device \"%s\" for reading and writing."), - v4lelement->videodev), GST_ERROR_SYSTEM); + (_("Could not open device \"%s\" for reading and writing."), + v4lelement->videodev), GST_ERROR_SYSTEM); return FALSE; } @@ -133,13 +133,13 @@ gst_v4l_open (GstV4lElement * v4lelement) /* device type check */ if ((GST_IS_V4LSRC (v4lelement) && - !(v4lelement->vcap.type & VID_TYPE_CAPTURE)) || + !(v4lelement->vcap.type & VID_TYPE_CAPTURE)) || (GST_IS_V4LMJPEGSRC (v4lelement) && - !(v4lelement->vcap.type & VID_TYPE_MJPEG_ENCODER)) || + !(v4lelement->vcap.type & VID_TYPE_MJPEG_ENCODER)) || (GST_IS_V4LMJPEGSINK (v4lelement) && - !(v4lelement->vcap.type & VID_TYPE_MJPEG_DECODER))) { + !(v4lelement->vcap.type & VID_TYPE_MJPEG_DECODER))) { GST_ELEMENT_ERROR (v4lelement, RESOURCE, SETTINGS, (NULL), - ("Device opened, but wrong type (0x%x)", v4lelement->vcap.type)); + ("Device opened, but wrong type (0x%x)", v4lelement->vcap.type)); close (v4lelement->video_fd); v4lelement->video_fd = -1; return FALSE; @@ -151,7 +151,7 @@ gst_v4l_open (GstV4lElement * v4lelement) /* norms + inputs, for the tuner interface */ for (num = 0; norm_name[num] != NULL; num++) { GstV4lTunerNorm *v4lnorm = g_object_new (GST_TYPE_V4L_TUNER_NORM, - NULL); + NULL); GstTunerNorm *norm = GST_TUNER_NORM (v4lnorm); norm->label = g_strdup (norm_name[num]); @@ -163,7 +163,7 @@ gst_v4l_open (GstV4lElement * v4lelement) for (num = 0; picture_name[num] != NULL; num++) { GstV4lColorBalanceChannel *v4lchannel = - g_object_new (GST_TYPE_V4L_COLOR_BALANCE_CHANNEL, NULL); + g_object_new (GST_TYPE_V4L_COLOR_BALANCE_CHANNEL, NULL); GstColorBalanceChannel *channel = GST_COLOR_BALANCE_CHANNEL (v4lchannel); channel->label = g_strdup (picture_name[num]); @@ -252,12 +252,12 @@ gst_v4l_get_chan_names (GstV4lElement * v4lelement) for (i = 0; i < gst_v4l_get_num_chans (v4lelement); i++) { GstV4lTunerChannel *v4lchannel = g_object_new (GST_TYPE_V4L_TUNER_CHANNEL, - NULL); + NULL); GstTunerChannel *channel = GST_TUNER_CHANNEL (v4lchannel); vchan.channel = i; if (ioctl (v4lelement->video_fd, VIDIOCGCHAN, &vchan) < 0) - return NULL; /* memleak... */ + return NULL; /* memleak... */ channel->label = g_strdup (vchan.name); channel->flags = GST_TUNER_CHANNEL_INPUT; v4lchannel->index = i; @@ -266,18 +266,18 @@ gst_v4l_get_chan_names (GstV4lElement * v4lelement) gint n; for (n = 0;; n++) { - vtun.tuner = n; - if (ioctl (v4lelement->video_fd, VIDIOCGTUNER, &vtun) < 0) - break; /* no more tuners */ - if (!strcmp (vtun.name, vchan.name)) { - v4lchannel->tuner = n; - channel->flags |= GST_TUNER_CHANNEL_FREQUENCY; - channel->min_frequency = vtun.rangelow; - channel->max_frequency = vtun.rangehigh; - channel->min_signal = 0; - channel->max_signal = 0xffff; - break; - } + vtun.tuner = n; + if (ioctl (v4lelement->video_fd, VIDIOCGTUNER, &vtun) < 0) + break; /* no more tuners */ + if (!strcmp (vtun.name, vchan.name)) { + v4lchannel->tuner = n; + channel->flags |= GST_TUNER_CHANNEL_FREQUENCY; + channel->min_frequency = vtun.rangelow; + channel->max_frequency = vtun.rangehigh; + channel->min_signal = 0; + channel->max_signal = 0xffff; + break; + } } } if (vchan.flags & VIDEO_VC_AUDIO) { @@ -285,14 +285,14 @@ gst_v4l_get_chan_names (GstV4lElement * v4lelement) gint n; for (n = 0; n < v4lelement->vcap.audios; n++) { - vaud.audio = n; - if (ioctl (v4lelement->video_fd, VIDIOCGAUDIO, &vaud) < 0) - continue; - if (!strcmp (vaud.name, vchan.name)) { - v4lchannel->audio = n; - channel->flags |= GST_TUNER_CHANNEL_AUDIO; - break; - } + vaud.audio = n; + if (ioctl (v4lelement->video_fd, VIDIOCGAUDIO, &vaud) < 0) + continue; + if (!strcmp (vaud.name, vchan.name)) { + v4lchannel->audio = n; + channel->flags |= GST_TUNER_CHANNEL_AUDIO; + break; + } } } list = g_list_append (list, (gpointer) channel); @@ -344,13 +344,13 @@ gst_v4l_set_chan_norm (GstV4lElement * v4lelement, gint channel, gint norm) if (ioctl (v4lelement->video_fd, VIDIOCSCHAN, &(v4lelement->vchan)) < 0) { GST_ELEMENT_ERROR (v4lelement, RESOURCE, SETTINGS, (NULL), - ("Error setting the channel/norm settings: %s", g_strerror (errno))); + ("Error setting the channel/norm settings: %s", g_strerror (errno))); return FALSE; } if (ioctl (v4lelement->video_fd, VIDIOCGCHAN, &(v4lelement->vchan)) < 0) { GST_ELEMENT_ERROR (v4lelement, RESOURCE, SETTINGS, (NULL), - ("Error getting the channel/norm settings: %s", g_strerror (errno))); + ("Error getting the channel/norm settings: %s", g_strerror (errno))); return FALSE; } @@ -375,7 +375,7 @@ gst_v4l_get_signal (GstV4lElement * v4lelement, gint tunernum, guint * signal) tuner.tuner = tunernum; if (ioctl (v4lelement->video_fd, VIDIOCGTUNER, &tuner) < 0) { GST_ELEMENT_ERROR (v4lelement, RESOURCE, SETTINGS, (NULL), - ("Error getting tuner signal: %s", g_strerror (errno))); + ("Error getting tuner signal: %s", g_strerror (errno))); return FALSE; } @@ -409,7 +409,7 @@ gst_v4l_get_frequency (GstV4lElement * v4lelement, if (ioctl (v4lelement->video_fd, VIDIOCGFREQ, frequency) < 0) { GST_ELEMENT_ERROR (v4lelement, RESOURCE, SETTINGS, (NULL), - ("Error getting tuner frequency: %s", g_strerror (errno))); + ("Error getting tuner frequency: %s", g_strerror (errno))); return FALSE; } @@ -441,7 +441,7 @@ gst_v4l_set_frequency (GstV4lElement * v4lelement, if (ioctl (v4lelement->video_fd, VIDIOCSFREQ, &frequency) < 0) { GST_ELEMENT_ERROR (v4lelement, RESOURCE, SETTINGS, (NULL), - ("Error setting tuner frequency: %s", g_strerror (errno))); + ("Error setting tuner frequency: %s", g_strerror (errno))); return FALSE; } @@ -466,7 +466,7 @@ gst_v4l_get_picture (GstV4lElement * v4lelement, if (ioctl (v4lelement->video_fd, VIDIOCGPICT, &vpic) < 0) { GST_ELEMENT_ERROR (v4lelement, RESOURCE, SETTINGS, (NULL), - ("Error getting picture parameters: %s", g_strerror (errno))); + ("Error getting picture parameters: %s", g_strerror (errno))); return FALSE; } @@ -485,7 +485,7 @@ gst_v4l_get_picture (GstV4lElement * v4lelement, break; default: GST_ELEMENT_ERROR (v4lelement, RESOURCE, SETTINGS, (NULL), - ("Error getting picture parameters: unknown type %d", type)); + ("Error getting picture parameters: unknown type %d", type)); return FALSE; } @@ -511,7 +511,7 @@ gst_v4l_set_picture (GstV4lElement * v4lelement, if (ioctl (v4lelement->video_fd, VIDIOCGPICT, &vpic) < 0) { GST_ELEMENT_ERROR (v4lelement, RESOURCE, SETTINGS, (NULL), - ("Error getting picture parameters: %s", g_strerror (errno))); + ("Error getting picture parameters: %s", g_strerror (errno))); return FALSE; } @@ -530,13 +530,13 @@ gst_v4l_set_picture (GstV4lElement * v4lelement, break; default: GST_ELEMENT_ERROR (v4lelement, RESOURCE, SETTINGS, (NULL), - ("Error setting picture parameters: unknown type %d", type)); + ("Error setting picture parameters: unknown type %d", type)); return FALSE; } if (ioctl (v4lelement->video_fd, VIDIOCSPICT, &vpic) < 0) { GST_ELEMENT_ERROR (v4lelement, RESOURCE, SETTINGS, (NULL), - ("Error setting picture parameters: %s", g_strerror (errno))); + ("Error setting picture parameters: %s", g_strerror (errno))); return FALSE; } @@ -562,7 +562,7 @@ gst_v4l_get_audio (GstV4lElement * v4lelement, vau.audio = audionum; if (ioctl (v4lelement->video_fd, VIDIOCGAUDIO, &vau) < 0) { GST_ELEMENT_ERROR (v4lelement, RESOURCE, SETTINGS, (NULL), - ("Error getting audio parameters: %s", g_strerror (errno))); + ("Error getting audio parameters: %s", g_strerror (errno))); return FALSE; } @@ -578,7 +578,7 @@ gst_v4l_get_audio (GstV4lElement * v4lelement, break; default: GST_ELEMENT_ERROR (v4lelement, RESOURCE, SETTINGS, (NULL), - ("Error getting audio parameters: unknown type %d", type)); + ("Error getting audio parameters: unknown type %d", type)); return FALSE; } @@ -605,27 +605,27 @@ gst_v4l_set_audio (GstV4lElement * v4lelement, vau.audio = audionum; if (ioctl (v4lelement->video_fd, VIDIOCGAUDIO, &vau) < 0) { GST_ELEMENT_ERROR (v4lelement, RESOURCE, SETTINGS, (NULL), - ("Error getting audio parameters: %s", g_strerror (errno))); + ("Error getting audio parameters: %s", g_strerror (errno))); return FALSE; } switch (type) { case V4L_AUDIO_MUTE: if (!(vau.flags & VIDEO_AUDIO_MUTABLE)) { - GST_ELEMENT_ERROR (v4lelement, CORE, NOT_IMPLEMENTED, (NULL), - ("Error setting audio mute: (un)setting mute is not supported")); - return FALSE; + GST_ELEMENT_ERROR (v4lelement, CORE, NOT_IMPLEMENTED, (NULL), + ("Error setting audio mute: (un)setting mute is not supported")); + return FALSE; } if (value) - vau.flags |= VIDEO_AUDIO_MUTE; + vau.flags |= VIDEO_AUDIO_MUTE; else - vau.flags &= ~VIDEO_AUDIO_MUTE; + vau.flags &= ~VIDEO_AUDIO_MUTE; break; case V4L_AUDIO_VOLUME: if (!(vau.flags & VIDEO_AUDIO_VOLUME)) { - GST_ELEMENT_ERROR (v4lelement, CORE, NOT_IMPLEMENTED, (NULL), - ("Error setting audio volume: setting volume is not supported")); - return FALSE; + GST_ELEMENT_ERROR (v4lelement, CORE, NOT_IMPLEMENTED, (NULL), + ("Error setting audio volume: setting volume is not supported")); + return FALSE; } vau.volume = value; break; @@ -634,13 +634,13 @@ gst_v4l_set_audio (GstV4lElement * v4lelement, break; default: GST_ELEMENT_ERROR (v4lelement, RESOURCE, SETTINGS, (NULL), - ("Error setting audio parameters: unknown type %d", type)); + ("Error setting audio parameters: unknown type %d", type)); return FALSE; } if (ioctl (v4lelement->video_fd, VIDIOCSAUDIO, &vau) < 0) { GST_ELEMENT_ERROR (v4lelement, RESOURCE, SETTINGS, (NULL), - ("Error setting audio parameters: %s", g_strerror (errno))); + ("Error setting audio parameters: %s", g_strerror (errno))); return FALSE; } diff --git a/sys/v4l/v4lmjpegsink_calls.c b/sys/v4l/v4lmjpegsink_calls.c index e3a1b9f0bd..6d90d02a34 100644 --- a/sys/v4l/v4lmjpegsink_calls.c +++ b/sys/v4l/v4lmjpegsink_calls.c @@ -51,7 +51,7 @@ static void * gst_v4lmjpegsink_sync_thread (void *arg) { GstV4lMjpegSink *v4lmjpegsink = GST_V4LMJPEGSINK (arg); - gint frame = 0; /* frame that we're currently syncing on */ + gint frame = 0; /* frame that we're currently syncing on */ DEBUG ("starting sync thread"); @@ -65,7 +65,7 @@ gst_v4lmjpegsink_sync_thread (void *arg) g_mutex_lock (v4lmjpegsink->mutex_queued_frames); if (!v4lmjpegsink->isqueued_queued_frames[frame]) { g_cond_wait (v4lmjpegsink->cond_queued_frames[frame], - v4lmjpegsink->mutex_queued_frames); + v4lmjpegsink->mutex_queued_frames); } if (v4lmjpegsink->isqueued_queued_frames[frame] != 1) { g_mutex_unlock (v4lmjpegsink->mutex_queued_frames); @@ -75,9 +75,9 @@ gst_v4lmjpegsink_sync_thread (void *arg) DEBUG ("thread-syncing on next frame"); if (ioctl (GST_V4LELEMENT (v4lmjpegsink)->video_fd, MJPIOC_SYNC, - &(v4lmjpegsink->bsync)) < 0) { + &(v4lmjpegsink->bsync)) < 0) { GST_ELEMENT_ERROR (v4lmjpegsink, RESOURCE, SYNC, (NULL), - ("Failed to sync on frame %d: %s", frame, g_strerror (errno))); + ("Failed to sync on frame %d: %s", frame, g_strerror (errno))); g_mutex_lock (v4lmjpegsink->mutex_queued_frames); v4lmjpegsink->isqueued_queued_frames[frame] = -1; g_cond_broadcast (v4lmjpegsink->cond_queued_frames[frame]); @@ -86,9 +86,9 @@ gst_v4lmjpegsink_sync_thread (void *arg) } else { /* be sure that we're not confusing */ if (frame != v4lmjpegsink->bsync.frame) { - GST_ELEMENT_ERROR (v4lmjpegsink, CORE, TOO_LAZY, (NULL), - ("Internal error: frame number confusion")); - goto end; + GST_ELEMENT_ERROR (v4lmjpegsink, CORE, TOO_LAZY, (NULL), + ("Internal error: frame number confusion")); + goto end; } g_mutex_lock (v4lmjpegsink->mutex_queued_frames); v4lmjpegsink->isqueued_queued_frames[frame] = 0; @@ -119,9 +119,9 @@ gst_v4lmjpegsink_queue_frame (GstV4lMjpegSink * v4lmjpegsink, gint num) /* queue on this frame */ if (ioctl (GST_V4LELEMENT (v4lmjpegsink)->video_fd, MJPIOC_QBUF_PLAY, - &num) < 0) { + &num) < 0) { GST_ELEMENT_ERROR (v4lmjpegsink, RESOURCE, WRITE, (NULL), - ("Failed to queue frame %d: %s", num, g_strerror (errno))); + ("Failed to queue frame %d: %s", num, g_strerror (errno))); return FALSE; } @@ -153,7 +153,7 @@ gst_v4lmjpegsink_sync_frame (GstV4lMjpegSink * v4lmjpegsink, gint * num) g_mutex_lock (v4lmjpegsink->mutex_queued_frames); if (v4lmjpegsink->isqueued_queued_frames[*num] == 1) { g_cond_wait (v4lmjpegsink->cond_queued_frames[*num], - v4lmjpegsink->mutex_queued_frames); + v4lmjpegsink->mutex_queued_frames); } if (v4lmjpegsink->isqueued_queued_frames[*num] != 0) { g_mutex_unlock (v4lmjpegsink->mutex_queued_frames); @@ -208,15 +208,15 @@ gst_v4lmjpegsink_set_playback (GstV4lMjpegSink * v4lmjpegsink, /*GST_V4L_CHECK_NOT_ACTIVE(GST_V4LELEMENT(v4lmjpegsink)); */ if (ioctl (GST_V4LELEMENT (v4lmjpegsink)->video_fd, MJPIOC_G_PARAMS, - &bparm) < 0) { + &bparm) < 0) { GST_ELEMENT_ERROR (v4lmjpegsink, RESOURCE, SETTINGS, (NULL), - GST_ERROR_SYSTEM); + GST_ERROR_SYSTEM); return FALSE; } bparm.input = 0; bparm.norm = norm; - bparm.decimation = 0; /* we'll set proper values later on */ + bparm.decimation = 0; /* we'll set proper values later on */ /* maxwidth is broken on marvel cards */ mw = GST_V4LELEMENT (v4lmjpegsink)->vcap.maxwidth; @@ -226,8 +226,8 @@ gst_v4lmjpegsink_set_playback (GstV4lMjpegSink * v4lmjpegsink, if (width > mw || height > mh) { GST_ELEMENT_ERROR (v4lmjpegsink, RESOURCE, TOO_LAZY, (NULL), - ("Video dimensions (%dx%d) are larger than device max (%dx%d)", - width, height, mw, mh)); + ("Video dimensions (%dx%d) are larger than device max (%dx%d)", + width, height, mw, mh)); return FALSE; } @@ -253,8 +253,8 @@ gst_v4lmjpegsink_set_playback (GstV4lMjpegSink * v4lmjpegsink, { if (height > mh / 2) { GST_ELEMENT_ERROR (v4lmjpegsink, RESOURCE, TOO_LAZY, (NULL), - ("Video dimensions (%dx%d) too large for non-interlaced playback (%dx%d)", - width, height, mw, mh / 2)); + ("Video dimensions (%dx%d) too large for non-interlaced playback (%dx%d)", + width, height, mw, mh / 2)); return FALSE; } @@ -296,9 +296,9 @@ gst_v4lmjpegsink_set_playback (GstV4lMjpegSink * v4lmjpegsink, } if (ioctl (GST_V4LELEMENT (v4lmjpegsink)->video_fd, MJPIOC_S_PARAMS, - &bparm) < 0) { + &bparm) < 0) { GST_ELEMENT_ERROR (v4lmjpegsink, RESOURCE, SETTINGS, (NULL), - GST_ERROR_SYSTEM); + GST_ERROR_SYSTEM); return FALSE; } @@ -323,7 +323,7 @@ gst_v4lmjpegsink_playback_init (GstV4lMjpegSink * v4lmjpegsink) /* Request buffers */ if (ioctl (GST_V4LELEMENT (v4lmjpegsink)->video_fd, MJPIOC_REQBUFS, - &(v4lmjpegsink->breq)) < 0) { + &(v4lmjpegsink->breq)) < 0) { GST_ELEMENT_ERROR (v4lmjpegsink, RESOURCE, READ, (NULL), GST_ERROR_SYSTEM); return FALSE; } @@ -338,7 +338,7 @@ gst_v4lmjpegsink_playback_init (GstV4lMjpegSink * v4lmjpegsink) GST_V4LELEMENT (v4lmjpegsink)->video_fd, 0); if (GST_V4LELEMENT (v4lmjpegsink)->buffer == MAP_FAILED) { GST_ELEMENT_ERROR (v4lmjpegsink, RESOURCE, TOO_LAZY, (NULL), - ("Error mapping video buffers: %s", g_strerror (errno))); + ("Error mapping video buffers: %s", g_strerror (errno))); GST_V4LELEMENT (v4lmjpegsink)->buffer = NULL; return FALSE; } @@ -349,14 +349,14 @@ gst_v4lmjpegsink_playback_init (GstV4lMjpegSink * v4lmjpegsink) malloc (sizeof (gint8) * v4lmjpegsink->breq.count); if (!v4lmjpegsink->isqueued_queued_frames) { GST_ELEMENT_ERROR (v4lmjpegsink, RESOURCE, TOO_LAZY, (NULL), - ("Failed to create queue tracker: %s", g_strerror (errno))); + ("Failed to create queue tracker: %s", g_strerror (errno))); return FALSE; } v4lmjpegsink->cond_queued_frames = (GCond **) malloc (sizeof (GCond *) * v4lmjpegsink->breq.count); if (!v4lmjpegsink->cond_queued_frames) { GST_ELEMENT_ERROR (v4lmjpegsink, RESOURCE, TOO_LAZY, (NULL), - ("Failed to create queue condition holders: %s", g_strerror (errno))); + ("Failed to create queue condition holders: %s", g_strerror (errno))); return FALSE; } for (n = 0; n < v4lmjpegsink->breq.count; n++) @@ -394,7 +394,7 @@ gst_v4lmjpegsink_playback_start (GstV4lMjpegSink * v4lmjpegsink) TRUE, &error); if (!v4lmjpegsink->thread_queued_frames) { GST_ELEMENT_ERROR (v4lmjpegsink, RESOURCE, TOO_LAZY, (NULL), - ("Failed to create sync thread: %s", error->message)); + ("Failed to create sync thread: %s", error->message)); return FALSE; } diff --git a/sys/v4l/v4lmjpegsrc_calls.c b/sys/v4l/v4lmjpegsrc_calls.c index 938f33b88a..b201e86585 100644 --- a/sys/v4l/v4lmjpegsrc_calls.c +++ b/sys/v4l/v4lmjpegsrc_calls.c @@ -66,9 +66,9 @@ gst_v4lmjpegsrc_queue_frame (GstV4lMjpegSrc * v4lmjpegsrc, gint num) } if (ioctl (GST_V4LELEMENT (v4lmjpegsrc)->video_fd, MJPIOC_QBUF_CAPT, - &num) < 0) { + &num) < 0) { GST_ELEMENT_ERROR (v4lmjpegsrc, RESOURCE, READ, (NULL), - ("Error queueing a buffer (%d): %s", num, g_strerror (errno))); + ("Error queueing a buffer (%d): %s", num, g_strerror (errno))); return FALSE; } @@ -95,7 +95,7 @@ gst_v4lmjpegsrc_sync_next_frame (GstV4lMjpegSrc * v4lmjpegsrc, gint * num) } while (ioctl (GST_V4LELEMENT (v4lmjpegsrc)->video_fd, - MJPIOC_SYNC, &(v4lmjpegsrc->bsync)) < 0) { + MJPIOC_SYNC, &(v4lmjpegsrc->bsync)) < 0) { if (errno != EINTR) { GST_ELEMENT_ERROR (v4lmjpegsrc, RESOURCE, SYNC, (NULL), GST_ERROR_SYSTEM); return FALSE; @@ -155,9 +155,9 @@ gst_v4lmjpegsrc_set_capture (GstV4lMjpegSrc * v4lmjpegsrc, /* Query params for capture */ if (ioctl (GST_V4LELEMENT (v4lmjpegsrc)->video_fd, MJPIOC_G_PARAMS, - &bparm) < 0) { + &bparm) < 0) { GST_ELEMENT_ERROR (v4lmjpegsrc, RESOURCE, SETTINGS, (NULL), - GST_ERROR_SYSTEM); + GST_ERROR_SYSTEM); return FALSE; } @@ -165,7 +165,7 @@ gst_v4lmjpegsrc_set_capture (GstV4lMjpegSrc * v4lmjpegsrc, bparm.quality = quality; bparm.norm = norm; bparm.input = input; - bparm.APP_len = 0; /* no JPEG markers - TODO: this is definately not right for decimation==1 */ + bparm.APP_len = 0; /* no JPEG markers - TODO: this is definately not right for decimation==1 */ mw = GST_V4LELEMENT (v4lmjpegsrc)->vcap.maxwidth; if (mw != 768 && mw != 640) { @@ -181,9 +181,9 @@ gst_v4lmjpegsrc_set_capture (GstV4lMjpegSrc * v4lmjpegsrc, /* Set params for capture */ if (ioctl (GST_V4LELEMENT (v4lmjpegsrc)->video_fd, MJPIOC_S_PARAMS, - &bparm) < 0) { + &bparm) < 0) { GST_ELEMENT_ERROR (v4lmjpegsrc, RESOURCE, SETTINGS, (NULL), - GST_ERROR_SYSTEM); + GST_ERROR_SYSTEM); return FALSE; } @@ -223,9 +223,9 @@ gst_v4lmjpegsrc_set_capture_m (GstV4lMjpegSrc * v4lmjpegsrc, /* Query params for capture */ if (ioctl (GST_V4LELEMENT (v4lmjpegsrc)->video_fd, MJPIOC_G_PARAMS, - &bparm) < 0) { + &bparm) < 0) { GST_ELEMENT_ERROR (v4lmjpegsrc, RESOURCE, SETTINGS, (NULL), - GST_ERROR_SYSTEM); + GST_ERROR_SYSTEM); return FALSE; } @@ -233,14 +233,14 @@ gst_v4lmjpegsrc_set_capture_m (GstV4lMjpegSrc * v4lmjpegsrc, bparm.quality = quality; bparm.norm = norm; bparm.input = input; - bparm.APP_len = 0; /* no JPEG markers - TODO: this is definately - * not right for decimation==1 */ + bparm.APP_len = 0; /* no JPEG markers - TODO: this is definately + * not right for decimation==1 */ if (width <= 0) { if (x_offset < 0) x_offset = 0; width = (maxwidth == 720 - && h_decimation != 1) ? 704 : maxwidth - 2 * x_offset; + && h_decimation != 1) ? 704 : maxwidth - 2 * x_offset; } else { if (x_offset < 0) x_offset = (maxwidth - width) / 2; @@ -257,20 +257,20 @@ gst_v4lmjpegsrc_set_capture_m (GstV4lMjpegSrc * v4lmjpegsrc, if (width + x_offset > maxwidth) { GST_ELEMENT_ERROR (v4lmjpegsrc, RESOURCE, TOO_LAZY, (NULL), - ("Image width+offset (%d) bigger than maximum (%d)", - width + x_offset, maxwidth)); + ("Image width+offset (%d) bigger than maximum (%d)", + width + x_offset, maxwidth)); return FALSE; } if ((width % (bparm.HorDcm * 16)) != 0) { GST_ELEMENT_ERROR (v4lmjpegsrc, STREAM, FORMAT, (NULL), - ("Image width (%d) not multiple of %d (required for JPEG)", - width, bparm.HorDcm * 16)); + ("Image width (%d) not multiple of %d (required for JPEG)", + width, bparm.HorDcm * 16)); return FALSE; } if (height + y_offset > (norm == VIDEO_MODE_NTSC ? 480 : 576)) { GST_ELEMENT_ERROR (v4lmjpegsrc, RESOURCE, TOO_LAZY, (NULL), - ("Image height+offset (%d) bigger than maximum (%d)", - height + y_offset, (norm == VIDEO_MODE_NTSC ? 480 : 576))); + ("Image height+offset (%d) bigger than maximum (%d)", + height + y_offset, (norm == VIDEO_MODE_NTSC ? 480 : 576))); return FALSE; } /* RJ: Image height must only be a multiple of 8, but geom_height @@ -278,8 +278,8 @@ gst_v4lmjpegsrc_set_capture_m (GstV4lMjpegSrc * v4lmjpegsrc, */ if ((height % (bparm.VerDcm * 16)) != 0) { GST_ELEMENT_ERROR (v4lmjpegsrc, STREAM, FORMAT, (NULL), - ("Image height (%d) not multiple of %d (required for JPEG)", - height, bparm.VerDcm * 16)); + ("Image height (%d) not multiple of %d (required for JPEG)", + height, bparm.VerDcm * 16)); return FALSE; } @@ -299,9 +299,9 @@ gst_v4lmjpegsrc_set_capture_m (GstV4lMjpegSrc * v4lmjpegsrc, /* Set params for capture */ if (ioctl (GST_V4LELEMENT (v4lmjpegsrc)->video_fd, MJPIOC_S_PARAMS, - &bparm) < 0) { + &bparm) < 0) { GST_ELEMENT_ERROR (v4lmjpegsrc, RESOURCE, SETTINGS, (NULL), - GST_ERROR_SYSTEM); + GST_ERROR_SYSTEM); return FALSE; } @@ -324,15 +324,15 @@ gst_v4lmjpegsrc_capture_init (GstV4lMjpegSrc * v4lmjpegsrc) /* Request buffers */ if (ioctl (GST_V4LELEMENT (v4lmjpegsrc)->video_fd, - MJPIOC_REQBUFS, &(v4lmjpegsrc->breq)) < 0) { + MJPIOC_REQBUFS, &(v4lmjpegsrc->breq)) < 0) { GST_ELEMENT_ERROR (v4lmjpegsrc, RESOURCE, READ, (NULL), GST_ERROR_SYSTEM); return FALSE; } if (v4lmjpegsrc->breq.count < MIN_BUFFERS_QUEUED) { GST_ELEMENT_ERROR (v4lmjpegsrc, RESOURCE, READ, (NULL), - ("Too little buffers. We got %ld, we want at least %d", - v4lmjpegsrc->breq.count, MIN_BUFFERS_QUEUED)); + ("Too little buffers. We got %ld, we want at least %d", + v4lmjpegsrc->breq.count, MIN_BUFFERS_QUEUED)); return FALSE; } @@ -358,7 +358,7 @@ gst_v4lmjpegsrc_capture_init (GstV4lMjpegSrc * v4lmjpegsrc) GST_V4LELEMENT (v4lmjpegsrc)->video_fd, 0); if (GST_V4LELEMENT (v4lmjpegsrc)->buffer == MAP_FAILED) { GST_ELEMENT_ERROR (v4lmjpegsrc, RESOURCE, TOO_LAZY, (NULL), - ("Error mapping video buffers: %s", g_strerror (errno))); + ("Error mapping video buffers: %s", g_strerror (errno))); GST_V4LELEMENT (v4lmjpegsrc)->buffer = NULL; return FALSE; } @@ -425,22 +425,22 @@ gst_v4lmjpegsrc_grab_frame (GstV4lMjpegSrc * v4lmjpegsrc, v4lmjpegsrc->frame_queue_state[v4lmjpegsrc->queue_frame] == QUEUE_STATE_READY_FOR_QUEUE) { while (v4lmjpegsrc->frame_queue_state[v4lmjpegsrc->queue_frame] != - QUEUE_STATE_READY_FOR_QUEUE && !v4lmjpegsrc->quit) { + QUEUE_STATE_READY_FOR_QUEUE && !v4lmjpegsrc->quit) { GST_DEBUG ("Waiting for frames to become available (%d < %d)", - v4lmjpegsrc->num_queued, MIN_BUFFERS_QUEUED); + v4lmjpegsrc->num_queued, MIN_BUFFERS_QUEUED); g_cond_wait (v4lmjpegsrc->cond_queue_state, - v4lmjpegsrc->mutex_queue_state); + v4lmjpegsrc->mutex_queue_state); } if (v4lmjpegsrc->quit) { g_mutex_unlock (v4lmjpegsrc->mutex_queue_state); - return TRUE; /* it won't get through anyway */ + return TRUE; /* it won't get through anyway */ } if (!gst_v4lmjpegsrc_queue_frame (v4lmjpegsrc, v4lmjpegsrc->queue_frame)) { g_mutex_unlock (v4lmjpegsrc->mutex_queue_state); return FALSE; } v4lmjpegsrc->queue_frame = - (v4lmjpegsrc->queue_frame + 1) % v4lmjpegsrc->breq.count; + (v4lmjpegsrc->queue_frame + 1) % v4lmjpegsrc->breq.count; } /* syncing on the buffer grabs it */ @@ -496,8 +496,8 @@ gst_v4lmjpegsrc_requeue_frame (GstV4lMjpegSrc * v4lmjpegsrc, gint num) if (v4lmjpegsrc->frame_queue_state[num] != QUEUE_STATE_SYNCED) { GST_ELEMENT_ERROR (v4lmjpegsrc, RESOURCE, TOO_LAZY, (NULL), - ("Invalid state %d (expected %d), can't requeue", - v4lmjpegsrc->frame_queue_state[num], QUEUE_STATE_SYNCED)); + ("Invalid state %d (expected %d), can't requeue", + v4lmjpegsrc->frame_queue_state[num], QUEUE_STATE_SYNCED)); return FALSE; } diff --git a/sys/v4l/v4lsrc_calls.c b/sys/v4l/v4lsrc_calls.c index 995ce851e6..a85a99e708 100644 --- a/sys/v4l/v4lsrc_calls.c +++ b/sys/v4l/v4lsrc_calls.c @@ -47,23 +47,23 @@ /* palette names */ static const char *palette_name[] = { - "", /* 0 */ - "grayscale", /* VIDEO_PALETTE_GREY */ - "Hi-420", /* VIDEO_PALETTE_HI420 */ - "16-bit RGB (RGB-565)", /* VIDEO_PALETTE_RB565 */ - "24-bit RGB", /* VIDEO_PALETTE_RGB24 */ - "32-bit RGB", /* VIDEO_PALETTE_RGB32 */ - "15-bit RGB (RGB-555)", /* VIDEO_PALETTE_RGB555 */ - "YUV-4:2:2 (packed)", /* VIDEO_PALETTE_YUV422 */ - "YUYV", /* VIDEO_PALETTE_YUYV */ - "UYVY", /* VIDEO_PALETTE_UYVY */ - "YUV-4:2:0 (packed)", /* VIDEO_PALETTE_YUV420 */ - "YUV-4:1:1 (packed)", /* VIDEO_PALETTE_YUV411 */ - "Raw", /* VIDEO_PALETTE_RAW */ - "YUV-4:2:2 (planar)", /* VIDEO_PALETTE_YUV422P */ - "YUV-4:1:1 (planar)", /* VIDEO_PALETTE_YUV411P */ - "YUV-4:2:0 (planar)", /* VIDEO_PALETTE_YUV420P */ - "YUV-4:1:0 (planar)" /* VIDEO_PALETTE_YUV410P */ + "", /* 0 */ + "grayscale", /* VIDEO_PALETTE_GREY */ + "Hi-420", /* VIDEO_PALETTE_HI420 */ + "16-bit RGB (RGB-565)", /* VIDEO_PALETTE_RB565 */ + "24-bit RGB", /* VIDEO_PALETTE_RGB24 */ + "32-bit RGB", /* VIDEO_PALETTE_RGB32 */ + "15-bit RGB (RGB-555)", /* VIDEO_PALETTE_RGB555 */ + "YUV-4:2:2 (packed)", /* VIDEO_PALETTE_YUV422 */ + "YUYV", /* VIDEO_PALETTE_YUYV */ + "UYVY", /* VIDEO_PALETTE_UYVY */ + "YUV-4:2:0 (packed)", /* VIDEO_PALETTE_YUV420 */ + "YUV-4:1:1 (packed)", /* VIDEO_PALETTE_YUV411 */ + "Raw", /* VIDEO_PALETTE_RAW */ + "YUV-4:2:2 (planar)", /* VIDEO_PALETTE_YUV422P */ + "YUV-4:1:1 (planar)", /* VIDEO_PALETTE_YUV411P */ + "YUV-4:2:0 (planar)", /* VIDEO_PALETTE_YUV420P */ + "YUV-4:1:0 (planar)" /* VIDEO_PALETTE_YUV410P */ }; /****************************************************** @@ -85,9 +85,9 @@ gst_v4lsrc_queue_frame (GstV4lSrc * v4lsrc, gint num) v4lsrc->mmap.frame = num; if (ioctl (GST_V4LELEMENT (v4lsrc)->video_fd, - VIDIOCMCAPTURE, &(v4lsrc->mmap)) < 0) { + VIDIOCMCAPTURE, &(v4lsrc->mmap)) < 0) { GST_ELEMENT_ERROR (v4lsrc, RESOURCE, WRITE, (NULL), - ("Error queueing a buffer (%d): %s", num, g_strerror (errno))); + ("Error queueing a buffer (%d): %s", num, g_strerror (errno))); return FALSE; } @@ -176,16 +176,16 @@ gst_v4lsrc_capture_init (GstV4lSrc * v4lsrc) /* request buffer info */ if (ioctl (GST_V4LELEMENT (v4lsrc)->video_fd, VIDIOCGMBUF, - &(v4lsrc->mbuf)) < 0) { + &(v4lsrc->mbuf)) < 0) { GST_ELEMENT_ERROR (v4lsrc, RESOURCE, READ, (NULL), - ("Error getting buffer information: %s", g_strerror (errno))); + ("Error getting buffer information: %s", g_strerror (errno))); return FALSE; } if (v4lsrc->mbuf.frames < MIN_BUFFERS_QUEUED) { GST_ELEMENT_ERROR (v4lsrc, RESOURCE, READ, (NULL), - ("Not enough buffers. We got %d, we want at least %d", - v4lsrc->mbuf.frames, MIN_BUFFERS_QUEUED)); + ("Not enough buffers. We got %d, we want at least %d", + v4lsrc->mbuf.frames, MIN_BUFFERS_QUEUED)); return FALSE; } @@ -210,7 +210,7 @@ gst_v4lsrc_capture_init (GstV4lSrc * v4lsrc) PROT_READ | PROT_WRITE, MAP_SHARED, GST_V4LELEMENT (v4lsrc)->video_fd, 0); if (GST_V4LELEMENT (v4lsrc)->buffer == MAP_FAILED) { GST_ELEMENT_ERROR (v4lsrc, RESOURCE, TOO_LAZY, (NULL), - ("Error mapping video buffers: %s", g_strerror (errno))); + ("Error mapping video buffers: %s", g_strerror (errno))); GST_V4LELEMENT (v4lsrc)->buffer = NULL; return FALSE; } @@ -278,14 +278,14 @@ gst_v4lsrc_grab_frame (GstV4lSrc * v4lsrc, gint * num) v4lsrc->frame_queue_state[v4lsrc->queue_frame] == QUEUE_STATE_READY_FOR_QUEUE) { while (v4lsrc->frame_queue_state[v4lsrc->queue_frame] != - QUEUE_STATE_READY_FOR_QUEUE && !v4lsrc->quit) { + QUEUE_STATE_READY_FOR_QUEUE && !v4lsrc->quit) { GST_DEBUG ("Waiting for frames to become available (%d < %d)", - v4lsrc->num_queued, MIN_BUFFERS_QUEUED); + v4lsrc->num_queued, MIN_BUFFERS_QUEUED); g_cond_wait (v4lsrc->cond_queue_state, v4lsrc->mutex_queue_state); } if (v4lsrc->quit) { g_mutex_unlock (v4lsrc->mutex_queue_state); - return TRUE; /* it won't get through anyway */ + return TRUE; /* it won't get through anyway */ } if (!gst_v4lsrc_queue_frame (v4lsrc, v4lsrc->queue_frame)) { g_mutex_unlock (v4lsrc->mutex_queue_state); @@ -346,8 +346,8 @@ gst_v4lsrc_requeue_frame (GstV4lSrc * v4lsrc, gint num) if (v4lsrc->frame_queue_state[num] != QUEUE_STATE_SYNCED) { GST_ELEMENT_ERROR (v4lsrc, RESOURCE, TOO_LAZY, (NULL), - ("Invalid state %d (expected %d), can't requeue", - v4lsrc->frame_queue_state[num], QUEUE_STATE_SYNCED)); + ("Invalid state %d (expected %d), can't requeue", + v4lsrc->frame_queue_state[num], QUEUE_STATE_SYNCED)); return FALSE; } @@ -458,7 +458,7 @@ gst_v4lsrc_try_palette (GstV4lSrc * v4lsrc, gint palette) /* let's start by requesting a buffer and mmap()'ing it */ if (ioctl (GST_V4LELEMENT (v4lsrc)->video_fd, VIDIOCGMBUF, &vmbuf) < 0) { GST_ELEMENT_ERROR (v4lsrc, RESOURCE, READ, (NULL), - ("Error getting buffer information: %s", g_strerror (errno))); + ("Error getting buffer information: %s", g_strerror (errno))); return FALSE; } /* Map the buffers */ @@ -466,7 +466,7 @@ gst_v4lsrc_try_palette (GstV4lSrc * v4lsrc, gint palette) MAP_SHARED, GST_V4LELEMENT (v4lsrc)->video_fd, 0); if (buffer == MAP_FAILED) { GST_ELEMENT_ERROR (v4lsrc, RESOURCE, TOO_LAZY, (NULL), - ("Error mapping our try-out buffer: %s", g_strerror (errno))); + ("Error mapping our try-out buffer: %s", g_strerror (errno))); return FALSE; } @@ -476,9 +476,9 @@ gst_v4lsrc_try_palette (GstV4lSrc * v4lsrc, gint palette) vmmap.format = palette; vmmap.frame = frame; if (ioctl (GST_V4LELEMENT (v4lsrc)->video_fd, VIDIOCMCAPTURE, &vmmap) < 0) { - if (errno != EINVAL) /* our format failed! */ + if (errno != EINVAL) /* our format failed! */ GST_ELEMENT_ERROR (v4lsrc, RESOURCE, TOO_LAZY, (NULL), - ("Error queueing our try-out buffer: %s", g_strerror (errno))); + ("Error queueing our try-out buffer: %s", g_strerror (errno))); munmap (buffer, vmbuf.size); return FALSE; } diff --git a/sys/ximage/ximagesink.c b/sys/ximage/ximagesink.c index 68f26027da..03b3878d52 100644 --- a/sys/ximage/ximagesink.c +++ b/sys/ximage/ximagesink.c @@ -44,8 +44,8 @@ GST_STATIC_PAD_TEMPLATE ("sink", GST_PAD_SINK, GST_PAD_ALWAYS, GST_STATIC_CAPS ("video/x-raw-rgb, " - "framerate = (double) [ 1.0, 100.0 ], " - "width = (int) [ 0, MAX ], " "height = (int) [ 0, MAX ]") + "framerate = (double) [ 1.0, 100.0 ], " + "width = (int) [ 0, MAX ], " "height = (int) [ 0, MAX ]") ); enum @@ -113,8 +113,8 @@ gst_ximagesink_check_xshm_calls (GstXContext * xcontext) XSetErrorHandler (handler); - if (error_catched) { /* Failed, detaching shared memory, destroying image and telling we can't - use XShm */ + if (error_catched) { /* Failed, detaching shared memory, destroying image and telling we can't + use XShm */ error_catched = FALSE; XDestroyImage (ximage->ximage); shmdt (ximage->SHMInfo.shmaddr); @@ -158,12 +158,12 @@ gst_ximagesink_ximage_new (GstXImageSink * ximagesink, gint width, gint height) #ifdef HAVE_XSHM if (ximagesink->xcontext->use_xshm) { ximage->ximage = XShmCreateImage (ximagesink->xcontext->disp, - ximagesink->xcontext->visual, - ximagesink->xcontext->depth, - ZPixmap, NULL, &ximage->SHMInfo, ximage->width, ximage->height); + ximagesink->xcontext->visual, + ximagesink->xcontext->depth, + ZPixmap, NULL, &ximage->SHMInfo, ximage->width, ximage->height); ximage->SHMInfo.shmid = shmget (IPC_PRIVATE, ximage->size, - IPC_CREAT | 0777); + IPC_CREAT | 0777); ximage->SHMInfo.shmaddr = shmat (ximage->SHMInfo.shmid, 0, 0); ximage->ximage->data = ximage->SHMInfo.shmaddr; @@ -182,12 +182,12 @@ gst_ximagesink_ximage_new (GstXImageSink * ximagesink, gint width, gint height) ximage->data = g_malloc (ximage->size); ximage->ximage = XCreateImage (ximagesink->xcontext->disp, - ximagesink->xcontext->visual, - ximagesink->xcontext->depth, - ZPixmap, 0, ximage->data, - ximage->width, ximage->height, - ximagesink->xcontext->bpp, - ximage->width * (ximagesink->xcontext->bpp / 8)); + ximagesink->xcontext->visual, + ximagesink->xcontext->depth, + ZPixmap, 0, ximage->data, + ximage->width, ximage->height, + ximagesink->xcontext->bpp, + ximage->width * (ximagesink->xcontext->bpp / 8)); XSync (ximagesink->xcontext->disp, FALSE); } @@ -267,14 +267,14 @@ gst_ximagesink_ximage_put (GstXImageSink * ximagesink, GstXImage * ximage) #ifdef HAVE_XSHM if (ximagesink->xcontext->use_xshm) { XShmPutImage (ximagesink->xcontext->disp, ximagesink->xwindow->win, - ximagesink->xwindow->gc, ximage->ximage, - 0, 0, x, y, ximage->width, ximage->height, FALSE); + ximagesink->xwindow->gc, ximage->ximage, + 0, 0, x, y, ximage->width, ximage->height, FALSE); } else #endif /* HAVE_XSHM */ { XPutImage (ximagesink->xcontext->disp, ximagesink->xwindow->win, - ximagesink->xwindow->gc, ximage->ximage, - 0, 0, x, y, ximage->width, ximage->height); + ximagesink->xwindow->gc, ximage->ximage, + 0, 0, x, y, ximage->width, ximage->height); } XSync (ximagesink->xcontext->disp, FALSE); @@ -432,16 +432,16 @@ gst_ximagesink_renegotiate_size (GstXImageSink * ximagesink) GstPadLinkReturn r; r = gst_pad_try_set_caps (GST_VIDEOSINK_PAD (ximagesink), - gst_caps_new_simple ("video/x-raw-rgb", - "bpp", G_TYPE_INT, ximagesink->xcontext->bpp, - "depth", G_TYPE_INT, ximagesink->xcontext->depth, - "endianness", G_TYPE_INT, ximagesink->xcontext->endianness, - "red_mask", G_TYPE_INT, ximagesink->xcontext->visual->red_mask, - "green_mask", G_TYPE_INT, ximagesink->xcontext->visual->green_mask, - "blue_mask", G_TYPE_INT, ximagesink->xcontext->visual->blue_mask, - "width", G_TYPE_INT, ximagesink->xwindow->width, - "height", G_TYPE_INT, ximagesink->xwindow->height, - "framerate", G_TYPE_DOUBLE, ximagesink->framerate, NULL)); + gst_caps_new_simple ("video/x-raw-rgb", + "bpp", G_TYPE_INT, ximagesink->xcontext->bpp, + "depth", G_TYPE_INT, ximagesink->xcontext->depth, + "endianness", G_TYPE_INT, ximagesink->xcontext->endianness, + "red_mask", G_TYPE_INT, ximagesink->xcontext->visual->red_mask, + "green_mask", G_TYPE_INT, ximagesink->xcontext->visual->green_mask, + "blue_mask", G_TYPE_INT, ximagesink->xcontext->visual->blue_mask, + "width", G_TYPE_INT, ximagesink->xwindow->width, + "height", G_TYPE_INT, ximagesink->xwindow->height, + "framerate", G_TYPE_DOUBLE, ximagesink->framerate, NULL)); if ((r == GST_PAD_LINK_OK) || (r == GST_PAD_LINK_DONE)) { /* Renegotiation succeeded, we update our size and image */ @@ -449,15 +449,15 @@ gst_ximagesink_renegotiate_size (GstXImageSink * ximagesink) GST_VIDEOSINK_HEIGHT (ximagesink) = ximagesink->xwindow->height; if ((ximagesink->ximage) && - ((GST_VIDEOSINK_WIDTH (ximagesink) != ximagesink->ximage->width) || - (GST_VIDEOSINK_HEIGHT (ximagesink) != - ximagesink->ximage->height))) { - /* We renew our ximage only if size changed */ - gst_ximagesink_ximage_destroy (ximagesink, ximagesink->ximage); - - ximagesink->ximage = gst_ximagesink_ximage_new (ximagesink, - GST_VIDEOSINK_WIDTH (ximagesink), - GST_VIDEOSINK_HEIGHT (ximagesink)); + ((GST_VIDEOSINK_WIDTH (ximagesink) != ximagesink->ximage->width) || + (GST_VIDEOSINK_HEIGHT (ximagesink) != + ximagesink->ximage->height))) { + /* We renew our ximage only if size changed */ + gst_ximagesink_ximage_destroy (ximagesink, ximagesink->ximage); + + ximagesink->ximage = gst_ximagesink_ximage_new (ximagesink, + GST_VIDEOSINK_WIDTH (ximagesink), + GST_VIDEOSINK_HEIGHT (ximagesink)); } } else { ximagesink->sw_scaling_failed = TRUE; @@ -484,17 +484,17 @@ gst_ximagesink_handle_xevents (GstXImageSink * ximagesink, GstPad * pad) interesting. */ g_mutex_lock (ximagesink->x_lock); while (XCheckWindowEvent (ximagesink->xcontext->disp, - ximagesink->xwindow->win, PointerMotionMask, &e)) { + ximagesink->xwindow->win, PointerMotionMask, &e)) { g_mutex_unlock (ximagesink->x_lock); switch (e.type) { case MotionNotify: - pointer_x = e.xmotion.x; - pointer_y = e.xmotion.y; - pointer_moved = TRUE; - break; + pointer_x = e.xmotion.x; + pointer_y = e.xmotion.y; + pointer_moved = TRUE; + break; default: - break; + break; } g_mutex_lock (ximagesink->x_lock); @@ -503,17 +503,17 @@ gst_ximagesink_handle_xevents (GstXImageSink * ximagesink, GstPad * pad) if (pointer_moved) { GST_DEBUG ("ximagesink pointer moved over window at %d,%d", - pointer_x, pointer_y); + pointer_x, pointer_y); gst_navigation_send_mouse_event (GST_NAVIGATION (ximagesink), - "mouse-move", 0, pointer_x, pointer_y); + "mouse-move", 0, pointer_x, pointer_y); } /* We get all remaining events on our window to throw them upstream */ g_mutex_lock (ximagesink->x_lock); while (XCheckWindowEvent (ximagesink->xcontext->disp, - ximagesink->xwindow->win, - KeyPressMask | KeyReleaseMask | - ButtonPressMask | ButtonReleaseMask, &e)) { + ximagesink->xwindow->win, + KeyPressMask | KeyReleaseMask | + ButtonPressMask | ButtonReleaseMask, &e)) { KeySym keysym; /* We lock only for the X function call */ @@ -521,38 +521,38 @@ gst_ximagesink_handle_xevents (GstXImageSink * ximagesink, GstPad * pad) switch (e.type) { case ButtonPress: - /* Mouse button pressed/released over our window. We send upstream - events for interactivity/navigation */ - GST_DEBUG ("ximagesink button %d pressed over window at %d,%d", - e.xbutton.button, e.xbutton.x, e.xbutton.x); - gst_navigation_send_mouse_event (GST_NAVIGATION (ximagesink), - "mouse-button-press", e.xbutton.button, e.xbutton.x, e.xbutton.y); - break; + /* Mouse button pressed/released over our window. We send upstream + events for interactivity/navigation */ + GST_DEBUG ("ximagesink button %d pressed over window at %d,%d", + e.xbutton.button, e.xbutton.x, e.xbutton.x); + gst_navigation_send_mouse_event (GST_NAVIGATION (ximagesink), + "mouse-button-press", e.xbutton.button, e.xbutton.x, e.xbutton.y); + break; case ButtonRelease: - GST_DEBUG ("ximagesink button %d release over window at %d,%d", - e.xbutton.button, e.xbutton.x, e.xbutton.x); - gst_navigation_send_mouse_event (GST_NAVIGATION (ximagesink), - "mouse-button-release", e.xbutton.button, e.xbutton.x, e.xbutton.y); - break; + GST_DEBUG ("ximagesink button %d release over window at %d,%d", + e.xbutton.button, e.xbutton.x, e.xbutton.x); + gst_navigation_send_mouse_event (GST_NAVIGATION (ximagesink), + "mouse-button-release", e.xbutton.button, e.xbutton.x, e.xbutton.y); + break; case KeyPress: case KeyRelease: - /* Key pressed/released over our window. We send upstream - events for interactivity/navigation */ - GST_DEBUG ("ximagesink key %d pressed over window at %d,%d", - e.xkey.keycode, e.xkey.x, e.xkey.x); - keysym = XKeycodeToKeysym (ximagesink->xcontext->disp, - e.xkey.keycode, 0); - if (keysym != NoSymbol) { - gst_navigation_send_key_event (GST_NAVIGATION (ximagesink), - e.type == KeyPress ? - "key-press" : "key-release", XKeysymToString (keysym)); - } else { - gst_navigation_send_key_event (GST_NAVIGATION (ximagesink), - e.type == KeyPress ? "key-press" : "key-release", "unknown"); - } - break; + /* Key pressed/released over our window. We send upstream + events for interactivity/navigation */ + GST_DEBUG ("ximagesink key %d pressed over window at %d,%d", + e.xkey.keycode, e.xkey.x, e.xkey.x); + keysym = XKeycodeToKeysym (ximagesink->xcontext->disp, + e.xkey.keycode, 0); + if (keysym != NoSymbol) { + gst_navigation_send_key_event (GST_NAVIGATION (ximagesink), + e.type == KeyPress ? + "key-press" : "key-release", XKeysymToString (keysym)); + } else { + gst_navigation_send_key_event (GST_NAVIGATION (ximagesink), + e.type == KeyPress ? "key-press" : "key-release", "unknown"); + } + break; default: - GST_DEBUG ("ximagesink unhandled X event (%d)", e.type); + GST_DEBUG ("ximagesink unhandled X event (%d)", e.type); } g_mutex_lock (ximagesink->x_lock); @@ -583,7 +583,7 @@ gst_ximagesink_xcontext_get (GstXImageSink * ximagesink) g_mutex_unlock (ximagesink->x_lock); g_free (xcontext); GST_ELEMENT_ERROR (ximagesink, RESOURCE, TOO_LAZY, (NULL), - ("Could not open display")); + ("Could not open display")); return NULL; } @@ -686,7 +686,7 @@ gst_ximagesink_imagepool_clear (GstXImageSink * ximagesink) GstXImage *ximage = ximagesink->image_pool->data; ximagesink->image_pool = g_slist_delete_link (ximagesink->image_pool, - ximagesink->image_pool); + ximagesink->image_pool); gst_ximagesink_ximage_destroy (ximagesink, ximage); } @@ -714,7 +714,7 @@ gst_ximagesink_fixate (GstPad * pad, const GstCaps * caps) return newcaps; } if (gst_caps_structure_fixate_field_nearest_double (structure, "framerate", - 30.0)) { + 30.0)) { return newcaps; } @@ -777,21 +777,21 @@ gst_ximagesink_sink_link (GstPad * pad, const GstCaps * caps) /* Creating our window and our image */ if (!ximagesink->xwindow) ximagesink->xwindow = gst_ximagesink_xwindow_new (ximagesink, - GST_VIDEOSINK_WIDTH (ximagesink), GST_VIDEOSINK_HEIGHT (ximagesink)); + GST_VIDEOSINK_WIDTH (ximagesink), GST_VIDEOSINK_HEIGHT (ximagesink)); else { if (ximagesink->xwindow->internal) gst_ximagesink_xwindow_resize (ximagesink, ximagesink->xwindow, - GST_VIDEOSINK_WIDTH (ximagesink), GST_VIDEOSINK_HEIGHT (ximagesink)); + GST_VIDEOSINK_WIDTH (ximagesink), GST_VIDEOSINK_HEIGHT (ximagesink)); } - if ((ximagesink->ximage) && ((GST_VIDEOSINK_WIDTH (ximagesink) != ximagesink->ximage->width) || (GST_VIDEOSINK_HEIGHT (ximagesink) != ximagesink->ximage->height))) { /* We renew our ximage only if size changed */ + if ((ximagesink->ximage) && ((GST_VIDEOSINK_WIDTH (ximagesink) != ximagesink->ximage->width) || (GST_VIDEOSINK_HEIGHT (ximagesink) != ximagesink->ximage->height))) { /* We renew our ximage only if size changed */ gst_ximagesink_ximage_destroy (ximagesink, ximagesink->ximage); ximagesink->ximage = gst_ximagesink_ximage_new (ximagesink, - GST_VIDEOSINK_WIDTH (ximagesink), GST_VIDEOSINK_HEIGHT (ximagesink)); - } else if (!ximagesink->ximage) /* If no ximage, creating one */ + GST_VIDEOSINK_WIDTH (ximagesink), GST_VIDEOSINK_HEIGHT (ximagesink)); + } else if (!ximagesink->ximage) /* If no ximage, creating one */ ximagesink->ximage = gst_ximagesink_ximage_new (ximagesink, - GST_VIDEOSINK_WIDTH (ximagesink), GST_VIDEOSINK_HEIGHT (ximagesink)); + GST_VIDEOSINK_WIDTH (ximagesink), GST_VIDEOSINK_HEIGHT (ximagesink)); gst_x_overlay_got_desired_size (GST_X_OVERLAY (ximagesink), GST_VIDEOSINK_WIDTH (ximagesink), GST_VIDEOSINK_HEIGHT (ximagesink)); @@ -810,13 +810,13 @@ gst_ximagesink_change_state (GstElement * element) case GST_STATE_NULL_TO_READY: /* Initializing the XContext */ if (!ximagesink->xcontext) - ximagesink->xcontext = gst_ximagesink_xcontext_get (ximagesink); + ximagesink->xcontext = gst_ximagesink_xcontext_get (ximagesink); if (!ximagesink->xcontext) - return GST_STATE_FAILURE; + return GST_STATE_FAILURE; break; case GST_STATE_READY_TO_PAUSED: if (ximagesink->xwindow) - gst_ximagesink_xwindow_clear (ximagesink, ximagesink->xwindow); + gst_ximagesink_xwindow_clear (ximagesink, ximagesink->xwindow); ximagesink->time = 0; break; case GST_STATE_PAUSED_TO_PLAYING: @@ -831,21 +831,21 @@ gst_ximagesink_change_state (GstElement * element) break; case GST_STATE_READY_TO_NULL: if (ximagesink->ximage) { - gst_ximagesink_ximage_destroy (ximagesink, ximagesink->ximage); - ximagesink->ximage = NULL; + gst_ximagesink_ximage_destroy (ximagesink, ximagesink->ximage); + ximagesink->ximage = NULL; } if (ximagesink->image_pool) - gst_ximagesink_imagepool_clear (ximagesink); + gst_ximagesink_imagepool_clear (ximagesink); if (ximagesink->xwindow) { - gst_ximagesink_xwindow_destroy (ximagesink, ximagesink->xwindow); - ximagesink->xwindow = NULL; + gst_ximagesink_xwindow_destroy (ximagesink, ximagesink->xwindow); + ximagesink->xwindow = NULL; } if (ximagesink->xcontext) { - gst_ximagesink_xcontext_clear (ximagesink); - ximagesink->xcontext = NULL; + gst_ximagesink_xcontext_clear (ximagesink); + ximagesink->xcontext = NULL; } break; } @@ -887,18 +887,18 @@ gst_ximagesink_chain (GstPad * pad, GstData * data) put the ximage which is in the PRIVATE pointer */ if (GST_BUFFER_FREE_DATA_FUNC (buf) == gst_ximagesink_buffer_free) { gst_ximagesink_ximage_put (ximagesink, GST_BUFFER_PRIVATE (buf)); - } else { /* Else we have to copy the data into our private image, */ + } else { /* Else we have to copy the data into our private image, */ /* if we have one... */ if (ximagesink->ximage) { memcpy (ximagesink->ximage->ximage->data, - GST_BUFFER_DATA (buf), - MIN (GST_BUFFER_SIZE (buf), ximagesink->ximage->size)); + GST_BUFFER_DATA (buf), + MIN (GST_BUFFER_SIZE (buf), ximagesink->ximage->size)); gst_ximagesink_ximage_put (ximagesink, ximagesink->ximage); - } else { /* No image available. Something went wrong during capsnego ! */ + } else { /* No image available. Something went wrong during capsnego ! */ gst_buffer_unref (buf); GST_ELEMENT_ERROR (ximagesink, CORE, NEGOTIATION, (NULL), - ("no format defined before chain function")); + ("no format defined before chain function")); return; } } @@ -930,7 +930,7 @@ gst_ximagesink_buffer_free (GstBuffer * buffer) if ((ximage->width != GST_VIDEOSINK_WIDTH (ximagesink)) || (ximage->height != GST_VIDEOSINK_HEIGHT (ximagesink))) gst_ximagesink_ximage_destroy (ximagesink, ximage); - else { /* In that case we can reuse the image and add it to our image pool. */ + else { /* In that case we can reuse the image and add it to our image pool. */ g_mutex_lock (ximagesink->pool_lock); ximagesink->image_pool = g_slist_prepend (ximagesink->image_pool, ximage); @@ -958,23 +958,23 @@ gst_ximagesink_buffer_alloc (GstPad * pad, guint64 offset, guint size) if (ximage) { /* Removing from the pool */ ximagesink->image_pool = g_slist_delete_link (ximagesink->image_pool, - ximagesink->image_pool); + ximagesink->image_pool); - if ((ximage->width != GST_VIDEOSINK_WIDTH (ximagesink)) || (ximage->height != GST_VIDEOSINK_HEIGHT (ximagesink))) { /* This image is unusable. Destroying... */ - gst_ximagesink_ximage_destroy (ximagesink, ximage); - ximage = NULL; - } else { /* We found a suitable image */ + if ((ximage->width != GST_VIDEOSINK_WIDTH (ximagesink)) || (ximage->height != GST_VIDEOSINK_HEIGHT (ximagesink))) { /* This image is unusable. Destroying... */ + gst_ximagesink_ximage_destroy (ximagesink, ximage); + ximage = NULL; + } else { /* We found a suitable image */ - break; + break; } } } g_mutex_unlock (ximagesink->pool_lock); - if (!ximage) { /* We found no suitable image in the pool. Creating... */ + if (!ximage) { /* We found no suitable image in the pool. Creating... */ ximage = gst_ximagesink_ximage_new (ximagesink, - GST_VIDEOSINK_WIDTH (ximagesink), GST_VIDEOSINK_HEIGHT (ximagesink)); + GST_VIDEOSINK_WIDTH (ximagesink), GST_VIDEOSINK_HEIGHT (ximagesink)); } if (ximage) { @@ -1088,7 +1088,7 @@ gst_ximagesink_set_xwindow_id (GstXOverlay * overlay, XID xwindow_id) during caps nego then */ if (GST_VIDEOSINK_WIDTH (ximagesink) && GST_VIDEOSINK_HEIGHT (ximagesink)) { xwindow = gst_ximagesink_xwindow_new (ximagesink, - GST_VIDEOSINK_WIDTH (ximagesink), GST_VIDEOSINK_HEIGHT (ximagesink)); + GST_VIDEOSINK_WIDTH (ximagesink), GST_VIDEOSINK_HEIGHT (ximagesink)); } } else { xwindow = g_new0 (GstXWindow, 1); @@ -1103,8 +1103,8 @@ gst_ximagesink_set_xwindow_id (GstXOverlay * overlay, XID xwindow_id) xwindow->height = attr.height; xwindow->internal = FALSE; XSelectInput (ximagesink->xcontext->disp, xwindow->win, ExposureMask | - StructureNotifyMask | PointerMotionMask | KeyPressMask | - KeyReleaseMask); + StructureNotifyMask | PointerMotionMask | KeyPressMask | + KeyReleaseMask); xwindow->gc = XCreateGC (ximagesink->xcontext->disp, xwindow->win, 0, NULL); g_mutex_unlock (ximagesink->x_lock); @@ -1112,26 +1112,26 @@ gst_ximagesink_set_xwindow_id (GstXOverlay * overlay, XID xwindow_id) /* If that new window geometry differs from our one we try to renegotiate caps */ if (gst_pad_is_negotiated (GST_VIDEOSINK_PAD (ximagesink)) && - (xwindow->width != GST_VIDEOSINK_WIDTH (ximagesink) || - xwindow->height != GST_VIDEOSINK_HEIGHT (ximagesink))) { + (xwindow->width != GST_VIDEOSINK_WIDTH (ximagesink) || + xwindow->height != GST_VIDEOSINK_HEIGHT (ximagesink))) { GstPadLinkReturn r; r = gst_pad_try_set_caps (GST_VIDEOSINK_PAD (ximagesink), - gst_caps_new_simple ("video/x-raw-rgb", - "bpp", G_TYPE_INT, ximagesink->xcontext->bpp, - "depth", G_TYPE_INT, ximagesink->xcontext->depth, - "endianness", G_TYPE_INT, ximagesink->xcontext->endianness, - "red_mask", G_TYPE_INT, ximagesink->xcontext->visual->red_mask, - "green_mask", G_TYPE_INT, - ximagesink->xcontext->visual->green_mask, "blue_mask", G_TYPE_INT, - ximagesink->xcontext->visual->blue_mask, "width", G_TYPE_INT, - xwindow->width, "height", G_TYPE_INT, xwindow->height, - "framerate", G_TYPE_DOUBLE, ximagesink->framerate, NULL)); + gst_caps_new_simple ("video/x-raw-rgb", + "bpp", G_TYPE_INT, ximagesink->xcontext->bpp, + "depth", G_TYPE_INT, ximagesink->xcontext->depth, + "endianness", G_TYPE_INT, ximagesink->xcontext->endianness, + "red_mask", G_TYPE_INT, ximagesink->xcontext->visual->red_mask, + "green_mask", G_TYPE_INT, + ximagesink->xcontext->visual->green_mask, "blue_mask", G_TYPE_INT, + ximagesink->xcontext->visual->blue_mask, "width", G_TYPE_INT, + xwindow->width, "height", G_TYPE_INT, xwindow->height, + "framerate", G_TYPE_DOUBLE, ximagesink->framerate, NULL)); /* If caps nego succeded updating our size */ if ((r == GST_PAD_LINK_OK) || (r == GST_PAD_LINK_DONE)) { - GST_VIDEOSINK_WIDTH (ximagesink) = xwindow->width; - GST_VIDEOSINK_HEIGHT (ximagesink) = xwindow->height; + GST_VIDEOSINK_WIDTH (ximagesink) = xwindow->width; + GST_VIDEOSINK_HEIGHT (ximagesink) = xwindow->height; } } } @@ -1140,7 +1140,7 @@ gst_ximagesink_set_xwindow_id (GstXOverlay * overlay, XID xwindow_id) if (!ximagesink->ximage && GST_VIDEOSINK_WIDTH (ximagesink) && GST_VIDEOSINK_HEIGHT (ximagesink)) { ximagesink->ximage = gst_ximagesink_ximage_new (ximagesink, - GST_VIDEOSINK_WIDTH (ximagesink), GST_VIDEOSINK_HEIGHT (ximagesink)); + GST_VIDEOSINK_WIDTH (ximagesink), GST_VIDEOSINK_HEIGHT (ximagesink)); } if (xwindow) @@ -1209,7 +1209,7 @@ gst_ximagesink_set_property (GObject * object, guint prop_id, case ARG_SYNCHRONOUS: ximagesink->synchronous = g_value_get_boolean (value); if (ximagesink->xcontext) { - XSynchronize (ximagesink->xcontext->disp, ximagesink->synchronous); + XSynchronize (ximagesink->xcontext->disp, ximagesink->synchronous); } break; default: @@ -1326,11 +1326,11 @@ gst_ximagesink_class_init (GstXImageSinkClass * klass) g_object_class_install_property (gobject_class, ARG_DISPLAY, g_param_spec_string ("display", "Display", "X Display name", - NULL, G_PARAM_READWRITE)); + NULL, G_PARAM_READWRITE)); g_object_class_install_property (gobject_class, ARG_SYNCHRONOUS, g_param_spec_boolean ("synchronous", "Synchronous", "When enabled, runs " - "the X display in synchronous mode. (used only for debugging)", FALSE, - G_PARAM_READWRITE)); + "the X display in synchronous mode. (used only for debugging)", FALSE, + G_PARAM_READWRITE)); gobject_class->dispose = gst_ximagesink_dispose; gobject_class->set_property = gst_ximagesink_set_property; @@ -1385,14 +1385,14 @@ gst_ximagesink_get_type (void) }; ximagesink_type = g_type_register_static (GST_TYPE_VIDEOSINK, - "GstXImageSink", &ximagesink_info, 0); + "GstXImageSink", &ximagesink_info, 0); g_type_add_interface_static (ximagesink_type, GST_TYPE_IMPLEMENTS_INTERFACE, - &iface_info); + &iface_info); g_type_add_interface_static (ximagesink_type, GST_TYPE_NAVIGATION, - &navigation_info); + &navigation_info); g_type_add_interface_static (ximagesink_type, GST_TYPE_X_OVERLAY, - &overlay_info); + &overlay_info); } return ximagesink_type; @@ -1406,7 +1406,7 @@ plugin_init (GstPlugin * plugin) return FALSE; if (!gst_element_register (plugin, "ximagesink", - GST_RANK_SECONDARY, GST_TYPE_XIMAGESINK)) + GST_RANK_SECONDARY, GST_TYPE_XIMAGESINK)) return FALSE; return TRUE; diff --git a/sys/xvimage/xvimagesink.c b/sys/xvimage/xvimagesink.c index ef71a4b0b8..cddeb57f28 100644 --- a/sys/xvimage/xvimagesink.c +++ b/sys/xvimage/xvimagesink.c @@ -45,12 +45,12 @@ static GstStaticPadTemplate gst_xvimagesink_sink_template_factory = GST_PAD_SINK, GST_PAD_ALWAYS, GST_STATIC_CAPS ("video/x-raw-rgb, " - "framerate = (double) [ 1.0, 100.0 ], " - "width = (int) [ 0, MAX ], " - "height = (int) [ 0, MAX ]; " - "video/x-raw-yuv, " - "framerate = (double) [ 1.0, 100.0 ], " - "width = (int) [ 0, MAX ], " "height = (int) [ 0, MAX ]") + "framerate = (double) [ 1.0, 100.0 ], " + "width = (int) [ 0, MAX ], " + "height = (int) [ 0, MAX ]; " + "video/x-raw-yuv, " + "framerate = (double) [ 1.0, 100.0 ], " + "width = (int) [ 0, MAX ], " "height = (int) [ 0, MAX ]") ); enum @@ -123,8 +123,8 @@ gst_xvimagesink_check_xshm_calls (GstXContext * xcontext) XSetErrorHandler (handler); - if (error_catched) { /* Failed, detaching shared memory, destroying image and telling we can't - use XShm */ + if (error_catched) { /* Failed, detaching shared memory, destroying image and telling we can't + use XShm */ error_catched = FALSE; XFree (xvimage->xvimage); shmdt (xvimage->SHMInfo.shmaddr); @@ -169,12 +169,12 @@ gst_xvimagesink_xvimage_new (GstXvImageSink * xvimagesink, #ifdef HAVE_XSHM if (xvimagesink->xcontext->use_xshm) { xvimage->xvimage = XvShmCreateImage (xvimagesink->xcontext->disp, - xvimagesink->xcontext->xv_port_id, - xvimagesink->xcontext->im_format, - NULL, xvimage->width, xvimage->height, &xvimage->SHMInfo); + xvimagesink->xcontext->xv_port_id, + xvimagesink->xcontext->im_format, + NULL, xvimage->width, xvimage->height, &xvimage->SHMInfo); xvimage->SHMInfo.shmid = shmget (IPC_PRIVATE, xvimage->size, - IPC_CREAT | 0777); + IPC_CREAT | 0777); xvimage->SHMInfo.shmaddr = shmat (xvimage->SHMInfo.shmid, 0, 0); xvimage->xvimage->data = xvimage->SHMInfo.shmaddr; @@ -191,9 +191,9 @@ gst_xvimagesink_xvimage_new (GstXvImageSink * xvimagesink, #endif /* HAVE_XSHM */ { xvimage->xvimage = XvCreateImage (xvimagesink->xcontext->disp, - xvimagesink->xcontext->xv_port_id, - xvimagesink->xcontext->im_format, - xvimage->data, xvimage->width, xvimage->height); + xvimagesink->xcontext->xv_port_id, + xvimagesink->xcontext->im_format, + xvimage->data, xvimage->width, xvimage->height); xvimage->data = g_malloc (xvimage->xvimage->data_size); @@ -272,20 +272,20 @@ gst_xvimagesink_xvimage_put (GstXvImageSink * xvimagesink, GstXvImage * xvimage) #ifdef HAVE_XSHM if (xvimagesink->xcontext->use_xshm) { XvShmPutImage (xvimagesink->xcontext->disp, - xvimagesink->xcontext->xv_port_id, - xvimagesink->xwindow->win, - xvimagesink->xwindow->gc, xvimage->xvimage, - 0, 0, xvimage->width, xvimage->height, - 0, 0, xvimagesink->xwindow->width, xvimagesink->xwindow->height, FALSE); + xvimagesink->xcontext->xv_port_id, + xvimagesink->xwindow->win, + xvimagesink->xwindow->gc, xvimage->xvimage, + 0, 0, xvimage->width, xvimage->height, + 0, 0, xvimagesink->xwindow->width, xvimagesink->xwindow->height, FALSE); } else #endif /* HAVE_XSHM */ { XvPutImage (xvimagesink->xcontext->disp, - xvimagesink->xcontext->xv_port_id, - xvimagesink->xwindow->win, - xvimagesink->xwindow->gc, xvimage->xvimage, - 0, 0, xvimage->width, xvimage->height, - 0, 0, xvimagesink->xwindow->width, xvimagesink->xwindow->height); + xvimagesink->xcontext->xv_port_id, + xvimagesink->xwindow->win, + xvimagesink->xwindow->gc, xvimage->xvimage, + 0, 0, xvimage->width, xvimage->height, + 0, 0, xvimagesink->xwindow->width, xvimagesink->xwindow->height); } XSync (xvimagesink->xcontext->disp, FALSE); @@ -431,27 +431,27 @@ gst_xvimagesink_update_colorbalance (GstXvImageSink * xvimagesink) convert_coef = (channel->max_value - channel->min_value) / 2000.0; if (g_ascii_strcasecmp (channel->label, "XV_HUE") == 0) { - value = (xvimagesink->hue + 1000) * convert_coef + channel->min_value; + value = (xvimagesink->hue + 1000) * convert_coef + channel->min_value; } else if (g_ascii_strcasecmp (channel->label, "XV_SATURATION") == 0) { - value = (xvimagesink->saturation + 1000) * convert_coef + - channel->min_value; + value = (xvimagesink->saturation + 1000) * convert_coef + + channel->min_value; } else if (g_ascii_strcasecmp (channel->label, "XV_CONTRAST") == 0) { - value = (xvimagesink->contrast + 1000) * convert_coef + - channel->min_value; + value = (xvimagesink->contrast + 1000) * convert_coef + + channel->min_value; } else if (g_ascii_strcasecmp (channel->label, "XV_BRIGHTNESS") == 0) { - value = (xvimagesink->brightness + 1000) * convert_coef + - channel->min_value; + value = (xvimagesink->brightness + 1000) * convert_coef + + channel->min_value; } else { - g_warning ("got an unknown channel %s", channel->label); - g_object_unref (channel); - return; + g_warning ("got an unknown channel %s", channel->label); + g_object_unref (channel); + return; } /* Committing to Xv port */ g_mutex_lock (xvimagesink->x_lock); XvSetPortAttribute (xvimagesink->xcontext->disp, - xvimagesink->xcontext->xv_port_id, - XInternAtom (xvimagesink->xcontext->disp, channel->label, 1), value); + xvimagesink->xcontext->xv_port_id, + XInternAtom (xvimagesink->xcontext->disp, channel->label, 1), value); g_mutex_unlock (xvimagesink->x_lock); g_object_unref (channel); @@ -477,17 +477,17 @@ gst_xvimagesink_handle_xevents (GstXvImageSink * xvimagesink, GstPad * pad) interesting. */ g_mutex_lock (xvimagesink->x_lock); while (XCheckWindowEvent (xvimagesink->xcontext->disp, - xvimagesink->xwindow->win, PointerMotionMask, &e)) { + xvimagesink->xwindow->win, PointerMotionMask, &e)) { g_mutex_unlock (xvimagesink->x_lock); switch (e.type) { case MotionNotify: - pointer_x = e.xmotion.x; - pointer_y = e.xmotion.y; - pointer_moved = TRUE; - break; + pointer_x = e.xmotion.x; + pointer_y = e.xmotion.y; + pointer_moved = TRUE; + break; default: - break; + break; } g_mutex_lock (xvimagesink->x_lock); @@ -496,17 +496,17 @@ gst_xvimagesink_handle_xevents (GstXvImageSink * xvimagesink, GstPad * pad) if (pointer_moved) { GST_DEBUG ("xvimagesink pointer moved over window at %d,%d", - pointer_x, pointer_y); + pointer_x, pointer_y); gst_navigation_send_mouse_event (GST_NAVIGATION (xvimagesink), - "mouse-move", 0, pointer_x, pointer_y); + "mouse-move", 0, pointer_x, pointer_y); } /* We get all events on our window to throw them upstream */ g_mutex_lock (xvimagesink->x_lock); while (XCheckWindowEvent (xvimagesink->xcontext->disp, - xvimagesink->xwindow->win, - StructureNotifyMask | KeyPressMask | - KeyReleaseMask | ButtonPressMask | ButtonReleaseMask, &e)) { + xvimagesink->xwindow->win, + StructureNotifyMask | KeyPressMask | + KeyReleaseMask | ButtonPressMask | ButtonReleaseMask, &e)) { KeySym keysym; /* We lock only for the X function call */ @@ -514,48 +514,48 @@ gst_xvimagesink_handle_xevents (GstXvImageSink * xvimagesink, GstPad * pad) switch (e.type) { case ConfigureNotify: - /* Window got resized or moved. We update our data. */ - GST_DEBUG ("xvimagesink window is at %d, %d with geometry : %d,%d", - e.xconfigure.x, e.xconfigure.y, - e.xconfigure.width, e.xconfigure.height); - xvimagesink->xwindow->width = e.xconfigure.width; - xvimagesink->xwindow->height = e.xconfigure.height; - break; + /* Window got resized or moved. We update our data. */ + GST_DEBUG ("xvimagesink window is at %d, %d with geometry : %d,%d", + e.xconfigure.x, e.xconfigure.y, + e.xconfigure.width, e.xconfigure.height); + xvimagesink->xwindow->width = e.xconfigure.width; + xvimagesink->xwindow->height = e.xconfigure.height; + break; case ButtonPress: - /* Mouse button pressed over our window. We send upstream - events for interactivity/navigation */ - GST_DEBUG ("xvimagesink button %d pressed over window at %d,%d", - e.xbutton.button, e.xbutton.x, e.xbutton.y); - gst_navigation_send_mouse_event (GST_NAVIGATION (xvimagesink), - "mouse-button-press", e.xbutton.button, e.xbutton.x, e.xbutton.y); - break; + /* Mouse button pressed over our window. We send upstream + events for interactivity/navigation */ + GST_DEBUG ("xvimagesink button %d pressed over window at %d,%d", + e.xbutton.button, e.xbutton.x, e.xbutton.y); + gst_navigation_send_mouse_event (GST_NAVIGATION (xvimagesink), + "mouse-button-press", e.xbutton.button, e.xbutton.x, e.xbutton.y); + break; case ButtonRelease: - /* Mouse button released over our window. We send upstream - events for interactivity/navigation */ - GST_DEBUG ("xvimagesink button %d released over window at %d,%d", - e.xbutton.button, e.xbutton.x, e.xbutton.y); - gst_navigation_send_mouse_event (GST_NAVIGATION (xvimagesink), - "mouse-button-release", e.xbutton.button, e.xbutton.x, e.xbutton.y); - break; + /* Mouse button released over our window. We send upstream + events for interactivity/navigation */ + GST_DEBUG ("xvimagesink button %d released over window at %d,%d", + e.xbutton.button, e.xbutton.x, e.xbutton.y); + gst_navigation_send_mouse_event (GST_NAVIGATION (xvimagesink), + "mouse-button-release", e.xbutton.button, e.xbutton.x, e.xbutton.y); + break; case KeyPress: case KeyRelease: - /* Key pressed/released over our window. We send upstream - events for interactivity/navigation */ - GST_DEBUG ("xvimagesink key %d pressed over window at %d,%d", - e.xkey.keycode, e.xkey.x, e.xkey.y); - keysym = XKeycodeToKeysym (xvimagesink->xcontext->disp, - e.xkey.keycode, 0); - if (keysym != NoSymbol) { - gst_navigation_send_key_event (GST_NAVIGATION (xvimagesink), - e.type == KeyPress ? - "key-press" : "key-release", XKeysymToString (keysym)); - } else { - gst_navigation_send_key_event (GST_NAVIGATION (xvimagesink), - e.type == KeyPress ? "key-press" : "key-release", "unknown"); - } - break; + /* Key pressed/released over our window. We send upstream + events for interactivity/navigation */ + GST_DEBUG ("xvimagesink key %d pressed over window at %d,%d", + e.xkey.keycode, e.xkey.x, e.xkey.y); + keysym = XKeycodeToKeysym (xvimagesink->xcontext->disp, + e.xkey.keycode, 0); + if (keysym != NoSymbol) { + gst_navigation_send_key_event (GST_NAVIGATION (xvimagesink), + e.type == KeyPress ? + "key-press" : "key-release", XKeysymToString (keysym)); + } else { + gst_navigation_send_key_event (GST_NAVIGATION (xvimagesink), + e.type == KeyPress ? "key-press" : "key-release", "unknown"); + } + break; default: - GST_DEBUG ("xvimagesink unhandled X event (%d)", e.type); + GST_DEBUG ("xvimagesink unhandled X event (%d)", e.type); } g_mutex_lock (xvimagesink->x_lock); @@ -582,7 +582,7 @@ gst_xvimagesink_get_xv_support (GstXContext * xcontext) /* Then we get adaptors list */ if (Success != XvQueryAdaptors (xcontext->disp, xcontext->root, - &nb_adaptors, &adaptors)) { + &nb_adaptors, &adaptors)) { GST_DEBUG ("Failed getting XV adaptors list"); return NULL; } @@ -598,15 +598,15 @@ gst_xvimagesink_get_xv_support (GstXContext * xcontext) /* We found such an adaptor, looking for an available port */ for (j = 0; j < adaptors[i].num_ports && !xcontext->xv_port_id; j++) { - /* We try to grab the port */ - if (Success == XvGrabPort (xcontext->disp, adaptors[i].base_id + j, 0)) { - xcontext->xv_port_id = adaptors[i].base_id + j; - } + /* We try to grab the port */ + if (Success == XvGrabPort (xcontext->disp, adaptors[i].base_id + j, 0)) { + xcontext->xv_port_id = adaptors[i].base_id + j; + } } } GST_DEBUG ("XV Adaptor %s with %ld ports", adaptors[i].name, - adaptors[i].num_ports); + adaptors[i].num_ports); } XvFreeAdaptorInfo (adaptors); @@ -618,7 +618,7 @@ gst_xvimagesink_get_xv_support (GstXContext * xcontext) /* We get all image formats supported by our port */ formats = XvListImageFormats (xcontext->disp, - xcontext->xv_port_id, &nb_formats); + xcontext->xv_port_id, &nb_formats); caps = gst_caps_new_empty (); for (i = 0; i < nb_formats; i++) { GstCaps *format_caps = NULL; @@ -630,46 +630,46 @@ gst_xvimagesink_get_xv_support (GstXContext * xcontext) xcontext->im_format = formats[i].id; switch (formats[i].type) { - case XvRGB: - { - format_caps = gst_caps_new_simple ("video/x-raw-rgb", - "endianness", G_TYPE_INT, xcontext->endianness, - "depth", G_TYPE_INT, xcontext->depth, - "bpp", G_TYPE_INT, xcontext->bpp, - "blue_mask", G_TYPE_INT, formats[i].red_mask, - "green_mask", G_TYPE_INT, formats[i].green_mask, - "red_mask", G_TYPE_INT, formats[i].blue_mask, - "width", GST_TYPE_INT_RANGE, 0, G_MAXINT, - "height", GST_TYPE_INT_RANGE, 0, G_MAXINT, - "framerate", GST_TYPE_DOUBLE_RANGE, 1.0, 100.0, NULL); - - /* For RGB caps we store them and the image - format so that we can get back the format - when sinkconnect will give us a caps without - format property */ - if (format_caps) { - GstXvImageFormat *format = NULL; - - format = g_new0 (GstXvImageFormat, 1); - if (format) { - format->format = formats[i].id; - format->caps = gst_caps_copy (format_caps); - xcontext->formats_list = - g_list_append (xcontext->formats_list, format); - } - } - break; - } - case XvYUV: - format_caps = gst_caps_new_simple ("video/x-raw-yuv", - "format", GST_TYPE_FOURCC, formats[i].id, - "width", GST_TYPE_INT_RANGE, 0, G_MAXINT, - "height", GST_TYPE_INT_RANGE, 0, G_MAXINT, - "framerate", GST_TYPE_DOUBLE_RANGE, 1.0, 100.0, NULL); - break; - default: - g_assert_not_reached (); - break; + case XvRGB: + { + format_caps = gst_caps_new_simple ("video/x-raw-rgb", + "endianness", G_TYPE_INT, xcontext->endianness, + "depth", G_TYPE_INT, xcontext->depth, + "bpp", G_TYPE_INT, xcontext->bpp, + "blue_mask", G_TYPE_INT, formats[i].red_mask, + "green_mask", G_TYPE_INT, formats[i].green_mask, + "red_mask", G_TYPE_INT, formats[i].blue_mask, + "width", GST_TYPE_INT_RANGE, 0, G_MAXINT, + "height", GST_TYPE_INT_RANGE, 0, G_MAXINT, + "framerate", GST_TYPE_DOUBLE_RANGE, 1.0, 100.0, NULL); + + /* For RGB caps we store them and the image + format so that we can get back the format + when sinkconnect will give us a caps without + format property */ + if (format_caps) { + GstXvImageFormat *format = NULL; + + format = g_new0 (GstXvImageFormat, 1); + if (format) { + format->format = formats[i].id; + format->caps = gst_caps_copy (format_caps); + xcontext->formats_list = + g_list_append (xcontext->formats_list, format); + } + } + break; + } + case XvYUV: + format_caps = gst_caps_new_simple ("video/x-raw-yuv", + "format", GST_TYPE_FOURCC, formats[i].id, + "width", GST_TYPE_INT_RANGE, 0, G_MAXINT, + "height", GST_TYPE_INT_RANGE, 0, G_MAXINT, + "framerate", GST_TYPE_DOUBLE_RANGE, 1.0, 100.0, NULL); + break; + default: + g_assert_not_reached (); + break; } gst_caps_append (caps, format_caps); @@ -713,7 +713,7 @@ gst_xvimagesink_xcontext_get (GstXvImageSink * xvimagesink) g_mutex_unlock (xvimagesink->x_lock); g_free (xcontext); GST_ELEMENT_ERROR (xvimagesink, RESOURCE, TOO_LAZY, (NULL), - ("Could not open display")); + ("Could not open display")); return NULL; } @@ -791,8 +791,8 @@ gst_xvimagesink_xcontext_get (GstXvImageSink * xvimagesink) if (xv_attr != NULL) { for (j = 0; j < N_attr && matching_attr == NULL; ++j) - if (!g_ascii_strcasecmp (channels[i], xv_attr[j].name)) - matching_attr = xv_attr + j; + if (!g_ascii_strcasecmp (channels[i], xv_attr[j].name)) + matching_attr = xv_attr + j; } if (matching_attr) { @@ -804,27 +804,27 @@ gst_xvimagesink_xcontext_get (GstXvImageSink * xvimagesink) channel->max_value = matching_attr ? matching_attr->max_value : 1000; xcontext->channels_list = g_list_append (xcontext->channels_list, - channel); + channel); /* If the colorbalance settings have not been touched we get Xv values as defaults and update our internal variables */ if (!xvimagesink->cb_changed) { - gint val; - - XvGetPortAttribute (xcontext->disp, xcontext->xv_port_id, - XInternAtom (xcontext->disp, channel->label, 1), &val); - /* Normalize val to [-1000, 1000] */ - val = -1000 + 2000 * (val - channel->min_value) / - (channel->max_value - channel->min_value); - - if (!g_ascii_strcasecmp (channels[i], "XV_HUE")) - xvimagesink->hue = val; - else if (!g_ascii_strcasecmp (channels[i], "XV_SATURATION")) - xvimagesink->saturation = val; - else if (!g_ascii_strcasecmp (channels[i], "XV_BRIGHTNESS")) - xvimagesink->brightness = val; - else if (!g_ascii_strcasecmp (channels[i], "XV_CONTRAST")) - xvimagesink->contrast = val; + gint val; + + XvGetPortAttribute (xcontext->disp, xcontext->xv_port_id, + XInternAtom (xcontext->disp, channel->label, 1), &val); + /* Normalize val to [-1000, 1000] */ + val = -1000 + 2000 * (val - channel->min_value) / + (channel->max_value - channel->min_value); + + if (!g_ascii_strcasecmp (channels[i], "XV_HUE")) + xvimagesink->hue = val; + else if (!g_ascii_strcasecmp (channels[i], "XV_SATURATION")) + xvimagesink->saturation = val; + else if (!g_ascii_strcasecmp (channels[i], "XV_BRIGHTNESS")) + xvimagesink->brightness = val; + else if (!g_ascii_strcasecmp (channels[i], "XV_CONTRAST")) + xvimagesink->contrast = val; } } } @@ -894,7 +894,7 @@ gst_xvimagesink_imagepool_clear (GstXvImageSink * xvimagesink) GstXvImage *xvimage = xvimagesink->image_pool->data; xvimagesink->image_pool = g_slist_delete_link (xvimagesink->image_pool, - xvimagesink->image_pool); + xvimagesink->image_pool); gst_xvimagesink_xvimage_destroy (xvimagesink, xvimage); } @@ -922,7 +922,7 @@ gst_xvimagesink_fixate (GstPad * pad, const GstCaps * caps) return newcaps; } if (gst_caps_structure_fixate_field_nearest_double (structure, "framerate", - 30.0)) { + 30.0)) { return newcaps; } @@ -950,7 +950,7 @@ gst_xvimagesink_get_fourcc_from_caps (GstXvImageSink * xvimagesink, icaps = gst_caps_intersect (caps, format->caps); if (!gst_caps_is_empty (icaps)) - return format->format; + return format->format; } list = g_list_next (list); } @@ -1007,10 +1007,10 @@ gst_xvimagesink_sink_link (GstPad * pad, const GstCaps * caps) xvimagesink->xcontext->im_format = 0; if (!gst_structure_get_fourcc (structure, "format", - &xvimagesink->xcontext->im_format)) { + &xvimagesink->xcontext->im_format)) { xvimagesink->xcontext->im_format = - gst_xvimagesink_get_fourcc_from_caps (xvimagesink, - gst_caps_copy (caps)); + gst_xvimagesink_get_fourcc_from_caps (xvimagesink, + gst_caps_copy (caps)); } if (xvimagesink->xcontext->im_format == 0) { return GST_PAD_LINK_REFUSED; @@ -1025,22 +1025,22 @@ gst_xvimagesink_sink_link (GstPad * pad, const GstCaps * caps) /* Creating our window and our image */ if (!xvimagesink->xwindow) xvimagesink->xwindow = gst_xvimagesink_xwindow_new (xvimagesink, - GST_VIDEOSINK_WIDTH (xvimagesink), GST_VIDEOSINK_HEIGHT (xvimagesink)); + GST_VIDEOSINK_WIDTH (xvimagesink), GST_VIDEOSINK_HEIGHT (xvimagesink)); else { if (xvimagesink->xwindow->internal) gst_xvimagesink_xwindow_resize (xvimagesink, xvimagesink->xwindow, - GST_VIDEOSINK_WIDTH (xvimagesink), - GST_VIDEOSINK_HEIGHT (xvimagesink)); + GST_VIDEOSINK_WIDTH (xvimagesink), + GST_VIDEOSINK_HEIGHT (xvimagesink)); } - if ((xvimagesink->xvimage) && ((GST_VIDEOSINK_WIDTH (xvimagesink) != xvimagesink->xvimage->width) || (GST_VIDEOSINK_HEIGHT (xvimagesink) != xvimagesink->xvimage->height))) { /* We renew our xvimage only if size changed */ + if ((xvimagesink->xvimage) && ((GST_VIDEOSINK_WIDTH (xvimagesink) != xvimagesink->xvimage->width) || (GST_VIDEOSINK_HEIGHT (xvimagesink) != xvimagesink->xvimage->height))) { /* We renew our xvimage only if size changed */ gst_xvimagesink_xvimage_destroy (xvimagesink, xvimagesink->xvimage); xvimagesink->xvimage = gst_xvimagesink_xvimage_new (xvimagesink, - GST_VIDEOSINK_WIDTH (xvimagesink), GST_VIDEOSINK_HEIGHT (xvimagesink)); - } else if (!xvimagesink->xvimage) /* If no xvimage, creating one */ + GST_VIDEOSINK_WIDTH (xvimagesink), GST_VIDEOSINK_HEIGHT (xvimagesink)); + } else if (!xvimagesink->xvimage) /* If no xvimage, creating one */ xvimagesink->xvimage = gst_xvimagesink_xvimage_new (xvimagesink, - GST_VIDEOSINK_WIDTH (xvimagesink), GST_VIDEOSINK_HEIGHT (xvimagesink)); + GST_VIDEOSINK_WIDTH (xvimagesink), GST_VIDEOSINK_HEIGHT (xvimagesink)); gst_x_overlay_got_desired_size (GST_X_OVERLAY (xvimagesink), GST_VIDEOSINK_WIDTH (xvimagesink), GST_VIDEOSINK_HEIGHT (xvimagesink)); @@ -1059,15 +1059,15 @@ gst_xvimagesink_change_state (GstElement * element) case GST_STATE_NULL_TO_READY: /* Initializing the XContext */ if (!xvimagesink->xcontext) - xvimagesink->xcontext = gst_xvimagesink_xcontext_get (xvimagesink); + xvimagesink->xcontext = gst_xvimagesink_xcontext_get (xvimagesink); if (!xvimagesink->xcontext) - return GST_STATE_FAILURE; - else /* If context initialized correctly let's commit our colorbalance */ - gst_xvimagesink_update_colorbalance (xvimagesink); + return GST_STATE_FAILURE; + else /* If context initialized correctly let's commit our colorbalance */ + gst_xvimagesink_update_colorbalance (xvimagesink); break; case GST_STATE_READY_TO_PAUSED: if (xvimagesink->xwindow) - gst_xvimagesink_xwindow_clear (xvimagesink, xvimagesink->xwindow); + gst_xvimagesink_xwindow_clear (xvimagesink, xvimagesink->xwindow); xvimagesink->time = 0; break; case GST_STATE_PAUSED_TO_PLAYING: @@ -1081,21 +1081,21 @@ gst_xvimagesink_change_state (GstElement * element) break; case GST_STATE_READY_TO_NULL: if (xvimagesink->xvimage) { - gst_xvimagesink_xvimage_destroy (xvimagesink, xvimagesink->xvimage); - xvimagesink->xvimage = NULL; + gst_xvimagesink_xvimage_destroy (xvimagesink, xvimagesink->xvimage); + xvimagesink->xvimage = NULL; } if (xvimagesink->image_pool) - gst_xvimagesink_imagepool_clear (xvimagesink); + gst_xvimagesink_imagepool_clear (xvimagesink); if (xvimagesink->xwindow) { - gst_xvimagesink_xwindow_destroy (xvimagesink, xvimagesink->xwindow); - xvimagesink->xwindow = NULL; + gst_xvimagesink_xwindow_destroy (xvimagesink, xvimagesink->xwindow); + xvimagesink->xwindow = NULL; } if (xvimagesink->xcontext) { - gst_xvimagesink_xcontext_clear (xvimagesink); - xvimagesink->xcontext = NULL; + gst_xvimagesink_xcontext_clear (xvimagesink); + xvimagesink->xcontext = NULL; } break; } @@ -1137,18 +1137,18 @@ gst_xvimagesink_chain (GstPad * pad, GstData * data) put the ximage which is in the PRIVATE pointer */ if (GST_BUFFER_FREE_DATA_FUNC (buf) == gst_xvimagesink_buffer_free) { gst_xvimagesink_xvimage_put (xvimagesink, GST_BUFFER_PRIVATE (buf)); - } else { /* Else we have to copy the data into our private image, */ + } else { /* Else we have to copy the data into our private image, */ /* if we have one... */ if (xvimagesink->xvimage) { memcpy (xvimagesink->xvimage->xvimage->data, - GST_BUFFER_DATA (buf), - MIN (GST_BUFFER_SIZE (buf), xvimagesink->xvimage->size)); + GST_BUFFER_DATA (buf), + MIN (GST_BUFFER_SIZE (buf), xvimagesink->xvimage->size)); gst_xvimagesink_xvimage_put (xvimagesink, xvimagesink->xvimage); - } else { /* No image available. Something went wrong during capsnego ! */ + } else { /* No image available. Something went wrong during capsnego ! */ gst_buffer_unref (buf); GST_ELEMENT_ERROR (xvimagesink, CORE, NEGOTIATION, (NULL), - ("no format defined before chain function")); + ("no format defined before chain function")); return; } } @@ -1180,11 +1180,11 @@ gst_xvimagesink_buffer_free (GstBuffer * buffer) if ((xvimage->width != GST_VIDEOSINK_WIDTH (xvimagesink)) || (xvimage->height != GST_VIDEOSINK_HEIGHT (xvimagesink))) gst_xvimagesink_xvimage_destroy (xvimagesink, xvimage); - else { /* In that case we can reuse the image and add it to our image pool. */ + else { /* In that case we can reuse the image and add it to our image pool. */ g_mutex_lock (xvimagesink->pool_lock); xvimagesink->image_pool = g_slist_prepend (xvimagesink->image_pool, - xvimage); + xvimage); g_mutex_unlock (xvimagesink->pool_lock); } } @@ -1209,23 +1209,23 @@ gst_xvimagesink_buffer_alloc (GstPad * pad, guint64 offset, guint size) if (xvimage) { /* Removing from the pool */ xvimagesink->image_pool = g_slist_delete_link (xvimagesink->image_pool, - xvimagesink->image_pool); + xvimagesink->image_pool); - if ((xvimage->width != GST_VIDEOSINK_WIDTH (xvimagesink)) || (xvimage->height != GST_VIDEOSINK_HEIGHT (xvimagesink))) { /* This image is unusable. Destroying... */ - gst_xvimagesink_xvimage_destroy (xvimagesink, xvimage); - xvimage = NULL; - } else { /* We found a suitable image */ + if ((xvimage->width != GST_VIDEOSINK_WIDTH (xvimagesink)) || (xvimage->height != GST_VIDEOSINK_HEIGHT (xvimagesink))) { /* This image is unusable. Destroying... */ + gst_xvimagesink_xvimage_destroy (xvimagesink, xvimage); + xvimage = NULL; + } else { /* We found a suitable image */ - break; + break; } } } g_mutex_unlock (xvimagesink->pool_lock); - if (!xvimage) { /* We found no suitable image in the pool. Creating... */ + if (!xvimage) { /* We found no suitable image in the pool. Creating... */ xvimage = gst_xvimagesink_xvimage_new (xvimagesink, - GST_VIDEOSINK_WIDTH (xvimagesink), GST_VIDEOSINK_HEIGHT (xvimagesink)); + GST_VIDEOSINK_WIDTH (xvimagesink), GST_VIDEOSINK_HEIGHT (xvimagesink)); } if (xvimage) { @@ -1311,7 +1311,7 @@ gst_xvimagesink_set_xwindow_id (GstXOverlay * overlay, XID xwindow_id) if (!xvimagesink->xcontext) { g_warning ("xvimagesink was unable to obtain the X11 context."); return; - } else /* If context initialized correctly let's commit our colorbalance */ + } else /* If context initialized correctly let's commit our colorbalance */ gst_xvimagesink_update_colorbalance (xvimagesink); /* Clear image pool as the images are unusable anyway */ @@ -1335,8 +1335,8 @@ gst_xvimagesink_set_xwindow_id (GstXOverlay * overlay, XID xwindow_id) during caps nego then */ if (GST_VIDEOSINK_WIDTH (xvimagesink) && GST_VIDEOSINK_HEIGHT (xvimagesink)) { xwindow = gst_xvimagesink_xwindow_new (xvimagesink, - GST_VIDEOSINK_WIDTH (xvimagesink), - GST_VIDEOSINK_HEIGHT (xvimagesink)); + GST_VIDEOSINK_WIDTH (xvimagesink), + GST_VIDEOSINK_HEIGHT (xvimagesink)); } } else { xwindow = g_new0 (GstXWindow, 1); @@ -1351,11 +1351,11 @@ gst_xvimagesink_set_xwindow_id (GstXOverlay * overlay, XID xwindow_id) xwindow->height = attr.height; xwindow->internal = FALSE; XSelectInput (xvimagesink->xcontext->disp, xwindow->win, ExposureMask | - StructureNotifyMask | PointerMotionMask | KeyPressMask | - KeyReleaseMask); + StructureNotifyMask | PointerMotionMask | KeyPressMask | + KeyReleaseMask); xwindow->gc = XCreateGC (xvimagesink->xcontext->disp, - xwindow->win, 0, NULL); + xwindow->win, 0, NULL); g_mutex_unlock (xvimagesink->x_lock); } @@ -1363,7 +1363,7 @@ gst_xvimagesink_set_xwindow_id (GstXOverlay * overlay, XID xwindow_id) if (!xvimagesink->xvimage && GST_VIDEOSINK_WIDTH (xvimagesink) && GST_VIDEOSINK_HEIGHT (xvimagesink)) { xvimagesink->xvimage = gst_xvimagesink_xvimage_new (xvimagesink, - GST_VIDEOSINK_WIDTH (xvimagesink), GST_VIDEOSINK_HEIGHT (xvimagesink)); + GST_VIDEOSINK_WIDTH (xvimagesink), GST_VIDEOSINK_HEIGHT (xvimagesink)); } if (xwindow) @@ -1536,7 +1536,7 @@ gst_xvimagesink_set_property (GObject * object, guint prop_id, case ARG_SYNCHRONOUS: xvimagesink->synchronous = g_value_get_boolean (value); if (xvimagesink->xcontext) { - XSynchronize (xvimagesink->xcontext->disp, xvimagesink->synchronous); + XSynchronize (xvimagesink->xcontext->disp, xvimagesink->synchronous); } break; default: @@ -1668,24 +1668,24 @@ gst_xvimagesink_class_init (GstXvImageSinkClass * klass) g_object_class_install_property (gobject_class, ARG_CONTRAST, g_param_spec_int ("contrast", "Contrast", "The contrast of the video", - -1000, 1000, 0, G_PARAM_READWRITE)); + -1000, 1000, 0, G_PARAM_READWRITE)); g_object_class_install_property (gobject_class, ARG_BRIGHTNESS, g_param_spec_int ("brightness", "Brightness", - "The brightness of the video", -1000, 1000, 0, G_PARAM_READWRITE)); + "The brightness of the video", -1000, 1000, 0, G_PARAM_READWRITE)); g_object_class_install_property (gobject_class, ARG_HUE, g_param_spec_int ("hue", "Hue", "The hue of the video", -1000, 1000, 0, - G_PARAM_READWRITE)); + G_PARAM_READWRITE)); g_object_class_install_property (gobject_class, ARG_SATURATION, g_param_spec_int ("saturation", "Saturation", - "The saturation of the video", -1000, 1000, 0, G_PARAM_READWRITE)); + "The saturation of the video", -1000, 1000, 0, G_PARAM_READWRITE)); g_object_class_install_property (gobject_class, ARG_DISPLAY, g_param_spec_string ("display", "Display", "X Display name", NULL, - G_PARAM_READWRITE)); + G_PARAM_READWRITE)); g_object_class_install_property (gobject_class, ARG_SYNCHRONOUS, g_param_spec_boolean ("synchronous", "Synchronous", - "When enabled, runs " - "the X display in synchronous mode. (used only for debugging)", FALSE, - G_PARAM_READWRITE)); + "When enabled, runs " + "the X display in synchronous mode. (used only for debugging)", FALSE, + G_PARAM_READWRITE)); gobject_class->dispose = gst_xvimagesink_dispose; gobject_class->set_property = gst_xvimagesink_set_property; @@ -1745,16 +1745,16 @@ gst_xvimagesink_get_type (void) }; xvimagesink_type = g_type_register_static (GST_TYPE_VIDEOSINK, - "GstXvImageSink", &xvimagesink_info, 0); + "GstXvImageSink", &xvimagesink_info, 0); g_type_add_interface_static (xvimagesink_type, - GST_TYPE_IMPLEMENTS_INTERFACE, &iface_info); + GST_TYPE_IMPLEMENTS_INTERFACE, &iface_info); g_type_add_interface_static (xvimagesink_type, GST_TYPE_NAVIGATION, - &navigation_info); + &navigation_info); g_type_add_interface_static (xvimagesink_type, GST_TYPE_X_OVERLAY, - &overlay_info); + &overlay_info); g_type_add_interface_static (xvimagesink_type, GST_TYPE_COLOR_BALANCE, - &colorbalance_info); + &colorbalance_info); } return xvimagesink_type; @@ -1768,7 +1768,7 @@ plugin_init (GstPlugin * plugin) return FALSE; if (!gst_element_register (plugin, "xvimagesink", - GST_RANK_PRIMARY, GST_TYPE_XVIMAGESINK)) + GST_RANK_PRIMARY, GST_TYPE_XVIMAGESINK)) return FALSE; return TRUE; diff --git a/tests/examples/seek/seek.c b/tests/examples/seek/seek.c index 34a6958dee..e8d6bc0455 100644 --- a/tests/examples/seek/seek.c +++ b/tests/examples/seek/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/tests/examples/seek/spider_seek.c b/tests/examples/seek/spider_seek.c index d2c2c6b217..dc9ddfd676 100644 --- a/tests/examples/seek/spider_seek.c +++ b/tests/examples/seek/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/tests/examples/seek/vorbisfile.c b/tests/examples/seek/vorbisfile.c index ec6844a07a..afb4ecc4e2 100644 --- a/tests/examples/seek/vorbisfile.c +++ b/tests/examples/seek/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/tests/old/examples/capsfilter/capsfilter1.c b/tests/old/examples/capsfilter/capsfilter1.c index 46e127a212..5948d60161 100644 --- a/tests/old/examples/capsfilter/capsfilter1.c +++ b/tests/old/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/tests/old/examples/dynparams/filter.c b/tests/old/examples/dynparams/filter.c index 982a4c7ad1..5178d28bdc 100644 --- a/tests/old/examples/dynparams/filter.c +++ b/tests/old/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/tests/old/examples/gstplay/player.c b/tests/old/examples/gstplay/player.c index 3272778bf6..a23d3a0184 100644 --- a/tests/old/examples/gstplay/player.c +++ b/tests/old/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/tests/old/examples/indexing/indexmpeg.c b/tests/old/examples/indexing/indexmpeg.c index 48a7ca2372..5c1296098d 100644 --- a/tests/old/examples/indexing/indexmpeg.c +++ b/tests/old/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] <type> <filename> \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/tests/old/examples/seek/cdparanoia.c b/tests/old/examples/seek/cdparanoia.c index e750f3468f..c4a58cf86a 100644 --- a/tests/old/examples/seek/cdparanoia.c +++ b/tests/old/examples/seek/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/tests/old/examples/seek/cdplayer.c b/tests/old/examples/seek/cdplayer.c index 1e823cc5b5..d83c78e648 100644 --- a/tests/old/examples/seek/cdplayer.c +++ b/tests/old/examples/seek/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/tests/old/examples/seek/spider_seek.c b/tests/old/examples/seek/spider_seek.c index d2c2c6b217..dc9ddfd676 100644 --- a/tests/old/examples/seek/spider_seek.c +++ b/tests/old/examples/seek/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/tests/old/examples/seek/vorbisfile.c b/tests/old/examples/seek/vorbisfile.c index ec6844a07a..afb4ecc4e2 100644 --- a/tests/old/examples/seek/vorbisfile.c +++ b/tests/old/examples/seek/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/tests/old/examples/stats/mp2ogg.c b/tests/old/examples/stats/mp2ogg.c index 55d79e90c7..3fb437febc 100644 --- a/tests/old/examples/stats/mp2ogg.c +++ b/tests/old/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/tests/old/testsuite/alsa/formats.c b/tests/old/testsuite/alsa/formats.c index 4cc5824c7c..4790da2757 100644 --- a/tests/old/testsuite/alsa/formats.c +++ b/tests/old/testsuite/alsa/formats.c @@ -65,66 +65,66 @@ create_pipeline (void) sinesrc->type = SINE_SRC_INT; sinesrc->sign = ((last % 2) == 0) ? TRUE : FALSE; sinesrc->endianness = - ((last / 2) % 2 == 0) ? G_LITTLE_ENDIAN : G_BIG_ENDIAN; + ((last / 2) % 2 == 0) ? G_LITTLE_ENDIAN : G_BIG_ENDIAN; switch ((last / 4) % 8) { case 0: - sinesrc->depth = 8; - sinesrc->width = 8; - break; + sinesrc->depth = 8; + sinesrc->width = 8; + break; case 1: - sinesrc->depth = 16; - sinesrc->width = 16; - break; + sinesrc->depth = 16; + sinesrc->width = 16; + break; case 2: - sinesrc->depth = 24; - sinesrc->width = 32; - break; + sinesrc->depth = 24; + sinesrc->width = 32; + break; case 3: - sinesrc->depth = 32; - sinesrc->width = 32; - break; - /* nomore tests below until i know what 24bit width means to alsa wrt endianness */ + sinesrc->depth = 32; + sinesrc->width = 32; + break; + /* nomore tests below until i know what 24bit width means to alsa wrt endianness */ case 4: - sinesrc->depth = 24; - sinesrc->width = 24; - break; + sinesrc->depth = 24; + sinesrc->width = 24; + break; case 5: - sinesrc->depth = 20; - sinesrc->width = 24; - break; + sinesrc->depth = 20; + sinesrc->width = 24; + break; case 6: - sinesrc->depth = 18; - sinesrc->width = 24; - break; + sinesrc->depth = 18; + sinesrc->width = 24; + break; case 7: - /* not used yet */ - sinesrc->depth = 8; - sinesrc->width = 8; - break; + /* not used yet */ + sinesrc->depth = 8; + sinesrc->width = 8; + break; default: - g_assert_not_reached (); + g_assert_not_reached (); } g_print ("Setting format to: format: \"int\"\n" - " sign: %s\n" - " endianness: %d\n" - " width: %d\n" - " depth: %d\n", - sinesrc->sign ? "TRUE" : "FALSE", sinesrc->endianness, - sinesrc->width, sinesrc->depth); + " sign: %s\n" + " endianness: %d\n" + " width: %d\n" + " depth: %d\n", + sinesrc->sign ? "TRUE" : "FALSE", sinesrc->endianness, + sinesrc->width, sinesrc->depth); } else if (last < NUMBER_OF_INT_TESTS + NUMBER_OF_FLOAT_TESTS) { gint temp = last - NUMBER_OF_INT_TESTS; sinesrc->type = SINE_SRC_FLOAT; switch (temp) { case 0: - sinesrc->width = 32; - break; + sinesrc->width = 32; + break; case 1: - sinesrc->width = 64; - break; + sinesrc->width = 64; + break; default: - g_assert_not_reached (); + g_assert_not_reached (); } g_print ("Setting format to float width %d\n", sinesrc->width); } else if (last < diff --git a/tests/old/testsuite/alsa/sinesrc.c b/tests/old/testsuite/alsa/sinesrc.c index 473d5a5a86..0eb8cd4576 100644 --- a/tests/old/testsuite/alsa/sinesrc.c +++ b/tests/old/testsuite/alsa/sinesrc.c @@ -20,7 +20,7 @@ #include "sinesrc.h" #include <math.h> -#include <string.h> /* memcpy */ +#include <string.h> /* memcpy */ #define SAMPLES_PER_WAVE 200 @@ -29,16 +29,16 @@ static GstStaticPadTemplate sinesrc_src_factory = GST_PAD_SRC, GST_PAD_ALWAYS, GST_STATIC_CAPS ("audio/x-raw-int, " - "endianness = (int) { LITTLE_ENDIAN, BIG_ENDIAN }, " - "signed = (boolean) { FALSE, TRUE }, " - "width = (int) [8, 32], " - "depth = (int) [8, 32], " - "rate = (int) [8000, 192000], " - "channels = (int) [1, 16];" - "audio/x-raw-float, " - "endianness = (int) BYTE_ORDER, " - "width = (int) {32, 64}, " - "rate = (int) [8000, 192000], " "channels = (int) [1, 16]") + "endianness = (int) { LITTLE_ENDIAN, BIG_ENDIAN }, " + "signed = (boolean) { FALSE, TRUE }, " + "width = (int) [8, 32], " + "depth = (int) [8, 32], " + "rate = (int) [8000, 192000], " + "channels = (int) [1, 16];" + "audio/x-raw-float, " + "endianness = (int) BYTE_ORDER, " + "width = (int) {32, 64}, " + "rate = (int) [8000, 192000], " "channels = (int) [1, 16]") ); static GstElementClass *parent_class = NULL; @@ -62,8 +62,9 @@ sinesrc_get_type (void) sizeof (SineSrc), 0, (GInstanceInitFunc) sinesrc_init, }; + sinesrc_type = g_type_register_static (GST_TYPE_ELEMENT, "SineSrc", - &sinesrc_info, 0); + &sinesrc_info, 0); } return sinesrc_type; } @@ -113,16 +114,16 @@ sinesrc_force_caps (SineSrc * src) switch (src->type) { case SINE_SRC_INT: caps = gst_caps_new_simple ("audio/x-raw-int", - "signed", G_TYPE_BOOLEAN, src->sign, - "depth", G_TYPE_INT, src->depth, NULL); + "signed", G_TYPE_BOOLEAN, src->sign, + "depth", G_TYPE_INT, src->depth, NULL); if (src->width > 8) - gst_caps_set_simple (caps, - "endianness", G_TYPE_INT, src->endianness, NULL); + gst_caps_set_simple (caps, + "endianness", G_TYPE_INT, src->endianness, NULL); break; case SINE_SRC_FLOAT: g_assert (src->width == 32 || src->width == 64); caps = gst_caps_new_simple ("audio/x-raw-float", - "endianness", G_TYPE_INT, src->endianness, NULL); + "endianness", G_TYPE_INT, src->endianness, NULL); break; default: caps = NULL; @@ -187,113 +188,113 @@ sinesrc_get (GstPad * pad) src->pre_get_func (src); g_assert ((buf = - gst_buffer_new_and_alloc ((src->width / 8) * src->channels * - SAMPLES_PER_WAVE))); + gst_buffer_new_and_alloc ((src->width / 8) * src->channels * + SAMPLES_PER_WAVE))); g_assert ((data = GST_BUFFER_DATA (buf))); for (i = 0; i < SAMPLES_PER_WAVE; i++) { value = sin (i * 2 * M_PI / SAMPLES_PER_WAVE); switch (src->type) { case SINE_SRC_INT:{ - gint64 int_value = - (value + (src->sign ? 0 : 1)) * (((guint64) 1) << (src->depth - 1)); - if (int_value == - (1 + (src->sign ? 0 : 1)) * (((guint64) 1) << (src->depth - 1))) - int_value--; - switch (src->width) { - case 8: - if (src->sign) - POPULATE (gint8, IDENTITY, IDENTITY); - else - POPULATE (guint8, UIDENTITY, UIDENTITY); - break; - case 16: - if (src->sign) - POPULATE (gint16, GINT16_TO_BE, GINT16_TO_LE); - else - POPULATE (guint16, GUINT16_TO_BE, GUINT16_TO_LE); - break; - case 24: - if (src->sign) { - gpointer p; - gint32 val = (gint32) int_value; - - switch (src->endianness) { - case G_LITTLE_ENDIAN: - val = GINT32_TO_LE (val); - break; - case G_BIG_ENDIAN: - val = GINT32_TO_BE (val); - break; - default: - g_assert_not_reached (); - }; - p = &val; - if (src->endianness == G_BIG_ENDIAN) - p++; - for (j = 0; j < src->channels; j++) { - memcpy (data, p, 3); - data += 3; - } - } else { - gpointer p; - guint32 val = (guint32) int_value; - - switch (src->endianness) { - case G_LITTLE_ENDIAN: - val = GUINT32_TO_LE (val); - break; - case G_BIG_ENDIAN: - val = GUINT32_TO_BE (val); - break; - default: - g_assert_not_reached (); - }; - p = &val; - if (src->endianness == G_BIG_ENDIAN) - p++; - for (j = 0; j < src->channels; j++) { - memcpy (data, p, 3); - data += 3; - } - } - break; - case 32: - if (src->sign) - POPULATE (gint32, GINT32_TO_BE, GINT32_TO_LE); - else - POPULATE (guint32, GUINT32_TO_BE, GUINT32_TO_LE); - break; - default: - g_assert_not_reached (); - } - break; + gint64 int_value = + (value + (src->sign ? 0 : 1)) * (((guint64) 1) << (src->depth - 1)); + if (int_value == + (1 + (src->sign ? 0 : 1)) * (((guint64) 1) << (src->depth - 1))) + int_value--; + switch (src->width) { + case 8: + if (src->sign) + POPULATE (gint8, IDENTITY, IDENTITY); + else + POPULATE (guint8, UIDENTITY, UIDENTITY); + break; + case 16: + if (src->sign) + POPULATE (gint16, GINT16_TO_BE, GINT16_TO_LE); + else + POPULATE (guint16, GUINT16_TO_BE, GUINT16_TO_LE); + break; + case 24: + if (src->sign) { + gpointer p; + gint32 val = (gint32) int_value; + + switch (src->endianness) { + case G_LITTLE_ENDIAN: + val = GINT32_TO_LE (val); + break; + case G_BIG_ENDIAN: + val = GINT32_TO_BE (val); + break; + default: + g_assert_not_reached (); + }; + p = &val; + if (src->endianness == G_BIG_ENDIAN) + p++; + for (j = 0; j < src->channels; j++) { + memcpy (data, p, 3); + data += 3; + } + } else { + gpointer p; + guint32 val = (guint32) int_value; + + switch (src->endianness) { + case G_LITTLE_ENDIAN: + val = GUINT32_TO_LE (val); + break; + case G_BIG_ENDIAN: + val = GUINT32_TO_BE (val); + break; + default: + g_assert_not_reached (); + }; + p = &val; + if (src->endianness == G_BIG_ENDIAN) + p++; + for (j = 0; j < src->channels; j++) { + memcpy (data, p, 3); + data += 3; + } + } + break; + case 32: + if (src->sign) + POPULATE (gint32, GINT32_TO_BE, GINT32_TO_LE); + else + POPULATE (guint32, GUINT32_TO_BE, GUINT32_TO_LE); + break; + default: + g_assert_not_reached (); + } + break; } case SINE_SRC_FLOAT: - if (src->width == 32) { - gfloat *p = (gfloat *) data; - gfloat fval = (gfloat) value; - - for (j = 0; j < src->channels; j++) { - *p = fval; - p++; - } - data = p; - break; - } - if (src->width == 64) { - gdouble *p = (gdouble *) data; - - for (j = 0; j < src->channels; j++) { - *p = value; - p++; - } - data = p; - break; - } - g_assert_not_reached (); + if (src->width == 32) { + gfloat *p = (gfloat *) data; + gfloat fval = (gfloat) value; + + for (j = 0; j < src->channels; j++) { + *p = fval; + p++; + } + data = p; + break; + } + if (src->width == 64) { + gdouble *p = (gdouble *) data; + + for (j = 0; j < src->channels; j++) { + *p = value; + p++; + } + data = p; + break; + } + g_assert_not_reached (); default: - g_assert_not_reached (); + g_assert_not_reached (); } } diff --git a/tests/old/testsuite/alsa/state.c b/tests/old/testsuite/alsa/state.c index 04e900e18f..3ca69e840d 100644 --- a/tests/old/testsuite/alsa/state.c +++ b/tests/old/testsuite/alsa/state.c @@ -42,8 +42,8 @@ set_state (GstElementState state) g_print (" DONE - iterating a bit..."); for (i = 0; i < 400; i++) { if (!gst_bin_iterate (GST_BIN (pipeline))) { - g_print (" ERROR in iteration %d\n", i); - exit (-2); + g_print (" ERROR in iteration %d\n", i); + exit (-2); } } } diff --git a/testsuite/alsa/formats.c b/testsuite/alsa/formats.c index 4cc5824c7c..4790da2757 100644 --- a/testsuite/alsa/formats.c +++ b/testsuite/alsa/formats.c @@ -65,66 +65,66 @@ create_pipeline (void) sinesrc->type = SINE_SRC_INT; sinesrc->sign = ((last % 2) == 0) ? TRUE : FALSE; sinesrc->endianness = - ((last / 2) % 2 == 0) ? G_LITTLE_ENDIAN : G_BIG_ENDIAN; + ((last / 2) % 2 == 0) ? G_LITTLE_ENDIAN : G_BIG_ENDIAN; switch ((last / 4) % 8) { case 0: - sinesrc->depth = 8; - sinesrc->width = 8; - break; + sinesrc->depth = 8; + sinesrc->width = 8; + break; case 1: - sinesrc->depth = 16; - sinesrc->width = 16; - break; + sinesrc->depth = 16; + sinesrc->width = 16; + break; case 2: - sinesrc->depth = 24; - sinesrc->width = 32; - break; + sinesrc->depth = 24; + sinesrc->width = 32; + break; case 3: - sinesrc->depth = 32; - sinesrc->width = 32; - break; - /* nomore tests below until i know what 24bit width means to alsa wrt endianness */ + sinesrc->depth = 32; + sinesrc->width = 32; + break; + /* nomore tests below until i know what 24bit width means to alsa wrt endianness */ case 4: - sinesrc->depth = 24; - sinesrc->width = 24; - break; + sinesrc->depth = 24; + sinesrc->width = 24; + break; case 5: - sinesrc->depth = 20; - sinesrc->width = 24; - break; + sinesrc->depth = 20; + sinesrc->width = 24; + break; case 6: - sinesrc->depth = 18; - sinesrc->width = 24; - break; + sinesrc->depth = 18; + sinesrc->width = 24; + break; case 7: - /* not used yet */ - sinesrc->depth = 8; - sinesrc->width = 8; - break; + /* not used yet */ + sinesrc->depth = 8; + sinesrc->width = 8; + break; default: - g_assert_not_reached (); + g_assert_not_reached (); } g_print ("Setting format to: format: \"int\"\n" - " sign: %s\n" - " endianness: %d\n" - " width: %d\n" - " depth: %d\n", - sinesrc->sign ? "TRUE" : "FALSE", sinesrc->endianness, - sinesrc->width, sinesrc->depth); + " sign: %s\n" + " endianness: %d\n" + " width: %d\n" + " depth: %d\n", + sinesrc->sign ? "TRUE" : "FALSE", sinesrc->endianness, + sinesrc->width, sinesrc->depth); } else if (last < NUMBER_OF_INT_TESTS + NUMBER_OF_FLOAT_TESTS) { gint temp = last - NUMBER_OF_INT_TESTS; sinesrc->type = SINE_SRC_FLOAT; switch (temp) { case 0: - sinesrc->width = 32; - break; + sinesrc->width = 32; + break; case 1: - sinesrc->width = 64; - break; + sinesrc->width = 64; + break; default: - g_assert_not_reached (); + g_assert_not_reached (); } g_print ("Setting format to float width %d\n", sinesrc->width); } else if (last < diff --git a/testsuite/alsa/sinesrc.c b/testsuite/alsa/sinesrc.c index 473d5a5a86..0eb8cd4576 100644 --- a/testsuite/alsa/sinesrc.c +++ b/testsuite/alsa/sinesrc.c @@ -20,7 +20,7 @@ #include "sinesrc.h" #include <math.h> -#include <string.h> /* memcpy */ +#include <string.h> /* memcpy */ #define SAMPLES_PER_WAVE 200 @@ -29,16 +29,16 @@ static GstStaticPadTemplate sinesrc_src_factory = GST_PAD_SRC, GST_PAD_ALWAYS, GST_STATIC_CAPS ("audio/x-raw-int, " - "endianness = (int) { LITTLE_ENDIAN, BIG_ENDIAN }, " - "signed = (boolean) { FALSE, TRUE }, " - "width = (int) [8, 32], " - "depth = (int) [8, 32], " - "rate = (int) [8000, 192000], " - "channels = (int) [1, 16];" - "audio/x-raw-float, " - "endianness = (int) BYTE_ORDER, " - "width = (int) {32, 64}, " - "rate = (int) [8000, 192000], " "channels = (int) [1, 16]") + "endianness = (int) { LITTLE_ENDIAN, BIG_ENDIAN }, " + "signed = (boolean) { FALSE, TRUE }, " + "width = (int) [8, 32], " + "depth = (int) [8, 32], " + "rate = (int) [8000, 192000], " + "channels = (int) [1, 16];" + "audio/x-raw-float, " + "endianness = (int) BYTE_ORDER, " + "width = (int) {32, 64}, " + "rate = (int) [8000, 192000], " "channels = (int) [1, 16]") ); static GstElementClass *parent_class = NULL; @@ -62,8 +62,9 @@ sinesrc_get_type (void) sizeof (SineSrc), 0, (GInstanceInitFunc) sinesrc_init, }; + sinesrc_type = g_type_register_static (GST_TYPE_ELEMENT, "SineSrc", - &sinesrc_info, 0); + &sinesrc_info, 0); } return sinesrc_type; } @@ -113,16 +114,16 @@ sinesrc_force_caps (SineSrc * src) switch (src->type) { case SINE_SRC_INT: caps = gst_caps_new_simple ("audio/x-raw-int", - "signed", G_TYPE_BOOLEAN, src->sign, - "depth", G_TYPE_INT, src->depth, NULL); + "signed", G_TYPE_BOOLEAN, src->sign, + "depth", G_TYPE_INT, src->depth, NULL); if (src->width > 8) - gst_caps_set_simple (caps, - "endianness", G_TYPE_INT, src->endianness, NULL); + gst_caps_set_simple (caps, + "endianness", G_TYPE_INT, src->endianness, NULL); break; case SINE_SRC_FLOAT: g_assert (src->width == 32 || src->width == 64); caps = gst_caps_new_simple ("audio/x-raw-float", - "endianness", G_TYPE_INT, src->endianness, NULL); + "endianness", G_TYPE_INT, src->endianness, NULL); break; default: caps = NULL; @@ -187,113 +188,113 @@ sinesrc_get (GstPad * pad) src->pre_get_func (src); g_assert ((buf = - gst_buffer_new_and_alloc ((src->width / 8) * src->channels * - SAMPLES_PER_WAVE))); + gst_buffer_new_and_alloc ((src->width / 8) * src->channels * + SAMPLES_PER_WAVE))); g_assert ((data = GST_BUFFER_DATA (buf))); for (i = 0; i < SAMPLES_PER_WAVE; i++) { value = sin (i * 2 * M_PI / SAMPLES_PER_WAVE); switch (src->type) { case SINE_SRC_INT:{ - gint64 int_value = - (value + (src->sign ? 0 : 1)) * (((guint64) 1) << (src->depth - 1)); - if (int_value == - (1 + (src->sign ? 0 : 1)) * (((guint64) 1) << (src->depth - 1))) - int_value--; - switch (src->width) { - case 8: - if (src->sign) - POPULATE (gint8, IDENTITY, IDENTITY); - else - POPULATE (guint8, UIDENTITY, UIDENTITY); - break; - case 16: - if (src->sign) - POPULATE (gint16, GINT16_TO_BE, GINT16_TO_LE); - else - POPULATE (guint16, GUINT16_TO_BE, GUINT16_TO_LE); - break; - case 24: - if (src->sign) { - gpointer p; - gint32 val = (gint32) int_value; - - switch (src->endianness) { - case G_LITTLE_ENDIAN: - val = GINT32_TO_LE (val); - break; - case G_BIG_ENDIAN: - val = GINT32_TO_BE (val); - break; - default: - g_assert_not_reached (); - }; - p = &val; - if (src->endianness == G_BIG_ENDIAN) - p++; - for (j = 0; j < src->channels; j++) { - memcpy (data, p, 3); - data += 3; - } - } else { - gpointer p; - guint32 val = (guint32) int_value; - - switch (src->endianness) { - case G_LITTLE_ENDIAN: - val = GUINT32_TO_LE (val); - break; - case G_BIG_ENDIAN: - val = GUINT32_TO_BE (val); - break; - default: - g_assert_not_reached (); - }; - p = &val; - if (src->endianness == G_BIG_ENDIAN) - p++; - for (j = 0; j < src->channels; j++) { - memcpy (data, p, 3); - data += 3; - } - } - break; - case 32: - if (src->sign) - POPULATE (gint32, GINT32_TO_BE, GINT32_TO_LE); - else - POPULATE (guint32, GUINT32_TO_BE, GUINT32_TO_LE); - break; - default: - g_assert_not_reached (); - } - break; + gint64 int_value = + (value + (src->sign ? 0 : 1)) * (((guint64) 1) << (src->depth - 1)); + if (int_value == + (1 + (src->sign ? 0 : 1)) * (((guint64) 1) << (src->depth - 1))) + int_value--; + switch (src->width) { + case 8: + if (src->sign) + POPULATE (gint8, IDENTITY, IDENTITY); + else + POPULATE (guint8, UIDENTITY, UIDENTITY); + break; + case 16: + if (src->sign) + POPULATE (gint16, GINT16_TO_BE, GINT16_TO_LE); + else + POPULATE (guint16, GUINT16_TO_BE, GUINT16_TO_LE); + break; + case 24: + if (src->sign) { + gpointer p; + gint32 val = (gint32) int_value; + + switch (src->endianness) { + case G_LITTLE_ENDIAN: + val = GINT32_TO_LE (val); + break; + case G_BIG_ENDIAN: + val = GINT32_TO_BE (val); + break; + default: + g_assert_not_reached (); + }; + p = &val; + if (src->endianness == G_BIG_ENDIAN) + p++; + for (j = 0; j < src->channels; j++) { + memcpy (data, p, 3); + data += 3; + } + } else { + gpointer p; + guint32 val = (guint32) int_value; + + switch (src->endianness) { + case G_LITTLE_ENDIAN: + val = GUINT32_TO_LE (val); + break; + case G_BIG_ENDIAN: + val = GUINT32_TO_BE (val); + break; + default: + g_assert_not_reached (); + }; + p = &val; + if (src->endianness == G_BIG_ENDIAN) + p++; + for (j = 0; j < src->channels; j++) { + memcpy (data, p, 3); + data += 3; + } + } + break; + case 32: + if (src->sign) + POPULATE (gint32, GINT32_TO_BE, GINT32_TO_LE); + else + POPULATE (guint32, GUINT32_TO_BE, GUINT32_TO_LE); + break; + default: + g_assert_not_reached (); + } + break; } case SINE_SRC_FLOAT: - if (src->width == 32) { - gfloat *p = (gfloat *) data; - gfloat fval = (gfloat) value; - - for (j = 0; j < src->channels; j++) { - *p = fval; - p++; - } - data = p; - break; - } - if (src->width == 64) { - gdouble *p = (gdouble *) data; - - for (j = 0; j < src->channels; j++) { - *p = value; - p++; - } - data = p; - break; - } - g_assert_not_reached (); + if (src->width == 32) { + gfloat *p = (gfloat *) data; + gfloat fval = (gfloat) value; + + for (j = 0; j < src->channels; j++) { + *p = fval; + p++; + } + data = p; + break; + } + if (src->width == 64) { + gdouble *p = (gdouble *) data; + + for (j = 0; j < src->channels; j++) { + *p = value; + p++; + } + data = p; + break; + } + g_assert_not_reached (); default: - g_assert_not_reached (); + g_assert_not_reached (); } } diff --git a/testsuite/alsa/state.c b/testsuite/alsa/state.c index 04e900e18f..3ca69e840d 100644 --- a/testsuite/alsa/state.c +++ b/testsuite/alsa/state.c @@ -42,8 +42,8 @@ set_state (GstElementState state) g_print (" DONE - iterating a bit..."); for (i = 0; i < 400; i++) { if (!gst_bin_iterate (GST_BIN (pipeline))) { - g_print (" ERROR in iteration %d\n", i); - exit (-2); + g_print (" ERROR in iteration %d\n", i); + exit (-2); } } } |