don't mix tabs and spaces

Original commit message from CVS:
don't mix tabs and spaces
This commit is contained in:
Thomas Vander Stichele 2004-03-15 19:32:27 +00:00
parent 9f4226fe55
commit 4fd57bbe3f
173 changed files with 8097 additions and 7987 deletions

View file

@ -1,3 +1,7 @@
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):

View file

@ -72,7 +72,7 @@ main (gint argc, gchar * argv[])
/* force RGB data passing between colorspace and xvideosink */
res = gst_element_link_filtered (colorspace, "src", xvideosink, "sink",
GST_CAPS_NEW ("filtercaps",
"video/raw", "format", GST_PROPS_FOURCC (GST_STR_FOURCC ("RGB "))
"video/raw", "format", GST_PROPS_FOURCC (GST_STR_FOURCC ("RGB "))
));
if (!res) {
g_print ("could not connect colorspace and xvideosink\n");

View file

@ -15,17 +15,17 @@
/* filter UI data */
struct _filter_ui
{
GtkWidget *window; /* top-level interface window */
GtkWidget *window; /* top-level interface window */
GtkWidget *buttons; /* all of the control buttons */
GtkWidget *parse, *play, *stop; /* control buttons */
GtkWidget *buttons; /* all of the control buttons */
GtkWidget *parse, *play, *stop; /* control buttons */
GtkWidget *feedback; /* here's where we'll tell you stuff */
GtkTextBuffer *fb_buffer; /* feedback buffer */
GtkWidget *selection; /* the place to input element stuff */
GtkWidget *input, *filter, *output; /* the selection widgets */
GtkWidget *feedback; /* here's where we'll tell you stuff */
GtkTextBuffer *fb_buffer; /* feedback buffer */
GtkWidget *selection; /* the place to input element stuff */
GtkWidget *input, *filter, *output; /* the selection widgets */
GtkWidget *control; /* the dynamically generated control UI */
GtkWidget *control; /* the dynamically generated control UI */
};
typedef struct _filter_ui _filter_ui_t;
@ -33,13 +33,13 @@ typedef struct _filter_ui _filter_ui_t;
/* back-end data */
struct _filter_data
{
_filter_ui_t *ui; /* the UI data */
_filter_ui_t *ui; /* the UI data */
gchar *input_pipe, *output_pipe, *filter_element;
gchar *pipe_string;
GList *filter_choices;
gboolean playing;
GstElement *input, *output; /* these are in and out bins */
GstElement *input, *output; /* these are in and out bins */
GstElement *pipeline;
GstElement *filter;
};
@ -75,21 +75,21 @@ gst_bin_find_unconnected_pad (GstBin * bin, GstPadDirection direction,
while (pads) {
/* check if the direction matches */
if (GST_PAD_DIRECTION (GST_PAD (pads->data)) == direction) {
if (GST_PAD_PEER (GST_PAD (pads->data)) == NULL) {
/* found it ! */
g_print ("DEBUG: found an unconnected pad !\n");
pad = GST_PAD (pads->data);
}
if (GST_PAD_PEER (GST_PAD (pads->data)) == NULL) {
/* found it ! */
g_print ("DEBUG: found an unconnected pad !\n");
pad = GST_PAD (pads->data);
}
}
if (pad)
break; /* found one already */
break; /* found one already */
pads = g_list_next (pads);
}
elements = g_list_next (elements);
}
g_print ("DEBUG: find_unconnected stop\n");
if (pad == NULL) /* we didn't find it at all */
if (pad == NULL) /* we didn't find it at all */
return NULL;
pad = gst_ghost_pad_new (name, pad);
@ -157,37 +157,37 @@ ui_control_create (GstElement * element, GtkWidget * control, _filter_ui_t * ui)
gtk_container_add (GTK_CONTAINER (hbox), widget);
gtk_widget_show (widget);
switch (G_PARAM_SPEC_VALUE_TYPE (specs[i])) {
case G_TYPE_INT64:
widget = gtk_hscale_new_with_range (
(gdouble) (((GParamSpecInt64 *) specs[i])->minimum),
(gdouble) (((GParamSpecInt64 *) specs[i])->maximum), 1.0);
gtk_range_set_value (GTK_RANGE (widget),
(gdouble) ((GParamSpecInt64 *) specs[i])->default_value);
break;
case G_TYPE_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_INT:
widget = gtk_hscale_new_with_range (
(gdouble) (((GParamSpecInt *) specs[i])->minimum),
(gdouble) (((GParamSpecInt *) specs[i])->maximum), 1.0);
gtk_range_set_value (GTK_RANGE (widget),
(gdouble) ((GParamSpecInt *) specs[i])->default_value);
break;
case G_TYPE_FLOAT:
widget = gtk_hscale_new_with_range (
(gdouble) (((GParamSpecFloat *) specs[i])->minimum),
(gdouble) (((GParamSpecFloat *) specs[i])->maximum), 0.00001);
gtk_range_set_value (GTK_RANGE (widget),
(gdouble) ((GParamSpecFloat *) specs[i])->default_value);
break;
}
/* create the dparam object */
dparam = gst_dpsmooth_new (G_PARAM_SPEC_VALUE_TYPE (specs[i]));
g_object_set (G_OBJECT (dparam), "update_period", 2000000LL, NULL);
g_assert (gst_dpman_attach_dparam (dpman,
(gchar *) g_param_spec_get_name (specs[i]), dparam));
(gchar *) g_param_spec_get_name (specs[i]), dparam));
gst_dpman_set_mode (dpman, "asynchronous");
g_signal_connect (widget, "value-changed",
G_CALLBACK (cb_dynparm_value_changed), dparam);
G_CALLBACK (cb_dynparm_value_changed), dparam);
cb_dynparm_value_changed (GTK_RANGE (widget), dparam);
gtk_container_add (GTK_CONTAINER (hbox), widget);
@ -315,7 +315,7 @@ cb_parse_clicked (GtkButton * button, gpointer * user_data)
fd->input = GST_ELEMENT (gst_parse_launch (fd->input_pipe, &error));
if (error) {
ui_feedback_add (fd->ui, "Error : parsing input pipeline : %s\n",
error->message);
error->message);
g_error_free (error);
return;
}
@ -329,7 +329,7 @@ cb_parse_clicked (GtkButton * button, gpointer * user_data)
fd->output = GST_ELEMENT (gst_parse_launch (fd->output_pipe, &error));
if (error) {
ui_feedback_add (fd->ui, "Error : parsing output pipeline : %s\n",
error->message);
error->message);
g_error_free (error);
return;
}
@ -340,7 +340,7 @@ cb_parse_clicked (GtkButton * button, gpointer * user_data)
fd->filter = gst_element_factory_make (fd->filter_element, "filter");
if (fd->filter == NULL) {
ui_feedback_add (fd->ui, "Error : could not create element %s\n",
fd->filter_element);
fd->filter_element);
return;
}
@ -359,14 +359,14 @@ cb_parse_clicked (GtkButton * button, gpointer * user_data)
"source");
if (src_pad == NULL) {
ui_feedback_add (fd->ui,
"Error : could not find an unconnected source pad !\n");
"Error : could not find an unconnected source pad !\n");
return;
}
sink_pad = gst_bin_find_unconnected_pad (GST_BIN (fd->output), GST_PAD_SINK,
"sink");
if (sink_pad == NULL) {
ui_feedback_add (fd->ui,
"Error : could not find an unconnected sink pad !\n");
"Error : could not find an unconnected sink pad !\n");
return;
}
gst_element_add_pad (fd->input, src_pad);
@ -417,8 +417,8 @@ init_data (_filter_data_t * fd)
void
create_ui (_filter_ui_t * fui, _filter_data_t * fd)
{
GtkWidget *widget; /* temporary widget */
GtkWidget *vbox; /* temporary vbox */
GtkWidget *widget; /* temporary widget */
GtkWidget *vbox; /* temporary vbox */
g_print ("DEBUG: creating top-level window\n");
fui->window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
@ -480,7 +480,7 @@ create_ui (_filter_ui_t * fui, _filter_data_t * fd)
widget = gtk_label_new ("Output Pipe");
gtk_container_add (GTK_CONTAINER (vbox), widget);
fui->output = gtk_entry_new ();
gtk_entry_set_text (GTK_ENTRY (fui->output), "osssink fragment=1572872"); /* fixme: gconf default ? */
gtk_entry_set_text (GTK_ENTRY (fui->output), "osssink fragment=1572872"); /* fixme: gconf default ? */
gtk_container_add (GTK_CONTAINER (vbox), fui->output);
gtk_container_add (GTK_CONTAINER (fui->selection), vbox);
g_signal_connect (G_OBJECT (fui->output), "activate",

View file

@ -36,7 +36,7 @@ print_tag (const GstTagList * list, const gchar * tag, gpointer unused)
g_assert (gst_tag_list_get_string_index (list, tag, i, &str));
} else {
str =
g_strdup_value_contents (gst_tag_list_get_value_index (list, tag, i));
g_strdup_value_contents (gst_tag_list_get_value_index (list, tag, i));
}
if (i == 0) {

View file

@ -29,21 +29,21 @@ entry_added (GstIndex * index, GstIndexEntry * entry)
switch (entry->type) {
case GST_INDEX_ENTRY_ID:
g_print ("id %d describes writer %s\n", entry->id,
GST_INDEX_ID_DESCRIPTION (entry));
GST_INDEX_ID_DESCRIPTION (entry));
break;
case GST_INDEX_ENTRY_FORMAT:
g_print ("%d: registered format %d for %s\n", entry->id,
GST_INDEX_FORMAT_FORMAT (entry), GST_INDEX_FORMAT_KEY (entry));
GST_INDEX_FORMAT_FORMAT (entry), GST_INDEX_FORMAT_KEY (entry));
break;
case GST_INDEX_ENTRY_ASSOCIATION:
{
gint i;
g_print ("%p, %d: %08x ", entry, entry->id,
GST_INDEX_ASSOC_FLAGS (entry));
GST_INDEX_ASSOC_FLAGS (entry));
for (i = 0; i < GST_INDEX_NASSOCS (entry); i++) {
g_print ("%d %lld ", GST_INDEX_ASSOC_FORMAT (entry, i),
GST_INDEX_ASSOC_VALUE (entry, i));
g_print ("%d %lld ", GST_INDEX_ASSOC_FORMAT (entry, i),
GST_INDEX_ASSOC_VALUE (entry, i));
}
g_print ("\n");
break;
@ -60,7 +60,8 @@ typedef struct
GstElement *bin;
GstElement *pipeline;
GstIndex *index;
} dyn_link;
}
dyn_link;
static void
dynamic_link (GstPadTemplate * templ, GstPad * newpad, gpointer data)
@ -205,18 +206,18 @@ main (gint argc, gchar * argv[])
GstElement *sink;
struct poptOption options[] = {
{"verbose", 'v', POPT_ARG_NONE | POPT_ARGFLAG_STRIP, &verbose, 0,
"Print index entries", NULL},
"Print index entries", NULL},
{"quiet", 'q', POPT_ARG_NONE | POPT_ARGFLAG_STRIP, &quiet, 0,
"don't print progress bar", NULL},
"don't print progress bar", NULL},
POPT_TABLEEND
};
if (!gst_init_check_with_popt_table (&argc, &argv, options) || argc < 3) {
g_print ("usage: %s [-v] <type> <filename> \n"
" type can be: 0 mpeg_systems\n"
" 1 mpeg_decoder\n"
" -v : report added index entries\n"
" -q : don't print progress\n", argv[0]);
" type can be: 0 mpeg_systems\n"
" 1 mpeg_decoder\n"
" -v : report added index entries\n"
" -q : don't print progress\n", argv[0]);
return -1;
}
@ -225,7 +226,7 @@ main (gint argc, gchar * argv[])
if (index) {
if (verbose)
g_signal_connect (G_OBJECT (index), "entry_added",
G_CALLBACK (entry_added), NULL);
G_CALLBACK (entry_added), NULL);
g_object_set (G_OBJECT (index), "resolver", 1, NULL);
}
@ -284,7 +285,7 @@ main (gint argc, gchar * argv[])
gst_index_get_writer_id (index, GST_OBJECT (src), &id);
entry = gst_index_get_assoc_entry (index, id, GST_INDEX_LOOKUP_BEFORE, 0,
GST_FORMAT_TIME, G_MAXINT64);
GST_FORMAT_TIME, G_MAXINT64);
g_assert (entry);
gst_index_entry_assoc_map (entry, GST_FORMAT_TIME, &result);
total_tm = result * 60 / GST_SECOND;

View file

@ -29,7 +29,7 @@ get_position_info (GstElement * cdparanoia)
if (format == GST_FORMAT_TIME) {
position /= GST_SECOND;
g_print ("%s: %lld:%02lld", definition->nick, position / 60,
position % 60);
position % 60);
} else {
g_print ("%s: %lld", definition->nick, position);
}
@ -72,16 +72,16 @@ get_track_info (GstElement * cdparanoia)
res = gst_pad_query (pad, GST_QUERY_TOTAL, &format, &total);
if (res) {
if (format == GST_FORMAT_TIME) {
total /= GST_SECOND;
g_print ("%s total: %lld:%02lld\n", definition->nick, total / 60,
total % 60);
total /= GST_SECOND;
g_print ("%s total: %lld:%02lld\n", definition->nick, total / 60,
total % 60);
} else
g_print ("%s total: %lld\n", definition->nick, total);
g_print ("%s total: %lld\n", definition->nick, total);
if (format == track_format)
total_tracks = total;
total_tracks = total;
else if (format == GST_FORMAT_TIME)
total_time = total;
total_time = total;
} else
g_print ("failed to get %s total\n", definition->nick);
@ -110,12 +110,12 @@ get_track_info (GstElement * cdparanoia)
/* for the first track (i==0) we wait until we have the
* time of the next track */
if (i > 0) {
gint64 length = time - time_count;
gint64 length = time - time_count;
g_print ("track %d: %lld:%02lld -> %lld:%02lld, length: %lld:%02lld\n",
i - 1,
time_count / 60, time_count % 60,
time / 60, time % 60, length / 60, length % 60);
g_print ("track %d: %lld:%02lld -> %lld:%02lld, length: %lld:%02lld\n",
i - 1,
time_count / 60, time_count % 60,
time / 60, time % 60, length / 60, length % 60);
}
} else {
g_print ("could not get time for track %d\n", i);

View file

@ -47,7 +47,8 @@ typedef struct
{
const gchar *name;
const GstFormat format;
} seek_format;
}
seek_format;
static seek_format seek_formats[] = {
{"tim", GST_FORMAT_TIME},
@ -76,9 +77,9 @@ query_durations ()
format = seek_formats[i].format;
res = gst_element_query (element, GST_QUERY_TOTAL, &format, &value);
if (res) {
g_print ("%s %13lld | ", seek_formats[i].name, value);
g_print ("%s %13lld | ", seek_formats[i].name, value);
} else {
g_print ("%s %13.13s | ", seek_formats[i].name, "*NA*");
g_print ("%s %13.13s | ", seek_formats[i].name, "*NA*");
}
i++;
}
@ -105,9 +106,9 @@ query_positions ()
format = seek_formats[i].format;
res = gst_element_query (element, GST_QUERY_POSITION, &format, &value);
if (res) {
g_print ("%s %13lld | ", seek_formats[i].name, value);
g_print ("%s %13lld | ", seek_formats[i].name, value);
} else {
g_print ("%s %13.13s | ", seek_formats[i].name, "*NA*");
g_print ("%s %13.13s | ", seek_formats[i].name, "*NA*");
}
i++;
}
@ -137,7 +138,7 @@ update_scale (gpointer data)
if (stats) {
if (clock)
g_print ("clock: %13llu (%s)\n", position,
gst_object_get_name (GST_OBJECT (clock)));
gst_object_get_name (GST_OBJECT (clock)));
query_durations ();
query_positions ();
}
@ -184,7 +185,7 @@ stop_seek (GtkWidget * widget, GdkEventButton * event, gpointer user_data)
g_print ("seek to %lld on element %s\n", real, GST_ELEMENT_NAME (seekable));
s_event = gst_event_new_seek (GST_FORMAT_TIME |
GST_SEEK_METHOD_SET | GST_SEEK_FLAG_FLUSH, real);
GST_SEEK_METHOD_SET | GST_SEEK_FLAG_FLUSH, real);
res = gst_element_send_event (seekable, s_event);
@ -208,7 +209,7 @@ play_cb (GtkButton * button, gpointer data)
if (!GST_FLAG_IS_SET (pipeline, GST_BIN_SELF_SCHEDULABLE))
gtk_idle_add ((GtkFunction) iterate, pipeline);
update_id =
gtk_timeout_add (UPDATE_INTERVAL, (GtkFunction) update_scale, pipeline);
gtk_timeout_add (UPDATE_INTERVAL, (GtkFunction) update_scale, pipeline);
}
}
@ -237,7 +238,7 @@ main (int argc, char **argv)
*play_button, *pause_button, *stop_button, *hscale;
struct poptOption options[] = {
{"stats", 's', POPT_ARG_NONE | POPT_ARGFLAG_STRIP, &stats, 0,
"Show element stats", NULL},
"Show element stats", NULL},
POPT_TABLEEND
};

View file

@ -28,7 +28,8 @@ typedef struct
const gchar *padname;
GstPad *target;
GstElement *bin;
} dyn_link;
}
dyn_link;
static GstElement *
gst_element_factory_make_or_warn (gchar * type, gchar * name)
@ -372,7 +373,7 @@ make_avi_pipeline (const gchar * location)
gst_element_set_state (audio_bin, GST_STATE_PAUSED);
setup_dynamic_link (demux, "audio_00", gst_element_get_pad (a_decoder,
"sink"), audio_bin);
"sink"), audio_bin);
seekable = gst_element_get_pad (a_queue, "src");
seekable_pads = g_list_prepend (seekable_pads, seekable);
@ -400,7 +401,7 @@ make_avi_pipeline (const gchar * location)
gst_element_set_state (video_bin, GST_STATE_PAUSED);
setup_dynamic_link (demux, "video_00", gst_element_get_pad (v_decoder,
"sink"), video_bin);
"sink"), video_bin);
seekable = gst_element_get_pad (v_queue, "src");
seekable_pads = g_list_prepend (seekable_pads, seekable);
@ -448,7 +449,7 @@ make_mpeg_pipeline (const gchar * location)
gst_bin_add (GST_BIN (audio_thread), audiosink);
setup_dynamic_link (demux, "audio_00", gst_element_get_pad (a_decoder,
"sink"), audio_bin);
"sink"), audio_bin);
seekable = gst_element_get_pad (a_queue, "src");
seekable_pads = g_list_prepend (seekable_pads, seekable);
@ -470,7 +471,7 @@ make_mpeg_pipeline (const gchar * location)
gst_bin_add_many (GST_BIN (video_thread), v_queue, v_filter, videosink, NULL);
setup_dynamic_link (demux, "video_00", gst_element_get_pad (v_decoder,
"sink"), video_bin);
"sink"), video_bin);
seekable = gst_element_get_pad (v_queue, "src");
seekable_pads = g_list_prepend (seekable_pads, seekable);
@ -519,7 +520,7 @@ make_mpegnt_pipeline (const gchar * location)
gst_bin_add (GST_BIN (audio_thread), audiosink);
setup_dynamic_link (demux, "audio_00", gst_element_get_pad (a_decoder,
"sink"), audio_bin);
"sink"), audio_bin);
seekable = gst_element_get_pad (a_queue, "src");
seekable_pads = g_list_prepend (seekable_pads, seekable);
@ -536,7 +537,7 @@ make_mpegnt_pipeline (const gchar * location)
gst_bin_add_many (GST_BIN (video_bin), v_decoder, v_filter, videosink, NULL);
setup_dynamic_link (demux, "video_00", gst_element_get_pad (v_decoder,
"sink"), video_bin);
"sink"), video_bin);
seekable = gst_element_get_pad (v_decoder, "src");
seekable_pads = g_list_prepend (seekable_pads, seekable);
@ -572,7 +573,8 @@ typedef struct
{
const gchar *name;
const GstFormat format;
} seek_format;
}
seek_format;
static seek_format seek_formats[] = {
{"tim", GST_FORMAT_TIME},
@ -599,9 +601,9 @@ query_rates (void)
format = seek_formats[i].format;
if (gst_pad_convert (pad, GST_FORMAT_TIME, GST_SECOND, &format, &value)) {
g_print ("%s %13lld | ", seek_formats[i].name, value);
g_print ("%s %13lld | ", seek_formats[i].name, value);
} else {
g_print ("%s %13.13s | ", seek_formats[i].name, "*NA*");
g_print ("%s %13.13s | ", seek_formats[i].name, "*NA*");
}
i++;
@ -630,9 +632,9 @@ query_durations ()
format = seek_formats[i].format;
res = gst_pad_query (pad, GST_QUERY_TOTAL, &format, &value);
if (res) {
g_print ("%s %13lld | ", seek_formats[i].name, value);
g_print ("%s %13lld | ", seek_formats[i].name, value);
} else {
g_print ("%s %13.13s | ", seek_formats[i].name, "*NA*");
g_print ("%s %13.13s | ", seek_formats[i].name, "*NA*");
}
i++;
}
@ -660,9 +662,9 @@ query_positions ()
format = seek_formats[i].format;
res = gst_pad_query (pad, GST_QUERY_POSITION, &format, &value);
if (res) {
g_print ("%s %13lld | ", seek_formats[i].name, value);
g_print ("%s %13lld | ", seek_formats[i].name, value);
} else {
g_print ("%s %13.13s | ", seek_formats[i].name, "*NA*");
g_print ("%s %13.13s | ", seek_formats[i].name, "*NA*");
}
i++;
}
@ -691,7 +693,7 @@ update_scale (gpointer data)
if (stats) {
g_print ("clock: %13llu (%s)\n", position,
gst_object_get_name (GST_OBJECT (clock)));
gst_object_get_name (GST_OBJECT (clock)));
query_durations ();
query_positions ();
query_rates ();
@ -740,10 +742,10 @@ stop_seek (GtkWidget * widget, GdkEventButton * event, gpointer user_data)
GstPad *seekable = GST_PAD (walk->data);
g_print ("seek to %lld on pad %s:%s\n", real,
GST_DEBUG_PAD_NAME (seekable));
GST_DEBUG_PAD_NAME (seekable));
s_event =
gst_event_new_seek (GST_FORMAT_TIME | GST_SEEK_METHOD_SET |
GST_SEEK_FLAG_FLUSH, real);
gst_event_new_seek (GST_FORMAT_TIME | GST_SEEK_METHOD_SET |
GST_SEEK_FLAG_FLUSH, real);
res = gst_pad_send_event (seekable, s_event);
@ -756,10 +758,10 @@ stop_seek (GtkWidget * widget, GdkEventButton * event, gpointer user_data)
GstElement *seekable = GST_ELEMENT (walk->data);
g_print ("seek to %lld on element %s\n", real,
gst_element_get_name (seekable));
gst_element_get_name (seekable));
s_event =
gst_event_new_seek (GST_FORMAT_TIME | GST_SEEK_METHOD_SET |
GST_SEEK_FLAG_FLUSH, real);
gst_event_new_seek (GST_FORMAT_TIME | GST_SEEK_METHOD_SET |
GST_SEEK_FLAG_FLUSH, real);
res = gst_element_send_event (seekable, s_event);
@ -782,7 +784,7 @@ play_cb (GtkButton * button, gpointer data)
gst_element_set_state (pipeline, GST_STATE_PLAYING);
gtk_idle_add ((GtkFunction) iterate, pipeline);
update_id =
gtk_timeout_add (UPDATE_INTERVAL, (GtkFunction) update_scale, pipeline);
gtk_timeout_add (UPDATE_INTERVAL, (GtkFunction) update_scale, pipeline);
}
}
@ -808,7 +810,8 @@ typedef struct
{
gchar *name;
GstElement *(*func) (const gchar * location);
} Pipeline;
}
Pipeline;
static Pipeline pipelines[] = {
{"mp3", make_mp3_pipeline},
@ -848,7 +851,7 @@ main (int argc, char **argv)
*play_button, *pause_button, *stop_button, *hscale;
struct poptOption options[] = {
{"stats", 's', POPT_ARG_NONE | POPT_ARGFLAG_STRIP, &stats, 0,
"Show pad stats", NULL},
"Show pad stats", NULL},
POPT_TABLEEND
};
gint type;

View file

@ -91,7 +91,8 @@ typedef struct
{
const gchar *name;
const GstFormat format;
} seek_format;
}
seek_format;
static seek_format seek_formats[] = {
{"tim", GST_FORMAT_TIME},
@ -118,9 +119,9 @@ query_rates (void)
format = seek_formats[i].format;
if (gst_pad_convert (pad, GST_FORMAT_TIME, GST_SECOND, &format, &value)) {
g_print ("%s %13lld | ", seek_formats[i].name, value);
g_print ("%s %13lld | ", seek_formats[i].name, value);
} else {
g_print ("%s %13.13s | ", seek_formats[i].name, "*NA*");
g_print ("%s %13.13s | ", seek_formats[i].name, "*NA*");
}
i++;
@ -149,9 +150,9 @@ query_durations ()
format = seek_formats[i].format;
res = gst_element_query (element, GST_QUERY_TOTAL, &format, &value);
if (res) {
g_print ("%s %13lld | ", seek_formats[i].name, value);
g_print ("%s %13lld | ", seek_formats[i].name, value);
} else {
g_print ("%s %13.13s | ", seek_formats[i].name, "*NA*");
g_print ("%s %13.13s | ", seek_formats[i].name, "*NA*");
}
i++;
}
@ -178,9 +179,9 @@ query_positions ()
format = seek_formats[i].format;
res = gst_element_query (element, GST_QUERY_POSITION, &format, &value);
if (res) {
g_print ("%s %13lld | ", seek_formats[i].name, value);
g_print ("%s %13lld | ", seek_formats[i].name, value);
} else {
g_print ("%s %13.13s | ", seek_formats[i].name, "*NA*");
g_print ("%s %13.13s | ", seek_formats[i].name, "*NA*");
}
i++;
}
@ -208,7 +209,7 @@ update_scale (gpointer data)
if (stats) {
g_print ("clock: %13llu (%s)\n", position,
gst_object_get_name (GST_OBJECT (clock)));
gst_object_get_name (GST_OBJECT (clock)));
query_durations ();
query_positions ();
query_rates ();
@ -255,7 +256,7 @@ stop_seek (GtkWidget * widget, GdkEventButton * event, gpointer user_data)
g_print ("seek to %lld on element %s\n", real, GST_ELEMENT_NAME (seekable));
s_event = gst_event_new_seek (GST_FORMAT_TIME |
GST_SEEK_METHOD_SET | GST_SEEK_FLAG_FLUSH, real);
GST_SEEK_METHOD_SET | GST_SEEK_FLAG_FLUSH, real);
res = gst_element_send_event (seekable, s_event);
@ -279,7 +280,7 @@ play_cb (GtkButton * button, gpointer data)
if (!GST_FLAG_IS_SET (pipeline, GST_BIN_SELF_SCHEDULABLE))
gtk_idle_add ((GtkFunction) iterate, pipeline);
update_id =
gtk_timeout_add (UPDATE_INTERVAL, (GtkFunction) update_scale, pipeline);
gtk_timeout_add (UPDATE_INTERVAL, (GtkFunction) update_scale, pipeline);
}
}
@ -309,9 +310,9 @@ main (int argc, char **argv)
gboolean threaded = FALSE;
struct poptOption options[] = {
{"threaded", 't', POPT_ARG_NONE | POPT_ARGFLAG_STRIP, &threaded, 0,
"Run the pipeline in a toplevel thread", NULL},
"Run the pipeline in a toplevel thread", NULL},
{"stats", 's', POPT_ARG_NONE | POPT_ARGFLAG_STRIP, &stats, 0,
"Show element stats", NULL},
"Show element stats", NULL},
POPT_TABLEEND
};

View file

@ -65,20 +65,20 @@ print_lbs_info (struct probe_context *context, gint stream)
/* get start and end position of this stream */
res = gst_pad_convert (context->pad,
context->ls_format, stream, &format, &value_start);
context->ls_format, stream, &format, &value_start);
res &= gst_pad_convert (context->pad,
context->ls_format, stream + 1, &format, &value_end);
context->ls_format, stream + 1, &format, &value_end);
if (res) {
/* substract to get the length */
value_end -= value_start;
if (format == GST_FORMAT_TIME) {
value_end /= (GST_SECOND / 100);
g_print (" %s: %lld:%02lld.%02lld\n", definition->nick,
value_end / 6000, (value_end / 100) % 60, (value_end % 100));
value_end /= (GST_SECOND / 100);
g_print (" %s: %lld:%02lld.%02lld\n", definition->nick,
value_end / 6000, (value_end / 100) % 60, (value_end % 100));
} else {
g_print (" %s: %lld\n", definition->nick, value_end);
g_print (" %s: %lld\n", definition->nick, value_end);
}
} else
g_print (" could not get logical stream %s\n", definition->nick);
@ -180,13 +180,13 @@ collect_stream_properties (struct probe_context *context)
if (res) {
if (format == GST_FORMAT_TIME) {
value /= (GST_SECOND / 100);
g_print (" total %s: %lld:%02lld.%02lld\n", definition->nick,
value / 6000, (value / 100) % 60, (value % 100));
value /= (GST_SECOND / 100);
g_print (" total %s: %lld:%02lld.%02lld\n", definition->nick,
value / 6000, (value / 100) % 60, (value % 100));
} else {
if (format == context->ls_format)
context->total_ls = value;
g_print (" total %s: %lld\n", definition->nick, value);
if (format == context->ls_format)
context->total_ls = value;
g_print (" total %s: %lld\n", definition->nick, value);
}
}
}

View file

@ -47,7 +47,7 @@ main (gint argc, gchar * argv[])
if (!pipeline) {
if (error)
g_print ("ERROR: pipeline could not be constructed: %s\n",
error->message);
error->message);
else
g_print ("ERROR: pipeline could not be constructed\n");
return -1;
@ -80,18 +80,18 @@ main (gint argc, gchar * argv[])
format = GST_FORMAT_BYTES;
/* see how many bytes are genereated per 8 seconds (== bitrate) */
gst_pad_convert (enc_src, GST_FORMAT_TIME, 8 * GST_SECOND,
&format, &bitrate_enc);
&format, &bitrate_enc);
gst_pad_convert (dec_sink, GST_FORMAT_TIME, 8 * GST_SECOND,
&format, &bitrate_dec);
&format, &bitrate_dec);
g_print ("[%2dm %.2ds] of [%2dm %.2ds], "
"src avg bitrate: %lld, dest avg birate: %lld, ratio [%02.2f] \r",
(gint) (position / (GST_SECOND * 60)),
(gint) (position / (GST_SECOND)) % 60,
(gint) (duration / (GST_SECOND * 60)),
(gint) (duration / (GST_SECOND)) % 60,
bitrate_dec, bitrate_enc, (gfloat) bitrate_dec / bitrate_enc);
"src avg bitrate: %lld, dest avg birate: %lld, ratio [%02.2f] \r",
(gint) (position / (GST_SECOND * 60)),
(gint) (position / (GST_SECOND)) % 60,
(gint) (duration / (GST_SECOND * 60)),
(gint) (duration / (GST_SECOND)) % 60,
bitrate_dec, bitrate_enc, (gfloat) bitrate_dec / bitrate_enc);
}
g_print ("\n");

View file

@ -42,21 +42,21 @@ static GstStaticPadTemplate sink_temp = GST_STATIC_PAD_TEMPLATE ("sink",
GST_PAD_SINK,
GST_PAD_ALWAYS,
GST_STATIC_CAPS ("audio/x-raw-int, "
"depth = (int) 16, "
"width = (int) 16, "
"signed = (boolean) true, "
"channels = (int) 2, " "endianness = (int) byte_order")
"depth = (int) 16, "
"width = (int) 16, "
"signed = (boolean) true, "
"channels = (int) 2, " "endianness = (int) byte_order")
);
static GstStaticPadTemplate src_temp = GST_STATIC_PAD_TEMPLATE ("src",
GST_PAD_SRC,
GST_PAD_ALWAYS,
GST_STATIC_CAPS ("audio/x-raw-int, "
"depth = (int) 16, "
"width = (int) 16, "
"signed = (boolean) true, "
"channels = (int) 2, "
"rate = (int) 44100, " "endianness = (int) byte_order")
"depth = (int) 16, "
"width = (int) 16, "
"signed = (boolean) true, "
"channels = (int) 2, "
"rate = (int) 44100, " "endianness = (int) byte_order")
);
enum
@ -93,8 +93,9 @@ gst_arts_get_type (void)
0,
(GInstanceInitFunc) gst_arts_init,
};
gst_arts_type =
g_type_register_static (GST_TYPE_ELEMENT, "GstArts", &gst_arts_info, 0);
g_type_register_static (GST_TYPE_ELEMENT, "GstArts", &gst_arts_info, 0);
}
return gst_arts_type;
}
@ -128,12 +129,12 @@ gst_arts_init (GstARTS * arts)
{
arts->sinkpad =
gst_pad_new_from_template (gst_element_get_pad_template (GST_ELEMENT
(arts), "sink"), "sink");
(arts), "sink"), "sink");
gst_element_add_pad (GST_ELEMENT (arts), arts->sinkpad);
arts->srcpad =
gst_pad_new_from_template (gst_element_get_pad_template (GST_ELEMENT
(arts), "src"), "src");
(arts), "src"), "src");
gst_element_add_pad (GST_ELEMENT (arts), arts->srcpad);
gst_element_set_loop_function (GST_ELEMENT (arts), gst_arts_loop);

View file

@ -44,40 +44,40 @@ namespace Gst
while (fulfilled < samples)
{
if (remainingsamples == 0) {
if (remainingsamples == 0) {
//fprintf(stderr,"need to get a buffer\n");
if (inbuf) {
gst_data_unref (inbuf);
inbuf = NULL;
}
// start by pulling a buffer from GStreamer
inbuf = gst_pad_pull (sinkpad);
if (inbuf) {
gst_data_unref (inbuf);
inbuf = NULL;
}
// start by pulling a buffer from GStreamer
inbuf = gst_pad_pull (sinkpad);
while (GST_IS_EVENT (inbuf)) {
switch (GST_EVENT_TYPE (inbuf)) {
case GST_EVENT_EOS:
gst_element_set_eos (GST_PAD_PARENT (sinkpad));
default:
break;
}
gst_pad_event_default (srcpad, GST_EVENT (inbuf));
inbuf = gst_pad_pull (sinkpad);
}
while (GST_IS_EVENT (inbuf)) {
switch (GST_EVENT_TYPE (inbuf)) {
case GST_EVENT_EOS:
gst_element_set_eos (GST_PAD_PARENT (sinkpad));
default:
break;
}
gst_pad_event_default (srcpad, GST_EVENT (inbuf));
inbuf = gst_pad_pull (sinkpad);
}
dataptr = GST_BUFFER_DATA (GST_BUFFER (inbuf));
remainingsamples = GST_BUFFER_SIZE (GST_BUFFER (inbuf)) / 4;
dataptr = GST_BUFFER_DATA (GST_BUFFER (inbuf));
remainingsamples = GST_BUFFER_SIZE (GST_BUFFER (inbuf)) / 4;
//fprintf(stderr,"got a buffer with %d samples\n",remainingsamples);
}
}
unsigned long count = MIN (remainingsamples, samples - fulfilled);
unsigned long count = MIN (remainingsamples, samples - fulfilled);
//fprintf(stderr,"have %d samples left, can fill %d\n",remainingsamples,count);
convert_stereo_i16le_2float (count, dataptr, outleft, outright);
convert_stereo_i16le_2float (count, dataptr, outleft, outright);
//s = (gint16 *)dataptr;
//fprintf(stderr,"samples in are %d and %d, out are %f and %f\n",s[0],s[1],outleft[0],outright[0]);
remainingsamples -= count;
dataptr += 4 * count;
fulfilled += count;
remainingsamples -= count;
dataptr += 4 * count;
fulfilled += count;
}
}
@ -112,7 +112,7 @@ namespace Gst
GST_BUFFER_SIZE (outbuf) = samples * 4;
memset (GST_BUFFER_DATA (outbuf), 0, samples * 4);
convert_stereo_2float_i16le (samples, inleft, inright,
GST_BUFFER_DATA (outbuf));
GST_BUFFER_DATA (outbuf));
//s = (gint16 *)GST_BUFFER_DATA(outbuf);
//fprintf(stderr,"samples in are %f and %f, out are %d and %d\n",inleft[0],inright[0],s[0],s[1]);
gst_pad_push (srcpad, GST_DATA (outbuf));

View file

@ -91,9 +91,10 @@ gst_artsdsink_get_type (void)
0,
(GInstanceInitFunc) gst_artsdsink_init,
};
artsdsink_type =
g_type_register_static (GST_TYPE_ELEMENT, "GstArtsdsink",
&artsdsink_info, 0);
g_type_register_static (GST_TYPE_ELEMENT, "GstArtsdsink",
&artsdsink_info, 0);
}
return artsdsink_type;
}
@ -119,9 +120,9 @@ gst_artsdsink_class_init (GstArtsdsinkClass * klass)
parent_class = g_type_class_ref (GST_TYPE_ELEMENT);
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_MUTE, g_param_spec_boolean ("mute", "mute", "mute", TRUE, G_PARAM_READWRITE)); /* CHECKME */
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_MUTE, g_param_spec_boolean ("mute", "mute", "mute", TRUE, G_PARAM_READWRITE)); /* CHECKME */
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_NAME, g_param_spec_string ("name", "name", "name", NULL, G_PARAM_READWRITE)); /* CHECKME */
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_NAME, g_param_spec_string ("name", "name", "name", NULL, G_PARAM_READWRITE)); /* CHECKME */
gobject_class->set_property = gst_artsdsink_set_property;
gobject_class->get_property = gst_artsdsink_get_property;
@ -134,7 +135,7 @@ gst_artsdsink_init (GstArtsdsink * artsdsink)
{
artsdsink->sinkpad =
gst_pad_new_from_template (gst_element_get_pad_template (GST_ELEMENT
(artsdsink), "sink"), "sink");
(artsdsink), "sink"), "sink");
gst_element_add_pad (GST_ELEMENT (artsdsink), artsdsink->sinkpad);
gst_pad_set_chain_function (artsdsink->sinkpad, gst_artsdsink_chain);
gst_pad_set_link_function (artsdsink->sinkpad, gst_artsdsink_link);
@ -190,24 +191,24 @@ gst_artsdsink_chain (GstPad * pad, GstData * _data)
if (GST_BUFFER_DATA (buf) != NULL) {
gst_trace_add_entry (NULL, 0, GPOINTER_TO_INT (buf),
"artsdsink: writing to server");
"artsdsink: writing to server");
if (!artsdsink->mute && artsdsink->connected) {
int bytes;
void *bufptr = GST_BUFFER_DATA (buf);
int bufsize = GST_BUFFER_SIZE (buf);
GST_DEBUG ("artsdsink: stream=%p data=%p size=%d",
artsdsink->stream, GST_BUFFER_DATA (buf), GST_BUFFER_SIZE (buf));
artsdsink->stream, GST_BUFFER_DATA (buf), GST_BUFFER_SIZE (buf));
do {
bytes = arts_write (artsdsink->stream, bufptr, bufsize);
if (bytes < 0) {
fprintf (stderr, "arts_write error: %s\n", arts_error_text (bytes));
gst_buffer_unref (buf);
return;
}
bufptr += bytes;
bufsize -= bytes;
bytes = arts_write (artsdsink->stream, bufptr, bufsize);
if (bytes < 0) {
fprintf (stderr, "arts_write error: %s\n", arts_error_text (bytes));
gst_buffer_unref (buf);
return;
}
bufptr += bytes;
bufsize -= bytes;
} while (bufsize > 0);
}
}
@ -230,11 +231,11 @@ gst_artsdsink_set_property (GObject * object, guint prop_id,
break;
case ARG_NAME:
if (artsdsink->connect_name != NULL)
g_free (artsdsink->connect_name);
g_free (artsdsink->connect_name);
if (g_value_get_string (value) == NULL)
artsdsink->connect_name = NULL;
artsdsink->connect_name = NULL;
else
artsdsink->connect_name = g_strdup (g_value_get_string (value));
artsdsink->connect_name = g_strdup (g_value_get_string (value));
break;
default:
break;
@ -268,7 +269,7 @@ static gboolean
plugin_init (GstPlugin * plugin)
{
if (!gst_element_register (plugin, "artsdsink", GST_RANK_NONE,
GST_TYPE_ARTSDSINK))
GST_TYPE_ARTSDSINK))
return FALSE;
return TRUE;
@ -337,7 +338,7 @@ gst_artsdsink_change_state (GstElement * element)
} else {
if (!GST_FLAG_IS_SET (element, GST_ARTSDSINK_OPEN)) {
if (!gst_artsdsink_open_audio (GST_ARTSDSINK (element)))
return GST_STATE_FAILURE;
return GST_STATE_FAILURE;
}
}

View file

@ -57,13 +57,13 @@ GST_STATIC_PAD_TEMPLATE ("src",
GST_PAD_SRC,
GST_PAD_ALWAYS,
GST_STATIC_CAPS ("audio/x-raw-int, "
"rate = (int) [ 1, MAX ], "
"channels = (int) [ 1, MAX ], "
"endianness = (int) BYTE_ORDER, "
"width = (int) { 8, 16 }, "
"depth = (int) { 8, 16 }, "
"signed = (boolean) { true, false }, "
"buffer-frames = (int) [ 1, MAX ]")
"rate = (int) [ 1, MAX ], "
"channels = (int) [ 1, MAX ], "
"endianness = (int) BYTE_ORDER, "
"width = (int) { 8, 16 }, "
"depth = (int) { 8, 16 }, "
"signed = (boolean) { true, false }, "
"buffer-frames = (int) [ 1, MAX ]")
);
static GstStaticPadTemplate afparse_sink_factory =
@ -112,9 +112,10 @@ gst_afparse_get_type (void)
0,
(GInstanceInitFunc) gst_afparse_init,
};
afparse_type =
g_type_register_static (GST_TYPE_ELEMENT, "GstAFParse", &afparse_info,
0);
g_type_register_static (GST_TYPE_ELEMENT, "GstAFParse", &afparse_info,
0);
}
return afparse_type;
}
@ -151,13 +152,13 @@ gst_afparse_init (GstAFParse * afparse)
{
afparse->srcpad =
gst_pad_new_from_template (gst_element_get_pad_template (GST_ELEMENT
(afparse), "src"), "src");
(afparse), "src"), "src");
gst_pad_use_explicit_caps (afparse->srcpad);
gst_element_add_pad (GST_ELEMENT (afparse), afparse->srcpad);
afparse->sinkpad =
gst_pad_new_from_template (gst_element_get_pad_template (GST_ELEMENT
(afparse), "sink"), "sink");
(afparse), "sink"), "sink");
gst_element_add_pad (GST_ELEMENT (afparse), afparse->sinkpad);
gst_element_set_loop_function (GST_ELEMENT (afparse), gst_afparse_loop);
@ -217,8 +218,8 @@ gst_afparse_loop (GstElement * element)
&v_width);
if (afGetCompression != AF_COMPRESSION_NONE
|| afGetByteOrder (afparse->file,
AF_DEFAULT_TRACK) != afGetVirtualByteOrder (afparse->file,
AF_DEFAULT_TRACK) || s_format != v_format || s_width != v_width) {
AF_DEFAULT_TRACK) != afGetVirtualByteOrder (afparse->file,
AF_DEFAULT_TRACK) || s_format != v_format || s_width != v_width) {
bypass_afread = FALSE;
}
@ -241,24 +242,24 @@ gst_afparse_loop (GstElement * element)
got_bytes = gst_bytestream_read (bs, &buf, bytes_per_read);
if (got_bytes == 0) {
/* we need to check for an event. */
gst_bytestream_get_status (bs, &waiting, &event);
if (event && GST_EVENT_TYPE (event) == GST_EVENT_EOS) {
gst_pad_push (afparse->srcpad,
GST_DATA (gst_event_new (GST_EVENT_EOS)));
gst_element_set_eos (GST_ELEMENT (afparse));
break;
}
/* we need to check for an event. */
gst_bytestream_get_status (bs, &waiting, &event);
if (event && GST_EVENT_TYPE (event) == GST_EVENT_EOS) {
gst_pad_push (afparse->srcpad,
GST_DATA (gst_event_new (GST_EVENT_EOS)));
gst_element_set_eos (GST_ELEMENT (afparse));
break;
}
} else {
GST_BUFFER_TIMESTAMP (buf) = afparse->timestamp;
gst_pad_push (afparse->srcpad, GST_DATA (buf));
if (got_bytes != bytes_per_read) {
/* this shouldn't happen very often */
/* FIXME calculate the timestamps based on the fewer bytes received */
GST_BUFFER_TIMESTAMP (buf) = afparse->timestamp;
gst_pad_push (afparse->srcpad, GST_DATA (buf));
if (got_bytes != bytes_per_read) {
/* this shouldn't happen very often */
/* FIXME calculate the timestamps based on the fewer bytes received */
} else {
afparse->timestamp += frames_per_read * 1E9 / afparse->rate;
}
} else {
afparse->timestamp += frames_per_read * 1E9 / afparse->rate;
}
}
}
while (TRUE);
@ -269,17 +270,17 @@ gst_afparse_loop (GstElement * element)
GST_BUFFER_TIMESTAMP (buf) = afparse->timestamp;
data = GST_BUFFER_DATA (buf);
numframes =
afReadFrames (afparse->file, AF_DEFAULT_TRACK, data, frames_per_read);
afReadFrames (afparse->file, AF_DEFAULT_TRACK, data, frames_per_read);
/* events are handled in gst_afparse_vf_read so if there are no
* frames it must be EOS */
if (numframes < 1) {
gst_buffer_unref (buf);
gst_buffer_unref (buf);
gst_pad_push (afparse->srcpad,
GST_DATA (gst_event_new (GST_EVENT_EOS)));
gst_element_set_eos (GST_ELEMENT (afparse));
break;
gst_pad_push (afparse->srcpad,
GST_DATA (gst_event_new (GST_EVENT_EOS)));
gst_element_set_eos (GST_ELEMENT (afparse));
break;
}
GST_BUFFER_SIZE (buf) = numframes * frames_to_bytes;
gst_pad_push (afparse->srcpad, GST_DATA (buf));
@ -334,7 +335,7 @@ gst_afparse_plugin_init (GstPlugin * plugin)
return FALSE;
if (!gst_element_register (plugin, "afparse", GST_RANK_NONE,
GST_TYPE_AFPARSE))
GST_TYPE_AFPARSE))
return FALSE;
return TRUE;
@ -363,35 +364,35 @@ gst_afparse_open_file (GstAFParse * afparse)
afparse->channels = afGetChannels (afparse->file, AF_DEFAULT_TRACK);
afGetSampleFormat (afparse->file, AF_DEFAULT_TRACK,
&sampleFormat, &sampleWidth);
&sampleFormat, &sampleWidth);
switch (sampleFormat) {
case AF_SAMPFMT_TWOSCOMP:
afparse->is_signed = TRUE;
break;
afparse->is_signed = TRUE;
break;
case AF_SAMPFMT_UNSIGNED:
afparse->is_signed = FALSE;
break;
afparse->is_signed = FALSE;
break;
case AF_SAMPFMT_FLOAT:
case AF_SAMPFMT_DOUBLE:
GST_DEBUG ("ERROR: float data not supported yet !\n");
GST_DEBUG ("ERROR: float data not supported yet !\n");
}
afparse->rate = (guint) afGetRate (afparse->file, AF_DEFAULT_TRACK);
afparse->width = sampleWidth;
GST_DEBUG ("input file: %d channels, %d width, %d rate, signed %s\n",
afparse->channels, afparse->width, afparse->rate,
afparse->is_signed ? "yes" : "no");
afparse->channels, afparse->width, afparse->rate,
afparse->is_signed ? "yes" : "no");
}
/* set caps on src */
/*FIXME: add all the possible formats, especially float ! */
gst_pad_set_explicit_caps (afparse->srcpad,
gst_caps_new_simple ("audio/x-raw-int",
"endianness", G_TYPE_INT, G_BYTE_ORDER,
"signed", G_TYPE_BOOLEAN, afparse->is_signed,
"width", G_TYPE_INT, afparse->width,
"depth", G_TYPE_INT, afparse->width,
"rate", G_TYPE_INT, afparse->rate,
"channels", G_TYPE_INT, afparse->channels, NULL));
"endianness", G_TYPE_INT, G_BYTE_ORDER,
"signed", G_TYPE_BOOLEAN, afparse->is_signed,
"width", G_TYPE_INT, afparse->width,
"depth", G_TYPE_INT, afparse->width,
"rate", G_TYPE_INT, afparse->rate,
"channels", G_TYPE_INT, afparse->channels, NULL));
GST_FLAG_SET (afparse, GST_AFPARSE_OPEN);
@ -433,17 +434,17 @@ gst_afparse_vf_read (AFvirtualfile * vfile, void *data, size_t nbytes)
}
switch (GST_EVENT_TYPE (event)) {
case GST_EVENT_EOS:
return 0;
return 0;
case GST_EVENT_FLUSH:
GST_DEBUG ("flush");
break;
GST_DEBUG ("flush");
break;
case GST_EVENT_DISCONTINUOUS:
GST_DEBUG ("seek done");
got_bytes = gst_bytestream_peek_bytes (bs, &bytes, nbytes);
break;
GST_DEBUG ("seek done");
got_bytes = gst_bytestream_peek_bytes (bs, &bytes, nbytes);
break;
default:
g_warning ("unknown event %d", GST_EVENT_TYPE (event));
got_bytes = gst_bytestream_peek_bytes (bs, &bytes, nbytes);
g_warning ("unknown event %d", GST_EVENT_TYPE (event));
got_bytes = gst_bytestream_peek_bytes (bs, &bytes, nbytes);
}
}

View file

@ -65,13 +65,13 @@ GST_STATIC_PAD_TEMPLATE ("sink",
GST_PAD_SINK,
GST_PAD_ALWAYS,
GST_STATIC_CAPS ("audio/x-raw-int, "
"rate = (int) [ 1, MAX ], "
"channels = (int) [ 1, 2 ], "
"endianness = (int) BYTE_ORDER, "
"width = (int) { 8, 16 }, "
"depth = (int) { 8, 16 }, "
"signed = (boolean) { true, false }, "
"buffer-frames = (int) [ 1, MAX ]")
"rate = (int) [ 1, MAX ], "
"channels = (int) [ 1, 2 ], "
"endianness = (int) BYTE_ORDER, "
"width = (int) { 8, 16 }, "
"depth = (int) { 8, 16 }, "
"signed = (boolean) { true, false }, "
"buffer-frames = (int) [ 1, MAX ]")
);
/* we use an enum for the output type arg */
@ -93,7 +93,7 @@ gst_afsink_types_get_type (void)
if (!afsink_types_type) {
afsink_types_type =
g_enum_register_static ("GstAudiosinkTypes", afsink_types);
g_enum_register_static ("GstAudiosinkTypes", afsink_types);
}
return afsink_types_type;
}
@ -136,8 +136,9 @@ gst_afsink_get_type (void)
0,
(GInstanceInitFunc) gst_afsink_init,
};
afsink_type =
g_type_register_static (GST_TYPE_ELEMENT, "GstAFSink", &afsink_info, 0);
g_type_register_static (GST_TYPE_ELEMENT, "GstAFSink", &afsink_info, 0);
}
return afsink_type;
}
@ -166,8 +167,8 @@ gst_afsink_class_init (GstAFSinkClass * klass)
gst_element_class_install_std_props (GST_ELEMENT_CLASS (klass),
"location", ARG_LOCATION, G_PARAM_READWRITE, NULL);
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_TYPE, g_param_spec_enum ("type", "type", "type", GST_TYPE_AFSINK_TYPES, 0, G_PARAM_READWRITE)); /* CHECKME! */
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_OUTPUT_ENDIANNESS, g_param_spec_int ("endianness", "endianness", "endianness", G_MININT, G_MAXINT, 0, G_PARAM_READWRITE)); /* CHECKME */
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_TYPE, g_param_spec_enum ("type", "type", "type", GST_TYPE_AFSINK_TYPES, 0, G_PARAM_READWRITE)); /* CHECKME! */
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_OUTPUT_ENDIANNESS, g_param_spec_int ("endianness", "endianness", "endianness", G_MININT, G_MAXINT, 0, G_PARAM_READWRITE)); /* CHECKME */
gst_afsink_signals[SIGNAL_HANDOFF] =
g_signal_new ("handoff", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST,
@ -188,7 +189,7 @@ gst_afsink_init (GstAFSink * afsink)
afsink->sinkpad =
gst_pad_new_from_template (gst_element_get_pad_template (GST_ELEMENT
(afsink), "sink"), "sink");
(afsink), "sink"), "sink");
gst_element_add_pad (GST_ELEMENT (afsink), afsink->sinkpad);
gst_pad_set_chain_function (afsink->sinkpad, gst_afsink_chain);
@ -217,14 +218,14 @@ gst_afsink_set_property (GObject * object, guint prop_id, const GValue * value,
case ARG_LOCATION:
/* the element must be stopped or paused in order to do this */
g_return_if_fail ((GST_STATE (sink) < GST_STATE_PLAYING)
|| (GST_STATE (sink) == GST_STATE_PAUSED));
|| (GST_STATE (sink) == GST_STATE_PAUSED));
if (sink->filename)
g_free (sink->filename);
g_free (sink->filename);
sink->filename = g_strdup (g_value_get_string (value));
if ((GST_STATE (sink) == GST_STATE_PAUSED)
&& (sink->filename != NULL)) {
gst_afsink_close_file (sink);
gst_afsink_open_file (sink);
&& (sink->filename != NULL)) {
gst_afsink_close_file (sink);
gst_afsink_open_file (sink);
}
break;
@ -236,7 +237,7 @@ gst_afsink_set_property (GObject * object, guint prop_id, const GValue * value,
int end = g_value_get_int (value);
if (end == 1234 || end == 4321)
sink->endianness_output = end;
sink->endianness_output = end;
}
break;
default:
@ -291,8 +292,8 @@ gst_afsink_open_file (GstAFSink * sink)
AFfilesetup outfilesetup;
const GstCaps *caps;
GstStructure *structure;
int sample_format; /* audiofile's sample format, look in audiofile.h */
int byte_order = 0; /* audiofile's byte order defines */
int sample_format; /* audiofile's sample format, look in audiofile.h */
int byte_order = 0; /* audiofile's byte order defines */
g_return_val_if_fail (!GST_FLAG_IS_SET (sink, GST_AFSINK_OPEN), FALSE);
@ -342,8 +343,8 @@ gst_afsink_open_file (GstAFSink * sink)
sink->file = afOpenFile (sink->filename, "w", outfilesetup);
if (sink->file == AF_NULL_FILEHANDLE) {
GST_ELEMENT_ERROR (sink, RESOURCE, OPEN_WRITE,
(_("Could not open file \"%s\" for writing."), sink->filename),
("system error: %s", strerror (errno)));
(_("Could not open file \"%s\" for writing."), sink->filename),
("system error: %s", strerror (errno)));
return FALSE;
}
@ -364,7 +365,7 @@ gst_afsink_close_file (GstAFSink * sink)
/* if (fclose (sink->file) != 0) */
if (afCloseFile (sink->file) != 0) {
GST_ELEMENT_ERROR (sink, RESOURCE, CLOSE,
(_("Error closing file \"%s\"."), sink->filename), GST_ERROR_SYSTEM);
(_("Error closing file \"%s\"."), sink->filename), GST_ERROR_SYSTEM);
} else {
GST_FLAG_UNSET (sink, GST_AFSINK_OPEN);
}
@ -417,10 +418,10 @@ gst_afsink_chain (GstPad * pad, GstData * _data)
int frameCount = 0;
frameCount =
GST_BUFFER_SIZE (buf) / ((afsink->width / 8) * afsink->channels);
GST_BUFFER_SIZE (buf) / ((afsink->width / 8) * afsink->channels);
/* g_print ("DEBUG: writing %d frames ", frameCount); */
ret = afWriteFrames (afsink->file, AF_DEFAULT_TRACK,
GST_BUFFER_DATA (buf), frameCount);
GST_BUFFER_DATA (buf), frameCount);
if (ret == AF_BAD_WRITE || ret == AF_BAD_LSEEK) {
printf ("afsink : Warning : afWriteFrames returned an error (%d)\n", ret);
}

View file

@ -62,13 +62,13 @@ static GstStaticPadTemplate afsrc_src_factory = GST_STATIC_PAD_TEMPLATE ("src",
GST_PAD_SRC,
GST_PAD_ALWAYS,
GST_STATIC_CAPS ("audio/x-raw-int, "
"rate = (int) [ 1, MAX ], "
"channels = (int) [ 1, MAX ], "
"endianness = (int) BYTE_ORDER, "
"width = (int) { 8, 16 }, "
"depth = (int) { 8, 16 }, "
"signed = (boolean) { true, false }, "
"buffer-frames = (int) [ 1, MAX ]")
"rate = (int) [ 1, MAX ], "
"channels = (int) [ 1, MAX ], "
"endianness = (int) BYTE_ORDER, "
"width = (int) { 8, 16 }, "
"depth = (int) { 8, 16 }, "
"signed = (boolean) { true, false }, "
"buffer-frames = (int) [ 1, MAX ]")
);
/* we use an enum for the output type arg */
@ -133,8 +133,9 @@ gst_afsrc_get_type (void)
0,
(GInstanceInitFunc) gst_afsrc_init,
};
afsrc_type =
g_type_register_static (GST_TYPE_ELEMENT, "GstAFSrc", &afsrc_info, 0);
g_type_register_static (GST_TYPE_ELEMENT, "GstAFSrc", &afsrc_info, 0);
}
return afsrc_type;
}
@ -181,7 +182,7 @@ gst_afsrc_init (GstAFSrc * afsrc)
/* no need for a template, caps are set based on file, right ? */
afsrc->srcpad =
gst_pad_new_from_template (gst_element_get_pad_template (GST_ELEMENT
(afsrc), "src"), "src");
(afsrc), "src"), "src");
gst_element_add_pad (GST_ELEMENT (afsrc), afsrc->srcpad);
gst_pad_use_explicit_caps (afsrc->srcpad);
gst_pad_set_get_function (afsrc->srcpad, gst_afsrc_get);
@ -258,7 +259,7 @@ gst_afsrc_set_property (GObject * object, guint prop_id, const GValue * value,
switch (prop_id) {
case ARG_LOCATION:
if (src->filename)
g_free (src->filename);
g_free (src->filename);
src->filename = g_strdup (g_value_get_string (value));
break;
default:
@ -316,8 +317,8 @@ gst_afsrc_open_file (GstAFSrc * src)
src->file = afOpenFile (src->filename, "r", AF_NULL_FILESETUP);
if (src->file == AF_NULL_FILEHANDLE) {
GST_ELEMENT_ERROR (src, RESOURCE, OPEN_READ,
(_("Could not open file \"%s\" for reading."), src->filename),
("system error: %s", strerror (errno)));
(_("Could not open file \"%s\" for reading."), src->filename),
("system error: %s", strerror (errno)));
return FALSE;
}
@ -327,33 +328,33 @@ gst_afsrc_open_file (GstAFSrc * src)
src->channels = afGetChannels (src->file, AF_DEFAULT_TRACK);
afGetSampleFormat (src->file, AF_DEFAULT_TRACK,
&sampleFormat, &sampleWidth);
&sampleFormat, &sampleWidth);
switch (sampleFormat) {
case AF_SAMPFMT_TWOSCOMP:
src->is_signed = TRUE;
break;
src->is_signed = TRUE;
break;
case AF_SAMPFMT_UNSIGNED:
src->is_signed = FALSE;
break;
src->is_signed = FALSE;
break;
case AF_SAMPFMT_FLOAT:
case AF_SAMPFMT_DOUBLE:
GST_DEBUG ("ERROR: float data not supported yet !\n");
GST_DEBUG ("ERROR: float data not supported yet !\n");
}
src->rate = (guint) afGetRate (src->file, AF_DEFAULT_TRACK);
src->width = sampleWidth;
GST_DEBUG ("input file: %d channels, %d width, %d rate, signed %s\n",
src->channels, src->width, src->rate, src->is_signed ? "yes" : "no");
src->channels, src->width, src->rate, src->is_signed ? "yes" : "no");
}
/* set caps on src */
gst_pad_set_explicit_caps (src->srcpad,
gst_caps_new_simple ("audio/x-raw-int",
"endianness", G_TYPE_INT, G_BYTE_ORDER,
"signed", G_TYPE_BOOLEAN, src->is_signed,
"width", G_TYPE_INT, src->width,
"depth", G_TYPE_INT, src->width,
"rate", G_TYPE_INT, src->rate,
"channels", G_TYPE_INT, src->channels, NULL));
"endianness", G_TYPE_INT, G_BYTE_ORDER,
"signed", G_TYPE_BOOLEAN, src->is_signed,
"width", G_TYPE_INT, src->width,
"depth", G_TYPE_INT, src->width,
"rate", G_TYPE_INT, src->rate,
"channels", G_TYPE_INT, src->channels, NULL));
GST_FLAG_SET (src, GST_AFSRC_OPEN);
@ -369,7 +370,7 @@ gst_afsrc_close_file (GstAFSrc * src)
/* if (fclose (src->file) != 0) */
if (afCloseFile (src->file) != 0) {
GST_ELEMENT_ERROR (src, RESOURCE, CLOSE,
(_("Error closing file \"%s\"."), src->filename), GST_ERROR_SYSTEM);
(_("Error closing file \"%s\"."), src->filename), GST_ERROR_SYSTEM);
} else {
GST_FLAG_UNSET (src, GST_AFSRC_OPEN);
}
@ -393,7 +394,7 @@ gst_afsrc_change_state (GstElement * element)
/* g_print ("DEBUG: GST_AFSRC_OPEN not set\n"); */
if (!gst_afsrc_open_file (GST_AFSRC (element))) {
/* g_print ("DEBUG: element tries to open file\n"); */
return GST_STATE_FAILURE;
return GST_STATE_FAILURE;
}
}
}

View file

@ -134,9 +134,10 @@ gst_cdaudio_get_type (void)
(GInstanceInitFunc) gst_cdaudio_init,
NULL
};
gst_cdaudio_type =
g_type_register_static (GST_TYPE_BIN, "GstCDAudio", &gst_cdaudio_info,
0);
g_type_register_static (GST_TYPE_BIN, "GstCDAudio", &gst_cdaudio_info,
0);
track_format = gst_format_register ("track", "CD track");
sector_format = gst_format_register ("sector", "CD sector");
@ -163,22 +164,22 @@ gst_cdaudio_class_init (GstCDAudioClass * klass)
g_object_class_install_property (gobject_klass, ARG_DEVICE,
g_param_spec_string ("device", "Device", "CDROM device",
NULL, G_PARAM_READWRITE));
NULL, G_PARAM_READWRITE));
g_object_class_install_property (gobject_klass, ARG_DISCID,
g_param_spec_ulong ("discid", "Disc ID", "CDDB Disc ID",
0, G_MAXULONG, 0, G_PARAM_READABLE));
0, G_MAXULONG, 0, G_PARAM_READABLE));
g_object_class_install_property (gobject_klass, ARG_VOLUME_FL,
g_param_spec_int ("volume_fl", "Volume fl", "Front left volume",
0, 255, 255, G_PARAM_READWRITE));
0, 255, 255, G_PARAM_READWRITE));
g_object_class_install_property (gobject_klass, ARG_VOLUME_FR,
g_param_spec_int ("volume_fr", "Volume fr", "Front right volume",
0, 255, 255, G_PARAM_READWRITE));
0, 255, 255, G_PARAM_READWRITE));
g_object_class_install_property (gobject_klass, ARG_VOLUME_BL,
g_param_spec_int ("volume_bl", "Volume bl", "Back left volume",
0, 255, 255, G_PARAM_READWRITE));
0, 255, 255, G_PARAM_READWRITE));
g_object_class_install_property (gobject_klass, ARG_VOLUME_BR,
g_param_spec_int ("volume_br", "Volume br", "Back right volume",
0, 255, 255, G_PARAM_READWRITE));
0, 255, 255, G_PARAM_READWRITE));
gst_cdaudio_signals[TRACK_CHANGE] =
g_signal_new ("track-change", G_TYPE_FROM_CLASS (klass),
@ -290,10 +291,10 @@ print_track_info (GstCDAudio * cdaudio)
for (i = 0; i < cdaudio->info.disc_total_tracks; i++) {
g_print ("%d %d %d %d:%02d\n", i,
cdaudio->info.disc_track[i].track_length.frames,
cdaudio->info.disc_track[i].track_pos.frames,
cdaudio->info.disc_track[i].track_length.minutes,
cdaudio->info.disc_track[i].track_length.seconds);
cdaudio->info.disc_track[i].track_length.frames,
cdaudio->info.disc_track[i].track_pos.frames,
cdaudio->info.disc_track[i].track_length.minutes,
cdaudio->info.disc_track[i].track_length.seconds);
}
}
@ -310,14 +311,14 @@ gst_cdaudio_change_state (GstElement * element)
case GST_STATE_READY_TO_PAUSED:
cdaudio->cd_desc = cd_init_device (cdaudio->device);
if (cdaudio->cd_desc < 0)
return GST_STATE_FAILURE;
return GST_STATE_FAILURE;
/* close tray */
if (cd_close (cdaudio->cd_desc) < 0)
return GST_STATE_FAILURE;
return GST_STATE_FAILURE;
if (cd_stat (cdaudio->cd_desc, &cdaudio->info) < 0)
return GST_STATE_FAILURE;
return GST_STATE_FAILURE;
print_track_info (cdaudio);
@ -331,12 +332,12 @@ gst_cdaudio_change_state (GstElement * element)
gint res;
if (cdaudio->was_playing)
res = cd_resume (cdaudio->cd_desc);
res = cd_resume (cdaudio->cd_desc);
else
res = cd_play (cdaudio->cd_desc, 1);
res = cd_play (cdaudio->cd_desc, 1);
if (res < 0)
return GST_STATE_FAILURE;
return GST_STATE_FAILURE;
cdaudio->was_playing = TRUE;
g_timer_start (cdaudio->timer);
@ -344,14 +345,14 @@ gst_cdaudio_change_state (GstElement * element)
}
case GST_STATE_PLAYING_TO_PAUSED:
if (cd_pause (cdaudio->cd_desc) < 0)
return GST_STATE_FAILURE;
return GST_STATE_FAILURE;
g_timer_stop (cdaudio->timer);
break;
case GST_STATE_PAUSED_TO_READY:
if (cd_stop (cdaudio->cd_desc) < 0)
return GST_STATE_FAILURE;
return GST_STATE_FAILURE;
if (cd_finish (cdaudio->cd_desc) < 0)
return GST_STATE_FAILURE;
return GST_STATE_FAILURE;
break;
case GST_STATE_READY_TO_NULL:
break;
@ -386,15 +387,15 @@ gst_cdaudio_send_event (GstElement * element, GstEvent * event)
switch (GST_EVENT_TYPE (event)) {
case GST_EVENT_SEEK:
switch (GST_EVENT_SEEK_FORMAT (event)) {
case GST_FORMAT_TIME:
{
cd_play_pos (cdaudio->cd_desc, 1,
GST_EVENT_SEEK_OFFSET (event) / (60 * GST_SECOND));
break;
}
default:
res = FALSE;
break;
case GST_FORMAT_TIME:
{
cd_play_pos (cdaudio->cd_desc, 1,
GST_EVENT_SEEK_OFFSET (event) / (60 * GST_SECOND));
break;
}
default:
res = FALSE;
break;
}
break;
default:
@ -412,8 +413,8 @@ gst_cdaudio_get_formats (GstElement * element)
GST_FORMAT_TIME,
GST_FORMAT_BYTES,
GST_FORMAT_DEFAULT,
0, /* fillted below */
0, /* fillted below */
0, /* fillted below */
0, /* fillted below */
0,
};
@ -441,6 +442,7 @@ gst_cdaudio_get_query_types (GstElement * element)
GST_QUERY_SEGMENT_END,
0
};
return query_types;
}
@ -465,36 +467,36 @@ gst_cdaudio_query (GstElement * element, GstQueryType type,
switch (type) {
case GST_QUERY_TOTAL:
switch (*format) {
case GST_FORMAT_TIME:
*value = (cdaudio->info.disc_length.minutes * 60 +
cdaudio->info.disc_length.seconds) * GST_SECOND;
break;
default:
{
if (*format == track_format) {
*value = cdaudio->info.disc_total_tracks;
} else {
res = FALSE;
}
break;
}
case GST_FORMAT_TIME:
*value = (cdaudio->info.disc_length.minutes * 60 +
cdaudio->info.disc_length.seconds) * GST_SECOND;
break;
default:
{
if (*format == track_format) {
*value = cdaudio->info.disc_total_tracks;
} else {
res = FALSE;
}
break;
}
}
break;
case GST_QUERY_POSITION:
switch (*format) {
case GST_FORMAT_TIME:
*value = (cdaudio->info.disc_time.minutes * 60 +
cdaudio->info.disc_time.seconds) * GST_SECOND;
break;
default:
{
if (*format == track_format) {
*value = cdaudio->info.disc_current_track;
} else {
res = FALSE;
}
break;
}
case GST_FORMAT_TIME:
*value = (cdaudio->info.disc_time.minutes * 60 +
cdaudio->info.disc_time.seconds) * GST_SECOND;
break;
default:
{
if (*format == track_format) {
*value = cdaudio->info.disc_current_track;
} else {
res = FALSE;
}
break;
}
}
break;
default:

View file

@ -37,16 +37,16 @@ static GstStaticPadTemplate sink_template = GST_STATIC_PAD_TEMPLATE ("sink",
GST_PAD_SINK,
GST_PAD_ALWAYS,
GST_STATIC_CAPS ("video/x-divx, "
"divxversion = (int) [ 3, 5 ], "
"width = (int) [ 16, 4096 ], "
"height = (int) [ 16, 4096 ], " "framerate = (double) [ 0, MAX ]")
"divxversion = (int) [ 3, 5 ], "
"width = (int) [ 16, 4096 ], "
"height = (int) [ 16, 4096 ], " "framerate = (double) [ 0, MAX ]")
);
static GstStaticPadTemplate src_template = GST_STATIC_PAD_TEMPLATE ("src",
GST_PAD_SRC,
GST_PAD_ALWAYS,
GST_STATIC_CAPS (GST_VIDEO_CAPS_YUV ("{ I420, YUY2, YV12, UYVY }")
/* FIXME: 15/16/24/32bpp RGB */
/* FIXME: 15/16/24/32bpp RGB */
)
);
@ -125,8 +125,9 @@ gst_divxdec_get_type (void)
0,
(GInstanceInitFunc) gst_divxdec_init,
};
divxdec_type = g_type_register_static (GST_TYPE_ELEMENT,
"GstDivxDec", &divxdec_info, 0);
"GstDivxDec", &divxdec_info, 0);
}
return divxdec_type;
}
@ -222,7 +223,7 @@ gst_divxdec_setup (GstDivxDec * divxdec)
}
if ((ret = decore (&handle, DEC_OPT_INIT, &xinit, NULL)) != 0) {
GST_ELEMENT_ERROR (divxdec, LIBRARY, INIT, (NULL),
("divx library error: %s (%d)", gst_divxdec_error (ret), ret));
("divx library error: %s (%d)", gst_divxdec_error (ret), ret));
return FALSE;
}
@ -239,7 +240,7 @@ gst_divxdec_setup (GstDivxDec * divxdec)
if ((ret = decore (divxdec->handle, DEC_OPT_SETOUT, &output, NULL)) != 0) {
GST_ELEMENT_ERROR (divxdec, LIBRARY, SETTINGS, (NULL),
("error setting output: %s (%d)", gst_divxdec_error (ret), ret));
("error setting output: %s (%d)", gst_divxdec_error (ret), ret));
gst_divxdec_unset (divxdec);
return FALSE;
}
@ -275,7 +276,7 @@ gst_divxdec_chain (GstPad * pad, GstData * _data)
if (!divxdec->handle) {
if (gst_divxdec_negotiate (divxdec) <= 0) {
GST_ELEMENT_ERROR (divxdec, CORE, TOO_LAZY, (NULL),
("No format set - aborting"));
("No format set - aborting"));
gst_buffer_unref (buf);
return;
}
@ -296,7 +297,7 @@ gst_divxdec_chain (GstPad * pad, GstData * _data)
if ((ret = decore (divxdec->handle, DEC_OPT_FRAME, &xframe, NULL))) {
GST_ELEMENT_ERROR (divxdec, STREAM, DECODE, (NULL),
("Error decoding divx frame: %s (%d)", gst_divxdec_error (ret), ret));
("Error decoding divx frame: %s (%d)", gst_divxdec_error (ret), ret));
gst_buffer_unref (buf);
return;
}
@ -395,16 +396,22 @@ gst_divxdec_negotiate (GstDivxDec * divxdec)
gint depth, bpp;
guint32 csp;
gint bitcnt;
} fmt_list[] = {
}
fmt_list[] =
{
{
GST_MAKE_FOURCC ('Y', 'U', 'Y', '2'), 16, 16,
GST_MAKE_FOURCC ('Y', 'U', 'Y', '2'), 0}, {
GST_MAKE_FOURCC ('Y', 'U', 'Y', '2'), 0}
, {
GST_MAKE_FOURCC ('U', 'Y', 'V', 'Y'), 16, 16,
GST_MAKE_FOURCC ('U', 'Y', 'V', 'Y'), 0}, {
GST_MAKE_FOURCC ('U', 'Y', 'V', 'Y'), 0}
, {
GST_MAKE_FOURCC ('I', '4', '2', '0'), 12, 12,
GST_MAKE_FOURCC ('I', '4', '2', '0'), 0}, {
GST_MAKE_FOURCC ('I', '4', '2', '0'), 0}
, {
GST_MAKE_FOURCC ('Y', 'V', '1', '2'), 12, 12,
GST_MAKE_FOURCC ('Y', 'V', '1', '2'), 0}, {
GST_MAKE_FOURCC ('Y', 'V', '1', '2'), 0}
, {
0, 0, 0, 0, 0}
};
gint i;
@ -413,13 +420,13 @@ gst_divxdec_negotiate (GstDivxDec * divxdec)
divxdec->csp = fmt_list[i].csp;
caps = gst_caps_new_simple ("video/x-raw-yuv",
"width", G_TYPE_INT, divxdec->width,
"height", G_TYPE_INT, divxdec->height,
"framerate", G_TYPE_DOUBLE, divxdec->fps,
"format", GST_TYPE_FOURCC, fmt_list[i].fourcc, NULL);
"width", G_TYPE_INT, divxdec->width,
"height", G_TYPE_INT, divxdec->height,
"framerate", G_TYPE_DOUBLE, divxdec->fps,
"format", GST_TYPE_FOURCC, fmt_list[i].fourcc, NULL);
if (gst_divxdec_setup (divxdec) &&
gst_pad_set_explicit_caps (divxdec->srcpad, caps)) {
gst_pad_set_explicit_caps (divxdec->srcpad, caps)) {
divxdec->csp = fmt_list[i].csp;
divxdec->bpp = fmt_list[i].bpp;
divxdec->bitcnt = fmt_list[i].bitcnt;
@ -468,8 +475,8 @@ plugin_init (GstPlugin * plugin)
lib_version = decore (NULL, DEC_OPT_VERSION, 0, 0);
if (lib_version != DECORE_VERSION) {
g_warning ("Version mismatch! This plugin was compiled for "
"DivX version %d, while your library has version %d!",
DECORE_VERSION, lib_version);
"DivX version %d, while your library has version %d!",
DECORE_VERSION, lib_version);
return FALSE;
}

View file

@ -38,7 +38,7 @@ static GstStaticPadTemplate sink_template = GST_STATIC_PAD_TEMPLATE ("sink",
GST_PAD_SINK,
GST_PAD_ALWAYS,
GST_STATIC_CAPS (GST_VIDEO_CAPS_YUV ("{ I420, YUY2, YV12, YVYU, UYVY }")
/* FIXME: 15/16/24/32bpp RGB */
/* FIXME: 15/16/24/32bpp RGB */
)
);
@ -46,9 +46,9 @@ static GstStaticPadTemplate src_template = GST_STATIC_PAD_TEMPLATE ("src",
GST_PAD_SRC,
GST_PAD_ALWAYS,
GST_STATIC_CAPS ("video/x-divx, "
"divxversion = (int) 5, "
"width = (int) [ 16, 4096 ], "
"height = (int) [ 16, 4096 ], " "framerate = (double) [ 0, MAX ]")
"divxversion = (int) 5, "
"width = (int) [ 16, 4096 ], "
"height = (int) [ 16, 4096 ], " "framerate = (double) [ 0, MAX ]")
);
@ -137,8 +137,9 @@ gst_divxenc_get_type (void)
0,
(GInstanceInitFunc) gst_divxenc_init,
};
divxenc_type = g_type_register_static (GST_TYPE_ELEMENT,
"GstDivxEnc", &divxenc_info, 0);
"GstDivxEnc", &divxenc_info, 0);
}
return divxenc_type;
}
@ -171,20 +172,20 @@ gst_divxenc_class_init (GstDivxEncClass * klass)
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_BITRATE,
g_param_spec_ulong ("bitrate", "Bitrate",
"Target video bitrate", 0, G_MAXULONG, 0, G_PARAM_READWRITE));
"Target video bitrate", 0, G_MAXULONG, 0, G_PARAM_READWRITE));
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_MAXKEYINTERVAL,
g_param_spec_int ("max_key_interval", "Max. Key Interval",
"Maximum number of frames between two keyframes",
0, G_MAXINT, 0, G_PARAM_READWRITE));
"Maximum number of frames between two keyframes",
0, G_MAXINT, 0, G_PARAM_READWRITE));
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_BUFSIZE,
g_param_spec_ulong ("buffer_size", "Buffer Size",
"Size of the video buffers", 0, G_MAXULONG, 0, G_PARAM_READABLE));
"Size of the video buffers", 0, G_MAXULONG, 0, G_PARAM_READABLE));
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_QUALITY,
g_param_spec_int ("quality", "Quality",
"Amount of Motion Estimation", 1, 5, 3, G_PARAM_READWRITE));
"Amount of Motion Estimation", 1, 5, 3, G_PARAM_READWRITE));
gobject_class->set_property = gst_divxenc_set_property;
gobject_class->get_property = gst_divxenc_get_property;
@ -221,7 +222,7 @@ gst_divxenc_init (GstDivxEnc * divxenc)
/* bitrate, etc. */
divxenc->width = divxenc->height = divxenc->csp = divxenc->bitcnt = -1;
divxenc->bitrate = 512 * 1024;
divxenc->max_key_interval = -1; /* default - 2*fps */
divxenc->max_key_interval = -1; /* default - 2*fps */
divxenc->buffer_size = 512 * 1024;
divxenc->quality = 3;
@ -279,8 +280,8 @@ gst_divxenc_setup (GstDivxEnc * divxenc)
if ((ret = encore (&handle, ENC_OPT_INIT, &input, &output))) {
GST_ELEMENT_ERROR (divxenc, LIBRARY, SETTINGS, (NULL),
("Error setting up divx encoder: %s (%d)",
gst_divxenc_error (ret), ret));
("Error setting up divx encoder: %s (%d)",
gst_divxenc_error (ret), ret));
return FALSE;
}
@ -339,7 +340,7 @@ gst_divxenc_chain (GstPad * pad, GstData * _data)
if ((ret = encore (divxenc->handle, ENC_OPT_ENCODE, &xframe, &xres))) {
GST_ELEMENT_ERROR (divxenc, LIBRARY, ENCODE, (NULL),
("Error encoding divx frame: %s (%d)", gst_divxenc_error (ret), ret));
("Error encoding divx frame: %s (%d)", gst_divxenc_error (ret), ret));
gst_buffer_unref (buf);
return;
}
@ -427,9 +428,9 @@ gst_divxenc_connect (GstPad * pad, const GstCaps * caps)
GstCaps *new_caps;
new_caps = gst_caps_new_simple ("video/x-divx",
"divxversion", G_TYPE_INT, 5,
"width", G_TYPE_INT, w,
"height", G_TYPE_INT, h, "framerate", G_TYPE_DOUBLE, fps, NULL);
"divxversion", G_TYPE_INT, 5,
"width", G_TYPE_INT, w,
"height", G_TYPE_INT, h, "framerate", G_TYPE_DOUBLE, fps, NULL);
ret = gst_pad_set_explicit_caps (divxenc->srcpad, new_caps);
if (ret <= 0) {
@ -509,8 +510,8 @@ plugin_init (GstPlugin * plugin)
lib_version = encore (NULL, ENC_OPT_VERSION, 0, 0);
if (lib_version != ENCORE_VERSION) {
g_warning ("Version mismatch! This plugin was compiled for "
"DivX version %d, while your library has version %d!",
ENCORE_VERSION, lib_version);
"DivX version %d, while your library has version %d!",
ENCORE_VERSION, lib_version);
return FALSE;
}

View file

@ -27,15 +27,15 @@ static GstStaticPadTemplate src_template = GST_STATIC_PAD_TEMPLATE ("src",
GST_PAD_SRC,
GST_PAD_ALWAYS,
GST_STATIC_CAPS ("audio/mpeg, "
"mpegversion = (int) { 4, 2 }, "
"channels = (int) [ 1, 6 ], " "rate = (int) [ 8000, 96000 ]")
"mpegversion = (int) { 4, 2 }, "
"channels = (int) [ 1, 6 ], " "rate = (int) [ 8000, 96000 ]")
);
static GstStaticPadTemplate sink_template = GST_STATIC_PAD_TEMPLATE ("sink",
GST_PAD_SINK,
GST_PAD_ALWAYS,
GST_STATIC_CAPS ("audio/x-raw-int, " "endianness = (int) BYTE_ORDER, " "signed = (boolean) TRUE, " "width = (int) 16, " "depth = (int) 16, " "rate = (int) [ 8000, 96000 ], " "channels = (int) [ 1, 6]; " "audio/x-raw-int, " "endianness = (int) BYTE_ORDER, " "signed = (boolean) TRUE, " "width = (int) 32, " "depth = (int) 24, " "rate = (int) [ 8000, 96000], " "channels = (int) [ 1, 6]; " "audio/x-raw-float, " "endianness = (int) BYTE_ORDER, " "depth = (int) 32, " /* sizeof (gfloat) */
"rate = (int) [ 8000, 96000], " "channels = (int) [ 1, 6]")
GST_STATIC_CAPS ("audio/x-raw-int, " "endianness = (int) BYTE_ORDER, " "signed = (boolean) TRUE, " "width = (int) 16, " "depth = (int) 16, " "rate = (int) [ 8000, 96000 ], " "channels = (int) [ 1, 6]; " "audio/x-raw-int, " "endianness = (int) BYTE_ORDER, " "signed = (boolean) TRUE, " "width = (int) 32, " "depth = (int) 24, " "rate = (int) [ 8000, 96000], " "channels = (int) [ 1, 6]; " "audio/x-raw-float, " "endianness = (int) BYTE_ORDER, " "depth = (int) 32, " /* sizeof (gfloat) */
"rate = (int) [ 8000, 96000], " "channels = (int) [ 1, 6]")
);
enum
@ -88,7 +88,7 @@ gst_faac_get_type (void)
};
gst_faac_type = g_type_register_static (GST_TYPE_ELEMENT,
"GstFaac", &gst_faac_info, 0);
"GstFaac", &gst_faac_info, 0);
}
return gst_faac_type;
@ -129,7 +129,7 @@ gst_faac_profile_get_type (void)
};
gst_faac_profile_type = g_enum_register_static ("GstFaacProfile",
gst_faac_profile);
gst_faac_profile);
}
return gst_faac_profile_type;
@ -150,7 +150,7 @@ gst_faac_shortctl_get_type (void)
};
gst_faac_shortctl_type = g_enum_register_static ("GstFaacShortCtl",
gst_faac_shortctl);
gst_faac_shortctl);
}
return gst_faac_shortctl_type;
@ -167,20 +167,20 @@ gst_faac_class_init (GstFaacClass * klass)
/* properties */
g_object_class_install_property (gobject_class, ARG_BITRATE,
g_param_spec_int ("bitrate", "Bitrate (bps)", "Bitrate in bits/sec",
8 * 1024, 320 * 1024, 128 * 1024, G_PARAM_READWRITE));
8 * 1024, 320 * 1024, 128 * 1024, G_PARAM_READWRITE));
g_object_class_install_property (gobject_class, ARG_PROFILE,
g_param_spec_enum ("profile", "Profile", "MPEG/AAC encoding profile",
GST_TYPE_FAAC_PROFILE, MAIN, G_PARAM_READWRITE));
GST_TYPE_FAAC_PROFILE, MAIN, G_PARAM_READWRITE));
g_object_class_install_property (gobject_class, ARG_TNS,
g_param_spec_boolean ("tns", "TNS", "Use temporal noise shaping",
FALSE, G_PARAM_READWRITE));
FALSE, G_PARAM_READWRITE));
g_object_class_install_property (gobject_class, ARG_MIDSIDE,
g_param_spec_boolean ("midside", "Midside", "Allow mid/side encoding",
TRUE, G_PARAM_READWRITE));
TRUE, G_PARAM_READWRITE));
g_object_class_install_property (gobject_class, ARG_SHORTCTL,
g_param_spec_enum ("shortctl", "Block type",
"Block type encorcing",
GST_TYPE_FAAC_SHORTCTL, MAIN, G_PARAM_READWRITE));
"Block type encorcing",
GST_TYPE_FAAC_SHORTCTL, MAIN, G_PARAM_READWRITE));
/* virtual functions */
gstelement_class->change_state = gst_faac_change_state;
@ -257,11 +257,11 @@ gst_faac_sinkconnect (GstPad * pad, const GstCaps * caps)
bps = 2;
break;
case 24:
fmt = FAAC_INPUT_32BIT; /* 24-in-32, actually */
fmt = FAAC_INPUT_32BIT; /* 24-in-32, actually */
bps = 4;
break;
case 32:
fmt = FAAC_INPUT_FLOAT; /* see template, this is right */
fmt = FAAC_INPUT_FLOAT; /* see template, this is right */
bps = 4;
break;
}
@ -282,7 +282,7 @@ gst_faac_sinkconnect (GstPad * pad, const GstCaps * caps)
/* if the other side was already set-up, redo that */
if (GST_PAD_CAPS (faac->srcpad))
return gst_faac_srcconnect (faac->srcpad,
gst_pad_get_allowed_caps (faac->srcpad));
gst_pad_get_allowed_caps (faac->srcpad));
/* else, that'll be done later */
return GST_PAD_LINK_OK;
@ -335,7 +335,7 @@ gst_faac_srcconnect (GstPad * pad, const GstCaps * caps)
* that (that the next element is filesink or any element
* that does want ADTS headers). */
conf->outputFormat = 0; /* raw, no ADTS headers */
conf->outputFormat = 0; /* raw, no ADTS headers */
conf->shortctl = faac->shortctl;
if (!faacEncSetConfiguration (faac->handle, conf)) {
GST_WARNING ("Faac doesn't support the current conf");
@ -343,19 +343,19 @@ gst_faac_srcconnect (GstPad * pad, const GstCaps * caps)
}
newcaps = gst_caps_new_simple ("audio/mpeg",
"mpegversion", G_TYPE_INT, mpegversion,
"channels", G_TYPE_INT, faac->channels,
"rate", G_TYPE_INT, faac->samplerate, NULL);
"mpegversion", G_TYPE_INT, mpegversion,
"channels", G_TYPE_INT, faac->channels,
"rate", G_TYPE_INT, faac->samplerate, NULL);
ret = gst_pad_try_set_caps (faac->srcpad, newcaps);
switch (ret) {
case GST_PAD_LINK_OK:
case GST_PAD_LINK_DONE:
return GST_PAD_LINK_DONE;
return GST_PAD_LINK_DONE;
case GST_PAD_LINK_DELAYED:
return GST_PAD_LINK_DELAYED;
return GST_PAD_LINK_DELAYED;
default:
break;
break;
}
}
@ -374,33 +374,33 @@ gst_faac_chain (GstPad * pad, GstData * data)
switch (GST_EVENT_TYPE (event)) {
case GST_EVENT_EOS:
/* flush first */
while (1) {
outbuf = gst_buffer_new_and_alloc (faac->bytes);
if ((ret_size = faacEncEncode (faac->handle,
NULL, 0, GST_BUFFER_DATA (outbuf), faac->bytes)) < 0) {
GST_ELEMENT_ERROR (faac, LIBRARY, ENCODE, (NULL), (NULL));
gst_event_unref (event);
gst_buffer_unref (outbuf);
return;
}
/* flush first */
while (1) {
outbuf = gst_buffer_new_and_alloc (faac->bytes);
if ((ret_size = faacEncEncode (faac->handle,
NULL, 0, GST_BUFFER_DATA (outbuf), faac->bytes)) < 0) {
GST_ELEMENT_ERROR (faac, LIBRARY, ENCODE, (NULL), (NULL));
gst_event_unref (event);
gst_buffer_unref (outbuf);
return;
}
if (ret_size > 0) {
GST_BUFFER_SIZE (outbuf) = ret_size;
GST_BUFFER_TIMESTAMP (outbuf) = 0;
GST_BUFFER_DURATION (outbuf) = 0;
gst_pad_push (faac->srcpad, GST_DATA (outbuf));
} else {
break;
}
}
if (ret_size > 0) {
GST_BUFFER_SIZE (outbuf) = ret_size;
GST_BUFFER_TIMESTAMP (outbuf) = 0;
GST_BUFFER_DURATION (outbuf) = 0;
gst_pad_push (faac->srcpad, GST_DATA (outbuf));
} else {
break;
}
}
gst_element_set_eos (GST_ELEMENT (faac));
gst_pad_push (faac->srcpad, data);
return;
gst_element_set_eos (GST_ELEMENT (faac));
gst_pad_push (faac->srcpad, data);
return;
default:
gst_pad_event_default (pad, event);
return;
gst_pad_event_default (pad, event);
return;
}
}
@ -408,16 +408,16 @@ gst_faac_chain (GstPad * pad, GstData * data)
if (!faac->handle) {
GST_ELEMENT_ERROR (faac, CORE, NEGOTIATION, (NULL),
("format wasn't negotiated before chain function"));
("format wasn't negotiated before chain function"));
gst_buffer_unref (inbuf);
return;
}
if (!GST_PAD_CAPS (faac->srcpad)) {
if (gst_faac_srcconnect (faac->srcpad,
gst_pad_get_allowed_caps (faac->srcpad)) <= 0) {
gst_pad_get_allowed_caps (faac->srcpad)) <= 0) {
GST_ELEMENT_ERROR (faac, CORE, NEGOTIATION, (NULL),
("failed to negotiate MPEG/AAC format with next element"));
("failed to negotiate MPEG/AAC format with next element"));
gst_buffer_unref (inbuf);
return;
}
@ -433,27 +433,27 @@ gst_faac_chain (GstPad * pad, GstData * data)
/* do we have enough data for one frame? */
if (in_size / faac->bps < faac->samples) {
if (in_size > size) {
GstBuffer *merge;
GstBuffer *merge;
/* this is panic! we got a buffer, but still don't have enough
* data. Merge them and retry in the next cycle... */
merge = gst_buffer_merge (faac->cache, inbuf);
gst_buffer_unref (faac->cache);
gst_buffer_unref (inbuf);
faac->cache = merge;
/* this is panic! we got a buffer, but still don't have enough
* data. Merge them and retry in the next cycle... */
merge = gst_buffer_merge (faac->cache, inbuf);
gst_buffer_unref (faac->cache);
gst_buffer_unref (inbuf);
faac->cache = merge;
} else if (in_size == size) {
/* this shouldn't happen, but still... */
faac->cache = inbuf;
/* this shouldn't happen, but still... */
faac->cache = inbuf;
} else if (in_size > 0) {
faac->cache = gst_buffer_create_sub (inbuf, size - in_size, in_size);
GST_BUFFER_DURATION (faac->cache) =
GST_BUFFER_DURATION (inbuf) * GST_BUFFER_SIZE (faac->cache) / size;
GST_BUFFER_TIMESTAMP (faac->cache) =
GST_BUFFER_TIMESTAMP (inbuf) + (GST_BUFFER_DURATION (inbuf) *
(size - in_size) / size);
gst_buffer_unref (inbuf);
faac->cache = gst_buffer_create_sub (inbuf, size - in_size, in_size);
GST_BUFFER_DURATION (faac->cache) =
GST_BUFFER_DURATION (inbuf) * GST_BUFFER_SIZE (faac->cache) / size;
GST_BUFFER_TIMESTAMP (faac->cache) =
GST_BUFFER_TIMESTAMP (inbuf) + (GST_BUFFER_DURATION (inbuf) *
(size - in_size) / size);
gst_buffer_unref (inbuf);
} else {
gst_buffer_unref (inbuf);
gst_buffer_unref (inbuf);
}
return;
@ -466,7 +466,7 @@ gst_faac_chain (GstPad * pad, GstData * data)
/* merge */
subbuf = gst_buffer_create_sub (inbuf, 0, frame_size - (in_size - size));
GST_BUFFER_DURATION (subbuf) =
GST_BUFFER_DURATION (inbuf) * GST_BUFFER_SIZE (subbuf) / size;
GST_BUFFER_DURATION (inbuf) * GST_BUFFER_SIZE (subbuf) / size;
merge = gst_buffer_merge (faac->cache, subbuf);
gst_buffer_unref (faac->cache);
gst_buffer_unref (subbuf);
@ -475,17 +475,17 @@ gst_faac_chain (GstPad * pad, GstData * data)
} else {
subbuf = gst_buffer_create_sub (inbuf, size - in_size, frame_size);
GST_BUFFER_DURATION (subbuf) =
GST_BUFFER_DURATION (inbuf) * GST_BUFFER_SIZE (subbuf) / size;
GST_BUFFER_DURATION (inbuf) * GST_BUFFER_SIZE (subbuf) / size;
GST_BUFFER_TIMESTAMP (subbuf) =
GST_BUFFER_TIMESTAMP (inbuf) + (GST_BUFFER_DURATION (inbuf) *
(size - in_size) / size);
GST_BUFFER_TIMESTAMP (inbuf) + (GST_BUFFER_DURATION (inbuf) *
(size - in_size) / size);
}
outbuf = gst_buffer_new_and_alloc (faac->bytes);
if ((ret_size = faacEncEncode (faac->handle,
(gint32 *) GST_BUFFER_DATA (subbuf),
GST_BUFFER_SIZE (subbuf) / faac->bps,
GST_BUFFER_DATA (outbuf), faac->bytes)) < 0) {
(gint32 *) GST_BUFFER_DATA (subbuf),
GST_BUFFER_SIZE (subbuf) / faac->bps,
GST_BUFFER_DATA (outbuf), faac->bytes)) < 0) {
GST_ELEMENT_ERROR (faac, LIBRARY, ENCODE, (NULL), (NULL));
gst_buffer_unref (inbuf);
gst_buffer_unref (subbuf);
@ -495,14 +495,14 @@ gst_faac_chain (GstPad * pad, GstData * data)
if (ret_size > 0) {
GST_BUFFER_SIZE (outbuf) = ret_size;
if (faac->cache_time != GST_CLOCK_TIME_NONE) {
GST_BUFFER_TIMESTAMP (outbuf) = faac->cache_time;
faac->cache_time = GST_CLOCK_TIME_NONE;
GST_BUFFER_TIMESTAMP (outbuf) = faac->cache_time;
faac->cache_time = GST_CLOCK_TIME_NONE;
} else
GST_BUFFER_TIMESTAMP (outbuf) = GST_BUFFER_TIMESTAMP (subbuf);
GST_BUFFER_TIMESTAMP (outbuf) = GST_BUFFER_TIMESTAMP (subbuf);
GST_BUFFER_DURATION (outbuf) = GST_BUFFER_DURATION (subbuf);
if (faac->cache_duration) {
GST_BUFFER_DURATION (outbuf) += faac->cache_duration;
faac->cache_duration = 0;
GST_BUFFER_DURATION (outbuf) += faac->cache_duration;
faac->cache_duration = 0;
}
gst_pad_push (faac->srcpad, GST_DATA (outbuf));
} else {
@ -516,7 +516,7 @@ gst_faac_chain (GstPad * pad, GstData * data)
gst_buffer_unref (outbuf);
if (faac->cache_time != GST_CLOCK_TIME_NONE)
faac->cache_time = GST_BUFFER_TIMESTAMP (subbuf);
faac->cache_time = GST_BUFFER_TIMESTAMP (subbuf);
faac->cache_duration += GST_BUFFER_DURATION (subbuf);
}
@ -589,12 +589,12 @@ gst_faac_change_state (GstElement * element)
switch (GST_STATE_TRANSITION (element)) {
case GST_STATE_PAUSED_TO_READY:
if (faac->handle) {
faacEncClose (faac->handle);
faac->handle = NULL;
faacEncClose (faac->handle);
faac->handle = NULL;
}
if (faac->cache) {
gst_buffer_unref (faac->cache);
faac->cache = NULL;
gst_buffer_unref (faac->cache);
faac->cache = NULL;
}
faac->cache_time = GST_CLOCK_TIME_NONE;
faac->cache_duration = 0;

View file

@ -29,23 +29,23 @@ GstStaticPadTemplate sink_template = GST_STATIC_PAD_TEMPLATE ("sink",
GST_PAD_SINK,
GST_PAD_ALWAYS,
GST_STATIC_CAPS ("audio/mpeg, "
"systemstream = (bool) FALSE, " "mpegversion = { (int) 2, (int) 4 }")
"systemstream = (bool) FALSE, " "mpegversion = { (int) 2, (int) 4 }")
);
GstStaticPadTemplate src_template = GST_STATIC_PAD_TEMPLATE ("src",
GST_PAD_SRC,
GST_PAD_ALWAYS,
GST_STATIC_CAPS ("audio/x-raw-int, "
"endianness = (int) BYTE_ORDER, "
"signed = (bool) TRUE, "
"width = (int) { 16, 24, 32 }, "
"depth = (int) { 16, 24, 32 }, "
"rate = (int) [ 8000, 96000 ], "
"channels = (int) [ 1, 6 ]; "
"audio/x-raw-float, "
"endianness = (int) BYTE_ORDER, "
"depth = (int) { 32, 64 }, "
"rate = (int) [ 8000, 96000 ], " "channels = (int) [ 1, 6 ]")
"endianness = (int) BYTE_ORDER, "
"signed = (bool) TRUE, "
"width = (int) { 16, 24, 32 }, "
"depth = (int) { 16, 24, 32 }, "
"rate = (int) [ 8000, 96000 ], "
"channels = (int) [ 1, 6 ]; "
"audio/x-raw-float, "
"endianness = (int) BYTE_ORDER, "
"depth = (int) { 32, 64 }, "
"rate = (int) [ 8000, 96000 ], " "channels = (int) [ 1, 6 ]")
);
static void gst_faad_base_init (GstFaadClass * klass);
@ -83,7 +83,7 @@ gst_faad_get_type (void)
};
gst_faad_type = g_type_register_static (GST_TYPE_ELEMENT,
"GstFaad", &gst_faad_info, 0);
"GstFaad", &gst_faad_info, 0);
}
return gst_faad_type;
@ -171,46 +171,46 @@ gst_faad_srcgetcaps (GstPad * pad)
for (n = 0; fmt[n] != -1; n++) {
switch (n) {
case FAAD_FMT_16BIT:
str = gst_structure_new ("audio/x-raw-int",
"signed", G_TYPE_BOOLEAN, TRUE,
"width", G_TYPE_INT, 16, "depth", G_TYPE_INT, 16, NULL);
break;
case FAAD_FMT_24BIT:
str = gst_structure_new ("audio/x-raw-int",
"signed", G_TYPE_BOOLEAN, TRUE,
"width", G_TYPE_INT, 24, "depth", G_TYPE_INT, 24, NULL);
break;
case FAAD_FMT_32BIT:
str = gst_structure_new ("audio/x-raw-int",
"signed", G_TYPE_BOOLEAN, TRUE,
"width", G_TYPE_INT, 32, "depth", G_TYPE_INT, 32, NULL);
break;
case FAAD_FMT_FLOAT:
str = gst_structure_new ("audio/x-raw-float",
"depth", G_TYPE_INT, 32, NULL);
break;
case FAAD_FMT_DOUBLE:
str = gst_structure_new ("audio/x-raw-float",
"depth", G_TYPE_INT, 64, NULL);
break;
default:
str = NULL;
break;
case FAAD_FMT_16BIT:
str = gst_structure_new ("audio/x-raw-int",
"signed", G_TYPE_BOOLEAN, TRUE,
"width", G_TYPE_INT, 16, "depth", G_TYPE_INT, 16, NULL);
break;
case FAAD_FMT_24BIT:
str = gst_structure_new ("audio/x-raw-int",
"signed", G_TYPE_BOOLEAN, TRUE,
"width", G_TYPE_INT, 24, "depth", G_TYPE_INT, 24, NULL);
break;
case FAAD_FMT_32BIT:
str = gst_structure_new ("audio/x-raw-int",
"signed", G_TYPE_BOOLEAN, TRUE,
"width", G_TYPE_INT, 32, "depth", G_TYPE_INT, 32, NULL);
break;
case FAAD_FMT_FLOAT:
str = gst_structure_new ("audio/x-raw-float",
"depth", G_TYPE_INT, 32, NULL);
break;
case FAAD_FMT_DOUBLE:
str = gst_structure_new ("audio/x-raw-float",
"depth", G_TYPE_INT, 64, NULL);
break;
default:
str = NULL;
break;
}
if (!str)
continue;
continue;
if (faad->samplerate != -1) {
gst_structure_set (str, "rate", G_TYPE_INT, faad->samplerate, NULL);
gst_structure_set (str, "rate", G_TYPE_INT, faad->samplerate, NULL);
} else {
gst_structure_set (str, "rate", GST_TYPE_INT_RANGE, 8000, 96000, NULL);
gst_structure_set (str, "rate", GST_TYPE_INT_RANGE, 8000, 96000, NULL);
}
if (faad->channels != -1) {
gst_structure_set (str, "channels", G_TYPE_INT, faad->channels, NULL);
gst_structure_set (str, "channels", G_TYPE_INT, faad->channels, NULL);
} else {
gst_structure_set (str, "channels", GST_TYPE_INT_RANGE, 1, 6, NULL);
gst_structure_set (str, "channels", GST_TYPE_INT_RANGE, 1, 6, NULL);
}
gst_structure_set (str, "endianness", G_TYPE_INT, G_BYTE_ORDER, NULL);
@ -252,21 +252,21 @@ gst_faad_srcconnect (GstPad * pad, const GstCaps * caps)
gint width;
if (!gst_structure_get_int (structure, "depth", &depth) ||
!gst_structure_get_int (structure, "width", &width))
!gst_structure_get_int (structure, "width", &width))
return GST_PAD_LINK_REFUSED;
if (depth != width)
return GST_PAD_LINK_REFUSED;
switch (depth) {
case 16:
fmt = FAAD_FMT_16BIT;
break;
fmt = FAAD_FMT_16BIT;
break;
case 24:
fmt = FAAD_FMT_24BIT;
break;
fmt = FAAD_FMT_24BIT;
break;
case 32:
fmt = FAAD_FMT_32BIT;
break;
fmt = FAAD_FMT_32BIT;
break;
}
} else {
if (!gst_structure_get_int (structure, "depth", &depth))
@ -274,11 +274,11 @@ gst_faad_srcconnect (GstPad * pad, const GstCaps * caps)
switch (depth) {
case 32:
fmt = FAAD_FMT_FLOAT;
break;
fmt = FAAD_FMT_FLOAT;
break;
case 64:
fmt = FAAD_FMT_DOUBLE;
break;
fmt = FAAD_FMT_DOUBLE;
break;
}
}
@ -310,12 +310,12 @@ gst_faad_chain (GstPad * pad, GstData * data)
switch (GST_EVENT_TYPE (event)) {
case GST_EVENT_EOS:
gst_element_set_eos (GST_ELEMENT (faad));
gst_pad_push (faad->srcpad, data);
return;
gst_element_set_eos (GST_ELEMENT (faad));
gst_pad_push (faad->srcpad, data);
return;
default:
gst_pad_event_default (pad, event);
return;
gst_pad_event_default (pad, event);
return;
}
}
@ -327,7 +327,7 @@ gst_faad_chain (GstPad * pad, GstData * data)
guchar channels;
faacDecInit (faad->handle,
GST_BUFFER_DATA (buf), GST_BUFFER_SIZE (buf), &samplerate, &channels);
GST_BUFFER_DATA (buf), GST_BUFFER_SIZE (buf), &samplerate, &channels);
faad->samplerate = samplerate;
faad->channels = channels;
ret = gst_pad_renegotiate (faad->srcpad);
@ -342,7 +342,7 @@ gst_faad_chain (GstPad * pad, GstData * data)
GST_BUFFER_DATA (buf), GST_BUFFER_SIZE (buf));
if (info.error) {
GST_ELEMENT_ERROR (faad, STREAM, DECODE, (NULL),
("Failed to decode buffer: %s", faacDecGetErrorMessage (info.error)));
("Failed to decode buffer: %s", faacDecGetErrorMessage (info.error)));
gst_buffer_unref (buf);
return;
}
@ -384,13 +384,13 @@ gst_faad_change_state (GstElement * element)
switch (GST_STATE_TRANSITION (element)) {
case GST_STATE_NULL_TO_READY:
if (!(faad->handle = faacDecOpen ()))
return GST_STATE_FAILURE;
return GST_STATE_FAILURE;
else {
faacDecConfiguration *conf;
faacDecConfiguration *conf;
conf = faacDecGetCurrentConfiguration (faad->handle);
conf->defObjectType = LC;
faacDecSetConfiguration (faad->handle, conf);
conf = faacDecGetCurrentConfiguration (faad->handle);
conf->defObjectType = LC;
faacDecSetConfiguration (faad->handle, conf);
}
break;
case GST_STATE_PAUSED_TO_READY:

View file

@ -30,7 +30,7 @@ plugin_init (GstPlugin * plugin)
if (!gst_element_register (plugin, "gsmenc", GST_RANK_NONE, GST_TYPE_GSMENC))
return FALSE;
if (!gst_element_register (plugin, "gsmdec", GST_RANK_PRIMARY,
GST_TYPE_GSMDEC))
GST_TYPE_GSMDEC))
return FALSE;
return TRUE;

View file

@ -75,8 +75,9 @@ gst_gsmdec_get_type (void)
0,
(GInstanceInitFunc) gst_gsmdec_init,
};
gsmdec_type =
g_type_register_static (GST_TYPE_ELEMENT, "GstGSMDec", &gsmdec_info, 0);
g_type_register_static (GST_TYPE_ELEMENT, "GstGSMDec", &gsmdec_info, 0);
}
return gsmdec_type;
}
@ -86,7 +87,7 @@ GST_STATIC_PAD_TEMPLATE ("sink",
GST_PAD_SINK,
GST_PAD_ALWAYS,
GST_STATIC_CAPS ("audio/x-gsm, "
"rate = (int) [ 1000, 48000 ], " "channels = (int) 1")
"rate = (int) [ 1000, 48000 ], " "channels = (int) 1")
);
static GstStaticPadTemplate gsmdec_src_template =
@ -94,11 +95,11 @@ GST_STATIC_PAD_TEMPLATE ("src",
GST_PAD_SRC,
GST_PAD_ALWAYS,
GST_STATIC_CAPS ("audio/x-raw-int, "
"endianness = (int) BYTE_ORDER, "
"signed = (boolean) true, "
"width = (int) 16, "
"depth = (int) 16, "
"rate = (int) [ 1000, 48000 ], " "channels = (int) 1")
"endianness = (int) BYTE_ORDER, "
"signed = (boolean) true, "
"width = (int) 16, "
"depth = (int) 16, "
"rate = (int) [ 1000, 48000 ], " "channels = (int) 1")
);
static void
@ -158,12 +159,12 @@ gst_gsmdec_sinkconnect (GstPad * pad, const GstCaps * caps)
gst_structure_get_int (structure, "rate", &rate);
if (gst_pad_try_set_caps (gsmdec->srcpad,
gst_caps_new_simple ("audio/x-raw-int",
"endianness", G_TYPE_INT, G_BYTE_ORDER,
"signed", G_TYPE_BOOLEAN, TRUE,
"width", G_TYPE_INT, 16,
"depth", G_TYPE_INT, 16,
"rate", G_TYPE_INT, rate, "channels", G_TYPE_INT, 1, NULL)) > 0) {
gst_caps_new_simple ("audio/x-raw-int",
"endianness", G_TYPE_INT, G_BYTE_ORDER,
"signed", G_TYPE_BOOLEAN, TRUE,
"width", G_TYPE_INT, 16,
"depth", G_TYPE_INT, 16,
"rate", G_TYPE_INT, rate, "channels", G_TYPE_INT, 1, NULL)) > 0) {
return GST_PAD_LINK_OK;
}
return GST_PAD_LINK_REFUSED;
@ -191,14 +192,14 @@ gst_gsmdec_chain (GstPad * pad, GstData * _data)
GstBuffer *outbuf;
memcpy (gsmdec->buffer + gsmdec->bufsize, data,
(33 - gsmdec->bufsize) * sizeof (gsm_byte));
(33 - gsmdec->bufsize) * sizeof (gsm_byte));
outbuf = gst_buffer_new ();
GST_BUFFER_DATA (outbuf) = g_malloc (160 * sizeof (gsm_signal));
GST_BUFFER_SIZE (outbuf) = 160 * sizeof (gsm_signal);
gsm_decode (gsmdec->state, gsmdec->buffer,
(gsm_signal *) GST_BUFFER_DATA (outbuf));
(gsm_signal *) GST_BUFFER_DATA (outbuf));
gst_pad_push (gsmdec->srcpad, GST_DATA (outbuf));

View file

@ -75,8 +75,9 @@ gst_gsmenc_get_type (void)
0,
(GInstanceInitFunc) gst_gsmenc_init,
};
gsmenc_type =
g_type_register_static (GST_TYPE_ELEMENT, "GstGSMEnc", &gsmenc_info, 0);
g_type_register_static (GST_TYPE_ELEMENT, "GstGSMEnc", &gsmenc_info, 0);
}
return gsmenc_type;
}
@ -86,7 +87,7 @@ GST_STATIC_PAD_TEMPLATE ("src",
GST_PAD_SRC,
GST_PAD_ALWAYS,
GST_STATIC_CAPS ("audio/x-gsm, "
"rate = (int) [ 1000, 48000 ], " "channels = (int) 1")
"rate = (int) [ 1000, 48000 ], " "channels = (int) 1")
);
static GstStaticPadTemplate gsmenc_sink_template =
@ -94,11 +95,11 @@ GST_STATIC_PAD_TEMPLATE ("sink",
GST_PAD_SINK,
GST_PAD_ALWAYS,
GST_STATIC_CAPS ("audio/x-raw-int, "
"endianness = (int) BYTE_ORDER, "
"signed = (boolean) true, "
"width = (int) 16, "
"depth = (int) 16, "
"rate = (int) [ 1000, 48000 ], " "channels = (int) 1")
"endianness = (int) BYTE_ORDER, "
"signed = (boolean) true, "
"width = (int) 16, "
"depth = (int) 16, "
"rate = (int) [ 1000, 48000 ], " "channels = (int) 1")
);
static void
@ -164,9 +165,9 @@ gst_gsmenc_sinkconnect (GstPad * pad, const GstCaps * caps)
structure = gst_caps_get_structure (caps, 0);
gst_structure_get_int (structure, "rate", &gsmenc->rate);
if (gst_pad_try_set_caps (gsmenc->srcpad,
gst_caps_new_simple ("audio/x-gsm",
"rate", G_TYPE_INT, gsmenc->rate,
"channels", G_TYPE_INT, 1, NULL)) > 0) {
gst_caps_new_simple ("audio/x-gsm",
"rate", G_TYPE_INT, gsmenc->rate,
"channels", G_TYPE_INT, 1, NULL)) > 0) {
return GST_PAD_LINK_OK;
}
return GST_PAD_LINK_REFUSED;
@ -194,14 +195,14 @@ gst_gsmenc_chain (GstPad * pad, GstData * _data)
GstBuffer *outbuf;
memcpy (gsmenc->buffer + gsmenc->bufsize, data,
(160 - gsmenc->bufsize) * sizeof (gsm_signal));
(160 - gsmenc->bufsize) * sizeof (gsm_signal));
outbuf = gst_buffer_new ();
GST_BUFFER_DATA (outbuf) = g_malloc (33 * sizeof (gsm_byte));
GST_BUFFER_SIZE (outbuf) = 33 * sizeof (gsm_byte);
gsm_encode (gsmenc->state, gsmenc->buffer,
(gsm_byte *) GST_BUFFER_DATA (outbuf));
(gsm_byte *) GST_BUFFER_DATA (outbuf));
GST_BUFFER_TIMESTAMP (outbuf) = gsmenc->next_ts;
gst_pad_push (gsmenc->srcpad, GST_DATA (outbuf));

View file

@ -48,7 +48,8 @@ typedef enum
GST_HERMES_COLORSPACE_RGB32_I420,
GST_HERMES_COLORSPACE_RGB32_YV12,
GST_HERMES_COLORSPACE_420_SWAP,
} GstColorSpaceConverterType;
}
GstColorSpaceConverterType;
struct _GstHermesColorspace
{
@ -85,7 +86,8 @@ typedef struct _GstHermesColorspaceFormat
{
GstStaticCaps caps;
} GstHermesColorspaceFormat;
}
GstHermesColorspaceFormat;
static GstHermesColorspaceFormat gst_hermes_colorspace_formats[] = {
{GST_STATIC_CAPS (GST_VIDEO_CAPS_xRGB)},
@ -174,125 +176,125 @@ colorspace_setup_converter (GstHermesColorspace * space, GstCaps * from_caps,
gst_structure_get_int (from_struct, "bpp", &from_bpp);
switch (to_space) {
case GST_MAKE_FOURCC ('R', 'G', 'B', ' '):
case GST_MAKE_FOURCC ('R', 'G', 'B', ' '):
#ifdef HAVE_HERMES
{
gint to_bpp;
{
gint to_bpp;
gst_structure_get_int (to_struct, "bpp", &to_bpp);
gst_structure_get_int (to_struct, "bpp", &to_bpp);
gst_structure_get_int (from_struct, "red_mask", &space->source.r);
gst_structure_get_int (from_struct, "green_mask", &space->source.g);
gst_structure_get_int (from_struct, "blue_mask", &space->source.b);
space->source.a = 0;
space->srcbpp = space->source.bits = from_bpp;
space->source.indexed = 0;
space->source.has_colorkey = 0;
gst_structure_get_int (from_struct, "red_mask", &space->source.r);
gst_structure_get_int (from_struct, "green_mask", &space->source.g);
gst_structure_get_int (from_struct, "blue_mask", &space->source.b);
space->source.a = 0;
space->srcbpp = space->source.bits = from_bpp;
space->source.indexed = 0;
space->source.has_colorkey = 0;
GST_INFO ("source red mask %08x", space->source.r);
GST_INFO ("source green mask %08x", space->source.g);
GST_INFO ("source blue mask %08x", space->source.b);
GST_INFO ("source bpp %08x", space->srcbpp);
GST_INFO ("source red mask %08x", space->source.r);
GST_INFO ("source green mask %08x", space->source.g);
GST_INFO ("source blue mask %08x", space->source.b);
GST_INFO ("source bpp %08x", space->srcbpp);
gst_structure_get_int (to_struct, "red_mask", &space->dest.r);
gst_structure_get_int (to_struct, "green_mask", &space->dest.g);
gst_structure_get_int (to_struct, "blue_mask", &space->dest.b);
space->dest.a = 0;
space->destbpp = space->dest.bits = to_bpp;
space->dest.indexed = 0;
space->dest.has_colorkey = 0;
gst_structure_get_int (to_struct, "red_mask", &space->dest.r);
gst_structure_get_int (to_struct, "green_mask", &space->dest.g);
gst_structure_get_int (to_struct, "blue_mask", &space->dest.b);
space->dest.a = 0;
space->destbpp = space->dest.bits = to_bpp;
space->dest.indexed = 0;
space->dest.has_colorkey = 0;
GST_INFO ("dest red mask %08x", space->dest.r);
GST_INFO ("dest green mask %08x", space->dest.g);
GST_INFO ("dest blue mask %08x", space->dest.b);
GST_INFO ("dest bpp %08x", space->destbpp);
GST_INFO ("dest red mask %08x", space->dest.r);
GST_INFO ("dest green mask %08x", space->dest.g);
GST_INFO ("dest blue mask %08x", space->dest.b);
GST_INFO ("dest bpp %08x", space->destbpp);
if (!Hermes_ConverterRequest (space->h_handle, &space->source,
&space->dest)) {
g_warning ("Hermes: could not get converter\n");
return FALSE;
}
GST_INFO ("converter set up");
space->type = GST_HERMES_COLORSPACE_HERMES;
return TRUE;
}
if (!Hermes_ConverterRequest (space->h_handle, &space->source,
&space->dest)) {
g_warning ("Hermes: could not get converter\n");
return FALSE;
}
GST_INFO ("converter set up");
space->type = GST_HERMES_COLORSPACE_HERMES;
return TRUE;
}
#else
g_warning ("colorspace: compiled without hermes!");
return FALSE;
g_warning ("colorspace: compiled without hermes!");
return FALSE;
#endif
case GST_MAKE_FOURCC ('Y', 'V', '1', '2'):
if (from_bpp == 32) {
space->type = GST_HERMES_COLORSPACE_RGB32_YV12;
space->destbpp = 12;
return TRUE;
}
case GST_MAKE_FOURCC ('I', '4', '2', '0'):
if (from_bpp == 32) {
space->type = GST_HERMES_COLORSPACE_RGB32_I420;
space->destbpp = 12;
return TRUE;
}
case GST_MAKE_FOURCC ('Y', 'U', 'Y', '2'):
GST_INFO ("colorspace: RGB to YUV with bpp %d not implemented!!",
from_bpp);
return FALSE;
case GST_MAKE_FOURCC ('Y', 'V', '1', '2'):
if (from_bpp == 32) {
space->type = GST_HERMES_COLORSPACE_RGB32_YV12;
space->destbpp = 12;
return TRUE;
}
case GST_MAKE_FOURCC ('I', '4', '2', '0'):
if (from_bpp == 32) {
space->type = GST_HERMES_COLORSPACE_RGB32_I420;
space->destbpp = 12;
return TRUE;
}
case GST_MAKE_FOURCC ('Y', 'U', 'Y', '2'):
GST_INFO ("colorspace: RGB to YUV with bpp %d not implemented!!",
from_bpp);
return FALSE;
}
break;
}
case GST_MAKE_FOURCC ('I', '4', '2', '0'):
switch (to_space) {
case GST_MAKE_FOURCC ('R', 'G', 'B', ' '):
GST_INFO ("colorspace: YUV to RGB");
case GST_MAKE_FOURCC ('R', 'G', 'B', ' '):
GST_INFO ("colorspace: YUV to RGB");
gst_structure_get_int (to_struct, "bpp", &space->destbpp);
space->converter =
gst_hermes_colorspace_yuv2rgb_get_converter (from_caps, to_caps);
space->type = GST_HERMES_COLORSPACE_YUV_RGB;
return TRUE;
case GST_MAKE_FOURCC ('I', '4', '2', '0'):
space->type = GST_HERMES_COLORSPACE_NONE;
space->destbpp = 12;
return TRUE;
case GST_MAKE_FOURCC ('Y', 'V', '1', '2'):
space->type = GST_HERMES_COLORSPACE_420_SWAP;
space->destbpp = 12;
return TRUE;
gst_structure_get_int (to_struct, "bpp", &space->destbpp);
space->converter =
gst_hermes_colorspace_yuv2rgb_get_converter (from_caps, to_caps);
space->type = GST_HERMES_COLORSPACE_YUV_RGB;
return TRUE;
case GST_MAKE_FOURCC ('I', '4', '2', '0'):
space->type = GST_HERMES_COLORSPACE_NONE;
space->destbpp = 12;
return TRUE;
case GST_MAKE_FOURCC ('Y', 'V', '1', '2'):
space->type = GST_HERMES_COLORSPACE_420_SWAP;
space->destbpp = 12;
return TRUE;
}
break;
case GST_MAKE_FOURCC ('Y', 'U', 'Y', '2'):
switch (to_space) {
case GST_MAKE_FOURCC ('I', '4', '2', '0'):
space->type = GST_HERMES_COLORSPACE_YUY2_I420;
space->destbpp = 12;
return TRUE;
case GST_MAKE_FOURCC ('Y', 'U', 'Y', '2'):
space->type = GST_HERMES_COLORSPACE_NONE;
space->destbpp = 16;
return TRUE;
case GST_MAKE_FOURCC ('R', 'G', 'B', ' '):
GST_INFO ("colorspace: YUY2 to RGB not implemented!!");
return FALSE;
case GST_MAKE_FOURCC ('I', '4', '2', '0'):
space->type = GST_HERMES_COLORSPACE_YUY2_I420;
space->destbpp = 12;
return TRUE;
case GST_MAKE_FOURCC ('Y', 'U', 'Y', '2'):
space->type = GST_HERMES_COLORSPACE_NONE;
space->destbpp = 16;
return TRUE;
case GST_MAKE_FOURCC ('R', 'G', 'B', ' '):
GST_INFO ("colorspace: YUY2 to RGB not implemented!!");
return FALSE;
}
break;
case GST_MAKE_FOURCC ('Y', 'V', '1', '2'):
switch (to_space) {
case GST_MAKE_FOURCC ('R', 'G', 'B', ' '):
GST_INFO ("colorspace: YV12 to RGB");
case GST_MAKE_FOURCC ('R', 'G', 'B', ' '):
GST_INFO ("colorspace: YV12 to RGB");
gst_structure_get_int (to_struct, "bpp", &space->destbpp);
space->converter =
gst_hermes_colorspace_yuv2rgb_get_converter (from_caps, to_caps);
space->type = GST_HERMES_COLORSPACE_YUV_RGB;
return TRUE;
case GST_MAKE_FOURCC ('I', '4', '2', '0'):
space->type = GST_HERMES_COLORSPACE_420_SWAP;
space->destbpp = 12;
return TRUE;
case GST_MAKE_FOURCC ('Y', 'V', '1', '2'):
space->type = GST_HERMES_COLORSPACE_NONE;
space->destbpp = 12;
return TRUE;
gst_structure_get_int (to_struct, "bpp", &space->destbpp);
space->converter =
gst_hermes_colorspace_yuv2rgb_get_converter (from_caps, to_caps);
space->type = GST_HERMES_COLORSPACE_YUV_RGB;
return TRUE;
case GST_MAKE_FOURCC ('I', '4', '2', '0'):
space->type = GST_HERMES_COLORSPACE_420_SWAP;
space->destbpp = 12;
return TRUE;
case GST_MAKE_FOURCC ('Y', 'V', '1', '2'):
space->type = GST_HERMES_COLORSPACE_NONE;
space->destbpp = 12;
return TRUE;
}
break;
}
@ -387,8 +389,8 @@ gst_hermes_colorspace_link (GstPad * pad, const GstCaps * caps)
GstCaps *fcaps;
fcaps =
gst_caps_copy (gst_static_caps_get (&gst_hermes_colorspace_formats[i].
caps));
gst_caps_copy (gst_static_caps_get (&gst_hermes_colorspace_formats[i].
caps));
icaps = gst_caps_intersect (caps, fcaps);
if (!gst_caps_is_empty (icaps)) {
@ -413,8 +415,8 @@ gst_hermes_colorspace_link (GstPad * pad, const GstCaps * caps)
othercaps = gst_caps_copy (gst_pad_get_negotiated_caps (otherpad));
gst_caps_set_simple (othercaps,
"width", G_TYPE_INT, width,
"height", G_TYPE_INT, height, "framerate", G_TYPE_DOUBLE, fps, NULL);
"width", G_TYPE_INT, width,
"height", G_TYPE_INT, height, "framerate", G_TYPE_DOUBLE, fps, NULL);
link_ret = gst_pad_try_set_caps (otherpad, othercaps);
if (link_ret != GST_PAD_LINK_OK) {
@ -425,11 +427,11 @@ gst_hermes_colorspace_link (GstPad * pad, const GstCaps * caps)
if (pad == space->srcpad) {
space->src_format_index = i;
gst_hermes_colorspace_structure_to_hermes_format (&space->src_format,
structure);
structure);
} else {
space->sink_format_index = i;
gst_hermes_colorspace_structure_to_hermes_format (&space->sink_format,
structure);
structure);
}
space->sink_stride = width * (space->sink_format.bits / 8);
@ -442,7 +444,7 @@ gst_hermes_colorspace_link (GstPad * pad, const GstCaps * caps)
if (gst_pad_is_negotiated (otherpad)) {
if (!Hermes_ConverterRequest (space->h_handle, &space->sink_format,
&space->src_format)) {
&space->src_format)) {
g_warning ("Hermes: could not get converter\n");
return GST_PAD_LINK_REFUSED;
}
@ -469,9 +471,10 @@ gst_hermes_colorspace_get_type (void)
0,
(GInstanceInitFunc) gst_hermes_colorspace_init,
};
colorspace_type =
g_type_register_static (GST_TYPE_ELEMENT, "GstHermesColorspace",
&colorspace_info, 0);
g_type_register_static (GST_TYPE_ELEMENT, "GstHermesColorspace",
&colorspace_info, 0);
}
return colorspace_type;
}
@ -481,12 +484,12 @@ static GstStaticPadTemplate gst_hermes_colorspace_src_pad_template =
GST_PAD_SRC,
GST_PAD_ALWAYS,
GST_STATIC_CAPS (GST_VIDEO_CAPS_xRGB "; "
GST_VIDEO_CAPS_RGBx "; "
GST_VIDEO_CAPS_BGRx "; "
GST_VIDEO_CAPS_xBGR "; "
GST_VIDEO_CAPS_BGR "; "
GST_VIDEO_CAPS_RGB "; "
GST_VIDEO_CAPS_RGB_16 "; " GST_VIDEO_CAPS_RGB_15)
GST_VIDEO_CAPS_RGBx "; "
GST_VIDEO_CAPS_BGRx "; "
GST_VIDEO_CAPS_xBGR "; "
GST_VIDEO_CAPS_BGR "; "
GST_VIDEO_CAPS_RGB "; "
GST_VIDEO_CAPS_RGB_16 "; " GST_VIDEO_CAPS_RGB_15)
);
static GstStaticPadTemplate gst_hermes_colorspace_sink_pad_template =
@ -494,12 +497,12 @@ static GstStaticPadTemplate gst_hermes_colorspace_sink_pad_template =
GST_PAD_SINK,
GST_PAD_ALWAYS,
GST_STATIC_CAPS (GST_VIDEO_CAPS_xRGB "; "
GST_VIDEO_CAPS_RGBx "; "
GST_VIDEO_CAPS_BGRx "; "
GST_VIDEO_CAPS_xBGR "; "
GST_VIDEO_CAPS_BGR "; "
GST_VIDEO_CAPS_RGB "; "
GST_VIDEO_CAPS_RGB_16 "; " GST_VIDEO_CAPS_RGB_15)
GST_VIDEO_CAPS_RGBx "; "
GST_VIDEO_CAPS_BGRx "; "
GST_VIDEO_CAPS_xBGR "; "
GST_VIDEO_CAPS_BGR "; "
GST_VIDEO_CAPS_RGB "; "
GST_VIDEO_CAPS_RGB_16 "; " GST_VIDEO_CAPS_RGB_15)
);
static void
@ -654,7 +657,7 @@ plugin_init (GstPlugin * plugin)
g_return_val_if_fail (hermes_res != 0, FALSE);
if (!gst_element_register (plugin, "hermescolorspace", GST_RANK_PRIMARY,
GST_TYPE_COLORSPACE))
GST_TYPE_COLORSPACE))
return FALSE;
return TRUE;

View file

@ -33,7 +33,7 @@ plugin_init (GstPlugin * plugin)
return FALSE;
if (!gst_element_register (plugin, "tremor", GST_RANK_PRIMARY,
ivorbisfile_get_type ()))
ivorbisfile_get_type ()))
return FALSE;
return TRUE;

View file

@ -152,13 +152,13 @@ ivorbisfile_get_type (void)
};
ivorbisfile_type = g_type_register_static (GST_TYPE_ELEMENT, "Ivorbisfile",
&ivorbisfile_info, 0);
&ivorbisfile_info, 0);
logical_stream_format =
gst_format_register ("logical_stream", "The logical stream");
gst_format_register ("logical_stream", "The logical stream");
GST_DEBUG_CATEGORY_INIT (ivorbisfile_debug, "ivorbisfile", 0,
"vorbis in ogg decoding element (integer arithmetic)");
"vorbis in ogg decoding element (integer arithmetic)");
}
return ivorbisfile_type;
}
@ -232,10 +232,10 @@ gst_ivorbisfile_class_init (IvorbisfileClass * klass)
g_object_class_install_property (gobject_class, ARG_METADATA,
g_param_spec_boxed ("metadata", "Metadata", "(logical) Stream metadata",
GST_TYPE_CAPS, G_PARAM_READABLE));
GST_TYPE_CAPS, G_PARAM_READABLE));
g_object_class_install_property (gobject_class, ARG_STREAMINFO,
g_param_spec_boxed ("streaminfo", "stream",
"(logical) Stream information", GST_TYPE_CAPS, G_PARAM_READABLE));
"(logical) Stream information", GST_TYPE_CAPS, G_PARAM_READABLE));
gobject_class->get_property = gst_ivorbisfile_get_property;
gobject_class->set_property = gst_ivorbisfile_set_property;
@ -311,25 +311,25 @@ gst_ivorbisfile_read (void *ptr, size_t size, size_t nmemb, void *datasource)
gst_bytestream_get_status (ivorbisfile->bs, &avail, &event);
switch (GST_EVENT_TYPE (event)) {
case GST_EVENT_EOS:
GST_DEBUG ("eos");
ivorbisfile->eos = TRUE;
if (avail == 0) {
gst_event_unref (event);
return 0;
}
break;
case GST_EVENT_DISCONTINUOUS:
GST_DEBUG ("discont");
ivorbisfile->need_discont = TRUE;
default:
break;
case GST_EVENT_EOS:
GST_DEBUG ("eos");
ivorbisfile->eos = TRUE;
if (avail == 0) {
gst_event_unref (event);
return 0;
}
break;
case GST_EVENT_DISCONTINUOUS:
GST_DEBUG ("discont");
ivorbisfile->need_discont = TRUE;
default:
break;
}
gst_event_unref (event);
if (avail > 0)
got_bytes = gst_bytestream_peek_bytes (ivorbisfile->bs, &data, avail);
got_bytes = gst_bytestream_peek_bytes (ivorbisfile->bs, &data, avail);
else
got_bytes = 0;
got_bytes = 0;
}
}
@ -539,13 +539,13 @@ gst_ivorbisfile_loop (GstElement * element)
ivorbisfile->total_bytes = 0;
ivorbisfile->may_eos = FALSE;
ivorbisfile->vf.seekable = gst_bytestream_seek (ivorbisfile->bs, 0,
GST_SEEK_METHOD_SET);
GST_SEEK_METHOD_SET);
GST_DEBUG ("ivorbisfile: seekable: %s\n",
ivorbisfile->vf.seekable ? "yes" : "no");
ivorbisfile->vf.seekable ? "yes" : "no");
/* open our custom ivorbisfile data object with the callbacks we provide */
if (ov_open_callbacks (ivorbisfile, &ivorbisfile->vf, NULL, 0,
ivorbisfile_ov_callbacks) < 0) {
ivorbisfile_ov_callbacks) < 0) {
GST_ELEMENT_ERROR (element, STREAM, DECODE, (NULL), (NULL));
return;
}
@ -560,45 +560,45 @@ gst_ivorbisfile_loop (GstElement * element)
switch (ivorbisfile->seek_format) {
case GST_FORMAT_TIME:
{
gdouble seek_to = (gdouble) ivorbisfile->seek_value / GST_SECOND;
gdouble seek_to = (gdouble) ivorbisfile->seek_value / GST_SECOND;
if (ivorbisfile->seek_accurate) {
if (ov_time_seek (&ivorbisfile->vf, seek_to) == 0) {
ivorbisfile->need_discont = TRUE;
}
} else {
if (ov_time_seek_page (&ivorbisfile->vf, seek_to) == 0) {
ivorbisfile->need_discont = TRUE;
}
}
break;
if (ivorbisfile->seek_accurate) {
if (ov_time_seek (&ivorbisfile->vf, seek_to) == 0) {
ivorbisfile->need_discont = TRUE;
}
} else {
if (ov_time_seek_page (&ivorbisfile->vf, seek_to) == 0) {
ivorbisfile->need_discont = TRUE;
}
}
break;
}
case GST_FORMAT_DEFAULT:
if (ivorbisfile->seek_accurate) {
if (ov_pcm_seek (&ivorbisfile->vf, ivorbisfile->seek_value) == 0) {
ivorbisfile->need_discont = TRUE;
}
} else {
if (ov_pcm_seek_page (&ivorbisfile->vf, ivorbisfile->seek_value) == 0) {
ivorbisfile->need_discont = TRUE;
}
}
break;
if (ivorbisfile->seek_accurate) {
if (ov_pcm_seek (&ivorbisfile->vf, ivorbisfile->seek_value) == 0) {
ivorbisfile->need_discont = TRUE;
}
} else {
if (ov_pcm_seek_page (&ivorbisfile->vf, ivorbisfile->seek_value) == 0) {
ivorbisfile->need_discont = TRUE;
}
}
break;
default:
if (ivorbisfile->seek_format == logical_stream_format) {
gint64 seek_to;
if (ivorbisfile->seek_format == logical_stream_format) {
gint64 seek_to;
seek_to = ivorbisfile->vf.offsets[ivorbisfile->seek_value];
seek_to = ivorbisfile->vf.offsets[ivorbisfile->seek_value];
if (ov_raw_seek (&ivorbisfile->vf, seek_to) == 0) {
ivorbisfile->need_discont = TRUE;
ivorbisfile->current_link = -1;
} else {
g_warning ("raw seek failed");
}
} else
g_warning ("unknown seek method, implement me !");
break;
if (ov_raw_seek (&ivorbisfile->vf, seek_to) == 0) {
ivorbisfile->need_discont = TRUE;
ivorbisfile->current_link = -1;
} else {
g_warning ("raw seek failed");
}
} else
g_warning ("unknown seek method, implement me !");
break;
}
ivorbisfile->seek_pending = FALSE;
}
@ -630,7 +630,7 @@ gst_ivorbisfile_loop (GstElement * element)
/* if the pad is not usable, don't push it out */
if (GST_PAD_IS_USABLE (ivorbisfile->srcpad)) {
gst_pad_push (ivorbisfile->srcpad,
GST_DATA (gst_event_new (GST_EVENT_EOS)));
GST_DATA (gst_event_new (GST_EVENT_EOS)));
}
gst_element_set_eos (element);
return;
@ -646,13 +646,13 @@ gst_ivorbisfile_loop (GstElement * element)
/* if the pad is not usable, don't push it out */
if (GST_PAD_IS_USABLE (ivorbisfile->srcpad)) {
/* get stream stats */
samples = (gint64) (ov_pcm_tell (&ivorbisfile->vf));
/* get stream stats */
samples = (gint64) (ov_pcm_tell (&ivorbisfile->vf));
discont = gst_event_new_discontinuous (FALSE, GST_FORMAT_TIME, time,
GST_FORMAT_DEFAULT, samples, NULL);
discont = gst_event_new_discontinuous (FALSE, GST_FORMAT_TIME, time,
GST_FORMAT_DEFAULT, samples, NULL);
gst_pad_push (ivorbisfile->srcpad, GST_DATA (discont));
gst_pad_push (ivorbisfile->srcpad, GST_DATA (discont));
}
}
@ -714,90 +714,90 @@ gst_ivorbisfile_src_convert (GstPad * pad,
switch (src_format) {
case GST_FORMAT_BYTES:
switch (*dest_format) {
case GST_FORMAT_DEFAULT:
*dest_value = src_value / (vi->channels * 2);
break;
case GST_FORMAT_TIME:
{
gint byterate = bytes_per_sample * vi->rate;
case GST_FORMAT_DEFAULT:
*dest_value = src_value / (vi->channels * 2);
break;
case GST_FORMAT_TIME:
{
gint byterate = bytes_per_sample * vi->rate;
if (byterate == 0)
return FALSE;
*dest_value = src_value * GST_SECOND / byterate;
break;
}
default:
res = FALSE;
if (byterate == 0)
return FALSE;
*dest_value = src_value * GST_SECOND / byterate;
break;
}
default:
res = FALSE;
}
case GST_FORMAT_DEFAULT:
switch (*dest_format) {
case GST_FORMAT_BYTES:
*dest_value = src_value * bytes_per_sample;
break;
case GST_FORMAT_TIME:
if (vi->rate == 0)
return FALSE;
*dest_value = src_value * GST_SECOND / vi->rate;
break;
default:
res = FALSE;
case GST_FORMAT_BYTES:
*dest_value = src_value * bytes_per_sample;
break;
case GST_FORMAT_TIME:
if (vi->rate == 0)
return FALSE;
*dest_value = src_value * GST_SECOND / vi->rate;
break;
default:
res = FALSE;
}
break;
case GST_FORMAT_TIME:
switch (*dest_format) {
case GST_FORMAT_BYTES:
scale = bytes_per_sample;
case GST_FORMAT_DEFAULT:
*dest_value = src_value * scale * vi->rate / GST_SECOND;
break;
default:
res = FALSE;
case GST_FORMAT_BYTES:
scale = bytes_per_sample;
case GST_FORMAT_DEFAULT:
*dest_value = src_value * scale * vi->rate / GST_SECOND;
break;
default:
res = FALSE;
}
break;
default:
if (src_format == logical_stream_format) {
/* because we need to convert relative from 0, we have to add
* all pcm totals */
gint i;
gint64 count = 0;
/* because we need to convert relative from 0, we have to add
* all pcm totals */
gint i;
gint64 count = 0;
switch (*dest_format) {
case GST_FORMAT_BYTES:
res = FALSE;
break;
case GST_FORMAT_DEFAULT:
if (src_value > ivorbisfile->vf.links) {
src_value = ivorbisfile->vf.links;
}
for (i = 0; i < src_value; i++) {
vi = ov_info (&ivorbisfile->vf, i);
switch (*dest_format) {
case GST_FORMAT_BYTES:
res = FALSE;
break;
case GST_FORMAT_DEFAULT:
if (src_value > ivorbisfile->vf.links) {
src_value = ivorbisfile->vf.links;
}
for (i = 0; i < src_value; i++) {
vi = ov_info (&ivorbisfile->vf, i);
count += ov_pcm_total (&ivorbisfile->vf, i);
}
*dest_value = count;
break;
case GST_FORMAT_TIME:
{
if (src_value > ivorbisfile->vf.links) {
src_value = ivorbisfile->vf.links;
}
for (i = 0; i < src_value; i++) {
vi = ov_info (&ivorbisfile->vf, i);
if (vi->rate)
count +=
ov_pcm_total (&ivorbisfile->vf, i) * GST_SECOND / vi->rate;
else
count += ov_time_total (&ivorbisfile->vf, i) * GST_SECOND;
}
/* we use the pcm totals to get the total time, it's more accurate */
*dest_value = count;
break;
}
default:
res = FALSE;
}
count += ov_pcm_total (&ivorbisfile->vf, i);
}
*dest_value = count;
break;
case GST_FORMAT_TIME:
{
if (src_value > ivorbisfile->vf.links) {
src_value = ivorbisfile->vf.links;
}
for (i = 0; i < src_value; i++) {
vi = ov_info (&ivorbisfile->vf, i);
if (vi->rate)
count +=
ov_pcm_total (&ivorbisfile->vf, i) * GST_SECOND / vi->rate;
else
count += ov_time_total (&ivorbisfile->vf, i) * GST_SECOND;
}
/* we use the pcm totals to get the total time, it's more accurate */
*dest_value = count;
break;
}
default:
res = FALSE;
}
} else
res = FALSE;
res = FALSE;
break;
}
return res;
@ -816,34 +816,34 @@ gst_ivorbisfile_sink_convert (GstPad * pad,
switch (src_format) {
case GST_FORMAT_BYTES:
switch (*dest_format) {
case GST_FORMAT_TIME:
break;
default:
if (*dest_format == logical_stream_format) {
} else
res = FALSE;
case GST_FORMAT_TIME:
break;
default:
if (*dest_format == logical_stream_format) {
} else
res = FALSE;
}
case GST_FORMAT_TIME:
switch (*dest_format) {
case GST_FORMAT_BYTES:
break;
default:
if (*dest_format == logical_stream_format) {
} else
res = FALSE;
case GST_FORMAT_BYTES:
break;
default:
if (*dest_format == logical_stream_format) {
} else
res = FALSE;
}
default:
if (src_format == logical_stream_format) {
switch (*dest_format) {
case GST_FORMAT_TIME:
break;
case GST_FORMAT_BYTES:
break;
default:
res = FALSE;
}
switch (*dest_format) {
case GST_FORMAT_TIME:
break;
case GST_FORMAT_BYTES:
break;
default:
res = FALSE;
}
} else
res = FALSE;
res = FALSE;
break;
}
@ -858,6 +858,7 @@ gst_ivorbisfile_get_query_types (GstPad * pad)
GST_QUERY_POSITION,
0
};
return types;
}
@ -878,67 +879,67 @@ gst_ivorbisfile_src_query (GstPad * pad, GstQueryType type,
case GST_QUERY_TOTAL:
{
switch (*format) {
case GST_FORMAT_DEFAULT:
if (ivorbisfile->vf.seekable)
*value = ov_pcm_total (&ivorbisfile->vf, -1);
else
return FALSE;
break;
case GST_FORMAT_BYTES:
if (ivorbisfile->vf.seekable)
*value = ov_pcm_total (&ivorbisfile->vf, -1) * vi->channels * 2;
else
return FALSE;
break;
case GST_FORMAT_TIME:
if (ivorbisfile->vf.seekable)
*value =
(gint64) (ov_time_total (&ivorbisfile->vf, -1) * GST_SECOND);
else
return FALSE;
break;
default:
if (*format == logical_stream_format) {
if (ivorbisfile->vf.seekable)
*value = ivorbisfile->vf.links;
else
return FALSE;
} else
res = FALSE;
break;
case GST_FORMAT_DEFAULT:
if (ivorbisfile->vf.seekable)
*value = ov_pcm_total (&ivorbisfile->vf, -1);
else
return FALSE;
break;
case GST_FORMAT_BYTES:
if (ivorbisfile->vf.seekable)
*value = ov_pcm_total (&ivorbisfile->vf, -1) * vi->channels * 2;
else
return FALSE;
break;
case GST_FORMAT_TIME:
if (ivorbisfile->vf.seekable)
*value =
(gint64) (ov_time_total (&ivorbisfile->vf, -1) * GST_SECOND);
else
return FALSE;
break;
default:
if (*format == logical_stream_format) {
if (ivorbisfile->vf.seekable)
*value = ivorbisfile->vf.links;
else
return FALSE;
} else
res = FALSE;
break;
}
break;
}
case GST_QUERY_POSITION:
switch (*format) {
case GST_FORMAT_TIME:
if (ivorbisfile->vf.seekable)
*value = (gint64) (ov_time_tell (&ivorbisfile->vf) * GST_SECOND);
else
*value = ivorbisfile->total_bytes * GST_SECOND
/ (vi->rate * vi->channels * 2);
break;
case GST_FORMAT_BYTES:
if (ivorbisfile->vf.seekable)
*value = ov_pcm_tell (&ivorbisfile->vf) * vi->channels * 2;
else
*value = ivorbisfile->total_bytes;
break;
case GST_FORMAT_DEFAULT:
if (ivorbisfile->vf.seekable)
*value = ov_pcm_tell (&ivorbisfile->vf);
else
*value = ivorbisfile->total_bytes / (vi->channels * 2);
break;
default:
if (*format == logical_stream_format) {
if (ivorbisfile->vf.seekable)
*value = ivorbisfile->current_link;
else
return FALSE;
} else
res = FALSE;
break;
case GST_FORMAT_TIME:
if (ivorbisfile->vf.seekable)
*value = (gint64) (ov_time_tell (&ivorbisfile->vf) * GST_SECOND);
else
*value = ivorbisfile->total_bytes * GST_SECOND
/ (vi->rate * vi->channels * 2);
break;
case GST_FORMAT_BYTES:
if (ivorbisfile->vf.seekable)
*value = ov_pcm_tell (&ivorbisfile->vf) * vi->channels * 2;
else
*value = ivorbisfile->total_bytes;
break;
case GST_FORMAT_DEFAULT:
if (ivorbisfile->vf.seekable)
*value = ov_pcm_tell (&ivorbisfile->vf);
else
*value = ivorbisfile->total_bytes / (vi->channels * 2);
break;
default:
if (*format == logical_stream_format) {
if (ivorbisfile->vf.seekable)
*value = ivorbisfile->current_link;
else
return FALSE;
} else
res = FALSE;
break;
}
break;
default:
@ -956,6 +957,7 @@ gst_ivorbisfile_get_event_masks (GstPad * pad)
{GST_EVENT_SEEK, GST_SEEK_METHOD_SET | GST_SEEK_FLAG_ACCURATE},
{0,}
};
return masks;
}
@ -976,52 +978,52 @@ gst_ivorbisfile_src_event (GstPad * pad, GstEvent * event)
GstFormat format;
GST_DEBUG ("ivorbisfile: handling seek event on pad %s:%s",
GST_DEBUG_PAD_NAME (pad));
GST_DEBUG_PAD_NAME (pad));
if (!ivorbisfile->vf.seekable) {
gst_event_unref (event);
GST_DEBUG ("vorbis stream is not seekable");
return FALSE;
gst_event_unref (event);
GST_DEBUG ("vorbis stream is not seekable");
return FALSE;
}
offset = GST_EVENT_SEEK_OFFSET (event);
format = GST_EVENT_SEEK_FORMAT (event);
switch (format) {
case GST_FORMAT_TIME:
ivorbisfile->seek_pending = TRUE;
ivorbisfile->seek_value = offset;
ivorbisfile->seek_format = format;
ivorbisfile->seek_accurate = GST_EVENT_SEEK_FLAGS (event)
& GST_SEEK_FLAG_ACCURATE;
break;
case GST_FORMAT_BYTES:
vi = ov_info (&ivorbisfile->vf, -1);
if (vi->channels == 0) {
GST_DEBUG ("vorbis stream has 0 channels ?");
res = FALSE;
goto done;
}
offset /= vi->channels * 2;
/* fallthrough */
case GST_FORMAT_DEFAULT:
ivorbisfile->seek_pending = TRUE;
ivorbisfile->seek_value = offset;
ivorbisfile->seek_format = format;
ivorbisfile->seek_accurate = GST_EVENT_SEEK_FLAGS (event)
& GST_SEEK_FLAG_ACCURATE;
break;
default:
if (format == logical_stream_format) {
ivorbisfile->seek_pending = TRUE;
ivorbisfile->seek_value = offset;
ivorbisfile->seek_format = format;
ivorbisfile->seek_accurate = GST_EVENT_SEEK_FLAGS (event)
& GST_SEEK_FLAG_ACCURATE;
} else {
GST_DEBUG ("unhandled seek format");
res = FALSE;
}
break;
case GST_FORMAT_TIME:
ivorbisfile->seek_pending = TRUE;
ivorbisfile->seek_value = offset;
ivorbisfile->seek_format = format;
ivorbisfile->seek_accurate = GST_EVENT_SEEK_FLAGS (event)
& GST_SEEK_FLAG_ACCURATE;
break;
case GST_FORMAT_BYTES:
vi = ov_info (&ivorbisfile->vf, -1);
if (vi->channels == 0) {
GST_DEBUG ("vorbis stream has 0 channels ?");
res = FALSE;
goto done;
}
offset /= vi->channels * 2;
/* fallthrough */
case GST_FORMAT_DEFAULT:
ivorbisfile->seek_pending = TRUE;
ivorbisfile->seek_value = offset;
ivorbisfile->seek_format = format;
ivorbisfile->seek_accurate = GST_EVENT_SEEK_FLAGS (event)
& GST_SEEK_FLAG_ACCURATE;
break;
default:
if (format == logical_stream_format) {
ivorbisfile->seek_pending = TRUE;
ivorbisfile->seek_value = offset;
ivorbisfile->seek_format = format;
ivorbisfile->seek_accurate = GST_EVENT_SEEK_FLAGS (event)
& GST_SEEK_FLAG_ACCURATE;
} else {
GST_DEBUG ("unhandled seek format");
res = FALSE;
}
break;
}
break;
}

View file

@ -106,8 +106,9 @@ gst_jack_get_type (void)
0,
NULL,
};
jack_type =
g_type_register_static (GST_TYPE_ELEMENT, "GstJack", &jack_info, 0);
g_type_register_static (GST_TYPE_ELEMENT, "GstJack", &jack_info, 0);
}
return jack_type;
}
@ -129,8 +130,9 @@ gst_jack_sink_get_type (void)
0,
(GInstanceInitFunc) gst_jack_init,
};
jack_type =
g_type_register_static (GST_TYPE_JACK, "GstJackSink", &jack_info, 0);
g_type_register_static (GST_TYPE_JACK, "GstJackSink", &jack_info, 0);
}
return jack_type;
}
@ -152,8 +154,9 @@ gst_jack_src_get_type (void)
0,
(GInstanceInitFunc) gst_jack_init,
};
jack_type =
g_type_register_static (GST_TYPE_JACK, "GstJackSrc", &jack_info, 0);
g_type_register_static (GST_TYPE_JACK, "GstJackSrc", &jack_info, 0);
}
return jack_type;
}
@ -240,7 +243,7 @@ gst_jack_set_property (GObject * object, guint prop_id, const GValue * value,
switch (prop_id) {
case ARG_PORT_NAME_PREFIX:
if (this->port_name_prefix)
g_free (this->port_name_prefix);
g_free (this->port_name_prefix);
this->port_name_prefix = g_strdup (g_value_get_string (value));
break;
default:
@ -318,8 +321,8 @@ gst_jack_request_new_pad (GstElement * element, GstPadTemplate * templ,
l = *pad_list;
while (l) {
if (strcmp (GST_JACK_PAD (l)->name, name) == 0) {
g_warning ("requested port name %s already in use.", name);
return NULL;
g_warning ("requested port name %s already in use.", name);
return NULL;
}
l = l->next;
}
@ -338,7 +341,7 @@ gst_jack_request_new_pad (GstElement * element, GstPadTemplate * templ,
count =
GPOINTER_TO_INT (g_hash_table_lookup (port_name_counts,
this->port_name_prefix));
this->port_name_prefix));
g_hash_table_insert (port_name_counts, g_strdup (this->port_name_prefix),
GINT_TO_POINTER (count + 1));
@ -377,26 +380,26 @@ gst_jack_change_state (GstElement * element)
JACK_DEBUG ("%s: READY", GST_OBJECT_NAME (GST_OBJECT (this)));
if (!this->bin) {
if (!(this->bin = (GstJackBin *) gst_element_get_managing_bin (element))
|| !GST_IS_JACK_BIN (this->bin)) {
this->bin = NULL;
g_warning ("jack element %s needs to be contained in a jack bin.",
GST_OBJECT_NAME (element));
return GST_STATE_FAILURE;
}
if (!(this->bin = (GstJackBin *) gst_element_get_managing_bin (element))
|| !GST_IS_JACK_BIN (this->bin)) {
this->bin = NULL;
g_warning ("jack element %s needs to be contained in a jack bin.",
GST_OBJECT_NAME (element));
return GST_STATE_FAILURE;
}
/* fixme: verify that all names are unique */
l = this->pads;
pads =
(this->direction ==
GST_PAD_SRC) ? &this->bin->src_pads : &this->bin->sink_pads;
while (l) {
pad = GST_JACK_PAD (l);
JACK_DEBUG ("%s: appending pad %s:%s to list", GST_OBJECT_NAME (this),
pad->name, pad->peer_name);
*pads = g_list_append (*pads, pad);
l = g_list_next (l);
}
/* fixme: verify that all names are unique */
l = this->pads;
pads =
(this->direction ==
GST_PAD_SRC) ? &this->bin->src_pads : &this->bin->sink_pads;
while (l) {
pad = GST_JACK_PAD (l);
JACK_DEBUG ("%s: appending pad %s:%s to list", GST_OBJECT_NAME (this),
pad->name, pad->peer_name);
*pads = g_list_append (*pads, pad);
l = g_list_next (l);
}
}
break;
@ -404,18 +407,18 @@ gst_jack_change_state (GstElement * element)
JACK_DEBUG ("%s: PAUSED", GST_OBJECT_NAME (GST_OBJECT (this)));
if (GST_STATE (element) == GST_STATE_READY) {
/* we're in READY->PAUSED */
l = this->pads;
while (l) {
pad = GST_JACK_PAD (l);
caps = gst_caps_copy (gst_pad_get_negotiated_caps (pad->pad));
gst_caps_set_simple (caps,
"rate", G_TYPE_INT, (int) this->bin->rate,
"buffer-frames", G_TYPE_INT, (gint) this->bin->nframes, NULL);
if (gst_pad_try_set_caps (pad->pad, caps) <= 0)
return GST_STATE_FAILURE;
l = g_list_next (l);
}
/* we're in READY->PAUSED */
l = this->pads;
while (l) {
pad = GST_JACK_PAD (l);
caps = gst_caps_copy (gst_pad_get_negotiated_caps (pad->pad));
gst_caps_set_simple (caps,
"rate", G_TYPE_INT, (int) this->bin->rate,
"buffer-frames", G_TYPE_INT, (gint) this->bin->nframes, NULL);
if (gst_pad_try_set_caps (pad->pad, caps) <= 0)
return GST_STATE_FAILURE;
l = g_list_next (l);
}
}
break;
case GST_STATE_PLAYING:
@ -444,7 +447,7 @@ gst_jack_link (GstPad * pad, const GstCaps * caps)
gst_structure_get_int (structure, "rate", &rate);
gst_structure_get_int (structure, "buffer-frames", &buffer_frames);
if (this->bin && (rate != this->bin->rate ||
buffer_frames != this->bin->nframes))
buffer_frames != this->bin->nframes))
return GST_PAD_LINK_REFUSED;
return GST_PAD_LINK_OK;
@ -471,17 +474,17 @@ gst_jack_loop (GstElement * element)
buffer = GST_BUFFER (gst_pad_pull (pad->pad));
if (GST_IS_EVENT (buffer)) {
GstEvent *event = GST_EVENT (buffer);
GstEvent *event = GST_EVENT (buffer);
switch (GST_EVENT_TYPE (buffer)) {
case GST_EVENT_EOS:
gst_element_set_eos (element);
gst_event_unref (event);
return;
default:
gst_pad_event_default (pad->pad, event);
return;
}
switch (GST_EVENT_TYPE (buffer)) {
case GST_EVENT_EOS:
gst_element_set_eos (element);
gst_event_unref (event);
return;
default:
gst_pad_event_default (pad->pad, event);
return;
}
}
/* if the other plugins only give out buffer-frames or less (as
@ -490,8 +493,8 @@ gst_jack_loop (GstElement * element)
next */
memcpy (pad->data, GST_BUFFER_DATA (buffer), GST_BUFFER_SIZE (buffer));
if (len != GST_BUFFER_SIZE (buffer))
memset (pad->data + GST_BUFFER_SIZE (buffer), 0,
len - GST_BUFFER_SIZE (buffer));
memset (pad->data + GST_BUFFER_SIZE (buffer), 0,
len - GST_BUFFER_SIZE (buffer));
gst_buffer_unref (buffer);
} else {
@ -509,15 +512,15 @@ static gboolean
plugin_init (GstPlugin * plugin)
{
if (!gst_element_register (plugin, "jackbin", GST_RANK_NONE,
GST_TYPE_JACK_BIN))
GST_TYPE_JACK_BIN))
return FALSE;
if (!gst_element_register (plugin, "jacksrc", GST_RANK_NONE,
GST_TYPE_JACK_SRC))
GST_TYPE_JACK_SRC))
return FALSE;
if (!gst_element_register (plugin, "jacksink", GST_RANK_NONE,
GST_TYPE_JACK_SINK))
GST_TYPE_JACK_SINK))
return FALSE;
return TRUE;

View file

@ -64,8 +64,9 @@ gst_jack_bin_get_type (void)
0,
(GInstanceInitFunc) gst_jack_bin_init,
};
jack_bin_type =
g_type_register_static (GST_TYPE_BIN, "GstJackBin", &jack_bin_info, 0);
g_type_register_static (GST_TYPE_BIN, "GstJackBin", &jack_bin_info, 0);
}
return jack_bin_type;
}
@ -111,17 +112,17 @@ gst_jack_bin_change_state (GstElement * element)
case GST_STATE_NULL:
JACK_DEBUG ("jackbin: NULL state");
if (this->client) {
JACK_DEBUG ("jackbin: closing client");
jack_client_close (this->client);
this->client = NULL;
JACK_DEBUG ("jackbin: closing client");
jack_client_close (this->client);
this->client = NULL;
}
if (_jackbin)
signal (SIGHUP, SIG_DFL);
signal (SIGHUP, SIG_DFL);
_jackbin = NULL;
if (GST_ELEMENT_CLASS (parent_class)->change_state)
return GST_ELEMENT_CLASS (parent_class)->change_state (element);
return GST_ELEMENT_CLASS (parent_class)->change_state (element);
break;
case GST_STATE_READY:
@ -131,116 +132,116 @@ gst_jack_bin_change_state (GstElement * element)
signal (SIGHUP, sighup_handler);
if (!this->client) {
if (!(this->client = jack_client_new ("gst-jack"))) {
g_warning ("jack server not running?");
return GST_STATE_FAILURE;
}
if (!(this->client = jack_client_new ("gst-jack"))) {
g_warning ("jack server not running?");
return GST_STATE_FAILURE;
}
gst_scheduler_setup (GST_ELEMENT_SCHED (this));
gst_scheduler_setup (GST_ELEMENT_SCHED (this));
jack_set_process_callback (this->client, process, this);
jack_set_sample_rate_callback (this->client, sample_rate, this);
jack_set_buffer_size_callback (this->client, buffer_size, this);
this->nframes = jack_get_buffer_size (this->client);
jack_on_shutdown (this->client, shutdown, this);
jack_set_process_callback (this->client, process, this);
jack_set_sample_rate_callback (this->client, sample_rate, this);
jack_set_buffer_size_callback (this->client, buffer_size, this);
this->nframes = jack_get_buffer_size (this->client);
jack_on_shutdown (this->client, shutdown, this);
}
if (GST_FLAG_IS_SET (GST_OBJECT (this), GST_JACK_OPEN)) {
l = this->src_pads;
while (l) {
JACK_DEBUG ("jackbin: unregistering pad %s:%s",
GST_JACK_PAD (l)->name, GST_JACK_PAD (l)->peer_name);
jack_port_unregister (this->client, GST_JACK_PAD (l)->port);
l = g_list_next (l);
}
l = this->sink_pads;
while (l) {
JACK_DEBUG ("jackbin: unregistering pad %s:%s",
GST_JACK_PAD (l)->name, GST_JACK_PAD (l)->peer_name);
jack_port_unregister (this->client, GST_JACK_PAD (l)->port);
l = g_list_next (l);
}
GST_FLAG_UNSET (GST_OBJECT (this), GST_JACK_OPEN);
l = this->src_pads;
while (l) {
JACK_DEBUG ("jackbin: unregistering pad %s:%s",
GST_JACK_PAD (l)->name, GST_JACK_PAD (l)->peer_name);
jack_port_unregister (this->client, GST_JACK_PAD (l)->port);
l = g_list_next (l);
}
l = this->sink_pads;
while (l) {
JACK_DEBUG ("jackbin: unregistering pad %s:%s",
GST_JACK_PAD (l)->name, GST_JACK_PAD (l)->peer_name);
jack_port_unregister (this->client, GST_JACK_PAD (l)->port);
l = g_list_next (l);
}
GST_FLAG_UNSET (GST_OBJECT (this), GST_JACK_OPEN);
if (GST_FLAG_IS_SET (GST_OBJECT (this), GST_JACK_ACTIVE)) {
JACK_DEBUG ("jackbin: deactivating client");
jack_deactivate (this->client);
GST_FLAG_UNSET (GST_OBJECT (this), GST_JACK_ACTIVE);
}
if (GST_FLAG_IS_SET (GST_OBJECT (this), GST_JACK_ACTIVE)) {
JACK_DEBUG ("jackbin: deactivating client");
jack_deactivate (this->client);
GST_FLAG_UNSET (GST_OBJECT (this), GST_JACK_ACTIVE);
}
}
if (GST_ELEMENT_CLASS (parent_class)->change_state)
return GST_ELEMENT_CLASS (parent_class)->change_state (element);
return GST_ELEMENT_CLASS (parent_class)->change_state (element);
break;
case GST_STATE_PAUSED:
JACK_DEBUG ("jackbin: PAUSED");
if (!GST_FLAG_IS_SET (GST_OBJECT (this), GST_JACK_OPEN)) {
l = this->src_pads;
while (l) {
pad = GST_JACK_PAD (l);
JACK_DEBUG ("jackbin: registering input port %s (peer %s)", pad->name,
pad->peer_name);
pad->port =
jack_port_register (this->client, pad->name,
JACK_DEFAULT_AUDIO_TYPE, JackPortIsInput | JackPortIsTerminal, 0);
l = g_list_next (l);
}
l = this->sink_pads;
while (l) {
pad = GST_JACK_PAD (l);
JACK_DEBUG ("jackbin: registering output port %s (peer %s)",
pad->name, pad->peer_name);
pad->port =
jack_port_register (this->client, pad->name,
JACK_DEFAULT_AUDIO_TYPE, JackPortIsOutput | JackPortIsTerminal,
0);
l = g_list_next (l);
}
l = this->src_pads;
while (l) {
pad = GST_JACK_PAD (l);
JACK_DEBUG ("jackbin: registering input port %s (peer %s)", pad->name,
pad->peer_name);
pad->port =
jack_port_register (this->client, pad->name,
JACK_DEFAULT_AUDIO_TYPE, JackPortIsInput | JackPortIsTerminal, 0);
l = g_list_next (l);
}
l = this->sink_pads;
while (l) {
pad = GST_JACK_PAD (l);
JACK_DEBUG ("jackbin: registering output port %s (peer %s)",
pad->name, pad->peer_name);
pad->port =
jack_port_register (this->client, pad->name,
JACK_DEFAULT_AUDIO_TYPE, JackPortIsOutput | JackPortIsTerminal,
0);
l = g_list_next (l);
}
/* must activate before connecting */
if (!GST_FLAG_IS_SET (GST_OBJECT (this), GST_JACK_ACTIVE)) {
JACK_DEBUG ("jackbin: activating client");
jack_activate (this->client);
GST_FLAG_SET (GST_OBJECT (this), GST_JACK_ACTIVE);
}
/* must activate before connecting */
if (!GST_FLAG_IS_SET (GST_OBJECT (this), GST_JACK_ACTIVE)) {
JACK_DEBUG ("jackbin: activating client");
jack_activate (this->client);
GST_FLAG_SET (GST_OBJECT (this), GST_JACK_ACTIVE);
}
l = this->src_pads;
while (l) {
pad = GST_JACK_PAD (l);
JACK_DEBUG ("connecting jack port %s to gst jack port %s",
pad->peer_name, jack_port_name (pad->port));
if (jack_connect (this->client, pad->peer_name,
jack_port_name (pad->port))) {
g_warning ("jackbin: could not connect %s and %s", pad->peer_name,
jack_port_name (pad->port));
return GST_STATE_FAILURE;
}
l = g_list_next (l);
}
l = this->sink_pads;
while (l) {
pad = GST_JACK_PAD (l);
JACK_DEBUG ("connecting gst jack port %s to jack port %s",
jack_port_name (pad->port), pad->peer_name);
if (jack_connect (this->client, jack_port_name (pad->port),
pad->peer_name)) {
g_warning ("jackbin: could not connect %s and %s", pad->peer_name,
jack_port_name (pad->port));
return GST_STATE_FAILURE;
}
l = g_list_next (l);
}
l = this->src_pads;
while (l) {
pad = GST_JACK_PAD (l);
JACK_DEBUG ("connecting jack port %s to gst jack port %s",
pad->peer_name, jack_port_name (pad->port));
if (jack_connect (this->client, pad->peer_name,
jack_port_name (pad->port))) {
g_warning ("jackbin: could not connect %s and %s", pad->peer_name,
jack_port_name (pad->port));
return GST_STATE_FAILURE;
}
l = g_list_next (l);
}
l = this->sink_pads;
while (l) {
pad = GST_JACK_PAD (l);
JACK_DEBUG ("connecting gst jack port %s to jack port %s",
jack_port_name (pad->port), pad->peer_name);
if (jack_connect (this->client, jack_port_name (pad->port),
pad->peer_name)) {
g_warning ("jackbin: could not connect %s and %s", pad->peer_name,
jack_port_name (pad->port));
return GST_STATE_FAILURE;
}
l = g_list_next (l);
}
JACK_DEBUG ("jackbin: setting OPEN flag");
GST_FLAG_SET (GST_OBJECT (this), GST_JACK_OPEN);
JACK_DEBUG ("jackbin: setting OPEN flag");
GST_FLAG_SET (GST_OBJECT (this), GST_JACK_OPEN);
if (GST_ELEMENT_CLASS (parent_class)->change_state)
return GST_ELEMENT_CLASS (parent_class)->change_state (element);
if (GST_ELEMENT_CLASS (parent_class)->change_state)
return GST_ELEMENT_CLASS (parent_class)->change_state (element);
} else {
if (GST_ELEMENT_CLASS (parent_class)->change_state)
return GST_ELEMENT_CLASS (parent_class)->change_state (element);
if (GST_ELEMENT_CLASS (parent_class)->change_state)
return GST_ELEMENT_CLASS (parent_class)->change_state (element);
}
break;
@ -248,7 +249,7 @@ gst_jack_bin_change_state (GstElement * element)
JACK_DEBUG ("jackbin: PLAYING");
if (GST_ELEMENT_CLASS (parent_class)->change_state)
return GST_ELEMENT_CLASS (parent_class)->change_state (element);
return GST_ELEMENT_CLASS (parent_class)->change_state (element);
break;
}

View file

@ -28,8 +28,8 @@
#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 */
@ -107,13 +107,13 @@ gst_ladspa_base_init (GstLADSPAClass * klass)
/* the factories take ownership of the name */
if (LADSPA_IS_PORT_INPUT (desc->PortDescriptors[j])) {
templ = gst_pad_template_new (name, GST_PAD_SINK, GST_PAD_ALWAYS,
gst_caps_copy (gst_static_caps_get (&ladspa_pad_caps)));
klass->numsinkpads++;
templ = gst_pad_template_new (name, GST_PAD_SINK, GST_PAD_ALWAYS,
gst_caps_copy (gst_static_caps_get (&ladspa_pad_caps)));
klass->numsinkpads++;
} else {
templ = gst_pad_template_new (name, GST_PAD_SRC, GST_PAD_ALWAYS,
gst_caps_copy (gst_static_caps_get (&ladspa_pad_caps)));
klass->numsrcpads++;
templ = gst_pad_template_new (name, GST_PAD_SRC, GST_PAD_ALWAYS,
gst_caps_copy (gst_static_caps_get (&ladspa_pad_caps)));
klass->numsrcpads++;
}
gst_element_class_add_pad_template (element_class, templ);
@ -132,7 +132,7 @@ gst_ladspa_base_init (GstLADSPAClass * klass)
else if ((klass->numsinkpads > 0) && (klass->numsrcpads == 0))
details->klass = "Sink/Audio/LADSPA";
else
details->klass = "Filter/Effect/Audio/LADSPA"; /* whatever this is */
details->klass = "Filter/Effect/Audio/LADSPA"; /* whatever this is */
gst_element_class_set_details (element_class, details);
klass->srcpad_portnums = g_new0 (gint, klass->numsrcpads);
@ -144,9 +144,9 @@ gst_ladspa_base_init (GstLADSPAClass * klass)
for (j = 0; j < desc->PortCount; j++) {
if (LADSPA_IS_PORT_AUDIO (desc->PortDescriptors[j])) {
if (LADSPA_IS_PORT_INPUT (desc->PortDescriptors[j]))
klass->sinkpad_portnums[sinkcount++] = j;
klass->sinkpad_portnums[sinkcount++] = j;
else
klass->srcpad_portnums[srccount++] = j;
klass->srcpad_portnums[srccount++] = j;
}
}
@ -185,7 +185,7 @@ gst_ladspa_class_init (GstLADSPAClass * klass)
/* walk through the ports, count the input, output and control ports */
for (i = 0; i < desc->PortCount; i++) {
if (!LADSPA_IS_PORT_AUDIO (desc->PortDescriptors[i]) &&
LADSPA_IS_PORT_INPUT (desc->PortDescriptors[i]))
LADSPA_IS_PORT_INPUT (desc->PortDescriptors[i]))
klass->numcontrols++;
}
@ -199,7 +199,7 @@ gst_ladspa_class_init (GstLADSPAClass * klass)
/* walk through the ports, note the portnums for control params */
for (i = 0; i < desc->PortCount; i++) {
if (!LADSPA_IS_PORT_AUDIO (desc->PortDescriptors[i]) &&
LADSPA_IS_PORT_INPUT (desc->PortDescriptors[i]))
LADSPA_IS_PORT_INPUT (desc->PortDescriptors[i]))
klass->control_portnums[controlcount++] = i;
}
@ -232,27 +232,27 @@ gst_ladspa_class_init (GstLADSPAClass * klass)
if (LADSPA_IS_HINT_BOUNDED_BELOW (hintdesc)) {
klass->control_info[i].lower = TRUE;
klass->control_info[i].lowerbound =
desc->PortRangeHints[current_portnum].LowerBound;
desc->PortRangeHints[current_portnum].LowerBound;
} else {
if (argtype == G_TYPE_INT)
klass->control_info[i].lowerbound = (gfloat) G_MININT;
klass->control_info[i].lowerbound = (gfloat) G_MININT;
if (argtype == G_TYPE_FLOAT)
klass->control_info[i].lowerbound = -G_MAXFLOAT;
klass->control_info[i].lowerbound = -G_MAXFLOAT;
}
if (LADSPA_IS_HINT_BOUNDED_ABOVE (hintdesc)) {
klass->control_info[i].upper = TRUE;
klass->control_info[i].upperbound =
desc->PortRangeHints[current_portnum].UpperBound;
desc->PortRangeHints[current_portnum].UpperBound;
if (LADSPA_IS_HINT_SAMPLE_RATE (hintdesc)) {
klass->control_info[i].samplerate = TRUE;
klass->control_info[i].upperbound *= 44100; /* FIXME? */
klass->control_info[i].samplerate = TRUE;
klass->control_info[i].upperbound *= 44100; /* FIXME? */
}
} else {
if (argtype == G_TYPE_INT)
klass->control_info[i].upperbound = (gfloat) G_MAXINT;
klass->control_info[i].upperbound = (gfloat) G_MAXINT;
if (argtype == G_TYPE_FLOAT)
klass->control_info[i].upperbound = G_MAXFLOAT;
klass->control_info[i].upperbound = G_MAXFLOAT;
}
/* use the lowerbound as the default value */
@ -262,49 +262,49 @@ gst_ladspa_class_init (GstLADSPAClass * klass)
/* figure out the defaults */
if (LADSPA_IS_HINT_HAS_DEFAULT (hintdesc)) {
if (LADSPA_IS_HINT_DEFAULT_MINIMUM (hintdesc))
klass->control_info[i].def = klass->control_info[i].lowerbound;
klass->control_info[i].def = klass->control_info[i].lowerbound;
else if (LADSPA_IS_HINT_DEFAULT_LOW (hintdesc))
if (LADSPA_IS_HINT_LOGARITHMIC (hintdesc))
klass->control_info[i].def =
exp (0.75 * log (klass->control_info[i].lowerbound) +
0.25 * log (klass->control_info[i].upperbound));
else
klass->control_info[i].def =
(0.75 * klass->control_info[i].lowerbound +
0.25 * klass->control_info[i].upperbound);
if (LADSPA_IS_HINT_LOGARITHMIC (hintdesc))
klass->control_info[i].def =
exp (0.75 * log (klass->control_info[i].lowerbound) +
0.25 * log (klass->control_info[i].upperbound));
else
klass->control_info[i].def =
(0.75 * klass->control_info[i].lowerbound +
0.25 * klass->control_info[i].upperbound);
else if (LADSPA_IS_HINT_DEFAULT_MIDDLE (hintdesc))
if (LADSPA_IS_HINT_LOGARITHMIC (hintdesc))
klass->control_info[i].def =
exp (0.5 * log (klass->control_info[i].lowerbound) +
0.5 * log (klass->control_info[i].upperbound));
else
klass->control_info[i].def =
(0.5 * klass->control_info[i].lowerbound +
0.5 * klass->control_info[i].upperbound);
if (LADSPA_IS_HINT_LOGARITHMIC (hintdesc))
klass->control_info[i].def =
exp (0.5 * log (klass->control_info[i].lowerbound) +
0.5 * log (klass->control_info[i].upperbound));
else
klass->control_info[i].def =
(0.5 * klass->control_info[i].lowerbound +
0.5 * klass->control_info[i].upperbound);
else if (LADSPA_IS_HINT_DEFAULT_HIGH (hintdesc))
if (LADSPA_IS_HINT_LOGARITHMIC (hintdesc))
klass->control_info[i].def =
exp (0.25 * log (klass->control_info[i].lowerbound) +
0.75 * log (klass->control_info[i].upperbound));
else
klass->control_info[i].def =
(0.25 * klass->control_info[i].lowerbound +
0.75 * klass->control_info[i].upperbound);
if (LADSPA_IS_HINT_LOGARITHMIC (hintdesc))
klass->control_info[i].def =
exp (0.25 * log (klass->control_info[i].lowerbound) +
0.75 * log (klass->control_info[i].upperbound));
else
klass->control_info[i].def =
(0.25 * klass->control_info[i].lowerbound +
0.75 * klass->control_info[i].upperbound);
else if (LADSPA_IS_HINT_DEFAULT_MAXIMUM (hintdesc))
klass->control_info[i].def = klass->control_info[i].upperbound;
klass->control_info[i].def = klass->control_info[i].upperbound;
else if (LADSPA_IS_HINT_DEFAULT_0 (hintdesc))
klass->control_info[i].def = 0.0;
klass->control_info[i].def = 0.0;
else if (LADSPA_IS_HINT_DEFAULT_1 (hintdesc))
klass->control_info[i].def = 1.0;
klass->control_info[i].def = 1.0;
else if (LADSPA_IS_HINT_DEFAULT_100 (hintdesc))
klass->control_info[i].def = 100.0;
klass->control_info[i].def = 100.0;
else if (LADSPA_IS_HINT_DEFAULT_440 (hintdesc))
klass->control_info[i].def = 440.0;
klass->control_info[i].def = 440.0;
}
#endif /* LADSPA_IS_HINT_HAS_DEFAULT */
klass->control_info[i].def = CLAMP (klass->control_info[i].def,
klass->control_info[i].lowerbound, klass->control_info[i].upperbound);
klass->control_info[i].lowerbound, klass->control_info[i].upperbound);
if (LADSPA_IS_PORT_INPUT (desc->PortDescriptors[current_portnum])) {
argperms = G_PARAM_READWRITE;
@ -326,7 +326,7 @@ gst_ladspa_class_init (GstLADSPAClass * klass)
g_strcanon (argname, G_CSET_A_2_Z G_CSET_a_2_z G_CSET_DIGITS "-", '-');
/* satisfy glib2 (argname[0] must be [A-Za-z]) */
if (!((argname[0] >= 'a' && argname[0] <= 'z') || (argname[0] >= 'A'
&& argname[0] <= 'Z'))) {
&& argname[0] <= 'Z'))) {
tempstr = argname;
argname = g_strconcat ("param-", argname, NULL);
g_free (tempstr);
@ -338,9 +338,9 @@ gst_ladspa_class_init (GstLADSPAClass * klass)
gchar *numargname = g_strdup_printf ("%s_%d", argname, numarg++);
while (g_object_class_find_property (G_OBJECT_CLASS (klass),
numargname) != NULL) {
g_free (numargname);
numargname = g_strdup_printf ("%s_%d", argname, numarg++);
numargname) != NULL) {
g_free (numargname);
numargname = g_strdup_printf ("%s_%d", argname, numarg++);
}
argname = numargname;
}
@ -351,19 +351,19 @@ gst_ladspa_class_init (GstLADSPAClass * klass)
if (argtype == G_TYPE_BOOLEAN) {
paramspec =
g_param_spec_boolean (argname, argname, argname, FALSE, argperms);
g_param_spec_boolean (argname, argname, argname, FALSE, argperms);
} else if (argtype == G_TYPE_INT) {
paramspec = g_param_spec_int (argname, argname, argname,
(gint) klass->control_info[i].lowerbound,
(gint) klass->control_info[i].upperbound,
(gint) klass->control_info[i].def, argperms);
(gint) klass->control_info[i].lowerbound,
(gint) klass->control_info[i].upperbound,
(gint) klass->control_info[i].def, argperms);
} else if (klass->control_info[i].samplerate) {
paramspec = g_param_spec_float (argname, argname, argname,
0.0, G_MAXFLOAT, 0.0, argperms);
0.0, G_MAXFLOAT, 0.0, argperms);
} else {
paramspec = g_param_spec_float (argname, argname, argname,
klass->control_info[i].lowerbound, klass->control_info[i].upperbound,
klass->control_info[i].def, argperms);
klass->control_info[i].lowerbound, klass->control_info[i].upperbound,
klass->control_info[i].def, argperms);
}
/* properties have an offset of 1 */
@ -395,7 +395,7 @@ gst_ladspa_init (GstLADSPA * ladspa)
srccount = 0;
for (l = GST_ELEMENT_CLASS (oclass)->padtemplates; l; l = l->next) {
GstPad *pad = gst_pad_new_from_template (GST_PAD_TEMPLATE (l->data),
GST_PAD_TEMPLATE_NAME_TEMPLATE (l->data));
GST_PAD_TEMPLATE_NAME_TEMPLATE (l->data));
gst_pad_set_link_function (pad, gst_ladspa_link);
gst_element_add_pad ((GstElement *) ladspa, pad);
@ -413,32 +413,32 @@ gst_ladspa_init (GstLADSPA * ladspa)
ladspa->controls[i] = cinfo.def;
if (cinfo.toggled) {
gst_dpman_add_required_dparam_callback (ladspa->dpman,
g_param_spec_int (cinfo.param_name, cinfo.name, cinfo.name,
0, 1, (gint) (ladspa->controls[i]), G_PARAM_READWRITE),
"int", gst_ladspa_update_int, &(ladspa->controls[i])
);
gst_dpman_add_required_dparam_callback (ladspa->dpman,
g_param_spec_int (cinfo.param_name, cinfo.name, cinfo.name,
0, 1, (gint) (ladspa->controls[i]), G_PARAM_READWRITE),
"int", gst_ladspa_update_int, &(ladspa->controls[i])
);
} else if (cinfo.integer) {
gst_dpman_add_required_dparam_callback (ladspa->dpman,
g_param_spec_int (cinfo.param_name, cinfo.name, cinfo.name,
(gint) cinfo.lowerbound, (gint) cinfo.upperbound,
(gint) ladspa->controls[i], G_PARAM_READWRITE),
"int", gst_ladspa_update_int, &(ladspa->controls[i])
);
gst_dpman_add_required_dparam_callback (ladspa->dpman,
g_param_spec_int (cinfo.param_name, cinfo.name, cinfo.name,
(gint) cinfo.lowerbound, (gint) cinfo.upperbound,
(gint) ladspa->controls[i], G_PARAM_READWRITE),
"int", gst_ladspa_update_int, &(ladspa->controls[i])
);
} else if (cinfo.samplerate) {
gst_dpman_add_required_dparam_direct (ladspa->dpman,
g_param_spec_float (cinfo.param_name, cinfo.name, cinfo.name,
cinfo.lowerbound, cinfo.upperbound,
ladspa->controls[i], G_PARAM_READWRITE),
"hertz-rate-bound", &(ladspa->controls[i])
);
gst_dpman_add_required_dparam_direct (ladspa->dpman,
g_param_spec_float (cinfo.param_name, cinfo.name, cinfo.name,
cinfo.lowerbound, cinfo.upperbound,
ladspa->controls[i], G_PARAM_READWRITE),
"hertz-rate-bound", &(ladspa->controls[i])
);
} else {
gst_dpman_add_required_dparam_direct (ladspa->dpman,
g_param_spec_float (cinfo.param_name, cinfo.name, cinfo.name,
cinfo.lowerbound, cinfo.upperbound,
ladspa->controls[i], G_PARAM_READWRITE),
"float", &(ladspa->controls[i])
);
gst_dpman_add_required_dparam_direct (ladspa->dpman,
g_param_spec_float (cinfo.param_name, cinfo.name, cinfo.name,
cinfo.lowerbound, cinfo.upperbound,
ladspa->controls[i], G_PARAM_READWRITE),
"float", &(ladspa->controls[i])
);
}
}
}
@ -446,7 +446,7 @@ gst_ladspa_init (GstLADSPA * ladspa)
/* nonzero default needed to instantiate() some plugins */
ladspa->samplerate = 44100;
ladspa->buffer_frames = 0; /* should be set with caps */
ladspa->buffer_frames = 0; /* should be set with caps */
ladspa->activated = FALSE;
ladspa->inplace_broken =
LADSPA_IS_INPLACE_BROKEN (ladspa->descriptor->Properties);
@ -464,7 +464,7 @@ gst_ladspa_init (GstLADSPA * ladspa)
} else if (sinkcount > 1) {
/* more than one sink pad needs loop mode */
DEBUG_OBJ (ladspa, "loop mode with %d sink pads and %d src pads", sinkcount,
srccount);
srccount);
gst_element_set_loop_function (GST_ELEMENT (ladspa), gst_ladspa_loop);
} else if (sinkcount == 0 && srccount == 0) {
@ -472,7 +472,7 @@ gst_ladspa_init (GstLADSPA * ladspa)
* it for now */
} else {
g_warning ("%d sink pads, %d src pads not yet supported", sinkcount,
srccount);
srccount);
}
gst_ladspa_instantiate (ladspa);
@ -500,7 +500,7 @@ gst_ladspa_link (GstPad * pad, const GstCaps * caps)
for (l = gst_element_get_pad_list (element); l; l = l->next)
if (pad != (GstPad *) l->data)
if (gst_pad_try_set_caps ((GstPad *) l->data, caps) <= 0)
return GST_PAD_LINK_REFUSED;
return GST_PAD_LINK_REFUSED;
/* we assume that the ladspa plugin can handle any sample rate, so this
check gets put last */
@ -523,7 +523,7 @@ static void
gst_ladspa_force_src_caps (GstLADSPA * ladspa, GstPad * pad)
{
if (!ladspa->buffer_frames) {
ladspa->buffer_frames = 256; /* 5 ms at 44100 kHz (just a default...) */
ladspa->buffer_frames = 256; /* 5 ms at 44100 kHz (just a default...) */
}
DEBUG_OBJ (ladspa, "forcing caps with rate=%d, buffer-frames=%d",
@ -531,12 +531,12 @@ gst_ladspa_force_src_caps (GstLADSPA * ladspa, GstPad * pad)
gst_pad_try_set_caps (pad,
gst_caps_new ("ladspa_src_caps",
"audio/x-raw-float",
gst_props_new ("width", G_TYPE_INT (32),
"endianness", G_TYPE_INT (G_BYTE_ORDER),
"rate", G_TYPE_INT (ladspa->samplerate),
"buffer-frames", G_TYPE_INT (ladspa->buffer_frames),
"channels", G_TYPE_INT (1), NULL)));
"audio/x-raw-float",
gst_props_new ("width", G_TYPE_INT (32),
"endianness", G_TYPE_INT (G_BYTE_ORDER),
"rate", G_TYPE_INT (ladspa->samplerate),
"buffer-frames", G_TYPE_INT (ladspa->buffer_frames),
"channels", G_TYPE_INT (1), NULL)));
}
#endif
@ -629,7 +629,7 @@ gst_ladspa_instantiate (GstLADSPA * ladspa)
/* connect the control ports */
for (i = 0; i < oclass->numcontrols; i++)
desc->connect_port (ladspa->handle,
oclass->control_portnums[i], &(ladspa->controls[i]));
oclass->control_portnums[i], &(ladspa->controls[i]));
/* reactivate if it was activated before the reinstantiation */
if (was_activated)
@ -731,13 +731,13 @@ gst_ladspa_loop (GstElement * element)
/* push it out on all pads */
gst_data_ref_by_count ((GstData *) buffers_in[i], numsrcpads);
for (j = 0; j < numsrcpads; j++)
gst_pad_push (ladspa->srcpads[j], GST_DATA (buffers_in[i]));
gst_pad_push (ladspa->srcpads[j], GST_DATA (buffers_in[i]));
if (GST_EVENT_TYPE (buffers_in[i]) == GST_EVENT_EOS) {
/* shut down */
gst_element_set_eos (element);
return;
/* shut down */
gst_element_set_eos (element);
return;
} else {
goto get_buffer;
goto get_buffer;
}
}
@ -745,8 +745,8 @@ gst_ladspa_loop (GstElement * element)
largest_buffer = GST_BUFFER_SIZE (buffers_in[i]) / sizeof (gfloat);
else
largest_buffer =
MIN (GST_BUFFER_SIZE (buffers_in[i]) / sizeof (gfloat),
largest_buffer);
MIN (GST_BUFFER_SIZE (buffers_in[i]) / sizeof (gfloat),
largest_buffer);
data_in[i] = (LADSPA_Data *) GST_BUFFER_DATA (buffers_in[i]);
GST_BUFFER_TIMESTAMP (buffers_in[i]) = ladspa->timestamp;
}
@ -761,7 +761,7 @@ gst_ladspa_loop (GstElement * element)
}
for (; i < numsrcpads; i++) {
buffers_out[i] =
gst_buffer_new_and_alloc (ladspa->buffer_frames * sizeof (gfloat));
gst_buffer_new_and_alloc (ladspa->buffer_frames * sizeof (gfloat));
GST_BUFFER_TIMESTAMP (buffers_out[i]) = ladspa->timestamp;
data_out[i] = (LADSPA_Data *) GST_BUFFER_DATA (buffers_out[i]);
}
@ -778,10 +778,10 @@ gst_ladspa_loop (GstElement * element)
for (i = 0; i < numsinkpads; i++)
desc->connect_port (ladspa->handle, oclass->sinkpad_portnums[i],
data_in[i]);
data_in[i]);
for (i = 0; i < numsrcpads; i++)
desc->connect_port (ladspa->handle, oclass->srcpad_portnums[i],
data_out[i]);
data_out[i]);
desc->run (ladspa->handle, num_to_process);
@ -874,7 +874,7 @@ gst_ladspa_chain (GstPad * pad, GstData * _data)
desc->connect_port (ladspa->handle, oclass->sinkpad_portnums[0], data_in);
for (i = 0; i < numsrcpads; i++)
desc->connect_port (ladspa->handle, oclass->srcpad_portnums[i],
data_out[i]);
data_out[i]);
desc->run (ladspa->handle, num_to_process);
@ -891,7 +891,7 @@ gst_ladspa_chain (GstPad * pad, GstData * _data)
if (numsrcpads) {
for (i = 0; i < numsrcpads; i++) {
DEBUG_OBJ (ladspa, "pushing buffer (%p, length %u bytes) on src pad %d",
buffers_out[i], GST_BUFFER_SIZE (buffers_out[i]), i);
buffers_out[i], GST_BUFFER_SIZE (buffers_out[i]), i);
gst_pad_push (ladspa->srcpads[i], GST_DATA (buffers_out[i]));
}
@ -979,7 +979,7 @@ ladspa_describe_plugin (const char *pcFullFilename,
/* base-init temp alloc */
g_hash_table_insert (ladspa_descriptors,
GINT_TO_POINTER (0), (gpointer) desc);
GINT_TO_POINTER (0), (gpointer) desc);
/* create the type now */
type = g_type_register_static (GST_TYPE_ELEMENT, type_name, &typeinfo, 0);
@ -988,7 +988,7 @@ ladspa_describe_plugin (const char *pcFullFilename,
/* add this plugin to the hash */
g_hash_table_insert (ladspa_descriptors,
GINT_TO_POINTER (type), (gpointer) desc);
GINT_TO_POINTER (type), (gpointer) desc);
}
g_hash_table_remove (ladspa_descriptors, GINT_TO_POINTER (0));

View file

@ -63,36 +63,36 @@ dlopenLADSPA (const char *pcFilename, int iFlag)
*/
pcLADSPAPath = g_strdup_printf ("%s:/usr/lib/ladspa:/usr/local/lib/ladspa",
getenv ("LADSPA_PATH"));
getenv ("LADSPA_PATH"));
if (pcLADSPAPath) {
pcStart = pcLADSPAPath;
while (*pcStart != '\0') {
pcEnd = pcStart;
while (*pcEnd != ':' && *pcEnd != '\0')
pcEnd++;
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);
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);
pvResult = dlopen (pcBuffer, iFlag);
free (pcBuffer);
if (pvResult != NULL)
return pvResult;
free (pcBuffer);
if (pvResult != NULL)
return pvResult;
pcStart = pcEnd;
if (*pcStart == ':')
pcStart++;
pcStart = pcEnd;
if (*pcStart == ':')
pcStart++;
}
}
}
@ -134,7 +134,7 @@ loadLADSPAPluginLibrary (const char *pcPluginFilename)
pvPluginHandle = dlopenLADSPA (pcPluginFilename, RTLD_NOW);
if (!pvPluginHandle) {
fprintf (stderr,
"Failed to load plugin \"%s\": %s\n", pcPluginFilename, dlerror ());
"Failed to load plugin \"%s\": %s\n", pcPluginFilename, dlerror ());
exit (1);
}
@ -169,10 +169,10 @@ findLADSPAPluginDescriptor (void *pvLADSPAPluginLibrary,
if (pcError) {
fprintf (stderr,
"Unable to find ladspa_descriptor() function in plugin "
"library file \"%s\": %s.\n"
"Are you sure this is a LADSPA plugin file?\n",
pcPluginLibraryFilename, pcError);
"Unable to find ladspa_descriptor() function in plugin "
"library file \"%s\": %s.\n"
"Are you sure this is a LADSPA plugin file?\n",
pcPluginLibraryFilename, pcError);
exit (1);
}
}
@ -181,8 +181,8 @@ findLADSPAPluginDescriptor (void *pvLADSPAPluginLibrary,
psDescriptor = pfDescriptorFunction (lPluginIndex);
if (psDescriptor == NULL) {
fprintf (stderr,
"Unable to find label \"%s\" in plugin library file \"%s\".\n",
pcPluginLabel, pcPluginLibraryFilename);
"Unable to find label \"%s\" in plugin library file \"%s\".\n",
pcPluginLabel, pcPluginLibraryFilename);
exit (1);
}
if (strcmp (psDescriptor->Label, pcPluginLabel) == 0)

View file

@ -61,7 +61,7 @@ static void
}
pcFilename = malloc (lDirLength + strlen (psDirectoryEntry->d_name)
+ 1 + iNeedSlash);
+ 1 + iNeedSlash);
strcpy (pcFilename, pcDirectory);
if (iNeedSlash)
strcat (pcFilename, "/");
@ -73,15 +73,15 @@ static void
dlerror ();
fDescriptorFunction
= (LADSPA_Descriptor_Function) dlsym (pvPluginHandle,
"ladspa_descriptor");
= (LADSPA_Descriptor_Function) dlsym (pvPluginHandle,
"ladspa_descriptor");
if (dlerror () == NULL && fDescriptorFunction) {
/* We've successfully found a ladspa_descriptor function. Pass
it to the callback function. */
fCallbackFunction (pcFilename, pvPluginHandle, fDescriptorFunction);
/* We've successfully found a ladspa_descriptor function. Pass
it to the callback function. */
fCallbackFunction (pcFilename, pvPluginHandle, fDescriptorFunction);
} else {
/* It was a library, but not a LADSPA one. Unload it. */
dlclose (pcFilename);
/* It was a library, but not a LADSPA one. Unload it. */
dlclose (pcFilename);
}
}
free (pcFilename);

View file

@ -106,15 +106,15 @@ static GstStaticPadTemplate gst_colorspace_src_template =
GST_PAD_SRC,
GST_PAD_ALWAYS,
GST_STATIC_CAPS (GST_VIDEO_CAPS_RGB "; "
GST_VIDEO_CAPS_BGR "; "
GST_VIDEO_CAPS_RGBx "; "
GST_VIDEO_CAPS_xRGB "; "
GST_VIDEO_CAPS_BGRx "; "
GST_VIDEO_CAPS_xBGR "; "
GST_VIDEO_CAPS_RGB_16 "; "
GST_VIDEO_CAPS_RGB_15 "; "
GST_VIDEO_CAPS_YUV ("{ I420, YV12, YUY2, YVYU, UYVY, YUV9, YVU9, "
"Y800, Y41P, Y41B, Y42B, IUY2 }")
GST_VIDEO_CAPS_BGR "; "
GST_VIDEO_CAPS_RGBx "; "
GST_VIDEO_CAPS_xRGB "; "
GST_VIDEO_CAPS_BGRx "; "
GST_VIDEO_CAPS_xBGR "; "
GST_VIDEO_CAPS_RGB_16 "; "
GST_VIDEO_CAPS_RGB_15 "; "
GST_VIDEO_CAPS_YUV ("{ I420, YV12, YUY2, YVYU, UYVY, YUV9, YVU9, "
"Y800, Y41P, Y41B, Y42B, IUY2 }")
)
);
@ -123,15 +123,15 @@ static GstStaticPadTemplate gst_colorspace_sink_template =
GST_PAD_SINK,
GST_PAD_ALWAYS,
GST_STATIC_CAPS (GST_VIDEO_CAPS_RGB "; "
GST_VIDEO_CAPS_BGR "; "
GST_VIDEO_CAPS_RGBx "; "
GST_VIDEO_CAPS_xRGB "; "
GST_VIDEO_CAPS_BGRx "; "
GST_VIDEO_CAPS_xBGR "; "
GST_VIDEO_CAPS_RGB_16 "; "
GST_VIDEO_CAPS_RGB_15 "; "
GST_VIDEO_CAPS_YUV ("{ I420, YV12, YUY2, YVYU, UYVY, YUV9, YVU9, "
"Y800, Y41P, Y41B, Y42B, IUY2 }")
GST_VIDEO_CAPS_BGR "; "
GST_VIDEO_CAPS_RGBx "; "
GST_VIDEO_CAPS_xRGB "; "
GST_VIDEO_CAPS_BGRx "; "
GST_VIDEO_CAPS_xBGR "; "
GST_VIDEO_CAPS_RGB_16 "; "
GST_VIDEO_CAPS_RGB_15 "; "
GST_VIDEO_CAPS_YUV ("{ I420, YV12, YUY2, YVYU, UYVY, YUV9, YVU9, "
"Y800, Y41P, Y41B, Y42B, IUY2 }")
)
);
@ -154,16 +154,16 @@ colorspace_find_lcs_format (const GstCaps * caps)
((LCSFormat *) rgb_fmt)->type = LCS_FORMAT_RGB_PACKED;
gst_structure_get_int (structure, "bpp",
&((LCSFormat *) rgb_fmt)->bits_per_pixel);
&((LCSFormat *) rgb_fmt)->bits_per_pixel);
gst_structure_get_int (structure, "red_mask", &mask);
lcs_utils_mask_to_shift (mask, &rgb_fmt->bits_per_component[LCS_R],
&rgb_fmt->component_bit_offset[LCS_R]);
&rgb_fmt->component_bit_offset[LCS_R]);
gst_structure_get_int (structure, "green_mask", &mask);
lcs_utils_mask_to_shift (mask, &rgb_fmt->bits_per_component[LCS_G],
&rgb_fmt->component_bit_offset[LCS_G]);
&rgb_fmt->component_bit_offset[LCS_G]);
gst_structure_get_int (structure, "blue_mask", &mask);
lcs_utils_mask_to_shift (mask, &rgb_fmt->bits_per_component[LCS_B],
&rgb_fmt->component_bit_offset[LCS_B]);
&rgb_fmt->component_bit_offset[LCS_B]);
rgb_fmt->bits_per_component[LCS_A] = 0;
rgb_fmt->component_bit_offset[LCS_A] = 0;
gst_structure_get_int (structure, "endianness", &endianness);
@ -224,7 +224,7 @@ colorspace_setup_converter (GstColorspace * space, const GstCaps * from_caps,
if (space->converter) {
GST_DEBUG ("trying from " GST_FOURCC_FORMAT " to " GST_FOURCC_FORMAT,
GST_FOURCC_ARGS (from_space), GST_FOURCC_ARGS (to_space));
GST_FOURCC_ARGS (from_space), GST_FOURCC_ARGS (to_space));
space->disabled = FALSE;
return TRUE;
}
@ -290,9 +290,9 @@ gst_colorspace_link (GstPad * pad, const GstCaps * caps)
othercaps = gst_caps_copy (gst_pad_get_negotiated_caps (otherpad));
gst_caps_set_simple (othercaps,
"width", G_TYPE_INT, width,
"height", G_TYPE_INT, height,
"framerate", G_TYPE_DOUBLE, framerate, NULL);
"width", G_TYPE_INT, width,
"height", G_TYPE_INT, height,
"framerate", G_TYPE_DOUBLE, framerate, NULL);
ret = gst_pad_try_set_caps (otherpad, othercaps);
if (!GST_PAD_LINK_SUCCESSFUL (ret)) {
@ -329,9 +329,10 @@ gst_colorspace_get_type (void)
0,
(GInstanceInitFunc) gst_colorspace_init,
};
colorspace_type =
g_type_register_static (GST_TYPE_ELEMENT, "GstColorspaceLCS",
&colorspace_info, 0);
g_type_register_static (GST_TYPE_ELEMENT, "GstColorspaceLCS",
&colorspace_info, 0);
}
return colorspace_type;
}
@ -407,13 +408,13 @@ gst_colorspace_chain (GstPad * pad, GstData * _data)
unsigned long size;
lcs_format_buffer_size (lcs_converter_get_dest_format (space->converter),
space->width, space->height, &size);
space->width, space->height, &size);
outbuf = gst_pad_alloc_buffer (space->srcpad, GST_BUFFER_OFFSET_NONE, size);
lcs_convert_auto (space->converter,
GST_BUFFER_DATA (buf),
GST_BUFFER_DATA (outbuf), space->width, space->height);
GST_BUFFER_DATA (buf),
GST_BUFFER_DATA (outbuf), space->width, space->height);
GST_BUFFER_TIMESTAMP (outbuf) = GST_BUFFER_TIMESTAMP (buf);
GST_BUFFER_DURATION (outbuf) = GST_BUFFER_DURATION (buf);

View file

@ -66,23 +66,23 @@ static GstStaticPadTemplate sink_template = GST_STATIC_PAD_TEMPLATE ("sink",
GST_PAD_SINK,
GST_PAD_ALWAYS,
GST_STATIC_CAPS ("video/x-raw-yuv, "
"format = (fourcc) I420, "
"width = (int) [ 16, 4096 ], "
"height = (int) [ 16, 4096 ], "
"framerate = (double) { 23.976024, 24.0, 25.0, 29.970030, 30.0, "
" 50.0, 59.940060, 60.0 }")
"format = (fourcc) I420, "
"width = (int) [ 16, 4096 ], "
"height = (int) [ 16, 4096 ], "
"framerate = (double) { 23.976024, 24.0, 25.0, 29.970030, 30.0, "
" 50.0, 59.940060, 60.0 }")
);
static GstStaticPadTemplate src_template = GST_STATIC_PAD_TEMPLATE ("src",
GST_PAD_SRC,
GST_PAD_ALWAYS,
GST_STATIC_CAPS ("video/mpeg, "
"mpegversion = (int) { 1, 4 }, "
"systemstream = (boolean) FALSE, "
"width = (int) [ 16, 4096 ], "
"height = (int) [ 16, 4096 ], "
"framerate = (double) { 23.976024, 24.0, 25.0, 29.970030, 30.0, "
" 50.0, 59.940060, 60.0 }")
"mpegversion = (int) { 1, 4 }, "
"systemstream = (boolean) FALSE, "
"width = (int) [ 16, 4096 ], "
"height = (int) [ 16, 4096 ], "
"framerate = (double) { 23.976024, 24.0, 25.0, 29.970030, 30.0, "
" 50.0, 59.940060, 60.0 }")
);
#define MAX_FRAME_RATES 9
@ -90,7 +90,8 @@ typedef struct
{
gint num;
gint den;
} frame_rate_entry;
}
frame_rate_entry;
static const frame_rate_entry frame_rates[] = {
{0, 0},
@ -115,12 +116,12 @@ framerate_to_index (gfloat fps)
idx = i;
} else {
gfloat old_diff = fabs ((1. * frame_rates[idx].num /
frame_rates[idx].den) - fps),
new_diff = fabs ((1. * frame_rates[i].num /
frame_rates[i].den) - fps);
frame_rates[idx].den) - fps),
new_diff = fabs ((1. * frame_rates[i].num /
frame_rates[i].den) - fps);
if (new_diff < old_diff) {
idx = i;
idx = i;
}
}
}
@ -161,8 +162,9 @@ gst_fameenc_get_type (void)
0,
(GInstanceInitFunc) gst_fameenc_init,
};
fameenc_type = g_type_register_static (GST_TYPE_ELEMENT,
"GstFameEnc", &fameenc_info, 0);
"GstFameEnc", &fameenc_info, 0);
}
return fameenc_type;
}
@ -214,8 +216,8 @@ gst_fameenc_class_init (GstFameEncClass * klass)
walk = context->type_list;
while (walk) {
props =
g_list_insert_sorted (props, walk,
(GCompareFunc) gst_fameenc_item_compare);
g_list_insert_sorted (props, walk,
(GCompareFunc) gst_fameenc_item_compare);
walk = walk->next;
}
@ -239,21 +241,21 @@ gst_fameenc_class_init (GstFameEncClass * klass)
do {
if (strstr (walk->type, "/")) {
GEnumValue value;
GEnumValue value;
if (current_default == walk->item)
default_index = current_value;
if (current_default == walk->item)
default_index = current_value;
value.value = current_value++;
value.value_name = g_strdup (walk->type);
value.value_nick = g_strdup (walk->item->name);
value.value = current_value++;
value.value_name = g_strdup (walk->type);
value.value_nick = g_strdup (walk->item->name);
g_array_append_val (array, value);
g_array_append_val (array, value);
}
props_walk = g_list_next (props_walk);
if (props_walk)
walk = (fame_list_t *) props_walk->data;
walk = (fame_list_t *) props_walk->data;
} while (props_walk && !strncmp (walk->type, current_type, current_len));
@ -262,43 +264,43 @@ gst_fameenc_class_init (GstFameEncClass * klass)
GParamSpec *pspec;
type =
g_enum_register_static (g_strdup_printf ("GstFameEnc_%s",
current_type), (GEnumValue *) array->data);
g_enum_register_static (g_strdup_printf ("GstFameEnc_%s",
current_type), (GEnumValue *) array->data);
pspec =
g_param_spec_enum (current_type, current_type,
g_strdup_printf ("The FAME \"%s\" object", current_type), type,
default_index, G_PARAM_READWRITE);
g_param_spec_enum (current_type, current_type,
g_strdup_printf ("The FAME \"%s\" object", current_type), type,
default_index, G_PARAM_READWRITE);
g_param_spec_set_qdata (pspec, fame_object_name, (gpointer) current_type);
g_object_class_install_property (G_OBJECT_CLASS (klass), current_prop++,
pspec);
pspec);
}
}
g_object_class_install_property (gobject_class, ARG_BITRATE,
g_param_spec_int ("bitrate", "Bitrate", "Target bitrate (0 = VBR)",
0, 5000000, 0, G_PARAM_READWRITE));
0, 5000000, 0, G_PARAM_READWRITE));
g_object_class_install_property (gobject_class, ARG_QUALITY,
g_param_spec_int ("quality", "Quality",
"Percentage of quality of compression (versus size)", 0, 100, 75,
G_PARAM_READWRITE));
"Percentage of quality of compression (versus size)", 0, 100, 75,
G_PARAM_READWRITE));
g_object_class_install_property (gobject_class, ARG_PATTERN,
g_param_spec_string ("pattern", "Pattern",
"Encoding pattern of I, P, and B frames", "IPPPPPPPPPPP",
G_PARAM_READWRITE));
"Encoding pattern of I, P, and B frames", "IPPPPPPPPPPP",
G_PARAM_READWRITE));
g_object_class_install_property (gobject_class, ARG_FRAMES_PER_SEQUENCE,
g_param_spec_int ("frames_per_sequence", "Frames Per Sequence",
"The number of frames in one sequence", 1, G_MAXINT, 12,
G_PARAM_READWRITE));
"The number of frames in one sequence", 1, G_MAXINT, 12,
G_PARAM_READWRITE));
g_object_class_install_property (gobject_class, ARG_FAME_VERBOSE,
g_param_spec_boolean ("fame_verbose", "Fame Verbose",
"Make FAME produce verbose output", FALSE, G_PARAM_READWRITE));
"Make FAME produce verbose output", FALSE, G_PARAM_READWRITE));
g_object_class_install_property (gobject_class, ARG_BUFFER_SIZE,
g_param_spec_int ("buffer_size", "Buffer Size",
"Set the decoding output buffer size", 0, 1024 * 1024,
FAMEENC_BUFFER_SIZE, G_PARAM_READWRITE));
"Set the decoding output buffer size", 0, 1024 * 1024,
FAMEENC_BUFFER_SIZE, G_PARAM_READWRITE));
}
static GstPadLinkReturn
@ -386,13 +388,13 @@ gst_fameenc_init (GstFameEnc * fameenc)
fameenc->fp.bitrate = 0;
fameenc->fp.quality = 75;
fameenc->fp.frame_rate_num = 25;
fameenc->fp.frame_rate_den = 1; /* avoid floating point exceptions */
fameenc->fp.frame_rate_den = 1; /* avoid floating point exceptions */
fameenc->fp.frames_per_sequence = 12;
fameenc->pattern = g_strdup ("IPPPPPPPPPP");
/* allocate space for the buffer */
fameenc->buffer_size = FAMEENC_BUFFER_SIZE; /* FIXME */
fameenc->buffer_size = FAMEENC_BUFFER_SIZE; /* FIXME */
fameenc->buffer = (unsigned char *) g_malloc (fameenc->buffer_size);
fameenc->next_time = 0;
@ -454,12 +456,12 @@ gst_fameenc_chain (GstPad * pad, GstData * _data)
/* FIXME: safeguard, remove me when a better way is found */
if (length > FAMEENC_BUFFER_SIZE)
g_warning
("FAMEENC_BUFFER_SIZE is defined too low, encoded slice has size %d !\n",
length);
("FAMEENC_BUFFER_SIZE is defined too low, encoded slice has size %d !\n",
length);
if (!fameenc->time_interval) {
fameenc->time_interval =
GST_SECOND * fameenc->fp.frame_rate_den / fameenc->fp.frame_rate_num;
GST_SECOND * fameenc->fp.frame_rate_den / fameenc->fp.frame_rate_num;
}
fameenc->next_time += fameenc->time_interval;
@ -471,7 +473,7 @@ gst_fameenc_chain (GstPad * pad, GstData * _data)
GST_BUFFER_TIMESTAMP (outbuf) = GST_BUFFER_TIMESTAMP (buf);
GST_DEBUG ("gst_fameenc_chain: pushing buffer of size %d",
GST_BUFFER_SIZE (outbuf));
GST_BUFFER_SIZE (outbuf));
gst_pad_push (fameenc->srcpad, GST_DATA (outbuf));
}
@ -492,7 +494,7 @@ gst_fameenc_set_property (GObject * object, guint prop_id,
if (fameenc->initialized) {
GST_DEBUG
("error: fameenc encoder already initialized, cannot set properties !");
("error: fameenc encoder already initialized, cannot set properties !");
return;
}
@ -518,17 +520,17 @@ gst_fameenc_set_property (GObject * object, guint prop_id,
break;
default:
if (prop_id >= ARG_FAME_PROPS_START) {
gchar *name;
gint index = g_value_get_enum (value);
GEnumValue *values;
gchar *name;
gint index = g_value_get_enum (value);
GEnumValue *values;
values = G_ENUM_CLASS (g_type_class_ref (pspec->value_type))->values;
name = (gchar *) g_param_spec_get_qdata (pspec, fame_object_name);
values = G_ENUM_CLASS (g_type_class_ref (pspec->value_type))->values;
name = (gchar *) g_param_spec_get_qdata (pspec, fame_object_name);
fame_register (fameenc->fc, name, fame_get_object (fameenc->fc,
values[index].value_name));
fame_register (fameenc->fc, name, fame_get_object (fameenc->fc,
values[index].value_name));
} else
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
@ -563,23 +565,23 @@ gst_fameenc_get_property (GObject * object, guint prop_id,
break;
default:
if (prop_id >= ARG_FAME_PROPS_START) {
gchar *name;
gint index = 0;
GEnumValue *values;
fame_object_t *f_object;
gchar *name;
gint index = 0;
GEnumValue *values;
fame_object_t *f_object;
values = G_ENUM_CLASS (g_type_class_ref (pspec->value_type))->values;
name = (gchar *) g_param_spec_get_qdata (pspec, fame_object_name);
values = G_ENUM_CLASS (g_type_class_ref (pspec->value_type))->values;
name = (gchar *) g_param_spec_get_qdata (pspec, fame_object_name);
f_object = fame_get_object (fameenc->fc, name);
f_object = fame_get_object (fameenc->fc, name);
while (values[index].value_name) {
if (!strcmp (values[index].value_nick, f_object->name)) {
g_value_set_enum (value, index);
return;
}
index++;
}
while (values[index].value_name) {
if (!strcmp (values[index].value_nick, f_object->name)) {
g_value_set_enum (value, index);
return;
}
index++;
}
}
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;

View file

@ -33,7 +33,8 @@ static void
add_fps (GstCaps * caps)
{
GstStructure *structure = gst_caps_get_structure (caps, 0);
GValue list = { 0 }, fps = {
GValue list = { 0 }, fps =
{
0};
gdouble fpss[] = { 24.0 / 1.001, 24.0, 25.0,
30.0 / 1.001, 30.0, 50.0,
@ -61,10 +62,10 @@ sink_templ (void)
GstCaps *caps;
caps = gst_caps_new_simple ("video/x-raw-yuv",
"format", GST_TYPE_FOURCC,
GST_MAKE_FOURCC ('I', '4', '2', '0'),
"width", GST_TYPE_INT_RANGE, 16, 4096,
"height", GST_TYPE_INT_RANGE, 16, 4096, NULL);
"format", GST_TYPE_FOURCC,
GST_MAKE_FOURCC ('I', '4', '2', '0'),
"width", GST_TYPE_INT_RANGE, 16, 4096,
"height", GST_TYPE_INT_RANGE, 16, 4096, NULL);
add_fps (caps);
templ = gst_pad_template_new ("sink", GST_PAD_SINK, GST_PAD_ALWAYS, caps);
@ -82,10 +83,10 @@ src_templ (void)
GstCaps *caps;
caps = gst_caps_new_simple ("video/mpeg",
"systemstream", G_TYPE_BOOLEAN, FALSE,
"mpegversion", GST_TYPE_INT_RANGE, 1, 2,
"width", GST_TYPE_INT_RANGE, 16, 4096,
"height", GST_TYPE_INT_RANGE, 16, 4096, NULL);
"systemstream", G_TYPE_BOOLEAN, FALSE,
"mpegversion", GST_TYPE_INT_RANGE, 1, 2,
"width", GST_TYPE_INT_RANGE, 16, 4096,
"height", GST_TYPE_INT_RANGE, 16, 4096, NULL);
add_fps (caps);
templ = gst_pad_template_new ("src", GST_PAD_SRC, GST_PAD_ALWAYS, caps);
@ -132,8 +133,8 @@ gst_mpeg2enc_get_type (void)
};
gst_mpeg2enc_type =
g_type_register_static (GST_TYPE_ELEMENT,
"GstMpeg2enc", &gst_mpeg2enc_info, (GTypeFlags) 0);
g_type_register_static (GST_TYPE_ELEMENT,
"GstMpeg2enc", &gst_mpeg2enc_info, (GTypeFlags) 0);
}
return gst_mpeg2enc_type;
@ -147,7 +148,7 @@ gst_mpeg2enc_base_init (GstMpeg2encClass * klass)
"Codec/Video/Encoder",
"High-quality MPEG-1/2 video encoder",
"Andrew Stevens <andrew.stevens@nexgo.de>\n"
"Ronald Bultje <rbultje@ronald.bitfreak.net>"
"Ronald Bultje <rbultje@ronald.bitfreak.net>"
};
GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
@ -199,13 +200,13 @@ gst_mpeg2enc_init (GstMpeg2enc * enc)
enc->sinkpad =
gst_pad_new_from_template (gst_element_class_get_pad_template (klass,
"sink"), "sink");
"sink"), "sink");
gst_pad_set_link_function (enc->sinkpad, gst_mpeg2enc_sink_link);
gst_element_add_pad (element, enc->sinkpad);
enc->srcpad =
gst_pad_new_from_template (gst_element_class_get_pad_template (klass,
"src"), "src");
"src"), "src");
gst_pad_use_explicit_caps (enc->srcpad);
gst_element_add_pad (element, enc->srcpad);
@ -232,13 +233,13 @@ gst_mpeg2enc_loop (GstElement * element)
if (!(caps = GST_PAD_CAPS (enc->sinkpad))) {
GST_ELEMENT_ERROR (element, CORE, NEGOTIATION, (NULL),
("format wasn't negotiated before loop function"));
("format wasn't negotiated before loop function"));
return;
}
/* create new encoder with these settings */
enc->encoder = new GstMpeg2Encoder (enc->options, enc->sinkpad,
caps, enc->srcpad);
caps, enc->srcpad);
/* and set caps on other side */
othercaps = enc->encoder->getFormat ();

View file

@ -96,7 +96,7 @@ gst_mpeg2enc_format_get_type (void)
};
mpeg2enc_format_type =
g_enum_register_static ("GstMpeg2encFormat", mpeg2enc_formats);
g_enum_register_static ("GstMpeg2encFormat", mpeg2enc_formats);
}
return mpeg2enc_format_type;
@ -125,7 +125,7 @@ gst_mpeg2enc_framerate_get_type (void)
};
mpeg2enc_framerate_type =
g_enum_register_static ("GstMpeg2encFramerate", mpeg2enc_framerates);
g_enum_register_static ("GstMpeg2encFramerate", mpeg2enc_framerates);
}
return mpeg2enc_framerate_type;
@ -150,7 +150,7 @@ gst_mpeg2enc_aspect_get_type (void)
};
mpeg2enc_aspect_type =
g_enum_register_static ("GstMpeg2encAspect", mpeg2enc_aspects);
g_enum_register_static ("GstMpeg2encAspect", mpeg2enc_aspects);
}
return mpeg2enc_aspect_type;
@ -174,8 +174,8 @@ gst_mpeg2enc_interlace_mode_get_type (void)
};
mpeg2enc_interlace_mode_type =
g_enum_register_static ("GstMpeg2encInterlaceMode",
mpeg2enc_interlace_modes);
g_enum_register_static ("GstMpeg2encInterlaceMode",
mpeg2enc_interlace_modes);
}
return mpeg2enc_interlace_mode_type;
@ -197,19 +197,19 @@ gst_mpeg2enc_quantisation_matrix_get_type (void)
if (!mpeg2enc_quantisation_matrix_type) {
static const GEnumValue mpeg2enc_quantisation_matrixes[] = {
{GST_MPEG2ENC_QUANTISATION_MATRIX_DEFAULT,
"0", "Default"},
"0", "Default"},
{GST_MPEG2ENC_QUANTISATION_MATRIX_HI_RES,
"1", "High resolution"},
"1", "High resolution"},
{GST_MPEG2ENC_QUANTISATION_MATRIX_KVCD,
"2", "KVCD"},
"2", "KVCD"},
{GST_MPEG2ENC_QUANTISATION_MATRIX_TMPGENC,
"3", "TMPGEnc"},
"3", "TMPGEnc"},
{0, NULL, NULL},
};
mpeg2enc_quantisation_matrix_type =
g_enum_register_static ("GstMpeg2encQuantisationMatrix",
mpeg2enc_quantisation_matrixes);
g_enum_register_static ("GstMpeg2encQuantisationMatrix",
mpeg2enc_quantisation_matrixes);
}
return mpeg2enc_quantisation_matrix_type;
@ -233,7 +233,7 @@ gst_mpeg2enc_video_norm_get_type (void)
};
mpeg2enc_video_norm_type =
g_enum_register_static ("GstMpeg2encVideoNorm", mpeg2enc_video_norms);
g_enum_register_static ("GstMpeg2encVideoNorm", mpeg2enc_video_norms);
}
return mpeg2enc_video_norm_type;
@ -256,8 +256,8 @@ gst_mpeg2enc_playback_field_order_get_type (void)
};
mpeg2enc_playback_field_order_type =
g_enum_register_static ("GstMpeg2encPlaybackFieldOrders",
mpeg2enc_playback_field_orders);
g_enum_register_static ("GstMpeg2encPlaybackFieldOrders",
mpeg2enc_playback_field_orders);
}
return mpeg2enc_playback_field_order_type;
@ -288,160 +288,160 @@ GstMpeg2EncOptions::initProperties (GObjectClass * klass)
/* encoding profile */
g_object_class_install_property (klass, ARG_FORMAT,
g_param_spec_enum ("format", "Format", "Encoding profile format",
GST_TYPE_MPEG2ENC_FORMAT, 0, (GParamFlags) G_PARAM_READWRITE));
GST_TYPE_MPEG2ENC_FORMAT, 0, (GParamFlags) G_PARAM_READWRITE));
/* input/output stream overrides */
g_object_class_install_property (klass, ARG_FRAMERATE,
g_param_spec_enum ("framerate", "Framerate", "Output framerate",
GST_TYPE_MPEG2ENC_FRAMERATE, 0, (GParamFlags) G_PARAM_READWRITE));
GST_TYPE_MPEG2ENC_FRAMERATE, 0, (GParamFlags) G_PARAM_READWRITE));
g_object_class_install_property (klass, ARG_ASPECT,
g_param_spec_enum ("aspect", "Aspect", "Display aspect ratio",
GST_TYPE_MPEG2ENC_ASPECT, 0, (GParamFlags) G_PARAM_READWRITE));
GST_TYPE_MPEG2ENC_ASPECT, 0, (GParamFlags) G_PARAM_READWRITE));
g_object_class_install_property (klass, ARG_INTERLACE_MODE,
g_param_spec_enum ("interlace-mode", "Interlace mode",
"MPEG-2 motion estimation and encoding modes",
GST_TYPE_MPEG2ENC_INTERLACE_MODE, 0,
(GParamFlags) G_PARAM_READWRITE));
"MPEG-2 motion estimation and encoding modes",
GST_TYPE_MPEG2ENC_INTERLACE_MODE, 0,
(GParamFlags) G_PARAM_READWRITE));
/* general encoding stream options */
g_object_class_install_property (klass, ARG_BITRATE,
g_param_spec_int ("bitrate", "Bitrate", "Compressed video bitrate (kbps)",
0, 10 * 1024, 1125, (GParamFlags) G_PARAM_READWRITE));
0, 10 * 1024, 1125, (GParamFlags) G_PARAM_READWRITE));
g_object_class_install_property (klass, ARG_NONVIDEO_BITRATE,
g_param_spec_int ("non-video-bitrate", "Non-video bitrate",
"Assumed bitrate of non-video for sequence splitting (kbps)",
0, 10 * 1024, 0, (GParamFlags) G_PARAM_READWRITE));
"Assumed bitrate of non-video for sequence splitting (kbps)",
0, 10 * 1024, 0, (GParamFlags) G_PARAM_READWRITE));
g_object_class_install_property (klass, ARG_QUANTISATION,
g_param_spec_int ("quantisation", "Quantisation",
"Quantisation factor (0=default, 1=best, 31=worst)",
0, 31, 0, (GParamFlags) G_PARAM_READWRITE));
"Quantisation factor (0=default, 1=best, 31=worst)",
0, 31, 0, (GParamFlags) G_PARAM_READWRITE));
/* stills options */
g_object_class_install_property (klass, ARG_VCD_STILL_SIZE,
g_param_spec_int ("vcd-still-size", "VCD stills size",
"Size of VCD stills (in kB)",
0, 512, 0, (GParamFlags) G_PARAM_READWRITE));
"Size of VCD stills (in kB)",
0, 512, 0, (GParamFlags) G_PARAM_READWRITE));
/* motion estimation options */
g_object_class_install_property (klass, ARG_MOTION_SEARCH_RADIUS,
g_param_spec_int ("motion-search-radius", "Motion search radius",
"Motion compensation search radius",
0, 32, 16, (GParamFlags) G_PARAM_READWRITE));
"Motion compensation search radius",
0, 32, 16, (GParamFlags) G_PARAM_READWRITE));
g_object_class_install_property (klass, ARG_REDUCTION_4_4,
g_param_spec_int ("reduction-4x4", "4x4 reduction",
"Reduction factor for 4x4 subsampled candidate motion estimates"
" (1=max. quality, 4=max. speed)",
1, 4, 2, (GParamFlags) G_PARAM_READWRITE));
"Reduction factor for 4x4 subsampled candidate motion estimates"
" (1=max. quality, 4=max. speed)",
1, 4, 2, (GParamFlags) G_PARAM_READWRITE));
g_object_class_install_property (klass, ARG_REDUCTION_2_2,
g_param_spec_int ("reduction-2x2", "2x2 reduction",
"Reduction factor for 2x2 subsampled candidate motion estimates"
" (1=max. quality, 4=max. speed)",
1, 4, 3, (GParamFlags) G_PARAM_READWRITE));
"Reduction factor for 2x2 subsampled candidate motion estimates"
" (1=max. quality, 4=max. speed)",
1, 4, 3, (GParamFlags) G_PARAM_READWRITE));
g_object_class_install_property (klass, ARG_UNIT_COEFF_ELIM,
g_param_spec_int ("unit-coeff-elim", "Unit coefficience elimination",
"How agressively small-unit picture blocks should be skipped",
-40, 40, 0, (GParamFlags) G_PARAM_READWRITE));
"How agressively small-unit picture blocks should be skipped",
-40, 40, 0, (GParamFlags) G_PARAM_READWRITE));
/* GOP options */
g_object_class_install_property (klass, ARG_MIN_GOP_SIZE,
g_param_spec_int ("min-gop-size", "Min. GOP size",
"Minimal size per Group-of-Pictures (-1=default)",
-1, 250, 0, (GParamFlags) G_PARAM_READWRITE));
"Minimal size per Group-of-Pictures (-1=default)",
-1, 250, 0, (GParamFlags) G_PARAM_READWRITE));
g_object_class_install_property (klass, ARG_MAX_GOP_SIZE,
g_param_spec_int ("max-gop-size", "Max. GOP size",
"Maximal size per Group-of-Pictures (-1=default)",
-1, 250, 0, (GParamFlags) G_PARAM_READWRITE));
"Maximal size per Group-of-Pictures (-1=default)",
-1, 250, 0, (GParamFlags) G_PARAM_READWRITE));
g_object_class_install_property (klass, ARG_CLOSED_GOP,
g_param_spec_boolean ("closed-gop", "Closed GOP",
"All Group-of-Pictures are closed (for multi-angle DVDs)",
FALSE, (GParamFlags) G_PARAM_READWRITE));
"All Group-of-Pictures are closed (for multi-angle DVDs)",
FALSE, (GParamFlags) G_PARAM_READWRITE));
g_object_class_install_property (klass, ARG_FORCE_B_B_P,
g_param_spec_boolean ("force-b-b-p", "Force B-B-P",
"Force two B frames between I/P frames when closing GOP boundaries",
FALSE, (GParamFlags) G_PARAM_READWRITE));
"Force two B frames between I/P frames when closing GOP boundaries",
FALSE, (GParamFlags) G_PARAM_READWRITE));
g_object_class_install_property (klass, ARG_B_PER_REFFRAME,
g_param_spec_int ("b-per-refframe", "B per ref. frame",
"Number of B frames between each I/P frame",
0, 2, 2, (GParamFlags) G_PARAM_READWRITE));
"Number of B frames between each I/P frame",
0, 2, 2, (GParamFlags) G_PARAM_READWRITE));
/* quantisation options */
g_object_class_install_property (klass, ARG_QUANTISATION_REDUCTION,
g_param_spec_float ("quantisation-reduction", "Quantisation reduction",
"Max. quantisation reduction for highly active blocks",
-4., 10., 0., (GParamFlags) G_PARAM_READWRITE));
"Max. quantisation reduction for highly active blocks",
-4., 10., 0., (GParamFlags) G_PARAM_READWRITE));
g_object_class_install_property (klass, ARG_QUANT_REDUCTION_MAX_VAR,
g_param_spec_float ("quant-reduction-max-var",
"Max. quant. reduction variance",
"Maximal luma variance below which quantisation boost is used", 0.,
2500., 0., (GParamFlags) G_PARAM_READWRITE));
"Max. quant. reduction variance",
"Maximal luma variance below which quantisation boost is used", 0.,
2500., 0., (GParamFlags) G_PARAM_READWRITE));
g_object_class_install_property (klass, ARG_INTRA_DC_PRECISION,
g_param_spec_int ("intra-dc-prec", "Intra. DC precision",
"Number of bits precision for DC (base colour) in MPEG-2 blocks", 8,
11, 9, (GParamFlags) G_PARAM_READWRITE));
"Number of bits precision for DC (base colour) in MPEG-2 blocks", 8,
11, 9, (GParamFlags) G_PARAM_READWRITE));
g_object_class_install_property (klass, ARG_REDUCE_HF,
g_param_spec_float ("reduce-hf", "Reduce HF",
"How much to reduce high-frequency resolution (by increasing quantisation)",
0., 2., 0., (GParamFlags) G_PARAM_READWRITE));
"How much to reduce high-frequency resolution (by increasing quantisation)",
0., 2., 0., (GParamFlags) G_PARAM_READWRITE));
g_object_class_install_property (klass, ARG_KEEP_HF,
g_param_spec_boolean ("keep-hf", "Keep HF",
"Maximize high-frequency resolution (for high-quality sources)",
FALSE, (GParamFlags) G_PARAM_READWRITE));
"Maximize high-frequency resolution (for high-quality sources)",
FALSE, (GParamFlags) G_PARAM_READWRITE));
g_object_class_install_property (klass, ARG_QUANTISATION_MATRIX,
g_param_spec_enum ("quant-matrix", "Quant. matrix",
"Quantisation matrix to use for encoding",
GST_TYPE_MPEG2ENC_QUANTISATION_MATRIX, 0,
(GParamFlags) G_PARAM_READWRITE));
"Quantisation matrix to use for encoding",
GST_TYPE_MPEG2ENC_QUANTISATION_MATRIX, 0,
(GParamFlags) G_PARAM_READWRITE));
/* general options */
g_object_class_install_property (klass, ARG_BUFSIZE,
g_param_spec_int ("bufsize", "Decoder buf. size",
"Target decoders video buffer size (kB)",
20, 4000, 46, (GParamFlags) G_PARAM_READWRITE));
"Target decoders video buffer size (kB)",
20, 4000, 46, (GParamFlags) G_PARAM_READWRITE));
/* header flag settings */
g_object_class_install_property (klass, ARG_VIDEO_NORM,
g_param_spec_enum ("norm", "Norm",
"Tag output for specific video norm",
GST_TYPE_MPEG2ENC_VIDEO_NORM, 0, (GParamFlags) G_PARAM_READWRITE));
"Tag output for specific video norm",
GST_TYPE_MPEG2ENC_VIDEO_NORM, 0, (GParamFlags) G_PARAM_READWRITE));
g_object_class_install_property (klass, ARG_SEQUENCE_LENGTH,
g_param_spec_int ("sequence-length", "Sequence length",
"Place a sequence boundary after each <num> MB (0=disable)",
0, 10 * 1024, 0, (GParamFlags) G_PARAM_READWRITE));
"Place a sequence boundary after each <num> MB (0=disable)",
0, 10 * 1024, 0, (GParamFlags) G_PARAM_READWRITE));
g_object_class_install_property (klass, ARG_3_2_PULLDOWN,
g_param_spec_boolean ("pulldown-3-2", "3-2 pull down",
"Generate header flags for 3-2 pull down 24fps movies",
FALSE, (GParamFlags) G_PARAM_READWRITE));
"Generate header flags for 3-2 pull down 24fps movies",
FALSE, (GParamFlags) G_PARAM_READWRITE));
g_object_class_install_property (klass, ARG_SEQUENCE_HEADER_EVERY_GOP,
g_param_spec_boolean ("sequence-header-every-gop",
"Sequence hdr. every GOP",
"Include a sequence header in every GOP",
FALSE, (GParamFlags) G_PARAM_READWRITE));
"Sequence hdr. every GOP",
"Include a sequence header in every GOP",
FALSE, (GParamFlags) G_PARAM_READWRITE));
g_object_class_install_property (klass, ARG_DUMMY_SVCD_SOF,
g_param_spec_boolean ("dummy-svcd-sof", "Dummy SVCD SOF",
"Generate dummy SVCD scan-data (for vcdimager)",
TRUE, (GParamFlags) G_PARAM_READWRITE));
"Generate dummy SVCD scan-data (for vcdimager)",
TRUE, (GParamFlags) G_PARAM_READWRITE));
g_object_class_install_property (klass, ARG_PLAYBACK_FIELD_ORDER,
g_param_spec_enum ("playback-field-order", "Playback field order",
"Force specific playback field order",
GST_TYPE_MPEG2ENC_PLAYBACK_FIELD_ORDER, Y4M_UNKNOWN,
(GParamFlags) G_PARAM_READWRITE));
"Force specific playback field order",
GST_TYPE_MPEG2ENC_PLAYBACK_FIELD_ORDER, Y4M_UNKNOWN,
(GParamFlags) G_PARAM_READWRITE));
g_object_class_install_property (klass, ARG_CORRECT_SVCD_HDS,
g_param_spec_boolean ("correct-svcd-hds", "Correct SVCD hor. size",
"Force SVCD width to 480 instead of 540/720",
FALSE, (GParamFlags) G_PARAM_READWRITE));
"Force SVCD width to 480 instead of 540/720",
FALSE, (GParamFlags) G_PARAM_READWRITE));
g_object_class_install_property (klass, ARG_ALTSCAN_MPEG2,
g_param_spec_boolean ("altscan-mpeg2", "Alt. MPEG-2 scan",
"Alternate MPEG-2 block scanning. Disabling this might "
"make buggy players play SVCD streams",
TRUE, (GParamFlags) G_PARAM_READWRITE));
"Alternate MPEG-2 block scanning. Disabling this might "
"make buggy players play SVCD streams",
TRUE, (GParamFlags) G_PARAM_READWRITE));
#if 0
"--dxr2-hack"
#endif
/* dangerous/experimental stuff */
g_object_class_install_property (klass, ARG_CONSTRAINTS,
g_param_spec_boolean ("constraints", "Constraints",
"Use strict video resolution and bitrate checks",
TRUE, (GParamFlags) G_PARAM_READWRITE));
"Use strict video resolution and bitrate checks",
TRUE, (GParamFlags) G_PARAM_READWRITE));
}
/*
@ -520,18 +520,18 @@ GstMpeg2EncOptions::getProperty (guint prop_id, GValue * value)
break;
case ARG_QUANTISATION_MATRIX:
switch (hf_quant) {
case 0:
g_value_set_enum (value, GST_MPEG2ENC_QUANTISATION_MATRIX_DEFAULT);
break;
case 2:
g_value_set_enum (value, GST_MPEG2ENC_QUANTISATION_MATRIX_HI_RES);
break;
case 3:
g_value_set_enum (value, GST_MPEG2ENC_QUANTISATION_MATRIX_KVCD);
break;
case 4:
g_value_set_enum (value, GST_MPEG2ENC_QUANTISATION_MATRIX_TMPGENC);
break;
case 0:
g_value_set_enum (value, GST_MPEG2ENC_QUANTISATION_MATRIX_DEFAULT);
break;
case 2:
g_value_set_enum (value, GST_MPEG2ENC_QUANTISATION_MATRIX_HI_RES);
break;
case 3:
g_value_set_enum (value, GST_MPEG2ENC_QUANTISATION_MATRIX_KVCD);
break;
case 4:
g_value_set_enum (value, GST_MPEG2ENC_QUANTISATION_MATRIX_TMPGENC);
break;
}
break;
case ARG_BUFSIZE:
@ -636,26 +636,26 @@ GstMpeg2EncOptions::setProperty (guint prop_id, const GValue * value)
case ARG_REDUCE_HF:
hf_q_boost = g_value_get_float (value);
if (hf_quant == 0 && hf_q_boost != 0.)
hf_quant = 1;
hf_quant = 1;
break;
case ARG_KEEP_HF:
hf_quant = g_value_get_boolean (value) ? 2 : 0;
break;
case ARG_QUANTISATION_MATRIX:
switch (g_value_get_enum (value)) {
case GST_MPEG2ENC_QUANTISATION_MATRIX_DEFAULT:
hf_quant = 0;
hf_q_boost = 0;
break;
case GST_MPEG2ENC_QUANTISATION_MATRIX_HI_RES:
hf_quant = 2;
break;
case GST_MPEG2ENC_QUANTISATION_MATRIX_KVCD:
hf_quant = 3;
break;
case GST_MPEG2ENC_QUANTISATION_MATRIX_TMPGENC:
hf_quant = 4;
break;
case GST_MPEG2ENC_QUANTISATION_MATRIX_DEFAULT:
hf_quant = 0;
hf_q_boost = 0;
break;
case GST_MPEG2ENC_QUANTISATION_MATRIX_HI_RES:
hf_quant = 2;
break;
case GST_MPEG2ENC_QUANTISATION_MATRIX_KVCD:
hf_quant = 3;
break;
case GST_MPEG2ENC_QUANTISATION_MATRIX_TMPGENC:
hf_quant = 4;
break;
}
break;
case ARG_BUFSIZE:

View file

@ -85,7 +85,9 @@ bool GstMpeg2EncPictureReader::LoadFrame ()
GstData *
data;
GstBuffer *
buf = NULL;
buf =
NULL;
gint
i,
x,
@ -93,10 +95,15 @@ bool GstMpeg2EncPictureReader::LoadFrame ()
n;
guint8 *
frame;
GstFormat
fmt = GST_FORMAT_DEFAULT;
fmt =
GST_FORMAT_DEFAULT;
gint64
pos = 0, tot = 0;
pos =
0,
tot =
0;
gst_pad_query (GST_PAD_PEER (pad), GST_QUERY_POSITION, &fmt, &pos);
gst_pad_query (GST_PAD_PEER (pad), GST_QUERY_TOTAL, &fmt, &tot);
@ -106,16 +113,16 @@ bool GstMpeg2EncPictureReader::LoadFrame ()
gst_pad_set_element_private (pad, NULL);
} else if (!(data = gst_pad_pull (pad))) {
GST_ELEMENT_ERROR (gst_pad_get_parent (pad), RESOURCE, READ,
(NULL), (NULL));
(NULL), (NULL));
return true;
}
if (GST_IS_EVENT (data)) {
if (GST_EVENT_TYPE (data) == GST_EVENT_EOS) {
gst_event_unref (GST_EVENT (data));
return true;
gst_event_unref (GST_EVENT (data));
return true;
} else {
gst_pad_event_default (pad, GST_EVENT (data));
gst_pad_event_default (pad, GST_EVENT (data));
}
} else {
buf = GST_BUFFER (data);

View file

@ -39,7 +39,7 @@ GST_STATIC_PAD_TEMPLATE ("video_%d",
GST_PAD_SINK,
GST_PAD_REQUEST,
GST_STATIC_CAPS ("video/mpeg, "
"mpegversion = (int) [ 1, 2 ], " "systemstream = (boolean) false")
"mpegversion = (int) [ 1, 2 ], " "systemstream = (boolean) false")
);
static GstStaticPadTemplate audio_sink_templ =
@ -47,16 +47,16 @@ static GstStaticPadTemplate audio_sink_templ =
GST_PAD_SINK,
GST_PAD_REQUEST,
GST_STATIC_CAPS ("audio/mpeg, "
"mpegversion = (int) 1, "
"layer = (int) [ 1, 2 ]; "
"audio/x-ac3; "
"audio/x-dts; "
"audio/x-raw-int, "
"endianness = (int) BYTE_ORDER, "
"signed = (boolean) TRUE, "
"width = (int) { 16, 20, 24 }, "
"depth = (int) { 16, 20, 24 }, "
"rate = (int) { 48000, 96000 }, " "channels = (int) [ 1, 6 ]")
"mpegversion = (int) 1, "
"layer = (int) [ 1, 2 ]; "
"audio/x-ac3; "
"audio/x-dts; "
"audio/x-raw-int, "
"endianness = (int) BYTE_ORDER, "
"signed = (boolean) TRUE, "
"width = (int) { 16, 20, 24 }, "
"depth = (int) { 16, 20, 24 }, "
"rate = (int) { 48000, 96000 }, " "channels = (int) [ 1, 6 ]")
);
/* FIXME: subtitles */
@ -99,8 +99,8 @@ gst_mplex_get_type (void)
};
gst_mplex_type =
g_type_register_static (GST_TYPE_ELEMENT,
"GstMplex", &gst_mplex_info, (GTypeFlags) 0);
g_type_register_static (GST_TYPE_ELEMENT,
"GstMplex", &gst_mplex_info, (GTypeFlags) 0);
}
return gst_mplex_type;
@ -114,7 +114,7 @@ gst_mplex_base_init (GstMplexClass * klass)
"Codec/Muxer",
"High-quality MPEG/DVD/SVCD/VCD video/audio multiplexer",
"Andrew Stevens <andrew.stevens@nexgo.de>\n"
"Ronald Bultje <rbultje@ronald.bitfreak.net>"
"Ronald Bultje <rbultje@ronald.bitfreak.net>"
};
GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
@ -191,7 +191,7 @@ gst_mplex_loop (GstElement * element)
const GList *item;
for (item = gst_element_get_pad_list (element);
item != NULL; item = item->next) {
item != NULL; item = item->next) {
StreamKind type;
GstMplexIBitStream *inputstream;
JobStream *jobstream;
@ -202,16 +202,16 @@ gst_mplex_loop (GstElement * element)
/* skip our source pad */
if (GST_PAD_DIRECTION (pad) == GST_PAD_SRC)
continue;
continue;
/* create inputstream, assure we've got caps */
inputstream = new GstMplexIBitStream (pad);
/* skip unnegotiated pads */
if (!(caps = GST_PAD_CAPS (pad))) {
delete inputstream;
delete inputstream;
continue;
continue;
}
/* get format */
@ -219,41 +219,41 @@ gst_mplex_loop (GstElement * element)
mime = gst_structure_get_name (structure);
if (!strcmp (mime, "video/mpeg")) {
VideoParams *params;
VideoParams *params;
type = MPEG_VIDEO;
type = MPEG_VIDEO;
params = VideoParams::Default (mplex->job->mux_format);
mplex->job->video_param.push_back (params);
mplex->job->video_tracks++;
params = VideoParams::Default (mplex->job->mux_format);
mplex->job->video_param.push_back (params);
mplex->job->video_tracks++;
} else if (!strcmp (mime, "audio/mpeg")) {
type = MPEG_AUDIO;
mplex->job->audio_tracks++;
type = MPEG_AUDIO;
mplex->job->audio_tracks++;
} else if (!strcmp (mime, "audio/x-ac3")) {
type = AC3_AUDIO;
mplex->job->audio_tracks++;
type = AC3_AUDIO;
mplex->job->audio_tracks++;
} else if (!strcmp (mime, "audio/x-dts")) {
type = DTS_AUDIO;
mplex->job->audio_tracks++;
type = DTS_AUDIO;
mplex->job->audio_tracks++;
} else if (!strcmp (mime, "audio/x-raw-int")) {
LpcmParams *params;
gint bits, chans, rate;
LpcmParams *params;
gint bits, chans, rate;
type = LPCM_AUDIO;
type = LPCM_AUDIO;
/* set LPCM params */
gst_structure_get_int (structure, "depth", &bits);
gst_structure_get_int (structure, "rate", &rate);
gst_structure_get_int (structure, "channels", &chans);
params = LpcmParams::Checked (rate, chans, bits);
/* set LPCM params */
gst_structure_get_int (structure, "depth", &bits);
gst_structure_get_int (structure, "rate", &rate);
gst_structure_get_int (structure, "channels", &chans);
params = LpcmParams::Checked (rate, chans, bits);
mplex->job->lpcm_param.push_back (params);
mplex->job->audio_tracks++;
mplex->job->lpcm_tracks++;
mplex->job->lpcm_param.push_back (params);
mplex->job->audio_tracks++;
mplex->job->lpcm_tracks++;
} else {
delete inputstream;
delete inputstream;
continue;
continue;
}
jobstream = new JobStream (inputstream, type);
@ -262,7 +262,7 @@ gst_mplex_loop (GstElement * element)
if (!mplex->job->video_tracks && !mplex->job->audio_tracks) {
GST_ELEMENT_ERROR (element, CORE, NEGOTIATION, (NULL),
("no input video or audio tracks set up before loop function"));
("no input video or audio tracks set up before loop function"));
return;
}

View file

@ -53,7 +53,7 @@ IBitStream ()
if (!ReadIntoBuffer () && buffered == 0) {
GST_ELEMENT_ERROR (gst_pad_get_parent (_pad), RESOURCE, READ, (NULL),
("Failed to read from input pad %s", gst_pad_get_name (pad)));
("Failed to read from input pad %s", gst_pad_get_name (pad)));
}
}
@ -70,6 +70,7 @@ size_t GstMplexIBitStream::ReadStreamBytes (uint8_t * buf, size_t size)
{
guint8 *
data;
guint
read;
@ -78,18 +79,19 @@ size_t GstMplexIBitStream::ReadStreamBytes (uint8_t * buf, size_t size)
if ((read = gst_bytestream_peek_bytes (bs, &data, size)) != size) {
GstEvent *
event;
event;
guint
pending;
pending;
gst_bytestream_get_status (bs, &pending, &event);
if (event) {
switch (GST_EVENT_TYPE (event)) {
case GST_EVENT_EOS:
eos = TRUE;
break;
default:
break;
case GST_EVENT_EOS:
eos = TRUE;
break;
default:
break;
}
gst_event_unref (event);
}

View file

@ -68,7 +68,7 @@ gst_mplex_format_get_type (void)
};
mplex_format_type =
g_enum_register_static ("GstMplexFormat", mplex_formats);
g_enum_register_static ("GstMplexFormat", mplex_formats);
}
return mplex_format_type;
@ -94,52 +94,53 @@ GstMplexJob::initProperties (GObjectClass * klass)
/* encoding profile */
g_object_class_install_property (klass, ARG_FORMAT,
g_param_spec_enum ("format", "Format", "Encoding profile format",
GST_TYPE_MPLEX_FORMAT, 0, (GParamFlags) G_PARAM_READWRITE));
GST_TYPE_MPLEX_FORMAT, 0, (GParamFlags) G_PARAM_READWRITE));
/* total stream datarate. Normally, this shouldn't be needed, but
* some DVD/VCD/SVCD players really need strict values to handle
* the created files correctly. */
g_object_class_install_property (klass, ARG_MUX_BITRATE,
g_param_spec_int ("mux-bitrate", "Mux. bitrate",
"Bitrate of output stream in kbps (0 = autodetect)",
0, 15 * 1024, 0, (GParamFlags) G_PARAM_READWRITE));
"Bitrate of output stream in kbps (0 = autodetect)",
0, 15 * 1024, 0, (GParamFlags) G_PARAM_READWRITE));
#if 0
{
"video-buffer", 1, 0, 'b'},
"video-buffer", 1, 0, 'b'}
,
#endif
/* some boolean stuff for headers */
g_object_class_install_property (klass, ARG_VBR,
g_param_spec_boolean ("vbr", "VBR",
"Whether the input video stream is variable bitrate",
FALSE, (GParamFlags) G_PARAM_READWRITE));
"Whether the input video stream is variable bitrate",
FALSE, (GParamFlags) G_PARAM_READWRITE));
g_object_class_install_property (klass, ARG_SYSTEM_HEADERS,
g_param_spec_boolean ("system-headers", "System headers",
"Create system header in every pack for generic formats",
FALSE, (GParamFlags) G_PARAM_READWRITE));
"Create system header in every pack for generic formats",
FALSE, (GParamFlags) G_PARAM_READWRITE));
g_object_class_install_property (klass, ARG_SPLIT_SEQUENCE,
g_param_spec_boolean ("split-sequence", "Split sequence",
"Simply split a sequence across files "
"(rather than building run-out/run-in)",
FALSE, (GParamFlags) G_PARAM_READWRITE));
"Simply split a sequence across files "
"(rather than building run-out/run-in)",
FALSE, (GParamFlags) G_PARAM_READWRITE));
/* size of a segment (followed by EOS) */
g_object_class_install_property (klass, ARG_SEGMENT_SIZE,
g_param_spec_int ("max-segment-size", "Max. segment size",
"Max. size per segment/file in MB (0 = unlimited)",
0, 10 * 1024, 0, (GParamFlags) G_PARAM_READWRITE));
"Max. size per segment/file in MB (0 = unlimited)",
0, 10 * 1024, 0, (GParamFlags) G_PARAM_READWRITE));
/* packets per pack (generic formats) */
g_object_class_install_property (klass, ARG_PACKETS_PER_PACK,
g_param_spec_int ("packets-per-pack", "Packets per pack",
"Number of packets per pack for generic formats",
1, 100, 1, (GParamFlags) G_PARAM_READWRITE));
"Number of packets per pack for generic formats",
1, 100, 1, (GParamFlags) G_PARAM_READWRITE));
/* size of one sector */
g_object_class_install_property (klass, ARG_SECTOR_SIZE,
g_param_spec_int ("sector-size", "Sector size",
"Specify sector size in bytes for generic formats",
256, 16384, 2048, (GParamFlags) G_PARAM_READWRITE));
"Specify sector size in bytes for generic formats",
256, 16384, 2048, (GParamFlags) G_PARAM_READWRITE));
}
/*

View file

@ -46,11 +46,11 @@ GstStaticPadTemplate src_template = GST_STATIC_PAD_TEMPLATE ("src",
GST_PAD_SRC,
GST_PAD_ALWAYS,
GST_STATIC_CAPS ("audio/x-raw-int, "
"endianness = (int) BYTE_ORDER, "
"signed = (bool) TRUE, "
"width = (int) { 8, 16 }, "
"depth = (int) { 8, 16 }, "
"rate = (int) [ 8000, 96000 ], " "channels = (int) [ 1, 2 ]")
"endianness = (int) BYTE_ORDER, "
"signed = (bool) TRUE, "
"width = (int) { 8, 16 }, "
"depth = (int) { 8, 16 }, "
"rate = (int) [ 8000, 96000 ], " "channels = (int) [ 1, 2 ]")
);
@ -58,11 +58,11 @@ GstStaticPadTemplate sink_template = GST_STATIC_PAD_TEMPLATE ("sink",
GST_PAD_SINK,
GST_PAD_ALWAYS,
GST_STATIC_CAPS ("audio/x-raw-int, "
"endianness = (int) BYTE_ORDER, "
"signed = (bool) TRUE, "
"width = (int) { 8, 16 }, "
"depth = (int) { 8, 16 }, "
"rate = (int) [ 8000, 96000 ], " "channels = (int) [ 1, 2 ]")
"endianness = (int) BYTE_ORDER, "
"signed = (bool) TRUE, "
"width = (int) { 8, 16 }, "
"depth = (int) { 8, 16 }, "
"rate = (int) [ 8000, 96000 ], " "channels = (int) [ 1, 2 ]")
);
@ -102,8 +102,9 @@ gst_musicbrainz_get_type (void)
0,
(GInstanceInitFunc) gst_musicbrainz_init,
};
musicbrainz_type = g_type_register_static (GST_TYPE_ELEMENT,
"GstMusicBrainz", &musicbrainz_info, 0);
"GstMusicBrainz", &musicbrainz_info, 0);
}
return musicbrainz_type;
}
@ -143,10 +144,10 @@ gst_musicbrainz_class_init (GstMusicBrainzClass * klass)
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_SIGNATURE,
g_param_spec_string ("signature", "signature", "signature",
NULL, G_PARAM_READABLE));
NULL, G_PARAM_READABLE));
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_ASCII_SIGNATURE,
g_param_spec_string ("ascii_signature", "ascii_signature",
"ascii_signature", NULL, G_PARAM_READABLE));
"ascii_signature", NULL, G_PARAM_READABLE));
gobject_class->set_property = gst_musicbrainz_set_property;
gobject_class->get_property = gst_musicbrainz_get_property;
@ -154,7 +155,7 @@ gst_musicbrainz_class_init (GstMusicBrainzClass * klass)
gst_musicbrainz_signals[SIGNAL_SIGNATURE_AVAILABLE] =
g_signal_new ("signature-available", G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (GstMusicBrainzClass,
signature_available), NULL, NULL, g_cclosure_marshal_VOID__VOID,
signature_available), NULL, NULL, g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE, 0);
gstelement_class->change_state = gst_musicbrainz_change_state;
@ -251,7 +252,7 @@ gst_musicbrainz_chain (GstPad * pad, GstData * data)
if (musicbrainz->linked && !musicbrainz->data_available)
if (gst_pad_query (gst_pad_get_peer (pad), GST_QUERY_TOTAL, &format,
&nanos)) {
&nanos)) {
musicbrainz->total_time = nanos / GST_SECOND;
trm_SetSongLength (musicbrainz->trm, musicbrainz->total_time);
musicbrainz->data_available = TRUE;
@ -261,16 +262,16 @@ gst_musicbrainz_chain (GstPad * pad, GstData * data)
if (!musicbrainz->signature_available
&& trm_GenerateSignature (musicbrainz->trm, GST_BUFFER_DATA (buf),
GST_BUFFER_SIZE (buf))) {
GST_BUFFER_SIZE (buf))) {
GST_DEBUG ("Signature");
trm_FinalizeSignature (musicbrainz->trm, musicbrainz->signature, NULL);
trm_ConvertSigToASCII (musicbrainz->trm, musicbrainz->signature,
musicbrainz->ascii_signature);
musicbrainz->ascii_signature);
g_print ("Signature : %s\n", musicbrainz->ascii_signature);
musicbrainz->signature_available = TRUE;
g_signal_emit (G_OBJECT (musicbrainz),
gst_musicbrainz_signals[SIGNAL_SIGNATURE_AVAILABLE], 0);
gst_musicbrainz_signals[SIGNAL_SIGNATURE_AVAILABLE], 0);
GST_DEBUG ("Signature : %s", musicbrainz->ascii_signature);

View file

@ -51,17 +51,17 @@ static GstStaticPadTemplate sink_factory = GST_STATIC_PAD_TEMPLATE ("sink",
GST_PAD_SINK,
GST_PAD_ALWAYS,
GST_STATIC_CAPS ("audio/x-raw-int, "
"endianess = (int) BYTE_ORDER, "
"signed = (boolean) TRUE, "
"width = (int) 16, "
"depth = (int) 16, "
"rate = (int) [ 1000, 96000 ], "
"channels = (int) [ 1, 2 ]; "
"audio/x-raw-int, "
"signed = (boolean) FALSE, "
"width = (int) 8, "
"depth = (int) 8, "
"rate = (int) [ 1000, 96000 ], " "channels = (int) [ 1, 2 ]")
"endianess = (int) BYTE_ORDER, "
"signed = (boolean) TRUE, "
"width = (int) 16, "
"depth = (int) 16, "
"rate = (int) [ 1000, 96000 ], "
"channels = (int) [ 1, 2 ]; "
"audio/x-raw-int, "
"signed = (boolean) FALSE, "
"width = (int) 8, "
"depth = (int) 8, "
"rate = (int) [ 1000, 96000 ], " "channels = (int) [ 1, 2 ]")
);
static void gst_nassink_base_init (gpointer g_class);
@ -111,9 +111,10 @@ gst_nassink_get_type (void)
0,
(GInstanceInitFunc) gst_nassink_init,
};
nassink_type =
g_type_register_static (GST_TYPE_ELEMENT, "GstNassink", &nassink_info,
0);
g_type_register_static (GST_TYPE_ELEMENT, "GstNassink", &nassink_info,
0);
}
return nassink_type;
@ -127,7 +128,7 @@ gst_nassink_base_init (gpointer g_class)
"Sink/Audio",
"Plays audio to a Network Audio Server",
"Laurent Vivier <Laurent.Vivier@bull.net>, "
"Arwed v. Merkatz <v.merkatz@gmx.net>"
"Arwed v. Merkatz <v.merkatz@gmx.net>"
};
GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
@ -152,8 +153,8 @@ gst_nassink_class_init (GstNassinkClass * klass)
gobject_class->set_property = gst_nassink_set_property;
gobject_class->get_property = gst_nassink_get_property;
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_MUTE, g_param_spec_boolean ("mute", "mute", "mute", TRUE, G_PARAM_READWRITE)); /* CHECKME */
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_HOST, g_param_spec_string ("host", "host", "host", NULL, G_PARAM_READWRITE)); /* CHECKME */
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_MUTE, g_param_spec_boolean ("mute", "mute", "mute", TRUE, G_PARAM_READWRITE)); /* CHECKME */
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_HOST, g_param_spec_string ("host", "host", "host", NULL, G_PARAM_READWRITE)); /* CHECKME */
gstelement_class->change_state = gst_nassink_change_state;
}
@ -203,7 +204,7 @@ gst_nassink_getcaps (GstPad * pad)
GstStructure *structure = gst_caps_get_structure (templatecaps, i);
gst_structure_set (structure, "rate", GST_TYPE_INT_RANGE,
AuServerMinSampleRate (server), AuServerMaxSampleRate (server), NULL);
AuServerMinSampleRate (server), AuServerMaxSampleRate (server), NULL);
}
caps = gst_caps_intersect (templatecaps, gst_pad_get_pad_template_caps (pad));
gst_caps_free (templatecaps);
@ -291,28 +292,28 @@ gst_nassink_chain (GstPad * pad, GstData * _data)
remaining = GST_BUFFER_SIZE (buf);
while ((nassink->flow != AuNone) && (remaining > 0)) {
/* number of bytes we can copy to buffer */
/* number of bytes we can copy to buffer */
available = remaining > nassink->size - nassink->pos ?
nassink->size - nassink->pos : remaining;
available = remaining > nassink->size - nassink->pos ?
nassink->size - nassink->pos : remaining;
/* fill the buffer */
/* fill the buffer */
memcpy (nassink->buf + nassink->pos, GST_BUFFER_DATA (buf) + pos,
available);
memcpy (nassink->buf + nassink->pos, GST_BUFFER_DATA (buf) + pos,
available);
nassink->pos += available;
pos += available;
nassink->pos += available;
pos += available;
remaining -= available;
remaining -= available;
/* if we have more bytes, need to flush the buffer */
/* if we have more bytes, need to flush the buffer */
if (remaining > 0) {
while ((nassink->flow != AuNone) && (nassink->pos == nassink->size)) {
NAS_flush (nassink);
}
}
if (remaining > 0) {
while ((nassink->flow != AuNone) && (nassink->pos == nassink->size)) {
NAS_flush (nassink);
}
}
}
/* give some time to event handler */
@ -340,11 +341,11 @@ gst_nassink_set_property (GObject * object, guint prop_id, const GValue * value,
break;
case ARG_HOST:
if (nassink->host != NULL)
g_free (nassink->host);
g_free (nassink->host);
if (g_value_get_string (value) == NULL)
nassink->host = NULL;
nassink->host = NULL;
else
nassink->host = g_strdup (g_value_get_string (value));
nassink->host = g_strdup (g_value_get_string (value));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
@ -379,7 +380,7 @@ static gboolean
plugin_init (GstPlugin * plugin)
{
if (!gst_element_register (plugin, "nassink", GST_RANK_NONE,
GST_TYPE_NASSINK)) {
GST_TYPE_NASSINK)) {
return FALSE;
}
@ -460,17 +461,17 @@ gst_nassink_change_state (GstElement * element)
switch (GST_STATE_PENDING (element)) {
case GST_STATE_NULL:
if (GST_FLAG_IS_SET (element, GST_NASSINK_OPEN))
gst_nassink_close_audio (nassink);
gst_nassink_close_audio (nassink);
break;
case GST_STATE_READY:
if (!GST_FLAG_IS_SET (element, GST_NASSINK_OPEN))
gst_nassink_open_audio (nassink);
gst_nassink_open_audio (nassink);
break;
case GST_STATE_PAUSED:
while (nassink->pos && nassink->buf)
NAS_flush (nassink);
NAS_flush (nassink);
break;
case GST_STATE_PLAYING:
@ -498,7 +499,7 @@ NAS_sendData (GstNassink * sink, AuUint32 numBytes)
if (numBytes < (sink->pos)) {
AuWriteElement (sink->audio, sink->flow, 0,
numBytes, sink->buf, AuFalse, NULL);
numBytes, sink->buf, AuFalse, NULL);
memmove (sink->buf, sink->buf + numBytes, sink->pos - numBytes);
@ -506,7 +507,7 @@ NAS_sendData (GstNassink * sink, AuUint32 numBytes)
} else {
AuWriteElement (sink->audio, sink->flow, 0,
sink->pos, sink->buf, (numBytes > sink->pos), NULL);
sink->pos, sink->buf, (numBytes > sink->pos), NULL);
sink->pos = 0;
}
}
@ -525,49 +526,49 @@ NAS_EventHandler (AuServer * aud, AuEvent * ev, AuEventHandlerRec * handler)
switch (notify->kind) {
case AuElementNotifyKindLowWater:
NAS_sendData (sink, notify->num_bytes);
break;
case AuElementNotifyKindLowWater:
NAS_sendData (sink, notify->num_bytes);
break;
case AuElementNotifyKindState:
case AuElementNotifyKindState:
switch (notify->cur_state) {
switch (notify->cur_state) {
case AuStateStop:
case AuStateStop:
if (sink->flow != AuNone) {
if (notify->reason == AuReasonEOF)
AuStopFlow (handler->aud, sink->flow, NULL);
AuReleaseScratchFlow (handler->aud, sink->flow, NULL);
sink->flow = AuNone;
}
AuUnregisterEventHandler (handler->aud, handler);
break;
if (sink->flow != AuNone) {
if (notify->reason == AuReasonEOF)
AuStopFlow (handler->aud, sink->flow, NULL);
AuReleaseScratchFlow (handler->aud, sink->flow, NULL);
sink->flow = AuNone;
}
AuUnregisterEventHandler (handler->aud, handler);
break;
case AuStatePause:
case AuStatePause:
switch (notify->reason) {
case AuReasonUnderrun:
case AuReasonOverrun:
case AuReasonEOF:
case AuReasonWatermark:
switch (notify->reason) {
case AuReasonUnderrun:
case AuReasonOverrun:
case AuReasonEOF:
case AuReasonWatermark:
NAS_sendData (sink, notify->num_bytes);
NAS_sendData (sink, notify->num_bytes);
break;
break;
case AuReasonHardware:
case AuReasonHardware:
if (AuSoundRestartHardwarePauses)
AuStartFlow (handler->aud, sink->flow, NULL);
else
AuStopFlow (handler->aud, sink->flow, NULL);
if (AuSoundRestartHardwarePauses)
AuStartFlow (handler->aud, sink->flow, NULL);
else
AuStopFlow (handler->aud, sink->flow, NULL);
break;
}
break;
}
break;
break;
}
break;
}
break;
}
break;
}
@ -582,8 +583,8 @@ NAS_getDevice (AuServer * aud, int numTracks)
for (i = 0; i < AuServerNumDevices (aud); i++) {
if ((AuDeviceKind (AuServerDevice (aud, i))
== AuComponentKindPhysicalOutput) &&
(AuDeviceNumTracks (AuServerDevice (aud, i)) == numTracks)) {
== AuComponentKindPhysicalOutput) &&
(AuDeviceNumTracks (AuServerDevice (aud, i)) == numTracks)) {
return AuDeviceIdentifier (AuServerDevice (aud, i));
@ -631,18 +632,18 @@ NAS_createFlow (GstNassink * sink, unsigned char format, unsigned short rate,
AuElement *oldelems;
oldelems =
AuGetElements (sink->audio, sink->flow, &clocked, &num_elements,
&status);
AuGetElements (sink->audio, sink->flow, &clocked, &num_elements,
&status);
if (num_elements > 0) {
GST_CAT_DEBUG (NAS, "GetElements status: %i", status);
if (oldelems)
AuFreeElements (sink->audio, num_elements, oldelems);
AuFreeElements (sink->audio, num_elements, oldelems);
gst_nassink_close_audio (sink);
gst_nassink_open_audio (sink);
sink->flow = AuGetScratchFlow (sink->audio, NULL);
if (sink->flow == 0) {
GST_CAT_DEBUG (NAS, "couldn't get flow");
return -1;
GST_CAT_DEBUG (NAS, "couldn't get flow");
return -1;
}
}
}
@ -655,18 +656,18 @@ NAS_createFlow (GstNassink * sink, unsigned char format, unsigned short rate,
AuElement *oldelems;
oldelems =
AuGetElements (sink->audio, sink->flow, &clocked, &num_elements,
&status);
AuGetElements (sink->audio, sink->flow, &clocked, &num_elements,
&status);
if (num_elements > 0) {
GST_CAT_DEBUG (NAS, "GetElements status: %i", status);
if (oldelems)
AuFreeElements (sink->audio, num_elements, oldelems);
AuFreeElements (sink->audio, num_elements, oldelems);
gst_nassink_close_audio (sink);
gst_nassink_open_audio (sink);
sink->flow = AuGetScratchFlow (sink->audio, NULL);
if (sink->flow == 0) {
GST_CAT_DEBUG (NAS, "couldn't get flow");
return -1;
GST_CAT_DEBUG (NAS, "couldn't get flow");
return -1;
}
}
}
@ -674,38 +675,38 @@ NAS_createFlow (GstNassink * sink, unsigned char format, unsigned short rate,
buf_samples = rate * NAS_SOUND_PORT_DURATION;
AuMakeElementImportClient (&elements[0], /* element */
rate, /* rate */
format, /* format */
numTracks, /* number of tracks */
AuTrue, /* discart */
buf_samples, /* max samples */
AuMakeElementImportClient (&elements[0], /* element */
rate, /* rate */
format, /* format */
numTracks, /* number of tracks */
AuTrue, /* discart */
buf_samples, /* max samples */
(AuUint32) (buf_samples / 100 * AuSoundPortLowWaterMark),
/* low water mark */
0, /* num actions */
0, /* num actions */
NULL);
AuMakeElementExportDevice (&elements[1], /* element */
0, /* input */
sink->device, /* device */
rate, /* rate */
AuUnlimitedSamples, /* num samples */
0, /* num actions */
NULL); /* actions */
AuMakeElementExportDevice (&elements[1], /* element */
0, /* input */
sink->device, /* device */
rate, /* rate */
AuUnlimitedSamples, /* num samples */
0, /* num actions */
NULL); /* actions */
AuSetElements (sink->audio, /* server */
sink->flow, /* flow ID */
AuTrue, /* clocked */
2, /* num elements */
elements, /* elements */
AuSetElements (sink->audio, /* server */
sink->flow, /* flow ID */
AuTrue, /* clocked */
2, /* num elements */
elements, /* elements */
NULL);
AuRegisterEventHandler (sink->audio, /* server */
AuEventHandlerIDMask, /* value mask */
0, /* type */
sink->flow, /* flow ID */
NAS_EventHandler, /* callback */
(AuPointer) sink); /* data */
AuRegisterEventHandler (sink->audio, /* server */
AuEventHandlerIDMask, /* value mask */
0, /* type */
sink->flow, /* flow ID */
NAS_EventHandler, /* callback */
(AuPointer) sink); /* data */
sink->size = buf_samples * numTracks * AuSizeofFormat (format);

View file

@ -108,11 +108,11 @@ gst_sdlvideosink_get_type (void)
};
sdlvideosink_type = g_type_register_static (GST_TYPE_VIDEOSINK,
"GstSDLVideoSink", &sdlvideosink_info, 0);
"GstSDLVideoSink", &sdlvideosink_info, 0);
g_type_add_interface_static (sdlvideosink_type,
GST_TYPE_IMPLEMENTS_INTERFACE, &iface_info);
GST_TYPE_IMPLEMENTS_INTERFACE, &iface_info);
g_type_add_interface_static (sdlvideosink_type, GST_TYPE_X_OVERLAY,
&xoverlay_info);
&xoverlay_info);
}
return sdlvideosink_type;
@ -135,11 +135,11 @@ gst_sdlvideosink_base_init (gpointer g_class)
capslist = gst_caps_new_empty ();
for (i = 0; i < 5; i++) {
gst_caps_append_structure (capslist,
gst_structure_new ("video/x-raw-yuv",
"format", GST_TYPE_FOURCC, format[i],
"width", GST_TYPE_INT_RANGE, 1, G_MAXINT,
"height", GST_TYPE_INT_RANGE, 1, G_MAXINT,
"framerate", GST_TYPE_DOUBLE_RANGE, 0.0, G_MAXDOUBLE, NULL));
gst_structure_new ("video/x-raw-yuv",
"format", GST_TYPE_FOURCC, format[i],
"width", GST_TYPE_INT_RANGE, 1, G_MAXINT,
"height", GST_TYPE_INT_RANGE, 1, G_MAXINT,
"framerate", GST_TYPE_DOUBLE_RANGE, 0.0, G_MAXDOUBLE, NULL));
}
sink_template = gst_pad_template_new ("sink",
@ -207,7 +207,7 @@ gst_sdlvideosink_buffer_new (GstBufferPool * pool,
if (sdlvideosink->format == SDL_YV12_OVERLAY ||
sdlvideosink->format == SDL_IYUV_OVERLAY) {
GST_BUFFER_SIZE (buffer) =
sdlvideosink->width * sdlvideosink->height * 3 / 2;
sdlvideosink->width * sdlvideosink->height * 3 / 2;
} else {
GST_BUFFER_SIZE (buffer) = sdlvideosink->width * sdlvideosink->height * 2;
}
@ -271,9 +271,9 @@ gst_sdlvideosink_init (GstSDLVideoSink * sdlvideosink)
sdlvideosink->lock = g_mutex_new ();
#if 0
sdlvideosink->bufferpool = gst_buffer_pool_new (NULL, /* free */
NULL, /* copy */
(GstBufferPoolBufferNewFunction) gst_sdlvideosink_buffer_new, NULL, /* buffer copy, the default is fine */
sdlvideosink->bufferpool = gst_buffer_pool_new (NULL, /* free */
NULL, /* copy */
(GstBufferPoolBufferNewFunction) gst_sdlvideosink_buffer_new, NULL, /* buffer copy, the default is fine */
(GstBufferPoolBufferFreeFunction) gst_sdlvideosink_buffer_free,
sdlvideosink);
#endif
@ -354,7 +354,7 @@ gst_sdlvideosink_lock (GstSDLVideoSink * sdlvideosink)
/* assure that we've got a screen */
if (!sdlvideosink->screen || !sdlvideosink->overlay) {
GST_ELEMENT_ERROR (sdlvideosink, LIBRARY, TOO_LAZY, (NULL),
("Tried to lock screen without being set-up"));
("Tried to lock screen without being set-up"));
return FALSE;
}
@ -362,13 +362,13 @@ gst_sdlvideosink_lock (GstSDLVideoSink * sdlvideosink)
if (SDL_MUSTLOCK (sdlvideosink->screen)) {
if (SDL_LockSurface (sdlvideosink->screen) < 0) {
GST_ELEMENT_ERROR (sdlvideosink, LIBRARY, TOO_LAZY, (NULL),
("SDL: couldn't lock the SDL video window: %s", SDL_GetError ()));
("SDL: couldn't lock the SDL video window: %s", SDL_GetError ()));
return FALSE;
}
}
if (SDL_LockYUVOverlay (sdlvideosink->overlay) < 0) {
GST_ELEMENT_ERROR (sdlvideosink, LIBRARY, TOO_LAZY, (NULL),
("SDL: couldn\'t lock the SDL YUV overlay: %s", SDL_GetError ()));
("SDL: couldn\'t lock the SDL YUV overlay: %s", SDL_GetError ()));
return FALSE;
}
@ -413,7 +413,7 @@ gst_sdlvideosink_initsdl (GstSDLVideoSink * sdlvideosink)
/* Initialize the SDL library */
if (SDL_Init (SDL_INIT_VIDEO | SDL_INIT_NOPARACHUTE) < 0) {
GST_ELEMENT_ERROR (sdlvideosink, LIBRARY, INIT, (NULL),
("Couldn't initialize SDL: %s", SDL_GetError ()));
("Couldn't initialize SDL: %s", SDL_GetError ()));
return FALSE;
}
@ -449,8 +449,8 @@ gst_sdlvideosink_create (GstSDLVideoSink * sdlvideosink)
GST_VIDEOSINK_HEIGHT (sdlvideosink), 0, SDL_HWSURFACE | SDL_RESIZABLE);
if (sdlvideosink->screen == NULL) {
GST_ELEMENT_ERROR (sdlvideosink, LIBRARY, TOO_LAZY, (NULL),
("SDL: Couldn't set %dx%d: %s", GST_VIDEOSINK_WIDTH (sdlvideosink),
GST_VIDEOSINK_HEIGHT (sdlvideosink), SDL_GetError ()));
("SDL: Couldn't set %dx%d: %s", GST_VIDEOSINK_WIDTH (sdlvideosink),
GST_VIDEOSINK_HEIGHT (sdlvideosink), SDL_GetError ()));
return FALSE;
}
@ -459,16 +459,16 @@ gst_sdlvideosink_create (GstSDLVideoSink * sdlvideosink)
sdlvideosink->height, sdlvideosink->format, sdlvideosink->screen);
if (sdlvideosink->overlay == NULL) {
GST_ELEMENT_ERROR (sdlvideosink, LIBRARY, TOO_LAZY, (NULL),
("SDL: Couldn't create SDL YUV overlay (%dx%d \'" GST_FOURCC_FORMAT
"\'): %s", sdlvideosink->width, sdlvideosink->height,
GST_FOURCC_ARGS (sdlvideosink->format), SDL_GetError ()));
("SDL: Couldn't create SDL YUV overlay (%dx%d \'" GST_FOURCC_FORMAT
"\'): %s", sdlvideosink->width, sdlvideosink->height,
GST_FOURCC_ARGS (sdlvideosink->format), SDL_GetError ()));
return FALSE;
} else {
GST_DEBUG ("Using a %dx%d %dbpp SDL screen with a %dx%d \'"
GST_FOURCC_FORMAT "\' YUV overlay", GST_VIDEOSINK_WIDTH (sdlvideosink),
GST_VIDEOSINK_HEIGHT (sdlvideosink),
sdlvideosink->screen->format->BitsPerPixel, sdlvideosink->width,
sdlvideosink->height, GST_FOURCC_ARGS (sdlvideosink->format));
GST_FOURCC_FORMAT "\' YUV overlay", GST_VIDEOSINK_WIDTH (sdlvideosink),
GST_VIDEOSINK_HEIGHT (sdlvideosink),
sdlvideosink->screen->format->BitsPerPixel, sdlvideosink->width,
sdlvideosink->height, GST_FOURCC_ARGS (sdlvideosink->format));
}
sdlvideosink->rect.x = 0;
@ -505,7 +505,7 @@ gst_sdlvideosink_fixate (GstPad * pad, const GstCaps * caps)
return newcaps;
}
if (gst_caps_structure_fixate_field_nearest_double (structure, "framerate",
30.0)) {
30.0)) {
return newcaps;
}
@ -555,13 +555,13 @@ gst_sdlvideosink_chain (GstPad * pad, GstData * _data)
switch (GST_EVENT_TYPE (event)) {
case GST_EVENT_DISCONTINUOUS:
offset = GST_EVENT_DISCONT_OFFSET (event, 0).value;
/*gst_clock_handle_discont (sdlvideosink->clock,
(guint64) GST_EVENT_DISCONT_OFFSET (event, 0).value); */
break;
offset = GST_EVENT_DISCONT_OFFSET (event, 0).value;
/*gst_clock_handle_discont (sdlvideosink->clock,
(guint64) GST_EVENT_DISCONT_OFFSET (event, 0).value); */
break;
default:
gst_pad_event_default (pad, event);
return;
gst_pad_event_default (pad, event);
return;
}
gst_event_unref (event);
return;
@ -578,19 +578,19 @@ gst_sdlvideosink_chain (GstPad * pad, GstData * _data)
/* buf->yuv - FIXME: bufferpool! */
if (sdlvideosink->format == SDL_IYUV_OVERLAY ||
sdlvideosink->format == SDL_YV12_OVERLAY) {
sdlvideosink->format == SDL_YV12_OVERLAY) {
memcpy (sdlvideosink->overlay->pixels[0], GST_BUFFER_DATA (buf),
sdlvideosink->width * sdlvideosink->height);
sdlvideosink->width * sdlvideosink->height);
memcpy (sdlvideosink->overlay->pixels[1],
GST_BUFFER_DATA (buf) + sdlvideosink->width * sdlvideosink->height,
sdlvideosink->width * sdlvideosink->height / 4);
GST_BUFFER_DATA (buf) + sdlvideosink->width * sdlvideosink->height,
sdlvideosink->width * sdlvideosink->height / 4);
memcpy (sdlvideosink->overlay->pixels[2],
GST_BUFFER_DATA (buf) +
sdlvideosink->width * sdlvideosink->height * 5 / 4,
sdlvideosink->width * sdlvideosink->height / 4);
GST_BUFFER_DATA (buf) +
sdlvideosink->width * sdlvideosink->height * 5 / 4,
sdlvideosink->width * sdlvideosink->height / 4);
} else {
memcpy (sdlvideosink->overlay->pixels[0], GST_BUFFER_DATA (buf),
sdlvideosink->width * sdlvideosink->height * 2);
sdlvideosink->width * sdlvideosink->height * 2);
}
gst_sdlvideosink_unlock (sdlvideosink);
@ -604,11 +604,11 @@ gst_sdlvideosink_chain (GstPad * pad, GstData * _data)
while (SDL_PollEvent (&sdl_event)) {
switch (sdl_event.type) {
case SDL_VIDEORESIZE:
/* create a SDL window of the size requested by the user */
GST_VIDEOSINK_WIDTH (sdlvideosink) = sdl_event.resize.w;
GST_VIDEOSINK_HEIGHT (sdlvideosink) = sdl_event.resize.h;
gst_sdlvideosink_create (sdlvideosink);
break;
/* create a SDL window of the size requested by the user */
GST_VIDEOSINK_WIDTH (sdlvideosink) = sdl_event.resize.w;
GST_VIDEOSINK_HEIGHT (sdlvideosink) = sdl_event.resize.h;
gst_sdlvideosink_create (sdlvideosink);
break;
}
}
}
@ -661,7 +661,7 @@ gst_sdlvideosink_change_state (GstElement * element)
switch (GST_STATE_TRANSITION (element)) {
case GST_STATE_NULL_TO_READY:
if (!gst_sdlvideosink_initsdl (sdlvideosink))
return GST_STATE_FAILURE;
return GST_STATE_FAILURE;
GST_FLAG_SET (sdlvideosink, GST_SDLVIDEOSINK_OPEN);
break;
case GST_STATE_PAUSED_TO_READY:
@ -671,7 +671,7 @@ gst_sdlvideosink_change_state (GstElement * element)
gst_sdlvideosink_deinitsdl (sdlvideosink);
GST_FLAG_UNSET (sdlvideosink, GST_SDLVIDEOSINK_OPEN);
break;
default: /* do nothing */
default: /* do nothing */
break;
}
@ -690,7 +690,7 @@ plugin_init (GstPlugin * plugin)
return FALSE;
if (!gst_element_register (plugin, "sdlvideosink", GST_RANK_NONE,
GST_TYPE_SDLVIDEOSINK))
GST_TYPE_SDLVIDEOSINK))
return FALSE;
return TRUE;

View file

@ -50,19 +50,19 @@ enum
enum
{
ARG_0,
ARG_IP, /* the ip of the server */
ARG_PORT, /* the encoder port number on the server */
ARG_PASSWORD, /* the encoder password on the server */
ARG_PUBLIC, /* is this stream public? */
ARG_NAME, /* Name of the stream */
ARG_DESCRIPTION, /* Description of the stream */
ARG_GENRE, /* Genre of the stream */
ARG_MOUNT, /* mountpoint of stream (icecast only) */
ARG_DUMPFILE, /* Dumpfile on the server for this stream (icecast only) */
ARG_ICY, /* use icy headers for login? (for use with shoutcast) */
ARG_AIM, /* AIM number (shoutcast only) */
ARG_ICQ, /* ICQ number (shoutcast only) */
ARG_IRC, /* IRC server (shoutcast only) */
ARG_IP, /* the ip of the server */
ARG_PORT, /* the encoder port number on the server */
ARG_PASSWORD, /* the encoder password on the server */
ARG_PUBLIC, /* is this stream public? */
ARG_NAME, /* Name of the stream */
ARG_DESCRIPTION, /* Description of the stream */
ARG_GENRE, /* Genre of the stream */
ARG_MOUNT, /* mountpoint of stream (icecast only) */
ARG_DUMPFILE, /* Dumpfile on the server for this stream (icecast only) */
ARG_ICY, /* use icy headers for login? (for use with shoutcast) */
ARG_AIM, /* AIM number (shoutcast only) */
ARG_ICQ, /* ICQ number (shoutcast only) */
ARG_IRC, /* IRC server (shoutcast only) */
};
static GstStaticPadTemplate sink_template_factory =
@ -70,7 +70,7 @@ GST_STATIC_PAD_TEMPLATE ("sink",
GST_PAD_SINK,
GST_PAD_ALWAYS,
GST_STATIC_CAPS ("audio/mpeg, "
"mpegversion = (int) 1, " "layer = (int) [ 1, 3 ]")
"mpegversion = (int) 1, " "layer = (int) [ 1, 3 ]")
);
static void gst_icecastsend_class_init (GstIcecastSendClass * klass);
@ -104,9 +104,10 @@ gst_icecastsend_get_type (void)
sizeof (GstIcecastSend), 0,
(GInstanceInitFunc) gst_icecastsend_init,
};
icecastsend_type =
g_type_register_static (GST_TYPE_ELEMENT, "GstIcecastSend",
&icecastsend_info, 0);
g_type_register_static (GST_TYPE_ELEMENT, "GstIcecastSend",
&icecastsend_info, 0);
}
return icecastsend_type;
}
@ -132,33 +133,33 @@ gst_icecastsend_class_init (GstIcecastSendClass * klass)
parent_class = g_type_class_ref (GST_TYPE_ELEMENT);
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_IP, g_param_spec_string ("ip", "ip", "ip", NULL, G_PARAM_READWRITE)); /* CHECKME */
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_PORT, g_param_spec_int ("port", "port", "port", G_MININT, G_MAXINT, 0, G_PARAM_READWRITE)); /* CHECKME */
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_IP, g_param_spec_string ("ip", "ip", "ip", NULL, G_PARAM_READWRITE)); /* CHECKME */
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_PORT, g_param_spec_int ("port", "port", "port", G_MININT, G_MAXINT, 0, G_PARAM_READWRITE)); /* CHECKME */
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_PASSWORD, g_param_spec_string ("password", "password", "password", NULL, G_PARAM_READWRITE)); /* CHECKME */
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_PASSWORD, g_param_spec_string ("password", "password", "password", NULL, G_PARAM_READWRITE)); /* CHECKME */
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_PUBLIC, g_param_spec_boolean ("public", "public", "public", TRUE, G_PARAM_READWRITE)); /* CHECKME */
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_PUBLIC, g_param_spec_boolean ("public", "public", "public", TRUE, G_PARAM_READWRITE)); /* CHECKME */
/* metadata */
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_NAME, g_param_spec_string ("name", "name", "name", NULL, G_PARAM_READWRITE)); /* CHECKME */
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_NAME, g_param_spec_string ("name", "name", "name", NULL, G_PARAM_READWRITE)); /* CHECKME */
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_DESCRIPTION, g_param_spec_string ("description", "description", "description", NULL, G_PARAM_READWRITE)); /* CHECKME */
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_DESCRIPTION, g_param_spec_string ("description", "description", "description", NULL, G_PARAM_READWRITE)); /* CHECKME */
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_GENRE, g_param_spec_string ("genre", "genre", "genre", NULL, G_PARAM_READWRITE)); /* CHECKME */
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_GENRE, g_param_spec_string ("genre", "genre", "genre", NULL, G_PARAM_READWRITE)); /* CHECKME */
/* icecast only */
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_MOUNT, g_param_spec_string ("mount", "mount", "mount", NULL, G_PARAM_READWRITE)); /* CHECKME */
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_MOUNT, g_param_spec_string ("mount", "mount", "mount", NULL, G_PARAM_READWRITE)); /* CHECKME */
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_DUMPFILE, g_param_spec_string ("dumpfile", "dumpfile", "dumpfile", NULL, G_PARAM_READWRITE)); /* CHECKME */
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_DUMPFILE, g_param_spec_string ("dumpfile", "dumpfile", "dumpfile", NULL, G_PARAM_READWRITE)); /* CHECKME */
/* shoutcast only */
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_ICY, g_param_spec_boolean ("icy", "icy", "icy", FALSE, G_PARAM_READWRITE)); /* CHECKME */
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_ICY, g_param_spec_boolean ("icy", "icy", "icy", FALSE, G_PARAM_READWRITE)); /* CHECKME */
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_AIM, g_param_spec_string ("aim", "aim", "aim", NULL, G_PARAM_READWRITE)); /* CHECKME */
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_AIM, g_param_spec_string ("aim", "aim", "aim", NULL, G_PARAM_READWRITE)); /* CHECKME */
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_ICQ, g_param_spec_string ("icq", "icq", "icq", NULL, G_PARAM_READWRITE)); /* CHECKME */
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_ICQ, g_param_spec_string ("icq", "icq", "icq", NULL, G_PARAM_READWRITE)); /* CHECKME */
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_IRC, g_param_spec_string ("irc", "irc", "irc", NULL, G_PARAM_READWRITE)); /* CHECKME */
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_IRC, g_param_spec_string ("irc", "irc", "irc", NULL, G_PARAM_READWRITE)); /* CHECKME */
gobject_class->set_property = gst_icecastsend_set_property;
@ -174,7 +175,7 @@ gst_icecastsend_init (GstIcecastSend * icecastsend)
icecastsend->sinkpad =
gst_pad_new_from_template (gst_element_class_get_pad_template (klass,
"sink"), "sink");
"sink"), "sink");
gst_element_add_pad (GST_ELEMENT (icecastsend), icecastsend->sinkpad);
gst_pad_set_chain_function (icecastsend->sinkpad, gst_icecastsend_chain);
@ -232,7 +233,7 @@ gst_icecastsend_set_property (GObject * object, guint prop_id,
switch (prop_id) {
case ARG_IP:
if (icecastsend->ip)
g_free (icecastsend->ip);
g_free (icecastsend->ip);
icecastsend->ip = g_strdup (g_value_get_string (value));
break;
case ARG_PORT:
@ -240,64 +241,64 @@ gst_icecastsend_set_property (GObject * object, guint prop_id,
break;
case ARG_PASSWORD:
if (icecastsend->password)
g_free (icecastsend->password);
g_free (icecastsend->password);
icecastsend->password = g_strdup (g_value_get_string (value));
break;
case ARG_PUBLIC: /* is this stream public? */
case ARG_PUBLIC: /* is this stream public? */
icecastsend->public = g_value_get_boolean (value);
break;
case ARG_NAME: /* Name of the stream */
case ARG_NAME: /* Name of the stream */
if (icecastsend->name)
g_free (icecastsend->name);
g_free (icecastsend->name);
icecastsend->name = g_strdup (g_value_get_string (value));
break;
case ARG_DESCRIPTION: /* Description of the stream */
case ARG_DESCRIPTION: /* Description of the stream */
if (icecastsend->description)
g_free (icecastsend->description);
g_free (icecastsend->description);
icecastsend->description = g_strdup (g_value_get_string (value));
break;
case ARG_GENRE: /* Genre of the stream */
case ARG_GENRE: /* Genre of the stream */
if (icecastsend->genre)
g_free (icecastsend->genre);
g_free (icecastsend->genre);
icecastsend->genre = g_strdup (g_value_get_string (value));
break;
case ARG_MOUNT: /* mountpoint of stream (icecast only) */
case ARG_MOUNT: /* mountpoint of stream (icecast only) */
if (icecastsend->mount)
g_free (icecastsend->mount);
g_free (icecastsend->mount);
icecastsend->mount = g_strdup (g_value_get_string (value));
break;
case ARG_DUMPFILE: /* Dumpfile on the server for this stream (icecast only) */
case ARG_DUMPFILE: /* Dumpfile on the server for this stream (icecast only) */
if (icecastsend->dumpfile)
g_free (icecastsend->dumpfile);
g_free (icecastsend->dumpfile);
icecastsend->dumpfile = g_strdup (g_value_get_string (value));
break;
case ARG_ICY: /* use icy headers for login? (for use with shoutcast) */
case ARG_ICY: /* use icy headers for login? (for use with shoutcast) */
icecastsend->icy = g_value_get_boolean (value);
break;
case ARG_AIM: /* AIM number (shoutcast only) */
case ARG_AIM: /* AIM number (shoutcast only) */
if (icecastsend->aim)
g_free (icecastsend->aim);
g_free (icecastsend->aim);
icecastsend->aim = g_strdup (g_value_get_string (value));
break;
case ARG_ICQ: /* ICQ number (shoutcast only) */
case ARG_ICQ: /* ICQ number (shoutcast only) */
if (icecastsend->icq)
g_free (icecastsend->icq);
g_free (icecastsend->icq);
icecastsend->icq = g_strdup (g_value_get_string (value));
break;
case ARG_IRC: /* IRC server (shoutcast only) */
case ARG_IRC: /* IRC server (shoutcast only) */
if (icecastsend->irc)
g_free (icecastsend->irc);
g_free (icecastsend->irc);
icecastsend->irc = g_strdup (g_value_get_string (value));
break;
@ -326,43 +327,43 @@ gst_icecastsend_get_property (GObject * object, guint prop_id, GValue * value,
case ARG_PASSWORD:
g_value_set_string (value, icecastsend->password);
break;
case ARG_PUBLIC: /* is this stream public? */
case ARG_PUBLIC: /* is this stream public? */
g_value_set_boolean (value, icecastsend->public);
break;
case ARG_NAME: /* Name of the stream */
case ARG_NAME: /* Name of the stream */
g_value_set_string (value, icecastsend->name);
break;
case ARG_DESCRIPTION: /* Description of the stream */
case ARG_DESCRIPTION: /* Description of the stream */
g_value_set_string (value, icecastsend->description);
break;
case ARG_GENRE: /* Genre of the stream */
case ARG_GENRE: /* Genre of the stream */
g_value_set_string (value, icecastsend->genre);
break;
case ARG_MOUNT: /* mountpoint of stream (icecast only) */
case ARG_MOUNT: /* mountpoint of stream (icecast only) */
g_value_set_string (value, icecastsend->mount);
break;
case ARG_DUMPFILE: /* Dumpfile on the server for this stream (icecast only) */
case ARG_DUMPFILE: /* Dumpfile on the server for this stream (icecast only) */
g_value_set_string (value, icecastsend->dumpfile);
break;
case ARG_ICY: /* use icy headers for login? (for use with shoutcast) */
case ARG_ICY: /* use icy headers for login? (for use with shoutcast) */
g_value_set_boolean (value, icecastsend->icy);
break;
case ARG_AIM: /* AIM number (shoutcast only) */
case ARG_AIM: /* AIM number (shoutcast only) */
g_value_set_string (value, icecastsend->aim);
break;
case ARG_ICQ: /* ICQ number (shoutcast only) */
case ARG_ICQ: /* ICQ number (shoutcast only) */
g_value_set_string (value, icecastsend->icq);
break;
case ARG_IRC: /* IRC server (shoutcast only) */
case ARG_IRC: /* IRC server (shoutcast only) */
g_value_set_string (value, icecastsend->irc);
break;
@ -407,12 +408,12 @@ gst_icecastsend_change_state (GstElement * element)
icecastsend->conn.irc = icecastsend->irc; */
if (shout_connect (&icecastsend->conn)) {
g_print ("connected to server...\n");
g_print ("connected to server...\n");
} else {
g_warning ("couldn't connect to server... (%i: %s)\n",
icecastsend->conn.error, SHOUT_ERRORS[icecastsend->conn.error]);
shout_disconnect (&icecastsend->conn);
return GST_STATE_FAILURE;
g_warning ("couldn't connect to server... (%i: %s)\n",
icecastsend->conn.error, SHOUT_ERRORS[icecastsend->conn.error]);
shout_disconnect (&icecastsend->conn);
return GST_STATE_FAILURE;
}
break;
case GST_STATE_PAUSED_TO_READY:

View file

@ -80,9 +80,10 @@ gst_smoothwave_get_type (void)
0,
(GInstanceInitFunc) gst_smoothwave_init,
};
smoothwave_type =
g_type_register_static (GST_TYPE_ELEMENT, "GstSmoothWave",
&smoothwave_info, 0);
g_type_register_static (GST_TYPE_ELEMENT, "GstSmoothWave",
&smoothwave_info, 0);
}
return smoothwave_type;
}
@ -106,9 +107,9 @@ gst_smoothwave_class_init (GstSmoothWaveClass * klass)
parent_class = g_type_class_ref (GST_TYPE_ELEMENT);
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_WIDTH, g_param_spec_int ("width", "width", "width", G_MININT, G_MAXINT, 0, G_PARAM_READWRITE)); /* CHECKME */
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_HEIGHT, g_param_spec_int ("height", "height", "height", G_MININT, G_MAXINT, 0, G_PARAM_READWRITE)); /* CHECKME */
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_WIDGET, g_param_spec_object ("widget", "widget", "widget", GTK_TYPE_WIDGET, G_PARAM_READABLE)); /* CHECKME! */
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_WIDTH, g_param_spec_int ("width", "width", "width", G_MININT, G_MAXINT, 0, G_PARAM_READWRITE)); /* CHECKME */
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_HEIGHT, g_param_spec_int ("height", "height", "height", G_MININT, G_MAXINT, 0, G_PARAM_READWRITE)); /* CHECKME */
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_WIDGET, g_param_spec_object ("widget", "widget", "widget", GTK_TYPE_WIDGET, G_PARAM_READABLE)); /* CHECKME! */
gobject_class->set_property = gst_smoothwave_set_property;
gobject_class->get_property = gst_smoothwave_get_property;
@ -192,7 +193,7 @@ gst_smoothwave_chain (GstPad * pad, GstData * _data)
for (i = 0; i < MAX (smoothwave->width, samplecount); i++) {
gint16 y1 = (gint32) (samples[i * 2] * qheight) / 32768 + qheight;
gint16 y2 = (gint32) (samples[(i * 2) + 1] * qheight) / 32768 +
(qheight * 3);
(qheight * 3);
smoothwave->imagebuffer[y1 * smoothwave->width + i] = 0xff;
smoothwave->imagebuffer[y2 * smoothwave->width + i] = 0xff;
/* smoothwave->imagebuffer[i+(smoothwave->width*5)] = i; */
@ -246,16 +247,16 @@ gst_smoothwave_set_property (GObject * object, guint prop_id,
case ARG_WIDTH:
smoothwave->width = g_value_get_int (value);
gtk_drawing_area_size (GTK_DRAWING_AREA (smoothwave->image),
smoothwave->width, smoothwave->height);
smoothwave->width, smoothwave->height);
gtk_widget_set_usize (GTK_WIDGET (smoothwave->image),
smoothwave->width, smoothwave->height);
smoothwave->width, smoothwave->height);
break;
case ARG_HEIGHT:
smoothwave->height = g_value_get_int (value);
gtk_drawing_area_size (GTK_DRAWING_AREA (smoothwave->image),
smoothwave->width, smoothwave->height);
smoothwave->width, smoothwave->height);
gtk_widget_set_usize (GTK_WIDGET (smoothwave->image),
smoothwave->width, smoothwave->height);
smoothwave->width, smoothwave->height);
break;
default:
break;
@ -297,7 +298,7 @@ static gboolean
plugin_init (GstPlugin * plugin)
{
if (!gst_element_register (plugin, "smoothwave", GST_RANK_NONE,
GST_TYPE_SMOOTHWAVE))
GST_TYPE_SMOOTHWAVE))
return FALSE;
return TRUE;

View file

@ -112,9 +112,10 @@ gst_snapshot_get_type (void)
0,
(GInstanceInitFunc) gst_snapshot_init,
};
snapshot_type =
g_type_register_static (GST_TYPE_ELEMENT, "GstSnapshot", &snapshot_info,
0);
g_type_register_static (GST_TYPE_ELEMENT, "GstSnapshot", &snapshot_info,
0);
}
return snapshot_type;
}
@ -145,10 +146,10 @@ gst_snapshot_class_init (GstSnapshotClass * klass)
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_FRAME,
g_param_spec_long ("frame", "frame", "frame",
0, G_MAXLONG, 0, G_PARAM_READWRITE));
0, G_MAXLONG, 0, G_PARAM_READWRITE));
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_LOCATION,
g_param_spec_string ("location", "location", "location",
0, G_PARAM_READWRITE));
0, G_PARAM_READWRITE));
gst_snapshot_signals[SNAPSHOT_SIGNAL] =
g_signal_new ("snapshot", G_TYPE_FROM_CLASS (klass),
@ -257,30 +258,30 @@ gst_snapshot_chain (GstPad * pad, GstData * _data)
g_warning (" Can not open %s\n", snapshot->location);
else {
png_set_filter (snapshot->png_struct_ptr, 0,
PNG_FILTER_NONE | PNG_FILTER_VALUE_NONE);
PNG_FILTER_NONE | PNG_FILTER_VALUE_NONE);
png_init_io (snapshot->png_struct_ptr, fp);
png_set_compression_level (snapshot->png_struct_ptr, 9);
png_set_IHDR (snapshot->png_struct_ptr,
snapshot->png_info_ptr,
snapshot->width,
snapshot->height,
snapshot->to_bpp / 3,
PNG_COLOR_TYPE_RGB,
PNG_INTERLACE_NONE,
PNG_COMPRESSION_TYPE_DEFAULT, PNG_FILTER_TYPE_DEFAULT);
snapshot->png_info_ptr,
snapshot->width,
snapshot->height,
snapshot->to_bpp / 3,
PNG_COLOR_TYPE_RGB,
PNG_INTERLACE_NONE,
PNG_COMPRESSION_TYPE_DEFAULT, PNG_FILTER_TYPE_DEFAULT);
for (i = 0; i < snapshot->height; i++)
row_pointers[i] = data + (snapshot->width * i * snapshot->to_bpp / 8);
row_pointers[i] = data + (snapshot->width * i * snapshot->to_bpp / 8);
png_write_info (snapshot->png_struct_ptr, snapshot->png_info_ptr);
png_write_image (snapshot->png_struct_ptr, row_pointers);
png_write_end (snapshot->png_struct_ptr, NULL);
png_destroy_info_struct (snapshot->png_struct_ptr,
&snapshot->png_info_ptr);
&snapshot->png_info_ptr);
png_destroy_write_struct (&snapshot->png_struct_ptr, (png_infopp) NULL);
fclose (fp);
g_signal_emit (G_OBJECT (snapshot),
gst_snapshot_signals[SNAPSHOT_SIGNAL], 0);
gst_snapshot_signals[SNAPSHOT_SIGNAL], 0);
}
@ -337,7 +338,7 @@ static gboolean
plugin_init (GstPlugin * plugin)
{
if (!gst_element_register (plugin, "snapshot", GST_RANK_NONE,
GST_TYPE_SNAPSHOT))
GST_TYPE_SNAPSHOT))
return FALSE;
return TRUE;

View file

@ -85,7 +85,7 @@ gst_sf_major_types_get_type (void)
for (k = 0; k < count; k++) {
format_info.format = k;
sf_command (NULL, SFC_GET_FORMAT_MAJOR, &format_info,
sizeof (format_info));
sizeof (format_info));
sf_major_types[k].value = format_info.format;
sf_major_types[k].value_name = g_strdup (format_info.name);
sf_major_types[k].value_nick = g_strdup (format_info.extension);
@ -94,19 +94,19 @@ gst_sf_major_types_get_type (void)
just hope that sndfile gives us the list in alphabetical order, as it
currently does. */
if (k > 0
&& strcmp (sf_major_types[k].value_nick,
sf_major_types[k - 1].value_nick) == 0) {
g_free (sf_major_types[k].value_nick);
sf_major_types[k].value_nick =
g_strconcat (sf_major_types[k - 1].value_nick, "-",
sf_major_types[k].value_name, NULL);
g_strcanon (sf_major_types[k].value_nick,
G_CSET_A_2_Z G_CSET_a_2_z G_CSET_DIGITS "-", '-');
&& strcmp (sf_major_types[k].value_nick,
sf_major_types[k - 1].value_nick) == 0) {
g_free (sf_major_types[k].value_nick);
sf_major_types[k].value_nick =
g_strconcat (sf_major_types[k - 1].value_nick, "-",
sf_major_types[k].value_name, NULL);
g_strcanon (sf_major_types[k].value_nick,
G_CSET_A_2_Z G_CSET_a_2_z G_CSET_DIGITS "-", '-');
}
}
sf_major_types_type =
g_enum_register_static ("GstSndfileMajorTypes", sf_major_types);
g_enum_register_static ("GstSndfileMajorTypes", sf_major_types);
}
return sf_major_types_type;
}
@ -129,16 +129,16 @@ gst_sf_minor_types_get_type (void)
for (k = 0; k < count; k++) {
format_info.format = k;
sf_command (NULL, SFC_GET_FORMAT_SUBTYPE, &format_info,
sizeof (format_info));
sizeof (format_info));
sf_minor_types[k].value = format_info.format;
sf_minor_types[k].value_name = g_strdup (format_info.name);
sf_minor_types[k].value_nick = g_ascii_strdown (format_info.name, -1);
g_strcanon (sf_minor_types[k].value_nick, G_CSET_a_2_z G_CSET_DIGITS "-",
'-');
'-');
}
sf_minor_types_type =
g_enum_register_static ("GstSndfileMinorTypes", sf_minor_types);
g_enum_register_static ("GstSndfileMinorTypes", sf_minor_types);
}
return sf_minor_types_type;
}
@ -186,13 +186,14 @@ gst_sf_get_type (void)
static const GTypeInfo sf_info = {
sizeof (GstSFClass), NULL,
NULL,
(GClassInitFunc) NULL, /* don't even initialize the class */
(GClassInitFunc) NULL, /* don't even initialize the class */
NULL,
NULL,
sizeof (GstSF),
0,
(GInstanceInitFunc) NULL /* abstract base class */
(GInstanceInitFunc) NULL /* abstract base class */
};
sf_type = g_type_register_static (GST_TYPE_ELEMENT, "GstSF", &sf_info, 0);
}
return sf_type;
@ -215,8 +216,9 @@ gst_sfsrc_get_type (void)
0,
(GInstanceInitFunc) gst_sf_init,
};
sfsrc_type =
g_type_register_static (GST_TYPE_SF, "GstSFSrc", &sfsrc_info, 0);
g_type_register_static (GST_TYPE_SF, "GstSFSrc", &sfsrc_info, 0);
}
return sfsrc_type;
}
@ -238,8 +240,9 @@ gst_sfsink_get_type (void)
0,
(GInstanceInitFunc) gst_sf_init,
};
sfsink_type =
g_type_register_static (GST_TYPE_SF, "GstSFSink", &sfsink_info, 0);
g_type_register_static (GST_TYPE_SF, "GstSFSink", &sfsink_info, 0);
}
return sfsink_type;
}
@ -291,12 +294,12 @@ gst_sf_class_init (GstSFClass * klass)
if (G_TYPE_FROM_CLASS (klass) == GST_TYPE_SFSRC) {
pspec = g_param_spec_boolean ("loop", "Loop?", "Loop the output?",
FALSE, G_PARAM_READWRITE | G_PARAM_CONSTRUCT);
FALSE, G_PARAM_READWRITE | G_PARAM_CONSTRUCT);
g_object_class_install_property (gobject_class, ARG_LOOP, pspec);
pspec =
g_param_spec_boolean ("create-pads", "Create pads?",
"Create one pad for each channel in the sound file?", TRUE,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT);
g_param_spec_boolean ("create-pads", "Create pads?",
"Create one pad for each channel in the sound file?", TRUE,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT);
g_object_class_install_property (gobject_class, ARG_CREATE_PADS, pspec);
}
@ -338,17 +341,17 @@ gst_sf_set_property (GObject * object, guint prop_id, const GValue * value,
switch (prop_id) {
case ARG_LOCATION:
if (GST_FLAG_IS_SET (object, GST_SF_OPEN))
gst_sf_close_file (this);
gst_sf_close_file (this);
if (this->filename)
g_free (this->filename);
g_free (this->filename);
if (g_value_get_string (value))
this->filename = g_strdup (g_value_get_string (value));
this->filename = g_strdup (g_value_get_string (value));
else
this->filename = NULL;
this->filename = NULL;
if (this->filename)
gst_sf_open_file (this);
gst_sf_open_file (this);
break;
case ARG_MAJOR_TYPE:
@ -366,10 +369,10 @@ gst_sf_set_property (GObject * object, guint prop_id, const GValue * value,
case ARG_CREATE_PADS:
this->create_pads = g_value_get_boolean (value);
if (this->file && this->create_pads) {
int i;
int i;
for (i = g_list_length (this->channels); i < this->numchannels; i++)
gst_element_get_request_pad ((GstElement *) this, "src%d");
for (i = g_list_length (this->channels); i < this->numchannels; i++)
gst_element_get_request_pad ((GstElement *) this, "src%d");
}
break;
@ -450,13 +453,13 @@ gst_sf_change_state (GstElement * element)
break;
case GST_STATE_PLAYING_TO_PAUSED:
gst_audio_clock_set_active (GST_AUDIO_CLOCK (this->provided_clock),
FALSE);
FALSE);
break;
case GST_STATE_PAUSED_TO_READY:
break;
case GST_STATE_READY_TO_NULL:
if (GST_FLAG_IS_SET (this, GST_SF_OPEN))
gst_sf_close_file (this);
gst_sf_close_file (this);
break;
}
@ -514,7 +517,7 @@ gst_sf_release_request_pad (GstElement * element, GstPad * pad)
if (GST_STATE (element) == GST_STATE_PLAYING) {
g_warning
("You can't release a request pad if the element is PLAYING, sorry.");
("You can't release a request pad if the element is PLAYING, sorry.");
return;
}
@ -557,9 +560,9 @@ gst_sf_link (GstPad * pad, const GstCaps * caps)
if (this->buffer)
g_free (this->buffer);
this->buffer =
g_malloc (this->numchannels * this->buffer_frames * sizeof (float));
g_malloc (this->numchannels * this->buffer_frames * sizeof (float));
memset (this->buffer, 0,
this->numchannels * this->buffer_frames * sizeof (float));
this->numchannels * this->buffer_frames * sizeof (float));
}
return GST_PAD_LINK_OK;
}
@ -576,7 +579,7 @@ gst_sf_open_file (GstSF * this)
if (!this->filename) {
GST_ELEMENT_ERROR (this, RESOURCE, NOT_FOUND,
(_("No filename specified.")), (NULL));
(_("No filename specified.")), (NULL));
return FALSE;
}
@ -586,11 +589,11 @@ gst_sf_open_file (GstSF * this)
} else {
if (!this->rate) {
INFO_OBJ (this, "Not opening %s yet because caps are not set",
this->filename);
this->filename);
return FALSE;
} else if (!this->numchannels) {
INFO_OBJ (this, "Not opening %s yet because we have no input channels",
this->filename);
this->filename);
return FALSE;
}
@ -601,12 +604,12 @@ gst_sf_open_file (GstSF * this)
info.format = this->format;
INFO_OBJ (this, "Opening %s with rate %d, %d channels, format 0x%x",
this->filename, info.samplerate, info.channels, info.format);
this->filename, info.samplerate, info.channels, info.format);
if (!sf_format_check (&info)) {
GST_ELEMENT_ERROR (this, STREAM, ENCODE, (NULL),
("Input parameters (rate:%d, channels:%d, format:0x%x) invalid",
info.samplerate, info.channels, info.format));
("Input parameters (rate:%d, channels:%d, format:0x%x) invalid",
info.samplerate, info.channels, info.format));
return FALSE;
}
}
@ -615,8 +618,8 @@ gst_sf_open_file (GstSF * this)
if (!this->file) {
GST_ELEMENT_ERROR (this, RESOURCE, OPEN_WRITE,
(_("Could not open file \"%s\" for writing."), this->filename),
("soundfile error: %s", sf_strerror (NULL)));
(_("Could not open file \"%s\" for writing."), this->filename),
("soundfile error: %s", sf_strerror (NULL)));
return FALSE;
}
@ -632,7 +635,7 @@ gst_sf_open_file (GstSF * this)
int i;
for (i = g_list_length (this->channels); i < this->numchannels; i++)
gst_element_get_request_pad ((GstElement *) this, "src%d");
gst_element_get_request_pad ((GstElement *) this, "src%d");
}
for (l = this->channels; l; l = l->next)
@ -656,8 +659,8 @@ gst_sf_close_file (GstSF * this)
if ((err = sf_close (this->file)))
GST_ELEMENT_ERROR (this, RESOURCE, CLOSE,
("Could not close file file \"%s\".", this->filename),
("soundfile error: %s", strerror (err)));
("Could not close file file \"%s\".", this->filename),
("soundfile error: %s", strerror (err)));
else
GST_FLAG_UNSET (this, GST_SF_OPEN);
@ -677,7 +680,7 @@ gst_sf_loop (GstElement * element)
if (this->channels == NULL) {
GST_ELEMENT_ERROR (element, CORE, PAD, (NULL),
("You must connect at least one pad to sndfile elements."));
("You must connect at least one pad to sndfile elements."));
return;
}
@ -694,7 +697,7 @@ gst_sf_loop (GstElement * element)
if (!GST_FLAG_IS_SET (this, GST_SF_OPEN))
if (!gst_sf_open_file (this))
return; /* we've already set gst_element_error */
return; /* we've already set gst_element_error */
if (buffer_frames == 0) {
/* we have to set the caps later */
@ -702,9 +705,9 @@ gst_sf_loop (GstElement * element)
}
if (buf == NULL) {
buf = this->buffer =
g_malloc (this->numchannels * this->buffer_frames * sizeof (float));
g_malloc (this->numchannels * this->buffer_frames * sizeof (float));
memset (this->buffer, 0,
this->numchannels * this->buffer_frames * sizeof (float));
this->numchannels * this->buffer_frames * sizeof (float));
}
read = sf_readf_float (this->file, buf, buffer_frames);
@ -713,51 +716,51 @@ gst_sf_loop (GstElement * element)
if (read)
for (i = 0, l = this->channels; l; l = l->next, i++) {
channel = GST_SF_CHANNEL (l);
channel = GST_SF_CHANNEL (l);
/* don't push on disconnected pads -- useful for ::create-pads=TRUE */
if (!GST_PAD_PEER (channel->pad))
continue;
/* don't push on disconnected pads -- useful for ::create-pads=TRUE */
if (!GST_PAD_PEER (channel->pad))
continue;
if (!channel->caps_set) {
GstCaps *caps =
gst_caps_copy (GST_PAD_CAPS (GST_SF_CHANNEL (l)->pad));
if (!caps)
caps = gst_caps_copy
(GST_PAD_TEMPLATE_CAPS (GST_PAD_PAD_TEMPLATE (GST_SF_CHANNEL
(l)->pad)));
gst_caps_set_simple (caps, "rate", G_TYPE_INT, this->rate,
"buffer-frames", G_TYPE_INT, this->buffer_frames, NULL);
if (!gst_pad_try_set_caps (GST_SF_CHANNEL (l)->pad, caps)) {
GST_ELEMENT_ERROR (this, CORE, NEGOTIATION, (NULL),
("Opened file with sample rate %d, but could not set caps",
this->rate));
gst_sf_close_file (this);
return;
}
channel->caps_set = TRUE;
}
if (!channel->caps_set) {
GstCaps *caps =
gst_caps_copy (GST_PAD_CAPS (GST_SF_CHANNEL (l)->pad));
if (!caps)
caps = gst_caps_copy
(GST_PAD_TEMPLATE_CAPS (GST_PAD_PAD_TEMPLATE (GST_SF_CHANNEL
(l)->pad)));
gst_caps_set_simple (caps, "rate", G_TYPE_INT, this->rate,
"buffer-frames", G_TYPE_INT, this->buffer_frames, NULL);
if (!gst_pad_try_set_caps (GST_SF_CHANNEL (l)->pad, caps)) {
GST_ELEMENT_ERROR (this, CORE, NEGOTIATION, (NULL),
("Opened file with sample rate %d, but could not set caps",
this->rate));
gst_sf_close_file (this);
return;
}
channel->caps_set = TRUE;
}
out = gst_buffer_new_and_alloc (read * sizeof (float));
data = (gfloat *) GST_BUFFER_DATA (out);
for (j = 0; j < read; j++)
data[j] = buf[j * nchannels + i % nchannels];
gst_pad_push (channel->pad, GST_DATA (out));
out = gst_buffer_new_and_alloc (read * sizeof (float));
data = (gfloat *) GST_BUFFER_DATA (out);
for (j = 0; j < read; j++)
data[j] = buf[j * nchannels + i % nchannels];
gst_pad_push (channel->pad, GST_DATA (out));
}
this->time += read * (GST_SECOND / this->rate);
gst_audio_clock_update_time ((GstAudioClock *) this->provided_clock,
this->time);
this->time);
if (eos) {
if (this->loop) {
sf_seek (this->file, (sf_count_t) 0, SEEK_SET);
eos = 0;
sf_seek (this->file, (sf_count_t) 0, SEEK_SET);
eos = 0;
} else {
for (l = this->channels; l; l = l->next)
gst_pad_push (GST_SF_CHANNEL (l)->pad,
GST_DATA (gst_event_new (GST_EVENT_EOS)));
gst_element_set_eos (element);
for (l = this->channels; l; l = l->next)
gst_pad_push (GST_SF_CHANNEL (l)->pad,
GST_DATA (gst_event_new (GST_EVENT_EOS)));
gst_element_set_eos (element);
}
}
} else {
@ -777,7 +780,7 @@ gst_sf_loop (GstElement * element)
num_to_write = buffer_frames;
INFO_OBJ (this, "looping, buffer_frames=%d, nchannels=%d", buffer_frames,
nchannels);
nchannels);
for (i = 0, l = this->channels; l; l = l->next, i++) {
channel = GST_SF_CHANNEL (l);
@ -786,40 +789,40 @@ gst_sf_loop (GstElement * element)
in = GST_BUFFER (gst_pad_pull (channel->pad));
if (buffer_frames == 0) {
/* pulling a buffer from the pad should have caused capsnego to occur,
which then would set this->buffer_frames to a new value */
buffer_frames = this->buffer_frames;
if (buffer_frames == 0) {
GST_ELEMENT_ERROR (element, CORE, NEGOTIATION, (NULL),
("format wasn't negotiated before chain function"));
return;
}
buf = this->buffer;
num_to_write = buffer_frames;
/* pulling a buffer from the pad should have caused capsnego to occur,
which then would set this->buffer_frames to a new value */
buffer_frames = this->buffer_frames;
if (buffer_frames == 0) {
GST_ELEMENT_ERROR (element, CORE, NEGOTIATION, (NULL),
("format wasn't negotiated before chain function"));
return;
}
buf = this->buffer;
num_to_write = buffer_frames;
}
if (!GST_FLAG_IS_SET (this, GST_SF_OPEN))
if (!gst_sf_open_file (this))
return; /* we've already set gst_element_error */
if (!gst_sf_open_file (this))
return; /* we've already set gst_element_error */
if (GST_IS_EVENT (in)) {
switch (GST_EVENT_TYPE (in)) {
case GST_EVENT_EOS:
case GST_EVENT_INTERRUPT:
num_to_write = 0;
break;
default:
goto pull_again;
break;
}
switch (GST_EVENT_TYPE (in)) {
case GST_EVENT_EOS:
case GST_EVENT_INTERRUPT:
num_to_write = 0;
break;
default:
goto pull_again;
break;
}
}
if (num_to_write) {
data = (gfloat *) GST_BUFFER_DATA (in);
num_to_write =
MIN (num_to_write, GST_BUFFER_SIZE (in) / sizeof (gfloat));
for (j = 0; j < num_to_write; j++)
buf[j * nchannels + i % nchannels] = data[j];
data = (gfloat *) GST_BUFFER_DATA (in);
num_to_write =
MIN (num_to_write, GST_BUFFER_SIZE (in) / sizeof (gfloat));
for (j = 0; j < num_to_write; j++)
buf[j * nchannels + i % nchannels] = data[j];
}
gst_data_unref ((GstData *) in);
@ -828,14 +831,14 @@ gst_sf_loop (GstElement * element)
if (num_to_write) {
written = sf_writef_float (this->file, buf, num_to_write);
if (written != num_to_write)
GST_ELEMENT_ERROR (element, RESOURCE, WRITE,
(_("Could not write to file \"%s\"."), this->filename),
("soundfile error: %s", sf_strerror (this->file)));
GST_ELEMENT_ERROR (element, RESOURCE, WRITE,
(_("Could not write to file \"%s\"."), this->filename),
("soundfile error: %s", sf_strerror (this->file)));
}
this->time += num_to_write * (GST_SECOND / this->rate);
gst_audio_clock_update_time ((GstAudioClock *) this->provided_clock,
this->time);
this->time);
if (num_to_write != buffer_frames)
gst_element_set_eos (element);

View file

@ -57,12 +57,12 @@ GST_STATIC_PAD_TEMPLATE ("audio_00",
GST_PAD_SRC,
GST_PAD_ALWAYS,
GST_STATIC_CAPS ("audio/x-raw-int, "
"rate = (int) 44100, "
"channels = (int) 2, "
"endianness = (int) BYTE_ORDER, "
"width = (int) 16, "
"depth = (int) 16, "
"signed = (boolean) true, " "buffer-frames = (int) [ 1, MAX ]")
"rate = (int) 44100, "
"channels = (int) 2, "
"endianness = (int) BYTE_ORDER, "
"width = (int) 16, "
"depth = (int) 16, "
"signed = (boolean) true, " "buffer-frames = (int) [ 1, MAX ]")
);
static GstStaticPadTemplate sink_template_factory =
@ -118,8 +118,9 @@ gst_swfdec_get_type (void)
0,
(GInstanceInitFunc) gst_swfdec_init,
};
swfdec_type =
g_type_register_static (GST_TYPE_ELEMENT, "GstSwfdec", &swfdec_info, 0);
g_type_register_static (GST_TYPE_ELEMENT, "GstSwfdec", &swfdec_info, 0);
}
return swfdec_type;
}
@ -167,7 +168,7 @@ gst_swfdec_video_getcaps (GstPad * pad)
caps = gst_caps_copy (gst_pad_get_pad_template_caps (pad));
if (swfdec->have_format) {
gst_caps_set_simple (caps,
"framerate", G_TYPE_DOUBLE, swfdec->frame_rate, NULL);
"framerate", G_TYPE_DOUBLE, swfdec->frame_rate, NULL);
}
return caps;
@ -247,20 +248,20 @@ gst_swfdec_loop (GstElement * element)
buf = GST_BUFFER (gst_pad_pull (swfdec->sinkpad));
if (GST_IS_EVENT (buf)) {
switch (GST_EVENT_TYPE (buf)) {
case GST_EVENT_EOS:
GST_DEBUG ("got eos");
break;
default:
GST_DEBUG ("got event");
break;
case GST_EVENT_EOS:
GST_DEBUG ("got eos");
break;
default:
GST_DEBUG ("got event");
break;
}
} else {
if (!GST_BUFFER_DATA (buf)) {
GST_DEBUG ("expected non-null buffer");
GST_DEBUG ("expected non-null buffer");
}
ret = swfdec_decoder_addbits (swfdec->state,
GST_BUFFER_DATA (buf), GST_BUFFER_SIZE (buf));
GST_BUFFER_DATA (buf), GST_BUFFER_SIZE (buf));
}
}
@ -269,16 +270,16 @@ gst_swfdec_loop (GstElement * element)
GstPadLinkReturn link_ret;
swfdec_decoder_get_image_size (swfdec->state,
&swfdec->width, &swfdec->height);
&swfdec->width, &swfdec->height);
swfdec_decoder_get_rate (swfdec->state, &swfdec->rate);
swfdec->interval = GST_SECOND / swfdec->rate;
caps = gst_caps_copy (gst_pad_get_pad_template_caps (swfdec->videopad));
swfdec_decoder_get_rate (swfdec->state, &swfdec->frame_rate);
gst_caps_set_simple (caps,
"framerate", G_TYPE_DOUBLE, swfdec->frame_rate,
"height", G_TYPE_INT, swfdec->height,
"width", G_TYPE_INT, swfdec->width, NULL);
"framerate", G_TYPE_DOUBLE, swfdec->frame_rate,
"height", G_TYPE_INT, swfdec->height,
"width", G_TYPE_INT, swfdec->width, NULL);
link_ret = gst_pad_try_set_caps (swfdec->videopad, caps);
if (GST_PAD_LINK_SUCCESSFUL (link_ret)) {
/* good */
@ -301,7 +302,7 @@ gst_swfdec_loop (GstElement * element)
//GST_BUFFER_SIZE(newbuf) = swfdec->width * swfdec->height * 3;
newbuf = gst_pad_alloc_buffer (swfdec->videopad, GST_BUFFER_OFFSET_NONE,
swfdec->width * 4 * swfdec->height);
swfdec->width * 4 * swfdec->height);
swfdec_decoder_get_image (swfdec->state, &data);
copy_image (GST_BUFFER_DATA (newbuf), data, swfdec->width, swfdec->height);
@ -398,16 +399,16 @@ gst_swfdec_convert_sink (GstPad * pad, GstFormat src_format, gint64 src_value,
switch (src_format) {
case GST_FORMAT_BYTES:
switch (*dest_format) {
case GST_FORMAT_TIME:
default:
res = FALSE;
case GST_FORMAT_TIME:
default:
res = FALSE;
}
break;
case GST_FORMAT_TIME:
switch (*dest_format) {
case GST_FORMAT_BYTES:
default:
res = FALSE;
case GST_FORMAT_BYTES:
default:
res = FALSE;
}
break;
default:
@ -430,43 +431,43 @@ gst_swfdec_convert_src (GstPad * pad, GstFormat src_format, gint64 src_value,
switch (src_format) {
case GST_FORMAT_BYTES:
switch (*dest_format) {
case GST_FORMAT_TIME:
default:
res = FALSE;
case GST_FORMAT_TIME:
default:
res = FALSE;
}
break;
case GST_FORMAT_TIME:
switch (*dest_format) {
case GST_FORMAT_BYTES:
*dest_value = src_value * 6 * (swfdec->width * swfdec->height >> 2) *
video_rates[swfdec->decoder->frame_rate_code] / GST_SECOND;
break;
case GST_FORMAT_DEFAULT:
*dest_value =
src_value * video_rates[swfdec->decoder->frame_rate_code] /
GST_SECOND;
break;
default:
res = FALSE;
case GST_FORMAT_BYTES:
*dest_value = src_value * 6 * (swfdec->width * swfdec->height >> 2) *
video_rates[swfdec->decoder->frame_rate_code] / GST_SECOND;
break;
case GST_FORMAT_DEFAULT:
*dest_value =
src_value * video_rates[swfdec->decoder->frame_rate_code] /
GST_SECOND;
break;
default:
res = FALSE;
}
break;
case GST_FORMAT_DEFAULT:
switch (*dest_format) {
case GST_FORMAT_TIME:
if (video_rates[swfdec->decoder->frame_rate_code] != 0.0) {
*dest_value = src_value * GST_SECOND /
video_rates[swfdec->decoder->frame_rate_code];
} else
res = FALSE;
break;
case GST_FORMAT_BYTES:
*dest_value = src_value * 6 * (swfdec->width * swfdec->height >> 2);
break;
case GST_FORMAT_DEFAULT:
*dest_value = src_value;
break;
default:
res = FALSE;
case GST_FORMAT_TIME:
if (video_rates[swfdec->decoder->frame_rate_code] != 0.0) {
*dest_value = src_value * GST_SECOND /
video_rates[swfdec->decoder->frame_rate_code];
} else
res = FALSE;
break;
case GST_FORMAT_BYTES:
*dest_value = src_value * 6 * (swfdec->width * swfdec->height >> 2);
break;
case GST_FORMAT_DEFAULT:
*dest_value = src_value;
break;
default:
res = FALSE;
}
break;
default:
@ -489,31 +490,31 @@ gst_swfdec_src_query (GstPad * pad, GstQueryType type,
case GST_QUERY_TOTAL:
{
switch (*format) {
case GST_FORMAT_TIME:
{
int n_frames;
int ret;
case GST_FORMAT_TIME:
{
int n_frames;
int ret;
res = FALSE;
ret = swfdec_decoder_get_n_frames (swfdec->state, &n_frames);
if (ret == SWF_OK) {
*value = n_frames * swfdec->interval;
res = TRUE;
}
break;
}
default:
res = FALSE;
break;
res = FALSE;
ret = swfdec_decoder_get_n_frames (swfdec->state, &n_frames);
if (ret == SWF_OK) {
*value = n_frames * swfdec->interval;
res = TRUE;
}
break;
}
default:
res = FALSE;
break;
}
break;
}
case GST_QUERY_POSITION:
{
switch (*format) {
default:
res = FALSE;
break;
default:
res = FALSE;
break;
}
break;
}
@ -532,7 +533,8 @@ gst_swfdec_src_event (GstPad * pad, GstEvent * event)
gboolean res = TRUE;
GstSwfdec *swfdec;
static const GstFormat formats[] = { GST_FORMAT_TIME, GST_FORMAT_BYTES };
#define MAX_SEEK_FORMATS 1 /* we can only do time seeking for now */
#define MAX_SEEK_FORMATS 1 /* we can only do time seeking for now */
gint i;
swfdec = GST_SWFDEC (gst_pad_get_parent (pad));
@ -549,11 +551,11 @@ gst_swfdec_src_event (GstPad * pad, GstEvent * event)
/* first bring the src_format to TIME */
if (!gst_pad_convert (pad,
GST_EVENT_SEEK_FORMAT (event), GST_EVENT_SEEK_OFFSET (event),
&format, &src_offset)) {
/* didn't work, probably unsupported seek format then */
res = FALSE;
break;
GST_EVENT_SEEK_FORMAT (event), GST_EVENT_SEEK_OFFSET (event),
&format, &src_offset)) {
/* didn't work, probably unsupported seek format then */
res = FALSE;
break;
}
/* shave off the flush flag, we'll need it later */
@ -564,26 +566,26 @@ gst_swfdec_src_event (GstPad * pad, GstEvent * event)
/* while we did not exhaust our seek formats without result */
for (i = 0; i < MAX_SEEK_FORMATS && !res; i++) {
gint64 desired_offset;
gint64 desired_offset;
format = formats[i];
format = formats[i];
/* try to convert requested format to one we can seek with on the sinkpad */
if (gst_pad_convert (swfdec->sinkpad, GST_FORMAT_TIME, src_offset,
&format, &desired_offset)) {
GstEvent *seek_event;
/* try to convert requested format to one we can seek with on the sinkpad */
if (gst_pad_convert (swfdec->sinkpad, GST_FORMAT_TIME, src_offset,
&format, &desired_offset)) {
GstEvent *seek_event;
/* conversion succeeded, create the seek */
seek_event =
gst_event_new_seek (formats[i] | GST_SEEK_METHOD_SET | flush,
desired_offset);
/* do the seekk */
if (gst_pad_send_event (GST_PAD_PEER (swfdec->sinkpad), seek_event)) {
/* seek worked, we're done, loop will exit */
res = TRUE;
}
}
/* at this point, either the seek worked or res == FALSE */
/* conversion succeeded, create the seek */
seek_event =
gst_event_new_seek (formats[i] | GST_SEEK_METHOD_SET | flush,
desired_offset);
/* do the seekk */
if (gst_pad_send_event (GST_PAD_PEER (swfdec->sinkpad), seek_event)) {
/* seek worked, we're done, loop will exit */
res = TRUE;
}
}
/* at this point, either the seek worked or res == FALSE */
}
break;
}
@ -630,8 +632,8 @@ gst_swfdec_change_state (GstElement * element)
/* if we are not closed by an EOS event do so now, this cen send a few frames but
* we are prepared to not really send them (see above) */
if (!swfdec->closed) {
/*swf_close (swfdec->decoder); */
swfdec->closed = TRUE;
/*swf_close (swfdec->decoder); */
swfdec->closed = TRUE;
}
//gst_swfdec_vo_destroy (swfdec);
break;

View file

@ -28,11 +28,11 @@ static gboolean
plugin_init (GstPlugin * plugin)
{
if (!gst_element_register (plugin, "tarkinenc", GST_RANK_NONE,
GST_TYPE_TARKINENC))
GST_TYPE_TARKINENC))
return FALSE;
if (!gst_element_register (plugin, "tarkindec", GST_RANK_NONE,
GST_TYPE_TARKINDEC))
GST_TYPE_TARKINDEC))
return FALSE;
return TRUE;

View file

@ -85,8 +85,8 @@ tarkindec_get_type (void)
};
tarkindec_type =
g_type_register_static (GST_TYPE_ELEMENT, "TarkinDec", &tarkindec_info,
0);
g_type_register_static (GST_TYPE_ELEMENT, "TarkinDec", &tarkindec_info,
0);
}
return tarkindec_type;
}
@ -145,7 +145,7 @@ gst_tarkindec_class_init (TarkinDecClass * klass)
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_BITRATE,
g_param_spec_int ("bitrate", "bitrate", "bitrate",
G_MININT, G_MAXINT, 3000, G_PARAM_READWRITE));
G_MININT, G_MAXINT, 3000, G_PARAM_READWRITE));
parent_class = g_type_class_ref (GST_TYPE_ELEMENT);
@ -200,7 +200,7 @@ gst_tarkindec_chain (GstPad * pad, GstData * _data)
if (!tarkindec->setup) {
GST_ELEMENT_ERROR (tarkindec, CORE, NEGOTATION, (NULL),
("decoder not initialized (input is not tarkin?)"));
("decoder not initialized (input is not tarkin?)"));
if (GST_IS_BUFFER (buf))
gst_buffer_unref (buf);
else
@ -212,8 +212,8 @@ gst_tarkindec_chain (GstPad * pad, GstData * _data)
switch (GST_EVENT_TYPE (buf)) {
case GST_EVENT_EOS:
default:
gst_pad_event_default (pad, GST_EVENT (buf));
break;
gst_pad_event_default (pad, GST_EVENT (buf));
break;
}
} else {
gchar *data;
@ -235,43 +235,43 @@ gst_tarkindec_chain (GstPad * pad, GstData * _data)
ogg_stream_pagein (&tarkindec->os, &tarkindec->og);
while (ogg_stream_packetout (&tarkindec->os, &tarkindec->op)) {
if (tarkindec->op.e_o_s)
break;
if (tarkindec->nheader < 3) { /* 3 first packets to headerin */
tarkin_synthesis_headerin (&tarkindec->ti, &tarkindec->tc,
&tarkindec->op);
if (tarkindec->op.e_o_s)
break;
if (tarkindec->nheader < 3) { /* 3 first packets to headerin */
tarkin_synthesis_headerin (&tarkindec->ti, &tarkindec->tc,
&tarkindec->op);
if (tarkindec->nheader == 2) {
tarkin_synthesis_init (tarkindec->tarkin_stream, &tarkindec->ti);
}
tarkindec->nheader++;
} else {
tarkin_synthesis_packetin (tarkindec->tarkin_stream, &tarkindec->op);
if (tarkindec->nheader == 2) {
tarkin_synthesis_init (tarkindec->tarkin_stream, &tarkindec->ti);
}
tarkindec->nheader++;
} else {
tarkin_synthesis_packetin (tarkindec->tarkin_stream, &tarkindec->op);
while (tarkin_synthesis_frameout (tarkindec->tarkin_stream, &rgb, 0,
&date) == 0) {
GstBuffer *outbuf;
while (tarkin_synthesis_frameout (tarkindec->tarkin_stream, &rgb, 0,
&date) == 0) {
GstBuffer *outbuf;
layer = &tarkindec->tarkin_stream->layer->desc;
layer = &tarkindec->tarkin_stream->layer->desc;
if (!GST_PAD_CAPS (tarkindec->srcpad)) {
if (gst_pad_try_set_caps (tarkindec->srcpad, GST_CAPS_NEW ("tarkin_raw", "video/x-raw-rgb", "bpp", GST_PROPS_INT (24), "depth", GST_PROPS_INT (24), "endianness", GST_PROPS_INT (G_BYTE_ORDER), "red_mask", GST_PROPS_INT (0xff0000), "green_mask", GST_PROPS_INT (0xff00), "blue_mask", GST_PROPS_INT (0xff), "width", GST_PROPS_INT (layer->width), "height", GST_PROPS_INT (layer->height), "framerate", GST_PROPS_FLOAT (0.) /* FIXME!!! */
)) <= 0) {
GST_ELEMENT_ERROR (tarkindec, CORE, NEGOTATION, (NULL),
("could not output format"));
gst_buffer_unref (buf);
return;
}
}
outbuf = gst_buffer_new ();
GST_BUFFER_DATA (outbuf) = rgb;
GST_BUFFER_SIZE (outbuf) = layer->width * layer->height * 3;
GST_BUFFER_FLAG_SET (outbuf, GST_BUFFER_DONTFREE);
gst_pad_push (tarkindec->srcpad, GST_DATA (outbuf));
if (!GST_PAD_CAPS (tarkindec->srcpad)) {
if (gst_pad_try_set_caps (tarkindec->srcpad, GST_CAPS_NEW ("tarkin_raw", "video/x-raw-rgb", "bpp", GST_PROPS_INT (24), "depth", GST_PROPS_INT (24), "endianness", GST_PROPS_INT (G_BYTE_ORDER), "red_mask", GST_PROPS_INT (0xff0000), "green_mask", GST_PROPS_INT (0xff00), "blue_mask", GST_PROPS_INT (0xff), "width", GST_PROPS_INT (layer->width), "height", GST_PROPS_INT (layer->height), "framerate", GST_PROPS_FLOAT (0.) /* FIXME!!! */
)) <= 0) {
GST_ELEMENT_ERROR (tarkindec, CORE, NEGOTATION, (NULL),
("could not output format"));
gst_buffer_unref (buf);
return;
}
}
outbuf = gst_buffer_new ();
GST_BUFFER_DATA (outbuf) = rgb;
GST_BUFFER_SIZE (outbuf) = layer->width * layer->height * 3;
GST_BUFFER_FLAG_SET (outbuf, GST_BUFFER_DONTFREE);
gst_pad_push (tarkindec->srcpad, GST_DATA (outbuf));
tarkin_synthesis_freeframe (tarkindec->tarkin_stream, rgb);
}
}
tarkin_synthesis_freeframe (tarkindec->tarkin_stream, rgb);
}
}
}
}
gst_buffer_unref (buf);

View file

@ -86,8 +86,8 @@ tarkinenc_get_type (void)
};
tarkinenc_type =
g_type_register_static (GST_TYPE_ELEMENT, "TarkinEnc", &tarkinenc_info,
0);
g_type_register_static (GST_TYPE_ELEMENT, "TarkinEnc", &tarkinenc_info,
0);
}
return tarkinenc_type;
}
@ -146,15 +146,15 @@ gst_tarkinenc_class_init (TarkinEncClass * klass)
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_BITRATE,
g_param_spec_int ("bitrate", "bitrate", "bitrate",
G_MININT, G_MAXINT, 3000, G_PARAM_READWRITE));
G_MININT, G_MAXINT, 3000, G_PARAM_READWRITE));
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_S_MOMENTS,
g_param_spec_int ("s_moments", "Synthesis Moments",
"Number of vanishing moments for the synthesis filter",
1, 4, 2, G_PARAM_READWRITE));
"Number of vanishing moments for the synthesis filter",
1, 4, 2, G_PARAM_READWRITE));
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_A_MOMENTS,
g_param_spec_int ("a_moments", "Analysis Moments",
"Number of vanishing moments for the analysis filter",
1, 4, 2, G_PARAM_READWRITE));
"Number of vanishing moments for the analysis filter",
1, 4, 2, G_PARAM_READWRITE));
parent_class = g_type_class_ref (GST_TYPE_ELEMENT);
@ -313,7 +313,7 @@ gst_tarkinenc_chain (GstPad * pad, GstData * _data)
if (!tarkinenc->setup) {
GST_ELEMENT_ERROR (tarkinenc, CORE, NEGOTIATION, (NULL),
("encoder not initialized (input is not tarkin?)"));
("encoder not initialized (input is not tarkin?)"));
if (GST_IS_BUFFER (buf))
gst_buffer_unref (buf);
else
@ -324,12 +324,12 @@ gst_tarkinenc_chain (GstPad * pad, GstData * _data)
if (GST_IS_EVENT (buf)) {
switch (GST_EVENT_TYPE (buf)) {
case GST_EVENT_EOS:
tarkin_analysis_framein (tarkinenc->tarkin_stream, NULL, 0, NULL); /* EOS */
tarkin_comment_clear (&tarkinenc->tc);
tarkin_stream_destroy (tarkinenc->tarkin_stream);
tarkin_analysis_framein (tarkinenc->tarkin_stream, NULL, 0, NULL); /* EOS */
tarkin_comment_clear (&tarkinenc->tc);
tarkin_stream_destroy (tarkinenc->tarkin_stream);
default:
gst_pad_event_default (pad, GST_EVENT (buf));
break;
gst_pad_event_default (pad, GST_EVENT (buf));
break;
}
} else {
gchar *data;
@ -396,9 +396,9 @@ gst_tarkinenc_set_property (GObject * object, guint prop_id,
s_moments = g_value_get_int (value);
if (s_moments != 1 || s_moments != 2 || s_moments != 4) {
g_warning ("tarkinenc: s_moments must be 1, 2 or 4");
g_warning ("tarkinenc: s_moments must be 1, 2 or 4");
} else {
tarkinenc->s_moments = s_moments;
tarkinenc->s_moments = s_moments;
}
break;
}
@ -408,9 +408,9 @@ gst_tarkinenc_set_property (GObject * object, guint prop_id,
a_moments = g_value_get_int (value);
if (a_moments != 1 || a_moments != 2 || a_moments != 4) {
g_warning ("tarkinenc: a_moments must be 1, 2 or 4");
g_warning ("tarkinenc: a_moments must be 1, 2 or 4");
} else {
tarkinenc->a_moments = a_moments;
tarkinenc->a_moments = a_moments;
}
break;
}

View file

@ -71,7 +71,7 @@ tarkin_comment_add (TarkinComment * vc, char *comment)
void
tarkin_comment_add_tag (TarkinComment * vc, char *tag, char *contents)
{
char *comment = alloca (strlen (tag) + strlen (contents) + 2); /* +2 for = and \0 */
char *comment = alloca (strlen (tag) + strlen (contents) + 2); /* +2 for = and \0 */
strcpy (comment, tag);
strcat (comment, "=");
@ -99,7 +99,7 @@ tarkin_comment_query (TarkinComment * vc, char *tag, int count)
{
long i;
int found = 0;
int taglen = strlen (tag) + 1; /* +1 for the = we append */
int taglen = strlen (tag) + 1; /* +1 for the = we append */
char *fulltag = alloca (taglen + 1);
strcpy (fulltag, tag);
@ -108,20 +108,20 @@ tarkin_comment_query (TarkinComment * vc, char *tag, int count)
for (i = 0; i < vc->comments; i++) {
if (!tagcompare (vc->user_comments[i], fulltag, taglen)) {
if (count == found)
/* We return a pointer to the data, not a copy */
return vc->user_comments[i] + taglen;
/* We return a pointer to the data, not a copy */
return vc->user_comments[i] + taglen;
else
found++;
found++;
}
}
return NULL; /* didn't find anything */
return NULL; /* didn't find anything */
}
int
tarkin_comment_query_count (TarkinComment * vc, char *tag)
{
int i, count = 0;
int taglen = strlen (tag) + 1; /* +1 for the = we append */
int taglen = strlen (tag) + 1; /* +1 for the = we append */
char *fulltag = alloca (taglen + 1);
strcpy (fulltag, tag);
@ -143,7 +143,7 @@ tarkin_comment_clear (TarkinComment * vc)
for (i = 0; i < vc->comments; i++)
if (vc->user_comments[i])
FREE (vc->user_comments[i]);
FREE (vc->user_comments[i]);
if (vc->user_comments)
FREE (vc->user_comments);
if (vc->comment_lengths)
@ -200,7 +200,7 @@ _tarkin_unpack_info (TarkinInfo * vi, oggpack_buffer * opb)
goto err_out;
if (oggpack_read (opb, 1) != 1)
goto err_out; /* EOP check */
goto err_out; /* EOP check */
#ifdef DBG_OGG
printf ("Success\n");
@ -245,7 +245,7 @@ _tarkin_unpack_comment (TarkinComment * vc, oggpack_buffer * opb)
_v_readstring (opb, vc->user_comments[i], len);
}
if (oggpack_read (opb, 1) != 1)
goto err_out; /* EOP check */
goto err_out; /* EOP check */
#ifdef DBG_OGG
printf ("Success, read %d comments\n", vc->comments);
@ -284,55 +284,55 @@ _tarkin_unpack_layer_desc (TarkinInfo * vi, oggpack_buffer * opb)
switch (layer->desc.format) {
case TARKIN_GRAYSCALE:
layer->n_comp = 1;
layer->color_fwd_xform = grayscale_to_y;
layer->color_inv_xform = y_to_grayscale;
break;
layer->n_comp = 1;
layer->color_fwd_xform = grayscale_to_y;
layer->color_inv_xform = y_to_grayscale;
break;
case TARKIN_RGB24:
layer->n_comp = 3;
layer->color_fwd_xform = rgb24_to_yuv;
layer->color_inv_xform = yuv_to_rgb24;
break;
layer->n_comp = 3;
layer->color_fwd_xform = rgb24_to_yuv;
layer->color_inv_xform = yuv_to_rgb24;
break;
case TARKIN_RGB32:
layer->n_comp = 3;
layer->color_fwd_xform = rgb32_to_yuv;
layer->color_inv_xform = yuv_to_rgb32;
break;
layer->n_comp = 3;
layer->color_fwd_xform = rgb32_to_yuv;
layer->color_inv_xform = yuv_to_rgb32;
break;
case TARKIN_RGBA:
layer->n_comp = 4;
layer->color_fwd_xform = rgba_to_yuv;
layer->color_inv_xform = yuv_to_rgba;
break;
layer->n_comp = 4;
layer->color_fwd_xform = rgba_to_yuv;
layer->color_inv_xform = yuv_to_rgba;
break;
default:
return -TARKIN_INVALID_COLOR_FORMAT;
return -TARKIN_INVALID_COLOR_FORMAT;
};
layer->waveletbuf = (Wavelet3DBuf **) CALLOC (layer->n_comp,
sizeof (Wavelet3DBuf *));
sizeof (Wavelet3DBuf *));
layer->packet = MALLOC (layer->n_comp * sizeof (*layer->packet));
memset (layer->packet, 0, layer->n_comp * sizeof (*layer->packet));
for (j = 0; j < layer->n_comp; j++) {
layer->waveletbuf[j] = wavelet_3d_buf_new (layer->desc.width,
layer->desc.height, layer->desc.frames_per_buf);
layer->desc.height, layer->desc.frames_per_buf);
layer->packet[j].data = MALLOC (layer->desc.bitstream_len);
layer->packet[j].storage = layer->desc.bitstream_len;
}
vi->max_bitstream_len += layer->desc.bitstream_len + 2 * 10 * sizeof (uint32_t) * layer->n_comp; /* truncation tables */
vi->max_bitstream_len += layer->desc.bitstream_len + 2 * 10 * sizeof (uint32_t) * layer->n_comp; /* truncation tables */
#ifdef DBG_OGG
printf
("\n layer%d: size %dx%dx%d, format %d, a_m %d, s_m %d, %d fpb\n",
i, layer->desc.width, layer->desc.height, layer->n_comp,
layer->desc.format, layer->desc.a_moments, layer->desc.s_moments,
layer->desc.frames_per_buf);
("\n layer%d: size %dx%dx%d, format %d, a_m %d, s_m %d, %d fpb\n",
i, layer->desc.width, layer->desc.height, layer->n_comp,
layer->desc.format, layer->desc.a_moments, layer->desc.s_moments,
layer->desc.frames_per_buf);
#endif
} /* for each layer */
} /* for each layer */
if (oggpack_read (opb, 1) != 1)
goto err_out; /* EOP check */
goto err_out; /* EOP check */
#ifdef DBG_OGG
printf ("Success\n");
@ -369,42 +369,42 @@ tarkin_synthesis_headerin (TarkinInfo * vi, TarkinComment * vc, ogg_packet * op)
memset (buffer, 0, 6);
_v_readstring (&opb, buffer, 6);
if (memcmp (buffer, "tarkin", 6)) {
/* not a tarkin header */
return (-TARKIN_NOT_TARKIN);
/* not a tarkin header */
return (-TARKIN_NOT_TARKIN);
}
switch (packtype) {
case 0x01: /* least significant *bit* is read first */
if (!op->b_o_s) {
/* Not the initial packet */
return (-TARKIN_BAD_HEADER);
}
if (vi->inter.numerator != 0) {
/* previously initialized info header */
return (-TARKIN_BAD_HEADER);
}
case 0x01: /* least significant *bit* is read first */
if (!op->b_o_s) {
/* Not the initial packet */
return (-TARKIN_BAD_HEADER);
}
if (vi->inter.numerator != 0) {
/* previously initialized info header */
return (-TARKIN_BAD_HEADER);
}
return (_tarkin_unpack_info (vi, &opb));
return (_tarkin_unpack_info (vi, &opb));
case 0x03: /* least significant *bit* is read first */
if (vi->inter.denominator == 0) {
/* um... we didn't get the initial header */
return (-TARKIN_BAD_HEADER);
}
case 0x03: /* least significant *bit* is read first */
if (vi->inter.denominator == 0) {
/* um... we didn't get the initial header */
return (-TARKIN_BAD_HEADER);
}
return (_tarkin_unpack_comment (vc, &opb));
return (_tarkin_unpack_comment (vc, &opb));
case 0x05: /* least significant *bit* is read first */
if (vi->inter.numerator == 0 || vc->vendor == NULL) {
/* um... we didn;t get the initial header or comments yet */
return (-TARKIN_BAD_HEADER);
}
case 0x05: /* least significant *bit* is read first */
if (vi->inter.numerator == 0 || vc->vendor == NULL) {
/* um... we didn;t get the initial header or comments yet */
return (-TARKIN_BAD_HEADER);
}
return (_tarkin_unpack_layer_desc (vi, &opb));
return (_tarkin_unpack_layer_desc (vi, &opb));
default:
/* Not a valid tarkin header type */
return (-TARKIN_BAD_HEADER);
break;
default:
/* Not a valid tarkin header type */
return (-TARKIN_BAD_HEADER);
break;
}
}
}
@ -462,10 +462,10 @@ _tarkin_pack_comment (oggpack_buffer * opb, TarkinComment * vc)
for (i = 0; i < vc->comments; i++) {
if (vc->user_comments[i]) {
oggpack_write (opb, vc->comment_lengths[i], 32);
_v_writestring (opb, vc->user_comments[i], vc->comment_lengths[i]);
oggpack_write (opb, vc->comment_lengths[i], 32);
_v_writestring (opb, vc->user_comments[i], vc->comment_lengths[i]);
} else {
oggpack_write (opb, 0, 32);
oggpack_write (opb, 0, 32);
}
}
}
@ -503,9 +503,9 @@ _tarkin_pack_layer_desc (oggpack_buffer * opb, TarkinInfo * vi)
#ifdef DBG_OGG
printf (" res. %dx%d, format %d, a_m %d, s_m %d, fpb %d\n",
layer->desc.width, layer->desc.height, layer->desc.format,
layer->desc.a_moments, layer->desc.s_moments,
layer->desc.frames_per_buf);
layer->desc.width, layer->desc.height, layer->desc.format,
layer->desc.a_moments, layer->desc.s_moments,
layer->desc.frames_per_buf);
#endif
}

View file

@ -16,7 +16,8 @@ typedef struct
char *allocated_in_func;
char *allocated_in_file;
unsigned int allocated_in_line;
} MemDesc;
}
MemDesc;
static int initialized = 0;
@ -38,8 +39,8 @@ dbg_memleaks_done (int exitcode, void *dummy)
MemDesc *d = &alloc_list[i];
fprintf (stderr, "chunk %p allocated in %s (%s: %u) not free'd !!\n",
d->mem, d->allocated_in_func, d->allocated_in_file,
d->allocated_in_line);
d->mem, d->allocated_in_func, d->allocated_in_file,
d->allocated_in_line);
}
free (alloc_list);
}
@ -114,9 +115,9 @@ dbg_realloc (char *file, int line, char *func, char *what,
if (mem != NULL) {
fprintf (stderr,
"%s: trying to reallocate unknown chunk %p (%s)\n"
" in %s (%s: %u) !!!\n",
__FUNCTION__, mem, what, func, file, line);
"%s: trying to reallocate unknown chunk %p (%s)\n"
" in %s (%s: %u) !!!\n",
__FUNCTION__, mem, what, func, file, line);
exit (-1);
}
@ -137,7 +138,7 @@ dbg_free (char *file, int line, char *func, char *what, void *mem)
free (mem);
alloc_count--;
memmove (&alloc_list[i], &alloc_list[i + 1],
(alloc_count - i) * sizeof (MemDesc));
(alloc_count - i) * sizeof (MemDesc));
return;
}
}

View file

@ -42,8 +42,8 @@ tarkin_stream_destroy (TarkinStream * s)
for (i = 0; i < s->n_layers; i++) {
if (s->layer[i].waveletbuf) {
for (j = 0; j < s->layer[i].n_comp; j++) {
wavelet_3d_buf_destroy (s->layer[i].waveletbuf[j]);
FREE (s->layer[i].packet[j].data);
wavelet_3d_buf_destroy (s->layer[i].waveletbuf[j]);
FREE (s->layer[i].packet[j].data);
}
FREE (s->layer[i].waveletbuf);
FREE (s->layer[i].packet);
@ -141,7 +141,7 @@ tarkin_analysis_add_layer (TarkinStream * s, TarkinVideoLayerDesc * tvld)
for (i = 0; i < layer->n_comp; i++) {
layer->waveletbuf[i] = wavelet_3d_buf_new (layer->desc.width,
layer->desc.height, layer->desc.frames_per_buf);
layer->desc.height, layer->desc.frames_per_buf);
layer->packet[i].data = MALLOC (layer->desc.bitstream_len);
layer->packet[i].storage = layer->desc.bitstream_len;
}
@ -165,7 +165,7 @@ _analysis_packetout (TarkinStream * s, uint32_t layer_id, uint32_t comp)
data_len = s->layer[layer_id].packet[comp].data_len;
oggpack_writeinit (&opb);
oggpack_write (&opb, 0, 8); /* No feature flags for now */
oggpack_write (&opb, 0, 8); /* No feature flags for now */
oggpack_write (&opb, layer_id, 12);
oggpack_write (&opb, comp, 12);
for (i = 0; i < data_len; i++)
@ -180,7 +180,7 @@ _analysis_packetout (TarkinStream * s, uint32_t layer_id, uint32_t comp)
printf ("dbg_ogg: writing packet layer %d, comp %d, data_len %d %s\n",
layer_id, comp, data_len, op.e_o_s ? "eos" : "");
#endif
s->layer[layer_id].packet[comp].data_len = 0; /* so direct call => eos */
s->layer[layer_id].packet[comp].data_len = 0; /* so direct call => eos */
return (s->packet_out (s, &op));
}
@ -198,31 +198,31 @@ _stream_flush (TarkinStream * s)
uint32_t comp_bitstream_len;
TarkinPacket *packet = layer->packet + j;
/**
/**
* implicit 6:1:1 subsampling
*/
if (j == 0)
comp_bitstream_len =
6 * layer->desc.bitstream_len / (layer->n_comp + 5);
comp_bitstream_len =
6 * layer->desc.bitstream_len / (layer->n_comp + 5);
else
comp_bitstream_len = layer->desc.bitstream_len / (layer->n_comp + 5);
comp_bitstream_len = layer->desc.bitstream_len / (layer->n_comp + 5);
if (packet->storage < comp_bitstream_len) {
packet->storage = comp_bitstream_len;
packet->data = REALLOC (packet->data, comp_bitstream_len);
packet->storage = comp_bitstream_len;
packet->data = REALLOC (packet->data, comp_bitstream_len);
}
wavelet_3d_buf_dump ("color-%d-%03d.pgm",
s->current_frame, j, layer->waveletbuf[j], j == 0 ? 0 : 128);
s->current_frame, j, layer->waveletbuf[j], j == 0 ? 0 : 128);
wavelet_3d_buf_fwd_xform (layer->waveletbuf[j],
layer->desc.a_moments, layer->desc.s_moments);
layer->desc.a_moments, layer->desc.s_moments);
wavelet_3d_buf_dump ("coeff-%d-%03d.pgm",
s->current_frame, j, layer->waveletbuf[j], 128);
s->current_frame, j, layer->waveletbuf[j], 128);
packet->data_len = wavelet_3d_buf_encode_coeff (layer->waveletbuf[j],
packet->data, comp_bitstream_len);
packet->data, comp_bitstream_len);
_analysis_packetout (s, i, j);
}
@ -237,7 +237,7 @@ tarkin_analysis_framein (TarkinStream * s, uint8_t * frame,
TarkinVideoLayer *layer;
if (!frame)
return (_analysis_packetout (s, 0, 0)); /* eos */
return (_analysis_packetout (s, 0, 0)); /* eos */
if ((layer_id >= s->n_layers) || (date->denominator == 0))
return (TARKIN_FAULT);
@ -286,7 +286,7 @@ TarkinError
tarkin_synthesis_init (TarkinStream * s, TarkinInfo * ti)
{
s->ti = ti;
s->layer = ti->layer; /* It was malloc()ed by headerin() */
s->layer = ti->layer; /* It was malloc()ed by headerin() */
s->n_layers = ti->n_layers;
return (TARKIN_OK);
}
@ -307,17 +307,17 @@ tarkin_synthesis_packetin (TarkinStream * s, ogg_packet * op)
#endif
oggpack_readinit (&opb, op->packet, op->bytes);
flags = oggpack_read (&opb, 8);
layer_id = oggpack_read (&opb, 12); /* Theses are required for */
comp = oggpack_read (&opb, 12); /* data hole handling (or maybe
* packetno would be enough ?) */
layer_id = oggpack_read (&opb, 12); /* Theses are required for */
comp = oggpack_read (&opb, 12); /* data hole handling (or maybe
* packetno would be enough ?) */
nread = 4;
if (flags) { /* This is void "infinite future features" feature ;) */
if (flags) { /* This is void "infinite future features" feature ;) */
if (flags & 1 << 7) {
junk = flags;
while (junk & 1 << 7)
junk = oggpack_read (&opb, 8); /* allow for many future flags
that must be correctly ordonned. */
junk = oggpack_read (&opb, 8); /* allow for many future flags
that must be correctly ordonned. */
}
/* This shows how to get a feature's data:
if (flags & TARKIN_FLAGS_EXAMPLE){
@ -326,7 +326,7 @@ tarkin_synthesis_packetin (TarkinStream * s, ogg_packet * op)
tp->example &= 0x4fffffff;
}
*/
for (junk = 1 << 31; junk & 1 << 31;) /* and many future data */
for (junk = 1 << 31; junk & 1 << 31;) /* and many future data */
while ((junk = oggpack_read (&opb, 32)) & 1 << 30);
/* That is, feature data comes in 30 bit chunks. We also have
* 31 potentially usefull bits in last chunk. */
@ -343,7 +343,7 @@ tarkin_synthesis_packetin (TarkinStream * s, ogg_packet * op)
/* We now have for shure our data. */
packet = &s->layer[layer_id].packet[comp];
if (packet->data_len)
return (-TARKIN_UNUSED); /* Previous data wasn't used */
return (-TARKIN_UNUSED); /* Previous data wasn't used */
if (packet->storage < data_len) {
packet->storage = data_len + 255;
@ -371,19 +371,19 @@ tarkin_synthesis_frameout (TarkinStream * s,
TarkinPacket *packet = layer->packet + j;
if (packet->data_len == 0)
goto err_out;
goto err_out;
wavelet_3d_buf_decode_coeff (layer->waveletbuf[j], packet->data,
packet->data_len);
packet->data_len);
wavelet_3d_buf_dump ("rcoeff-%d-%03d.pgm",
s->current_frame, j, layer->waveletbuf[j], 128);
s->current_frame, j, layer->waveletbuf[j], 128);
wavelet_3d_buf_inv_xform (layer->waveletbuf[j],
layer->desc.a_moments, layer->desc.s_moments);
layer->desc.a_moments, layer->desc.s_moments);
wavelet_3d_buf_dump ("rcolor-%d-%03d.pgm",
s->current_frame, j, layer->waveletbuf[j], j == 0 ? 0 : 128);
s->current_frame, j, layer->waveletbuf[j], j == 0 ? 0 : 128);
}
/* We did successfylly read a block from this layer, acknowledge it. */

View file

@ -118,7 +118,7 @@ wavelet_3d_buf_dump (char *fmt,
snprintf (fname, 256, fmt, id, first_frame_in_buf + f);
write_pgm16 (fname, buf->data + f * buf->width * buf->height,
buf->width, buf->height, offset);
buf->width, buf->height, offset);
}
}
#endif

View file

@ -104,15 +104,15 @@ skip_0coeffs (Wavelet3DBuf * buf,
uint32_t runlength = ENTROPY_CODER_RUNLENGTH (&s_stream[i]);
if (i == 0)
runlength /= 2; /* sign bits are in this bitplane ... */
runlength /= 2; /* sign bits are in this bitplane ... */
if (skip > runlength)
skip = runlength;
skip = runlength;
if (skip <= 2)
return 0;
return 0;
}
}
ENTROPY_CODER_SKIP (&s_stream[0], 2 * skip); /* kill sign+significance bits */
ENTROPY_CODER_SKIP (&s_stream[0], 2 * skip); /* kill sign+significance bits */
for (i = 1; i < TYPE_BITS; i++)
ENTROPY_CODER_SKIP (&s_stream[i], skip);
@ -134,11 +134,11 @@ encode_quadrant (const Wavelet3DBuf * buf,
for (z = 0; z < f; z++) {
for (y = 0; y < h; y++) {
for (x = 0; x < w; x++) {
unsigned int index = buf->offset[level][quadrant]
+ z * buf->width * buf->height + y * buf->width + x;
unsigned int index = buf->offset[level][quadrant]
+ z * buf->width * buf->height + y * buf->width + x;
encode_coeff (significand_bitstream, insignificand_bitstream,
buf->data[index]);
encode_coeff (significand_bitstream, insignificand_bitstream,
buf->data[index]);
}
}
}
@ -194,28 +194,28 @@ decode_quadrant (Wavelet3DBuf * buf,
do {
x = 0;
do {
uint32_t skip;
uint32_t index = buf->offset[level][quadrant]
+ z * buf->width * buf->height + y * buf->width + x;
uint32_t skip;
uint32_t index = buf->offset[level][quadrant]
+ z * buf->width * buf->height + y * buf->width + x;
buf->data[index] = decode_coeff (s_stream, i_stream);
buf->data[index] = decode_coeff (s_stream, i_stream);
skip = skip_0coeffs (buf, s_stream, i_stream,
(w - x - 1) + (h - y - 1) * w + (f - z - 1) * w * h);
if (skip > 0) {
x += skip;
while (x >= w) {
y++;
x -= w;
while (y >= h) {
z++;
y -= h;
if (z >= f)
return;
}
}
}
x++;
skip = skip_0coeffs (buf, s_stream, i_stream,
(w - x - 1) + (h - y - 1) * w + (f - z - 1) * w * h);
if (skip > 0) {
x += skip;
while (x >= w) {
y++;
x -= w;
while (y >= h) {
z++;
y -= h;
if (z >= f)
return;
}
}
}
x++;
} while (x < w);
y++;
} while (y < h);
@ -285,7 +285,7 @@ decode_coefficients (Wavelet3DBuf * buf,
buf->data[i] = decode_coeff (s_stream, i_stream);
skip = skip_0coeffs (buf, s_stream, i_stream,
buf->width * buf->height * buf->frames - i);
buf->width * buf->height * buf->frames - i);
i += skip;
}
}
@ -304,10 +304,10 @@ setup_limittabs (ENTROPY_CODER significand_bitstream[],
uint32_t byte_count;
int i;
assert (limit > 2 * TYPE_BITS * sizeof (uint32_t)); /* limit too small */
assert (limit > 2 * TYPE_BITS * sizeof (uint32_t)); /* limit too small */
printf ("%s: limit == %u\n", __FUNCTION__, limit);
byte_count = 2 * TYPE_BITS * sizeof (uint32_t); /* 2 binary coded limittabs */
byte_count = 2 * TYPE_BITS * sizeof (uint32_t); /* 2 binary coded limittabs */
limit -= byte_count;
printf ("%s: rem. limit == %u\n", __FUNCTION__, limit);
@ -342,9 +342,9 @@ setup_limittabs (ENTROPY_CODER significand_bitstream[],
byte_count += insignificand_limittab[i];
printf ("insignificand_limittab[%i] == %u / %u\n",
i, insignificand_limittab[i], i_bytes);
i, insignificand_limittab[i], i_bytes);
printf (" significand_limittab[%i] == %u / %u\n",
i, significand_limittab[i], s_bytes);
i, significand_limittab[i], s_bytes);
significand_limit -= significand_limittab[i];
insignificand_limit -= insignificand_limittab[i];
@ -394,7 +394,7 @@ read_limittabs (uint8_t * bitstream,
for (i = 0; i < TYPE_BITS; i++) {
insignificand_limittab[i] = *(uint32_t *) bitstream;
printf ("insignificand_limittab[%i] == %u\n", i,
insignificand_limittab[i]);
insignificand_limittab[i]);
bitstream += 4;
}
@ -415,16 +415,16 @@ merge_bitstreams (uint8_t * bitstream,
for (i = TYPE_BITS - 1; i >= 0; i--) {
memcpy (bitstream,
ENTROPY_CODER_BITSTREAM (&significand_bitstream[i]),
significand_limittab[i]);
ENTROPY_CODER_BITSTREAM (&significand_bitstream[i]),
significand_limittab[i]);
bitstream += significand_limittab[i];
}
for (i = TYPE_BITS - 1; i >= 0; i--) {
memcpy (bitstream,
ENTROPY_CODER_BITSTREAM (&insignificand_bitstream[i]),
insignificand_limittab[i]);
ENTROPY_CODER_BITSTREAM (&insignificand_bitstream[i]),
insignificand_limittab[i]);
bitstream += insignificand_limittab[i];
}

View file

@ -61,13 +61,13 @@ fwd_analyze_2 (const TYPE * x, TYPE * d, int stride, int n)
if (n & 1) {
for (i = 0; i < k; i++)
d[i] =
x[(2 * i + 1) * stride] - (x[2 * i * stride] + x[(2 * i +
2) * stride]) / 2;
x[(2 * i + 1) * stride] - (x[2 * i * stride] + x[(2 * i +
2) * stride]) / 2;
} else {
for (i = 0; i < k - 1; i++)
d[i] =
x[(2 * i + 1) * stride] - (x[2 * i * stride] + x[(2 * i +
2) * stride]) / 2;
x[(2 * i + 1) * stride] - (x[2 * i * stride] + x[(2 * i +
2) * stride]) / 2;
d[k - 1] = x[(n - 1) * stride] - x[(n - 2) * stride];
}
}
@ -95,11 +95,11 @@ inv_analyze_2 (TYPE * x, const TYPE * d, int stride, int n)
if (n & 1) {
for (i = 0; i < k; i++)
x[(2 * i + 1) * stride] =
d[i] + (x[2 * i * stride] + x[(2 * i + 2) * stride]) / 2;
d[i] + (x[2 * i * stride] + x[(2 * i + 2) * stride]) / 2;
} else {
for (i = 0; i < k - 1; i++)
x[(2 * i + 1) * stride] =
d[i] + (x[2 * i * stride] + x[(2 * i + 2) * stride]) / 2;
d[i] + (x[2 * i * stride] + x[(2 * i + 2) * stride]) / 2;
x[(n - 1) * stride] = d[k - 1] + x[(n - 2) * stride];
}
}
@ -129,20 +129,20 @@ fwd_analyze_4 (const TYPE * x, TYPE * d, int stride, int n)
if (n & 1) {
for (i = 1; i < k - 1; i++)
d[i] = x[(2 * i + 1) * stride]
- ((uint32_t) 9 * (x[2 * i * stride] + x[(2 * i + 2) * stride])
- (x[(2 * i - 2) * stride] + x[(2 * i + 4) * stride])) / 16;
- ((uint32_t) 9 * (x[2 * i * stride] + x[(2 * i + 2) * stride])
- (x[(2 * i - 2) * stride] + x[(2 * i + 4) * stride])) / 16;
if (k > 1)
d[k - 1] =
x[(2 * k - 1) * stride] - (x[(2 * k - 2) * stride] +
x[2 * k * stride]) / 2;
x[(2 * k - 1) * stride] - (x[(2 * k - 2) * stride] +
x[2 * k * stride]) / 2;
} else {
for (i = 1; i < k - 2; i++)
d[i] = x[(2 * i + 1) * stride]
- ((uint32_t) 9 * (x[2 * i * stride] + x[(2 * i + 2) * stride])
- (x[(2 * i - 2) * stride] + x[(2 * i + 4) * stride])) / 16;
- ((uint32_t) 9 * (x[2 * i * stride] + x[(2 * i + 2) * stride])
- (x[(2 * i - 2) * stride] + x[(2 * i + 4) * stride])) / 16;
if (k > 2)
d[k - 2] = x[(2 * k - 3) * stride] - (x[(2 * k - 4) * stride]
+ x[(2 * k - 2) * stride]) / 2;
+ x[(2 * k - 2) * stride]) / 2;
if (k > 1)
d[k - 1] = x[(n - 1) * stride] - x[(n - 2) * stride];
}
@ -159,7 +159,7 @@ fwd_synthesize_4 (const TYPE * x, TYPE * s, const TYPE * d, int stride, int n)
s[stride] = x[2 * stride] + (d[0] + d[1]) / 4;
for (i = 2; i < k - 1; i++)
s[i * stride] = x[2 * i * stride]
+ ((uint32_t) 9 * (d[i - 1] + d[i]) - (d[i - 2] + d[i + 1])) / 32;
+ ((uint32_t) 9 * (d[i - 1] + d[i]) - (d[i - 2] + d[i + 1])) / 32;
if (k > 2)
s[(k - 1) * stride] = x[(2 * k - 2) * stride] + (d[k - 2] + d[k - 1]) / 4;
if (n & 1)
@ -177,19 +177,19 @@ inv_analyze_4 (TYPE * x, const TYPE * d, int stride, int n)
if (n & 1) {
for (i = 1; i < k - 1; i++)
x[(2 * i + 1) * stride] = d[i]
+ ((uint32_t) 9 * (x[2 * i * stride] + x[(2 * i + 2) * stride])
- (x[(2 * i - 2) * stride] + x[(2 * i + 4) * stride])) / 16;
+ ((uint32_t) 9 * (x[2 * i * stride] + x[(2 * i + 2) * stride])
- (x[(2 * i - 2) * stride] + x[(2 * i + 4) * stride])) / 16;
if (k > 1)
x[(2 * k - 1) * stride] =
d[k - 1] + (x[(2 * k - 2) * stride] + x[2 * k * stride]) / 2;
d[k - 1] + (x[(2 * k - 2) * stride] + x[2 * k * stride]) / 2;
} else {
for (i = 1; i < k - 2; i++)
x[(2 * i + 1) * stride] = d[i]
+ (9 * (x[2 * i * stride] + x[(2 * i + 2) * stride])
- (x[(2 * i - 2) * stride] + x[(2 * i + 4) * stride])) / 16;
+ (9 * (x[2 * i * stride] + x[(2 * i + 2) * stride])
- (x[(2 * i - 2) * stride] + x[(2 * i + 4) * stride])) / 16;
if (k > 2)
x[(2 * k - 3) * stride] = d[k - 2] + (x[(2 * k - 4) * stride]
+ x[(2 * k - 2) * stride]) / 2;
+ x[(2 * k - 2) * stride]) / 2;
if (k > 1)
x[(n - 1) * stride] = d[k - 1] + x[(n - 2) * stride];
}
@ -206,7 +206,7 @@ inv_synthesize_4 (TYPE * x, const TYPE * s, const TYPE * d, int stride, int n)
x[2 * stride] = s[1] - (d[0] + d[1]) / 4;
for (i = 2; i < k - 1; i++)
x[2 * i * stride] = s[i] - ((uint32_t) 9 * (d[i - 1] + d[i])
- (d[i - 2] + d[i + 1])) / 32;
- (d[i - 2] + d[i + 1])) / 32;
if (k > 2)
x[(2 * k - 2) * stride] = s[k - 1] - (d[k - 2] + d[k - 1]) / 4;
if (n & 1)
@ -333,11 +333,11 @@ wavelet_3d_buf_fwd_xform (Wavelet3DBuf * buf, int a_moments, int s_moments)
int row, frame;
for (frame = 0; frame < f; frame++) {
for (row = 0; row < h; row++) {
TYPE *data = buf->data + (frame * buf->height + row) * buf->width;
for (row = 0; row < h; row++) {
TYPE *data = buf->data + (frame * buf->height + row) * buf->width;
fwd_xform (buf->scratchbuf, data, 1, w, a_moments, s_moments);
}
fwd_xform (buf->scratchbuf, data, 1, w, a_moments, s_moments);
}
}
}
@ -345,12 +345,12 @@ wavelet_3d_buf_fwd_xform (Wavelet3DBuf * buf, int a_moments, int s_moments)
int col, frame;
for (frame = 0; frame < f; frame++) {
for (col = 0; col < w; col++) {
TYPE *data = buf->data + frame * buf->width * buf->height + col;
for (col = 0; col < w; col++) {
TYPE *data = buf->data + frame * buf->width * buf->height + col;
fwd_xform (buf->scratchbuf, data, buf->width, h,
a_moments, s_moments);
}
fwd_xform (buf->scratchbuf, data, buf->width, h,
a_moments, s_moments);
}
}
}
@ -358,12 +358,12 @@ wavelet_3d_buf_fwd_xform (Wavelet3DBuf * buf, int a_moments, int s_moments)
int i, j;
for (j = 0; j < h; j++) {
for (i = 0; i < w; i++) {
TYPE *data = buf->data + j * buf->width + i;
for (i = 0; i < w; i++) {
TYPE *data = buf->data + j * buf->width + i;
fwd_xform (buf->scratchbuf, data, buf->width * buf->height, f,
a_moments, s_moments);
}
fwd_xform (buf->scratchbuf, data, buf->width * buf->height, f,
a_moments, s_moments);
}
}
}
}
@ -384,12 +384,12 @@ wavelet_3d_buf_inv_xform (Wavelet3DBuf * buf, int a_moments, int s_moments)
int i, j;
for (j = 0; j < h; j++) {
for (i = 0; i < w; i++) {
TYPE *data = buf->data + j * buf->width + i;
for (i = 0; i < w; i++) {
TYPE *data = buf->data + j * buf->width + i;
inv_xform (buf->scratchbuf, data, buf->width * buf->height, f,
a_moments, s_moments);
}
inv_xform (buf->scratchbuf, data, buf->width * buf->height, f,
a_moments, s_moments);
}
}
}
@ -397,12 +397,12 @@ wavelet_3d_buf_inv_xform (Wavelet3DBuf * buf, int a_moments, int s_moments)
int col, frame;
for (frame = 0; frame < f; frame++) {
for (col = 0; col < w; col++) {
TYPE *data = buf->data + frame * buf->width * buf->height + col;
for (col = 0; col < w; col++) {
TYPE *data = buf->data + frame * buf->width * buf->height + col;
inv_xform (buf->scratchbuf, data, buf->width, h,
a_moments, s_moments);
}
inv_xform (buf->scratchbuf, data, buf->width, h,
a_moments, s_moments);
}
}
}
@ -410,11 +410,11 @@ wavelet_3d_buf_inv_xform (Wavelet3DBuf * buf, int a_moments, int s_moments)
int row, frame;
for (frame = 0; frame < f; frame++) {
for (row = 0; row < h; row++) {
TYPE *data = buf->data + (frame * buf->height + row) * buf->width;
for (row = 0; row < h; row++) {
TYPE *data = buf->data + (frame * buf->height + row) * buf->width;
inv_xform (buf->scratchbuf, data, 1, w, a_moments, s_moments);
}
inv_xform (buf->scratchbuf, data, 1, w, a_moments, s_moments);
}
}
}
}

View file

@ -72,7 +72,7 @@ gst_xine_change_state (GstElement * element)
break;
case GST_STATE_READY_TO_NULL:
if (xine->stream != NULL)
gst_xine_free_stream (xine);
gst_xine_free_stream (xine);
break;
default:
GST_ERROR_OBJECT (element, "invalid state change");
@ -107,7 +107,7 @@ gst_xine_get_stream (GstXine * xine)
xine->audio_driver = klass->create_audio_driver (xine);
xine->video_driver = klass->create_video_driver (xine);
xine->stream =
xine_stream_new (klass->xine, xine->audio_driver, xine->video_driver);
xine_stream_new (klass->xine, xine->audio_driver, xine->video_driver);
/* FIXME: fail gracefully */
g_assert (xine->stream);

View file

@ -67,7 +67,8 @@ typedef struct
xine_ao_driver_t driver;
GstXineAudioDec *xine;
gboolean open;
} GstXineAudioDriver;
}
GstXineAudioDriver;
static guint32
_driver_get_capabilities (xine_ao_driver_t * driver)
@ -152,19 +153,19 @@ _driver_status (xine_ao_driver_t * driver, xine_stream_t * stream,
return 0;
structure = gst_caps_get_structure (caps, 0);
*bits = 0; /* FIXME */
*bits = 0; /* FIXME */
if (!gst_structure_get_int (structure, "rate", &temp)) {
g_assert_not_reached (); /* may never happen with negotiated caps */
g_assert_not_reached (); /* may never happen with negotiated caps */
return 0;
}
*rate = temp;
if (!gst_structure_get_int (structure, "channels", &temp)) {
g_assert_not_reached (); /* may never happen with negotiated caps */
g_assert_not_reached (); /* may never happen with negotiated caps */
return 0;
}
*mode = (temp == 2) ? AO_CAP_MODE_STEREO : AO_CAP_MODE_MONO;
if (!gst_structure_get_int (structure, "width", &temp)) {
g_assert_not_reached (); /* may never happen with negotiated caps */
g_assert_not_reached (); /* may never happen with negotiated caps */
return 0;
}
if (temp == 8)
@ -233,11 +234,11 @@ GST_BOILERPLATE (GstXineAudioDec, gst_xine_audio_dec, GstXine, GST_TYPE_XINE)
static void gst_xine_audio_dec_chain (GstPad * pad, GstData * in);
static GstElementStateReturn
gst_xine_audio_dec_change_state (GstElement * element);
gst_xine_audio_dec_change_state (GstElement * element);
/* this function handles the link with other plug-ins */
static GstPadLinkReturn
gst_xine_audio_dec_sink_link (GstPad * pad, const GstCaps * caps)
gst_xine_audio_dec_sink_link (GstPad * pad, const GstCaps * caps)
{
guint temp;
GstStructure *structure;
@ -255,7 +256,7 @@ GST_BOILERPLATE (GstXineAudioDec, gst_xine_audio_dec, GstXine, GST_TYPE_XINE)
xine->wave.nChannels = temp;
if (gst_structure_get_int (structure, "rate", &temp))
xine->wave.nSamplesPerSec = temp;
xine->wave.wBitsPerSample = 16; /* FIXME: how do we figure this thing out? */
xine->wave.wBitsPerSample = 16; /* FIXME: how do we figure this thing out? */
/* FIXME: fill wave header better */
return GST_PAD_LINK_OK;
@ -304,7 +305,7 @@ gst_xine_audio_dec_chain (GstPad * pad, GstData * in)
if (xine->format == 0) {
/* no caps yet */
GST_ELEMENT_ERROR (xine, CORE, NEGOTIATION, (NULL),
("buffer sent before doing caps nego"));
("buffer sent before doing caps nego"));
gst_data_unref (in);
return;
}
@ -329,7 +330,7 @@ gst_xine_audio_dec_chain (GstPad * pad, GstData * in)
/* FIXME: qdm2 only right now */
g_assert (gst_pad_get_negotiated_caps (xine->sinkpad));
structure =
gst_caps_get_structure (gst_pad_get_negotiated_caps (xine->sinkpad), 0);
gst_caps_get_structure (gst_pad_get_negotiated_caps (xine->sinkpad), 0);
*((guint32 *) & stsd[56]) = GUINT32_TO_BE (12);
memcpy (&stsd[60], "frmaQDM2", 8);
*((guint32 *) & stsd[68]) = GUINT32_TO_BE (36);
@ -409,7 +410,7 @@ gst_xine_audio_dec_change_state (GstElement * element)
case GST_STATE_NULL_TO_READY:
xine->decoder = _load_decoder (xine);
if (!xine->decoder)
return GST_STATE_FAILURE;
return GST_STATE_FAILURE;
break;
case GST_STATE_READY_TO_PAUSED:
break;
@ -422,7 +423,7 @@ gst_xine_audio_dec_change_state (GstElement * element)
case GST_STATE_READY_TO_NULL:
xine->setup = FALSE;
_x_free_audio_decoder (gst_xine_get_stream (GST_XINE (xine)),
xine->decoder);
xine->decoder);
break;
default:
GST_ERROR_OBJECT (element, "invalid state change");
@ -439,17 +440,17 @@ static GstStaticPadTemplate src_template = GST_STATIC_PAD_TEMPLATE ("src",
GST_PAD_SRC,
GST_PAD_ALWAYS,
GST_STATIC_CAPS ("audio/x-raw-int, "
"endianness = (int) BYTE_ORDER, "
"signed = (boolean) TRUE, "
"width = (int) 16, "
"depth = (int) 16, "
"rate = (int) [ 1, MAX ], "
"channels = (int) [ 1, 2 ]; "
"audio/x-raw-int, "
"signed = (boolean) FALSE, "
"width = (int) 8, "
"depth = (int) 8, "
"rate = (int) [ 1, MAX ], " "channels = (int) [ 1, 2 ]")
"endianness = (int) BYTE_ORDER, "
"signed = (boolean) TRUE, "
"width = (int) 16, "
"depth = (int) 16, "
"rate = (int) [ 1, MAX ], "
"channels = (int) [ 1, 2 ]; "
"audio/x-raw-int, "
"signed = (boolean) FALSE, "
"width = (int) 8, "
"depth = (int) 8, "
"rate = (int) [ 1, MAX ], " "channels = (int) [ 1, 2 ]")
);
static void
@ -483,7 +484,7 @@ gst_xine_audio_dec_subclass_init (gpointer g_class, gpointer class_data)
while (dec->supported_types[i] != 0) {
const gchar *type_str =
gst_xine_get_caps_for_format (dec->supported_types[i]);
gst_xine_get_caps_for_format (dec->supported_types[i]);
if (type_str) {
gst_caps_append (caps, gst_caps_from_string (type_str));
}
@ -501,14 +502,14 @@ gst_xine_audio_dec_sub_init (GTypeInstance * instance, gpointer g_class)
xine->sinkpad =
gst_pad_new_from_template (gst_element_class_get_pad_template (klass,
"sink"), "sink");
"sink"), "sink");
gst_pad_set_link_function (xine->sinkpad, gst_xine_audio_dec_sink_link);
gst_pad_set_chain_function (xine->sinkpad, gst_xine_audio_dec_chain);
gst_element_add_pad (GST_ELEMENT (xine), xine->sinkpad);
xine->srcpad =
gst_pad_new_from_template (gst_element_class_get_pad_template (klass,
"src"), "src");
"src"), "src");
gst_pad_use_explicit_caps (xine->srcpad);
gst_element_add_pad (GST_ELEMENT (xine), xine->srcpad);
}
@ -545,26 +546,26 @@ gst_xine_audio_dec_init_plugin (GstPlugin * plugin)
dec = node->info->special_info;
while (dec->supported_types[format] != 0) {
const gchar *caps =
gst_xine_get_caps_for_format (dec->supported_types[format]);
gst_xine_get_caps_for_format (dec->supported_types[format]);
if (caps) {
gchar *plugin_name =
g_strdup_printf ("xineaudiodec_%s", node->info->id);
gchar *type_name =
g_strdup_printf ("GstXineAudioDec%s", node->info->id);
GType type;
gchar *plugin_name =
g_strdup_printf ("xineaudiodec_%s", node->info->id);
gchar *type_name =
g_strdup_printf ("GstXineAudioDec%s", node->info->id);
GType type;
plugin_info.class_data = node;
type =
g_type_register_static (GST_TYPE_XINE_AUDIO_DEC, type_name,
&plugin_info, 0);
g_free (type_name);
if (!gst_element_register (plugin, plugin_name,
MAX (GST_RANK_MARGINAL,
GST_RANK_MARGINAL * dec->priority / 10 + 1), type)) {
g_free (plugin_name);
return FALSE;
}
g_free (plugin_name);
plugin_info.class_data = node;
type =
g_type_register_static (GST_TYPE_XINE_AUDIO_DEC, type_name,
&plugin_info, 0);
g_free (type_name);
if (!gst_element_register (plugin, plugin_name,
MAX (GST_RANK_MARGINAL,
GST_RANK_MARGINAL * dec->priority / 10 + 1), type)) {
g_free (plugin_name);
return FALSE;
}
g_free (plugin_name);
}
format++;
}

View file

@ -48,7 +48,7 @@ struct _GstXineAudioSink
GstPad *sinkpad;
ao_driver_t *driver;
guint open; /* number of bytes per sample or 0 if driver not open */
guint open; /* number of bytes per sample or 0 if driver not open */
};
struct _GstXineAudioSinkClass
@ -63,7 +63,7 @@ struct _GstXineAudioSinkClass
GST_BOILERPLATE (GstXineAudioSink, gst_xine_audio_sink, GstXine, GST_TYPE_XINE)
static GstElementStateReturn
gst_xine_audio_sink_change_state (GstElement * element);
gst_xine_audio_sink_change_state (GstElement * element);
static void gst_xine_audio_sink_base_init (gpointer g_class)
{
@ -89,7 +89,7 @@ gst_xine_audio_sink_chain (GstPad * pad, GstData * data)
GST_XINE_AUDIO_SINK (gst_object_get_parent (GST_OBJECT (pad)));
while (xine->driver->write (xine->driver, (guint16 *) GST_BUFFER_DATA (data),
GST_BUFFER_SIZE (data) / xine->open) == 0);
GST_BUFFER_SIZE (data) / xine->open) == 0);
gst_data_unref (GST_DATA (data));
}
@ -104,22 +104,22 @@ gst_xine_audio_sink_change_state (GstElement * element)
switch (GST_STATE_TRANSITION (element)) {
case GST_STATE_NULL_TO_READY:
if (driver == NULL) {
xine_audio_port_t *port =
xine_open_audio_driver (GST_XINE_GET_CLASS (xine)->xine,
GST_XINE_AUDIO_SINK_GET_CLASS (xine)->plugin_node->info->id, NULL);
xine_audio_port_t *port =
xine_open_audio_driver (GST_XINE_GET_CLASS (xine)->xine,
GST_XINE_AUDIO_SINK_GET_CLASS (xine)->plugin_node->info->id, NULL);
if (!port)
return GST_STATE_FAILURE;
port->exit (port);
driver =
(audio_driver_class_t *) GST_XINE_AUDIO_SINK_GET_CLASS (xine)->
plugin_node->plugin_class;
if (driver == NULL)
return GST_STATE_FAILURE;
if (!port)
return GST_STATE_FAILURE;
port->exit (port);
driver =
(audio_driver_class_t *) GST_XINE_AUDIO_SINK_GET_CLASS (xine)->
plugin_node->plugin_class;
if (driver == NULL)
return GST_STATE_FAILURE;
}
xine->driver = driver->open_plugin (driver, NULL);
if (!xine->driver)
return GST_STATE_FAILURE;
return GST_STATE_FAILURE;
break;
case GST_STATE_READY_TO_PAUSED:
break;
@ -129,7 +129,7 @@ gst_xine_audio_sink_change_state (GstElement * element)
break;
case GST_STATE_PAUSED_TO_READY:
if (xine->open != 0)
xine->driver->close (xine->driver);
xine->driver->close (xine->driver);
xine->open = 0;
break;
case GST_STATE_READY_TO_NULL:
@ -169,31 +169,31 @@ _xine_audio_sink_get_caps (GstPad * pad)
do {
if (capa & AO_CAP_8BITS) {
caps = gst_caps_from_string ("audio/x-raw-int, "
"signed = (boolean) FALSE, "
"width = (int) 8, "
"depth = (int) 8, " "rate = (int) [ 8000, 192000 ]");
"signed = (boolean) FALSE, "
"width = (int) 8, "
"depth = (int) 8, " "rate = (int) [ 8000, 192000 ]");
capa &= ~AO_CAP_8BITS;
} else {
caps = gst_caps_from_string ("audio/x-raw-int, "
"endianness = (int) BYTE_ORDER, "
"signed = (boolean) TRUE, "
"width = (int) 16, "
"depth = (int) 16, " "rate = (int) [ 8000, 192000 ]");
"endianness = (int) BYTE_ORDER, "
"signed = (boolean) TRUE, "
"width = (int) 16, "
"depth = (int) 16, " "rate = (int) [ 8000, 192000 ]");
capa = -1;
}
switch (channels) {
case AO_CAP_MODE_MONO | AO_CAP_MODE_STEREO:
gst_caps_set_simple (caps, "channels", GST_TYPE_INT_RANGE, 1, 2, NULL);
break;
gst_caps_set_simple (caps, "channels", GST_TYPE_INT_RANGE, 1, 2, NULL);
break;
case AO_CAP_MODE_MONO:
gst_caps_set_simple (caps, "channels", G_TYPE_INT, 1, NULL);
break;
gst_caps_set_simple (caps, "channels", G_TYPE_INT, 1, NULL);
break;
case AO_CAP_MODE_STEREO:
gst_caps_set_simple (caps, "channels", G_TYPE_INT, 2, NULL);
break;
gst_caps_set_simple (caps, "channels", G_TYPE_INT, 2, NULL);
break;
default:
g_assert_not_reached ();
break;
g_assert_not_reached ();
break;
}
gst_caps_append (ret, caps);
} while (capa != -1);
@ -229,7 +229,7 @@ _xine_audio_sink_link (GstPad * pad, const GstCaps * caps)
if (temp != rate) {
/* FIXME? */
GST_WARNING_OBJECT (xine, "rates don't match (requested: %u, got %u)", rate,
temp);
temp);
}
return GST_PAD_LINK_OK;
@ -241,17 +241,17 @@ static GstStaticPadTemplate sink_template = GST_STATIC_PAD_TEMPLATE ("sink",
GST_PAD_SINK,
GST_PAD_ALWAYS,
GST_STATIC_CAPS ("audio/x-raw-int, "
"signed = (boolean) FALSE, "
"width = (int) 8, "
"depth = (int) 8, "
"rate = (int) [ 8000, 192000 ], "
"channels = (int) [1, 2]; "
"audio/x-raw-int, "
"endianness = (int) BYTE_ORDER, "
"signed = (boolean) TRUE, "
"width = (int) 16, "
"depth = (int) 16, "
"rate = (int) [ 8000, 192000 ], " "channels = (int) [1, 2]")
"signed = (boolean) FALSE, "
"width = (int) 8, "
"depth = (int) 8, "
"rate = (int) [ 8000, 192000 ], "
"channels = (int) [1, 2]; "
"audio/x-raw-int, "
"endianness = (int) BYTE_ORDER, "
"signed = (boolean) TRUE, "
"width = (int) 16, "
"depth = (int) 16, "
"rate = (int) [ 8000, 192000 ], " "channels = (int) [1, 2]")
);
static void
@ -286,7 +286,7 @@ gst_xine_audio_sink_sub_init (GTypeInstance * instance, gpointer g_class)
xine->sinkpad =
gst_pad_new_from_template (gst_element_class_get_pad_template (klass,
"sink"), "sink");
"sink"), "sink");
gst_pad_set_chain_function (xine->sinkpad, gst_xine_audio_sink_chain);
gst_pad_set_getcaps_function (xine->sinkpad, _xine_audio_sink_get_caps);
gst_pad_set_link_function (xine->sinkpad, _xine_audio_sink_link);
@ -320,8 +320,8 @@ gst_xine_audio_sink_init_plugin (GstPlugin * plugin)
plugin_info.class_data = node;
type =
g_type_register_static (GST_TYPE_XINE_AUDIO_SINK, type_name,
&plugin_info, 0);
g_type_register_static (GST_TYPE_XINE_AUDIO_SINK, type_name,
&plugin_info, 0);
g_free (type_name);
if (!gst_element_register (plugin, plugin_name, GST_RANK_MARGINAL, type)) {
g_free (plugin_name);

View file

@ -75,7 +75,7 @@ GST_BOILERPLATE (GstXineInput, gst_xine_input, GstXine, GST_TYPE_XINE)
static void gst_xine_input_get_property (GObject * object, guint prop_id,
GValue * value, GParamSpec * pspec);
static GstElementStateReturn
gst_xine_input_change_state (GstElement * element);
gst_xine_input_change_state (GstElement * element);
static void gst_xine_input_base_init (gpointer g_class)
{
@ -95,7 +95,7 @@ gst_xine_input_class_init (GstXineInputClass * klass)
g_object_class_install_property (object, ARG_LOCATION,
g_param_spec_string ("location", "location", "location",
NULL, G_PARAM_READWRITE));
NULL, G_PARAM_READWRITE));
}
static void
@ -123,9 +123,9 @@ gst_xine_input_set_property (GObject * object, guint prop_id,
switch (prop_id) {
case ARG_LOCATION:
if (gst_element_get_state (GST_ELEMENT (xine)) != GST_STATE_NULL)
return;
return;
if (xine->location)
g_free (xine->location);
g_free (xine->location);
xine->location = g_strdup (g_value_get_string (value));
break;
default:
@ -150,7 +150,7 @@ gst_xine_input_get_property (GObject * object, guint prop_id, GValue * value,
}
}
#define BUFFER_SIZE 4096 /* FIXME: what size? */
#define BUFFER_SIZE 4096 /* FIXME: what size? */
static GstData *
gst_xine_input_get (GstPad * pad)
{
@ -176,7 +176,7 @@ gst_xine_input_get (GstPad * pad)
GST_BUFFER_SIZE (buf) = real_size;
if (real_size < 0) {
GST_ELEMENT_ERROR (xine, RESOURCE, READ, (NULL), ("error %d reading data",
real_size));
real_size));
gst_data_unref (GST_DATA (buf));
return NULL;
} else if (real_size == 0) {
@ -184,8 +184,8 @@ gst_xine_input_get (GstPad * pad)
if (xine->input->get_capabilities (xine->input) & INPUT_CAP_BLOCK)
element =
xine->input->read_block (xine->input,
gst_xine_get_stream (GST_XINE (xine))->audio_fifo, xine->blocksize);
xine->input->read_block (xine->input,
gst_xine_get_stream (GST_XINE (xine))->audio_fifo, xine->blocksize);
if (element == NULL) {
/* FIXME: is this EOS? */
gst_element_set_eos (GST_ELEMENT (xine));
@ -213,15 +213,15 @@ gst_xine_input_change_state (GstElement * element)
switch (GST_STATE_TRANSITION (element)) {
case GST_STATE_NULL_TO_READY:
xine->input =
input->get_instance (input, gst_xine_get_stream (GST_XINE (xine)),
xine->location);
input->get_instance (input, gst_xine_get_stream (GST_XINE (xine)),
xine->location);
if (!xine->input)
return GST_STATE_FAILURE;
return GST_STATE_FAILURE;
if (xine->input->open (xine->input) == 0)
return GST_STATE_FAILURE;
return GST_STATE_FAILURE;
xine->blocksize = xine->input->get_blocksize (xine->input);
if (xine->blocksize == 0)
xine->blocksize = BUFFER_SIZE;
xine->blocksize = BUFFER_SIZE;
break;
case GST_STATE_READY_TO_PAUSED:
break;
@ -256,10 +256,10 @@ static GstStaticPadTemplate cdda_template = GST_STATIC_PAD_TEMPLATE ("src",
GST_PAD_SRC,
GST_PAD_ALWAYS,
GST_STATIC_CAPS ("audio/x-raw-int, "
"endianness = (int) LITTLE_ENDIAN, "
"signed = (boolean) true, "
"width = (int) 16, "
"depth = (int) 16, " "rate = (int) 44100, " "channels = (int) 2")
"endianness = (int) LITTLE_ENDIAN, "
"signed = (boolean) true, "
"width = (int) 16, "
"depth = (int) 16, " "rate = (int) 44100, " "channels = (int) 2")
);
static void
@ -285,10 +285,10 @@ gst_xine_input_subclass_init (gpointer g_class, gpointer class_data)
/* FIXME: this is pretty hackish, anyone knows a better idea (xine doesn't) */
if (strcmp (input->get_identifier (input), "cdda") == 0) {
gst_element_class_add_pad_template (element_class,
gst_static_pad_template_get (&cdda_template));
gst_static_pad_template_get (&cdda_template));
} else {
gst_element_class_add_pad_template (element_class,
gst_static_pad_template_get (&any_template));
gst_static_pad_template_get (&any_template));
}
}
@ -300,7 +300,7 @@ gst_xine_input_sub_init (GTypeInstance * instance, gpointer g_class)
xine->srcpad =
gst_pad_new_from_template (gst_element_class_get_pad_template (klass,
"src"), "src");
"src"), "src");
gst_pad_set_get_function (xine->srcpad, gst_xine_input_get);
gst_element_add_pad (GST_ELEMENT (xine), xine->srcpad);
}
@ -332,8 +332,8 @@ gst_xine_input_init_plugin (GstPlugin * plugin)
plugin_info.class_data = node;
type =
g_type_register_static (GST_TYPE_XINE_INPUT, type_name, &plugin_info,
0);
g_type_register_static (GST_TYPE_XINE_INPUT, type_name, &plugin_info,
0);
g_free (type_name);
if (!gst_element_register (plugin, plugin_name, GST_RANK_MARGINAL, type)) {
g_free (plugin_name);

View file

@ -99,30 +99,30 @@ gst_xvid_structure_to_csp (GstStructure * structure,
gst_structure_get_fourcc (structure, "format", &fourcc);
switch (fourcc) {
case GST_MAKE_FOURCC ('I', '4', '2', '0'):
xvid_cs = XVID_CSP_I420;
stride = w;
bpp = 12;
break;
xvid_cs = XVID_CSP_I420;
stride = w;
bpp = 12;
break;
case GST_MAKE_FOURCC ('Y', 'U', 'Y', '2'):
xvid_cs = XVID_CSP_YUY2;
stride = w * 2;
bpp = 16;
break;
xvid_cs = XVID_CSP_YUY2;
stride = w * 2;
bpp = 16;
break;
case GST_MAKE_FOURCC ('Y', 'V', '1', '2'):
xvid_cs = XVID_CSP_YV12;
stride = w;
bpp = 12;
break;
xvid_cs = XVID_CSP_YV12;
stride = w;
bpp = 12;
break;
case GST_MAKE_FOURCC ('U', 'Y', 'V', 'Y'):
xvid_cs = XVID_CSP_UYVY;
stride = w * 2;
bpp = 16;
break;
xvid_cs = XVID_CSP_UYVY;
stride = w * 2;
bpp = 16;
break;
case GST_MAKE_FOURCC ('Y', 'V', 'Y', 'U'):
xvid_cs = XVID_CSP_YVYU;
stride = w * 2;
bpp = 16;
break;
xvid_cs = XVID_CSP_YVYU;
stride = w * 2;
bpp = 16;
break;
}
} else {
gint depth, r_mask;
@ -133,35 +133,35 @@ gst_xvid_structure_to_csp (GstStructure * structure,
switch (depth) {
case 15:
xvid_cs = XVID_CSP_RGB555;
break;
xvid_cs = XVID_CSP_RGB555;
break;
case 16:
xvid_cs = XVID_CSP_RGB565;
break;
xvid_cs = XVID_CSP_RGB565;
break;
case 24:
if (bpp == 24) {
xvid_cs = XVID_CSP_BGR;
} else {
switch (r_mask) {
case 0xff000000:
xvid_cs = XVID_CSP_RGBA;
break;
if (bpp == 24) {
xvid_cs = XVID_CSP_BGR;
} else {
switch (r_mask) {
case 0xff000000:
xvid_cs = XVID_CSP_RGBA;
break;
#ifdef XVID_CSP_ARGB
case 0x00ff0000:
xvid_cs = XVID_CSP_ARGB;
break;
case 0x00ff0000:
xvid_cs = XVID_CSP_ARGB;
break;
#endif
case 0x0000ff00:
xvid_cs = XVID_CSP_BGRA;
break;
case 0x000000ff:
xvid_cs = XVID_CSP_ABGR;
break;
}
}
break;
case 0x0000ff00:
xvid_cs = XVID_CSP_BGRA;
break;
case 0x000000ff:
xvid_cs = XVID_CSP_ABGR;
break;
}
}
break;
default:
break;
break;
}
stride = w * bpp / 8;
@ -191,79 +191,79 @@ gst_xvid_csp_to_caps (gint csp, gint w, gint h, gdouble fps)
#endif
case XVID_CSP_RGBA:{
gint r_mask = 0, b_mask = 0, g_mask = 0,
endianness = 0, bpp = 0, depth = 0;
endianness = 0, bpp = 0, depth = 0;
switch (csp) {
case XVID_CSP_RGB555:
r_mask = GST_VIDEO_RED_MASK_15_INT;
g_mask = GST_VIDEO_GREEN_MASK_15_INT;
b_mask = GST_VIDEO_BLUE_MASK_15_INT;
endianness = G_BYTE_ORDER;
depth = 15;
bpp = 16;
break;
case XVID_CSP_RGB565:
r_mask = GST_VIDEO_RED_MASK_16_INT;
g_mask = GST_VIDEO_GREEN_MASK_16_INT;
b_mask = GST_VIDEO_BLUE_MASK_16_INT;
endianness = G_BYTE_ORDER;
depth = 16;
bpp = 16;
break;
case XVID_CSP_BGR:
r_mask = 0x0000ff;
g_mask = 0x00ff00;
b_mask = 0xff0000;
endianness = G_BIG_ENDIAN;
depth = 24;
bpp = 24;
break;
case XVID_CSP_ABGR:
r_mask = 0x000000ff;
g_mask = 0x0000ff00;
b_mask = 0x00ff0000;
endianness = G_BIG_ENDIAN;
depth = 24;
bpp = 32;
break;
case XVID_CSP_BGRA:
r_mask = 0x0000ff00;
g_mask = 0x00ff0000;
b_mask = 0xff000000;
endianness = G_BIG_ENDIAN;
depth = 24;
bpp = 32;
break;
case XVID_CSP_RGB555:
r_mask = GST_VIDEO_RED_MASK_15_INT;
g_mask = GST_VIDEO_GREEN_MASK_15_INT;
b_mask = GST_VIDEO_BLUE_MASK_15_INT;
endianness = G_BYTE_ORDER;
depth = 15;
bpp = 16;
break;
case XVID_CSP_RGB565:
r_mask = GST_VIDEO_RED_MASK_16_INT;
g_mask = GST_VIDEO_GREEN_MASK_16_INT;
b_mask = GST_VIDEO_BLUE_MASK_16_INT;
endianness = G_BYTE_ORDER;
depth = 16;
bpp = 16;
break;
case XVID_CSP_BGR:
r_mask = 0x0000ff;
g_mask = 0x00ff00;
b_mask = 0xff0000;
endianness = G_BIG_ENDIAN;
depth = 24;
bpp = 24;
break;
case XVID_CSP_ABGR:
r_mask = 0x000000ff;
g_mask = 0x0000ff00;
b_mask = 0x00ff0000;
endianness = G_BIG_ENDIAN;
depth = 24;
bpp = 32;
break;
case XVID_CSP_BGRA:
r_mask = 0x0000ff00;
g_mask = 0x00ff0000;
b_mask = 0xff000000;
endianness = G_BIG_ENDIAN;
depth = 24;
bpp = 32;
break;
#ifdef XVID_CSP_ARGB
case XVID_CSP_ARGB:
r_mask = 0x00ff0000;
g_mask = 0x0000ff00;
b_mask = 0x000000ff;
endianness = G_BIG_ENDIAN;
depth = 24;
bpp = 32;
break;
case XVID_CSP_ARGB:
r_mask = 0x00ff0000;
g_mask = 0x0000ff00;
b_mask = 0x000000ff;
endianness = G_BIG_ENDIAN;
depth = 24;
bpp = 32;
break;
#endif
case XVID_CSP_RGBA:
r_mask = 0xff000000;
g_mask = 0x00ff0000;
b_mask = 0x0000ff00;
endianness = G_BIG_ENDIAN;
depth = 24;
bpp = 32;
break;
case XVID_CSP_RGBA:
r_mask = 0xff000000;
g_mask = 0x00ff0000;
b_mask = 0x0000ff00;
endianness = G_BIG_ENDIAN;
depth = 24;
bpp = 32;
break;
}
caps = gst_caps_new_simple ("video/x-raw-rgb",
"width", G_TYPE_INT, w,
"height", G_TYPE_INT, h,
"depth", G_TYPE_INT, depth,
"bpp", G_TYPE_INT, bpp,
"endianness", G_TYPE_INT, endianness,
"red_mask", G_TYPE_INT, r_mask,
"green_mask", G_TYPE_INT, g_mask,
"blue_mask", G_TYPE_INT, b_mask,
"framerate", G_TYPE_DOUBLE, fps, NULL);
"width", G_TYPE_INT, w,
"height", G_TYPE_INT, h,
"depth", G_TYPE_INT, depth,
"bpp", G_TYPE_INT, bpp,
"endianness", G_TYPE_INT, endianness,
"red_mask", G_TYPE_INT, r_mask,
"green_mask", G_TYPE_INT, g_mask,
"blue_mask", G_TYPE_INT, b_mask,
"framerate", G_TYPE_DOUBLE, fps, NULL);
break;
}
@ -275,28 +275,28 @@ gst_xvid_csp_to_caps (gint csp, gint w, gint h, gdouble fps)
guint32 fourcc = 0;
switch (csp) {
case XVID_CSP_YUY2:
fourcc = GST_MAKE_FOURCC ('Y', 'U', 'Y', '2');
break;
case XVID_CSP_YVYU:
fourcc = GST_MAKE_FOURCC ('Y', 'V', 'Y', 'U');
break;
case XVID_CSP_UYVY:
fourcc = GST_MAKE_FOURCC ('U', 'Y', 'V', 'Y');
break;
case XVID_CSP_I420:
fourcc = GST_MAKE_FOURCC ('I', '4', '2', '0');
break;
case XVID_CSP_YV12:
fourcc = GST_MAKE_FOURCC ('Y', 'V', '1', '2');
break;
case XVID_CSP_YUY2:
fourcc = GST_MAKE_FOURCC ('Y', 'U', 'Y', '2');
break;
case XVID_CSP_YVYU:
fourcc = GST_MAKE_FOURCC ('Y', 'V', 'Y', 'U');
break;
case XVID_CSP_UYVY:
fourcc = GST_MAKE_FOURCC ('U', 'Y', 'V', 'Y');
break;
case XVID_CSP_I420:
fourcc = GST_MAKE_FOURCC ('I', '4', '2', '0');
break;
case XVID_CSP_YV12:
fourcc = GST_MAKE_FOURCC ('Y', 'V', '1', '2');
break;
}
caps = gst_caps_new_simple ("video/x-raw-yuv",
"width", G_TYPE_INT, w,
"height", G_TYPE_INT, h,
"format", GST_TYPE_FOURCC, fourcc,
"framerate", G_TYPE_DOUBLE, fps, NULL);
"width", G_TYPE_INT, w,
"height", G_TYPE_INT, h,
"format", GST_TYPE_FOURCC, fourcc,
"framerate", G_TYPE_DOUBLE, fps, NULL);
break;
}
}
@ -309,9 +309,9 @@ static gboolean
plugin_init (GstPlugin * plugin)
{
return (gst_element_register (plugin, "xvidenc",
GST_RANK_NONE, GST_TYPE_XVIDENC) &&
GST_RANK_NONE, GST_TYPE_XVIDENC) &&
gst_element_register (plugin, "xviddec",
GST_RANK_SECONDARY, GST_TYPE_XVIDDEC));
GST_RANK_SECONDARY, GST_TYPE_XVIDDEC));
}
GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,

View file

@ -39,20 +39,20 @@ static GstStaticPadTemplate sink_template = GST_STATIC_PAD_TEMPLATE ("sink",
GST_PAD_SINK,
GST_PAD_ALWAYS,
GST_STATIC_CAPS ("video/x-xvid, "
"width = (int) [ 0, MAX ], "
"height = (int) [ 0, MAX ], " "framerate = (double) [ 0, MAX ]")
"width = (int) [ 0, MAX ], "
"height = (int) [ 0, MAX ], " "framerate = (double) [ 0, MAX ]")
);
static GstStaticPadTemplate src_template = GST_STATIC_PAD_TEMPLATE ("src",
GST_PAD_SRC,
GST_PAD_ALWAYS,
GST_STATIC_CAPS (GST_VIDEO_CAPS_YUV ("{ I420, YUY2, YV12, YVYU, UYVY }")
"; " RGB_24_32_STATIC_CAPS (32, 0x00ff0000, 0x0000ff00,
0x000000ff) "; " RGB_24_32_STATIC_CAPS (32, 0xff000000, 0x00ff0000,
0x0000ff00) "; " RGB_24_32_STATIC_CAPS (32, 0x0000ff00, 0x00ff0000,
0xff000000) "; " RGB_24_32_STATIC_CAPS (32, 0x000000ff, 0x0000ff00,
0x00ff0000) "; " RGB_24_32_STATIC_CAPS (24, 0x0000ff, 0x00ff00,
0xff0000) "; " GST_VIDEO_CAPS_RGB_15 "; " GST_VIDEO_CAPS_RGB_16)
"; " RGB_24_32_STATIC_CAPS (32, 0x00ff0000, 0x0000ff00,
0x000000ff) "; " RGB_24_32_STATIC_CAPS (32, 0xff000000, 0x00ff0000,
0x0000ff00) "; " RGB_24_32_STATIC_CAPS (32, 0x0000ff00, 0x00ff0000,
0xff000000) "; " RGB_24_32_STATIC_CAPS (32, 0x000000ff, 0x0000ff00,
0x00ff0000) "; " RGB_24_32_STATIC_CAPS (24, 0x0000ff, 0x00ff00,
0xff0000) "; " GST_VIDEO_CAPS_RGB_15 "; " GST_VIDEO_CAPS_RGB_16)
);
@ -103,8 +103,9 @@ gst_xviddec_get_type (void)
0,
(GInstanceInitFunc) gst_xviddec_init,
};
xviddec_type = g_type_register_static (GST_TYPE_ELEMENT,
"GstXvidDec", &xviddec_info, 0);
"GstXvidDec", &xviddec_info, 0);
}
return xviddec_type;
}
@ -187,9 +188,9 @@ gst_xviddec_setup (GstXvidDec * xviddec)
if ((ret = xvid_decore (NULL, XVID_DEC_CREATE, &xdec, NULL)) < 0) {
GST_ELEMENT_ERROR (xviddec, LIBRARY, SETTINGS, (NULL),
("Setting parameters %dx%d@%d failed: %s (%d)",
xviddec->width, xviddec->height, xviddec->csp,
gst_xvid_error (ret), ret));
("Setting parameters %dx%d@%d failed: %s (%d)",
xviddec->width, xviddec->height, xviddec->csp,
gst_xvid_error (ret), ret));
return FALSE;
}
@ -213,7 +214,7 @@ gst_xviddec_chain (GstPad * pad, GstData * _data)
if (!xviddec->handle) {
GST_ELEMENT_ERROR (xviddec, CORE, NEGOTIATION, (NULL),
("format wasn't negotiated before chain function"));
("format wasn't negotiated before chain function"));
gst_buffer_unref (buf);
return;
}
@ -234,9 +235,9 @@ gst_xviddec_chain (GstPad * pad, GstData * _data)
if (xviddec->width == xviddec->stride) {
xframe.output.plane[0] = GST_BUFFER_DATA (outbuf);
xframe.output.plane[1] =
xframe.output.plane[0] + (xviddec->width * xviddec->height);
xframe.output.plane[0] + (xviddec->width * xviddec->height);
xframe.output.plane[2] =
xframe.output.plane[1] + (xviddec->width * xviddec->height / 4);
xframe.output.plane[1] + (xviddec->width * xviddec->height / 4);
xframe.output.stride[0] = xviddec->width;
xframe.output.stride[1] = xviddec->width / 2;
xframe.output.stride[2] = xviddec->width / 2;
@ -247,7 +248,7 @@ gst_xviddec_chain (GstPad * pad, GstData * _data)
if ((ret = xvid_decore (xviddec->handle, XVID_DEC_DECODE, &xframe, NULL)) < 0) {
GST_ELEMENT_ERROR (xviddec, STREAM, DECODE, (NULL),
("Error decoding xvid frame: %s (%d)\n", gst_xvid_error (ret), ret));
("Error decoding xvid frame: %s (%d)\n", gst_xvid_error (ret), ret));
gst_buffer_unref (buf);
gst_buffer_unref (outbuf);
return;
@ -289,7 +290,7 @@ gst_xviddec_src_getcaps (GstPad * pad)
caps = gst_caps_new_empty ();
for (i = 0; csp[i] != 0; i++) {
GstCaps *one = gst_xvid_csp_to_caps (csp[i], xviddec->width,
xviddec->height, xviddec->fps);
xviddec->height, xviddec->fps);
gst_caps_append (caps, one);
}
@ -350,13 +351,13 @@ gst_xviddec_sink_link (GstPad * pad, const GstCaps * vscaps)
for (i = 0; i < gst_caps_get_size (vscaps); i++) {
csp = gst_xvid_structure_to_csp (gst_caps_get_structure (vscaps, i),
0, NULL, NULL);
0, NULL, NULL);
new =
gst_xvid_csp_to_caps (csp, xviddec->width, xviddec->height,
xviddec->fps);
gst_xvid_csp_to_caps (csp, xviddec->width, xviddec->height,
xviddec->fps);
ret = gst_pad_try_set_caps (xviddec->srcpad, new);
if (ret != GST_PAD_LINK_REFUSED)
return ret;
return ret;
}
return GST_PAD_LINK_REFUSED;
@ -373,7 +374,7 @@ gst_xviddec_change_state (GstElement * element)
switch (GST_STATE_PENDING (element)) {
case GST_STATE_PAUSED_TO_READY:
if (xviddec->handle) {
gst_xviddec_unset (xviddec);
gst_xviddec_unset (xviddec);
}
break;
default:

View file

@ -40,20 +40,20 @@ static GstStaticPadTemplate sink_template = GST_STATIC_PAD_TEMPLATE ("sink",
GST_PAD_SINK,
GST_PAD_ALWAYS,
GST_STATIC_CAPS (GST_VIDEO_CAPS_YUV ("{ I420, YUY2, YV12, YVYU, UYVY }")
"; " RGB_24_32_STATIC_CAPS (32, 0x00ff0000, 0x0000ff00,
0x000000ff) "; " RGB_24_32_STATIC_CAPS (32, 0xff000000, 0x00ff0000,
0x0000ff00) "; " RGB_24_32_STATIC_CAPS (32, 0x0000ff00, 0x00ff0000,
0xff000000) "; " RGB_24_32_STATIC_CAPS (32, 0x000000ff, 0x0000ff00,
0x00ff0000) "; " RGB_24_32_STATIC_CAPS (24, 0x0000ff, 0x00ff00,
0xff0000) "; " GST_VIDEO_CAPS_RGB_15 "; " GST_VIDEO_CAPS_RGB_16)
"; " RGB_24_32_STATIC_CAPS (32, 0x00ff0000, 0x0000ff00,
0x000000ff) "; " RGB_24_32_STATIC_CAPS (32, 0xff000000, 0x00ff0000,
0x0000ff00) "; " RGB_24_32_STATIC_CAPS (32, 0x0000ff00, 0x00ff0000,
0xff000000) "; " RGB_24_32_STATIC_CAPS (32, 0x000000ff, 0x0000ff00,
0x00ff0000) "; " RGB_24_32_STATIC_CAPS (24, 0x0000ff, 0x00ff00,
0xff0000) "; " GST_VIDEO_CAPS_RGB_15 "; " GST_VIDEO_CAPS_RGB_16)
);
static GstStaticPadTemplate src_template = GST_STATIC_PAD_TEMPLATE ("src",
GST_PAD_SRC,
GST_PAD_ALWAYS,
GST_STATIC_CAPS ("video/x-xvid, "
"width = (int) [ 0, MAX ], "
"height = (int) [ 0, MAX ], " "framerate = (double) [ 0.0, MAX ]")
"width = (int) [ 0, MAX ], "
"height = (int) [ 0, MAX ], " "framerate = (double) [ 0.0, MAX ]")
);
@ -111,13 +111,13 @@ gst_xvidenc_profile_get_type (void)
{XVID_PROFILE_S_L2, "S_L2", "Simple profile, L2"},
{XVID_PROFILE_S_L3, "S_L3", "Simple profile, L3"},
{XVID_PROFILE_ARTS_L1, "ARTS_L1",
"Advanced real-time simple profile, L1"},
"Advanced real-time simple profile, L1"},
{XVID_PROFILE_ARTS_L2, "ARTS_L2",
"Advanced real-time simple profile, L2"},
"Advanced real-time simple profile, L2"},
{XVID_PROFILE_ARTS_L3, "ARTS_L3",
"Advanced real-time simple profile, L3"},
"Advanced real-time simple profile, L3"},
{XVID_PROFILE_ARTS_L4, "ARTS_L4",
"Advanced real-time simple profile, L4"},
"Advanced real-time simple profile, L4"},
{XVID_PROFILE_AS_L0, "AS_L0", "Advanced simple profile, L0"},
{XVID_PROFILE_AS_L1, "AS_L1", "Advanced simple profile, L1"},
{XVID_PROFILE_AS_L2, "AS_L2", "Advanced simple profile, L2"},
@ -127,7 +127,7 @@ gst_xvidenc_profile_get_type (void)
};
xvidenc_profile_type =
g_enum_register_static ("GstXvidEncProfiles", xvidenc_profiles);
g_enum_register_static ("GstXvidEncProfiles", xvidenc_profiles);
}
return xvidenc_profile_type;
@ -150,8 +150,9 @@ gst_xvidenc_get_type (void)
0,
(GInstanceInitFunc) gst_xvidenc_init,
};
xvidenc_type = g_type_register_static (GST_TYPE_ELEMENT,
"GstXvidEnc", &xvidenc_info, 0);
"GstXvidEnc", &xvidenc_info, 0);
}
return xvidenc_type;
}
@ -182,22 +183,22 @@ gst_xvidenc_class_init (GstXvidEncClass * klass)
/* encoding profile */
g_object_class_install_property (gobject_class, ARG_PROFILE,
g_param_spec_enum ("profile", "Profile", "XviD/MPEG-4 encoding profile",
GST_TYPE_XVIDENC_PROFILE, XVID_PROFILE_S_L0, G_PARAM_READWRITE));
GST_TYPE_XVIDENC_PROFILE, XVID_PROFILE_S_L0, G_PARAM_READWRITE));
/* bitrate */
g_object_class_install_property (gobject_class, ARG_BITRATE,
g_param_spec_int ("bitrate", "Bitrate",
"Target video bitrate (kbps)", 0, G_MAXINT, 512, G_PARAM_READWRITE));
"Target video bitrate (kbps)", 0, G_MAXINT, 512, G_PARAM_READWRITE));
/* keyframe interval */
g_object_class_install_property (gobject_class, ARG_MAXKEYINTERVAL,
g_param_spec_int ("max_key_interval", "Max. Key Interval",
"Maximum number of frames between two keyframes",
0, G_MAXINT, 0, G_PARAM_READWRITE));
"Maximum number of frames between two keyframes",
0, G_MAXINT, 0, G_PARAM_READWRITE));
g_object_class_install_property (gobject_class, ARG_BUFSIZE,
g_param_spec_ulong ("buffer_size", "Buffer Size",
"Size of the video buffers", 0, G_MAXULONG, 0, G_PARAM_READWRITE));
"Size of the video buffers", 0, G_MAXULONG, 0, G_PARAM_READWRITE));
gobject_class->set_property = gst_xvidenc_set_property;
gobject_class->get_property = gst_xvidenc_get_property;
@ -236,7 +237,7 @@ gst_xvidenc_init (GstXvidEnc * xvidenc)
xvidenc->profile = XVID_PROFILE_S_L0;
xvidenc->bitrate = 512;
xvidenc->max_b_frames = 2;
xvidenc->max_key_interval = -1; /* default - 2*fps */
xvidenc->max_key_interval = -1; /* default - 2*fps */
xvidenc->buffer_size = 512;
/* set xvid handle to NULL */
@ -281,7 +282,7 @@ gst_xvidenc_setup (GstXvidEnc * xvidenc)
if ((ret = xvid_encore (NULL, XVID_ENC_CREATE, &xenc, NULL)) < 0) {
GST_ELEMENT_ERROR (xvidenc, LIBRARY, INIT, (NULL),
("Error setting up xvid encoder: %s (%d)", gst_xvid_error (ret), ret));
("Error setting up xvid encoder: %s (%d)", gst_xvid_error (ret), ret));
return FALSE;
}
@ -318,9 +319,9 @@ gst_xvidenc_chain (GstPad * pad, GstData * _data)
if (xvidenc->width == xvidenc->stride) {
xframe.input.plane[0] = GST_BUFFER_DATA (buf);
xframe.input.plane[1] =
xframe.input.plane[0] + (xvidenc->width * xvidenc->height);
xframe.input.plane[0] + (xvidenc->width * xvidenc->height);
xframe.input.plane[2] =
xframe.input.plane[1] + (xvidenc->width * xvidenc->height / 4);
xframe.input.plane[1] + (xvidenc->width * xvidenc->height / 4);
xframe.input.stride[0] = xvidenc->width;
xframe.input.stride[1] = xvidenc->width / 2;
xframe.input.stride[2] = xvidenc->width / 2;
@ -334,9 +335,9 @@ gst_xvidenc_chain (GstPad * pad, GstData * _data)
gst_xvid_init_struct (xstats);
if ((ret = xvid_encore (xvidenc->handle, XVID_ENC_ENCODE,
&xframe, &xstats)) < 0) {
&xframe, &xstats)) < 0) {
GST_ELEMENT_ERROR (xvidenc, LIBRARY, ENCODE, (NULL),
("Error encoding xvid frame: %s (%d)", gst_xvid_error (ret), ret));
("Error encoding xvid frame: %s (%d)", gst_xvid_error (ret), ret));
gst_buffer_unref (buf);
gst_buffer_unref (outbuf);
return;
@ -397,13 +398,13 @@ gst_xvidenc_link (GstPad * pad, const GstCaps * vscaps)
GstCaps *new_caps;
new_caps = gst_caps_new_simple ("video/x-xvid",
"width", G_TYPE_INT, w,
"height", G_TYPE_INT, h, "framerate", G_TYPE_DOUBLE, fps, NULL);
"width", G_TYPE_INT, w,
"height", G_TYPE_INT, h, "framerate", G_TYPE_DOUBLE, fps, NULL);
ret = gst_pad_try_set_caps (xvidenc->srcpad, new_caps);
if (GST_PAD_LINK_FAILED (ret)) {
if (xvidenc->handle) {
xvid_encore (xvidenc->handle, XVID_ENC_DESTROY, NULL, NULL);
xvidenc->handle = NULL;
xvid_encore (xvidenc->handle, XVID_ENC_DESTROY, NULL, NULL);
xvidenc->handle = NULL;
}
}
@ -482,8 +483,8 @@ gst_xvidenc_change_state (GstElement * element)
switch (GST_STATE_PENDING (element)) {
case GST_STATE_PAUSED_TO_READY:
if (xvidenc->handle) {
xvid_encore (xvidenc->handle, XVID_ENC_DESTROY, NULL, NULL);
xvidenc->handle = NULL;
xvid_encore (xvidenc->handle, XVID_ENC_DESTROY, NULL, NULL);
xvidenc->handle = NULL;
}
break;
default:

View file

@ -46,7 +46,7 @@ gst_audio_frame_byte_size (GstPad * pad)
if (caps == NULL) {
/* ERROR: could not get caps of pad */
g_warning ("gstaudio: could not get caps of pad %s:%s\n",
GST_ELEMENT_NAME (gst_pad_get_parent (pad)), GST_PAD_NAME (pad));
GST_ELEMENT_NAME (gst_pad_get_parent (pad)), GST_PAD_NAME (pad));
return 0;
}
@ -94,7 +94,7 @@ gst_audio_frame_rate (GstPad * pad)
if (caps == NULL) {
/* ERROR: could not get caps of pad */
g_warning ("gstaudio: could not get caps of pad %s:%s\n",
GST_ELEMENT_NAME (gst_pad_get_parent (pad)), GST_PAD_NAME (pad));
GST_ELEMENT_NAME (gst_pad_get_parent (pad)), GST_PAD_NAME (pad));
return 0;
} else {
structure = gst_caps_get_structure (caps, 0);
@ -127,7 +127,7 @@ gst_audio_length (GstPad * pad, GstBuffer * buf)
if (caps == NULL) {
/* ERROR: could not get caps of pad */
g_warning ("gstaudio: could not get caps of pad %s:%s\n",
GST_ELEMENT_NAME (gst_pad_get_parent (pad)), GST_PAD_NAME (pad));
GST_ELEMENT_NAME (gst_pad_get_parent (pad)), GST_PAD_NAME (pad));
length = 0.0;
} else {
structure = gst_caps_get_structure (caps, 0);
@ -160,7 +160,7 @@ gst_audio_highest_sample_value (GstPad * pad)
caps = GST_PAD_CAPS (pad);
if (caps == NULL) {
g_warning ("gstaudio: could not get caps of pad %s:%s\n",
GST_ELEMENT_NAME (gst_pad_get_parent (pad)), GST_PAD_NAME (pad));
GST_ELEMENT_NAME (gst_pad_get_parent (pad)), GST_PAD_NAME (pad));
}
structure = gst_caps_get_structure (caps, 0);
@ -218,19 +218,19 @@ _gst_audio_structure_set_list (GstStructure * structure,
switch (type) {
case G_TYPE_INT:
i = va_arg (varargs, int);
i = va_arg (varargs, int);
g_value_init (&list_value, G_TYPE_INT);
g_value_set_int (&list_value, i);
break;
g_value_init (&list_value, G_TYPE_INT);
g_value_set_int (&list_value, i);
break;
case G_TYPE_BOOLEAN:
b = va_arg (varargs, gboolean);
g_value_init (&list_value, G_TYPE_BOOLEAN);
g_value_set_boolean (&list_value, b);
break;
b = va_arg (varargs, gboolean);
g_value_init (&list_value, G_TYPE_BOOLEAN);
g_value_set_boolean (&list_value, b);
break;
default:
g_warning
("_gst_audio_structure_set_list: LIST of given type not implemented.");
g_warning
("_gst_audio_structure_set_list: LIST of given type not implemented.");
}
g_array_append_val (array, list_value);
@ -244,24 +244,24 @@ gst_audio_structure_set_int (GstStructure * structure, GstAudioFieldFlag flag)
{
if (flag & GST_AUDIO_FIELD_RATE)
gst_structure_set (structure, "rate", GST_TYPE_INT_RANGE, 1, G_MAXINT,
NULL);
NULL);
if (flag & GST_AUDIO_FIELD_CHANNELS)
gst_structure_set (structure, "channels", GST_TYPE_INT_RANGE, 1, G_MAXINT,
NULL);
NULL);
if (flag & GST_AUDIO_FIELD_ENDIANNESS)
_gst_audio_structure_set_list (structure, "endianness", G_TYPE_INT, 2,
G_LITTLE_ENDIAN, G_BIG_ENDIAN, NULL);
G_LITTLE_ENDIAN, G_BIG_ENDIAN, NULL);
if (flag & GST_AUDIO_FIELD_WIDTH)
_gst_audio_structure_set_list (structure, "width", G_TYPE_INT, 3, 8, 16, 32,
NULL);
NULL);
if (flag & GST_AUDIO_FIELD_DEPTH)
gst_structure_set (structure, "depth", GST_TYPE_INT_RANGE, 1, 32, NULL);
if (flag & GST_AUDIO_FIELD_SIGNED)
_gst_audio_structure_set_list (structure, "signed", G_TYPE_BOOLEAN, 2, TRUE,
FALSE, NULL);
FALSE, NULL);
if (flag & GST_AUDIO_FIELD_BUFFER_FRAMES)
gst_structure_set (structure, "buffer-frames", GST_TYPE_INT_RANGE, 1,
G_MAXINT, NULL);
G_MAXINT, NULL);
}
static gboolean

View file

@ -57,8 +57,9 @@ gst_audio_clock_get_type (void)
(GInstanceInitFunc) gst_audio_clock_init,
NULL
};
clock_type = g_type_register_static (GST_TYPE_SYSTEM_CLOCK, "GstAudioClock",
&clock_info, 0);
&clock_info, 0);
}
return clock_type;
}
@ -162,7 +163,7 @@ gst_audio_clock_update_time (GstAudioClock * aclock, GstClockTime time)
entry->func ((GstClock *) aclock, time, entry, entry->user_data);
aclock->async_entries = g_slist_delete_link (aclock->async_entries,
aclock->async_entries);
aclock->async_entries);
/* do I need to free the entry? */
}
}

View file

@ -73,8 +73,9 @@ gst_audiofilter_get_type (void)
0,
gst_audiofilter_init,
};
audiofilter_type = g_type_register_static (GST_TYPE_ELEMENT,
"GstAudiofilter", &audiofilter_info, G_TYPE_FLAG_ABSTRACT);
"GstAudiofilter", &audiofilter_info, G_TYPE_FLAG_ABSTRACT);
}
return audiofilter_type;
}
@ -141,7 +142,7 @@ gst_audiofilter_link (GstPad * pad, const GstCaps * caps)
ret = gst_structure_get_int (structure, "depth", &audiofilter->depth);
ret &= gst_structure_get_int (structure, "width", &audiofilter->width);
ret &=
gst_structure_get_int (structure, "channels", &audiofilter->channels);
gst_structure_get_int (structure, "channels", &audiofilter->channels);
} else if (strcmp (gst_structure_get_name (structure), "audio/x-raw-float")
== 0) {
@ -236,7 +237,7 @@ gst_audiofilter_chain (GstPad * pad, GstData * data)
(audiofilter_class->filter) (audiofilter, outbuf, inbuf);
} else {
memcpy (GST_BUFFER_DATA (outbuf), GST_BUFFER_DATA (inbuf),
GST_BUFFER_SIZE (inbuf));
GST_BUFFER_SIZE (inbuf));
(audiofilter_class->filter_inplace) (audiofilter, outbuf);
}
@ -290,11 +291,11 @@ gst_audiofilter_class_add_pad_templates (GstAudiofilterClass *
gst_element_class_add_pad_template (element_class,
gst_pad_template_new ("src", GST_PAD_SRC, GST_PAD_ALWAYS,
gst_caps_copy (caps)));
gst_caps_copy (caps)));
gst_element_class_add_pad_template (element_class,
gst_pad_template_new ("sink", GST_PAD_SINK, GST_PAD_ALWAYS,
gst_caps_copy (caps)));
gst_caps_copy (caps)));
}
static gboolean

View file

@ -107,8 +107,9 @@ gst_audiofilter_template_get_type (void)
0,
NULL,
};
audiofilter_template_type = g_type_register_static (GST_TYPE_AUDIOFILTER,
"GstAudiofilterTemplate", &audiofilter_template_info, 0);
"GstAudiofilterTemplate", &audiofilter_template_info, 0);
}
return audiofilter_template_type;
}
@ -147,8 +148,8 @@ gst_audiofilter_template_class_init (gpointer g_class, gpointer class_data)
#if 0
g_object_class_install_property (gobject_class, ARG_METHOD,
g_param_spec_enum ("method", "method", "method",
GST_TYPE_AUDIOTEMPLATE_METHOD, GST_AUDIOTEMPLATE_METHOD_1,
G_PARAM_READWRITE));
GST_TYPE_AUDIOTEMPLATE_METHOD, GST_AUDIOTEMPLATE_METHOD_1,
G_PARAM_READWRITE));
#endif
gobject_class->set_property = gst_audiofilter_template_set_property;

View file

@ -56,9 +56,9 @@ gst_color_balance_get_type (void)
};
gst_color_balance_type = g_type_register_static (G_TYPE_INTERFACE,
"GstColorBalance", &gst_color_balance_info, 0);
"GstColorBalance", &gst_color_balance_info, 0);
g_type_interface_add_prerequisite (gst_color_balance_type,
GST_TYPE_IMPLEMENTS_INTERFACE);
GST_TYPE_IMPLEMENTS_INTERFACE);
}
return gst_color_balance_type;
@ -71,12 +71,12 @@ gst_color_balance_class_init (GstColorBalanceClass * klass)
if (!initialized) {
gst_color_balance_signals[VALUE_CHANGED] =
g_signal_new ("value-changed",
GST_TYPE_COLOR_BALANCE, G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GstColorBalanceClass, value_changed),
NULL, NULL,
gst_color_balance_marshal_VOID__OBJECT_INT,
G_TYPE_NONE, 2, GST_TYPE_COLOR_BALANCE_CHANNEL, G_TYPE_INT);
g_signal_new ("value-changed",
GST_TYPE_COLOR_BALANCE, G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GstColorBalanceClass, value_changed),
NULL, NULL,
gst_color_balance_marshal_VOID__OBJECT_INT,
G_TYPE_NONE, 2, GST_TYPE_COLOR_BALANCE_CHANNEL, G_TYPE_INT);
initialized = TRUE;
}

View file

@ -60,8 +60,8 @@ gst_color_balance_channel_get_type (void)
};
gst_color_balance_channel_type =
g_type_register_static (G_TYPE_OBJECT,
"GstColorBalanceChannel", &color_balance_channel_info, 0);
g_type_register_static (G_TYPE_OBJECT,
"GstColorBalanceChannel", &color_balance_channel_info, 0);
}
return gst_color_balance_channel_type;
@ -78,7 +78,7 @@ gst_color_balance_channel_class_init (GstColorBalanceChannelClass * klass)
g_signal_new ("value-changed", G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GstColorBalanceChannelClass,
value_changed),
value_changed),
NULL, NULL, g_cclosure_marshal_VOID__INT, G_TYPE_NONE, 1, G_TYPE_INT);
object_klass->dispose = gst_color_balance_channel_dispose;

View file

@ -31,7 +31,7 @@
#error "GST_GCONF_DIR is not defined !"
#endif
static GConfClient *_gst_gconf_client = NULL; /* GConf connection */
static GConfClient *_gst_gconf_client = NULL; /* GConf connection */
/* internal functions */
@ -63,13 +63,13 @@ gst_bin_find_unconnected_pad (GstBin * bin, GstPadDirection direction)
while (pads) {
/* check if the direction matches */
if (GST_PAD_DIRECTION (GST_PAD (pads->data)) == direction) {
if (GST_PAD_PEER (GST_PAD (pads->data)) == NULL) {
/* found it ! */
pad = GST_PAD (pads->data);
}
if (GST_PAD_PEER (GST_PAD (pads->data)) == NULL) {
/* found it ! */
pad = GST_PAD (pads->data);
}
}
if (pad)
break; /* found one already */
break; /* found one already */
pads = g_list_next (pads);
}
elements = g_list_next (elements);
@ -149,7 +149,7 @@ gst_gconf_render_bin_from_description (const gchar * description)
g_free (desc);
if (error) {
g_print ("DEBUG: gstgconf: error parsing pipeline %s\n%s\n",
description, error->message);
description, error->message);
g_error_free (error);
return NULL;
}
@ -308,7 +308,7 @@ gst_gconf_get_default_visualization_element (void)
if (!ret)
g_warning
("No GConf default visualization plugin key and goom doesn't work");
("No GConf default visualization plugin key and goom doesn't work");
else
g_print ("GConf visualization plugin not found, using goom\n");
}

View file

@ -45,17 +45,17 @@
/* this code assumes >> to be a two's-complement arithmetic */
/* right shift: (-2)>>1 == -1 , (-3)>>1 == -2 */
#define W1 2841 /* 2048*sqrt(2)*cos(1*pi/16) */
#define W2 2676 /* 2048*sqrt(2)*cos(2*pi/16) */
#define W3 2408 /* 2048*sqrt(2)*cos(3*pi/16) */
#define W5 1609 /* 2048*sqrt(2)*cos(5*pi/16) */
#define W6 1108 /* 2048*sqrt(2)*cos(6*pi/16) */
#define W7 565 /* 2048*sqrt(2)*cos(7*pi/16) */
#define W1 2841 /* 2048*sqrt(2)*cos(1*pi/16) */
#define W2 2676 /* 2048*sqrt(2)*cos(2*pi/16) */
#define W3 2408 /* 2048*sqrt(2)*cos(3*pi/16) */
#define W5 1609 /* 2048*sqrt(2)*cos(5*pi/16) */
#define W6 1108 /* 2048*sqrt(2)*cos(6*pi/16) */
#define W7 565 /* 2048*sqrt(2)*cos(7*pi/16) */
#include "dct.h"
/* private data */
static short iclip[1024]; /* clipping table */
static short iclip[1024]; /* clipping table */
static short *iclp;
/* private prototypes */
@ -80,13 +80,13 @@ idctrow (blk)
/* shortcut */
if (!((x1 = blk[4] << 11) | (x2 = blk[6]) | (x3 = blk[2]) |
(x4 = blk[1]) | (x5 = blk[7]) | (x6 = blk[5]) | (x7 = blk[3]))) {
(x4 = blk[1]) | (x5 = blk[7]) | (x6 = blk[5]) | (x7 = blk[3]))) {
blk[0] = blk[1] = blk[2] = blk[3] = blk[4] = blk[5] = blk[6] = blk[7] =
blk[0] << 3;
blk[0] << 3;
return;
}
x0 = (blk[0] << 11) + 128; /* for proper rounding in the fourth stage */
x0 = (blk[0] << 11) + 128; /* for proper rounding in the fourth stage */
/* first stage */
x8 = W7 * (x4 + x5);
@ -143,10 +143,10 @@ idctcol (blk)
/* shortcut */
if (!((x1 = (blk[8 * 4] << 8)) | (x2 = blk[8 * 6]) | (x3 = blk[8 * 2]) |
(x4 = blk[8 * 1]) | (x5 = blk[8 * 7]) | (x6 = blk[8 * 5]) | (x7 =
blk[8 * 3]))) {
(x4 = blk[8 * 1]) | (x5 = blk[8 * 7]) | (x6 = blk[8 * 5]) | (x7 =
blk[8 * 3]))) {
blk[8 * 0] = blk[8 * 1] = blk[8 * 2] = blk[8 * 3] = blk[8 * 4] =
blk[8 * 5] = blk[8 * 6] = blk[8 * 7] = iclp[(blk[8 * 0] + 32) >> 6];
blk[8 * 5] = blk[8 * 6] = blk[8 * 7] = iclp[(blk[8 * 0] + 32) >> 6];
return;
}

View file

@ -66,7 +66,7 @@ gst_idct_init_float_idct ()
scale = (freq == 0) ? sqrt (0.125) : 0.5;
for (time = 0; time < 8; time++)
gst_idct_float_c[freq][time] =
scale * cos ((PI / 8.0) * freq * (time + 0.5));
scale * cos ((PI / 8.0) * freq * (time + 0.5));
}
}
@ -85,7 +85,7 @@ gst_idct_float_idct (block)
partial_product = 0.0;
for (k = 0; k < 8; k++)
partial_product += gst_idct_float_c[k][j] * block[8 * i + k];
partial_product += gst_idct_float_c[k][j] * block[8 * i + k];
tmp[8 * i + j] = partial_product;
}
@ -98,7 +98,7 @@ gst_idct_float_idct (block)
partial_product = 0.0;
for (k = 0; k < 8; k++)
partial_product += gst_idct_float_c[k][i] * tmp[8 * k + j];
partial_product += gst_idct_float_c[k][i] * tmp[8 * k + j];
v = (int) floor (partial_product + 0.5);
block[8 * i + j] = (v < -256) ? -256 : ((v > 255) ? 255 : v);

View file

@ -52,10 +52,10 @@ main (int argc, char **argv)
int i, j;
double max, total;
int method;
DCTELEM block[DCTSIZE2]; /* random source data */
DCTELEM refcoefs[DCTSIZE2]; /* coefs from reference FDCT */
DCTELEM refout[DCTSIZE2]; /* output from reference IDCT */
DCTELEM testout[DCTSIZE2]; /* output from test IDCT */
DCTELEM block[DCTSIZE2]; /* random source data */
DCTELEM refcoefs[DCTSIZE2]; /* coefs from reference FDCT */
DCTELEM refout[DCTSIZE2]; /* output from reference IDCT */
DCTELEM testout[DCTSIZE2]; /* output from test IDCT */
GstIDCT *idct;
guint64 tscstart, tscmin = ~0, tscmax = 0;
guint64 tscstop;
@ -96,9 +96,9 @@ main (int argc, char **argv)
/* clip */
for (i = 0; i < DCTSIZE2; i++) {
if (refcoefs[i] < -2048)
refcoefs[i] = -2048;
refcoefs[i] = -2048;
else if (refcoefs[i] > 2047)
refcoefs[i] = 2047;
refcoefs[i] = 2047;
}
/* perform reference IDCT */
@ -107,17 +107,17 @@ main (int argc, char **argv)
/* clip */
for (i = 0; i < DCTSIZE2; i++) {
if (refout[i] < -256)
refout[i] = -256;
refout[i] = -256;
else if (refout[i] > 255)
refout[i] = 255;
refout[i] = 255;
}
/* perform test IDCT */
if (GST_IDCT_TRANSPOSE (idct)) {
for (j = 0; j < DCTSIZE; j++) {
for (i = 0; i < DCTSIZE; i++) {
testout[i * DCTSIZE + j] = refcoefs[j * DCTSIZE + i];
}
for (i = 0; i < DCTSIZE; i++) {
testout[i * DCTSIZE + j] = refcoefs[j * DCTSIZE + i];
}
}
} else {
memcpy (testout, refcoefs, sizeof (DCTELEM) * DCTSIZE2);
@ -135,9 +135,9 @@ main (int argc, char **argv)
/* clip */
for (i = 0; i < DCTSIZE2; i++) {
if (testout[i] < -256)
testout[i] = -256;
testout[i] = -256;
else if (testout[i] > 255)
testout[i] = 255;
testout[i] = 255;
}
/* accumulate error stats */
@ -147,9 +147,9 @@ main (int argc, char **argv)
sumerrs[i] += err;
sumsqerrs[i] += err * err;
if (err < 0)
err = -err;
err = -err;
if (maxerr[i] < err)
maxerr[i] = err;
maxerr[i] = err;
}
if (curiter % 100 == 99) {
@ -290,7 +290,7 @@ dct_init (void)
for (b = 0; b < 8; b++) {
tmp = cos ((double) ((a + a + 1) * b) * (3.14159265358979323846 / 16.0));
if (b == 0)
tmp /= sqrt (2.0);
tmp /= sqrt (2.0);
coslu[a][b] = tmp * 0.5;
}
}
@ -307,11 +307,11 @@ ref_fdct (DCTELEM block[8][8])
for (u = 0; u < 8; u++) {
tmp = 0.0;
for (y = 0; y < 8; y++) {
tmp2 = 0.0;
for (x = 0; x < 8; x++) {
tmp2 += (double) block[y][x] * coslu[x][u];
}
tmp += coslu[y][v] * tmp2;
tmp2 = 0.0;
for (x = 0; x < 8; x++) {
tmp2 += (double) block[y][x] * coslu[x][u];
}
tmp += coslu[y][v] * tmp2;
}
res[v][u] = tmp;
}
@ -321,9 +321,9 @@ ref_fdct (DCTELEM block[8][8])
for (u = 0; u < 8; u++) {
tmp = res[v][u];
if (tmp < 0.0) {
x = -((int) (0.5 - tmp));
x = -((int) (0.5 - tmp));
} else {
x = (int) (tmp + 0.5);
x = (int) (tmp + 0.5);
}
block[v][u] = (DCTELEM) x;
}
@ -342,11 +342,11 @@ ref_idct (DCTELEM block[8][8])
for (x = 0; x < 8; x++) {
tmp = 0.0;
for (v = 0; v < 8; v++) {
tmp2 = 0.0;
for (u = 0; u < 8; u++) {
tmp2 += (double) block[v][u] * coslu[x][u];
}
tmp += coslu[y][v] * tmp2;
tmp2 = 0.0;
for (u = 0; u < 8; u++) {
tmp2 += (double) block[v][u] * coslu[x][u];
}
tmp += coslu[y][v] * tmp2;
}
res[y][x] = tmp;
}
@ -356,9 +356,9 @@ ref_idct (DCTELEM block[8][8])
for (u = 0; u < 8; u++) {
tmp = res[v][u];
if (tmp < 0.0) {
x = -((int) (0.5 - tmp));
x = -((int) (0.5 - tmp));
} else {
x = (int) (tmp + 0.5);
x = (int) (tmp + 0.5);
}
block[v][u] = (DCTELEM) x;
}

View file

@ -51,7 +51,7 @@
*/
#if DCTSIZE != 8
Sorry, this code only copes with 8 x8 DCTs. /* deliberate syntax err */
Sorry, this code only copes with 8 x8 DCTs. /* deliberate syntax err */
#endif
/*
* A 2-D IDCT can be done by 1-D IDCT on each row followed by 1-D IDCT
@ -93,7 +93,7 @@ Sorry, this code only copes with 8 x8 DCTs. /* deliberate syntax err */
#define PASS1_BITS 2
#else
#define CONST_BITS 13
#define PASS1_BITS 1 /* lose a little precision to avoid overflow */
#define PASS1_BITS 1 /* lose a little precision to avoid overflow */
#endif
#define ONE ((INT32) 1)
#define CONST_SCALE (ONE << CONST_BITS)
@ -106,18 +106,18 @@ Sorry, this code only copes with 8 x8 DCTs. /* deliberate syntax err */
* (With a reasonable C compiler, you can just rely on the FIX() macro...)
*/
#if CONST_BITS == 13
#define FIX_0_298631336 ((INT32) 2446) /* FIX(0.298631336) */
#define FIX_0_390180644 ((INT32) 3196) /* FIX(0.390180644) */
#define FIX_0_541196100 ((INT32) 4433) /* FIX(0.541196100) */
#define FIX_0_765366865 ((INT32) 6270) /* FIX(0.765366865) */
#define FIX_0_899976223 ((INT32) 7373) /* FIX(0.899976223) */
#define FIX_1_175875602 ((INT32) 9633) /* FIX(1.175875602) */
#define FIX_1_501321110 ((INT32) 12299) /* FIX(1.501321110) */
#define FIX_1_847759065 ((INT32) 15137) /* FIX(1.847759065) */
#define FIX_1_961570560 ((INT32) 16069) /* FIX(1.961570560) */
#define FIX_2_053119869 ((INT32) 16819) /* FIX(2.053119869) */
#define FIX_2_562915447 ((INT32) 20995) /* FIX(2.562915447) */
#define FIX_3_072711026 ((INT32) 25172) /* FIX(3.072711026) */
#define FIX_0_298631336 ((INT32) 2446) /* FIX(0.298631336) */
#define FIX_0_390180644 ((INT32) 3196) /* FIX(0.390180644) */
#define FIX_0_541196100 ((INT32) 4433) /* FIX(0.541196100) */
#define FIX_0_765366865 ((INT32) 6270) /* FIX(0.765366865) */
#define FIX_0_899976223 ((INT32) 7373) /* FIX(0.899976223) */
#define FIX_1_175875602 ((INT32) 9633) /* FIX(1.175875602) */
#define FIX_1_501321110 ((INT32) 12299) /* FIX(1.501321110) */
#define FIX_1_847759065 ((INT32) 15137) /* FIX(1.847759065) */
#define FIX_1_961570560 ((INT32) 16069) /* FIX(1.961570560) */
#define FIX_2_053119869 ((INT32) 16819) /* FIX(2.053119869) */
#define FIX_2_562915447 ((INT32) 20995) /* FIX(2.562915447) */
#define FIX_3_072711026 ((INT32) 25172) /* FIX(3.072711026) */
#else
#define FIX_0_298631336 FIX(0.298631336)
#define FIX_0_390180644 FIX(0.390180644)
@ -148,14 +148,14 @@ Sorry, this code only copes with 8 x8 DCTs. /* deliberate syntax err */
* NB: for 12-bit samples, a full 32-bit multiplication will be needed.
*/
#ifdef EIGHT_BIT_SAMPLES
#ifdef SHORTxSHORT_32 /* may work if 'int' is 32 bits */
#ifdef SHORTxSHORT_32 /* may work if 'int' is 32 bits */
#define MULTIPLY(var,const) (((INT16) (var)) * ((INT16) (const)))
#endif
#ifdef SHORTxLCONST_32 /* known to work with Microsoft C 6.0 */
#ifdef SHORTxLCONST_32 /* known to work with Microsoft C 6.0 */
#define MULTIPLY(var,const) (((INT16) (var)) * ((INT32) (const)))
#endif
#endif
#ifndef MULTIPLY /* default definition */
#ifndef MULTIPLY /* default definition */
#define MULTIPLY(var,const) ((var) * (const))
#endif
/*
@ -186,7 +186,7 @@ gst_idct_int_idct (DCTBLOCK data)
*/
if ((dataptr[1] | dataptr[2] | dataptr[3] | dataptr[4] |
dataptr[5] | dataptr[6] | dataptr[7]) == 0) {
dataptr[5] | dataptr[6] | dataptr[7]) == 0) {
/* AC terms all zero */
DCTELEM dcval = (DCTELEM) (dataptr[0] << PASS1_BITS);
@ -199,7 +199,7 @@ gst_idct_int_idct (DCTBLOCK data)
dataptr[6] = dcval;
dataptr[7] = dcval;
dataptr += DCTSIZE; /* advance pointer to next row */
dataptr += DCTSIZE; /* advance pointer to next row */
continue;
}
@ -234,16 +234,16 @@ gst_idct_int_idct (DCTBLOCK data)
z2 = tmp1 + tmp2;
z3 = tmp0 + tmp2;
z4 = tmp1 + tmp3;
z5 = MULTIPLY (z3 + z4, FIX_1_175875602); /* sqrt(2) * c3 */
z5 = MULTIPLY (z3 + z4, FIX_1_175875602); /* sqrt(2) * c3 */
tmp0 = MULTIPLY (tmp0, FIX_0_298631336); /* sqrt(2) * (-c1+c3+c5-c7) */
tmp1 = MULTIPLY (tmp1, FIX_2_053119869); /* sqrt(2) * ( c1+c3-c5+c7) */
tmp2 = MULTIPLY (tmp2, FIX_3_072711026); /* sqrt(2) * ( c1+c3+c5-c7) */
tmp3 = MULTIPLY (tmp3, FIX_1_501321110); /* sqrt(2) * ( c1+c3-c5-c7) */
z1 = MULTIPLY (z1, -FIX_0_899976223); /* sqrt(2) * (c7-c3) */
z2 = MULTIPLY (z2, -FIX_2_562915447); /* sqrt(2) * (-c1-c3) */
z3 = MULTIPLY (z3, -FIX_1_961570560); /* sqrt(2) * (-c3-c5) */
z4 = MULTIPLY (z4, -FIX_0_390180644); /* sqrt(2) * (c5-c3) */
tmp0 = MULTIPLY (tmp0, FIX_0_298631336); /* sqrt(2) * (-c1+c3+c5-c7) */
tmp1 = MULTIPLY (tmp1, FIX_2_053119869); /* sqrt(2) * ( c1+c3-c5+c7) */
tmp2 = MULTIPLY (tmp2, FIX_3_072711026); /* sqrt(2) * ( c1+c3+c5-c7) */
tmp3 = MULTIPLY (tmp3, FIX_1_501321110); /* sqrt(2) * ( c1+c3-c5-c7) */
z1 = MULTIPLY (z1, -FIX_0_899976223); /* sqrt(2) * (c7-c3) */
z2 = MULTIPLY (z2, -FIX_2_562915447); /* sqrt(2) * (-c1-c3) */
z3 = MULTIPLY (z3, -FIX_1_961570560); /* sqrt(2) * (-c3-c5) */
z4 = MULTIPLY (z4, -FIX_0_390180644); /* sqrt(2) * (c5-c3) */
z3 += z5;
z4 += z5;
@ -264,7 +264,7 @@ gst_idct_int_idct (DCTBLOCK data)
dataptr[3] = (DCTELEM) DESCALE (tmp13 + tmp0, CONST_BITS - PASS1_BITS);
dataptr[4] = (DCTELEM) DESCALE (tmp13 - tmp0, CONST_BITS - PASS1_BITS);
dataptr += DCTSIZE; /* advance pointer to next row */
dataptr += DCTSIZE; /* advance pointer to next row */
}
/* Pass 2: process columns. */
@ -283,8 +283,8 @@ gst_idct_int_idct (DCTBLOCK data)
#ifndef NO_ZERO_COLUMN_TEST
if ((dataptr[DCTSIZE * 1] | dataptr[DCTSIZE * 2] | dataptr[DCTSIZE * 3] |
dataptr[DCTSIZE * 4] | dataptr[DCTSIZE * 5] | dataptr[DCTSIZE * 6] |
dataptr[DCTSIZE * 7]) == 0) {
dataptr[DCTSIZE * 4] | dataptr[DCTSIZE * 5] | dataptr[DCTSIZE * 6] |
dataptr[DCTSIZE * 7]) == 0) {
/* AC terms all zero */
DCTELEM dcval = (DCTELEM) DESCALE ((INT32) dataptr[0], PASS1_BITS + 3);
@ -297,7 +297,7 @@ gst_idct_int_idct (DCTBLOCK data)
dataptr[DCTSIZE * 6] = dcval;
dataptr[DCTSIZE * 7] = dcval;
dataptr++; /* advance pointer to next column */
dataptr++; /* advance pointer to next column */
continue;
}
#endif
@ -313,11 +313,11 @@ gst_idct_int_idct (DCTBLOCK data)
tmp3 = z1 + MULTIPLY (z2, FIX_0_765366865);
tmp0 =
((INT32) dataptr[DCTSIZE * 0] +
(INT32) dataptr[DCTSIZE * 4]) << CONST_BITS;
((INT32) dataptr[DCTSIZE * 0] +
(INT32) dataptr[DCTSIZE * 4]) << CONST_BITS;
tmp1 =
((INT32) dataptr[DCTSIZE * 0] -
(INT32) dataptr[DCTSIZE * 4]) << CONST_BITS;
((INT32) dataptr[DCTSIZE * 0] -
(INT32) dataptr[DCTSIZE * 4]) << CONST_BITS;
tmp10 = tmp0 + tmp3;
tmp13 = tmp0 - tmp3;
@ -337,16 +337,16 @@ gst_idct_int_idct (DCTBLOCK data)
z2 = tmp1 + tmp2;
z3 = tmp0 + tmp2;
z4 = tmp1 + tmp3;
z5 = MULTIPLY (z3 + z4, FIX_1_175875602); /* sqrt(2) * c3 */
z5 = MULTIPLY (z3 + z4, FIX_1_175875602); /* sqrt(2) * c3 */
tmp0 = MULTIPLY (tmp0, FIX_0_298631336); /* sqrt(2) * (-c1+c3+c5-c7) */
tmp1 = MULTIPLY (tmp1, FIX_2_053119869); /* sqrt(2) * ( c1+c3-c5+c7) */
tmp2 = MULTIPLY (tmp2, FIX_3_072711026); /* sqrt(2) * ( c1+c3+c5-c7) */
tmp3 = MULTIPLY (tmp3, FIX_1_501321110); /* sqrt(2) * ( c1+c3-c5-c7) */
z1 = MULTIPLY (z1, -FIX_0_899976223); /* sqrt(2) * (c7-c3) */
z2 = MULTIPLY (z2, -FIX_2_562915447); /* sqrt(2) * (-c1-c3) */
z3 = MULTIPLY (z3, -FIX_1_961570560); /* sqrt(2) * (-c3-c5) */
z4 = MULTIPLY (z4, -FIX_0_390180644); /* sqrt(2) * (c5-c3) */
tmp0 = MULTIPLY (tmp0, FIX_0_298631336); /* sqrt(2) * (-c1+c3+c5-c7) */
tmp1 = MULTIPLY (tmp1, FIX_2_053119869); /* sqrt(2) * ( c1+c3-c5+c7) */
tmp2 = MULTIPLY (tmp2, FIX_3_072711026); /* sqrt(2) * ( c1+c3+c5-c7) */
tmp3 = MULTIPLY (tmp3, FIX_1_501321110); /* sqrt(2) * ( c1+c3-c5-c7) */
z1 = MULTIPLY (z1, -FIX_0_899976223); /* sqrt(2) * (c7-c3) */
z2 = MULTIPLY (z2, -FIX_2_562915447); /* sqrt(2) * (-c1-c3) */
z3 = MULTIPLY (z3, -FIX_1_961570560); /* sqrt(2) * (-c3-c5) */
z4 = MULTIPLY (z4, -FIX_0_390180644); /* sqrt(2) * (c5-c3) */
z3 += z5;
z4 += z5;
@ -359,22 +359,22 @@ gst_idct_int_idct (DCTBLOCK data)
/* Final output stage: inputs are tmp10..tmp13, tmp0..tmp3 */
dataptr[DCTSIZE * 0] = (DCTELEM) DESCALE (tmp10 + tmp3,
CONST_BITS + PASS1_BITS + 3);
CONST_BITS + PASS1_BITS + 3);
dataptr[DCTSIZE * 7] = (DCTELEM) DESCALE (tmp10 - tmp3,
CONST_BITS + PASS1_BITS + 3);
CONST_BITS + PASS1_BITS + 3);
dataptr[DCTSIZE * 1] = (DCTELEM) DESCALE (tmp11 + tmp2,
CONST_BITS + PASS1_BITS + 3);
CONST_BITS + PASS1_BITS + 3);
dataptr[DCTSIZE * 6] = (DCTELEM) DESCALE (tmp11 - tmp2,
CONST_BITS + PASS1_BITS + 3);
CONST_BITS + PASS1_BITS + 3);
dataptr[DCTSIZE * 2] = (DCTELEM) DESCALE (tmp12 + tmp1,
CONST_BITS + PASS1_BITS + 3);
CONST_BITS + PASS1_BITS + 3);
dataptr[DCTSIZE * 5] = (DCTELEM) DESCALE (tmp12 - tmp1,
CONST_BITS + PASS1_BITS + 3);
CONST_BITS + PASS1_BITS + 3);
dataptr[DCTSIZE * 3] = (DCTELEM) DESCALE (tmp13 + tmp0,
CONST_BITS + PASS1_BITS + 3);
CONST_BITS + PASS1_BITS + 3);
dataptr[DCTSIZE * 4] = (DCTELEM) DESCALE (tmp13 - tmp0,
CONST_BITS + PASS1_BITS + 3);
CONST_BITS + PASS1_BITS + 3);
dataptr++; /* advance pointer to next column */
dataptr++; /* advance pointer to next column */
}
}

View file

@ -117,15 +117,15 @@ qword ptr equ mword ptr */
#endif
#include <mmx.h>
#define BITS_INV_ACC 4 /*; 4 or 5 for IEEE */
#define BITS_INV_ACC 4 /*; 4 or 5 for IEEE */
/* 5 yields higher accuracy, but lessens dynamic range on the input matrix */
#define SHIFT_INV_ROW (16 - BITS_INV_ACC)
#define SHIFT_INV_COL (1 + BITS_INV_ACC +14 ) /* changed from Intel's val) */
#define SHIFT_INV_COL (1 + BITS_INV_ACC +14 ) /* changed from Intel's val) */
/*#define SHIFT_INV_COL (1 + BITS_INV_ACC ) */
#define RND_INV_ROW (1 << (SHIFT_INV_ROW-1))
#define RND_INV_COL (1 << (SHIFT_INV_COL-1))
#define RND_INV_CORR (RND_INV_COL - 1) /*; correction -1.0 and round */
#define RND_INV_CORR (RND_INV_COL - 1) /*; correction -1.0 and round */
/*#define RND_INV_ROW (1024 * (6 - BITS_INV_ACC)) //; 1 << (SHIFT_INV_ROW-1) */
/*#define RND_INV_COL (16 * (BITS_INV_ACC - 3)) //; 1 << (SHIFT_INV_COL-1) */
@ -158,12 +158,12 @@ const static long r_inv_row[2] = { RND_INV_ROW, RND_INV_ROW };
/*const static short ocos_4_16[4] = {23170, 23170, 23170, 23170 }; //cos * (2<<15) + 0.5 */
/*concatenated table, for forward DCT transformation */
const static short tg_all_16[] = { 13036, 13036, 13036, 13036, /* tg * (2<<16) + 0.5 */
27146, 27146, 27146, 27146, /*tg * (2<<16) + 0.5 */
-21746, -21746, -21746, -21746, /* tg * (2<<16) + 0.5 */
-19195, -19195, -19195, -19195, /*cos * (2<<16) + 0.5 */
const static short tg_all_16[] = { 13036, 13036, 13036, 13036, /* tg * (2<<16) + 0.5 */
27146, 27146, 27146, 27146, /*tg * (2<<16) + 0.5 */
-21746, -21746, -21746, -21746, /* tg * (2<<16) + 0.5 */
-19195, -19195, -19195, -19195, /*cos * (2<<16) + 0.5 */
23170, 23170, 23170, 23170
}; /*cos * (2<<15) + 0.5 */
}; /*cos * (2<<15) + 0.5 */
#define tg_1_16 (tg_all_16 + 0)
@ -233,51 +233,51 @@ IF _MMX ; MMX code
;=============================================================================
/*; Table for rows 0,4 - constants are multiplied by cos_4_16 */
const short tab_i_04[] = { 16384, 16384, 16384, -16384, /* ; movq-> w06 w04 w02 w00 */
21407, 8867, 8867, -21407, /* w07 w05 w03 w01 */
16384, -16384, 16384, 16384, /*; w14 w12 w10 w08 */
-8867, 21407, -21407, -8867, /*; w15 w13 w11 w09 */
22725, 12873, 19266, -22725, /*; w22 w20 w18 w16 */
19266, 4520, -4520, -12873, /*; w23 w21 w19 w17 */
12873, 4520, 4520, 19266, /*; w30 w28 w26 w24 */
const short tab_i_04[] = { 16384, 16384, 16384, -16384, /* ; movq-> w06 w04 w02 w00 */
21407, 8867, 8867, -21407, /* w07 w05 w03 w01 */
16384, -16384, 16384, 16384, /*; w14 w12 w10 w08 */
-8867, 21407, -21407, -8867, /*; w15 w13 w11 w09 */
22725, 12873, 19266, -22725, /*; w22 w20 w18 w16 */
19266, 4520, -4520, -12873, /*; w23 w21 w19 w17 */
12873, 4520, 4520, 19266, /*; w30 w28 w26 w24 */
-22725, 19266, -12873, -22725
}; /*w31 w29 w27 w25 */
}; /*w31 w29 w27 w25 */
/*; Table for rows 1,7 - constants are multiplied by cos_1_16 */
const short tab_i_17[] = { 22725, 22725, 22725, -22725, /* ; movq-> w06 w04 w02 w00 */
29692, 12299, 12299, -29692, /* ; w07 w05 w03 w01 */
22725, -22725, 22725, 22725, /*; w14 w12 w10 w08 */
-12299, 29692, -29692, -12299, /*; w15 w13 w11 w09 */
31521, 17855, 26722, -31521, /*; w22 w20 w18 w16 */
26722, 6270, -6270, -17855, /*; w23 w21 w19 w17 */
17855, 6270, 6270, 26722, /*; w30 w28 w26 w24 */
const short tab_i_17[] = { 22725, 22725, 22725, -22725, /* ; movq-> w06 w04 w02 w00 */
29692, 12299, 12299, -29692, /* ; w07 w05 w03 w01 */
22725, -22725, 22725, 22725, /*; w14 w12 w10 w08 */
-12299, 29692, -29692, -12299, /*; w15 w13 w11 w09 */
31521, 17855, 26722, -31521, /*; w22 w20 w18 w16 */
26722, 6270, -6270, -17855, /*; w23 w21 w19 w17 */
17855, 6270, 6270, 26722, /*; w30 w28 w26 w24 */
-31521, 26722, -17855, -31521
}; /* w31 w29 w27 w25 */
}; /* w31 w29 w27 w25 */
/*; Table for rows 2,6 - constants are multiplied by cos_2_16 */
const short tab_i_26[] = { 21407, 21407, 21407, -21407, /* ; movq-> w06 w04 w02 w00 */
27969, 11585, 11585, -27969, /* ; w07 w05 w03 w01 */
21407, -21407, 21407, 21407, /* ; w14 w12 w10 w08 */
-11585, 27969, -27969, -11585, /* ;w15 w13 w11 w09 */
29692, 16819, 25172, -29692, /* ;w22 w20 w18 w16 */
25172, 5906, -5906, -16819, /* ;w23 w21 w19 w17 */
16819, 5906, 5906, 25172, /* ;w30 w28 w26 w24 */
const short tab_i_26[] = { 21407, 21407, 21407, -21407, /* ; movq-> w06 w04 w02 w00 */
27969, 11585, 11585, -27969, /* ; w07 w05 w03 w01 */
21407, -21407, 21407, 21407, /* ; w14 w12 w10 w08 */
-11585, 27969, -27969, -11585, /* ;w15 w13 w11 w09 */
29692, 16819, 25172, -29692, /* ;w22 w20 w18 w16 */
25172, 5906, -5906, -16819, /* ;w23 w21 w19 w17 */
16819, 5906, 5906, 25172, /* ;w30 w28 w26 w24 */
-29692, 25172, -16819, -29692
}; /* ;w31 w29 w27 w25 */
}; /* ;w31 w29 w27 w25 */
/*; Table for rows 3,5 - constants are multiplied by cos_3_16 */
const short tab_i_35[] = { 19266, 19266, 19266, -19266, /*; movq-> w06 w04 w02 w00 */
25172, 10426, 10426, -25172, /*; w07 w05 w03 w01 */
19266, -19266, 19266, 19266, /*; w14 w12 w10 w08 */
-10426, 25172, -25172, -10426, /*; w15 w13 w11 w09 */
26722, 15137, 22654, -26722, /*; w22 w20 w18 w16 */
22654, 5315, -5315, -15137, /*; w23 w21 w19 w17 */
15137, 5315, 5315, 22654, /*; w30 w28 w26 w24 */
const short tab_i_35[] = { 19266, 19266, 19266, -19266, /*; movq-> w06 w04 w02 w00 */
25172, 10426, 10426, -25172, /*; w07 w05 w03 w01 */
19266, -19266, 19266, 19266, /*; w14 w12 w10 w08 */
-10426, 25172, -25172, -10426, /*; w15 w13 w11 w09 */
26722, 15137, 22654, -26722, /*; w22 w20 w18 w16 */
22654, 5315, -5315, -15137, /*; w23 w21 w19 w17 */
15137, 5315, 5315, 22654, /*; w30 w28 w26 w24 */
-26722, 22654, -15137, -26722
}; /*; w31 w29 w27 w25 */
}; /*; w31 w29 w27 w25 */
*/
/* CONCATENATED TABLE, rows 0,1,2,3,4,5,6,7 (in order ) */
@ -286,109 +286,109 @@ const short tab_i_35[] = { 19266, 19266, 19266, -19266, /*; movq-> w06 w04 w02
/* */
static const short tab_i_01234567[] = {
/*row0, this row is required */
16384, 16384, 16384, -16384, /* ; movq-> w06 w04 w02 w00 */
21407, 8867, 8867, -21407, /* w07 w05 w03 w01 */
16384, -16384, 16384, 16384, /*; w14 w12 w10 w08 */
-8867, 21407, -21407, -8867, /*; w15 w13 w11 w09 */
22725, 12873, 19266, -22725, /*; w22 w20 w18 w16 */
19266, 4520, -4520, -12873, /*; w23 w21 w19 w17 */
12873, 4520, 4520, 19266, /*; w30 w28 w26 w24 */
-22725, 19266, -12873, -22725, /*w31 w29 w27 w25 */
16384, 16384, 16384, -16384, /* ; movq-> w06 w04 w02 w00 */
21407, 8867, 8867, -21407, /* w07 w05 w03 w01 */
16384, -16384, 16384, 16384, /*; w14 w12 w10 w08 */
-8867, 21407, -21407, -8867, /*; w15 w13 w11 w09 */
22725, 12873, 19266, -22725, /*; w22 w20 w18 w16 */
19266, 4520, -4520, -12873, /*; w23 w21 w19 w17 */
12873, 4520, 4520, 19266, /*; w30 w28 w26 w24 */
-22725, 19266, -12873, -22725, /*w31 w29 w27 w25 */
/* the rest of these rows (1-7), aren't used ! */
/*row1 */
22725, 22725, 22725, -22725, /* ; movq-> w06 w04 w02 w00 */
29692, 12299, 12299, -29692, /* ; w07 w05 w03 w01 */
22725, -22725, 22725, 22725, /*; w14 w12 w10 w08 */
-12299, 29692, -29692, -12299, /*; w15 w13 w11 w09 */
31521, 17855, 26722, -31521, /*; w22 w20 w18 w16 */
26722, 6270, -6270, -17855, /*; w23 w21 w19 w17 */
17855, 6270, 6270, 26722, /*; w30 w28 w26 w24 */
-31521, 26722, -17855, -31521, /* w31 w29 w27 w25 */
22725, 22725, 22725, -22725, /* ; movq-> w06 w04 w02 w00 */
29692, 12299, 12299, -29692, /* ; w07 w05 w03 w01 */
22725, -22725, 22725, 22725, /*; w14 w12 w10 w08 */
-12299, 29692, -29692, -12299, /*; w15 w13 w11 w09 */
31521, 17855, 26722, -31521, /*; w22 w20 w18 w16 */
26722, 6270, -6270, -17855, /*; w23 w21 w19 w17 */
17855, 6270, 6270, 26722, /*; w30 w28 w26 w24 */
-31521, 26722, -17855, -31521, /* w31 w29 w27 w25 */
/*row2 */
21407, 21407, 21407, -21407, /* ; movq-> w06 w04 w02 w00 */
27969, 11585, 11585, -27969, /* ; w07 w05 w03 w01 */
21407, -21407, 21407, 21407, /* ; w14 w12 w10 w08 */
-11585, 27969, -27969, -11585, /* ;w15 w13 w11 w09 */
29692, 16819, 25172, -29692, /* ;w22 w20 w18 w16 */
25172, 5906, -5906, -16819, /* ;w23 w21 w19 w17 */
16819, 5906, 5906, 25172, /* ;w30 w28 w26 w24 */
-29692, 25172, -16819, -29692, /* ;w31 w29 w27 w25 */
21407, 21407, 21407, -21407, /* ; movq-> w06 w04 w02 w00 */
27969, 11585, 11585, -27969, /* ; w07 w05 w03 w01 */
21407, -21407, 21407, 21407, /* ; w14 w12 w10 w08 */
-11585, 27969, -27969, -11585, /* ;w15 w13 w11 w09 */
29692, 16819, 25172, -29692, /* ;w22 w20 w18 w16 */
25172, 5906, -5906, -16819, /* ;w23 w21 w19 w17 */
16819, 5906, 5906, 25172, /* ;w30 w28 w26 w24 */
-29692, 25172, -16819, -29692, /* ;w31 w29 w27 w25 */
/*row3 */
19266, 19266, 19266, -19266, /*; movq-> w06 w04 w02 w00 */
25172, 10426, 10426, -25172, /*; w07 w05 w03 w01 */
19266, -19266, 19266, 19266, /*; w14 w12 w10 w08 */
-10426, 25172, -25172, -10426, /*; w15 w13 w11 w09 */
26722, 15137, 22654, -26722, /*; w22 w20 w18 w16 */
22654, 5315, -5315, -15137, /*; w23 w21 w19 w17 */
15137, 5315, 5315, 22654, /*; w30 w28 w26 w24 */
-26722, 22654, -15137, -26722, /*; w31 w29 w27 w25 */
19266, 19266, 19266, -19266, /*; movq-> w06 w04 w02 w00 */
25172, 10426, 10426, -25172, /*; w07 w05 w03 w01 */
19266, -19266, 19266, 19266, /*; w14 w12 w10 w08 */
-10426, 25172, -25172, -10426, /*; w15 w13 w11 w09 */
26722, 15137, 22654, -26722, /*; w22 w20 w18 w16 */
22654, 5315, -5315, -15137, /*; w23 w21 w19 w17 */
15137, 5315, 5315, 22654, /*; w30 w28 w26 w24 */
-26722, 22654, -15137, -26722, /*; w31 w29 w27 w25 */
/*row4 */
16384, 16384, 16384, -16384, /* ; movq-> w06 w04 w02 w00 */
21407, 8867, 8867, -21407, /* w07 w05 w03 w01 */
16384, -16384, 16384, 16384, /*; w14 w12 w10 w08 */
-8867, 21407, -21407, -8867, /*; w15 w13 w11 w09 */
22725, 12873, 19266, -22725, /*; w22 w20 w18 w16 */
19266, 4520, -4520, -12873, /*; w23 w21 w19 w17 */
12873, 4520, 4520, 19266, /*; w30 w28 w26 w24 */
-22725, 19266, -12873, -22725, /*w31 w29 w27 w25 */
16384, 16384, 16384, -16384, /* ; movq-> w06 w04 w02 w00 */
21407, 8867, 8867, -21407, /* w07 w05 w03 w01 */
16384, -16384, 16384, 16384, /*; w14 w12 w10 w08 */
-8867, 21407, -21407, -8867, /*; w15 w13 w11 w09 */
22725, 12873, 19266, -22725, /*; w22 w20 w18 w16 */
19266, 4520, -4520, -12873, /*; w23 w21 w19 w17 */
12873, 4520, 4520, 19266, /*; w30 w28 w26 w24 */
-22725, 19266, -12873, -22725, /*w31 w29 w27 w25 */
/*row5 */
19266, 19266, 19266, -19266, /*; movq-> w06 w04 w02 w00 */
25172, 10426, 10426, -25172, /*; w07 w05 w03 w01 */
19266, -19266, 19266, 19266, /*; w14 w12 w10 w08 */
-10426, 25172, -25172, -10426, /*; w15 w13 w11 w09 */
26722, 15137, 22654, -26722, /*; w22 w20 w18 w16 */
22654, 5315, -5315, -15137, /*; w23 w21 w19 w17 */
15137, 5315, 5315, 22654, /*; w30 w28 w26 w24 */
-26722, 22654, -15137, -26722, /*; w31 w29 w27 w25 */
19266, 19266, 19266, -19266, /*; movq-> w06 w04 w02 w00 */
25172, 10426, 10426, -25172, /*; w07 w05 w03 w01 */
19266, -19266, 19266, 19266, /*; w14 w12 w10 w08 */
-10426, 25172, -25172, -10426, /*; w15 w13 w11 w09 */
26722, 15137, 22654, -26722, /*; w22 w20 w18 w16 */
22654, 5315, -5315, -15137, /*; w23 w21 w19 w17 */
15137, 5315, 5315, 22654, /*; w30 w28 w26 w24 */
-26722, 22654, -15137, -26722, /*; w31 w29 w27 w25 */
/*row6 */
21407, 21407, 21407, -21407, /* ; movq-> w06 w04 w02 w00 */
27969, 11585, 11585, -27969, /* ; w07 w05 w03 w01 */
21407, -21407, 21407, 21407, /* ; w14 w12 w10 w08 */
-11585, 27969, -27969, -11585, /* ;w15 w13 w11 w09 */
29692, 16819, 25172, -29692, /* ;w22 w20 w18 w16 */
25172, 5906, -5906, -16819, /* ;w23 w21 w19 w17 */
16819, 5906, 5906, 25172, /* ;w30 w28 w26 w24 */
-29692, 25172, -16819, -29692, /* ;w31 w29 w27 w25 */
21407, 21407, 21407, -21407, /* ; movq-> w06 w04 w02 w00 */
27969, 11585, 11585, -27969, /* ; w07 w05 w03 w01 */
21407, -21407, 21407, 21407, /* ; w14 w12 w10 w08 */
-11585, 27969, -27969, -11585, /* ;w15 w13 w11 w09 */
29692, 16819, 25172, -29692, /* ;w22 w20 w18 w16 */
25172, 5906, -5906, -16819, /* ;w23 w21 w19 w17 */
16819, 5906, 5906, 25172, /* ;w30 w28 w26 w24 */
-29692, 25172, -16819, -29692, /* ;w31 w29 w27 w25 */
/*row7 */
22725, 22725, 22725, -22725, /* ; movq-> w06 w04 w02 w00 */
29692, 12299, 12299, -29692, /* ; w07 w05 w03 w01 */
22725, -22725, 22725, 22725, /*; w14 w12 w10 w08 */
-12299, 29692, -29692, -12299, /*; w15 w13 w11 w09 */
31521, 17855, 26722, -31521, /*; w22 w20 w18 w16 */
26722, 6270, -6270, -17855, /*; w23 w21 w19 w17 */
17855, 6270, 6270, 26722, /*; w30 w28 w26 w24 */
22725, 22725, 22725, -22725, /* ; movq-> w06 w04 w02 w00 */
29692, 12299, 12299, -29692, /* ; w07 w05 w03 w01 */
22725, -22725, 22725, 22725, /*; w14 w12 w10 w08 */
-12299, 29692, -29692, -12299, /*; w15 w13 w11 w09 */
31521, 17855, 26722, -31521, /*; w22 w20 w18 w16 */
26722, 6270, -6270, -17855, /*; w23 w21 w19 w17 */
17855, 6270, 6270, 26722, /*; w30 w28 w26 w24 */
-31521, 26722, -17855, -31521
}; /* w31 w29 w27 w25 */
}; /* w31 w29 w27 w25 */
#define INP eax /* pointer to (short *blk) */
#define OUT ecx /* pointer to output (temporary store space qwTemp[]) */
#define TABLE ebx /* pointer to tab_i_01234567[] */
#define INP eax /* pointer to (short *blk) */
#define OUT ecx /* pointer to output (temporary store space qwTemp[]) */
#define TABLE ebx /* pointer to tab_i_01234567[] */
#define round_inv_row edx
#define round_inv_col edx
#define ROW_STRIDE 8 /* for 8x8 matrix transposer */
#define ROW_STRIDE 8 /* for 8x8 matrix transposer */
/* private variables and functions */
/*temporary storage space, 8x8 of shorts */
__inline static void idct_mmx32_rows (short *blk); /* transform rows */
__inline static void idct_mmx32_cols (short *blk); /* transform "columns" */
__inline static void idct_mmx32_rows (short *blk); /* transform rows */
__inline static void idct_mmx32_cols (short *blk); /* transform "columns" */
/* the "column" transform actually transforms rows, it is */
/* identical to the row-transform except for the ROUNDING */
/* and SHIFTING coefficients. */
/* the "column" transform actually transforms rows, it is */
/* identical to the row-transform except for the ROUNDING */
/* and SHIFTING coefficients. */
static void
idct_mmx32_rows (short *blk)
{ /* transform all 8 rows of 8x8 iDCT block */
{ /* transform all 8 rows of 8x8 iDCT block */
int x;
short qwTemp[64];
short *out = &qwTemp[0];
@ -402,58 +402,58 @@ idct_mmx32_rows (short *blk)
/* */
/* 2) transpose the matrix (which was stored in qwTemp[]) */
/* qwTemp[] -> [8x8 matrix transpose] -> blk[] */
for (x = 0; x < 8; x++) { /* transform one row per iteration */
movq_m2r (*(inptr), mm0); /* 0 ; x3 x2 x1 x0 */
movq_m2r (*(inptr + 4), mm1); /* 1 ; x7 x6 x5 x4 */
movq_r2r (mm0, mm2); /* 2 ; x3 x2 x1 x0 */
movq_m2r (*(tab_i_01234567), mm3); /* 3 ; w06 w04 w02 w00 */
punpcklwd_r2r (mm1, mm0); /* x5 x1 x4 x0 */
for (x = 0; x < 8; x++) { /* transform one row per iteration */
movq_m2r (*(inptr), mm0); /* 0 ; x3 x2 x1 x0 */
movq_m2r (*(inptr + 4), mm1); /* 1 ; x7 x6 x5 x4 */
movq_r2r (mm0, mm2); /* 2 ; x3 x2 x1 x0 */
movq_m2r (*(tab_i_01234567), mm3); /* 3 ; w06 w04 w02 w00 */
punpcklwd_r2r (mm1, mm0); /* x5 x1 x4 x0 */
/* ---------- */
movq_r2r (mm0, mm5); /* 5 ; x5 x1 x4 x0 */
punpckldq_r2r (mm0, mm0); /* x4 x0 x4 x0 */
movq_m2r (*(tab_i_01234567 + 4), mm4); /* 4 ; w07 w05 w03 w01 */
punpckhwd_r2r (mm1, mm2); /* 1 ; x7 x3 x6 x2 */
pmaddwd_r2r (mm0, mm3); /* x4*w06+x0*w04 x4*w02+x0*w00 */
movq_r2r (mm2, mm6); /* 6 ; x7 x3 x6 x2 */
movq_m2r (*(tab_i_01234567 + 16), mm1); /* 1 ; w22 w20 w18 w16 */
punpckldq_r2r (mm2, mm2); /* x6 x2 x6 x2 */
pmaddwd_r2r (mm2, mm4); /* x6*w07+x2*w05 x6*w03+x2*w01 */
punpckhdq_r2r (mm5, mm5); /* x5 x1 x5 x1 */
pmaddwd_m2r (*(tab_i_01234567 + 8), mm0); /* x4*w14+x0*w12 x4*w10+x0*w08 */
punpckhdq_r2r (mm6, mm6); /* x7 x3 x7 x3 */
movq_m2r (*(tab_i_01234567 + 20), mm7); /* 7 ; w23 w21 w19 w17 */
pmaddwd_r2r (mm5, mm1); /* x5*w22+x1*w20 x5*w18+x1*w16 */
paddd_m2r (*(r_inv_row), mm3); /* +rounder */
pmaddwd_r2r (mm6, mm7); /* x7*w23+x3*w21 x7*w19+x3*w17 */
pmaddwd_m2r (*(tab_i_01234567 + 12), mm2); /* x6*w15+x2*w13 x6*w11+x2*w09 */
paddd_r2r (mm4, mm3); /* 4 ; a1=sum(even1) a0=sum(even0) */
pmaddwd_m2r (*(tab_i_01234567 + 24), mm5); /* x5*w30+x1*w28 x5*w26+x1*w24 */
movq_r2r (mm3, mm4); /* 4 ; a1 a0 */
pmaddwd_m2r (*(tab_i_01234567 + 28), mm6); /* x7*w31+x3*w29 x7*w27+x3*w25 */
paddd_r2r (mm7, mm1); /* 7 ; b1=sum(odd1) b0=sum(odd0) */
paddd_m2r (*(r_inv_row), mm0); /* +rounder */
psubd_r2r (mm1, mm3); /* a1-b1 a0-b0 */
psrad_i2r (SHIFT_INV_ROW, mm3); /* y6=a1-b1 y7=a0-b0 */
paddd_r2r (mm4, mm1); /* 4 ; a1+b1 a0+b0 */
paddd_r2r (mm2, mm0); /* 2 ; a3=sum(even3) a2=sum(even2) */
psrad_i2r (SHIFT_INV_ROW, mm1); /* y1=a1+b1 y0=a0+b0 */
paddd_r2r (mm6, mm5); /* 6 ; b3=sum(odd3) b2=sum(odd2) */
movq_r2r (mm0, mm4); /* 4 ; a3 a2 */
paddd_r2r (mm5, mm0); /* a3+b3 a2+b2 */
psubd_r2r (mm5, mm4); /* 5 ; a3-b3 a2-b2 */
psrad_i2r (SHIFT_INV_ROW, mm4); /* y4=a3-b3 y5=a2-b2 */
psrad_i2r (SHIFT_INV_ROW, mm0); /* y3=a3+b3 y2=a2+b2 */
packssdw_r2r (mm3, mm4); /* 3 ; y6 y7 y4 y5 */
packssdw_r2r (mm0, mm1); /* 0 ; y3 y2 y1 y0 */
movq_r2r (mm4, mm7); /* 7 ; y6 y7 y4 y5 */
psrld_i2r (16, mm4); /* 0 y6 0 y4 */
movq_r2m (mm1, *(out)); /* 1 ; save y3 y2 y1 y0 */
pslld_i2r (16, mm7); /* y7 0 y5 0 */
por_r2r (mm4, mm7); /* 4 ; y7 y6 y5 y4 */
/* ---------- */
movq_r2r (mm0, mm5); /* 5 ; x5 x1 x4 x0 */
punpckldq_r2r (mm0, mm0); /* x4 x0 x4 x0 */
movq_m2r (*(tab_i_01234567 + 4), mm4); /* 4 ; w07 w05 w03 w01 */
punpckhwd_r2r (mm1, mm2); /* 1 ; x7 x3 x6 x2 */
pmaddwd_r2r (mm0, mm3); /* x4*w06+x0*w04 x4*w02+x0*w00 */
movq_r2r (mm2, mm6); /* 6 ; x7 x3 x6 x2 */
movq_m2r (*(tab_i_01234567 + 16), mm1); /* 1 ; w22 w20 w18 w16 */
punpckldq_r2r (mm2, mm2); /* x6 x2 x6 x2 */
pmaddwd_r2r (mm2, mm4); /* x6*w07+x2*w05 x6*w03+x2*w01 */
punpckhdq_r2r (mm5, mm5); /* x5 x1 x5 x1 */
pmaddwd_m2r (*(tab_i_01234567 + 8), mm0); /* x4*w14+x0*w12 x4*w10+x0*w08 */
punpckhdq_r2r (mm6, mm6); /* x7 x3 x7 x3 */
movq_m2r (*(tab_i_01234567 + 20), mm7); /* 7 ; w23 w21 w19 w17 */
pmaddwd_r2r (mm5, mm1); /* x5*w22+x1*w20 x5*w18+x1*w16 */
paddd_m2r (*(r_inv_row), mm3); /* +rounder */
pmaddwd_r2r (mm6, mm7); /* x7*w23+x3*w21 x7*w19+x3*w17 */
pmaddwd_m2r (*(tab_i_01234567 + 12), mm2); /* x6*w15+x2*w13 x6*w11+x2*w09 */
paddd_r2r (mm4, mm3); /* 4 ; a1=sum(even1) a0=sum(even0) */
pmaddwd_m2r (*(tab_i_01234567 + 24), mm5); /* x5*w30+x1*w28 x5*w26+x1*w24 */
movq_r2r (mm3, mm4); /* 4 ; a1 a0 */
pmaddwd_m2r (*(tab_i_01234567 + 28), mm6); /* x7*w31+x3*w29 x7*w27+x3*w25 */
paddd_r2r (mm7, mm1); /* 7 ; b1=sum(odd1) b0=sum(odd0) */
paddd_m2r (*(r_inv_row), mm0); /* +rounder */
psubd_r2r (mm1, mm3); /* a1-b1 a0-b0 */
psrad_i2r (SHIFT_INV_ROW, mm3); /* y6=a1-b1 y7=a0-b0 */
paddd_r2r (mm4, mm1); /* 4 ; a1+b1 a0+b0 */
paddd_r2r (mm2, mm0); /* 2 ; a3=sum(even3) a2=sum(even2) */
psrad_i2r (SHIFT_INV_ROW, mm1); /* y1=a1+b1 y0=a0+b0 */
paddd_r2r (mm6, mm5); /* 6 ; b3=sum(odd3) b2=sum(odd2) */
movq_r2r (mm0, mm4); /* 4 ; a3 a2 */
paddd_r2r (mm5, mm0); /* a3+b3 a2+b2 */
psubd_r2r (mm5, mm4); /* 5 ; a3-b3 a2-b2 */
psrad_i2r (SHIFT_INV_ROW, mm4); /* y4=a3-b3 y5=a2-b2 */
psrad_i2r (SHIFT_INV_ROW, mm0); /* y3=a3+b3 y2=a2+b2 */
packssdw_r2r (mm3, mm4); /* 3 ; y6 y7 y4 y5 */
packssdw_r2r (mm0, mm1); /* 0 ; y3 y2 y1 y0 */
movq_r2r (mm4, mm7); /* 7 ; y6 y7 y4 y5 */
psrld_i2r (16, mm4); /* 0 y6 0 y4 */
movq_r2m (mm1, *(out)); /* 1 ; save y3 y2 y1 y0 */
pslld_i2r (16, mm7); /* y7 0 y5 0 */
por_r2r (mm4, mm7); /* 4 ; y7 y6 y5 y4 */
/* begin processing row 1 */
movq_r2m (mm7, *(out + 4)); /* 7 ; save y7 y6 y5 y4 */
/* begin processing row 1 */
movq_r2m (mm7, *(out + 4)); /* 7 ; save y7 y6 y5 y4 */
inptr += 8;
out += 8;
}
@ -477,31 +477,31 @@ idct_mmx32_rows (short *blk)
out = &qwTemp[0];
movq_m2r (*(out + ROW_STRIDE * 0), mm0);
movq_m2r (*(out + ROW_STRIDE * 1), mm1);
movq_r2r (mm0, mm4); /* mm4 = copy of row1[A B C D] */
movq_r2r (mm0, mm4); /* mm4 = copy of row1[A B C D] */
movq_m2r (*(out + ROW_STRIDE * 2), mm2);
punpcklwd_r2r (mm1, mm0); /* mm0 = [ 0 4 1 5] */
punpcklwd_r2r (mm1, mm0); /* mm0 = [ 0 4 1 5] */
movq_m2r (*(out + ROW_STRIDE * 3), mm3);
punpckhwd_r2r (mm1, mm4); /* mm4 = [ 2 6 3 7] */
punpckhwd_r2r (mm1, mm4); /* mm4 = [ 2 6 3 7] */
movq_r2r (mm2, mm6);
punpcklwd_r2r (mm3, mm2); /* mm2 = [ 8 12 9 13] */
punpckhwd_r2r (mm3, mm6); /* mm6 = 10 14 11 15] */
movq_r2r (mm0, mm1); /* mm1 = [ 0 4 1 5] */
punpcklwd_r2r (mm3, mm2); /* mm2 = [ 8 12 9 13] */
punpckhwd_r2r (mm3, mm6); /* mm6 = 10 14 11 15] */
movq_r2r (mm0, mm1); /* mm1 = [ 0 4 1 5] */
inptr = blk;
punpckldq_r2r (mm2, mm0); /* final result mm0 = row1 [0 4 8 12] */
movq_r2r (mm4, mm3); /* mm3 = [ 2 6 3 7] */
punpckhdq_r2r (mm2, mm1); /* mm1 = final result mm1 = row2 [1 5 9 13] */
movq_r2m (mm0, *(inptr + ROW_STRIDE * 0)); /* store row 1 */
punpckldq_r2r (mm6, mm4); /* final result mm4 = row3 [2 6 10 14] */
punpckldq_r2r (mm2, mm0); /* final result mm0 = row1 [0 4 8 12] */
movq_r2r (mm4, mm3); /* mm3 = [ 2 6 3 7] */
punpckhdq_r2r (mm2, mm1); /* mm1 = final result mm1 = row2 [1 5 9 13] */
movq_r2m (mm0, *(inptr + ROW_STRIDE * 0)); /* store row 1 */
punpckldq_r2r (mm6, mm4); /* final result mm4 = row3 [2 6 10 14] */
/* begin reading next quadrant (lower-right) */
movq_m2r (*(out + ROW_STRIDE * 4 + 4), mm0);
punpckhdq_r2r (mm6, mm3); /* final result mm3 = row4 [3 7 11 15] */
movq_r2m (mm4, *(inptr + ROW_STRIDE * 2)); /* store row 3 */
movq_r2r (mm0, mm4); /* mm4 = copy of row1[A B C D] */
movq_r2m (mm1, *(inptr + ROW_STRIDE * 1)); /* store row 2 */
punpckhdq_r2r (mm6, mm3); /* final result mm3 = row4 [3 7 11 15] */
movq_r2m (mm4, *(inptr + ROW_STRIDE * 2)); /* store row 3 */
movq_r2r (mm0, mm4); /* mm4 = copy of row1[A B C D] */
movq_r2m (mm1, *(inptr + ROW_STRIDE * 1)); /* store row 2 */
movq_m2r (*(out + ROW_STRIDE * 5 + 4), mm1);
movq_r2m (mm3, *(inptr + ROW_STRIDE * 3)); /* store row 4 */
punpcklwd_r2r (mm1, mm0); /* mm0 = [ 0 4 1 5] */
movq_r2m (mm3, *(inptr + ROW_STRIDE * 3)); /* store row 4 */
punpcklwd_r2r (mm1, mm0); /* mm0 = [ 0 4 1 5] */
/* 2) transpose lower-right quadrant */
@ -512,28 +512,28 @@ idct_mmx32_rows (short *blk)
movq_m2r (*(out + ROW_STRIDE * 6 + 4), mm2);
/* punpcklwd mm0, mm1; // mm0 = [ 0 4 1 5] */
punpckhwd_r2r (mm1, mm4); /* mm4 = [ 2 6 3 7] */
punpckhwd_r2r (mm1, mm4); /* mm4 = [ 2 6 3 7] */
movq_m2r (*(out + ROW_STRIDE * 7 + 4), mm3);
movq_r2r (mm2, mm6);
punpcklwd_r2r (mm3, mm2); /* mm2 = [ 8 12 9 13] */
movq_r2r (mm0, mm1); /* mm1 = [ 0 4 1 5] */
punpckhwd_r2r (mm3, mm6); /* mm6 = 10 14 11 15] */
movq_r2r (mm4, mm3); /* mm3 = [ 2 6 3 7] */
punpckldq_r2r (mm2, mm0); /* final result mm0 = row1 [0 4 8 12] */
punpckhdq_r2r (mm2, mm1); /* mm1 = final result mm1 = row2 [1 5 9 13] */
; /* slot */
movq_r2m (mm0, *(inptr + ROW_STRIDE * 4 + 4)); /* store row 1 */
punpckldq_r2r (mm6, mm4); /* final result mm4 = row3 [2 6 10 14] */
punpcklwd_r2r (mm3, mm2); /* mm2 = [ 8 12 9 13] */
movq_r2r (mm0, mm1); /* mm1 = [ 0 4 1 5] */
punpckhwd_r2r (mm3, mm6); /* mm6 = 10 14 11 15] */
movq_r2r (mm4, mm3); /* mm3 = [ 2 6 3 7] */
punpckldq_r2r (mm2, mm0); /* final result mm0 = row1 [0 4 8 12] */
punpckhdq_r2r (mm2, mm1); /* mm1 = final result mm1 = row2 [1 5 9 13] */
; /* slot */
movq_r2m (mm0, *(inptr + ROW_STRIDE * 4 + 4)); /* store row 1 */
punpckldq_r2r (mm6, mm4); /* final result mm4 = row3 [2 6 10 14] */
movq_m2r (*(out + ROW_STRIDE * 4), mm0);
punpckhdq_r2r (mm6, mm3); /* final result mm3 = row4 [3 7 11 15] */
movq_r2m (mm4, *(inptr + ROW_STRIDE * 6 + 4)); /* store row 3 */
movq_r2r (mm0, mm4); /* mm4 = copy of row1[A B C D] */
movq_r2m (mm1, *(inptr + ROW_STRIDE * 5 + 4)); /* store row 2 */
; /* slot */
punpckhdq_r2r (mm6, mm3); /* final result mm3 = row4 [3 7 11 15] */
movq_r2m (mm4, *(inptr + ROW_STRIDE * 6 + 4)); /* store row 3 */
movq_r2r (mm0, mm4); /* mm4 = copy of row1[A B C D] */
movq_r2m (mm1, *(inptr + ROW_STRIDE * 5 + 4)); /* store row 2 */
; /* slot */
movq_m2r (*(out + ROW_STRIDE * 5), mm1);
; /* slot */
movq_r2m (mm3, *(inptr + ROW_STRIDE * 7 + 4)); /* store row 4 */
punpcklwd_r2r (mm1, mm0); /* mm0 = [ 0 4 1 5] */
; /* slot */
movq_r2m (mm3, *(inptr + ROW_STRIDE * 7 + 4)); /* store row 4 */
punpcklwd_r2r (mm1, mm0); /* mm0 = [ 0 4 1 5] */
/* 3) transpose lower-left */
/* movq mm0, qword ptr [OUT + ROW_STRIDE * 4 ] */
@ -543,28 +543,28 @@ idct_mmx32_rows (short *blk)
movq_m2r (*(out + ROW_STRIDE * 6), mm2);
/* punpcklwd mm0, mm1; // mm0 = [ 0 4 1 5] */
punpckhwd_r2r (mm1, mm4); /* mm4 = [ 2 6 3 7] */
punpckhwd_r2r (mm1, mm4); /* mm4 = [ 2 6 3 7] */
movq_m2r (*(out + ROW_STRIDE * 7), mm3);
movq_r2r (mm2, mm6);
punpcklwd_r2r (mm3, mm2); /* mm2 = [ 8 12 9 13] */
movq_r2r (mm0, mm1); /* mm1 = [ 0 4 1 5] */
punpckhwd_r2r (mm3, mm6); /* mm6 = 10 14 11 15] */
movq_r2r (mm4, mm3); /* mm3 = [ 2 6 3 7] */
punpckldq_r2r (mm2, mm0); /* final result mm0 = row1 [0 4 8 12] */
punpckhdq_r2r (mm2, mm1); /* mm1 = final result mm1 = row2 [1 5 9 13] */
; /*slot */
movq_r2m (mm0, *(inptr + ROW_STRIDE * 0 + 4)); /* store row 1 */
punpckldq_r2r (mm6, mm4); /* final result mm4 = row3 [2 6 10 14] */
punpcklwd_r2r (mm3, mm2); /* mm2 = [ 8 12 9 13] */
movq_r2r (mm0, mm1); /* mm1 = [ 0 4 1 5] */
punpckhwd_r2r (mm3, mm6); /* mm6 = 10 14 11 15] */
movq_r2r (mm4, mm3); /* mm3 = [ 2 6 3 7] */
punpckldq_r2r (mm2, mm0); /* final result mm0 = row1 [0 4 8 12] */
punpckhdq_r2r (mm2, mm1); /* mm1 = final result mm1 = row2 [1 5 9 13] */
; /*slot */
movq_r2m (mm0, *(inptr + ROW_STRIDE * 0 + 4)); /* store row 1 */
punpckldq_r2r (mm6, mm4); /* final result mm4 = row3 [2 6 10 14] */
/* begin reading next quadrant (upper-right) */
movq_m2r (*(out + ROW_STRIDE * 0 + 4), mm0);
punpckhdq_r2r (mm6, mm3); /* final result mm3 = row4 [3 7 11 15] */
movq_r2m (mm4, *(inptr + ROW_STRIDE * 2 + 4)); /* store row 3 */
movq_r2r (mm0, mm4); /* mm4 = copy of row1[A B C D] */
movq_r2m (mm1, *(inptr + ROW_STRIDE * 1 + 4)); /* store row 2 */
punpckhdq_r2r (mm6, mm3); /* final result mm3 = row4 [3 7 11 15] */
movq_r2m (mm4, *(inptr + ROW_STRIDE * 2 + 4)); /* store row 3 */
movq_r2r (mm0, mm4); /* mm4 = copy of row1[A B C D] */
movq_r2m (mm1, *(inptr + ROW_STRIDE * 1 + 4)); /* store row 2 */
movq_m2r (*(out + ROW_STRIDE * 1 + 4), mm1);
movq_r2m (mm3, *(inptr + ROW_STRIDE * 3 + 4)); /* store row 4 */
punpcklwd_r2r (mm1, mm0); /* mm0 = [ 0 4 1 5] */
movq_r2m (mm3, *(inptr + ROW_STRIDE * 3 + 4)); /* store row 4 */
punpcklwd_r2r (mm1, mm0); /* mm0 = [ 0 4 1 5] */
/* 2) transpose lower-right quadrant */
@ -575,28 +575,28 @@ idct_mmx32_rows (short *blk)
movq_m2r (*(out + ROW_STRIDE * 2 + 4), mm2);
/* punpcklwd mm0, mm1; // mm0 = [ 0 4 1 5] */
punpckhwd_r2r (mm1, mm4); /* mm4 = [ 2 6 3 7] */
punpckhwd_r2r (mm1, mm4); /* mm4 = [ 2 6 3 7] */
movq_m2r (*(out + ROW_STRIDE * 3 + 4), mm3);
movq_r2r (mm2, mm6);
punpcklwd_r2r (mm3, mm2); /* mm2 = [ 8 12 9 13] */
movq_r2r (mm0, mm1); /* mm1 = [ 0 4 1 5] */
punpckhwd_r2r (mm3, mm6); /* mm6 = 10 14 11 15] */
movq_r2r (mm4, mm3); /* mm3 = [ 2 6 3 7] */
punpckldq_r2r (mm2, mm0); /* final result mm0 = row1 [0 4 8 12] */
punpckhdq_r2r (mm2, mm1); /* mm1 = final result mm1 = row2 [1 5 9 13] */
; /* slot */
movq_r2m (mm0, *(inptr + ROW_STRIDE * 4)); /* store row 1 */
punpckldq_r2r (mm6, mm4); /* final result mm4 = row3 [2 6 10 14] */
movq_r2m (mm1, *(inptr + ROW_STRIDE * 5)); /* store row 2 */
punpckhdq_r2r (mm6, mm3); /* final result mm3 = row4 [3 7 11 15] */
movq_r2m (mm4, *(inptr + ROW_STRIDE * 6)); /* store row 3 */
; /* slot */
movq_r2m (mm3, *(inptr + ROW_STRIDE * 7)); /* store row 4 */
; /* slot */
punpcklwd_r2r (mm3, mm2); /* mm2 = [ 8 12 9 13] */
movq_r2r (mm0, mm1); /* mm1 = [ 0 4 1 5] */
punpckhwd_r2r (mm3, mm6); /* mm6 = 10 14 11 15] */
movq_r2r (mm4, mm3); /* mm3 = [ 2 6 3 7] */
punpckldq_r2r (mm2, mm0); /* final result mm0 = row1 [0 4 8 12] */
punpckhdq_r2r (mm2, mm1); /* mm1 = final result mm1 = row2 [1 5 9 13] */
; /* slot */
movq_r2m (mm0, *(inptr + ROW_STRIDE * 4)); /* store row 1 */
punpckldq_r2r (mm6, mm4); /* final result mm4 = row3 [2 6 10 14] */
movq_r2m (mm1, *(inptr + ROW_STRIDE * 5)); /* store row 2 */
punpckhdq_r2r (mm6, mm3); /* final result mm3 = row4 [3 7 11 15] */
movq_r2m (mm4, *(inptr + ROW_STRIDE * 6)); /* store row 3 */
; /* slot */
movq_r2m (mm3, *(inptr + ROW_STRIDE * 7)); /* store row 4 */
; /* slot */
}
static void
idct_mmx32_cols (short *blk)
{ /* transform all 8 cols of 8x8 iDCT block */
{ /* transform all 8 cols of 8x8 iDCT block */
int x;
short *inptr = blk;
@ -612,58 +612,58 @@ idct_mmx32_cols (short *blk)
/* */
/* 2) transpose the matrix (which was stored in qwTemp[]) */
/* qwTemp[] -> [8x8 matrix transpose] -> blk[] */
for (x = 0; x < 8; x++) { /* transform one row per iteration */
movq_m2r (*(inptr), mm0); /* 0 ; x3 x2 x1 x0 */
movq_m2r (*(inptr + 4), mm1); /* 1 ; x7 x6 x5 x4 */
movq_r2r (mm0, mm2); /* 2 ; x3 x2 x1 x0 */
movq_m2r (*(tab_i_01234567), mm3); /* 3 ; w06 w04 w02 w00 */
punpcklwd_r2r (mm1, mm0); /* x5 x1 x4 x0 */
for (x = 0; x < 8; x++) { /* transform one row per iteration */
movq_m2r (*(inptr), mm0); /* 0 ; x3 x2 x1 x0 */
movq_m2r (*(inptr + 4), mm1); /* 1 ; x7 x6 x5 x4 */
movq_r2r (mm0, mm2); /* 2 ; x3 x2 x1 x0 */
movq_m2r (*(tab_i_01234567), mm3); /* 3 ; w06 w04 w02 w00 */
punpcklwd_r2r (mm1, mm0); /* x5 x1 x4 x0 */
/* ---------- */
movq_r2r (mm0, mm5); /* 5 ; x5 x1 x4 x0 */
punpckldq_r2r (mm0, mm0); /* x4 x0 x4 x0 */
movq_m2r (*(tab_i_01234567 + 4), mm4); /* 4 ; w07 w05 w03 w01 */
punpckhwd_r2r (mm1, mm2); /* 1 ; x7 x3 x6 x2 */
pmaddwd_r2r (mm0, mm3); /* x4*w06+x0*w04 x4*w02+x0*w00 */
movq_r2r (mm2, mm6); /* 6 ; x7 x3 x6 x2 */
movq_m2r (*(tab_i_01234567 + 16), mm1); /* 1 ; w22 w20 w18 w16 */
punpckldq_r2r (mm2, mm2); /* x6 x2 x6 x2 */
pmaddwd_r2r (mm2, mm4); /* x6*w07+x2*w05 x6*w03+x2*w01 */
punpckhdq_r2r (mm5, mm5); /* x5 x1 x5 x1 */
pmaddwd_m2r (*(tab_i_01234567 + 8), mm0); /* x4*w14+x0*w12 x4*w10+x0*w08 */
punpckhdq_r2r (mm6, mm6); /* x7 x3 x7 x3 */
movq_m2r (*(tab_i_01234567 + 20), mm7); /* 7 ; w23 w21 w19 w17 */
pmaddwd_r2r (mm5, mm1); /* x5*w22+x1*w20 x5*w18+x1*w16 */
paddd_m2r (*(r_inv_col), mm3); /* +rounder */
pmaddwd_r2r (mm6, mm7); /* x7*w23+x3*w21 x7*w19+x3*w17 */
pmaddwd_m2r (*(tab_i_01234567 + 12), mm2); /* x6*w15+x2*w13 x6*w11+x2*w09 */
paddd_r2r (mm4, mm3); /* 4 ; a1=sum(even1) a0=sum(even0) */
pmaddwd_m2r (*(tab_i_01234567 + 24), mm5); /* x5*w30+x1*w28 x5*w26+x1*w24 */
movq_r2r (mm3, mm4); /* 4 ; a1 a0 */
pmaddwd_m2r (*(tab_i_01234567 + 28), mm6); /* x7*w31+x3*w29 x7*w27+x3*w25 */
paddd_r2r (mm7, mm1); /* 7 ; b1=sum(odd1) b0=sum(odd0) */
paddd_m2r (*(r_inv_col), mm0); /* +rounder */
psubd_r2r (mm1, mm3); /* a1-b1 a0-b0 */
psrad_i2r (SHIFT_INV_COL, mm3); /* y6=a1-b1 y7=a0-b0 */
paddd_r2r (mm4, mm1); /* 4 ; a1+b1 a0+b0 */
paddd_r2r (mm2, mm0); /* 2 ; a3=sum(even3) a2=sum(even2) */
psrad_i2r (SHIFT_INV_COL, mm1); /* y1=a1+b1 y0=a0+b0 */
paddd_r2r (mm6, mm5); /* 6 ; b3=sum(odd3) b2=sum(odd2) */
movq_r2r (mm0, mm4); /* 4 ; a3 a2 */
paddd_r2r (mm5, mm0); /* a3+b3 a2+b2 */
psubd_r2r (mm5, mm4); /* 5 ; a3-b3 a2-b2 */
psrad_i2r (SHIFT_INV_COL, mm4); /* y4=a3-b3 y5=a2-b2 */
psrad_i2r (SHIFT_INV_COL, mm0); /* y3=a3+b3 y2=a2+b2 */
packssdw_r2r (mm3, mm4); /* 3 ; y6 y7 y4 y5 */
packssdw_r2r (mm0, mm1); /* 0 ; y3 y2 y1 y0 */
movq_r2r (mm4, mm7); /* 7 ; y6 y7 y4 y5 */
psrld_i2r (16, mm4); /* 0 y6 0 y4 */
movq_r2m (mm1, *(inptr)); /* 1 ; save y3 y2 y1 y0 */
pslld_i2r (16, mm7); /* y7 0 y5 0 */
por_r2r (mm4, mm7); /* 4 ; y7 y6 y5 y4 */
movq_r2r (mm0, mm5); /* 5 ; x5 x1 x4 x0 */
punpckldq_r2r (mm0, mm0); /* x4 x0 x4 x0 */
movq_m2r (*(tab_i_01234567 + 4), mm4); /* 4 ; w07 w05 w03 w01 */
punpckhwd_r2r (mm1, mm2); /* 1 ; x7 x3 x6 x2 */
pmaddwd_r2r (mm0, mm3); /* x4*w06+x0*w04 x4*w02+x0*w00 */
movq_r2r (mm2, mm6); /* 6 ; x7 x3 x6 x2 */
movq_m2r (*(tab_i_01234567 + 16), mm1); /* 1 ; w22 w20 w18 w16 */
punpckldq_r2r (mm2, mm2); /* x6 x2 x6 x2 */
pmaddwd_r2r (mm2, mm4); /* x6*w07+x2*w05 x6*w03+x2*w01 */
punpckhdq_r2r (mm5, mm5); /* x5 x1 x5 x1 */
pmaddwd_m2r (*(tab_i_01234567 + 8), mm0); /* x4*w14+x0*w12 x4*w10+x0*w08 */
punpckhdq_r2r (mm6, mm6); /* x7 x3 x7 x3 */
movq_m2r (*(tab_i_01234567 + 20), mm7); /* 7 ; w23 w21 w19 w17 */
pmaddwd_r2r (mm5, mm1); /* x5*w22+x1*w20 x5*w18+x1*w16 */
paddd_m2r (*(r_inv_col), mm3); /* +rounder */
pmaddwd_r2r (mm6, mm7); /* x7*w23+x3*w21 x7*w19+x3*w17 */
pmaddwd_m2r (*(tab_i_01234567 + 12), mm2); /* x6*w15+x2*w13 x6*w11+x2*w09 */
paddd_r2r (mm4, mm3); /* 4 ; a1=sum(even1) a0=sum(even0) */
pmaddwd_m2r (*(tab_i_01234567 + 24), mm5); /* x5*w30+x1*w28 x5*w26+x1*w24 */
movq_r2r (mm3, mm4); /* 4 ; a1 a0 */
pmaddwd_m2r (*(tab_i_01234567 + 28), mm6); /* x7*w31+x3*w29 x7*w27+x3*w25 */
paddd_r2r (mm7, mm1); /* 7 ; b1=sum(odd1) b0=sum(odd0) */
paddd_m2r (*(r_inv_col), mm0); /* +rounder */
psubd_r2r (mm1, mm3); /* a1-b1 a0-b0 */
psrad_i2r (SHIFT_INV_COL, mm3); /* y6=a1-b1 y7=a0-b0 */
paddd_r2r (mm4, mm1); /* 4 ; a1+b1 a0+b0 */
paddd_r2r (mm2, mm0); /* 2 ; a3=sum(even3) a2=sum(even2) */
psrad_i2r (SHIFT_INV_COL, mm1); /* y1=a1+b1 y0=a0+b0 */
paddd_r2r (mm6, mm5); /* 6 ; b3=sum(odd3) b2=sum(odd2) */
movq_r2r (mm0, mm4); /* 4 ; a3 a2 */
paddd_r2r (mm5, mm0); /* a3+b3 a2+b2 */
psubd_r2r (mm5, mm4); /* 5 ; a3-b3 a2-b2 */
psrad_i2r (SHIFT_INV_COL, mm4); /* y4=a3-b3 y5=a2-b2 */
psrad_i2r (SHIFT_INV_COL, mm0); /* y3=a3+b3 y2=a2+b2 */
packssdw_r2r (mm3, mm4); /* 3 ; y6 y7 y4 y5 */
packssdw_r2r (mm0, mm1); /* 0 ; y3 y2 y1 y0 */
movq_r2r (mm4, mm7); /* 7 ; y6 y7 y4 y5 */
psrld_i2r (16, mm4); /* 0 y6 0 y4 */
movq_r2m (mm1, *(inptr)); /* 1 ; save y3 y2 y1 y0 */
pslld_i2r (16, mm7); /* y7 0 y5 0 */
por_r2r (mm4, mm7); /* 4 ; y7 y6 y5 y4 */
/* begin processing row 1 */
movq_r2m (mm7, *(inptr + 4)); /* 7 ; save y7 y6 y5 y4 */
/* begin processing row 1 */
movq_r2m (mm7, *(inptr + 4)); /* 7 ; save y7 y6 y5 y4 */
inptr += 8;
}
@ -679,10 +679,12 @@ gst_idct_mmx32_idct (short *blk)
{
/* 1) iDCT row transformation */
idct_mmx32_rows (blk); /* 1) transform iDCT row, and transpose */
idct_mmx32_rows (blk); /* 1) transform iDCT row, and transpose */
/* 2) iDCT column transformation */
idct_mmx32_cols (blk); /* 2) transform iDCT row, and transpose */
emms (); /* restore processor state */
idct_mmx32_cols (blk); /* 2) transform iDCT row, and transpose */
emms (); /* restore processor state */
/* all done */
}
}

View file

@ -104,11 +104,11 @@ have_type_callback (GstElement * typefind, guint probability, GstCaps * type,
/* FIXME: signal error */
g_warning ("Couldn't create id3tag");
if (!gst_element_link_many (priv->source, priv->decontainer, priv->typefind,
NULL));
NULL));
g_warning ("Couldn't link in id3tag");
if (gst_element_set_state (priv->pipeline, GST_STATE_PLAYING)
== GST_STATE_FAILURE)
== GST_STATE_FAILURE)
g_warning ("Couldn't set to playing");
}
#endif
@ -139,8 +139,8 @@ deep_notify_callback (GObject * object, GstObject * origin,
GST_DEBUG ("caps: %" GST_PTR_FORMAT, priv->format);
} else
GST_DEBUG ("ignoring caps on object %s:%s",
gst_object_get_name (gst_object_get_parent (origin)),
gst_object_get_name (origin));
gst_object_get_name (gst_object_get_parent (origin)),
gst_object_get_name (origin));
} else if (strcmp (pspec->name, "offset") == 0) {
/* we REALLY ignore offsets, we hate them */
}
@ -151,7 +151,8 @@ typedef struct
{
guint meta;
guint encoded;
} TagFlagScore;
}
TagFlagScore;
static void
tag_flag_score (const GstTagList * list, const gchar * tag, gpointer user_data)
@ -323,7 +324,7 @@ gmi_seek_to_track (GstMediaInfo * info, long track)
res = gst_pad_send_event (info->priv->decoder_pad, event);
if (!res) {
g_warning ("seek to logical track on pad %s:%s failed",
GST_DEBUG_PAD_NAME (info->priv->decoder_pad));
GST_DEBUG_PAD_NAME (info->priv->decoder_pad));
return FALSE;
}
/* clear structs because of the seek */
@ -350,37 +351,37 @@ gmi_set_mime (GstMediaInfo * info, const char *mime)
if ((strcmp (mime, "application/x-ogg") == 0) ||
(strcmp (mime, "application/ogg") == 0))
desc =
g_strdup_printf
("%s name=source ! oggdemux ! vorbisdec name=decoder ! fakesink name=sink",
priv->source_name);
g_strdup_printf
("%s name=source ! oggdemux ! vorbisdec name=decoder ! fakesink name=sink",
priv->source_name);
else if ((strcmp (mime, "audio/mpeg") == 0)
|| (strcmp (mime, "audio/x-mp3") == 0)
|| (strcmp (mime, "audio/mp3") == 0)
|| (strcmp (mime, "application/x-id3") == 0)
|| (strcmp (mime, "audio/x-id3") == 0))
desc =
g_strdup_printf
("%s name=source ! id3tag ! mad name=decoder ! audio/x-raw-int ! fakesink name=sink",
priv->source_name);
g_strdup_printf
("%s name=source ! id3tag ! mad name=decoder ! audio/x-raw-int ! fakesink name=sink",
priv->source_name);
else if ((strcmp (mime, "application/x-flac") == 0)
|| (strcmp (mime, "audio/x-flac") == 0))
desc =
g_strdup_printf
("%s name=source ! flacdec name=decoder ! audio/x-raw-int ! fakesink name=sink",
priv->source_name);
g_strdup_printf
("%s name=source ! flacdec name=decoder ! audio/x-raw-int ! fakesink name=sink",
priv->source_name);
else if ((strcmp (mime, "audio/wav") == 0)
|| (strcmp (mime, "audio/x-wav") == 0))
desc =
g_strdup_printf
("%s ! wavparse name=decoder ! audio/x-raw-int ! fakesink name=sink",
priv->source_name);
g_strdup_printf
("%s ! wavparse name=decoder ! audio/x-raw-int ! fakesink name=sink",
priv->source_name);
else if (strcmp (mime, "audio/x-mod") == 0
|| strcmp (mime, "audio/x-s3m") == 0 || strcmp (mime, "audio/x-xm") == 0
|| strcmp (mime, "audio/x-it") == 0)
desc =
g_strdup_printf
("%s name=source ! modplug name=decoder ! audio/x-raw-int ! fakesink name=sink",
priv->source_name);
g_strdup_printf
("%s name=source ! modplug name=decoder ! audio/x-raw-int ! fakesink name=sink",
priv->source_name);
else
return FALSE;
@ -409,7 +410,7 @@ gmi_set_mime (GstMediaInfo * info, const char *mime)
g_assert (GST_IS_PAD (priv->decoder_pad));
GST_DEBUG ("decoder pad: %s:%s",
gst_object_get_name (gst_object_get_parent (GST_OBJECT (priv->
decoder_pad))), gst_pad_get_name (priv->decoder_pad));
decoder_pad))), gst_pad_get_name (priv->decoder_pad));
/* attach notify handler */
g_signal_connect (G_OBJECT (info->priv->pipeline), "deep_notify",
@ -557,21 +558,21 @@ gmip_find_stream_post (GstMediaInfoPriv * priv)
if (res) {
switch (format) {
case GST_FORMAT_TIME:
stream->length_time = value;
GST_DEBUG (" total %s: %lld", definition->nick, value);
break;
case GST_FORMAT_DEFAULT:
case GST_FORMAT_BYTES:
break;
default:
/* separation is necessary because track_format doesn't resolve to
* int */
if (format == track_format) {
stream->length_tracks = value;
GST_DEBUG (" total %s: %lld", definition->nick, value);
} else
GST_DEBUG ("unhandled format %s", definition->nick);
case GST_FORMAT_TIME:
stream->length_time = value;
GST_DEBUG (" total %s: %lld", definition->nick, value);
break;
case GST_FORMAT_DEFAULT:
case GST_FORMAT_BYTES:
break;
default:
/* separation is necessary because track_format doesn't resolve to
* int */
if (format == track_format) {
stream->length_tracks = value;
GST_DEBUG (" total %s: %lld", definition->nick, value);
} else
GST_DEBUG ("unhandled format %s", definition->nick);
}
} else
GST_DEBUG ("query didn't return result for %s", definition->nick);
@ -597,7 +598,7 @@ gmip_find_stream_post (GstMediaInfoPriv * priv)
stream->bitrate = (long) (bits / seconds);
}
GST_DEBUG ("moving to STATE_METADATA\n");
priv->state = GST_MEDIA_INFO_STATE_METADATA; /* metadata of first track */
priv->state = GST_MEDIA_INFO_STATE_METADATA; /* metadata of first track */
return TRUE;
}
@ -694,23 +695,23 @@ gmip_find_track_streaminfo_post (GstMediaInfoPriv * priv)
gboolean res;
res = gst_pad_query (priv->decoder_pad, GST_QUERY_POSITION,
&track_format, &value_start);
&track_format, &value_start);
if (res) {
format = GST_FORMAT_TIME;
track_num = value_start;
GST_DEBUG ("we are currently at %ld", track_num);
res = gst_pad_convert (priv->decoder_pad,
track_format, track_num, &format, &value_start);
track_format, track_num, &format, &value_start);
res &= gst_pad_convert (priv->decoder_pad,
track_format, track_num + 1, &format, &value_end);
track_format, track_num + 1, &format, &value_end);
if (res) {
/* substract to get the length */
GST_DEBUG ("start %lld, end %lld", value_start, value_end);
value_end -= value_start;
/* FIXME: check units; this is in seconds */
/* substract to get the length */
GST_DEBUG ("start %lld, end %lld", value_start, value_end);
value_end -= value_start;
/* FIXME: check units; this is in seconds */
gst_tag_list_add (priv->streaminfo, GST_TAG_MERGE_REPLACE,
GST_TAG_DURATION, (int) (value_end / 1E6), NULL);
gst_tag_list_add (priv->streaminfo, GST_TAG_MERGE_REPLACE,
GST_TAG_DURATION, (int) (value_end / 1E6), NULL);
}
}
}

View file

@ -18,7 +18,7 @@ print_tag (const GstTagList * list, const gchar * tag, gpointer unused)
g_assert (gst_tag_list_get_string_index (list, tag, i, &str));
} else {
str =
g_strdup_value_contents (gst_tag_list_get_value_index (list, tag, i));
g_strdup_value_contents (gst_tag_list_get_value_index (list, tag, i));
}
if (i == 0) {

View file

@ -113,8 +113,9 @@ gst_media_info_get_type (void)
(GInstanceInitFunc) gst_media_info_instance_init,
NULL
};
gst_media_info_type = g_type_register_static (G_TYPE_OBJECT,
"GstMediaInfo", &gst_media_info_info, 0);
"GstMediaInfo", &gst_media_info_info, 0);
}
return gst_media_info_type;
}
@ -192,7 +193,7 @@ gst_media_info_new (GError ** error)
info->priv->error = NULL;
} else {
g_warning ("Error creating GstMediaInfo object.\n%s",
info->priv->error->message);
info->priv->error->message);
g_error_free (info->priv->error);
}
}
@ -222,7 +223,7 @@ gst_media_info_read_with_idler (GstMediaInfo * info, const char *location,
{
GstMediaInfoPriv *priv = info->priv;
gmip_reset (info->priv); /* reset all structs */
gmip_reset (info->priv); /* reset all structs */
priv->location = g_strdup (location);
priv->flags = flags;
}
@ -251,9 +252,9 @@ gst_media_info_read_idler (GstMediaInfo * info, GstMediaInfoStream ** streamp,
case GST_MEDIA_INFO_STATE_NULL:
/* make sure we have a source */
if (!priv->source_name) {
*error = g_error_new (GST_MEDIA_INFO_ERROR, 0,
"No source set on media info.");
return FALSE;
*error = g_error_new (GST_MEDIA_INFO_ERROR, 0,
"No source set on media info.");
return FALSE;
}
/* need to find type */
@ -266,26 +267,26 @@ gst_media_info_read_idler (GstMediaInfo * info, GstMediaInfoStream ** streamp,
GST_LOG ("STATE_TYPEFIND");
if ((priv->type == NULL) && gst_bin_iterate (GST_BIN (priv->pipeline))) {
GST_DEBUG ("iterating while in STATE_TYPEFIND");
GMI_DEBUG ("?");
return TRUE;
GST_DEBUG ("iterating while in STATE_TYPEFIND");
GMI_DEBUG ("?");
return TRUE;
}
if (priv->type == NULL) {
g_warning ("Couldn't find type\n");
return FALSE;
g_warning ("Couldn't find type\n");
return FALSE;
}
/* do the state transition */
GST_DEBUG ("doing find_type_post");
gmip_find_type_post (priv);
GST_DEBUG ("finding out mime type");
mime =
g_strdup (gst_structure_get_name (gst_caps_get_structure (priv->type,
0)));
g_strdup (gst_structure_get_name (gst_caps_get_structure (priv->type,
0)));
GST_DEBUG ("found out mime type: %s", mime);
if (!gmi_set_mime (info, mime)) {
/* FIXME: pop up error */
GST_DEBUG ("no decoder pipeline found for mime %s", mime);
return FALSE;
/* FIXME: pop up error */
GST_DEBUG ("no decoder pipeline found for mime %s", mime);
return FALSE;
}
priv->stream = gmi_stream_new ();
GST_DEBUG ("new stream: %p", priv->stream);
@ -298,12 +299,12 @@ gst_media_info_read_idler (GstMediaInfo * info, GstMediaInfoStream ** streamp,
{
GST_LOG ("STATE_STREAM");
if ((priv->format == NULL) && gst_bin_iterate (GST_BIN (priv->pipeline))) {
GMI_DEBUG ("?");
return TRUE;
GMI_DEBUG ("?");
return TRUE;
}
if (priv->format == NULL) {
g_warning ("Couldn't find format\n");
return FALSE;
g_warning ("Couldn't find format\n");
return FALSE;
}
/* do state transition; stream -> first track metadata */
priv->current_track_num = 0;
@ -316,21 +317,21 @@ gst_media_info_read_idler (GstMediaInfo * info, GstMediaInfoStream ** streamp,
case GST_MEDIA_INFO_STATE_METADATA:
{
if ((priv->metadata == NULL) &&
gst_bin_iterate (GST_BIN (priv->pipeline)) &&
priv->metadata_iters < MAX_METADATA_ITERS) {
GMI_DEBUG ("?");
priv->metadata_iters++;
return TRUE;
gst_bin_iterate (GST_BIN (priv->pipeline)) &&
priv->metadata_iters < MAX_METADATA_ITERS) {
GMI_DEBUG ("?");
priv->metadata_iters++;
return TRUE;
}
if (priv->metadata_iters == MAX_METADATA_ITERS)
g_print ("iterated a few times, didn't find metadata\n");
g_print ("iterated a few times, didn't find metadata\n");
if (priv->metadata == NULL) {
/* this is not a permanent failure */
GST_DEBUG ("Couldn't find metadata");
/* this is not a permanent failure */
GST_DEBUG ("Couldn't find metadata");
}
GST_DEBUG ("found metadata of track %ld", priv->current_track_num);
if (!gmip_find_track_metadata_post (priv))
return FALSE;
return FALSE;
GST_DEBUG ("METADATA: going to STREAMINFO\n");
priv->state = GST_MEDIA_INFO_STATE_STREAMINFO;
return gmip_find_track_streaminfo_pre (priv);
@ -338,50 +339,50 @@ gst_media_info_read_idler (GstMediaInfo * info, GstMediaInfoStream ** streamp,
case GST_MEDIA_INFO_STATE_STREAMINFO:
{
if ((priv->streaminfo == NULL) &&
gst_bin_iterate (GST_BIN (priv->pipeline))) {
GMI_DEBUG ("?");
return TRUE;
gst_bin_iterate (GST_BIN (priv->pipeline))) {
GMI_DEBUG ("?");
return TRUE;
}
if (priv->streaminfo == NULL) {
/* this is not a permanent failure */
GST_DEBUG ("Couldn't find streaminfo");
/* this is not a permanent failure */
GST_DEBUG ("Couldn't find streaminfo");
} else
GST_DEBUG ("found streaminfo of track %ld", priv->current_track_num);
GST_DEBUG ("found streaminfo of track %ld", priv->current_track_num);
if (!gmip_find_track_streaminfo_post (priv))
return FALSE;
return FALSE;
priv->state = GST_MEDIA_INFO_STATE_FORMAT;
return gmip_find_track_format_pre (priv);
}
case GST_MEDIA_INFO_STATE_FORMAT:
{
if ((priv->format == NULL) && gst_bin_iterate (GST_BIN (priv->pipeline))) {
GMI_DEBUG ("?");
return TRUE;
GMI_DEBUG ("?");
return TRUE;
}
if (priv->format == NULL) {
g_warning ("Couldn't find format\n");
return FALSE;
g_warning ("Couldn't find format\n");
return FALSE;
}
GST_DEBUG ("found format of track %ld", priv->current_track_num);
if (!gmip_find_track_format_post (priv))
return FALSE;
return FALSE;
/* save the track info */
priv->stream->tracks = g_list_append (priv->stream->tracks,
priv->current_track);
priv->current_track);
/* these alloc'd data types have been handed off */
priv->current_track = NULL;
priv->location = NULL;
/* now see if we need to seek to a next track or not */
priv->current_track_num++;
if (priv->current_track_num < priv->stream->length_tracks) {
gmi_seek_to_track (info, priv->current_track_num);
priv->current_track = gmi_track_new ();
if (!gmip_find_track_metadata_pre (priv)) {
g_free (priv->current_track);
return FALSE;
}
priv->state = GST_MEDIA_INFO_STATE_METADATA;
return TRUE;
gmi_seek_to_track (info, priv->current_track_num);
priv->current_track = gmi_track_new ();
if (!gmip_find_track_metadata_pre (priv)) {
g_free (priv->current_track);
return FALSE;
}
priv->state = GST_MEDIA_INFO_STATE_METADATA;
return TRUE;
}
priv->state = GST_MEDIA_INFO_STATE_DONE;
gmi_clear_decoder (info);

View file

@ -57,9 +57,9 @@ gst_mixer_get_type (void)
};
gst_mixer_type = g_type_register_static (G_TYPE_INTERFACE,
"GstMixer", &gst_mixer_info, 0);
"GstMixer", &gst_mixer_info, 0);
g_type_interface_add_prerequisite (gst_mixer_type,
GST_TYPE_IMPLEMENTS_INTERFACE);
GST_TYPE_IMPLEMENTS_INTERFACE);
}
return gst_mixer_type;
@ -72,26 +72,26 @@ gst_mixer_class_init (GstMixerClass * klass)
if (!initialized) {
gst_mixer_signals[RECORD_TOGGLED] =
g_signal_new ("record-toggled",
GST_TYPE_MIXER, G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GstMixerClass, record_toggled),
NULL, NULL,
gst_mixer_marshal_VOID__OBJECT_BOOLEAN, G_TYPE_NONE, 2,
GST_TYPE_MIXER_TRACK, G_TYPE_BOOLEAN);
g_signal_new ("record-toggled",
GST_TYPE_MIXER, G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GstMixerClass, record_toggled),
NULL, NULL,
gst_mixer_marshal_VOID__OBJECT_BOOLEAN, G_TYPE_NONE, 2,
GST_TYPE_MIXER_TRACK, G_TYPE_BOOLEAN);
gst_mixer_signals[MUTE_TOGGLED] =
g_signal_new ("mute-toggled",
GST_TYPE_MIXER, G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GstMixerClass, mute_toggled),
NULL, NULL,
gst_mixer_marshal_VOID__OBJECT_BOOLEAN, G_TYPE_NONE, 2,
GST_TYPE_MIXER_TRACK, G_TYPE_BOOLEAN);
g_signal_new ("mute-toggled",
GST_TYPE_MIXER, G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GstMixerClass, mute_toggled),
NULL, NULL,
gst_mixer_marshal_VOID__OBJECT_BOOLEAN, G_TYPE_NONE, 2,
GST_TYPE_MIXER_TRACK, G_TYPE_BOOLEAN);
gst_mixer_signals[VOLUME_CHANGED] =
g_signal_new ("volume-changed",
GST_TYPE_MIXER, G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GstMixerClass, volume_changed),
NULL, NULL,
gst_mixer_marshal_VOID__OBJECT_POINTER, G_TYPE_NONE, 2,
GST_TYPE_MIXER_TRACK, G_TYPE_POINTER);
g_signal_new ("volume-changed",
GST_TYPE_MIXER, G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GstMixerClass, volume_changed),
NULL, NULL,
gst_mixer_marshal_VOID__OBJECT_POINTER, G_TYPE_NONE, 2,
GST_TYPE_MIXER_TRACK, G_TYPE_POINTER);
initialized = TRUE;
}

View file

@ -61,8 +61,8 @@ gst_mixer_track_get_type (void)
};
gst_mixer_track_type =
g_type_register_static (G_TYPE_OBJECT,
"GstMixerTrack", &mixer_track_info, 0);
g_type_register_static (G_TYPE_OBJECT,
"GstMixerTrack", &mixer_track_info, 0);
}
return gst_mixer_track_type;
@ -79,21 +79,21 @@ gst_mixer_track_class_init (GstMixerTrackClass * klass)
g_signal_new ("record_toggled", G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GstMixerTrackClass,
record_toggled),
record_toggled),
NULL, NULL, g_cclosure_marshal_VOID__BOOLEAN,
G_TYPE_NONE, 1, G_TYPE_BOOLEAN);
signals[SIGNAL_MUTE_TOGGLED] =
g_signal_new ("mute_toggled", G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GstMixerTrackClass,
mute_toggled),
mute_toggled),
NULL, NULL, g_cclosure_marshal_VOID__BOOLEAN,
G_TYPE_NONE, 1, G_TYPE_BOOLEAN);
signals[SIGNAL_VOLUME_CHANGED] =
g_signal_new ("volume_changed", G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GstMixerTrackClass,
volume_changed),
volume_changed),
NULL, NULL, g_cclosure_marshal_VOID__POINTER,
G_TYPE_NONE, 1, G_TYPE_POINTER);

View file

@ -46,7 +46,7 @@ gst_navigation_get_type (void)
};
gst_navigation_type = g_type_register_static (G_TYPE_INTERFACE,
"GstNavigation", &gst_navigation_info, 0);
"GstNavigation", &gst_navigation_info, 0);
}
return gst_navigation_type;
@ -75,7 +75,7 @@ gst_navigation_send_key_event (GstNavigation * navigation, const char *event,
{
gst_navigation_send_event (navigation,
gst_structure_new ("application/x-gst-navigation", "event", G_TYPE_STRING,
event, "key", G_TYPE_STRING, key, NULL));
event, "key", G_TYPE_STRING, key, NULL));
}
void
@ -84,6 +84,6 @@ gst_navigation_send_mouse_event (GstNavigation * navigation, const char *event,
{
gst_navigation_send_event (navigation,
gst_structure_new ("application/x-gst-navigation", "event", G_TYPE_STRING,
event, "button", G_TYPE_INT, button, "pointer_x", G_TYPE_DOUBLE, x,
"pointer_y", G_TYPE_DOUBLE, y, NULL));
event, "button", G_TYPE_INT, button, "pointer_x", G_TYPE_DOUBLE, x,
"pointer_y", G_TYPE_DOUBLE, y, NULL));
}

View file

@ -45,8 +45,8 @@ struct _GstPlayPrivate
gint get_length_attempt;
gint tick_unblock_remaining; /* how many msecs left
to unblock due to seeking */
gint tick_unblock_remaining; /* how many msecs left
to unblock due to seeking */
guint tick_id;
guint length_id;
@ -171,7 +171,7 @@ gst_play_pipeline_setup (GstPlay * play, GError ** error)
/* Make sure we convert audio to the needed format */
GST_PLAY_MAKE_OR_ERROR (audioconvert, "audioconvert", "audioconvert",
error);
error);
g_hash_table_insert (play->priv->elements, "audioconvert", audioconvert);
/* Duplicate audio signal to audio sink and visualization thread */
@ -183,7 +183,7 @@ gst_play_pipeline_setup (GstPlay * play, GError ** error)
g_hash_table_insert (play->priv->elements, "tee", tee);
gst_bin_add_many (GST_BIN (work_thread), source, autoplugger, audioconvert,
tee, NULL);
tee, NULL);
if (!gst_element_link_many (source, autoplugger, audioconvert, tee, NULL))
GST_PLAY_ERROR_RETURN (error, "Could not link source thread elements");
@ -194,13 +194,13 @@ gst_play_pipeline_setup (GstPlay * play, GError ** error)
identity_cs = gst_element_factory_make ("ffcolorspace", "identity_cs");
if (!GST_IS_ELEMENT (identity_cs)) {
identity_cs =
gst_element_factory_make ("ffmpegcolorspace", "identity_cs");
gst_element_factory_make ("ffmpegcolorspace", "identity_cs");
if (!GST_IS_ELEMENT (identity_cs)) {
identity_cs = gst_element_factory_make ("colorspace", "identity_cs");
if (!GST_IS_ELEMENT (identity_cs)) {
gst_play_error_plugin ("colorspace", error);
return FALSE;
}
identity_cs = gst_element_factory_make ("colorspace", "identity_cs");
if (!GST_IS_ELEMENT (identity_cs)) {
gst_play_error_plugin ("colorspace", error);
return FALSE;
}
}
}
g_hash_table_insert (play->priv->elements, "identity_cs", identity_cs);
@ -232,11 +232,11 @@ gst_play_pipeline_setup (GstPlay * play, GError ** error)
if (!GST_IS_ELEMENT (vis_cs)) {
vis_cs = gst_element_factory_make ("ffmpegcolorspace", "vis_cs");
if (!GST_IS_ELEMENT (vis_cs)) {
vis_cs = gst_element_factory_make ("colorspace", "vis_cs");
if (!GST_IS_ELEMENT (vis_cs)) {
gst_play_error_plugin ("colorspace", error);
return FALSE;
}
vis_cs = gst_element_factory_make ("colorspace", "vis_cs");
if (!GST_IS_ELEMENT (vis_cs)) {
gst_play_error_plugin ("colorspace", error);
return FALSE;
}
}
}
@ -245,9 +245,9 @@ gst_play_pipeline_setup (GstPlay * play, GError ** error)
gst_bin_add_many (GST_BIN (vis_bin), vis_queue, vis_element, vis_cs, NULL);
if (!gst_element_link_many (vis_queue, vis_element, vis_cs, NULL))
GST_PLAY_ERROR_RETURN (error,
"Could not link visualisation thread elements");
"Could not link visualisation thread elements");
gst_element_add_ghost_pad (vis_bin, gst_element_get_pad (vis_cs, "src"),
"src");
"src");
}
/* Creating our video output bin */
{
@ -267,18 +267,18 @@ gst_play_pipeline_setup (GstPlay * play, GError ** error)
if (!GST_IS_ELEMENT (video_cs)) {
video_cs = gst_element_factory_make ("ffmpegcolorspace", "video_cs");
if (!GST_IS_ELEMENT (video_cs)) {
video_cs = gst_element_factory_make ("colorspace", "video_cs");
if (!GST_IS_ELEMENT (video_cs)) {
gst_play_error_plugin ("colorspace", error);
return FALSE;
}
video_cs = gst_element_factory_make ("colorspace", "video_cs");
if (!GST_IS_ELEMENT (video_cs)) {
gst_play_error_plugin ("colorspace", error);
return FALSE;
}
}
}
g_hash_table_insert (play->priv->elements, "video_cs", video_cs);
/* Software colorbalance */
GST_PLAY_MAKE_OR_ERROR (video_balance, "videobalance", "video_balance",
error);
error);
g_hash_table_insert (play->priv->elements, "video_balance", video_balance);
/* Colorspace conversion */
@ -286,11 +286,11 @@ gst_play_pipeline_setup (GstPlay * play, GError ** error)
if (!GST_IS_ELEMENT (balance_cs)) {
balance_cs = gst_element_factory_make ("ffmpegcolorspace", "balance_cs");
if (!GST_IS_ELEMENT (balance_cs)) {
balance_cs = gst_element_factory_make ("colorspace", "balance_cs");
if (!GST_IS_ELEMENT (balance_cs)) {
gst_play_error_plugin ("colorspace", error);
return FALSE;
}
balance_cs = gst_element_factory_make ("colorspace", "balance_cs");
if (!GST_IS_ELEMENT (balance_cs)) {
gst_play_error_plugin ("colorspace", error);
return FALSE;
}
}
}
g_hash_table_insert (play->priv->elements, "balance_cs", balance_cs);
@ -299,38 +299,38 @@ gst_play_pipeline_setup (GstPlay * play, GError ** error)
GST_PLAY_MAKE_OR_ERROR (video_scaler, "videoscale", "video_scaler", error);
g_hash_table_insert (play->priv->elements, "video_scaler", video_scaler);
g_signal_connect (gst_element_get_pad (video_scaler, "src"), "fixate",
G_CALLBACK (gst_play_video_fixate), play);
G_CALLBACK (gst_play_video_fixate), play);
/* Placeholder for future video sink bin */
GST_PLAY_MAKE_OR_ERROR (video_sink, "fakesink", "video_sink", error);
g_hash_table_insert (play->priv->elements, "video_sink", video_sink);
gst_bin_add_many (GST_BIN (video_thread), video_queue, video_switch,
video_cs, video_balance, balance_cs, video_scaler, video_sink, NULL);
video_cs, video_balance, balance_cs, video_scaler, video_sink, NULL);
/* break down linking so we can figure out what might be failing */
if (!gst_element_link (video_queue, video_switch))
GST_PLAY_ERROR_RETURN (error,
"Could not link video output thread (queue and switch)");
"Could not link video output thread (queue and switch)");
if (!gst_element_link (video_switch, video_cs))
GST_PLAY_ERROR_RETURN (error,
"Could not link video output thread (switch and cs)");
"Could not link video output thread (switch and cs)");
if (!gst_element_link (video_cs, video_balance))
GST_PLAY_ERROR_RETURN (error,
"Could not link video output thread (cs and balance)");
"Could not link video output thread (cs and balance)");
if (!gst_element_link (video_balance, balance_cs))
GST_PLAY_ERROR_RETURN (error,
"Could not link video output thread (balance and balance_cs)");
"Could not link video output thread (balance and balance_cs)");
if (!gst_element_link (balance_cs, video_scaler))
GST_PLAY_ERROR_RETURN (error,
"Could not link video output thread (balance_cs and scaler)");
"Could not link video output thread (balance_cs and scaler)");
if (!gst_element_link (video_scaler, video_sink))
GST_PLAY_ERROR_RETURN (error,
"Could not link video output thread (balance_cs and scaler)");
"Could not link video output thread (balance_cs and scaler)");
gst_element_add_ghost_pad (video_thread, gst_element_get_pad (video_queue,
"sink"), "sink");
"sink"), "sink");
if (!gst_element_link (identity_cs, video_thread))
GST_PLAY_ERROR_RETURN (error,
"Could not link video output thread elements");
"Could not link video output thread elements");
}
/* Creating our audio output bin
{ queue ! fakesink } */
@ -347,19 +347,19 @@ gst_play_pipeline_setup (GstPlay * play, GError ** error)
GST_PLAY_MAKE_OR_ERROR (volume, "volume", "volume", error);
g_hash_table_insert (play->priv->elements, "volume", volume);
g_signal_connect (gst_element_get_pad (volume, "src"), "fixate",
G_CALLBACK (gst_play_audio_fixate), play);
G_CALLBACK (gst_play_audio_fixate), play);
/* Placeholder for future audio sink bin */
GST_PLAY_MAKE_OR_ERROR (audio_sink, "fakesink", "audio_sink", error);
g_hash_table_insert (play->priv->elements, "audio_sink", audio_sink);
gst_bin_add_many (GST_BIN (audio_thread), audio_queue, volume, audio_sink,
NULL);
NULL);
if (!gst_element_link_many (audio_queue, volume, audio_sink, NULL))
GST_PLAY_ERROR_RETURN (error,
"Could not link audio output thread elements");
"Could not link audio output thread elements");
gst_element_add_ghost_pad (audio_thread, gst_element_get_pad (audio_queue,
"sink"), "sink");
"sink"), "sink");
gst_pad_link (tee_pad2, gst_element_get_pad (audio_queue, "sink"));
}
@ -408,7 +408,7 @@ gst_play_tick_callback (GstPlay * play)
if (q)
g_signal_emit (G_OBJECT (play), gst_play_signals[TIME_TICK],
0, play->priv->time_nanos);
0, play->priv->time_nanos);
if (GST_STATE (GST_ELEMENT (play)) == GST_STATE_PLAYING)
return TRUE;
@ -443,15 +443,15 @@ gst_play_get_length_callback (GstPlay * play)
/* Audio first and then Video */
if (GST_IS_ELEMENT (audio_sink_element))
q = gst_element_query (audio_sink_element, GST_QUERY_TOTAL, &format,
&value);
&value);
if ((!q) && (GST_IS_ELEMENT (video_sink_element)))
q = gst_element_query (video_sink_element, GST_QUERY_TOTAL, &format,
&value);
&value);
if (q) {
play->priv->length_nanos = value;
g_signal_emit (G_OBJECT (play), gst_play_signals[STREAM_LENGTH],
0, play->priv->length_nanos);
0, play->priv->length_nanos);
play->priv->length_id = 0;
return FALSE;
}
@ -487,7 +487,7 @@ gst_play_video_fixate (GstPad * pad, const GstCaps * caps, gpointer user_data)
return newcaps;
}
if (gst_caps_structure_fixate_field_nearest_double (structure, "framerate",
30.0)) {
30.0)) {
return newcaps;
}
@ -545,7 +545,7 @@ gst_play_state_change (GstElement * element, GstElementState old,
}
play->priv->tick_id = g_timeout_add (TICK_INTERVAL_MSEC,
(GSourceFunc) gst_play_tick_callback, play);
(GSourceFunc) gst_play_tick_callback, play);
play->priv->get_length_attempt = 0;
@ -555,7 +555,7 @@ gst_play_state_change (GstElement * element, GstElementState old,
}
play->priv->length_id = g_timeout_add (TICK_INTERVAL_MSEC,
(GSourceFunc) gst_play_get_length_callback, play);
(GSourceFunc) gst_play_get_length_callback, play);
} else {
if (play->priv->tick_id) {
g_source_remove (play->priv->tick_id);
@ -632,7 +632,7 @@ gst_play_init (GstPlay * play)
if (!gst_play_pipeline_setup (play, &play->priv->error)) {
g_warning ("libgstplay: failed initializing pipeline, error: %s",
play->priv->error->message);
play->priv->error->message);
}
}
@ -793,10 +793,10 @@ gst_play_seek_to_time (GstPlay * play, gint64 time_nanos)
play->priv->tick_unblock_remaining = 500;
s = gst_element_seek (video_seek_element, GST_FORMAT_TIME |
GST_SEEK_METHOD_SET | GST_SEEK_FLAG_FLUSH, time_nanos);
GST_SEEK_METHOD_SET | GST_SEEK_FLAG_FLUSH, time_nanos);
if (!s) {
s = gst_element_seek (audio_seek_element, GST_FORMAT_TIME |
GST_SEEK_METHOD_SET | GST_SEEK_FLAG_FLUSH, time_nanos);
GST_SEEK_METHOD_SET | GST_SEEK_FLAG_FLUSH, time_nanos);
}
if (s) {
@ -804,11 +804,11 @@ gst_play_seek_to_time (GstPlay * play, gint64 time_nanos)
gboolean q = FALSE;
q = gst_element_query (audio_sink_element, GST_QUERY_POSITION, &format,
&(play->priv->time_nanos));
&(play->priv->time_nanos));
if (q)
g_signal_emit (G_OBJECT (play), gst_play_signals[TIME_TICK],
0, play->priv->time_nanos);
g_signal_emit (G_OBJECT (play), gst_play_signals[TIME_TICK],
0, play->priv->time_nanos);
}
}
@ -907,10 +907,10 @@ gst_play_set_video_sink (GstPlay * play, GstElement * video_sink)
GST_PLAY_SINK_TYPE_VIDEO);
if (GST_IS_ELEMENT (video_sink_element)) {
g_hash_table_replace (play->priv->elements, "video_sink_element",
video_sink_element);
video_sink_element);
if (GST_IS_X_OVERLAY (video_sink_element)) {
g_signal_connect (G_OBJECT (video_sink_element),
"desired_size_changed", G_CALLBACK (gst_play_have_video_size), play);
"desired_size_changed", G_CALLBACK (gst_play_have_video_size), play);
}
}
@ -966,7 +966,7 @@ gst_play_set_audio_sink (GstPlay * play, GstElement * audio_sink)
GST_PLAY_SINK_TYPE_AUDIO);
if (GST_IS_ELEMENT (audio_sink_element)) {
g_hash_table_replace (play->priv->elements, "audio_sink_element",
audio_sink_element);
audio_sink_element);
}
gst_element_set_state (audio_sink, GST_STATE (GST_ELEMENT (play)));
@ -1114,7 +1114,7 @@ gst_play_connect_visualization (GstPlay * play, gboolean connect)
/* Adding, linking */
play->priv->handoff_hid = g_signal_connect (G_OBJECT (identity),
"handoff", G_CALLBACK (gst_play_identity_handoff), play);
"handoff", G_CALLBACK (gst_play_identity_handoff), play);
gst_bin_add (GST_BIN (video_thread), vis_bin);
gst_pad_link (tee_pad1, vis_queue_pad);
gst_element_link (vis_bin, video_switch);
@ -1168,64 +1168,64 @@ gst_play_get_sink_element (GstPlay * play,
if (GST_IS_BIN (element)) {
element = gst_play_get_sink_element (play, element, sink_type);
if (GST_IS_ELEMENT (element))
return element;
return element;
} else {
pads = gst_element_get_pad_list (element);
has_src = FALSE;
has_correct_type = FALSE;
while (pads) {
/* check for src pad */
if (GST_PAD_DIRECTION (GST_PAD (pads->data)) == GST_PAD_SRC) {
has_src = TRUE;
break;
} else {
/* If not a src pad checking caps */
GstCaps *caps;
GstStructure *structure;
gboolean has_video_cap = FALSE;
gboolean has_audio_cap = FALSE;
/* check for src pad */
if (GST_PAD_DIRECTION (GST_PAD (pads->data)) == GST_PAD_SRC) {
has_src = TRUE;
break;
} else {
/* If not a src pad checking caps */
GstCaps *caps;
GstStructure *structure;
gboolean has_video_cap = FALSE;
gboolean has_audio_cap = FALSE;
caps = gst_pad_get_caps (GST_PAD (pads->data));
structure = gst_caps_get_structure (caps, 0);
caps = gst_pad_get_caps (GST_PAD (pads->data));
structure = gst_caps_get_structure (caps, 0);
if (strcmp (gst_structure_get_name (structure),
"audio/x-raw-int") == 0) {
has_audio_cap = TRUE;
}
if (strcmp (gst_structure_get_name (structure),
"audio/x-raw-int") == 0) {
has_audio_cap = TRUE;
}
if (strcmp (gst_structure_get_name (structure),
"video/x-raw-yuv") == 0 ||
strcmp (gst_structure_get_name (structure),
"video/x-raw-rgb") == 0) {
has_video_cap = TRUE;
}
if (strcmp (gst_structure_get_name (structure),
"video/x-raw-yuv") == 0 ||
strcmp (gst_structure_get_name (structure),
"video/x-raw-rgb") == 0) {
has_video_cap = TRUE;
}
gst_caps_free (caps);
gst_caps_free (caps);
switch (sink_type) {
case GST_PLAY_SINK_TYPE_AUDIO:
if (has_audio_cap)
has_correct_type = TRUE;
break;
case GST_PLAY_SINK_TYPE_VIDEO:
if (has_video_cap)
has_correct_type = TRUE;
break;
case GST_PLAY_SINK_TYPE_ANY:
if ((has_video_cap) || (has_audio_cap))
has_correct_type = TRUE;
break;
default:
has_correct_type = FALSE;
}
}
switch (sink_type) {
case GST_PLAY_SINK_TYPE_AUDIO:
if (has_audio_cap)
has_correct_type = TRUE;
break;
case GST_PLAY_SINK_TYPE_VIDEO:
if (has_video_cap)
has_correct_type = TRUE;
break;
case GST_PLAY_SINK_TYPE_ANY:
if ((has_video_cap) || (has_audio_cap))
has_correct_type = TRUE;
break;
default:
has_correct_type = FALSE;
}
}
pads = g_list_next (pads);
pads = g_list_next (pads);
}
if ((!has_src) && (has_correct_type))
return element;
return element;
}
elements = g_list_next (elements);
@ -1247,7 +1247,7 @@ gst_play_new (GError ** error)
play->priv->error = NULL;
} else {
g_warning ("Error creating GstPlay object.\n%s",
play->priv->error->message);
play->priv->error->message);
g_error_free (play->priv->error);
}
}
@ -1280,7 +1280,7 @@ gst_play_get_type (void)
};
play_type = g_type_register_static (GST_TYPE_PIPELINE, "GstPlay",
&play_info, 0);
&play_info, 0);
}
return play_type;

View file

@ -56,8 +56,8 @@ gst_property_probe_get_type (void)
};
gst_property_probe_type =
g_type_register_static (G_TYPE_INTERFACE,
"GstPropertyProbe", &gst_property_probe_info, 0);
g_type_register_static (G_TYPE_INTERFACE,
"GstPropertyProbe", &gst_property_probe_info, 0);
}
return gst_property_probe_type;
@ -70,10 +70,10 @@ gst_property_probe_iface_init (GstPropertyProbeInterface * iface)
if (!initialized) {
gst_property_probe_signals[SIGNAL_PROBE_NEEDED] =
g_signal_new ("probe-needed", G_TYPE_FROM_CLASS (iface),
G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (GstPropertyProbeInterface,
probe_needed), NULL, NULL, g_cclosure_marshal_VOID__POINTER,
G_TYPE_NONE, 1, G_TYPE_POINTER);
g_signal_new ("probe-needed", G_TYPE_FROM_CLASS (iface),
G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (GstPropertyProbeInterface,
probe_needed), NULL, NULL, g_cclosure_marshal_VOID__POINTER,
G_TYPE_NONE, 1, G_TYPE_POINTER);
initialized = TRUE;
}

View file

@ -108,7 +108,8 @@ static union
{
int i[4];
float f[4];
} av_tmp __attribute__ ((__aligned__ (16)));
}
av_tmp __attribute__ ((__aligned__ (16)));
void
conv_double_short_altivec (double *dest, short *src, int n)
@ -122,7 +123,7 @@ conv_double_short_altivec (double *dest, short *src, int n)
av_tmp.i[3] = src[3];
asm (" lvx 0,0,%0\n" " vcfsx 1,0,0\n" " stvx 1,0,%0\n": :"r" (&av_tmp)
);
);
dest[0] = av_tmp.f[0];
dest[1] = av_tmp.f[1];

View file

@ -100,33 +100,33 @@ gst_resample_reinit (gst_resample_t * r)
switch (r->method) {
default:
case GST_RESAMPLE_NEAREST:
r->scale = gst_resample_nearest_s16;
break;
r->scale = gst_resample_nearest_s16;
break;
case GST_RESAMPLE_BILINEAR:
r->scale = gst_resample_bilinear_s16;
break;
r->scale = gst_resample_bilinear_s16;
break;
case GST_RESAMPLE_SINC_SLOW:
r->scale = gst_resample_sinc_s16;
break;
r->scale = gst_resample_sinc_s16;
break;
case GST_RESAMPLE_SINC:
r->scale = gst_resample_sinc_ft_s16;
break;
r->scale = gst_resample_sinc_ft_s16;
break;
}
} else if (r->format == GST_RESAMPLE_FLOAT) {
switch (r->method) {
default:
case GST_RESAMPLE_NEAREST:
r->scale = gst_resample_nearest_float;
break;
r->scale = gst_resample_nearest_float;
break;
case GST_RESAMPLE_BILINEAR:
r->scale = gst_resample_bilinear_float;
break;
r->scale = gst_resample_bilinear_float;
break;
case GST_RESAMPLE_SINC_SLOW:
r->scale = gst_resample_sinc_float;
break;
r->scale = gst_resample_sinc_float;
break;
case GST_RESAMPLE_SINC:
r->scale = gst_resample_sinc_ft_float;
break;
r->scale = gst_resample_sinc_ft_float;
break;
}
} else {
fprintf (stderr, "gst_resample: Unexpected format \"%d\"\n", r->format);
@ -170,9 +170,9 @@ gst_resample_scale (gst_resample_t * r, void *i_buf, unsigned int i_size)
if (r->verbose) {
printf ("gst_resample_scale: i_buf=%p i_size=%d\n", i_buf, i_size);
printf ("gst_resample_scale: i_samples=%d o_samples=%d i_inc=%g o_buf=%p\n",
r->i_samples, r->o_samples, r->i_inc, r->o_buf);
r->i_samples, r->o_samples, r->i_inc, r->o_buf);
printf ("gst_resample_scale: i_start=%g i_end=%g o_start=%g\n",
r->i_start, r->i_end, r->o_start);
r->i_start, r->i_end, r->o_start);
}
if ((r->filter_length + r->i_samples) * sizeof (double) * 2 > r->buffer_len) {
@ -191,20 +191,20 @@ gst_resample_scale (gst_resample_t * r, void *i_buf, unsigned int i_size)
if (r->format == GST_RESAMPLE_S16) {
if (r->channels == 2) {
conv_double_short (r->buffer + r->filter_length * sizeof (double) * 2,
r->i_buf, r->i_samples * 2);
r->i_buf, r->i_samples * 2);
} else {
conv_double_short_dstr (r->buffer +
r->filter_length * sizeof (double) * 2, r->i_buf, r->i_samples,
sizeof (double) * 2);
r->filter_length * sizeof (double) * 2, r->i_buf, r->i_samples,
sizeof (double) * 2);
}
} else if (r->format == GST_RESAMPLE_FLOAT) {
if (r->channels == 2) {
conv_double_float (r->buffer + r->filter_length * sizeof (double) * 2,
r->i_buf, r->i_samples * 2);
r->i_buf, r->i_samples * 2);
} else {
conv_double_float_dstr (r->buffer +
r->filter_length * sizeof (double) * 2, r->i_buf, r->i_samples,
sizeof (double) * 2);
r->filter_length * sizeof (double) * 2, r->i_buf, r->i_samples,
sizeof (double) * 2);
}
}
@ -358,15 +358,15 @@ gst_resample_sinc_slow_s16 (gst_resample_t * r)
c0 = 0;
c1 = 0;
for (j = 0; j < r->filter_length; j++) {
weight = (x == 0) ? 1 : (sinx / x);
weight = (x == 0) ? 1 : (sinx / x);
/*printf("j %d sin %g cos %g\n",j,sinx,cosx); */
/*printf("j %d sin %g x %g sinc %g\n",j,sinx,x,weight); */
c0 += weight * GETBUF ((start + j), 0);
c1 += weight * GETBUF ((start + j), 1);
t = cosx * cosd - sinx * sind;
sinx = cosx * sind + sinx * cosd;
cosx = t;
x += d;
c0 += weight * GETBUF ((start + j), 0);
c1 += weight * GETBUF ((start + j), 1);
t = cosx * cosd - sinx * sind;
sinx = cosx * sind + sinx * cosd;
cosx = t;
x += d;
}
o_ptr[0] = rint (c0);
o_ptr[1] = rint (c1);
@ -494,7 +494,7 @@ gst_resample_sinc_ft_s16 (gst_resample_t * r)
double scale;
int n = 4;
scale = r->i_inc; /* cutoff at 22050 */
scale = r->i_inc; /* cutoff at 22050 */
/*scale = 1.0; // cutoff at 24000 */
/*scale = r->i_inc * 0.5; // cutoff at 11025 */
@ -546,7 +546,7 @@ gst_resample_sinc_ft_s16 (gst_resample_t * r)
}
#else
functable_fir2 (ft,
&c0, &c1, x, n, ptr + (start + r->filter_length) * 2, r->filter_length);
&c0, &c1, x, n, ptr + (start + r->filter_length) * 2, r->filter_length);
c0 *= scale;
c1 *= scale;
#endif
@ -566,7 +566,7 @@ gst_resample_sinc_ft_s16 (gst_resample_t * r)
conv_short_double (r->o_buf, out_tmp, 2 * r->o_samples);
} else {
conv_short_double_sstr (r->o_buf, out_tmp, r->o_samples,
2 * sizeof (double));
2 * sizeof (double));
}
}
@ -711,15 +711,15 @@ gst_resample_sinc_slow_float (gst_resample_t * r)
c0 = 0;
c1 = 0;
for (j = 0; j < r->filter_length; j++) {
weight = (x == 0) ? 1 : (sinx / x);
weight = (x == 0) ? 1 : (sinx / x);
/*printf("j %d sin %g cos %g\n",j,sinx,cosx); */
/*printf("j %d sin %g x %g sinc %g\n",j,sinx,x,weight); */
c0 += weight * GETBUF ((start + j), 0);
c1 += weight * GETBUF ((start + j), 1);
t = cosx * cosd - sinx * sind;
sinx = cosx * sind + sinx * cosd;
cosx = t;
x += d;
c0 += weight * GETBUF ((start + j), 0);
c1 += weight * GETBUF ((start + j), 1);
t = cosx * cosd - sinx * sind;
sinx = cosx * sind + sinx * cosd;
cosx = t;
x += d;
}
o_ptr[0] = c0;
o_ptr[1] = c1;
@ -806,7 +806,7 @@ gst_resample_sinc_ft_float (gst_resample_t * r)
double scale;
int n = 4;
scale = r->i_inc; /* cutoff at 22050 */
scale = r->i_inc; /* cutoff at 22050 */
/*scale = 1.0; // cutoff at 24000 */
/*scale = r->i_inc * 0.5; // cutoff at 11025 */
@ -858,7 +858,7 @@ gst_resample_sinc_ft_float (gst_resample_t * r)
}
#else
functable_fir2 (ft,
&c0, &c1, x, n, ptr + (start + r->filter_length) * 2, r->filter_length);
&c0, &c1, x, n, ptr + (start + r->filter_length) * 2, r->filter_length);
c0 *= scale;
c1 *= scale;
#endif
@ -878,7 +878,7 @@ gst_resample_sinc_ft_float (gst_resample_t * r)
conv_float_double (r->o_buf, out_tmp, 2 * r->o_samples);
} else {
conv_float_double_sstr (r->o_buf, out_tmp, r->o_samples,
2 * sizeof (double));
2 * sizeof (double));
}
}

View file

@ -123,7 +123,7 @@ test_res1 (void)
f = AMP * test_func ((double) i / O_RATE);
/*f = rint(AMP*test_func((double)i/O_RATE)); */
fprintf (out, "%d %d %d %g %g\n", i,
o_buf[2 * i + 0], o_buf[2 * i + 1], f, o_buf[2 * i + 0] - f);
o_buf[2 * i + 0], o_buf[2 * i + 1], f, o_buf[2 * i + 0] - f);
}
sum10k = 0;
@ -206,7 +206,7 @@ test_res3 (void)
for (i = 0; i < 1000 * n; i++) {
x = -50.0 + 0.1 / n * i;
f1 = functable_sinc (NULL, t->scale * x) *
functable_window_std (NULL, t->scale2 * x);
functable_window_std (NULL, t->scale2 * x);
f2 = functable_eval (t, x);
fprintf (out, "%d %g %g %g\n", i, f1, f2, f2 - f1);
}
@ -224,7 +224,7 @@ sinc_poly (double x)
return 1 - x2 * INV3FAC + x2 * x2 * INV5FAC - x2 * x2 * x2 * INV7FAC;
/*+ x2 * x2 * x2 * x2 * INV9FAC */
/*- x2 * x2 * x2 * x2 * x2 * INV11FAC; */
/*- x2 * x2 * x2 * x2 * x2 * INV11FAC; */
}
void

View file

@ -35,175 +35,175 @@ gst_riff_create_video_caps (guint32 codec_fcc,
switch (codec_fcc) {
case GST_MAKE_FOURCC ('I', '4', '2', '0'):
caps = gst_caps_new_simple ("video/x-raw-yuv",
"format", GST_TYPE_FOURCC, codec_fcc, NULL);
"format", GST_TYPE_FOURCC, codec_fcc, NULL);
if (codec_name)
*codec_name = g_strdup ("Raw, uncompressed I420");
*codec_name = g_strdup ("Raw, uncompressed I420");
break;
case GST_MAKE_FOURCC ('Y', 'U', 'Y', '2'):
caps = gst_caps_new_simple ("video/x-raw-yuv",
"format", GST_TYPE_FOURCC, codec_fcc, NULL);
"format", GST_TYPE_FOURCC, codec_fcc, NULL);
if (codec_name)
*codec_name = g_strdup ("Raw, uncompressed YUV 4:2:2");
*codec_name = g_strdup ("Raw, uncompressed YUV 4:2:2");
break;
case GST_MAKE_FOURCC ('M', 'J', 'P', 'G'): /* YUY2 MJPEG */
case GST_MAKE_FOURCC ('M', 'J', 'P', 'G'): /* YUY2 MJPEG */
caps = gst_caps_new_simple ("video/x-jpeg", NULL);
if (codec_name)
*codec_name = g_strdup ("Motion JPEG");
*codec_name = g_strdup ("Motion JPEG");
break;
case GST_MAKE_FOURCC ('J', 'P', 'E', 'G'): /* generic (mostly RGB) MJPEG */
case GST_MAKE_FOURCC ('J', 'P', 'E', 'G'): /* generic (mostly RGB) MJPEG */
caps = gst_caps_new_simple ("video/x-jpeg", NULL);
if (codec_name)
*codec_name = g_strdup ("JPEG Still Image");
*codec_name = g_strdup ("JPEG Still Image");
break;
case GST_MAKE_FOURCC ('P', 'I', 'X', 'L'): /* Miro/Pinnacle fourccs */
case GST_MAKE_FOURCC ('V', 'I', 'X', 'L'): /* Miro/Pinnacle fourccs */
case GST_MAKE_FOURCC ('P', 'I', 'X', 'L'): /* Miro/Pinnacle fourccs */
case GST_MAKE_FOURCC ('V', 'I', 'X', 'L'): /* Miro/Pinnacle fourccs */
caps = gst_caps_new_simple ("video/x-jpeg", NULL);
if (codec_name)
*codec_name = g_strdup ("Miro/Pinnacle Video XL");
*codec_name = g_strdup ("Miro/Pinnacle Video XL");
break;
case GST_MAKE_FOURCC ('H', 'F', 'Y', 'U'):
caps = gst_caps_new_simple ("video/x-huffyuv", NULL);
if (codec_name)
*codec_name = g_strdup ("Huffman Lossless Codec");
*codec_name = g_strdup ("Huffman Lossless Codec");
break;
case GST_MAKE_FOURCC ('M', 'P', 'E', 'G'):
case GST_MAKE_FOURCC ('M', 'P', 'G', 'I'):
caps = gst_caps_new_simple ("video/mpeg",
"systemstream", G_TYPE_BOOLEAN, FALSE,
"mpegversion", G_TYPE_BOOLEAN, 1, NULL);
"systemstream", G_TYPE_BOOLEAN, FALSE,
"mpegversion", G_TYPE_BOOLEAN, 1, NULL);
if (codec_name)
*codec_name = g_strdup ("MPEG video");
*codec_name = g_strdup ("MPEG video");
break;
case GST_MAKE_FOURCC ('H', '2', '6', '3'):
caps = gst_caps_new_simple ("video/x-h263", NULL);
if (codec_name)
*codec_name = g_strdup ("ITU H.26n");
*codec_name = g_strdup ("ITU H.26n");
break;
case GST_MAKE_FOURCC ('i', '2', '6', '3'):
caps = gst_caps_new_simple ("video/x-h263", NULL);
if (codec_name)
*codec_name = g_strdup ("ITU H.263");
*codec_name = g_strdup ("ITU H.263");
break;
case GST_MAKE_FOURCC ('L', '2', '6', '3'):
caps = gst_caps_new_simple ("video/x-h263", NULL);
if (codec_name)
*codec_name = g_strdup ("Lead H.263");
*codec_name = g_strdup ("Lead H.263");
break;
case GST_MAKE_FOURCC ('M', '2', '6', '3'):
caps = gst_caps_new_simple ("video/x-h263", NULL);
if (codec_name)
*codec_name = g_strdup ("Microsoft H.263");
*codec_name = g_strdup ("Microsoft H.263");
break;
case GST_MAKE_FOURCC ('V', 'D', 'O', 'W'):
caps = gst_caps_new_simple ("video/x-h263", NULL);
if (codec_name)
*codec_name = g_strdup ("VDOLive");
*codec_name = g_strdup ("VDOLive");
break;
case GST_MAKE_FOURCC ('V', 'I', 'V', 'O'):
caps = gst_caps_new_simple ("video/x-h263", NULL);
if (codec_name)
*codec_name = g_strdup ("Vivo H.263");
*codec_name = g_strdup ("Vivo H.263");
break;
case GST_MAKE_FOURCC ('x', '2', '6', '3'):
caps = gst_caps_new_simple ("video/x-h263", NULL);
if (codec_name)
*codec_name = g_strdup ("Xirlink H.263");
*codec_name = g_strdup ("Xirlink H.263");
break;
case GST_MAKE_FOURCC ('D', 'I', 'V', '3'):
caps = gst_caps_new_simple ("video/x-divx",
"divxversion", G_TYPE_INT, 3, NULL);
"divxversion", G_TYPE_INT, 3, NULL);
if (codec_name)
*codec_name = g_strdup ("DivX MPEG-4 Version 3");
*codec_name = g_strdup ("DivX MPEG-4 Version 3");
break;
case GST_MAKE_FOURCC ('D', 'I', 'V', '4'):
caps = gst_caps_new_simple ("video/x-divx",
"divxversion", G_TYPE_INT, 4, NULL);
"divxversion", G_TYPE_INT, 4, NULL);
if (codec_name)
*codec_name = g_strdup ("DivX MPEG-4 Version 4");
*codec_name = g_strdup ("DivX MPEG-4 Version 4");
break;
case GST_MAKE_FOURCC ('d', 'i', 'v', 'x'):
case GST_MAKE_FOURCC ('D', 'I', 'V', 'X'):
case GST_MAKE_FOURCC ('D', 'X', '5', '0'):
case GST_MAKE_FOURCC ('D', 'I', 'V', '5'):
caps = gst_caps_new_simple ("video/x-divx",
"divxversion", G_TYPE_INT, 5, NULL);
"divxversion", G_TYPE_INT, 5, NULL);
if (codec_name)
*codec_name = g_strdup ("DivX MPEG-4 Version 5");
*codec_name = g_strdup ("DivX MPEG-4 Version 5");
break;
case GST_MAKE_FOURCC ('X', 'V', 'I', 'D'):
case GST_MAKE_FOURCC ('x', 'v', 'i', 'd'):
caps = gst_caps_new_simple ("video/x-xvid", NULL);
if (codec_name)
*codec_name = g_strdup ("XVID MPEG-4");
*codec_name = g_strdup ("XVID MPEG-4");
break;
case GST_MAKE_FOURCC ('M', 'P', 'G', '4'):
caps = gst_caps_new_simple ("video/x-msmpeg",
"msmpegversion", G_TYPE_INT, 41, NULL);
"msmpegversion", G_TYPE_INT, 41, NULL);
if (codec_name)
*codec_name = g_strdup ("Microsoft MPEG-4 4.1");
*codec_name = g_strdup ("Microsoft MPEG-4 4.1");
break;
case GST_MAKE_FOURCC ('M', 'P', '4', '2'):
caps = gst_caps_new_simple ("video/x-msmpeg",
"msmpegversion", G_TYPE_INT, 42, NULL);
"msmpegversion", G_TYPE_INT, 42, NULL);
if (codec_name)
*codec_name = g_strdup ("Microsoft MPEG-4 4.2");
*codec_name = g_strdup ("Microsoft MPEG-4 4.2");
break;
case GST_MAKE_FOURCC ('M', 'P', '4', '3'):
caps = gst_caps_new_simple ("video/x-msmpeg",
"msmpegversion", G_TYPE_INT, 43, NULL);
"msmpegversion", G_TYPE_INT, 43, NULL);
if (codec_name)
*codec_name = g_strdup ("Microsoft MPEG-4 4.3");
*codec_name = g_strdup ("Microsoft MPEG-4 4.3");
break;
case GST_MAKE_FOURCC ('3', 'I', 'V', '1'):
case GST_MAKE_FOURCC ('3', 'I', 'V', '2'):
caps = gst_caps_new_simple ("video/x-3ivx", NULL);
if (codec_name)
*codec_name = g_strdup ("3ivx");
*codec_name = g_strdup ("3ivx");
break;
case GST_MAKE_FOURCC ('D', 'V', 'S', 'D'):
case GST_MAKE_FOURCC ('d', 'v', 's', 'd'):
caps = gst_caps_new_simple ("video/x-dv",
"systemstream", G_TYPE_BOOLEAN, FALSE, NULL);
"systemstream", G_TYPE_BOOLEAN, FALSE, NULL);
if (codec_name)
*codec_name = g_strdup ("Generic DV");
*codec_name = g_strdup ("Generic DV");
break;
case GST_MAKE_FOURCC ('W', 'M', 'V', '1'):
caps = gst_caps_new_simple ("video/x-wmv",
"wmvversion", G_TYPE_INT, 1, NULL);
"wmvversion", G_TYPE_INT, 1, NULL);
if (codec_name)
*codec_name = g_strdup ("Windows Media Video 7");
*codec_name = g_strdup ("Windows Media Video 7");
break;
case GST_MAKE_FOURCC ('W', 'M', 'V', '2'):
caps = gst_caps_new_simple ("video/x-wmv",
"wmvversion", G_TYPE_INT, 2, NULL);
"wmvversion", G_TYPE_INT, 2, NULL);
if (codec_name)
*codec_name = g_strdup ("Windows Media Video 8");
*codec_name = g_strdup ("Windows Media Video 8");
break;
case GST_MAKE_FOURCC ('W', 'M', 'V', '3'):
caps = gst_caps_new_simple ("video/x-wmv",
"wmvversion", G_TYPE_INT, 3, NULL);
"wmvversion", G_TYPE_INT, 3, NULL);
if (codec_name)
*codec_name = g_strdup ("Windows Media Video 9");
*codec_name = g_strdup ("Windows Media Video 9");
break;
default:
GST_WARNING ("Unkown video fourcc " GST_FOURCC_FORMAT,
GST_FOURCC_ARGS (codec_fcc));
GST_FOURCC_ARGS (codec_fcc));
return NULL;
}
@ -213,17 +213,17 @@ gst_riff_create_video_caps (guint32 codec_fcc,
gst_caps_set_simple (caps, "framerate", G_TYPE_DOUBLE, fps, NULL);
} else {
gst_caps_set_simple (caps,
"framerate", GST_TYPE_DOUBLE_RANGE, 0., G_MAXDOUBLE, NULL);
"framerate", GST_TYPE_DOUBLE_RANGE, 0., G_MAXDOUBLE, NULL);
}
if (strf != NULL) {
gst_caps_set_simple (caps,
"width", G_TYPE_INT, strf->width,
"height", G_TYPE_INT, strf->height, NULL);
"width", G_TYPE_INT, strf->width,
"height", G_TYPE_INT, strf->height, NULL);
} else {
gst_caps_set_simple (caps,
"width", GST_TYPE_INT_RANGE, 16, 4096,
"height", GST_TYPE_INT_RANGE, 16, 4096, NULL);
"width", GST_TYPE_INT_RANGE, 16, 4096,
"height", GST_TYPE_INT_RANGE, 16, 4096, NULL);
}
return caps;
@ -236,75 +236,75 @@ gst_riff_create_audio_caps (guint16 codec_id,
GstCaps *caps = NULL;
switch (codec_id) {
case GST_RIFF_WAVE_FORMAT_MPEGL3: /* mp3 */
case GST_RIFF_WAVE_FORMAT_MPEGL3: /* mp3 */
caps = gst_caps_new_simple ("audio/mpeg",
"mpegversion", G_TYPE_INT, 1, "layer", G_TYPE_INT, 3, NULL);
"mpegversion", G_TYPE_INT, 1, "layer", G_TYPE_INT, 3, NULL);
if (codec_name)
*codec_name = g_strdup ("MPEG 1 layer 3");
*codec_name = g_strdup ("MPEG 1 layer 3");
break;
case GST_RIFF_WAVE_FORMAT_MPEGL12: /* mp1 or mp2 */
case GST_RIFF_WAVE_FORMAT_MPEGL12: /* mp1 or mp2 */
caps = gst_caps_new_simple ("audio/mpeg",
"mpegversion", G_TYPE_INT, 1, "layer", G_TYPE_INT, 2, NULL);
"mpegversion", G_TYPE_INT, 1, "layer", G_TYPE_INT, 2, NULL);
if (codec_name)
*codec_name = g_strdup ("MPEG 1 layer 2");
*codec_name = g_strdup ("MPEG 1 layer 2");
break;
case GST_RIFF_WAVE_FORMAT_PCM: /* PCM/wav */
case GST_RIFF_WAVE_FORMAT_PCM: /* PCM/wav */
if (strf != NULL) {
gint ba = GUINT16_FROM_LE (strf->blockalign);
gint ch = GUINT16_FROM_LE (strf->channels);
gint ws = GUINT16_FROM_LE (strf->size);
gint ba = GUINT16_FROM_LE (strf->blockalign);
gint ch = GUINT16_FROM_LE (strf->channels);
gint ws = GUINT16_FROM_LE (strf->size);
caps = gst_caps_new_simple ("audio/x-raw-int",
"endianness", G_TYPE_INT, G_LITTLE_ENDIAN,
"width", G_TYPE_INT, (int) (ba * 8 / ch),
"depth", G_TYPE_INT, ws, "signed", G_TYPE_BOOLEAN, ws != 8, NULL);
caps = gst_caps_new_simple ("audio/x-raw-int",
"endianness", G_TYPE_INT, G_LITTLE_ENDIAN,
"width", G_TYPE_INT, (int) (ba * 8 / ch),
"depth", G_TYPE_INT, ws, "signed", G_TYPE_BOOLEAN, ws != 8, NULL);
} else {
caps = gst_caps_from_string ("audio/x-raw-int, "
"endianness = (int) LITTLE_ENDIAN, "
"signed = (boolean) { true, false }, "
"width = (int) { 8, 16 }, " "height = (int) { 8, 16 }");
caps = gst_caps_from_string ("audio/x-raw-int, "
"endianness = (int) LITTLE_ENDIAN, "
"signed = (boolean) { true, false }, "
"width = (int) { 8, 16 }, " "height = (int) { 8, 16 }");
}
if (codec_name)
*codec_name = g_strdup ("PCM WAV");
*codec_name = g_strdup ("PCM WAV");
break;
case GST_RIFF_WAVE_FORMAT_MULAW:
if (strf != NULL && strf->size != 8) {
GST_WARNING ("invalid depth (%d) of mulaw audio, overwriting.",
strf->size);
GST_WARNING ("invalid depth (%d) of mulaw audio, overwriting.",
strf->size);
}
caps = gst_caps_new_simple ("audio/x-mulaw", NULL);
if (codec_name)
*codec_name = g_strdup ("Mulaw");
*codec_name = g_strdup ("Mulaw");
break;
case GST_RIFF_WAVE_FORMAT_ALAW:
if (strf != NULL && strf->size != 8) {
GST_WARNING ("invalid depth (%d) of alaw audio, overwriting.",
strf->size);
GST_WARNING ("invalid depth (%d) of alaw audio, overwriting.",
strf->size);
}
caps = gst_caps_new_simple ("audio/x-alaw", NULL);
if (codec_name)
*codec_name = g_strdup ("Alaw");
*codec_name = g_strdup ("Alaw");
break;
case GST_RIFF_WAVE_FORMAT_VORBIS1: /* ogg/vorbis mode 1 */
case GST_RIFF_WAVE_FORMAT_VORBIS2: /* ogg/vorbis mode 2 */
case GST_RIFF_WAVE_FORMAT_VORBIS3: /* ogg/vorbis mode 3 */
case GST_RIFF_WAVE_FORMAT_VORBIS1PLUS: /* ogg/vorbis mode 1+ */
case GST_RIFF_WAVE_FORMAT_VORBIS2PLUS: /* ogg/vorbis mode 2+ */
case GST_RIFF_WAVE_FORMAT_VORBIS3PLUS: /* ogg/vorbis mode 3+ */
case GST_RIFF_WAVE_FORMAT_VORBIS1: /* ogg/vorbis mode 1 */
case GST_RIFF_WAVE_FORMAT_VORBIS2: /* ogg/vorbis mode 2 */
case GST_RIFF_WAVE_FORMAT_VORBIS3: /* ogg/vorbis mode 3 */
case GST_RIFF_WAVE_FORMAT_VORBIS1PLUS: /* ogg/vorbis mode 1+ */
case GST_RIFF_WAVE_FORMAT_VORBIS2PLUS: /* ogg/vorbis mode 2+ */
case GST_RIFF_WAVE_FORMAT_VORBIS3PLUS: /* ogg/vorbis mode 3+ */
caps = gst_caps_new_simple ("audio/x-vorbis", NULL);
if (codec_name)
*codec_name = g_strdup ("Vorbis");
*codec_name = g_strdup ("Vorbis");
break;
case GST_RIFF_WAVE_FORMAT_A52:
caps = gst_caps_new_simple ("audio/x-ac3", NULL);
if (codec_name)
*codec_name = g_strdup ("AC3");
*codec_name = g_strdup ("AC3");
break;
default:
@ -314,12 +314,12 @@ gst_riff_create_audio_caps (guint16 codec_id,
if (strf != NULL) {
gst_caps_set_simple (caps,
"rate", G_TYPE_INT, strf->rate,
"channels", G_TYPE_INT, strf->channels, NULL);
"rate", G_TYPE_INT, strf->rate,
"channels", G_TYPE_INT, strf->channels, NULL);
} else {
gst_caps_set_simple (caps,
"rate", GST_TYPE_INT_RANGE, 8000, 96000,
"channels", GST_TYPE_INT_RANGE, 1, 2, NULL);
"rate", GST_TYPE_INT_RANGE, 8000, 96000,
"channels", GST_TYPE_INT_RANGE, 1, 2, NULL);
}
return caps;
@ -336,13 +336,13 @@ gst_riff_create_iavs_caps (guint32 codec_fcc,
case GST_MAKE_FOURCC ('D', 'V', 'S', 'D'):
case GST_MAKE_FOURCC ('d', 'v', 's', 'd'):
caps = gst_caps_new_simple ("video/x-dv",
"systemstream", G_TYPE_BOOLEAN, TRUE, NULL);
"systemstream", G_TYPE_BOOLEAN, TRUE, NULL);
if (codec_name)
*codec_name = g_strdup ("Generic DV");
*codec_name = g_strdup ("Generic DV");
default:
GST_WARNING ("Unkown IAVS fourcc " GST_FOURCC_FORMAT,
GST_FOURCC_ARGS (codec_fcc));
GST_FOURCC_ARGS (codec_fcc));
return NULL;
}

View file

@ -61,8 +61,8 @@ gst_riff_read_get_type (void)
};
gst_riff_read_type =
g_type_register_static (GST_TYPE_ELEMENT, "GstRiffRead",
&gst_riff_read_info, 0);
g_type_register_static (GST_TYPE_ELEMENT, "GstRiffRead",
&gst_riff_read_info, 0);
}
return gst_riff_read_type;
@ -94,16 +94,16 @@ gst_riff_read_change_state (GstElement * element)
switch (GST_STATE_TRANSITION (element)) {
case GST_STATE_READY_TO_PAUSED:
if (!riff->sinkpad)
return GST_STATE_FAILURE;
return GST_STATE_FAILURE;
riff->bs = gst_bytestream_new (riff->sinkpad);
break;
case GST_STATE_PAUSED_TO_READY:
gst_bytestream_destroy (riff->bs);
while (riff->level) {
GstRiffLevel *level = riff->level->data;
GstRiffLevel *level = riff->level->data;
riff->level = g_list_remove (riff->level, level);
g_free (level);
riff->level = g_list_remove (riff->level, level);
g_free (level);
}
break;
default:
@ -165,7 +165,7 @@ gst_riff_peek_head (GstRiffRead * riff,
if (GST_IS_EVENT (event)) {
gst_pad_event_default (riff->sinkpad, event);
if (GST_EVENT_TYPE (event) == GST_EVENT_EOS)
return FALSE;
return FALSE;
} else {
GST_ELEMENT_ERROR (riff, RESOURCE, READ, (NULL), (NULL));
return FALSE;
@ -257,7 +257,7 @@ gst_riff_read_seek (GstRiffRead * riff, guint64 offset)
} else if (GST_EVENT_TYPE (event) != GST_EVENT_DISCONTINUOUS) {
gst_pad_event_default (riff->sinkpad, event);
if (GST_EVENT_TYPE (event) == GST_EVENT_EOS)
return NULL;
return NULL;
event = NULL;
}
}
@ -341,7 +341,7 @@ gst_riff_read_skip (GstRiffRead * riff)
/* no */
if (!(event = gst_riff_read_seek (riff,
gst_bytestream_tell (riff->bs) + length)))
gst_bytestream_tell (riff->bs) + length)))
return FALSE;
gst_event_unref (event);
@ -407,7 +407,7 @@ gst_riff_read_strh (GstRiffRead * riff, gst_riff_strh ** header)
}
if (GST_BUFFER_SIZE (buf) < sizeof (gst_riff_strh)) {
g_warning ("Too small strh (%d available, %d needed)",
GST_BUFFER_SIZE (buf), (int) sizeof (gst_riff_strh));
GST_BUFFER_SIZE (buf), (int) sizeof (gst_riff_strh));
gst_buffer_unref (buf);
return FALSE;
}
@ -474,7 +474,7 @@ gst_riff_read_strf_vids (GstRiffRead * riff, gst_riff_strf_vids ** header)
}
if (GST_BUFFER_SIZE (buf) < sizeof (gst_riff_strf_vids)) {
g_warning ("Too small strf_vids (%d available, %d needed)",
GST_BUFFER_SIZE (buf), (int) sizeof (gst_riff_strf_vids));
GST_BUFFER_SIZE (buf), (int) sizeof (gst_riff_strf_vids));
gst_buffer_unref (buf);
return FALSE;
}
@ -498,7 +498,7 @@ gst_riff_read_strf_vids (GstRiffRead * riff, gst_riff_strf_vids ** header)
/* size checking */
if (strf->size > GST_BUFFER_SIZE (buf)) {
g_warning ("strf_vids header gave %d bytes data, only %d available",
strf->size, GST_BUFFER_SIZE (buf));
strf->size, GST_BUFFER_SIZE (buf));
strf->size = GST_BUFFER_SIZE (buf);
}
@ -541,7 +541,7 @@ gst_riff_read_strf_auds (GstRiffRead * riff, gst_riff_strf_auds ** header)
}
if (GST_BUFFER_SIZE (buf) < sizeof (gst_riff_strf_auds)) {
g_warning ("Too small strf_auds (%d available, %d needed)",
GST_BUFFER_SIZE (buf), (int) sizeof (gst_riff_strf_auds));
GST_BUFFER_SIZE (buf), (int) sizeof (gst_riff_strf_auds));
gst_buffer_unref (buf);
return FALSE;
}
@ -564,7 +564,7 @@ gst_riff_read_strf_auds (GstRiffRead * riff, gst_riff_strf_auds ** header)
GST_INFO (" rate %d", strf->rate);
GST_INFO (" av_bps %d", strf->av_bps);
GST_INFO (" blockalign %d", strf->blockalign);
GST_INFO (" size %d", strf->size); /* wordsize, not extrasize! */
GST_INFO (" size %d", strf->size); /* wordsize, not extrasize! */
gst_buffer_unref (buf);
@ -590,7 +590,7 @@ gst_riff_read_strf_iavs (GstRiffRead * riff, gst_riff_strf_iavs ** header)
}
if (GST_BUFFER_SIZE (buf) < sizeof (gst_riff_strf_iavs)) {
g_warning ("Too small strf_iavs (%d available, %d needed)",
GST_BUFFER_SIZE (buf), (int) sizeof (gst_riff_strf_iavs));
GST_BUFFER_SIZE (buf), (int) sizeof (gst_riff_strf_iavs));
gst_buffer_unref (buf);
return FALSE;
}
@ -694,102 +694,103 @@ gst_riff_read_info (GstRiffRead * riff)
/* find out the type of metadata */
switch (tag) {
case GST_RIFF_INFO_IARL:
type = GST_TAG_LOCATION;
break;
type = GST_TAG_LOCATION;
break;
case GST_RIFF_INFO_IART:
type = GST_TAG_ARTIST;
break;
type = GST_TAG_ARTIST;
break;
case GST_RIFF_INFO_ICMS:
type = NULL; /*"Commissioner"; */
break;
type = NULL; /*"Commissioner"; */
break;
case GST_RIFF_INFO_ICMT:
type = GST_TAG_COMMENT;
break;
type = GST_TAG_COMMENT;
break;
case GST_RIFF_INFO_ICOP:
type = GST_TAG_COPYRIGHT;
break;
type = GST_TAG_COPYRIGHT;
break;
case GST_RIFF_INFO_ICRD:
type = GST_TAG_DATE;
break;
type = GST_TAG_DATE;
break;
case GST_RIFF_INFO_ICRP:
type = NULL; /*"Cropped"; */
break;
type = NULL; /*"Cropped"; */
break;
case GST_RIFF_INFO_IDIM:
type = NULL; /*"Dimensions"; */
break;
type = NULL; /*"Dimensions"; */
break;
case GST_RIFF_INFO_IDPI:
type = NULL; /*"Dots per Inch"; */
break;
type = NULL; /*"Dots per Inch"; */
break;
case GST_RIFF_INFO_IENG:
type = NULL; /*"Engineer"; */
break;
type = NULL; /*"Engineer"; */
break;
case GST_RIFF_INFO_IGNR:
type = GST_TAG_GENRE;
break;
type = GST_TAG_GENRE;
break;
case GST_RIFF_INFO_IKEY:
type = NULL; /*"Keywords"; */ ;
break;
type = NULL; /*"Keywords"; */ ;
break;
case GST_RIFF_INFO_ILGT:
type = NULL; /*"Lightness"; */
break;
type = NULL; /*"Lightness"; */
break;
case GST_RIFF_INFO_IMED:
type = NULL; /*"Medium"; */
break;
type = NULL; /*"Medium"; */
break;
case GST_RIFF_INFO_INAM:
type = GST_TAG_TITLE;
break;
type = GST_TAG_TITLE;
break;
case GST_RIFF_INFO_IPLT:
type = NULL; /*"Palette"; */
break;
type = NULL; /*"Palette"; */
break;
case GST_RIFF_INFO_IPRD:
type = NULL; /*"Product"; */
break;
type = NULL; /*"Product"; */
break;
case GST_RIFF_INFO_ISBJ:
type = NULL; /*"Subject"; */
break;
type = NULL; /*"Subject"; */
break;
case GST_RIFF_INFO_ISFT:
type = GST_TAG_ENCODER;
break;
type = GST_TAG_ENCODER;
break;
case GST_RIFF_INFO_ISHP:
type = NULL; /*"Sharpness"; */
break;
type = NULL; /*"Sharpness"; */
break;
case GST_RIFF_INFO_ISRC:
type = GST_TAG_ISRC;
break;
type = GST_TAG_ISRC;
break;
case GST_RIFF_INFO_ISRF:
type = NULL; /*"Source Form"; */
break;
type = NULL; /*"Source Form"; */
break;
case GST_RIFF_INFO_ITCH:
type = NULL; /*"Technician"; */
break;
type = NULL; /*"Technician"; */
break;
default:
type = NULL;
GST_WARNING ("Unknown INFO (metadata) tag entry " GST_FOURCC_FORMAT,
GST_FOURCC_ARGS (tag));
break;
type = NULL;
GST_WARNING ("Unknown INFO (metadata) tag entry " GST_FOURCC_FORMAT,
GST_FOURCC_ARGS (tag));
break;
}
if (type) {
name = NULL;
if (!gst_riff_read_ascii (riff, &tag, &name)) {
return FALSE;
return FALSE;
}
if (name && name[0] != '\0') {
GValue src = { 0 }
, dest = {
0};
GType dest_type = gst_tag_get_type (type);
GValue src = { 0 }
, dest =
{
0};
GType dest_type = gst_tag_get_type (type);
have_tags = TRUE;
g_value_init (&src, G_TYPE_STRING);
g_value_set_string (&src, name);
g_value_init (&dest, dest_type);
g_value_transform (&src, &dest);
g_value_unset (&src);
gst_tag_list_add_values (taglist, GST_TAG_MERGE_APPEND,
type, &dest, NULL);
g_value_unset (&dest);
have_tags = TRUE;
g_value_init (&src, G_TYPE_STRING);
g_value_set_string (&src, name);
g_value_init (&dest, dest_type);
g_value_transform (&src, &dest);
g_value_unset (&src);
gst_tag_list_add_values (taglist, GST_TAG_MERGE_APPEND,
type, &dest, NULL);
g_value_unset (&dest);
}
g_free (name);
} else {
@ -804,10 +805,10 @@ gst_riff_read_info (GstRiffRead * riff)
/* let the world know about this wonderful thing */
for (padlist = gst_element_get_pad_list (element);
padlist != NULL; padlist = padlist->next) {
padlist != NULL; padlist = padlist->next) {
if (GST_PAD_IS_SRC (padlist->data) && GST_PAD_IS_USABLE (padlist->data)) {
gst_event_ref (event);
gst_pad_push (GST_PAD (padlist->data), GST_DATA (event));
gst_event_ref (event);
gst_pad_push (GST_PAD (padlist->data), GST_DATA (event));
}
}
gst_event_unref (event);

View file

@ -60,9 +60,9 @@ gst_tuner_get_type (void)
};
gst_tuner_type = g_type_register_static (G_TYPE_INTERFACE,
"GstTuner", &gst_tuner_info, 0);
"GstTuner", &gst_tuner_info, 0);
g_type_interface_add_prerequisite (gst_tuner_type,
GST_TYPE_IMPLEMENTS_INTERFACE);
GST_TYPE_IMPLEMENTS_INTERFACE);
}
return gst_tuner_type;
@ -75,32 +75,32 @@ gst_tuner_class_init (GstTunerClass * klass)
if (!initialized) {
gst_tuner_signals[NORM_CHANGED] =
g_signal_new ("norm-changed",
GST_TYPE_TUNER, G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GstTunerClass, norm_changed),
NULL, NULL,
g_cclosure_marshal_VOID__OBJECT, G_TYPE_NONE, 1, GST_TYPE_TUNER_NORM);
g_signal_new ("norm-changed",
GST_TYPE_TUNER, G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GstTunerClass, norm_changed),
NULL, NULL,
g_cclosure_marshal_VOID__OBJECT, G_TYPE_NONE, 1, GST_TYPE_TUNER_NORM);
gst_tuner_signals[CHANNEL_CHANGED] =
g_signal_new ("channel-changed",
GST_TYPE_TUNER, G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GstTunerClass, channel_changed),
NULL, NULL,
g_cclosure_marshal_VOID__OBJECT, G_TYPE_NONE, 1,
GST_TYPE_TUNER_CHANNEL);
g_signal_new ("channel-changed",
GST_TYPE_TUNER, G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GstTunerClass, channel_changed),
NULL, NULL,
g_cclosure_marshal_VOID__OBJECT, G_TYPE_NONE, 1,
GST_TYPE_TUNER_CHANNEL);
gst_tuner_signals[FREQUENCY_CHANGED] =
g_signal_new ("frequency-changed",
GST_TYPE_TUNER, G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GstTunerClass, frequency_changed),
NULL, NULL,
gst_tuner_marshal_VOID__OBJECT_ULONG, G_TYPE_NONE, 2,
GST_TYPE_TUNER_CHANNEL, G_TYPE_ULONG);
g_signal_new ("frequency-changed",
GST_TYPE_TUNER, G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GstTunerClass, frequency_changed),
NULL, NULL,
gst_tuner_marshal_VOID__OBJECT_ULONG, G_TYPE_NONE, 2,
GST_TYPE_TUNER_CHANNEL, G_TYPE_ULONG);
gst_tuner_signals[SIGNAL_CHANGED] =
g_signal_new ("signal-changed",
GST_TYPE_TUNER, G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GstTunerClass, signal_changed),
NULL, NULL,
gst_tuner_marshal_VOID__OBJECT_INT, G_TYPE_NONE, 2,
GST_TYPE_TUNER_CHANNEL, G_TYPE_INT);
g_signal_new ("signal-changed",
GST_TYPE_TUNER, G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GstTunerClass, signal_changed),
NULL, NULL,
gst_tuner_marshal_VOID__OBJECT_INT, G_TYPE_NONE, 2,
GST_TYPE_TUNER_CHANNEL, G_TYPE_INT);
initialized = TRUE;
}
@ -262,7 +262,7 @@ gst_tuner_set_frequency (GstTuner * tuner,
GstTunerClass *klass = GST_TUNER_GET_CLASS (tuner);
g_return_if_fail (GST_TUNER_CHANNEL_HAS_FLAG (channel,
GST_TUNER_CHANNEL_FREQUENCY));
GST_TUNER_CHANNEL_FREQUENCY));
if (klass->set_frequency) {
klass->set_frequency (tuner, channel, frequency);
@ -286,7 +286,7 @@ gst_tuner_get_frequency (GstTuner * tuner, GstTunerChannel * channel)
GstTunerClass *klass = GST_TUNER_GET_CLASS (tuner);
g_return_val_if_fail (GST_TUNER_CHANNEL_HAS_FLAG (channel,
GST_TUNER_CHANNEL_FREQUENCY), 0);
GST_TUNER_CHANNEL_FREQUENCY), 0);
if (klass->get_frequency) {
return klass->get_frequency (tuner, channel);
@ -315,7 +315,7 @@ gst_tuner_signal_strength (GstTuner * tuner, GstTunerChannel * channel)
GstTunerClass *klass = GST_TUNER_GET_CLASS (tuner);
g_return_val_if_fail (GST_TUNER_CHANNEL_HAS_FLAG (channel,
GST_TUNER_CHANNEL_FREQUENCY), 0);
GST_TUNER_CHANNEL_FREQUENCY), 0);
if (klass->signal_strength) {
return klass->signal_strength (tuner, channel);

View file

@ -60,8 +60,8 @@ gst_tuner_channel_get_type (void)
};
gst_tuner_channel_type =
g_type_register_static (G_TYPE_OBJECT,
"GstTunerChannel", &tuner_channel_info, 0);
g_type_register_static (G_TYPE_OBJECT,
"GstTunerChannel", &tuner_channel_info, 0);
}
return gst_tuner_channel_type;
@ -78,13 +78,13 @@ gst_tuner_channel_class_init (GstTunerChannelClass * klass)
g_signal_new ("frequency-changed", G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GstTunerChannelClass,
frequency_changed),
frequency_changed),
NULL, NULL, g_cclosure_marshal_VOID__ULONG, G_TYPE_NONE, 1, G_TYPE_ULONG);
signals[SIGNAL_SIGNAL_CHANGED] =
g_signal_new ("signal-changed", G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GstTunerChannelClass,
signal_changed),
signal_changed),
NULL, NULL, g_cclosure_marshal_VOID__INT, G_TYPE_NONE, 1, G_TYPE_INT);
object_klass->dispose = gst_tuner_channel_dispose;

View file

@ -59,8 +59,8 @@ gst_tuner_norm_get_type (void)
};
gst_tuner_norm_type =
g_type_register_static (G_TYPE_OBJECT,
"GstTunerNorm", &tuner_norm_info, 0);
g_type_register_static (G_TYPE_OBJECT,
"GstTunerNorm", &tuner_norm_info, 0);
}
return gst_tuner_norm_type;

View file

@ -83,7 +83,7 @@ gst_videosink_get_type (void)
};
videosink_type = g_type_register_static (GST_TYPE_ELEMENT,
"GstVideoSink", &videosink_info, 0);
"GstVideoSink", &videosink_info, 0);
}
return videosink_type;

View file

@ -37,14 +37,14 @@ gst_video_frame_rate (GstPad * pad)
caps = GST_PAD_CAPS (pad);
if (caps == NULL) {
g_warning ("gstvideo: failed to get caps of pad %s:%s",
GST_ELEMENT_NAME (gst_pad_get_parent (pad)), GST_PAD_NAME (pad));
GST_ELEMENT_NAME (gst_pad_get_parent (pad)), GST_PAD_NAME (pad));
return 0.;
}
structure = gst_caps_get_structure (caps, 0);
if (!gst_structure_get_double (structure, "framerate", &fps)) {
g_warning ("gstvideo: failed to get framerate property of pad %s:%s",
GST_ELEMENT_NAME (gst_pad_get_parent (pad)), GST_PAD_NAME (pad));
GST_ELEMENT_NAME (gst_pad_get_parent (pad)), GST_PAD_NAME (pad));
return 0.;
}
@ -69,7 +69,7 @@ gst_video_get_size (GstPad * pad, gint * width, gint * height)
if (caps == NULL) {
g_warning ("gstvideo: failed to get caps of pad %s:%s",
GST_ELEMENT_NAME (gst_pad_get_parent (pad)), GST_PAD_NAME (pad));
GST_ELEMENT_NAME (gst_pad_get_parent (pad)), GST_PAD_NAME (pad));
return FALSE;
}
@ -79,7 +79,7 @@ gst_video_get_size (GstPad * pad, gint * width, gint * height)
if (!ret) {
g_warning ("gstvideo: failed to get size properties on pad %s:%s",
GST_ELEMENT_NAME (gst_pad_get_parent (pad)), GST_PAD_NAME (pad));
GST_ELEMENT_NAME (gst_pad_get_parent (pad)), GST_PAD_NAME (pad));
return FALSE;
}

View file

@ -55,9 +55,9 @@ gst_x_overlay_get_type (void)
};
gst_x_overlay_type = g_type_register_static (G_TYPE_INTERFACE,
"GstXOverlay", &gst_x_overlay_info, 0);
"GstXOverlay", &gst_x_overlay_info, 0);
g_type_interface_add_prerequisite (gst_x_overlay_type,
GST_TYPE_IMPLEMENTS_INTERFACE);
GST_TYPE_IMPLEMENTS_INTERFACE);
}
return gst_x_overlay_type;
@ -76,16 +76,16 @@ gst_x_overlay_base_init (gpointer g_class)
if (!initialized) {
gst_x_overlay_signals[HAVE_XWINDOW_ID] =
g_signal_new ("have-xwindow-id",
GST_TYPE_X_OVERLAY, G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GstXOverlayClass, have_xwindow_id),
NULL, NULL, g_cclosure_marshal_VOID__INT, G_TYPE_NONE, 1, G_TYPE_INT);
g_signal_new ("have-xwindow-id",
GST_TYPE_X_OVERLAY, G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GstXOverlayClass, have_xwindow_id),
NULL, NULL, g_cclosure_marshal_VOID__INT, G_TYPE_NONE, 1, G_TYPE_INT);
gst_x_overlay_signals[DESIRED_SIZE] =
g_signal_new ("desired-size-changed",
GST_TYPE_X_OVERLAY, G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GstXOverlayClass, desired_size),
NULL, NULL,
gst_marshal_VOID__INT_INT, G_TYPE_NONE, 2, G_TYPE_INT, G_TYPE_INT);
g_signal_new ("desired-size-changed",
GST_TYPE_X_OVERLAY, G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GstXOverlayClass, desired_size),
NULL, NULL,
gst_marshal_VOID__INT_INT, G_TYPE_NONE, 2, G_TYPE_INT, G_TYPE_INT);
initialized = TRUE;
}
@ -155,7 +155,7 @@ gst_x_overlay_get_desired_size (GstXOverlay * overlay, guint * width,
/* this ensures that elements don't need to check width and height for NULL
but apps may use NULL */
klass->get_desired_size (overlay, width ? width : &width_tmp,
height ? height : &height_tmp);
height ? height : &height_tmp);
} else {
if (width)
*width = 0;

View file

@ -57,8 +57,8 @@ gst_x_window_listener_get_type (void)
};
x_window_listener_type =
g_type_register_static (G_TYPE_OBJECT,
"GstXWindowListener", &x_window_listener_info, 0);
g_type_register_static (G_TYPE_OBJECT,
"GstXWindowListener", &x_window_listener_info, 0);
}
return x_window_listener_type;
@ -183,7 +183,7 @@ gst_xwin_refresh (gpointer data)
if (!xwin->ov_move && xwin->ov_map &&
xwin->ov_visibility == VisibilityUnobscured) {
g_mutex_unlock (xwin->main_lock);
return FALSE; /* skip */
return FALSE; /* skip */
}
if (xwin->ov_map && xwin->ov_visibility != VisibilityFullyObscured) {
@ -307,17 +307,17 @@ gst_xwin_window (GstXWindowListener * xwin)
if (xwin->ov_conf) {
xwin->set_window_func (xwin->private_data,
xwin->x, xwin->y, xwin->w, xwin->h, xwin->clips, xwin->num_clips);
xwin->x, xwin->y, xwin->w, xwin->h, xwin->clips, xwin->num_clips);
if (!xwin->ov_visible)
gst_xwin_set_overlay (xwin, TRUE);
gst_xwin_set_overlay (xwin, TRUE);
g_mutex_lock (xwin->main_lock);
if (xwin->ov_refresh_id)
g_source_remove (xwin->ov_refresh_id);
g_source_remove (xwin->ov_refresh_id);
xwin->ov_refresh_id =
g_timeout_add (200, (GSourceFunc) gst_xwin_refresh, (gpointer) xwin);
g_timeout_add (200, (GSourceFunc) gst_xwin_refresh, (gpointer) xwin);
xwin->ov_conf = FALSE;
@ -331,9 +331,9 @@ gst_xwin_window (GstXWindowListener * xwin)
g_mutex_lock (xwin->main_lock);
if (xwin->ov_refresh_id)
g_source_remove (xwin->ov_refresh_id);
g_source_remove (xwin->ov_refresh_id);
xwin->ov_refresh_id =
g_timeout_add (200, (GSourceFunc) gst_xwin_refresh, (gpointer) xwin);
g_timeout_add (200, (GSourceFunc) gst_xwin_refresh, (gpointer) xwin);
xwin->ov_conf = FALSE;
@ -355,7 +355,7 @@ gst_xwin_configure (GstXWindowListener * xwin)
* in the main thread instead of here. */
if (!xwin->ov_conf_id)
xwin->ov_conf_id =
g_idle_add ((GSourceFunc) gst_rec_xoverlay_window, (gpointer) xwin);
g_idle_add ((GSourceFunc) gst_rec_xoverlay_window, (gpointer) xwin);
#endif
gst_xwin_window ((gpointer) xwin);
@ -473,89 +473,89 @@ gst_xwin_thread (gpointer data)
break;
if ((event.type == ConfigureNotify &&
event.xconfigure.window == xwin->xwindow_id) ||
(event.type == MapNotify &&
event.xmap.window == xwin->xwindow_id) ||
(event.type == UnmapNotify &&
event.xunmap.window == xwin->xwindow_id)) {
event.xconfigure.window == xwin->xwindow_id) ||
(event.type == MapNotify &&
event.xmap.window == xwin->xwindow_id) ||
(event.type == UnmapNotify &&
event.xunmap.window == xwin->xwindow_id)) {
/* the 'parent' window, i.e. the widget provided by client */
switch (event.type) {
case MapNotify:
xwin->ov_map = TRUE;
xwin->ov_conf = TRUE;
gst_xwin_configure (xwin);
break;
case MapNotify:
xwin->ov_map = TRUE;
xwin->ov_conf = TRUE;
gst_xwin_configure (xwin);
break;
case UnmapNotify:
xwin->ov_map = FALSE;
xwin->ov_conf = TRUE;
gst_xwin_configure (xwin);
break;
case UnmapNotify:
xwin->ov_map = FALSE;
xwin->ov_conf = TRUE;
gst_xwin_configure (xwin);
break;
case ConfigureNotify:
gst_xwin_resize (xwin);
break;
case ConfigureNotify:
gst_xwin_resize (xwin);
break;
default:
/* nothing */
break;
default:
/* nothing */
break;
}
} else if (event.xany.window == xwin->child) {
/* our own private window */
switch (event.type) {
case Expose:
if (!event.xexpose.count) {
if (xwin->ov_refresh) {
xwin->ov_refresh = FALSE;
} else {
xwin->ov_conf = TRUE;
gst_xwin_configure (xwin);
}
}
break;
case Expose:
if (!event.xexpose.count) {
if (xwin->ov_refresh) {
xwin->ov_refresh = FALSE;
} else {
xwin->ov_conf = TRUE;
gst_xwin_configure (xwin);
}
}
break;
case VisibilityNotify:
xwin->ov_visibility = event.xvisibility.state;
if (xwin->ov_refresh) {
if (event.xvisibility.state != VisibilityFullyObscured)
xwin->ov_refresh = FALSE;
} else {
xwin->ov_conf = TRUE;
gst_xwin_configure (xwin);
}
break;
case VisibilityNotify:
xwin->ov_visibility = event.xvisibility.state;
if (xwin->ov_refresh) {
if (event.xvisibility.state != VisibilityFullyObscured)
xwin->ov_refresh = FALSE;
} else {
xwin->ov_conf = TRUE;
gst_xwin_configure (xwin);
}
break;
default:
/* nothing */
break;
default:
/* nothing */
break;
}
} else {
/* root window */
switch (event.type) {
case MapNotify:
case UnmapNotify:
/* are we still visible? */
if (!xwin->ov_refresh) {
XWindowAttributes attr;
gboolean on;
case MapNotify:
case UnmapNotify:
/* are we still visible? */
if (!xwin->ov_refresh) {
XWindowAttributes attr;
gboolean on;
XGetWindowAttributes (xwin->display, xwin->xwindow_id, &attr);
on = (attr.map_state == IsViewable);
xwin->ov_wmmap = on;
xwin->ov_conf = TRUE;
gst_xwin_configure (xwin);
}
break;
XGetWindowAttributes (xwin->display, xwin->xwindow_id, &attr);
on = (attr.map_state == IsViewable);
xwin->ov_wmmap = on;
xwin->ov_conf = TRUE;
gst_xwin_configure (xwin);
}
break;
case ConfigureNotify:
if (!xwin->ov_refresh) {
gst_xwin_resize (xwin);
}
break;
case ConfigureNotify:
if (!xwin->ov_refresh) {
gst_xwin_resize (xwin);
}
break;
default:
/* nothing */
break;
default:
/* nothing */
break;
}
}
}

View file

@ -102,9 +102,10 @@ gst_cdxa_parse_get_type (void)
0,
(GInstanceInitFunc) gst_cdxa_parse_init,
};
cdxa_parse_type =
g_type_register_static (GST_TYPE_ELEMENT, "GstCDXAParse",
&cdxa_parse_info, 0);
g_type_register_static (GST_TYPE_ELEMENT, "GstCDXAParse",
&cdxa_parse_info, 0);
}
return cdxa_parse_type;
}
@ -202,7 +203,8 @@ typedef struct
gchar CDXA_tag[4];
gchar fmt_tag[4];
guint32 fmt_size;
} CDXAParseHeader;
}
CDXAParseHeader;
/*
A sectors is 2352 bytes long and is composed of:
@ -245,7 +247,7 @@ gst_cdxa_parse_loop (GstElement * element)
/* get the data size */
got_bytes =
gst_bytestream_peek_bytes (cdxa_parse->bs, (guint8 **) & buf, 4);
gst_bytestream_peek_bytes (cdxa_parse->bs, (guint8 **) & buf, 4);
if (got_bytes < 4)
return;
cdxa_parse->data_size = GUINT32_FROM_LE (*((guint32 *) buf));
@ -315,7 +317,7 @@ plugin_init (GstPlugin * plugin)
return FALSE;
if (!gst_element_register (plugin, "cdxaparse", GST_RANK_NONE,
GST_TYPE_CDXA_PARSE))
GST_TYPE_CDXA_PARSE))
return FALSE;
return TRUE;

View file

@ -50,9 +50,9 @@ struct _GstChart
gint height;
gint samplerate;
gdouble framerate; /* desired frame rate */
gint samples_between_frames; /* number of samples between start of successive frames */
gint samples_since_last_frame; /* number of samples between start of successive frames */
gdouble framerate; /* desired frame rate */
gint samples_between_frames; /* number of samples between start of successive frames */
gint samples_since_last_frame; /* number of samples between start of successive frames */
};
struct _GstChartClass
@ -94,11 +94,11 @@ static GstStaticPadTemplate sink_factory = GST_STATIC_PAD_TEMPLATE ("sink",
GST_PAD_SINK,
GST_PAD_ALWAYS,
GST_STATIC_CAPS ("audio/x-raw-int, "
"endianness = (int) BYTE_ORDER, "
"signed = (boolean) TRUE, "
"width = (int) 16, "
"depth = (int) 16, "
"rate = (int) [ 8000, 96000 ], " "channels = (int) 1")
"endianness = (int) BYTE_ORDER, "
"signed = (boolean) TRUE, "
"width = (int) 16, "
"depth = (int) 16, "
"rate = (int) [ 8000, 96000 ], " "channels = (int) 1")
);
static void gst_chart_base_init (gpointer g_class);
@ -136,6 +136,7 @@ gst_chart_get_type (void)
0,
(GInstanceInitFunc) gst_chart_init,
};
type = g_type_register_static (GST_TYPE_ELEMENT, "GstChart", &info, 0);
}
return type;
@ -194,8 +195,8 @@ gst_chart_init (GstChart * chart)
chart->height = 128;
chart->samplerate = -1;
chart->framerate = 25; /* desired frame rate */
chart->samples_between_frames = 0; /* number of samples between start of successive frames */
chart->framerate = 25; /* desired frame rate */
chart->samples_between_frames = 0; /* number of samples between start of successive frames */
chart->samples_since_last_frame = 0;
}
@ -264,29 +265,29 @@ draw_chart_16bpp (guchar * output, gint width, gint height,
if (h1 < height / 2) {
while (pos < colstart + h1 * width) {
*pos = 0x0000;
pos += width;
*pos = 0x0000;
pos += width;
}
while (pos < colstart + height / 2 * width) {
*pos = 0x07e0;
pos += width;
*pos = 0x07e0;
pos += width;
}
while (pos < colstart + height * width) {
*pos = 0x0000;
pos += width;
*pos = 0x0000;
pos += width;
}
} else {
while (pos < colstart + height / 2 * width) {
*pos = 0x0000;
pos += width;
*pos = 0x0000;
pos += width;
}
while (pos < colstart + h1 * width) {
*pos = 0x07e0;
pos += width;
*pos = 0x07e0;
pos += width;
}
while (pos < colstart + height * width) {
*pos = 0x0000;
pos += width;
*pos = 0x0000;
pos += width;
}
}
}
@ -333,12 +334,12 @@ gst_chart_chain (GstPad * pad, GstData * _data)
GST_BUFFER_SIZE (bufout) = sizeout;
GST_BUFFER_DATA (bufout) = dataout;
GST_DEBUG ("CHART: made new buffer: size %d, width %d, height %d",
sizeout, chart->width, chart->height);
sizeout, chart->width, chart->height);
/* take data and draw to new buffer */
/* FIXME: call different routines for different properties */
draw_chart_16bpp (dataout, chart->width, chart->height, (gint16 *) datain,
samples_in);
samples_in);
gst_buffer_unref (bufin);

View file

@ -62,7 +62,7 @@ static GstStaticPadTemplate gst_colorspace_src_template =
GST_PAD_SRC,
GST_PAD_ALWAYS,
GST_STATIC_CAPS (GST_VIDEO_CAPS_xRGB "; "
GST_VIDEO_CAPS_BGRx "; " GST_VIDEO_CAPS_RGB "; " GST_VIDEO_CAPS_RGB_16)
GST_VIDEO_CAPS_BGRx "; " GST_VIDEO_CAPS_RGB "; " GST_VIDEO_CAPS_RGB_16)
);
/* Stereo signals and args */
@ -132,125 +132,125 @@ colorspace_setup_converter (GstColorspace * space, GstCaps * from_caps,
gst_structure_get_int (from_struct, "bpp", &from_bpp);
switch (to_space) {
case GST_MAKE_FOURCC ('R', 'G', 'B', ' '):
case GST_MAKE_FOURCC ('R', 'G', 'B', ' '):
#ifdef HAVE_HERMES
{
gint to_bpp;
{
gint to_bpp;
gst_structure_get_int (to_struct, "bpp", &to_bpp);
gst_structure_get_int (to_struct, "bpp", &to_bpp);
gst_structure_get_int (from_struct, "red_mask", &space->source.r);
gst_structure_get_int (from_struct, "green_mask", &space->source.g);
gst_structure_get_int (from_struct, "blue_mask", &space->source.b);
space->source.a = 0;
space->srcbpp = space->source.bits = from_bpp;
space->source.indexed = 0;
space->source.has_colorkey = 0;
gst_structure_get_int (from_struct, "red_mask", &space->source.r);
gst_structure_get_int (from_struct, "green_mask", &space->source.g);
gst_structure_get_int (from_struct, "blue_mask", &space->source.b);
space->source.a = 0;
space->srcbpp = space->source.bits = from_bpp;
space->source.indexed = 0;
space->source.has_colorkey = 0;
GST_INFO ("source red mask %08x", space->source.r);
GST_INFO ("source green mask %08x", space->source.g);
GST_INFO ("source blue mask %08x", space->source.b);
GST_INFO ("source bpp %08x", space->srcbpp);
GST_INFO ("source red mask %08x", space->source.r);
GST_INFO ("source green mask %08x", space->source.g);
GST_INFO ("source blue mask %08x", space->source.b);
GST_INFO ("source bpp %08x", space->srcbpp);
gst_structure_get_int (to_struct, "red_mask", &space->dest.r);
gst_structure_get_int (to_struct, "green_mask", &space->dest.g);
gst_structure_get_int (to_struct, "blue_mask", &space->dest.b);
space->dest.a = 0;
space->destbpp = space->dest.bits = to_bpp;
space->dest.indexed = 0;
space->dest.has_colorkey = 0;
gst_structure_get_int (to_struct, "red_mask", &space->dest.r);
gst_structure_get_int (to_struct, "green_mask", &space->dest.g);
gst_structure_get_int (to_struct, "blue_mask", &space->dest.b);
space->dest.a = 0;
space->destbpp = space->dest.bits = to_bpp;
space->dest.indexed = 0;
space->dest.has_colorkey = 0;
GST_INFO ("dest red mask %08x", space->dest.r);
GST_INFO ("dest green mask %08x", space->dest.g);
GST_INFO ("dest blue mask %08x", space->dest.b);
GST_INFO ("dest bpp %08x", space->destbpp);
GST_INFO ("dest red mask %08x", space->dest.r);
GST_INFO ("dest green mask %08x", space->dest.g);
GST_INFO ("dest blue mask %08x", space->dest.b);
GST_INFO ("dest bpp %08x", space->destbpp);
if (!Hermes_ConverterRequest (space->h_handle, &space->source,
&space->dest)) {
g_warning ("Hermes: could not get converter\n");
return FALSE;
}
GST_INFO ("converter set up");
space->type = GST_COLORSPACE_HERMES;
return TRUE;
}
if (!Hermes_ConverterRequest (space->h_handle, &space->source,
&space->dest)) {
g_warning ("Hermes: could not get converter\n");
return FALSE;
}
GST_INFO ("converter set up");
space->type = GST_COLORSPACE_HERMES;
return TRUE;
}
#else
g_warning ("colorspace: compiled without hermes!");
return FALSE;
g_warning ("colorspace: compiled without hermes!");
return FALSE;
#endif
case GST_MAKE_FOURCC ('Y', 'V', '1', '2'):
if (from_bpp == 32) {
space->type = GST_COLORSPACE_RGB32_YV12;
space->destbpp = 12;
return TRUE;
}
case GST_MAKE_FOURCC ('I', '4', '2', '0'):
if (from_bpp == 32) {
space->type = GST_COLORSPACE_RGB32_I420;
space->destbpp = 12;
return TRUE;
}
case GST_MAKE_FOURCC ('Y', 'U', 'Y', '2'):
GST_INFO ("colorspace: RGB to YUV with bpp %d not implemented!!",
from_bpp);
return FALSE;
case GST_MAKE_FOURCC ('Y', 'V', '1', '2'):
if (from_bpp == 32) {
space->type = GST_COLORSPACE_RGB32_YV12;
space->destbpp = 12;
return TRUE;
}
case GST_MAKE_FOURCC ('I', '4', '2', '0'):
if (from_bpp == 32) {
space->type = GST_COLORSPACE_RGB32_I420;
space->destbpp = 12;
return TRUE;
}
case GST_MAKE_FOURCC ('Y', 'U', 'Y', '2'):
GST_INFO ("colorspace: RGB to YUV with bpp %d not implemented!!",
from_bpp);
return FALSE;
}
break;
}
case GST_MAKE_FOURCC ('I', '4', '2', '0'):
switch (to_space) {
case GST_MAKE_FOURCC ('R', 'G', 'B', ' '):
GST_INFO ("colorspace: YUV to RGB");
case GST_MAKE_FOURCC ('R', 'G', 'B', ' '):
GST_INFO ("colorspace: YUV to RGB");
gst_structure_get_int (to_struct, "bpp", &space->destbpp);
space->converter =
gst_colorspace_yuv2rgb_get_converter (from_caps, to_caps);
space->type = GST_COLORSPACE_YUV_RGB;
return TRUE;
case GST_MAKE_FOURCC ('I', '4', '2', '0'):
space->type = GST_COLORSPACE_NONE;
space->destbpp = 12;
return TRUE;
case GST_MAKE_FOURCC ('Y', 'V', '1', '2'):
space->type = GST_COLORSPACE_420_SWAP;
space->destbpp = 12;
return TRUE;
gst_structure_get_int (to_struct, "bpp", &space->destbpp);
space->converter =
gst_colorspace_yuv2rgb_get_converter (from_caps, to_caps);
space->type = GST_COLORSPACE_YUV_RGB;
return TRUE;
case GST_MAKE_FOURCC ('I', '4', '2', '0'):
space->type = GST_COLORSPACE_NONE;
space->destbpp = 12;
return TRUE;
case GST_MAKE_FOURCC ('Y', 'V', '1', '2'):
space->type = GST_COLORSPACE_420_SWAP;
space->destbpp = 12;
return TRUE;
}
break;
case GST_MAKE_FOURCC ('Y', 'U', 'Y', '2'):
switch (to_space) {
case GST_MAKE_FOURCC ('I', '4', '2', '0'):
space->type = GST_COLORSPACE_YUY2_I420;
space->destbpp = 12;
return TRUE;
case GST_MAKE_FOURCC ('Y', 'U', 'Y', '2'):
space->type = GST_COLORSPACE_NONE;
space->destbpp = 16;
return TRUE;
case GST_MAKE_FOURCC ('R', 'G', 'B', ' '):
GST_INFO ("colorspace: YUY2 to RGB not implemented!!");
return FALSE;
case GST_MAKE_FOURCC ('I', '4', '2', '0'):
space->type = GST_COLORSPACE_YUY2_I420;
space->destbpp = 12;
return TRUE;
case GST_MAKE_FOURCC ('Y', 'U', 'Y', '2'):
space->type = GST_COLORSPACE_NONE;
space->destbpp = 16;
return TRUE;
case GST_MAKE_FOURCC ('R', 'G', 'B', ' '):
GST_INFO ("colorspace: YUY2 to RGB not implemented!!");
return FALSE;
}
break;
case GST_MAKE_FOURCC ('Y', 'V', '1', '2'):
switch (to_space) {
case GST_MAKE_FOURCC ('R', 'G', 'B', ' '):
GST_INFO ("colorspace: YV12 to RGB");
case GST_MAKE_FOURCC ('R', 'G', 'B', ' '):
GST_INFO ("colorspace: YV12 to RGB");
gst_structure_get_int (to_struct, "bpp", &space->destbpp);
space->converter =
gst_colorspace_yuv2rgb_get_converter (from_caps, to_caps);
space->type = GST_COLORSPACE_YUV_RGB;
return TRUE;
case GST_MAKE_FOURCC ('I', '4', '2', '0'):
space->type = GST_COLORSPACE_420_SWAP;
space->destbpp = 12;
return TRUE;
case GST_MAKE_FOURCC ('Y', 'V', '1', '2'):
space->type = GST_COLORSPACE_NONE;
space->destbpp = 12;
return TRUE;
gst_structure_get_int (to_struct, "bpp", &space->destbpp);
space->converter =
gst_colorspace_yuv2rgb_get_converter (from_caps, to_caps);
space->type = GST_COLORSPACE_YUV_RGB;
return TRUE;
case GST_MAKE_FOURCC ('I', '4', '2', '0'):
space->type = GST_COLORSPACE_420_SWAP;
space->destbpp = 12;
return TRUE;
case GST_MAKE_FOURCC ('Y', 'V', '1', '2'):
space->type = GST_COLORSPACE_NONE;
space->destbpp = 12;
return TRUE;
}
break;
}
@ -317,7 +317,7 @@ gst_colorspace_get_format (const GstCaps * caps)
GstCaps *fcaps;
fcaps =
gst_caps_copy (gst_static_caps_get (&gst_colorspace_formats[i].caps));
gst_caps_copy (gst_static_caps_get (&gst_colorspace_formats[i].caps));
icaps = gst_caps_intersect (caps, fcaps);
if (!gst_caps_is_empty (icaps)) {
@ -417,8 +417,8 @@ gst_colorspace_link (GstPad * pad, const GstCaps * caps)
othercaps = gst_caps_copy (gst_pad_get_negotiated_caps (otherpad));
gst_caps_set_simple (othercaps,
"width", G_TYPE_INT, width,
"height", G_TYPE_INT, height, "framerate", G_TYPE_DOUBLE, fps, NULL);
"width", G_TYPE_INT, width,
"height", G_TYPE_INT, height, "framerate", G_TYPE_DOUBLE, fps, NULL);
link_ret = gst_pad_try_set_caps (otherpad, othercaps);
if (link_ret != GST_PAD_LINK_OK) {
@ -434,15 +434,15 @@ gst_colorspace_link (GstPad * pad, const GstCaps * caps)
if (gst_pad_is_negotiated (otherpad)) {
space->converter_index =
gst_colorspace_get_converter (space->sink_format_index,
space->src_format_index);
gst_colorspace_get_converter (space->sink_format_index,
space->src_format_index);
g_print ("using index %d\n", space->converter_index);
space->sink_size = gst_colorspace_format_get_size (space->sink_format_index,
width, height);
width, height);
space->src_size = gst_colorspace_format_get_size (space->src_format_index,
width, height);
width, height);
space->width = width;
space->height = height;
space->fps = fps;
@ -474,9 +474,10 @@ gst_colorspace_get_type (void)
0,
(GInstanceInitFunc) gst_colorspace_init,
};
colorspace_type =
g_type_register_static (GST_TYPE_ELEMENT, "GstColorspace",
&colorspace_info, 0);
g_type_register_static (GST_TYPE_ELEMENT, "GstColorspace",
&colorspace_info, 0);
}
return colorspace_type;
}
@ -621,7 +622,7 @@ static gboolean
plugin_init (GstPlugin * plugin)
{
if (!gst_element_register (plugin, "colorspace", GST_RANK_PRIMARY,
GST_TYPE_COLORSPACE))
GST_TYPE_COLORSPACE))
return FALSE;
return TRUE;

Some files were not shown because too many files have changed in this diff Show more