mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-04-15 20:44:16 +00:00
don't mix tabs and spaces
Original commit message from CVS: don't mix tabs and spaces
This commit is contained in:
parent
d07ec45fa4
commit
6cc1c73d2b
124 changed files with 6006 additions and 5872 deletions
|
@ -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):
|
||||
|
|
|
@ -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");
|
||||
|
|
|
@ -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",
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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
|
||||
};
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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
|
||||
};
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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");
|
||||
|
|
|
@ -100,8 +100,9 @@ gst_aasink_get_type (void)
|
|||
0,
|
||||
(GInstanceInitFunc) gst_aasink_init,
|
||||
};
|
||||
|
||||
aasink_type =
|
||||
g_type_register_static (GST_TYPE_ELEMENT, "GstAASink", &aasink_info, 0);
|
||||
g_type_register_static (GST_TYPE_ELEMENT, "GstAASink", &aasink_info, 0);
|
||||
}
|
||||
return aasink_type;
|
||||
}
|
||||
|
@ -191,17 +192,17 @@ gst_aasink_class_init (GstAASinkClass * klass)
|
|||
|
||||
parent_class = g_type_class_ref (GST_TYPE_ELEMENT);
|
||||
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_WIDTH, g_param_spec_int ("width", "width", "width", G_MININT, G_MAXINT, 0, G_PARAM_READWRITE)); /* CHECKME */
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_HEIGHT, g_param_spec_int ("height", "height", "height", G_MININT, G_MAXINT, 0, G_PARAM_READWRITE)); /* CHECKME */
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_DRIVER, g_param_spec_enum ("driver", "driver", "driver", GST_TYPE_AADRIVERS, 0, G_PARAM_READWRITE)); /* CHECKME! */
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_DITHER, g_param_spec_enum ("dither", "dither", "dither", GST_TYPE_AADITHER, 0, G_PARAM_READWRITE)); /* CHECKME! */
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_BRIGHTNESS, g_param_spec_int ("brightness", "brightness", "brightness", G_MININT, G_MAXINT, 0, G_PARAM_READWRITE)); /* CHECKME */
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_CONTRAST, g_param_spec_int ("contrast", "contrast", "contrast", G_MININT, G_MAXINT, 0, G_PARAM_READWRITE)); /* CHECKME */
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_GAMMA, g_param_spec_float ("gamma", "gamma", "gamma", 0.0, 5.0, 1.0, G_PARAM_READWRITE)); /* CHECKME */
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_INVERSION, g_param_spec_boolean ("inversion", "inversion", "inversion", TRUE, G_PARAM_READWRITE)); /* CHECKME */
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_RANDOMVAL, g_param_spec_int ("randomval", "randomval", "randomval", G_MININT, G_MAXINT, 0, G_PARAM_READWRITE)); /* CHECKME */
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_FRAMES_DISPLAYED, g_param_spec_int ("frames_displayed", "frames_displayed", "frames_displayed", G_MININT, G_MAXINT, 0, G_PARAM_READABLE)); /* CHECKME */
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_FRAME_TIME, g_param_spec_int ("frame_time", "frame_time", "frame_time", G_MININT, G_MAXINT, 0, G_PARAM_READABLE)); /* CHECKME */
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_WIDTH, g_param_spec_int ("width", "width", "width", G_MININT, G_MAXINT, 0, G_PARAM_READWRITE)); /* CHECKME */
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_HEIGHT, g_param_spec_int ("height", "height", "height", G_MININT, G_MAXINT, 0, G_PARAM_READWRITE)); /* CHECKME */
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_DRIVER, g_param_spec_enum ("driver", "driver", "driver", GST_TYPE_AADRIVERS, 0, G_PARAM_READWRITE)); /* CHECKME! */
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_DITHER, g_param_spec_enum ("dither", "dither", "dither", GST_TYPE_AADITHER, 0, G_PARAM_READWRITE)); /* CHECKME! */
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_BRIGHTNESS, g_param_spec_int ("brightness", "brightness", "brightness", G_MININT, G_MAXINT, 0, G_PARAM_READWRITE)); /* CHECKME */
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_CONTRAST, g_param_spec_int ("contrast", "contrast", "contrast", G_MININT, G_MAXINT, 0, G_PARAM_READWRITE)); /* CHECKME */
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_GAMMA, g_param_spec_float ("gamma", "gamma", "gamma", 0.0, 5.0, 1.0, G_PARAM_READWRITE)); /* CHECKME */
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_INVERSION, g_param_spec_boolean ("inversion", "inversion", "inversion", TRUE, G_PARAM_READWRITE)); /* CHECKME */
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_RANDOMVAL, g_param_spec_int ("randomval", "randomval", "randomval", G_MININT, G_MAXINT, 0, G_PARAM_READWRITE)); /* CHECKME */
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_FRAMES_DISPLAYED, g_param_spec_int ("frames_displayed", "frames_displayed", "frames_displayed", G_MININT, G_MAXINT, 0, G_PARAM_READABLE)); /* CHECKME */
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_FRAME_TIME, g_param_spec_int ("frame_time", "frame_time", "frame_time", G_MININT, G_MAXINT, 0, G_PARAM_READABLE)); /* CHECKME */
|
||||
|
||||
gobject_class->set_property = gst_aasink_set_property;
|
||||
gobject_class->get_property = gst_aasink_get_property;
|
||||
|
@ -238,7 +239,7 @@ gst_aasink_fixate (GstPad * pad, const GstCaps * caps)
|
|||
return newcaps;
|
||||
}
|
||||
if (gst_caps_structure_fixate_field_nearest_double (structure, "framerate",
|
||||
30.0)) {
|
||||
30.0)) {
|
||||
return newcaps;
|
||||
}
|
||||
|
||||
|
@ -282,7 +283,7 @@ gst_aasink_init (GstAASink * aasink)
|
|||
{
|
||||
aasink->sinkpad =
|
||||
gst_pad_new_from_template (gst_element_get_pad_template (GST_ELEMENT
|
||||
(aasink), "sink"), "sink");
|
||||
(aasink), "sink"), "sink");
|
||||
gst_element_add_pad (GST_ELEMENT (aasink), aasink->sinkpad);
|
||||
gst_pad_set_chain_function (aasink->sinkpad, gst_aasink_chain);
|
||||
gst_pad_set_link_function (aasink->sinkpad, gst_aasink_sinkconnect);
|
||||
|
@ -330,12 +331,12 @@ gst_aasink_scale (GstAASink * aasink, gchar * src, gchar * dest,
|
|||
guchar *srcp = src;
|
||||
|
||||
for (x = dw; x; x--) {
|
||||
while (xpos >= 0x10000L) {
|
||||
srcp++;
|
||||
xpos -= 0x10000L;
|
||||
}
|
||||
*destp++ = *srcp;
|
||||
xpos += xinc;
|
||||
while (xpos >= 0x10000L) {
|
||||
srcp++;
|
||||
xpos -= 0x10000L;
|
||||
}
|
||||
*destp++ = *srcp;
|
||||
xpos += xinc;
|
||||
}
|
||||
}
|
||||
dest += dw;
|
||||
|
@ -355,12 +356,12 @@ gst_aasink_chain (GstPad * pad, GstData * _data)
|
|||
|
||||
aasink = GST_AASINK (gst_pad_get_parent (pad));
|
||||
|
||||
gst_aasink_scale (aasink, GST_BUFFER_DATA (buf), /* src */
|
||||
aa_image (aasink->context), /* dest */
|
||||
aasink->width, /* sw */
|
||||
aasink->height, /* sh */
|
||||
aa_imgwidth (aasink->context), /* dw */
|
||||
aa_imgheight (aasink->context)); /* dh */
|
||||
gst_aasink_scale (aasink, GST_BUFFER_DATA (buf), /* src */
|
||||
aa_image (aasink->context), /* dest */
|
||||
aasink->width, /* sw */
|
||||
aasink->height, /* sh */
|
||||
aa_imgwidth (aasink->context), /* dw */
|
||||
aa_imgheight (aasink->context)); /* dh */
|
||||
|
||||
GST_DEBUG ("videosink: clock wait: %" G_GUINT64_FORMAT,
|
||||
GST_BUFFER_TIMESTAMP (buf));
|
||||
|
@ -503,7 +504,7 @@ gst_aasink_open (GstAASink * aasink)
|
|||
aasink->context = aa_autoinit (&aasink->ascii_surf);
|
||||
if (aasink->context == NULL) {
|
||||
GST_ELEMENT_ERROR (GST_ELEMENT (aasink), LIBRARY, TOO_LAZY, (NULL),
|
||||
("error opening aalib context"));
|
||||
("error opening aalib context"));
|
||||
return FALSE;
|
||||
}
|
||||
aa_autoinitkbd (aasink->context, 0);
|
||||
|
@ -535,7 +536,7 @@ gst_aasink_change_state (GstElement * element)
|
|||
} else {
|
||||
if (!GST_FLAG_IS_SET (element, GST_AASINK_OPEN)) {
|
||||
if (!gst_aasink_open (GST_AASINK (element)))
|
||||
return GST_STATE_FAILURE;
|
||||
return GST_STATE_FAILURE;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -38,7 +38,7 @@ main (int argc, char *argv[])
|
|||
} else {
|
||||
src = gst_element_factory_make ("filesrc", "src");
|
||||
g_object_set (G_OBJECT (src), "location", argv[1], "bytesperread", 480,
|
||||
NULL);
|
||||
NULL);
|
||||
}
|
||||
dvdec = gst_element_factory_make ("dvdec", "decoder");
|
||||
if (!dvdec)
|
||||
|
|
|
@ -81,54 +81,54 @@ static GstStaticPadTemplate video_src_temp = GST_STATIC_PAD_TEMPLATE ("video",
|
|||
GST_PAD_SRC,
|
||||
GST_PAD_ALWAYS,
|
||||
GST_STATIC_CAPS ("video/x-raw-yuv, "
|
||||
"format = (fourcc) YUY2, "
|
||||
"width = (int) 720, "
|
||||
"height = (int) { "
|
||||
G_STRINGIFY (NTSC_HEIGHT) ", " G_STRINGIFY (PAL_HEIGHT)
|
||||
" }, "
|
||||
"framerate = (double) { "
|
||||
G_STRINGIFY (PAL_FRAMERATE) ", " G_STRINGIFY (NTSC_FRAMERATE)
|
||||
" }; "
|
||||
"video/x-raw-rgb, "
|
||||
"bpp = (int) 32, "
|
||||
"depth = (int) 32, "
|
||||
"endianness = (int) " G_STRINGIFY (G_BIG_ENDIAN) ", "
|
||||
"red_mask = (int) 0x000000ff, "
|
||||
"green_mask = (int) 0x0000ff00, "
|
||||
"blue_mask = (int) 0x00ff0000, "
|
||||
"width = (int) 720, "
|
||||
"height = (int) { "
|
||||
G_STRINGIFY (NTSC_HEIGHT) ", " G_STRINGIFY (PAL_HEIGHT)
|
||||
" }, "
|
||||
"framerate = (double) { "
|
||||
G_STRINGIFY (PAL_FRAMERATE) ", " G_STRINGIFY (NTSC_FRAMERATE)
|
||||
" }; "
|
||||
"video/x-raw-rgb, "
|
||||
"bpp = (int) 24, "
|
||||
"depth = (int) 24, "
|
||||
"endianness = (int) " G_STRINGIFY (G_BIG_ENDIAN) ", "
|
||||
"red_mask = (int) 0x000000ff, "
|
||||
"green_mask = (int) 0x0000ff00, "
|
||||
"blue_mask = (int) 0x00ff0000, "
|
||||
"width = (int) 720, "
|
||||
"height = (int) { "
|
||||
G_STRINGIFY (NTSC_HEIGHT) ", " G_STRINGIFY (PAL_HEIGHT)
|
||||
" }, "
|
||||
"framerate = (double) { "
|
||||
G_STRINGIFY (PAL_FRAMERATE) ", " G_STRINGIFY (NTSC_FRAMERATE)
|
||||
" }")
|
||||
"format = (fourcc) YUY2, "
|
||||
"width = (int) 720, "
|
||||
"height = (int) { "
|
||||
G_STRINGIFY (NTSC_HEIGHT) ", " G_STRINGIFY (PAL_HEIGHT)
|
||||
" }, "
|
||||
"framerate = (double) { "
|
||||
G_STRINGIFY (PAL_FRAMERATE) ", " G_STRINGIFY (NTSC_FRAMERATE)
|
||||
" }; "
|
||||
"video/x-raw-rgb, "
|
||||
"bpp = (int) 32, "
|
||||
"depth = (int) 32, "
|
||||
"endianness = (int) " G_STRINGIFY (G_BIG_ENDIAN) ", "
|
||||
"red_mask = (int) 0x000000ff, "
|
||||
"green_mask = (int) 0x0000ff00, "
|
||||
"blue_mask = (int) 0x00ff0000, "
|
||||
"width = (int) 720, "
|
||||
"height = (int) { "
|
||||
G_STRINGIFY (NTSC_HEIGHT) ", " G_STRINGIFY (PAL_HEIGHT)
|
||||
" }, "
|
||||
"framerate = (double) { "
|
||||
G_STRINGIFY (PAL_FRAMERATE) ", " G_STRINGIFY (NTSC_FRAMERATE)
|
||||
" }; "
|
||||
"video/x-raw-rgb, "
|
||||
"bpp = (int) 24, "
|
||||
"depth = (int) 24, "
|
||||
"endianness = (int) " G_STRINGIFY (G_BIG_ENDIAN) ", "
|
||||
"red_mask = (int) 0x000000ff, "
|
||||
"green_mask = (int) 0x0000ff00, "
|
||||
"blue_mask = (int) 0x00ff0000, "
|
||||
"width = (int) 720, "
|
||||
"height = (int) { "
|
||||
G_STRINGIFY (NTSC_HEIGHT) ", " G_STRINGIFY (PAL_HEIGHT)
|
||||
" }, "
|
||||
"framerate = (double) { "
|
||||
G_STRINGIFY (PAL_FRAMERATE) ", " G_STRINGIFY (NTSC_FRAMERATE)
|
||||
" }")
|
||||
);
|
||||
|
||||
static GstStaticPadTemplate audio_src_temp = GST_STATIC_PAD_TEMPLATE ("audio",
|
||||
GST_PAD_SRC,
|
||||
GST_PAD_ALWAYS,
|
||||
GST_STATIC_CAPS ("audio/x-raw-int, "
|
||||
"depth = (int) 16, "
|
||||
"width = (int) 16, "
|
||||
"signed = (boolean) TRUE, "
|
||||
"channels = (int) 2, "
|
||||
"endianness = (int) " G_STRINGIFY (G_LITTLE_ENDIAN) ", "
|
||||
"rate = (int) [ 4000, 48000 ]")
|
||||
"depth = (int) 16, "
|
||||
"width = (int) 16, "
|
||||
"signed = (boolean) TRUE, "
|
||||
"channels = (int) 2, "
|
||||
"endianness = (int) " G_STRINGIFY (G_LITTLE_ENDIAN) ", "
|
||||
"rate = (int) [ 4000, 48000 ]")
|
||||
);
|
||||
|
||||
#define GST_TYPE_DVDEC_QUALITY (gst_dvdec_quality_get_type())
|
||||
|
@ -144,6 +144,7 @@ gst_dvdec_quality_get_type (void)
|
|||
{DV_QUALITY_AC_2, "DV_QUALITY_AC_2", "AC 2 something"},
|
||||
{0, NULL, NULL}
|
||||
};
|
||||
|
||||
qtype = g_flags_register_static ("GstDVDecQualityFlags", values);
|
||||
}
|
||||
return qtype;
|
||||
|
@ -211,8 +212,9 @@ gst_dvdec_get_type (void)
|
|||
0,
|
||||
(GInstanceInitFunc) gst_dvdec_init,
|
||||
};
|
||||
|
||||
dvdec_type =
|
||||
g_type_register_static (GST_TYPE_ELEMENT, "GstDVDec", &dvdec_info, 0);
|
||||
g_type_register_static (GST_TYPE_ELEMENT, "GstDVDec", &dvdec_info, 0);
|
||||
}
|
||||
return dvdec_type;
|
||||
}
|
||||
|
@ -261,13 +263,13 @@ gst_dvdec_class_init (GstDVDecClass * klass)
|
|||
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_CLAMP_LUMA,
|
||||
g_param_spec_boolean ("clamp_luma", "Clamp luma", "Clamp luma",
|
||||
FALSE, G_PARAM_READWRITE));
|
||||
FALSE, G_PARAM_READWRITE));
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_CLAMP_CHROMA,
|
||||
g_param_spec_boolean ("clamp_chroma", "Clamp chroma", "Clamp chroma",
|
||||
FALSE, G_PARAM_READWRITE));
|
||||
FALSE, G_PARAM_READWRITE));
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_QUALITY,
|
||||
g_param_spec_flags ("quality", "Quality", "Decoding quality",
|
||||
GST_TYPE_DVDEC_QUALITY, DV_QUALITY_BEST, G_PARAM_READWRITE));
|
||||
GST_TYPE_DVDEC_QUALITY, DV_QUALITY_BEST, G_PARAM_READWRITE));
|
||||
|
||||
gobject_class->set_property = gst_dvdec_set_property;
|
||||
gobject_class->get_property = gst_dvdec_get_property;
|
||||
|
@ -355,7 +357,7 @@ gst_dvdec_init (GstDVDec * dvdec)
|
|||
|
||||
for (i = 0; i < 4; i++) {
|
||||
dvdec->audio_buffers[i] =
|
||||
(gint16 *) g_malloc (DV_AUDIO_MAX_SAMPLES * sizeof (gint16));
|
||||
(gint16 *) g_malloc (DV_AUDIO_MAX_SAMPLES * sizeof (gint16));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -396,29 +398,29 @@ gst_dvdec_src_convert (GstPad * pad, GstFormat src_format, gint64 src_value,
|
|||
switch (src_format) {
|
||||
case GST_FORMAT_BYTES:
|
||||
switch (*dest_format) {
|
||||
case GST_FORMAT_TIME:
|
||||
default:
|
||||
res = FALSE;
|
||||
case GST_FORMAT_TIME:
|
||||
default:
|
||||
res = FALSE;
|
||||
}
|
||||
break;
|
||||
case GST_FORMAT_TIME:
|
||||
switch (*dest_format) {
|
||||
case GST_FORMAT_BYTES:
|
||||
if (pad == dvdec->videosrcpad)
|
||||
scale = 720 * dvdec->height * dvdec->bpp;
|
||||
else if (pad == dvdec->audiosrcpad)
|
||||
scale = dvdec->decoder->audio->num_channels * 2;
|
||||
/* fallthrough */
|
||||
case GST_FORMAT_DEFAULT:
|
||||
if (pad == dvdec->videosrcpad)
|
||||
*dest_value = src_value * dvdec->framerate * scale / GST_SECOND;
|
||||
else if (pad == dvdec->audiosrcpad)
|
||||
*dest_value =
|
||||
src_value * dvdec->decoder->audio->frequency * scale /
|
||||
GST_SECOND;
|
||||
break;
|
||||
default:
|
||||
res = FALSE;
|
||||
case GST_FORMAT_BYTES:
|
||||
if (pad == dvdec->videosrcpad)
|
||||
scale = 720 * dvdec->height * dvdec->bpp;
|
||||
else if (pad == dvdec->audiosrcpad)
|
||||
scale = dvdec->decoder->audio->num_channels * 2;
|
||||
/* fallthrough */
|
||||
case GST_FORMAT_DEFAULT:
|
||||
if (pad == dvdec->videosrcpad)
|
||||
*dest_value = src_value * dvdec->framerate * scale / GST_SECOND;
|
||||
else if (pad == dvdec->audiosrcpad)
|
||||
*dest_value =
|
||||
src_value * dvdec->decoder->audio->frequency * scale /
|
||||
GST_SECOND;
|
||||
break;
|
||||
default:
|
||||
res = FALSE;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
|
@ -442,34 +444,34 @@ gst_dvdec_sink_convert (GstPad * pad, GstFormat src_format, gint64 src_value,
|
|||
switch (src_format) {
|
||||
case GST_FORMAT_BYTES:
|
||||
switch (*dest_format) {
|
||||
case GST_FORMAT_TIME:
|
||||
{
|
||||
guint64 frame;
|
||||
case GST_FORMAT_TIME:
|
||||
{
|
||||
guint64 frame;
|
||||
|
||||
/* get frame number */
|
||||
frame = src_value / dvdec->length;
|
||||
/* get frame number */
|
||||
frame = src_value / dvdec->length;
|
||||
|
||||
*dest_value = (frame * GST_SECOND) / dvdec->framerate;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
res = FALSE;
|
||||
*dest_value = (frame * GST_SECOND) / dvdec->framerate;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
res = FALSE;
|
||||
}
|
||||
break;
|
||||
case GST_FORMAT_TIME:
|
||||
switch (*dest_format) {
|
||||
case GST_FORMAT_BYTES:
|
||||
{
|
||||
guint64 frame;
|
||||
case GST_FORMAT_BYTES:
|
||||
{
|
||||
guint64 frame;
|
||||
|
||||
/* calculate the frame */
|
||||
frame = src_value * dvdec->framerate / GST_SECOND;
|
||||
/* calculate the offset */
|
||||
*dest_value = frame * dvdec->length;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
res = FALSE;
|
||||
/* calculate the frame */
|
||||
frame = src_value * dvdec->framerate / GST_SECOND;
|
||||
/* calculate the offset */
|
||||
*dest_value = frame * dvdec->length;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
res = FALSE;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
|
@ -486,6 +488,7 @@ gst_dvdec_get_src_query_types (GstPad * pad)
|
|||
GST_QUERY_POSITION,
|
||||
0
|
||||
};
|
||||
|
||||
return src_query_types;
|
||||
}
|
||||
|
||||
|
@ -501,31 +504,31 @@ gst_dvdec_src_query (GstPad * pad, GstQueryType type,
|
|||
switch (type) {
|
||||
case GST_QUERY_TOTAL:
|
||||
switch (*format) {
|
||||
default:
|
||||
{
|
||||
guint64 len;
|
||||
GstFormat tmp_format;
|
||||
default:
|
||||
{
|
||||
guint64 len;
|
||||
GstFormat tmp_format;
|
||||
|
||||
len = gst_bytestream_length (dvdec->bs);
|
||||
tmp_format = GST_FORMAT_TIME;
|
||||
if (len == -1 || !gst_pad_convert (dvdec->sinkpad,
|
||||
GST_FORMAT_BYTES, len, &tmp_format, value)) {
|
||||
return FALSE;
|
||||
}
|
||||
if (!gst_pad_convert (pad, GST_FORMAT_TIME, *value, format, value)) {
|
||||
return FALSE;
|
||||
}
|
||||
break;
|
||||
}
|
||||
len = gst_bytestream_length (dvdec->bs);
|
||||
tmp_format = GST_FORMAT_TIME;
|
||||
if (len == -1 || !gst_pad_convert (dvdec->sinkpad,
|
||||
GST_FORMAT_BYTES, len, &tmp_format, value)) {
|
||||
return FALSE;
|
||||
}
|
||||
if (!gst_pad_convert (pad, GST_FORMAT_TIME, *value, format, value)) {
|
||||
return FALSE;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case GST_QUERY_POSITION:
|
||||
switch (*format) {
|
||||
default:
|
||||
res =
|
||||
gst_pad_convert (pad, GST_FORMAT_TIME, dvdec->next_ts, format,
|
||||
value);
|
||||
break;
|
||||
default:
|
||||
res =
|
||||
gst_pad_convert (pad, GST_FORMAT_TIME, dvdec->next_ts, format,
|
||||
value);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
|
@ -575,17 +578,17 @@ gst_dvdec_handle_sink_event (GstDVDec * dvdec)
|
|||
format = GST_FORMAT_TIME;
|
||||
/* try to get a timestamp from the discont formats */
|
||||
for (i = 0; i < GST_EVENT_DISCONT_OFFSET_LEN (event); i++) {
|
||||
if (gst_pad_convert (dvdec->sinkpad,
|
||||
GST_EVENT_DISCONT_OFFSET (event, i).format,
|
||||
GST_EVENT_DISCONT_OFFSET (event, i).value,
|
||||
&format, &dvdec->next_ts)) {
|
||||
found = TRUE;
|
||||
break;
|
||||
}
|
||||
if (gst_pad_convert (dvdec->sinkpad,
|
||||
GST_EVENT_DISCONT_OFFSET (event, i).format,
|
||||
GST_EVENT_DISCONT_OFFSET (event, i).value,
|
||||
&format, &dvdec->next_ts)) {
|
||||
found = TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
/* assume 0 then */
|
||||
if (!found) {
|
||||
dvdec->next_ts = 0LL;
|
||||
dvdec->next_ts = 0LL;
|
||||
}
|
||||
dvdec->need_discont = TRUE;
|
||||
break;
|
||||
|
@ -615,11 +618,11 @@ gst_dvdec_handle_src_event (GstPad * pad, GstEvent * event)
|
|||
/* first bring the format to time */
|
||||
format = GST_FORMAT_TIME;
|
||||
if (!gst_pad_convert (pad,
|
||||
GST_EVENT_SEEK_FORMAT (event),
|
||||
GST_EVENT_SEEK_ENDOFFSET (event), &format, &position)) {
|
||||
/* could not convert seek format to time offset */
|
||||
res = FALSE;
|
||||
break;
|
||||
GST_EVENT_SEEK_FORMAT (event),
|
||||
GST_EVENT_SEEK_ENDOFFSET (event), &format, &position)) {
|
||||
/* could not convert seek format to time offset */
|
||||
res = FALSE;
|
||||
break;
|
||||
}
|
||||
|
||||
dvdec->end_position = position;
|
||||
|
@ -633,27 +636,27 @@ gst_dvdec_handle_src_event (GstPad * pad, GstEvent * event)
|
|||
/* first bring the format to time */
|
||||
format = GST_FORMAT_TIME;
|
||||
if (!gst_pad_convert (pad,
|
||||
GST_EVENT_SEEK_FORMAT (event),
|
||||
GST_EVENT_SEEK_OFFSET (event), &format, &position)) {
|
||||
/* could not convert seek format to time offset */
|
||||
res = FALSE;
|
||||
break;
|
||||
GST_EVENT_SEEK_FORMAT (event),
|
||||
GST_EVENT_SEEK_OFFSET (event), &format, &position)) {
|
||||
/* could not convert seek format to time offset */
|
||||
res = FALSE;
|
||||
break;
|
||||
}
|
||||
dvdec->next_ts = position;
|
||||
/* then try to figure out the byteoffset for this time */
|
||||
format = GST_FORMAT_BYTES;
|
||||
if (!gst_pad_convert (dvdec->sinkpad, GST_FORMAT_TIME, position,
|
||||
&format, &position)) {
|
||||
/* could not convert seek format to byte offset */
|
||||
res = FALSE;
|
||||
break;
|
||||
&format, &position)) {
|
||||
/* could not convert seek format to byte offset */
|
||||
res = FALSE;
|
||||
break;
|
||||
}
|
||||
/* seek to offset */
|
||||
if (!gst_bytestream_seek (dvdec->bs, position, GST_SEEK_METHOD_SET)) {
|
||||
res = FALSE;
|
||||
res = FALSE;
|
||||
}
|
||||
if (GST_EVENT_TYPE (event) != GST_EVENT_SEEK_SEGMENT)
|
||||
dvdec->end_position = -1;
|
||||
dvdec->end_position = -1;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
|
@ -683,8 +686,8 @@ gst_dvdec_video_getcaps (GstPad * pad)
|
|||
GstStructure *structure = gst_caps_get_structure (caps, i);
|
||||
|
||||
gst_structure_set (structure,
|
||||
"height", G_TYPE_INT, dvdec->height,
|
||||
"framerate", G_TYPE_DOUBLE, dvdec->framerate, NULL);
|
||||
"height", G_TYPE_INT, dvdec->height,
|
||||
"framerate", G_TYPE_DOUBLE, dvdec->framerate, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -827,21 +830,21 @@ gst_dvdec_loop (GstElement * element)
|
|||
gint i, j;
|
||||
|
||||
dv_decode_full_audio (dvdec->decoder, GST_BUFFER_DATA (buf),
|
||||
dvdec->audio_buffers);
|
||||
dvdec->audio_buffers);
|
||||
|
||||
if ((dvdec->decoder->audio->frequency != dvdec->frequency) ||
|
||||
(dvdec->decoder->audio->num_channels != dvdec->channels)) {
|
||||
(dvdec->decoder->audio->num_channels != dvdec->channels)) {
|
||||
if (!gst_pad_set_explicit_caps (dvdec->audiosrcpad,
|
||||
gst_caps_new_simple ("audio/x-raw-int",
|
||||
"rate", G_TYPE_INT, dvdec->decoder->audio->frequency,
|
||||
"depth", G_TYPE_INT, 16,
|
||||
"width", G_TYPE_INT, 16,
|
||||
"signed", G_TYPE_BOOLEAN, TRUE,
|
||||
"channels", G_TYPE_INT, dvdec->decoder->audio->num_channels,
|
||||
"endianness", G_TYPE_INT, G_LITTLE_ENDIAN, NULL))) {
|
||||
gst_buffer_unref (buf);
|
||||
GST_ELEMENT_ERROR (dvdec, CORE, NEGOTIATION, (NULL), (NULL));
|
||||
return;
|
||||
gst_caps_new_simple ("audio/x-raw-int",
|
||||
"rate", G_TYPE_INT, dvdec->decoder->audio->frequency,
|
||||
"depth", G_TYPE_INT, 16,
|
||||
"width", G_TYPE_INT, 16,
|
||||
"signed", G_TYPE_BOOLEAN, TRUE,
|
||||
"channels", G_TYPE_INT, dvdec->decoder->audio->num_channels,
|
||||
"endianness", G_TYPE_INT, G_LITTLE_ENDIAN, NULL))) {
|
||||
gst_buffer_unref (buf);
|
||||
GST_ELEMENT_ERROR (dvdec, CORE, NEGOTIATION, (NULL), (NULL));
|
||||
return;
|
||||
}
|
||||
|
||||
dvdec->frequency = dvdec->decoder->audio->frequency;
|
||||
|
@ -850,14 +853,14 @@ gst_dvdec_loop (GstElement * element)
|
|||
|
||||
outbuf = gst_buffer_new ();
|
||||
GST_BUFFER_SIZE (outbuf) = dvdec->decoder->audio->samples_this_frame *
|
||||
sizeof (gint16) * dvdec->decoder->audio->num_channels;
|
||||
sizeof (gint16) * dvdec->decoder->audio->num_channels;
|
||||
GST_BUFFER_DATA (outbuf) = g_malloc (GST_BUFFER_SIZE (outbuf));
|
||||
|
||||
a_ptr = (gint16 *) GST_BUFFER_DATA (outbuf);
|
||||
|
||||
for (i = 0; i < dvdec->decoder->audio->samples_this_frame; i++) {
|
||||
for (j = 0; j < dvdec->decoder->audio->num_channels; j++) {
|
||||
*(a_ptr++) = dvdec->audio_buffers[j][i];
|
||||
*(a_ptr++) = dvdec->audio_buffers[j][i];
|
||||
}
|
||||
}
|
||||
gst_dvdec_push (dvdec, outbuf, dvdec->audiosrcpad, ts);
|
||||
|
@ -885,7 +888,7 @@ gst_dvdec_loop (GstElement * element)
|
|||
}
|
||||
|
||||
dv_decode_full_frame (dvdec->decoder, GST_BUFFER_DATA (buf),
|
||||
dvdec->space, outframe_ptrs, outframe_pitches);
|
||||
dvdec->space, outframe_ptrs, outframe_pitches);
|
||||
|
||||
gst_dvdec_push (dvdec, outbuf, dvdec->videosrcpad, ts);
|
||||
}
|
||||
|
@ -913,7 +916,7 @@ gst_dvdec_change_state (GstElement * element)
|
|||
case GST_STATE_READY_TO_PAUSED:
|
||||
dvdec->bs = gst_bytestream_new (dvdec->sinkpad);
|
||||
dvdec->decoder =
|
||||
dv_decoder_new (0, dvdec->clamp_luma, dvdec->clamp_chroma);
|
||||
dv_decoder_new (0, dvdec->clamp_luma, dvdec->clamp_chroma);
|
||||
dvdec->decoder->quality = dvdec->quality;
|
||||
break;
|
||||
case GST_STATE_PAUSED_TO_PLAYING:
|
||||
|
@ -1006,7 +1009,7 @@ plugin_init (GstPlugin * plugin)
|
|||
return FALSE;
|
||||
|
||||
if (!gst_element_register (plugin, "dvdec", GST_RANK_PRIMARY,
|
||||
gst_dvdec_get_type ()))
|
||||
gst_dvdec_get_type ()))
|
||||
return FALSE;
|
||||
|
||||
return TRUE;
|
||||
|
|
|
@ -58,16 +58,16 @@ static GstStaticPadTemplate src_factory = GST_STATIC_PAD_TEMPLATE ("src",
|
|||
GST_PAD_SRC,
|
||||
GST_PAD_ALWAYS,
|
||||
GST_STATIC_CAPS ("audio/x-raw-int, "
|
||||
"endianness = (int) " G_STRINGIFY (G_BYTE_ORDER) ", "
|
||||
"signed = (boolean) TRUE, "
|
||||
"width = (int) 16, "
|
||||
"depth = (int) 16, "
|
||||
"rate = [ 8000, 96000 ], "
|
||||
"channels = [ 1, 2 ]; "
|
||||
"audio/x-raw-int, "
|
||||
"signed = (boolean) FALSE, "
|
||||
"width = (int) 8, "
|
||||
"depth = (int) 8, " "rate = [ 8000, 96000 ], " "channels = [ 1, 2 ]")
|
||||
"endianness = (int) " G_STRINGIFY (G_BYTE_ORDER) ", "
|
||||
"signed = (boolean) TRUE, "
|
||||
"width = (int) 16, "
|
||||
"depth = (int) 16, "
|
||||
"rate = [ 8000, 96000 ], "
|
||||
"channels = [ 1, 2 ]; "
|
||||
"audio/x-raw-int, "
|
||||
"signed = (boolean) FALSE, "
|
||||
"width = (int) 8, "
|
||||
"depth = (int) 8, " "rate = [ 8000, 96000 ], " "channels = [ 1, 2 ]")
|
||||
);
|
||||
|
||||
static void gst_esdmon_base_init (gpointer g_class);
|
||||
|
@ -96,9 +96,10 @@ gst_esdmon_depths_get_type (void)
|
|||
{16, "16", "16 Bits"},
|
||||
{0, NULL, NULL},
|
||||
};
|
||||
|
||||
if (!esdmon_depths_type) {
|
||||
esdmon_depths_type =
|
||||
g_enum_register_static ("GstEsdmonDepths", esdmon_depths);
|
||||
g_enum_register_static ("GstEsdmonDepths", esdmon_depths);
|
||||
}
|
||||
return esdmon_depths_type;
|
||||
}
|
||||
|
@ -113,9 +114,10 @@ gst_esdmon_channels_get_type (void)
|
|||
{2, "2", "Stereo"},
|
||||
{0, NULL, NULL},
|
||||
};
|
||||
|
||||
if (!esdmon_channels_type) {
|
||||
esdmon_channels_type =
|
||||
g_enum_register_static ("GstEsdmonChannels", esdmon_channels);
|
||||
g_enum_register_static ("GstEsdmonChannels", esdmon_channels);
|
||||
}
|
||||
return esdmon_channels_type;
|
||||
}
|
||||
|
@ -142,8 +144,9 @@ gst_esdmon_get_type (void)
|
|||
0,
|
||||
gst_esdmon_init,
|
||||
};
|
||||
|
||||
esdmon_type =
|
||||
g_type_register_static (GST_TYPE_ELEMENT, "GstEsdmon", &esdmon_info, 0);
|
||||
g_type_register_static (GST_TYPE_ELEMENT, "GstEsdmon", &esdmon_info, 0);
|
||||
}
|
||||
return esdmon_type;
|
||||
}
|
||||
|
@ -166,12 +169,12 @@ gst_esdmon_class_init (gpointer g_class, gpointer class_data)
|
|||
|
||||
parent_class = g_type_class_peek_parent (g_class);
|
||||
|
||||
g_object_class_install_property (gobject_class, ARG_BYTESPERREAD, g_param_spec_ulong ("bytes_per_read", "bytes_per_read", "bytes_per_read", 0, G_MAXULONG, 0, G_PARAM_READWRITE)); /* CHECKME */
|
||||
g_object_class_install_property (gobject_class, ARG_CUROFFSET, g_param_spec_ulong ("curoffset", "curoffset", "curoffset", 0, G_MAXULONG, 0, G_PARAM_READABLE)); /* CHECKME */
|
||||
g_object_class_install_property (gobject_class, ARG_DEPTH, g_param_spec_enum ("depth", "depth", "depth", GST_TYPE_ESDMON_DEPTHS, 16, G_PARAM_READWRITE)); /* CHECKME! */
|
||||
g_object_class_install_property (gobject_class, ARG_CHANNELS, g_param_spec_enum ("channels", "channels", "channels", GST_TYPE_ESDMON_CHANNELS, 2, G_PARAM_READWRITE)); /* CHECKME! */
|
||||
g_object_class_install_property (gobject_class, ARG_RATE, g_param_spec_int ("frequency", "frequency", "frequency", G_MININT, G_MAXINT, 0, G_PARAM_READWRITE)); /* CHECKME */
|
||||
g_object_class_install_property (gobject_class, ARG_HOST, g_param_spec_string ("host", "host", "host", NULL, G_PARAM_READWRITE)); /* CHECKME */
|
||||
g_object_class_install_property (gobject_class, ARG_BYTESPERREAD, g_param_spec_ulong ("bytes_per_read", "bytes_per_read", "bytes_per_read", 0, G_MAXULONG, 0, G_PARAM_READWRITE)); /* CHECKME */
|
||||
g_object_class_install_property (gobject_class, ARG_CUROFFSET, g_param_spec_ulong ("curoffset", "curoffset", "curoffset", 0, G_MAXULONG, 0, G_PARAM_READABLE)); /* CHECKME */
|
||||
g_object_class_install_property (gobject_class, ARG_DEPTH, g_param_spec_enum ("depth", "depth", "depth", GST_TYPE_ESDMON_DEPTHS, 16, G_PARAM_READWRITE)); /* CHECKME! */
|
||||
g_object_class_install_property (gobject_class, ARG_CHANNELS, g_param_spec_enum ("channels", "channels", "channels", GST_TYPE_ESDMON_CHANNELS, 2, G_PARAM_READWRITE)); /* CHECKME! */
|
||||
g_object_class_install_property (gobject_class, ARG_RATE, g_param_spec_int ("frequency", "frequency", "frequency", G_MININT, G_MAXINT, 0, G_PARAM_READWRITE)); /* CHECKME */
|
||||
g_object_class_install_property (gobject_class, ARG_HOST, g_param_spec_string ("host", "host", "host", NULL, G_PARAM_READWRITE)); /* CHECKME */
|
||||
|
||||
gobject_class->set_property = gst_esdmon_set_property;
|
||||
gobject_class->get_property = gst_esdmon_get_property;
|
||||
|
@ -246,13 +249,13 @@ gst_esdmon_get (GstPad * pad)
|
|||
|
||||
/* set caps on src pad */
|
||||
if (gst_pad_set_explicit_caps (esdmon->srcpad,
|
||||
gst_caps_new_simple ("audio/x-raw-int",
|
||||
"endianness", G_TYPE_INT, G_BYTE_ORDER,
|
||||
"signed", G_TYPE_BOOLEAN, sign,
|
||||
"width", G_TYPE_INT, esdmon->depth,
|
||||
"depth", G_TYPE_INT, esdmon->depth,
|
||||
"rate", G_TYPE_INT, esdmon->frequency,
|
||||
"channels", G_TYPE_INT, esdmon->channels)) <= 0) {
|
||||
gst_caps_new_simple ("audio/x-raw-int",
|
||||
"endianness", G_TYPE_INT, G_BYTE_ORDER,
|
||||
"signed", G_TYPE_BOOLEAN, sign,
|
||||
"width", G_TYPE_INT, esdmon->depth,
|
||||
"depth", G_TYPE_INT, esdmon->depth,
|
||||
"rate", G_TYPE_INT, esdmon->frequency,
|
||||
"channels", G_TYPE_INT, esdmon->channels)) <= 0) {
|
||||
GST_ELEMENT_ERROR (esdmon, CORE, NEGOTIATION, (NULL), (NULL));
|
||||
return NULL;
|
||||
}
|
||||
|
@ -300,7 +303,7 @@ gst_esdmon_set_property (GObject * object, guint prop_id, const GValue * value,
|
|||
case ARG_RATE:
|
||||
/* Preserve the timestamps */
|
||||
esdmon->basetime =
|
||||
esdmon->samples_since_basetime * GST_SECOND / esdmon->frequency;
|
||||
esdmon->samples_since_basetime * GST_SECOND / esdmon->frequency;
|
||||
esdmon->samples_since_basetime = 0;
|
||||
|
||||
/* Set the new frequency */
|
||||
|
@ -309,11 +312,11 @@ gst_esdmon_set_property (GObject * object, guint prop_id, const GValue * value,
|
|||
break;
|
||||
case ARG_HOST:
|
||||
if (esdmon->host != NULL)
|
||||
g_free (esdmon->host);
|
||||
g_free (esdmon->host);
|
||||
if (g_value_get_string (value) == NULL)
|
||||
esdmon->host = NULL;
|
||||
esdmon->host = NULL;
|
||||
else
|
||||
esdmon->host = g_strdup (g_value_get_string (value));
|
||||
esdmon->host = g_strdup (g_value_get_string (value));
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
@ -432,7 +435,7 @@ gst_esdmon_change_state (GstElement * element)
|
|||
} else {
|
||||
if (!GST_FLAG_IS_SET (element, GST_ESDMON_OPEN)) {
|
||||
if (!gst_esdmon_open_audio (GST_ESDMON (element)))
|
||||
return GST_STATE_FAILURE;
|
||||
return GST_STATE_FAILURE;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -59,10 +59,10 @@ static GstStaticPadTemplate sink_factory = GST_STATIC_PAD_TEMPLATE ("sink",
|
|||
GST_PAD_SINK,
|
||||
GST_PAD_ALWAYS,
|
||||
GST_STATIC_CAPS ("audio/x-raw-int, "
|
||||
"endianness = (int) " G_STRINGIFY (G_BYTE_ORDER) ", "
|
||||
"signed = (boolean) TRUE, "
|
||||
"width = (int) 16, "
|
||||
"depth = (int) 16, " "rate = 44100, " "channels = 2")
|
||||
"endianness = (int) " G_STRINGIFY (G_BYTE_ORDER) ", "
|
||||
"signed = (boolean) TRUE, "
|
||||
"width = (int) 16, "
|
||||
"depth = (int) 16, " "rate = 44100, " "channels = 2")
|
||||
);
|
||||
|
||||
static void gst_esdsink_base_init (gpointer g_class);
|
||||
|
@ -104,9 +104,10 @@ gst_esdsink_get_type (void)
|
|||
0,
|
||||
gst_esdsink_init,
|
||||
};
|
||||
|
||||
esdsink_type =
|
||||
g_type_register_static (GST_TYPE_ELEMENT, "GstEsdsink", &esdsink_info,
|
||||
0);
|
||||
g_type_register_static (GST_TYPE_ELEMENT, "GstEsdsink", &esdsink_info,
|
||||
0);
|
||||
}
|
||||
return esdsink_type;
|
||||
}
|
||||
|
@ -129,17 +130,17 @@ gst_esdsink_class_init (gpointer g_class, gpointer class_data)
|
|||
|
||||
parent_class = g_type_class_peek_parent (g_class);
|
||||
|
||||
g_object_class_install_property (gobject_class, ARG_MUTE, g_param_spec_boolean ("mute", "mute", "mute", TRUE, G_PARAM_READWRITE)); /* CHECKME */
|
||||
g_object_class_install_property (gobject_class, ARG_HOST, g_param_spec_string ("host", "host", "host", NULL, G_PARAM_READWRITE)); /* CHECKME */
|
||||
g_object_class_install_property (gobject_class, ARG_MUTE, g_param_spec_boolean ("mute", "mute", "mute", TRUE, G_PARAM_READWRITE)); /* CHECKME */
|
||||
g_object_class_install_property (gobject_class, ARG_HOST, g_param_spec_string ("host", "host", "host", NULL, G_PARAM_READWRITE)); /* CHECKME */
|
||||
g_object_class_install_property (gobject_class, ARG_SYNC,
|
||||
g_param_spec_boolean ("sync", "sync", "Synchronize output to clock",
|
||||
TRUE, G_PARAM_READWRITE));
|
||||
TRUE, G_PARAM_READWRITE));
|
||||
#if 0
|
||||
/* This option is disabled because it is dumb in GStreamer's architecture. */
|
||||
g_object_class_install_property (gobject_class, ARG_FALLBACK,
|
||||
g_param_spec_boolean ("fallback", "fallback",
|
||||
"Fall back to using OSS if Esound daemon is not present", FALSE,
|
||||
G_PARAM_READWRITE));
|
||||
"Fall back to using OSS if Esound daemon is not present", FALSE,
|
||||
G_PARAM_READWRITE));
|
||||
#endif
|
||||
|
||||
gobject_class->set_property = gst_esdsink_set_property;
|
||||
|
@ -255,7 +256,7 @@ gst_esdsink_chain (GstPad * pad, GstData * _data)
|
|||
|
||||
if (!esdsink->negotiated) {
|
||||
GST_ELEMENT_ERROR (esdsink, CORE, NEGOTIATION, (NULL),
|
||||
("element wasn't negotiated before chain function"));
|
||||
("element wasn't negotiated before chain function"));
|
||||
goto done;
|
||||
}
|
||||
|
||||
|
@ -264,13 +265,13 @@ gst_esdsink_chain (GstPad * pad, GstData * _data)
|
|||
|
||||
switch (GST_EVENT_TYPE (event)) {
|
||||
case GST_EVENT_EOS:
|
||||
gst_audio_clock_set_active (GST_AUDIO_CLOCK (esdsink->provided_clock),
|
||||
FALSE);
|
||||
gst_pad_event_default (pad, event);
|
||||
return;
|
||||
gst_audio_clock_set_active (GST_AUDIO_CLOCK (esdsink->provided_clock),
|
||||
FALSE);
|
||||
gst_pad_event_default (pad, event);
|
||||
return;
|
||||
default:
|
||||
gst_pad_event_default (pad, event);
|
||||
return;
|
||||
gst_pad_event_default (pad, event);
|
||||
return;
|
||||
}
|
||||
gst_event_unref (event);
|
||||
return;
|
||||
|
@ -285,22 +286,22 @@ gst_esdsink_chain (GstPad * pad, GstData * _data)
|
|||
to_write = size;
|
||||
|
||||
GST_LOG ("fd=%d data=%p size=%d",
|
||||
esdsink->fd, GST_BUFFER_DATA (buf), GST_BUFFER_SIZE (buf));
|
||||
esdsink->fd, GST_BUFFER_DATA (buf), GST_BUFFER_SIZE (buf));
|
||||
while (to_write > 0) {
|
||||
int done;
|
||||
int done;
|
||||
|
||||
done = write (esdsink->fd, data, to_write);
|
||||
done = write (esdsink->fd, data, to_write);
|
||||
|
||||
if (done < 0) {
|
||||
if (errno == EINTR) {
|
||||
goto done;
|
||||
}
|
||||
g_assert_not_reached ();
|
||||
}
|
||||
if (done < 0) {
|
||||
if (errno == EINTR) {
|
||||
goto done;
|
||||
}
|
||||
g_assert_not_reached ();
|
||||
}
|
||||
|
||||
to_write -= done;
|
||||
data += done;
|
||||
esdsink->handled += done / esdsink->bytes_per_sample;
|
||||
to_write -= done;
|
||||
data += done;
|
||||
esdsink->handled += done / esdsink->bytes_per_sample;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -330,9 +331,9 @@ gst_esdsink_set_property (GObject * object, guint prop_id, const GValue * value,
|
|||
case ARG_HOST:
|
||||
g_free (esdsink->host);
|
||||
if (g_value_get_string (value) == NULL)
|
||||
esdsink->host = NULL;
|
||||
esdsink->host = NULL;
|
||||
else
|
||||
esdsink->host = g_strdup (g_value_get_string (value));
|
||||
esdsink->host = g_strdup (g_value_get_string (value));
|
||||
break;
|
||||
case ARG_SYNC:
|
||||
esdsink->sync = g_value_get_boolean (value);
|
||||
|
@ -376,7 +377,7 @@ gboolean
|
|||
gst_esdsink_factory_init (GstPlugin * plugin)
|
||||
{
|
||||
if (!gst_element_register (plugin, "esdsink", GST_RANK_NONE,
|
||||
GST_TYPE_ESDSINK))
|
||||
GST_TYPE_ESDSINK))
|
||||
return FALSE;
|
||||
|
||||
return TRUE;
|
||||
|
@ -399,7 +400,7 @@ gst_esdsink_open_audio (GstEsdsink * sink)
|
|||
esdformat |= ESD_BITS8;
|
||||
else {
|
||||
GST_ELEMENT_ERROR (sink, STREAM, FORMAT, (NULL),
|
||||
("invalid bit depth (%d)", sink->depth));
|
||||
("invalid bit depth (%d)", sink->depth));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -409,22 +410,22 @@ gst_esdsink_open_audio (GstEsdsink * sink)
|
|||
esdformat |= ESD_MONO;
|
||||
else {
|
||||
GST_ELEMENT_ERROR (sink, STREAM, FORMAT, (NULL),
|
||||
("invalid number of channels (%d)", sink->channels));
|
||||
("invalid number of channels (%d)", sink->channels));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
GST_INFO ("attempting to open connection to esound server");
|
||||
if (sink->fallback) {
|
||||
sink->fd =
|
||||
esd_play_stream_fallback (esdformat, sink->frequency, sink->host,
|
||||
connname);
|
||||
esd_play_stream_fallback (esdformat, sink->frequency, sink->host,
|
||||
connname);
|
||||
} else {
|
||||
sink->fd =
|
||||
esd_play_stream (esdformat, sink->frequency, sink->host, connname);
|
||||
esd_play_stream (esdformat, sink->frequency, sink->host, connname);
|
||||
}
|
||||
if (sink->fd < 0) {
|
||||
GST_ELEMENT_ERROR (sink, RESOURCE, OPEN_WRITE, (NULL),
|
||||
("can't open connection to esound server"));
|
||||
("can't open connection to esound server"));
|
||||
return FALSE;
|
||||
}
|
||||
GST_INFO ("successfully opened connection to esound server");
|
||||
|
@ -454,18 +455,18 @@ gst_esdsink_change_state (GstElement * element)
|
|||
switch (GST_STATE_TRANSITION (element)) {
|
||||
case GST_STATE_NULL_TO_READY:
|
||||
if (!gst_esdsink_open_audio (GST_ESDSINK (element))) {
|
||||
return GST_STATE_FAILURE;
|
||||
return GST_STATE_FAILURE;
|
||||
}
|
||||
break;
|
||||
case GST_STATE_READY_TO_PAUSED:
|
||||
break;
|
||||
case GST_STATE_PAUSED_TO_PLAYING:
|
||||
gst_audio_clock_set_active (GST_AUDIO_CLOCK (esdsink->provided_clock),
|
||||
TRUE);
|
||||
TRUE);
|
||||
break;
|
||||
case GST_STATE_PLAYING_TO_PAUSED:
|
||||
gst_audio_clock_set_active (GST_AUDIO_CLOCK (esdsink->provided_clock),
|
||||
FALSE);
|
||||
FALSE);
|
||||
esdsink->resync = TRUE;
|
||||
break;
|
||||
case GST_STATE_PAUSED_TO_READY:
|
||||
|
|
|
@ -38,15 +38,15 @@ plugin_init (GstPlugin * plugin)
|
|||
return FALSE;
|
||||
|
||||
if (!gst_element_register (plugin, "flacenc", GST_RANK_NONE,
|
||||
GST_TYPE_FLACENC))
|
||||
GST_TYPE_FLACENC))
|
||||
return FALSE;
|
||||
|
||||
if (!gst_element_register (plugin, "flacdec", GST_RANK_PRIMARY,
|
||||
GST_TYPE_FLACDEC))
|
||||
GST_TYPE_FLACDEC))
|
||||
return FALSE;
|
||||
|
||||
if (!gst_element_register (plugin, "flactag", GST_RANK_PRIMARY,
|
||||
gst_flac_tag_get_type ()))
|
||||
gst_flac_tag_get_type ()))
|
||||
return FALSE;
|
||||
|
||||
return TRUE;
|
||||
|
|
|
@ -112,8 +112,9 @@ flacdec_get_type (void)
|
|||
0,
|
||||
(GInstanceInitFunc) gst_flacdec_init,
|
||||
};
|
||||
|
||||
flacdec_type =
|
||||
g_type_register_static (GST_TYPE_ELEMENT, "FlacDec", &flacdec_info, 0);
|
||||
g_type_register_static (GST_TYPE_ELEMENT, "FlacDec", &flacdec_info, 0);
|
||||
}
|
||||
return flacdec_type;
|
||||
}
|
||||
|
@ -212,9 +213,9 @@ gst_flacdec_init (FlacDec * flacdec)
|
|||
#else
|
||||
FLAC__seekable_stream_decoder_set_write_callback (flacdec->decoder,
|
||||
(FLAC__StreamDecoderWriteStatus (*)
|
||||
(const FLAC__SeekableStreamDecoder * decoder,
|
||||
const FLAC__Frame * frame,
|
||||
const FLAC__int32 * buffer[], void *client_data))
|
||||
(const FLAC__SeekableStreamDecoder * decoder,
|
||||
const FLAC__Frame * frame,
|
||||
const FLAC__int32 * buffer[], void *client_data))
|
||||
(gst_flacdec_write));
|
||||
#endif
|
||||
FLAC__seekable_stream_decoder_set_metadata_respond (flacdec->decoder,
|
||||
|
@ -394,29 +395,29 @@ gst_flacdec_read (const FLAC__SeekableStreamDecoder * decoder,
|
|||
gst_bytestream_get_status (flacdec->bs, &avail, &event);
|
||||
|
||||
switch (GST_EVENT_TYPE (event)) {
|
||||
case GST_EVENT_EOS:
|
||||
GST_DEBUG ("eos");
|
||||
flacdec->eos = TRUE;
|
||||
gst_event_unref (event);
|
||||
if (avail == 0) {
|
||||
return 0;
|
||||
}
|
||||
break;
|
||||
case GST_EVENT_DISCONTINUOUS:
|
||||
GST_DEBUG ("discont");
|
||||
case GST_EVENT_EOS:
|
||||
GST_DEBUG ("eos");
|
||||
flacdec->eos = TRUE;
|
||||
gst_event_unref (event);
|
||||
if (avail == 0) {
|
||||
return 0;
|
||||
}
|
||||
break;
|
||||
case GST_EVENT_DISCONTINUOUS:
|
||||
GST_DEBUG ("discont");
|
||||
|
||||
/* we are not yet sending the discont, we'll do that in the next write operation */
|
||||
flacdec->need_discont = TRUE;
|
||||
gst_event_unref (event);
|
||||
break;
|
||||
default:
|
||||
gst_pad_event_default (flacdec->sinkpad, event);
|
||||
break;
|
||||
/* we are not yet sending the discont, we'll do that in the next write operation */
|
||||
flacdec->need_discont = TRUE;
|
||||
gst_event_unref (event);
|
||||
break;
|
||||
default:
|
||||
gst_pad_event_default (flacdec->sinkpad, event);
|
||||
break;
|
||||
}
|
||||
if (avail > 0)
|
||||
insize = gst_bytestream_peek_bytes (flacdec->bs, &indata, avail);
|
||||
insize = gst_bytestream_peek_bytes (flacdec->bs, &indata, avail);
|
||||
else
|
||||
insize = 0;
|
||||
insize = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -450,36 +451,36 @@ gst_flacdec_write (const FLAC__SeekableStreamDecoder * decoder,
|
|||
|
||||
if (!GST_PAD_CAPS (flacdec->srcpad)) {
|
||||
if (flacdec->seek_pending) {
|
||||
flacdec->total_samples = flacdec->seek_value;
|
||||
flacdec->total_samples = flacdec->seek_value;
|
||||
}
|
||||
|
||||
if (GST_PAD_IS_USABLE (flacdec->srcpad)) {
|
||||
GST_DEBUG ("send discont");
|
||||
GST_DEBUG ("send discont");
|
||||
|
||||
format = GST_FORMAT_TIME;
|
||||
gst_pad_convert (flacdec->srcpad, GST_FORMAT_DEFAULT,
|
||||
flacdec->total_samples, &format, &time);
|
||||
format = GST_FORMAT_BYTES;
|
||||
gst_pad_convert (flacdec->srcpad, GST_FORMAT_DEFAULT,
|
||||
flacdec->total_samples, &format, &bytes);
|
||||
discont = gst_event_new_discontinuous (FALSE, GST_FORMAT_TIME, time,
|
||||
GST_FORMAT_BYTES, bytes,
|
||||
GST_FORMAT_DEFAULT, flacdec->total_samples, NULL);
|
||||
format = GST_FORMAT_TIME;
|
||||
gst_pad_convert (flacdec->srcpad, GST_FORMAT_DEFAULT,
|
||||
flacdec->total_samples, &format, &time);
|
||||
format = GST_FORMAT_BYTES;
|
||||
gst_pad_convert (flacdec->srcpad, GST_FORMAT_DEFAULT,
|
||||
flacdec->total_samples, &format, &bytes);
|
||||
discont = gst_event_new_discontinuous (FALSE, GST_FORMAT_TIME, time,
|
||||
GST_FORMAT_BYTES, bytes,
|
||||
GST_FORMAT_DEFAULT, flacdec->total_samples, NULL);
|
||||
|
||||
gst_pad_push (flacdec->srcpad, GST_DATA (discont));
|
||||
gst_pad_push (flacdec->srcpad, GST_DATA (discont));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!GST_PAD_CAPS (flacdec->srcpad)) {
|
||||
gst_pad_set_explicit_caps (flacdec->srcpad,
|
||||
gst_caps_new_simple ("audio/x-raw-int",
|
||||
"endianness", G_TYPE_INT, G_BYTE_ORDER,
|
||||
"signed", G_TYPE_BOOLEAN, TRUE,
|
||||
"width", G_TYPE_INT, depth,
|
||||
"depth", G_TYPE_INT, depth,
|
||||
"rate", G_TYPE_INT, frame->header.sample_rate,
|
||||
"channels", G_TYPE_INT, channels, NULL));
|
||||
gst_caps_new_simple ("audio/x-raw-int",
|
||||
"endianness", G_TYPE_INT, G_BYTE_ORDER,
|
||||
"signed", G_TYPE_BOOLEAN, TRUE,
|
||||
"width", G_TYPE_INT, depth,
|
||||
"depth", G_TYPE_INT, depth,
|
||||
"rate", G_TYPE_INT, frame->header.sample_rate,
|
||||
"channels", G_TYPE_INT, channels, NULL));
|
||||
|
||||
flacdec->depth = depth;
|
||||
flacdec->channels = channels;
|
||||
|
@ -491,23 +492,23 @@ gst_flacdec_write (const FLAC__SeekableStreamDecoder * decoder,
|
|||
GST_BUFFER_SIZE (outbuf) = samples * channels * ((depth + 7) >> 3);
|
||||
GST_BUFFER_DATA (outbuf) = g_malloc (GST_BUFFER_SIZE (outbuf));
|
||||
GST_BUFFER_TIMESTAMP (outbuf) =
|
||||
flacdec->total_samples * GST_SECOND / frame->header.sample_rate;
|
||||
flacdec->total_samples * GST_SECOND / frame->header.sample_rate;
|
||||
|
||||
if (depth == 8) {
|
||||
guint8 *outbuffer = (guint8 *) GST_BUFFER_DATA (outbuf);
|
||||
|
||||
for (i = 0; i < samples; i++) {
|
||||
for (j = 0; j < channels; j++) {
|
||||
*outbuffer++ = (guint8) buffer[j][i];
|
||||
}
|
||||
for (j = 0; j < channels; j++) {
|
||||
*outbuffer++ = (guint8) buffer[j][i];
|
||||
}
|
||||
}
|
||||
} else if (depth == 16) {
|
||||
guint16 *outbuffer = (guint16 *) GST_BUFFER_DATA (outbuf);
|
||||
|
||||
for (i = 0; i < samples; i++) {
|
||||
for (j = 0; j < channels; j++) {
|
||||
*outbuffer++ = (guint16) buffer[j][i];
|
||||
}
|
||||
for (j = 0; j < channels; j++) {
|
||||
*outbuffer++ = (guint16) buffer[j][i];
|
||||
}
|
||||
}
|
||||
} else {
|
||||
g_warning ("flacdec: invalid depth %d found\n", depth);
|
||||
|
@ -536,7 +537,7 @@ gst_flacdec_loop (GstElement * element)
|
|||
res = FLAC__seekable_stream_decoder_init (flacdec->decoder);
|
||||
if (res != FLAC__SEEKABLE_STREAM_DECODER_OK) {
|
||||
GST_ELEMENT_ERROR (flacdec, LIBRARY, INIT, (NULL),
|
||||
(FLAC__SeekableStreamDecoderStateString[res]));
|
||||
(FLAC__SeekableStreamDecoderStateString[res]));
|
||||
return;
|
||||
}
|
||||
/* FLAC__seekable_stream_decoder_process_metadata (flacdec->decoder); */
|
||||
|
@ -547,7 +548,7 @@ gst_flacdec_loop (GstElement * element)
|
|||
GST_DEBUG ("perform seek to sample %" G_GINT64_FORMAT, flacdec->seek_value);
|
||||
|
||||
if (FLAC__seekable_stream_decoder_seek_absolute (flacdec->decoder,
|
||||
flacdec->seek_value)) {
|
||||
flacdec->seek_value)) {
|
||||
flacdec->total_samples = flacdec->seek_value;
|
||||
GST_DEBUG ("seek done");
|
||||
} else {
|
||||
|
@ -585,6 +586,7 @@ gst_flacdec_get_src_formats (GstPad * pad)
|
|||
GST_FORMAT_TIME,
|
||||
0,
|
||||
};
|
||||
|
||||
return formats;
|
||||
}
|
||||
|
||||
|
@ -602,47 +604,47 @@ gst_flacdec_convert_src (GstPad * pad, GstFormat src_format, gint64 src_value,
|
|||
switch (src_format) {
|
||||
case GST_FORMAT_BYTES:
|
||||
switch (*dest_format) {
|
||||
case GST_FORMAT_DEFAULT:
|
||||
if (bytes_per_sample == 0)
|
||||
return FALSE;
|
||||
*dest_value = src_value / bytes_per_sample;
|
||||
break;
|
||||
case GST_FORMAT_TIME:
|
||||
{
|
||||
gint byterate = bytes_per_sample * flacdec->frequency;
|
||||
case GST_FORMAT_DEFAULT:
|
||||
if (bytes_per_sample == 0)
|
||||
return FALSE;
|
||||
*dest_value = src_value / bytes_per_sample;
|
||||
break;
|
||||
case GST_FORMAT_TIME:
|
||||
{
|
||||
gint byterate = bytes_per_sample * flacdec->frequency;
|
||||
|
||||
if (byterate == 0)
|
||||
return FALSE;
|
||||
*dest_value = src_value * GST_SECOND / byterate;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
res = FALSE;
|
||||
if (byterate == 0)
|
||||
return FALSE;
|
||||
*dest_value = src_value * GST_SECOND / byterate;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
res = FALSE;
|
||||
}
|
||||
break;
|
||||
case GST_FORMAT_DEFAULT:
|
||||
switch (*dest_format) {
|
||||
case GST_FORMAT_BYTES:
|
||||
*dest_value = src_value * bytes_per_sample;
|
||||
break;
|
||||
case GST_FORMAT_TIME:
|
||||
if (flacdec->frequency == 0)
|
||||
return FALSE;
|
||||
*dest_value = src_value * GST_SECOND / flacdec->frequency;
|
||||
break;
|
||||
default:
|
||||
res = FALSE;
|
||||
case GST_FORMAT_BYTES:
|
||||
*dest_value = src_value * bytes_per_sample;
|
||||
break;
|
||||
case GST_FORMAT_TIME:
|
||||
if (flacdec->frequency == 0)
|
||||
return FALSE;
|
||||
*dest_value = src_value * GST_SECOND / flacdec->frequency;
|
||||
break;
|
||||
default:
|
||||
res = FALSE;
|
||||
}
|
||||
break;
|
||||
case GST_FORMAT_TIME:
|
||||
switch (*dest_format) {
|
||||
case GST_FORMAT_BYTES:
|
||||
scale = bytes_per_sample;
|
||||
case GST_FORMAT_DEFAULT:
|
||||
*dest_value = src_value * scale * flacdec->frequency / GST_SECOND;
|
||||
break;
|
||||
default:
|
||||
res = FALSE;
|
||||
case GST_FORMAT_BYTES:
|
||||
scale = bytes_per_sample;
|
||||
case GST_FORMAT_DEFAULT:
|
||||
*dest_value = src_value * scale * flacdec->frequency / GST_SECOND;
|
||||
break;
|
||||
default:
|
||||
res = FALSE;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
|
@ -659,6 +661,7 @@ gst_flacdec_get_src_query_types (GstPad * pad)
|
|||
GST_QUERY_POSITION,
|
||||
0,
|
||||
};
|
||||
|
||||
return types;
|
||||
}
|
||||
|
||||
|
@ -675,17 +678,17 @@ gst_flacdec_src_query (GstPad * pad, GstQueryType type,
|
|||
guint64 samples;
|
||||
|
||||
if (flacdec->stream_samples == 0)
|
||||
samples = flacdec->total_samples;
|
||||
samples = flacdec->total_samples;
|
||||
else
|
||||
samples = flacdec->stream_samples;
|
||||
samples = flacdec->stream_samples;
|
||||
|
||||
gst_pad_convert (flacdec->srcpad,
|
||||
GST_FORMAT_DEFAULT, samples, format, value);
|
||||
GST_FORMAT_DEFAULT, samples, format, value);
|
||||
break;
|
||||
}
|
||||
case GST_QUERY_POSITION:
|
||||
gst_pad_convert (flacdec->srcpad,
|
||||
GST_FORMAT_DEFAULT, flacdec->total_samples, format, value);
|
||||
GST_FORMAT_DEFAULT, flacdec->total_samples, format, value);
|
||||
break;
|
||||
default:
|
||||
res = FALSE;
|
||||
|
@ -702,6 +705,7 @@ gst_flacdec_get_src_event_masks (GstPad * pad)
|
|||
{GST_EVENT_SEEK, GST_SEEK_FLAG_ACCURATE},
|
||||
{0, 0},
|
||||
};
|
||||
|
||||
return masks;
|
||||
}
|
||||
|
||||
|
@ -717,11 +721,11 @@ gst_flacdec_src_event (GstPad * pad, GstEvent * event)
|
|||
format = GST_FORMAT_DEFAULT;
|
||||
|
||||
if (gst_pad_convert (flacdec->srcpad,
|
||||
GST_EVENT_SEEK_FORMAT (event),
|
||||
GST_EVENT_SEEK_OFFSET (event), &format, &flacdec->seek_value))
|
||||
flacdec->seek_pending = TRUE;
|
||||
GST_EVENT_SEEK_FORMAT (event),
|
||||
GST_EVENT_SEEK_OFFSET (event), &format, &flacdec->seek_value))
|
||||
flacdec->seek_pending = TRUE;
|
||||
else
|
||||
res = FALSE;
|
||||
res = FALSE;
|
||||
break;
|
||||
default:
|
||||
res = FALSE;
|
||||
|
@ -744,7 +748,7 @@ gst_flacdec_change_state (GstElement * element)
|
|||
flacdec->total_samples = 0;
|
||||
flacdec->eos = FALSE;
|
||||
if (flacdec->init == FALSE) {
|
||||
FLAC__seekable_stream_decoder_reset (flacdec->decoder);
|
||||
FLAC__seekable_stream_decoder_reset (flacdec->decoder);
|
||||
}
|
||||
break;
|
||||
case GST_STATE_PAUSED_TO_PLAYING:
|
||||
|
|
|
@ -117,9 +117,9 @@ flacenc_get_type (void)
|
|||
};
|
||||
|
||||
flacenc_type =
|
||||
g_type_register_static (GST_TYPE_ELEMENT, "FlacEnc", &flacenc_info, 0);
|
||||
g_type_register_static (GST_TYPE_ELEMENT, "FlacEnc", &flacenc_info, 0);
|
||||
g_type_add_interface_static (flacenc_type, GST_TYPE_TAG_SETTER,
|
||||
&tag_setter_info);
|
||||
&tag_setter_info);
|
||||
}
|
||||
return flacenc_type;
|
||||
}
|
||||
|
@ -137,7 +137,8 @@ typedef struct
|
|||
guint rice_parameter_search_dist;
|
||||
guint max_lpc_order;
|
||||
guint blocksize;
|
||||
} FlacEncParams;
|
||||
}
|
||||
FlacEncParams;
|
||||
|
||||
static const FlacEncParams flacenc_params[] = {
|
||||
{FALSE, FALSE, FALSE, FALSE, 0, FALSE, 2, 2, 0, 0, 1152},
|
||||
|
@ -174,6 +175,7 @@ gst_flacenc_quality_get_type (void)
|
|||
{9, "9", "9 - Insane"},
|
||||
{0, NULL, NULL}
|
||||
};
|
||||
|
||||
qtype = g_enum_register_static ("FlacEncQuality", values);
|
||||
}
|
||||
return qtype;
|
||||
|
@ -235,78 +237,78 @@ gst_flacenc_class_init (FlacEncClass * klass)
|
|||
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_QUALITY,
|
||||
g_param_spec_enum ("quality",
|
||||
"Quality",
|
||||
"Speed versus compression tradeoff",
|
||||
GST_TYPE_FLACENC_QUALITY, DEFAULT_QUALITY, G_PARAM_READWRITE));
|
||||
"Quality",
|
||||
"Speed versus compression tradeoff",
|
||||
GST_TYPE_FLACENC_QUALITY, DEFAULT_QUALITY, G_PARAM_READWRITE));
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass),
|
||||
ARG_STREAMABLE_SUBSET, g_param_spec_boolean ("streamable_subset",
|
||||
"Streamable subset",
|
||||
"true to limit encoder to generating a Subset stream, else false",
|
||||
TRUE, G_PARAM_READWRITE));
|
||||
"Streamable subset",
|
||||
"true to limit encoder to generating a Subset stream, else false",
|
||||
TRUE, G_PARAM_READWRITE));
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_MID_SIDE_STEREO,
|
||||
g_param_spec_boolean ("mid_side_stereo", "Do mid side stereo",
|
||||
"Do mid side stereo (only for stereo input)",
|
||||
flacenc_params[DEFAULT_QUALITY].mid_side, G_PARAM_READWRITE));
|
||||
"Do mid side stereo (only for stereo input)",
|
||||
flacenc_params[DEFAULT_QUALITY].mid_side, G_PARAM_READWRITE));
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass),
|
||||
ARG_LOOSE_MID_SIDE_STEREO, g_param_spec_boolean ("loose_mid_side_stereo",
|
||||
"Loose mid side stereo", "Loose mid side stereo",
|
||||
flacenc_params[DEFAULT_QUALITY].loose_mid_side, G_PARAM_READWRITE));
|
||||
"Loose mid side stereo", "Loose mid side stereo",
|
||||
flacenc_params[DEFAULT_QUALITY].loose_mid_side, G_PARAM_READWRITE));
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_BLOCKSIZE,
|
||||
g_param_spec_uint ("blocksize", "Blocksize", "Blocksize in samples",
|
||||
FLAC__MIN_BLOCK_SIZE, FLAC__MAX_BLOCK_SIZE,
|
||||
flacenc_params[DEFAULT_QUALITY].blocksize, G_PARAM_READWRITE));
|
||||
FLAC__MIN_BLOCK_SIZE, FLAC__MAX_BLOCK_SIZE,
|
||||
flacenc_params[DEFAULT_QUALITY].blocksize, G_PARAM_READWRITE));
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_MAX_LPC_ORDER,
|
||||
g_param_spec_uint ("max_lpc_order", "Max LPC order",
|
||||
"Max LPC order; 0 => use only fixed predictors", 0,
|
||||
FLAC__MAX_LPC_ORDER, flacenc_params[DEFAULT_QUALITY].max_lpc_order,
|
||||
G_PARAM_READWRITE));
|
||||
"Max LPC order; 0 => use only fixed predictors", 0,
|
||||
FLAC__MAX_LPC_ORDER, flacenc_params[DEFAULT_QUALITY].max_lpc_order,
|
||||
G_PARAM_READWRITE));
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass),
|
||||
ARG_QLP_COEFF_PRECISION, g_param_spec_uint ("qlp_coeff_precision",
|
||||
"QLP coefficients precision",
|
||||
"Precision in bits of quantized linear-predictor coefficients; 0 = automatic",
|
||||
0, 32, flacenc_params[DEFAULT_QUALITY].qlp_coeff_precision,
|
||||
G_PARAM_READWRITE));
|
||||
"QLP coefficients precision",
|
||||
"Precision in bits of quantized linear-predictor coefficients; 0 = automatic",
|
||||
0, 32, flacenc_params[DEFAULT_QUALITY].qlp_coeff_precision,
|
||||
G_PARAM_READWRITE));
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass),
|
||||
ARG_QLP_COEFF_PREC_SEARCH, g_param_spec_boolean ("qlp_coeff_prec_search",
|
||||
"Do QLP coefficients precision search",
|
||||
"false = use qlp_coeff_precision, "
|
||||
"true = search around qlp_coeff_precision, take best",
|
||||
flacenc_params[DEFAULT_QUALITY].qlp_coeff_prec_search,
|
||||
G_PARAM_READWRITE));
|
||||
"Do QLP coefficients precision search",
|
||||
"false = use qlp_coeff_precision, "
|
||||
"true = search around qlp_coeff_precision, take best",
|
||||
flacenc_params[DEFAULT_QUALITY].qlp_coeff_prec_search,
|
||||
G_PARAM_READWRITE));
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_ESCAPE_CODING,
|
||||
g_param_spec_boolean ("escape_coding", "Do Escape coding",
|
||||
"search for escape codes in the entropy coding stage "
|
||||
"for slightly better compression",
|
||||
flacenc_params[DEFAULT_QUALITY].escape_coding, G_PARAM_READWRITE));
|
||||
"search for escape codes in the entropy coding stage "
|
||||
"for slightly better compression",
|
||||
flacenc_params[DEFAULT_QUALITY].escape_coding, G_PARAM_READWRITE));
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass),
|
||||
ARG_EXHAUSTIVE_MODEL_SEARCH,
|
||||
g_param_spec_boolean ("exhaustive_model_search",
|
||||
"Do exhaustive model search",
|
||||
"do exhaustive search of LP coefficient quantization (expensive!)",
|
||||
flacenc_params[DEFAULT_QUALITY].exhaustive_model_search,
|
||||
G_PARAM_READWRITE));
|
||||
"Do exhaustive model search",
|
||||
"do exhaustive search of LP coefficient quantization (expensive!)",
|
||||
flacenc_params[DEFAULT_QUALITY].exhaustive_model_search,
|
||||
G_PARAM_READWRITE));
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass),
|
||||
ARG_MIN_RESIDUAL_PARTITION_ORDER,
|
||||
g_param_spec_uint ("min_residual_partition_order",
|
||||
"Min residual partition order",
|
||||
"Min residual partition order (above 4 doesn't usually help much)", 0,
|
||||
16, flacenc_params[DEFAULT_QUALITY].min_residual_partition_order,
|
||||
G_PARAM_READWRITE));
|
||||
"Min residual partition order",
|
||||
"Min residual partition order (above 4 doesn't usually help much)", 0,
|
||||
16, flacenc_params[DEFAULT_QUALITY].min_residual_partition_order,
|
||||
G_PARAM_READWRITE));
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass),
|
||||
ARG_MAX_RESIDUAL_PARTITION_ORDER,
|
||||
g_param_spec_uint ("max_residual_partition_order",
|
||||
"Max residual partition order",
|
||||
"Max residual partition order (above 4 doesn't usually help much)", 0,
|
||||
16, flacenc_params[DEFAULT_QUALITY].max_residual_partition_order,
|
||||
G_PARAM_READWRITE));
|
||||
"Max residual partition order",
|
||||
"Max residual partition order (above 4 doesn't usually help much)", 0,
|
||||
16, flacenc_params[DEFAULT_QUALITY].max_residual_partition_order,
|
||||
G_PARAM_READWRITE));
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass),
|
||||
ARG_RICE_PARAMETER_SEARCH_DIST,
|
||||
g_param_spec_uint ("rice_parameter_search_dist",
|
||||
"rice_parameter_search_dist",
|
||||
"0 = try only calc'd parameter k; else try all [k-dist..k+dist] "
|
||||
"parameters, use best", 0, FLAC__MAX_RICE_PARTITION_ORDER,
|
||||
flacenc_params[DEFAULT_QUALITY].rice_parameter_search_dist,
|
||||
G_PARAM_READWRITE));
|
||||
"rice_parameter_search_dist",
|
||||
"0 = try only calc'd parameter k; else try all [k-dist..k+dist] "
|
||||
"parameters, use best", 0, FLAC__MAX_RICE_PARTITION_ORDER,
|
||||
flacenc_params[DEFAULT_QUALITY].rice_parameter_search_dist,
|
||||
G_PARAM_READWRITE));
|
||||
|
||||
gstelement_class->change_state = gst_flacenc_change_state;
|
||||
}
|
||||
|
@ -434,7 +436,7 @@ gst_flacenc_seek_callback (const FLAC__SeekableStreamEncoder * encoder,
|
|||
|
||||
event =
|
||||
gst_event_new_seek ((GstSeekType) (int) (GST_FORMAT_BYTES |
|
||||
GST_SEEK_METHOD_SET), absolute_byte_offset);
|
||||
GST_SEEK_METHOD_SET), absolute_byte_offset);
|
||||
|
||||
if (event)
|
||||
gst_pad_push (flacenc->srcpad, GST_DATA (event));
|
||||
|
@ -484,8 +486,8 @@ add_one_tag (const GstTagList * list, const gchar * tag, gpointer user_data)
|
|||
commment_entry.length = strlen (it->data);
|
||||
commment_entry.entry = it->data;
|
||||
FLAC__metadata_object_vorbiscomment_insert_comment (flacenc->meta[0],
|
||||
flacenc->meta[0]->data.vorbis_comment.num_comments,
|
||||
commment_entry, TRUE);
|
||||
flacenc->meta[0]->data.vorbis_comment.num_comments,
|
||||
commment_entry, TRUE);
|
||||
g_free (it->data);
|
||||
}
|
||||
g_list_free (comments);
|
||||
|
@ -511,7 +513,7 @@ gst_flacenc_set_metadata (FlacEnc * flacenc)
|
|||
gst_tag_list_foreach (copy, add_one_tag, flacenc);
|
||||
|
||||
if (FLAC__seekable_stream_encoder_set_metadata (flacenc->encoder,
|
||||
flacenc->meta, 1) != true)
|
||||
flacenc->meta, 1) != true)
|
||||
g_warning ("Dude, i'm already initialized!");
|
||||
gst_tag_list_free (copy);
|
||||
}
|
||||
|
@ -537,18 +539,18 @@ gst_flacenc_chain (GstPad * pad, GstData * _data)
|
|||
|
||||
switch (GST_EVENT_TYPE (event)) {
|
||||
case GST_EVENT_EOS:
|
||||
FLAC__seekable_stream_encoder_finish (flacenc->encoder);
|
||||
break;
|
||||
FLAC__seekable_stream_encoder_finish (flacenc->encoder);
|
||||
break;
|
||||
case GST_EVENT_TAG:
|
||||
if (flacenc->tags) {
|
||||
gst_tag_list_insert (flacenc->tags, gst_event_tag_get_list (event),
|
||||
GST_TAG_MERGE_REPLACE);
|
||||
} else {
|
||||
g_assert_not_reached ();
|
||||
}
|
||||
break;
|
||||
if (flacenc->tags) {
|
||||
gst_tag_list_insert (flacenc->tags, gst_event_tag_get_list (event),
|
||||
GST_TAG_MERGE_REPLACE);
|
||||
} else {
|
||||
g_assert_not_reached ();
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
break;
|
||||
}
|
||||
gst_pad_event_default (pad, event);
|
||||
return;
|
||||
|
@ -556,7 +558,7 @@ gst_flacenc_chain (GstPad * pad, GstData * _data)
|
|||
|
||||
if (!flacenc->negotiated) {
|
||||
GST_ELEMENT_ERROR (flacenc, CORE, NEGOTIATION, (NULL),
|
||||
("format wasn't negotiated before chain function"));
|
||||
("format wasn't negotiated before chain function"));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -570,9 +572,9 @@ gst_flacenc_chain (GstPad * pad, GstData * _data)
|
|||
FLAC__SeekableStreamEncoderState state;
|
||||
|
||||
FLAC__seekable_stream_encoder_set_write_callback (flacenc->encoder,
|
||||
gst_flacenc_write_callback);
|
||||
gst_flacenc_write_callback);
|
||||
FLAC__seekable_stream_encoder_set_seek_callback (flacenc->encoder,
|
||||
gst_flacenc_seek_callback);
|
||||
gst_flacenc_seek_callback);
|
||||
|
||||
FLAC__seekable_stream_encoder_set_client_data (flacenc->encoder, flacenc);
|
||||
|
||||
|
@ -580,7 +582,7 @@ gst_flacenc_chain (GstPad * pad, GstData * _data)
|
|||
state = FLAC__seekable_stream_encoder_init (flacenc->encoder);
|
||||
if (state != FLAC__STREAM_ENCODER_OK) {
|
||||
GST_ELEMENT_ERROR (flacenc, LIBRARY, INIT, (NULL),
|
||||
("could not initialize encoder (wrong parameters?)"));
|
||||
("could not initialize encoder (wrong parameters?)"));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -630,51 +632,51 @@ gst_flacenc_set_property (GObject * object, guint prop_id,
|
|||
break;
|
||||
case ARG_STREAMABLE_SUBSET:
|
||||
FLAC__seekable_stream_encoder_set_streamable_subset (this->encoder,
|
||||
g_value_get_boolean (value));
|
||||
g_value_get_boolean (value));
|
||||
break;
|
||||
case ARG_MID_SIDE_STEREO:
|
||||
FLAC__seekable_stream_encoder_set_do_mid_side_stereo (this->encoder,
|
||||
g_value_get_boolean (value));
|
||||
g_value_get_boolean (value));
|
||||
break;
|
||||
case ARG_LOOSE_MID_SIDE_STEREO:
|
||||
FLAC__seekable_stream_encoder_set_loose_mid_side_stereo (this->encoder,
|
||||
g_value_get_boolean (value));
|
||||
g_value_get_boolean (value));
|
||||
break;
|
||||
case ARG_BLOCKSIZE:
|
||||
FLAC__seekable_stream_encoder_set_blocksize (this->encoder,
|
||||
g_value_get_uint (value));
|
||||
g_value_get_uint (value));
|
||||
break;
|
||||
case ARG_MAX_LPC_ORDER:
|
||||
FLAC__seekable_stream_encoder_set_max_lpc_order (this->encoder,
|
||||
g_value_get_uint (value));
|
||||
g_value_get_uint (value));
|
||||
break;
|
||||
case ARG_QLP_COEFF_PRECISION:
|
||||
FLAC__seekable_stream_encoder_set_qlp_coeff_precision (this->encoder,
|
||||
g_value_get_uint (value));
|
||||
g_value_get_uint (value));
|
||||
break;
|
||||
case ARG_QLP_COEFF_PREC_SEARCH:
|
||||
FLAC__seekable_stream_encoder_set_do_qlp_coeff_prec_search (this->encoder,
|
||||
g_value_get_boolean (value));
|
||||
g_value_get_boolean (value));
|
||||
break;
|
||||
case ARG_ESCAPE_CODING:
|
||||
FLAC__seekable_stream_encoder_set_do_escape_coding (this->encoder,
|
||||
g_value_get_boolean (value));
|
||||
g_value_get_boolean (value));
|
||||
break;
|
||||
case ARG_EXHAUSTIVE_MODEL_SEARCH:
|
||||
FLAC__seekable_stream_encoder_set_do_exhaustive_model_search (this->
|
||||
encoder, g_value_get_boolean (value));
|
||||
encoder, g_value_get_boolean (value));
|
||||
break;
|
||||
case ARG_MIN_RESIDUAL_PARTITION_ORDER:
|
||||
FLAC__seekable_stream_encoder_set_min_residual_partition_order (this->
|
||||
encoder, g_value_get_uint (value));
|
||||
encoder, g_value_get_uint (value));
|
||||
break;
|
||||
case ARG_MAX_RESIDUAL_PARTITION_ORDER:
|
||||
FLAC__seekable_stream_encoder_set_max_residual_partition_order (this->
|
||||
encoder, g_value_get_uint (value));
|
||||
encoder, g_value_get_uint (value));
|
||||
break;
|
||||
case ARG_RICE_PARAMETER_SEARCH_DIST:
|
||||
FLAC__seekable_stream_encoder_set_rice_parameter_search_dist (this->
|
||||
encoder, g_value_get_uint (value));
|
||||
encoder, g_value_get_uint (value));
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
|
@ -696,58 +698,58 @@ gst_flacenc_get_property (GObject * object, guint prop_id,
|
|||
break;
|
||||
case ARG_STREAMABLE_SUBSET:
|
||||
g_value_set_boolean (value,
|
||||
FLAC__seekable_stream_encoder_get_streamable_subset (this->encoder));
|
||||
FLAC__seekable_stream_encoder_get_streamable_subset (this->encoder));
|
||||
break;
|
||||
case ARG_MID_SIDE_STEREO:
|
||||
g_value_set_boolean (value,
|
||||
FLAC__seekable_stream_encoder_get_do_mid_side_stereo (this->encoder));
|
||||
FLAC__seekable_stream_encoder_get_do_mid_side_stereo (this->encoder));
|
||||
break;
|
||||
case ARG_LOOSE_MID_SIDE_STEREO:
|
||||
g_value_set_boolean (value,
|
||||
FLAC__seekable_stream_encoder_get_loose_mid_side_stereo (this->
|
||||
encoder));
|
||||
FLAC__seekable_stream_encoder_get_loose_mid_side_stereo (this->
|
||||
encoder));
|
||||
break;
|
||||
case ARG_BLOCKSIZE:
|
||||
g_value_set_uint (value,
|
||||
FLAC__seekable_stream_encoder_get_blocksize (this->encoder));
|
||||
FLAC__seekable_stream_encoder_get_blocksize (this->encoder));
|
||||
break;
|
||||
case ARG_MAX_LPC_ORDER:
|
||||
g_value_set_uint (value,
|
||||
FLAC__seekable_stream_encoder_get_max_lpc_order (this->encoder));
|
||||
FLAC__seekable_stream_encoder_get_max_lpc_order (this->encoder));
|
||||
break;
|
||||
case ARG_QLP_COEFF_PRECISION:
|
||||
g_value_set_uint (value,
|
||||
FLAC__seekable_stream_encoder_get_qlp_coeff_precision (this->
|
||||
encoder));
|
||||
FLAC__seekable_stream_encoder_get_qlp_coeff_precision (this->
|
||||
encoder));
|
||||
break;
|
||||
case ARG_QLP_COEFF_PREC_SEARCH:
|
||||
g_value_set_boolean (value,
|
||||
FLAC__seekable_stream_encoder_get_do_qlp_coeff_prec_search (this->
|
||||
encoder));
|
||||
FLAC__seekable_stream_encoder_get_do_qlp_coeff_prec_search (this->
|
||||
encoder));
|
||||
break;
|
||||
case ARG_ESCAPE_CODING:
|
||||
g_value_set_boolean (value,
|
||||
FLAC__seekable_stream_encoder_get_do_escape_coding (this->encoder));
|
||||
FLAC__seekable_stream_encoder_get_do_escape_coding (this->encoder));
|
||||
break;
|
||||
case ARG_EXHAUSTIVE_MODEL_SEARCH:
|
||||
g_value_set_boolean (value,
|
||||
FLAC__seekable_stream_encoder_get_do_exhaustive_model_search (this->
|
||||
encoder));
|
||||
FLAC__seekable_stream_encoder_get_do_exhaustive_model_search (this->
|
||||
encoder));
|
||||
break;
|
||||
case ARG_MIN_RESIDUAL_PARTITION_ORDER:
|
||||
g_value_set_uint (value,
|
||||
FLAC__seekable_stream_encoder_get_min_residual_partition_order (this->
|
||||
encoder));
|
||||
FLAC__seekable_stream_encoder_get_min_residual_partition_order (this->
|
||||
encoder));
|
||||
break;
|
||||
case ARG_MAX_RESIDUAL_PARTITION_ORDER:
|
||||
g_value_set_uint (value,
|
||||
FLAC__seekable_stream_encoder_get_max_residual_partition_order (this->
|
||||
encoder));
|
||||
FLAC__seekable_stream_encoder_get_max_residual_partition_order (this->
|
||||
encoder));
|
||||
break;
|
||||
case ARG_RICE_PARAMETER_SEARCH_DIST:
|
||||
g_value_set_uint (value,
|
||||
FLAC__seekable_stream_encoder_get_rice_parameter_search_dist (this->
|
||||
encoder));
|
||||
FLAC__seekable_stream_encoder_get_rice_parameter_search_dist (this->
|
||||
encoder));
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
|
@ -771,20 +773,20 @@ gst_flacenc_change_state (GstElement * element)
|
|||
break;
|
||||
case GST_STATE_PAUSED_TO_READY:
|
||||
if (FLAC__seekable_stream_encoder_get_state (flacenc->encoder) !=
|
||||
FLAC__STREAM_ENCODER_UNINITIALIZED) {
|
||||
flacenc->stopped = TRUE;
|
||||
FLAC__seekable_stream_encoder_finish (flacenc->encoder);
|
||||
FLAC__STREAM_ENCODER_UNINITIALIZED) {
|
||||
flacenc->stopped = TRUE;
|
||||
FLAC__seekable_stream_encoder_finish (flacenc->encoder);
|
||||
}
|
||||
flacenc->negotiated = FALSE;
|
||||
if (flacenc->first_buf)
|
||||
gst_buffer_unref (flacenc->first_buf);
|
||||
gst_buffer_unref (flacenc->first_buf);
|
||||
flacenc->first_buf = NULL;
|
||||
g_free (flacenc->data);
|
||||
flacenc->data = NULL;
|
||||
if (flacenc->meta) {
|
||||
FLAC__metadata_object_delete (flacenc->meta[0]);
|
||||
g_free (flacenc->meta);
|
||||
flacenc->meta = NULL;
|
||||
FLAC__metadata_object_delete (flacenc->meta[0]);
|
||||
g_free (flacenc->meta);
|
||||
flacenc->meta = NULL;
|
||||
}
|
||||
break;
|
||||
case GST_STATE_READY_TO_NULL:
|
||||
|
|
|
@ -56,7 +56,8 @@ typedef enum
|
|||
GST_FLAC_TAG_STATE_VC_METADATA_BLOCK,
|
||||
GST_FLAC_TAG_STATE_ADD_VORBIS_COMMENT,
|
||||
GST_FLAC_TAG_STATE_AUDIO_DATA
|
||||
} GstFlacTagState;
|
||||
}
|
||||
GstFlacTagState;
|
||||
|
||||
|
||||
struct _GstFlacTag
|
||||
|
@ -157,11 +158,11 @@ gst_flac_tag_get_type (void)
|
|||
};
|
||||
|
||||
flac_tag_type =
|
||||
g_type_register_static (GST_TYPE_ELEMENT, "GstFlacTag", &flac_tag_info,
|
||||
0);
|
||||
g_type_register_static (GST_TYPE_ELEMENT, "GstFlacTag", &flac_tag_info,
|
||||
0);
|
||||
|
||||
g_type_add_interface_static (flac_tag_type, GST_TYPE_TAG_SETTER,
|
||||
&tag_setter_info);
|
||||
&tag_setter_info);
|
||||
|
||||
}
|
||||
return flac_tag_type;
|
||||
|
@ -189,8 +190,8 @@ send_eos (GstFlacTag * tag)
|
|||
gst_pad_push (tag->srcpad, GST_DATA (gst_event_new (GST_EVENT_EOS)));
|
||||
/* Seek to end of sink stream */
|
||||
if (gst_pad_send_event (GST_PAD_PEER (tag->sinkpad),
|
||||
gst_event_new_seek (GST_FORMAT_BYTES | GST_SEEK_METHOD_END |
|
||||
GST_SEEK_FLAG_FLUSH, 0))) {
|
||||
gst_event_new_seek (GST_FORMAT_BYTES | GST_SEEK_METHOD_END |
|
||||
GST_SEEK_FLAG_FLUSH, 0))) {
|
||||
} else {
|
||||
g_warning ("Couldn't seek to eos on sinkpad\n");
|
||||
}
|
||||
|
@ -209,8 +210,8 @@ caps_nego (GstFlacTag * tag)
|
|||
GST_LOG_OBJECT (tag, "normal operation, using audio/x-flac output");
|
||||
} else {
|
||||
if (gst_pad_try_set_caps (tag->srcpad,
|
||||
gst_caps_new_simple ("application/x-gst-tags", NULL))
|
||||
!= GST_PAD_LINK_REFUSED) {
|
||||
gst_caps_new_simple ("application/x-gst-tags", NULL))
|
||||
!= GST_PAD_LINK_REFUSED) {
|
||||
tag->only_output_tags = TRUE;
|
||||
GST_LOG_OBJECT (tag, "fast operation, just outputting tags");
|
||||
printf ("output tags only\n");
|
||||
|
@ -295,7 +296,7 @@ gst_flac_tag_chain (GstPad * pad, GstData * data)
|
|||
}
|
||||
|
||||
if (strncmp (GST_BUFFER_DATA (tag->buffer), FLAC_MAGIC,
|
||||
FLAC_MAGIC_SIZE) == 0) {
|
||||
FLAC_MAGIC_SIZE) == 0) {
|
||||
GstBuffer *sub;
|
||||
|
||||
tag->state = GST_FLAC_TAG_STATE_METADATA_BLOCKS;
|
||||
|
@ -303,8 +304,8 @@ gst_flac_tag_chain (GstPad * pad, GstData * data)
|
|||
|
||||
gst_pad_push (tag->srcpad, GST_DATA (sub));
|
||||
sub =
|
||||
gst_buffer_create_sub (tag->buffer, FLAC_MAGIC_SIZE,
|
||||
GST_BUFFER_SIZE (tag->buffer) - FLAC_MAGIC_SIZE);
|
||||
gst_buffer_create_sub (tag->buffer, FLAC_MAGIC_SIZE,
|
||||
GST_BUFFER_SIZE (tag->buffer) - FLAC_MAGIC_SIZE);
|
||||
gst_buffer_unref (tag->buffer);
|
||||
/* We do a copy because we need a writable buffer, and _create_sub
|
||||
* sets the buffer it uses to read-only
|
||||
|
@ -347,8 +348,8 @@ gst_flac_tag_chain (GstPad * pad, GstData * data)
|
|||
|
||||
type = (GST_BUFFER_DATA (tag->buffer)[0]) & 0x7F;
|
||||
size = ((GST_BUFFER_DATA (tag->buffer)[1]) << 16)
|
||||
| ((GST_BUFFER_DATA (tag->buffer)[2]) << 8)
|
||||
| (GST_BUFFER_DATA (tag->buffer)[3]);
|
||||
| ((GST_BUFFER_DATA (tag->buffer)[2]) << 8)
|
||||
| (GST_BUFFER_DATA (tag->buffer)[3]);
|
||||
|
||||
/* The 4 bytes long header isn't included in the metadata size */
|
||||
tag->metadata_bytes_remaining = size + 4;
|
||||
|
@ -372,7 +373,7 @@ gst_flac_tag_chain (GstPad * pad, GstData * data)
|
|||
g_assert (tag->metadata_bytes_remaining != 0);
|
||||
|
||||
bytes_to_push = min (tag->metadata_bytes_remaining,
|
||||
GST_BUFFER_SIZE (tag->buffer));
|
||||
GST_BUFFER_SIZE (tag->buffer));
|
||||
|
||||
sub = gst_buffer_create_sub (tag->buffer, 0, bytes_to_push);
|
||||
|
||||
|
@ -380,14 +381,14 @@ gst_flac_tag_chain (GstPad * pad, GstData * data)
|
|||
gst_pad_push (tag->srcpad, GST_DATA (sub));
|
||||
} else {
|
||||
if (tag->vorbiscomment == NULL) {
|
||||
tag->vorbiscomment = sub;
|
||||
tag->vorbiscomment = sub;
|
||||
} else {
|
||||
GstBuffer *merge;
|
||||
GstBuffer *merge;
|
||||
|
||||
merge = gst_buffer_merge (tag->vorbiscomment, sub);
|
||||
gst_buffer_unref (tag->vorbiscomment);
|
||||
gst_buffer_unref (sub);
|
||||
tag->vorbiscomment = merge;
|
||||
merge = gst_buffer_merge (tag->vorbiscomment, sub);
|
||||
gst_buffer_unref (tag->vorbiscomment);
|
||||
gst_buffer_unref (sub);
|
||||
tag->vorbiscomment = merge;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -397,7 +398,7 @@ gst_flac_tag_chain (GstPad * pad, GstData * data)
|
|||
GstBuffer *sub;
|
||||
|
||||
sub = gst_buffer_create_sub (tag->buffer, bytes_to_push,
|
||||
GST_BUFFER_SIZE (tag->buffer) - bytes_to_push);
|
||||
GST_BUFFER_SIZE (tag->buffer) - bytes_to_push);
|
||||
gst_buffer_unref (tag->buffer);
|
||||
|
||||
/* We make a copy because we need a writable buffer, and _create_sub
|
||||
|
@ -431,17 +432,17 @@ gst_flac_tag_chain (GstPad * pad, GstData * data)
|
|||
* that we encoutered some tags
|
||||
*/
|
||||
tag->tags = gst_tag_list_from_vorbiscomment_buffer (tag->vorbiscomment,
|
||||
GST_BUFFER_DATA (tag->vorbiscomment), 4, NULL);
|
||||
GST_BUFFER_DATA (tag->vorbiscomment), 4, NULL);
|
||||
if (tag->tags != NULL) {
|
||||
gst_element_found_tags (GST_ELEMENT (tag), tag->tags);
|
||||
gst_element_found_tags (GST_ELEMENT (tag), tag->tags);
|
||||
}
|
||||
|
||||
gst_buffer_unref (tag->vorbiscomment);
|
||||
tag->vorbiscomment = NULL;
|
||||
|
||||
if (tag->only_output_tags) {
|
||||
send_eos (tag);
|
||||
return;
|
||||
send_eos (tag);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -450,13 +451,13 @@ gst_flac_tag_chain (GstPad * pad, GstData * data)
|
|||
tag->state = GST_FLAC_TAG_STATE_METADATA_BLOCKS;
|
||||
} else {
|
||||
if (tag->only_output_tags) {
|
||||
/* If we finished parsing the metadata blocks, we will never find any
|
||||
* metadata, so just stop now
|
||||
*/
|
||||
send_eos (tag);
|
||||
return;
|
||||
/* If we finished parsing the metadata blocks, we will never find any
|
||||
* metadata, so just stop now
|
||||
*/
|
||||
send_eos (tag);
|
||||
return;
|
||||
} else {
|
||||
tag->state = GST_FLAC_TAG_STATE_ADD_VORBIS_COMMENT;
|
||||
tag->state = GST_FLAC_TAG_STATE_ADD_VORBIS_COMMENT;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -475,7 +476,7 @@ gst_flac_tag_chain (GstPad * pad, GstData * data)
|
|||
|
||||
user_tags = gst_tag_setter_get_list (GST_TAG_SETTER (tag));
|
||||
merged_tags = gst_tag_list_merge (tag->tags, user_tags,
|
||||
gst_tag_setter_get_merge_mode (GST_TAG_SETTER (tag)));
|
||||
gst_tag_setter_get_merge_mode (GST_TAG_SETTER (tag)));
|
||||
|
||||
if (merged_tags == NULL) {
|
||||
/* If we get a NULL list of tags, we must generate a padding block
|
||||
|
@ -485,37 +486,37 @@ gst_flac_tag_chain (GstPad * pad, GstData * data)
|
|||
g_warning ("No tags found\n");
|
||||
buffer = gst_buffer_new_and_alloc (12);
|
||||
if (buffer == NULL) {
|
||||
GST_ELEMENT_ERROR (tag, CORE, TOO_LAZY, (NULL),
|
||||
("Error creating 12-byte buffer for padding block"));
|
||||
GST_ELEMENT_ERROR (tag, CORE, TOO_LAZY, (NULL),
|
||||
("Error creating 12-byte buffer for padding block"));
|
||||
}
|
||||
memset (GST_BUFFER_DATA (buffer), 0, GST_BUFFER_SIZE (buffer));
|
||||
GST_BUFFER_DATA (buffer)[0] = 0x81; /* 0x80 = Last metadata block,
|
||||
* 0x01 = padding block
|
||||
*/
|
||||
GST_BUFFER_DATA (buffer)[0] = 0x81; /* 0x80 = Last metadata block,
|
||||
* 0x01 = padding block
|
||||
*/
|
||||
} else {
|
||||
guchar header[4];
|
||||
|
||||
memset (header, 0, sizeof (header));
|
||||
header[0] = 0x84; /* 0x80 = Last metadata block,
|
||||
* 0x04 = vorbiscomment block
|
||||
*/
|
||||
header[0] = 0x84; /* 0x80 = Last metadata block,
|
||||
* 0x04 = vorbiscomment block
|
||||
*/
|
||||
buffer = gst_tag_list_to_vorbiscomment_buffer (merged_tags, header,
|
||||
sizeof (header), NULL);
|
||||
sizeof (header), NULL);
|
||||
gst_tag_list_free (merged_tags);
|
||||
if (buffer == NULL) {
|
||||
GST_ELEMENT_ERROR (tag, CORE, TAG, (NULL),
|
||||
("Error converting tag list to vorbiscomment buffer"));
|
||||
return;
|
||||
GST_ELEMENT_ERROR (tag, CORE, TAG, (NULL),
|
||||
("Error converting tag list to vorbiscomment buffer"));
|
||||
return;
|
||||
}
|
||||
size = GST_BUFFER_SIZE (buffer) - 4;
|
||||
if ((size > 0xFFFFFF) || (size < 0)) {
|
||||
/* FLAC vorbis comment blocks are limited to 2^24 bytes,
|
||||
* while the vorbis specs allow more than that. Shouldn't
|
||||
* be a real world problem though
|
||||
*/
|
||||
GST_ELEMENT_ERROR (tag, CORE, TAG, (NULL),
|
||||
("Vorbis comment of size %d too long", size));
|
||||
return;
|
||||
/* FLAC vorbis comment blocks are limited to 2^24 bytes,
|
||||
* while the vorbis specs allow more than that. Shouldn't
|
||||
* be a real world problem though
|
||||
*/
|
||||
GST_ELEMENT_ERROR (tag, CORE, TAG, (NULL),
|
||||
("Vorbis comment of size %d too long", size));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -559,15 +560,15 @@ gst_flac_tag_change_state (GstElement * element)
|
|||
break;
|
||||
case GST_STATE_PAUSED_TO_READY:
|
||||
if (tag->buffer) {
|
||||
gst_buffer_unref (tag->buffer);
|
||||
tag->buffer = NULL;
|
||||
gst_buffer_unref (tag->buffer);
|
||||
tag->buffer = NULL;
|
||||
}
|
||||
if (tag->vorbiscomment) {
|
||||
gst_buffer_unref (tag->vorbiscomment);
|
||||
tag->vorbiscomment = NULL;
|
||||
gst_buffer_unref (tag->vorbiscomment);
|
||||
tag->vorbiscomment = NULL;
|
||||
}
|
||||
if (tag->tags) {
|
||||
gst_tag_list_free (tag->tags);
|
||||
gst_tag_list_free (tag->tags);
|
||||
}
|
||||
tag->state = GST_FLAC_TAG_STATE_INIT;
|
||||
break;
|
||||
|
|
|
@ -41,7 +41,8 @@ typedef struct
|
|||
/* our own stuff - we're much better at keeping fields small :p */
|
||||
GstGdkAnimation *ani;
|
||||
gboolean initialized;
|
||||
} GstLoaderContext;
|
||||
}
|
||||
GstLoaderContext;
|
||||
|
||||
GST_DEBUG_CATEGORY_STATIC (gst_loader_debug);
|
||||
#define GST_CAT_DEFAULT gst_loader_debug
|
||||
|
@ -56,13 +57,13 @@ gst_loader_init (GError ** error)
|
|||
|
||||
if (!g_thread_supported ()) {
|
||||
g_set_error (error, GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR_FAILED,
|
||||
"The GStreamer loader requires threading support.");
|
||||
"The GStreamer loader requires threading support.");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (!gst_init_check (0, NULL)) {
|
||||
g_set_error (error, GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR_FAILED,
|
||||
"GStreamer could not be initialized.");
|
||||
"GStreamer could not be initialized.");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -119,15 +120,15 @@ gst_loader_load_increment (gpointer context_pointer, const guchar * buf,
|
|||
gst_gdk_animation_add_data (context->ani, buf, size);
|
||||
if (!context->initialized
|
||||
&& (iter =
|
||||
gdk_pixbuf_animation_get_iter (GDK_PIXBUF_ANIMATION (context->ani),
|
||||
NULL)) != NULL) {
|
||||
gdk_pixbuf_animation_get_iter (GDK_PIXBUF_ANIMATION (context->ani),
|
||||
NULL)) != NULL) {
|
||||
int width =
|
||||
gdk_pixbuf_animation_get_width (GDK_PIXBUF_ANIMATION (context->ani));
|
||||
gdk_pixbuf_animation_get_width (GDK_PIXBUF_ANIMATION (context->ani));
|
||||
int height =
|
||||
gdk_pixbuf_animation_get_height (GDK_PIXBUF_ANIMATION (context->ani));
|
||||
gdk_pixbuf_animation_get_height (GDK_PIXBUF_ANIMATION (context->ani));
|
||||
GdkPixbuf *pixbuf =
|
||||
gdk_pixbuf_animation_get_static_image (GDK_PIXBUF_ANIMATION (context->
|
||||
ani));
|
||||
gdk_pixbuf_animation_get_static_image (GDK_PIXBUF_ANIMATION (context->
|
||||
ani));
|
||||
|
||||
g_object_unref (iter);
|
||||
GST_LOG_OBJECT (context->ani, "initializing loader");
|
||||
|
@ -138,9 +139,9 @@ gst_loader_load_increment (gpointer context_pointer, const guchar * buf,
|
|||
|
||||
if (context->prepared_func) {
|
||||
GST_LOG_OBJECT (context->ani, "calling prepared_func %p",
|
||||
context->prepared_func);
|
||||
context->prepared_func);
|
||||
context->prepared_func (pixbuf, GDK_PIXBUF_ANIMATION (context->ani),
|
||||
context->user_data);
|
||||
context->user_data);
|
||||
}
|
||||
|
||||
context->initialized = TRUE;
|
||||
|
@ -187,7 +188,7 @@ gst_loader_load_animation (FILE * f, GError ** error)
|
|||
g_free (filename);
|
||||
if (iter == NULL) {
|
||||
g_set_error (error, GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
|
||||
"could not create an image");
|
||||
"could not create an image");
|
||||
g_object_unref (ani);
|
||||
GST_INFO ("could not create an image");
|
||||
return NULL;
|
||||
|
@ -211,7 +212,7 @@ gst_loader_load (FILE * f, GError ** error)
|
|||
GST_ERROR_OBJECT (ani, "Could not get an image in _pixbuf_load");
|
||||
g_object_unref (ani);
|
||||
g_set_error (error, GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
|
||||
"Could not get an image from file.");
|
||||
"Could not get an image from file.");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -250,7 +251,7 @@ fill_info (GdkPixbufFormat * info)
|
|||
{" free", "xxxx ", 80},
|
||||
/* ASF */
|
||||
{"\060\046\262\165\216\146\317\021\246\331 \252 \142\316\154",
|
||||
" z z ", 100},
|
||||
" z z ", 100},
|
||||
{NULL, NULL, 0}
|
||||
};
|
||||
|
||||
|
|
|
@ -54,18 +54,18 @@ gst_gdk_animation_get_type (void)
|
|||
NULL,
|
||||
NULL,
|
||||
gst_gdk_animation_class_init,
|
||||
NULL, /* class_finalize */
|
||||
NULL, /* class_data */
|
||||
NULL, /* class_finalize */
|
||||
NULL, /* class_data */
|
||||
sizeof (GstGdkAnimation),
|
||||
0, /* n_preallocs */
|
||||
0, /* n_preallocs */
|
||||
NULL,
|
||||
};
|
||||
|
||||
object_type = g_type_register_static (GDK_TYPE_PIXBUF_ANIMATION,
|
||||
"GstGdkAnimation", &object_info, 0);
|
||||
"GstGdkAnimation", &object_info, 0);
|
||||
|
||||
GST_DEBUG_CATEGORY_INIT (gst_gdk_animation_debug, "gstloader_animation", 0,
|
||||
"GStreamer GdkPixbuf loader - GdkAnimation class");
|
||||
"GStreamer GdkPixbuf loader - GdkAnimation class");
|
||||
}
|
||||
|
||||
return object_type;
|
||||
|
@ -179,15 +179,15 @@ gst_gdk_animation_iter_get_type (void)
|
|||
NULL,
|
||||
NULL,
|
||||
gst_gdk_animation_iter_class_init,
|
||||
NULL, /* class_finalize */
|
||||
NULL, /* class_data */
|
||||
NULL, /* class_finalize */
|
||||
NULL, /* class_data */
|
||||
sizeof (GstGdkAnimationIter),
|
||||
0, /* n_preallocs */
|
||||
0, /* n_preallocs */
|
||||
gst_gdk_animation_iter_init,
|
||||
};
|
||||
|
||||
object_type = g_type_register_static (GDK_TYPE_PIXBUF_ANIMATION_ITER,
|
||||
"GdkPixbufAniAnimIter", &object_info, 0);
|
||||
"GdkPixbufAniAnimIter", &object_info, 0);
|
||||
}
|
||||
|
||||
return object_type;
|
||||
|
@ -266,12 +266,12 @@ gst_gdk_animation_iter_create_pipeline (GstGdkAnimationIter * iter)
|
|||
);
|
||||
|
||||
gst_caps_append (caps, GST_CAPS_NEW ("pixbuf_filter24",
|
||||
"video/x-raw-rgb",
|
||||
"endianness", GST_PROPS_INT (G_BIG_ENDIAN),
|
||||
"bpp", GST_PROPS_INT (24),
|
||||
"red_mask", GST_PROPS_INT (0xFF0000),
|
||||
"green_mask", GST_PROPS_INT (0x00FF00),
|
||||
"blue_mask", GST_PROPS_INT (0x0000FF)
|
||||
"video/x-raw-rgb",
|
||||
"endianness", GST_PROPS_INT (G_BIG_ENDIAN),
|
||||
"bpp", GST_PROPS_INT (24),
|
||||
"red_mask", GST_PROPS_INT (0xFF0000),
|
||||
"green_mask", GST_PROPS_INT (0x00FF00),
|
||||
"blue_mask", GST_PROPS_INT (0x0000FF)
|
||||
));
|
||||
|
||||
iter->pipeline = gst_element_factory_make ("pipeline", "main_pipeline");
|
||||
|
@ -323,7 +323,7 @@ gst_gdk_animation_iter_create_pipeline (GstGdkAnimationIter * iter)
|
|||
if (!gst_element_link_filtered (colorspace, sink, caps))
|
||||
goto error;
|
||||
if (gst_element_set_state (iter->pipeline,
|
||||
GST_STATE_PLAYING) != GST_STATE_SUCCESS)
|
||||
GST_STATE_PLAYING) != GST_STATE_SUCCESS)
|
||||
goto error;
|
||||
|
||||
return TRUE;
|
||||
|
@ -346,7 +346,7 @@ gst_gdk_animation_iter_may_advance (GstGdkAnimationIter * iter)
|
|||
data_amount = lseek (iter->ani->temp_fd, 0, SEEK_CUR);
|
||||
g_assert (data_amount >= 0);
|
||||
g_assert (gst_element_query (gst_bin_get_by_name (GST_BIN (iter->pipeline),
|
||||
"source"), GST_QUERY_POSITION, &bytes, &offset));
|
||||
"source"), GST_QUERY_POSITION, &bytes, &offset));
|
||||
if (data_amount - offset > GST_GDK_BUFFER_SIZE)
|
||||
return TRUE;
|
||||
|
||||
|
@ -394,7 +394,7 @@ gst_gdk_animation_iter_create_pixbuf (GstGdkAnimationIter * iter)
|
|||
GstPad *pad;
|
||||
GstCaps *caps;
|
||||
GstElement *fakesink =
|
||||
gst_bin_get_by_name (GST_BIN (iter->pipeline), "sink");
|
||||
gst_bin_get_by_name (GST_BIN (iter->pipeline), "sink");
|
||||
g_assert (fakesink);
|
||||
pad = gst_element_get_pad (fakesink, "sink");
|
||||
g_assert (pad);
|
||||
|
@ -402,13 +402,13 @@ gst_gdk_animation_iter_create_pixbuf (GstGdkAnimationIter * iter)
|
|||
g_assert (caps);
|
||||
g_assert (GST_CAPS_IS_FIXED (caps));
|
||||
g_assert (gst_caps_has_fixed_property (caps, "bpp") &&
|
||||
gst_caps_has_fixed_property (caps, "width") &&
|
||||
gst_caps_has_fixed_property (caps, "height"));
|
||||
gst_caps_has_fixed_property (caps, "width") &&
|
||||
gst_caps_has_fixed_property (caps, "height"));
|
||||
gst_caps_get_int (caps, "width", &ani->width);
|
||||
gst_caps_get_int (caps, "height", &ani->height);
|
||||
gst_caps_get_int (caps, "bpp", &ani->bpp);
|
||||
GST_DEBUG_OBJECT (ani, "found format (width %d, height %d, bpp %d)",
|
||||
ani->width, ani->height, ani->bpp);
|
||||
ani->width, ani->height, ani->bpp);
|
||||
}
|
||||
g_assert (GST_BUFFER_SIZE (buf) == ani->width * ani->height * ani->bpp / 8);
|
||||
if (ani->bpp == 32) {
|
||||
|
@ -473,12 +473,12 @@ gst_gdk_animation_iter_advance (GdkPixbufAnimationIter * anim_iter,
|
|||
((GstClockTime) current_time->tv_sec - iter->start.tv_sec) * GST_SECOND;
|
||||
if (iter->start.tv_usec > current_time->tv_usec) {
|
||||
offset -=
|
||||
((GstClockTime) iter->start.tv_usec -
|
||||
current_time->tv_usec) * GST_SECOND / G_USEC_PER_SEC;
|
||||
((GstClockTime) iter->start.tv_usec -
|
||||
current_time->tv_usec) * GST_SECOND / G_USEC_PER_SEC;
|
||||
} else {
|
||||
offset +=
|
||||
((GstClockTime) current_time->tv_usec -
|
||||
iter->start.tv_usec) * GST_SECOND / G_USEC_PER_SEC;
|
||||
((GstClockTime) current_time->tv_usec -
|
||||
iter->start.tv_usec) * GST_SECOND / G_USEC_PER_SEC;
|
||||
}
|
||||
GST_DEBUG_OBJECT (iter,
|
||||
"advancing to %ld:%ld (started at %ld:%ld) need offset %"
|
||||
|
@ -487,18 +487,18 @@ gst_gdk_animation_iter_advance (GdkPixbufAnimationIter * anim_iter,
|
|||
if (!iter->just_seeked
|
||||
&& offset - iter->last_timestamp > GST_GDK_MAX_DELAY_TO_SEEK) {
|
||||
GST_INFO_OBJECT (iter,
|
||||
"current pipeline timestamp is too old (%" G_GUINT64_FORMAT " vs %"
|
||||
G_GUINT64_FORMAT "), seeking there", iter->last_timestamp, offset);
|
||||
"current pipeline timestamp is too old (%" G_GUINT64_FORMAT " vs %"
|
||||
G_GUINT64_FORMAT "), seeking there", iter->last_timestamp, offset);
|
||||
if (gst_element_send_event (gst_bin_get_by_name (GST_BIN (iter->pipeline),
|
||||
"sink"),
|
||||
gst_event_new_seek (GST_FORMAT_TIME | GST_SEEK_METHOD_SET |
|
||||
GST_SEEK_FLAG_FLUSH | GST_SEEK_FLAG_ACCURATE, offset))) {
|
||||
"sink"),
|
||||
gst_event_new_seek (GST_FORMAT_TIME | GST_SEEK_METHOD_SET |
|
||||
GST_SEEK_FLAG_FLUSH | GST_SEEK_FLAG_ACCURATE, offset))) {
|
||||
iter->last_timestamp = offset;
|
||||
iter->just_seeked = TRUE;
|
||||
} else {
|
||||
GST_WARNING_OBJECT (iter,
|
||||
"seek to %" G_GUINT64_FORMAT " didn't work. Iterating there...",
|
||||
offset);
|
||||
"seek to %" G_GUINT64_FORMAT " didn't work. Iterating there...",
|
||||
offset);
|
||||
}
|
||||
} else if (iter->just_seeked) {
|
||||
iter->just_seeked = FALSE;
|
||||
|
@ -507,17 +507,17 @@ gst_gdk_animation_iter_advance (GdkPixbufAnimationIter * anim_iter,
|
|||
while (TRUE) {
|
||||
if (g_queue_is_empty (iter->buffers)) {
|
||||
if (iter->eos)
|
||||
return FALSE;
|
||||
return FALSE;
|
||||
if (gst_gdk_animation_get_more_buffers (iter))
|
||||
continue;
|
||||
continue;
|
||||
break;
|
||||
}
|
||||
if (GST_BUFFER_TIMESTAMP (g_queue_peek_head (iter->buffers)) > offset)
|
||||
break;
|
||||
if (buffer) {
|
||||
GST_LOG_OBJECT (iter, "unreffing buffer %p, because timestamp too low (%"
|
||||
G_GUINT64_FORMAT " vs %" G_GUINT64_FORMAT ")",
|
||||
buffer, GST_BUFFER_TIMESTAMP (buffer), offset);
|
||||
G_GUINT64_FORMAT " vs %" G_GUINT64_FORMAT ")",
|
||||
buffer, GST_BUFFER_TIMESTAMP (buffer), offset);
|
||||
gst_data_unref (GST_DATA (buffer));
|
||||
}
|
||||
buffer = GST_BUFFER (g_queue_pop_head (iter->buffers));
|
||||
|
@ -547,7 +547,7 @@ gst_gdk_animation_iter_get_delay_time (GdkPixbufAnimationIter * anim_iter)
|
|||
return -1;
|
||||
}
|
||||
if (!gst_gdk_animation_get_more_buffers (iter))
|
||||
return -1; /* FIXME? */
|
||||
return -1; /* FIXME? */
|
||||
}
|
||||
|
||||
delay =
|
||||
|
@ -593,52 +593,52 @@ gst_gdk_animation_get_static_image (GdkPixbufAnimation * animation)
|
|||
GST_LOG_OBJECT (ani, "trying to create pixbuf");
|
||||
g_get_current_time (&tv);
|
||||
iter =
|
||||
GST_GDK_ANIMATION_ITER (gdk_pixbuf_animation_get_iter (animation, &tv));
|
||||
GST_GDK_ANIMATION_ITER (gdk_pixbuf_animation_get_iter (animation, &tv));
|
||||
if (iter) {
|
||||
guint64 offset;
|
||||
GstBuffer *buf;
|
||||
GstFormat time = GST_FORMAT_TIME;
|
||||
|
||||
if (!gst_element_query (gst_bin_get_by_name (GST_BIN (iter->pipeline),
|
||||
"sink"), GST_QUERY_TOTAL, &time, &offset)) {
|
||||
offset = 0;
|
||||
"sink"), GST_QUERY_TOTAL, &time, &offset)) {
|
||||
offset = 0;
|
||||
}
|
||||
if (offset > 120 * GST_SECOND) {
|
||||
offset = 120 * GST_SECOND;
|
||||
offset = 120 * GST_SECOND;
|
||||
} else if (offset < 120 * GST_SECOND && offset >= 10 * GST_SECOND) {
|
||||
offset = offset / 2;
|
||||
offset = offset / 2;
|
||||
}
|
||||
g_assert (time == GST_FORMAT_TIME);
|
||||
GST_LOG_OBJECT (ani,
|
||||
"using time offset %" G_GUINT64_FORMAT " for creating static image",
|
||||
offset);
|
||||
"using time offset %" G_GUINT64_FORMAT " for creating static image",
|
||||
offset);
|
||||
while ((buf = g_queue_pop_head (iter->buffers)) != NULL) {
|
||||
gst_data_unref (GST_DATA (buf));
|
||||
gst_data_unref (GST_DATA (buf));
|
||||
}
|
||||
/* now we do evil stuff, be sure to get rid of the iterator afterwards */
|
||||
if (!gst_element_send_event (gst_bin_get_by_name (GST_BIN (iter->
|
||||
pipeline), "sink"),
|
||||
gst_event_new_seek (GST_FORMAT_TIME | GST_SEEK_METHOD_SET |
|
||||
GST_SEEK_FLAG_FLUSH | GST_SEEK_FLAG_ACCURATE, offset))) {
|
||||
GST_INFO_OBJECT (ani, "seeking didn't work. Using next image");
|
||||
pipeline), "sink"),
|
||||
gst_event_new_seek (GST_FORMAT_TIME | GST_SEEK_METHOD_SET |
|
||||
GST_SEEK_FLAG_FLUSH | GST_SEEK_FLAG_ACCURATE, offset))) {
|
||||
GST_INFO_OBJECT (ani, "seeking didn't work. Using next image");
|
||||
}
|
||||
|
||||
do {
|
||||
if (g_queue_is_empty (iter->buffers)) {
|
||||
if (iter->eos)
|
||||
return FALSE;
|
||||
if (gst_gdk_animation_get_more_buffers (iter))
|
||||
continue;
|
||||
}
|
||||
if (g_queue_is_empty (iter->buffers)) {
|
||||
if (iter->eos)
|
||||
return FALSE;
|
||||
if (gst_gdk_animation_get_more_buffers (iter))
|
||||
continue;
|
||||
}
|
||||
} while (FALSE);
|
||||
if (!g_queue_is_empty (iter->buffers)) {
|
||||
gst_gdk_animation_iter_create_pixbuf (iter);
|
||||
ani->pixbuf =
|
||||
gst_gdk_animation_iter_get_pixbuf (GDK_PIXBUF_ANIMATION_ITER
|
||||
(iter));
|
||||
g_object_ref (ani->pixbuf);
|
||||
gst_gdk_animation_iter_create_pixbuf (iter);
|
||||
ani->pixbuf =
|
||||
gst_gdk_animation_iter_get_pixbuf (GDK_PIXBUF_ANIMATION_ITER
|
||||
(iter));
|
||||
g_object_ref (ani->pixbuf);
|
||||
} else {
|
||||
g_assert (ani->pixbuf == NULL);
|
||||
g_assert (ani->pixbuf == NULL);
|
||||
}
|
||||
/* DiE iterator, DiE */
|
||||
g_object_unref (iter);
|
||||
|
|
|
@ -58,22 +58,22 @@ static GstStaticPadTemplate gst_gdk_pixbuf_sink_template =
|
|||
GST_PAD_SINK,
|
||||
GST_PAD_ALWAYS,
|
||||
GST_STATIC_CAPS ("image/png; "
|
||||
"image/jpeg; "
|
||||
"image/gif; "
|
||||
"image/x-icon; "
|
||||
"application/x-navi-animation; "
|
||||
"image/x-cmu-raster; "
|
||||
"image/x-sun-raster; "
|
||||
"image/x-pixmap; "
|
||||
"image/tiff; "
|
||||
"image/x-portable-anymap; "
|
||||
"image/x-portable-bitmap; "
|
||||
"image/x-portable-graymap; "
|
||||
"image/x-portable-pixmap; "
|
||||
"image/bmp; "
|
||||
"image/x-bmp; "
|
||||
"image/x-MS-bmp; "
|
||||
"image/vnd.wap.wbmp; " "image/x-bitmap; " "image/x-tga")
|
||||
"image/jpeg; "
|
||||
"image/gif; "
|
||||
"image/x-icon; "
|
||||
"application/x-navi-animation; "
|
||||
"image/x-cmu-raster; "
|
||||
"image/x-sun-raster; "
|
||||
"image/x-pixmap; "
|
||||
"image/tiff; "
|
||||
"image/x-portable-anymap; "
|
||||
"image/x-portable-bitmap; "
|
||||
"image/x-portable-graymap; "
|
||||
"image/x-portable-pixmap; "
|
||||
"image/bmp; "
|
||||
"image/x-bmp; "
|
||||
"image/x-MS-bmp; "
|
||||
"image/vnd.wap.wbmp; " "image/x-bitmap; " "image/x-tga")
|
||||
);
|
||||
|
||||
static GstStaticPadTemplate gst_gdk_pixbuf_src_template =
|
||||
|
@ -125,7 +125,7 @@ static GstCaps *
|
|||
gst_gdk_pixbuf_get_capslist (void)
|
||||
{
|
||||
return gst_caps_copy (gst_static_caps_get (&gst_gdk_pixbuf_sink_template.
|
||||
static_caps));
|
||||
static_caps));
|
||||
}
|
||||
#else
|
||||
static GstCaps *
|
||||
|
@ -184,8 +184,9 @@ gst_gdk_pixbuf_get_type (void)
|
|||
0,
|
||||
(GInstanceInitFunc) gst_gdk_pixbuf_init,
|
||||
};
|
||||
|
||||
plugin_type = g_type_register_static (GST_TYPE_ELEMENT,
|
||||
"GstGdkPixbuf", &plugin_info, 0);
|
||||
"GstGdkPixbuf", &plugin_info, 0);
|
||||
}
|
||||
return plugin_type;
|
||||
}
|
||||
|
@ -216,7 +217,7 @@ gst_gdk_pixbuf_class_init (GstGdkPixbufClass * klass)
|
|||
|
||||
g_object_class_install_property (gobject_class, ARG_SILENT,
|
||||
g_param_spec_boolean ("silent", "Silent", "Produce verbose output ?",
|
||||
FALSE, G_PARAM_READWRITE));
|
||||
FALSE, G_PARAM_READWRITE));
|
||||
|
||||
gobject_class->set_property = gst_gdk_pixbuf_set_property;
|
||||
gobject_class->get_property = gst_gdk_pixbuf_get_property;
|
||||
|
@ -266,15 +267,15 @@ gst_gdk_pixbuf_chain (GstPad * pad, GstData * _data)
|
|||
|
||||
switch (GST_EVENT_TYPE (event)) {
|
||||
case GST_EVENT_EOS:
|
||||
push_buffer = TRUE;
|
||||
got_eos = TRUE;
|
||||
break;
|
||||
push_buffer = TRUE;
|
||||
got_eos = TRUE;
|
||||
break;
|
||||
case GST_EVENT_DISCONTINUOUS:
|
||||
dump_buffer = TRUE;
|
||||
break;
|
||||
dump_buffer = TRUE;
|
||||
break;
|
||||
default:
|
||||
gst_pad_event_default (pad, event);
|
||||
return;
|
||||
gst_pad_event_default (pad, event);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -289,37 +290,37 @@ gst_gdk_pixbuf_chain (GstPad * pad, GstData * _data)
|
|||
GError *error = NULL;
|
||||
|
||||
if (!gdk_pixbuf_loader_close (filter->pixbuf_loader, &error)) {
|
||||
GST_ELEMENT_ERROR (filter, LIBRARY, SHUTDOWN, (NULL), (error->message));
|
||||
g_error_free (error);
|
||||
return;
|
||||
GST_ELEMENT_ERROR (filter, LIBRARY, SHUTDOWN, (NULL), (error->message));
|
||||
g_error_free (error);
|
||||
return;
|
||||
}
|
||||
|
||||
pixbuf = gdk_pixbuf_loader_get_pixbuf (filter->pixbuf_loader);
|
||||
|
||||
if (filter->image_size == 0) {
|
||||
GstCaps *caps;
|
||||
GstCaps *caps;
|
||||
|
||||
filter->width = gdk_pixbuf_get_width (pixbuf);
|
||||
filter->height = gdk_pixbuf_get_height (pixbuf);
|
||||
filter->rowstride = gdk_pixbuf_get_rowstride (pixbuf);
|
||||
filter->image_size = filter->rowstride * filter->height;
|
||||
filter->width = gdk_pixbuf_get_width (pixbuf);
|
||||
filter->height = gdk_pixbuf_get_height (pixbuf);
|
||||
filter->rowstride = gdk_pixbuf_get_rowstride (pixbuf);
|
||||
filter->image_size = filter->rowstride * filter->height;
|
||||
|
||||
caps = gst_caps_copy (gst_pad_get_pad_template_caps (filter->srcpad));
|
||||
gst_caps_set_simple (caps,
|
||||
"width", G_TYPE_INT, filter->width,
|
||||
"height", G_TYPE_INT, filter->height,
|
||||
"framerate", G_TYPE_DOUBLE, filter->framerate, NULL);
|
||||
caps = gst_caps_copy (gst_pad_get_pad_template_caps (filter->srcpad));
|
||||
gst_caps_set_simple (caps,
|
||||
"width", G_TYPE_INT, filter->width,
|
||||
"height", G_TYPE_INT, filter->height,
|
||||
"framerate", G_TYPE_DOUBLE, filter->framerate, NULL);
|
||||
|
||||
gst_pad_set_explicit_caps (filter->srcpad, caps);
|
||||
gst_pad_set_explicit_caps (filter->srcpad, caps);
|
||||
}
|
||||
|
||||
outbuf = gst_pad_alloc_buffer (filter->srcpad, GST_BUFFER_OFFSET_NONE,
|
||||
filter->image_size);
|
||||
filter->image_size);
|
||||
GST_BUFFER_TIMESTAMP (outbuf) = GST_BUFFER_TIMESTAMP (buf);
|
||||
GST_BUFFER_DURATION (outbuf) = GST_BUFFER_DURATION (buf);
|
||||
|
||||
memcpy (GST_BUFFER_DATA (outbuf), gdk_pixbuf_get_pixels (pixbuf),
|
||||
filter->image_size);
|
||||
filter->image_size);
|
||||
|
||||
gst_pad_push (filter->srcpad, GST_DATA (outbuf));
|
||||
|
||||
|
@ -344,7 +345,7 @@ gst_gdk_pixbuf_chain (GstPad * pad, GstData * _data)
|
|||
}
|
||||
|
||||
gdk_pixbuf_loader_write (filter->pixbuf_loader, GST_BUFFER_DATA (buf),
|
||||
GST_BUFFER_SIZE (buf), &error);
|
||||
GST_BUFFER_SIZE (buf), &error);
|
||||
gst_buffer_unref (buf);
|
||||
}
|
||||
|
||||
|
@ -450,7 +451,7 @@ plugin_init (GstPlugin * plugin)
|
|||
"gdk pixbuf loader");
|
||||
|
||||
if (!gst_element_register (plugin, "gdkpixbufdec", GST_RANK_NONE,
|
||||
GST_TYPE_GDK_PIXBUF))
|
||||
GST_TYPE_GDK_PIXBUF))
|
||||
return FALSE;
|
||||
|
||||
#ifdef enable_typefind
|
||||
|
|
|
@ -27,11 +27,11 @@ static gboolean
|
|||
plugin_init (GstPlugin * plugin)
|
||||
{
|
||||
if (!gst_element_register (plugin, "jpegenc", GST_RANK_NONE,
|
||||
GST_TYPE_JPEGENC))
|
||||
GST_TYPE_JPEGENC))
|
||||
return FALSE;
|
||||
|
||||
if (!gst_element_register (plugin, "jpegdec", GST_RANK_PRIMARY,
|
||||
GST_TYPE_JPEGDEC))
|
||||
GST_TYPE_JPEGDEC))
|
||||
return FALSE;
|
||||
|
||||
return TRUE;
|
||||
|
|
|
@ -76,9 +76,10 @@ gst_jpegdec_get_type (void)
|
|||
0,
|
||||
(GInstanceInitFunc) gst_jpegdec_init,
|
||||
};
|
||||
|
||||
jpegdec_type =
|
||||
g_type_register_static (GST_TYPE_ELEMENT, "GstJpegDec", &jpegdec_info,
|
||||
0);
|
||||
g_type_register_static (GST_TYPE_ELEMENT, "GstJpegDec", &jpegdec_info,
|
||||
0);
|
||||
}
|
||||
return jpegdec_type;
|
||||
}
|
||||
|
@ -95,8 +96,8 @@ GST_STATIC_PAD_TEMPLATE ("sink",
|
|||
GST_PAD_SINK,
|
||||
GST_PAD_ALWAYS,
|
||||
GST_STATIC_CAPS ("image/jpeg, "
|
||||
"width = (int) [ 16, 4096 ], "
|
||||
"height = (int) [ 16, 4096 ], " "framerate = (double) [ 1, MAX ]")
|
||||
"width = (int) [ 16, 4096 ], "
|
||||
"height = (int) [ 16, 4096 ], " "framerate = (double) [ 1, MAX ]")
|
||||
);
|
||||
|
||||
static void
|
||||
|
@ -417,10 +418,10 @@ gst_jpegdec_chain (GstPad * pad, GstData * _data)
|
|||
jpegdec->height = height;
|
||||
|
||||
caps = gst_caps_new_simple ("video/x-raw-yuv",
|
||||
"format", GST_TYPE_FOURCC, GST_MAKE_FOURCC ('I', '4', '2', '0'),
|
||||
"width", G_TYPE_INT, width,
|
||||
"height", G_TYPE_INT, height,
|
||||
"framerate", G_TYPE_DOUBLE, jpegdec->fps, NULL);
|
||||
"format", GST_TYPE_FOURCC, GST_MAKE_FOURCC ('I', '4', '2', '0'),
|
||||
"width", G_TYPE_INT, width,
|
||||
"height", G_TYPE_INT, height,
|
||||
"framerate", G_TYPE_DOUBLE, jpegdec->fps, NULL);
|
||||
gst_pad_set_explicit_caps (jpegdec->srcpad, caps);
|
||||
gst_caps_free (caps);
|
||||
}
|
||||
|
@ -439,14 +440,14 @@ gst_jpegdec_chain (GstPad * pad, GstData * _data)
|
|||
jpegdec->line[0][j] = base[0];
|
||||
base[0] += width;
|
||||
if (r_v == 2) {
|
||||
jpegdec->line[0][j + 1] = base[0];
|
||||
base[0] += width;
|
||||
jpegdec->line[0][j + 1] = base[0];
|
||||
base[0] += width;
|
||||
}
|
||||
jpegdec->line[1][k] = base[1];
|
||||
jpegdec->line[2][k] = base[2];
|
||||
if (r_v == 2 || k & 1) {
|
||||
base[1] += width2;
|
||||
base[2] += width2;
|
||||
base[1] += width2;
|
||||
base[2] += width2;
|
||||
}
|
||||
}
|
||||
/*g_print ("%d\n", jpegdec->cinfo.output_scanline); */
|
||||
|
|
|
@ -84,9 +84,10 @@ gst_jpegenc_get_type (void)
|
|||
0,
|
||||
(GInstanceInitFunc) gst_jpegenc_init,
|
||||
};
|
||||
|
||||
jpegenc_type =
|
||||
g_type_register_static (GST_TYPE_ELEMENT, "GstJpegEnc", &jpegenc_info,
|
||||
0);
|
||||
g_type_register_static (GST_TYPE_ELEMENT, "GstJpegEnc", &jpegenc_info,
|
||||
0);
|
||||
}
|
||||
return jpegenc_type;
|
||||
}
|
||||
|
@ -103,8 +104,8 @@ GST_STATIC_PAD_TEMPLATE ("src",
|
|||
GST_PAD_SRC,
|
||||
GST_PAD_ALWAYS,
|
||||
GST_STATIC_CAPS ("image/jpeg, "
|
||||
"width = (int) [ 16, 4096 ], "
|
||||
"height = (int) [ 16, 4096 ], " "framerate = (double) [ 1, MAX ]")
|
||||
"width = (int) [ 16, 4096 ], "
|
||||
"height = (int) [ 16, 4096 ], " "framerate = (double) [ 1, MAX ]")
|
||||
);
|
||||
|
||||
static void
|
||||
|
@ -137,12 +138,12 @@ gst_jpegenc_class_init (GstJpegEnc * klass)
|
|||
|
||||
g_object_class_install_property (gobject_class, ARG_QUALITY,
|
||||
g_param_spec_int ("quality", "Quality", "Quality of encoding",
|
||||
0, 100, 85, G_PARAM_READWRITE));
|
||||
0, 100, 85, G_PARAM_READWRITE));
|
||||
#if 0
|
||||
/* disabled, since it doesn't seem to work */
|
||||
g_object_class_install_property (gobject_class, ARG_SMOOTHING,
|
||||
g_param_spec_int ("smoothing", "Smoothing", "Smoothing factor",
|
||||
0, 100, 0, G_PARAM_READWRITE));
|
||||
0, 100, 0, G_PARAM_READWRITE));
|
||||
#endif
|
||||
|
||||
gobject_class->set_property = gst_jpegenc_set_property;
|
||||
|
@ -314,12 +315,12 @@ gst_jpegenc_resync (GstJpegEnc * jpegenc)
|
|||
jpegenc->cinfo.comp_info[2].v_samp_factor = 1;
|
||||
|
||||
if (height != -1) {
|
||||
jpegenc->line[0] =
|
||||
g_realloc (jpegenc->line[0], height * sizeof (char *));
|
||||
jpegenc->line[1] =
|
||||
g_realloc (jpegenc->line[1], height * sizeof (char *) / 2);
|
||||
jpegenc->line[2] =
|
||||
g_realloc (jpegenc->line[2], height * sizeof (char *) / 2);
|
||||
jpegenc->line[0] =
|
||||
g_realloc (jpegenc->line[0], height * sizeof (char *));
|
||||
jpegenc->line[1] =
|
||||
g_realloc (jpegenc->line[1], height * sizeof (char *) / 2);
|
||||
jpegenc->line[2] =
|
||||
g_realloc (jpegenc->line[2], height * sizeof (char *) / 2);
|
||||
}
|
||||
|
||||
GST_DEBUG ("gst_jpegenc_resync: setting format done");
|
||||
|
|
|
@ -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));
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -55,7 +55,7 @@ static GstStaticPadTemplate sink_template = GST_STATIC_PAD_TEMPLATE ("sink",
|
|||
GST_PAD_SINK,
|
||||
GST_PAD_ALWAYS,
|
||||
GST_STATIC_CAPS (GST_VIDEO_CAPS_RGB ";" GST_VIDEO_CAPS_RGBx ";"
|
||||
GST_VIDEO_CAPS_RGB_16 ";" GST_VIDEO_CAPS_RGB_15)
|
||||
GST_VIDEO_CAPS_RGB_16 ";" GST_VIDEO_CAPS_RGB_15)
|
||||
);
|
||||
|
||||
static void gst_cacasink_base_init (gpointer g_class);
|
||||
|
@ -111,13 +111,13 @@ gst_cacasink_get_type (void)
|
|||
};
|
||||
|
||||
cacasink_type =
|
||||
g_type_register_static (GST_TYPE_VIDEOSINK, "GstCACASink",
|
||||
&cacasink_info, 0);
|
||||
g_type_register_static (GST_TYPE_VIDEOSINK, "GstCACASink",
|
||||
&cacasink_info, 0);
|
||||
|
||||
g_type_add_interface_static (cacasink_type, GST_TYPE_IMPLEMENTS_INTERFACE,
|
||||
&iface_info);
|
||||
&iface_info);
|
||||
g_type_add_interface_static (cacasink_type, GST_TYPE_NAVIGATION,
|
||||
&navigation_info);
|
||||
&navigation_info);
|
||||
}
|
||||
return cacasink_type;
|
||||
}
|
||||
|
@ -177,14 +177,14 @@ gst_cacasink_class_init (GstCACASinkClass * klass)
|
|||
|
||||
parent_class = g_type_class_ref (GST_TYPE_ELEMENT);
|
||||
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_SCREEN_WIDTH, g_param_spec_int ("screen_width", "screen_width", "screen_width", G_MININT, G_MAXINT, 0, G_PARAM_READABLE)); /* CHECKME */
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_SCREEN_HEIGHT, g_param_spec_int ("screen_height", "screen_height", "screen_height", G_MININT, G_MAXINT, 0, G_PARAM_READABLE)); /* CHECKME */
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_SCREEN_WIDTH, g_param_spec_int ("screen_width", "screen_width", "screen_width", G_MININT, G_MAXINT, 0, G_PARAM_READABLE)); /* CHECKME */
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_SCREEN_HEIGHT, g_param_spec_int ("screen_height", "screen_height", "screen_height", G_MININT, G_MAXINT, 0, G_PARAM_READABLE)); /* CHECKME */
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_DITHER,
|
||||
g_param_spec_enum ("dither", "Dither Type", "Set type of Dither",
|
||||
GST_TYPE_CACADITHER, 0, G_PARAM_READWRITE));
|
||||
GST_TYPE_CACADITHER, 0, G_PARAM_READWRITE));
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_ANTIALIASING,
|
||||
g_param_spec_boolean ("anti_aliasing", "Anti-Aliasing",
|
||||
"Enables Anti-Aliasing", TRUE, G_PARAM_READWRITE));
|
||||
"Enables Anti-Aliasing", TRUE, G_PARAM_READWRITE));
|
||||
|
||||
gobject_class->set_property = gst_cacasink_set_property;
|
||||
gobject_class->get_property = gst_cacasink_get_property;
|
||||
|
@ -333,8 +333,8 @@ gst_cacasink_chain (GstPad * pad, GstData * _data)
|
|||
|
||||
if (cacasink->id && GST_CLOCK_TIME_IS_VALID (time)) {
|
||||
GST_DEBUG ("videosink: clock %s wait: %" G_GUINT64_FORMAT " %u",
|
||||
GST_OBJECT_NAME (GST_VIDEOSINK_CLOCK (cacasink)),
|
||||
time, GST_BUFFER_SIZE (buf));
|
||||
GST_OBJECT_NAME (GST_VIDEOSINK_CLOCK (cacasink)),
|
||||
time, GST_BUFFER_SIZE (buf));
|
||||
gst_element_wait (GST_ELEMENT (cacasink), GST_BUFFER_TIMESTAMP (buf));
|
||||
}
|
||||
|
||||
|
@ -388,11 +388,11 @@ gst_cacasink_set_property (GObject * object, guint prop_id,
|
|||
case ARG_ANTIALIASING:{
|
||||
cacasink->antialiasing = g_value_get_boolean (value);
|
||||
if (cacasink->antialiasing) {
|
||||
caca_set_feature (CACA_ANTIALIASING_MAX);
|
||||
caca_set_feature (CACA_ANTIALIASING_MAX);
|
||||
}
|
||||
|
||||
else {
|
||||
caca_set_feature (CACA_ANTIALIASING_MIN);
|
||||
caca_set_feature (CACA_ANTIALIASING_MIN);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -463,7 +463,7 @@ gst_cacasink_change_state (GstElement * element)
|
|||
} else {
|
||||
if (!GST_FLAG_IS_SET (element, GST_CACASINK_OPEN)) {
|
||||
if (!gst_cacasink_open (GST_CACASINK (element)))
|
||||
return GST_STATE_FAILURE;
|
||||
return GST_STATE_FAILURE;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -481,7 +481,7 @@ plugin_init (GstPlugin * plugin)
|
|||
return FALSE;
|
||||
|
||||
if (!gst_element_register (plugin, "cacasink", GST_RANK_NONE,
|
||||
GST_TYPE_CACASINK))
|
||||
GST_TYPE_CACASINK))
|
||||
return FALSE;
|
||||
|
||||
return TRUE;
|
||||
|
|
|
@ -90,7 +90,7 @@ gst_pngenc_get_type (void)
|
|||
};
|
||||
|
||||
pngenc_type = g_type_register_static (GST_TYPE_ELEMENT, "GstPngEnc",
|
||||
&pngenc_info, 0);
|
||||
&pngenc_info, 0);
|
||||
}
|
||||
return pngenc_type;
|
||||
}
|
||||
|
@ -245,7 +245,7 @@ gst_pngenc_chain (GstPad * pad, GstData * _data)
|
|||
pngenc->png_info_ptr = png_create_info_struct (pngenc->png_struct_ptr);
|
||||
if (!pngenc->png_info_ptr) {
|
||||
png_destroy_read_struct (&(pngenc->png_struct_ptr), (png_infopp) NULL,
|
||||
(png_infopp) NULL);
|
||||
(png_infopp) NULL);
|
||||
}
|
||||
|
||||
/* non-0 return is from a longjmp inside of libpng */
|
||||
|
@ -273,7 +273,7 @@ gst_pngenc_chain (GstPad * pad, GstData * _data)
|
|||
|
||||
for (row_index = 0; row_index < pngenc->height; row_index++)
|
||||
row_pointers[row_index] = GST_BUFFER_DATA (buf) +
|
||||
(pngenc->width * row_index * pngenc->bpp / 8);
|
||||
(pngenc->width * row_index * pngenc->bpp / 8);
|
||||
|
||||
png_write_info (pngenc->png_struct_ptr, pngenc->png_info_ptr);
|
||||
png_write_image (pngenc->png_struct_ptr, row_pointers);
|
||||
|
|
|
@ -68,18 +68,18 @@ static GstStaticPadTemplate mikmod_src_factory = GST_STATIC_PAD_TEMPLATE ("src",
|
|||
GST_PAD_SRC,
|
||||
GST_PAD_ALWAYS,
|
||||
GST_STATIC_CAPS ("audio/x-raw-int, "
|
||||
"endianness = (int) BYTE_ORDER, "
|
||||
"signed = (boolean) TRUE, "
|
||||
"width = (int) 16, "
|
||||
"depth = (int) 16, "
|
||||
"rate = (int) { 8000, 11025, 22050, 44100 }, "
|
||||
"channels = (int) [ 1, 2 ]; "
|
||||
"audio/x-raw-int, "
|
||||
"signed = (boolean) FALSE, "
|
||||
"width = (int) 8, "
|
||||
"depth = (int) 8, "
|
||||
"rate = (int) { 8000, 11025, 22050, 44100 }, "
|
||||
"channels = (int) [ 1, 2 ]")
|
||||
"endianness = (int) BYTE_ORDER, "
|
||||
"signed = (boolean) TRUE, "
|
||||
"width = (int) 16, "
|
||||
"depth = (int) 16, "
|
||||
"rate = (int) { 8000, 11025, 22050, 44100 }, "
|
||||
"channels = (int) [ 1, 2 ]; "
|
||||
"audio/x-raw-int, "
|
||||
"signed = (boolean) FALSE, "
|
||||
"width = (int) 8, "
|
||||
"depth = (int) 8, "
|
||||
"rate = (int) { 8000, 11025, 22050, 44100 }, "
|
||||
"channels = (int) [ 1, 2 ]")
|
||||
);
|
||||
|
||||
static GstStaticPadTemplate mikmod_sink_factory =
|
||||
|
@ -123,8 +123,9 @@ gst_mikmod_get_type (void)
|
|||
0,
|
||||
(GInstanceInitFunc) gst_mikmod_init,
|
||||
};
|
||||
|
||||
mikmod_type =
|
||||
g_type_register_static (GST_TYPE_ELEMENT, "GstMikmod", &mikmod_info, 0);
|
||||
g_type_register_static (GST_TYPE_ELEMENT, "GstMikmod", &mikmod_info, 0);
|
||||
}
|
||||
return mikmod_type;
|
||||
}
|
||||
|
@ -154,44 +155,44 @@ gst_mikmod_class_init (GstMikModClass * klass)
|
|||
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_SONGNAME,
|
||||
g_param_spec_string ("songname", "songname", "songname",
|
||||
NULL, G_PARAM_READABLE));
|
||||
NULL, G_PARAM_READABLE));
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_MODTYPE,
|
||||
g_param_spec_string ("modtype", "modtype", "modtype",
|
||||
NULL, G_PARAM_READABLE));
|
||||
NULL, G_PARAM_READABLE));
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_MUSICVOLUME,
|
||||
g_param_spec_int ("musicvolume", "musivolume", "musicvolume",
|
||||
0, 128, 128, G_PARAM_READWRITE));
|
||||
0, 128, 128, G_PARAM_READWRITE));
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_PANSEP,
|
||||
g_param_spec_int ("pansep", "pansep", "pansep",
|
||||
0, 128, 128, G_PARAM_READWRITE));
|
||||
0, 128, 128, G_PARAM_READWRITE));
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_REVERB,
|
||||
g_param_spec_int ("reverb", "reverb", "reverb",
|
||||
0, 15, 0, G_PARAM_READWRITE));
|
||||
0, 15, 0, G_PARAM_READWRITE));
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_SNDFXVOLUME,
|
||||
g_param_spec_int ("sndfxvolume", "sndfxvolume", "sndfxvolume",
|
||||
0, 128, 128, G_PARAM_READWRITE));
|
||||
0, 128, 128, G_PARAM_READWRITE));
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_VOLUME,
|
||||
g_param_spec_int ("volume", "volume", "volume",
|
||||
0, 128, 96, G_PARAM_READWRITE));
|
||||
0, 128, 96, G_PARAM_READWRITE));
|
||||
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_INTERP,
|
||||
g_param_spec_boolean ("interp", "interp", "interp",
|
||||
FALSE, G_PARAM_READWRITE));
|
||||
FALSE, G_PARAM_READWRITE));
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_REVERSE,
|
||||
g_param_spec_boolean ("reverse", "reverse", "reverse",
|
||||
FALSE, G_PARAM_READWRITE));
|
||||
FALSE, G_PARAM_READWRITE));
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_SURROUND,
|
||||
g_param_spec_boolean ("surround", "surround", "surround",
|
||||
TRUE, G_PARAM_READWRITE));
|
||||
TRUE, G_PARAM_READWRITE));
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_HQMIXER,
|
||||
g_param_spec_boolean ("hqmixer", "hqmixer", "hqmixer",
|
||||
FALSE, G_PARAM_READWRITE));
|
||||
FALSE, G_PARAM_READWRITE));
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_SOFT_MUSIC,
|
||||
g_param_spec_boolean ("soft_music", "soft_music", "soft_music",
|
||||
TRUE, G_PARAM_READWRITE));
|
||||
TRUE, G_PARAM_READWRITE));
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_SOFT_SNDFX,
|
||||
g_param_spec_boolean ("soft_sndfx", "soft_sndfx", "soft_sndfx",
|
||||
TRUE, G_PARAM_READWRITE));
|
||||
TRUE, G_PARAM_READWRITE));
|
||||
|
||||
|
||||
gobject_class->set_property = gst_mikmod_set_property;
|
||||
|
@ -296,28 +297,28 @@ gst_mikmod_loop (GstElement * element)
|
|||
if (!mikmod->initialized) {
|
||||
while ((buffer_in = GST_BUFFER (gst_pad_pull (mikmod->sinkpad)))) {
|
||||
if (GST_IS_EVENT (buffer_in)) {
|
||||
GstEvent *event = GST_EVENT (buffer_in);
|
||||
GstEvent *event = GST_EVENT (buffer_in);
|
||||
|
||||
if (GST_EVENT_TYPE (event) == GST_EVENT_EOS)
|
||||
break;
|
||||
if (GST_EVENT_TYPE (event) == GST_EVENT_EOS)
|
||||
break;
|
||||
} else {
|
||||
if (mikmod->Buffer) {
|
||||
GstBuffer *merge;
|
||||
if (mikmod->Buffer) {
|
||||
GstBuffer *merge;
|
||||
|
||||
merge = gst_buffer_merge (mikmod->Buffer, buffer_in);
|
||||
gst_buffer_unref (buffer_in);
|
||||
gst_buffer_unref (mikmod->Buffer);
|
||||
mikmod->Buffer = merge;
|
||||
} else {
|
||||
mikmod->Buffer = buffer_in;
|
||||
}
|
||||
merge = gst_buffer_merge (mikmod->Buffer, buffer_in);
|
||||
gst_buffer_unref (buffer_in);
|
||||
gst_buffer_unref (mikmod->Buffer);
|
||||
mikmod->Buffer = merge;
|
||||
} else {
|
||||
mikmod->Buffer = buffer_in;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!GST_PAD_CAPS (mikmod->srcpad)) {
|
||||
if (GST_PAD_LINK_SUCCESSFUL (gst_pad_renegotiate (mikmod->srcpad))) {
|
||||
GST_ELEMENT_ERROR (mikmod, CORE, NEGOTIATION, (NULL), (NULL));
|
||||
return;
|
||||
GST_ELEMENT_ERROR (mikmod, CORE, NEGOTIATION, (NULL), (NULL));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -541,7 +542,7 @@ static gboolean
|
|||
plugin_init (GstPlugin * plugin)
|
||||
{
|
||||
if (!gst_element_register (plugin, "mikmod", GST_RANK_SECONDARY,
|
||||
GST_TYPE_MIKMOD))
|
||||
GST_TYPE_MIKMOD))
|
||||
return FALSE;
|
||||
|
||||
return TRUE;
|
||||
|
|
|
@ -23,8 +23,8 @@
|
|||
|
||||
#include <gst/gst.h>
|
||||
#include "mikmod_types.h"
|
||||
#include <string.h> /* memcmp */
|
||||
#include <ctype.h> /* isdigit */
|
||||
#include <string.h> /* memcmp */
|
||||
#include <ctype.h> /* isdigit */
|
||||
|
||||
#define MODULEHEADERSIZE 0x438
|
||||
|
||||
|
|
|
@ -34,8 +34,8 @@ GST_STATIC_PAD_TEMPLATE ("src",
|
|||
GST_PAD_SRC,
|
||||
GST_PAD_ALWAYS,
|
||||
GST_STATIC_CAPS ("video/x-raw-yuv, "
|
||||
"format = (fourcc) I420, "
|
||||
"width = (int) [ 1, MAX ], " "height = (int) [ 1, MAX ]")
|
||||
"format = (fourcc) I420, "
|
||||
"width = (int) [ 1, MAX ], " "height = (int) [ 1, MAX ]")
|
||||
);
|
||||
|
||||
static GstStaticPadTemplate video_sink_template_factory =
|
||||
|
@ -43,8 +43,8 @@ GST_STATIC_PAD_TEMPLATE ("video_sink",
|
|||
GST_PAD_SINK,
|
||||
GST_PAD_ALWAYS,
|
||||
GST_STATIC_CAPS ("video/x-raw-yuv, "
|
||||
"format = (fourcc) I420, "
|
||||
"width = (int) [ 1, MAX ], " "height = (int) [ 1, MAX ]")
|
||||
"format = (fourcc) I420, "
|
||||
"width = (int) [ 1, MAX ], " "height = (int) [ 1, MAX ]")
|
||||
);
|
||||
|
||||
static GstStaticPadTemplate text_sink_template_factory =
|
||||
|
@ -88,9 +88,10 @@ gst_textoverlay_get_type (void)
|
|||
0,
|
||||
(GInstanceInitFunc) gst_textoverlay_init,
|
||||
};
|
||||
|
||||
textoverlay_type =
|
||||
g_type_register_static (GST_TYPE_ELEMENT, "GstTextOverlay",
|
||||
&textoverlay_info, 0);
|
||||
g_type_register_static (GST_TYPE_ELEMENT, "GstTextOverlay",
|
||||
&textoverlay_info, 0);
|
||||
}
|
||||
return textoverlay_type;
|
||||
}
|
||||
|
@ -129,35 +130,35 @@ gst_textoverlay_class_init (GstTextOverlayClass * klass)
|
|||
klass->pango_context = pango_ft2_get_context (72, 72);
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_TEXT,
|
||||
g_param_spec_string ("text", "text",
|
||||
"Text to be display,"
|
||||
" in pango markup format.", "", G_PARAM_WRITABLE));
|
||||
"Text to be display,"
|
||||
" in pango markup format.", "", G_PARAM_WRITABLE));
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_VALIGN,
|
||||
g_param_spec_string ("valign", "vertical alignment",
|
||||
"Vertical alignment of the text. "
|
||||
"Can be either 'baseline', 'bottom', or 'top'",
|
||||
"baseline", G_PARAM_WRITABLE));
|
||||
"Vertical alignment of the text. "
|
||||
"Can be either 'baseline', 'bottom', or 'top'",
|
||||
"baseline", G_PARAM_WRITABLE));
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_HALIGN,
|
||||
g_param_spec_string ("halign", "horizontal alignment",
|
||||
"Horizontal alignment of the text. "
|
||||
"Can be either 'left', 'right', or 'center'",
|
||||
"center", G_PARAM_WRITABLE));
|
||||
"Horizontal alignment of the text. "
|
||||
"Can be either 'left', 'right', or 'center'",
|
||||
"center", G_PARAM_WRITABLE));
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_X0,
|
||||
g_param_spec_int ("x0", "X position",
|
||||
"Initial X position."
|
||||
" Horizontal aligment takes this point"
|
||||
" as reference.", G_MININT, G_MAXINT, 0, G_PARAM_WRITABLE));
|
||||
"Initial X position."
|
||||
" Horizontal aligment takes this point"
|
||||
" as reference.", G_MININT, G_MAXINT, 0, G_PARAM_WRITABLE));
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_Y0,
|
||||
g_param_spec_int ("y0", "Y position",
|
||||
"Initial Y position."
|
||||
" Vertical aligment takes this point"
|
||||
" as reference.", G_MININT, G_MAXINT, 0, G_PARAM_WRITABLE));
|
||||
"Initial Y position."
|
||||
" Vertical aligment takes this point"
|
||||
" as reference.", G_MININT, G_MAXINT, 0, G_PARAM_WRITABLE));
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_FONT_DESC,
|
||||
g_param_spec_string ("font-desc", "font description",
|
||||
"Pango font description of font "
|
||||
"to be used for rendering. "
|
||||
"See documentation of "
|
||||
"pango_font_description_from_string"
|
||||
" for syntax.", "", G_PARAM_WRITABLE));
|
||||
"Pango font description of font "
|
||||
"to be used for rendering. "
|
||||
"See documentation of "
|
||||
"pango_font_description_from_string"
|
||||
" for syntax.", "", G_PARAM_WRITABLE));
|
||||
}
|
||||
|
||||
|
||||
|
@ -231,22 +232,22 @@ static void
|
|||
gst_text_overlay_blit_yuv420 (GstTextOverlay * overlay, FT_Bitmap * bitmap,
|
||||
guchar * pixbuf, int x0, int y0)
|
||||
{
|
||||
int y; /* text bitmap coordinates */
|
||||
int x1, y1; /* video buffer coordinates */
|
||||
int y; /* text bitmap coordinates */
|
||||
int x1, y1; /* video buffer coordinates */
|
||||
int rowinc, bit_rowinc, uv_rowinc;
|
||||
guchar *p, *bitp, *u_p;
|
||||
int video_width = overlay->width, video_height = overlay->height;
|
||||
int bitmap_x0 = x0 < 1 ? -(x0 - 1) : 1; /* 1 pixel border */
|
||||
int bitmap_y0 = y0 < 1 ? -(y0 - 1) : 1; /* 1 pixel border */
|
||||
int bitmap_x0 = x0 < 1 ? -(x0 - 1) : 1; /* 1 pixel border */
|
||||
int bitmap_y0 = y0 < 1 ? -(y0 - 1) : 1; /* 1 pixel border */
|
||||
int bitmap_width = bitmap->width - bitmap_x0;
|
||||
int bitmap_height = bitmap->rows - bitmap_y0;
|
||||
int u_plane_size;
|
||||
int skip_y, skip_x;
|
||||
guchar v;
|
||||
|
||||
if (x0 + bitmap_x0 + bitmap_width > video_width - 1) /* 1 pixel border */
|
||||
if (x0 + bitmap_x0 + bitmap_width > video_width - 1) /* 1 pixel border */
|
||||
bitmap_width -= x0 + bitmap_x0 + bitmap_width - video_width + 1;
|
||||
if (y0 + bitmap_y0 + bitmap_height > video_height - 1) /* 1 pixel border */
|
||||
if (y0 + bitmap_y0 + bitmap_height > video_height - 1) /* 1 pixel border */
|
||||
bitmap_height -= y0 + bitmap_y0 + bitmap_height - video_height + 1;
|
||||
|
||||
rowinc = video_width - bitmap_width;
|
||||
|
@ -264,10 +265,10 @@ gst_text_overlay_blit_yuv420 (GstTextOverlay * overlay, FT_Bitmap * bitmap,
|
|||
for (n = bitmap_width; n > 0; --n) {
|
||||
v = *bitp;
|
||||
if (v) {
|
||||
p[-1] = CLAMP (p[-1] - v, 0, 255);
|
||||
p[1] = CLAMP (p[1] - v, 0, 255);
|
||||
p[-video_width] = CLAMP (p[-video_width] - v, 0, 255);
|
||||
p[video_width] = CLAMP (p[video_width] - v, 0, 255);
|
||||
p[-1] = CLAMP (p[-1] - v, 0, 255);
|
||||
p[1] = CLAMP (p[1] - v, 0, 255);
|
||||
p[-video_width] = CLAMP (p[-video_width] - v, 0, 255);
|
||||
p[video_width] = CLAMP (p[video_width] - v, 0, 255);
|
||||
}
|
||||
p++;
|
||||
bitp++;
|
||||
|
@ -295,15 +296,15 @@ gst_text_overlay_blit_yuv420 (GstTextOverlay * overlay, FT_Bitmap * bitmap,
|
|||
for (n = bitmap_width; n > 0; --n) {
|
||||
v = *bitp;
|
||||
if (v) {
|
||||
*p = v;
|
||||
if (!skip_y) {
|
||||
u_p[0] = u_p[u_plane_size] = 0x80;
|
||||
}
|
||||
*p = v;
|
||||
if (!skip_y) {
|
||||
u_p[0] = u_p[u_plane_size] = 0x80;
|
||||
}
|
||||
}
|
||||
if (!skip_y) {
|
||||
skip_x = !skip_x;
|
||||
if (!skip_x)
|
||||
u_p++;
|
||||
skip_x = !skip_x;
|
||||
if (!skip_x)
|
||||
u_p++;
|
||||
}
|
||||
p++;
|
||||
bitp++;
|
||||
|
@ -414,7 +415,7 @@ gst_textoverlay_loop (GstElement * element)
|
|||
|
||||
if (overlay->next_buffer &&
|
||||
(GST_BUFFER_TIMESTAMP (overlay->next_buffer) <= now ||
|
||||
GST_BUFFER_TIMESTAMP (overlay->next_buffer) == GST_CLOCK_TIME_NONE)) {
|
||||
GST_BUFFER_TIMESTAMP (overlay->next_buffer) == GST_CLOCK_TIME_NONE)) {
|
||||
GST_DEBUG ("using new buffer");
|
||||
|
||||
if (overlay->current_buffer) {
|
||||
|
@ -424,11 +425,11 @@ gst_textoverlay_loop (GstElement * element)
|
|||
overlay->next_buffer = NULL;
|
||||
|
||||
GST_DEBUG ("rendering '%*s'",
|
||||
GST_BUFFER_SIZE (overlay->current_buffer),
|
||||
GST_BUFFER_DATA (overlay->current_buffer));
|
||||
GST_BUFFER_SIZE (overlay->current_buffer),
|
||||
GST_BUFFER_DATA (overlay->current_buffer));
|
||||
pango_layout_set_markup (overlay->layout,
|
||||
GST_BUFFER_DATA (overlay->current_buffer),
|
||||
GST_BUFFER_SIZE (overlay->current_buffer));
|
||||
GST_BUFFER_DATA (overlay->current_buffer),
|
||||
GST_BUFFER_SIZE (overlay->current_buffer));
|
||||
render_text (overlay);
|
||||
overlay->need_render = FALSE;
|
||||
}
|
||||
|
@ -445,7 +446,7 @@ gst_textoverlay_loop (GstElement * element)
|
|||
if (overlay->need_render) {
|
||||
GST_DEBUG ("rendering '%s'", overlay->default_text);
|
||||
pango_layout_set_markup (overlay->layout,
|
||||
overlay->default_text, strlen (overlay->default_text));
|
||||
overlay->default_text, strlen (overlay->default_text));
|
||||
render_text (overlay);
|
||||
|
||||
overlay->need_render = FALSE;
|
||||
|
@ -547,7 +548,7 @@ gst_textoverlay_set_property (GObject * object, guint prop_id,
|
|||
|
||||
case ARG_TEXT:
|
||||
if (overlay->default_text) {
|
||||
g_free (overlay->default_text);
|
||||
g_free (overlay->default_text);
|
||||
}
|
||||
overlay->default_text = g_strdup (g_value_get_string (value));
|
||||
overlay->need_render = TRUE;
|
||||
|
@ -555,26 +556,26 @@ gst_textoverlay_set_property (GObject * object, guint prop_id,
|
|||
|
||||
case ARG_VALIGN:
|
||||
if (strcasecmp (g_value_get_string (value), "baseline") == 0)
|
||||
overlay->valign = GST_TEXT_OVERLAY_VALIGN_BASELINE;
|
||||
overlay->valign = GST_TEXT_OVERLAY_VALIGN_BASELINE;
|
||||
else if (strcasecmp (g_value_get_string (value), "bottom") == 0)
|
||||
overlay->valign = GST_TEXT_OVERLAY_VALIGN_BOTTOM;
|
||||
overlay->valign = GST_TEXT_OVERLAY_VALIGN_BOTTOM;
|
||||
else if (strcasecmp (g_value_get_string (value), "top") == 0)
|
||||
overlay->valign = GST_TEXT_OVERLAY_VALIGN_TOP;
|
||||
overlay->valign = GST_TEXT_OVERLAY_VALIGN_TOP;
|
||||
else
|
||||
g_warning ("Invalid 'valign' property value: %s",
|
||||
g_value_get_string (value));
|
||||
g_warning ("Invalid 'valign' property value: %s",
|
||||
g_value_get_string (value));
|
||||
break;
|
||||
|
||||
case ARG_HALIGN:
|
||||
if (strcasecmp (g_value_get_string (value), "left") == 0)
|
||||
overlay->halign = GST_TEXT_OVERLAY_HALIGN_LEFT;
|
||||
overlay->halign = GST_TEXT_OVERLAY_HALIGN_LEFT;
|
||||
else if (strcasecmp (g_value_get_string (value), "right") == 0)
|
||||
overlay->halign = GST_TEXT_OVERLAY_HALIGN_RIGHT;
|
||||
overlay->halign = GST_TEXT_OVERLAY_HALIGN_RIGHT;
|
||||
else if (strcasecmp (g_value_get_string (value), "center") == 0)
|
||||
overlay->halign = GST_TEXT_OVERLAY_HALIGN_CENTER;
|
||||
overlay->halign = GST_TEXT_OVERLAY_HALIGN_CENTER;
|
||||
else
|
||||
g_warning ("Invalid 'halign' property value: %s",
|
||||
g_value_get_string (value));
|
||||
g_warning ("Invalid 'halign' property value: %s",
|
||||
g_value_get_string (value));
|
||||
break;
|
||||
|
||||
case ARG_X0:
|
||||
|
@ -591,13 +592,13 @@ gst_textoverlay_set_property (GObject * object, guint prop_id,
|
|||
|
||||
desc = pango_font_description_from_string (g_value_get_string (value));
|
||||
if (desc) {
|
||||
g_message ("font description set: %s", g_value_get_string (value));
|
||||
pango_layout_set_font_description (overlay->layout, desc);
|
||||
pango_font_description_free (desc);
|
||||
render_text (overlay);
|
||||
g_message ("font description set: %s", g_value_get_string (value));
|
||||
pango_layout_set_font_description (overlay->layout, desc);
|
||||
pango_font_description_free (desc);
|
||||
render_text (overlay);
|
||||
} else
|
||||
g_warning ("font description parse failed: %s",
|
||||
g_value_get_string (value));
|
||||
g_warning ("font description parse failed: %s",
|
||||
g_value_get_string (value));
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -627,7 +628,7 @@ static gboolean
|
|||
plugin_init (GstPlugin * plugin)
|
||||
{
|
||||
if (!gst_element_register (plugin, "textoverlay", GST_RANK_PRIMARY,
|
||||
GST_TYPE_TEXTOVERLAY))
|
||||
GST_TYPE_TEXTOVERLAY))
|
||||
return FALSE;
|
||||
|
||||
/*texttestsrc_plugin_init(module, plugin); */
|
||||
|
|
|
@ -87,8 +87,9 @@ gst_timeoverlay_get_type (void)
|
|||
0,
|
||||
gst_timeoverlay_init,
|
||||
};
|
||||
|
||||
timeoverlay_type = g_type_register_static (GST_TYPE_VIDEOFILTER,
|
||||
"GstTimeoverlay", &timeoverlay_info, 0);
|
||||
"GstTimeoverlay", &timeoverlay_info, 0);
|
||||
}
|
||||
return timeoverlay_type;
|
||||
}
|
||||
|
@ -114,7 +115,7 @@ gst_timeoverlay_base_init (gpointer g_class)
|
|||
|
||||
for (i = 0; i < G_N_ELEMENTS (gst_timeoverlay_formats); i++) {
|
||||
gst_videofilter_class_add_format (videofilter_class,
|
||||
gst_timeoverlay_formats + i);
|
||||
gst_timeoverlay_formats + i);
|
||||
}
|
||||
|
||||
gst_videofilter_class_add_pad_templates (GST_VIDEOFILTER_CLASS (g_class));
|
||||
|
@ -132,8 +133,8 @@ gst_timeoverlay_class_init (gpointer g_class, gpointer class_data)
|
|||
#if 0
|
||||
g_object_class_install_property (gobject_class, ARG_METHOD,
|
||||
g_param_spec_enum ("method", "method", "method",
|
||||
GST_TYPE_TIMEOVERLAY_METHOD, GST_TIMEOVERLAY_METHOD_1,
|
||||
G_PARAM_READWRITE));
|
||||
GST_TYPE_TIMEOVERLAY_METHOD, GST_TIMEOVERLAY_METHOD_1,
|
||||
G_PARAM_READWRITE));
|
||||
#endif
|
||||
|
||||
gobject_class->set_property = gst_timeoverlay_set_property;
|
||||
|
@ -293,7 +294,7 @@ gst_timeoverlay_planar411 (GstVideofilter * videofilter, void *dest, void *src)
|
|||
layout = pango_layout_new (timeoverlay->context);
|
||||
string =
|
||||
gst_timeoverlay_print_smpte_time (GST_BUFFER_TIMESTAMP (videofilter->
|
||||
in_buf));
|
||||
in_buf));
|
||||
pango_layout_set_text (layout, string, strlen (string));
|
||||
g_free (string);
|
||||
|
||||
|
@ -314,7 +315,7 @@ gst_timeoverlay_planar411 (GstVideofilter * videofilter, void *dest, void *src)
|
|||
for (i = 0; i < b_height / 2; i++) {
|
||||
memset (dest + width * height + i * (width / 2), 128, b_width / 2);
|
||||
memset (dest + width * height + (width / 2) * (height / 2) +
|
||||
i * (width / 2), 128, b_width / 2);
|
||||
i * (width / 2), 128, b_width / 2);
|
||||
}
|
||||
bitmap.rows = b_height;
|
||||
bitmap.width = b_width;
|
||||
|
|
|
@ -30,7 +30,7 @@ static gboolean
|
|||
plugin_init (GstPlugin * plugin)
|
||||
{
|
||||
if (!gst_element_register (plugin, "dv1394src", GST_RANK_NONE,
|
||||
GST_TYPE_DV1394SRC))
|
||||
GST_TYPE_DV1394SRC))
|
||||
return FALSE;
|
||||
|
||||
return TRUE;
|
||||
|
|
|
@ -60,14 +60,14 @@ gst_dv1394src_factory (void)
|
|||
|
||||
if (!template) {
|
||||
template = gst_pad_template_new ("src",
|
||||
GST_PAD_SRC,
|
||||
GST_PAD_ALWAYS,
|
||||
GST_STATIC_CAPS ("dv1394src",
|
||||
"video/dv",
|
||||
gst_props_new ("format", GST_PROPS_LIST (G_TYPE_STRING ("NTSC"),
|
||||
G_TYPE_STRING ("PAL")
|
||||
), NULL)
|
||||
), NULL);
|
||||
GST_PAD_SRC,
|
||||
GST_PAD_ALWAYS,
|
||||
GST_STATIC_CAPS ("dv1394src",
|
||||
"video/dv",
|
||||
gst_props_new ("format", GST_PROPS_LIST (G_TYPE_STRING ("NTSC"),
|
||||
G_TYPE_STRING ("PAL")
|
||||
), NULL)
|
||||
), NULL);
|
||||
}
|
||||
return template;
|
||||
}
|
||||
|
@ -107,9 +107,10 @@ gst_dv1394src_get_type (void)
|
|||
0,
|
||||
(GInstanceInitFunc) gst_dv1394src_init,
|
||||
};
|
||||
|
||||
gst_dv1394src_type =
|
||||
g_type_register_static (GST_TYPE_ELEMENT, "DV1394Src",
|
||||
&gst_dv1394src_info, 0);
|
||||
g_type_register_static (GST_TYPE_ELEMENT, "DV1394Src",
|
||||
&gst_dv1394src_info, 0);
|
||||
}
|
||||
return gst_dv1394src_type;
|
||||
}
|
||||
|
@ -133,14 +134,14 @@ gst_dv1394src_class_init (GstDV1394SrcClass * klass)
|
|||
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_CONSECUTIVE,
|
||||
g_param_spec_int ("consecutive", "consecutive frames",
|
||||
"send n consecutive frames after skipping", 1, G_MAXINT, 1,
|
||||
G_PARAM_READWRITE));
|
||||
"send n consecutive frames after skipping", 1, G_MAXINT, 1,
|
||||
G_PARAM_READWRITE));
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_SKIP,
|
||||
g_param_spec_int ("skip", "skip frames", "skip n frames", 0, G_MAXINT, 1,
|
||||
G_PARAM_READWRITE));
|
||||
G_PARAM_READWRITE));
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_DROP_INCOMPLETE,
|
||||
g_param_spec_boolean ("drop_incomplete", "drop_incomplete",
|
||||
"drop incomplete frames", TRUE, G_PARAM_READWRITE));
|
||||
"drop incomplete frames", TRUE, G_PARAM_READWRITE));
|
||||
|
||||
parent_class = g_type_class_ref (GST_TYPE_ELEMENT);
|
||||
|
||||
|
@ -235,58 +236,58 @@ gst_dv1394src_iso_receive (raw1394handle_t handle, int channel, size_t len,
|
|||
the following code taken from kino-0.51 (Dan Dennedy/Charles Yates)
|
||||
*/
|
||||
unsigned char *p = (unsigned char *) &data[3];
|
||||
int section_type = p[0] >> 5; /* section type is in bits 5 - 7 */
|
||||
int dif_sequence = p[1] >> 4; /* dif sequence number is in bits 4 - 7 */
|
||||
int section_type = p[0] >> 5; /* section type is in bits 5 - 7 */
|
||||
int dif_sequence = p[1] >> 4; /* dif sequence number is in bits 4 - 7 */
|
||||
int dif_block = p[2];
|
||||
|
||||
/* if we are at the beginning of a frame,
|
||||
we set buf=frame, and alloc a new buffer for frame
|
||||
*/
|
||||
|
||||
if (section_type == 0 && dif_sequence == 0) { // dif header
|
||||
if (section_type == 0 && dif_sequence == 0) { // dif header
|
||||
|
||||
if (!dv1394src->negotiated) {
|
||||
// figure format (NTSC/PAL)
|
||||
if (p[3] & 0x80) {
|
||||
// PAL
|
||||
dv1394src->frameSize = PAL_FRAMESIZE;
|
||||
GST_DEBUG ("PAL data");
|
||||
if (gst_pad_try_set_caps (dv1394src->srcpad,
|
||||
gst_caps_new_simple ("video/dv",
|
||||
"format", G_TYPE_STRING, "PAL", NULL)) <= 0) {
|
||||
GST_ELEMENT_ERROR (dv1394src, CORE, NEGOTIATION, (NULL),
|
||||
("Could not set source caps for PAL"));
|
||||
return 0;
|
||||
}
|
||||
} else {
|
||||
// NTSC (untested)
|
||||
dv1394src->frameSize = NTSC_FRAMESIZE;
|
||||
GST_DEBUG
|
||||
("NTSC data [untested] - please report success/failure to <dan@f3c.com>");
|
||||
if (gst_pad_try_set_caps (dv1394src->srcpad,
|
||||
gst_caps_new_simple ("video/dv", "format", G_TYPE_STRING,
|
||||
"NTSC", NULL)) <= 0) {
|
||||
GST_ELEMENT_ERROR (dv1394src, CORE, NEGOTIATION, (NULL),
|
||||
("Could not set source caps for NTSC"));
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
dv1394src->negotiated = TRUE;
|
||||
// figure format (NTSC/PAL)
|
||||
if (p[3] & 0x80) {
|
||||
// PAL
|
||||
dv1394src->frameSize = PAL_FRAMESIZE;
|
||||
GST_DEBUG ("PAL data");
|
||||
if (gst_pad_try_set_caps (dv1394src->srcpad,
|
||||
gst_caps_new_simple ("video/dv",
|
||||
"format", G_TYPE_STRING, "PAL", NULL)) <= 0) {
|
||||
GST_ELEMENT_ERROR (dv1394src, CORE, NEGOTIATION, (NULL),
|
||||
("Could not set source caps for PAL"));
|
||||
return 0;
|
||||
}
|
||||
} else {
|
||||
// NTSC (untested)
|
||||
dv1394src->frameSize = NTSC_FRAMESIZE;
|
||||
GST_DEBUG
|
||||
("NTSC data [untested] - please report success/failure to <dan@f3c.com>");
|
||||
if (gst_pad_try_set_caps (dv1394src->srcpad,
|
||||
gst_caps_new_simple ("video/dv", "format", G_TYPE_STRING,
|
||||
"NTSC", NULL)) <= 0) {
|
||||
GST_ELEMENT_ERROR (dv1394src, CORE, NEGOTIATION, (NULL),
|
||||
("Could not set source caps for NTSC"));
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
dv1394src->negotiated = TRUE;
|
||||
}
|
||||
// drop last frame when not complete
|
||||
if (!dv1394src->drop_incomplete
|
||||
|| dv1394src->bytesInFrame == dv1394src->frameSize) {
|
||||
dv1394src->buf = dv1394src->frame;
|
||||
|| dv1394src->bytesInFrame == dv1394src->frameSize) {
|
||||
dv1394src->buf = dv1394src->frame;
|
||||
} else {
|
||||
GST_INFO_OBJECT (GST_ELEMENT (dv1394src), "incomplete frame dropped");
|
||||
GST_INFO_OBJECT (GST_ELEMENT (dv1394src), "incomplete frame dropped");
|
||||
}
|
||||
dv1394src->frame = NULL;
|
||||
|
||||
dv1394src->frameSequence++;
|
||||
|
||||
if (dv1394src->frameSequence % (dv1394src->skip +
|
||||
dv1394src->consecutive) < dv1394src->consecutive) {
|
||||
dv1394src->frame = gst_buffer_new_and_alloc (dv1394src->frameSize);
|
||||
dv1394src->consecutive) < dv1394src->consecutive) {
|
||||
dv1394src->frame = gst_buffer_new_and_alloc (dv1394src->frameSize);
|
||||
}
|
||||
dv1394src->bytesInFrame = 0;
|
||||
}
|
||||
|
@ -296,33 +297,33 @@ gst_dv1394src_iso_receive (raw1394handle_t handle, int channel, size_t len,
|
|||
|
||||
|
||||
switch (section_type) {
|
||||
case 0: /* 1 Header block */
|
||||
/* p[3] |= 0x80; // hack to force PAL data */
|
||||
memcpy (data + dif_sequence * 150 * 80, p, 480);
|
||||
break;
|
||||
case 0: /* 1 Header block */
|
||||
/* p[3] |= 0x80; // hack to force PAL data */
|
||||
memcpy (data + dif_sequence * 150 * 80, p, 480);
|
||||
break;
|
||||
|
||||
case 1: /* 2 Subcode blocks */
|
||||
memcpy (data + dif_sequence * 150 * 80 + (1 + dif_block) * 80, p,
|
||||
480);
|
||||
break;
|
||||
case 1: /* 2 Subcode blocks */
|
||||
memcpy (data + dif_sequence * 150 * 80 + (1 + dif_block) * 80, p,
|
||||
480);
|
||||
break;
|
||||
|
||||
case 2: /* 3 VAUX blocks */
|
||||
memcpy (data + dif_sequence * 150 * 80 + (3 + dif_block) * 80, p,
|
||||
480);
|
||||
break;
|
||||
case 2: /* 3 VAUX blocks */
|
||||
memcpy (data + dif_sequence * 150 * 80 + (3 + dif_block) * 80, p,
|
||||
480);
|
||||
break;
|
||||
|
||||
case 3: /* 9 Audio blocks interleaved with video */
|
||||
memcpy (data + dif_sequence * 150 * 80 + (6 + dif_block * 16) * 80, p,
|
||||
480);
|
||||
break;
|
||||
case 3: /* 9 Audio blocks interleaved with video */
|
||||
memcpy (data + dif_sequence * 150 * 80 + (6 + dif_block * 16) * 80, p,
|
||||
480);
|
||||
break;
|
||||
|
||||
case 4: /* 135 Video blocks interleaved with audio */
|
||||
memcpy (data + dif_sequence * 150 * 80 + (7 + (dif_block / 15) +
|
||||
dif_block) * 80, p, 480);
|
||||
break;
|
||||
case 4: /* 135 Video blocks interleaved with audio */
|
||||
memcpy (data + dif_sequence * 150 * 80 + (7 + (dif_block / 15) +
|
||||
dif_block) * 80, p, 480);
|
||||
break;
|
||||
|
||||
default: /* we can´t handle any other data */
|
||||
break;
|
||||
default: /* we can´t handle any other data */
|
||||
break;
|
||||
}
|
||||
dv1394src->bytesInFrame += 480;
|
||||
}
|
||||
|
@ -362,35 +363,35 @@ gst_dv1394src_change_state (GstElement * element)
|
|||
switch (GST_STATE_TRANSITION (element)) {
|
||||
case GST_STATE_NULL_TO_READY:
|
||||
if ((dv1394src->handle = raw1394_new_handle ()) == NULL) {
|
||||
GST_INFO_OBJECT (dv1394src, "can't get raw1394 handle");
|
||||
return GST_STATE_FAILURE;
|
||||
GST_INFO_OBJECT (dv1394src, "can't get raw1394 handle");
|
||||
return GST_STATE_FAILURE;
|
||||
}
|
||||
raw1394_set_userdata (dv1394src->handle, dv1394src);
|
||||
dv1394src->numcards =
|
||||
raw1394_get_port_info (dv1394src->handle, dv1394src->pinfo, 16);
|
||||
raw1394_get_port_info (dv1394src->handle, dv1394src->pinfo, 16);
|
||||
if (dv1394src->numcards == 0) {
|
||||
GST_INFO_OBJECT (dv1394src, "no cards available for raw1394");
|
||||
return GST_STATE_FAILURE;
|
||||
GST_INFO_OBJECT (dv1394src, "no cards available for raw1394");
|
||||
return GST_STATE_FAILURE;
|
||||
}
|
||||
if (dv1394src->pinfo[dv1394src->card].nodes <= 1) {
|
||||
GST_INFO_OBJECT (dv1394src, "there are no nodes on the 1394 bus");
|
||||
return GST_STATE_FAILURE;
|
||||
GST_INFO_OBJECT (dv1394src, "there are no nodes on the 1394 bus");
|
||||
return GST_STATE_FAILURE;
|
||||
}
|
||||
if (raw1394_set_port (dv1394src->handle, dv1394src->port) < 0) {
|
||||
GST_INFO_OBJECT (dv1394src, "can't set 1394 port %d", dv1394src->port);
|
||||
return GST_STATE_FAILURE;
|
||||
GST_INFO_OBJECT (dv1394src, "can't set 1394 port %d", dv1394src->port);
|
||||
return GST_STATE_FAILURE;
|
||||
}
|
||||
raw1394_set_iso_handler (dv1394src->handle, dv1394src->channel,
|
||||
gst_dv1394src_iso_receive);
|
||||
gst_dv1394src_iso_receive);
|
||||
raw1394_set_bus_reset_handler (dv1394src->handle,
|
||||
gst_dv1394src_bus_reset);
|
||||
gst_dv1394src_bus_reset);
|
||||
dv1394src->started = FALSE;
|
||||
GST_DEBUG ("successfully opened up 1394 connection");
|
||||
break;
|
||||
case GST_STATE_PAUSED_TO_PLAYING:
|
||||
if (raw1394_start_iso_rcv (dv1394src->handle, dv1394src->channel) < 0) {
|
||||
GST_INFO_OBJECT (dv1394src, "can't start 1394 iso receive");
|
||||
return GST_STATE_FAILURE;
|
||||
GST_INFO_OBJECT (dv1394src, "can't start 1394 iso receive");
|
||||
return GST_STATE_FAILURE;
|
||||
}
|
||||
break;
|
||||
case GST_STATE_PLAYING_TO_PAUSED:
|
||||
|
|
|
@ -44,18 +44,18 @@ enum
|
|||
enum
|
||||
{
|
||||
ARG_0,
|
||||
ARG_IP, /* the ip of the server */
|
||||
ARG_PORT, /* the encoder port number on the server */
|
||||
ARG_PASSWORD, /* the encoder password on the server */
|
||||
ARG_PUBLIC, /* is this stream public? */
|
||||
ARG_NAME, /* Name of the stream */
|
||||
ARG_DESCRIPTION, /* Description of the stream */
|
||||
ARG_GENRE, /* Genre of the stream */
|
||||
ARG_IP, /* the ip of the server */
|
||||
ARG_PORT, /* the encoder port number on the server */
|
||||
ARG_PASSWORD, /* the encoder password on the server */
|
||||
ARG_PUBLIC, /* is this stream public? */
|
||||
ARG_NAME, /* Name of the stream */
|
||||
ARG_DESCRIPTION, /* Description of the stream */
|
||||
ARG_GENRE, /* Genre of the stream */
|
||||
|
||||
ARG_PROTOCOL, /* Protocol to connect with */
|
||||
ARG_PROTOCOL, /* Protocol to connect with */
|
||||
|
||||
ARG_MOUNT, /* mountpoint of stream (icecast only) */
|
||||
ARG_URL, /* Url of stream (I'm guessing) */
|
||||
ARG_MOUNT, /* mountpoint of stream (icecast only) */
|
||||
ARG_URL, /* Url of stream (I'm guessing) */
|
||||
};
|
||||
|
||||
static GstPadTemplate *
|
||||
|
@ -65,15 +65,15 @@ sink_template_factory (void)
|
|||
|
||||
if (!template) {
|
||||
template = gst_pad_template_new ("sink",
|
||||
GST_PAD_SINK,
|
||||
GST_PAD_ALWAYS,
|
||||
gst_caps_new ("shout2send_sink",
|
||||
"application/ogg",
|
||||
NULL),
|
||||
gst_caps_new ("shout2send_sink",
|
||||
"audio/mpeg",
|
||||
gst_props_new ("mpegversion", GST_PROPS_INT (1),
|
||||
"layer", GST_PROPS_INT_RANGE (1, 3), NULL)), NULL);
|
||||
GST_PAD_SINK,
|
||||
GST_PAD_ALWAYS,
|
||||
gst_caps_new ("shout2send_sink",
|
||||
"application/ogg",
|
||||
NULL),
|
||||
gst_caps_new ("shout2send_sink",
|
||||
"audio/mpeg",
|
||||
gst_props_new ("mpegversion", GST_PROPS_INT (1),
|
||||
"layer", GST_PROPS_INT_RANGE (1, 3), NULL)), NULL);
|
||||
}
|
||||
|
||||
return template;
|
||||
|
@ -105,14 +105,15 @@ gst_shout2send_protocol_get_type (void)
|
|||
static GEnumValue shout2send_protocol[] = {
|
||||
{SHOUT2SEND_PROTOCOL_ICE, "1", "Ice Protocol"},
|
||||
{SHOUT2SEND_PROTOCOL_XAUDIOCAST, "2",
|
||||
"Xaudiocast Protocol (icecast 1.3.x)"},
|
||||
"Xaudiocast Protocol (icecast 1.3.x)"},
|
||||
{SHOUT2SEND_PROTOCOL_ICY, "3", "Icy Protocol (ShoutCast)"},
|
||||
{SHOUT2SEND_PROTOCOL_HTTP, "4", "Http Protocol (icecast 2.x)"},
|
||||
{0, NULL, NULL},
|
||||
};
|
||||
|
||||
if (!shout2send_protocol_type) {
|
||||
shout2send_protocol_type =
|
||||
g_enum_register_static ("GstShout2SendProtocol", shout2send_protocol);
|
||||
g_enum_register_static ("GstShout2SendProtocol", shout2send_protocol);
|
||||
}
|
||||
return shout2send_protocol_type;
|
||||
}
|
||||
|
@ -134,9 +135,10 @@ gst_shout2send_get_type (void)
|
|||
0,
|
||||
(GInstanceInitFunc) gst_shout2send_init,
|
||||
};
|
||||
|
||||
shout2send_type =
|
||||
g_type_register_static (GST_TYPE_ELEMENT, "GstShout2send",
|
||||
&shout2send_info, 0);
|
||||
g_type_register_static (GST_TYPE_ELEMENT, "GstShout2send",
|
||||
&shout2send_info, 0);
|
||||
}
|
||||
return shout2send_type;
|
||||
}
|
||||
|
@ -161,28 +163,28 @@ gst_shout2send_class_init (GstShout2sendClass * klass)
|
|||
|
||||
parent_class = g_type_class_ref (GST_TYPE_ELEMENT);
|
||||
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_IP, g_param_spec_string ("ip", "ip", "ip", NULL, G_PARAM_READWRITE)); /* CHECKME */
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_PORT, g_param_spec_int ("port", "port", "port", 1, G_MAXUSHORT, 8000, G_PARAM_READWRITE)); /* CHECKME */
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_IP, g_param_spec_string ("ip", "ip", "ip", NULL, G_PARAM_READWRITE)); /* CHECKME */
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_PORT, g_param_spec_int ("port", "port", "port", 1, G_MAXUSHORT, 8000, G_PARAM_READWRITE)); /* CHECKME */
|
||||
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_PASSWORD, g_param_spec_string ("password", "password", "password", NULL, G_PARAM_READWRITE)); /* CHECKME */
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_PASSWORD, g_param_spec_string ("password", "password", "password", NULL, G_PARAM_READWRITE)); /* CHECKME */
|
||||
|
||||
/* metadata */
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_NAME, g_param_spec_string ("name", "name", "name", NULL, G_PARAM_READWRITE)); /* CHECKME */
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_NAME, g_param_spec_string ("name", "name", "name", NULL, G_PARAM_READWRITE)); /* CHECKME */
|
||||
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_DESCRIPTION, g_param_spec_string ("description", "description", "description", NULL, G_PARAM_READWRITE)); /* CHECKME */
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_DESCRIPTION, g_param_spec_string ("description", "description", "description", NULL, G_PARAM_READWRITE)); /* CHECKME */
|
||||
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_GENRE, g_param_spec_string ("genre", "genre", "genre", NULL, G_PARAM_READWRITE)); /* CHECKME */
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_GENRE, g_param_spec_string ("genre", "genre", "genre", NULL, G_PARAM_READWRITE)); /* CHECKME */
|
||||
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_PROTOCOL,
|
||||
g_param_spec_enum ("protocol", "protocol", "Connection Protocol to use",
|
||||
GST_TYPE_SHOUT_PROTOCOL, SHOUT2SEND_PROTOCOL_HTTP,
|
||||
G_PARAM_READWRITE));
|
||||
GST_TYPE_SHOUT_PROTOCOL, SHOUT2SEND_PROTOCOL_HTTP,
|
||||
G_PARAM_READWRITE));
|
||||
|
||||
|
||||
/* icecast only */
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_MOUNT, g_param_spec_string ("mount", "mount", "mount", NULL, G_PARAM_READWRITE)); /* CHECKME */
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_MOUNT, g_param_spec_string ("mount", "mount", "mount", NULL, G_PARAM_READWRITE)); /* CHECKME */
|
||||
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_URL, g_param_spec_string ("url", "url", "url", NULL, G_PARAM_READWRITE)); /* CHECKME */
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_URL, g_param_spec_string ("url", "url", "url", NULL, G_PARAM_READWRITE)); /* CHECKME */
|
||||
|
||||
|
||||
|
||||
|
@ -254,7 +256,7 @@ gst_shout2send_set_property (GObject * object, guint prop_id,
|
|||
|
||||
case ARG_IP:
|
||||
if (shout2send->ip)
|
||||
g_free (shout2send->ip);
|
||||
g_free (shout2send->ip);
|
||||
shout2send->ip = g_strdup (g_value_get_string (value));
|
||||
break;
|
||||
|
||||
|
@ -264,41 +266,41 @@ gst_shout2send_set_property (GObject * object, guint prop_id,
|
|||
|
||||
case ARG_PASSWORD:
|
||||
if (shout2send->password)
|
||||
g_free (shout2send->password);
|
||||
g_free (shout2send->password);
|
||||
shout2send->password = g_strdup (g_value_get_string (value));
|
||||
break;
|
||||
|
||||
case ARG_NAME: /* Name of the stream */
|
||||
case ARG_NAME: /* Name of the stream */
|
||||
if (shout2send->name)
|
||||
g_free (shout2send->name);
|
||||
g_free (shout2send->name);
|
||||
shout2send->name = g_strdup (g_value_get_string (value));
|
||||
break;
|
||||
|
||||
case ARG_DESCRIPTION: /* Description of the stream */
|
||||
case ARG_DESCRIPTION: /* Description of the stream */
|
||||
if (shout2send->description)
|
||||
g_free (shout2send->description);
|
||||
g_free (shout2send->description);
|
||||
shout2send->description = g_strdup (g_value_get_string (value));
|
||||
break;
|
||||
|
||||
case ARG_GENRE: /* Genre of the stream */
|
||||
case ARG_GENRE: /* Genre of the stream */
|
||||
if (shout2send->genre)
|
||||
g_free (shout2send->genre);
|
||||
g_free (shout2send->genre);
|
||||
shout2send->genre = g_strdup (g_value_get_string (value));
|
||||
break;
|
||||
|
||||
case ARG_PROTOCOL: /* protocol to connect with */
|
||||
case ARG_PROTOCOL: /* protocol to connect with */
|
||||
shout2send->protocol = g_value_get_enum (value);
|
||||
break;
|
||||
|
||||
case ARG_MOUNT: /* mountpoint of stream (icecast only) */
|
||||
case ARG_MOUNT: /* mountpoint of stream (icecast only) */
|
||||
if (shout2send->mount)
|
||||
g_free (shout2send->mount);
|
||||
g_free (shout2send->mount);
|
||||
shout2send->mount = g_strdup (g_value_get_string (value));
|
||||
break;
|
||||
|
||||
case ARG_URL: /* Url of the stream (I'm guessing) */
|
||||
case ARG_URL: /* Url of the stream (I'm guessing) */
|
||||
if (shout2send->url)
|
||||
g_free (shout2send->url);
|
||||
g_free (shout2send->url);
|
||||
shout2send->url = g_strdup (g_value_get_string (value));
|
||||
break;
|
||||
|
||||
|
@ -329,27 +331,27 @@ gst_shout2send_get_property (GObject * object, guint prop_id, GValue * value,
|
|||
g_value_set_string (value, shout2send->password);
|
||||
break;
|
||||
|
||||
case ARG_NAME: /* Name of the stream */
|
||||
case ARG_NAME: /* Name of the stream */
|
||||
g_value_set_string (value, shout2send->name);
|
||||
break;
|
||||
|
||||
case ARG_DESCRIPTION: /* Description of the stream */
|
||||
case ARG_DESCRIPTION: /* Description of the stream */
|
||||
g_value_set_string (value, shout2send->description);
|
||||
break;
|
||||
|
||||
case ARG_GENRE: /* Genre of the stream */
|
||||
case ARG_GENRE: /* Genre of the stream */
|
||||
g_value_set_string (value, shout2send->genre);
|
||||
break;
|
||||
|
||||
case ARG_PROTOCOL: /* protocol to connect with */
|
||||
case ARG_PROTOCOL: /* protocol to connect with */
|
||||
g_value_set_enum (value, shout2send->protocol);
|
||||
break;
|
||||
|
||||
case ARG_MOUNT: /* mountpoint of stream (icecast only) */
|
||||
case ARG_MOUNT: /* mountpoint of stream (icecast only) */
|
||||
g_value_set_string (value, shout2send->mount);
|
||||
break;
|
||||
|
||||
case ARG_URL: /* Url of stream (I'm guessing) */
|
||||
case ARG_URL: /* Url of stream (I'm guessing) */
|
||||
g_value_set_string (value, shout2send->url);
|
||||
break;
|
||||
|
||||
|
@ -400,23 +402,23 @@ gst_shout2send_change_state (GstElement * element)
|
|||
shout2send->conn = shout_new ();
|
||||
|
||||
switch (shout2send->protocol) {
|
||||
case SHOUT2SEND_PROTOCOL_ICE:
|
||||
proto = SHOUT_PROTOCOL_ICE;
|
||||
break;
|
||||
case SHOUT2SEND_PROTOCOL_XAUDIOCAST:
|
||||
proto = SHOUT_PROTOCOL_XAUDIOCAST;
|
||||
break;
|
||||
case SHOUT2SEND_PROTOCOL_ICY:
|
||||
proto = SHOUT_PROTOCOL_ICY;
|
||||
break;
|
||||
case SHOUT2SEND_PROTOCOL_HTTP:
|
||||
proto = SHOUT_PROTOCOL_HTTP;
|
||||
break;
|
||||
case SHOUT2SEND_PROTOCOL_ICE:
|
||||
proto = SHOUT_PROTOCOL_ICE;
|
||||
break;
|
||||
case SHOUT2SEND_PROTOCOL_XAUDIOCAST:
|
||||
proto = SHOUT_PROTOCOL_XAUDIOCAST;
|
||||
break;
|
||||
case SHOUT2SEND_PROTOCOL_ICY:
|
||||
proto = SHOUT_PROTOCOL_ICY;
|
||||
break;
|
||||
case SHOUT2SEND_PROTOCOL_HTTP:
|
||||
proto = SHOUT_PROTOCOL_HTTP;
|
||||
break;
|
||||
}
|
||||
|
||||
if (shout_set_protocol (shout2send->conn, proto) != SHOUTERR_SUCCESS) {
|
||||
g_error ("Error setting protocol: %s\n",
|
||||
shout_get_error (shout2send->conn));
|
||||
g_error ("Error setting protocol: %s\n",
|
||||
shout_get_error (shout2send->conn));
|
||||
}
|
||||
|
||||
/* --- FIXME: shout requires an ip, and fails if it is given a host. */
|
||||
|
@ -424,61 +426,61 @@ gst_shout2send_change_state (GstElement * element)
|
|||
|
||||
|
||||
if (shout_set_host (shout2send->conn, shout2send->ip) != SHOUTERR_SUCCESS) {
|
||||
g_error ("Error setting host: %s\n",
|
||||
shout_get_error (shout2send->conn));
|
||||
g_error ("Error setting host: %s\n",
|
||||
shout_get_error (shout2send->conn));
|
||||
}
|
||||
/* --- */
|
||||
|
||||
if (shout_set_port (shout2send->conn,
|
||||
shout2send->port) != SHOUTERR_SUCCESS) {
|
||||
g_error ("Error setting port: %s\n",
|
||||
shout_get_error (shout2send->conn));
|
||||
shout2send->port) != SHOUTERR_SUCCESS) {
|
||||
g_error ("Error setting port: %s\n",
|
||||
shout_get_error (shout2send->conn));
|
||||
}
|
||||
|
||||
if (shout_set_password (shout2send->conn,
|
||||
shout2send->password) != SHOUTERR_SUCCESS) {
|
||||
g_error ("Error setting password: %s\n",
|
||||
shout_get_error (shout2send->conn));
|
||||
shout2send->password) != SHOUTERR_SUCCESS) {
|
||||
g_error ("Error setting password: %s\n",
|
||||
shout_get_error (shout2send->conn));
|
||||
}
|
||||
|
||||
if (shout_set_name (shout2send->conn,
|
||||
shout2send->name) != SHOUTERR_SUCCESS) {
|
||||
g_error ("Error setting name: %s\n",
|
||||
shout_get_error (shout2send->conn));
|
||||
shout2send->name) != SHOUTERR_SUCCESS) {
|
||||
g_error ("Error setting name: %s\n",
|
||||
shout_get_error (shout2send->conn));
|
||||
}
|
||||
|
||||
if (shout_set_description (shout2send->conn,
|
||||
shout2send->description) != SHOUTERR_SUCCESS) {
|
||||
g_error ("Error setting name: %s\n",
|
||||
shout_get_error (shout2send->conn));
|
||||
shout2send->description) != SHOUTERR_SUCCESS) {
|
||||
g_error ("Error setting name: %s\n",
|
||||
shout_get_error (shout2send->conn));
|
||||
}
|
||||
|
||||
if (shout_set_genre (shout2send->conn,
|
||||
shout2send->genre) != SHOUTERR_SUCCESS) {
|
||||
g_error ("Error setting name: %s\n",
|
||||
shout_get_error (shout2send->conn));
|
||||
shout2send->genre) != SHOUTERR_SUCCESS) {
|
||||
g_error ("Error setting name: %s\n",
|
||||
shout_get_error (shout2send->conn));
|
||||
}
|
||||
|
||||
if (shout_set_mount (shout2send->conn,
|
||||
shout2send->mount) != SHOUTERR_SUCCESS) {
|
||||
g_error ("Error setting mount point: %s\n",
|
||||
shout_get_error (shout2send->conn));
|
||||
shout2send->mount) != SHOUTERR_SUCCESS) {
|
||||
g_error ("Error setting mount point: %s\n",
|
||||
shout_get_error (shout2send->conn));
|
||||
}
|
||||
|
||||
if (shout_set_user (shout2send->conn, "source") != SHOUTERR_SUCCESS) {
|
||||
g_error ("Error setting user: %s\n",
|
||||
shout_get_error (shout2send->conn));
|
||||
g_error ("Error setting user: %s\n",
|
||||
shout_get_error (shout2send->conn));
|
||||
}
|
||||
|
||||
gst_version (&major, &minor, µ);
|
||||
|
||||
version_string =
|
||||
g_strdup_printf ("GStreamer %d.%d.%d", major, minor, micro);
|
||||
g_strdup_printf ("GStreamer %d.%d.%d", major, minor, micro);
|
||||
|
||||
if (shout_set_agent (shout2send->conn,
|
||||
version_string) != SHOUTERR_SUCCESS) {
|
||||
g_error ("Error setting agent: %s\n",
|
||||
shout_get_error (shout2send->conn));
|
||||
version_string) != SHOUTERR_SUCCESS) {
|
||||
g_error ("Error setting agent: %s\n",
|
||||
shout_get_error (shout2send->conn));
|
||||
}
|
||||
|
||||
g_free (version_string);
|
||||
|
@ -492,18 +494,18 @@ gst_shout2send_change_state (GstElement * element)
|
|||
we are being given as input. */
|
||||
|
||||
if (shout_set_format (shout2send->conn, audio_format) != SHOUTERR_SUCCESS) {
|
||||
g_error ("Error setting connection format: %s\n",
|
||||
shout_get_error (shout2send->conn));
|
||||
g_error ("Error setting connection format: %s\n",
|
||||
shout_get_error (shout2send->conn));
|
||||
}
|
||||
|
||||
if (shout_open (shout2send->conn) == SHOUTERR_SUCCESS) {
|
||||
g_print ("connected to server...\n");
|
||||
g_print ("connected to server...\n");
|
||||
} else {
|
||||
g_warning ("Couldn't connect to server: %s",
|
||||
shout_get_error (shout2send->conn));
|
||||
shout_close (shout2send->conn);
|
||||
shout_free (shout2send->conn);
|
||||
return GST_STATE_FAILURE;
|
||||
g_warning ("Couldn't connect to server: %s",
|
||||
shout_get_error (shout2send->conn));
|
||||
shout_close (shout2send->conn);
|
||||
shout_free (shout2send->conn);
|
||||
return GST_STATE_FAILURE;
|
||||
}
|
||||
break;
|
||||
case GST_STATE_PAUSED_TO_READY:
|
||||
|
|
|
@ -27,11 +27,11 @@ static gboolean
|
|||
plugin_init (GstPlugin * plugin)
|
||||
{
|
||||
if (!gst_element_register (plugin, "speexenc", GST_RANK_NONE,
|
||||
GST_TYPE_SPEEXENC))
|
||||
GST_TYPE_SPEEXENC))
|
||||
return FALSE;
|
||||
|
||||
if (!gst_element_register (plugin, "speexdec", GST_RANK_PRIMARY,
|
||||
GST_TYPE_SPEEXDEC))
|
||||
GST_TYPE_SPEEXDEC))
|
||||
return FALSE;
|
||||
|
||||
return TRUE;
|
||||
|
|
|
@ -77,9 +77,10 @@ gst_speexdec_get_type (void)
|
|||
0,
|
||||
(GInstanceInitFunc) gst_speexdec_init,
|
||||
};
|
||||
|
||||
speexdec_type =
|
||||
g_type_register_static (GST_TYPE_ELEMENT, "GstSpeexDec", &speexdec_info,
|
||||
0);
|
||||
g_type_register_static (GST_TYPE_ELEMENT, "GstSpeexDec", &speexdec_info,
|
||||
0);
|
||||
}
|
||||
return speexdec_type;
|
||||
}
|
||||
|
@ -89,18 +90,18 @@ GST_STATIC_PAD_TEMPLATE ("sink",
|
|||
GST_PAD_SINK,
|
||||
GST_PAD_ALWAYS,
|
||||
GST_STATIC_CAPS ("audio/x-speex, "
|
||||
"rate = (int) [ 1000, 48000 ], " "channels = (int) 1")
|
||||
"rate = (int) [ 1000, 48000 ], " "channels = (int) 1")
|
||||
);
|
||||
|
||||
static GstStaticPadTemplate speex_src_template = GST_STATIC_PAD_TEMPLATE ("src",
|
||||
GST_PAD_SRC,
|
||||
GST_PAD_ALWAYS,
|
||||
GST_STATIC_CAPS ("audio/x-raw-int, "
|
||||
"endianness = (int) BYTE_ORDER, "
|
||||
"signed = (boolean) true, "
|
||||
"width = (int) 16, "
|
||||
"depth = (int) 16, "
|
||||
"rate = (int) [ 1000, 48000 ], " "channels = (int) 1")
|
||||
"endianness = (int) BYTE_ORDER, "
|
||||
"signed = (boolean) true, "
|
||||
"width = (int) 16, "
|
||||
"depth = (int) 16, "
|
||||
"rate = (int) [ 1000, 48000 ], " "channels = (int) 1")
|
||||
);
|
||||
|
||||
static void
|
||||
|
@ -157,12 +158,12 @@ gst_speexdec_sinkconnect (GstPad * pad, const GstCaps * caps)
|
|||
gst_structure_get_int (structure, "rate", &rate);
|
||||
|
||||
if (gst_pad_set_explicit_caps (speexdec->srcpad,
|
||||
gst_caps_new_simple ("audio/x-raw-int",
|
||||
"endianness", G_TYPE_INT, G_BYTE_ORDER,
|
||||
"signed", G_TYPE_BOOLEAN, TRUE,
|
||||
"width", G_TYPE_INT, 16,
|
||||
"depth", G_TYPE_INT, 16,
|
||||
"rate", G_TYPE_INT, rate, "channels", G_TYPE_INT, 1, NULL))) {
|
||||
gst_caps_new_simple ("audio/x-raw-int",
|
||||
"endianness", G_TYPE_INT, G_BYTE_ORDER,
|
||||
"signed", G_TYPE_BOOLEAN, TRUE,
|
||||
"width", G_TYPE_INT, 16,
|
||||
"depth", G_TYPE_INT, 16,
|
||||
"rate", G_TYPE_INT, rate, "channels", G_TYPE_INT, 1, NULL))) {
|
||||
return GST_PAD_LINK_OK;
|
||||
}
|
||||
return GST_PAD_LINK_REFUSED;
|
||||
|
|
|
@ -77,9 +77,10 @@ gst_speexenc_get_type (void)
|
|||
0,
|
||||
(GInstanceInitFunc) gst_speexenc_init,
|
||||
};
|
||||
|
||||
speexenc_type =
|
||||
g_type_register_static (GST_TYPE_ELEMENT, "GstSpeexEnc", &speexenc_info,
|
||||
0);
|
||||
g_type_register_static (GST_TYPE_ELEMENT, "GstSpeexEnc", &speexenc_info,
|
||||
0);
|
||||
}
|
||||
return speexenc_type;
|
||||
}
|
||||
|
@ -89,18 +90,18 @@ GST_STATIC_PAD_TEMPLATE ("sink",
|
|||
GST_PAD_SINK,
|
||||
GST_PAD_ALWAYS,
|
||||
GST_STATIC_CAPS ("audio/x-raw-int, "
|
||||
"endianness = (int) BYTE_ORDER, "
|
||||
"signed = (boolean) true, "
|
||||
"width = (int) 16, "
|
||||
"depth = (int) 16, "
|
||||
"rate = (int) [ 1000, 48000 ], " "channels = (int) 1")
|
||||
"endianness = (int) BYTE_ORDER, "
|
||||
"signed = (boolean) true, "
|
||||
"width = (int) 16, "
|
||||
"depth = (int) 16, "
|
||||
"rate = (int) [ 1000, 48000 ], " "channels = (int) 1")
|
||||
);
|
||||
|
||||
static GstStaticPadTemplate speex_src_template = GST_STATIC_PAD_TEMPLATE ("src",
|
||||
GST_PAD_SRC,
|
||||
GST_PAD_ALWAYS,
|
||||
GST_STATIC_CAPS ("audio/x-speex, "
|
||||
"rate = (int) [ 1000, 48000 ], " "channels = (int) 1")
|
||||
"rate = (int) [ 1000, 48000 ], " "channels = (int) 1")
|
||||
);
|
||||
|
||||
static void
|
||||
|
@ -165,15 +166,15 @@ gst_speexenc_sinkconnect (GstPad * pad, const GstCaps * caps)
|
|||
structure = gst_caps_get_structure (caps, 0);
|
||||
gst_structure_get_int (structure, "rate", &speexenc->rate);
|
||||
if (gst_pad_try_set_caps (speexenc->srcpad,
|
||||
gst_caps_new_simple ("audio/x-speex",
|
||||
"rate", G_TYPE_INT, speexenc->rate,
|
||||
"channels", G_TYPE_INT, 1, NULL))) {
|
||||
gst_caps_new_simple ("audio/x-speex",
|
||||
"rate", G_TYPE_INT, speexenc->rate,
|
||||
"channels", G_TYPE_INT, 1, NULL))) {
|
||||
speex_init_header (&speexenc->header, speexenc->rate, 1, speexenc->mode);
|
||||
speexenc->header.frames_per_packet = speexenc->n_packets;
|
||||
|
||||
speexenc->state = speex_encoder_init (speexenc->mode);
|
||||
speex_encoder_ctl (speexenc->state, SPEEX_GET_FRAME_SIZE,
|
||||
&speexenc->frame_size);
|
||||
&speexenc->frame_size);
|
||||
|
||||
return GST_PAD_LINK_OK;
|
||||
}
|
||||
|
@ -203,9 +204,9 @@ gst_speexenc_chain (GstPad * pad, GstData * _data)
|
|||
if (!GST_PAD_CAPS (speexenc->srcpad)) {
|
||||
|
||||
if (!gst_pad_try_set_caps (speexenc->srcpad,
|
||||
gst_caps_new_simple ("audio/x-speex",
|
||||
"rate", G_TYPE_INT, speexenc->rate,
|
||||
"channels", G_TYPE_INT, 1, NULL))) {
|
||||
gst_caps_new_simple ("audio/x-speex",
|
||||
"rate", G_TYPE_INT, speexenc->rate,
|
||||
"channels", G_TYPE_INT, 1, NULL))) {
|
||||
GST_ELEMENT_ERROR (speexenc, CORE, NEGOTIATION, (NULL), (NULL));
|
||||
return;
|
||||
}
|
||||
|
@ -228,7 +229,7 @@ gst_speexenc_chain (GstPad * pad, GstData * _data)
|
|||
|
||||
if (speexenc->bufsize && (speexenc->bufsize + size >= frame_size)) {
|
||||
memcpy (speexenc->buffer + speexenc->bufsize, data,
|
||||
(frame_size - speexenc->bufsize) * sizeof (gint16));
|
||||
(frame_size - speexenc->bufsize) * sizeof (gint16));
|
||||
|
||||
for (i = 0; i < frame_size; i++)
|
||||
input[i] = speexenc->buffer[i];
|
||||
|
@ -241,7 +242,7 @@ gst_speexenc_chain (GstPad * pad, GstData * _data)
|
|||
|
||||
outbuf = gst_buffer_new_and_alloc (frame_size * speexenc->n_packets);
|
||||
GST_BUFFER_SIZE (outbuf) = speex_bits_write (&speexenc->bits,
|
||||
GST_BUFFER_DATA (outbuf), GST_BUFFER_SIZE (outbuf));
|
||||
GST_BUFFER_DATA (outbuf), GST_BUFFER_SIZE (outbuf));
|
||||
GST_BUFFER_TIMESTAMP (outbuf) = speexenc->next_ts;
|
||||
speex_bits_reset (&speexenc->bits);
|
||||
|
||||
|
@ -267,7 +268,7 @@ gst_speexenc_chain (GstPad * pad, GstData * _data)
|
|||
|
||||
outbuf = gst_buffer_new_and_alloc (frame_size * speexenc->n_packets);
|
||||
GST_BUFFER_SIZE (outbuf) = speex_bits_write (&speexenc->bits,
|
||||
GST_BUFFER_DATA (outbuf), GST_BUFFER_SIZE (outbuf));
|
||||
GST_BUFFER_DATA (outbuf), GST_BUFFER_SIZE (outbuf));
|
||||
GST_BUFFER_TIMESTAMP (outbuf) = speexenc->next_ts;
|
||||
speex_bits_reset (&speexenc->bits);
|
||||
|
||||
|
|
|
@ -35,8 +35,8 @@
|
|||
#endif
|
||||
#include <gst/gst.h>
|
||||
#include "gstfilter.h"
|
||||
#include <math.h> /* M_PI */
|
||||
#include <string.h> /* memmove */
|
||||
#include <math.h> /* M_PI */
|
||||
#include <string.h> /* memmove */
|
||||
|
||||
/* elementfactory information */
|
||||
static GstElementDetails gst_bpwsinc_details = GST_ELEMENT_DETAILS ("BPWSinc",
|
||||
|
@ -80,10 +80,10 @@ struct _GstBPWSinc
|
|||
|
||||
double frequency;
|
||||
double lower_frequency, upper_frequency;
|
||||
int wing_size; /* length of a "wing" of the filter;
|
||||
actual length is 2 * wing_size + 1 */
|
||||
int wing_size; /* length of a "wing" of the filter;
|
||||
actual length is 2 * wing_size + 1 */
|
||||
|
||||
gfloat *residue; /* buffer for left-over samples from previous buffer */
|
||||
gfloat *residue; /* buffer for left-over samples from previous buffer */
|
||||
double *kernel;
|
||||
};
|
||||
|
||||
|
@ -125,7 +125,7 @@ gst_bpwsinc_get_type (void)
|
|||
};
|
||||
|
||||
bpwsinc_type = g_type_register_static (GST_TYPE_ELEMENT, "GstBPWSinc",
|
||||
&bpwsinc_info, 0);
|
||||
&bpwsinc_info, 0);
|
||||
}
|
||||
return bpwsinc_type;
|
||||
}
|
||||
|
@ -157,16 +157,16 @@ gst_bpwsinc_class_init (GstBPWSincClass * klass)
|
|||
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_LOWER_FREQUENCY,
|
||||
g_param_spec_double ("lower-frequency", "Lower Frequency",
|
||||
"Cut-off lower frequency (relative to sample rate)",
|
||||
0.0, 0.5, 0, G_PARAM_READWRITE));
|
||||
"Cut-off lower frequency (relative to sample rate)",
|
||||
0.0, 0.5, 0, G_PARAM_READWRITE));
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_UPPER_FREQUENCY,
|
||||
g_param_spec_double ("upper-frequency", "Upper Frequency",
|
||||
"Cut-off upper frequency (relative to sample rate)",
|
||||
0.0, 0.5, 0, G_PARAM_READWRITE));
|
||||
"Cut-off upper frequency (relative to sample rate)",
|
||||
0.0, 0.5, 0, G_PARAM_READWRITE));
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_LENGTH,
|
||||
g_param_spec_int ("length", "Length",
|
||||
"N such that the filter length = 2N + 1",
|
||||
1, G_MAXINT, 1, G_PARAM_READWRITE));
|
||||
"N such that the filter length = 2N + 1",
|
||||
1, G_MAXINT, 1, G_PARAM_READWRITE));
|
||||
|
||||
gobject_class->set_property = gst_bpwsinc_set_property;
|
||||
gobject_class->get_property = gst_bpwsinc_get_property;
|
||||
|
@ -213,17 +213,17 @@ gst_bpwsinc_sink_connect (GstPad * pad, const GstCaps * caps)
|
|||
len = filter->wing_size;
|
||||
/* fill the lp kernel */
|
||||
GST_DEBUG ("bpwsinc: initializing LP kernel of length %d with cut-off %f",
|
||||
len * 2 + 1, filter->lower_frequency);
|
||||
len * 2 + 1, filter->lower_frequency);
|
||||
kernel_lp = (double *) g_malloc (sizeof (double) * (2 * len + 1));
|
||||
for (i = 0; i <= len * 2; ++i) {
|
||||
if (i == len)
|
||||
kernel_lp[i] = 2 * M_PI * filter->lower_frequency;
|
||||
kernel_lp[i] = 2 * M_PI * filter->lower_frequency;
|
||||
else
|
||||
kernel_lp[i] = sin (2 * M_PI * filter->lower_frequency * (i - len))
|
||||
/ (i - len);
|
||||
kernel_lp[i] = sin (2 * M_PI * filter->lower_frequency * (i - len))
|
||||
/ (i - len);
|
||||
/* Blackman windowing */
|
||||
kernel_lp[i] *= (0.42 - 0.5 * cos (M_PI * i / len)
|
||||
+ 0.08 * cos (2 * M_PI * i / len));
|
||||
+ 0.08 * cos (2 * M_PI * i / len));
|
||||
}
|
||||
|
||||
/* normalize for unity gain at DC
|
||||
|
@ -236,17 +236,17 @@ gst_bpwsinc_sink_connect (GstPad * pad, const GstCaps * caps)
|
|||
|
||||
/* fill the hp kernel */
|
||||
GST_DEBUG ("bpwsinc: initializing HP kernel of length %d with cut-off %f",
|
||||
len * 2 + 1, filter->upper_frequency);
|
||||
len * 2 + 1, filter->upper_frequency);
|
||||
kernel_hp = (double *) g_malloc (sizeof (double) * (2 * len + 1));
|
||||
for (i = 0; i <= len * 2; ++i) {
|
||||
if (i == len)
|
||||
kernel_hp[i] = 2 * M_PI * filter->upper_frequency;
|
||||
kernel_hp[i] = 2 * M_PI * filter->upper_frequency;
|
||||
else
|
||||
kernel_hp[i] = sin (2 * M_PI * filter->upper_frequency * (i - len))
|
||||
/ (i - len);
|
||||
kernel_hp[i] = sin (2 * M_PI * filter->upper_frequency * (i - len))
|
||||
/ (i - len);
|
||||
/* Blackman windowing */
|
||||
kernel_hp[i] *= (0.42 - 0.5 * cos (M_PI * i / len)
|
||||
+ 0.08 * cos (2 * M_PI * i / len));
|
||||
+ 0.08 * cos (2 * M_PI * i / len));
|
||||
}
|
||||
|
||||
/* normalize for unity gain at DC
|
||||
|
|
|
@ -35,8 +35,8 @@
|
|||
#endif
|
||||
#include <gst/gst.h>
|
||||
#include "gstfilter.h"
|
||||
#include <math.h> /* M_PI */
|
||||
#include <string.h> /* memmove */
|
||||
#include <math.h> /* M_PI */
|
||||
#include <string.h> /* memmove */
|
||||
|
||||
static GstElementDetails gst_lpwsinc_details = GST_ELEMENT_DETAILS ("LPWSinc",
|
||||
"Filter/Effect/Audio",
|
||||
|
@ -77,10 +77,10 @@ struct _GstLPWSinc
|
|||
GstPad *sinkpad, *srcpad;
|
||||
|
||||
double frequency;
|
||||
int wing_size; /* length of a "wing" of the filter;
|
||||
actual length is 2 * wing_size + 1 */
|
||||
int wing_size; /* length of a "wing" of the filter;
|
||||
actual length is 2 * wing_size + 1 */
|
||||
|
||||
gfloat *residue; /* buffer for left-over samples from previous buffer */
|
||||
gfloat *residue; /* buffer for left-over samples from previous buffer */
|
||||
double *kernel;
|
||||
};
|
||||
|
||||
|
@ -122,7 +122,7 @@ gst_lpwsinc_get_type (void)
|
|||
};
|
||||
|
||||
lpwsinc_type = g_type_register_static (GST_TYPE_ELEMENT, "GstLPWSinc",
|
||||
&lpwsinc_info, 0);
|
||||
&lpwsinc_info, 0);
|
||||
}
|
||||
return lpwsinc_type;
|
||||
}
|
||||
|
@ -154,12 +154,12 @@ gst_lpwsinc_class_init (GstLPWSincClass * klass)
|
|||
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_FREQUENCY,
|
||||
g_param_spec_double ("frequency", "Frequency",
|
||||
"Cut-off Frequency relative to sample rate)",
|
||||
0.0, 0.5, 0, G_PARAM_READWRITE));
|
||||
"Cut-off Frequency relative to sample rate)",
|
||||
0.0, 0.5, 0, G_PARAM_READWRITE));
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_LENGTH,
|
||||
g_param_spec_int ("length", "Length",
|
||||
"N such that the filter length = 2N + 1",
|
||||
1, G_MAXINT, 1, G_PARAM_READWRITE));
|
||||
"N such that the filter length = 2N + 1",
|
||||
1, G_MAXINT, 1, G_PARAM_READWRITE));
|
||||
|
||||
gobject_class->set_property = gst_lpwsinc_set_property;
|
||||
gobject_class->get_property = gst_lpwsinc_get_property;
|
||||
|
@ -210,10 +210,10 @@ gst_lpwsinc_sink_connect (GstPad * pad, const GstCaps * caps)
|
|||
|
||||
for (i = 0; i <= len * 2; ++i) {
|
||||
if (i == len)
|
||||
filter->kernel[i] = 2 * M_PI * filter->frequency;
|
||||
filter->kernel[i] = 2 * M_PI * filter->frequency;
|
||||
else
|
||||
filter->kernel[i] = sin (2 * M_PI * filter->frequency * (i - len))
|
||||
/ (i - len);
|
||||
filter->kernel[i] = sin (2 * M_PI * filter->frequency * (i - len))
|
||||
/ (i - len);
|
||||
/* windowing */
|
||||
filter->kernel[i] *= (0.54 - 0.46 * cos (M_PI * i / len));
|
||||
}
|
||||
|
|
|
@ -50,8 +50,8 @@ static GstStaticPadTemplate gst_auparse_src_template =
|
|||
GST_PAD_SRC,
|
||||
GST_PAD_ALWAYS,
|
||||
GST_STATIC_CAPS (GST_AUDIO_INT_PAD_TEMPLATE_CAPS "; "
|
||||
"audio/x-alaw, "
|
||||
"rate = (int) [ 8000, 48000 ], " "channels = (int) [ 1, 2 ]")
|
||||
"audio/x-alaw, "
|
||||
"rate = (int) [ 8000, 48000 ], " "channels = (int) [ 1, 2 ]")
|
||||
);
|
||||
|
||||
/* AuParse signals and args */
|
||||
|
@ -94,9 +94,10 @@ gst_auparse_get_type (void)
|
|||
0,
|
||||
(GInstanceInitFunc) gst_auparse_init,
|
||||
};
|
||||
|
||||
auparse_type =
|
||||
g_type_register_static (GST_TYPE_ELEMENT, "GstAuParse", &auparse_info,
|
||||
0);
|
||||
g_type_register_static (GST_TYPE_ELEMENT, "GstAuParse", &auparse_info,
|
||||
0);
|
||||
}
|
||||
return auparse_type;
|
||||
}
|
||||
|
@ -213,46 +214,46 @@ gst_auparse_chain (GstPad * pad, GstData * _data)
|
|||
}
|
||||
|
||||
g_print
|
||||
("offset %ld, size %ld, encoding %ld, frequency %ld, channels %ld\n",
|
||||
auparse->offset, auparse->size, auparse->encoding, auparse->frequency,
|
||||
auparse->channels);
|
||||
("offset %ld, size %ld, encoding %ld, frequency %ld, channels %ld\n",
|
||||
auparse->offset, auparse->size, auparse->encoding, auparse->frequency,
|
||||
auparse->channels);
|
||||
GST_DEBUG
|
||||
("offset %ld, size %ld, encoding %ld, frequency %ld, channels %ld",
|
||||
auparse->offset, auparse->size, auparse->encoding, auparse->frequency,
|
||||
auparse->channels);
|
||||
("offset %ld, size %ld, encoding %ld, frequency %ld, channels %ld",
|
||||
auparse->offset, auparse->size, auparse->encoding, auparse->frequency,
|
||||
auparse->channels);
|
||||
|
||||
switch (auparse->encoding) {
|
||||
case 1:
|
||||
law = 1;
|
||||
depth = 8;
|
||||
sign = FALSE;
|
||||
break;
|
||||
law = 1;
|
||||
depth = 8;
|
||||
sign = FALSE;
|
||||
break;
|
||||
case 2:
|
||||
law = 0;
|
||||
depth = 8;
|
||||
sign = FALSE;
|
||||
break;
|
||||
law = 0;
|
||||
depth = 8;
|
||||
sign = FALSE;
|
||||
break;
|
||||
case 3:
|
||||
law = 0;
|
||||
depth = 16;
|
||||
sign = TRUE;
|
||||
break;
|
||||
law = 0;
|
||||
depth = 16;
|
||||
sign = TRUE;
|
||||
break;
|
||||
default:
|
||||
g_warning ("help!, dont know how to deal with this format yet\n");
|
||||
return;
|
||||
g_warning ("help!, dont know how to deal with this format yet\n");
|
||||
return;
|
||||
}
|
||||
|
||||
if (law) {
|
||||
tempcaps = gst_caps_new_simple ("audio/x-alaw",
|
||||
"rate", G_TYPE_INT, auparse->frequency,
|
||||
"channels", G_TYPE_INT, auparse->channels, NULL);
|
||||
"rate", G_TYPE_INT, auparse->frequency,
|
||||
"channels", G_TYPE_INT, auparse->channels, NULL);
|
||||
} else {
|
||||
tempcaps = gst_caps_new_simple ("audio/x-raw-int",
|
||||
"endianness", G_TYPE_INT, G_BIG_ENDIAN,
|
||||
"rate", G_TYPE_INT, auparse->frequency,
|
||||
"channels", G_TYPE_INT, auparse->channels,
|
||||
"depth", G_TYPE_INT, depth,
|
||||
"width", G_TYPE_INT, depth, "signed", G_TYPE_BOOLEAN, sign, NULL);
|
||||
"endianness", G_TYPE_INT, G_BIG_ENDIAN,
|
||||
"rate", G_TYPE_INT, auparse->frequency,
|
||||
"channels", G_TYPE_INT, auparse->channels,
|
||||
"depth", G_TYPE_INT, depth,
|
||||
"width", G_TYPE_INT, depth, "signed", G_TYPE_BOOLEAN, sign, NULL);
|
||||
}
|
||||
|
||||
if (!gst_pad_set_explicit_caps (auparse->srcpad, tempcaps)) {
|
||||
|
@ -279,7 +280,7 @@ static gboolean
|
|||
plugin_init (GstPlugin * plugin)
|
||||
{
|
||||
if (!gst_element_register (plugin, "auparse", GST_RANK_SECONDARY,
|
||||
GST_TYPE_AUPARSE)) {
|
||||
GST_TYPE_AUPARSE)) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
|
|
@ -40,8 +40,8 @@ plugin_init (GstPlugin * plugin)
|
|||
#endif /* ENABLE_NLS */
|
||||
|
||||
return (gst_element_register (plugin, "avidemux",
|
||||
GST_RANK_PRIMARY,
|
||||
GST_TYPE_AVI_DEMUX) &&
|
||||
GST_RANK_PRIMARY,
|
||||
GST_TYPE_AVI_DEMUX) &&
|
||||
gst_element_register (plugin, "avimux", GST_RANK_NONE, GST_TYPE_AVIMUX));
|
||||
}
|
||||
|
||||
|
|
|
@ -66,7 +66,7 @@ GST_PADTEMPLATE_FACTORY (sink_templ,
|
|||
GST_PAD_SINK,
|
||||
GST_PAD_ALWAYS,
|
||||
GST_CAPS_NEW ("avidecoder_sink",
|
||||
"video/avi", "RIFF", GST_PROPS_STRING ("AVI")
|
||||
"video/avi", "RIFF", GST_PROPS_STRING ("AVI")
|
||||
)
|
||||
)
|
||||
|
||||
|
@ -75,12 +75,12 @@ GST_PADTEMPLATE_FACTORY (sink_templ,
|
|||
GST_PAD_SRC,
|
||||
GST_PAD_ALWAYS,
|
||||
GST_CAPS_NEW ("wincodec_src",
|
||||
"video/raw",
|
||||
"format", GST_PROPS_LIST (GST_PROPS_FOURCC (GST_MAKE_FOURCC ('Y', 'U', 'Y',
|
||||
'2')), GST_PROPS_FOURCC (GST_MAKE_FOURCC ('I', '4', '2', '0')),
|
||||
GST_PROPS_FOURCC (GST_MAKE_FOURCC ('R', 'G', 'B', ' '))
|
||||
), "width", GST_PROPS_INT_RANGE (16, 4096), "height",
|
||||
GST_PROPS_INT_RANGE (16, 4096)
|
||||
"video/raw",
|
||||
"format", GST_PROPS_LIST (GST_PROPS_FOURCC (GST_MAKE_FOURCC ('Y', 'U', 'Y',
|
||||
'2')), GST_PROPS_FOURCC (GST_MAKE_FOURCC ('I', '4', '2', '0')),
|
||||
GST_PROPS_FOURCC (GST_MAKE_FOURCC ('R', 'G', 'B', ' '))
|
||||
), "width", GST_PROPS_INT_RANGE (16, 4096), "height",
|
||||
GST_PROPS_INT_RANGE (16, 4096)
|
||||
)
|
||||
)
|
||||
|
||||
|
@ -89,17 +89,17 @@ GST_PADTEMPLATE_FACTORY (sink_templ,
|
|||
GST_PAD_SRC,
|
||||
GST_PAD_ALWAYS,
|
||||
GST_CAPS_NEW ("src_audio",
|
||||
"audio/raw",
|
||||
"format", GST_PROPS_STRING ("int"),
|
||||
"law", GST_PROPS_INT (0),
|
||||
"endianness", GST_PROPS_INT (G_BYTE_ORDER),
|
||||
"signed", GST_PROPS_LIST (GST_PROPS_BOOLEAN (TRUE),
|
||||
GST_PROPS_BOOLEAN (FALSE)
|
||||
), "width", GST_PROPS_LIST (GST_PROPS_INT (8), GST_PROPS_INT (16)
|
||||
), "depth", GST_PROPS_LIST (GST_PROPS_INT (8), GST_PROPS_INT (16)
|
||||
),
|
||||
"rate", GST_PROPS_INT_RANGE (11025, 48000),
|
||||
"channels", GST_PROPS_INT_RANGE (1, 2)
|
||||
"audio/raw",
|
||||
"format", GST_PROPS_STRING ("int"),
|
||||
"law", GST_PROPS_INT (0),
|
||||
"endianness", GST_PROPS_INT (G_BYTE_ORDER),
|
||||
"signed", GST_PROPS_LIST (GST_PROPS_BOOLEAN (TRUE),
|
||||
GST_PROPS_BOOLEAN (FALSE)
|
||||
), "width", GST_PROPS_LIST (GST_PROPS_INT (8), GST_PROPS_INT (16)
|
||||
), "depth", GST_PROPS_LIST (GST_PROPS_INT (8), GST_PROPS_INT (16)
|
||||
),
|
||||
"rate", GST_PROPS_INT_RANGE (11025, 48000),
|
||||
"channels", GST_PROPS_INT_RANGE (1, 2)
|
||||
)
|
||||
)
|
||||
|
||||
|
@ -132,9 +132,10 @@ gst_avi_decoder_get_type (void)
|
|||
0,
|
||||
(GInstanceInitFunc) gst_avi_decoder_init,
|
||||
};
|
||||
|
||||
avi_decoder_type =
|
||||
g_type_register_static (GST_TYPE_BIN, "GstAviDecoder",
|
||||
&avi_decoder_info, 0);
|
||||
g_type_register_static (GST_TYPE_BIN, "GstAviDecoder",
|
||||
&avi_decoder_info, 0);
|
||||
}
|
||||
return avi_decoder_type;
|
||||
}
|
||||
|
@ -148,9 +149,9 @@ gst_avi_decoder_class_init (GstAviDecoderClass * klass)
|
|||
gobject_class = (GObjectClass *) klass;
|
||||
gstelement_class = (GstElementClass *) klass;
|
||||
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_BITRATE, g_param_spec_long ("bitrate", "bitrate", "bitrate", G_MINLONG, G_MAXLONG, 0, G_PARAM_READABLE)); /* CHECKME */
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_MEDIA_TIME, g_param_spec_long ("media_time", "media_time", "media_time", G_MINLONG, G_MAXLONG, 0, G_PARAM_READABLE)); /* CHECKME */
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_CURRENT_TIME, g_param_spec_long ("current_time", "current_time", "current_time", G_MINLONG, G_MAXLONG, 0, G_PARAM_READABLE)); /* CHECKME */
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_BITRATE, g_param_spec_long ("bitrate", "bitrate", "bitrate", G_MINLONG, G_MAXLONG, 0, G_PARAM_READABLE)); /* CHECKME */
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_MEDIA_TIME, g_param_spec_long ("media_time", "media_time", "media_time", G_MINLONG, G_MAXLONG, 0, G_PARAM_READABLE)); /* CHECKME */
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_CURRENT_TIME, g_param_spec_long ("current_time", "current_time", "current_time", G_MINLONG, G_MAXLONG, 0, G_PARAM_READABLE)); /* CHECKME */
|
||||
|
||||
parent_class = g_type_class_ref (GST_TYPE_BIN);
|
||||
|
||||
|
@ -182,17 +183,17 @@ gst_avi_decoder_new_pad (GstElement * element, GstPad * pad,
|
|||
|
||||
if (!strcmp (format, "strf_vids")) {
|
||||
targetcaps =
|
||||
gst_padtemplate_get_caps (GST_PADTEMPLATE_GET (src_video_templ));
|
||||
gst_padtemplate_get_caps (GST_PADTEMPLATE_GET (src_video_templ));
|
||||
media_type = AVI_TYPE_VIDEO;
|
||||
gpadname = g_strdup_printf ("video_%02d", avi_decoder->video_count++);
|
||||
} else if (!strcmp (format, "strf_auds")) {
|
||||
targetcaps =
|
||||
gst_padtemplate_get_caps (GST_PADTEMPLATE_GET (src_audio_templ));
|
||||
gst_padtemplate_get_caps (GST_PADTEMPLATE_GET (src_audio_templ));
|
||||
media_type = AVI_TYPE_AUDIO;
|
||||
gpadname = g_strdup_printf ("audio_%02d", avi_decoder->audio_count++);
|
||||
} else if (!strcmp (format, "strf_iavs")) {
|
||||
targetcaps =
|
||||
gst_padtemplate_get_caps (GST_PADTEMPLATE_GET (src_video_templ));
|
||||
gst_padtemplate_get_caps (GST_PADTEMPLATE_GET (src_video_templ));
|
||||
media_type = AVI_TYPE_VIDEO;
|
||||
gpadname = g_strdup_printf ("video_%02d", avi_decoder->video_count++);
|
||||
} else {
|
||||
|
@ -219,7 +220,7 @@ gst_avi_decoder_new_pad (GstElement * element, GstPad * pad,
|
|||
|
||||
if (gst_caps_is_always_compatible (caps, targetcaps)) {
|
||||
gst_element_add_ghost_pad (GST_ELEMENT (avi_decoder),
|
||||
gst_element_get_pad (type, "src"), gpadname);
|
||||
gst_element_get_pad (type, "src"), gpadname);
|
||||
|
||||
avi_decoder->count++;
|
||||
goto done;
|
||||
|
@ -247,11 +248,11 @@ gst_avi_decoder_new_pad (GstElement * element, GstPad * pad,
|
|||
if (new_element) {
|
||||
gst_pad_connect (pad, gst_element_get_pad (new_element, "sink"));
|
||||
gst_element_set_name (new_element, g_strdup_printf ("element%d",
|
||||
avi_decoder->count));
|
||||
avi_decoder->count));
|
||||
gst_bin_add (GST_BIN (avi_decoder), new_element);
|
||||
|
||||
gst_element_add_ghost_pad (GST_ELEMENT (avi_decoder),
|
||||
gst_element_get_pad (new_element, padname), gpadname);
|
||||
gst_element_get_pad (new_element, padname), gpadname);
|
||||
|
||||
avi_decoder->count++;
|
||||
} else {
|
||||
|
@ -271,10 +272,10 @@ gst_avi_decoder_init (GstAviDecoder * avi_decoder)
|
|||
gst_bin_add (GST_BIN (avi_decoder), avi_decoder->demuxer);
|
||||
|
||||
gst_element_add_ghost_pad (GST_ELEMENT (avi_decoder),
|
||||
gst_element_get_pad (avi_decoder->demuxer, "sink"), "sink");
|
||||
gst_element_get_pad (avi_decoder->demuxer, "sink"), "sink");
|
||||
|
||||
g_signal_connect (G_OBJECT (avi_decoder->demuxer), "new_pad",
|
||||
G_CALLBACK (gst_avi_decoder_new_pad), avi_decoder);
|
||||
G_CALLBACK (gst_avi_decoder_new_pad), avi_decoder);
|
||||
} else {
|
||||
g_warning ("wow!, no avi demuxer found. help me\n");
|
||||
}
|
||||
|
@ -317,11 +318,11 @@ gst_avi_decoder_get_property (GObject * object, guint prop_id, GValue * value,
|
|||
break;
|
||||
case ARG_MEDIA_TIME:
|
||||
g_value_set_long (value, gst_util_get_long_arg (G_OBJECT (src->demuxer),
|
||||
"media_time"));
|
||||
"media_time"));
|
||||
break;
|
||||
case ARG_CURRENT_TIME:
|
||||
g_value_set_long (value, gst_util_get_long_arg (G_OBJECT (src->demuxer),
|
||||
"current_time"));
|
||||
"current_time"));
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
|
|
@ -99,8 +99,8 @@ gst_avi_demux_get_type (void)
|
|||
};
|
||||
|
||||
avi_demux_type =
|
||||
g_type_register_static (GST_TYPE_RIFF_READ,
|
||||
"GstAviDemux", &avi_demux_info, 0);
|
||||
g_type_register_static (GST_TYPE_RIFF_READ,
|
||||
"GstAviDemux", &avi_demux_info, 0);
|
||||
}
|
||||
|
||||
return avi_demux_type;
|
||||
|
@ -147,7 +147,7 @@ gst_avi_demux_class_init (GstAviDemuxClass * klass)
|
|||
|
||||
g_object_class_install_property (gobject_class, ARG_STREAMINFO,
|
||||
g_param_spec_boxed ("streaminfo", "Streaminfo", "Streaminfo",
|
||||
GST_TYPE_CAPS, G_PARAM_READABLE));
|
||||
GST_TYPE_CAPS, G_PARAM_READABLE));
|
||||
|
||||
GST_DEBUG_CATEGORY_INIT (avidemux_debug, "avidemux",
|
||||
0, "Demuxer for AVI streams");
|
||||
|
@ -347,38 +347,38 @@ gst_avi_demux_src_convert (GstPad * pad,
|
|||
switch (src_format) {
|
||||
case GST_FORMAT_TIME:
|
||||
switch (*dest_format) {
|
||||
case GST_FORMAT_BYTES:
|
||||
*dest_value = src_value * stream->strh->rate /
|
||||
(stream->strh->scale * GST_SECOND);
|
||||
break;
|
||||
case GST_FORMAT_DEFAULT:
|
||||
*dest_value = src_value * stream->strh->rate /
|
||||
(stream->strh->scale * GST_SECOND);
|
||||
break;
|
||||
default:
|
||||
res = FALSE;
|
||||
break;
|
||||
case GST_FORMAT_BYTES:
|
||||
*dest_value = src_value * stream->strh->rate /
|
||||
(stream->strh->scale * GST_SECOND);
|
||||
break;
|
||||
case GST_FORMAT_DEFAULT:
|
||||
*dest_value = src_value * stream->strh->rate /
|
||||
(stream->strh->scale * GST_SECOND);
|
||||
break;
|
||||
default:
|
||||
res = FALSE;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case GST_FORMAT_BYTES:
|
||||
switch (*dest_format) {
|
||||
case GST_FORMAT_TIME:
|
||||
*dest_value = ((gfloat) src_value) * GST_SECOND / stream->strh->rate;
|
||||
break;
|
||||
default:
|
||||
res = FALSE;
|
||||
break;
|
||||
case GST_FORMAT_TIME:
|
||||
*dest_value = ((gfloat) src_value) * GST_SECOND / stream->strh->rate;
|
||||
break;
|
||||
default:
|
||||
res = FALSE;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case GST_FORMAT_DEFAULT:
|
||||
switch (*dest_format) {
|
||||
case GST_FORMAT_TIME:
|
||||
*dest_value = ((((gfloat) src_value) * stream->strh->scale) /
|
||||
stream->strh->rate) * GST_SECOND;
|
||||
break;
|
||||
default:
|
||||
res = FALSE;
|
||||
break;
|
||||
case GST_FORMAT_TIME:
|
||||
*dest_value = ((((gfloat) src_value) * stream->strh->scale) /
|
||||
stream->strh->rate) * GST_SECOND;
|
||||
break;
|
||||
default:
|
||||
res = FALSE;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
|
@ -412,54 +412,54 @@ gst_avi_demux_handle_src_query (GstPad * pad,
|
|||
switch (type) {
|
||||
case GST_QUERY_TOTAL:
|
||||
switch (*format) {
|
||||
case GST_FORMAT_TIME:
|
||||
*value = (((gfloat) stream->strh->scale) * stream->strh->length /
|
||||
stream->strh->rate) * GST_SECOND;
|
||||
break;
|
||||
case GST_FORMAT_BYTES:
|
||||
if (stream->strh->type == GST_RIFF_FCC_auds) {
|
||||
*value = stream->total_bytes;
|
||||
} else
|
||||
res = FALSE;
|
||||
break;
|
||||
case GST_FORMAT_DEFAULT:
|
||||
if (stream->strh->type == GST_RIFF_FCC_auds)
|
||||
*value = stream->strh->length * stream->strh->samplesize;
|
||||
else if (stream->strh->type == GST_RIFF_FCC_vids)
|
||||
*value = stream->strh->length;
|
||||
else
|
||||
res = FALSE;
|
||||
break;
|
||||
default:
|
||||
res = FALSE;
|
||||
break;
|
||||
case GST_FORMAT_TIME:
|
||||
*value = (((gfloat) stream->strh->scale) * stream->strh->length /
|
||||
stream->strh->rate) * GST_SECOND;
|
||||
break;
|
||||
case GST_FORMAT_BYTES:
|
||||
if (stream->strh->type == GST_RIFF_FCC_auds) {
|
||||
*value = stream->total_bytes;
|
||||
} else
|
||||
res = FALSE;
|
||||
break;
|
||||
case GST_FORMAT_DEFAULT:
|
||||
if (stream->strh->type == GST_RIFF_FCC_auds)
|
||||
*value = stream->strh->length * stream->strh->samplesize;
|
||||
else if (stream->strh->type == GST_RIFF_FCC_vids)
|
||||
*value = stream->strh->length;
|
||||
else
|
||||
res = FALSE;
|
||||
break;
|
||||
default:
|
||||
res = FALSE;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case GST_QUERY_POSITION:
|
||||
switch (*format) {
|
||||
case GST_FORMAT_TIME:
|
||||
if (stream->strh->samplesize &&
|
||||
stream->strh->type == GST_RIFF_FCC_auds) {
|
||||
*value = ((gfloat) stream->current_byte) * GST_SECOND /
|
||||
stream->strh->rate;
|
||||
} else {
|
||||
*value = (((gfloat) stream->current_frame) * stream->strh->scale /
|
||||
stream->strh->rate) * GST_SECOND;
|
||||
}
|
||||
break;
|
||||
case GST_FORMAT_BYTES:
|
||||
*value = stream->current_byte;
|
||||
break;
|
||||
case GST_FORMAT_DEFAULT:
|
||||
if (stream->strh->samplesize &&
|
||||
stream->strh->type == GST_RIFF_FCC_auds)
|
||||
*value = stream->current_byte * stream->strh->samplesize;
|
||||
else
|
||||
*value = stream->current_frame;
|
||||
break;
|
||||
default:
|
||||
res = FALSE;
|
||||
break;
|
||||
case GST_FORMAT_TIME:
|
||||
if (stream->strh->samplesize &&
|
||||
stream->strh->type == GST_RIFF_FCC_auds) {
|
||||
*value = ((gfloat) stream->current_byte) * GST_SECOND /
|
||||
stream->strh->rate;
|
||||
} else {
|
||||
*value = (((gfloat) stream->current_frame) * stream->strh->scale /
|
||||
stream->strh->rate) * GST_SECOND;
|
||||
}
|
||||
break;
|
||||
case GST_FORMAT_BYTES:
|
||||
*value = stream->current_byte;
|
||||
break;
|
||||
case GST_FORMAT_DEFAULT:
|
||||
if (stream->strh->samplesize &&
|
||||
stream->strh->type == GST_RIFF_FCC_auds)
|
||||
*value = stream->current_byte * stream->strh->samplesize;
|
||||
else
|
||||
*value = stream->current_frame;
|
||||
break;
|
||||
default:
|
||||
res = FALSE;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
|
@ -492,7 +492,7 @@ gst_avi_demux_sync_streams (GstAviDemux * avi, guint64 time)
|
|||
GST_DEBUG ("finding %d for time %" G_GINT64_FORMAT, i, time);
|
||||
|
||||
entry = gst_avi_demux_index_entry_for_time (avi, stream->num, time,
|
||||
GST_RIFF_IF_KEYFRAME);
|
||||
GST_RIFF_IF_KEYFRAME);
|
||||
if (entry) {
|
||||
min_index = MIN (entry->index_nr, min_index);
|
||||
}
|
||||
|
@ -510,7 +510,7 @@ gst_avi_demux_sync_streams (GstAviDemux * avi, guint64 time)
|
|||
next_entry = gst_avi_demux_index_next (avi, stream->num, min_index, 0);
|
||||
/* next entry with keyframe */
|
||||
entry = gst_avi_demux_index_next (avi, stream->num, min_index,
|
||||
GST_RIFF_IF_KEYFRAME);
|
||||
GST_RIFF_IF_KEYFRAME);
|
||||
|
||||
stream->current_byte = next_entry->bytes_before;
|
||||
stream->current_frame = next_entry->frames_before;
|
||||
|
@ -539,9 +539,9 @@ gst_avi_demux_send_event (GstElement * element, GstEvent * event)
|
|||
* failed on this pad */
|
||||
gst_event_ref (event);
|
||||
if (gst_avi_demux_handle_src_event (pad, event)) {
|
||||
gst_event_unref (event);
|
||||
gst_event_unref (event);
|
||||
|
||||
return TRUE;
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -576,56 +576,56 @@ gst_avi_demux_handle_src_event (GstPad * pad, GstEvent * event)
|
|||
switch (GST_EVENT_TYPE (event)) {
|
||||
case GST_EVENT_SEEK:
|
||||
GST_DEBUG ("seek format %d, %08x", GST_EVENT_SEEK_FORMAT (event),
|
||||
stream->strh->type);
|
||||
stream->strh->type);
|
||||
|
||||
switch (GST_EVENT_SEEK_FORMAT (event)) {
|
||||
case GST_FORMAT_BYTES:
|
||||
case GST_FORMAT_DEFAULT:
|
||||
case GST_FORMAT_TIME:{
|
||||
gst_avi_index_entry *seek_entry, *entry = NULL;
|
||||
gint64 desired_offset = GST_EVENT_SEEK_OFFSET (event);
|
||||
guint32 flags;
|
||||
guint64 min_index;
|
||||
case GST_FORMAT_BYTES:
|
||||
case GST_FORMAT_DEFAULT:
|
||||
case GST_FORMAT_TIME:{
|
||||
gst_avi_index_entry *seek_entry, *entry = NULL;
|
||||
gint64 desired_offset = GST_EVENT_SEEK_OFFSET (event);
|
||||
guint32 flags;
|
||||
guint64 min_index;
|
||||
|
||||
/* no seek on audio yet */
|
||||
if (stream->strh->type == GST_RIFF_FCC_auds) {
|
||||
res = FALSE;
|
||||
goto done;
|
||||
}
|
||||
GST_DEBUG ("seeking to %" G_GINT64_FORMAT, desired_offset);
|
||||
/* no seek on audio yet */
|
||||
if (stream->strh->type == GST_RIFF_FCC_auds) {
|
||||
res = FALSE;
|
||||
goto done;
|
||||
}
|
||||
GST_DEBUG ("seeking to %" G_GINT64_FORMAT, desired_offset);
|
||||
|
||||
flags = GST_RIFF_IF_KEYFRAME;
|
||||
switch (GST_EVENT_SEEK_FORMAT (event)) {
|
||||
case GST_FORMAT_BYTES:
|
||||
entry = gst_avi_demux_index_entry_for_byte (avi, stream->num,
|
||||
desired_offset, flags);
|
||||
break;
|
||||
case GST_FORMAT_DEFAULT:
|
||||
entry = gst_avi_demux_index_entry_for_frame (avi, stream->num,
|
||||
desired_offset, flags);
|
||||
break;
|
||||
case GST_FORMAT_TIME:
|
||||
entry = gst_avi_demux_index_entry_for_time (avi, stream->num,
|
||||
desired_offset, flags);
|
||||
break;
|
||||
}
|
||||
flags = GST_RIFF_IF_KEYFRAME;
|
||||
switch (GST_EVENT_SEEK_FORMAT (event)) {
|
||||
case GST_FORMAT_BYTES:
|
||||
entry = gst_avi_demux_index_entry_for_byte (avi, stream->num,
|
||||
desired_offset, flags);
|
||||
break;
|
||||
case GST_FORMAT_DEFAULT:
|
||||
entry = gst_avi_demux_index_entry_for_frame (avi, stream->num,
|
||||
desired_offset, flags);
|
||||
break;
|
||||
case GST_FORMAT_TIME:
|
||||
entry = gst_avi_demux_index_entry_for_time (avi, stream->num,
|
||||
desired_offset, flags);
|
||||
break;
|
||||
}
|
||||
|
||||
if (entry) {
|
||||
min_index = gst_avi_demux_sync_streams (avi, entry->ts);
|
||||
seek_entry = &avi->index_entries[min_index];
|
||||
if (entry) {
|
||||
min_index = gst_avi_demux_sync_streams (avi, entry->ts);
|
||||
seek_entry = &avi->index_entries[min_index];
|
||||
|
||||
avi->seek_offset = seek_entry->offset + avi->index_offset;
|
||||
avi->last_seek = entry->ts;
|
||||
} else {
|
||||
GST_DEBUG ("no index entry found for format=%d value=%"
|
||||
G_GINT64_FORMAT, GST_EVENT_SEEK_FORMAT (event), desired_offset);
|
||||
res = FALSE;
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
res = FALSE;
|
||||
break;
|
||||
avi->seek_offset = seek_entry->offset + avi->index_offset;
|
||||
avi->last_seek = entry->ts;
|
||||
} else {
|
||||
GST_DEBUG ("no index entry found for format=%d value=%"
|
||||
G_GINT64_FORMAT, GST_EVENT_SEEK_FORMAT (event), desired_offset);
|
||||
res = FALSE;
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
res = FALSE;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
|
@ -682,7 +682,7 @@ gst_avi_demux_stream_avih (GstAviDemux * avi,
|
|||
}
|
||||
if (GST_BUFFER_SIZE (buf) < sizeof (gst_riff_avih)) {
|
||||
g_warning ("Too small avih (%d available, %d needed)",
|
||||
GST_BUFFER_SIZE (buf), (int) sizeof (gst_riff_avih));
|
||||
GST_BUFFER_SIZE (buf), (int) sizeof (gst_riff_avih));
|
||||
gst_buffer_unref (buf);
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -751,7 +751,8 @@ gst_avi_demux_add_stream (GstAviDemux * avi)
|
|||
gst_riff_strf_vids *vids;
|
||||
gst_riff_strf_auds *auds;
|
||||
gst_riff_strf_iavs *iavs;
|
||||
} strf;
|
||||
}
|
||||
strf;
|
||||
|
||||
/* the stream starts with a 'strh' header */
|
||||
if (!(tag = gst_riff_peek_tag (riff, NULL)))
|
||||
|
@ -768,25 +769,25 @@ gst_avi_demux_add_stream (GstAviDemux * avi)
|
|||
return FALSE;
|
||||
if (tag != GST_RIFF_TAG_strf) {
|
||||
GST_ELEMENT_ERROR (avi, STREAM, DEMUX, (NULL),
|
||||
("Invalid AVI header (no strf as second tag)"));
|
||||
("Invalid AVI header (no strf as second tag)"));
|
||||
goto skip_stream;
|
||||
}
|
||||
switch (strh->type) {
|
||||
case GST_RIFF_FCC_vids:
|
||||
if (!gst_riff_read_strf_vids (riff, &strf.vids))
|
||||
return FALSE;
|
||||
return FALSE;
|
||||
break;
|
||||
case GST_RIFF_FCC_auds:
|
||||
if (!gst_riff_read_strf_auds (riff, &strf.auds))
|
||||
return FALSE;
|
||||
return FALSE;
|
||||
break;
|
||||
case GST_RIFF_FCC_iavs:
|
||||
if (!gst_riff_read_strf_iavs (riff, &strf.iavs))
|
||||
return FALSE;
|
||||
return FALSE;
|
||||
break;
|
||||
default:
|
||||
g_warning ("Unknown stream type " GST_FOURCC_FORMAT,
|
||||
GST_FOURCC_ARGS (strh->type));
|
||||
GST_FOURCC_ARGS (strh->type));
|
||||
goto skip_stream;
|
||||
}
|
||||
|
||||
|
@ -801,22 +802,22 @@ gst_avi_demux_add_stream (GstAviDemux * avi)
|
|||
|
||||
switch (tag) {
|
||||
case GST_RIFF_TAG_strn:
|
||||
if (name)
|
||||
g_free (name);
|
||||
if (!gst_riff_read_ascii (riff, &tag, &name))
|
||||
return FALSE;
|
||||
break;
|
||||
if (name)
|
||||
g_free (name);
|
||||
if (!gst_riff_read_ascii (riff, &tag, &name))
|
||||
return FALSE;
|
||||
break;
|
||||
|
||||
default:
|
||||
GST_WARNING ("Unknown tag " GST_FOURCC_FORMAT " in AVI header",
|
||||
GST_FOURCC_ARGS (tag));
|
||||
/* fall-through */
|
||||
GST_WARNING ("Unknown tag " GST_FOURCC_FORMAT " in AVI header",
|
||||
GST_FOURCC_ARGS (tag));
|
||||
/* fall-through */
|
||||
|
||||
case GST_RIFF_TAG_strd: /* what is this? */
|
||||
case GST_RIFF_TAG_strd: /* what is this? */
|
||||
case GST_RIFF_TAG_JUNK:
|
||||
if (!gst_riff_read_skip (riff))
|
||||
return FALSE;
|
||||
break;
|
||||
if (!gst_riff_read_skip (riff))
|
||||
return FALSE;
|
||||
break;
|
||||
}
|
||||
|
||||
if (avi->level_up) {
|
||||
|
@ -835,13 +836,13 @@ gst_avi_demux_add_stream (GstAviDemux * avi)
|
|||
padname = g_strdup_printf ("video_%02d", avi->num_v_streams);
|
||||
templ = gst_element_class_get_pad_template (klass, "video_%02d");
|
||||
caps = gst_riff_create_video_caps (strf.vids->compression, strh,
|
||||
strf.vids, &codec_name);
|
||||
strf.vids, &codec_name);
|
||||
gst_tag_list_add (list, GST_TAG_MERGE_APPEND, GST_TAG_VIDEO_CODEC,
|
||||
codec_name, NULL);
|
||||
codec_name, NULL);
|
||||
gst_element_found_tags (GST_ELEMENT (avi), list);
|
||||
gst_tag_list_free (list);
|
||||
if (codec_name)
|
||||
g_free (codec_name);
|
||||
g_free (codec_name);
|
||||
g_free (strf.vids);
|
||||
avi->num_v_streams++;
|
||||
break;
|
||||
|
@ -854,13 +855,13 @@ gst_avi_demux_add_stream (GstAviDemux * avi)
|
|||
padname = g_strdup_printf ("audio_%02d", avi->num_a_streams);
|
||||
templ = gst_element_class_get_pad_template (klass, "audio_%02d");
|
||||
caps = gst_riff_create_audio_caps (strf.auds->format, strh, strf.auds,
|
||||
&codec_name);
|
||||
&codec_name);
|
||||
gst_tag_list_add (list, GST_TAG_MERGE_APPEND, GST_TAG_AUDIO_CODEC,
|
||||
codec_name, NULL);
|
||||
codec_name, NULL);
|
||||
gst_element_found_tags (GST_ELEMENT (avi), list);
|
||||
gst_tag_list_free (list);
|
||||
if (codec_name)
|
||||
g_free (codec_name);
|
||||
g_free (codec_name);
|
||||
g_free (strf.auds);
|
||||
avi->num_a_streams++;
|
||||
break;
|
||||
|
@ -873,13 +874,13 @@ gst_avi_demux_add_stream (GstAviDemux * avi)
|
|||
padname = g_strdup_printf ("video_%02d", avi->num_v_streams);
|
||||
templ = gst_element_class_get_pad_template (klass, "video_%02d");
|
||||
caps = gst_riff_create_iavs_caps (strh->fcc_handler, strh, strf.iavs,
|
||||
&codec_name);
|
||||
&codec_name);
|
||||
gst_tag_list_add (list, GST_TAG_MERGE_APPEND, GST_TAG_VIDEO_CODEC,
|
||||
codec_name, NULL);
|
||||
codec_name, NULL);
|
||||
gst_element_found_tags (GST_ELEMENT (avi), list);
|
||||
gst_tag_list_free (list);
|
||||
if (codec_name)
|
||||
g_free (codec_name);
|
||||
g_free (codec_name);
|
||||
g_free (strf.iavs);
|
||||
avi->num_v_streams++;
|
||||
break;
|
||||
|
@ -935,7 +936,7 @@ skip_stream:
|
|||
/* add a "NULL" stream */
|
||||
avi->num_streams++;
|
||||
|
||||
return TRUE; /* recoverable */
|
||||
return TRUE; /* recoverable */
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -959,37 +960,37 @@ gst_avi_demux_stream_odml (GstAviDemux * avi)
|
|||
|
||||
switch (tag) {
|
||||
case GST_RIFF_TAG_dmlh:{
|
||||
gst_riff_dmlh dmlh, *_dmlh;
|
||||
GstBuffer *buf;
|
||||
gst_riff_dmlh dmlh, *_dmlh;
|
||||
GstBuffer *buf;
|
||||
|
||||
if (!gst_riff_read_data (riff, &tag, &buf))
|
||||
return FALSE;
|
||||
if (GST_BUFFER_SIZE (buf) < sizeof (gst_riff_dmlh)) {
|
||||
g_warning ("DMLH entry is too small (%d bytes, %d needed)",
|
||||
GST_BUFFER_SIZE (buf), (int) sizeof (gst_riff_dmlh));
|
||||
gst_buffer_unref (buf);
|
||||
break;
|
||||
}
|
||||
_dmlh = (gst_riff_dmlh *) GST_BUFFER_DATA (buf);
|
||||
dmlh.totalframes = GUINT32_FROM_LE (_dmlh->totalframes);
|
||||
if (!gst_riff_read_data (riff, &tag, &buf))
|
||||
return FALSE;
|
||||
if (GST_BUFFER_SIZE (buf) < sizeof (gst_riff_dmlh)) {
|
||||
g_warning ("DMLH entry is too small (%d bytes, %d needed)",
|
||||
GST_BUFFER_SIZE (buf), (int) sizeof (gst_riff_dmlh));
|
||||
gst_buffer_unref (buf);
|
||||
break;
|
||||
}
|
||||
_dmlh = (gst_riff_dmlh *) GST_BUFFER_DATA (buf);
|
||||
dmlh.totalframes = GUINT32_FROM_LE (_dmlh->totalframes);
|
||||
|
||||
GST_INFO ("dmlh tag found:");
|
||||
GST_INFO (" totalframes: %u", dmlh.totalframes);
|
||||
GST_INFO ("dmlh tag found:");
|
||||
GST_INFO (" totalframes: %u", dmlh.totalframes);
|
||||
|
||||
avi->num_frames = dmlh.totalframes;
|
||||
gst_buffer_unref (buf);
|
||||
break;
|
||||
avi->num_frames = dmlh.totalframes;
|
||||
gst_buffer_unref (buf);
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
GST_WARNING ("Unknown tag " GST_FOURCC_FORMAT " in AVI header",
|
||||
GST_FOURCC_ARGS (tag));
|
||||
/* fall-through */
|
||||
GST_WARNING ("Unknown tag " GST_FOURCC_FORMAT " in AVI header",
|
||||
GST_FOURCC_ARGS (tag));
|
||||
/* fall-through */
|
||||
|
||||
case GST_RIFF_TAG_JUNK:
|
||||
if (!gst_riff_read_skip (riff))
|
||||
return FALSE;
|
||||
break;
|
||||
if (!gst_riff_read_skip (riff))
|
||||
return FALSE;
|
||||
break;
|
||||
}
|
||||
|
||||
if (avi->level_up) {
|
||||
|
@ -1036,7 +1037,7 @@ gst_avi_demux_stream_index (GstAviDemux * avi)
|
|||
return FALSE;
|
||||
if (tag != GST_RIFF_TAG_idx1) {
|
||||
g_warning ("No index after data, but " GST_FOURCC_FORMAT,
|
||||
GST_FOURCC_ARGS (tag));
|
||||
GST_FOURCC_ARGS (tag));
|
||||
goto end;
|
||||
}
|
||||
|
||||
|
@ -1081,9 +1082,9 @@ gst_avi_demux_stream_index (GstAviDemux * avi)
|
|||
/* figure out if the index is 0 based or relative to the MOVI start */
|
||||
if (i == 0) {
|
||||
if (target->offset < pos_before)
|
||||
avi->index_offset = pos_before + 8;
|
||||
avi->index_offset = pos_before + 8;
|
||||
else
|
||||
avi->index_offset = 0;
|
||||
avi->index_offset = 0;
|
||||
}
|
||||
|
||||
target->bytes_before = stream->total_bytes;
|
||||
|
@ -1098,11 +1099,11 @@ gst_avi_demux_stream_index (GstAviDemux * avi)
|
|||
if (stream->strh->samplesize && stream->strh->type == GST_RIFF_FCC_auds) {
|
||||
/* constant rate stream */
|
||||
gst_pad_convert (stream->pad, GST_FORMAT_BYTES,
|
||||
stream->total_bytes, &format, &target->ts);
|
||||
stream->total_bytes, &format, &target->ts);
|
||||
} else {
|
||||
/* VBR stream */
|
||||
gst_pad_convert (stream->pad, GST_FORMAT_DEFAULT,
|
||||
stream->total_frames, &format, &target->ts);
|
||||
stream->total_frames, &format, &target->ts);
|
||||
}
|
||||
|
||||
stream->total_bytes += target->size;
|
||||
|
@ -1115,7 +1116,7 @@ gst_avi_demux_stream_index (GstAviDemux * avi)
|
|||
|
||||
stream = &avi->stream[i];
|
||||
GST_DEBUG ("stream %u: %u frames, %" G_GINT64_FORMAT " bytes",
|
||||
i, stream->total_frames, stream->total_bytes);
|
||||
i, stream->total_frames, stream->total_bytes);
|
||||
}
|
||||
|
||||
end:
|
||||
|
@ -1159,16 +1160,16 @@ gst_avi_demux_stream_header (GstAviDemux * avi)
|
|||
return FALSE;
|
||||
if (tag != GST_RIFF_TAG_LIST) {
|
||||
GST_ELEMENT_ERROR (avi, STREAM, DEMUX, (NULL),
|
||||
("Invalid AVI header (no LIST at start): "
|
||||
GST_FOURCC_FORMAT, GST_FOURCC_ARGS (tag)));
|
||||
("Invalid AVI header (no LIST at start): "
|
||||
GST_FOURCC_FORMAT, GST_FOURCC_ARGS (tag)));
|
||||
return FALSE;
|
||||
}
|
||||
if (!gst_riff_read_list (riff, &tag))
|
||||
return FALSE;
|
||||
if (tag != GST_RIFF_LIST_hdrl) {
|
||||
GST_ELEMENT_ERROR (avi, STREAM, DEMUX, (NULL),
|
||||
("Invalid AVI header (no hdrl at start): "
|
||||
GST_FOURCC_FORMAT, GST_FOURCC_ARGS (tag)));
|
||||
("Invalid AVI header (no hdrl at start): "
|
||||
GST_FOURCC_FORMAT, GST_FOURCC_ARGS (tag)));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -1177,8 +1178,8 @@ gst_avi_demux_stream_header (GstAviDemux * avi)
|
|||
return FALSE;
|
||||
if (tag != GST_RIFF_TAG_avih) {
|
||||
GST_ELEMENT_ERROR (avi, STREAM, DEMUX, (NULL),
|
||||
("Invalid AVI header (no avih at start): "
|
||||
GST_FOURCC_FORMAT, GST_FOURCC_ARGS (tag)));
|
||||
("Invalid AVI header (no avih at start): "
|
||||
GST_FOURCC_FORMAT, GST_FOURCC_ARGS (tag)));
|
||||
return FALSE;
|
||||
}
|
||||
if (!gst_avi_demux_stream_avih (avi, &flags, &streams))
|
||||
|
@ -1195,44 +1196,44 @@ gst_avi_demux_stream_header (GstAviDemux * avi)
|
|||
|
||||
switch (tag) {
|
||||
case GST_RIFF_TAG_LIST:
|
||||
if (!(tag = gst_riff_peek_list (riff)))
|
||||
return FALSE;
|
||||
if (!(tag = gst_riff_peek_list (riff)))
|
||||
return FALSE;
|
||||
|
||||
switch (tag) {
|
||||
case GST_RIFF_LIST_strl:
|
||||
if (!gst_riff_read_list (riff, &tag) ||
|
||||
!gst_avi_demux_add_stream (avi))
|
||||
return FALSE;
|
||||
break;
|
||||
switch (tag) {
|
||||
case GST_RIFF_LIST_strl:
|
||||
if (!gst_riff_read_list (riff, &tag) ||
|
||||
!gst_avi_demux_add_stream (avi))
|
||||
return FALSE;
|
||||
break;
|
||||
|
||||
case GST_RIFF_LIST_odml:
|
||||
if (!gst_riff_read_list (riff, &tag) ||
|
||||
!gst_avi_demux_stream_odml (avi))
|
||||
return FALSE;
|
||||
break;
|
||||
case GST_RIFF_LIST_odml:
|
||||
if (!gst_riff_read_list (riff, &tag) ||
|
||||
!gst_avi_demux_stream_odml (avi))
|
||||
return FALSE;
|
||||
break;
|
||||
|
||||
default:
|
||||
GST_WARNING ("Unknown list " GST_FOURCC_FORMAT " in AVI header",
|
||||
GST_FOURCC_ARGS (tag));
|
||||
/* fall-through */
|
||||
default:
|
||||
GST_WARNING ("Unknown list " GST_FOURCC_FORMAT " in AVI header",
|
||||
GST_FOURCC_ARGS (tag));
|
||||
/* fall-through */
|
||||
|
||||
case GST_RIFF_TAG_JUNK:
|
||||
if (!gst_riff_read_skip (riff))
|
||||
return FALSE;
|
||||
break;
|
||||
}
|
||||
case GST_RIFF_TAG_JUNK:
|
||||
if (!gst_riff_read_skip (riff))
|
||||
return FALSE;
|
||||
break;
|
||||
}
|
||||
|
||||
break;
|
||||
break;
|
||||
|
||||
default:
|
||||
GST_WARNING ("Unknown tag " GST_FOURCC_FORMAT " in AVI header",
|
||||
GST_FOURCC_ARGS (tag));
|
||||
/* fall-through */
|
||||
GST_WARNING ("Unknown tag " GST_FOURCC_FORMAT " in AVI header",
|
||||
GST_FOURCC_ARGS (tag));
|
||||
/* fall-through */
|
||||
|
||||
case GST_RIFF_TAG_JUNK:
|
||||
if (!gst_riff_read_skip (riff))
|
||||
return FALSE;
|
||||
break;
|
||||
if (!gst_riff_read_skip (riff))
|
||||
return FALSE;
|
||||
break;
|
||||
}
|
||||
|
||||
if (avi->level_up) {
|
||||
|
@ -1243,7 +1244,7 @@ gst_avi_demux_stream_header (GstAviDemux * avi)
|
|||
|
||||
if (avi->num_streams != streams) {
|
||||
g_warning ("Stream header mentioned %d streams, but %d available",
|
||||
streams, avi->num_streams);
|
||||
streams, avi->num_streams);
|
||||
}
|
||||
|
||||
/* we've got streaminfo now */
|
||||
|
@ -1255,17 +1256,17 @@ gst_avi_demux_stream_header (GstAviDemux * avi)
|
|||
return FALSE;
|
||||
if (tag != GST_RIFF_TAG_LIST) {
|
||||
if (!gst_riff_read_skip (riff))
|
||||
return FALSE;
|
||||
return FALSE;
|
||||
continue;
|
||||
}
|
||||
if (!(tag = gst_riff_peek_list (riff)))
|
||||
return FALSE;
|
||||
if (tag != GST_RIFF_LIST_movi) {
|
||||
if (tag == GST_RIFF_LIST_INFO) {
|
||||
if (!gst_riff_read_list (riff, &tag) || !gst_riff_read_info (riff))
|
||||
return FALSE;
|
||||
if (!gst_riff_read_list (riff, &tag) || !gst_riff_read_info (riff))
|
||||
return FALSE;
|
||||
} else if (!gst_riff_read_skip (riff)) {
|
||||
return FALSE;
|
||||
return FALSE;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
@ -1307,7 +1308,7 @@ gst_avi_demux_handle_seek (GstAviDemux * avi)
|
|||
|
||||
if (GST_PAD_IS_USABLE (stream->pad)) {
|
||||
event = gst_event_new_discontinuous (FALSE, GST_FORMAT_TIME,
|
||||
avi->last_seek + stream->delay, NULL);
|
||||
avi->last_seek + stream->delay, NULL);
|
||||
gst_pad_push (stream->pad, GST_DATA (event));
|
||||
}
|
||||
}
|
||||
|
@ -1347,40 +1348,40 @@ gst_avi_demux_stream_data (GstAviDemux * avi)
|
|||
|
||||
switch (tag) {
|
||||
case GST_RIFF_TAG_LIST:
|
||||
if (!(tag = gst_riff_peek_list (riff)))
|
||||
return FALSE;
|
||||
if (!(tag = gst_riff_peek_list (riff)))
|
||||
return FALSE;
|
||||
|
||||
switch (tag) {
|
||||
case GST_RIFF_LIST_AVIX:
|
||||
case GST_RIFF_LIST_movi:
|
||||
if (!gst_riff_read_list (riff, &tag))
|
||||
return FALSE;
|
||||
/* we're now going to read buffers! */
|
||||
break;
|
||||
switch (tag) {
|
||||
case GST_RIFF_LIST_AVIX:
|
||||
case GST_RIFF_LIST_movi:
|
||||
if (!gst_riff_read_list (riff, &tag))
|
||||
return FALSE;
|
||||
/* we're now going to read buffers! */
|
||||
break;
|
||||
|
||||
default:
|
||||
GST_WARNING ("Unknown list " GST_FOURCC_FORMAT " before AVI data",
|
||||
GST_FOURCC_ARGS (tag));
|
||||
/* fall-through */
|
||||
default:
|
||||
GST_WARNING ("Unknown list " GST_FOURCC_FORMAT " before AVI data",
|
||||
GST_FOURCC_ARGS (tag));
|
||||
/* fall-through */
|
||||
|
||||
case GST_RIFF_TAG_JUNK:
|
||||
if (!gst_riff_read_skip (riff))
|
||||
return FALSE;
|
||||
break;
|
||||
}
|
||||
case GST_RIFF_TAG_JUNK:
|
||||
if (!gst_riff_read_skip (riff))
|
||||
return FALSE;
|
||||
break;
|
||||
}
|
||||
|
||||
break;
|
||||
break;
|
||||
|
||||
default:
|
||||
GST_WARNING ("Unknown tag " GST_FOURCC_FORMAT " before AVI data",
|
||||
GST_FOURCC_ARGS (tag));
|
||||
/* fall-through */
|
||||
GST_WARNING ("Unknown tag " GST_FOURCC_FORMAT " before AVI data",
|
||||
GST_FOURCC_ARGS (tag));
|
||||
/* fall-through */
|
||||
|
||||
case GST_RIFF_TAG_idx1:
|
||||
case GST_RIFF_TAG_JUNK:
|
||||
if (!gst_riff_read_skip (riff))
|
||||
return FALSE;
|
||||
break;
|
||||
if (!gst_riff_read_skip (riff))
|
||||
return FALSE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1391,7 +1392,7 @@ gst_avi_demux_stream_data (GstAviDemux * avi)
|
|||
if (stream_nr < 0 || stream_nr >= avi->num_streams) {
|
||||
/* recoverable */
|
||||
g_warning ("Invalid stream ID %d (" GST_FOURCC_FORMAT ")",
|
||||
stream_nr, GST_FOURCC_ARGS (tag));
|
||||
stream_nr, GST_FOURCC_ARGS (tag));
|
||||
if (!gst_riff_read_skip (riff))
|
||||
return FALSE;
|
||||
} else {
|
||||
|
@ -1407,11 +1408,11 @@ gst_avi_demux_stream_data (GstAviDemux * avi)
|
|||
/* get time of this buffer */
|
||||
stream = &avi->stream[stream_nr];
|
||||
entry = gst_avi_demux_index_next (avi, stream_nr,
|
||||
stream->current_entry + 1, 0);
|
||||
stream->current_entry + 1, 0);
|
||||
if (entry) {
|
||||
stream->current_entry = entry->index_nr;
|
||||
if (entry->flags & GST_RIFF_IF_KEYFRAME) {
|
||||
GST_BUFFER_FLAG_SET (buf, GST_BUFFER_KEY_UNIT);
|
||||
GST_BUFFER_FLAG_SET (buf, GST_BUFFER_KEY_UNIT);
|
||||
}
|
||||
}
|
||||
format = GST_FORMAT_TIME;
|
||||
|
@ -1419,7 +1420,7 @@ gst_avi_demux_stream_data (GstAviDemux * avi)
|
|||
|
||||
/* set delay (if any) */
|
||||
if (stream->strh->init_frames == stream->current_frame &&
|
||||
stream->delay == 0)
|
||||
stream->delay == 0)
|
||||
stream->delay = next_ts;
|
||||
|
||||
stream->current_frame++;
|
||||
|
@ -1431,15 +1432,15 @@ gst_avi_demux_stream_data (GstAviDemux * avi)
|
|||
gst_buffer_unref (buf);
|
||||
} else {
|
||||
if (!stream->pad || !GST_PAD_IS_USABLE (stream->pad)) {
|
||||
gst_buffer_unref (buf);
|
||||
gst_buffer_unref (buf);
|
||||
} else {
|
||||
GstClockTime dur_ts;
|
||||
GstClockTime dur_ts;
|
||||
|
||||
GST_BUFFER_TIMESTAMP (buf) = next_ts;
|
||||
gst_pad_query (stream->pad, GST_QUERY_POSITION, &format, &dur_ts);
|
||||
GST_BUFFER_DURATION (buf) = dur_ts - next_ts;
|
||||
GST_BUFFER_TIMESTAMP (buf) = next_ts;
|
||||
gst_pad_query (stream->pad, GST_QUERY_POSITION, &format, &dur_ts);
|
||||
GST_BUFFER_DURATION (buf) = dur_ts - next_ts;
|
||||
|
||||
gst_pad_push (stream->pad, GST_DATA (buf));
|
||||
gst_pad_push (stream->pad, GST_DATA (buf));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1455,19 +1456,19 @@ gst_avi_demux_loop (GstElement * element)
|
|||
switch (avi->state) {
|
||||
case GST_AVI_DEMUX_START:
|
||||
if (!gst_avi_demux_stream_init (avi))
|
||||
return;
|
||||
return;
|
||||
avi->state = GST_AVI_DEMUX_HEADER;
|
||||
/* fall-through */
|
||||
|
||||
case GST_AVI_DEMUX_HEADER:
|
||||
if (!gst_avi_demux_stream_header (avi))
|
||||
return;
|
||||
return;
|
||||
avi->state = GST_AVI_DEMUX_MOVI;
|
||||
/* fall-through */
|
||||
|
||||
case GST_AVI_DEMUX_MOVI:
|
||||
if (!gst_avi_demux_stream_data (avi))
|
||||
return;
|
||||
return;
|
||||
break;
|
||||
|
||||
default:
|
||||
|
|
|
@ -68,40 +68,40 @@ static GstStaticPadTemplate video_sink_factory =
|
|||
GST_PAD_SINK,
|
||||
GST_PAD_REQUEST,
|
||||
GST_STATIC_CAPS ("video/x-raw-yuv, "
|
||||
"format = (fourcc) { YUY2, I420 }, "
|
||||
"width = (int) [ 16, 4096 ], "
|
||||
"height = (int) [ 16, 4096 ]; "
|
||||
"video/x-jpeg, "
|
||||
"width = (int) [ 16, 4096 ], "
|
||||
"height = (int) [ 16, 4096 ]; "
|
||||
"video/x-divx, "
|
||||
"width = (int) [ 16, 4096 ], "
|
||||
"height = (int) [ 16, 4096 ], "
|
||||
"divxversion = (int) [ 3, 5 ]; "
|
||||
"video/x-xvid, "
|
||||
"width = (int) [ 16, 4096 ], "
|
||||
"height = (int) [ 16, 4096 ]; "
|
||||
"video/x-3ivx, "
|
||||
"width = (int) [ 16, 4096 ], "
|
||||
"height = (int) [ 16, 4096 ]; "
|
||||
"video/x-msmpeg, "
|
||||
"width = (int) [ 16, 4096 ], "
|
||||
"height = (int) [ 16, 4096 ], "
|
||||
"msmpegversion = (int) [ 41, 43 ]; "
|
||||
"video/mpeg, "
|
||||
"width = (int) [ 16, 4096 ], "
|
||||
"height = (int) [ 16, 4096 ], "
|
||||
"mpegversion = (int) 1, "
|
||||
"systemstream = (boolean) FALSE; "
|
||||
"video/x-h263, "
|
||||
"width = (int) [ 16, 4096 ], "
|
||||
"height = (int) [ 16, 4096 ]; "
|
||||
"video/x-dv, "
|
||||
"width = (int) 720, "
|
||||
"height = (int) { 576, 480 }, "
|
||||
"systemstream = (boolean) FALSE; "
|
||||
"video/x-huffyuv, "
|
||||
"width = (int) [ 16, 4096 ], " "height = (int) [ 16, 4096 ]")
|
||||
"format = (fourcc) { YUY2, I420 }, "
|
||||
"width = (int) [ 16, 4096 ], "
|
||||
"height = (int) [ 16, 4096 ]; "
|
||||
"video/x-jpeg, "
|
||||
"width = (int) [ 16, 4096 ], "
|
||||
"height = (int) [ 16, 4096 ]; "
|
||||
"video/x-divx, "
|
||||
"width = (int) [ 16, 4096 ], "
|
||||
"height = (int) [ 16, 4096 ], "
|
||||
"divxversion = (int) [ 3, 5 ]; "
|
||||
"video/x-xvid, "
|
||||
"width = (int) [ 16, 4096 ], "
|
||||
"height = (int) [ 16, 4096 ]; "
|
||||
"video/x-3ivx, "
|
||||
"width = (int) [ 16, 4096 ], "
|
||||
"height = (int) [ 16, 4096 ]; "
|
||||
"video/x-msmpeg, "
|
||||
"width = (int) [ 16, 4096 ], "
|
||||
"height = (int) [ 16, 4096 ], "
|
||||
"msmpegversion = (int) [ 41, 43 ]; "
|
||||
"video/mpeg, "
|
||||
"width = (int) [ 16, 4096 ], "
|
||||
"height = (int) [ 16, 4096 ], "
|
||||
"mpegversion = (int) 1, "
|
||||
"systemstream = (boolean) FALSE; "
|
||||
"video/x-h263, "
|
||||
"width = (int) [ 16, 4096 ], "
|
||||
"height = (int) [ 16, 4096 ]; "
|
||||
"video/x-dv, "
|
||||
"width = (int) 720, "
|
||||
"height = (int) { 576, 480 }, "
|
||||
"systemstream = (boolean) FALSE; "
|
||||
"video/x-huffyuv, "
|
||||
"width = (int) [ 16, 4096 ], " "height = (int) [ 16, 4096 ]")
|
||||
);
|
||||
|
||||
static GstStaticPadTemplate audio_sink_factory =
|
||||
|
@ -109,22 +109,22 @@ static GstStaticPadTemplate audio_sink_factory =
|
|||
GST_PAD_SINK,
|
||||
GST_PAD_REQUEST,
|
||||
GST_STATIC_CAPS ("audio/x-raw-int, "
|
||||
"endianness = (int) LITTLE_ENDIAN, "
|
||||
"signed = (boolean) { TRUE, FALSE }, "
|
||||
"width = (int) { 8, 16 }, "
|
||||
"depth = (int) { 8, 16 }, "
|
||||
"rate = (int) [ 1000, 96000 ], "
|
||||
"channels = (int) [ 1, 2 ]; "
|
||||
"audio/mpeg, "
|
||||
"mpegversion = (int) 1, "
|
||||
"layer = (int) [ 1, 3 ], "
|
||||
"rate = (int) [ 1000, 96000 ], "
|
||||
"channels = (int) [ 1, 2 ]; "
|
||||
"audio/x-vorbis, "
|
||||
"rate = (int) [ 1000, 96000 ], "
|
||||
"channels = (int) [ 1, 2 ]; "
|
||||
"audio/x-ac3, "
|
||||
"rate = (int) [ 1000, 96000 ], " "channels = (int) [ 1, 2 ]")
|
||||
"endianness = (int) LITTLE_ENDIAN, "
|
||||
"signed = (boolean) { TRUE, FALSE }, "
|
||||
"width = (int) { 8, 16 }, "
|
||||
"depth = (int) { 8, 16 }, "
|
||||
"rate = (int) [ 1000, 96000 ], "
|
||||
"channels = (int) [ 1, 2 ]; "
|
||||
"audio/mpeg, "
|
||||
"mpegversion = (int) 1, "
|
||||
"layer = (int) [ 1, 3 ], "
|
||||
"rate = (int) [ 1000, 96000 ], "
|
||||
"channels = (int) [ 1, 2 ]; "
|
||||
"audio/x-vorbis, "
|
||||
"rate = (int) [ 1000, 96000 ], "
|
||||
"channels = (int) [ 1, 2 ]; "
|
||||
"audio/x-ac3, "
|
||||
"rate = (int) [ 1000, 96000 ], " "channels = (int) [ 1, 2 ]")
|
||||
);
|
||||
|
||||
|
||||
|
@ -163,8 +163,9 @@ gst_avimux_get_type (void)
|
|||
0,
|
||||
(GInstanceInitFunc) gst_avimux_init,
|
||||
};
|
||||
|
||||
avimux_type =
|
||||
g_type_register_static (GST_TYPE_ELEMENT, "GstAviMux", &avimux_info, 0);
|
||||
g_type_register_static (GST_TYPE_ELEMENT, "GstAviMux", &avimux_info, 0);
|
||||
}
|
||||
return avimux_type;
|
||||
}
|
||||
|
@ -202,7 +203,7 @@ gst_avimux_class_init (GstAviMuxClass * klass)
|
|||
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_BIGFILE,
|
||||
g_param_spec_boolean ("bigfile", "Bigfile Support",
|
||||
"Support for openDML-2.0 (big) AVI files", 0, G_PARAM_READWRITE));
|
||||
"Support for openDML-2.0 (big) AVI files", 0, G_PARAM_READWRITE));
|
||||
|
||||
gstelement_class->request_new_pad = gst_avimux_request_new_pad;
|
||||
|
||||
|
@ -230,7 +231,7 @@ gst_avimux_init (GstAviMux * avimux)
|
|||
|
||||
avimux->srcpad =
|
||||
gst_pad_new_from_template (gst_element_class_get_pad_template (klass,
|
||||
"src"), "src");
|
||||
"src"), "src");
|
||||
gst_element_add_pad (GST_ELEMENT (avimux), avimux->srcpad);
|
||||
|
||||
GST_FLAG_SET (GST_ELEMENT (avimux), GST_ELEMENT_EVENT_AWARE);
|
||||
|
@ -303,11 +304,11 @@ gst_avimux_vidsinkconnect (GstPad * pad, const GstCaps * vscaps)
|
|||
avimux->vids.compression = format;
|
||||
switch (format) {
|
||||
case GST_MAKE_FOURCC ('Y', 'U', 'Y', '2'):
|
||||
avimux->vids.bit_cnt = 16;
|
||||
break;
|
||||
avimux->vids.bit_cnt = 16;
|
||||
break;
|
||||
case GST_MAKE_FOURCC ('I', '4', '2', '0'):
|
||||
avimux->vids.bit_cnt = 12;
|
||||
break;
|
||||
avimux->vids.bit_cnt = 12;
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
avimux->vids.bit_cnt = 24;
|
||||
|
@ -323,15 +324,15 @@ gst_avimux_vidsinkconnect (GstPad * pad, const GstCaps * vscaps)
|
|||
|
||||
gst_structure_get_int (structure, "divxversion", &divxversion);
|
||||
switch (divxversion) {
|
||||
case 3:
|
||||
avimux->vids.compression = GST_MAKE_FOURCC ('D', 'I', 'V', '3');
|
||||
break;
|
||||
case 4:
|
||||
avimux->vids.compression = GST_MAKE_FOURCC ('D', 'I', 'V', 'X');
|
||||
break;
|
||||
case 5:
|
||||
avimux->vids.compression = GST_MAKE_FOURCC ('D', 'X', '5', '0');
|
||||
break;
|
||||
case 3:
|
||||
avimux->vids.compression = GST_MAKE_FOURCC ('D', 'I', 'V', '3');
|
||||
break;
|
||||
case 4:
|
||||
avimux->vids.compression = GST_MAKE_FOURCC ('D', 'I', 'V', 'X');
|
||||
break;
|
||||
case 5:
|
||||
avimux->vids.compression = GST_MAKE_FOURCC ('D', 'X', '5', '0');
|
||||
break;
|
||||
}
|
||||
} else if (!strcmp (mimetype, "video/x-xvid")) {
|
||||
avimux->vids.compression = GST_MAKE_FOURCC ('X', 'V', 'I', 'D');
|
||||
|
@ -342,15 +343,15 @@ gst_avimux_vidsinkconnect (GstPad * pad, const GstCaps * vscaps)
|
|||
|
||||
gst_structure_get_int (structure, "msmpegversion", &msmpegversion);
|
||||
switch (msmpegversion) {
|
||||
case 41:
|
||||
avimux->vids.compression = GST_MAKE_FOURCC ('M', 'P', 'G', '4');
|
||||
break;
|
||||
case 42:
|
||||
avimux->vids.compression = GST_MAKE_FOURCC ('M', 'P', '4', '2');
|
||||
break;
|
||||
case 43:
|
||||
avimux->vids.compression = GST_MAKE_FOURCC ('M', 'P', '4', '3');
|
||||
break;
|
||||
case 41:
|
||||
avimux->vids.compression = GST_MAKE_FOURCC ('M', 'P', 'G', '4');
|
||||
break;
|
||||
case 42:
|
||||
avimux->vids.compression = GST_MAKE_FOURCC ('M', 'P', '4', '2');
|
||||
break;
|
||||
case 43:
|
||||
avimux->vids.compression = GST_MAKE_FOURCC ('M', 'P', '4', '3');
|
||||
break;
|
||||
}
|
||||
} else if (!strcmp (mimetype, "video/x-dv")) {
|
||||
avimux->vids.compression = GST_MAKE_FOURCC ('D', 'V', 'S', 'D');
|
||||
|
@ -417,13 +418,13 @@ gst_avimux_audsinkconnect (GstPad * pad, const GstCaps * vscaps)
|
|||
|
||||
gst_structure_get_int (structure, "layer", &layer);
|
||||
switch (layer) {
|
||||
case 3:
|
||||
avimux->auds.format = GST_RIFF_WAVE_FORMAT_MPEGL3;
|
||||
break;
|
||||
case 1:
|
||||
case 2:
|
||||
avimux->auds.format = GST_RIFF_WAVE_FORMAT_MPEGL12;
|
||||
break;
|
||||
case 3:
|
||||
avimux->auds.format = GST_RIFF_WAVE_FORMAT_MPEGL3;
|
||||
break;
|
||||
case 1:
|
||||
case 2:
|
||||
avimux->auds.format = GST_RIFF_WAVE_FORMAT_MPEGL12;
|
||||
break;
|
||||
}
|
||||
} else if (!strcmp (mimetype, "audio/x-vorbis")) {
|
||||
avimux->auds.format = GST_RIFF_WAVE_FORMAT_VORBIS3;
|
||||
|
@ -544,17 +545,17 @@ gst_avimux_riff_get_avi_header (GstAviMux * avimux)
|
|||
|
||||
/* first, let's see what actually needs to be in the buffer */
|
||||
GST_BUFFER_SIZE (buffer) = 0;
|
||||
GST_BUFFER_SIZE (buffer) += 32 + sizeof (gst_riff_avih); /* avi header */
|
||||
if (avimux->video_pad_connected) { /* we have video */
|
||||
GST_BUFFER_SIZE (buffer) += 28 + sizeof (gst_riff_strh) + sizeof (gst_riff_strf_vids); /* vid hdr */
|
||||
GST_BUFFER_SIZE (buffer) += 24; /* odml header */
|
||||
GST_BUFFER_SIZE (buffer) += 32 + sizeof (gst_riff_avih); /* avi header */
|
||||
if (avimux->video_pad_connected) { /* we have video */
|
||||
GST_BUFFER_SIZE (buffer) += 28 + sizeof (gst_riff_strh) + sizeof (gst_riff_strf_vids); /* vid hdr */
|
||||
GST_BUFFER_SIZE (buffer) += 24; /* odml header */
|
||||
}
|
||||
if (avimux->audio_pad_connected) { /* we have audio */
|
||||
GST_BUFFER_SIZE (buffer) += 28 + sizeof (gst_riff_strh) + sizeof (gst_riff_strf_auds); /* aud hdr */
|
||||
if (avimux->audio_pad_connected) { /* we have audio */
|
||||
GST_BUFFER_SIZE (buffer) += 28 + sizeof (gst_riff_strh) + sizeof (gst_riff_strf_auds); /* aud hdr */
|
||||
}
|
||||
/* this is the "riff size" */
|
||||
avimux->header_size = GST_BUFFER_SIZE (buffer);
|
||||
GST_BUFFER_SIZE (buffer) += 12; /* avi data header */
|
||||
GST_BUFFER_SIZE (buffer) += 12; /* avi data header */
|
||||
|
||||
/* allocate the buffer */
|
||||
buffdata = GST_BUFFER_DATA (buffer) = g_malloc (GST_BUFFER_SIZE (buffer));
|
||||
|
@ -630,8 +631,8 @@ gst_avimux_riff_get_avi_header (GstAviMux * avimux)
|
|||
memcpy (buffdata, "LIST", 4);
|
||||
buffdata += 4;
|
||||
temp32 =
|
||||
LE_FROM_GUINT32 (sizeof (gst_riff_strh) + sizeof (gst_riff_strf_vids) +
|
||||
4 * 5);
|
||||
LE_FROM_GUINT32 (sizeof (gst_riff_strh) + sizeof (gst_riff_strf_vids) +
|
||||
4 * 5);
|
||||
memcpy (buffdata, &temp32, 4);
|
||||
buffdata += 4;
|
||||
memcpy (buffdata, "strl", 4);
|
||||
|
@ -726,8 +727,8 @@ gst_avimux_riff_get_avi_header (GstAviMux * avimux)
|
|||
memcpy (buffdata, "LIST", 4);
|
||||
buffdata += 4;
|
||||
temp32 =
|
||||
LE_FROM_GUINT32 (sizeof (gst_riff_strh) + sizeof (gst_riff_strf_auds) +
|
||||
4 * 5);
|
||||
LE_FROM_GUINT32 (sizeof (gst_riff_strh) + sizeof (gst_riff_strf_auds) +
|
||||
4 * 5);
|
||||
memcpy (buffdata, &temp32, 4);
|
||||
buffdata += 4;
|
||||
memcpy (buffdata, "strl", 4);
|
||||
|
@ -901,8 +902,8 @@ gst_avimux_add_index (GstAviMux * avimux, guchar * code, guint32 flags,
|
|||
if (avimux->idx_index == avimux->idx_count) {
|
||||
avimux->idx_count += 256;
|
||||
avimux->idx =
|
||||
realloc (avimux->idx,
|
||||
avimux->idx_count * sizeof (gst_riff_index_entry));
|
||||
realloc (avimux->idx,
|
||||
avimux->idx_count * sizeof (gst_riff_index_entry));
|
||||
}
|
||||
memcpy (&(avimux->idx[avimux->idx_index].id), code, 4);
|
||||
avimux->idx[avimux->idx_index].flags = LE_FROM_GUINT32 (flags);
|
||||
|
@ -928,7 +929,7 @@ gst_avimux_write_index (GstAviMux * avimux)
|
|||
buffer = gst_buffer_new ();
|
||||
GST_BUFFER_SIZE (buffer) = avimux->idx_index * sizeof (gst_riff_index_entry);
|
||||
GST_BUFFER_DATA (buffer) = (unsigned char *) avimux->idx;
|
||||
avimux->idx = NULL; /* will be free()'ed by gst_buffer_unref() */
|
||||
avimux->idx = NULL; /* will be free()'ed by gst_buffer_unref() */
|
||||
avimux->total_data += GST_BUFFER_SIZE (buffer);
|
||||
gst_pad_push (avimux->srcpad, GST_DATA (buffer));
|
||||
|
||||
|
@ -947,7 +948,7 @@ gst_avimux_bigfile (GstAviMux * avimux, gboolean last)
|
|||
if (avimux->is_bigfile) {
|
||||
/* sarch back */
|
||||
event = gst_event_new_seek (GST_FORMAT_BYTES |
|
||||
GST_SEEK_METHOD_SET | GST_SEEK_FLAG_FLUSH, avimux->avix_start);
|
||||
GST_SEEK_METHOD_SET | GST_SEEK_FLAG_FLUSH, avimux->avix_start);
|
||||
/* if the event succeeds */
|
||||
gst_pad_push (avimux->srcpad, GST_DATA (event));
|
||||
|
||||
|
@ -957,7 +958,7 @@ gst_avimux_bigfile (GstAviMux * avimux, gboolean last)
|
|||
|
||||
/* go back to current location */
|
||||
event = gst_event_new_seek (GST_FORMAT_BYTES |
|
||||
GST_SEEK_METHOD_SET | GST_SEEK_FLAG_FLUSH, avimux->total_data);
|
||||
GST_SEEK_METHOD_SET | GST_SEEK_FLAG_FLUSH, avimux->total_data);
|
||||
gst_pad_push (avimux->srcpad, GST_DATA (event));
|
||||
}
|
||||
avimux->avix_start = avimux->total_data;
|
||||
|
@ -983,7 +984,7 @@ gst_avimux_start_file (GstAviMux * avimux)
|
|||
|
||||
avimux->total_data = 0;
|
||||
avimux->total_frames = 0;
|
||||
avimux->data_size = 4; /* ? */
|
||||
avimux->data_size = 4; /* ? */
|
||||
avimux->datax_size = 0;
|
||||
avimux->num_frames = 0;
|
||||
avimux->numx_frames = 0;
|
||||
|
@ -992,7 +993,7 @@ gst_avimux_start_file (GstAviMux * avimux)
|
|||
avimux->avix_start = 0;
|
||||
|
||||
avimux->idx_index = 0;
|
||||
avimux->idx_offset = 0; /* see 10 lines below */
|
||||
avimux->idx_offset = 0; /* see 10 lines below */
|
||||
avimux->idx_size = 0;
|
||||
avimux->idx_count = 0;
|
||||
avimux->idx = NULL;
|
||||
|
@ -1035,7 +1036,7 @@ gst_avimux_stop_file (GstAviMux * avimux)
|
|||
}
|
||||
if (avimux->audio_pad_connected) {
|
||||
avimux->auds_hdr.length =
|
||||
(avimux->audio_time * avimux->auds.rate) / GST_SECOND;
|
||||
(avimux->audio_time * avimux->auds.rate) / GST_SECOND;
|
||||
}
|
||||
|
||||
/* set rate and everything having to do with that */
|
||||
|
@ -1044,13 +1045,13 @@ gst_avimux_stop_file (GstAviMux * avimux)
|
|||
/* calculate bps if needed */
|
||||
if (!avimux->auds.av_bps) {
|
||||
if (avimux->audio_time) {
|
||||
avimux->auds_hdr.rate =
|
||||
(GST_SECOND * avimux->audio_size) / avimux->audio_time;
|
||||
avimux->auds_hdr.rate =
|
||||
(GST_SECOND * avimux->audio_size) / avimux->audio_time;
|
||||
} else {
|
||||
GST_ELEMENT_ERROR (avimux, STREAM, MUX,
|
||||
(_("No or invalid input audio, AVI stream will be corrupt.")),
|
||||
(NULL));
|
||||
avimux->auds_hdr.rate = 0;
|
||||
GST_ELEMENT_ERROR (avimux, STREAM, MUX,
|
||||
(_("No or invalid input audio, AVI stream will be corrupt.")),
|
||||
(NULL));
|
||||
avimux->auds_hdr.rate = 0;
|
||||
}
|
||||
avimux->auds.av_bps = avimux->auds_hdr.rate * avimux->auds_hdr.scale;
|
||||
}
|
||||
|
@ -1058,7 +1059,7 @@ gst_avimux_stop_file (GstAviMux * avimux)
|
|||
}
|
||||
if (avimux->video_pad_connected) {
|
||||
avimux->avi_hdr.max_bps += ((avimux->vids.bit_cnt + 7) / 8) *
|
||||
(1000000. / avimux->avi_hdr.us_frame) * avimux->vids.image_size;
|
||||
(1000000. / avimux->avi_hdr.us_frame) * avimux->vids.image_size;
|
||||
}
|
||||
|
||||
/* seek and rewrite the header */
|
||||
|
@ -1101,11 +1102,11 @@ gst_avimux_handle_event (GstPad * pad, GstEvent * event)
|
|||
case GST_EVENT_EOS:
|
||||
/* is this allright? */
|
||||
if (pad == avimux->videosinkpad) {
|
||||
avimux->video_pad_eos = TRUE;
|
||||
avimux->video_pad_eos = TRUE;
|
||||
} else if (pad == avimux->audiosinkpad) {
|
||||
avimux->audio_pad_eos = TRUE;
|
||||
avimux->audio_pad_eos = TRUE;
|
||||
} else {
|
||||
g_warning ("Unknown pad for EOS!");
|
||||
g_warning ("Unknown pad for EOS!");
|
||||
}
|
||||
break;
|
||||
default:
|
||||
|
@ -1256,7 +1257,7 @@ gst_avimux_do_one_buffer (GstAviMux * avimux)
|
|||
{
|
||||
if (avimux->video_buffer_queue && avimux->audio_buffer_queue) {
|
||||
if (GST_BUFFER_TIMESTAMP (avimux->video_buffer_queue) <=
|
||||
GST_BUFFER_TIMESTAMP (avimux->audio_buffer_queue))
|
||||
GST_BUFFER_TIMESTAMP (avimux->audio_buffer_queue))
|
||||
gst_avimux_do_video_buffer (avimux);
|
||||
else
|
||||
gst_avimux_do_audio_buffer (avimux);
|
||||
|
|
|
@ -57,7 +57,7 @@ static GstStaticPadTemplate cutter_src_factory = GST_STATIC_PAD_TEMPLATE ("src",
|
|||
GST_PAD_SRC,
|
||||
GST_PAD_ALWAYS,
|
||||
GST_STATIC_CAPS (GST_AUDIO_INT_PAD_TEMPLATE_CAPS "; "
|
||||
GST_AUDIO_FLOAT_PAD_TEMPLATE_CAPS)
|
||||
GST_AUDIO_FLOAT_PAD_TEMPLATE_CAPS)
|
||||
);
|
||||
|
||||
static GstStaticPadTemplate cutter_sink_factory =
|
||||
|
@ -65,7 +65,7 @@ static GstStaticPadTemplate cutter_sink_factory =
|
|||
GST_PAD_SINK,
|
||||
GST_PAD_ALWAYS,
|
||||
GST_STATIC_CAPS (GST_AUDIO_INT_PAD_TEMPLATE_CAPS "; "
|
||||
GST_AUDIO_FLOAT_PAD_TEMPLATE_CAPS)
|
||||
GST_AUDIO_FLOAT_PAD_TEMPLATE_CAPS)
|
||||
);
|
||||
|
||||
static void gst_cutter_base_init (gpointer g_class);
|
||||
|
@ -101,8 +101,9 @@ gst_cutter_get_type (void)
|
|||
sizeof (GstCutter), 0,
|
||||
(GInstanceInitFunc) gst_cutter_init,
|
||||
};
|
||||
|
||||
cutter_type = g_type_register_static (GST_TYPE_ELEMENT, "GstCutter",
|
||||
&cutter_info, 0);
|
||||
&cutter_info, 0);
|
||||
}
|
||||
return cutter_type;
|
||||
}
|
||||
|
@ -146,24 +147,24 @@ gst_cutter_class_init (GstCutterClass * klass)
|
|||
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_THRESHOLD,
|
||||
g_param_spec_double ("threshold", "Threshold",
|
||||
"Volume threshold before trigger",
|
||||
-G_MAXDOUBLE, G_MAXDOUBLE, 0.0, G_PARAM_READWRITE));
|
||||
"Volume threshold before trigger",
|
||||
-G_MAXDOUBLE, G_MAXDOUBLE, 0.0, G_PARAM_READWRITE));
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_THRESHOLD_DB,
|
||||
g_param_spec_double ("threshold_dB", "Threshold (dB)",
|
||||
"Volume threshold before trigger (in dB)",
|
||||
-G_MAXDOUBLE, G_MAXDOUBLE, 0.0, G_PARAM_READWRITE));
|
||||
"Volume threshold before trigger (in dB)",
|
||||
-G_MAXDOUBLE, G_MAXDOUBLE, 0.0, G_PARAM_READWRITE));
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_RUN_LENGTH,
|
||||
g_param_spec_double ("runlength", "Runlength",
|
||||
"Length of drop below threshold before cut_stop (seconds)",
|
||||
0.0, G_MAXDOUBLE, 0.0, G_PARAM_READWRITE));
|
||||
"Length of drop below threshold before cut_stop (seconds)",
|
||||
0.0, G_MAXDOUBLE, 0.0, G_PARAM_READWRITE));
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_PRE_LENGTH,
|
||||
g_param_spec_double ("prelength", "prelength",
|
||||
"Length of pre-recording buffer (seconds)",
|
||||
0.0, G_MAXDOUBLE, 0.0, G_PARAM_READWRITE));
|
||||
"Length of pre-recording buffer (seconds)",
|
||||
0.0, G_MAXDOUBLE, 0.0, G_PARAM_READWRITE));
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_LEAKY,
|
||||
g_param_spec_boolean ("leaky", "Leaky",
|
||||
"do we leak buffers when below threshold ?",
|
||||
FALSE, G_PARAM_READWRITE));
|
||||
"do we leak buffers when below threshold ?",
|
||||
FALSE, G_PARAM_READWRITE));
|
||||
gst_cutter_signals[CUT_START] =
|
||||
g_signal_new ("cut-start", G_TYPE_FROM_CLASS (klass),
|
||||
G_SIGNAL_RUN_FIRST,
|
||||
|
@ -214,10 +215,10 @@ gst_cutter_chain (GstPad * pad, GstData * _data)
|
|||
GstBuffer *buf = GST_BUFFER (_data);
|
||||
GstCutter *filter;
|
||||
gint16 *in_data;
|
||||
double RMS = 0.0; /* RMS of signal in buffer */
|
||||
double ms = 0.0; /* mean square value of buffer */
|
||||
static gboolean silent_prev = FALSE; /* previous value of silent */
|
||||
GstBuffer *prebuf; /* pointer to a prebuffer element */
|
||||
double RMS = 0.0; /* RMS of signal in buffer */
|
||||
double ms = 0.0; /* mean square value of buffer */
|
||||
static gboolean silent_prev = FALSE; /* previous value of silent */
|
||||
GstBuffer *prebuf; /* pointer to a prebuffer element */
|
||||
|
||||
g_return_if_fail (pad != NULL);
|
||||
g_return_if_fail (GST_IS_PAD (pad));
|
||||
|
@ -247,7 +248,7 @@ gst_cutter_chain (GstPad * pad, GstData * _data)
|
|||
default:
|
||||
/* this shouldn't happen */
|
||||
g_print ("WARNING: no mean square function for width %d\n",
|
||||
filter->width);
|
||||
filter->width);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -285,10 +286,10 @@ gst_cutter_chain (GstPad * pad, GstData * _data)
|
|||
g_signal_emit (G_OBJECT (filter), gst_cutter_signals[CUT_START], 0);
|
||||
GST_DEBUG ("flushing buffer of length %.3f", filter->pre_run_length);
|
||||
while (filter->pre_buffer) {
|
||||
prebuf = (g_list_first (filter->pre_buffer))->data;
|
||||
filter->pre_buffer = g_list_remove (filter->pre_buffer, prebuf);
|
||||
gst_pad_push (filter->srcpad, GST_DATA (prebuf));
|
||||
++count;
|
||||
prebuf = (g_list_first (filter->pre_buffer))->data;
|
||||
filter->pre_buffer = g_list_remove (filter->pre_buffer, prebuf);
|
||||
gst_pad_push (filter->srcpad, GST_DATA (prebuf));
|
||||
++count;
|
||||
}
|
||||
GST_DEBUG ("flushed %d buffers", count);
|
||||
filter->pre_run_length = 0.0;
|
||||
|
@ -313,7 +314,7 @@ gst_cutter_chain (GstPad * pad, GstData * _data)
|
|||
filter->pre_run_length -= gst_audio_length (filter->srcpad, prebuf);
|
||||
/* only pass buffers if we don't leak */
|
||||
if (!filter->leaky)
|
||||
gst_pad_push (filter->srcpad, GST_DATA (prebuf));
|
||||
gst_pad_push (filter->srcpad, GST_DATA (prebuf));
|
||||
/* we unref it after getting it out of the pre_buffer */
|
||||
gst_buffer_unref (prebuf);
|
||||
}
|
||||
|
@ -327,7 +328,7 @@ gst_cutter_16bit_ms (gint16 * data, guint num_samples)
|
|||
static double inline gst_cutter_8bit_ms (gint8 * data, guint num_samples)
|
||||
#include "filter.func"
|
||||
static void
|
||||
gst_cutter_set_property (GObject * object, guint prop_id,
|
||||
gst_cutter_set_property (GObject * object, guint prop_id,
|
||||
const GValue * value, GParamSpec * pspec)
|
||||
{
|
||||
GstCutter *filter;
|
||||
|
|
|
@ -122,8 +122,9 @@ gst_gst_efence_get_type (void)
|
|||
0,
|
||||
(GInstanceInitFunc) gst_efence_init,
|
||||
};
|
||||
|
||||
plugin_type = g_type_register_static (GST_TYPE_ELEMENT,
|
||||
"GstEFence", &plugin_info, 0);
|
||||
"GstEFence", &plugin_info, 0);
|
||||
}
|
||||
return plugin_type;
|
||||
}
|
||||
|
@ -154,7 +155,7 @@ gst_efence_class_init (GstEFenceClass * klass)
|
|||
|
||||
g_object_class_install_property (gobject_class, ARG_FENCE_TOP,
|
||||
g_param_spec_boolean ("fence_top", "Fence Top",
|
||||
"Align buffers with top of fenced region", TRUE, G_PARAM_READWRITE));
|
||||
"Align buffers with top of fenced region", TRUE, G_PARAM_READWRITE));
|
||||
|
||||
gobject_class->set_property = gst_efence_set_property;
|
||||
gobject_class->get_property = gst_efence_get_property;
|
||||
|
@ -350,11 +351,11 @@ gst_fenced_buffer_default_free (GstData * data)
|
|||
if (!GST_BUFFER_FLAG_IS_SET (buffer, GST_BUFFER_DONTFREE) &&
|
||||
GST_BUFFER_DATA (buffer)) {
|
||||
GST_DEBUG ("free region %p %d", fenced_buffer->region,
|
||||
fenced_buffer->length);
|
||||
fenced_buffer->length);
|
||||
munmap (fenced_buffer->region, fenced_buffer->length);
|
||||
} else {
|
||||
GST_DEBUG ("not freeing region %p %d %p", fenced_buffer->region,
|
||||
GST_BUFFER_FLAGS (buffer), GST_BUFFER_DATA (buffer));
|
||||
GST_BUFFER_FLAGS (buffer), GST_BUFFER_DATA (buffer));
|
||||
}
|
||||
|
||||
/* set to safe values */
|
||||
|
|
|
@ -79,8 +79,9 @@ gst_navigationtest_get_type (void)
|
|||
0,
|
||||
gst_navigationtest_init,
|
||||
};
|
||||
|
||||
navigationtest_type = g_type_register_static (GST_TYPE_VIDEOFILTER,
|
||||
"GstNavigationtest", &navigationtest_info, 0);
|
||||
"GstNavigationtest", &navigationtest_info, 0);
|
||||
}
|
||||
return navigationtest_type;
|
||||
}
|
||||
|
@ -106,7 +107,7 @@ gst_navigationtest_base_init (gpointer g_class)
|
|||
|
||||
for (i = 0; i < G_N_ELEMENTS (gst_navigationtest_formats); i++) {
|
||||
gst_videofilter_class_add_format (videofilter_class,
|
||||
gst_navigationtest_formats + i);
|
||||
gst_navigationtest_formats + i);
|
||||
}
|
||||
|
||||
gst_videofilter_class_add_pad_templates (GST_VIDEOFILTER_CLASS (g_class));
|
||||
|
@ -124,8 +125,8 @@ gst_navigationtest_class_init (gpointer g_class, gpointer class_data)
|
|||
#if 0
|
||||
g_object_class_install_property (gobject_class, ARG_METHOD,
|
||||
g_param_spec_enum ("method", "method", "method",
|
||||
GST_TYPE_NAVIGATIONTEST_METHOD, GST_NAVIGATIONTEST_METHOD_1,
|
||||
G_PARAM_READWRITE));
|
||||
GST_TYPE_NAVIGATIONTEST_METHOD, GST_NAVIGATIONTEST_METHOD_1,
|
||||
G_PARAM_READWRITE));
|
||||
#endif
|
||||
|
||||
gobject_class->set_property = gst_navigationtest_set_property;
|
||||
|
@ -161,9 +162,9 @@ gst_navigationtest_handle_src_event (GstPad * pad, GstEvent * event)
|
|||
switch (GST_EVENT_TYPE (event)) {
|
||||
case GST_EVENT_NAVIGATION:
|
||||
gst_structure_get_double (event->event_data.structure.structure,
|
||||
"pointer_x", &navigationtest->x);
|
||||
"pointer_x", &navigationtest->x);
|
||||
gst_structure_get_double (event->event_data.structure.structure,
|
||||
"pointer_y", &navigationtest->y);
|
||||
"pointer_y", &navigationtest->y);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
|
|
@ -60,7 +60,8 @@ typedef struct _scratch
|
|||
gint x;
|
||||
gint dx;
|
||||
gint init;
|
||||
} scratch;
|
||||
}
|
||||
scratch;
|
||||
|
||||
static int dx[8] = { 1, 1, 0, -1, -1, -1, 0, 1 };
|
||||
static int dy[8] = { 0, -1, -1, -1, 0, 1, 1, 1 };
|
||||
|
@ -129,8 +130,9 @@ gst_agingtv_get_type (void)
|
|||
0,
|
||||
gst_agingtv_init,
|
||||
};
|
||||
|
||||
agingtv_type = g_type_register_static (GST_TYPE_VIDEOFILTER,
|
||||
"GstAgingTV", &agingtv_info, 0);
|
||||
"GstAgingTV", &agingtv_info, 0);
|
||||
}
|
||||
return agingtv_type;
|
||||
}
|
||||
|
@ -155,7 +157,7 @@ gst_agingtv_base_init (gpointer g_class)
|
|||
|
||||
for (i = 0; i < G_N_ELEMENTS (gst_agingtv_formats); i++) {
|
||||
gst_videofilter_class_add_format (videofilter_class,
|
||||
gst_agingtv_formats + i);
|
||||
gst_agingtv_formats + i);
|
||||
}
|
||||
|
||||
gst_videofilter_class_add_pad_templates (GST_VIDEOFILTER_CLASS (g_class));
|
||||
|
@ -173,7 +175,7 @@ gst_agingtv_class_init (gpointer g_class, gpointer class_data)
|
|||
#if 0
|
||||
g_object_class_install_property (gobject_class, ARG_METHOD,
|
||||
g_param_spec_enum ("method", "method", "method",
|
||||
GST_TYPE_AGINGTV_METHOD, GST_AGINGTV_METHOD_1, G_PARAM_READWRITE));
|
||||
GST_TYPE_AGINGTV_METHOD, GST_AGINGTV_METHOD_1, G_PARAM_READWRITE));
|
||||
#endif
|
||||
|
||||
gobject_class->set_property = gst_agingtv_set_property;
|
||||
|
@ -249,35 +251,35 @@ scratching (scratch * scratches, gint scratch_lines, guint32 * dest, gint width,
|
|||
scratch->x = scratch->x + scratch->dx;
|
||||
|
||||
if (scratch->x < 0 || scratch->x > width * 256) {
|
||||
scratch->life = 0;
|
||||
break;
|
||||
scratch->life = 0;
|
||||
break;
|
||||
}
|
||||
p = dest + (scratch->x >> 8);
|
||||
if (scratch->init) {
|
||||
y1 = scratch->init;
|
||||
scratch->init = 0;
|
||||
y1 = scratch->init;
|
||||
scratch->init = 0;
|
||||
} else {
|
||||
y1 = 0;
|
||||
y1 = 0;
|
||||
}
|
||||
scratch->life--;
|
||||
if (scratch->life) {
|
||||
y2 = height;
|
||||
y2 = height;
|
||||
} else {
|
||||
y2 = fastrand () % height;
|
||||
y2 = fastrand () % height;
|
||||
}
|
||||
for (y = y1; y < y2; y++) {
|
||||
a = *p & 0xfefeff;
|
||||
a += 0x202020;
|
||||
b = a & 0x1010100;
|
||||
*p = a | (b - (b >> 8));
|
||||
p += width;
|
||||
a = *p & 0xfefeff;
|
||||
a += 0x202020;
|
||||
b = a & 0x1010100;
|
||||
*p = a | (b - (b >> 8));
|
||||
p += width;
|
||||
}
|
||||
} else {
|
||||
if ((fastrand () & 0xf0000000) == 0) {
|
||||
scratch->life = 2 + (fastrand () >> 27);
|
||||
scratch->x = fastrand () % (width * 256);
|
||||
scratch->dx = ((int) fastrand ()) >> 23;
|
||||
scratch->init = (fastrand () % (height - 1)) + 1;
|
||||
scratch->life = 2 + (fastrand () >> 27);
|
||||
scratch->x = fastrand () % (width * 256);
|
||||
scratch->dx = ((int) fastrand ()) >> 23;
|
||||
scratch->init = (fastrand () % (height - 1)) + 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -311,7 +313,7 @@ dusts (guint32 * dest, gint width, gint height, gint dust_interval,
|
|||
x += dx[d];
|
||||
|
||||
if (y >= height || x >= width)
|
||||
break;
|
||||
break;
|
||||
|
||||
d = (d + fastrand () % 3 - 1) & 7;
|
||||
}
|
||||
|
@ -350,7 +352,7 @@ pits (guint32 * dest, gint width, gint height, gint area_scale,
|
|||
y = y + fastrand () % 3 - 1;
|
||||
|
||||
if (y >= height || x >= width)
|
||||
break;
|
||||
break;
|
||||
|
||||
dest[y * width + x] = 0xc0c0c0;
|
||||
}
|
||||
|
|
|
@ -41,7 +41,8 @@ typedef enum _dice_dir
|
|||
DICE_RIGHT = 1,
|
||||
DICE_DOWN = 2,
|
||||
DICE_LEFT = 3
|
||||
} DiceDir;
|
||||
}
|
||||
DiceDir;
|
||||
|
||||
struct _GstDiceTV
|
||||
{
|
||||
|
@ -112,8 +113,8 @@ gst_dicetv_get_type (void)
|
|||
};
|
||||
|
||||
dicetv_type =
|
||||
g_type_register_static (GST_TYPE_VIDEOFILTER, "GstDiceTV", &dicetv_info,
|
||||
0);
|
||||
g_type_register_static (GST_TYPE_VIDEOFILTER, "GstDiceTV", &dicetv_info,
|
||||
0);
|
||||
}
|
||||
return dicetv_type;
|
||||
}
|
||||
|
@ -146,7 +147,7 @@ gst_dicetv_base_init (gpointer g_class)
|
|||
|
||||
for (i = 0; i < G_N_ELEMENTS (gst_dicetv_formats); i++) {
|
||||
gst_videofilter_class_add_format (videofilter_class,
|
||||
gst_dicetv_formats + i);
|
||||
gst_dicetv_formats + i);
|
||||
}
|
||||
|
||||
gst_videofilter_class_add_pad_templates (GST_VIDEOFILTER_CLASS (g_class));
|
||||
|
@ -174,7 +175,7 @@ gst_dicetv_class_init (gpointer g_class, gpointer class_data)
|
|||
|
||||
g_object_class_install_property (gobject_class, ARG_CUBE_BITS,
|
||||
g_param_spec_int ("square_bits", "Square Bits", "The size of the Squares",
|
||||
MIN_CUBE_BITS, MAX_CUBE_BITS, DEFAULT_CUBE_BITS, G_PARAM_READWRITE));
|
||||
MIN_CUBE_BITS, MAX_CUBE_BITS, DEFAULT_CUBE_BITS, G_PARAM_READWRITE));
|
||||
|
||||
gobject_class->set_property = gst_dicetv_set_property;
|
||||
gobject_class->get_property = gst_dicetv_get_property;
|
||||
|
@ -255,50 +256,50 @@ gst_dicetv_draw (GstVideofilter * videofilter, void *d, void *s)
|
|||
base = (map_y << g_cube_bits) * video_width + (map_x << g_cube_bits);
|
||||
|
||||
switch (filter->dicemap[map_i]) {
|
||||
case DICE_UP:
|
||||
for (dy = 0; dy < g_cube_size; dy++) {
|
||||
i = base + dy * video_width;
|
||||
for (dx = 0; dx < g_cube_size; dx++) {
|
||||
dest[i] = src[i];
|
||||
i++;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case DICE_LEFT:
|
||||
for (dy = 0; dy < g_cube_size; dy++) {
|
||||
i = base + dy * video_width;
|
||||
case DICE_UP:
|
||||
for (dy = 0; dy < g_cube_size; dy++) {
|
||||
i = base + dy * video_width;
|
||||
for (dx = 0; dx < g_cube_size; dx++) {
|
||||
dest[i] = src[i];
|
||||
i++;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case DICE_LEFT:
|
||||
for (dy = 0; dy < g_cube_size; dy++) {
|
||||
i = base + dy * video_width;
|
||||
|
||||
for (dx = 0; dx < g_cube_size; dx++) {
|
||||
di = base + (dx * video_width) + (g_cube_size - dy - 1);
|
||||
dest[di] = src[i];
|
||||
i++;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case DICE_DOWN:
|
||||
for (dy = 0; dy < g_cube_size; dy++) {
|
||||
di = base + dy * video_width;
|
||||
i = base + (g_cube_size - dy - 1) * video_width + g_cube_size;
|
||||
for (dx = 0; dx < g_cube_size; dx++) {
|
||||
i--;
|
||||
dest[di] = src[i];
|
||||
di++;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case DICE_RIGHT:
|
||||
for (dy = 0; dy < g_cube_size; dy++) {
|
||||
i = base + (dy * video_width);
|
||||
for (dx = 0; dx < g_cube_size; dx++) {
|
||||
di = base + dy + (g_cube_size - dx - 1) * video_width;
|
||||
dest[di] = src[i];
|
||||
i++;
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
g_assert_not_reached ();
|
||||
break;
|
||||
for (dx = 0; dx < g_cube_size; dx++) {
|
||||
di = base + (dx * video_width) + (g_cube_size - dy - 1);
|
||||
dest[di] = src[i];
|
||||
i++;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case DICE_DOWN:
|
||||
for (dy = 0; dy < g_cube_size; dy++) {
|
||||
di = base + dy * video_width;
|
||||
i = base + (g_cube_size - dy - 1) * video_width + g_cube_size;
|
||||
for (dx = 0; dx < g_cube_size; dx++) {
|
||||
i--;
|
||||
dest[di] = src[i];
|
||||
di++;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case DICE_RIGHT:
|
||||
for (dy = 0; dy < g_cube_size; dy++) {
|
||||
i = base + (dy * video_width);
|
||||
for (dx = 0; dx < g_cube_size; dx++) {
|
||||
di = base + dy + (g_cube_size - dx - 1) * video_width;
|
||||
dest[di] = src[i];
|
||||
i++;
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
g_assert_not_reached ();
|
||||
break;
|
||||
}
|
||||
map_i++;
|
||||
}
|
||||
|
|
|
@ -102,8 +102,8 @@ gst_edgetv_get_type (void)
|
|||
};
|
||||
|
||||
edgetv_type =
|
||||
g_type_register_static (GST_TYPE_VIDEOFILTER, "GstEdgeTV", &edgetv_info,
|
||||
0);
|
||||
g_type_register_static (GST_TYPE_VIDEOFILTER, "GstEdgeTV", &edgetv_info,
|
||||
0);
|
||||
}
|
||||
return edgetv_type;
|
||||
}
|
||||
|
@ -130,7 +130,7 @@ gst_edgetv_base_init (gpointer g_class)
|
|||
|
||||
for (i = 0; i < G_N_ELEMENTS (gst_edgetv_formats); i++) {
|
||||
gst_videofilter_class_add_format (videofilter_class,
|
||||
gst_edgetv_formats + i);
|
||||
gst_edgetv_formats + i);
|
||||
}
|
||||
|
||||
gst_videofilter_class_add_pad_templates (GST_VIDEOFILTER_CLASS (g_class));
|
||||
|
@ -214,15 +214,15 @@ gst_edgetv_rgb32 (GstVideofilter * videofilter, void *d, void *s)
|
|||
r *= r;
|
||||
g *= g;
|
||||
b *= b;
|
||||
r = r >> 5; /* To lack the lower bit for saturated addition, */
|
||||
g = g >> 5; /* devide the value with 32, instead of 16. It is */
|
||||
b = b >> 4; /* same as `v2 &= 0xfefeff' */
|
||||
r = r >> 5; /* To lack the lower bit for saturated addition, */
|
||||
g = g >> 5; /* devide the value with 32, instead of 16. It is */
|
||||
b = b >> 4; /* same as `v2 &= 0xfefeff' */
|
||||
if (r > 127)
|
||||
r = 127;
|
||||
r = 127;
|
||||
if (g > 127)
|
||||
g = 127;
|
||||
g = 127;
|
||||
if (b > 255)
|
||||
b = 255;
|
||||
b = 255;
|
||||
v2 = (r << 17) | (g << 9) | b;
|
||||
|
||||
/* difference between the current pixel and upper neighbor. */
|
||||
|
@ -237,11 +237,11 @@ gst_edgetv_rgb32 (GstVideofilter * videofilter, void *d, void *s)
|
|||
g = g >> 5;
|
||||
b = b >> 4;
|
||||
if (r > 127)
|
||||
r = 127;
|
||||
r = 127;
|
||||
if (g > 127)
|
||||
g = 127;
|
||||
g = 127;
|
||||
if (b > 255)
|
||||
b = 255;
|
||||
b = 255;
|
||||
v3 = (r << 17) | (g << 9) | b;
|
||||
|
||||
v0 = filter->map[(y - 1) * filter->map_width * 2 + x * 2];
|
||||
|
|
|
@ -73,7 +73,7 @@ plugin_init (GstPlugin * plugin)
|
|||
|
||||
while (_elements[i].name) {
|
||||
if (!gst_element_register (plugin, _elements[i].name,
|
||||
GST_RANK_NONE, (_elements[i].type) ()))
|
||||
GST_RANK_NONE, (_elements[i].type) ()))
|
||||
return FALSE;
|
||||
i++;
|
||||
}
|
||||
|
|
|
@ -128,8 +128,8 @@ gst_quarktv_get_type (void)
|
|||
};
|
||||
|
||||
quarktv_type =
|
||||
g_type_register_static (GST_TYPE_ELEMENT, "GstQuarkTV", &quarktv_info,
|
||||
0);
|
||||
g_type_register_static (GST_TYPE_ELEMENT, "GstQuarkTV", &quarktv_info,
|
||||
0);
|
||||
}
|
||||
return quarktv_type;
|
||||
}
|
||||
|
@ -160,7 +160,7 @@ gst_quarktv_class_init (GstQuarkTVClass * klass)
|
|||
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_PLANES,
|
||||
g_param_spec_int ("planes", "Planes", "Number of frames in the buffer",
|
||||
1, 32, PLANES, G_PARAM_READWRITE));
|
||||
1, 32, PLANES, G_PARAM_READWRITE));
|
||||
|
||||
gobject_class->set_property = gst_quarktv_set_property;
|
||||
gobject_class->get_property = gst_quarktv_get_property;
|
||||
|
@ -258,8 +258,8 @@ gst_quarktv_chain (GstPad * pad, GstData * _data)
|
|||
|
||||
/* pick a random buffer */
|
||||
rand =
|
||||
filter->planetable[(filter->current_plane +
|
||||
(fastrand () >> 24)) & (filter->planes - 1)];
|
||||
filter->planetable[(filter->current_plane +
|
||||
(fastrand () >> 24)) & (filter->planes - 1)];
|
||||
|
||||
dest[area] = (rand ? ((guint32 *) GST_BUFFER_DATA (rand))[area] : 0);
|
||||
}
|
||||
|
@ -283,9 +283,9 @@ gst_quarktv_change_state (GstElement * element)
|
|||
gint i;
|
||||
|
||||
for (i = 0; i < filter->planes; i++) {
|
||||
if (filter->planetable[i])
|
||||
gst_buffer_unref (filter->planetable[i]);
|
||||
filter->planetable[i] = NULL;
|
||||
if (filter->planetable[i])
|
||||
gst_buffer_unref (filter->planetable[i]);
|
||||
filter->planetable[i] = NULL;
|
||||
}
|
||||
g_free (filter->planetable);
|
||||
filter->planetable = NULL;
|
||||
|
@ -319,20 +319,20 @@ gst_quarktv_set_property (GObject * object, guint prop_id, const GValue * value,
|
|||
|
||||
/* If the number of planes changed, copy across any existing planes */
|
||||
if (new_n_planes != filter->planes) {
|
||||
new_planetable =
|
||||
(GstBuffer **) g_malloc (new_n_planes * sizeof (GstBuffer *));
|
||||
new_planetable =
|
||||
(GstBuffer **) g_malloc (new_n_planes * sizeof (GstBuffer *));
|
||||
|
||||
for (i = 0; (i < new_n_planes) && (i < filter->planes); i++) {
|
||||
new_planetable[i] = filter->planetable[i];
|
||||
}
|
||||
for (; i < filter->planes; i++) {
|
||||
if (filter->planetable[i])
|
||||
gst_buffer_unref (filter->planetable[i]);
|
||||
}
|
||||
g_free (filter->planetable);
|
||||
filter->planetable = new_planetable;
|
||||
filter->current_plane = filter->planes - 1;
|
||||
filter->planes = new_n_planes;
|
||||
for (i = 0; (i < new_n_planes) && (i < filter->planes); i++) {
|
||||
new_planetable[i] = filter->planetable[i];
|
||||
}
|
||||
for (; i < filter->planes; i++) {
|
||||
if (filter->planetable[i])
|
||||
gst_buffer_unref (filter->planetable[i]);
|
||||
}
|
||||
g_free (filter->planetable);
|
||||
filter->planetable = new_planetable;
|
||||
filter->current_plane = filter->planes - 1;
|
||||
filter->planes = new_n_planes;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
|
|
@ -129,8 +129,8 @@ gst_revtv_get_type (void)
|
|||
};
|
||||
|
||||
revtv_type =
|
||||
g_type_register_static (GST_TYPE_VIDEOFILTER, "GstRevTV", &revtv_info,
|
||||
0);
|
||||
g_type_register_static (GST_TYPE_VIDEOFILTER, "GstRevTV", &revtv_info,
|
||||
0);
|
||||
}
|
||||
return revtv_type;
|
||||
}
|
||||
|
@ -173,13 +173,13 @@ gst_revtv_class_init (gpointer klass, gpointer class_data)
|
|||
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_DELAY,
|
||||
g_param_spec_int ("delay", "Delay", "Delay in frames between updates",
|
||||
1, 100, 1, G_PARAM_READWRITE));
|
||||
1, 100, 1, G_PARAM_READWRITE));
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_LINESPACE,
|
||||
g_param_spec_int ("linespace", "Linespace", "Control line spacing",
|
||||
1, 100, 6, G_PARAM_READWRITE));
|
||||
1, 100, 6, G_PARAM_READWRITE));
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_GAIN,
|
||||
g_param_spec_int ("gain", "Gain", "Control gain",
|
||||
1, 200, 50, G_PARAM_READWRITE));
|
||||
1, 200, 50, G_PARAM_READWRITE));
|
||||
|
||||
gobject_class->set_property = gst_revtv_set_property;
|
||||
gobject_class->get_property = gst_revtv_get_property;
|
||||
|
@ -243,7 +243,7 @@ gst_revtv_rgb32 (GstVideofilter * videofilter, void *d, void *s)
|
|||
yval = y - ((short) (R + G + B) / filter->vscale);
|
||||
|
||||
if (yval > 0) {
|
||||
dest[x + (yval * width)] = THE_COLOR;
|
||||
dest[x + (yval * width)] = THE_COLOR;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -111,8 +111,8 @@ gst_shagadelictv_get_type (void)
|
|||
};
|
||||
|
||||
shagadelictv_type =
|
||||
g_type_register_static (GST_TYPE_VIDEOFILTER, "GstShagadelicTV",
|
||||
&shagadelictv_info, 0);
|
||||
g_type_register_static (GST_TYPE_VIDEOFILTER, "GstShagadelicTV",
|
||||
&shagadelictv_info, 0);
|
||||
}
|
||||
return shagadelictv_type;
|
||||
}
|
||||
|
@ -140,7 +140,7 @@ gst_shagadelictv_base_init (gpointer g_class)
|
|||
|
||||
for (i = 0; i < G_N_ELEMENTS (gst_shagadelictv_formats); i++) {
|
||||
gst_videofilter_class_add_format (videofilter_class,
|
||||
gst_shagadelictv_formats + i);
|
||||
gst_shagadelictv_formats + i);
|
||||
}
|
||||
|
||||
gst_videofilter_class_add_pad_templates (GST_VIDEOFILTER_CLASS (g_class));
|
||||
|
@ -237,13 +237,13 @@ gst_shagadelic_initialize (GstShagadelicTV * filter)
|
|||
xx = x - filter->width / 2;
|
||||
#ifdef PS2
|
||||
filter->spiral[i++] = ((unsigned int)
|
||||
((atan2f (xx,
|
||||
yy) / ((float) M_PI) * 256 * 9) + (sqrtf (xx * xx +
|
||||
yy * yy) * 5))) & 255;
|
||||
((atan2f (xx,
|
||||
yy) / ((float) M_PI) * 256 * 9) + (sqrtf (xx * xx +
|
||||
yy * yy) * 5))) & 255;
|
||||
#else
|
||||
filter->spiral[i++] = ((unsigned int)
|
||||
((atan2 (xx, yy) / M_PI * 256 * 9) + (sqrt (xx * xx +
|
||||
yy * yy) * 5))) & 255;
|
||||
((atan2 (xx, yy) / M_PI * 256 * 9) + (sqrt (xx * xx +
|
||||
yy * yy) * 5))) & 255;
|
||||
#endif
|
||||
/* Here is another Swinger!
|
||||
* ((atan2(xx, yy)/M_PI*256) + (sqrt(xx*xx+yy*yy)*10))&255;
|
||||
|
@ -289,10 +289,10 @@ gst_shagadelictv_rgb32 (GstVideofilter * videofilter, void *d, void *s)
|
|||
* *dest++ = v & ((r<<16)|(g<<8)|b);
|
||||
*/
|
||||
r = (gchar) (filter->ripple[(filter->ry + y) * width * 2 + filter->rx +
|
||||
x] + filter->phase * 2) >> 7;
|
||||
x] + filter->phase * 2) >> 7;
|
||||
g = (gchar) (filter->spiral[y * width + x] + filter->phase * 3) >> 7;
|
||||
b = (gchar) (filter->ripple[(filter->by + y) * width * 2 + filter->bx +
|
||||
x] - filter->phase) >> 7;
|
||||
x] - filter->phase) >> 7;
|
||||
*dest++ = v & ((r << 16) | (g << 8) | b);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -116,8 +116,8 @@ gst_vertigotv_get_type (void)
|
|||
};
|
||||
|
||||
vertigotv_type =
|
||||
g_type_register_static (GST_TYPE_VIDEOFILTER, "GstVertigoTV",
|
||||
&vertigotv_info, 0);
|
||||
g_type_register_static (GST_TYPE_VIDEOFILTER, "GstVertigoTV",
|
||||
&vertigotv_info, 0);
|
||||
}
|
||||
return vertigotv_type;
|
||||
}
|
||||
|
@ -143,7 +143,7 @@ gst_vertigotv_base_init (gpointer g_class)
|
|||
|
||||
for (i = 0; i < G_N_ELEMENTS (gst_vertigotv_formats); i++) {
|
||||
gst_videofilter_class_add_format (videofilter_class,
|
||||
gst_vertigotv_formats + i);
|
||||
gst_vertigotv_formats + i);
|
||||
}
|
||||
|
||||
gst_videofilter_class_add_pad_templates (GST_VIDEOFILTER_CLASS (g_class));
|
||||
|
@ -171,10 +171,10 @@ gst_vertigotv_class_init (GstVertigoTVClass * klass, gpointer class_data)
|
|||
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_SPEED,
|
||||
g_param_spec_float ("speed", "Speed", "Control the speed of movement",
|
||||
0.01, 100.0, 0.02, G_PARAM_READWRITE));
|
||||
0.01, 100.0, 0.02, G_PARAM_READWRITE));
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_ZOOM_SPEED,
|
||||
g_param_spec_float ("zoom_speed", "Zoom Speed",
|
||||
"Control the rate of zooming", 1.01, 1.1, 1.01, G_PARAM_READWRITE));
|
||||
"Control the rate of zooming", 1.01, 1.1, 1.01, G_PARAM_READWRITE));
|
||||
|
||||
gobject_class->set_property = gst_vertigotv_set_property;
|
||||
gobject_class->get_property = gst_vertigotv_get_property;
|
||||
|
@ -246,22 +246,22 @@ gst_vertigotv_set_parms (GstVertigoTV * filter)
|
|||
if (filter->width > filter->height) {
|
||||
if (dizz >= 0) {
|
||||
if (dizz > x)
|
||||
dizz = x;
|
||||
dizz = x;
|
||||
vx = (x * (x - dizz) + y * y) / t;
|
||||
} else {
|
||||
if (dizz < -x)
|
||||
dizz = -x;
|
||||
dizz = -x;
|
||||
vx = (x * (x + dizz) + y * y) / t;
|
||||
}
|
||||
vy = (dizz * y) / t;
|
||||
} else {
|
||||
if (dizz >= 0) {
|
||||
if (dizz > y)
|
||||
dizz = y;
|
||||
dizz = y;
|
||||
vx = (x * x + y * (y - dizz)) / t;
|
||||
} else {
|
||||
if (dizz < -y)
|
||||
dizz = -y;
|
||||
dizz = -y;
|
||||
vx = (x * x + y * (y + dizz)) / t;
|
||||
}
|
||||
vy = (dizz * x) / t;
|
||||
|
@ -307,9 +307,9 @@ gst_vertigotv_rgb32 (GstVideofilter * videofilter, void *d, void *s)
|
|||
for (x = width; x > 0; x--) {
|
||||
i = (oy >> 16) * width + (ox >> 16);
|
||||
if (i < 0)
|
||||
i = 0;
|
||||
i = 0;
|
||||
if (i >= area)
|
||||
i = area;
|
||||
i = area;
|
||||
|
||||
v = filter->current_buffer[i] & 0xfcfcff;
|
||||
v = (v * 3) + ((*src++) & 0xfcfcff);
|
||||
|
|
|
@ -125,8 +125,9 @@ gst_warptv_get_type (void)
|
|||
0,
|
||||
gst_warptv_init,
|
||||
};
|
||||
|
||||
warptv_type = g_type_register_static (GST_TYPE_VIDEOFILTER,
|
||||
"GstWarpTV", &warptv_info, 0);
|
||||
"GstWarpTV", &warptv_info, 0);
|
||||
}
|
||||
return warptv_type;
|
||||
}
|
||||
|
@ -157,7 +158,7 @@ gst_warptv_base_init (gpointer g_class)
|
|||
|
||||
for (i = 0; i < G_N_ELEMENTS (gst_warptv_formats); i++) {
|
||||
gst_videofilter_class_add_format (videofilter_class,
|
||||
gst_warptv_formats + i);
|
||||
gst_warptv_formats + i);
|
||||
}
|
||||
|
||||
gst_videofilter_class_add_pad_templates (GST_VIDEOFILTER_CLASS (g_class));
|
||||
|
@ -175,7 +176,7 @@ gst_warptv_class_init (gpointer g_class, gpointer class_data)
|
|||
#if 0
|
||||
g_object_class_install_property (gobject_class, ARG_METHOD,
|
||||
g_param_spec_enum ("method", "method", "method",
|
||||
GST_TYPE_WARPTV_METHOD, GST_WARPTV_METHOD_1, G_PARAM_READWRITE));
|
||||
GST_TYPE_WARPTV_METHOD, GST_WARPTV_METHOD_1, G_PARAM_READWRITE));
|
||||
#endif
|
||||
|
||||
gobject_class->set_property = gst_warptv_set_property;
|
||||
|
@ -351,7 +352,7 @@ gst_warptv_rgb32 (GstVideofilter * videofilter, void *d, void *s)
|
|||
sintable = warptv->sintable;
|
||||
ctable = warptv->ctable;
|
||||
|
||||
skip = 0; /* video_width*sizeof(RGB32)/4 - video_width;; */
|
||||
skip = 0; /* video_width*sizeof(RGB32)/4 - video_width;; */
|
||||
c = 0;
|
||||
|
||||
for (x = 0; x < 512; x++) {
|
||||
|
@ -370,14 +371,14 @@ gst_warptv_rgb32 (GstVideofilter * videofilter, void *d, void *s)
|
|||
dy = ctable[i] + y;
|
||||
|
||||
if (dx < 0)
|
||||
dx = 0;
|
||||
dx = 0;
|
||||
else if (dx > maxx)
|
||||
dx = maxx;
|
||||
dx = maxx;
|
||||
|
||||
if (dy < 0)
|
||||
dy = 0;
|
||||
dy = 0;
|
||||
else if (dy > maxy)
|
||||
dy = maxy;
|
||||
dy = maxy;
|
||||
*dest++ = src[warptv->offstable[dy] + dx];
|
||||
}
|
||||
dest += skip;
|
||||
|
|
|
@ -103,8 +103,9 @@ gst_flxdec_get_type (void)
|
|||
0,
|
||||
(GInstanceInitFunc) gst_flxdec_init,
|
||||
};
|
||||
|
||||
flxdec_type =
|
||||
g_type_register_static (GST_TYPE_ELEMENT, "GstFlxDec", &flxdec_info, 0);
|
||||
g_type_register_static (GST_TYPE_ELEMENT, "GstFlxDec", &flxdec_info, 0);
|
||||
}
|
||||
return flxdec_type;
|
||||
}
|
||||
|
@ -172,44 +173,44 @@ flx_decode_chunks (GstFlxDec * flxdec, gulong count, gchar * data, gchar * dest)
|
|||
|
||||
switch (hdr->id) {
|
||||
case FLX_COLOR64:
|
||||
flx_decode_color (flxdec, data, dest, 2);
|
||||
data += rndalign (hdr->size) - FlxFrameChunkSize;
|
||||
break;
|
||||
flx_decode_color (flxdec, data, dest, 2);
|
||||
data += rndalign (hdr->size) - FlxFrameChunkSize;
|
||||
break;
|
||||
|
||||
case FLX_COLOR256:
|
||||
flx_decode_color (flxdec, data, dest, 0);
|
||||
data += rndalign (hdr->size) - FlxFrameChunkSize;
|
||||
break;
|
||||
flx_decode_color (flxdec, data, dest, 0);
|
||||
data += rndalign (hdr->size) - FlxFrameChunkSize;
|
||||
break;
|
||||
|
||||
case FLX_BRUN:
|
||||
flx_decode_brun (flxdec, data, dest);
|
||||
data += rndalign (hdr->size) - FlxFrameChunkSize;
|
||||
break;
|
||||
flx_decode_brun (flxdec, data, dest);
|
||||
data += rndalign (hdr->size) - FlxFrameChunkSize;
|
||||
break;
|
||||
|
||||
case FLX_LC:
|
||||
flx_decode_delta_fli (flxdec, data, dest);
|
||||
data += rndalign (hdr->size) - FlxFrameChunkSize;
|
||||
break;
|
||||
flx_decode_delta_fli (flxdec, data, dest);
|
||||
data += rndalign (hdr->size) - FlxFrameChunkSize;
|
||||
break;
|
||||
|
||||
case FLX_SS2:
|
||||
flx_decode_delta_flc (flxdec, data, dest);
|
||||
data += rndalign (hdr->size) - FlxFrameChunkSize;
|
||||
break;
|
||||
flx_decode_delta_flc (flxdec, data, dest);
|
||||
data += rndalign (hdr->size) - FlxFrameChunkSize;
|
||||
break;
|
||||
|
||||
case FLX_BLACK:
|
||||
memset (dest, 0, flxdec->size);
|
||||
break;
|
||||
memset (dest, 0, flxdec->size);
|
||||
break;
|
||||
|
||||
case FLX_MINI:
|
||||
data += rndalign (hdr->size) - FlxFrameChunkSize;
|
||||
break;
|
||||
data += rndalign (hdr->size) - FlxFrameChunkSize;
|
||||
break;
|
||||
|
||||
default:
|
||||
g_print ("GstFlxDec: Unimplented chunk type: 0x%02x size: %d\n",
|
||||
hdr->id, hdr->size);
|
||||
g_print ("GstFlxDec: Skipping...\n");
|
||||
data += rndalign (hdr->size) - FlxFrameChunkSize;
|
||||
break;
|
||||
g_print ("GstFlxDec: Unimplented chunk type: 0x%02x size: %d\n",
|
||||
hdr->id, hdr->size);
|
||||
g_print ("GstFlxDec: Skipping...\n");
|
||||
data += rndalign (hdr->size) - FlxFrameChunkSize;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -266,20 +267,20 @@ flx_decode_brun (GstFlxDec * flxdec, guchar * data, guchar * dest)
|
|||
count = *data++;
|
||||
|
||||
if (count > 0x7f) {
|
||||
/* literal run */
|
||||
count = 0x100 - count;
|
||||
row -= count;
|
||||
/* literal run */
|
||||
count = 0x100 - count;
|
||||
row -= count;
|
||||
|
||||
while (count--)
|
||||
*dest++ = *data++;
|
||||
while (count--)
|
||||
*dest++ = *data++;
|
||||
|
||||
} else {
|
||||
/* replicate run */
|
||||
row -= count;
|
||||
x = *data++;
|
||||
/* replicate run */
|
||||
row -= count;
|
||||
x = *data++;
|
||||
|
||||
while (count--)
|
||||
*dest++ = x;
|
||||
while (count--)
|
||||
*dest++ = x;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -320,17 +321,17 @@ flx_decode_delta_fli (GstFlxDec * flxdec, guchar * data, guchar * dest)
|
|||
count = *data++;
|
||||
|
||||
if (count > 0x7f) {
|
||||
/* literal run */
|
||||
count = 0x100 - count;
|
||||
x = *data++;
|
||||
/* literal run */
|
||||
count = 0x100 - count;
|
||||
x = *data++;
|
||||
|
||||
while (count--)
|
||||
*dest++ = x;
|
||||
while (count--)
|
||||
*dest++ = x;
|
||||
|
||||
} else {
|
||||
/* replicate run */
|
||||
while (count--)
|
||||
*dest++ = *data++;
|
||||
/* replicate run */
|
||||
while (count--)
|
||||
*dest++ = *data++;
|
||||
}
|
||||
}
|
||||
start_p += flxdec->hdr.width;
|
||||
|
@ -365,13 +366,13 @@ flx_decode_delta_flc (GstFlxDec * flxdec, guchar * data, guchar * dest)
|
|||
while ((opcode = (data[0] + (data[1] << 8))) & 0xc000) {
|
||||
data += 2;
|
||||
if ((opcode & 0xc000) == 0xc000) {
|
||||
/* skip count */
|
||||
start_l += (0x10000 - opcode);
|
||||
dest += flxdec->hdr.width * (0x10000 - opcode);
|
||||
/* skip count */
|
||||
start_l += (0x10000 - opcode);
|
||||
dest += flxdec->hdr.width * (0x10000 - opcode);
|
||||
} else {
|
||||
/* last pixel */
|
||||
dest += flxdec->hdr.width;
|
||||
*dest++ = (opcode & 0xff);
|
||||
/* last pixel */
|
||||
dest += flxdec->hdr.width;
|
||||
*dest++ = (opcode & 0xff);
|
||||
}
|
||||
}
|
||||
data += 2;
|
||||
|
@ -385,19 +386,19 @@ flx_decode_delta_flc (GstFlxDec * flxdec, guchar * data, guchar * dest)
|
|||
count = *data++;
|
||||
|
||||
if (count > 0x7f) {
|
||||
/* replicate word run */
|
||||
count = 0x100 - count;
|
||||
while (count--) {
|
||||
*dest++ = data[0];
|
||||
*dest++ = data[1];
|
||||
}
|
||||
data += 2;
|
||||
/* replicate word run */
|
||||
count = 0x100 - count;
|
||||
while (count--) {
|
||||
*dest++ = data[0];
|
||||
*dest++ = data[1];
|
||||
}
|
||||
data += 2;
|
||||
} else {
|
||||
/* literal word run */
|
||||
while (count--) {
|
||||
*dest++ = *data++;
|
||||
*dest++ = *data++;
|
||||
}
|
||||
/* literal word run */
|
||||
while (count--) {
|
||||
*dest++ = *data++;
|
||||
*dest++ = *data++;
|
||||
}
|
||||
}
|
||||
}
|
||||
lines--;
|
||||
|
@ -462,9 +463,9 @@ gst_flxdec_loop (GstElement * element)
|
|||
|
||||
/* check header */
|
||||
if (flxh->type != FLX_MAGICHDR_FLI &&
|
||||
flxh->type != FLX_MAGICHDR_FLC && flxh->type != FLX_MAGICHDR_FLX) {
|
||||
flxh->type != FLX_MAGICHDR_FLC && flxh->type != FLX_MAGICHDR_FLX) {
|
||||
GST_ELEMENT_ERROR (element, STREAM, WRONG_TYPE, (NULL),
|
||||
("not a flx file (type %d)\n", flxh->type));
|
||||
("not a flx file (type %d)\n", flxh->type));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -486,13 +487,13 @@ gst_flxdec_loop (GstElement * element)
|
|||
|
||||
caps = gst_caps_from_string (GST_VIDEO_CAPS_xRGB_HOST_ENDIAN);
|
||||
gst_caps_set_simple (caps,
|
||||
"width", G_TYPE_INT, flxh->width,
|
||||
"height", G_TYPE_INT, flxh->height,
|
||||
"framerate", G_TYPE_DOUBLE, GST_SECOND / flxdec->frame_time, NULL);
|
||||
"width", G_TYPE_INT, flxh->width,
|
||||
"height", G_TYPE_INT, flxh->height,
|
||||
"framerate", G_TYPE_DOUBLE, GST_SECOND / flxdec->frame_time, NULL);
|
||||
|
||||
if (flxh->depth <= 8)
|
||||
flxdec->converter =
|
||||
flx_colorspace_converter_new (flxh->width, flxh->height);
|
||||
flx_colorspace_converter_new (flxh->width, flxh->height);
|
||||
|
||||
if (flxh->type == FLX_MAGICHDR_FLC || flxh->type == FLX_MAGICHDR_FLX) {
|
||||
g_print ("GstFlxDec: (FLC) aspect_dx : %d\n", flxh->aspect_dx);
|
||||
|
@ -523,41 +524,41 @@ gst_flxdec_loop (GstElement * element)
|
|||
|
||||
switch (flxfh->id) {
|
||||
case FLX_FRAME_TYPE:
|
||||
buf = flx_get_data (flxdec, flxfh->size - FlxFrameChunkSize);
|
||||
buf = flx_get_data (flxdec, flxfh->size - FlxFrameChunkSize);
|
||||
|
||||
chunk = GST_BUFFER_DATA (buf);
|
||||
chunk = GST_BUFFER_DATA (buf);
|
||||
|
||||
if (((FlxFrameType *) chunk)->chunks == 0)
|
||||
break;
|
||||
if (((FlxFrameType *) chunk)->chunks == 0)
|
||||
break;
|
||||
|
||||
/* create 32 bits output frame */
|
||||
out = gst_buffer_new ();
|
||||
GST_BUFFER_DATA (out) = g_malloc (flxdec->size * 4);
|
||||
GST_BUFFER_SIZE (out) = flxdec->size * 4;
|
||||
/* create 32 bits output frame */
|
||||
out = gst_buffer_new ();
|
||||
GST_BUFFER_DATA (out) = g_malloc (flxdec->size * 4);
|
||||
GST_BUFFER_SIZE (out) = flxdec->size * 4;
|
||||
|
||||
/* decode chunks */
|
||||
flx_decode_chunks (flxdec,
|
||||
((FlxFrameType *) chunk)->chunks,
|
||||
GST_BUFFER_DATA (buf) + FlxFrameTypeSize,
|
||||
GST_BUFFER_DATA (flxdec->frame));
|
||||
/* decode chunks */
|
||||
flx_decode_chunks (flxdec,
|
||||
((FlxFrameType *) chunk)->chunks,
|
||||
GST_BUFFER_DATA (buf) + FlxFrameTypeSize,
|
||||
GST_BUFFER_DATA (flxdec->frame));
|
||||
|
||||
/* destroy input buffer */
|
||||
gst_buffer_unref (buf);
|
||||
/* destroy input buffer */
|
||||
gst_buffer_unref (buf);
|
||||
|
||||
/* save copy of the current frame for possible delta. */
|
||||
memcpy (GST_BUFFER_DATA (flxdec->delta),
|
||||
GST_BUFFER_DATA (flxdec->frame), GST_BUFFER_SIZE (flxdec->delta));
|
||||
/* save copy of the current frame for possible delta. */
|
||||
memcpy (GST_BUFFER_DATA (flxdec->delta),
|
||||
GST_BUFFER_DATA (flxdec->frame), GST_BUFFER_SIZE (flxdec->delta));
|
||||
|
||||
/* convert current frame. */
|
||||
flx_colorspace_convert (flxdec->converter,
|
||||
GST_BUFFER_DATA (flxdec->frame), GST_BUFFER_DATA (out));
|
||||
/* convert current frame. */
|
||||
flx_colorspace_convert (flxdec->converter,
|
||||
GST_BUFFER_DATA (flxdec->frame), GST_BUFFER_DATA (out));
|
||||
|
||||
GST_BUFFER_TIMESTAMP (out) = flxdec->next_time;
|
||||
flxdec->next_time += flxdec->frame_time;
|
||||
GST_BUFFER_TIMESTAMP (out) = flxdec->next_time;
|
||||
flxdec->next_time += flxdec->frame_time;
|
||||
|
||||
gst_pad_push (flxdec->srcpad, GST_DATA (out));
|
||||
gst_pad_push (flxdec->srcpad, GST_DATA (out));
|
||||
|
||||
break;
|
||||
break;
|
||||
}
|
||||
|
||||
/* destroy header buffer */
|
||||
|
|
|
@ -55,8 +55,8 @@ unsigned int ppcsize4;
|
|||
#endif /* PowerPC */
|
||||
|
||||
unsigned int *coeffs = 0, *freecoeffs = 0;
|
||||
guint32 *expix1 = 0; /* pointeur exporte vers p1 */
|
||||
guint32 *expix2 = 0; /* pointeur exporte vers p2 */
|
||||
guint32 *expix1 = 0; /* pointeur exporte vers p1 */
|
||||
guint32 *expix2 = 0; /* pointeur exporte vers p2 */
|
||||
guint32 zoom_width;
|
||||
|
||||
#endif /* ASM */
|
||||
|
@ -141,33 +141,33 @@ calculatePXandPY (int x, int y, int *px, int *py)
|
|||
|
||||
switch (theMode) {
|
||||
case WAVE_MODE:
|
||||
dist =
|
||||
ShiftRight (vx, 9) * ShiftRight (vx, 9) + ShiftRight (vy,
|
||||
9) * ShiftRight (vy, 9);
|
||||
fvitesse *=
|
||||
1024 +
|
||||
ShiftRight (sintable[(unsigned short) (0xffff * dist *
|
||||
EFFECT_DISTORS)], 6);
|
||||
fvitesse /= 1024;
|
||||
break;
|
||||
dist =
|
||||
ShiftRight (vx, 9) * ShiftRight (vx, 9) + ShiftRight (vy,
|
||||
9) * ShiftRight (vy, 9);
|
||||
fvitesse *=
|
||||
1024 +
|
||||
ShiftRight (sintable[(unsigned short) (0xffff * dist *
|
||||
EFFECT_DISTORS)], 6);
|
||||
fvitesse /= 1024;
|
||||
break;
|
||||
case CRYSTAL_BALL_MODE:
|
||||
dist =
|
||||
ShiftRight (vx, 9) * ShiftRight (vx, 9) + ShiftRight (vy,
|
||||
9) * ShiftRight (vy, 9);
|
||||
fvitesse += (dist * EFFECT_DISTORS >> 10);
|
||||
break;
|
||||
dist =
|
||||
ShiftRight (vx, 9) * ShiftRight (vx, 9) + ShiftRight (vy,
|
||||
9) * ShiftRight (vy, 9);
|
||||
fvitesse += (dist * EFFECT_DISTORS >> 10);
|
||||
break;
|
||||
case AMULETTE_MODE:
|
||||
dist =
|
||||
ShiftRight (vx, 9) * ShiftRight (vx, 9) + ShiftRight (vy,
|
||||
9) * ShiftRight (vy, 9);
|
||||
fvitesse -= (dist * EFFECT_DISTORS >> 4);
|
||||
break;
|
||||
dist =
|
||||
ShiftRight (vx, 9) * ShiftRight (vx, 9) + ShiftRight (vy,
|
||||
9) * ShiftRight (vy, 9);
|
||||
fvitesse -= (dist * EFFECT_DISTORS >> 4);
|
||||
break;
|
||||
case SCRUNCH_MODE:
|
||||
dist =
|
||||
ShiftRight (vx, 9) * ShiftRight (vx, 9) + ShiftRight (vy,
|
||||
9) * ShiftRight (vy, 9);
|
||||
fvitesse -= (dist * EFFECT_DISTORS >> 9);
|
||||
break;
|
||||
dist =
|
||||
ShiftRight (vx, 9) * ShiftRight (vx, 9) + ShiftRight (vy,
|
||||
9) * ShiftRight (vy, 9);
|
||||
fvitesse -= (dist * EFFECT_DISTORS >> 9);
|
||||
break;
|
||||
}
|
||||
if (vx < 0)
|
||||
*px = (middleX << 4) - (-(vx * fvitesse) >> 16);
|
||||
|
@ -285,7 +285,7 @@ zoomFilterFastRGB (Uint * pix1,
|
|||
{
|
||||
static guint32 prevX = 0, prevY = 0;
|
||||
|
||||
static char reverse = 0; /*vitesse inversé..(zoom out) */
|
||||
static char reverse = 0; /*vitesse inversé..(zoom out) */
|
||||
|
||||
/* static int perte = 100; // 100 = normal */
|
||||
static unsigned char pertedec = 8;
|
||||
|
@ -361,7 +361,7 @@ zoomFilterFastRGB (Uint * pix1,
|
|||
firstTime = 0;
|
||||
#ifdef USE_ASM
|
||||
freecoeffs = (unsigned int *)
|
||||
malloc (resx * resy * 2 * sizeof (unsigned int) + 128);
|
||||
malloc (resx * resy * 2 * sizeof (unsigned int) + 128);
|
||||
coeffs = (guint32 *) ((1 + ((unsigned int) (freecoeffs)) / 128) * 128);
|
||||
|
||||
#else
|
||||
|
@ -372,49 +372,49 @@ zoomFilterFastRGB (Uint * pix1,
|
|||
c4 = (unsigned int *) malloc (resx * resy * sizeof (unsigned int));
|
||||
#endif
|
||||
for (us = 0; us < 0xffff; us++) {
|
||||
sintable[us] = (int) (1024.0f * sin (us * 2 * 3.31415f / 0xffff));
|
||||
sintable[us] = (int) (1024.0f * sin (us * 2 * 3.31415f / 0xffff));
|
||||
}
|
||||
|
||||
{
|
||||
int loopv;
|
||||
firedec = (int *) malloc (prevY * sizeof (int));
|
||||
for (loopv = prevY; loopv != 0;) {
|
||||
static int decc = 0;
|
||||
static int spdc = 0;
|
||||
static int accel = 0;
|
||||
int loopv;
|
||||
firedec = (int *) malloc (prevY * sizeof (int));
|
||||
for (loopv = prevY; loopv != 0;) {
|
||||
static int decc = 0;
|
||||
static int spdc = 0;
|
||||
static int accel = 0;
|
||||
|
||||
loopv--;
|
||||
firedec[loopv] = decc;
|
||||
decc += spdc / 10;
|
||||
spdc += RAND () % 3;
|
||||
spdc -= RAND () % 3;
|
||||
loopv--;
|
||||
firedec[loopv] = decc;
|
||||
decc += spdc / 10;
|
||||
spdc += RAND () % 3;
|
||||
spdc -= RAND () % 3;
|
||||
|
||||
if (decc > 4)
|
||||
spdc -= 1;
|
||||
if (decc < -4)
|
||||
spdc += 1;
|
||||
if (decc > 4)
|
||||
spdc -= 1;
|
||||
if (decc < -4)
|
||||
spdc += 1;
|
||||
|
||||
if (spdc > 30)
|
||||
spdc = spdc - RAND () % 3 + accel / 10;
|
||||
if (spdc < -30)
|
||||
spdc = spdc + RAND () % 3 + accel / 10;
|
||||
if (spdc > 30)
|
||||
spdc = spdc - RAND () % 3 + accel / 10;
|
||||
if (spdc < -30)
|
||||
spdc = spdc + RAND () % 3 + accel / 10;
|
||||
|
||||
if (decc > 8 && spdc > 1)
|
||||
spdc -= RAND () % 3 - 2;
|
||||
if (decc > 8 && spdc > 1)
|
||||
spdc -= RAND () % 3 - 2;
|
||||
|
||||
if (decc < -8 && spdc < -1)
|
||||
spdc += RAND () % 3 + 2;
|
||||
if (decc < -8 && spdc < -1)
|
||||
spdc += RAND () % 3 + 2;
|
||||
|
||||
if (decc > 8 || decc < -8)
|
||||
decc = decc * 8 / 9;
|
||||
if (decc > 8 || decc < -8)
|
||||
decc = decc * 8 / 9;
|
||||
|
||||
accel += RAND () % 2;
|
||||
accel -= RAND () % 2;
|
||||
if (accel > 20)
|
||||
accel -= 2;
|
||||
if (accel < -20)
|
||||
accel += 2;
|
||||
}
|
||||
accel += RAND () % 2;
|
||||
accel -= RAND () % 2;
|
||||
if (accel > 20)
|
||||
accel -= 2;
|
||||
if (accel < -20)
|
||||
accel += 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -422,67 +422,67 @@ zoomFilterFastRGB (Uint * pix1,
|
|||
/* generation du buffer */
|
||||
for (y = 0; y < prevY; y++)
|
||||
for (x = 0; x < prevX; x++) {
|
||||
int px, py;
|
||||
unsigned char coefv, coefh;
|
||||
int px, py;
|
||||
unsigned char coefv, coefh;
|
||||
|
||||
/* calculer px et py en fonction de */
|
||||
/* x,y,middleX,middleY et theMode */
|
||||
calculatePXandPY (x, y, &px, &py);
|
||||
if ((px == x << 4) && (py == y << 4))
|
||||
py += 8;
|
||||
/* calculer px et py en fonction de */
|
||||
/* x,y,middleX,middleY et theMode */
|
||||
calculatePXandPY (x, y, &px, &py);
|
||||
if ((px == x << 4) && (py == y << 4))
|
||||
py += 8;
|
||||
|
||||
if ((py < 0) || (px < 0) ||
|
||||
(py >= (prevY - 1) * sqrtperte) ||
|
||||
(px >= (prevX - 1) * sqrtperte)) {
|
||||
if ((py < 0) || (px < 0) ||
|
||||
(py >= (prevY - 1) * sqrtperte) ||
|
||||
(px >= (prevX - 1) * sqrtperte)) {
|
||||
#ifdef USE_ASM
|
||||
coeffs[(y * prevX + x) * 2] = 0;
|
||||
coeffs[(y * prevX + x) * 2 + 1] = 0;
|
||||
coeffs[(y * prevX + x) * 2] = 0;
|
||||
coeffs[(y * prevX + x) * 2 + 1] = 0;
|
||||
#else
|
||||
pos10[y * prevX + x] = 0;
|
||||
c1[y * prevX + x] = 0;
|
||||
c2[y * prevX + x] = 0;
|
||||
c3[y * prevX + x] = 0;
|
||||
c4[y * prevX + x] = 0;
|
||||
pos10[y * prevX + x] = 0;
|
||||
c1[y * prevX + x] = 0;
|
||||
c2[y * prevX + x] = 0;
|
||||
c3[y * prevX + x] = 0;
|
||||
c4[y * prevX + x] = 0;
|
||||
#endif
|
||||
} else {
|
||||
int npx10;
|
||||
int npy10;
|
||||
int pos;
|
||||
} else {
|
||||
int npx10;
|
||||
int npy10;
|
||||
int pos;
|
||||
|
||||
npx10 = (px / sqrtperte);
|
||||
npy10 = (py / sqrtperte);
|
||||
npx10 = (px / sqrtperte);
|
||||
npy10 = (py / sqrtperte);
|
||||
|
||||
/* if (npx10 >= prevX) fprintf(stderr,"error npx:%d",npx10);
|
||||
if (npy10 >= prevY) fprintf(stderr,"error npy:%d",npy10);
|
||||
*/
|
||||
coefh = px % sqrtperte;
|
||||
coefv = py % sqrtperte;
|
||||
coefh = px % sqrtperte;
|
||||
coefv = py % sqrtperte;
|
||||
#ifdef USE_ASM
|
||||
pos = (y * prevX + x) * 2;
|
||||
coeffs[pos] = (npx10 + prevX * npy10) * 4;
|
||||
pos = (y * prevX + x) * 2;
|
||||
coeffs[pos] = (npx10 + prevX * npy10) * 4;
|
||||
|
||||
if (!(coefh || coefv))
|
||||
coeffs[pos + 1] = (sqrtperte * sqrtperte - 1);
|
||||
else
|
||||
coeffs[pos + 1] = ((sqrtperte - coefh) * (sqrtperte - coefv));
|
||||
if (!(coefh || coefv))
|
||||
coeffs[pos + 1] = (sqrtperte * sqrtperte - 1);
|
||||
else
|
||||
coeffs[pos + 1] = ((sqrtperte - coefh) * (sqrtperte - coefv));
|
||||
|
||||
coeffs[pos + 1] |= (coefh * (sqrtperte - coefv)) << 8;
|
||||
coeffs[pos + 1] |= ((sqrtperte - coefh) * coefv) << 16;
|
||||
coeffs[pos + 1] |= (coefh * coefv) << 24;
|
||||
coeffs[pos + 1] |= (coefh * (sqrtperte - coefv)) << 8;
|
||||
coeffs[pos + 1] |= ((sqrtperte - coefh) * coefv) << 16;
|
||||
coeffs[pos + 1] |= (coefh * coefv) << 24;
|
||||
#else
|
||||
pos = y * prevX + x;
|
||||
pos10[pos] = npx10 + prevX * npy10;
|
||||
pos = y * prevX + x;
|
||||
pos10[pos] = npx10 + prevX * npy10;
|
||||
|
||||
if (!(coefh || coefv))
|
||||
c1[pos] = sqrtperte * sqrtperte - 1;
|
||||
else
|
||||
c1[pos] = (sqrtperte - coefh) * (sqrtperte - coefv);
|
||||
if (!(coefh || coefv))
|
||||
c1[pos] = sqrtperte * sqrtperte - 1;
|
||||
else
|
||||
c1[pos] = (sqrtperte - coefh) * (sqrtperte - coefv);
|
||||
|
||||
c2[pos] = coefh * (sqrtperte - coefv);
|
||||
c3[pos] = (sqrtperte - coefh) * coefv;
|
||||
c4[pos] = coefh * coefv;
|
||||
c2[pos] = coefh * (sqrtperte - coefv);
|
||||
c3[pos] = (sqrtperte - coefh) * coefv;
|
||||
c4[pos] = coefh * coefv;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#ifdef USE_ASM
|
||||
|
@ -511,21 +511,21 @@ zoomFilterFastRGB (Uint * pix1,
|
|||
getPixelRGB_ (pix1, pos10[position] + prevX + 1, &col4);
|
||||
|
||||
couleur.r = col1.r * c1[position]
|
||||
+ col2.r * c2[position]
|
||||
+ col3.r * c3[position]
|
||||
+ col4.r * c4[position];
|
||||
+ col2.r * c2[position]
|
||||
+ col3.r * c3[position]
|
||||
+ col4.r * c4[position];
|
||||
couleur.r >>= pertedec;
|
||||
|
||||
couleur.v = col1.v * c1[position]
|
||||
+ col2.v * c2[position]
|
||||
+ col3.v * c3[position]
|
||||
+ col4.v * c4[position];
|
||||
+ col2.v * c2[position]
|
||||
+ col3.v * c3[position]
|
||||
+ col4.v * c4[position];
|
||||
couleur.v >>= pertedec;
|
||||
|
||||
couleur.b = col1.b * c1[position]
|
||||
+ col2.b * c2[position]
|
||||
+ col3.b * c3[position]
|
||||
+ col4.b * c4[position];
|
||||
+ col2.b * c2[position]
|
||||
+ col3.b * c3[position]
|
||||
+ col4.b * c4[position];
|
||||
couleur.b >>= pertedec;
|
||||
|
||||
setPixelRGB_ (pix2, position, couleur);
|
||||
|
|
|
@ -67,21 +67,21 @@ goom_set_resolution (guint32 resx, guint32 resy)
|
|||
guint32 *
|
||||
goom_update (gint16 data[2][512])
|
||||
{
|
||||
static int lockvar = 0; /* pour empecher de nouveaux changements */
|
||||
static int goomvar = 0; /* boucle des gooms */
|
||||
static int totalgoom = 0; /* nombre de gooms par seconds */
|
||||
static int agoom = 0; /* un goom a eu lieu.. */
|
||||
static int loopvar = 0; /* mouvement des points */
|
||||
static int speedvar = 0; /* vitesse des particules */
|
||||
static int lineMode = 0; /* l'effet lineaire a dessiner */
|
||||
static int lockvar = 0; /* pour empecher de nouveaux changements */
|
||||
static int goomvar = 0; /* boucle des gooms */
|
||||
static int totalgoom = 0; /* nombre de gooms par seconds */
|
||||
static int agoom = 0; /* un goom a eu lieu.. */
|
||||
static int loopvar = 0; /* mouvement des points */
|
||||
static int speedvar = 0; /* vitesse des particules */
|
||||
static int lineMode = 0; /* l'effet lineaire a dessiner */
|
||||
guint32 *return_val;
|
||||
guint32 pointWidth;
|
||||
guint32 pointHeight;
|
||||
int incvar; /* volume du son */
|
||||
int accelvar; /* acceleration des particules */
|
||||
int incvar; /* volume du son */
|
||||
int accelvar; /* acceleration des particules */
|
||||
int i;
|
||||
float largfactor; /* elargissement de l'intervalle d'évolution des points */
|
||||
static char goomlimit = 2; /* sensibilité du goom */
|
||||
float largfactor; /* elargissement de l'intervalle d'évolution des points */
|
||||
static char goomlimit = 2; /* sensibilité du goom */
|
||||
static ZoomFilterData zfd = {
|
||||
128, 8, 16,
|
||||
1, 1, 0, WAVE_MODE,
|
||||
|
@ -128,26 +128,26 @@ goom_update (gint16 data[2][512])
|
|||
loopvar += speedvar + 1;
|
||||
|
||||
pointFilter (p1,
|
||||
YELLOW,
|
||||
((pointWidth - 6.0f) * largfactor + 5.0f),
|
||||
((pointHeight - 6.0f) * largfactor + 5.0f),
|
||||
i * 152.0f, 128.0f, loopvar + i * 2032);
|
||||
YELLOW,
|
||||
((pointWidth - 6.0f) * largfactor + 5.0f),
|
||||
((pointHeight - 6.0f) * largfactor + 5.0f),
|
||||
i * 152.0f, 128.0f, loopvar + i * 2032);
|
||||
pointFilter (p1, ORANGE,
|
||||
((pointWidth / 2) * largfactor) / i + 10.0f * i,
|
||||
((pointHeight / 2) * largfactor) / i + 10.0f * i,
|
||||
96.0f, i * 80.0f, loopvar / i);
|
||||
((pointWidth / 2) * largfactor) / i + 10.0f * i,
|
||||
((pointHeight / 2) * largfactor) / i + 10.0f * i,
|
||||
96.0f, i * 80.0f, loopvar / i);
|
||||
pointFilter (p1, VIOLET,
|
||||
((pointHeight / 3 + 5.0f) * largfactor) / i + 10.0f * i,
|
||||
((pointHeight / 3 + 5.0f) * largfactor) / i + 10.0f * i,
|
||||
i + 122.0f, 134.0f, loopvar / i);
|
||||
((pointHeight / 3 + 5.0f) * largfactor) / i + 10.0f * i,
|
||||
((pointHeight / 3 + 5.0f) * largfactor) / i + 10.0f * i,
|
||||
i + 122.0f, 134.0f, loopvar / i);
|
||||
pointFilter (p1, BLACK,
|
||||
((pointHeight / 3) * largfactor + 20.0f),
|
||||
((pointHeight / 3) * largfactor + 20.0f),
|
||||
58.0f, i * 66.0f, loopvar / i);
|
||||
((pointHeight / 3) * largfactor + 20.0f),
|
||||
((pointHeight / 3) * largfactor + 20.0f),
|
||||
58.0f, i * 66.0f, loopvar / i);
|
||||
pointFilter (p1, WHITE,
|
||||
(pointHeight * largfactor + 10.0f * i) / i,
|
||||
(pointHeight * largfactor + 10.0f * i) / i,
|
||||
66.0f, 74.0f, loopvar + i * 500);
|
||||
(pointHeight * largfactor + 10.0f * i) / i,
|
||||
(pointHeight * largfactor + 10.0f * i) / i,
|
||||
66.0f, 74.0f, loopvar + i * 500);
|
||||
}
|
||||
|
||||
/* par défaut pas de changement de zoom */
|
||||
|
@ -167,33 +167,33 @@ goom_update (gint16 data[2][512])
|
|||
if ((accelvar > goomlimit) || (accelvar < -goomlimit)) {
|
||||
/* UN GOOM !!! YAHOO ! */
|
||||
totalgoom++;
|
||||
agoom = 20; /* mais pdt 20 cycles, il n'y en aura plus. */
|
||||
lineMode = (lineMode + 1) % 20; /* Tous les 10 gooms on change de mode lineaire */
|
||||
agoom = 20; /* mais pdt 20 cycles, il n'y en aura plus. */
|
||||
lineMode = (lineMode + 1) % 20; /* Tous les 10 gooms on change de mode lineaire */
|
||||
|
||||
/* changement eventuel de mode */
|
||||
switch (iRAND (10)) {
|
||||
case 0:
|
||||
case 1:
|
||||
case 2:
|
||||
zfd.mode = WAVE_MODE;
|
||||
zfd.vitesse = STOP_SPEED - 1;
|
||||
zfd.reverse = 0;
|
||||
break;
|
||||
zfd.mode = WAVE_MODE;
|
||||
zfd.vitesse = STOP_SPEED - 1;
|
||||
zfd.reverse = 0;
|
||||
break;
|
||||
case 3:
|
||||
case 4:
|
||||
zfd.mode = CRYSTAL_BALL_MODE;
|
||||
break;
|
||||
zfd.mode = CRYSTAL_BALL_MODE;
|
||||
break;
|
||||
case 5:
|
||||
zfd.mode = AMULETTE_MODE;
|
||||
break;
|
||||
zfd.mode = AMULETTE_MODE;
|
||||
break;
|
||||
case 6:
|
||||
zfd.mode = WATER_MODE;
|
||||
break;
|
||||
zfd.mode = WATER_MODE;
|
||||
break;
|
||||
case 7:
|
||||
zfd.mode = SCRUNCH_MODE;
|
||||
break;
|
||||
zfd.mode = SCRUNCH_MODE;
|
||||
break;
|
||||
default:
|
||||
zfd.mode = NORMAL_MODE;
|
||||
zfd.mode = NORMAL_MODE;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -205,113 +205,113 @@ goom_update (gint16 data[2][512])
|
|||
goomvar++;
|
||||
/*if (goomvar % 1 == 0) */
|
||||
{
|
||||
guint32 vtmp;
|
||||
guint32 newvit;
|
||||
guint32 vtmp;
|
||||
guint32 newvit;
|
||||
|
||||
newvit = STOP_SPEED - speedvar / 2;
|
||||
/* retablir le zoom avant.. */
|
||||
if ((zfd.reverse) && (!(cycle % 12)) && (rand () % 3 == 0)) {
|
||||
zfd.reverse = 0;
|
||||
zfd.vitesse = STOP_SPEED - 2;
|
||||
lockvar = 50;
|
||||
}
|
||||
if (iRAND (10) == 0) {
|
||||
zfd.reverse = 1;
|
||||
lockvar = 100;
|
||||
}
|
||||
newvit = STOP_SPEED - speedvar / 2;
|
||||
/* retablir le zoom avant.. */
|
||||
if ((zfd.reverse) && (!(cycle % 12)) && (rand () % 3 == 0)) {
|
||||
zfd.reverse = 0;
|
||||
zfd.vitesse = STOP_SPEED - 2;
|
||||
lockvar = 50;
|
||||
}
|
||||
if (iRAND (10) == 0) {
|
||||
zfd.reverse = 1;
|
||||
lockvar = 100;
|
||||
}
|
||||
|
||||
/* changement de milieu.. */
|
||||
switch (iRAND (20)) {
|
||||
case 0:
|
||||
zfd.middleY = resoly - 1;
|
||||
zfd.middleX = resolx / 2;
|
||||
break;
|
||||
case 1:
|
||||
zfd.middleX = resolx - 1;
|
||||
break;
|
||||
case 2:
|
||||
zfd.middleX = 1;
|
||||
break;
|
||||
default:
|
||||
zfd.middleY = resoly / 2;
|
||||
zfd.middleX = resolx / 2;
|
||||
}
|
||||
/* changement de milieu.. */
|
||||
switch (iRAND (20)) {
|
||||
case 0:
|
||||
zfd.middleY = resoly - 1;
|
||||
zfd.middleX = resolx / 2;
|
||||
break;
|
||||
case 1:
|
||||
zfd.middleX = resolx - 1;
|
||||
break;
|
||||
case 2:
|
||||
zfd.middleX = 1;
|
||||
break;
|
||||
default:
|
||||
zfd.middleY = resoly / 2;
|
||||
zfd.middleX = resolx / 2;
|
||||
}
|
||||
|
||||
if (zfd.mode == WATER_MODE) {
|
||||
zfd.middleX = resolx / 2;
|
||||
zfd.middleY = resoly / 2;
|
||||
}
|
||||
if (zfd.mode == WATER_MODE) {
|
||||
zfd.middleX = resolx / 2;
|
||||
zfd.middleY = resoly / 2;
|
||||
}
|
||||
|
||||
switch (vtmp = (iRAND (27))) {
|
||||
case 0:
|
||||
zfd.vPlaneEffect = iRAND (3);
|
||||
zfd.vPlaneEffect -= iRAND (3);
|
||||
zfd.hPlaneEffect = iRAND (3);
|
||||
zfd.hPlaneEffect -= iRAND (3);
|
||||
break;
|
||||
case 3:
|
||||
zfd.vPlaneEffect = 0;
|
||||
zfd.hPlaneEffect = iRAND (8);
|
||||
zfd.hPlaneEffect -= iRAND (8);
|
||||
break;
|
||||
case 4:
|
||||
case 5:
|
||||
case 6:
|
||||
case 7:
|
||||
zfd.vPlaneEffect = iRAND (5);
|
||||
zfd.vPlaneEffect -= iRAND (5);
|
||||
zfd.hPlaneEffect = -zfd.vPlaneEffect;
|
||||
break;
|
||||
case 8:
|
||||
zfd.hPlaneEffect = 5 + iRAND (8);
|
||||
zfd.vPlaneEffect = -zfd.hPlaneEffect;
|
||||
break;
|
||||
case 9:
|
||||
zfd.vPlaneEffect = 5 + iRAND (8);
|
||||
zfd.hPlaneEffect = -zfd.hPlaneEffect;
|
||||
break;
|
||||
case 13:
|
||||
zfd.hPlaneEffect = 0;
|
||||
zfd.vPlaneEffect = iRAND (10);
|
||||
zfd.vPlaneEffect -= iRAND (10);
|
||||
break;
|
||||
default:
|
||||
if (vtmp < 10) {
|
||||
zfd.vPlaneEffect = 0;
|
||||
zfd.hPlaneEffect = 0;
|
||||
}
|
||||
}
|
||||
switch (vtmp = (iRAND (27))) {
|
||||
case 0:
|
||||
zfd.vPlaneEffect = iRAND (3);
|
||||
zfd.vPlaneEffect -= iRAND (3);
|
||||
zfd.hPlaneEffect = iRAND (3);
|
||||
zfd.hPlaneEffect -= iRAND (3);
|
||||
break;
|
||||
case 3:
|
||||
zfd.vPlaneEffect = 0;
|
||||
zfd.hPlaneEffect = iRAND (8);
|
||||
zfd.hPlaneEffect -= iRAND (8);
|
||||
break;
|
||||
case 4:
|
||||
case 5:
|
||||
case 6:
|
||||
case 7:
|
||||
zfd.vPlaneEffect = iRAND (5);
|
||||
zfd.vPlaneEffect -= iRAND (5);
|
||||
zfd.hPlaneEffect = -zfd.vPlaneEffect;
|
||||
break;
|
||||
case 8:
|
||||
zfd.hPlaneEffect = 5 + iRAND (8);
|
||||
zfd.vPlaneEffect = -zfd.hPlaneEffect;
|
||||
break;
|
||||
case 9:
|
||||
zfd.vPlaneEffect = 5 + iRAND (8);
|
||||
zfd.hPlaneEffect = -zfd.hPlaneEffect;
|
||||
break;
|
||||
case 13:
|
||||
zfd.hPlaneEffect = 0;
|
||||
zfd.vPlaneEffect = iRAND (10);
|
||||
zfd.vPlaneEffect -= iRAND (10);
|
||||
break;
|
||||
default:
|
||||
if (vtmp < 10) {
|
||||
zfd.vPlaneEffect = 0;
|
||||
zfd.hPlaneEffect = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (iRAND (3) != 0)
|
||||
zfd.noisify = 0;
|
||||
else {
|
||||
zfd.noisify = iRAND (3) + 2;
|
||||
lockvar *= 3;
|
||||
}
|
||||
if (iRAND (3) != 0)
|
||||
zfd.noisify = 0;
|
||||
else {
|
||||
zfd.noisify = iRAND (3) + 2;
|
||||
lockvar *= 3;
|
||||
}
|
||||
|
||||
if (zfd.mode == AMULETTE_MODE) {
|
||||
zfd.vPlaneEffect = 0;
|
||||
zfd.hPlaneEffect = 0;
|
||||
zfd.noisify = 0;
|
||||
}
|
||||
if (zfd.mode == AMULETTE_MODE) {
|
||||
zfd.vPlaneEffect = 0;
|
||||
zfd.hPlaneEffect = 0;
|
||||
zfd.noisify = 0;
|
||||
}
|
||||
|
||||
if ((zfd.middleX == 1) || (zfd.middleX == resolx - 1)) {
|
||||
zfd.vPlaneEffect = 0;
|
||||
zfd.hPlaneEffect = iRAND (2) ? 0 : zfd.hPlaneEffect;
|
||||
}
|
||||
if ((zfd.middleX == 1) || (zfd.middleX == resolx - 1)) {
|
||||
zfd.vPlaneEffect = 0;
|
||||
zfd.hPlaneEffect = iRAND (2) ? 0 : zfd.hPlaneEffect;
|
||||
}
|
||||
|
||||
if (newvit < zfd.vitesse) { /* on accelere */
|
||||
pzfd = &zfd;
|
||||
if (((newvit < STOP_SPEED - 7) &&
|
||||
(zfd.vitesse < STOP_SPEED - 6) &&
|
||||
(cycle % 3 == 0)) || (iRAND (40) == 0)) {
|
||||
zfd.vitesse = STOP_SPEED - 1;
|
||||
zfd.reverse = !zfd.reverse;
|
||||
} else {
|
||||
zfd.vitesse = (newvit + zfd.vitesse * 4) / 5;
|
||||
}
|
||||
lockvar += 50;
|
||||
}
|
||||
if (newvit < zfd.vitesse) { /* on accelere */
|
||||
pzfd = &zfd;
|
||||
if (((newvit < STOP_SPEED - 7) &&
|
||||
(zfd.vitesse < STOP_SPEED - 6) &&
|
||||
(cycle % 3 == 0)) || (iRAND (40) == 0)) {
|
||||
zfd.vitesse = STOP_SPEED - 1;
|
||||
zfd.reverse = !zfd.reverse;
|
||||
} else {
|
||||
zfd.vitesse = (newvit + zfd.vitesse * 4) / 5;
|
||||
}
|
||||
lockvar += 50;
|
||||
}
|
||||
}
|
||||
}
|
||||
/* mode mega-lent */
|
||||
|
@ -370,9 +370,9 @@ goom_update (gint16 data[2][512])
|
|||
/* si on est dans un goom : afficher les lignes... */
|
||||
if (agoom > 15)
|
||||
goom_lines
|
||||
(data, ((zfd.middleX == resolx / 2) && (zfd.middleY == resoly / 2)
|
||||
&& (zfd.mode != WATER_MODE))
|
||||
? (lineMode / 10) : 0, p2, agoom - 15);
|
||||
(data, ((zfd.middleX == resolx / 2) && (zfd.middleY == resoly / 2)
|
||||
&& (zfd.mode != WATER_MODE))
|
||||
? (lineMode / 10) : 0, p2, agoom - 15);
|
||||
|
||||
return_val = p2;
|
||||
tmp = p1;
|
||||
|
@ -390,7 +390,7 @@ goom_update (gint16 data[2][512])
|
|||
goomlimit++;
|
||||
} else {
|
||||
if ((totalgoom == 0) && (goomlimit > 1))
|
||||
goomlimit--;
|
||||
goomlimit--;
|
||||
}
|
||||
totalgoom = 0;
|
||||
}
|
||||
|
|
|
@ -88,15 +88,15 @@ static GstStaticPadTemplate src_template = GST_STATIC_PAD_TEMPLATE ("src",
|
|||
GST_STATIC_CAPS (GST_VIDEO_CAPS_xRGB_HOST_ENDIAN)
|
||||
);
|
||||
|
||||
static GstStaticPadTemplate sink_template = GST_STATIC_PAD_TEMPLATE ("sink", /* the name of the pads */
|
||||
GST_PAD_SINK, /* type of the pad */
|
||||
GST_PAD_ALWAYS, /* ALWAYS/SOMETIMES */
|
||||
static GstStaticPadTemplate sink_template = GST_STATIC_PAD_TEMPLATE ("sink", /* the name of the pads */
|
||||
GST_PAD_SINK, /* type of the pad */
|
||||
GST_PAD_ALWAYS, /* ALWAYS/SOMETIMES */
|
||||
GST_STATIC_CAPS ("audio/x-raw-int, "
|
||||
"endianness = (int) BYTE_ORDER, "
|
||||
"signed = (boolean) TRUE, "
|
||||
"width = (int) 16, "
|
||||
"depth = (int) 16, "
|
||||
"rate = (int) [ 8000, 96000 ], " "channels = (int) [ 1, 2 ]")
|
||||
"endianness = (int) BYTE_ORDER, "
|
||||
"signed = (boolean) TRUE, "
|
||||
"width = (int) 16, "
|
||||
"depth = (int) 16, "
|
||||
"rate = (int) [ 8000, 96000 ], " "channels = (int) [ 1, 2 ]")
|
||||
);
|
||||
|
||||
|
||||
|
@ -134,6 +134,7 @@ gst_goom_get_type (void)
|
|||
0,
|
||||
(GInstanceInitFunc) gst_goom_init,
|
||||
};
|
||||
|
||||
type = g_type_register_static (GST_TYPE_ELEMENT, "GstGOOM", &info, 0);
|
||||
}
|
||||
return type;
|
||||
|
@ -190,7 +191,7 @@ gst_goom_init (GstGOOM * goom)
|
|||
|
||||
goom->width = 320;
|
||||
goom->height = 200;
|
||||
goom->fps = 25.; /* desired frame rate */
|
||||
goom->fps = 25.; /* desired frame rate */
|
||||
goom->channels = 0;
|
||||
/* set to something */
|
||||
goom_init (50, 50);
|
||||
|
@ -258,7 +259,7 @@ gst_goom_src_fixate (GstPad * pad, const GstCaps * caps)
|
|||
return newcaps;
|
||||
}
|
||||
if (gst_caps_structure_fixate_field_nearest_double (structure, "framerate",
|
||||
30.0)) {
|
||||
30.0)) {
|
||||
return newcaps;
|
||||
}
|
||||
|
||||
|
@ -287,22 +288,22 @@ gst_goom_chain (GstPad * pad, GstData * _data)
|
|||
switch (GST_EVENT_TYPE (event)) {
|
||||
case GST_EVENT_DISCONTINUOUS:
|
||||
{
|
||||
gint64 value = 0;
|
||||
gint64 value = 0;
|
||||
|
||||
gst_event_discont_get_value (event, GST_FORMAT_TIME, &value);
|
||||
gst_event_discont_get_value (event, GST_FORMAT_TIME, &value);
|
||||
|
||||
goom->next_time = value;
|
||||
goom->next_time = value;
|
||||
}
|
||||
default:
|
||||
gst_pad_event_default (pad, event);
|
||||
break;
|
||||
gst_pad_event_default (pad, event);
|
||||
break;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (goom->channels == 0) {
|
||||
GST_ELEMENT_ERROR (goom, CORE, NEGOTIATION, (NULL),
|
||||
("format wasn't negotiated before chain function"));
|
||||
("format wasn't negotiated before chain function"));
|
||||
|
||||
goto done;
|
||||
}
|
||||
|
|
|
@ -35,14 +35,14 @@ goom_lines (gint16 data[2][512], unsigned int ID, unsigned int *p,
|
|||
unsigned char *color = 1 + (unsigned char *) &color1;
|
||||
|
||||
switch (ID) {
|
||||
case 0: /* Horizontal stereo lines */
|
||||
case 0: /* Horizontal stereo lines */
|
||||
{
|
||||
color1 = 0x0000AA00;
|
||||
color2 = 0x00AA0000;
|
||||
break;
|
||||
}
|
||||
|
||||
case 1: /* Stereo circles */
|
||||
case 1: /* Stereo circles */
|
||||
{
|
||||
color1 = 0x00AA33DD;
|
||||
color2 = 0x00AA33DD;
|
||||
|
@ -62,24 +62,24 @@ goom_lines (gint16 data[2][512], unsigned int ID, unsigned int *p,
|
|||
*color = lighten (*color, power);
|
||||
|
||||
switch (ID) {
|
||||
case 0: /* Horizontal stereo lines */
|
||||
case 0: /* Horizontal stereo lines */
|
||||
{
|
||||
unsigned int i;
|
||||
|
||||
for (i = 0; i < 512; i++) {
|
||||
guint32 plot;
|
||||
guint32 plot;
|
||||
|
||||
plot = i * resolx / 512 + (resoly / 4 + data[0][i] / 1600) * resolx;
|
||||
p[plot] = color1;
|
||||
p[plot + 1] = color1;
|
||||
plot = i * resolx / 512 + (resoly * 3 / 4 - data[1][i] / 1600) * resolx;
|
||||
p[plot] = color2;
|
||||
p[plot + 1] = color2;
|
||||
plot = i * resolx / 512 + (resoly / 4 + data[0][i] / 1600) * resolx;
|
||||
p[plot] = color1;
|
||||
p[plot + 1] = color1;
|
||||
plot = i * resolx / 512 + (resoly * 3 / 4 - data[1][i] / 1600) * resolx;
|
||||
p[plot] = color2;
|
||||
p[plot + 1] = color2;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case 1: /* Stereo circles */
|
||||
case 1: /* Stereo circles */
|
||||
{
|
||||
float z;
|
||||
unsigned int monX = resolx / 2;
|
||||
|
@ -87,19 +87,19 @@ goom_lines (gint16 data[2][512], unsigned int ID, unsigned int *p,
|
|||
float monY2 = resoly / 2;
|
||||
|
||||
for (z = 0; z < 6.2832f; z += 1.0f / monY) {
|
||||
/* float offset1 = 128+data[1][(unsigned int)(z*81.33f)])/200000; */
|
||||
p[monX + (unsigned int) ((monY + ((float) resoly) * (128 +
|
||||
data[1][(unsigned int) (z * 81.33f)]) / 200000) *
|
||||
cos (z) + resolx * (unsigned int) (monY2 + (monY +
|
||||
((float) resoly) * (128 +
|
||||
data[1][(unsigned int) (z * 81.33f)]) / 400000) *
|
||||
sin (z)))] = color1;
|
||||
p[monX + (unsigned int) ((monY - ((float) resoly) * (128 +
|
||||
data[0][(unsigned int) (z * 81.33f)]) / 200000) *
|
||||
cos (z) + resolx * (unsigned int) (monY2 + (monY -
|
||||
((float) resoly) * (128 +
|
||||
data[0][(unsigned int) (z * 81.33f)]) / 400000) *
|
||||
sin (z)))] = color2;
|
||||
/* float offset1 = 128+data[1][(unsigned int)(z*81.33f)])/200000; */
|
||||
p[monX + (unsigned int) ((monY + ((float) resoly) * (128 +
|
||||
data[1][(unsigned int) (z * 81.33f)]) / 200000) *
|
||||
cos (z) + resolx * (unsigned int) (monY2 + (monY +
|
||||
((float) resoly) * (128 +
|
||||
data[1][(unsigned int) (z * 81.33f)]) / 400000) *
|
||||
sin (z)))] = color1;
|
||||
p[monX + (unsigned int) ((monY - ((float) resoly) * (128 +
|
||||
data[0][(unsigned int) (z * 81.33f)]) / 200000) *
|
||||
cos (z) + resolx * (unsigned int) (monY2 + (monY -
|
||||
((float) resoly) * (128 +
|
||||
data[0][(unsigned int) (z * 81.33f)]) / 400000) *
|
||||
sin (z)))] = color2;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -129,9 +129,10 @@ gst_alawdec_get_type (void)
|
|||
0,
|
||||
(GInstanceInitFunc) gst_alawdec_init,
|
||||
};
|
||||
|
||||
alawdec_type =
|
||||
g_type_register_static (GST_TYPE_ELEMENT, "GstALawDec", &alawdec_info,
|
||||
0);
|
||||
g_type_register_static (GST_TYPE_ELEMENT, "GstALawDec", &alawdec_info,
|
||||
0);
|
||||
}
|
||||
return alawdec_type;
|
||||
}
|
||||
|
|
|
@ -171,9 +171,10 @@ gst_alawenc_get_type (void)
|
|||
0,
|
||||
(GInstanceInitFunc) gst_alawenc_init,
|
||||
};
|
||||
|
||||
alawenc_type =
|
||||
g_type_register_static (GST_TYPE_ELEMENT, "GstALawEnc", &alawenc_info,
|
||||
0);
|
||||
g_type_register_static (GST_TYPE_ELEMENT, "GstALawEnc", &alawenc_info,
|
||||
0);
|
||||
}
|
||||
return alawenc_type;
|
||||
}
|
||||
|
|
|
@ -46,9 +46,9 @@ plugin_init (GstPlugin * plugin)
|
|||
gst_pad_template_new ("sink", GST_PAD_SINK, GST_PAD_ALWAYS, alaw_caps);
|
||||
|
||||
if (!gst_element_register (plugin, "alawenc",
|
||||
GST_RANK_NONE, GST_TYPE_ALAWENC) ||
|
||||
GST_RANK_NONE, GST_TYPE_ALAWENC) ||
|
||||
!gst_element_register (plugin, "alawdec",
|
||||
GST_RANK_PRIMARY, GST_TYPE_ALAWENC))
|
||||
GST_RANK_PRIMARY, GST_TYPE_ALAWENC))
|
||||
return FALSE;
|
||||
|
||||
return TRUE;
|
||||
|
|
|
@ -25,8 +25,8 @@
|
|||
|
||||
#include <glib.h>
|
||||
|
||||
#define ZEROTRAP /* turn on the trap as per the MIL-STD */
|
||||
#define BIAS 0x84 /* define the add-in bias for 16 bit samples */
|
||||
#define ZEROTRAP /* turn on the trap as per the MIL-STD */
|
||||
#define BIAS 0x84 /* define the add-in bias for 16 bit samples */
|
||||
#define CLIP 32635
|
||||
|
||||
void
|
||||
|
@ -56,11 +56,11 @@ mulaw_encode (gint16 * in, guint8 * out, gint numsamples)
|
|||
for (i = 0; i < numsamples; i++) {
|
||||
sample = in[i];
|
||||
/** get the sample into sign-magnitude **/
|
||||
sign = (sample >> 8) & 0x80; /* set aside the sign */
|
||||
sign = (sample >> 8) & 0x80; /* set aside the sign */
|
||||
if (sign != 0)
|
||||
sample = -sample; /* get magnitude */
|
||||
sample = -sample; /* get magnitude */
|
||||
if (sample > CLIP)
|
||||
sample = CLIP; /* clip the magnitude */
|
||||
sample = CLIP; /* clip the magnitude */
|
||||
/** convert from 16 bit linear to ulaw **/
|
||||
sample = sample + BIAS;
|
||||
exponent = exp_lut[(sample >> 7) & 0xFF];
|
||||
|
@ -68,7 +68,7 @@ mulaw_encode (gint16 * in, guint8 * out, gint numsamples)
|
|||
ulawbyte = ~(sign | (exponent << 4) | mantissa);
|
||||
#ifdef ZEROTRAP
|
||||
if (ulawbyte == 0)
|
||||
ulawbyte = 0x02; /* optional CCITT trap */
|
||||
ulawbyte = 0x02; /* optional CCITT trap */
|
||||
#endif
|
||||
out[i] = ulawbyte;
|
||||
}
|
||||
|
|
|
@ -106,9 +106,10 @@ gst_mulawdec_get_type (void)
|
|||
0,
|
||||
(GInstanceInitFunc) gst_mulawdec_init,
|
||||
};
|
||||
|
||||
mulawdec_type =
|
||||
g_type_register_static (GST_TYPE_ELEMENT, "GstMuLawDec", &mulawdec_info,
|
||||
0);
|
||||
g_type_register_static (GST_TYPE_ELEMENT, "GstMuLawDec", &mulawdec_info,
|
||||
0);
|
||||
}
|
||||
return mulawdec_type;
|
||||
}
|
||||
|
|
|
@ -104,9 +104,10 @@ gst_mulawenc_get_type (void)
|
|||
0,
|
||||
(GInstanceInitFunc) gst_mulawenc_init,
|
||||
};
|
||||
|
||||
mulawenc_type =
|
||||
g_type_register_static (GST_TYPE_ELEMENT, "GstMuLawEnc", &mulawenc_info,
|
||||
0);
|
||||
g_type_register_static (GST_TYPE_ELEMENT, "GstMuLawEnc", &mulawenc_info,
|
||||
0);
|
||||
}
|
||||
return mulawenc_type;
|
||||
}
|
||||
|
|
|
@ -46,9 +46,9 @@ plugin_init (GstPlugin * plugin)
|
|||
gst_pad_template_new ("sink", GST_PAD_SINK, GST_PAD_ALWAYS, mulaw_caps);
|
||||
|
||||
if (!gst_element_register (plugin, "mulawenc",
|
||||
GST_RANK_NONE, GST_TYPE_MULAWENC) ||
|
||||
GST_RANK_NONE, GST_TYPE_MULAWENC) ||
|
||||
!gst_element_register (plugin, "mulawdec",
|
||||
GST_RANK_PRIMARY, GST_TYPE_MULAWDEC))
|
||||
GST_RANK_PRIMARY, GST_TYPE_MULAWDEC))
|
||||
return FALSE;
|
||||
|
||||
return TRUE;
|
||||
|
|
|
@ -98,8 +98,9 @@ gst_level_get_type (void)
|
|||
sizeof (GstLevel), 0,
|
||||
(GInstanceInitFunc) gst_level_init
|
||||
};
|
||||
|
||||
level_type = g_type_register_static (GST_TYPE_ELEMENT, "GstLevel",
|
||||
&level_info, 0);
|
||||
&level_info, 0);
|
||||
}
|
||||
return level_type;
|
||||
}
|
||||
|
@ -160,8 +161,8 @@ gst_level_link (GstPad * pad, const GstCaps * caps)
|
|||
|
||||
for (i = 0; i < filter->channels; ++i) {
|
||||
filter->CS[i] = filter->peak[i] = filter->last_peak[i] =
|
||||
filter->decay_peak[i] = filter->decay_peak_age[i] =
|
||||
filter->MS[i] = filter->RMS_dB[i] = 0.0;
|
||||
filter->decay_peak[i] = filter->decay_peak_age[i] =
|
||||
filter->MS[i] = filter->RMS_dB[i] = 0.0;
|
||||
}
|
||||
|
||||
filter->inited = TRUE;
|
||||
|
@ -174,7 +175,7 @@ gst_level_fast_16bit_chain (gint16 * in, guint num, gint channels,
|
|||
gint resolution, double *CS, double *peak)
|
||||
#include "filter.func"
|
||||
static void inline
|
||||
gst_level_fast_8bit_chain (gint8 * in, guint num, gint channels,
|
||||
gst_level_fast_8bit_chain (gint8 * in, guint num, gint channels,
|
||||
gint resolution, double *CS, double *peak)
|
||||
#include "filter.func"
|
||||
static void gst_level_chain (GstPad * pad, GstData * _data)
|
||||
|
@ -203,18 +204,18 @@ gst_level_fast_16bit_chain (gint16 * in, guint num, gint channels,
|
|||
num_samples = GST_BUFFER_SIZE (buf) / (filter->width / 8);
|
||||
if (num_samples % filter->channels != 0)
|
||||
g_warning
|
||||
("WARNING: level: programming error, data not properly interleaved");
|
||||
("WARNING: level: programming error, data not properly interleaved");
|
||||
|
||||
for (i = 0; i < filter->channels; ++i) {
|
||||
switch (filter->width) {
|
||||
case 16:
|
||||
gst_level_fast_16bit_chain (in_data + i, num_samples,
|
||||
filter->channels, filter->width - 1, &CS, &filter->peak[i]);
|
||||
break;
|
||||
gst_level_fast_16bit_chain (in_data + i, num_samples,
|
||||
filter->channels, filter->width - 1, &CS, &filter->peak[i]);
|
||||
break;
|
||||
case 8:
|
||||
gst_level_fast_8bit_chain (((gint8 *) in_data) + i, num_samples,
|
||||
filter->channels, filter->width - 1, &CS, &filter->peak[i]);
|
||||
break;
|
||||
gst_level_fast_8bit_chain (((gint8 *) in_data) + i, num_samples,
|
||||
filter->channels, filter->width - 1, &CS, &filter->peak[i]);
|
||||
break;
|
||||
}
|
||||
/* g_print ("DEBUG: CS %f, peak %f\n", CS, filter->peak[i]); */
|
||||
filter->CS[i] += CS;
|
||||
|
@ -240,20 +241,20 @@ gst_level_fast_16bit_chain (gint16 * in, guint num, gint channels,
|
|||
} else {
|
||||
/* make decay peak fall off if too old */
|
||||
if (filter->decay_peak_age[i] > filter->rate * filter->decay_peak_ttl) {
|
||||
double falloff_dB;
|
||||
double falloff;
|
||||
double length; /* length of buffer in seconds */
|
||||
double falloff_dB;
|
||||
double falloff;
|
||||
double length; /* length of buffer in seconds */
|
||||
|
||||
|
||||
length = (double) num_samples / (filter->channels * filter->rate);
|
||||
falloff_dB = filter->decay_peak_falloff * length;
|
||||
falloff = pow (10, falloff_dB / -20.0);
|
||||
length = (double) num_samples / (filter->channels * filter->rate);
|
||||
falloff_dB = filter->decay_peak_falloff * length;
|
||||
falloff = pow (10, falloff_dB / -20.0);
|
||||
|
||||
/* g_print ("falloff: length %f, dB falloff %f, falloff factor %e\n",
|
||||
length, falloff_dB, falloff); */
|
||||
filter->decay_peak[i] *= falloff;
|
||||
/* g_print ("peak is %f samples old, decayed with factor %e to %f\n",
|
||||
filter->decay_peak_age[i], falloff, filter->decay_peak[i]); */
|
||||
/* g_print ("falloff: length %f, dB falloff %f, falloff factor %e\n",
|
||||
length, falloff_dB, falloff); */
|
||||
filter->decay_peak[i] *= falloff;
|
||||
/* g_print ("peak is %f samples old, decayed with factor %e to %f\n",
|
||||
filter->decay_peak_age[i], falloff, filter->decay_peak[i]); */
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -265,19 +266,19 @@ gst_level_fast_16bit_chain (gint16 * in, guint num, gint channels,
|
|||
gdouble RMS, peak, endtime;
|
||||
|
||||
for (i = 0; i < filter->channels; ++i) {
|
||||
RMS = sqrt (filter->CS[i] / (filter->num_samples / filter->channels));
|
||||
peak = filter->last_peak[i];
|
||||
num_samples = GST_BUFFER_SIZE (buf) / (filter->width / 8);
|
||||
endtime = (double) GST_BUFFER_TIMESTAMP (buf) / GST_SECOND
|
||||
+ (double) num_samples / (double) filter->rate;
|
||||
RMS = sqrt (filter->CS[i] / (filter->num_samples / filter->channels));
|
||||
peak = filter->last_peak[i];
|
||||
num_samples = GST_BUFFER_SIZE (buf) / (filter->width / 8);
|
||||
endtime = (double) GST_BUFFER_TIMESTAMP (buf) / GST_SECOND
|
||||
+ (double) num_samples / (double) filter->rate;
|
||||
|
||||
g_signal_emit (G_OBJECT (filter), gst_filter_signals[SIGNAL_LEVEL], 0,
|
||||
endtime, i,
|
||||
20 * log10 (RMS), 20 * log10 (filter->last_peak[i]),
|
||||
20 * log10 (filter->decay_peak[i]));
|
||||
/* we emitted, so reset cumulative and normal peak */
|
||||
filter->CS[i] = 0.0;
|
||||
filter->last_peak[i] = 0.0;
|
||||
g_signal_emit (G_OBJECT (filter), gst_filter_signals[SIGNAL_LEVEL], 0,
|
||||
endtime, i,
|
||||
20 * log10 (RMS), 20 * log10 (filter->last_peak[i]),
|
||||
20 * log10 (filter->decay_peak[i]));
|
||||
/* we emitted, so reset cumulative and normal peak */
|
||||
filter->CS[i] = 0.0;
|
||||
filter->last_peak[i] = 0.0;
|
||||
}
|
||||
}
|
||||
filter->num_samples = 0;
|
||||
|
@ -292,7 +293,7 @@ gst_level_change_state (GstElement * element)
|
|||
switch (GST_STATE_TRANSITION (element)) {
|
||||
case GST_STATE_PAUSED_TO_PLAYING:
|
||||
if (!filter->inited)
|
||||
return GST_STATE_FAILURE;
|
||||
return GST_STATE_FAILURE;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
@ -384,19 +385,19 @@ gst_level_class_init (GstLevelClass * klass)
|
|||
parent_class = g_type_class_ref (GST_TYPE_ELEMENT);
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_SIGNAL_LEVEL,
|
||||
g_param_spec_boolean ("signal", "Signal",
|
||||
"Emit level signals for each interval", TRUE, G_PARAM_READWRITE));
|
||||
"Emit level signals for each interval", TRUE, G_PARAM_READWRITE));
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_SIGNAL_INTERVAL,
|
||||
g_param_spec_double ("interval", "Interval",
|
||||
"Interval between emissions (in seconds)",
|
||||
0.01, 100.0, 0.1, G_PARAM_READWRITE));
|
||||
"Interval between emissions (in seconds)",
|
||||
0.01, 100.0, 0.1, G_PARAM_READWRITE));
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_PEAK_TTL,
|
||||
g_param_spec_double ("peak_ttl", "Peak TTL",
|
||||
"Time To Live of decay peak before it falls back",
|
||||
0, 100.0, 0.3, G_PARAM_READWRITE));
|
||||
"Time To Live of decay peak before it falls back",
|
||||
0, 100.0, 0.3, G_PARAM_READWRITE));
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_PEAK_FALLOFF,
|
||||
g_param_spec_double ("peak_falloff", "Peak Falloff",
|
||||
"Decay rate of decay peak after TTL (in dB/sec)",
|
||||
0.0, G_MAXDOUBLE, 10.0, G_PARAM_READWRITE));
|
||||
"Decay rate of decay peak after TTL (in dB/sec)",
|
||||
0.0, G_MAXDOUBLE, 10.0, G_PARAM_READWRITE));
|
||||
|
||||
gobject_class->set_property = gst_level_set_property;
|
||||
gobject_class->get_property = gst_level_get_property;
|
||||
|
@ -437,7 +438,7 @@ gst_level_init (GstLevel * filter)
|
|||
|
||||
filter->interval = 0.1;
|
||||
filter->decay_peak_ttl = 0.4;
|
||||
filter->decay_peak_falloff = 10.0; /* dB falloff (/sec) */
|
||||
filter->decay_peak_falloff = 10.0; /* dB falloff (/sec) */
|
||||
}
|
||||
|
||||
static gboolean
|
||||
|
|
|
@ -28,10 +28,10 @@
|
|||
#include <gst/gst.h>
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
gboolean got_channel[2] = { FALSE, FALSE }; /* to see if we got the signal for this one yet */
|
||||
gint channels = 0; /* guess at how many channels there are */
|
||||
gdouble last_time = 0.0; /* time of last signal */
|
||||
gdouble values[2][3]; /* array of levels from which to print */
|
||||
gboolean got_channel[2] = { FALSE, FALSE }; /* to see if we got the signal for this one yet */
|
||||
gint channels = 0; /* guess at how many channels there are */
|
||||
gdouble last_time = 0.0; /* time of last signal */
|
||||
gdouble values[2][3]; /* array of levels from which to print */
|
||||
|
||||
static void
|
||||
level_callback (GstElement * element, gdouble time, gint channel,
|
||||
|
@ -66,7 +66,7 @@ level_callback (GstElement * element, gdouble time, gint channel,
|
|||
g_print ("%f ", time);
|
||||
for (i = 0; i < channels; ++i)
|
||||
for (j = 0; j < 3; ++j)
|
||||
g_print ("%f ", values[i][j]);
|
||||
g_print ("%f ", values[i][j]);
|
||||
g_print ("\n");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -59,8 +59,8 @@ gst_ebml_read_get_type (void)
|
|||
};
|
||||
|
||||
gst_ebml_read_type =
|
||||
g_type_register_static (GST_TYPE_ELEMENT, "GstEbmlRead",
|
||||
&gst_ebml_read_info, 0);
|
||||
g_type_register_static (GST_TYPE_ELEMENT, "GstEbmlRead",
|
||||
&gst_ebml_read_info, 0);
|
||||
}
|
||||
|
||||
return gst_ebml_read_type;
|
||||
|
@ -92,16 +92,16 @@ gst_ebml_read_change_state (GstElement * element)
|
|||
switch (GST_STATE_TRANSITION (element)) {
|
||||
case GST_STATE_READY_TO_PAUSED:
|
||||
if (!ebml->sinkpad)
|
||||
return GST_STATE_FAILURE;
|
||||
return GST_STATE_FAILURE;
|
||||
ebml->bs = gst_bytestream_new (ebml->sinkpad);
|
||||
break;
|
||||
case GST_STATE_PAUSED_TO_READY:
|
||||
gst_bytestream_destroy (ebml->bs);
|
||||
while (ebml->level) {
|
||||
GstEbmlLevel *level = ebml->level->data;
|
||||
GstEbmlLevel *level = ebml->level->data;
|
||||
|
||||
ebml->level = g_list_remove (ebml->level, level);
|
||||
g_free (level);
|
||||
ebml->level = g_list_remove (ebml->level, level);
|
||||
g_free (level);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
|
@ -167,7 +167,7 @@ gst_ebml_read_element_id (GstEbmlRead * ebml, guint32 * id, guint * level_up)
|
|||
|
||||
gst_event_unref (event);
|
||||
GST_ELEMENT_ERROR (ebml, RESOURCE, READ, (NULL),
|
||||
("Read error at position %llu (0x%llx)", pos, pos));
|
||||
("Read error at position %llu (0x%llx)", pos, pos));
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
@ -180,8 +180,8 @@ gst_ebml_read_element_id (GstEbmlRead * ebml, guint32 * id, guint * level_up)
|
|||
guint64 pos = gst_bytestream_tell (ebml->bs);
|
||||
|
||||
GST_ELEMENT_ERROR (ebml, STREAM, DEMUX, (NULL),
|
||||
("Invalid EBML ID size tag (0x%x) at position %llu (0x%llx)",
|
||||
data[0], pos, pos));
|
||||
("Invalid EBML ID size tag (0x%x) at position %llu (0x%llx)",
|
||||
data[0], pos, pos));
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -189,7 +189,7 @@ gst_ebml_read_element_id (GstEbmlRead * ebml, guint32 * id, guint * level_up)
|
|||
guint64 pos = gst_bytestream_tell (ebml->bs);
|
||||
|
||||
GST_ELEMENT_ERROR (ebml, RESOURCE, READ, (NULL),
|
||||
("Read error at position %llu (0x%llx)", pos, pos));
|
||||
("Read error at position %llu (0x%llx)", pos, pos));
|
||||
return -1;
|
||||
}
|
||||
while (n < read)
|
||||
|
@ -220,7 +220,7 @@ gst_ebml_read_element_length (GstEbmlRead * ebml, guint64 * length)
|
|||
guint64 pos = gst_bytestream_tell (ebml->bs);
|
||||
|
||||
GST_ELEMENT_ERROR (ebml, RESOURCE, READ, (NULL),
|
||||
("Read error at position %llu (0x%llx)", pos, pos));
|
||||
("Read error at position %llu (0x%llx)", pos, pos));
|
||||
return -1;
|
||||
}
|
||||
total = data[0];
|
||||
|
@ -232,8 +232,8 @@ gst_ebml_read_element_length (GstEbmlRead * ebml, guint64 * length)
|
|||
guint64 pos = gst_bytestream_tell (ebml->bs);
|
||||
|
||||
GST_ELEMENT_ERROR (ebml, STREAM, DEMUX, (NULL),
|
||||
("Invalid EBML length size tag (0x%x) at position %llu (0x%llx)",
|
||||
data[0], pos, pos));
|
||||
("Invalid EBML length size tag (0x%x) at position %llu (0x%llx)",
|
||||
data[0], pos, pos));
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -243,7 +243,7 @@ gst_ebml_read_element_length (GstEbmlRead * ebml, guint64 * length)
|
|||
guint64 pos = gst_bytestream_tell (ebml->bs);
|
||||
|
||||
GST_ELEMENT_ERROR (ebml, RESOURCE, READ, (NULL),
|
||||
("Read error at position %llu (0x%llx)", pos, pos));
|
||||
("Read error at position %llu (0x%llx)", pos, pos));
|
||||
return -1;
|
||||
}
|
||||
while (n < read) {
|
||||
|
@ -275,7 +275,7 @@ gst_ebml_read_element_data (GstEbmlRead * ebml, guint64 length)
|
|||
guint64 pos = gst_bytestream_tell (ebml->bs);
|
||||
|
||||
GST_ELEMENT_ERROR (ebml, RESOURCE, READ, (NULL),
|
||||
("Read error at position %llu (0x%llx)", pos, pos));
|
||||
("Read error at position %llu (0x%llx)", pos, pos));
|
||||
if (buf)
|
||||
gst_buffer_unref (buf);
|
||||
return NULL;
|
||||
|
@ -328,7 +328,7 @@ gst_ebml_read_seek (GstEbmlRead * ebml, guint64 offset)
|
|||
/* now seek */
|
||||
if (!gst_bytestream_seek (ebml->bs, offset, GST_SEEK_METHOD_SET)) {
|
||||
GST_ELEMENT_ERROR (ebml, RESOURCE, SEEK, (NULL),
|
||||
("Seek to position %llu (0x%llx) failed", offset, offset));
|
||||
("Seek to position %llu (0x%llx) failed", offset, offset));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -385,7 +385,7 @@ gst_ebml_read_skip (GstEbmlRead * ebml)
|
|||
return gst_bytestream_flush (ebml->bs, length);
|
||||
|
||||
if (!(event = gst_ebml_read_seek (ebml,
|
||||
gst_bytestream_tell (ebml->bs) + length)))
|
||||
gst_bytestream_tell (ebml->bs) + length)))
|
||||
return FALSE;
|
||||
|
||||
gst_event_unref (event);
|
||||
|
@ -432,8 +432,8 @@ gst_ebml_read_uint (GstEbmlRead * ebml, guint32 * id, guint64 * num)
|
|||
size = GST_BUFFER_SIZE (buf);
|
||||
if (size < 1 || size > 8) {
|
||||
GST_ELEMENT_ERROR (ebml, STREAM, DEMUX, (NULL),
|
||||
("Invalid integer element size %d at position %llu (0x%llu)",
|
||||
size, GST_BUFFER_OFFSET (buf), GST_BUFFER_OFFSET (buf)));
|
||||
("Invalid integer element size %d at position %llu (0x%llu)",
|
||||
size, GST_BUFFER_OFFSET (buf), GST_BUFFER_OFFSET (buf)));
|
||||
gst_buffer_unref (buf);
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -466,8 +466,8 @@ gst_ebml_read_sint (GstEbmlRead * ebml, guint32 * id, gint64 * num)
|
|||
size = GST_BUFFER_SIZE (buf);
|
||||
if (size < 1 || size > 8) {
|
||||
GST_ELEMENT_ERROR (ebml, STREAM, DEMUX, (NULL),
|
||||
("Invalid integer element size %d at position %llu (0x%llx)",
|
||||
size, GST_BUFFER_OFFSET (buf), GST_BUFFER_OFFSET (buf)));
|
||||
("Invalid integer element size %d at position %llu (0x%llx)",
|
||||
size, GST_BUFFER_OFFSET (buf), GST_BUFFER_OFFSET (buf)));
|
||||
gst_buffer_unref (buf);
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -509,15 +509,15 @@ gst_ebml_read_float (GstEbmlRead * ebml, guint32 * id, gdouble * num)
|
|||
|
||||
if (size != 4 && size != 8 && size != 10) {
|
||||
GST_ELEMENT_ERROR (ebml, STREAM, DEMUX, (NULL),
|
||||
("Invalid float element size %d at position %llu (0x%llx)",
|
||||
size, GST_BUFFER_OFFSET (buf), GST_BUFFER_OFFSET (buf)));
|
||||
("Invalid float element size %d at position %llu (0x%llx)",
|
||||
size, GST_BUFFER_OFFSET (buf), GST_BUFFER_OFFSET (buf)));
|
||||
gst_buffer_unref (buf);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (size == 10) {
|
||||
GST_ELEMENT_ERROR (ebml, CORE, NOT_IMPLEMENTED, (NULL),
|
||||
("FIXME! 10-byte floats unimplemented"));
|
||||
("FIXME! 10-byte floats unimplemented"));
|
||||
gst_buffer_unref (buf);
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -682,79 +682,79 @@ gst_ebml_read_header (GstEbmlRead * ebml, gchar ** doctype, guint * version)
|
|||
break;
|
||||
|
||||
switch (id) {
|
||||
/* is our read version uptodate? */
|
||||
/* is our read version uptodate? */
|
||||
case GST_EBML_ID_EBMLREADVERSION:{
|
||||
guint64 num;
|
||||
guint64 num;
|
||||
|
||||
if (!gst_ebml_read_uint (ebml, &id, &num))
|
||||
return FALSE;
|
||||
g_assert (id == GST_EBML_ID_EBMLREADVERSION);
|
||||
if (num != GST_EBML_VERSION)
|
||||
return FALSE;
|
||||
break;
|
||||
if (!gst_ebml_read_uint (ebml, &id, &num))
|
||||
return FALSE;
|
||||
g_assert (id == GST_EBML_ID_EBMLREADVERSION);
|
||||
if (num != GST_EBML_VERSION)
|
||||
return FALSE;
|
||||
break;
|
||||
}
|
||||
|
||||
/* we only handle 8 byte lengths at max */
|
||||
/* we only handle 8 byte lengths at max */
|
||||
case GST_EBML_ID_EBMLMAXSIZELENGTH:{
|
||||
guint64 num;
|
||||
guint64 num;
|
||||
|
||||
if (!gst_ebml_read_uint (ebml, &id, &num))
|
||||
return FALSE;
|
||||
g_assert (id == GST_EBML_ID_EBMLMAXSIZELENGTH);
|
||||
if (num != sizeof (guint64))
|
||||
return FALSE;
|
||||
break;
|
||||
if (!gst_ebml_read_uint (ebml, &id, &num))
|
||||
return FALSE;
|
||||
g_assert (id == GST_EBML_ID_EBMLMAXSIZELENGTH);
|
||||
if (num != sizeof (guint64))
|
||||
return FALSE;
|
||||
break;
|
||||
}
|
||||
|
||||
/* we handle 4 byte IDs at max */
|
||||
/* we handle 4 byte IDs at max */
|
||||
case GST_EBML_ID_EBMLMAXIDLENGTH:{
|
||||
guint64 num;
|
||||
guint64 num;
|
||||
|
||||
if (!gst_ebml_read_uint (ebml, &id, &num))
|
||||
return FALSE;
|
||||
g_assert (id == GST_EBML_ID_EBMLMAXIDLENGTH);
|
||||
if (num != sizeof (guint32))
|
||||
return FALSE;
|
||||
break;
|
||||
if (!gst_ebml_read_uint (ebml, &id, &num))
|
||||
return FALSE;
|
||||
g_assert (id == GST_EBML_ID_EBMLMAXIDLENGTH);
|
||||
if (num != sizeof (guint32))
|
||||
return FALSE;
|
||||
break;
|
||||
}
|
||||
|
||||
case GST_EBML_ID_DOCTYPE:{
|
||||
gchar *text;
|
||||
gchar *text;
|
||||
|
||||
if (!gst_ebml_read_ascii (ebml, &id, &text))
|
||||
return FALSE;
|
||||
g_assert (id == GST_EBML_ID_DOCTYPE);
|
||||
if (doctype) {
|
||||
if (doctype)
|
||||
g_free (*doctype);
|
||||
*doctype = text;
|
||||
} else
|
||||
g_free (text);
|
||||
break;
|
||||
if (!gst_ebml_read_ascii (ebml, &id, &text))
|
||||
return FALSE;
|
||||
g_assert (id == GST_EBML_ID_DOCTYPE);
|
||||
if (doctype) {
|
||||
if (doctype)
|
||||
g_free (*doctype);
|
||||
*doctype = text;
|
||||
} else
|
||||
g_free (text);
|
||||
break;
|
||||
}
|
||||
|
||||
case GST_EBML_ID_DOCTYPEREADVERSION:{
|
||||
guint64 num;
|
||||
guint64 num;
|
||||
|
||||
if (!gst_ebml_read_uint (ebml, &id, &num))
|
||||
return FALSE;
|
||||
g_assert (id == GST_EBML_ID_DOCTYPEREADVERSION);
|
||||
if (version)
|
||||
*version = num;
|
||||
break;
|
||||
if (!gst_ebml_read_uint (ebml, &id, &num))
|
||||
return FALSE;
|
||||
g_assert (id == GST_EBML_ID_DOCTYPEREADVERSION);
|
||||
if (version)
|
||||
*version = num;
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
GST_WARNING ("Unknown data type 0x%x in EBML header (ignored)", id);
|
||||
/* pass-through */
|
||||
GST_WARNING ("Unknown data type 0x%x in EBML header (ignored)", id);
|
||||
/* pass-through */
|
||||
|
||||
/* we ignore these two, as they don't tell us anything we care about */
|
||||
/* we ignore these two, as they don't tell us anything we care about */
|
||||
case GST_EBML_ID_VOID:
|
||||
case GST_EBML_ID_EBMLVERSION:
|
||||
case GST_EBML_ID_DOCTYPEVERSION:
|
||||
if (!gst_ebml_read_skip (ebml))
|
||||
return FALSE;
|
||||
break;
|
||||
if (!gst_ebml_read_skip (ebml))
|
||||
return FALSE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -59,8 +59,8 @@ gst_ebml_write_get_type (void)
|
|||
};
|
||||
|
||||
gst_ebml_write_type =
|
||||
g_type_register_static (GST_TYPE_ELEMENT, "GstEbmlWrite",
|
||||
&gst_ebml_write_info, 0);
|
||||
g_type_register_static (GST_TYPE_ELEMENT, "GstEbmlWrite",
|
||||
&gst_ebml_write_info, 0);
|
||||
}
|
||||
|
||||
return gst_ebml_write_type;
|
||||
|
@ -292,13 +292,13 @@ gst_ebml_write_seek (GstEbmlWrite * ebml, guint64 pos)
|
|||
if (ebml->cache) {
|
||||
/* within bounds? */
|
||||
if (pos >= GST_BUFFER_OFFSET (ebml->cache) &&
|
||||
pos <
|
||||
GST_BUFFER_OFFSET (ebml->cache) + GST_BUFFER_MAXSIZE (ebml->cache)) {
|
||||
pos <
|
||||
GST_BUFFER_OFFSET (ebml->cache) + GST_BUFFER_MAXSIZE (ebml->cache)) {
|
||||
GST_BUFFER_SIZE (ebml->cache) = pos - GST_BUFFER_OFFSET (ebml->cache);
|
||||
if (ebml->pos > pos)
|
||||
ebml->handled -= ebml->pos - pos;
|
||||
ebml->handled -= ebml->pos - pos;
|
||||
else
|
||||
ebml->handled += pos - ebml->pos;
|
||||
ebml->handled += pos - ebml->pos;
|
||||
ebml->pos = pos;
|
||||
} else {
|
||||
GST_LOG ("Seek outside cache range. Clearing...");
|
||||
|
@ -414,7 +414,7 @@ gst_ebml_write_float (GstEbmlWrite * ebml, guint32 id, gdouble num)
|
|||
void
|
||||
gst_ebml_write_ascii (GstEbmlWrite * ebml, guint32 id, const gchar * str)
|
||||
{
|
||||
gint len = strlen (str) + 1; /* add trailing '\0' */
|
||||
gint len = strlen (str) + 1; /* add trailing '\0' */
|
||||
GstBuffer *buf = gst_ebml_write_element_new (ebml, len);
|
||||
|
||||
gst_ebml_write_element_id (buf, id);
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -58,19 +58,19 @@ static GstStaticPadTemplate videosink_templ =
|
|||
GST_PAD_SINK,
|
||||
GST_PAD_REQUEST,
|
||||
GST_STATIC_CAPS ("video/mpeg, "
|
||||
"mpegversion = (int) { 1, 2, 4 }, "
|
||||
"systemstream = (boolean) false, "
|
||||
COMMON_VIDEO_CAPS "; "
|
||||
"video/x-divx, "
|
||||
COMMON_VIDEO_CAPS "; "
|
||||
"video/x-xvid, "
|
||||
COMMON_VIDEO_CAPS "; "
|
||||
"video/x-msmpeg, "
|
||||
COMMON_VIDEO_CAPS "; "
|
||||
"video/x-jpeg, "
|
||||
COMMON_VIDEO_CAPS "; "
|
||||
"video/x-raw-yuv, "
|
||||
"format = (fourcc) { YUY2, I420 }, " COMMON_VIDEO_CAPS)
|
||||
"mpegversion = (int) { 1, 2, 4 }, "
|
||||
"systemstream = (boolean) false, "
|
||||
COMMON_VIDEO_CAPS "; "
|
||||
"video/x-divx, "
|
||||
COMMON_VIDEO_CAPS "; "
|
||||
"video/x-xvid, "
|
||||
COMMON_VIDEO_CAPS "; "
|
||||
"video/x-msmpeg, "
|
||||
COMMON_VIDEO_CAPS "; "
|
||||
"video/x-jpeg, "
|
||||
COMMON_VIDEO_CAPS "; "
|
||||
"video/x-raw-yuv, "
|
||||
"format = (fourcc) { YUY2, I420 }, " COMMON_VIDEO_CAPS)
|
||||
);
|
||||
|
||||
#define COMMON_AUDIO_CAPS \
|
||||
|
@ -86,19 +86,19 @@ static GstStaticPadTemplate audiosink_templ =
|
|||
GST_PAD_SINK,
|
||||
GST_PAD_REQUEST,
|
||||
GST_STATIC_CAPS ("audio/mpeg, "
|
||||
"mpegversion = (int) 1, "
|
||||
"layer = (int) [ 1, 3 ], "
|
||||
COMMON_AUDIO_CAPS "; "
|
||||
"audio/mpeg, "
|
||||
"mpegversion = (int) { 2, 4 }, "
|
||||
COMMON_AUDIO_CAPS "; "
|
||||
"audio/x-ac3, "
|
||||
COMMON_AUDIO_CAPS "; "
|
||||
"audio/x-raw-int, "
|
||||
"width = (int) { 8, 16, 24 }, "
|
||||
"depth = (int) { 8, 16, 24 }, "
|
||||
"endianness = (int) { BIG_ENDIAN, LITTLE_ENDIAN }, "
|
||||
"signed = (boolean) { true, false }, " COMMON_AUDIO_CAPS)
|
||||
"mpegversion = (int) 1, "
|
||||
"layer = (int) [ 1, 3 ], "
|
||||
COMMON_AUDIO_CAPS "; "
|
||||
"audio/mpeg, "
|
||||
"mpegversion = (int) { 2, 4 }, "
|
||||
COMMON_AUDIO_CAPS "; "
|
||||
"audio/x-ac3, "
|
||||
COMMON_AUDIO_CAPS "; "
|
||||
"audio/x-raw-int, "
|
||||
"width = (int) { 8, 16, 24 }, "
|
||||
"depth = (int) { 8, 16, 24 }, "
|
||||
"endianness = (int) { BIG_ENDIAN, LITTLE_ENDIAN }, "
|
||||
"signed = (boolean) { true, false }, " COMMON_AUDIO_CAPS)
|
||||
);
|
||||
|
||||
static GstStaticPadTemplate subtitlesink_templ =
|
||||
|
@ -155,8 +155,8 @@ gst_matroska_mux_get_type (void)
|
|||
};
|
||||
|
||||
gst_matroska_mux_type =
|
||||
g_type_register_static (GST_TYPE_EBML_WRITE,
|
||||
"GstMatroskaMmux", &gst_matroska_mux_info, 0);
|
||||
g_type_register_static (GST_TYPE_EBML_WRITE,
|
||||
"GstMatroskaMmux", &gst_matroska_mux_info, 0);
|
||||
}
|
||||
|
||||
return gst_matroska_mux_type;
|
||||
|
@ -195,7 +195,7 @@ gst_matroska_mux_class_init (GstMatroskaMuxClass * klass)
|
|||
|
||||
g_object_class_install_property (gobject_class, ARG_METADATA,
|
||||
g_param_spec_boxed ("metadata", "Metadata", "Metadata",
|
||||
GST_TYPE_CAPS, G_PARAM_READWRITE));
|
||||
GST_TYPE_CAPS, G_PARAM_READWRITE));
|
||||
|
||||
parent_class = g_type_class_ref (GST_TYPE_EBML_WRITE);
|
||||
|
||||
|
@ -214,7 +214,7 @@ gst_matroska_mux_init (GstMatroskaMux * mux)
|
|||
|
||||
mux->srcpad =
|
||||
gst_pad_new_from_template (gst_element_class_get_pad_template (klass,
|
||||
"src"), "src");
|
||||
"src"), "src");
|
||||
gst_element_add_pad (GST_ELEMENT (mux), mux->srcpad);
|
||||
GST_EBML_WRITE (mux)->srcpad = mux->srcpad;
|
||||
|
||||
|
@ -244,7 +244,7 @@ gst_matroska_mux_reset (GstElement * element)
|
|||
for (i = 0; i < GST_MATROSKA_MUX_MAX_STREAMS; i++) {
|
||||
if (mux->sink[i].track != NULL) {
|
||||
if (mux->sink[i].track->pad != NULL) {
|
||||
gst_element_remove_pad (GST_ELEMENT (mux), mux->sink[i].track->pad);
|
||||
gst_element_remove_pad (GST_ELEMENT (mux), mux->sink[i].track->pad);
|
||||
}
|
||||
g_free (mux->sink[i].track->codec_id);
|
||||
g_free (mux->sink[i].track->codec_name);
|
||||
|
@ -268,7 +268,7 @@ gst_matroska_mux_reset (GstElement * element)
|
|||
/* reset media info (to default) */
|
||||
gst_caps_replace (&mux->metadata,
|
||||
gst_caps_new_simple ("application/x-gst-metadata",
|
||||
"application", G_TYPE_STRING, "", "date", G_TYPE_STRING, "", NULL));
|
||||
"application", G_TYPE_STRING, "", "date", G_TYPE_STRING, "", NULL));
|
||||
|
||||
/* reset indexes */
|
||||
mux->num_indexes = 0;
|
||||
|
@ -295,7 +295,7 @@ gst_matroska_mux_video_pad_link (GstPad * pad, const GstCaps * caps)
|
|||
/* find context */
|
||||
for (i = 0; i < mux->num_streams; i++) {
|
||||
if (mux->sink[i].track && mux->sink[i].track->pad &&
|
||||
mux->sink[i].track->pad == pad) {
|
||||
mux->sink[i].track->pad == pad) {
|
||||
context = mux->sink[i].track;
|
||||
break;
|
||||
}
|
||||
|
@ -356,14 +356,14 @@ gst_matroska_mux_video_pad_link (GstPad * pad, const GstCaps * caps)
|
|||
gst_structure_get_int (structure, "divxversion", &divxversion);
|
||||
switch (divxversion) {
|
||||
case 3:
|
||||
context->codec_id = g_strdup (GST_MATROSKA_CODEC_ID_VIDEO_MSMPEG4V3);
|
||||
break;
|
||||
context->codec_id = g_strdup (GST_MATROSKA_CODEC_ID_VIDEO_MSMPEG4V3);
|
||||
break;
|
||||
case 4:
|
||||
context->codec_id = g_strdup (GST_MATROSKA_CODEC_ID_VIDEO_MPEG4_SP);
|
||||
break;
|
||||
context->codec_id = g_strdup (GST_MATROSKA_CODEC_ID_VIDEO_MPEG4_SP);
|
||||
break;
|
||||
case 5:
|
||||
context->codec_id = g_strdup (GST_MATROSKA_CODEC_ID_VIDEO_MPEG4_ASP);
|
||||
break;
|
||||
context->codec_id = g_strdup (GST_MATROSKA_CODEC_ID_VIDEO_MPEG4_ASP);
|
||||
break;
|
||||
}
|
||||
|
||||
return GST_PAD_LINK_OK;
|
||||
|
@ -377,14 +377,14 @@ gst_matroska_mux_video_pad_link (GstPad * pad, const GstCaps * caps)
|
|||
gst_structure_get_int (structure, "mpegversion", &mpegversion);
|
||||
switch (mpegversion) {
|
||||
case 1:
|
||||
context->codec_id = g_strdup (GST_MATROSKA_CODEC_ID_VIDEO_MPEG1);
|
||||
break;
|
||||
context->codec_id = g_strdup (GST_MATROSKA_CODEC_ID_VIDEO_MPEG1);
|
||||
break;
|
||||
case 2:
|
||||
context->codec_id = g_strdup (GST_MATROSKA_CODEC_ID_VIDEO_MPEG2);
|
||||
break;
|
||||
context->codec_id = g_strdup (GST_MATROSKA_CODEC_ID_VIDEO_MPEG2);
|
||||
break;
|
||||
case 3:
|
||||
context->codec_id = g_strdup (GST_MATROSKA_CODEC_ID_VIDEO_MPEG4_ASP);
|
||||
break;
|
||||
context->codec_id = g_strdup (GST_MATROSKA_CODEC_ID_VIDEO_MPEG4_ASP);
|
||||
break;
|
||||
}
|
||||
|
||||
return GST_PAD_LINK_OK;
|
||||
|
@ -410,7 +410,7 @@ gst_matroska_mux_audio_pad_link (GstPad * pad, const GstCaps * caps)
|
|||
/* find context */
|
||||
for (i = 0; i < mux->num_streams; i++) {
|
||||
if (mux->sink[i].track && mux->sink[i].track->pad &&
|
||||
mux->sink[i].track->pad == pad) {
|
||||
mux->sink[i].track->pad == pad) {
|
||||
context = mux->sink[i].track;
|
||||
break;
|
||||
}
|
||||
|
@ -436,28 +436,28 @@ gst_matroska_mux_audio_pad_link (GstPad * pad, const GstCaps * caps)
|
|||
gst_structure_get_int (structure, "mpegversion", &mpegversion);
|
||||
switch (mpegversion) {
|
||||
case 1:{
|
||||
gint layer;
|
||||
gint layer;
|
||||
|
||||
gst_structure_get_int (structure, "layer", &layer);
|
||||
switch (layer) {
|
||||
case 1:
|
||||
context->codec_id = g_strdup (GST_MATROSKA_CODEC_ID_AUDIO_MPEG1_L1);
|
||||
break;
|
||||
case 2:
|
||||
context->codec_id = g_strdup (GST_MATROSKA_CODEC_ID_AUDIO_MPEG1_L2);
|
||||
break;
|
||||
case 3:
|
||||
context->codec_id = g_strdup (GST_MATROSKA_CODEC_ID_AUDIO_MPEG1_L3);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
gst_structure_get_int (structure, "layer", &layer);
|
||||
switch (layer) {
|
||||
case 1:
|
||||
context->codec_id = g_strdup (GST_MATROSKA_CODEC_ID_AUDIO_MPEG1_L1);
|
||||
break;
|
||||
case 2:
|
||||
context->codec_id = g_strdup (GST_MATROSKA_CODEC_ID_AUDIO_MPEG1_L2);
|
||||
break;
|
||||
case 3:
|
||||
context->codec_id = g_strdup (GST_MATROSKA_CODEC_ID_AUDIO_MPEG1_L3);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 2:
|
||||
context->codec_id = g_strdup (GST_MATROSKA_CODEC_ID_AUDIO_MPEG2 "MAIN");
|
||||
break;
|
||||
context->codec_id = g_strdup (GST_MATROSKA_CODEC_ID_AUDIO_MPEG2 "MAIN");
|
||||
break;
|
||||
case 4:
|
||||
context->codec_id = g_strdup (GST_MATROSKA_CODEC_ID_AUDIO_MPEG4 "MAIN");
|
||||
break;
|
||||
context->codec_id = g_strdup (GST_MATROSKA_CODEC_ID_AUDIO_MPEG4 "MAIN");
|
||||
break;
|
||||
}
|
||||
|
||||
return GST_PAD_LINK_OK;
|
||||
|
@ -470,7 +470,7 @@ gst_matroska_mux_audio_pad_link (GstPad * pad, const GstCaps * caps)
|
|||
gst_structure_get_int (structure, "depth", &depth);
|
||||
gst_structure_get_int (structure, "signed", &signedness);
|
||||
if (width != depth ||
|
||||
(width == 8 && signedness) || (width == 16 && !signedness))
|
||||
(width == 8 && signedness) || (width == 16 && !signedness))
|
||||
return GST_PAD_LINK_REFUSED;
|
||||
|
||||
audiocontext->bitdepth = depth;
|
||||
|
@ -518,21 +518,21 @@ gst_matroska_mux_request_new_pad (GstElement * element,
|
|||
name = g_strdup_printf ("audio_%d", mux->num_a_streams++);
|
||||
linkfunc = gst_matroska_mux_audio_pad_link;
|
||||
context = (GstMatroskaTrackContext *)
|
||||
g_new0 (GstMatroskaTrackAudioContext, 1);
|
||||
g_new0 (GstMatroskaTrackAudioContext, 1);
|
||||
context->type = GST_MATROSKA_TRACK_TYPE_AUDIO;
|
||||
context->name = g_strdup ("Audio");
|
||||
} else if (templ == gst_element_class_get_pad_template (klass, "video_%d")) {
|
||||
name = g_strdup_printf ("video_%d", mux->num_v_streams++);
|
||||
linkfunc = gst_matroska_mux_video_pad_link;
|
||||
context = (GstMatroskaTrackContext *)
|
||||
g_new0 (GstMatroskaTrackVideoContext, 1);
|
||||
g_new0 (GstMatroskaTrackVideoContext, 1);
|
||||
context->type = GST_MATROSKA_TRACK_TYPE_VIDEO;
|
||||
context->name = g_strdup ("Video");
|
||||
} else if (templ == gst_element_class_get_pad_template (klass, "subtitle_%d")) {
|
||||
name = g_strdup_printf ("subtitle_%d", mux->num_t_streams++);
|
||||
linkfunc = gst_matroska_mux_subtitle_pad_link;
|
||||
context = (GstMatroskaTrackContext *)
|
||||
g_new0 (GstMatroskaTrackSubtitleContext, 1);
|
||||
g_new0 (GstMatroskaTrackSubtitleContext, 1);
|
||||
context->type = GST_MATROSKA_TRACK_TYPE_SUBTITLE;
|
||||
context->name = g_strdup ("Subtitle");
|
||||
} else {
|
||||
|
@ -567,30 +567,30 @@ gst_matroska_mux_track_header (GstMatroskaMux * mux,
|
|||
switch (context->type) {
|
||||
case GST_MATROSKA_TRACK_TYPE_VIDEO:{
|
||||
GstMatroskaTrackVideoContext *videocontext =
|
||||
(GstMatroskaTrackVideoContext *) context;
|
||||
(GstMatroskaTrackVideoContext *) context;
|
||||
|
||||
/* framerate, but not in the video part */
|
||||
gst_ebml_write_uint (ebml, GST_MATROSKA_ID_TRACKDEFAULTDURATION,
|
||||
context->default_duration);
|
||||
context->default_duration);
|
||||
|
||||
master = gst_ebml_write_master_start (ebml, GST_MATROSKA_ID_TRACKVIDEO);
|
||||
gst_ebml_write_uint (ebml, GST_MATROSKA_ID_VIDEOPIXELWIDTH,
|
||||
videocontext->pixel_width);
|
||||
videocontext->pixel_width);
|
||||
gst_ebml_write_uint (ebml, GST_MATROSKA_ID_VIDEOPIXELHEIGHT,
|
||||
videocontext->pixel_height);
|
||||
videocontext->pixel_height);
|
||||
if (videocontext->display_width && videocontext->display_height) {
|
||||
gst_ebml_write_uint (ebml, GST_MATROSKA_ID_VIDEODISPLAYWIDTH,
|
||||
videocontext->display_width);
|
||||
gst_ebml_write_uint (ebml, GST_MATROSKA_ID_VIDEODISPLAYHEIGHT,
|
||||
videocontext->display_height);
|
||||
gst_ebml_write_uint (ebml, GST_MATROSKA_ID_VIDEODISPLAYWIDTH,
|
||||
videocontext->display_width);
|
||||
gst_ebml_write_uint (ebml, GST_MATROSKA_ID_VIDEODISPLAYHEIGHT,
|
||||
videocontext->display_height);
|
||||
}
|
||||
if (context->flags & GST_MATROSKA_VIDEOTRACK_INTERLACED)
|
||||
gst_ebml_write_uint (ebml, GST_MATROSKA_ID_VIDEOFLAGINTERLACED, 1);
|
||||
gst_ebml_write_uint (ebml, GST_MATROSKA_ID_VIDEOFLAGINTERLACED, 1);
|
||||
if (videocontext->fourcc) {
|
||||
guint32 fcc_le = GUINT32_TO_LE (videocontext->fourcc);
|
||||
guint32 fcc_le = GUINT32_TO_LE (videocontext->fourcc);
|
||||
|
||||
gst_ebml_write_binary (ebml, GST_MATROSKA_ID_VIDEOCOLOURSPACE,
|
||||
(gpointer) & fcc_le, 4);
|
||||
gst_ebml_write_binary (ebml, GST_MATROSKA_ID_VIDEOCOLOURSPACE,
|
||||
(gpointer) & fcc_le, 4);
|
||||
}
|
||||
gst_ebml_write_master_finish (ebml, master);
|
||||
|
||||
|
@ -599,18 +599,18 @@ gst_matroska_mux_track_header (GstMatroskaMux * mux,
|
|||
|
||||
case GST_MATROSKA_TRACK_TYPE_AUDIO:{
|
||||
GstMatroskaTrackAudioContext *audiocontext =
|
||||
(GstMatroskaTrackAudioContext *) context;
|
||||
(GstMatroskaTrackAudioContext *) context;
|
||||
|
||||
master = gst_ebml_write_master_start (ebml, GST_MATROSKA_ID_TRACKAUDIO);
|
||||
if (audiocontext->samplerate != 8000)
|
||||
gst_ebml_write_float (ebml, GST_MATROSKA_ID_AUDIOSAMPLINGFREQ,
|
||||
audiocontext->samplerate);
|
||||
gst_ebml_write_float (ebml, GST_MATROSKA_ID_AUDIOSAMPLINGFREQ,
|
||||
audiocontext->samplerate);
|
||||
if (audiocontext->channels != 1)
|
||||
gst_ebml_write_uint (ebml, GST_MATROSKA_ID_AUDIOCHANNELS,
|
||||
audiocontext->channels);
|
||||
gst_ebml_write_uint (ebml, GST_MATROSKA_ID_AUDIOCHANNELS,
|
||||
audiocontext->channels);
|
||||
if (audiocontext->bitdepth) {
|
||||
gst_ebml_write_uint (ebml, GST_MATROSKA_ID_AUDIOBITDEPTH,
|
||||
audiocontext->bitdepth);
|
||||
gst_ebml_write_uint (ebml, GST_MATROSKA_ID_AUDIOBITDEPTH,
|
||||
audiocontext->bitdepth);
|
||||
}
|
||||
gst_ebml_write_master_finish (ebml, master);
|
||||
|
||||
|
@ -625,7 +625,7 @@ gst_matroska_mux_track_header (GstMatroskaMux * mux,
|
|||
gst_ebml_write_ascii (ebml, GST_MATROSKA_ID_CODECID, context->codec_id);
|
||||
if (context->codec_priv)
|
||||
gst_ebml_write_binary (ebml, GST_MATROSKA_ID_CODECPRIVATE,
|
||||
context->codec_priv, context->codec_priv_size);
|
||||
context->codec_priv, context->codec_priv_size);
|
||||
/* FIXME: until we have a nice way of getting the codecname
|
||||
* out of the caps, I'm not going to enable this. Too much
|
||||
* (useless, double, boring) work... */
|
||||
|
@ -681,11 +681,11 @@ gst_matroska_mux_start (GstMatroskaMux * mux)
|
|||
gst_ebml_write_utf8 (ebml, GST_MATROSKA_ID_MUXINGAPP, "GStreamer");
|
||||
if (mux->metadata &&
|
||||
gst_structure_has_field (gst_caps_get_structure (mux->metadata, 0),
|
||||
"application")) {
|
||||
"application")) {
|
||||
const gchar *app;
|
||||
|
||||
app = gst_structure_get_string (gst_caps_get_structure (mux->metadata, 0),
|
||||
"application");
|
||||
"application");
|
||||
if (app && app[0]) {
|
||||
gst_ebml_write_utf8 (ebml, GST_MATROSKA_ID_WRITINGAPP, app);
|
||||
}
|
||||
|
@ -730,14 +730,14 @@ gst_matroska_mux_finish (GstMatroskaMux * mux)
|
|||
GstMatroskaIndex *idx = &mux->index[n];
|
||||
|
||||
pointentry_master = gst_ebml_write_master_start (ebml,
|
||||
GST_MATROSKA_ID_POINTENTRY);
|
||||
GST_MATROSKA_ID_POINTENTRY);
|
||||
gst_ebml_write_date (ebml, GST_MATROSKA_ID_CUETIME,
|
||||
idx->time / mux->time_scale);
|
||||
idx->time / mux->time_scale);
|
||||
trackpos_master = gst_ebml_write_master_start (ebml,
|
||||
GST_MATROSKA_ID_CUETRACKPOSITION);
|
||||
GST_MATROSKA_ID_CUETRACKPOSITION);
|
||||
gst_ebml_write_uint (ebml, GST_MATROSKA_ID_CUETRACK, idx->track);
|
||||
gst_ebml_write_uint (ebml, GST_MATROSKA_ID_CUECLUSTERPOSITION,
|
||||
idx->pos - mux->segment_master);
|
||||
idx->pos - mux->segment_master);
|
||||
gst_ebml_write_master_finish (ebml, trackpos_master);
|
||||
gst_ebml_write_master_finish (ebml, pointentry_master);
|
||||
}
|
||||
|
@ -764,7 +764,7 @@ gst_matroska_mux_finish (GstMatroskaMux * mux)
|
|||
mux->tracks_pos - mux->segment_master);
|
||||
if (mux->index != NULL) {
|
||||
gst_ebml_replace_uint (ebml, mux->seekhead_pos + 88,
|
||||
mux->cues_pos - mux->segment_master);
|
||||
mux->cues_pos - mux->segment_master);
|
||||
} else {
|
||||
/* void'ify */
|
||||
guint64 my_pos = ebml->pos;
|
||||
|
@ -796,24 +796,24 @@ gst_matroska_mux_prepare_data (GstMatroskaMux * mux)
|
|||
|
||||
for (i = 0; i < mux->num_streams; i++) {
|
||||
while (!mux->sink[i].eos && !mux->sink[i].buffer &&
|
||||
mux->sink[i].track->num > 0 &&
|
||||
GST_PAD_IS_USABLE (mux->sink[i].track->pad)) {
|
||||
mux->sink[i].track->num > 0 &&
|
||||
GST_PAD_IS_USABLE (mux->sink[i].track->pad)) {
|
||||
GstData *data;
|
||||
|
||||
data = gst_pad_pull (mux->sink[i].track->pad);
|
||||
if (GST_IS_EVENT (data)) {
|
||||
if (GST_EVENT_TYPE (GST_EVENT (data)) == GST_EVENT_EOS)
|
||||
mux->sink[i].eos = TRUE;
|
||||
gst_event_unref (GST_EVENT (data));
|
||||
if (GST_EVENT_TYPE (GST_EVENT (data)) == GST_EVENT_EOS)
|
||||
mux->sink[i].eos = TRUE;
|
||||
gst_event_unref (GST_EVENT (data));
|
||||
} else {
|
||||
mux->sink[i].buffer = GST_BUFFER (data);
|
||||
mux->sink[i].buffer = GST_BUFFER (data);
|
||||
}
|
||||
}
|
||||
|
||||
if (mux->sink[i].buffer) {
|
||||
if (first < 0 || GST_BUFFER_TIMESTAMP (mux->sink[i].buffer) <
|
||||
GST_BUFFER_TIMESTAMP (mux->sink[first].buffer))
|
||||
first = i;
|
||||
GST_BUFFER_TIMESTAMP (mux->sink[first].buffer))
|
||||
first = i;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -854,7 +854,7 @@ gst_matroska_mux_write_data (GstMatroskaMux * mux)
|
|||
|
||||
if (mux->num_indexes % 32 == 0) {
|
||||
mux->index = g_renew (GstMatroskaIndex, mux->index,
|
||||
mux->num_indexes + 32);
|
||||
mux->num_indexes + 32);
|
||||
}
|
||||
idx = &mux->index[mux->num_indexes++];
|
||||
|
||||
|
|
|
@ -98,8 +98,9 @@ gst_median_get_type (void)
|
|||
0,
|
||||
(GInstanceInitFunc) gst_median_init,
|
||||
};
|
||||
|
||||
median_type =
|
||||
g_type_register_static (GST_TYPE_ELEMENT, "GstMedian", &median_info, 0);
|
||||
g_type_register_static (GST_TYPE_ELEMENT, "GstMedian", &median_info, 0);
|
||||
}
|
||||
return median_type;
|
||||
}
|
||||
|
@ -127,9 +128,9 @@ gst_median_class_init (GstMedianClass * klass)
|
|||
|
||||
parent_class = g_type_class_ref (GST_TYPE_ELEMENT);
|
||||
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_ACTIVE, g_param_spec_boolean ("active", "active", "active", TRUE, G_PARAM_READWRITE)); /* CHECKME */
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_FILTERSIZE, g_param_spec_int ("filtersize", "filtersize", "filtersize", G_MININT, G_MAXINT, 0, G_PARAM_READWRITE)); /* CHECKME */
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_LUM_ONLY, g_param_spec_boolean ("lum_only", "lum_only", "lum_only", TRUE, G_PARAM_READWRITE)); /* CHECKME */
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_ACTIVE, g_param_spec_boolean ("active", "active", "active", TRUE, G_PARAM_READWRITE)); /* CHECKME */
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_FILTERSIZE, g_param_spec_int ("filtersize", "filtersize", "filtersize", G_MININT, G_MAXINT, 0, G_PARAM_READWRITE)); /* CHECKME */
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_LUM_ONLY, g_param_spec_boolean ("lum_only", "lum_only", "lum_only", TRUE, G_PARAM_READWRITE)); /* CHECKME */
|
||||
|
||||
gobject_class->set_property = gst_median_set_property;
|
||||
gobject_class->get_property = gst_median_get_property;
|
||||
|
@ -333,25 +334,25 @@ gst_median_chain (GstPad * pad, GstData * _data)
|
|||
median_5 (data, GST_BUFFER_DATA (outbuf), median->width, median->height);
|
||||
if (!median->lum_only) {
|
||||
median_5 (data + lumsize, GST_BUFFER_DATA (outbuf) + lumsize,
|
||||
median->width / 2, median->height / 2);
|
||||
median->width / 2, median->height / 2);
|
||||
median_5 (data + lumsize + chromsize,
|
||||
GST_BUFFER_DATA (outbuf) + lumsize + chromsize, median->width / 2,
|
||||
median->height / 2);
|
||||
GST_BUFFER_DATA (outbuf) + lumsize + chromsize, median->width / 2,
|
||||
median->height / 2);
|
||||
} else {
|
||||
memcpy (GST_BUFFER_DATA (outbuf) + lumsize, data + lumsize,
|
||||
chromsize * 2);
|
||||
chromsize * 2);
|
||||
}
|
||||
} else {
|
||||
median_9 (data, GST_BUFFER_DATA (outbuf), median->width, median->height);
|
||||
if (!median->lum_only) {
|
||||
median_9 (data + lumsize, GST_BUFFER_DATA (outbuf) + lumsize,
|
||||
median->width / 2, median->height / 2);
|
||||
median->width / 2, median->height / 2);
|
||||
median_9 (data + lumsize + chromsize,
|
||||
GST_BUFFER_DATA (outbuf) + lumsize + chromsize, median->width / 2,
|
||||
median->height / 2);
|
||||
GST_BUFFER_DATA (outbuf) + lumsize + chromsize, median->width / 2,
|
||||
median->height / 2);
|
||||
} else {
|
||||
memcpy (GST_BUFFER_DATA (outbuf) + lumsize, data + lumsize,
|
||||
chromsize * 2);
|
||||
chromsize * 2);
|
||||
}
|
||||
}
|
||||
GST_BUFFER_TIMESTAMP (outbuf) = GST_BUFFER_TIMESTAMP (buf);
|
||||
|
@ -376,10 +377,10 @@ gst_median_set_property (GObject * object, guint prop_id, const GValue * value,
|
|||
case ARG_FILTERSIZE:
|
||||
argvalue = g_value_get_int (value);
|
||||
if (argvalue != 5 && argvalue != 9) {
|
||||
g_warning ("median: invalid filtersize (%d), must be 5 or 9\n",
|
||||
argvalue);
|
||||
g_warning ("median: invalid filtersize (%d), must be 5 or 9\n",
|
||||
argvalue);
|
||||
} else {
|
||||
median->filtersize = argvalue;
|
||||
median->filtersize = argvalue;
|
||||
}
|
||||
break;
|
||||
case ARG_ACTIVE:
|
||||
|
|
|
@ -68,13 +68,16 @@ typedef union stack_entry_s
|
|||
{
|
||||
const double *left, *right;
|
||||
double *out;
|
||||
} v;
|
||||
}
|
||||
v;
|
||||
struct
|
||||
{
|
||||
double *main, *null;
|
||||
} b;
|
||||
}
|
||||
b;
|
||||
|
||||
} stack_entry;
|
||||
}
|
||||
stack_entry;
|
||||
|
||||
#define STACK_SIZE (CONVOLVE_DEPTH * 3)
|
||||
|
||||
|
@ -175,11 +178,11 @@ convolve_run (stack_entry * top, unsigned size, double *scratch)
|
|||
|
||||
/* Create the intermediate factors. */
|
||||
for (i = 0; i < size; i++) {
|
||||
double l = left[i] + left[i + size];
|
||||
double r = right[i] + right[i + size];
|
||||
double l = left[i] + left[i + size];
|
||||
double r = right[i] + right[i + size];
|
||||
|
||||
s_left[i + size] = r;
|
||||
s_left[i] = l;
|
||||
s_left[i + size] = r;
|
||||
s_left[i] = l;
|
||||
}
|
||||
|
||||
/* Push the combine entry onto the stack. */
|
||||
|
@ -227,15 +230,15 @@ convolve_run (stack_entry * top, unsigned size, double *scratch)
|
|||
top++;
|
||||
out[size * 2 - 1] = 0;
|
||||
for (i = 0; i < size - 1; i++) {
|
||||
double lo;
|
||||
double hi;
|
||||
double lo;
|
||||
double hi;
|
||||
|
||||
lo = mid[0] - (out[0] + out[2 * size]) + out[size];
|
||||
hi = mid[size] - (out[size] + out[3 * size]) + out[2 * size];
|
||||
out[size] = lo;
|
||||
out[2 * size] = hi;
|
||||
out++;
|
||||
mid++;
|
||||
lo = mid[0] - (out[0] + out[2 * size]) + out[size];
|
||||
hi = mid[size] - (out[size] + out[3 * size]) + out[2 * size];
|
||||
out[size] = lo;
|
||||
out[2 * size] = hi;
|
||||
out++;
|
||||
mid++;
|
||||
}
|
||||
size <<= 1;
|
||||
} while (top->b.null == NULL);
|
||||
|
@ -281,7 +284,7 @@ convolve_match (const int *lastchoice,
|
|||
for (i = 0; i < 256; i++)
|
||||
right[i] -= avg;
|
||||
/* End-of-stack marker. */
|
||||
#if 0 /* The following line produces a CRASH, need to figure out why?!! */
|
||||
#if 0 /* The following line produces a CRASH, need to figure out why?!! */
|
||||
top[1].b.null = scratch;
|
||||
#endif
|
||||
top[1].b.main = NULL;
|
||||
|
@ -327,11 +330,11 @@ convolve_match (const int *lastchoice,
|
|||
unsigned int j;
|
||||
|
||||
for (j = 0; j < 256; j++)
|
||||
tot += ((double) input[i + j]) * ((double) lastchoice[j] - avg);
|
||||
tot += ((double) input[i + j]) * ((double) lastchoice[j] - avg);
|
||||
if (tot > best)
|
||||
printf ("(%i)", i);
|
||||
printf ("(%i)", i);
|
||||
if (tot != left[i + 255])
|
||||
printf ("!");
|
||||
printf ("!");
|
||||
}
|
||||
|
||||
printf ("%i\n", p);
|
||||
|
|
|
@ -126,6 +126,7 @@ gst_monoscope_get_type (void)
|
|||
0,
|
||||
(GInstanceInitFunc) gst_monoscope_init,
|
||||
};
|
||||
|
||||
type = g_type_register_static (GST_TYPE_ELEMENT, "GstMonoscope", &info, 0);
|
||||
}
|
||||
return type;
|
||||
|
@ -177,7 +178,7 @@ gst_monoscope_init (GstMonoscope * monoscope)
|
|||
monoscope->first_buffer = TRUE;
|
||||
monoscope->width = 256;
|
||||
monoscope->height = 128;
|
||||
monoscope->fps = 25.; /* desired frame rate */
|
||||
monoscope->fps = 25.; /* desired frame rate */
|
||||
}
|
||||
|
||||
static GstPadLinkReturn
|
||||
|
@ -216,7 +217,7 @@ gst_monoscope_chain (GstPad * pad, GstData * _data)
|
|||
/* FIXME: should really select the first 1024 samples after the timestamp. */
|
||||
if (GST_BUFFER_TIMESTAMP (bufin) < monoscope->next_time || samples_in < 1024) {
|
||||
GST_DEBUG ("timestamp is %" G_GUINT64_FORMAT ": want >= %" G_GUINT64_FORMAT,
|
||||
GST_BUFFER_TIMESTAMP (bufin), monoscope->next_time);
|
||||
GST_BUFFER_TIMESTAMP (bufin), monoscope->next_time);
|
||||
gst_buffer_unref (bufin);
|
||||
return;
|
||||
}
|
||||
|
@ -233,8 +234,8 @@ gst_monoscope_chain (GstPad * pad, GstData * _data)
|
|||
GST_DEBUG ("making new pad");
|
||||
if (!gst_pad_is_negotiated (monoscope->srcpad)) {
|
||||
if (gst_pad_renegotiate (monoscope->srcpad) <= 0) {
|
||||
GST_ELEMENT_ERROR (monoscope, CORE, NEGOTIATION, (NULL), (NULL));
|
||||
return;
|
||||
GST_ELEMENT_ERROR (monoscope, CORE, NEGOTIATION, (NULL), (NULL));
|
||||
return;
|
||||
}
|
||||
}
|
||||
monoscope->first_buffer = FALSE;
|
||||
|
|
|
@ -87,7 +87,7 @@ monoscope_update (struct monoscope_state * stateptr, gint16 data[512])
|
|||
}
|
||||
stateptr->avgMax += max - (stateptr->avgMax >> 8);
|
||||
if (stateptr->avgMax < max)
|
||||
stateptr->avgMax = max; /* Avoid overflow */
|
||||
stateptr->avgMax = max; /* Avoid overflow */
|
||||
factor = 0x7fffffff / stateptr->avgMax;
|
||||
/* Keep the scaling sensible. */
|
||||
if (factor > (1 << 18))
|
||||
|
@ -106,15 +106,15 @@ monoscope_update (struct monoscope_state * stateptr, gint16 data[512])
|
|||
if ((bar > 0) && (bar < (256 * 128))) {
|
||||
loc = stateptr->display + bar;
|
||||
if (foo < 0) {
|
||||
for (h = 0; h <= (-foo); h++) {
|
||||
*loc = stateptr->colors[h];
|
||||
loc += 256;
|
||||
}
|
||||
for (h = 0; h <= (-foo); h++) {
|
||||
*loc = stateptr->colors[h];
|
||||
loc += 256;
|
||||
}
|
||||
} else {
|
||||
for (h = 0; h <= foo; h++) {
|
||||
*loc = stateptr->colors[h];
|
||||
loc -= 256;
|
||||
}
|
||||
for (h = 0; h <= foo; h++) {
|
||||
*loc = stateptr->colors[h];
|
||||
loc -= 256;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -124,7 +124,7 @@ monoscope_update (struct monoscope_state * stateptr, gint16 data[512])
|
|||
for (h = 0; h < 256; h += 2) {
|
||||
stateptr->display[(i << 8) + h] = stateptr->colors[63];
|
||||
if (i == 64)
|
||||
stateptr->display[(i << 8) + h + 1] = stateptr->colors[63];
|
||||
stateptr->display[(i << 8) + h + 1] = stateptr->colors[63];
|
||||
}
|
||||
}
|
||||
for (i = 16; i < 256; i += 16) {
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -46,11 +46,11 @@ GST_STATIC_PAD_TEMPLATE ("src",
|
|||
GST_PAD_SRC,
|
||||
GST_PAD_ALWAYS,
|
||||
GST_STATIC_CAPS ("audio/x-raw-int, "
|
||||
"endianness = (int) BYTE_ORDER, "
|
||||
"signed = (boolean) true, "
|
||||
"width = (int) 16, "
|
||||
"depth = (int) 16, "
|
||||
"rate = (int) [ 1000, 48000 ], " "channels = (int) [ 1, 2 ]")
|
||||
"endianness = (int) BYTE_ORDER, "
|
||||
"signed = (boolean) true, "
|
||||
"width = (int) 16, "
|
||||
"depth = (int) 16, "
|
||||
"rate = (int) [ 1000, 48000 ], " "channels = (int) [ 1, 2 ]")
|
||||
);
|
||||
|
||||
static GstStaticPadTemplate gst_rtpL16parse_sink_template =
|
||||
|
@ -94,8 +94,8 @@ gst_rtpL16parse_get_type (void)
|
|||
};
|
||||
|
||||
rtpL16parse_type =
|
||||
g_type_register_static (GST_TYPE_ELEMENT, "GstRtpL16Parse",
|
||||
&rtpL16parse_info, 0);
|
||||
g_type_register_static (GST_TYPE_ELEMENT, "GstRtpL16Parse",
|
||||
&rtpL16parse_info, 0);
|
||||
}
|
||||
return rtpL16parse_type;
|
||||
}
|
||||
|
@ -125,10 +125,10 @@ gst_rtpL16parse_class_init (GstRtpL16ParseClass * klass)
|
|||
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_PAYLOAD_TYPE,
|
||||
g_param_spec_int ("payload_type", "payload_type", "payload type",
|
||||
G_MININT, G_MAXINT, PAYLOAD_L16_STEREO, G_PARAM_READABLE));
|
||||
G_MININT, G_MAXINT, PAYLOAD_L16_STEREO, G_PARAM_READABLE));
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_FREQUENCY,
|
||||
g_param_spec_int ("frequency", "frequency", "frequency",
|
||||
G_MININT, G_MAXINT, 44100, G_PARAM_READWRITE));
|
||||
G_MININT, G_MAXINT, 44100, G_PARAM_READWRITE));
|
||||
|
||||
gobject_class->set_property = gst_rtpL16parse_set_property;
|
||||
gobject_class->get_property = gst_rtpL16parse_get_property;
|
||||
|
@ -176,7 +176,7 @@ gst_rtpL16_caps_nego (GstRtpL16Parse * rtpL16parse)
|
|||
|
||||
caps =
|
||||
gst_caps_copy (gst_static_caps_get (&gst_rtpL16parse_src_template.
|
||||
static_caps));
|
||||
static_caps));
|
||||
|
||||
gst_caps_set_simple (caps,
|
||||
"rate", G_TYPE_INT, rtpL16parse->frequency,
|
||||
|
|
|
@ -49,11 +49,11 @@ GST_STATIC_PAD_TEMPLATE ("sink",
|
|||
GST_PAD_SINK,
|
||||
GST_PAD_ALWAYS,
|
||||
GST_STATIC_CAPS ("audio/x-raw-int, "
|
||||
"endianness = (int) BYTE_ORDER, "
|
||||
"signed = (boolean) true, "
|
||||
"width = (int) 16, "
|
||||
"depth = (int) 16, "
|
||||
"rate = (int) [ 1000, 48000 ], " "channels = (int) [ 1, 2 ]")
|
||||
"endianness = (int) BYTE_ORDER, "
|
||||
"signed = (boolean) true, "
|
||||
"width = (int) 16, "
|
||||
"depth = (int) 16, "
|
||||
"rate = (int) [ 1000, 48000 ], " "channels = (int) [ 1, 2 ]")
|
||||
);
|
||||
|
||||
static GstStaticPadTemplate gst_rtpL16enc_src_template =
|
||||
|
@ -96,8 +96,8 @@ gst_rtpL16enc_get_type (void)
|
|||
};
|
||||
|
||||
rtpL16enc_type =
|
||||
g_type_register_static (GST_TYPE_ELEMENT, "GstRtpL16Enc",
|
||||
&rtpL16enc_info, 0);
|
||||
g_type_register_static (GST_TYPE_ELEMENT, "GstRtpL16Enc",
|
||||
&rtpL16enc_info, 0);
|
||||
}
|
||||
return rtpL16enc_type;
|
||||
}
|
||||
|
@ -216,13 +216,13 @@ gst_rtpL16enc_chain (GstPad * pad, GstData * _data)
|
|||
|
||||
switch (GST_EVENT_TYPE (event)) {
|
||||
case GST_EVENT_DISCONTINUOUS:
|
||||
GST_DEBUG ("discont");
|
||||
rtpL16enc->next_time = 0;
|
||||
gst_pad_event_default (pad, event);
|
||||
return;
|
||||
GST_DEBUG ("discont");
|
||||
rtpL16enc->next_time = 0;
|
||||
gst_pad_event_default (pad, event);
|
||||
return;
|
||||
default:
|
||||
gst_pad_event_default (pad, event);
|
||||
return;
|
||||
gst_pad_event_default (pad, event);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -46,11 +46,11 @@ GST_STATIC_PAD_TEMPLATE ("src",
|
|||
GST_PAD_SRC,
|
||||
GST_PAD_ALWAYS,
|
||||
GST_STATIC_CAPS ("audio/x-raw-int, "
|
||||
"endianness = (int) BYTE_ORDER, "
|
||||
"signed = (boolean) true, "
|
||||
"width = (int) 16, "
|
||||
"depth = (int) 16, "
|
||||
"rate = (int) [ 1000, 48000 ], " "channels = (int) [ 1, 2 ]")
|
||||
"endianness = (int) BYTE_ORDER, "
|
||||
"signed = (boolean) true, "
|
||||
"width = (int) 16, "
|
||||
"depth = (int) 16, "
|
||||
"rate = (int) [ 1000, 48000 ], " "channels = (int) [ 1, 2 ]")
|
||||
);
|
||||
|
||||
static GstStaticPadTemplate gst_rtpL16parse_sink_template =
|
||||
|
@ -94,8 +94,8 @@ gst_rtpL16parse_get_type (void)
|
|||
};
|
||||
|
||||
rtpL16parse_type =
|
||||
g_type_register_static (GST_TYPE_ELEMENT, "GstRtpL16Parse",
|
||||
&rtpL16parse_info, 0);
|
||||
g_type_register_static (GST_TYPE_ELEMENT, "GstRtpL16Parse",
|
||||
&rtpL16parse_info, 0);
|
||||
}
|
||||
return rtpL16parse_type;
|
||||
}
|
||||
|
@ -125,10 +125,10 @@ gst_rtpL16parse_class_init (GstRtpL16ParseClass * klass)
|
|||
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_PAYLOAD_TYPE,
|
||||
g_param_spec_int ("payload_type", "payload_type", "payload type",
|
||||
G_MININT, G_MAXINT, PAYLOAD_L16_STEREO, G_PARAM_READABLE));
|
||||
G_MININT, G_MAXINT, PAYLOAD_L16_STEREO, G_PARAM_READABLE));
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_FREQUENCY,
|
||||
g_param_spec_int ("frequency", "frequency", "frequency",
|
||||
G_MININT, G_MAXINT, 44100, G_PARAM_READWRITE));
|
||||
G_MININT, G_MAXINT, 44100, G_PARAM_READWRITE));
|
||||
|
||||
gobject_class->set_property = gst_rtpL16parse_set_property;
|
||||
gobject_class->get_property = gst_rtpL16parse_get_property;
|
||||
|
@ -176,7 +176,7 @@ gst_rtpL16_caps_nego (GstRtpL16Parse * rtpL16parse)
|
|||
|
||||
caps =
|
||||
gst_caps_copy (gst_static_caps_get (&gst_rtpL16parse_src_template.
|
||||
static_caps));
|
||||
static_caps));
|
||||
|
||||
gst_caps_set_simple (caps,
|
||||
"rate", G_TYPE_INT, rtpL16parse->frequency,
|
||||
|
|
|
@ -49,11 +49,11 @@ GST_STATIC_PAD_TEMPLATE ("sink",
|
|||
GST_PAD_SINK,
|
||||
GST_PAD_ALWAYS,
|
||||
GST_STATIC_CAPS ("audio/x-raw-int, "
|
||||
"endianness = (int) BYTE_ORDER, "
|
||||
"signed = (boolean) true, "
|
||||
"width = (int) 16, "
|
||||
"depth = (int) 16, "
|
||||
"rate = (int) [ 1000, 48000 ], " "channels = (int) [ 1, 2 ]")
|
||||
"endianness = (int) BYTE_ORDER, "
|
||||
"signed = (boolean) true, "
|
||||
"width = (int) 16, "
|
||||
"depth = (int) 16, "
|
||||
"rate = (int) [ 1000, 48000 ], " "channels = (int) [ 1, 2 ]")
|
||||
);
|
||||
|
||||
static GstStaticPadTemplate gst_rtpL16enc_src_template =
|
||||
|
@ -96,8 +96,8 @@ gst_rtpL16enc_get_type (void)
|
|||
};
|
||||
|
||||
rtpL16enc_type =
|
||||
g_type_register_static (GST_TYPE_ELEMENT, "GstRtpL16Enc",
|
||||
&rtpL16enc_info, 0);
|
||||
g_type_register_static (GST_TYPE_ELEMENT, "GstRtpL16Enc",
|
||||
&rtpL16enc_info, 0);
|
||||
}
|
||||
return rtpL16enc_type;
|
||||
}
|
||||
|
@ -216,13 +216,13 @@ gst_rtpL16enc_chain (GstPad * pad, GstData * _data)
|
|||
|
||||
switch (GST_EVENT_TYPE (event)) {
|
||||
case GST_EVENT_DISCONTINUOUS:
|
||||
GST_DEBUG ("discont");
|
||||
rtpL16enc->next_time = 0;
|
||||
gst_pad_event_default (pad, event);
|
||||
return;
|
||||
GST_DEBUG ("discont");
|
||||
rtpL16enc->next_time = 0;
|
||||
gst_pad_event_default (pad, event);
|
||||
return;
|
||||
default:
|
||||
gst_pad_event_default (pad, event);
|
||||
return;
|
||||
gst_pad_event_default (pad, event);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -90,8 +90,8 @@ gst_rtpgsmparse_get_type (void)
|
|||
};
|
||||
|
||||
rtpgsmparse_type =
|
||||
g_type_register_static (GST_TYPE_ELEMENT, "GstRtpGSMParse",
|
||||
&rtpgsmparse_info, 0);
|
||||
g_type_register_static (GST_TYPE_ELEMENT, "GstRtpGSMParse",
|
||||
&rtpgsmparse_info, 0);
|
||||
}
|
||||
return rtpgsmparse_type;
|
||||
}
|
||||
|
@ -121,7 +121,7 @@ gst_rtpgsmparse_class_init (GstRtpGSMParseClass * klass)
|
|||
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_FREQUENCY,
|
||||
g_param_spec_int ("frequency", "frequency", "frequency",
|
||||
G_MININT, G_MAXINT, 8000, G_PARAM_READWRITE));
|
||||
G_MININT, G_MAXINT, 8000, G_PARAM_READWRITE));
|
||||
|
||||
gobject_class->set_property = gst_rtpgsmparse_set_property;
|
||||
gobject_class->get_property = gst_rtpgsmparse_get_property;
|
||||
|
|
|
@ -93,8 +93,8 @@ gst_rtpgsmenc_get_type (void)
|
|||
};
|
||||
|
||||
rtpgsmenc_type =
|
||||
g_type_register_static (GST_TYPE_ELEMENT, "GstRtpGSMEnc",
|
||||
&rtpgsmenc_info, 0);
|
||||
g_type_register_static (GST_TYPE_ELEMENT, "GstRtpGSMEnc",
|
||||
&rtpgsmenc_info, 0);
|
||||
}
|
||||
return rtpgsmenc_type;
|
||||
}
|
||||
|
@ -209,13 +209,13 @@ gst_rtpgsmenc_chain (GstPad * pad, GstData * _data)
|
|||
|
||||
switch (GST_EVENT_TYPE (event)) {
|
||||
case GST_EVENT_DISCONTINUOUS:
|
||||
GST_DEBUG ("discont");
|
||||
rtpgsmenc->next_time = 0;
|
||||
gst_pad_event_default (pad, event);
|
||||
return;
|
||||
GST_DEBUG ("discont");
|
||||
rtpgsmenc->next_time = 0;
|
||||
gst_pad_event_default (pad, event);
|
||||
return;
|
||||
default:
|
||||
gst_pad_event_default (pad, event);
|
||||
return;
|
||||
gst_pad_event_default (pad, event);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -90,8 +90,8 @@ gst_rtpgsmparse_get_type (void)
|
|||
};
|
||||
|
||||
rtpgsmparse_type =
|
||||
g_type_register_static (GST_TYPE_ELEMENT, "GstRtpGSMParse",
|
||||
&rtpgsmparse_info, 0);
|
||||
g_type_register_static (GST_TYPE_ELEMENT, "GstRtpGSMParse",
|
||||
&rtpgsmparse_info, 0);
|
||||
}
|
||||
return rtpgsmparse_type;
|
||||
}
|
||||
|
@ -121,7 +121,7 @@ gst_rtpgsmparse_class_init (GstRtpGSMParseClass * klass)
|
|||
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_FREQUENCY,
|
||||
g_param_spec_int ("frequency", "frequency", "frequency",
|
||||
G_MININT, G_MAXINT, 8000, G_PARAM_READWRITE));
|
||||
G_MININT, G_MAXINT, 8000, G_PARAM_READWRITE));
|
||||
|
||||
gobject_class->set_property = gst_rtpgsmparse_set_property;
|
||||
gobject_class->get_property = gst_rtpgsmparse_get_property;
|
||||
|
|
|
@ -93,8 +93,8 @@ gst_rtpgsmenc_get_type (void)
|
|||
};
|
||||
|
||||
rtpgsmenc_type =
|
||||
g_type_register_static (GST_TYPE_ELEMENT, "GstRtpGSMEnc",
|
||||
&rtpgsmenc_info, 0);
|
||||
g_type_register_static (GST_TYPE_ELEMENT, "GstRtpGSMEnc",
|
||||
&rtpgsmenc_info, 0);
|
||||
}
|
||||
return rtpgsmenc_type;
|
||||
}
|
||||
|
@ -209,13 +209,13 @@ gst_rtpgsmenc_chain (GstPad * pad, GstData * _data)
|
|||
|
||||
switch (GST_EVENT_TYPE (event)) {
|
||||
case GST_EVENT_DISCONTINUOUS:
|
||||
GST_DEBUG ("discont");
|
||||
rtpgsmenc->next_time = 0;
|
||||
gst_pad_event_default (pad, event);
|
||||
return;
|
||||
GST_DEBUG ("discont");
|
||||
rtpgsmenc->next_time = 0;
|
||||
gst_pad_event_default (pad, event);
|
||||
return;
|
||||
default:
|
||||
gst_pad_event_default (pad, event);
|
||||
return;
|
||||
gst_pad_event_default (pad, event);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -87,7 +87,7 @@ gst_smpte_transition_type_get_type (void)
|
|||
|
||||
definitions = gst_mask_get_definitions ();
|
||||
smpte_transitions =
|
||||
g_new0 (GEnumValue, g_list_length ((GList *) definitions) + 1);
|
||||
g_new0 (GEnumValue, g_list_length ((GList *) definitions) + 1);
|
||||
|
||||
while (definitions) {
|
||||
GstMaskDefinition *definition = (GstMaskDefinition *) definitions->data;
|
||||
|
@ -102,7 +102,7 @@ gst_smpte_transition_type_get_type (void)
|
|||
}
|
||||
|
||||
smpte_transition_type =
|
||||
g_enum_register_static ("GstSMPTETransitionType", smpte_transitions);
|
||||
g_enum_register_static ("GstSMPTETransitionType", smpte_transitions);
|
||||
}
|
||||
return smpte_transition_type;
|
||||
}
|
||||
|
@ -140,8 +140,9 @@ gst_smpte_get_type (void)
|
|||
0,
|
||||
(GInstanceInitFunc) gst_smpte_init,
|
||||
};
|
||||
|
||||
smpte_type =
|
||||
g_type_register_static (GST_TYPE_ELEMENT, "GstSMPTE", &smpte_info, 0);
|
||||
g_type_register_static (GST_TYPE_ELEMENT, "GstSMPTE", &smpte_info, 0);
|
||||
}
|
||||
return smpte_type;
|
||||
}
|
||||
|
@ -178,18 +179,18 @@ gst_smpte_class_init (GstSMPTEClass * klass)
|
|||
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_TYPE,
|
||||
g_param_spec_enum ("type", "Type", "The type of transition to use",
|
||||
GST_TYPE_SMPTE_TRANSITION_TYPE, 1, G_PARAM_READWRITE));
|
||||
GST_TYPE_SMPTE_TRANSITION_TYPE, 1, G_PARAM_READWRITE));
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_FPS,
|
||||
g_param_spec_float ("fps", "FPS",
|
||||
"Frames per second if no input files are given", 0., G_MAXFLOAT, 25.,
|
||||
G_PARAM_READWRITE));
|
||||
"Frames per second if no input files are given", 0., G_MAXFLOAT, 25.,
|
||||
G_PARAM_READWRITE));
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_BORDER,
|
||||
g_param_spec_int ("border", "Border",
|
||||
"The border width of the transition", 0, G_MAXINT, 0,
|
||||
G_PARAM_READWRITE));
|
||||
"The border width of the transition", 0, G_MAXINT, 0,
|
||||
G_PARAM_READWRITE));
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_DEPTH,
|
||||
g_param_spec_int ("depth", "Depth", "Depth of the mask in bits", 1, 24,
|
||||
16, G_PARAM_READWRITE));
|
||||
16, G_PARAM_READWRITE));
|
||||
}
|
||||
|
||||
/* wht yel cya grn mag red blu blk -I Q */
|
||||
|
@ -324,8 +325,8 @@ gst_smpte_blend_i420 (guint8 * in1, guint8 * in2, guint8 * out, GstMask * mask,
|
|||
|
||||
*out++ = ((*in1++ * value) + (*in2++ * (256 - value))) >> 8;
|
||||
if (!(i & 1) && !(j & 1)) {
|
||||
*outu++ = ((*in1u++ * value) + (*in2u++ * (256 - value))) >> 8;
|
||||
*outv++ = ((*in1v++ * value) + (*in2v++ * (256 - value))) >> 8;
|
||||
*outu++ = ((*in1u++ * value) + (*in2u++ * (256 - value))) >> 8;
|
||||
*outv++ = ((*in1v++ * value) + (*in2v++ * (256 - value))) >> 8;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -376,25 +377,25 @@ gst_smpte_loop (GstElement * element)
|
|||
GstCaps *caps;
|
||||
|
||||
caps =
|
||||
gst_caps_copy (gst_static_caps_get (&gst_smpte_src_template.
|
||||
static_caps));
|
||||
gst_caps_copy (gst_static_caps_get (&gst_smpte_src_template.
|
||||
static_caps));
|
||||
gst_caps_set_simple (caps, "width", G_TYPE_INT, smpte->width, "height",
|
||||
G_TYPE_INT, smpte->height, "framerate", G_TYPE_DOUBLE, smpte->fps,
|
||||
NULL);
|
||||
G_TYPE_INT, smpte->height, "framerate", G_TYPE_DOUBLE, smpte->fps,
|
||||
NULL);
|
||||
|
||||
if (!gst_pad_try_set_caps (smpte->srcpad, caps)) {
|
||||
GST_ELEMENT_ERROR (smpte, CORE, NEGOTIATION, (NULL), (NULL));
|
||||
return;
|
||||
GST_ELEMENT_ERROR (smpte, CORE, NEGOTIATION, (NULL), (NULL));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
gst_smpte_blend_i420 (GST_BUFFER_DATA (in1),
|
||||
GST_BUFFER_DATA (in2),
|
||||
GST_BUFFER_DATA (outbuf),
|
||||
smpte->mask, smpte->width, smpte->height,
|
||||
smpte->border,
|
||||
((1 << smpte->depth) + smpte->border) *
|
||||
smpte->position / smpte->duration);
|
||||
GST_BUFFER_DATA (in2),
|
||||
GST_BUFFER_DATA (outbuf),
|
||||
smpte->mask, smpte->width, smpte->height,
|
||||
smpte->border,
|
||||
((1 << smpte->depth) + smpte->border) *
|
||||
smpte->position / smpte->duration);
|
||||
} else {
|
||||
outbuf = in2;
|
||||
gst_buffer_ref (in2);
|
||||
|
@ -425,7 +426,7 @@ gst_smpte_set_property (GObject * object, guint prop_id,
|
|||
gint type = g_value_get_enum (value);
|
||||
|
||||
gst_smpte_update_mask (smpte, type, smpte->depth,
|
||||
smpte->width, smpte->height);
|
||||
smpte->width, smpte->height);
|
||||
break;
|
||||
}
|
||||
case ARG_BORDER:
|
||||
|
@ -439,7 +440,7 @@ gst_smpte_set_property (GObject * object, guint prop_id,
|
|||
gint depth = g_value_get_int (value);
|
||||
|
||||
gst_smpte_update_mask (smpte, smpte->type, depth,
|
||||
smpte->width, smpte->height);
|
||||
smpte->width, smpte->height);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
|
@ -459,7 +460,7 @@ gst_smpte_get_property (GObject * object, guint prop_id,
|
|||
switch (prop_id) {
|
||||
case ARG_TYPE:
|
||||
if (smpte->mask) {
|
||||
g_value_set_enum (value, smpte->mask->type);
|
||||
g_value_set_enum (value, smpte->mask->type);
|
||||
}
|
||||
break;
|
||||
case ARG_FPS:
|
||||
|
|
|
@ -189,22 +189,22 @@ gst_smpte_paint_triangle_linear (guint32 * dest, gint stride,
|
|||
|
||||
e += sign;
|
||||
for (j = s; j != e; j += sign) {
|
||||
dest[j] = (ec * (j - s) + sc * (e - j)) / (e - s);
|
||||
dest[j] = (ec * (j - s) + sc * (e - j)) / (e - s);
|
||||
}
|
||||
|
||||
while (pyr == i) {
|
||||
STEP_3D_LINE (dxrabs, dyrabs, dcrabs, sdxr, sdyr, sdcr,
|
||||
xrr, yrr, crr, pxr, pyr, pcr);
|
||||
STEP_3D_LINE (dxrabs, dyrabs, dcrabs, sdxr, sdyr, sdcr,
|
||||
xrr, yrr, crr, pxr, pyr, pcr);
|
||||
}
|
||||
while (pyl == i) {
|
||||
STEP_3D_LINE (dxlabs, dylabs, dclabs, sdxl, sdyl, sdcl,
|
||||
xrl, yrl, crl, pxl, pyl, pcl);
|
||||
STEP_3D_LINE (dxlabs, dylabs, dclabs, sdxl, sdyl, sdcl,
|
||||
xrl, yrl, crl, pxl, pyl, pcl);
|
||||
}
|
||||
dest += stride;
|
||||
}
|
||||
|
||||
PREPARE_3D_LINE (x1, y1, c1, x2, y2, c2,
|
||||
dxrabs, dyrabs, dcrabs, sdxr, sdyr, sdcr, xrr, yrr, crr, pxr, pyr, pcr);
|
||||
dxrabs, dyrabs, dcrabs, sdxr, sdyr, sdcr, xrr, yrr, crr, pxr, pyr, pcr);
|
||||
|
||||
seg_start = y1;
|
||||
seg_end = y2;
|
||||
|
@ -265,7 +265,7 @@ gst_smpte_paint_triangle_clock (guint32 * dest, gint stride,
|
|||
angle_s = 0.0;
|
||||
angle_e = acos (((x1 - x0) * (x2 - x0) + (y1 - y0) * (y2 - y0)) /
|
||||
(sqrt ((x1 - x0) * (x1 - x0) + (y1 - y0) * (y1 - y0)) *
|
||||
sqrt ((x2 - x0) * (x2 - x0) + (y2 - y0) * (y2 - y0))));
|
||||
sqrt ((x2 - x0) * (x2 - x0) + (y2 - y0) * (y2 - y0))));
|
||||
|
||||
len1 = sqrt ((x1 - x0) * (x1 - x0) + (y1 - y0) * (y1 - y0));
|
||||
|
||||
|
@ -274,28 +274,28 @@ gst_smpte_paint_triangle_clock (guint32 * dest, gint stride,
|
|||
|
||||
for (i = y1; i != (y2 + sign); i += sign) {
|
||||
if (y1 == i)
|
||||
angle = 0;
|
||||
angle = 0;
|
||||
else
|
||||
angle = acos (((x1 - x0) * (x2 - x0) + (y1 - y0) * (i - y0)) /
|
||||
(len1 * sqrt ((x1 - x0) * (x1 - x0) + (i - y0) * (i -
|
||||
y0)))) / angle_e;
|
||||
angle = acos (((x1 - x0) * (x2 - x0) + (y1 - y0) * (i - y0)) /
|
||||
(len1 * sqrt ((x1 - x0) * (x1 - x0) + (i - y0) * (i -
|
||||
y0)))) / angle_e;
|
||||
|
||||
draw_bresenham_line (dest, stride,
|
||||
x0, y0, x1, i, (c2 * angle + c1 * (1.0 - angle)));
|
||||
x0, y0, x1, i, (c2 * angle + c1 * (1.0 - angle)));
|
||||
}
|
||||
} else if (y1 == y2) {
|
||||
sign = SIGN (x2 - x1);
|
||||
|
||||
for (i = x1; i != (x2 + sign); i += sign) {
|
||||
if (x1 == i)
|
||||
angle = 0;
|
||||
angle = 0;
|
||||
else
|
||||
angle = acos (((x1 - x0) * (i - x0) + (y1 - y0) * (y2 - y0)) /
|
||||
(len1 * sqrt ((i - x0) * (i - x0) + (y2 - y0) * (y2 -
|
||||
y0)))) / angle_e;
|
||||
angle = acos (((x1 - x0) * (i - x0) + (y1 - y0) * (y2 - y0)) /
|
||||
(len1 * sqrt ((i - x0) * (i - x0) + (y2 - y0) * (y2 -
|
||||
y0)))) / angle_e;
|
||||
|
||||
draw_bresenham_line (dest, stride,
|
||||
x0, y0, i, y1, (c2 * angle + c1 * (1.0 - angle)));
|
||||
x0, y0, i, y1, (c2 * angle + c1 * (1.0 - angle)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -321,7 +321,7 @@ gst_smpte_paint_box_clock (guint32 * dest, gint stride,
|
|||
|
||||
angle_m = 2 * acos (((x1 - x0) * (xv - x0) + (y1 - y0) * (yv - y0)) /
|
||||
(sqrt ((x1 - x0) * (x1 - x0) + (y1 - y0) * (y1 - y0)) *
|
||||
sqrt ((xv - x0) * (xv - x0) + (yv - y0) * (yv - y0)))) / M_PI;
|
||||
sqrt ((xv - x0) * (xv - x0) + (yv - y0) * (yv - y0)))) / M_PI;
|
||||
|
||||
col_m = c2 * angle_m + c1 * (1.0 - angle_m);
|
||||
|
||||
|
|
|
@ -82,9 +82,10 @@ gst_spectrum_get_type (void)
|
|||
0,
|
||||
(GInstanceInitFunc) gst_spectrum_init,
|
||||
};
|
||||
|
||||
spectrum_type =
|
||||
g_type_register_static (GST_TYPE_ELEMENT, "GstSpectrum", &spectrum_info,
|
||||
0);
|
||||
g_type_register_static (GST_TYPE_ELEMENT, "GstSpectrum", &spectrum_info,
|
||||
0);
|
||||
}
|
||||
return spectrum_type;
|
||||
}
|
||||
|
@ -105,7 +106,7 @@ gst_spectrum_class_init (GstSpectrumClass * klass)
|
|||
|
||||
parent_class = g_type_class_ref (GST_TYPE_ELEMENT);
|
||||
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_WIDTH, g_param_spec_int ("width", "width", "width", G_MININT, G_MAXINT, 0, G_PARAM_WRITABLE)); /* CHECKME */
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_WIDTH, g_param_spec_int ("width", "width", "width", G_MININT, G_MAXINT, 0, G_PARAM_WRITABLE)); /* CHECKME */
|
||||
|
||||
gobject_class->set_property = gst_spectrum_set_property;
|
||||
}
|
||||
|
|
|
@ -28,7 +28,7 @@ static gboolean
|
|||
plugin_init (GstPlugin * plugin)
|
||||
{
|
||||
if (!gst_element_register (plugin, "udpsink", GST_RANK_NONE,
|
||||
GST_TYPE_UDPSINK))
|
||||
GST_TYPE_UDPSINK))
|
||||
return FALSE;
|
||||
|
||||
if (!gst_element_register (plugin, "udpsrc", GST_RANK_NONE, GST_TYPE_UDPSRC))
|
||||
|
|
|
@ -63,9 +63,10 @@ gst_udpsink_control_get_type (void)
|
|||
{CONTROL_TCP, "3", "tcp"},
|
||||
{CONTROL_ZERO, NULL, NULL},
|
||||
};
|
||||
|
||||
if (!udpsink_control_type) {
|
||||
udpsink_control_type =
|
||||
g_enum_register_static ("GstUDPSinkControl", udpsink_control);
|
||||
g_enum_register_static ("GstUDPSinkControl", udpsink_control);
|
||||
}
|
||||
return udpsink_control_type;
|
||||
}
|
||||
|
@ -107,9 +108,10 @@ gst_udpsink_get_type (void)
|
|||
(GInstanceInitFunc) gst_udpsink_init,
|
||||
NULL
|
||||
};
|
||||
|
||||
udpsink_type =
|
||||
g_type_register_static (GST_TYPE_ELEMENT, "GstUDPSink", &udpsink_info,
|
||||
0);
|
||||
g_type_register_static (GST_TYPE_ELEMENT, "GstUDPSink", &udpsink_info,
|
||||
0);
|
||||
}
|
||||
return udpsink_type;
|
||||
}
|
||||
|
@ -135,15 +137,15 @@ gst_udpsink_class_init (GstUDPSink * klass)
|
|||
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_HOST,
|
||||
g_param_spec_string ("host", "host",
|
||||
"The host/IP/Multicast group to send the packets to",
|
||||
UDP_DEFAULT_HOST, G_PARAM_READWRITE));
|
||||
"The host/IP/Multicast group to send the packets to",
|
||||
UDP_DEFAULT_HOST, G_PARAM_READWRITE));
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_PORT,
|
||||
g_param_spec_int ("port", "port", "The port to send the packets to",
|
||||
0, 32768, UDP_DEFAULT_PORT, G_PARAM_READWRITE));
|
||||
0, 32768, UDP_DEFAULT_PORT, G_PARAM_READWRITE));
|
||||
g_object_class_install_property (gobject_class, ARG_CONTROL,
|
||||
g_param_spec_enum ("control", "control", "The type of control",
|
||||
GST_TYPE_UDPSINK_CONTROL, CONTROL_UDP, G_PARAM_READWRITE));
|
||||
g_object_class_install_property (gobject_class, ARG_MTU, g_param_spec_int ("mtu", "mtu", "maximun transmit unit", G_MININT, G_MAXINT, 0, G_PARAM_READWRITE)); /* CHECKME */
|
||||
GST_TYPE_UDPSINK_CONTROL, CONTROL_UDP, G_PARAM_READWRITE));
|
||||
g_object_class_install_property (gobject_class, ARG_MTU, g_param_spec_int ("mtu", "mtu", "maximun transmit unit", G_MININT, G_MAXINT, 0, G_PARAM_READWRITE)); /* CHECKME */
|
||||
|
||||
gobject_class->set_property = gst_udpsink_set_property;
|
||||
gobject_class->get_property = gst_udpsink_get_property;
|
||||
|
@ -192,8 +194,8 @@ gst_udpsink_sink_link (GstPad * pad, const GstCaps * caps)
|
|||
switch (udpsink->control) {
|
||||
case CONTROL_UDP:
|
||||
if ((fd = socket (AF_INET, SOCK_DGRAM, IPPROTO_UDP)) == -1) {
|
||||
perror ("socket");
|
||||
return GST_PAD_LINK_REFUSED;
|
||||
perror ("socket");
|
||||
return GST_PAD_LINK_REFUSED;
|
||||
}
|
||||
|
||||
/* We can only do broadcast in udp */
|
||||
|
@ -203,22 +205,22 @@ gst_udpsink_sink_link (GstPad * pad, const GstCaps * caps)
|
|||
xmlDocDumpMemory (doc, &buf, &buf_size);
|
||||
|
||||
if (sendto (fd, buf, buf_size, 0, (struct sockaddr *) &serv_addr,
|
||||
sizeof (serv_addr)) == -1) {
|
||||
perror ("sending");
|
||||
return GST_PAD_LINK_REFUSED;
|
||||
sizeof (serv_addr)) == -1) {
|
||||
perror ("sending");
|
||||
return GST_PAD_LINK_REFUSED;
|
||||
}
|
||||
close (fd);
|
||||
break;
|
||||
case CONTROL_TCP:
|
||||
if ((fd = socket (AF_INET, SOCK_STREAM, IPPROTO_TCP)) == -1) {
|
||||
perror ("socket");
|
||||
return GST_PAD_LINK_REFUSED;
|
||||
perror ("socket");
|
||||
return GST_PAD_LINK_REFUSED;
|
||||
}
|
||||
|
||||
if (connect (fd, (struct sockaddr *) &serv_addr, sizeof (serv_addr)) != 0) {
|
||||
g_printerr ("udpsink: connect to %s port %d failed: %s\n",
|
||||
udpsink->host, udpsink->port, g_strerror (errno));
|
||||
return GST_PAD_LINK_REFUSED;
|
||||
g_printerr ("udpsink: connect to %s port %d failed: %s\n",
|
||||
udpsink->host, udpsink->port, g_strerror (errno));
|
||||
return GST_PAD_LINK_REFUSED;
|
||||
}
|
||||
|
||||
f = fdopen (dup (fd), "wb");
|
||||
|
@ -296,15 +298,15 @@ gst_udpsink_chain (GstPad * pad, GstData * _data)
|
|||
for (i = 0; i < GST_BUFFER_SIZE (buf); i += udpsink->mtu) {
|
||||
if (GST_BUFFER_SIZE (buf) - i > udpsink->mtu) {
|
||||
if (sendto (udpsink->sock, GST_BUFFER_DATA (buf) + i,
|
||||
udpsink->mtu, 0, (struct sockaddr *) &udpsink->theiraddr,
|
||||
tolen) == -1) {
|
||||
perror ("sending");
|
||||
udpsink->mtu, 0, (struct sockaddr *) &udpsink->theiraddr,
|
||||
tolen) == -1) {
|
||||
perror ("sending");
|
||||
}
|
||||
} else {
|
||||
if (sendto (udpsink->sock, GST_BUFFER_DATA (buf) + i,
|
||||
GST_BUFFER_SIZE (buf) - i, 0,
|
||||
(struct sockaddr *) &udpsink->theiraddr, tolen) == -1) {
|
||||
perror ("sending");
|
||||
GST_BUFFER_SIZE (buf) - i, 0,
|
||||
(struct sockaddr *) &udpsink->theiraddr, tolen) == -1) {
|
||||
perror ("sending");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -325,11 +327,11 @@ gst_udpsink_set_property (GObject * object, guint prop_id, const GValue * value,
|
|||
switch (prop_id) {
|
||||
case ARG_HOST:
|
||||
if (udpsink->host != NULL)
|
||||
g_free (udpsink->host);
|
||||
g_free (udpsink->host);
|
||||
if (g_value_get_string (value) == NULL)
|
||||
udpsink->host = NULL;
|
||||
udpsink->host = NULL;
|
||||
else
|
||||
udpsink->host = g_strdup (g_value_get_string (value));
|
||||
udpsink->host = g_strdup (g_value_get_string (value));
|
||||
break;
|
||||
case ARG_PORT:
|
||||
udpsink->port = g_value_get_int (value);
|
||||
|
@ -384,8 +386,8 @@ gst_udpsink_init_send (GstUDPSink * sink)
|
|||
guint bc_val;
|
||||
|
||||
memset (&sink->theiraddr, 0, sizeof (sink->theiraddr));
|
||||
sink->theiraddr.sin_family = AF_INET; /* host byte order */
|
||||
sink->theiraddr.sin_port = htons (sink->port); /* short, network byte order */
|
||||
sink->theiraddr.sin_family = AF_INET; /* host byte order */
|
||||
sink->theiraddr.sin_port = htons (sink->port); /* short, network byte order */
|
||||
|
||||
/* if its an IP address */
|
||||
if (inet_aton (sink->host, &addr)) {
|
||||
|
@ -398,7 +400,7 @@ gst_udpsink_init_send (GstUDPSink * sink)
|
|||
|
||||
/* Joining the multicast group */
|
||||
setsockopt (sink->sock, IPPROTO_IP, IP_ADD_MEMBERSHIP, &sink->multi_addr,
|
||||
sizeof (sink->multi_addr));
|
||||
sizeof (sink->multi_addr));
|
||||
}
|
||||
|
||||
else {
|
||||
|
@ -454,7 +456,7 @@ gst_udpsink_change_state (GstElement * element)
|
|||
} else {
|
||||
if (!GST_FLAG_IS_SET (element, GST_UDPSINK_OPEN)) {
|
||||
if (!gst_udpsink_init_send (GST_UDPSINK (element)))
|
||||
return GST_STATE_FAILURE;
|
||||
return GST_STATE_FAILURE;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -62,9 +62,10 @@ gst_udpsrc_control_get_type (void)
|
|||
{CONTROL_TCP, "3", "tcp"},
|
||||
{CONTROL_ZERO, NULL, NULL},
|
||||
};
|
||||
|
||||
if (!udpsrc_control_type) {
|
||||
udpsrc_control_type =
|
||||
g_enum_register_static ("GstUDPSrcControl", udpsrc_control);
|
||||
g_enum_register_static ("GstUDPSrcControl", udpsrc_control);
|
||||
}
|
||||
return udpsrc_control_type;
|
||||
}
|
||||
|
@ -104,8 +105,9 @@ gst_udpsrc_get_type (void)
|
|||
(GInstanceInitFunc) gst_udpsrc_init,
|
||||
NULL
|
||||
};
|
||||
|
||||
udpsrc_type =
|
||||
g_type_register_static (GST_TYPE_ELEMENT, "GstUDPSrc", &udpsrc_info, 0);
|
||||
g_type_register_static (GST_TYPE_ELEMENT, "GstUDPSrc", &udpsrc_info, 0);
|
||||
}
|
||||
return udpsrc_type;
|
||||
}
|
||||
|
@ -131,14 +133,14 @@ gst_udpsrc_class_init (GstUDPSrc * klass)
|
|||
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_PORT,
|
||||
g_param_spec_int ("port", "port", "The port to receive the packets from",
|
||||
0, 32768, UDP_DEFAULT_PORT, G_PARAM_READWRITE));
|
||||
0, 32768, UDP_DEFAULT_PORT, G_PARAM_READWRITE));
|
||||
g_object_class_install_property (gobject_class, ARG_CONTROL,
|
||||
g_param_spec_enum ("control", "control", "The type of control",
|
||||
GST_TYPE_UDPSRC_CONTROL, CONTROL_UDP, G_PARAM_READWRITE));
|
||||
GST_TYPE_UDPSRC_CONTROL, CONTROL_UDP, G_PARAM_READWRITE));
|
||||
g_object_class_install_property (gobject_class, ARG_MULTICAST_GROUP,
|
||||
g_param_spec_string ("multicast_group", "multicast_group",
|
||||
"The Address of multicast group to join",
|
||||
UDP_DEFAULT_MULTICAST_GROUP, G_PARAM_READWRITE));
|
||||
"The Address of multicast group to join",
|
||||
UDP_DEFAULT_MULTICAST_GROUP, G_PARAM_READWRITE));
|
||||
|
||||
gobject_class->set_property = gst_udpsrc_set_property;
|
||||
gobject_class->get_property = gst_udpsrc_get_property;
|
||||
|
@ -200,7 +202,7 @@ gst_udpsrc_get (GstPad * pad)
|
|||
|
||||
if (select (max_sock + 1, &read_fds, NULL, NULL, NULL) > 0) {
|
||||
if ((udpsrc->control_sock != -1) &&
|
||||
FD_ISSET (udpsrc->control_sock, &read_fds)) {
|
||||
FD_ISSET (udpsrc->control_sock, &read_fds)) {
|
||||
#ifndef GST_DISABLE_LOADSAVE
|
||||
guchar *buf;
|
||||
int ret;
|
||||
|
@ -212,45 +214,45 @@ gst_udpsrc_get (GstPad * pad)
|
|||
buf = g_malloc (1024 * 10);
|
||||
|
||||
switch (udpsrc->control) {
|
||||
case CONTROL_TCP:
|
||||
len = sizeof (struct sockaddr);
|
||||
fdread = accept (udpsrc->control_sock, &addr, &len);
|
||||
if (fdread < 0) {
|
||||
perror ("accept");
|
||||
}
|
||||
case CONTROL_TCP:
|
||||
len = sizeof (struct sockaddr);
|
||||
fdread = accept (udpsrc->control_sock, &addr, &len);
|
||||
if (fdread < 0) {
|
||||
perror ("accept");
|
||||
}
|
||||
|
||||
ret = read (fdread, buf, 1024 * 10);
|
||||
break;
|
||||
case CONTROL_UDP:
|
||||
len = sizeof (struct sockaddr);
|
||||
ret =
|
||||
recvfrom (udpsrc->control_sock, buf, 1024 * 10, 0,
|
||||
(struct sockaddr *) &tmpaddr, &len);
|
||||
if (ret < 0) {
|
||||
perror ("recvfrom");
|
||||
}
|
||||
break;
|
||||
case CONTROL_NONE:
|
||||
default:
|
||||
g_free (buf);
|
||||
return NULL;
|
||||
break;
|
||||
ret = read (fdread, buf, 1024 * 10);
|
||||
break;
|
||||
case CONTROL_UDP:
|
||||
len = sizeof (struct sockaddr);
|
||||
ret =
|
||||
recvfrom (udpsrc->control_sock, buf, 1024 * 10, 0,
|
||||
(struct sockaddr *) &tmpaddr, &len);
|
||||
if (ret < 0) {
|
||||
perror ("recvfrom");
|
||||
}
|
||||
break;
|
||||
case CONTROL_NONE:
|
||||
default:
|
||||
g_free (buf);
|
||||
return NULL;
|
||||
break;
|
||||
}
|
||||
|
||||
buf[ret] = '\0';
|
||||
doc = xmlParseMemory (buf, ret);
|
||||
caps = gst_caps_load_thyself (doc->xmlRootNode);
|
||||
if (caps == NULL) {
|
||||
return NULL;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* foward the connect, we don't signal back the result here... */
|
||||
if (gst_caps_is_fixed (caps)) {
|
||||
gst_pad_try_set_caps (udpsrc->srcpad, caps);
|
||||
gst_pad_try_set_caps (udpsrc->srcpad, caps);
|
||||
} else {
|
||||
GST_ERROR ("caps %" GST_PTR_FORMAT, caps);
|
||||
GST_ELEMENT_ERROR (udpsrc, CORE, NEGOTIATION, (NULL),
|
||||
("Got unfixed caps from peer"));
|
||||
GST_ERROR ("caps %" GST_PTR_FORMAT, caps);
|
||||
GST_ELEMENT_ERROR (udpsrc, CORE, NEGOTIATION, (NULL),
|
||||
("Got unfixed caps from peer"));
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -262,37 +264,37 @@ gst_udpsrc_get (GstPad * pad)
|
|||
GST_BUFFER_SIZE (outbuf) = 24000;
|
||||
|
||||
if (udpsrc->first_buf) {
|
||||
if (udpsrc->clock) {
|
||||
GstClockTime current_time;
|
||||
GstEvent *discont;
|
||||
if (udpsrc->clock) {
|
||||
GstClockTime current_time;
|
||||
GstEvent *discont;
|
||||
|
||||
current_time = gst_clock_get_time (udpsrc->clock);
|
||||
current_time = gst_clock_get_time (udpsrc->clock);
|
||||
|
||||
GST_BUFFER_TIMESTAMP (outbuf) = current_time;
|
||||
GST_BUFFER_TIMESTAMP (outbuf) = current_time;
|
||||
|
||||
discont = gst_event_new_discontinuous (FALSE, GST_FORMAT_TIME,
|
||||
current_time, NULL);
|
||||
discont = gst_event_new_discontinuous (FALSE, GST_FORMAT_TIME,
|
||||
current_time, NULL);
|
||||
|
||||
gst_pad_push (udpsrc->srcpad, GST_DATA (discont));
|
||||
}
|
||||
gst_pad_push (udpsrc->srcpad, GST_DATA (discont));
|
||||
}
|
||||
|
||||
udpsrc->first_buf = FALSE;
|
||||
udpsrc->first_buf = FALSE;
|
||||
}
|
||||
|
||||
else {
|
||||
GST_BUFFER_TIMESTAMP (outbuf) = GST_CLOCK_TIME_NONE;
|
||||
GST_BUFFER_TIMESTAMP (outbuf) = GST_CLOCK_TIME_NONE;
|
||||
}
|
||||
|
||||
len = sizeof (struct sockaddr);
|
||||
numbytes = recvfrom (udpsrc->sock, GST_BUFFER_DATA (outbuf),
|
||||
GST_BUFFER_SIZE (outbuf), 0, (struct sockaddr *) &tmpaddr, &len);
|
||||
GST_BUFFER_SIZE (outbuf), 0, (struct sockaddr *) &tmpaddr, &len);
|
||||
|
||||
if (numbytes != -1) {
|
||||
GST_BUFFER_SIZE (outbuf) = numbytes;
|
||||
GST_BUFFER_SIZE (outbuf) = numbytes;
|
||||
} else {
|
||||
perror ("recvfrom");
|
||||
gst_buffer_unref (outbuf);
|
||||
outbuf = NULL;
|
||||
perror ("recvfrom");
|
||||
gst_buffer_unref (outbuf);
|
||||
outbuf = NULL;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -322,9 +324,9 @@ gst_udpsrc_set_property (GObject * object, guint prop_id, const GValue * value,
|
|||
g_free (udpsrc->multi_group);
|
||||
|
||||
if (g_value_get_string (value) == NULL)
|
||||
udpsrc->multi_group = g_strdup (UDP_DEFAULT_MULTICAST_GROUP);
|
||||
udpsrc->multi_group = g_strdup (UDP_DEFAULT_MULTICAST_GROUP);
|
||||
else
|
||||
udpsrc->multi_group = g_strdup (g_value_get_string (value));
|
||||
udpsrc->multi_group = g_strdup (g_value_get_string (value));
|
||||
|
||||
break;
|
||||
case ARG_CONTROL:
|
||||
|
@ -369,8 +371,8 @@ gst_udpsrc_init_receive (GstUDPSrc * src)
|
|||
gint reuse = 1;
|
||||
|
||||
memset (&src->myaddr, 0, sizeof (src->myaddr));
|
||||
src->myaddr.sin_family = AF_INET; /* host byte order */
|
||||
src->myaddr.sin_port = htons (src->port); /* short, network byte order */
|
||||
src->myaddr.sin_family = AF_INET; /* host byte order */
|
||||
src->myaddr.sin_port = htons (src->port); /* short, network byte order */
|
||||
src->myaddr.sin_addr.s_addr = INADDR_ANY;
|
||||
|
||||
if ((src->sock = socket (AF_INET, SOCK_DGRAM, 0)) == -1) {
|
||||
|
@ -379,13 +381,13 @@ gst_udpsrc_init_receive (GstUDPSrc * src)
|
|||
}
|
||||
|
||||
if (setsockopt (src->sock, SOL_SOCKET, SO_REUSEADDR, &reuse,
|
||||
sizeof (reuse)) == -1) {
|
||||
sizeof (reuse)) == -1) {
|
||||
perror ("setsockopt");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (bind (src->sock, (struct sockaddr *) &src->myaddr,
|
||||
sizeof (src->myaddr)) == -1) {
|
||||
sizeof (src->myaddr)) == -1) {
|
||||
perror ("bind");
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -394,7 +396,7 @@ gst_udpsrc_init_receive (GstUDPSrc * src)
|
|||
if (src->multi_addr.imr_multiaddr.s_addr) {
|
||||
src->multi_addr.imr_interface.s_addr = INADDR_ANY;
|
||||
setsockopt (src->sock, IPPROTO_IP, IP_ADD_MEMBERSHIP, &src->multi_addr,
|
||||
sizeof (src->multi_addr));
|
||||
sizeof (src->multi_addr));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -405,19 +407,19 @@ gst_udpsrc_init_receive (GstUDPSrc * src)
|
|||
switch (src->control) {
|
||||
case CONTROL_TCP:
|
||||
if ((src->control_sock = socket (AF_INET, SOCK_STREAM, 0)) == -1) {
|
||||
perror ("control_socket");
|
||||
return FALSE;
|
||||
perror ("control_socket");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (bind (src->control_sock, (struct sockaddr *) &src->myaddr,
|
||||
sizeof (src->myaddr)) == -1) {
|
||||
perror ("control_bind");
|
||||
return FALSE;
|
||||
sizeof (src->myaddr)) == -1) {
|
||||
perror ("control_bind");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (listen (src->control_sock, 5) == -1) {
|
||||
perror ("listen");
|
||||
return FALSE;
|
||||
perror ("listen");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
fcntl (src->control_sock, F_SETFL, O_NONBLOCK);
|
||||
|
@ -425,19 +427,19 @@ gst_udpsrc_init_receive (GstUDPSrc * src)
|
|||
break;
|
||||
case CONTROL_UDP:
|
||||
if ((src->control_sock = socket (AF_INET, SOCK_DGRAM, 0)) == -1) {
|
||||
perror ("socket");
|
||||
return FALSE;
|
||||
perror ("socket");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (bind (src->control_sock, (struct sockaddr *) &src->myaddr,
|
||||
sizeof (src->myaddr)) == -1) {
|
||||
perror ("control_bind");
|
||||
return FALSE;
|
||||
sizeof (src->myaddr)) == -1) {
|
||||
perror ("control_bind");
|
||||
return FALSE;
|
||||
}
|
||||
/* We can only do broadcast in udp */
|
||||
bc_val = 1;
|
||||
setsockopt (src->control_sock, SOL_SOCKET, SO_BROADCAST, &bc_val,
|
||||
sizeof (bc_val));
|
||||
sizeof (bc_val));
|
||||
break;
|
||||
case CONTROL_NONE:
|
||||
GST_FLAG_SET (src, GST_UDPSRC_OPEN);
|
||||
|
@ -479,7 +481,7 @@ gst_udpsrc_change_state (GstElement * element)
|
|||
} else {
|
||||
if (!GST_FLAG_IS_SET (element, GST_UDPSRC_OPEN)) {
|
||||
if (!gst_udpsrc_init_receive (GST_UDPSRC (element)))
|
||||
return GST_STATE_FAILURE;
|
||||
return GST_STATE_FAILURE;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -135,9 +135,10 @@ gst_video_crop_get_type (void)
|
|||
0,
|
||||
(GInstanceInitFunc) gst_video_crop_init,
|
||||
};
|
||||
|
||||
video_crop_type =
|
||||
g_type_register_static (GST_TYPE_ELEMENT, "GstVideoCrop",
|
||||
&video_crop_info, 0);
|
||||
g_type_register_static (GST_TYPE_ELEMENT, "GstVideoCrop",
|
||||
&video_crop_info, 0);
|
||||
}
|
||||
return video_crop_type;
|
||||
}
|
||||
|
@ -167,16 +168,16 @@ gst_video_crop_class_init (GstVideoCropClass * klass)
|
|||
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_LEFT,
|
||||
g_param_spec_int ("left", "Left", "Pixels to crop at left",
|
||||
0, G_MAXINT, 0, G_PARAM_READWRITE));
|
||||
0, G_MAXINT, 0, G_PARAM_READWRITE));
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_RIGHT,
|
||||
g_param_spec_int ("right", "Right", "Pixels to crop at right",
|
||||
0, G_MAXINT, 0, G_PARAM_READWRITE));
|
||||
0, G_MAXINT, 0, G_PARAM_READWRITE));
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_TOP,
|
||||
g_param_spec_int ("top", "Top", "Pixels to crop at top",
|
||||
0, G_MAXINT, 0, G_PARAM_READWRITE));
|
||||
0, G_MAXINT, 0, G_PARAM_READWRITE));
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_BOTTOM,
|
||||
g_param_spec_int ("bottom", "Bottom", "Pixels to crop at bottom",
|
||||
0, G_MAXINT, 0, G_PARAM_READWRITE));
|
||||
0, G_MAXINT, 0, G_PARAM_READWRITE));
|
||||
|
||||
gobject_class->set_property = gst_video_crop_set_property;
|
||||
gobject_class->get_property = gst_video_crop_get_property;
|
||||
|
@ -369,8 +370,8 @@ gst_video_crop_chain (GstPad * pad, GstData * _data)
|
|||
|
||||
switch (GST_EVENT_TYPE (event)) {
|
||||
default:
|
||||
gst_pad_event_default (pad, event);
|
||||
break;
|
||||
gst_pad_event_default (pad, event);
|
||||
break;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue