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:
/* 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");
/* 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;
/* 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;
};
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);
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);
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;
}
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;
}
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;
}
"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);
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);
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",
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) {
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;
GstElement *bin;
GstElement *pipeline;
GstIndex *index;
-} dyn_link;
+}
+dyn_link;
static void
dynamic_link (GstPadTemplate * templ, GstPad * newpad, gpointer data)
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;
}
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);
}
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;
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);
}
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);
/* 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);
{
const gchar *name;
const GstFormat format;
-} seek_format;
+}
+seek_format;
static seek_format seek_formats[] = {
{"tim", GST_FORMAT_TIME},
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++;
}
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++;
}
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 ();
}
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);
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);
}
}
*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
};
const gchar *padname;
GstPad *target;
GstElement *bin;
-} dyn_link;
+}
+dyn_link;
static GstElement *
gst_element_factory_make_or_warn (gchar * type, gchar * name)
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);
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);
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);
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);
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);
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);
{
const gchar *name;
const GstFormat format;
-} seek_format;
+}
+seek_format;
static seek_format seek_formats[] = {
{"tim", GST_FORMAT_TIME},
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++;
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++;
}
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++;
}
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 ();
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);
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);
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);
}
}
{
gchar *name;
GstElement *(*func) (const gchar * location);
-} Pipeline;
+}
+Pipeline;
static Pipeline pipelines[] = {
{"mp3", make_mp3_pipeline},
*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;
{
const gchar *name;
const GstFormat format;
-} seek_format;
+}
+seek_format;
static seek_format seek_formats[] = {
{"tim", GST_FORMAT_TIME},
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++;
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++;
}
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++;
}
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 ();
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);
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);
}
}
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
};
/* 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);
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);
}
}
}
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;
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");
};
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;
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);
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:
* 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;
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);
}
}
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;
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;
}
/* 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;
/* 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;
/* 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;
} 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);
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;
}
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;
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);
}
}
/* 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);
}
}
}
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),
/* 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;
+ }
}
}
}
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;
+ }
}
}
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:
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 *********************************************************/
gst_alsa_xrun_recovery (this);
} else {
GST_WARNING_OBJECT (this, "unknown ALSA avail_update return value (%d)",
- (int) avail);
+ (int) avail);
}
}
return avail;
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;
}
}
}
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) {
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;
}
#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;
}
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); */
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;
}
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)");
}
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),
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");
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;
/* 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;
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:
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;
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
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));
}
(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;
}
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));
}
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;
}
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;
};
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;
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;
}
/* 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);
}
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);
}
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:
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;
}
}
}
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]);
}
}
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]);
}
}
}
};
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;
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;
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;
}
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;
}
};
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;
}
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;
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;
}
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;
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);
/* 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]);
}
/* 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? */
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;
}
}
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;
}
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;
}
};
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;
}
}
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;
/* 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;
}
}
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;
}
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;
+ }
}
}
}
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;
}
}
return;
if (snd_pcm_state (this->handle) != SND_PCM_STATE_RUNNING) {
if (!gst_alsa_start (this))
- return;
+ return;
continue;
};
/* wait */
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;
}
#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"
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)
)
);
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;
}
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;
}
};
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");
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;
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);
* 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:
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 */
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");
/* 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;
}
/* 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;
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;
{
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,}
};
/* 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:
GST_FORMAT_TIME,
GST_FORMAT_BYTES,
GST_FORMAT_DEFAULT,
- 0, /* filled later */
- 0, /* filled later */
+ 0, /* filled later */
+ 0, /* filled later */
0
};
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:
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;
}
GST_QUERY_SEGMENT_END,
0
};
+
return src_query_types;
}
/* 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;
plugin_init (GstPlugin * plugin)
{
if (!gst_element_register (plugin, "cdparanoia", GST_RANK_NONE,
- GST_TYPE_CDPARANOIA))
+ GST_TYPE_CDPARANOIA))
return FALSE;
return TRUE;
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
GST_GNOMEVFSSINK_OPEN = GST_ELEMENT_FLAG_LAST,
GST_GNOMEVFSSINK_FLAG_LAST = GST_ELEMENT_FLAG_LAST + 2,
-} GstGnomeVFSSinkFlags;
+}
+GstGnomeVFSSinkFlags;
struct _GstGnomeVFSSink
{
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;
}
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,
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;
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
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);
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);
} 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;
}
}
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;
/* 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 */
GST_FORMAT_BYTES,
0,
};
+
return formats;
}
GST_QUERY_POSITION,
0,
};
+
return types;
}
{
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;
}
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;
}
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;
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:
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;
}
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;
}
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;
}
}
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) {
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);
}
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;
}
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");
}
}
}
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);
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);
}
}
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) {
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);
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;
}
}
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;
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:
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:
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;
}
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");
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
{
/* 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{ \
GST_OGG_FLAG_BOS = GST_ELEMENT_FLAG_LAST,
GST_OGG_FLAG_EOS,
GST_OGG_FLAG_WAIT_FOR_DISCONT
-} GstOggFlag;
+}
+GstOggFlag;
struct _GstOggDemux
{
{GST_EVENT_SEEK, GST_SEEK_METHOD_SET | GST_SEEK_FLAG_FLUSH},
{0,}
};
+
return gst_ogg_demux_src_event_masks;
}
static const GstQueryType *
GST_QUERY_POSITION,
0
};
+
return gst_ogg_demux_src_query_types;
}
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:
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);
{
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);
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;
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) ?
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:
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;
}
}
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);
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:
}
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 */
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;
}
}
}
ogg_packet *packet;
guint best_probability;
GstCaps *caps;
-} OggTypeFind;
+}
+OggTypeFind;
static guint8 *
ogg_find_peek (gpointer data, gint64 offset, guint size)
{
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;
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 =
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 =
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;
}
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));
}
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;
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++;
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++;
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) {
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;
}
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;
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;
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:
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;
}
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); */
0,
gst_timeoverlay_init,
};
+
timeoverlay_type = g_type_register_static (GST_TYPE_VIDEOFILTER,
- "GstTimeoverlay", &timeoverlay_info, 0);
+ "GstTimeoverlay", &timeoverlay_info, 0);
}
return timeoverlay_type;
}
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));
#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;
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);
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;
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 =
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;
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;
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))
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;
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:
/* 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;
/* 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);
}
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));
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;
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,
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 =
GST_FORMAT_TIME,
0
};
+
return (GST_PAD_IS_SRC (pad) ? src_formats : sink_formats);
}
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))
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;
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;
{
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)) {
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;
/* 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;
}
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;
};
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;
}
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);
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:
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:
GST_QUERY_POSITION,
0
};
+
return gst_vorbisenc_src_query_types;
}
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:
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));
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);
}
}
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;
}
}
} 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;
}
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;
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;
}
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;
}
/* 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;
}
}
/* 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;
+ }
}
}
}
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:
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);
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;
}
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);
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);
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);
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);
{
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
(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;
}
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? */
}
}
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;
}
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) {
(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);
}
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
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;
}
#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;
};
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;
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;
}
};
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;
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;
#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 */
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);
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;
}
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");
}
/* 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 */
/* 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);
/* 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;
}
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));
}
}
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;
}
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);
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;
/* 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 */
/* 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);
/* 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 */
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) {
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;
}
}
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;
}
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;
}
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;
}
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;
}
*/
#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
#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)
* (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)
* 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
/*
*/
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);
dataptr[6] = dcval;
dataptr[7] = dcval;
- dataptr += DCTSIZE; /* advance pointer to next row */
+ dataptr += DCTSIZE; /* advance pointer to next row */
continue;
}
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;
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. */
#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);
dataptr[DCTSIZE * 6] = dcval;
dataptr[DCTSIZE * 7] = dcval;
- dataptr++; /* advance pointer to next column */
+ dataptr++; /* advance pointer to next column */
continue;
}
#endif
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;
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;
/* 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 */
}
}
#endif
#include <mmx.h>\r
\r
-#define BITS_INV_ACC 4 /*; 4 or 5 for IEEE\r */
+#define BITS_INV_ACC 4 /*; 4 or 5 for IEEE\r */
/* 5 yields higher accuracy, but lessens dynamic range on the input matrix\r */
#define SHIFT_INV_ROW (16 - BITS_INV_ACC)\r
-#define SHIFT_INV_COL (1 + BITS_INV_ACC +14 ) /* changed from Intel's val)\r */
+#define SHIFT_INV_COL (1 + BITS_INV_ACC +14 ) /* changed from Intel's val)\r */
/*#define SHIFT_INV_COL (1 + BITS_INV_ACC )\r */
\r
#define RND_INV_ROW (1 << (SHIFT_INV_ROW-1))\r
#define RND_INV_COL (1 << (SHIFT_INV_COL-1)) \r
-#define RND_INV_CORR (RND_INV_COL - 1) /*; correction -1.0 and round\r */
+#define RND_INV_CORR (RND_INV_COL - 1) /*; correction -1.0 and round\r */
/*#define RND_INV_ROW (1024 * (6 - BITS_INV_ACC)) //; 1 << (SHIFT_INV_ROW-1)\r */
/*#define RND_INV_COL (16 * (BITS_INV_ACC - 3)) //; 1 << (SHIFT_INV_COL-1)\r */
\r\r
/*const static short ocos_4_16[4] = {23170, 23170, 23170, 23170 }; //cos * (2<<15) + 0.5\r */
\r
/*concatenated table, for forward DCT transformation\r */
-const static short tg_all_16[] = { \r13036, 13036, 13036, 13036, /* tg * (2<<16) + 0.5\r */
- 27146, 27146, 27146, 27146, /*tg * (2<<16) + 0.5\r */
- -21746, -21746, -21746, -21746, /* tg * (2<<16) + 0.5\r */
- -19195, -19195, -19195, -19195, /*cos * (2<<16) + 0.5\r */
+const static short tg_all_16[] = { \r13036, 13036, 13036, 13036, /* tg * (2<<16) + 0.5\r */
+ 27146, 27146, 27146, 27146, /*tg * (2<<16) + 0.5\r */
+ -21746, -21746, -21746, -21746, /* tg * (2<<16) + 0.5\r */
+ -19195, -19195, -19195, -19195, /*cos * (2<<16) + 0.5\r */
23170, 23170, 23170, 23170
-}; /*cos * (2<<15) + 0.5\r */
+}; /*cos * (2<<15) + 0.5\r */
\r
#define tg_1_16 (tg_all_16 + 0)\r
;=============================================================================\r
\r
/*; Table for rows 0,4 - constants are multiplied by cos_4_16\r */
-const short tab_i_04[] = { \r16384, 16384, 16384, -16384, /* ; movq-> w06 w04 w02 w00\r */
- 21407, 8867, 8867, -21407, /* w07 w05 w03 w01\r */
- 16384, -16384, 16384, 16384, /*; w14 w12 w10 w08\r */
- -8867, 21407, -21407, -8867, /*; w15 w13 w11 w09\r */
- 22725, 12873, 19266, -22725, /*; w22 w20 w18 w16\r */
- 19266, 4520, -4520, -12873, /*; w23 w21 w19 w17\r */
- 12873, 4520, 4520, 19266, /*; w30 w28 w26 w24\r */
+const short tab_i_04[] = { \r16384, 16384, 16384, -16384, /* ; movq-> w06 w04 w02 w00\r */
+ 21407, 8867, 8867, -21407, /* w07 w05 w03 w01\r */
+ 16384, -16384, 16384, 16384, /*; w14 w12 w10 w08\r */
+ -8867, 21407, -21407, -8867, /*; w15 w13 w11 w09\r */
+ 22725, 12873, 19266, -22725, /*; w22 w20 w18 w16\r */
+ 19266, 4520, -4520, -12873, /*; w23 w21 w19 w17\r */
+ 12873, 4520, 4520, 19266, /*; w30 w28 w26 w24\r */
-22725, 19266, -12873, -22725
-}; /*w31 w29 w27 w25\r */
+}; /*w31 w29 w27 w25\r */
\r
/*; Table for rows 1,7 - constants are multiplied by cos_1_16\r */
-const short tab_i_17[] = { \r22725, 22725, 22725, -22725, /* ; movq-> w06 w04 w02 w00\r */
- 29692, 12299, 12299, -29692, /* ; w07 w05 w03 w01\r */
- 22725, -22725, 22725, 22725, /*; w14 w12 w10 w08\r */
- -12299, 29692, -29692, -12299, /*; w15 w13 w11 w09\r */
- 31521, 17855, 26722, -31521, /*; w22 w20 w18 w16\r */
- 26722, 6270, -6270, -17855, /*; w23 w21 w19 w17\r */
- 17855, 6270, 6270, 26722, /*; w30 w28 w26 w24\r */
+const short tab_i_17[] = { \r22725, 22725, 22725, -22725, /* ; movq-> w06 w04 w02 w00\r */
+ 29692, 12299, 12299, -29692, /* ; w07 w05 w03 w01\r */
+ 22725, -22725, 22725, 22725, /*; w14 w12 w10 w08\r */
+ -12299, 29692, -29692, -12299, /*; w15 w13 w11 w09\r */
+ 31521, 17855, 26722, -31521, /*; w22 w20 w18 w16\r */
+ 26722, 6270, -6270, -17855, /*; w23 w21 w19 w17\r */
+ 17855, 6270, 6270, 26722, /*; w30 w28 w26 w24\r */
-31521, 26722, -17855, -31521
-}; /* w31 w29 w27 w25\r */
+}; /* w31 w29 w27 w25\r */
\r
/*; Table for rows 2,6 - constants are multiplied by cos_2_16\r */
-const short tab_i_26[] = { \r21407, 21407, 21407, -21407, /* ; movq-> w06 w04 w02 w00\r */
- 27969, 11585, 11585, -27969, /* ; w07 w05 w03 w01\r */
- 21407, -21407, 21407, 21407, /* ; w14 w12 w10 w08\r */
- -11585, 27969, -27969, -11585, /* ;w15 w13 w11 w09\r */
- 29692, 16819, 25172, -29692, /* ;w22 w20 w18 w16\r */
- 25172, 5906, -5906, -16819, /* ;w23 w21 w19 w17\r */
- 16819, 5906, 5906, 25172, /* ;w30 w28 w26 w24\r */
+const short tab_i_26[] = { \r21407, 21407, 21407, -21407, /* ; movq-> w06 w04 w02 w00\r */
+ 27969, 11585, 11585, -27969, /* ; w07 w05 w03 w01\r */
+ 21407, -21407, 21407, 21407, /* ; w14 w12 w10 w08\r */
+ -11585, 27969, -27969, -11585, /* ;w15 w13 w11 w09\r */
+ 29692, 16819, 25172, -29692, /* ;w22 w20 w18 w16\r */
+ 25172, 5906, -5906, -16819, /* ;w23 w21 w19 w17\r */
+ 16819, 5906, 5906, 25172, /* ;w30 w28 w26 w24\r */
-29692, 25172, -16819, -29692
-}; /* ;w31 w29 w27 w25\r */
+}; /* ;w31 w29 w27 w25\r */
\r\r
/*; Table for rows 3,5 - constants are multiplied by cos_3_16\r */
-const short tab_i_35[] = { \r19266, 19266, 19266, -19266, /*; movq-> w06 w04 w02 w00\r */
- 25172, 10426, 10426, -25172, /*; w07 w05 w03 w01\r */
- 19266, -19266, 19266, 19266, /*; w14 w12 w10 w08\r */
- -10426, 25172, -25172, -10426, /*; w15 w13 w11 w09\r */
- 26722, 15137, 22654, -26722, /*; w22 w20 w18 w16\r */
- 22654, 5315, -5315, -15137, /*; w23 w21 w19 w17\r */
- 15137, 5315, 5315, 22654, /*; w30 w28 w26 w24\r */
+const short tab_i_35[] = { \r19266, 19266, 19266, -19266, /*; movq-> w06 w04 w02 w00\r */
+ 25172, 10426, 10426, -25172, /*; w07 w05 w03 w01\r */
+ 19266, -19266, 19266, 19266, /*; w14 w12 w10 w08\r */
+ -10426, 25172, -25172, -10426, /*; w15 w13 w11 w09\r */
+ 26722, 15137, 22654, -26722, /*; w22 w20 w18 w16\r */
+ 22654, 5315, -5315, -15137, /*; w23 w21 w19 w17\r */
+ 15137, 5315, 5315, 22654, /*; w30 w28 w26 w24\r */
-26722, 22654, -15137, -26722
-}; /*; w31 w29 w27 w25\r */
+}; /*; w31 w29 w27 w25\r */
*/\r\r
/* CONCATENATED TABLE, rows 0,1,2,3,4,5,6,7 (in order )\r */
/*\r */
static const short tab_i_01234567[] = { \r
/*row0, this row is required\r */
- 16384, 16384, 16384, -16384, /* ; movq-> w06 w04 w02 w00\r */
- 21407, 8867, 8867, -21407, /* w07 w05 w03 w01\r */
- 16384, -16384, 16384, 16384, /*; w14 w12 w10 w08\r */
- -8867, 21407, -21407, -8867, /*; w15 w13 w11 w09\r */
- 22725, 12873, 19266, -22725, /*; w22 w20 w18 w16\r */
- 19266, 4520, -4520, -12873, /*; w23 w21 w19 w17\r */
- 12873, 4520, 4520, 19266, /*; w30 w28 w26 w24\r */
- -22725, 19266, -12873, -22725, /*w31 w29 w27 w25\r */
+ 16384, 16384, 16384, -16384, /* ; movq-> w06 w04 w02 w00\r */
+ 21407, 8867, 8867, -21407, /* w07 w05 w03 w01\r */
+ 16384, -16384, 16384, 16384, /*; w14 w12 w10 w08\r */
+ -8867, 21407, -21407, -8867, /*; w15 w13 w11 w09\r */
+ 22725, 12873, 19266, -22725, /*; w22 w20 w18 w16\r */
+ 19266, 4520, -4520, -12873, /*; w23 w21 w19 w17\r */
+ 12873, 4520, 4520, 19266, /*; w30 w28 w26 w24\r */
+ -22725, 19266, -12873, -22725, /*w31 w29 w27 w25\r */
\r
/* the rest of these rows (1-7), aren't used !\r */
\r
/*row1\r */
- 22725, 22725, 22725, -22725, /* ; movq-> w06 w04 w02 w00\r */
- 29692, 12299, 12299, -29692, /* ; w07 w05 w03 w01\r */
- 22725, -22725, 22725, 22725, /*; w14 w12 w10 w08\r */
- -12299, 29692, -29692, -12299, /*; w15 w13 w11 w09\r */
- 31521, 17855, 26722, -31521, /*; w22 w20 w18 w16\r */
- 26722, 6270, -6270, -17855, /*; w23 w21 w19 w17\r */
- 17855, 6270, 6270, 26722, /*; w30 w28 w26 w24\r */
- -31521, 26722, -17855, -31521, /* w31 w29 w27 w25\r */
+ 22725, 22725, 22725, -22725, /* ; movq-> w06 w04 w02 w00\r */
+ 29692, 12299, 12299, -29692, /* ; w07 w05 w03 w01\r */
+ 22725, -22725, 22725, 22725, /*; w14 w12 w10 w08\r */
+ -12299, 29692, -29692, -12299, /*; w15 w13 w11 w09\r */
+ 31521, 17855, 26722, -31521, /*; w22 w20 w18 w16\r */
+ 26722, 6270, -6270, -17855, /*; w23 w21 w19 w17\r */
+ 17855, 6270, 6270, 26722, /*; w30 w28 w26 w24\r */
+ -31521, 26722, -17855, -31521, /* w31 w29 w27 w25\r */
\r
/*row2\r */
- 21407, 21407, 21407, -21407, /* ; movq-> w06 w04 w02 w00\r */
- 27969, 11585, 11585, -27969, /* ; w07 w05 w03 w01\r */
- 21407, -21407, 21407, 21407, /* ; w14 w12 w10 w08\r */
- -11585, 27969, -27969, -11585, /* ;w15 w13 w11 w09\r */
- 29692, 16819, 25172, -29692, /* ;w22 w20 w18 w16\r */
- 25172, 5906, -5906, -16819, /* ;w23 w21 w19 w17\r */
- 16819, 5906, 5906, 25172, /* ;w30 w28 w26 w24\r */
- -29692, 25172, -16819, -29692, /* ;w31 w29 w27 w25\r */
+ 21407, 21407, 21407, -21407, /* ; movq-> w06 w04 w02 w00\r */
+ 27969, 11585, 11585, -27969, /* ; w07 w05 w03 w01\r */
+ 21407, -21407, 21407, 21407, /* ; w14 w12 w10 w08\r */
+ -11585, 27969, -27969, -11585, /* ;w15 w13 w11 w09\r */
+ 29692, 16819, 25172, -29692, /* ;w22 w20 w18 w16\r */
+ 25172, 5906, -5906, -16819, /* ;w23 w21 w19 w17\r */
+ 16819, 5906, 5906, 25172, /* ;w30 w28 w26 w24\r */
+ -29692, 25172, -16819, -29692, /* ;w31 w29 w27 w25\r */
\r
/*row3\r */
- 19266, 19266, 19266, -19266, /*; movq-> w06 w04 w02 w00\r */
- 25172, 10426, 10426, -25172, /*; w07 w05 w03 w01\r */
- 19266, -19266, 19266, 19266, /*; w14 w12 w10 w08\r */
- -10426, 25172, -25172, -10426, /*; w15 w13 w11 w09\r */
- 26722, 15137, 22654, -26722, /*; w22 w20 w18 w16\r */
- 22654, 5315, -5315, -15137, /*; w23 w21 w19 w17\r */
- 15137, 5315, 5315, 22654, /*; w30 w28 w26 w24\r */
- -26722, 22654, -15137, -26722, /*; w31 w29 w27 w25\r */
+ 19266, 19266, 19266, -19266, /*; movq-> w06 w04 w02 w00\r */
+ 25172, 10426, 10426, -25172, /*; w07 w05 w03 w01\r */
+ 19266, -19266, 19266, 19266, /*; w14 w12 w10 w08\r */
+ -10426, 25172, -25172, -10426, /*; w15 w13 w11 w09\r */
+ 26722, 15137, 22654, -26722, /*; w22 w20 w18 w16\r */
+ 22654, 5315, -5315, -15137, /*; w23 w21 w19 w17\r */
+ 15137, 5315, 5315, 22654, /*; w30 w28 w26 w24\r */
+ -26722, 22654, -15137, -26722, /*; w31 w29 w27 w25\r */
\r
/*row4\r */
- 16384, 16384, 16384, -16384, /* ; movq-> w06 w04 w02 w00\r */
- 21407, 8867, 8867, -21407, /* w07 w05 w03 w01\r */
- 16384, -16384, 16384, 16384, /*; w14 w12 w10 w08\r */
- -8867, 21407, -21407, -8867, /*; w15 w13 w11 w09\r */
- 22725, 12873, 19266, -22725, /*; w22 w20 w18 w16\r */
- 19266, 4520, -4520, -12873, /*; w23 w21 w19 w17\r */
- 12873, 4520, 4520, 19266, /*; w30 w28 w26 w24\r */
- -22725, 19266, -12873, -22725, /*w31 w29 w27 w25\r */
+ 16384, 16384, 16384, -16384, /* ; movq-> w06 w04 w02 w00\r */
+ 21407, 8867, 8867, -21407, /* w07 w05 w03 w01\r */
+ 16384, -16384, 16384, 16384, /*; w14 w12 w10 w08\r */
+ -8867, 21407, -21407, -8867, /*; w15 w13 w11 w09\r */
+ 22725, 12873, 19266, -22725, /*; w22 w20 w18 w16\r */
+ 19266, 4520, -4520, -12873, /*; w23 w21 w19 w17\r */
+ 12873, 4520, 4520, 19266, /*; w30 w28 w26 w24\r */
+ -22725, 19266, -12873, -22725, /*w31 w29 w27 w25\r */
\r
/*row5\r */
- 19266, 19266, 19266, -19266, /*; movq-> w06 w04 w02 w00\r */
- 25172, 10426, 10426, -25172, /*; w07 w05 w03 w01\r */
- 19266, -19266, 19266, 19266, /*; w14 w12 w10 w08\r */
- -10426, 25172, -25172, -10426, /*; w15 w13 w11 w09\r */
- 26722, 15137, 22654, -26722, /*; w22 w20 w18 w16\r */
- 22654, 5315, -5315, -15137, /*; w23 w21 w19 w17\r */
- 15137, 5315, 5315, 22654, /*; w30 w28 w26 w24\r */
- -26722, 22654, -15137, -26722, /*; w31 w29 w27 w25\r */
+ 19266, 19266, 19266, -19266, /*; movq-> w06 w04 w02 w00\r */
+ 25172, 10426, 10426, -25172, /*; w07 w05 w03 w01\r */
+ 19266, -19266, 19266, 19266, /*; w14 w12 w10 w08\r */
+ -10426, 25172, -25172, -10426, /*; w15 w13 w11 w09\r */
+ 26722, 15137, 22654, -26722, /*; w22 w20 w18 w16\r */
+ 22654, 5315, -5315, -15137, /*; w23 w21 w19 w17\r */
+ 15137, 5315, 5315, 22654, /*; w30 w28 w26 w24\r */
+ -26722, 22654, -15137, -26722, /*; w31 w29 w27 w25\r */
\r
/*row6\r */
- 21407, 21407, 21407, -21407, /* ; movq-> w06 w04 w02 w00\r */
- 27969, 11585, 11585, -27969, /* ; w07 w05 w03 w01\r */
- 21407, -21407, 21407, 21407, /* ; w14 w12 w10 w08\r */
- -11585, 27969, -27969, -11585, /* ;w15 w13 w11 w09\r */
- 29692, 16819, 25172, -29692, /* ;w22 w20 w18 w16\r */
- 25172, 5906, -5906, -16819, /* ;w23 w21 w19 w17\r */
- 16819, 5906, 5906, 25172, /* ;w30 w28 w26 w24\r */
- -29692, 25172, -16819, -29692, /* ;w31 w29 w27 w25\r */
+ 21407, 21407, 21407, -21407, /* ; movq-> w06 w04 w02 w00\r */
+ 27969, 11585, 11585, -27969, /* ; w07 w05 w03 w01\r */
+ 21407, -21407, 21407, 21407, /* ; w14 w12 w10 w08\r */
+ -11585, 27969, -27969, -11585, /* ;w15 w13 w11 w09\r */
+ 29692, 16819, 25172, -29692, /* ;w22 w20 w18 w16\r */
+ 25172, 5906, -5906, -16819, /* ;w23 w21 w19 w17\r */
+ 16819, 5906, 5906, 25172, /* ;w30 w28 w26 w24\r */
+ -29692, 25172, -16819, -29692, /* ;w31 w29 w27 w25\r */
\r
/*row7\r */
- 22725, 22725, 22725, -22725, /* ; movq-> w06 w04 w02 w00\r */
- 29692, 12299, 12299, -29692, /* ; w07 w05 w03 w01\r */
- 22725, -22725, 22725, 22725, /*; w14 w12 w10 w08\r */
- -12299, 29692, -29692, -12299, /*; w15 w13 w11 w09\r */
- 31521, 17855, 26722, -31521, /*; w22 w20 w18 w16\r */
- 26722, 6270, -6270, -17855, /*; w23 w21 w19 w17\r */
- 17855, 6270, 6270, 26722, /*; w30 w28 w26 w24\r */
+ 22725, 22725, 22725, -22725, /* ; movq-> w06 w04 w02 w00\r */
+ 29692, 12299, 12299, -29692, /* ; w07 w05 w03 w01\r */
+ 22725, -22725, 22725, 22725, /*; w14 w12 w10 w08\r */
+ -12299, 29692, -29692, -12299, /*; w15 w13 w11 w09\r */
+ 31521, 17855, 26722, -31521, /*; w22 w20 w18 w16\r */
+ 26722, 6270, -6270, -17855, /*; w23 w21 w19 w17\r */
+ 17855, 6270, 6270, 26722, /*; w30 w28 w26 w24\r */
-31521, 26722, -17855, -31521
-}; /* w31 w29 w27 w25\r */
+}; /* w31 w29 w27 w25\r */
\r\r
-#define INP eax /* pointer to (short *blk)\r */
-#define OUT ecx /* pointer to output (temporary store space qwTemp[])\r */
-#define TABLE ebx /* pointer to tab_i_01234567[]\r */
+#define INP eax /* pointer to (short *blk)\r */
+#define OUT ecx /* pointer to output (temporary store space qwTemp[])\r */
+#define TABLE ebx /* pointer to tab_i_01234567[]\r */
#define round_inv_row edx\r
#define round_inv_col edx\r
\r
-#define ROW_STRIDE 8 /* for 8x8 matrix transposer\r */
+#define ROW_STRIDE 8 /* for 8x8 matrix transposer\r */
\r
/* private variables and functions\r */
\r
/*temporary storage space, 8x8 of shorts\r */
-\r__inline static void idct_mmx32_rows (short *blk); /* transform rows\r */
-__inline static void idct_mmx32_cols (short *blk); /* transform "columns"\r */
+\r__inline static void idct_mmx32_rows (short *blk); /* transform rows\r */
+__inline static void idct_mmx32_cols (short *blk); /* transform "columns"\r */
- /* the "column" transform actually transforms rows, it is\r */
- /* identical to the row-transform except for the ROUNDING\r */
- /* and SHIFTING coefficients.\r */
+ /* the "column" transform actually transforms rows, it is\r */
+ /* identical to the row-transform except for the ROUNDING\r */
+ /* and SHIFTING coefficients.\r */
\r\rstatic void \r
idct_mmx32_rows (short *blk)
-{ /* transform all 8 rows of 8x8 iDCT block\r */
+{ /* transform all 8 rows of 8x8 iDCT block\r */
\rint x;
\rshort qwTemp[64];
\rshort *out = &qwTemp[0];
/*\r */
/* 2) transpose the matrix (which was stored in qwTemp[])\r */
/* qwTemp[] -> [8x8 matrix transpose] -> blk[]\r */
- \rfor (x = 0; x < 8; x++) { /* transform one row per iteration\r */
- movq_m2r (*(inptr), mm0); /* 0 ; x3 x2 x1 x0\r */
- \rmovq_m2r (*(inptr + 4), mm1); /* 1 ; x7 x6 x5 x4\r */
- movq_r2r (mm0, mm2); /* 2 ; x3 x2 x1 x0\r */
- \rmovq_m2r (*(tab_i_01234567), mm3); /* 3 ; w06 w04 w02 w00\r */
- punpcklwd_r2r (mm1, mm0); /* x5 x1 x4 x0\r */
+ \rfor (x = 0; x < 8; x++) { /* transform one row per iteration\r */
+ movq_m2r (*(inptr), mm0); /* 0 ; x3 x2 x1 x0\r */
+ \rmovq_m2r (*(inptr + 4), mm1); /* 1 ; x7 x6 x5 x4\r */
+ movq_r2r (mm0, mm2); /* 2 ; x3 x2 x1 x0\r */
+ \rmovq_m2r (*(tab_i_01234567), mm3); /* 3 ; w06 w04 w02 w00\r */
+ punpcklwd_r2r (mm1, mm0); /* x5 x1 x4 x0\r */
\r
- /* ----------\r */
- movq_r2r (mm0, mm5); /* 5 ; x5 x1 x4 x0\r */
- punpckldq_r2r (mm0, mm0); /* x4 x0 x4 x0\r */
- \rmovq_m2r (*(tab_i_01234567 + 4), mm4); /* 4 ; w07 w05 w03 w01\r */
- punpckhwd_r2r (mm1, mm2); /* 1 ; x7 x3 x6 x2\r */
- \rpmaddwd_r2r (mm0, mm3); /* x4*w06+x0*w04 x4*w02+x0*w00\r */
- movq_r2r (mm2, mm6); /* 6 ; x7 x3 x6 x2\r */
- \rmovq_m2r (*(tab_i_01234567 + 16), mm1); /* 1 ; w22 w20 w18 w16\r */
- punpckldq_r2r (mm2, mm2); /* x6 x2 x6 x2\r */
- \rpmaddwd_r2r (mm2, mm4); /* x6*w07+x2*w05 x6*w03+x2*w01\r */
- punpckhdq_r2r (mm5, mm5); /* x5 x1 x5 x1\r */
- \rpmaddwd_m2r (*(tab_i_01234567 + 8), mm0); /* x4*w14+x0*w12 x4*w10+x0*w08\r */
- punpckhdq_r2r (mm6, mm6); /* x7 x3 x7 x3\r */
- \rmovq_m2r (*(tab_i_01234567 + 20), mm7); /* 7 ; w23 w21 w19 w17\r */
- pmaddwd_r2r (mm5, mm1); /* x5*w22+x1*w20 x5*w18+x1*w16\r */
- \rpaddd_m2r (*(r_inv_row), mm3); /* +rounder\r */
- pmaddwd_r2r (mm6, mm7); /* x7*w23+x3*w21 x7*w19+x3*w17\r */
- \rpmaddwd_m2r (*(tab_i_01234567 + 12), mm2); /* x6*w15+x2*w13 x6*w11+x2*w09\r */
- paddd_r2r (mm4, mm3); /* 4 ; a1=sum(even1) a0=sum(even0)\r */
- \rpmaddwd_m2r (*(tab_i_01234567 + 24), mm5); /* x5*w30+x1*w28 x5*w26+x1*w24\r */
- movq_r2r (mm3, mm4); /* 4 ; a1 a0\r */
- \rpmaddwd_m2r (*(tab_i_01234567 + 28), mm6); /* x7*w31+x3*w29 x7*w27+x3*w25\r */
- paddd_r2r (mm7, mm1); /* 7 ; b1=sum(odd1) b0=sum(odd0)\r */
- \rpaddd_m2r (*(r_inv_row), mm0); /* +rounder\r */
- psubd_r2r (mm1, mm3); /* a1-b1 a0-b0\r */
- \rpsrad_i2r (SHIFT_INV_ROW, mm3); /* y6=a1-b1 y7=a0-b0\r */
- paddd_r2r (mm4, mm1); /* 4 ; a1+b1 a0+b0\r */
- \rpaddd_r2r (mm2, mm0); /* 2 ; a3=sum(even3) a2=sum(even2)\r */
- psrad_i2r (SHIFT_INV_ROW, mm1); /* y1=a1+b1 y0=a0+b0\r */
- \rpaddd_r2r (mm6, mm5); /* 6 ; b3=sum(odd3) b2=sum(odd2)\r */
- movq_r2r (mm0, mm4); /* 4 ; a3 a2\r */
- \rpaddd_r2r (mm5, mm0); /* a3+b3 a2+b2\r */
- psubd_r2r (mm5, mm4); /* 5 ; a3-b3 a2-b2\r */
- \rpsrad_i2r (SHIFT_INV_ROW, mm4); /* y4=a3-b3 y5=a2-b2\r */
- psrad_i2r (SHIFT_INV_ROW, mm0); /* y3=a3+b3 y2=a2+b2\r */
- \rpackssdw_r2r (mm3, mm4); /* 3 ; y6 y7 y4 y5\r */
- \rpackssdw_r2r (mm0, mm1); /* 0 ; y3 y2 y1 y0\r */
- movq_r2r (mm4, mm7); /* 7 ; y6 y7 y4 y5\r */
- \rpsrld_i2r (16, mm4); /* 0 y6 0 y4\r */
- \rmovq_r2m (mm1, *(out)); /* 1 ; save y3 y2 y1 y0\r */
- pslld_i2r (16, mm7); /* y7 0 y5 0\r */
- \rpor_r2r (mm4, mm7); /* 4 ; y7 y6 y5 y4\r */
+ /* ----------\r */
+ movq_r2r (mm0, mm5); /* 5 ; x5 x1 x4 x0\r */
+ punpckldq_r2r (mm0, mm0); /* x4 x0 x4 x0\r */
+ \rmovq_m2r (*(tab_i_01234567 + 4), mm4); /* 4 ; w07 w05 w03 w01\r */
+ punpckhwd_r2r (mm1, mm2); /* 1 ; x7 x3 x6 x2\r */
+ \rpmaddwd_r2r (mm0, mm3); /* x4*w06+x0*w04 x4*w02+x0*w00\r */
+ movq_r2r (mm2, mm6); /* 6 ; x7 x3 x6 x2\r */
+ \rmovq_m2r (*(tab_i_01234567 + 16), mm1); /* 1 ; w22 w20 w18 w16\r */
+ punpckldq_r2r (mm2, mm2); /* x6 x2 x6 x2\r */
+ \rpmaddwd_r2r (mm2, mm4); /* x6*w07+x2*w05 x6*w03+x2*w01\r */
+ punpckhdq_r2r (mm5, mm5); /* x5 x1 x5 x1\r */
+ \rpmaddwd_m2r (*(tab_i_01234567 + 8), mm0); /* x4*w14+x0*w12 x4*w10+x0*w08\r */
+ punpckhdq_r2r (mm6, mm6); /* x7 x3 x7 x3\r */
+ \rmovq_m2r (*(tab_i_01234567 + 20), mm7); /* 7 ; w23 w21 w19 w17\r */
+ pmaddwd_r2r (mm5, mm1); /* x5*w22+x1*w20 x5*w18+x1*w16\r */
+ \rpaddd_m2r (*(r_inv_row), mm3); /* +rounder\r */
+ pmaddwd_r2r (mm6, mm7); /* x7*w23+x3*w21 x7*w19+x3*w17\r */
+ \rpmaddwd_m2r (*(tab_i_01234567 + 12), mm2); /* x6*w15+x2*w13 x6*w11+x2*w09\r */
+ paddd_r2r (mm4, mm3); /* 4 ; a1=sum(even1) a0=sum(even0)\r */
+ \rpmaddwd_m2r (*(tab_i_01234567 + 24), mm5); /* x5*w30+x1*w28 x5*w26+x1*w24\r */
+ movq_r2r (mm3, mm4); /* 4 ; a1 a0\r */
+ \rpmaddwd_m2r (*(tab_i_01234567 + 28), mm6); /* x7*w31+x3*w29 x7*w27+x3*w25\r */
+ paddd_r2r (mm7, mm1); /* 7 ; b1=sum(odd1) b0=sum(odd0)\r */
+ \rpaddd_m2r (*(r_inv_row), mm0); /* +rounder\r */
+ psubd_r2r (mm1, mm3); /* a1-b1 a0-b0\r */
+ \rpsrad_i2r (SHIFT_INV_ROW, mm3); /* y6=a1-b1 y7=a0-b0\r */
+ paddd_r2r (mm4, mm1); /* 4 ; a1+b1 a0+b0\r */
+ \rpaddd_r2r (mm2, mm0); /* 2 ; a3=sum(even3) a2=sum(even2)\r */
+ psrad_i2r (SHIFT_INV_ROW, mm1); /* y1=a1+b1 y0=a0+b0\r */
+ \rpaddd_r2r (mm6, mm5); /* 6 ; b3=sum(odd3) b2=sum(odd2)\r */
+ movq_r2r (mm0, mm4); /* 4 ; a3 a2\r */
+ \rpaddd_r2r (mm5, mm0); /* a3+b3 a2+b2\r */
+ psubd_r2r (mm5, mm4); /* 5 ; a3-b3 a2-b2\r */
+ \rpsrad_i2r (SHIFT_INV_ROW, mm4); /* y4=a3-b3 y5=a2-b2\r */
+ psrad_i2r (SHIFT_INV_ROW, mm0); /* y3=a3+b3 y2=a2+b2\r */
+ \rpackssdw_r2r (mm3, mm4); /* 3 ; y6 y7 y4 y5\r */
+ \rpackssdw_r2r (mm0, mm1); /* 0 ; y3 y2 y1 y0\r */
+ movq_r2r (mm4, mm7); /* 7 ; y6 y7 y4 y5\r */
+ \rpsrld_i2r (16, mm4); /* 0 y6 0 y4\r */
+ \rmovq_r2m (mm1, *(out)); /* 1 ; save y3 y2 y1 y0\r */
+ pslld_i2r (16, mm7); /* y7 0 y5 0\r */
+ \rpor_r2r (mm4, mm7); /* 4 ; y7 y6 y5 y4\r */
\r
- /* begin processing row 1\r */
- movq_r2m (mm7, *(out + 4)); /* 7 ; save y7 y6 y5 y4\r */
+ /* begin processing row 1\r */
+ movq_r2m (mm7, *(out + 4)); /* 7 ; save y7 y6 y5 y4\r */
\rinptr += 8;
\rout += 8;
\r}
out = &qwTemp[0];
\r\rmovq_m2r (*(out + ROW_STRIDE * 0), mm0);
\r\rmovq_m2r (*(out + ROW_STRIDE * 1), mm1);
- \rmovq_r2r (mm0, mm4); /* mm4 = copy of row1[A B C D]\r */
+ \rmovq_r2r (mm0, mm4); /* mm4 = copy of row1[A B C D]\r */
\rmovq_m2r (*(out + ROW_STRIDE * 2), mm2);
- \rpunpcklwd_r2r (mm1, mm0); /* mm0 = [ 0 4 1 5]\r */
+ \rpunpcklwd_r2r (mm1, mm0); /* mm0 = [ 0 4 1 5]\r */
\rmovq_m2r (*(out + ROW_STRIDE * 3), mm3);
- \rpunpckhwd_r2r (mm1, mm4); /* mm4 = [ 2 6 3 7]\r */
+ \rpunpckhwd_r2r (mm1, mm4); /* mm4 = [ 2 6 3 7]\r */
\rmovq_r2r (mm2, mm6);
- \rpunpcklwd_r2r (mm3, mm2); /* mm2 = [ 8 12 9 13]\r */
- \rpunpckhwd_r2r (mm3, mm6); /* mm6 = 10 14 11 15]\r */
- movq_r2r (mm0, mm1); /* mm1 = [ 0 4 1 5]\r */
+ \rpunpcklwd_r2r (mm3, mm2); /* mm2 = [ 8 12 9 13]\r */
+ \rpunpckhwd_r2r (mm3, mm6); /* mm6 = 10 14 11 15]\r */
+ movq_r2r (mm0, mm1); /* mm1 = [ 0 4 1 5]\r */
\rinptr = blk;
- \r\rpunpckldq_r2r (mm2, mm0); /* final result mm0 = row1 [0 4 8 12]\r */
- \rmovq_r2r (mm4, mm3); /* mm3 = [ 2 6 3 7]\r */
- punpckhdq_r2r (mm2, mm1); /* mm1 = final result mm1 = row2 [1 5 9 13]\r */
- \rmovq_r2m (mm0, *(inptr + ROW_STRIDE * 0)); /* store row 1\r */
- punpckldq_r2r (mm6, mm4); /* final result mm4 = row3 [2 6 10 14]\r */
+ \r\rpunpckldq_r2r (mm2, mm0); /* final result mm0 = row1 [0 4 8 12]\r */
+ \rmovq_r2r (mm4, mm3); /* mm3 = [ 2 6 3 7]\r */
+ punpckhdq_r2r (mm2, mm1); /* mm1 = final result mm1 = row2 [1 5 9 13]\r */
+ \rmovq_r2m (mm0, *(inptr + ROW_STRIDE * 0)); /* store row 1\r */
+ punpckldq_r2r (mm6, mm4); /* final result mm4 = row3 [2 6 10 14]\r */
\r
/* begin reading next quadrant (lower-right)\r */
movq_m2r (*(out + ROW_STRIDE * 4 + 4), mm0);
- \rpunpckhdq_r2r (mm6, mm3); /* final result mm3 = row4 [3 7 11 15]\r */
- \rmovq_r2m (mm4, *(inptr + ROW_STRIDE * 2)); /* store row 3\r */
- movq_r2r (mm0, mm4); /* mm4 = copy of row1[A B C D]\r */
- \rmovq_r2m (mm1, *(inptr + ROW_STRIDE * 1)); /* store row 2\r */
+ \rpunpckhdq_r2r (mm6, mm3); /* final result mm3 = row4 [3 7 11 15]\r */
+ \rmovq_r2m (mm4, *(inptr + ROW_STRIDE * 2)); /* store row 3\r */
+ movq_r2r (mm0, mm4); /* mm4 = copy of row1[A B C D]\r */
+ \rmovq_r2m (mm1, *(inptr + ROW_STRIDE * 1)); /* store row 2\r */
\rmovq_m2r (*(out + ROW_STRIDE * 5 + 4), mm1);
- \r\rmovq_r2m (mm3, *(inptr + ROW_STRIDE * 3)); /* store row 4\r */
- punpcklwd_r2r (mm1, mm0); /* mm0 = [ 0 4 1 5]\r */
+ \r\rmovq_r2m (mm3, *(inptr + ROW_STRIDE * 3)); /* store row 4\r */
+ punpcklwd_r2r (mm1, mm0); /* mm0 = [ 0 4 1 5]\r */
\r
/* 2) transpose lower-right quadrant\r */
\r
\rmovq_m2r (*(out + ROW_STRIDE * 6 + 4), mm2);
\r
/* punpcklwd mm0, mm1; // mm0 = [ 0 4 1 5]\r */
- punpckhwd_r2r (mm1, mm4); /* mm4 = [ 2 6 3 7]\r */
+ punpckhwd_r2r (mm1, mm4); /* mm4 = [ 2 6 3 7]\r */
\rmovq_m2r (*(out + ROW_STRIDE * 7 + 4), mm3);
\rmovq_r2r (mm2, mm6);
- \r\rpunpcklwd_r2r (mm3, mm2); /* mm2 = [ 8 12 9 13]\r */
- movq_r2r (mm0, mm1); /* mm1 = [ 0 4 1 5]\r */
- \rpunpckhwd_r2r (mm3, mm6); /* mm6 = 10 14 11 15]\r */
- movq_r2r (mm4, mm3); /* mm3 = [ 2 6 3 7]\r */
- \rpunpckldq_r2r (mm2, mm0); /* final result mm0 = row1 [0 4 8 12]\r */
- \rpunpckhdq_r2r (mm2, mm1); /* mm1 = final result mm1 = row2 [1 5 9 13]\r */
- ; /* slot\r */
- \rmovq_r2m (mm0, *(inptr + ROW_STRIDE * 4 + 4)); /* store row 1\r */
- punpckldq_r2r (mm6, mm4); /* final result mm4 = row3 [2 6 10 14]\r */
+ \r\rpunpcklwd_r2r (mm3, mm2); /* mm2 = [ 8 12 9 13]\r */
+ movq_r2r (mm0, mm1); /* mm1 = [ 0 4 1 5]\r */
+ \rpunpckhwd_r2r (mm3, mm6); /* mm6 = 10 14 11 15]\r */
+ movq_r2r (mm4, mm3); /* mm3 = [ 2 6 3 7]\r */
+ \rpunpckldq_r2r (mm2, mm0); /* final result mm0 = row1 [0 4 8 12]\r */
+ \rpunpckhdq_r2r (mm2, mm1); /* mm1 = final result mm1 = row2 [1 5 9 13]\r */
+ ; /* slot\r */
+ \rmovq_r2m (mm0, *(inptr + ROW_STRIDE * 4 + 4)); /* store row 1\r */
+ punpckldq_r2r (mm6, mm4); /* final result mm4 = row3 [2 6 10 14]\r */
\rmovq_m2r (*(out + ROW_STRIDE * 4), mm0);
- \rpunpckhdq_r2r (mm6, mm3); /* final result mm3 = row4 [3 7 11 15]\r */
- \rmovq_r2m (mm4, *(inptr + ROW_STRIDE * 6 + 4)); /* store row 3\r */
- movq_r2r (mm0, mm4); /* mm4 = copy of row1[A B C D]\r */
- \rmovq_r2m (mm1, *(inptr + ROW_STRIDE * 5 + 4)); /* store row 2\r */
- ; /* slot\r */
+ \rpunpckhdq_r2r (mm6, mm3); /* final result mm3 = row4 [3 7 11 15]\r */
+ \rmovq_r2m (mm4, *(inptr + ROW_STRIDE * 6 + 4)); /* store row 3\r */
+ movq_r2r (mm0, mm4); /* mm4 = copy of row1[A B C D]\r */
+ \rmovq_r2m (mm1, *(inptr + ROW_STRIDE * 5 + 4)); /* store row 2\r */
+ ; /* slot\r */
\rmovq_m2r (*(out + ROW_STRIDE * 5), mm1);
- \r; /* slot\r */
- \rmovq_r2m (mm3, *(inptr + ROW_STRIDE * 7 + 4)); /* store row 4\r */
- punpcklwd_r2r (mm1, mm0); /* mm0 = [ 0 4 1 5]\r */
+ \r; /* slot\r */
+ \rmovq_r2m (mm3, *(inptr + ROW_STRIDE * 7 + 4)); /* store row 4\r */
+ punpcklwd_r2r (mm1, mm0); /* mm0 = [ 0 4 1 5]\r */
\r
/* 3) transpose lower-left\r */
/* movq mm0, qword ptr [OUT + ROW_STRIDE * 4 ]\r */
\rmovq_m2r (*(out + ROW_STRIDE * 6), mm2);
\r
/* punpcklwd mm0, mm1; // mm0 = [ 0 4 1 5]\r */
- punpckhwd_r2r (mm1, mm4); /* mm4 = [ 2 6 3 7]\r */
+ punpckhwd_r2r (mm1, mm4); /* mm4 = [ 2 6 3 7]\r */
\rmovq_m2r (*(out + ROW_STRIDE * 7), mm3);
\rmovq_r2r (mm2, mm6);
- \r\rpunpcklwd_r2r (mm3, mm2); /* mm2 = [ 8 12 9 13]\r */
- movq_r2r (mm0, mm1); /* mm1 = [ 0 4 1 5]\r */
- \rpunpckhwd_r2r (mm3, mm6); /* mm6 = 10 14 11 15]\r */
- movq_r2r (mm4, mm3); /* mm3 = [ 2 6 3 7]\r */
- \rpunpckldq_r2r (mm2, mm0); /* final result mm0 = row1 [0 4 8 12]\r */
- \rpunpckhdq_r2r (mm2, mm1); /* mm1 = final result mm1 = row2 [1 5 9 13]\r */
- ; /*slot\r */
- \rmovq_r2m (mm0, *(inptr + ROW_STRIDE * 0 + 4)); /* store row 1\r */
- punpckldq_r2r (mm6, mm4); /* final result mm4 = row3 [2 6 10 14]\r */
+ \r\rpunpcklwd_r2r (mm3, mm2); /* mm2 = [ 8 12 9 13]\r */
+ movq_r2r (mm0, mm1); /* mm1 = [ 0 4 1 5]\r */
+ \rpunpckhwd_r2r (mm3, mm6); /* mm6 = 10 14 11 15]\r */
+ movq_r2r (mm4, mm3); /* mm3 = [ 2 6 3 7]\r */
+ \rpunpckldq_r2r (mm2, mm0); /* final result mm0 = row1 [0 4 8 12]\r */
+ \rpunpckhdq_r2r (mm2, mm1); /* mm1 = final result mm1 = row2 [1 5 9 13]\r */
+ ; /*slot\r */
+ \rmovq_r2m (mm0, *(inptr + ROW_STRIDE * 0 + 4)); /* store row 1\r */
+ punpckldq_r2r (mm6, mm4); /* final result mm4 = row3 [2 6 10 14]\r */
\r
/* begin reading next quadrant (upper-right)\r */
movq_m2r (*(out + ROW_STRIDE * 0 + 4), mm0);
- \rpunpckhdq_r2r (mm6, mm3); /* final result mm3 = row4 [3 7 11 15]\r */
- \rmovq_r2m (mm4, *(inptr + ROW_STRIDE * 2 + 4)); /* store row 3\r */
- movq_r2r (mm0, mm4); /* mm4 = copy of row1[A B C D]\r */
- \rmovq_r2m (mm1, *(inptr + ROW_STRIDE * 1 + 4)); /* store row 2\r */
+ \rpunpckhdq_r2r (mm6, mm3); /* final result mm3 = row4 [3 7 11 15]\r */
+ \rmovq_r2m (mm4, *(inptr + ROW_STRIDE * 2 + 4)); /* store row 3\r */
+ movq_r2r (mm0, mm4); /* mm4 = copy of row1[A B C D]\r */
+ \rmovq_r2m (mm1, *(inptr + ROW_STRIDE * 1 + 4)); /* store row 2\r */
movq_m2r (*(out + ROW_STRIDE * 1 + 4), mm1);
- \r\rmovq_r2m (mm3, *(inptr + ROW_STRIDE * 3 + 4)); /* store row 4\r */
- punpcklwd_r2r (mm1, mm0); /* mm0 = [ 0 4 1 5]\r */
+ \r\rmovq_r2m (mm3, *(inptr + ROW_STRIDE * 3 + 4)); /* store row 4\r */
+ punpcklwd_r2r (mm1, mm0); /* mm0 = [ 0 4 1 5]\r */
\r\r
/* 2) transpose lower-right quadrant\r */
\r
\rmovq_m2r (*(out + ROW_STRIDE * 2 + 4), mm2);
\r
/* punpcklwd mm0, mm1; // mm0 = [ 0 4 1 5]\r */
- punpckhwd_r2r (mm1, mm4); /* mm4 = [ 2 6 3 7]\r */
+ punpckhwd_r2r (mm1, mm4); /* mm4 = [ 2 6 3 7]\r */
\rmovq_m2r (*(out + ROW_STRIDE * 3 + 4), mm3);
\rmovq_r2r (mm2, mm6);
- \r\rpunpcklwd_r2r (mm3, mm2); /* mm2 = [ 8 12 9 13]\r */
- movq_r2r (mm0, mm1); /* mm1 = [ 0 4 1 5]\r */
- \rpunpckhwd_r2r (mm3, mm6); /* mm6 = 10 14 11 15]\r */
- movq_r2r (mm4, mm3); /* mm3 = [ 2 6 3 7]\r */
- \rpunpckldq_r2r (mm2, mm0); /* final result mm0 = row1 [0 4 8 12]\r */
- \rpunpckhdq_r2r (mm2, mm1); /* mm1 = final result mm1 = row2 [1 5 9 13]\r */
- ; /* slot\r */
- \rmovq_r2m (mm0, *(inptr + ROW_STRIDE * 4)); /* store row 1\r */
- punpckldq_r2r (mm6, mm4); /* final result mm4 = row3 [2 6 10 14]\r */
- \rmovq_r2m (mm1, *(inptr + ROW_STRIDE * 5)); /* store row 2\r */
- punpckhdq_r2r (mm6, mm3); /* final result mm3 = row4 [3 7 11 15]\r */
- \rmovq_r2m (mm4, *(inptr + ROW_STRIDE * 6)); /* store row 3\r */
- ; /* slot\r */
- \rmovq_r2m (mm3, *(inptr + ROW_STRIDE * 7)); /* store row 4\r */
- ; /* slot\r */
+ \r\rpunpcklwd_r2r (mm3, mm2); /* mm2 = [ 8 12 9 13]\r */
+ movq_r2r (mm0, mm1); /* mm1 = [ 0 4 1 5]\r */
+ \rpunpckhwd_r2r (mm3, mm6); /* mm6 = 10 14 11 15]\r */
+ movq_r2r (mm4, mm3); /* mm3 = [ 2 6 3 7]\r */
+ \rpunpckldq_r2r (mm2, mm0); /* final result mm0 = row1 [0 4 8 12]\r */
+ \rpunpckhdq_r2r (mm2, mm1); /* mm1 = final result mm1 = row2 [1 5 9 13]\r */
+ ; /* slot\r */
+ \rmovq_r2m (mm0, *(inptr + ROW_STRIDE * 4)); /* store row 1\r */
+ punpckldq_r2r (mm6, mm4); /* final result mm4 = row3 [2 6 10 14]\r */
+ \rmovq_r2m (mm1, *(inptr + ROW_STRIDE * 5)); /* store row 2\r */
+ punpckhdq_r2r (mm6, mm3); /* final result mm3 = row4 [3 7 11 15]\r */
+ \rmovq_r2m (mm4, *(inptr + ROW_STRIDE * 6)); /* store row 3\r */
+ ; /* slot\r */
+ \rmovq_r2m (mm3, *(inptr + ROW_STRIDE * 7)); /* store row 4\r */
+ ; /* slot\r */
\r}
\r\r\rstatic void \r
idct_mmx32_cols (short *blk)
-{ /* transform all 8 cols of 8x8 iDCT block\r */
+{ /* transform all 8 cols of 8x8 iDCT block\r */
\rint x;
\rshort *inptr = blk;
/*\r */
/* 2) transpose the matrix (which was stored in qwTemp[])\r */
/* qwTemp[] -> [8x8 matrix transpose] -> blk[]\r */
- \r\rfor (x = 0; x < 8; x++) { /* transform one row per iteration\r */
- \rmovq_m2r (*(inptr), mm0); /* 0 ; x3 x2 x1 x0\r */
- \rmovq_m2r (*(inptr + 4), mm1); /* 1 ; x7 x6 x5 x4\r */
- movq_r2r (mm0, mm2); /* 2 ; x3 x2 x1 x0\r */
- \rmovq_m2r (*(tab_i_01234567), mm3); /* 3 ; w06 w04 w02 w00\r */
- punpcklwd_r2r (mm1, mm0); /* x5 x1 x4 x0\r */
+ \r\rfor (x = 0; x < 8; x++) { /* transform one row per iteration\r */
+ \rmovq_m2r (*(inptr), mm0); /* 0 ; x3 x2 x1 x0\r */
+ \rmovq_m2r (*(inptr + 4), mm1); /* 1 ; x7 x6 x5 x4\r */
+ movq_r2r (mm0, mm2); /* 2 ; x3 x2 x1 x0\r */
+ \rmovq_m2r (*(tab_i_01234567), mm3); /* 3 ; w06 w04 w02 w00\r */
+ punpcklwd_r2r (mm1, mm0); /* x5 x1 x4 x0\r */
\r
/* ----------\r */
- movq_r2r (mm0, mm5); /* 5 ; x5 x1 x4 x0\r */
- punpckldq_r2r (mm0, mm0); /* x4 x0 x4 x0\r */
- \rmovq_m2r (*(tab_i_01234567 + 4), mm4); /* 4 ; w07 w05 w03 w01\r */
- punpckhwd_r2r (mm1, mm2); /* 1 ; x7 x3 x6 x2\r */
- \rpmaddwd_r2r (mm0, mm3); /* x4*w06+x0*w04 x4*w02+x0*w00\r */
- movq_r2r (mm2, mm6); /* 6 ; x7 x3 x6 x2\r */
- \rmovq_m2r (*(tab_i_01234567 + 16), mm1); /* 1 ; w22 w20 w18 w16\r */
- punpckldq_r2r (mm2, mm2); /* x6 x2 x6 x2\r */
- \rpmaddwd_r2r (mm2, mm4); /* x6*w07+x2*w05 x6*w03+x2*w01\r */
- punpckhdq_r2r (mm5, mm5); /* x5 x1 x5 x1\r */
- \rpmaddwd_m2r (*(tab_i_01234567 + 8), mm0); /* x4*w14+x0*w12 x4*w10+x0*w08\r */
- punpckhdq_r2r (mm6, mm6); /* x7 x3 x7 x3\r */
- \rmovq_m2r (*(tab_i_01234567 + 20), mm7); /* 7 ; w23 w21 w19 w17\r */
- pmaddwd_r2r (mm5, mm1); /* x5*w22+x1*w20 x5*w18+x1*w16\r */
- \rpaddd_m2r (*(r_inv_col), mm3); /* +rounder\r */
- pmaddwd_r2r (mm6, mm7); /* x7*w23+x3*w21 x7*w19+x3*w17\r */
- \rpmaddwd_m2r (*(tab_i_01234567 + 12), mm2); /* x6*w15+x2*w13 x6*w11+x2*w09\r */
- paddd_r2r (mm4, mm3); /* 4 ; a1=sum(even1) a0=sum(even0)\r */
- \rpmaddwd_m2r (*(tab_i_01234567 + 24), mm5); /* x5*w30+x1*w28 x5*w26+x1*w24\r */
- movq_r2r (mm3, mm4); /* 4 ; a1 a0\r */
- \rpmaddwd_m2r (*(tab_i_01234567 + 28), mm6); /* x7*w31+x3*w29 x7*w27+x3*w25\r */
- paddd_r2r (mm7, mm1); /* 7 ; b1=sum(odd1) b0=sum(odd0)\r */
- \rpaddd_m2r (*(r_inv_col), mm0); /* +rounder\r */
- psubd_r2r (mm1, mm3); /* a1-b1 a0-b0\r */
- \rpsrad_i2r (SHIFT_INV_COL, mm3); /* y6=a1-b1 y7=a0-b0\r */
- paddd_r2r (mm4, mm1); /* 4 ; a1+b1 a0+b0\r */
- \rpaddd_r2r (mm2, mm0); /* 2 ; a3=sum(even3) a2=sum(even2)\r */
- psrad_i2r (SHIFT_INV_COL, mm1); /* y1=a1+b1 y0=a0+b0\r */
- \rpaddd_r2r (mm6, mm5); /* 6 ; b3=sum(odd3) b2=sum(odd2)\r */
- movq_r2r (mm0, mm4); /* 4 ; a3 a2\r */
- \rpaddd_r2r (mm5, mm0); /* a3+b3 a2+b2\r */
- psubd_r2r (mm5, mm4); /* 5 ; a3-b3 a2-b2\r */
- \r\rpsrad_i2r (SHIFT_INV_COL, mm4); /* y4=a3-b3 y5=a2-b2\r */
- psrad_i2r (SHIFT_INV_COL, mm0); /* y3=a3+b3 y2=a2+b2\r */
- \rpackssdw_r2r (mm3, mm4); /* 3 ; y6 y7 y4 y5\r */
- \rpackssdw_r2r (mm0, mm1); /* 0 ; y3 y2 y1 y0\r */
- movq_r2r (mm4, mm7); /* 7 ; y6 y7 y4 y5\r */
- \rpsrld_i2r (16, mm4); /* 0 y6 0 y4\r */
- \rmovq_r2m (mm1, *(inptr)); /* 1 ; save y3 y2 y1 y0\r */
- pslld_i2r (16, mm7); /* y7 0 y5 0\r */
- \rpor_r2r (mm4, mm7); /* 4 ; y7 y6 y5 y4\r */
+ movq_r2r (mm0, mm5); /* 5 ; x5 x1 x4 x0\r */
+ punpckldq_r2r (mm0, mm0); /* x4 x0 x4 x0\r */
+ \rmovq_m2r (*(tab_i_01234567 + 4), mm4); /* 4 ; w07 w05 w03 w01\r */
+ punpckhwd_r2r (mm1, mm2); /* 1 ; x7 x3 x6 x2\r */
+ \rpmaddwd_r2r (mm0, mm3); /* x4*w06+x0*w04 x4*w02+x0*w00\r */
+ movq_r2r (mm2, mm6); /* 6 ; x7 x3 x6 x2\r */
+ \rmovq_m2r (*(tab_i_01234567 + 16), mm1); /* 1 ; w22 w20 w18 w16\r */
+ punpckldq_r2r (mm2, mm2); /* x6 x2 x6 x2\r */
+ \rpmaddwd_r2r (mm2, mm4); /* x6*w07+x2*w05 x6*w03+x2*w01\r */
+ punpckhdq_r2r (mm5, mm5); /* x5 x1 x5 x1\r */
+ \rpmaddwd_m2r (*(tab_i_01234567 + 8), mm0); /* x4*w14+x0*w12 x4*w10+x0*w08\r */
+ punpckhdq_r2r (mm6, mm6); /* x7 x3 x7 x3\r */
+ \rmovq_m2r (*(tab_i_01234567 + 20), mm7); /* 7 ; w23 w21 w19 w17\r */
+ pmaddwd_r2r (mm5, mm1); /* x5*w22+x1*w20 x5*w18+x1*w16\r */
+ \rpaddd_m2r (*(r_inv_col), mm3); /* +rounder\r */
+ pmaddwd_r2r (mm6, mm7); /* x7*w23+x3*w21 x7*w19+x3*w17\r */
+ \rpmaddwd_m2r (*(tab_i_01234567 + 12), mm2); /* x6*w15+x2*w13 x6*w11+x2*w09\r */
+ paddd_r2r (mm4, mm3); /* 4 ; a1=sum(even1) a0=sum(even0)\r */
+ \rpmaddwd_m2r (*(tab_i_01234567 + 24), mm5); /* x5*w30+x1*w28 x5*w26+x1*w24\r */
+ movq_r2r (mm3, mm4); /* 4 ; a1 a0\r */
+ \rpmaddwd_m2r (*(tab_i_01234567 + 28), mm6); /* x7*w31+x3*w29 x7*w27+x3*w25\r */
+ paddd_r2r (mm7, mm1); /* 7 ; b1=sum(odd1) b0=sum(odd0)\r */
+ \rpaddd_m2r (*(r_inv_col), mm0); /* +rounder\r */
+ psubd_r2r (mm1, mm3); /* a1-b1 a0-b0\r */
+ \rpsrad_i2r (SHIFT_INV_COL, mm3); /* y6=a1-b1 y7=a0-b0\r */
+ paddd_r2r (mm4, mm1); /* 4 ; a1+b1 a0+b0\r */
+ \rpaddd_r2r (mm2, mm0); /* 2 ; a3=sum(even3) a2=sum(even2)\r */
+ psrad_i2r (SHIFT_INV_COL, mm1); /* y1=a1+b1 y0=a0+b0\r */
+ \rpaddd_r2r (mm6, mm5); /* 6 ; b3=sum(odd3) b2=sum(odd2)\r */
+ movq_r2r (mm0, mm4); /* 4 ; a3 a2\r */
+ \rpaddd_r2r (mm5, mm0); /* a3+b3 a2+b2\r */
+ psubd_r2r (mm5, mm4); /* 5 ; a3-b3 a2-b2\r */
+ \r\rpsrad_i2r (SHIFT_INV_COL, mm4); /* y4=a3-b3 y5=a2-b2\r */
+ psrad_i2r (SHIFT_INV_COL, mm0); /* y3=a3+b3 y2=a2+b2\r */
+ \rpackssdw_r2r (mm3, mm4); /* 3 ; y6 y7 y4 y5\r */
+ \rpackssdw_r2r (mm0, mm1); /* 0 ; y3 y2 y1 y0\r */
+ movq_r2r (mm4, mm7); /* 7 ; y6 y7 y4 y5\r */
+ \rpsrld_i2r (16, mm4); /* 0 y6 0 y4\r */
+ \rmovq_r2m (mm1, *(inptr)); /* 1 ; save y3 y2 y1 y0\r */
+ pslld_i2r (16, mm7); /* y7 0 y5 0\r */
+ \rpor_r2r (mm4, mm7); /* 4 ; y7 y6 y5 y4\r */
\r
- /* begin processing row 1\r */
- movq_r2m (mm7, *(inptr + 4)); /* 7 ; save y7 y6 y5 y4\r */
+ /* begin processing row 1\r */
+ movq_r2m (mm7, *(inptr + 4)); /* 7 ; save y7 y6 y5 y4\r */
\rinptr += 8;
\r}
\r
{
\r
/* 1) iDCT row transformation\r */
- idct_mmx32_rows (blk); /* 1) transform iDCT row, and transpose\r */
+ idct_mmx32_rows (blk); /* 1) transform iDCT row, and transpose\r */
\r
/* 2) iDCT column transformation\r */
- idct_mmx32_cols (blk); /* 2) transform iDCT row, and transpose\r */
- \remms (); /* restore processor state\r */
+ idct_mmx32_cols (blk); /* 2) transform iDCT row, and transpose\r */
+ \remms (); /* restore processor state\r */
/* all done\r */
-} \r
+}
+
+\r
};
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;
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;
}
};
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;
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;
};
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;
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;
}
};
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;
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);
};
gst_navigation_type = g_type_register_static (G_TYPE_INTERFACE,
- "GstNavigation", &gst_navigation_info, 0);
+ "GstNavigation", &gst_navigation_info, 0);
}
return gst_navigation_type;
{
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
{
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));
}
};
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;
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;
}
};
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;
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;
}
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);
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);
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);
};
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;
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;
};
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;
};
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;
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;
}
/* 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;
/* 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
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 */
}
{
guint meta;
guint encoded;
-} TagFlagScore;
+}
+TagFlagScore;
static void
tag_flag_score (const GstTagList * list, const gchar * tag, gpointer user_data)
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 */
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;
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",
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);
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;
}
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);
}
}
}
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) {
(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;
}
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);
}
}
{
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;
}
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 */
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);
{
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;
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);
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);
};
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;
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;
}
};
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;
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);
};
gst_navigation_type = g_type_register_static (G_TYPE_INTERFACE,
- "GstNavigation", &gst_navigation_info, 0);
+ "GstNavigation", &gst_navigation_info, 0);
}
return gst_navigation_type;
{
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
{
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));
}
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;
/* 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 */
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");
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);
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;
+ }
}
}
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 */
{
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 */
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);
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 } */
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"));
}
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;
/* 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;
}
return newcaps;
}
if (gst_caps_structure_fixate_field_nearest_double (structure, "framerate",
- 30.0)) {
+ 30.0)) {
return newcaps;
}
}
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;
}
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);
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);
}
}
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) {
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);
}
}
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);
}
}
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)));
/* 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);
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);
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);
}
}
};
play_type = g_type_register_static (GST_TYPE_PIPELINE, "GstPlay",
- &play_info, 0);
+ &play_info, 0);
}
return play_type;
};
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;
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;
}
{
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)
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];
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);
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) {
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);
}
}
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);
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 */
}
#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
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));
}
}
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;
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 */
}
#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
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));
}
}
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;
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);
}
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
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;
}
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;
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:
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;
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;
}
};
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;
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:
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;
} 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;
}
}
/* 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);
}
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;
}
}
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;
}
/* 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);
}
}
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;
}
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);
}
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;
}
/* 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 {
/* 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);
};
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;
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;
}
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);
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);
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);
};
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;
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;
};
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;
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;
}
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,
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);
}
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) {
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,
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")
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;
}
}
}
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
};
videosink_type = g_type_register_static (GST_TYPE_ELEMENT,
- "GstVideoSink", &videosink_info, 0);
+ "GstVideoSink", &videosink_info, 0);
}
return videosink_type;
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.;
}
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;
}
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;
}
};
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;
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;
}
/* 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;
};
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;
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) {
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;
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;
* 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);
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;
}
}
}
#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
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 =
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);
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;
}
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);
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);
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;
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;
}
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)) {
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));
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 */
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)) {
|| !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;
}
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);
}
}
}
/* 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;
}
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;
}
}
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);
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;
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 {
/* 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;
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;
{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;
}
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;
}
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);
}
}
gst_structure_set (structure, "rate", GST_TYPE_INT_RANGE, rate_min,
- rate_max, NULL);
+ rate_max, NULL);
}
return 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;
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);
return FALSE;
if (!gst_element_register (plugin, "audioscale", GST_RANK_NONE,
- GST_TYPE_AUDIOSCALE)) {
+ GST_TYPE_AUDIOSCALE)) {
return FALSE;
}
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) {
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;
}
}
}
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;
};
ffmpegcolorspace_type = g_type_register_static (GST_TYPE_ELEMENT,
- "GstFFMpegColorspace", &ffmpegcolorspace_info, 0);
+ "GstFFMpegColorspace", &ffmpegcolorspace_info, 0);
}
return ffmpegcolorspace_type;
} 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);
#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;
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,
},
};
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;
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;
if (pf->pixel_type == FF_PIXEL_PALETTE)
memcpy ((unsigned char *) (((size_t) dest + 3) & ~3), src->data[1],
- 256 * 4);
+ 256 * 4);
return size;
}
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)
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:
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;
+ }
}
}
}
{
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),
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)
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;
}
}
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];
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;
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;
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];
}
}
}
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;
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++;
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++;
*/
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},
},
};
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;
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;
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;
}
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;
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;
}
/* 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;
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:
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++;
}
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
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);
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;
}
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;
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);
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:
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);
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;
}
}
/*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) {
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;
}
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);
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;
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;
}
};
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;
}
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:
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;
guint count;
guint data_count;
GList *entries;
-} MyForEach;
+}
+MyForEach;
GList *
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);
}
/* 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);
}
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))
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))
{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;
}
(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;
}
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;
/* 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;
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");
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);
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)) {
}
if (connect (sink->sock, (struct sockaddr *) &(sink->theiraddr),
- sizeof (sink->theiraddr)) != 0) {
+ sizeof (sink->theiraddr)) != 0) {
perror ("stream connect");
return FALSE;
}
} 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;
}
}
{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;
}
(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;
}
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",
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;
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);
}
}
}
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) {
/* } */
if (bind (src->sock, (struct sockaddr *) &src->myaddr,
- sizeof (src->myaddr)) == -1) {
+ sizeof (src->myaddr)) == -1) {
perror ("stream_sock bind");
return FALSE;
}
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);
} 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;
}
}
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);
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;
}
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) { \
while (*data == '#') {
/* Goto end of line */
while (*data != '\n') {
- INC_BUFFER;
+ INC_BUFFER;
}
INC_BUFFER;
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;
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;
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;
}
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);
* / 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
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++;
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);
}
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) */
* = <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)
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)) {
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++;
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);
}
*/
#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
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;
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 */
}
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;
}
}
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;
}
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;
}
}
/* 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;
}
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 */
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 */
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;
}
}
}
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);
}
}
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);
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)
guint size;
guint probability;
GstCaps *caps;
-} GstTypeFindData;
+}
+GstTypeFindData;
static void
start_with_type_find (GstTypeFind * tf, gpointer private)
{
{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;
}
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;
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;
}
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);
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);
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)) {
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);
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;
}
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,
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,
for (i = 0; i < videoscale_n_formats; i++) {
format = videoscale_formats + i;
if (format->depth == 0 && format->fourcc == fourcc) {
- return format;
+ return format;
}
}
} else {
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;
}
}
}
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;
}
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;
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;
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); */
}
}
}
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;
for (x = dw; x; x--) {
while (xpos >= 0x10000L) {
- srcp++;
- xpos -= 0x10000L;
+ srcp++;
+ xpos -= 0x10000L;
}
*destp++ = *srcp;
xpos += xinc;
for (x = dw; x; x--) {
while (xpos >= 0x10000L) {
- srcp += 2;
- xpos -= 0x10000L;
+ srcp += 2;
+ xpos -= 0x10000L;
}
*destp = *srcp;
destp += 2;
for (x = dw; x; x--) {
while (xpos >= 0x10000L) {
- srcp += 4;
- xpos -= 0x10000L;
+ srcp += 4;
+ xpos -= 0x10000L;
}
*destp = *srcp;
destp += 4;
for (x = dw; x; x--) {
while (xpos >= 0x10000L) {
- srcp += 4;
- xpos -= 0x10000L;
+ srcp += 4;
+ xpos -= 0x10000L;
}
*(guint32 *) destp = *(guint32 *) srcp;
destp += 4;
for (x = dw; x; x--) {
while (xpos >= 0x10000L) {
- srcp += 3;
- xpos -= 0x10000L;
+ srcp += 3;
+ xpos -= 0x10000L;
}
destp[0] = srcp[0];
destp[1] = srcp[1];
for (x = dw; x; x--) {
while (xpos >= 0x10000L) {
- srcp += 2;
- xpos -= 0x10000L;
+ srcp += 2;
+ xpos -= 0x10000L;
}
destp[0] = srcp[0];
destp[1] = srcp[1];
for (i = 0; i < dst_w; ++i) {
while (pos >= 0x10000L) {
if (bpp == 2) {
- *eip++ = PREFIX16;
+ *eip++ = PREFIX16;
}
*eip++ = load;
pos -= 0x10000L;
};
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;
}
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;
}
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);
return newcaps;
}
if (gst_caps_structure_fixate_field_nearest_double (structure, "framerate",
- 30.0)) {
+ 30.0)) {
return newcaps;
}
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);
}
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);
}
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:
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;
}
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 */
}
} 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;
{"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 */
//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) {
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;
}
}
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;
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);
}
}
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);
}
}
/* 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
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);
};
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;
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;
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);
/* 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++;
}
}
}
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
};
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;
/* 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);
}
/* 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;
/* 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);
}
}
};
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;
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] =
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:
gchar *new = NULL;
if (GST_V4L_IS_OPEN (v4lelement))
- new = v4lelement->vcap.name;
+ new = v4lelement->vcap.name;
g_value_set_string (value, new);
break;
}
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;
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;
}
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;
}
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);
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;
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;
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);
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;
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));
}
/* 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
}
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))
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;
}
(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;
}
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);
#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] =
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);
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;
}
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;
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:
/* 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;
}
}
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
/* 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;
* 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;
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),
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:
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);
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;
}
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"));
}
(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;
}
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] =
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);
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]));
}
}
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;
}
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;
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:
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;
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;
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:
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);
}
/* 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;
* 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 {
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),
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;
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:
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;
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"));
}
};
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;
};
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;
/* 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);
/* 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) {
/* 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 &&
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);
}
}
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);
}
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;
}
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;
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;
}
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;
}
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;
}
/* 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;
}
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;
}
/* 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;
/* 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]);
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]);
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;
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) {
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);
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
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;
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;
}
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");
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);
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]);
} 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;
/* 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;
}
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);
/*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;
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;
}
{
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;
}
}
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;
}
/* 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;
}
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;
}
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++)
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;
}
}
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;
}
}
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;
/* 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;
}
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) {
/* 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;
}
/* 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;
}
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;
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
*/
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;
}
/* 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;
}
/* 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;
}
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;
}
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 */
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;
}
/* 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 */
};
/******************************************************
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;
}
/* 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;
}
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;
}
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);
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;
}
/* 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 */
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;
}
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;
}
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
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);
#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;
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);
}
#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);
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 */
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;
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);
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 */
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);
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;
}
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);
}
return newcaps;
}
if (gst_caps_structure_fixate_field_nearest_double (structure, "framerate",
- 30.0)) {
+ 30.0)) {
return newcaps;
}
/* 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));
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:
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;
}
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;
}
}
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);
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) {
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);
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);
/* 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;
}
}
}
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)
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:
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;
};
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;
return FALSE;
if (!gst_element_register (plugin, "ximagesink",
- GST_RANK_SECONDARY, GST_TYPE_XIMAGESINK))
+ GST_RANK_SECONDARY, GST_TYPE_XIMAGESINK))
return FALSE;
return TRUE;
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
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);
#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;
#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);
#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);
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);
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);
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 */
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);
/* 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;
}
/* 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);
/* 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;
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);
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;
}
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) {
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;
}
}
}
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);
}
return newcaps;
}
if (gst_caps_structure_fixate_field_nearest_double (structure, "framerate",
- 30.0)) {
+ 30.0)) {
return newcaps;
}
icaps = gst_caps_intersect (caps, format->caps);
if (!gst_caps_is_empty (icaps))
- return format->format;
+ return format->format;
}
list = g_list_next (list);
}
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;
/* 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));
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:
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;
}
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;
}
}
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);
}
}
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) {
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 */
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);
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);
}
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)
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:
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;
};
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;
return FALSE;
if (!gst_element_register (plugin, "xvimagesink",
- GST_RANK_PRIMARY, GST_TYPE_XVIMAGESINK))
+ GST_RANK_PRIMARY, GST_TYPE_XVIMAGESINK))
return FALSE;
return TRUE;
const gchar *padname;
GstPad *target;
GstElement *bin;
-} dyn_link;
+}
+dyn_link;
static GstElement *
gst_element_factory_make_or_warn (gchar * type, gchar * name)
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);
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);
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);
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);
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);
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);
{
const gchar *name;
const GstFormat format;
-} seek_format;
+}
+seek_format;
static seek_format seek_formats[] = {
{"tim", GST_FORMAT_TIME},
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++;
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++;
}
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++;
}
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 ();
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);
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);
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);
}
}
{
gchar *name;
GstElement *(*func) (const gchar * location);
-} Pipeline;
+}
+Pipeline;
static Pipeline pipelines[] = {
{"mp3", make_mp3_pipeline},
*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;
{
const gchar *name;
const GstFormat format;
-} seek_format;
+}
+seek_format;
static seek_format seek_formats[] = {
{"tim", GST_FORMAT_TIME},
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++;
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++;
}
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++;
}
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 ();
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);
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);
}
}
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
};
/* 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);
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);
}
}
}
/* 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");
/* 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;
/* 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;
};
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);
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);
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;
}
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;
}
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;
}
"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);
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);
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",
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) {
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;
GstElement *bin;
GstElement *pipeline;
GstIndex *index;
-} dyn_link;
+}
+dyn_link;
static void
dynamic_link (GstPadTemplate * templ, GstPad * newpad, gpointer data)
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;
}
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);
}
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;
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);
}
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);
/* 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);
{
const gchar *name;
const GstFormat format;
-} seek_format;
+}
+seek_format;
static seek_format seek_formats[] = {
{"tim", GST_FORMAT_TIME},
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++;
}
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++;
}
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 ();
}
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);
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);
}
}
*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
};
{
const gchar *name;
const GstFormat format;
-} seek_format;
+}
+seek_format;
static seek_format seek_formats[] = {
{"tim", GST_FORMAT_TIME},
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++;
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++;
}
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++;
}
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 ();
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);
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);
}
}
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
};
/* 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);
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);
}
}
}
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;
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");
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 <
#include "sinesrc.h"
#include <math.h>
-#include <string.h> /* memcpy */
+#include <string.h> /* memcpy */
#define SAMPLES_PER_WAVE 200
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;
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;
}
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;
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 ();
}
}
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);
}
}
}
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 <
#include "sinesrc.h"
#include <math.h>
-#include <string.h> /* memcpy */
+#include <string.h> /* memcpy */
#define SAMPLES_PER_WAVE 200
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;
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;
}
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;
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 ();
}
}
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);
}
}
}