+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):
/* 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");
0,
(GInstanceInitFunc) gst_aasink_init,
};
+
aasink_type =
- g_type_register_static (GST_TYPE_ELEMENT, "GstAASink", &aasink_info, 0);
+ g_type_register_static (GST_TYPE_ELEMENT, "GstAASink", &aasink_info, 0);
}
return aasink_type;
}
parent_class = g_type_class_ref (GST_TYPE_ELEMENT);
- g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_WIDTH, g_param_spec_int ("width", "width", "width", G_MININT, G_MAXINT, 0, G_PARAM_READWRITE)); /* CHECKME */
- g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_HEIGHT, g_param_spec_int ("height", "height", "height", G_MININT, G_MAXINT, 0, G_PARAM_READWRITE)); /* CHECKME */
- g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_DRIVER, g_param_spec_enum ("driver", "driver", "driver", GST_TYPE_AADRIVERS, 0, G_PARAM_READWRITE)); /* CHECKME! */
- g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_DITHER, g_param_spec_enum ("dither", "dither", "dither", GST_TYPE_AADITHER, 0, G_PARAM_READWRITE)); /* CHECKME! */
- g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_BRIGHTNESS, g_param_spec_int ("brightness", "brightness", "brightness", G_MININT, G_MAXINT, 0, G_PARAM_READWRITE)); /* CHECKME */
- g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_CONTRAST, g_param_spec_int ("contrast", "contrast", "contrast", G_MININT, G_MAXINT, 0, G_PARAM_READWRITE)); /* CHECKME */
- g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_GAMMA, g_param_spec_float ("gamma", "gamma", "gamma", 0.0, 5.0, 1.0, G_PARAM_READWRITE)); /* CHECKME */
- g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_INVERSION, g_param_spec_boolean ("inversion", "inversion", "inversion", TRUE, G_PARAM_READWRITE)); /* CHECKME */
- g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_RANDOMVAL, g_param_spec_int ("randomval", "randomval", "randomval", G_MININT, G_MAXINT, 0, G_PARAM_READWRITE)); /* CHECKME */
- g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_FRAMES_DISPLAYED, g_param_spec_int ("frames_displayed", "frames_displayed", "frames_displayed", G_MININT, G_MAXINT, 0, G_PARAM_READABLE)); /* CHECKME */
- g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_FRAME_TIME, g_param_spec_int ("frame_time", "frame_time", "frame_time", G_MININT, G_MAXINT, 0, G_PARAM_READABLE)); /* CHECKME */
+ g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_WIDTH, g_param_spec_int ("width", "width", "width", G_MININT, G_MAXINT, 0, G_PARAM_READWRITE)); /* CHECKME */
+ g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_HEIGHT, g_param_spec_int ("height", "height", "height", G_MININT, G_MAXINT, 0, G_PARAM_READWRITE)); /* CHECKME */
+ g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_DRIVER, g_param_spec_enum ("driver", "driver", "driver", GST_TYPE_AADRIVERS, 0, G_PARAM_READWRITE)); /* CHECKME! */
+ g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_DITHER, g_param_spec_enum ("dither", "dither", "dither", GST_TYPE_AADITHER, 0, G_PARAM_READWRITE)); /* CHECKME! */
+ g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_BRIGHTNESS, g_param_spec_int ("brightness", "brightness", "brightness", G_MININT, G_MAXINT, 0, G_PARAM_READWRITE)); /* CHECKME */
+ g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_CONTRAST, g_param_spec_int ("contrast", "contrast", "contrast", G_MININT, G_MAXINT, 0, G_PARAM_READWRITE)); /* CHECKME */
+ g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_GAMMA, g_param_spec_float ("gamma", "gamma", "gamma", 0.0, 5.0, 1.0, G_PARAM_READWRITE)); /* CHECKME */
+ g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_INVERSION, g_param_spec_boolean ("inversion", "inversion", "inversion", TRUE, G_PARAM_READWRITE)); /* CHECKME */
+ g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_RANDOMVAL, g_param_spec_int ("randomval", "randomval", "randomval", G_MININT, G_MAXINT, 0, G_PARAM_READWRITE)); /* CHECKME */
+ g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_FRAMES_DISPLAYED, g_param_spec_int ("frames_displayed", "frames_displayed", "frames_displayed", G_MININT, G_MAXINT, 0, G_PARAM_READABLE)); /* CHECKME */
+ g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_FRAME_TIME, g_param_spec_int ("frame_time", "frame_time", "frame_time", G_MININT, G_MAXINT, 0, G_PARAM_READABLE)); /* CHECKME */
gobject_class->set_property = gst_aasink_set_property;
gobject_class->get_property = gst_aasink_get_property;
return newcaps;
}
if (gst_caps_structure_fixate_field_nearest_double (structure, "framerate",
- 30.0)) {
+ 30.0)) {
return newcaps;
}
{
aasink->sinkpad =
gst_pad_new_from_template (gst_element_get_pad_template (GST_ELEMENT
- (aasink), "sink"), "sink");
+ (aasink), "sink"), "sink");
gst_element_add_pad (GST_ELEMENT (aasink), aasink->sinkpad);
gst_pad_set_chain_function (aasink->sinkpad, gst_aasink_chain);
gst_pad_set_link_function (aasink->sinkpad, gst_aasink_sinkconnect);
guchar *srcp = src;
for (x = dw; x; x--) {
- while (xpos >= 0x10000L) {
- srcp++;
- xpos -= 0x10000L;
- }
- *destp++ = *srcp;
- xpos += xinc;
+ while (xpos >= 0x10000L) {
+ srcp++;
+ xpos -= 0x10000L;
+ }
+ *destp++ = *srcp;
+ xpos += xinc;
}
}
dest += dw;
aasink = GST_AASINK (gst_pad_get_parent (pad));
- gst_aasink_scale (aasink, GST_BUFFER_DATA (buf), /* src */
- aa_image (aasink->context), /* dest */
- aasink->width, /* sw */
- aasink->height, /* sh */
- aa_imgwidth (aasink->context), /* dw */
- aa_imgheight (aasink->context)); /* dh */
+ gst_aasink_scale (aasink, GST_BUFFER_DATA (buf), /* src */
+ aa_image (aasink->context), /* dest */
+ aasink->width, /* sw */
+ aasink->height, /* sh */
+ aa_imgwidth (aasink->context), /* dw */
+ aa_imgheight (aasink->context)); /* dh */
GST_DEBUG ("videosink: clock wait: %" G_GUINT64_FORMAT,
GST_BUFFER_TIMESTAMP (buf));
aasink->context = aa_autoinit (&aasink->ascii_surf);
if (aasink->context == NULL) {
GST_ELEMENT_ERROR (GST_ELEMENT (aasink), LIBRARY, TOO_LAZY, (NULL),
- ("error opening aalib context"));
+ ("error opening aalib context"));
return FALSE;
}
aa_autoinitkbd (aasink->context, 0);
} else {
if (!GST_FLAG_IS_SET (element, GST_AASINK_OPEN)) {
if (!gst_aasink_open (GST_AASINK (element)))
- return GST_STATE_FAILURE;
+ return GST_STATE_FAILURE;
}
}
} else {
src = gst_element_factory_make ("filesrc", "src");
g_object_set (G_OBJECT (src), "location", argv[1], "bytesperread", 480,
- NULL);
+ NULL);
}
dvdec = gst_element_factory_make ("dvdec", "decoder");
if (!dvdec)
GST_PAD_SRC,
GST_PAD_ALWAYS,
GST_STATIC_CAPS ("video/x-raw-yuv, "
- "format = (fourcc) YUY2, "
- "width = (int) 720, "
- "height = (int) { "
- G_STRINGIFY (NTSC_HEIGHT) ", " G_STRINGIFY (PAL_HEIGHT)
- " }, "
- "framerate = (double) { "
- G_STRINGIFY (PAL_FRAMERATE) ", " G_STRINGIFY (NTSC_FRAMERATE)
- " }; "
- "video/x-raw-rgb, "
- "bpp = (int) 32, "
- "depth = (int) 32, "
- "endianness = (int) " G_STRINGIFY (G_BIG_ENDIAN) ", "
- "red_mask = (int) 0x000000ff, "
- "green_mask = (int) 0x0000ff00, "
- "blue_mask = (int) 0x00ff0000, "
- "width = (int) 720, "
- "height = (int) { "
- G_STRINGIFY (NTSC_HEIGHT) ", " G_STRINGIFY (PAL_HEIGHT)
- " }, "
- "framerate = (double) { "
- G_STRINGIFY (PAL_FRAMERATE) ", " G_STRINGIFY (NTSC_FRAMERATE)
- " }; "
- "video/x-raw-rgb, "
- "bpp = (int) 24, "
- "depth = (int) 24, "
- "endianness = (int) " G_STRINGIFY (G_BIG_ENDIAN) ", "
- "red_mask = (int) 0x000000ff, "
- "green_mask = (int) 0x0000ff00, "
- "blue_mask = (int) 0x00ff0000, "
- "width = (int) 720, "
- "height = (int) { "
- G_STRINGIFY (NTSC_HEIGHT) ", " G_STRINGIFY (PAL_HEIGHT)
- " }, "
- "framerate = (double) { "
- G_STRINGIFY (PAL_FRAMERATE) ", " G_STRINGIFY (NTSC_FRAMERATE)
- " }")
+ "format = (fourcc) YUY2, "
+ "width = (int) 720, "
+ "height = (int) { "
+ G_STRINGIFY (NTSC_HEIGHT) ", " G_STRINGIFY (PAL_HEIGHT)
+ " }, "
+ "framerate = (double) { "
+ G_STRINGIFY (PAL_FRAMERATE) ", " G_STRINGIFY (NTSC_FRAMERATE)
+ " }; "
+ "video/x-raw-rgb, "
+ "bpp = (int) 32, "
+ "depth = (int) 32, "
+ "endianness = (int) " G_STRINGIFY (G_BIG_ENDIAN) ", "
+ "red_mask = (int) 0x000000ff, "
+ "green_mask = (int) 0x0000ff00, "
+ "blue_mask = (int) 0x00ff0000, "
+ "width = (int) 720, "
+ "height = (int) { "
+ G_STRINGIFY (NTSC_HEIGHT) ", " G_STRINGIFY (PAL_HEIGHT)
+ " }, "
+ "framerate = (double) { "
+ G_STRINGIFY (PAL_FRAMERATE) ", " G_STRINGIFY (NTSC_FRAMERATE)
+ " }; "
+ "video/x-raw-rgb, "
+ "bpp = (int) 24, "
+ "depth = (int) 24, "
+ "endianness = (int) " G_STRINGIFY (G_BIG_ENDIAN) ", "
+ "red_mask = (int) 0x000000ff, "
+ "green_mask = (int) 0x0000ff00, "
+ "blue_mask = (int) 0x00ff0000, "
+ "width = (int) 720, "
+ "height = (int) { "
+ G_STRINGIFY (NTSC_HEIGHT) ", " G_STRINGIFY (PAL_HEIGHT)
+ " }, "
+ "framerate = (double) { "
+ G_STRINGIFY (PAL_FRAMERATE) ", " G_STRINGIFY (NTSC_FRAMERATE)
+ " }")
);
static GstStaticPadTemplate audio_src_temp = GST_STATIC_PAD_TEMPLATE ("audio",
GST_PAD_SRC,
GST_PAD_ALWAYS,
GST_STATIC_CAPS ("audio/x-raw-int, "
- "depth = (int) 16, "
- "width = (int) 16, "
- "signed = (boolean) TRUE, "
- "channels = (int) 2, "
- "endianness = (int) " G_STRINGIFY (G_LITTLE_ENDIAN) ", "
- "rate = (int) [ 4000, 48000 ]")
+ "depth = (int) 16, "
+ "width = (int) 16, "
+ "signed = (boolean) TRUE, "
+ "channels = (int) 2, "
+ "endianness = (int) " G_STRINGIFY (G_LITTLE_ENDIAN) ", "
+ "rate = (int) [ 4000, 48000 ]")
);
#define GST_TYPE_DVDEC_QUALITY (gst_dvdec_quality_get_type())
{DV_QUALITY_AC_2, "DV_QUALITY_AC_2", "AC 2 something"},
{0, NULL, NULL}
};
+
qtype = g_flags_register_static ("GstDVDecQualityFlags", values);
}
return qtype;
0,
(GInstanceInitFunc) gst_dvdec_init,
};
+
dvdec_type =
- g_type_register_static (GST_TYPE_ELEMENT, "GstDVDec", &dvdec_info, 0);
+ g_type_register_static (GST_TYPE_ELEMENT, "GstDVDec", &dvdec_info, 0);
}
return dvdec_type;
}
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_CLAMP_LUMA,
g_param_spec_boolean ("clamp_luma", "Clamp luma", "Clamp luma",
- FALSE, G_PARAM_READWRITE));
+ FALSE, G_PARAM_READWRITE));
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_CLAMP_CHROMA,
g_param_spec_boolean ("clamp_chroma", "Clamp chroma", "Clamp chroma",
- FALSE, G_PARAM_READWRITE));
+ FALSE, G_PARAM_READWRITE));
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_QUALITY,
g_param_spec_flags ("quality", "Quality", "Decoding quality",
- GST_TYPE_DVDEC_QUALITY, DV_QUALITY_BEST, G_PARAM_READWRITE));
+ GST_TYPE_DVDEC_QUALITY, DV_QUALITY_BEST, G_PARAM_READWRITE));
gobject_class->set_property = gst_dvdec_set_property;
gobject_class->get_property = gst_dvdec_get_property;
for (i = 0; i < 4; i++) {
dvdec->audio_buffers[i] =
- (gint16 *) g_malloc (DV_AUDIO_MAX_SAMPLES * sizeof (gint16));
+ (gint16 *) g_malloc (DV_AUDIO_MAX_SAMPLES * sizeof (gint16));
}
}
switch (src_format) {
case GST_FORMAT_BYTES:
switch (*dest_format) {
- case GST_FORMAT_TIME:
- default:
- res = FALSE;
+ case GST_FORMAT_TIME:
+ default:
+ res = FALSE;
}
break;
case GST_FORMAT_TIME:
switch (*dest_format) {
- case GST_FORMAT_BYTES:
- if (pad == dvdec->videosrcpad)
- scale = 720 * dvdec->height * dvdec->bpp;
- else if (pad == dvdec->audiosrcpad)
- scale = dvdec->decoder->audio->num_channels * 2;
- /* fallthrough */
- case GST_FORMAT_DEFAULT:
- if (pad == dvdec->videosrcpad)
- *dest_value = src_value * dvdec->framerate * scale / GST_SECOND;
- else if (pad == dvdec->audiosrcpad)
- *dest_value =
- src_value * dvdec->decoder->audio->frequency * scale /
- GST_SECOND;
- break;
- default:
- res = FALSE;
+ case GST_FORMAT_BYTES:
+ if (pad == dvdec->videosrcpad)
+ scale = 720 * dvdec->height * dvdec->bpp;
+ else if (pad == dvdec->audiosrcpad)
+ scale = dvdec->decoder->audio->num_channels * 2;
+ /* fallthrough */
+ case GST_FORMAT_DEFAULT:
+ if (pad == dvdec->videosrcpad)
+ *dest_value = src_value * dvdec->framerate * scale / GST_SECOND;
+ else if (pad == dvdec->audiosrcpad)
+ *dest_value =
+ src_value * dvdec->decoder->audio->frequency * scale /
+ GST_SECOND;
+ break;
+ default:
+ res = FALSE;
}
break;
default:
switch (src_format) {
case GST_FORMAT_BYTES:
switch (*dest_format) {
- case GST_FORMAT_TIME:
- {
- guint64 frame;
-
- /* get frame number */
- frame = src_value / dvdec->length;
-
- *dest_value = (frame * GST_SECOND) / dvdec->framerate;
- break;
- }
- default:
- res = FALSE;
+ case GST_FORMAT_TIME:
+ {
+ guint64 frame;
+
+ /* get frame number */
+ frame = src_value / dvdec->length;
+
+ *dest_value = (frame * GST_SECOND) / dvdec->framerate;
+ break;
+ }
+ default:
+ res = FALSE;
}
break;
case GST_FORMAT_TIME:
switch (*dest_format) {
- case GST_FORMAT_BYTES:
- {
- guint64 frame;
-
- /* calculate the frame */
- frame = src_value * dvdec->framerate / GST_SECOND;
- /* calculate the offset */
- *dest_value = frame * dvdec->length;
- break;
- }
- default:
- res = FALSE;
+ case GST_FORMAT_BYTES:
+ {
+ guint64 frame;
+
+ /* calculate the frame */
+ frame = src_value * dvdec->framerate / GST_SECOND;
+ /* calculate the offset */
+ *dest_value = frame * dvdec->length;
+ break;
+ }
+ default:
+ res = FALSE;
}
break;
default:
GST_QUERY_POSITION,
0
};
+
return src_query_types;
}
switch (type) {
case GST_QUERY_TOTAL:
switch (*format) {
- default:
- {
- guint64 len;
- GstFormat tmp_format;
-
- len = gst_bytestream_length (dvdec->bs);
- tmp_format = GST_FORMAT_TIME;
- if (len == -1 || !gst_pad_convert (dvdec->sinkpad,
- GST_FORMAT_BYTES, len, &tmp_format, value)) {
- return FALSE;
- }
- if (!gst_pad_convert (pad, GST_FORMAT_TIME, *value, format, value)) {
- return FALSE;
- }
- break;
- }
+ default:
+ {
+ guint64 len;
+ GstFormat tmp_format;
+
+ len = gst_bytestream_length (dvdec->bs);
+ tmp_format = GST_FORMAT_TIME;
+ if (len == -1 || !gst_pad_convert (dvdec->sinkpad,
+ GST_FORMAT_BYTES, len, &tmp_format, value)) {
+ return FALSE;
+ }
+ if (!gst_pad_convert (pad, GST_FORMAT_TIME, *value, format, value)) {
+ return FALSE;
+ }
+ break;
+ }
}
break;
case GST_QUERY_POSITION:
switch (*format) {
- default:
- res =
- gst_pad_convert (pad, GST_FORMAT_TIME, dvdec->next_ts, format,
- value);
- break;
+ default:
+ res =
+ gst_pad_convert (pad, GST_FORMAT_TIME, dvdec->next_ts, format,
+ value);
+ break;
}
break;
default:
format = GST_FORMAT_TIME;
/* try to get a timestamp from the discont formats */
for (i = 0; i < GST_EVENT_DISCONT_OFFSET_LEN (event); i++) {
- if (gst_pad_convert (dvdec->sinkpad,
- GST_EVENT_DISCONT_OFFSET (event, i).format,
- GST_EVENT_DISCONT_OFFSET (event, i).value,
- &format, &dvdec->next_ts)) {
- found = TRUE;
- break;
- }
+ if (gst_pad_convert (dvdec->sinkpad,
+ GST_EVENT_DISCONT_OFFSET (event, i).format,
+ GST_EVENT_DISCONT_OFFSET (event, i).value,
+ &format, &dvdec->next_ts)) {
+ found = TRUE;
+ break;
+ }
}
/* assume 0 then */
if (!found) {
- dvdec->next_ts = 0LL;
+ dvdec->next_ts = 0LL;
}
dvdec->need_discont = TRUE;
break;
/* first bring the format to time */
format = GST_FORMAT_TIME;
if (!gst_pad_convert (pad,
- GST_EVENT_SEEK_FORMAT (event),
- GST_EVENT_SEEK_ENDOFFSET (event), &format, &position)) {
- /* could not convert seek format to time offset */
- res = FALSE;
- break;
+ GST_EVENT_SEEK_FORMAT (event),
+ GST_EVENT_SEEK_ENDOFFSET (event), &format, &position)) {
+ /* could not convert seek format to time offset */
+ res = FALSE;
+ break;
}
dvdec->end_position = position;
/* first bring the format to time */
format = GST_FORMAT_TIME;
if (!gst_pad_convert (pad,
- GST_EVENT_SEEK_FORMAT (event),
- GST_EVENT_SEEK_OFFSET (event), &format, &position)) {
- /* could not convert seek format to time offset */
- res = FALSE;
- break;
+ GST_EVENT_SEEK_FORMAT (event),
+ GST_EVENT_SEEK_OFFSET (event), &format, &position)) {
+ /* could not convert seek format to time offset */
+ res = FALSE;
+ break;
}
dvdec->next_ts = position;
/* then try to figure out the byteoffset for this time */
format = GST_FORMAT_BYTES;
if (!gst_pad_convert (dvdec->sinkpad, GST_FORMAT_TIME, position,
- &format, &position)) {
- /* could not convert seek format to byte offset */
- res = FALSE;
- break;
+ &format, &position)) {
+ /* could not convert seek format to byte offset */
+ res = FALSE;
+ break;
}
/* seek to offset */
if (!gst_bytestream_seek (dvdec->bs, position, GST_SEEK_METHOD_SET)) {
- res = FALSE;
+ res = FALSE;
}
if (GST_EVENT_TYPE (event) != GST_EVENT_SEEK_SEGMENT)
- dvdec->end_position = -1;
+ dvdec->end_position = -1;
break;
}
default:
GstStructure *structure = gst_caps_get_structure (caps, i);
gst_structure_set (structure,
- "height", G_TYPE_INT, dvdec->height,
- "framerate", G_TYPE_DOUBLE, dvdec->framerate, NULL);
+ "height", G_TYPE_INT, dvdec->height,
+ "framerate", G_TYPE_DOUBLE, dvdec->framerate, NULL);
}
}
gint i, j;
dv_decode_full_audio (dvdec->decoder, GST_BUFFER_DATA (buf),
- dvdec->audio_buffers);
+ dvdec->audio_buffers);
if ((dvdec->decoder->audio->frequency != dvdec->frequency) ||
- (dvdec->decoder->audio->num_channels != dvdec->channels)) {
+ (dvdec->decoder->audio->num_channels != dvdec->channels)) {
if (!gst_pad_set_explicit_caps (dvdec->audiosrcpad,
- gst_caps_new_simple ("audio/x-raw-int",
- "rate", G_TYPE_INT, dvdec->decoder->audio->frequency,
- "depth", G_TYPE_INT, 16,
- "width", G_TYPE_INT, 16,
- "signed", G_TYPE_BOOLEAN, TRUE,
- "channels", G_TYPE_INT, dvdec->decoder->audio->num_channels,
- "endianness", G_TYPE_INT, G_LITTLE_ENDIAN, NULL))) {
- gst_buffer_unref (buf);
- GST_ELEMENT_ERROR (dvdec, CORE, NEGOTIATION, (NULL), (NULL));
- return;
+ gst_caps_new_simple ("audio/x-raw-int",
+ "rate", G_TYPE_INT, dvdec->decoder->audio->frequency,
+ "depth", G_TYPE_INT, 16,
+ "width", G_TYPE_INT, 16,
+ "signed", G_TYPE_BOOLEAN, TRUE,
+ "channels", G_TYPE_INT, dvdec->decoder->audio->num_channels,
+ "endianness", G_TYPE_INT, G_LITTLE_ENDIAN, NULL))) {
+ gst_buffer_unref (buf);
+ GST_ELEMENT_ERROR (dvdec, CORE, NEGOTIATION, (NULL), (NULL));
+ return;
}
dvdec->frequency = dvdec->decoder->audio->frequency;
outbuf = gst_buffer_new ();
GST_BUFFER_SIZE (outbuf) = dvdec->decoder->audio->samples_this_frame *
- sizeof (gint16) * dvdec->decoder->audio->num_channels;
+ sizeof (gint16) * dvdec->decoder->audio->num_channels;
GST_BUFFER_DATA (outbuf) = g_malloc (GST_BUFFER_SIZE (outbuf));
a_ptr = (gint16 *) GST_BUFFER_DATA (outbuf);
for (i = 0; i < dvdec->decoder->audio->samples_this_frame; i++) {
for (j = 0; j < dvdec->decoder->audio->num_channels; j++) {
- *(a_ptr++) = dvdec->audio_buffers[j][i];
+ *(a_ptr++) = dvdec->audio_buffers[j][i];
}
}
gst_dvdec_push (dvdec, outbuf, dvdec->audiosrcpad, ts);
}
dv_decode_full_frame (dvdec->decoder, GST_BUFFER_DATA (buf),
- dvdec->space, outframe_ptrs, outframe_pitches);
+ dvdec->space, outframe_ptrs, outframe_pitches);
gst_dvdec_push (dvdec, outbuf, dvdec->videosrcpad, ts);
}
case GST_STATE_READY_TO_PAUSED:
dvdec->bs = gst_bytestream_new (dvdec->sinkpad);
dvdec->decoder =
- dv_decoder_new (0, dvdec->clamp_luma, dvdec->clamp_chroma);
+ dv_decoder_new (0, dvdec->clamp_luma, dvdec->clamp_chroma);
dvdec->decoder->quality = dvdec->quality;
break;
case GST_STATE_PAUSED_TO_PLAYING:
return FALSE;
if (!gst_element_register (plugin, "dvdec", GST_RANK_PRIMARY,
- gst_dvdec_get_type ()))
+ gst_dvdec_get_type ()))
return FALSE;
return TRUE;
GST_PAD_SRC,
GST_PAD_ALWAYS,
GST_STATIC_CAPS ("audio/x-raw-int, "
- "endianness = (int) " G_STRINGIFY (G_BYTE_ORDER) ", "
- "signed = (boolean) TRUE, "
- "width = (int) 16, "
- "depth = (int) 16, "
- "rate = [ 8000, 96000 ], "
- "channels = [ 1, 2 ]; "
- "audio/x-raw-int, "
- "signed = (boolean) FALSE, "
- "width = (int) 8, "
- "depth = (int) 8, " "rate = [ 8000, 96000 ], " "channels = [ 1, 2 ]")
+ "endianness = (int) " G_STRINGIFY (G_BYTE_ORDER) ", "
+ "signed = (boolean) TRUE, "
+ "width = (int) 16, "
+ "depth = (int) 16, "
+ "rate = [ 8000, 96000 ], "
+ "channels = [ 1, 2 ]; "
+ "audio/x-raw-int, "
+ "signed = (boolean) FALSE, "
+ "width = (int) 8, "
+ "depth = (int) 8, " "rate = [ 8000, 96000 ], " "channels = [ 1, 2 ]")
);
static void gst_esdmon_base_init (gpointer g_class);
{16, "16", "16 Bits"},
{0, NULL, NULL},
};
+
if (!esdmon_depths_type) {
esdmon_depths_type =
- g_enum_register_static ("GstEsdmonDepths", esdmon_depths);
+ g_enum_register_static ("GstEsdmonDepths", esdmon_depths);
}
return esdmon_depths_type;
}
{2, "2", "Stereo"},
{0, NULL, NULL},
};
+
if (!esdmon_channels_type) {
esdmon_channels_type =
- g_enum_register_static ("GstEsdmonChannels", esdmon_channels);
+ g_enum_register_static ("GstEsdmonChannels", esdmon_channels);
}
return esdmon_channels_type;
}
0,
gst_esdmon_init,
};
+
esdmon_type =
- g_type_register_static (GST_TYPE_ELEMENT, "GstEsdmon", &esdmon_info, 0);
+ g_type_register_static (GST_TYPE_ELEMENT, "GstEsdmon", &esdmon_info, 0);
}
return esdmon_type;
}
parent_class = g_type_class_peek_parent (g_class);
- g_object_class_install_property (gobject_class, ARG_BYTESPERREAD, g_param_spec_ulong ("bytes_per_read", "bytes_per_read", "bytes_per_read", 0, G_MAXULONG, 0, G_PARAM_READWRITE)); /* CHECKME */
- g_object_class_install_property (gobject_class, ARG_CUROFFSET, g_param_spec_ulong ("curoffset", "curoffset", "curoffset", 0, G_MAXULONG, 0, G_PARAM_READABLE)); /* CHECKME */
- g_object_class_install_property (gobject_class, ARG_DEPTH, g_param_spec_enum ("depth", "depth", "depth", GST_TYPE_ESDMON_DEPTHS, 16, G_PARAM_READWRITE)); /* CHECKME! */
- g_object_class_install_property (gobject_class, ARG_CHANNELS, g_param_spec_enum ("channels", "channels", "channels", GST_TYPE_ESDMON_CHANNELS, 2, G_PARAM_READWRITE)); /* CHECKME! */
- g_object_class_install_property (gobject_class, ARG_RATE, g_param_spec_int ("frequency", "frequency", "frequency", G_MININT, G_MAXINT, 0, G_PARAM_READWRITE)); /* CHECKME */
- g_object_class_install_property (gobject_class, ARG_HOST, g_param_spec_string ("host", "host", "host", NULL, G_PARAM_READWRITE)); /* CHECKME */
+ g_object_class_install_property (gobject_class, ARG_BYTESPERREAD, g_param_spec_ulong ("bytes_per_read", "bytes_per_read", "bytes_per_read", 0, G_MAXULONG, 0, G_PARAM_READWRITE)); /* CHECKME */
+ g_object_class_install_property (gobject_class, ARG_CUROFFSET, g_param_spec_ulong ("curoffset", "curoffset", "curoffset", 0, G_MAXULONG, 0, G_PARAM_READABLE)); /* CHECKME */
+ g_object_class_install_property (gobject_class, ARG_DEPTH, g_param_spec_enum ("depth", "depth", "depth", GST_TYPE_ESDMON_DEPTHS, 16, G_PARAM_READWRITE)); /* CHECKME! */
+ g_object_class_install_property (gobject_class, ARG_CHANNELS, g_param_spec_enum ("channels", "channels", "channels", GST_TYPE_ESDMON_CHANNELS, 2, G_PARAM_READWRITE)); /* CHECKME! */
+ g_object_class_install_property (gobject_class, ARG_RATE, g_param_spec_int ("frequency", "frequency", "frequency", G_MININT, G_MAXINT, 0, G_PARAM_READWRITE)); /* CHECKME */
+ g_object_class_install_property (gobject_class, ARG_HOST, g_param_spec_string ("host", "host", "host", NULL, G_PARAM_READWRITE)); /* CHECKME */
gobject_class->set_property = gst_esdmon_set_property;
gobject_class->get_property = gst_esdmon_get_property;
/* set caps on src pad */
if (gst_pad_set_explicit_caps (esdmon->srcpad,
- gst_caps_new_simple ("audio/x-raw-int",
- "endianness", G_TYPE_INT, G_BYTE_ORDER,
- "signed", G_TYPE_BOOLEAN, sign,
- "width", G_TYPE_INT, esdmon->depth,
- "depth", G_TYPE_INT, esdmon->depth,
- "rate", G_TYPE_INT, esdmon->frequency,
- "channels", G_TYPE_INT, esdmon->channels)) <= 0) {
+ gst_caps_new_simple ("audio/x-raw-int",
+ "endianness", G_TYPE_INT, G_BYTE_ORDER,
+ "signed", G_TYPE_BOOLEAN, sign,
+ "width", G_TYPE_INT, esdmon->depth,
+ "depth", G_TYPE_INT, esdmon->depth,
+ "rate", G_TYPE_INT, esdmon->frequency,
+ "channels", G_TYPE_INT, esdmon->channels)) <= 0) {
GST_ELEMENT_ERROR (esdmon, CORE, NEGOTIATION, (NULL), (NULL));
return NULL;
}
case ARG_RATE:
/* Preserve the timestamps */
esdmon->basetime =
- esdmon->samples_since_basetime * GST_SECOND / esdmon->frequency;
+ esdmon->samples_since_basetime * GST_SECOND / esdmon->frequency;
esdmon->samples_since_basetime = 0;
/* Set the new frequency */
break;
case ARG_HOST:
if (esdmon->host != NULL)
- g_free (esdmon->host);
+ g_free (esdmon->host);
if (g_value_get_string (value) == NULL)
- esdmon->host = NULL;
+ esdmon->host = NULL;
else
- esdmon->host = g_strdup (g_value_get_string (value));
+ esdmon->host = g_strdup (g_value_get_string (value));
break;
default:
break;
} else {
if (!GST_FLAG_IS_SET (element, GST_ESDMON_OPEN)) {
if (!gst_esdmon_open_audio (GST_ESDMON (element)))
- return GST_STATE_FAILURE;
+ return GST_STATE_FAILURE;
}
}
GST_PAD_SINK,
GST_PAD_ALWAYS,
GST_STATIC_CAPS ("audio/x-raw-int, "
- "endianness = (int) " G_STRINGIFY (G_BYTE_ORDER) ", "
- "signed = (boolean) TRUE, "
- "width = (int) 16, "
- "depth = (int) 16, " "rate = 44100, " "channels = 2")
+ "endianness = (int) " G_STRINGIFY (G_BYTE_ORDER) ", "
+ "signed = (boolean) TRUE, "
+ "width = (int) 16, "
+ "depth = (int) 16, " "rate = 44100, " "channels = 2")
);
static void gst_esdsink_base_init (gpointer g_class);
0,
gst_esdsink_init,
};
+
esdsink_type =
- g_type_register_static (GST_TYPE_ELEMENT, "GstEsdsink", &esdsink_info,
- 0);
+ g_type_register_static (GST_TYPE_ELEMENT, "GstEsdsink", &esdsink_info,
+ 0);
}
return esdsink_type;
}
parent_class = g_type_class_peek_parent (g_class);
- g_object_class_install_property (gobject_class, ARG_MUTE, g_param_spec_boolean ("mute", "mute", "mute", TRUE, G_PARAM_READWRITE)); /* CHECKME */
- g_object_class_install_property (gobject_class, ARG_HOST, g_param_spec_string ("host", "host", "host", NULL, G_PARAM_READWRITE)); /* CHECKME */
+ g_object_class_install_property (gobject_class, ARG_MUTE, g_param_spec_boolean ("mute", "mute", "mute", TRUE, G_PARAM_READWRITE)); /* CHECKME */
+ g_object_class_install_property (gobject_class, ARG_HOST, g_param_spec_string ("host", "host", "host", NULL, G_PARAM_READWRITE)); /* CHECKME */
g_object_class_install_property (gobject_class, ARG_SYNC,
g_param_spec_boolean ("sync", "sync", "Synchronize output to clock",
- TRUE, G_PARAM_READWRITE));
+ TRUE, G_PARAM_READWRITE));
#if 0
/* This option is disabled because it is dumb in GStreamer's architecture. */
g_object_class_install_property (gobject_class, ARG_FALLBACK,
g_param_spec_boolean ("fallback", "fallback",
- "Fall back to using OSS if Esound daemon is not present", FALSE,
- G_PARAM_READWRITE));
+ "Fall back to using OSS if Esound daemon is not present", FALSE,
+ G_PARAM_READWRITE));
#endif
gobject_class->set_property = gst_esdsink_set_property;
if (!esdsink->negotiated) {
GST_ELEMENT_ERROR (esdsink, CORE, NEGOTIATION, (NULL),
- ("element wasn't negotiated before chain function"));
+ ("element wasn't negotiated before chain function"));
goto done;
}
switch (GST_EVENT_TYPE (event)) {
case GST_EVENT_EOS:
- gst_audio_clock_set_active (GST_AUDIO_CLOCK (esdsink->provided_clock),
- FALSE);
- gst_pad_event_default (pad, event);
- return;
+ gst_audio_clock_set_active (GST_AUDIO_CLOCK (esdsink->provided_clock),
+ FALSE);
+ gst_pad_event_default (pad, event);
+ return;
default:
- gst_pad_event_default (pad, event);
- return;
+ gst_pad_event_default (pad, event);
+ return;
}
gst_event_unref (event);
return;
to_write = size;
GST_LOG ("fd=%d data=%p size=%d",
- esdsink->fd, GST_BUFFER_DATA (buf), GST_BUFFER_SIZE (buf));
+ esdsink->fd, GST_BUFFER_DATA (buf), GST_BUFFER_SIZE (buf));
while (to_write > 0) {
- int done;
+ int done;
- done = write (esdsink->fd, data, to_write);
+ done = write (esdsink->fd, data, to_write);
- if (done < 0) {
- if (errno == EINTR) {
- goto done;
- }
- g_assert_not_reached ();
- }
+ if (done < 0) {
+ if (errno == EINTR) {
+ goto done;
+ }
+ g_assert_not_reached ();
+ }
- to_write -= done;
- data += done;
- esdsink->handled += done / esdsink->bytes_per_sample;
+ to_write -= done;
+ data += done;
+ esdsink->handled += done / esdsink->bytes_per_sample;
}
}
case ARG_HOST:
g_free (esdsink->host);
if (g_value_get_string (value) == NULL)
- esdsink->host = NULL;
+ esdsink->host = NULL;
else
- esdsink->host = g_strdup (g_value_get_string (value));
+ esdsink->host = g_strdup (g_value_get_string (value));
break;
case ARG_SYNC:
esdsink->sync = g_value_get_boolean (value);
gst_esdsink_factory_init (GstPlugin * plugin)
{
if (!gst_element_register (plugin, "esdsink", GST_RANK_NONE,
- GST_TYPE_ESDSINK))
+ GST_TYPE_ESDSINK))
return FALSE;
return TRUE;
esdformat |= ESD_BITS8;
else {
GST_ELEMENT_ERROR (sink, STREAM, FORMAT, (NULL),
- ("invalid bit depth (%d)", sink->depth));
+ ("invalid bit depth (%d)", sink->depth));
return FALSE;
}
esdformat |= ESD_MONO;
else {
GST_ELEMENT_ERROR (sink, STREAM, FORMAT, (NULL),
- ("invalid number of channels (%d)", sink->channels));
+ ("invalid number of channels (%d)", sink->channels));
return FALSE;
}
GST_INFO ("attempting to open connection to esound server");
if (sink->fallback) {
sink->fd =
- esd_play_stream_fallback (esdformat, sink->frequency, sink->host,
- connname);
+ esd_play_stream_fallback (esdformat, sink->frequency, sink->host,
+ connname);
} else {
sink->fd =
- esd_play_stream (esdformat, sink->frequency, sink->host, connname);
+ esd_play_stream (esdformat, sink->frequency, sink->host, connname);
}
if (sink->fd < 0) {
GST_ELEMENT_ERROR (sink, RESOURCE, OPEN_WRITE, (NULL),
- ("can't open connection to esound server"));
+ ("can't open connection to esound server"));
return FALSE;
}
GST_INFO ("successfully opened connection to esound server");
switch (GST_STATE_TRANSITION (element)) {
case GST_STATE_NULL_TO_READY:
if (!gst_esdsink_open_audio (GST_ESDSINK (element))) {
- return GST_STATE_FAILURE;
+ return GST_STATE_FAILURE;
}
break;
case GST_STATE_READY_TO_PAUSED:
break;
case GST_STATE_PAUSED_TO_PLAYING:
gst_audio_clock_set_active (GST_AUDIO_CLOCK (esdsink->provided_clock),
- TRUE);
+ TRUE);
break;
case GST_STATE_PLAYING_TO_PAUSED:
gst_audio_clock_set_active (GST_AUDIO_CLOCK (esdsink->provided_clock),
- FALSE);
+ FALSE);
esdsink->resync = TRUE;
break;
case GST_STATE_PAUSED_TO_READY:
return FALSE;
if (!gst_element_register (plugin, "flacenc", GST_RANK_NONE,
- GST_TYPE_FLACENC))
+ GST_TYPE_FLACENC))
return FALSE;
if (!gst_element_register (plugin, "flacdec", GST_RANK_PRIMARY,
- GST_TYPE_FLACDEC))
+ GST_TYPE_FLACDEC))
return FALSE;
if (!gst_element_register (plugin, "flactag", GST_RANK_PRIMARY,
- gst_flac_tag_get_type ()))
+ gst_flac_tag_get_type ()))
return FALSE;
return TRUE;
0,
(GInstanceInitFunc) gst_flacdec_init,
};
+
flacdec_type =
- g_type_register_static (GST_TYPE_ELEMENT, "FlacDec", &flacdec_info, 0);
+ g_type_register_static (GST_TYPE_ELEMENT, "FlacDec", &flacdec_info, 0);
}
return flacdec_type;
}
#else
FLAC__seekable_stream_decoder_set_write_callback (flacdec->decoder,
(FLAC__StreamDecoderWriteStatus (*)
- (const FLAC__SeekableStreamDecoder * decoder,
- const FLAC__Frame * frame,
- const FLAC__int32 * buffer[], void *client_data))
+ (const FLAC__SeekableStreamDecoder * decoder,
+ const FLAC__Frame * frame,
+ const FLAC__int32 * buffer[], void *client_data))
(gst_flacdec_write));
#endif
FLAC__seekable_stream_decoder_set_metadata_respond (flacdec->decoder,
gst_bytestream_get_status (flacdec->bs, &avail, &event);
switch (GST_EVENT_TYPE (event)) {
- case GST_EVENT_EOS:
- GST_DEBUG ("eos");
- flacdec->eos = TRUE;
- gst_event_unref (event);
- if (avail == 0) {
- return 0;
- }
- break;
- case GST_EVENT_DISCONTINUOUS:
- GST_DEBUG ("discont");
-
- /* we are not yet sending the discont, we'll do that in the next write operation */
- flacdec->need_discont = TRUE;
- gst_event_unref (event);
- break;
- default:
- gst_pad_event_default (flacdec->sinkpad, event);
- break;
+ case GST_EVENT_EOS:
+ GST_DEBUG ("eos");
+ flacdec->eos = TRUE;
+ gst_event_unref (event);
+ if (avail == 0) {
+ return 0;
+ }
+ break;
+ case GST_EVENT_DISCONTINUOUS:
+ GST_DEBUG ("discont");
+
+ /* we are not yet sending the discont, we'll do that in the next write operation */
+ flacdec->need_discont = TRUE;
+ gst_event_unref (event);
+ break;
+ default:
+ gst_pad_event_default (flacdec->sinkpad, event);
+ break;
}
if (avail > 0)
- insize = gst_bytestream_peek_bytes (flacdec->bs, &indata, avail);
+ insize = gst_bytestream_peek_bytes (flacdec->bs, &indata, avail);
else
- insize = 0;
+ insize = 0;
}
}
if (!GST_PAD_CAPS (flacdec->srcpad)) {
if (flacdec->seek_pending) {
- flacdec->total_samples = flacdec->seek_value;
+ flacdec->total_samples = flacdec->seek_value;
}
if (GST_PAD_IS_USABLE (flacdec->srcpad)) {
- GST_DEBUG ("send discont");
-
- format = GST_FORMAT_TIME;
- gst_pad_convert (flacdec->srcpad, GST_FORMAT_DEFAULT,
- flacdec->total_samples, &format, &time);
- format = GST_FORMAT_BYTES;
- gst_pad_convert (flacdec->srcpad, GST_FORMAT_DEFAULT,
- flacdec->total_samples, &format, &bytes);
- discont = gst_event_new_discontinuous (FALSE, GST_FORMAT_TIME, time,
- GST_FORMAT_BYTES, bytes,
- GST_FORMAT_DEFAULT, flacdec->total_samples, NULL);
-
- gst_pad_push (flacdec->srcpad, GST_DATA (discont));
+ GST_DEBUG ("send discont");
+
+ format = GST_FORMAT_TIME;
+ gst_pad_convert (flacdec->srcpad, GST_FORMAT_DEFAULT,
+ flacdec->total_samples, &format, &time);
+ format = GST_FORMAT_BYTES;
+ gst_pad_convert (flacdec->srcpad, GST_FORMAT_DEFAULT,
+ flacdec->total_samples, &format, &bytes);
+ discont = gst_event_new_discontinuous (FALSE, GST_FORMAT_TIME, time,
+ GST_FORMAT_BYTES, bytes,
+ GST_FORMAT_DEFAULT, flacdec->total_samples, NULL);
+
+ gst_pad_push (flacdec->srcpad, GST_DATA (discont));
}
}
}
if (!GST_PAD_CAPS (flacdec->srcpad)) {
gst_pad_set_explicit_caps (flacdec->srcpad,
- gst_caps_new_simple ("audio/x-raw-int",
- "endianness", G_TYPE_INT, G_BYTE_ORDER,
- "signed", G_TYPE_BOOLEAN, TRUE,
- "width", G_TYPE_INT, depth,
- "depth", G_TYPE_INT, depth,
- "rate", G_TYPE_INT, frame->header.sample_rate,
- "channels", G_TYPE_INT, channels, NULL));
+ gst_caps_new_simple ("audio/x-raw-int",
+ "endianness", G_TYPE_INT, G_BYTE_ORDER,
+ "signed", G_TYPE_BOOLEAN, TRUE,
+ "width", G_TYPE_INT, depth,
+ "depth", G_TYPE_INT, depth,
+ "rate", G_TYPE_INT, frame->header.sample_rate,
+ "channels", G_TYPE_INT, channels, NULL));
flacdec->depth = depth;
flacdec->channels = channels;
GST_BUFFER_SIZE (outbuf) = samples * channels * ((depth + 7) >> 3);
GST_BUFFER_DATA (outbuf) = g_malloc (GST_BUFFER_SIZE (outbuf));
GST_BUFFER_TIMESTAMP (outbuf) =
- flacdec->total_samples * GST_SECOND / frame->header.sample_rate;
+ flacdec->total_samples * GST_SECOND / frame->header.sample_rate;
if (depth == 8) {
guint8 *outbuffer = (guint8 *) GST_BUFFER_DATA (outbuf);
for (i = 0; i < samples; i++) {
- for (j = 0; j < channels; j++) {
- *outbuffer++ = (guint8) buffer[j][i];
- }
+ for (j = 0; j < channels; j++) {
+ *outbuffer++ = (guint8) buffer[j][i];
+ }
}
} else if (depth == 16) {
guint16 *outbuffer = (guint16 *) GST_BUFFER_DATA (outbuf);
for (i = 0; i < samples; i++) {
- for (j = 0; j < channels; j++) {
- *outbuffer++ = (guint16) buffer[j][i];
- }
+ for (j = 0; j < channels; j++) {
+ *outbuffer++ = (guint16) buffer[j][i];
+ }
}
} else {
g_warning ("flacdec: invalid depth %d found\n", depth);
res = FLAC__seekable_stream_decoder_init (flacdec->decoder);
if (res != FLAC__SEEKABLE_STREAM_DECODER_OK) {
GST_ELEMENT_ERROR (flacdec, LIBRARY, INIT, (NULL),
- (FLAC__SeekableStreamDecoderStateString[res]));
+ (FLAC__SeekableStreamDecoderStateString[res]));
return;
}
/* FLAC__seekable_stream_decoder_process_metadata (flacdec->decoder); */
GST_DEBUG ("perform seek to sample %" G_GINT64_FORMAT, flacdec->seek_value);
if (FLAC__seekable_stream_decoder_seek_absolute (flacdec->decoder,
- flacdec->seek_value)) {
+ flacdec->seek_value)) {
flacdec->total_samples = flacdec->seek_value;
GST_DEBUG ("seek done");
} else {
GST_FORMAT_TIME,
0,
};
+
return formats;
}
switch (src_format) {
case GST_FORMAT_BYTES:
switch (*dest_format) {
- case GST_FORMAT_DEFAULT:
- if (bytes_per_sample == 0)
- return FALSE;
- *dest_value = src_value / bytes_per_sample;
- break;
- case GST_FORMAT_TIME:
- {
- gint byterate = bytes_per_sample * flacdec->frequency;
-
- if (byterate == 0)
- return FALSE;
- *dest_value = src_value * GST_SECOND / byterate;
- break;
- }
- default:
- res = FALSE;
+ case GST_FORMAT_DEFAULT:
+ if (bytes_per_sample == 0)
+ return FALSE;
+ *dest_value = src_value / bytes_per_sample;
+ break;
+ case GST_FORMAT_TIME:
+ {
+ gint byterate = bytes_per_sample * flacdec->frequency;
+
+ if (byterate == 0)
+ return FALSE;
+ *dest_value = src_value * GST_SECOND / byterate;
+ break;
+ }
+ default:
+ res = FALSE;
}
break;
case GST_FORMAT_DEFAULT:
switch (*dest_format) {
- case GST_FORMAT_BYTES:
- *dest_value = src_value * bytes_per_sample;
- break;
- case GST_FORMAT_TIME:
- if (flacdec->frequency == 0)
- return FALSE;
- *dest_value = src_value * GST_SECOND / flacdec->frequency;
- break;
- default:
- res = FALSE;
+ case GST_FORMAT_BYTES:
+ *dest_value = src_value * bytes_per_sample;
+ break;
+ case GST_FORMAT_TIME:
+ if (flacdec->frequency == 0)
+ return FALSE;
+ *dest_value = src_value * GST_SECOND / flacdec->frequency;
+ break;
+ default:
+ res = FALSE;
}
break;
case GST_FORMAT_TIME:
switch (*dest_format) {
- case GST_FORMAT_BYTES:
- scale = bytes_per_sample;
- case GST_FORMAT_DEFAULT:
- *dest_value = src_value * scale * flacdec->frequency / GST_SECOND;
- break;
- default:
- res = FALSE;
+ case GST_FORMAT_BYTES:
+ scale = bytes_per_sample;
+ case GST_FORMAT_DEFAULT:
+ *dest_value = src_value * scale * flacdec->frequency / GST_SECOND;
+ break;
+ default:
+ res = FALSE;
}
break;
default:
GST_QUERY_POSITION,
0,
};
+
return types;
}
guint64 samples;
if (flacdec->stream_samples == 0)
- samples = flacdec->total_samples;
+ samples = flacdec->total_samples;
else
- samples = flacdec->stream_samples;
+ samples = flacdec->stream_samples;
gst_pad_convert (flacdec->srcpad,
- GST_FORMAT_DEFAULT, samples, format, value);
+ GST_FORMAT_DEFAULT, samples, format, value);
break;
}
case GST_QUERY_POSITION:
gst_pad_convert (flacdec->srcpad,
- GST_FORMAT_DEFAULT, flacdec->total_samples, format, value);
+ GST_FORMAT_DEFAULT, flacdec->total_samples, format, value);
break;
default:
res = FALSE;
{GST_EVENT_SEEK, GST_SEEK_FLAG_ACCURATE},
{0, 0},
};
+
return masks;
}
format = GST_FORMAT_DEFAULT;
if (gst_pad_convert (flacdec->srcpad,
- GST_EVENT_SEEK_FORMAT (event),
- GST_EVENT_SEEK_OFFSET (event), &format, &flacdec->seek_value))
- flacdec->seek_pending = TRUE;
+ GST_EVENT_SEEK_FORMAT (event),
+ GST_EVENT_SEEK_OFFSET (event), &format, &flacdec->seek_value))
+ flacdec->seek_pending = TRUE;
else
- res = FALSE;
+ res = FALSE;
break;
default:
res = FALSE;
flacdec->total_samples = 0;
flacdec->eos = FALSE;
if (flacdec->init == FALSE) {
- FLAC__seekable_stream_decoder_reset (flacdec->decoder);
+ FLAC__seekable_stream_decoder_reset (flacdec->decoder);
}
break;
case GST_STATE_PAUSED_TO_PLAYING:
};
flacenc_type =
- g_type_register_static (GST_TYPE_ELEMENT, "FlacEnc", &flacenc_info, 0);
+ g_type_register_static (GST_TYPE_ELEMENT, "FlacEnc", &flacenc_info, 0);
g_type_add_interface_static (flacenc_type, GST_TYPE_TAG_SETTER,
- &tag_setter_info);
+ &tag_setter_info);
}
return flacenc_type;
}
guint rice_parameter_search_dist;
guint max_lpc_order;
guint blocksize;
-} FlacEncParams;
+}
+FlacEncParams;
static const FlacEncParams flacenc_params[] = {
{FALSE, FALSE, FALSE, FALSE, 0, FALSE, 2, 2, 0, 0, 1152},
{9, "9", "9 - Insane"},
{0, NULL, NULL}
};
+
qtype = g_enum_register_static ("FlacEncQuality", values);
}
return qtype;
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_QUALITY,
g_param_spec_enum ("quality",
- "Quality",
- "Speed versus compression tradeoff",
- GST_TYPE_FLACENC_QUALITY, DEFAULT_QUALITY, G_PARAM_READWRITE));
+ "Quality",
+ "Speed versus compression tradeoff",
+ GST_TYPE_FLACENC_QUALITY, DEFAULT_QUALITY, G_PARAM_READWRITE));
g_object_class_install_property (G_OBJECT_CLASS (klass),
ARG_STREAMABLE_SUBSET, g_param_spec_boolean ("streamable_subset",
- "Streamable subset",
- "true to limit encoder to generating a Subset stream, else false",
- TRUE, G_PARAM_READWRITE));
+ "Streamable subset",
+ "true to limit encoder to generating a Subset stream, else false",
+ TRUE, G_PARAM_READWRITE));
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_MID_SIDE_STEREO,
g_param_spec_boolean ("mid_side_stereo", "Do mid side stereo",
- "Do mid side stereo (only for stereo input)",
- flacenc_params[DEFAULT_QUALITY].mid_side, G_PARAM_READWRITE));
+ "Do mid side stereo (only for stereo input)",
+ flacenc_params[DEFAULT_QUALITY].mid_side, G_PARAM_READWRITE));
g_object_class_install_property (G_OBJECT_CLASS (klass),
ARG_LOOSE_MID_SIDE_STEREO, g_param_spec_boolean ("loose_mid_side_stereo",
- "Loose mid side stereo", "Loose mid side stereo",
- flacenc_params[DEFAULT_QUALITY].loose_mid_side, G_PARAM_READWRITE));
+ "Loose mid side stereo", "Loose mid side stereo",
+ flacenc_params[DEFAULT_QUALITY].loose_mid_side, G_PARAM_READWRITE));
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_BLOCKSIZE,
g_param_spec_uint ("blocksize", "Blocksize", "Blocksize in samples",
- FLAC__MIN_BLOCK_SIZE, FLAC__MAX_BLOCK_SIZE,
- flacenc_params[DEFAULT_QUALITY].blocksize, G_PARAM_READWRITE));
+ FLAC__MIN_BLOCK_SIZE, FLAC__MAX_BLOCK_SIZE,
+ flacenc_params[DEFAULT_QUALITY].blocksize, G_PARAM_READWRITE));
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_MAX_LPC_ORDER,
g_param_spec_uint ("max_lpc_order", "Max LPC order",
- "Max LPC order; 0 => use only fixed predictors", 0,
- FLAC__MAX_LPC_ORDER, flacenc_params[DEFAULT_QUALITY].max_lpc_order,
- G_PARAM_READWRITE));
+ "Max LPC order; 0 => use only fixed predictors", 0,
+ FLAC__MAX_LPC_ORDER, flacenc_params[DEFAULT_QUALITY].max_lpc_order,
+ G_PARAM_READWRITE));
g_object_class_install_property (G_OBJECT_CLASS (klass),
ARG_QLP_COEFF_PRECISION, g_param_spec_uint ("qlp_coeff_precision",
- "QLP coefficients precision",
- "Precision in bits of quantized linear-predictor coefficients; 0 = automatic",
- 0, 32, flacenc_params[DEFAULT_QUALITY].qlp_coeff_precision,
- G_PARAM_READWRITE));
+ "QLP coefficients precision",
+ "Precision in bits of quantized linear-predictor coefficients; 0 = automatic",
+ 0, 32, flacenc_params[DEFAULT_QUALITY].qlp_coeff_precision,
+ G_PARAM_READWRITE));
g_object_class_install_property (G_OBJECT_CLASS (klass),
ARG_QLP_COEFF_PREC_SEARCH, g_param_spec_boolean ("qlp_coeff_prec_search",
- "Do QLP coefficients precision search",
- "false = use qlp_coeff_precision, "
- "true = search around qlp_coeff_precision, take best",
- flacenc_params[DEFAULT_QUALITY].qlp_coeff_prec_search,
- G_PARAM_READWRITE));
+ "Do QLP coefficients precision search",
+ "false = use qlp_coeff_precision, "
+ "true = search around qlp_coeff_precision, take best",
+ flacenc_params[DEFAULT_QUALITY].qlp_coeff_prec_search,
+ G_PARAM_READWRITE));
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_ESCAPE_CODING,
g_param_spec_boolean ("escape_coding", "Do Escape coding",
- "search for escape codes in the entropy coding stage "
- "for slightly better compression",
- flacenc_params[DEFAULT_QUALITY].escape_coding, G_PARAM_READWRITE));
+ "search for escape codes in the entropy coding stage "
+ "for slightly better compression",
+ flacenc_params[DEFAULT_QUALITY].escape_coding, G_PARAM_READWRITE));
g_object_class_install_property (G_OBJECT_CLASS (klass),
ARG_EXHAUSTIVE_MODEL_SEARCH,
g_param_spec_boolean ("exhaustive_model_search",
- "Do exhaustive model search",
- "do exhaustive search of LP coefficient quantization (expensive!)",
- flacenc_params[DEFAULT_QUALITY].exhaustive_model_search,
- G_PARAM_READWRITE));
+ "Do exhaustive model search",
+ "do exhaustive search of LP coefficient quantization (expensive!)",
+ flacenc_params[DEFAULT_QUALITY].exhaustive_model_search,
+ G_PARAM_READWRITE));
g_object_class_install_property (G_OBJECT_CLASS (klass),
ARG_MIN_RESIDUAL_PARTITION_ORDER,
g_param_spec_uint ("min_residual_partition_order",
- "Min residual partition order",
- "Min residual partition order (above 4 doesn't usually help much)", 0,
- 16, flacenc_params[DEFAULT_QUALITY].min_residual_partition_order,
- G_PARAM_READWRITE));
+ "Min residual partition order",
+ "Min residual partition order (above 4 doesn't usually help much)", 0,
+ 16, flacenc_params[DEFAULT_QUALITY].min_residual_partition_order,
+ G_PARAM_READWRITE));
g_object_class_install_property (G_OBJECT_CLASS (klass),
ARG_MAX_RESIDUAL_PARTITION_ORDER,
g_param_spec_uint ("max_residual_partition_order",
- "Max residual partition order",
- "Max residual partition order (above 4 doesn't usually help much)", 0,
- 16, flacenc_params[DEFAULT_QUALITY].max_residual_partition_order,
- G_PARAM_READWRITE));
+ "Max residual partition order",
+ "Max residual partition order (above 4 doesn't usually help much)", 0,
+ 16, flacenc_params[DEFAULT_QUALITY].max_residual_partition_order,
+ G_PARAM_READWRITE));
g_object_class_install_property (G_OBJECT_CLASS (klass),
ARG_RICE_PARAMETER_SEARCH_DIST,
g_param_spec_uint ("rice_parameter_search_dist",
- "rice_parameter_search_dist",
- "0 = try only calc'd parameter k; else try all [k-dist..k+dist] "
- "parameters, use best", 0, FLAC__MAX_RICE_PARTITION_ORDER,
- flacenc_params[DEFAULT_QUALITY].rice_parameter_search_dist,
- G_PARAM_READWRITE));
+ "rice_parameter_search_dist",
+ "0 = try only calc'd parameter k; else try all [k-dist..k+dist] "
+ "parameters, use best", 0, FLAC__MAX_RICE_PARTITION_ORDER,
+ flacenc_params[DEFAULT_QUALITY].rice_parameter_search_dist,
+ G_PARAM_READWRITE));
gstelement_class->change_state = gst_flacenc_change_state;
}
event =
gst_event_new_seek ((GstSeekType) (int) (GST_FORMAT_BYTES |
- GST_SEEK_METHOD_SET), absolute_byte_offset);
+ GST_SEEK_METHOD_SET), absolute_byte_offset);
if (event)
gst_pad_push (flacenc->srcpad, GST_DATA (event));
commment_entry.length = strlen (it->data);
commment_entry.entry = it->data;
FLAC__metadata_object_vorbiscomment_insert_comment (flacenc->meta[0],
- flacenc->meta[0]->data.vorbis_comment.num_comments,
- commment_entry, TRUE);
+ flacenc->meta[0]->data.vorbis_comment.num_comments,
+ commment_entry, TRUE);
g_free (it->data);
}
g_list_free (comments);
gst_tag_list_foreach (copy, add_one_tag, flacenc);
if (FLAC__seekable_stream_encoder_set_metadata (flacenc->encoder,
- flacenc->meta, 1) != true)
+ flacenc->meta, 1) != true)
g_warning ("Dude, i'm already initialized!");
gst_tag_list_free (copy);
}
switch (GST_EVENT_TYPE (event)) {
case GST_EVENT_EOS:
- FLAC__seekable_stream_encoder_finish (flacenc->encoder);
- break;
+ FLAC__seekable_stream_encoder_finish (flacenc->encoder);
+ break;
case GST_EVENT_TAG:
- if (flacenc->tags) {
- gst_tag_list_insert (flacenc->tags, gst_event_tag_get_list (event),
- GST_TAG_MERGE_REPLACE);
- } else {
- g_assert_not_reached ();
- }
- break;
+ if (flacenc->tags) {
+ gst_tag_list_insert (flacenc->tags, gst_event_tag_get_list (event),
+ GST_TAG_MERGE_REPLACE);
+ } else {
+ g_assert_not_reached ();
+ }
+ break;
default:
- break;
+ break;
}
gst_pad_event_default (pad, event);
return;
if (!flacenc->negotiated) {
GST_ELEMENT_ERROR (flacenc, CORE, NEGOTIATION, (NULL),
- ("format wasn't negotiated before chain function"));
+ ("format wasn't negotiated before chain function"));
return;
}
FLAC__SeekableStreamEncoderState state;
FLAC__seekable_stream_encoder_set_write_callback (flacenc->encoder,
- gst_flacenc_write_callback);
+ gst_flacenc_write_callback);
FLAC__seekable_stream_encoder_set_seek_callback (flacenc->encoder,
- gst_flacenc_seek_callback);
+ gst_flacenc_seek_callback);
FLAC__seekable_stream_encoder_set_client_data (flacenc->encoder, flacenc);
state = FLAC__seekable_stream_encoder_init (flacenc->encoder);
if (state != FLAC__STREAM_ENCODER_OK) {
GST_ELEMENT_ERROR (flacenc, LIBRARY, INIT, (NULL),
- ("could not initialize encoder (wrong parameters?)"));
+ ("could not initialize encoder (wrong parameters?)"));
return;
}
}
break;
case ARG_STREAMABLE_SUBSET:
FLAC__seekable_stream_encoder_set_streamable_subset (this->encoder,
- g_value_get_boolean (value));
+ g_value_get_boolean (value));
break;
case ARG_MID_SIDE_STEREO:
FLAC__seekable_stream_encoder_set_do_mid_side_stereo (this->encoder,
- g_value_get_boolean (value));
+ g_value_get_boolean (value));
break;
case ARG_LOOSE_MID_SIDE_STEREO:
FLAC__seekable_stream_encoder_set_loose_mid_side_stereo (this->encoder,
- g_value_get_boolean (value));
+ g_value_get_boolean (value));
break;
case ARG_BLOCKSIZE:
FLAC__seekable_stream_encoder_set_blocksize (this->encoder,
- g_value_get_uint (value));
+ g_value_get_uint (value));
break;
case ARG_MAX_LPC_ORDER:
FLAC__seekable_stream_encoder_set_max_lpc_order (this->encoder,
- g_value_get_uint (value));
+ g_value_get_uint (value));
break;
case ARG_QLP_COEFF_PRECISION:
FLAC__seekable_stream_encoder_set_qlp_coeff_precision (this->encoder,
- g_value_get_uint (value));
+ g_value_get_uint (value));
break;
case ARG_QLP_COEFF_PREC_SEARCH:
FLAC__seekable_stream_encoder_set_do_qlp_coeff_prec_search (this->encoder,
- g_value_get_boolean (value));
+ g_value_get_boolean (value));
break;
case ARG_ESCAPE_CODING:
FLAC__seekable_stream_encoder_set_do_escape_coding (this->encoder,
- g_value_get_boolean (value));
+ g_value_get_boolean (value));
break;
case ARG_EXHAUSTIVE_MODEL_SEARCH:
FLAC__seekable_stream_encoder_set_do_exhaustive_model_search (this->
- encoder, g_value_get_boolean (value));
+ encoder, g_value_get_boolean (value));
break;
case ARG_MIN_RESIDUAL_PARTITION_ORDER:
FLAC__seekable_stream_encoder_set_min_residual_partition_order (this->
- encoder, g_value_get_uint (value));
+ encoder, g_value_get_uint (value));
break;
case ARG_MAX_RESIDUAL_PARTITION_ORDER:
FLAC__seekable_stream_encoder_set_max_residual_partition_order (this->
- encoder, g_value_get_uint (value));
+ encoder, g_value_get_uint (value));
break;
case ARG_RICE_PARAMETER_SEARCH_DIST:
FLAC__seekable_stream_encoder_set_rice_parameter_search_dist (this->
- encoder, g_value_get_uint (value));
+ encoder, g_value_get_uint (value));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
case ARG_STREAMABLE_SUBSET:
g_value_set_boolean (value,
- FLAC__seekable_stream_encoder_get_streamable_subset (this->encoder));
+ FLAC__seekable_stream_encoder_get_streamable_subset (this->encoder));
break;
case ARG_MID_SIDE_STEREO:
g_value_set_boolean (value,
- FLAC__seekable_stream_encoder_get_do_mid_side_stereo (this->encoder));
+ FLAC__seekable_stream_encoder_get_do_mid_side_stereo (this->encoder));
break;
case ARG_LOOSE_MID_SIDE_STEREO:
g_value_set_boolean (value,
- FLAC__seekable_stream_encoder_get_loose_mid_side_stereo (this->
- encoder));
+ FLAC__seekable_stream_encoder_get_loose_mid_side_stereo (this->
+ encoder));
break;
case ARG_BLOCKSIZE:
g_value_set_uint (value,
- FLAC__seekable_stream_encoder_get_blocksize (this->encoder));
+ FLAC__seekable_stream_encoder_get_blocksize (this->encoder));
break;
case ARG_MAX_LPC_ORDER:
g_value_set_uint (value,
- FLAC__seekable_stream_encoder_get_max_lpc_order (this->encoder));
+ FLAC__seekable_stream_encoder_get_max_lpc_order (this->encoder));
break;
case ARG_QLP_COEFF_PRECISION:
g_value_set_uint (value,
- FLAC__seekable_stream_encoder_get_qlp_coeff_precision (this->
- encoder));
+ FLAC__seekable_stream_encoder_get_qlp_coeff_precision (this->
+ encoder));
break;
case ARG_QLP_COEFF_PREC_SEARCH:
g_value_set_boolean (value,
- FLAC__seekable_stream_encoder_get_do_qlp_coeff_prec_search (this->
- encoder));
+ FLAC__seekable_stream_encoder_get_do_qlp_coeff_prec_search (this->
+ encoder));
break;
case ARG_ESCAPE_CODING:
g_value_set_boolean (value,
- FLAC__seekable_stream_encoder_get_do_escape_coding (this->encoder));
+ FLAC__seekable_stream_encoder_get_do_escape_coding (this->encoder));
break;
case ARG_EXHAUSTIVE_MODEL_SEARCH:
g_value_set_boolean (value,
- FLAC__seekable_stream_encoder_get_do_exhaustive_model_search (this->
- encoder));
+ FLAC__seekable_stream_encoder_get_do_exhaustive_model_search (this->
+ encoder));
break;
case ARG_MIN_RESIDUAL_PARTITION_ORDER:
g_value_set_uint (value,
- FLAC__seekable_stream_encoder_get_min_residual_partition_order (this->
- encoder));
+ FLAC__seekable_stream_encoder_get_min_residual_partition_order (this->
+ encoder));
break;
case ARG_MAX_RESIDUAL_PARTITION_ORDER:
g_value_set_uint (value,
- FLAC__seekable_stream_encoder_get_max_residual_partition_order (this->
- encoder));
+ FLAC__seekable_stream_encoder_get_max_residual_partition_order (this->
+ encoder));
break;
case ARG_RICE_PARAMETER_SEARCH_DIST:
g_value_set_uint (value,
- FLAC__seekable_stream_encoder_get_rice_parameter_search_dist (this->
- encoder));
+ FLAC__seekable_stream_encoder_get_rice_parameter_search_dist (this->
+ encoder));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
case GST_STATE_PAUSED_TO_READY:
if (FLAC__seekable_stream_encoder_get_state (flacenc->encoder) !=
- FLAC__STREAM_ENCODER_UNINITIALIZED) {
- flacenc->stopped = TRUE;
- FLAC__seekable_stream_encoder_finish (flacenc->encoder);
+ FLAC__STREAM_ENCODER_UNINITIALIZED) {
+ flacenc->stopped = TRUE;
+ FLAC__seekable_stream_encoder_finish (flacenc->encoder);
}
flacenc->negotiated = FALSE;
if (flacenc->first_buf)
- gst_buffer_unref (flacenc->first_buf);
+ gst_buffer_unref (flacenc->first_buf);
flacenc->first_buf = NULL;
g_free (flacenc->data);
flacenc->data = NULL;
if (flacenc->meta) {
- FLAC__metadata_object_delete (flacenc->meta[0]);
- g_free (flacenc->meta);
- flacenc->meta = NULL;
+ FLAC__metadata_object_delete (flacenc->meta[0]);
+ g_free (flacenc->meta);
+ flacenc->meta = NULL;
}
break;
case GST_STATE_READY_TO_NULL:
GST_FLAC_TAG_STATE_VC_METADATA_BLOCK,
GST_FLAC_TAG_STATE_ADD_VORBIS_COMMENT,
GST_FLAC_TAG_STATE_AUDIO_DATA
-} GstFlacTagState;
+}
+GstFlacTagState;
struct _GstFlacTag
};
flac_tag_type =
- g_type_register_static (GST_TYPE_ELEMENT, "GstFlacTag", &flac_tag_info,
- 0);
+ g_type_register_static (GST_TYPE_ELEMENT, "GstFlacTag", &flac_tag_info,
+ 0);
g_type_add_interface_static (flac_tag_type, GST_TYPE_TAG_SETTER,
- &tag_setter_info);
+ &tag_setter_info);
}
return flac_tag_type;
gst_pad_push (tag->srcpad, GST_DATA (gst_event_new (GST_EVENT_EOS)));
/* Seek to end of sink stream */
if (gst_pad_send_event (GST_PAD_PEER (tag->sinkpad),
- gst_event_new_seek (GST_FORMAT_BYTES | GST_SEEK_METHOD_END |
- GST_SEEK_FLAG_FLUSH, 0))) {
+ gst_event_new_seek (GST_FORMAT_BYTES | GST_SEEK_METHOD_END |
+ GST_SEEK_FLAG_FLUSH, 0))) {
} else {
g_warning ("Couldn't seek to eos on sinkpad\n");
}
GST_LOG_OBJECT (tag, "normal operation, using audio/x-flac output");
} else {
if (gst_pad_try_set_caps (tag->srcpad,
- gst_caps_new_simple ("application/x-gst-tags", NULL))
- != GST_PAD_LINK_REFUSED) {
+ gst_caps_new_simple ("application/x-gst-tags", NULL))
+ != GST_PAD_LINK_REFUSED) {
tag->only_output_tags = TRUE;
GST_LOG_OBJECT (tag, "fast operation, just outputting tags");
printf ("output tags only\n");
}
if (strncmp (GST_BUFFER_DATA (tag->buffer), FLAC_MAGIC,
- FLAC_MAGIC_SIZE) == 0) {
+ FLAC_MAGIC_SIZE) == 0) {
GstBuffer *sub;
tag->state = GST_FLAC_TAG_STATE_METADATA_BLOCKS;
gst_pad_push (tag->srcpad, GST_DATA (sub));
sub =
- gst_buffer_create_sub (tag->buffer, FLAC_MAGIC_SIZE,
- GST_BUFFER_SIZE (tag->buffer) - FLAC_MAGIC_SIZE);
+ gst_buffer_create_sub (tag->buffer, FLAC_MAGIC_SIZE,
+ GST_BUFFER_SIZE (tag->buffer) - FLAC_MAGIC_SIZE);
gst_buffer_unref (tag->buffer);
/* We do a copy because we need a writable buffer, and _create_sub
* sets the buffer it uses to read-only
type = (GST_BUFFER_DATA (tag->buffer)[0]) & 0x7F;
size = ((GST_BUFFER_DATA (tag->buffer)[1]) << 16)
- | ((GST_BUFFER_DATA (tag->buffer)[2]) << 8)
- | (GST_BUFFER_DATA (tag->buffer)[3]);
+ | ((GST_BUFFER_DATA (tag->buffer)[2]) << 8)
+ | (GST_BUFFER_DATA (tag->buffer)[3]);
/* The 4 bytes long header isn't included in the metadata size */
tag->metadata_bytes_remaining = size + 4;
g_assert (tag->metadata_bytes_remaining != 0);
bytes_to_push = min (tag->metadata_bytes_remaining,
- GST_BUFFER_SIZE (tag->buffer));
+ GST_BUFFER_SIZE (tag->buffer));
sub = gst_buffer_create_sub (tag->buffer, 0, bytes_to_push);
gst_pad_push (tag->srcpad, GST_DATA (sub));
} else {
if (tag->vorbiscomment == NULL) {
- tag->vorbiscomment = sub;
+ tag->vorbiscomment = sub;
} else {
- GstBuffer *merge;
+ GstBuffer *merge;
- merge = gst_buffer_merge (tag->vorbiscomment, sub);
- gst_buffer_unref (tag->vorbiscomment);
- gst_buffer_unref (sub);
- tag->vorbiscomment = merge;
+ merge = gst_buffer_merge (tag->vorbiscomment, sub);
+ gst_buffer_unref (tag->vorbiscomment);
+ gst_buffer_unref (sub);
+ tag->vorbiscomment = merge;
}
}
GstBuffer *sub;
sub = gst_buffer_create_sub (tag->buffer, bytes_to_push,
- GST_BUFFER_SIZE (tag->buffer) - bytes_to_push);
+ GST_BUFFER_SIZE (tag->buffer) - bytes_to_push);
gst_buffer_unref (tag->buffer);
/* We make a copy because we need a writable buffer, and _create_sub
* that we encoutered some tags
*/
tag->tags = gst_tag_list_from_vorbiscomment_buffer (tag->vorbiscomment,
- GST_BUFFER_DATA (tag->vorbiscomment), 4, NULL);
+ GST_BUFFER_DATA (tag->vorbiscomment), 4, NULL);
if (tag->tags != NULL) {
- gst_element_found_tags (GST_ELEMENT (tag), tag->tags);
+ gst_element_found_tags (GST_ELEMENT (tag), tag->tags);
}
gst_buffer_unref (tag->vorbiscomment);
tag->vorbiscomment = NULL;
if (tag->only_output_tags) {
- send_eos (tag);
- return;
+ send_eos (tag);
+ return;
}
}
tag->state = GST_FLAC_TAG_STATE_METADATA_BLOCKS;
} else {
if (tag->only_output_tags) {
- /* If we finished parsing the metadata blocks, we will never find any
- * metadata, so just stop now
- */
- send_eos (tag);
- return;
+ /* If we finished parsing the metadata blocks, we will never find any
+ * metadata, so just stop now
+ */
+ send_eos (tag);
+ return;
} else {
- tag->state = GST_FLAC_TAG_STATE_ADD_VORBIS_COMMENT;
+ tag->state = GST_FLAC_TAG_STATE_ADD_VORBIS_COMMENT;
}
}
}
user_tags = gst_tag_setter_get_list (GST_TAG_SETTER (tag));
merged_tags = gst_tag_list_merge (tag->tags, user_tags,
- gst_tag_setter_get_merge_mode (GST_TAG_SETTER (tag)));
+ gst_tag_setter_get_merge_mode (GST_TAG_SETTER (tag)));
if (merged_tags == NULL) {
/* If we get a NULL list of tags, we must generate a padding block
g_warning ("No tags found\n");
buffer = gst_buffer_new_and_alloc (12);
if (buffer == NULL) {
- GST_ELEMENT_ERROR (tag, CORE, TOO_LAZY, (NULL),
- ("Error creating 12-byte buffer for padding block"));
+ GST_ELEMENT_ERROR (tag, CORE, TOO_LAZY, (NULL),
+ ("Error creating 12-byte buffer for padding block"));
}
memset (GST_BUFFER_DATA (buffer), 0, GST_BUFFER_SIZE (buffer));
- GST_BUFFER_DATA (buffer)[0] = 0x81; /* 0x80 = Last metadata block,
- * 0x01 = padding block
- */
+ GST_BUFFER_DATA (buffer)[0] = 0x81; /* 0x80 = Last metadata block,
+ * 0x01 = padding block
+ */
} else {
guchar header[4];
memset (header, 0, sizeof (header));
- header[0] = 0x84; /* 0x80 = Last metadata block,
- * 0x04 = vorbiscomment block
- */
+ header[0] = 0x84; /* 0x80 = Last metadata block,
+ * 0x04 = vorbiscomment block
+ */
buffer = gst_tag_list_to_vorbiscomment_buffer (merged_tags, header,
- sizeof (header), NULL);
+ sizeof (header), NULL);
gst_tag_list_free (merged_tags);
if (buffer == NULL) {
- GST_ELEMENT_ERROR (tag, CORE, TAG, (NULL),
- ("Error converting tag list to vorbiscomment buffer"));
- return;
+ GST_ELEMENT_ERROR (tag, CORE, TAG, (NULL),
+ ("Error converting tag list to vorbiscomment buffer"));
+ return;
}
size = GST_BUFFER_SIZE (buffer) - 4;
if ((size > 0xFFFFFF) || (size < 0)) {
- /* FLAC vorbis comment blocks are limited to 2^24 bytes,
- * while the vorbis specs allow more than that. Shouldn't
- * be a real world problem though
- */
- GST_ELEMENT_ERROR (tag, CORE, TAG, (NULL),
- ("Vorbis comment of size %d too long", size));
- return;
+ /* FLAC vorbis comment blocks are limited to 2^24 bytes,
+ * while the vorbis specs allow more than that. Shouldn't
+ * be a real world problem though
+ */
+ GST_ELEMENT_ERROR (tag, CORE, TAG, (NULL),
+ ("Vorbis comment of size %d too long", size));
+ return;
}
}
break;
case GST_STATE_PAUSED_TO_READY:
if (tag->buffer) {
- gst_buffer_unref (tag->buffer);
- tag->buffer = NULL;
+ gst_buffer_unref (tag->buffer);
+ tag->buffer = NULL;
}
if (tag->vorbiscomment) {
- gst_buffer_unref (tag->vorbiscomment);
- tag->vorbiscomment = NULL;
+ gst_buffer_unref (tag->vorbiscomment);
+ tag->vorbiscomment = NULL;
}
if (tag->tags) {
- gst_tag_list_free (tag->tags);
+ gst_tag_list_free (tag->tags);
}
tag->state = GST_FLAC_TAG_STATE_INIT;
break;
/* our own stuff - we're much better at keeping fields small :p */
GstGdkAnimation *ani;
gboolean initialized;
-} GstLoaderContext;
+}
+GstLoaderContext;
GST_DEBUG_CATEGORY_STATIC (gst_loader_debug);
#define GST_CAT_DEFAULT gst_loader_debug
if (!g_thread_supported ()) {
g_set_error (error, GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR_FAILED,
- "The GStreamer loader requires threading support.");
+ "The GStreamer loader requires threading support.");
return FALSE;
}
if (!gst_init_check (0, NULL)) {
g_set_error (error, GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR_FAILED,
- "GStreamer could not be initialized.");
+ "GStreamer could not be initialized.");
return FALSE;
}
gst_gdk_animation_add_data (context->ani, buf, size);
if (!context->initialized
&& (iter =
- gdk_pixbuf_animation_get_iter (GDK_PIXBUF_ANIMATION (context->ani),
- NULL)) != NULL) {
+ gdk_pixbuf_animation_get_iter (GDK_PIXBUF_ANIMATION (context->ani),
+ NULL)) != NULL) {
int width =
- gdk_pixbuf_animation_get_width (GDK_PIXBUF_ANIMATION (context->ani));
+ gdk_pixbuf_animation_get_width (GDK_PIXBUF_ANIMATION (context->ani));
int height =
- gdk_pixbuf_animation_get_height (GDK_PIXBUF_ANIMATION (context->ani));
+ gdk_pixbuf_animation_get_height (GDK_PIXBUF_ANIMATION (context->ani));
GdkPixbuf *pixbuf =
- gdk_pixbuf_animation_get_static_image (GDK_PIXBUF_ANIMATION (context->
- ani));
+ gdk_pixbuf_animation_get_static_image (GDK_PIXBUF_ANIMATION (context->
+ ani));
g_object_unref (iter);
GST_LOG_OBJECT (context->ani, "initializing loader");
if (context->prepared_func) {
GST_LOG_OBJECT (context->ani, "calling prepared_func %p",
- context->prepared_func);
+ context->prepared_func);
context->prepared_func (pixbuf, GDK_PIXBUF_ANIMATION (context->ani),
- context->user_data);
+ context->user_data);
}
context->initialized = TRUE;
g_free (filename);
if (iter == NULL) {
g_set_error (error, GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
- "could not create an image");
+ "could not create an image");
g_object_unref (ani);
GST_INFO ("could not create an image");
return NULL;
GST_ERROR_OBJECT (ani, "Could not get an image in _pixbuf_load");
g_object_unref (ani);
g_set_error (error, GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
- "Could not get an image from file.");
+ "Could not get an image from file.");
return NULL;
}
{" free", "xxxx ", 80},
/* ASF */
{"\060\046\262\165\216\146\317\021\246\331 \252 \142\316\154",
- " z z ", 100},
+ " z z ", 100},
{NULL, NULL, 0}
};
NULL,
NULL,
gst_gdk_animation_class_init,
- NULL, /* class_finalize */
- NULL, /* class_data */
+ NULL, /* class_finalize */
+ NULL, /* class_data */
sizeof (GstGdkAnimation),
- 0, /* n_preallocs */
+ 0, /* n_preallocs */
NULL,
};
object_type = g_type_register_static (GDK_TYPE_PIXBUF_ANIMATION,
- "GstGdkAnimation", &object_info, 0);
+ "GstGdkAnimation", &object_info, 0);
GST_DEBUG_CATEGORY_INIT (gst_gdk_animation_debug, "gstloader_animation", 0,
- "GStreamer GdkPixbuf loader - GdkAnimation class");
+ "GStreamer GdkPixbuf loader - GdkAnimation class");
}
return object_type;
NULL,
NULL,
gst_gdk_animation_iter_class_init,
- NULL, /* class_finalize */
- NULL, /* class_data */
+ NULL, /* class_finalize */
+ NULL, /* class_data */
sizeof (GstGdkAnimationIter),
- 0, /* n_preallocs */
+ 0, /* n_preallocs */
gst_gdk_animation_iter_init,
};
object_type = g_type_register_static (GDK_TYPE_PIXBUF_ANIMATION_ITER,
- "GdkPixbufAniAnimIter", &object_info, 0);
+ "GdkPixbufAniAnimIter", &object_info, 0);
}
return object_type;
);
gst_caps_append (caps, GST_CAPS_NEW ("pixbuf_filter24",
- "video/x-raw-rgb",
- "endianness", GST_PROPS_INT (G_BIG_ENDIAN),
- "bpp", GST_PROPS_INT (24),
- "red_mask", GST_PROPS_INT (0xFF0000),
- "green_mask", GST_PROPS_INT (0x00FF00),
- "blue_mask", GST_PROPS_INT (0x0000FF)
+ "video/x-raw-rgb",
+ "endianness", GST_PROPS_INT (G_BIG_ENDIAN),
+ "bpp", GST_PROPS_INT (24),
+ "red_mask", GST_PROPS_INT (0xFF0000),
+ "green_mask", GST_PROPS_INT (0x00FF00),
+ "blue_mask", GST_PROPS_INT (0x0000FF)
));
iter->pipeline = gst_element_factory_make ("pipeline", "main_pipeline");
if (!gst_element_link_filtered (colorspace, sink, caps))
goto error;
if (gst_element_set_state (iter->pipeline,
- GST_STATE_PLAYING) != GST_STATE_SUCCESS)
+ GST_STATE_PLAYING) != GST_STATE_SUCCESS)
goto error;
return TRUE;
data_amount = lseek (iter->ani->temp_fd, 0, SEEK_CUR);
g_assert (data_amount >= 0);
g_assert (gst_element_query (gst_bin_get_by_name (GST_BIN (iter->pipeline),
- "source"), GST_QUERY_POSITION, &bytes, &offset));
+ "source"), GST_QUERY_POSITION, &bytes, &offset));
if (data_amount - offset > GST_GDK_BUFFER_SIZE)
return TRUE;
GstPad *pad;
GstCaps *caps;
GstElement *fakesink =
- gst_bin_get_by_name (GST_BIN (iter->pipeline), "sink");
+ gst_bin_get_by_name (GST_BIN (iter->pipeline), "sink");
g_assert (fakesink);
pad = gst_element_get_pad (fakesink, "sink");
g_assert (pad);
g_assert (caps);
g_assert (GST_CAPS_IS_FIXED (caps));
g_assert (gst_caps_has_fixed_property (caps, "bpp") &&
- gst_caps_has_fixed_property (caps, "width") &&
- gst_caps_has_fixed_property (caps, "height"));
+ gst_caps_has_fixed_property (caps, "width") &&
+ gst_caps_has_fixed_property (caps, "height"));
gst_caps_get_int (caps, "width", &ani->width);
gst_caps_get_int (caps, "height", &ani->height);
gst_caps_get_int (caps, "bpp", &ani->bpp);
GST_DEBUG_OBJECT (ani, "found format (width %d, height %d, bpp %d)",
- ani->width, ani->height, ani->bpp);
+ ani->width, ani->height, ani->bpp);
}
g_assert (GST_BUFFER_SIZE (buf) == ani->width * ani->height * ani->bpp / 8);
if (ani->bpp == 32) {
((GstClockTime) current_time->tv_sec - iter->start.tv_sec) * GST_SECOND;
if (iter->start.tv_usec > current_time->tv_usec) {
offset -=
- ((GstClockTime) iter->start.tv_usec -
- current_time->tv_usec) * GST_SECOND / G_USEC_PER_SEC;
+ ((GstClockTime) iter->start.tv_usec -
+ current_time->tv_usec) * GST_SECOND / G_USEC_PER_SEC;
} else {
offset +=
- ((GstClockTime) current_time->tv_usec -
- iter->start.tv_usec) * GST_SECOND / G_USEC_PER_SEC;
+ ((GstClockTime) current_time->tv_usec -
+ iter->start.tv_usec) * GST_SECOND / G_USEC_PER_SEC;
}
GST_DEBUG_OBJECT (iter,
"advancing to %ld:%ld (started at %ld:%ld) need offset %"
if (!iter->just_seeked
&& offset - iter->last_timestamp > GST_GDK_MAX_DELAY_TO_SEEK) {
GST_INFO_OBJECT (iter,
- "current pipeline timestamp is too old (%" G_GUINT64_FORMAT " vs %"
- G_GUINT64_FORMAT "), seeking there", iter->last_timestamp, offset);
+ "current pipeline timestamp is too old (%" G_GUINT64_FORMAT " vs %"
+ G_GUINT64_FORMAT "), seeking there", iter->last_timestamp, offset);
if (gst_element_send_event (gst_bin_get_by_name (GST_BIN (iter->pipeline),
- "sink"),
- gst_event_new_seek (GST_FORMAT_TIME | GST_SEEK_METHOD_SET |
- GST_SEEK_FLAG_FLUSH | GST_SEEK_FLAG_ACCURATE, offset))) {
+ "sink"),
+ gst_event_new_seek (GST_FORMAT_TIME | GST_SEEK_METHOD_SET |
+ GST_SEEK_FLAG_FLUSH | GST_SEEK_FLAG_ACCURATE, offset))) {
iter->last_timestamp = offset;
iter->just_seeked = TRUE;
} else {
GST_WARNING_OBJECT (iter,
- "seek to %" G_GUINT64_FORMAT " didn't work. Iterating there...",
- offset);
+ "seek to %" G_GUINT64_FORMAT " didn't work. Iterating there...",
+ offset);
}
} else if (iter->just_seeked) {
iter->just_seeked = FALSE;
while (TRUE) {
if (g_queue_is_empty (iter->buffers)) {
if (iter->eos)
- return FALSE;
+ return FALSE;
if (gst_gdk_animation_get_more_buffers (iter))
- continue;
+ continue;
break;
}
if (GST_BUFFER_TIMESTAMP (g_queue_peek_head (iter->buffers)) > offset)
break;
if (buffer) {
GST_LOG_OBJECT (iter, "unreffing buffer %p, because timestamp too low (%"
- G_GUINT64_FORMAT " vs %" G_GUINT64_FORMAT ")",
- buffer, GST_BUFFER_TIMESTAMP (buffer), offset);
+ G_GUINT64_FORMAT " vs %" G_GUINT64_FORMAT ")",
+ buffer, GST_BUFFER_TIMESTAMP (buffer), offset);
gst_data_unref (GST_DATA (buffer));
}
buffer = GST_BUFFER (g_queue_pop_head (iter->buffers));
return -1;
}
if (!gst_gdk_animation_get_more_buffers (iter))
- return -1; /* FIXME? */
+ return -1; /* FIXME? */
}
delay =
GST_LOG_OBJECT (ani, "trying to create pixbuf");
g_get_current_time (&tv);
iter =
- GST_GDK_ANIMATION_ITER (gdk_pixbuf_animation_get_iter (animation, &tv));
+ GST_GDK_ANIMATION_ITER (gdk_pixbuf_animation_get_iter (animation, &tv));
if (iter) {
guint64 offset;
GstBuffer *buf;
GstFormat time = GST_FORMAT_TIME;
if (!gst_element_query (gst_bin_get_by_name (GST_BIN (iter->pipeline),
- "sink"), GST_QUERY_TOTAL, &time, &offset)) {
- offset = 0;
+ "sink"), GST_QUERY_TOTAL, &time, &offset)) {
+ offset = 0;
}
if (offset > 120 * GST_SECOND) {
- offset = 120 * GST_SECOND;
+ offset = 120 * GST_SECOND;
} else if (offset < 120 * GST_SECOND && offset >= 10 * GST_SECOND) {
- offset = offset / 2;
+ offset = offset / 2;
}
g_assert (time == GST_FORMAT_TIME);
GST_LOG_OBJECT (ani,
- "using time offset %" G_GUINT64_FORMAT " for creating static image",
- offset);
+ "using time offset %" G_GUINT64_FORMAT " for creating static image",
+ offset);
while ((buf = g_queue_pop_head (iter->buffers)) != NULL) {
- gst_data_unref (GST_DATA (buf));
+ gst_data_unref (GST_DATA (buf));
}
/* now we do evil stuff, be sure to get rid of the iterator afterwards */
if (!gst_element_send_event (gst_bin_get_by_name (GST_BIN (iter->
- pipeline), "sink"),
- gst_event_new_seek (GST_FORMAT_TIME | GST_SEEK_METHOD_SET |
- GST_SEEK_FLAG_FLUSH | GST_SEEK_FLAG_ACCURATE, offset))) {
- GST_INFO_OBJECT (ani, "seeking didn't work. Using next image");
+ pipeline), "sink"),
+ gst_event_new_seek (GST_FORMAT_TIME | GST_SEEK_METHOD_SET |
+ GST_SEEK_FLAG_FLUSH | GST_SEEK_FLAG_ACCURATE, offset))) {
+ GST_INFO_OBJECT (ani, "seeking didn't work. Using next image");
}
do {
- if (g_queue_is_empty (iter->buffers)) {
- if (iter->eos)
- return FALSE;
- if (gst_gdk_animation_get_more_buffers (iter))
- continue;
- }
+ if (g_queue_is_empty (iter->buffers)) {
+ if (iter->eos)
+ return FALSE;
+ if (gst_gdk_animation_get_more_buffers (iter))
+ continue;
+ }
} while (FALSE);
if (!g_queue_is_empty (iter->buffers)) {
- gst_gdk_animation_iter_create_pixbuf (iter);
- ani->pixbuf =
- gst_gdk_animation_iter_get_pixbuf (GDK_PIXBUF_ANIMATION_ITER
- (iter));
- g_object_ref (ani->pixbuf);
+ gst_gdk_animation_iter_create_pixbuf (iter);
+ ani->pixbuf =
+ gst_gdk_animation_iter_get_pixbuf (GDK_PIXBUF_ANIMATION_ITER
+ (iter));
+ g_object_ref (ani->pixbuf);
} else {
- g_assert (ani->pixbuf == NULL);
+ g_assert (ani->pixbuf == NULL);
}
/* DiE iterator, DiE */
g_object_unref (iter);
GST_PAD_SINK,
GST_PAD_ALWAYS,
GST_STATIC_CAPS ("image/png; "
- "image/jpeg; "
- "image/gif; "
- "image/x-icon; "
- "application/x-navi-animation; "
- "image/x-cmu-raster; "
- "image/x-sun-raster; "
- "image/x-pixmap; "
- "image/tiff; "
- "image/x-portable-anymap; "
- "image/x-portable-bitmap; "
- "image/x-portable-graymap; "
- "image/x-portable-pixmap; "
- "image/bmp; "
- "image/x-bmp; "
- "image/x-MS-bmp; "
- "image/vnd.wap.wbmp; " "image/x-bitmap; " "image/x-tga")
+ "image/jpeg; "
+ "image/gif; "
+ "image/x-icon; "
+ "application/x-navi-animation; "
+ "image/x-cmu-raster; "
+ "image/x-sun-raster; "
+ "image/x-pixmap; "
+ "image/tiff; "
+ "image/x-portable-anymap; "
+ "image/x-portable-bitmap; "
+ "image/x-portable-graymap; "
+ "image/x-portable-pixmap; "
+ "image/bmp; "
+ "image/x-bmp; "
+ "image/x-MS-bmp; "
+ "image/vnd.wap.wbmp; " "image/x-bitmap; " "image/x-tga")
);
static GstStaticPadTemplate gst_gdk_pixbuf_src_template =
gst_gdk_pixbuf_get_capslist (void)
{
return gst_caps_copy (gst_static_caps_get (&gst_gdk_pixbuf_sink_template.
- static_caps));
+ static_caps));
}
#else
static GstCaps *
0,
(GInstanceInitFunc) gst_gdk_pixbuf_init,
};
+
plugin_type = g_type_register_static (GST_TYPE_ELEMENT,
- "GstGdkPixbuf", &plugin_info, 0);
+ "GstGdkPixbuf", &plugin_info, 0);
}
return plugin_type;
}
g_object_class_install_property (gobject_class, ARG_SILENT,
g_param_spec_boolean ("silent", "Silent", "Produce verbose output ?",
- FALSE, G_PARAM_READWRITE));
+ FALSE, G_PARAM_READWRITE));
gobject_class->set_property = gst_gdk_pixbuf_set_property;
gobject_class->get_property = gst_gdk_pixbuf_get_property;
switch (GST_EVENT_TYPE (event)) {
case GST_EVENT_EOS:
- push_buffer = TRUE;
- got_eos = TRUE;
- break;
+ push_buffer = TRUE;
+ got_eos = TRUE;
+ break;
case GST_EVENT_DISCONTINUOUS:
- dump_buffer = TRUE;
- break;
+ dump_buffer = TRUE;
+ break;
default:
- gst_pad_event_default (pad, event);
- return;
+ gst_pad_event_default (pad, event);
+ return;
}
}
GError *error = NULL;
if (!gdk_pixbuf_loader_close (filter->pixbuf_loader, &error)) {
- GST_ELEMENT_ERROR (filter, LIBRARY, SHUTDOWN, (NULL), (error->message));
- g_error_free (error);
- return;
+ GST_ELEMENT_ERROR (filter, LIBRARY, SHUTDOWN, (NULL), (error->message));
+ g_error_free (error);
+ return;
}
pixbuf = gdk_pixbuf_loader_get_pixbuf (filter->pixbuf_loader);
if (filter->image_size == 0) {
- GstCaps *caps;
+ GstCaps *caps;
- filter->width = gdk_pixbuf_get_width (pixbuf);
- filter->height = gdk_pixbuf_get_height (pixbuf);
- filter->rowstride = gdk_pixbuf_get_rowstride (pixbuf);
- filter->image_size = filter->rowstride * filter->height;
+ filter->width = gdk_pixbuf_get_width (pixbuf);
+ filter->height = gdk_pixbuf_get_height (pixbuf);
+ filter->rowstride = gdk_pixbuf_get_rowstride (pixbuf);
+ filter->image_size = filter->rowstride * filter->height;
- caps = gst_caps_copy (gst_pad_get_pad_template_caps (filter->srcpad));
- gst_caps_set_simple (caps,
- "width", G_TYPE_INT, filter->width,
- "height", G_TYPE_INT, filter->height,
- "framerate", G_TYPE_DOUBLE, filter->framerate, NULL);
+ caps = gst_caps_copy (gst_pad_get_pad_template_caps (filter->srcpad));
+ gst_caps_set_simple (caps,
+ "width", G_TYPE_INT, filter->width,
+ "height", G_TYPE_INT, filter->height,
+ "framerate", G_TYPE_DOUBLE, filter->framerate, NULL);
- gst_pad_set_explicit_caps (filter->srcpad, caps);
+ gst_pad_set_explicit_caps (filter->srcpad, caps);
}
outbuf = gst_pad_alloc_buffer (filter->srcpad, GST_BUFFER_OFFSET_NONE,
- filter->image_size);
+ filter->image_size);
GST_BUFFER_TIMESTAMP (outbuf) = GST_BUFFER_TIMESTAMP (buf);
GST_BUFFER_DURATION (outbuf) = GST_BUFFER_DURATION (buf);
memcpy (GST_BUFFER_DATA (outbuf), gdk_pixbuf_get_pixels (pixbuf),
- filter->image_size);
+ filter->image_size);
gst_pad_push (filter->srcpad, GST_DATA (outbuf));
}
gdk_pixbuf_loader_write (filter->pixbuf_loader, GST_BUFFER_DATA (buf),
- GST_BUFFER_SIZE (buf), &error);
+ GST_BUFFER_SIZE (buf), &error);
gst_buffer_unref (buf);
}
"gdk pixbuf loader");
if (!gst_element_register (plugin, "gdkpixbufdec", GST_RANK_NONE,
- GST_TYPE_GDK_PIXBUF))
+ GST_TYPE_GDK_PIXBUF))
return FALSE;
#ifdef enable_typefind
plugin_init (GstPlugin * plugin)
{
if (!gst_element_register (plugin, "jpegenc", GST_RANK_NONE,
- GST_TYPE_JPEGENC))
+ GST_TYPE_JPEGENC))
return FALSE;
if (!gst_element_register (plugin, "jpegdec", GST_RANK_PRIMARY,
- GST_TYPE_JPEGDEC))
+ GST_TYPE_JPEGDEC))
return FALSE;
return TRUE;
0,
(GInstanceInitFunc) gst_jpegdec_init,
};
+
jpegdec_type =
- g_type_register_static (GST_TYPE_ELEMENT, "GstJpegDec", &jpegdec_info,
- 0);
+ g_type_register_static (GST_TYPE_ELEMENT, "GstJpegDec", &jpegdec_info,
+ 0);
}
return jpegdec_type;
}
GST_PAD_SINK,
GST_PAD_ALWAYS,
GST_STATIC_CAPS ("image/jpeg, "
- "width = (int) [ 16, 4096 ], "
- "height = (int) [ 16, 4096 ], " "framerate = (double) [ 1, MAX ]")
+ "width = (int) [ 16, 4096 ], "
+ "height = (int) [ 16, 4096 ], " "framerate = (double) [ 1, MAX ]")
);
static void
jpegdec->height = height;
caps = gst_caps_new_simple ("video/x-raw-yuv",
- "format", GST_TYPE_FOURCC, GST_MAKE_FOURCC ('I', '4', '2', '0'),
- "width", G_TYPE_INT, width,
- "height", G_TYPE_INT, height,
- "framerate", G_TYPE_DOUBLE, jpegdec->fps, NULL);
+ "format", GST_TYPE_FOURCC, GST_MAKE_FOURCC ('I', '4', '2', '0'),
+ "width", G_TYPE_INT, width,
+ "height", G_TYPE_INT, height,
+ "framerate", G_TYPE_DOUBLE, jpegdec->fps, NULL);
gst_pad_set_explicit_caps (jpegdec->srcpad, caps);
gst_caps_free (caps);
}
jpegdec->line[0][j] = base[0];
base[0] += width;
if (r_v == 2) {
- jpegdec->line[0][j + 1] = base[0];
- base[0] += width;
+ jpegdec->line[0][j + 1] = base[0];
+ base[0] += width;
}
jpegdec->line[1][k] = base[1];
jpegdec->line[2][k] = base[2];
if (r_v == 2 || k & 1) {
- base[1] += width2;
- base[2] += width2;
+ base[1] += width2;
+ base[2] += width2;
}
}
/*g_print ("%d\n", jpegdec->cinfo.output_scanline); */
0,
(GInstanceInitFunc) gst_jpegenc_init,
};
+
jpegenc_type =
- g_type_register_static (GST_TYPE_ELEMENT, "GstJpegEnc", &jpegenc_info,
- 0);
+ g_type_register_static (GST_TYPE_ELEMENT, "GstJpegEnc", &jpegenc_info,
+ 0);
}
return jpegenc_type;
}
GST_PAD_SRC,
GST_PAD_ALWAYS,
GST_STATIC_CAPS ("image/jpeg, "
- "width = (int) [ 16, 4096 ], "
- "height = (int) [ 16, 4096 ], " "framerate = (double) [ 1, MAX ]")
+ "width = (int) [ 16, 4096 ], "
+ "height = (int) [ 16, 4096 ], " "framerate = (double) [ 1, MAX ]")
);
static void
g_object_class_install_property (gobject_class, ARG_QUALITY,
g_param_spec_int ("quality", "Quality", "Quality of encoding",
- 0, 100, 85, G_PARAM_READWRITE));
+ 0, 100, 85, G_PARAM_READWRITE));
#if 0
/* disabled, since it doesn't seem to work */
g_object_class_install_property (gobject_class, ARG_SMOOTHING,
g_param_spec_int ("smoothing", "Smoothing", "Smoothing factor",
- 0, 100, 0, G_PARAM_READWRITE));
+ 0, 100, 0, G_PARAM_READWRITE));
#endif
gobject_class->set_property = gst_jpegenc_set_property;
jpegenc->cinfo.comp_info[2].v_samp_factor = 1;
if (height != -1) {
- jpegenc->line[0] =
- g_realloc (jpegenc->line[0], height * sizeof (char *));
- jpegenc->line[1] =
- g_realloc (jpegenc->line[1], height * sizeof (char *) / 2);
- jpegenc->line[2] =
- g_realloc (jpegenc->line[2], height * sizeof (char *) / 2);
+ jpegenc->line[0] =
+ g_realloc (jpegenc->line[0], height * sizeof (char *));
+ jpegenc->line[1] =
+ g_realloc (jpegenc->line[1], height * sizeof (char *) / 2);
+ jpegenc->line[2] =
+ g_realloc (jpegenc->line[2], height * sizeof (char *) / 2);
}
GST_DEBUG ("gst_jpegenc_resync: setting format done");
#include <gst/audio/audio.h>
#include "gstladspa.h"
-#include <ladspa.h> /* main ladspa sdk include file */
-#include "utils.h" /* ladspa sdk utility functions */
+#include <ladspa.h> /* main ladspa sdk include file */
+#include "utils.h" /* ladspa sdk utility functions */
/* 1.0 and the 1.1 preliminary headers don't define a version, but 1.1 final
does */
/* the factories take ownership of the name */
if (LADSPA_IS_PORT_INPUT (desc->PortDescriptors[j])) {
- templ = gst_pad_template_new (name, GST_PAD_SINK, GST_PAD_ALWAYS,
- gst_caps_copy (gst_static_caps_get (&ladspa_pad_caps)));
- klass->numsinkpads++;
+ templ = gst_pad_template_new (name, GST_PAD_SINK, GST_PAD_ALWAYS,
+ gst_caps_copy (gst_static_caps_get (&ladspa_pad_caps)));
+ klass->numsinkpads++;
} else {
- templ = gst_pad_template_new (name, GST_PAD_SRC, GST_PAD_ALWAYS,
- gst_caps_copy (gst_static_caps_get (&ladspa_pad_caps)));
- klass->numsrcpads++;
+ templ = gst_pad_template_new (name, GST_PAD_SRC, GST_PAD_ALWAYS,
+ gst_caps_copy (gst_static_caps_get (&ladspa_pad_caps)));
+ klass->numsrcpads++;
}
gst_element_class_add_pad_template (element_class, templ);
else if ((klass->numsinkpads > 0) && (klass->numsrcpads == 0))
details->klass = "Sink/Audio/LADSPA";
else
- details->klass = "Filter/Effect/Audio/LADSPA"; /* whatever this is */
+ details->klass = "Filter/Effect/Audio/LADSPA"; /* whatever this is */
gst_element_class_set_details (element_class, details);
klass->srcpad_portnums = g_new0 (gint, klass->numsrcpads);
for (j = 0; j < desc->PortCount; j++) {
if (LADSPA_IS_PORT_AUDIO (desc->PortDescriptors[j])) {
if (LADSPA_IS_PORT_INPUT (desc->PortDescriptors[j]))
- klass->sinkpad_portnums[sinkcount++] = j;
+ klass->sinkpad_portnums[sinkcount++] = j;
else
- klass->srcpad_portnums[srccount++] = j;
+ klass->srcpad_portnums[srccount++] = j;
}
}
/* walk through the ports, count the input, output and control ports */
for (i = 0; i < desc->PortCount; i++) {
if (!LADSPA_IS_PORT_AUDIO (desc->PortDescriptors[i]) &&
- LADSPA_IS_PORT_INPUT (desc->PortDescriptors[i]))
+ LADSPA_IS_PORT_INPUT (desc->PortDescriptors[i]))
klass->numcontrols++;
}
/* walk through the ports, note the portnums for control params */
for (i = 0; i < desc->PortCount; i++) {
if (!LADSPA_IS_PORT_AUDIO (desc->PortDescriptors[i]) &&
- LADSPA_IS_PORT_INPUT (desc->PortDescriptors[i]))
+ LADSPA_IS_PORT_INPUT (desc->PortDescriptors[i]))
klass->control_portnums[controlcount++] = i;
}
if (LADSPA_IS_HINT_BOUNDED_BELOW (hintdesc)) {
klass->control_info[i].lower = TRUE;
klass->control_info[i].lowerbound =
- desc->PortRangeHints[current_portnum].LowerBound;
+ desc->PortRangeHints[current_portnum].LowerBound;
} else {
if (argtype == G_TYPE_INT)
- klass->control_info[i].lowerbound = (gfloat) G_MININT;
+ klass->control_info[i].lowerbound = (gfloat) G_MININT;
if (argtype == G_TYPE_FLOAT)
- klass->control_info[i].lowerbound = -G_MAXFLOAT;
+ klass->control_info[i].lowerbound = -G_MAXFLOAT;
}
if (LADSPA_IS_HINT_BOUNDED_ABOVE (hintdesc)) {
klass->control_info[i].upper = TRUE;
klass->control_info[i].upperbound =
- desc->PortRangeHints[current_portnum].UpperBound;
+ desc->PortRangeHints[current_portnum].UpperBound;
if (LADSPA_IS_HINT_SAMPLE_RATE (hintdesc)) {
- klass->control_info[i].samplerate = TRUE;
- klass->control_info[i].upperbound *= 44100; /* FIXME? */
+ klass->control_info[i].samplerate = TRUE;
+ klass->control_info[i].upperbound *= 44100; /* FIXME? */
}
} else {
if (argtype == G_TYPE_INT)
- klass->control_info[i].upperbound = (gfloat) G_MAXINT;
+ klass->control_info[i].upperbound = (gfloat) G_MAXINT;
if (argtype == G_TYPE_FLOAT)
- klass->control_info[i].upperbound = G_MAXFLOAT;
+ klass->control_info[i].upperbound = G_MAXFLOAT;
}
/* use the lowerbound as the default value */
/* figure out the defaults */
if (LADSPA_IS_HINT_HAS_DEFAULT (hintdesc)) {
if (LADSPA_IS_HINT_DEFAULT_MINIMUM (hintdesc))
- klass->control_info[i].def = klass->control_info[i].lowerbound;
+ klass->control_info[i].def = klass->control_info[i].lowerbound;
else if (LADSPA_IS_HINT_DEFAULT_LOW (hintdesc))
- if (LADSPA_IS_HINT_LOGARITHMIC (hintdesc))
- klass->control_info[i].def =
- exp (0.75 * log (klass->control_info[i].lowerbound) +
- 0.25 * log (klass->control_info[i].upperbound));
- else
- klass->control_info[i].def =
- (0.75 * klass->control_info[i].lowerbound +
- 0.25 * klass->control_info[i].upperbound);
+ if (LADSPA_IS_HINT_LOGARITHMIC (hintdesc))
+ klass->control_info[i].def =
+ exp (0.75 * log (klass->control_info[i].lowerbound) +
+ 0.25 * log (klass->control_info[i].upperbound));
+ else
+ klass->control_info[i].def =
+ (0.75 * klass->control_info[i].lowerbound +
+ 0.25 * klass->control_info[i].upperbound);
else if (LADSPA_IS_HINT_DEFAULT_MIDDLE (hintdesc))
- if (LADSPA_IS_HINT_LOGARITHMIC (hintdesc))
- klass->control_info[i].def =
- exp (0.5 * log (klass->control_info[i].lowerbound) +
- 0.5 * log (klass->control_info[i].upperbound));
- else
- klass->control_info[i].def =
- (0.5 * klass->control_info[i].lowerbound +
- 0.5 * klass->control_info[i].upperbound);
+ if (LADSPA_IS_HINT_LOGARITHMIC (hintdesc))
+ klass->control_info[i].def =
+ exp (0.5 * log (klass->control_info[i].lowerbound) +
+ 0.5 * log (klass->control_info[i].upperbound));
+ else
+ klass->control_info[i].def =
+ (0.5 * klass->control_info[i].lowerbound +
+ 0.5 * klass->control_info[i].upperbound);
else if (LADSPA_IS_HINT_DEFAULT_HIGH (hintdesc))
- if (LADSPA_IS_HINT_LOGARITHMIC (hintdesc))
- klass->control_info[i].def =
- exp (0.25 * log (klass->control_info[i].lowerbound) +
- 0.75 * log (klass->control_info[i].upperbound));
- else
- klass->control_info[i].def =
- (0.25 * klass->control_info[i].lowerbound +
- 0.75 * klass->control_info[i].upperbound);
+ if (LADSPA_IS_HINT_LOGARITHMIC (hintdesc))
+ klass->control_info[i].def =
+ exp (0.25 * log (klass->control_info[i].lowerbound) +
+ 0.75 * log (klass->control_info[i].upperbound));
+ else
+ klass->control_info[i].def =
+ (0.25 * klass->control_info[i].lowerbound +
+ 0.75 * klass->control_info[i].upperbound);
else if (LADSPA_IS_HINT_DEFAULT_MAXIMUM (hintdesc))
- klass->control_info[i].def = klass->control_info[i].upperbound;
+ klass->control_info[i].def = klass->control_info[i].upperbound;
else if (LADSPA_IS_HINT_DEFAULT_0 (hintdesc))
- klass->control_info[i].def = 0.0;
+ klass->control_info[i].def = 0.0;
else if (LADSPA_IS_HINT_DEFAULT_1 (hintdesc))
- klass->control_info[i].def = 1.0;
+ klass->control_info[i].def = 1.0;
else if (LADSPA_IS_HINT_DEFAULT_100 (hintdesc))
- klass->control_info[i].def = 100.0;
+ klass->control_info[i].def = 100.0;
else if (LADSPA_IS_HINT_DEFAULT_440 (hintdesc))
- klass->control_info[i].def = 440.0;
+ klass->control_info[i].def = 440.0;
}
#endif /* LADSPA_IS_HINT_HAS_DEFAULT */
klass->control_info[i].def = CLAMP (klass->control_info[i].def,
- klass->control_info[i].lowerbound, klass->control_info[i].upperbound);
+ klass->control_info[i].lowerbound, klass->control_info[i].upperbound);
if (LADSPA_IS_PORT_INPUT (desc->PortDescriptors[current_portnum])) {
argperms = G_PARAM_READWRITE;
g_strcanon (argname, G_CSET_A_2_Z G_CSET_a_2_z G_CSET_DIGITS "-", '-');
/* satisfy glib2 (argname[0] must be [A-Za-z]) */
if (!((argname[0] >= 'a' && argname[0] <= 'z') || (argname[0] >= 'A'
- && argname[0] <= 'Z'))) {
+ && argname[0] <= 'Z'))) {
tempstr = argname;
argname = g_strconcat ("param-", argname, NULL);
g_free (tempstr);
gchar *numargname = g_strdup_printf ("%s_%d", argname, numarg++);
while (g_object_class_find_property (G_OBJECT_CLASS (klass),
- numargname) != NULL) {
- g_free (numargname);
- numargname = g_strdup_printf ("%s_%d", argname, numarg++);
+ numargname) != NULL) {
+ g_free (numargname);
+ numargname = g_strdup_printf ("%s_%d", argname, numarg++);
}
argname = numargname;
}
if (argtype == G_TYPE_BOOLEAN) {
paramspec =
- g_param_spec_boolean (argname, argname, argname, FALSE, argperms);
+ g_param_spec_boolean (argname, argname, argname, FALSE, argperms);
} else if (argtype == G_TYPE_INT) {
paramspec = g_param_spec_int (argname, argname, argname,
- (gint) klass->control_info[i].lowerbound,
- (gint) klass->control_info[i].upperbound,
- (gint) klass->control_info[i].def, argperms);
+ (gint) klass->control_info[i].lowerbound,
+ (gint) klass->control_info[i].upperbound,
+ (gint) klass->control_info[i].def, argperms);
} else if (klass->control_info[i].samplerate) {
paramspec = g_param_spec_float (argname, argname, argname,
- 0.0, G_MAXFLOAT, 0.0, argperms);
+ 0.0, G_MAXFLOAT, 0.0, argperms);
} else {
paramspec = g_param_spec_float (argname, argname, argname,
- klass->control_info[i].lowerbound, klass->control_info[i].upperbound,
- klass->control_info[i].def, argperms);
+ klass->control_info[i].lowerbound, klass->control_info[i].upperbound,
+ klass->control_info[i].def, argperms);
}
/* properties have an offset of 1 */
srccount = 0;
for (l = GST_ELEMENT_CLASS (oclass)->padtemplates; l; l = l->next) {
GstPad *pad = gst_pad_new_from_template (GST_PAD_TEMPLATE (l->data),
- GST_PAD_TEMPLATE_NAME_TEMPLATE (l->data));
+ GST_PAD_TEMPLATE_NAME_TEMPLATE (l->data));
gst_pad_set_link_function (pad, gst_ladspa_link);
gst_element_add_pad ((GstElement *) ladspa, pad);
ladspa->controls[i] = cinfo.def;
if (cinfo.toggled) {
- gst_dpman_add_required_dparam_callback (ladspa->dpman,
- g_param_spec_int (cinfo.param_name, cinfo.name, cinfo.name,
- 0, 1, (gint) (ladspa->controls[i]), G_PARAM_READWRITE),
- "int", gst_ladspa_update_int, &(ladspa->controls[i])
- );
+ gst_dpman_add_required_dparam_callback (ladspa->dpman,
+ g_param_spec_int (cinfo.param_name, cinfo.name, cinfo.name,
+ 0, 1, (gint) (ladspa->controls[i]), G_PARAM_READWRITE),
+ "int", gst_ladspa_update_int, &(ladspa->controls[i])
+ );
} else if (cinfo.integer) {
- gst_dpman_add_required_dparam_callback (ladspa->dpman,
- g_param_spec_int (cinfo.param_name, cinfo.name, cinfo.name,
- (gint) cinfo.lowerbound, (gint) cinfo.upperbound,
- (gint) ladspa->controls[i], G_PARAM_READWRITE),
- "int", gst_ladspa_update_int, &(ladspa->controls[i])
- );
+ gst_dpman_add_required_dparam_callback (ladspa->dpman,
+ g_param_spec_int (cinfo.param_name, cinfo.name, cinfo.name,
+ (gint) cinfo.lowerbound, (gint) cinfo.upperbound,
+ (gint) ladspa->controls[i], G_PARAM_READWRITE),
+ "int", gst_ladspa_update_int, &(ladspa->controls[i])
+ );
} else if (cinfo.samplerate) {
- gst_dpman_add_required_dparam_direct (ladspa->dpman,
- g_param_spec_float (cinfo.param_name, cinfo.name, cinfo.name,
- cinfo.lowerbound, cinfo.upperbound,
- ladspa->controls[i], G_PARAM_READWRITE),
- "hertz-rate-bound", &(ladspa->controls[i])
- );
+ gst_dpman_add_required_dparam_direct (ladspa->dpman,
+ g_param_spec_float (cinfo.param_name, cinfo.name, cinfo.name,
+ cinfo.lowerbound, cinfo.upperbound,
+ ladspa->controls[i], G_PARAM_READWRITE),
+ "hertz-rate-bound", &(ladspa->controls[i])
+ );
} else {
- gst_dpman_add_required_dparam_direct (ladspa->dpman,
- g_param_spec_float (cinfo.param_name, cinfo.name, cinfo.name,
- cinfo.lowerbound, cinfo.upperbound,
- ladspa->controls[i], G_PARAM_READWRITE),
- "float", &(ladspa->controls[i])
- );
+ gst_dpman_add_required_dparam_direct (ladspa->dpman,
+ g_param_spec_float (cinfo.param_name, cinfo.name, cinfo.name,
+ cinfo.lowerbound, cinfo.upperbound,
+ ladspa->controls[i], G_PARAM_READWRITE),
+ "float", &(ladspa->controls[i])
+ );
}
}
}
/* nonzero default needed to instantiate() some plugins */
ladspa->samplerate = 44100;
- ladspa->buffer_frames = 0; /* should be set with caps */
+ ladspa->buffer_frames = 0; /* should be set with caps */
ladspa->activated = FALSE;
ladspa->inplace_broken =
LADSPA_IS_INPLACE_BROKEN (ladspa->descriptor->Properties);
} else if (sinkcount > 1) {
/* more than one sink pad needs loop mode */
DEBUG_OBJ (ladspa, "loop mode with %d sink pads and %d src pads", sinkcount,
- srccount);
+ srccount);
gst_element_set_loop_function (GST_ELEMENT (ladspa), gst_ladspa_loop);
} else if (sinkcount == 0 && srccount == 0) {
* it for now */
} else {
g_warning ("%d sink pads, %d src pads not yet supported", sinkcount,
- srccount);
+ srccount);
}
gst_ladspa_instantiate (ladspa);
for (l = gst_element_get_pad_list (element); l; l = l->next)
if (pad != (GstPad *) l->data)
if (gst_pad_try_set_caps ((GstPad *) l->data, caps) <= 0)
- return GST_PAD_LINK_REFUSED;
+ return GST_PAD_LINK_REFUSED;
/* we assume that the ladspa plugin can handle any sample rate, so this
check gets put last */
gst_ladspa_force_src_caps (GstLADSPA * ladspa, GstPad * pad)
{
if (!ladspa->buffer_frames) {
- ladspa->buffer_frames = 256; /* 5 ms at 44100 kHz (just a default...) */
+ ladspa->buffer_frames = 256; /* 5 ms at 44100 kHz (just a default...) */
}
DEBUG_OBJ (ladspa, "forcing caps with rate=%d, buffer-frames=%d",
gst_pad_try_set_caps (pad,
gst_caps_new ("ladspa_src_caps",
- "audio/x-raw-float",
- gst_props_new ("width", G_TYPE_INT (32),
- "endianness", G_TYPE_INT (G_BYTE_ORDER),
- "rate", G_TYPE_INT (ladspa->samplerate),
- "buffer-frames", G_TYPE_INT (ladspa->buffer_frames),
- "channels", G_TYPE_INT (1), NULL)));
+ "audio/x-raw-float",
+ gst_props_new ("width", G_TYPE_INT (32),
+ "endianness", G_TYPE_INT (G_BYTE_ORDER),
+ "rate", G_TYPE_INT (ladspa->samplerate),
+ "buffer-frames", G_TYPE_INT (ladspa->buffer_frames),
+ "channels", G_TYPE_INT (1), NULL)));
}
#endif
/* connect the control ports */
for (i = 0; i < oclass->numcontrols; i++)
desc->connect_port (ladspa->handle,
- oclass->control_portnums[i], &(ladspa->controls[i]));
+ oclass->control_portnums[i], &(ladspa->controls[i]));
/* reactivate if it was activated before the reinstantiation */
if (was_activated)
/* push it out on all pads */
gst_data_ref_by_count ((GstData *) buffers_in[i], numsrcpads);
for (j = 0; j < numsrcpads; j++)
- gst_pad_push (ladspa->srcpads[j], GST_DATA (buffers_in[i]));
+ gst_pad_push (ladspa->srcpads[j], GST_DATA (buffers_in[i]));
if (GST_EVENT_TYPE (buffers_in[i]) == GST_EVENT_EOS) {
- /* shut down */
- gst_element_set_eos (element);
- return;
+ /* shut down */
+ gst_element_set_eos (element);
+ return;
} else {
- goto get_buffer;
+ goto get_buffer;
}
}
largest_buffer = GST_BUFFER_SIZE (buffers_in[i]) / sizeof (gfloat);
else
largest_buffer =
- MIN (GST_BUFFER_SIZE (buffers_in[i]) / sizeof (gfloat),
- largest_buffer);
+ MIN (GST_BUFFER_SIZE (buffers_in[i]) / sizeof (gfloat),
+ largest_buffer);
data_in[i] = (LADSPA_Data *) GST_BUFFER_DATA (buffers_in[i]);
GST_BUFFER_TIMESTAMP (buffers_in[i]) = ladspa->timestamp;
}
}
for (; i < numsrcpads; i++) {
buffers_out[i] =
- gst_buffer_new_and_alloc (ladspa->buffer_frames * sizeof (gfloat));
+ gst_buffer_new_and_alloc (ladspa->buffer_frames * sizeof (gfloat));
GST_BUFFER_TIMESTAMP (buffers_out[i]) = ladspa->timestamp;
data_out[i] = (LADSPA_Data *) GST_BUFFER_DATA (buffers_out[i]);
}
for (i = 0; i < numsinkpads; i++)
desc->connect_port (ladspa->handle, oclass->sinkpad_portnums[i],
- data_in[i]);
+ data_in[i]);
for (i = 0; i < numsrcpads; i++)
desc->connect_port (ladspa->handle, oclass->srcpad_portnums[i],
- data_out[i]);
+ data_out[i]);
desc->run (ladspa->handle, num_to_process);
desc->connect_port (ladspa->handle, oclass->sinkpad_portnums[0], data_in);
for (i = 0; i < numsrcpads; i++)
desc->connect_port (ladspa->handle, oclass->srcpad_portnums[i],
- data_out[i]);
+ data_out[i]);
desc->run (ladspa->handle, num_to_process);
if (numsrcpads) {
for (i = 0; i < numsrcpads; i++) {
DEBUG_OBJ (ladspa, "pushing buffer (%p, length %u bytes) on src pad %d",
- buffers_out[i], GST_BUFFER_SIZE (buffers_out[i]), i);
+ buffers_out[i], GST_BUFFER_SIZE (buffers_out[i]), i);
gst_pad_push (ladspa->srcpads[i], GST_DATA (buffers_out[i]));
}
/* base-init temp alloc */
g_hash_table_insert (ladspa_descriptors,
- GINT_TO_POINTER (0), (gpointer) desc);
+ GINT_TO_POINTER (0), (gpointer) desc);
/* create the type now */
type = g_type_register_static (GST_TYPE_ELEMENT, type_name, &typeinfo, 0);
/* add this plugin to the hash */
g_hash_table_insert (ladspa_descriptors,
- GINT_TO_POINTER (type), (gpointer) desc);
+ GINT_TO_POINTER (type), (gpointer) desc);
}
g_hash_table_remove (ladspa_descriptors, GINT_TO_POINTER (0));
*/
pcLADSPAPath = g_strdup_printf ("%s:/usr/lib/ladspa:/usr/local/lib/ladspa",
- getenv ("LADSPA_PATH"));
+ getenv ("LADSPA_PATH"));
if (pcLADSPAPath) {
pcStart = pcLADSPAPath;
while (*pcStart != '\0') {
- pcEnd = pcStart;
- while (*pcEnd != ':' && *pcEnd != '\0')
- pcEnd++;
-
- pcBuffer = malloc (iFilenameLength + 2 + (pcEnd - pcStart));
- if (pcEnd > pcStart)
- strncpy (pcBuffer, pcStart, pcEnd - pcStart);
- iNeedSlash = 0;
- if (pcEnd > pcStart)
- if (*(pcEnd - 1) != '/') {
- iNeedSlash = 1;
- pcBuffer[pcEnd - pcStart] = '/';
- }
- strcpy (pcBuffer + iNeedSlash + (pcEnd - pcStart), pcFilename);
-
- pvResult = dlopen (pcBuffer, iFlag);
-
- free (pcBuffer);
- if (pvResult != NULL)
- return pvResult;
-
- pcStart = pcEnd;
- if (*pcStart == ':')
- pcStart++;
+ pcEnd = pcStart;
+ while (*pcEnd != ':' && *pcEnd != '\0')
+ pcEnd++;
+
+ pcBuffer = malloc (iFilenameLength + 2 + (pcEnd - pcStart));
+ if (pcEnd > pcStart)
+ strncpy (pcBuffer, pcStart, pcEnd - pcStart);
+ iNeedSlash = 0;
+ if (pcEnd > pcStart)
+ if (*(pcEnd - 1) != '/') {
+ iNeedSlash = 1;
+ pcBuffer[pcEnd - pcStart] = '/';
+ }
+ strcpy (pcBuffer + iNeedSlash + (pcEnd - pcStart), pcFilename);
+
+ pvResult = dlopen (pcBuffer, iFlag);
+
+ free (pcBuffer);
+ if (pvResult != NULL)
+ return pvResult;
+
+ pcStart = pcEnd;
+ if (*pcStart == ':')
+ pcStart++;
}
}
}
pvPluginHandle = dlopenLADSPA (pcPluginFilename, RTLD_NOW);
if (!pvPluginHandle) {
fprintf (stderr,
- "Failed to load plugin \"%s\": %s\n", pcPluginFilename, dlerror ());
+ "Failed to load plugin \"%s\": %s\n", pcPluginFilename, dlerror ());
exit (1);
}
if (pcError) {
fprintf (stderr,
- "Unable to find ladspa_descriptor() function in plugin "
- "library file \"%s\": %s.\n"
- "Are you sure this is a LADSPA plugin file?\n",
- pcPluginLibraryFilename, pcError);
+ "Unable to find ladspa_descriptor() function in plugin "
+ "library file \"%s\": %s.\n"
+ "Are you sure this is a LADSPA plugin file?\n",
+ pcPluginLibraryFilename, pcError);
exit (1);
}
}
psDescriptor = pfDescriptorFunction (lPluginIndex);
if (psDescriptor == NULL) {
fprintf (stderr,
- "Unable to find label \"%s\" in plugin library file \"%s\".\n",
- pcPluginLabel, pcPluginLibraryFilename);
+ "Unable to find label \"%s\" in plugin library file \"%s\".\n",
+ pcPluginLabel, pcPluginLibraryFilename);
exit (1);
}
if (strcmp (psDescriptor->Label, pcPluginLabel) == 0)
}
pcFilename = malloc (lDirLength + strlen (psDirectoryEntry->d_name)
- + 1 + iNeedSlash);
+ + 1 + iNeedSlash);
strcpy (pcFilename, pcDirectory);
if (iNeedSlash)
strcat (pcFilename, "/");
dlerror ();
fDescriptorFunction
- = (LADSPA_Descriptor_Function) dlsym (pvPluginHandle,
- "ladspa_descriptor");
+ = (LADSPA_Descriptor_Function) dlsym (pvPluginHandle,
+ "ladspa_descriptor");
if (dlerror () == NULL && fDescriptorFunction) {
- /* We've successfully found a ladspa_descriptor function. Pass
- it to the callback function. */
- fCallbackFunction (pcFilename, pvPluginHandle, fDescriptorFunction);
+ /* We've successfully found a ladspa_descriptor function. Pass
+ it to the callback function. */
+ fCallbackFunction (pcFilename, pvPluginHandle, fDescriptorFunction);
} else {
- /* It was a library, but not a LADSPA one. Unload it. */
- dlclose (pcFilename);
+ /* It was a library, but not a LADSPA one. Unload it. */
+ dlclose (pcFilename);
}
}
free (pcFilename);
GST_PAD_SINK,
GST_PAD_ALWAYS,
GST_STATIC_CAPS (GST_VIDEO_CAPS_RGB ";" GST_VIDEO_CAPS_RGBx ";"
- GST_VIDEO_CAPS_RGB_16 ";" GST_VIDEO_CAPS_RGB_15)
+ GST_VIDEO_CAPS_RGB_16 ";" GST_VIDEO_CAPS_RGB_15)
);
static void gst_cacasink_base_init (gpointer g_class);
};
cacasink_type =
- g_type_register_static (GST_TYPE_VIDEOSINK, "GstCACASink",
- &cacasink_info, 0);
+ g_type_register_static (GST_TYPE_VIDEOSINK, "GstCACASink",
+ &cacasink_info, 0);
g_type_add_interface_static (cacasink_type, GST_TYPE_IMPLEMENTS_INTERFACE,
- &iface_info);
+ &iface_info);
g_type_add_interface_static (cacasink_type, GST_TYPE_NAVIGATION,
- &navigation_info);
+ &navigation_info);
}
return cacasink_type;
}
parent_class = g_type_class_ref (GST_TYPE_ELEMENT);
- g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_SCREEN_WIDTH, g_param_spec_int ("screen_width", "screen_width", "screen_width", G_MININT, G_MAXINT, 0, G_PARAM_READABLE)); /* CHECKME */
- g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_SCREEN_HEIGHT, g_param_spec_int ("screen_height", "screen_height", "screen_height", G_MININT, G_MAXINT, 0, G_PARAM_READABLE)); /* CHECKME */
+ g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_SCREEN_WIDTH, g_param_spec_int ("screen_width", "screen_width", "screen_width", G_MININT, G_MAXINT, 0, G_PARAM_READABLE)); /* CHECKME */
+ g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_SCREEN_HEIGHT, g_param_spec_int ("screen_height", "screen_height", "screen_height", G_MININT, G_MAXINT, 0, G_PARAM_READABLE)); /* CHECKME */
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_DITHER,
g_param_spec_enum ("dither", "Dither Type", "Set type of Dither",
- GST_TYPE_CACADITHER, 0, G_PARAM_READWRITE));
+ GST_TYPE_CACADITHER, 0, G_PARAM_READWRITE));
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_ANTIALIASING,
g_param_spec_boolean ("anti_aliasing", "Anti-Aliasing",
- "Enables Anti-Aliasing", TRUE, G_PARAM_READWRITE));
+ "Enables Anti-Aliasing", TRUE, G_PARAM_READWRITE));
gobject_class->set_property = gst_cacasink_set_property;
gobject_class->get_property = gst_cacasink_get_property;
if (cacasink->id && GST_CLOCK_TIME_IS_VALID (time)) {
GST_DEBUG ("videosink: clock %s wait: %" G_GUINT64_FORMAT " %u",
- GST_OBJECT_NAME (GST_VIDEOSINK_CLOCK (cacasink)),
- time, GST_BUFFER_SIZE (buf));
+ GST_OBJECT_NAME (GST_VIDEOSINK_CLOCK (cacasink)),
+ time, GST_BUFFER_SIZE (buf));
gst_element_wait (GST_ELEMENT (cacasink), GST_BUFFER_TIMESTAMP (buf));
}
case ARG_ANTIALIASING:{
cacasink->antialiasing = g_value_get_boolean (value);
if (cacasink->antialiasing) {
- caca_set_feature (CACA_ANTIALIASING_MAX);
+ caca_set_feature (CACA_ANTIALIASING_MAX);
}
else {
- caca_set_feature (CACA_ANTIALIASING_MIN);
+ caca_set_feature (CACA_ANTIALIASING_MIN);
}
break;
}
} else {
if (!GST_FLAG_IS_SET (element, GST_CACASINK_OPEN)) {
if (!gst_cacasink_open (GST_CACASINK (element)))
- return GST_STATE_FAILURE;
+ return GST_STATE_FAILURE;
}
}
return FALSE;
if (!gst_element_register (plugin, "cacasink", GST_RANK_NONE,
- GST_TYPE_CACASINK))
+ GST_TYPE_CACASINK))
return FALSE;
return TRUE;
};
pngenc_type = g_type_register_static (GST_TYPE_ELEMENT, "GstPngEnc",
- &pngenc_info, 0);
+ &pngenc_info, 0);
}
return pngenc_type;
}
pngenc->png_info_ptr = png_create_info_struct (pngenc->png_struct_ptr);
if (!pngenc->png_info_ptr) {
png_destroy_read_struct (&(pngenc->png_struct_ptr), (png_infopp) NULL,
- (png_infopp) NULL);
+ (png_infopp) NULL);
}
/* non-0 return is from a longjmp inside of libpng */
for (row_index = 0; row_index < pngenc->height; row_index++)
row_pointers[row_index] = GST_BUFFER_DATA (buf) +
- (pngenc->width * row_index * pngenc->bpp / 8);
+ (pngenc->width * row_index * pngenc->bpp / 8);
png_write_info (pngenc->png_struct_ptr, pngenc->png_info_ptr);
png_write_image (pngenc->png_struct_ptr, row_pointers);
GST_PAD_SRC,
GST_PAD_ALWAYS,
GST_STATIC_CAPS ("audio/x-raw-int, "
- "endianness = (int) BYTE_ORDER, "
- "signed = (boolean) TRUE, "
- "width = (int) 16, "
- "depth = (int) 16, "
- "rate = (int) { 8000, 11025, 22050, 44100 }, "
- "channels = (int) [ 1, 2 ]; "
- "audio/x-raw-int, "
- "signed = (boolean) FALSE, "
- "width = (int) 8, "
- "depth = (int) 8, "
- "rate = (int) { 8000, 11025, 22050, 44100 }, "
- "channels = (int) [ 1, 2 ]")
+ "endianness = (int) BYTE_ORDER, "
+ "signed = (boolean) TRUE, "
+ "width = (int) 16, "
+ "depth = (int) 16, "
+ "rate = (int) { 8000, 11025, 22050, 44100 }, "
+ "channels = (int) [ 1, 2 ]; "
+ "audio/x-raw-int, "
+ "signed = (boolean) FALSE, "
+ "width = (int) 8, "
+ "depth = (int) 8, "
+ "rate = (int) { 8000, 11025, 22050, 44100 }, "
+ "channels = (int) [ 1, 2 ]")
);
static GstStaticPadTemplate mikmod_sink_factory =
0,
(GInstanceInitFunc) gst_mikmod_init,
};
+
mikmod_type =
- g_type_register_static (GST_TYPE_ELEMENT, "GstMikmod", &mikmod_info, 0);
+ g_type_register_static (GST_TYPE_ELEMENT, "GstMikmod", &mikmod_info, 0);
}
return mikmod_type;
}
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_SONGNAME,
g_param_spec_string ("songname", "songname", "songname",
- NULL, G_PARAM_READABLE));
+ NULL, G_PARAM_READABLE));
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_MODTYPE,
g_param_spec_string ("modtype", "modtype", "modtype",
- NULL, G_PARAM_READABLE));
+ NULL, G_PARAM_READABLE));
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_MUSICVOLUME,
g_param_spec_int ("musicvolume", "musivolume", "musicvolume",
- 0, 128, 128, G_PARAM_READWRITE));
+ 0, 128, 128, G_PARAM_READWRITE));
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_PANSEP,
g_param_spec_int ("pansep", "pansep", "pansep",
- 0, 128, 128, G_PARAM_READWRITE));
+ 0, 128, 128, G_PARAM_READWRITE));
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_REVERB,
g_param_spec_int ("reverb", "reverb", "reverb",
- 0, 15, 0, G_PARAM_READWRITE));
+ 0, 15, 0, G_PARAM_READWRITE));
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_SNDFXVOLUME,
g_param_spec_int ("sndfxvolume", "sndfxvolume", "sndfxvolume",
- 0, 128, 128, G_PARAM_READWRITE));
+ 0, 128, 128, G_PARAM_READWRITE));
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_VOLUME,
g_param_spec_int ("volume", "volume", "volume",
- 0, 128, 96, G_PARAM_READWRITE));
+ 0, 128, 96, G_PARAM_READWRITE));
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_INTERP,
g_param_spec_boolean ("interp", "interp", "interp",
- FALSE, G_PARAM_READWRITE));
+ FALSE, G_PARAM_READWRITE));
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_REVERSE,
g_param_spec_boolean ("reverse", "reverse", "reverse",
- FALSE, G_PARAM_READWRITE));
+ FALSE, G_PARAM_READWRITE));
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_SURROUND,
g_param_spec_boolean ("surround", "surround", "surround",
- TRUE, G_PARAM_READWRITE));
+ TRUE, G_PARAM_READWRITE));
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_HQMIXER,
g_param_spec_boolean ("hqmixer", "hqmixer", "hqmixer",
- FALSE, G_PARAM_READWRITE));
+ FALSE, G_PARAM_READWRITE));
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_SOFT_MUSIC,
g_param_spec_boolean ("soft_music", "soft_music", "soft_music",
- TRUE, G_PARAM_READWRITE));
+ TRUE, G_PARAM_READWRITE));
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_SOFT_SNDFX,
g_param_spec_boolean ("soft_sndfx", "soft_sndfx", "soft_sndfx",
- TRUE, G_PARAM_READWRITE));
+ TRUE, G_PARAM_READWRITE));
gobject_class->set_property = gst_mikmod_set_property;
if (!mikmod->initialized) {
while ((buffer_in = GST_BUFFER (gst_pad_pull (mikmod->sinkpad)))) {
if (GST_IS_EVENT (buffer_in)) {
- GstEvent *event = GST_EVENT (buffer_in);
+ GstEvent *event = GST_EVENT (buffer_in);
- if (GST_EVENT_TYPE (event) == GST_EVENT_EOS)
- break;
+ if (GST_EVENT_TYPE (event) == GST_EVENT_EOS)
+ break;
} else {
- if (mikmod->Buffer) {
- GstBuffer *merge;
-
- merge = gst_buffer_merge (mikmod->Buffer, buffer_in);
- gst_buffer_unref (buffer_in);
- gst_buffer_unref (mikmod->Buffer);
- mikmod->Buffer = merge;
- } else {
- mikmod->Buffer = buffer_in;
- }
+ if (mikmod->Buffer) {
+ GstBuffer *merge;
+
+ merge = gst_buffer_merge (mikmod->Buffer, buffer_in);
+ gst_buffer_unref (buffer_in);
+ gst_buffer_unref (mikmod->Buffer);
+ mikmod->Buffer = merge;
+ } else {
+ mikmod->Buffer = buffer_in;
+ }
}
}
if (!GST_PAD_CAPS (mikmod->srcpad)) {
if (GST_PAD_LINK_SUCCESSFUL (gst_pad_renegotiate (mikmod->srcpad))) {
- GST_ELEMENT_ERROR (mikmod, CORE, NEGOTIATION, (NULL), (NULL));
- return;
+ GST_ELEMENT_ERROR (mikmod, CORE, NEGOTIATION, (NULL), (NULL));
+ return;
}
}
plugin_init (GstPlugin * plugin)
{
if (!gst_element_register (plugin, "mikmod", GST_RANK_SECONDARY,
- GST_TYPE_MIKMOD))
+ GST_TYPE_MIKMOD))
return FALSE;
return TRUE;
#include <gst/gst.h>
#include "mikmod_types.h"
-#include <string.h> /* memcmp */
-#include <ctype.h> /* isdigit */
+#include <string.h> /* memcmp */
+#include <ctype.h> /* isdigit */
#define MODULEHEADERSIZE 0x438
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;
plugin_init (GstPlugin * plugin)
{
if (!gst_element_register (plugin, "dv1394src", GST_RANK_NONE,
- GST_TYPE_DV1394SRC))
+ GST_TYPE_DV1394SRC))
return FALSE;
return TRUE;
if (!template) {
template = gst_pad_template_new ("src",
- GST_PAD_SRC,
- GST_PAD_ALWAYS,
- GST_STATIC_CAPS ("dv1394src",
- "video/dv",
- gst_props_new ("format", GST_PROPS_LIST (G_TYPE_STRING ("NTSC"),
- G_TYPE_STRING ("PAL")
- ), NULL)
- ), NULL);
+ GST_PAD_SRC,
+ GST_PAD_ALWAYS,
+ GST_STATIC_CAPS ("dv1394src",
+ "video/dv",
+ gst_props_new ("format", GST_PROPS_LIST (G_TYPE_STRING ("NTSC"),
+ G_TYPE_STRING ("PAL")
+ ), NULL)
+ ), NULL);
}
return template;
}
0,
(GInstanceInitFunc) gst_dv1394src_init,
};
+
gst_dv1394src_type =
- g_type_register_static (GST_TYPE_ELEMENT, "DV1394Src",
- &gst_dv1394src_info, 0);
+ g_type_register_static (GST_TYPE_ELEMENT, "DV1394Src",
+ &gst_dv1394src_info, 0);
}
return gst_dv1394src_type;
}
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_CONSECUTIVE,
g_param_spec_int ("consecutive", "consecutive frames",
- "send n consecutive frames after skipping", 1, G_MAXINT, 1,
- G_PARAM_READWRITE));
+ "send n consecutive frames after skipping", 1, G_MAXINT, 1,
+ G_PARAM_READWRITE));
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_SKIP,
g_param_spec_int ("skip", "skip frames", "skip n frames", 0, G_MAXINT, 1,
- G_PARAM_READWRITE));
+ G_PARAM_READWRITE));
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_DROP_INCOMPLETE,
g_param_spec_boolean ("drop_incomplete", "drop_incomplete",
- "drop incomplete frames", TRUE, G_PARAM_READWRITE));
+ "drop incomplete frames", TRUE, G_PARAM_READWRITE));
parent_class = g_type_class_ref (GST_TYPE_ELEMENT);
the following code taken from kino-0.51 (Dan Dennedy/Charles Yates)
*/
unsigned char *p = (unsigned char *) &data[3];
- int section_type = p[0] >> 5; /* section type is in bits 5 - 7 */
- int dif_sequence = p[1] >> 4; /* dif sequence number is in bits 4 - 7 */
+ int section_type = p[0] >> 5; /* section type is in bits 5 - 7 */
+ int dif_sequence = p[1] >> 4; /* dif sequence number is in bits 4 - 7 */
int dif_block = p[2];
/* if we are at the beginning of a frame,
we set buf=frame, and alloc a new buffer for frame
*/
- if (section_type == 0 && dif_sequence == 0) { // dif header
+ if (section_type == 0 && dif_sequence == 0) { // dif header
if (!dv1394src->negotiated) {
- // figure format (NTSC/PAL)
- if (p[3] & 0x80) {
- // PAL
- dv1394src->frameSize = PAL_FRAMESIZE;
- GST_DEBUG ("PAL data");
- if (gst_pad_try_set_caps (dv1394src->srcpad,
- gst_caps_new_simple ("video/dv",
- "format", G_TYPE_STRING, "PAL", NULL)) <= 0) {
- GST_ELEMENT_ERROR (dv1394src, CORE, NEGOTIATION, (NULL),
- ("Could not set source caps for PAL"));
- return 0;
- }
- } else {
- // NTSC (untested)
- dv1394src->frameSize = NTSC_FRAMESIZE;
- GST_DEBUG
- ("NTSC data [untested] - please report success/failure to <dan@f3c.com>");
- if (gst_pad_try_set_caps (dv1394src->srcpad,
- gst_caps_new_simple ("video/dv", "format", G_TYPE_STRING,
- "NTSC", NULL)) <= 0) {
- GST_ELEMENT_ERROR (dv1394src, CORE, NEGOTIATION, (NULL),
- ("Could not set source caps for NTSC"));
- return 0;
- }
- }
- dv1394src->negotiated = TRUE;
+ // figure format (NTSC/PAL)
+ if (p[3] & 0x80) {
+ // PAL
+ dv1394src->frameSize = PAL_FRAMESIZE;
+ GST_DEBUG ("PAL data");
+ if (gst_pad_try_set_caps (dv1394src->srcpad,
+ gst_caps_new_simple ("video/dv",
+ "format", G_TYPE_STRING, "PAL", NULL)) <= 0) {
+ GST_ELEMENT_ERROR (dv1394src, CORE, NEGOTIATION, (NULL),
+ ("Could not set source caps for PAL"));
+ return 0;
+ }
+ } else {
+ // NTSC (untested)
+ dv1394src->frameSize = NTSC_FRAMESIZE;
+ GST_DEBUG
+ ("NTSC data [untested] - please report success/failure to <dan@f3c.com>");
+ if (gst_pad_try_set_caps (dv1394src->srcpad,
+ gst_caps_new_simple ("video/dv", "format", G_TYPE_STRING,
+ "NTSC", NULL)) <= 0) {
+ GST_ELEMENT_ERROR (dv1394src, CORE, NEGOTIATION, (NULL),
+ ("Could not set source caps for NTSC"));
+ return 0;
+ }
+ }
+ dv1394src->negotiated = TRUE;
}
// drop last frame when not complete
if (!dv1394src->drop_incomplete
- || dv1394src->bytesInFrame == dv1394src->frameSize) {
- dv1394src->buf = dv1394src->frame;
+ || dv1394src->bytesInFrame == dv1394src->frameSize) {
+ dv1394src->buf = dv1394src->frame;
} else {
- GST_INFO_OBJECT (GST_ELEMENT (dv1394src), "incomplete frame dropped");
+ GST_INFO_OBJECT (GST_ELEMENT (dv1394src), "incomplete frame dropped");
}
dv1394src->frame = NULL;
dv1394src->frameSequence++;
if (dv1394src->frameSequence % (dv1394src->skip +
- dv1394src->consecutive) < dv1394src->consecutive) {
- dv1394src->frame = gst_buffer_new_and_alloc (dv1394src->frameSize);
+ dv1394src->consecutive) < dv1394src->consecutive) {
+ dv1394src->frame = gst_buffer_new_and_alloc (dv1394src->frameSize);
}
dv1394src->bytesInFrame = 0;
}
switch (section_type) {
- case 0: /* 1 Header block */
- /* p[3] |= 0x80; // hack to force PAL data */
- memcpy (data + dif_sequence * 150 * 80, p, 480);
- break;
-
- case 1: /* 2 Subcode blocks */
- memcpy (data + dif_sequence * 150 * 80 + (1 + dif_block) * 80, p,
- 480);
- break;
-
- case 2: /* 3 VAUX blocks */
- memcpy (data + dif_sequence * 150 * 80 + (3 + dif_block) * 80, p,
- 480);
- break;
-
- case 3: /* 9 Audio blocks interleaved with video */
- memcpy (data + dif_sequence * 150 * 80 + (6 + dif_block * 16) * 80, p,
- 480);
- break;
-
- case 4: /* 135 Video blocks interleaved with audio */
- memcpy (data + dif_sequence * 150 * 80 + (7 + (dif_block / 15) +
- dif_block) * 80, p, 480);
- break;
-
- default: /* we can´t handle any other data */
- break;
+ case 0: /* 1 Header block */
+ /* p[3] |= 0x80; // hack to force PAL data */
+ memcpy (data + dif_sequence * 150 * 80, p, 480);
+ break;
+
+ case 1: /* 2 Subcode blocks */
+ memcpy (data + dif_sequence * 150 * 80 + (1 + dif_block) * 80, p,
+ 480);
+ break;
+
+ case 2: /* 3 VAUX blocks */
+ memcpy (data + dif_sequence * 150 * 80 + (3 + dif_block) * 80, p,
+ 480);
+ break;
+
+ case 3: /* 9 Audio blocks interleaved with video */
+ memcpy (data + dif_sequence * 150 * 80 + (6 + dif_block * 16) * 80, p,
+ 480);
+ break;
+
+ case 4: /* 135 Video blocks interleaved with audio */
+ memcpy (data + dif_sequence * 150 * 80 + (7 + (dif_block / 15) +
+ dif_block) * 80, p, 480);
+ break;
+
+ default: /* we can´t handle any other data */
+ break;
}
dv1394src->bytesInFrame += 480;
}
switch (GST_STATE_TRANSITION (element)) {
case GST_STATE_NULL_TO_READY:
if ((dv1394src->handle = raw1394_new_handle ()) == NULL) {
- GST_INFO_OBJECT (dv1394src, "can't get raw1394 handle");
- return GST_STATE_FAILURE;
+ GST_INFO_OBJECT (dv1394src, "can't get raw1394 handle");
+ return GST_STATE_FAILURE;
}
raw1394_set_userdata (dv1394src->handle, dv1394src);
dv1394src->numcards =
- raw1394_get_port_info (dv1394src->handle, dv1394src->pinfo, 16);
+ raw1394_get_port_info (dv1394src->handle, dv1394src->pinfo, 16);
if (dv1394src->numcards == 0) {
- GST_INFO_OBJECT (dv1394src, "no cards available for raw1394");
- return GST_STATE_FAILURE;
+ GST_INFO_OBJECT (dv1394src, "no cards available for raw1394");
+ return GST_STATE_FAILURE;
}
if (dv1394src->pinfo[dv1394src->card].nodes <= 1) {
- GST_INFO_OBJECT (dv1394src, "there are no nodes on the 1394 bus");
- return GST_STATE_FAILURE;
+ GST_INFO_OBJECT (dv1394src, "there are no nodes on the 1394 bus");
+ return GST_STATE_FAILURE;
}
if (raw1394_set_port (dv1394src->handle, dv1394src->port) < 0) {
- GST_INFO_OBJECT (dv1394src, "can't set 1394 port %d", dv1394src->port);
- return GST_STATE_FAILURE;
+ GST_INFO_OBJECT (dv1394src, "can't set 1394 port %d", dv1394src->port);
+ return GST_STATE_FAILURE;
}
raw1394_set_iso_handler (dv1394src->handle, dv1394src->channel,
- gst_dv1394src_iso_receive);
+ gst_dv1394src_iso_receive);
raw1394_set_bus_reset_handler (dv1394src->handle,
- gst_dv1394src_bus_reset);
+ gst_dv1394src_bus_reset);
dv1394src->started = FALSE;
GST_DEBUG ("successfully opened up 1394 connection");
break;
case GST_STATE_PAUSED_TO_PLAYING:
if (raw1394_start_iso_rcv (dv1394src->handle, dv1394src->channel) < 0) {
- GST_INFO_OBJECT (dv1394src, "can't start 1394 iso receive");
- return GST_STATE_FAILURE;
+ GST_INFO_OBJECT (dv1394src, "can't start 1394 iso receive");
+ return GST_STATE_FAILURE;
}
break;
case GST_STATE_PLAYING_TO_PAUSED:
enum
{
ARG_0,
- ARG_IP, /* the ip of the server */
- ARG_PORT, /* the encoder port number on the server */
- ARG_PASSWORD, /* the encoder password on the server */
- ARG_PUBLIC, /* is this stream public? */
- ARG_NAME, /* Name of the stream */
- ARG_DESCRIPTION, /* Description of the stream */
- ARG_GENRE, /* Genre of the stream */
-
- ARG_PROTOCOL, /* Protocol to connect with */
-
- ARG_MOUNT, /* mountpoint of stream (icecast only) */
- ARG_URL, /* Url of stream (I'm guessing) */
+ ARG_IP, /* the ip of the server */
+ ARG_PORT, /* the encoder port number on the server */
+ ARG_PASSWORD, /* the encoder password on the server */
+ ARG_PUBLIC, /* is this stream public? */
+ ARG_NAME, /* Name of the stream */
+ ARG_DESCRIPTION, /* Description of the stream */
+ ARG_GENRE, /* Genre of the stream */
+
+ ARG_PROTOCOL, /* Protocol to connect with */
+
+ ARG_MOUNT, /* mountpoint of stream (icecast only) */
+ ARG_URL, /* Url of stream (I'm guessing) */
};
static GstPadTemplate *
if (!template) {
template = gst_pad_template_new ("sink",
- GST_PAD_SINK,
- GST_PAD_ALWAYS,
- gst_caps_new ("shout2send_sink",
- "application/ogg",
- NULL),
- gst_caps_new ("shout2send_sink",
- "audio/mpeg",
- gst_props_new ("mpegversion", GST_PROPS_INT (1),
- "layer", GST_PROPS_INT_RANGE (1, 3), NULL)), NULL);
+ GST_PAD_SINK,
+ GST_PAD_ALWAYS,
+ gst_caps_new ("shout2send_sink",
+ "application/ogg",
+ NULL),
+ gst_caps_new ("shout2send_sink",
+ "audio/mpeg",
+ gst_props_new ("mpegversion", GST_PROPS_INT (1),
+ "layer", GST_PROPS_INT_RANGE (1, 3), NULL)), NULL);
}
return template;
static GEnumValue shout2send_protocol[] = {
{SHOUT2SEND_PROTOCOL_ICE, "1", "Ice Protocol"},
{SHOUT2SEND_PROTOCOL_XAUDIOCAST, "2",
- "Xaudiocast Protocol (icecast 1.3.x)"},
+ "Xaudiocast Protocol (icecast 1.3.x)"},
{SHOUT2SEND_PROTOCOL_ICY, "3", "Icy Protocol (ShoutCast)"},
{SHOUT2SEND_PROTOCOL_HTTP, "4", "Http Protocol (icecast 2.x)"},
{0, NULL, NULL},
};
+
if (!shout2send_protocol_type) {
shout2send_protocol_type =
- g_enum_register_static ("GstShout2SendProtocol", shout2send_protocol);
+ g_enum_register_static ("GstShout2SendProtocol", shout2send_protocol);
}
return shout2send_protocol_type;
}
0,
(GInstanceInitFunc) gst_shout2send_init,
};
+
shout2send_type =
- g_type_register_static (GST_TYPE_ELEMENT, "GstShout2send",
- &shout2send_info, 0);
+ g_type_register_static (GST_TYPE_ELEMENT, "GstShout2send",
+ &shout2send_info, 0);
}
return shout2send_type;
}
parent_class = g_type_class_ref (GST_TYPE_ELEMENT);
- g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_IP, g_param_spec_string ("ip", "ip", "ip", NULL, G_PARAM_READWRITE)); /* CHECKME */
- g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_PORT, g_param_spec_int ("port", "port", "port", 1, G_MAXUSHORT, 8000, G_PARAM_READWRITE)); /* CHECKME */
+ g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_IP, g_param_spec_string ("ip", "ip", "ip", NULL, G_PARAM_READWRITE)); /* CHECKME */
+ g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_PORT, g_param_spec_int ("port", "port", "port", 1, G_MAXUSHORT, 8000, G_PARAM_READWRITE)); /* CHECKME */
- g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_PASSWORD, g_param_spec_string ("password", "password", "password", NULL, G_PARAM_READWRITE)); /* CHECKME */
+ g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_PASSWORD, g_param_spec_string ("password", "password", "password", NULL, G_PARAM_READWRITE)); /* CHECKME */
/* metadata */
- g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_NAME, g_param_spec_string ("name", "name", "name", NULL, G_PARAM_READWRITE)); /* CHECKME */
+ g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_NAME, g_param_spec_string ("name", "name", "name", NULL, G_PARAM_READWRITE)); /* CHECKME */
- g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_DESCRIPTION, g_param_spec_string ("description", "description", "description", NULL, G_PARAM_READWRITE)); /* CHECKME */
+ g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_DESCRIPTION, g_param_spec_string ("description", "description", "description", NULL, G_PARAM_READWRITE)); /* CHECKME */
- g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_GENRE, g_param_spec_string ("genre", "genre", "genre", NULL, G_PARAM_READWRITE)); /* CHECKME */
+ g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_GENRE, g_param_spec_string ("genre", "genre", "genre", NULL, G_PARAM_READWRITE)); /* CHECKME */
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_PROTOCOL,
g_param_spec_enum ("protocol", "protocol", "Connection Protocol to use",
- GST_TYPE_SHOUT_PROTOCOL, SHOUT2SEND_PROTOCOL_HTTP,
- G_PARAM_READWRITE));
+ GST_TYPE_SHOUT_PROTOCOL, SHOUT2SEND_PROTOCOL_HTTP,
+ G_PARAM_READWRITE));
/* icecast only */
- g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_MOUNT, g_param_spec_string ("mount", "mount", "mount", NULL, G_PARAM_READWRITE)); /* CHECKME */
+ g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_MOUNT, g_param_spec_string ("mount", "mount", "mount", NULL, G_PARAM_READWRITE)); /* CHECKME */
- g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_URL, g_param_spec_string ("url", "url", "url", NULL, G_PARAM_READWRITE)); /* CHECKME */
+ g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_URL, g_param_spec_string ("url", "url", "url", NULL, G_PARAM_READWRITE)); /* CHECKME */
case ARG_IP:
if (shout2send->ip)
- g_free (shout2send->ip);
+ g_free (shout2send->ip);
shout2send->ip = g_strdup (g_value_get_string (value));
break;
case ARG_PASSWORD:
if (shout2send->password)
- g_free (shout2send->password);
+ g_free (shout2send->password);
shout2send->password = g_strdup (g_value_get_string (value));
break;
- case ARG_NAME: /* Name of the stream */
+ case ARG_NAME: /* Name of the stream */
if (shout2send->name)
- g_free (shout2send->name);
+ g_free (shout2send->name);
shout2send->name = g_strdup (g_value_get_string (value));
break;
- case ARG_DESCRIPTION: /* Description of the stream */
+ case ARG_DESCRIPTION: /* Description of the stream */
if (shout2send->description)
- g_free (shout2send->description);
+ g_free (shout2send->description);
shout2send->description = g_strdup (g_value_get_string (value));
break;
- case ARG_GENRE: /* Genre of the stream */
+ case ARG_GENRE: /* Genre of the stream */
if (shout2send->genre)
- g_free (shout2send->genre);
+ g_free (shout2send->genre);
shout2send->genre = g_strdup (g_value_get_string (value));
break;
- case ARG_PROTOCOL: /* protocol to connect with */
+ case ARG_PROTOCOL: /* protocol to connect with */
shout2send->protocol = g_value_get_enum (value);
break;
- case ARG_MOUNT: /* mountpoint of stream (icecast only) */
+ case ARG_MOUNT: /* mountpoint of stream (icecast only) */
if (shout2send->mount)
- g_free (shout2send->mount);
+ g_free (shout2send->mount);
shout2send->mount = g_strdup (g_value_get_string (value));
break;
- case ARG_URL: /* Url of the stream (I'm guessing) */
+ case ARG_URL: /* Url of the stream (I'm guessing) */
if (shout2send->url)
- g_free (shout2send->url);
+ g_free (shout2send->url);
shout2send->url = g_strdup (g_value_get_string (value));
break;
g_value_set_string (value, shout2send->password);
break;
- case ARG_NAME: /* Name of the stream */
+ case ARG_NAME: /* Name of the stream */
g_value_set_string (value, shout2send->name);
break;
- case ARG_DESCRIPTION: /* Description of the stream */
+ case ARG_DESCRIPTION: /* Description of the stream */
g_value_set_string (value, shout2send->description);
break;
- case ARG_GENRE: /* Genre of the stream */
+ case ARG_GENRE: /* Genre of the stream */
g_value_set_string (value, shout2send->genre);
break;
- case ARG_PROTOCOL: /* protocol to connect with */
+ case ARG_PROTOCOL: /* protocol to connect with */
g_value_set_enum (value, shout2send->protocol);
break;
- case ARG_MOUNT: /* mountpoint of stream (icecast only) */
+ case ARG_MOUNT: /* mountpoint of stream (icecast only) */
g_value_set_string (value, shout2send->mount);
break;
- case ARG_URL: /* Url of stream (I'm guessing) */
+ case ARG_URL: /* Url of stream (I'm guessing) */
g_value_set_string (value, shout2send->url);
break;
shout2send->conn = shout_new ();
switch (shout2send->protocol) {
- case SHOUT2SEND_PROTOCOL_ICE:
- proto = SHOUT_PROTOCOL_ICE;
- break;
- case SHOUT2SEND_PROTOCOL_XAUDIOCAST:
- proto = SHOUT_PROTOCOL_XAUDIOCAST;
- break;
- case SHOUT2SEND_PROTOCOL_ICY:
- proto = SHOUT_PROTOCOL_ICY;
- break;
- case SHOUT2SEND_PROTOCOL_HTTP:
- proto = SHOUT_PROTOCOL_HTTP;
- break;
+ case SHOUT2SEND_PROTOCOL_ICE:
+ proto = SHOUT_PROTOCOL_ICE;
+ break;
+ case SHOUT2SEND_PROTOCOL_XAUDIOCAST:
+ proto = SHOUT_PROTOCOL_XAUDIOCAST;
+ break;
+ case SHOUT2SEND_PROTOCOL_ICY:
+ proto = SHOUT_PROTOCOL_ICY;
+ break;
+ case SHOUT2SEND_PROTOCOL_HTTP:
+ proto = SHOUT_PROTOCOL_HTTP;
+ break;
}
if (shout_set_protocol (shout2send->conn, proto) != SHOUTERR_SUCCESS) {
- g_error ("Error setting protocol: %s\n",
- shout_get_error (shout2send->conn));
+ g_error ("Error setting protocol: %s\n",
+ shout_get_error (shout2send->conn));
}
/* --- FIXME: shout requires an ip, and fails if it is given a host. */
if (shout_set_host (shout2send->conn, shout2send->ip) != SHOUTERR_SUCCESS) {
- g_error ("Error setting host: %s\n",
- shout_get_error (shout2send->conn));
+ g_error ("Error setting host: %s\n",
+ shout_get_error (shout2send->conn));
}
/* --- */
if (shout_set_port (shout2send->conn,
- shout2send->port) != SHOUTERR_SUCCESS) {
- g_error ("Error setting port: %s\n",
- shout_get_error (shout2send->conn));
+ shout2send->port) != SHOUTERR_SUCCESS) {
+ g_error ("Error setting port: %s\n",
+ shout_get_error (shout2send->conn));
}
if (shout_set_password (shout2send->conn,
- shout2send->password) != SHOUTERR_SUCCESS) {
- g_error ("Error setting password: %s\n",
- shout_get_error (shout2send->conn));
+ shout2send->password) != SHOUTERR_SUCCESS) {
+ g_error ("Error setting password: %s\n",
+ shout_get_error (shout2send->conn));
}
if (shout_set_name (shout2send->conn,
- shout2send->name) != SHOUTERR_SUCCESS) {
- g_error ("Error setting name: %s\n",
- shout_get_error (shout2send->conn));
+ shout2send->name) != SHOUTERR_SUCCESS) {
+ g_error ("Error setting name: %s\n",
+ shout_get_error (shout2send->conn));
}
if (shout_set_description (shout2send->conn,
- shout2send->description) != SHOUTERR_SUCCESS) {
- g_error ("Error setting name: %s\n",
- shout_get_error (shout2send->conn));
+ shout2send->description) != SHOUTERR_SUCCESS) {
+ g_error ("Error setting name: %s\n",
+ shout_get_error (shout2send->conn));
}
if (shout_set_genre (shout2send->conn,
- shout2send->genre) != SHOUTERR_SUCCESS) {
- g_error ("Error setting name: %s\n",
- shout_get_error (shout2send->conn));
+ shout2send->genre) != SHOUTERR_SUCCESS) {
+ g_error ("Error setting name: %s\n",
+ shout_get_error (shout2send->conn));
}
if (shout_set_mount (shout2send->conn,
- shout2send->mount) != SHOUTERR_SUCCESS) {
- g_error ("Error setting mount point: %s\n",
- shout_get_error (shout2send->conn));
+ shout2send->mount) != SHOUTERR_SUCCESS) {
+ g_error ("Error setting mount point: %s\n",
+ shout_get_error (shout2send->conn));
}
if (shout_set_user (shout2send->conn, "source") != SHOUTERR_SUCCESS) {
- g_error ("Error setting user: %s\n",
- shout_get_error (shout2send->conn));
+ g_error ("Error setting user: %s\n",
+ shout_get_error (shout2send->conn));
}
gst_version (&major, &minor, µ);
version_string =
- g_strdup_printf ("GStreamer %d.%d.%d", major, minor, micro);
+ g_strdup_printf ("GStreamer %d.%d.%d", major, minor, micro);
if (shout_set_agent (shout2send->conn,
- version_string) != SHOUTERR_SUCCESS) {
- g_error ("Error setting agent: %s\n",
- shout_get_error (shout2send->conn));
+ version_string) != SHOUTERR_SUCCESS) {
+ g_error ("Error setting agent: %s\n",
+ shout_get_error (shout2send->conn));
}
g_free (version_string);
we are being given as input. */
if (shout_set_format (shout2send->conn, audio_format) != SHOUTERR_SUCCESS) {
- g_error ("Error setting connection format: %s\n",
- shout_get_error (shout2send->conn));
+ g_error ("Error setting connection format: %s\n",
+ shout_get_error (shout2send->conn));
}
if (shout_open (shout2send->conn) == SHOUTERR_SUCCESS) {
- g_print ("connected to server...\n");
+ g_print ("connected to server...\n");
} else {
- g_warning ("Couldn't connect to server: %s",
- shout_get_error (shout2send->conn));
- shout_close (shout2send->conn);
- shout_free (shout2send->conn);
- return GST_STATE_FAILURE;
+ g_warning ("Couldn't connect to server: %s",
+ shout_get_error (shout2send->conn));
+ shout_close (shout2send->conn);
+ shout_free (shout2send->conn);
+ return GST_STATE_FAILURE;
}
break;
case GST_STATE_PAUSED_TO_READY:
plugin_init (GstPlugin * plugin)
{
if (!gst_element_register (plugin, "speexenc", GST_RANK_NONE,
- GST_TYPE_SPEEXENC))
+ GST_TYPE_SPEEXENC))
return FALSE;
if (!gst_element_register (plugin, "speexdec", GST_RANK_PRIMARY,
- GST_TYPE_SPEEXDEC))
+ GST_TYPE_SPEEXDEC))
return FALSE;
return TRUE;
0,
(GInstanceInitFunc) gst_speexdec_init,
};
+
speexdec_type =
- g_type_register_static (GST_TYPE_ELEMENT, "GstSpeexDec", &speexdec_info,
- 0);
+ g_type_register_static (GST_TYPE_ELEMENT, "GstSpeexDec", &speexdec_info,
+ 0);
}
return speexdec_type;
}
GST_PAD_SINK,
GST_PAD_ALWAYS,
GST_STATIC_CAPS ("audio/x-speex, "
- "rate = (int) [ 1000, 48000 ], " "channels = (int) 1")
+ "rate = (int) [ 1000, 48000 ], " "channels = (int) 1")
);
static GstStaticPadTemplate speex_src_template = GST_STATIC_PAD_TEMPLATE ("src",
GST_PAD_SRC,
GST_PAD_ALWAYS,
GST_STATIC_CAPS ("audio/x-raw-int, "
- "endianness = (int) BYTE_ORDER, "
- "signed = (boolean) true, "
- "width = (int) 16, "
- "depth = (int) 16, "
- "rate = (int) [ 1000, 48000 ], " "channels = (int) 1")
+ "endianness = (int) BYTE_ORDER, "
+ "signed = (boolean) true, "
+ "width = (int) 16, "
+ "depth = (int) 16, "
+ "rate = (int) [ 1000, 48000 ], " "channels = (int) 1")
);
static void
gst_structure_get_int (structure, "rate", &rate);
if (gst_pad_set_explicit_caps (speexdec->srcpad,
- gst_caps_new_simple ("audio/x-raw-int",
- "endianness", G_TYPE_INT, G_BYTE_ORDER,
- "signed", G_TYPE_BOOLEAN, TRUE,
- "width", G_TYPE_INT, 16,
- "depth", G_TYPE_INT, 16,
- "rate", G_TYPE_INT, rate, "channels", G_TYPE_INT, 1, NULL))) {
+ gst_caps_new_simple ("audio/x-raw-int",
+ "endianness", G_TYPE_INT, G_BYTE_ORDER,
+ "signed", G_TYPE_BOOLEAN, TRUE,
+ "width", G_TYPE_INT, 16,
+ "depth", G_TYPE_INT, 16,
+ "rate", G_TYPE_INT, rate, "channels", G_TYPE_INT, 1, NULL))) {
return GST_PAD_LINK_OK;
}
return GST_PAD_LINK_REFUSED;
0,
(GInstanceInitFunc) gst_speexenc_init,
};
+
speexenc_type =
- g_type_register_static (GST_TYPE_ELEMENT, "GstSpeexEnc", &speexenc_info,
- 0);
+ g_type_register_static (GST_TYPE_ELEMENT, "GstSpeexEnc", &speexenc_info,
+ 0);
}
return speexenc_type;
}
GST_PAD_SINK,
GST_PAD_ALWAYS,
GST_STATIC_CAPS ("audio/x-raw-int, "
- "endianness = (int) BYTE_ORDER, "
- "signed = (boolean) true, "
- "width = (int) 16, "
- "depth = (int) 16, "
- "rate = (int) [ 1000, 48000 ], " "channels = (int) 1")
+ "endianness = (int) BYTE_ORDER, "
+ "signed = (boolean) true, "
+ "width = (int) 16, "
+ "depth = (int) 16, "
+ "rate = (int) [ 1000, 48000 ], " "channels = (int) 1")
);
static GstStaticPadTemplate speex_src_template = GST_STATIC_PAD_TEMPLATE ("src",
GST_PAD_SRC,
GST_PAD_ALWAYS,
GST_STATIC_CAPS ("audio/x-speex, "
- "rate = (int) [ 1000, 48000 ], " "channels = (int) 1")
+ "rate = (int) [ 1000, 48000 ], " "channels = (int) 1")
);
static void
structure = gst_caps_get_structure (caps, 0);
gst_structure_get_int (structure, "rate", &speexenc->rate);
if (gst_pad_try_set_caps (speexenc->srcpad,
- gst_caps_new_simple ("audio/x-speex",
- "rate", G_TYPE_INT, speexenc->rate,
- "channels", G_TYPE_INT, 1, NULL))) {
+ gst_caps_new_simple ("audio/x-speex",
+ "rate", G_TYPE_INT, speexenc->rate,
+ "channels", G_TYPE_INT, 1, NULL))) {
speex_init_header (&speexenc->header, speexenc->rate, 1, speexenc->mode);
speexenc->header.frames_per_packet = speexenc->n_packets;
speexenc->state = speex_encoder_init (speexenc->mode);
speex_encoder_ctl (speexenc->state, SPEEX_GET_FRAME_SIZE,
- &speexenc->frame_size);
+ &speexenc->frame_size);
return GST_PAD_LINK_OK;
}
if (!GST_PAD_CAPS (speexenc->srcpad)) {
if (!gst_pad_try_set_caps (speexenc->srcpad,
- gst_caps_new_simple ("audio/x-speex",
- "rate", G_TYPE_INT, speexenc->rate,
- "channels", G_TYPE_INT, 1, NULL))) {
+ gst_caps_new_simple ("audio/x-speex",
+ "rate", G_TYPE_INT, speexenc->rate,
+ "channels", G_TYPE_INT, 1, NULL))) {
GST_ELEMENT_ERROR (speexenc, CORE, NEGOTIATION, (NULL), (NULL));
return;
}
if (speexenc->bufsize && (speexenc->bufsize + size >= frame_size)) {
memcpy (speexenc->buffer + speexenc->bufsize, data,
- (frame_size - speexenc->bufsize) * sizeof (gint16));
+ (frame_size - speexenc->bufsize) * sizeof (gint16));
for (i = 0; i < frame_size; i++)
input[i] = speexenc->buffer[i];
outbuf = gst_buffer_new_and_alloc (frame_size * speexenc->n_packets);
GST_BUFFER_SIZE (outbuf) = speex_bits_write (&speexenc->bits,
- GST_BUFFER_DATA (outbuf), GST_BUFFER_SIZE (outbuf));
+ GST_BUFFER_DATA (outbuf), GST_BUFFER_SIZE (outbuf));
GST_BUFFER_TIMESTAMP (outbuf) = speexenc->next_ts;
speex_bits_reset (&speexenc->bits);
outbuf = gst_buffer_new_and_alloc (frame_size * speexenc->n_packets);
GST_BUFFER_SIZE (outbuf) = speex_bits_write (&speexenc->bits,
- GST_BUFFER_DATA (outbuf), GST_BUFFER_SIZE (outbuf));
+ GST_BUFFER_DATA (outbuf), GST_BUFFER_SIZE (outbuf));
GST_BUFFER_TIMESTAMP (outbuf) = speexenc->next_ts;
speex_bits_reset (&speexenc->bits);
#endif
#include <gst/gst.h>
#include "gstfilter.h"
-#include <math.h> /* M_PI */
-#include <string.h> /* memmove */
+#include <math.h> /* M_PI */
+#include <string.h> /* memmove */
/* elementfactory information */
static GstElementDetails gst_bpwsinc_details = GST_ELEMENT_DETAILS ("BPWSinc",
double frequency;
double lower_frequency, upper_frequency;
- int wing_size; /* length of a "wing" of the filter;
- actual length is 2 * wing_size + 1 */
+ int wing_size; /* length of a "wing" of the filter;
+ actual length is 2 * wing_size + 1 */
- gfloat *residue; /* buffer for left-over samples from previous buffer */
+ gfloat *residue; /* buffer for left-over samples from previous buffer */
double *kernel;
};
};
bpwsinc_type = g_type_register_static (GST_TYPE_ELEMENT, "GstBPWSinc",
- &bpwsinc_info, 0);
+ &bpwsinc_info, 0);
}
return bpwsinc_type;
}
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_LOWER_FREQUENCY,
g_param_spec_double ("lower-frequency", "Lower Frequency",
- "Cut-off lower frequency (relative to sample rate)",
- 0.0, 0.5, 0, G_PARAM_READWRITE));
+ "Cut-off lower frequency (relative to sample rate)",
+ 0.0, 0.5, 0, G_PARAM_READWRITE));
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_UPPER_FREQUENCY,
g_param_spec_double ("upper-frequency", "Upper Frequency",
- "Cut-off upper frequency (relative to sample rate)",
- 0.0, 0.5, 0, G_PARAM_READWRITE));
+ "Cut-off upper frequency (relative to sample rate)",
+ 0.0, 0.5, 0, G_PARAM_READWRITE));
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_LENGTH,
g_param_spec_int ("length", "Length",
- "N such that the filter length = 2N + 1",
- 1, G_MAXINT, 1, G_PARAM_READWRITE));
+ "N such that the filter length = 2N + 1",
+ 1, G_MAXINT, 1, G_PARAM_READWRITE));
gobject_class->set_property = gst_bpwsinc_set_property;
gobject_class->get_property = gst_bpwsinc_get_property;
len = filter->wing_size;
/* fill the lp kernel */
GST_DEBUG ("bpwsinc: initializing LP kernel of length %d with cut-off %f",
- len * 2 + 1, filter->lower_frequency);
+ len * 2 + 1, filter->lower_frequency);
kernel_lp = (double *) g_malloc (sizeof (double) * (2 * len + 1));
for (i = 0; i <= len * 2; ++i) {
if (i == len)
- kernel_lp[i] = 2 * M_PI * filter->lower_frequency;
+ kernel_lp[i] = 2 * M_PI * filter->lower_frequency;
else
- kernel_lp[i] = sin (2 * M_PI * filter->lower_frequency * (i - len))
- / (i - len);
+ kernel_lp[i] = sin (2 * M_PI * filter->lower_frequency * (i - len))
+ / (i - len);
/* Blackman windowing */
kernel_lp[i] *= (0.42 - 0.5 * cos (M_PI * i / len)
- + 0.08 * cos (2 * M_PI * i / len));
+ + 0.08 * cos (2 * M_PI * i / len));
}
/* normalize for unity gain at DC
/* fill the hp kernel */
GST_DEBUG ("bpwsinc: initializing HP kernel of length %d with cut-off %f",
- len * 2 + 1, filter->upper_frequency);
+ len * 2 + 1, filter->upper_frequency);
kernel_hp = (double *) g_malloc (sizeof (double) * (2 * len + 1));
for (i = 0; i <= len * 2; ++i) {
if (i == len)
- kernel_hp[i] = 2 * M_PI * filter->upper_frequency;
+ kernel_hp[i] = 2 * M_PI * filter->upper_frequency;
else
- kernel_hp[i] = sin (2 * M_PI * filter->upper_frequency * (i - len))
- / (i - len);
+ kernel_hp[i] = sin (2 * M_PI * filter->upper_frequency * (i - len))
+ / (i - len);
/* Blackman windowing */
kernel_hp[i] *= (0.42 - 0.5 * cos (M_PI * i / len)
- + 0.08 * cos (2 * M_PI * i / len));
+ + 0.08 * cos (2 * M_PI * i / len));
}
/* normalize for unity gain at DC
#endif
#include <gst/gst.h>
#include "gstfilter.h"
-#include <math.h> /* M_PI */
-#include <string.h> /* memmove */
+#include <math.h> /* M_PI */
+#include <string.h> /* memmove */
static GstElementDetails gst_lpwsinc_details = GST_ELEMENT_DETAILS ("LPWSinc",
"Filter/Effect/Audio",
GstPad *sinkpad, *srcpad;
double frequency;
- int wing_size; /* length of a "wing" of the filter;
- actual length is 2 * wing_size + 1 */
+ int wing_size; /* length of a "wing" of the filter;
+ actual length is 2 * wing_size + 1 */
- gfloat *residue; /* buffer for left-over samples from previous buffer */
+ gfloat *residue; /* buffer for left-over samples from previous buffer */
double *kernel;
};
};
lpwsinc_type = g_type_register_static (GST_TYPE_ELEMENT, "GstLPWSinc",
- &lpwsinc_info, 0);
+ &lpwsinc_info, 0);
}
return lpwsinc_type;
}
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_FREQUENCY,
g_param_spec_double ("frequency", "Frequency",
- "Cut-off Frequency relative to sample rate)",
- 0.0, 0.5, 0, G_PARAM_READWRITE));
+ "Cut-off Frequency relative to sample rate)",
+ 0.0, 0.5, 0, G_PARAM_READWRITE));
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_LENGTH,
g_param_spec_int ("length", "Length",
- "N such that the filter length = 2N + 1",
- 1, G_MAXINT, 1, G_PARAM_READWRITE));
+ "N such that the filter length = 2N + 1",
+ 1, G_MAXINT, 1, G_PARAM_READWRITE));
gobject_class->set_property = gst_lpwsinc_set_property;
gobject_class->get_property = gst_lpwsinc_get_property;
for (i = 0; i <= len * 2; ++i) {
if (i == len)
- filter->kernel[i] = 2 * M_PI * filter->frequency;
+ filter->kernel[i] = 2 * M_PI * filter->frequency;
else
- filter->kernel[i] = sin (2 * M_PI * filter->frequency * (i - len))
- / (i - len);
+ filter->kernel[i] = sin (2 * M_PI * filter->frequency * (i - len))
+ / (i - len);
/* windowing */
filter->kernel[i] *= (0.54 - 0.46 * cos (M_PI * i / len));
}
GST_PAD_SRC,
GST_PAD_ALWAYS,
GST_STATIC_CAPS (GST_AUDIO_INT_PAD_TEMPLATE_CAPS "; "
- "audio/x-alaw, "
- "rate = (int) [ 8000, 48000 ], " "channels = (int) [ 1, 2 ]")
+ "audio/x-alaw, "
+ "rate = (int) [ 8000, 48000 ], " "channels = (int) [ 1, 2 ]")
);
/* AuParse signals and args */
0,
(GInstanceInitFunc) gst_auparse_init,
};
+
auparse_type =
- g_type_register_static (GST_TYPE_ELEMENT, "GstAuParse", &auparse_info,
- 0);
+ g_type_register_static (GST_TYPE_ELEMENT, "GstAuParse", &auparse_info,
+ 0);
}
return auparse_type;
}
}
g_print
- ("offset %ld, size %ld, encoding %ld, frequency %ld, channels %ld\n",
- auparse->offset, auparse->size, auparse->encoding, auparse->frequency,
- auparse->channels);
+ ("offset %ld, size %ld, encoding %ld, frequency %ld, channels %ld\n",
+ auparse->offset, auparse->size, auparse->encoding, auparse->frequency,
+ auparse->channels);
GST_DEBUG
- ("offset %ld, size %ld, encoding %ld, frequency %ld, channels %ld",
- auparse->offset, auparse->size, auparse->encoding, auparse->frequency,
- auparse->channels);
+ ("offset %ld, size %ld, encoding %ld, frequency %ld, channels %ld",
+ auparse->offset, auparse->size, auparse->encoding, auparse->frequency,
+ auparse->channels);
switch (auparse->encoding) {
case 1:
- law = 1;
- depth = 8;
- sign = FALSE;
- break;
+ law = 1;
+ depth = 8;
+ sign = FALSE;
+ break;
case 2:
- law = 0;
- depth = 8;
- sign = FALSE;
- break;
+ law = 0;
+ depth = 8;
+ sign = FALSE;
+ break;
case 3:
- law = 0;
- depth = 16;
- sign = TRUE;
- break;
+ law = 0;
+ depth = 16;
+ sign = TRUE;
+ break;
default:
- g_warning ("help!, dont know how to deal with this format yet\n");
- return;
+ g_warning ("help!, dont know how to deal with this format yet\n");
+ return;
}
if (law) {
tempcaps = gst_caps_new_simple ("audio/x-alaw",
- "rate", G_TYPE_INT, auparse->frequency,
- "channels", G_TYPE_INT, auparse->channels, NULL);
+ "rate", G_TYPE_INT, auparse->frequency,
+ "channels", G_TYPE_INT, auparse->channels, NULL);
} else {
tempcaps = gst_caps_new_simple ("audio/x-raw-int",
- "endianness", G_TYPE_INT, G_BIG_ENDIAN,
- "rate", G_TYPE_INT, auparse->frequency,
- "channels", G_TYPE_INT, auparse->channels,
- "depth", G_TYPE_INT, depth,
- "width", G_TYPE_INT, depth, "signed", G_TYPE_BOOLEAN, sign, NULL);
+ "endianness", G_TYPE_INT, G_BIG_ENDIAN,
+ "rate", G_TYPE_INT, auparse->frequency,
+ "channels", G_TYPE_INT, auparse->channels,
+ "depth", G_TYPE_INT, depth,
+ "width", G_TYPE_INT, depth, "signed", G_TYPE_BOOLEAN, sign, NULL);
}
if (!gst_pad_set_explicit_caps (auparse->srcpad, tempcaps)) {
plugin_init (GstPlugin * plugin)
{
if (!gst_element_register (plugin, "auparse", GST_RANK_SECONDARY,
- GST_TYPE_AUPARSE)) {
+ GST_TYPE_AUPARSE)) {
return FALSE;
}
#endif /* ENABLE_NLS */
return (gst_element_register (plugin, "avidemux",
- GST_RANK_PRIMARY,
- GST_TYPE_AVI_DEMUX) &&
+ GST_RANK_PRIMARY,
+ GST_TYPE_AVI_DEMUX) &&
gst_element_register (plugin, "avimux", GST_RANK_NONE, GST_TYPE_AVIMUX));
}
GST_PAD_SINK,
GST_PAD_ALWAYS,
GST_CAPS_NEW ("avidecoder_sink",
- "video/avi", "RIFF", GST_PROPS_STRING ("AVI")
+ "video/avi", "RIFF", GST_PROPS_STRING ("AVI")
)
)
GST_PAD_SRC,
GST_PAD_ALWAYS,
GST_CAPS_NEW ("wincodec_src",
- "video/raw",
- "format", GST_PROPS_LIST (GST_PROPS_FOURCC (GST_MAKE_FOURCC ('Y', 'U', 'Y',
- '2')), GST_PROPS_FOURCC (GST_MAKE_FOURCC ('I', '4', '2', '0')),
- GST_PROPS_FOURCC (GST_MAKE_FOURCC ('R', 'G', 'B', ' '))
- ), "width", GST_PROPS_INT_RANGE (16, 4096), "height",
- GST_PROPS_INT_RANGE (16, 4096)
+ "video/raw",
+ "format", GST_PROPS_LIST (GST_PROPS_FOURCC (GST_MAKE_FOURCC ('Y', 'U', 'Y',
+ '2')), GST_PROPS_FOURCC (GST_MAKE_FOURCC ('I', '4', '2', '0')),
+ GST_PROPS_FOURCC (GST_MAKE_FOURCC ('R', 'G', 'B', ' '))
+ ), "width", GST_PROPS_INT_RANGE (16, 4096), "height",
+ GST_PROPS_INT_RANGE (16, 4096)
)
)
GST_PAD_SRC,
GST_PAD_ALWAYS,
GST_CAPS_NEW ("src_audio",
- "audio/raw",
- "format", GST_PROPS_STRING ("int"),
- "law", GST_PROPS_INT (0),
- "endianness", GST_PROPS_INT (G_BYTE_ORDER),
- "signed", GST_PROPS_LIST (GST_PROPS_BOOLEAN (TRUE),
- GST_PROPS_BOOLEAN (FALSE)
- ), "width", GST_PROPS_LIST (GST_PROPS_INT (8), GST_PROPS_INT (16)
- ), "depth", GST_PROPS_LIST (GST_PROPS_INT (8), GST_PROPS_INT (16)
- ),
- "rate", GST_PROPS_INT_RANGE (11025, 48000),
- "channels", GST_PROPS_INT_RANGE (1, 2)
+ "audio/raw",
+ "format", GST_PROPS_STRING ("int"),
+ "law", GST_PROPS_INT (0),
+ "endianness", GST_PROPS_INT (G_BYTE_ORDER),
+ "signed", GST_PROPS_LIST (GST_PROPS_BOOLEAN (TRUE),
+ GST_PROPS_BOOLEAN (FALSE)
+ ), "width", GST_PROPS_LIST (GST_PROPS_INT (8), GST_PROPS_INT (16)
+ ), "depth", GST_PROPS_LIST (GST_PROPS_INT (8), GST_PROPS_INT (16)
+ ),
+ "rate", GST_PROPS_INT_RANGE (11025, 48000),
+ "channels", GST_PROPS_INT_RANGE (1, 2)
)
)
0,
(GInstanceInitFunc) gst_avi_decoder_init,
};
+
avi_decoder_type =
- g_type_register_static (GST_TYPE_BIN, "GstAviDecoder",
- &avi_decoder_info, 0);
+ g_type_register_static (GST_TYPE_BIN, "GstAviDecoder",
+ &avi_decoder_info, 0);
}
return avi_decoder_type;
}
gobject_class = (GObjectClass *) klass;
gstelement_class = (GstElementClass *) klass;
- g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_BITRATE, g_param_spec_long ("bitrate", "bitrate", "bitrate", G_MINLONG, G_MAXLONG, 0, G_PARAM_READABLE)); /* CHECKME */
- g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_MEDIA_TIME, g_param_spec_long ("media_time", "media_time", "media_time", G_MINLONG, G_MAXLONG, 0, G_PARAM_READABLE)); /* CHECKME */
- g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_CURRENT_TIME, g_param_spec_long ("current_time", "current_time", "current_time", G_MINLONG, G_MAXLONG, 0, G_PARAM_READABLE)); /* CHECKME */
+ g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_BITRATE, g_param_spec_long ("bitrate", "bitrate", "bitrate", G_MINLONG, G_MAXLONG, 0, G_PARAM_READABLE)); /* CHECKME */
+ g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_MEDIA_TIME, g_param_spec_long ("media_time", "media_time", "media_time", G_MINLONG, G_MAXLONG, 0, G_PARAM_READABLE)); /* CHECKME */
+ g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_CURRENT_TIME, g_param_spec_long ("current_time", "current_time", "current_time", G_MINLONG, G_MAXLONG, 0, G_PARAM_READABLE)); /* CHECKME */
parent_class = g_type_class_ref (GST_TYPE_BIN);
if (!strcmp (format, "strf_vids")) {
targetcaps =
- gst_padtemplate_get_caps (GST_PADTEMPLATE_GET (src_video_templ));
+ gst_padtemplate_get_caps (GST_PADTEMPLATE_GET (src_video_templ));
media_type = AVI_TYPE_VIDEO;
gpadname = g_strdup_printf ("video_%02d", avi_decoder->video_count++);
} else if (!strcmp (format, "strf_auds")) {
targetcaps =
- gst_padtemplate_get_caps (GST_PADTEMPLATE_GET (src_audio_templ));
+ gst_padtemplate_get_caps (GST_PADTEMPLATE_GET (src_audio_templ));
media_type = AVI_TYPE_AUDIO;
gpadname = g_strdup_printf ("audio_%02d", avi_decoder->audio_count++);
} else if (!strcmp (format, "strf_iavs")) {
targetcaps =
- gst_padtemplate_get_caps (GST_PADTEMPLATE_GET (src_video_templ));
+ gst_padtemplate_get_caps (GST_PADTEMPLATE_GET (src_video_templ));
media_type = AVI_TYPE_VIDEO;
gpadname = g_strdup_printf ("video_%02d", avi_decoder->video_count++);
} else {
if (gst_caps_is_always_compatible (caps, targetcaps)) {
gst_element_add_ghost_pad (GST_ELEMENT (avi_decoder),
- gst_element_get_pad (type, "src"), gpadname);
+ gst_element_get_pad (type, "src"), gpadname);
avi_decoder->count++;
goto done;
if (new_element) {
gst_pad_connect (pad, gst_element_get_pad (new_element, "sink"));
gst_element_set_name (new_element, g_strdup_printf ("element%d",
- avi_decoder->count));
+ avi_decoder->count));
gst_bin_add (GST_BIN (avi_decoder), new_element);
gst_element_add_ghost_pad (GST_ELEMENT (avi_decoder),
- gst_element_get_pad (new_element, padname), gpadname);
+ gst_element_get_pad (new_element, padname), gpadname);
avi_decoder->count++;
} else {
gst_bin_add (GST_BIN (avi_decoder), avi_decoder->demuxer);
gst_element_add_ghost_pad (GST_ELEMENT (avi_decoder),
- gst_element_get_pad (avi_decoder->demuxer, "sink"), "sink");
+ gst_element_get_pad (avi_decoder->demuxer, "sink"), "sink");
g_signal_connect (G_OBJECT (avi_decoder->demuxer), "new_pad",
- G_CALLBACK (gst_avi_decoder_new_pad), avi_decoder);
+ G_CALLBACK (gst_avi_decoder_new_pad), avi_decoder);
} else {
g_warning ("wow!, no avi demuxer found. help me\n");
}
break;
case ARG_MEDIA_TIME:
g_value_set_long (value, gst_util_get_long_arg (G_OBJECT (src->demuxer),
- "media_time"));
+ "media_time"));
break;
case ARG_CURRENT_TIME:
g_value_set_long (value, gst_util_get_long_arg (G_OBJECT (src->demuxer),
- "current_time"));
+ "current_time"));
break;
default:
break;
};
avi_demux_type =
- g_type_register_static (GST_TYPE_RIFF_READ,
- "GstAviDemux", &avi_demux_info, 0);
+ g_type_register_static (GST_TYPE_RIFF_READ,
+ "GstAviDemux", &avi_demux_info, 0);
}
return avi_demux_type;
g_object_class_install_property (gobject_class, ARG_STREAMINFO,
g_param_spec_boxed ("streaminfo", "Streaminfo", "Streaminfo",
- GST_TYPE_CAPS, G_PARAM_READABLE));
+ GST_TYPE_CAPS, G_PARAM_READABLE));
GST_DEBUG_CATEGORY_INIT (avidemux_debug, "avidemux",
0, "Demuxer for AVI streams");
switch (src_format) {
case GST_FORMAT_TIME:
switch (*dest_format) {
- case GST_FORMAT_BYTES:
- *dest_value = src_value * stream->strh->rate /
- (stream->strh->scale * GST_SECOND);
- break;
- case GST_FORMAT_DEFAULT:
- *dest_value = src_value * stream->strh->rate /
- (stream->strh->scale * GST_SECOND);
- break;
- default:
- res = FALSE;
- break;
+ case GST_FORMAT_BYTES:
+ *dest_value = src_value * stream->strh->rate /
+ (stream->strh->scale * GST_SECOND);
+ break;
+ case GST_FORMAT_DEFAULT:
+ *dest_value = src_value * stream->strh->rate /
+ (stream->strh->scale * GST_SECOND);
+ break;
+ default:
+ res = FALSE;
+ break;
}
break;
case GST_FORMAT_BYTES:
switch (*dest_format) {
- case GST_FORMAT_TIME:
- *dest_value = ((gfloat) src_value) * GST_SECOND / stream->strh->rate;
- break;
- default:
- res = FALSE;
- break;
+ case GST_FORMAT_TIME:
+ *dest_value = ((gfloat) src_value) * GST_SECOND / stream->strh->rate;
+ break;
+ default:
+ res = FALSE;
+ break;
}
break;
case GST_FORMAT_DEFAULT:
switch (*dest_format) {
- case GST_FORMAT_TIME:
- *dest_value = ((((gfloat) src_value) * stream->strh->scale) /
- stream->strh->rate) * GST_SECOND;
- break;
- default:
- res = FALSE;
- break;
+ case GST_FORMAT_TIME:
+ *dest_value = ((((gfloat) src_value) * stream->strh->scale) /
+ stream->strh->rate) * GST_SECOND;
+ break;
+ default:
+ res = FALSE;
+ break;
}
break;
default:
switch (type) {
case GST_QUERY_TOTAL:
switch (*format) {
- case GST_FORMAT_TIME:
- *value = (((gfloat) stream->strh->scale) * stream->strh->length /
- stream->strh->rate) * GST_SECOND;
- break;
- case GST_FORMAT_BYTES:
- if (stream->strh->type == GST_RIFF_FCC_auds) {
- *value = stream->total_bytes;
- } else
- res = FALSE;
- break;
- case GST_FORMAT_DEFAULT:
- if (stream->strh->type == GST_RIFF_FCC_auds)
- *value = stream->strh->length * stream->strh->samplesize;
- else if (stream->strh->type == GST_RIFF_FCC_vids)
- *value = stream->strh->length;
- else
- res = FALSE;
- break;
- default:
- res = FALSE;
- break;
+ case GST_FORMAT_TIME:
+ *value = (((gfloat) stream->strh->scale) * stream->strh->length /
+ stream->strh->rate) * GST_SECOND;
+ break;
+ case GST_FORMAT_BYTES:
+ if (stream->strh->type == GST_RIFF_FCC_auds) {
+ *value = stream->total_bytes;
+ } else
+ res = FALSE;
+ break;
+ case GST_FORMAT_DEFAULT:
+ if (stream->strh->type == GST_RIFF_FCC_auds)
+ *value = stream->strh->length * stream->strh->samplesize;
+ else if (stream->strh->type == GST_RIFF_FCC_vids)
+ *value = stream->strh->length;
+ else
+ res = FALSE;
+ break;
+ default:
+ res = FALSE;
+ break;
}
break;
case GST_QUERY_POSITION:
switch (*format) {
- case GST_FORMAT_TIME:
- if (stream->strh->samplesize &&
- stream->strh->type == GST_RIFF_FCC_auds) {
- *value = ((gfloat) stream->current_byte) * GST_SECOND /
- stream->strh->rate;
- } else {
- *value = (((gfloat) stream->current_frame) * stream->strh->scale /
- stream->strh->rate) * GST_SECOND;
- }
- break;
- case GST_FORMAT_BYTES:
- *value = stream->current_byte;
- break;
- case GST_FORMAT_DEFAULT:
- if (stream->strh->samplesize &&
- stream->strh->type == GST_RIFF_FCC_auds)
- *value = stream->current_byte * stream->strh->samplesize;
- else
- *value = stream->current_frame;
- break;
- default:
- res = FALSE;
- break;
+ case GST_FORMAT_TIME:
+ if (stream->strh->samplesize &&
+ stream->strh->type == GST_RIFF_FCC_auds) {
+ *value = ((gfloat) stream->current_byte) * GST_SECOND /
+ stream->strh->rate;
+ } else {
+ *value = (((gfloat) stream->current_frame) * stream->strh->scale /
+ stream->strh->rate) * GST_SECOND;
+ }
+ break;
+ case GST_FORMAT_BYTES:
+ *value = stream->current_byte;
+ break;
+ case GST_FORMAT_DEFAULT:
+ if (stream->strh->samplesize &&
+ stream->strh->type == GST_RIFF_FCC_auds)
+ *value = stream->current_byte * stream->strh->samplesize;
+ else
+ *value = stream->current_frame;
+ break;
+ default:
+ res = FALSE;
+ break;
}
break;
default:
GST_DEBUG ("finding %d for time %" G_GINT64_FORMAT, i, time);
entry = gst_avi_demux_index_entry_for_time (avi, stream->num, time,
- GST_RIFF_IF_KEYFRAME);
+ GST_RIFF_IF_KEYFRAME);
if (entry) {
min_index = MIN (entry->index_nr, min_index);
}
next_entry = gst_avi_demux_index_next (avi, stream->num, min_index, 0);
/* next entry with keyframe */
entry = gst_avi_demux_index_next (avi, stream->num, min_index,
- GST_RIFF_IF_KEYFRAME);
+ GST_RIFF_IF_KEYFRAME);
stream->current_byte = next_entry->bytes_before;
stream->current_frame = next_entry->frames_before;
* failed on this pad */
gst_event_ref (event);
if (gst_avi_demux_handle_src_event (pad, event)) {
- gst_event_unref (event);
+ gst_event_unref (event);
- return TRUE;
+ return TRUE;
}
}
switch (GST_EVENT_TYPE (event)) {
case GST_EVENT_SEEK:
GST_DEBUG ("seek format %d, %08x", GST_EVENT_SEEK_FORMAT (event),
- stream->strh->type);
+ stream->strh->type);
switch (GST_EVENT_SEEK_FORMAT (event)) {
- case GST_FORMAT_BYTES:
- case GST_FORMAT_DEFAULT:
- case GST_FORMAT_TIME:{
- gst_avi_index_entry *seek_entry, *entry = NULL;
- gint64 desired_offset = GST_EVENT_SEEK_OFFSET (event);
- guint32 flags;
- guint64 min_index;
-
- /* no seek on audio yet */
- if (stream->strh->type == GST_RIFF_FCC_auds) {
- res = FALSE;
- goto done;
- }
- GST_DEBUG ("seeking to %" G_GINT64_FORMAT, desired_offset);
-
- flags = GST_RIFF_IF_KEYFRAME;
- switch (GST_EVENT_SEEK_FORMAT (event)) {
- case GST_FORMAT_BYTES:
- entry = gst_avi_demux_index_entry_for_byte (avi, stream->num,
- desired_offset, flags);
- break;
- case GST_FORMAT_DEFAULT:
- entry = gst_avi_demux_index_entry_for_frame (avi, stream->num,
- desired_offset, flags);
- break;
- case GST_FORMAT_TIME:
- entry = gst_avi_demux_index_entry_for_time (avi, stream->num,
- desired_offset, flags);
- break;
- }
-
- if (entry) {
- min_index = gst_avi_demux_sync_streams (avi, entry->ts);
- seek_entry = &avi->index_entries[min_index];
-
- avi->seek_offset = seek_entry->offset + avi->index_offset;
- avi->last_seek = entry->ts;
- } else {
- GST_DEBUG ("no index entry found for format=%d value=%"
- G_GINT64_FORMAT, GST_EVENT_SEEK_FORMAT (event), desired_offset);
- res = FALSE;
- }
- break;
- }
- default:
- res = FALSE;
- break;
+ case GST_FORMAT_BYTES:
+ case GST_FORMAT_DEFAULT:
+ case GST_FORMAT_TIME:{
+ gst_avi_index_entry *seek_entry, *entry = NULL;
+ gint64 desired_offset = GST_EVENT_SEEK_OFFSET (event);
+ guint32 flags;
+ guint64 min_index;
+
+ /* no seek on audio yet */
+ if (stream->strh->type == GST_RIFF_FCC_auds) {
+ res = FALSE;
+ goto done;
+ }
+ GST_DEBUG ("seeking to %" G_GINT64_FORMAT, desired_offset);
+
+ flags = GST_RIFF_IF_KEYFRAME;
+ switch (GST_EVENT_SEEK_FORMAT (event)) {
+ case GST_FORMAT_BYTES:
+ entry = gst_avi_demux_index_entry_for_byte (avi, stream->num,
+ desired_offset, flags);
+ break;
+ case GST_FORMAT_DEFAULT:
+ entry = gst_avi_demux_index_entry_for_frame (avi, stream->num,
+ desired_offset, flags);
+ break;
+ case GST_FORMAT_TIME:
+ entry = gst_avi_demux_index_entry_for_time (avi, stream->num,
+ desired_offset, flags);
+ break;
+ }
+
+ if (entry) {
+ min_index = gst_avi_demux_sync_streams (avi, entry->ts);
+ seek_entry = &avi->index_entries[min_index];
+
+ avi->seek_offset = seek_entry->offset + avi->index_offset;
+ avi->last_seek = entry->ts;
+ } else {
+ GST_DEBUG ("no index entry found for format=%d value=%"
+ G_GINT64_FORMAT, GST_EVENT_SEEK_FORMAT (event), desired_offset);
+ res = FALSE;
+ }
+ break;
+ }
+ default:
+ res = FALSE;
+ break;
}
break;
default:
}
if (GST_BUFFER_SIZE (buf) < sizeof (gst_riff_avih)) {
g_warning ("Too small avih (%d available, %d needed)",
- GST_BUFFER_SIZE (buf), (int) sizeof (gst_riff_avih));
+ GST_BUFFER_SIZE (buf), (int) sizeof (gst_riff_avih));
gst_buffer_unref (buf);
return FALSE;
}
gst_riff_strf_vids *vids;
gst_riff_strf_auds *auds;
gst_riff_strf_iavs *iavs;
- } strf;
+ }
+ strf;
/* the stream starts with a 'strh' header */
if (!(tag = gst_riff_peek_tag (riff, NULL)))
return FALSE;
if (tag != GST_RIFF_TAG_strf) {
GST_ELEMENT_ERROR (avi, STREAM, DEMUX, (NULL),
- ("Invalid AVI header (no strf as second tag)"));
+ ("Invalid AVI header (no strf as second tag)"));
goto skip_stream;
}
switch (strh->type) {
case GST_RIFF_FCC_vids:
if (!gst_riff_read_strf_vids (riff, &strf.vids))
- return FALSE;
+ return FALSE;
break;
case GST_RIFF_FCC_auds:
if (!gst_riff_read_strf_auds (riff, &strf.auds))
- return FALSE;
+ return FALSE;
break;
case GST_RIFF_FCC_iavs:
if (!gst_riff_read_strf_iavs (riff, &strf.iavs))
- return FALSE;
+ return FALSE;
break;
default:
g_warning ("Unknown stream type " GST_FOURCC_FORMAT,
- GST_FOURCC_ARGS (strh->type));
+ GST_FOURCC_ARGS (strh->type));
goto skip_stream;
}
switch (tag) {
case GST_RIFF_TAG_strn:
- if (name)
- g_free (name);
- if (!gst_riff_read_ascii (riff, &tag, &name))
- return FALSE;
- break;
+ if (name)
+ g_free (name);
+ if (!gst_riff_read_ascii (riff, &tag, &name))
+ return FALSE;
+ break;
default:
- GST_WARNING ("Unknown tag " GST_FOURCC_FORMAT " in AVI header",
- GST_FOURCC_ARGS (tag));
- /* fall-through */
+ GST_WARNING ("Unknown tag " GST_FOURCC_FORMAT " in AVI header",
+ GST_FOURCC_ARGS (tag));
+ /* fall-through */
- case GST_RIFF_TAG_strd: /* what is this? */
+ case GST_RIFF_TAG_strd: /* what is this? */
case GST_RIFF_TAG_JUNK:
- if (!gst_riff_read_skip (riff))
- return FALSE;
- break;
+ if (!gst_riff_read_skip (riff))
+ return FALSE;
+ break;
}
if (avi->level_up) {
padname = g_strdup_printf ("video_%02d", avi->num_v_streams);
templ = gst_element_class_get_pad_template (klass, "video_%02d");
caps = gst_riff_create_video_caps (strf.vids->compression, strh,
- strf.vids, &codec_name);
+ strf.vids, &codec_name);
gst_tag_list_add (list, GST_TAG_MERGE_APPEND, GST_TAG_VIDEO_CODEC,
- codec_name, NULL);
+ codec_name, NULL);
gst_element_found_tags (GST_ELEMENT (avi), list);
gst_tag_list_free (list);
if (codec_name)
- g_free (codec_name);
+ g_free (codec_name);
g_free (strf.vids);
avi->num_v_streams++;
break;
padname = g_strdup_printf ("audio_%02d", avi->num_a_streams);
templ = gst_element_class_get_pad_template (klass, "audio_%02d");
caps = gst_riff_create_audio_caps (strf.auds->format, strh, strf.auds,
- &codec_name);
+ &codec_name);
gst_tag_list_add (list, GST_TAG_MERGE_APPEND, GST_TAG_AUDIO_CODEC,
- codec_name, NULL);
+ codec_name, NULL);
gst_element_found_tags (GST_ELEMENT (avi), list);
gst_tag_list_free (list);
if (codec_name)
- g_free (codec_name);
+ g_free (codec_name);
g_free (strf.auds);
avi->num_a_streams++;
break;
padname = g_strdup_printf ("video_%02d", avi->num_v_streams);
templ = gst_element_class_get_pad_template (klass, "video_%02d");
caps = gst_riff_create_iavs_caps (strh->fcc_handler, strh, strf.iavs,
- &codec_name);
+ &codec_name);
gst_tag_list_add (list, GST_TAG_MERGE_APPEND, GST_TAG_VIDEO_CODEC,
- codec_name, NULL);
+ codec_name, NULL);
gst_element_found_tags (GST_ELEMENT (avi), list);
gst_tag_list_free (list);
if (codec_name)
- g_free (codec_name);
+ g_free (codec_name);
g_free (strf.iavs);
avi->num_v_streams++;
break;
/* add a "NULL" stream */
avi->num_streams++;
- return TRUE; /* recoverable */
+ return TRUE; /* recoverable */
}
/*
switch (tag) {
case GST_RIFF_TAG_dmlh:{
- gst_riff_dmlh dmlh, *_dmlh;
- GstBuffer *buf;
-
- if (!gst_riff_read_data (riff, &tag, &buf))
- return FALSE;
- if (GST_BUFFER_SIZE (buf) < sizeof (gst_riff_dmlh)) {
- g_warning ("DMLH entry is too small (%d bytes, %d needed)",
- GST_BUFFER_SIZE (buf), (int) sizeof (gst_riff_dmlh));
- gst_buffer_unref (buf);
- break;
- }
- _dmlh = (gst_riff_dmlh *) GST_BUFFER_DATA (buf);
- dmlh.totalframes = GUINT32_FROM_LE (_dmlh->totalframes);
-
- GST_INFO ("dmlh tag found:");
- GST_INFO (" totalframes: %u", dmlh.totalframes);
-
- avi->num_frames = dmlh.totalframes;
- gst_buffer_unref (buf);
- break;
+ gst_riff_dmlh dmlh, *_dmlh;
+ GstBuffer *buf;
+
+ if (!gst_riff_read_data (riff, &tag, &buf))
+ return FALSE;
+ if (GST_BUFFER_SIZE (buf) < sizeof (gst_riff_dmlh)) {
+ g_warning ("DMLH entry is too small (%d bytes, %d needed)",
+ GST_BUFFER_SIZE (buf), (int) sizeof (gst_riff_dmlh));
+ gst_buffer_unref (buf);
+ break;
+ }
+ _dmlh = (gst_riff_dmlh *) GST_BUFFER_DATA (buf);
+ dmlh.totalframes = GUINT32_FROM_LE (_dmlh->totalframes);
+
+ GST_INFO ("dmlh tag found:");
+ GST_INFO (" totalframes: %u", dmlh.totalframes);
+
+ avi->num_frames = dmlh.totalframes;
+ gst_buffer_unref (buf);
+ break;
}
default:
- GST_WARNING ("Unknown tag " GST_FOURCC_FORMAT " in AVI header",
- GST_FOURCC_ARGS (tag));
- /* fall-through */
+ GST_WARNING ("Unknown tag " GST_FOURCC_FORMAT " in AVI header",
+ GST_FOURCC_ARGS (tag));
+ /* fall-through */
case GST_RIFF_TAG_JUNK:
- if (!gst_riff_read_skip (riff))
- return FALSE;
- break;
+ if (!gst_riff_read_skip (riff))
+ return FALSE;
+ break;
}
if (avi->level_up) {
return FALSE;
if (tag != GST_RIFF_TAG_idx1) {
g_warning ("No index after data, but " GST_FOURCC_FORMAT,
- GST_FOURCC_ARGS (tag));
+ GST_FOURCC_ARGS (tag));
goto end;
}
/* figure out if the index is 0 based or relative to the MOVI start */
if (i == 0) {
if (target->offset < pos_before)
- avi->index_offset = pos_before + 8;
+ avi->index_offset = pos_before + 8;
else
- avi->index_offset = 0;
+ avi->index_offset = 0;
}
target->bytes_before = stream->total_bytes;
if (stream->strh->samplesize && stream->strh->type == GST_RIFF_FCC_auds) {
/* constant rate stream */
gst_pad_convert (stream->pad, GST_FORMAT_BYTES,
- stream->total_bytes, &format, &target->ts);
+ stream->total_bytes, &format, &target->ts);
} else {
/* VBR stream */
gst_pad_convert (stream->pad, GST_FORMAT_DEFAULT,
- stream->total_frames, &format, &target->ts);
+ stream->total_frames, &format, &target->ts);
}
stream->total_bytes += target->size;
stream = &avi->stream[i];
GST_DEBUG ("stream %u: %u frames, %" G_GINT64_FORMAT " bytes",
- i, stream->total_frames, stream->total_bytes);
+ i, stream->total_frames, stream->total_bytes);
}
end:
return FALSE;
if (tag != GST_RIFF_TAG_LIST) {
GST_ELEMENT_ERROR (avi, STREAM, DEMUX, (NULL),
- ("Invalid AVI header (no LIST at start): "
- GST_FOURCC_FORMAT, GST_FOURCC_ARGS (tag)));
+ ("Invalid AVI header (no LIST at start): "
+ GST_FOURCC_FORMAT, GST_FOURCC_ARGS (tag)));
return FALSE;
}
if (!gst_riff_read_list (riff, &tag))
return FALSE;
if (tag != GST_RIFF_LIST_hdrl) {
GST_ELEMENT_ERROR (avi, STREAM, DEMUX, (NULL),
- ("Invalid AVI header (no hdrl at start): "
- GST_FOURCC_FORMAT, GST_FOURCC_ARGS (tag)));
+ ("Invalid AVI header (no hdrl at start): "
+ GST_FOURCC_FORMAT, GST_FOURCC_ARGS (tag)));
return FALSE;
}
return FALSE;
if (tag != GST_RIFF_TAG_avih) {
GST_ELEMENT_ERROR (avi, STREAM, DEMUX, (NULL),
- ("Invalid AVI header (no avih at start): "
- GST_FOURCC_FORMAT, GST_FOURCC_ARGS (tag)));
+ ("Invalid AVI header (no avih at start): "
+ GST_FOURCC_FORMAT, GST_FOURCC_ARGS (tag)));
return FALSE;
}
if (!gst_avi_demux_stream_avih (avi, &flags, &streams))
switch (tag) {
case GST_RIFF_TAG_LIST:
- if (!(tag = gst_riff_peek_list (riff)))
- return FALSE;
-
- switch (tag) {
- case GST_RIFF_LIST_strl:
- if (!gst_riff_read_list (riff, &tag) ||
- !gst_avi_demux_add_stream (avi))
- return FALSE;
- break;
-
- case GST_RIFF_LIST_odml:
- if (!gst_riff_read_list (riff, &tag) ||
- !gst_avi_demux_stream_odml (avi))
- return FALSE;
- break;
-
- default:
- GST_WARNING ("Unknown list " GST_FOURCC_FORMAT " in AVI header",
- GST_FOURCC_ARGS (tag));
- /* fall-through */
-
- case GST_RIFF_TAG_JUNK:
- if (!gst_riff_read_skip (riff))
- return FALSE;
- break;
- }
-
- break;
+ if (!(tag = gst_riff_peek_list (riff)))
+ return FALSE;
+
+ switch (tag) {
+ case GST_RIFF_LIST_strl:
+ if (!gst_riff_read_list (riff, &tag) ||
+ !gst_avi_demux_add_stream (avi))
+ return FALSE;
+ break;
+
+ case GST_RIFF_LIST_odml:
+ if (!gst_riff_read_list (riff, &tag) ||
+ !gst_avi_demux_stream_odml (avi))
+ return FALSE;
+ break;
+
+ default:
+ GST_WARNING ("Unknown list " GST_FOURCC_FORMAT " in AVI header",
+ GST_FOURCC_ARGS (tag));
+ /* fall-through */
+
+ case GST_RIFF_TAG_JUNK:
+ if (!gst_riff_read_skip (riff))
+ return FALSE;
+ break;
+ }
+
+ break;
default:
- GST_WARNING ("Unknown tag " GST_FOURCC_FORMAT " in AVI header",
- GST_FOURCC_ARGS (tag));
- /* fall-through */
+ GST_WARNING ("Unknown tag " GST_FOURCC_FORMAT " in AVI header",
+ GST_FOURCC_ARGS (tag));
+ /* fall-through */
case GST_RIFF_TAG_JUNK:
- if (!gst_riff_read_skip (riff))
- return FALSE;
- break;
+ if (!gst_riff_read_skip (riff))
+ return FALSE;
+ break;
}
if (avi->level_up) {
if (avi->num_streams != streams) {
g_warning ("Stream header mentioned %d streams, but %d available",
- streams, avi->num_streams);
+ streams, avi->num_streams);
}
/* we've got streaminfo now */
return FALSE;
if (tag != GST_RIFF_TAG_LIST) {
if (!gst_riff_read_skip (riff))
- return FALSE;
+ return FALSE;
continue;
}
if (!(tag = gst_riff_peek_list (riff)))
return FALSE;
if (tag != GST_RIFF_LIST_movi) {
if (tag == GST_RIFF_LIST_INFO) {
- if (!gst_riff_read_list (riff, &tag) || !gst_riff_read_info (riff))
- return FALSE;
+ if (!gst_riff_read_list (riff, &tag) || !gst_riff_read_info (riff))
+ return FALSE;
} else if (!gst_riff_read_skip (riff)) {
- return FALSE;
+ return FALSE;
}
continue;
}
if (GST_PAD_IS_USABLE (stream->pad)) {
event = gst_event_new_discontinuous (FALSE, GST_FORMAT_TIME,
- avi->last_seek + stream->delay, NULL);
+ avi->last_seek + stream->delay, NULL);
gst_pad_push (stream->pad, GST_DATA (event));
}
}
switch (tag) {
case GST_RIFF_TAG_LIST:
- if (!(tag = gst_riff_peek_list (riff)))
- return FALSE;
-
- switch (tag) {
- case GST_RIFF_LIST_AVIX:
- case GST_RIFF_LIST_movi:
- if (!gst_riff_read_list (riff, &tag))
- return FALSE;
- /* we're now going to read buffers! */
- break;
-
- default:
- GST_WARNING ("Unknown list " GST_FOURCC_FORMAT " before AVI data",
- GST_FOURCC_ARGS (tag));
- /* fall-through */
-
- case GST_RIFF_TAG_JUNK:
- if (!gst_riff_read_skip (riff))
- return FALSE;
- break;
- }
-
- break;
+ if (!(tag = gst_riff_peek_list (riff)))
+ return FALSE;
+
+ switch (tag) {
+ case GST_RIFF_LIST_AVIX:
+ case GST_RIFF_LIST_movi:
+ if (!gst_riff_read_list (riff, &tag))
+ return FALSE;
+ /* we're now going to read buffers! */
+ break;
+
+ default:
+ GST_WARNING ("Unknown list " GST_FOURCC_FORMAT " before AVI data",
+ GST_FOURCC_ARGS (tag));
+ /* fall-through */
+
+ case GST_RIFF_TAG_JUNK:
+ if (!gst_riff_read_skip (riff))
+ return FALSE;
+ break;
+ }
+
+ break;
default:
- GST_WARNING ("Unknown tag " GST_FOURCC_FORMAT " before AVI data",
- GST_FOURCC_ARGS (tag));
- /* fall-through */
+ GST_WARNING ("Unknown tag " GST_FOURCC_FORMAT " before AVI data",
+ GST_FOURCC_ARGS (tag));
+ /* fall-through */
case GST_RIFF_TAG_idx1:
case GST_RIFF_TAG_JUNK:
- if (!gst_riff_read_skip (riff))
- return FALSE;
- break;
+ if (!gst_riff_read_skip (riff))
+ return FALSE;
+ break;
}
}
if (stream_nr < 0 || stream_nr >= avi->num_streams) {
/* recoverable */
g_warning ("Invalid stream ID %d (" GST_FOURCC_FORMAT ")",
- stream_nr, GST_FOURCC_ARGS (tag));
+ stream_nr, GST_FOURCC_ARGS (tag));
if (!gst_riff_read_skip (riff))
return FALSE;
} else {
/* get time of this buffer */
stream = &avi->stream[stream_nr];
entry = gst_avi_demux_index_next (avi, stream_nr,
- stream->current_entry + 1, 0);
+ stream->current_entry + 1, 0);
if (entry) {
stream->current_entry = entry->index_nr;
if (entry->flags & GST_RIFF_IF_KEYFRAME) {
- GST_BUFFER_FLAG_SET (buf, GST_BUFFER_KEY_UNIT);
+ GST_BUFFER_FLAG_SET (buf, GST_BUFFER_KEY_UNIT);
}
}
format = GST_FORMAT_TIME;
/* set delay (if any) */
if (stream->strh->init_frames == stream->current_frame &&
- stream->delay == 0)
+ stream->delay == 0)
stream->delay = next_ts;
stream->current_frame++;
gst_buffer_unref (buf);
} else {
if (!stream->pad || !GST_PAD_IS_USABLE (stream->pad)) {
- gst_buffer_unref (buf);
+ gst_buffer_unref (buf);
} else {
- GstClockTime dur_ts;
+ GstClockTime dur_ts;
- GST_BUFFER_TIMESTAMP (buf) = next_ts;
- gst_pad_query (stream->pad, GST_QUERY_POSITION, &format, &dur_ts);
- GST_BUFFER_DURATION (buf) = dur_ts - next_ts;
+ GST_BUFFER_TIMESTAMP (buf) = next_ts;
+ gst_pad_query (stream->pad, GST_QUERY_POSITION, &format, &dur_ts);
+ GST_BUFFER_DURATION (buf) = dur_ts - next_ts;
- gst_pad_push (stream->pad, GST_DATA (buf));
+ gst_pad_push (stream->pad, GST_DATA (buf));
}
}
}
switch (avi->state) {
case GST_AVI_DEMUX_START:
if (!gst_avi_demux_stream_init (avi))
- return;
+ return;
avi->state = GST_AVI_DEMUX_HEADER;
/* fall-through */
case GST_AVI_DEMUX_HEADER:
if (!gst_avi_demux_stream_header (avi))
- return;
+ return;
avi->state = GST_AVI_DEMUX_MOVI;
/* fall-through */
case GST_AVI_DEMUX_MOVI:
if (!gst_avi_demux_stream_data (avi))
- return;
+ return;
break;
default:
GST_PAD_SINK,
GST_PAD_REQUEST,
GST_STATIC_CAPS ("video/x-raw-yuv, "
- "format = (fourcc) { YUY2, I420 }, "
- "width = (int) [ 16, 4096 ], "
- "height = (int) [ 16, 4096 ]; "
- "video/x-jpeg, "
- "width = (int) [ 16, 4096 ], "
- "height = (int) [ 16, 4096 ]; "
- "video/x-divx, "
- "width = (int) [ 16, 4096 ], "
- "height = (int) [ 16, 4096 ], "
- "divxversion = (int) [ 3, 5 ]; "
- "video/x-xvid, "
- "width = (int) [ 16, 4096 ], "
- "height = (int) [ 16, 4096 ]; "
- "video/x-3ivx, "
- "width = (int) [ 16, 4096 ], "
- "height = (int) [ 16, 4096 ]; "
- "video/x-msmpeg, "
- "width = (int) [ 16, 4096 ], "
- "height = (int) [ 16, 4096 ], "
- "msmpegversion = (int) [ 41, 43 ]; "
- "video/mpeg, "
- "width = (int) [ 16, 4096 ], "
- "height = (int) [ 16, 4096 ], "
- "mpegversion = (int) 1, "
- "systemstream = (boolean) FALSE; "
- "video/x-h263, "
- "width = (int) [ 16, 4096 ], "
- "height = (int) [ 16, 4096 ]; "
- "video/x-dv, "
- "width = (int) 720, "
- "height = (int) { 576, 480 }, "
- "systemstream = (boolean) FALSE; "
- "video/x-huffyuv, "
- "width = (int) [ 16, 4096 ], " "height = (int) [ 16, 4096 ]")
+ "format = (fourcc) { YUY2, I420 }, "
+ "width = (int) [ 16, 4096 ], "
+ "height = (int) [ 16, 4096 ]; "
+ "video/x-jpeg, "
+ "width = (int) [ 16, 4096 ], "
+ "height = (int) [ 16, 4096 ]; "
+ "video/x-divx, "
+ "width = (int) [ 16, 4096 ], "
+ "height = (int) [ 16, 4096 ], "
+ "divxversion = (int) [ 3, 5 ]; "
+ "video/x-xvid, "
+ "width = (int) [ 16, 4096 ], "
+ "height = (int) [ 16, 4096 ]; "
+ "video/x-3ivx, "
+ "width = (int) [ 16, 4096 ], "
+ "height = (int) [ 16, 4096 ]; "
+ "video/x-msmpeg, "
+ "width = (int) [ 16, 4096 ], "
+ "height = (int) [ 16, 4096 ], "
+ "msmpegversion = (int) [ 41, 43 ]; "
+ "video/mpeg, "
+ "width = (int) [ 16, 4096 ], "
+ "height = (int) [ 16, 4096 ], "
+ "mpegversion = (int) 1, "
+ "systemstream = (boolean) FALSE; "
+ "video/x-h263, "
+ "width = (int) [ 16, 4096 ], "
+ "height = (int) [ 16, 4096 ]; "
+ "video/x-dv, "
+ "width = (int) 720, "
+ "height = (int) { 576, 480 }, "
+ "systemstream = (boolean) FALSE; "
+ "video/x-huffyuv, "
+ "width = (int) [ 16, 4096 ], " "height = (int) [ 16, 4096 ]")
);
static GstStaticPadTemplate audio_sink_factory =
GST_PAD_SINK,
GST_PAD_REQUEST,
GST_STATIC_CAPS ("audio/x-raw-int, "
- "endianness = (int) LITTLE_ENDIAN, "
- "signed = (boolean) { TRUE, FALSE }, "
- "width = (int) { 8, 16 }, "
- "depth = (int) { 8, 16 }, "
- "rate = (int) [ 1000, 96000 ], "
- "channels = (int) [ 1, 2 ]; "
- "audio/mpeg, "
- "mpegversion = (int) 1, "
- "layer = (int) [ 1, 3 ], "
- "rate = (int) [ 1000, 96000 ], "
- "channels = (int) [ 1, 2 ]; "
- "audio/x-vorbis, "
- "rate = (int) [ 1000, 96000 ], "
- "channels = (int) [ 1, 2 ]; "
- "audio/x-ac3, "
- "rate = (int) [ 1000, 96000 ], " "channels = (int) [ 1, 2 ]")
+ "endianness = (int) LITTLE_ENDIAN, "
+ "signed = (boolean) { TRUE, FALSE }, "
+ "width = (int) { 8, 16 }, "
+ "depth = (int) { 8, 16 }, "
+ "rate = (int) [ 1000, 96000 ], "
+ "channels = (int) [ 1, 2 ]; "
+ "audio/mpeg, "
+ "mpegversion = (int) 1, "
+ "layer = (int) [ 1, 3 ], "
+ "rate = (int) [ 1000, 96000 ], "
+ "channels = (int) [ 1, 2 ]; "
+ "audio/x-vorbis, "
+ "rate = (int) [ 1000, 96000 ], "
+ "channels = (int) [ 1, 2 ]; "
+ "audio/x-ac3, "
+ "rate = (int) [ 1000, 96000 ], " "channels = (int) [ 1, 2 ]")
);
0,
(GInstanceInitFunc) gst_avimux_init,
};
+
avimux_type =
- g_type_register_static (GST_TYPE_ELEMENT, "GstAviMux", &avimux_info, 0);
+ g_type_register_static (GST_TYPE_ELEMENT, "GstAviMux", &avimux_info, 0);
}
return avimux_type;
}
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_BIGFILE,
g_param_spec_boolean ("bigfile", "Bigfile Support",
- "Support for openDML-2.0 (big) AVI files", 0, G_PARAM_READWRITE));
+ "Support for openDML-2.0 (big) AVI files", 0, G_PARAM_READWRITE));
gstelement_class->request_new_pad = gst_avimux_request_new_pad;
avimux->srcpad =
gst_pad_new_from_template (gst_element_class_get_pad_template (klass,
- "src"), "src");
+ "src"), "src");
gst_element_add_pad (GST_ELEMENT (avimux), avimux->srcpad);
GST_FLAG_SET (GST_ELEMENT (avimux), GST_ELEMENT_EVENT_AWARE);
avimux->vids.compression = format;
switch (format) {
case GST_MAKE_FOURCC ('Y', 'U', 'Y', '2'):
- avimux->vids.bit_cnt = 16;
- break;
+ avimux->vids.bit_cnt = 16;
+ break;
case GST_MAKE_FOURCC ('I', '4', '2', '0'):
- avimux->vids.bit_cnt = 12;
- break;
+ avimux->vids.bit_cnt = 12;
+ break;
}
} else {
avimux->vids.bit_cnt = 24;
gst_structure_get_int (structure, "divxversion", &divxversion);
switch (divxversion) {
- case 3:
- avimux->vids.compression = GST_MAKE_FOURCC ('D', 'I', 'V', '3');
- break;
- case 4:
- avimux->vids.compression = GST_MAKE_FOURCC ('D', 'I', 'V', 'X');
- break;
- case 5:
- avimux->vids.compression = GST_MAKE_FOURCC ('D', 'X', '5', '0');
- break;
+ case 3:
+ avimux->vids.compression = GST_MAKE_FOURCC ('D', 'I', 'V', '3');
+ break;
+ case 4:
+ avimux->vids.compression = GST_MAKE_FOURCC ('D', 'I', 'V', 'X');
+ break;
+ case 5:
+ avimux->vids.compression = GST_MAKE_FOURCC ('D', 'X', '5', '0');
+ break;
}
} else if (!strcmp (mimetype, "video/x-xvid")) {
avimux->vids.compression = GST_MAKE_FOURCC ('X', 'V', 'I', 'D');
gst_structure_get_int (structure, "msmpegversion", &msmpegversion);
switch (msmpegversion) {
- case 41:
- avimux->vids.compression = GST_MAKE_FOURCC ('M', 'P', 'G', '4');
- break;
- case 42:
- avimux->vids.compression = GST_MAKE_FOURCC ('M', 'P', '4', '2');
- break;
- case 43:
- avimux->vids.compression = GST_MAKE_FOURCC ('M', 'P', '4', '3');
- break;
+ case 41:
+ avimux->vids.compression = GST_MAKE_FOURCC ('M', 'P', 'G', '4');
+ break;
+ case 42:
+ avimux->vids.compression = GST_MAKE_FOURCC ('M', 'P', '4', '2');
+ break;
+ case 43:
+ avimux->vids.compression = GST_MAKE_FOURCC ('M', 'P', '4', '3');
+ break;
}
} else if (!strcmp (mimetype, "video/x-dv")) {
avimux->vids.compression = GST_MAKE_FOURCC ('D', 'V', 'S', 'D');
gst_structure_get_int (structure, "layer", &layer);
switch (layer) {
- case 3:
- avimux->auds.format = GST_RIFF_WAVE_FORMAT_MPEGL3;
- break;
- case 1:
- case 2:
- avimux->auds.format = GST_RIFF_WAVE_FORMAT_MPEGL12;
- break;
+ case 3:
+ avimux->auds.format = GST_RIFF_WAVE_FORMAT_MPEGL3;
+ break;
+ case 1:
+ case 2:
+ avimux->auds.format = GST_RIFF_WAVE_FORMAT_MPEGL12;
+ break;
}
} else if (!strcmp (mimetype, "audio/x-vorbis")) {
avimux->auds.format = GST_RIFF_WAVE_FORMAT_VORBIS3;
/* first, let's see what actually needs to be in the buffer */
GST_BUFFER_SIZE (buffer) = 0;
- GST_BUFFER_SIZE (buffer) += 32 + sizeof (gst_riff_avih); /* avi header */
- if (avimux->video_pad_connected) { /* we have video */
- GST_BUFFER_SIZE (buffer) += 28 + sizeof (gst_riff_strh) + sizeof (gst_riff_strf_vids); /* vid hdr */
- GST_BUFFER_SIZE (buffer) += 24; /* odml header */
+ GST_BUFFER_SIZE (buffer) += 32 + sizeof (gst_riff_avih); /* avi header */
+ if (avimux->video_pad_connected) { /* we have video */
+ GST_BUFFER_SIZE (buffer) += 28 + sizeof (gst_riff_strh) + sizeof (gst_riff_strf_vids); /* vid hdr */
+ GST_BUFFER_SIZE (buffer) += 24; /* odml header */
}
- if (avimux->audio_pad_connected) { /* we have audio */
- GST_BUFFER_SIZE (buffer) += 28 + sizeof (gst_riff_strh) + sizeof (gst_riff_strf_auds); /* aud hdr */
+ if (avimux->audio_pad_connected) { /* we have audio */
+ GST_BUFFER_SIZE (buffer) += 28 + sizeof (gst_riff_strh) + sizeof (gst_riff_strf_auds); /* aud hdr */
}
/* this is the "riff size" */
avimux->header_size = GST_BUFFER_SIZE (buffer);
- GST_BUFFER_SIZE (buffer) += 12; /* avi data header */
+ GST_BUFFER_SIZE (buffer) += 12; /* avi data header */
/* allocate the buffer */
buffdata = GST_BUFFER_DATA (buffer) = g_malloc (GST_BUFFER_SIZE (buffer));
memcpy (buffdata, "LIST", 4);
buffdata += 4;
temp32 =
- LE_FROM_GUINT32 (sizeof (gst_riff_strh) + sizeof (gst_riff_strf_vids) +
- 4 * 5);
+ LE_FROM_GUINT32 (sizeof (gst_riff_strh) + sizeof (gst_riff_strf_vids) +
+ 4 * 5);
memcpy (buffdata, &temp32, 4);
buffdata += 4;
memcpy (buffdata, "strl", 4);
memcpy (buffdata, "LIST", 4);
buffdata += 4;
temp32 =
- LE_FROM_GUINT32 (sizeof (gst_riff_strh) + sizeof (gst_riff_strf_auds) +
- 4 * 5);
+ LE_FROM_GUINT32 (sizeof (gst_riff_strh) + sizeof (gst_riff_strf_auds) +
+ 4 * 5);
memcpy (buffdata, &temp32, 4);
buffdata += 4;
memcpy (buffdata, "strl", 4);
if (avimux->idx_index == avimux->idx_count) {
avimux->idx_count += 256;
avimux->idx =
- realloc (avimux->idx,
- avimux->idx_count * sizeof (gst_riff_index_entry));
+ realloc (avimux->idx,
+ avimux->idx_count * sizeof (gst_riff_index_entry));
}
memcpy (&(avimux->idx[avimux->idx_index].id), code, 4);
avimux->idx[avimux->idx_index].flags = LE_FROM_GUINT32 (flags);
buffer = gst_buffer_new ();
GST_BUFFER_SIZE (buffer) = avimux->idx_index * sizeof (gst_riff_index_entry);
GST_BUFFER_DATA (buffer) = (unsigned char *) avimux->idx;
- avimux->idx = NULL; /* will be free()'ed by gst_buffer_unref() */
+ avimux->idx = NULL; /* will be free()'ed by gst_buffer_unref() */
avimux->total_data += GST_BUFFER_SIZE (buffer);
gst_pad_push (avimux->srcpad, GST_DATA (buffer));
if (avimux->is_bigfile) {
/* sarch back */
event = gst_event_new_seek (GST_FORMAT_BYTES |
- GST_SEEK_METHOD_SET | GST_SEEK_FLAG_FLUSH, avimux->avix_start);
+ GST_SEEK_METHOD_SET | GST_SEEK_FLAG_FLUSH, avimux->avix_start);
/* if the event succeeds */
gst_pad_push (avimux->srcpad, GST_DATA (event));
/* go back to current location */
event = gst_event_new_seek (GST_FORMAT_BYTES |
- GST_SEEK_METHOD_SET | GST_SEEK_FLAG_FLUSH, avimux->total_data);
+ GST_SEEK_METHOD_SET | GST_SEEK_FLAG_FLUSH, avimux->total_data);
gst_pad_push (avimux->srcpad, GST_DATA (event));
}
avimux->avix_start = avimux->total_data;
avimux->total_data = 0;
avimux->total_frames = 0;
- avimux->data_size = 4; /* ? */
+ avimux->data_size = 4; /* ? */
avimux->datax_size = 0;
avimux->num_frames = 0;
avimux->numx_frames = 0;
avimux->avix_start = 0;
avimux->idx_index = 0;
- avimux->idx_offset = 0; /* see 10 lines below */
+ avimux->idx_offset = 0; /* see 10 lines below */
avimux->idx_size = 0;
avimux->idx_count = 0;
avimux->idx = NULL;
}
if (avimux->audio_pad_connected) {
avimux->auds_hdr.length =
- (avimux->audio_time * avimux->auds.rate) / GST_SECOND;
+ (avimux->audio_time * avimux->auds.rate) / GST_SECOND;
}
/* set rate and everything having to do with that */
/* calculate bps if needed */
if (!avimux->auds.av_bps) {
if (avimux->audio_time) {
- avimux->auds_hdr.rate =
- (GST_SECOND * avimux->audio_size) / avimux->audio_time;
+ avimux->auds_hdr.rate =
+ (GST_SECOND * avimux->audio_size) / avimux->audio_time;
} else {
- GST_ELEMENT_ERROR (avimux, STREAM, MUX,
- (_("No or invalid input audio, AVI stream will be corrupt.")),
- (NULL));
- avimux->auds_hdr.rate = 0;
+ GST_ELEMENT_ERROR (avimux, STREAM, MUX,
+ (_("No or invalid input audio, AVI stream will be corrupt.")),
+ (NULL));
+ avimux->auds_hdr.rate = 0;
}
avimux->auds.av_bps = avimux->auds_hdr.rate * avimux->auds_hdr.scale;
}
}
if (avimux->video_pad_connected) {
avimux->avi_hdr.max_bps += ((avimux->vids.bit_cnt + 7) / 8) *
- (1000000. / avimux->avi_hdr.us_frame) * avimux->vids.image_size;
+ (1000000. / avimux->avi_hdr.us_frame) * avimux->vids.image_size;
}
/* seek and rewrite the header */
case GST_EVENT_EOS:
/* is this allright? */
if (pad == avimux->videosinkpad) {
- avimux->video_pad_eos = TRUE;
+ avimux->video_pad_eos = TRUE;
} else if (pad == avimux->audiosinkpad) {
- avimux->audio_pad_eos = TRUE;
+ avimux->audio_pad_eos = TRUE;
} else {
- g_warning ("Unknown pad for EOS!");
+ g_warning ("Unknown pad for EOS!");
}
break;
default:
{
if (avimux->video_buffer_queue && avimux->audio_buffer_queue) {
if (GST_BUFFER_TIMESTAMP (avimux->video_buffer_queue) <=
- GST_BUFFER_TIMESTAMP (avimux->audio_buffer_queue))
+ GST_BUFFER_TIMESTAMP (avimux->audio_buffer_queue))
gst_avimux_do_video_buffer (avimux);
else
gst_avimux_do_audio_buffer (avimux);
GST_PAD_SRC,
GST_PAD_ALWAYS,
GST_STATIC_CAPS (GST_AUDIO_INT_PAD_TEMPLATE_CAPS "; "
- GST_AUDIO_FLOAT_PAD_TEMPLATE_CAPS)
+ GST_AUDIO_FLOAT_PAD_TEMPLATE_CAPS)
);
static GstStaticPadTemplate cutter_sink_factory =
GST_PAD_SINK,
GST_PAD_ALWAYS,
GST_STATIC_CAPS (GST_AUDIO_INT_PAD_TEMPLATE_CAPS "; "
- GST_AUDIO_FLOAT_PAD_TEMPLATE_CAPS)
+ GST_AUDIO_FLOAT_PAD_TEMPLATE_CAPS)
);
static void gst_cutter_base_init (gpointer g_class);
sizeof (GstCutter), 0,
(GInstanceInitFunc) gst_cutter_init,
};
+
cutter_type = g_type_register_static (GST_TYPE_ELEMENT, "GstCutter",
- &cutter_info, 0);
+ &cutter_info, 0);
}
return cutter_type;
}
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_THRESHOLD,
g_param_spec_double ("threshold", "Threshold",
- "Volume threshold before trigger",
- -G_MAXDOUBLE, G_MAXDOUBLE, 0.0, G_PARAM_READWRITE));
+ "Volume threshold before trigger",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0.0, G_PARAM_READWRITE));
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_THRESHOLD_DB,
g_param_spec_double ("threshold_dB", "Threshold (dB)",
- "Volume threshold before trigger (in dB)",
- -G_MAXDOUBLE, G_MAXDOUBLE, 0.0, G_PARAM_READWRITE));
+ "Volume threshold before trigger (in dB)",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0.0, G_PARAM_READWRITE));
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_RUN_LENGTH,
g_param_spec_double ("runlength", "Runlength",
- "Length of drop below threshold before cut_stop (seconds)",
- 0.0, G_MAXDOUBLE, 0.0, G_PARAM_READWRITE));
+ "Length of drop below threshold before cut_stop (seconds)",
+ 0.0, G_MAXDOUBLE, 0.0, G_PARAM_READWRITE));
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_PRE_LENGTH,
g_param_spec_double ("prelength", "prelength",
- "Length of pre-recording buffer (seconds)",
- 0.0, G_MAXDOUBLE, 0.0, G_PARAM_READWRITE));
+ "Length of pre-recording buffer (seconds)",
+ 0.0, G_MAXDOUBLE, 0.0, G_PARAM_READWRITE));
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_LEAKY,
g_param_spec_boolean ("leaky", "Leaky",
- "do we leak buffers when below threshold ?",
- FALSE, G_PARAM_READWRITE));
+ "do we leak buffers when below threshold ?",
+ FALSE, G_PARAM_READWRITE));
gst_cutter_signals[CUT_START] =
g_signal_new ("cut-start", G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_FIRST,
GstBuffer *buf = GST_BUFFER (_data);
GstCutter *filter;
gint16 *in_data;
- double RMS = 0.0; /* RMS of signal in buffer */
- double ms = 0.0; /* mean square value of buffer */
- static gboolean silent_prev = FALSE; /* previous value of silent */
- GstBuffer *prebuf; /* pointer to a prebuffer element */
+ double RMS = 0.0; /* RMS of signal in buffer */
+ double ms = 0.0; /* mean square value of buffer */
+ static gboolean silent_prev = FALSE; /* previous value of silent */
+ GstBuffer *prebuf; /* pointer to a prebuffer element */
g_return_if_fail (pad != NULL);
g_return_if_fail (GST_IS_PAD (pad));
default:
/* this shouldn't happen */
g_print ("WARNING: no mean square function for width %d\n",
- filter->width);
+ filter->width);
break;
}
g_signal_emit (G_OBJECT (filter), gst_cutter_signals[CUT_START], 0);
GST_DEBUG ("flushing buffer of length %.3f", filter->pre_run_length);
while (filter->pre_buffer) {
- prebuf = (g_list_first (filter->pre_buffer))->data;
- filter->pre_buffer = g_list_remove (filter->pre_buffer, prebuf);
- gst_pad_push (filter->srcpad, GST_DATA (prebuf));
- ++count;
+ prebuf = (g_list_first (filter->pre_buffer))->data;
+ filter->pre_buffer = g_list_remove (filter->pre_buffer, prebuf);
+ gst_pad_push (filter->srcpad, GST_DATA (prebuf));
+ ++count;
}
GST_DEBUG ("flushed %d buffers", count);
filter->pre_run_length = 0.0;
filter->pre_run_length -= gst_audio_length (filter->srcpad, prebuf);
/* only pass buffers if we don't leak */
if (!filter->leaky)
- gst_pad_push (filter->srcpad, GST_DATA (prebuf));
+ gst_pad_push (filter->srcpad, GST_DATA (prebuf));
/* we unref it after getting it out of the pre_buffer */
gst_buffer_unref (prebuf);
}
static double inline gst_cutter_8bit_ms (gint8 * data, guint num_samples)
#include "filter.func"
static void
- gst_cutter_set_property (GObject * object, guint prop_id,
+ gst_cutter_set_property (GObject * object, guint prop_id,
const GValue * value, GParamSpec * pspec)
{
GstCutter *filter;
0,
(GInstanceInitFunc) gst_efence_init,
};
+
plugin_type = g_type_register_static (GST_TYPE_ELEMENT,
- "GstEFence", &plugin_info, 0);
+ "GstEFence", &plugin_info, 0);
}
return plugin_type;
}
g_object_class_install_property (gobject_class, ARG_FENCE_TOP,
g_param_spec_boolean ("fence_top", "Fence Top",
- "Align buffers with top of fenced region", TRUE, G_PARAM_READWRITE));
+ "Align buffers with top of fenced region", TRUE, G_PARAM_READWRITE));
gobject_class->set_property = gst_efence_set_property;
gobject_class->get_property = gst_efence_get_property;
if (!GST_BUFFER_FLAG_IS_SET (buffer, GST_BUFFER_DONTFREE) &&
GST_BUFFER_DATA (buffer)) {
GST_DEBUG ("free region %p %d", fenced_buffer->region,
- fenced_buffer->length);
+ fenced_buffer->length);
munmap (fenced_buffer->region, fenced_buffer->length);
} else {
GST_DEBUG ("not freeing region %p %d %p", fenced_buffer->region,
- GST_BUFFER_FLAGS (buffer), GST_BUFFER_DATA (buffer));
+ GST_BUFFER_FLAGS (buffer), GST_BUFFER_DATA (buffer));
}
/* set to safe values */
0,
gst_navigationtest_init,
};
+
navigationtest_type = g_type_register_static (GST_TYPE_VIDEOFILTER,
- "GstNavigationtest", &navigationtest_info, 0);
+ "GstNavigationtest", &navigationtest_info, 0);
}
return navigationtest_type;
}
for (i = 0; i < G_N_ELEMENTS (gst_navigationtest_formats); i++) {
gst_videofilter_class_add_format (videofilter_class,
- gst_navigationtest_formats + i);
+ gst_navigationtest_formats + i);
}
gst_videofilter_class_add_pad_templates (GST_VIDEOFILTER_CLASS (g_class));
#if 0
g_object_class_install_property (gobject_class, ARG_METHOD,
g_param_spec_enum ("method", "method", "method",
- GST_TYPE_NAVIGATIONTEST_METHOD, GST_NAVIGATIONTEST_METHOD_1,
- G_PARAM_READWRITE));
+ GST_TYPE_NAVIGATIONTEST_METHOD, GST_NAVIGATIONTEST_METHOD_1,
+ G_PARAM_READWRITE));
#endif
gobject_class->set_property = gst_navigationtest_set_property;
switch (GST_EVENT_TYPE (event)) {
case GST_EVENT_NAVIGATION:
gst_structure_get_double (event->event_data.structure.structure,
- "pointer_x", &navigationtest->x);
+ "pointer_x", &navigationtest->x);
gst_structure_get_double (event->event_data.structure.structure,
- "pointer_y", &navigationtest->y);
+ "pointer_y", &navigationtest->y);
break;
default:
break;
gint x;
gint dx;
gint init;
-} scratch;
+}
+scratch;
static int dx[8] = { 1, 1, 0, -1, -1, -1, 0, 1 };
static int dy[8] = { 0, -1, -1, -1, 0, 1, 1, 1 };
0,
gst_agingtv_init,
};
+
agingtv_type = g_type_register_static (GST_TYPE_VIDEOFILTER,
- "GstAgingTV", &agingtv_info, 0);
+ "GstAgingTV", &agingtv_info, 0);
}
return agingtv_type;
}
for (i = 0; i < G_N_ELEMENTS (gst_agingtv_formats); i++) {
gst_videofilter_class_add_format (videofilter_class,
- gst_agingtv_formats + i);
+ gst_agingtv_formats + i);
}
gst_videofilter_class_add_pad_templates (GST_VIDEOFILTER_CLASS (g_class));
#if 0
g_object_class_install_property (gobject_class, ARG_METHOD,
g_param_spec_enum ("method", "method", "method",
- GST_TYPE_AGINGTV_METHOD, GST_AGINGTV_METHOD_1, G_PARAM_READWRITE));
+ GST_TYPE_AGINGTV_METHOD, GST_AGINGTV_METHOD_1, G_PARAM_READWRITE));
#endif
gobject_class->set_property = gst_agingtv_set_property;
scratch->x = scratch->x + scratch->dx;
if (scratch->x < 0 || scratch->x > width * 256) {
- scratch->life = 0;
- break;
+ scratch->life = 0;
+ break;
}
p = dest + (scratch->x >> 8);
if (scratch->init) {
- y1 = scratch->init;
- scratch->init = 0;
+ y1 = scratch->init;
+ scratch->init = 0;
} else {
- y1 = 0;
+ y1 = 0;
}
scratch->life--;
if (scratch->life) {
- y2 = height;
+ y2 = height;
} else {
- y2 = fastrand () % height;
+ y2 = fastrand () % height;
}
for (y = y1; y < y2; y++) {
- a = *p & 0xfefeff;
- a += 0x202020;
- b = a & 0x1010100;
- *p = a | (b - (b >> 8));
- p += width;
+ a = *p & 0xfefeff;
+ a += 0x202020;
+ b = a & 0x1010100;
+ *p = a | (b - (b >> 8));
+ p += width;
}
} else {
if ((fastrand () & 0xf0000000) == 0) {
- scratch->life = 2 + (fastrand () >> 27);
- scratch->x = fastrand () % (width * 256);
- scratch->dx = ((int) fastrand ()) >> 23;
- scratch->init = (fastrand () % (height - 1)) + 1;
+ scratch->life = 2 + (fastrand () >> 27);
+ scratch->x = fastrand () % (width * 256);
+ scratch->dx = ((int) fastrand ()) >> 23;
+ scratch->init = (fastrand () % (height - 1)) + 1;
}
}
}
x += dx[d];
if (y >= height || x >= width)
- break;
+ break;
d = (d + fastrand () % 3 - 1) & 7;
}
y = y + fastrand () % 3 - 1;
if (y >= height || x >= width)
- break;
+ break;
dest[y * width + x] = 0xc0c0c0;
}
DICE_RIGHT = 1,
DICE_DOWN = 2,
DICE_LEFT = 3
-} DiceDir;
+}
+DiceDir;
struct _GstDiceTV
{
};
dicetv_type =
- g_type_register_static (GST_TYPE_VIDEOFILTER, "GstDiceTV", &dicetv_info,
- 0);
+ g_type_register_static (GST_TYPE_VIDEOFILTER, "GstDiceTV", &dicetv_info,
+ 0);
}
return dicetv_type;
}
for (i = 0; i < G_N_ELEMENTS (gst_dicetv_formats); i++) {
gst_videofilter_class_add_format (videofilter_class,
- gst_dicetv_formats + i);
+ gst_dicetv_formats + i);
}
gst_videofilter_class_add_pad_templates (GST_VIDEOFILTER_CLASS (g_class));
g_object_class_install_property (gobject_class, ARG_CUBE_BITS,
g_param_spec_int ("square_bits", "Square Bits", "The size of the Squares",
- MIN_CUBE_BITS, MAX_CUBE_BITS, DEFAULT_CUBE_BITS, G_PARAM_READWRITE));
+ MIN_CUBE_BITS, MAX_CUBE_BITS, DEFAULT_CUBE_BITS, G_PARAM_READWRITE));
gobject_class->set_property = gst_dicetv_set_property;
gobject_class->get_property = gst_dicetv_get_property;
base = (map_y << g_cube_bits) * video_width + (map_x << g_cube_bits);
switch (filter->dicemap[map_i]) {
- case DICE_UP:
- for (dy = 0; dy < g_cube_size; dy++) {
- i = base + dy * video_width;
- for (dx = 0; dx < g_cube_size; dx++) {
- dest[i] = src[i];
- i++;
- }
- }
- break;
- case DICE_LEFT:
- for (dy = 0; dy < g_cube_size; dy++) {
- i = base + dy * video_width;
-
- for (dx = 0; dx < g_cube_size; dx++) {
- di = base + (dx * video_width) + (g_cube_size - dy - 1);
- dest[di] = src[i];
- i++;
- }
- }
- break;
- case DICE_DOWN:
- for (dy = 0; dy < g_cube_size; dy++) {
- di = base + dy * video_width;
- i = base + (g_cube_size - dy - 1) * video_width + g_cube_size;
- for (dx = 0; dx < g_cube_size; dx++) {
- i--;
- dest[di] = src[i];
- di++;
- }
- }
- break;
- case DICE_RIGHT:
- for (dy = 0; dy < g_cube_size; dy++) {
- i = base + (dy * video_width);
- for (dx = 0; dx < g_cube_size; dx++) {
- di = base + dy + (g_cube_size - dx - 1) * video_width;
- dest[di] = src[i];
- i++;
- }
- }
- break;
- default:
- g_assert_not_reached ();
- break;
+ case DICE_UP:
+ for (dy = 0; dy < g_cube_size; dy++) {
+ i = base + dy * video_width;
+ for (dx = 0; dx < g_cube_size; dx++) {
+ dest[i] = src[i];
+ i++;
+ }
+ }
+ break;
+ case DICE_LEFT:
+ for (dy = 0; dy < g_cube_size; dy++) {
+ i = base + dy * video_width;
+
+ for (dx = 0; dx < g_cube_size; dx++) {
+ di = base + (dx * video_width) + (g_cube_size - dy - 1);
+ dest[di] = src[i];
+ i++;
+ }
+ }
+ break;
+ case DICE_DOWN:
+ for (dy = 0; dy < g_cube_size; dy++) {
+ di = base + dy * video_width;
+ i = base + (g_cube_size - dy - 1) * video_width + g_cube_size;
+ for (dx = 0; dx < g_cube_size; dx++) {
+ i--;
+ dest[di] = src[i];
+ di++;
+ }
+ }
+ break;
+ case DICE_RIGHT:
+ for (dy = 0; dy < g_cube_size; dy++) {
+ i = base + (dy * video_width);
+ for (dx = 0; dx < g_cube_size; dx++) {
+ di = base + dy + (g_cube_size - dx - 1) * video_width;
+ dest[di] = src[i];
+ i++;
+ }
+ }
+ break;
+ default:
+ g_assert_not_reached ();
+ break;
}
map_i++;
}
};
edgetv_type =
- g_type_register_static (GST_TYPE_VIDEOFILTER, "GstEdgeTV", &edgetv_info,
- 0);
+ g_type_register_static (GST_TYPE_VIDEOFILTER, "GstEdgeTV", &edgetv_info,
+ 0);
}
return edgetv_type;
}
for (i = 0; i < G_N_ELEMENTS (gst_edgetv_formats); i++) {
gst_videofilter_class_add_format (videofilter_class,
- gst_edgetv_formats + i);
+ gst_edgetv_formats + i);
}
gst_videofilter_class_add_pad_templates (GST_VIDEOFILTER_CLASS (g_class));
r *= r;
g *= g;
b *= b;
- r = r >> 5; /* To lack the lower bit for saturated addition, */
- g = g >> 5; /* devide the value with 32, instead of 16. It is */
- b = b >> 4; /* same as `v2 &= 0xfefeff' */
+ r = r >> 5; /* To lack the lower bit for saturated addition, */
+ g = g >> 5; /* devide the value with 32, instead of 16. It is */
+ b = b >> 4; /* same as `v2 &= 0xfefeff' */
if (r > 127)
- r = 127;
+ r = 127;
if (g > 127)
- g = 127;
+ g = 127;
if (b > 255)
- b = 255;
+ b = 255;
v2 = (r << 17) | (g << 9) | b;
/* difference between the current pixel and upper neighbor. */
g = g >> 5;
b = b >> 4;
if (r > 127)
- r = 127;
+ r = 127;
if (g > 127)
- g = 127;
+ g = 127;
if (b > 255)
- b = 255;
+ b = 255;
v3 = (r << 17) | (g << 9) | b;
v0 = filter->map[(y - 1) * filter->map_width * 2 + x * 2];
while (_elements[i].name) {
if (!gst_element_register (plugin, _elements[i].name,
- GST_RANK_NONE, (_elements[i].type) ()))
+ GST_RANK_NONE, (_elements[i].type) ()))
return FALSE;
i++;
}
};
quarktv_type =
- g_type_register_static (GST_TYPE_ELEMENT, "GstQuarkTV", &quarktv_info,
- 0);
+ g_type_register_static (GST_TYPE_ELEMENT, "GstQuarkTV", &quarktv_info,
+ 0);
}
return quarktv_type;
}
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_PLANES,
g_param_spec_int ("planes", "Planes", "Number of frames in the buffer",
- 1, 32, PLANES, G_PARAM_READWRITE));
+ 1, 32, PLANES, G_PARAM_READWRITE));
gobject_class->set_property = gst_quarktv_set_property;
gobject_class->get_property = gst_quarktv_get_property;
/* pick a random buffer */
rand =
- filter->planetable[(filter->current_plane +
- (fastrand () >> 24)) & (filter->planes - 1)];
+ filter->planetable[(filter->current_plane +
+ (fastrand () >> 24)) & (filter->planes - 1)];
dest[area] = (rand ? ((guint32 *) GST_BUFFER_DATA (rand))[area] : 0);
}
gint i;
for (i = 0; i < filter->planes; i++) {
- if (filter->planetable[i])
- gst_buffer_unref (filter->planetable[i]);
- filter->planetable[i] = NULL;
+ if (filter->planetable[i])
+ gst_buffer_unref (filter->planetable[i]);
+ filter->planetable[i] = NULL;
}
g_free (filter->planetable);
filter->planetable = NULL;
/* If the number of planes changed, copy across any existing planes */
if (new_n_planes != filter->planes) {
- new_planetable =
- (GstBuffer **) g_malloc (new_n_planes * sizeof (GstBuffer *));
-
- for (i = 0; (i < new_n_planes) && (i < filter->planes); i++) {
- new_planetable[i] = filter->planetable[i];
- }
- for (; i < filter->planes; i++) {
- if (filter->planetable[i])
- gst_buffer_unref (filter->planetable[i]);
- }
- g_free (filter->planetable);
- filter->planetable = new_planetable;
- filter->current_plane = filter->planes - 1;
- filter->planes = new_n_planes;
+ new_planetable =
+ (GstBuffer **) g_malloc (new_n_planes * sizeof (GstBuffer *));
+
+ for (i = 0; (i < new_n_planes) && (i < filter->planes); i++) {
+ new_planetable[i] = filter->planetable[i];
+ }
+ for (; i < filter->planes; i++) {
+ if (filter->planetable[i])
+ gst_buffer_unref (filter->planetable[i]);
+ }
+ g_free (filter->planetable);
+ filter->planetable = new_planetable;
+ filter->current_plane = filter->planes - 1;
+ filter->planes = new_n_planes;
}
}
break;
};
revtv_type =
- g_type_register_static (GST_TYPE_VIDEOFILTER, "GstRevTV", &revtv_info,
- 0);
+ g_type_register_static (GST_TYPE_VIDEOFILTER, "GstRevTV", &revtv_info,
+ 0);
}
return revtv_type;
}
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_DELAY,
g_param_spec_int ("delay", "Delay", "Delay in frames between updates",
- 1, 100, 1, G_PARAM_READWRITE));
+ 1, 100, 1, G_PARAM_READWRITE));
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_LINESPACE,
g_param_spec_int ("linespace", "Linespace", "Control line spacing",
- 1, 100, 6, G_PARAM_READWRITE));
+ 1, 100, 6, G_PARAM_READWRITE));
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_GAIN,
g_param_spec_int ("gain", "Gain", "Control gain",
- 1, 200, 50, G_PARAM_READWRITE));
+ 1, 200, 50, G_PARAM_READWRITE));
gobject_class->set_property = gst_revtv_set_property;
gobject_class->get_property = gst_revtv_get_property;
yval = y - ((short) (R + G + B) / filter->vscale);
if (yval > 0) {
- dest[x + (yval * width)] = THE_COLOR;
+ dest[x + (yval * width)] = THE_COLOR;
}
}
}
};
shagadelictv_type =
- g_type_register_static (GST_TYPE_VIDEOFILTER, "GstShagadelicTV",
- &shagadelictv_info, 0);
+ g_type_register_static (GST_TYPE_VIDEOFILTER, "GstShagadelicTV",
+ &shagadelictv_info, 0);
}
return shagadelictv_type;
}
for (i = 0; i < G_N_ELEMENTS (gst_shagadelictv_formats); i++) {
gst_videofilter_class_add_format (videofilter_class,
- gst_shagadelictv_formats + i);
+ gst_shagadelictv_formats + i);
}
gst_videofilter_class_add_pad_templates (GST_VIDEOFILTER_CLASS (g_class));
xx = x - filter->width / 2;
#ifdef PS2
filter->spiral[i++] = ((unsigned int)
- ((atan2f (xx,
- yy) / ((float) M_PI) * 256 * 9) + (sqrtf (xx * xx +
- yy * yy) * 5))) & 255;
+ ((atan2f (xx,
+ yy) / ((float) M_PI) * 256 * 9) + (sqrtf (xx * xx +
+ yy * yy) * 5))) & 255;
#else
filter->spiral[i++] = ((unsigned int)
- ((atan2 (xx, yy) / M_PI * 256 * 9) + (sqrt (xx * xx +
- yy * yy) * 5))) & 255;
+ ((atan2 (xx, yy) / M_PI * 256 * 9) + (sqrt (xx * xx +
+ yy * yy) * 5))) & 255;
#endif
/* Here is another Swinger!
* ((atan2(xx, yy)/M_PI*256) + (sqrt(xx*xx+yy*yy)*10))&255;
* *dest++ = v & ((r<<16)|(g<<8)|b);
*/
r = (gchar) (filter->ripple[(filter->ry + y) * width * 2 + filter->rx +
- x] + filter->phase * 2) >> 7;
+ x] + filter->phase * 2) >> 7;
g = (gchar) (filter->spiral[y * width + x] + filter->phase * 3) >> 7;
b = (gchar) (filter->ripple[(filter->by + y) * width * 2 + filter->bx +
- x] - filter->phase) >> 7;
+ x] - filter->phase) >> 7;
*dest++ = v & ((r << 16) | (g << 8) | b);
}
}
};
vertigotv_type =
- g_type_register_static (GST_TYPE_VIDEOFILTER, "GstVertigoTV",
- &vertigotv_info, 0);
+ g_type_register_static (GST_TYPE_VIDEOFILTER, "GstVertigoTV",
+ &vertigotv_info, 0);
}
return vertigotv_type;
}
for (i = 0; i < G_N_ELEMENTS (gst_vertigotv_formats); i++) {
gst_videofilter_class_add_format (videofilter_class,
- gst_vertigotv_formats + i);
+ gst_vertigotv_formats + i);
}
gst_videofilter_class_add_pad_templates (GST_VIDEOFILTER_CLASS (g_class));
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_SPEED,
g_param_spec_float ("speed", "Speed", "Control the speed of movement",
- 0.01, 100.0, 0.02, G_PARAM_READWRITE));
+ 0.01, 100.0, 0.02, G_PARAM_READWRITE));
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_ZOOM_SPEED,
g_param_spec_float ("zoom_speed", "Zoom Speed",
- "Control the rate of zooming", 1.01, 1.1, 1.01, G_PARAM_READWRITE));
+ "Control the rate of zooming", 1.01, 1.1, 1.01, G_PARAM_READWRITE));
gobject_class->set_property = gst_vertigotv_set_property;
gobject_class->get_property = gst_vertigotv_get_property;
if (filter->width > filter->height) {
if (dizz >= 0) {
if (dizz > x)
- dizz = x;
+ dizz = x;
vx = (x * (x - dizz) + y * y) / t;
} else {
if (dizz < -x)
- dizz = -x;
+ dizz = -x;
vx = (x * (x + dizz) + y * y) / t;
}
vy = (dizz * y) / t;
} else {
if (dizz >= 0) {
if (dizz > y)
- dizz = y;
+ dizz = y;
vx = (x * x + y * (y - dizz)) / t;
} else {
if (dizz < -y)
- dizz = -y;
+ dizz = -y;
vx = (x * x + y * (y + dizz)) / t;
}
vy = (dizz * x) / t;
for (x = width; x > 0; x--) {
i = (oy >> 16) * width + (ox >> 16);
if (i < 0)
- i = 0;
+ i = 0;
if (i >= area)
- i = area;
+ i = area;
v = filter->current_buffer[i] & 0xfcfcff;
v = (v * 3) + ((*src++) & 0xfcfcff);
0,
gst_warptv_init,
};
+
warptv_type = g_type_register_static (GST_TYPE_VIDEOFILTER,
- "GstWarpTV", &warptv_info, 0);
+ "GstWarpTV", &warptv_info, 0);
}
return warptv_type;
}
for (i = 0; i < G_N_ELEMENTS (gst_warptv_formats); i++) {
gst_videofilter_class_add_format (videofilter_class,
- gst_warptv_formats + i);
+ gst_warptv_formats + i);
}
gst_videofilter_class_add_pad_templates (GST_VIDEOFILTER_CLASS (g_class));
#if 0
g_object_class_install_property (gobject_class, ARG_METHOD,
g_param_spec_enum ("method", "method", "method",
- GST_TYPE_WARPTV_METHOD, GST_WARPTV_METHOD_1, G_PARAM_READWRITE));
+ GST_TYPE_WARPTV_METHOD, GST_WARPTV_METHOD_1, G_PARAM_READWRITE));
#endif
gobject_class->set_property = gst_warptv_set_property;
sintable = warptv->sintable;
ctable = warptv->ctable;
- skip = 0; /* video_width*sizeof(RGB32)/4 - video_width;; */
+ skip = 0; /* video_width*sizeof(RGB32)/4 - video_width;; */
c = 0;
for (x = 0; x < 512; x++) {
dy = ctable[i] + y;
if (dx < 0)
- dx = 0;
+ dx = 0;
else if (dx > maxx)
- dx = maxx;
+ dx = maxx;
if (dy < 0)
- dy = 0;
+ dy = 0;
else if (dy > maxy)
- dy = maxy;
+ dy = maxy;
*dest++ = src[warptv->offstable[dy] + dx];
}
dest += skip;
0,
(GInstanceInitFunc) gst_flxdec_init,
};
+
flxdec_type =
- g_type_register_static (GST_TYPE_ELEMENT, "GstFlxDec", &flxdec_info, 0);
+ g_type_register_static (GST_TYPE_ELEMENT, "GstFlxDec", &flxdec_info, 0);
}
return flxdec_type;
}
switch (hdr->id) {
case FLX_COLOR64:
- flx_decode_color (flxdec, data, dest, 2);
- data += rndalign (hdr->size) - FlxFrameChunkSize;
- break;
+ flx_decode_color (flxdec, data, dest, 2);
+ data += rndalign (hdr->size) - FlxFrameChunkSize;
+ break;
case FLX_COLOR256:
- flx_decode_color (flxdec, data, dest, 0);
- data += rndalign (hdr->size) - FlxFrameChunkSize;
- break;
+ flx_decode_color (flxdec, data, dest, 0);
+ data += rndalign (hdr->size) - FlxFrameChunkSize;
+ break;
case FLX_BRUN:
- flx_decode_brun (flxdec, data, dest);
- data += rndalign (hdr->size) - FlxFrameChunkSize;
- break;
+ flx_decode_brun (flxdec, data, dest);
+ data += rndalign (hdr->size) - FlxFrameChunkSize;
+ break;
case FLX_LC:
- flx_decode_delta_fli (flxdec, data, dest);
- data += rndalign (hdr->size) - FlxFrameChunkSize;
- break;
+ flx_decode_delta_fli (flxdec, data, dest);
+ data += rndalign (hdr->size) - FlxFrameChunkSize;
+ break;
case FLX_SS2:
- flx_decode_delta_flc (flxdec, data, dest);
- data += rndalign (hdr->size) - FlxFrameChunkSize;
- break;
+ flx_decode_delta_flc (flxdec, data, dest);
+ data += rndalign (hdr->size) - FlxFrameChunkSize;
+ break;
case FLX_BLACK:
- memset (dest, 0, flxdec->size);
- break;
+ memset (dest, 0, flxdec->size);
+ break;
case FLX_MINI:
- data += rndalign (hdr->size) - FlxFrameChunkSize;
- break;
+ data += rndalign (hdr->size) - FlxFrameChunkSize;
+ break;
default:
- g_print ("GstFlxDec: Unimplented chunk type: 0x%02x size: %d\n",
- hdr->id, hdr->size);
- g_print ("GstFlxDec: Skipping...\n");
- data += rndalign (hdr->size) - FlxFrameChunkSize;
- break;
+ g_print ("GstFlxDec: Unimplented chunk type: 0x%02x size: %d\n",
+ hdr->id, hdr->size);
+ g_print ("GstFlxDec: Skipping...\n");
+ data += rndalign (hdr->size) - FlxFrameChunkSize;
+ break;
}
}
}
count = *data++;
if (count > 0x7f) {
- /* literal run */
- count = 0x100 - count;
- row -= count;
+ /* literal run */
+ count = 0x100 - count;
+ row -= count;
- while (count--)
- *dest++ = *data++;
+ while (count--)
+ *dest++ = *data++;
} else {
- /* replicate run */
- row -= count;
- x = *data++;
+ /* replicate run */
+ row -= count;
+ x = *data++;
- while (count--)
- *dest++ = x;
+ while (count--)
+ *dest++ = x;
}
}
}
count = *data++;
if (count > 0x7f) {
- /* literal run */
- count = 0x100 - count;
- x = *data++;
+ /* literal run */
+ count = 0x100 - count;
+ x = *data++;
- while (count--)
- *dest++ = x;
+ while (count--)
+ *dest++ = x;
} else {
- /* replicate run */
- while (count--)
- *dest++ = *data++;
+ /* replicate run */
+ while (count--)
+ *dest++ = *data++;
}
}
start_p += flxdec->hdr.width;
while ((opcode = (data[0] + (data[1] << 8))) & 0xc000) {
data += 2;
if ((opcode & 0xc000) == 0xc000) {
- /* skip count */
- start_l += (0x10000 - opcode);
- dest += flxdec->hdr.width * (0x10000 - opcode);
+ /* skip count */
+ start_l += (0x10000 - opcode);
+ dest += flxdec->hdr.width * (0x10000 - opcode);
} else {
- /* last pixel */
- dest += flxdec->hdr.width;
- *dest++ = (opcode & 0xff);
+ /* last pixel */
+ dest += flxdec->hdr.width;
+ *dest++ = (opcode & 0xff);
}
}
data += 2;
count = *data++;
if (count > 0x7f) {
- /* replicate word run */
- count = 0x100 - count;
- while (count--) {
- *dest++ = data[0];
- *dest++ = data[1];
- }
- data += 2;
+ /* replicate word run */
+ count = 0x100 - count;
+ while (count--) {
+ *dest++ = data[0];
+ *dest++ = data[1];
+ }
+ data += 2;
} else {
- /* literal word run */
- while (count--) {
- *dest++ = *data++;
- *dest++ = *data++;
- }
+ /* literal word run */
+ while (count--) {
+ *dest++ = *data++;
+ *dest++ = *data++;
+ }
}
}
lines--;
/* check header */
if (flxh->type != FLX_MAGICHDR_FLI &&
- flxh->type != FLX_MAGICHDR_FLC && flxh->type != FLX_MAGICHDR_FLX) {
+ flxh->type != FLX_MAGICHDR_FLC && flxh->type != FLX_MAGICHDR_FLX) {
GST_ELEMENT_ERROR (element, STREAM, WRONG_TYPE, (NULL),
- ("not a flx file (type %d)\n", flxh->type));
+ ("not a flx file (type %d)\n", flxh->type));
return;
}
caps = gst_caps_from_string (GST_VIDEO_CAPS_xRGB_HOST_ENDIAN);
gst_caps_set_simple (caps,
- "width", G_TYPE_INT, flxh->width,
- "height", G_TYPE_INT, flxh->height,
- "framerate", G_TYPE_DOUBLE, GST_SECOND / flxdec->frame_time, NULL);
+ "width", G_TYPE_INT, flxh->width,
+ "height", G_TYPE_INT, flxh->height,
+ "framerate", G_TYPE_DOUBLE, GST_SECOND / flxdec->frame_time, NULL);
if (flxh->depth <= 8)
flxdec->converter =
- flx_colorspace_converter_new (flxh->width, flxh->height);
+ flx_colorspace_converter_new (flxh->width, flxh->height);
if (flxh->type == FLX_MAGICHDR_FLC || flxh->type == FLX_MAGICHDR_FLX) {
g_print ("GstFlxDec: (FLC) aspect_dx : %d\n", flxh->aspect_dx);
switch (flxfh->id) {
case FLX_FRAME_TYPE:
- buf = flx_get_data (flxdec, flxfh->size - FlxFrameChunkSize);
+ buf = flx_get_data (flxdec, flxfh->size - FlxFrameChunkSize);
- chunk = GST_BUFFER_DATA (buf);
+ chunk = GST_BUFFER_DATA (buf);
- if (((FlxFrameType *) chunk)->chunks == 0)
- break;
+ if (((FlxFrameType *) chunk)->chunks == 0)
+ break;
- /* create 32 bits output frame */
- out = gst_buffer_new ();
- GST_BUFFER_DATA (out) = g_malloc (flxdec->size * 4);
- GST_BUFFER_SIZE (out) = flxdec->size * 4;
+ /* create 32 bits output frame */
+ out = gst_buffer_new ();
+ GST_BUFFER_DATA (out) = g_malloc (flxdec->size * 4);
+ GST_BUFFER_SIZE (out) = flxdec->size * 4;
- /* decode chunks */
- flx_decode_chunks (flxdec,
- ((FlxFrameType *) chunk)->chunks,
- GST_BUFFER_DATA (buf) + FlxFrameTypeSize,
- GST_BUFFER_DATA (flxdec->frame));
+ /* decode chunks */
+ flx_decode_chunks (flxdec,
+ ((FlxFrameType *) chunk)->chunks,
+ GST_BUFFER_DATA (buf) + FlxFrameTypeSize,
+ GST_BUFFER_DATA (flxdec->frame));
- /* destroy input buffer */
- gst_buffer_unref (buf);
+ /* destroy input buffer */
+ gst_buffer_unref (buf);
- /* save copy of the current frame for possible delta. */
- memcpy (GST_BUFFER_DATA (flxdec->delta),
- GST_BUFFER_DATA (flxdec->frame), GST_BUFFER_SIZE (flxdec->delta));
+ /* save copy of the current frame for possible delta. */
+ memcpy (GST_BUFFER_DATA (flxdec->delta),
+ GST_BUFFER_DATA (flxdec->frame), GST_BUFFER_SIZE (flxdec->delta));
- /* convert current frame. */
- flx_colorspace_convert (flxdec->converter,
- GST_BUFFER_DATA (flxdec->frame), GST_BUFFER_DATA (out));
+ /* convert current frame. */
+ flx_colorspace_convert (flxdec->converter,
+ GST_BUFFER_DATA (flxdec->frame), GST_BUFFER_DATA (out));
- GST_BUFFER_TIMESTAMP (out) = flxdec->next_time;
- flxdec->next_time += flxdec->frame_time;
+ GST_BUFFER_TIMESTAMP (out) = flxdec->next_time;
+ flxdec->next_time += flxdec->frame_time;
- gst_pad_push (flxdec->srcpad, GST_DATA (out));
+ gst_pad_push (flxdec->srcpad, GST_DATA (out));
- break;
+ break;
}
/* destroy header buffer */
#endif /* PowerPC */
unsigned int *coeffs = 0, *freecoeffs = 0;
-guint32 *expix1 = 0; /* pointeur exporte vers p1 */
-guint32 *expix2 = 0; /* pointeur exporte vers p2 */
+guint32 *expix1 = 0; /* pointeur exporte vers p1 */
+guint32 *expix2 = 0; /* pointeur exporte vers p2 */
guint32 zoom_width;
#endif /* ASM */
switch (theMode) {
case WAVE_MODE:
- dist =
- ShiftRight (vx, 9) * ShiftRight (vx, 9) + ShiftRight (vy,
- 9) * ShiftRight (vy, 9);
- fvitesse *=
- 1024 +
- ShiftRight (sintable[(unsigned short) (0xffff * dist *
- EFFECT_DISTORS)], 6);
- fvitesse /= 1024;
- break;
+ dist =
+ ShiftRight (vx, 9) * ShiftRight (vx, 9) + ShiftRight (vy,
+ 9) * ShiftRight (vy, 9);
+ fvitesse *=
+ 1024 +
+ ShiftRight (sintable[(unsigned short) (0xffff * dist *
+ EFFECT_DISTORS)], 6);
+ fvitesse /= 1024;
+ break;
case CRYSTAL_BALL_MODE:
- dist =
- ShiftRight (vx, 9) * ShiftRight (vx, 9) + ShiftRight (vy,
- 9) * ShiftRight (vy, 9);
- fvitesse += (dist * EFFECT_DISTORS >> 10);
- break;
+ dist =
+ ShiftRight (vx, 9) * ShiftRight (vx, 9) + ShiftRight (vy,
+ 9) * ShiftRight (vy, 9);
+ fvitesse += (dist * EFFECT_DISTORS >> 10);
+ break;
case AMULETTE_MODE:
- dist =
- ShiftRight (vx, 9) * ShiftRight (vx, 9) + ShiftRight (vy,
- 9) * ShiftRight (vy, 9);
- fvitesse -= (dist * EFFECT_DISTORS >> 4);
- break;
+ dist =
+ ShiftRight (vx, 9) * ShiftRight (vx, 9) + ShiftRight (vy,
+ 9) * ShiftRight (vy, 9);
+ fvitesse -= (dist * EFFECT_DISTORS >> 4);
+ break;
case SCRUNCH_MODE:
- dist =
- ShiftRight (vx, 9) * ShiftRight (vx, 9) + ShiftRight (vy,
- 9) * ShiftRight (vy, 9);
- fvitesse -= (dist * EFFECT_DISTORS >> 9);
- break;
+ dist =
+ ShiftRight (vx, 9) * ShiftRight (vx, 9) + ShiftRight (vy,
+ 9) * ShiftRight (vy, 9);
+ fvitesse -= (dist * EFFECT_DISTORS >> 9);
+ break;
}
if (vx < 0)
*px = (middleX << 4) - (-(vx * fvitesse) >> 16);
{
static guint32 prevX = 0, prevY = 0;
- static char reverse = 0; /*vitesse inversé..(zoom out) */
+ static char reverse = 0; /*vitesse inversé..(zoom out) */
/* static int perte = 100; // 100 = normal */
static unsigned char pertedec = 8;
firstTime = 0;
#ifdef USE_ASM
freecoeffs = (unsigned int *)
- malloc (resx * resy * 2 * sizeof (unsigned int) + 128);
+ malloc (resx * resy * 2 * sizeof (unsigned int) + 128);
coeffs = (guint32 *) ((1 + ((unsigned int) (freecoeffs)) / 128) * 128);
#else
c4 = (unsigned int *) malloc (resx * resy * sizeof (unsigned int));
#endif
for (us = 0; us < 0xffff; us++) {
- sintable[us] = (int) (1024.0f * sin (us * 2 * 3.31415f / 0xffff));
+ sintable[us] = (int) (1024.0f * sin (us * 2 * 3.31415f / 0xffff));
}
{
- int loopv;
- firedec = (int *) malloc (prevY * sizeof (int));
- for (loopv = prevY; loopv != 0;) {
- static int decc = 0;
- static int spdc = 0;
- static int accel = 0;
-
- loopv--;
- firedec[loopv] = decc;
- decc += spdc / 10;
- spdc += RAND () % 3;
- spdc -= RAND () % 3;
-
- if (decc > 4)
- spdc -= 1;
- if (decc < -4)
- spdc += 1;
-
- if (spdc > 30)
- spdc = spdc - RAND () % 3 + accel / 10;
- if (spdc < -30)
- spdc = spdc + RAND () % 3 + accel / 10;
-
- if (decc > 8 && spdc > 1)
- spdc -= RAND () % 3 - 2;
-
- if (decc < -8 && spdc < -1)
- spdc += RAND () % 3 + 2;
-
- if (decc > 8 || decc < -8)
- decc = decc * 8 / 9;
-
- accel += RAND () % 2;
- accel -= RAND () % 2;
- if (accel > 20)
- accel -= 2;
- if (accel < -20)
- accel += 2;
- }
+ int loopv;
+ firedec = (int *) malloc (prevY * sizeof (int));
+ for (loopv = prevY; loopv != 0;) {
+ static int decc = 0;
+ static int spdc = 0;
+ static int accel = 0;
+
+ loopv--;
+ firedec[loopv] = decc;
+ decc += spdc / 10;
+ spdc += RAND () % 3;
+ spdc -= RAND () % 3;
+
+ if (decc > 4)
+ spdc -= 1;
+ if (decc < -4)
+ spdc += 1;
+
+ if (spdc > 30)
+ spdc = spdc - RAND () % 3 + accel / 10;
+ if (spdc < -30)
+ spdc = spdc + RAND () % 3 + accel / 10;
+
+ if (decc > 8 && spdc > 1)
+ spdc -= RAND () % 3 - 2;
+
+ if (decc < -8 && spdc < -1)
+ spdc += RAND () % 3 + 2;
+
+ if (decc > 8 || decc < -8)
+ decc = decc * 8 / 9;
+
+ accel += RAND () % 2;
+ accel -= RAND () % 2;
+ if (accel > 20)
+ accel -= 2;
+ if (accel < -20)
+ accel += 2;
+ }
}
}
/* generation du buffer */
for (y = 0; y < prevY; y++)
for (x = 0; x < prevX; x++) {
- int px, py;
- unsigned char coefv, coefh;
-
- /* calculer px et py en fonction de */
- /* x,y,middleX,middleY et theMode */
- calculatePXandPY (x, y, &px, &py);
- if ((px == x << 4) && (py == y << 4))
- py += 8;
-
- if ((py < 0) || (px < 0) ||
- (py >= (prevY - 1) * sqrtperte) ||
- (px >= (prevX - 1) * sqrtperte)) {
+ int px, py;
+ unsigned char coefv, coefh;
+
+ /* calculer px et py en fonction de */
+ /* x,y,middleX,middleY et theMode */
+ calculatePXandPY (x, y, &px, &py);
+ if ((px == x << 4) && (py == y << 4))
+ py += 8;
+
+ if ((py < 0) || (px < 0) ||
+ (py >= (prevY - 1) * sqrtperte) ||
+ (px >= (prevX - 1) * sqrtperte)) {
#ifdef USE_ASM
- coeffs[(y * prevX + x) * 2] = 0;
- coeffs[(y * prevX + x) * 2 + 1] = 0;
+ coeffs[(y * prevX + x) * 2] = 0;
+ coeffs[(y * prevX + x) * 2 + 1] = 0;
#else
- pos10[y * prevX + x] = 0;
- c1[y * prevX + x] = 0;
- c2[y * prevX + x] = 0;
- c3[y * prevX + x] = 0;
- c4[y * prevX + x] = 0;
+ pos10[y * prevX + x] = 0;
+ c1[y * prevX + x] = 0;
+ c2[y * prevX + x] = 0;
+ c3[y * prevX + x] = 0;
+ c4[y * prevX + x] = 0;
#endif
- } else {
- int npx10;
- int npy10;
- int pos;
+ } else {
+ int npx10;
+ int npy10;
+ int pos;
- npx10 = (px / sqrtperte);
- npy10 = (py / sqrtperte);
+ npx10 = (px / sqrtperte);
+ npy10 = (py / sqrtperte);
/* if (npx10 >= prevX) fprintf(stderr,"error npx:%d",npx10);
if (npy10 >= prevY) fprintf(stderr,"error npy:%d",npy10);
*/
- coefh = px % sqrtperte;
- coefv = py % sqrtperte;
+ coefh = px % sqrtperte;
+ coefv = py % sqrtperte;
#ifdef USE_ASM
- pos = (y * prevX + x) * 2;
- coeffs[pos] = (npx10 + prevX * npy10) * 4;
+ pos = (y * prevX + x) * 2;
+ coeffs[pos] = (npx10 + prevX * npy10) * 4;
- if (!(coefh || coefv))
- coeffs[pos + 1] = (sqrtperte * sqrtperte - 1);
- else
- coeffs[pos + 1] = ((sqrtperte - coefh) * (sqrtperte - coefv));
+ if (!(coefh || coefv))
+ coeffs[pos + 1] = (sqrtperte * sqrtperte - 1);
+ else
+ coeffs[pos + 1] = ((sqrtperte - coefh) * (sqrtperte - coefv));
- coeffs[pos + 1] |= (coefh * (sqrtperte - coefv)) << 8;
- coeffs[pos + 1] |= ((sqrtperte - coefh) * coefv) << 16;
- coeffs[pos + 1] |= (coefh * coefv) << 24;
+ coeffs[pos + 1] |= (coefh * (sqrtperte - coefv)) << 8;
+ coeffs[pos + 1] |= ((sqrtperte - coefh) * coefv) << 16;
+ coeffs[pos + 1] |= (coefh * coefv) << 24;
#else
- pos = y * prevX + x;
- pos10[pos] = npx10 + prevX * npy10;
+ pos = y * prevX + x;
+ pos10[pos] = npx10 + prevX * npy10;
- if (!(coefh || coefv))
- c1[pos] = sqrtperte * sqrtperte - 1;
- else
- c1[pos] = (sqrtperte - coefh) * (sqrtperte - coefv);
+ if (!(coefh || coefv))
+ c1[pos] = sqrtperte * sqrtperte - 1;
+ else
+ c1[pos] = (sqrtperte - coefh) * (sqrtperte - coefv);
- c2[pos] = coefh * (sqrtperte - coefv);
- c3[pos] = (sqrtperte - coefh) * coefv;
- c4[pos] = coefh * coefv;
+ c2[pos] = coefh * (sqrtperte - coefv);
+ c3[pos] = (sqrtperte - coefh) * coefv;
+ c4[pos] = coefh * coefv;
#endif
- }
+ }
}
}
#ifdef USE_ASM
getPixelRGB_ (pix1, pos10[position] + prevX + 1, &col4);
couleur.r = col1.r * c1[position]
- + col2.r * c2[position]
- + col3.r * c3[position]
- + col4.r * c4[position];
+ + col2.r * c2[position]
+ + col3.r * c3[position]
+ + col4.r * c4[position];
couleur.r >>= pertedec;
couleur.v = col1.v * c1[position]
- + col2.v * c2[position]
- + col3.v * c3[position]
- + col4.v * c4[position];
+ + col2.v * c2[position]
+ + col3.v * c3[position]
+ + col4.v * c4[position];
couleur.v >>= pertedec;
couleur.b = col1.b * c1[position]
- + col2.b * c2[position]
- + col3.b * c3[position]
- + col4.b * c4[position];
+ + col2.b * c2[position]
+ + col3.b * c3[position]
+ + col4.b * c4[position];
couleur.b >>= pertedec;
setPixelRGB_ (pix2, position, couleur);
guint32 *
goom_update (gint16 data[2][512])
{
- static int lockvar = 0; /* pour empecher de nouveaux changements */
- static int goomvar = 0; /* boucle des gooms */
- static int totalgoom = 0; /* nombre de gooms par seconds */
- static int agoom = 0; /* un goom a eu lieu.. */
- static int loopvar = 0; /* mouvement des points */
- static int speedvar = 0; /* vitesse des particules */
- static int lineMode = 0; /* l'effet lineaire a dessiner */
+ static int lockvar = 0; /* pour empecher de nouveaux changements */
+ static int goomvar = 0; /* boucle des gooms */
+ static int totalgoom = 0; /* nombre de gooms par seconds */
+ static int agoom = 0; /* un goom a eu lieu.. */
+ static int loopvar = 0; /* mouvement des points */
+ static int speedvar = 0; /* vitesse des particules */
+ static int lineMode = 0; /* l'effet lineaire a dessiner */
guint32 *return_val;
guint32 pointWidth;
guint32 pointHeight;
- int incvar; /* volume du son */
- int accelvar; /* acceleration des particules */
+ int incvar; /* volume du son */
+ int accelvar; /* acceleration des particules */
int i;
- float largfactor; /* elargissement de l'intervalle d'évolution des points */
- static char goomlimit = 2; /* sensibilité du goom */
+ float largfactor; /* elargissement de l'intervalle d'évolution des points */
+ static char goomlimit = 2; /* sensibilité du goom */
static ZoomFilterData zfd = {
128, 8, 16,
1, 1, 0, WAVE_MODE,
loopvar += speedvar + 1;
pointFilter (p1,
- YELLOW,
- ((pointWidth - 6.0f) * largfactor + 5.0f),
- ((pointHeight - 6.0f) * largfactor + 5.0f),
- i * 152.0f, 128.0f, loopvar + i * 2032);
+ YELLOW,
+ ((pointWidth - 6.0f) * largfactor + 5.0f),
+ ((pointHeight - 6.0f) * largfactor + 5.0f),
+ i * 152.0f, 128.0f, loopvar + i * 2032);
pointFilter (p1, ORANGE,
- ((pointWidth / 2) * largfactor) / i + 10.0f * i,
- ((pointHeight / 2) * largfactor) / i + 10.0f * i,
- 96.0f, i * 80.0f, loopvar / i);
+ ((pointWidth / 2) * largfactor) / i + 10.0f * i,
+ ((pointHeight / 2) * largfactor) / i + 10.0f * i,
+ 96.0f, i * 80.0f, loopvar / i);
pointFilter (p1, VIOLET,
- ((pointHeight / 3 + 5.0f) * largfactor) / i + 10.0f * i,
- ((pointHeight / 3 + 5.0f) * largfactor) / i + 10.0f * i,
- i + 122.0f, 134.0f, loopvar / i);
+ ((pointHeight / 3 + 5.0f) * largfactor) / i + 10.0f * i,
+ ((pointHeight / 3 + 5.0f) * largfactor) / i + 10.0f * i,
+ i + 122.0f, 134.0f, loopvar / i);
pointFilter (p1, BLACK,
- ((pointHeight / 3) * largfactor + 20.0f),
- ((pointHeight / 3) * largfactor + 20.0f),
- 58.0f, i * 66.0f, loopvar / i);
+ ((pointHeight / 3) * largfactor + 20.0f),
+ ((pointHeight / 3) * largfactor + 20.0f),
+ 58.0f, i * 66.0f, loopvar / i);
pointFilter (p1, WHITE,
- (pointHeight * largfactor + 10.0f * i) / i,
- (pointHeight * largfactor + 10.0f * i) / i,
- 66.0f, 74.0f, loopvar + i * 500);
+ (pointHeight * largfactor + 10.0f * i) / i,
+ (pointHeight * largfactor + 10.0f * i) / i,
+ 66.0f, 74.0f, loopvar + i * 500);
}
/* par défaut pas de changement de zoom */
if ((accelvar > goomlimit) || (accelvar < -goomlimit)) {
/* UN GOOM !!! YAHOO ! */
totalgoom++;
- agoom = 20; /* mais pdt 20 cycles, il n'y en aura plus. */
- lineMode = (lineMode + 1) % 20; /* Tous les 10 gooms on change de mode lineaire */
+ agoom = 20; /* mais pdt 20 cycles, il n'y en aura plus. */
+ lineMode = (lineMode + 1) % 20; /* Tous les 10 gooms on change de mode lineaire */
/* changement eventuel de mode */
switch (iRAND (10)) {
case 0:
case 1:
case 2:
- zfd.mode = WAVE_MODE;
- zfd.vitesse = STOP_SPEED - 1;
- zfd.reverse = 0;
- break;
+ zfd.mode = WAVE_MODE;
+ zfd.vitesse = STOP_SPEED - 1;
+ zfd.reverse = 0;
+ break;
case 3:
case 4:
- zfd.mode = CRYSTAL_BALL_MODE;
- break;
+ zfd.mode = CRYSTAL_BALL_MODE;
+ break;
case 5:
- zfd.mode = AMULETTE_MODE;
- break;
+ zfd.mode = AMULETTE_MODE;
+ break;
case 6:
- zfd.mode = WATER_MODE;
- break;
+ zfd.mode = WATER_MODE;
+ break;
case 7:
- zfd.mode = SCRUNCH_MODE;
- break;
+ zfd.mode = SCRUNCH_MODE;
+ break;
default:
- zfd.mode = NORMAL_MODE;
+ zfd.mode = NORMAL_MODE;
}
}
goomvar++;
/*if (goomvar % 1 == 0) */
{
- guint32 vtmp;
- guint32 newvit;
-
- newvit = STOP_SPEED - speedvar / 2;
- /* retablir le zoom avant.. */
- if ((zfd.reverse) && (!(cycle % 12)) && (rand () % 3 == 0)) {
- zfd.reverse = 0;
- zfd.vitesse = STOP_SPEED - 2;
- lockvar = 50;
- }
- if (iRAND (10) == 0) {
- zfd.reverse = 1;
- lockvar = 100;
- }
-
- /* changement de milieu.. */
- switch (iRAND (20)) {
- case 0:
- zfd.middleY = resoly - 1;
- zfd.middleX = resolx / 2;
- break;
- case 1:
- zfd.middleX = resolx - 1;
- break;
- case 2:
- zfd.middleX = 1;
- break;
- default:
- zfd.middleY = resoly / 2;
- zfd.middleX = resolx / 2;
- }
-
- if (zfd.mode == WATER_MODE) {
- zfd.middleX = resolx / 2;
- zfd.middleY = resoly / 2;
- }
-
- switch (vtmp = (iRAND (27))) {
- case 0:
- zfd.vPlaneEffect = iRAND (3);
- zfd.vPlaneEffect -= iRAND (3);
- zfd.hPlaneEffect = iRAND (3);
- zfd.hPlaneEffect -= iRAND (3);
- break;
- case 3:
- zfd.vPlaneEffect = 0;
- zfd.hPlaneEffect = iRAND (8);
- zfd.hPlaneEffect -= iRAND (8);
- break;
- case 4:
- case 5:
- case 6:
- case 7:
- zfd.vPlaneEffect = iRAND (5);
- zfd.vPlaneEffect -= iRAND (5);
- zfd.hPlaneEffect = -zfd.vPlaneEffect;
- break;
- case 8:
- zfd.hPlaneEffect = 5 + iRAND (8);
- zfd.vPlaneEffect = -zfd.hPlaneEffect;
- break;
- case 9:
- zfd.vPlaneEffect = 5 + iRAND (8);
- zfd.hPlaneEffect = -zfd.hPlaneEffect;
- break;
- case 13:
- zfd.hPlaneEffect = 0;
- zfd.vPlaneEffect = iRAND (10);
- zfd.vPlaneEffect -= iRAND (10);
- break;
- default:
- if (vtmp < 10) {
- zfd.vPlaneEffect = 0;
- zfd.hPlaneEffect = 0;
- }
- }
-
- if (iRAND (3) != 0)
- zfd.noisify = 0;
- else {
- zfd.noisify = iRAND (3) + 2;
- lockvar *= 3;
- }
-
- if (zfd.mode == AMULETTE_MODE) {
- zfd.vPlaneEffect = 0;
- zfd.hPlaneEffect = 0;
- zfd.noisify = 0;
- }
-
- if ((zfd.middleX == 1) || (zfd.middleX == resolx - 1)) {
- zfd.vPlaneEffect = 0;
- zfd.hPlaneEffect = iRAND (2) ? 0 : zfd.hPlaneEffect;
- }
-
- if (newvit < zfd.vitesse) { /* on accelere */
- pzfd = &zfd;
- if (((newvit < STOP_SPEED - 7) &&
- (zfd.vitesse < STOP_SPEED - 6) &&
- (cycle % 3 == 0)) || (iRAND (40) == 0)) {
- zfd.vitesse = STOP_SPEED - 1;
- zfd.reverse = !zfd.reverse;
- } else {
- zfd.vitesse = (newvit + zfd.vitesse * 4) / 5;
- }
- lockvar += 50;
- }
+ guint32 vtmp;
+ guint32 newvit;
+
+ newvit = STOP_SPEED - speedvar / 2;
+ /* retablir le zoom avant.. */
+ if ((zfd.reverse) && (!(cycle % 12)) && (rand () % 3 == 0)) {
+ zfd.reverse = 0;
+ zfd.vitesse = STOP_SPEED - 2;
+ lockvar = 50;
+ }
+ if (iRAND (10) == 0) {
+ zfd.reverse = 1;
+ lockvar = 100;
+ }
+
+ /* changement de milieu.. */
+ switch (iRAND (20)) {
+ case 0:
+ zfd.middleY = resoly - 1;
+ zfd.middleX = resolx / 2;
+ break;
+ case 1:
+ zfd.middleX = resolx - 1;
+ break;
+ case 2:
+ zfd.middleX = 1;
+ break;
+ default:
+ zfd.middleY = resoly / 2;
+ zfd.middleX = resolx / 2;
+ }
+
+ if (zfd.mode == WATER_MODE) {
+ zfd.middleX = resolx / 2;
+ zfd.middleY = resoly / 2;
+ }
+
+ switch (vtmp = (iRAND (27))) {
+ case 0:
+ zfd.vPlaneEffect = iRAND (3);
+ zfd.vPlaneEffect -= iRAND (3);
+ zfd.hPlaneEffect = iRAND (3);
+ zfd.hPlaneEffect -= iRAND (3);
+ break;
+ case 3:
+ zfd.vPlaneEffect = 0;
+ zfd.hPlaneEffect = iRAND (8);
+ zfd.hPlaneEffect -= iRAND (8);
+ break;
+ case 4:
+ case 5:
+ case 6:
+ case 7:
+ zfd.vPlaneEffect = iRAND (5);
+ zfd.vPlaneEffect -= iRAND (5);
+ zfd.hPlaneEffect = -zfd.vPlaneEffect;
+ break;
+ case 8:
+ zfd.hPlaneEffect = 5 + iRAND (8);
+ zfd.vPlaneEffect = -zfd.hPlaneEffect;
+ break;
+ case 9:
+ zfd.vPlaneEffect = 5 + iRAND (8);
+ zfd.hPlaneEffect = -zfd.hPlaneEffect;
+ break;
+ case 13:
+ zfd.hPlaneEffect = 0;
+ zfd.vPlaneEffect = iRAND (10);
+ zfd.vPlaneEffect -= iRAND (10);
+ break;
+ default:
+ if (vtmp < 10) {
+ zfd.vPlaneEffect = 0;
+ zfd.hPlaneEffect = 0;
+ }
+ }
+
+ if (iRAND (3) != 0)
+ zfd.noisify = 0;
+ else {
+ zfd.noisify = iRAND (3) + 2;
+ lockvar *= 3;
+ }
+
+ if (zfd.mode == AMULETTE_MODE) {
+ zfd.vPlaneEffect = 0;
+ zfd.hPlaneEffect = 0;
+ zfd.noisify = 0;
+ }
+
+ if ((zfd.middleX == 1) || (zfd.middleX == resolx - 1)) {
+ zfd.vPlaneEffect = 0;
+ zfd.hPlaneEffect = iRAND (2) ? 0 : zfd.hPlaneEffect;
+ }
+
+ if (newvit < zfd.vitesse) { /* on accelere */
+ pzfd = &zfd;
+ if (((newvit < STOP_SPEED - 7) &&
+ (zfd.vitesse < STOP_SPEED - 6) &&
+ (cycle % 3 == 0)) || (iRAND (40) == 0)) {
+ zfd.vitesse = STOP_SPEED - 1;
+ zfd.reverse = !zfd.reverse;
+ } else {
+ zfd.vitesse = (newvit + zfd.vitesse * 4) / 5;
+ }
+ lockvar += 50;
+ }
}
}
/* mode mega-lent */
/* si on est dans un goom : afficher les lignes... */
if (agoom > 15)
goom_lines
- (data, ((zfd.middleX == resolx / 2) && (zfd.middleY == resoly / 2)
- && (zfd.mode != WATER_MODE))
- ? (lineMode / 10) : 0, p2, agoom - 15);
+ (data, ((zfd.middleX == resolx / 2) && (zfd.middleY == resoly / 2)
+ && (zfd.mode != WATER_MODE))
+ ? (lineMode / 10) : 0, p2, agoom - 15);
return_val = p2;
tmp = p1;
goomlimit++;
} else {
if ((totalgoom == 0) && (goomlimit > 1))
- goomlimit--;
+ goomlimit--;
}
totalgoom = 0;
}
GST_STATIC_CAPS (GST_VIDEO_CAPS_xRGB_HOST_ENDIAN)
);
-static GstStaticPadTemplate sink_template = GST_STATIC_PAD_TEMPLATE ("sink", /* the name of the pads */
- GST_PAD_SINK, /* type of the pad */
- GST_PAD_ALWAYS, /* ALWAYS/SOMETIMES */
+static GstStaticPadTemplate sink_template = GST_STATIC_PAD_TEMPLATE ("sink", /* the name of the pads */
+ GST_PAD_SINK, /* type of the pad */
+ GST_PAD_ALWAYS, /* ALWAYS/SOMETIMES */
GST_STATIC_CAPS ("audio/x-raw-int, "
- "endianness = (int) BYTE_ORDER, "
- "signed = (boolean) TRUE, "
- "width = (int) 16, "
- "depth = (int) 16, "
- "rate = (int) [ 8000, 96000 ], " "channels = (int) [ 1, 2 ]")
+ "endianness = (int) BYTE_ORDER, "
+ "signed = (boolean) TRUE, "
+ "width = (int) 16, "
+ "depth = (int) 16, "
+ "rate = (int) [ 8000, 96000 ], " "channels = (int) [ 1, 2 ]")
);
0,
(GInstanceInitFunc) gst_goom_init,
};
+
type = g_type_register_static (GST_TYPE_ELEMENT, "GstGOOM", &info, 0);
}
return type;
goom->width = 320;
goom->height = 200;
- goom->fps = 25.; /* desired frame rate */
+ goom->fps = 25.; /* desired frame rate */
goom->channels = 0;
/* set to something */
goom_init (50, 50);
return newcaps;
}
if (gst_caps_structure_fixate_field_nearest_double (structure, "framerate",
- 30.0)) {
+ 30.0)) {
return newcaps;
}
switch (GST_EVENT_TYPE (event)) {
case GST_EVENT_DISCONTINUOUS:
{
- gint64 value = 0;
+ gint64 value = 0;
- gst_event_discont_get_value (event, GST_FORMAT_TIME, &value);
+ gst_event_discont_get_value (event, GST_FORMAT_TIME, &value);
- goom->next_time = value;
+ goom->next_time = value;
}
default:
- gst_pad_event_default (pad, event);
- break;
+ gst_pad_event_default (pad, event);
+ break;
}
return;
}
if (goom->channels == 0) {
GST_ELEMENT_ERROR (goom, CORE, NEGOTIATION, (NULL),
- ("format wasn't negotiated before chain function"));
+ ("format wasn't negotiated before chain function"));
goto done;
}
unsigned char *color = 1 + (unsigned char *) &color1;
switch (ID) {
- case 0: /* Horizontal stereo lines */
+ case 0: /* Horizontal stereo lines */
{
color1 = 0x0000AA00;
color2 = 0x00AA0000;
break;
}
- case 1: /* Stereo circles */
+ case 1: /* Stereo circles */
{
color1 = 0x00AA33DD;
color2 = 0x00AA33DD;
*color = lighten (*color, power);
switch (ID) {
- case 0: /* Horizontal stereo lines */
+ case 0: /* Horizontal stereo lines */
{
unsigned int i;
for (i = 0; i < 512; i++) {
- guint32 plot;
+ guint32 plot;
- plot = i * resolx / 512 + (resoly / 4 + data[0][i] / 1600) * resolx;
- p[plot] = color1;
- p[plot + 1] = color1;
- plot = i * resolx / 512 + (resoly * 3 / 4 - data[1][i] / 1600) * resolx;
- p[plot] = color2;
- p[plot + 1] = color2;
+ plot = i * resolx / 512 + (resoly / 4 + data[0][i] / 1600) * resolx;
+ p[plot] = color1;
+ p[plot + 1] = color1;
+ plot = i * resolx / 512 + (resoly * 3 / 4 - data[1][i] / 1600) * resolx;
+ p[plot] = color2;
+ p[plot + 1] = color2;
}
break;
}
- case 1: /* Stereo circles */
+ case 1: /* Stereo circles */
{
float z;
unsigned int monX = resolx / 2;
float monY2 = resoly / 2;
for (z = 0; z < 6.2832f; z += 1.0f / monY) {
- /* float offset1 = 128+data[1][(unsigned int)(z*81.33f)])/200000; */
- p[monX + (unsigned int) ((monY + ((float) resoly) * (128 +
- data[1][(unsigned int) (z * 81.33f)]) / 200000) *
- cos (z) + resolx * (unsigned int) (monY2 + (monY +
- ((float) resoly) * (128 +
- data[1][(unsigned int) (z * 81.33f)]) / 400000) *
- sin (z)))] = color1;
- p[monX + (unsigned int) ((monY - ((float) resoly) * (128 +
- data[0][(unsigned int) (z * 81.33f)]) / 200000) *
- cos (z) + resolx * (unsigned int) (monY2 + (monY -
- ((float) resoly) * (128 +
- data[0][(unsigned int) (z * 81.33f)]) / 400000) *
- sin (z)))] = color2;
+ /* float offset1 = 128+data[1][(unsigned int)(z*81.33f)])/200000; */
+ p[monX + (unsigned int) ((monY + ((float) resoly) * (128 +
+ data[1][(unsigned int) (z * 81.33f)]) / 200000) *
+ cos (z) + resolx * (unsigned int) (monY2 + (monY +
+ ((float) resoly) * (128 +
+ data[1][(unsigned int) (z * 81.33f)]) / 400000) *
+ sin (z)))] = color1;
+ p[monX + (unsigned int) ((monY - ((float) resoly) * (128 +
+ data[0][(unsigned int) (z * 81.33f)]) / 200000) *
+ cos (z) + resolx * (unsigned int) (monY2 + (monY -
+ ((float) resoly) * (128 +
+ data[0][(unsigned int) (z * 81.33f)]) / 400000) *
+ sin (z)))] = color2;
}
break;
}
0,
(GInstanceInitFunc) gst_alawdec_init,
};
+
alawdec_type =
- g_type_register_static (GST_TYPE_ELEMENT, "GstALawDec", &alawdec_info,
- 0);
+ g_type_register_static (GST_TYPE_ELEMENT, "GstALawDec", &alawdec_info,
+ 0);
}
return alawdec_type;
}
0,
(GInstanceInitFunc) gst_alawenc_init,
};
+
alawenc_type =
- g_type_register_static (GST_TYPE_ELEMENT, "GstALawEnc", &alawenc_info,
- 0);
+ g_type_register_static (GST_TYPE_ELEMENT, "GstALawEnc", &alawenc_info,
+ 0);
}
return alawenc_type;
}
gst_pad_template_new ("sink", GST_PAD_SINK, GST_PAD_ALWAYS, alaw_caps);
if (!gst_element_register (plugin, "alawenc",
- GST_RANK_NONE, GST_TYPE_ALAWENC) ||
+ GST_RANK_NONE, GST_TYPE_ALAWENC) ||
!gst_element_register (plugin, "alawdec",
- GST_RANK_PRIMARY, GST_TYPE_ALAWENC))
+ GST_RANK_PRIMARY, GST_TYPE_ALAWENC))
return FALSE;
return TRUE;
#include <glib.h>
-#define ZEROTRAP /* turn on the trap as per the MIL-STD */
-#define BIAS 0x84 /* define the add-in bias for 16 bit samples */
+#define ZEROTRAP /* turn on the trap as per the MIL-STD */
+#define BIAS 0x84 /* define the add-in bias for 16 bit samples */
#define CLIP 32635
void
for (i = 0; i < numsamples; i++) {
sample = in[i];
/** get the sample into sign-magnitude **/
- sign = (sample >> 8) & 0x80; /* set aside the sign */
+ sign = (sample >> 8) & 0x80; /* set aside the sign */
if (sign != 0)
- sample = -sample; /* get magnitude */
+ sample = -sample; /* get magnitude */
if (sample > CLIP)
- sample = CLIP; /* clip the magnitude */
+ sample = CLIP; /* clip the magnitude */
/** convert from 16 bit linear to ulaw **/
sample = sample + BIAS;
exponent = exp_lut[(sample >> 7) & 0xFF];
ulawbyte = ~(sign | (exponent << 4) | mantissa);
#ifdef ZEROTRAP
if (ulawbyte == 0)
- ulawbyte = 0x02; /* optional CCITT trap */
+ ulawbyte = 0x02; /* optional CCITT trap */
#endif
out[i] = ulawbyte;
}
0,
(GInstanceInitFunc) gst_mulawdec_init,
};
+
mulawdec_type =
- g_type_register_static (GST_TYPE_ELEMENT, "GstMuLawDec", &mulawdec_info,
- 0);
+ g_type_register_static (GST_TYPE_ELEMENT, "GstMuLawDec", &mulawdec_info,
+ 0);
}
return mulawdec_type;
}
0,
(GInstanceInitFunc) gst_mulawenc_init,
};
+
mulawenc_type =
- g_type_register_static (GST_TYPE_ELEMENT, "GstMuLawEnc", &mulawenc_info,
- 0);
+ g_type_register_static (GST_TYPE_ELEMENT, "GstMuLawEnc", &mulawenc_info,
+ 0);
}
return mulawenc_type;
}
gst_pad_template_new ("sink", GST_PAD_SINK, GST_PAD_ALWAYS, mulaw_caps);
if (!gst_element_register (plugin, "mulawenc",
- GST_RANK_NONE, GST_TYPE_MULAWENC) ||
+ GST_RANK_NONE, GST_TYPE_MULAWENC) ||
!gst_element_register (plugin, "mulawdec",
- GST_RANK_PRIMARY, GST_TYPE_MULAWDEC))
+ GST_RANK_PRIMARY, GST_TYPE_MULAWDEC))
return FALSE;
return TRUE;
sizeof (GstLevel), 0,
(GInstanceInitFunc) gst_level_init
};
+
level_type = g_type_register_static (GST_TYPE_ELEMENT, "GstLevel",
- &level_info, 0);
+ &level_info, 0);
}
return level_type;
}
for (i = 0; i < filter->channels; ++i) {
filter->CS[i] = filter->peak[i] = filter->last_peak[i] =
- filter->decay_peak[i] = filter->decay_peak_age[i] =
- filter->MS[i] = filter->RMS_dB[i] = 0.0;
+ filter->decay_peak[i] = filter->decay_peak_age[i] =
+ filter->MS[i] = filter->RMS_dB[i] = 0.0;
}
filter->inited = TRUE;
gint resolution, double *CS, double *peak)
#include "filter.func"
static void inline
- gst_level_fast_8bit_chain (gint8 * in, guint num, gint channels,
+ gst_level_fast_8bit_chain (gint8 * in, guint num, gint channels,
gint resolution, double *CS, double *peak)
#include "filter.func"
static void gst_level_chain (GstPad * pad, GstData * _data)
num_samples = GST_BUFFER_SIZE (buf) / (filter->width / 8);
if (num_samples % filter->channels != 0)
g_warning
- ("WARNING: level: programming error, data not properly interleaved");
+ ("WARNING: level: programming error, data not properly interleaved");
for (i = 0; i < filter->channels; ++i) {
switch (filter->width) {
case 16:
- gst_level_fast_16bit_chain (in_data + i, num_samples,
- filter->channels, filter->width - 1, &CS, &filter->peak[i]);
- break;
+ gst_level_fast_16bit_chain (in_data + i, num_samples,
+ filter->channels, filter->width - 1, &CS, &filter->peak[i]);
+ break;
case 8:
- gst_level_fast_8bit_chain (((gint8 *) in_data) + i, num_samples,
- filter->channels, filter->width - 1, &CS, &filter->peak[i]);
- break;
+ gst_level_fast_8bit_chain (((gint8 *) in_data) + i, num_samples,
+ filter->channels, filter->width - 1, &CS, &filter->peak[i]);
+ break;
}
/* g_print ("DEBUG: CS %f, peak %f\n", CS, filter->peak[i]); */
filter->CS[i] += CS;
} else {
/* make decay peak fall off if too old */
if (filter->decay_peak_age[i] > filter->rate * filter->decay_peak_ttl) {
- double falloff_dB;
- double falloff;
- double length; /* length of buffer in seconds */
+ double falloff_dB;
+ double falloff;
+ double length; /* length of buffer in seconds */
- length = (double) num_samples / (filter->channels * filter->rate);
- falloff_dB = filter->decay_peak_falloff * length;
- falloff = pow (10, falloff_dB / -20.0);
+ length = (double) num_samples / (filter->channels * filter->rate);
+ falloff_dB = filter->decay_peak_falloff * length;
+ falloff = pow (10, falloff_dB / -20.0);
- /* g_print ("falloff: length %f, dB falloff %f, falloff factor %e\n",
- length, falloff_dB, falloff); */
- filter->decay_peak[i] *= falloff;
- /* g_print ("peak is %f samples old, decayed with factor %e to %f\n",
- filter->decay_peak_age[i], falloff, filter->decay_peak[i]); */
+ /* g_print ("falloff: length %f, dB falloff %f, falloff factor %e\n",
+ length, falloff_dB, falloff); */
+ filter->decay_peak[i] *= falloff;
+ /* g_print ("peak is %f samples old, decayed with factor %e to %f\n",
+ filter->decay_peak_age[i], falloff, filter->decay_peak[i]); */
}
}
}
gdouble RMS, peak, endtime;
for (i = 0; i < filter->channels; ++i) {
- RMS = sqrt (filter->CS[i] / (filter->num_samples / filter->channels));
- peak = filter->last_peak[i];
- num_samples = GST_BUFFER_SIZE (buf) / (filter->width / 8);
- endtime = (double) GST_BUFFER_TIMESTAMP (buf) / GST_SECOND
- + (double) num_samples / (double) filter->rate;
-
- g_signal_emit (G_OBJECT (filter), gst_filter_signals[SIGNAL_LEVEL], 0,
- endtime, i,
- 20 * log10 (RMS), 20 * log10 (filter->last_peak[i]),
- 20 * log10 (filter->decay_peak[i]));
- /* we emitted, so reset cumulative and normal peak */
- filter->CS[i] = 0.0;
- filter->last_peak[i] = 0.0;
+ RMS = sqrt (filter->CS[i] / (filter->num_samples / filter->channels));
+ peak = filter->last_peak[i];
+ num_samples = GST_BUFFER_SIZE (buf) / (filter->width / 8);
+ endtime = (double) GST_BUFFER_TIMESTAMP (buf) / GST_SECOND
+ + (double) num_samples / (double) filter->rate;
+
+ g_signal_emit (G_OBJECT (filter), gst_filter_signals[SIGNAL_LEVEL], 0,
+ endtime, i,
+ 20 * log10 (RMS), 20 * log10 (filter->last_peak[i]),
+ 20 * log10 (filter->decay_peak[i]));
+ /* we emitted, so reset cumulative and normal peak */
+ filter->CS[i] = 0.0;
+ filter->last_peak[i] = 0.0;
}
}
filter->num_samples = 0;
switch (GST_STATE_TRANSITION (element)) {
case GST_STATE_PAUSED_TO_PLAYING:
if (!filter->inited)
- return GST_STATE_FAILURE;
+ return GST_STATE_FAILURE;
break;
default:
break;
parent_class = g_type_class_ref (GST_TYPE_ELEMENT);
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_SIGNAL_LEVEL,
g_param_spec_boolean ("signal", "Signal",
- "Emit level signals for each interval", TRUE, G_PARAM_READWRITE));
+ "Emit level signals for each interval", TRUE, G_PARAM_READWRITE));
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_SIGNAL_INTERVAL,
g_param_spec_double ("interval", "Interval",
- "Interval between emissions (in seconds)",
- 0.01, 100.0, 0.1, G_PARAM_READWRITE));
+ "Interval between emissions (in seconds)",
+ 0.01, 100.0, 0.1, G_PARAM_READWRITE));
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_PEAK_TTL,
g_param_spec_double ("peak_ttl", "Peak TTL",
- "Time To Live of decay peak before it falls back",
- 0, 100.0, 0.3, G_PARAM_READWRITE));
+ "Time To Live of decay peak before it falls back",
+ 0, 100.0, 0.3, G_PARAM_READWRITE));
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_PEAK_FALLOFF,
g_param_spec_double ("peak_falloff", "Peak Falloff",
- "Decay rate of decay peak after TTL (in dB/sec)",
- 0.0, G_MAXDOUBLE, 10.0, G_PARAM_READWRITE));
+ "Decay rate of decay peak after TTL (in dB/sec)",
+ 0.0, G_MAXDOUBLE, 10.0, G_PARAM_READWRITE));
gobject_class->set_property = gst_level_set_property;
gobject_class->get_property = gst_level_get_property;
filter->interval = 0.1;
filter->decay_peak_ttl = 0.4;
- filter->decay_peak_falloff = 10.0; /* dB falloff (/sec) */
+ filter->decay_peak_falloff = 10.0; /* dB falloff (/sec) */
}
static gboolean
#include <gst/gst.h>
#include <gtk/gtk.h>
-gboolean got_channel[2] = { FALSE, FALSE }; /* to see if we got the signal for this one yet */
-gint channels = 0; /* guess at how many channels there are */
-gdouble last_time = 0.0; /* time of last signal */
-gdouble values[2][3]; /* array of levels from which to print */
+gboolean got_channel[2] = { FALSE, FALSE }; /* to see if we got the signal for this one yet */
+gint channels = 0; /* guess at how many channels there are */
+gdouble last_time = 0.0; /* time of last signal */
+gdouble values[2][3]; /* array of levels from which to print */
static void
level_callback (GstElement * element, gdouble time, gint channel,
g_print ("%f ", time);
for (i = 0; i < channels; ++i)
for (j = 0; j < 3; ++j)
- g_print ("%f ", values[i][j]);
+ g_print ("%f ", values[i][j]);
g_print ("\n");
}
}
};
gst_ebml_read_type =
- g_type_register_static (GST_TYPE_ELEMENT, "GstEbmlRead",
- &gst_ebml_read_info, 0);
+ g_type_register_static (GST_TYPE_ELEMENT, "GstEbmlRead",
+ &gst_ebml_read_info, 0);
}
return gst_ebml_read_type;
switch (GST_STATE_TRANSITION (element)) {
case GST_STATE_READY_TO_PAUSED:
if (!ebml->sinkpad)
- return GST_STATE_FAILURE;
+ return GST_STATE_FAILURE;
ebml->bs = gst_bytestream_new (ebml->sinkpad);
break;
case GST_STATE_PAUSED_TO_READY:
gst_bytestream_destroy (ebml->bs);
while (ebml->level) {
- GstEbmlLevel *level = ebml->level->data;
+ GstEbmlLevel *level = ebml->level->data;
- ebml->level = g_list_remove (ebml->level, level);
- g_free (level);
+ ebml->level = g_list_remove (ebml->level, level);
+ g_free (level);
}
break;
default:
gst_event_unref (event);
GST_ELEMENT_ERROR (ebml, RESOURCE, READ, (NULL),
- ("Read error at position %llu (0x%llx)", pos, pos));
+ ("Read error at position %llu (0x%llx)", pos, pos));
return -1;
}
}
guint64 pos = gst_bytestream_tell (ebml->bs);
GST_ELEMENT_ERROR (ebml, STREAM, DEMUX, (NULL),
- ("Invalid EBML ID size tag (0x%x) at position %llu (0x%llx)",
- data[0], pos, pos));
+ ("Invalid EBML ID size tag (0x%x) at position %llu (0x%llx)",
+ data[0], pos, pos));
return -1;
}
guint64 pos = gst_bytestream_tell (ebml->bs);
GST_ELEMENT_ERROR (ebml, RESOURCE, READ, (NULL),
- ("Read error at position %llu (0x%llx)", pos, pos));
+ ("Read error at position %llu (0x%llx)", pos, pos));
return -1;
}
while (n < read)
guint64 pos = gst_bytestream_tell (ebml->bs);
GST_ELEMENT_ERROR (ebml, RESOURCE, READ, (NULL),
- ("Read error at position %llu (0x%llx)", pos, pos));
+ ("Read error at position %llu (0x%llx)", pos, pos));
return -1;
}
total = data[0];
guint64 pos = gst_bytestream_tell (ebml->bs);
GST_ELEMENT_ERROR (ebml, STREAM, DEMUX, (NULL),
- ("Invalid EBML length size tag (0x%x) at position %llu (0x%llx)",
- data[0], pos, pos));
+ ("Invalid EBML length size tag (0x%x) at position %llu (0x%llx)",
+ data[0], pos, pos));
return -1;
}
guint64 pos = gst_bytestream_tell (ebml->bs);
GST_ELEMENT_ERROR (ebml, RESOURCE, READ, (NULL),
- ("Read error at position %llu (0x%llx)", pos, pos));
+ ("Read error at position %llu (0x%llx)", pos, pos));
return -1;
}
while (n < read) {
guint64 pos = gst_bytestream_tell (ebml->bs);
GST_ELEMENT_ERROR (ebml, RESOURCE, READ, (NULL),
- ("Read error at position %llu (0x%llx)", pos, pos));
+ ("Read error at position %llu (0x%llx)", pos, pos));
if (buf)
gst_buffer_unref (buf);
return NULL;
/* now seek */
if (!gst_bytestream_seek (ebml->bs, offset, GST_SEEK_METHOD_SET)) {
GST_ELEMENT_ERROR (ebml, RESOURCE, SEEK, (NULL),
- ("Seek to position %llu (0x%llx) failed", offset, offset));
+ ("Seek to position %llu (0x%llx) failed", offset, offset));
return NULL;
}
return gst_bytestream_flush (ebml->bs, length);
if (!(event = gst_ebml_read_seek (ebml,
- gst_bytestream_tell (ebml->bs) + length)))
+ gst_bytestream_tell (ebml->bs) + length)))
return FALSE;
gst_event_unref (event);
size = GST_BUFFER_SIZE (buf);
if (size < 1 || size > 8) {
GST_ELEMENT_ERROR (ebml, STREAM, DEMUX, (NULL),
- ("Invalid integer element size %d at position %llu (0x%llu)",
- size, GST_BUFFER_OFFSET (buf), GST_BUFFER_OFFSET (buf)));
+ ("Invalid integer element size %d at position %llu (0x%llu)",
+ size, GST_BUFFER_OFFSET (buf), GST_BUFFER_OFFSET (buf)));
gst_buffer_unref (buf);
return FALSE;
}
size = GST_BUFFER_SIZE (buf);
if (size < 1 || size > 8) {
GST_ELEMENT_ERROR (ebml, STREAM, DEMUX, (NULL),
- ("Invalid integer element size %d at position %llu (0x%llx)",
- size, GST_BUFFER_OFFSET (buf), GST_BUFFER_OFFSET (buf)));
+ ("Invalid integer element size %d at position %llu (0x%llx)",
+ size, GST_BUFFER_OFFSET (buf), GST_BUFFER_OFFSET (buf)));
gst_buffer_unref (buf);
return FALSE;
}
if (size != 4 && size != 8 && size != 10) {
GST_ELEMENT_ERROR (ebml, STREAM, DEMUX, (NULL),
- ("Invalid float element size %d at position %llu (0x%llx)",
- size, GST_BUFFER_OFFSET (buf), GST_BUFFER_OFFSET (buf)));
+ ("Invalid float element size %d at position %llu (0x%llx)",
+ size, GST_BUFFER_OFFSET (buf), GST_BUFFER_OFFSET (buf)));
gst_buffer_unref (buf);
return FALSE;
}
if (size == 10) {
GST_ELEMENT_ERROR (ebml, CORE, NOT_IMPLEMENTED, (NULL),
- ("FIXME! 10-byte floats unimplemented"));
+ ("FIXME! 10-byte floats unimplemented"));
gst_buffer_unref (buf);
return FALSE;
}
break;
switch (id) {
- /* is our read version uptodate? */
+ /* is our read version uptodate? */
case GST_EBML_ID_EBMLREADVERSION:{
- guint64 num;
-
- if (!gst_ebml_read_uint (ebml, &id, &num))
- return FALSE;
- g_assert (id == GST_EBML_ID_EBMLREADVERSION);
- if (num != GST_EBML_VERSION)
- return FALSE;
- break;
+ guint64 num;
+
+ if (!gst_ebml_read_uint (ebml, &id, &num))
+ return FALSE;
+ g_assert (id == GST_EBML_ID_EBMLREADVERSION);
+ if (num != GST_EBML_VERSION)
+ return FALSE;
+ break;
}
- /* we only handle 8 byte lengths at max */
+ /* we only handle 8 byte lengths at max */
case GST_EBML_ID_EBMLMAXSIZELENGTH:{
- guint64 num;
-
- if (!gst_ebml_read_uint (ebml, &id, &num))
- return FALSE;
- g_assert (id == GST_EBML_ID_EBMLMAXSIZELENGTH);
- if (num != sizeof (guint64))
- return FALSE;
- break;
+ guint64 num;
+
+ if (!gst_ebml_read_uint (ebml, &id, &num))
+ return FALSE;
+ g_assert (id == GST_EBML_ID_EBMLMAXSIZELENGTH);
+ if (num != sizeof (guint64))
+ return FALSE;
+ break;
}
- /* we handle 4 byte IDs at max */
+ /* we handle 4 byte IDs at max */
case GST_EBML_ID_EBMLMAXIDLENGTH:{
- guint64 num;
-
- if (!gst_ebml_read_uint (ebml, &id, &num))
- return FALSE;
- g_assert (id == GST_EBML_ID_EBMLMAXIDLENGTH);
- if (num != sizeof (guint32))
- return FALSE;
- break;
+ guint64 num;
+
+ if (!gst_ebml_read_uint (ebml, &id, &num))
+ return FALSE;
+ g_assert (id == GST_EBML_ID_EBMLMAXIDLENGTH);
+ if (num != sizeof (guint32))
+ return FALSE;
+ break;
}
case GST_EBML_ID_DOCTYPE:{
- gchar *text;
-
- if (!gst_ebml_read_ascii (ebml, &id, &text))
- return FALSE;
- g_assert (id == GST_EBML_ID_DOCTYPE);
- if (doctype) {
- if (doctype)
- g_free (*doctype);
- *doctype = text;
- } else
- g_free (text);
- break;
+ gchar *text;
+
+ if (!gst_ebml_read_ascii (ebml, &id, &text))
+ return FALSE;
+ g_assert (id == GST_EBML_ID_DOCTYPE);
+ if (doctype) {
+ if (doctype)
+ g_free (*doctype);
+ *doctype = text;
+ } else
+ g_free (text);
+ break;
}
case GST_EBML_ID_DOCTYPEREADVERSION:{
- guint64 num;
-
- if (!gst_ebml_read_uint (ebml, &id, &num))
- return FALSE;
- g_assert (id == GST_EBML_ID_DOCTYPEREADVERSION);
- if (version)
- *version = num;
- break;
+ guint64 num;
+
+ if (!gst_ebml_read_uint (ebml, &id, &num))
+ return FALSE;
+ g_assert (id == GST_EBML_ID_DOCTYPEREADVERSION);
+ if (version)
+ *version = num;
+ break;
}
default:
- GST_WARNING ("Unknown data type 0x%x in EBML header (ignored)", id);
- /* pass-through */
+ GST_WARNING ("Unknown data type 0x%x in EBML header (ignored)", id);
+ /* pass-through */
- /* we ignore these two, as they don't tell us anything we care about */
+ /* we ignore these two, as they don't tell us anything we care about */
case GST_EBML_ID_VOID:
case GST_EBML_ID_EBMLVERSION:
case GST_EBML_ID_DOCTYPEVERSION:
- if (!gst_ebml_read_skip (ebml))
- return FALSE;
- break;
+ if (!gst_ebml_read_skip (ebml))
+ return FALSE;
+ break;
}
}
};
gst_ebml_write_type =
- g_type_register_static (GST_TYPE_ELEMENT, "GstEbmlWrite",
- &gst_ebml_write_info, 0);
+ g_type_register_static (GST_TYPE_ELEMENT, "GstEbmlWrite",
+ &gst_ebml_write_info, 0);
}
return gst_ebml_write_type;
if (ebml->cache) {
/* within bounds? */
if (pos >= GST_BUFFER_OFFSET (ebml->cache) &&
- pos <
- GST_BUFFER_OFFSET (ebml->cache) + GST_BUFFER_MAXSIZE (ebml->cache)) {
+ pos <
+ GST_BUFFER_OFFSET (ebml->cache) + GST_BUFFER_MAXSIZE (ebml->cache)) {
GST_BUFFER_SIZE (ebml->cache) = pos - GST_BUFFER_OFFSET (ebml->cache);
if (ebml->pos > pos)
- ebml->handled -= ebml->pos - pos;
+ ebml->handled -= ebml->pos - pos;
else
- ebml->handled += pos - ebml->pos;
+ ebml->handled += pos - ebml->pos;
ebml->pos = pos;
} else {
GST_LOG ("Seek outside cache range. Clearing...");
void
gst_ebml_write_ascii (GstEbmlWrite * ebml, guint32 id, const gchar * str)
{
- gint len = strlen (str) + 1; /* add trailing '\0' */
+ gint len = strlen (str) + 1; /* add trailing '\0' */
GstBuffer *buf = gst_ebml_write_element_new (ebml, len);
gst_ebml_write_element_id (buf, id);
};
gst_matroska_demux_type =
- g_type_register_static (GST_TYPE_EBML_READ,
- "GstMatroskaDemux", &gst_matroska_demux_info, 0);
+ g_type_register_static (GST_TYPE_EBML_READ,
+ "GstMatroskaDemux", &gst_matroska_demux_info, 0);
}
return gst_matroska_demux_type;
g_object_class_install_property (gobject_class, ARG_METADATA,
g_param_spec_boxed ("metadata", "Metadata", "Metadata",
- GST_TYPE_STRUCTURE, G_PARAM_READABLE));
+ GST_TYPE_STRUCTURE, G_PARAM_READABLE));
g_object_class_install_property (gobject_class, ARG_STREAMINFO,
g_param_spec_boxed ("streaminfo", "Streaminfo", "Streaminfo",
- GST_TYPE_STRUCTURE, G_PARAM_READABLE));
+ GST_TYPE_STRUCTURE, G_PARAM_READABLE));
parent_class = g_type_class_ref (GST_TYPE_EBML_READ);
demux->sinkpad =
gst_pad_new_from_template (gst_element_class_get_pad_template (klass,
- "sink"), "sink");
+ "sink"), "sink");
gst_element_add_pad (GST_ELEMENT (demux), demux->sinkpad);
GST_EBML_READ (demux)->sinkpad = demux->sinkpad;
for (i = 0; i < GST_MATROSKA_DEMUX_MAX_STREAMS; i++) {
if (demux->src[i] != NULL) {
if (demux->src[i]->pad != NULL) {
- gst_element_remove_pad (GST_ELEMENT (demux), demux->src[i]->pad);
+ gst_element_remove_pad (GST_ELEMENT (demux), demux->src[i]->pad);
}
g_free (demux->src[i]->codec_id);
g_free (demux->src[i]->codec_name);
if (demux->num_streams >= GST_MATROSKA_DEMUX_MAX_STREAMS) {
GST_WARNING ("Maximum number of streams (%d) exceeded, skipping",
- GST_MATROSKA_DEMUX_MAX_STREAMS);
- return gst_ebml_read_skip (ebml); /* skip-and-continue */
+ GST_MATROSKA_DEMUX_MAX_STREAMS);
+ return gst_ebml_read_skip (ebml); /* skip-and-continue */
}
/* allocate generic... if we know the type, we'll g_renew()
context = g_new0 (GstMatroskaTrackContext, 1);
demux->src[demux->num_streams] = context;
context->index = demux->num_streams;
- context->type = 0; /* no type yet */
+ context->type = 0; /* no type yet */
demux->num_streams++;
/* start with the master */
}
switch (id) {
- /* track number (unique stream ID) */
+ /* track number (unique stream ID) */
case GST_MATROSKA_ID_TRACKNUMBER:{
- guint64 num;
-
- if (!gst_ebml_read_uint (ebml, &id, &num)) {
- res = FALSE;
- break;
- }
- context->num = num;
- break;
+ guint64 num;
+
+ if (!gst_ebml_read_uint (ebml, &id, &num)) {
+ res = FALSE;
+ break;
+ }
+ context->num = num;
+ break;
}
- /* track UID (unique identifier) */
+ /* track UID (unique identifier) */
case GST_MATROSKA_ID_TRACKUID:{
- guint64 num;
-
- if (!gst_ebml_read_uint (ebml, &id, &num)) {
- res = FALSE;
- break;
- }
- context->uid = num;
- break;
+ guint64 num;
+
+ if (!gst_ebml_read_uint (ebml, &id, &num)) {
+ res = FALSE;
+ break;
+ }
+ context->uid = num;
+ break;
}
- /* track type (video, audio, combined, subtitle, etc.) */
+ /* track type (video, audio, combined, subtitle, etc.) */
case GST_MATROSKA_ID_TRACKTYPE:{
- guint64 num;
-
- if (context->type != 0) {
- GST_WARNING
- ("More than one tracktype defined in a trackentry - skipping");
- break;
- }
- if (!gst_ebml_read_uint (ebml, &id, &num)) {
- res = FALSE;
- break;
- }
- context->type = num;
-
- /* ok, so we're actually going to reallocate this thing */
- switch (context->type) {
- case GST_MATROSKA_TRACK_TYPE_VIDEO:
- context = (GstMatroskaTrackContext *)
- g_renew (GstMatroskaTrackVideoContext, context, 1);
- break;
- case GST_MATROSKA_TRACK_TYPE_AUDIO:
- context = (GstMatroskaTrackContext *)
- g_renew (GstMatroskaTrackAudioContext, context, 1);
- /* defaults */
- ((GstMatroskaTrackAudioContext *) context)->channels = 1;
- ((GstMatroskaTrackAudioContext *) context)->samplerate = 8000;
- break;
- case GST_MATROSKA_TRACK_TYPE_COMPLEX:
- context = (GstMatroskaTrackContext *)
- g_renew (GstMatroskaTrackComplexContext, context, 1);
- break;
- case GST_MATROSKA_TRACK_TYPE_SUBTITLE:
- context = (GstMatroskaTrackContext *)
- g_renew (GstMatroskaTrackSubtitleContext, context, 1);
- break;
- case GST_MATROSKA_TRACK_TYPE_LOGO:
- case GST_MATROSKA_TRACK_TYPE_CONTROL:
- default:
- GST_WARNING ("Unknown or unsupported track type 0x%x",
- context->type);
- context->type = 0;
- break;
- }
- demux->src[demux->num_streams - 1] = context;
- break;
+ guint64 num;
+
+ if (context->type != 0) {
+ GST_WARNING
+ ("More than one tracktype defined in a trackentry - skipping");
+ break;
+ }
+ if (!gst_ebml_read_uint (ebml, &id, &num)) {
+ res = FALSE;
+ break;
+ }
+ context->type = num;
+
+ /* ok, so we're actually going to reallocate this thing */
+ switch (context->type) {
+ case GST_MATROSKA_TRACK_TYPE_VIDEO:
+ context = (GstMatroskaTrackContext *)
+ g_renew (GstMatroskaTrackVideoContext, context, 1);
+ break;
+ case GST_MATROSKA_TRACK_TYPE_AUDIO:
+ context = (GstMatroskaTrackContext *)
+ g_renew (GstMatroskaTrackAudioContext, context, 1);
+ /* defaults */
+ ((GstMatroskaTrackAudioContext *) context)->channels = 1;
+ ((GstMatroskaTrackAudioContext *) context)->samplerate = 8000;
+ break;
+ case GST_MATROSKA_TRACK_TYPE_COMPLEX:
+ context = (GstMatroskaTrackContext *)
+ g_renew (GstMatroskaTrackComplexContext, context, 1);
+ break;
+ case GST_MATROSKA_TRACK_TYPE_SUBTITLE:
+ context = (GstMatroskaTrackContext *)
+ g_renew (GstMatroskaTrackSubtitleContext, context, 1);
+ break;
+ case GST_MATROSKA_TRACK_TYPE_LOGO:
+ case GST_MATROSKA_TRACK_TYPE_CONTROL:
+ default:
+ GST_WARNING ("Unknown or unsupported track type 0x%x",
+ context->type);
+ context->type = 0;
+ break;
+ }
+ demux->src[demux->num_streams - 1] = context;
+ break;
}
- /* tracktype specific stuff for video */
+ /* tracktype specific stuff for video */
case GST_MATROSKA_ID_TRACKVIDEO:{
- GstMatroskaTrackVideoContext *videocontext;
-
- if (context->type != GST_MATROSKA_TRACK_TYPE_VIDEO) {
- GST_WARNING
- ("trackvideo EBML entry in non-video track - ignoring track");
- res = FALSE;
- break;
- } else if (!gst_ebml_read_master (ebml, &id)) {
- res = FALSE;
- break;
- }
- videocontext = (GstMatroskaTrackVideoContext *) context;
-
- while (res) {
- if (!(id = gst_ebml_peek_id (ebml, &demux->level_up))) {
- res = FALSE;
- break;
- } else if (demux->level_up > 0) {
- demux->level_up--;
- break;
- }
-
- switch (id) {
- /* fixme, this should be one-up, but I get it here (?) */
- case GST_MATROSKA_ID_TRACKDEFAULTDURATION:{
- guint64 num;
-
- if (!gst_ebml_read_uint (ebml, &id, &num)) {
- res = FALSE;
- break;
- }
- context->default_duration = num;
- break;
- }
-
- /* video framerate */
- case GST_MATROSKA_ID_VIDEOFRAMERATE:{
- gdouble num;
-
- if (!gst_ebml_read_float (ebml, &id, &num)) {
- res = FALSE;
- break;
- }
- context->default_duration = GST_SECOND * (1. / num);
- break;
- }
-
- /* width of the size to display the video at */
- case GST_MATROSKA_ID_VIDEODISPLAYWIDTH:{
- guint64 num;
-
- if (!gst_ebml_read_uint (ebml, &id, &num)) {
- res = FALSE;
- break;
- }
- videocontext->display_width = num;
- break;
- }
-
- /* height of the size to display the video at */
- case GST_MATROSKA_ID_VIDEODISPLAYHEIGHT:{
- guint64 num;
-
- if (!gst_ebml_read_uint (ebml, &id, &num)) {
- res = FALSE;
- break;
- }
- videocontext->display_height = num;
- break;
- }
-
- /* width of the video in the file */
- case GST_MATROSKA_ID_VIDEOPIXELWIDTH:{
- guint64 num;
-
- if (!gst_ebml_read_uint (ebml, &id, &num)) {
- res = FALSE;
- break;
- }
- videocontext->pixel_width = num;
- break;
- }
-
- /* height of the video in the file */
- case GST_MATROSKA_ID_VIDEOPIXELHEIGHT:{
- guint64 num;
-
- if (!gst_ebml_read_uint (ebml, &id, &num)) {
- res = FALSE;
- break;
- }
- videocontext->pixel_height = num;
- break;
- }
-
- /* whether the video is interlaced */
- case GST_MATROSKA_ID_VIDEOFLAGINTERLACED:{
- guint64 num;
-
- if (!gst_ebml_read_uint (ebml, &id, &num)) {
- res = FALSE;
- break;
- }
- if (num)
- context->flags |= GST_MATROSKA_VIDEOTRACK_INTERLACED;
- else
- context->flags &= ~GST_MATROSKA_VIDEOTRACK_INTERLACED;
- break;
- }
-
- /* stereo mode (whether the video has two streams, where
- * one is for the left eye and the other for the right eye,
- * which creates a 3D-like effect) */
- case GST_MATROSKA_ID_VIDEOSTEREOMODE:{
- guint64 num;
-
- if (!gst_ebml_read_uint (ebml, &id, &num)) {
- res = FALSE;
- break;
- }
- if (num != GST_MATROSKA_EYE_MODE_MONO &&
- num != GST_MATROSKA_EYE_MODE_LEFT &&
- num != GST_MATROSKA_EYE_MODE_RIGHT &&
- num != GST_MATROSKA_EYE_MODE_BOTH) {
- GST_WARNING ("Unknown eye mode 0x%x - ignoring", (guint) num);
- break;
- }
- videocontext->eye_mode = num;
- break;
- }
-
- /* aspect ratio behaviour */
- case GST_MATROSKA_ID_VIDEOASPECTRATIO:{
- guint64 num;
-
- if (!gst_ebml_read_uint (ebml, &id, &num)) {
- res = FALSE;
- break;
- }
- if (num != GST_MATROSKA_ASPECT_RATIO_MODE_FREE &&
- num != GST_MATROSKA_ASPECT_RATIO_MODE_KEEP &&
- num != GST_MATROSKA_ASPECT_RATIO_MODE_FIXED) {
- GST_WARNING ("Unknown aspect ratio mode 0x%x - ignoring",
- (guint) num);
- break;
- }
- videocontext->asr_mode = num;
- break;
- }
-
- /* colourspace (only matters for raw video) fourcc */
- case GST_MATROSKA_ID_VIDEOCOLOURSPACE:{
- guint64 num;
-
- if (!gst_ebml_read_uint (ebml, &id, &num)) {
- res = FALSE;
- break;
- }
- videocontext->fourcc = num;
- break;
- }
-
- default:
- GST_WARNING ("Unknown video track header entry 0x%x - ignoring",
- id);
- /* pass-through */
-
- case GST_EBML_ID_VOID:
- if (!gst_ebml_read_skip (ebml))
- res = FALSE;
- break;
- }
-
- if (demux->level_up) {
- demux->level_up--;
- break;
- }
- }
- break;
+ GstMatroskaTrackVideoContext *videocontext;
+
+ if (context->type != GST_MATROSKA_TRACK_TYPE_VIDEO) {
+ GST_WARNING
+ ("trackvideo EBML entry in non-video track - ignoring track");
+ res = FALSE;
+ break;
+ } else if (!gst_ebml_read_master (ebml, &id)) {
+ res = FALSE;
+ break;
+ }
+ videocontext = (GstMatroskaTrackVideoContext *) context;
+
+ while (res) {
+ if (!(id = gst_ebml_peek_id (ebml, &demux->level_up))) {
+ res = FALSE;
+ break;
+ } else if (demux->level_up > 0) {
+ demux->level_up--;
+ break;
+ }
+
+ switch (id) {
+ /* fixme, this should be one-up, but I get it here (?) */
+ case GST_MATROSKA_ID_TRACKDEFAULTDURATION:{
+ guint64 num;
+
+ if (!gst_ebml_read_uint (ebml, &id, &num)) {
+ res = FALSE;
+ break;
+ }
+ context->default_duration = num;
+ break;
+ }
+
+ /* video framerate */
+ case GST_MATROSKA_ID_VIDEOFRAMERATE:{
+ gdouble num;
+
+ if (!gst_ebml_read_float (ebml, &id, &num)) {
+ res = FALSE;
+ break;
+ }
+ context->default_duration = GST_SECOND * (1. / num);
+ break;
+ }
+
+ /* width of the size to display the video at */
+ case GST_MATROSKA_ID_VIDEODISPLAYWIDTH:{
+ guint64 num;
+
+ if (!gst_ebml_read_uint (ebml, &id, &num)) {
+ res = FALSE;
+ break;
+ }
+ videocontext->display_width = num;
+ break;
+ }
+
+ /* height of the size to display the video at */
+ case GST_MATROSKA_ID_VIDEODISPLAYHEIGHT:{
+ guint64 num;
+
+ if (!gst_ebml_read_uint (ebml, &id, &num)) {
+ res = FALSE;
+ break;
+ }
+ videocontext->display_height = num;
+ break;
+ }
+
+ /* width of the video in the file */
+ case GST_MATROSKA_ID_VIDEOPIXELWIDTH:{
+ guint64 num;
+
+ if (!gst_ebml_read_uint (ebml, &id, &num)) {
+ res = FALSE;
+ break;
+ }
+ videocontext->pixel_width = num;
+ break;
+ }
+
+ /* height of the video in the file */
+ case GST_MATROSKA_ID_VIDEOPIXELHEIGHT:{
+ guint64 num;
+
+ if (!gst_ebml_read_uint (ebml, &id, &num)) {
+ res = FALSE;
+ break;
+ }
+ videocontext->pixel_height = num;
+ break;
+ }
+
+ /* whether the video is interlaced */
+ case GST_MATROSKA_ID_VIDEOFLAGINTERLACED:{
+ guint64 num;
+
+ if (!gst_ebml_read_uint (ebml, &id, &num)) {
+ res = FALSE;
+ break;
+ }
+ if (num)
+ context->flags |= GST_MATROSKA_VIDEOTRACK_INTERLACED;
+ else
+ context->flags &= ~GST_MATROSKA_VIDEOTRACK_INTERLACED;
+ break;
+ }
+
+ /* stereo mode (whether the video has two streams, where
+ * one is for the left eye and the other for the right eye,
+ * which creates a 3D-like effect) */
+ case GST_MATROSKA_ID_VIDEOSTEREOMODE:{
+ guint64 num;
+
+ if (!gst_ebml_read_uint (ebml, &id, &num)) {
+ res = FALSE;
+ break;
+ }
+ if (num != GST_MATROSKA_EYE_MODE_MONO &&
+ num != GST_MATROSKA_EYE_MODE_LEFT &&
+ num != GST_MATROSKA_EYE_MODE_RIGHT &&
+ num != GST_MATROSKA_EYE_MODE_BOTH) {
+ GST_WARNING ("Unknown eye mode 0x%x - ignoring", (guint) num);
+ break;
+ }
+ videocontext->eye_mode = num;
+ break;
+ }
+
+ /* aspect ratio behaviour */
+ case GST_MATROSKA_ID_VIDEOASPECTRATIO:{
+ guint64 num;
+
+ if (!gst_ebml_read_uint (ebml, &id, &num)) {
+ res = FALSE;
+ break;
+ }
+ if (num != GST_MATROSKA_ASPECT_RATIO_MODE_FREE &&
+ num != GST_MATROSKA_ASPECT_RATIO_MODE_KEEP &&
+ num != GST_MATROSKA_ASPECT_RATIO_MODE_FIXED) {
+ GST_WARNING ("Unknown aspect ratio mode 0x%x - ignoring",
+ (guint) num);
+ break;
+ }
+ videocontext->asr_mode = num;
+ break;
+ }
+
+ /* colourspace (only matters for raw video) fourcc */
+ case GST_MATROSKA_ID_VIDEOCOLOURSPACE:{
+ guint64 num;
+
+ if (!gst_ebml_read_uint (ebml, &id, &num)) {
+ res = FALSE;
+ break;
+ }
+ videocontext->fourcc = num;
+ break;
+ }
+
+ default:
+ GST_WARNING ("Unknown video track header entry 0x%x - ignoring",
+ id);
+ /* pass-through */
+
+ case GST_EBML_ID_VOID:
+ if (!gst_ebml_read_skip (ebml))
+ res = FALSE;
+ break;
+ }
+
+ if (demux->level_up) {
+ demux->level_up--;
+ break;
+ }
+ }
+ break;
}
- /* tracktype specific stuff for audio */
+ /* tracktype specific stuff for audio */
case GST_MATROSKA_ID_TRACKAUDIO:{
- GstMatroskaTrackAudioContext *audiocontext;
-
- if (context->type != GST_MATROSKA_TRACK_TYPE_AUDIO) {
- GST_WARNING
- ("trackaudio EBML entry in non-audio track - ignoring track");
- res = FALSE;
- break;
- } else if (!gst_ebml_read_master (ebml, &id)) {
- res = FALSE;
- break;
- }
- audiocontext = (GstMatroskaTrackAudioContext *) context;
-
- while (res) {
- if (!(id = gst_ebml_peek_id (ebml, &demux->level_up))) {
- res = FALSE;
- break;
- } else if (demux->level_up > 0) {
- demux->level_up--;
- break;
- }
-
- switch (id) {
- /* samplerate */
- case GST_MATROSKA_ID_AUDIOSAMPLINGFREQ:{
- gdouble num;
-
- if (!gst_ebml_read_float (ebml, &id, &num)) {
- res = FALSE;
- break;
- }
- audiocontext->samplerate = num;
- break;
- }
-
- /* bitdepth */
- case GST_MATROSKA_ID_AUDIOBITDEPTH:{
- guint64 num;
-
- if (!gst_ebml_read_uint (ebml, &id, &num)) {
- res = FALSE;
- break;
- }
- audiocontext->bitdepth = num;
- break;
- }
-
- /* channels */
- case GST_MATROSKA_ID_AUDIOCHANNELS:{
- guint64 num;
-
- if (!gst_ebml_read_uint (ebml, &id, &num)) {
- res = FALSE;
- break;
- }
- audiocontext->channels = num;
- break;
- }
-
- default:
- GST_WARNING ("Unknown audio track header entry 0x%x - ignoring",
- id);
- /* pass-through */
-
- case GST_EBML_ID_VOID:
- if (!gst_ebml_read_skip (ebml))
- res = FALSE;
- break;
- }
-
- if (demux->level_up) {
- demux->level_up--;
- break;
- }
- }
- break;
+ GstMatroskaTrackAudioContext *audiocontext;
+
+ if (context->type != GST_MATROSKA_TRACK_TYPE_AUDIO) {
+ GST_WARNING
+ ("trackaudio EBML entry in non-audio track - ignoring track");
+ res = FALSE;
+ break;
+ } else if (!gst_ebml_read_master (ebml, &id)) {
+ res = FALSE;
+ break;
+ }
+ audiocontext = (GstMatroskaTrackAudioContext *) context;
+
+ while (res) {
+ if (!(id = gst_ebml_peek_id (ebml, &demux->level_up))) {
+ res = FALSE;
+ break;
+ } else if (demux->level_up > 0) {
+ demux->level_up--;
+ break;
+ }
+
+ switch (id) {
+ /* samplerate */
+ case GST_MATROSKA_ID_AUDIOSAMPLINGFREQ:{
+ gdouble num;
+
+ if (!gst_ebml_read_float (ebml, &id, &num)) {
+ res = FALSE;
+ break;
+ }
+ audiocontext->samplerate = num;
+ break;
+ }
+
+ /* bitdepth */
+ case GST_MATROSKA_ID_AUDIOBITDEPTH:{
+ guint64 num;
+
+ if (!gst_ebml_read_uint (ebml, &id, &num)) {
+ res = FALSE;
+ break;
+ }
+ audiocontext->bitdepth = num;
+ break;
+ }
+
+ /* channels */
+ case GST_MATROSKA_ID_AUDIOCHANNELS:{
+ guint64 num;
+
+ if (!gst_ebml_read_uint (ebml, &id, &num)) {
+ res = FALSE;
+ break;
+ }
+ audiocontext->channels = num;
+ break;
+ }
+
+ default:
+ GST_WARNING ("Unknown audio track header entry 0x%x - ignoring",
+ id);
+ /* pass-through */
+
+ case GST_EBML_ID_VOID:
+ if (!gst_ebml_read_skip (ebml))
+ res = FALSE;
+ break;
+ }
+
+ if (demux->level_up) {
+ demux->level_up--;
+ break;
+ }
+ }
+ break;
}
- /* codec identifier */
+ /* codec identifier */
case GST_MATROSKA_ID_CODECID:{
- gchar *text;
-
- if (!gst_ebml_read_ascii (ebml, &id, &text)) {
- res = FALSE;
- break;
- }
- context->codec_id = text;
- break;
+ gchar *text;
+
+ if (!gst_ebml_read_ascii (ebml, &id, &text)) {
+ res = FALSE;
+ break;
+ }
+ context->codec_id = text;
+ break;
}
- /* codec private data */
+ /* codec private data */
case GST_MATROSKA_ID_CODECPRIVATE:{
- guint8 *data;
- guint64 size;
-
- if (!gst_ebml_read_binary (ebml, &id, &data, &size)) {
- res = FALSE;
- break;
- }
- context->codec_priv = data;
- context->codec_priv_size = size;
- break;
+ guint8 *data;
+ guint64 size;
+
+ if (!gst_ebml_read_binary (ebml, &id, &data, &size)) {
+ res = FALSE;
+ break;
+ }
+ context->codec_priv = data;
+ context->codec_priv_size = size;
+ break;
}
- /* name of the codec */
+ /* name of the codec */
case GST_MATROSKA_ID_CODECNAME:{
- gchar *text;
-
- if (!gst_ebml_read_utf8 (ebml, &id, &text)) {
- res = FALSE;
- break;
- }
- context->codec_name = text;
- break;
+ gchar *text;
+
+ if (!gst_ebml_read_utf8 (ebml, &id, &text)) {
+ res = FALSE;
+ break;
+ }
+ context->codec_name = text;
+ break;
}
- /* name of this track */
+ /* name of this track */
case GST_MATROSKA_ID_TRACKNAME:{
- gchar *text;
-
- if (!gst_ebml_read_utf8 (ebml, &id, &text)) {
- res = FALSE;
- break;
- }
- context->name = text;
- break;
+ gchar *text;
+
+ if (!gst_ebml_read_utf8 (ebml, &id, &text)) {
+ res = FALSE;
+ break;
+ }
+ context->name = text;
+ break;
}
- /* language (matters for audio/subtitles, mostly) */
+ /* language (matters for audio/subtitles, mostly) */
case GST_MATROSKA_ID_TRACKLANGUAGE:{
- gchar *text;
-
- if (!gst_ebml_read_utf8 (ebml, &id, &text)) {
- res = FALSE;
- break;
- }
- context->language = text;
- break;
+ gchar *text;
+
+ if (!gst_ebml_read_utf8 (ebml, &id, &text)) {
+ res = FALSE;
+ break;
+ }
+ context->language = text;
+ break;
}
- /* whether this is actually used */
+ /* whether this is actually used */
case GST_MATROSKA_ID_TRACKFLAGENABLED:{
- guint64 num;
-
- if (!gst_ebml_read_uint (ebml, &id, &num)) {
- res = FALSE;
- break;
- }
- if (num)
- context->flags |= GST_MATROSKA_TRACK_ENABLED;
- else
- context->flags &= ~GST_MATROSKA_TRACK_ENABLED;
- break;
+ guint64 num;
+
+ if (!gst_ebml_read_uint (ebml, &id, &num)) {
+ res = FALSE;
+ break;
+ }
+ if (num)
+ context->flags |= GST_MATROSKA_TRACK_ENABLED;
+ else
+ context->flags &= ~GST_MATROSKA_TRACK_ENABLED;
+ break;
}
- /* whether it's the default for this track type */
+ /* whether it's the default for this track type */
case GST_MATROSKA_ID_TRACKFLAGDEFAULT:{
- guint64 num;
-
- if (!gst_ebml_read_uint (ebml, &id, &num)) {
- res = FALSE;
- break;
- }
- if (num)
- context->flags |= GST_MATROSKA_TRACK_DEFAULT;
- else
- context->flags &= ~GST_MATROSKA_TRACK_DEFAULT;
- break;
+ guint64 num;
+
+ if (!gst_ebml_read_uint (ebml, &id, &num)) {
+ res = FALSE;
+ break;
+ }
+ if (num)
+ context->flags |= GST_MATROSKA_TRACK_DEFAULT;
+ else
+ context->flags &= ~GST_MATROSKA_TRACK_DEFAULT;
+ break;
}
- /* lacing (like MPEG, where blocks don't end/start on frame
- * boundaries) */
+ /* lacing (like MPEG, where blocks don't end/start on frame
+ * boundaries) */
case GST_MATROSKA_ID_TRACKFLAGLACING:{
- guint64 num;
-
- if (!gst_ebml_read_uint (ebml, &id, &num)) {
- res = FALSE;
- break;
- }
- if (num)
- context->flags |= GST_MATROSKA_TRACK_LACING;
- else
- context->flags &= ~GST_MATROSKA_TRACK_LACING;
- break;
+ guint64 num;
+
+ if (!gst_ebml_read_uint (ebml, &id, &num)) {
+ res = FALSE;
+ break;
+ }
+ if (num)
+ context->flags |= GST_MATROSKA_TRACK_LACING;
+ else
+ context->flags &= ~GST_MATROSKA_TRACK_LACING;
+ break;
}
- /* default length (in time) of one data block in this track */
+ /* default length (in time) of one data block in this track */
case GST_MATROSKA_ID_TRACKDEFAULTDURATION:{
- guint64 num;
-
- if (!gst_ebml_read_uint (ebml, &id, &num)) {
- res = FALSE;
- break;
- }
- context->default_duration = num;
- break;
+ guint64 num;
+
+ if (!gst_ebml_read_uint (ebml, &id, &num)) {
+ res = FALSE;
+ break;
+ }
+ context->default_duration = num;
+ break;
}
default:
- GST_WARNING ("Unknown track header entry 0x%x - ignoring", id);
- /* pass-through */
+ GST_WARNING ("Unknown track header entry 0x%x - ignoring", id);
+ /* pass-through */
- /* we ignore these because they're nothing useful (i.e. crap). */
+ /* we ignore these because they're nothing useful (i.e. crap). */
case GST_MATROSKA_ID_CODECINFOURL:
case GST_MATROSKA_ID_CODECDOWNLOADURL:
case GST_MATROSKA_ID_TRACKMINCACHE:
case GST_MATROSKA_ID_TRACKMAXCACHE:
case GST_EBML_ID_VOID:
- if (!gst_ebml_read_skip (ebml))
- res = FALSE;
- break;
+ if (!gst_ebml_read_skip (ebml))
+ res = FALSE;
+ break;
}
if (demux->level_up) {
switch (context->type) {
case GST_MATROSKA_TRACK_TYPE_VIDEO:{
GstMatroskaTrackVideoContext *videocontext =
- (GstMatroskaTrackVideoContext *) context;
+ (GstMatroskaTrackVideoContext *) context;
padname = g_strdup_printf ("video_%02d", demux->num_v_streams++);
templ = gst_element_class_get_pad_template (klass, "video_%02d");
caps = gst_matroska_demux_video_caps (videocontext,
- context->codec_id,
- context->codec_priv, context->codec_priv_size, demux);
+ context->codec_id,
+ context->codec_priv, context->codec_priv_size, demux);
break;
}
case GST_MATROSKA_TRACK_TYPE_AUDIO:{
GstMatroskaTrackAudioContext *audiocontext =
- (GstMatroskaTrackAudioContext *) context;
+ (GstMatroskaTrackAudioContext *) context;
padname = g_strdup_printf ("audio_%02d", demux->num_a_streams++);
templ = gst_element_class_get_pad_template (klass, "audio_%02d");
caps = gst_matroska_demux_audio_caps (audiocontext,
- context->codec_id,
- context->codec_priv, context->codec_priv_size, demux);
+ context->codec_id,
+ context->codec_priv, context->codec_priv_size, demux);
break;
}
case GST_MATROSKA_TRACK_TYPE_COMPLEX:{
GstMatroskaTrackComplexContext *complexcontext =
- (GstMatroskaTrackComplexContext *) context;
+ (GstMatroskaTrackComplexContext *) context;
padname = g_strdup_printf ("video_%02d", demux->num_v_streams++);
templ = gst_element_class_get_pad_template (klass, "video_%02d");
caps = gst_matroska_demux_complex_caps (complexcontext,
- context->codec_id, context->codec_priv, context->codec_priv_size);
+ context->codec_id, context->codec_priv, context->codec_priv_size);
break;
}
case GST_MATROSKA_TRACK_TYPE_SUBTITLE:{
GstMatroskaTrackSubtitleContext *subtitlecontext =
- (GstMatroskaTrackSubtitleContext *) context;
+ (GstMatroskaTrackSubtitleContext *) context;
padname = g_strdup_printf ("subtitle_%02d", demux->num_t_streams++);
templ = gst_element_class_get_pad_template (klass, "subtitle_%02d");
caps = gst_matroska_demux_subtitle_caps (subtitlecontext,
- context->codec_id, context->codec_priv, context->codec_priv_size);
+ context->codec_id, context->codec_priv, context->codec_priv_size);
break;
}
switch (type) {
case GST_QUERY_TOTAL:
switch (*format) {
- case GST_FORMAT_DEFAULT:
- *format = GST_FORMAT_TIME;
- /* fall through */
- case GST_FORMAT_TIME:
- *value = demux->duration;
- break;
- default:
- res = FALSE;
- break;
+ case GST_FORMAT_DEFAULT:
+ *format = GST_FORMAT_TIME;
+ /* fall through */
+ case GST_FORMAT_TIME:
+ *value = demux->duration;
+ break;
+ default:
+ res = FALSE;
+ break;
}
break;
case GST_QUERY_POSITION:
switch (*format) {
- case GST_FORMAT_DEFAULT:
- *format = GST_FORMAT_TIME;
- /* fall through */
- case GST_FORMAT_TIME:
- *value = demux->pos;
- break;
- default:
- res = FALSE;
- break;
+ case GST_FORMAT_DEFAULT:
+ *format = GST_FORMAT_TIME;
+ /* fall through */
+ case GST_FORMAT_TIME:
+ *value = demux->pos;
+ break;
+ default:
+ res = FALSE;
+ break;
}
break;
entry = n;
} else {
gfloat diff_old = fabs (1. * (demux->index[entry].time - offset)),
- diff_new = fabs (1. * (demux->index[n].time - offset));
+ diff_new = fabs (1. * (demux->index[n].time - offset));
if (diff_new < diff_old) {
- entry = n;
+ entry = n;
}
}
}
switch (GST_EVENT_TYPE (event)) {
case GST_EVENT_SEEK:
switch (GST_EVENT_SEEK_FORMAT (event)) {
- case GST_FORMAT_TIME:
- demux->seek_pending = GST_EVENT_SEEK_OFFSET (event);
- break;
-
- default:
- GST_WARNING ("Only time seek is supported");
- res = FALSE;
- break;
+ case GST_FORMAT_TIME:
+ demux->seek_pending = GST_EVENT_SEEK_OFFSET (event);
+ break;
+
+ default:
+ GST_WARNING ("Only time seek is supported");
+ res = FALSE;
+ break;
}
break;
{
static const GstEventMask masks[] = {
{GST_EVENT_SEEK, (GstEventFlag) ((gint) GST_SEEK_METHOD_SET |
- (gint) GST_SEEK_FLAG_KEY_UNIT)},
+ (gint) GST_SEEK_FLAG_KEY_UNIT)},
{GST_EVENT_SEEK_SEGMENT, (GstEventFlag) ((gint) GST_SEEK_METHOD_SET |
- (gint) GST_SEEK_FLAG_KEY_UNIT)},
+ (gint) GST_SEEK_FLAG_KEY_UNIT)},
{(GstEventType) 0, (GstEventFlag) 0}
};
/* seek (relative to segment) */
if (!(event = gst_ebml_read_seek (ebml, entry->pos + demux->segment_start)))
return FALSE;
- gst_event_unref (event); /* byte - we want time */
+ gst_event_unref (event); /* byte - we want time */
event = gst_event_new_discontinuous (FALSE, GST_FORMAT_TIME, entry->time);
/* forward to all src pads */
if (!doctype || strcmp (doctype, "matroska") != 0) {
GST_ELEMENT_ERROR (demux, STREAM, WRONG_TYPE, (NULL),
- ("Input is not a matroska stream (doctype=%s)",
- doctype ? doctype : "none"));
+ ("Input is not a matroska stream (doctype=%s)",
+ doctype ? doctype : "none"));
g_free (doctype);
return FALSE;
}
g_free (doctype);
if (version > 1) {
GST_ELEMENT_ERROR (demux, STREAM, DEMUX, (NULL),
- ("Demuxer version (1) is too old to read stream version %d", version));
+ ("Demuxer version (1) is too old to read stream version %d", version));
return FALSE;
}
/* oi! */
GST_WARNING ("Expected a Segment ID (0x%x), but received 0x%x!",
- GST_MATROSKA_ID_SEGMENT, id);
+ GST_MATROSKA_ID_SEGMENT, id);
if (!gst_ebml_read_skip (ebml))
return FALSE;
}
}
switch (id) {
- /* one track within the "all-tracks" header */
+ /* one track within the "all-tracks" header */
case GST_MATROSKA_ID_TRACKENTRY:
- if (!gst_matroska_demux_add_stream (demux))
- res = FALSE;
- break;
+ if (!gst_matroska_demux_add_stream (demux))
+ res = FALSE;
+ break;
default:
- GST_WARNING ("Unknown entry 0x%x in track header", id);
- /* fall-through */
+ GST_WARNING ("Unknown entry 0x%x in track header", id);
+ /* fall-through */
case GST_EBML_ID_VOID:
- if (!gst_ebml_read_skip (ebml))
- res = FALSE;
- break;
+ if (!gst_ebml_read_skip (ebml))
+ res = FALSE;
+ break;
}
if (demux->level_up) {
}
switch (id) {
- /* one single index entry ('point') */
+ /* one single index entry ('point') */
case GST_MATROSKA_ID_POINTENTRY:
- if (!gst_ebml_read_master (ebml, &id)) {
- res = FALSE;
- break;
- }
-
- /* in the end, we hope to fill one entry with a
- * timestamp, a file position and a tracknum */
- idx.pos = (guint64) - 1;
- idx.time = (guint64) - 1;
- idx.track = (guint16) - 1;
-
- while (res) {
- if (prevent_eos && length == gst_bytestream_tell (ebml->bs)) {
- res = FALSE;
- break;
- } else if (!(id = gst_ebml_peek_id (ebml, &demux->level_up))) {
- res = FALSE;
- break;
- } else if (demux->level_up) {
- demux->level_up--;
- break;
- }
-
- switch (id) {
- /* one single index entry ('point') */
- case GST_MATROSKA_ID_CUETIME:{
- gint64 time;
-
- if (!gst_ebml_read_uint (ebml, &id, &time)) {
- res = FALSE;
- break;
- }
- idx.time = time * demux->time_scale;
- break;
- }
-
- /* position in the file + track to which it belongs */
- case GST_MATROSKA_ID_CUETRACKPOSITION:
- if (!gst_ebml_read_master (ebml, &id)) {
- res = FALSE;
- break;
- }
-
- while (res) {
- if (prevent_eos && length == gst_bytestream_tell (ebml->bs)) {
- res = FALSE;
- break;
- } else if (!(id = gst_ebml_peek_id (ebml, &demux->level_up))) {
- res = FALSE;
- break;
- } else if (demux->level_up) {
- demux->level_up--;
- break;
- }
-
- switch (id) {
- /* track number */
- case GST_MATROSKA_ID_CUETRACK:{
- guint64 num;
-
- if (!gst_ebml_read_uint (ebml, &id, &num)) {
- res = FALSE;
- break;
- }
- idx.track = num;
- break;
- }
-
- /* position in file */
- case GST_MATROSKA_ID_CUECLUSTERPOSITION:{
- guint64 num;
-
- if (!gst_ebml_read_uint (ebml, &id, &num)) {
- res = FALSE;
- break;
- }
- idx.pos = num;
- break;
- }
-
- default:
- GST_WARNING ("Unknown entry 0x%x in CuesTrackPositions",
- id);
- /* fall-through */
-
- case GST_EBML_ID_VOID:
- if (!gst_ebml_read_skip (ebml))
- res = FALSE;
- break;
- }
-
- if (demux->level_up) {
- demux->level_up--;
- break;
- }
- }
-
- break;
-
- default:
- GST_WARNING ("Unknown entry 0x%x in cuespoint index", id);
- /* fall-through */
-
- case GST_EBML_ID_VOID:
- if (!gst_ebml_read_skip (ebml))
- res = FALSE;
- break;
- }
-
- if (demux->level_up) {
- demux->level_up--;
- break;
- }
- }
-
- /* so let's see if we got what we wanted */
- if (idx.pos != (guint64) - 1 &&
- idx.time != (guint64) - 1 && idx.track != (guint16) - 1) {
- if (demux->num_indexes % 32 == 0) {
- /* re-allocate bigger index */
- demux->index = g_renew (GstMatroskaIndex, demux->index,
- demux->num_indexes + 32);
- }
- demux->index[demux->num_indexes].pos = idx.pos;
- demux->index[demux->num_indexes].time = idx.time;
- demux->index[demux->num_indexes].track = idx.track;
- demux->num_indexes++;
- }
-
- break;
+ if (!gst_ebml_read_master (ebml, &id)) {
+ res = FALSE;
+ break;
+ }
+
+ /* in the end, we hope to fill one entry with a
+ * timestamp, a file position and a tracknum */
+ idx.pos = (guint64) - 1;
+ idx.time = (guint64) - 1;
+ idx.track = (guint16) - 1;
+
+ while (res) {
+ if (prevent_eos && length == gst_bytestream_tell (ebml->bs)) {
+ res = FALSE;
+ break;
+ } else if (!(id = gst_ebml_peek_id (ebml, &demux->level_up))) {
+ res = FALSE;
+ break;
+ } else if (demux->level_up) {
+ demux->level_up--;
+ break;
+ }
+
+ switch (id) {
+ /* one single index entry ('point') */
+ case GST_MATROSKA_ID_CUETIME:{
+ gint64 time;
+
+ if (!gst_ebml_read_uint (ebml, &id, &time)) {
+ res = FALSE;
+ break;
+ }
+ idx.time = time * demux->time_scale;
+ break;
+ }
+
+ /* position in the file + track to which it belongs */
+ case GST_MATROSKA_ID_CUETRACKPOSITION:
+ if (!gst_ebml_read_master (ebml, &id)) {
+ res = FALSE;
+ break;
+ }
+
+ while (res) {
+ if (prevent_eos && length == gst_bytestream_tell (ebml->bs)) {
+ res = FALSE;
+ break;
+ } else if (!(id = gst_ebml_peek_id (ebml, &demux->level_up))) {
+ res = FALSE;
+ break;
+ } else if (demux->level_up) {
+ demux->level_up--;
+ break;
+ }
+
+ switch (id) {
+ /* track number */
+ case GST_MATROSKA_ID_CUETRACK:{
+ guint64 num;
+
+ if (!gst_ebml_read_uint (ebml, &id, &num)) {
+ res = FALSE;
+ break;
+ }
+ idx.track = num;
+ break;
+ }
+
+ /* position in file */
+ case GST_MATROSKA_ID_CUECLUSTERPOSITION:{
+ guint64 num;
+
+ if (!gst_ebml_read_uint (ebml, &id, &num)) {
+ res = FALSE;
+ break;
+ }
+ idx.pos = num;
+ break;
+ }
+
+ default:
+ GST_WARNING ("Unknown entry 0x%x in CuesTrackPositions",
+ id);
+ /* fall-through */
+
+ case GST_EBML_ID_VOID:
+ if (!gst_ebml_read_skip (ebml))
+ res = FALSE;
+ break;
+ }
+
+ if (demux->level_up) {
+ demux->level_up--;
+ break;
+ }
+ }
+
+ break;
+
+ default:
+ GST_WARNING ("Unknown entry 0x%x in cuespoint index", id);
+ /* fall-through */
+
+ case GST_EBML_ID_VOID:
+ if (!gst_ebml_read_skip (ebml))
+ res = FALSE;
+ break;
+ }
+
+ if (demux->level_up) {
+ demux->level_up--;
+ break;
+ }
+ }
+
+ /* so let's see if we got what we wanted */
+ if (idx.pos != (guint64) - 1 &&
+ idx.time != (guint64) - 1 && idx.track != (guint16) - 1) {
+ if (demux->num_indexes % 32 == 0) {
+ /* re-allocate bigger index */
+ demux->index = g_renew (GstMatroskaIndex, demux->index,
+ demux->num_indexes + 32);
+ }
+ demux->index[demux->num_indexes].pos = idx.pos;
+ demux->index[demux->num_indexes].time = idx.time;
+ demux->index[demux->num_indexes].track = idx.track;
+ demux->num_indexes++;
+ }
+
+ break;
default:
- GST_WARNING ("Unknown entry 0x%x in cues header", id);
- /* fall-through */
+ GST_WARNING ("Unknown entry 0x%x in cues header", id);
+ /* fall-through */
case GST_EBML_ID_VOID:
- if (!gst_ebml_read_skip (ebml))
- res = FALSE;
- break;
+ if (!gst_ebml_read_skip (ebml))
+ res = FALSE;
+ break;
}
if (demux->level_up) {
}
switch (id) {
- /* cluster timecode */
+ /* cluster timecode */
case GST_MATROSKA_ID_TIMECODESCALE:{
- guint64 num;
-
- if (!gst_ebml_read_uint (ebml, &id, &num)) {
- res = FALSE;
- break;
- }
- demux->time_scale = num;
- break;
+ guint64 num;
+
+ if (!gst_ebml_read_uint (ebml, &id, &num)) {
+ res = FALSE;
+ break;
+ }
+ demux->time_scale = num;
+ break;
}
case GST_MATROSKA_ID_DURATION:{
- gdouble num;
-
- if (!gst_ebml_read_float (ebml, &id, &num)) {
- res = FALSE;
- break;
- }
- demux->duration = num * demux->time_scale;
- break;
+ gdouble num;
+
+ if (!gst_ebml_read_float (ebml, &id, &num)) {
+ res = FALSE;
+ break;
+ }
+ demux->duration = num * demux->time_scale;
+ break;
}
case GST_MATROSKA_ID_WRITINGAPP:{
- gchar *text;
-
- if (!gst_ebml_read_utf8 (ebml, &id, &text)) {
- res = FALSE;
- break;
- }
- demux->writing_app = text;
- break;
+ gchar *text;
+
+ if (!gst_ebml_read_utf8 (ebml, &id, &text)) {
+ res = FALSE;
+ break;
+ }
+ demux->writing_app = text;
+ break;
}
case GST_MATROSKA_ID_MUXINGAPP:{
- gchar *text;
-
- if (!gst_ebml_read_utf8 (ebml, &id, &text)) {
- res = FALSE;
- break;
- }
- demux->muxing_app = text;
- break;
+ gchar *text;
+
+ if (!gst_ebml_read_utf8 (ebml, &id, &text)) {
+ res = FALSE;
+ break;
+ }
+ demux->muxing_app = text;
+ break;
}
case GST_MATROSKA_ID_DATEUTC:{
- gint64 time;
-
- if (!gst_ebml_read_date (ebml, &id, &time)) {
- res = FALSE;
- break;
- }
- demux->created = time;
- break;
+ gint64 time;
+
+ if (!gst_ebml_read_date (ebml, &id, &time)) {
+ res = FALSE;
+ break;
+ }
+ demux->created = time;
+ break;
}
default:
- GST_WARNING ("Unknown entry 0x%x in info header", id);
- /* fall-through */
+ GST_WARNING ("Unknown entry 0x%x in info header", id);
+ /* fall-through */
case GST_EBML_ID_VOID:
- if (!gst_ebml_read_skip (ebml))
- res = FALSE;
- break;
+ if (!gst_ebml_read_skip (ebml))
+ res = FALSE;
+ break;
}
if (demux->level_up) {
switch (id) {
default:
- GST_WARNING ("metadata unimplemented");
- /* fall-through */
+ GST_WARNING ("metadata unimplemented");
+ /* fall-through */
case GST_EBML_ID_VOID:
- if (!gst_ebml_read_skip (ebml))
- res = FALSE;
- break;
+ if (!gst_ebml_read_skip (ebml))
+ res = FALSE;
+ break;
}
if (demux->level_up) {
}
switch (id) {
- /* one block inside the group. Note, block parsing is one
- * of the harder things, so this code is a bit complicated.
- * See http://www.matroska.org/ for documentation. */
+ /* one block inside the group. Note, block parsing is one
+ * of the harder things, so this code is a bit complicated.
+ * See http://www.matroska.org/ for documentation. */
case GST_MATROSKA_ID_BLOCK:{
- GstBuffer *buf;
- guint8 *data;
- gint64 time;
- guint size, *lace_size = NULL;
- gint n, stream, flags, laces = 0;
- guint64 num;
-
- if (!gst_ebml_read_buffer (ebml, &id, &buf)) {
- res = FALSE;
- break;
- }
- data = GST_BUFFER_DATA (buf);
- size = GST_BUFFER_SIZE (buf);
-
- /* first byte(s): blocknum */
- if ((n = gst_matroska_ebmlnum_uint (data, size, &num)) < 0) {
- GST_ELEMENT_ERROR (demux, STREAM, DEMUX, (NULL), ("Data error"));
- gst_buffer_unref (buf);
- res = FALSE;
- break;
- }
- data += n;
- size -= n;
-
- /* fetch stream from num */
- stream = gst_matroska_demux_stream_from_num (demux, num);
- if (size <= 3 || stream < 0 || stream >= demux->num_streams) {
- gst_buffer_unref (buf);
- GST_WARNING ("Invalid stream %d or size %u", stream, size);
- break;
- }
- if (!GST_PAD_IS_USABLE (demux->src[stream]->pad)) {
- gst_buffer_unref (buf);
- break;
- }
-
- /* time (relative to cluster time) */
- time = (GINT16_FROM_BE (*(gint16 *) data)) * demux->time_scale;
- data += 2;
- size -= 2;
- flags = *(guint8 *) data;
- data += 1;
- size -= 1;
- switch ((flags & 0x06) >> 1) {
- case 0x0: /* no lacing */
- laces = 1;
- lace_size = g_new (gint, 1);
- lace_size[0] = size;
- break;
-
- case 0x1: /* xiph lacing */
- case 0x2: /* fixed-size lacing */
- case 0x3: /* EBML lacing */
- if (size == 0) {
- res = FALSE;
- break;
- }
- laces = (*(guint8 *) data) + 1;
- data += 1;
- size -= 1;
- lace_size = g_new0 (gint, laces);
-
- switch ((flags & 0x06) >> 1) {
- case 0x1: /* xiph lacing */ {
- guint temp, total = 0;
-
- for (n = 0; res && n < laces - 1; n++) {
- while (1) {
- if (size == 0) {
- res = FALSE;
- break;
- }
- temp = *(guint8 *) data;
- lace_size[n] += temp;
- data += 1;
- size -= 1;
- if (temp != 0xff)
- break;
- }
- total += lace_size[n];
- }
- lace_size[n] = size - total;
- break;
- }
-
- case 0x2: /* fixed-size lacing */
- for (n = 0; n < laces; n++)
- lace_size[n] = size / laces;
- break;
-
- case 0x3: /* EBML lacing */ {
- guint total;
-
- if ((n = gst_matroska_ebmlnum_uint (data, size, &num)) < 0) {
- GST_ELEMENT_ERROR (demux, STREAM, DEMUX, (NULL),
- ("Data error"));
- res = FALSE;
- break;
- }
- data += n;
- size -= n;
- total = lace_size[0] = num;
- for (n = 1; res && n < laces - 1; n++) {
- gint64 snum;
- gint r;
-
- if ((r = gst_matroska_ebmlnum_sint (data, size, &snum)) < 0) {
- GST_ELEMENT_ERROR (demux, STREAM, DEMUX, (NULL),
- ("Data error"));
- res = FALSE;
- break;
- }
- data += r;
- size -= r;
- lace_size[n] = lace_size[n - 1] + snum;
- total += lace_size[n];
- }
- lace_size[n] = size - total;
- break;
- }
- }
- break;
- }
-
- if (res) {
- for (n = 0; n < laces; n++) {
- GstBuffer *sub = gst_buffer_create_sub (buf,
- GST_BUFFER_SIZE (buf) - size,
- lace_size[n]);
-
- if (cluster_time != GST_CLOCK_TIME_NONE) {
- if (time < 0 && (-time) > cluster_time)
- GST_BUFFER_TIMESTAMP (sub) = cluster_time;
- else
- GST_BUFFER_TIMESTAMP (sub) = cluster_time + time;
- }
- /* FIXME: duration */
-
- gst_pad_push (demux->src[stream]->pad, GST_DATA (sub));
-
- size -= lace_size[n];
- }
- }
-
- g_free (lace_size);
- gst_buffer_unref (buf);
- break;
+ GstBuffer *buf;
+ guint8 *data;
+ gint64 time;
+ guint size, *lace_size = NULL;
+ gint n, stream, flags, laces = 0;
+ guint64 num;
+
+ if (!gst_ebml_read_buffer (ebml, &id, &buf)) {
+ res = FALSE;
+ break;
+ }
+ data = GST_BUFFER_DATA (buf);
+ size = GST_BUFFER_SIZE (buf);
+
+ /* first byte(s): blocknum */
+ if ((n = gst_matroska_ebmlnum_uint (data, size, &num)) < 0) {
+ GST_ELEMENT_ERROR (demux, STREAM, DEMUX, (NULL), ("Data error"));
+ gst_buffer_unref (buf);
+ res = FALSE;
+ break;
+ }
+ data += n;
+ size -= n;
+
+ /* fetch stream from num */
+ stream = gst_matroska_demux_stream_from_num (demux, num);
+ if (size <= 3 || stream < 0 || stream >= demux->num_streams) {
+ gst_buffer_unref (buf);
+ GST_WARNING ("Invalid stream %d or size %u", stream, size);
+ break;
+ }
+ if (!GST_PAD_IS_USABLE (demux->src[stream]->pad)) {
+ gst_buffer_unref (buf);
+ break;
+ }
+
+ /* time (relative to cluster time) */
+ time = (GINT16_FROM_BE (*(gint16 *) data)) * demux->time_scale;
+ data += 2;
+ size -= 2;
+ flags = *(guint8 *) data;
+ data += 1;
+ size -= 1;
+ switch ((flags & 0x06) >> 1) {
+ case 0x0: /* no lacing */
+ laces = 1;
+ lace_size = g_new (gint, 1);
+ lace_size[0] = size;
+ break;
+
+ case 0x1: /* xiph lacing */
+ case 0x2: /* fixed-size lacing */
+ case 0x3: /* EBML lacing */
+ if (size == 0) {
+ res = FALSE;
+ break;
+ }
+ laces = (*(guint8 *) data) + 1;
+ data += 1;
+ size -= 1;
+ lace_size = g_new0 (gint, laces);
+
+ switch ((flags & 0x06) >> 1) {
+ case 0x1: /* xiph lacing */ {
+ guint temp, total = 0;
+
+ for (n = 0; res && n < laces - 1; n++) {
+ while (1) {
+ if (size == 0) {
+ res = FALSE;
+ break;
+ }
+ temp = *(guint8 *) data;
+ lace_size[n] += temp;
+ data += 1;
+ size -= 1;
+ if (temp != 0xff)
+ break;
+ }
+ total += lace_size[n];
+ }
+ lace_size[n] = size - total;
+ break;
+ }
+
+ case 0x2: /* fixed-size lacing */
+ for (n = 0; n < laces; n++)
+ lace_size[n] = size / laces;
+ break;
+
+ case 0x3: /* EBML lacing */ {
+ guint total;
+
+ if ((n = gst_matroska_ebmlnum_uint (data, size, &num)) < 0) {
+ GST_ELEMENT_ERROR (demux, STREAM, DEMUX, (NULL),
+ ("Data error"));
+ res = FALSE;
+ break;
+ }
+ data += n;
+ size -= n;
+ total = lace_size[0] = num;
+ for (n = 1; res && n < laces - 1; n++) {
+ gint64 snum;
+ gint r;
+
+ if ((r = gst_matroska_ebmlnum_sint (data, size, &snum)) < 0) {
+ GST_ELEMENT_ERROR (demux, STREAM, DEMUX, (NULL),
+ ("Data error"));
+ res = FALSE;
+ break;
+ }
+ data += r;
+ size -= r;
+ lace_size[n] = lace_size[n - 1] + snum;
+ total += lace_size[n];
+ }
+ lace_size[n] = size - total;
+ break;
+ }
+ }
+ break;
+ }
+
+ if (res) {
+ for (n = 0; n < laces; n++) {
+ GstBuffer *sub = gst_buffer_create_sub (buf,
+ GST_BUFFER_SIZE (buf) - size,
+ lace_size[n]);
+
+ if (cluster_time != GST_CLOCK_TIME_NONE) {
+ if (time < 0 && (-time) > cluster_time)
+ GST_BUFFER_TIMESTAMP (sub) = cluster_time;
+ else
+ GST_BUFFER_TIMESTAMP (sub) = cluster_time + time;
+ }
+ /* FIXME: duration */
+
+ gst_pad_push (demux->src[stream]->pad, GST_DATA (sub));
+
+ size -= lace_size[n];
+ }
+ }
+
+ g_free (lace_size);
+ gst_buffer_unref (buf);
+ break;
}
case GST_MATROSKA_ID_BLOCKDURATION:{
- guint64 num;
-
- if (!gst_ebml_read_uint (ebml, &id, &num)) {
- res = FALSE;
- break;
- }
- GST_WARNING ("FIXME: implement support for BlockDuration");
- break;
+ guint64 num;
+
+ if (!gst_ebml_read_uint (ebml, &id, &num)) {
+ res = FALSE;
+ break;
+ }
+ GST_WARNING ("FIXME: implement support for BlockDuration");
+ break;
}
default:
- GST_WARNING ("Unknown entry 0x%x in blockgroup data", id);
- /* fall-through */
+ GST_WARNING ("Unknown entry 0x%x in blockgroup data", id);
+ /* fall-through */
case GST_EBML_ID_VOID:
- if (!gst_ebml_read_skip (ebml))
- res = FALSE;
- break;
+ if (!gst_ebml_read_skip (ebml))
+ res = FALSE;
+ break;
}
if (demux->level_up) {
}
switch (id) {
- /* cluster timecode */
+ /* cluster timecode */
case GST_MATROSKA_ID_CLUSTERTIMECODE:{
- guint64 num;
-
- if (!gst_ebml_read_uint (ebml, &id, &num)) {
- res = FALSE;
- break;
- }
- cluster_time = num * demux->time_scale;
- break;
+ guint64 num;
+
+ if (!gst_ebml_read_uint (ebml, &id, &num)) {
+ res = FALSE;
+ break;
+ }
+ cluster_time = num * demux->time_scale;
+ break;
}
- /* a group of blocks inside a cluster */
+ /* a group of blocks inside a cluster */
case GST_MATROSKA_ID_BLOCKGROUP:
- if (!gst_ebml_read_master (ebml, &id)) {
- res = FALSE;
- break;
- }
- res = gst_matroska_demux_parse_blockgroup (demux, cluster_time);
- break;
+ if (!gst_ebml_read_master (ebml, &id)) {
+ res = FALSE;
+ break;
+ }
+ res = gst_matroska_demux_parse_blockgroup (demux, cluster_time);
+ break;
default:
- GST_WARNING ("Unknown entry 0x%x in cluster data", id);
- /* fall-through */
+ GST_WARNING ("Unknown entry 0x%x in cluster data", id);
+ /* fall-through */
case GST_EBML_ID_VOID:
- if (!gst_ebml_read_skip (ebml))
- res = FALSE;
- break;
+ if (!gst_ebml_read_skip (ebml))
+ res = FALSE;
+ break;
}
if (demux->level_up) {
switch (id) {
case GST_MATROSKA_ID_SEEKENTRY:{
- guint32 seek_id = 0;
- guint64 seek_pos = (guint64) - 1, t;
-
- if (!gst_ebml_read_master (ebml, &id)) {
- res = FALSE;
- break;
- }
-
- while (res) {
- if (!(id = gst_ebml_peek_id (ebml, &demux->level_up))) {
- res = FALSE;
- break;
- } else if (demux->level_up) {
- demux->level_up--;
- break;
- }
-
- switch (id) {
- case GST_MATROSKA_ID_SEEKID:
- if (!gst_ebml_read_uint (ebml, &id, &t))
- res = FALSE;
- seek_id = t;
- break;
-
- case GST_MATROSKA_ID_SEEKPOSITION:
- if (!gst_ebml_read_uint (ebml, &id, &seek_pos))
- res = FALSE;
- break;
-
- default:
- GST_WARNING ("Unknown seekhead ID 0x%x", id);
- /* fall-through */
-
- case GST_EBML_ID_VOID:
- if (!gst_ebml_read_skip (ebml))
- res = FALSE;
- break;
- }
-
- if (demux->level_up) {
- demux->level_up--;
- break;
- }
- }
-
- if (!seek_id || seek_pos == (guint64) - 1) {
- GST_WARNING ("Incomplete seekhead entry (0x%x/%"
- G_GUINT64_FORMAT ")", seek_id, seek_pos);
- break;
- }
-
- switch (seek_id) {
- case GST_MATROSKA_ID_CUES:
- case GST_MATROSKA_ID_TAGS:{
- guint level_up = demux->level_up;
- guint64 before_pos, length;
- GstEbmlLevel *level;
- GstEvent *event;
-
- /* remember */
- length = gst_bytestream_length (ebml->bs);
- before_pos = gst_bytestream_tell (ebml->bs);
-
- /* check for validity */
- if (seek_pos + demux->segment_start + 12 >= length) {
- g_warning ("Seekhead reference lies outside file!");
- break;
- }
-
- /* seek */
- if (!(event = gst_ebml_read_seek (ebml,
- seek_pos + demux->segment_start)))
- return FALSE;
- gst_event_unref (event);
-
- /* we don't want to lose our seekhead level, so we add
- * a dummy. This is a crude hack. */
- level = g_new (GstEbmlLevel, 1);
- level->start = 0;
- level->length = G_MAXUINT64;
- ebml->level = g_list_append (ebml->level, level);
-
- /* check ID */
- if (!(id = gst_ebml_peek_id (ebml, &demux->level_up))) {
- res = FALSE;
- break;
- }
- if (id != seek_id) {
- g_warning ("We looked for ID=0x%x but got ID=0x%x (pos=%llu)",
- seek_id, id, seek_pos + demux->segment_start);
- goto finish;
- }
-
- /* read master + parse */
- switch (id) {
- case GST_MATROSKA_ID_CUES:
- if (!gst_ebml_read_master (ebml, &id))
- res = FALSE;
- else if (!gst_matroska_demux_parse_index (demux, TRUE) &&
- gst_bytestream_length (ebml->bs) !=
- gst_bytestream_tell (ebml->bs))
- res = FALSE;
- else
- demux->index_parsed = TRUE;
- break;
- case GST_MATROSKA_ID_TAGS:
- if (!gst_ebml_read_master (ebml, &id))
- res = FALSE;
- else if (!gst_matroska_demux_parse_metadata (demux, TRUE) &&
- gst_bytestream_length (ebml->bs) !=
- gst_bytestream_tell (ebml->bs))
- res = FALSE;
- else
- demux->metadata_parsed = TRUE;
- break;
- }
- if (!res)
- break;
-
- finish:
- /* remove dummy level */
- while (ebml->level) {
- guint64 length;
-
- level = g_list_last (ebml->level)->data;
- ebml->level = g_list_remove (ebml->level, level);
- length = level->length;
- g_free (level);
- if (length == G_MAXUINT64)
- break;
- }
-
- /* seek back */
- if (!(event = gst_ebml_read_seek (ebml, before_pos)))
- return FALSE;
- gst_event_unref (event);
- demux->level_up = level_up;
- break;
- }
-
- default:
- GST_INFO ("Ignoring seekhead entry for ID=0x%x", seek_id);
- break;
- }
-
- break;
+ guint32 seek_id = 0;
+ guint64 seek_pos = (guint64) - 1, t;
+
+ if (!gst_ebml_read_master (ebml, &id)) {
+ res = FALSE;
+ break;
+ }
+
+ while (res) {
+ if (!(id = gst_ebml_peek_id (ebml, &demux->level_up))) {
+ res = FALSE;
+ break;
+ } else if (demux->level_up) {
+ demux->level_up--;
+ break;
+ }
+
+ switch (id) {
+ case GST_MATROSKA_ID_SEEKID:
+ if (!gst_ebml_read_uint (ebml, &id, &t))
+ res = FALSE;
+ seek_id = t;
+ break;
+
+ case GST_MATROSKA_ID_SEEKPOSITION:
+ if (!gst_ebml_read_uint (ebml, &id, &seek_pos))
+ res = FALSE;
+ break;
+
+ default:
+ GST_WARNING ("Unknown seekhead ID 0x%x", id);
+ /* fall-through */
+
+ case GST_EBML_ID_VOID:
+ if (!gst_ebml_read_skip (ebml))
+ res = FALSE;
+ break;
+ }
+
+ if (demux->level_up) {
+ demux->level_up--;
+ break;
+ }
+ }
+
+ if (!seek_id || seek_pos == (guint64) - 1) {
+ GST_WARNING ("Incomplete seekhead entry (0x%x/%"
+ G_GUINT64_FORMAT ")", seek_id, seek_pos);
+ break;
+ }
+
+ switch (seek_id) {
+ case GST_MATROSKA_ID_CUES:
+ case GST_MATROSKA_ID_TAGS:{
+ guint level_up = demux->level_up;
+ guint64 before_pos, length;
+ GstEbmlLevel *level;
+ GstEvent *event;
+
+ /* remember */
+ length = gst_bytestream_length (ebml->bs);
+ before_pos = gst_bytestream_tell (ebml->bs);
+
+ /* check for validity */
+ if (seek_pos + demux->segment_start + 12 >= length) {
+ g_warning ("Seekhead reference lies outside file!");
+ break;
+ }
+
+ /* seek */
+ if (!(event = gst_ebml_read_seek (ebml,
+ seek_pos + demux->segment_start)))
+ return FALSE;
+ gst_event_unref (event);
+
+ /* we don't want to lose our seekhead level, so we add
+ * a dummy. This is a crude hack. */
+ level = g_new (GstEbmlLevel, 1);
+ level->start = 0;
+ level->length = G_MAXUINT64;
+ ebml->level = g_list_append (ebml->level, level);
+
+ /* check ID */
+ if (!(id = gst_ebml_peek_id (ebml, &demux->level_up))) {
+ res = FALSE;
+ break;
+ }
+ if (id != seek_id) {
+ g_warning ("We looked for ID=0x%x but got ID=0x%x (pos=%llu)",
+ seek_id, id, seek_pos + demux->segment_start);
+ goto finish;
+ }
+
+ /* read master + parse */
+ switch (id) {
+ case GST_MATROSKA_ID_CUES:
+ if (!gst_ebml_read_master (ebml, &id))
+ res = FALSE;
+ else if (!gst_matroska_demux_parse_index (demux, TRUE) &&
+ gst_bytestream_length (ebml->bs) !=
+ gst_bytestream_tell (ebml->bs))
+ res = FALSE;
+ else
+ demux->index_parsed = TRUE;
+ break;
+ case GST_MATROSKA_ID_TAGS:
+ if (!gst_ebml_read_master (ebml, &id))
+ res = FALSE;
+ else if (!gst_matroska_demux_parse_metadata (demux, TRUE) &&
+ gst_bytestream_length (ebml->bs) !=
+ gst_bytestream_tell (ebml->bs))
+ res = FALSE;
+ else
+ demux->metadata_parsed = TRUE;
+ break;
+ }
+ if (!res)
+ break;
+
+ finish:
+ /* remove dummy level */
+ while (ebml->level) {
+ guint64 length;
+
+ level = g_list_last (ebml->level)->data;
+ ebml->level = g_list_remove (ebml->level, level);
+ length = level->length;
+ g_free (level);
+ if (length == G_MAXUINT64)
+ break;
+ }
+
+ /* seek back */
+ if (!(event = gst_ebml_read_seek (ebml, before_pos)))
+ return FALSE;
+ gst_event_unref (event);
+ demux->level_up = level_up;
+ break;
+ }
+
+ default:
+ GST_INFO ("Ignoring seekhead entry for ID=0x%x", seek_id);
+ break;
+ }
+
+ break;
}
default:
- GST_WARNING ("Unknown seekhead ID 0x%x", id);
- /* fall-through */
+ GST_WARNING ("Unknown seekhead ID 0x%x", id);
+ /* fall-through */
case GST_EBML_ID_VOID:
- if (!gst_ebml_read_skip (ebml))
- res = FALSE;
- break;
+ if (!gst_ebml_read_skip (ebml))
+ res = FALSE;
+ break;
}
if (demux->level_up) {
}
switch (id) {
- /* stream info */
+ /* stream info */
case GST_MATROSKA_ID_INFO:{
- if (!gst_ebml_read_master (ebml, &id)) {
- res = FALSE;
- break;
- }
- res = gst_matroska_demux_parse_info (demux);
- break;
+ if (!gst_ebml_read_master (ebml, &id)) {
+ res = FALSE;
+ break;
+ }
+ res = gst_matroska_demux_parse_info (demux);
+ break;
}
- /* track info headers */
+ /* track info headers */
case GST_MATROSKA_ID_TRACKS:{
- if (!gst_ebml_read_master (ebml, &id)) {
- res = FALSE;
- break;
- }
- res = gst_matroska_demux_parse_tracks (demux);
- break;
+ if (!gst_ebml_read_master (ebml, &id)) {
+ res = FALSE;
+ break;
+ }
+ res = gst_matroska_demux_parse_tracks (demux);
+ break;
}
- /* stream index */
+ /* stream index */
case GST_MATROSKA_ID_CUES:{
- if (!demux->index_parsed) {
- if (!gst_ebml_read_master (ebml, &id)) {
- res = FALSE;
- break;
- }
- res = gst_matroska_demux_parse_index (demux, FALSE);
- } else
- res = gst_ebml_read_skip (ebml);
- break;
+ if (!demux->index_parsed) {
+ if (!gst_ebml_read_master (ebml, &id)) {
+ res = FALSE;
+ break;
+ }
+ res = gst_matroska_demux_parse_index (demux, FALSE);
+ } else
+ res = gst_ebml_read_skip (ebml);
+ break;
}
- /* metadata */
+ /* metadata */
case GST_MATROSKA_ID_TAGS:{
- if (!demux->index_parsed) {
- if (!gst_ebml_read_master (ebml, &id)) {
- res = FALSE;
- break;
- }
- res = gst_matroska_demux_parse_metadata (demux, FALSE);
- } else
- res = gst_ebml_read_skip (ebml);
- break;
+ if (!demux->index_parsed) {
+ if (!gst_ebml_read_master (ebml, &id)) {
+ res = FALSE;
+ break;
+ }
+ res = gst_matroska_demux_parse_metadata (demux, FALSE);
+ } else
+ res = gst_ebml_read_skip (ebml);
+ break;
}
- /* file index (if seekable, seek to Cues/Tags to parse it) */
+ /* file index (if seekable, seek to Cues/Tags to parse it) */
case GST_MATROSKA_ID_SEEKHEAD:{
- if (!gst_ebml_read_master (ebml, &id)) {
- res = FALSE;
- break;
- }
- res = gst_matroska_demux_parse_contents (demux);
- break;
+ if (!gst_ebml_read_master (ebml, &id)) {
+ res = FALSE;
+ break;
+ }
+ res = gst_matroska_demux_parse_contents (demux);
+ break;
}
case GST_MATROSKA_ID_CLUSTER:{
- if (!gst_ebml_read_master (ebml, &id)) {
- res = FALSE;
- break;
- }
- /* The idea is that we parse one cluster per loop and
- * then break out of the loop here. In the next call
- * of the loopfunc, we will get back here with the
- * next cluster. If an error occurs, we didn't
- * actually push a buffer, but we still want to break
- * out of the loop to handle a possible error. We'll
- * get back here if it's recoverable. */
- gst_matroska_demux_parse_cluster (demux);
- demux->state = GST_MATROSKA_DEMUX_STATE_DATA;
- res = FALSE;
- break;
+ if (!gst_ebml_read_master (ebml, &id)) {
+ res = FALSE;
+ break;
+ }
+ /* The idea is that we parse one cluster per loop and
+ * then break out of the loop here. In the next call
+ * of the loopfunc, we will get back here with the
+ * next cluster. If an error occurs, we didn't
+ * actually push a buffer, but we still want to break
+ * out of the loop to handle a possible error. We'll
+ * get back here if it's recoverable. */
+ gst_matroska_demux_parse_cluster (demux);
+ demux->state = GST_MATROSKA_DEMUX_STATE_DATA;
+ res = FALSE;
+ break;
}
default:
- GST_WARNING ("Unknown matroska file header ID 0x%x", id);
- /* fall-through */
+ GST_WARNING ("Unknown matroska file header ID 0x%x", id);
+ /* fall-through */
case GST_EBML_ID_VOID:
- if (!gst_ebml_read_skip (ebml))
- res = FALSE;
- break;
+ if (!gst_ebml_read_skip (ebml))
+ res = FALSE;
+ break;
}
if (demux->level_up) {
/* assure size is big enough */
if (size < 24) {
- GST_WARNING ("Too small BITMAPINFOHEADER (%d bytes)", size);
- return NULL;
+ GST_WARNING ("Too small BITMAPINFOHEADER (%d bytes)", size);
+ return NULL;
}
if (size < sizeof (gst_riff_strf_vids)) {
- vids =
- (gst_riff_strf_vids *) g_realloc (vids,
- sizeof (gst_riff_strf_vids));
+ vids =
+ (gst_riff_strf_vids *) g_realloc (vids,
+ sizeof (gst_riff_strf_vids));
}
/* little-endian -> byte-order */
vids->imp_colors = GUINT32_FROM_LE (vids->imp_colors);
caps = gst_riff_create_video_caps (vids->compression, NULL, vids,
- &codec_name);
+ &codec_name);
gst_tag_list_add (list, GST_TAG_MERGE_APPEND, GST_TAG_VIDEO_CODEC,
- codec_name, NULL);
+ codec_name, NULL);
if (GST_IS_ELEMENT (demux))
- gst_element_found_tags (GST_ELEMENT (demux), list);
+ gst_element_found_tags (GST_ELEMENT (demux), list);
gst_tag_list_free (list);
if (codec_name)
- g_free (codec_name);
+ g_free (codec_name);
} else {
caps = gst_riff_create_video_template_caps ();
}
guint32 fourcc = 0;
switch (videocontext->fourcc) {
- case GST_MAKE_FOURCC ('I', '4', '2', '0'):
- case GST_MAKE_FOURCC ('Y', 'U', 'Y', '2'):
- fourcc = videocontext->fourcc;
- break;
-
- default:
- GST_DEBUG ("Unknown fourcc " GST_FOURCC_FORMAT,
- GST_FOURCC_ARGS (videocontext->fourcc));
- return NULL;
+ case GST_MAKE_FOURCC ('I', '4', '2', '0'):
+ case GST_MAKE_FOURCC ('Y', 'U', 'Y', '2'):
+ fourcc = videocontext->fourcc;
+ break;
+
+ default:
+ GST_DEBUG ("Unknown fourcc " GST_FOURCC_FORMAT,
+ GST_FOURCC_ARGS (videocontext->fourcc));
+ return NULL;
}
caps = gst_caps_new_simple ("video/x-raw-yuv",
- "format", GST_TYPE_FOURCC, fourcc, NULL);
+ "format", GST_TYPE_FOURCC, fourcc, NULL);
} else {
caps = gst_caps_from_string ("video/x-raw-yuv, "
- "format = (fourcc) { I420, YUY2, YV12 }");
+ "format = (fourcc) { I420, YUY2, YV12 }");
}
} else if (!strcmp (codec_id, GST_MATROSKA_CODEC_ID_VIDEO_MPEG4_SP)) {
caps = gst_caps_new_simple ("video/x-divx",
- "divxversion", G_TYPE_INT, 4, NULL);
+ "divxversion", G_TYPE_INT, 4, NULL);
} else if (!strcmp (codec_id, GST_MATROSKA_CODEC_ID_VIDEO_MPEG4_ASP) ||
!strcmp (codec_id, GST_MATROSKA_CODEC_ID_VIDEO_MPEG4_AP)) {
caps = gst_caps_new_full (gst_structure_new ("video/x-divx",
- "divxversion", G_TYPE_INT, 5, NULL),
- gst_structure_new ("video/x-xvid", NULL),
- gst_structure_new ("video/mpeg",
- "mpegversion", G_TYPE_INT, 4,
- "systemstream", G_TYPE_BOOLEAN, FALSE, NULL), NULL);
+ "divxversion", G_TYPE_INT, 5, NULL),
+ gst_structure_new ("video/x-xvid", NULL),
+ gst_structure_new ("video/mpeg",
+ "mpegversion", G_TYPE_INT, 4,
+ "systemstream", G_TYPE_BOOLEAN, FALSE, NULL), NULL);
} else if (!strcmp (codec_id, GST_MATROSKA_CODEC_ID_VIDEO_MSMPEG4V3)) {
caps = gst_caps_new_full (gst_structure_new ("video/x-divx",
- "divxversion", G_TYPE_INT, 3, NULL),
- gst_structure_new ("video/x-msmpeg",
- "msmpegversion", G_TYPE_INT, 43, NULL), NULL);
+ "divxversion", G_TYPE_INT, 3, NULL),
+ gst_structure_new ("video/x-msmpeg",
+ "msmpegversion", G_TYPE_INT, 43, NULL), NULL);
} else if (!strcmp (codec_id, GST_MATROSKA_CODEC_ID_VIDEO_MPEG1) ||
!strcmp (codec_id, GST_MATROSKA_CODEC_ID_VIDEO_MPEG2)) {
gint mpegversion = -1;
g_assert (0);
caps = gst_caps_new_simple ("video/mpeg",
- "systemstream", G_TYPE_BOOLEAN, FALSE,
- "mpegversion", G_TYPE_INT, mpegversion, NULL);
+ "systemstream", G_TYPE_BOOLEAN, FALSE,
+ "mpegversion", G_TYPE_INT, mpegversion, NULL);
} else if (!strcmp (codec_id, GST_MATROSKA_CODEC_ID_VIDEO_MJPEG)) {
caps = gst_caps_new_simple ("video/x-jpeg", NULL);
} else {
for (i = 0; i < gst_caps_get_size (caps); i++) {
structure = gst_caps_get_structure (caps, i);
if (videocontext != NULL) {
- if (videocontext->pixel_width > 0 && videocontext->pixel_height > 0) {
- gint w = videocontext->pixel_width;
- gint h = videocontext->pixel_height;
-
- gst_structure_set (structure,
- "width", G_TYPE_INT, w, "height", G_TYPE_INT, h, NULL);
- } else {
- gst_structure_set (structure,
- "width", GST_TYPE_INT_RANGE, 16, 4096,
- "height", GST_TYPE_INT_RANGE, 16, 4096, NULL);
- }
+ if (videocontext->pixel_width > 0 && videocontext->pixel_height > 0) {
+ gint w = videocontext->pixel_width;
+ gint h = videocontext->pixel_height;
+
+ gst_structure_set (structure,
+ "width", G_TYPE_INT, w, "height", G_TYPE_INT, h, NULL);
+ } else {
+ gst_structure_set (structure,
+ "width", GST_TYPE_INT_RANGE, 16, 4096,
+ "height", GST_TYPE_INT_RANGE, 16, 4096, NULL);
+ }
#if 0
- if (videocontext->display_width > 0 && videocontext->display_height > 0) {
- gint w =
- 100 * videocontext->display_width / videocontext->pixel_width;
- gint h =
- 100 * videocontext->display_height / videocontext->pixel_height;
-
- gst_structure_set (structure,
- "pixel_width", G_TYPE_INT, w,
- "pixel_height", G_TYPE_INT, h, NULL);
- }
+ if (videocontext->display_width > 0 && videocontext->display_height > 0) {
+ gint w =
+ 100 * videocontext->display_width / videocontext->pixel_width;
+ gint h =
+ 100 * videocontext->display_height / videocontext->pixel_height;
+
+ gst_structure_set (structure,
+ "pixel_width", G_TYPE_INT, w,
+ "pixel_height", G_TYPE_INT, h, NULL);
+ }
#endif
- if (context->default_duration > 0) {
- gfloat framerate = 1. * GST_SECOND / context->default_duration;
-
- gst_structure_set (structure,
- "framerate", G_TYPE_DOUBLE, framerate, NULL);
- } else {
- /* sort of a hack to get most codecs to support,
- * even if the default_duration is missing */
- gst_structure_set (structure, "framerate", G_TYPE_DOUBLE, 25.0, NULL);
- }
+ if (context->default_duration > 0) {
+ gfloat framerate = 1. * GST_SECOND / context->default_duration;
+
+ gst_structure_set (structure,
+ "framerate", G_TYPE_DOUBLE, framerate, NULL);
+ } else {
+ /* sort of a hack to get most codecs to support,
+ * even if the default_duration is missing */
+ gst_structure_set (structure, "framerate", G_TYPE_DOUBLE, 25.0, NULL);
+ }
} else {
- gst_structure_set (structure,
- "width", GST_TYPE_INT_RANGE, 16, 4096,
- "height", GST_TYPE_INT_RANGE, 16, 4096,
- "pixel_width", GST_TYPE_INT_RANGE, 0, 255,
- "pixel_height", GST_TYPE_INT_RANGE, 0, 255,
- "framerate", GST_TYPE_DOUBLE_RANGE, 0.0, G_MAXDOUBLE, NULL);
+ gst_structure_set (structure,
+ "width", GST_TYPE_INT_RANGE, 16, 4096,
+ "height", GST_TYPE_INT_RANGE, 16, 4096,
+ "pixel_width", GST_TYPE_INT_RANGE, 0, 255,
+ "pixel_height", GST_TYPE_INT_RANGE, 0, 255,
+ "framerate", GST_TYPE_DOUBLE_RANGE, 0.0, G_MAXDOUBLE, NULL);
}
}
}
g_assert (0);
caps = gst_caps_new_simple ("audio/mpeg",
- "mpegversion", G_TYPE_INT, 1, "layer", G_TYPE_INT, layer, NULL);
+ "mpegversion", G_TYPE_INT, 1, "layer", G_TYPE_INT, layer, NULL);
} else if (!strcmp (codec_id, GST_MATROSKA_CODEC_ID_AUDIO_PCM_INT_BE) ||
!strcmp (codec_id, GST_MATROSKA_CODEC_ID_AUDIO_PCM_INT_LE)) {
gint endianness = -1;
if (context != NULL) {
caps = gst_caps_new_simple ("audio/x-raw-int",
- "width", G_TYPE_INT, audiocontext->bitdepth,
- "depth", G_TYPE_INT, audiocontext->bitdepth,
- "signed", G_TYPE_BOOLEAN, audiocontext->bitdepth == 8, NULL);
+ "width", G_TYPE_INT, audiocontext->bitdepth,
+ "depth", G_TYPE_INT, audiocontext->bitdepth,
+ "signed", G_TYPE_BOOLEAN, audiocontext->bitdepth == 8, NULL);
} else {
caps = gst_caps_from_string ("audio/x-raw-int, "
- "signed = (boolean) { TRUE, FALSE }, "
- "depth = (int) { 8, 16 }, " "width = (int) { 8, 16 }");
+ "signed = (boolean) { TRUE, FALSE }, "
+ "depth = (int) { 8, 16 }, " "width = (int) { 8, 16 }");
}
gst_caps_set_simple (caps, "endianness", G_TYPE_INT, endianness, NULL);
} else if (!strcmp (codec_id, GST_MATROSKA_CODEC_ID_AUDIO_PCM_FLOAT)) {
caps = gst_caps_new_simple ("audio/x-raw-float",
- "endianness", G_TYPE_INT, G_BYTE_ORDER,
- "buffer-frames", GST_TYPE_INT_RANGE, 1, G_MAXINT, NULL);
+ "endianness", G_TYPE_INT, G_BYTE_ORDER,
+ "buffer-frames", GST_TYPE_INT_RANGE, 1, G_MAXINT, NULL);
if (audiocontext != NULL) {
gst_caps_set_simple (caps,
- "width", G_TYPE_INT, audiocontext->bitdepth, NULL);
+ "width", G_TYPE_INT, audiocontext->bitdepth, NULL);
} else {
gst_caps_set_simple (caps, "width", GST_TYPE_INT_RANGE, 32, 64, NULL);
}
caps = gst_riff_create_audio_caps (auds->format, NULL, auds, &codec_name);
gst_tag_list_add (list, GST_TAG_MERGE_APPEND, GST_TAG_AUDIO_CODEC,
- codec_name, NULL);
+ codec_name, NULL);
if (GST_IS_ELEMENT (demux))
- gst_element_found_tags (GST_ELEMENT (demux), list);
+ gst_element_found_tags (GST_ELEMENT (demux), list);
gst_tag_list_free (list);
if (codec_name)
- g_free (codec_name);
+ g_free (codec_name);
} else {
caps = gst_riff_create_audio_template_caps ();
}
} else if (!strncmp (codec_id, GST_MATROSKA_CODEC_ID_AUDIO_MPEG2,
- strlen (GST_MATROSKA_CODEC_ID_AUDIO_MPEG2)) ||
+ strlen (GST_MATROSKA_CODEC_ID_AUDIO_MPEG2)) ||
!strncmp (codec_id, GST_MATROSKA_CODEC_ID_AUDIO_MPEG4,
- strlen (GST_MATROSKA_CODEC_ID_AUDIO_MPEG4))) {
+ strlen (GST_MATROSKA_CODEC_ID_AUDIO_MPEG4))) {
gint mpegversion = -1;
if (!strncmp (codec_id, GST_MATROSKA_CODEC_ID_AUDIO_MPEG2,
- strlen (GST_MATROSKA_CODEC_ID_AUDIO_MPEG2)))
+ strlen (GST_MATROSKA_CODEC_ID_AUDIO_MPEG2)))
mpegversion = 2;
else if (!strncmp (codec_id, GST_MATROSKA_CODEC_ID_AUDIO_MPEG4,
- strlen (GST_MATROSKA_CODEC_ID_AUDIO_MPEG4)))
+ strlen (GST_MATROSKA_CODEC_ID_AUDIO_MPEG4)))
mpegversion = 4;
else
g_assert (0);
caps = gst_caps_new_simple ("audio/mpeg",
- "mpegversion", G_TYPE_INT, mpegversion, NULL);
+ "mpegversion", G_TYPE_INT, mpegversion, NULL);
} else {
GST_WARNING ("Unknown codec '%s', cannot build Caps", codec_id);
return NULL;
for (i = 0; i < gst_caps_get_size (caps); i++) {
structure = gst_caps_get_structure (caps, i);
if (audiocontext != NULL) {
- if (audiocontext->samplerate > 0 && audiocontext->channels > 0) {
- gst_structure_set (structure,
- "channels", G_TYPE_INT, audiocontext->channels,
- "rate", G_TYPE_INT, audiocontext->samplerate, NULL);
- }
+ if (audiocontext->samplerate > 0 && audiocontext->channels > 0) {
+ gst_structure_set (structure,
+ "channels", G_TYPE_INT, audiocontext->channels,
+ "rate", G_TYPE_INT, audiocontext->samplerate, NULL);
+ }
} else {
- gst_structure_set (structure,
- "channels", GST_TYPE_INT_RANGE, 1, 6,
- "rate", GST_TYPE_INT_RANGE, 4000, 96000, NULL);
+ gst_structure_set (structure,
+ "channels", GST_TYPE_INT_RANGE, 1, 6,
+ "rate", GST_TYPE_INT_RANGE, 4000, 96000, NULL);
}
}
}
/* TODO: Real/Quicktime */
/* FILLME */
NULL,
- }, *audio_id[] = {
+ }, *audio_id[] =
+ {
GST_MATROSKA_CODEC_ID_AUDIO_MPEG1_L1,
- GST_MATROSKA_CODEC_ID_AUDIO_MPEG1_L2,
- GST_MATROSKA_CODEC_ID_AUDIO_MPEG1_L3,
- GST_MATROSKA_CODEC_ID_AUDIO_PCM_INT_BE,
- GST_MATROSKA_CODEC_ID_AUDIO_PCM_INT_LE,
- GST_MATROSKA_CODEC_ID_AUDIO_PCM_FLOAT,
- GST_MATROSKA_CODEC_ID_AUDIO_AC3,
- GST_MATROSKA_CODEC_ID_AUDIO_ACM,
- GST_MATROSKA_CODEC_ID_AUDIO_VORBIS,
- GST_MATROSKA_CODEC_ID_AUDIO_MPEG2, GST_MATROSKA_CODEC_ID_AUDIO_MPEG4,
- /* TODO: AC3-9/10, Real, Musepack, Quicktime */
- /* FILLME */
- NULL,}, *complex_id[] = {
+ GST_MATROSKA_CODEC_ID_AUDIO_MPEG1_L2,
+ GST_MATROSKA_CODEC_ID_AUDIO_MPEG1_L3,
+ GST_MATROSKA_CODEC_ID_AUDIO_PCM_INT_BE,
+ GST_MATROSKA_CODEC_ID_AUDIO_PCM_INT_LE,
+ GST_MATROSKA_CODEC_ID_AUDIO_PCM_FLOAT,
+ GST_MATROSKA_CODEC_ID_AUDIO_AC3,
+ GST_MATROSKA_CODEC_ID_AUDIO_ACM,
+ GST_MATROSKA_CODEC_ID_AUDIO_VORBIS,
+ GST_MATROSKA_CODEC_ID_AUDIO_MPEG2, GST_MATROSKA_CODEC_ID_AUDIO_MPEG4,
+ /* TODO: AC3-9/10, Real, Musepack, Quicktime */
+ /* FILLME */
+ NULL,}
+ , *complex_id[] = {
/* FILLME */
- NULL,}, *subtitle_id[] = {
+ NULL,}
+ , *subtitle_id[] = {
/* FILLME */
NULL,};
/* this filter needs the riff parser */
- if (!gst_library_load ("gstbytestream") || !gst_library_load ("riff")) /* for fourcc stuff */
+ if (!gst_library_load ("gstbytestream") || !gst_library_load ("riff")) /* for fourcc stuff */
return FALSE;
/* video src template */
/* create an elementfactory for the matroska_demux element */
if (!gst_element_register (plugin, "matroskademux",
- GST_RANK_PRIMARY, GST_TYPE_MATROSKA_DEMUX))
+ GST_RANK_PRIMARY, GST_TYPE_MATROSKA_DEMUX))
return FALSE;
return TRUE;
GST_PAD_SINK,
GST_PAD_REQUEST,
GST_STATIC_CAPS ("video/mpeg, "
- "mpegversion = (int) { 1, 2, 4 }, "
- "systemstream = (boolean) false, "
- COMMON_VIDEO_CAPS "; "
- "video/x-divx, "
- COMMON_VIDEO_CAPS "; "
- "video/x-xvid, "
- COMMON_VIDEO_CAPS "; "
- "video/x-msmpeg, "
- COMMON_VIDEO_CAPS "; "
- "video/x-jpeg, "
- COMMON_VIDEO_CAPS "; "
- "video/x-raw-yuv, "
- "format = (fourcc) { YUY2, I420 }, " COMMON_VIDEO_CAPS)
+ "mpegversion = (int) { 1, 2, 4 }, "
+ "systemstream = (boolean) false, "
+ COMMON_VIDEO_CAPS "; "
+ "video/x-divx, "
+ COMMON_VIDEO_CAPS "; "
+ "video/x-xvid, "
+ COMMON_VIDEO_CAPS "; "
+ "video/x-msmpeg, "
+ COMMON_VIDEO_CAPS "; "
+ "video/x-jpeg, "
+ COMMON_VIDEO_CAPS "; "
+ "video/x-raw-yuv, "
+ "format = (fourcc) { YUY2, I420 }, " COMMON_VIDEO_CAPS)
);
#define COMMON_AUDIO_CAPS \
GST_PAD_SINK,
GST_PAD_REQUEST,
GST_STATIC_CAPS ("audio/mpeg, "
- "mpegversion = (int) 1, "
- "layer = (int) [ 1, 3 ], "
- COMMON_AUDIO_CAPS "; "
- "audio/mpeg, "
- "mpegversion = (int) { 2, 4 }, "
- COMMON_AUDIO_CAPS "; "
- "audio/x-ac3, "
- COMMON_AUDIO_CAPS "; "
- "audio/x-raw-int, "
- "width = (int) { 8, 16, 24 }, "
- "depth = (int) { 8, 16, 24 }, "
- "endianness = (int) { BIG_ENDIAN, LITTLE_ENDIAN }, "
- "signed = (boolean) { true, false }, " COMMON_AUDIO_CAPS)
+ "mpegversion = (int) 1, "
+ "layer = (int) [ 1, 3 ], "
+ COMMON_AUDIO_CAPS "; "
+ "audio/mpeg, "
+ "mpegversion = (int) { 2, 4 }, "
+ COMMON_AUDIO_CAPS "; "
+ "audio/x-ac3, "
+ COMMON_AUDIO_CAPS "; "
+ "audio/x-raw-int, "
+ "width = (int) { 8, 16, 24 }, "
+ "depth = (int) { 8, 16, 24 }, "
+ "endianness = (int) { BIG_ENDIAN, LITTLE_ENDIAN }, "
+ "signed = (boolean) { true, false }, " COMMON_AUDIO_CAPS)
);
static GstStaticPadTemplate subtitlesink_templ =
};
gst_matroska_mux_type =
- g_type_register_static (GST_TYPE_EBML_WRITE,
- "GstMatroskaMmux", &gst_matroska_mux_info, 0);
+ g_type_register_static (GST_TYPE_EBML_WRITE,
+ "GstMatroskaMmux", &gst_matroska_mux_info, 0);
}
return gst_matroska_mux_type;
g_object_class_install_property (gobject_class, ARG_METADATA,
g_param_spec_boxed ("metadata", "Metadata", "Metadata",
- GST_TYPE_CAPS, G_PARAM_READWRITE));
+ GST_TYPE_CAPS, G_PARAM_READWRITE));
parent_class = g_type_class_ref (GST_TYPE_EBML_WRITE);
mux->srcpad =
gst_pad_new_from_template (gst_element_class_get_pad_template (klass,
- "src"), "src");
+ "src"), "src");
gst_element_add_pad (GST_ELEMENT (mux), mux->srcpad);
GST_EBML_WRITE (mux)->srcpad = mux->srcpad;
for (i = 0; i < GST_MATROSKA_MUX_MAX_STREAMS; i++) {
if (mux->sink[i].track != NULL) {
if (mux->sink[i].track->pad != NULL) {
- gst_element_remove_pad (GST_ELEMENT (mux), mux->sink[i].track->pad);
+ gst_element_remove_pad (GST_ELEMENT (mux), mux->sink[i].track->pad);
}
g_free (mux->sink[i].track->codec_id);
g_free (mux->sink[i].track->codec_name);
/* reset media info (to default) */
gst_caps_replace (&mux->metadata,
gst_caps_new_simple ("application/x-gst-metadata",
- "application", G_TYPE_STRING, "", "date", G_TYPE_STRING, "", NULL));
+ "application", G_TYPE_STRING, "", "date", G_TYPE_STRING, "", NULL));
/* reset indexes */
mux->num_indexes = 0;
/* find context */
for (i = 0; i < mux->num_streams; i++) {
if (mux->sink[i].track && mux->sink[i].track->pad &&
- mux->sink[i].track->pad == pad) {
+ mux->sink[i].track->pad == pad) {
context = mux->sink[i].track;
break;
}
gst_structure_get_int (structure, "divxversion", &divxversion);
switch (divxversion) {
case 3:
- context->codec_id = g_strdup (GST_MATROSKA_CODEC_ID_VIDEO_MSMPEG4V3);
- break;
+ context->codec_id = g_strdup (GST_MATROSKA_CODEC_ID_VIDEO_MSMPEG4V3);
+ break;
case 4:
- context->codec_id = g_strdup (GST_MATROSKA_CODEC_ID_VIDEO_MPEG4_SP);
- break;
+ context->codec_id = g_strdup (GST_MATROSKA_CODEC_ID_VIDEO_MPEG4_SP);
+ break;
case 5:
- context->codec_id = g_strdup (GST_MATROSKA_CODEC_ID_VIDEO_MPEG4_ASP);
- break;
+ context->codec_id = g_strdup (GST_MATROSKA_CODEC_ID_VIDEO_MPEG4_ASP);
+ break;
}
return GST_PAD_LINK_OK;
gst_structure_get_int (structure, "mpegversion", &mpegversion);
switch (mpegversion) {
case 1:
- context->codec_id = g_strdup (GST_MATROSKA_CODEC_ID_VIDEO_MPEG1);
- break;
+ context->codec_id = g_strdup (GST_MATROSKA_CODEC_ID_VIDEO_MPEG1);
+ break;
case 2:
- context->codec_id = g_strdup (GST_MATROSKA_CODEC_ID_VIDEO_MPEG2);
- break;
+ context->codec_id = g_strdup (GST_MATROSKA_CODEC_ID_VIDEO_MPEG2);
+ break;
case 3:
- context->codec_id = g_strdup (GST_MATROSKA_CODEC_ID_VIDEO_MPEG4_ASP);
- break;
+ context->codec_id = g_strdup (GST_MATROSKA_CODEC_ID_VIDEO_MPEG4_ASP);
+ break;
}
return GST_PAD_LINK_OK;
/* find context */
for (i = 0; i < mux->num_streams; i++) {
if (mux->sink[i].track && mux->sink[i].track->pad &&
- mux->sink[i].track->pad == pad) {
+ mux->sink[i].track->pad == pad) {
context = mux->sink[i].track;
break;
}
gst_structure_get_int (structure, "mpegversion", &mpegversion);
switch (mpegversion) {
case 1:{
- gint layer;
-
- gst_structure_get_int (structure, "layer", &layer);
- switch (layer) {
- case 1:
- context->codec_id = g_strdup (GST_MATROSKA_CODEC_ID_AUDIO_MPEG1_L1);
- break;
- case 2:
- context->codec_id = g_strdup (GST_MATROSKA_CODEC_ID_AUDIO_MPEG1_L2);
- break;
- case 3:
- context->codec_id = g_strdup (GST_MATROSKA_CODEC_ID_AUDIO_MPEG1_L3);
- break;
- }
- break;
+ gint layer;
+
+ gst_structure_get_int (structure, "layer", &layer);
+ switch (layer) {
+ case 1:
+ context->codec_id = g_strdup (GST_MATROSKA_CODEC_ID_AUDIO_MPEG1_L1);
+ break;
+ case 2:
+ context->codec_id = g_strdup (GST_MATROSKA_CODEC_ID_AUDIO_MPEG1_L2);
+ break;
+ case 3:
+ context->codec_id = g_strdup (GST_MATROSKA_CODEC_ID_AUDIO_MPEG1_L3);
+ break;
+ }
+ break;
}
case 2:
- context->codec_id = g_strdup (GST_MATROSKA_CODEC_ID_AUDIO_MPEG2 "MAIN");
- break;
+ context->codec_id = g_strdup (GST_MATROSKA_CODEC_ID_AUDIO_MPEG2 "MAIN");
+ break;
case 4:
- context->codec_id = g_strdup (GST_MATROSKA_CODEC_ID_AUDIO_MPEG4 "MAIN");
- break;
+ context->codec_id = g_strdup (GST_MATROSKA_CODEC_ID_AUDIO_MPEG4 "MAIN");
+ break;
}
return GST_PAD_LINK_OK;
gst_structure_get_int (structure, "depth", &depth);
gst_structure_get_int (structure, "signed", &signedness);
if (width != depth ||
- (width == 8 && signedness) || (width == 16 && !signedness))
+ (width == 8 && signedness) || (width == 16 && !signedness))
return GST_PAD_LINK_REFUSED;
audiocontext->bitdepth = depth;
name = g_strdup_printf ("audio_%d", mux->num_a_streams++);
linkfunc = gst_matroska_mux_audio_pad_link;
context = (GstMatroskaTrackContext *)
- g_new0 (GstMatroskaTrackAudioContext, 1);
+ g_new0 (GstMatroskaTrackAudioContext, 1);
context->type = GST_MATROSKA_TRACK_TYPE_AUDIO;
context->name = g_strdup ("Audio");
} else if (templ == gst_element_class_get_pad_template (klass, "video_%d")) {
name = g_strdup_printf ("video_%d", mux->num_v_streams++);
linkfunc = gst_matroska_mux_video_pad_link;
context = (GstMatroskaTrackContext *)
- g_new0 (GstMatroskaTrackVideoContext, 1);
+ g_new0 (GstMatroskaTrackVideoContext, 1);
context->type = GST_MATROSKA_TRACK_TYPE_VIDEO;
context->name = g_strdup ("Video");
} else if (templ == gst_element_class_get_pad_template (klass, "subtitle_%d")) {
name = g_strdup_printf ("subtitle_%d", mux->num_t_streams++);
linkfunc = gst_matroska_mux_subtitle_pad_link;
context = (GstMatroskaTrackContext *)
- g_new0 (GstMatroskaTrackSubtitleContext, 1);
+ g_new0 (GstMatroskaTrackSubtitleContext, 1);
context->type = GST_MATROSKA_TRACK_TYPE_SUBTITLE;
context->name = g_strdup ("Subtitle");
} else {
switch (context->type) {
case GST_MATROSKA_TRACK_TYPE_VIDEO:{
GstMatroskaTrackVideoContext *videocontext =
- (GstMatroskaTrackVideoContext *) context;
+ (GstMatroskaTrackVideoContext *) context;
/* framerate, but not in the video part */
gst_ebml_write_uint (ebml, GST_MATROSKA_ID_TRACKDEFAULTDURATION,
- context->default_duration);
+ context->default_duration);
master = gst_ebml_write_master_start (ebml, GST_MATROSKA_ID_TRACKVIDEO);
gst_ebml_write_uint (ebml, GST_MATROSKA_ID_VIDEOPIXELWIDTH,
- videocontext->pixel_width);
+ videocontext->pixel_width);
gst_ebml_write_uint (ebml, GST_MATROSKA_ID_VIDEOPIXELHEIGHT,
- videocontext->pixel_height);
+ videocontext->pixel_height);
if (videocontext->display_width && videocontext->display_height) {
- gst_ebml_write_uint (ebml, GST_MATROSKA_ID_VIDEODISPLAYWIDTH,
- videocontext->display_width);
- gst_ebml_write_uint (ebml, GST_MATROSKA_ID_VIDEODISPLAYHEIGHT,
- videocontext->display_height);
+ gst_ebml_write_uint (ebml, GST_MATROSKA_ID_VIDEODISPLAYWIDTH,
+ videocontext->display_width);
+ gst_ebml_write_uint (ebml, GST_MATROSKA_ID_VIDEODISPLAYHEIGHT,
+ videocontext->display_height);
}
if (context->flags & GST_MATROSKA_VIDEOTRACK_INTERLACED)
- gst_ebml_write_uint (ebml, GST_MATROSKA_ID_VIDEOFLAGINTERLACED, 1);
+ gst_ebml_write_uint (ebml, GST_MATROSKA_ID_VIDEOFLAGINTERLACED, 1);
if (videocontext->fourcc) {
- guint32 fcc_le = GUINT32_TO_LE (videocontext->fourcc);
+ guint32 fcc_le = GUINT32_TO_LE (videocontext->fourcc);
- gst_ebml_write_binary (ebml, GST_MATROSKA_ID_VIDEOCOLOURSPACE,
- (gpointer) & fcc_le, 4);
+ gst_ebml_write_binary (ebml, GST_MATROSKA_ID_VIDEOCOLOURSPACE,
+ (gpointer) & fcc_le, 4);
}
gst_ebml_write_master_finish (ebml, master);
case GST_MATROSKA_TRACK_TYPE_AUDIO:{
GstMatroskaTrackAudioContext *audiocontext =
- (GstMatroskaTrackAudioContext *) context;
+ (GstMatroskaTrackAudioContext *) context;
master = gst_ebml_write_master_start (ebml, GST_MATROSKA_ID_TRACKAUDIO);
if (audiocontext->samplerate != 8000)
- gst_ebml_write_float (ebml, GST_MATROSKA_ID_AUDIOSAMPLINGFREQ,
- audiocontext->samplerate);
+ gst_ebml_write_float (ebml, GST_MATROSKA_ID_AUDIOSAMPLINGFREQ,
+ audiocontext->samplerate);
if (audiocontext->channels != 1)
- gst_ebml_write_uint (ebml, GST_MATROSKA_ID_AUDIOCHANNELS,
- audiocontext->channels);
+ gst_ebml_write_uint (ebml, GST_MATROSKA_ID_AUDIOCHANNELS,
+ audiocontext->channels);
if (audiocontext->bitdepth) {
- gst_ebml_write_uint (ebml, GST_MATROSKA_ID_AUDIOBITDEPTH,
- audiocontext->bitdepth);
+ gst_ebml_write_uint (ebml, GST_MATROSKA_ID_AUDIOBITDEPTH,
+ audiocontext->bitdepth);
}
gst_ebml_write_master_finish (ebml, master);
gst_ebml_write_ascii (ebml, GST_MATROSKA_ID_CODECID, context->codec_id);
if (context->codec_priv)
gst_ebml_write_binary (ebml, GST_MATROSKA_ID_CODECPRIVATE,
- context->codec_priv, context->codec_priv_size);
+ context->codec_priv, context->codec_priv_size);
/* FIXME: until we have a nice way of getting the codecname
* out of the caps, I'm not going to enable this. Too much
* (useless, double, boring) work... */
gst_ebml_write_utf8 (ebml, GST_MATROSKA_ID_MUXINGAPP, "GStreamer");
if (mux->metadata &&
gst_structure_has_field (gst_caps_get_structure (mux->metadata, 0),
- "application")) {
+ "application")) {
const gchar *app;
app = gst_structure_get_string (gst_caps_get_structure (mux->metadata, 0),
- "application");
+ "application");
if (app && app[0]) {
gst_ebml_write_utf8 (ebml, GST_MATROSKA_ID_WRITINGAPP, app);
}
GstMatroskaIndex *idx = &mux->index[n];
pointentry_master = gst_ebml_write_master_start (ebml,
- GST_MATROSKA_ID_POINTENTRY);
+ GST_MATROSKA_ID_POINTENTRY);
gst_ebml_write_date (ebml, GST_MATROSKA_ID_CUETIME,
- idx->time / mux->time_scale);
+ idx->time / mux->time_scale);
trackpos_master = gst_ebml_write_master_start (ebml,
- GST_MATROSKA_ID_CUETRACKPOSITION);
+ GST_MATROSKA_ID_CUETRACKPOSITION);
gst_ebml_write_uint (ebml, GST_MATROSKA_ID_CUETRACK, idx->track);
gst_ebml_write_uint (ebml, GST_MATROSKA_ID_CUECLUSTERPOSITION,
- idx->pos - mux->segment_master);
+ idx->pos - mux->segment_master);
gst_ebml_write_master_finish (ebml, trackpos_master);
gst_ebml_write_master_finish (ebml, pointentry_master);
}
mux->tracks_pos - mux->segment_master);
if (mux->index != NULL) {
gst_ebml_replace_uint (ebml, mux->seekhead_pos + 88,
- mux->cues_pos - mux->segment_master);
+ mux->cues_pos - mux->segment_master);
} else {
/* void'ify */
guint64 my_pos = ebml->pos;
for (i = 0; i < mux->num_streams; i++) {
while (!mux->sink[i].eos && !mux->sink[i].buffer &&
- mux->sink[i].track->num > 0 &&
- GST_PAD_IS_USABLE (mux->sink[i].track->pad)) {
+ mux->sink[i].track->num > 0 &&
+ GST_PAD_IS_USABLE (mux->sink[i].track->pad)) {
GstData *data;
data = gst_pad_pull (mux->sink[i].track->pad);
if (GST_IS_EVENT (data)) {
- if (GST_EVENT_TYPE (GST_EVENT (data)) == GST_EVENT_EOS)
- mux->sink[i].eos = TRUE;
- gst_event_unref (GST_EVENT (data));
+ if (GST_EVENT_TYPE (GST_EVENT (data)) == GST_EVENT_EOS)
+ mux->sink[i].eos = TRUE;
+ gst_event_unref (GST_EVENT (data));
} else {
- mux->sink[i].buffer = GST_BUFFER (data);
+ mux->sink[i].buffer = GST_BUFFER (data);
}
}
if (mux->sink[i].buffer) {
if (first < 0 || GST_BUFFER_TIMESTAMP (mux->sink[i].buffer) <
- GST_BUFFER_TIMESTAMP (mux->sink[first].buffer))
- first = i;
+ GST_BUFFER_TIMESTAMP (mux->sink[first].buffer))
+ first = i;
}
}
if (mux->num_indexes % 32 == 0) {
mux->index = g_renew (GstMatroskaIndex, mux->index,
- mux->num_indexes + 32);
+ mux->num_indexes + 32);
}
idx = &mux->index[mux->num_indexes++];
0,
(GInstanceInitFunc) gst_median_init,
};
+
median_type =
- g_type_register_static (GST_TYPE_ELEMENT, "GstMedian", &median_info, 0);
+ g_type_register_static (GST_TYPE_ELEMENT, "GstMedian", &median_info, 0);
}
return median_type;
}
parent_class = g_type_class_ref (GST_TYPE_ELEMENT);
- g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_ACTIVE, g_param_spec_boolean ("active", "active", "active", TRUE, G_PARAM_READWRITE)); /* CHECKME */
- g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_FILTERSIZE, g_param_spec_int ("filtersize", "filtersize", "filtersize", G_MININT, G_MAXINT, 0, G_PARAM_READWRITE)); /* CHECKME */
- g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_LUM_ONLY, g_param_spec_boolean ("lum_only", "lum_only", "lum_only", TRUE, G_PARAM_READWRITE)); /* CHECKME */
+ g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_ACTIVE, g_param_spec_boolean ("active", "active", "active", TRUE, G_PARAM_READWRITE)); /* CHECKME */
+ g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_FILTERSIZE, g_param_spec_int ("filtersize", "filtersize", "filtersize", G_MININT, G_MAXINT, 0, G_PARAM_READWRITE)); /* CHECKME */
+ g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_LUM_ONLY, g_param_spec_boolean ("lum_only", "lum_only", "lum_only", TRUE, G_PARAM_READWRITE)); /* CHECKME */
gobject_class->set_property = gst_median_set_property;
gobject_class->get_property = gst_median_get_property;
median_5 (data, GST_BUFFER_DATA (outbuf), median->width, median->height);
if (!median->lum_only) {
median_5 (data + lumsize, GST_BUFFER_DATA (outbuf) + lumsize,
- median->width / 2, median->height / 2);
+ median->width / 2, median->height / 2);
median_5 (data + lumsize + chromsize,
- GST_BUFFER_DATA (outbuf) + lumsize + chromsize, median->width / 2,
- median->height / 2);
+ GST_BUFFER_DATA (outbuf) + lumsize + chromsize, median->width / 2,
+ median->height / 2);
} else {
memcpy (GST_BUFFER_DATA (outbuf) + lumsize, data + lumsize,
- chromsize * 2);
+ chromsize * 2);
}
} else {
median_9 (data, GST_BUFFER_DATA (outbuf), median->width, median->height);
if (!median->lum_only) {
median_9 (data + lumsize, GST_BUFFER_DATA (outbuf) + lumsize,
- median->width / 2, median->height / 2);
+ median->width / 2, median->height / 2);
median_9 (data + lumsize + chromsize,
- GST_BUFFER_DATA (outbuf) + lumsize + chromsize, median->width / 2,
- median->height / 2);
+ GST_BUFFER_DATA (outbuf) + lumsize + chromsize, median->width / 2,
+ median->height / 2);
} else {
memcpy (GST_BUFFER_DATA (outbuf) + lumsize, data + lumsize,
- chromsize * 2);
+ chromsize * 2);
}
}
GST_BUFFER_TIMESTAMP (outbuf) = GST_BUFFER_TIMESTAMP (buf);
case ARG_FILTERSIZE:
argvalue = g_value_get_int (value);
if (argvalue != 5 && argvalue != 9) {
- g_warning ("median: invalid filtersize (%d), must be 5 or 9\n",
- argvalue);
+ g_warning ("median: invalid filtersize (%d), must be 5 or 9\n",
+ argvalue);
} else {
- median->filtersize = argvalue;
+ median->filtersize = argvalue;
}
break;
case ARG_ACTIVE:
{
const double *left, *right;
double *out;
- } v;
+ }
+ v;
struct
{
double *main, *null;
- } b;
+ }
+ b;
-} stack_entry;
+}
+stack_entry;
#define STACK_SIZE (CONVOLVE_DEPTH * 3)
/* Create the intermediate factors. */
for (i = 0; i < size; i++) {
- double l = left[i] + left[i + size];
- double r = right[i] + right[i + size];
+ double l = left[i] + left[i + size];
+ double r = right[i] + right[i + size];
- s_left[i + size] = r;
- s_left[i] = l;
+ s_left[i + size] = r;
+ s_left[i] = l;
}
/* Push the combine entry onto the stack. */
top++;
out[size * 2 - 1] = 0;
for (i = 0; i < size - 1; i++) {
- double lo;
- double hi;
-
- lo = mid[0] - (out[0] + out[2 * size]) + out[size];
- hi = mid[size] - (out[size] + out[3 * size]) + out[2 * size];
- out[size] = lo;
- out[2 * size] = hi;
- out++;
- mid++;
+ double lo;
+ double hi;
+
+ lo = mid[0] - (out[0] + out[2 * size]) + out[size];
+ hi = mid[size] - (out[size] + out[3 * size]) + out[2 * size];
+ out[size] = lo;
+ out[2 * size] = hi;
+ out++;
+ mid++;
}
size <<= 1;
} while (top->b.null == NULL);
for (i = 0; i < 256; i++)
right[i] -= avg;
/* End-of-stack marker. */
-#if 0 /* The following line produces a CRASH, need to figure out why?!! */
+#if 0 /* The following line produces a CRASH, need to figure out why?!! */
top[1].b.null = scratch;
#endif
top[1].b.main = NULL;
unsigned int j;
for (j = 0; j < 256; j++)
- tot += ((double) input[i + j]) * ((double) lastchoice[j] - avg);
+ tot += ((double) input[i + j]) * ((double) lastchoice[j] - avg);
if (tot > best)
- printf ("(%i)", i);
+ printf ("(%i)", i);
if (tot != left[i + 255])
- printf ("!");
+ printf ("!");
}
printf ("%i\n", p);
0,
(GInstanceInitFunc) gst_monoscope_init,
};
+
type = g_type_register_static (GST_TYPE_ELEMENT, "GstMonoscope", &info, 0);
}
return type;
monoscope->first_buffer = TRUE;
monoscope->width = 256;
monoscope->height = 128;
- monoscope->fps = 25.; /* desired frame rate */
+ monoscope->fps = 25.; /* desired frame rate */
}
static GstPadLinkReturn
/* FIXME: should really select the first 1024 samples after the timestamp. */
if (GST_BUFFER_TIMESTAMP (bufin) < monoscope->next_time || samples_in < 1024) {
GST_DEBUG ("timestamp is %" G_GUINT64_FORMAT ": want >= %" G_GUINT64_FORMAT,
- GST_BUFFER_TIMESTAMP (bufin), monoscope->next_time);
+ GST_BUFFER_TIMESTAMP (bufin), monoscope->next_time);
gst_buffer_unref (bufin);
return;
}
GST_DEBUG ("making new pad");
if (!gst_pad_is_negotiated (monoscope->srcpad)) {
if (gst_pad_renegotiate (monoscope->srcpad) <= 0) {
- GST_ELEMENT_ERROR (monoscope, CORE, NEGOTIATION, (NULL), (NULL));
- return;
+ GST_ELEMENT_ERROR (monoscope, CORE, NEGOTIATION, (NULL), (NULL));
+ return;
}
}
monoscope->first_buffer = FALSE;
}
stateptr->avgMax += max - (stateptr->avgMax >> 8);
if (stateptr->avgMax < max)
- stateptr->avgMax = max; /* Avoid overflow */
+ stateptr->avgMax = max; /* Avoid overflow */
factor = 0x7fffffff / stateptr->avgMax;
/* Keep the scaling sensible. */
if (factor > (1 << 18))
if ((bar > 0) && (bar < (256 * 128))) {
loc = stateptr->display + bar;
if (foo < 0) {
- for (h = 0; h <= (-foo); h++) {
- *loc = stateptr->colors[h];
- loc += 256;
- }
+ for (h = 0; h <= (-foo); h++) {
+ *loc = stateptr->colors[h];
+ loc += 256;
+ }
} else {
- for (h = 0; h <= foo; h++) {
- *loc = stateptr->colors[h];
- loc -= 256;
- }
+ for (h = 0; h <= foo; h++) {
+ *loc = stateptr->colors[h];
+ loc -= 256;
+ }
}
}
}
for (h = 0; h < 256; h += 2) {
stateptr->display[(i << 8) + h] = stateptr->colors[63];
if (i == 64)
- stateptr->display[(i << 8) + h + 1] = stateptr->colors[63];
+ stateptr->display[(i << 8) + h + 1] = stateptr->colors[63];
}
}
for (i = 16; i < 256; i += 16) {
NULL, NULL, sizeof (GstQTDemux), 0,
(GInstanceInitFunc) gst_qtdemux_init,
};
+
qtdemux_type =
- g_type_register_static (GST_TYPE_ELEMENT, "GstQTDemux", &qtdemux_info,
- 0);
+ g_type_register_static (GST_TYPE_ELEMENT, "GstQTDemux", &qtdemux_info,
+ 0);
}
return qtdemux_type;
}
switch (src_format) {
case GST_FORMAT_TIME:
switch (*dest_format) {
- case GST_FORMAT_BYTES:
- *dest_value = src_value * 1; /* FIXME */
- break;
- case GST_FORMAT_DEFAULT:
- *dest_value = src_value * 1; /* FIXME */
- break;
- default:
- res = FALSE;
- break;
+ case GST_FORMAT_BYTES:
+ *dest_value = src_value * 1; /* FIXME */
+ break;
+ case GST_FORMAT_DEFAULT:
+ *dest_value = src_value * 1; /* FIXME */
+ break;
+ default:
+ res = FALSE;
+ break;
}
break;
case GST_FORMAT_BYTES:
switch (*dest_format) {
- case GST_FORMAT_TIME:
- *dest_value = src_value * 1; /* FIXME */
- break;
- default:
- res = FALSE;
- break;
+ case GST_FORMAT_TIME:
+ *dest_value = src_value * 1; /* FIXME */
+ break;
+ default:
+ res = FALSE;
+ break;
}
break;
case GST_FORMAT_DEFAULT:
switch (*dest_format) {
- case GST_FORMAT_TIME:
- *dest_value = src_value * 1; /* FIXME */
- break;
- default:
- res = FALSE;
- break;
+ case GST_FORMAT_TIME:
+ *dest_value = src_value * 1; /* FIXME */
+ break;
+ default:
+ res = FALSE;
+ break;
}
break;
default:
switch (type) {
case GST_QUERY_TOTAL:
switch (*format) {
- case GST_FORMAT_TIME:
- *value = 0; /* FIXME */
- break;
- case GST_FORMAT_BYTES:
- *value = 0; /* FIXME */
- break;
- case GST_FORMAT_DEFAULT:
- *value = 0; /* FIXME */
- break;
- default:
- res = FALSE;
- break;
+ case GST_FORMAT_TIME:
+ *value = 0; /* FIXME */
+ break;
+ case GST_FORMAT_BYTES:
+ *value = 0; /* FIXME */
+ break;
+ case GST_FORMAT_DEFAULT:
+ *value = 0; /* FIXME */
+ break;
+ default:
+ res = FALSE;
+ break;
}
break;
case GST_QUERY_POSITION:
switch (*format) {
- case GST_FORMAT_TIME:
- *value = 0; /* FIXME */
- break;
- case GST_FORMAT_BYTES:
- *value = 0; /* FIXME */
- break;
- case GST_FORMAT_DEFAULT:
- *value = 0; /* FIXME */
- break;
- default:
- res = FALSE;
- break;
+ case GST_FORMAT_TIME:
+ *value = 0; /* FIXME */
+ break;
+ case GST_FORMAT_BYTES:
+ *value = 0; /* FIXME */
+ break;
+ case GST_FORMAT_DEFAULT:
+ *value = 0; /* FIXME */
+ break;
+ default:
+ res = FALSE;
+ break;
}
break;
default:
GST_DEBUG ("seek format %d", GST_EVENT_SEEK_FORMAT (event));
switch (GST_EVENT_SEEK_FORMAT (event)) {
- case GST_FORMAT_BYTES:
- case GST_FORMAT_DEFAULT:
- case GST_FORMAT_TIME:
- {
- gint64 desired_offset = GST_EVENT_SEEK_OFFSET (event);
-
- GST_DEBUG ("seeking to %" G_GINT64_FORMAT, desired_offset);
-
- res = FALSE;
- }
- default:
- res = FALSE;
- break;
+ case GST_FORMAT_BYTES:
+ case GST_FORMAT_DEFAULT:
+ case GST_FORMAT_TIME:
+ {
+ gint64 desired_offset = GST_EVENT_SEEK_OFFSET (event);
+
+ GST_DEBUG ("seeking to %" G_GINT64_FORMAT, desired_offset);
+
+ res = FALSE;
+ }
+ default:
+ res = FALSE;
+ break;
}
default:
res = FALSE;
case QTDEMUX_STATE_HEADER:
{
do {
- ret = gst_bytestream_peek_bytes (qtdemux->bs, &data, 16);
- if (ret < 16) {
- if (!gst_qtdemux_handle_sink_event (qtdemux)) {
- return;
- }
- } else {
- break;
- }
+ ret = gst_bytestream_peek_bytes (qtdemux->bs, &data, 16);
+ if (ret < 16) {
+ if (!gst_qtdemux_handle_sink_event (qtdemux)) {
+ return;
+ }
+ } else {
+ break;
+ }
} while (1);
length = GUINT32_FROM_BE (*(guint32 *) data);
GST_DEBUG ("fourcc " GST_FOURCC_FORMAT, GST_FOURCC_ARGS (fourcc));
if (length == 0) {
- length = gst_bytestream_length (qtdemux->bs) - cur_offset;
+ length = gst_bytestream_length (qtdemux->bs) - cur_offset;
}
if (length == 1) {
- guint32 length1, length2;
+ guint32 length1, length2;
- length1 = GUINT32_FROM_BE (*(guint32 *) (data + 8));
- GST_DEBUG ("length1 %08x", length1);
- length2 = GUINT32_FROM_BE (*(guint32 *) (data + 12));
- GST_DEBUG ("length2 %08x", length2);
+ length1 = GUINT32_FROM_BE (*(guint32 *) (data + 8));
+ GST_DEBUG ("length1 %08x", length1);
+ length2 = GUINT32_FROM_BE (*(guint32 *) (data + 12));
+ GST_DEBUG ("length2 %08x", length2);
- length = length2;
+ length = length2;
}
switch (fourcc) {
- case GST_MAKE_FOURCC ('m', 'd', 'a', 't'):
- case GST_MAKE_FOURCC ('f', 'r', 'e', 'e'):
- case GST_MAKE_FOURCC ('w', 'i', 'd', 'e'):
- case GST_MAKE_FOURCC ('P', 'I', 'C', 'T'):
- case GST_MAKE_FOURCC ('p', 'n', 'o', 't'):
- break;
- case GST_MAKE_FOURCC ('m', 'o', 'o', 'v'):
- {
- GstBuffer *moov;
-
- do {
- ret = gst_bytestream_read (qtdemux->bs, &moov, length);
- if (ret < length) {
- GST_DEBUG ("read failed (%d < %d)", ret, length);
- if (!gst_qtdemux_handle_sink_event (qtdemux)) {
- return;
- }
- } else {
- break;
- }
- } while (1);
-
- qtdemux_parse_moov (qtdemux, GST_BUFFER_DATA (moov), length);
- if (1)
- qtdemux_node_dump (qtdemux, qtdemux->moov_node);
- qtdemux_parse_tree (qtdemux);
- qtdemux->state = QTDEMUX_STATE_MOVIE;
- break;
- }
- default:
- {
- GST_LOG ("unknown %08x '" GST_FOURCC_FORMAT "' at %d\n",
- fourcc, GST_FOURCC_ARGS (fourcc), cur_offset);
- break;
- }
+ case GST_MAKE_FOURCC ('m', 'd', 'a', 't'):
+ case GST_MAKE_FOURCC ('f', 'r', 'e', 'e'):
+ case GST_MAKE_FOURCC ('w', 'i', 'd', 'e'):
+ case GST_MAKE_FOURCC ('P', 'I', 'C', 'T'):
+ case GST_MAKE_FOURCC ('p', 'n', 'o', 't'):
+ break;
+ case GST_MAKE_FOURCC ('m', 'o', 'o', 'v'):
+ {
+ GstBuffer *moov;
+
+ do {
+ ret = gst_bytestream_read (qtdemux->bs, &moov, length);
+ if (ret < length) {
+ GST_DEBUG ("read failed (%d < %d)", ret, length);
+ if (!gst_qtdemux_handle_sink_event (qtdemux)) {
+ return;
+ }
+ } else {
+ break;
+ }
+ } while (1);
+
+ qtdemux_parse_moov (qtdemux, GST_BUFFER_DATA (moov), length);
+ if (1)
+ qtdemux_node_dump (qtdemux, qtdemux->moov_node);
+ qtdemux_parse_tree (qtdemux);
+ qtdemux->state = QTDEMUX_STATE_MOVIE;
+ break;
+ }
+ default:
+ {
+ GST_LOG ("unknown %08x '" GST_FOURCC_FORMAT "' at %d\n",
+ fourcc, GST_FOURCC_ARGS (fourcc), cur_offset);
+ break;
+ }
}
ret = gst_bytestream_seek (qtdemux->bs, cur_offset + length,
- GST_SEEK_METHOD_SET);
+ GST_SEEK_METHOD_SET);
qtdemux->offset = cur_offset + length;
GST_DEBUG ("seek returned %d\n", ret);
break;
guint8 *data;
do {
- ret = gst_bytestream_peek_bytes (qtdemux->bs, &data, 1);
- if (ret < 1) {
- if (!gst_qtdemux_handle_sink_event (qtdemux)) {
- return;
- }
- } else {
- break;
- }
+ ret = gst_bytestream_peek_bytes (qtdemux->bs, &data, 1);
+ if (ret < 1) {
+ if (!gst_qtdemux_handle_sink_event (qtdemux)) {
+ return;
+ }
+ } else {
+ break;
+ }
} while (TRUE);
gst_element_set_eos (element);
min_time = G_MAXUINT64;
for (i = 0; i < qtdemux->n_streams; i++) {
- stream = qtdemux->streams[i];
+ stream = qtdemux->streams[i];
- if (stream->sample_index < stream->n_samples &&
- stream->samples[stream->sample_index].timestamp < min_time) {
- min_time = stream->samples[stream->sample_index].timestamp;
- index = i;
- }
+ if (stream->sample_index < stream->n_samples &&
+ stream->samples[stream->sample_index].timestamp < min_time) {
+ min_time = stream->samples[stream->sample_index].timestamp;
+ index = i;
+ }
}
if (index == -1) {
- for (i = 0; i < qtdemux->n_streams; i++) {
- gst_pad_push (qtdemux->streams[i]->pad,
- GST_DATA (gst_event_new (GST_EVENT_EOS)));
- }
- ret = gst_bytestream_seek (qtdemux->bs, 0, GST_SEEK_METHOD_END);
- GST_DEBUG ("seek returned %d", ret);
-
- qtdemux->state = QTDEMUX_STATE_SEEKING_EOS;
- return;
+ for (i = 0; i < qtdemux->n_streams; i++) {
+ gst_pad_push (qtdemux->streams[i]->pad,
+ GST_DATA (gst_event_new (GST_EVENT_EOS)));
+ }
+ ret = gst_bytestream_seek (qtdemux->bs, 0, GST_SEEK_METHOD_END);
+ GST_DEBUG ("seek returned %d", ret);
+
+ qtdemux->state = QTDEMUX_STATE_SEEKING_EOS;
+ return;
}
stream = qtdemux->streams[index];
size = stream->samples[stream->sample_index].size;
GST_INFO
- ("pushing from stream %d, sample_index=%d offset=%d size=%d timestamp=%lld",
- index, stream->sample_index, offset, size,
- stream->samples[stream->sample_index].timestamp);
+ ("pushing from stream %d, sample_index=%d offset=%d size=%d timestamp=%lld",
+ index, stream->sample_index, offset, size,
+ stream->samples[stream->sample_index].timestamp);
cur_offset = gst_bytestream_tell (qtdemux->bs);
if (offset != cur_offset) {
- GST_DEBUG ("seeking to offset %d", offset);
- GST_LOG ("seeking to offset %d\n", offset);
- ret = gst_bytestream_seek (qtdemux->bs, offset, GST_SEEK_METHOD_SET);
- GST_DEBUG ("seek returned %d", ret);
- return;
+ GST_DEBUG ("seeking to offset %d", offset);
+ GST_LOG ("seeking to offset %d\n", offset);
+ ret = gst_bytestream_seek (qtdemux->bs, offset, GST_SEEK_METHOD_SET);
+ GST_DEBUG ("seek returned %d", ret);
+ return;
}
GST_DEBUG ("reading %d bytes\n", size);
buf = NULL;
do {
- ret = gst_bytestream_read (qtdemux->bs, &buf, size);
- if (ret < size) {
- GST_DEBUG ("read failed (%d < %d)", ret, size);
- if (!gst_qtdemux_handle_sink_event (qtdemux)) {
- return;
- }
- } else {
- break;
- }
+ ret = gst_bytestream_read (qtdemux->bs, &buf, size);
+ if (ret < size) {
+ GST_DEBUG ("read failed (%d < %d)", ret, size);
+ if (!gst_qtdemux_handle_sink_event (qtdemux)) {
+ return;
+ }
+ } else {
+ break;
+ }
} while (TRUE);
if (buf) {
- /* hum... */
- if (stream->subtype == GST_MAKE_FOURCC ('v', 'i', 'd', 'e')) {
- float fps =
- 1. * GST_SECOND / stream->samples[stream->sample_index].duration;
- if (fps != stream->fps) {
- gst_caps_set_simple (stream->caps, "framerate", G_TYPE_DOUBLE, fps,
- NULL);
- stream->fps = fps;
- gst_pad_set_explicit_caps (stream->pad, stream->caps);
- }
- }
-
- GST_BUFFER_TIMESTAMP (buf) =
- stream->samples[stream->sample_index].timestamp;
- GST_BUFFER_DURATION (buf) =
- stream->samples[stream->sample_index].duration;
- gst_pad_push (stream->pad, GST_DATA (buf));
-
- GST_DEBUG ("pushing buffer on %" GST_PTR_FORMAT, stream->pad);
+ /* hum... */
+ if (stream->subtype == GST_MAKE_FOURCC ('v', 'i', 'd', 'e')) {
+ float fps =
+ 1. * GST_SECOND / stream->samples[stream->sample_index].duration;
+ if (fps != stream->fps) {
+ gst_caps_set_simple (stream->caps, "framerate", G_TYPE_DOUBLE, fps,
+ NULL);
+ stream->fps = fps;
+ gst_pad_set_explicit_caps (stream->pad, stream->caps);
+ }
+ }
+
+ GST_BUFFER_TIMESTAMP (buf) =
+ stream->samples[stream->sample_index].timestamp;
+ GST_BUFFER_DURATION (buf) =
+ stream->samples[stream->sample_index].duration;
+ gst_pad_push (stream->pad, GST_DATA (buf));
+
+ GST_DEBUG ("pushing buffer on %" GST_PTR_FORMAT, stream->pad);
}
stream->sample_index++;
break;
gchar *name = g_strdup_printf ("video_%02d", qtdemux->n_video_streams);
stream->pad =
- gst_pad_new_from_template (gst_static_pad_template_get
- (&gst_qtdemux_videosrc_template), name);
+ gst_pad_new_from_template (gst_static_pad_template_get
+ (&gst_qtdemux_videosrc_template), name);
g_free (name);
stream->fps = 1. * GST_SECOND / stream->samples[0].duration;
if (stream->caps) {
gst_caps_set_simple (stream->caps,
- "width", G_TYPE_INT, stream->width,
- "height", G_TYPE_INT, stream->height,
- "framerate", G_TYPE_DOUBLE, stream->fps, NULL);
+ "width", G_TYPE_INT, stream->width,
+ "height", G_TYPE_INT, stream->height,
+ "framerate", G_TYPE_DOUBLE, stream->fps, NULL);
}
qtdemux->n_video_streams++;
} else {
gchar *name = g_strdup_printf ("audio_%02d", qtdemux->n_audio_streams);
stream->pad =
- gst_pad_new_from_template (gst_static_pad_template_get
- (&gst_qtdemux_audiosrc_template), name);
+ gst_pad_new_from_template (gst_static_pad_template_get
+ (&gst_qtdemux_audiosrc_template), name);
g_free (name);
if (stream->caps) {
gst_caps_set_simple (stream->caps,
- "rate", G_TYPE_INT, (int) stream->rate,
- "channels", G_TYPE_INT, stream->n_channels, NULL);
+ "rate", G_TYPE_INT, (int) stream->rate,
+ "channels", G_TYPE_INT, stream->n_channels, NULL);
}
qtdemux->n_audio_streams++;
}
qtdemux_dump_mvhd},
{FOURCC_clip, "clipping", QT_CONTAINER,},
{FOURCC_trak, "track", QT_CONTAINER,},
- {FOURCC_udta, "user data", 0,}, /* special container */
+ {FOURCC_udta, "user data", 0,}, /* special container */
{FOURCC_ctab, "color table", 0,},
{FOURCC_tkhd, "track header", 0,
qtdemux_dump_tkhd},
{FOURCC_load, "track load settings", 0,},
{FOURCC_tref, "track reference", QT_CONTAINER,},
{FOURCC_imap, "track input map", QT_CONTAINER,},
- {FOURCC___in, "track input", 0,}, /* special container */
+ {FOURCC___in, "track input", 0,}, /* special container */
{FOURCC___ty, "input type", 0,},
{FOURCC_mdia, "media", QT_CONTAINER},
{FOURCC_mdhd, "media header", 0,
cmvd = qtdemux_tree_get_child_by_type (cmov, FOURCC_cmvd);
if (QTDEMUX_FOURCC_GET (dcom->data + 8) == GST_MAKE_FOURCC ('z', 'l', 'i',
- 'b')) {
+ 'b')) {
int uncompressed_length;
int compressed_length;
void *buf;
GST_LOG ("length = %d\n", uncompressed_length);
buf = qtdemux_inflate (cmvd->data + 12, compressed_length,
- uncompressed_length);
+ uncompressed_length);
qtdemux->moov_node_compressed = qtdemux->moov_node;
qtdemux->moov_node = g_node_new (buf);
GNode *child;
if (buf + 8 >= end) {
- /* FIXME: get annoyed */
- GST_LOG ("buffer overrun\n");
+ /* FIXME: get annoyed */
+ GST_LOG ("buffer overrun\n");
}
len = QTDEMUX_GUINT32_GET (buf);
GST_LOG ("length = %d\n", uncompressed_length);
buf =
- qtdemux_inflate (buffer + 12, node_length - 12, uncompressed_length);
+ qtdemux_inflate (buffer + 12, node_length - 12, uncompressed_length);
end = buf + uncompressed_length;
while (buf < end) {
- GNode *child;
- guint32 len;
+ GNode *child;
+ guint32 len;
- if (buf + 8 >= end) {
- /* FIXME: get annoyed */
- GST_LOG ("buffer overrun\n");
- }
- len = QTDEMUX_GUINT32_GET (buf);
+ if (buf + 8 >= end) {
+ /* FIXME: get annoyed */
+ GST_LOG ("buffer overrun\n");
+ }
+ len = QTDEMUX_GUINT32_GET (buf);
- child = g_node_new (buf);
- g_node_append (node, child);
- qtdemux_parse (qtdemux, child, buf, len);
+ child = g_node_new (buf);
+ g_node_append (node, child);
+ qtdemux_parse (qtdemux, child, buf, len);
- buf += len;
+ buf += len;
}
}
#endif
n = QTDEMUX_GUINT32_GET (buffer + 12);
for (i = 0; i < n; i++) {
GST_LOG ("%*s track dur: %u\n", depth, "",
- QTDEMUX_GUINT32_GET (buffer + 16 + i * 12));
+ QTDEMUX_GUINT32_GET (buffer + 16 + i * 12));
GST_LOG ("%*s media time: %u\n", depth, "",
- QTDEMUX_GUINT32_GET (buffer + 20 + i * 12));
+ QTDEMUX_GUINT32_GET (buffer + 20 + i * 12));
GST_LOG ("%*s media rate: %g\n", depth, "",
- QTDEMUX_FP32_GET (buffer + 24 + i * 12));
+ QTDEMUX_FP32_GET (buffer + 24 + i * 12));
}
}
offset = 16;
for (i = 0; i < n; i++) {
GST_LOG ("%*s size: %u\n", depth, "",
- QTDEMUX_GUINT32_GET (buffer + offset));
+ QTDEMUX_GUINT32_GET (buffer + offset));
GST_LOG ("%*s type: " GST_FOURCC_FORMAT "\n", depth, "",
- GST_FOURCC_ARGS (QTDEMUX_FOURCC_GET (buffer + offset + 4)));
+ GST_FOURCC_ARGS (QTDEMUX_FOURCC_GET (buffer + offset + 4)));
offset += QTDEMUX_GUINT32_GET (buffer + offset);
}
}
offset = 16;
for (i = 0; i < n; i++) {
GST_LOG ("%*s size: %u\n", depth, "",
- QTDEMUX_GUINT32_GET (buffer + offset));
+ QTDEMUX_GUINT32_GET (buffer + offset));
GST_LOG ("%*s type: " GST_FOURCC_FORMAT "\n", depth, "",
- GST_FOURCC_ARGS (QTDEMUX_FOURCC_GET (buffer + offset + 4)));
+ GST_FOURCC_ARGS (QTDEMUX_FOURCC_GET (buffer + offset + 4)));
GST_LOG ("%*s data reference:%d\n", depth, "",
- QTDEMUX_GUINT16_GET (buffer + offset + 14));
+ QTDEMUX_GUINT16_GET (buffer + offset + 14));
GST_LOG ("%*s version/rev.: %08x\n", depth, "",
- QTDEMUX_GUINT32_GET (buffer + offset + 16));
+ QTDEMUX_GUINT32_GET (buffer + offset + 16));
GST_LOG ("%*s vendor: " GST_FOURCC_FORMAT "\n", depth, "",
- GST_FOURCC_ARGS (QTDEMUX_FOURCC_GET (buffer + offset + 20)));
+ GST_FOURCC_ARGS (QTDEMUX_FOURCC_GET (buffer + offset + 20)));
GST_LOG ("%*s temporal qual: %u\n", depth, "",
- QTDEMUX_GUINT32_GET (buffer + offset + 24));
+ QTDEMUX_GUINT32_GET (buffer + offset + 24));
GST_LOG ("%*s spatial qual: %u\n", depth, "",
- QTDEMUX_GUINT32_GET (buffer + offset + 28));
+ QTDEMUX_GUINT32_GET (buffer + offset + 28));
GST_LOG ("%*s width: %u\n", depth, "",
- QTDEMUX_GUINT16_GET (buffer + offset + 32));
+ QTDEMUX_GUINT16_GET (buffer + offset + 32));
GST_LOG ("%*s height: %u\n", depth, "",
- QTDEMUX_GUINT16_GET (buffer + offset + 34));
+ QTDEMUX_GUINT16_GET (buffer + offset + 34));
GST_LOG ("%*s horiz. resol: %g\n", depth, "",
- QTDEMUX_FP32_GET (buffer + offset + 36));
+ QTDEMUX_FP32_GET (buffer + offset + 36));
GST_LOG ("%*s vert. resol.: %g\n", depth, "",
- QTDEMUX_FP32_GET (buffer + offset + 40));
+ QTDEMUX_FP32_GET (buffer + offset + 40));
GST_LOG ("%*s data size: %u\n", depth, "",
- QTDEMUX_GUINT32_GET (buffer + offset + 44));
+ QTDEMUX_GUINT32_GET (buffer + offset + 44));
GST_LOG ("%*s frame count: %u\n", depth, "",
- QTDEMUX_GUINT16_GET (buffer + offset + 48));
+ QTDEMUX_GUINT16_GET (buffer + offset + 48));
GST_LOG ("%*s compressor: %*s\n", depth, "",
- QTDEMUX_GUINT8_GET (buffer + offset + 49),
- (char *) (buffer + offset + 51));
+ QTDEMUX_GUINT8_GET (buffer + offset + 49),
+ (char *) (buffer + offset + 51));
GST_LOG ("%*s depth: %u\n", depth, "",
- QTDEMUX_GUINT16_GET (buffer + offset + 82));
+ QTDEMUX_GUINT16_GET (buffer + offset + 82));
GST_LOG ("%*s color table ID:%u\n", depth, "",
- QTDEMUX_GUINT16_GET (buffer + offset + 84));
+ QTDEMUX_GUINT16_GET (buffer + offset + 84));
offset += QTDEMUX_GUINT32_GET (buffer + offset);
}
offset = 16;
for (i = 0; i < n; i++) {
GST_LOG ("%*s count: %u\n", depth, "",
- QTDEMUX_GUINT32_GET (buffer + offset));
+ QTDEMUX_GUINT32_GET (buffer + offset));
GST_LOG ("%*s duration: %u\n", depth, "",
- QTDEMUX_GUINT32_GET (buffer + offset + 4));
+ QTDEMUX_GUINT32_GET (buffer + offset + 4));
offset += 8;
}
offset = 16;
for (i = 0; i < n; i++) {
GST_LOG ("%*s sample: %u\n", depth, "",
- QTDEMUX_GUINT32_GET (buffer + offset));
+ QTDEMUX_GUINT32_GET (buffer + offset));
offset += 4;
}
offset = 16;
for (i = 0; i < n; i++) {
GST_LOG ("%*s first chunk: %u\n", depth, "",
- QTDEMUX_GUINT32_GET (buffer + offset));
+ QTDEMUX_GUINT32_GET (buffer + offset));
GST_LOG ("%*s sample per ch: %u\n", depth, "",
- QTDEMUX_GUINT32_GET (buffer + offset + 4));
+ QTDEMUX_GUINT32_GET (buffer + offset + 4));
GST_LOG ("%*s sample desc id:%08x\n", depth, "",
- QTDEMUX_GUINT32_GET (buffer + offset + 8));
+ QTDEMUX_GUINT32_GET (buffer + offset + 8));
offset += 12;
}
sample_size = QTDEMUX_GUINT32_GET (buffer + 12);
if (sample_size == 0) {
GST_LOG ("%*s n entries: %d\n", depth, "",
- QTDEMUX_GUINT32_GET (buffer + 16));
+ QTDEMUX_GUINT32_GET (buffer + 16));
n = QTDEMUX_GUINT32_GET (buffer + 16);
offset = 20;
for (i = 0; i < n; i++) {
GST_LOG ("%*s sample size: %u\n", depth, "",
- QTDEMUX_GUINT32_GET (buffer + offset));
+ QTDEMUX_GUINT32_GET (buffer + offset));
offset += 4;
}
offset = 16;
for (i = 0; i < n; i++) {
GST_LOG ("%*s chunk offset: %u\n", depth, "",
- QTDEMUX_GUINT32_GET (buffer + offset));
+ QTDEMUX_GUINT32_GET (buffer + offset));
offset += 4;
}
offset = 16;
for (i = 0; i < n; i++) {
GST_LOG ("%*s chunk offset: %" G_GUINT64_FORMAT "\n", depth, "",
- QTDEMUX_GUINT64_GET (buffer + offset));
+ QTDEMUX_GUINT64_GET (buffer + offset));
offset += 8;
}
if (stream->subtype == FOURCC_vide) {
offset = 16;
GST_LOG ("st type: " GST_FOURCC_FORMAT "\n",
- GST_FOURCC_ARGS (QTDEMUX_FOURCC_GET (stsd->data + offset + 4)));
+ GST_FOURCC_ARGS (QTDEMUX_FOURCC_GET (stsd->data + offset + 4)));
stream->width = QTDEMUX_GUINT16_GET (stsd->data + offset + 32);
stream->height = QTDEMUX_GUINT16_GET (stsd->data + offset + 34);
- stream->fps = 0.; /* this is filled in later */
+ stream->fps = 0.; /* this is filled in later */
GST_LOG ("frame count: %u\n",
- QTDEMUX_GUINT16_GET (stsd->data + offset + 48));
+ QTDEMUX_GUINT16_GET (stsd->data + offset + 48));
stream->caps = qtdemux_video_caps (qtdemux,
- QTDEMUX_FOURCC_GET (stsd->data + offset + 4), stsd->data);
+ QTDEMUX_FOURCC_GET (stsd->data + offset + 4), stsd->data);
GST_INFO ("type " GST_FOURCC_FORMAT " caps %" GST_PTR_FORMAT "\n",
- GST_FOURCC_ARGS (QTDEMUX_FOURCC_GET (stsd->data + offset + 4)),
- stream->caps);
+ GST_FOURCC_ARGS (QTDEMUX_FOURCC_GET (stsd->data + offset + 4)),
+ stream->caps);
} else if (stream->subtype == FOURCC_soun) {
int version, samplesize;
GST_LOG ("st type: " GST_FOURCC_FORMAT "\n",
- GST_FOURCC_ARGS (QTDEMUX_FOURCC_GET (stsd->data + 16 + 4)));
+ GST_FOURCC_ARGS (QTDEMUX_FOURCC_GET (stsd->data + 16 + 4)));
offset = 32;
GST_LOG ("version/rev: %08x\n",
- QTDEMUX_GUINT32_GET (stsd->data + offset));
+ QTDEMUX_GUINT32_GET (stsd->data + offset));
version = QTDEMUX_GUINT32_GET (stsd->data + offset);
GST_LOG ("vendor: %08x\n",
- QTDEMUX_GUINT32_GET (stsd->data + offset + 4));
+ QTDEMUX_GUINT32_GET (stsd->data + offset + 4));
GST_LOG ("n_channels: %d\n",
- QTDEMUX_GUINT16_GET (stsd->data + offset + 8));
+ QTDEMUX_GUINT16_GET (stsd->data + offset + 8));
stream->n_channels = QTDEMUX_GUINT16_GET (stsd->data + offset + 8);
GST_LOG ("sample_size: %d\n",
- QTDEMUX_GUINT16_GET (stsd->data + offset + 10));
+ QTDEMUX_GUINT16_GET (stsd->data + offset + 10));
samplesize = QTDEMUX_GUINT16_GET (stsd->data + offset + 10);
GST_LOG ("compression_id: %d\n",
- QTDEMUX_GUINT16_GET (stsd->data + offset + 12));
+ QTDEMUX_GUINT16_GET (stsd->data + offset + 12));
GST_LOG ("packet size: %d\n",
- QTDEMUX_GUINT16_GET (stsd->data + offset + 14));
+ QTDEMUX_GUINT16_GET (stsd->data + offset + 14));
GST_LOG ("sample rate: %g\n",
- QTDEMUX_FP32_GET (stsd->data + offset + 16));
+ QTDEMUX_FP32_GET (stsd->data + offset + 16));
stream->rate = QTDEMUX_FP32_GET (stsd->data + offset + 16);
offset = 52;
if (version == 0x00010000) {
GST_LOG ("samples/packet: %d\n",
- QTDEMUX_GUINT32_GET (stsd->data + offset));
+ QTDEMUX_GUINT32_GET (stsd->data + offset));
stream->samples_per_packet = QTDEMUX_GUINT32_GET (stsd->data + offset);
GST_LOG ("bytes/packet: %d\n",
- QTDEMUX_GUINT32_GET (stsd->data + offset + 4));
+ QTDEMUX_GUINT32_GET (stsd->data + offset + 4));
GST_LOG ("bytes/frame: %d\n",
- QTDEMUX_GUINT32_GET (stsd->data + offset + 8));
+ QTDEMUX_GUINT32_GET (stsd->data + offset + 8));
stream->bytes_per_frame = QTDEMUX_GUINT32_GET (stsd->data + offset + 8);
GST_LOG ("bytes/sample: %d\n",
- QTDEMUX_GUINT32_GET (stsd->data + offset + 12));
+ QTDEMUX_GUINT32_GET (stsd->data + offset + 12));
offset = 68;
} else {
stream->bytes_per_frame = stream->n_channels * samplesize / 8;
}
stream->caps = qtdemux_audio_caps (qtdemux,
- QTDEMUX_FOURCC_GET (stsd->data + 16 + 4),
- (QTDEMUX_GUINT32_GET (stsd->data) >
- offset) ? stsd->data + offset : NULL);
+ QTDEMUX_FOURCC_GET (stsd->data + 16 + 4),
+ (QTDEMUX_GUINT32_GET (stsd->data) >
+ offset) ? stsd->data + offset : NULL);
GST_INFO ("type " GST_FOURCC_FORMAT " caps %" GST_PTR_FORMAT "\n",
- GST_FOURCC_ARGS (QTDEMUX_FOURCC_GET (stsd->data + 16 + 4)),
- stream->caps);
+ GST_FOURCC_ARGS (QTDEMUX_FOURCC_GET (stsd->data + 16 + 4)),
+ stream->caps);
} else {
GST_LOG ("unknown subtype\n");
return;
first_chunk = QTDEMUX_GUINT32_GET (stsc->data + 16 + i * 12 + 0) - 1;
if (i == n_samples_per_chunk - 1) {
- last_chunk = INT_MAX;
+ last_chunk = INT_MAX;
} else {
- last_chunk = QTDEMUX_GUINT32_GET (stsc->data + 16 + i * 12 + 12) - 1;
+ last_chunk = QTDEMUX_GUINT32_GET (stsc->data + 16 + i * 12 + 12) - 1;
}
samples_per_chunk = QTDEMUX_GUINT32_GET (stsc->data + 16 + i * 12 + 4);
for (j = first_chunk; j < last_chunk; j++) {
- int chunk_offset;
-
- if (stco) {
- chunk_offset = QTDEMUX_GUINT32_GET (stco->data + 16 + j * 4);
- } else {
- chunk_offset = QTDEMUX_GUINT64_GET (co64->data + 16 + j * 8);
- }
- for (k = 0; k < samples_per_chunk; k++) {
- samples[index].chunk = j;
- samples[index].offset = chunk_offset;
- chunk_offset += samples[index].size;
- index++;
- if (index >= n_samples)
- goto done;
- }
+ int chunk_offset;
+
+ if (stco) {
+ chunk_offset = QTDEMUX_GUINT32_GET (stco->data + 16 + j * 4);
+ } else {
+ chunk_offset = QTDEMUX_GUINT64_GET (co64->data + 16 + j * 8);
+ }
+ for (k = 0; k < samples_per_chunk; k++) {
+ samples[index].chunk = j;
+ samples[index].offset = chunk_offset;
+ chunk_offset += samples[index].size;
+ index++;
+ if (index >= n_samples)
+ goto done;
+ }
}
}
done:
duration = QTDEMUX_GUINT32_GET (stts->data + 16 + 8 * i + 4);
time = (GST_SECOND * duration) / stream->timescale;
for (j = 0; j < n; j++) {
- //GST_INFO("moo %lld", timestamp);
- samples[index].timestamp = timestamp;
- samples[index].duration = time;
- timestamp += time;
- index++;
+ //GST_INFO("moo %lld", timestamp);
+ samples[index].timestamp = timestamp;
+ samples[index].duration = time;
+ timestamp += time;
+ index++;
}
}
} else {
first_chunk = QTDEMUX_GUINT32_GET (stsc->data + 16 + i * 12 + 0) - 1;
if (i == n_samples - 1) {
- last_chunk = INT_MAX;
+ last_chunk = INT_MAX;
} else {
- last_chunk = QTDEMUX_GUINT32_GET (stsc->data + 16 + i * 12 + 12) - 1;
+ last_chunk = QTDEMUX_GUINT32_GET (stsc->data + 16 + i * 12 + 12) - 1;
}
samples_per_chunk = QTDEMUX_GUINT32_GET (stsc->data + 16 + i * 12 + 4);
for (j = first_chunk; j < last_chunk; j++) {
- int chunk_offset;
-
- if (j >= n_samples)
- goto done2;
- if (stco) {
- chunk_offset = QTDEMUX_GUINT32_GET (stco->data + 16 + j * 4);
- } else {
- chunk_offset = QTDEMUX_GUINT64_GET (co64->data + 16 + j * 8);
- }
- samples[j].chunk = j;
- samples[j].offset = chunk_offset;
- samples[j].size =
- samples_per_chunk * stream->bytes_per_frame /
- stream->samples_per_packet;
- samples[j].duration =
- samples_per_chunk * GST_SECOND / (stream->rate / 2);
- samples[j].timestamp = timestamp;
- timestamp += (samples_per_chunk * GST_SECOND) / stream->rate;
+ int chunk_offset;
+
+ if (j >= n_samples)
+ goto done2;
+ if (stco) {
+ chunk_offset = QTDEMUX_GUINT32_GET (stco->data + 16 + j * 4);
+ } else {
+ chunk_offset = QTDEMUX_GUINT64_GET (co64->data + 16 + j * 8);
+ }
+ samples[j].chunk = j;
+ samples[j].offset = chunk_offset;
+ samples[j].size =
+ samples_per_chunk * stream->bytes_per_frame /
+ stream->samples_per_packet;
+ samples[j].duration =
+ samples_per_chunk * GST_SECOND / (stream->rate / 2);
+ samples[j].timestamp = timestamp;
+ timestamp += (samples_per_chunk * GST_SECOND) / stream->rate;
#if 0
- GST_INFO ("moo samples_per_chunk=%d rate=%d dur=%lld %lld",
- (int) samples_per_chunk,
- (int) stream->rate,
- (long long) ((samples_per_chunk * GST_SECOND) / stream->rate),
- (long long) timestamp);
+ GST_INFO ("moo samples_per_chunk=%d rate=%d dur=%lld %lld",
+ (int) samples_per_chunk,
+ (int) stream->rate,
+ (long long) ((samples_per_chunk * GST_SECOND) / stream->rate),
+ (long long) timestamp);
#endif
- samples[j].sample_index = sample_index;
- sample_index += samples_per_chunk;
+ samples[j].sample_index = sample_index;
+ sample_index += samples_per_chunk;
}
}
/*
#if 0
for (i = 0; i < n_samples; i++) {
GST_LOG ("%d: %d %d %d %d %" G_GUINT64_FORMAT "\n", i,
- samples[i].sample_index, samples[i].chunk,
- samples[i].offset, samples[i].size, samples[i].timestamp);
+ samples[i].sample_index, samples[i].chunk,
+ samples[i].offset, samples[i].size, samples[i].timestamp);
if (i > 10)
break;
}
return gst_caps_from_string ("image/jpeg");
case GST_MAKE_FOURCC ('S', 'V', 'Q', '3'):
if (stsd_data != NULL) {
- gst_getbits_t gb;
- gint halfpel_flag;
- gint thirdpel_flag;
- gint unknown_svq3_flag;
- gint low_delay;
- gint size;
+ gst_getbits_t gb;
+ gint halfpel_flag;
+ gint thirdpel_flag;
+ gint unknown_svq3_flag;
+ gint low_delay;
+ gint size;
- size = QTDEMUX_GUINT32_GET (stsd_data + 16);
+ size = QTDEMUX_GUINT32_GET (stsd_data + 16);
- gst_getbits_init (&gb, NULL, NULL);
- gst_getbits_newbuf (&gb, (unsigned char *) stsd_data + 98 + 16 + 4,
- (size - 102 + 16));
+ gst_getbits_init (&gb, NULL, NULL);
+ gst_getbits_newbuf (&gb, (unsigned char *) stsd_data + 98 + 16 + 4,
+ (size - 102 + 16));
- /* Infos ripped from ffmpeg see libavcodec/svq3.c */
+ /* Infos ripped from ffmpeg see libavcodec/svq3.c */
- /* 'frame size code' and optional 'width, height' */
- if (gst_getbitsn (&gb, 3) == 7) {
- gst_getbitsn (&gb, 12);
- gst_getbitsn (&gb, 12);
- }
+ /* 'frame size code' and optional 'width, height' */
+ if (gst_getbitsn (&gb, 3) == 7) {
+ gst_getbitsn (&gb, 12);
+ gst_getbitsn (&gb, 12);
+ }
- halfpel_flag = gst_get1bit (&gb);
- thirdpel_flag = gst_get1bit (&gb);
+ halfpel_flag = gst_get1bit (&gb);
+ thirdpel_flag = gst_get1bit (&gb);
- /* unknown fields */
- gst_get1bit (&gb);
- gst_get1bit (&gb);
- gst_get1bit (&gb);
- gst_get1bit (&gb);
+ /* unknown fields */
+ gst_get1bit (&gb);
+ gst_get1bit (&gb);
+ gst_get1bit (&gb);
+ gst_get1bit (&gb);
- low_delay = gst_get1bit (&gb);
+ low_delay = gst_get1bit (&gb);
- /* unknown field */
- gst_get1bit (&gb);
+ /* unknown field */
+ gst_get1bit (&gb);
- while (gst_get1bit (&gb)) {
- gst_getbitsn (&gb, 8);
- }
+ while (gst_get1bit (&gb)) {
+ gst_getbitsn (&gb, 8);
+ }
- unknown_svq3_flag = gst_get1bit (&gb);
+ unknown_svq3_flag = gst_get1bit (&gb);
- return gst_caps_new_simple ("video/x-svq",
- "svqversion", G_TYPE_INT, 3,
- "halfpel_flag", G_TYPE_INT, halfpel_flag,
- "thirdpel_flag", G_TYPE_INT, thirdpel_flag,
- "low_delay", G_TYPE_INT, low_delay,
- "unknown_svq3_flag", G_TYPE_INT, unknown_svq3_flag, NULL);
+ return gst_caps_new_simple ("video/x-svq",
+ "svqversion", G_TYPE_INT, 3,
+ "halfpel_flag", G_TYPE_INT, halfpel_flag,
+ "thirdpel_flag", G_TYPE_INT, thirdpel_flag,
+ "low_delay", G_TYPE_INT, low_delay,
+ "unknown_svq3_flag", G_TYPE_INT, unknown_svq3_flag, NULL);
}
return gst_caps_from_string ("video/x-svq, " "svqversion = (int) 3");
case GST_MAKE_FOURCC ('s', 'v', 'q', 'i'):
case GST_MAKE_FOURCC ('r', 'a', 'w', ' '):
/* uncompressed RGB */
return gst_caps_from_string ("video/x-raw-rgb, "
- "endianness = (int) BIG_ENDIAN");
+ "endianness = (int) BIG_ENDIAN");
/*"bpp", GST_PROPS_INT(x),
"depth", GST_PROPS_INT(x),
"red_mask", GST_PROPS_INT(x),
case GST_MAKE_FOURCC ('Y', 'u', 'v', '2'):
/* uncompressed YUV2 */
return gst_caps_from_string ("video/x-raw-yuv, "
- "format = (fourcc) YUY2");
+ "format = (fourcc) YUY2");
case GST_MAKE_FOURCC ('m', 'p', 'e', 'g'):
/* MPEG */
return gst_caps_from_string ("video/mpeg, "
- "systemstream = (boolean) false, " "mpegversion = (int) 1");
+ "systemstream = (boolean) false, " "mpegversion = (int) 1");
case GST_MAKE_FOURCC ('g', 'i', 'f', ' '):
return gst_caps_from_string ("image/gif");
case GST_MAKE_FOURCC ('h', '2', '6', '3'):
case GST_MAKE_FOURCC ('m', 'p', '4', 'v'):
/* MPEG-4 */
return gst_caps_from_string ("video/mpeg, "
- "mpegversion = (int) 4, " "systemstream = (boolean) false");
+ "mpegversion = (int) 4, " "systemstream = (boolean) false");
case GST_MAKE_FOURCC ('3', 'I', 'V', '1'):
return gst_caps_from_string ("video/x-3ivx");
case GST_MAKE_FOURCC ('c', 'v', 'i', 'd'):
case GST_MAKE_FOURCC ('k', 'p', 'c', 'd'):
default:
g_critical ("Don't know how to convert fourcc '" GST_FOURCC_FORMAT
- "' to caps\n", GST_FOURCC_ARGS (fourcc));
+ "' to caps\n", GST_FOURCC_ARGS (fourcc));
return NULL;
}
}
{
switch (fourcc) {
case GST_MAKE_FOURCC ('N', 'O', 'N', 'E'):
- return NULL; /*gst_caps_from_string ("audio/raw"); */
+ return NULL; /*gst_caps_from_string ("audio/raw"); */
case GST_MAKE_FOURCC ('r', 'a', 'w', ' '):
/* FIXME */
return gst_caps_from_string ("audio/x-raw-int, "
- "width = (int) 8, " "depth = (int) 8, " "signed = (boolean) true");
+ "width = (int) 8, " "depth = (int) 8, " "signed = (boolean) true");
case GST_MAKE_FOURCC ('t', 'w', 'o', 's'):
/* FIXME */
return gst_caps_from_string ("audio/x-raw-int, "
- "width = (int) 16, "
- "depth = (int) 16, "
- "endianness = (int) G_BIG_ENDIAN, " "signed = (boolean) true");
+ "width = (int) 16, "
+ "depth = (int) 16, "
+ "endianness = (int) G_BIG_ENDIAN, " "signed = (boolean) true");
case GST_MAKE_FOURCC ('s', 'o', 'w', 't'):
/* FIXME */
return gst_caps_from_string ("audio/x-raw-int, "
- "width = (int) 16, "
- "depth = (int) 16, "
- "endianness = (int) G_LITTLE_ENDIAN, " "signed = (boolean) true");
+ "width = (int) 16, "
+ "depth = (int) 16, "
+ "endianness = (int) G_LITTLE_ENDIAN, " "signed = (boolean) true");
case GST_MAKE_FOURCC ('f', 'l', '6', '4'):
return gst_caps_from_string ("audio/x-raw-float, "
- "width = (int) 64, " "endianness = (int) G_BIG_ENDIAN");
+ "width = (int) 64, " "endianness = (int) G_BIG_ENDIAN");
case GST_MAKE_FOURCC ('f', 'l', '3', '2'):
return gst_caps_from_string ("audio/x-raw-float, "
- "width = (int) 32, " "endianness = (int) G_BIG_ENDIAN");
+ "width = (int) 32, " "endianness = (int) G_BIG_ENDIAN");
case GST_MAKE_FOURCC ('i', 'n', '2', '4'):
/* FIXME */
return gst_caps_from_string ("audio/x-raw-int, "
- "width = (int) 24, "
- "depth = (int) 32, "
- "endianness = (int) G_BIG_ENDIAN, " "signed = (boolean) true");
+ "width = (int) 24, "
+ "depth = (int) 32, "
+ "endianness = (int) G_BIG_ENDIAN, " "signed = (boolean) true");
case GST_MAKE_FOURCC ('i', 'n', '3', '2'):
/* FIXME */
return gst_caps_from_string ("audio/x-raw-int, "
- "width = (int) 32, "
- "depth = (int) 32, "
- "endianness = (int) G_BIG_ENDIAN, " "signed = (boolean) true");
+ "width = (int) 32, "
+ "depth = (int) 32, "
+ "endianness = (int) G_BIG_ENDIAN, " "signed = (boolean) true");
case GST_MAKE_FOURCC ('u', 'l', 'a', 'w'):
/* FIXME */
return gst_caps_from_string ("audio/x-mulaw");
case 0x6d730002:
/* Microsoft ADPCM-ACM code 2 */
return gst_caps_from_string ("audio/x-adpcm, "
- "layout = (string) microsoft");
+ "layout = (string) microsoft");
case 0x6d730011:
/* FIXME DVI/Intel IMA ADPCM/ACM code 17 */
return gst_caps_from_string ("audio/x-adpcm, "
- "layout = (string) quicktime");
+ "layout = (string) quicktime");
case 0x6d730055:
/* MPEG layer 3, CBR only (pre QT4.1) */
case 0x5500736d:
case GST_MAKE_FOURCC ('.', 'm', 'p', '3'):
/* MPEG layer 3, CBR & VBR (QT4.1 and later) */
return gst_caps_from_string ("audio/mpeg, "
- "layer = (int) 3, " "mpegversion = (int) 1");
+ "layer = (int) 3, " "mpegversion = (int) 1");
case GST_MAKE_FOURCC ('M', 'A', 'C', '3'):
/* MACE 3:1 */
return gst_caps_from_string ("audio/x-mace, " "maceversion = (int) 3");
case GST_MAKE_FOURCC ('Q', 'D', 'M', '2'):
/* FIXME: QDesign music version 2 (no constant) */
if (QTDEMUX_GUINT32_GET (data) <= 100) {
- gst_util_dump_mem ((guint8 *) data, 100);
- return gst_caps_new_simple ("audio/x-qdm2",
- "framesize", G_TYPE_INT, QTDEMUX_GUINT32_GET (data + 52),
- "bitrate", G_TYPE_INT, QTDEMUX_GUINT32_GET (data + 40),
- "blocksize", G_TYPE_INT, QTDEMUX_GUINT32_GET (data + 44), NULL);
+ gst_util_dump_mem ((guint8 *) data, 100);
+ return gst_caps_new_simple ("audio/x-qdm2",
+ "framesize", G_TYPE_INT, QTDEMUX_GUINT32_GET (data + 52),
+ "bitrate", G_TYPE_INT, QTDEMUX_GUINT32_GET (data + 40),
+ "blocksize", G_TYPE_INT, QTDEMUX_GUINT32_GET (data + 44), NULL);
}
case GST_MAKE_FOURCC ('q', 't', 'v', 'r'):
/* ? */
/* ? */
default:
g_critical ("Don't know how to convert fourcc '" GST_FOURCC_FORMAT
- "' to caps\n", GST_FOURCC_ARGS (fourcc));
+ "' to caps\n", GST_FOURCC_ARGS (fourcc));
return NULL;
}
}
GST_PAD_SRC,
GST_PAD_ALWAYS,
GST_STATIC_CAPS ("audio/x-raw-int, "
- "endianness = (int) BYTE_ORDER, "
- "signed = (boolean) true, "
- "width = (int) 16, "
- "depth = (int) 16, "
- "rate = (int) [ 1000, 48000 ], " "channels = (int) [ 1, 2 ]")
+ "endianness = (int) BYTE_ORDER, "
+ "signed = (boolean) true, "
+ "width = (int) 16, "
+ "depth = (int) 16, "
+ "rate = (int) [ 1000, 48000 ], " "channels = (int) [ 1, 2 ]")
);
static GstStaticPadTemplate gst_rtpL16parse_sink_template =
};
rtpL16parse_type =
- g_type_register_static (GST_TYPE_ELEMENT, "GstRtpL16Parse",
- &rtpL16parse_info, 0);
+ g_type_register_static (GST_TYPE_ELEMENT, "GstRtpL16Parse",
+ &rtpL16parse_info, 0);
}
return rtpL16parse_type;
}
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_PAYLOAD_TYPE,
g_param_spec_int ("payload_type", "payload_type", "payload type",
- G_MININT, G_MAXINT, PAYLOAD_L16_STEREO, G_PARAM_READABLE));
+ G_MININT, G_MAXINT, PAYLOAD_L16_STEREO, G_PARAM_READABLE));
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_FREQUENCY,
g_param_spec_int ("frequency", "frequency", "frequency",
- G_MININT, G_MAXINT, 44100, G_PARAM_READWRITE));
+ G_MININT, G_MAXINT, 44100, G_PARAM_READWRITE));
gobject_class->set_property = gst_rtpL16parse_set_property;
gobject_class->get_property = gst_rtpL16parse_get_property;
caps =
gst_caps_copy (gst_static_caps_get (&gst_rtpL16parse_src_template.
- static_caps));
+ static_caps));
gst_caps_set_simple (caps,
"rate", G_TYPE_INT, rtpL16parse->frequency,
GST_PAD_SINK,
GST_PAD_ALWAYS,
GST_STATIC_CAPS ("audio/x-raw-int, "
- "endianness = (int) BYTE_ORDER, "
- "signed = (boolean) true, "
- "width = (int) 16, "
- "depth = (int) 16, "
- "rate = (int) [ 1000, 48000 ], " "channels = (int) [ 1, 2 ]")
+ "endianness = (int) BYTE_ORDER, "
+ "signed = (boolean) true, "
+ "width = (int) 16, "
+ "depth = (int) 16, "
+ "rate = (int) [ 1000, 48000 ], " "channels = (int) [ 1, 2 ]")
);
static GstStaticPadTemplate gst_rtpL16enc_src_template =
};
rtpL16enc_type =
- g_type_register_static (GST_TYPE_ELEMENT, "GstRtpL16Enc",
- &rtpL16enc_info, 0);
+ g_type_register_static (GST_TYPE_ELEMENT, "GstRtpL16Enc",
+ &rtpL16enc_info, 0);
}
return rtpL16enc_type;
}
switch (GST_EVENT_TYPE (event)) {
case GST_EVENT_DISCONTINUOUS:
- GST_DEBUG ("discont");
- rtpL16enc->next_time = 0;
- gst_pad_event_default (pad, event);
- return;
+ GST_DEBUG ("discont");
+ rtpL16enc->next_time = 0;
+ gst_pad_event_default (pad, event);
+ return;
default:
- gst_pad_event_default (pad, event);
- return;
+ gst_pad_event_default (pad, event);
+ return;
}
}
GST_PAD_SRC,
GST_PAD_ALWAYS,
GST_STATIC_CAPS ("audio/x-raw-int, "
- "endianness = (int) BYTE_ORDER, "
- "signed = (boolean) true, "
- "width = (int) 16, "
- "depth = (int) 16, "
- "rate = (int) [ 1000, 48000 ], " "channels = (int) [ 1, 2 ]")
+ "endianness = (int) BYTE_ORDER, "
+ "signed = (boolean) true, "
+ "width = (int) 16, "
+ "depth = (int) 16, "
+ "rate = (int) [ 1000, 48000 ], " "channels = (int) [ 1, 2 ]")
);
static GstStaticPadTemplate gst_rtpL16parse_sink_template =
};
rtpL16parse_type =
- g_type_register_static (GST_TYPE_ELEMENT, "GstRtpL16Parse",
- &rtpL16parse_info, 0);
+ g_type_register_static (GST_TYPE_ELEMENT, "GstRtpL16Parse",
+ &rtpL16parse_info, 0);
}
return rtpL16parse_type;
}
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_PAYLOAD_TYPE,
g_param_spec_int ("payload_type", "payload_type", "payload type",
- G_MININT, G_MAXINT, PAYLOAD_L16_STEREO, G_PARAM_READABLE));
+ G_MININT, G_MAXINT, PAYLOAD_L16_STEREO, G_PARAM_READABLE));
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_FREQUENCY,
g_param_spec_int ("frequency", "frequency", "frequency",
- G_MININT, G_MAXINT, 44100, G_PARAM_READWRITE));
+ G_MININT, G_MAXINT, 44100, G_PARAM_READWRITE));
gobject_class->set_property = gst_rtpL16parse_set_property;
gobject_class->get_property = gst_rtpL16parse_get_property;
caps =
gst_caps_copy (gst_static_caps_get (&gst_rtpL16parse_src_template.
- static_caps));
+ static_caps));
gst_caps_set_simple (caps,
"rate", G_TYPE_INT, rtpL16parse->frequency,
GST_PAD_SINK,
GST_PAD_ALWAYS,
GST_STATIC_CAPS ("audio/x-raw-int, "
- "endianness = (int) BYTE_ORDER, "
- "signed = (boolean) true, "
- "width = (int) 16, "
- "depth = (int) 16, "
- "rate = (int) [ 1000, 48000 ], " "channels = (int) [ 1, 2 ]")
+ "endianness = (int) BYTE_ORDER, "
+ "signed = (boolean) true, "
+ "width = (int) 16, "
+ "depth = (int) 16, "
+ "rate = (int) [ 1000, 48000 ], " "channels = (int) [ 1, 2 ]")
);
static GstStaticPadTemplate gst_rtpL16enc_src_template =
};
rtpL16enc_type =
- g_type_register_static (GST_TYPE_ELEMENT, "GstRtpL16Enc",
- &rtpL16enc_info, 0);
+ g_type_register_static (GST_TYPE_ELEMENT, "GstRtpL16Enc",
+ &rtpL16enc_info, 0);
}
return rtpL16enc_type;
}
switch (GST_EVENT_TYPE (event)) {
case GST_EVENT_DISCONTINUOUS:
- GST_DEBUG ("discont");
- rtpL16enc->next_time = 0;
- gst_pad_event_default (pad, event);
- return;
+ GST_DEBUG ("discont");
+ rtpL16enc->next_time = 0;
+ gst_pad_event_default (pad, event);
+ return;
default:
- gst_pad_event_default (pad, event);
- return;
+ gst_pad_event_default (pad, event);
+ return;
}
}
};
rtpgsmparse_type =
- g_type_register_static (GST_TYPE_ELEMENT, "GstRtpGSMParse",
- &rtpgsmparse_info, 0);
+ g_type_register_static (GST_TYPE_ELEMENT, "GstRtpGSMParse",
+ &rtpgsmparse_info, 0);
}
return rtpgsmparse_type;
}
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_FREQUENCY,
g_param_spec_int ("frequency", "frequency", "frequency",
- G_MININT, G_MAXINT, 8000, G_PARAM_READWRITE));
+ G_MININT, G_MAXINT, 8000, G_PARAM_READWRITE));
gobject_class->set_property = gst_rtpgsmparse_set_property;
gobject_class->get_property = gst_rtpgsmparse_get_property;
};
rtpgsmenc_type =
- g_type_register_static (GST_TYPE_ELEMENT, "GstRtpGSMEnc",
- &rtpgsmenc_info, 0);
+ g_type_register_static (GST_TYPE_ELEMENT, "GstRtpGSMEnc",
+ &rtpgsmenc_info, 0);
}
return rtpgsmenc_type;
}
switch (GST_EVENT_TYPE (event)) {
case GST_EVENT_DISCONTINUOUS:
- GST_DEBUG ("discont");
- rtpgsmenc->next_time = 0;
- gst_pad_event_default (pad, event);
- return;
+ GST_DEBUG ("discont");
+ rtpgsmenc->next_time = 0;
+ gst_pad_event_default (pad, event);
+ return;
default:
- gst_pad_event_default (pad, event);
- return;
+ gst_pad_event_default (pad, event);
+ return;
}
}
};
rtpgsmparse_type =
- g_type_register_static (GST_TYPE_ELEMENT, "GstRtpGSMParse",
- &rtpgsmparse_info, 0);
+ g_type_register_static (GST_TYPE_ELEMENT, "GstRtpGSMParse",
+ &rtpgsmparse_info, 0);
}
return rtpgsmparse_type;
}
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_FREQUENCY,
g_param_spec_int ("frequency", "frequency", "frequency",
- G_MININT, G_MAXINT, 8000, G_PARAM_READWRITE));
+ G_MININT, G_MAXINT, 8000, G_PARAM_READWRITE));
gobject_class->set_property = gst_rtpgsmparse_set_property;
gobject_class->get_property = gst_rtpgsmparse_get_property;
};
rtpgsmenc_type =
- g_type_register_static (GST_TYPE_ELEMENT, "GstRtpGSMEnc",
- &rtpgsmenc_info, 0);
+ g_type_register_static (GST_TYPE_ELEMENT, "GstRtpGSMEnc",
+ &rtpgsmenc_info, 0);
}
return rtpgsmenc_type;
}
switch (GST_EVENT_TYPE (event)) {
case GST_EVENT_DISCONTINUOUS:
- GST_DEBUG ("discont");
- rtpgsmenc->next_time = 0;
- gst_pad_event_default (pad, event);
- return;
+ GST_DEBUG ("discont");
+ rtpgsmenc->next_time = 0;
+ gst_pad_event_default (pad, event);
+ return;
default:
- gst_pad_event_default (pad, event);
- return;
+ gst_pad_event_default (pad, event);
+ return;
}
}
0,
(GInstanceInitFunc) gst_smoothwave_init,
};
+
smoothwave_type =
- g_type_register_static (GST_TYPE_ELEMENT, "GstSmoothWave",
- &smoothwave_info, 0);
+ g_type_register_static (GST_TYPE_ELEMENT, "GstSmoothWave",
+ &smoothwave_info, 0);
}
return smoothwave_type;
}
parent_class = g_type_class_ref (GST_TYPE_ELEMENT);
- g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_WIDTH, g_param_spec_int ("width", "width", "width", G_MININT, G_MAXINT, 0, G_PARAM_READWRITE)); /* CHECKME */
- g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_HEIGHT, g_param_spec_int ("height", "height", "height", G_MININT, G_MAXINT, 0, G_PARAM_READWRITE)); /* CHECKME */
- g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_WIDGET, g_param_spec_object ("widget", "widget", "widget", GTK_TYPE_WIDGET, G_PARAM_READABLE)); /* CHECKME! */
+ g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_WIDTH, g_param_spec_int ("width", "width", "width", G_MININT, G_MAXINT, 0, G_PARAM_READWRITE)); /* CHECKME */
+ g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_HEIGHT, g_param_spec_int ("height", "height", "height", G_MININT, G_MAXINT, 0, G_PARAM_READWRITE)); /* CHECKME */
+ g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_WIDGET, g_param_spec_object ("widget", "widget", "widget", GTK_TYPE_WIDGET, G_PARAM_READABLE)); /* CHECKME! */
gobject_class->set_property = gst_smoothwave_set_property;
gobject_class->get_property = gst_smoothwave_get_property;
for (i = 0; i < MAX (smoothwave->width, samplecount); i++) {
gint16 y1 = (gint32) (samples[i * 2] * qheight) / 32768 + qheight;
gint16 y2 = (gint32) (samples[(i * 2) + 1] * qheight) / 32768 +
- (qheight * 3);
+ (qheight * 3);
smoothwave->imagebuffer[y1 * smoothwave->width + i] = 0xff;
smoothwave->imagebuffer[y2 * smoothwave->width + i] = 0xff;
/* smoothwave->imagebuffer[i+(smoothwave->width*5)] = i; */
case ARG_WIDTH:
smoothwave->width = g_value_get_int (value);
gtk_drawing_area_size (GTK_DRAWING_AREA (smoothwave->image),
- smoothwave->width, smoothwave->height);
+ smoothwave->width, smoothwave->height);
gtk_widget_set_usize (GTK_WIDGET (smoothwave->image),
- smoothwave->width, smoothwave->height);
+ smoothwave->width, smoothwave->height);
break;
case ARG_HEIGHT:
smoothwave->height = g_value_get_int (value);
gtk_drawing_area_size (GTK_DRAWING_AREA (smoothwave->image),
- smoothwave->width, smoothwave->height);
+ smoothwave->width, smoothwave->height);
gtk_widget_set_usize (GTK_WIDGET (smoothwave->image),
- smoothwave->width, smoothwave->height);
+ smoothwave->width, smoothwave->height);
break;
default:
break;
plugin_init (GstPlugin * plugin)
{
if (!gst_element_register (plugin, "smoothwave", GST_RANK_NONE,
- GST_TYPE_SMOOTHWAVE))
+ GST_TYPE_SMOOTHWAVE))
return FALSE;
return TRUE;
static gint box_clock_4b[][4 * 10] = {
#define WIPE_B4_201 0
{BOX_CLOCK, 1, 1, 0, 1, 0, 0, 2, 1, 1,
- BOX_CLOCK, 1, 1, 0, 2, 1, 1, 1, 2, 2,
- BOX_CLOCK, 1, 1, 0, 1, 2, 2, 0, 1, 3,
+ BOX_CLOCK, 1, 1, 0, 2, 1, 1, 1, 2, 2,
+ BOX_CLOCK, 1, 1, 0, 1, 2, 2, 0, 1, 3,
BOX_CLOCK, 1, 1, 0, 0, 1, 3, 1, 0, 4},
#define WIPE_B4_202 1
{BOX_CLOCK, 1, 1, 0, 1, 0, 3, 2, 1, 4,
- BOX_CLOCK, 1, 1, 0, 2, 1, 0, 1, 2, 1,
- BOX_CLOCK, 1, 1, 0, 1, 2, 1, 0, 1, 2,
+ BOX_CLOCK, 1, 1, 0, 2, 1, 0, 1, 2, 1,
+ BOX_CLOCK, 1, 1, 0, 1, 2, 1, 0, 1, 2,
BOX_CLOCK, 1, 1, 0, 0, 1, 2, 1, 0, 3},
#define WIPE_B4_203 2
{BOX_CLOCK, 1, 1, 0, 1, 0, 2, 2, 1, 3,
- BOX_CLOCK, 1, 1, 0, 2, 1, 3, 1, 2, 4,
- BOX_CLOCK, 1, 1, 0, 1, 2, 0, 0, 1, 1,
+ BOX_CLOCK, 1, 1, 0, 2, 1, 3, 1, 2, 4,
+ BOX_CLOCK, 1, 1, 0, 1, 2, 0, 0, 1, 1,
BOX_CLOCK, 1, 1, 0, 0, 1, 1, 1, 0, 2},
#define WIPE_B4_204 3
{BOX_CLOCK, 1, 1, 0, 1, 0, 1, 2, 1, 2,
- BOX_CLOCK, 1, 1, 0, 2, 1, 2, 1, 2, 3,
- BOX_CLOCK, 1, 1, 0, 1, 2, 3, 0, 1, 4,
+ BOX_CLOCK, 1, 1, 0, 2, 1, 2, 1, 2, 3,
+ BOX_CLOCK, 1, 1, 0, 1, 2, 3, 0, 1, 4,
BOX_CLOCK, 1, 1, 0, 0, 1, 0, 1, 0, 1},
#define WIPE_B4_205 4
{BOX_CLOCK, 1, 1, 0, 1, 0, 0, 2, 1, 1,
- BOX_CLOCK, 1, 1, 0, 2, 1, 1, 1, 2, 2,
- BOX_CLOCK, 1, 1, 0, 1, 2, 0, 0, 1, 1,
+ BOX_CLOCK, 1, 1, 0, 2, 1, 1, 1, 2, 2,
+ BOX_CLOCK, 1, 1, 0, 1, 2, 0, 0, 1, 1,
BOX_CLOCK, 1, 1, 0, 0, 1, 1, 1, 0, 2},
#define WIPE_B4_206 5
{BOX_CLOCK, 1, 1, 0, 1, 0, 1, 2, 1, 2,
- BOX_CLOCK, 1, 1, 0, 2, 1, 0, 1, 2, 1,
- BOX_CLOCK, 1, 1, 0, 1, 2, 1, 0, 1, 2,
+ BOX_CLOCK, 1, 1, 0, 2, 1, 0, 1, 2, 1,
+ BOX_CLOCK, 1, 1, 0, 1, 2, 1, 0, 1, 2,
BOX_CLOCK, 1, 1, 0, 0, 1, 0, 1, 0, 1},
#define WIPE_B4_207 6
{BOX_CLOCK, 1, 1, 0, 1, 0, 0, 2, 1, 1,
- BOX_CLOCK, 1, 1, 0, 2, 1, 0, 1, 2, 1,
- BOX_CLOCK, 1, 1, 0, 1, 2, 0, 0, 1, 1,
+ BOX_CLOCK, 1, 1, 0, 2, 1, 0, 1, 2, 1,
+ BOX_CLOCK, 1, 1, 0, 1, 2, 0, 0, 1, 1,
BOX_CLOCK, 1, 1, 0, 0, 1, 0, 1, 0, 1},
#define WIPE_B4_211 7
{BOX_CLOCK, 1, 1, 0, 1, 0, 0, 2, 1, 1,
- BOX_CLOCK, 1, 1, 0, 2, 1, 1, 1, 2, 2,
- BOX_CLOCK, 1, 1, 0, 1, 0, 0, 0, 1, 1,
+ BOX_CLOCK, 1, 1, 0, 2, 1, 1, 1, 2, 2,
+ BOX_CLOCK, 1, 1, 0, 1, 0, 0, 0, 1, 1,
BOX_CLOCK, 1, 1, 0, 0, 1, 1, 1, 2, 2},
#define WIPE_B4_212 8
{BOX_CLOCK, 1, 1, 0, 2, 1, 0, 1, 0, 1,
- BOX_CLOCK, 1, 1, 0, 1, 0, 1, 0, 1, 2,
- BOX_CLOCK, 1, 1, 0, 2, 1, 0, 1, 2, 1,
+ BOX_CLOCK, 1, 1, 0, 1, 0, 1, 0, 1, 2,
+ BOX_CLOCK, 1, 1, 0, 2, 1, 0, 1, 2, 1,
BOX_CLOCK, 1, 1, 0, 1, 2, 1, 0, 1, 2},
#define WIPE_B4_213 9
{BOX_CLOCK, 1, 1, 0, 1, 0, 0, 2, 1, 1,
- BOX_CLOCK, 1, 1, 0, 1, 0, 0, 0, 1, 1,
- BOX_CLOCK, 1, 1, 0, 1, 2, 0, 2, 1, 1,
+ BOX_CLOCK, 1, 1, 0, 1, 0, 0, 0, 1, 1,
+ BOX_CLOCK, 1, 1, 0, 1, 2, 0, 2, 1, 1,
BOX_CLOCK, 1, 1, 0, 1, 2, 0, 0, 1, 1},
#define WIPE_B4_214 10
{BOX_CLOCK, 1, 1, 0, 2, 1, 0, 1, 0, 1,
- BOX_CLOCK, 1, 1, 0, 2, 1, 0, 1, 2, 1,
- BOX_CLOCK, 1, 1, 0, 0, 1, 0, 1, 0, 1,
+ BOX_CLOCK, 1, 1, 0, 2, 1, 0, 1, 2, 1,
+ BOX_CLOCK, 1, 1, 0, 0, 1, 0, 1, 0, 1,
BOX_CLOCK, 1, 1, 0, 0, 1, 0, 1, 2, 1},
#define WIPE_B4_227 11
{BOX_CLOCK, 1, 0, 0, 2, 0, 0, 1, 1, 1,
- BOX_CLOCK, 1, 0, 0, 1, 1, 1, 0, 0, 2,
- BOX_CLOCK, 1, 2, 0, 2, 2, 0, 1, 1, 1,
+ BOX_CLOCK, 1, 0, 0, 1, 1, 1, 0, 0, 2,
+ BOX_CLOCK, 1, 2, 0, 2, 2, 0, 1, 1, 1,
BOX_CLOCK, 1, 2, 0, 1, 1, 1, 0, 2, 2},
#define WIPE_B4_228 12
{BOX_CLOCK, 0, 1, 0, 0, 0, 0, 1, 1, 1,
- BOX_CLOCK, 0, 1, 0, 1, 1, 1, 0, 2, 2,
- BOX_CLOCK, 2, 1, 0, 2, 0, 0, 1, 1, 1,
+ BOX_CLOCK, 0, 1, 0, 1, 1, 1, 0, 2, 2,
+ BOX_CLOCK, 2, 1, 0, 2, 0, 0, 1, 1, 1,
BOX_CLOCK, 2, 1, 0, 1, 1, 1, 2, 2, 2},
#define WIPE_B4_235 13
{BOX_CLOCK, 1, 0, 0, 1, 1, 0, 0, 0, 1,
- BOX_CLOCK, 1, 0, 0, 1, 1, 0, 2, 0, 1,
- BOX_CLOCK, 1, 2, 0, 1, 1, 0, 2, 2, 1,
+ BOX_CLOCK, 1, 0, 0, 1, 1, 0, 2, 0, 1,
+ BOX_CLOCK, 1, 2, 0, 1, 1, 0, 2, 2, 1,
BOX_CLOCK, 1, 2, 0, 1, 1, 0, 0, 2, 1},
#define WIPE_B4_236 14
{BOX_CLOCK, 0, 1, 0, 1, 1, 0, 0, 0, 1,
- BOX_CLOCK, 0, 1, 0, 1, 1, 0, 0, 2, 1,
- BOX_CLOCK, 2, 1, 0, 1, 1, 0, 2, 0, 1,
+ BOX_CLOCK, 0, 1, 0, 1, 1, 0, 0, 2, 1,
+ BOX_CLOCK, 2, 1, 0, 1, 1, 0, 2, 0, 1,
BOX_CLOCK, 2, 1, 0, 1, 1, 0, 2, 2, 1},
};
static gint box_clock_8b[][8 * 10] = {
#define WIPE_B8_261 0
{BOX_CLOCK, 2, 1, 0, 2, 2, 0, 4, 1, 1,
- BOX_CLOCK, 2, 1, 0, 4, 1, 1, 2, 0, 2,
- BOX_CLOCK, 2, 1, 0, 2, 0, 2, 0, 1, 3,
- BOX_CLOCK, 2, 1, 0, 0, 1, 3, 2, 2, 4,
- BOX_CLOCK, 2, 3, 0, 2, 2, 0, 4, 3, 1,
- BOX_CLOCK, 2, 3, 0, 4, 3, 1, 2, 4, 2,
- BOX_CLOCK, 2, 3, 0, 2, 4, 2, 0, 3, 3,
+ BOX_CLOCK, 2, 1, 0, 4, 1, 1, 2, 0, 2,
+ BOX_CLOCK, 2, 1, 0, 2, 0, 2, 0, 1, 3,
+ BOX_CLOCK, 2, 1, 0, 0, 1, 3, 2, 2, 4,
+ BOX_CLOCK, 2, 3, 0, 2, 2, 0, 4, 3, 1,
+ BOX_CLOCK, 2, 3, 0, 4, 3, 1, 2, 4, 2,
+ BOX_CLOCK, 2, 3, 0, 2, 4, 2, 0, 3, 3,
BOX_CLOCK, 2, 3, 0, 0, 3, 3, 2, 2, 4},
#define WIPE_B8_262 1
{BOX_CLOCK, 1, 2, 0, 2, 2, 0, 1, 0, 1,
- BOX_CLOCK, 1, 2, 0, 1, 0, 1, 0, 2, 2,
- BOX_CLOCK, 1, 2, 0, 0, 2, 2, 1, 4, 3,
- BOX_CLOCK, 1, 2, 0, 1, 4, 3, 2, 2, 4,
- BOX_CLOCK, 3, 2, 0, 2, 2, 0, 3, 0, 1,
- BOX_CLOCK, 3, 2, 0, 3, 0, 1, 4, 2, 2,
- BOX_CLOCK, 3, 2, 0, 4, 2, 2, 3, 4, 3,
+ BOX_CLOCK, 1, 2, 0, 1, 0, 1, 0, 2, 2,
+ BOX_CLOCK, 1, 2, 0, 0, 2, 2, 1, 4, 3,
+ BOX_CLOCK, 1, 2, 0, 1, 4, 3, 2, 2, 4,
+ BOX_CLOCK, 3, 2, 0, 2, 2, 0, 3, 0, 1,
+ BOX_CLOCK, 3, 2, 0, 3, 0, 1, 4, 2, 2,
+ BOX_CLOCK, 3, 2, 0, 4, 2, 2, 3, 4, 3,
BOX_CLOCK, 3, 2, 0, 3, 4, 3, 2, 2, 4},
#define WIPE_B8_263 2
{BOX_CLOCK, 2, 1, 0, 2, 0, 0, 4, 1, 1,
- BOX_CLOCK, 2, 1, 0, 4, 1, 1, 2, 2, 2,
- BOX_CLOCK, 2, 1, 0, 2, 0, 0, 0, 1, 1,
- BOX_CLOCK, 2, 1, 0, 0, 1, 1, 2, 2, 2,
- BOX_CLOCK, 2, 3, 0, 2, 4, 0, 4, 3, 1,
- BOX_CLOCK, 2, 3, 0, 4, 3, 1, 2, 2, 2,
- BOX_CLOCK, 2, 3, 0, 2, 4, 0, 0, 3, 1,
+ BOX_CLOCK, 2, 1, 0, 4, 1, 1, 2, 2, 2,
+ BOX_CLOCK, 2, 1, 0, 2, 0, 0, 0, 1, 1,
+ BOX_CLOCK, 2, 1, 0, 0, 1, 1, 2, 2, 2,
+ BOX_CLOCK, 2, 3, 0, 2, 4, 0, 4, 3, 1,
+ BOX_CLOCK, 2, 3, 0, 4, 3, 1, 2, 2, 2,
+ BOX_CLOCK, 2, 3, 0, 2, 4, 0, 0, 3, 1,
BOX_CLOCK, 2, 3, 0, 0, 3, 1, 2, 2, 2},
#define WIPE_B8_264 3
{BOX_CLOCK, 1, 2, 0, 0, 2, 0, 1, 0, 1,
- BOX_CLOCK, 1, 2, 0, 1, 0, 1, 2, 2, 2,
- BOX_CLOCK, 1, 2, 0, 0, 2, 0, 1, 4, 1,
- BOX_CLOCK, 1, 2, 0, 1, 4, 1, 2, 2, 2,
- BOX_CLOCK, 3, 2, 0, 4, 2, 0, 3, 0, 1,
- BOX_CLOCK, 3, 2, 0, 3, 0, 1, 2, 2, 2,
- BOX_CLOCK, 3, 2, 0, 4, 2, 0, 3, 4, 1,
+ BOX_CLOCK, 1, 2, 0, 1, 0, 1, 2, 2, 2,
+ BOX_CLOCK, 1, 2, 0, 0, 2, 0, 1, 4, 1,
+ BOX_CLOCK, 1, 2, 0, 1, 4, 1, 2, 2, 2,
+ BOX_CLOCK, 3, 2, 0, 4, 2, 0, 3, 0, 1,
+ BOX_CLOCK, 3, 2, 0, 3, 0, 1, 2, 2, 2,
+ BOX_CLOCK, 3, 2, 0, 4, 2, 0, 3, 4, 1,
BOX_CLOCK, 3, 2, 0, 3, 4, 1, 2, 2, 2},
};
/* 23 -> 26 */
#define WIPE_T3_23 0
{0, 0, 1, 1, 0, 0, 0, 2, 1,
- 1, 0, 0, 0, 2, 1, 2, 2, 1,
+ 1, 0, 0, 0, 2, 1, 2, 2, 1,
1, 0, 0, 2, 0, 1, 2, 2, 1},
#define WIPE_T3_24 1
{0, 0, 1, 2, 0, 1, 2, 1, 0,
- 0, 0, 1, 2, 1, 0, 0, 2, 1,
+ 0, 0, 1, 2, 1, 0, 0, 2, 1,
2, 1, 0, 0, 2, 1, 2, 2, 1},
#define WIPE_T3_25 2
{0, 0, 1, 0, 2, 1, 1, 2, 0,
- 0, 0, 1, 2, 0, 1, 1, 2, 0,
+ 0, 0, 1, 2, 0, 1, 1, 2, 0,
2, 0, 1, 1, 2, 0, 2, 2, 1},
#define WIPE_T3_26 3
{0, 0, 1, 2, 0, 1, 0, 1, 0,
- 2, 0, 1, 0, 1, 0, 2, 2, 1,
+ 2, 0, 1, 0, 1, 0, 2, 2, 1,
0, 1, 0, 0, 2, 1, 2, 2, 1},
};
static gint triangles_4t[][4 * 9] = {
#define WIPE_T4_61 0
{0, 0, 1, 1, 0, 0, 1, 2, 1,
- 0, 0, 1, 0, 2, 2, 1, 2, 1,
- 1, 0, 0, 2, 0, 1, 1, 2, 1,
+ 0, 0, 1, 0, 2, 2, 1, 2, 1,
+ 1, 0, 0, 2, 0, 1, 1, 2, 1,
2, 0, 1, 1, 2, 1, 2, 2, 2},
#define WIPE_T4_62 1
{0, 0, 2, 2, 0, 1, 0, 1, 1,
- 2, 0, 1, 0, 1, 1, 2, 1, 0,
- 0, 1, 1, 2, 1, 0, 2, 2, 1,
+ 2, 0, 1, 0, 1, 1, 2, 1, 0,
+ 0, 1, 1, 2, 1, 0, 2, 2, 1,
0, 1, 1, 0, 2, 2, 2, 2, 1},
#define WIPE_T4_63 2
{0, 0, 2, 1, 0, 1, 0, 2, 1,
- 1, 0, 1, 0, 2, 1, 1, 2, 0,
- 1, 0, 1, 1, 2, 0, 2, 2, 1,
+ 1, 0, 1, 0, 2, 1, 1, 2, 0,
+ 1, 0, 1, 1, 2, 0, 2, 2, 1,
1, 0, 1, 2, 0, 2, 2, 2, 1},
#define WIPE_T4_64 3
{0, 0, 1, 2, 0, 2, 2, 1, 1,
- 0, 0, 1, 0, 1, 0, 2, 1, 1,
- 0, 1, 0, 2, 1, 1, 0, 2, 1,
+ 0, 0, 1, 0, 1, 0, 2, 1, 1,
+ 0, 1, 0, 2, 1, 1, 0, 2, 1,
2, 1, 1, 0, 2, 1, 2, 2, 2},
#define WIPE_T4_65 4
{0, 0, 0, 1, 0, 1, 1, 2, 0,
- 0, 0, 0, 0, 2, 1, 1, 2, 0,
- 1, 0, 1, 2, 0, 0, 1, 2, 0,
+ 0, 0, 0, 0, 2, 1, 1, 2, 0,
+ 1, 0, 1, 2, 0, 0, 1, 2, 0,
2, 0, 0, 1, 2, 0, 2, 2, 1},
#define WIPE_T4_66 5
{0, 0, 1, 2, 0, 0, 0, 1, 0,
- 2, 0, 0, 0, 1, 0, 2, 1, 1,
- 0, 1, 0, 2, 1, 1, 2, 2, 0,
+ 2, 0, 0, 0, 1, 0, 2, 1, 1,
+ 0, 1, 0, 2, 1, 1, 2, 2, 0,
0, 1, 0, 0, 2, 1, 2, 2, 0},
#define WIPE_T4_67 6
{0, 0, 1, 1, 0, 0, 0, 2, 0,
- 1, 0, 0, 0, 2, 0, 1, 2, 1,
- 1, 0, 0, 1, 2, 1, 2, 2, 0,
+ 1, 0, 0, 0, 2, 0, 1, 2, 1,
+ 1, 0, 0, 1, 2, 1, 2, 2, 0,
1, 0, 0, 2, 0, 1, 2, 2, 0},
#define WIPE_T4_68 7
{0, 0, 0, 2, 0, 1, 2, 1, 0,
- 0, 0, 0, 0, 1, 1, 2, 1, 0,
- 0, 1, 1, 2, 1, 0, 0, 2, 0,
+ 0, 0, 0, 0, 1, 1, 2, 1, 0,
+ 0, 1, 1, 2, 1, 0, 0, 2, 0,
2, 1, 0, 0, 2, 0, 2, 2, 1},
#define WIPE_T4_101 8
{0, 0, 1, 2, 0, 1, 1, 1, 0,
- 0, 0, 1, 1, 1, 0, 0, 2, 1,
- 1, 1, 0, 0, 2, 1, 2, 2, 1,
+ 0, 0, 1, 1, 1, 0, 0, 2, 1,
+ 1, 1, 0, 0, 2, 1, 2, 2, 1,
2, 0, 1, 1, 1, 0, 2, 2, 1},
};
/* 7 */
#define WIPE_T8_7 0
{0, 0, 0, 1, 0, 1, 1, 1, 1,
- 1, 0, 1, 2, 0, 0, 1, 1, 1,
- 2, 0, 0, 1, 1, 1, 2, 1, 1,
- 1, 1, 1, 2, 1, 1, 2, 2, 0,
- 1, 1, 1, 1, 2, 1, 2, 2, 0,
- 1, 1, 1, 0, 2, 0, 1, 2, 1,
- 0, 1, 1, 1, 1, 1, 0, 2, 0,
+ 1, 0, 1, 2, 0, 0, 1, 1, 1,
+ 2, 0, 0, 1, 1, 1, 2, 1, 1,
+ 1, 1, 1, 2, 1, 1, 2, 2, 0,
+ 1, 1, 1, 1, 2, 1, 2, 2, 0,
+ 1, 1, 1, 0, 2, 0, 1, 2, 1,
+ 0, 1, 1, 1, 1, 1, 0, 2, 0,
0, 0, 0, 0, 1, 1, 1, 1, 1},
#define WIPE_T8_43 1
{0, 0, 1, 1, 0, 0, 1, 1, 1,
- 1, 0, 0, 2, 0, 1, 1, 1, 1,
- 2, 0, 1, 1, 1, 1, 2, 1, 2,
- 1, 1, 1, 2, 1, 2, 2, 2, 1,
- 1, 1, 1, 1, 2, 0, 2, 2, 1,
- 1, 1, 1, 0, 2, 1, 1, 2, 0,
- 0, 1, 2, 1, 1, 1, 0, 2, 1,
+ 1, 0, 0, 2, 0, 1, 1, 1, 1,
+ 2, 0, 1, 1, 1, 1, 2, 1, 2,
+ 1, 1, 1, 2, 1, 2, 2, 2, 1,
+ 1, 1, 1, 1, 2, 0, 2, 2, 1,
+ 1, 1, 1, 0, 2, 1, 1, 2, 0,
+ 0, 1, 2, 1, 1, 1, 0, 2, 1,
0, 0, 1, 0, 1, 2, 1, 1, 1},
#define WIPE_T8_44 2
{0, 0, 1, 1, 0, 2, 1, 1, 1,
- 1, 0, 2, 2, 0, 1, 1, 1, 1,
- 2, 0, 1, 1, 1, 1, 2, 1, 0,
- 1, 1, 1, 2, 1, 0, 2, 2, 1,
- 1, 1, 1, 1, 2, 2, 2, 2, 1,
- 1, 1, 1, 0, 2, 1, 1, 2, 2,
- 0, 1, 0, 1, 1, 1, 0, 2, 1,
+ 1, 0, 2, 2, 0, 1, 1, 1, 1,
+ 2, 0, 1, 1, 1, 1, 2, 1, 0,
+ 1, 1, 1, 2, 1, 0, 2, 2, 1,
+ 1, 1, 1, 1, 2, 2, 2, 2, 1,
+ 1, 1, 1, 0, 2, 1, 1, 2, 2,
+ 0, 1, 0, 1, 1, 1, 0, 2, 1,
0, 0, 1, 0, 1, 0, 1, 1, 1},
#define WIPE_T8_47 3
{0, 0, 0, 1, 0, 1, 1, 1, 0,
- 1, 0, 1, 2, 0, 0, 1, 1, 0,
- 2, 0, 0, 1, 1, 0, 2, 1, 1,
- 1, 1, 0, 2, 1, 1, 2, 2, 0,
- 1, 1, 0, 1, 2, 1, 2, 2, 0,
- 1, 1, 0, 0, 2, 0, 1, 2, 1,
- 0, 1, 1, 1, 1, 0, 0, 2, 0,
+ 1, 0, 1, 2, 0, 0, 1, 1, 0,
+ 2, 0, 0, 1, 1, 0, 2, 1, 1,
+ 1, 1, 0, 2, 1, 1, 2, 2, 0,
+ 1, 1, 0, 1, 2, 1, 2, 2, 0,
+ 1, 1, 0, 0, 2, 0, 1, 2, 1,
+ 0, 1, 1, 1, 1, 0, 0, 2, 0,
0, 0, 0, 0, 1, 1, 1, 1, 0},
#define WIPE_T8_48 4
{0, 0, 1, 1, 0, 0, 0, 1, 0,
- 1, 0, 0, 0, 1, 0, 1, 1, 1,
- 1, 0, 0, 2, 0, 1, 2, 1, 0,
- 1, 0, 0, 1, 1, 1, 2, 1, 0,
- 0, 1, 0, 1, 1, 1, 1, 2, 0,
- 0, 1, 0, 0, 2, 1, 1, 2, 0,
- 1, 1, 1, 2, 1, 0, 1, 2, 0,
+ 1, 0, 0, 0, 1, 0, 1, 1, 1,
+ 1, 0, 0, 2, 0, 1, 2, 1, 0,
+ 1, 0, 0, 1, 1, 1, 2, 1, 0,
+ 0, 1, 0, 1, 1, 1, 1, 2, 0,
+ 0, 1, 0, 0, 2, 1, 1, 2, 0,
+ 1, 1, 1, 2, 1, 0, 1, 2, 0,
2, 1, 0, 1, 2, 0, 2, 2, 1},
};
/* 8 */
#define WIPE_T16_8 0
{0, 0, 1, 2, 0, 1, 1, 1, 0,
- 2, 0, 1, 1, 1, 0, 2, 2, 1,
- 1, 1, 0, 0, 2, 1, 2, 2, 1,
- 0, 0, 1, 1, 1, 0, 0, 2, 1,
- 2, 0, 1, 4, 0, 1, 3, 1, 0,
- 4, 0, 1, 3, 1, 0, 4, 2, 1,
- 3, 1, 0, 2, 2, 1, 4, 2, 1,
- 2, 0, 1, 3, 1, 0, 2, 2, 1,
- 0, 2, 1, 2, 2, 1, 1, 3, 0,
- 2, 2, 1, 1, 3, 0, 2, 4, 1,
- 1, 3, 0, 0, 4, 1, 2, 4, 1,
- 0, 2, 1, 1, 3, 0, 0, 4, 1,
- 2, 2, 1, 4, 2, 1, 3, 3, 0,
- 4, 2, 1, 3, 3, 0, 4, 4, 1,
- 3, 3, 0, 2, 4, 1, 4, 4, 1,
+ 2, 0, 1, 1, 1, 0, 2, 2, 1,
+ 1, 1, 0, 0, 2, 1, 2, 2, 1,
+ 0, 0, 1, 1, 1, 0, 0, 2, 1,
+ 2, 0, 1, 4, 0, 1, 3, 1, 0,
+ 4, 0, 1, 3, 1, 0, 4, 2, 1,
+ 3, 1, 0, 2, 2, 1, 4, 2, 1,
+ 2, 0, 1, 3, 1, 0, 2, 2, 1,
+ 0, 2, 1, 2, 2, 1, 1, 3, 0,
+ 2, 2, 1, 1, 3, 0, 2, 4, 1,
+ 1, 3, 0, 0, 4, 1, 2, 4, 1,
+ 0, 2, 1, 1, 3, 0, 0, 4, 1,
+ 2, 2, 1, 4, 2, 1, 3, 3, 0,
+ 4, 2, 1, 3, 3, 0, 4, 4, 1,
+ 3, 3, 0, 2, 4, 1, 4, 4, 1,
2, 2, 1, 3, 3, 0, 2, 4, 1}
};
static GstWipeConfig wipe_config[] = {
#define WIPE_CONFIG_1 0
- {boxes_1b[WIPE_B1_1], 1, 0, 0, 0}, /* 1 */
+ {boxes_1b[WIPE_B1_1], 1, 0, 0, 0}, /* 1 */
#define WIPE_CONFIG_2 WIPE_CONFIG_1+1
- {boxes_1b[WIPE_B1_2], 1, 0, 0, 0}, /* 2 */
+ {boxes_1b[WIPE_B1_2], 1, 0, 0, 0}, /* 2 */
#define WIPE_CONFIG_3 WIPE_CONFIG_2+1
- {triangles_2t[WIPE_T2_3], 2, 0, 0, 0}, /* 3 */
+ {triangles_2t[WIPE_T2_3], 2, 0, 0, 0}, /* 3 */
#define WIPE_CONFIG_4 WIPE_CONFIG_3+1
- {triangles_2t[WIPE_T2_4], 2, 0, 0, 0}, /* 4 */
+ {triangles_2t[WIPE_T2_4], 2, 0, 0, 0}, /* 4 */
#define WIPE_CONFIG_5 WIPE_CONFIG_4+1
- {triangles_2t[WIPE_T2_5], 2, 0, 0, 0}, /* 5 */
+ {triangles_2t[WIPE_T2_5], 2, 0, 0, 0}, /* 5 */
#define WIPE_CONFIG_6 WIPE_CONFIG_5+1
- {triangles_2t[WIPE_T2_6], 2, 0, 0, 0}, /* 6 */
+ {triangles_2t[WIPE_T2_6], 2, 0, 0, 0}, /* 6 */
#define WIPE_CONFIG_7 WIPE_CONFIG_6+1
- {triangles_8t[WIPE_T8_7], 8, 1, 1, 0}, /* 7 */
+ {triangles_8t[WIPE_T8_7], 8, 1, 1, 0}, /* 7 */
#define WIPE_CONFIG_8 WIPE_CONFIG_7+1
- {triangles_16t[WIPE_T16_8], 16, 2, 2, 0}, /* 8 */
+ {triangles_16t[WIPE_T16_8], 16, 2, 2, 0}, /* 8 */
#define WIPE_CONFIG_21 WIPE_CONFIG_8+1
- {boxes_2b[WIPE_B2_21], 2, 1, 1, 0}, /* 21 */
+ {boxes_2b[WIPE_B2_21], 2, 1, 1, 0}, /* 21 */
#define WIPE_CONFIG_22 WIPE_CONFIG_21+1
- {boxes_2b[WIPE_B2_22], 2, 1, 1, 0}, /* 22 */
+ {boxes_2b[WIPE_B2_22], 2, 1, 1, 0}, /* 22 */
#define WIPE_CONFIG_23 WIPE_CONFIG_22+1
- {triangles_3t[WIPE_T3_23], 3, 1, 1, 0}, /* 23 */
+ {triangles_3t[WIPE_T3_23], 3, 1, 1, 0}, /* 23 */
#define WIPE_CONFIG_24 WIPE_CONFIG_23+1
- {triangles_3t[WIPE_T3_24], 3, 1, 1, 0}, /* 24 */
+ {triangles_3t[WIPE_T3_24], 3, 1, 1, 0}, /* 24 */
#define WIPE_CONFIG_25 WIPE_CONFIG_24+1
- {triangles_3t[WIPE_T3_23], 3, 1, 1, 0}, /* 25 */
+ {triangles_3t[WIPE_T3_23], 3, 1, 1, 0}, /* 25 */
#define WIPE_CONFIG_26 WIPE_CONFIG_25+1
- {triangles_3t[WIPE_T3_26], 3, 1, 1, 0}, /* 26 */
+ {triangles_3t[WIPE_T3_26], 3, 1, 1, 0}, /* 26 */
#define WIPE_CONFIG_41 WIPE_CONFIG_26+1
- {triangles_2t[WIPE_T2_41], 2, 0, 0, 1}, /* 41 */
+ {triangles_2t[WIPE_T2_41], 2, 0, 0, 1}, /* 41 */
#define WIPE_CONFIG_42 WIPE_CONFIG_41+1
- {triangles_2t[WIPE_T2_42], 2, 0, 0, 1}, /* 42 */
+ {triangles_2t[WIPE_T2_42], 2, 0, 0, 1}, /* 42 */
#define WIPE_CONFIG_43 WIPE_CONFIG_42+1
- {triangles_8t[WIPE_T8_43], 8, 1, 1, 1}, /* 43 */
+ {triangles_8t[WIPE_T8_43], 8, 1, 1, 1}, /* 43 */
#define WIPE_CONFIG_44 WIPE_CONFIG_43+1
- {triangles_8t[WIPE_T8_44], 8, 1, 1, 1}, /* 44 */
+ {triangles_8t[WIPE_T8_44], 8, 1, 1, 1}, /* 44 */
#define WIPE_CONFIG_45 WIPE_CONFIG_44+1
- {triangles_2t[WIPE_T2_45], 2, 0, 0, 0}, /* 45 */
+ {triangles_2t[WIPE_T2_45], 2, 0, 0, 0}, /* 45 */
#define WIPE_CONFIG_46 WIPE_CONFIG_45+1
- {triangles_2t[WIPE_T2_46], 2, 0, 0, 0}, /* 46 */
+ {triangles_2t[WIPE_T2_46], 2, 0, 0, 0}, /* 46 */
#define WIPE_CONFIG_47 WIPE_CONFIG_46+1
- {triangles_8t[WIPE_T8_47], 8, 1, 1, 0}, /* 47 */
+ {triangles_8t[WIPE_T8_47], 8, 1, 1, 0}, /* 47 */
#define WIPE_CONFIG_48 WIPE_CONFIG_47+1
- {triangles_8t[WIPE_T8_48], 8, 1, 1, 0}, /* 48 */
+ {triangles_8t[WIPE_T8_48], 8, 1, 1, 0}, /* 48 */
#define WIPE_CONFIG_61 WIPE_CONFIG_48+1
- {triangles_4t[WIPE_T4_61], 4, 1, 1, 1}, /* 61 */
+ {triangles_4t[WIPE_T4_61], 4, 1, 1, 1}, /* 61 */
#define WIPE_CONFIG_62 WIPE_CONFIG_61+1
- {triangles_4t[WIPE_T4_62], 4, 1, 1, 1}, /* 62 */
+ {triangles_4t[WIPE_T4_62], 4, 1, 1, 1}, /* 62 */
#define WIPE_CONFIG_63 WIPE_CONFIG_62+1
- {triangles_4t[WIPE_T4_63], 4, 1, 1, 1}, /* 63 */
+ {triangles_4t[WIPE_T4_63], 4, 1, 1, 1}, /* 63 */
#define WIPE_CONFIG_64 WIPE_CONFIG_63+1
- {triangles_4t[WIPE_T4_64], 4, 1, 1, 1}, /* 64 */
+ {triangles_4t[WIPE_T4_64], 4, 1, 1, 1}, /* 64 */
#define WIPE_CONFIG_65 WIPE_CONFIG_64+1
- {triangles_4t[WIPE_T4_65], 4, 1, 1, 0}, /* 65 */
+ {triangles_4t[WIPE_T4_65], 4, 1, 1, 0}, /* 65 */
#define WIPE_CONFIG_66 WIPE_CONFIG_65+1
- {triangles_4t[WIPE_T4_66], 4, 1, 1, 0}, /* 66 */
+ {triangles_4t[WIPE_T4_66], 4, 1, 1, 0}, /* 66 */
#define WIPE_CONFIG_67 WIPE_CONFIG_66+1
- {triangles_4t[WIPE_T4_67], 4, 1, 1, 0}, /* 67 */
+ {triangles_4t[WIPE_T4_67], 4, 1, 1, 0}, /* 67 */
#define WIPE_CONFIG_68 WIPE_CONFIG_67+1
- {triangles_4t[WIPE_T4_68], 4, 1, 1, 0}, /* 68 */
+ {triangles_4t[WIPE_T4_68], 4, 1, 1, 0}, /* 68 */
#define WIPE_CONFIG_101 WIPE_CONFIG_68+1
- {triangles_4t[WIPE_T4_101], 4, 1, 1, 0}, /* 101 */
+ {triangles_4t[WIPE_T4_101], 4, 1, 1, 0}, /* 101 */
#define WIPE_CONFIG_201 WIPE_CONFIG_101+1
- {box_clock_4b[WIPE_B4_201], 4, 1, 1, 2}, /* 201 */
+ {box_clock_4b[WIPE_B4_201], 4, 1, 1, 2}, /* 201 */
#define WIPE_CONFIG_202 WIPE_CONFIG_201+1
- {box_clock_4b[WIPE_B4_202], 4, 1, 1, 2}, /* 202 */
+ {box_clock_4b[WIPE_B4_202], 4, 1, 1, 2}, /* 202 */
#define WIPE_CONFIG_203 WIPE_CONFIG_202+1
- {box_clock_4b[WIPE_B4_203], 4, 1, 1, 2}, /* 203 */
+ {box_clock_4b[WIPE_B4_203], 4, 1, 1, 2}, /* 203 */
#define WIPE_CONFIG_204 WIPE_CONFIG_203+1
- {box_clock_4b[WIPE_B4_204], 4, 1, 1, 2}, /* 204 */
+ {box_clock_4b[WIPE_B4_204], 4, 1, 1, 2}, /* 204 */
#define WIPE_CONFIG_205 WIPE_CONFIG_204+1
- {box_clock_4b[WIPE_B4_205], 4, 1, 1, 1}, /* 205 */
+ {box_clock_4b[WIPE_B4_205], 4, 1, 1, 1}, /* 205 */
#define WIPE_CONFIG_206 WIPE_CONFIG_205+1
- {box_clock_4b[WIPE_B4_206], 4, 1, 1, 1}, /* 206 */
+ {box_clock_4b[WIPE_B4_206], 4, 1, 1, 1}, /* 206 */
#define WIPE_CONFIG_207 WIPE_CONFIG_206+1
- {box_clock_4b[WIPE_B4_207], 4, 1, 1, 0}, /* 207 */
+ {box_clock_4b[WIPE_B4_207], 4, 1, 1, 0}, /* 207 */
#define WIPE_CONFIG_211 WIPE_CONFIG_207+1
- {box_clock_4b[WIPE_B4_211], 4, 1, 1, 1}, /* 211 */
+ {box_clock_4b[WIPE_B4_211], 4, 1, 1, 1}, /* 211 */
#define WIPE_CONFIG_212 WIPE_CONFIG_211+1
- {box_clock_4b[WIPE_B4_212], 4, 1, 1, 1}, /* 212 */
+ {box_clock_4b[WIPE_B4_212], 4, 1, 1, 1}, /* 212 */
#define WIPE_CONFIG_213 WIPE_CONFIG_212+1
- {box_clock_4b[WIPE_B4_213], 4, 1, 1, 0}, /* 213 */
+ {box_clock_4b[WIPE_B4_213], 4, 1, 1, 0}, /* 213 */
#define WIPE_CONFIG_214 WIPE_CONFIG_213+1
- {box_clock_4b[WIPE_B4_214], 4, 1, 1, 0}, /* 214 */
+ {box_clock_4b[WIPE_B4_214], 4, 1, 1, 0}, /* 214 */
#define WIPE_CONFIG_221 WIPE_CONFIG_214+1
- {box_clock_2b[WIPE_B2_221], 2, 1, 1, 1}, /* 221 */
+ {box_clock_2b[WIPE_B2_221], 2, 1, 1, 1}, /* 221 */
#define WIPE_CONFIG_222 WIPE_CONFIG_221+1
- {box_clock_2b[WIPE_B2_222], 2, 1, 1, 1}, /* 222 */
+ {box_clock_2b[WIPE_B2_222], 2, 1, 1, 1}, /* 222 */
#define WIPE_CONFIG_223 WIPE_CONFIG_222+1
- {box_clock_2b[WIPE_B2_223], 2, 1, 1, 1}, /* 223 */
+ {box_clock_2b[WIPE_B2_223], 2, 1, 1, 1}, /* 223 */
#define WIPE_CONFIG_224 WIPE_CONFIG_223+1
- {box_clock_2b[WIPE_B2_224], 2, 1, 1, 1}, /* 224 */
+ {box_clock_2b[WIPE_B2_224], 2, 1, 1, 1}, /* 224 */
#define WIPE_CONFIG_225 WIPE_CONFIG_224+1
- {box_clock_2b[WIPE_B2_225], 2, 1, 1, 0}, /* 225 */
+ {box_clock_2b[WIPE_B2_225], 2, 1, 1, 0}, /* 225 */
#define WIPE_CONFIG_226 WIPE_CONFIG_225+1
- {box_clock_2b[WIPE_B2_226], 2, 1, 1, 0}, /* 226 */
+ {box_clock_2b[WIPE_B2_226], 2, 1, 1, 0}, /* 226 */
#define WIPE_CONFIG_227 WIPE_CONFIG_226+1
- {box_clock_4b[WIPE_B4_227], 4, 1, 1, 1}, /* 227 */
+ {box_clock_4b[WIPE_B4_227], 4, 1, 1, 1}, /* 227 */
#define WIPE_CONFIG_228 WIPE_CONFIG_227+1
- {box_clock_4b[WIPE_B4_228], 4, 1, 1, 1}, /* 228 */
+ {box_clock_4b[WIPE_B4_228], 4, 1, 1, 1}, /* 228 */
#define WIPE_CONFIG_231 WIPE_CONFIG_228+1
- {box_clock_2b[WIPE_B2_231], 2, 1, 1, 0}, /* 231 */
+ {box_clock_2b[WIPE_B2_231], 2, 1, 1, 0}, /* 231 */
#define WIPE_CONFIG_232 WIPE_CONFIG_231+1
- {box_clock_2b[WIPE_B2_232], 2, 1, 1, 0}, /* 232 */
+ {box_clock_2b[WIPE_B2_232], 2, 1, 1, 0}, /* 232 */
#define WIPE_CONFIG_233 WIPE_CONFIG_232+1
- {box_clock_2b[WIPE_B2_233], 2, 1, 1, 0}, /* 233 */
+ {box_clock_2b[WIPE_B2_233], 2, 1, 1, 0}, /* 233 */
#define WIPE_CONFIG_234 WIPE_CONFIG_233+1
- {box_clock_2b[WIPE_B2_234], 2, 1, 1, 0}, /* 234 */
+ {box_clock_2b[WIPE_B2_234], 2, 1, 1, 0}, /* 234 */
#define WIPE_CONFIG_235 WIPE_CONFIG_234+1
- {box_clock_4b[WIPE_B4_235], 4, 1, 1, 0}, /* 235 */
+ {box_clock_4b[WIPE_B4_235], 4, 1, 1, 0}, /* 235 */
#define WIPE_CONFIG_236 WIPE_CONFIG_235+1
- {box_clock_4b[WIPE_B4_236], 4, 1, 1, 0}, /* 236 */
+ {box_clock_4b[WIPE_B4_236], 4, 1, 1, 0}, /* 236 */
#define WIPE_CONFIG_241 WIPE_CONFIG_236+1
- {box_clock_1b[WIPE_B1_241], 1, 0, 0, 0}, /* 241 */
+ {box_clock_1b[WIPE_B1_241], 1, 0, 0, 0}, /* 241 */
#define WIPE_CONFIG_242 WIPE_CONFIG_241+1
- {box_clock_1b[WIPE_B1_242], 1, 0, 0, 0}, /* 242 */
+ {box_clock_1b[WIPE_B1_242], 1, 0, 0, 0}, /* 242 */
#define WIPE_CONFIG_243 WIPE_CONFIG_242+1
- {box_clock_1b[WIPE_B1_243], 1, 0, 0, 0}, /* 243 */
+ {box_clock_1b[WIPE_B1_243], 1, 0, 0, 0}, /* 243 */
#define WIPE_CONFIG_244 WIPE_CONFIG_243+1
- {box_clock_1b[WIPE_B1_244], 1, 0, 0, 0}, /* 244 */
+ {box_clock_1b[WIPE_B1_244], 1, 0, 0, 0}, /* 244 */
#define WIPE_CONFIG_245 WIPE_CONFIG_244+1
- {triangles_2t[WIPE_T2_245], 2, 1, 1, 0}, /* 245 */
+ {triangles_2t[WIPE_T2_245], 2, 1, 1, 0}, /* 245 */
#define WIPE_CONFIG_246 WIPE_CONFIG_245+1
- {triangles_2t[WIPE_T2_246], 2, 1, 1, 0}, /* 246 */
+ {triangles_2t[WIPE_T2_246], 2, 1, 1, 0}, /* 246 */
#define WIPE_CONFIG_251 WIPE_CONFIG_246+1
- {box_clock_2b[WIPE_B2_251], 2, 1, 1, 0}, /* 251 */
+ {box_clock_2b[WIPE_B2_251], 2, 1, 1, 0}, /* 251 */
#define WIPE_CONFIG_252 WIPE_CONFIG_251+1
- {box_clock_2b[WIPE_B2_252], 2, 1, 1, 0}, /* 252 */
+ {box_clock_2b[WIPE_B2_252], 2, 1, 1, 0}, /* 252 */
#define WIPE_CONFIG_253 WIPE_CONFIG_252+1
- {box_clock_2b[WIPE_B2_253], 2, 1, 1, 0}, /* 253 */
+ {box_clock_2b[WIPE_B2_253], 2, 1, 1, 0}, /* 253 */
#define WIPE_CONFIG_254 WIPE_CONFIG_253+1
- {box_clock_2b[WIPE_B2_254], 2, 1, 1, 0}, /* 254 */
+ {box_clock_2b[WIPE_B2_254], 2, 1, 1, 0}, /* 254 */
#define WIPE_CONFIG_261 WIPE_CONFIG_254+1
- {box_clock_8b[WIPE_B8_261], 8, 2, 2, 2}, /* 261 */
+ {box_clock_8b[WIPE_B8_261], 8, 2, 2, 2}, /* 261 */
#define WIPE_CONFIG_262 WIPE_CONFIG_261+1
- {box_clock_8b[WIPE_B8_262], 8, 2, 2, 2}, /* 262 */
+ {box_clock_8b[WIPE_B8_262], 8, 2, 2, 2}, /* 262 */
#define WIPE_CONFIG_263 WIPE_CONFIG_262+1
- {box_clock_8b[WIPE_B8_263], 8, 2, 2, 1}, /* 263 */
+ {box_clock_8b[WIPE_B8_263], 8, 2, 2, 1}, /* 263 */
#define WIPE_CONFIG_264 WIPE_CONFIG_263+1
- {box_clock_8b[WIPE_B8_264], 8, 2, 2, 1}, /* 264 */
+ {box_clock_8b[WIPE_B8_264], 8, 2, 2, 1}, /* 264 */
};
static void
for (i = 0; i < config->nobjects; i++) {
switch (impacts[0]) {
case BOX_VERTICAL:
- gst_smpte_paint_vbox (mask->data, mask->width,
- impacts[1] * width, impacts[2] * height, impacts[3] * depth,
- impacts[4] * width, impacts[5] * height, impacts[6] * depth);
- impacts += 7;
- break;
+ gst_smpte_paint_vbox (mask->data, mask->width,
+ impacts[1] * width, impacts[2] * height, impacts[3] * depth,
+ impacts[4] * width, impacts[5] * height, impacts[6] * depth);
+ impacts += 7;
+ break;
case BOX_HORIZONTAL:
- gst_smpte_paint_hbox (mask->data, mask->width,
- impacts[1] * width, impacts[2] * height, impacts[3] * depth,
- impacts[4] * width, impacts[5] * height, impacts[6] * depth);
- impacts += 7;
+ gst_smpte_paint_hbox (mask->data, mask->width,
+ impacts[1] * width, impacts[2] * height, impacts[3] * depth,
+ impacts[4] * width, impacts[5] * height, impacts[6] * depth);
+ impacts += 7;
case BOX_CLOCK:
- gst_smpte_paint_box_clock (mask->data, mask->width,
- impacts[1] * width, impacts[2] * height, impacts[3] * depth,
- impacts[4] * width, impacts[5] * height, impacts[6] * depth,
- impacts[7] * width, impacts[8] * height, impacts[9] * depth);
- impacts += 10;
+ gst_smpte_paint_box_clock (mask->data, mask->width,
+ impacts[1] * width, impacts[2] * height, impacts[3] * depth,
+ impacts[4] * width, impacts[5] * height, impacts[6] * depth,
+ impacts[7] * width, impacts[8] * height, impacts[9] * depth);
+ impacts += 10;
default:
- break;
+ break;
}
}
}
for (i = 0; i < config->nobjects; i++) {
gst_smpte_paint_triangle_clock (mask->data, mask->width,
- impacts[0] * width, impacts[1] * height, impacts[2] * depth,
- impacts[3] * width, impacts[4] * height, impacts[5] * depth,
- impacts[6] * width, impacts[7] * height, impacts[8] * depth);
+ impacts[0] * width, impacts[1] * height, impacts[2] * depth,
+ impacts[3] * width, impacts[4] * height, impacts[5] * depth,
+ impacts[6] * width, impacts[7] * height, impacts[8] * depth);
impacts += 9;
}
}
for (i = 0; i < config->nobjects; i++) {
gst_smpte_paint_triangle_linear (mask->data, mask->width,
- impacts[0] * width, impacts[1] * height, impacts[2] * depth,
- impacts[3] * width, impacts[4] * height, impacts[5] * depth,
- impacts[6] * width, impacts[7] * height, impacts[8] * depth);
+ impacts[0] * width, impacts[1] * height, impacts[2] * depth,
+ impacts[3] * width, impacts[4] * height, impacts[5] * depth,
+ impacts[6] * width, impacts[7] * height, impacts[8] * depth);
impacts += 9;
}
}
static GstMaskDefinition definitions[] = {
{1, "bar_wipe_lr",
- "A bar moves from left to right",
- gst_wipe_boxes_draw, _gst_mask_default_destroy,
+ "A bar moves from left to right",
+ gst_wipe_boxes_draw, _gst_mask_default_destroy,
&wipe_config[WIPE_CONFIG_1]},
{2, "bar_wipe_tb",
- "A bar moves from top to bottom",
- gst_wipe_boxes_draw, _gst_mask_default_destroy,
+ "A bar moves from top to bottom",
+ gst_wipe_boxes_draw, _gst_mask_default_destroy,
&wipe_config[WIPE_CONFIG_2]},
{3, "box_wipe_tl",
- "A box expands from the upper-left corner to the lower-right corner",
- gst_wipe_triangles_draw, _gst_mask_default_destroy,
+ "A box expands from the upper-left corner to the lower-right corner",
+ gst_wipe_triangles_draw, _gst_mask_default_destroy,
&wipe_config[WIPE_CONFIG_3]},
{4, "box_wipe_tr",
- "A box expands from the upper-right corner to the lower-left corner",
- gst_wipe_triangles_draw, _gst_mask_default_destroy,
+ "A box expands from the upper-right corner to the lower-left corner",
+ gst_wipe_triangles_draw, _gst_mask_default_destroy,
&wipe_config[WIPE_CONFIG_4]},
{5, "box_wipe_br",
- "A box expands from the lower-right corner to the upper-left corner",
- gst_wipe_triangles_draw, _gst_mask_default_destroy,
+ "A box expands from the lower-right corner to the upper-left corner",
+ gst_wipe_triangles_draw, _gst_mask_default_destroy,
&wipe_config[WIPE_CONFIG_5]},
{6, "box_wipe_bl",
- "A box expands from the lower-left corner to the upper-right corner",
- gst_wipe_triangles_draw, _gst_mask_default_destroy,
+ "A box expands from the lower-left corner to the upper-right corner",
+ gst_wipe_triangles_draw, _gst_mask_default_destroy,
&wipe_config[WIPE_CONFIG_6]},
{7, "four_box_wipe_ci",
- "A box shape expands from each of the four corners toward the center",
- gst_wipe_triangles_draw, _gst_mask_default_destroy,
+ "A box shape expands from each of the four corners toward the center",
+ gst_wipe_triangles_draw, _gst_mask_default_destroy,
&wipe_config[WIPE_CONFIG_7]},
{8, "four_box_wipe_co",
- "A box shape expands from the center of each quadrant toward the corners of each quadrant",
- gst_wipe_triangles_draw, _gst_mask_default_destroy,
+ "A box shape expands from the center of each quadrant toward the corners of each quadrant",
+ gst_wipe_triangles_draw, _gst_mask_default_destroy,
&wipe_config[WIPE_CONFIG_8]},
{21, "barndoor_v",
- "A central, vertical line splits and expands toward the left and right edges",
- gst_wipe_boxes_draw, _gst_mask_default_destroy,
+ "A central, vertical line splits and expands toward the left and right edges",
+ gst_wipe_boxes_draw, _gst_mask_default_destroy,
&wipe_config[WIPE_CONFIG_21]},
{22, "barndoor_h",
- "A central, horizontal line splits and expands toward the top and bottom edges",
- gst_wipe_boxes_draw, _gst_mask_default_destroy,
+ "A central, horizontal line splits and expands toward the top and bottom edges",
+ gst_wipe_boxes_draw, _gst_mask_default_destroy,
&wipe_config[WIPE_CONFIG_22]},
{23, "box_wipe_tc",
- "A box expands from the top edge's midpoint to the bottom corners",
- gst_wipe_triangles_draw, _gst_mask_default_destroy,
+ "A box expands from the top edge's midpoint to the bottom corners",
+ gst_wipe_triangles_draw, _gst_mask_default_destroy,
&wipe_config[WIPE_CONFIG_23]},
{24, "box_wipe_rc",
- "A box expands from the right edge's midpoint to the left corners",
- gst_wipe_triangles_draw, _gst_mask_default_destroy,
+ "A box expands from the right edge's midpoint to the left corners",
+ gst_wipe_triangles_draw, _gst_mask_default_destroy,
&wipe_config[WIPE_CONFIG_24]},
{25, "box_wipe_bc",
- "A box expands from the bottom edge's midpoint to the top corners",
- gst_wipe_triangles_draw, _gst_mask_default_destroy,
+ "A box expands from the bottom edge's midpoint to the top corners",
+ gst_wipe_triangles_draw, _gst_mask_default_destroy,
&wipe_config[WIPE_CONFIG_25]},
{26, "box_wipe_lc",
- "A box expands from the left edge's midpoint to the right corners",
- gst_wipe_triangles_draw, _gst_mask_default_destroy,
+ "A box expands from the left edge's midpoint to the right corners",
+ gst_wipe_triangles_draw, _gst_mask_default_destroy,
&wipe_config[WIPE_CONFIG_26]},
{41, "diagonal_tl",
- "A diagonal line moves from the upper-left corner to the lower-right corner",
- gst_wipe_triangles_draw, _gst_mask_default_destroy,
+ "A diagonal line moves from the upper-left corner to the lower-right corner",
+ gst_wipe_triangles_draw, _gst_mask_default_destroy,
&wipe_config[WIPE_CONFIG_41]},
{42, "diagonal_tr",
- "A diagonal line moves from the upper right corner to the lower-left corner",
- gst_wipe_triangles_draw, _gst_mask_default_destroy,
+ "A diagonal line moves from the upper right corner to the lower-left corner",
+ gst_wipe_triangles_draw, _gst_mask_default_destroy,
&wipe_config[WIPE_CONFIG_42]},
{43, "bowtie_v",
- "Two wedge shapes slide in from the top and bottom edges toward the center",
- gst_wipe_triangles_draw, _gst_mask_default_destroy,
+ "Two wedge shapes slide in from the top and bottom edges toward the center",
+ gst_wipe_triangles_draw, _gst_mask_default_destroy,
&wipe_config[WIPE_CONFIG_43]},
{44, "bowtie_h",
- "Two wedge shapes slide in from the left and right edges toward the center",
- gst_wipe_triangles_draw, _gst_mask_default_destroy,
+ "Two wedge shapes slide in from the left and right edges toward the center",
+ gst_wipe_triangles_draw, _gst_mask_default_destroy,
&wipe_config[WIPE_CONFIG_44]},
{45, "barndoor_dbl",
- "A diagonal line from the lower-left to upper-right corners splits and expands toward the opposite corners",
- gst_wipe_triangles_draw, _gst_mask_default_destroy,
+ "A diagonal line from the lower-left to upper-right corners splits and expands toward the opposite corners",
+ gst_wipe_triangles_draw, _gst_mask_default_destroy,
&wipe_config[WIPE_CONFIG_45]},
{46, "barndoor_dtl",
- "A diagonal line from upper-left to lower-right corners splits and expands toward the opposite corners",
- gst_wipe_triangles_draw, _gst_mask_default_destroy,
+ "A diagonal line from upper-left to lower-right corners splits and expands toward the opposite corners",
+ gst_wipe_triangles_draw, _gst_mask_default_destroy,
&wipe_config[WIPE_CONFIG_46]},
{47, "misc_diagonal_dbd",
- "Four wedge shapes split from the center and retract toward the four edges",
- gst_wipe_triangles_draw, _gst_mask_default_destroy,
+ "Four wedge shapes split from the center and retract toward the four edges",
+ gst_wipe_triangles_draw, _gst_mask_default_destroy,
&wipe_config[WIPE_CONFIG_47]},
{48, "misc_diagonal_dd",
- "A diamond connecting the four edge midpoints simultaneously contracts toward the center and expands toward the edges",
- gst_wipe_triangles_draw, _gst_mask_default_destroy,
+ "A diamond connecting the four edge midpoints simultaneously contracts toward the center and expands toward the edges",
+ gst_wipe_triangles_draw, _gst_mask_default_destroy,
&wipe_config[WIPE_CONFIG_48]},
{61, "vee_d",
- "A wedge shape moves from top to bottom",
- gst_wipe_triangles_draw, _gst_mask_default_destroy,
+ "A wedge shape moves from top to bottom",
+ gst_wipe_triangles_draw, _gst_mask_default_destroy,
&wipe_config[WIPE_CONFIG_61]},
{62, "vee_l",
- "A wedge shape moves from right to left",
- gst_wipe_triangles_draw, _gst_mask_default_destroy,
+ "A wedge shape moves from right to left",
+ gst_wipe_triangles_draw, _gst_mask_default_destroy,
&wipe_config[WIPE_CONFIG_62]},
{63, "vee_u",
- "A wedge shape moves from bottom to top",
- gst_wipe_triangles_draw, _gst_mask_default_destroy,
+ "A wedge shape moves from bottom to top",
+ gst_wipe_triangles_draw, _gst_mask_default_destroy,
&wipe_config[WIPE_CONFIG_63]},
{64, "vee_r",
- "A wedge shape moves from left to right",
- gst_wipe_triangles_draw, _gst_mask_default_destroy,
+ "A wedge shape moves from left to right",
+ gst_wipe_triangles_draw, _gst_mask_default_destroy,
&wipe_config[WIPE_CONFIG_64]},
{65, "barnvee_d",
- "A 'V' shape extending from the bottom edge's midpoint to the opposite corners contracts toward the center and expands toward the edges",
- gst_wipe_triangles_draw, _gst_mask_default_destroy,
+ "A 'V' shape extending from the bottom edge's midpoint to the opposite corners contracts toward the center and expands toward the edges",
+ gst_wipe_triangles_draw, _gst_mask_default_destroy,
&wipe_config[WIPE_CONFIG_65]},
{66, "barnvee_l",
- "A 'V' shape extending from the left edge's midpoint to the opposite corners contracts toward the center and expands toward the edges",
- gst_wipe_triangles_draw, _gst_mask_default_destroy,
+ "A 'V' shape extending from the left edge's midpoint to the opposite corners contracts toward the center and expands toward the edges",
+ gst_wipe_triangles_draw, _gst_mask_default_destroy,
&wipe_config[WIPE_CONFIG_66]},
{67, "barnvee_u",
- "A 'V' shape extending from the top edge's midpoint to the opposite corners contracts toward the center and expands toward the edges",
- gst_wipe_triangles_draw, _gst_mask_default_destroy,
+ "A 'V' shape extending from the top edge's midpoint to the opposite corners contracts toward the center and expands toward the edges",
+ gst_wipe_triangles_draw, _gst_mask_default_destroy,
&wipe_config[WIPE_CONFIG_67]},
{68, "barnvee_r",
- "A 'V' shape extending from the right edge's midpoint to the opposite corners contracts toward the center and expands toward the edges",
- gst_wipe_triangles_draw, _gst_mask_default_destroy,
+ "A 'V' shape extending from the right edge's midpoint to the opposite corners contracts toward the center and expands toward the edges",
+ gst_wipe_triangles_draw, _gst_mask_default_destroy,
&wipe_config[WIPE_CONFIG_68]},
{101, "iris_rect",
- "A rectangle expands from the center.",
- gst_wipe_triangles_draw, _gst_mask_default_destroy,
+ "A rectangle expands from the center.",
+ gst_wipe_triangles_draw, _gst_mask_default_destroy,
&wipe_config[WIPE_CONFIG_101]},
{201, "clock_cw12",
- "A radial hand sweeps clockwise from the twelve o'clock position",
- gst_wipe_boxes_draw, _gst_mask_default_destroy,
+ "A radial hand sweeps clockwise from the twelve o'clock position",
+ gst_wipe_boxes_draw, _gst_mask_default_destroy,
&wipe_config[WIPE_CONFIG_201]},
{202, "clock_cw3",
- "A radial hand sweeps clockwise from the three o'clock position",
- gst_wipe_boxes_draw, _gst_mask_default_destroy,
+ "A radial hand sweeps clockwise from the three o'clock position",
+ gst_wipe_boxes_draw, _gst_mask_default_destroy,
&wipe_config[WIPE_CONFIG_202]},
{203, "clock_cw6",
- "A radial hand sweeps clockwise from the six o'clock position",
- gst_wipe_boxes_draw, _gst_mask_default_destroy,
+ "A radial hand sweeps clockwise from the six o'clock position",
+ gst_wipe_boxes_draw, _gst_mask_default_destroy,
&wipe_config[WIPE_CONFIG_203]},
{204, "clock_cw9",
- "A radial hand sweeps clockwise from the nine o'clock position",
- gst_wipe_boxes_draw, _gst_mask_default_destroy,
+ "A radial hand sweeps clockwise from the nine o'clock position",
+ gst_wipe_boxes_draw, _gst_mask_default_destroy,
&wipe_config[WIPE_CONFIG_204]},
{205, "pinwheel_tbv",
- "Two radial hands sweep clockwise from the twelve and six o'clock positions",
- gst_wipe_boxes_draw, _gst_mask_default_destroy,
+ "Two radial hands sweep clockwise from the twelve and six o'clock positions",
+ gst_wipe_boxes_draw, _gst_mask_default_destroy,
&wipe_config[WIPE_CONFIG_205]},
{206, "pinwheel_tbh",
- "Two radial hands sweep clockwise from the nine and three o'clock positions",
- gst_wipe_boxes_draw, _gst_mask_default_destroy,
+ "Two radial hands sweep clockwise from the nine and three o'clock positions",
+ gst_wipe_boxes_draw, _gst_mask_default_destroy,
&wipe_config[WIPE_CONFIG_206]},
{207, "pinwheel_fb",
- "Four radial hands sweep clockwise",
- gst_wipe_boxes_draw, _gst_mask_default_destroy,
+ "Four radial hands sweep clockwise",
+ gst_wipe_boxes_draw, _gst_mask_default_destroy,
&wipe_config[WIPE_CONFIG_207]},
{211, "fan_ct",
- "A fan unfolds from the top edge, the fan axis at the center",
- gst_wipe_boxes_draw, _gst_mask_default_destroy,
+ "A fan unfolds from the top edge, the fan axis at the center",
+ gst_wipe_boxes_draw, _gst_mask_default_destroy,
&wipe_config[WIPE_CONFIG_211]},
{212, "fan_cr",
- "A fan unfolds from the right edge, the fan axis at the center",
- gst_wipe_boxes_draw, _gst_mask_default_destroy,
+ "A fan unfolds from the right edge, the fan axis at the center",
+ gst_wipe_boxes_draw, _gst_mask_default_destroy,
&wipe_config[WIPE_CONFIG_212]},
{213, "doublefan_fov",
- "Two fans, their axes at the center, unfold from the top and bottom",
- gst_wipe_boxes_draw, _gst_mask_default_destroy,
+ "Two fans, their axes at the center, unfold from the top and bottom",
+ gst_wipe_boxes_draw, _gst_mask_default_destroy,
&wipe_config[WIPE_CONFIG_213]},
{214, "doublefan_foh",
- "Two fans, their axes at the center, unfold from the left and right",
- gst_wipe_boxes_draw, _gst_mask_default_destroy,
+ "Two fans, their axes at the center, unfold from the left and right",
+ gst_wipe_boxes_draw, _gst_mask_default_destroy,
&wipe_config[WIPE_CONFIG_214]},
{221, "singlesweep_cwt",
- "A radial hand sweeps clockwise from the top edge's midpoint",
- gst_wipe_boxes_draw, _gst_mask_default_destroy,
+ "A radial hand sweeps clockwise from the top edge's midpoint",
+ gst_wipe_boxes_draw, _gst_mask_default_destroy,
&wipe_config[WIPE_CONFIG_221]},
{222, "singlesweep_cwr",
- "A radial hand sweeps clockwise from the right edge's midpoint",
- gst_wipe_boxes_draw, _gst_mask_default_destroy,
+ "A radial hand sweeps clockwise from the right edge's midpoint",
+ gst_wipe_boxes_draw, _gst_mask_default_destroy,
&wipe_config[WIPE_CONFIG_222]},
{223, "singlesweep_cwb",
- "A radial hand sweeps clockwise from the bottom edge's midpoint",
- gst_wipe_boxes_draw, _gst_mask_default_destroy,
+ "A radial hand sweeps clockwise from the bottom edge's midpoint",
+ gst_wipe_boxes_draw, _gst_mask_default_destroy,
&wipe_config[WIPE_CONFIG_223]},
{224, "singlesweep_cwl",
- "A radial hand sweeps clockwise from the left edge's midpoint",
- gst_wipe_boxes_draw, _gst_mask_default_destroy,
+ "A radial hand sweeps clockwise from the left edge's midpoint",
+ gst_wipe_boxes_draw, _gst_mask_default_destroy,
&wipe_config[WIPE_CONFIG_224]},
{225, "doublesweep_pv",
- "Two radial hands sweep clockwise and counter-clockwise from the top and bottom edges' midpoints",
- gst_wipe_boxes_draw, _gst_mask_default_destroy,
+ "Two radial hands sweep clockwise and counter-clockwise from the top and bottom edges' midpoints",
+ gst_wipe_boxes_draw, _gst_mask_default_destroy,
&wipe_config[WIPE_CONFIG_225]},
{226, "doublesweep_pd",
- "Two radial hands sweep clockwise and counter-clockwise from the left and right edges' midpoints",
- gst_wipe_boxes_draw, _gst_mask_default_destroy,
+ "Two radial hands sweep clockwise and counter-clockwise from the left and right edges' midpoints",
+ gst_wipe_boxes_draw, _gst_mask_default_destroy,
&wipe_config[WIPE_CONFIG_226]},
{227, "doublesweep_ov",
- "Two radial hands attached at the top and bottom edges' midpoints sweep from right to left",
- gst_wipe_boxes_draw, _gst_mask_default_destroy,
+ "Two radial hands attached at the top and bottom edges' midpoints sweep from right to left",
+ gst_wipe_boxes_draw, _gst_mask_default_destroy,
&wipe_config[WIPE_CONFIG_227]},
{228, "doublesweep_oh",
- "Two radial hands attached at the left and right edges' midpoints sweep from top to bottom",
- gst_wipe_boxes_draw, _gst_mask_default_destroy,
+ "Two radial hands attached at the left and right edges' midpoints sweep from top to bottom",
+ gst_wipe_boxes_draw, _gst_mask_default_destroy,
&wipe_config[WIPE_CONFIG_228]},
{231, "fan_t",
- "A fan unfolds from the bottom, the fan axis at the top edge's midpoint",
- gst_wipe_boxes_draw, _gst_mask_default_destroy,
+ "A fan unfolds from the bottom, the fan axis at the top edge's midpoint",
+ gst_wipe_boxes_draw, _gst_mask_default_destroy,
&wipe_config[WIPE_CONFIG_231]},
{232, "fan_r",
- "A fan unfolds from the left, the fan axis at the right edge's midpoint",
- gst_wipe_boxes_draw, _gst_mask_default_destroy,
+ "A fan unfolds from the left, the fan axis at the right edge's midpoint",
+ gst_wipe_boxes_draw, _gst_mask_default_destroy,
&wipe_config[WIPE_CONFIG_232]},
{233, "fan_b",
- "A fan unfolds from the top, the fan axis at the bottom edge's midpoint",
- gst_wipe_boxes_draw, _gst_mask_default_destroy,
+ "A fan unfolds from the top, the fan axis at the bottom edge's midpoint",
+ gst_wipe_boxes_draw, _gst_mask_default_destroy,
&wipe_config[WIPE_CONFIG_233]},
{234, "fan_l",
- "A fan unfolds from the right, the fan axis at the left edge's midpoint",
- gst_wipe_boxes_draw, _gst_mask_default_destroy,
+ "A fan unfolds from the right, the fan axis at the left edge's midpoint",
+ gst_wipe_boxes_draw, _gst_mask_default_destroy,
&wipe_config[WIPE_CONFIG_234]},
{235, "doublefan_fiv",
- "Two fans, their axes at the top and bottom, unfold from the center",
- gst_wipe_boxes_draw, _gst_mask_default_destroy,
+ "Two fans, their axes at the top and bottom, unfold from the center",
+ gst_wipe_boxes_draw, _gst_mask_default_destroy,
&wipe_config[WIPE_CONFIG_235]},
{236, "doublefan_fih",
- "Two fans, their axes at the left and right, unfold from the center",
- gst_wipe_boxes_draw, _gst_mask_default_destroy,
+ "Two fans, their axes at the left and right, unfold from the center",
+ gst_wipe_boxes_draw, _gst_mask_default_destroy,
&wipe_config[WIPE_CONFIG_236]},
{241, "singlesweep_cwtl",
- "A radial hand sweeps clockwise from the upper-left corner",
- gst_wipe_boxes_draw, _gst_mask_default_destroy,
+ "A radial hand sweeps clockwise from the upper-left corner",
+ gst_wipe_boxes_draw, _gst_mask_default_destroy,
&wipe_config[WIPE_CONFIG_241]},
{242, "singlesweep_cwbl",
- "A radial hand sweeps counter-clockwise from the lower-left corner.",
- gst_wipe_boxes_draw, _gst_mask_default_destroy,
+ "A radial hand sweeps counter-clockwise from the lower-left corner.",
+ gst_wipe_boxes_draw, _gst_mask_default_destroy,
&wipe_config[WIPE_CONFIG_242]},
{243, "singlesweep_cwbr",
- "A radial hand sweeps clockwise from the lower-right corner",
- gst_wipe_boxes_draw, _gst_mask_default_destroy,
+ "A radial hand sweeps clockwise from the lower-right corner",
+ gst_wipe_boxes_draw, _gst_mask_default_destroy,
&wipe_config[WIPE_CONFIG_243]},
{244, "singlesweep_cwtr",
- "A radial hand sweeps counter-clockwise from the upper-right corner",
- gst_wipe_boxes_draw, _gst_mask_default_destroy,
+ "A radial hand sweeps counter-clockwise from the upper-right corner",
+ gst_wipe_boxes_draw, _gst_mask_default_destroy,
&wipe_config[WIPE_CONFIG_244]},
{245, "doublesweep_pdtl",
- "Two radial hands attached at the upper-left and lower-right corners sweep down and up",
- gst_wipe_triangles_clock_draw, _gst_mask_default_destroy,
+ "Two radial hands attached at the upper-left and lower-right corners sweep down and up",
+ gst_wipe_triangles_clock_draw, _gst_mask_default_destroy,
&wipe_config[WIPE_CONFIG_245]},
{246, "doublesweep_pdbl",
- "Two radial hands attached at the lower-left and upper-right corners sweep down and up",
- gst_wipe_triangles_clock_draw, _gst_mask_default_destroy,
+ "Two radial hands attached at the lower-left and upper-right corners sweep down and up",
+ gst_wipe_triangles_clock_draw, _gst_mask_default_destroy,
&wipe_config[WIPE_CONFIG_246]},
{251, "saloondoor_t",
- "Two radial hands attached at the upper-left and upper-right corners sweep down",
- gst_wipe_boxes_draw, _gst_mask_default_destroy,
+ "Two radial hands attached at the upper-left and upper-right corners sweep down",
+ gst_wipe_boxes_draw, _gst_mask_default_destroy,
&wipe_config[WIPE_CONFIG_251]},
{252, "saloondoor_l",
- "Two radial hands attached at the upper-left and lower-left corners sweep to the right",
- gst_wipe_boxes_draw, _gst_mask_default_destroy,
+ "Two radial hands attached at the upper-left and lower-left corners sweep to the right",
+ gst_wipe_boxes_draw, _gst_mask_default_destroy,
&wipe_config[WIPE_CONFIG_252]},
{253, "saloondoor_b",
- "Two radial hands attached at the lower-left and lower-right corners sweep up",
- gst_wipe_boxes_draw, _gst_mask_default_destroy,
+ "Two radial hands attached at the lower-left and lower-right corners sweep up",
+ gst_wipe_boxes_draw, _gst_mask_default_destroy,
&wipe_config[WIPE_CONFIG_253]},
{254, "saloondoor_r",
- "Two radial hands attached at the upper-right and lower-right corners sweep to the left",
- gst_wipe_boxes_draw, _gst_mask_default_destroy,
+ "Two radial hands attached at the upper-right and lower-right corners sweep to the left",
+ gst_wipe_boxes_draw, _gst_mask_default_destroy,
&wipe_config[WIPE_CONFIG_254]},
{261, "windshield_r",
- "Two radial hands attached at the midpoints of the top and bottom halves sweep from right to left",
- gst_wipe_boxes_draw, _gst_mask_default_destroy,
+ "Two radial hands attached at the midpoints of the top and bottom halves sweep from right to left",
+ gst_wipe_boxes_draw, _gst_mask_default_destroy,
&wipe_config[WIPE_CONFIG_261]},
{262, "windshield_u",
- "Two radial hands attached at the midpoints of the left and right halves sweep from top to bottom",
- gst_wipe_boxes_draw, _gst_mask_default_destroy,
+ "Two radial hands attached at the midpoints of the left and right halves sweep from top to bottom",
+ gst_wipe_boxes_draw, _gst_mask_default_destroy,
&wipe_config[WIPE_CONFIG_262]},
{263, "windshield_v",
- "Two sets of radial hands attached at the midpoints of the top and bottom halves sweep from top to bottom and bottom to top",
- gst_wipe_boxes_draw, _gst_mask_default_destroy,
+ "Two sets of radial hands attached at the midpoints of the top and bottom halves sweep from top to bottom and bottom to top",
+ gst_wipe_boxes_draw, _gst_mask_default_destroy,
&wipe_config[WIPE_CONFIG_263]},
{264, "windshield_h",
- "Two sets of radial hands attached at the midpoints of the left and right halves sweep from left to right and right to left",
- gst_wipe_boxes_draw, _gst_mask_default_destroy,
+ "Two sets of radial hands attached at the midpoints of the left and right halves sweep from left to right and right to left",
+ gst_wipe_boxes_draw, _gst_mask_default_destroy,
&wipe_config[WIPE_CONFIG_264]},
{0, NULL, NULL, NULL}
};
definitions = gst_mask_get_definitions ();
smpte_transitions =
- g_new0 (GEnumValue, g_list_length ((GList *) definitions) + 1);
+ g_new0 (GEnumValue, g_list_length ((GList *) definitions) + 1);
while (definitions) {
GstMaskDefinition *definition = (GstMaskDefinition *) definitions->data;
}
smpte_transition_type =
- g_enum_register_static ("GstSMPTETransitionType", smpte_transitions);
+ g_enum_register_static ("GstSMPTETransitionType", smpte_transitions);
}
return smpte_transition_type;
}
0,
(GInstanceInitFunc) gst_smpte_init,
};
+
smpte_type =
- g_type_register_static (GST_TYPE_ELEMENT, "GstSMPTE", &smpte_info, 0);
+ g_type_register_static (GST_TYPE_ELEMENT, "GstSMPTE", &smpte_info, 0);
}
return smpte_type;
}
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_TYPE,
g_param_spec_enum ("type", "Type", "The type of transition to use",
- GST_TYPE_SMPTE_TRANSITION_TYPE, 1, G_PARAM_READWRITE));
+ GST_TYPE_SMPTE_TRANSITION_TYPE, 1, G_PARAM_READWRITE));
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_FPS,
g_param_spec_float ("fps", "FPS",
- "Frames per second if no input files are given", 0., G_MAXFLOAT, 25.,
- G_PARAM_READWRITE));
+ "Frames per second if no input files are given", 0., G_MAXFLOAT, 25.,
+ G_PARAM_READWRITE));
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_BORDER,
g_param_spec_int ("border", "Border",
- "The border width of the transition", 0, G_MAXINT, 0,
- G_PARAM_READWRITE));
+ "The border width of the transition", 0, G_MAXINT, 0,
+ G_PARAM_READWRITE));
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_DEPTH,
g_param_spec_int ("depth", "Depth", "Depth of the mask in bits", 1, 24,
- 16, G_PARAM_READWRITE));
+ 16, G_PARAM_READWRITE));
}
/* wht yel cya grn mag red blu blk -I Q */
*out++ = ((*in1++ * value) + (*in2++ * (256 - value))) >> 8;
if (!(i & 1) && !(j & 1)) {
- *outu++ = ((*in1u++ * value) + (*in2u++ * (256 - value))) >> 8;
- *outv++ = ((*in1v++ * value) + (*in2v++ * (256 - value))) >> 8;
+ *outu++ = ((*in1u++ * value) + (*in2u++ * (256 - value))) >> 8;
+ *outv++ = ((*in1v++ * value) + (*in2v++ * (256 - value))) >> 8;
}
}
}
GstCaps *caps;
caps =
- gst_caps_copy (gst_static_caps_get (&gst_smpte_src_template.
- static_caps));
+ gst_caps_copy (gst_static_caps_get (&gst_smpte_src_template.
+ static_caps));
gst_caps_set_simple (caps, "width", G_TYPE_INT, smpte->width, "height",
- G_TYPE_INT, smpte->height, "framerate", G_TYPE_DOUBLE, smpte->fps,
- NULL);
+ G_TYPE_INT, smpte->height, "framerate", G_TYPE_DOUBLE, smpte->fps,
+ NULL);
if (!gst_pad_try_set_caps (smpte->srcpad, caps)) {
- GST_ELEMENT_ERROR (smpte, CORE, NEGOTIATION, (NULL), (NULL));
- return;
+ GST_ELEMENT_ERROR (smpte, CORE, NEGOTIATION, (NULL), (NULL));
+ return;
}
}
gst_smpte_blend_i420 (GST_BUFFER_DATA (in1),
- GST_BUFFER_DATA (in2),
- GST_BUFFER_DATA (outbuf),
- smpte->mask, smpte->width, smpte->height,
- smpte->border,
- ((1 << smpte->depth) + smpte->border) *
- smpte->position / smpte->duration);
+ GST_BUFFER_DATA (in2),
+ GST_BUFFER_DATA (outbuf),
+ smpte->mask, smpte->width, smpte->height,
+ smpte->border,
+ ((1 << smpte->depth) + smpte->border) *
+ smpte->position / smpte->duration);
} else {
outbuf = in2;
gst_buffer_ref (in2);
gint type = g_value_get_enum (value);
gst_smpte_update_mask (smpte, type, smpte->depth,
- smpte->width, smpte->height);
+ smpte->width, smpte->height);
break;
}
case ARG_BORDER:
gint depth = g_value_get_int (value);
gst_smpte_update_mask (smpte, smpte->type, depth,
- smpte->width, smpte->height);
+ smpte->width, smpte->height);
break;
}
default:
switch (prop_id) {
case ARG_TYPE:
if (smpte->mask) {
- g_value_set_enum (value, smpte->mask->type);
+ g_value_set_enum (value, smpte->mask->type);
}
break;
case ARG_FPS:
e += sign;
for (j = s; j != e; j += sign) {
- dest[j] = (ec * (j - s) + sc * (e - j)) / (e - s);
+ dest[j] = (ec * (j - s) + sc * (e - j)) / (e - s);
}
while (pyr == i) {
- STEP_3D_LINE (dxrabs, dyrabs, dcrabs, sdxr, sdyr, sdcr,
- xrr, yrr, crr, pxr, pyr, pcr);
+ STEP_3D_LINE (dxrabs, dyrabs, dcrabs, sdxr, sdyr, sdcr,
+ xrr, yrr, crr, pxr, pyr, pcr);
}
while (pyl == i) {
- STEP_3D_LINE (dxlabs, dylabs, dclabs, sdxl, sdyl, sdcl,
- xrl, yrl, crl, pxl, pyl, pcl);
+ STEP_3D_LINE (dxlabs, dylabs, dclabs, sdxl, sdyl, sdcl,
+ xrl, yrl, crl, pxl, pyl, pcl);
}
dest += stride;
}
PREPARE_3D_LINE (x1, y1, c1, x2, y2, c2,
- dxrabs, dyrabs, dcrabs, sdxr, sdyr, sdcr, xrr, yrr, crr, pxr, pyr, pcr);
+ dxrabs, dyrabs, dcrabs, sdxr, sdyr, sdcr, xrr, yrr, crr, pxr, pyr, pcr);
seg_start = y1;
seg_end = y2;
angle_s = 0.0;
angle_e = acos (((x1 - x0) * (x2 - x0) + (y1 - y0) * (y2 - y0)) /
(sqrt ((x1 - x0) * (x1 - x0) + (y1 - y0) * (y1 - y0)) *
- sqrt ((x2 - x0) * (x2 - x0) + (y2 - y0) * (y2 - y0))));
+ sqrt ((x2 - x0) * (x2 - x0) + (y2 - y0) * (y2 - y0))));
len1 = sqrt ((x1 - x0) * (x1 - x0) + (y1 - y0) * (y1 - y0));
for (i = y1; i != (y2 + sign); i += sign) {
if (y1 == i)
- angle = 0;
+ angle = 0;
else
- angle = acos (((x1 - x0) * (x2 - x0) + (y1 - y0) * (i - y0)) /
- (len1 * sqrt ((x1 - x0) * (x1 - x0) + (i - y0) * (i -
- y0)))) / angle_e;
+ angle = acos (((x1 - x0) * (x2 - x0) + (y1 - y0) * (i - y0)) /
+ (len1 * sqrt ((x1 - x0) * (x1 - x0) + (i - y0) * (i -
+ y0)))) / angle_e;
draw_bresenham_line (dest, stride,
- x0, y0, x1, i, (c2 * angle + c1 * (1.0 - angle)));
+ x0, y0, x1, i, (c2 * angle + c1 * (1.0 - angle)));
}
} else if (y1 == y2) {
sign = SIGN (x2 - x1);
for (i = x1; i != (x2 + sign); i += sign) {
if (x1 == i)
- angle = 0;
+ angle = 0;
else
- angle = acos (((x1 - x0) * (i - x0) + (y1 - y0) * (y2 - y0)) /
- (len1 * sqrt ((i - x0) * (i - x0) + (y2 - y0) * (y2 -
- y0)))) / angle_e;
+ angle = acos (((x1 - x0) * (i - x0) + (y1 - y0) * (y2 - y0)) /
+ (len1 * sqrt ((i - x0) * (i - x0) + (y2 - y0) * (y2 -
+ y0)))) / angle_e;
draw_bresenham_line (dest, stride,
- x0, y0, i, y1, (c2 * angle + c1 * (1.0 - angle)));
+ x0, y0, i, y1, (c2 * angle + c1 * (1.0 - angle)));
}
}
}
angle_m = 2 * acos (((x1 - x0) * (xv - x0) + (y1 - y0) * (yv - y0)) /
(sqrt ((x1 - x0) * (x1 - x0) + (y1 - y0) * (y1 - y0)) *
- sqrt ((xv - x0) * (xv - x0) + (yv - y0) * (yv - y0)))) / M_PI;
+ sqrt ((xv - x0) * (xv - x0) + (yv - y0) * (yv - y0)))) / M_PI;
col_m = c2 * angle_m + c1 * (1.0 - angle_m);
0,
(GInstanceInitFunc) gst_spectrum_init,
};
+
spectrum_type =
- g_type_register_static (GST_TYPE_ELEMENT, "GstSpectrum", &spectrum_info,
- 0);
+ g_type_register_static (GST_TYPE_ELEMENT, "GstSpectrum", &spectrum_info,
+ 0);
}
return spectrum_type;
}
parent_class = g_type_class_ref (GST_TYPE_ELEMENT);
- g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_WIDTH, g_param_spec_int ("width", "width", "width", G_MININT, G_MAXINT, 0, G_PARAM_WRITABLE)); /* CHECKME */
+ g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_WIDTH, g_param_spec_int ("width", "width", "width", G_MININT, G_MAXINT, 0, G_PARAM_WRITABLE)); /* CHECKME */
gobject_class->set_property = gst_spectrum_set_property;
}
plugin_init (GstPlugin * plugin)
{
if (!gst_element_register (plugin, "udpsink", GST_RANK_NONE,
- GST_TYPE_UDPSINK))
+ GST_TYPE_UDPSINK))
return FALSE;
if (!gst_element_register (plugin, "udpsrc", GST_RANK_NONE, GST_TYPE_UDPSRC))
{CONTROL_TCP, "3", "tcp"},
{CONTROL_ZERO, NULL, NULL},
};
+
if (!udpsink_control_type) {
udpsink_control_type =
- g_enum_register_static ("GstUDPSinkControl", udpsink_control);
+ g_enum_register_static ("GstUDPSinkControl", udpsink_control);
}
return udpsink_control_type;
}
(GInstanceInitFunc) gst_udpsink_init,
NULL
};
+
udpsink_type =
- g_type_register_static (GST_TYPE_ELEMENT, "GstUDPSink", &udpsink_info,
- 0);
+ g_type_register_static (GST_TYPE_ELEMENT, "GstUDPSink", &udpsink_info,
+ 0);
}
return udpsink_type;
}
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_HOST,
g_param_spec_string ("host", "host",
- "The host/IP/Multicast group to send the packets to",
- UDP_DEFAULT_HOST, G_PARAM_READWRITE));
+ "The host/IP/Multicast group to send the packets to",
+ UDP_DEFAULT_HOST, G_PARAM_READWRITE));
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_PORT,
g_param_spec_int ("port", "port", "The port to send the packets to",
- 0, 32768, UDP_DEFAULT_PORT, G_PARAM_READWRITE));
+ 0, 32768, UDP_DEFAULT_PORT, G_PARAM_READWRITE));
g_object_class_install_property (gobject_class, ARG_CONTROL,
g_param_spec_enum ("control", "control", "The type of control",
- GST_TYPE_UDPSINK_CONTROL, CONTROL_UDP, G_PARAM_READWRITE));
- g_object_class_install_property (gobject_class, ARG_MTU, g_param_spec_int ("mtu", "mtu", "maximun transmit unit", G_MININT, G_MAXINT, 0, G_PARAM_READWRITE)); /* CHECKME */
+ GST_TYPE_UDPSINK_CONTROL, CONTROL_UDP, G_PARAM_READWRITE));
+ g_object_class_install_property (gobject_class, ARG_MTU, g_param_spec_int ("mtu", "mtu", "maximun transmit unit", G_MININT, G_MAXINT, 0, G_PARAM_READWRITE)); /* CHECKME */
gobject_class->set_property = gst_udpsink_set_property;
gobject_class->get_property = gst_udpsink_get_property;
switch (udpsink->control) {
case CONTROL_UDP:
if ((fd = socket (AF_INET, SOCK_DGRAM, IPPROTO_UDP)) == -1) {
- perror ("socket");
- return GST_PAD_LINK_REFUSED;
+ perror ("socket");
+ return GST_PAD_LINK_REFUSED;
}
/* We can only do broadcast in udp */
xmlDocDumpMemory (doc, &buf, &buf_size);
if (sendto (fd, buf, buf_size, 0, (struct sockaddr *) &serv_addr,
- sizeof (serv_addr)) == -1) {
- perror ("sending");
- return GST_PAD_LINK_REFUSED;
+ sizeof (serv_addr)) == -1) {
+ perror ("sending");
+ return GST_PAD_LINK_REFUSED;
}
close (fd);
break;
case CONTROL_TCP:
if ((fd = socket (AF_INET, SOCK_STREAM, IPPROTO_TCP)) == -1) {
- perror ("socket");
- return GST_PAD_LINK_REFUSED;
+ perror ("socket");
+ return GST_PAD_LINK_REFUSED;
}
if (connect (fd, (struct sockaddr *) &serv_addr, sizeof (serv_addr)) != 0) {
- g_printerr ("udpsink: connect to %s port %d failed: %s\n",
- udpsink->host, udpsink->port, g_strerror (errno));
- return GST_PAD_LINK_REFUSED;
+ g_printerr ("udpsink: connect to %s port %d failed: %s\n",
+ udpsink->host, udpsink->port, g_strerror (errno));
+ return GST_PAD_LINK_REFUSED;
}
f = fdopen (dup (fd), "wb");
for (i = 0; i < GST_BUFFER_SIZE (buf); i += udpsink->mtu) {
if (GST_BUFFER_SIZE (buf) - i > udpsink->mtu) {
if (sendto (udpsink->sock, GST_BUFFER_DATA (buf) + i,
- udpsink->mtu, 0, (struct sockaddr *) &udpsink->theiraddr,
- tolen) == -1) {
- perror ("sending");
+ udpsink->mtu, 0, (struct sockaddr *) &udpsink->theiraddr,
+ tolen) == -1) {
+ perror ("sending");
}
} else {
if (sendto (udpsink->sock, GST_BUFFER_DATA (buf) + i,
- GST_BUFFER_SIZE (buf) - i, 0,
- (struct sockaddr *) &udpsink->theiraddr, tolen) == -1) {
- perror ("sending");
+ GST_BUFFER_SIZE (buf) - i, 0,
+ (struct sockaddr *) &udpsink->theiraddr, tolen) == -1) {
+ perror ("sending");
}
}
}
switch (prop_id) {
case ARG_HOST:
if (udpsink->host != NULL)
- g_free (udpsink->host);
+ g_free (udpsink->host);
if (g_value_get_string (value) == NULL)
- udpsink->host = NULL;
+ udpsink->host = NULL;
else
- udpsink->host = g_strdup (g_value_get_string (value));
+ udpsink->host = g_strdup (g_value_get_string (value));
break;
case ARG_PORT:
udpsink->port = g_value_get_int (value);
guint bc_val;
memset (&sink->theiraddr, 0, sizeof (sink->theiraddr));
- sink->theiraddr.sin_family = AF_INET; /* host byte order */
- sink->theiraddr.sin_port = htons (sink->port); /* short, network byte order */
+ sink->theiraddr.sin_family = AF_INET; /* host byte order */
+ sink->theiraddr.sin_port = htons (sink->port); /* short, network byte order */
/* if its an IP address */
if (inet_aton (sink->host, &addr)) {
/* Joining the multicast group */
setsockopt (sink->sock, IPPROTO_IP, IP_ADD_MEMBERSHIP, &sink->multi_addr,
- sizeof (sink->multi_addr));
+ sizeof (sink->multi_addr));
}
else {
} else {
if (!GST_FLAG_IS_SET (element, GST_UDPSINK_OPEN)) {
if (!gst_udpsink_init_send (GST_UDPSINK (element)))
- return GST_STATE_FAILURE;
+ return GST_STATE_FAILURE;
}
}
{CONTROL_TCP, "3", "tcp"},
{CONTROL_ZERO, NULL, NULL},
};
+
if (!udpsrc_control_type) {
udpsrc_control_type =
- g_enum_register_static ("GstUDPSrcControl", udpsrc_control);
+ g_enum_register_static ("GstUDPSrcControl", udpsrc_control);
}
return udpsrc_control_type;
}
(GInstanceInitFunc) gst_udpsrc_init,
NULL
};
+
udpsrc_type =
- g_type_register_static (GST_TYPE_ELEMENT, "GstUDPSrc", &udpsrc_info, 0);
+ g_type_register_static (GST_TYPE_ELEMENT, "GstUDPSrc", &udpsrc_info, 0);
}
return udpsrc_type;
}
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_PORT,
g_param_spec_int ("port", "port", "The port to receive the packets from",
- 0, 32768, UDP_DEFAULT_PORT, G_PARAM_READWRITE));
+ 0, 32768, UDP_DEFAULT_PORT, G_PARAM_READWRITE));
g_object_class_install_property (gobject_class, ARG_CONTROL,
g_param_spec_enum ("control", "control", "The type of control",
- GST_TYPE_UDPSRC_CONTROL, CONTROL_UDP, G_PARAM_READWRITE));
+ GST_TYPE_UDPSRC_CONTROL, CONTROL_UDP, G_PARAM_READWRITE));
g_object_class_install_property (gobject_class, ARG_MULTICAST_GROUP,
g_param_spec_string ("multicast_group", "multicast_group",
- "The Address of multicast group to join",
- UDP_DEFAULT_MULTICAST_GROUP, G_PARAM_READWRITE));
+ "The Address of multicast group to join",
+ UDP_DEFAULT_MULTICAST_GROUP, G_PARAM_READWRITE));
gobject_class->set_property = gst_udpsrc_set_property;
gobject_class->get_property = gst_udpsrc_get_property;
if (select (max_sock + 1, &read_fds, NULL, NULL, NULL) > 0) {
if ((udpsrc->control_sock != -1) &&
- FD_ISSET (udpsrc->control_sock, &read_fds)) {
+ FD_ISSET (udpsrc->control_sock, &read_fds)) {
#ifndef GST_DISABLE_LOADSAVE
guchar *buf;
int ret;
buf = g_malloc (1024 * 10);
switch (udpsrc->control) {
- case CONTROL_TCP:
- len = sizeof (struct sockaddr);
- fdread = accept (udpsrc->control_sock, &addr, &len);
- if (fdread < 0) {
- perror ("accept");
- }
-
- ret = read (fdread, buf, 1024 * 10);
- break;
- case CONTROL_UDP:
- len = sizeof (struct sockaddr);
- ret =
- recvfrom (udpsrc->control_sock, buf, 1024 * 10, 0,
- (struct sockaddr *) &tmpaddr, &len);
- if (ret < 0) {
- perror ("recvfrom");
- }
- break;
- case CONTROL_NONE:
- default:
- g_free (buf);
- return NULL;
- break;
+ case CONTROL_TCP:
+ len = sizeof (struct sockaddr);
+ fdread = accept (udpsrc->control_sock, &addr, &len);
+ if (fdread < 0) {
+ perror ("accept");
+ }
+
+ ret = read (fdread, buf, 1024 * 10);
+ break;
+ case CONTROL_UDP:
+ len = sizeof (struct sockaddr);
+ ret =
+ recvfrom (udpsrc->control_sock, buf, 1024 * 10, 0,
+ (struct sockaddr *) &tmpaddr, &len);
+ if (ret < 0) {
+ perror ("recvfrom");
+ }
+ break;
+ case CONTROL_NONE:
+ default:
+ g_free (buf);
+ return NULL;
+ break;
}
buf[ret] = '\0';
doc = xmlParseMemory (buf, ret);
caps = gst_caps_load_thyself (doc->xmlRootNode);
if (caps == NULL) {
- return NULL;
+ return NULL;
}
/* foward the connect, we don't signal back the result here... */
if (gst_caps_is_fixed (caps)) {
- gst_pad_try_set_caps (udpsrc->srcpad, caps);
+ gst_pad_try_set_caps (udpsrc->srcpad, caps);
} else {
- GST_ERROR ("caps %" GST_PTR_FORMAT, caps);
- GST_ELEMENT_ERROR (udpsrc, CORE, NEGOTIATION, (NULL),
- ("Got unfixed caps from peer"));
+ GST_ERROR ("caps %" GST_PTR_FORMAT, caps);
+ GST_ELEMENT_ERROR (udpsrc, CORE, NEGOTIATION, (NULL),
+ ("Got unfixed caps from peer"));
}
#endif
GST_BUFFER_SIZE (outbuf) = 24000;
if (udpsrc->first_buf) {
- if (udpsrc->clock) {
- GstClockTime current_time;
- GstEvent *discont;
+ if (udpsrc->clock) {
+ GstClockTime current_time;
+ GstEvent *discont;
- current_time = gst_clock_get_time (udpsrc->clock);
+ current_time = gst_clock_get_time (udpsrc->clock);
- GST_BUFFER_TIMESTAMP (outbuf) = current_time;
+ GST_BUFFER_TIMESTAMP (outbuf) = current_time;
- discont = gst_event_new_discontinuous (FALSE, GST_FORMAT_TIME,
- current_time, NULL);
+ discont = gst_event_new_discontinuous (FALSE, GST_FORMAT_TIME,
+ current_time, NULL);
- gst_pad_push (udpsrc->srcpad, GST_DATA (discont));
- }
+ gst_pad_push (udpsrc->srcpad, GST_DATA (discont));
+ }
- udpsrc->first_buf = FALSE;
+ udpsrc->first_buf = FALSE;
}
else {
- GST_BUFFER_TIMESTAMP (outbuf) = GST_CLOCK_TIME_NONE;
+ GST_BUFFER_TIMESTAMP (outbuf) = GST_CLOCK_TIME_NONE;
}
len = sizeof (struct sockaddr);
numbytes = recvfrom (udpsrc->sock, GST_BUFFER_DATA (outbuf),
- GST_BUFFER_SIZE (outbuf), 0, (struct sockaddr *) &tmpaddr, &len);
+ GST_BUFFER_SIZE (outbuf), 0, (struct sockaddr *) &tmpaddr, &len);
if (numbytes != -1) {
- GST_BUFFER_SIZE (outbuf) = numbytes;
+ GST_BUFFER_SIZE (outbuf) = numbytes;
} else {
- perror ("recvfrom");
- gst_buffer_unref (outbuf);
- outbuf = NULL;
+ perror ("recvfrom");
+ gst_buffer_unref (outbuf);
+ outbuf = NULL;
}
}
g_free (udpsrc->multi_group);
if (g_value_get_string (value) == NULL)
- udpsrc->multi_group = g_strdup (UDP_DEFAULT_MULTICAST_GROUP);
+ udpsrc->multi_group = g_strdup (UDP_DEFAULT_MULTICAST_GROUP);
else
- udpsrc->multi_group = g_strdup (g_value_get_string (value));
+ udpsrc->multi_group = g_strdup (g_value_get_string (value));
break;
case ARG_CONTROL:
gint reuse = 1;
memset (&src->myaddr, 0, sizeof (src->myaddr));
- src->myaddr.sin_family = AF_INET; /* host byte order */
- src->myaddr.sin_port = htons (src->port); /* short, network byte order */
+ src->myaddr.sin_family = AF_INET; /* host byte order */
+ src->myaddr.sin_port = htons (src->port); /* short, network byte order */
src->myaddr.sin_addr.s_addr = INADDR_ANY;
if ((src->sock = socket (AF_INET, SOCK_DGRAM, 0)) == -1) {
}
if (setsockopt (src->sock, SOL_SOCKET, SO_REUSEADDR, &reuse,
- sizeof (reuse)) == -1) {
+ sizeof (reuse)) == -1) {
perror ("setsockopt");
return FALSE;
}
if (bind (src->sock, (struct sockaddr *) &src->myaddr,
- sizeof (src->myaddr)) == -1) {
+ sizeof (src->myaddr)) == -1) {
perror ("bind");
return FALSE;
}
if (src->multi_addr.imr_multiaddr.s_addr) {
src->multi_addr.imr_interface.s_addr = INADDR_ANY;
setsockopt (src->sock, IPPROTO_IP, IP_ADD_MEMBERSHIP, &src->multi_addr,
- sizeof (src->multi_addr));
+ sizeof (src->multi_addr));
}
}
switch (src->control) {
case CONTROL_TCP:
if ((src->control_sock = socket (AF_INET, SOCK_STREAM, 0)) == -1) {
- perror ("control_socket");
- return FALSE;
+ perror ("control_socket");
+ return FALSE;
}
if (bind (src->control_sock, (struct sockaddr *) &src->myaddr,
- sizeof (src->myaddr)) == -1) {
- perror ("control_bind");
- return FALSE;
+ sizeof (src->myaddr)) == -1) {
+ perror ("control_bind");
+ return FALSE;
}
if (listen (src->control_sock, 5) == -1) {
- perror ("listen");
- return FALSE;
+ perror ("listen");
+ return FALSE;
}
fcntl (src->control_sock, F_SETFL, O_NONBLOCK);
break;
case CONTROL_UDP:
if ((src->control_sock = socket (AF_INET, SOCK_DGRAM, 0)) == -1) {
- perror ("socket");
- return FALSE;
+ perror ("socket");
+ return FALSE;
}
if (bind (src->control_sock, (struct sockaddr *) &src->myaddr,
- sizeof (src->myaddr)) == -1) {
- perror ("control_bind");
- return FALSE;
+ sizeof (src->myaddr)) == -1) {
+ perror ("control_bind");
+ return FALSE;
}
/* We can only do broadcast in udp */
bc_val = 1;
setsockopt (src->control_sock, SOL_SOCKET, SO_BROADCAST, &bc_val,
- sizeof (bc_val));
+ sizeof (bc_val));
break;
case CONTROL_NONE:
GST_FLAG_SET (src, GST_UDPSRC_OPEN);
} else {
if (!GST_FLAG_IS_SET (element, GST_UDPSRC_OPEN)) {
if (!gst_udpsrc_init_receive (GST_UDPSRC (element)))
- return GST_STATE_FAILURE;
+ return GST_STATE_FAILURE;
}
}
0,
(GInstanceInitFunc) gst_video_crop_init,
};
+
video_crop_type =
- g_type_register_static (GST_TYPE_ELEMENT, "GstVideoCrop",
- &video_crop_info, 0);
+ g_type_register_static (GST_TYPE_ELEMENT, "GstVideoCrop",
+ &video_crop_info, 0);
}
return video_crop_type;
}
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_LEFT,
g_param_spec_int ("left", "Left", "Pixels to crop at left",
- 0, G_MAXINT, 0, G_PARAM_READWRITE));
+ 0, G_MAXINT, 0, G_PARAM_READWRITE));
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_RIGHT,
g_param_spec_int ("right", "Right", "Pixels to crop at right",
- 0, G_MAXINT, 0, G_PARAM_READWRITE));
+ 0, G_MAXINT, 0, G_PARAM_READWRITE));
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_TOP,
g_param_spec_int ("top", "Top", "Pixels to crop at top",
- 0, G_MAXINT, 0, G_PARAM_READWRITE));
+ 0, G_MAXINT, 0, G_PARAM_READWRITE));
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_BOTTOM,
g_param_spec_int ("bottom", "Bottom", "Pixels to crop at bottom",
- 0, G_MAXINT, 0, G_PARAM_READWRITE));
+ 0, G_MAXINT, 0, G_PARAM_READWRITE));
gobject_class->set_property = gst_video_crop_set_property;
gobject_class->get_property = gst_video_crop_get_property;
switch (GST_EVENT_TYPE (event)) {
default:
- gst_pad_event_default (pad, event);
- break;
+ gst_pad_event_default (pad, event);
+ break;
}
return;
}
0,
gst_gamma_init,
};
+
gamma_type = g_type_register_static (GST_TYPE_VIDEOFILTER,
- "GstGamma", &gamma_info, 0);
+ "GstGamma", &gamma_info, 0);
}
return gamma_type;
}
g_object_class_install_property (gobject_class, ARG_GAMMA,
g_param_spec_double ("gamma", "Gamma", "gamma",
- 0.01, 10, 1, G_PARAM_READWRITE));
+ 0.01, 10, 1, G_PARAM_READWRITE));
g_object_class_install_property (gobject_class, ARG_GAMMA_R,
g_param_spec_double ("redgamma", "Gamma_r",
- "gamma value for the red channel", 0.01, 10, 1, G_PARAM_READWRITE));
+ "gamma value for the red channel", 0.01, 10, 1, G_PARAM_READWRITE));
g_object_class_install_property (gobject_class, ARG_GAMMA_G,
g_param_spec_double ("greengamma", "Gamma_g",
- "gamma value for the green channel", 0.01, 10, 1, G_PARAM_READWRITE));
+ "gamma value for the green channel", 0.01, 10, 1, G_PARAM_READWRITE));
g_object_class_install_property (gobject_class, ARG_GAMMA_B,
g_param_spec_double ("bluegamma", "Gamma_b",
- "gamma value for the blue channel", 0.01, 10, 1, G_PARAM_READWRITE));
+ "gamma value for the blue channel", 0.01, 10, 1, G_PARAM_READWRITE));
gobject_class->set_property = gst_gamma_set_property;
gobject_class->get_property = gst_gamma_get_property;
int x, y;
for (y = 0; y < height; y++) {
- for (x = 0; x < width; x++) {
- cdest[y * width + x] =
- gamma->gamma_table[(unsigned char) csrc[y * width + x]];
- }
+ for (x = 0; x < width; x++) {
+ cdest[y * width + x] =
+ gamma->gamma_table[(unsigned char) csrc[y * width + x]];
+ }
}
}
}
i = 0;
while (i < width * height * 4) {
if ((i % 4) != 3)
- *cdest++ = gamma->gamma_table[*csrc++];
+ *cdest++ = gamma->gamma_table[*csrc++];
else {
- cdest++;
- csrc++;
+ cdest++;
+ csrc++;
}
i++;
}
};
videobalance_type = g_type_register_static (GST_TYPE_VIDEOFILTER,
- "GstVideobalance", &videobalance_info, 0);
+ "GstVideobalance", &videobalance_info, 0);
g_type_add_interface_static (videobalance_type,
- GST_TYPE_IMPLEMENTS_INTERFACE, &iface_info);
+ GST_TYPE_IMPLEMENTS_INTERFACE, &iface_info);
g_type_add_interface_static (videobalance_type, GST_TYPE_COLOR_BALANCE,
- &colorbalance_info);
+ &colorbalance_info);
}
return videobalance_type;
}
for (i = 0; i < G_N_ELEMENTS (gst_videobalance_formats); i++) {
gst_videofilter_class_add_format (videofilter_class,
- gst_videobalance_formats + i);
+ gst_videobalance_formats + i);
}
gst_videofilter_class_add_pad_templates (GST_VIDEOFILTER_CLASS (g_class));
g_object_class_install_property (gobject_class, ARG_CONTRAST,
g_param_spec_double ("contrast", "Contrast", "contrast",
- 0, 2, 1, G_PARAM_READWRITE));
+ 0, 2, 1, G_PARAM_READWRITE));
g_object_class_install_property (gobject_class, ARG_BRIGHTNESS,
g_param_spec_double ("brightness", "Brightness", "brightness",
- -1, 1, 0, G_PARAM_READWRITE));
+ -1, 1, 0, G_PARAM_READWRITE));
g_object_class_install_property (gobject_class, ARG_HUE,
g_param_spec_double ("hue", "Hue", "hue", -1, 1, 0, G_PARAM_READWRITE));
g_object_class_install_property (gobject_class, ARG_SATURATION,
g_param_spec_double ("saturation", "Saturation", "saturation",
- 0, 2, 1, G_PARAM_READWRITE));
+ 0, 2, 1, G_PARAM_READWRITE));
gobject_class->set_property = gst_videobalance_set_property;
gobject_class->get_property = gst_videobalance_get_property;
u = 128 + ((i * hue_cos + j * hue_sin) * vb->saturation);
v = 128 + ((-i * hue_sin + j * hue_cos) * vb->saturation);
if (u < 0)
- u = 0;
+ u = 0;
else if (u > 255)
- u = 255;
+ u = 255;
if (v < 0)
- v = 0;
+ v = 0;
else if (v > 255)
- v = 255;
+ v = 255;
vb->tableu[i + 128][j + 128] = rint (u);
vb->tablev[i + 128][j + 128] = rint (v);
}
for (y = 0; y < height; y++) {
tablelookup_u8 (cdest + y * width, 1, csrc + y * width, 1,
- videobalance->tabley, 1, width);
+ videobalance->tabley, 1, width);
}
}
for (y = 0; y < height / 2; y++) {
for (x = 0; x < width / 2; x++) {
- u1 = usrc[y * (width / 2) + x];
- v1 = vsrc[y * (width / 2) + x];
- udest[y * (width / 2) + x] = videobalance->tableu[u1][v1];
- vdest[y * (width / 2) + x] = videobalance->tablev[u1][v1];
+ u1 = usrc[y * (width / 2) + x];
+ v1 = vsrc[y * (width / 2) + x];
+ udest[y * (width / 2) + x] = videobalance->tableu[u1][v1];
+ vdest[y * (width / 2) + x] = videobalance->tablev[u1][v1];
}
}
}
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
{GST_VIDEOFLIP_METHOD_HORIZ, "4", "Flip horizontally"},
{GST_VIDEOFLIP_METHOD_VERT, "5", "Flip vertically"},
{GST_VIDEOFLIP_METHOD_TRANS, "6",
- "Flip across upper left/lower right diagonal"},
+ "Flip across upper left/lower right diagonal"},
{GST_VIDEOFLIP_METHOD_OTHER, "7",
- "Flip across upper right/lower left diagonal"},
+ "Flip across upper right/lower left diagonal"},
{0, NULL, NULL},
};
+
if (!videoflip_method_type) {
videoflip_method_type = g_enum_register_static ("GstVideoflipMethod",
- videoflip_methods);
+ videoflip_methods);
}
return videoflip_method_type;
}
0,
gst_videoflip_init,
};
+
videoflip_type = g_type_register_static (GST_TYPE_VIDEOFILTER,
- "GstVideoflip", &videoflip_info, 0);
+ "GstVideoflip", &videoflip_info, 0);
}
return videoflip_type;
}
for (i = 0; i < G_N_ELEMENTS (gst_videoflip_formats); i++) {
gst_videofilter_class_add_format (videofilter_class,
- gst_videoflip_formats + i);
+ gst_videoflip_formats + i);
}
gst_videofilter_class_add_pad_templates (GST_VIDEOFILTER_CLASS (g_class));
g_object_class_install_property (gobject_class, ARG_METHOD,
g_param_spec_enum ("method", "method", "method",
- GST_TYPE_VIDEOFLIP_METHOD, GST_VIDEOFLIP_METHOD_90R,
- G_PARAM_READWRITE));
+ GST_TYPE_VIDEOFLIP_METHOD, GST_VIDEOFLIP_METHOD_90R,
+ G_PARAM_READWRITE));
gobject_class->set_property = gst_videoflip_set_property;
gobject_class->get_property = gst_videoflip_get_property;
switch (videoflip->method) {
case GST_VIDEOFLIP_METHOD_90R:
for (y = 0; y < dh; y++) {
- for (x = 0; x < dw; x++) {
- dest[y * dw + x] = src[(sh - 1 - x) * sw + y];
- }
+ for (x = 0; x < dw; x++) {
+ dest[y * dw + x] = src[(sh - 1 - x) * sw + y];
+ }
}
break;
case GST_VIDEOFLIP_METHOD_90L:
for (y = 0; y < dh; y++) {
- for (x = 0; x < dw; x++) {
- dest[y * dw + x] = src[x * sw + (sw - 1 - y)];
- }
+ for (x = 0; x < dw; x++) {
+ dest[y * dw + x] = src[x * sw + (sw - 1 - y)];
+ }
}
break;
case GST_VIDEOFLIP_METHOD_180:
for (y = 0; y < dh; y++) {
- for (x = 0; x < dw; x++) {
- dest[y * dw + x] = src[(sh - 1 - y) * sw + (sw - 1 - x)];
- }
+ for (x = 0; x < dw; x++) {
+ dest[y * dw + x] = src[(sh - 1 - y) * sw + (sw - 1 - x)];
+ }
}
break;
case GST_VIDEOFLIP_METHOD_HORIZ:
for (y = 0; y < dh; y++) {
- for (x = 0; x < dw; x++) {
- dest[y * dw + x] = src[y * sw + (sw - 1 - x)];
- }
+ for (x = 0; x < dw; x++) {
+ dest[y * dw + x] = src[y * sw + (sw - 1 - x)];
+ }
}
break;
case GST_VIDEOFLIP_METHOD_VERT:
for (y = 0; y < dh; y++) {
- for (x = 0; x < dw; x++) {
- dest[y * dw + x] = src[(sh - 1 - y) * sw + x];
- }
+ for (x = 0; x < dw; x++) {
+ dest[y * dw + x] = src[(sh - 1 - y) * sw + x];
+ }
}
break;
case GST_VIDEOFLIP_METHOD_TRANS:
for (y = 0; y < dh; y++) {
- for (x = 0; x < dw; x++) {
- dest[y * dw + x] = src[x * sw + y];
- }
+ for (x = 0; x < dw; x++) {
+ dest[y * dw + x] = src[x * sw + y];
+ }
}
break;
case GST_VIDEOFLIP_METHOD_OTHER:
for (y = 0; y < dh; y++) {
- for (x = 0; x < dw; x++) {
- dest[y * dw + x] = src[(sh - 1 - x) * sw + (sw - 1 - y)];
- }
+ for (x = 0; x < dw; x++) {
+ dest[y * dw + x] = src[(sh - 1 - x) * sw + (sw - 1 - y)];
+ }
}
break;
default:
0,
gst_videotemplate_init,
};
+
videotemplate_type = g_type_register_static (GST_TYPE_VIDEOFILTER,
- "GstVideotemplate", &videotemplate_info, 0);
+ "GstVideotemplate", &videotemplate_info, 0);
}
return videotemplate_type;
}
for (i = 0; i < G_N_ELEMENTS (gst_videotemplate_formats); i++) {
gst_videofilter_class_add_format (videofilter_class,
- gst_videotemplate_formats + i);
+ gst_videotemplate_formats + i);
}
gst_videofilter_class_add_pad_templates (GST_VIDEOFILTER_CLASS (g_class));
#if 0
g_object_class_install_property (gobject_class, ARG_METHOD,
g_param_spec_enum ("method", "method", "method",
- GST_TYPE_VIDEOTEMPLATE_METHOD, GST_VIDEOTEMPLATE_METHOD_1,
- G_PARAM_READWRITE));
+ GST_TYPE_VIDEOTEMPLATE_METHOD, GST_VIDEOTEMPLATE_METHOD_1,
+ G_PARAM_READWRITE));
#endif
gobject_class->set_property = gst_videotemplate_set_property;
{GST_VIDEOFLIP_METHOD_HORIZ, "4", "Flip horizontally"},
{GST_VIDEOFLIP_METHOD_VERT, "5", "Flip vertically"},
{GST_VIDEOFLIP_METHOD_TRANS, "6",
- "Flip across upper left/lower right diagonal"},
+ "Flip across upper left/lower right diagonal"},
{GST_VIDEOFLIP_METHOD_OTHER, "7",
- "Flip across upper right/lower left diagonal"},
+ "Flip across upper right/lower left diagonal"},
{0, NULL, NULL},
};
+
if (!videoflip_method_type) {
videoflip_method_type = g_enum_register_static ("GstVideoflipMethod",
- videoflip_methods);
+ videoflip_methods);
}
return videoflip_method_type;
}
0,
(GInstanceInitFunc) gst_videoflip_init,
};
+
videoflip_type =
- g_type_register_static (GST_TYPE_ELEMENT, "GstVideoflip",
- &videoflip_info, 0);
+ g_type_register_static (GST_TYPE_ELEMENT, "GstVideoflip",
+ &videoflip_info, 0);
}
return videoflip_type;
}
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_METHOD,
g_param_spec_enum ("method", "method", "method",
- GST_TYPE_VIDEOFLIP_METHOD, GST_VIDEOFLIP_METHOD_90R,
- G_PARAM_READWRITE));
+ GST_TYPE_VIDEOFLIP_METHOD, GST_VIDEOFLIP_METHOD_90R,
+ G_PARAM_READWRITE));
parent_class = g_type_class_ref (GST_TYPE_ELEMENT);
* the peer's formats. Create a list of them. */
for (i = 0; i < videoflip_n_formats; i++) {
GstCaps *fromcaps =
- gst_caps_new_full (videoflip_get_cap (videoflip_formats + i), NULL);
+ gst_caps_new_full (videoflip_get_cap (videoflip_formats + i), NULL);
if (gst_caps_is_always_compatible (fromcaps, peercaps)) {
gst_caps_append (capslist, fromcaps);
}
if (format->bpp) {
structure = gst_structure_new ("video/x-raw-rgb",
- "depth", G_TYPE_INT, format->bpp,
- "bpp", G_TYPE_INT, format->depth,
- "endianness", G_TYPE_INT, format->endianness,
- "red_mask", G_TYPE_INT, format->red_mask,
- "green_mask", G_TYPE_INT, format->green_mask,
- "blue_mask", G_TYPE_INT, format->blue_mask, NULL);
+ "depth", G_TYPE_INT, format->bpp,
+ "bpp", G_TYPE_INT, format->depth,
+ "endianness", G_TYPE_INT, format->endianness,
+ "red_mask", G_TYPE_INT, format->red_mask,
+ "green_mask", G_TYPE_INT, format->green_mask,
+ "blue_mask", G_TYPE_INT, format->blue_mask, NULL);
} else {
structure = gst_structure_new ("video/x-raw-yuv",
- "format", GST_TYPE_FOURCC, fourcc, NULL);
+ "format", GST_TYPE_FOURCC, fourcc, NULL);
}
return structure;
c = gst_caps_new_full (videoflip_get_cap (videoflip_formats + i), NULL);
if (c) {
if (gst_caps_is_always_compatible (caps, c)) {
- gst_caps_free (c);
- return videoflip_formats + i;
+ gst_caps_free (c);
+ return videoflip_formats + i;
}
gst_caps_free (c);
}
switch (videoflip->method) {
case GST_VIDEOFLIP_METHOD_90R:
for (y = 0; y < dh; y++) {
- for (x = 0; x < dw; x++) {
- dest[y * dw + x] = src[(sh - 1 - x) * sw + y];
- }
+ for (x = 0; x < dw; x++) {
+ dest[y * dw + x] = src[(sh - 1 - x) * sw + y];
+ }
}
break;
case GST_VIDEOFLIP_METHOD_90L:
for (y = 0; y < dh; y++) {
- for (x = 0; x < dw; x++) {
- dest[y * dw + x] = src[x * sw + (sw - 1 - y)];
- }
+ for (x = 0; x < dw; x++) {
+ dest[y * dw + x] = src[x * sw + (sw - 1 - y)];
+ }
}
break;
case GST_VIDEOFLIP_METHOD_180:
for (y = 0; y < dh; y++) {
- for (x = 0; x < dw; x++) {
- dest[y * dw + x] = src[(sh - 1 - y) * sw + (sw - 1 - x)];
- }
+ for (x = 0; x < dw; x++) {
+ dest[y * dw + x] = src[(sh - 1 - y) * sw + (sw - 1 - x)];
+ }
}
break;
case GST_VIDEOFLIP_METHOD_HORIZ:
for (y = 0; y < dh; y++) {
- for (x = 0; x < dw; x++) {
- dest[y * dw + x] = src[y * sw + (sw - 1 - x)];
- }
+ for (x = 0; x < dw; x++) {
+ dest[y * dw + x] = src[y * sw + (sw - 1 - x)];
+ }
}
break;
case GST_VIDEOFLIP_METHOD_VERT:
for (y = 0; y < dh; y++) {
- for (x = 0; x < dw; x++) {
- dest[y * dw + x] = src[(sh - 1 - y) * sw + x];
- }
+ for (x = 0; x < dw; x++) {
+ dest[y * dw + x] = src[(sh - 1 - y) * sw + x];
+ }
}
break;
case GST_VIDEOFLIP_METHOD_TRANS:
for (y = 0; y < dh; y++) {
- for (x = 0; x < dw; x++) {
- dest[y * dw + x] = src[x * sw + y];
- }
+ for (x = 0; x < dw; x++) {
+ dest[y * dw + x] = src[x * sw + y];
+ }
}
break;
case GST_VIDEOFLIP_METHOD_OTHER:
for (y = 0; y < dh; y++) {
- for (x = 0; x < dw; x++) {
- dest[y * dw + x] = src[(sh - 1 - x) * sw + (sw - 1 - y)];
- }
+ for (x = 0; x < dw; x++) {
+ dest[y * dw + x] = src[(sh - 1 - x) * sw + (sw - 1 - y)];
+ }
}
break;
default:
struct riff_struct
{
- guint8 id[4]; /* RIFF */
+ guint8 id[4]; /* RIFF */
guint32 len;
- guint8 wav_id[4]; /* WAVE */
+ guint8 wav_id[4]; /* WAVE */
};
struct chunk_struct
guint32 dwSamplesPerSec;
guint32 dwAvgBytesPerSec;
guint16 wBlockAlign;
- guint16 wBitsPerSample; /* Only for PCM */
+ guint16 wBitsPerSample; /* Only for PCM */
};
struct wave_header
GST_PAD_SINK,
GST_PAD_ALWAYS,
GST_STATIC_CAPS ("audio/x-raw-int, "
- "rate = (int) [ 1, MAX ], "
- "channels = (int) [ 1, MAX ], "
- "endianness = (int) LITTLE_ENDIAN, "
- "width = (int) { 8, 16 }, "
- "depth = (int) { 8, 16 }, " "signed = (boolean) true")
+ "rate = (int) [ 1, MAX ], "
+ "channels = (int) [ 1, MAX ], "
+ "endianness = (int) LITTLE_ENDIAN, "
+ "width = (int) { 8, 16 }, "
+ "depth = (int) { 8, 16 }, " "signed = (boolean) true")
);
static GstStaticPadTemplate src_factory = GST_STATIC_PAD_TEMPLATE ("src",
gst_wavenc_setup (GstWavEnc * wavenc)
{
struct wave_header wave;
- gint size = 0x7fffffff; /* Use a bogus size initially */
+ gint size = 0x7fffffff; /* Use a bogus size initially */
wave.common.wChannels = wavenc->channels;
wave.common.wBitsPerSample = wavenc->bits;
wavenc->sinkpad =
gst_pad_new_from_template (gst_element_class_get_pad_template (klass,
- "sink"), "sink");
+ "sink"), "sink");
gst_element_add_pad (GST_ELEMENT (wavenc), wavenc->sinkpad);
gst_pad_set_chain_function (wavenc->sinkpad, gst_wavenc_chain);
gst_pad_set_link_function (wavenc->sinkpad, gst_wavenc_sinkconnect);
wavenc->srcpad =
gst_pad_new_from_template (gst_element_class_get_pad_template (klass,
- "src"), "src");
+ "src"), "src");
gst_element_add_pad (GST_ELEMENT (wavenc), wavenc->srcpad);
wavenc->setup = FALSE;
{
guint32 id;
char *name;
-} maps[] = {
+}
+maps[] =
+{
{
- GST_RIFF_INFO_IARL, "Location"}, {
- GST_RIFF_INFO_IART, "Artist"}, {
- GST_RIFF_INFO_ICMS, "Commissioner"}, {
- GST_RIFF_INFO_ICMT, "Comment"}, {
- GST_RIFF_INFO_ICOP, "Copyright"}, {
- GST_RIFF_INFO_ICRD, "Creation Date"}, {
- GST_RIFF_INFO_IENG, "Engineer"}, {
- GST_RIFF_INFO_IGNR, "Genre"}, {
- GST_RIFF_INFO_IKEY, "Keywords"}, {
- GST_RIFF_INFO_INAM, "Title"}, /* Name */
+ GST_RIFF_INFO_IARL, "Location"}
+ , {
+ GST_RIFF_INFO_IART, "Artist"}
+ , {
+ GST_RIFF_INFO_ICMS, "Commissioner"}
+ , {
+ GST_RIFF_INFO_ICMT, "Comment"}
+ , {
+ GST_RIFF_INFO_ICOP, "Copyright"}
+ , {
+ GST_RIFF_INFO_ICRD, "Creation Date"}
+ , {
+ GST_RIFF_INFO_IENG, "Engineer"}
+ , {
+ GST_RIFF_INFO_IGNR, "Genre"}
+ , {
+ GST_RIFF_INFO_IKEY, "Keywords"}
+ , {
+ GST_RIFF_INFO_INAM, "Title"}
+ , /* Name */
{
- GST_RIFF_INFO_IPRD, "Product"}, {
- GST_RIFF_INFO_ISBJ, "Subject"}, {
- GST_RIFF_INFO_ISFT, "Software"}, {
- GST_RIFF_INFO_ITCH, "Technician"}, {
+ GST_RIFF_INFO_IPRD, "Product"}
+ , {
+ GST_RIFF_INFO_ISBJ, "Subject"}
+ , {
+ GST_RIFF_INFO_ISFT, "Software"}
+ , {
+ GST_RIFF_INFO_ITCH, "Technician"}
+ , {
0, NULL}
};
char *tmp;
int len, req, i;
- need_to_write = TRUE; /* We've got at least one entry */
+ need_to_write = TRUE; /* We've got at least one entry */
gst_props_entry_get_string (entry, &text);
- len = strlen (text) + 1; /* The length in the file includes the \0 */
+ len = strlen (text) + 1; /* The length in the file includes the \0 */
tmp = g_strdup_printf (GST_FOURCC_FORMAT "%d%s", GST_FOURCC_ARGS (id),
- GUINT32_TO_LE (len), text);
+ GUINT32_TO_LE (len), text);
g_string_append (info_str, tmp);
g_free (tmp);
/* Check that we end on an even boundary */
req = ((len + 8) + 1) & ~1;
for (i = 0; i < req - len; i++) {
- g_string_append_printf (info_str, "%c", 0);
+ g_string_append_printf (info_str, "%c", 0);
}
total += req;
int num_cues, total = 4;
if (gst_props_get (wavenc->metadata->properties,
- "cues", &cue_list, NULL) == FALSE) {
+ "cues", &cue_list, NULL) == FALSE) {
/* No cues, move along please, nothing to see here */
return;
}
#define LTXT_SIZE 28
ltxt = g_string_new ("ltxt ");
- ltxt->str[8] = GUINT32_TO_LE (i); /* Identifier */
- ltxt->str[12] = GUINT32_TO_LE (0); /* Sample Length */
- ltxt->str[16] = GUINT32_TO_LE (0); /* FIXME: Don't save the purpose yet */
- ltxt->str[20] = GUINT16_TO_LE (0); /* Country */
- ltxt->str[22] = GUINT16_TO_LE (0); /* Language */
- ltxt->str[24] = GUINT16_TO_LE (0); /* Dialect */
- ltxt->str[26] = GUINT16_TO_LE (0); /* Code Page */
+ ltxt->str[8] = GUINT32_TO_LE (i); /* Identifier */
+ ltxt->str[12] = GUINT32_TO_LE (0); /* Sample Length */
+ ltxt->str[16] = GUINT32_TO_LE (0); /* FIXME: Don't save the purpose yet */
+ ltxt->str[20] = GUINT16_TO_LE (0); /* Country */
+ ltxt->str[22] = GUINT16_TO_LE (0); /* Language */
+ ltxt->str[24] = GUINT16_TO_LE (0); /* Dialect */
+ ltxt->str[26] = GUINT16_TO_LE (0); /* Code Page */
g_string_append (ltxt, label);
g_free (label);
/* Check that we end on an even boundary */
req = ((len + 8) + 1) & ~1;
for (j = 0; j < req - len; j++) {
- g_string_append_printf (ltxt, "%c", 0);
+ g_string_append_printf (ltxt, "%c", 0);
}
total += req;
/* Check our size */
req = ((len + 8) + 1) & ~1;
for (j = 0; j < req - len; j++) {
- g_string_append_printf (labl, "%c", 0);
+ g_string_append_printf (labl, "%c", 0);
}
total += req;
/* Size check */
req = ((len + 8) + 1) & ~1;
for (j = 0; j < req - len; j++) {
- g_string_append_printf (note, "%c", 0);
+ g_string_append_printf (note, "%c", 0);
}
total += req;
if (!wavenc->setup) {
gst_buffer_unref (buf);
GST_ELEMENT_ERROR (wavenc, CORE, NEGOTIATION, (NULL),
- ("encoder not initialised (input is not audio?)"));
+ ("encoder not initialised (input is not audio?)"));
return;
}
#if 0
/* Write our metadata if we have any */
if (wavenc->metadata) {
- write_metadata (wavenc);
- write_cues (wavenc);
- write_labels (wavenc);
+ write_metadata (wavenc);
+ write_cues (wavenc);
+ write_labels (wavenc);
}
#endif
GST_PAD_SRC,
GST_PAD_ALWAYS,
GST_STATIC_CAPS ("audio/x-raw-int, "
- "endianness = (int) little_endian, "
- "signed = (boolean) { true, false }, "
- "width = (int) { 8, 16 }, "
- "depth = (int) { 8, 16 }, "
- "rate = (int) [ 8000, 48000 ], "
- "channels = (int) [ 1, 2 ]; "
- "audio/mpeg, "
- "mpegversion = (int) 1, "
- "layer = (int) [ 1, 3 ], "
- "rate = (int) [ 8000, 48000 ], "
- "channels = (int) [ 1, 2 ]; "
- "audio/x-alaw, "
- "rate = (int) [ 8000, 48000 ], "
- "channels = (int) [ 1, 2 ]; "
- "audio/x-mulaw, "
- "rate = (int) [ 8000, 48000 ], " "channels = (int) [ 1, 2 ]")
+ "endianness = (int) little_endian, "
+ "signed = (boolean) { true, false }, "
+ "width = (int) { 8, 16 }, "
+ "depth = (int) { 8, 16 }, "
+ "rate = (int) [ 8000, 48000 ], "
+ "channels = (int) [ 1, 2 ]; "
+ "audio/mpeg, "
+ "mpegversion = (int) 1, "
+ "layer = (int) [ 1, 3 ], "
+ "rate = (int) [ 8000, 48000 ], "
+ "channels = (int) [ 1, 2 ]; "
+ "audio/x-alaw, "
+ "rate = (int) [ 8000, 48000 ], "
+ "channels = (int) [ 1, 2 ]; "
+ "audio/x-mulaw, "
+ "rate = (int) [ 8000, 48000 ], " "channels = (int) [ 1, 2 ]")
);
/* WavParse signals and args */
0,
(GInstanceInitFunc) gst_wavparse_init,
};
+
wavparse_type =
- g_type_register_static (GST_TYPE_ELEMENT, "GstWavParse", &wavparse_info,
- 0);
+ g_type_register_static (GST_TYPE_ELEMENT, "GstWavParse", &wavparse_info,
+ 0);
}
return wavparse_type;
}
while (len > 0) {
got_bytes =
- gst_bytestream_peek_bytes (bs, &tempdata, sizeof (gst_riff_chunk));
+ gst_bytestream_peek_bytes (bs, &tempdata, sizeof (gst_riff_chunk));
if (got_bytes != sizeof (gst_riff_chunk)) {
return;
}
switch (chunk.id) {
case GST_RIFF_adtl_labl:
- got_bytes =
- gst_bytestream_peek_bytes (bs, &tempdata,
- sizeof (struct _gst_riff_labl));
- if (got_bytes != sizeof (struct _gst_riff_labl)) {
- return;
- }
+ got_bytes =
+ gst_bytestream_peek_bytes (bs, &tempdata,
+ sizeof (struct _gst_riff_labl));
+ if (got_bytes != sizeof (struct _gst_riff_labl)) {
+ return;
+ }
- temp_labl = (struct _gst_riff_labl *) tempdata;
- labl.id = GUINT32_FROM_LE (temp_labl->id);
- labl.size = GUINT32_FROM_LE (temp_labl->size);
- labl.identifier = GUINT32_FROM_LE (temp_labl->identifier);
+ temp_labl = (struct _gst_riff_labl *) tempdata;
+ labl.id = GUINT32_FROM_LE (temp_labl->id);
+ labl.size = GUINT32_FROM_LE (temp_labl->size);
+ labl.identifier = GUINT32_FROM_LE (temp_labl->identifier);
- gst_bytestream_flush (bs, sizeof (struct _gst_riff_labl));
- len -= sizeof (struct _gst_riff_labl);
+ gst_bytestream_flush (bs, sizeof (struct _gst_riff_labl));
+ len -= sizeof (struct _gst_riff_labl);
- got_bytes = gst_bytestream_peek_bytes (bs, &tempdata, labl.size - 4);
- if (got_bytes != labl.size - 4) {
- return;
- }
+ got_bytes = gst_bytestream_peek_bytes (bs, &tempdata, labl.size - 4);
+ if (got_bytes != labl.size - 4) {
+ return;
+ }
- label_name = (char *) tempdata;
+ label_name = (char *) tempdata;
- gst_bytestream_flush (bs, ((labl.size - 4) + 1) & ~1);
- len -= (((labl.size - 4) + 1) & ~1);
+ gst_bytestream_flush (bs, ((labl.size - 4) + 1) & ~1);
+ len -= (((labl.size - 4) + 1) & ~1);
- new_caps = gst_caps_new ("label",
- "application/x-gst-metadata",
- gst_props_new ("identifier", G_TYPE_INT (labl.identifier),
- "name", G_TYPE_STRING (label_name), NULL));
+ new_caps = gst_caps_new ("label",
+ "application/x-gst-metadata",
+ gst_props_new ("identifier", G_TYPE_INT (labl.identifier),
+ "name", G_TYPE_STRING (label_name), NULL));
- if (gst_props_get (props, "labels", &caps, NULL)) {
- caps = g_list_append (caps, new_caps);
- } else {
- caps = g_list_append (NULL, new_caps);
+ if (gst_props_get (props, "labels", &caps, NULL)) {
+ caps = g_list_append (caps, new_caps);
+ } else {
+ caps = g_list_append (NULL, new_caps);
- entry = gst_props_entry_new ("labels", GST_PROPS_GLIST (caps));
- gst_props_add_entry (props, entry);
- }
+ entry = gst_props_entry_new ("labels", GST_PROPS_GLIST (caps));
+ gst_props_add_entry (props, entry);
+ }
- break;
+ break;
case GST_RIFF_adtl_ltxt:
- got_bytes =
- gst_bytestream_peek_bytes (bs, &tempdata,
- sizeof (struct _gst_riff_ltxt));
- if (got_bytes != sizeof (struct _gst_riff_ltxt)) {
- return;
- }
-
- temp_ltxt = (struct _gst_riff_ltxt *) tempdata;
- ltxt.id = GUINT32_FROM_LE (temp_ltxt->id);
- ltxt.size = GUINT32_FROM_LE (temp_ltxt->size);
- ltxt.identifier = GUINT32_FROM_LE (temp_ltxt->identifier);
- ltxt.length = GUINT32_FROM_LE (temp_ltxt->length);
- ltxt.purpose = GUINT32_FROM_LE (temp_ltxt->purpose);
- ltxt.country = GUINT16_FROM_LE (temp_ltxt->country);
- ltxt.language = GUINT16_FROM_LE (temp_ltxt->language);
- ltxt.dialect = GUINT16_FROM_LE (temp_ltxt->dialect);
- ltxt.codepage = GUINT16_FROM_LE (temp_ltxt->codepage);
-
- gst_bytestream_flush (bs, sizeof (struct _gst_riff_ltxt));
- len -= sizeof (struct _gst_riff_ltxt);
-
- if (ltxt.size - 20 > 0) {
- got_bytes = gst_bytestream_peek_bytes (bs, &tempdata, ltxt.size - 20);
- if (got_bytes != ltxt.size - 20) {
- return;
- }
-
- gst_bytestream_flush (bs, ((ltxt.size - 20) + 1) & ~1);
- len -= (((ltxt.size - 20) + 1) & ~1);
-
- label_name = (char *) tempdata;
- } else {
- label_name = "";
- }
-
- new_caps = gst_caps_new ("ltxt",
- "application/x-gst-metadata",
- gst_props_new ("identifier", G_TYPE_INT (ltxt.identifier),
- "name", G_TYPE_STRING (label_name),
- "length", G_TYPE_INT (ltxt.length), NULL));
-
- if (gst_props_get (props, "ltxts", &caps, NULL)) {
- caps = g_list_append (caps, new_caps);
- } else {
- caps = g_list_append (NULL, new_caps);
-
- entry = gst_props_entry_new ("ltxts", GST_PROPS_GLIST (caps));
- gst_props_add_entry (props, entry);
- }
-
- break;
+ got_bytes =
+ gst_bytestream_peek_bytes (bs, &tempdata,
+ sizeof (struct _gst_riff_ltxt));
+ if (got_bytes != sizeof (struct _gst_riff_ltxt)) {
+ return;
+ }
+
+ temp_ltxt = (struct _gst_riff_ltxt *) tempdata;
+ ltxt.id = GUINT32_FROM_LE (temp_ltxt->id);
+ ltxt.size = GUINT32_FROM_LE (temp_ltxt->size);
+ ltxt.identifier = GUINT32_FROM_LE (temp_ltxt->identifier);
+ ltxt.length = GUINT32_FROM_LE (temp_ltxt->length);
+ ltxt.purpose = GUINT32_FROM_LE (temp_ltxt->purpose);
+ ltxt.country = GUINT16_FROM_LE (temp_ltxt->country);
+ ltxt.language = GUINT16_FROM_LE (temp_ltxt->language);
+ ltxt.dialect = GUINT16_FROM_LE (temp_ltxt->dialect);
+ ltxt.codepage = GUINT16_FROM_LE (temp_ltxt->codepage);
+
+ gst_bytestream_flush (bs, sizeof (struct _gst_riff_ltxt));
+ len -= sizeof (struct _gst_riff_ltxt);
+
+ if (ltxt.size - 20 > 0) {
+ got_bytes = gst_bytestream_peek_bytes (bs, &tempdata, ltxt.size - 20);
+ if (got_bytes != ltxt.size - 20) {
+ return;
+ }
+
+ gst_bytestream_flush (bs, ((ltxt.size - 20) + 1) & ~1);
+ len -= (((ltxt.size - 20) + 1) & ~1);
+
+ label_name = (char *) tempdata;
+ } else {
+ label_name = "";
+ }
+
+ new_caps = gst_caps_new ("ltxt",
+ "application/x-gst-metadata",
+ gst_props_new ("identifier", G_TYPE_INT (ltxt.identifier),
+ "name", G_TYPE_STRING (label_name),
+ "length", G_TYPE_INT (ltxt.length), NULL));
+
+ if (gst_props_get (props, "ltxts", &caps, NULL)) {
+ caps = g_list_append (caps, new_caps);
+ } else {
+ caps = g_list_append (NULL, new_caps);
+
+ entry = gst_props_entry_new ("ltxts", GST_PROPS_GLIST (caps));
+ gst_props_add_entry (props, entry);
+ }
+
+ break;
case GST_RIFF_adtl_note:
- got_bytes =
- gst_bytestream_peek_bytes (bs, &tempdata,
- sizeof (struct _gst_riff_note));
- if (got_bytes != sizeof (struct _gst_riff_note)) {
- return;
- }
+ got_bytes =
+ gst_bytestream_peek_bytes (bs, &tempdata,
+ sizeof (struct _gst_riff_note));
+ if (got_bytes != sizeof (struct _gst_riff_note)) {
+ return;
+ }
- temp_note = (struct _gst_riff_note *) tempdata;
- note.id = GUINT32_FROM_LE (temp_note->id);
- note.size = GUINT32_FROM_LE (temp_note->size);
- note.identifier = GUINT32_FROM_LE (temp_note->identifier);
+ temp_note = (struct _gst_riff_note *) tempdata;
+ note.id = GUINT32_FROM_LE (temp_note->id);
+ note.size = GUINT32_FROM_LE (temp_note->size);
+ note.identifier = GUINT32_FROM_LE (temp_note->identifier);
- gst_bytestream_flush (bs, sizeof (struct _gst_riff_note));
- len -= sizeof (struct _gst_riff_note);
+ gst_bytestream_flush (bs, sizeof (struct _gst_riff_note));
+ len -= sizeof (struct _gst_riff_note);
- got_bytes = gst_bytestream_peek_bytes (bs, &tempdata, note.size - 4);
- if (got_bytes != note.size - 4) {
- return;
- }
+ got_bytes = gst_bytestream_peek_bytes (bs, &tempdata, note.size - 4);
+ if (got_bytes != note.size - 4) {
+ return;
+ }
- gst_bytestream_flush (bs, ((note.size - 4) + 1) & ~1);
- len -= (((note.size - 4) + 1) & ~1);
+ gst_bytestream_flush (bs, ((note.size - 4) + 1) & ~1);
+ len -= (((note.size - 4) + 1) & ~1);
- label_name = (char *) tempdata;
+ label_name = (char *) tempdata;
- new_caps = gst_caps_new ("note",
- "application/x-gst-metadata",
- gst_props_new ("identifier", G_TYPE_INT (note.identifier),
- "name", G_TYPE_STRING (label_name), NULL));
+ new_caps = gst_caps_new ("note",
+ "application/x-gst-metadata",
+ gst_props_new ("identifier", G_TYPE_INT (note.identifier),
+ "name", G_TYPE_STRING (label_name), NULL));
- if (gst_props_get (props, "notes", &caps, NULL)) {
- caps = g_list_append (caps, new_caps);
- } else {
- caps = g_list_append (NULL, new_caps);
+ if (gst_props_get (props, "notes", &caps, NULL)) {
+ caps = g_list_append (caps, new_caps);
+ } else {
+ caps = g_list_append (NULL, new_caps);
- entry = gst_props_entry_new ("notes", GST_PROPS_GLIST (caps));
- gst_props_add_entry (props, entry);
- }
+ entry = gst_props_entry_new ("notes", GST_PROPS_GLIST (caps));
+ gst_props_add_entry (props, entry);
+ }
- break;
+ break;
default:
- g_print ("Unknown chunk: " GST_FOURCC_FORMAT "\n",
- GST_FOURCC_ARGS (chunk.id));
- return;
+ g_print ("Unknown chunk: " GST_FOURCC_FORMAT "\n",
+ GST_FOURCC_ARGS (chunk.id));
+ return;
}
}
while (len > 0) {
got_bytes =
- gst_bytestream_peek_bytes (bs, &tempdata, sizeof (gst_riff_chunk));
+ gst_bytestream_peek_bytes (bs, &tempdata, sizeof (gst_riff_chunk));
temp_chunk = (gst_riff_chunk *) tempdata;
chunk.id = GUINT32_FROM_LE (temp_chunk->id);
- find type */
switch (chunk.id) {
case GST_RIFF_INFO_IARL:
- type = "Location";
- break;
+ type = "Location";
+ break;
case GST_RIFF_INFO_IART:
- type = "Artist";
- break;
+ type = "Artist";
+ break;
case GST_RIFF_INFO_ICMS:
- type = "Commissioner";
- break;
+ type = "Commissioner";
+ break;
case GST_RIFF_INFO_ICMT:
- type = "Comment";
- break;
+ type = "Comment";
+ break;
case GST_RIFF_INFO_ICOP:
- type = "Copyright";
- break;
+ type = "Copyright";
+ break;
case GST_RIFF_INFO_ICRD:
- type = "Creation Date";
- break;
+ type = "Creation Date";
+ break;
case GST_RIFF_INFO_IENG:
- type = "Engineer";
- break;
+ type = "Engineer";
+ break;
case GST_RIFF_INFO_IGNR:
- type = "Genre";
- break;
+ type = "Genre";
+ break;
case GST_RIFF_INFO_IKEY:
- type = "Keywords";
- break;
+ type = "Keywords";
+ break;
case GST_RIFF_INFO_INAM:
- type = "Title"; /* name */
- break;
+ type = "Title"; /* name */
+ break;
case GST_RIFF_INFO_IPRD:
- type = "Product";
- break;
+ type = "Product";
+ break;
case GST_RIFF_INFO_ISBJ:
- type = "Subject";
- break;
+ type = "Subject";
+ break;
case GST_RIFF_INFO_ISFT:
- type = "Software";
- break;
+ type = "Software";
+ break;
case GST_RIFF_INFO_ITCH:
- type = "Technician";
- break;
+ type = "Technician";
+ break;
default:
- g_print ("Unknown: %4.4s\n", (char *) &chunk.id);
- type = NULL;
- break;
+ g_print ("Unknown: %4.4s\n", (char *) &chunk.id);
+ type = NULL;
+ break;
}
if (type) {
int required;
got_bytes =
- gst_bytestream_peek_bytes (bs, &tempdata,
- sizeof (struct _gst_riff_cue));
+ gst_bytestream_peek_bytes (bs, &tempdata,
+ sizeof (struct _gst_riff_cue));
temp_cue = (struct _gst_riff_cue *) tempdata;
/* fixup for our big endian friends */
GstCaps *caps;
caps = gst_caps_new ("cues",
- "application/x-gst-metadata",
- gst_props_new ("identifier", G_TYPE_INT (points[i].identifier),
- "position", G_TYPE_INT (points[i].offset), NULL));
+ "application/x-gst-metadata",
+ gst_props_new ("identifier", G_TYPE_INT (points[i].identifier),
+ "position", G_TYPE_INT (points[i].offset), NULL));
cues = g_list_append (cues, caps);
}
switch (wavparse->format) {
case GST_RIFF_WAVE_FORMAT_ALAW:
case GST_RIFF_WAVE_FORMAT_MULAW:{
- char *mime = (wavparse->format == GST_RIFF_WAVE_FORMAT_ALAW) ?
- "audio/x-alaw" : "audio/x-mulaw";
- if (wavparse->width != 8) {
- g_warning ("Ignoring invalid width %d", wavparse->width);
- return;
- }
-
- caps = gst_caps_new_simple (mime,
- "rate", G_TYPE_INT, wavparse->rate,
- "channels", G_TYPE_INT, wavparse->channels, NULL);
+ char *mime = (wavparse->format == GST_RIFF_WAVE_FORMAT_ALAW) ?
+ "audio/x-alaw" : "audio/x-mulaw";
+ if (wavparse->width != 8) {
+ g_warning ("Ignoring invalid width %d", wavparse->width);
+ return;
+ }
+
+ caps = gst_caps_new_simple (mime,
+ "rate", G_TYPE_INT, wavparse->rate,
+ "channels", G_TYPE_INT, wavparse->channels, NULL);
}
- break;
+ break;
case GST_RIFF_WAVE_FORMAT_PCM:
- caps = gst_caps_new_simple ("audio/x-raw-int",
- "endianness", G_TYPE_INT, G_LITTLE_ENDIAN,
- "signed", G_TYPE_BOOLEAN, (wavparse->width > 8) ? TRUE : FALSE,
- "width", G_TYPE_INT, wavparse->width,
- "depth", G_TYPE_INT, wavparse->width,
- "rate", G_TYPE_INT, wavparse->rate,
- "channels", G_TYPE_INT, wavparse->channels, NULL);
- break;
+ caps = gst_caps_new_simple ("audio/x-raw-int",
+ "endianness", G_TYPE_INT, G_LITTLE_ENDIAN,
+ "signed", G_TYPE_BOOLEAN, (wavparse->width > 8) ? TRUE : FALSE,
+ "width", G_TYPE_INT, wavparse->width,
+ "depth", G_TYPE_INT, wavparse->width,
+ "rate", G_TYPE_INT, wavparse->rate,
+ "channels", G_TYPE_INT, wavparse->channels, NULL);
+ break;
case GST_RIFF_WAVE_FORMAT_MPEGL12:
case GST_RIFF_WAVE_FORMAT_MPEGL3:{
- int layer = (wavparse->format == GST_RIFF_WAVE_FORMAT_MPEGL12) ? 2 : 3;
+ int layer = (wavparse->format == GST_RIFF_WAVE_FORMAT_MPEGL12) ? 2 : 3;
- caps = gst_caps_new_simple ("audio/mpeg",
- "mpegversion", G_TYPE_INT, 1,
- "layer", G_TYPE_INT, layer,
- "rate", G_TYPE_INT, wavparse->rate,
- "channels", G_TYPE_INT, wavparse->channels, NULL);
+ caps = gst_caps_new_simple ("audio/mpeg",
+ "mpegversion", G_TYPE_INT, 1,
+ "layer", G_TYPE_INT, layer,
+ "rate", G_TYPE_INT, wavparse->rate,
+ "channels", G_TYPE_INT, wavparse->channels, NULL);
}
- break;
+ break;
default:
- GST_ELEMENT_ERROR (wavparse, STREAM, NOT_IMPLEMENTED, (NULL),
- ("format %d not handled", wavparse->format));
- return;
+ GST_ELEMENT_ERROR (wavparse, STREAM, NOT_IMPLEMENTED, (NULL),
+ ("format %d not handled", wavparse->format));
+ return;
}
if (caps) {
if (wavparse->seek_pending) {
GST_DEBUG ("wavparse: seek pending to %" G_GINT64_FORMAT " %08llx",
- wavparse->seek_offset, (unsigned long long) wavparse->seek_offset);
+ wavparse->seek_offset, (unsigned long long) wavparse->seek_offset);
if (!gst_bytestream_seek (bs, wavparse->seek_offset, GST_SEEK_METHOD_SET)) {
GST_INFO ("wavparse: Could not seek");
got_bytes = gst_bytestream_peek (bs, &buf, desired);
if (got_bytes != desired) {
- /* EOS? */
- GstEvent *event;
- guint32 remaining;
-
- gst_bytestream_get_status (bs, &remaining, &event);
- if (event && GST_EVENT_TYPE (event) == GST_EVENT_EOS) {
- gst_pad_event_default (wavparse->sinkpad, event);
- } else {
- GST_ELEMENT_ERROR (element, RESOURCE, READ, (NULL), (NULL));
- }
- return;
+ /* EOS? */
+ GstEvent *event;
+ guint32 remaining;
+
+ gst_bytestream_get_status (bs, &remaining, &event);
+ if (event && GST_EVENT_TYPE (event) == GST_EVENT_EOS) {
+ gst_pad_event_default (wavparse->sinkpad, event);
+ } else {
+ GST_ELEMENT_ERROR (element, RESOURCE, READ, (NULL), (NULL));
+ }
+ return;
}
wavparse->dataleft -= got_bytes;
/* read first two dwords to get chunktype and size */
while (TRUE) {
got_bytes =
- gst_bytestream_peek_bytes (bs, &tempdata, sizeof (gst_riff_chunk));
+ gst_bytestream_peek_bytes (bs, &tempdata, sizeof (gst_riff_chunk));
temp_chunk = (gst_riff_riff *) tempdata;
if (got_bytes < sizeof (gst_riff_chunk)) {
- if (!gst_wavparse_handle_sink_event (wavparse)) {
- return;
- }
+ if (!gst_wavparse_handle_sink_event (wavparse)) {
+ return;
+ }
} else {
- break;
+ break;
}
}
switch (chunk.id) {
case GST_RIFF_TAG_RIFF:
case GST_RIFF_TAG_LIST:
- /* Read complete list chunk */
- while (TRUE) {
- got_bytes =
- gst_bytestream_peek_bytes (bs, &tempdata, sizeof (gst_riff_list));
- temp_chunk = (gst_riff_riff *) tempdata;
- if (got_bytes < sizeof (gst_riff_list)) {
- if (!gst_wavparse_handle_sink_event (wavparse)) {
- return;
- }
- } else {
- break;
- }
- }
-
- chunk.type = GUINT32_FROM_LE (temp_chunk->type);
- skipsize = sizeof (gst_riff_list);
- break;
+ /* Read complete list chunk */
+ while (TRUE) {
+ got_bytes =
+ gst_bytestream_peek_bytes (bs, &tempdata, sizeof (gst_riff_list));
+ temp_chunk = (gst_riff_riff *) tempdata;
+ if (got_bytes < sizeof (gst_riff_list)) {
+ if (!gst_wavparse_handle_sink_event (wavparse)) {
+ return;
+ }
+ } else {
+ break;
+ }
+ }
+
+ chunk.type = GUINT32_FROM_LE (temp_chunk->type);
+ skipsize = sizeof (gst_riff_list);
+ break;
case GST_RIFF_TAG_cue:
- skipsize = 0;
- break;
+ skipsize = 0;
+ break;
default:
- skipsize = sizeof (gst_riff_chunk);
- break;
+ skipsize = sizeof (gst_riff_chunk);
+ break;
}
gst_bytestream_flush (bs, skipsize);
} while (FALSE);
switch (wavparse->state) {
case GST_WAVPARSE_START:
if (chunk.id != GST_RIFF_TAG_RIFF && chunk.type != GST_RIFF_RIFF_WAVE) {
- GST_ELEMENT_ERROR (element, STREAM, WRONG_TYPE, (NULL),
- ("chunk.id %08x chunk.type %08x", chunk.id, chunk.type));
- return;
+ GST_ELEMENT_ERROR (element, STREAM, WRONG_TYPE, (NULL),
+ ("chunk.id %08x chunk.type %08x", chunk.id, chunk.type));
+ return;
}
wavparse->state = GST_WAVPARSE_OTHER;
GST_DEBUG ("riff tag: %4.4s %08x", (char *) &chunk.id, chunk.size);
switch (chunk.id) {
- case GST_RIFF_TAG_data:
- wavparse->state = GST_WAVPARSE_DATA;
- wavparse->dataleft = chunk.size;
- wavparse->byteoffset = 0;
- flush = 0;
- break;
-
- case GST_RIFF_TAG_fmt:
- gst_wavparse_parse_fmt (wavparse, chunk.size);
- flush = 0;
- break;
-
- case GST_RIFF_TAG_cue:
- //gst_wavparse_parse_cues (wavparse, chunk.size);
- break;
-
- case GST_RIFF_TAG_LIST:
- GST_DEBUG ("list type: %4.4s", (char *) &chunk.type);
- switch (chunk.type) {
- case GST_RIFF_LIST_INFO:
- //gst_wavparse_parse_info (wavparse, chunk.size - 4);
- //flush = 0;
-
- break;
-
- case GST_RIFF_LIST_adtl:
- //gst_wavparse_parse_adtl (wavparse, chunk.size - 4);
- //flush = 0;
- break;
-
- default:
- //flush = 0;
- break;
- }
-
- default:
- GST_DEBUG (" ***** unknown chunkid %08x", chunk.id);
- //flush = 0;
- break;
+ case GST_RIFF_TAG_data:
+ wavparse->state = GST_WAVPARSE_DATA;
+ wavparse->dataleft = chunk.size;
+ wavparse->byteoffset = 0;
+ flush = 0;
+ break;
+
+ case GST_RIFF_TAG_fmt:
+ gst_wavparse_parse_fmt (wavparse, chunk.size);
+ flush = 0;
+ break;
+
+ case GST_RIFF_TAG_cue:
+ //gst_wavparse_parse_cues (wavparse, chunk.size);
+ break;
+
+ case GST_RIFF_TAG_LIST:
+ GST_DEBUG ("list type: %4.4s", (char *) &chunk.type);
+ switch (chunk.type) {
+ case GST_RIFF_LIST_INFO:
+ //gst_wavparse_parse_info (wavparse, chunk.size - 4);
+ //flush = 0;
+
+ break;
+
+ case GST_RIFF_LIST_adtl:
+ //gst_wavparse_parse_adtl (wavparse, chunk.size - 4);
+ //flush = 0;
+ break;
+
+ default:
+ //flush = 0;
+ break;
+ }
+
+ default:
+ GST_DEBUG (" ***** unknown chunkid %08x", chunk.id);
+ //flush = 0;
+ break;
}
break;
static GstFormat formats[] = {
GST_FORMAT_TIME,
GST_FORMAT_BYTES,
- GST_FORMAT_DEFAULT, /* a "frame", ie a set of samples per Hz */
+ GST_FORMAT_DEFAULT, /* a "frame", ie a set of samples per Hz */
0,
0
};
+
return formats;
}
bytes_per_sample = wavparse->channels * wavparse->width / 8;
if (bytes_per_sample == 0) {
GST_DEBUG ("bytes_per_sample 0, probably an mp3 - channels %d, width %d",
- wavparse->channels, wavparse->width);
+ wavparse->channels, wavparse->width);
return FALSE;
}
byterate = (glong) (bytes_per_sample * wavparse->rate);
switch (src_format) {
case GST_FORMAT_BYTES:
if (*dest_format == GST_FORMAT_DEFAULT)
- *dest_value = src_value / bytes_per_sample;
+ *dest_value = src_value / bytes_per_sample;
else if (*dest_format == GST_FORMAT_TIME)
- *dest_value = src_value * GST_SECOND / byterate;
+ *dest_value = src_value * GST_SECOND / byterate;
else {
- GST_DEBUG ("can't convert from bytes to other than units/time");
- return FALSE;
+ GST_DEBUG ("can't convert from bytes to other than units/time");
+ return FALSE;
}
break;
case GST_FORMAT_DEFAULT:
if (*dest_format == GST_FORMAT_BYTES)
- *dest_value = src_value * bytes_per_sample;
+ *dest_value = src_value * bytes_per_sample;
else if (*dest_format == GST_FORMAT_TIME)
- *dest_value = src_value * GST_SECOND / wavparse->rate;
+ *dest_value = src_value * GST_SECOND / wavparse->rate;
else {
- GST_DEBUG ("can't convert from units to other than bytes/time");
- return FALSE;
+ GST_DEBUG ("can't convert from units to other than bytes/time");
+ return FALSE;
}
break;
case GST_FORMAT_TIME:
if (*dest_format == GST_FORMAT_BYTES)
- *dest_value = src_value * byterate / GST_SECOND;
+ *dest_value = src_value * byterate / GST_SECOND;
else if (*dest_format == GST_FORMAT_DEFAULT)
- *dest_value = src_value * wavparse->rate / GST_SECOND;
+ *dest_value = src_value * wavparse->rate / GST_SECOND;
else {
- GST_DEBUG ("can't convert from time to other than bytes/units");
- return FALSE;
+ GST_DEBUG ("can't convert from time to other than bytes/units");
+ return FALSE;
}
*dest_value = *dest_value & ~(bytes_per_sample - 1);
GST_QUERY_POSITION,
0
};
+
return types;
}
/* only support byte, time and unit queries */
wavparse = GST_WAVPARSE (gst_pad_get_parent (pad));
if (!gst_pad_query (GST_PAD_PEER (wavparse->sinkpad), type,
- &peer_format, &peer_value)) {
+ &peer_format, &peer_value)) {
GST_DEBUG ("Could not query sink pad's peer");
return FALSE;
}
if (!gst_pad_convert (wavparse->sinkpad, peer_format, peer_value,
- format, value)) {
+ format, value)) {
GST_DEBUG ("Could not convert sink pad's peer");
return FALSE;
}
{GST_EVENT_SEEK, GST_SEEK_METHOD_SET | GST_SEEK_FLAG_FLUSH},
{0,}
};
+
return gst_wavparse_src_event_masks;
}
/* we can only seek when in the DATA state */
if (wavparse->state != GST_WAVPARSE_DATA) {
- return FALSE;
+ return FALSE;
}
format = GST_FORMAT_BYTES;
/* bring format to bytes for the peer element,
* FIXME be smarter here */
res = gst_pad_convert (pad,
- GST_EVENT_SEEK_FORMAT (event),
- GST_EVENT_SEEK_OFFSET (event), &format, &byteoffset);
+ GST_EVENT_SEEK_FORMAT (event),
+ GST_EVENT_SEEK_OFFSET (event), &format, &byteoffset);
if (res) {
- /* ok, seek worked, update our state */
- wavparse->seek_offset = byteoffset;
- wavparse->seek_pending = TRUE;
- wavparse->need_discont = TRUE;
+ /* ok, seek worked, update our state */
+ wavparse->seek_offset = byteoffset;
+ wavparse->seek_pending = TRUE;
+ wavparse->need_discont = TRUE;
}
break;
}
return FALSE;
if (!gst_element_register (plugin, "ossmixer", GST_RANK_PRIMARY,
- GST_TYPE_OSSELEMENT) ||
+ GST_TYPE_OSSELEMENT) ||
!gst_element_register (plugin, "osssrc", GST_RANK_PRIMARY,
- GST_TYPE_OSSSRC) ||
+ GST_TYPE_OSSSRC) ||
!gst_element_register (plugin, "osssink", GST_RANK_PRIMARY,
- GST_TYPE_OSSSINK)) {
+ GST_TYPE_OSSSINK)) {
return FALSE;
}
};
osselement_type = g_type_register_static (GST_TYPE_ELEMENT,
- "GstOssElement", &osselement_info, 0);
+ "GstOssElement", &osselement_info, 0);
g_type_add_interface_static (osselement_type,
- GST_TYPE_IMPLEMENTS_INTERFACE, &ossiface_info);
+ GST_TYPE_IMPLEMENTS_INTERFACE, &ossiface_info);
g_type_add_interface_static (osselement_type,
- GST_TYPE_MIXER, &ossmixer_info);
+ GST_TYPE_MIXER, &ossmixer_info);
g_type_add_interface_static (osselement_type,
- GST_TYPE_PROPERTY_PROBE, &ossprobe_info);
+ GST_TYPE_PROPERTY_PROBE, &ossprobe_info);
}
return osselement_type;
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_DEVICE,
g_param_spec_string ("device", "Device", "OSS device (/dev/dspN usually)",
- "default", G_PARAM_READWRITE));
+ "default", G_PARAM_READWRITE));
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_MIXERDEV,
g_param_spec_string ("mixerdev", "Mixer device",
- "OSS mixer device (/dev/mixerN usually)",
- "default", G_PARAM_READWRITE));
+ "OSS mixer device (/dev/mixerN usually)",
+ "default", G_PARAM_READWRITE));
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_DEVICE_NAME,
g_param_spec_string ("device_name", "Device name", "Name of the device",
- NULL, G_PARAM_READABLE));
+ NULL, G_PARAM_READABLE));
gobject_class->set_property = gst_osselement_set_property;
gobject_class->get_property = gst_osselement_get_property;
gint fd;
for (n = -1; n < MAX_OSS_DEVICES; n++) {
- gchar *dsp = NULL;
- gchar *mixer = NULL;
- dev_t dsp_dev;
- dev_t mixer_dev;
-
- gst_osselement_probe (dev_base[base][DSP], n, &dsp, &dsp_dev);
- if (dsp == NULL) {
- continue;
- }
- gst_osselement_probe (dev_base[base][MIXER], n, &mixer, &mixer_dev);
- /* does the device exist (can we open them)? */
-
- /* we just check the dsp. we assume the mixer always works.
- * we don't need a mixer anyway (says OSS)... If we are a
- * mixer element, we use the mixer anyway. */
- if ((fd = open (mixer ? mixer :
- dsp, openmode | O_NONBLOCK)) > 0 || errno == EBUSY) {
- GstOssDeviceCombination *combi;
-
- if (fd > 0)
- close (fd);
-
- /* yay! \o/ */
- combi = g_new0 (GstOssDeviceCombination, 1);
- combi->dsp = dsp;
- combi->mixer = mixer;
- device_combinations = device_combination_append (device_combinations,
- combi);
- } else {
- g_free (dsp);
- g_free (mixer);
- }
+ gchar *dsp = NULL;
+ gchar *mixer = NULL;
+ dev_t dsp_dev;
+ dev_t mixer_dev;
+
+ gst_osselement_probe (dev_base[base][DSP], n, &dsp, &dsp_dev);
+ if (dsp == NULL) {
+ continue;
+ }
+ gst_osselement_probe (dev_base[base][MIXER], n, &mixer, &mixer_dev);
+ /* does the device exist (can we open them)? */
+
+ /* we just check the dsp. we assume the mixer always works.
+ * we don't need a mixer anyway (says OSS)... If we are a
+ * mixer element, we use the mixer anyway. */
+ if ((fd = open (mixer ? mixer :
+ dsp, openmode | O_NONBLOCK)) > 0 || errno == EBUSY) {
+ GstOssDeviceCombination *combi;
+
+ if (fd > 0)
+ close (fd);
+
+ /* yay! \o/ */
+ combi = g_new0 (GstOssDeviceCombination, 1);
+ combi->dsp = dsp;
+ combi->mixer = mixer;
+ device_combinations = device_combination_append (device_combinations,
+ combi);
+ } else {
+ g_free (dsp);
+ g_free (mixer);
+ }
}
}
if (law == 0) {
if (width == 16) {
if (sign == TRUE) {
- if (endianness == G_LITTLE_ENDIAN) {
- *format = AFMT_S16_LE;
- GST_DEBUG ("16 bit signed LE, no law (%d)", *format);
- } else if (endianness == G_BIG_ENDIAN) {
- *format = AFMT_S16_BE;
- GST_DEBUG ("16 bit signed BE, no law (%d)", *format);
- }
+ if (endianness == G_LITTLE_ENDIAN) {
+ *format = AFMT_S16_LE;
+ GST_DEBUG ("16 bit signed LE, no law (%d)", *format);
+ } else if (endianness == G_BIG_ENDIAN) {
+ *format = AFMT_S16_BE;
+ GST_DEBUG ("16 bit signed BE, no law (%d)", *format);
+ }
} else {
- if (endianness == G_LITTLE_ENDIAN) {
- *format = AFMT_U16_LE;
- GST_DEBUG ("16 bit unsigned LE, no law (%d)", *format);
- } else if (endianness == G_BIG_ENDIAN) {
- *format = AFMT_U16_BE;
- GST_DEBUG ("16 bit unsigned BE, no law (%d)", *format);
- }
+ if (endianness == G_LITTLE_ENDIAN) {
+ *format = AFMT_U16_LE;
+ GST_DEBUG ("16 bit unsigned LE, no law (%d)", *format);
+ } else if (endianness == G_BIG_ENDIAN) {
+ *format = AFMT_U16_BE;
+ GST_DEBUG ("16 bit unsigned BE, no law (%d)", *format);
+ }
}
*bps = 2;
} else if (width == 8) {
if (sign == TRUE) {
- *format = AFMT_S8;
- GST_DEBUG ("8 bit signed, no law (%d)", *format);
+ *format = AFMT_S8;
+ GST_DEBUG ("8 bit signed, no law (%d)", *format);
} else {
- *format = AFMT_U8;
- GST_DEBUG ("8 bit unsigned, no law (%d)", *format);
+ *format = AFMT_U8;
+ GST_DEBUG ("8 bit unsigned, no law (%d)", *format);
}
*bps = 1;
}
gst_structure_get_boolean (structure, "signed", &oss->sign);
if (!gst_ossformat_get (oss->law, oss->endianness, oss->sign,
- oss->width, oss->depth, &format, &bps)) {
+ oss->width, oss->depth, &format, &bps)) {
GST_DEBUG ("could not get format");
return FALSE;
}
gst_structure_get_int (structure, "depth", &oss->depth);
if (!gst_ossformat_get (oss->law, oss->endianness, oss->sign,
- oss->width, oss->depth, &format, &bps)) {
+ oss->width, oss->depth, &format, &bps)) {
return FALSE;
}
target_channels != oss->channels || target_rate != oss->rate) {
if (target_channels != oss->channels)
g_warning
- ("couldn't set the right number of channels (wanted %d, got %d), enjoy the tone difference",
- target_channels, oss->channels);
+ ("couldn't set the right number of channels (wanted %d, got %d), enjoy the tone difference",
+ target_channels, oss->channels);
if (target_rate != oss->rate)
g_warning
- ("couldn't set the right sample rate (wanted %d, got %d), enjoy the speed difference",
- target_rate, oss->rate);
+ ("couldn't set the right sample rate (wanted %d, got %d), enjoy the speed difference",
+ target_rate, oss->rate);
if (target_format != oss->format)
g_warning ("couldn't set requested OSS format, enjoy the noise :)");
/* we could eventually return FALSE here, or just do some additional tests
if (oss->fd < 0) {
switch (errno) {
case EBUSY:
- GST_ELEMENT_ERROR (oss, RESOURCE, BUSY,
- (_("OSS device \"%s\" is already in use by another program."),
- oss->device), (NULL));
- break;
+ GST_ELEMENT_ERROR (oss, RESOURCE, BUSY,
+ (_("OSS device \"%s\" is already in use by another program."),
+ oss->device), (NULL));
+ break;
case EACCES:
case ETXTBSY:
- if (mode == GST_OSSELEMENT_WRITE)
- GST_ELEMENT_ERROR (oss, RESOURCE, OPEN_WRITE,
- (_("Could not access device \"%s\", check its permissions."),
- oss->device), GST_ERROR_SYSTEM);
- else
- GST_ELEMENT_ERROR (oss, RESOURCE, OPEN_READ,
- (_("Could not access device \"%s\", check its permissions."),
- oss->device), GST_ERROR_SYSTEM);
- break;
+ if (mode == GST_OSSELEMENT_WRITE)
+ GST_ELEMENT_ERROR (oss, RESOURCE, OPEN_WRITE,
+ (_("Could not access device \"%s\", check its permissions."),
+ oss->device), GST_ERROR_SYSTEM);
+ else
+ GST_ELEMENT_ERROR (oss, RESOURCE, OPEN_READ,
+ (_("Could not access device \"%s\", check its permissions."),
+ oss->device), GST_ERROR_SYSTEM);
+ break;
case ENXIO:
case ENODEV:
case ENOENT:
- GST_ELEMENT_ERROR (oss, RESOURCE, NOT_FOUND,
- (_("Device \"%s\" does not exist."), oss->device),
- GST_ERROR_SYSTEM);
- break;
+ GST_ELEMENT_ERROR (oss, RESOURCE, NOT_FOUND,
+ (_("Device \"%s\" does not exist."), oss->device),
+ GST_ERROR_SYSTEM);
+ break;
default:
- /* FIXME: strerror is not threadsafe */
- if (mode == GST_OSSELEMENT_WRITE)
- GST_ELEMENT_ERROR (oss, RESOURCE, OPEN_WRITE,
- (_("Could not open device \"%s\" for writing."), oss->device),
- GST_ERROR_SYSTEM);
- else
- GST_ELEMENT_ERROR (oss, RESOURCE, OPEN_READ,
- (_("Could not open device \"%s\" for reading."), oss->device),
- GST_ERROR_SYSTEM);
- break;
+ /* FIXME: strerror is not threadsafe */
+ if (mode == GST_OSSELEMENT_WRITE)
+ GST_ELEMENT_ERROR (oss, RESOURCE, OPEN_WRITE,
+ (_("Could not open device \"%s\" for writing."), oss->device),
+ GST_ERROR_SYSTEM);
+ else
+ GST_ELEMENT_ERROR (oss, RESOURCE, OPEN_READ,
+ (_("Could not open device \"%s\" for reading."), oss->device),
+ GST_ERROR_SYSTEM);
+ break;
}
return FALSE;
}
switch (src_format) {
case GST_FORMAT_BYTES:
switch (*dest_format) {
- case GST_FORMAT_TIME:
- *dest_value = src_value * GST_SECOND / oss->bps;
- break;
- case GST_FORMAT_DEFAULT:
- *dest_value = src_value / (oss->width * oss->channels / 8);
- break;
- default:
- res = FALSE;
+ case GST_FORMAT_TIME:
+ *dest_value = src_value * GST_SECOND / oss->bps;
+ break;
+ case GST_FORMAT_DEFAULT:
+ *dest_value = src_value / (oss->width * oss->channels / 8);
+ break;
+ default:
+ res = FALSE;
}
break;
case GST_FORMAT_TIME:
switch (*dest_format) {
- case GST_FORMAT_BYTES:
- *dest_value = src_value * oss->bps / GST_SECOND;
- break;
- case GST_FORMAT_DEFAULT:
- *dest_value = src_value * oss->rate / GST_SECOND;
- break;
- default:
- res = FALSE;
+ case GST_FORMAT_BYTES:
+ *dest_value = src_value * oss->bps / GST_SECOND;
+ break;
+ case GST_FORMAT_DEFAULT:
+ *dest_value = src_value * oss->rate / GST_SECOND;
+ break;
+ default:
+ res = FALSE;
}
break;
case GST_FORMAT_DEFAULT:
switch (*dest_format) {
- case GST_FORMAT_TIME:
- *dest_value = src_value * GST_SECOND / oss->rate;
- break;
- case GST_FORMAT_BYTES:
- *dest_value = src_value * oss->width * oss->channels / 8;
- break;
- default:
- res = FALSE;
+ case GST_FORMAT_TIME:
+ *dest_value = src_value * GST_SECOND / oss->rate;
+ break;
+ case GST_FORMAT_BYTES:
+ *dest_value = src_value * oss->width * oss->channels / 8;
+ break;
+ default:
+ res = FALSE;
}
break;
default:
/* disallow changing the device while it is opened
get_property("device") should return the right one */
if (gst_element_get_state (GST_ELEMENT (oss)) == GST_STATE_NULL) {
- g_free (oss->device);
- oss->device = g_strdup (g_value_get_string (value));
-
- /* let's assume that if we have a device map for the mixer,
- * we're allowed to do all that automagically here */
- if (GST_OSSELEMENT_GET_CLASS (oss)->device_combinations != NULL) {
- GList *list = GST_OSSELEMENT_GET_CLASS (oss)->device_combinations;
-
- while (list) {
- GstOssDeviceCombination *combi = list->data;
-
- if (!strcmp (combi->dsp, oss->device)) {
- g_free (oss->mixer_dev);
- oss->mixer_dev = g_strdup (combi->mixer);
- break;
- }
-
- list = list->next;
- }
- }
+ g_free (oss->device);
+ oss->device = g_strdup (g_value_get_string (value));
+
+ /* let's assume that if we have a device map for the mixer,
+ * we're allowed to do all that automagically here */
+ if (GST_OSSELEMENT_GET_CLASS (oss)->device_combinations != NULL) {
+ GList *list = GST_OSSELEMENT_GET_CLASS (oss)->device_combinations;
+
+ while (list) {
+ GstOssDeviceCombination *combi = list->data;
+
+ if (!strcmp (combi->dsp, oss->device)) {
+ g_free (oss->mixer_dev);
+ oss->mixer_dev = g_strdup (combi->mixer);
+ break;
+ }
+
+ list = list->next;
+ }
+ }
}
break;
case ARG_MIXERDEV:
/* disallow changing the device while it is opened
get_property("mixerdev") should return the right one */
if (gst_element_get_state (GST_ELEMENT (oss)) == GST_STATE_NULL) {
- g_free (oss->mixer_dev);
- oss->mixer_dev = g_strdup (g_value_get_string (value));
+ g_free (oss->mixer_dev);
+ oss->mixer_dev = g_strdup (g_value_get_string (value));
}
break;
default:
switch (GST_STATE_TRANSITION (element)) {
case GST_STATE_NULL_TO_READY:
if (!gst_osselement_open_audio (oss)) {
- return GST_STATE_FAILURE;
+ return GST_STATE_FAILURE;
}
GST_INFO ("osselement: opened sound device");
break;
struct
{
gchar *given, *wanted;
- } cases[] = {
+ }
+ cases[] =
+ {
/* Note: this list is simply ripped from soundcard.h. For
* some people, some values might be missing (3D surround,
* etc.) - feel free to add them. That's the reason why
* I'm doing this in such a horribly complicated way. */
{
- "Vol ", _("Volume")}, {
- "Bass ", _("Bass")}, {
- "Trebl", _("Treble")}, {
- "Synth", _("Synth")}, {
- "Pcm ", _("PCM")}, {
- "Spkr ", _("Speaker")}, {
- "Line ", _("Line-in")}, {
- "Mic ", _("Microphone")}, {
- "CD ", _("CD")}, {
- "Mix ", _("Mixer")}, {
- "Pcm2 ", _("PCM-2")}, {
- "Rec ", _("Record")}, {
- "IGain", _("In-gain")}, {
- "OGain", _("Out-gain")}, {
- "Line1", _("Line-1")}, {
- "Line2", _("Line-2")}, {
- "Line3", _("Line-3")}, {
- "Digital1", _("Digital-1")}, {
- "Digital2", _("Digital-2")}, {
- "Digital3", _("Digital-3")}, {
- "PhoneIn", _("Phone-in")}, {
- "PhoneOut", _("Phone-out")}, {
- "Video", _("Video")}, {
- "Radio", _("Radio")}, {
- "Monitor", _("Monitor")}, {
+ "Vol ", _("Volume")}
+ , {
+ "Bass ", _("Bass")}
+ , {
+ "Trebl", _("Treble")}
+ , {
+ "Synth", _("Synth")}
+ , {
+ "Pcm ", _("PCM")}
+ , {
+ "Spkr ", _("Speaker")}
+ , {
+ "Line ", _("Line-in")}
+ , {
+ "Mic ", _("Microphone")}
+ , {
+ "CD ", _("CD")}
+ , {
+ "Mix ", _("Mixer")}
+ , {
+ "Pcm2 ", _("PCM-2")}
+ , {
+ "Rec ", _("Record")}
+ , {
+ "IGain", _("In-gain")}
+ , {
+ "OGain", _("Out-gain")}
+ , {
+ "Line1", _("Line-1")}
+ , {
+ "Line2", _("Line-2")}
+ , {
+ "Line3", _("Line-3")}
+ , {
+ "Digital1", _("Digital-1")}
+ , {
+ "Digital2", _("Digital-2")}
+ , {
+ "Digital3", _("Digital-3")}
+ , {
+ "PhoneIn", _("Phone-in")}
+ , {
+ "PhoneOut", _("Phone-out")}
+ , {
+ "Video", _("Video")}
+ , {
+ "Radio", _("Radio")}
+ , {
+ "Monitor", _("Monitor")}
+ , {
NULL, NULL}
};
for (i = 0; i < SOUND_MIXER_NRDEVICES; i++) {
for (pos = 0; cases[pos].given != NULL; pos++) {
if (!strcmp (cases[pos].given, origs[i])) {
- labels[i] = g_strdup (cases[pos].wanted);
- break;
+ labels[i] = g_strdup (cases[pos].wanted);
+ break;
}
}
if (cases[pos].given == NULL)
};
gst_ossmixer_track_type =
- g_type_register_static (GST_TYPE_MIXER_TRACK,
- "GstOssMixerTrack", &ossmixer_track_info, 0);
+ g_type_register_static (GST_TYPE_MIXER_TRACK,
+ "GstOssMixerTrack", &ossmixer_track_info, 0);
}
return gst_ossmixer_track_type;
/* volume */
if (ioctl (oss->mixer_fd, MIXER_READ (osstrack->track_num), &volume) < 0) {
g_warning ("Error getting device (%d) volume: %s",
- osstrack->track_num, strerror (errno));
+ osstrack->track_num, strerror (errno));
volume = 0;
}
osstrack->lvol = (volume & 0xff);
/* get */
if (ioctl (oss->mixer_fd, MIXER_READ (osstrack->track_num), &volume) < 0) {
g_warning ("Error getting recording device (%d) volume: %s",
- osstrack->track_num, strerror (errno));
+ osstrack->track_num, strerror (errno));
volume = 0;
}
/* set */
if (ioctl (oss->mixer_fd, MIXER_WRITE (osstrack->track_num), &volume) < 0) {
g_warning ("Error setting recording device (%d) volume (0x%x): %s",
- osstrack->track_num, volume, strerror (errno));
+ osstrack->track_num, volume, strerror (errno));
return;
}
}
if (ioctl (oss->mixer_fd, MIXER_WRITE (osstrack->track_num), &volume) < 0) {
g_warning ("Error setting mixer recording device volume (0x%x): %s",
- volume, strerror (errno));
+ volume, strerror (errno));
return;
}
/* set it to the device */
if (ioctl (oss->mixer_fd, SOUND_MIXER_WRITE_RECSRC, &oss->recdevs) < 0) {
g_warning ("Error setting mixer recording devices (0x%x): %s",
- oss->recdevs, strerror (errno));
+ oss->recdevs, strerror (errno));
return;
}
if (oss->mixer_fd == -1) {
/* this is valid. OSS devices don't need to expose a mixer */
GST_DEBUG ("Failed to open mixer device %s, mixing disabled: %s",
- oss->mixer_dev, strerror (errno));
+ oss->mixer_dev, strerror (errno));
return;
}
else if (devmask & SOUND_MASK_PCM)
master = SOUND_MIXER_PCM;
else if (devmask & SOUND_MASK_SPEAKER)
- master = SOUND_MIXER_SPEAKER; /* doubtful... */
+ master = SOUND_MIXER_SPEAKER; /* doubtful... */
/* else: no master, so we won't set any */
/* build track list */
/* track exists, make up capabilities */
if (MASK_BIT_IS_SET (oss->stereomask, i))
- stereo = TRUE;
+ stereo = TRUE;
if (MASK_BIT_IS_SET (oss->recmask, i))
- input = TRUE;
+ input = TRUE;
if (MASK_BIT_IS_SET (oss->recdevs, i))
- record = TRUE;
+ record = TRUE;
/* do we want this in our list? */
if ((dir == GST_PAD_SRC && input == FALSE) ||
- (dir == GST_PAD_SINK && i != SOUND_MIXER_PCM))
- continue;
+ (dir == GST_PAD_SINK && i != SOUND_MIXER_PCM))
+ continue;
/* add track to list */
track = gst_ossmixer_track_new (oss, i, stereo ? 2 : 1,
- (record ? GST_MIXER_TRACK_RECORD : 0) |
- (input ? GST_MIXER_TRACK_INPUT :
- GST_MIXER_TRACK_OUTPUT) |
- ((master != i) ? 0 : GST_MIXER_TRACK_MASTER));
+ (record ? GST_MIXER_TRACK_RECORD : 0) |
+ (input ? GST_MIXER_TRACK_INPUT :
+ GST_MIXER_TRACK_OUTPUT) |
+ ((master != i) ? 0 : GST_MIXER_TRACK_MASTER));
oss->tracklist = g_list_append (oss->tracklist, track);
}
}
GST_PAD_SINK,
GST_PAD_ALWAYS,
GST_STATIC_CAPS ("audio/x-raw-int, "
- "endianness = (int) BYTE_ORDER, "
- "signed = (boolean) { TRUE, FALSE }, "
- "width = (int) { 8, 16 }, "
- "depth = (int) { 8, 16 }, "
- "rate = (int) [ 1000, 48000 ], " "channels = (int) [ 1, 2 ]")
+ "endianness = (int) BYTE_ORDER, "
+ "signed = (boolean) { TRUE, FALSE }, "
+ "width = (int) { 8, 16 }, "
+ "depth = (int) { 8, 16 }, "
+ "rate = (int) [ 1000, 48000 ], " "channels = (int) [ 1, 2 ]")
);
static GstElementClass *parent_class = NULL;
0,
(GInstanceInitFunc) gst_osssink_init,
};
+
osssink_type =
- g_type_register_static (GST_TYPE_OSSELEMENT, "GstOssSink",
- &osssink_info, 0);
+ g_type_register_static (GST_TYPE_OSSELEMENT, "GstOssSink",
+ &osssink_info, 0);
}
return osssink_type;
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_MUTE,
g_param_spec_boolean ("mute", "Mute", "Mute the audio",
- FALSE, G_PARAM_READWRITE));
+ FALSE, G_PARAM_READWRITE));
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_SYNC,
g_param_spec_boolean ("sync", "Sync",
- "If syncing on timestamps should be enabled", TRUE,
- G_PARAM_READWRITE));
+ "If syncing on timestamps should be enabled", TRUE,
+ G_PARAM_READWRITE));
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_FRAGMENT,
g_param_spec_int ("fragment", "Fragment",
- "The fragment as 0xMMMMSSSS (MMMM = total fragments, 2^SSSS = fragment size)",
- 0, G_MAXINT, 6, G_PARAM_READWRITE));
+ "The fragment as 0xMMMMSSSS (MMMM = total fragments, 2^SSSS = fragment size)",
+ 0, G_MAXINT, 6, G_PARAM_READWRITE));
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_BUFFER_SIZE,
g_param_spec_uint ("buffer_size", "Buffer size",
- "Size of buffers in osssink's bufferpool (bytes)", 0, G_MAXINT, 4096,
- G_PARAM_READWRITE));
+ "Size of buffers in osssink's bufferpool (bytes)", 0, G_MAXINT, 4096,
+ G_PARAM_READWRITE));
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_CHUNK_SIZE,
g_param_spec_uint ("chunk_size", "Chunk size",
- "Write data in chunk sized buffers", 0, G_MAXUINT, 4096,
- G_PARAM_READWRITE));
+ "Write data in chunk sized buffers", 0, G_MAXUINT, 4096,
+ G_PARAM_READWRITE));
gst_osssink_signals[SIGNAL_HANDOFF] =
g_signal_new ("handoff", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST,
switch (GST_EVENT_TYPE (event)) {
case GST_EVENT_EOS:
- ioctl (GST_OSSELEMENT (osssink)->fd, SNDCTL_DSP_SYNC, 0);
- gst_audio_clock_set_active (GST_AUDIO_CLOCK (osssink->provided_clock),
- FALSE);
- gst_pad_event_default (pad, event);
- return;
+ ioctl (GST_OSSELEMENT (osssink)->fd, SNDCTL_DSP_SYNC, 0);
+ gst_audio_clock_set_active (GST_AUDIO_CLOCK (osssink->provided_clock),
+ FALSE);
+ gst_pad_event_default (pad, event);
+ return;
case GST_EVENT_DISCONTINUOUS:
- osssink->resync = TRUE;
- /* pass-through */
+ osssink->resync = TRUE;
+ /* pass-through */
default:
- gst_pad_event_default (pad, event);
- return;
+ gst_pad_event_default (pad, event);
+ return;
}
g_assert_not_reached ();
}
if (!GST_OSSELEMENT (osssink)->bps) {
gst_buffer_unref (buf);
GST_ELEMENT_ERROR (osssink, CORE, NEGOTIATION, (NULL),
- ("format wasn't negotiated before chain function"));
+ ("format wasn't negotiated before chain function"));
return;
}
if (MAX (buftime, soundtime) - MIN (buftime, soundtime) > (GST_SECOND / 10)) {
/* we need to adjust to the buffers here */
GST_INFO_OBJECT (osssink,
- "need sync: real %" G_GUINT64_FORMAT ", buffer: %" G_GUINT64_FORMAT,
- soundtime, buftime);
+ "need sync: real %" G_GUINT64_FORMAT ", buffer: %" G_GUINT64_FORMAT,
+ soundtime, buftime);
if (soundtime > buftime) {
/* do *not* throw frames out. It's useless. The next frame will come in
* too late. And the next one. And so on. We don't want to lose sound.
* sending events upstream to drop buffers. */
} else {
guint64 to_handle =
- (((buftime -
- soundtime) * GST_OSSELEMENT (osssink)->bps / GST_SECOND) /
- ((GST_OSSELEMENT (osssink)->width / 8) *
- GST_OSSELEMENT (osssink)->channels)) *
- (GST_OSSELEMENT (osssink)->width / 8) *
- GST_OSSELEMENT (osssink)->channels;
+ (((buftime -
+ soundtime) * GST_OSSELEMENT (osssink)->bps / GST_SECOND) /
+ ((GST_OSSELEMENT (osssink)->width / 8) *
+ GST_OSSELEMENT (osssink)->channels)) *
+ (GST_OSSELEMENT (osssink)->width / 8) *
+ GST_OSSELEMENT (osssink)->channels;
if (!osssink->resync) {
- guint8 *buf = g_new (guint8, to_handle);
-
- memset (buf, (GST_OSSELEMENT (osssink)->width == 8) ? 0 : 128,
- to_handle);
- while (to_handle > 0) {
- gint done = write (GST_OSSELEMENT (osssink)->fd, buf,
- MIN (to_handle, osssink->chunk_size));
-
- if (done == -1 && errno != EINTR) {
- break;
- } else {
- to_handle -= done;
- osssink->handled += done;
- }
- }
- g_free (buf);
+ guint8 *buf = g_new (guint8, to_handle);
+
+ memset (buf, (GST_OSSELEMENT (osssink)->width == 8) ? 0 : 128,
+ to_handle);
+ while (to_handle > 0) {
+ gint done = write (GST_OSSELEMENT (osssink)->fd, buf,
+ MIN (to_handle, osssink->chunk_size));
+
+ if (done == -1 && errno != EINTR) {
+ break;
+ } else {
+ to_handle -= done;
+ osssink->handled += done;
+ }
+ }
+ g_free (buf);
} else {
- /* Timestamps at start-of-stream (MPEG) or after seek (hey,
- * again MPEG!) can be borken, therefore this hacklet. */
- osssink->handled += to_handle;
+ /* Timestamps at start-of-stream (MPEG) or after seek (hey,
+ * again MPEG!) can be borken, therefore this hacklet. */
+ osssink->handled += to_handle;
}
}
}
if (!osssink->mute) {
while (to_write > 0) {
- gint done = write (GST_OSSELEMENT (osssink)->fd, data,
- MIN (to_write, osssink->chunk_size));
-
- if (done == -1) {
- if (errno != EINTR)
- break;
- } else {
- to_write -= done;
- data += done;
- osssink->handled += done;
- }
+ gint done = write (GST_OSSELEMENT (osssink)->fd, data,
+ MIN (to_write, osssink->chunk_size));
+
+ if (done == -1) {
+ if (errno != EINTR)
+ break;
+ } else {
+ to_write -= done;
+ data += done;
+ osssink->handled += done;
+ }
}
} else {
g_warning ("muting osssinks unimplemented wrt clocks!");
GST_FORMAT_BYTES,
0
};
+
return formats;
}
GST_QUERY_POSITION,
0,
};
+
return query_types;
}
switch (type) {
case GST_QUERY_LATENCY:
if (!gst_osssink_convert (pad,
- GST_FORMAT_BYTES, gst_osssink_get_delay (osssink),
- format, value)) {
- res = FALSE;
+ GST_FORMAT_BYTES, gst_osssink_get_delay (osssink),
+ format, value)) {
+ res = FALSE;
}
break;
case GST_QUERY_POSITION:
if (!gst_osssink_convert (pad,
- GST_FORMAT_TIME, gst_element_get_time (GST_ELEMENT (osssink)),
- format, value)) {
- res = FALSE;
+ GST_FORMAT_TIME, gst_element_get_time (GST_ELEMENT (osssink)),
+ format, value)) {
+ res = FALSE;
}
break;
default:
res =
- gst_pad_query (gst_pad_get_peer (osssink->sinkpad), type, format,
- value);
+ gst_pad_query (gst_pad_get_peer (osssink->sinkpad), type, format,
+ value);
break;
}
break;
case GST_STATE_PAUSED_TO_PLAYING:
gst_audio_clock_set_active (GST_AUDIO_CLOCK (osssink->provided_clock),
- TRUE);
+ TRUE);
break;
case GST_STATE_PLAYING_TO_PAUSED:
if (GST_FLAG_IS_SET (element, GST_OSSSINK_OPEN))
- ioctl (GST_OSSELEMENT (osssink)->fd, SNDCTL_DSP_RESET, 0);
+ ioctl (GST_OSSELEMENT (osssink)->fd, SNDCTL_DSP_RESET, 0);
gst_audio_clock_set_active (GST_AUDIO_CLOCK (osssink->provided_clock),
- FALSE);
+ FALSE);
break;
case GST_STATE_PAUSED_TO_READY:
if (GST_FLAG_IS_SET (element, GST_OSSSINK_OPEN))
- ioctl (GST_OSSELEMENT (osssink)->fd, SNDCTL_DSP_RESET, 0);
+ ioctl (GST_OSSELEMENT (osssink)->fd, SNDCTL_DSP_RESET, 0);
gst_osselement_reset (GST_OSSELEMENT (osssink));
osssink->handled = 0;
osssink->resync = TRUE;
GST_PAD_SRC,
GST_PAD_ALWAYS,
GST_STATIC_CAPS ("audio/x-raw-int, "
- "endianness = (int) BYTE_ORDER, "
- "signed = (boolean) { TRUE, FALSE }, "
- "width = (int) { 8, 16 }, "
- "depth = (int) { 8, 16 }, "
- "rate = (int) [ 1000, 48000 ], " "channels = (int) [ 1, 2 ]")
+ "endianness = (int) BYTE_ORDER, "
+ "signed = (boolean) { TRUE, FALSE }, "
+ "width = (int) { 8, 16 }, "
+ "depth = (int) { 8, 16 }, "
+ "rate = (int) [ 1000, 48000 ], " "channels = (int) [ 1, 2 ]")
);
static void gst_osssrc_base_init (gpointer g_class);
0,
(GInstanceInitFunc) gst_osssrc_init,
};
+
osssrc_type =
- g_type_register_static (GST_TYPE_OSSELEMENT, "GstOssSrc", &osssrc_info,
- 0);
+ g_type_register_static (GST_TYPE_OSSELEMENT, "GstOssSrc", &osssrc_info,
+ 0);
}
return osssrc_type;
}
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_BUFFERSIZE,
g_param_spec_ulong ("buffersize", "Buffer Size",
- "The size of the buffers with samples", 0, G_MAXULONG, 0,
- G_PARAM_READWRITE));
+ "The size of the buffers with samples", 0, G_MAXULONG, 0,
+ G_PARAM_READWRITE));
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_FRAGMENT,
g_param_spec_int ("fragment", "Fragment",
- "The fragment as 0xMMMMSSSS (MMMM = total fragments, 2^SSSS = fragment size)",
- 0, G_MAXINT, 6, G_PARAM_READWRITE));
+ "The fragment as 0xMMMMSSSS (MMMM = total fragments, 2^SSSS = fragment size)",
+ 0, G_MAXINT, 6, G_PARAM_READWRITE));
gobject_class->set_property = gst_osssrc_set_property;
gobject_class->get_property = gst_osssrc_get_property;
/* set caps on src pad */
if (gst_pad_try_set_caps (src->srcpad,
- gst_caps_new_simple ("audio/x-raw-int",
- "endianness", G_TYPE_INT, GST_OSSELEMENT (src)->endianness,
- "signed", G_TYPE_BOOLEAN, GST_OSSELEMENT (src)->sign,
- "width", G_TYPE_INT, GST_OSSELEMENT (src)->width,
- "depth", G_TYPE_INT, GST_OSSELEMENT (src)->depth,
- "rate", G_TYPE_INT, GST_OSSELEMENT (src)->rate,
- "channels", G_TYPE_INT, GST_OSSELEMENT (src)->channels,
- NULL)) <= 0) {
+ gst_caps_new_simple ("audio/x-raw-int",
+ "endianness", G_TYPE_INT, GST_OSSELEMENT (src)->endianness,
+ "signed", G_TYPE_BOOLEAN, GST_OSSELEMENT (src)->sign,
+ "width", G_TYPE_INT, GST_OSSELEMENT (src)->width,
+ "depth", G_TYPE_INT, GST_OSSELEMENT (src)->depth,
+ "rate", G_TYPE_INT, GST_OSSELEMENT (src)->rate,
+ "channels", G_TYPE_INT, GST_OSSELEMENT (src)->channels,
+ NULL)) <= 0) {
return FALSE;
}
return TRUE;
if (GST_OSSELEMENT (src)->bps == 0) {
gst_buffer_unref (buf);
GST_ELEMENT_ERROR (src, CORE, NEGOTIATION, (NULL),
- ("format wasn't negotiated before chain function"));
+ ("format wasn't negotiated before chain function"));
return GST_DATA (gst_event_new (GST_EVENT_INTERRUPT));
}
break;
case GST_STATE_PAUSED_TO_PLAYING:
gst_audio_clock_set_active (GST_AUDIO_CLOCK (osssrc->provided_clock),
- TRUE);
+ TRUE);
break;
case GST_STATE_PLAYING_TO_PAUSED:
gst_audio_clock_set_active (GST_AUDIO_CLOCK (osssrc->provided_clock),
- FALSE);
+ FALSE);
break;
case GST_STATE_PAUSED_TO_READY:
if (GST_FLAG_IS_SET (element, GST_OSSSRC_OPEN))
- ioctl (GST_OSSELEMENT (osssrc)->fd, SNDCTL_DSP_RESET, 0);
+ ioctl (GST_OSSELEMENT (osssrc)->fd, SNDCTL_DSP_RESET, 0);
break;
default:
break;
GST_FORMAT_BYTES,
0
};
+
return formats;
}
{GST_EVENT_SIZE, 0},
{0,}
};
+
return gst_osssrc_src_event_masks;
}
/* convert to bytes */
if (gst_osselement_convert (GST_OSSELEMENT (osssrc),
- GST_EVENT_SIZE_FORMAT (event),
- GST_EVENT_SIZE_VALUE (event), &format, &value)) {
- osssrc->buffersize = GST_EVENT_SIZE_VALUE (event);
- g_object_notify (G_OBJECT (osssrc), "buffersize");
- retval = TRUE;
+ GST_EVENT_SIZE_FORMAT (event),
+ GST_EVENT_SIZE_VALUE (event), &format, &value)) {
+ osssrc->buffersize = GST_EVENT_SIZE_VALUE (event);
+ g_object_notify (G_OBJECT (osssrc), "buffersize");
+ retval = TRUE;
}
}
default:
GST_QUERY_POSITION,
0,
};
+
return query_types;
}
switch (type) {
case GST_QUERY_POSITION:
res = gst_osselement_convert (GST_OSSELEMENT (osssrc),
- GST_FORMAT_BYTES, osssrc->curoffset, format, value);
+ GST_FORMAT_BYTES, osssrc->curoffset, format, value);
break;
default:
break;
return FALSE;
if (!gst_element_register (plugin, "v4l2element",
- GST_RANK_NONE, GST_TYPE_V4L2ELEMENT) ||
+ GST_RANK_NONE, GST_TYPE_V4L2ELEMENT) ||
!gst_element_register (plugin, "v4l2src",
- GST_RANK_NONE, GST_TYPE_V4L2SRC))
+ GST_RANK_NONE, GST_TYPE_V4L2SRC))
return FALSE;
#ifdef ENABLE_NLS
};
gst_v4l2_color_balance_channel_type =
- g_type_register_static (GST_TYPE_COLOR_BALANCE_CHANNEL,
- "GstV4l2ColorBalanceChannel", &v4l2_tuner_channel_info, 0);
+ g_type_register_static (GST_TYPE_COLOR_BALANCE_CHANNEL,
+ "GstV4l2ColorBalanceChannel", &v4l2_tuner_channel_info, 0);
}
return gst_v4l2_color_balance_channel_type;
/* assert that we're opened and that we're using a known item */
g_return_if_fail (GST_V4L2_IS_OPEN (v4l2element));
g_return_if_fail (gst_v4l2_color_balance_contains_channel (v4l2element,
- v4l2channel));
+ v4l2channel));
gst_v4l2_set_attribute (v4l2element, v4l2channel->index, value);
}
/* assert that we're opened and that we're using a known item */
g_return_val_if_fail (GST_V4L2_IS_OPEN (v4l2element), 0);
g_return_val_if_fail (gst_v4l2_color_balance_contains_channel (v4l2element,
- v4l2channel), 0);
+ v4l2channel), 0);
if (!gst_v4l2_get_attribute (v4l2element, v4l2channel->index, &value))
return 0;
/* 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);
}
}
};
v4l2element_type =
- g_type_register_static (GST_TYPE_ELEMENT,
- "GstV4l2Element", &v4l2element_info, 0);
+ g_type_register_static (GST_TYPE_ELEMENT,
+ "GstV4l2Element", &v4l2element_info, 0);
g_type_add_interface_static (v4l2element_type,
- GST_TYPE_IMPLEMENTS_INTERFACE, &v4l2iface_info);
+ GST_TYPE_IMPLEMENTS_INTERFACE, &v4l2iface_info);
g_type_add_interface_static (v4l2element_type,
- GST_TYPE_TUNER, &v4l2_tuner_info);
+ GST_TYPE_TUNER, &v4l2_tuner_info);
g_type_add_interface_static (v4l2element_type,
- GST_TYPE_X_OVERLAY, &v4l2_xoverlay_info);
+ GST_TYPE_X_OVERLAY, &v4l2_xoverlay_info);
g_type_add_interface_static (v4l2element_type,
- GST_TYPE_COLOR_BALANCE, &v4l2_colorbalance_info);
+ GST_TYPE_COLOR_BALANCE, &v4l2_colorbalance_info);
g_type_add_interface_static (v4l2element_type,
- GST_TYPE_PROPERTY_PROBE, &v4l2_propertyprobe_info);
+ GST_TYPE_PROPERTY_PROBE, &v4l2_propertyprobe_info);
}
return v4l2element_type;
if (v4l2_device_type == 0) {
static const GFlagsValue values[] = {
{V4L2_CAP_VIDEO_CAPTURE, "CAPTURE",
- "Device can capture"},
+ "Device can capture"},
{V4L2_CAP_VIDEO_OUTPUT, "PLAYBACK",
- "Device can playback"},
+ "Device can playback"},
{V4L2_CAP_VIDEO_OVERLAY, "OVERLAY",
- "Device can do overlay"},
+ "Device can do overlay"},
{V4L2_CAP_TUNER, "TUNER",
- "Device has a tuner"},
+ "Device has a tuner"},
{V4L2_CAP_AUDIO, "AUDIO",
- "Device handles audio"},
+ "Device handles audio"},
{0, NULL, NULL}
};
v4l2_device_type =
- g_flags_register_static ("GstV4l2DeviceTypeFlags", values);
+ g_flags_register_static ("GstV4l2DeviceTypeFlags", values);
}
return v4l2_device_type;
g_object_class_install_property (gobject_class, ARG_DEVICE,
g_param_spec_string ("device", "Device", "Device location",
- NULL, G_PARAM_READWRITE));
+ NULL, G_PARAM_READWRITE));
g_object_class_install_property (gobject_class, ARG_DEVICE_NAME,
g_param_spec_string ("device_name", "Device name",
- "Name of the device", NULL, G_PARAM_READABLE));
+ "Name of the device", NULL, G_PARAM_READABLE));
g_object_class_install_property (gobject_class, ARG_FLAGS,
g_param_spec_flags ("flags", "Flags", "Device type flags",
- GST_TYPE_V4L2_DEVICE_FLAGS, 0, G_PARAM_READABLE));
+ GST_TYPE_V4L2_DEVICE_FLAGS, 0, G_PARAM_READABLE));
g_object_class_install_property (gobject_class, ARG_NORM,
g_param_spec_string ("norm", "norm",
- "Norm to use", NULL, G_PARAM_READWRITE));
+ "Norm to use", NULL, G_PARAM_READWRITE));
g_object_class_install_property (gobject_class, ARG_CHANNEL,
g_param_spec_string ("channel", "channel",
- "input/output to switch to", NULL, G_PARAM_READWRITE));
+ "input/output to switch to", NULL, G_PARAM_READWRITE));
g_object_class_install_property (gobject_class, ARG_FREQUENCY,
g_param_spec_ulong ("frequency", "frequency",
- "frequency to tune to", 0, G_MAXULONG, 0, G_PARAM_READWRITE));
+ "frequency to tune to", 0, G_MAXULONG, 0, G_PARAM_READWRITE));
/* signals */
gst_v4l2element_signals[SIGNAL_OPEN] =
switch (prop_id) {
case ARG_DEVICE:
if (!GST_V4L2_IS_OPEN (v4l2element)) {
- if (v4l2element->device)
- g_free (v4l2element->device);
- v4l2element->device = g_value_dup_string (value);
+ if (v4l2element->device)
+ g_free (v4l2element->device);
+ v4l2element->device = g_value_dup_string (value);
}
break;
case ARG_NORM:
if (GST_V4L2_IS_OPEN (v4l2element)) {
- GstTunerNorm *norm = gst_tuner_get_norm (tuner);
+ GstTunerNorm *norm = gst_tuner_get_norm (tuner);
- if (norm) {
- gst_tuner_set_norm (tuner, norm);
- }
+ if (norm) {
+ gst_tuner_set_norm (tuner, norm);
+ }
} else {
- g_free (v4l2element->norm);
- v4l2element->norm = g_value_dup_string (value);
- g_object_notify (object, "norm");
+ g_free (v4l2element->norm);
+ v4l2element->norm = g_value_dup_string (value);
+ g_object_notify (object, "norm");
}
break;
case ARG_CHANNEL:
if (GST_V4L2_IS_OPEN (v4l2element)) {
- GstTunerChannel *channel = gst_tuner_get_channel (tuner);
+ GstTunerChannel *channel = gst_tuner_get_channel (tuner);
- if (channel) {
- gst_tuner_set_channel (tuner, channel);
- }
+ if (channel) {
+ gst_tuner_set_channel (tuner, channel);
+ }
} else {
- g_free (v4l2element->channel);
- v4l2element->channel = g_value_dup_string (value);
- g_object_notify (object, "channel");
+ g_free (v4l2element->channel);
+ v4l2element->channel = g_value_dup_string (value);
+ g_object_notify (object, "channel");
}
break;
case ARG_FREQUENCY:
if (GST_V4L2_IS_OPEN (v4l2element)) {
- GstTunerChannel *channel;
+ GstTunerChannel *channel;
- if (!v4l2element->channel)
- return;
- channel = gst_tuner_get_channel (tuner);
- g_assert (channel);
- gst_tuner_set_frequency (tuner, channel, g_value_get_ulong (value));
+ if (!v4l2element->channel)
+ return;
+ channel = gst_tuner_get_channel (tuner);
+ g_assert (channel);
+ gst_tuner_set_frequency (tuner, channel, g_value_get_ulong (value));
} else {
- v4l2element->frequency = g_value_get_ulong (value);
- g_object_notify (object, "frequency");
+ v4l2element->frequency = g_value_get_ulong (value);
+ g_object_notify (object, "frequency");
}
break;
default:
gchar *new = NULL;
if (GST_V4L2_IS_OPEN (v4l2element))
- new = v4l2element->vcap.card;
+ new = v4l2element->vcap.card;
g_value_set_string (value, new);
break;
}
guint flags = 0;
if (GST_V4L2_IS_OPEN (v4l2element)) {
- flags |= v4l2element->vcap.capabilities & 30007;
+ flags |= v4l2element->vcap.capabilities & 30007;
}
g_value_set_flags (value, flags);
break;
gst_v4l2_set_display (v4l2element);
if (!gst_v4l2_open (v4l2element))
- return GST_STATE_FAILURE;
+ return GST_STATE_FAILURE;
gst_v4l2_xoverlay_open (v4l2element);
/* emit a signal! whoopie! */
g_signal_emit (G_OBJECT (v4l2element),
- gst_v4l2element_signals[SIGNAL_OPEN], 0, v4l2element->device);
+ gst_v4l2element_signals[SIGNAL_OPEN], 0, v4l2element->device);
break;
case GST_STATE_READY_TO_NULL:
gst_v4l2_xoverlay_close (v4l2element);
if (!gst_v4l2_close (v4l2element))
- return GST_STATE_FAILURE;
+ return GST_STATE_FAILURE;
/* emit yet another signal! wheehee! */
g_signal_emit (G_OBJECT (v4l2element),
- gst_v4l2element_signals[SIGNAL_CLOSE], 0, v4l2element->device);
+ gst_v4l2element_signals[SIGNAL_CLOSE], 0, v4l2element->device);
break;
}
guint32 gst_v4l2_formats[] = {
/* from Linux 2.6.0 videodev2.h */
- V4L2_PIX_FMT_RGB332, /* 8 RGB-3-3-2 */
- V4L2_PIX_FMT_RGB555, /* 16 RGB-5-5-5 */
- V4L2_PIX_FMT_RGB565, /* 16 RGB-5-6-5 */
- V4L2_PIX_FMT_RGB555X, /* 16 RGB-5-5-5 BE */
- V4L2_PIX_FMT_RGB565X, /* 16 RGB-5-6-5 BE */
- V4L2_PIX_FMT_BGR24, /* 24 BGR-8-8-8 */
- V4L2_PIX_FMT_RGB24, /* 24 RGB-8-8-8 */
- V4L2_PIX_FMT_BGR32, /* 32 BGR-8-8-8-8 */
- V4L2_PIX_FMT_RGB32, /* 32 RGB-8-8-8-8 */
- V4L2_PIX_FMT_GREY, /* 8 Greyscale */
- V4L2_PIX_FMT_YVU410, /* 9 YVU 4:1:0 */
- V4L2_PIX_FMT_YVU420, /* 12 YVU 4:2:0 */
- V4L2_PIX_FMT_YUYV, /* 16 YUV 4:2:2 */
- V4L2_PIX_FMT_UYVY, /* 16 YUV 4:2:2 */
- V4L2_PIX_FMT_YUV422P, /* 16 YVU422 planar */
- V4L2_PIX_FMT_YUV411P, /* 16 YVU411 planar */
- V4L2_PIX_FMT_Y41P, /* 12 YUV 4:1:1 */
- V4L2_PIX_FMT_NV12, /* 12 Y/CbCr 4:2:0 */
- V4L2_PIX_FMT_NV21, /* 12 Y/CrCb 4:2:0 */
- V4L2_PIX_FMT_YUV410, /* 9 YUV 4:1:0 */
- V4L2_PIX_FMT_YUV420, /* 12 YUV 4:2:0 */
- V4L2_PIX_FMT_YYUV, /* 16 YUV 4:2:2 */
- V4L2_PIX_FMT_HI240, /* 8 8-bit color */
- V4L2_PIX_FMT_MJPEG, /* Motion-JPEG */
- V4L2_PIX_FMT_JPEG, /* JFIF JPEG */
- V4L2_PIX_FMT_DV, /* 1394 */
- V4L2_PIX_FMT_MPEG, /* MPEG */
- V4L2_PIX_FMT_WNVA /* Winnov hw compres */
+ V4L2_PIX_FMT_RGB332, /* 8 RGB-3-3-2 */
+ V4L2_PIX_FMT_RGB555, /* 16 RGB-5-5-5 */
+ V4L2_PIX_FMT_RGB565, /* 16 RGB-5-6-5 */
+ V4L2_PIX_FMT_RGB555X, /* 16 RGB-5-5-5 BE */
+ V4L2_PIX_FMT_RGB565X, /* 16 RGB-5-6-5 BE */
+ V4L2_PIX_FMT_BGR24, /* 24 BGR-8-8-8 */
+ V4L2_PIX_FMT_RGB24, /* 24 RGB-8-8-8 */
+ V4L2_PIX_FMT_BGR32, /* 32 BGR-8-8-8-8 */
+ V4L2_PIX_FMT_RGB32, /* 32 RGB-8-8-8-8 */
+ V4L2_PIX_FMT_GREY, /* 8 Greyscale */
+ V4L2_PIX_FMT_YVU410, /* 9 YVU 4:1:0 */
+ V4L2_PIX_FMT_YVU420, /* 12 YVU 4:2:0 */
+ V4L2_PIX_FMT_YUYV, /* 16 YUV 4:2:2 */
+ V4L2_PIX_FMT_UYVY, /* 16 YUV 4:2:2 */
+ V4L2_PIX_FMT_YUV422P, /* 16 YVU422 planar */
+ V4L2_PIX_FMT_YUV411P, /* 16 YVU411 planar */
+ V4L2_PIX_FMT_Y41P, /* 12 YUV 4:1:1 */
+ V4L2_PIX_FMT_NV12, /* 12 Y/CbCr 4:2:0 */
+ V4L2_PIX_FMT_NV21, /* 12 Y/CrCb 4:2:0 */
+ V4L2_PIX_FMT_YUV410, /* 9 YUV 4:1:0 */
+ V4L2_PIX_FMT_YUV420, /* 12 YUV 4:2:0 */
+ V4L2_PIX_FMT_YYUV, /* 16 YUV 4:2:2 */
+ V4L2_PIX_FMT_HI240, /* 8 8-bit color */
+ V4L2_PIX_FMT_MJPEG, /* Motion-JPEG */
+ V4L2_PIX_FMT_JPEG, /* JFIF JPEG */
+ V4L2_PIX_FMT_DV, /* 1394 */
+ V4L2_PIX_FMT_MPEG, /* MPEG */
+ V4L2_PIX_FMT_WNVA /* Winnov hw compres */
};
#define GST_V4L2_FORMAT_COUNT (G_N_ELEMENTS (gst_v4l2_formats))
gst_v4l2src_init,
NULL
};
+
v4l2src_type = g_type_register_static (GST_TYPE_V4L2ELEMENT,
- "GstV4l2Src", &v4l2src_info, 0);
+ "GstV4l2Src", &v4l2src_info, 0);
GST_DEBUG_CATEGORY_INIT (v4l2src_debug, "v4l2src", 0, "v4l2src element");
}
return v4l2src_type;
g_object_class_install_property (gobject_class, ARG_NUMBUFS,
g_param_spec_int ("num_buffers", "num_buffers", "num_buffers",
- G_MININT, G_MAXINT, 0, G_PARAM_READWRITE));
+ G_MININT, G_MAXINT, 0, G_PARAM_READWRITE));
g_object_class_install_property (gobject_class, ARG_BUFSIZE,
g_param_spec_int ("buffer_size", "buffer_size", "buffer_size",
- G_MININT, G_MAXINT, 0, G_PARAM_READABLE));
+ G_MININT, G_MAXINT, 0, G_PARAM_READABLE));
g_object_class_install_property (gobject_class, ARG_USE_FIXED_FPS,
g_param_spec_boolean ("use_fixed_fps", "Use Fixed FPS",
- "Drop/Insert frames to reach a certain FPS (TRUE) "
- "or adapt FPS to suit the number of frabbed frames",
- TRUE, G_PARAM_READWRITE));
+ "Drop/Insert frames to reach a certain FPS (TRUE) "
+ "or adapt FPS to suit the number of frabbed frames",
+ TRUE, G_PARAM_READWRITE));
/* signals */
gst_v4l2src_signals[SIGNAL_FRAME_CAPTURE] =
if (!v4l2src->use_fixed_fps && v4l2src->clock != NULL && v4l2src->handled > 0) {
/* try to get time from clock master and calculate fps */
GstClockTime time = gst_clock_get_time (v4l2src->clock) -
- v4l2src->substract_time;
+ v4l2src->substract_time;
return v4l2src->handled * GST_SECOND / time;
}
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 = v4l2src->handled * GST_SECOND / fps;
- break;
- case GST_FORMAT_DEFAULT:
- *value = v4l2src->handled;
- break;
- default:
- res = FALSE;
- break;
+ case GST_FORMAT_TIME:
+ *value = v4l2src->handled * GST_SECOND / fps;
+ break;
+ case GST_FORMAT_DEFAULT:
+ *value = v4l2src->handled;
+ break;
+ default:
+ res = FALSE;
+ break;
}
break;
default:
GstStructure *structure = NULL;
switch (fourcc) {
- case V4L2_PIX_FMT_MJPEG: /* Motion-JPEG */
- case V4L2_PIX_FMT_JPEG: /* JFIF JPEG */
+ case V4L2_PIX_FMT_MJPEG: /* Motion-JPEG */
+ case V4L2_PIX_FMT_JPEG: /* JFIF JPEG */
structure = gst_structure_new ("video/x-jpeg", NULL);
break;
case V4L2_PIX_FMT_RGB332:
guint32 r_mask = 0, b_mask = 0, g_mask = 0;
switch (fourcc) {
- case V4L2_PIX_FMT_RGB332:
- bpp = depth = 8;
- endianness = G_BYTE_ORDER; /* 'like, whatever' */
- r_mask = 0xe0;
- g_mask = 0x1c;
- b_mask = 0x03;
- break;
- case V4L2_PIX_FMT_RGB555:
- case V4L2_PIX_FMT_RGB555X:
- bpp = 16;
- depth = 15;
- endianness =
- fourcc == V4L2_PIX_FMT_RGB555X ? G_BIG_ENDIAN : G_LITTLE_ENDIAN;
- r_mask = 0x7c00;
- g_mask = 0x03e0;
- b_mask = 0x001f;
- break;
- case V4L2_PIX_FMT_RGB565:
- case V4L2_PIX_FMT_RGB565X:
- bpp = depth = 16;
- endianness =
- fourcc == V4L2_PIX_FMT_RGB565X ? G_BIG_ENDIAN : G_LITTLE_ENDIAN;
- r_mask = 0xf800;
- g_mask = 0x07e0;
- b_mask = 0x001f;
- case V4L2_PIX_FMT_RGB24:
- bpp = depth = 24;
- endianness = G_BIG_ENDIAN;
- r_mask = 0xff0000;
- g_mask = 0x00ff00;
- b_mask = 0x0000ff;
- break;
- case V4L2_PIX_FMT_BGR24:
- bpp = depth = 24;
- endianness = G_BIG_ENDIAN;
- r_mask = 0x0000ff;
- g_mask = 0x00ff00;
- b_mask = 0xff0000;
- break;
- case V4L2_PIX_FMT_RGB32:
- bpp = depth = 32;
- endianness = G_BIG_ENDIAN;
- r_mask = 0xff000000;
- g_mask = 0x00ff0000;
- b_mask = 0x0000ff00;
- break;
- case V4L2_PIX_FMT_BGR32:
- bpp = depth = 32;
- endianness = G_BIG_ENDIAN;
- r_mask = 0x000000ff;
- g_mask = 0x0000ff00;
- b_mask = 0x00ff0000;
- break;
- default:
- g_assert_not_reached ();
- break;
+ case V4L2_PIX_FMT_RGB332:
+ bpp = depth = 8;
+ endianness = G_BYTE_ORDER; /* 'like, whatever' */
+ r_mask = 0xe0;
+ g_mask = 0x1c;
+ b_mask = 0x03;
+ break;
+ case V4L2_PIX_FMT_RGB555:
+ case V4L2_PIX_FMT_RGB555X:
+ bpp = 16;
+ depth = 15;
+ endianness =
+ fourcc == V4L2_PIX_FMT_RGB555X ? G_BIG_ENDIAN : G_LITTLE_ENDIAN;
+ r_mask = 0x7c00;
+ g_mask = 0x03e0;
+ b_mask = 0x001f;
+ break;
+ case V4L2_PIX_FMT_RGB565:
+ case V4L2_PIX_FMT_RGB565X:
+ bpp = depth = 16;
+ endianness =
+ fourcc == V4L2_PIX_FMT_RGB565X ? G_BIG_ENDIAN : G_LITTLE_ENDIAN;
+ r_mask = 0xf800;
+ g_mask = 0x07e0;
+ b_mask = 0x001f;
+ case V4L2_PIX_FMT_RGB24:
+ bpp = depth = 24;
+ endianness = G_BIG_ENDIAN;
+ r_mask = 0xff0000;
+ g_mask = 0x00ff00;
+ b_mask = 0x0000ff;
+ break;
+ case V4L2_PIX_FMT_BGR24:
+ bpp = depth = 24;
+ endianness = G_BIG_ENDIAN;
+ r_mask = 0x0000ff;
+ g_mask = 0x00ff00;
+ b_mask = 0xff0000;
+ break;
+ case V4L2_PIX_FMT_RGB32:
+ bpp = depth = 32;
+ endianness = G_BIG_ENDIAN;
+ r_mask = 0xff000000;
+ g_mask = 0x00ff0000;
+ b_mask = 0x0000ff00;
+ break;
+ case V4L2_PIX_FMT_BGR32:
+ bpp = depth = 32;
+ endianness = G_BIG_ENDIAN;
+ r_mask = 0x000000ff;
+ g_mask = 0x0000ff00;
+ b_mask = 0x00ff0000;
+ break;
+ default:
+ g_assert_not_reached ();
+ break;
}
structure = gst_structure_new ("video/x-raw-rgb",
- "bpp", G_TYPE_INT, bpp,
- "depth", G_TYPE_INT, depth,
- "red_mask", G_TYPE_INT, r_mask,
- "green_mask", G_TYPE_INT, g_mask,
- "blue_mask", G_TYPE_INT, b_mask,
- "endianness", G_TYPE_INT, endianness, NULL);
+ "bpp", G_TYPE_INT, bpp,
+ "depth", G_TYPE_INT, depth,
+ "red_mask", G_TYPE_INT, r_mask,
+ "green_mask", G_TYPE_INT, g_mask,
+ "blue_mask", G_TYPE_INT, b_mask,
+ "endianness", G_TYPE_INT, endianness, NULL);
break;
}
- case V4L2_PIX_FMT_GREY: /* 8 Greyscale */
- case V4L2_PIX_FMT_YUV422P: /* 16 YVU422 planar */
- case V4L2_PIX_FMT_YUV411P: /* 16 YVU411 planar */
- case V4L2_PIX_FMT_NV12: /* 12 Y/CbCr 4:2:0 */
- case V4L2_PIX_FMT_NV21: /* 12 Y/CrCb 4:2:0 */
- case V4L2_PIX_FMT_YYUV: /* 16 YUV 4:2:2 */
- case V4L2_PIX_FMT_HI240: /* 8 8-bit color */
+ case V4L2_PIX_FMT_GREY: /* 8 Greyscale */
+ case V4L2_PIX_FMT_YUV422P: /* 16 YVU422 planar */
+ case V4L2_PIX_FMT_YUV411P: /* 16 YVU411 planar */
+ case V4L2_PIX_FMT_NV12: /* 12 Y/CbCr 4:2:0 */
+ case V4L2_PIX_FMT_NV21: /* 12 Y/CrCb 4:2:0 */
+ case V4L2_PIX_FMT_YYUV: /* 16 YUV 4:2:2 */
+ case V4L2_PIX_FMT_HI240: /* 8 8-bit color */
/* FIXME: get correct fourccs here */
break;
case V4L2_PIX_FMT_YVU410:
case V4L2_PIX_FMT_YUV410:
- case V4L2_PIX_FMT_YUV420: /* I420/IYUV */
+ case V4L2_PIX_FMT_YUV420: /* I420/IYUV */
case V4L2_PIX_FMT_YUYV:
case V4L2_PIX_FMT_YVU420:
case V4L2_PIX_FMT_UYVY:
guint32 fcc = 0;
switch (fourcc) {
- case V4L2_PIX_FMT_YVU410:
- fcc = GST_MAKE_FOURCC ('Y', 'V', 'U', '9');
- break;
- case V4L2_PIX_FMT_YUV410:
- fcc = GST_MAKE_FOURCC ('Y', 'U', 'V', '9');
- break;
- case V4L2_PIX_FMT_YUV420:
- fcc = GST_MAKE_FOURCC ('I', '4', '2', '0');
- break;
- case V4L2_PIX_FMT_YUYV:
- fcc = GST_MAKE_FOURCC ('Y', 'U', 'Y', '2');
- break;
- case V4L2_PIX_FMT_YVU420:
- fcc = GST_MAKE_FOURCC ('Y', 'V', '1', '2');
- break;
- case V4L2_PIX_FMT_UYVY:
- fcc = GST_MAKE_FOURCC ('U', 'Y', 'V', 'Y');
- break;
- case V4L2_PIX_FMT_Y41P:
- fcc = GST_MAKE_FOURCC ('Y', '4', '1', 'B');
- break;
- default:
- g_assert_not_reached ();
- break;
+ case V4L2_PIX_FMT_YVU410:
+ fcc = GST_MAKE_FOURCC ('Y', 'V', 'U', '9');
+ break;
+ case V4L2_PIX_FMT_YUV410:
+ fcc = GST_MAKE_FOURCC ('Y', 'U', 'V', '9');
+ break;
+ case V4L2_PIX_FMT_YUV420:
+ fcc = GST_MAKE_FOURCC ('I', '4', '2', '0');
+ break;
+ case V4L2_PIX_FMT_YUYV:
+ fcc = GST_MAKE_FOURCC ('Y', 'U', 'Y', '2');
+ break;
+ case V4L2_PIX_FMT_YVU420:
+ fcc = GST_MAKE_FOURCC ('Y', 'V', '1', '2');
+ break;
+ case V4L2_PIX_FMT_UYVY:
+ fcc = GST_MAKE_FOURCC ('U', 'Y', 'V', 'Y');
+ break;
+ case V4L2_PIX_FMT_Y41P:
+ fcc = GST_MAKE_FOURCC ('Y', '4', '1', 'B');
+ break;
+ default:
+ g_assert_not_reached ();
+ break;
}
structure = gst_structure_new ("video/x-raw-yuv",
- "format", GST_TYPE_FOURCC, fcc, NULL);
+ "format", GST_TYPE_FOURCC, fcc, NULL);
break;
}
case V4L2_PIX_FMT_DV:
structure =
- gst_structure_new ("video/x-dv", "systemstream", G_TYPE_BOOLEAN, TRUE,
- NULL);
+ gst_structure_new ("video/x-dv", "systemstream", G_TYPE_BOOLEAN, TRUE,
+ NULL);
break;
- case V4L2_PIX_FMT_MPEG: /* MPEG */
+ case V4L2_PIX_FMT_MPEG: /* MPEG */
/* someone figure out the MPEG format used... */
break;
- case V4L2_PIX_FMT_WNVA: /* Winnov hw compres */
+ case V4L2_PIX_FMT_WNVA: /* Winnov hw compres */
break;
default:
GST_DEBUG ("Unknown fourcc 0x%08x " GST_FOURCC_FORMAT,
- fourcc, GST_FOURCC_ARGS (fourcc));
+ fourcc, GST_FOURCC_ARGS (fourcc));
break;
}
#if 0
return fmt;
/* special case for jpeg */
if ((fmt->pixelformat == V4L2_PIX_FMT_MJPEG && fourcc == V4L2_PIX_FMT_JPEG)
- || (fmt->pixelformat == V4L2_PIX_FMT_JPEG
- && fourcc == V4L2_PIX_FMT_MJPEG)) {
+ || (fmt->pixelformat == V4L2_PIX_FMT_JPEG
+ && fourcc == V4L2_PIX_FMT_MJPEG)) {
return fmt;
}
walk = g_slist_next (walk);
switch (fourcc) {
case GST_MAKE_FOURCC ('I', '4', '2', '0'):
case GST_MAKE_FOURCC ('I', 'Y', 'U', 'V'):
- fourcc = V4L2_PIX_FMT_YUV420;
- break;
+ fourcc = V4L2_PIX_FMT_YUV420;
+ break;
case GST_MAKE_FOURCC ('Y', 'U', 'Y', '2'):
- fourcc = V4L2_PIX_FMT_YUYV;
- break;
+ fourcc = V4L2_PIX_FMT_YUYV;
+ break;
case GST_MAKE_FOURCC ('Y', '4', '1', 'P'):
- fourcc = V4L2_PIX_FMT_Y41P;
- break;
+ fourcc = V4L2_PIX_FMT_Y41P;
+ break;
case GST_MAKE_FOURCC ('U', 'Y', 'V', 'Y'):
- fourcc = V4L2_PIX_FMT_UYVY;
- break;
+ fourcc = V4L2_PIX_FMT_UYVY;
+ break;
case GST_MAKE_FOURCC ('Y', 'V', '1', '2'):
- fourcc = V4L2_PIX_FMT_YVU420;
- break;
+ fourcc = V4L2_PIX_FMT_YVU420;
+ break;
case GST_MAKE_FOURCC ('R', 'G', 'B', ' '):{
- gint depth, endianness, r_mask;
-
- gst_structure_get_int (structure, "depth", &depth);
- gst_structure_get_int (structure, "endianness", &endianness);
- gst_structure_get_int (structure, "red_mask", &r_mask);
-
- switch (depth) {
- case 8:
- fourcc = V4L2_PIX_FMT_RGB332;
- break;
- case 15:
- fourcc = (endianness == G_LITTLE_ENDIAN) ?
- V4L2_PIX_FMT_RGB555 : V4L2_PIX_FMT_RGB555X;
- break;
- case 16:
- fourcc = (endianness == G_LITTLE_ENDIAN) ?
- V4L2_PIX_FMT_RGB565 : V4L2_PIX_FMT_RGB565X;
- break;
- case 24:
- fourcc = (r_mask == 0xFF) ? V4L2_PIX_FMT_BGR24 : V4L2_PIX_FMT_RGB24;
- break;
- case 32:
- fourcc = (r_mask == 0xFF) ? V4L2_PIX_FMT_BGR32 : V4L2_PIX_FMT_RGB32;
- break;
- }
+ gint depth, endianness, r_mask;
+
+ gst_structure_get_int (structure, "depth", &depth);
+ gst_structure_get_int (structure, "endianness", &endianness);
+ gst_structure_get_int (structure, "red_mask", &r_mask);
+
+ switch (depth) {
+ case 8:
+ fourcc = V4L2_PIX_FMT_RGB332;
+ break;
+ case 15:
+ fourcc = (endianness == G_LITTLE_ENDIAN) ?
+ V4L2_PIX_FMT_RGB555 : V4L2_PIX_FMT_RGB555X;
+ break;
+ case 16:
+ fourcc = (endianness == G_LITTLE_ENDIAN) ?
+ V4L2_PIX_FMT_RGB565 : V4L2_PIX_FMT_RGB565X;
+ break;
+ case 24:
+ fourcc = (r_mask == 0xFF) ? V4L2_PIX_FMT_BGR24 : V4L2_PIX_FMT_RGB24;
+ break;
+ case 32:
+ fourcc = (r_mask == 0xFF) ? V4L2_PIX_FMT_BGR32 : V4L2_PIX_FMT_RGB32;
+ break;
+ }
default:
- break;
+ break;
}
}
} else if (strcmp (mimetype, "video/x-dv") == 0) {
for (i = 0; i < GST_V4L2_FORMAT_COUNT; i++) {
structure = gst_v4l2src_v4l2fourcc_to_caps (gst_v4l2_formats[i]);
if (structure) {
- gst_structure_set (structure,
- "width", GST_TYPE_INT_RANGE, 1, 4096,
- "height", GST_TYPE_INT_RANGE, 1, 4096,
- "framerate", GST_TYPE_DOUBLE_RANGE, (double) 0, G_MAXDOUBLE, NULL);
+ gst_structure_set (structure,
+ "width", GST_TYPE_INT_RANGE, 1, 4096,
+ "height", GST_TYPE_INT_RANGE, 1, 4096,
+ "framerate", GST_TYPE_DOUBLE_RANGE, (double) 0, G_MAXDOUBLE, NULL);
- gst_caps_append_structure (caps, structure);
+ gst_caps_append_structure (caps, structure);
}
}
}
for (i = 0; i < gst_caps_get_size (caps); i++) {
structure = gst_caps_get_structure (caps, i);
changed |=
- gst_caps_structure_fixate_field_nearest_int (structure, "width",
- G_MAXINT);
+ gst_caps_structure_fixate_field_nearest_int (structure, "width",
+ G_MAXINT);
}
if (changed)
return caps;
for (i = 0; i < gst_caps_get_size (caps); i++) {
structure = gst_caps_get_structure (caps, i);
changed |=
- gst_caps_structure_fixate_field_nearest_int (structure, "height",
- G_MAXINT);
+ gst_caps_structure_fixate_field_nearest_int (structure, "height",
+ G_MAXINT);
}
if (changed)
return caps;
/* get size delimiters */
if (!gst_v4l2src_get_size_limits (v4l2src, format,
- &min_w, &max_w, &min_h, &max_h)) {
+ &min_w, &max_w, &min_h, &max_h)) {
continue;
}
if (structure) {
gst_structure_set (structure,
- "width", GST_TYPE_INT_RANGE, min_w, max_w,
- "height", GST_TYPE_INT_RANGE, min_h, max_h,
- "framerate", GST_TYPE_DOUBLE_RANGE, (double) 0, G_MAXDOUBLE, NULL);
+ "width", GST_TYPE_INT_RANGE, min_w, max_w,
+ "height", GST_TYPE_INT_RANGE, min_h, max_h,
+ "framerate", GST_TYPE_DOUBLE_RANGE, (double) 0, G_MAXDOUBLE, NULL);
gst_caps_append_structure (caps, structure);
}
if (v4l2src->use_fixed_fps && (fps = gst_v4l2src_get_fps (v4l2src)) == 0) {
GST_ELEMENT_ERROR (v4l2src, RESOURCE, SETTINGS, (NULL),
- ("could not get frame rate for element"));
+ ("could not get frame rate for element"));
return NULL;
}
gboolean have_frame = FALSE;
do {
- /* FIXME: isn't this v4l2 timestamp its own clock?! */
- /* by default, we use the frame once */
- v4l2src->need_writes = 1;
-
- g_assert (time >= v4l2src->substract_time);
- time -= v4l2src->substract_time;
-
- /* first check whether we lost any frames according to the device */
- if (v4l2src->last_seq != 0) {
- if (v4l2src->pool->buffers[num].buffer.sequence - v4l2src->last_seq >
- 1) {
- v4l2src->need_writes =
- v4l2src->pool->buffers[num].buffer.sequence - v4l2src->last_seq;
- g_signal_emit (G_OBJECT (v4l2src),
- gst_v4l2src_signals[SIGNAL_FRAME_LOST], 0,
- v4l2src->need_writes - 1);
- }
- }
- v4l2src->last_seq = v4l2src->pool->buffers[num].buffer.sequence;
-
- /* decide how often we're going to write the frame - set
- * v4lmjpegsrc->need_writes to (that-1) and have_frame to TRUE
- * if we're going to write it - else, just continue.
- *
- * time is generally the system or audio clock. Let's
- * say that we've written one second of audio, then we want
- * to have written one second of video too, within the same
- * timeframe. This means that if time - begin_time = X sec,
- * we want to have written X*fps frames. If we've written
- * more - drop, if we've written less - dup... */
- if (v4l2src->handled * (GST_SECOND / fps) - time >
- 1.5 * (GST_SECOND / fps)) {
- /* yo dude, we've got too many frames here! Drop! DROP! */
- v4l2src->need_writes--; /* -= (v4l2src->handled - (time / fps)); */
- g_signal_emit (G_OBJECT (v4l2src),
- gst_v4l2src_signals[SIGNAL_FRAME_DROP], 0);
- } else if (v4l2src->handled * (GST_SECOND / fps) - time <
- -1.5 * (GST_SECOND / fps)) {
- /* this means we're lagging far behind */
- v4l2src->need_writes++; /* += ((time / fps) - v4l2src->handled); */
- g_signal_emit (G_OBJECT (v4l2src),
- gst_v4l2src_signals[SIGNAL_FRAME_INSERT], 0);
- }
-
- if (v4l2src->need_writes > 0) {
- have_frame = TRUE;
- v4l2src->need_writes--;
- } else {
- if (!gst_v4l2src_queue_frame (v4l2src, num))
- return NULL;
- num = gst_v4l2src_grab_frame (v4l2src);
- if (num == -1)
- return NULL;
- }
+ /* FIXME: isn't this v4l2 timestamp its own clock?! */
+ /* by default, we use the frame once */
+ v4l2src->need_writes = 1;
+
+ g_assert (time >= v4l2src->substract_time);
+ time -= v4l2src->substract_time;
+
+ /* first check whether we lost any frames according to the device */
+ if (v4l2src->last_seq != 0) {
+ if (v4l2src->pool->buffers[num].buffer.sequence - v4l2src->last_seq >
+ 1) {
+ v4l2src->need_writes =
+ v4l2src->pool->buffers[num].buffer.sequence - v4l2src->last_seq;
+ g_signal_emit (G_OBJECT (v4l2src),
+ gst_v4l2src_signals[SIGNAL_FRAME_LOST], 0,
+ v4l2src->need_writes - 1);
+ }
+ }
+ v4l2src->last_seq = v4l2src->pool->buffers[num].buffer.sequence;
+
+ /* decide how often we're going to write the frame - set
+ * v4lmjpegsrc->need_writes to (that-1) and have_frame to TRUE
+ * if we're going to write it - else, just continue.
+ *
+ * time is generally the system or audio clock. Let's
+ * say that we've written one second of audio, then we want
+ * to have written one second of video too, within the same
+ * timeframe. This means that if time - begin_time = X sec,
+ * we want to have written X*fps frames. If we've written
+ * more - drop, if we've written less - dup... */
+ if (v4l2src->handled * (GST_SECOND / fps) - time >
+ 1.5 * (GST_SECOND / fps)) {
+ /* yo dude, we've got too many frames here! Drop! DROP! */
+ v4l2src->need_writes--; /* -= (v4l2src->handled - (time / fps)); */
+ g_signal_emit (G_OBJECT (v4l2src),
+ gst_v4l2src_signals[SIGNAL_FRAME_DROP], 0);
+ } else if (v4l2src->handled * (GST_SECOND / fps) - time <
+ -1.5 * (GST_SECOND / fps)) {
+ /* this means we're lagging far behind */
+ v4l2src->need_writes++; /* += ((time / fps) - v4l2src->handled); */
+ g_signal_emit (G_OBJECT (v4l2src),
+ gst_v4l2src_signals[SIGNAL_FRAME_INSERT], 0);
+ }
+
+ if (v4l2src->need_writes > 0) {
+ have_frame = TRUE;
+ v4l2src->need_writes--;
+ } else {
+ if (!gst_v4l2src_queue_frame (v4l2src, num))
+ return NULL;
+ num = gst_v4l2src_grab_frame (v4l2src);
+ if (num == -1)
+ return NULL;
+ }
} while (!have_frame);
}
g_assert (num != -1);
GST_LOG_OBJECT (v4l2src, "buffer %d needs %d writes", num,
- v4l2src->need_writes + 1);
+ v4l2src->need_writes + 1);
i = v4l2src->pool->buffers[num].buffer.bytesused >
- 0 ? v4l2src->pool->buffers[num].buffer.bytesused : v4l2src->pool->
- buffers[num].length;
+ 0 ? v4l2src->pool->buffers[num].buffer.bytesused : v4l2src->pool->
+ buffers[num].length;
/* check if this is the last buffer in the queue. If so do a memcpy to put it back asap
to avoid framedrops and deadlocks because of stupid elements */
if (gst_atomic_int_read (&v4l2src->pool->refcount) == v4l2src->breq.count) {
buf = gst_buffer_new_and_alloc (i);
memcpy (GST_BUFFER_DATA (buf), v4l2src->pool->buffers[num].start, i);
if (!gst_v4l2src_queue_frame (v4l2src, num)) {
- gst_data_unref (GST_DATA (buf));
- return NULL;
+ gst_data_unref (GST_DATA (buf));
+ return NULL;
}
} else {
GST_LOG_OBJECT (v4l2src, "using mmap'd buffer");
} else {
/* calculate time based on our own clock */
GST_BUFFER_TIMESTAMP (buf) =
- GST_TIMEVAL_TO_TIME (v4l2src->pool->buffers[num].buffer.timestamp) -
- v4l2src->substract_time;
+ GST_TIMEVAL_TO_TIME (v4l2src->pool->buffers[num].buffer.timestamp) -
+ v4l2src->substract_time;
}
if (v4l2src->need_writes > 0) {
v4l2src->cached_buffer = buf;
for (i = 0; i < v4l2src->need_writes; i++) {
- gst_data_ref (GST_DATA (buf));
+ gst_data_ref (GST_DATA (buf));
}
}
}
switch (prop_id) {
case ARG_NUMBUFS:
if (!GST_V4L2_IS_ACTIVE (GST_V4L2ELEMENT (v4l2src))) {
- v4l2src->breq.count = g_value_get_int (value);
+ v4l2src->breq.count = g_value_get_int (value);
}
break;
case ARG_USE_FIXED_FPS:
if (!GST_V4L2_IS_ACTIVE (GST_V4L2ELEMENT (v4l2src))) {
- v4l2src->use_fixed_fps = g_value_get_boolean (value);
+ v4l2src->use_fixed_fps = g_value_get_boolean (value);
}
break;
switch (transition) {
case GST_STATE_NULL_TO_READY:
if (!gst_v4l2src_get_capture (v4l2src))
- return GST_STATE_FAILURE;
+ return GST_STATE_FAILURE;
break;
case GST_STATE_READY_TO_PAUSED:
v4l2src->handled = 0;
case GST_STATE_PAUSED_TO_PLAYING:
/* queue all buffer, start streaming capture */
if (!gst_v4l2src_capture_start (v4l2src))
- return GST_STATE_FAILURE;
+ return GST_STATE_FAILURE;
g_get_current_time (&time);
v4l2src->substract_time = GST_TIMEVAL_TO_TIME (time) -
- v4l2src->substract_time;
+ v4l2src->substract_time;
v4l2src->last_seq = 0;
break;
case GST_STATE_PLAYING_TO_PAUSED:
g_get_current_time (&time);
v4l2src->substract_time = GST_TIMEVAL_TO_TIME (time) -
- v4l2src->substract_time;
+ v4l2src->substract_time;
/* de-queue all queued buffers */
if (!gst_v4l2src_capture_stop (v4l2src))
- return GST_STATE_FAILURE;
+ return GST_STATE_FAILURE;
break;
case GST_STATE_PAUSED_TO_READY:
/* stop capturing, unmap all buffers */
if (!gst_v4l2src_capture_deinit (v4l2src))
- return GST_STATE_FAILURE;
+ return GST_STATE_FAILURE;
break;
case GST_STATE_READY_TO_NULL:
break;
};
gst_v4l2_tuner_channel_type =
- g_type_register_static (GST_TYPE_TUNER_CHANNEL,
- "GstV4l2TunerChannel", &v4l2_tuner_channel_info, 0);
+ g_type_register_static (GST_TYPE_TUNER_CHANNEL,
+ "GstV4l2TunerChannel", &v4l2_tuner_channel_info, 0);
}
return gst_v4l2_tuner_channel_type;
};
gst_v4l2_tuner_norm_type =
- g_type_register_static (GST_TYPE_TUNER_NORM,
- "GstV4l2TunerNorm", &v4l2_tuner_norm_info, 0);
+ g_type_register_static (GST_TYPE_TUNER_NORM,
+ "GstV4l2TunerNorm", &v4l2_tuner_norm_info, 0);
}
return gst_v4l2_tuner_norm_type;
/* assert that we're opened and that we're using a known item */
g_return_if_fail (GST_V4L2_IS_OPEN (v4l2element));
g_return_if_fail (GST_TUNER_CHANNEL_HAS_FLAG (channel,
- GST_TUNER_CHANNEL_FREQUENCY));
+ GST_TUNER_CHANNEL_FREQUENCY));
g_return_if_fail (gst_v4l2_tuner_contains_channel (v4l2element, v4l2channel));
gst_v4l2_get_input (v4l2element, &chan);
/* assert that we're opened and that we're using a known item */
g_return_val_if_fail (GST_V4L2_IS_OPEN (v4l2element), 0);
g_return_val_if_fail (GST_TUNER_CHANNEL_HAS_FLAG (channel,
- GST_TUNER_CHANNEL_FREQUENCY), 0);
+ GST_TUNER_CHANNEL_FREQUENCY), 0);
g_return_val_if_fail (gst_v4l2_tuner_contains_channel (v4l2element,
- v4l2channel), 0);
+ v4l2channel), 0);
gst_v4l2_get_input (v4l2element, &chan);
if (chan == GST_V4L2_TUNER_CHANNEL (channel)->index &&
/* assert that we're opened and that we're using a known item */
g_return_val_if_fail (GST_V4L2_IS_OPEN (v4l2element), 0);
g_return_val_if_fail (GST_TUNER_CHANNEL_HAS_FLAG (channel,
- GST_TUNER_CHANNEL_FREQUENCY), 0);
+ GST_TUNER_CHANNEL_FREQUENCY), 0);
g_return_val_if_fail (gst_v4l2_tuner_contains_channel (v4l2element,
- v4l2channel), 0);
+ v4l2channel), 0);
gst_v4l2_get_input (v4l2element, &chan);
if (chan == GST_V4L2_TUNER_CHANNEL (channel)->index &&
xwin->display_name = g_strdup (v4l2element->display);
if (v4l2element->xwindow_id != 0 &&
- xwin->display_name && xwin->display_name[0] == ':') {
+ xwin->display_name && xwin->display_name[0] == ':') {
gst_x_window_listener_set_xid (xwin, v4l2element->xwindow_id);
}
}
if (xwin != NULL) {
if (v4l2element->xwindow_id != 0 &&
- xwin->display_name && xwin->display_name[0] == ':') {
+ xwin->display_name && xwin->display_name[0] == ':') {
gst_x_window_listener_set_xid (xwin, 0);
}
switch (system (buff)) {
case -1:
GST_ELEMENT_ERROR (v4l2element, RESOURCE, FAILED,
- (_("Could not start v4l-conf.")), GST_ERROR_SYSTEM);
+ (_("Could not start v4l-conf.")), GST_ERROR_SYSTEM);
g_free (buff);
return FALSE;
case 0:
break;
default:
GST_ELEMENT_ERROR (v4l2element, RESOURCE, FAILED,
- (_("Executing v4l-conf failed.")), GST_ERROR_SYSTEM);
+ (_("Executing v4l-conf failed.")), GST_ERROR_SYSTEM);
g_free (buff);
return FALSE;
}
if (ioctl (v4l2element->video_fd, VIDIOC_S_FMT, &fmt) < 0) {
GST_ELEMENT_ERROR (v4l2element, RESOURCE, TOO_LAZY, (NULL),
- ("Failed to set the video window: %s", g_strerror (errno)));
+ ("Failed to set the video window: %s", g_strerror (errno)));
return FALSE;
}
if (ioctl (v4l2element->video_fd, VIDIOC_OVERLAY, &doit) < 0) {
GST_ELEMENT_ERROR (v4l2element, RESOURCE, TOO_LAZY, (NULL),
- ("Failed to %s overlay display: %s",
- enable ? "enable" : "disable", g_strerror (errno)));
+ ("Failed to %s overlay display: %s",
+ enable ? "enable" : "disable", g_strerror (errno)));
return FALSE;
}
if (ioctl (v4l2element->video_fd, VIDIOC_QUERYCAP, &(v4l2element->vcap)) < 0) {
GST_ELEMENT_ERROR (v4l2element, RESOURCE, SETTINGS, (NULL),
- ("Error getting %s capabilities: %s",
- v4l2element->device, g_strerror (errno)));
+ ("Error getting %s capabilities: %s",
+ v4l2element->device, g_strerror (errno)));
return FALSE;
}
input.index = n;
if (ioctl (v4l2element->video_fd, VIDIOC_ENUMINPUT, &input) < 0) {
- if (errno == EINVAL)
- break; /* end of enumeration */
- else {
- GST_ELEMENT_ERROR (v4l2element, RESOURCE, SETTINGS, (NULL),
- ("Failed to get %d in input enumeration for %s: %s",
- n, v4l2element->device, g_strerror (errno)));
- return FALSE;
- }
+ if (errno == EINVAL)
+ break; /* end of enumeration */
+ else {
+ GST_ELEMENT_ERROR (v4l2element, RESOURCE, SETTINGS, (NULL),
+ ("Failed to get %d in input enumeration for %s: %s",
+ n, v4l2element->device, g_strerror (errno)));
+ return FALSE;
+ }
}
v4l2channel = g_object_new (GST_TYPE_V4L2_TUNER_CHANNEL, NULL);
channel->flags = GST_TUNER_CHANNEL_INPUT;
v4l2channel->index = n;
if (input.type == V4L2_INPUT_TYPE_TUNER) {
- struct v4l2_tuner vtun;
-
- v4l2channel->tuner = input.tuner;
- channel->flags |= GST_TUNER_CHANNEL_FREQUENCY;
-
- vtun.index = input.tuner;
- if (ioctl (v4l2element->video_fd, VIDIOC_G_TUNER, &vtun) < 0) {
- GST_ELEMENT_ERROR (v4l2element, RESOURCE, SETTINGS, (NULL),
- ("Failed to get tuner %d settings on %s: %s",
- input.tuner, v4l2element->device, g_strerror (errno)));
- g_object_unref (G_OBJECT (channel));
- return FALSE;
- }
- channel->min_frequency = vtun.rangelow;
- channel->max_frequency = vtun.rangehigh;
- channel->min_signal = 0;
- channel->max_signal = 0xffff;
+ struct v4l2_tuner vtun;
+
+ v4l2channel->tuner = input.tuner;
+ channel->flags |= GST_TUNER_CHANNEL_FREQUENCY;
+
+ vtun.index = input.tuner;
+ if (ioctl (v4l2element->video_fd, VIDIOC_G_TUNER, &vtun) < 0) {
+ GST_ELEMENT_ERROR (v4l2element, RESOURCE, SETTINGS, (NULL),
+ ("Failed to get tuner %d settings on %s: %s",
+ input.tuner, v4l2element->device, g_strerror (errno)));
+ g_object_unref (G_OBJECT (channel));
+ return FALSE;
+ }
+ channel->min_frequency = vtun.rangelow;
+ channel->max_frequency = vtun.rangehigh;
+ channel->min_signal = 0;
+ channel->max_signal = 0xffff;
}
if (input.audioset) {
- /* we take the first. We don't care for
- * the others for now */
- while (!(input.audioset & (1 << v4l2channel->audio)))
- v4l2channel->audio++;
- channel->flags |= GST_TUNER_CHANNEL_AUDIO;
+ /* we take the first. We don't care for
+ * the others for now */
+ while (!(input.audioset & (1 << v4l2channel->audio)))
+ v4l2channel->audio++;
+ channel->flags |= GST_TUNER_CHANNEL_AUDIO;
}
v4l2element->channels =
- g_list_append (v4l2element->channels, (gpointer) channel);
+ g_list_append (v4l2element->channels, (gpointer) channel);
}
} else {
/* outputs */
output.index = n;
if (ioctl (v4l2element->video_fd, VIDIOC_ENUMOUTPUT, &output) < 0) {
- if (errno == EINVAL)
- break; /* end of enumeration */
- else {
- GST_ELEMENT_ERROR (v4l2element, RESOURCE, SETTINGS, (NULL),
- ("Failed to get %d in output enumeration for %s: %s",
- n, v4l2element->device, g_strerror (errno)));
- return FALSE;
- }
+ if (errno == EINVAL)
+ break; /* end of enumeration */
+ else {
+ GST_ELEMENT_ERROR (v4l2element, RESOURCE, SETTINGS, (NULL),
+ ("Failed to get %d in output enumeration for %s: %s",
+ n, v4l2element->device, g_strerror (errno)));
+ return FALSE;
+ }
}
v4l2channel = g_object_new (GST_TYPE_V4L2_TUNER_CHANNEL, NULL);
channel->flags = GST_TUNER_CHANNEL_OUTPUT;
v4l2channel->index = n;
if (output.audioset) {
- /* we take the first. We don't care for
- * the others for now */
- while (!(output.audioset & (1 << v4l2channel->audio)))
- v4l2channel->audio++;
- channel->flags |= GST_TUNER_CHANNEL_AUDIO;
+ /* we take the first. We don't care for
+ * the others for now */
+ while (!(output.audioset & (1 << v4l2channel->audio)))
+ v4l2channel->audio++;
+ channel->flags |= GST_TUNER_CHANNEL_AUDIO;
}
v4l2element->channels =
- g_list_append (v4l2element->channels, (gpointer) channel);
+ g_list_append (v4l2element->channels, (gpointer) channel);
}
}
standard.index = n;
if (ioctl (v4l2element->video_fd, VIDIOC_ENUMSTD, &standard) < 0) {
if (errno == EINVAL)
- break; /* end of enumeration */
+ break; /* end of enumeration */
else {
- GST_ELEMENT_ERROR (v4l2element, RESOURCE, SETTINGS, (NULL),
- ("Failed to get %d in norm enumeration for %s: %s",
- n, v4l2element->device, g_strerror (errno)));
- return FALSE;
+ GST_ELEMENT_ERROR (v4l2element, RESOURCE, SETTINGS, (NULL),
+ ("Failed to get %d in norm enumeration for %s: %s",
+ n, v4l2element->device, g_strerror (errno)));
+ return FALSE;
}
}
norm = GST_TUNER_NORM (v4l2norm);
norm->label = g_strdup (standard.name);
norm->fps = (gfloat) standard.frameperiod.denominator /
- standard.frameperiod.numerator;
+ standard.frameperiod.numerator;
v4l2norm->index = standard.id;
v4l2element->norms = g_list_append (v4l2element->norms, (gpointer) norm);
control.id = n;
if (ioctl (v4l2element->video_fd, VIDIOC_QUERYCTRL, &control) < 0) {
if (errno == EINVAL) {
- if (n < V4L2_CID_PRIVATE_BASE)
- continue;
- else
- break;
+ if (n < V4L2_CID_PRIVATE_BASE)
+ continue;
+ else
+ break;
} else {
- GST_ELEMENT_ERROR (v4l2element, RESOURCE, SETTINGS, (NULL),
- ("Failed to get %d in control enumeration for %s: %s",
- n, v4l2element->device, g_strerror (errno)));
- return FALSE;
+ GST_ELEMENT_ERROR (v4l2element, RESOURCE, SETTINGS, (NULL),
+ ("Failed to get %d in control enumeration for %s: %s",
+ n, v4l2element->device, g_strerror (errno)));
+ return FALSE;
}
}
if (control.flags & V4L2_CTRL_FLAG_DISABLED)
case V4L2_CID_EXPOSURE:
case V4L2_CID_AUTOGAIN:
case V4L2_CID_GAIN:
- /* we only handle these for now */
- break;
+ /* we only handle these for now */
+ break;
default:
- DEBUG ("ControlID %s (%d) unhandled, FIXME", control.name, n);
- control.id++;
- break;
+ DEBUG ("ControlID %s (%d) unhandled, FIXME", control.name, n);
+ control.id++;
+ break;
}
if (n != control.id)
continue;
menu.id = n;
for (i = 0;; i++) {
- menu.index = i;
- if (ioctl (v4l2element->video_fd, VIDIOC_QUERYMENU, &menu) < 0) {
- if (errno == EINVAL)
- break; /* end of enumeration */
- else {
- GST_ELEMENT_ERROR (v4l2element, RESOURCE, SETTINGS, (NULL),
- ("Failed to get %d in menu enumeration for %s: %s",
- n, v4l2element->device, g_strerror (errno)));
- return FALSE;
- }
- }
- mptr = g_malloc (sizeof (menu));
- memcpy (mptr, &menu, sizeof (menu));
- menus = g_list_append (menus, mptr);
+ menu.index = i;
+ if (ioctl (v4l2element->video_fd, VIDIOC_QUERYMENU, &menu) < 0) {
+ if (errno == EINVAL)
+ break; /* end of enumeration */
+ else {
+ GST_ELEMENT_ERROR (v4l2element, RESOURCE, SETTINGS, (NULL),
+ ("Failed to get %d in menu enumeration for %s: %s",
+ n, v4l2element->device, g_strerror (errno)));
+ return FALSE;
+ }
+ }
+ mptr = g_malloc (sizeof (menu));
+ memcpy (mptr, &menu, sizeof (menu));
+ menus = g_list_append (menus, mptr);
}
}
v4l2element->menus = g_list_append (v4l2element->menus, menus);
switch (control.type) {
case V4L2_CTRL_TYPE_INTEGER:
- channel->min_value = control.minimum;
- channel->max_value = control.maximum;
- break;
+ channel->min_value = control.minimum;
+ channel->max_value = control.maximum;
+ break;
case V4L2_CTRL_TYPE_BOOLEAN:
- channel->min_value = FALSE;
- channel->max_value = TRUE;
- break;
+ channel->min_value = FALSE;
+ channel->max_value = TRUE;
+ break;
default:
- channel->min_value = channel->max_value = 0;
- break;
+ channel->min_value = channel->max_value = 0;
+ break;
}
v4l2element->colors = g_list_append (v4l2element->colors,
- (gpointer) channel);
+ (gpointer) channel);
}
return TRUE;
gst_tuner_set_channel (tuner, channel);
} else {
channel =
- GST_TUNER_CHANNEL (gst_tuner_get_channel (GST_TUNER (v4l2element)));
+ GST_TUNER_CHANNEL (gst_tuner_get_channel (GST_TUNER (v4l2element)));
v4l2element->channel = g_strdup (channel->label);
gst_tuner_channel_changed (tuner, channel);
g_object_notify (G_OBJECT (v4l2element), "channel");
v4l2element->video_fd = open (v4l2element->device, O_RDWR);
if (!GST_V4L2_IS_OPEN (v4l2element)) {
GST_ELEMENT_ERROR (v4l2element, RESOURCE, OPEN_READ_WRITE,
- (_("Could not open device \"%s\" for reading and writing."),
- v4l2element->device), GST_ERROR_SYSTEM);
+ (_("Could not open device \"%s\" for reading and writing."),
+ v4l2element->device), GST_ERROR_SYSTEM);
goto error;
}
if (GST_IS_V4L2SRC (v4l2element) &&
!(v4l2element->vcap.capabilities & V4L2_CAP_VIDEO_CAPTURE)) {
GST_ELEMENT_ERROR (v4l2element, RESOURCE, NOT_FOUND,
- (_("Device \"%s\" is not a capture device."), v4l2element->device),
- ("Capabilities: 0x%x", v4l2element->vcap.capabilities));
+ (_("Device \"%s\" is not a capture device."), v4l2element->device),
+ ("Capabilities: 0x%x", v4l2element->vcap.capabilities));
goto error;
}
if (ioctl (v4l2element->video_fd, VIDIOC_G_STD, norm) < 0) {
GST_ELEMENT_ERROR (v4l2element, RESOURCE, SETTINGS, (NULL),
- ("Failed to get the current norm for device %s: %s",
- v4l2element->device, g_strerror (errno)));
+ ("Failed to get the current norm for device %s: %s",
+ v4l2element->device, g_strerror (errno)));
return FALSE;
}
if (ioctl (v4l2element->video_fd, VIDIOC_S_STD, &norm) < 0) {
GST_ELEMENT_ERROR (v4l2element, RESOURCE, SETTINGS, (NULL),
- ("Failed to set norm 0x%llx for device %s: %s",
- norm, v4l2element->device, g_strerror (errno)));
+ ("Failed to set norm 0x%llx for device %s: %s",
+ norm, v4l2element->device, g_strerror (errno)));
return FALSE;
}
if (ioctl (v4l2element->video_fd, VIDIOC_G_INPUT, &n) < 0) {
GST_ELEMENT_ERROR (v4l2element, RESOURCE, SETTINGS, (NULL),
- ("Failed to get current input on device %s: %s",
- v4l2element->device, g_strerror (errno)));
+ ("Failed to get current input on device %s: %s",
+ v4l2element->device, g_strerror (errno)));
return FALSE;
}
if (ioctl (v4l2element->video_fd, VIDIOC_S_INPUT, &input) < 0) {
GST_ELEMENT_ERROR (v4l2element, RESOURCE, SETTINGS, (NULL),
- ("Failed to set input %d on device %s: %s",
- input, v4l2element->device, g_strerror (errno)));
+ ("Failed to set input %d on device %s: %s",
+ input, v4l2element->device, g_strerror (errno)));
return FALSE;
}
if (ioctl (v4l2element->video_fd, VIDIOC_G_OUTPUT, &n) < 0) {
GST_ELEMENT_ERROR (v4l2element, RESOURCE, SETTINGS, (NULL),
- ("Failed to get current output on device %s: %s",
- v4l2element->device, g_strerror (errno)));
+ ("Failed to get current output on device %s: %s",
+ v4l2element->device, g_strerror (errno)));
return FALSE;
}
if (ioctl (v4l2element->video_fd, VIDIOC_S_OUTPUT, &output) < 0) {
GST_ELEMENT_ERROR (v4l2element, RESOURCE, SETTINGS, (NULL),
- ("Failed to set output %d on device %s: %s",
- output, v4l2element->device, g_strerror (errno)));
+ ("Failed to set output %d on device %s: %s",
+ output, v4l2element->device, g_strerror (errno)));
return FALSE;
}
freq.tuner = tunernum;
if (ioctl (v4l2element->video_fd, VIDIOC_G_FREQUENCY, &freq) < 0) {
GST_ELEMENT_ERROR (v4l2element, RESOURCE, SETTINGS, (NULL),
- ("Failed to get current tuner frequency for device %s: %s",
- v4l2element->device, g_strerror (errno)));
+ ("Failed to get current tuner frequency for device %s: %s",
+ v4l2element->device, g_strerror (errno)));
return FALSE;
}
if (ioctl (v4l2element->video_fd, VIDIOC_S_FREQUENCY, &freq) < 0) {
GST_ELEMENT_ERROR (v4l2element, RESOURCE, SETTINGS, (NULL),
- ("Failed to set tuner frequency to %lu for device %s: %s",
- frequency, v4l2element->device, g_strerror (errno)));
+ ("Failed to set tuner frequency to %lu for device %s: %s",
+ frequency, v4l2element->device, g_strerror (errno)));
return FALSE;
}
tuner.index = tunernum;
if (ioctl (v4l2element->video_fd, VIDIOC_G_TUNER, &tuner) < 0) {
GST_ELEMENT_ERROR (v4l2element, RESOURCE, SETTINGS, (NULL),
- ("Failed to get signal strength for device %s: %s",
- v4l2element->device, g_strerror (errno)));
+ ("Failed to get signal strength for device %s: %s",
+ v4l2element->device, g_strerror (errno)));
return FALSE;
}
if (ioctl (v4l2element->video_fd, VIDIOC_G_CTRL, &control) < 0) {
GST_ELEMENT_ERROR (v4l2element, RESOURCE, SETTINGS, (NULL),
- ("Failed to get value for control %d on device %s: %s",
- attribute_num, v4l2element->device, g_strerror (errno)));
+ ("Failed to get value for control %d on device %s: %s",
+ attribute_num, v4l2element->device, g_strerror (errno)));
return FALSE;
}
if (ioctl (v4l2element->video_fd, VIDIOC_S_CTRL, &control) < 0) {
GST_ELEMENT_ERROR (v4l2element, RESOURCE, SETTINGS, (NULL),
- ("Failed to set value %d for control %d on device %s: %s",
- value, attribute_num, v4l2element->device, g_strerror (errno)));
+ ("Failed to set value %d for control %d on device %s: %s",
+ value, attribute_num, v4l2element->device, g_strerror (errno)));
return FALSE;
}
format->index = n;
format->type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
if (ioctl (GST_V4L2ELEMENT (v4l2src)->video_fd, VIDIOC_ENUM_FMT,
- format) < 0) {
+ format) < 0) {
if (errno == EINVAL) {
- break; /* end of enumeration */
+ break; /* end of enumeration */
} else {
- GST_ELEMENT_ERROR (v4l2src, RESOURCE, SETTINGS, (NULL),
- ("failed to get number %d in pixelformat enumeration for %s: %s",
- n, GST_V4L2ELEMENT (v4l2src)->device, g_strerror (errno)));
- g_free (format);
- return FALSE;
+ GST_ELEMENT_ERROR (v4l2src, RESOURCE, SETTINGS, (NULL),
+ ("failed to get number %d in pixelformat enumeration for %s: %s",
+ n, GST_V4L2ELEMENT (v4l2src)->device, g_strerror (errno)));
+ g_free (format);
+ return FALSE;
}
}
GST_LOG_OBJECT (v4l2src, "got format" GST_FOURCC_FORMAT,
- GST_FOURCC_ARGS (format->pixelformat));
+ GST_FOURCC_ARGS (format->pixelformat));
v4l2src->formats = g_slist_prepend (v4l2src->formats, format);
}
GST_LOG_OBJECT (v4l2src, "queueing frame %u", i);
if (ioctl (GST_V4L2ELEMENT (v4l2src)->video_fd, VIDIOC_QBUF,
- &v4l2src->pool->buffers[i].buffer) < 0) {
+ &v4l2src->pool->buffers[i].buffer) < 0) {
GST_ELEMENT_ERROR (v4l2src, RESOURCE, WRITE,
- (_("Could not write to device \"%s\"."),
- GST_V4L2ELEMENT (v4l2src)->device),
- ("Error queueing buffer %u on device %s", i, g_strerror (errno)));
+ (_("Could not write to device \"%s\"."),
+ GST_V4L2ELEMENT (v4l2src)->device),
+ ("Error queueing buffer %u on device %s", i, g_strerror (errno)));
return FALSE;
}
/* if the sync() got interrupted, we can retry */
if (errno != EINTR) {
GST_ELEMENT_ERROR (v4l2src, RESOURCE, SYNC, (NULL),
- ("could not sync on a buffer on device %s: %s",
- GST_V4L2ELEMENT (v4l2src)->device, g_strerror (errno)));
+ ("could not sync on a buffer on device %s: %s",
+ GST_V4L2ELEMENT (v4l2src)->device, g_strerror (errno)));
return -1;
}
GST_DEBUG_OBJECT (v4l2src, "grab got interrupted");
v4l2src->format.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
if (ioctl (GST_V4L2ELEMENT (v4l2src)->video_fd, VIDIOC_G_FMT,
- &v4l2src->format) < 0) {
+ &v4l2src->format) < 0) {
GST_ELEMENT_ERROR (v4l2src, RESOURCE, SETTINGS, (NULL),
- ("failed to get pixelformat for device %s: %s",
- GST_V4L2ELEMENT (v4l2src)->device, g_strerror (errno)));
+ ("failed to get pixelformat for device %s: %s",
+ GST_V4L2ELEMENT (v4l2src)->device, g_strerror (errno)));
return FALSE;
}
v4l2src->format.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
if (ioctl (GST_V4L2ELEMENT (v4l2src)->video_fd, VIDIOC_S_FMT,
- &v4l2src->format) < 0) {
+ &v4l2src->format) < 0) {
GST_ELEMENT_ERROR (v4l2src, RESOURCE, SETTINGS, (NULL),
- ("failed to set pixelformat to %s @ %dx%d for device %s: %s",
- fmt->description, width, height, GST_V4L2ELEMENT (v4l2src)->device,
- g_strerror (errno)));
+ ("failed to set pixelformat to %s @ %dx%d for device %s: %s",
+ fmt->description, width, height, GST_V4L2ELEMENT (v4l2src)->device,
+ g_strerror (errno)));
return FALSE;
}
v4l2src->breq.type = v4l2src->format.type;
v4l2src->breq.memory = V4L2_MEMORY_MMAP;
if (ioctl (GST_V4L2ELEMENT (v4l2src)->video_fd, VIDIOC_REQBUFS,
- &v4l2src->breq) < 0) {
+ &v4l2src->breq) < 0) {
GST_ELEMENT_ERROR (v4l2src, RESOURCE, READ,
- (_("Could not get buffers from device \"%s\"."),
- GST_V4L2ELEMENT (v4l2src)->device),
- ("error requesting %d buffers: %s", v4l2src->breq.count,
- g_strerror (errno)));
+ (_("Could not get buffers from device \"%s\"."),
+ GST_V4L2ELEMENT (v4l2src)->device),
+ ("error requesting %d buffers: %s", v4l2src->breq.count,
+ g_strerror (errno)));
return FALSE;
}
if (v4l2src->breq.count < GST_V4L2_MIN_BUFFERS) {
GST_ELEMENT_ERROR (v4l2src, RESOURCE, READ,
- (_("Could not get enough buffers from device \"%s\"."),
- GST_V4L2ELEMENT (v4l2src)->device),
- ("we received %d, we want at least %d", v4l2src->breq.count,
- GST_V4L2_MIN_BUFFERS));
+ (_("Could not get enough buffers from device \"%s\"."),
+ GST_V4L2ELEMENT (v4l2src)->device),
+ ("we received %d, we want at least %d", v4l2src->breq.count,
+ GST_V4L2_MIN_BUFFERS));
v4l2src->breq.count = buffers;
return FALSE;
}
buffer->buffer.index = n;
buffer->buffer.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
if (ioctl (GST_V4L2ELEMENT (v4l2src)->video_fd, VIDIOC_QUERYBUF,
- &buffer->buffer) < 0) {
+ &buffer->buffer) < 0) {
GST_ELEMENT_ERROR (v4l2src, RESOURCE, READ, (NULL),
- ("Could not get buffer properties of buffer %d: %s", n,
- g_strerror (errno)));
+ ("Could not get buffer properties of buffer %d: %s", n,
+ g_strerror (errno)));
gst_v4l2src_capture_deinit (v4l2src);
return FALSE;
}
buffer->start =
- mmap (0, buffer->buffer.length, PROT_READ | PROT_WRITE, MAP_SHARED,
- GST_V4L2ELEMENT (v4l2src)->video_fd, buffer->buffer.m.offset);
+ mmap (0, buffer->buffer.length, PROT_READ | PROT_WRITE, MAP_SHARED,
+ GST_V4L2ELEMENT (v4l2src)->video_fd, buffer->buffer.m.offset);
if (buffer->start == MAP_FAILED) {
GST_ELEMENT_ERROR (v4l2src, RESOURCE, READ, (NULL),
- ("Could not mmap video buffer %d: %s", n, g_strerror (errno)));
+ ("Could not mmap video buffer %d: %s", n, g_strerror (errno)));
buffer->start = 0;
gst_v4l2src_capture_deinit (v4l2src);
return FALSE;
if (ioctl (GST_V4L2ELEMENT (v4l2src)->video_fd, VIDIOC_STREAMON, &type) < 0) {
GST_ELEMENT_ERROR (v4l2src, RESOURCE, OPEN_READ, (NULL),
- ("Error starting streaming capture from device %s: %s",
- GST_V4L2ELEMENT (v4l2src)->device, g_strerror (errno)));
+ ("Error starting streaming capture from device %s: %s",
+ GST_V4L2ELEMENT (v4l2src)->device, g_strerror (errno)));
return FALSE;
}
* on the non-queued ones */
if (ioctl (GST_V4L2ELEMENT (v4l2src)->video_fd, VIDIOC_STREAMOFF, &type) < 0) {
GST_ELEMENT_ERROR (v4l2src, RESOURCE, CLOSE, (NULL),
- ("Error stopping streaming capture from device %s: %s",
- GST_V4L2ELEMENT (v4l2src)->device, g_strerror (errno)));
+ ("Error stopping streaming capture from device %s: %s",
+ GST_V4L2ELEMENT (v4l2src)->device, g_strerror (errno)));
return FALSE;
}
buffer.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
if (ioctl (GST_V4L2ELEMENT (v4l2src)->video_fd, VIDIOC_DQBUF, &buffer) < 0)
GST_WARNING_OBJECT (v4l2src,
- "Could not dequeue buffer on uninitialization");
+ "Could not dequeue buffer on uninitialization");
}
if (gst_atomic_int_dec_and_test (&v4l2src->pool->refcount)) {
/* we're last thing that used all this */
TRUE, 0, 0, GST_BUFFER_SIZE (buf), 25);
for (i = 0; i < GST_BUFFER_SIZE (buf); i++) {
gdk_draw_rectangle (drawingarea->window, drawingarea->style->white_gc,
- TRUE, i, 32 - data[i], 1, data[i]);
+ TRUE, i, 32 - data[i], 1, data[i]);
}
gst_buffer_unref (buf);
}