mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-24 01:00:37 +00:00
gst-indent
Original commit message from CVS: gst-indent
This commit is contained in:
parent
55594847ba
commit
908defa2c4
120 changed files with 11300 additions and 11450 deletions
|
@ -1,3 +1,7 @@
|
|||
2004-03-14 Thomas Vander Stichele <thomas at apestaart dot org>
|
||||
|
||||
* *.c, *.h: run gst-indent
|
||||
|
||||
2004-03-14 Benjamin Otte <otte@gnome.org>
|
||||
|
||||
* gst/modplug/gstmodplug.cc:
|
||||
|
|
|
@ -44,7 +44,8 @@ main (gint argc, gchar *argv[])
|
|||
g_object_set (G_OBJECT (filesrc), "location", argv[1], NULL);
|
||||
demux = gst_element_factory_make ("mpegdemux", "demux");
|
||||
g_return_val_if_fail (demux, -1);
|
||||
g_signal_connect (G_OBJECT (demux), "new_pad", G_CALLBACK (new_pad_func), pipeline);
|
||||
g_signal_connect (G_OBJECT (demux), "new_pad", G_CALLBACK (new_pad_func),
|
||||
pipeline);
|
||||
|
||||
thread = gst_thread_new ("thread");
|
||||
queue = gst_element_factory_make ("queue", "queue");
|
||||
|
@ -70,10 +71,8 @@ main (gint argc, gchar *argv[])
|
|||
gst_element_link (mpeg2dec, "src", colorspace, "sink");
|
||||
/* 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 "))
|
||||
GST_CAPS_NEW ("filtercaps",
|
||||
"video/raw", "format", GST_PROPS_FOURCC (GST_STR_FOURCC ("RGB "))
|
||||
));
|
||||
if (!res) {
|
||||
g_print ("could not connect colorspace and xvideosink\n");
|
||||
|
|
|
@ -48,6 +48,7 @@ typedef struct _filter_data _filter_data_t;
|
|||
|
||||
/* internal prototypes when they can't be avoided */
|
||||
void cb_remove_and_destroy (GtkWidget * widget, gpointer user_data);
|
||||
|
||||
//void cb_dynparm_value_changed (GtkWidget *widget, gpointer user_data);
|
||||
void cb_dynparm_value_changed (GtkRange * range, GstDParam * dparam);
|
||||
|
||||
|
@ -67,24 +68,21 @@ gst_bin_find_unconnected_pad (GstBin *bin, GstPadDirection direction,
|
|||
g_print ("DEBUG: find_unconnected start\n");
|
||||
elements = (GList *) gst_bin_get_list (bin);
|
||||
/* traverse all elements looking for unconnected pads */
|
||||
while (elements && pad == NULL)
|
||||
{
|
||||
while (elements && pad == NULL) {
|
||||
element = GST_ELEMENT (elements->data);
|
||||
g_print ("DEBUG: looking in element %s\n", gst_element_get_name (element));
|
||||
pads = gst_element_get_pad_list (element);
|
||||
while (pads)
|
||||
{
|
||||
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)
|
||||
{
|
||||
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 (pad) break; /* found one already */
|
||||
if (pad)
|
||||
break; /* found one already */
|
||||
pads = g_list_next (pads);
|
||||
}
|
||||
elements = g_list_next (elements);
|
||||
|
@ -150,23 +148,19 @@ ui_control_create (GstElement *element, GtkWidget *control, _filter_ui_t *ui)
|
|||
gtk_container_add (GTK_CONTAINER (control), widget);
|
||||
gtk_widget_show (widget);
|
||||
|
||||
if ((dpman = gst_dpman_get_manager (element)))
|
||||
{
|
||||
if ((dpman = gst_dpman_get_manager (element))) {
|
||||
ui_feedback_add (ui, "Found Dynamic Parameters on filter element.\n");
|
||||
specs = gst_dpman_list_dparam_specs (dpman);
|
||||
for (i = 0; specs[i] != NULL; ++i)
|
||||
{
|
||||
for (i = 0; specs[i] != NULL; ++i) {
|
||||
hbox = gtk_hbox_new (FALSE, 0);
|
||||
widget = gtk_label_new (g_param_spec_get_name (specs[i]));
|
||||
gtk_container_add (GTK_CONTAINER (hbox), widget);
|
||||
gtk_widget_show (widget);
|
||||
switch (G_PARAM_SPEC_VALUE_TYPE (specs[i]))
|
||||
{
|
||||
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);
|
||||
(gdouble) (((GParamSpecInt64 *) specs[i])->maximum), 1.0);
|
||||
gtk_range_set_value (GTK_RANGE (widget),
|
||||
(gdouble) ((GParamSpecInt64 *) specs[i])->default_value);
|
||||
break;
|
||||
|
@ -174,16 +168,14 @@ ui_control_create (GstElement *element, GtkWidget *control, _filter_ui_t *ui)
|
|||
case G_TYPE_INT:
|
||||
widget = gtk_hscale_new_with_range (
|
||||
(gdouble) (((GParamSpecInt *) specs[i])->minimum),
|
||||
(gdouble) (((GParamSpecInt*)specs[i])->maximum),
|
||||
1.0);
|
||||
(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);
|
||||
(gdouble) (((GParamSpecFloat *) specs[i])->maximum), 0.00001);
|
||||
gtk_range_set_value (GTK_RANGE (widget),
|
||||
(gdouble) ((GParamSpecFloat *) specs[i])->default_value);
|
||||
break;
|
||||
|
@ -192,8 +184,7 @@ ui_control_create (GstElement *element, GtkWidget *control, _filter_ui_t *ui)
|
|||
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);
|
||||
|
@ -227,6 +218,7 @@ cb_dynparm_value_changed (GtkRange *range, GstDParam *dparam)
|
|||
GtkHScale *adj = GTK_HSCALE (widget);
|
||||
*/
|
||||
gdouble value = 0.0;
|
||||
|
||||
g_assert (GST_IS_DPARAM (dparam));
|
||||
g_assert (GTK_IS_RANGE (range));
|
||||
|
||||
|
@ -234,21 +226,17 @@ cb_dynparm_value_changed (GtkRange *range, GstDParam *dparam)
|
|||
|
||||
g_print ("DEBUG: setting value to %f\n", value);
|
||||
|
||||
switch (G_PARAM_SPEC_VALUE_TYPE (GST_DPARAM_PARAM_SPEC (dparam)))
|
||||
{
|
||||
switch (G_PARAM_SPEC_VALUE_TYPE (GST_DPARAM_PARAM_SPEC (dparam))) {
|
||||
case G_TYPE_INT64:
|
||||
g_object_set (G_OBJECT (dparam), "value_int64",
|
||||
(gint64) value, NULL);
|
||||
g_object_set (G_OBJECT (dparam), "value_int64", (gint64) value, NULL);
|
||||
break;
|
||||
|
||||
case G_TYPE_INT:
|
||||
g_object_set (G_OBJECT (dparam), "value_int",
|
||||
(gint) value, NULL);
|
||||
g_object_set (G_OBJECT (dparam), "value_int", (gint) value, NULL);
|
||||
break;
|
||||
|
||||
case G_TYPE_FLOAT:
|
||||
g_object_set (G_OBJECT (dparam), "value_float",
|
||||
(gfloat) value, NULL);
|
||||
g_object_set (G_OBJECT (dparam), "value_float", (gfloat) value, NULL);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -267,8 +255,7 @@ cb_play_clicked (GtkButton *button, gpointer *user_data)
|
|||
_filter_data_t *fd = (_filter_data_t *) user_data;
|
||||
|
||||
g_return_if_fail (GST_IS_PIPELINE (fd->pipeline));
|
||||
if (GST_STATE (fd->pipeline) == GST_STATE_PLAYING)
|
||||
{
|
||||
if (GST_STATE (fd->pipeline) == GST_STATE_PLAYING) {
|
||||
ui_feedback_add (fd->ui, "Pipeline is already playing !\n");
|
||||
return;
|
||||
}
|
||||
|
@ -280,8 +267,7 @@ cb_stop_clicked (GtkButton *button, gpointer *user_data)
|
|||
{
|
||||
_filter_data_t *fd = (_filter_data_t *) user_data;
|
||||
|
||||
if (GST_STATE (fd->pipeline) != GST_STATE_PLAYING)
|
||||
{
|
||||
if (GST_STATE (fd->pipeline) != GST_STATE_PLAYING) {
|
||||
ui_feedback_add (fd->ui, "Pipeline is not playing !\n");
|
||||
return;
|
||||
}
|
||||
|
@ -299,44 +285,49 @@ cb_parse_clicked (GtkButton *button, gpointer *user_data)
|
|||
g_print ("DEBUG: you pressed parse.\n");
|
||||
ui_feedback_clear (fd->ui);
|
||||
ui_feedback_add (fd->ui, "Parsing pipeline ...\n");
|
||||
if (fd->input_pipe) g_free (fd->input_pipe);
|
||||
if (fd->output_pipe) g_free (fd->output_pipe);
|
||||
if (fd->filter_element) g_free (fd->filter_element);
|
||||
if (fd->input_pipe)
|
||||
g_free (fd->input_pipe);
|
||||
if (fd->output_pipe)
|
||||
g_free (fd->output_pipe);
|
||||
if (fd->filter_element)
|
||||
g_free (fd->filter_element);
|
||||
fd->input_pipe = g_strdup_printf ("bin.( %s )",
|
||||
gtk_entry_get_text (GTK_ENTRY (fd->ui->input)));
|
||||
fd->output_pipe = g_strdup_printf ("bin.( %s )",
|
||||
gtk_entry_get_text (GTK_ENTRY (fd->ui->output)));
|
||||
/* gtkcombo.h says I can access the entry field directly */
|
||||
fd->filter_element = g_strdup (gtk_entry_get_text (GTK_ENTRY (filter->entry)));
|
||||
g_print ("Input pipeline :\t%s (%d)\n", fd->input_pipe, (int)strlen (fd->input_pipe));
|
||||
g_print ("Filter element :\t%s (%d)\n", fd->filter_element, (int)strlen (fd->filter_element));
|
||||
g_print ("Output pipeline :\t%s (%d)\n", fd->output_pipe, (int)strlen (fd->output_pipe));
|
||||
fd->filter_element =
|
||||
g_strdup (gtk_entry_get_text (GTK_ENTRY (filter->entry)));
|
||||
g_print ("Input pipeline :\t%s (%d)\n", fd->input_pipe,
|
||||
(int) strlen (fd->input_pipe));
|
||||
g_print ("Filter element :\t%s (%d)\n", fd->filter_element,
|
||||
(int) strlen (fd->filter_element));
|
||||
g_print ("Output pipeline :\t%s (%d)\n", fd->output_pipe,
|
||||
(int) strlen (fd->output_pipe));
|
||||
|
||||
/* try to create in and out bins */
|
||||
if (strlen (fd->input_pipe) == 0)
|
||||
{
|
||||
if (strlen (fd->input_pipe) == 0) {
|
||||
ui_feedback_add (fd->ui, "Error : try setting an input pipe.\n");
|
||||
return;
|
||||
}
|
||||
if (fd->input) gst_object_unref (GST_OBJECT (fd->input));
|
||||
if (fd->input)
|
||||
gst_object_unref (GST_OBJECT (fd->input));
|
||||
fd->input = GST_ELEMENT (gst_parse_launch (fd->input_pipe, &error));
|
||||
if (error)
|
||||
{
|
||||
if (error) {
|
||||
ui_feedback_add (fd->ui, "Error : parsing input pipeline : %s\n",
|
||||
error->message);
|
||||
g_error_free (error);
|
||||
return;
|
||||
}
|
||||
|
||||
if (strlen (fd->output_pipe) == 0)
|
||||
{
|
||||
if (strlen (fd->output_pipe) == 0) {
|
||||
ui_feedback_add (fd->ui, "Error : try setting an output pipe.\n");
|
||||
return;
|
||||
}
|
||||
if (fd->output) gst_object_unref (GST_OBJECT (fd->output));
|
||||
if (fd->output)
|
||||
gst_object_unref (GST_OBJECT (fd->output));
|
||||
fd->output = GST_ELEMENT (gst_parse_launch (fd->output_pipe, &error));
|
||||
if (error)
|
||||
{
|
||||
if (error) {
|
||||
ui_feedback_add (fd->ui, "Error : parsing output pipeline : %s\n",
|
||||
error->message);
|
||||
g_error_free (error);
|
||||
|
@ -344,10 +335,10 @@ cb_parse_clicked (GtkButton *button, gpointer *user_data)
|
|||
}
|
||||
|
||||
/* try to create filter */
|
||||
if (fd->filter) gst_object_unref (GST_OBJECT (fd->filter));
|
||||
if (fd->filter)
|
||||
gst_object_unref (GST_OBJECT (fd->filter));
|
||||
fd->filter = gst_element_factory_make (fd->filter_element, "filter");
|
||||
if (fd->filter == NULL)
|
||||
{
|
||||
if (fd->filter == NULL) {
|
||||
ui_feedback_add (fd->ui, "Error : could not create element %s\n",
|
||||
fd->filter_element);
|
||||
return;
|
||||
|
@ -361,22 +352,19 @@ cb_parse_clicked (GtkButton *button, gpointer *user_data)
|
|||
|
||||
/* add the players to it */
|
||||
gst_bin_add_many (GST_BIN (fd->pipeline),
|
||||
fd->input, fd->filter,
|
||||
fd->output, NULL);
|
||||
fd->input, fd->filter, fd->output, NULL);
|
||||
|
||||
/* connect filter to input and output bin */
|
||||
src_pad = gst_bin_find_unconnected_pad (GST_BIN (fd->input), GST_PAD_SRC,
|
||||
"source");
|
||||
if (src_pad == NULL)
|
||||
{
|
||||
if (src_pad == NULL) {
|
||||
ui_feedback_add (fd->ui,
|
||||
"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)
|
||||
{
|
||||
if (sink_pad == NULL) {
|
||||
ui_feedback_add (fd->ui,
|
||||
"Error : could not find an unconnected sink pad !\n");
|
||||
return;
|
||||
|
@ -386,7 +374,8 @@ cb_parse_clicked (GtkButton *button, gpointer *user_data)
|
|||
|
||||
gst_element_link_many (fd->input, fd->filter, fd->output, NULL);
|
||||
|
||||
if (fd->pipe_string) g_free (fd->pipe_string);
|
||||
if (fd->pipe_string)
|
||||
g_free (fd->pipe_string);
|
||||
fd->pipe_string = g_strdup_printf ("%s ! %s ! %s", fd->input_pipe,
|
||||
fd->filter_element, fd->output_pipe);
|
||||
g_print ("Pipeline : %s\n", fd->pipe_string);
|
||||
|
@ -465,7 +454,7 @@ create_ui (_filter_ui_t *fui, _filter_data_t *fd)
|
|||
/* feedback widget */
|
||||
fui->fb_buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (fui->feedback));
|
||||
gtk_text_buffer_set_text (fui->fb_buffer,
|
||||
"Hello, and welcome to the GStreamer filter demo app !\n"\
|
||||
"Hello, and welcome to the GStreamer filter demo app !\n"
|
||||
"I'll be your feedback window for today.\n", -1);
|
||||
|
||||
/* selection widget */
|
||||
|
@ -527,4 +516,3 @@ main (int argc, char *argv[])
|
|||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -35,8 +35,8 @@ print_tag (const GstTagList *list, const gchar *tag, gpointer unused)
|
|||
if (gst_tag_get_type (tag) == G_TYPE_STRING) {
|
||||
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));
|
||||
str =
|
||||
g_strdup_value_contents (gst_tag_list_get_value_index (list, tag, i));
|
||||
}
|
||||
|
||||
if (i == 0) {
|
||||
|
@ -114,8 +114,7 @@ main (int argc, char *argv[])
|
|||
|
||||
/* Creating the GstPlay object */
|
||||
play = gst_play_new (&error);
|
||||
if (error)
|
||||
{
|
||||
if (error) {
|
||||
g_print ("Error: could not create play object:\n%s\n", error->message);
|
||||
g_error_free (error);
|
||||
return 1;
|
||||
|
@ -149,8 +148,7 @@ main (int argc, char *argv[])
|
|||
G_CALLBACK (got_found_tag), NULL);
|
||||
g_signal_connect (G_OBJECT (play), "error",
|
||||
G_CALLBACK (gst_element_default_error), NULL);
|
||||
g_signal_connect (G_OBJECT (play), "eos",
|
||||
G_CALLBACK (got_eos), NULL);
|
||||
g_signal_connect (G_OBJECT (play), "eos", G_CALLBACK (got_eos), NULL);
|
||||
|
||||
/* Change state to PLAYING */
|
||||
gst_element_set_state (GST_ELEMENT (play), GST_STATE_PLAYING);
|
||||
|
|
|
@ -33,14 +33,14 @@ entry_added (GstIndex *index, GstIndexEntry *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));
|
||||
g_print ("%p, %d: %08x ", entry, entry->id,
|
||||
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));
|
||||
|
@ -79,10 +79,7 @@ dynamic_link (GstPadTemplate *templ, GstPad *newpad, gpointer data)
|
|||
static void
|
||||
setup_dynamic_linking (GstElement * pipeline,
|
||||
GstElement * element,
|
||||
const gchar *padname,
|
||||
GstPad *target,
|
||||
GstElement *bin,
|
||||
GstIndex *index)
|
||||
const gchar * padname, GstPad * target, GstElement * bin, GstIndex * index)
|
||||
{
|
||||
dyn_link *link;
|
||||
|
||||
|
@ -93,7 +90,8 @@ setup_dynamic_linking (GstElement *pipeline,
|
|||
link->pipeline = pipeline;
|
||||
link->index = index;
|
||||
|
||||
g_signal_connect (G_OBJECT (element), "new_pad", G_CALLBACK (dynamic_link), link);
|
||||
g_signal_connect (G_OBJECT (element), "new_pad", G_CALLBACK (dynamic_link),
|
||||
link);
|
||||
}
|
||||
|
||||
static GstElement *
|
||||
|
@ -147,15 +145,13 @@ make_mpeg_decoder_pipeline (const gchar *path, GstIndex *index)
|
|||
gst_bin_add (GST_BIN (video_bin), video_decoder);
|
||||
|
||||
setup_dynamic_linking (pipeline, demux, "video_00",
|
||||
gst_element_get_pad (video_decoder, "sink"),
|
||||
video_bin, index);
|
||||
gst_element_get_pad (video_decoder, "sink"), video_bin, index);
|
||||
|
||||
audio_bin = gst_bin_new ("audio_bin");
|
||||
audio_decoder = gst_element_factory_make ("mad", "audio_decoder");
|
||||
|
||||
setup_dynamic_linking (pipeline, demux, "audio_00",
|
||||
gst_element_get_pad (audio_decoder, "sink"),
|
||||
audio_bin, index);
|
||||
gst_element_get_pad (audio_decoder, "sink"), audio_bin, index);
|
||||
|
||||
gst_bin_add (GST_BIN (audio_bin), audio_decoder);
|
||||
|
||||
|
@ -228,7 +224,8 @@ main (gint argc, gchar *argv[])
|
|||
index = gst_index_factory_make ("memindex");
|
||||
if (index) {
|
||||
if (verbose)
|
||||
g_signal_connect (G_OBJECT (index), "entry_added", G_CALLBACK (entry_added), NULL);
|
||||
g_signal_connect (G_OBJECT (index), "entry_added",
|
||||
G_CALLBACK (entry_added), NULL);
|
||||
|
||||
g_object_set (G_OBJECT (index), "resolver", 1, NULL);
|
||||
}
|
||||
|
@ -301,8 +298,7 @@ main (gint argc, gchar *argv[])
|
|||
|
||||
g_print ("seeking %s...\n", argv[2]);
|
||||
event = gst_event_new_seek (GST_FORMAT_TIME |
|
||||
GST_SEEK_METHOD_SET |
|
||||
GST_SEEK_FLAG_FLUSH, 5 * GST_SECOND);
|
||||
GST_SEEK_METHOD_SET | GST_SEEK_FLAG_FLUSH, 5 * GST_SECOND);
|
||||
|
||||
res = gst_pad_send_event (pad, event);
|
||||
if (!res) {
|
||||
|
@ -322,4 +318,3 @@ main (gint argc, gchar *argv[])
|
|||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
|
|
@ -24,14 +24,13 @@ get_position_info (GstElement *cdparanoia)
|
|||
definition = gst_format_get_details (*formats);
|
||||
|
||||
format = *formats;
|
||||
res = gst_pad_query (pad, GST_QUERY_POSITION,
|
||||
&format, &position);
|
||||
res = gst_pad_query (pad, GST_QUERY_POSITION, &format, &position);
|
||||
|
||||
if (format == GST_FORMAT_TIME) {
|
||||
position /= GST_SECOND;
|
||||
g_print ("%s: %lld:%02lld", definition->nick, position/60, position%60);
|
||||
}
|
||||
else {
|
||||
g_print ("%s: %lld:%02lld", definition->nick, position / 60,
|
||||
position % 60);
|
||||
} else {
|
||||
g_print ("%s: %lld", definition->nick, position);
|
||||
}
|
||||
|
||||
|
@ -70,22 +69,20 @@ get_track_info (GstElement *cdparanoia)
|
|||
definition = gst_format_get_details (*formats);
|
||||
|
||||
format = *formats;
|
||||
res = gst_pad_query (pad, GST_QUERY_TOTAL,
|
||||
&format, &total);
|
||||
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);
|
||||
}
|
||||
else
|
||||
g_print ("%s total: %lld:%02lld\n", definition->nick, total / 60,
|
||||
total % 60);
|
||||
} else
|
||||
g_print ("%s total: %lld\n", definition->nick, total);
|
||||
|
||||
if (format == track_format)
|
||||
total_tracks = total;
|
||||
else if (format == GST_FORMAT_TIME)
|
||||
total_time = total;
|
||||
}
|
||||
else
|
||||
} else
|
||||
g_print ("failed to get %s total\n", definition->nick);
|
||||
|
||||
formats++;
|
||||
|
@ -102,11 +99,9 @@ get_track_info (GstElement *cdparanoia)
|
|||
GstFormat format;
|
||||
|
||||
format = GST_FORMAT_TIME;
|
||||
res = gst_pad_convert (pad, track_format, i,
|
||||
&format, &time);
|
||||
res = gst_pad_convert (pad, track_format, i, &format, &time);
|
||||
time /= GST_SECOND;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
time = total_time;
|
||||
res = TRUE;
|
||||
}
|
||||
|
@ -120,11 +115,9 @@ get_track_info (GstElement *cdparanoia)
|
|||
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);
|
||||
time / 60, time % 60, length / 60, length % 60);
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
g_print ("could not get time for track %d\n", i);
|
||||
}
|
||||
|
||||
|
@ -177,9 +170,7 @@ main (int argc, char **argv)
|
|||
g_print ("playing from track 3\n");
|
||||
/* seek to track3 */
|
||||
event = gst_event_new_seek (track_format |
|
||||
GST_SEEK_METHOD_SET |
|
||||
GST_SEEK_FLAG_FLUSH,
|
||||
3);
|
||||
GST_SEEK_METHOD_SET | GST_SEEK_FLAG_FLUSH, 3);
|
||||
|
||||
res = gst_pad_send_event (pad, event);
|
||||
if (!res)
|
||||
|
@ -199,8 +190,7 @@ main (int argc, char **argv)
|
|||
/* seek to some seconds */
|
||||
event = gst_event_new_segment_seek (GST_FORMAT_TIME |
|
||||
GST_SEEK_METHOD_SET |
|
||||
GST_SEEK_FLAG_FLUSH,
|
||||
25 * GST_SECOND, 29 * GST_SECOND);
|
||||
GST_SEEK_FLAG_FLUSH, 25 * GST_SECOND, 29 * GST_SECOND);
|
||||
res = gst_pad_send_event (pad, event);
|
||||
if (!res)
|
||||
g_warning ("seek failed");
|
||||
|
|
|
@ -29,8 +29,7 @@ make_cdaudio_pipeline (void)
|
|||
}
|
||||
|
||||
static gchar *
|
||||
format_value (GtkScale *scale,
|
||||
gdouble value)
|
||||
format_value (GtkScale * scale, gdouble value)
|
||||
{
|
||||
gint64 real;
|
||||
gint64 seconds;
|
||||
|
@ -41,9 +40,7 @@ format_value (GtkScale *scale,
|
|||
subseconds = (gint64) real / (GST_SECOND / 100);
|
||||
|
||||
return g_strdup_printf ("%02lld:%02lld:%02lld",
|
||||
seconds/60,
|
||||
seconds%60,
|
||||
subseconds%100);
|
||||
seconds / 60, seconds % 60, subseconds % 100);
|
||||
}
|
||||
|
||||
typedef struct
|
||||
|
@ -52,8 +49,7 @@ typedef struct
|
|||
const GstFormat format;
|
||||
} seek_format;
|
||||
|
||||
static seek_format seek_formats[] =
|
||||
{
|
||||
static seek_format seek_formats[] = {
|
||||
{"tim", GST_FORMAT_TIME},
|
||||
{"byt", GST_FORMAT_BYTES},
|
||||
{"buf", GST_FORMAT_BUFFERS},
|
||||
|
@ -81,8 +77,7 @@ query_durations ()
|
|||
res = gst_element_query (element, GST_QUERY_TOTAL, &format, &value);
|
||||
if (res) {
|
||||
g_print ("%s %13lld | ", seek_formats[i].name, value);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
g_print ("%s %13.13s | ", seek_formats[i].name, "*NA*");
|
||||
}
|
||||
i++;
|
||||
|
@ -111,8 +106,7 @@ query_positions ()
|
|||
res = gst_element_query (element, GST_QUERY_POSITION, &format, &value);
|
||||
if (res) {
|
||||
g_print ("%s %13lld | ", seek_formats[i].name, value);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
g_print ("%s %13.13s | ", seek_formats[i].name, "*NA*");
|
||||
}
|
||||
i++;
|
||||
|
@ -134,6 +128,7 @@ update_scale (gpointer data)
|
|||
|
||||
if (seekable_elements) {
|
||||
GstElement *element = GST_ELEMENT (seekable_elements->data);
|
||||
|
||||
gst_element_query (element, GST_QUERY_TOTAL, &format, &duration);
|
||||
}
|
||||
if (clock)
|
||||
|
@ -141,7 +136,8 @@ update_scale (gpointer data)
|
|||
|
||||
if (stats) {
|
||||
if (clock)
|
||||
g_print ("clock: %13llu (%s)\n", position, gst_object_get_name (GST_OBJECT (clock)));
|
||||
g_print ("clock: %13llu (%s)\n", position,
|
||||
gst_object_get_name (GST_OBJECT (clock)));
|
||||
query_durations ();
|
||||
query_positions ();
|
||||
}
|
||||
|
@ -188,8 +184,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);
|
||||
|
||||
|
@ -199,7 +194,8 @@ stop_seek (GtkWidget *widget, GdkEventButton *event, gpointer user_data)
|
|||
gst_element_set_state (pipeline, GST_STATE_PLAYING);
|
||||
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);
|
||||
update_id =
|
||||
gtk_timeout_add (UPDATE_INTERVAL, (GtkFunction) update_scale, pipeline);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -211,7 +207,8 @@ play_cb (GtkButton * button, gpointer data)
|
|||
gst_element_set_state (pipeline, GST_STATE_PLAYING);
|
||||
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);
|
||||
update_id =
|
||||
gtk_timeout_add (UPDATE_INTERVAL, (GtkFunction) update_scale, pipeline);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -237,8 +234,7 @@ int
|
|||
main (int argc, char **argv)
|
||||
{
|
||||
GtkWidget *window, *hbox, *vbox,
|
||||
*play_button, *pause_button, *stop_button,
|
||||
*hscale;
|
||||
*play_button, *pause_button, *stop_button, *hscale;
|
||||
struct poptOption options[] = {
|
||||
{"stats", 's', POPT_ARG_NONE | POPT_ARGFLAG_STRIP, &stats, 0,
|
||||
"Show element stats", NULL},
|
||||
|
@ -250,8 +246,10 @@ main (int argc, char **argv)
|
|||
|
||||
pipeline = make_cdaudio_pipeline ();
|
||||
|
||||
g_signal_connect (pipeline, "deep_notify", G_CALLBACK (gst_element_default_deep_notify), NULL);
|
||||
g_signal_connect (pipeline, "error", G_CALLBACK (gst_element_default_error), NULL);
|
||||
g_signal_connect (pipeline, "deep_notify",
|
||||
G_CALLBACK (gst_element_default_deep_notify), NULL);
|
||||
g_signal_connect (pipeline, "error", G_CALLBACK (gst_element_default_error),
|
||||
NULL);
|
||||
|
||||
/* initialize gui elements ... */
|
||||
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
||||
|
@ -261,7 +259,8 @@ main (int argc, char **argv)
|
|||
pause_button = gtk_button_new_with_label ("pause");
|
||||
stop_button = gtk_button_new_with_label ("stop");
|
||||
|
||||
adjustment = GTK_ADJUSTMENT (gtk_adjustment_new (0.0, 0.00, 100.0, 0.1, 1.0, 1.0));
|
||||
adjustment =
|
||||
GTK_ADJUSTMENT (gtk_adjustment_new (0.0, 0.00, 100.0, 0.1, 1.0, 1.0));
|
||||
hscale = gtk_hscale_new (adjustment);
|
||||
gtk_scale_set_digits (GTK_SCALE (hscale), 2);
|
||||
gtk_range_set_update_policy (GTK_RANGE (hscale), GTK_UPDATE_CONTINUOUS);
|
||||
|
@ -283,9 +282,12 @@ main (int argc, char **argv)
|
|||
gtk_box_pack_start (GTK_BOX (vbox), hscale, TRUE, TRUE, 2);
|
||||
|
||||
/* connect things ... */
|
||||
g_signal_connect (G_OBJECT (play_button), "clicked", G_CALLBACK (play_cb), pipeline);
|
||||
g_signal_connect (G_OBJECT (pause_button), "clicked", G_CALLBACK (pause_cb), pipeline);
|
||||
g_signal_connect (G_OBJECT (stop_button), "clicked", G_CALLBACK (stop_cb), pipeline);
|
||||
g_signal_connect (G_OBJECT (play_button), "clicked", G_CALLBACK (play_cb),
|
||||
pipeline);
|
||||
g_signal_connect (G_OBJECT (pause_button), "clicked", G_CALLBACK (pause_cb),
|
||||
pipeline);
|
||||
g_signal_connect (G_OBJECT (stop_button), "clicked", G_CALLBACK (stop_cb),
|
||||
pipeline);
|
||||
g_signal_connect (G_OBJECT (window), "delete_event", gtk_main_quit, NULL);
|
||||
|
||||
/* show the gui. */
|
||||
|
|
|
@ -36,8 +36,7 @@ gst_element_factory_make_or_warn (gchar *type, gchar *name)
|
|||
GstElement *element = gst_element_factory_make (type, name);
|
||||
|
||||
if (!element) {
|
||||
g_warning ("Failed to create element %s of type %s",
|
||||
name, type);
|
||||
g_warning ("Failed to create element %s of type %s", name, type);
|
||||
}
|
||||
|
||||
return element;
|
||||
|
@ -60,7 +59,8 @@ dynamic_link (GstPadTemplate *templ, GstPad *newpad, gpointer data)
|
|||
}
|
||||
|
||||
static void
|
||||
setup_dynamic_link (GstElement *element, const gchar *padname, GstPad *target, GstElement *bin)
|
||||
setup_dynamic_link (GstElement * element, const gchar * padname,
|
||||
GstPad * target, GstElement * bin)
|
||||
{
|
||||
dyn_link *connect;
|
||||
|
||||
|
@ -69,7 +69,8 @@ setup_dynamic_link (GstElement *element, const gchar *padname, GstPad *target, G
|
|||
connect->target = target;
|
||||
connect->bin = bin;
|
||||
|
||||
g_signal_connect (G_OBJECT (element), "new_pad", G_CALLBACK (dynamic_link), connect);
|
||||
g_signal_connect (G_OBJECT (element), "new_pad", G_CALLBACK (dynamic_link),
|
||||
connect);
|
||||
}
|
||||
|
||||
static GstElement *
|
||||
|
@ -340,7 +341,8 @@ make_avi_pipeline (const gchar *location)
|
|||
{
|
||||
GstElement *pipeline, *audio_bin, *video_bin;
|
||||
GstElement *src, *demux, *a_decoder, *v_decoder, *audiosink, *videosink;
|
||||
GstElement *a_queue = NULL, *audio_thread = NULL, *v_queue = NULL, *video_thread = NULL;
|
||||
GstElement *a_queue = NULL, *audio_thread = NULL, *v_queue =
|
||||
NULL, *video_thread = NULL;
|
||||
GstPad *seekable;
|
||||
|
||||
pipeline = gst_pipeline_new ("app");
|
||||
|
@ -369,12 +371,14 @@ make_avi_pipeline (const gchar *location)
|
|||
gst_bin_add (GST_BIN (audio_thread), audiosink);
|
||||
gst_element_set_state (audio_bin, GST_STATE_PAUSED);
|
||||
|
||||
setup_dynamic_link (demux, "audio_00", gst_element_get_pad (a_decoder, "sink"), audio_bin);
|
||||
setup_dynamic_link (demux, "audio_00", gst_element_get_pad (a_decoder,
|
||||
"sink"), audio_bin);
|
||||
|
||||
seekable = gst_element_get_pad (a_queue, "src");
|
||||
seekable_pads = g_list_prepend (seekable_pads, seekable);
|
||||
rate_pads = g_list_prepend (rate_pads, seekable);
|
||||
rate_pads = g_list_prepend (rate_pads, gst_element_get_pad (a_decoder, "sink"));
|
||||
rate_pads =
|
||||
g_list_prepend (rate_pads, gst_element_get_pad (a_decoder, "sink"));
|
||||
|
||||
video_bin = gst_bin_new ("v_decoder_bin");
|
||||
//v_decoder = gst_element_factory_make_or_warn ("identity", "v_dec");
|
||||
|
@ -395,12 +399,14 @@ 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);
|
||||
setup_dynamic_link (demux, "video_00", gst_element_get_pad (v_decoder,
|
||||
"sink"), video_bin);
|
||||
|
||||
seekable = gst_element_get_pad (v_queue, "src");
|
||||
seekable_pads = g_list_prepend (seekable_pads, seekable);
|
||||
rate_pads = g_list_prepend (rate_pads, seekable);
|
||||
rate_pads = g_list_prepend (rate_pads, gst_element_get_pad (v_decoder, "sink"));
|
||||
rate_pads =
|
||||
g_list_prepend (rate_pads, gst_element_get_pad (v_decoder, "sink"));
|
||||
|
||||
return pipeline;
|
||||
}
|
||||
|
@ -441,12 +447,14 @@ make_mpeg_pipeline (const gchar *location)
|
|||
gst_bin_add (GST_BIN (audio_thread), a_queue);
|
||||
gst_bin_add (GST_BIN (audio_thread), audiosink);
|
||||
|
||||
setup_dynamic_link (demux, "audio_00", gst_element_get_pad (a_decoder, "sink"), audio_bin);
|
||||
setup_dynamic_link (demux, "audio_00", gst_element_get_pad (a_decoder,
|
||||
"sink"), audio_bin);
|
||||
|
||||
seekable = gst_element_get_pad (a_queue, "src");
|
||||
seekable_pads = g_list_prepend (seekable_pads, seekable);
|
||||
rate_pads = g_list_prepend (rate_pads, seekable);
|
||||
rate_pads = g_list_prepend (rate_pads, gst_element_get_pad (a_decoder, "sink"));
|
||||
rate_pads =
|
||||
g_list_prepend (rate_pads, gst_element_get_pad (a_decoder, "sink"));
|
||||
|
||||
video_bin = gst_bin_new ("v_decoder_bin");
|
||||
v_decoder = gst_element_factory_make_or_warn ("mpeg2dec", "v_dec");
|
||||
|
@ -461,12 +469,14 @@ make_mpeg_pipeline (const gchar *location)
|
|||
gst_bin_add_many (GST_BIN (video_bin), v_decoder, video_thread, NULL);
|
||||
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);
|
||||
setup_dynamic_link (demux, "video_00", gst_element_get_pad (v_decoder,
|
||||
"sink"), video_bin);
|
||||
|
||||
seekable = gst_element_get_pad (v_queue, "src");
|
||||
seekable_pads = g_list_prepend (seekable_pads, seekable);
|
||||
rate_pads = g_list_prepend (rate_pads, seekable);
|
||||
rate_pads = g_list_prepend (rate_pads, gst_element_get_pad (v_decoder, "sink"));
|
||||
rate_pads =
|
||||
g_list_prepend (rate_pads, gst_element_get_pad (v_decoder, "sink"));
|
||||
|
||||
return pipeline;
|
||||
}
|
||||
|
@ -508,12 +518,14 @@ make_mpegnt_pipeline (const gchar *location)
|
|||
gst_bin_add (GST_BIN (audio_thread), a_queue);
|
||||
gst_bin_add (GST_BIN (audio_thread), audiosink);
|
||||
|
||||
setup_dynamic_link (demux, "audio_00", gst_element_get_pad (a_decoder, "sink"), audio_bin);
|
||||
setup_dynamic_link (demux, "audio_00", gst_element_get_pad (a_decoder,
|
||||
"sink"), audio_bin);
|
||||
|
||||
seekable = gst_element_get_pad (a_queue, "src");
|
||||
seekable_pads = g_list_prepend (seekable_pads, seekable);
|
||||
rate_pads = g_list_prepend (rate_pads, seekable);
|
||||
rate_pads = g_list_prepend (rate_pads, gst_element_get_pad (a_decoder, "sink"));
|
||||
rate_pads =
|
||||
g_list_prepend (rate_pads, gst_element_get_pad (a_decoder, "sink"));
|
||||
|
||||
video_bin = gst_bin_new ("v_decoder_bin");
|
||||
v_decoder = gst_element_factory_make_or_warn ("mpeg2dec", "v_dec");
|
||||
|
@ -523,12 +535,14 @@ 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);
|
||||
setup_dynamic_link (demux, "video_00", gst_element_get_pad (v_decoder,
|
||||
"sink"), video_bin);
|
||||
|
||||
seekable = gst_element_get_pad (v_decoder, "src");
|
||||
seekable_pads = g_list_prepend (seekable_pads, seekable);
|
||||
rate_pads = g_list_prepend (rate_pads, seekable);
|
||||
rate_pads = g_list_prepend (rate_pads, gst_element_get_pad (v_decoder, "sink"));
|
||||
rate_pads =
|
||||
g_list_prepend (rate_pads, gst_element_get_pad (v_decoder, "sink"));
|
||||
|
||||
return pipeline;
|
||||
}
|
||||
|
@ -540,8 +554,7 @@ make_playerbin_pipeline (const gchar *location)
|
|||
}
|
||||
|
||||
static gchar *
|
||||
format_value (GtkScale *scale,
|
||||
gdouble value)
|
||||
format_value (GtkScale * scale, gdouble value)
|
||||
{
|
||||
gint64 real;
|
||||
gint64 seconds;
|
||||
|
@ -552,9 +565,7 @@ format_value (GtkScale *scale,
|
|||
subseconds = (gint64) real / (GST_SECOND / 100);
|
||||
|
||||
return g_strdup_printf ("%02lld:%02lld:%02lld",
|
||||
seconds/60,
|
||||
seconds%60,
|
||||
subseconds%100);
|
||||
seconds / 60, seconds % 60, subseconds % 100);
|
||||
}
|
||||
|
||||
typedef struct
|
||||
|
@ -563,8 +574,7 @@ typedef struct
|
|||
const GstFormat format;
|
||||
} seek_format;
|
||||
|
||||
static seek_format seek_formats[] =
|
||||
{
|
||||
static seek_format seek_formats[] = {
|
||||
{"tim", GST_FORMAT_TIME},
|
||||
{"byt", GST_FORMAT_BYTES},
|
||||
{"buf", GST_FORMAT_BUFFERS},
|
||||
|
@ -588,12 +598,9 @@ query_rates (void)
|
|||
|
||||
format = seek_formats[i].format;
|
||||
|
||||
if (gst_pad_convert (pad, GST_FORMAT_TIME, GST_SECOND,
|
||||
&format, &value))
|
||||
{
|
||||
if (gst_pad_convert (pad, GST_FORMAT_TIME, GST_SECOND, &format, &value)) {
|
||||
g_print ("%s %13lld | ", seek_formats[i].name, value);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
g_print ("%s %13.13s | ", seek_formats[i].name, "*NA*");
|
||||
}
|
||||
|
||||
|
@ -624,8 +631,7 @@ query_durations ()
|
|||
res = gst_pad_query (pad, GST_QUERY_TOTAL, &format, &value);
|
||||
if (res) {
|
||||
g_print ("%s %13lld | ", seek_formats[i].name, value);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
g_print ("%s %13.13s | ", seek_formats[i].name, "*NA*");
|
||||
}
|
||||
i++;
|
||||
|
@ -655,8 +661,7 @@ query_positions ()
|
|||
res = gst_pad_query (pad, GST_QUERY_POSITION, &format, &value);
|
||||
if (res) {
|
||||
g_print ("%s %13lld | ", seek_formats[i].name, value);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
g_print ("%s %13.13s | ", seek_formats[i].name, "*NA*");
|
||||
}
|
||||
i++;
|
||||
|
@ -679,12 +684,14 @@ update_scale (gpointer data)
|
|||
|
||||
if (seekable_pads) {
|
||||
GstPad *pad = GST_PAD (seekable_pads->data);
|
||||
|
||||
gst_pad_query (pad, GST_QUERY_TOTAL, &format, &duration);
|
||||
}
|
||||
position = gst_clock_get_time (clock);
|
||||
|
||||
if (stats) {
|
||||
g_print ("clock: %13llu (%s)\n", position, gst_object_get_name (GST_OBJECT (clock)));
|
||||
g_print ("clock: %13llu (%s)\n", position,
|
||||
gst_object_get_name (GST_OBJECT (clock)));
|
||||
query_durations ();
|
||||
query_positions ();
|
||||
query_rates ();
|
||||
|
@ -725,15 +732,17 @@ stop_seek (GtkWidget *widget, GdkEventButton *event, gpointer user_data)
|
|||
gint64 real = gtk_range_get_value (GTK_RANGE (widget)) * duration / 100;
|
||||
gboolean res;
|
||||
GstEvent *s_event;
|
||||
|
||||
#ifdef PAD_SEEK
|
||||
GList *walk = seekable_pads;
|
||||
|
||||
while (walk) {
|
||||
GstPad *seekable = GST_PAD (walk->data);
|
||||
|
||||
g_print ("seek to %lld on pad %s:%s\n", real, GST_DEBUG_PAD_NAME (seekable));
|
||||
s_event = gst_event_new_seek (GST_FORMAT_TIME |
|
||||
GST_SEEK_METHOD_SET |
|
||||
g_print ("seek to %lld on pad %s:%s\n", real,
|
||||
GST_DEBUG_PAD_NAME (seekable));
|
||||
s_event =
|
||||
gst_event_new_seek (GST_FORMAT_TIME | GST_SEEK_METHOD_SET |
|
||||
GST_SEEK_FLAG_FLUSH, real);
|
||||
|
||||
res = gst_pad_send_event (seekable, s_event);
|
||||
|
@ -746,9 +755,10 @@ stop_seek (GtkWidget *widget, GdkEventButton *event, gpointer user_data)
|
|||
while (walk) {
|
||||
GstElement *seekable = GST_ELEMENT (walk->data);
|
||||
|
||||
g_print ("seek to %lld on element %s\n", real, gst_element_get_name (seekable));
|
||||
s_event = gst_event_new_seek (GST_FORMAT_TIME |
|
||||
GST_SEEK_METHOD_SET |
|
||||
g_print ("seek to %lld on element %s\n", real,
|
||||
gst_element_get_name (seekable));
|
||||
s_event =
|
||||
gst_event_new_seek (GST_FORMAT_TIME | GST_SEEK_METHOD_SET |
|
||||
GST_SEEK_FLAG_FLUSH, real);
|
||||
|
||||
res = gst_element_send_event (seekable, s_event);
|
||||
|
@ -759,7 +769,8 @@ stop_seek (GtkWidget *widget, GdkEventButton *event, gpointer user_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);
|
||||
update_id =
|
||||
gtk_timeout_add (UPDATE_INTERVAL, (GtkFunction) update_scale, pipeline);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -770,7 +781,8 @@ play_cb (GtkButton * button, gpointer data)
|
|||
if (gst_element_get_state (pipeline) != GST_STATE_PLAYING) {
|
||||
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);
|
||||
update_id =
|
||||
gtk_timeout_add (UPDATE_INTERVAL, (GtkFunction) update_scale, pipeline);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -833,8 +845,7 @@ int
|
|||
main (int argc, char **argv)
|
||||
{
|
||||
GtkWidget *window, *hbox, *vbox,
|
||||
*play_button, *pause_button, *stop_button,
|
||||
*hscale;
|
||||
*play_button, *pause_button, *stop_button, *hscale;
|
||||
struct poptOption options[] = {
|
||||
{"stats", 's', POPT_ARG_NONE | POPT_ARGFLAG_STRIP, &stats, 0,
|
||||
"Show pad stats", NULL},
|
||||
|
@ -868,7 +879,8 @@ main (int argc, char **argv)
|
|||
pause_button = gtk_button_new_with_label ("pause");
|
||||
stop_button = gtk_button_new_with_label ("stop");
|
||||
|
||||
adjustment = GTK_ADJUSTMENT (gtk_adjustment_new (0.0, 0.00, 100.0, 0.1, 1.0, 1.0));
|
||||
adjustment =
|
||||
GTK_ADJUSTMENT (gtk_adjustment_new (0.0, 0.00, 100.0, 0.1, 1.0, 1.0));
|
||||
hscale = gtk_hscale_new (adjustment);
|
||||
gtk_scale_set_digits (GTK_SCALE (hscale), 2);
|
||||
gtk_range_set_update_policy (GTK_RANGE (hscale), GTK_UPDATE_CONTINUOUS);
|
||||
|
@ -890,16 +902,21 @@ main (int argc, char **argv)
|
|||
gtk_box_pack_start (GTK_BOX (vbox), hscale, TRUE, TRUE, 2);
|
||||
|
||||
/* connect things ... */
|
||||
g_signal_connect (G_OBJECT (play_button), "clicked", G_CALLBACK (play_cb), pipeline);
|
||||
g_signal_connect (G_OBJECT (pause_button), "clicked", G_CALLBACK (pause_cb), pipeline);
|
||||
g_signal_connect (G_OBJECT (stop_button), "clicked", G_CALLBACK (stop_cb), pipeline);
|
||||
g_signal_connect (G_OBJECT (play_button), "clicked", G_CALLBACK (play_cb),
|
||||
pipeline);
|
||||
g_signal_connect (G_OBJECT (pause_button), "clicked", G_CALLBACK (pause_cb),
|
||||
pipeline);
|
||||
g_signal_connect (G_OBJECT (stop_button), "clicked", G_CALLBACK (stop_cb),
|
||||
pipeline);
|
||||
g_signal_connect (G_OBJECT (window), "delete_event", gtk_main_quit, NULL);
|
||||
|
||||
/* show the gui. */
|
||||
gtk_widget_show_all (window);
|
||||
|
||||
g_signal_connect (pipeline, "deep_notify", G_CALLBACK (gst_element_default_deep_notify), NULL);
|
||||
g_signal_connect (pipeline, "error", G_CALLBACK (gst_element_default_error), NULL);
|
||||
g_signal_connect (pipeline, "deep_notify",
|
||||
G_CALLBACK (gst_element_default_deep_notify), NULL);
|
||||
g_signal_connect (pipeline, "error", G_CALLBACK (gst_element_default_error),
|
||||
NULL);
|
||||
|
||||
gtk_main ();
|
||||
|
||||
|
|
|
@ -23,12 +23,12 @@ static GstElement*
|
|||
make_spider_pipeline (const gchar * location, gboolean thread)
|
||||
{
|
||||
GstElement *pipeline;
|
||||
GstElement *src, *decoder, *audiosink, *videosink, *a_thread, *v_thread, *a_queue, *v_queue;
|
||||
GstElement *src, *decoder, *audiosink, *videosink, *a_thread, *v_thread,
|
||||
*a_queue, *v_queue;
|
||||
|
||||
if (thread) {
|
||||
pipeline = gst_thread_new ("app");
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
pipeline = gst_pipeline_new ("app");
|
||||
}
|
||||
|
||||
|
@ -64,15 +64,16 @@ make_spider_pipeline (const gchar *location, gboolean thread)
|
|||
|
||||
seekable_elements = g_list_prepend (seekable_elements, videosink);
|
||||
seekable_elements = g_list_prepend (seekable_elements, audiosink);
|
||||
rate_pads = g_list_prepend (rate_pads, gst_element_get_pad (audiosink, "sink"));
|
||||
rate_pads = g_list_prepend (rate_pads, gst_element_get_pad (videosink, "sink"));
|
||||
rate_pads =
|
||||
g_list_prepend (rate_pads, gst_element_get_pad (audiosink, "sink"));
|
||||
rate_pads =
|
||||
g_list_prepend (rate_pads, gst_element_get_pad (videosink, "sink"));
|
||||
|
||||
return pipeline;
|
||||
}
|
||||
|
||||
static gchar *
|
||||
format_value (GtkScale *scale,
|
||||
gdouble value)
|
||||
format_value (GtkScale * scale, gdouble value)
|
||||
{
|
||||
gint64 real;
|
||||
gint64 seconds;
|
||||
|
@ -83,9 +84,7 @@ format_value (GtkScale *scale,
|
|||
subseconds = (gint64) real / (GST_SECOND / 100);
|
||||
|
||||
return g_strdup_printf ("%02lld:%02lld:%02lld",
|
||||
seconds/60,
|
||||
seconds%60,
|
||||
subseconds%100);
|
||||
seconds / 60, seconds % 60, subseconds % 100);
|
||||
}
|
||||
|
||||
typedef struct
|
||||
|
@ -94,8 +93,7 @@ typedef struct
|
|||
const GstFormat format;
|
||||
} seek_format;
|
||||
|
||||
static seek_format seek_formats[] =
|
||||
{
|
||||
static seek_format seek_formats[] = {
|
||||
{"tim", GST_FORMAT_TIME},
|
||||
{"byt", GST_FORMAT_BYTES},
|
||||
{"buf", GST_FORMAT_BUFFERS},
|
||||
|
@ -119,12 +117,9 @@ query_rates (void)
|
|||
|
||||
format = seek_formats[i].format;
|
||||
|
||||
if (gst_pad_convert (pad, GST_FORMAT_TIME, GST_SECOND,
|
||||
&format, &value))
|
||||
{
|
||||
if (gst_pad_convert (pad, GST_FORMAT_TIME, GST_SECOND, &format, &value)) {
|
||||
g_print ("%s %13lld | ", seek_formats[i].name, value);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
g_print ("%s %13.13s | ", seek_formats[i].name, "*NA*");
|
||||
}
|
||||
|
||||
|
@ -155,8 +150,7 @@ query_durations ()
|
|||
res = gst_element_query (element, GST_QUERY_TOTAL, &format, &value);
|
||||
if (res) {
|
||||
g_print ("%s %13lld | ", seek_formats[i].name, value);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
g_print ("%s %13.13s | ", seek_formats[i].name, "*NA*");
|
||||
}
|
||||
i++;
|
||||
|
@ -185,8 +179,7 @@ query_positions ()
|
|||
res = gst_element_query (element, GST_QUERY_POSITION, &format, &value);
|
||||
if (res) {
|
||||
g_print ("%s %13lld | ", seek_formats[i].name, value);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
g_print ("%s %13.13s | ", seek_formats[i].name, "*NA*");
|
||||
}
|
||||
i++;
|
||||
|
@ -208,12 +201,14 @@ update_scale (gpointer data)
|
|||
|
||||
if (seekable_elements) {
|
||||
GstElement *element = GST_ELEMENT (seekable_elements->data);
|
||||
|
||||
gst_element_query (element, GST_QUERY_TOTAL, &format, &duration);
|
||||
}
|
||||
position = gst_clock_get_time (clock);
|
||||
|
||||
if (stats) {
|
||||
g_print ("clock: %13llu (%s)\n", position, gst_object_get_name (GST_OBJECT (clock)));
|
||||
g_print ("clock: %13llu (%s)\n", position,
|
||||
gst_object_get_name (GST_OBJECT (clock)));
|
||||
query_durations ();
|
||||
query_positions ();
|
||||
query_rates ();
|
||||
|
@ -260,8 +255,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);
|
||||
|
||||
|
@ -271,7 +265,8 @@ stop_seek (GtkWidget *widget, GdkEventButton *event, gpointer user_data)
|
|||
gst_element_set_state (pipeline, GST_STATE_PLAYING);
|
||||
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);
|
||||
update_id =
|
||||
gtk_timeout_add (UPDATE_INTERVAL, (GtkFunction) update_scale, pipeline);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -283,7 +278,8 @@ play_cb (GtkButton * button, gpointer data)
|
|||
gst_element_set_state (pipeline, GST_STATE_PLAYING);
|
||||
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);
|
||||
update_id =
|
||||
gtk_timeout_add (UPDATE_INTERVAL, (GtkFunction) update_scale, pipeline);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -309,8 +305,7 @@ int
|
|||
main (int argc, char **argv)
|
||||
{
|
||||
GtkWidget *window, *hbox, *vbox,
|
||||
*play_button, *pause_button, *stop_button,
|
||||
*hscale;
|
||||
*play_button, *pause_button, *stop_button, *hscale;
|
||||
gboolean threaded = FALSE;
|
||||
struct poptOption options[] = {
|
||||
{"threaded", 't', POPT_ARG_NONE | POPT_ARGFLAG_STRIP, &threaded, 0,
|
||||
|
@ -338,7 +333,8 @@ main (int argc, char **argv)
|
|||
pause_button = gtk_button_new_with_label ("pause");
|
||||
stop_button = gtk_button_new_with_label ("stop");
|
||||
|
||||
adjustment = GTK_ADJUSTMENT (gtk_adjustment_new (0.0, 0.00, 100.0, 0.1, 1.0, 1.0));
|
||||
adjustment =
|
||||
GTK_ADJUSTMENT (gtk_adjustment_new (0.0, 0.00, 100.0, 0.1, 1.0, 1.0));
|
||||
hscale = gtk_hscale_new (adjustment);
|
||||
gtk_scale_set_digits (GTK_SCALE (hscale), 2);
|
||||
gtk_range_set_update_policy (GTK_RANGE (hscale), GTK_UPDATE_CONTINUOUS);
|
||||
|
@ -360,9 +356,12 @@ main (int argc, char **argv)
|
|||
gtk_box_pack_start (GTK_BOX (vbox), hscale, TRUE, TRUE, 2);
|
||||
|
||||
/* connect things ... */
|
||||
g_signal_connect (G_OBJECT (play_button), "clicked", G_CALLBACK (play_cb), pipeline);
|
||||
g_signal_connect (G_OBJECT (pause_button), "clicked", G_CALLBACK (pause_cb), pipeline);
|
||||
g_signal_connect (G_OBJECT (stop_button), "clicked", G_CALLBACK (stop_cb), pipeline);
|
||||
g_signal_connect (G_OBJECT (play_button), "clicked", G_CALLBACK (play_cb),
|
||||
pipeline);
|
||||
g_signal_connect (G_OBJECT (pause_button), "clicked", G_CALLBACK (pause_cb),
|
||||
pipeline);
|
||||
g_signal_connect (G_OBJECT (stop_button), "clicked", G_CALLBACK (stop_cb),
|
||||
pipeline);
|
||||
g_signal_connect (G_OBJECT (window), "delete_event", gtk_main_quit, NULL);
|
||||
|
||||
/* show the gui. */
|
||||
|
|
|
@ -4,7 +4,8 @@
|
|||
|
||||
static gboolean ready = FALSE;
|
||||
|
||||
struct probe_context {
|
||||
struct probe_context
|
||||
{
|
||||
GstElement *pipeline;
|
||||
GstElement *element;
|
||||
GstPad *pad;
|
||||
|
@ -21,6 +22,7 @@ static void
|
|||
print_caps (GstCaps * caps)
|
||||
{
|
||||
char *s;
|
||||
|
||||
s = gst_caps_to_string (caps);
|
||||
g_print (" %s\n", s);
|
||||
g_free (s);
|
||||
|
@ -30,6 +32,7 @@ static void
|
|||
print_format (GstCaps * caps)
|
||||
{
|
||||
char *s;
|
||||
|
||||
s = gst_caps_to_string (caps);
|
||||
g_print (" format: %s\n", s);
|
||||
g_free (s);
|
||||
|
@ -62,11 +65,9 @@ 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 */
|
||||
|
@ -76,12 +77,10 @@ print_lbs_info (struct probe_context *context, gint stream)
|
|||
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 {
|
||||
} else {
|
||||
g_print (" %s: %lld\n", definition->nick, value_end);
|
||||
}
|
||||
}
|
||||
else
|
||||
} else
|
||||
g_print (" could not get logical stream %s\n", definition->nick);
|
||||
|
||||
}
|
||||
|
@ -99,8 +98,7 @@ deep_notify (GObject *object, GstObject *origin,
|
|||
g_value_init (&value, pspec->value_type);
|
||||
g_object_get_property (G_OBJECT (origin), pspec->name, &value);
|
||||
context->metadata = g_value_peek_pointer (&value);
|
||||
}
|
||||
else if (!strcmp (pspec->name, "streaminfo")) {
|
||||
} else if (!strcmp (pspec->name, "streaminfo")) {
|
||||
|
||||
g_value_init (&value, pspec->value_type);
|
||||
g_object_get_property (G_OBJECT (origin), pspec->name, &value);
|
||||
|
@ -127,9 +125,7 @@ collect_logical_stream_properties (struct probe_context *context, gint stream)
|
|||
|
||||
/* seek to stream */
|
||||
event = gst_event_new_seek (context->ls_format |
|
||||
GST_SEEK_METHOD_SET |
|
||||
GST_SEEK_FLAG_FLUSH,
|
||||
stream);
|
||||
GST_SEEK_METHOD_SET | GST_SEEK_FLAG_FLUSH, stream);
|
||||
res = gst_pad_send_event (context->pad, event);
|
||||
if (!res) {
|
||||
g_warning ("seek to logical track failed");
|
||||
|
@ -141,7 +137,8 @@ collect_logical_stream_properties (struct probe_context *context, gint stream)
|
|||
ready = FALSE;
|
||||
while (gst_bin_iterate (GST_BIN (context->pipeline)) && !ready) {
|
||||
count++;
|
||||
if (count > 10) break;
|
||||
if (count > 10)
|
||||
break;
|
||||
}
|
||||
|
||||
print_caps (context->metadata);
|
||||
|
@ -177,8 +174,7 @@ collect_stream_properties (struct probe_context *context)
|
|||
format = *formats;
|
||||
formats++;
|
||||
|
||||
res = gst_pad_query (context->pad, GST_QUERY_TOTAL,
|
||||
&format, &value);
|
||||
res = gst_pad_query (context->pad, GST_QUERY_TOTAL, &format, &value);
|
||||
|
||||
definition = gst_format_get_details (format);
|
||||
|
||||
|
@ -187,8 +183,7 @@ collect_stream_properties (struct probe_context *context)
|
|||
value /= (GST_SECOND / 100);
|
||||
g_print (" total %s: %lld:%02lld.%02lld\n", definition->nick,
|
||||
value / 6000, (value / 100) % 60, (value % 100));
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
if (format == context->ls_format)
|
||||
context->total_ls = value;
|
||||
g_print (" total %s: %lld\n", definition->nick, value);
|
||||
|
|
|
@ -46,7 +46,8 @@ main (gint argc, gchar *argv[])
|
|||
pipeline = GST_ELEMENT (gst_parse_launch (description, &error));
|
||||
if (!pipeline) {
|
||||
if (error)
|
||||
g_print ("ERROR: pipeline could not be constructed: %s\n", error->message);
|
||||
g_print ("ERROR: pipeline could not be constructed: %s\n",
|
||||
error->message);
|
||||
else
|
||||
g_print ("ERROR: pipeline could not be constructed\n");
|
||||
return -1;
|
||||
|
@ -71,12 +72,10 @@ main (gint argc, gchar *argv[])
|
|||
|
||||
format = GST_FORMAT_TIME;
|
||||
/* get the position */
|
||||
gst_pad_query (enc_src, GST_QUERY_POSITION,
|
||||
&format, &position);
|
||||
gst_pad_query (enc_src, GST_QUERY_POSITION, &format, &position);
|
||||
|
||||
/* get the total duration */
|
||||
gst_pad_query (enc_src, GST_QUERY_TOTAL,
|
||||
&format, &duration);
|
||||
gst_pad_query (enc_src, GST_QUERY_TOTAL, &format, &duration);
|
||||
|
||||
format = GST_FORMAT_BYTES;
|
||||
/* see how many bytes are genereated per 8 seconds (== bitrate) */
|
||||
|
@ -92,9 +91,7 @@ main (gint argc, gchar *argv[])
|
|||
(gint) (position / (GST_SECOND)) % 60,
|
||||
(gint) (duration / (GST_SECOND * 60)),
|
||||
(gint) (duration / (GST_SECOND)) % 60,
|
||||
bitrate_dec,
|
||||
bitrate_enc,
|
||||
(gfloat)bitrate_dec/bitrate_enc);
|
||||
bitrate_dec, bitrate_enc, (gfloat) bitrate_dec / bitrate_enc);
|
||||
}
|
||||
|
||||
g_print ("\n");
|
||||
|
|
|
@ -46,16 +46,14 @@ switch_timer (GstElement *video_switch)
|
|||
gint nb_sources, active_source;
|
||||
|
||||
g_object_get (G_OBJECT (video_switch), "nb_sources", &nb_sources, NULL);
|
||||
g_object_get (G_OBJECT (video_switch), "active_source",
|
||||
&active_source, NULL);
|
||||
g_object_get (G_OBJECT (video_switch), "active_source", &active_source, NULL);
|
||||
|
||||
active_source++;
|
||||
|
||||
if (active_source > nb_sources - 1)
|
||||
active_source = 0;
|
||||
|
||||
g_object_set (G_OBJECT (video_switch), "active_source",
|
||||
active_source, NULL);
|
||||
g_object_set (G_OBJECT (video_switch), "active_source", active_source, NULL);
|
||||
|
||||
g_message ("current number of sources : %d, active source %d",
|
||||
nb_sources, active_source);
|
||||
|
@ -88,8 +86,7 @@ main (int argc, char *argv[])
|
|||
gst_element_link (src2, video_switch);
|
||||
gst_element_link (video_switch, video_sink);
|
||||
|
||||
g_signal_connect (G_OBJECT (pipeline), "eos",
|
||||
G_CALLBACK (got_eos), NULL);
|
||||
g_signal_connect (G_OBJECT (pipeline), "eos", G_CALLBACK (got_eos), NULL);
|
||||
|
||||
gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_PLAYING);
|
||||
|
||||
|
|
|
@ -57,17 +57,13 @@ enum
|
|||
* "audio/a52" and "audio/ac3" are the same format. The name
|
||||
* "ac3" is now deprecated and should not be used in new code.
|
||||
*/
|
||||
static GstStaticPadTemplate sink_factory =
|
||||
GST_STATIC_PAD_TEMPLATE (
|
||||
"sink",
|
||||
static GstStaticPadTemplate sink_factory = GST_STATIC_PAD_TEMPLATE ("sink",
|
||||
GST_PAD_SINK,
|
||||
GST_PAD_ALWAYS,
|
||||
GST_STATIC_CAPS ("audio/x-ac3")
|
||||
);
|
||||
|
||||
static GstStaticPadTemplate src_factory =
|
||||
GST_STATIC_PAD_TEMPLATE (
|
||||
"src",
|
||||
static GstStaticPadTemplate src_factory = GST_STATIC_PAD_TEMPLATE ("src",
|
||||
GST_PAD_SRC,
|
||||
GST_PAD_ALWAYS,
|
||||
GST_STATIC_CAPS ("audio/x-raw-int, "
|
||||
|
@ -75,9 +71,7 @@ GST_STATIC_PAD_TEMPLATE (
|
|||
"signed = (boolean) true, "
|
||||
"width = (int) 16, "
|
||||
"depth = (int) 16, "
|
||||
"rate = (int) [ 4000, 48000 ], "
|
||||
"channels = (int) [ 1, 6 ]"
|
||||
)
|
||||
"rate = (int) [ 4000, 48000 ], " "channels = (int) [ 1, 6 ]")
|
||||
);
|
||||
|
||||
static void gst_a52dec_base_init (gpointer g_class);
|
||||
|
@ -85,8 +79,7 @@ static void gst_a52dec_class_init (GstA52DecClass * klass);
|
|||
static void gst_a52dec_init (GstA52Dec * a52dec);
|
||||
|
||||
static void gst_a52dec_loop (GstElement * element);
|
||||
static GstElementStateReturn
|
||||
gst_a52dec_change_state (GstElement * element);
|
||||
static GstElementStateReturn gst_a52dec_change_state (GstElement * element);
|
||||
|
||||
static void gst_a52dec_set_property (GObject * object, guint prop_id,
|
||||
const GValue * value, GParamSpec * pspec);
|
||||
|
@ -94,6 +87,7 @@ static void gst_a52dec_get_property (GObject * object, guint prop_id,
|
|||
GValue * value, GParamSpec * pspec);
|
||||
|
||||
static GstElementClass *parent_class = NULL;
|
||||
|
||||
/* static guint gst_a52dec_signals[LAST_SIGNAL] = { 0 }; */
|
||||
|
||||
GType
|
||||
|
@ -113,7 +107,8 @@ gst_a52dec_get_type (void)
|
|||
(GInstanceInitFunc) gst_a52dec_init,
|
||||
};
|
||||
|
||||
a52dec_type = g_type_register_static (GST_TYPE_ELEMENT, "GstA52Dec", &a52dec_info, 0);
|
||||
a52dec_type =
|
||||
g_type_register_static (GST_TYPE_ELEMENT, "GstA52Dec", &a52dec_info, 0);
|
||||
}
|
||||
return a52dec_type;
|
||||
}
|
||||
|
@ -142,8 +137,7 @@ gst_a52dec_class_init (GstA52DecClass * klass)
|
|||
parent_class = g_type_class_ref (GST_TYPE_ELEMENT);
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_DRC,
|
||||
g_param_spec_boolean ("drc", "Dynamic Range Compression",
|
||||
"Use Dynamic Range Compression", FALSE,
|
||||
G_PARAM_READWRITE));
|
||||
"Use Dynamic Range Compression", FALSE, G_PARAM_READWRITE));
|
||||
|
||||
gobject_class->set_property = gst_a52dec_set_property;
|
||||
gobject_class->get_property = gst_a52dec_get_property;
|
||||
|
@ -155,13 +149,15 @@ static void
|
|||
gst_a52dec_init (GstA52Dec * a52dec)
|
||||
{
|
||||
/* create the sink and src pads */
|
||||
a52dec->sinkpad = gst_pad_new_from_template (
|
||||
gst_element_get_pad_template (GST_ELEMENT (a52dec), "sink"), "sink");
|
||||
a52dec->sinkpad =
|
||||
gst_pad_new_from_template (gst_element_get_pad_template (GST_ELEMENT
|
||||
(a52dec), "sink"), "sink");
|
||||
gst_element_add_pad (GST_ELEMENT (a52dec), a52dec->sinkpad);
|
||||
gst_element_set_loop_function ((GstElement *) a52dec, gst_a52dec_loop);
|
||||
|
||||
a52dec->srcpad = gst_pad_new_from_template (
|
||||
gst_element_get_pad_template (GST_ELEMENT (a52dec), "src"), "src");
|
||||
a52dec->srcpad =
|
||||
gst_pad_new_from_template (gst_element_get_pad_template (GST_ELEMENT
|
||||
(a52dec), "src"), "src");
|
||||
gst_pad_use_explicit_caps (a52dec->srcpad);
|
||||
gst_element_add_pad (GST_ELEMENT (a52dec), a52dec->srcpad);
|
||||
|
||||
|
@ -310,7 +306,8 @@ gst_a52dec_channels (int flags)
|
|||
}
|
||||
|
||||
static int
|
||||
gst_a52dec_push (GstPad * srcpad, int flags, sample_t * _samples, gint64 timestamp)
|
||||
gst_a52dec_push (GstPad * srcpad, int flags, sample_t * _samples,
|
||||
gint64 timestamp)
|
||||
{
|
||||
GstBuffer *buf;
|
||||
int chans;
|
||||
|
@ -356,9 +353,7 @@ gst_a52dec_reneg (GstPad * pad, int channels, int rate)
|
|||
"signed", G_TYPE_BOOLEAN, TRUE,
|
||||
"width", G_TYPE_INT, 16,
|
||||
"depth", G_TYPE_INT, 16,
|
||||
"channels", G_TYPE_INT, channels,
|
||||
"rate", G_TYPE_INT, rate,
|
||||
NULL));
|
||||
"channels", G_TYPE_INT, channels, "rate", G_TYPE_INT, rate, NULL));
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -398,8 +393,7 @@ gst_a52dec_update_streaminfo (GstA52Dec *a52dec)
|
|||
gst_caps_unref (a52dec->streaminfo);
|
||||
|
||||
a52dec->streaminfo = gst_caps_new ("a52dec_streaminfo",
|
||||
"application/x-gst-streaminfo",
|
||||
props);
|
||||
"application/x-gst-streaminfo", props);
|
||||
g_object_notify (G_OBJECT (a52dec), "streaminfo");
|
||||
}
|
||||
#endif
|
||||
|
@ -429,8 +423,7 @@ gst_a52dec_loop (GstElement *element)
|
|||
if (length == 0) {
|
||||
/* slide window to next 7 bytesa */
|
||||
gst_bytestream_flush_fast (a52dec->bs, 1);
|
||||
}
|
||||
else
|
||||
} else
|
||||
break;
|
||||
|
||||
/* FIXME this can potentially be an infinite loop, we might
|
||||
|
@ -460,8 +453,7 @@ gst_a52dec_loop (GstElement *element)
|
|||
timestamp = gst_bytestream_get_timestamp (a52dec->bs);
|
||||
if (timestamp == a52dec->last_ts) {
|
||||
timestamp = a52dec->current_ts;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
a52dec->last_ts = timestamp;
|
||||
}
|
||||
|
||||
|
@ -498,10 +490,10 @@ gst_a52dec_loop (GstElement *element)
|
|||
continue;
|
||||
}
|
||||
/* push on */
|
||||
if (gst_a52dec_push (a52dec->srcpad, a52dec->using_channels, a52dec->samples, timestamp)) {
|
||||
if (gst_a52dec_push (a52dec->srcpad, a52dec->using_channels,
|
||||
a52dec->samples, timestamp)) {
|
||||
g_warning ("a52dec push error\n");
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
timestamp += sizeof (int16_t) * 256 * GST_SECOND / a52dec->sample_rate;
|
||||
}
|
||||
}
|
||||
|
@ -558,7 +550,8 @@ gst_a52dec_change_state (GstElement * element)
|
|||
}
|
||||
|
||||
static void
|
||||
gst_a52dec_set_property (GObject * object, guint prop_id, const GValue * value, GParamSpec * pspec)
|
||||
gst_a52dec_set_property (GObject * object, guint prop_id, const GValue * value,
|
||||
GParamSpec * pspec)
|
||||
{
|
||||
GstA52Dec *src;
|
||||
|
||||
|
@ -577,7 +570,8 @@ gst_a52dec_set_property (GObject * object, guint prop_id, const GValue * value,
|
|||
}
|
||||
|
||||
static void
|
||||
gst_a52dec_get_property (GObject * object, guint prop_id, GValue * value, GParamSpec * pspec)
|
||||
gst_a52dec_get_property (GObject * object, guint prop_id, GValue * value,
|
||||
GParamSpec * pspec)
|
||||
{
|
||||
GstA52Dec *src;
|
||||
|
||||
|
@ -602,20 +596,15 @@ plugin_init (GstPlugin * plugin)
|
|||
if (!gst_library_load ("gstbytestream"))
|
||||
return FALSE;
|
||||
|
||||
if (!gst_element_register (plugin, "a52dec", GST_RANK_PRIMARY, GST_TYPE_A52DEC))
|
||||
if (!gst_element_register (plugin, "a52dec", GST_RANK_PRIMARY,
|
||||
GST_TYPE_A52DEC))
|
||||
return FALSE;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
GST_PLUGIN_DEFINE (
|
||||
GST_VERSION_MAJOR,
|
||||
GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
|
||||
GST_VERSION_MINOR,
|
||||
"a52dec",
|
||||
"Decodes ATSC A/52 encoded audio streams",
|
||||
plugin_init,
|
||||
VERSION,
|
||||
"GPL",
|
||||
GST_PACKAGE,
|
||||
GST_ORIGIN
|
||||
);
|
||||
plugin_init, VERSION, "GPL", GST_PACKAGE, GST_ORIGIN);
|
||||
|
|
|
@ -25,7 +25,6 @@
|
|||
#include <gst/bytestream/bytestream.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define GST_TYPE_A52DEC \
|
||||
(gst_a52dec_get_type())
|
||||
#define GST_A52DEC(obj) \
|
||||
|
@ -36,16 +35,15 @@ G_BEGIN_DECLS
|
|||
(G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_A52DEC))
|
||||
#define GST_IS_A52DEC_CLASS(obj) \
|
||||
(G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_A52DEC))
|
||||
|
||||
typedef struct _GstA52Dec GstA52Dec;
|
||||
typedef struct _GstA52DecClass GstA52DecClass;
|
||||
|
||||
struct _GstA52Dec {
|
||||
struct _GstA52Dec
|
||||
{
|
||||
GstElement element;
|
||||
|
||||
/* pads */
|
||||
GstPad *sinkpad,
|
||||
*srcpad;
|
||||
GstPad *sinkpad, *srcpad;
|
||||
int bit_rate;
|
||||
int sample_rate;
|
||||
int stream_channels;
|
||||
|
@ -64,10 +62,10 @@ struct _GstA52Dec {
|
|||
GstClockTime current_ts;
|
||||
};
|
||||
|
||||
struct _GstA52DecClass {
|
||||
struct _GstA52DecClass
|
||||
{
|
||||
GstElementClass parent_class;
|
||||
};
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GST_A52DEC_H__ */
|
||||
|
|
|
@ -47,7 +47,8 @@
|
|||
typedef struct _DVDNavSrc DVDNavSrc;
|
||||
typedef struct _DVDNavSrcClass DVDNavSrcClass;
|
||||
|
||||
struct _DVDNavSrc {
|
||||
struct _DVDNavSrc
|
||||
{
|
||||
GstElement element;
|
||||
|
||||
/* pads */
|
||||
|
@ -66,7 +67,8 @@ struct _DVDNavSrc {
|
|||
GstCaps *buttoninfo;
|
||||
};
|
||||
|
||||
struct _DVDNavSrcClass {
|
||||
struct _DVDNavSrcClass
|
||||
{
|
||||
GstElementClass parent_class;
|
||||
|
||||
void (*button_pressed) (DVDNavSrc * src, int button);
|
||||
|
@ -85,7 +87,8 @@ GstElementDetails dvdnavsrc_details = {
|
|||
|
||||
|
||||
/* DVDNavSrc signals and args */
|
||||
enum {
|
||||
enum
|
||||
{
|
||||
BUTTON_PRESSED_SIGNAL,
|
||||
POINTER_SELECT_SIGNAL,
|
||||
POINTER_ACTIVATE_SIGNAL,
|
||||
|
@ -93,7 +96,8 @@ enum {
|
|||
LAST_SIGNAL
|
||||
};
|
||||
|
||||
enum {
|
||||
enum
|
||||
{
|
||||
ARG_0,
|
||||
ARG_LOCATION,
|
||||
ARG_STREAMINFO,
|
||||
|
@ -104,7 +108,8 @@ enum {
|
|||
ARG_ANGLE
|
||||
};
|
||||
|
||||
typedef enum {
|
||||
typedef enum
|
||||
{
|
||||
DVDNAVSRC_OPEN = GST_ELEMENT_FLAG_LAST,
|
||||
|
||||
DVDNAVSRC_FLAG_LAST = GST_ELEMENT_FLAG_LAST + 2,
|
||||
|
@ -116,16 +121,18 @@ static void dvdnavsrc_base_init (gpointer g_class);
|
|||
static void dvdnavsrc_class_init (DVDNavSrcClass * klass);
|
||||
static void dvdnavsrc_init (DVDNavSrc * dvdnavsrc);
|
||||
|
||||
static void dvdnavsrc_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec);
|
||||
static void dvdnavsrc_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec);
|
||||
static void dvdnavsrc_set_property (GObject * object, guint prop_id,
|
||||
const GValue * value, GParamSpec * pspec);
|
||||
static void dvdnavsrc_get_property (GObject * object, guint prop_id,
|
||||
GValue * value, GParamSpec * pspec);
|
||||
|
||||
static GstData *dvdnavsrc_get (GstPad * pad);
|
||||
|
||||
/*static GstBuffer * dvdnavsrc_get_region (GstPad *pad,gulong offset,gulong size); */
|
||||
static gboolean dvdnavsrc_event (GstPad * pad, GstEvent * event);
|
||||
static const GstEventMask*
|
||||
dvdnavsrc_get_event_mask (GstPad *pad);
|
||||
static const GstFormat*
|
||||
dvdnavsrc_get_formats (GstPad *pad);
|
||||
static const GstEventMask *dvdnavsrc_get_event_mask (GstPad * pad);
|
||||
static const GstFormat *dvdnavsrc_get_formats (GstPad * pad);
|
||||
|
||||
/*static gboolean dvdnavsrc_convert (GstPad *pad,
|
||||
GstFormat src_format,
|
||||
gint64 src_value,
|
||||
|
@ -133,13 +140,13 @@ static const GstFormat*
|
|||
gint64 *dest_value);*/
|
||||
static gboolean dvdnavsrc_query (GstPad * pad, GstQueryType type,
|
||||
GstFormat * format, gint64 * value);
|
||||
static const GstQueryType*
|
||||
dvdnavsrc_get_query_types (GstPad *pad);
|
||||
static const GstQueryType *dvdnavsrc_get_query_types (GstPad * pad);
|
||||
|
||||
static gboolean dvdnavsrc_close (DVDNavSrc * src);
|
||||
static gboolean dvdnavsrc_open (DVDNavSrc * src);
|
||||
static gboolean dvdnavsrc_is_open (DVDNavSrc * src);
|
||||
static void dvdnavsrc_print_event (DVDNavSrc *src, guint8 *data, int event, int len);
|
||||
static void dvdnavsrc_print_event (DVDNavSrc * src, guint8 * data, int event,
|
||||
int len);
|
||||
static void dvdnavsrc_update_streaminfo (DVDNavSrc * src);
|
||||
static void dvdnavsrc_update_buttoninfo (DVDNavSrc * src);
|
||||
static void dvdnavsrc_button_pressed (DVDNavSrc * src, int button);
|
||||
|
@ -175,7 +182,9 @@ dvdnavsrc_get_type (void)
|
|||
0,
|
||||
(GInstanceInitFunc) dvdnavsrc_init,
|
||||
};
|
||||
dvdnavsrc_type = g_type_register_static (GST_TYPE_ELEMENT, "DVDNavSrc", &dvdnavsrc_info, 0);
|
||||
dvdnavsrc_type =
|
||||
g_type_register_static (GST_TYPE_ELEMENT, "DVDNavSrc", &dvdnavsrc_info,
|
||||
0);
|
||||
|
||||
sector_format = gst_format_register ("sector", "DVD sector");
|
||||
title_format = gst_format_register ("title", "DVD title");
|
||||
|
@ -209,10 +218,7 @@ dvdnavsrc_class_init (DVDNavSrcClass *klass)
|
|||
G_TYPE_FROM_CLASS (klass),
|
||||
G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
|
||||
G_STRUCT_OFFSET (DVDNavSrcClass, button_pressed),
|
||||
NULL, NULL,
|
||||
gst_marshal_VOID__INT,
|
||||
G_TYPE_NONE, 1,
|
||||
G_TYPE_INT);
|
||||
NULL, NULL, gst_marshal_VOID__INT, G_TYPE_NONE, 1, G_TYPE_INT);
|
||||
|
||||
dvdnavsrc_signals[POINTER_SELECT_SIGNAL] =
|
||||
g_signal_new ("pointer-select",
|
||||
|
@ -220,9 +226,7 @@ dvdnavsrc_class_init (DVDNavSrcClass *klass)
|
|||
G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
|
||||
G_STRUCT_OFFSET (DVDNavSrcClass, pointer_select),
|
||||
NULL, NULL,
|
||||
gst_marshal_VOID__INT_INT,
|
||||
G_TYPE_NONE, 2,
|
||||
G_TYPE_INT, G_TYPE_INT);
|
||||
gst_marshal_VOID__INT_INT, G_TYPE_NONE, 2, G_TYPE_INT, G_TYPE_INT);
|
||||
|
||||
dvdnavsrc_signals[POINTER_ACTIVATE_SIGNAL] =
|
||||
g_signal_new ("pointer-activate",
|
||||
|
@ -230,19 +234,14 @@ dvdnavsrc_class_init (DVDNavSrcClass *klass)
|
|||
G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
|
||||
G_STRUCT_OFFSET (DVDNavSrcClass, pointer_activate),
|
||||
NULL, NULL,
|
||||
gst_marshal_VOID__INT_INT,
|
||||
G_TYPE_NONE, 2,
|
||||
G_TYPE_INT, G_TYPE_INT);
|
||||
gst_marshal_VOID__INT_INT, G_TYPE_NONE, 2, G_TYPE_INT, G_TYPE_INT);
|
||||
|
||||
dvdnavsrc_signals[USER_OP_SIGNAL] =
|
||||
g_signal_new ("user-op",
|
||||
G_TYPE_FROM_CLASS (klass),
|
||||
G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
|
||||
G_STRUCT_OFFSET (DVDNavSrcClass, user_op),
|
||||
NULL, NULL,
|
||||
gst_marshal_VOID__INT,
|
||||
G_TYPE_NONE, 1,
|
||||
G_TYPE_INT);
|
||||
NULL, NULL, gst_marshal_VOID__INT, G_TYPE_NONE, 1, G_TYPE_INT);
|
||||
|
||||
klass->button_pressed = dvdnavsrc_button_pressed;
|
||||
klass->pointer_select = dvdnavsrc_pointer_select;
|
||||
|
@ -262,8 +261,7 @@ dvdnavsrc_class_init (DVDNavSrcClass *klass)
|
|||
g_param_spec_int ("chapter", "chapter", "chapter",
|
||||
0, 99, 1, G_PARAM_READWRITE));
|
||||
g_object_class_install_property (gobject_class, ARG_ANGLE,
|
||||
g_param_spec_int("angle", "angle", "angle",
|
||||
1,9,1,G_PARAM_READWRITE));
|
||||
g_param_spec_int ("angle", "angle", "angle", 1, 9, 1, G_PARAM_READWRITE));
|
||||
g_object_class_install_property (gobject_class, ARG_STREAMINFO,
|
||||
g_param_spec_boxed ("streaminfo", "streaminfo", "streaminfo",
|
||||
GST_TYPE_CAPS, G_PARAM_READABLE));
|
||||
|
@ -312,7 +310,8 @@ dvdnavsrc_is_open (DVDNavSrc *src)
|
|||
}
|
||||
|
||||
static void
|
||||
dvdnavsrc_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec)
|
||||
dvdnavsrc_set_property (GObject * object, guint prop_id, const GValue * value,
|
||||
GParamSpec * pspec)
|
||||
{
|
||||
DVDNavSrc *src;
|
||||
|
||||
|
@ -354,7 +353,8 @@ dvdnavsrc_set_property (GObject *object, guint prop_id, const GValue *value, GPa
|
|||
}
|
||||
|
||||
static void
|
||||
dvdnavsrc_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
|
||||
dvdnavsrc_get_property (GObject * object, guint prop_id, GValue * value,
|
||||
GParamSpec * pspec)
|
||||
{
|
||||
DVDNavSrc *src;
|
||||
const char *title_string;
|
||||
|
@ -416,7 +416,8 @@ dvdnavsrc_tca_seek(DVDNavSrc *src, int title, int chapter, int angle)
|
|||
* Make sure our title number is valid.
|
||||
*/
|
||||
if (dvdnav_get_number_of_titles (src->dvdnav, &titles) != DVDNAV_STATUS_OK) {
|
||||
fprintf (stderr, "dvdnav_get_number_of_titles error: %s\n", dvdnav_err_to_string(src->dvdnav));
|
||||
fprintf (stderr, "dvdnav_get_number_of_titles error: %s\n",
|
||||
dvdnav_err_to_string (src->dvdnav));
|
||||
return FALSE;
|
||||
}
|
||||
fprintf (stderr, "There are %d titles on this DVD.\n", titles);
|
||||
|
@ -441,7 +442,8 @@ dvdnavsrc_tca_seek(DVDNavSrc *src, int title, int chapter, int angle)
|
|||
* Make sure the chapter number is valid for this title.
|
||||
*/
|
||||
if (dvdnav_get_number_of_titles (src->dvdnav, &programs) != DVDNAV_STATUS_OK) {
|
||||
fprintf( stderr, "dvdnav_get_number_of_programs error: %s\n", dvdnav_err_to_string(src->dvdnav));
|
||||
fprintf (stderr, "dvdnav_get_number_of_programs error: %s\n",
|
||||
dvdnav_err_to_string (src->dvdnav));
|
||||
return FALSE;
|
||||
}
|
||||
fprintf (stderr, "There are %d chapters in this title.\n", programs);
|
||||
|
@ -454,8 +456,10 @@ dvdnavsrc_tca_seek(DVDNavSrc *src, int title, int chapter, int angle)
|
|||
/**
|
||||
* Make sure the angle number is valid for this title.
|
||||
*/
|
||||
if (dvdnav_get_angle_info (src->dvdnav, &curangle, &angles) != DVDNAV_STATUS_OK) {
|
||||
fprintf (stderr, "dvdnav_get_angle_info error: %s\n", dvdnav_err_to_string(src->dvdnav));
|
||||
if (dvdnav_get_angle_info (src->dvdnav, &curangle,
|
||||
&angles) != DVDNAV_STATUS_OK) {
|
||||
fprintf (stderr, "dvdnav_get_angle_info error: %s\n",
|
||||
dvdnav_err_to_string (src->dvdnav));
|
||||
return FALSE;
|
||||
}
|
||||
fprintf (stderr, "There are %d angles in this title.\n", angles);
|
||||
|
@ -470,17 +474,20 @@ dvdnavsrc_tca_seek(DVDNavSrc *src, int title, int chapter, int angle)
|
|||
*/
|
||||
if (src->chapter == 0) {
|
||||
if (dvdnav_title_play (src->dvdnav, title) != DVDNAV_STATUS_OK) {
|
||||
fprintf (stderr, "dvdnav_title_play error: %s\n", dvdnav_err_to_string(src->dvdnav));
|
||||
fprintf (stderr, "dvdnav_title_play error: %s\n",
|
||||
dvdnav_err_to_string (src->dvdnav));
|
||||
return FALSE;
|
||||
}
|
||||
} else {
|
||||
if (dvdnav_part_play (src->dvdnav, title, chapter) != DVDNAV_STATUS_OK) {
|
||||
fprintf (stderr, "dvdnav_part_play error: %s\n", dvdnav_err_to_string(src->dvdnav));
|
||||
fprintf (stderr, "dvdnav_part_play error: %s\n",
|
||||
dvdnav_err_to_string (src->dvdnav));
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
if (dvdnav_angle_change (src->dvdnav, angle) != DVDNAV_STATUS_OK) {
|
||||
fprintf (stderr, "dvdnav_angle_change error: %s\n", dvdnav_err_to_string(src->dvdnav));
|
||||
fprintf (stderr, "dvdnav_angle_change error: %s\n",
|
||||
dvdnav_err_to_string (src->dvdnav));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -521,7 +528,8 @@ dvdnavsrc_update_streaminfo (DVDNavSrc *src)
|
|||
if (dvdnavsrc_query (src->srcpad, GST_QUERY_TOTAL, &chapter_format, &value)) {
|
||||
gst_caps_set_simple (caps, "chapters", G_TYPE_INT, value, NULL);
|
||||
}
|
||||
if (dvdnavsrc_query(src->srcpad, GST_QUERY_POSITION, &chapter_format, &value)) {
|
||||
if (dvdnavsrc_query (src->srcpad, GST_QUERY_POSITION, &chapter_format,
|
||||
&value)) {
|
||||
gst_caps_set_simple (caps, "chapter", G_TYPE_INT, value, NULL);
|
||||
}
|
||||
|
||||
|
@ -553,16 +561,13 @@ dvdnavsrc_update_buttoninfo (DVDNavSrc *src)
|
|||
/* Don't notify if there is no actual change */
|
||||
if (gst_structure_get_int (gst_caps_get_structure (src->buttoninfo, 0),
|
||||
"total", &btn_ns)
|
||||
&& (btn_ns == pci->hli.hl_gi.btn_ns))
|
||||
{
|
||||
&& (btn_ns == pci->hli.hl_gi.btn_ns)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
caps = gst_caps_new_simple (
|
||||
"application/x-gst-dvdnavsrc-buttoninfo",
|
||||
"total", G_TYPE_INT, (gint) pci->hli.hl_gi.btn_ns,
|
||||
NULL);
|
||||
caps = gst_caps_new_simple ("application/x-gst-dvdnavsrc-buttoninfo",
|
||||
"total", G_TYPE_INT, (gint) pci->hli.hl_gi.btn_ns, NULL);
|
||||
|
||||
if (src->buttoninfo)
|
||||
gst_caps_free (src->buttoninfo);
|
||||
|
@ -580,16 +585,14 @@ static void
|
|||
dvdnavsrc_pointer_select (DVDNavSrc * src, int x, int y)
|
||||
{
|
||||
dvdnav_mouse_select (src->dvdnav,
|
||||
dvdnav_get_current_nav_pci(src->dvdnav),
|
||||
x, y);
|
||||
dvdnav_get_current_nav_pci (src->dvdnav), x, y);
|
||||
}
|
||||
|
||||
static void
|
||||
dvdnavsrc_pointer_activate (DVDNavSrc * src, int x, int y)
|
||||
{
|
||||
dvdnav_mouse_activate (src->dvdnav,
|
||||
dvdnav_get_current_nav_pci(src->dvdnav),
|
||||
x, y);
|
||||
dvdnav_get_current_nav_pci (src->dvdnav), x, y);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -658,7 +661,8 @@ dvdnavsrc_user_op (DVDNavSrc *src, int op)
|
|||
}
|
||||
break;
|
||||
case 12: /* Menu - Subpicture */
|
||||
if (dvdnav_menu_call(src->dvdnav, DVD_MENU_Subpicture) != DVDNAV_STATUS_OK) {
|
||||
if (dvdnav_menu_call (src->dvdnav,
|
||||
DVD_MENU_Subpicture) != DVDNAV_STATUS_OK) {
|
||||
goto naverr;
|
||||
}
|
||||
break;
|
||||
|
@ -689,19 +693,45 @@ static gchar *
|
|||
dvdnav_get_event_name (int event)
|
||||
{
|
||||
switch (event) {
|
||||
case DVDNAV_BLOCK_OK: return "DVDNAV_BLOCK_OK"; break;
|
||||
case DVDNAV_NOP: return "DVDNAV_NOP"; break;
|
||||
case DVDNAV_STILL_FRAME: return "DVDNAV_STILL_FRAME"; break;
|
||||
case DVDNAV_SPU_STREAM_CHANGE: return "DVDNAV_SPU_STREAM_CHANGE"; break;
|
||||
case DVDNAV_AUDIO_STREAM_CHANGE: return "DVDNAV_AUDIO_STREAM_CHANGE"; break;
|
||||
case DVDNAV_VTS_CHANGE: return "DVDNAV_VTS_CHANGE"; break;
|
||||
case DVDNAV_CELL_CHANGE: return "DVDNAV_CELL_CHANGE"; break;
|
||||
case DVDNAV_NAV_PACKET: return "DVDNAV_NAV_PACKET"; break;
|
||||
case DVDNAV_STOP: return "DVDNAV_STOP"; break;
|
||||
case DVDNAV_HIGHLIGHT: return "DVDNAV_HIGHLIGHT"; break;
|
||||
case DVDNAV_SPU_CLUT_CHANGE: return "DVDNAV_SPU_CLUT_CHANGE"; break;
|
||||
case DVDNAV_HOP_CHANNEL: return "DVDNAV_HOP_CHANNEL"; break;
|
||||
case DVDNAV_WAIT: return "DVDNAV_WAIT"; break;
|
||||
case DVDNAV_BLOCK_OK:
|
||||
return "DVDNAV_BLOCK_OK";
|
||||
break;
|
||||
case DVDNAV_NOP:
|
||||
return "DVDNAV_NOP";
|
||||
break;
|
||||
case DVDNAV_STILL_FRAME:
|
||||
return "DVDNAV_STILL_FRAME";
|
||||
break;
|
||||
case DVDNAV_SPU_STREAM_CHANGE:
|
||||
return "DVDNAV_SPU_STREAM_CHANGE";
|
||||
break;
|
||||
case DVDNAV_AUDIO_STREAM_CHANGE:
|
||||
return "DVDNAV_AUDIO_STREAM_CHANGE";
|
||||
break;
|
||||
case DVDNAV_VTS_CHANGE:
|
||||
return "DVDNAV_VTS_CHANGE";
|
||||
break;
|
||||
case DVDNAV_CELL_CHANGE:
|
||||
return "DVDNAV_CELL_CHANGE";
|
||||
break;
|
||||
case DVDNAV_NAV_PACKET:
|
||||
return "DVDNAV_NAV_PACKET";
|
||||
break;
|
||||
case DVDNAV_STOP:
|
||||
return "DVDNAV_STOP";
|
||||
break;
|
||||
case DVDNAV_HIGHLIGHT:
|
||||
return "DVDNAV_HIGHLIGHT";
|
||||
break;
|
||||
case DVDNAV_SPU_CLUT_CHANGE:
|
||||
return "DVDNAV_SPU_CLUT_CHANGE";
|
||||
break;
|
||||
case DVDNAV_HOP_CHANNEL:
|
||||
return "DVDNAV_HOP_CHANNEL";
|
||||
break;
|
||||
case DVDNAV_WAIT:
|
||||
return "DVDNAV_WAIT";
|
||||
break;
|
||||
}
|
||||
return "UNKNOWN";
|
||||
}
|
||||
|
@ -710,10 +740,18 @@ static gchar *
|
|||
dvdnav_get_read_domain_name (dvd_read_domain_t domain)
|
||||
{
|
||||
switch (domain) {
|
||||
case DVD_READ_INFO_FILE: return "DVD_READ_INFO_FILE"; break;
|
||||
case DVD_READ_INFO_BACKUP_FILE: return "DVD_READ_INFO_BACKUP_FILE"; break;
|
||||
case DVD_READ_MENU_VOBS: return "DVD_READ_MENU_VOBS"; break;
|
||||
case DVD_READ_TITLE_VOBS: return "DVD_READ_TITLE_VOBS"; break;
|
||||
case DVD_READ_INFO_FILE:
|
||||
return "DVD_READ_INFO_FILE";
|
||||
break;
|
||||
case DVD_READ_INFO_BACKUP_FILE:
|
||||
return "DVD_READ_INFO_BACKUP_FILE";
|
||||
break;
|
||||
case DVD_READ_MENU_VOBS:
|
||||
return "DVD_READ_MENU_VOBS";
|
||||
break;
|
||||
case DVD_READ_TITLE_VOBS:
|
||||
return "DVD_READ_TITLE_VOBS";
|
||||
break;
|
||||
}
|
||||
return "UNKNOWN";
|
||||
}
|
||||
|
@ -724,7 +762,8 @@ dvdnavsrc_print_event (DVDNavSrc *src, guint8 *data, int event, int len)
|
|||
g_return_if_fail (src != NULL);
|
||||
g_return_if_fail (GST_IS_DVDNAVSRC (src));
|
||||
|
||||
fprintf (stderr, "dvdnavsrc (%p): event: %s\n", src, dvdnav_get_event_name(event));
|
||||
fprintf (stderr, "dvdnavsrc (%p): event: %s\n", src,
|
||||
dvdnav_get_event_name (event));
|
||||
switch (event) {
|
||||
case DVDNAV_BLOCK_OK:
|
||||
break;
|
||||
|
@ -733,12 +772,14 @@ dvdnavsrc_print_event (DVDNavSrc *src, guint8 *data, int event, int len)
|
|||
case DVDNAV_STILL_FRAME:
|
||||
{
|
||||
dvdnav_still_event_t *event = (dvdnav_still_event_t *) data;
|
||||
|
||||
fprintf (stderr, " still frame: %d seconds\n", event->length);
|
||||
}
|
||||
break;
|
||||
case DVDNAV_SPU_STREAM_CHANGE:
|
||||
{
|
||||
dvdnav_spu_stream_change_event_t * event = (dvdnav_spu_stream_change_event_t *)data;
|
||||
dvdnav_spu_stream_change_event_t *event =
|
||||
(dvdnav_spu_stream_change_event_t *) data;
|
||||
fprintf (stderr, " physical_wide: %d\n", event->physical_wide);
|
||||
fprintf (stderr, " physical_letterbox: %d\n", event->physical_letterbox);
|
||||
fprintf (stderr, " physical_pan_scan: %d\n", event->physical_pan_scan);
|
||||
|
@ -747,7 +788,8 @@ dvdnavsrc_print_event (DVDNavSrc *src, guint8 *data, int event, int len)
|
|||
break;
|
||||
case DVDNAV_AUDIO_STREAM_CHANGE:
|
||||
{
|
||||
dvdnav_audio_stream_change_event_t * event = (dvdnav_audio_stream_change_event_t *)data;
|
||||
dvdnav_audio_stream_change_event_t *event =
|
||||
(dvdnav_audio_stream_change_event_t *) data;
|
||||
fprintf (stderr, " physical: %d\n", event->physical);
|
||||
fprintf (stderr, " logical: %d\n", event->logical);
|
||||
}
|
||||
|
@ -755,10 +797,13 @@ dvdnavsrc_print_event (DVDNavSrc *src, guint8 *data, int event, int len)
|
|||
case DVDNAV_VTS_CHANGE:
|
||||
{
|
||||
dvdnav_vts_change_event_t *event = (dvdnav_vts_change_event_t *) data;
|
||||
|
||||
fprintf (stderr, " old_vtsN: %d\n", event->old_vtsN);
|
||||
fprintf (stderr, " old_domain: %s\n", dvdnav_get_read_domain_name(event->old_domain));
|
||||
fprintf (stderr, " old_domain: %s\n",
|
||||
dvdnav_get_read_domain_name (event->old_domain));
|
||||
fprintf (stderr, " new_vtsN: %d\n", event->new_vtsN);
|
||||
fprintf (stderr, " new_domain: %s\n", dvdnav_get_read_domain_name(event->new_domain));
|
||||
fprintf (stderr, " new_domain: %s\n",
|
||||
dvdnav_get_read_domain_name (event->new_domain));
|
||||
}
|
||||
break;
|
||||
case DVDNAV_CELL_CHANGE:
|
||||
|
@ -793,12 +838,15 @@ dvdnavsrc_print_event (DVDNavSrc *src, guint8 *data, int event, int len)
|
|||
case DVDNAV_HIGHLIGHT:
|
||||
{
|
||||
dvdnav_highlight_event_t *event = (dvdnav_highlight_event_t *) data;
|
||||
|
||||
fprintf (stderr, " display: %s\n",
|
||||
event->display == 0 ? "hide" : (event->display == 1 ? "show" : "unknown")
|
||||
event->display == 0 ? "hide" : (event->display ==
|
||||
1 ? "show" : "unknown")
|
||||
);
|
||||
if (event->display == 1) {
|
||||
fprintf (stderr, " palette: %08x\n", event->palette);
|
||||
fprintf (stderr, " coords (%u, %u) - (%u, %u)\n", event->sx, event->sy, event->ex, event->ey);
|
||||
fprintf (stderr, " coords (%u, %u) - (%u, %u)\n", event->sx, event->sy,
|
||||
event->ex, event->ey);
|
||||
fprintf (stderr, " pts: %u\n", event->pts);
|
||||
fprintf (stderr, " button: %u\n", event->buttonN);
|
||||
}
|
||||
|
@ -851,7 +899,8 @@ dvdnavsrc_get (GstPad *pad)
|
|||
while (!have_buf) {
|
||||
buf = gst_buffer_new_and_alloc (DVD_VIDEO_LB_LEN);
|
||||
if (!buf) {
|
||||
GST_ELEMENT_ERROR (src, CORE, TOO_LAZY, (NULL), ("Failed to create a new GstBuffer"));
|
||||
GST_ELEMENT_ERROR (src, CORE, TOO_LAZY, (NULL),
|
||||
("Failed to create a new GstBuffer"));
|
||||
return NULL;
|
||||
}
|
||||
data = GST_BUFFER_DATA (buf);
|
||||
|
@ -859,7 +908,8 @@ dvdnavsrc_get (GstPad *pad)
|
|||
if (dvdnav_get_next_block (src->dvdnav, data, &event, &len) !=
|
||||
DVDNAV_STATUS_OK) {
|
||||
GST_ELEMENT_ERROR (src, STREAM, DECODE, (NULL),
|
||||
("dvdnav_get_next_block error: %s\n", dvdnav_err_to_string(src->dvdnav)));
|
||||
("dvdnav_get_next_block error: %s\n",
|
||||
dvdnav_err_to_string (src->dvdnav)));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -876,7 +926,8 @@ dvdnavsrc_get (GstPad *pad)
|
|||
* dvdnav_still_skip */
|
||||
dvdnavsrc_print_event (src, data, event, len);
|
||||
if (dvdnav_still_skip (src->dvdnav) != DVDNAV_STATUS_OK) {
|
||||
GST_ELEMENT_ERROR (src, STREAM, TOO_LAZY, (NULL), ("dvdnav_still_skip error: %s\n",
|
||||
GST_ELEMENT_ERROR (src, STREAM, TOO_LAZY, (NULL),
|
||||
("dvdnav_still_skip error: %s\n",
|
||||
dvdnav_err_to_string (src->dvdnav)));
|
||||
/* FIXME: close the stream??? */
|
||||
}
|
||||
|
@ -942,7 +993,8 @@ dvdnavsrc_open (DVDNavSrc *src)
|
|||
g_return_val_if_fail (src->location != NULL, FALSE);
|
||||
|
||||
if (dvdnav_open (&src->dvdnav, (char *) src->location) != DVDNAV_STATUS_OK) {
|
||||
fprintf( stderr, "dvdnav_open error: %s location: %s\n", dvdnav_err_to_string(src->dvdnav), src->location);
|
||||
fprintf (stderr, "dvdnav_open error: %s location: %s\n",
|
||||
dvdnav_err_to_string (src->dvdnav), src->location);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -967,9 +1019,12 @@ dvdnavsrc_open (DVDNavSrc *src)
|
|||
if (src->title > 0) {
|
||||
unsigned char buf[2048];
|
||||
int event, buflen = sizeof (buf);
|
||||
|
||||
fprintf (stderr, "+XXX\n");
|
||||
if (dvdnav_get_next_block(src->dvdnav, buf, &event, &buflen) != DVDNAV_STATUS_OK) {
|
||||
fprintf(stderr, "pre seek dvdnav_get_next_block error: %s\n", dvdnav_err_to_string(src->dvdnav));
|
||||
if (dvdnav_get_next_block (src->dvdnav, buf, &event,
|
||||
&buflen) != DVDNAV_STATUS_OK) {
|
||||
fprintf (stderr, "pre seek dvdnav_get_next_block error: %s\n",
|
||||
dvdnav_err_to_string (src->dvdnav));
|
||||
return FALSE;
|
||||
}
|
||||
dvdnavsrc_print_event (src, buf, event, buflen);
|
||||
|
@ -979,13 +1034,11 @@ dvdnavsrc_open (DVDNavSrc *src)
|
|||
dvdnavsrc_print_event (src, buf, event, buflen);
|
||||
}
|
||||
*/
|
||||
fprintf(stderr, "pre seek dvdnav_get_next_block error: %s\n", dvdnav_err_to_string(src->dvdnav));
|
||||
fprintf (stderr, "pre seek dvdnav_get_next_block error: %s\n",
|
||||
dvdnav_err_to_string (src->dvdnav));
|
||||
fprintf (stderr, "-XXX\n");
|
||||
|
||||
if (!dvdnavsrc_tca_seek(src,
|
||||
src->title,
|
||||
src->chapter,
|
||||
src->angle))
|
||||
if (!dvdnavsrc_tca_seek (src, src->title, src->chapter, src->angle))
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -1059,9 +1112,7 @@ dvdnavsrc_get_event_mask (GstPad *pad)
|
|||
{
|
||||
static const GstEventMask masks[] = {
|
||||
{GST_EVENT_SEEK, GST_SEEK_METHOD_SET |
|
||||
GST_SEEK_METHOD_CUR |
|
||||
GST_SEEK_METHOD_END |
|
||||
GST_SEEK_FLAG_FLUSH },
|
||||
GST_SEEK_METHOD_CUR | GST_SEEK_METHOD_END | GST_SEEK_FLAG_FLUSH},
|
||||
/*
|
||||
{GST_EVENT_SEEK_SEGMENT, GST_SEEK_METHOD_SET |
|
||||
GST_SEEK_METHOD_CUR |
|
||||
|
@ -1083,24 +1134,19 @@ dvdnav_handle_navigation_event (DVDNavSrc *src, GstEvent *event)
|
|||
|
||||
g_return_val_if_fail (event != NULL, FALSE);
|
||||
|
||||
if (strcmp (event_type, "key-press") == 0)
|
||||
{
|
||||
if (strcmp (event_type, "key-press") == 0) {
|
||||
const char *key = gst_structure_get_string (structure, "key");
|
||||
|
||||
g_assert (key != NULL);
|
||||
g_print ("dvdnavsrc got a keypress: %s\n", key);
|
||||
}
|
||||
else if (strcmp (event_type, "mouse-move") == 0)
|
||||
{
|
||||
} else if (strcmp (event_type, "mouse-move") == 0) {
|
||||
double x, y;
|
||||
|
||||
gst_structure_get_double (structure, "pointer_x", &x);
|
||||
gst_structure_get_double (structure, "pointer_y", &y);
|
||||
|
||||
dvdnavsrc_pointer_select (src, (int) x, (int) y);
|
||||
}
|
||||
else if (strcmp (event_type, "mouse-button-release") == 0)
|
||||
{
|
||||
} else if (strcmp (event_type, "mouse-button-release") == 0) {
|
||||
double x, y;
|
||||
|
||||
gst_structure_get_double (structure, "pointer_x", &x);
|
||||
|
@ -1178,8 +1224,7 @@ dvdnavsrc_event (GstPad *pad, GstEvent *event)
|
|||
default:
|
||||
goto error;
|
||||
}
|
||||
if (dvdnav_title_play(src->dvdnav, new_title) !=
|
||||
DVDNAV_STATUS_OK) {
|
||||
if (dvdnav_title_play (src->dvdnav, new_title) != DVDNAV_STATUS_OK) {
|
||||
goto error;
|
||||
}
|
||||
} else if (format == chapter_format) {
|
||||
|
@ -1311,16 +1356,15 @@ dvdnavsrc_convert (GstPad *pad,
|
|||
break;
|
||||
default:
|
||||
if (*dest_format == track_format || *dest_format == sector_format) {
|
||||
gint sector = (src_value * 44100) / ((CD_FRAMESIZE_RAW >> 2) * GST_SECOND);
|
||||
gint sector =
|
||||
(src_value * 44100) / ((CD_FRAMESIZE_RAW >> 2) * GST_SECOND);
|
||||
|
||||
if (*dest_format == sector_format) {
|
||||
*dest_value = sector;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
*dest_value = cdda_sector_gettrack (src->d, sector) - 1;
|
||||
}
|
||||
}
|
||||
else
|
||||
} else
|
||||
return FALSE;
|
||||
break;
|
||||
}
|
||||
|
@ -1341,12 +1385,10 @@ dvdnavsrc_convert (GstPad *pad,
|
|||
|
||||
if (*dest_format == track_format) {
|
||||
*dest_value = cdda_sector_gettrack (src->d, sector) - 1;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
*dest_value = sector;
|
||||
}
|
||||
}
|
||||
else
|
||||
} else
|
||||
return FALSE;
|
||||
break;
|
||||
}
|
||||
|
@ -1361,11 +1403,9 @@ dvdnavsrc_convert (GstPad *pad,
|
|||
return FALSE;
|
||||
|
||||
sector = cdda_track_firstsector (src->d, src_value + 1);
|
||||
}
|
||||
else if (src_format == sector_format) {
|
||||
} else if (src_format == sector_format) {
|
||||
sector = src_value;
|
||||
}
|
||||
else
|
||||
} else
|
||||
return FALSE;
|
||||
|
||||
switch (*dest_format) {
|
||||
|
@ -1380,15 +1420,13 @@ dvdnavsrc_convert (GstPad *pad,
|
|||
default:
|
||||
if (*dest_format == sector_format) {
|
||||
*dest_value = sector;
|
||||
}
|
||||
else if (*dest_format == track_format) {
|
||||
} else if (*dest_format == track_format) {
|
||||
/* if we go past the last sector, make sure to report the last track */
|
||||
if (sector > src->last_sector)
|
||||
*dest_value = cdda_sector_gettrack (src->d, src->last_sector);
|
||||
else
|
||||
*dest_value = cdda_sector_gettrack (src->d, sector) - 1;
|
||||
}
|
||||
else
|
||||
} else
|
||||
return FALSE;
|
||||
break;
|
||||
}
|
||||
|
@ -1435,17 +1473,20 @@ dvdnavsrc_query (GstPad *pad, GstQueryType type,
|
|||
}
|
||||
*value = len;
|
||||
} else if (*format == title_format) {
|
||||
if (dvdnav_get_number_of_titles(src->dvdnav, &titles) != DVDNAV_STATUS_OK) {
|
||||
if (dvdnav_get_number_of_titles (src->dvdnav,
|
||||
&titles) != DVDNAV_STATUS_OK) {
|
||||
res = FALSE;
|
||||
}
|
||||
*value = titles;
|
||||
} else if (*format == chapter_format) {
|
||||
if (dvdnav_get_number_of_titles(src->dvdnav, &parts) != DVDNAV_STATUS_OK) {
|
||||
if (dvdnav_get_number_of_titles (src->dvdnav,
|
||||
&parts) != DVDNAV_STATUS_OK) {
|
||||
res = FALSE;
|
||||
}
|
||||
*value = parts;
|
||||
} else if (*format == angle_format) {
|
||||
if (dvdnav_get_angle_info(src->dvdnav, &angle, &angles) != DVDNAV_STATUS_OK) {
|
||||
if (dvdnav_get_angle_info (src->dvdnav, &angle,
|
||||
&angles) != DVDNAV_STATUS_OK) {
|
||||
res = FALSE;
|
||||
}
|
||||
*value = angles;
|
||||
|
@ -1460,17 +1501,20 @@ dvdnavsrc_query (GstPad *pad, GstQueryType type,
|
|||
}
|
||||
*value = pos;
|
||||
} else if (*format == title_format) {
|
||||
if (dvdnav_current_title_info(src->dvdnav, &title, &part) != DVDNAV_STATUS_OK) {
|
||||
if (dvdnav_current_title_info (src->dvdnav, &title,
|
||||
&part) != DVDNAV_STATUS_OK) {
|
||||
res = FALSE;
|
||||
}
|
||||
*value = title;
|
||||
} else if (*format == chapter_format) {
|
||||
if (dvdnav_current_title_info(src->dvdnav, &title, &part) != DVDNAV_STATUS_OK) {
|
||||
if (dvdnav_current_title_info (src->dvdnav, &title,
|
||||
&part) != DVDNAV_STATUS_OK) {
|
||||
res = FALSE;
|
||||
}
|
||||
*value = part;
|
||||
} else if (*format == angle_format) {
|
||||
if (dvdnav_get_angle_info(src->dvdnav, &angle, &angles) != DVDNAV_STATUS_OK) {
|
||||
if (dvdnav_get_angle_info (src->dvdnav, &angle,
|
||||
&angles) != DVDNAV_STATUS_OK) {
|
||||
res = FALSE;
|
||||
}
|
||||
*value = angle;
|
||||
|
@ -1488,19 +1532,15 @@ dvdnavsrc_query (GstPad *pad, GstQueryType type,
|
|||
static gboolean
|
||||
plugin_init (GstPlugin * plugin)
|
||||
{
|
||||
if (!gst_element_register (plugin, "dvdnavsrc", GST_RANK_NONE, GST_TYPE_DVDNAVSRC))
|
||||
if (!gst_element_register (plugin, "dvdnavsrc", GST_RANK_NONE,
|
||||
GST_TYPE_DVDNAVSRC))
|
||||
return FALSE;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
GST_PLUGIN_DEFINE (
|
||||
GST_VERSION_MAJOR,
|
||||
GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
|
||||
GST_VERSION_MINOR,
|
||||
"dvdnavsrc",
|
||||
"Access a DVD with navigation features using libdvdnav",
|
||||
plugin_init,
|
||||
VERSION,
|
||||
"GPL",
|
||||
GST_PACKAGE,
|
||||
GST_ORIGIN)
|
||||
plugin_init, VERSION, "GPL", GST_PACKAGE, GST_ORIGIN)
|
||||
|
|
|
@ -6,17 +6,23 @@ GstElement *v_queue, *a_queue, *v_thread, *a_thread;
|
|||
GtkWidget *appwindow;
|
||||
GtkWidget *gtk_socket;
|
||||
|
||||
void eof(GstElement *src) {
|
||||
void
|
||||
eof (GstElement * src)
|
||||
{
|
||||
g_print ("have eos, quitting\n");
|
||||
exit (0);
|
||||
}
|
||||
|
||||
gboolean idle_func(gpointer data) {
|
||||
gboolean
|
||||
idle_func (gpointer data)
|
||||
{
|
||||
gst_bin_iterate (GST_BIN (data));
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void mpeg2parse_newpad(GstElement *parser,GstPad *pad, GstElement *pipeline) {
|
||||
void
|
||||
mpeg2parse_newpad (GstElement * parser, GstPad * pad, GstElement * pipeline)
|
||||
{
|
||||
|
||||
g_print ("***** a new pad %s was created\n", gst_pad_get_name (pad));
|
||||
|
||||
|
@ -31,12 +37,16 @@ void mpeg2parse_newpad(GstElement *parser,GstPad *pad, GstElement *pipeline) {
|
|||
}
|
||||
}
|
||||
|
||||
void mpeg2parse_have_size(GstElement *videosink,gint width,gint height) {
|
||||
void
|
||||
mpeg2parse_have_size (GstElement * videosink, gint width, gint height)
|
||||
{
|
||||
gtk_widget_set_usize (gtk_socket, width, height);
|
||||
gtk_widget_show_all (appwindow);
|
||||
}
|
||||
|
||||
int main(int argc,char *argv[]) {
|
||||
int
|
||||
main (int argc, char *argv[])
|
||||
{
|
||||
GstElement *src, *parse;
|
||||
GstElement *v_decode, *show, *color;
|
||||
GstElement *a_decode, *osssink;
|
||||
|
@ -123,16 +133,17 @@ int main(int argc,char *argv[]) {
|
|||
gtk_socket = gtk_socket_new ();
|
||||
gtk_widget_show (gtk_socket);
|
||||
|
||||
gnome_app_set_contents(GNOME_APP(appwindow),
|
||||
GTK_WIDGET(gtk_socket));
|
||||
gnome_app_set_contents (GNOME_APP (appwindow), GTK_WIDGET (gtk_socket));
|
||||
|
||||
gtk_widget_realize (gtk_socket);
|
||||
gtk_socket_steal (GTK_SOCKET (gtk_socket),
|
||||
gst_util_get_int_arg (GTK_OBJECT (show), "xid"));
|
||||
|
||||
gtk_signal_connect(GTK_OBJECT(parse),"new_pad",mpeg2parse_newpad, pipeline);
|
||||
gtk_signal_connect (GTK_OBJECT (parse), "new_pad", mpeg2parse_newpad,
|
||||
pipeline);
|
||||
gtk_signal_connect (GTK_OBJECT (src), "eos", GTK_SIGNAL_FUNC (eof), NULL);
|
||||
gtk_signal_connect(GTK_OBJECT(show),"have_size",mpeg2parse_have_size, pipeline);
|
||||
gtk_signal_connect (GTK_OBJECT (show), "have_size", mpeg2parse_have_size,
|
||||
pipeline);
|
||||
|
||||
g_print ("setting to PLAYING state\n");
|
||||
gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_PLAYING);
|
||||
|
|
|
@ -62,7 +62,8 @@
|
|||
#include <dvdread/nav_read.h>
|
||||
#include <dvdread/nav_print.h>
|
||||
|
||||
struct _DVDReadSrcPrivate {
|
||||
struct _DVDReadSrcPrivate
|
||||
{
|
||||
GstElement element;
|
||||
/* pads */
|
||||
GstPad *srcpad;
|
||||
|
@ -94,12 +95,14 @@ GstElementDetails dvdreadsrc_details = {
|
|||
|
||||
|
||||
/* DVDReadSrc signals and args */
|
||||
enum {
|
||||
enum
|
||||
{
|
||||
/* FILL ME */
|
||||
LAST_SIGNAL
|
||||
};
|
||||
|
||||
enum {
|
||||
enum
|
||||
{
|
||||
ARG_0,
|
||||
ARG_LOCATION,
|
||||
ARG_TITLE,
|
||||
|
@ -111,17 +114,21 @@ static void dvdreadsrc_base_init (gpointer g_class);
|
|||
static void dvdreadsrc_class_init (DVDReadSrcClass * klass);
|
||||
static void dvdreadsrc_init (DVDReadSrc * dvdreadsrc);
|
||||
|
||||
static void dvdreadsrc_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec);
|
||||
static void dvdreadsrc_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec);
|
||||
static void dvdreadsrc_set_property (GObject * object, guint prop_id,
|
||||
const GValue * value, GParamSpec * pspec);
|
||||
static void dvdreadsrc_get_property (GObject * object, guint prop_id,
|
||||
GValue * value, GParamSpec * pspec);
|
||||
|
||||
/*static GstData * dvdreadsrc_get (GstPad *pad); */
|
||||
static void dvdreadsrc_loop (GstElement * element);
|
||||
|
||||
/*static GstBuffer * dvdreadsrc_get_region (GstPad *pad,gulong offset,gulong size); */
|
||||
|
||||
static GstElementStateReturn dvdreadsrc_change_state (GstElement * element);
|
||||
|
||||
|
||||
static GstElementClass *parent_class = NULL;
|
||||
|
||||
/*static guint dvdreadsrc_signals[LAST_SIGNAL] = { 0 }; */
|
||||
|
||||
GType
|
||||
|
@ -141,7 +148,9 @@ dvdreadsrc_get_type (void)
|
|||
0,
|
||||
(GInstanceInitFunc) dvdreadsrc_init,
|
||||
};
|
||||
dvdreadsrc_type = g_type_register_static (GST_TYPE_ELEMENT, "DVDReadSrc", &dvdreadsrc_info, 0);
|
||||
dvdreadsrc_type =
|
||||
g_type_register_static (GST_TYPE_ELEMENT, "DVDReadSrc",
|
||||
&dvdreadsrc_info, 0);
|
||||
}
|
||||
return dvdreadsrc_type;
|
||||
}
|
||||
|
@ -190,7 +199,8 @@ dvdreadsrc_init (DVDReadSrc *dvdreadsrc)
|
|||
dvdreadsrc->priv = g_new (DVDReadSrcPrivate, 1);
|
||||
dvdreadsrc->priv->srcpad = gst_pad_new ("src", GST_PAD_SRC);
|
||||
gst_element_add_pad (GST_ELEMENT (dvdreadsrc), dvdreadsrc->priv->srcpad);
|
||||
gst_element_set_loop_function (GST_ELEMENT(dvdreadsrc), GST_DEBUG_FUNCPTR(dvdreadsrc_loop));
|
||||
gst_element_set_loop_function (GST_ELEMENT (dvdreadsrc),
|
||||
GST_DEBUG_FUNCPTR (dvdreadsrc_loop));
|
||||
|
||||
dvdreadsrc->priv->location = g_strdup ("/dev/dvd");
|
||||
dvdreadsrc->priv->new_seek = FALSE;
|
||||
|
@ -211,7 +221,8 @@ dvdreadsrc_destroy (DVDReadSrc *dvdreadsrc)
|
|||
#endif
|
||||
|
||||
static void
|
||||
dvdreadsrc_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec)
|
||||
dvdreadsrc_set_property (GObject * object, guint prop_id, const GValue * value,
|
||||
GParamSpec * pspec)
|
||||
{
|
||||
DVDReadSrc *src;
|
||||
DVDReadSrcPrivate *priv;
|
||||
|
@ -255,7 +266,8 @@ dvdreadsrc_set_property (GObject *object, guint prop_id, const GValue *value, GP
|
|||
}
|
||||
|
||||
static void
|
||||
dvdreadsrc_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
|
||||
dvdreadsrc_get_property (GObject * object, guint prop_id, GValue * value,
|
||||
GParamSpec * pspec)
|
||||
{
|
||||
DVDReadSrc *src;
|
||||
DVDReadSrcPrivate *priv;
|
||||
|
@ -383,7 +395,8 @@ _seek(DVDReadSrcPrivate *priv, int title, int chapter, int angle)
|
|||
/**
|
||||
* Load the VTS information for the title set our title is in.
|
||||
*/
|
||||
priv->vts_file = ifoOpen( priv->dvd, priv->tt_srpt->title[ title ].title_set_nr );
|
||||
priv->vts_file =
|
||||
ifoOpen (priv->dvd, priv->tt_srpt->title[title].title_set_nr);
|
||||
if (!priv->vts_file) {
|
||||
fprintf (stderr, "Can't open the title %d info file.\n",
|
||||
priv->tt_srpt->title[title].title_set_nr);
|
||||
|
@ -408,7 +421,8 @@ _seek(DVDReadSrcPrivate *priv, int title, int chapter, int angle)
|
|||
/**
|
||||
* We've got enough info, time to open the title set data.
|
||||
*/
|
||||
priv->dvd_title = DVDOpenFile( priv->dvd, priv->tt_srpt->title[ title ].title_set_nr,
|
||||
priv->dvd_title =
|
||||
DVDOpenFile (priv->dvd, priv->tt_srpt->title[title].title_set_nr,
|
||||
DVD_READ_TITLE_VOBS);
|
||||
if (!priv->dvd_title) {
|
||||
fprintf (stderr, "Can't open title VOBS (VTS_%02d_1.VOB).\n",
|
||||
|
@ -439,7 +453,8 @@ dvdreadsrc_loop (GstElement *element)
|
|||
* Playback by cell in this pgc, starting at the cell for our chapter.
|
||||
*/
|
||||
priv->next_cell = priv->start_cell;
|
||||
for( priv->cur_cell = priv->start_cell; priv->next_cell < priv->cur_pgc->nr_of_cells; ) {
|
||||
for (priv->cur_cell = priv->start_cell;
|
||||
priv->next_cell < priv->cur_pgc->nr_of_cells;) {
|
||||
|
||||
priv->cur_cell = priv->next_cell;
|
||||
|
||||
|
@ -464,8 +479,10 @@ dvdreadsrc_loop (GstElement *element)
|
|||
/**
|
||||
* We loop until we're out of this cell.
|
||||
*/
|
||||
for( priv->cur_pack = priv->cur_pgc->cell_playback[ priv->cur_cell ].first_sector;
|
||||
priv->cur_pack < priv->cur_pgc->cell_playback[ priv->cur_cell ].last_sector; ) {
|
||||
for (priv->cur_pack =
|
||||
priv->cur_pgc->cell_playback[priv->cur_cell].first_sector;
|
||||
priv->cur_pack <
|
||||
priv->cur_pgc->cell_playback[priv->cur_cell].last_sector;) {
|
||||
|
||||
dsi_t dsi_pack;
|
||||
unsigned int next_vobu, next_ilvu_start, cur_output_size;
|
||||
|
@ -525,8 +542,7 @@ dvdreadsrc_loop (GstElement *element)
|
|||
* force the code above to go to the next cell in the program.
|
||||
*/
|
||||
if (dsi_pack.vobu_sri.next_vobu != SRI_END_OF_CELL) {
|
||||
next_vobu = priv->cur_pack
|
||||
+ ( dsi_pack.vobu_sri.next_vobu & 0x7fffffff );
|
||||
next_vobu = priv->cur_pack + (dsi_pack.vobu_sri.next_vobu & 0x7fffffff);
|
||||
} else {
|
||||
next_vobu = priv->cur_pack + cur_output_size + 1;
|
||||
}
|
||||
|
@ -595,11 +611,13 @@ _read(DVDReadSrcPrivate *priv, int angle, int new_seek, GstBuffer *buf)
|
|||
* We loop until we're out of this cell.
|
||||
*/
|
||||
if (priv->new_cell) {
|
||||
priv->cur_pack = priv->cur_pgc->cell_playback[ priv->cur_cell ].first_sector;
|
||||
priv->cur_pack =
|
||||
priv->cur_pgc->cell_playback[priv->cur_cell].first_sector;
|
||||
priv->new_cell = FALSE;
|
||||
}
|
||||
|
||||
if (priv->cur_pack < priv->cur_pgc->cell_playback[ priv->cur_cell ].last_sector; ) {
|
||||
if (priv->cur_pack <
|
||||
priv->cur_pgc->cell_playback[priv->cur_cell].last_sector;) {
|
||||
|
||||
dsi_t dsi_pack;
|
||||
unsigned int next_vobu, next_ilvu_start, cur_output_size;
|
||||
|
@ -629,8 +647,7 @@ _read(DVDReadSrcPrivate *priv, int angle, int new_seek, GstBuffer *buf)
|
|||
* Determine where we go next. These values are the ones we mostly
|
||||
* care about.
|
||||
*/
|
||||
next_ilvu_start = priv->cur_pack
|
||||
+ dsi_pack.sml_agli.data[ angle ].address;
|
||||
next_ilvu_start = priv->cur_pack + dsi_pack.sml_agli.data[angle].address;
|
||||
cur_output_size = dsi_pack.dsi_gi.vobu_ea;
|
||||
|
||||
|
||||
|
@ -645,8 +662,7 @@ _read(DVDReadSrcPrivate *priv, int angle, int new_seek, GstBuffer *buf)
|
|||
* force the code above to go to the next cell in the program.
|
||||
*/
|
||||
if (dsi_pack.vobu_sri.next_vobu != SRI_END_OF_CELL) {
|
||||
next_vobu = priv->cur_pack
|
||||
+ ( dsi_pack.vobu_sri.next_vobu & 0x7fffffff );
|
||||
next_vobu = priv->cur_pack + (dsi_pack.vobu_sri.next_vobu & 0x7fffffff);
|
||||
} else {
|
||||
next_vobu = priv->cur_pack + cur_output_size + 1;
|
||||
}
|
||||
|
@ -657,8 +673,7 @@ _read(DVDReadSrcPrivate *priv, int angle, int new_seek, GstBuffer *buf)
|
|||
/**
|
||||
* Read in and output cursize packs.
|
||||
*/
|
||||
len = DVDReadBlocks( priv->title, priv->cur_pack,
|
||||
cur_output_size, data );
|
||||
len = DVDReadBlocks (priv->title, priv->cur_pack, cur_output_size, data);
|
||||
if (len != cur_output_size) {
|
||||
fprintf (stderr, "Read failed for %d blocks at %d\n",
|
||||
cur_output_size, priv->cur_pack);
|
||||
|
@ -727,10 +742,7 @@ dvdreadsrc_open_file (DVDReadSrc *src)
|
|||
|
||||
if (_open (src->priv, src->priv->location))
|
||||
return FALSE;
|
||||
if (_seek(src->priv,
|
||||
src->priv->title,
|
||||
src->priv->chapter,
|
||||
src->priv->angle))
|
||||
if (_seek (src->priv, src->priv->title, src->priv->chapter, src->priv->angle))
|
||||
return FALSE;
|
||||
|
||||
GST_FLAG_SET (src, DVDREADSRC_OPEN);
|
||||
|
@ -778,20 +790,15 @@ dvdreadsrc_change_state (GstElement *element)
|
|||
static gboolean
|
||||
plugin_init (GstPlugin * plugin)
|
||||
{
|
||||
if (!gst_element_register (plugin, "dvdreadsrc", GST_RANK_NONE, GST_TYPE_DVDREADSRC))
|
||||
if (!gst_element_register (plugin, "dvdreadsrc", GST_RANK_NONE,
|
||||
GST_TYPE_DVDREADSRC))
|
||||
return FALSE;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
GST_PLUGIN_DEFINE (
|
||||
GST_VERSION_MAJOR,
|
||||
GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
|
||||
GST_VERSION_MINOR,
|
||||
"dvdreadsrc",
|
||||
"Access a DVD with dvdread",
|
||||
plugin_init,
|
||||
VERSION,
|
||||
"GPL",
|
||||
GST_PACKAGE,
|
||||
GST_ORIGIN)
|
||||
|
||||
plugin_init, VERSION, "GPL", GST_PACKAGE, GST_ORIGIN)
|
||||
|
|
|
@ -25,9 +25,7 @@
|
|||
#include <gst/gst.h>
|
||||
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
GstElementDetails dvdreadsrc_details;
|
||||
G_BEGIN_DECLS GstElementDetails dvdreadsrc_details;
|
||||
|
||||
|
||||
#define GST_TYPE_DVDREADSRC \
|
||||
|
@ -42,7 +40,8 @@ GstElementDetails dvdreadsrc_details;
|
|||
(G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_DVDREADSRC))
|
||||
|
||||
/* NOTE: per-element flags start with 16 for now */
|
||||
typedef enum {
|
||||
typedef enum
|
||||
{
|
||||
DVDREADSRC_OPEN = GST_ELEMENT_FLAG_LAST,
|
||||
|
||||
DVDREADSRC_FLAG_LAST = GST_ELEMENT_FLAG_LAST + 2,
|
||||
|
@ -52,17 +51,18 @@ typedef struct _DVDReadSrc DVDReadSrc;
|
|||
typedef struct _DVDReadSrcPrivate DVDReadSrcPrivate;
|
||||
typedef struct _DVDReadSrcClass DVDReadSrcClass;
|
||||
|
||||
struct _DVDReadSrc {
|
||||
struct _DVDReadSrc
|
||||
{
|
||||
GstElement element;
|
||||
DVDReadSrcPrivate *priv;
|
||||
};
|
||||
|
||||
struct _DVDReadSrcClass {
|
||||
struct _DVDReadSrcClass
|
||||
{
|
||||
GstElementClass parent_class;
|
||||
};
|
||||
|
||||
GType dvdreadsrc_get_type (void);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __DVDREADSRC_H__ */
|
||||
|
|
|
@ -24,8 +24,7 @@
|
|||
#include "gstlame.h"
|
||||
|
||||
/* elementfactory information */
|
||||
static GstElementDetails gst_lame_details =
|
||||
{
|
||||
static GstElementDetails gst_lame_details = {
|
||||
"L.A.M.E. mp3 encoder",
|
||||
"Codec/Audio/Encoder",
|
||||
"High-quality free MP3 encoder",
|
||||
|
@ -33,33 +32,27 @@ static GstElementDetails gst_lame_details =
|
|||
};
|
||||
|
||||
static GstStaticPadTemplate gst_lame_sink_template =
|
||||
GST_STATIC_PAD_TEMPLATE (
|
||||
"sink",
|
||||
GST_STATIC_PAD_TEMPLATE ("sink",
|
||||
GST_PAD_SINK,
|
||||
GST_PAD_ALWAYS,
|
||||
GST_STATIC_CAPS (
|
||||
"audio/x-raw-int, "
|
||||
GST_STATIC_CAPS ("audio/x-raw-int, "
|
||||
"endianness = (int) BYTE_ORDER, "
|
||||
"signed = (boolean) true, "
|
||||
"width = (int) 16, "
|
||||
"depth = (int) 16, "
|
||||
"rate = (int) { 8000, 11025, 12000, 16000, 22050, 24000, 32000, 44100, 48000 }, "
|
||||
"channels = (int) [ 1, 2 ]"
|
||||
)
|
||||
"channels = (int) [ 1, 2 ]")
|
||||
);
|
||||
|
||||
static GstStaticPadTemplate gst_lame_src_template =
|
||||
GST_STATIC_PAD_TEMPLATE (
|
||||
"src",
|
||||
GST_STATIC_PAD_TEMPLATE ("src",
|
||||
GST_PAD_SRC,
|
||||
GST_PAD_ALWAYS,
|
||||
GST_STATIC_CAPS (
|
||||
"audio/mpeg, "
|
||||
GST_STATIC_CAPS ("audio/mpeg, "
|
||||
"mpegversion = (int) 1, "
|
||||
"layer = (int) 3, "
|
||||
"rate = (int) { 8000, 11025, 12000, 16000, 22050, 24000, 32000, 44100, 48000 }, "
|
||||
"channels = (int) [ 1, 2 ]"
|
||||
)
|
||||
"channels = (int) [ 1, 2 ]")
|
||||
);
|
||||
|
||||
/********** Define useful types for non-programmatic interfaces **********/
|
||||
|
@ -125,12 +118,14 @@ gst_lame_padding_get_type (void)
|
|||
|
||||
/********** Standard stuff for signals and arguments **********/
|
||||
/* GstLame signals and args */
|
||||
enum {
|
||||
enum
|
||||
{
|
||||
/* FILL_ME */
|
||||
LAST_SIGNAL
|
||||
};
|
||||
|
||||
enum {
|
||||
enum
|
||||
{
|
||||
ARG_0,
|
||||
ARG_BITRATE,
|
||||
ARG_COMPRESSION_RATIO,
|
||||
|
@ -177,6 +172,7 @@ static gboolean gst_lame_setup (GstLame *lame);
|
|||
static GstElementStateReturn gst_lame_change_state (GstElement * element);
|
||||
|
||||
static GstElementClass *parent_class = NULL;
|
||||
|
||||
/* static guint gst_lame_signals[LAST_SIGNAL] = { 0 }; */
|
||||
|
||||
GType
|
||||
|
@ -203,8 +199,10 @@ gst_lame_get_type (void)
|
|||
NULL
|
||||
};
|
||||
|
||||
gst_lame_type = g_type_register_static (GST_TYPE_ELEMENT, "GstLame", &gst_lame_info, 0);
|
||||
g_type_add_interface_static (gst_lame_type, GST_TYPE_TAG_SETTER, &tag_setter_info);
|
||||
gst_lame_type =
|
||||
g_type_register_static (GST_TYPE_ELEMENT, "GstLame", &gst_lame_info, 0);
|
||||
g_type_add_interface_static (gst_lame_type, GST_TYPE_TAG_SETTER,
|
||||
&tag_setter_info);
|
||||
|
||||
}
|
||||
return gst_lame_type;
|
||||
|
@ -236,102 +234,103 @@ gst_lame_class_init (GstLameClass *klass)
|
|||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_BITRATE,
|
||||
g_param_spec_int ("bitrate", "Bitrate (kb/s)", "Bitrate in kbit/sec",
|
||||
8, 320, 128, G_PARAM_READWRITE));
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_COMPRESSION_RATIO,
|
||||
g_param_spec_float ("compression_ratio", "Compression Ratio",
|
||||
"choose bitrate to achive selected compression ratio",
|
||||
1.0, 200.0, 11.0, G_PARAM_READWRITE));
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass),
|
||||
ARG_COMPRESSION_RATIO, g_param_spec_float ("compression_ratio",
|
||||
"Compression Ratio",
|
||||
"choose bitrate to achive selected compression ratio", 1.0, 200.0,
|
||||
11.0, G_PARAM_READWRITE));
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_QUALITY,
|
||||
g_param_spec_enum ("quality", "Quality", "Encoding Quality",
|
||||
GST_TYPE_LAME_QUALITY, 5, G_PARAM_READWRITE));
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_MODE,
|
||||
g_param_spec_enum ("mode", "Mode", "Encoding mode",
|
||||
GST_TYPE_LAME_MODE, 0, G_PARAM_READWRITE));
|
||||
g_param_spec_enum ("mode", "Mode", "Encoding mode", GST_TYPE_LAME_MODE, 0,
|
||||
G_PARAM_READWRITE));
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_FORCE_MS,
|
||||
g_param_spec_boolean ("force_ms","Force ms","Force ms_stereo on all frames",
|
||||
TRUE, G_PARAM_READWRITE));
|
||||
g_param_spec_boolean ("force_ms", "Force ms",
|
||||
"Force ms_stereo on all frames", TRUE, G_PARAM_READWRITE));
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_FREE_FORMAT,
|
||||
g_param_spec_boolean ("free_format","Free format","Produce a free format bitstream",
|
||||
TRUE, G_PARAM_READWRITE));
|
||||
g_param_spec_boolean ("free_format", "Free format",
|
||||
"Produce a free format bitstream", TRUE, G_PARAM_READWRITE));
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_COPYRIGHT,
|
||||
g_param_spec_boolean ("copyright","Copyright","Mark as copyright",
|
||||
TRUE, G_PARAM_READWRITE));
|
||||
g_param_spec_boolean ("copyright", "Copyright", "Mark as copyright", TRUE,
|
||||
G_PARAM_READWRITE));
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_ORIGINAL,
|
||||
g_param_spec_boolean ("original", "Original", "Mark as non-original",
|
||||
TRUE, G_PARAM_READWRITE));
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_ERROR_PROTECTION,
|
||||
g_param_spec_boolean ("error_protection", "Error protection",
|
||||
"Adds 16 bit checksum to every frame",
|
||||
TRUE, G_PARAM_READWRITE));
|
||||
"Adds 16 bit checksum to every frame", TRUE, G_PARAM_READWRITE));
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_PADDING_TYPE,
|
||||
g_param_spec_enum ("padding_type", "Padding type", "Padding type",
|
||||
GST_TYPE_LAME_PADDING, 0, G_PARAM_READWRITE));
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_EXTENSION,
|
||||
g_param_spec_boolean ("extension", "Extension", "Extension",
|
||||
TRUE, G_PARAM_READWRITE));
|
||||
g_param_spec_boolean ("extension", "Extension", "Extension", TRUE,
|
||||
G_PARAM_READWRITE));
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_STRICT_ISO,
|
||||
g_param_spec_boolean ("strict_iso", "Strict ISO",
|
||||
"Comply as much as possible to ISO MPEG spec",
|
||||
TRUE, G_PARAM_READWRITE));
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_DISABLE_RESERVOIR,
|
||||
g_param_spec_boolean ("disable_reservoir", "Disable reservoir", "Disable the bit reservoir",
|
||||
TRUE, G_PARAM_READWRITE));
|
||||
"Comply as much as possible to ISO MPEG spec", TRUE,
|
||||
G_PARAM_READWRITE));
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass),
|
||||
ARG_DISABLE_RESERVOIR, g_param_spec_boolean ("disable_reservoir",
|
||||
"Disable reservoir", "Disable the bit reservoir", TRUE,
|
||||
G_PARAM_READWRITE));
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_VBR,
|
||||
g_param_spec_boolean ("vbr", "VBR", "Use variable bitrate",
|
||||
TRUE, G_PARAM_READWRITE));
|
||||
g_param_spec_boolean ("vbr", "VBR", "Use variable bitrate", TRUE,
|
||||
G_PARAM_READWRITE));
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_VBR_MEAN_BITRATE,
|
||||
g_param_spec_int ("vbr_mean_bitrate", "VBR mean bitrate", "Specify mean bitrate",
|
||||
0, G_MAXINT, 0, G_PARAM_READWRITE));
|
||||
g_param_spec_int ("vbr_mean_bitrate", "VBR mean bitrate",
|
||||
"Specify mean bitrate", 0, G_MAXINT, 0, G_PARAM_READWRITE));
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_VBR_MIN_BITRATE,
|
||||
g_param_spec_int ("vbr_min_bitrate", "VBR min bitrate", "Specify min bitrate",
|
||||
0, G_MAXINT, 0, G_PARAM_READWRITE));
|
||||
g_param_spec_int ("vbr_min_bitrate", "VBR min bitrate",
|
||||
"Specify min bitrate", 0, G_MAXINT, 0, G_PARAM_READWRITE));
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_VBR_MAX_BITRATE,
|
||||
g_param_spec_int ("vbr_max_bitrate", "VBR max bitrate", "Specify max bitrate",
|
||||
0, G_MAXINT, 0, G_PARAM_READWRITE));
|
||||
g_param_spec_int ("vbr_max_bitrate", "VBR max bitrate",
|
||||
"Specify max bitrate", 0, G_MAXINT, 0, G_PARAM_READWRITE));
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_VBR_HARD_MIN,
|
||||
g_param_spec_int ("vbr_hard_min", "VBR hard min", "Specify hard min bitrate",
|
||||
0, G_MAXINT, 0, G_PARAM_READWRITE));
|
||||
g_param_spec_int ("vbr_hard_min", "VBR hard min",
|
||||
"Specify hard min bitrate", 0, G_MAXINT, 0, G_PARAM_READWRITE));
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_LOWPASS_FREQ,
|
||||
g_param_spec_int ("lowpass_freq", "Lowpass freq",
|
||||
"frequency(kHz), lowpass filter cutoff above freq",
|
||||
0, 50000, 0, G_PARAM_READWRITE));
|
||||
"frequency(kHz), lowpass filter cutoff above freq", 0, 50000, 0,
|
||||
G_PARAM_READWRITE));
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_LOWPASS_WIDTH,
|
||||
g_param_spec_int ("lowpass_width", "Lowpass width",
|
||||
"frequency(kHz) - default 15% of lowpass freq",
|
||||
0, G_MAXINT, 0, G_PARAM_READWRITE));
|
||||
"frequency(kHz) - default 15% of lowpass freq", 0, G_MAXINT, 0,
|
||||
G_PARAM_READWRITE));
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_HIGHPASS_FREQ,
|
||||
g_param_spec_int ("highpass_freq", "Highpass freq",
|
||||
"frequency(kHz), highpass filter cutoff below freq",
|
||||
0, 50000, 0, G_PARAM_READWRITE));
|
||||
"frequency(kHz), highpass filter cutoff below freq", 0, 50000, 0,
|
||||
G_PARAM_READWRITE));
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_HIGHPASS_WIDTH,
|
||||
g_param_spec_int ("highpass_width", "Highpass width",
|
||||
"frequency(kHz) - default 15% of highpass freq",
|
||||
0, G_MAXINT, 0, G_PARAM_READWRITE));
|
||||
"frequency(kHz) - default 15% of highpass freq", 0, G_MAXINT, 0,
|
||||
G_PARAM_READWRITE));
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_ATH_ONLY,
|
||||
g_param_spec_boolean ("ath_only", "ATH only",
|
||||
"Ignore GPSYCHO completely, use ATH only",
|
||||
TRUE, G_PARAM_READWRITE));
|
||||
"Ignore GPSYCHO completely, use ATH only", TRUE, G_PARAM_READWRITE));
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_ATH_SHORT,
|
||||
g_param_spec_boolean ("ath_short", "ATH short",
|
||||
"Ignore GPSYCHO for short blocks, use ATH only",
|
||||
TRUE, G_PARAM_READWRITE));
|
||||
"Ignore GPSYCHO for short blocks, use ATH only", TRUE,
|
||||
G_PARAM_READWRITE));
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_NO_ATH,
|
||||
g_param_spec_boolean ("no_ath", "No ath", "turns ATH down to a flat noise floor",
|
||||
TRUE, G_PARAM_READWRITE));
|
||||
g_param_spec_boolean ("no_ath", "No ath",
|
||||
"turns ATH down to a flat noise floor", TRUE, G_PARAM_READWRITE));
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_ATH_LOWER,
|
||||
g_param_spec_int ("ath_lower", "ATH lower", "lowers ATH by x dB",
|
||||
G_MININT, G_MAXINT, 0, G_PARAM_READWRITE));
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_CWLIMIT,
|
||||
g_param_spec_int ("cwlimit", "Cwlimit", "Compute tonality up to freq (in kHz) default 8.8717",
|
||||
0, 50000, 0, G_PARAM_READWRITE));
|
||||
g_param_spec_int ("cwlimit", "Cwlimit",
|
||||
"Compute tonality up to freq (in kHz) default 8.8717", 0, 50000, 0,
|
||||
G_PARAM_READWRITE));
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_ALLOW_DIFF_SHORT,
|
||||
g_param_spec_boolean ("allow_diff_short", "Allow diff short", "Allow diff short",
|
||||
TRUE, G_PARAM_READWRITE));
|
||||
g_param_spec_boolean ("allow_diff_short", "Allow diff short",
|
||||
"Allow diff short", TRUE, G_PARAM_READWRITE));
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_NO_SHORT_BLOCKS,
|
||||
g_param_spec_boolean ("no_short_blocks", "No short blocks", "Do not use short blocks",
|
||||
TRUE, G_PARAM_READWRITE));
|
||||
g_param_spec_boolean ("no_short_blocks", "No short blocks",
|
||||
"Do not use short blocks", TRUE, G_PARAM_READWRITE));
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_EMPHASIS,
|
||||
g_param_spec_boolean ("emphasis", "Emphasis", "Emphasis",
|
||||
TRUE, G_PARAM_READWRITE));
|
||||
g_param_spec_boolean ("emphasis", "Emphasis", "Emphasis", TRUE,
|
||||
G_PARAM_READWRITE));
|
||||
|
||||
gobject_class->set_property = gst_lame_set_property;
|
||||
gobject_class->get_property = gst_lame_get_property;
|
||||
|
@ -361,14 +360,11 @@ gst_lame_sink_link (GstPad *pad, const GstCaps *caps)
|
|||
|
||||
out_samplerate = lame_get_out_samplerate (lame->lgf);
|
||||
othercaps =
|
||||
gst_caps_new_simple (
|
||||
"audio/mpeg",
|
||||
gst_caps_new_simple ("audio/mpeg",
|
||||
"mpegversion", G_TYPE_INT, 1,
|
||||
"layer", G_TYPE_INT, 3,
|
||||
"channels", G_TYPE_INT, lame->num_channels,
|
||||
"rate", G_TYPE_INT, out_samplerate,
|
||||
NULL
|
||||
);
|
||||
"rate", G_TYPE_INT, out_samplerate, NULL);
|
||||
|
||||
return gst_pad_try_set_caps (lame->srcpad, othercaps);
|
||||
}
|
||||
|
@ -378,14 +374,16 @@ gst_lame_init (GstLame *lame)
|
|||
{
|
||||
GST_DEBUG_OBJECT (lame, "starting initialization");
|
||||
|
||||
lame->sinkpad = gst_pad_new_from_template (
|
||||
gst_static_pad_template_get (&gst_lame_sink_template), "sink");
|
||||
lame->sinkpad =
|
||||
gst_pad_new_from_template (gst_static_pad_template_get
|
||||
(&gst_lame_sink_template), "sink");
|
||||
gst_element_add_pad (GST_ELEMENT (lame), lame->sinkpad);
|
||||
gst_pad_set_chain_function (lame->sinkpad, gst_lame_chain);
|
||||
gst_pad_set_link_function (lame->sinkpad, gst_lame_sink_link);
|
||||
|
||||
lame->srcpad = gst_pad_new_from_template (
|
||||
gst_static_pad_template_get (&gst_lame_src_template), "src");
|
||||
lame->srcpad =
|
||||
gst_pad_new_from_template (gst_static_pad_template_get
|
||||
(&gst_lame_src_template), "src");
|
||||
gst_element_add_pad (GST_ELEMENT (lame), lame->srcpad);
|
||||
|
||||
GST_FLAG_SET (lame, GST_ELEMENT_EVENT_AWARE);
|
||||
|
@ -444,8 +442,7 @@ struct _GstLameTagMatch
|
|||
GstLameTagFunc tag_func;
|
||||
};
|
||||
|
||||
static GstLameTagMatch tag_matches[] =
|
||||
{
|
||||
static GstLameTagMatch tag_matches[] = {
|
||||
{GST_TAG_TITLE, id3tag_set_title},
|
||||
{GST_TAG_DATE, id3tag_set_year},
|
||||
{GST_TAG_TRACK_NUMBER, id3tag_set_track},
|
||||
|
@ -457,8 +454,7 @@ static GstLameTagMatch tag_matches[] =
|
|||
};
|
||||
|
||||
static void
|
||||
add_one_tag (const GstTagList *list, const gchar *tag,
|
||||
gpointer user_data)
|
||||
add_one_tag (const GstTagList * list, const gchar * tag, gpointer user_data)
|
||||
{
|
||||
GstLame *lame;
|
||||
gchar *value;
|
||||
|
@ -482,6 +478,7 @@ add_one_tag (const GstTagList *list, const gchar *tag,
|
|||
switch (gst_tag_get_type (tag)) {
|
||||
case G_TYPE_UINT:{
|
||||
guint ivalue;
|
||||
|
||||
if (!gst_tag_list_get_uint (list, tag, &ivalue)) {
|
||||
GST_DEBUG ("Error reading \"%s\" tag value\n", tag);
|
||||
return;
|
||||
|
@ -528,7 +525,8 @@ gst_lame_set_metadata (GstLame *lame)
|
|||
|
||||
|
||||
static void
|
||||
gst_lame_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec)
|
||||
gst_lame_set_property (GObject * object, guint prop_id, const GValue * value,
|
||||
GParamSpec * pspec)
|
||||
{
|
||||
GstLame *lame;
|
||||
|
||||
|
@ -635,7 +633,8 @@ gst_lame_set_property (GObject *object, guint prop_id, const GValue *value, GPar
|
|||
}
|
||||
|
||||
static void
|
||||
gst_lame_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
|
||||
gst_lame_get_property (GObject * object, guint prop_id, GValue * value,
|
||||
GParamSpec * pspec)
|
||||
{
|
||||
GstLame *lame;
|
||||
|
||||
|
@ -768,7 +767,8 @@ gst_lame_chain (GstPad *pad, GstData *_data)
|
|||
break;
|
||||
case GST_EVENT_TAG:
|
||||
if (lame->tags) {
|
||||
gst_tag_list_insert (lame->tags, gst_event_tag_get_list (GST_EVENT (buf)),
|
||||
gst_tag_list_insert (lame->tags,
|
||||
gst_event_tag_get_list (GST_EVENT (buf)),
|
||||
gst_tag_setter_get_merge_mode (GST_TAG_SETTER (lame)));
|
||||
} else {
|
||||
g_assert_not_reached ();
|
||||
|
@ -779,8 +779,7 @@ gst_lame_chain (GstPad *pad, GstData *_data)
|
|||
gst_pad_event_default (pad, GST_EVENT (buf));
|
||||
break;
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
gint64 duration;
|
||||
|
||||
if (!lame->initialized) {
|
||||
|
@ -791,25 +790,22 @@ gst_lame_chain (GstPad *pad, GstData *_data)
|
|||
}
|
||||
|
||||
/* allocate space for output */
|
||||
mp3_buffer_size = ((GST_BUFFER_SIZE(buf) / (2+lame->num_channels)) * 1.25) + 7200;
|
||||
mp3_buffer_size =
|
||||
((GST_BUFFER_SIZE (buf) / (2 + lame->num_channels)) * 1.25) + 7200;
|
||||
mp3_data = g_malloc (mp3_buffer_size);
|
||||
|
||||
if (lame->num_channels == 2) {
|
||||
mp3_size = lame_encode_buffer_interleaved (lame->lgf,
|
||||
(short int *) (GST_BUFFER_DATA (buf)),
|
||||
GST_BUFFER_SIZE (buf) / 4,
|
||||
mp3_data, mp3_buffer_size);
|
||||
}
|
||||
else {
|
||||
GST_BUFFER_SIZE (buf) / 4, mp3_data, mp3_buffer_size);
|
||||
} else {
|
||||
mp3_size = lame_encode_buffer (lame->lgf,
|
||||
(short int *) (GST_BUFFER_DATA (buf)),
|
||||
(short int *) (GST_BUFFER_DATA (buf)),
|
||||
GST_BUFFER_SIZE (buf) / 2,
|
||||
mp3_data, mp3_buffer_size);
|
||||
GST_BUFFER_SIZE (buf) / 2, mp3_data, mp3_buffer_size);
|
||||
}
|
||||
|
||||
GST_DEBUG (
|
||||
"encoded %d bytes of audio to %d bytes of mp3",
|
||||
GST_DEBUG ("encoded %d bytes of audio to %d bytes of mp3",
|
||||
GST_BUFFER_SIZE (buf), mp3_size);
|
||||
|
||||
duration = (GST_SECOND * GST_BUFFER_SIZE (buf) /
|
||||
|
@ -817,8 +813,7 @@ gst_lame_chain (GstPad *pad, GstData *_data)
|
|||
|
||||
if (GST_BUFFER_DURATION (buf) != GST_CLOCK_TIME_NONE &&
|
||||
GST_BUFFER_DURATION (buf) != duration)
|
||||
GST_DEBUG (
|
||||
"mad: incoming buffer had incorrect duration %lld, "
|
||||
GST_DEBUG ("mad: incoming buffer had incorrect duration %lld, "
|
||||
"outgoing buffer will have correct duration %lld",
|
||||
GST_BUFFER_DURATION (buf), duration);
|
||||
|
||||
|
@ -844,8 +839,7 @@ gst_lame_chain (GstPad *pad, GstData *_data)
|
|||
gst_pad_push (lame->srcpad, GST_DATA (outbuf));
|
||||
|
||||
lame->last_ts = GST_CLOCK_TIME_NONE;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
g_free (mp3_data);
|
||||
}
|
||||
|
||||
|
@ -910,12 +904,10 @@ gst_lame_setup (GstLame *lame)
|
|||
/* initialize the lame encoder */
|
||||
if (lame_init_params (lame->lgf) < 0) {
|
||||
lame->initialized = FALSE;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
lame->initialized = TRUE;
|
||||
/* FIXME: it would be nice to print out the mode here */
|
||||
GST_INFO (
|
||||
"lame encoder initialized (%d kbit/s, %d Hz, %d channels)",
|
||||
GST_INFO ("lame encoder initialized (%d kbit/s, %d Hz, %d channels)",
|
||||
lame->bitrate, lame->samplerate, lame->num_channels);
|
||||
}
|
||||
|
||||
|
@ -965,13 +957,8 @@ plugin_init (GstPlugin *plugin)
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
GST_PLUGIN_DEFINE (
|
||||
GST_VERSION_MAJOR,
|
||||
GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
|
||||
GST_VERSION_MINOR,
|
||||
"lame",
|
||||
"Encode MP3's with LAME",
|
||||
plugin_init,
|
||||
VERSION,
|
||||
"LGPL",
|
||||
GST_PACKAGE,
|
||||
GST_ORIGIN)
|
||||
plugin_init, VERSION, "LGPL", GST_PACKAGE, GST_ORIGIN)
|
||||
|
|
|
@ -25,7 +25,8 @@
|
|||
#include <gst/gst.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
extern "C"
|
||||
{
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#include <lame/lame.h>
|
||||
|
@ -41,7 +42,8 @@ extern "C" {
|
|||
#define GST_IS_LAME_CLASS(obj) \
|
||||
(G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_LAME))
|
||||
|
||||
typedef enum {
|
||||
typedef enum
|
||||
{
|
||||
GST_LAME_OPEN = GST_ELEMENT_FLAG_LAST,
|
||||
|
||||
GST_LAME_FLAG_LAST = GST_ELEMENT_FLAG_LAST + 2,
|
||||
|
@ -50,7 +52,8 @@ typedef enum {
|
|||
typedef struct _GstLame GstLame;
|
||||
typedef struct _GstLameClass GstLameClass;
|
||||
|
||||
struct _GstLame {
|
||||
struct _GstLame
|
||||
{
|
||||
GstElement element;
|
||||
/* pads */
|
||||
GstPad *srcpad, *sinkpad;
|
||||
|
@ -99,7 +102,8 @@ struct _GstLame {
|
|||
guint64 last_ts, last_offs, last_duration;
|
||||
};
|
||||
|
||||
struct _GstLameClass {
|
||||
struct _GstLameClass
|
||||
{
|
||||
GstElementClass parent_class;
|
||||
};
|
||||
|
||||
|
|
|
@ -29,13 +29,20 @@ main (int argc, char *argv[])
|
|||
gst_init (&argc, &argv);
|
||||
|
||||
/* create elements */
|
||||
if (!(pipeline = gst_element_factory_make ("pipeline", "pipeline"))) return 1;
|
||||
if (!(src = gst_element_factory_make ("fakesrc", "source"))) return 1;
|
||||
if (!(tee = gst_element_factory_make ("tee", "tee"))) return 1;
|
||||
if (!(encoder1 = gst_element_factory_make ("lame", "lame1"))) return 1;
|
||||
if (!(encoder2 = gst_element_factory_make ("lame", "lame2"))) return 1;
|
||||
if (!(sink1 = gst_element_factory_make ("fakesink", "sink1"))) return 1;
|
||||
if (!(sink2 = gst_element_factory_make ("fakesink", "sink2"))) return 1;
|
||||
if (!(pipeline = gst_element_factory_make ("pipeline", "pipeline")))
|
||||
return 1;
|
||||
if (!(src = gst_element_factory_make ("fakesrc", "source")))
|
||||
return 1;
|
||||
if (!(tee = gst_element_factory_make ("tee", "tee")))
|
||||
return 1;
|
||||
if (!(encoder1 = gst_element_factory_make ("lame", "lame1")))
|
||||
return 1;
|
||||
if (!(encoder2 = gst_element_factory_make ("lame", "lame2")))
|
||||
return 1;
|
||||
if (!(sink1 = gst_element_factory_make ("fakesink", "sink1")))
|
||||
return 1;
|
||||
if (!(sink2 = gst_element_factory_make ("fakesink", "sink2")))
|
||||
return 1;
|
||||
|
||||
pipeline = gst_pipeline_new ("pipeline");
|
||||
g_signal_connect (pipeline, "error", G_CALLBACK (error_callback), NULL);
|
||||
|
@ -52,20 +59,17 @@ main (int argc, char *argv[])
|
|||
g_object_set (G_OBJECT (src), "sizetype", 3, NULL);
|
||||
|
||||
/* set caps on fakesrc */
|
||||
caps = GST_CAPS_NEW (
|
||||
"input audio",
|
||||
caps = GST_CAPS_NEW ("input audio",
|
||||
"audio/raw",
|
||||
"format", GST_PROPS_STRING ("int"),
|
||||
"rate", GST_PROPS_INT (44100),
|
||||
"width", GST_PROPS_INT (16),
|
||||
"depth", GST_PROPS_INT (16),
|
||||
"law", GST_PROPS_INT (0),
|
||||
"signed", GST_PROPS_BOOLEAN (TRUE),
|
||||
"channels", GST_PROPS_INT (1)
|
||||
"signed", GST_PROPS_BOOLEAN (TRUE), "channels", GST_PROPS_INT (1)
|
||||
);
|
||||
|
||||
g_object_set (G_OBJECT (src), "sizetype", 3,
|
||||
"filltype", 3, NULL);
|
||||
g_object_set (G_OBJECT (src), "sizetype", 3, "filltype", 3, NULL);
|
||||
|
||||
|
||||
gst_element_set_state (pipeline, GST_STATE_READY);
|
||||
|
|
|
@ -39,7 +39,8 @@ GST_DEBUG_CATEGORY_STATIC (gst_id3_tag_debug);
|
|||
typedef struct _GstID3Tag GstID3Tag;
|
||||
typedef struct _GstID3TagClass GstID3TagClass;
|
||||
|
||||
typedef enum {
|
||||
typedef enum
|
||||
{
|
||||
GST_ID3_TAG_STATE_READING_V2_TAG,
|
||||
GST_ID3_TAG_STATE_SEEKING_TO_V1_TAG,
|
||||
GST_ID3_TAG_STATE_READING_V1_TAG,
|
||||
|
@ -48,14 +49,16 @@ typedef enum {
|
|||
GST_ID3_TAG_STATE_NORMAL,
|
||||
} GstID3TagState;
|
||||
|
||||
typedef enum {
|
||||
typedef enum
|
||||
{
|
||||
GST_ID3_TAG_PARSE_UNKNOWN,
|
||||
GST_ID3_TAG_PARSE_TAG,
|
||||
GST_ID3_TAG_PARSE_WRITE,
|
||||
GST_ID3_TAG_PARSE_PARSE
|
||||
} GstID3ParseMode;
|
||||
|
||||
struct _GstID3Tag {
|
||||
struct _GstID3Tag
|
||||
{
|
||||
GstElement element;
|
||||
|
||||
/* pads */
|
||||
|
@ -84,26 +87,28 @@ struct _GstID3Tag {
|
|||
gboolean v2tag_render;
|
||||
};
|
||||
|
||||
struct _GstID3TagClass {
|
||||
struct _GstID3TagClass
|
||||
{
|
||||
GstElementClass parent_class;
|
||||
};
|
||||
|
||||
/* elementfactory information */
|
||||
static GstElementDetails gst_id3_tag_details = GST_ELEMENT_DETAILS (
|
||||
"id3 tag extractor",
|
||||
static GstElementDetails gst_id3_tag_details =
|
||||
GST_ELEMENT_DETAILS ("id3 tag extractor",
|
||||
"Tag",
|
||||
"Extract tagging information from mp3s",
|
||||
"Benjamin Otte <in7y118@public.uni-hamburg.de>"
|
||||
);
|
||||
"Benjamin Otte <in7y118@public.uni-hamburg.de>");
|
||||
|
||||
|
||||
/* signals and args */
|
||||
enum {
|
||||
enum
|
||||
{
|
||||
/* FILL ME */
|
||||
LAST_SIGNAL
|
||||
};
|
||||
|
||||
enum {
|
||||
enum
|
||||
{
|
||||
ARG_0,
|
||||
ARG_V1_TAG,
|
||||
ARG_V2_TAG,
|
||||
|
@ -112,8 +117,7 @@ enum {
|
|||
};
|
||||
|
||||
static GstStaticPadTemplate id3_tag_src_template_factory =
|
||||
GST_STATIC_PAD_TEMPLATE (
|
||||
"src",
|
||||
GST_STATIC_PAD_TEMPLATE ("src",
|
||||
GST_PAD_SRC,
|
||||
/* FIXME: for spider - GST_PAD_ALWAYS, */
|
||||
GST_PAD_SOMETIMES,
|
||||
|
@ -121,8 +125,7 @@ GST_STATIC_PAD_TEMPLATE (
|
|||
);
|
||||
|
||||
static GstStaticPadTemplate id3_tag_sink_template_factory =
|
||||
GST_STATIC_PAD_TEMPLATE (
|
||||
"sink",
|
||||
GST_STATIC_PAD_TEMPLATE ("sink",
|
||||
GST_PAD_SINK,
|
||||
GST_PAD_ALWAYS,
|
||||
GST_STATIC_CAPS ("application/x-id3")
|
||||
|
@ -133,32 +136,25 @@ static void gst_id3_tag_base_init (gpointer g_class);
|
|||
static void gst_id3_tag_class_init (GstID3TagClass * klass);
|
||||
static void gst_id3_tag_init (GstID3Tag * tag);
|
||||
static void gst_id3_tag_set_property (GObject * object,
|
||||
guint prop_id,
|
||||
const GValue * value,
|
||||
GParamSpec * pspec);
|
||||
guint prop_id, const GValue * value, GParamSpec * pspec);
|
||||
static void gst_id3_tag_get_property (GObject * object,
|
||||
guint prop_id,
|
||||
GValue * value,
|
||||
GParamSpec * pspec);
|
||||
guint prop_id, GValue * value, GParamSpec * pspec);
|
||||
|
||||
static gboolean gst_id3_tag_src_event (GstPad * pad,
|
||||
GstEvent * event);
|
||||
static gboolean gst_id3_tag_src_event (GstPad * pad, GstEvent * event);
|
||||
static const GstEventMask *gst_id3_tag_get_event_masks (GstPad * pad);
|
||||
static const GstQueryType *gst_id3_tag_get_query_types (GstPad * pad);
|
||||
|
||||
static gboolean gst_id3_tag_src_query (GstPad * pad,
|
||||
GstQueryType type,
|
||||
GstFormat * format,
|
||||
gint64 * value);
|
||||
GstQueryType type, GstFormat * format, gint64 * value);
|
||||
|
||||
static void gst_id3_tag_chain (GstPad * pad,
|
||||
GstData * data);
|
||||
static void gst_id3_tag_chain (GstPad * pad, GstData * data);
|
||||
static GstPadLinkReturn gst_id3_tag_src_link (GstPad * pad,
|
||||
const GstCaps * caps);
|
||||
|
||||
static GstElementStateReturn gst_id3_tag_change_state (GstElement * element);
|
||||
|
||||
static GstElementClass *parent_class = NULL;
|
||||
|
||||
/* static guint gst_id3_tag_signals[LAST_SIGNAL] = { 0 }; */
|
||||
|
||||
GType
|
||||
|
@ -184,11 +180,15 @@ gst_id3_tag_get_type (void)
|
|||
NULL
|
||||
};
|
||||
|
||||
id3_tag_type = g_type_register_static(GST_TYPE_ELEMENT, "GstID3Tag", &id3_tag_info, 0);
|
||||
id3_tag_type =
|
||||
g_type_register_static (GST_TYPE_ELEMENT, "GstID3Tag", &id3_tag_info,
|
||||
0);
|
||||
|
||||
g_type_add_interface_static (id3_tag_type, GST_TYPE_TAG_SETTER, &tag_setter_info);
|
||||
g_type_add_interface_static (id3_tag_type, GST_TYPE_TAG_SETTER,
|
||||
&tag_setter_info);
|
||||
|
||||
GST_DEBUG_CATEGORY_INIT (gst_id3_tag_debug, "id3tag", 0, "id3 tag reader / setter");
|
||||
GST_DEBUG_CATEGORY_INIT (gst_id3_tag_debug, "id3tag", 0,
|
||||
"id3 tag reader / setter");
|
||||
}
|
||||
return id3_tag_type;
|
||||
}
|
||||
|
@ -218,14 +218,17 @@ gst_id3_tag_class_init (GstID3TagClass *klass)
|
|||
gstelement_class->change_state = gst_id3_tag_change_state;
|
||||
|
||||
g_object_class_install_property (gobject_class, ARG_V1_TAG,
|
||||
g_param_spec_boolean ("v1-tag", "add version 1 tag", "Add version 1 tag at end of file",
|
||||
FALSE, G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
|
||||
g_param_spec_boolean ("v1-tag", "add version 1 tag",
|
||||
"Add version 1 tag at end of file", FALSE,
|
||||
G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
|
||||
g_object_class_install_property (gobject_class, ARG_V2_TAG,
|
||||
g_param_spec_boolean ("v2-tag", "add version 2 tag", "Add version 2 tag at start of file",
|
||||
TRUE, G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
|
||||
g_param_spec_boolean ("v2-tag", "add version 2 tag",
|
||||
"Add version 2 tag at start of file", TRUE,
|
||||
G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
|
||||
g_object_class_install_property (gobject_class, ARG_PREFER_V1,
|
||||
g_param_spec_boolean ("prefer-v1", "prefer version 1 tag", "Prefer tags from tag at end of file",
|
||||
FALSE, G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
|
||||
g_param_spec_boolean ("prefer-v1", "prefer version 1 tag",
|
||||
"Prefer tags from tag at end of file", FALSE,
|
||||
G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
|
||||
|
||||
gobject_class->set_property = GST_DEBUG_FUNCPTR (gst_id3_tag_set_property);
|
||||
gobject_class->get_property = GST_DEBUG_FUNCPTR (gst_id3_tag_get_property);
|
||||
|
@ -238,6 +241,7 @@ gst_id3_tag_get_caps (GstPad *pad)
|
|||
|
||||
if (tag->found_caps) {
|
||||
GstCaps *caps;
|
||||
|
||||
caps = gst_caps_from_string ("application/x-gst-tags; application/x-id3");
|
||||
gst_caps_append (caps, gst_caps_copy (tag->found_caps));
|
||||
return caps;
|
||||
|
@ -250,24 +254,33 @@ static void
|
|||
gst_id3_tag_add_src_pad (GstID3Tag * tag)
|
||||
{
|
||||
g_assert (tag->srcpad == NULL);
|
||||
tag->srcpad = gst_pad_new_from_template (gst_static_pad_template_get (
|
||||
&id3_tag_src_template_factory), "src");
|
||||
gst_pad_set_event_function (tag->srcpad, GST_DEBUG_FUNCPTR (gst_id3_tag_src_event));
|
||||
gst_pad_set_event_mask_function (tag->srcpad, GST_DEBUG_FUNCPTR (gst_id3_tag_get_event_masks));
|
||||
gst_pad_set_query_function (tag->srcpad, GST_DEBUG_FUNCPTR (gst_id3_tag_src_query));
|
||||
gst_pad_set_query_type_function (tag->srcpad, GST_DEBUG_FUNCPTR (gst_id3_tag_get_query_types));
|
||||
gst_pad_set_getcaps_function (tag->srcpad, GST_DEBUG_FUNCPTR (gst_id3_tag_get_caps));
|
||||
gst_pad_set_link_function (tag->srcpad, GST_DEBUG_FUNCPTR (gst_id3_tag_src_link));
|
||||
tag->srcpad =
|
||||
gst_pad_new_from_template (gst_static_pad_template_get
|
||||
(&id3_tag_src_template_factory), "src");
|
||||
gst_pad_set_event_function (tag->srcpad,
|
||||
GST_DEBUG_FUNCPTR (gst_id3_tag_src_event));
|
||||
gst_pad_set_event_mask_function (tag->srcpad,
|
||||
GST_DEBUG_FUNCPTR (gst_id3_tag_get_event_masks));
|
||||
gst_pad_set_query_function (tag->srcpad,
|
||||
GST_DEBUG_FUNCPTR (gst_id3_tag_src_query));
|
||||
gst_pad_set_query_type_function (tag->srcpad,
|
||||
GST_DEBUG_FUNCPTR (gst_id3_tag_get_query_types));
|
||||
gst_pad_set_getcaps_function (tag->srcpad,
|
||||
GST_DEBUG_FUNCPTR (gst_id3_tag_get_caps));
|
||||
gst_pad_set_link_function (tag->srcpad,
|
||||
GST_DEBUG_FUNCPTR (gst_id3_tag_src_link));
|
||||
gst_element_add_pad (GST_ELEMENT (tag), tag->srcpad);
|
||||
}
|
||||
static void
|
||||
gst_id3_tag_init (GstID3Tag * tag)
|
||||
{
|
||||
/* create the sink and src pads */
|
||||
tag->sinkpad = gst_pad_new_from_template(
|
||||
gst_static_pad_template_get (&id3_tag_sink_template_factory), "sink");
|
||||
tag->sinkpad =
|
||||
gst_pad_new_from_template (gst_static_pad_template_get
|
||||
(&id3_tag_sink_template_factory), "sink");
|
||||
gst_element_add_pad (GST_ELEMENT (tag), tag->sinkpad);
|
||||
gst_pad_set_chain_function (tag->sinkpad, GST_DEBUG_FUNCPTR (gst_id3_tag_chain));
|
||||
gst_pad_set_chain_function (tag->sinkpad,
|
||||
GST_DEBUG_FUNCPTR (gst_id3_tag_chain));
|
||||
|
||||
/* FIXME: for the alli^H^H^H^Hspider - gst_id3_tag_add_src_pad (tag); */
|
||||
|
||||
|
@ -278,7 +291,8 @@ gst_id3_tag_init (GstID3Tag *tag)
|
|||
GST_FLAG_SET (tag, GST_ELEMENT_EVENT_AWARE);
|
||||
}
|
||||
static void
|
||||
gst_id3_tag_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec)
|
||||
gst_id3_tag_set_property (GObject * object, guint prop_id, const GValue * value,
|
||||
GParamSpec * pspec)
|
||||
{
|
||||
GstID3Tag *tag;
|
||||
|
||||
|
@ -303,9 +317,11 @@ gst_id3_tag_set_property (GObject *object, guint prop_id, const GValue *value, G
|
|||
}
|
||||
}
|
||||
static void
|
||||
gst_id3_tag_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
|
||||
gst_id3_tag_get_property (GObject * object, guint prop_id, GValue * value,
|
||||
GParamSpec * pspec)
|
||||
{
|
||||
GstID3Tag *tag;
|
||||
|
||||
tag = GST_ID3_TAG (object);
|
||||
|
||||
switch (prop_id) {
|
||||
|
@ -323,6 +339,7 @@ gst_id3_tag_get_property (GObject *object, guint prop_id, GValue *value, GParamS
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
#define gst_id3_tag_set_state(tag,new_state) G_STMT_START { \
|
||||
GST_LOG_OBJECT (tag, "setting state to %s", #new_state ); \
|
||||
tag->state = new_state; \
|
||||
|
@ -331,8 +348,7 @@ static const GstEventMask*
|
|||
gst_id3_tag_get_event_masks (GstPad * pad)
|
||||
{
|
||||
static const GstEventMask gst_id3_tag_src_event_masks[] = {
|
||||
{ GST_EVENT_SEEK, GST_SEEK_METHOD_SET |
|
||||
GST_SEEK_FLAG_FLUSH },
|
||||
{GST_EVENT_SEEK, GST_SEEK_METHOD_SET | GST_SEEK_FLAG_FLUSH},
|
||||
{0,}
|
||||
};
|
||||
return gst_id3_tag_src_event_masks;
|
||||
|
@ -363,7 +379,8 @@ gst_id3_tag_src_query (GstPad *pad, GstQueryType type,
|
|||
case GST_FORMAT_BYTES:
|
||||
if (GST_PAD_PEER (tag->sinkpad) &&
|
||||
tag->state == GST_ID3_TAG_STATE_NORMAL &&
|
||||
gst_pad_query (GST_PAD_PEER (tag->sinkpad), GST_QUERY_TOTAL, format, value)) {
|
||||
gst_pad_query (GST_PAD_PEER (tag->sinkpad), GST_QUERY_TOTAL,
|
||||
format, value)) {
|
||||
*value -= tag->v2tag_size + tag->v1tag_size;
|
||||
*value += tag->v2tag_size_new + tag->v1tag_size_new;
|
||||
res = TRUE;
|
||||
|
@ -378,7 +395,8 @@ gst_id3_tag_src_query (GstPad *pad, GstQueryType type,
|
|||
switch (*format) {
|
||||
case GST_FORMAT_BYTES:
|
||||
if (GST_PAD_PEER (tag->sinkpad) &&
|
||||
gst_pad_query (GST_PAD_PEER (tag->sinkpad), GST_QUERY_POSITION, format, value)) {
|
||||
gst_pad_query (GST_PAD_PEER (tag->sinkpad), GST_QUERY_POSITION,
|
||||
format, value)) {
|
||||
if (tag->state == GST_ID3_TAG_STATE_NORMAL) {
|
||||
*value -= tag->v2tag_size + tag->v2tag_size_new;
|
||||
} else {
|
||||
|
@ -413,10 +431,19 @@ gst_id3_tag_src_event (GstPad *pad, GstEvent *event)
|
|||
gint diff = 0;
|
||||
|
||||
switch (GST_EVENT_SEEK_METHOD (event)) {
|
||||
case GST_SEEK_METHOD_SET: diff = tag->v2tag_size_new - tag->v2tag_size; break;
|
||||
case GST_SEEK_METHOD_CUR: break;
|
||||
case GST_SEEK_METHOD_END: diff = GST_EVENT_SEEK_OFFSET(event) ? tag->v1tag_size_new - tag->v1tag_size : 0; break;
|
||||
default: g_assert_not_reached(); break;
|
||||
case GST_SEEK_METHOD_SET:
|
||||
diff = tag->v2tag_size_new - tag->v2tag_size;
|
||||
break;
|
||||
case GST_SEEK_METHOD_CUR:
|
||||
break;
|
||||
case GST_SEEK_METHOD_END:
|
||||
diff =
|
||||
GST_EVENT_SEEK_OFFSET (event) ? tag->v1tag_size_new -
|
||||
tag->v1tag_size : 0;
|
||||
break;
|
||||
default:
|
||||
g_assert_not_reached ();
|
||||
break;
|
||||
}
|
||||
new = gst_event_new_seek (GST_EVENT_SEEK_TYPE (event),
|
||||
GST_EVENT_SEEK_OFFSET (event) + diff);
|
||||
|
@ -431,6 +458,7 @@ gst_id3_tag_src_event (GstPad *pad, GstEvent *event)
|
|||
gst_event_unref (event);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
GstTagList *
|
||||
gst_mad_id3_to_tag_list (const struct id3_tag * tag)
|
||||
{
|
||||
|
@ -446,6 +474,7 @@ gst_mad_id3_to_tag_list(const struct id3_tag *tag)
|
|||
const union id3_field *field;
|
||||
unsigned int nstrings, j;
|
||||
const gchar *tag_name;
|
||||
|
||||
/* find me the function to query the frame id */
|
||||
gchar *id = g_strndup (frame->id, 5);
|
||||
|
||||
|
@ -487,8 +516,10 @@ gst_mad_id3_to_tag_list(const struct id3_tag *tag)
|
|||
if (strcmp (tag_name, GST_TAG_DATE) == 0) {
|
||||
GDate *d;
|
||||
|
||||
if (*check != '\0') break;
|
||||
if (tmp == 0) break;
|
||||
if (*check != '\0')
|
||||
break;
|
||||
if (tmp == 0)
|
||||
break;
|
||||
d = g_date_new_dmy (1, 1, tmp);
|
||||
tmp = g_date_get_julian (d);
|
||||
g_date_free (d);
|
||||
|
@ -498,9 +529,11 @@ gst_mad_id3_to_tag_list(const struct id3_tag *tag)
|
|||
|
||||
check++;
|
||||
total = strtoul (check, &check, 10);
|
||||
if (*check != '\0') break;
|
||||
if (*check != '\0')
|
||||
break;
|
||||
|
||||
gst_tag_list_add (tag_list, GST_TAG_MERGE_APPEND, GST_TAG_TRACK_COUNT, total, NULL);
|
||||
gst_tag_list_add (tag_list, GST_TAG_MERGE_APPEND,
|
||||
GST_TAG_TRACK_COUNT, total, NULL);
|
||||
}
|
||||
} else if (strcmp (tag_name, GST_TAG_ALBUM_VOLUME_NUMBER) == 0) {
|
||||
if (*check == '/') {
|
||||
|
@ -508,32 +541,37 @@ gst_mad_id3_to_tag_list(const struct id3_tag *tag)
|
|||
|
||||
check++;
|
||||
total = strtoul (check, &check, 10);
|
||||
if (*check != '\0') break;
|
||||
if (*check != '\0')
|
||||
break;
|
||||
|
||||
gst_tag_list_add (tag_list, GST_TAG_MERGE_APPEND, GST_TAG_ALBUM_VOLUME_COUNT, total, NULL);
|
||||
gst_tag_list_add (tag_list, GST_TAG_MERGE_APPEND,
|
||||
GST_TAG_ALBUM_VOLUME_COUNT, total, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
if (*check != '\0') break;
|
||||
gst_tag_list_add (tag_list, GST_TAG_MERGE_APPEND, tag_name, tmp, NULL);
|
||||
if (*check != '\0')
|
||||
break;
|
||||
gst_tag_list_add (tag_list, GST_TAG_MERGE_APPEND, tag_name, tmp,
|
||||
NULL);
|
||||
break;
|
||||
}
|
||||
case G_TYPE_UINT64:
|
||||
{
|
||||
guint64 tmp;
|
||||
|
||||
g_assert ((strcmp (tag_name, GST_TAG_DURATION) == 0));
|
||||
tmp = strtoul (utf8, NULL, 10);
|
||||
if (tmp == 0) {
|
||||
break;
|
||||
}
|
||||
gst_tag_list_add (tag_list, GST_TAG_MERGE_APPEND,
|
||||
GST_TAG_DURATION, tmp*1000*1000,
|
||||
NULL);
|
||||
GST_TAG_DURATION, tmp * 1000 * 1000, NULL);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
g_assert (gst_tag_get_type (tag_name) == G_TYPE_STRING);
|
||||
gst_tag_list_add (tag_list, GST_TAG_MERGE_APPEND, tag_name, utf8, NULL);
|
||||
gst_tag_list_add (tag_list, GST_TAG_MERGE_APPEND, tag_name, utf8,
|
||||
NULL);
|
||||
break;
|
||||
}
|
||||
free (utf8);
|
||||
|
@ -544,7 +582,8 @@ gst_mad_id3_to_tag_list(const struct id3_tag *tag)
|
|||
return tag_list;
|
||||
}
|
||||
static void
|
||||
tag_list_to_id3_tag_foreach (const GstTagList *list, const gchar *tag_name, gpointer user_data)
|
||||
tag_list_to_id3_tag_foreach (const GstTagList * list, const gchar * tag_name,
|
||||
gpointer user_data)
|
||||
{
|
||||
struct id3_frame *frame;
|
||||
union id3_field *field;
|
||||
|
@ -648,10 +687,14 @@ gst_id3_tag_handle_event (GstPad *pad, GstEvent *event)
|
|||
switch (tag->state) {
|
||||
case GST_ID3_TAG_STATE_READING_V2_TAG:{
|
||||
guint64 value;
|
||||
|
||||
gst_event_discont_get_value (event, GST_FORMAT_BYTES, &value);
|
||||
if (value != (tag->buffer ? GST_BUFFER_OFFSET (tag->buffer) + GST_BUFFER_SIZE (tag->buffer)
|
||||
if (value !=
|
||||
(tag->buffer ? GST_BUFFER_OFFSET (tag->buffer) +
|
||||
GST_BUFFER_SIZE (tag->buffer)
|
||||
: 0))
|
||||
GST_ELEMENT_ERROR (tag, CORE, EVENT, (NULL), ("Seek during ID3v2 tag reading"));
|
||||
GST_ELEMENT_ERROR (tag, CORE, EVENT, (NULL),
|
||||
("Seek during ID3v2 tag reading"));
|
||||
gst_data_unref (GST_DATA (event));
|
||||
break;
|
||||
}
|
||||
|
@ -660,7 +703,8 @@ gst_id3_tag_handle_event (GstPad *pad, GstEvent *event)
|
|||
gst_id3_tag_set_state (tag, GST_ID3_TAG_STATE_READING_V1_TAG);
|
||||
break;
|
||||
case GST_ID3_TAG_STATE_READING_V1_TAG:
|
||||
GST_ELEMENT_ERROR (tag, CORE, EVENT, (NULL), ("Seek during ID3v1 tag reading"));
|
||||
GST_ELEMENT_ERROR (tag, CORE, EVENT, (NULL),
|
||||
("Seek during ID3v1 tag reading"));
|
||||
gst_data_unref (GST_DATA (event));
|
||||
break;
|
||||
case GST_ID3_TAG_STATE_SEEKING_TO_NORMAL:
|
||||
|
@ -691,7 +735,8 @@ gst_id3_tag_handle_event (GstPad *pad, GstEvent *event)
|
|||
break;
|
||||
case GST_EVENT_TAG:
|
||||
if (tag->event_tags) {
|
||||
gst_tag_list_insert (tag->event_tags, gst_event_tag_get_list (event), GST_TAG_MERGE_PREPEND);
|
||||
gst_tag_list_insert (tag->event_tags, gst_event_tag_get_list (event),
|
||||
GST_TAG_MERGE_PREPEND);
|
||||
} else {
|
||||
tag->event_tags = gst_tag_list_copy (gst_event_tag_get_list (event));
|
||||
}
|
||||
|
@ -725,7 +770,8 @@ gst_id3_tag_handle_event (GstPad *pad, GstEvent *event)
|
|||
}
|
||||
return;
|
||||
}
|
||||
typedef struct {
|
||||
typedef struct
|
||||
{
|
||||
guint best_probability;
|
||||
GstCaps *caps;
|
||||
GstBuffer *buffer;
|
||||
|
@ -837,11 +883,11 @@ static void
|
|||
gst_id3_tag_send_tag_event (GstID3Tag * tag)
|
||||
{
|
||||
/* FIXME: what's the correct merge mode? Docs need to tell... */
|
||||
GstTagList *merged = gst_tag_list_merge (tag->event_tags, tag->parsed_tags, GST_TAG_MERGE_KEEP);
|
||||
GstTagList *merged = gst_tag_list_merge (tag->event_tags, tag->parsed_tags,
|
||||
GST_TAG_MERGE_KEEP);
|
||||
|
||||
if (merged) {
|
||||
gst_element_found_tags_for_pad (GST_ELEMENT (tag), tag->srcpad, 0,
|
||||
merged);
|
||||
gst_element_found_tags_for_pad (GST_ELEMENT (tag), tag->srcpad, 0, merged);
|
||||
}
|
||||
}
|
||||
static void
|
||||
|
@ -868,6 +914,7 @@ gst_id3_tag_chain (GstPad *pad, GstData *data)
|
|||
case GST_ID3_TAG_STATE_READING_V1_TAG:
|
||||
if (tag->buffer) {
|
||||
GstBuffer *temp;
|
||||
|
||||
temp = gst_buffer_merge (tag->buffer, buffer);
|
||||
gst_data_unref (GST_DATA (tag->buffer));
|
||||
tag->buffer = temp;
|
||||
|
@ -901,7 +948,8 @@ gst_id3_tag_chain (GstPad *pad, GstData *data)
|
|||
} else if (tag->v1tag_size != 0) {
|
||||
GST_WARNING_OBJECT (tag, "bad non-ID3v1 tag at end of file");
|
||||
} else {
|
||||
GST_LOG_OBJECT (tag, "no ID3v1 tag (%"G_GUINT64_FORMAT")", GST_BUFFER_OFFSET (tag->buffer));
|
||||
GST_LOG_OBJECT (tag, "no ID3v1 tag (%" G_GUINT64_FORMAT ")",
|
||||
GST_BUFFER_OFFSET (tag->buffer));
|
||||
}
|
||||
gst_data_unref (GST_DATA (tag->buffer));
|
||||
tag->buffer = NULL;
|
||||
|
@ -913,7 +961,8 @@ gst_id3_tag_chain (GstPad *pad, GstData *data)
|
|||
GST_SEEK_FLAG_FLUSH, tag->v2tag_size))) {
|
||||
gst_id3_tag_set_state (tag, GST_ID3_TAG_STATE_SEEKING_TO_NORMAL);
|
||||
} else {
|
||||
GST_ELEMENT_ERROR (tag, CORE, SEEK, (NULL), ("can't seek back to beginning from reading ID3v1 tag"));
|
||||
GST_ELEMENT_ERROR (tag, CORE, SEEK, (NULL),
|
||||
("can't seek back to beginning from reading ID3v1 tag"));
|
||||
}
|
||||
} else {
|
||||
gst_id3_tag_send_tag_event (tag);
|
||||
|
@ -927,6 +976,7 @@ gst_id3_tag_chain (GstPad *pad, GstData *data)
|
|||
case GST_ID3_TAG_STATE_READING_V2_TAG:
|
||||
if (tag->buffer) {
|
||||
GstBuffer *temp;
|
||||
|
||||
temp = gst_buffer_merge (tag->buffer, buffer);
|
||||
gst_data_unref (GST_DATA (tag->buffer));
|
||||
tag->buffer = temp;
|
||||
|
@ -952,6 +1002,7 @@ gst_id3_tag_chain (GstPad *pad, GstData *data)
|
|||
GST_BUFFER_SIZE (tag->buffer));
|
||||
if (v2tag) {
|
||||
GstTagList *list;
|
||||
|
||||
list = gst_mad_id3_to_tag_list (v2tag);
|
||||
id3_tag_delete (v2tag);
|
||||
GST_LOG_OBJECT (tag, "parsed ID3v2 tag");
|
||||
|
@ -963,8 +1014,11 @@ gst_id3_tag_chain (GstPad *pad, GstData *data)
|
|||
}
|
||||
}
|
||||
/* caps nego and typefinding */
|
||||
GST_LOG_OBJECT (tag, "removing first %ld bytes, because they're the ID3v2 tag", tag->v2tag_size);
|
||||
buffer = gst_buffer_create_sub (tag->buffer, tag->v2tag_size,
|
||||
GST_LOG_OBJECT (tag,
|
||||
"removing first %ld bytes, because they're the ID3v2 tag",
|
||||
tag->v2tag_size);
|
||||
buffer =
|
||||
gst_buffer_create_sub (tag->buffer, tag->v2tag_size,
|
||||
GST_BUFFER_SIZE (tag->buffer) - tag->v2tag_size);
|
||||
gst_data_unref (GST_DATA (tag->buffer));
|
||||
tag->buffer = NULL;
|
||||
|
@ -985,8 +1039,7 @@ gst_id3_tag_chain (GstPad *pad, GstData *data)
|
|||
g_assert (tag->buffer == NULL);
|
||||
gst_id3_tag_send_tag_event (tag);
|
||||
|
||||
if (tag->parse_mode == GST_ID3_TAG_PARSE_WRITE &&
|
||||
tag->v2tag_render) {
|
||||
if (tag->parse_mode == GST_ID3_TAG_PARSE_WRITE && tag->v2tag_render) {
|
||||
struct id3_tag *id3;
|
||||
GstTagList *merged;
|
||||
GstBuffer *tag_buffer;
|
||||
|
@ -998,9 +1051,11 @@ gst_id3_tag_chain (GstPad *pad, GstData *data)
|
|||
id3 = gst_mad_tag_list_to_id3_tag (merged);
|
||||
if (id3) {
|
||||
glong estimated;
|
||||
|
||||
estimated = id3_tag_render (id3, NULL);
|
||||
tag_buffer = gst_buffer_new_and_alloc (estimated);
|
||||
tag->v2tag_size_new = id3_tag_render (id3, GST_BUFFER_DATA (tag_buffer));
|
||||
tag->v2tag_size_new =
|
||||
id3_tag_render (id3, GST_BUFFER_DATA (tag_buffer));
|
||||
g_assert (estimated >= tag->v2tag_size_new);
|
||||
GST_BUFFER_SIZE (tag_buffer) = tag->v2tag_size_new;
|
||||
gst_pad_push (tag->srcpad, GST_DATA (tag_buffer));
|
||||
|
@ -1013,7 +1068,8 @@ gst_id3_tag_chain (GstPad *pad, GstData *data)
|
|||
tag->v1tag_size_new = (tag->v1tag_render &&
|
||||
tag->parse_mode == GST_ID3_TAG_PARSE_WRITE &&
|
||||
(tag->parsed_tags != NULL ||
|
||||
gst_tag_setter_get_list (GST_TAG_SETTER (tag)) != NULL)) ? 128 : 0;
|
||||
gst_tag_setter_get_list (GST_TAG_SETTER (tag)) !=
|
||||
NULL)) ? 128 : 0;
|
||||
/* fall through */
|
||||
case GST_ID3_TAG_STATE_NORMAL:
|
||||
if (tag->parse_mode == GST_ID3_TAG_PARSE_TAG) {
|
||||
|
@ -1026,6 +1082,7 @@ gst_id3_tag_chain (GstPad *pad, GstData *data)
|
|||
} else if (buffer->offset + buffer->size > tag->v1tag_offset) {
|
||||
GstBuffer *sub = gst_buffer_create_sub (buffer, 0,
|
||||
buffer->size - 128);
|
||||
|
||||
gst_data_unref (GST_DATA (buffer));
|
||||
buffer = sub;
|
||||
}
|
||||
|
@ -1092,21 +1149,17 @@ plugin_init (GstPlugin *plugin)
|
|||
if (!gst_library_load ("gsttags"))
|
||||
return FALSE;
|
||||
|
||||
if (!gst_element_register (plugin, "mad", GST_RANK_PRIMARY, gst_mad_get_type ()) ||
|
||||
!gst_element_register (plugin, "id3tag", GST_RANK_PRIMARY, gst_id3_tag_get_type ()))
|
||||
if (!gst_element_register (plugin, "mad", GST_RANK_PRIMARY,
|
||||
gst_mad_get_type ())
|
||||
|| !gst_element_register (plugin, "id3tag", GST_RANK_PRIMARY,
|
||||
gst_id3_tag_get_type ()))
|
||||
return FALSE;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
GST_PLUGIN_DEFINE (
|
||||
GST_VERSION_MAJOR,
|
||||
GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
|
||||
GST_VERSION_MINOR,
|
||||
"mad",
|
||||
"id3 tag manipulation and mp3 decoding based on the mad library",
|
||||
plugin_init,
|
||||
VERSION,
|
||||
"GPL",
|
||||
GST_PACKAGE,
|
||||
GST_ORIGIN
|
||||
)
|
||||
plugin_init, VERSION, "GPL", GST_PACKAGE, GST_ORIGIN)
|
||||
|
|
268
ext/mad/gstmad.c
268
ext/mad/gstmad.c
|
@ -38,7 +38,8 @@
|
|||
typedef struct _GstMad GstMad;
|
||||
typedef struct _GstMadClass GstMadClass;
|
||||
|
||||
struct _GstMad {
|
||||
struct _GstMad
|
||||
{
|
||||
GstElement element;
|
||||
|
||||
/* pads */
|
||||
|
@ -81,26 +82,28 @@ struct _GstMad {
|
|||
gboolean check_for_xing;
|
||||
};
|
||||
|
||||
struct _GstMadClass {
|
||||
struct _GstMadClass
|
||||
{
|
||||
GstElementClass parent_class;
|
||||
};
|
||||
|
||||
/* elementfactory information */
|
||||
static GstElementDetails gst_mad_details = GST_ELEMENT_DETAILS (
|
||||
"mad mp3 decoder",
|
||||
static GstElementDetails gst_mad_details =
|
||||
GST_ELEMENT_DETAILS ("mad mp3 decoder",
|
||||
"Codec/Decoder/Audio",
|
||||
"Uses mad code to decode mp3 streams",
|
||||
"Wim Taymans <wim.taymans@chello.be>"
|
||||
);
|
||||
"Wim Taymans <wim.taymans@chello.be>");
|
||||
|
||||
|
||||
/* Mad signals and args */
|
||||
enum {
|
||||
enum
|
||||
{
|
||||
/* FILL ME */
|
||||
LAST_SIGNAL
|
||||
};
|
||||
|
||||
enum {
|
||||
enum
|
||||
{
|
||||
ARG_0,
|
||||
ARG_HALF,
|
||||
ARG_IGNORE_CRC,
|
||||
|
@ -110,8 +113,7 @@ enum {
|
|||
};
|
||||
|
||||
static GstStaticPadTemplate mad_src_template_factory =
|
||||
GST_STATIC_PAD_TEMPLATE (
|
||||
"src",
|
||||
GST_STATIC_PAD_TEMPLATE ("src",
|
||||
GST_PAD_SRC,
|
||||
GST_PAD_ALWAYS,
|
||||
GST_STATIC_CAPS ("audio/x-raw-int, "
|
||||
|
@ -119,20 +121,15 @@ GST_STATIC_PAD_TEMPLATE (
|
|||
"signed = (boolean) true, "
|
||||
"width = (int) 16, "
|
||||
"depth = (int) 16, "
|
||||
"rate = (int) [ 11025, 48000 ], "
|
||||
"channels = (int) [ 1, 2 ]"
|
||||
)
|
||||
"rate = (int) [ 11025, 48000 ], " "channels = (int) [ 1, 2 ]")
|
||||
);
|
||||
|
||||
static GstStaticPadTemplate mad_sink_template_factory =
|
||||
GST_STATIC_PAD_TEMPLATE (
|
||||
"sink",
|
||||
GST_STATIC_PAD_TEMPLATE ("sink",
|
||||
GST_PAD_SINK,
|
||||
GST_PAD_ALWAYS,
|
||||
GST_STATIC_CAPS ("audio/mpeg, "
|
||||
"mpegversion = (int) 1, "
|
||||
"layer = (int) [ 1, 3 ]"
|
||||
)
|
||||
"mpegversion = (int) 1, " "layer = (int) [ 1, 3 ]")
|
||||
);
|
||||
|
||||
static void gst_mad_base_init (gpointer g_class);
|
||||
|
@ -146,32 +143,27 @@ static void gst_mad_get_property (GObject *object, guint prop_id,
|
|||
GValue * value, GParamSpec * pspec);
|
||||
|
||||
static gboolean gst_mad_src_event (GstPad * pad, GstEvent * event);
|
||||
static const GstFormat*
|
||||
gst_mad_get_formats (GstPad *pad);
|
||||
static const GstEventMask*
|
||||
gst_mad_get_event_masks (GstPad *pad);
|
||||
static const GstQueryType*
|
||||
gst_mad_get_query_types (GstPad *pad);
|
||||
static const GstFormat *gst_mad_get_formats (GstPad * pad);
|
||||
static const GstEventMask *gst_mad_get_event_masks (GstPad * pad);
|
||||
static const GstQueryType *gst_mad_get_query_types (GstPad * pad);
|
||||
|
||||
static gboolean gst_mad_src_query (GstPad * pad, GstQueryType type,
|
||||
GstFormat * format, gint64 * value);
|
||||
static gboolean gst_mad_convert_sink (GstPad * pad, GstFormat src_format,
|
||||
gint64 src_value, GstFormat
|
||||
*dest_format, gint64 *dest_value);
|
||||
gint64 src_value, GstFormat * dest_format, gint64 * dest_value);
|
||||
static gboolean gst_mad_convert_src (GstPad * pad, GstFormat src_format,
|
||||
gint64 src_value, GstFormat
|
||||
*dest_format, gint64 *dest_value);
|
||||
gint64 src_value, GstFormat * dest_format, gint64 * dest_value);
|
||||
|
||||
static void gst_mad_chain (GstPad * pad, GstData * _data);
|
||||
|
||||
static GstElementStateReturn
|
||||
gst_mad_change_state (GstElement *element);
|
||||
static GstElementStateReturn gst_mad_change_state (GstElement * element);
|
||||
|
||||
static void gst_mad_set_index (GstElement * element, GstIndex * index);
|
||||
static GstIndex *gst_mad_get_index (GstElement * element);
|
||||
|
||||
|
||||
static GstElementClass *parent_class = NULL;
|
||||
|
||||
/* static guint gst_mad_signals[LAST_SIGNAL] = { 0 }; */
|
||||
|
||||
GType
|
||||
|
@ -191,14 +183,16 @@ gst_mad_get_type (void)
|
|||
0,
|
||||
(GInstanceInitFunc) gst_mad_init,
|
||||
};
|
||||
mad_type = g_type_register_static(GST_TYPE_ELEMENT, "GstMad", &mad_info, 0);
|
||||
mad_type =
|
||||
g_type_register_static (GST_TYPE_ELEMENT, "GstMad", &mad_info, 0);
|
||||
}
|
||||
return mad_type;
|
||||
}
|
||||
|
||||
#define GST_TYPE_MAD_LAYER (gst_mad_layer_get_type())
|
||||
G_GNUC_UNUSED static GType
|
||||
gst_mad_layer_get_type(void) {
|
||||
gst_mad_layer_get_type (void)
|
||||
{
|
||||
static GType mad_layer_type = 0;
|
||||
static GEnumValue mad_layer[] = {
|
||||
{0, "0", "Unknown"},
|
||||
|
@ -215,7 +209,8 @@ gst_mad_layer_get_type(void) {
|
|||
|
||||
#define GST_TYPE_MAD_MODE (gst_mad_mode_get_type())
|
||||
G_GNUC_UNUSED static GType
|
||||
gst_mad_mode_get_type(void) {
|
||||
gst_mad_mode_get_type (void)
|
||||
{
|
||||
static GType mad_mode_type = 0;
|
||||
static GEnumValue mad_mode[] = {
|
||||
{-1, "-1", "Unknown"},
|
||||
|
@ -233,7 +228,8 @@ gst_mad_mode_get_type(void) {
|
|||
|
||||
#define GST_TYPE_MAD_EMPHASIS (gst_mad_emphasis_get_type())
|
||||
G_GNUC_UNUSED static GType
|
||||
gst_mad_emphasis_get_type(void) {
|
||||
gst_mad_emphasis_get_type (void)
|
||||
{
|
||||
static GType mad_emphasis_type = 0;
|
||||
static GEnumValue mad_emphasis[] = {
|
||||
{-1, "-1", "Unknown"},
|
||||
|
@ -307,22 +303,32 @@ static void
|
|||
gst_mad_init (GstMad * mad)
|
||||
{
|
||||
/* create the sink and src pads */
|
||||
mad->sinkpad = gst_pad_new_from_template(
|
||||
gst_static_pad_template_get (&mad_sink_template_factory), "sink");
|
||||
mad->sinkpad =
|
||||
gst_pad_new_from_template (gst_static_pad_template_get
|
||||
(&mad_sink_template_factory), "sink");
|
||||
gst_element_add_pad (GST_ELEMENT (mad), mad->sinkpad);
|
||||
gst_pad_set_chain_function (mad->sinkpad, GST_DEBUG_FUNCPTR (gst_mad_chain));
|
||||
gst_pad_set_convert_function (mad->sinkpad, GST_DEBUG_FUNCPTR (gst_mad_convert_sink));
|
||||
gst_pad_set_formats_function (mad->sinkpad, GST_DEBUG_FUNCPTR (gst_mad_get_formats));
|
||||
gst_pad_set_convert_function (mad->sinkpad,
|
||||
GST_DEBUG_FUNCPTR (gst_mad_convert_sink));
|
||||
gst_pad_set_formats_function (mad->sinkpad,
|
||||
GST_DEBUG_FUNCPTR (gst_mad_get_formats));
|
||||
|
||||
mad->srcpad = gst_pad_new_from_template(
|
||||
gst_static_pad_template_get (&mad_src_template_factory), "src");
|
||||
mad->srcpad =
|
||||
gst_pad_new_from_template (gst_static_pad_template_get
|
||||
(&mad_src_template_factory), "src");
|
||||
gst_element_add_pad (GST_ELEMENT (mad), mad->srcpad);
|
||||
gst_pad_set_event_function (mad->srcpad, GST_DEBUG_FUNCPTR (gst_mad_src_event));
|
||||
gst_pad_set_event_mask_function (mad->srcpad, GST_DEBUG_FUNCPTR (gst_mad_get_event_masks));
|
||||
gst_pad_set_query_function (mad->srcpad, GST_DEBUG_FUNCPTR (gst_mad_src_query));
|
||||
gst_pad_set_query_type_function (mad->srcpad, GST_DEBUG_FUNCPTR (gst_mad_get_query_types));
|
||||
gst_pad_set_convert_function (mad->srcpad, GST_DEBUG_FUNCPTR (gst_mad_convert_src));
|
||||
gst_pad_set_formats_function (mad->srcpad, GST_DEBUG_FUNCPTR (gst_mad_get_formats));
|
||||
gst_pad_set_event_function (mad->srcpad,
|
||||
GST_DEBUG_FUNCPTR (gst_mad_src_event));
|
||||
gst_pad_set_event_mask_function (mad->srcpad,
|
||||
GST_DEBUG_FUNCPTR (gst_mad_get_event_masks));
|
||||
gst_pad_set_query_function (mad->srcpad,
|
||||
GST_DEBUG_FUNCPTR (gst_mad_src_query));
|
||||
gst_pad_set_query_type_function (mad->srcpad,
|
||||
GST_DEBUG_FUNCPTR (gst_mad_get_query_types));
|
||||
gst_pad_set_convert_function (mad->srcpad,
|
||||
GST_DEBUG_FUNCPTR (gst_mad_convert_src));
|
||||
gst_pad_set_formats_function (mad->srcpad,
|
||||
GST_DEBUG_FUNCPTR (gst_mad_get_formats));
|
||||
gst_pad_use_explicit_caps (mad->srcpad);
|
||||
|
||||
mad->tempbuffer = g_malloc (MAD_BUFFER_MDLEN * 3);
|
||||
|
@ -400,8 +406,7 @@ static const GstEventMask*
|
|||
gst_mad_get_event_masks (GstPad * pad)
|
||||
{
|
||||
static const GstEventMask gst_mad_src_event_masks[] = {
|
||||
{ GST_EVENT_SEEK, GST_SEEK_METHOD_SET |
|
||||
GST_SEEK_FLAG_FLUSH },
|
||||
{GST_EVENT_SEEK, GST_SEEK_METHOD_SET | GST_SEEK_FLAG_FLUSH},
|
||||
{0,}
|
||||
};
|
||||
return gst_mad_src_event_masks;
|
||||
|
@ -500,7 +505,8 @@ gst_mad_convert_src (GstPad *pad, GstFormat src_format, gint64 src_value,
|
|||
scale = bytes_per_sample;
|
||||
/* fallthrough */
|
||||
case GST_FORMAT_DEFAULT:
|
||||
*dest_value = src_value * scale * mad->frame.header.samplerate / GST_SECOND;
|
||||
*dest_value =
|
||||
src_value * scale * mad->frame.header.samplerate / GST_SECOND;
|
||||
break;
|
||||
default:
|
||||
res = FALSE;
|
||||
|
@ -553,18 +559,16 @@ gst_mad_src_query (GstPad *pad, GstQueryType type,
|
|||
|
||||
/* do the probe */
|
||||
if (gst_pad_query (GST_PAD_PEER (mad->sinkpad), GST_QUERY_TOTAL,
|
||||
&peer_format, &peer_value))
|
||||
{
|
||||
&peer_format, &peer_value)) {
|
||||
GstFormat conv_format;
|
||||
|
||||
/* convert to TIME */
|
||||
conv_format = GST_FORMAT_TIME;
|
||||
res = gst_pad_convert (mad->sinkpad,
|
||||
peer_format, peer_value,
|
||||
&conv_format, value);
|
||||
peer_format, peer_value, &conv_format, value);
|
||||
/* and to final format */
|
||||
res &= gst_pad_convert (pad,
|
||||
GST_FORMAT_TIME, *value,
|
||||
format, value);
|
||||
GST_FORMAT_TIME, *value, format, value);
|
||||
}
|
||||
peer_formats++;
|
||||
}
|
||||
|
@ -582,8 +586,7 @@ gst_mad_src_query (GstPad *pad, GstQueryType type,
|
|||
{
|
||||
/* we only know about our samples, convert to requested format */
|
||||
res &= gst_pad_convert (pad,
|
||||
GST_FORMAT_DEFAULT, mad->total_samples,
|
||||
format, value);
|
||||
GST_FORMAT_DEFAULT, mad->total_samples, format, value);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -609,11 +612,11 @@ index_seek (GstMad *mad, GstPad *pad, GstEvent *event)
|
|||
const GstFormat *try_formats = try_all_formats;
|
||||
const GstFormat *peer_formats;
|
||||
|
||||
GstIndexEntry *entry =
|
||||
gst_index_get_assoc_entry (mad->index, mad->index_id,
|
||||
GstIndexEntry *entry = gst_index_get_assoc_entry (mad->index, mad->index_id,
|
||||
GST_INDEX_LOOKUP_BEFORE, 0,
|
||||
GST_EVENT_SEEK_FORMAT (event),
|
||||
GST_EVENT_SEEK_OFFSET (event));
|
||||
|
||||
if (!entry)
|
||||
return FALSE;
|
||||
|
||||
|
@ -630,12 +633,10 @@ index_seek (GstMad *mad, GstPad *pad, GstEvent *event)
|
|||
" -> %s %" G_GINT64_FORMAT,
|
||||
gst_format_get_details (GST_EVENT_SEEK_FORMAT (event))->nick,
|
||||
GST_EVENT_SEEK_OFFSET (event),
|
||||
gst_format_get_details (*try_formats)->nick,
|
||||
value);
|
||||
gst_format_get_details (*try_formats)->nick, value);
|
||||
|
||||
seek_event = gst_event_new_seek (*try_formats |
|
||||
GST_SEEK_METHOD_SET |
|
||||
GST_SEEK_FLAG_FLUSH, value);
|
||||
GST_SEEK_METHOD_SET | GST_SEEK_FLAG_FLUSH, value);
|
||||
|
||||
if (gst_pad_send_event (GST_PAD_PEER (mad->sinkpad), seek_event)) {
|
||||
/* seek worked, we're done, loop will exit */
|
||||
|
@ -665,8 +666,7 @@ normal_seek (GstMad *mad, GstPad *pad, GstEvent *event)
|
|||
/* first bring the src_format to TIME */
|
||||
if (!gst_pad_convert (pad,
|
||||
GST_EVENT_SEEK_FORMAT (event), GST_EVENT_SEEK_OFFSET (event),
|
||||
&format, &src_offset))
|
||||
{
|
||||
&format, &src_offset)) {
|
||||
/* didn't work, probably unsupported seek format then */
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -687,8 +687,7 @@ normal_seek (GstMad *mad, GstPad *pad, GstEvent *event)
|
|||
|
||||
/* try to convert requested format to one we can seek with on the sinkpad */
|
||||
if (gst_pad_convert (mad->sinkpad, GST_FORMAT_TIME, src_offset,
|
||||
&format, &desired_offset))
|
||||
{
|
||||
&format, &desired_offset)) {
|
||||
GstEvent *seek_event;
|
||||
|
||||
/* conversion succeeded, create the seek */
|
||||
|
@ -846,19 +845,20 @@ G_STMT_START{ \
|
|||
GEnumValue *mode;
|
||||
GEnumValue *emphasis;
|
||||
|
||||
mode = g_enum_get_value (g_type_class_ref (GST_TYPE_MAD_MODE), mad->header.mode);
|
||||
emphasis = g_enum_get_value (g_type_class_ref (GST_TYPE_MAD_EMPHASIS), mad->header.emphasis);
|
||||
mode =
|
||||
g_enum_get_value (g_type_class_ref (GST_TYPE_MAD_MODE),
|
||||
mad->header.mode);
|
||||
emphasis =
|
||||
g_enum_get_value (g_type_class_ref (GST_TYPE_MAD_EMPHASIS),
|
||||
mad->header.emphasis);
|
||||
list = gst_tag_list_new ();
|
||||
gst_tag_list_add (list, GST_TAG_MERGE_REPLACE,
|
||||
GST_TAG_LAYER, mad->header.layer,
|
||||
GST_TAG_MODE, mode->value_nick,
|
||||
GST_TAG_EMPHASIS, emphasis->value_nick,
|
||||
NULL);
|
||||
GST_TAG_EMPHASIS, emphasis->value_nick, NULL);
|
||||
gst_element_found_tags (GST_ELEMENT (mad), list);
|
||||
gst_tag_list_free (list);
|
||||
}
|
||||
|
||||
|
||||
#undef CHECK_HEADER
|
||||
|
||||
}
|
||||
|
@ -869,8 +869,7 @@ gst_mad_handle_event (GstPad *pad, GstBuffer *buffer)
|
|||
GstEvent *event = GST_EVENT (buffer);
|
||||
GstMad *mad = GST_MAD (gst_pad_get_parent (pad));
|
||||
|
||||
switch (GST_EVENT_TYPE (event))
|
||||
{
|
||||
switch (GST_EVENT_TYPE (event)) {
|
||||
case GST_EVENT_DISCONTINUOUS:
|
||||
{
|
||||
gint n = GST_EVENT_DISCONT_OFFSET_LEN (event);
|
||||
|
@ -878,13 +877,13 @@ gst_mad_handle_event (GstPad *pad, GstBuffer *buffer)
|
|||
|
||||
mad->total_samples = 0;
|
||||
|
||||
for (i = 0; i < n; i++)
|
||||
{
|
||||
for (i = 0; i < n; i++) {
|
||||
const GstFormat *formats;
|
||||
|
||||
formats = gst_pad_get_formats (pad);
|
||||
|
||||
if (gst_formats_contains (formats, GST_EVENT_DISCONT_OFFSET(event, i).format))
|
||||
{
|
||||
if (gst_formats_contains (formats, GST_EVENT_DISCONT_OFFSET (event,
|
||||
i).format)) {
|
||||
gint64 value = GST_EVENT_DISCONT_OFFSET (event, i).value;
|
||||
gint64 time;
|
||||
GstFormat format;
|
||||
|
@ -894,8 +893,7 @@ gst_mad_handle_event (GstPad *pad, GstBuffer *buffer)
|
|||
format = GST_FORMAT_TIME;
|
||||
if (!gst_pad_convert (pad,
|
||||
GST_EVENT_DISCONT_OFFSET (event, i).format,
|
||||
value, &format, &time))
|
||||
{
|
||||
value, &format, &time)) {
|
||||
time = 0;
|
||||
}
|
||||
|
||||
|
@ -903,15 +901,13 @@ gst_mad_handle_event (GstPad *pad, GstBuffer *buffer)
|
|||
* of samples */
|
||||
format = GST_FORMAT_DEFAULT;
|
||||
if (!gst_pad_convert (mad->srcpad,
|
||||
GST_FORMAT_TIME, time, &format, &mad->total_samples))
|
||||
{
|
||||
GST_FORMAT_TIME, time, &format, &mad->total_samples)) {
|
||||
mad->total_samples = 0;
|
||||
}
|
||||
|
||||
gst_event_unref (event);
|
||||
|
||||
if (GST_PAD_IS_USABLE (mad->srcpad))
|
||||
{
|
||||
if (GST_PAD_IS_USABLE (mad->srcpad)) {
|
||||
discont = gst_event_new_discontinuous (FALSE, GST_FORMAT_TIME,
|
||||
time, NULL);
|
||||
gst_pad_push (mad->srcpad, GST_DATA (discont));
|
||||
|
@ -935,6 +931,7 @@ static gboolean
|
|||
gst_mad_check_restart (GstMad * mad)
|
||||
{
|
||||
gboolean yes = mad->restart;
|
||||
|
||||
if (mad->restart) {
|
||||
mad->restart = FALSE;
|
||||
mad->tempsize = 0;
|
||||
|
@ -966,7 +963,8 @@ gst_mad_check_restart (GstMad *mad)
|
|||
#define XING_TOC_LENGTH 100
|
||||
|
||||
/* check for valid "Xing" VBR header */
|
||||
static int is_xhead(unsigned char *buf)
|
||||
static int
|
||||
is_xhead (unsigned char *buf)
|
||||
{
|
||||
return (BE_32 (buf) == XING_TAG);
|
||||
}
|
||||
|
@ -980,9 +978,9 @@ static int is_xhead(unsigned char *buf)
|
|||
#define lprintf(x...)
|
||||
#endif
|
||||
|
||||
static int mpg123_parse_xing_header(struct mad_header *header,
|
||||
const guint8 *buf, int bufsize, int *bitrate,
|
||||
int *time)
|
||||
static int
|
||||
mpg123_parse_xing_header (struct mad_header *header,
|
||||
const guint8 * buf, int bufsize, int *bitrate, int *time)
|
||||
{
|
||||
int i;
|
||||
guint8 *ptr = (guint8 *) buf;
|
||||
|
@ -990,16 +988,17 @@ static int mpg123_parse_xing_header(struct mad_header *header,
|
|||
int xflags, xframes, xbytes, xvbr_scale;
|
||||
int abr;
|
||||
guint8 xtoc[XING_TOC_LENGTH];
|
||||
|
||||
/* This should be the MPEG Audio version ID
|
||||
* (version 2.5, 2 or 1) least significant byte, but mad doesn't
|
||||
* provide that, so assume it's always MPEG 1
|
||||
*/
|
||||
int lsf_bit = 1;
|
||||
|
||||
xframes = xbytes = 0;
|
||||
|
||||
/* offset of the Xing header */
|
||||
if ( lsf_bit )
|
||||
{
|
||||
if (lsf_bit) {
|
||||
if (header->mode != MAD_MODE_STEREO)
|
||||
ptr += (32 + 4);
|
||||
else
|
||||
|
@ -1014,35 +1013,35 @@ static int mpg123_parse_xing_header(struct mad_header *header,
|
|||
if (ptr >= (buf + bufsize - 4))
|
||||
return 0;
|
||||
|
||||
if (is_xhead(ptr))
|
||||
{
|
||||
if (is_xhead (ptr)) {
|
||||
lprintf ("Xing header found\n");
|
||||
|
||||
ptr += 4; if (ptr >= (buf + bufsize - 4)) return 0;
|
||||
ptr += 4;
|
||||
if (ptr >= (buf + bufsize - 4))
|
||||
return 0;
|
||||
|
||||
xflags = BE_32 (ptr);
|
||||
ptr += 4;
|
||||
|
||||
if (xflags & XING_FRAMES_FLAG)
|
||||
{
|
||||
if (ptr >= (buf + bufsize - 4)) return 0;
|
||||
if (xflags & XING_FRAMES_FLAG) {
|
||||
if (ptr >= (buf + bufsize - 4))
|
||||
return 0;
|
||||
xframes = BE_32 (ptr);
|
||||
lprintf ("xframes: %d\n", xframes);
|
||||
ptr += 4;
|
||||
}
|
||||
if (xflags & XING_BYTES_FLAG)
|
||||
{
|
||||
if (ptr >= (buf + bufsize - 4)) return 0;
|
||||
if (xflags & XING_BYTES_FLAG) {
|
||||
if (ptr >= (buf + bufsize - 4))
|
||||
return 0;
|
||||
xbytes = BE_32 (ptr);
|
||||
lprintf ("xbytes: %d\n", xbytes);
|
||||
ptr += 4;
|
||||
}
|
||||
if (xflags & XING_TOC_FLAG)
|
||||
{
|
||||
if (xflags & XING_TOC_FLAG) {
|
||||
lprintf ("toc found\n");
|
||||
if (ptr >= (buf + bufsize - XING_TOC_LENGTH)) return 0;
|
||||
for (i = 0; i < XING_TOC_LENGTH; i++)
|
||||
{
|
||||
if (ptr >= (buf + bufsize - XING_TOC_LENGTH))
|
||||
return 0;
|
||||
for (i = 0; i < XING_TOC_LENGTH; i++) {
|
||||
xtoc[i] = *(ptr + i);
|
||||
lprintf ("%d ", xtoc[i]);
|
||||
}
|
||||
|
@ -1052,7 +1051,8 @@ static int mpg123_parse_xing_header(struct mad_header *header,
|
|||
|
||||
xvbr_scale = -1;
|
||||
if (xflags & XING_VBR_SCALE_FLAG) {
|
||||
if (ptr >= (buf + bufsize - 4)) return 0;
|
||||
if (ptr >= (buf + bufsize - 4))
|
||||
return 0;
|
||||
xvbr_scale = BE_32 (ptr);
|
||||
lprintf ("xvbr_scale: %d\n", xvbr_scale);
|
||||
}
|
||||
|
@ -1063,7 +1063,9 @@ static int mpg123_parse_xing_header(struct mad_header *header,
|
|||
frame_duration = 384.0 / (double) header->samplerate;
|
||||
} else {
|
||||
int slots_per_frame;
|
||||
slots_per_frame = ((header->layer == MAD_LAYER_III) && !lsf_bit) ? 72 : 144;
|
||||
|
||||
slots_per_frame = ((header->layer == MAD_LAYER_III)
|
||||
&& !lsf_bit) ? 72 : 144;
|
||||
frame_duration = slots_per_frame * 8.0 / (double) header->samplerate;
|
||||
}
|
||||
abr = ((double) xbytes * 8.0) / ((double) xframes * frame_duration);
|
||||
|
@ -1073,6 +1075,7 @@ static int mpg123_parse_xing_header(struct mad_header *header,
|
|||
}
|
||||
if (time != NULL) {
|
||||
*time = (double) xframes *frame_duration;
|
||||
|
||||
lprintf ("stream_length: %d s, %d min %d s\n", *time,
|
||||
*time / 60, *time % 60);
|
||||
}
|
||||
|
@ -1086,6 +1089,7 @@ static int mpg123_parse_xing_header(struct mad_header *header,
|
|||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/* End of Xine code */
|
||||
|
||||
|
||||
|
@ -1103,8 +1107,7 @@ gst_mad_chain (GstPad *pad, GstData *_data)
|
|||
g_return_if_fail (GST_IS_MAD (mad));
|
||||
|
||||
/* handle events */
|
||||
if (GST_IS_EVENT (buffer))
|
||||
{
|
||||
if (GST_IS_EVENT (buffer)) {
|
||||
gst_mad_handle_event (pad, buffer);
|
||||
return;
|
||||
}
|
||||
|
@ -1138,8 +1141,7 @@ gst_mad_chain (GstPad *pad, GstData *_data)
|
|||
|
||||
/* process the incoming buffer in chunks of maximum MAD_BUFFER_MDLEN bytes;
|
||||
* this is the upper limit on processable chunk sizes set by mad */
|
||||
while (size > 0)
|
||||
{
|
||||
while (size > 0) {
|
||||
gint tocopy;
|
||||
guchar *mad_input_buffer;
|
||||
|
||||
|
@ -1174,8 +1176,7 @@ gst_mad_chain (GstPad *pad, GstData *_data)
|
|||
if (!MAD_RECOVERABLE (mad->stream.error)) {
|
||||
GST_ELEMENT_ERROR (mad, STREAM, DECODE, (NULL), (NULL));
|
||||
return;
|
||||
}
|
||||
else if (mad->stream.error == MAD_ERROR_LOSTSYNC) {
|
||||
} else if (mad->stream.error == MAD_ERROR_LOSTSYNC) {
|
||||
/* lost sync, force a resync */
|
||||
signed long tagsize;
|
||||
|
||||
|
@ -1184,8 +1185,7 @@ gst_mad_chain (GstPad *pad, GstData *_data)
|
|||
|
||||
if (tagsize > mad->tempsize) {
|
||||
GST_INFO ("mad: got partial id3 tag in buffer, skipping");
|
||||
}
|
||||
else if (tagsize > 0) {
|
||||
} else if (tagsize > 0) {
|
||||
struct id3_tag *tag;
|
||||
id3_byte_t const *data;
|
||||
|
||||
|
@ -1233,13 +1233,11 @@ gst_mad_chain (GstPad *pad, GstData *_data)
|
|||
|
||||
/* Assume Xing headers can only be the first frame in a mp3 file */
|
||||
if (mpg123_parse_xing_header (&mad->frame.header,
|
||||
mad->stream.this_frame,
|
||||
frame_len, &bitrate, &time)) {
|
||||
mad->stream.this_frame, frame_len, &bitrate, &time)) {
|
||||
list = gst_tag_list_new ();
|
||||
gst_tag_list_add (list, GST_TAG_MERGE_REPLACE,
|
||||
GST_TAG_DURATION, (gint64) time * 1000 * 1000 * 1000,
|
||||
GST_TAG_BITRATE, bitrate,
|
||||
NULL);
|
||||
GST_TAG_BITRATE, bitrate, NULL);
|
||||
gst_element_found_tags (GST_ELEMENT (mad), list);
|
||||
if (GST_PAD_IS_USABLE (mad->srcpad)) {
|
||||
gst_pad_push (mad->srcpad, GST_DATA (gst_event_new_tag (list)));
|
||||
|
@ -1276,9 +1274,7 @@ gst_mad_chain (GstPad *pad, GstData *_data)
|
|||
"signed", G_TYPE_BOOLEAN, TRUE,
|
||||
"width", G_TYPE_INT, 16,
|
||||
"depth", G_TYPE_INT, 16,
|
||||
"rate", G_TYPE_INT, rate,
|
||||
"channels", G_TYPE_INT, nchannels,
|
||||
NULL);
|
||||
"rate", G_TYPE_INT, rate, "channels", G_TYPE_INT, nchannels, NULL);
|
||||
|
||||
gst_pad_set_explicit_caps (mad->srcpad, caps);
|
||||
gst_caps_free (caps);
|
||||
|
@ -1287,34 +1283,34 @@ gst_mad_chain (GstPad *pad, GstData *_data)
|
|||
}
|
||||
|
||||
if (mad->frame.header.samplerate == 0) {
|
||||
g_warning ("mad->frame.header.samplerate is 0; timestamps cannot be calculated");
|
||||
g_warning
|
||||
("mad->frame.header.samplerate is 0; timestamps cannot be calculated");
|
||||
time_offset = GST_CLOCK_TIME_NONE;
|
||||
time_duration = GST_CLOCK_TIME_NONE;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
/* if we have a pending timestamp, we can use it now to calculate the sample offset */
|
||||
if (GST_CLOCK_TIME_IS_VALID (mad->last_ts)) {
|
||||
GstFormat format = GST_FORMAT_DEFAULT;
|
||||
gst_pad_convert (mad->srcpad, GST_FORMAT_TIME, mad->last_ts, &format, &mad->total_samples);
|
||||
|
||||
gst_pad_convert (mad->srcpad, GST_FORMAT_TIME, mad->last_ts, &format,
|
||||
&mad->total_samples);
|
||||
mad->last_ts = GST_CLOCK_TIME_NONE;
|
||||
}
|
||||
time_offset = mad->total_samples * GST_SECOND
|
||||
/ mad->frame.header.samplerate;
|
||||
time_duration = (nsamples * GST_SECOND
|
||||
/ mad->frame.header.samplerate);
|
||||
time_duration = (nsamples * GST_SECOND / mad->frame.header.samplerate);
|
||||
}
|
||||
|
||||
if (mad->index) {
|
||||
guint64 x_bytes = mad->base_byte_offset + mad->bytes_consumed;
|
||||
|
||||
gst_index_add_association (mad->index, mad->index_id, 0,
|
||||
GST_FORMAT_BYTES, x_bytes,
|
||||
GST_FORMAT_TIME, time_offset,
|
||||
NULL);
|
||||
GST_FORMAT_BYTES, x_bytes, GST_FORMAT_TIME, time_offset, NULL);
|
||||
}
|
||||
|
||||
if (GST_PAD_IS_USABLE (mad->srcpad) &&
|
||||
mad->segment_start <= (time_offset == GST_CLOCK_TIME_NONE ? 0 : time_offset)) {
|
||||
mad->segment_start <= (time_offset ==
|
||||
GST_CLOCK_TIME_NONE ? 0 : time_offset)) {
|
||||
|
||||
/* for sample accurate seeking, calculate how many samples
|
||||
to skip and send the remaining pcm samples */
|
||||
|
@ -1337,11 +1333,13 @@ gst_mad_chain (GstPad *pad, GstData *_data)
|
|||
/* output sample(s) in 16-bit signed native-endian PCM */
|
||||
if (nchannels == 1) {
|
||||
gint count = nsamples;
|
||||
|
||||
while (count--) {
|
||||
*outdata++ = scale (*left_ch++) & 0xffff;
|
||||
}
|
||||
} else {
|
||||
gint count = nsamples;
|
||||
|
||||
while (count--) {
|
||||
*outdata++ = scale (*left_ch++) & 0xffff;
|
||||
*outdata++ = scale (*right_ch++) & 0xffff;
|
||||
|
@ -1409,8 +1407,10 @@ gst_mad_change_state (GstElement *element)
|
|||
mad->vbr_rate = 0;
|
||||
mad->frame.header.samplerate = 0;
|
||||
mad->last_ts = GST_CLOCK_TIME_NONE;
|
||||
if (mad->ignore_crc) options |= MAD_OPTION_IGNORECRC;
|
||||
if (mad->half) options |= MAD_OPTION_HALFSAMPLERATE;
|
||||
if (mad->ignore_crc)
|
||||
options |= MAD_OPTION_IGNORECRC;
|
||||
if (mad->half)
|
||||
options |= MAD_OPTION_HALFSAMPLERATE;
|
||||
mad_stream_options (&mad->stream, options);
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -26,10 +26,7 @@
|
|||
#include <mad.h>
|
||||
#include <id3tag.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
|
||||
GType gst_mad_get_type (void);
|
||||
G_BEGIN_DECLS GType gst_mad_get_type (void);
|
||||
GType gst_id3_parse_get_type (void);
|
||||
GType gst_id3_tag_get_type (void);
|
||||
|
||||
|
@ -38,5 +35,4 @@ struct id3_tag * gst_mad_tag_list_to_id3_tag (GstTagList * list);
|
|||
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GST_MAD_H__ */
|
||||
|
|
|
@ -35,6 +35,7 @@
|
|||
#define MPEG2_RELEASE MPEG2_VERSION(0,3,1)
|
||||
typedef picture_t mpeg2_picture_t;
|
||||
typedef gint mpeg2_state_t;
|
||||
|
||||
#define STATE_BUFFER 0
|
||||
#endif
|
||||
|
||||
|
@ -49,19 +50,20 @@ static GstElementDetails gst_mpeg2dec_details = {
|
|||
};
|
||||
|
||||
/* Mpeg2dec signals and args */
|
||||
enum {
|
||||
enum
|
||||
{
|
||||
/* FILL ME */
|
||||
LAST_SIGNAL
|
||||
};
|
||||
|
||||
enum {
|
||||
enum
|
||||
{
|
||||
ARG_0,
|
||||
/* FILL ME */
|
||||
};
|
||||
|
||||
static GstStaticPadTemplate src_template_factory =
|
||||
GST_STATIC_PAD_TEMPLATE (
|
||||
"src",
|
||||
GST_STATIC_PAD_TEMPLATE ("src",
|
||||
GST_PAD_SRC,
|
||||
GST_PAD_ALWAYS,
|
||||
GST_STATIC_CAPS ("video/x-raw-yuv, "
|
||||
|
@ -76,23 +78,18 @@ GST_STATIC_PAD_TEMPLATE (
|
|||
|
||||
#ifdef enable_user_data
|
||||
static GstStaticPadTemplate user_data_template_factory =
|
||||
GST_STATIC_PAD_TEMPLATE (
|
||||
"user_data",
|
||||
GST_STATIC_PAD_TEMPLATE ("user_data",
|
||||
GST_PAD_SRC,
|
||||
GST_PAD_ALWAYS,
|
||||
GST_STATIC_CAPS_ANY
|
||||
);
|
||||
GST_STATIC_CAPS_ANY);
|
||||
#endif
|
||||
|
||||
static GstStaticPadTemplate sink_template_factory =
|
||||
GST_STATIC_PAD_TEMPLATE (
|
||||
"sink",
|
||||
GST_STATIC_PAD_TEMPLATE ("sink",
|
||||
GST_PAD_SINK,
|
||||
GST_PAD_ALWAYS,
|
||||
GST_STATIC_CAPS ("video/mpeg, "
|
||||
"mpegversion = (int) [ 1, 2 ], "
|
||||
"systemstream = (boolean) false"
|
||||
)
|
||||
"mpegversion = (int) [ 1, 2 ], " "systemstream = (boolean) false")
|
||||
);
|
||||
|
||||
static void gst_mpeg2dec_base_init (gpointer g_class);
|
||||
|
@ -108,29 +105,25 @@ static void gst_mpeg2dec_get_property (GObject *object, guint prop_id,
|
|||
static void gst_mpeg2dec_set_index (GstElement * element, GstIndex * index);
|
||||
static GstIndex *gst_mpeg2dec_get_index (GstElement * element);
|
||||
|
||||
static const GstFormat*
|
||||
gst_mpeg2dec_get_src_formats (GstPad *pad);
|
||||
static const GstEventMask*
|
||||
gst_mpeg2dec_get_src_event_masks (GstPad *pad);
|
||||
static const GstFormat *gst_mpeg2dec_get_src_formats (GstPad * pad);
|
||||
static const GstEventMask *gst_mpeg2dec_get_src_event_masks (GstPad * pad);
|
||||
static gboolean gst_mpeg2dec_src_event (GstPad * pad, GstEvent * event);
|
||||
static const GstQueryType*
|
||||
gst_mpeg2dec_get_src_query_types (GstPad *pad);
|
||||
static const GstQueryType *gst_mpeg2dec_get_src_query_types (GstPad * pad);
|
||||
static gboolean gst_mpeg2dec_src_query (GstPad * pad, GstQueryType type,
|
||||
GstFormat * format, gint64 * value);
|
||||
|
||||
static const GstFormat*
|
||||
gst_mpeg2dec_get_sink_formats (GstPad *pad);
|
||||
static gboolean gst_mpeg2dec_convert_sink (GstPad *pad, GstFormat src_format, gint64 src_value,
|
||||
GstFormat *dest_format, gint64 *dest_value);
|
||||
static gboolean gst_mpeg2dec_convert_src (GstPad *pad, GstFormat src_format, gint64 src_value,
|
||||
GstFormat *dest_format, gint64 *dest_value);
|
||||
static const GstFormat *gst_mpeg2dec_get_sink_formats (GstPad * pad);
|
||||
static gboolean gst_mpeg2dec_convert_sink (GstPad * pad, GstFormat src_format,
|
||||
gint64 src_value, GstFormat * dest_format, gint64 * dest_value);
|
||||
static gboolean gst_mpeg2dec_convert_src (GstPad * pad, GstFormat src_format,
|
||||
gint64 src_value, GstFormat * dest_format, gint64 * dest_value);
|
||||
|
||||
static GstElementStateReturn
|
||||
gst_mpeg2dec_change_state (GstElement *element);
|
||||
static GstElementStateReturn gst_mpeg2dec_change_state (GstElement * element);
|
||||
|
||||
static void gst_mpeg2dec_chain (GstPad * pad, GstData * _data);
|
||||
|
||||
static GstElementClass *parent_class = NULL;
|
||||
|
||||
/*static guint gst_mpeg2dec_signals[LAST_SIGNAL] = { 0 };*/
|
||||
|
||||
GType
|
||||
|
@ -150,7 +143,9 @@ gst_mpeg2dec_get_type (void)
|
|||
0,
|
||||
(GInstanceInitFunc) gst_mpeg2dec_init,
|
||||
};
|
||||
mpeg2dec_type = g_type_register_static(GST_TYPE_ELEMENT, "GstMpeg2dec", &mpeg2dec_info, 0);
|
||||
mpeg2dec_type =
|
||||
g_type_register_static (GST_TYPE_ELEMENT, "GstMpeg2dec", &mpeg2dec_info,
|
||||
0);
|
||||
}
|
||||
return mpeg2dec_type;
|
||||
}
|
||||
|
@ -160,10 +155,13 @@ gst_mpeg2dec_base_init (gpointer g_class)
|
|||
{
|
||||
GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
|
||||
|
||||
gst_element_class_add_pad_template (element_class, gst_static_pad_template_get (&src_template_factory));
|
||||
gst_element_class_add_pad_template (element_class, gst_static_pad_template_get (&sink_template_factory));
|
||||
gst_element_class_add_pad_template (element_class,
|
||||
gst_static_pad_template_get (&src_template_factory));
|
||||
gst_element_class_add_pad_template (element_class,
|
||||
gst_static_pad_template_get (&sink_template_factory));
|
||||
#ifdef enable_user_data
|
||||
gst_element_class_add_pad_template (element_class, gst_static_pad_template_get (&user_data_template_factory));
|
||||
gst_element_class_add_pad_template (element_class,
|
||||
gst_static_pad_template_get (&user_data_template_factory));
|
||||
#endif
|
||||
gst_element_class_set_details (element_class, &gst_mpeg2dec_details);
|
||||
}
|
||||
|
@ -192,27 +190,39 @@ static void
|
|||
gst_mpeg2dec_init (GstMpeg2dec * mpeg2dec)
|
||||
{
|
||||
/* create the sink and src pads */
|
||||
mpeg2dec->sinkpad = gst_pad_new_from_template (
|
||||
gst_static_pad_template_get (&sink_template_factory), "sink");
|
||||
mpeg2dec->sinkpad =
|
||||
gst_pad_new_from_template (gst_static_pad_template_get
|
||||
(&sink_template_factory), "sink");
|
||||
gst_element_add_pad (GST_ELEMENT (mpeg2dec), mpeg2dec->sinkpad);
|
||||
gst_pad_set_chain_function (mpeg2dec->sinkpad, GST_DEBUG_FUNCPTR (gst_mpeg2dec_chain));
|
||||
gst_pad_set_formats_function (mpeg2dec->sinkpad, GST_DEBUG_FUNCPTR (gst_mpeg2dec_get_sink_formats));
|
||||
gst_pad_set_convert_function (mpeg2dec->sinkpad, GST_DEBUG_FUNCPTR (gst_mpeg2dec_convert_sink));
|
||||
gst_pad_set_chain_function (mpeg2dec->sinkpad,
|
||||
GST_DEBUG_FUNCPTR (gst_mpeg2dec_chain));
|
||||
gst_pad_set_formats_function (mpeg2dec->sinkpad,
|
||||
GST_DEBUG_FUNCPTR (gst_mpeg2dec_get_sink_formats));
|
||||
gst_pad_set_convert_function (mpeg2dec->sinkpad,
|
||||
GST_DEBUG_FUNCPTR (gst_mpeg2dec_convert_sink));
|
||||
|
||||
mpeg2dec->srcpad = gst_pad_new_from_template (
|
||||
gst_static_pad_template_get (&src_template_factory), "src");
|
||||
mpeg2dec->srcpad =
|
||||
gst_pad_new_from_template (gst_static_pad_template_get
|
||||
(&src_template_factory), "src");
|
||||
gst_element_add_pad (GST_ELEMENT (mpeg2dec), mpeg2dec->srcpad);
|
||||
gst_pad_use_explicit_caps (mpeg2dec->srcpad);
|
||||
gst_pad_set_formats_function (mpeg2dec->srcpad, GST_DEBUG_FUNCPTR (gst_mpeg2dec_get_src_formats));
|
||||
gst_pad_set_event_mask_function (mpeg2dec->srcpad, GST_DEBUG_FUNCPTR (gst_mpeg2dec_get_src_event_masks));
|
||||
gst_pad_set_event_function (mpeg2dec->srcpad, GST_DEBUG_FUNCPTR (gst_mpeg2dec_src_event));
|
||||
gst_pad_set_query_type_function (mpeg2dec->srcpad, GST_DEBUG_FUNCPTR (gst_mpeg2dec_get_src_query_types));
|
||||
gst_pad_set_query_function (mpeg2dec->srcpad, GST_DEBUG_FUNCPTR (gst_mpeg2dec_src_query));
|
||||
gst_pad_set_convert_function (mpeg2dec->srcpad, GST_DEBUG_FUNCPTR (gst_mpeg2dec_convert_src));
|
||||
gst_pad_set_formats_function (mpeg2dec->srcpad,
|
||||
GST_DEBUG_FUNCPTR (gst_mpeg2dec_get_src_formats));
|
||||
gst_pad_set_event_mask_function (mpeg2dec->srcpad,
|
||||
GST_DEBUG_FUNCPTR (gst_mpeg2dec_get_src_event_masks));
|
||||
gst_pad_set_event_function (mpeg2dec->srcpad,
|
||||
GST_DEBUG_FUNCPTR (gst_mpeg2dec_src_event));
|
||||
gst_pad_set_query_type_function (mpeg2dec->srcpad,
|
||||
GST_DEBUG_FUNCPTR (gst_mpeg2dec_get_src_query_types));
|
||||
gst_pad_set_query_function (mpeg2dec->srcpad,
|
||||
GST_DEBUG_FUNCPTR (gst_mpeg2dec_src_query));
|
||||
gst_pad_set_convert_function (mpeg2dec->srcpad,
|
||||
GST_DEBUG_FUNCPTR (gst_mpeg2dec_convert_src));
|
||||
|
||||
#ifdef enable_user_data
|
||||
mpeg2dec->userdatapad = gst_pad_new_from_template (
|
||||
gst_static_pad_template_get (&user_data_template_factory), "user_data");
|
||||
mpeg2dec->userdatapad =
|
||||
gst_pad_new_from_template (gst_static_pad_template_get
|
||||
(&user_data_template_factory), "user_data");
|
||||
gst_element_add_pad (GST_ELEMENT (mpeg2dec), mpeg2dec->userdatapad);
|
||||
#endif
|
||||
|
||||
|
@ -272,7 +282,8 @@ gst_mpeg2dec_get_index (GstElement *element)
|
|||
}
|
||||
|
||||
static GstBuffer *
|
||||
gst_mpeg2dec_alloc_buffer (GstMpeg2dec *mpeg2dec, const mpeg2_info_t *info, gint64 offset)
|
||||
gst_mpeg2dec_alloc_buffer (GstMpeg2dec * mpeg2dec, const mpeg2_info_t * info,
|
||||
gint64 offset)
|
||||
{
|
||||
GstBuffer *outbuf = NULL;
|
||||
gint size = mpeg2dec->width * mpeg2dec->height;
|
||||
|
@ -287,8 +298,7 @@ gst_mpeg2dec_alloc_buffer (GstMpeg2dec *mpeg2dec, const mpeg2_info_t *info, gint
|
|||
if (mpeg2dec->format == MPEG2DEC_FORMAT_I420) {
|
||||
buf[1] = buf[0] + size;
|
||||
buf[2] = buf[1] + size / 4;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
buf[2] = buf[0] + size;
|
||||
buf[1] = buf[2] + size / 4;
|
||||
}
|
||||
|
@ -298,10 +308,10 @@ gst_mpeg2dec_alloc_buffer (GstMpeg2dec *mpeg2dec, const mpeg2_info_t *info, gint
|
|||
|
||||
picture = info->current_picture;
|
||||
|
||||
if (picture && (picture->flags & PIC_MASK_CODING_TYPE) == PIC_FLAG_CODING_TYPE_I) {
|
||||
if (picture
|
||||
&& (picture->flags & PIC_MASK_CODING_TYPE) == PIC_FLAG_CODING_TYPE_I) {
|
||||
GST_BUFFER_FLAG_SET (outbuf, GST_BUFFER_KEY_UNIT);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
GST_BUFFER_FLAG_UNSET (outbuf, GST_BUFFER_KEY_UNIT);
|
||||
}
|
||||
/* we store the original byteoffset of this picture in the stream here
|
||||
|
@ -333,7 +343,8 @@ gst_mpeg2dec_negotiate_format (GstMpeg2dec *mpeg2dec)
|
|||
NULL);
|
||||
|
||||
ret = gst_pad_set_explicit_caps (mpeg2dec->srcpad, caps);
|
||||
if (!ret) return FALSE;
|
||||
if (!ret)
|
||||
return FALSE;
|
||||
|
||||
/* it worked, try to find what it was again */
|
||||
gst_structure_get_fourcc (gst_caps_get_structure (caps, 0),
|
||||
|
@ -361,14 +372,17 @@ update_streaminfo (GstMpeg2dec *mpeg2dec)
|
|||
|
||||
props = gst_props_empty_new ();
|
||||
|
||||
entry = gst_props_entry_new ("framerate", G_TYPE_DOUBLE (GST_SECOND/(float)mpeg2dec->frame_period));
|
||||
entry =
|
||||
gst_props_entry_new ("framerate",
|
||||
G_TYPE_DOUBLE (GST_SECOND / (float) mpeg2dec->frame_period));
|
||||
gst_props_add_entry (props, entry);
|
||||
entry = gst_props_entry_new ("bitrate", G_TYPE_INT (info->sequence->byte_rate * 8));
|
||||
entry =
|
||||
gst_props_entry_new ("bitrate",
|
||||
G_TYPE_INT (info->sequence->byte_rate * 8));
|
||||
gst_props_add_entry (props, entry);
|
||||
|
||||
caps = gst_caps_new ("mpeg2dec_streaminfo",
|
||||
"application/x-gst-streaminfo",
|
||||
props);
|
||||
"application/x-gst-streaminfo", props);
|
||||
|
||||
gst_caps_replace_sink (&mpeg2dec->streaminfo, caps);
|
||||
g_object_notify (G_OBJECT (mpeg2dec), "streaminfo");
|
||||
|
@ -444,12 +458,12 @@ gst_mpeg2dec_chain (GstPad *pad, GstData *_data)
|
|||
mpeg_pts, MPEGTIME_TO_GSTTIME (mpeg_pts));
|
||||
|
||||
#if MPEG2_RELEASE >= MPEG2_VERSION(0,4,0)
|
||||
mpeg2_tag_picture (mpeg2dec->decoder, mpeg_pts&0xffffffff, mpeg_pts>>32);
|
||||
mpeg2_tag_picture (mpeg2dec->decoder, mpeg_pts & 0xffffffff,
|
||||
mpeg_pts >> 32);
|
||||
#else
|
||||
mpeg2_pts (mpeg2dec->decoder, mpeg_pts);
|
||||
#endif
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
GST_DEBUG ("no pts");
|
||||
}
|
||||
|
||||
|
@ -471,14 +485,16 @@ gst_mpeg2dec_chain (GstPad *pad, GstData *_data)
|
|||
mpeg2dec->pixel_width = info->sequence->pixel_width;
|
||||
mpeg2dec->pixel_height = info->sequence->pixel_height;
|
||||
mpeg2dec->total_frames = 0;
|
||||
mpeg2dec->frame_period = info->sequence->frame_period * GST_USECOND / 27;
|
||||
mpeg2dec->frame_period =
|
||||
info->sequence->frame_period * GST_USECOND / 27;
|
||||
|
||||
GST_DEBUG ("sequence flags: %d, frame period: %d",
|
||||
info->sequence->flags, info->sequence->frame_period);
|
||||
GST_DEBUG ("profile: %02x, colour_primaries: %d",
|
||||
info->sequence->profile_level_id, info->sequence->colour_primaries);
|
||||
GST_DEBUG ("transfer chars: %d, matrix coef: %d",
|
||||
info->sequence->transfer_characteristics, info->sequence->matrix_coefficients);
|
||||
info->sequence->transfer_characteristics,
|
||||
info->sequence->matrix_coefficients);
|
||||
|
||||
if (!gst_mpeg2dec_negotiate_format (mpeg2dec)) {
|
||||
GST_ELEMENT_ERROR (mpeg2dec, CORE, NEGOTIATION, (NULL), (NULL));
|
||||
|
@ -495,7 +511,9 @@ gst_mpeg2dec_chain (GstPad *pad, GstData *_data)
|
|||
|
||||
mpeg2dec->need_sequence = FALSE;
|
||||
if (mpeg2dec->pending_event) {
|
||||
done = GST_EVENT_SEEK_FLAGS (mpeg2dec->pending_event) & GST_SEEK_FLAG_FLUSH;
|
||||
done =
|
||||
GST_EVENT_SEEK_FLAGS (mpeg2dec->
|
||||
pending_event) & GST_SEEK_FLAG_FLUSH;
|
||||
|
||||
gst_mpeg2dec_src_event (mpeg2dec->srcpad, mpeg2dec->pending_event);
|
||||
mpeg2dec->pending_event = NULL;
|
||||
|
@ -512,9 +530,12 @@ gst_mpeg2dec_chain (GstPad *pad, GstData *_data)
|
|||
GstBuffer *outbuf;
|
||||
|
||||
if (info->current_picture) {
|
||||
key_frame = (info->current_picture->flags & PIC_MASK_CODING_TYPE) == PIC_FLAG_CODING_TYPE_I;
|
||||
key_frame =
|
||||
(info->current_picture->flags & PIC_MASK_CODING_TYPE) ==
|
||||
PIC_FLAG_CODING_TYPE_I;
|
||||
}
|
||||
outbuf = gst_mpeg2dec_alloc_buffer (mpeg2dec, info, GST_BUFFER_OFFSET (buf));
|
||||
outbuf =
|
||||
gst_mpeg2dec_alloc_buffer (mpeg2dec, info, GST_BUFFER_OFFSET (buf));
|
||||
|
||||
GST_DEBUG ("picture %d, %p, %" G_GINT64_FORMAT ", %" G_GINT64_FORMAT,
|
||||
key_frame, outbuf, GST_BUFFER_OFFSET (outbuf), pts);
|
||||
|
@ -548,7 +569,8 @@ gst_mpeg2dec_chain (GstPad *pad, GstData *_data)
|
|||
if (!slice) {
|
||||
mpeg2dec->need_sequence = TRUE;
|
||||
}
|
||||
GST_DEBUG ("picture end %p %p %p %p", info->display_fbuf, info->display_picture, info->current_picture,
|
||||
GST_DEBUG ("picture end %p %p %p %p", info->display_fbuf,
|
||||
info->display_picture, info->current_picture,
|
||||
(info->display_fbuf ? info->display_fbuf->id : NULL));
|
||||
|
||||
if (info->display_fbuf && info->display_fbuf->id) {
|
||||
|
@ -558,13 +580,15 @@ gst_mpeg2dec_chain (GstPad *pad, GstData *_data)
|
|||
outbuf = (GstBuffer *) info->display_fbuf->id;
|
||||
picture = info->display_picture;
|
||||
|
||||
key_frame = (picture->flags & PIC_MASK_CODING_TYPE) == PIC_FLAG_CODING_TYPE_I;
|
||||
key_frame =
|
||||
(picture->flags & PIC_MASK_CODING_TYPE) == PIC_FLAG_CODING_TYPE_I;
|
||||
GST_DEBUG ("picture keyfame %d", key_frame);
|
||||
|
||||
if (key_frame) {
|
||||
GST_BUFFER_FLAG_SET (outbuf, GST_BUFFER_KEY_UNIT);
|
||||
}
|
||||
if (mpeg2dec->discont_state == MPEG2DEC_DISC_NEW_KEYFRAME && key_frame)
|
||||
if (mpeg2dec->discont_state == MPEG2DEC_DISC_NEW_KEYFRAME
|
||||
&& key_frame)
|
||||
mpeg2dec->discont_state = MPEG2DEC_DISC_NONE;
|
||||
|
||||
#if MPEG2_RELEASE < MPEG2_VERSION(0,4,0)
|
||||
|
@ -572,25 +596,28 @@ gst_mpeg2dec_chain (GstPad *pad, GstData *_data)
|
|||
GstClockTime time = MPEGTIME_TO_GSTTIME (picture->pts);
|
||||
#else
|
||||
if (picture->flags & PIC_FLAG_TAGS) {
|
||||
GstClockTime time = MPEGTIME_TO_GSTTIME ((guint64) picture->tag2 << 32 | picture->tag);
|
||||
GstClockTime time =
|
||||
MPEGTIME_TO_GSTTIME ((guint64) picture->tag2 << 32 | picture->
|
||||
tag);
|
||||
#endif
|
||||
|
||||
GST_DEBUG ("picture had pts %" G_GINT64_FORMAT, time);
|
||||
GST_BUFFER_TIMESTAMP (outbuf) = mpeg2dec->next_time = time;
|
||||
}
|
||||
else {
|
||||
GST_DEBUG ("picture didn't have pts using %" G_GINT64_FORMAT, mpeg2dec->next_time);
|
||||
} else {
|
||||
GST_DEBUG ("picture didn't have pts using %" G_GINT64_FORMAT,
|
||||
mpeg2dec->next_time);
|
||||
GST_BUFFER_TIMESTAMP (outbuf) = mpeg2dec->next_time;
|
||||
}
|
||||
|
||||
mpeg2dec->next_time += (mpeg2dec->frame_period * picture->nb_fields) >> 1;
|
||||
mpeg2dec->next_time +=
|
||||
(mpeg2dec->frame_period * picture->nb_fields) >> 1;
|
||||
|
||||
|
||||
GST_DEBUG ("picture: %s %s fields:%d off:%" G_GINT64_FORMAT " ts:%" G_GINT64_FORMAT,
|
||||
GST_DEBUG ("picture: %s %s fields:%d off:%" G_GINT64_FORMAT " ts:%"
|
||||
G_GINT64_FORMAT,
|
||||
(picture->flags & PIC_FLAG_TOP_FIELD_FIRST ? "tff " : " "),
|
||||
(picture->flags & PIC_FLAG_PROGRESSIVE_FRAME ? "prog" : " "),
|
||||
picture->nb_fields,
|
||||
GST_BUFFER_OFFSET (outbuf),
|
||||
picture->nb_fields, GST_BUFFER_OFFSET (outbuf),
|
||||
GST_BUFFER_TIMESTAMP (outbuf));
|
||||
|
||||
if (mpeg2dec->index) {
|
||||
|
@ -604,12 +631,9 @@ gst_mpeg2dec_chain (GstPad *pad, GstData *_data)
|
|||
if (picture->flags & PIC_FLAG_SKIP ||
|
||||
!GST_PAD_IS_USABLE (mpeg2dec->srcpad) ||
|
||||
mpeg2dec->discont_state != MPEG2DEC_DISC_NONE ||
|
||||
mpeg2dec->next_time < mpeg2dec->segment_start ||
|
||||
skip)
|
||||
{
|
||||
mpeg2dec->next_time < mpeg2dec->segment_start || skip) {
|
||||
gst_buffer_unref (outbuf);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
/* TODO set correct offset here based on frame number */
|
||||
GST_BUFFER_DURATION (outbuf) = mpeg2dec->frame_period;
|
||||
gst_pad_push (mpeg2dec->srcpad, GST_DATA (outbuf));
|
||||
|
@ -634,8 +658,7 @@ gst_mpeg2dec_chain (GstPad *pad, GstData *_data)
|
|||
break;
|
||||
default:
|
||||
g_warning ("%s: unhandled state %d, FIXME",
|
||||
gst_element_get_name (GST_ELEMENT (mpeg2dec)),
|
||||
state);
|
||||
gst_element_get_name (GST_ELEMENT (mpeg2dec)), state);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -768,7 +791,8 @@ gst_mpeg2dec_convert_src (GstPad *pad, GstFormat src_format, gint64 src_value,
|
|||
*dest_value = src_value * mpeg2dec->frame_period;
|
||||
break;
|
||||
case GST_FORMAT_BYTES:
|
||||
*dest_value = src_value * 6 * ((mpeg2dec->width * mpeg2dec->height) >> 2);
|
||||
*dest_value =
|
||||
src_value * 6 * ((mpeg2dec->width * mpeg2dec->height) >> 2);
|
||||
break;
|
||||
default:
|
||||
res = FALSE;
|
||||
|
@ -822,20 +846,17 @@ gst_mpeg2dec_src_query (GstPad *pad, GstQueryType type,
|
|||
peer_format = *formats;
|
||||
|
||||
/* do the probe */
|
||||
if (gst_pad_query (GST_PAD_PEER (mpeg2dec->sinkpad), GST_QUERY_TOTAL,
|
||||
&peer_format, &peer_value))
|
||||
{
|
||||
if (gst_pad_query (GST_PAD_PEER (mpeg2dec->sinkpad),
|
||||
GST_QUERY_TOTAL, &peer_format, &peer_value)) {
|
||||
GstFormat conv_format;
|
||||
|
||||
/* convert to TIME */
|
||||
conv_format = GST_FORMAT_TIME;
|
||||
res = gst_pad_convert (mpeg2dec->sinkpad,
|
||||
peer_format, peer_value,
|
||||
&conv_format, value);
|
||||
peer_format, peer_value, &conv_format, value);
|
||||
/* and to final format */
|
||||
res &= gst_pad_convert (pad,
|
||||
GST_FORMAT_TIME, *value,
|
||||
format, value);
|
||||
GST_FORMAT_TIME, *value, format, value);
|
||||
}
|
||||
formats++;
|
||||
}
|
||||
|
@ -852,8 +873,7 @@ gst_mpeg2dec_src_query (GstPad *pad, GstQueryType type,
|
|||
switch (*format) {
|
||||
default:
|
||||
res = gst_pad_convert (pad,
|
||||
GST_FORMAT_TIME, mpeg2dec->next_time,
|
||||
format, value);
|
||||
GST_FORMAT_TIME, mpeg2dec->next_time, format, value);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
@ -888,14 +908,13 @@ index_seek (GstPad *pad, GstEvent *event)
|
|||
|
||||
entry = gst_index_get_assoc_entry (mpeg2dec->index, mpeg2dec->index_id,
|
||||
GST_INDEX_LOOKUP_BEFORE, GST_ASSOCIATION_FLAG_KEY_UNIT,
|
||||
GST_EVENT_SEEK_FORMAT (event),
|
||||
GST_EVENT_SEEK_OFFSET (event));
|
||||
GST_EVENT_SEEK_FORMAT (event), GST_EVENT_SEEK_OFFSET (event));
|
||||
|
||||
if (entry) {
|
||||
const GstFormat *peer_formats, *try_formats;
|
||||
|
||||
/* since we know the exaxt byteoffset of the frame, make sure to seek on bytes first */
|
||||
const GstFormat try_all_formats[] =
|
||||
{
|
||||
const GstFormat try_all_formats[] = {
|
||||
GST_FORMAT_BYTES,
|
||||
GST_FORMAT_TIME,
|
||||
0
|
||||
|
@ -914,11 +933,12 @@ index_seek (GstPad *pad, GstEvent *event)
|
|||
" -> %s %" G_GINT64_FORMAT,
|
||||
gst_format_get_details (GST_EVENT_SEEK_FORMAT (event))->nick,
|
||||
GST_EVENT_SEEK_OFFSET (event),
|
||||
gst_format_get_details (*try_formats)->nick,
|
||||
value);
|
||||
gst_format_get_details (*try_formats)->nick, value);
|
||||
|
||||
/* lookup succeeded, create the seek */
|
||||
seek_event = gst_event_new_seek (*try_formats | GST_SEEK_METHOD_SET | GST_SEEK_FLAG_FLUSH, value);
|
||||
seek_event =
|
||||
gst_event_new_seek (*try_formats | GST_SEEK_METHOD_SET |
|
||||
GST_SEEK_FLAG_FLUSH, value);
|
||||
/* do the seekk */
|
||||
if (gst_pad_send_event (GST_PAD_PEER (mpeg2dec->sinkpad), seek_event)) {
|
||||
/* seek worked, we're done, loop will exit */
|
||||
|
@ -951,8 +971,7 @@ normal_seek (GstPad *pad, GstEvent *event)
|
|||
/* first bring the src_format to TIME */
|
||||
if (!gst_pad_convert (pad,
|
||||
GST_EVENT_SEEK_FORMAT (event), GST_EVENT_SEEK_OFFSET (event),
|
||||
&format, &src_offset))
|
||||
{
|
||||
&format, &src_offset)) {
|
||||
/* didn't work, probably unsupported seek format then */
|
||||
return res;
|
||||
}
|
||||
|
@ -970,12 +989,14 @@ normal_seek (GstPad *pad, GstEvent *event)
|
|||
format = *peer_formats;
|
||||
|
||||
/* try to convert requested format to one we can seek with on the sinkpad */
|
||||
if (gst_pad_convert (mpeg2dec->sinkpad, GST_FORMAT_TIME, src_offset, &format, &desired_offset))
|
||||
{
|
||||
if (gst_pad_convert (mpeg2dec->sinkpad, GST_FORMAT_TIME, src_offset,
|
||||
&format, &desired_offset)) {
|
||||
GstEvent *seek_event;
|
||||
|
||||
/* conversion succeeded, create the seek */
|
||||
seek_event = gst_event_new_seek (format | GST_SEEK_METHOD_SET | flush, desired_offset);
|
||||
seek_event =
|
||||
gst_event_new_seek (format | GST_SEEK_METHOD_SET | flush,
|
||||
desired_offset);
|
||||
/* do the seekk */
|
||||
if (gst_pad_send_event (GST_PAD_PEER (mpeg2dec->sinkpad), seek_event)) {
|
||||
/* seek worked, we're done, loop will exit */
|
||||
|
@ -995,6 +1016,7 @@ normal_seek (GstPad *pad, GstEvent *event)
|
|||
|
||||
return res;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gst_mpeg2dec_src_event (GstPad * pad, GstEvent * event)
|
||||
{
|
||||
|
@ -1012,8 +1034,7 @@ gst_mpeg2dec_src_event (GstPad *pad, GstEvent *event)
|
|||
if (mpeg2dec->need_sequence) {
|
||||
mpeg2dec->pending_event = event;
|
||||
return TRUE;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
if (mpeg2dec->index)
|
||||
res = index_seek (pad, event);
|
||||
else
|
||||
|
@ -1075,7 +1096,8 @@ gst_mpeg2dec_change_state (GstElement *element)
|
|||
}
|
||||
|
||||
static void
|
||||
gst_mpeg2dec_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec)
|
||||
gst_mpeg2dec_set_property (GObject * object, guint prop_id,
|
||||
const GValue * value, GParamSpec * pspec)
|
||||
{
|
||||
GstMpeg2dec *src;
|
||||
|
||||
|
@ -1090,7 +1112,8 @@ gst_mpeg2dec_set_property (GObject *object, guint prop_id, const GValue *value,
|
|||
}
|
||||
|
||||
static void
|
||||
gst_mpeg2dec_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
|
||||
gst_mpeg2dec_get_property (GObject * object, guint prop_id, GValue * value,
|
||||
GParamSpec * pspec)
|
||||
{
|
||||
GstMpeg2dec *mpeg2dec;
|
||||
|
||||
|
@ -1107,19 +1130,14 @@ gst_mpeg2dec_get_property (GObject *object, guint prop_id, GValue *value, GParam
|
|||
static gboolean
|
||||
plugin_init (GstPlugin * plugin)
|
||||
{
|
||||
if (!gst_element_register (plugin, "mpeg2dec", GST_RANK_PRIMARY, GST_TYPE_MPEG2DEC))
|
||||
if (!gst_element_register (plugin, "mpeg2dec", GST_RANK_PRIMARY,
|
||||
GST_TYPE_MPEG2DEC))
|
||||
return FALSE;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
GST_PLUGIN_DEFINE (
|
||||
GST_VERSION_MAJOR,
|
||||
GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
|
||||
GST_VERSION_MINOR,
|
||||
"mpeg2dec",
|
||||
"LibMpeg2 decoder",
|
||||
plugin_init,
|
||||
VERSION,
|
||||
"GPL",
|
||||
GST_PACKAGE,
|
||||
GST_ORIGIN)
|
||||
"LibMpeg2 decoder", plugin_init, VERSION, "GPL", GST_PACKAGE, GST_ORIGIN)
|
||||
|
|
|
@ -26,7 +26,6 @@
|
|||
#include <mpeg2.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define GST_TYPE_MPEG2DEC \
|
||||
(gst_mpeg2dec_get_type())
|
||||
#define GST_MPEG2DEC(obj) \
|
||||
|
@ -37,10 +36,8 @@ G_BEGIN_DECLS
|
|||
(G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_MPEG2DEC))
|
||||
#define GST_IS_MPEG2DEC_CLASS(obj) \
|
||||
(G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_MPEG2DEC))
|
||||
|
||||
#define MPEGTIME_TO_GSTTIME(time) (((time) * (GST_MSECOND/10)) / 9LL)
|
||||
#define GSTTIME_TO_MPEGTIME(time) (((time) * 9LL) / (GST_MSECOND/10))
|
||||
|
||||
typedef struct _GstMpeg2dec GstMpeg2dec;
|
||||
typedef struct _GstMpeg2decClass GstMpeg2decClass;
|
||||
|
||||
|
@ -58,13 +55,12 @@ typedef enum
|
|||
MPEG2DEC_DISC_NEW_KEYFRAME,
|
||||
} DiscontState;
|
||||
|
||||
struct _GstMpeg2dec {
|
||||
struct _GstMpeg2dec
|
||||
{
|
||||
GstElement element;
|
||||
|
||||
/* pads */
|
||||
GstPad *sinkpad,
|
||||
*srcpad,
|
||||
*userdatapad;
|
||||
GstPad *sinkpad, *srcpad, *userdatapad;
|
||||
|
||||
mpeg2dec_t *decoder;
|
||||
gboolean closed;
|
||||
|
@ -93,12 +89,12 @@ struct _GstMpeg2dec {
|
|||
gint index_id;
|
||||
};
|
||||
|
||||
struct _GstMpeg2decClass {
|
||||
struct _GstMpeg2decClass
|
||||
{
|
||||
GstElementClass parent_class;
|
||||
};
|
||||
|
||||
GType gst_mpeg2dec_get_type (void);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GST_MPEG2DEC_H__ */
|
||||
|
|
|
@ -11,7 +11,8 @@
|
|||
#include "gstmpeg2dec.h"
|
||||
|
||||
|
||||
void new_frame (char *buf, void *data, uint64_t timestamp)
|
||||
void
|
||||
new_frame (char *buf, void *data, uint64_t timestamp)
|
||||
{
|
||||
g_print (".");
|
||||
}
|
||||
|
|
|
@ -28,7 +28,6 @@
|
|||
#include <gst/gst.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define GST_TYPE_SIDDEC \
|
||||
(gst_siddec_get_type())
|
||||
#define GST_SIDDEC(obj) \
|
||||
|
@ -39,16 +38,15 @@ G_BEGIN_DECLS
|
|||
(G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_SIDDEC))
|
||||
#define GST_IS_SIDDEC_CLASS(obj) \
|
||||
(G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_SIDDEC))
|
||||
|
||||
typedef struct _GstSidDec GstSidDec;
|
||||
typedef struct _GstSidDecClass GstSidDecClass;
|
||||
|
||||
struct _GstSidDec {
|
||||
struct _GstSidDec
|
||||
{
|
||||
GstElement element;
|
||||
|
||||
/* pads */
|
||||
GstPad *sinkpad,
|
||||
*srcpad;
|
||||
GstPad *sinkpad, *srcpad;
|
||||
|
||||
gint state;
|
||||
guchar *tune_buffer;
|
||||
|
@ -65,12 +63,12 @@ struct _GstSidDec {
|
|||
GstCaps *metadata;
|
||||
};
|
||||
|
||||
struct _GstSidDecClass {
|
||||
struct _GstSidDecClass
|
||||
{
|
||||
GstElementClass parent_class;
|
||||
};
|
||||
|
||||
GType gst_siddec_get_type (void);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GST_SIDDEC_H__ */
|
||||
|
|
|
@ -96,8 +96,7 @@ gst_audio_frame_rate (GstPad *pad)
|
|||
g_warning ("gstaudio: could not get caps of pad %s:%s\n",
|
||||
GST_ELEMENT_NAME (gst_pad_get_parent (pad)), GST_PAD_NAME (pad));
|
||||
return 0;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
structure = gst_caps_get_structure (caps, 0);
|
||||
gst_structure_get_int (structure, "rate", &rate);
|
||||
return rate;
|
||||
|
@ -125,15 +124,12 @@ gst_audio_length (GstPad* pad, GstBuffer* buf)
|
|||
g_assert (GST_IS_BUFFER (buf));
|
||||
/* get caps of pad */
|
||||
caps = GST_PAD_CAPS (pad);
|
||||
if (caps == NULL)
|
||||
{
|
||||
if (caps == NULL) {
|
||||
/* ERROR: could not get caps of pad */
|
||||
g_warning ("gstaudio: could not get caps of pad %s:%s\n",
|
||||
GST_ELEMENT_NAME (gst_pad_get_parent (pad)), GST_PAD_NAME (pad));
|
||||
length = 0.0;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
structure = gst_caps_get_structure (caps, 0);
|
||||
bytes = GST_BUFFER_SIZE (buf);
|
||||
gst_structure_get_int (structure, "width", &width);
|
||||
|
@ -162,8 +158,7 @@ gst_audio_highest_sample_value (GstPad* pad)
|
|||
GstStructure *structure;
|
||||
|
||||
caps = GST_PAD_CAPS (pad);
|
||||
if (caps == NULL)
|
||||
{
|
||||
if (caps == NULL) {
|
||||
g_warning ("gstaudio: could not get caps of pad %s:%s\n",
|
||||
GST_ELEMENT_NAME (gst_pad_get_parent (pad)), GST_PAD_NAME (pad));
|
||||
}
|
||||
|
@ -172,7 +167,8 @@ gst_audio_highest_sample_value (GstPad* pad)
|
|||
gst_structure_get_int (structure, "width", &width);
|
||||
gst_structure_get_boolean (structure, "signed", &is_signed);
|
||||
|
||||
if (is_signed) --width;
|
||||
if (is_signed)
|
||||
--width;
|
||||
/* example : 16 bit, signed : samples between -32768 and 32767 */
|
||||
return ((long) (1 << width));
|
||||
}
|
||||
|
@ -199,8 +195,8 @@ gst_audio_is_buffer_framed (GstPad* pad, GstBuffer* buf)
|
|||
* number of list values, and each of the values, terminating with NULL
|
||||
*/
|
||||
static void
|
||||
_gst_audio_structure_set_list (GstStructure *structure, const gchar *fieldname,
|
||||
GType type, int number, ...)
|
||||
_gst_audio_structure_set_list (GstStructure * structure,
|
||||
const gchar * fieldname, GType type, int number, ...)
|
||||
{
|
||||
va_list varargs;
|
||||
GValue value = { 0 };
|
||||
|
@ -214,17 +210,16 @@ _gst_audio_structure_set_list (GstStructure *structure, const gchar *fieldname,
|
|||
|
||||
va_start (varargs, number);
|
||||
|
||||
for (j = 0; j < number; ++j)
|
||||
{
|
||||
for (j = 0; j < number; ++j) {
|
||||
int i;
|
||||
gboolean b;
|
||||
|
||||
GValue list_value = { 0 };
|
||||
|
||||
switch (type)
|
||||
{
|
||||
switch (type) {
|
||||
case G_TYPE_INT:
|
||||
i = va_arg (varargs, int);
|
||||
|
||||
g_value_init (&list_value, G_TYPE_INT);
|
||||
g_value_set_int (&list_value, i);
|
||||
break;
|
||||
|
@ -234,7 +229,8 @@ _gst_audio_structure_set_list (GstStructure *structure, const gchar *fieldname,
|
|||
g_value_set_boolean (&list_value, b);
|
||||
break;
|
||||
default:
|
||||
g_warning ("_gst_audio_structure_set_list: LIST of given type not implemented.");
|
||||
g_warning
|
||||
("_gst_audio_structure_set_list: LIST of given type not implemented.");
|
||||
}
|
||||
g_array_append_val (array, list_value);
|
||||
|
||||
|
@ -247,19 +243,25 @@ void
|
|||
gst_audio_structure_set_int (GstStructure * structure, GstAudioFieldFlag flag)
|
||||
{
|
||||
if (flag & GST_AUDIO_FIELD_RATE)
|
||||
gst_structure_set (structure, "rate", GST_TYPE_INT_RANGE, 1, G_MAXINT, NULL);
|
||||
gst_structure_set (structure, "rate", GST_TYPE_INT_RANGE, 1, G_MAXINT,
|
||||
NULL);
|
||||
if (flag & GST_AUDIO_FIELD_CHANNELS)
|
||||
gst_structure_set (structure, "channels", GST_TYPE_INT_RANGE, 1, G_MAXINT, NULL);
|
||||
gst_structure_set (structure, "channels", GST_TYPE_INT_RANGE, 1, G_MAXINT,
|
||||
NULL);
|
||||
if (flag & GST_AUDIO_FIELD_ENDIANNESS)
|
||||
_gst_audio_structure_set_list (structure, "endianness", G_TYPE_INT, 2, G_LITTLE_ENDIAN, G_BIG_ENDIAN, NULL);
|
||||
_gst_audio_structure_set_list (structure, "endianness", G_TYPE_INT, 2,
|
||||
G_LITTLE_ENDIAN, G_BIG_ENDIAN, NULL);
|
||||
if (flag & GST_AUDIO_FIELD_WIDTH)
|
||||
_gst_audio_structure_set_list (structure, "width", G_TYPE_INT, 3, 8, 16, 32, NULL);
|
||||
_gst_audio_structure_set_list (structure, "width", G_TYPE_INT, 3, 8, 16, 32,
|
||||
NULL);
|
||||
if (flag & GST_AUDIO_FIELD_DEPTH)
|
||||
gst_structure_set (structure, "depth", GST_TYPE_INT_RANGE, 1, 32, NULL);
|
||||
if (flag & GST_AUDIO_FIELD_SIGNED)
|
||||
_gst_audio_structure_set_list (structure, "signed", G_TYPE_BOOLEAN, 2, TRUE, FALSE, NULL);
|
||||
_gst_audio_structure_set_list (structure, "signed", G_TYPE_BOOLEAN, 2, TRUE,
|
||||
FALSE, NULL);
|
||||
if (flag & GST_AUDIO_FIELD_BUFFER_FRAMES)
|
||||
gst_structure_set (structure, "buffer-frames", GST_TYPE_INT_RANGE, 1, G_MAXINT, NULL);
|
||||
gst_structure_set (structure, "buffer-frames", GST_TYPE_INT_RANGE, 1,
|
||||
G_MAXINT, NULL);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
|
@ -268,14 +270,8 @@ plugin_init (GstPlugin *plugin)
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
GST_PLUGIN_DEFINE (
|
||||
GST_VERSION_MAJOR,
|
||||
GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
|
||||
GST_VERSION_MINOR,
|
||||
"gstaudio",
|
||||
"Support services for audio plugins",
|
||||
plugin_init,
|
||||
VERSION,
|
||||
GST_LICENSE,
|
||||
GST_PACKAGE,
|
||||
GST_ORIGIN
|
||||
);
|
||||
plugin_init, VERSION, GST_LICENSE, GST_PACKAGE, GST_ORIGIN);
|
||||
|
|
|
@ -26,7 +26,6 @@
|
|||
#define __GST_AUDIO_AUDIO_H__
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
/* For people that are looking at this source: the purpose of these defines is
|
||||
* to make GstCaps a bit easier, in that you don't have to know all of the
|
||||
* properties that need to be defined. you can just use these macros. currently
|
||||
|
@ -50,9 +49,7 @@ G_BEGIN_DECLS
|
|||
*
|
||||
* Andy Wingo, 18 August 2001
|
||||
* Thomas, 6 September 2002 */
|
||||
|
||||
#define GST_AUDIO_DEF_RATE 44100
|
||||
|
||||
#define GST_AUDIO_INT_PAD_TEMPLATE_CAPS \
|
||||
"audio/x-raw-int, " \
|
||||
"rate = (int) [ 1, MAX ], " \
|
||||
|
@ -61,8 +58,6 @@ G_BEGIN_DECLS
|
|||
"width = (int) { 8, 16, 32 }, " \
|
||||
"depth = (int) [ 1, 32 ], " \
|
||||
"signed = (boolean) { true, false }"
|
||||
|
||||
|
||||
/* "standard" int audio is native order, 16 bit stereo. */
|
||||
#define GST_AUDIO_INT_STANDARD_PAD_TEMPLATE_CAPS \
|
||||
"audio/x-raw-int, " \
|
||||
|
@ -72,7 +67,6 @@ G_BEGIN_DECLS
|
|||
"width = (int) 16, " \
|
||||
"depth = (int) 16, " \
|
||||
"signed = (boolean) true"
|
||||
|
||||
#define GST_AUDIO_FLOAT_PAD_TEMPLATE_CAPS \
|
||||
"audio/x-raw-float, " \
|
||||
"rate = (int) [ 1, MAX ], " \
|
||||
|
@ -80,7 +74,6 @@ G_BEGIN_DECLS
|
|||
"endianness = (int) { LITTLE_ENDIAN , BIG_ENDIAN }, " \
|
||||
"width = (int) { 32, 64 }, " \
|
||||
"buffer-frames = (int) [ 1, MAX]"
|
||||
|
||||
/* "standard" float audio is native order, 32 bit mono. */
|
||||
#define GST_AUDIO_FLOAT_STANDARD_PAD_TEMPLATE_CAPS \
|
||||
"audio/x-raw-float, " \
|
||||
|
@ -88,12 +81,10 @@ G_BEGIN_DECLS
|
|||
"channels = (int) 1, " \
|
||||
"endianness = (int) BYTE_ORDER, " \
|
||||
"buffer-frames = (int) [ 1, MAX]"
|
||||
|
||||
/*
|
||||
* this library defines and implements some helper functions for audio
|
||||
* handling
|
||||
*/
|
||||
|
||||
/* get byte size of audio frame (based on caps of pad */
|
||||
int gst_audio_frame_byte_size (GstPad * pad);
|
||||
|
||||
|
@ -113,7 +104,8 @@ long gst_audio_highest_sample_value (GstPad* pad);
|
|||
gboolean gst_audio_is_buffer_framed (GstPad * pad, GstBuffer * buf);
|
||||
|
||||
/* functions useful for _getcaps functions */
|
||||
typedef enum {
|
||||
typedef enum
|
||||
{
|
||||
GST_AUDIO_FIELD_RATE = (1 << 0),
|
||||
GST_AUDIO_FIELD_CHANNELS = (1 << 1),
|
||||
GST_AUDIO_FIELD_ENDIANNESS = (1 << 2),
|
||||
|
@ -123,8 +115,8 @@ typedef enum {
|
|||
GST_AUDIO_FIELD_BUFFER_FRAMES = (1 << 6)
|
||||
} GstAudioFieldFlag;
|
||||
|
||||
void gst_audio_structure_set_int (GstStructure *structure, GstAudioFieldFlag flag);
|
||||
void gst_audio_structure_set_int (GstStructure * structure,
|
||||
GstAudioFieldFlag flag);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GST_AUDIO_AUDIO_H__ */
|
||||
|
|
|
@ -36,6 +36,7 @@ static void gst_audio_clock_id_unschedule (GstClock *clock,
|
|||
GstClockEntry * entry);
|
||||
|
||||
static GstSystemClockClass *parent_class = NULL;
|
||||
|
||||
/* static guint gst_audio_clock_signals[LAST_SIGNAL] = { 0 }; */
|
||||
|
||||
GType
|
||||
|
@ -91,9 +92,11 @@ gst_audio_clock_init (GstAudioClock *clock)
|
|||
}
|
||||
|
||||
GstClock *
|
||||
gst_audio_clock_new (gchar *name, GstAudioClockGetTimeFunc func, gpointer user_data)
|
||||
gst_audio_clock_new (gchar * name, GstAudioClockGetTimeFunc func,
|
||||
gpointer user_data)
|
||||
{
|
||||
GstAudioClock *aclock = GST_AUDIO_CLOCK (g_object_new (GST_TYPE_AUDIO_CLOCK, NULL));
|
||||
GstAudioClock *aclock =
|
||||
GST_AUDIO_CLOCK (g_object_new (GST_TYPE_AUDIO_CLOCK, NULL));
|
||||
|
||||
aclock->func = func;
|
||||
aclock->user_data = user_data;
|
||||
|
@ -117,6 +120,7 @@ gst_audio_clock_set_active (GstAudioClock *aclock, gboolean active)
|
|||
aclock->adjust = time - aclock->func (clock, aclock->user_data);
|
||||
} else {
|
||||
GTimeVal timeval;
|
||||
|
||||
g_get_current_time (&timeval);
|
||||
|
||||
aclock->adjust = GST_TIMEVAL_TO_TIME (timeval) - time;
|
||||
|
@ -175,8 +179,7 @@ gst_audio_clock_id_wait_async (GstClock *clock, GstClockEntry *entry)
|
|||
GstAudioClock *aclock = (GstAudioClock *) clock;
|
||||
|
||||
aclock->async_entries = g_slist_insert_sorted (aclock->async_entries,
|
||||
entry,
|
||||
(GCompareFunc)compare_clock_entries);
|
||||
entry, (GCompareFunc) compare_clock_entries);
|
||||
|
||||
/* is this the proper return val? */
|
||||
return GST_CLOCK_EARLY;
|
||||
|
@ -187,6 +190,5 @@ gst_audio_clock_id_unschedule (GstClock *clock, GstClockEntry *entry)
|
|||
{
|
||||
GstAudioClock *aclock = (GstAudioClock *) clock;
|
||||
|
||||
aclock->async_entries = g_slist_remove (aclock->async_entries,
|
||||
entry);
|
||||
aclock->async_entries = g_slist_remove (aclock->async_entries, entry);
|
||||
}
|
||||
|
|
|
@ -27,7 +27,6 @@
|
|||
#include <gst/gstsystemclock.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define GST_TYPE_AUDIO_CLOCK \
|
||||
(gst_audio_clock_get_type())
|
||||
#define GST_AUDIO_CLOCK(obj) \
|
||||
|
@ -38,14 +37,15 @@ G_BEGIN_DECLS
|
|||
(G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_AUDIO_CLOCK))
|
||||
#define GST_IS_AUDIO_CLOCK_CLASS(obj) \
|
||||
(G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_AUDIO_CLOCK))
|
||||
|
||||
typedef struct _GstAudioClock GstAudioClock;
|
||||
typedef struct _GstAudioClockClass GstAudioClockClass;
|
||||
|
||||
typedef GstClockTime (*GstAudioClockGetTimeFunc) (GstClock *clock, gpointer user_data);
|
||||
typedef GstClockTime (*GstAudioClockGetTimeFunc) (GstClock * clock,
|
||||
gpointer user_data);
|
||||
|
||||
|
||||
struct _GstAudioClock {
|
||||
struct _GstAudioClock
|
||||
{
|
||||
GstSystemClock clock;
|
||||
|
||||
GstClockTime prev1, prev2;
|
||||
|
@ -63,7 +63,8 @@ struct _GstAudioClock {
|
|||
gpointer _gst_reserved[GST_PADDING];
|
||||
};
|
||||
|
||||
struct _GstAudioClockClass {
|
||||
struct _GstAudioClockClass
|
||||
{
|
||||
GstSystemClockClass parent_class;
|
||||
|
||||
gpointer _gst_reserved[GST_PADDING];
|
||||
|
@ -77,5 +78,4 @@ void gst_audio_clock_set_active (GstAudioClock *aclock, gboolean active);
|
|||
void gst_audio_clock_update_time (GstAudioClock * aclock, GstClockTime time);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GST_AUDIO_CLOCK_H__ */
|
||||
|
|
|
@ -29,12 +29,14 @@
|
|||
|
||||
|
||||
/* GstAudiofilter signals and args */
|
||||
enum {
|
||||
enum
|
||||
{
|
||||
/* FILL ME */
|
||||
LAST_SIGNAL
|
||||
};
|
||||
|
||||
enum {
|
||||
enum
|
||||
{
|
||||
ARG_0,
|
||||
ARG_METHOD,
|
||||
/* FILL ME */
|
||||
|
@ -44,8 +46,10 @@ static void gst_audiofilter_base_init (gpointer g_class);
|
|||
static void gst_audiofilter_class_init (gpointer g_class, gpointer class_data);
|
||||
static void gst_audiofilter_init (GTypeInstance * instance, gpointer g_class);
|
||||
|
||||
static void gst_audiofilter_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec);
|
||||
static void gst_audiofilter_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec);
|
||||
static void gst_audiofilter_set_property (GObject * object, guint prop_id,
|
||||
const GValue * value, GParamSpec * pspec);
|
||||
static void gst_audiofilter_get_property (GObject * object, guint prop_id,
|
||||
GValue * value, GParamSpec * pspec);
|
||||
|
||||
static void gst_audiofilter_chain (GstPad * pad, GstData * _data);
|
||||
GstCaps *gst_audiofilter_class_get_capslist (GstAudiofilterClass * klass);
|
||||
|
@ -75,7 +79,8 @@ gst_audiofilter_get_type (void)
|
|||
return audiofilter_type;
|
||||
}
|
||||
|
||||
static void gst_audiofilter_base_init (gpointer g_class)
|
||||
static void
|
||||
gst_audiofilter_base_init (gpointer g_class)
|
||||
{
|
||||
static GstElementDetails audiofilter_details = {
|
||||
"Audio filter base class",
|
||||
|
@ -89,7 +94,8 @@ static void gst_audiofilter_base_init (gpointer g_class)
|
|||
gst_element_class_set_details (element_class, &audiofilter_details);
|
||||
}
|
||||
|
||||
static void gst_audiofilter_class_init (gpointer g_class, gpointer class_data)
|
||||
static void
|
||||
gst_audiofilter_class_init (gpointer g_class, gpointer class_data)
|
||||
{
|
||||
GObjectClass *gobject_class;
|
||||
GstElementClass *gstelement_class;
|
||||
|
@ -116,8 +122,7 @@ gst_audiofilter_link (GstPad *pad, const GstCaps *caps)
|
|||
|
||||
GST_DEBUG ("gst_audiofilter_link");
|
||||
audiofilter = GST_AUDIOFILTER (gst_pad_get_parent (pad));
|
||||
audiofilter_class = GST_AUDIOFILTER_CLASS (
|
||||
G_OBJECT_GET_CLASS (audiofilter));
|
||||
audiofilter_class = GST_AUDIOFILTER_CLASS (G_OBJECT_GET_CLASS (audiofilter));
|
||||
|
||||
|
||||
if (pad == audiofilter->srcpad) {
|
||||
|
@ -135,7 +140,8 @@ gst_audiofilter_link (GstPad *pad, const GstCaps *caps)
|
|||
if (strcmp (gst_structure_get_name (structure), "audio/x-raw-int") == 0) {
|
||||
ret = gst_structure_get_int (structure, "depth", &audiofilter->depth);
|
||||
ret &= gst_structure_get_int (structure, "width", &audiofilter->width);
|
||||
ret &= gst_structure_get_int (structure, "channels", &audiofilter->channels);
|
||||
ret &=
|
||||
gst_structure_get_int (structure, "channels", &audiofilter->channels);
|
||||
} else if (strcmp (gst_structure_get_name (structure), "audio/x-raw-float")
|
||||
== 0) {
|
||||
|
||||
|
@ -147,7 +153,8 @@ gst_audiofilter_link (GstPad *pad, const GstCaps *caps)
|
|||
audiofilter->bytes_per_sample = (audiofilter->width / 8) *
|
||||
audiofilter->channels;
|
||||
|
||||
if (audiofilter_class->setup) (audiofilter_class->setup) (audiofilter);
|
||||
if (audiofilter_class->setup)
|
||||
(audiofilter_class->setup) (audiofilter);
|
||||
|
||||
return GST_PAD_LINK_OK;
|
||||
}
|
||||
|
@ -160,8 +167,8 @@ gst_audiofilter_init (GTypeInstance *instance, gpointer g_class)
|
|||
|
||||
GST_DEBUG ("gst_audiofilter_init");
|
||||
|
||||
pad_template = gst_element_class_get_pad_template(GST_ELEMENT_CLASS(g_class),
|
||||
"sink");
|
||||
pad_template =
|
||||
gst_element_class_get_pad_template (GST_ELEMENT_CLASS (g_class), "sink");
|
||||
g_return_if_fail (pad_template != NULL);
|
||||
audiofilter->sinkpad = gst_pad_new_from_template (pad_template, "sink");
|
||||
gst_element_add_pad (GST_ELEMENT (audiofilter), audiofilter->sinkpad);
|
||||
|
@ -169,8 +176,8 @@ gst_audiofilter_init (GTypeInstance *instance, gpointer g_class)
|
|||
gst_pad_set_link_function (audiofilter->sinkpad, gst_audiofilter_link);
|
||||
gst_pad_set_getcaps_function (audiofilter->sinkpad, gst_pad_proxy_getcaps);
|
||||
|
||||
pad_template = gst_element_class_get_pad_template(GST_ELEMENT_CLASS(g_class),
|
||||
"src");
|
||||
pad_template =
|
||||
gst_element_class_get_pad_template (GST_ELEMENT_CLASS (g_class), "src");
|
||||
g_return_if_fail (pad_template != NULL);
|
||||
audiofilter->srcpad = gst_pad_new_from_template (pad_template, "src");
|
||||
gst_element_add_pad (GST_ELEMENT (audiofilter), audiofilter->srcpad);
|
||||
|
@ -196,8 +203,7 @@ gst_audiofilter_chain (GstPad *pad, GstData *data)
|
|||
|
||||
audiofilter = GST_AUDIOFILTER (gst_pad_get_parent (pad));
|
||||
//g_return_if_fail (audiofilter->inited);
|
||||
audiofilter_class = GST_AUDIOFILTER_CLASS (
|
||||
G_OBJECT_GET_CLASS (audiofilter));
|
||||
audiofilter_class = GST_AUDIOFILTER_CLASS (G_OBJECT_GET_CLASS (audiofilter));
|
||||
|
||||
GST_DEBUG ("gst_audiofilter_chain: got buffer of %d bytes in '%s'",
|
||||
GST_BUFFER_SIZE (inbuf), GST_OBJECT_NAME (audiofilter));
|
||||
|
@ -241,7 +247,8 @@ gst_audiofilter_chain (GstPad *pad, GstData *data)
|
|||
}
|
||||
|
||||
static void
|
||||
gst_audiofilter_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec)
|
||||
gst_audiofilter_set_property (GObject * object, guint prop_id,
|
||||
const GValue * value, GParamSpec * pspec)
|
||||
{
|
||||
GstAudiofilter *src;
|
||||
|
||||
|
@ -257,7 +264,8 @@ gst_audiofilter_set_property (GObject *object, guint prop_id, const GValue *valu
|
|||
}
|
||||
|
||||
static void
|
||||
gst_audiofilter_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
|
||||
gst_audiofilter_get_property (GObject * object, guint prop_id, GValue * value,
|
||||
GParamSpec * pspec)
|
||||
{
|
||||
GstAudiofilter *src;
|
||||
|
||||
|
@ -272,8 +280,9 @@ gst_audiofilter_get_property (GObject *object, guint prop_id, GValue *value, GPa
|
|||
}
|
||||
}
|
||||
|
||||
void gst_audiofilter_class_add_pad_templates (
|
||||
GstAudiofilterClass *audiofilter_class, const GstCaps *caps)
|
||||
void
|
||||
gst_audiofilter_class_add_pad_templates (GstAudiofilterClass *
|
||||
audiofilter_class, const GstCaps * caps)
|
||||
{
|
||||
GstElementClass *element_class = GST_ELEMENT_CLASS (audiofilter_class);
|
||||
|
||||
|
@ -294,15 +303,8 @@ plugin_init (GstPlugin *plugin)
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
GST_PLUGIN_DEFINE (
|
||||
GST_VERSION_MAJOR,
|
||||
GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
|
||||
GST_VERSION_MINOR,
|
||||
"gstaudiofilter",
|
||||
"Audio filter parent class",
|
||||
plugin_init,
|
||||
VERSION,
|
||||
"LGPL",
|
||||
GST_PACKAGE,
|
||||
GST_ORIGIN
|
||||
)
|
||||
|
||||
plugin_init, VERSION, "LGPL", GST_PACKAGE, GST_ORIGIN)
|
||||
|
|
|
@ -25,9 +25,7 @@
|
|||
#include <gst/gst.h>
|
||||
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
typedef struct _GstAudiofilter GstAudiofilter;
|
||||
G_BEGIN_DECLS typedef struct _GstAudiofilter GstAudiofilter;
|
||||
typedef struct _GstAudiofilterClass GstAudiofilterClass;
|
||||
|
||||
typedef void (*GstAudiofilterFilterFunc) (GstAudiofilter * filter,
|
||||
|
@ -49,7 +47,8 @@ typedef void (*GstAudiofilterSetupFunc) (GstAudiofilter *filter);
|
|||
#define GST_IS_AUDIOFILTER_CLASS(obj) \
|
||||
(G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_AUDIOFILTER))
|
||||
|
||||
struct _GstAudiofilter {
|
||||
struct _GstAudiofilter
|
||||
{
|
||||
GstElement element;
|
||||
|
||||
GstPad *sinkpad, *srcpad;
|
||||
|
@ -68,7 +67,8 @@ struct _GstAudiofilter {
|
|||
int bytes_per_sample;
|
||||
};
|
||||
|
||||
struct _GstAudiofilterClass {
|
||||
struct _GstAudiofilterClass
|
||||
{
|
||||
GstElementClass parent_class;
|
||||
|
||||
GstCaps *caps;
|
||||
|
@ -79,9 +79,8 @@ struct _GstAudiofilterClass {
|
|||
|
||||
GType gst_audiofilter_get_type (void);
|
||||
|
||||
void gst_audiofilter_class_add_pad_templates (GstAudiofilterClass *audiofilterclass, const GstCaps *caps);
|
||||
void gst_audiofilter_class_add_pad_templates (GstAudiofilterClass *
|
||||
audiofilterclass, const GstCaps * caps);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GST_AUDIOFILTER_H__ */
|
||||
|
||||
|
|
|
@ -48,37 +48,47 @@ typedef struct _GstAudiofilterTemplateClass GstAudiofilterTemplateClass;
|
|||
#define GST_IS_AUDIOFILTER_TEMPLATE_CLASS(obj) \
|
||||
(G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_AUDIOFILTER_TEMPLATE))
|
||||
|
||||
struct _GstAudiofilterTemplate {
|
||||
struct _GstAudiofilterTemplate
|
||||
{
|
||||
GstAudiofilter audiofilter;
|
||||
|
||||
};
|
||||
|
||||
struct _GstAudiofilterTemplateClass {
|
||||
struct _GstAudiofilterTemplateClass
|
||||
{
|
||||
GstAudiofilterClass parent_class;
|
||||
|
||||
};
|
||||
|
||||
|
||||
enum {
|
||||
enum
|
||||
{
|
||||
/* FILL ME */
|
||||
LAST_SIGNAL
|
||||
};
|
||||
|
||||
enum {
|
||||
enum
|
||||
{
|
||||
ARG_0,
|
||||
/* FILL ME */
|
||||
};
|
||||
|
||||
static void gst_audiofilter_template_base_init (gpointer g_class);
|
||||
static void gst_audiofilter_template_class_init (gpointer g_class, gpointer class_data);
|
||||
static void gst_audiofilter_template_init (GTypeInstance *instance, gpointer g_class);
|
||||
static void gst_audiofilter_template_class_init (gpointer g_class,
|
||||
gpointer class_data);
|
||||
static void gst_audiofilter_template_init (GTypeInstance * instance,
|
||||
gpointer g_class);
|
||||
|
||||
static void gst_audiofilter_template_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec);
|
||||
static void gst_audiofilter_template_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec);
|
||||
static void gst_audiofilter_template_set_property (GObject * object,
|
||||
guint prop_id, const GValue * value, GParamSpec * pspec);
|
||||
static void gst_audiofilter_template_get_property (GObject * object,
|
||||
guint prop_id, GValue * value, GParamSpec * pspec);
|
||||
|
||||
static void gst_audiofilter_template_setup (GstAudiofilter * audiofilter);
|
||||
static void gst_audiofilter_template_filter (GstAudiofilter *audiofilter, GstBuffer *outbuf, GstBuffer *inbuf);
|
||||
static void gst_audiofilter_template_filter_inplace (GstAudiofilter *audiofilter, GstBuffer *buf);
|
||||
static void gst_audiofilter_template_filter (GstAudiofilter * audiofilter,
|
||||
GstBuffer * outbuf, GstBuffer * inbuf);
|
||||
static void gst_audiofilter_template_filter_inplace (GstAudiofilter *
|
||||
audiofilter, GstBuffer * buf);
|
||||
|
||||
GType
|
||||
gst_audiofilter_template_get_type (void)
|
||||
|
@ -103,7 +113,8 @@ gst_audiofilter_template_get_type (void)
|
|||
return audiofilter_template_type;
|
||||
}
|
||||
|
||||
static void gst_audiofilter_template_base_init (gpointer g_class)
|
||||
static void
|
||||
gst_audiofilter_template_base_init (gpointer g_class)
|
||||
{
|
||||
static GstElementDetails audiofilter_template_details = {
|
||||
"Audio filter template",
|
||||
|
@ -162,7 +173,8 @@ gst_audiofilter_template_init (GTypeInstance *instance, gpointer g_class)
|
|||
}
|
||||
|
||||
static void
|
||||
gst_audiofilter_template_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec)
|
||||
gst_audiofilter_template_set_property (GObject * object, guint prop_id,
|
||||
const GValue * value, GParamSpec * pspec)
|
||||
{
|
||||
GstAudiofilterTemplate *src;
|
||||
|
||||
|
@ -178,7 +190,8 @@ gst_audiofilter_template_set_property (GObject *object, guint prop_id, const GVa
|
|||
}
|
||||
|
||||
static void
|
||||
gst_audiofilter_template_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
|
||||
gst_audiofilter_template_get_property (GObject * object, guint prop_id,
|
||||
GValue * value, GParamSpec * pspec)
|
||||
{
|
||||
GstAudiofilterTemplate *src;
|
||||
|
||||
|
@ -203,20 +216,13 @@ plugin_init (GstPlugin *plugin)
|
|||
GST_TYPE_AUDIOFILTER_TEMPLATE);
|
||||
}
|
||||
|
||||
GST_PLUGIN_DEFINE (
|
||||
GST_VERSION_MAJOR,
|
||||
GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
|
||||
GST_VERSION_MINOR,
|
||||
"gstaudiofilter_template",
|
||||
"Audio filter template",
|
||||
plugin_init,
|
||||
VERSION,
|
||||
"LGPL",
|
||||
GST_PACKAGE,
|
||||
GST_ORIGIN
|
||||
)
|
||||
plugin_init, VERSION, "LGPL", GST_PACKAGE, GST_ORIGIN)
|
||||
|
||||
static void
|
||||
gst_audiofilter_template_setup (GstAudiofilter *audiofilter)
|
||||
static void gst_audiofilter_template_setup (GstAudiofilter * audiofilter)
|
||||
{
|
||||
GstAudiofilterTemplate *audiofilter_template;
|
||||
|
||||
|
@ -245,8 +251,7 @@ gst_audiofilter_template_filter (GstAudiofilter *audiofilter,
|
|||
/* do something interesting here. This simply copies the source
|
||||
* to the destination. */
|
||||
|
||||
memcpy (GST_BUFFER_DATA (outbuf), GST_BUFFER_DATA (inbuf),
|
||||
audiofilter->size);
|
||||
memcpy (GST_BUFFER_DATA (outbuf), GST_BUFFER_DATA (inbuf), audiofilter->size);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -262,4 +267,3 @@ gst_audiofilter_template_filter_inplace (GstAudiofilter *audiofilter,
|
|||
* to the destination. */
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -27,7 +27,8 @@
|
|||
#include "colorbalance.h"
|
||||
#include "colorbalance-marshal.h"
|
||||
|
||||
enum {
|
||||
enum
|
||||
{
|
||||
VALUE_CHANGED,
|
||||
LAST_SIGNAL
|
||||
};
|
||||
|
@ -55,8 +56,7 @@ gst_color_balance_get_type (void)
|
|||
};
|
||||
|
||||
gst_color_balance_type = g_type_register_static (G_TYPE_INTERFACE,
|
||||
"GstColorBalance",
|
||||
&gst_color_balance_info, 0);
|
||||
"GstColorBalance", &gst_color_balance_info, 0);
|
||||
g_type_interface_add_prerequisite (gst_color_balance_type,
|
||||
GST_TYPE_IMPLEMENTS_INTERFACE);
|
||||
}
|
||||
|
@ -76,8 +76,7 @@ gst_color_balance_class_init (GstColorBalanceClass *klass)
|
|||
G_STRUCT_OFFSET (GstColorBalanceClass, value_changed),
|
||||
NULL, NULL,
|
||||
gst_color_balance_marshal_VOID__OBJECT_INT,
|
||||
G_TYPE_NONE, 2,
|
||||
GST_TYPE_COLOR_BALANCE_CHANNEL, G_TYPE_INT);
|
||||
G_TYPE_NONE, 2, GST_TYPE_COLOR_BALANCE_CHANNEL, G_TYPE_INT);
|
||||
|
||||
initialized = TRUE;
|
||||
}
|
||||
|
@ -104,8 +103,7 @@ gst_color_balance_list_channels (GstColorBalance *balance)
|
|||
|
||||
void
|
||||
gst_color_balance_set_value (GstColorBalance * balance,
|
||||
GstColorBalanceChannel *channel,
|
||||
gint value)
|
||||
GstColorBalanceChannel * channel, gint value)
|
||||
{
|
||||
GstColorBalanceClass *klass = GST_COLOR_BALANCE_GET_CLASS (balance);
|
||||
|
||||
|
@ -129,12 +127,10 @@ gst_color_balance_get_value (GstColorBalance *balance,
|
|||
|
||||
void
|
||||
gst_color_balance_value_changed (GstColorBalance * balance,
|
||||
GstColorBalanceChannel *channel,
|
||||
gint value)
|
||||
GstColorBalanceChannel * channel, gint value)
|
||||
{
|
||||
g_signal_emit (G_OBJECT (balance),
|
||||
gst_color_balance_signals[VALUE_CHANGED],
|
||||
0, channel, value);
|
||||
gst_color_balance_signals[VALUE_CHANGED], 0, channel, value);
|
||||
|
||||
g_signal_emit_by_name (G_OBJECT (channel), "value_changed", value);
|
||||
}
|
||||
|
|
|
@ -27,7 +27,6 @@
|
|||
#include <gst/colorbalance/colorbalance-enumtypes.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define GST_TYPE_COLOR_BALANCE \
|
||||
(gst_color_balance_get_type ())
|
||||
#define GST_COLOR_BALANCE(obj) \
|
||||
|
@ -42,9 +41,7 @@ G_BEGIN_DECLS
|
|||
(G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_COLOR_BALANCE))
|
||||
#define GST_COLOR_BALANCE_GET_CLASS(inst) \
|
||||
(G_TYPE_INSTANCE_GET_INTERFACE ((inst), GST_TYPE_COLOR_BALANCE, GstColorBalanceClass))
|
||||
|
||||
#define GST_COLOR_BALANCE_TYPE(klass) (klass->balance_type)
|
||||
|
||||
typedef struct _GstColorBalance GstColorBalance;
|
||||
|
||||
typedef enum
|
||||
|
@ -53,7 +50,8 @@ typedef enum
|
|||
GST_COLOR_BALANCE_SOFTWARE
|
||||
} GstColorBalanceType;
|
||||
|
||||
typedef struct _GstColorBalanceClass {
|
||||
typedef struct _GstColorBalanceClass
|
||||
{
|
||||
GTypeInterface klass;
|
||||
|
||||
GstColorBalanceType balance_type;
|
||||
|
@ -62,15 +60,13 @@ typedef struct _GstColorBalanceClass {
|
|||
const GList *(*list_channels) (GstColorBalance * balance);
|
||||
|
||||
void (*set_value) (GstColorBalance * balance,
|
||||
GstColorBalanceChannel *channel,
|
||||
gint value);
|
||||
GstColorBalanceChannel * channel, gint value);
|
||||
gint (*get_value) (GstColorBalance * balance,
|
||||
GstColorBalanceChannel * channel);
|
||||
|
||||
/* signals */
|
||||
void (*value_changed) (GstColorBalance * balance,
|
||||
GstColorBalanceChannel *channel,
|
||||
gint value);
|
||||
GstColorBalanceChannel * channel, gint value);
|
||||
|
||||
gpointer _gst_reserved[GST_PADDING];
|
||||
} GstColorBalanceClass;
|
||||
|
@ -78,19 +74,15 @@ typedef struct _GstColorBalanceClass {
|
|||
GType gst_color_balance_get_type (void);
|
||||
|
||||
/* virtual class function wrappers */
|
||||
const GList *
|
||||
gst_color_balance_list_channels (GstColorBalance *balance);
|
||||
const GList *gst_color_balance_list_channels (GstColorBalance * balance);
|
||||
void gst_color_balance_set_value (GstColorBalance * balance,
|
||||
GstColorBalanceChannel *channel,
|
||||
gint value);
|
||||
GstColorBalanceChannel * channel, gint value);
|
||||
gint gst_color_balance_get_value (GstColorBalance * balance,
|
||||
GstColorBalanceChannel * channel);
|
||||
|
||||
/* trigger signal */
|
||||
void gst_color_balance_value_changed (GstColorBalance * balance,
|
||||
GstColorBalanceChannel *channel,
|
||||
gint value);
|
||||
GstColorBalanceChannel * channel, gint value);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GST_COLOR_BALANCE_H__ */
|
||||
|
|
|
@ -25,13 +25,15 @@
|
|||
|
||||
#include "colorbalancechannel.h"
|
||||
|
||||
enum {
|
||||
enum
|
||||
{
|
||||
/* FILL ME */
|
||||
SIGNAL_VALUE_CHANGED,
|
||||
LAST_SIGNAL
|
||||
};
|
||||
|
||||
static void gst_color_balance_channel_class_init (GstColorBalanceChannelClass *klass);
|
||||
static void gst_color_balance_channel_class_init (GstColorBalanceChannelClass *
|
||||
klass);
|
||||
static void gst_color_balance_channel_init (GstColorBalanceChannel * balance);
|
||||
static void gst_color_balance_channel_dispose (GObject * object);
|
||||
|
||||
|
@ -59,8 +61,7 @@ gst_color_balance_channel_get_type (void)
|
|||
|
||||
gst_color_balance_channel_type =
|
||||
g_type_register_static (G_TYPE_OBJECT,
|
||||
"GstColorBalanceChannel",
|
||||
&color_balance_channel_info, 0);
|
||||
"GstColorBalanceChannel", &color_balance_channel_info, 0);
|
||||
}
|
||||
|
||||
return gst_color_balance_channel_type;
|
||||
|
@ -78,8 +79,7 @@ gst_color_balance_channel_class_init (GstColorBalanceChannelClass *klass)
|
|||
G_SIGNAL_RUN_LAST,
|
||||
G_STRUCT_OFFSET (GstColorBalanceChannelClass,
|
||||
value_changed),
|
||||
NULL, NULL, g_cclosure_marshal_VOID__INT,
|
||||
G_TYPE_NONE, 1, G_TYPE_INT);
|
||||
NULL, NULL, g_cclosure_marshal_VOID__INT, G_TYPE_NONE, 1, G_TYPE_INT);
|
||||
|
||||
object_klass->dispose = gst_color_balance_channel_dispose;
|
||||
}
|
||||
|
|
|
@ -25,7 +25,6 @@
|
|||
#include <gst/gst.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define GST_TYPE_COLOR_BALANCE_CHANNEL \
|
||||
(gst_color_balance_channel_get_type ())
|
||||
#define GST_COLOR_BALANCE_CHANNEL(obj) \
|
||||
|
@ -38,21 +37,20 @@ G_BEGIN_DECLS
|
|||
(G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_COLOR_BALANCE_CHANNEL))
|
||||
#define GST_IS_COLOR_BALANCE_CHANNEL_CLASS(klass) \
|
||||
(G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_COLOR_BALANCE_CHANNEL))
|
||||
|
||||
typedef struct _GstColorBalanceChannel {
|
||||
typedef struct _GstColorBalanceChannel
|
||||
{
|
||||
GObject parent;
|
||||
|
||||
gchar *label;
|
||||
gint min_value,
|
||||
max_value;
|
||||
gint min_value, max_value;
|
||||
} GstColorBalanceChannel;
|
||||
|
||||
typedef struct _GstColorBalanceChannelClass {
|
||||
typedef struct _GstColorBalanceChannelClass
|
||||
{
|
||||
GObjectClass parent;
|
||||
|
||||
/* signals */
|
||||
void (* value_changed) (GstColorBalanceChannel *channel,
|
||||
gint value);
|
||||
void (*value_changed) (GstColorBalanceChannel * channel, gint value);
|
||||
|
||||
gpointer _gst_reserved[GST_PADDING];
|
||||
} GstColorBalanceChannelClass;
|
||||
|
@ -60,5 +58,4 @@ typedef struct _GstColorBalanceChannelClass {
|
|||
GType gst_color_balance_channel_get_type (void);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GST_COLOR_BALANCE_CHANNEL_H__ */
|
||||
|
|
|
@ -29,39 +29,31 @@
|
|||
#include <glib/gtypes.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#if (HAVE_LRINT && HAVE_LRINTF)
|
||||
|
||||
/* These defines enable functionality introduced with the 1999 ISO C
|
||||
** standard. They must be defined before the inclusion of math.h to
|
||||
** engage them. If optimisation is enabled, these functions will be
|
||||
** inlined. With optimisation switched off, you have to link in the
|
||||
** maths library using -lm.
|
||||
*/
|
||||
|
||||
#define _ISOC9X_SOURCE 1
|
||||
#define _ISOC99_SOURCE 1
|
||||
|
||||
#define __USE_ISOC9X 1
|
||||
#define __USE_ISOC99 1
|
||||
|
||||
#include <math.h>
|
||||
|
||||
#define gst_cast_float(x) ((gint)lrintf(x))
|
||||
#define gst_cast_double(x) ((gint)lrint(x))
|
||||
|
||||
#else
|
||||
/* use a standard c cast, but do rounding correctly */
|
||||
#define gst_cast_float(x) ((gint)floor((x)+0.5))
|
||||
#define gst_cast_double(x) ((gint)floor((x)+0.5))
|
||||
|
||||
#endif
|
||||
|
||||
inline static gfloat
|
||||
GFLOAT_SWAP_LE_BE (gfloat in)
|
||||
{
|
||||
gint32 swap;
|
||||
gfloat out;
|
||||
|
||||
memcpy (&swap, &in, 4);
|
||||
swap = GUINT32_SWAP_LE_BE_CONSTANT (swap);
|
||||
memcpy (&out, &swap, 4);
|
||||
|
@ -73,6 +65,7 @@ GDOUBLE_SWAP_LE_BE(gdouble in)
|
|||
{
|
||||
gint64 swap;
|
||||
gdouble out;
|
||||
|
||||
memcpy (&swap, &in, 8);
|
||||
swap = GUINT64_SWAP_LE_BE_CONSTANT (swap);
|
||||
memcpy (&out, &swap, 8);
|
||||
|
@ -101,6 +94,4 @@ GDOUBLE_SWAP_LE_BE(gdouble in)
|
|||
#define GDOUBLE_FROM_BE(val) (GDOUBLE_TO_BE (val))
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __FLOATCAST_H__ */
|
||||
|
||||
|
|
|
@ -57,22 +57,19 @@ gst_bin_find_unconnected_pad (GstBin *bin, GstPadDirection direction)
|
|||
|
||||
elements = (GList *) gst_bin_get_list (bin);
|
||||
/* traverse all elements looking for unconnected pads */
|
||||
while (elements && pad == NULL)
|
||||
{
|
||||
while (elements && pad == NULL) {
|
||||
element = GST_ELEMENT (elements->data);
|
||||
pads = gst_element_get_pad_list (element);
|
||||
while (pads)
|
||||
{
|
||||
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)
|
||||
{
|
||||
if (GST_PAD_DIRECTION (GST_PAD (pads->data)) == direction) {
|
||||
if (GST_PAD_PEER (GST_PAD (pads->data)) == NULL) {
|
||||
/* found it ! */
|
||||
pad = GST_PAD (pads->data);
|
||||
}
|
||||
}
|
||||
if (pad) break; /* found one already */
|
||||
if (pad)
|
||||
break; /* found one already */
|
||||
pads = g_list_next (pads);
|
||||
}
|
||||
elements = g_list_next (elements);
|
||||
|
@ -101,8 +98,7 @@ gst_gconf_get_string (const gchar *key)
|
|||
value = gconf_client_get_string (gst_gconf_get_client (), full_key, &error);
|
||||
g_free (full_key);
|
||||
|
||||
if (error)
|
||||
{
|
||||
if (error) {
|
||||
g_print ("gst_gconf_get_string: error: %s\n", error->message);
|
||||
g_error_free (error);
|
||||
}
|
||||
|
@ -124,8 +120,7 @@ gst_gconf_set_string (const gchar *key, const gchar *value)
|
|||
gchar *full_key = g_strdup_printf ("%s/%s", GST_GCONF_DIR, key);
|
||||
|
||||
gconf_client_set_string (gst_gconf_get_client (), full_key, value, &error);
|
||||
if (error)
|
||||
{
|
||||
if (error) {
|
||||
g_print ("gst_gconf_set_string: error: %s\n", error->message);
|
||||
g_error_free (error);
|
||||
}
|
||||
|
@ -152,8 +147,7 @@ gst_gconf_render_bin_from_description (const gchar *description)
|
|||
desc = g_strdup_printf ("bin.( %s )", description);
|
||||
bin = GST_ELEMENT (gst_parse_launch (desc, &error));
|
||||
g_free (desc);
|
||||
if (error)
|
||||
{
|
||||
if (error) {
|
||||
g_print ("DEBUG: gstgconf: error parsing pipeline %s\n%s\n",
|
||||
description, error->message);
|
||||
g_error_free (error);
|
||||
|
@ -313,11 +307,11 @@ gst_gconf_get_default_visualization_element (void)
|
|||
ret = gst_element_factory_make ("goom", NULL);
|
||||
|
||||
if (!ret)
|
||||
g_warning ("No GConf default visualization plugin key and goom doesn't work");
|
||||
g_warning
|
||||
("No GConf default visualization plugin key and goom doesn't work");
|
||||
else
|
||||
g_print ("GConf visualization plugin not found, using goom\n");
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
|
@ -28,8 +28,7 @@
|
|||
#include <gconf/gconf-client.h>
|
||||
|
||||
gchar *gst_gconf_get_string (const gchar * key);
|
||||
void gst_gconf_set_string (const gchar *key,
|
||||
const gchar *value);
|
||||
void gst_gconf_set_string (const gchar * key, const gchar * value);
|
||||
|
||||
GstElement *gst_gconf_render_bin_from_key (const gchar * key);
|
||||
GstElement *gst_gconf_render_bin_from_description (const gchar * description);
|
||||
|
|
|
@ -29,4 +29,3 @@ extern void gst_idct_sse_idct (short *block);
|
|||
|
||||
extern void gst_idct_init_float_idct (void);
|
||||
extern void gst_idct_float_idct (short *block);
|
||||
|
||||
|
|
|
@ -72,16 +72,17 @@ static void idctcol (short *blk);
|
|||
* c[1..7] = 128*sqrt(2)
|
||||
*/
|
||||
|
||||
static void idctrow(blk)
|
||||
static void
|
||||
idctrow (blk)
|
||||
short *blk;
|
||||
{
|
||||
int x0, x1, x2, x3, x4, x5, x6, x7, x8;
|
||||
|
||||
/* shortcut */
|
||||
if (!((x1 = blk[4] << 11) | (x2 = blk[6]) | (x3 = blk[2]) |
|
||||
(x4 = blk[1]) | (x5 = blk[7]) | (x6 = blk[5]) | (x7 = blk[3])))
|
||||
{
|
||||
blk[0]=blk[1]=blk[2]=blk[3]=blk[4]=blk[5]=blk[6]=blk[7]=blk[0]<<3;
|
||||
(x4 = blk[1]) | (x5 = blk[7]) | (x6 = blk[5]) | (x7 = blk[3]))) {
|
||||
blk[0] = blk[1] = blk[2] = blk[3] = blk[4] = blk[5] = blk[6] = blk[7] =
|
||||
blk[0] << 3;
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -134,17 +135,18 @@ short *blk;
|
|||
* where: c[0] = 1/1024
|
||||
* c[1..7] = (1/1024)*sqrt(2)
|
||||
*/
|
||||
static void idctcol(blk)
|
||||
static void
|
||||
idctcol (blk)
|
||||
short *blk;
|
||||
{
|
||||
int x0, x1, x2, x3, x4, x5, x6, x7, x8;
|
||||
|
||||
/* shortcut */
|
||||
if (!((x1 = (blk[8 * 4] << 8)) | (x2 = blk[8 * 6]) | (x3 = blk[8 * 2]) |
|
||||
(x4 = blk[8*1]) | (x5 = blk[8*7]) | (x6 = blk[8*5]) | (x7 = blk[8*3])))
|
||||
{
|
||||
blk[8*0]=blk[8*1]=blk[8*2]=blk[8*3]=blk[8*4]=blk[8*5]=blk[8*6]=blk[8*7]=
|
||||
iclp[(blk[8*0]+32)>>6];
|
||||
(x4 = blk[8 * 1]) | (x5 = blk[8 * 7]) | (x6 = blk[8 * 5]) | (x7 =
|
||||
blk[8 * 3]))) {
|
||||
blk[8 * 0] = blk[8 * 1] = blk[8 * 2] = blk[8 * 3] = blk[8 * 4] =
|
||||
blk[8 * 5] = blk[8 * 6] = blk[8 * 7] = iclp[(blk[8 * 0] + 32) >> 6];
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -189,7 +191,8 @@ short *blk;
|
|||
}
|
||||
|
||||
/* two dimensional inverse discrete cosine transform */
|
||||
void gst_idct_fast_int_idct(block)
|
||||
void
|
||||
gst_idct_fast_int_idct (block)
|
||||
short *block;
|
||||
{
|
||||
int i;
|
||||
|
@ -201,7 +204,8 @@ short *block;
|
|||
idctcol (block + i);
|
||||
}
|
||||
|
||||
void gst_idct_init_fast_int_idct()
|
||||
void
|
||||
gst_idct_init_fast_int_idct ()
|
||||
{
|
||||
int i;
|
||||
|
||||
|
|
|
@ -56,22 +56,24 @@ static double gst_idct_float_c[8][8];
|
|||
|
||||
/* initialize DCT coefficient matrix */
|
||||
|
||||
void gst_idct_init_float_idct()
|
||||
void
|
||||
gst_idct_init_float_idct ()
|
||||
{
|
||||
int freq, time;
|
||||
double scale;
|
||||
|
||||
for (freq=0; freq < 8; freq++)
|
||||
{
|
||||
for (freq = 0; freq < 8; freq++) {
|
||||
scale = (freq == 0) ? sqrt (0.125) : 0.5;
|
||||
for (time = 0; time < 8; time++)
|
||||
gst_idct_float_c[freq][time] = scale*cos((PI/8.0)*freq*(time + 0.5));
|
||||
gst_idct_float_c[freq][time] =
|
||||
scale * cos ((PI / 8.0) * freq * (time + 0.5));
|
||||
}
|
||||
}
|
||||
|
||||
/* perform IDCT matrix multiply for 8x8 coefficient block */
|
||||
|
||||
void gst_idct_float_idct(block)
|
||||
void
|
||||
gst_idct_float_idct (block)
|
||||
short *block;
|
||||
{
|
||||
int i, j, k, v;
|
||||
|
@ -79,8 +81,7 @@ short *block;
|
|||
double tmp[64];
|
||||
|
||||
for (i = 0; i < 8; i++)
|
||||
for (j=0; j<8; j++)
|
||||
{
|
||||
for (j = 0; j < 8; j++) {
|
||||
partial_product = 0.0;
|
||||
|
||||
for (k = 0; k < 8; k++)
|
||||
|
@ -93,8 +94,7 @@ short *block;
|
|||
loop order of i and j */
|
||||
|
||||
for (j = 0; j < 8; j++)
|
||||
for (i=0; i<8; i++)
|
||||
{
|
||||
for (i = 0; i < 8; i++) {
|
||||
partial_product = 0.0;
|
||||
|
||||
for (k = 0; k < 8; k++)
|
||||
|
|
|
@ -27,7 +27,8 @@
|
|||
|
||||
static void gst_idct_int_sparse_idct (short *data);
|
||||
|
||||
GstIDCT *gst_idct_new(GstIDCTMethod method)
|
||||
GstIDCT *
|
||||
gst_idct_new (GstIDCTMethod method)
|
||||
{
|
||||
GstIDCT *new = g_malloc (sizeof (GstIDCT));
|
||||
|
||||
|
@ -92,7 +93,8 @@ GstIDCT *gst_idct_new(GstIDCTMethod method)
|
|||
return new;
|
||||
}
|
||||
|
||||
static void gst_idct_int_sparse_idct(short *data)
|
||||
static void
|
||||
gst_idct_int_sparse_idct (short *data)
|
||||
{
|
||||
short val;
|
||||
gint32 v, *dp = (guint32 *) data;
|
||||
|
@ -104,23 +106,47 @@ static void gst_idct_int_sparse_idct(short *data)
|
|||
val += (8 >> 1);
|
||||
val /= 8;
|
||||
val = -val;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
val = (v + (8 >> 1)) / 8;
|
||||
}
|
||||
v = ((val & 0xffff) | (val << 16));
|
||||
|
||||
dp[0] = v; dp[1] = v; dp[2] = v; dp[3] = v;
|
||||
dp[4] = v; dp[5] = v; dp[6] = v; dp[7] = v;
|
||||
dp[8] = v; dp[9] = v; dp[10] = v; dp[11] = v;
|
||||
dp[12] = v; dp[13] = v; dp[14] = v; dp[15] = v;
|
||||
dp[16] = v; dp[17] = v; dp[18] = v; dp[19] = v;
|
||||
dp[20] = v; dp[21] = v; dp[22] = v; dp[23] = v;
|
||||
dp[24] = v; dp[25] = v; dp[26] = v; dp[27] = v;
|
||||
dp[28] = v; dp[29] = v; dp[30] = v; dp[31] = v;
|
||||
dp[0] = v;
|
||||
dp[1] = v;
|
||||
dp[2] = v;
|
||||
dp[3] = v;
|
||||
dp[4] = v;
|
||||
dp[5] = v;
|
||||
dp[6] = v;
|
||||
dp[7] = v;
|
||||
dp[8] = v;
|
||||
dp[9] = v;
|
||||
dp[10] = v;
|
||||
dp[11] = v;
|
||||
dp[12] = v;
|
||||
dp[13] = v;
|
||||
dp[14] = v;
|
||||
dp[15] = v;
|
||||
dp[16] = v;
|
||||
dp[17] = v;
|
||||
dp[18] = v;
|
||||
dp[19] = v;
|
||||
dp[20] = v;
|
||||
dp[21] = v;
|
||||
dp[22] = v;
|
||||
dp[23] = v;
|
||||
dp[24] = v;
|
||||
dp[25] = v;
|
||||
dp[26] = v;
|
||||
dp[27] = v;
|
||||
dp[28] = v;
|
||||
dp[29] = v;
|
||||
dp[30] = v;
|
||||
dp[31] = v;
|
||||
}
|
||||
|
||||
void gst_idct_destroy(GstIDCT *idct)
|
||||
void
|
||||
gst_idct_destroy (GstIDCT * idct)
|
||||
{
|
||||
g_return_if_fail (idct != NULL);
|
||||
|
||||
|
@ -133,14 +159,8 @@ plugin_init (GstPlugin *plugin)
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
GST_PLUGIN_DEFINE (
|
||||
GST_VERSION_MAJOR,
|
||||
GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
|
||||
GST_VERSION_MINOR,
|
||||
"gstidct",
|
||||
"Accelerated IDCT routines",
|
||||
plugin_init,
|
||||
VERSION,
|
||||
GST_LICENSE,
|
||||
GST_PACKAGE,
|
||||
GST_ORIGIN
|
||||
)
|
||||
plugin_init, VERSION, GST_LICENSE, GST_PACKAGE, GST_ORIGIN)
|
||||
|
|
|
@ -23,7 +23,8 @@
|
|||
|
||||
#include <glib.h>
|
||||
|
||||
typedef enum {
|
||||
typedef enum
|
||||
{
|
||||
GST_IDCT_DEFAULT,
|
||||
GST_IDCT_INT,
|
||||
GST_IDCT_FAST_INT,
|
||||
|
@ -38,7 +39,8 @@ typedef void (*GstIDCTFunction) (gshort *block);
|
|||
|
||||
#define GST_IDCT_TRANSPOSE(idct) ((idct)->need_transpose)
|
||||
|
||||
struct _GstIDCT {
|
||||
struct _GstIDCT
|
||||
{
|
||||
/* private */
|
||||
GstIDCTFunction convert;
|
||||
GstIDCTFunction convert_sparse;
|
||||
|
@ -47,6 +49,7 @@ struct _GstIDCT {
|
|||
|
||||
|
||||
GstIDCT *gst_idct_new (GstIDCTMethod method);
|
||||
|
||||
#define gst_idct_convert(idct, blocks) (idct)->convert((blocks))
|
||||
#define gst_idct_convert_sparse(idct, blocks) (idct)->convert_sparse((blocks))
|
||||
void gst_idct_destroy (GstIDCT * idct);
|
||||
|
|
|
@ -38,7 +38,8 @@ long sumsqerrs[DCTSIZE2];
|
|||
int maxerr[DCTSIZE2];
|
||||
|
||||
|
||||
char * meets (double val, double limit)
|
||||
char *
|
||||
meets (double val, double limit)
|
||||
{
|
||||
return ((fabs (val) <= limit) ? "meets" : "FAILS");
|
||||
}
|
||||
|
@ -61,7 +62,8 @@ main(int argc, char **argv)
|
|||
|
||||
/* Argument parsing --- not very bulletproof at all */
|
||||
|
||||
if (argc != 6) usage(NULL);
|
||||
if (argc != 6)
|
||||
usage (NULL);
|
||||
|
||||
method = atoi (argv[1]);
|
||||
minpix = atoi (argv[2]);
|
||||
|
@ -93,8 +95,10 @@ main(int argc, char **argv)
|
|||
ref_fdct ((DCTELEM **) & refcoefs);
|
||||
/* clip */
|
||||
for (i = 0; i < DCTSIZE2; i++) {
|
||||
if (refcoefs[i] < -2048) refcoefs[i] = -2048;
|
||||
else if (refcoefs[i] > 2047) refcoefs[i] = 2047;
|
||||
if (refcoefs[i] < -2048)
|
||||
refcoefs[i] = -2048;
|
||||
else if (refcoefs[i] > 2047)
|
||||
refcoefs[i] = 2047;
|
||||
}
|
||||
|
||||
/* perform reference IDCT */
|
||||
|
@ -102,8 +106,10 @@ main(int argc, char **argv)
|
|||
ref_idct (refout);
|
||||
/* clip */
|
||||
for (i = 0; i < DCTSIZE2; i++) {
|
||||
if (refout[i] < -256) refout[i] = -256;
|
||||
else if (refout[i] > 255) refout[i] = 255;
|
||||
if (refout[i] < -256)
|
||||
refout[i] = -256;
|
||||
else if (refout[i] > 255)
|
||||
refout[i] = 255;
|
||||
}
|
||||
|
||||
/* perform test IDCT */
|
||||
|
@ -113,8 +119,7 @@ main(int argc, char **argv)
|
|||
testout[i * DCTSIZE + j] = refcoefs[j * DCTSIZE + i];
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
memcpy (testout, refcoefs, sizeof (DCTELEM) * DCTSIZE2);
|
||||
}
|
||||
|
||||
|
@ -122,22 +127,29 @@ main(int argc, char **argv)
|
|||
gst_idct_convert (idct, testout);
|
||||
gst_trace_read_tsc (&tscstop);
|
||||
/*printf("time %llu, %llu %lld\n", tscstart, tscstop, tscstop-tscstart); */
|
||||
if (tscstop - tscstart < tscmin) tscmin = tscstop-tscstart;
|
||||
if (tscstop - tscstart > tscmax) tscmax = tscstop-tscstart;
|
||||
if (tscstop - tscstart < tscmin)
|
||||
tscmin = tscstop - tscstart;
|
||||
if (tscstop - tscstart > tscmax)
|
||||
tscmax = tscstop - tscstart;
|
||||
|
||||
/* clip */
|
||||
for (i = 0; i < DCTSIZE2; i++) {
|
||||
if (testout[i] < -256) testout[i] = -256;
|
||||
else if (testout[i] > 255) testout[i] = 255;
|
||||
if (testout[i] < -256)
|
||||
testout[i] = -256;
|
||||
else if (testout[i] > 255)
|
||||
testout[i] = 255;
|
||||
}
|
||||
|
||||
/* accumulate error stats */
|
||||
for (i = 0; i < DCTSIZE2; i++) {
|
||||
register int err = testout[i] - refout[i];
|
||||
|
||||
sumerrs[i] += err;
|
||||
sumsqerrs[i] += err * err;
|
||||
if (err < 0) err = -err;
|
||||
if (maxerr[i] < err) maxerr[i] = err;
|
||||
if (err < 0)
|
||||
err = -err;
|
||||
if (maxerr[i] < err)
|
||||
maxerr[i] = err;
|
||||
}
|
||||
|
||||
if (curiter % 100 == 99) {
|
||||
|
@ -149,16 +161,19 @@ main(int argc, char **argv)
|
|||
|
||||
/* print results */
|
||||
|
||||
printf("IEEE test conditions: -L = %ld, +H = %ld, sign = %ld, #iters = %ld\n",
|
||||
printf
|
||||
("IEEE test conditions: -L = %ld, +H = %ld, sign = %ld, #iters = %ld\n",
|
||||
minpix, maxpix, sign, niters);
|
||||
|
||||
printf ("Speed, min time %lld, max %lld\n", tscmin, tscmax);
|
||||
|
||||
printf ("Peak absolute values of errors:\n");
|
||||
for (i = 0, j = 0; i < DCTSIZE2; i++) {
|
||||
if (j < maxerr[i]) j = maxerr[i];
|
||||
if (j < maxerr[i])
|
||||
j = maxerr[i];
|
||||
printf ("%4d", maxerr[i]);
|
||||
if ((i%DCTSIZE) == DCTSIZE-1) printf("\n");
|
||||
if ((i % DCTSIZE) == DCTSIZE - 1)
|
||||
printf ("\n");
|
||||
}
|
||||
printf ("Worst peak error = %d (%s spec limit 1)\n\n", j,
|
||||
meets ((double) j, 1.0));
|
||||
|
@ -167,10 +182,13 @@ main(int argc, char **argv)
|
|||
max = total = 0.0;
|
||||
for (i = 0; i < DCTSIZE2; i++) {
|
||||
double err = (double) sumsqerrs[i] / ((double) niters);
|
||||
|
||||
total += (double) sumsqerrs[i];
|
||||
if (max < err) max = err;
|
||||
if (max < err)
|
||||
max = err;
|
||||
printf (" %8.4f", err);
|
||||
if ((i%DCTSIZE) == DCTSIZE-1) printf("\n");
|
||||
if ((i % DCTSIZE) == DCTSIZE - 1)
|
||||
printf ("\n");
|
||||
}
|
||||
printf ("Worst pmse = %.6f (%s spec limit 0.06)\n", max, meets (max, 0.06));
|
||||
total /= (double) (64 * niters);
|
||||
|
@ -181,11 +199,15 @@ main(int argc, char **argv)
|
|||
max = total = 0.0;
|
||||
for (i = 0; i < DCTSIZE2; i++) {
|
||||
double err = (double) sumerrs[i] / ((double) niters);
|
||||
|
||||
total += (double) sumerrs[i];
|
||||
printf (" %8.4f", err);
|
||||
if (err < 0.0) err = -err;
|
||||
if (max < err) max = err;
|
||||
if ((i%DCTSIZE) == DCTSIZE-1) printf("\n");
|
||||
if (err < 0.0)
|
||||
err = -err;
|
||||
if (max < err)
|
||||
max = err;
|
||||
if ((i % DCTSIZE) == DCTSIZE - 1)
|
||||
printf ("\n");
|
||||
}
|
||||
printf ("Worst mean error = %.6f (%s spec limit 0.015)\n", max,
|
||||
meets (max, 0.015));
|
||||
|
@ -209,7 +231,8 @@ main(int argc, char **argv)
|
|||
}
|
||||
|
||||
|
||||
void usage (char *msg)
|
||||
void
|
||||
usage (char *msg)
|
||||
{
|
||||
if (msg != NULL)
|
||||
fprintf (stderr, "\nerror: %s\n", msg);
|
||||
|
@ -230,7 +253,8 @@ void usage (char *msg)
|
|||
|
||||
/* Pseudo-random generator specified by IEEE 1180 */
|
||||
|
||||
long ieeerand (long L, long H)
|
||||
long
|
||||
ieeerand (long L, long H)
|
||||
{
|
||||
static long randx = 1;
|
||||
static double z = (double) 0x7fffffff;
|
||||
|
@ -256,7 +280,8 @@ double coslu[8][8];
|
|||
|
||||
|
||||
/* Routine to initialise the cosine lookup table */
|
||||
void dct_init(void)
|
||||
void
|
||||
dct_init (void)
|
||||
{
|
||||
int a, b;
|
||||
double tmp;
|
||||
|
@ -271,7 +296,8 @@ void dct_init(void)
|
|||
}
|
||||
|
||||
|
||||
void ref_fdct (DCTELEM block[8][8])
|
||||
void
|
||||
ref_fdct (DCTELEM block[8][8])
|
||||
{
|
||||
int x, y, u, v;
|
||||
double tmp, tmp2;
|
||||
|
@ -305,7 +331,8 @@ void ref_fdct (DCTELEM block[8][8])
|
|||
}
|
||||
|
||||
|
||||
void ref_idct (DCTELEM block[8][8])
|
||||
void
|
||||
ref_idct (DCTELEM block[8][8])
|
||||
{
|
||||
int x, y, u, v;
|
||||
double tmp, tmp2;
|
||||
|
|
|
@ -53,8 +53,6 @@
|
|||
#if DCTSIZE != 8
|
||||
Sorry, this code only copes with 8 x8 DCTs. /* deliberate syntax err */
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
* A 2-D IDCT can be done by 1-D IDCT on each row followed by 1-D IDCT
|
||||
* on each column. Direct algorithms are also available, but they are
|
||||
|
@ -90,7 +88,6 @@
|
|||
* have BITS_IN_JSAMPLE + CONST_BITS + PASS1_BITS <= 26. Error analysis
|
||||
* shows that the values given below are the most effective.
|
||||
*/
|
||||
|
||||
#ifdef EIGHT_BIT_SAMPLES
|
||||
#define CONST_BITS 13
|
||||
#define PASS1_BITS 2
|
||||
|
@ -98,22 +95,16 @@
|
|||
#define CONST_BITS 13
|
||||
#define PASS1_BITS 1 /* lose a little precision to avoid overflow */
|
||||
#endif
|
||||
|
||||
#define ONE ((INT32) 1)
|
||||
|
||||
#define CONST_SCALE (ONE << CONST_BITS)
|
||||
|
||||
/* Convert a positive real constant to an integer scaled by CONST_SCALE. */
|
||||
|
||||
#define FIX(x) ((INT32) ((x) * CONST_SCALE + 0.5))
|
||||
|
||||
/* Some C compilers fail to reduce "FIX(constant)" at compile time, thus
|
||||
* causing a lot of useless floating-point operations at run time.
|
||||
* To get around this we use the following pre-calculated constants.
|
||||
* If you change CONST_BITS you may want to add appropriate values.
|
||||
* (With a reasonable C compiler, you can just rely on the FIX() macro...)
|
||||
*/
|
||||
|
||||
#if CONST_BITS == 13
|
||||
#define FIX_0_298631336 ((INT32) 2446) /* FIX(0.298631336) */
|
||||
#define FIX_0_390180644 ((INT32) 3196) /* FIX(0.390180644) */
|
||||
|
@ -141,15 +132,11 @@
|
|||
#define FIX_2_562915447 FIX(2.562915447)
|
||||
#define FIX_3_072711026 FIX(3.072711026)
|
||||
#endif
|
||||
|
||||
|
||||
/* Descale and correctly round an INT32 value that's scaled by N bits.
|
||||
* We assume RIGHT_SHIFT rounds towards minus infinity, so adding
|
||||
* the fudge factor is correct for either sign of X.
|
||||
*/
|
||||
|
||||
#define DESCALE(x,n) RIGHT_SHIFT((x) + (ONE << ((n)-1)), n)
|
||||
|
||||
/* Multiply an INT32 variable by an INT32 constant to yield an INT32 result.
|
||||
* For 8-bit samples with the recommended scaling, all the variable
|
||||
* and constant values involved are no more than 16 bits wide, so a
|
||||
|
@ -160,7 +147,6 @@
|
|||
* combination of casts.
|
||||
* NB: for 12-bit samples, a full 32-bit multiplication will be needed.
|
||||
*/
|
||||
|
||||
#ifdef EIGHT_BIT_SAMPLES
|
||||
#ifdef SHORTxSHORT_32 /* may work if 'int' is 32 bits */
|
||||
#define MULTIPLY(var,const) (((INT16) (var)) * ((INT16) (const)))
|
||||
|
@ -169,16 +155,12 @@
|
|||
#define MULTIPLY(var,const) (((INT16) (var)) * ((INT32) (const)))
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef MULTIPLY /* default definition */
|
||||
#define MULTIPLY(var,const) ((var) * (const))
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
* Perform the inverse DCT on one block of coefficients.
|
||||
*/
|
||||
|
||||
void
|
||||
gst_idct_int_idct (DCTBLOCK data)
|
||||
{
|
||||
|
@ -187,12 +169,11 @@ gst_idct_int_idct (DCTBLOCK data)
|
|||
INT32 z1, z2, z3, z4, z5;
|
||||
register DCTELEM *dataptr;
|
||||
int rowctr;
|
||||
SHIFT_TEMPS
|
||||
|
||||
SHIFT_TEMPS
|
||||
/* Pass 1: process rows. */
|
||||
/* Note results are scaled up by sqrt(8) compared to a true IDCT; */
|
||||
/* furthermore, we scale the results by 2**PASS1_BITS. */
|
||||
|
||||
dataptr = data;
|
||||
for (rowctr = DCTSIZE - 1; rowctr >= 0; rowctr--) {
|
||||
/* Due to quantization, we will usually find that many of the input
|
||||
|
@ -331,8 +312,12 @@ gst_idct_int_idct (DCTBLOCK data)
|
|||
tmp2 = z1 + MULTIPLY (z3, -FIX_1_847759065);
|
||||
tmp3 = z1 + MULTIPLY (z2, FIX_0_765366865);
|
||||
|
||||
tmp0 = ((INT32) dataptr[DCTSIZE*0] + (INT32) dataptr[DCTSIZE*4]) << CONST_BITS;
|
||||
tmp1 = ((INT32) dataptr[DCTSIZE*0] - (INT32) dataptr[DCTSIZE*4]) << CONST_BITS;
|
||||
tmp0 =
|
||||
((INT32) dataptr[DCTSIZE * 0] +
|
||||
(INT32) dataptr[DCTSIZE * 4]) << CONST_BITS;
|
||||
tmp1 =
|
||||
((INT32) dataptr[DCTSIZE * 0] -
|
||||
(INT32) dataptr[DCTSIZE * 4]) << CONST_BITS;
|
||||
|
||||
tmp10 = tmp0 + tmp3;
|
||||
tmp13 = tmp0 - tmp3;
|
||||
|
|
|
@ -21,7 +21,6 @@
|
|||
*
|
||||
*/
|
||||
|
||||
|
||||
/* MMX32 iDCT algorithm (IEEE-1180 compliant) :: idct_mmx32()
*/
|
||||
/*
*/
|
||||
/* MPEG2AVI
*/
|
||||
|
@ -103,7 +102,6 @@
|
|||
/* liaor@umcc.ais.org http://members.tripod.com/~liaor
*/
|
||||
/*
*/
|
||||
|
||||
|
||||
/*;=============================================================================
*/
|
||||
/*;
*/
|
||||
/*; AP-922 http://developer.intel.com/vtune/cbts/strmsimd
*/
|
||||
|
@ -114,11 +112,9 @@
|
|||
/*
|
||||
mword typedef qword
|
||||
qword ptr equ mword ptr */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <mmx.h>
|
||||
|
||||
#define BITS_INV_ACC 4 /*; 4 or 5 for IEEE
*/
|
||||
|
@ -133,13 +129,13 @@ qword ptr equ mword ptr */
|
|||
/*#define RND_INV_ROW (1024 * (6 - BITS_INV_ACC)) //; 1 << (SHIFT_INV_ROW-1)
*/
|
||||
/*#define RND_INV_COL (16 * (BITS_INV_ACC - 3)) //; 1 << (SHIFT_INV_COL-1)
*/
|
||||
|
||||
|
||||
/*.data
*/
|
||||
/*Align 16
*/
|
||||
const static long r_inv_row[2] = { RND_INV_ROW, RND_INV_ROW };
|
||||
const static long r_inv_col[2] = { RND_INV_COL, RND_INV_COL };
|
||||
const static long r_inv_corr[2] = { RND_INV_CORR, RND_INV_CORR };
|
||||
|
||||
|
||||
/*const static short r_inv_col[4] =
*/
|
||||
/* {RND_INV_COL, RND_INV_COL, RND_INV_COL, RND_INV_COL};
*/
|
||||
/*const static short r_inv_corr[4] =
*/
|
||||
|
@ -151,10 +147,10 @@ const static long r_inv_corr[2] = {RND_INV_CORR, RND_INV_CORR };
|
|||
/*#define SHIFT_FRW_COL BITS_FRW_ACC
*/
|
||||
/*#define SHIFT_FRW_ROW (BITS_FRW_ACC + 17)
*/
|
||||
/*#define RND_FRW_ROW (262144 * (BITS_FRW_ACC - 1)) //; 1 << (SHIFT_FRW_ROW-1)
*/
|
||||
|
||||
const static __int64 one_corr = 0x0001000100010001;
|
||||
const static long r_frw_row[2] = { RND_FRW_ROW, RND_FRW_ROW };
|
||||
|
||||
|
||||
/*const static short tg_1_16[4] = {13036, 13036, 13036, 13036 }; //tg * (2<<16) + 0.5
*/
|
||||
/*const static short tg_2_16[4] = {27146, 27146, 27146, 27146 }; //tg * (2<<16) + 0.5
*/
|
||||
/*const static short tg_3_16[4] = {-21746, -21746, -21746, -21746 }; //tg * (2<<16) + 0.5
*/
|
||||
|
@ -162,12 +158,13 @@ const static long r_frw_row[2] = {RND_FRW_ROW, RND_FRW_ROW };
|
|||
/*const static short ocos_4_16[4] = {23170, 23170, 23170, 23170 }; //cos * (2<<15) + 0.5
*/
|
||||
|
||||
/*concatenated table, for forward DCT transformation
*/
|
||||
const static short tg_all_16[] = {
|
||||
13036, 13036, 13036, 13036, /* tg * (2<<16) + 0.5
*/
|
||||
const static short tg_all_16[] = {
13036, 13036, 13036, 13036, /* tg * (2<<16) + 0.5
*/
|
||||
27146, 27146, 27146, 27146, /*tg * (2<<16) + 0.5
*/
|
||||
-21746, -21746, -21746, -21746, /* tg * (2<<16) + 0.5
*/
|
||||
-19195, -19195, -19195, -19195, /*cos * (2<<16) + 0.5
*/
|
||||
23170, 23170, 23170, 23170 }; /*cos * (2<<15) + 0.5
*/
|
||||
23170, 23170, 23170, 23170
|
||||
}; /*cos * (2<<15) + 0.5
*/
|
||||
|
||||
|
||||
#define tg_1_16 (tg_all_16 + 0)
|
||||
#define tg_2_16 (tg_all_16 + 8)
|
||||
|
@ -236,51 +233,53 @@ IF _MMX ; MMX code
|
|||
;=============================================================================
|
||||
|
||||
/*; Table for rows 0,4 - constants are multiplied by cos_4_16
*/
|
||||
const short tab_i_04[] = {
|
||||
16384, 16384, 16384, -16384, /* ; movq-> w06 w04 w02 w00
*/
|
||||
const short tab_i_04[] = {
16384, 16384, 16384, -16384, /* ; movq-> w06 w04 w02 w00
*/
|
||||
21407, 8867, 8867, -21407, /* w07 w05 w03 w01
*/
|
||||
16384, -16384, 16384, 16384, /*; w14 w12 w10 w08
*/
|
||||
-8867, 21407, -21407, -8867, /*; w15 w13 w11 w09
*/
|
||||
22725, 12873, 19266, -22725, /*; w22 w20 w18 w16
*/
|
||||
19266, 4520, -4520, -12873, /*; w23 w21 w19 w17
*/
|
||||
12873, 4520, 4520, 19266, /*; w30 w28 w26 w24
*/
|
||||
-22725, 19266, -12873, -22725 };/*w31 w29 w27 w25
*/
|
||||
-22725, 19266, -12873, -22725
|
||||
}; /*w31 w29 w27 w25
*/
|
||||
|
||||
|
||||
/*; Table for rows 1,7 - constants are multiplied by cos_1_16
*/
|
||||
const short tab_i_17[] = {
|
||||
22725, 22725, 22725, -22725, /* ; movq-> w06 w04 w02 w00
*/
|
||||
const short tab_i_17[] = {
22725, 22725, 22725, -22725, /* ; movq-> w06 w04 w02 w00
*/
|
||||
29692, 12299, 12299, -29692, /* ; w07 w05 w03 w01
*/
|
||||
22725, -22725, 22725, 22725, /*; w14 w12 w10 w08
*/
|
||||
-12299, 29692, -29692, -12299, /*; w15 w13 w11 w09
*/
|
||||
31521, 17855, 26722, -31521, /*; w22 w20 w18 w16
*/
|
||||
26722, 6270, -6270, -17855, /*; w23 w21 w19 w17
*/
|
||||
17855, 6270, 6270, 26722, /*; w30 w28 w26 w24
*/
|
||||
-31521, 26722, -17855, -31521}; /* w31 w29 w27 w25
*/
|
||||
-31521, 26722, -17855, -31521
|
||||
}; /* w31 w29 w27 w25
*/
|
||||
|
||||
|
||||
/*; Table for rows 2,6 - constants are multiplied by cos_2_16
*/
|
||||
const short tab_i_26[] = {
|
||||
21407, 21407, 21407, -21407, /* ; movq-> w06 w04 w02 w00
*/
|
||||
const short tab_i_26[] = {
21407, 21407, 21407, -21407, /* ; movq-> w06 w04 w02 w00
*/
|
||||
27969, 11585, 11585, -27969, /* ; w07 w05 w03 w01
*/
|
||||
21407, -21407, 21407, 21407, /* ; w14 w12 w10 w08
*/
|
||||
-11585, 27969, -27969, -11585, /* ;w15 w13 w11 w09
*/
|
||||
29692, 16819, 25172, -29692, /* ;w22 w20 w18 w16
*/
|
||||
25172, 5906, -5906, -16819, /* ;w23 w21 w19 w17
*/
|
||||
16819, 5906, 5906, 25172, /* ;w30 w28 w26 w24
*/
|
||||
-29692, 25172, -16819, -29692}; /* ;w31 w29 w27 w25
*/
|
||||
-29692, 25172, -16819, -29692
|
||||
}; /* ;w31 w29 w27 w25
*/
|
||||
|
||||
|
||||
/*; Table for rows 3,5 - constants are multiplied by cos_3_16
*/
|
||||
const short tab_i_35[] = {
|
||||
19266, 19266, 19266, -19266, /*; movq-> w06 w04 w02 w00
*/
|
||||
const short tab_i_35[] = {
19266, 19266, 19266, -19266, /*; movq-> w06 w04 w02 w00
*/
|
||||
25172, 10426, 10426, -25172, /*; w07 w05 w03 w01
*/
|
||||
19266, -19266, 19266, 19266, /*; w14 w12 w10 w08
*/
|
||||
-10426, 25172, -25172, -10426, /*; w15 w13 w11 w09
*/
|
||||
26722, 15137, 22654, -26722, /*; w22 w20 w18 w16
*/
|
||||
22654, 5315, -5315, -15137, /*; w23 w21 w19 w17
*/
|
||||
15137, 5315, 5315, 22654, /*; w30 w28 w26 w24
*/
|
||||
-26722, 22654, -15137, -26722}; /*; w31 w29 w27 w25
*/
|
||||
*/
|
||||
-26722, 22654, -15137, -26722
|
||||
}; /*; w31 w29 w27 w25
*/
|
||||
|
||||
*/
|
||||
/* CONCATENATED TABLE, rows 0,1,2,3,4,5,6,7 (in order )
*/
|
||||
/*
*/
|
||||
/* In our implementation, however, we only use row0 !
*/
|
||||
|
@ -366,7 +365,8 @@ static const short tab_i_01234567[] = {
|
|||
31521, 17855, 26722, -31521, /*; w22 w20 w18 w16
*/
|
||||
26722, 6270, -6270, -17855, /*; w23 w21 w19 w17
*/
|
||||
17855, 6270, 6270, 26722, /*; w30 w28 w26 w24
*/
|
||||
-31521, 26722, -17855, -31521}; /* w31 w29 w27 w25
*/
|
||||
-31521, 26722, -17855, -31521
|
||||
}; /* w31 w29 w27 w25
*/
|
||||
|
||||
|
||||
#define INP eax /* pointer to (short *blk)
*/
|
||||
|
@ -380,21 +380,21 @@ static const short tab_i_01234567[] = {
|
|||
/* private variables and functions
*/
|
||||
|
||||
/*temporary storage space, 8x8 of shorts
*/
|
||||
|
||||
__inline static void idct_mmx32_rows (short *blk); /* transform rows
*/
|
||||
__inline static void idct_mmx32_cols (short *blk); /* transform "columns"
*/
|
||||
|
||||
/* the "column" transform actually transforms rows, it is
*/
|
||||
/* identical to the row-transform except for the ROUNDING
*/
|
||||
/* and SHIFTING coefficients.
*/
|
||||
|
||||
|
||||
static void
|
||||
idct_mmx32_rows( short *blk ) /* transform all 8 rows of 8x8 iDCT block
*/
|
||||
{
|
||||
idct_mmx32_rows (short *blk)
|
||||
{ /* transform all 8 rows of 8x8 iDCT block
*/
|
||||
int x;
|
||||
short qwTemp[64];
|
||||
short *out = &qwTemp[0];
|
||||
short *inptr = blk;
|
||||
|
||||
|
||||
/* this subroutine performs two operations
*/
|
||||
/* 1) iDCT row transform
*/
|
||||
/* for( i = 0; i < 8; ++ i)
*/
|
||||
|
@ -402,88 +402,62 @@ idct_mmx32_rows( short *blk ) /* transform all 8 rows of 8x8 iDCT block
*/
|
|||
/*
*/
|
||||
/* 2) transpose the matrix (which was stored in qwTemp[])
*/
|
||||
/* qwTemp[] -> [8x8 matrix transpose] -> blk[]
*/
|
||||
|
||||
for (x = 0; x < 8; x++) { /* transform one row per iteration
*/
|
||||
movq_m2r (*(inptr), mm0); /* 0 ; x3 x2 x1 x0
*/
|
||||
|
||||
movq_m2r (*(inptr + 4), mm1); /* 1 ; x7 x6 x5 x4
*/
|
||||
movq_r2r (mm0, mm2); /* 2 ; x3 x2 x1 x0
*/
|
||||
|
||||
movq_m2r (*(tab_i_01234567), mm3); /* 3 ; w06 w04 w02 w00
*/
|
||||
punpcklwd_r2r (mm1, mm0); /* x5 x1 x4 x0
*/
|
||||
|
||||
/* ----------
*/
|
||||
movq_r2r (mm0, mm5); /* 5 ; x5 x1 x4 x0
*/
|
||||
punpckldq_r2r (mm0, mm0); /* x4 x0 x4 x0
*/
|
||||
|
||||
movq_m2r (*(tab_i_01234567 + 4), mm4); /* 4 ; w07 w05 w03 w01
*/
|
||||
punpckhwd_r2r (mm1, mm2); /* 1 ; x7 x3 x6 x2
*/
|
||||
|
||||
pmaddwd_r2r (mm0, mm3); /* x4*w06+x0*w04 x4*w02+x0*w00
*/
|
||||
movq_r2r (mm2, mm6); /* 6 ; x7 x3 x6 x2
*/
|
||||
|
||||
movq_m2r (*(tab_i_01234567 + 16), mm1); /* 1 ; w22 w20 w18 w16
*/
|
||||
punpckldq_r2r (mm2, mm2); /* x6 x2 x6 x2
*/
|
||||
|
||||
pmaddwd_r2r (mm2, mm4); /* x6*w07+x2*w05 x6*w03+x2*w01
*/
|
||||
punpckhdq_r2r (mm5, mm5); /* x5 x1 x5 x1
*/
|
||||
|
||||
pmaddwd_m2r (*(tab_i_01234567 + 8), mm0); /* x4*w14+x0*w12 x4*w10+x0*w08
*/
|
||||
punpckhdq_r2r (mm6, mm6); /* x7 x3 x7 x3
*/
|
||||
|
||||
movq_m2r (*(tab_i_01234567 + 20), mm7); /* 7 ; w23 w21 w19 w17
*/
|
||||
pmaddwd_r2r (mm5, mm1); /* x5*w22+x1*w20 x5*w18+x1*w16
*/
|
||||
|
||||
paddd_m2r (*(r_inv_row), mm3); /* +rounder
*/
|
||||
pmaddwd_r2r (mm6, mm7); /* x7*w23+x3*w21 x7*w19+x3*w17
*/
|
||||
|
||||
pmaddwd_m2r (*(tab_i_01234567 + 12), mm2); /* x6*w15+x2*w13 x6*w11+x2*w09
*/
|
||||
paddd_r2r (mm4, mm3); /* 4 ; a1=sum(even1) a0=sum(even0)
*/
|
||||
|
||||
pmaddwd_m2r (*(tab_i_01234567 + 24), mm5); /* x5*w30+x1*w28 x5*w26+x1*w24
*/
|
||||
movq_r2r (mm3, mm4); /* 4 ; a1 a0
*/
|
||||
|
||||
pmaddwd_m2r (*(tab_i_01234567 + 28), mm6); /* x7*w31+x3*w29 x7*w27+x3*w25
*/
|
||||
paddd_r2r (mm7, mm1); /* 7 ; b1=sum(odd1) b0=sum(odd0)
*/
|
||||
|
||||
paddd_m2r (*(r_inv_row), mm0); /* +rounder
*/
|
||||
psubd_r2r (mm1, mm3); /* a1-b1 a0-b0
*/
|
||||
|
||||
psrad_i2r (SHIFT_INV_ROW, mm3); /* y6=a1-b1 y7=a0-b0
*/
|
||||
paddd_r2r (mm4, mm1); /* 4 ; a1+b1 a0+b0
*/
|
||||
|
||||
paddd_r2r (mm2, mm0); /* 2 ; a3=sum(even3) a2=sum(even2)
*/
|
||||
psrad_i2r (SHIFT_INV_ROW, mm1); /* y1=a1+b1 y0=a0+b0
*/
|
||||
|
||||
paddd_r2r (mm6, mm5); /* 6 ; b3=sum(odd3) b2=sum(odd2)
*/
|
||||
movq_r2r (mm0, mm4); /* 4 ; a3 a2
*/
|
||||
|
||||
paddd_r2r (mm5, mm0); /* a3+b3 a2+b2
*/
|
||||
psubd_r2r (mm5, mm4); /* 5 ; a3-b3 a2-b2
*/
|
||||
|
||||
psrad_i2r (SHIFT_INV_ROW, mm4); /* y4=a3-b3 y5=a2-b2
*/
|
||||
psrad_i2r (SHIFT_INV_ROW, mm0); /* y3=a3+b3 y2=a2+b2
*/
|
||||
|
||||
packssdw_r2r (mm3, mm4); /* 3 ; y6 y7 y4 y5
*/
|
||||
|
||||
packssdw_r2r (mm0, mm1); /* 0 ; y3 y2 y1 y0
*/
|
||||
movq_r2r (mm4, mm7); /* 7 ; y6 y7 y4 y5
*/
|
||||
|
||||
psrld_i2r (16, mm4); /* 0 y6 0 y4
*/
|
||||
|
||||
movq_r2m (mm1, *(out)); /* 1 ; save y3 y2 y1 y0
*/
|
||||
pslld_i2r (16, mm7); /* y7 0 y5 0
*/
|
||||
|
||||
por_r2r (mm4, mm7); /* 4 ; y7 y6 y5 y4
*/
|
||||
|
||||
/* begin processing row 1
*/
|
||||
movq_r2m (mm7, *(out + 4)); /* 7 ; save y7 y6 y5 y4
*/
|
||||
|
||||
inptr += 8;
|
||||
out += 8;
|
||||
}
|
||||
|
||||
|
||||
/* done with the iDCT row-transformation
*/
|
||||
|
||||
/* now we have to transpose the output 8x8 matrix
*/
|
||||
|
@ -494,7 +468,6 @@ idct_mmx32_rows( short *blk ) /* transform all 8 rows of 8x8 iDCT block
*/
|
|||
/* 3) transpose lower-left quad
*/
|
||||
/* 4) transpose upper-right quad
*/
|
||||
|
||||
|
||||
/* mm0 = 1st row [ A B C D ] row1
*/
|
||||
/* mm1 = 2nd row [ E F G H ] 2
*/
|
||||
/* mm2 = 3rd row [ I J K L ] 3
*/
|
||||
|
@ -502,45 +475,31 @@ idct_mmx32_rows( short *blk ) /* transform all 8 rows of 8x8 iDCT block
*/
|
|||
|
||||
/* 1) transpose upper-left quad
*/
|
||||
out = &qwTemp[0];
|
||||
|
||||
movq_m2r (*(out + ROW_STRIDE * 0), mm0);
|
||||
|
||||
movq_m2r (*(out + ROW_STRIDE * 1), mm1);
|
||||
movq_r2r (mm0, mm4); /* mm4 = copy of row1[A B C D]
*/
|
||||
|
||||
movq_m2r (*(out + ROW_STRIDE * 2), mm2);
|
||||
punpcklwd_r2r (mm1, mm0); /* mm0 = [ 0 4 1 5]
*/
|
||||
|
||||
movq_m2r (*(out + ROW_STRIDE * 3), mm3);
|
||||
punpckhwd_r2r (mm1, mm4); /* mm4 = [ 2 6 3 7]
*/
|
||||
|
||||
movq_r2r (mm2, mm6);
|
||||
punpcklwd_r2r (mm3, mm2); /* mm2 = [ 8 12 9 13]
*/
|
||||
|
||||
punpckhwd_r2r (mm3, mm6); /* mm6 = 10 14 11 15]
*/
|
||||
movq_r2r (mm0, mm1); /* mm1 = [ 0 4 1 5]
*/
|
||||
|
||||
inptr = blk;
|
||||
|
||||
punpckldq_r2r (mm2, mm0); /* final result mm0 = row1 [0 4 8 12]
*/
|
||||
|
||||
movq_r2r (mm4, mm3); /* mm3 = [ 2 6 3 7]
*/
|
||||
punpckhdq_r2r (mm2, mm1); /* mm1 = final result mm1 = row2 [1 5 9 13]
*/
|
||||
|
||||
movq_r2m (mm0, *(inptr + ROW_STRIDE * 0)); /* store row 1
*/
|
||||
punpckldq_r2r (mm6, mm4); /* final result mm4 = row3 [2 6 10 14]
*/
|
||||
|
||||
/* begin reading next quadrant (lower-right)
*/
|
||||
movq_m2r (*(out + ROW_STRIDE * 4 + 4), mm0);
|
||||
punpckhdq_r2r (mm6, mm3); /* final result mm3 = row4 [3 7 11 15]
*/
|
||||
|
||||
movq_r2m (mm4, *(inptr + ROW_STRIDE * 2)); /* store row 3
*/
|
||||
movq_r2r (mm0, mm4); /* mm4 = copy of row1[A B C D]
*/
|
||||
|
||||
movq_r2m (mm1, *(inptr + ROW_STRIDE * 1)); /* store row 2
*/
|
||||
|
||||
movq_m2r (*(out + ROW_STRIDE * 5 + 4), mm1);
|
||||
|
||||
movq_r2m (mm3, *(inptr + ROW_STRIDE * 3)); /* store row 4
*/
|
||||
punpcklwd_r2r (mm1, mm0); /* mm0 = [ 0 4 1 5]
*/
|
||||
|
||||
|
@ -550,40 +509,29 @@ idct_mmx32_rows( short *blk ) /* transform all 8 rows of 8x8 iDCT block
*/
|
|||
|
||||
/* movq mm1, qword ptr [OUT + ROW_STRIDE*5 + 8]
*/
|
||||
/* movq mm4, mm0; // mm4 = copy of row1[A B C D]
*/
|
||||
|
||||
movq_m2r (*(out + ROW_STRIDE * 6 + 4), mm2);
|
||||
|
||||
/* punpcklwd mm0, mm1; // mm0 = [ 0 4 1 5]
*/
|
||||
punpckhwd_r2r (mm1, mm4); /* mm4 = [ 2 6 3 7]
*/
|
||||
|
||||
movq_m2r (*(out + ROW_STRIDE * 7 + 4), mm3);
|
||||
movq_r2r (mm2, mm6);
|
||||
|
||||
punpcklwd_r2r (mm3, mm2); /* mm2 = [ 8 12 9 13]
*/
|
||||
movq_r2r (mm0, mm1); /* mm1 = [ 0 4 1 5]
*/
|
||||
|
||||
punpckhwd_r2r (mm3, mm6); /* mm6 = 10 14 11 15]
*/
|
||||
movq_r2r (mm4, mm3); /* mm3 = [ 2 6 3 7]
*/
|
||||
|
||||
punpckldq_r2r (mm2, mm0); /* final result mm0 = row1 [0 4 8 12]
*/
|
||||
|
||||
punpckhdq_r2r (mm2, mm1); /* mm1 = final result mm1 = row2 [1 5 9 13]
*/
|
||||
; /* slot
*/
|
||||
|
||||
movq_r2m (mm0, *(inptr + ROW_STRIDE * 4 + 4)); /* store row 1
*/
|
||||
punpckldq_r2r (mm6, mm4); /* final result mm4 = row3 [2 6 10 14]
*/
|
||||
|
||||
movq_m2r (*(out + ROW_STRIDE * 4), mm0);
|
||||
punpckhdq_r2r (mm6, mm3); /* final result mm3 = row4 [3 7 11 15]
*/
|
||||
|
||||
movq_r2m (mm4, *(inptr + ROW_STRIDE * 6 + 4)); /* store row 3
*/
|
||||
movq_r2r (mm0, mm4); /* mm4 = copy of row1[A B C D]
*/
|
||||
|
||||
movq_r2m (mm1, *(inptr + ROW_STRIDE * 5 + 4)); /* store row 2
*/
|
||||
; /* slot
*/
|
||||
|
||||
movq_m2r (*(out + ROW_STRIDE * 5), mm1);
|
||||
; /* slot
*/
|
||||
|
||||
movq_r2m (mm3, *(inptr + ROW_STRIDE * 7 + 4)); /* store row 4
*/
|
||||
punpcklwd_r2r (mm1, mm0); /* mm0 = [ 0 4 1 5]
*/
|
||||
|
||||
|
@ -592,88 +540,67 @@ idct_mmx32_rows( short *blk ) /* transform all 8 rows of 8x8 iDCT block
*/
|
|||
|
||||
/* movq mm1, qword ptr [OUT + ROW_STRIDE * 5 ]
*/
|
||||
/* movq mm4, mm0; // mm4 = copy of row1[A B C D]
*/
|
||||
|
||||
movq_m2r (*(out + ROW_STRIDE * 6), mm2);
|
||||
|
||||
/* punpcklwd mm0, mm1; // mm0 = [ 0 4 1 5]
*/
|
||||
punpckhwd_r2r (mm1, mm4); /* mm4 = [ 2 6 3 7]
*/
|
||||
|
||||
movq_m2r (*(out + ROW_STRIDE * 7), mm3);
|
||||
movq_r2r (mm2, mm6);
|
||||
|
||||
punpcklwd_r2r (mm3, mm2); /* mm2 = [ 8 12 9 13]
*/
|
||||
movq_r2r (mm0, mm1); /* mm1 = [ 0 4 1 5]
*/
|
||||
|
||||
punpckhwd_r2r (mm3, mm6); /* mm6 = 10 14 11 15]
*/
|
||||
movq_r2r (mm4, mm3); /* mm3 = [ 2 6 3 7]
*/
|
||||
|
||||
punpckldq_r2r (mm2, mm0); /* final result mm0 = row1 [0 4 8 12]
*/
|
||||
|
||||
punpckhdq_r2r (mm2, mm1); /* mm1 = final result mm1 = row2 [1 5 9 13]
*/
|
||||
; /*slot
*/
|
||||
|
||||
movq_r2m (mm0, *(inptr + ROW_STRIDE * 0 + 4)); /* store row 1
*/
|
||||
punpckldq_r2r (mm6, mm4); /* final result mm4 = row3 [2 6 10 14]
*/
|
||||
|
||||
/* begin reading next quadrant (upper-right)
*/
|
||||
movq_m2r (*(out + ROW_STRIDE * 0 + 4), mm0);
|
||||
punpckhdq_r2r (mm6, mm3); /* final result mm3 = row4 [3 7 11 15]
*/
|
||||
|
||||
movq_r2m (mm4, *(inptr + ROW_STRIDE * 2 + 4)); /* store row 3
*/
|
||||
movq_r2r (mm0, mm4); /* mm4 = copy of row1[A B C D]
*/
|
||||
|
||||
movq_r2m (mm1, *(inptr + ROW_STRIDE * 1 + 4)); /* store row 2
*/
|
||||
movq_m2r (*(out + ROW_STRIDE * 1 + 4), mm1);
|
||||
|
||||
movq_r2m (mm3, *(inptr + ROW_STRIDE * 3 + 4)); /* store row 4
*/
|
||||
punpcklwd_r2r (mm1, mm0); /* mm0 = [ 0 4 1 5]
*/
|
||||
|
||||
|
||||
/* 2) transpose lower-right quadrant
*/
|
||||
|
||||
/* movq mm0, qword ptr [OUT + ROW_STRIDE*4 + 8]
*/
|
||||
|
||||
/* movq mm1, qword ptr [OUT + ROW_STRIDE*5 + 8]
*/
|
||||
/* movq mm4, mm0; // mm4 = copy of row1[A B C D]
*/
|
||||
|
||||
movq_m2r (*(out + ROW_STRIDE * 2 + 4), mm2);
|
||||
|
||||
/* punpcklwd mm0, mm1; // mm0 = [ 0 4 1 5]
*/
|
||||
punpckhwd_r2r (mm1, mm4); /* mm4 = [ 2 6 3 7]
*/
|
||||
|
||||
movq_m2r (*(out + ROW_STRIDE * 3 + 4), mm3);
|
||||
movq_r2r (mm2, mm6);
|
||||
|
||||
punpcklwd_r2r (mm3, mm2); /* mm2 = [ 8 12 9 13]
*/
|
||||
movq_r2r (mm0, mm1); /* mm1 = [ 0 4 1 5]
*/
|
||||
|
||||
punpckhwd_r2r (mm3, mm6); /* mm6 = 10 14 11 15]
*/
|
||||
movq_r2r (mm4, mm3); /* mm3 = [ 2 6 3 7]
*/
|
||||
|
||||
punpckldq_r2r (mm2, mm0); /* final result mm0 = row1 [0 4 8 12]
*/
|
||||
|
||||
punpckhdq_r2r (mm2, mm1); /* mm1 = final result mm1 = row2 [1 5 9 13]
*/
|
||||
; /* slot
*/
|
||||
|
||||
movq_r2m (mm0, *(inptr + ROW_STRIDE * 4)); /* store row 1
*/
|
||||
punpckldq_r2r (mm6, mm4); /* final result mm4 = row3 [2 6 10 14]
*/
|
||||
|
||||
movq_r2m (mm1, *(inptr + ROW_STRIDE * 5)); /* store row 2
*/
|
||||
punpckhdq_r2r (mm6, mm3); /* final result mm3 = row4 [3 7 11 15]
*/
|
||||
|
||||
movq_r2m (mm4, *(inptr + ROW_STRIDE * 6)); /* store row 3
*/
|
||||
; /* slot
*/
|
||||
|
||||
movq_r2m (mm3, *(inptr + ROW_STRIDE * 7)); /* store row 4
*/
|
||||
; /* slot
*/
|
||||
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
idct_mmx32_cols( short *blk ) /* transform all 8 cols of 8x8 iDCT block
*/
|
||||
{
|
||||
idct_mmx32_cols (short *blk)
|
||||
{ /* transform all 8 cols of 8x8 iDCT block
*/
|
||||
int x;
|
||||
short *inptr = blk;
|
||||
|
||||
|
||||
/* Despite the function's name, the matrix is transformed
*/
|
||||
/* row by row. This function is identical to idct_mmx32_rows(),
*/
|
||||
/* except for the SHIFT amount and ROUND_INV amount.
*/
|
||||
|
@ -685,103 +612,77 @@ idct_mmx32_cols( short *blk ) /* transform all 8 cols of 8x8 iDCT block
*/
|
|||
/*
*/
|
||||
/* 2) transpose the matrix (which was stored in qwTemp[])
*/
|
||||
/* qwTemp[] -> [8x8 matrix transpose] -> blk[]
*/
|
||||
|
||||
|
||||
for (x = 0; x < 8; x++) { /* transform one row per iteration
*/
|
||||
|
||||
movq_m2r (*(inptr), mm0); /* 0 ; x3 x2 x1 x0
*/
|
||||
|
||||
movq_m2r (*(inptr + 4), mm1); /* 1 ; x7 x6 x5 x4
*/
|
||||
movq_r2r (mm0, mm2); /* 2 ; x3 x2 x1 x0
*/
|
||||
|
||||
movq_m2r (*(tab_i_01234567), mm3); /* 3 ; w06 w04 w02 w00
*/
|
||||
punpcklwd_r2r (mm1, mm0); /* x5 x1 x4 x0
*/
|
||||
|
||||
/* ----------
*/
|
||||
movq_r2r (mm0, mm5); /* 5 ; x5 x1 x4 x0
*/
|
||||
punpckldq_r2r (mm0, mm0); /* x4 x0 x4 x0
*/
|
||||
|
||||
movq_m2r (*(tab_i_01234567 + 4), mm4); /* 4 ; w07 w05 w03 w01
*/
|
||||
punpckhwd_r2r (mm1, mm2); /* 1 ; x7 x3 x6 x2
*/
|
||||
|
||||
pmaddwd_r2r (mm0, mm3); /* x4*w06+x0*w04 x4*w02+x0*w00
*/
|
||||
movq_r2r (mm2, mm6); /* 6 ; x7 x3 x6 x2
*/
|
||||
|
||||
movq_m2r (*(tab_i_01234567 + 16), mm1); /* 1 ; w22 w20 w18 w16
*/
|
||||
punpckldq_r2r (mm2, mm2); /* x6 x2 x6 x2
*/
|
||||
|
||||
pmaddwd_r2r (mm2, mm4); /* x6*w07+x2*w05 x6*w03+x2*w01
*/
|
||||
punpckhdq_r2r (mm5, mm5); /* x5 x1 x5 x1
*/
|
||||
|
||||
pmaddwd_m2r (*(tab_i_01234567 + 8), mm0); /* x4*w14+x0*w12 x4*w10+x0*w08
*/
|
||||
punpckhdq_r2r (mm6, mm6); /* x7 x3 x7 x3
*/
|
||||
|
||||
movq_m2r (*(tab_i_01234567 + 20), mm7); /* 7 ; w23 w21 w19 w17
*/
|
||||
pmaddwd_r2r (mm5, mm1); /* x5*w22+x1*w20 x5*w18+x1*w16
*/
|
||||
|
||||
paddd_m2r (*(r_inv_col), mm3); /* +rounder
*/
|
||||
pmaddwd_r2r (mm6, mm7); /* x7*w23+x3*w21 x7*w19+x3*w17
*/
|
||||
|
||||
pmaddwd_m2r (*(tab_i_01234567 + 12), mm2); /* x6*w15+x2*w13 x6*w11+x2*w09
*/
|
||||
paddd_r2r (mm4, mm3); /* 4 ; a1=sum(even1) a0=sum(even0)
*/
|
||||
|
||||
pmaddwd_m2r (*(tab_i_01234567 + 24), mm5); /* x5*w30+x1*w28 x5*w26+x1*w24
*/
|
||||
movq_r2r (mm3, mm4); /* 4 ; a1 a0
*/
|
||||
|
||||
pmaddwd_m2r (*(tab_i_01234567 + 28), mm6); /* x7*w31+x3*w29 x7*w27+x3*w25
*/
|
||||
paddd_r2r (mm7, mm1); /* 7 ; b1=sum(odd1) b0=sum(odd0)
*/
|
||||
|
||||
paddd_m2r (*(r_inv_col), mm0); /* +rounder
*/
|
||||
psubd_r2r (mm1, mm3); /* a1-b1 a0-b0
*/
|
||||
|
||||
psrad_i2r (SHIFT_INV_COL, mm3); /* y6=a1-b1 y7=a0-b0
*/
|
||||
paddd_r2r (mm4, mm1); /* 4 ; a1+b1 a0+b0
*/
|
||||
|
||||
paddd_r2r (mm2, mm0); /* 2 ; a3=sum(even3) a2=sum(even2)
*/
|
||||
psrad_i2r (SHIFT_INV_COL, mm1); /* y1=a1+b1 y0=a0+b0
*/
|
||||
|
||||
paddd_r2r (mm6, mm5); /* 6 ; b3=sum(odd3) b2=sum(odd2)
*/
|
||||
movq_r2r (mm0, mm4); /* 4 ; a3 a2
*/
|
||||
|
||||
paddd_r2r (mm5, mm0); /* a3+b3 a2+b2
*/
|
||||
psubd_r2r (mm5, mm4); /* 5 ; a3-b3 a2-b2
*/
|
||||
|
||||
|
||||
psrad_i2r (SHIFT_INV_COL, mm4); /* y4=a3-b3 y5=a2-b2
*/
|
||||
psrad_i2r (SHIFT_INV_COL, mm0); /* y3=a3+b3 y2=a2+b2
*/
|
||||
|
||||
packssdw_r2r (mm3, mm4); /* 3 ; y6 y7 y4 y5
*/
|
||||
|
||||
packssdw_r2r (mm0, mm1); /* 0 ; y3 y2 y1 y0
*/
|
||||
movq_r2r (mm4, mm7); /* 7 ; y6 y7 y4 y5
*/
|
||||
|
||||
psrld_i2r (16, mm4); /* 0 y6 0 y4
*/
|
||||
|
||||
movq_r2m (mm1, *(inptr)); /* 1 ; save y3 y2 y1 y0
*/
|
||||
pslld_i2r (16, mm7); /* y7 0 y5 0
*/
|
||||
|
||||
por_r2r (mm4, mm7); /* 4 ; y7 y6 y5 y4
*/
|
||||
|
||||
/* begin processing row 1
*/
|
||||
movq_r2m (mm7, *(inptr + 4)); /* 7 ; save y7 y6 y5 y4
*/
|
||||
|
||||
inptr += 8;
|
||||
}
|
||||
|
||||
/* done with the iDCT column-transformation
*/
|
||||
}
|
||||
|
||||
|
||||
/*
*/
|
||||
/* public interface to MMX32 IDCT 8x8 operation
*/
|
||||
/*
*/
|
||||
void
|
||||
gst_idct_mmx32_idct (short *blk)
|
||||
{
|
||||
|
||||
/* 1) iDCT row transformation
*/
|
||||
idct_mmx32_rows (blk); /* 1) transform iDCT row, and transpose
*/
|
||||
|
||||
/* 2) iDCT column transformation
*/
|
||||
idct_mmx32_cols (blk); /* 2) transform iDCT row, and transpose
*/
|
||||
|
||||
emms (); /* restore processor state
*/
|
||||
/* all done
*/
|
||||
}
|
||||
|
|
|
@ -51,7 +51,8 @@ gmi_stream_new (void)
|
|||
void
|
||||
gmi_stream_free (GstMediaInfoStream * stream)
|
||||
{
|
||||
if (stream->mime) g_free (stream->mime);
|
||||
if (stream->mime)
|
||||
g_free (stream->mime);
|
||||
/* FIXME: free tracks */
|
||||
g_free (stream);
|
||||
}
|
||||
|
@ -78,7 +79,8 @@ gmi_track_new (void)
|
|||
|
||||
/* callbacks */
|
||||
static void
|
||||
have_type_callback (GstElement *typefind, guint probability, GstCaps *type, GstMediaInfoPriv *priv)
|
||||
have_type_callback (GstElement * typefind, guint probability, GstCaps * type,
|
||||
GstMediaInfoPriv * priv)
|
||||
{
|
||||
GstStructure *str;
|
||||
const gchar *mime;
|
||||
|
@ -90,8 +92,7 @@ have_type_callback (GstElement *typefind, guint probability, GstCaps *type, GstM
|
|||
|
||||
/* FIXME: this code doesn't yet work, test it later */
|
||||
#ifdef DONTWORK
|
||||
if (strcmp (mime, "application/x-id3") == 0)
|
||||
{
|
||||
if (strcmp (mime, "application/x-id3") == 0) {
|
||||
/* dig a little deeper */
|
||||
GST_DEBUG ("dealing with id3, digging deeper");
|
||||
gst_element_set_state (priv->pipeline, GST_STATE_READY);
|
||||
|
@ -102,7 +103,8 @@ have_type_callback (GstElement *typefind, guint probability, GstCaps *type, GstM
|
|||
if (priv->decontainer == NULL)
|
||||
/* FIXME: signal error */
|
||||
g_warning ("Couldn't create id3tag");
|
||||
if (!gst_element_link_many (priv->source, priv->decontainer, priv->typefind, NULL));
|
||||
if (!gst_element_link_many (priv->source, priv->decontainer, priv->typefind,
|
||||
NULL));
|
||||
g_warning ("Couldn't link in id3tag");
|
||||
|
||||
if (gst_element_set_state (priv->pipeline, GST_STATE_PLAYING)
|
||||
|
@ -119,36 +121,34 @@ deep_notify_callback (GObject *object, GstObject *origin,
|
|||
GValue value = { 0, };
|
||||
|
||||
/* we only care about pad notifies */
|
||||
if (!GST_IS_PAD (origin)) return;
|
||||
if (!GST_IS_PAD (origin))
|
||||
return;
|
||||
|
||||
/*
|
||||
GST_DEBUG ("DEBUG: deep_notify: have notify of %s from object %s:%s !",
|
||||
pspec->name, gst_element_get_name (gst_pad_get_parent (GST_PAD (origin))),
|
||||
gst_object_get_name (origin));
|
||||
*/
|
||||
else if (strcmp (pspec->name, "caps") == 0)
|
||||
{
|
||||
else if (strcmp (pspec->name, "caps") == 0) {
|
||||
/* check if we're getting it from fakesink */
|
||||
if (GST_IS_PAD (origin) && GST_PAD_PARENT (origin) == priv->fakesink)
|
||||
{
|
||||
if (GST_IS_PAD (origin) && GST_PAD_PARENT (origin) == priv->fakesink) {
|
||||
GST_DEBUG ("have caps on fakesink pad !");
|
||||
g_value_init (&value, pspec->value_type);
|
||||
g_object_get_property (G_OBJECT (origin), pspec->name, &value);
|
||||
priv->format = g_value_peek_pointer (&value);
|
||||
GST_DEBUG ("caps: %" GST_PTR_FORMAT, priv->format);
|
||||
}
|
||||
else GST_DEBUG ("ignoring caps on object %s:%s",
|
||||
} else
|
||||
GST_DEBUG ("ignoring caps on object %s:%s",
|
||||
gst_object_get_name (gst_object_get_parent (origin)),
|
||||
gst_object_get_name (origin));
|
||||
}
|
||||
else if (strcmp (pspec->name, "offset") == 0)
|
||||
{
|
||||
} else if (strcmp (pspec->name, "offset") == 0) {
|
||||
/* we REALLY ignore offsets, we hate them */
|
||||
}
|
||||
//else GST_DEBUG ("ignoring notify of %s", pspec->name);
|
||||
}
|
||||
|
||||
typedef struct {
|
||||
typedef struct
|
||||
{
|
||||
guint meta;
|
||||
guint encoded;
|
||||
} TagFlagScore;
|
||||
|
@ -160,12 +160,15 @@ tag_flag_score (const GstTagList *list, const gchar *tag, gpointer user_data)
|
|||
GstTagFlag flag;
|
||||
|
||||
flag = gst_tag_get_flag (tag);
|
||||
if (flag == GST_TAG_FLAG_META) score->meta++;
|
||||
if (flag == GST_TAG_FLAG_ENCODED) score->encoded++;
|
||||
if (flag == GST_TAG_FLAG_META)
|
||||
score->meta++;
|
||||
if (flag == GST_TAG_FLAG_ENCODED)
|
||||
score->encoded++;
|
||||
}
|
||||
|
||||
void
|
||||
found_tag_callback (GObject *pipeline, GstElement *source, GstTagList *tags, GstMediaInfoPriv *priv)
|
||||
found_tag_callback (GObject * pipeline, GstElement * source, GstTagList * tags,
|
||||
GstMediaInfoPriv * priv)
|
||||
{
|
||||
TagFlagScore score;
|
||||
|
||||
|
@ -179,20 +182,18 @@ found_tag_callback (GObject *pipeline, GstElement *source, GstTagList *tags, Gst
|
|||
|
||||
gst_tag_list_foreach (tags, tag_flag_score, &score);
|
||||
|
||||
if (score.meta > score.encoded)
|
||||
{
|
||||
if (score.meta > score.encoded) {
|
||||
GST_DEBUG ("found tags from decoder, adding them as metadata");
|
||||
priv->metadata = gst_tag_list_copy (tags);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
GST_DEBUG ("found tags, adding them as streaminfo");
|
||||
priv->streaminfo = gst_tag_list_copy (tags);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
error_callback (GObject *element, GstElement *source, GError *error, gchar *debug, GstMediaInfoPriv *priv)
|
||||
error_callback (GObject * element, GstElement * source, GError * error,
|
||||
gchar * debug, GstMediaInfoPriv * priv)
|
||||
{
|
||||
g_print ("ERROR: %s\n", error->message);
|
||||
g_error_free (error);
|
||||
|
@ -221,8 +222,7 @@ gst_media_info_error_element (const gchar *element, GError **error)
|
|||
message = g_strdup_printf ("The %s element could not be found. "
|
||||
"This element is essential for reading. "
|
||||
"Please install the right plug-in and verify "
|
||||
"that it works by running 'gst-inspect %s'",
|
||||
element, element);
|
||||
"that it works by running 'gst-inspect %s'", element, element);
|
||||
gst_media_info_error_create (error, message);
|
||||
g_free (message);
|
||||
return;
|
||||
|
@ -289,8 +289,7 @@ G_STMT_START { \
|
|||
TAGS_RESET (priv->streaminfo);
|
||||
#undef TAGS_RESET
|
||||
|
||||
if (priv->stream)
|
||||
{
|
||||
if (priv->stream) {
|
||||
gmi_stream_free (priv->stream);
|
||||
priv->stream = NULL;
|
||||
}
|
||||
|
@ -311,7 +310,8 @@ gmi_seek_to_track (GstMediaInfo *info, long track)
|
|||
|
||||
/* FIXME: consider more nicks as "track" */
|
||||
track_format = gst_format_get_by_nick ("logical_stream");
|
||||
if (track_format == 0) return FALSE;
|
||||
if (track_format == 0)
|
||||
return FALSE;
|
||||
GST_DEBUG ("Track format: %d", track_format);
|
||||
|
||||
if (gst_element_set_state (priv->pipeline, GST_STATE_PLAYING)
|
||||
|
@ -319,24 +319,19 @@ gmi_seek_to_track (GstMediaInfo *info, long track)
|
|||
g_warning ("Couldn't set to play");
|
||||
g_assert (GST_IS_PAD (info->priv->decoder_pad));
|
||||
event = gst_event_new_seek (track_format |
|
||||
GST_SEEK_METHOD_SET |
|
||||
GST_SEEK_FLAG_FLUSH,
|
||||
track);
|
||||
GST_SEEK_METHOD_SET | GST_SEEK_FLAG_FLUSH, track);
|
||||
res = gst_pad_send_event (info->priv->decoder_pad, event);
|
||||
if (!res)
|
||||
{
|
||||
if (!res) {
|
||||
g_warning ("seek to logical track on pad %s:%s failed",
|
||||
GST_DEBUG_PAD_NAME (info->priv->decoder_pad));
|
||||
return FALSE;
|
||||
}
|
||||
/* clear structs because of the seek */
|
||||
if (priv->metadata)
|
||||
{
|
||||
if (priv->metadata) {
|
||||
gst_tag_list_free (priv->metadata);
|
||||
priv->metadata = NULL;
|
||||
}
|
||||
if (priv->streaminfo)
|
||||
{
|
||||
if (priv->streaminfo) {
|
||||
gst_tag_list_free (priv->streaminfo);
|
||||
priv->streaminfo = NULL;
|
||||
}
|
||||
|
@ -354,31 +349,45 @@ gmi_set_mime (GstMediaInfo *info, const char *mime)
|
|||
/* FIXME: please figure out proper mp3 mimetypes */
|
||||
if ((strcmp (mime, "application/x-ogg") == 0) ||
|
||||
(strcmp (mime, "application/ogg") == 0))
|
||||
desc = g_strdup_printf ("%s name=source ! oggdemux ! vorbisdec name=decoder ! fakesink name=sink", priv->source_name);
|
||||
else if ((strcmp (mime, "audio/mpeg") == 0) ||
|
||||
(strcmp (mime, "audio/x-mp3") == 0) ||
|
||||
(strcmp (mime, "audio/mp3") == 0) ||
|
||||
(strcmp (mime, "application/x-id3") == 0) ||
|
||||
(strcmp (mime, "audio/x-id3") == 0))
|
||||
desc = g_strdup_printf ("%s name=source ! id3tag ! mad name=decoder ! audio/x-raw-int ! fakesink name=sink", priv->source_name);
|
||||
else if ((strcmp (mime, "application/x-flac") == 0) ||
|
||||
(strcmp (mime, "audio/x-flac") == 0))
|
||||
desc = g_strdup_printf ("%s name=source ! flacdec name=decoder ! audio/x-raw-int ! fakesink name=sink", priv->source_name);
|
||||
else if ((strcmp (mime, "audio/wav") == 0) ||
|
||||
(strcmp (mime, "audio/x-wav") == 0))
|
||||
desc = g_strdup_printf ("%s ! wavparse name=decoder ! audio/x-raw-int ! fakesink name=sink", priv->source_name);
|
||||
else if (strcmp (mime, "audio/x-mod") == 0 ||
|
||||
strcmp (mime, "audio/x-s3m") == 0 ||
|
||||
strcmp (mime, "audio/x-xm") == 0 ||
|
||||
strcmp (mime, "audio/x-it") == 0)
|
||||
desc = g_strdup_printf ("%s name=source ! modplug name=decoder ! audio/x-raw-int ! fakesink name=sink", priv->source_name);
|
||||
else return FALSE;
|
||||
desc =
|
||||
g_strdup_printf
|
||||
("%s name=source ! oggdemux ! vorbisdec name=decoder ! fakesink name=sink",
|
||||
priv->source_name);
|
||||
else if ((strcmp (mime, "audio/mpeg") == 0)
|
||||
|| (strcmp (mime, "audio/x-mp3") == 0)
|
||||
|| (strcmp (mime, "audio/mp3") == 0)
|
||||
|| (strcmp (mime, "application/x-id3") == 0)
|
||||
|| (strcmp (mime, "audio/x-id3") == 0))
|
||||
desc =
|
||||
g_strdup_printf
|
||||
("%s name=source ! id3tag ! mad name=decoder ! audio/x-raw-int ! fakesink name=sink",
|
||||
priv->source_name);
|
||||
else if ((strcmp (mime, "application/x-flac") == 0)
|
||||
|| (strcmp (mime, "audio/x-flac") == 0))
|
||||
desc =
|
||||
g_strdup_printf
|
||||
("%s name=source ! flacdec name=decoder ! audio/x-raw-int ! fakesink name=sink",
|
||||
priv->source_name);
|
||||
else if ((strcmp (mime, "audio/wav") == 0)
|
||||
|| (strcmp (mime, "audio/x-wav") == 0))
|
||||
desc =
|
||||
g_strdup_printf
|
||||
("%s ! wavparse name=decoder ! audio/x-raw-int ! fakesink name=sink",
|
||||
priv->source_name);
|
||||
else if (strcmp (mime, "audio/x-mod") == 0
|
||||
|| strcmp (mime, "audio/x-s3m") == 0 || strcmp (mime, "audio/x-xm") == 0
|
||||
|| strcmp (mime, "audio/x-it") == 0)
|
||||
desc =
|
||||
g_strdup_printf
|
||||
("%s name=source ! modplug name=decoder ! audio/x-raw-int ! fakesink name=sink",
|
||||
priv->source_name);
|
||||
else
|
||||
return FALSE;
|
||||
|
||||
GST_DEBUG ("using description %s", desc);
|
||||
priv->pipeline_desc = desc;
|
||||
priv->pipeline = gst_parse_launch (desc, &error);
|
||||
if (error)
|
||||
{
|
||||
if (error) {
|
||||
g_warning ("Error parsing pipeline description: %s\n", error->message);
|
||||
g_error_free (error);
|
||||
return FALSE;
|
||||
|
@ -398,12 +407,15 @@ gmi_set_mime (GstMediaInfo *info, const char *mime)
|
|||
/* get the "decoder" source pad */
|
||||
priv->decoder_pad = gst_element_get_pad (priv->decoder, "src");
|
||||
g_assert (GST_IS_PAD (priv->decoder_pad));
|
||||
GST_DEBUG ("decoder pad: %s:%s", gst_object_get_name (gst_object_get_parent (GST_OBJECT (priv->decoder_pad))), gst_pad_get_name (priv->decoder_pad));
|
||||
GST_DEBUG ("decoder pad: %s:%s",
|
||||
gst_object_get_name (gst_object_get_parent (GST_OBJECT (priv->
|
||||
decoder_pad))), gst_pad_get_name (priv->decoder_pad));
|
||||
|
||||
/* attach notify handler */
|
||||
g_signal_connect (G_OBJECT (info->priv->pipeline), "deep_notify",
|
||||
G_CALLBACK (deep_notify_callback), info->priv);
|
||||
g_signal_connect (G_OBJECT (info->priv->pipeline), "found-tag", G_CALLBACK (found_tag_callback), info->priv);
|
||||
g_signal_connect (G_OBJECT (info->priv->pipeline), "found-tag",
|
||||
G_CALLBACK (found_tag_callback), info->priv);
|
||||
g_signal_connect (G_OBJECT (info->priv->pipeline), "error",
|
||||
G_CALLBACK (error_callback), info->priv);
|
||||
|
||||
|
@ -414,8 +426,7 @@ gmi_set_mime (GstMediaInfo *info, const char *mime)
|
|||
void
|
||||
gmi_clear_decoder (GstMediaInfo * info)
|
||||
{
|
||||
if (info->priv->pipeline)
|
||||
{
|
||||
if (info->priv->pipeline) {
|
||||
GST_DEBUG ("Unreffing pipeline");
|
||||
gst_object_unref (GST_OBJECT (info->priv->pipeline));
|
||||
}
|
||||
|
@ -440,8 +451,7 @@ gmip_find_type_pre (GstMediaInfoPriv *priv, GError **error)
|
|||
* just use it through this function only */
|
||||
|
||||
priv->pipeline = gst_pipeline_new ("pipeline-typefind");
|
||||
if (!GST_IS_PIPELINE (priv->pipeline))
|
||||
{
|
||||
if (!GST_IS_PIPELINE (priv->pipeline)) {
|
||||
gst_media_info_error_create (error, "Internal GStreamer error.");
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -455,8 +465,7 @@ gmip_find_type_pre (GstMediaInfoPriv *priv, GError **error)
|
|||
g_signal_connect (G_OBJECT (priv->typefind), "have-type",
|
||||
G_CALLBACK (have_type_callback), priv);
|
||||
if (gst_element_set_state (priv->pipeline, GST_STATE_PLAYING)
|
||||
== GST_STATE_FAILURE)
|
||||
{
|
||||
== GST_STATE_FAILURE) {
|
||||
g_warning ("Couldn't set to play");
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -471,20 +480,16 @@ gmip_find_type_post (GstMediaInfoPriv *priv)
|
|||
{
|
||||
/*clear up typefind */
|
||||
gst_element_set_state (priv->pipeline, GST_STATE_READY);
|
||||
if (priv->decontainer)
|
||||
{
|
||||
if (priv->decontainer) {
|
||||
gst_element_unlink (priv->source, priv->decontainer);
|
||||
gst_element_unlink (priv->decontainer, priv->typefind);
|
||||
gst_bin_remove (GST_BIN (priv->pipeline), priv->decontainer);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
gst_element_unlink (priv->source, priv->typefind);
|
||||
}
|
||||
gst_bin_remove (GST_BIN (priv->pipeline), priv->typefind);
|
||||
|
||||
if (priv->type == NULL)
|
||||
{
|
||||
if (priv->type == NULL) {
|
||||
g_warning ("iteration ended, type not found !\n");
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -500,8 +505,7 @@ gmip_find_type (GstMediaInfoPriv *priv, GError ** error)
|
|||
if (!gmip_find_type_pre (priv, error))
|
||||
return FALSE;
|
||||
GST_DEBUG ("gmip_find_type: iterating");
|
||||
while ((priv->type == NULL) &&
|
||||
gst_bin_iterate (GST_BIN (priv->pipeline)))
|
||||
while ((priv->type == NULL) && gst_bin_iterate (GST_BIN (priv->pipeline)))
|
||||
GMI_DEBUG ("+");
|
||||
GMI_DEBUG ("\n");
|
||||
return gmip_find_type_post (priv);
|
||||
|
@ -512,8 +516,7 @@ gboolean
|
|||
gmip_find_stream_pre (GstMediaInfoPriv * priv)
|
||||
{
|
||||
if (gst_element_set_state (priv->pipeline, GST_STATE_PLAYING)
|
||||
== GST_STATE_FAILURE)
|
||||
{
|
||||
== GST_STATE_FAILURE) {
|
||||
g_warning ("Couldn't set to play");
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -541,8 +544,7 @@ gmip_find_stream_post (GstMediaInfoPriv *priv)
|
|||
|
||||
/* get supported formats on decoder pad */
|
||||
formats = gst_pad_get_formats (priv->decoder_pad);
|
||||
while (*formats)
|
||||
{
|
||||
while (*formats) {
|
||||
const GstFormatDefinition *definition;
|
||||
|
||||
format = *formats;
|
||||
|
@ -551,13 +553,10 @@ gmip_find_stream_post (GstMediaInfoPriv *priv)
|
|||
definition = gst_format_get_details (*formats);
|
||||
GST_DEBUG ("trying to figure out length for format %s", definition->nick);
|
||||
|
||||
res = gst_pad_query (priv->decoder_pad, GST_QUERY_TOTAL,
|
||||
&format, &value);
|
||||
res = gst_pad_query (priv->decoder_pad, GST_QUERY_TOTAL, &format, &value);
|
||||
|
||||
if (res)
|
||||
{
|
||||
switch (format)
|
||||
{
|
||||
if (res) {
|
||||
switch (format) {
|
||||
case GST_FORMAT_TIME:
|
||||
stream->length_time = value;
|
||||
GST_DEBUG (" total %s: %lld", definition->nick, value);
|
||||
|
@ -568,35 +567,33 @@ gmip_find_stream_post (GstMediaInfoPriv *priv)
|
|||
default:
|
||||
/* separation is necessary because track_format doesn't resolve to
|
||||
* int */
|
||||
if (format == track_format)
|
||||
{
|
||||
if (format == track_format) {
|
||||
stream->length_tracks = value;
|
||||
GST_DEBUG (" total %s: %lld", definition->nick, value);
|
||||
}
|
||||
else
|
||||
} else
|
||||
GST_DEBUG ("unhandled format %s", definition->nick);
|
||||
}
|
||||
}
|
||||
else
|
||||
} else
|
||||
GST_DEBUG ("query didn't return result for %s", definition->nick);
|
||||
|
||||
formats++;
|
||||
}
|
||||
if (stream->length_tracks == 0) stream->length_tracks = 1;
|
||||
if (stream->length_tracks == 0)
|
||||
stream->length_tracks = 1;
|
||||
|
||||
/* now get number of bytes from the sink pad to get the bitrate */
|
||||
format = GST_FORMAT_BYTES;
|
||||
g_assert (GST_IS_PAD (priv->source_pad));
|
||||
res = gst_pad_query (priv->source_pad, GST_QUERY_TOTAL,
|
||||
&format, &value);
|
||||
if (!res) g_warning ("Failed to query on sink pad !");
|
||||
res = gst_pad_query (priv->source_pad, GST_QUERY_TOTAL, &format, &value);
|
||||
if (!res)
|
||||
g_warning ("Failed to query on sink pad !");
|
||||
bytes = value;
|
||||
GST_DEBUG ("bitrate calc: bytes gotten: %ld", bytes);
|
||||
|
||||
if (bytes)
|
||||
{
|
||||
if (bytes) {
|
||||
double seconds = (double) stream->length_time / GST_SECOND;
|
||||
double bits = bytes * 8;
|
||||
|
||||
stream->bitrate = (long) (bits / seconds);
|
||||
}
|
||||
GST_DEBUG ("moving to STATE_METADATA\n");
|
||||
|
@ -615,15 +612,12 @@ gmip_find_stream (GstMediaInfoPriv *priv)
|
|||
/* iterate until caps are found */
|
||||
/* FIXME: this should be done through the plugin sending some signal
|
||||
* that it is ready for queries */
|
||||
while (gst_bin_iterate (GST_BIN (priv->pipeline)) &&
|
||||
priv->format == NULL)
|
||||
;
|
||||
while (gst_bin_iterate (GST_BIN (priv->pipeline)) && priv->format == NULL);
|
||||
if (gst_element_set_state (priv->pipeline, GST_STATE_PAUSED)
|
||||
== GST_STATE_FAILURE)
|
||||
g_warning ("Couldn't set to paused");
|
||||
|
||||
if (priv->format == NULL)
|
||||
{
|
||||
if (priv->format == NULL) {
|
||||
GMI_DEBUG ("gmip_find_stream: couldn't get caps !");
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -638,8 +632,7 @@ gmip_find_track_metadata_pre (GstMediaInfoPriv *priv)
|
|||
* querying - we should make gst smarter by itself instead */
|
||||
priv->metadata_iters = 0;
|
||||
if (gst_element_set_state (priv->pipeline, GST_STATE_PLAYING)
|
||||
== GST_STATE_FAILURE)
|
||||
{
|
||||
== GST_STATE_FAILURE) {
|
||||
g_warning ("Couldn't set to play");
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -662,8 +655,7 @@ gmip_find_track_metadata (GstMediaInfoPriv *priv)
|
|||
{
|
||||
gmip_find_track_metadata_pre (priv);
|
||||
GST_DEBUG ("gmip_find_metadata: iterating");
|
||||
while ((priv->metadata == NULL) &&
|
||||
gst_bin_iterate (GST_BIN (priv->pipeline)))
|
||||
while ((priv->metadata == NULL) && gst_bin_iterate (GST_BIN (priv->pipeline)))
|
||||
GMI_DEBUG ("+");
|
||||
GMI_DEBUG ("\n");
|
||||
gmip_find_track_metadata_post (priv);
|
||||
|
@ -677,8 +669,7 @@ gboolean
|
|||
gmip_find_track_streaminfo_pre (GstMediaInfoPriv * priv)
|
||||
{
|
||||
if (gst_element_set_state (priv->pipeline, GST_STATE_PLAYING)
|
||||
== GST_STATE_FAILURE)
|
||||
{
|
||||
== GST_STATE_FAILURE) {
|
||||
g_warning ("Couldn't set to play");
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -694,12 +685,9 @@ gmip_find_track_streaminfo_post (GstMediaInfoPriv *priv)
|
|||
|
||||
/* now add total length to this, and maybe even bitrate ? FIXME */
|
||||
track_format = gst_format_get_by_nick ("logical_stream");
|
||||
if (track_format == 0)
|
||||
{
|
||||
if (track_format == 0) {
|
||||
g_print ("FIXME: implement getting length of whole track\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
/* which one are we at ? */
|
||||
long track_num;
|
||||
gint64 value_start, value_end;
|
||||
|
@ -707,19 +695,15 @@ gmip_find_track_streaminfo_post (GstMediaInfoPriv *priv)
|
|||
|
||||
res = gst_pad_query (priv->decoder_pad, GST_QUERY_POSITION,
|
||||
&track_format, &value_start);
|
||||
if (res)
|
||||
{
|
||||
if (res) {
|
||||
format = GST_FORMAT_TIME;
|
||||
track_num = value_start;
|
||||
GST_DEBUG ("we are currently at %ld", track_num);
|
||||
res = gst_pad_convert (priv->decoder_pad,
|
||||
track_format, track_num,
|
||||
&format, &value_start);
|
||||
track_format, track_num, &format, &value_start);
|
||||
res &= gst_pad_convert (priv->decoder_pad,
|
||||
track_format, track_num + 1,
|
||||
&format, &value_end);
|
||||
if (res)
|
||||
{
|
||||
track_format, track_num + 1, &format, &value_end);
|
||||
if (res) {
|
||||
/* substract to get the length */
|
||||
GST_DEBUG ("start %lld, end %lld", value_start, value_end);
|
||||
value_end -= value_start;
|
||||
|
@ -755,8 +739,7 @@ gboolean
|
|||
gmip_find_track_format_pre (GstMediaInfoPriv * priv)
|
||||
{
|
||||
if (gst_element_set_state (priv->pipeline, GST_STATE_PLAYING)
|
||||
== GST_STATE_FAILURE)
|
||||
{
|
||||
== GST_STATE_FAILURE) {
|
||||
g_warning ("Couldn't set to play");
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -779,13 +762,10 @@ gmip_find_track_format (GstMediaInfoPriv *priv)
|
|||
{
|
||||
gmip_find_track_format_pre (priv);
|
||||
GST_DEBUG ("DEBUG: gmip_find_format: iterating");
|
||||
while ((priv->format == NULL) &&
|
||||
gst_bin_iterate (GST_BIN (priv->pipeline)))
|
||||
while ((priv->format == NULL) && gst_bin_iterate (GST_BIN (priv->pipeline)))
|
||||
GMI_DEBUG ("+");
|
||||
GMI_DEBUG ("\n");
|
||||
gmip_find_track_format_post (priv);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -96,30 +96,26 @@ struct GstMediaInfoPriv
|
|||
};
|
||||
|
||||
/* declarations */
|
||||
GstMediaInfoStream *
|
||||
gmi_stream_new (void);
|
||||
GstMediaInfoStream *gmi_stream_new (void);
|
||||
void gmi_stream_free (GstMediaInfoStream * stream);
|
||||
|
||||
GstMediaInfoTrack *
|
||||
gmi_track_new (void);
|
||||
GstMediaInfoTrack *gmi_track_new (void);
|
||||
|
||||
void gmip_reset (GstMediaInfoPriv * priv);
|
||||
gboolean gmip_init (GstMediaInfoPriv * priv, GError ** error);
|
||||
|
||||
void gmi_clear_decoder (GstMediaInfo * info);
|
||||
|
||||
gboolean gmi_seek_to_track (GstMediaInfo *info,
|
||||
long track);
|
||||
gboolean gmi_seek_to_track (GstMediaInfo * info, long track);
|
||||
|
||||
gboolean gmi_set_mime (GstMediaInfo *info,
|
||||
const char *mime);
|
||||
gboolean gmi_set_mime (GstMediaInfo * info, const char *mime);
|
||||
|
||||
void deep_notify_callback (GObject * object,
|
||||
GstObject *origin,
|
||||
GParamSpec *pspec,
|
||||
GstMediaInfoPriv *priv);
|
||||
void found_tag_callback (GObject *pipeline, GstElement *source, GstTagList *tags, GstMediaInfoPriv *priv);
|
||||
void error_callback (GObject *element, GstElement *source, GError *error, gchar *debug, GstMediaInfoPriv *priv);
|
||||
GstObject * origin, GParamSpec * pspec, GstMediaInfoPriv * priv);
|
||||
void found_tag_callback (GObject * pipeline, GstElement * source,
|
||||
GstTagList * tags, GstMediaInfoPriv * priv);
|
||||
void error_callback (GObject * element, GstElement * source, GError * error,
|
||||
gchar * debug, GstMediaInfoPriv * priv);
|
||||
|
||||
gboolean gmip_find_type_pre (GstMediaInfoPriv * priv, GError ** error);
|
||||
gboolean gmip_find_type_post (GstMediaInfoPriv * priv);
|
||||
|
|
|
@ -17,8 +17,8 @@ print_tag (const GstTagList *list, const gchar *tag, gpointer unused)
|
|||
if (gst_tag_get_type (tag) == G_TYPE_STRING) {
|
||||
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));
|
||||
str =
|
||||
g_strdup_value_contents (gst_tag_list_get_value_index (list, tag, i));
|
||||
}
|
||||
|
||||
if (i == 0) {
|
||||
|
@ -44,13 +44,11 @@ info_print (GstMediaInfoStream *stream)
|
|||
g_print ("- bitrate: %.3f kbps\n", stream->bitrate / 1000.0);
|
||||
g_print ("- number of tracks: %ld\n", stream->length_tracks);
|
||||
p = stream->tracks;
|
||||
if (p == NULL)
|
||||
{
|
||||
if (p == NULL) {
|
||||
g_print ("- no track information, probably an error\n");
|
||||
return;
|
||||
}
|
||||
for (i = 0; i < stream->length_tracks; ++i)
|
||||
{
|
||||
for (i = 0; i < stream->length_tracks; ++i) {
|
||||
g_print ("- track %d\n", i);
|
||||
track = (GstMediaInfoTrack *) p->data;
|
||||
g_print (" - metadata:\n");
|
||||
|
@ -80,16 +78,14 @@ main (int argc, char *argv[])
|
|||
gst_init (&argc, &argv);
|
||||
|
||||
info = gst_media_info_new (&error);
|
||||
if (error != NULL)
|
||||
{
|
||||
if (error != NULL) {
|
||||
g_print ("Error creating media-info object: %s\n", error->message);
|
||||
g_error_free (error);
|
||||
return -1;
|
||||
}
|
||||
|
||||
g_assert (G_IS_OBJECT (info));
|
||||
if (!gst_media_info_set_source (info, "gnomevfssrc", &error))
|
||||
{
|
||||
if (!gst_media_info_set_source (info, "gnomevfssrc", &error)) {
|
||||
g_print ("Could not set gnomevfssrc as a source\n");
|
||||
g_print ("reason: %s\n", error->message);
|
||||
g_error_free (error);
|
||||
|
@ -97,19 +93,18 @@ main (int argc, char *argv[])
|
|||
}
|
||||
|
||||
g_print ("stream: %p, &stream: %p\n", stream, &stream);
|
||||
for (i = 1; i < argc; ++i)
|
||||
{
|
||||
for (i = 1; i < argc; ++i) {
|
||||
|
||||
/*
|
||||
stream = gst_media_info_read (info, argv[i], GST_MEDIA_INFO_ALL);
|
||||
*/
|
||||
gst_media_info_read_with_idler (info, argv[i], GST_MEDIA_INFO_ALL, &error);
|
||||
while (gst_media_info_read_idler (info, &stream, &error) && stream == NULL)
|
||||
/* keep idling */ g_print ("+");
|
||||
/* keep idling */
|
||||
g_print ("+");
|
||||
g_print ("\nFILE: %s\n", argv[i]);
|
||||
g_print ("stream: %p, &stream: %p\n", stream, &stream);
|
||||
if (error)
|
||||
{
|
||||
if (error) {
|
||||
g_print ("Error reading media info: %s\n", error->message);
|
||||
g_error_free (error);
|
||||
}
|
||||
|
|
|
@ -30,8 +30,7 @@ static void gst_media_info_class_init (GstMediaInfoClass *klass);
|
|||
static void gst_media_info_instance_init (GstMediaInfo * info);
|
||||
|
||||
static void gst_media_info_get_property (GObject * object, guint prop_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec);
|
||||
GValue * value, GParamSpec * pspec);
|
||||
|
||||
|
||||
static gboolean _media_info_inited = FALSE;
|
||||
|
@ -64,6 +63,7 @@ GQuark
|
|||
gst_media_info_error_quark (void)
|
||||
{
|
||||
static GQuark quark = 0;
|
||||
|
||||
if (quark == 0)
|
||||
quark = g_quark_from_static_string ("gst-media-info-error-quark");
|
||||
return quark;
|
||||
|
@ -86,7 +86,8 @@ GST_DEBUG_CATEGORY (gst_media_info_debug);
|
|||
void
|
||||
gst_media_info_init (void)
|
||||
{
|
||||
if (_media_info_inited) return;
|
||||
if (_media_info_inited)
|
||||
return;
|
||||
|
||||
/* register our debugging category */
|
||||
GST_DEBUG_CATEGORY_INIT (gst_media_info_debug, "GST_MEDIA_INFO", 0,
|
||||
|
@ -99,8 +100,8 @@ GType
|
|||
gst_media_info_get_type (void)
|
||||
{
|
||||
static GType gst_media_info_type = 0;
|
||||
if (!gst_media_info_type)
|
||||
{
|
||||
|
||||
if (!gst_media_info_type) {
|
||||
static const GTypeInfo gst_media_info_info = {
|
||||
sizeof (GstMediaInfoClass),
|
||||
(GBaseInitFunc) NULL,
|
||||
|
@ -113,8 +114,7 @@ gst_media_info_get_type (void)
|
|||
NULL
|
||||
};
|
||||
gst_media_info_type = g_type_register_static (G_TYPE_OBJECT,
|
||||
"GstMediaInfo",
|
||||
&gst_media_info_info, 0);
|
||||
"GstMediaInfo", &gst_media_info_info, 0);
|
||||
}
|
||||
return gst_media_info_type;
|
||||
}
|
||||
|
@ -145,9 +145,7 @@ gst_media_info_class_init (GstMediaInfoClass *klass)
|
|||
G_TYPE_FROM_CLASS (klass),
|
||||
G_SIGNAL_RUN_LAST,
|
||||
G_STRUCT_OFFSET (GstMediaInfoClass, media_info_signal),
|
||||
NULL, NULL,
|
||||
gst_marshal_VOID__VOID,
|
||||
G_TYPE_NONE, 0);
|
||||
NULL, NULL, gst_marshal_VOID__VOID, G_TYPE_NONE, 0);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -158,7 +156,9 @@ gst_media_info_instance_init (GstMediaInfo *info)
|
|||
info->priv = g_new0 (GstMediaInfoPriv, 1);
|
||||
error = &info->priv->error;
|
||||
|
||||
if (!_media_info_inited) { gst_media_info_init (); }
|
||||
if (!_media_info_inited) {
|
||||
gst_media_info_init ();
|
||||
}
|
||||
|
||||
gmip_init (info->priv, error);
|
||||
gmip_reset (info->priv);
|
||||
|
@ -171,8 +171,7 @@ gst_media_info_get_property (GObject *object, guint prop_id,
|
|||
{
|
||||
GstMediaInfo *info = GST_MEDIA_INFO (object);
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
switch (prop_id) {
|
||||
case PROP_SOURCE:
|
||||
g_value_set_string (value, info->priv->source_name);
|
||||
break;
|
||||
|
@ -187,15 +186,11 @@ gst_media_info_new (GError **error)
|
|||
{
|
||||
GstMediaInfo *info = g_object_new (GST_MEDIA_INFO_TYPE, NULL);
|
||||
|
||||
if (info->priv->error)
|
||||
{
|
||||
if (error)
|
||||
{
|
||||
if (info->priv->error) {
|
||||
if (error) {
|
||||
*error = info->priv->error;
|
||||
info->priv->error = NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
g_warning ("Error creating GstMediaInfo object.\n%s",
|
||||
info->priv->error->message);
|
||||
g_error_free (info->priv->error);
|
||||
|
@ -208,7 +203,8 @@ gst_media_info_new (GError **error)
|
|||
* public methods
|
||||
*/
|
||||
gboolean
|
||||
gst_media_info_set_source (GstMediaInfo *info, const char *source, GError **error)
|
||||
gst_media_info_set_source (GstMediaInfo * info, const char *source,
|
||||
GError ** error)
|
||||
{
|
||||
info->priv->source_name = g_strdup (source);
|
||||
return TRUE;
|
||||
|
@ -236,12 +232,14 @@ gst_media_info_read_with_idler (GstMediaInfo *info, const char *location,
|
|||
* returns: TRUE if it was able to idle, FALSE if there was an error
|
||||
*/
|
||||
gboolean
|
||||
gst_media_info_read_idler (GstMediaInfo *info, GstMediaInfoStream **streamp, GError **error)
|
||||
gst_media_info_read_idler (GstMediaInfo * info, GstMediaInfoStream ** streamp,
|
||||
GError ** error)
|
||||
{
|
||||
GstMediaInfoPriv *priv;
|
||||
|
||||
/* if it's NULL then we're sure something went wrong higher up) */
|
||||
if (info == NULL) return FALSE;
|
||||
if (info == NULL)
|
||||
return FALSE;
|
||||
g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
|
||||
|
||||
priv = info->priv;
|
||||
|
@ -249,12 +247,10 @@ gst_media_info_read_idler (GstMediaInfo *info, GstMediaInfoStream **streamp, GEr
|
|||
g_assert (streamp != NULL);
|
||||
g_assert (priv);
|
||||
|
||||
switch (priv->state)
|
||||
{
|
||||
switch (priv->state) {
|
||||
case GST_MEDIA_INFO_STATE_NULL:
|
||||
/* make sure we have a source */
|
||||
if (!priv->source_name)
|
||||
{
|
||||
if (!priv->source_name) {
|
||||
*error = g_error_new (GST_MEDIA_INFO_ERROR, 0,
|
||||
"No source set on media info.");
|
||||
return FALSE;
|
||||
|
@ -269,14 +265,12 @@ gst_media_info_read_idler (GstMediaInfo *info, GstMediaInfoStream **streamp, GEr
|
|||
gchar *mime;
|
||||
|
||||
GST_LOG ("STATE_TYPEFIND");
|
||||
if ((priv->type == NULL) && gst_bin_iterate (GST_BIN (priv->pipeline)))
|
||||
{
|
||||
if ((priv->type == NULL) && gst_bin_iterate (GST_BIN (priv->pipeline))) {
|
||||
GST_DEBUG ("iterating while in STATE_TYPEFIND");
|
||||
GMI_DEBUG ("?");
|
||||
return TRUE;
|
||||
}
|
||||
if (priv->type == NULL)
|
||||
{
|
||||
if (priv->type == NULL) {
|
||||
g_warning ("Couldn't find type\n");
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -284,11 +278,11 @@ gst_media_info_read_idler (GstMediaInfo *info, GstMediaInfoStream **streamp, GEr
|
|||
GST_DEBUG ("doing find_type_post");
|
||||
gmip_find_type_post (priv);
|
||||
GST_DEBUG ("finding out mime type");
|
||||
mime = g_strdup (gst_structure_get_name (
|
||||
gst_caps_get_structure(priv->type, 0)));
|
||||
mime =
|
||||
g_strdup (gst_structure_get_name (gst_caps_get_structure (priv->type,
|
||||
0)));
|
||||
GST_DEBUG ("found out mime type: %s", mime);
|
||||
if (!gmi_set_mime (info, mime))
|
||||
{
|
||||
if (!gmi_set_mime (info, mime)) {
|
||||
/* FIXME: pop up error */
|
||||
GST_DEBUG ("no decoder pipeline found for mime %s", mime);
|
||||
return FALSE;
|
||||
|
@ -303,13 +297,11 @@ gst_media_info_read_idler (GstMediaInfo *info, GstMediaInfoStream **streamp, GEr
|
|||
case GST_MEDIA_INFO_STATE_STREAM:
|
||||
{
|
||||
GST_LOG ("STATE_STREAM");
|
||||
if ((priv->format == NULL) && gst_bin_iterate (GST_BIN (priv->pipeline)))
|
||||
{
|
||||
if ((priv->format == NULL) && gst_bin_iterate (GST_BIN (priv->pipeline))) {
|
||||
GMI_DEBUG ("?");
|
||||
return TRUE;
|
||||
}
|
||||
if (priv->format == NULL)
|
||||
{
|
||||
if (priv->format == NULL) {
|
||||
g_warning ("Couldn't find format\n");
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -325,21 +317,20 @@ gst_media_info_read_idler (GstMediaInfo *info, GstMediaInfoStream **streamp, GEr
|
|||
{
|
||||
if ((priv->metadata == NULL) &&
|
||||
gst_bin_iterate (GST_BIN (priv->pipeline)) &&
|
||||
priv->metadata_iters < MAX_METADATA_ITERS)
|
||||
{
|
||||
priv->metadata_iters < MAX_METADATA_ITERS) {
|
||||
GMI_DEBUG ("?");
|
||||
priv->metadata_iters++;
|
||||
return TRUE;
|
||||
}
|
||||
if (priv->metadata_iters == MAX_METADATA_ITERS)
|
||||
g_print ("iterated a few times, didn't find metadata\n");
|
||||
if (priv->metadata == NULL)
|
||||
{
|
||||
if (priv->metadata == NULL) {
|
||||
/* this is not a permanent failure */
|
||||
GST_DEBUG ("Couldn't find metadata");
|
||||
}
|
||||
GST_DEBUG ("found metadata of track %ld", priv->current_track_num);
|
||||
if (!gmip_find_track_metadata_post (priv)) return FALSE;
|
||||
if (!gmip_find_track_metadata_post (priv))
|
||||
return FALSE;
|
||||
GST_DEBUG ("METADATA: going to STREAMINFO\n");
|
||||
priv->state = GST_MEDIA_INFO_STATE_STREAMINFO;
|
||||
return gmip_find_track_streaminfo_pre (priv);
|
||||
|
@ -347,37 +338,33 @@ gst_media_info_read_idler (GstMediaInfo *info, GstMediaInfoStream **streamp, GEr
|
|||
case GST_MEDIA_INFO_STATE_STREAMINFO:
|
||||
{
|
||||
if ((priv->streaminfo == NULL) &&
|
||||
gst_bin_iterate (GST_BIN (priv->pipeline)))
|
||||
{
|
||||
gst_bin_iterate (GST_BIN (priv->pipeline))) {
|
||||
GMI_DEBUG ("?");
|
||||
return TRUE;
|
||||
}
|
||||
if (priv->streaminfo == NULL)
|
||||
{
|
||||
if (priv->streaminfo == NULL) {
|
||||
/* this is not a permanent failure */
|
||||
GST_DEBUG ("Couldn't find streaminfo");
|
||||
}
|
||||
else
|
||||
} else
|
||||
GST_DEBUG ("found streaminfo of track %ld", priv->current_track_num);
|
||||
if (!gmip_find_track_streaminfo_post (priv)) return FALSE;
|
||||
if (!gmip_find_track_streaminfo_post (priv))
|
||||
return FALSE;
|
||||
priv->state = GST_MEDIA_INFO_STATE_FORMAT;
|
||||
return gmip_find_track_format_pre (priv);
|
||||
}
|
||||
case GST_MEDIA_INFO_STATE_FORMAT:
|
||||
{
|
||||
if ((priv->format == NULL) &&
|
||||
gst_bin_iterate (GST_BIN (priv->pipeline)))
|
||||
{
|
||||
if ((priv->format == NULL) && gst_bin_iterate (GST_BIN (priv->pipeline))) {
|
||||
GMI_DEBUG ("?");
|
||||
return TRUE;
|
||||
}
|
||||
if (priv->format == NULL)
|
||||
{
|
||||
if (priv->format == NULL) {
|
||||
g_warning ("Couldn't find format\n");
|
||||
return FALSE;
|
||||
}
|
||||
GST_DEBUG ("found format of track %ld", priv->current_track_num);
|
||||
if (!gmip_find_track_format_post (priv)) return FALSE;
|
||||
if (!gmip_find_track_format_post (priv))
|
||||
return FALSE;
|
||||
/* save the track info */
|
||||
priv->stream->tracks = g_list_append (priv->stream->tracks,
|
||||
priv->current_track);
|
||||
|
@ -386,12 +373,10 @@ gst_media_info_read_idler (GstMediaInfo *info, GstMediaInfoStream **streamp, GEr
|
|||
priv->location = NULL;
|
||||
/* now see if we need to seek to a next track or not */
|
||||
priv->current_track_num++;
|
||||
if (priv->current_track_num < priv->stream->length_tracks)
|
||||
{
|
||||
if (priv->current_track_num < priv->stream->length_tracks) {
|
||||
gmi_seek_to_track (info, priv->current_track_num);
|
||||
priv->current_track = gmi_track_new ();
|
||||
if (!gmip_find_track_metadata_pre (priv))
|
||||
{
|
||||
if (!gmip_find_track_metadata_pre (priv)) {
|
||||
g_free (priv->current_track);
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -417,12 +402,14 @@ gst_media_info_read_idler (GstMediaInfo *info, GstMediaInfoStream **streamp, GEr
|
|||
* read all possible info from the file pointed to by location
|
||||
* use flags to limit the type of information searched for */
|
||||
GstMediaInfoStream *
|
||||
gst_media_info_read (GstMediaInfo *info, const char *location, guint16 flags, GError **error)
|
||||
gst_media_info_read (GstMediaInfo * info, const char *location, guint16 flags,
|
||||
GError ** error)
|
||||
{
|
||||
GstMediaInfoStream *stream = NULL;
|
||||
|
||||
gst_media_info_read_with_idler (info, location, flags, error);
|
||||
if (*error) return FALSE;
|
||||
if (*error)
|
||||
return FALSE;
|
||||
while (gst_media_info_read_idler (info, &stream, error) && stream == NULL)
|
||||
/* keep looping */ ;
|
||||
if (*error)
|
||||
|
|
|
@ -23,9 +23,7 @@
|
|||
|
||||
#include <gst/gst.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
typedef struct GstMediaInfoPriv GstMediaInfoPriv;
|
||||
G_BEGIN_DECLS typedef struct GstMediaInfoPriv GstMediaInfoPriv;
|
||||
typedef struct _GstMediaInfo GstMediaInfo;
|
||||
typedef struct _GstMediaInfoClass GstMediaInfoClass;
|
||||
|
||||
|
@ -44,7 +42,8 @@ struct _GstMediaInfoClass
|
|||
|
||||
/* signals */
|
||||
void (*media_info_signal) (GstMediaInfo * gst_media_info);
|
||||
void (*error_signal) (GstMediaInfo *gst_media_info, GError *error, const gchar *debug);
|
||||
void (*error_signal) (GstMediaInfo * gst_media_info, GError * error,
|
||||
const gchar * debug);
|
||||
|
||||
gpointer _gst_reserved[GST_PADDING];
|
||||
};
|
||||
|
@ -108,26 +107,17 @@ GType gst_media_info_get_type (void);
|
|||
GstMediaInfo *gst_media_info_new (GError ** error);
|
||||
|
||||
gboolean gst_media_info_set_source (GstMediaInfo * info,
|
||||
const char *source,
|
||||
GError **error);
|
||||
const char *source, GError ** error);
|
||||
void gst_media_info_read_with_idler (GstMediaInfo * media_info,
|
||||
const char *location,
|
||||
guint16 GST_MEDIA_INFO_FLAGS,
|
||||
GError **error);
|
||||
const char *location, guint16 GST_MEDIA_INFO_FLAGS, GError ** error);
|
||||
gboolean gst_media_info_read_idler (GstMediaInfo * media_info,
|
||||
GstMediaInfoStream **streamp,
|
||||
GError **error);
|
||||
GstMediaInfoStream *
|
||||
gst_media_info_read (GstMediaInfo *media_info,
|
||||
const char *location,
|
||||
guint16 GST_MEDIA_INFO_FLAGS,
|
||||
GError **error);
|
||||
GstMediaInfoStream ** streamp, GError ** error);
|
||||
GstMediaInfoStream *gst_media_info_read (GstMediaInfo * media_info,
|
||||
const char *location, guint16 GST_MEDIA_INFO_FLAGS, GError ** error);
|
||||
gboolean gst_media_info_read_many (GstMediaInfo * media_info,
|
||||
GList *locations,
|
||||
guint16 GST_MEDIA_INFO_FLAGS,
|
||||
GError **error);
|
||||
GstCaps * gst_media_info_get_next (GstMediaInfo *media_info,
|
||||
GError **error);
|
||||
GList * locations, guint16 GST_MEDIA_INFO_FLAGS, GError ** error);
|
||||
GstCaps *gst_media_info_get_next (GstMediaInfo * media_info, GError ** error);
|
||||
|
||||
/*
|
||||
* FIXME: reset ?
|
||||
gboolean gst_media_info_write (GstMediaInfo *media_info,
|
||||
|
@ -136,5 +126,4 @@ gboolean gst_media_info_write (GstMediaInfo *media_info,
|
|||
*/
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GST_MEDIA_INFO_H__ */
|
||||
|
|
|
@ -26,7 +26,8 @@
|
|||
#include "mixer.h"
|
||||
#include "mixer-marshal.h"
|
||||
|
||||
enum {
|
||||
enum
|
||||
{
|
||||
MUTE_TOGGLED,
|
||||
RECORD_TOGGLED,
|
||||
VOLUME_CHANGED,
|
||||
|
@ -56,8 +57,7 @@ gst_mixer_get_type (void)
|
|||
};
|
||||
|
||||
gst_mixer_type = g_type_register_static (G_TYPE_INTERFACE,
|
||||
"GstMixer",
|
||||
&gst_mixer_info, 0);
|
||||
"GstMixer", &gst_mixer_info, 0);
|
||||
g_type_interface_add_prerequisite (gst_mixer_type,
|
||||
GST_TYPE_IMPLEMENTS_INTERFACE);
|
||||
}
|
||||
|
@ -146,9 +146,7 @@ gst_mixer_list_tracks (GstMixer *mixer)
|
|||
*/
|
||||
|
||||
void
|
||||
gst_mixer_set_volume (GstMixer *mixer,
|
||||
GstMixerTrack *track,
|
||||
gint *volumes)
|
||||
gst_mixer_set_volume (GstMixer * mixer, GstMixerTrack * track, gint * volumes)
|
||||
{
|
||||
GstMixerClass *klass = GST_MIXER_GET_CLASS (mixer);
|
||||
|
||||
|
@ -169,9 +167,7 @@ gst_mixer_set_volume (GstMixer *mixer,
|
|||
*/
|
||||
|
||||
void
|
||||
gst_mixer_get_volume (GstMixer *mixer,
|
||||
GstMixerTrack *track,
|
||||
gint *volumes)
|
||||
gst_mixer_get_volume (GstMixer * mixer, GstMixerTrack * track, gint * volumes)
|
||||
{
|
||||
GstMixerClass *klass = GST_MIXER_GET_CLASS (mixer);
|
||||
|
||||
|
@ -198,9 +194,7 @@ gst_mixer_get_volume (GstMixer *mixer,
|
|||
*/
|
||||
|
||||
void
|
||||
gst_mixer_set_mute (GstMixer *mixer,
|
||||
GstMixerTrack *track,
|
||||
gboolean mute)
|
||||
gst_mixer_set_mute (GstMixer * mixer, GstMixerTrack * track, gboolean mute)
|
||||
{
|
||||
GstMixerClass *klass = GST_MIXER_GET_CLASS (mixer);
|
||||
|
||||
|
@ -223,9 +217,7 @@ gst_mixer_set_mute (GstMixer *mixer,
|
|||
*/
|
||||
|
||||
void
|
||||
gst_mixer_set_record (GstMixer *mixer,
|
||||
GstMixerTrack *track,
|
||||
gboolean record)
|
||||
gst_mixer_set_record (GstMixer * mixer, GstMixerTrack * track, gboolean record)
|
||||
{
|
||||
GstMixerClass *klass = GST_MIXER_GET_CLASS (mixer);
|
||||
|
||||
|
@ -235,43 +227,30 @@ gst_mixer_set_record (GstMixer *mixer,
|
|||
}
|
||||
|
||||
void
|
||||
gst_mixer_mute_toggled (GstMixer *mixer,
|
||||
GstMixerTrack *track,
|
||||
gboolean mute)
|
||||
gst_mixer_mute_toggled (GstMixer * mixer, GstMixerTrack * track, gboolean mute)
|
||||
{
|
||||
g_signal_emit (G_OBJECT (mixer),
|
||||
gst_mixer_signals[MUTE_TOGGLED], 0,
|
||||
track, mute);
|
||||
gst_mixer_signals[MUTE_TOGGLED], 0, track, mute);
|
||||
|
||||
g_signal_emit_by_name (G_OBJECT (track),
|
||||
"mute_toggled",
|
||||
mute);
|
||||
g_signal_emit_by_name (G_OBJECT (track), "mute_toggled", mute);
|
||||
}
|
||||
|
||||
void
|
||||
gst_mixer_record_toggled (GstMixer * mixer,
|
||||
GstMixerTrack *track,
|
||||
gboolean record)
|
||||
GstMixerTrack * track, gboolean record)
|
||||
{
|
||||
g_signal_emit (G_OBJECT (mixer),
|
||||
gst_mixer_signals[RECORD_TOGGLED], 0,
|
||||
track, record);
|
||||
gst_mixer_signals[RECORD_TOGGLED], 0, track, record);
|
||||
|
||||
g_signal_emit_by_name (G_OBJECT (track),
|
||||
"record_toggled",
|
||||
record);
|
||||
g_signal_emit_by_name (G_OBJECT (track), "record_toggled", record);
|
||||
}
|
||||
|
||||
void
|
||||
gst_mixer_volume_changed (GstMixer * mixer,
|
||||
GstMixerTrack *track,
|
||||
gint *volumes)
|
||||
GstMixerTrack * track, gint * volumes)
|
||||
{
|
||||
g_signal_emit (G_OBJECT (mixer),
|
||||
gst_mixer_signals[VOLUME_CHANGED], 0,
|
||||
track, volumes);
|
||||
gst_mixer_signals[VOLUME_CHANGED], 0, track, volumes);
|
||||
|
||||
g_signal_emit_by_name (G_OBJECT (track),
|
||||
"volume_changed",
|
||||
volumes);
|
||||
g_signal_emit_by_name (G_OBJECT (track), "volume_changed", volumes);
|
||||
}
|
||||
|
|
|
@ -27,7 +27,6 @@
|
|||
#include <gst/mixer/mixer-enumtypes.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define GST_TYPE_MIXER \
|
||||
(gst_mixer_get_type ())
|
||||
#define GST_MIXER(obj) \
|
||||
|
@ -40,9 +39,7 @@ G_BEGIN_DECLS
|
|||
(G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_MIXER))
|
||||
#define GST_MIXER_GET_CLASS(inst) \
|
||||
(G_TYPE_INSTANCE_GET_INTERFACE ((inst), GST_TYPE_MIXER, GstMixerClass))
|
||||
|
||||
#define GST_MIXER_TYPE(klass) (klass->mixer_type)
|
||||
|
||||
typedef struct _GstMixer GstMixer;
|
||||
|
||||
typedef enum
|
||||
|
@ -51,7 +48,8 @@ typedef enum
|
|||
GST_MIXER_SOFTWARE
|
||||
} GstMixerType;
|
||||
|
||||
typedef struct _GstMixerClass {
|
||||
typedef struct _GstMixerClass
|
||||
{
|
||||
GTypeInterface klass;
|
||||
|
||||
GstMixerType mixer_type;
|
||||
|
@ -59,30 +57,19 @@ typedef struct _GstMixerClass {
|
|||
/* virtual functions */
|
||||
const GList *(*list_tracks) (GstMixer * mixer);
|
||||
|
||||
void (* set_volume) (GstMixer *mixer,
|
||||
GstMixerTrack *track,
|
||||
gint *volumes);
|
||||
void (* get_volume) (GstMixer *mixer,
|
||||
GstMixerTrack *track,
|
||||
gint *volumes);
|
||||
void (*set_volume) (GstMixer * mixer, GstMixerTrack * track, gint * volumes);
|
||||
void (*get_volume) (GstMixer * mixer, GstMixerTrack * track, gint * volumes);
|
||||
|
||||
void (* set_mute) (GstMixer *mixer,
|
||||
GstMixerTrack *track,
|
||||
gboolean mute);
|
||||
void (* set_record) (GstMixer *mixer,
|
||||
GstMixerTrack *track,
|
||||
gboolean record);
|
||||
void (*set_mute) (GstMixer * mixer, GstMixerTrack * track, gboolean mute);
|
||||
void (*set_record) (GstMixer * mixer, GstMixerTrack * track, gboolean record);
|
||||
|
||||
/* signals */
|
||||
void (*mute_toggled) (GstMixer * mixer,
|
||||
GstMixerTrack *channel,
|
||||
gboolean mute);
|
||||
GstMixerTrack * channel, gboolean mute);
|
||||
void (*record_toggled) (GstMixer * mixer,
|
||||
GstMixerTrack *channel,
|
||||
gboolean record);
|
||||
GstMixerTrack * channel, gboolean record);
|
||||
void (*volume_changed) (GstMixer * mixer,
|
||||
GstMixerTrack *channel,
|
||||
gint *volumes);
|
||||
GstMixerTrack * channel, gint * volumes);
|
||||
|
||||
gpointer _gst_reserved[GST_PADDING];
|
||||
} GstMixerClass;
|
||||
|
@ -92,29 +79,21 @@ GType gst_mixer_get_type (void);
|
|||
/* virtual class function wrappers */
|
||||
const GList *gst_mixer_list_tracks (GstMixer * mixer);
|
||||
void gst_mixer_set_volume (GstMixer * mixer,
|
||||
GstMixerTrack *track,
|
||||
gint *volumes);
|
||||
GstMixerTrack * track, gint * volumes);
|
||||
void gst_mixer_get_volume (GstMixer * mixer,
|
||||
GstMixerTrack *track,
|
||||
gint *volumes);
|
||||
GstMixerTrack * track, gint * volumes);
|
||||
void gst_mixer_set_mute (GstMixer * mixer,
|
||||
GstMixerTrack *track,
|
||||
gboolean mute);
|
||||
GstMixerTrack * track, gboolean mute);
|
||||
void gst_mixer_set_record (GstMixer * mixer,
|
||||
GstMixerTrack *track,
|
||||
gboolean record);
|
||||
GstMixerTrack * track, gboolean record);
|
||||
|
||||
/* trigger signals */
|
||||
void gst_mixer_mute_toggled (GstMixer * mixer,
|
||||
GstMixerTrack *track,
|
||||
gboolean mute);
|
||||
GstMixerTrack * track, gboolean mute);
|
||||
void gst_mixer_record_toggled (GstMixer * mixer,
|
||||
GstMixerTrack *track,
|
||||
gboolean record);
|
||||
GstMixerTrack * track, gboolean record);
|
||||
void gst_mixer_volume_changed (GstMixer * mixer,
|
||||
GstMixerTrack *track,
|
||||
gint *volumes);
|
||||
GstMixerTrack * track, gint * volumes);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GST_MIXER_H__ */
|
||||
|
|
|
@ -25,7 +25,8 @@
|
|||
|
||||
#include "mixertrack.h"
|
||||
|
||||
enum {
|
||||
enum
|
||||
{
|
||||
/* FILL ME */
|
||||
SIGNAL_VOLUME_CHANGED,
|
||||
SIGNAL_RECORD_TOGGLED,
|
||||
|
@ -61,8 +62,7 @@ gst_mixer_track_get_type (void)
|
|||
|
||||
gst_mixer_track_type =
|
||||
g_type_register_static (G_TYPE_OBJECT,
|
||||
"GstMixerTrack",
|
||||
&mixer_track_info, 0);
|
||||
"GstMixerTrack", &mixer_track_info, 0);
|
||||
}
|
||||
|
||||
return gst_mixer_track_type;
|
||||
|
|
|
@ -25,7 +25,6 @@
|
|||
#include <gst/gst.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define GST_TYPE_MIXER_TRACK \
|
||||
(gst_mixer_track_get_type ())
|
||||
#define GST_MIXER_TRACK(obj) \
|
||||
|
@ -38,7 +37,6 @@ G_BEGIN_DECLS
|
|||
(G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_MIXER_TRACK))
|
||||
#define GST_IS_MIXER_TRACK_CLASS(klass) \
|
||||
(G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_MIXER_TRACK))
|
||||
|
||||
/*
|
||||
* Naming:
|
||||
*
|
||||
|
@ -54,8 +52,8 @@ G_BEGIN_DECLS
|
|||
* mixer, which means that setting this track will change
|
||||
* the hearable volume on any output.
|
||||
*/
|
||||
|
||||
typedef enum {
|
||||
typedef enum
|
||||
{
|
||||
GST_MIXER_TRACK_INPUT = (1 << 0),
|
||||
GST_MIXER_TRACK_OUTPUT = (1 << 1),
|
||||
GST_MIXER_TRACK_MUTE = (1 << 2),
|
||||
|
@ -67,26 +65,23 @@ typedef enum {
|
|||
#define GST_MIXER_TRACK_HAS_FLAG(channel, flag) \
|
||||
((channel)->flags & flag)
|
||||
|
||||
typedef struct _GstMixerTrack {
|
||||
typedef struct _GstMixerTrack
|
||||
{
|
||||
GObject parent;
|
||||
|
||||
gchar *label;
|
||||
GstMixerTrackFlags flags;
|
||||
gint num_channels,
|
||||
min_volume,
|
||||
max_volume;
|
||||
gint num_channels, min_volume, max_volume;
|
||||
} GstMixerTrack;
|
||||
|
||||
typedef struct _GstMixerTrackClass {
|
||||
typedef struct _GstMixerTrackClass
|
||||
{
|
||||
GObjectClass parent;
|
||||
|
||||
/* signals */
|
||||
void (* mute_toggled) (GstMixerTrack *channel,
|
||||
gboolean mute);
|
||||
void (* record_toggled) (GstMixerTrack *channel,
|
||||
gboolean record);
|
||||
void (* volume_changed) (GstMixerTrack *channel,
|
||||
gint *volumes);
|
||||
void (*mute_toggled) (GstMixerTrack * channel, gboolean mute);
|
||||
void (*record_toggled) (GstMixerTrack * channel, gboolean record);
|
||||
void (*volume_changed) (GstMixerTrack * channel, gint * volumes);
|
||||
|
||||
gpointer _gst_reserved[GST_PADDING];
|
||||
} GstMixerTrackClass;
|
||||
|
@ -94,5 +89,4 @@ typedef struct _GstMixerTrackClass {
|
|||
GType gst_mixer_track_get_type (void);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GST_MIXER_TRACK_H__ */
|
||||
|
|
|
@ -46,8 +46,7 @@ gst_navigation_get_type (void)
|
|||
};
|
||||
|
||||
gst_navigation_type = g_type_register_static (G_TYPE_INTERFACE,
|
||||
"GstNavigation",
|
||||
&gst_navigation_info, 0);
|
||||
"GstNavigation", &gst_navigation_info, 0);
|
||||
}
|
||||
|
||||
return gst_navigation_type;
|
||||
|
@ -74,22 +73,17 @@ void
|
|||
gst_navigation_send_key_event (GstNavigation * navigation, const char *event,
|
||||
const char *key)
|
||||
{
|
||||
gst_navigation_send_event (navigation, gst_structure_new (
|
||||
"application/x-gst-navigation",
|
||||
"event", G_TYPE_STRING, event,
|
||||
"key", G_TYPE_STRING, key, NULL));
|
||||
gst_navigation_send_event (navigation,
|
||||
gst_structure_new ("application/x-gst-navigation", "event", G_TYPE_STRING,
|
||||
event, "key", G_TYPE_STRING, key, NULL));
|
||||
}
|
||||
|
||||
void
|
||||
gst_navigation_send_mouse_event (GstNavigation * navigation, const char *event,
|
||||
int button, double x, double y)
|
||||
{
|
||||
gst_navigation_send_event (navigation, gst_structure_new (
|
||||
"application/x-gst-navigation",
|
||||
"event", G_TYPE_STRING, event,
|
||||
"button", G_TYPE_INT, button,
|
||||
"pointer_x", G_TYPE_DOUBLE, x,
|
||||
gst_navigation_send_event (navigation,
|
||||
gst_structure_new ("application/x-gst-navigation", "event", G_TYPE_STRING,
|
||||
event, "button", G_TYPE_INT, button, "pointer_x", G_TYPE_DOUBLE, x,
|
||||
"pointer_y", G_TYPE_DOUBLE, y, NULL));
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -26,7 +26,6 @@
|
|||
#include <gst/gst.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define GST_TYPE_NAVIGATION \
|
||||
(gst_navigation_get_type ())
|
||||
#define GST_NAVIGATION(obj) \
|
||||
|
@ -35,10 +34,10 @@ G_BEGIN_DECLS
|
|||
(G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_NAVIGATION))
|
||||
#define GST_NAVIGATION_GET_IFACE(obj) \
|
||||
(G_TYPE_INSTANCE_GET_INTERFACE ((obj), GST_TYPE_NAVIGATION, GstNavigationInterface))
|
||||
|
||||
typedef struct _GstNavigation GstNavigation;
|
||||
|
||||
typedef struct _GstNavigationInterface {
|
||||
typedef struct _GstNavigationInterface
|
||||
{
|
||||
GTypeInterface g_iface;
|
||||
|
||||
/* virtual functions */
|
||||
|
@ -50,7 +49,8 @@ typedef struct _GstNavigationInterface {
|
|||
GType gst_navigation_get_type (void);
|
||||
|
||||
/* virtual class function wrappers */
|
||||
void gst_navigation_send_event (GstNavigation *navigation, GstStructure *structure);
|
||||
void gst_navigation_send_event (GstNavigation * navigation,
|
||||
GstStructure * structure);
|
||||
|
||||
void gst_navigation_send_key_event (GstNavigation * navigation,
|
||||
const char *event, const char *key);
|
||||
|
@ -58,5 +58,4 @@ void gst_navigation_send_mouse_event (GstNavigation *navigation,
|
|||
const char *event, int button, double x, double y);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GST_NAVIGATION_H__ */
|
||||
|
|
|
@ -34,7 +34,8 @@ enum
|
|||
LAST_SIGNAL
|
||||
};
|
||||
|
||||
struct _GstPlayPrivate {
|
||||
struct _GstPlayPrivate
|
||||
{
|
||||
char *location;
|
||||
|
||||
GHashTable *elements;
|
||||
|
@ -67,13 +68,16 @@ static GstPipelineClass *parent_class = NULL;
|
|||
/* */
|
||||
/* ======================================================= */
|
||||
|
||||
static GstCaps * gst_play_video_fixate (GstPad *pad, const GstCaps *caps, gpointer user_data);
|
||||
static GstCaps * gst_play_audio_fixate (GstPad *pad, const GstCaps *caps, gpointer user_data);
|
||||
static GstCaps *gst_play_video_fixate (GstPad * pad, const GstCaps * caps,
|
||||
gpointer user_data);
|
||||
static GstCaps *gst_play_audio_fixate (GstPad * pad, const GstCaps * caps,
|
||||
gpointer user_data);
|
||||
|
||||
static GQuark
|
||||
gst_play_error_quark (void)
|
||||
{
|
||||
static GQuark quark = 0;
|
||||
|
||||
if (quark == 0)
|
||||
quark = g_quark_from_static_string ("gst-play-error-quark");
|
||||
return quark;
|
||||
|
@ -102,8 +106,7 @@ gst_play_error_plugin (const gchar *element, GError ** error)
|
|||
message = g_strdup_printf ("The %s element could not be found. "
|
||||
"This element is essential for playback. "
|
||||
"Please install the right plug-in and verify "
|
||||
"that it works by running 'gst-inspect %s'",
|
||||
element, element);
|
||||
"that it works by running 'gst-inspect %s'", element, element);
|
||||
gst_play_error_create (error, message);
|
||||
g_free (message);
|
||||
return;
|
||||
|
@ -131,16 +134,21 @@ gst_play_pipeline_setup (GstPlay *play, GError **error)
|
|||
{
|
||||
/* Threads */
|
||||
GstElement *work_thread, *audio_thread, *video_thread;
|
||||
|
||||
/* Main Thread elements */
|
||||
GstElement *source, *autoplugger, *audioconvert, *volume, *tee, *identity;
|
||||
GstElement *identity_cs;
|
||||
|
||||
/* Visualization bin */
|
||||
GstElement *vis_bin, *vis_queue, *vis_element, *vis_cs;
|
||||
|
||||
/* Video Thread elements */
|
||||
GstElement *video_queue, *video_switch, *video_cs, *video_balance;
|
||||
GstElement *balance_cs, *video_scaler, *video_sink;
|
||||
|
||||
/* Audio Thread elements */
|
||||
GstElement *audio_queue, *audio_sink;
|
||||
|
||||
/* Some useful pads */
|
||||
GstPad *tee_pad1, *tee_pad2;
|
||||
|
||||
|
@ -162,7 +170,8 @@ gst_play_pipeline_setup (GstPlay *play, GError **error)
|
|||
g_hash_table_insert (play->priv->elements, "autoplugger", autoplugger);
|
||||
|
||||
/* Make sure we convert audio to the needed format */
|
||||
GST_PLAY_MAKE_OR_ERROR (audioconvert, "audioconvert", "audioconvert", error);
|
||||
GST_PLAY_MAKE_OR_ERROR (audioconvert, "audioconvert", "audioconvert",
|
||||
error);
|
||||
g_hash_table_insert (play->priv->elements, "audioconvert", audioconvert);
|
||||
|
||||
/* Duplicate audio signal to audio sink and visualization thread */
|
||||
|
@ -173,7 +182,8 @@ gst_play_pipeline_setup (GstPlay *play, GError **error)
|
|||
g_hash_table_insert (play->priv->elements, "tee_pad2", tee_pad2);
|
||||
g_hash_table_insert (play->priv->elements, "tee", tee);
|
||||
|
||||
gst_bin_add_many (GST_BIN (work_thread), source, autoplugger, audioconvert, tee, NULL);
|
||||
gst_bin_add_many (GST_BIN (work_thread), source, autoplugger, audioconvert,
|
||||
tee, NULL);
|
||||
if (!gst_element_link_many (source, autoplugger, audioconvert, tee, NULL))
|
||||
GST_PLAY_ERROR_RETURN (error, "Could not link source thread elements");
|
||||
|
||||
|
@ -184,8 +194,7 @@ gst_play_pipeline_setup (GstPlay *play, GError **error)
|
|||
identity_cs = gst_element_factory_make ("ffcolorspace", "identity_cs");
|
||||
if (!GST_IS_ELEMENT (identity_cs)) {
|
||||
identity_cs = gst_element_factory_make ("colorspace", "identity_cs");
|
||||
if (!GST_IS_ELEMENT (identity_cs))
|
||||
{
|
||||
if (!GST_IS_ELEMENT (identity_cs)) {
|
||||
gst_play_error_plugin ("colorspace", error);
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -199,8 +208,7 @@ gst_play_pipeline_setup (GstPlay *play, GError **error)
|
|||
/* Visualization bin (note: it s not added to the pipeline yet) */
|
||||
{
|
||||
vis_bin = gst_bin_new ("vis_bin");
|
||||
if (!GST_IS_ELEMENT (vis_bin))
|
||||
{
|
||||
if (!GST_IS_ELEMENT (vis_bin)) {
|
||||
gst_play_error_plugin ("bin", error);
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -219,8 +227,7 @@ gst_play_pipeline_setup (GstPlay *play, GError **error)
|
|||
vis_cs = gst_element_factory_make ("ffcolorspace", "vis_cs");
|
||||
if (!GST_IS_ELEMENT (vis_cs)) {
|
||||
vis_cs = gst_element_factory_make ("colorspace", "vis_cs");
|
||||
if (!GST_IS_ELEMENT (vis_cs))
|
||||
{
|
||||
if (!GST_IS_ELEMENT (vis_cs)) {
|
||||
gst_play_error_plugin ("colorspace", error);
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -230,9 +237,10 @@ gst_play_pipeline_setup (GstPlay *play, GError **error)
|
|||
|
||||
gst_bin_add_many (GST_BIN (vis_bin), vis_queue, vis_element, vis_cs, NULL);
|
||||
if (!gst_element_link_many (vis_queue, vis_element, vis_cs, NULL))
|
||||
GST_PLAY_ERROR_RETURN (error, "Could not link visualisation thread elements");
|
||||
gst_element_add_ghost_pad (vis_bin,
|
||||
gst_element_get_pad (vis_cs, "src"), "src");
|
||||
GST_PLAY_ERROR_RETURN (error,
|
||||
"Could not link visualisation thread elements");
|
||||
gst_element_add_ghost_pad (vis_bin, gst_element_get_pad (vis_cs, "src"),
|
||||
"src");
|
||||
}
|
||||
/* Creating our video output bin */
|
||||
{
|
||||
|
@ -251,8 +259,7 @@ gst_play_pipeline_setup (GstPlay *play, GError **error)
|
|||
video_cs = gst_element_factory_make ("ffcolorspace", "video_cs");
|
||||
if (!GST_IS_ELEMENT (video_cs)) {
|
||||
video_cs = gst_element_factory_make ("colorspace", "video_cs");
|
||||
if (!GST_IS_ELEMENT (video_cs))
|
||||
{
|
||||
if (!GST_IS_ELEMENT (video_cs)) {
|
||||
gst_play_error_plugin ("colorspace", error);
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -260,15 +267,15 @@ gst_play_pipeline_setup (GstPlay *play, GError **error)
|
|||
g_hash_table_insert (play->priv->elements, "video_cs", video_cs);
|
||||
|
||||
/* Software colorbalance */
|
||||
GST_PLAY_MAKE_OR_ERROR (video_balance, "videobalance", "video_balance", error);
|
||||
GST_PLAY_MAKE_OR_ERROR (video_balance, "videobalance", "video_balance",
|
||||
error);
|
||||
g_hash_table_insert (play->priv->elements, "video_balance", video_balance);
|
||||
|
||||
/* Colorspace conversion */
|
||||
balance_cs = gst_element_factory_make ("ffcolorspace", "balance_cs");
|
||||
if (!GST_IS_ELEMENT (balance_cs)) {
|
||||
balance_cs = gst_element_factory_make ("colorspace", "balance_cs");
|
||||
if (!GST_IS_ELEMENT (balance_cs))
|
||||
{
|
||||
if (!GST_IS_ELEMENT (balance_cs)) {
|
||||
gst_play_error_plugin ("colorspace", error);
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -285,26 +292,32 @@ gst_play_pipeline_setup (GstPlay *play, GError **error)
|
|||
GST_PLAY_MAKE_OR_ERROR (video_sink, "fakesink", "video_sink", error);
|
||||
g_hash_table_insert (play->priv->elements, "video_sink", video_sink);
|
||||
|
||||
gst_bin_add_many (GST_BIN (video_thread), video_queue, video_switch, video_cs,
|
||||
video_balance, balance_cs, video_scaler, video_sink, NULL);
|
||||
gst_bin_add_many (GST_BIN (video_thread), video_queue, video_switch,
|
||||
video_cs, video_balance, balance_cs, video_scaler, video_sink, NULL);
|
||||
/* break down linking so we can figure out what might be failing */
|
||||
if (!gst_element_link (video_queue, video_switch))
|
||||
GST_PLAY_ERROR_RETURN (error, "Could not link video output thread (queue and switch)");
|
||||
GST_PLAY_ERROR_RETURN (error,
|
||||
"Could not link video output thread (queue and switch)");
|
||||
if (!gst_element_link (video_switch, video_cs))
|
||||
GST_PLAY_ERROR_RETURN (error, "Could not link video output thread (switch and cs)");
|
||||
GST_PLAY_ERROR_RETURN (error,
|
||||
"Could not link video output thread (switch and cs)");
|
||||
if (!gst_element_link (video_cs, video_balance))
|
||||
GST_PLAY_ERROR_RETURN (error, "Could not link video output thread (cs and balance)");
|
||||
GST_PLAY_ERROR_RETURN (error,
|
||||
"Could not link video output thread (cs and balance)");
|
||||
if (!gst_element_link (video_balance, balance_cs))
|
||||
GST_PLAY_ERROR_RETURN (error, "Could not link video output thread (balance and balance_cs)");
|
||||
GST_PLAY_ERROR_RETURN (error,
|
||||
"Could not link video output thread (balance and balance_cs)");
|
||||
if (!gst_element_link (balance_cs, video_scaler))
|
||||
GST_PLAY_ERROR_RETURN (error, "Could not link video output thread (balance_cs and scaler)");
|
||||
GST_PLAY_ERROR_RETURN (error,
|
||||
"Could not link video output thread (balance_cs and scaler)");
|
||||
if (!gst_element_link (video_scaler, video_sink))
|
||||
GST_PLAY_ERROR_RETURN (error, "Could not link video output thread (balance_cs and scaler)");
|
||||
gst_element_add_ghost_pad (video_thread,
|
||||
gst_element_get_pad (video_queue, "sink"),
|
||||
"sink");
|
||||
GST_PLAY_ERROR_RETURN (error,
|
||||
"Could not link video output thread (balance_cs and scaler)");
|
||||
gst_element_add_ghost_pad (video_thread, gst_element_get_pad (video_queue,
|
||||
"sink"), "sink");
|
||||
if (!gst_element_link (identity_cs, video_thread))
|
||||
GST_PLAY_ERROR_RETURN (error, "Could not link video output thread elements");
|
||||
GST_PLAY_ERROR_RETURN (error,
|
||||
"Could not link video output thread elements");
|
||||
}
|
||||
/* Creating our audio output bin
|
||||
{ queue ! fakesink } */
|
||||
|
@ -327,12 +340,13 @@ gst_play_pipeline_setup (GstPlay *play, GError **error)
|
|||
GST_PLAY_MAKE_OR_ERROR (audio_sink, "fakesink", "audio_sink", error);
|
||||
g_hash_table_insert (play->priv->elements, "audio_sink", audio_sink);
|
||||
|
||||
gst_bin_add_many (GST_BIN (audio_thread), audio_queue, volume, audio_sink, NULL);
|
||||
gst_bin_add_many (GST_BIN (audio_thread), audio_queue, volume, audio_sink,
|
||||
NULL);
|
||||
if (!gst_element_link_many (audio_queue, volume, audio_sink, NULL))
|
||||
GST_PLAY_ERROR_RETURN (error, "Could not link audio output thread elements");
|
||||
gst_element_add_ghost_pad (audio_thread,
|
||||
gst_element_get_pad (audio_queue, "sink"),
|
||||
"sink");
|
||||
GST_PLAY_ERROR_RETURN (error,
|
||||
"Could not link audio output thread elements");
|
||||
gst_element_add_ghost_pad (audio_thread, gst_element_get_pad (audio_queue,
|
||||
"sink"), "sink");
|
||||
gst_pad_link (tee_pad2, gst_element_get_pad (audio_queue, "sink"));
|
||||
}
|
||||
|
||||
|
@ -358,8 +372,7 @@ gst_play_tick_callback (GstPlay *play)
|
|||
|
||||
g_return_val_if_fail (play != NULL, FALSE);
|
||||
/* just return without updating the UI when we are in the middle of seeking */
|
||||
if (play->priv->tick_unblock_remaining > 0)
|
||||
{
|
||||
if (play->priv->tick_unblock_remaining > 0) {
|
||||
play->priv->tick_unblock_remaining -= TICK_INTERVAL_MSEC;
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -436,8 +449,7 @@ gst_play_get_length_callback (GstPlay *play)
|
|||
if (play->priv->get_length_attempt > 15) {
|
||||
play->priv->length_id = 0;
|
||||
return FALSE;
|
||||
}
|
||||
else
|
||||
} else
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -449,7 +461,8 @@ gst_play_video_fixate (GstPad *pad, const GstCaps *caps, gpointer user_data)
|
|||
|
||||
GST_DEBUG ("video fixate %p %" GST_PTR_FORMAT, pad, caps);
|
||||
|
||||
if (gst_caps_get_size (caps) > 1) return NULL;
|
||||
if (gst_caps_get_size (caps) > 1)
|
||||
return NULL;
|
||||
|
||||
newcaps = gst_caps_copy (caps);
|
||||
structure = gst_caps_get_structure (newcaps, 0);
|
||||
|
@ -478,8 +491,9 @@ gst_play_audio_fixate (GstPad *pad, const GstCaps *caps, gpointer user_data)
|
|||
|
||||
GST_DEBUG ("audio fixate %p %" GST_PTR_FORMAT, pad, caps);
|
||||
|
||||
newcaps = gst_caps_new_full (gst_structure_copy (
|
||||
gst_caps_get_structure (caps, 0)), NULL);
|
||||
newcaps =
|
||||
gst_caps_new_full (gst_structure_copy (gst_caps_get_structure (caps, 0)),
|
||||
NULL);
|
||||
structure = gst_caps_get_structure (newcaps, 0);
|
||||
|
||||
if (gst_caps_structure_fixate_field_nearest_int (structure, "rate", 44100)) {
|
||||
|
@ -518,8 +532,7 @@ gst_play_state_change (GstElement *element, GstElementState old,
|
|||
}
|
||||
|
||||
play->priv->tick_id = g_timeout_add (TICK_INTERVAL_MSEC,
|
||||
(GSourceFunc) gst_play_tick_callback,
|
||||
play);
|
||||
(GSourceFunc) gst_play_tick_callback, play);
|
||||
|
||||
play->priv->get_length_attempt = 0;
|
||||
|
||||
|
@ -529,10 +542,8 @@ gst_play_state_change (GstElement *element, GstElementState old,
|
|||
}
|
||||
|
||||
play->priv->length_id = g_timeout_add (TICK_INTERVAL_MSEC,
|
||||
(GSourceFunc) gst_play_get_length_callback,
|
||||
play);
|
||||
}
|
||||
else {
|
||||
(GSourceFunc) gst_play_get_length_callback, play);
|
||||
} else {
|
||||
if (play->priv->tick_id) {
|
||||
g_source_remove (play->priv->tick_id);
|
||||
play->priv->tick_id = 0;
|
||||
|
@ -548,7 +559,8 @@ gst_play_state_change (GstElement *element, GstElementState old,
|
|||
}
|
||||
|
||||
static void
|
||||
gst_play_identity_handoff (GstElement *identity, GstBuffer *buf, GstPlay *play)
|
||||
gst_play_identity_handoff (GstElement * identity, GstBuffer * buf,
|
||||
GstPlay * play)
|
||||
{
|
||||
g_signal_handler_disconnect (G_OBJECT (identity), play->priv->handoff_hid);
|
||||
play->priv->handoff_hid = 0;
|
||||
|
@ -605,8 +617,7 @@ gst_play_init (GstPlay *play)
|
|||
play->priv->error = NULL;
|
||||
play->priv->debug = NULL;
|
||||
|
||||
if (!gst_play_pipeline_setup (play, &play->priv->error))
|
||||
{
|
||||
if (!gst_play_pipeline_setup (play, &play->priv->error)) {
|
||||
g_warning ("libgstplay: failed initializing pipeline, error: %s",
|
||||
play->priv->error->message);
|
||||
}
|
||||
|
@ -637,8 +648,7 @@ gst_play_class_init (GstPlayClass *klass)
|
|||
g_signal_new ("have-video-size", G_TYPE_FROM_CLASS (klass),
|
||||
G_SIGNAL_RUN_FIRST,
|
||||
G_STRUCT_OFFSET (GstPlayClass, have_video_size), NULL, NULL,
|
||||
gst_marshal_VOID__INT_INT, G_TYPE_NONE, 2,
|
||||
G_TYPE_INT, G_TYPE_INT);
|
||||
gst_marshal_VOID__INT_INT, G_TYPE_NONE, 2, G_TYPE_INT, G_TYPE_INT);
|
||||
}
|
||||
|
||||
/* ======================================================= */
|
||||
|
@ -757,8 +767,7 @@ gst_play_seek_to_time (GstPlay * play, gint64 time_nanos)
|
|||
"audioconvert");
|
||||
audio_sink_element = g_hash_table_lookup (play->priv->elements,
|
||||
"audio_sink_element");
|
||||
video_seek_element = g_hash_table_lookup (play->priv->elements,
|
||||
"identity");
|
||||
video_seek_element = g_hash_table_lookup (play->priv->elements, "identity");
|
||||
|
||||
if (GST_IS_ELEMENT (audio_seek_element) &&
|
||||
GST_IS_ELEMENT (video_seek_element) &&
|
||||
|
@ -771,12 +780,10 @@ gst_play_seek_to_time (GstPlay * play, gint64 time_nanos)
|
|||
play->priv->tick_unblock_remaining = 500;
|
||||
|
||||
s = gst_element_seek (video_seek_element, GST_FORMAT_TIME |
|
||||
GST_SEEK_METHOD_SET | GST_SEEK_FLAG_FLUSH,
|
||||
time_nanos);
|
||||
GST_SEEK_METHOD_SET | GST_SEEK_FLAG_FLUSH, time_nanos);
|
||||
if (!s) {
|
||||
s = gst_element_seek (audio_seek_element, GST_FORMAT_TIME |
|
||||
GST_SEEK_METHOD_SET | GST_SEEK_FLAG_FLUSH,
|
||||
time_nanos);
|
||||
GST_SEEK_METHOD_SET | GST_SEEK_FLAG_FLUSH, time_nanos);
|
||||
}
|
||||
|
||||
if (s) {
|
||||
|
@ -890,8 +897,7 @@ gst_play_set_video_sink (GstPlay *play, GstElement *video_sink)
|
|||
video_sink_element);
|
||||
if (GST_IS_X_OVERLAY (video_sink_element)) {
|
||||
g_signal_connect (G_OBJECT (video_sink_element),
|
||||
"desired_size_changed",
|
||||
G_CALLBACK (gst_play_have_video_size), play);
|
||||
"desired_size_changed", G_CALLBACK (gst_play_have_video_size), play);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -982,8 +988,7 @@ gst_play_set_visualization (GstPlay *play, GstElement *vis_element)
|
|||
vis_queue = g_hash_table_lookup (play->priv->elements, "vis_queue");
|
||||
if (!GST_IS_ELEMENT (vis_queue))
|
||||
return FALSE;
|
||||
old_vis_element = g_hash_table_lookup (play->priv->elements,
|
||||
"vis_element");
|
||||
old_vis_element = g_hash_table_lookup (play->priv->elements, "vis_element");
|
||||
if (!GST_IS_ELEMENT (old_vis_element))
|
||||
return FALSE;
|
||||
vis_cs = g_hash_table_lookup (play->priv->elements, "vis_cs");
|
||||
|
@ -1079,8 +1084,7 @@ gst_play_connect_visualization (GstPlay * play, gboolean connect)
|
|||
gst_element_release_request_pad (video_switch, switch_pad);
|
||||
gst_object_ref (GST_OBJECT (vis_bin));
|
||||
gst_bin_remove (GST_BIN (video_thread), vis_bin);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
|
||||
/* If we are supposed to disconnect then nothing to do we return */
|
||||
if (!connect) {
|
||||
|
@ -1097,8 +1101,7 @@ gst_play_connect_visualization (GstPlay * play, gboolean connect)
|
|||
|
||||
/* Adding, linking */
|
||||
play->priv->handoff_hid = g_signal_connect (G_OBJECT (identity),
|
||||
"handoff",
|
||||
G_CALLBACK (gst_play_identity_handoff), play);
|
||||
"handoff", G_CALLBACK (gst_play_identity_handoff), play);
|
||||
gst_bin_add (GST_BIN (video_thread), vis_bin);
|
||||
gst_pad_link (tee_pad1, vis_queue_pad);
|
||||
gst_element_link (vis_bin, video_switch);
|
||||
|
@ -1153,8 +1156,7 @@ gst_play_get_sink_element (GstPlay *play,
|
|||
element = gst_play_get_sink_element (play, element, sink_type);
|
||||
if (GST_IS_ELEMENT (element))
|
||||
return element;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
pads = gst_element_get_pad_list (element);
|
||||
has_src = FALSE;
|
||||
has_correct_type = FALSE;
|
||||
|
@ -1163,8 +1165,7 @@ gst_play_get_sink_element (GstPlay *play,
|
|||
if (GST_PAD_DIRECTION (GST_PAD (pads->data)) == GST_PAD_SRC) {
|
||||
has_src = TRUE;
|
||||
break;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
/* If not a src pad checking caps */
|
||||
GstCaps *caps;
|
||||
GstStructure *structure;
|
||||
|
@ -1227,16 +1228,13 @@ gst_play_new (GError **error)
|
|||
{
|
||||
GstPlay *play = g_object_new (GST_TYPE_PLAY, NULL);
|
||||
|
||||
if (play->priv->error)
|
||||
{
|
||||
if (error)
|
||||
{
|
||||
if (play->priv->error) {
|
||||
if (error) {
|
||||
*error = play->priv->error;
|
||||
play->priv->error = NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
g_warning ("Error creating GstPlay object.\n%s", play->priv->error->message);
|
||||
} else {
|
||||
g_warning ("Error creating GstPlay object.\n%s",
|
||||
play->priv->error->message);
|
||||
g_error_free (play->priv->error);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -70,27 +70,19 @@ struct _GstPlayClass
|
|||
GType gst_play_get_type (void);
|
||||
GstPlay *gst_play_new (GError ** error);
|
||||
|
||||
gboolean gst_play_set_data_src (GstPlay *play,
|
||||
GstElement *data_src);
|
||||
gboolean gst_play_set_video_sink (GstPlay *play,
|
||||
GstElement *video_sink);
|
||||
gboolean gst_play_set_audio_sink (GstPlay *play,
|
||||
GstElement *audio_sink);
|
||||
gboolean gst_play_set_data_src (GstPlay * play, GstElement * data_src);
|
||||
gboolean gst_play_set_video_sink (GstPlay * play, GstElement * video_sink);
|
||||
gboolean gst_play_set_audio_sink (GstPlay * play, GstElement * audio_sink);
|
||||
|
||||
gboolean gst_play_set_visualization (GstPlay *play,
|
||||
GstElement *element);
|
||||
gboolean gst_play_connect_visualization (GstPlay *play,
|
||||
gboolean connect);
|
||||
gboolean gst_play_set_visualization (GstPlay * play, GstElement * element);
|
||||
gboolean gst_play_connect_visualization (GstPlay * play, gboolean connect);
|
||||
|
||||
gboolean gst_play_set_location (GstPlay *play,
|
||||
const char *location);
|
||||
gboolean gst_play_set_location (GstPlay * play, const char *location);
|
||||
char *gst_play_get_location (GstPlay * play);
|
||||
|
||||
gboolean gst_play_seek_to_time (GstPlay *play,
|
||||
gint64 time_nanos);
|
||||
gboolean gst_play_seek_to_time (GstPlay * play, gint64 time_nanos);
|
||||
|
||||
GstElement *gst_play_get_sink_element (GstPlay * play,
|
||||
GstElement *element,
|
||||
GstPlaySinkType sink_type);
|
||||
GstElement * element, GstPlaySinkType sink_type);
|
||||
|
||||
#endif /* __GST_PLAY_H__ */
|
||||
|
|
|
@ -27,7 +27,8 @@
|
|||
|
||||
#include "propertyprobe.h"
|
||||
|
||||
enum {
|
||||
enum
|
||||
{
|
||||
SIGNAL_PROBE_NEEDED,
|
||||
LAST_SIGNAL
|
||||
};
|
||||
|
@ -56,8 +57,7 @@ gst_property_probe_get_type (void)
|
|||
|
||||
gst_property_probe_type =
|
||||
g_type_register_static (G_TYPE_INTERFACE,
|
||||
"GstPropertyProbe",
|
||||
&gst_property_probe_info, 0);
|
||||
"GstPropertyProbe", &gst_property_probe_info, 0);
|
||||
}
|
||||
|
||||
return gst_property_probe_type;
|
||||
|
@ -70,9 +70,9 @@ gst_property_probe_iface_init (GstPropertyProbeInterface *iface)
|
|||
|
||||
if (!initialized) {
|
||||
gst_property_probe_signals[SIGNAL_PROBE_NEEDED] =
|
||||
g_signal_new ("probe-needed", G_TYPE_FROM_CLASS (iface), G_SIGNAL_RUN_LAST,
|
||||
G_STRUCT_OFFSET (GstPropertyProbeInterface, probe_needed),
|
||||
NULL, NULL, g_cclosure_marshal_VOID__POINTER,
|
||||
g_signal_new ("probe-needed", G_TYPE_FROM_CLASS (iface),
|
||||
G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (GstPropertyProbeInterface,
|
||||
probe_needed), NULL, NULL, g_cclosure_marshal_VOID__POINTER,
|
||||
G_TYPE_NONE, 1, G_TYPE_POINTER);
|
||||
initialized = TRUE;
|
||||
}
|
||||
|
@ -108,8 +108,7 @@ gst_property_probe_get_properties (GstPropertyProbe *probe)
|
|||
}
|
||||
|
||||
const GParamSpec *
|
||||
gst_property_probe_get_property (GstPropertyProbe *probe,
|
||||
const gchar *name)
|
||||
gst_property_probe_get_property (GstPropertyProbe * probe, const gchar * name)
|
||||
{
|
||||
const GList *pspecs = gst_property_probe_get_properties (probe);
|
||||
|
||||
|
|
|
@ -25,7 +25,6 @@
|
|||
#include <gst/gst.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define GST_TYPE_PROPERTY_PROBE \
|
||||
(gst_property_probe_get_type ())
|
||||
#define GST_PROPERTY_PROBE(obj) \
|
||||
|
@ -34,27 +33,23 @@ G_BEGIN_DECLS
|
|||
(G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_PROPERTY_PROBE))
|
||||
#define GST_PROPERTY_PROBE_GET_IFACE(obj) \
|
||||
(G_TYPE_INSTANCE_GET_INTERFACE ((obj), GST_TYPE_PROPERTY_PROBE, GstPropertyProbeInterface))
|
||||
|
||||
typedef struct _GstPropertyProbe GstPropertyProbe; /* dummy typedef */
|
||||
|
||||
typedef struct _GstPropertyProbeInterface {
|
||||
typedef struct _GstPropertyProbeInterface
|
||||
{
|
||||
GTypeInterface klass;
|
||||
|
||||
/* signals */
|
||||
void (*probe_needed) (GstPropertyProbe *probe,
|
||||
const GParamSpec *pspec);
|
||||
void (*probe_needed) (GstPropertyProbe * probe, const GParamSpec * pspec);
|
||||
|
||||
/* virtual functions */
|
||||
const GList *(*get_properties) (GstPropertyProbe * probe);
|
||||
gboolean (*needs_probe) (GstPropertyProbe * probe,
|
||||
guint prop_id,
|
||||
const GParamSpec *pspec);
|
||||
guint prop_id, const GParamSpec * pspec);
|
||||
void (*probe_property) (GstPropertyProbe * probe,
|
||||
guint prop_id,
|
||||
const GParamSpec *pspec);
|
||||
guint prop_id, const GParamSpec * pspec);
|
||||
GValueArray *(*get_values) (GstPropertyProbe * probe,
|
||||
guint prop_id,
|
||||
const GParamSpec *pspec);
|
||||
guint prop_id, const GParamSpec * pspec);
|
||||
|
||||
gpointer _gst_reserved[GST_PADDING];
|
||||
} GstPropertyProbeInterface;
|
||||
|
@ -89,9 +84,8 @@ GValueArray * gst_property_probe_get_values_name (GstPropertyProbe *prob
|
|||
/* sugar */
|
||||
GValueArray *gst_property_probe_probe_and_get_values (GstPropertyProbe * probe,
|
||||
const GParamSpec * pspec);
|
||||
GValueArray * gst_property_probe_probe_and_get_values_name (GstPropertyProbe *probe,
|
||||
const gchar *name);
|
||||
GValueArray *gst_property_probe_probe_and_get_values_name (GstPropertyProbe *
|
||||
probe, const gchar * name);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GST_PROPERTY_PROBE_H__ */
|
||||
|
|
|
@ -29,33 +29,40 @@
|
|||
/*#include <ml.h> */
|
||||
#include "private.h"
|
||||
|
||||
void conv_double_float_ref(double *dest, float *src, int n)
|
||||
void
|
||||
conv_double_float_ref (double *dest, float *src, int n)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < n; i++) {
|
||||
dest[i] = src[i];
|
||||
}
|
||||
}
|
||||
|
||||
void conv_float_double_ref(float *dest, double *src, int n)
|
||||
void
|
||||
conv_float_double_ref (float *dest, double *src, int n)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < n; i++) {
|
||||
dest[i] = src[i];
|
||||
}
|
||||
}
|
||||
|
||||
void conv_double_float_dstr(double *dest, float *src, int n, int dstr)
|
||||
void
|
||||
conv_double_float_dstr (double *dest, float *src, int n, int dstr)
|
||||
{
|
||||
int i;
|
||||
void *d = dest;
|
||||
|
||||
for (i = 0; i < n; i++) {
|
||||
(*(double *) d) = *src++;
|
||||
d += dstr;
|
||||
}
|
||||
}
|
||||
|
||||
void conv_float_double_sstr(float *dest, double *src, int n, int sstr)
|
||||
void
|
||||
conv_float_double_sstr (float *dest, double *src, int n, int sstr)
|
||||
{
|
||||
int i;
|
||||
void *s = src;
|
||||
|
@ -65,4 +72,3 @@ void conv_float_double_sstr(float *dest, double *src, int n, int sstr)
|
|||
s += sstr;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -39,11 +39,13 @@
|
|||
static float ints_high[256];
|
||||
static float ints_low[256];
|
||||
|
||||
void conv_double_short_table(double *dest, short *src, int n)
|
||||
void
|
||||
conv_double_short_table (double *dest, short *src, int n)
|
||||
{
|
||||
static int init = 0;
|
||||
int i;
|
||||
unsigned int idx;
|
||||
|
||||
if (!init) {
|
||||
for (i = 0; i < 256; i++) {
|
||||
ints_high[i] = 256.0 * ((i < 128) ? i : i - 256);
|
||||
|
@ -68,7 +70,8 @@ void conv_double_short_table(double *dest, short *src, int n)
|
|||
#endif
|
||||
|
||||
#ifdef short_to_double_unroll
|
||||
void conv_double_short_unroll(double *dest, short *src, int n)
|
||||
void
|
||||
conv_double_short_unroll (double *dest, short *src, int n)
|
||||
{
|
||||
if (n & 1) {
|
||||
*dest++ = *src++;
|
||||
|
@ -89,9 +92,11 @@ void conv_double_short_unroll(double *dest, short *src, int n)
|
|||
}
|
||||
#endif
|
||||
|
||||
void conv_double_short_ref(double *dest, short *src, int n)
|
||||
void
|
||||
conv_double_short_ref (double *dest, short *src, int n)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < n; i++) {
|
||||
dest[i] = src[i];
|
||||
}
|
||||
|
@ -99,9 +104,14 @@ void conv_double_short_ref(double *dest, short *src, int n)
|
|||
|
||||
#ifdef HAVE_CPU_PPC
|
||||
#if 0
|
||||
static union { int i[4]; float f[4]; } av_tmp __attribute__ ((__aligned__ (16)));
|
||||
static union
|
||||
{
|
||||
int i[4];
|
||||
float f[4];
|
||||
} av_tmp __attribute__ ((__aligned__ (16)));
|
||||
|
||||
void conv_double_short_altivec(double *dest, short *src, int n)
|
||||
void
|
||||
conv_double_short_altivec (double *dest, short *src, int n)
|
||||
{
|
||||
int i;
|
||||
|
||||
|
@ -111,11 +121,7 @@ void conv_double_short_altivec(double *dest, short *src, int n)
|
|||
av_tmp.i[2] = src[2];
|
||||
av_tmp.i[3] = src[3];
|
||||
|
||||
asm(
|
||||
" lvx 0,0,%0\n"
|
||||
" vcfsx 1,0,0\n"
|
||||
" stvx 1,0,%0\n"
|
||||
: : "r" (&av_tmp)
|
||||
asm (" lvx 0,0,%0\n" " vcfsx 1,0,0\n" " stvx 1,0,%0\n": :"r" (&av_tmp)
|
||||
);
|
||||
|
||||
dest[0] = av_tmp.f[0];
|
||||
|
@ -133,30 +139,33 @@ void conv_double_short_altivec(double *dest, short *src, int n)
|
|||
|
||||
/* double to short */
|
||||
|
||||
void conv_short_double_ref(short *dest, double *src, int n)
|
||||
void
|
||||
conv_short_double_ref (short *dest, double *src, int n)
|
||||
{
|
||||
int i;
|
||||
double x;
|
||||
|
||||
for (i = 0; i < n; i++) {
|
||||
x = *src++;
|
||||
if(x<-32768.0)x=-32768.0;
|
||||
if(x>32767.0)x=32767.0;
|
||||
if (x < -32768.0)
|
||||
x = -32768.0;
|
||||
if (x > 32767.0)
|
||||
x = 32767.0;
|
||||
*dest++ = rint (x);
|
||||
}
|
||||
}
|
||||
|
||||
/* #ifdef HAVE_CPU_PPC */
|
||||
#if 0
|
||||
void conv_short_double_ppcasm(short *dest, double *src, int n)
|
||||
void
|
||||
conv_short_double_ppcasm (short *dest, double *src, int n)
|
||||
{
|
||||
int tmp[2];
|
||||
double min = -32768.0;
|
||||
double max = 32767.0;
|
||||
double ftmp0, ftmp1;
|
||||
|
||||
asm __volatile__(
|
||||
"\taddic. %3,%3,-8\n"
|
||||
asm __volatile__ ("\taddic. %3,%3,-8\n"
|
||||
"\taddic. %6,%6,-2\n"
|
||||
"loop:\n"
|
||||
"\tlfdu %0,8(%3)\n"
|
||||
|
@ -168,9 +177,7 @@ void conv_short_double_ppcasm(short *dest, double *src, int n)
|
|||
"\taddic. 5,5,-1\n"
|
||||
"\tstfd %1,0(%2)\n"
|
||||
"\tlhz 9,6(%2)\n"
|
||||
"\tsthu 9,2(%6)\n"
|
||||
"\tbne loop\n"
|
||||
: "=&f" (ftmp0), "=&f" (ftmp1)
|
||||
"\tsthu 9,2(%6)\n" "\tbne loop\n":"=&f" (ftmp0), "=&f" (ftmp1)
|
||||
:"b" (tmp), "r" (src), "f" (min), "f" (max), "r" (dest)
|
||||
:"r9", "r5");
|
||||
|
||||
|
@ -178,17 +185,20 @@ void conv_short_double_ppcasm(short *dest, double *src, int n)
|
|||
#endif
|
||||
|
||||
|
||||
void conv_double_short_dstr(double *dest, short *src, int n, int dstr)
|
||||
void
|
||||
conv_double_short_dstr (double *dest, short *src, int n, int dstr)
|
||||
{
|
||||
int i;
|
||||
void *d = dest;
|
||||
|
||||
for (i = 0; i < n; i++) {
|
||||
(*(double *) d) = *src++;
|
||||
d += dstr;
|
||||
}
|
||||
}
|
||||
|
||||
void conv_short_double_sstr(short *dest, double *src, int n, int sstr)
|
||||
void
|
||||
conv_short_double_sstr (short *dest, double *src, int n, int sstr)
|
||||
{
|
||||
int i;
|
||||
double x;
|
||||
|
@ -196,10 +206,11 @@ void conv_short_double_sstr(short *dest, double *src, int n, int sstr)
|
|||
|
||||
for (i = 0; i < n; i++) {
|
||||
x = *(double *) s;
|
||||
if(x<-32768.0)x=-32768.0;
|
||||
if(x>32767.0)x=32767.0;
|
||||
if (x < -32768.0)
|
||||
x = -32768.0;
|
||||
if (x > 32767.0)
|
||||
x = 32767.0;
|
||||
*dest++ = rint (x);
|
||||
s += sstr;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -30,44 +30,56 @@
|
|||
|
||||
|
||||
|
||||
double functable_sinc(void *p,double x)
|
||||
double
|
||||
functable_sinc (void *p, double x)
|
||||
{
|
||||
if(x==0)return 1;
|
||||
if (x == 0)
|
||||
return 1;
|
||||
return sin (x) / x;
|
||||
}
|
||||
|
||||
double functable_dsinc(void *p,double x)
|
||||
double
|
||||
functable_dsinc (void *p, double x)
|
||||
{
|
||||
if(x==0)return 0;
|
||||
if (x == 0)
|
||||
return 0;
|
||||
return cos (x) / x - sin (x) / (x * x);
|
||||
}
|
||||
|
||||
double functable_window_boxcar(void *p,double x)
|
||||
double
|
||||
functable_window_boxcar (void *p, double x)
|
||||
{
|
||||
if(x<-1 || x>1)return 0;
|
||||
if (x < -1 || x > 1)
|
||||
return 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
double functable_window_dboxcar(void *p,double x)
|
||||
double
|
||||
functable_window_dboxcar (void *p, double x)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
double functable_window_std(void *p,double x)
|
||||
double
|
||||
functable_window_std (void *p, double x)
|
||||
{
|
||||
if(x<-1 || x>1)return 0;
|
||||
if (x < -1 || x > 1)
|
||||
return 0;
|
||||
return (1 - x * x) * (1 - x * x);
|
||||
}
|
||||
|
||||
double functable_window_dstd(void *p,double x)
|
||||
double
|
||||
functable_window_dstd (void *p, double x)
|
||||
{
|
||||
if(x<-1 || x>1)return 0;
|
||||
if (x < -1 || x > 1)
|
||||
return 0;
|
||||
return -4 * x * (1 - x * x);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void functable_init(functable_t *t)
|
||||
void
|
||||
functable_init (functable_t * t)
|
||||
{
|
||||
int i;
|
||||
double x;
|
||||
|
@ -104,7 +116,8 @@ void functable_init(functable_t *t)
|
|||
}
|
||||
}
|
||||
|
||||
double functable_eval(functable_t *t,double x)
|
||||
double
|
||||
functable_eval (functable_t * t, double x)
|
||||
{
|
||||
int i;
|
||||
double f0, f1, w0, w1;
|
||||
|
@ -129,8 +142,7 @@ double functable_eval(functable_t *t,double x)
|
|||
|
||||
/*printf("i=%d x=%g f0=%g f1=%g w0=%g w1=%g\n",i,x,f0,f1,w0,w1); */
|
||||
|
||||
w = t->fx[i] * f0 + t->fx[i + 1] * f1 +
|
||||
t->fdx[i] * w0 + t->fdx[i + 1] * w1;
|
||||
w = t->fx[i] * f0 + t->fx[i + 1] * f1 + t->fdx[i] * w0 + t->fdx[i + 1] * w1;
|
||||
|
||||
/*w = t->fx[i] * (1-x) + t->fx[i+1] * x; */
|
||||
|
||||
|
@ -138,7 +150,8 @@ double functable_eval(functable_t *t,double x)
|
|||
}
|
||||
|
||||
|
||||
double functable_fir(functable_t *t, double x, int n, double *data, int len)
|
||||
double
|
||||
functable_fir (functable_t * t, double x, int n, double *data, int len)
|
||||
{
|
||||
int i, j;
|
||||
double f0, f1, w0, w1;
|
||||
|
@ -161,8 +174,7 @@ double functable_fir(functable_t *t, double x, int n, double *data, int len)
|
|||
|
||||
sum = 0;
|
||||
for (j = 0; j < len; j++) {
|
||||
w = t->fx[i] * f0 + t->fx[i + 1] * f1 +
|
||||
t->fdx[i] * w0 + t->fdx[i + 1] * w1;
|
||||
w = t->fx[i] * f0 + t->fx[i + 1] * f1 + t->fdx[i] * w0 + t->fdx[i + 1] * w1;
|
||||
sum += data[j * 2] * w;
|
||||
i += n;
|
||||
}
|
||||
|
@ -170,7 +182,8 @@ double functable_fir(functable_t *t, double x, int n, double *data, int len)
|
|||
return sum;
|
||||
}
|
||||
|
||||
void functable_fir2(functable_t *t, double *r0, double *r1, double x,
|
||||
void
|
||||
functable_fir2 (functable_t * t, double *r0, double *r1, double x,
|
||||
int n, double *data, int len)
|
||||
{
|
||||
int i, j;
|
||||
|
@ -197,8 +210,7 @@ void functable_fir2(functable_t *t, double *r0, double *r1, double x,
|
|||
sum0 = 0;
|
||||
sum1 = 0;
|
||||
for (j = 0; j < len; j++) {
|
||||
w = t->fx[i] * f0 + t->fx[i + 1] * f1 +
|
||||
t->fdx[i] * w0 + t->fdx[i + 1] * w1;
|
||||
w = t->fx[i] * f0 + t->fx[i + 1] * f1 + t->fdx[i] * w0 + t->fdx[i + 1] * w1;
|
||||
sum0 += data[j * 2] * w;
|
||||
sum1 += data[j * 2 + 1] * w;
|
||||
i += n;
|
||||
|
@ -209,8 +221,7 @@ void functable_fir2(functable_t *t, double *r0, double *r1, double x,
|
|||
#ifdef unroll2
|
||||
j++;
|
||||
|
||||
w = t->fx[i] * f0 + t->fx[i + 1] * f1 +
|
||||
t->fdx[i] * w0 + t->fdx[i + 1] * w1;
|
||||
w = t->fx[i] * f0 + t->fx[i + 1] * f1 + t->fdx[i] * w0 + t->fdx[i + 1] * w1;
|
||||
sum0 += data[j * 2] * w;
|
||||
sum1 += data[j * 2 + 1] * w;
|
||||
i += n;
|
||||
|
@ -218,8 +229,7 @@ void functable_fir2(functable_t *t, double *r0, double *r1, double x,
|
|||
#ifdef unroll3
|
||||
j++;
|
||||
|
||||
w = t->fx[i] * f0 + t->fx[i + 1] * f1 +
|
||||
t->fdx[i] * w0 + t->fdx[i + 1] * w1;
|
||||
w = t->fx[i] * f0 + t->fx[i + 1] * f1 + t->fdx[i] * w0 + t->fdx[i + 1] * w1;
|
||||
sum0 += data[j * 2] * w;
|
||||
sum1 += data[j * 2 + 1] * w;
|
||||
i += n;
|
||||
|
@ -227,8 +237,7 @@ void functable_fir2(functable_t *t, double *r0, double *r1, double x,
|
|||
#ifdef unroll4
|
||||
j++;
|
||||
|
||||
w = t->fx[i] * f0 + t->fx[i + 1] * f1 +
|
||||
t->fdx[i] * w0 + t->fdx[i + 1] * w1;
|
||||
w = t->fx[i] * f0 + t->fx[i + 1] * f1 + t->fdx[i] * w0 + t->fdx[i + 1] * w1;
|
||||
sum0 += data[j * 2] * w;
|
||||
sum1 += data[j * 2 + 1] * w;
|
||||
i += n;
|
||||
|
@ -242,7 +251,8 @@ void functable_fir2(functable_t *t, double *r0, double *r1, double x,
|
|||
|
||||
|
||||
#ifdef unused
|
||||
void functable_fir2_altivec(functable_t *t, float *r0, float *r1,
|
||||
void
|
||||
functable_fir2_altivec (functable_t * t, float *r0, float *r1,
|
||||
double x, int n, float *data, int len)
|
||||
{
|
||||
int i, j;
|
||||
|
@ -291,8 +301,7 @@ void functable_fir2_altivec(functable_t *t, float *r0, float *r1,
|
|||
/* v12 += v6 * v10 */
|
||||
/* v12 += v7 * v11 */
|
||||
|
||||
w = t->fx[i] * f0 + t->fx[i + 1] * f1 +
|
||||
t->fdx[i] * w0 + t->fdx[i + 1] * w1;
|
||||
w = t->fx[i] * f0 + t->fx[i + 1] * f1 + t->fdx[i] * w0 + t->fdx[i + 1] * w1;
|
||||
|
||||
/* v13 = data[j*2] */
|
||||
/* v14 = data[j*2+4] */
|
||||
|
@ -311,4 +320,3 @@ void functable_fir2_altivec(functable_t *t, float *r0, float *r1,
|
|||
*r1 = sum1;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
@ -37,7 +37,8 @@ void gst_resample_sinc_ft_float(gst_resample_t * r);
|
|||
|
||||
|
||||
typedef struct functable_s functable_t;
|
||||
struct functable_s {
|
||||
struct functable_s
|
||||
{
|
||||
double start;
|
||||
double offset;
|
||||
int len;
|
||||
|
@ -78,11 +79,13 @@ double functable_window_dboxcar(void *p, double x);
|
|||
void conv_double_short_table (double *dest, short *src, int n);
|
||||
void conv_double_short_unroll (double *dest, short *src, int n);
|
||||
void conv_double_short_ref (double *dest, short *src, int n);
|
||||
|
||||
#ifdef HAVE_CPU_PPC
|
||||
void conv_double_short_altivec (double *dest, short *src, int n);
|
||||
#endif
|
||||
|
||||
void conv_short_double_ref (short *dest, double *src, int n);
|
||||
|
||||
#ifdef HAVE_CPU_PPC
|
||||
void conv_short_double_ppcasm (short *dest, double *src, int n);
|
||||
#endif
|
||||
|
|
|
@ -30,19 +30,23 @@
|
|||
#include <gst/gstplugin.h>
|
||||
#include <gst/gstversion.h>
|
||||
|
||||
inline double sinc(double x)
|
||||
inline double
|
||||
sinc (double x)
|
||||
{
|
||||
if(x==0)return 1;
|
||||
if (x == 0)
|
||||
return 1;
|
||||
return sin (x) / x;
|
||||
}
|
||||
|
||||
inline double window_func(double x)
|
||||
inline double
|
||||
window_func (double x)
|
||||
{
|
||||
x = 1 - x * x;
|
||||
return x * x;
|
||||
}
|
||||
|
||||
signed short double_to_s16(double x)
|
||||
signed short
|
||||
double_to_s16 (double x)
|
||||
{
|
||||
if (x < -32768) {
|
||||
printf ("clipped\n");
|
||||
|
@ -55,7 +59,8 @@ signed short double_to_s16(double x)
|
|||
return rint (x);
|
||||
}
|
||||
|
||||
signed short double_to_s16_ppcasm(double x)
|
||||
signed short
|
||||
double_to_s16_ppcasm (double x)
|
||||
{
|
||||
if (x < -32768) {
|
||||
return -32768;
|
||||
|
@ -66,7 +71,8 @@ signed short double_to_s16_ppcasm(double x)
|
|||
return rint (x);
|
||||
}
|
||||
|
||||
void gst_resample_init(gst_resample_t * r)
|
||||
void
|
||||
gst_resample_init (gst_resample_t * r)
|
||||
{
|
||||
r->i_start = 0;
|
||||
if (r->filter_length & 1) {
|
||||
|
@ -80,7 +86,8 @@ void gst_resample_init(gst_resample_t * r)
|
|||
gst_resample_reinit (r);
|
||||
}
|
||||
|
||||
void gst_resample_reinit(gst_resample_t * r)
|
||||
void
|
||||
gst_resample_reinit (gst_resample_t * r)
|
||||
{
|
||||
/* i_inc is the number of samples that the output increments for
|
||||
* each input sample. o_inc is the opposite. */
|
||||
|
@ -140,7 +147,8 @@ void gst_resample_reinit(gst_resample_t * r)
|
|||
* i_start_buf is the time of the first sample in the temporary
|
||||
* buffer.
|
||||
*/
|
||||
void gst_resample_scale(gst_resample_t * r, void *i_buf, unsigned int i_size)
|
||||
void
|
||||
gst_resample_scale (gst_resample_t * r, void *i_buf, unsigned int i_size)
|
||||
{
|
||||
int o_size;
|
||||
|
||||
|
@ -160,8 +168,7 @@ void gst_resample_scale(gst_resample_t * r, void *i_buf, unsigned int i_size)
|
|||
r->o_buf = r->get_buffer (r->priv, o_size);
|
||||
|
||||
if (r->verbose) {
|
||||
printf("gst_resample_scale: i_buf=%p i_size=%d\n",
|
||||
i_buf,i_size);
|
||||
printf ("gst_resample_scale: i_buf=%p i_size=%d\n", i_buf, i_size);
|
||||
printf ("gst_resample_scale: i_samples=%d o_samples=%d i_inc=%g o_buf=%p\n",
|
||||
r->i_samples, r->o_samples, r->i_inc, r->o_buf);
|
||||
printf ("gst_resample_scale: i_start=%g i_end=%g o_start=%g\n",
|
||||
|
@ -174,7 +181,8 @@ void gst_resample_scale(gst_resample_t * r, void *i_buf, unsigned int i_size)
|
|||
if (r->verbose) {
|
||||
printf ("gst_resample temp buffer size=%d\n", size);
|
||||
}
|
||||
if(r->buffer)free(r->buffer);
|
||||
if (r->buffer)
|
||||
free (r->buffer);
|
||||
r->buffer_len = size;
|
||||
r->buffer = malloc (size);
|
||||
memset (r->buffer, 0, size);
|
||||
|
@ -182,23 +190,21 @@ void gst_resample_scale(gst_resample_t * r, void *i_buf, unsigned int i_size)
|
|||
|
||||
if (r->format == GST_RESAMPLE_S16) {
|
||||
if (r->channels == 2) {
|
||||
conv_double_short(
|
||||
r->buffer + r->filter_length * sizeof(double) * 2,
|
||||
conv_double_short (r->buffer + r->filter_length * sizeof (double) * 2,
|
||||
r->i_buf, r->i_samples * 2);
|
||||
} else {
|
||||
conv_double_short_dstr(
|
||||
r->buffer + r->filter_length * sizeof(double) * 2,
|
||||
r->i_buf, r->i_samples, sizeof(double) * 2);
|
||||
conv_double_short_dstr (r->buffer +
|
||||
r->filter_length * sizeof (double) * 2, r->i_buf, r->i_samples,
|
||||
sizeof (double) * 2);
|
||||
}
|
||||
} else if (r->format == GST_RESAMPLE_FLOAT) {
|
||||
if (r->channels == 2) {
|
||||
conv_double_float(
|
||||
r->buffer + r->filter_length * sizeof(double) * 2,
|
||||
conv_double_float (r->buffer + r->filter_length * sizeof (double) * 2,
|
||||
r->i_buf, r->i_samples * 2);
|
||||
} else {
|
||||
conv_double_float_dstr(
|
||||
r->buffer + r->filter_length * sizeof(double) * 2,
|
||||
r->i_buf, r->i_samples, sizeof(double) * 2);
|
||||
conv_double_float_dstr (r->buffer +
|
||||
r->filter_length * sizeof (double) * 2, r->i_buf, r->i_samples,
|
||||
sizeof (double) * 2);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -216,7 +222,8 @@ void gst_resample_scale(gst_resample_t * r, void *i_buf, unsigned int i_size)
|
|||
r->i_start -= r->o_samples;
|
||||
}
|
||||
|
||||
void gst_resample_nearest_s16(gst_resample_t * r)
|
||||
void
|
||||
gst_resample_nearest_s16 (gst_resample_t * r)
|
||||
{
|
||||
signed short *i_ptr, *o_ptr;
|
||||
int i_count = 0;
|
||||
|
@ -245,24 +252,22 @@ void gst_resample_nearest_s16(gst_resample_t * r)
|
|||
SCALE_LOOP (o_ptr[0] = i_ptr[0], 1);
|
||||
break;
|
||||
case 2:
|
||||
SCALE_LOOP(o_ptr[0] = i_ptr[0];
|
||||
o_ptr[1] = i_ptr[1], 2);
|
||||
SCALE_LOOP (o_ptr[0] = i_ptr[0]; o_ptr[1] = i_ptr[1], 2);
|
||||
break;
|
||||
default:
|
||||
{
|
||||
int n, n_chan = r->channels;
|
||||
|
||||
SCALE_LOOP(for (n = 0; n < n_chan; n++) o_ptr[n] =
|
||||
i_ptr[n], n_chan);
|
||||
SCALE_LOOP (for (n = 0; n < n_chan; n++) o_ptr[n] = i_ptr[n], n_chan);
|
||||
}
|
||||
}
|
||||
if (i_count != r->i_samples) {
|
||||
printf("handled %d in samples (expected %d)\n", i_count,
|
||||
r->i_samples);
|
||||
printf ("handled %d in samples (expected %d)\n", i_count, r->i_samples);
|
||||
}
|
||||
}
|
||||
|
||||
void gst_resample_bilinear_s16(gst_resample_t * r)
|
||||
void
|
||||
gst_resample_bilinear_s16 (gst_resample_t * r)
|
||||
{
|
||||
signed short *i_ptr, *o_ptr;
|
||||
int o_count = 0;
|
||||
|
@ -306,12 +311,12 @@ void gst_resample_bilinear_s16(gst_resample_t * r)
|
|||
r->acc[1] = acc1;
|
||||
|
||||
if (o_count != r->o_samples) {
|
||||
printf("handled %d out samples (expected %d)\n", o_count,
|
||||
r->o_samples);
|
||||
printf ("handled %d out samples (expected %d)\n", o_count, r->o_samples);
|
||||
}
|
||||
}
|
||||
|
||||
void gst_resample_sinc_slow_s16(gst_resample_t * r)
|
||||
void
|
||||
gst_resample_sinc_slow_s16 (gst_resample_t * r)
|
||||
{
|
||||
signed short *i_ptr, *o_ptr;
|
||||
int i, j;
|
||||
|
@ -377,7 +382,8 @@ void gst_resample_sinc_slow_s16(gst_resample_t * r)
|
|||
}
|
||||
|
||||
/* only works for channels == 2 ???? */
|
||||
void gst_resample_sinc_s16(gst_resample_t * r)
|
||||
void
|
||||
gst_resample_sinc_s16 (gst_resample_t * r)
|
||||
{
|
||||
double *ptr;
|
||||
signed short *o_ptr;
|
||||
|
@ -468,17 +474,21 @@ static functable_t *ft;
|
|||
|
||||
double out_tmp[10000];
|
||||
|
||||
void gst_resample_sinc_ft_s16(gst_resample_t * r)
|
||||
void
|
||||
gst_resample_sinc_ft_s16 (gst_resample_t * r)
|
||||
{
|
||||
double *ptr;
|
||||
signed short *o_ptr;
|
||||
int i;
|
||||
|
||||
/*int j; */
|
||||
double c0, c1;
|
||||
|
||||
/*double a; */
|
||||
double start_f, start_x;
|
||||
int start;
|
||||
double center;
|
||||
|
||||
/*double weight; */
|
||||
double x, d;
|
||||
double scale;
|
||||
|
@ -536,10 +546,7 @@ void gst_resample_sinc_ft_s16(gst_resample_t * r)
|
|||
}
|
||||
#else
|
||||
functable_fir2 (ft,
|
||||
&c0,&c1,
|
||||
x, n,
|
||||
ptr+(start + r->filter_length)*2,
|
||||
r->filter_length);
|
||||
&c0, &c1, x, n, ptr + (start + r->filter_length) * 2, r->filter_length);
|
||||
c0 *= scale;
|
||||
c1 *= scale;
|
||||
#endif
|
||||
|
@ -558,7 +565,8 @@ void gst_resample_sinc_ft_s16(gst_resample_t * r)
|
|||
if (r->channels == 2) {
|
||||
conv_short_double (r->o_buf, out_tmp, 2 * r->o_samples);
|
||||
} else {
|
||||
conv_short_double_sstr(r->o_buf,out_tmp,r->o_samples,2 * sizeof(double));
|
||||
conv_short_double_sstr (r->o_buf, out_tmp, r->o_samples,
|
||||
2 * sizeof (double));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -567,7 +575,8 @@ void gst_resample_sinc_ft_s16(gst_resample_t * r)
|
|||
********/
|
||||
|
||||
|
||||
void gst_resample_nearest_float(gst_resample_t * r)
|
||||
void
|
||||
gst_resample_nearest_float (gst_resample_t * r)
|
||||
{
|
||||
float *i_ptr, *o_ptr;
|
||||
int i_count = 0;
|
||||
|
@ -596,24 +605,22 @@ void gst_resample_nearest_float(gst_resample_t * r)
|
|||
SCALE_LOOP (o_ptr[0] = i_ptr[0], 1);
|
||||
break;
|
||||
case 2:
|
||||
SCALE_LOOP(o_ptr[0] = i_ptr[0];
|
||||
o_ptr[1] = i_ptr[1], 2);
|
||||
SCALE_LOOP (o_ptr[0] = i_ptr[0]; o_ptr[1] = i_ptr[1], 2);
|
||||
break;
|
||||
default:
|
||||
{
|
||||
int n, n_chan = r->channels;
|
||||
|
||||
SCALE_LOOP(for (n = 0; n < n_chan; n++) o_ptr[n] =
|
||||
i_ptr[n], n_chan);
|
||||
SCALE_LOOP (for (n = 0; n < n_chan; n++) o_ptr[n] = i_ptr[n], n_chan);
|
||||
}
|
||||
}
|
||||
if (i_count != r->i_samples) {
|
||||
printf("handled %d in samples (expected %d)\n", i_count,
|
||||
r->i_samples);
|
||||
printf ("handled %d in samples (expected %d)\n", i_count, r->i_samples);
|
||||
}
|
||||
}
|
||||
|
||||
void gst_resample_bilinear_float(gst_resample_t * r)
|
||||
void
|
||||
gst_resample_bilinear_float (gst_resample_t * r)
|
||||
{
|
||||
float *i_ptr, *o_ptr;
|
||||
int o_count = 0;
|
||||
|
@ -657,12 +664,12 @@ void gst_resample_bilinear_float(gst_resample_t * r)
|
|||
r->acc[1] = acc1;
|
||||
|
||||
if (o_count != r->o_samples) {
|
||||
printf("handled %d out samples (expected %d)\n", o_count,
|
||||
r->o_samples);
|
||||
printf ("handled %d out samples (expected %d)\n", o_count, r->o_samples);
|
||||
}
|
||||
}
|
||||
|
||||
void gst_resample_sinc_slow_float(gst_resample_t * r)
|
||||
void
|
||||
gst_resample_sinc_slow_float (gst_resample_t * r)
|
||||
{
|
||||
float *i_ptr, *o_ptr;
|
||||
int i, j;
|
||||
|
@ -728,7 +735,8 @@ void gst_resample_sinc_slow_float(gst_resample_t * r)
|
|||
}
|
||||
|
||||
/* only works for channels == 2 ???? */
|
||||
void gst_resample_sinc_float(gst_resample_t * r)
|
||||
void
|
||||
gst_resample_sinc_float (gst_resample_t * r)
|
||||
{
|
||||
double *ptr;
|
||||
float *o_ptr;
|
||||
|
@ -778,17 +786,21 @@ void gst_resample_sinc_float(gst_resample_t * r)
|
|||
}
|
||||
}
|
||||
|
||||
void gst_resample_sinc_ft_float(gst_resample_t * r)
|
||||
void
|
||||
gst_resample_sinc_ft_float (gst_resample_t * r)
|
||||
{
|
||||
double *ptr;
|
||||
float *o_ptr;
|
||||
int i;
|
||||
|
||||
/*int j; */
|
||||
double c0, c1;
|
||||
|
||||
/*double a; */
|
||||
double start_f, start_x;
|
||||
int start;
|
||||
double center;
|
||||
|
||||
/*double weight; */
|
||||
double x, d;
|
||||
double scale;
|
||||
|
@ -846,10 +858,7 @@ void gst_resample_sinc_ft_float(gst_resample_t * r)
|
|||
}
|
||||
#else
|
||||
functable_fir2 (ft,
|
||||
&c0,&c1,
|
||||
x, n,
|
||||
ptr+(start + r->filter_length)*2,
|
||||
r->filter_length);
|
||||
&c0, &c1, x, n, ptr + (start + r->filter_length) * 2, r->filter_length);
|
||||
c0 *= scale;
|
||||
c1 *= scale;
|
||||
#endif
|
||||
|
@ -868,7 +877,8 @@ void gst_resample_sinc_ft_float(gst_resample_t * r)
|
|||
if (r->channels == 2) {
|
||||
conv_float_double (r->o_buf, out_tmp, 2 * r->o_samples);
|
||||
} else {
|
||||
conv_float_double_sstr(r->o_buf,out_tmp,r->o_samples,2 * sizeof(double));
|
||||
conv_float_double_sstr (r->o_buf, out_tmp, r->o_samples,
|
||||
2 * sizeof (double));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -878,15 +888,8 @@ plugin_init (GstPlugin *plugin)
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
GST_PLUGIN_DEFINE (
|
||||
GST_VERSION_MAJOR,
|
||||
GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
|
||||
GST_VERSION_MINOR,
|
||||
"gstresample",
|
||||
"Resampling routines for use in audio plugins",
|
||||
plugin_init,
|
||||
VERSION,
|
||||
GST_LICENSE,
|
||||
GST_PACKAGE,
|
||||
GST_ORIGIN
|
||||
);
|
||||
|
||||
plugin_init, VERSION, GST_LICENSE, GST_PACKAGE, GST_ORIGIN);
|
||||
|
|
|
@ -21,21 +21,24 @@
|
|||
#ifndef __GST_RESAMPLE_H__
|
||||
#define __GST_RESAMPLE_H__
|
||||
|
||||
typedef enum {
|
||||
typedef enum
|
||||
{
|
||||
GST_RESAMPLE_NEAREST = 0,
|
||||
GST_RESAMPLE_BILINEAR,
|
||||
GST_RESAMPLE_SINC_SLOW,
|
||||
GST_RESAMPLE_SINC,
|
||||
} gst_resample_method;
|
||||
|
||||
typedef enum {
|
||||
typedef enum
|
||||
{
|
||||
GST_RESAMPLE_S16 = 0,
|
||||
GST_RESAMPLE_FLOAT
|
||||
} gst_resample_format;
|
||||
|
||||
typedef struct gst_resample_s gst_resample_t;
|
||||
|
||||
struct gst_resample_s {
|
||||
struct gst_resample_s
|
||||
{
|
||||
/* parameters */
|
||||
|
||||
gst_resample_method method;
|
||||
|
@ -93,4 +96,3 @@ void gst_resample_reinit(gst_resample_t *r);
|
|||
void gst_resample_scale (gst_resample_t * r, void *i_buf, unsigned int size);
|
||||
|
||||
#endif /* __GST_RESAMPLE_H__ */
|
||||
|
||||
|
|
|
@ -32,7 +32,8 @@ void test_res5(void);
|
|||
void test_res6 (void);
|
||||
void test_res7 (void);
|
||||
|
||||
int main(int argc,char *argv[])
|
||||
int
|
||||
main (int argc, char *argv[])
|
||||
{
|
||||
out = fopen ("out", "w");
|
||||
|
||||
|
@ -41,22 +42,26 @@ int main(int argc,char *argv[])
|
|||
return 0;
|
||||
}
|
||||
|
||||
void *get_buffer(void *priv, unsigned int size)
|
||||
void *
|
||||
get_buffer (void *priv, unsigned int size)
|
||||
{
|
||||
void *ret;
|
||||
|
||||
ret = ((void *) o_buf) + o_offset;
|
||||
o_offset += size;
|
||||
return ret;
|
||||
}
|
||||
|
||||
struct timeval start_time;
|
||||
void start_timer(void)
|
||||
void
|
||||
start_timer (void)
|
||||
{
|
||||
gettimeofday (&start_time, NULL);
|
||||
/*printf("start %ld.%06ld\n",start_time.tv_sec,start_time.tv_usec); */
|
||||
}
|
||||
|
||||
void end_timer(void)
|
||||
void
|
||||
end_timer (void)
|
||||
{
|
||||
struct timeval end_time;
|
||||
double diff;
|
||||
|
@ -70,7 +75,8 @@ void end_timer(void)
|
|||
|
||||
}
|
||||
|
||||
void test_res1(void)
|
||||
void
|
||||
test_res1 (void)
|
||||
{
|
||||
resample_t *r;
|
||||
int i;
|
||||
|
@ -117,8 +123,7 @@ void test_res1(void)
|
|||
f = AMP * test_func ((double) i / O_RATE);
|
||||
/*f = rint(AMP*test_func((double)i/O_RATE)); */
|
||||
fprintf (out, "%d %d %d %g %g\n", i,
|
||||
o_buf[2*i+0],o_buf[2*i+1],
|
||||
f,o_buf[2*i+0]-f);
|
||||
o_buf[2 * i + 0], o_buf[2 * i + 1], f, o_buf[2 * i + 0] - f);
|
||||
}
|
||||
|
||||
sum10k = 0;
|
||||
|
@ -139,12 +144,12 @@ void test_res1(void)
|
|||
}
|
||||
}
|
||||
printf ("average error 10k=%g 22k=%g\n",
|
||||
sqrt(sum10k/n10k),
|
||||
sqrt(sum22k/n22k));
|
||||
sqrt (sum10k / n10k), sqrt (sum22k / n22k));
|
||||
}
|
||||
|
||||
|
||||
void test_res2(void)
|
||||
void
|
||||
test_res2 (void)
|
||||
{
|
||||
functable_t *t;
|
||||
int i;
|
||||
|
@ -171,7 +176,8 @@ void test_res2(void)
|
|||
}
|
||||
}
|
||||
|
||||
void test_res3(void)
|
||||
void
|
||||
test_res3 (void)
|
||||
{
|
||||
functable_t *t;
|
||||
int i;
|
||||
|
@ -206,7 +212,8 @@ void test_res3(void)
|
|||
}
|
||||
}
|
||||
|
||||
double sinc_poly(double x)
|
||||
double
|
||||
sinc_poly (double x)
|
||||
{
|
||||
#define INV3FAC 1.66666666666666666e-1
|
||||
#define INV5FAC 8.33333333333333333e-3
|
||||
|
@ -215,15 +222,13 @@ double sinc_poly(double x)
|
|||
#define INV11FAC 2.505210839e-8
|
||||
double x2 = x * x;
|
||||
|
||||
return 1
|
||||
- x2 * INV3FAC
|
||||
+ x2 * x2 * INV5FAC
|
||||
- x2 * x2 * x2 * INV7FAC;
|
||||
return 1 - x2 * INV3FAC + x2 * x2 * INV5FAC - x2 * x2 * x2 * INV7FAC;
|
||||
/*+ x2 * x2 * x2 * x2 * INV9FAC */
|
||||
/*- x2 * x2 * x2 * x2 * x2 * INV11FAC; */
|
||||
}
|
||||
|
||||
void test_res4(void)
|
||||
void
|
||||
test_res4 (void)
|
||||
{
|
||||
int i;
|
||||
double x, f1, f2;
|
||||
|
@ -238,7 +243,8 @@ void test_res4(void)
|
|||
}
|
||||
|
||||
|
||||
void test_res5(void)
|
||||
void
|
||||
test_res5 (void)
|
||||
{
|
||||
int i;
|
||||
double sum;
|
||||
|
@ -253,14 +259,34 @@ void test_res5(void)
|
|||
}
|
||||
|
||||
|
||||
void short_to_double(double *d,short *x) { *d = *x; }
|
||||
void short_to_float(float *f,short *x) { *f = *x; }
|
||||
void float_to_double(double *f,float *x) { *f = *x; }
|
||||
void double_to_short(short *f,double *x) { *f = *x; }
|
||||
void
|
||||
short_to_double (double *d, short *x)
|
||||
{
|
||||
*d = *x;
|
||||
}
|
||||
|
||||
void
|
||||
short_to_float (float *f, short *x)
|
||||
{
|
||||
*f = *x;
|
||||
}
|
||||
|
||||
void
|
||||
float_to_double (double *f, float *x)
|
||||
{
|
||||
*f = *x;
|
||||
}
|
||||
|
||||
void
|
||||
double_to_short (short *f, double *x)
|
||||
{
|
||||
*f = *x;
|
||||
}
|
||||
|
||||
double res6_tmp[1000];
|
||||
|
||||
void test_res6(void)
|
||||
void
|
||||
test_res6 (void)
|
||||
{
|
||||
int i;
|
||||
|
||||
|
@ -279,7 +305,8 @@ void test_res6(void)
|
|||
}
|
||||
}
|
||||
|
||||
void test_res7(void)
|
||||
void
|
||||
test_res7 (void)
|
||||
{
|
||||
resample_t *r;
|
||||
int i;
|
||||
|
@ -323,9 +350,7 @@ void test_res7(void)
|
|||
for (i = 0; i < O_RATE; i++) {
|
||||
f = AMP * test_func ((double) i / O_RATE);
|
||||
/*f = rint(AMP*test_func((double)i/O_RATE)); */
|
||||
fprintf(out,"%d %d %d %g %g\n",i,
|
||||
o_buf[i],0,
|
||||
f,o_buf[i]-f);
|
||||
fprintf (out, "%d %d %d %g %g\n", i, o_buf[i], 0, f, o_buf[i] - f);
|
||||
}
|
||||
|
||||
sum10k = 0;
|
||||
|
@ -346,7 +371,5 @@ void test_res7(void)
|
|||
}
|
||||
}
|
||||
printf ("average error 10k=%g 22k=%g\n",
|
||||
sqrt(sum10k/n10k),
|
||||
sqrt(sum22k/n22k));
|
||||
sqrt (sum10k / n10k), sqrt (sum22k / n22k));
|
||||
}
|
||||
|
||||
|
|
|
@ -216,7 +216,8 @@
|
|||
#define GST_RIFF_rec GST_MAKE_FOURCC ('r', 'e', 'c', ' ')
|
||||
|
||||
/* common data structures */
|
||||
typedef struct _gst_riff_strh {
|
||||
typedef struct _gst_riff_strh
|
||||
{
|
||||
guint32 type; /* stream type */
|
||||
guint32 fcc_handler; /* fcc_handler */
|
||||
guint32 flags;
|
||||
|
@ -235,7 +236,8 @@ typedef struct _gst_riff_strh {
|
|||
/* XXX 16 bytes ? */
|
||||
} gst_riff_strh;
|
||||
|
||||
typedef struct _gst_riff_strf_vids { /* == BitMapInfoHeader */
|
||||
typedef struct _gst_riff_strf_vids
|
||||
{ /* == BitMapInfoHeader */
|
||||
guint32 size;
|
||||
guint32 width;
|
||||
guint32 height;
|
||||
|
@ -251,7 +253,8 @@ typedef struct _gst_riff_strf_vids { /* == BitMapInfoHeader */
|
|||
} gst_riff_strf_vids;
|
||||
|
||||
|
||||
typedef struct _gst_riff_strf_auds { /* == WaveHeader (?) */
|
||||
typedef struct _gst_riff_strf_auds
|
||||
{ /* == WaveHeader (?) */
|
||||
guint16 format;
|
||||
/**** from public Microsoft RIFF docs ******/
|
||||
#define GST_RIFF_WAVE_FORMAT_UNKNOWN (0x0000)
|
||||
|
@ -290,7 +293,8 @@ typedef struct _gst_riff_strf_auds { /* == WaveHeader (?) */
|
|||
guint16 size;
|
||||
} gst_riff_strf_auds;
|
||||
|
||||
typedef struct _gst_riff_strf_iavs {
|
||||
typedef struct _gst_riff_strf_iavs
|
||||
{
|
||||
guint32 DVAAuxSrc;
|
||||
guint32 DVAAuxCtl;
|
||||
guint32 DVAAuxSrc1;
|
||||
|
@ -301,7 +305,8 @@ typedef struct _gst_riff_strf_iavs {
|
|||
guint32 DVReserved2;
|
||||
} gst_riff_strf_iavs;
|
||||
|
||||
typedef struct _gst_riff_index_entry {
|
||||
typedef struct _gst_riff_index_entry
|
||||
{
|
||||
guint32 id;
|
||||
guint32 flags;
|
||||
#define GST_RIFF_IF_LIST (0x00000001L)
|
||||
|
@ -312,7 +317,8 @@ typedef struct _gst_riff_index_entry {
|
|||
guint32 size;
|
||||
} gst_riff_index_entry;
|
||||
|
||||
typedef struct _gst_riff_dmlh {
|
||||
typedef struct _gst_riff_dmlh
|
||||
{
|
||||
guint32 totalframes;
|
||||
} gst_riff_dmlh;
|
||||
|
||||
|
|
|
@ -28,24 +28,20 @@
|
|||
|
||||
GstCaps *
|
||||
gst_riff_create_video_caps (guint32 codec_fcc,
|
||||
gst_riff_strh *strh,
|
||||
gst_riff_strf_vids *strf,
|
||||
char **codec_name)
|
||||
gst_riff_strh * strh, gst_riff_strf_vids * strf, char **codec_name)
|
||||
{
|
||||
GstCaps *caps = NULL;
|
||||
|
||||
switch (codec_fcc) {
|
||||
case GST_MAKE_FOURCC ('I', '4', '2', '0'):
|
||||
caps = gst_caps_new_simple ("video/x-raw-yuv",
|
||||
"format", GST_TYPE_FOURCC, codec_fcc,
|
||||
NULL);
|
||||
"format", GST_TYPE_FOURCC, codec_fcc, NULL);
|
||||
if (codec_name)
|
||||
*codec_name = g_strdup ("Raw, uncompressed I420");
|
||||
break;
|
||||
case GST_MAKE_FOURCC ('Y', 'U', 'Y', '2'):
|
||||
caps = gst_caps_new_simple ("video/x-raw-yuv",
|
||||
"format", GST_TYPE_FOURCC, codec_fcc,
|
||||
NULL);
|
||||
"format", GST_TYPE_FOURCC, codec_fcc, NULL);
|
||||
if (codec_name)
|
||||
*codec_name = g_strdup ("Raw, uncompressed YUV 4:2:2");
|
||||
break;
|
||||
|
@ -78,8 +74,7 @@ gst_riff_create_video_caps (guint32 codec_fcc,
|
|||
case GST_MAKE_FOURCC ('M', 'P', 'G', 'I'):
|
||||
caps = gst_caps_new_simple ("video/mpeg",
|
||||
"systemstream", G_TYPE_BOOLEAN, FALSE,
|
||||
"mpegversion", G_TYPE_BOOLEAN, 1,
|
||||
NULL);
|
||||
"mpegversion", G_TYPE_BOOLEAN, 1, NULL);
|
||||
if (codec_name)
|
||||
*codec_name = g_strdup ("MPEG video");
|
||||
break;
|
||||
|
@ -122,15 +117,13 @@ gst_riff_create_video_caps (guint32 codec_fcc,
|
|||
|
||||
case GST_MAKE_FOURCC ('D', 'I', 'V', '3'):
|
||||
caps = gst_caps_new_simple ("video/x-divx",
|
||||
"divxversion", G_TYPE_INT, 3,
|
||||
NULL);
|
||||
"divxversion", G_TYPE_INT, 3, NULL);
|
||||
if (codec_name)
|
||||
*codec_name = g_strdup ("DivX MPEG-4 Version 3");
|
||||
break;
|
||||
case GST_MAKE_FOURCC ('D', 'I', 'V', '4'):
|
||||
caps = gst_caps_new_simple ("video/x-divx",
|
||||
"divxversion", G_TYPE_INT, 4,
|
||||
NULL);
|
||||
"divxversion", G_TYPE_INT, 4, NULL);
|
||||
if (codec_name)
|
||||
*codec_name = g_strdup ("DivX MPEG-4 Version 4");
|
||||
break;
|
||||
|
@ -139,8 +132,7 @@ gst_riff_create_video_caps (guint32 codec_fcc,
|
|||
case GST_MAKE_FOURCC ('D', 'X', '5', '0'):
|
||||
case GST_MAKE_FOURCC ('D', 'I', 'V', '5'):
|
||||
caps = gst_caps_new_simple ("video/x-divx",
|
||||
"divxversion", G_TYPE_INT, 5,
|
||||
NULL);
|
||||
"divxversion", G_TYPE_INT, 5, NULL);
|
||||
if (codec_name)
|
||||
*codec_name = g_strdup ("DivX MPEG-4 Version 5");
|
||||
break;
|
||||
|
@ -154,24 +146,21 @@ gst_riff_create_video_caps (guint32 codec_fcc,
|
|||
|
||||
case GST_MAKE_FOURCC ('M', 'P', 'G', '4'):
|
||||
caps = gst_caps_new_simple ("video/x-msmpeg",
|
||||
"msmpegversion", G_TYPE_INT, 41,
|
||||
NULL);
|
||||
"msmpegversion", G_TYPE_INT, 41, NULL);
|
||||
if (codec_name)
|
||||
*codec_name = g_strdup ("Microsoft MPEG-4 4.1");
|
||||
break;
|
||||
|
||||
case GST_MAKE_FOURCC ('M', 'P', '4', '2'):
|
||||
caps = gst_caps_new_simple ("video/x-msmpeg",
|
||||
"msmpegversion", G_TYPE_INT, 42,
|
||||
NULL);
|
||||
"msmpegversion", G_TYPE_INT, 42, NULL);
|
||||
if (codec_name)
|
||||
*codec_name = g_strdup ("Microsoft MPEG-4 4.2");
|
||||
break;
|
||||
|
||||
case GST_MAKE_FOURCC ('M', 'P', '4', '3'):
|
||||
caps = gst_caps_new_simple ("video/x-msmpeg",
|
||||
"msmpegversion", G_TYPE_INT, 43,
|
||||
NULL);
|
||||
"msmpegversion", G_TYPE_INT, 43, NULL);
|
||||
if (codec_name)
|
||||
*codec_name = g_strdup ("Microsoft MPEG-4 4.3");
|
||||
break;
|
||||
|
@ -186,32 +175,28 @@ gst_riff_create_video_caps (guint32 codec_fcc,
|
|||
case GST_MAKE_FOURCC ('D', 'V', 'S', 'D'):
|
||||
case GST_MAKE_FOURCC ('d', 'v', 's', 'd'):
|
||||
caps = gst_caps_new_simple ("video/x-dv",
|
||||
"systemstream", G_TYPE_BOOLEAN, FALSE,
|
||||
NULL);
|
||||
"systemstream", G_TYPE_BOOLEAN, FALSE, NULL);
|
||||
if (codec_name)
|
||||
*codec_name = g_strdup ("Generic DV");
|
||||
break;
|
||||
|
||||
case GST_MAKE_FOURCC ('W', 'M', 'V', '1'):
|
||||
caps = gst_caps_new_simple ("video/x-wmv",
|
||||
"wmvversion", G_TYPE_INT, 1,
|
||||
NULL);
|
||||
"wmvversion", G_TYPE_INT, 1, NULL);
|
||||
if (codec_name)
|
||||
*codec_name = g_strdup ("Windows Media Video 7");
|
||||
break;
|
||||
|
||||
case GST_MAKE_FOURCC ('W', 'M', 'V', '2'):
|
||||
caps = gst_caps_new_simple ("video/x-wmv",
|
||||
"wmvversion", G_TYPE_INT, 2,
|
||||
NULL);
|
||||
"wmvversion", G_TYPE_INT, 2, NULL);
|
||||
if (codec_name)
|
||||
*codec_name = g_strdup ("Windows Media Video 8");
|
||||
break;
|
||||
|
||||
case GST_MAKE_FOURCC ('W', 'M', 'V', '3'):
|
||||
caps = gst_caps_new_simple ("video/x-wmv",
|
||||
"wmvversion", G_TYPE_INT, 3,
|
||||
NULL);
|
||||
"wmvversion", G_TYPE_INT, 3, NULL);
|
||||
if (codec_name)
|
||||
*codec_name = g_strdup ("Windows Media Video 9");
|
||||
break;
|
||||
|
@ -228,20 +213,17 @@ gst_riff_create_video_caps (guint32 codec_fcc,
|
|||
gst_caps_set_simple (caps, "framerate", G_TYPE_DOUBLE, fps, NULL);
|
||||
} else {
|
||||
gst_caps_set_simple (caps,
|
||||
"framerate", GST_TYPE_DOUBLE_RANGE, 0., G_MAXDOUBLE,
|
||||
NULL);
|
||||
"framerate", GST_TYPE_DOUBLE_RANGE, 0., G_MAXDOUBLE, NULL);
|
||||
}
|
||||
|
||||
if (strf != NULL) {
|
||||
gst_caps_set_simple (caps,
|
||||
"width", G_TYPE_INT, strf->width,
|
||||
"height", G_TYPE_INT, strf->height,
|
||||
NULL);
|
||||
"height", G_TYPE_INT, strf->height, NULL);
|
||||
} else {
|
||||
gst_caps_set_simple (caps,
|
||||
"width", GST_TYPE_INT_RANGE, 16, 4096,
|
||||
"height", GST_TYPE_INT_RANGE, 16, 4096,
|
||||
NULL);
|
||||
"height", GST_TYPE_INT_RANGE, 16, 4096, NULL);
|
||||
}
|
||||
|
||||
return caps;
|
||||
|
@ -249,27 +231,21 @@ gst_riff_create_video_caps (guint32 codec_fcc,
|
|||
|
||||
GstCaps *
|
||||
gst_riff_create_audio_caps (guint16 codec_id,
|
||||
gst_riff_strh *strh,
|
||||
gst_riff_strf_auds *strf,
|
||||
char **codec_name)
|
||||
gst_riff_strh * strh, gst_riff_strf_auds * strf, char **codec_name)
|
||||
{
|
||||
GstCaps *caps = NULL;
|
||||
|
||||
switch (codec_id) {
|
||||
case GST_RIFF_WAVE_FORMAT_MPEGL3: /* mp3 */
|
||||
caps = gst_caps_new_simple ("audio/mpeg",
|
||||
"mpegversion", G_TYPE_INT, 1,
|
||||
"layer", G_TYPE_INT, 3,
|
||||
NULL);
|
||||
"mpegversion", G_TYPE_INT, 1, "layer", G_TYPE_INT, 3, NULL);
|
||||
if (codec_name)
|
||||
*codec_name = g_strdup ("MPEG 1 layer 3");
|
||||
break;
|
||||
|
||||
case GST_RIFF_WAVE_FORMAT_MPEGL12: /* mp1 or mp2 */
|
||||
caps = gst_caps_new_simple ("audio/mpeg",
|
||||
"mpegversion", G_TYPE_INT, 1,
|
||||
"layer", G_TYPE_INT, 2,
|
||||
NULL);
|
||||
"mpegversion", G_TYPE_INT, 1, "layer", G_TYPE_INT, 2, NULL);
|
||||
if (codec_name)
|
||||
*codec_name = g_strdup ("MPEG 1 layer 2");
|
||||
break;
|
||||
|
@ -283,15 +259,12 @@ gst_riff_create_audio_caps (guint16 codec_id,
|
|||
caps = gst_caps_new_simple ("audio/x-raw-int",
|
||||
"endianness", G_TYPE_INT, G_LITTLE_ENDIAN,
|
||||
"width", G_TYPE_INT, (int) (ba * 8 / ch),
|
||||
"depth", G_TYPE_INT, ws,
|
||||
"signed", G_TYPE_BOOLEAN, ws != 8,
|
||||
NULL);
|
||||
"depth", G_TYPE_INT, ws, "signed", G_TYPE_BOOLEAN, ws != 8, NULL);
|
||||
} else {
|
||||
caps = gst_caps_from_string ("audio/x-raw-int, "
|
||||
"endianness = (int) LITTLE_ENDIAN, "
|
||||
"signed = (boolean) { true, false }, "
|
||||
"width = (int) { 8, 16 }, "
|
||||
"height = (int) { 8, 16 }");
|
||||
"width = (int) { 8, 16 }, " "height = (int) { 8, 16 }");
|
||||
}
|
||||
if (codec_name)
|
||||
*codec_name = g_strdup ("PCM WAV");
|
||||
|
@ -335,21 +308,18 @@ gst_riff_create_audio_caps (guint16 codec_id,
|
|||
break;
|
||||
|
||||
default:
|
||||
GST_WARNING ("Unkown audio tag 0x%04x",
|
||||
codec_id);
|
||||
GST_WARNING ("Unkown audio tag 0x%04x", codec_id);
|
||||
break;
|
||||
}
|
||||
|
||||
if (strf != NULL) {
|
||||
gst_caps_set_simple (caps,
|
||||
"rate", G_TYPE_INT, strf->rate,
|
||||
"channels", G_TYPE_INT, strf->channels,
|
||||
NULL);
|
||||
"channels", G_TYPE_INT, strf->channels, NULL);
|
||||
} else {
|
||||
gst_caps_set_simple (caps,
|
||||
"rate", GST_TYPE_INT_RANGE, 8000, 96000,
|
||||
"channels", GST_TYPE_INT_RANGE, 1, 2,
|
||||
NULL);
|
||||
"channels", GST_TYPE_INT_RANGE, 1, 2, NULL);
|
||||
}
|
||||
|
||||
return caps;
|
||||
|
@ -357,9 +327,7 @@ gst_riff_create_audio_caps (guint16 codec_id,
|
|||
|
||||
GstCaps *
|
||||
gst_riff_create_iavs_caps (guint32 codec_fcc,
|
||||
gst_riff_strh *strh,
|
||||
gst_riff_strf_iavs *strf,
|
||||
char **codec_name)
|
||||
gst_riff_strh * strh, gst_riff_strf_iavs * strf, char **codec_name)
|
||||
{
|
||||
GstCaps *caps = NULL;
|
||||
|
||||
|
|
|
@ -27,23 +27,15 @@
|
|||
#include "riff-ids.h"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
/*
|
||||
* Create one caps. strh/strf can be NULL (for non-fixed caps).
|
||||
*/
|
||||
|
||||
GstCaps * gst_riff_create_video_caps (guint32 codec_fcc,
|
||||
gst_riff_strh *strh,
|
||||
gst_riff_strf_vids *strf,
|
||||
char **codec_name);
|
||||
gst_riff_strh * strh, gst_riff_strf_vids * strf, char **codec_name);
|
||||
GstCaps *gst_riff_create_audio_caps (guint16 codec_id,
|
||||
gst_riff_strh *strh,
|
||||
gst_riff_strf_auds *strf,
|
||||
char **codec_name);
|
||||
gst_riff_strh * strh, gst_riff_strf_auds * strf, char **codec_name);
|
||||
GstCaps *gst_riff_create_iavs_caps (guint32 codec_fcc,
|
||||
gst_riff_strh *strh,
|
||||
gst_riff_strf_iavs *strf,
|
||||
char **codec_name);
|
||||
gst_riff_strh * strh, gst_riff_strf_iavs * strf, char **codec_name);
|
||||
|
||||
/*
|
||||
* Create template caps (includes all known types).
|
||||
|
@ -54,5 +46,4 @@ GstCaps *gst_riff_create_audio_template_caps (void);
|
|||
GstCaps *gst_riff_create_iavs_template_caps (void);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GST_RIFF_READ_H__ */
|
||||
|
|
|
@ -28,7 +28,8 @@
|
|||
#include "riff-ids.h"
|
||||
#include "riff-read.h"
|
||||
|
||||
enum {
|
||||
enum
|
||||
{
|
||||
ARG_0,
|
||||
ARG_METADATA
|
||||
/* FILL ME */
|
||||
|
@ -37,8 +38,7 @@ enum {
|
|||
static void gst_riff_read_class_init (GstRiffReadClass * klass);
|
||||
static void gst_riff_read_init (GstRiffRead * riff);
|
||||
|
||||
static GstElementStateReturn
|
||||
gst_riff_read_change_state (GstElement *element);
|
||||
static GstElementStateReturn gst_riff_read_change_state (GstElement * element);
|
||||
|
||||
static GstElementClass *parent_class = NULL;
|
||||
|
||||
|
@ -151,9 +151,7 @@ gst_riff_read_element_level_up (GstRiffRead *riff)
|
|||
|
||||
static gboolean
|
||||
gst_riff_peek_head (GstRiffRead * riff,
|
||||
guint32 *tag,
|
||||
guint32 *length,
|
||||
guint *level_up)
|
||||
guint32 * tag, guint32 * length, guint * level_up)
|
||||
{
|
||||
guint8 *data;
|
||||
|
||||
|
@ -192,8 +190,7 @@ gst_riff_peek_head (GstRiffRead *riff,
|
|||
*/
|
||||
|
||||
static GstBuffer *
|
||||
gst_riff_read_element_data (GstRiffRead *riff,
|
||||
guint length)
|
||||
gst_riff_read_element_data (GstRiffRead * riff, guint length)
|
||||
{
|
||||
GstBuffer *buf = NULL;
|
||||
|
||||
|
@ -218,8 +215,7 @@ gst_riff_read_element_data (GstRiffRead *riff,
|
|||
*/
|
||||
|
||||
GstEvent *
|
||||
gst_riff_read_seek (GstRiffRead *riff,
|
||||
guint64 offset)
|
||||
gst_riff_read_seek (GstRiffRead * riff, guint64 offset)
|
||||
{
|
||||
guint64 length = gst_bytestream_length (riff->bs);
|
||||
guint32 remaining;
|
||||
|
@ -274,8 +270,7 @@ gst_riff_read_seek (GstRiffRead *riff,
|
|||
*/
|
||||
|
||||
guint32
|
||||
gst_riff_peek_tag (GstRiffRead *riff,
|
||||
guint *level_up)
|
||||
gst_riff_peek_tag (GstRiffRead * riff, guint * level_up)
|
||||
{
|
||||
guint32 tag;
|
||||
|
||||
|
@ -359,9 +354,7 @@ gst_riff_read_skip (GstRiffRead *riff)
|
|||
*/
|
||||
|
||||
gboolean
|
||||
gst_riff_read_data (GstRiffRead *riff,
|
||||
guint32 *tag,
|
||||
GstBuffer **buf)
|
||||
gst_riff_read_data (GstRiffRead * riff, guint32 * tag, GstBuffer ** buf)
|
||||
{
|
||||
guint32 length;
|
||||
|
||||
|
@ -377,9 +370,7 @@ gst_riff_read_data (GstRiffRead *riff,
|
|||
*/
|
||||
|
||||
gboolean
|
||||
gst_riff_read_ascii (GstRiffRead *riff,
|
||||
guint32 *tag,
|
||||
gchar **str)
|
||||
gst_riff_read_ascii (GstRiffRead * riff, guint32 * tag, gchar ** str)
|
||||
{
|
||||
GstBuffer *buf;
|
||||
|
||||
|
@ -400,8 +391,7 @@ gst_riff_read_ascii (GstRiffRead *riff,
|
|||
*/
|
||||
|
||||
gboolean
|
||||
gst_riff_read_strh (GstRiffRead *riff,
|
||||
gst_riff_strh **header)
|
||||
gst_riff_read_strh (GstRiffRead * riff, gst_riff_strh ** header)
|
||||
{
|
||||
guint32 tag;
|
||||
GstBuffer *buf;
|
||||
|
@ -422,8 +412,7 @@ gst_riff_read_strh (GstRiffRead *riff,
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
strh = g_memdup (GST_BUFFER_DATA (buf),
|
||||
GST_BUFFER_SIZE (buf));
|
||||
strh = g_memdup (GST_BUFFER_DATA (buf), GST_BUFFER_SIZE (buf));
|
||||
gst_buffer_unref (buf);
|
||||
|
||||
#if (G_BYTE_ORDER == G_BIG_ENDIAN)
|
||||
|
@ -449,8 +438,7 @@ gst_riff_read_strh (GstRiffRead *riff,
|
|||
|
||||
/* debug */
|
||||
GST_INFO ("strh tag found");
|
||||
GST_INFO (" type " GST_FOURCC_FORMAT,
|
||||
GST_FOURCC_ARGS (strh->type));
|
||||
GST_INFO (" type " GST_FOURCC_FORMAT, GST_FOURCC_ARGS (strh->type));
|
||||
GST_INFO (" fcc_handler " GST_FOURCC_FORMAT,
|
||||
GST_FOURCC_ARGS (strh->fcc_handler));
|
||||
GST_INFO (" flags 0x%08x", strh->flags);
|
||||
|
@ -470,8 +458,7 @@ gst_riff_read_strh (GstRiffRead *riff,
|
|||
}
|
||||
|
||||
gboolean
|
||||
gst_riff_read_strf_vids (GstRiffRead *riff,
|
||||
gst_riff_strf_vids **header)
|
||||
gst_riff_read_strf_vids (GstRiffRead * riff, gst_riff_strf_vids ** header)
|
||||
{
|
||||
guint32 tag;
|
||||
GstBuffer *buf;
|
||||
|
@ -492,8 +479,7 @@ gst_riff_read_strf_vids (GstRiffRead *riff,
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
strf = g_memdup (GST_BUFFER_DATA (buf),
|
||||
GST_BUFFER_SIZE (buf));
|
||||
strf = g_memdup (GST_BUFFER_DATA (buf), GST_BUFFER_SIZE (buf));
|
||||
|
||||
#if (G_BYTE_ORDER == G_BIG_ENDIAN)
|
||||
strf->size = GUINT32_FROM_LE (strf->size);
|
||||
|
@ -539,8 +525,7 @@ gst_riff_read_strf_vids (GstRiffRead *riff,
|
|||
}
|
||||
|
||||
gboolean
|
||||
gst_riff_read_strf_auds (GstRiffRead *riff,
|
||||
gst_riff_strf_auds **header)
|
||||
gst_riff_read_strf_auds (GstRiffRead * riff, gst_riff_strf_auds ** header)
|
||||
{
|
||||
guint32 tag;
|
||||
GstBuffer *buf;
|
||||
|
@ -561,8 +546,7 @@ gst_riff_read_strf_auds (GstRiffRead *riff,
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
strf = g_memdup (GST_BUFFER_DATA (buf),
|
||||
GST_BUFFER_SIZE (buf));
|
||||
strf = g_memdup (GST_BUFFER_DATA (buf), GST_BUFFER_SIZE (buf));
|
||||
|
||||
#if (G_BYTE_ORDER == G_BIG_ENDIAN)
|
||||
strf->format = GUINT16_FROM_LE (strf->format);
|
||||
|
@ -590,8 +574,7 @@ gst_riff_read_strf_auds (GstRiffRead *riff,
|
|||
}
|
||||
|
||||
gboolean
|
||||
gst_riff_read_strf_iavs (GstRiffRead *riff,
|
||||
gst_riff_strf_iavs **header)
|
||||
gst_riff_read_strf_iavs (GstRiffRead * riff, gst_riff_strf_iavs ** header)
|
||||
{
|
||||
guint32 tag;
|
||||
GstBuffer *buf;
|
||||
|
@ -612,8 +595,7 @@ gst_riff_read_strf_iavs (GstRiffRead *riff,
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
strf = g_memdup (GST_BUFFER_DATA (buf),
|
||||
GST_BUFFER_SIZE (buf));
|
||||
strf = g_memdup (GST_BUFFER_DATA (buf), GST_BUFFER_SIZE (buf));
|
||||
gst_buffer_unref (buf);
|
||||
|
||||
#if (G_BYTE_ORDER == G_BIG_ENDIAN)
|
||||
|
@ -648,8 +630,7 @@ gst_riff_read_strf_iavs (GstRiffRead *riff,
|
|||
*/
|
||||
|
||||
gboolean
|
||||
gst_riff_read_list (GstRiffRead *riff,
|
||||
guint32 *tag)
|
||||
gst_riff_read_list (GstRiffRead * riff, guint32 * tag)
|
||||
{
|
||||
guint32 length, lst;
|
||||
GstRiffLevel *level;
|
||||
|
@ -795,7 +776,9 @@ gst_riff_read_info (GstRiffRead *riff)
|
|||
}
|
||||
|
||||
if (name && name[0] != '\0') {
|
||||
GValue src = { 0 }, dest = { 0 };
|
||||
GValue src = { 0 }
|
||||
, dest = {
|
||||
0};
|
||||
GType dest_type = gst_tag_get_type (type);
|
||||
|
||||
have_tags = TRUE;
|
||||
|
@ -839,8 +822,7 @@ gst_riff_read_info (GstRiffRead *riff)
|
|||
*/
|
||||
|
||||
gboolean
|
||||
gst_riff_read_header (GstRiffRead *riff,
|
||||
guint32 *doctype)
|
||||
gst_riff_read_header (GstRiffRead * riff, guint32 * doctype)
|
||||
{
|
||||
GstRiffLevel *level;
|
||||
guint32 tag, length;
|
||||
|
|
|
@ -27,7 +27,6 @@
|
|||
#include <gst/bytestream/bytestream.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define GST_TYPE_RIFF_READ \
|
||||
(gst_riff_read_get_type ())
|
||||
#define GST_RIFF_READ(obj) \
|
||||
|
@ -40,13 +39,13 @@ G_BEGIN_DECLS
|
|||
(G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_RIFF_READ))
|
||||
#define GST_RIFF_READ_GET_CLASS(obj) \
|
||||
(G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_RIFF_READ, GstRiffReadClass))
|
||||
|
||||
typedef struct _GstRiffLevel {
|
||||
guint64 start,
|
||||
length;
|
||||
typedef struct _GstRiffLevel
|
||||
{
|
||||
guint64 start, length;
|
||||
} GstRiffLevel;
|
||||
|
||||
typedef struct _GstRiffRead {
|
||||
typedef struct _GstRiffRead
|
||||
{
|
||||
GstElement parent;
|
||||
|
||||
GstPad *sinkpad;
|
||||
|
@ -55,35 +54,28 @@ typedef struct _GstRiffRead {
|
|||
GList *level;
|
||||
} GstRiffRead;
|
||||
|
||||
typedef struct _GstRiffReadClass {
|
||||
typedef struct _GstRiffReadClass
|
||||
{
|
||||
GstElementClass parent;
|
||||
} GstRiffReadClass;
|
||||
|
||||
GType gst_riff_read_get_type (void);
|
||||
|
||||
guint32 gst_riff_peek_tag (GstRiffRead *riff,
|
||||
guint *level_up);
|
||||
guint32 gst_riff_peek_tag (GstRiffRead * riff, guint * level_up);
|
||||
guint32 gst_riff_peek_list (GstRiffRead * riff);
|
||||
|
||||
GstEvent *gst_riff_read_seek (GstRiffRead *riff,
|
||||
guint64 offset);
|
||||
GstEvent *gst_riff_read_seek (GstRiffRead * riff, guint64 offset);
|
||||
gboolean gst_riff_read_skip (GstRiffRead * riff);
|
||||
gboolean gst_riff_read_data (GstRiffRead * riff,
|
||||
guint32 *tag,
|
||||
GstBuffer **buf);
|
||||
gboolean gst_riff_read_ascii (GstRiffRead *riff,
|
||||
guint32 *tag,
|
||||
gchar **str);
|
||||
gboolean gst_riff_read_list (GstRiffRead *riff,
|
||||
guint32 *tag);
|
||||
gboolean gst_riff_read_header (GstRiffRead *read,
|
||||
guint32 *doctype);
|
||||
guint32 * tag, GstBuffer ** buf);
|
||||
gboolean gst_riff_read_ascii (GstRiffRead * riff, guint32 * tag, gchar ** str);
|
||||
gboolean gst_riff_read_list (GstRiffRead * riff, guint32 * tag);
|
||||
gboolean gst_riff_read_header (GstRiffRead * read, guint32 * doctype);
|
||||
|
||||
/*
|
||||
* Utility functions (including byteswapping).
|
||||
*/
|
||||
gboolean gst_riff_read_strh (GstRiffRead *riff,
|
||||
gst_riff_strh **header);
|
||||
gboolean gst_riff_read_strh (GstRiffRead * riff, gst_riff_strh ** header);
|
||||
gboolean gst_riff_read_strf_vids (GstRiffRead * riff,
|
||||
gst_riff_strf_vids ** header);
|
||||
gboolean gst_riff_read_strf_auds (GstRiffRead * riff,
|
||||
|
@ -93,5 +85,4 @@ gboolean gst_riff_read_strf_iavs (GstRiffRead *riff,
|
|||
gboolean gst_riff_read_info (GstRiffRead * riff);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GST_RIFF_READ_H__ */
|
||||
|
|
|
@ -31,14 +31,8 @@ plugin_init (GstPlugin *plugin)
|
|||
return gst_library_load ("gstbytestream");
|
||||
}
|
||||
|
||||
GST_PLUGIN_DEFINE (
|
||||
GST_VERSION_MAJOR,
|
||||
GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
|
||||
GST_VERSION_MINOR,
|
||||
"riff",
|
||||
"RIFF I/O functions",
|
||||
plugin_init,
|
||||
VERSION,
|
||||
GST_LICENSE,
|
||||
GST_PACKAGE,
|
||||
GST_ORIGIN
|
||||
)
|
||||
plugin_init, VERSION, GST_LICENSE, GST_PACKAGE, GST_ORIGIN)
|
||||
|
|
|
@ -24,28 +24,20 @@
|
|||
#include <gst/gst.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
|
||||
/* functions for vorbis comment manipulation */
|
||||
|
||||
G_CONST_RETURN gchar * gst_tag_from_vorbis_tag (const gchar * vorbis_tag);
|
||||
G_CONST_RETURN gchar *gst_tag_to_vorbis_tag (const gchar * gst_tag);
|
||||
void gst_vorbis_tag_add (GstTagList * list,
|
||||
const gchar * tag,
|
||||
const gchar * value);
|
||||
const gchar * tag, const gchar * value);
|
||||
|
||||
GList * gst_tag_to_vorbis_comments (const GstTagList * list,
|
||||
const gchar * tag);
|
||||
GList *gst_tag_to_vorbis_comments (const GstTagList * list, const gchar * tag);
|
||||
|
||||
/* functions to convert GstBuffers with vorbiscomment contents to GstTagLists and back */
|
||||
GstTagList *gst_tag_list_from_vorbiscomment_buffer (const GstBuffer * buffer,
|
||||
const guint8 * id_data,
|
||||
const guint id_data_length,
|
||||
gchar ** vendor_string);
|
||||
const guint8 * id_data, const guint id_data_length, gchar ** vendor_string);
|
||||
GstBuffer *gst_tag_list_to_vorbiscomment_buffer (const GstTagList * list,
|
||||
const guint8 * id_data,
|
||||
const guint id_data_length,
|
||||
const gchar * vendor_string);
|
||||
const guint id_data_length, const gchar * vendor_string);
|
||||
|
||||
/* functions for ID3 tag manipulation */
|
||||
|
||||
|
@ -58,5 +50,4 @@ G_CONST_RETURN gchar * gst_tag_to_id3_tag (const gchar * gst_tag);
|
|||
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GST_TAG_TAG_H__ */
|
||||
|
|
|
@ -28,7 +28,8 @@
|
|||
|
||||
#include <string.h>
|
||||
|
||||
enum {
|
||||
enum
|
||||
{
|
||||
NORM_CHANGED,
|
||||
CHANNEL_CHANGED,
|
||||
FREQUENCY_CHANGED,
|
||||
|
@ -59,8 +60,7 @@ gst_tuner_get_type (void)
|
|||
};
|
||||
|
||||
gst_tuner_type = g_type_register_static (G_TYPE_INTERFACE,
|
||||
"GstTuner",
|
||||
&gst_tuner_info, 0);
|
||||
"GstTuner", &gst_tuner_info, 0);
|
||||
g_type_interface_add_prerequisite (gst_tuner_type,
|
||||
GST_TYPE_IMPLEMENTS_INTERFACE);
|
||||
}
|
||||
|
@ -79,8 +79,7 @@ gst_tuner_class_init (GstTunerClass *klass)
|
|||
GST_TYPE_TUNER, G_SIGNAL_RUN_LAST,
|
||||
G_STRUCT_OFFSET (GstTunerClass, norm_changed),
|
||||
NULL, NULL,
|
||||
g_cclosure_marshal_VOID__OBJECT, G_TYPE_NONE, 1,
|
||||
GST_TYPE_TUNER_NORM);
|
||||
g_cclosure_marshal_VOID__OBJECT, G_TYPE_NONE, 1, GST_TYPE_TUNER_NORM);
|
||||
gst_tuner_signals[CHANNEL_CHANGED] =
|
||||
g_signal_new ("channel-changed",
|
||||
GST_TYPE_TUNER, G_SIGNAL_RUN_LAST,
|
||||
|
@ -151,8 +150,7 @@ gst_tuner_list_channels (GstTuner *tuner)
|
|||
*/
|
||||
|
||||
void
|
||||
gst_tuner_set_channel (GstTuner *tuner,
|
||||
GstTunerChannel *channel)
|
||||
gst_tuner_set_channel (GstTuner * tuner, GstTunerChannel * channel)
|
||||
{
|
||||
GstTunerClass *klass = GST_TUNER_GET_CLASS (tuner);
|
||||
|
||||
|
@ -214,8 +212,7 @@ gst_tuner_list_norms (GstTuner *tuner)
|
|||
*/
|
||||
|
||||
void
|
||||
gst_tuner_set_norm (GstTuner *tuner,
|
||||
GstTunerNorm *norm)
|
||||
gst_tuner_set_norm (GstTuner * tuner, GstTunerNorm * norm)
|
||||
{
|
||||
GstTunerClass *klass = GST_TUNER_GET_CLASS (tuner);
|
||||
|
||||
|
@ -260,8 +257,7 @@ gst_tuner_get_norm (GstTuner *tuner)
|
|||
|
||||
void
|
||||
gst_tuner_set_frequency (GstTuner * tuner,
|
||||
GstTunerChannel *channel,
|
||||
gulong frequency)
|
||||
GstTunerChannel * channel, gulong frequency)
|
||||
{
|
||||
GstTunerClass *klass = GST_TUNER_GET_CLASS (tuner);
|
||||
|
||||
|
@ -285,8 +281,7 @@ gst_tuner_set_frequency (GstTuner *tuner,
|
|||
*/
|
||||
|
||||
gulong
|
||||
gst_tuner_get_frequency (GstTuner *tuner,
|
||||
GstTunerChannel *channel)
|
||||
gst_tuner_get_frequency (GstTuner * tuner, GstTunerChannel * channel)
|
||||
{
|
||||
GstTunerClass *klass = GST_TUNER_GET_CLASS (tuner);
|
||||
|
||||
|
@ -315,8 +310,7 @@ gst_tuner_get_frequency (GstTuner *tuner,
|
|||
*/
|
||||
|
||||
gint
|
||||
gst_tuner_signal_strength (GstTuner *tuner,
|
||||
GstTunerChannel *channel)
|
||||
gst_tuner_signal_strength (GstTuner * tuner, GstTunerChannel * channel)
|
||||
{
|
||||
GstTunerClass *klass = GST_TUNER_GET_CLASS (tuner);
|
||||
|
||||
|
@ -331,8 +325,7 @@ gst_tuner_signal_strength (GstTuner *tuner,
|
|||
}
|
||||
|
||||
GstTunerNorm *
|
||||
gst_tuner_find_norm_by_name (GstTuner *tuner,
|
||||
gchar *norm)
|
||||
gst_tuner_find_norm_by_name (GstTuner * tuner, gchar * norm)
|
||||
{
|
||||
GList *walk;
|
||||
|
||||
|
@ -349,8 +342,7 @@ gst_tuner_find_norm_by_name (GstTuner *tuner,
|
|||
}
|
||||
|
||||
GstTunerChannel *
|
||||
gst_tuner_find_channel_by_name (GstTuner *tuner,
|
||||
gchar *channel)
|
||||
gst_tuner_find_channel_by_name (GstTuner * tuner, gchar * channel)
|
||||
{
|
||||
GList *walk;
|
||||
|
||||
|
@ -367,59 +359,46 @@ gst_tuner_find_channel_by_name (GstTuner *tuner,
|
|||
}
|
||||
|
||||
void
|
||||
gst_tuner_channel_changed (GstTuner *tuner,
|
||||
GstTunerChannel *channel)
|
||||
gst_tuner_channel_changed (GstTuner * tuner, GstTunerChannel * channel)
|
||||
{
|
||||
g_return_if_fail (GST_IS_TUNER (tuner));
|
||||
g_return_if_fail (GST_IS_TUNER_CHANNEL (channel));
|
||||
|
||||
g_signal_emit (G_OBJECT (tuner),
|
||||
gst_tuner_signals[CHANNEL_CHANGED], 0,
|
||||
channel);
|
||||
gst_tuner_signals[CHANNEL_CHANGED], 0, channel);
|
||||
}
|
||||
|
||||
void
|
||||
gst_tuner_norm_changed (GstTuner *tuner,
|
||||
GstTunerNorm *norm)
|
||||
gst_tuner_norm_changed (GstTuner * tuner, GstTunerNorm * norm)
|
||||
{
|
||||
g_return_if_fail (GST_IS_TUNER (tuner));
|
||||
g_return_if_fail (GST_IS_TUNER_NORM (norm));
|
||||
|
||||
g_signal_emit (G_OBJECT (tuner),
|
||||
gst_tuner_signals[NORM_CHANGED], 0,
|
||||
norm);
|
||||
g_signal_emit (G_OBJECT (tuner), gst_tuner_signals[NORM_CHANGED], 0, norm);
|
||||
}
|
||||
|
||||
void
|
||||
gst_tuner_frequency_changed (GstTuner * tuner,
|
||||
GstTunerChannel *channel,
|
||||
gulong frequency)
|
||||
GstTunerChannel * channel, gulong frequency)
|
||||
{
|
||||
g_return_if_fail (GST_IS_TUNER (tuner));
|
||||
g_return_if_fail (GST_IS_TUNER_CHANNEL (channel));
|
||||
|
||||
g_signal_emit (G_OBJECT (tuner),
|
||||
gst_tuner_signals[FREQUENCY_CHANGED], 0,
|
||||
channel, frequency);
|
||||
gst_tuner_signals[FREQUENCY_CHANGED], 0, channel, frequency);
|
||||
|
||||
g_signal_emit_by_name (G_OBJECT (channel),
|
||||
"frequency_changed",
|
||||
frequency);
|
||||
g_signal_emit_by_name (G_OBJECT (channel), "frequency_changed", frequency);
|
||||
}
|
||||
|
||||
void
|
||||
gst_tuner_signal_changed (GstTuner * tuner,
|
||||
GstTunerChannel *channel,
|
||||
gint signal)
|
||||
GstTunerChannel * channel, gint signal)
|
||||
{
|
||||
g_return_if_fail (GST_IS_TUNER (tuner));
|
||||
g_return_if_fail (GST_IS_TUNER_CHANNEL (channel));
|
||||
|
||||
g_signal_emit (G_OBJECT (tuner),
|
||||
gst_tuner_signals[SIGNAL_CHANGED], 0,
|
||||
channel, signal);
|
||||
gst_tuner_signals[SIGNAL_CHANGED], 0, channel, signal);
|
||||
|
||||
g_signal_emit_by_name (G_OBJECT (channel),
|
||||
"signal_changed",
|
||||
signal);
|
||||
g_signal_emit_by_name (G_OBJECT (channel), "signal_changed", signal);
|
||||
}
|
||||
|
|
|
@ -28,7 +28,6 @@
|
|||
#include <gst/tuner/tuner-enumtypes.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define GST_TYPE_TUNER \
|
||||
(gst_tuner_get_type ())
|
||||
#define GST_TUNER(obj) \
|
||||
|
@ -41,43 +40,33 @@ G_BEGIN_DECLS
|
|||
(G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_TUNER))
|
||||
#define GST_TUNER_GET_CLASS(inst) \
|
||||
(G_TYPE_INSTANCE_GET_INTERFACE ((inst), GST_TYPE_TUNER, GstTunerClass))
|
||||
|
||||
typedef struct _GstTuner GstTuner;
|
||||
|
||||
typedef struct _GstTunerClass {
|
||||
typedef struct _GstTunerClass
|
||||
{
|
||||
GTypeInterface klass;
|
||||
|
||||
/* virtual functions */
|
||||
const GList *(*list_channels) (GstTuner * tuner);
|
||||
void (* set_channel) (GstTuner *tuner,
|
||||
GstTunerChannel *channel);
|
||||
GstTunerChannel *
|
||||
(* get_channel) (GstTuner *tuner);
|
||||
void (*set_channel) (GstTuner * tuner, GstTunerChannel * channel);
|
||||
GstTunerChannel *(*get_channel) (GstTuner * tuner);
|
||||
|
||||
const GList *(*list_norms) (GstTuner * tuner);
|
||||
void (* set_norm) (GstTuner *tuner,
|
||||
GstTunerNorm *norm);
|
||||
void (*set_norm) (GstTuner * tuner, GstTunerNorm * norm);
|
||||
GstTunerNorm *(*get_norm) (GstTuner * tuner);
|
||||
|
||||
void (*set_frequency) (GstTuner * tuner,
|
||||
GstTunerChannel *channel,
|
||||
gulong frequency);
|
||||
gulong (* get_frequency) (GstTuner *tuner,
|
||||
GstTunerChannel *channel);
|
||||
gint (* signal_strength) (GstTuner *tuner,
|
||||
GstTunerChannel *channel);
|
||||
GstTunerChannel * channel, gulong frequency);
|
||||
gulong (*get_frequency) (GstTuner * tuner, GstTunerChannel * channel);
|
||||
gint (*signal_strength) (GstTuner * tuner, GstTunerChannel * channel);
|
||||
|
||||
/* signals */
|
||||
void (*channel_changed) (GstTuner *tuner,
|
||||
GstTunerChannel *channel);
|
||||
void (*norm_changed) (GstTuner *tuner,
|
||||
GstTunerNorm *norm);
|
||||
void (*channel_changed) (GstTuner * tuner, GstTunerChannel * channel);
|
||||
void (*norm_changed) (GstTuner * tuner, GstTunerNorm * norm);
|
||||
void (*frequency_changed) (GstTuner * tuner,
|
||||
GstTunerChannel *channel,
|
||||
gulong frequency);
|
||||
GstTunerChannel * channel, gulong frequency);
|
||||
void (*signal_changed) (GstTuner * tuner,
|
||||
GstTunerChannel *channel,
|
||||
gint signal);
|
||||
GstTunerChannel * channel, gint signal);
|
||||
|
||||
gpointer _gst_reserved[GST_PADDING];
|
||||
} GstTunerClass;
|
||||
|
@ -86,42 +75,30 @@ GType gst_tuner_get_type (void);
|
|||
|
||||
/* virtual class function wrappers */
|
||||
const GList *gst_tuner_list_channels (GstTuner * tuner);
|
||||
void gst_tuner_set_channel (GstTuner *tuner,
|
||||
GstTunerChannel *channel);
|
||||
GstTunerChannel *
|
||||
gst_tuner_get_channel (GstTuner *tuner);
|
||||
void gst_tuner_set_channel (GstTuner * tuner, GstTunerChannel * channel);
|
||||
GstTunerChannel *gst_tuner_get_channel (GstTuner * tuner);
|
||||
|
||||
const GList *gst_tuner_list_norms (GstTuner * tuner);
|
||||
void gst_tuner_set_norm (GstTuner *tuner,
|
||||
GstTunerNorm *channel);
|
||||
void gst_tuner_set_norm (GstTuner * tuner, GstTunerNorm * channel);
|
||||
GstTunerNorm *gst_tuner_get_norm (GstTuner * tuner);
|
||||
|
||||
void gst_tuner_set_frequency (GstTuner * tuner,
|
||||
GstTunerChannel *channel,
|
||||
gulong frequency);
|
||||
gulong gst_tuner_get_frequency (GstTuner *tuner,
|
||||
GstTunerChannel *channel);
|
||||
gint gst_tuner_signal_strength (GstTuner *tuner,
|
||||
GstTunerChannel *channel);
|
||||
GstTunerChannel * channel, gulong frequency);
|
||||
gulong gst_tuner_get_frequency (GstTuner * tuner, GstTunerChannel * channel);
|
||||
gint gst_tuner_signal_strength (GstTuner * tuner, GstTunerChannel * channel);
|
||||
|
||||
/* helper functions */
|
||||
GstTunerNorm * gst_tuner_find_norm_by_name (GstTuner *tuner,
|
||||
gchar *norm);
|
||||
GstTunerNorm *gst_tuner_find_norm_by_name (GstTuner * tuner, gchar * norm);
|
||||
GstTunerChannel *gst_tuner_find_channel_by_name (GstTuner * tuner,
|
||||
gchar * channel);
|
||||
|
||||
/* trigger signals */
|
||||
void gst_tuner_channel_changed (GstTuner *tuner,
|
||||
GstTunerChannel *channel);
|
||||
void gst_tuner_norm_changed (GstTuner *tuner,
|
||||
GstTunerNorm *norm);
|
||||
void gst_tuner_channel_changed (GstTuner * tuner, GstTunerChannel * channel);
|
||||
void gst_tuner_norm_changed (GstTuner * tuner, GstTunerNorm * norm);
|
||||
void gst_tuner_frequency_changed (GstTuner * tuner,
|
||||
GstTunerChannel *channel,
|
||||
gulong frequency);
|
||||
GstTunerChannel * channel, gulong frequency);
|
||||
void gst_tuner_signal_changed (GstTuner * tuner,
|
||||
GstTunerChannel *channel,
|
||||
gint signal);
|
||||
GstTunerChannel * channel, gint signal);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GST_TUNER_H__ */
|
||||
|
|
|
@ -25,7 +25,8 @@
|
|||
|
||||
#include "tunerchannel.h"
|
||||
|
||||
enum {
|
||||
enum
|
||||
{
|
||||
/* FILL ME */
|
||||
SIGNAL_FREQUENCY_CHANGED,
|
||||
SIGNAL_SIGNAL_CHANGED,
|
||||
|
@ -60,8 +61,7 @@ gst_tuner_channel_get_type (void)
|
|||
|
||||
gst_tuner_channel_type =
|
||||
g_type_register_static (G_TYPE_OBJECT,
|
||||
"GstTunerChannel",
|
||||
&tuner_channel_info, 0);
|
||||
"GstTunerChannel", &tuner_channel_info, 0);
|
||||
}
|
||||
|
||||
return gst_tuner_channel_type;
|
||||
|
@ -79,15 +79,13 @@ gst_tuner_channel_class_init (GstTunerChannelClass *klass)
|
|||
G_SIGNAL_RUN_LAST,
|
||||
G_STRUCT_OFFSET (GstTunerChannelClass,
|
||||
frequency_changed),
|
||||
NULL, NULL, g_cclosure_marshal_VOID__ULONG,
|
||||
G_TYPE_NONE, 1, G_TYPE_ULONG);
|
||||
NULL, NULL, g_cclosure_marshal_VOID__ULONG, G_TYPE_NONE, 1, G_TYPE_ULONG);
|
||||
signals[SIGNAL_SIGNAL_CHANGED] =
|
||||
g_signal_new ("signal-changed", G_TYPE_FROM_CLASS (klass),
|
||||
G_SIGNAL_RUN_LAST,
|
||||
G_STRUCT_OFFSET (GstTunerChannelClass,
|
||||
signal_changed),
|
||||
NULL, NULL, g_cclosure_marshal_VOID__INT,
|
||||
G_TYPE_NONE, 1, G_TYPE_INT);
|
||||
NULL, NULL, g_cclosure_marshal_VOID__INT, G_TYPE_NONE, 1, G_TYPE_INT);
|
||||
|
||||
object_klass->dispose = gst_tuner_channel_dispose;
|
||||
}
|
||||
|
|
|
@ -25,7 +25,6 @@
|
|||
#include <gst/gst.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define GST_TYPE_TUNER_CHANNEL \
|
||||
(gst_tuner_channel_get_type ())
|
||||
#define GST_TUNER_CHANNEL(obj) \
|
||||
|
@ -38,8 +37,8 @@ G_BEGIN_DECLS
|
|||
(G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_TUNER_CHANNEL))
|
||||
#define GST_IS_TUNER_CHANNEL_CLASS(klass) \
|
||||
(G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_TUNER_CHANNEL))
|
||||
|
||||
typedef enum {
|
||||
typedef enum
|
||||
{
|
||||
GST_TUNER_CHANNEL_INPUT = (1 << 0),
|
||||
GST_TUNER_CHANNEL_OUTPUT = (1 << 1),
|
||||
GST_TUNER_CHANNEL_FREQUENCY = (1 << 2),
|
||||
|
@ -49,25 +48,23 @@ typedef enum {
|
|||
#define GST_TUNER_CHANNEL_HAS_FLAG(channel, flag) \
|
||||
((channel)->flags & flag)
|
||||
|
||||
typedef struct _GstTunerChannel {
|
||||
typedef struct _GstTunerChannel
|
||||
{
|
||||
GObject parent;
|
||||
|
||||
gchar *label;
|
||||
GstTunerChannelFlags flags;
|
||||
gulong min_frequency,
|
||||
max_frequency;
|
||||
gint min_signal,
|
||||
max_signal;
|
||||
gulong min_frequency, max_frequency;
|
||||
gint min_signal, max_signal;
|
||||
} GstTunerChannel;
|
||||
|
||||
typedef struct _GstTunerChannelClass {
|
||||
typedef struct _GstTunerChannelClass
|
||||
{
|
||||
GObjectClass parent;
|
||||
|
||||
/* signals */
|
||||
void (*frequency_changed) (GstTunerChannel *channel,
|
||||
gulong frequency);
|
||||
void (*signal_changed) (GstTunerChannel *channel,
|
||||
gint signal);
|
||||
void (*frequency_changed) (GstTunerChannel * channel, gulong frequency);
|
||||
void (*signal_changed) (GstTunerChannel * channel, gint signal);
|
||||
|
||||
gpointer _gst_reserved[GST_PADDING];
|
||||
} GstTunerChannelClass;
|
||||
|
@ -75,5 +72,4 @@ typedef struct _GstTunerChannelClass {
|
|||
GType gst_tuner_channel_get_type (void);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GST_TUNER_CHANNEL_H__ */
|
||||
|
|
|
@ -25,7 +25,8 @@
|
|||
|
||||
#include "tunernorm.h"
|
||||
|
||||
enum {
|
||||
enum
|
||||
{
|
||||
/* FILL ME */
|
||||
LAST_SIGNAL
|
||||
};
|
||||
|
@ -35,6 +36,7 @@ static void gst_tuner_norm_init (GstTunerNorm *norm);
|
|||
static void gst_tuner_norm_dispose (GObject * object);
|
||||
|
||||
static GObjectClass *parent_class = NULL;
|
||||
|
||||
/*static guint signals[LAST_SIGNAL] = { 0 };*/
|
||||
|
||||
GType
|
||||
|
@ -58,8 +60,7 @@ gst_tuner_norm_get_type (void)
|
|||
|
||||
gst_tuner_norm_type =
|
||||
g_type_register_static (G_TYPE_OBJECT,
|
||||
"GstTunerNorm",
|
||||
&tuner_norm_info, 0);
|
||||
"GstTunerNorm", &tuner_norm_info, 0);
|
||||
}
|
||||
|
||||
return gst_tuner_norm_type;
|
||||
|
|
|
@ -25,7 +25,6 @@
|
|||
#include <gst/gst.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define GST_TYPE_TUNER_NORM \
|
||||
(gst_tuner_norm_get_type ())
|
||||
#define GST_TUNER_NORM(obj) \
|
||||
|
@ -36,15 +35,16 @@ G_BEGIN_DECLS
|
|||
(G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_TUNER_NORM))
|
||||
#define GST_IS_TUNER_NORM_CLASS(klass) \
|
||||
(G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_TUNER_NORM))
|
||||
|
||||
typedef struct _GstTunerNorm {
|
||||
typedef struct _GstTunerNorm
|
||||
{
|
||||
GObject parent;
|
||||
|
||||
gchar *label;
|
||||
gfloat fps;
|
||||
} GstTunerNorm;
|
||||
|
||||
typedef struct _GstTunerNormClass {
|
||||
typedef struct _GstTunerNormClass
|
||||
{
|
||||
GObjectClass parent;
|
||||
|
||||
gpointer _gst_reserved[GST_PADDING];
|
||||
|
@ -53,5 +53,4 @@ typedef struct _GstTunerNormClass {
|
|||
GType gst_tuner_norm_get_type (void);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GST_TUNER_NORM_H__ */
|
||||
|
|
|
@ -69,8 +69,7 @@ gst_videosink_get_type (void)
|
|||
{
|
||||
static GType videosink_type = 0;
|
||||
|
||||
if (!videosink_type)
|
||||
{
|
||||
if (!videosink_type) {
|
||||
static const GTypeInfo videosink_info = {
|
||||
sizeof (GstVideoSinkClass),
|
||||
NULL,
|
||||
|
@ -84,8 +83,7 @@ gst_videosink_get_type (void)
|
|||
};
|
||||
|
||||
videosink_type = g_type_register_static (GST_TYPE_ELEMENT,
|
||||
"GstVideoSink",
|
||||
&videosink_info, 0);
|
||||
"GstVideoSink", &videosink_info, 0);
|
||||
}
|
||||
|
||||
return videosink_type;
|
||||
|
|
|
@ -37,30 +37,25 @@ gst_video_frame_rate (GstPad *pad)
|
|||
caps = GST_PAD_CAPS (pad);
|
||||
if (caps == NULL) {
|
||||
g_warning ("gstvideo: failed to get caps of pad %s:%s",
|
||||
GST_ELEMENT_NAME (gst_pad_get_parent (pad)),
|
||||
GST_PAD_NAME(pad));
|
||||
GST_ELEMENT_NAME (gst_pad_get_parent (pad)), GST_PAD_NAME (pad));
|
||||
return 0.;
|
||||
}
|
||||
|
||||
structure = gst_caps_get_structure (caps, 0);
|
||||
if (!gst_structure_get_double (structure, "framerate", &fps)) {
|
||||
g_warning ("gstvideo: failed to get framerate property of pad %s:%s",
|
||||
GST_ELEMENT_NAME (gst_pad_get_parent (pad)),
|
||||
GST_PAD_NAME (pad));
|
||||
GST_ELEMENT_NAME (gst_pad_get_parent (pad)), GST_PAD_NAME (pad));
|
||||
return 0.;
|
||||
}
|
||||
|
||||
GST_DEBUG ("Framerate request on pad %s:%s: %f",
|
||||
GST_ELEMENT_NAME (gst_pad_get_parent (pad)),
|
||||
GST_PAD_NAME(pad), fps);
|
||||
GST_ELEMENT_NAME (gst_pad_get_parent (pad)), GST_PAD_NAME (pad), fps);
|
||||
|
||||
return fps;
|
||||
}
|
||||
|
||||
gboolean
|
||||
gst_video_get_size (GstPad *pad,
|
||||
gint *width,
|
||||
gint *height)
|
||||
gst_video_get_size (GstPad * pad, gint * width, gint * height)
|
||||
{
|
||||
const GstCaps *caps = NULL;
|
||||
GstStructure *structure;
|
||||
|
@ -74,8 +69,7 @@ gst_video_get_size (GstPad *pad,
|
|||
|
||||
if (caps == NULL) {
|
||||
g_warning ("gstvideo: failed to get caps of pad %s:%s",
|
||||
GST_ELEMENT_NAME (gst_pad_get_parent (pad)),
|
||||
GST_PAD_NAME(pad));
|
||||
GST_ELEMENT_NAME (gst_pad_get_parent (pad)), GST_PAD_NAME (pad));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -85,16 +79,13 @@ gst_video_get_size (GstPad *pad,
|
|||
|
||||
if (!ret) {
|
||||
g_warning ("gstvideo: failed to get size properties on pad %s:%s",
|
||||
GST_ELEMENT_NAME (gst_pad_get_parent (pad)),
|
||||
GST_PAD_NAME(pad));
|
||||
GST_ELEMENT_NAME (gst_pad_get_parent (pad)), GST_PAD_NAME (pad));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
GST_DEBUG ("size request on pad %s:%s: %dx%d",
|
||||
GST_ELEMENT_NAME (gst_pad_get_parent (pad)),
|
||||
GST_PAD_NAME (pad),
|
||||
width ? *width : -1,
|
||||
height ? *height : -1);
|
||||
GST_PAD_NAME (pad), width ? *width : -1, height ? *height : -1);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -105,14 +96,8 @@ plugin_init (GstPlugin *plugin)
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
GST_PLUGIN_DEFINE (
|
||||
GST_VERSION_MAJOR,
|
||||
GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
|
||||
GST_VERSION_MINOR,
|
||||
"gstvideo",
|
||||
"Convenience routines for video plugins",
|
||||
plugin_init,
|
||||
VERSION,
|
||||
GST_LICENSE,
|
||||
GST_PACKAGE,
|
||||
GST_ORIGIN
|
||||
)
|
||||
plugin_init, VERSION, GST_LICENSE, GST_PACKAGE, GST_ORIGIN)
|
||||
|
|
|
@ -156,8 +156,6 @@
|
|||
|
||||
/* functions */
|
||||
gdouble gst_video_frame_rate (GstPad * pad);
|
||||
gboolean gst_video_get_size (GstPad *pad,
|
||||
gint *width,
|
||||
gint *height);
|
||||
gboolean gst_video_get_size (GstPad * pad, gint * width, gint * height);
|
||||
|
||||
#endif /* __GST_VIDEO_H__ */
|
||||
|
|
|
@ -24,7 +24,8 @@
|
|||
#include <gst/gst.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
extern "C"
|
||||
{
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#define GST_TYPE_VIDEOSINK (gst_videosink_get_type())
|
||||
|
@ -47,7 +48,8 @@ extern "C" {
|
|||
typedef struct _GstVideoSink GstVideoSink;
|
||||
typedef struct _GstVideoSinkClass GstVideoSinkClass;
|
||||
|
||||
struct _GstVideoSink {
|
||||
struct _GstVideoSink
|
||||
{
|
||||
GstElement element;
|
||||
|
||||
GstPad *sinkpad;
|
||||
|
@ -59,7 +61,8 @@ struct _GstVideoSink {
|
|||
gpointer _gst_reserved[GST_PADDING];
|
||||
};
|
||||
|
||||
struct _GstVideoSinkClass {
|
||||
struct _GstVideoSinkClass
|
||||
{
|
||||
GstElementClass parent_class;
|
||||
|
||||
gpointer _gst_reserved[GST_PADDING];
|
||||
|
|
|
@ -25,7 +25,8 @@
|
|||
|
||||
#include "xoverlay.h"
|
||||
|
||||
enum {
|
||||
enum
|
||||
{
|
||||
HAVE_XWINDOW_ID,
|
||||
DESIRED_SIZE,
|
||||
LAST_SIGNAL
|
||||
|
@ -54,8 +55,7 @@ gst_x_overlay_get_type (void)
|
|||
};
|
||||
|
||||
gst_x_overlay_type = g_type_register_static (G_TYPE_INTERFACE,
|
||||
"GstXOverlay",
|
||||
&gst_x_overlay_info, 0);
|
||||
"GstXOverlay", &gst_x_overlay_info, 0);
|
||||
g_type_interface_add_prerequisite (gst_x_overlay_type,
|
||||
GST_TYPE_IMPLEMENTS_INTERFACE);
|
||||
}
|
||||
|
@ -64,8 +64,9 @@ gst_x_overlay_get_type (void)
|
|||
}
|
||||
|
||||
/* FIXME: evil hack, we should figure out our marshal handling in this interfaces some day */
|
||||
extern void gst_marshal_VOID__INT_INT (GClosure *closure, GValue *return_value, guint n_param_values,
|
||||
const GValue *param_values, gpointer invocation_hint, gpointer marshal_data);
|
||||
extern void gst_marshal_VOID__INT_INT (GClosure * closure,
|
||||
GValue * return_value, guint n_param_values, const GValue * param_values,
|
||||
gpointer invocation_hint, gpointer marshal_data);
|
||||
|
||||
static void
|
||||
gst_x_overlay_base_init (gpointer g_class)
|
||||
|
@ -73,22 +74,18 @@ gst_x_overlay_base_init (gpointer g_class)
|
|||
GstXOverlayClass *overlay_class = (GstXOverlayClass *) g_class;
|
||||
static gboolean initialized = FALSE;
|
||||
|
||||
if (! initialized)
|
||||
{
|
||||
if (!initialized) {
|
||||
gst_x_overlay_signals[HAVE_XWINDOW_ID] =
|
||||
g_signal_new ("have-xwindow-id",
|
||||
GST_TYPE_X_OVERLAY, G_SIGNAL_RUN_LAST,
|
||||
G_STRUCT_OFFSET (GstXOverlayClass, have_xwindow_id),
|
||||
NULL, NULL,
|
||||
g_cclosure_marshal_VOID__INT, G_TYPE_NONE, 1,
|
||||
G_TYPE_INT);
|
||||
NULL, NULL, g_cclosure_marshal_VOID__INT, G_TYPE_NONE, 1, G_TYPE_INT);
|
||||
gst_x_overlay_signals[DESIRED_SIZE] =
|
||||
g_signal_new ("desired-size-changed",
|
||||
GST_TYPE_X_OVERLAY, G_SIGNAL_RUN_LAST,
|
||||
G_STRUCT_OFFSET (GstXOverlayClass, desired_size),
|
||||
NULL, NULL,
|
||||
gst_marshal_VOID__INT_INT, G_TYPE_NONE, 2,
|
||||
G_TYPE_INT, G_TYPE_INT);
|
||||
gst_marshal_VOID__INT_INT, G_TYPE_NONE, 2, G_TYPE_INT, G_TYPE_INT);
|
||||
|
||||
initialized = TRUE;
|
||||
}
|
||||
|
@ -145,7 +142,8 @@ gst_x_overlay_got_xwindow_id (GstXOverlay *overlay, gulong xwindow_id)
|
|||
* size, width and height are set to 0.
|
||||
*/
|
||||
void
|
||||
gst_x_overlay_get_desired_size (GstXOverlay *overlay, guint *width, guint *height)
|
||||
gst_x_overlay_get_desired_size (GstXOverlay * overlay, guint * width,
|
||||
guint * height)
|
||||
{
|
||||
guint width_tmp, height_tmp;
|
||||
GstXOverlayClass *klass;
|
||||
|
@ -156,7 +154,8 @@ gst_x_overlay_get_desired_size (GstXOverlay *overlay, guint *width, guint *heigh
|
|||
if (klass->get_desired_size && GST_IS_X_OVERLAY (overlay)) {
|
||||
/* this ensures that elements don't need to check width and height for NULL
|
||||
but apps may use NULL */
|
||||
klass->get_desired_size (overlay, width ? width : &width_tmp, height ? height : &height_tmp);
|
||||
klass->get_desired_size (overlay, width ? width : &width_tmp,
|
||||
height ? height : &height_tmp);
|
||||
} else {
|
||||
if (width)
|
||||
*width = 0;
|
||||
|
@ -176,7 +175,8 @@ gst_x_overlay_get_desired_size (GstXOverlay *overlay, guint *width, guint *heigh
|
|||
* This function should be used by video overlay developpers.
|
||||
*/
|
||||
void
|
||||
gst_x_overlay_got_desired_size (GstXOverlay *overlay, guint width, guint height)
|
||||
gst_x_overlay_got_desired_size (GstXOverlay * overlay, guint width,
|
||||
guint height)
|
||||
{
|
||||
g_return_if_fail (GST_IS_X_OVERLAY (overlay));
|
||||
|
||||
|
|
|
@ -26,7 +26,6 @@
|
|||
#include <gst/gst.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define GST_TYPE_X_OVERLAY \
|
||||
(gst_x_overlay_get_type ())
|
||||
#define GST_X_OVERLAY(obj) \
|
||||
|
@ -40,27 +39,22 @@ G_BEGIN_DECLS
|
|||
(G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_X_OVERLAY))
|
||||
#define GST_X_OVERLAY_GET_CLASS(inst) \
|
||||
(G_TYPE_INSTANCE_GET_INTERFACE ((inst), GST_TYPE_X_OVERLAY, GstXOverlayClass))
|
||||
|
||||
typedef struct _GstXOverlay GstXOverlay;
|
||||
|
||||
typedef struct _GstXOverlayClass {
|
||||
typedef struct _GstXOverlayClass
|
||||
{
|
||||
GTypeInterface klass;
|
||||
|
||||
/* virtual functions */
|
||||
void (* set_xwindow_id) (GstXOverlay *overlay,
|
||||
gulong xwindow_id);
|
||||
void (*set_xwindow_id) (GstXOverlay * overlay, gulong xwindow_id);
|
||||
/* optional virtual functions */
|
||||
void (*get_desired_size) (GstXOverlay * overlay,
|
||||
guint *width,
|
||||
guint *height);
|
||||
guint * width, guint * height);
|
||||
void (*expose) (GstXOverlay * overlay);
|
||||
|
||||
/* signals */
|
||||
void (*have_xwindow_id) (GstXOverlay *overlay,
|
||||
gulong xwindow_id);
|
||||
void (* desired_size) (GstXOverlay *overlay,
|
||||
guint width,
|
||||
guint height);
|
||||
void (*have_xwindow_id) (GstXOverlay * overlay, gulong xwindow_id);
|
||||
void (*desired_size) (GstXOverlay * overlay, guint width, guint height);
|
||||
|
||||
gpointer _gst_reserved[GST_PADDING];
|
||||
} GstXOverlayClass;
|
||||
|
@ -69,13 +63,14 @@ GType gst_x_overlay_get_type (void);
|
|||
|
||||
/* virtual class function wrappers */
|
||||
void gst_x_overlay_set_xwindow_id (GstXOverlay * overlay, gulong xwindow_id);
|
||||
void gst_x_overlay_get_desired_size (GstXOverlay *overlay, guint *width, guint *height);
|
||||
void gst_x_overlay_get_desired_size (GstXOverlay * overlay, guint * width,
|
||||
guint * height);
|
||||
void gst_x_overlay_expose (GstXOverlay * overlay);
|
||||
|
||||
/* public methods to fire signals */
|
||||
void gst_x_overlay_got_xwindow_id (GstXOverlay * overlay, gulong xwindow_id);
|
||||
void gst_x_overlay_got_desired_size (GstXOverlay *overlay, guint width, guint height);
|
||||
void gst_x_overlay_got_desired_size (GstXOverlay * overlay, guint width,
|
||||
guint height);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GST_X_OVERLAY_H__ */
|
||||
|
|
|
@ -58,8 +58,7 @@ gst_x_window_listener_get_type (void)
|
|||
|
||||
x_window_listener_type =
|
||||
g_type_register_static (G_TYPE_OBJECT,
|
||||
"GstXWindowListener",
|
||||
&x_window_listener_info, 0);
|
||||
"GstXWindowListener", &x_window_listener_info, 0);
|
||||
}
|
||||
|
||||
return x_window_listener_type;
|
||||
|
@ -107,11 +106,9 @@ gst_x_window_listener_dispose (GObject *object)
|
|||
GstXWindowListener *
|
||||
gst_x_window_listener_new (gchar * display,
|
||||
MapWindowFunc map_window_func,
|
||||
SetWindowFunc set_window_func,
|
||||
gpointer private_data)
|
||||
SetWindowFunc set_window_func, gpointer private_data)
|
||||
{
|
||||
GstXWindowListener *xwin =
|
||||
g_object_new (GST_TYPE_X_WINDOW_LISTENER, NULL);
|
||||
GstXWindowListener *xwin = g_object_new (GST_TYPE_X_WINDOW_LISTENER, NULL);
|
||||
|
||||
xwin->display_name = g_strdup (display);
|
||||
xwin->map_window_func = map_window_func;
|
||||
|
@ -122,8 +119,7 @@ gst_x_window_listener_new (gchar *display,
|
|||
}
|
||||
|
||||
void
|
||||
gst_x_window_listener_set_xid (GstXWindowListener *xwin,
|
||||
XID id)
|
||||
gst_x_window_listener_set_xid (GstXWindowListener * xwin, XID id)
|
||||
{
|
||||
g_return_if_fail (xwin != NULL);
|
||||
|
||||
|
@ -137,9 +133,7 @@ gst_x_window_listener_set_xid (GstXWindowListener *xwin,
|
|||
|
||||
xwin->xwindow_id = id;
|
||||
|
||||
if (xwin->xwindow_id &&
|
||||
xwin->display_name &&
|
||||
xwin->display_name[0] == ':') {
|
||||
if (xwin->xwindow_id && xwin->display_name && xwin->display_name[0] == ':') {
|
||||
g_return_if_fail (xwin->map_window_func != NULL);
|
||||
g_return_if_fail (xwin->set_window_func != NULL);
|
||||
|
||||
|
@ -163,8 +157,7 @@ gst_x_window_listener_set_xid (GstXWindowListener *xwin,
|
|||
GST_DEBUG ("XWL: " format, ##args)
|
||||
|
||||
static void
|
||||
gst_xwin_set_overlay (GstXWindowListener *xwin,
|
||||
gboolean on)
|
||||
gst_xwin_set_overlay (GstXWindowListener * xwin, gboolean on)
|
||||
{
|
||||
xwin->map_window_func (xwin->private_data, on);
|
||||
|
||||
|
@ -193,8 +186,7 @@ gst_xwin_refresh (gpointer data)
|
|||
return FALSE; /* skip */
|
||||
}
|
||||
|
||||
if (xwin->ov_map &&
|
||||
xwin->ov_visibility != VisibilityFullyObscured) {
|
||||
if (xwin->ov_map && xwin->ov_visibility != VisibilityFullyObscured) {
|
||||
xwin->ov_refresh = TRUE;
|
||||
}
|
||||
|
||||
|
@ -204,8 +196,7 @@ gst_xwin_refresh (gpointer data)
|
|||
tmp = XCreateWindow (xwin->main_display, win, 0, 0,
|
||||
attr.width, attr.height, 0,
|
||||
CopyFromParent, InputOutput, CopyFromParent,
|
||||
(CWSaveUnder | CWBackingStore| CWOverrideRedirect ),
|
||||
&xswa);
|
||||
(CWSaveUnder | CWBackingStore | CWOverrideRedirect), &xswa);
|
||||
XMapWindow (xwin->main_display, tmp);
|
||||
XUnmapWindow (xwin->main_display, tmp);
|
||||
XDestroyWindow (xwin->main_display, tmp);
|
||||
|
@ -218,8 +209,7 @@ gst_xwin_refresh (gpointer data)
|
|||
}
|
||||
|
||||
static int
|
||||
x11_error_dev_null (Display *display,
|
||||
XErrorEvent *event)
|
||||
x11_error_dev_null (Display * display, XErrorEvent * event)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
@ -286,8 +276,7 @@ gst_xwin_set_clips (GstXWindowListener *xwin)
|
|||
y1 = attr.y - xwin->y;
|
||||
w1 = attr.width + 2 * attr.border_width;
|
||||
h1 = attr.height + 2 * attr.border_width;
|
||||
if (((x1 + w1) < 0) || (x1 > xwin->w) ||
|
||||
((y1 + h1) < 0) || (y1 > xwin->h))
|
||||
if (((x1 + w1) < 0) || (x1 > xwin->w) || ((y1 + h1) < 0) || (y1 > xwin->h))
|
||||
continue;
|
||||
|
||||
if (x1 < 0)
|
||||
|
@ -318,9 +307,7 @@ gst_xwin_window (GstXWindowListener *xwin)
|
|||
|
||||
if (xwin->ov_conf) {
|
||||
xwin->set_window_func (xwin->private_data,
|
||||
xwin->x, xwin->y,
|
||||
xwin->w, xwin->h,
|
||||
xwin->clips, xwin->num_clips);
|
||||
xwin->x, xwin->y, xwin->w, xwin->h, xwin->clips, xwin->num_clips);
|
||||
|
||||
if (!xwin->ov_visible)
|
||||
gst_xwin_set_overlay (xwin, TRUE);
|
||||
|
@ -330,8 +317,7 @@ gst_xwin_window (GstXWindowListener *xwin)
|
|||
if (xwin->ov_refresh_id)
|
||||
g_source_remove (xwin->ov_refresh_id);
|
||||
xwin->ov_refresh_id =
|
||||
g_timeout_add (200, (GSourceFunc) gst_xwin_refresh,
|
||||
(gpointer) xwin);
|
||||
g_timeout_add (200, (GSourceFunc) gst_xwin_refresh, (gpointer) xwin);
|
||||
|
||||
xwin->ov_conf = FALSE;
|
||||
|
||||
|
@ -347,8 +333,7 @@ gst_xwin_window (GstXWindowListener *xwin)
|
|||
if (xwin->ov_refresh_id)
|
||||
g_source_remove (xwin->ov_refresh_id);
|
||||
xwin->ov_refresh_id =
|
||||
g_timeout_add (200, (GSourceFunc) gst_xwin_refresh,
|
||||
(gpointer) xwin);
|
||||
g_timeout_add (200, (GSourceFunc) gst_xwin_refresh, (gpointer) xwin);
|
||||
|
||||
xwin->ov_conf = FALSE;
|
||||
|
||||
|
@ -370,8 +355,7 @@ gst_xwin_configure (GstXWindowListener *xwin)
|
|||
* in the main thread instead of here. */
|
||||
if (!xwin->ov_conf_id)
|
||||
xwin->ov_conf_id =
|
||||
g_idle_add ((GSourceFunc) gst_rec_xoverlay_window,
|
||||
(gpointer) xwin);
|
||||
g_idle_add ((GSourceFunc) gst_rec_xoverlay_window, (gpointer) xwin);
|
||||
#endif
|
||||
|
||||
gst_xwin_window ((gpointer) xwin);
|
||||
|
@ -384,10 +368,8 @@ gst_xwin_resize (GstXWindowListener *xwin)
|
|||
guint numkids;
|
||||
XWindowAttributes attr;
|
||||
|
||||
XGetWindowAttributes (xwin->display,
|
||||
xwin->xwindow_id, &attr);
|
||||
XMoveResizeWindow (xwin->display, xwin->child,
|
||||
0, 0, attr.width, attr.height);
|
||||
XGetWindowAttributes (xwin->display, xwin->xwindow_id, &attr);
|
||||
XMoveResizeWindow (xwin->display, xwin->child, 0, 0, attr.width, attr.height);
|
||||
|
||||
/* set the video window - the first clip is our own window */
|
||||
xwin->x = 0;
|
||||
|
@ -397,8 +379,7 @@ gst_xwin_resize (GstXWindowListener *xwin)
|
|||
|
||||
drawable = xwin->child;
|
||||
while (1) {
|
||||
XQueryTree (xwin->display, drawable,
|
||||
&root, &parent, &kids, &numkids);
|
||||
XQueryTree (xwin->display, drawable, &root, &parent, &kids, &numkids);
|
||||
if (numkids)
|
||||
XFree (kids);
|
||||
drawable = parent;
|
||||
|
@ -438,20 +419,16 @@ gst_xwin_init_window (GstXWindowListener *xwin)
|
|||
xwin->display = XOpenDisplay (xwin->display_name);
|
||||
|
||||
/* window */
|
||||
XGetWindowAttributes (xwin->display,
|
||||
xwin->xwindow_id, &attr);
|
||||
XGetWindowAttributes (xwin->display, xwin->xwindow_id, &attr);
|
||||
xwin->child = XCreateSimpleWindow (xwin->display,
|
||||
xwin->xwindow_id, 0, 0,
|
||||
attr.width, attr.height, 0, 0, 0);
|
||||
xwin->xwindow_id, 0, 0, attr.width, attr.height, 0, 0, 0);
|
||||
|
||||
/* listen to certain X events */
|
||||
XSelectInput (xwin->display, xwin->xwindow_id,
|
||||
StructureNotifyMask);
|
||||
XSelectInput (xwin->display, xwin->xwindow_id, StructureNotifyMask);
|
||||
XSelectInput (xwin->display, xwin->child,
|
||||
VisibilityChangeMask | StructureNotifyMask);
|
||||
XSelectInput (xwin->display, DefaultRootWindow (xwin->display),
|
||||
VisibilityChangeMask | StructureNotifyMask |
|
||||
SubstructureNotifyMask);
|
||||
VisibilityChangeMask | StructureNotifyMask | SubstructureNotifyMask);
|
||||
|
||||
/* show */
|
||||
XMapWindow (xwin->display, xwin->child);
|
||||
|
@ -561,8 +538,8 @@ gst_xwin_thread (gpointer data)
|
|||
if (!xwin->ov_refresh) {
|
||||
XWindowAttributes attr;
|
||||
gboolean on;
|
||||
XGetWindowAttributes (xwin->display,
|
||||
xwin->xwindow_id, &attr);
|
||||
|
||||
XGetWindowAttributes (xwin->display, xwin->xwindow_id, &attr);
|
||||
on = (attr.map_state == IsViewable);
|
||||
xwin->ov_wmmap = on;
|
||||
xwin->ov_conf = TRUE;
|
||||
|
@ -603,9 +580,7 @@ gst_xwin_start (GstXWindowListener *xwin)
|
|||
* event handler after we've stopped it */
|
||||
xwin->main_lock = g_mutex_new ();
|
||||
xwin->main_display = XOpenDisplay (xwin->display_name);
|
||||
xwin->thread = g_thread_create (gst_xwin_thread,
|
||||
(gpointer) xwin,
|
||||
TRUE, NULL);
|
||||
xwin->thread = g_thread_create (gst_xwin_thread, (gpointer) xwin, TRUE, NULL);
|
||||
|
||||
DEBUG ("Started X-overlay");
|
||||
}
|
||||
|
@ -642,14 +617,8 @@ plugin_init (GstPlugin *plugin)
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
GST_PLUGIN_DEFINE (
|
||||
GST_VERSION_MAJOR,
|
||||
GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
|
||||
GST_VERSION_MINOR,
|
||||
"xwindowlistener",
|
||||
"X11-based XWindow event/motion listener",
|
||||
plugin_init,
|
||||
VERSION,
|
||||
GST_LICENSE,
|
||||
GST_PACKAGE,
|
||||
GST_ORIGIN
|
||||
)
|
||||
plugin_init, VERSION, GST_LICENSE, GST_PACKAGE, GST_ORIGIN)
|
||||
|
|
|
@ -26,7 +26,6 @@
|
|||
#include <X11/Xlib.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define GST_TYPE_X_WINDOW_LISTENER \
|
||||
(gst_x_window_listener_get_type())
|
||||
#define GST_X_WINDOW_LISTENER(obj) \
|
||||
|
@ -39,27 +38,21 @@ G_BEGIN_DECLS
|
|||
(G_TYPE_CHECK_INSTANCE_TYPE((obj), GST_TYPE_X_WINDOW_LISTENER))
|
||||
#define GST_IS_X_WINDOW_LISTENER_CLASS(obj) \
|
||||
(G_TYPE_CHECK_CLASS_TYPE((klass), GST_TYPE_X_WINDOW_LISTENER))
|
||||
|
||||
typedef struct _GstXWindowListener GstXWindowListener;
|
||||
typedef struct _GstXWindowListenerClass GstXWindowListenerClass;
|
||||
typedef struct _GstXWindowClip GstXWindowClip;
|
||||
typedef void (* MapWindowFunc) (gpointer your_data,
|
||||
gboolean visible);
|
||||
typedef void (*MapWindowFunc) (gpointer your_data, gboolean visible);
|
||||
typedef void (*SetWindowFunc) (gpointer your_data,
|
||||
gint x, gint y,
|
||||
gint w, gint h,
|
||||
GstXWindowClip *clips,
|
||||
gint num_clips);
|
||||
gint x, gint y, gint w, gint h, GstXWindowClip * clips, gint num_clips);
|
||||
|
||||
struct _GstXWindowClip {
|
||||
gint32 x_offset,
|
||||
y_offset,
|
||||
width,
|
||||
height;
|
||||
struct _GstXWindowClip
|
||||
{
|
||||
gint32 x_offset, y_offset, width, height;
|
||||
gpointer data;
|
||||
};
|
||||
|
||||
struct _GstXWindowListener {
|
||||
struct _GstXWindowListener
|
||||
{
|
||||
GObject parent;
|
||||
|
||||
/* "per-instance virtual functions" */
|
||||
|
@ -84,33 +77,24 @@ struct _GstXWindowListener {
|
|||
/* the overlay window + own thread */
|
||||
Display *display;
|
||||
Drawable child;
|
||||
gboolean ov_conf,
|
||||
ov_map,
|
||||
ov_visible,
|
||||
ov_refresh,
|
||||
ov_move,
|
||||
ov_wmmap;
|
||||
gboolean ov_conf, ov_map, ov_visible, ov_refresh, ov_move, ov_wmmap;
|
||||
gint ov_visibility;
|
||||
guint ov_conf_id,
|
||||
ov_refresh_id;
|
||||
guint ov_conf_id, ov_refresh_id;
|
||||
gint x, y, w, h;
|
||||
GstXWindowClip *clips;
|
||||
gint num_clips;
|
||||
};
|
||||
|
||||
struct _GstXWindowListenerClass {
|
||||
struct _GstXWindowListenerClass
|
||||
{
|
||||
GObjectClass parent;
|
||||
};
|
||||
|
||||
GType gst_x_window_listener_get_type (void);
|
||||
GstXWindowListener *
|
||||
gst_x_window_listener_new (gchar *display,
|
||||
GstXWindowListener *gst_x_window_listener_new (gchar * display,
|
||||
MapWindowFunc map_window_func,
|
||||
SetWindowFunc set_window_func,
|
||||
gpointer private_data);
|
||||
void gst_x_window_listener_set_xid (GstXWindowListener *xwin,
|
||||
XID id);
|
||||
SetWindowFunc set_window_func, gpointer private_data);
|
||||
void gst_x_window_listener_set_xid (GstXWindowListener * xwin, XID id);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __X_WINDOW_LISTENER_H__ */
|
||||
|
|
|
@ -28,7 +28,8 @@
|
|||
#include <gstac3parse.h>
|
||||
|
||||
/* struct and table stolen from ac3dec by Aaron Holtzman */
|
||||
struct frmsize_s {
|
||||
struct frmsize_s
|
||||
{
|
||||
guint16 bit_rate;
|
||||
guint16 frm_size[3];
|
||||
};
|
||||
|
@ -71,43 +72,39 @@ static struct frmsize_s frmsizecod_tbl[] = {
|
|||
{576, {1152, 1253, 1728}},
|
||||
{576, {1152, 1254, 1728}},
|
||||
{640, {1280, 1393, 1920}},
|
||||
{ 640 ,{1280 ,1394 ,1920 } }};
|
||||
{640, {1280, 1394, 1920}}
|
||||
};
|
||||
|
||||
/* elementfactory information */
|
||||
static GstElementDetails ac3parse_details = GST_ELEMENT_DETAILS (
|
||||
"AC3 Parser",
|
||||
static GstElementDetails ac3parse_details = GST_ELEMENT_DETAILS ("AC3 Parser",
|
||||
"Codec/Parser/Audio",
|
||||
"Parses and frames AC3 audio streams, provides seek",
|
||||
"Erik Walthinsen <omega@cse.ogi.edu>"
|
||||
);
|
||||
"Erik Walthinsen <omega@cse.ogi.edu>");
|
||||
|
||||
/* GstAc3Parse signals and args */
|
||||
enum {
|
||||
enum
|
||||
{
|
||||
/* FILL ME */
|
||||
LAST_SIGNAL
|
||||
};
|
||||
|
||||
enum {
|
||||
enum
|
||||
{
|
||||
ARG_0,
|
||||
ARG_SKIP,
|
||||
/* FILL ME */
|
||||
};
|
||||
|
||||
static GstStaticPadTemplate gst_ac3parse_src_template =
|
||||
GST_STATIC_PAD_TEMPLATE (
|
||||
"src",
|
||||
GST_STATIC_PAD_TEMPLATE ("src",
|
||||
GST_PAD_SRC,
|
||||
GST_PAD_ALWAYS,
|
||||
GST_STATIC_CAPS (
|
||||
"audio/ac3, "
|
||||
"channels = (int) [ 1, 6 ], "
|
||||
"rate = (int) [ 32000, 48000 ]"
|
||||
)
|
||||
GST_STATIC_CAPS ("audio/ac3, "
|
||||
"channels = (int) [ 1, 6 ], " "rate = (int) [ 32000, 48000 ]")
|
||||
);
|
||||
|
||||
static GstStaticPadTemplate gst_ac3parse_sink_template =
|
||||
GST_STATIC_PAD_TEMPLATE (
|
||||
"sink",
|
||||
GST_STATIC_PAD_TEMPLATE ("sink",
|
||||
GST_PAD_SINK,
|
||||
GST_PAD_ALWAYS,
|
||||
GST_STATIC_CAPS ("audio/x-ac3")
|
||||
|
@ -116,22 +113,17 @@ GST_STATIC_PAD_TEMPLATE (
|
|||
static void gst_ac3parse_class_init (gpointer g_class);
|
||||
static void gst_ac3parse_init (GstAc3Parse * ac3parse);
|
||||
|
||||
static void gst_ac3parse_chain (GstPad *pad,
|
||||
GstData *data);
|
||||
static void gst_ac3parse_chain (GstPad * pad, GstData * data);
|
||||
|
||||
static void gst_ac3parse_set_property (GObject * object,
|
||||
guint prop_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec);
|
||||
guint prop_id, const GValue * value, GParamSpec * pspec);
|
||||
static void gst_ac3parse_get_property (GObject * object,
|
||||
guint prop_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec);
|
||||
guint prop_id, GValue * value, GParamSpec * pspec);
|
||||
|
||||
static GstElementStateReturn
|
||||
gst_ac3parse_change_state (GstElement *element);
|
||||
static GstElementStateReturn gst_ac3parse_change_state (GstElement * element);
|
||||
|
||||
static GstElementClass *parent_class = NULL;
|
||||
|
||||
/*static guint gst_ac3parse_signals[LAST_SIGNAL] = { 0 };*/
|
||||
|
||||
GType
|
||||
|
@ -150,7 +142,9 @@ ac3parse_get_type (void)
|
|||
0,
|
||||
(GInstanceInitFunc) gst_ac3parse_init,
|
||||
};
|
||||
ac3parse_type = g_type_register_static(GST_TYPE_ELEMENT, "GstAc3Parse", &ac3parse_info, 0);
|
||||
ac3parse_type =
|
||||
g_type_register_static (GST_TYPE_ELEMENT, "GstAc3Parse", &ac3parse_info,
|
||||
0);
|
||||
}
|
||||
return ac3parse_type;
|
||||
}
|
||||
|
@ -170,12 +164,9 @@ gst_ac3parse_class_init (gpointer g_class)
|
|||
gst_static_pad_template_get (&gst_ac3parse_src_template));
|
||||
gst_element_class_add_pad_template (gstelement_class,
|
||||
gst_static_pad_template_get (&gst_ac3parse_sink_template));
|
||||
gst_element_class_set_details (gstelement_class,
|
||||
&ac3parse_details);
|
||||
gst_element_class_set_details (gstelement_class, &ac3parse_details);
|
||||
|
||||
g_object_class_install_property(G_OBJECT_CLASS(klass), ARG_SKIP,
|
||||
g_param_spec_int("skip","skip","skip",
|
||||
G_MININT,G_MAXINT,0,G_PARAM_READWRITE)); /* CHECKME */
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_SKIP, g_param_spec_int ("skip", "skip", "skip", G_MININT, G_MAXINT, 0, G_PARAM_READWRITE)); /* CHECKME */
|
||||
|
||||
parent_class = g_type_class_ref (GST_TYPE_ELEMENT);
|
||||
|
||||
|
@ -188,13 +179,15 @@ gst_ac3parse_class_init (gpointer g_class)
|
|||
static void
|
||||
gst_ac3parse_init (GstAc3Parse * ac3parse)
|
||||
{
|
||||
ac3parse->sinkpad = gst_pad_new_from_template (
|
||||
gst_static_pad_template_get (&gst_ac3parse_sink_template), "sink");
|
||||
ac3parse->sinkpad =
|
||||
gst_pad_new_from_template (gst_static_pad_template_get
|
||||
(&gst_ac3parse_sink_template), "sink");
|
||||
gst_element_add_pad (GST_ELEMENT (ac3parse), ac3parse->sinkpad);
|
||||
gst_pad_set_chain_function (ac3parse->sinkpad, gst_ac3parse_chain);
|
||||
|
||||
ac3parse->srcpad = gst_pad_new_from_template (
|
||||
gst_static_pad_template_get (&gst_ac3parse_src_template), "src");
|
||||
ac3parse->srcpad =
|
||||
gst_pad_new_from_template (gst_static_pad_template_get
|
||||
(&gst_ac3parse_src_template), "src");
|
||||
gst_pad_use_explicit_caps (ac3parse->srcpad);
|
||||
gst_element_add_pad (GST_ELEMENT (ac3parse), ac3parse->srcpad);
|
||||
|
||||
|
@ -228,12 +221,12 @@ gst_ac3parse_chain (GstPad *pad, GstData *_data)
|
|||
/* deal with partial frame from previous buffer */
|
||||
if (ac3parse->partialbuf) {
|
||||
GstBuffer *merge;
|
||||
|
||||
merge = gst_buffer_merge (ac3parse->partialbuf, buf);
|
||||
gst_buffer_unref (buf);
|
||||
gst_buffer_unref (ac3parse->partialbuf);
|
||||
ac3parse->partialbuf = merge;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
ac3parse->partialbuf = buf;
|
||||
}
|
||||
|
||||
|
@ -253,9 +246,11 @@ gst_ac3parse_chain (GstPad *pad, GstData *_data)
|
|||
GST_DEBUG ("ac3parse: offset %ld, size %ld ", offset, size);
|
||||
|
||||
/* search for a possible start byte */
|
||||
for (;((data[offset] != 0x0b) && (offset < size-6));offset++) skipped++ ;
|
||||
for (; ((data[offset] != 0x0b) && (offset < size - 6)); offset++)
|
||||
skipped++;
|
||||
if (skipped) {
|
||||
fprintf(stderr, "ac3parse: **** now at %ld skipped %d bytes (FIXME?)\n",offset,skipped);
|
||||
fprintf (stderr, "ac3parse: **** now at %ld skipped %d bytes (FIXME?)\n",
|
||||
offset, skipped);
|
||||
}
|
||||
/* construct the header word */
|
||||
header = GUINT16_TO_BE (*((guint16 *) (data + offset)));
|
||||
|
@ -263,6 +258,7 @@ gst_ac3parse_chain (GstPad *pad, GstData *_data)
|
|||
/* if it's a valid header, go ahead and send off the frame */
|
||||
if (header == 0x0b77) {
|
||||
gint rate, fsize;
|
||||
|
||||
/* g_print("AC3PARSE: found sync at %d\n",offset); */
|
||||
/* get the bits we're interested in */
|
||||
rate = (data[offset + 4] >> 6) & 0x3;
|
||||
|
@ -323,7 +319,8 @@ gst_ac3parse_chain (GstPad *pad, GstData *_data)
|
|||
channels++;
|
||||
/* if we don't have the whole frame... */
|
||||
if ((size - offset) < bpf) {
|
||||
GST_DEBUG ("ac3parse: partial buffer needed %ld < %d ",size-offset, bpf);
|
||||
GST_DEBUG ("ac3parse: partial buffer needed %ld < %d ", size - offset,
|
||||
bpf);
|
||||
break;
|
||||
} else {
|
||||
gboolean need_capsnego = FALSE;
|
||||
|
@ -341,6 +338,7 @@ gst_ac3parse_chain (GstPad *pad, GstData *_data)
|
|||
}
|
||||
if (need_capsnego) {
|
||||
GstCaps *newcaps;
|
||||
|
||||
newcaps = gst_caps_new_simple ("audio/x-ac3",
|
||||
"channels", G_TYPE_INT, channels,
|
||||
"rate", G_TYPE_INT, sample_rate, NULL);
|
||||
|
@ -349,11 +347,12 @@ gst_ac3parse_chain (GstPad *pad, GstData *_data)
|
|||
|
||||
offset += bpf;
|
||||
if (ac3parse->skip == 0 && GST_PAD_IS_LINKED (ac3parse->srcpad)) {
|
||||
GST_DEBUG ("ac3parse: pushing buffer of %d bytes",GST_BUFFER_SIZE(outbuf));
|
||||
GST_DEBUG ("ac3parse: pushing buffer of %d bytes",
|
||||
GST_BUFFER_SIZE (outbuf));
|
||||
gst_pad_push (ac3parse->srcpad, GST_DATA (outbuf));
|
||||
}
|
||||
else {
|
||||
GST_DEBUG ("ac3parse: skipping buffer of %d bytes",GST_BUFFER_SIZE(outbuf));
|
||||
} else {
|
||||
GST_DEBUG ("ac3parse: skipping buffer of %d bytes",
|
||||
GST_BUFFER_SIZE (outbuf));
|
||||
gst_buffer_unref (outbuf);
|
||||
ac3parse->skip--;
|
||||
}
|
||||
|
@ -367,7 +366,9 @@ gst_ac3parse_chain (GstPad *pad, GstData *_data)
|
|||
/* bytes left not in a partial block, copy them over. */
|
||||
if (size - offset > 0) {
|
||||
gint remainder = (size - offset);
|
||||
GST_DEBUG ("ac3parse: partial buffer needed %d for trailing bytes",remainder);
|
||||
|
||||
GST_DEBUG ("ac3parse: partial buffer needed %d for trailing bytes",
|
||||
remainder);
|
||||
|
||||
outbuf = gst_buffer_create_sub (ac3parse->partialbuf, offset, remainder);
|
||||
gst_buffer_unref (ac3parse->partialbuf);
|
||||
|
@ -376,7 +377,8 @@ gst_ac3parse_chain (GstPad *pad, GstData *_data)
|
|||
}
|
||||
|
||||
static void
|
||||
gst_ac3parse_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec)
|
||||
gst_ac3parse_set_property (GObject * object, guint prop_id,
|
||||
const GValue * value, GParamSpec * pspec)
|
||||
{
|
||||
GstAc3Parse *src;
|
||||
|
||||
|
@ -394,7 +396,8 @@ gst_ac3parse_set_property (GObject *object, guint prop_id, const GValue *value,
|
|||
}
|
||||
|
||||
static void
|
||||
gst_ac3parse_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
|
||||
gst_ac3parse_get_property (GObject * object, guint prop_id, GValue * value,
|
||||
GParamSpec * pspec)
|
||||
{
|
||||
GstAc3Parse *src;
|
||||
|
||||
|
@ -440,15 +443,7 @@ plugin_init (GstPlugin *plugin)
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
GST_PLUGIN_DEFINE(
|
||||
GST_VERSION_MAJOR,
|
||||
GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
|
||||
GST_VERSION_MINOR,
|
||||
"ac3parse",
|
||||
"ac3 parsing",
|
||||
plugin_init,
|
||||
VERSION,
|
||||
"LGPL",
|
||||
GST_PACKAGE,
|
||||
GST_ORIGIN
|
||||
)
|
||||
|
||||
"ac3 parsing", plugin_init, VERSION, "LGPL", GST_PACKAGE, GST_ORIGIN)
|
||||
|
|
|
@ -26,7 +26,8 @@
|
|||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
extern "C"
|
||||
{
|
||||
#endif /* __cplusplus */
|
||||
|
||||
|
||||
|
@ -44,7 +45,8 @@ extern "C" {
|
|||
typedef struct _GstAc3Parse GstAc3Parse;
|
||||
typedef struct _GstAc3ParseClass GstAc3ParseClass;
|
||||
|
||||
struct _GstAc3Parse {
|
||||
struct _GstAc3Parse
|
||||
{
|
||||
GstElement element;
|
||||
|
||||
GstPad *sinkpad, *srcpad;
|
||||
|
@ -59,7 +61,8 @@ struct _GstAc3Parse {
|
|||
gint channels;
|
||||
};
|
||||
|
||||
struct _GstAc3ParseClass {
|
||||
struct _GstAc3ParseClass
|
||||
{
|
||||
GstElementClass parent_class;
|
||||
};
|
||||
|
||||
|
|
|
@ -20,7 +20,8 @@
|
|||
#ifndef ASFHEADERS_H
|
||||
#define ASFHEADERS_H
|
||||
|
||||
typedef struct {
|
||||
typedef struct
|
||||
{
|
||||
guint32 v1;
|
||||
guint32 v2;
|
||||
guint32 v3;
|
||||
|
@ -29,12 +30,14 @@ typedef struct {
|
|||
|
||||
|
||||
|
||||
typedef struct {
|
||||
typedef struct
|
||||
{
|
||||
guint8 obj_id;
|
||||
ASFGuid guid;
|
||||
} ASFGuidHash;
|
||||
|
||||
enum {
|
||||
enum
|
||||
{
|
||||
ASF_OBJ_UNDEFINED = 0,
|
||||
ASF_OBJ_STREAM,
|
||||
ASF_OBJ_DATA,
|
||||
|
@ -53,13 +56,15 @@ enum {
|
|||
ASF_OBJ_BITRATE_MUTEX,
|
||||
};
|
||||
|
||||
enum {
|
||||
enum
|
||||
{
|
||||
ASF_STREAM_UNDEFINED = 0,
|
||||
ASF_STREAM_VIDEO,
|
||||
ASF_STREAM_AUDIO,
|
||||
};
|
||||
|
||||
enum {
|
||||
enum
|
||||
{
|
||||
ASF_CORRECTION_UNDEFINED = 0,
|
||||
ASF_CORRECTION_ON,
|
||||
ASF_CORRECTION_OFF,
|
||||
|
@ -78,7 +83,8 @@ static ASFGuidHash asf_stream_guids[] = {
|
|||
{ASF_STREAM_UNDEFINED, {0, 0, 0, 0}},
|
||||
};
|
||||
|
||||
struct _asf_obj_header {
|
||||
struct _asf_obj_header
|
||||
{
|
||||
guint32 num_objects;
|
||||
guint8 unknown1;
|
||||
guint8 unknown2;
|
||||
|
@ -86,7 +92,8 @@ struct _asf_obj_header {
|
|||
|
||||
typedef struct _asf_obj_header asf_obj_header;
|
||||
|
||||
struct _asf_obj_comment {
|
||||
struct _asf_obj_comment
|
||||
{
|
||||
guint16 title_length;
|
||||
guint16 author_length;
|
||||
guint16 copyright_length;
|
||||
|
@ -96,7 +103,8 @@ struct _asf_obj_comment {
|
|||
|
||||
typedef struct _asf_obj_comment asf_obj_comment;
|
||||
|
||||
struct _asf_obj_file {
|
||||
struct _asf_obj_file
|
||||
{
|
||||
ASFGuid file_id;
|
||||
guint64 file_size;
|
||||
guint64 creation_time;
|
||||
|
@ -112,7 +120,8 @@ struct _asf_obj_file {
|
|||
|
||||
typedef struct _asf_obj_file asf_obj_file;
|
||||
|
||||
struct _asf_obj_stream {
|
||||
struct _asf_obj_stream
|
||||
{
|
||||
ASFGuid type;
|
||||
ASFGuid correction;
|
||||
guint64 unknown1;
|
||||
|
@ -124,7 +133,8 @@ struct _asf_obj_stream {
|
|||
|
||||
typedef struct _asf_obj_stream asf_obj_stream;
|
||||
|
||||
struct _asf_stream_audio {
|
||||
struct _asf_stream_audio
|
||||
{
|
||||
guint16 codec_tag;
|
||||
guint16 channels;
|
||||
guint32 sample_rate;
|
||||
|
@ -136,7 +146,8 @@ struct _asf_stream_audio {
|
|||
|
||||
typedef struct _asf_stream_audio asf_stream_audio;
|
||||
|
||||
struct _asf_stream_correction {
|
||||
struct _asf_stream_correction
|
||||
{
|
||||
guint8 span;
|
||||
guint16 packet_size;
|
||||
guint16 chunk_size;
|
||||
|
@ -146,7 +157,8 @@ struct _asf_stream_correction {
|
|||
|
||||
typedef struct _asf_stream_correction asf_stream_correction;
|
||||
|
||||
struct _asf_stream_video {
|
||||
struct _asf_stream_video
|
||||
{
|
||||
guint32 width;
|
||||
guint32 height;
|
||||
guint8 unknown;
|
||||
|
@ -155,7 +167,8 @@ struct _asf_stream_video {
|
|||
|
||||
typedef struct _asf_stream_video asf_stream_video;
|
||||
|
||||
struct _asf_stream_video_format {
|
||||
struct _asf_stream_video_format
|
||||
{
|
||||
guint32 size;
|
||||
guint32 width;
|
||||
guint32 height;
|
||||
|
@ -171,7 +184,8 @@ struct _asf_stream_video_format {
|
|||
|
||||
typedef struct _asf_stream_video_format asf_stream_video_format;
|
||||
|
||||
struct _asf_obj_data {
|
||||
struct _asf_obj_data
|
||||
{
|
||||
ASFGuid file_id;
|
||||
guint64 packets;
|
||||
guint8 unknown1;
|
||||
|
@ -181,21 +195,24 @@ struct _asf_obj_data {
|
|||
|
||||
typedef struct _asf_obj_data asf_obj_data;
|
||||
|
||||
struct _asf_obj_data_correction {
|
||||
struct _asf_obj_data_correction
|
||||
{
|
||||
guint8 type;
|
||||
guint8 cycle;
|
||||
};
|
||||
|
||||
typedef struct _asf_obj_data_correction asf_obj_data_correction;
|
||||
|
||||
struct _asf_obj_data_packet {
|
||||
struct _asf_obj_data_packet
|
||||
{
|
||||
guint8 flags;
|
||||
guint8 property;
|
||||
};
|
||||
|
||||
typedef struct _asf_obj_data_packet asf_obj_data_packet;
|
||||
|
||||
struct _asf_packet_info {
|
||||
struct _asf_packet_info
|
||||
{
|
||||
guint32 padsize;
|
||||
guint8 replicsizetype;
|
||||
guint8 fragoffsettype;
|
||||
|
@ -207,7 +224,8 @@ struct _asf_packet_info {
|
|||
|
||||
typedef struct _asf_packet_info asf_packet_info;
|
||||
|
||||
struct _asf_segment_info {
|
||||
struct _asf_segment_info
|
||||
{
|
||||
guint8 stream_number;
|
||||
guint32 chunk_size;
|
||||
guint32 frag_offset;
|
||||
|
@ -219,14 +237,16 @@ struct _asf_segment_info {
|
|||
|
||||
typedef struct _asf_segment_info asf_segment_info;
|
||||
|
||||
struct _asf_replicated_data {
|
||||
struct _asf_replicated_data
|
||||
{
|
||||
guint32 object_size;
|
||||
guint32 frag_timestamp;
|
||||
};
|
||||
|
||||
typedef struct _asf_replicated_data asf_replicated_data;
|
||||
|
||||
struct _asf_bitrate_record {
|
||||
struct _asf_bitrate_record
|
||||
{
|
||||
guint16 stream_id;
|
||||
guint32 bitrate;
|
||||
};
|
||||
|
|
|
@ -35,8 +35,7 @@ static GstElementDetails gst_asf_demux_details = {
|
|||
};
|
||||
|
||||
static GstStaticPadTemplate gst_asf_demux_sink_template =
|
||||
GST_STATIC_PAD_TEMPLATE (
|
||||
"sink",
|
||||
GST_STATIC_PAD_TEMPLATE ("sink",
|
||||
GST_PAD_SINK,
|
||||
GST_PAD_ALWAYS,
|
||||
GST_STATIC_CAPS ("video/x-ms-asf")
|
||||
|
@ -53,45 +52,31 @@ static gboolean gst_asf_demux_send_event (GstElement *element,
|
|||
static void gst_asf_demux_loop (GstElement * element);
|
||||
static gboolean gst_asf_demux_process_object (GstASFDemux * asf_demux);
|
||||
static void gst_asf_demux_get_property (GObject * object,
|
||||
guint prop_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec);
|
||||
guint prop_id, GValue * value, GParamSpec * pspec);
|
||||
static guint32 gst_asf_demux_identify_guid (GstASFDemux * asf_demux,
|
||||
ASFGuidHash *guids,
|
||||
ASFGuid *guid_raw);
|
||||
ASFGuidHash * guids, ASFGuid * guid_raw);
|
||||
static gboolean gst_asf_demux_process_chunk (GstASFDemux * asf_demux,
|
||||
asf_packet_info *packet_info,
|
||||
asf_segment_info *segment_info);
|
||||
asf_packet_info * packet_info, asf_segment_info * segment_info);
|
||||
static const GstEventMask *gst_asf_demux_get_src_event_mask (GstPad * pad);
|
||||
static gboolean gst_asf_demux_handle_sink_event (GstASFDemux * asf_demux,
|
||||
GstEvent *event,
|
||||
guint32 remaining);
|
||||
static gboolean gst_asf_demux_handle_src_event (GstPad *pad,
|
||||
GstEvent *event);
|
||||
GstEvent * event, guint32 remaining);
|
||||
static gboolean gst_asf_demux_handle_src_event (GstPad * pad, GstEvent * event);
|
||||
static const GstFormat *gst_asf_demux_get_src_formats (GstPad * pad);
|
||||
static const GstQueryType *gst_asf_demux_get_src_query_types (GstPad * pad);
|
||||
static gboolean gst_asf_demux_handle_src_query (GstPad * pad,
|
||||
GstQueryType type,
|
||||
GstFormat *format, gint64 *value);
|
||||
GstQueryType type, GstFormat * format, gint64 * value);
|
||||
static gboolean gst_asf_demux_add_video_stream (GstASFDemux * asf_demux,
|
||||
asf_stream_video_format *video_format,
|
||||
guint16 id);
|
||||
asf_stream_video_format * video_format, guint16 id);
|
||||
static gboolean gst_asf_demux_add_audio_stream (GstASFDemux * asf_demux,
|
||||
asf_stream_audio *audio,
|
||||
guint16 id);
|
||||
asf_stream_audio * audio, guint16 id);
|
||||
static gboolean gst_asf_demux_setup_pad (GstASFDemux * asf_demux,
|
||||
GstPad *src_pad,
|
||||
GstCaps *caps,
|
||||
guint16 id);
|
||||
GstPad * src_pad, GstCaps * caps, guint16 id);
|
||||
|
||||
static GstElementStateReturn gst_asf_demux_change_state (GstElement * element);
|
||||
static GstCaps *gst_asf_demux_video_caps (guint32 codec_fcc,
|
||||
asf_stream_video_format *video,
|
||||
char **codec_name);
|
||||
asf_stream_video_format * video, char **codec_name);
|
||||
static GstCaps *gst_asf_demux_audio_caps (guint16 codec_id,
|
||||
asf_stream_audio *audio,
|
||||
guint8 *extradata,
|
||||
char **codec_name);
|
||||
asf_stream_audio * audio, guint8 * extradata, char **codec_name);
|
||||
|
||||
static GstPadTemplate *videosrctempl, *audiosrctempl;
|
||||
static GstElementClass *parent_class = NULL;
|
||||
|
@ -113,7 +98,9 @@ asf_demux_get_type (void)
|
|||
0,
|
||||
(GInstanceInitFunc) gst_asf_demux_init,
|
||||
};
|
||||
asf_demux_type = g_type_register_static(GST_TYPE_ELEMENT, "GstASFDemux", &asf_demux_info, 0);
|
||||
asf_demux_type =
|
||||
g_type_register_static (GST_TYPE_ELEMENT, "GstASFDemux",
|
||||
&asf_demux_info, 0);
|
||||
}
|
||||
return asf_demux_type;
|
||||
}
|
||||
|
@ -157,9 +144,7 @@ gst_asf_demux_base_init (gpointer g_class)
|
|||
}
|
||||
|
||||
audiosrctempl = gst_pad_template_new ("audio_%02d",
|
||||
GST_PAD_SRC,
|
||||
GST_PAD_SOMETIMES,
|
||||
audcaps);
|
||||
GST_PAD_SRC, GST_PAD_SOMETIMES, audcaps);
|
||||
|
||||
vidcaps = gst_caps_new_empty ();
|
||||
for (i = 0; vid_list[i] != 0; i++) {
|
||||
|
@ -168,9 +153,7 @@ gst_asf_demux_base_init (gpointer g_class)
|
|||
}
|
||||
|
||||
videosrctempl = gst_pad_template_new ("video_%02d",
|
||||
GST_PAD_SRC,
|
||||
GST_PAD_SOMETIMES,
|
||||
vidcaps);
|
||||
GST_PAD_SRC, GST_PAD_SOMETIMES, vidcaps);
|
||||
gst_element_class_add_pad_template (element_class, audiosrctempl);
|
||||
gst_element_class_add_pad_template (element_class, videosrctempl);
|
||||
gst_element_class_add_pad_template (element_class,
|
||||
|
@ -200,8 +183,9 @@ gst_asf_demux_init (GstASFDemux *asf_demux)
|
|||
{
|
||||
guint i;
|
||||
|
||||
asf_demux->sinkpad = gst_pad_new_from_template(
|
||||
gst_static_pad_template_get (&gst_asf_demux_sink_template), "sink");
|
||||
asf_demux->sinkpad =
|
||||
gst_pad_new_from_template (gst_static_pad_template_get
|
||||
(&gst_asf_demux_sink_template), "sink");
|
||||
gst_element_add_pad (GST_ELEMENT (asf_demux), asf_demux->sinkpad);
|
||||
|
||||
gst_element_set_loop_function (GST_ELEMENT (asf_demux), gst_asf_demux_loop);
|
||||
|
@ -265,7 +249,8 @@ gst_asf_demux_loop (GstElement *element)
|
|||
gst_asf_demux_process_object (asf_demux);
|
||||
}
|
||||
|
||||
static guint32 _read_var_length (GstASFDemux *asf_demux, guint8 type, guint32 *rsize)
|
||||
static guint32
|
||||
_read_var_length (GstASFDemux * asf_demux, guint8 type, guint32 * rsize)
|
||||
{
|
||||
guint32 got_bytes;
|
||||
guint8 *var;
|
||||
|
@ -338,11 +323,8 @@ READ_UINT_BITS_FUNCTION (8)
|
|||
READ_UINT_BITS_FUNCTION (16)
|
||||
READ_UINT_BITS_FUNCTION (32)
|
||||
READ_UINT_BITS_FUNCTION (64)
|
||||
|
||||
#define GET_UINT(a,b)
|
||||
|
||||
static gboolean
|
||||
_read_guid (GstASFDemux *asf_demux, ASFGuid *guid)
|
||||
static gboolean _read_guid (GstASFDemux * asf_demux, ASFGuid * guid)
|
||||
{
|
||||
return (_read_uint32 (asf_demux, &guid->v1) &&
|
||||
_read_uint32 (asf_demux, &guid->v2) &&
|
||||
|
@ -421,7 +403,8 @@ _read_obj_data (GstASFDemux *asf_demux, asf_obj_data *object)
|
|||
}
|
||||
|
||||
static gboolean
|
||||
_read_obj_data_correction (GstASFDemux *asf_demux, asf_obj_data_correction *object)
|
||||
_read_obj_data_correction (GstASFDemux * asf_demux,
|
||||
asf_obj_data_correction * object)
|
||||
{
|
||||
return (_read_uint8 (asf_demux, &object->type) &&
|
||||
_read_uint8 (asf_demux, &object->cycle));
|
||||
|
@ -447,7 +430,8 @@ _read_stream_audio (GstASFDemux *asf_demux, asf_stream_audio *audio)
|
|||
}
|
||||
|
||||
static gboolean
|
||||
_read_stream_correction (GstASFDemux *asf_demux, asf_stream_correction *object)
|
||||
_read_stream_correction (GstASFDemux * asf_demux,
|
||||
asf_stream_correction * object)
|
||||
{
|
||||
return (_read_uint8 (asf_demux, &object->span) &&
|
||||
_read_uint16 (asf_demux, &object->packet_size) &&
|
||||
|
@ -466,7 +450,8 @@ _read_stream_video (GstASFDemux *asf_demux, asf_stream_video *video)
|
|||
}
|
||||
|
||||
static gboolean
|
||||
_read_stream_video_format (GstASFDemux *asf_demux, asf_stream_video_format *fmt)
|
||||
_read_stream_video_format (GstASFDemux * asf_demux,
|
||||
asf_stream_video_format * fmt)
|
||||
{
|
||||
return (_read_uint32 (asf_demux, &fmt->size) &&
|
||||
_read_uint32 (asf_demux, &fmt->width) &&
|
||||
|
@ -498,13 +483,15 @@ gst_asf_demux_process_file (GstASFDemux *asf_demux, guint64 *obj_size)
|
|||
asf_demux->play_time = (guint32) object.play_time / 10;
|
||||
asf_demux->preroll = object.preroll;
|
||||
|
||||
GST_INFO ( "Object is a file with %" G_GUINT64_FORMAT " data packets", object.packets_count);
|
||||
GST_INFO ("Object is a file with %" G_GUINT64_FORMAT " data packets",
|
||||
object.packets_count);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gst_asf_demux_process_bitrate_props_object (GstASFDemux *asf_demux, guint64 *obj_size)
|
||||
gst_asf_demux_process_bitrate_props_object (GstASFDemux * asf_demux,
|
||||
guint64 * obj_size)
|
||||
{
|
||||
guint16 num_streams;
|
||||
guint8 stream_id;
|
||||
|
@ -514,7 +501,8 @@ gst_asf_demux_process_bitrate_props_object (GstASFDemux *asf_demux, guint64 *obj
|
|||
if (!_read_uint16 (asf_demux, &num_streams))
|
||||
return FALSE;
|
||||
|
||||
GST_INFO ( "Object is a bitrate properties object with %u streams.", num_streams);
|
||||
GST_INFO ("Object is a bitrate properties object with %u streams.",
|
||||
num_streams);
|
||||
|
||||
for (i = 0; i < num_streams; i++) {
|
||||
_read_bitrate_record (asf_demux, &bitrate_record);
|
||||
|
@ -535,8 +523,10 @@ gst_asf_demux_process_comment (GstASFDemux *asf_demux, guint64 *obj_size)
|
|||
|
||||
/* Get the rest of the comment's header */
|
||||
_read_obj_comment (asf_demux, &object);
|
||||
GST_DEBUG ("Comment lengths: title=%d author=%d copyright=%d description=%d rating=%d",
|
||||
object.title_length, object.author_length, object.copyright_length, object.description_length, object.rating_length);
|
||||
GST_DEBUG
|
||||
("Comment lengths: title=%d author=%d copyright=%d description=%d rating=%d",
|
||||
object.title_length, object.author_length, object.copyright_length,
|
||||
object.description_length, object.rating_length);
|
||||
|
||||
/* We don't do anything with them at the moment so just skip them */
|
||||
gst_bytestream_flush (bs, object.title_length);
|
||||
|
@ -583,15 +573,20 @@ gst_asf_demux_process_segment (GstASFDemux *asf_demux,
|
|||
guint32 rsize;
|
||||
asf_segment_info segment_info;
|
||||
|
||||
_read_uint8 (asf_demux, &byte); rsize = 1;
|
||||
_read_uint8 (asf_demux, &byte);
|
||||
rsize = 1;
|
||||
segment_info.stream_number = byte & 0x7f;
|
||||
key_frame = (byte & 0x80) >> 7;
|
||||
|
||||
GST_INFO ("Processing segment for stream %u", segment_info.stream_number);
|
||||
segment_info.sequence = _read_var_length (asf_demux, packet_info->seqtype, &rsize);
|
||||
segment_info.frag_offset = _read_var_length (asf_demux, packet_info->fragoffsettype, &rsize);
|
||||
replic_size = _read_var_length (asf_demux, packet_info->replicsizetype, &rsize);
|
||||
GST_DEBUG ("sequence = %x, frag_offset = %x, replic_size = %x", segment_info.sequence, segment_info.frag_offset, replic_size);
|
||||
segment_info.sequence =
|
||||
_read_var_length (asf_demux, packet_info->seqtype, &rsize);
|
||||
segment_info.frag_offset =
|
||||
_read_var_length (asf_demux, packet_info->fragoffsettype, &rsize);
|
||||
replic_size =
|
||||
_read_var_length (asf_demux, packet_info->replicsizetype, &rsize);
|
||||
GST_DEBUG ("sequence = %x, frag_offset = %x, replic_size = %x",
|
||||
segment_info.sequence, segment_info.frag_offset, replic_size);
|
||||
|
||||
if (replic_size > 1) {
|
||||
asf_replicated_data replicated_data_header;
|
||||
|
@ -600,7 +595,8 @@ gst_asf_demux_process_segment (GstASFDemux *asf_demux,
|
|||
|
||||
/* It's uncompressed with replic data */
|
||||
if (replic_size < 8) {
|
||||
GST_ELEMENT_ERROR (asf_demux, STREAM, DEMUX, (NULL), ("The payload has replicated data but the size is less than 8"));
|
||||
GST_ELEMENT_ERROR (asf_demux, STREAM, DEMUX, (NULL),
|
||||
("The payload has replicated data but the size is less than 8"));
|
||||
return FALSE;
|
||||
}
|
||||
_read_replicated_data (asf_demux, &replicated_data_header);
|
||||
|
@ -616,7 +612,8 @@ gst_asf_demux_process_segment (GstASFDemux *asf_demux,
|
|||
if (replic_size == 1) {
|
||||
/* It's compressed */
|
||||
segment_info.compressed = TRUE;
|
||||
_read_uint8 (asf_demux, &time_delta); rsize++;
|
||||
_read_uint8 (asf_demux, &time_delta);
|
||||
rsize++;
|
||||
GST_DEBUG ("time_delta %u", time_delta);
|
||||
} else {
|
||||
segment_info.compressed = FALSE;
|
||||
|
@ -627,7 +624,8 @@ gst_asf_demux_process_segment (GstASFDemux *asf_demux,
|
|||
segment_info.frag_timestamp = asf_demux->timestamp;
|
||||
}
|
||||
|
||||
GST_DEBUG ("multiple = %u compressed = %u", packet_info->multiple, segment_info.compressed);
|
||||
GST_DEBUG ("multiple = %u compressed = %u", packet_info->multiple,
|
||||
segment_info.compressed);
|
||||
|
||||
if (packet_info->multiple) {
|
||||
frag_size = _read_var_length (asf_demux, packet_info->segsizetype, &rsize);
|
||||
|
@ -637,7 +635,8 @@ gst_asf_demux_process_segment (GstASFDemux *asf_demux,
|
|||
|
||||
packet_info->size_left -= rsize;
|
||||
|
||||
GST_DEBUG ("size left = %u frag size = %u rsize = %u", packet_info->size_left, frag_size, rsize);
|
||||
GST_DEBUG ("size left = %u frag size = %u rsize = %u", packet_info->size_left,
|
||||
frag_size, rsize);
|
||||
|
||||
if (segment_info.compressed) {
|
||||
while (frag_size > 0) {
|
||||
|
@ -647,7 +646,8 @@ gst_asf_demux_process_segment (GstASFDemux *asf_demux,
|
|||
segment_info.segment_size = segment_info.chunk_size;
|
||||
|
||||
if (segment_info.chunk_size > packet_info->size_left) {
|
||||
GST_ELEMENT_ERROR (asf_demux, STREAM, DEMUX, (NULL), ("Payload chunk overruns packet size."));
|
||||
GST_ELEMENT_ERROR (asf_demux, STREAM, DEMUX, (NULL),
|
||||
("Payload chunk overruns packet size."));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -691,18 +691,21 @@ gst_asf_demux_process_data (GstASFDemux *asf_demux, guint64 *obj_size)
|
|||
for (packet = 0; packet < packets; packet++) {
|
||||
GST_INFO ("\n\nProcess packet %" G_GUINT64_FORMAT, packet);
|
||||
|
||||
_read_uint8 (asf_demux, &buf); rsize=1;
|
||||
_read_uint8 (asf_demux, &buf);
|
||||
rsize = 1;
|
||||
if (buf & 0x80) {
|
||||
asf_obj_data_correction correction_object;
|
||||
|
||||
/* Uses error correction */
|
||||
correction = TRUE;
|
||||
GST_DEBUG ("Data has error correction (%x)", buf);
|
||||
_read_obj_data_correction (asf_demux, &correction_object); rsize += 2;
|
||||
_read_obj_data_correction (asf_demux, &correction_object);
|
||||
rsize += 2;
|
||||
}
|
||||
|
||||
/* Read the packet flags */
|
||||
_read_obj_data_packet (asf_demux, &packet_properties_object); rsize += 2;
|
||||
_read_obj_data_packet (asf_demux, &packet_properties_object);
|
||||
rsize += 2;
|
||||
flags = packet_properties_object.flags;
|
||||
property = packet_properties_object.property;
|
||||
|
||||
|
@ -710,12 +713,12 @@ gst_asf_demux_process_data (GstASFDemux *asf_demux, guint64 *obj_size)
|
|||
sequence = _read_var_length (asf_demux, (flags >> 1) & 0x03, &rsize);
|
||||
packet_info.padsize =
|
||||
_read_var_length (asf_demux, (flags >> 3) & 0x03, &rsize);
|
||||
packet_length =
|
||||
_read_var_length (asf_demux, (flags >> 5) & 0x03, &rsize);
|
||||
packet_length = _read_var_length (asf_demux, (flags >> 5) & 0x03, &rsize);
|
||||
if (packet_length == 0)
|
||||
packet_length = asf_demux->packet_size;
|
||||
|
||||
GST_DEBUG ("Multiple = %u, Sequence = %u, Padsize = %u, Packet length = %u", packet_info.multiple, sequence, packet_info.padsize, packet_length);
|
||||
GST_DEBUG ("Multiple = %u, Sequence = %u, Padsize = %u, Packet length = %u",
|
||||
packet_info.multiple, sequence, packet_info.padsize, packet_length);
|
||||
|
||||
/* Read the property flags */
|
||||
packet_info.replicsizetype = property & 0x03;
|
||||
|
@ -782,8 +785,11 @@ gst_asf_demux_process_stream (GstASFDemux *asf_demux, guint64 *obj_size)
|
|||
_read_obj_stream (asf_demux, &object);
|
||||
|
||||
/* Identify the stream type */
|
||||
stream_id = gst_asf_demux_identify_guid (asf_demux, asf_stream_guids, &(object.type));
|
||||
correction = gst_asf_demux_identify_guid (asf_demux, asf_correction_guids, &(object.correction));
|
||||
stream_id =
|
||||
gst_asf_demux_identify_guid (asf_demux, asf_stream_guids, &(object.type));
|
||||
correction =
|
||||
gst_asf_demux_identify_guid (asf_demux, asf_correction_guids,
|
||||
&(object.correction));
|
||||
id = object.id;
|
||||
|
||||
switch (stream_id) {
|
||||
|
@ -791,7 +797,8 @@ gst_asf_demux_process_stream (GstASFDemux *asf_demux, guint64 *obj_size)
|
|||
_read_stream_audio (asf_demux, &audio_object);
|
||||
size = audio_object.size;
|
||||
|
||||
GST_INFO ("Object is an audio stream with %u bytes of additional data.", size);
|
||||
GST_INFO ("Object is an audio stream with %u bytes of additional data.",
|
||||
size);
|
||||
|
||||
if (!gst_asf_demux_add_audio_stream (asf_demux, &audio_object, id))
|
||||
return FALSE;
|
||||
|
@ -803,11 +810,15 @@ gst_asf_demux_process_stream (GstASFDemux *asf_demux, guint64 *obj_size)
|
|||
_read_stream_correction (asf_demux, &correction_object);
|
||||
asf_demux->span = correction_object.span;
|
||||
|
||||
GST_DEBUG ("Descrambling: ps:%d cs:%d ds:%d s:%d sd:%d", correction_object.packet_size, correction_object.chunk_size,
|
||||
correction_object.data_size, (guint) correction_object.span, (guint) correction_object.silence_data);
|
||||
GST_DEBUG ("Descrambling: ps:%d cs:%d ds:%d s:%d sd:%d",
|
||||
correction_object.packet_size, correction_object.chunk_size,
|
||||
correction_object.data_size, (guint) correction_object.span,
|
||||
(guint) correction_object.silence_data);
|
||||
|
||||
if (asf_demux->span > 1) {
|
||||
if (!correction_object.chunk_size || ((correction_object.packet_size / correction_object.chunk_size) <= 1))
|
||||
if (!correction_object.chunk_size
|
||||
|| ((correction_object.packet_size /
|
||||
correction_object.chunk_size) <= 1))
|
||||
/* Disable descrambling */
|
||||
asf_demux->span = 0;
|
||||
} else {
|
||||
|
@ -818,7 +829,8 @@ gst_asf_demux_process_stream (GstASFDemux *asf_demux, guint64 *obj_size)
|
|||
|
||||
/* Now skip the rest of the silence data */
|
||||
if (correction_object.data_size > 1)
|
||||
gst_bytestream_flush (asf_demux->bs, correction_object.data_size - 1);
|
||||
gst_bytestream_flush (asf_demux->bs,
|
||||
correction_object.data_size - 1);
|
||||
|
||||
break;
|
||||
case ASF_CORRECTION_OFF:
|
||||
|
@ -826,7 +838,8 @@ gst_asf_demux_process_stream (GstASFDemux *asf_demux, guint64 *obj_size)
|
|||
gst_bytestream_flush (asf_demux->bs, object.stream_specific_size);
|
||||
break;
|
||||
default:
|
||||
GST_ELEMENT_ERROR (asf_demux, STREAM, DEMUX, (NULL), ("Audio stream using unknown error correction"));
|
||||
GST_ELEMENT_ERROR (asf_demux, STREAM, DEMUX, (NULL),
|
||||
("Audio stream using unknown error correction"));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -834,7 +847,8 @@ gst_asf_demux_process_stream (GstASFDemux *asf_demux, guint64 *obj_size)
|
|||
case ASF_STREAM_VIDEO:
|
||||
_read_stream_video (asf_demux, &video_object);
|
||||
size = video_object.size - 40; /* Byte order gets offset by single byte */
|
||||
GST_INFO ( "Object is a video stream with %u bytes of additional data.", size);
|
||||
GST_INFO ("Object is a video stream with %u bytes of additional data.",
|
||||
size);
|
||||
_read_stream_video_format (asf_demux, &video_format_object);
|
||||
|
||||
if (!gst_asf_demux_add_video_stream (asf_demux, &video_format_object, id))
|
||||
|
@ -856,7 +870,8 @@ gst_asf_demux_process_stream (GstASFDemux *asf_demux, guint64 *obj_size)
|
|||
}
|
||||
break;
|
||||
default:
|
||||
GST_ELEMENT_ERROR (asf_demux, STREAM, WRONG_TYPE, (NULL), ("unknown asf stream (id %08x)", (guint) stream_id));
|
||||
GST_ELEMENT_ERROR (asf_demux, STREAM, WRONG_TYPE, (NULL),
|
||||
("unknown asf stream (id %08x)", (guint) stream_id));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -876,7 +891,8 @@ gst_asf_demux_skip_object (GstASFDemux *asf_demux, guint64 *obj_size)
|
|||
}
|
||||
|
||||
static inline gboolean
|
||||
_read_object_header (GstASFDemux *asf_demux, guint32 *obj_id, guint64 *obj_size)
|
||||
_read_object_header (GstASFDemux * asf_demux, guint32 * obj_id,
|
||||
guint64 * obj_size)
|
||||
{
|
||||
ASFGuid guid;
|
||||
|
||||
|
@ -889,7 +905,8 @@ _read_object_header (GstASFDemux *asf_demux, guint32 *obj_id, guint64 *obj_size)
|
|||
return FALSE;
|
||||
|
||||
if (*obj_id == ASF_OBJ_UNDEFINED) {
|
||||
GST_WARNING_OBJECT (asf_demux, "Could not identify object (0x%08x/0x%08x/0x%08x/0x%08x) with size=%llu",
|
||||
GST_WARNING_OBJECT (asf_demux,
|
||||
"Could not identify object (0x%08x/0x%08x/0x%08x/0x%08x) with size=%llu",
|
||||
guid.v1, guid.v2, guid.v3, guid.v4, *obj_size);
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -898,14 +915,17 @@ _read_object_header (GstASFDemux *asf_demux, guint32 *obj_id, guint64 *obj_size)
|
|||
}
|
||||
|
||||
static gboolean
|
||||
gst_asf_demux_process_object (GstASFDemux *asf_demux) {
|
||||
gst_asf_demux_process_object (GstASFDemux * asf_demux)
|
||||
{
|
||||
|
||||
guint32 obj_id;
|
||||
guint64 obj_size;
|
||||
|
||||
if (!_read_object_header (asf_demux, &obj_id, &obj_size)) {
|
||||
GST_DEBUG (" ***** Error reading object at filepos %" G_GUINT64_FORMAT " (EOS?)\n", /**filepos*/ gst_bytestream_tell (asf_demux->bs));
|
||||
gst_asf_demux_handle_sink_event (asf_demux, gst_event_new (GST_EVENT_EOS), 0);
|
||||
GST_DEBUG (" ***** Error reading object at filepos %" G_GUINT64_FORMAT
|
||||
" (EOS?)\n", /**filepos*/ gst_bytestream_tell (asf_demux->bs));
|
||||
gst_asf_demux_handle_sink_event (asf_demux, gst_event_new (GST_EVENT_EOS),
|
||||
0);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -953,8 +973,7 @@ gst_asf_demux_process_object (GstASFDemux *asf_demux) {
|
|||
|
||||
|
||||
static asf_stream_context *
|
||||
gst_asf_demux_get_stream (GstASFDemux *asf_demux,
|
||||
guint16 id)
|
||||
gst_asf_demux_get_stream (GstASFDemux * asf_demux, guint16 id)
|
||||
{
|
||||
guint8 i;
|
||||
asf_stream_context *stream;
|
||||
|
@ -968,15 +987,16 @@ gst_asf_demux_get_stream (GstASFDemux *asf_demux,
|
|||
}
|
||||
|
||||
/* Base case if we haven't found one at all */
|
||||
GST_ELEMENT_ERROR (asf_demux, STREAM, DEMUX, (NULL), ("Segment found for undefined stream: (%d)", id));
|
||||
GST_ELEMENT_ERROR (asf_demux, STREAM, DEMUX, (NULL),
|
||||
("Segment found for undefined stream: (%d)", id));
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static inline void
|
||||
gst_asf_demux_descramble_segment (GstASFDemux * asf_demux,
|
||||
asf_segment_info *segment_info,
|
||||
asf_stream_context *stream) {
|
||||
asf_segment_info * segment_info, asf_stream_context * stream)
|
||||
{
|
||||
GstBuffer *scrambled_buffer;
|
||||
GstBuffer *descrambled_buffer;
|
||||
GstBuffer *sub_buffer;
|
||||
|
@ -992,12 +1012,15 @@ gst_asf_demux_descramble_segment (GstASFDemux *asf_demux,
|
|||
|
||||
offset = 0;
|
||||
|
||||
for (offset = 0; offset < segment_info->segment_size; offset += asf_demux->ds_chunk_size) {
|
||||
for (offset = 0; offset < segment_info->segment_size;
|
||||
offset += asf_demux->ds_chunk_size) {
|
||||
off = offset / asf_demux->ds_chunk_size;
|
||||
row = off / asf_demux->span;
|
||||
col = off % asf_demux->span;
|
||||
idx = row + col * asf_demux->ds_packet_size / asf_demux->ds_chunk_size;
|
||||
sub_buffer = gst_buffer_create_sub (scrambled_buffer, idx * asf_demux->ds_chunk_size, asf_demux->ds_chunk_size);
|
||||
sub_buffer =
|
||||
gst_buffer_create_sub (scrambled_buffer, idx * asf_demux->ds_chunk_size,
|
||||
asf_demux->ds_chunk_size);
|
||||
if (!offset) {
|
||||
descrambled_buffer = sub_buffer;
|
||||
} else {
|
||||
|
@ -1017,37 +1040,48 @@ gst_asf_demux_descramble_segment (GstASFDemux *asf_demux,
|
|||
|
||||
static gboolean
|
||||
gst_asf_demux_process_chunk (GstASFDemux * asf_demux,
|
||||
asf_packet_info *packet_info,
|
||||
asf_segment_info *segment_info)
|
||||
asf_packet_info * packet_info, asf_segment_info * segment_info)
|
||||
{
|
||||
asf_stream_context *stream;
|
||||
guint32 got_bytes;
|
||||
GstByteStream *bs = asf_demux->bs;
|
||||
GstBuffer *buffer;
|
||||
|
||||
if (!(stream = gst_asf_demux_get_stream (asf_demux, segment_info->stream_number)))
|
||||
if (!(stream =
|
||||
gst_asf_demux_get_stream (asf_demux, segment_info->stream_number)))
|
||||
return FALSE;
|
||||
|
||||
GST_DEBUG ("Processing chunk of size %u (fo = %d)", segment_info->chunk_size, stream->frag_offset);
|
||||
GST_DEBUG ("Processing chunk of size %u (fo = %d)", segment_info->chunk_size,
|
||||
stream->frag_offset);
|
||||
|
||||
if (stream->frag_offset == 0) {
|
||||
/* new packet */
|
||||
stream->sequence = segment_info->sequence;
|
||||
asf_demux->pts = segment_info->frag_timestamp - asf_demux->preroll;
|
||||
got_bytes = gst_bytestream_peek (bs, &buffer, segment_info->chunk_size);
|
||||
GST_DEBUG ("BUFFER: Copied stream to buffer (%p - %d)", buffer, GST_BUFFER_REFCOUNT_VALUE(buffer));
|
||||
GST_DEBUG ("BUFFER: Copied stream to buffer (%p - %d)", buffer,
|
||||
GST_BUFFER_REFCOUNT_VALUE (buffer));
|
||||
stream->payload = buffer;
|
||||
} else {
|
||||
GST_DEBUG ("segment_info->sequence = %d, stream->sequence = %d, segment_info->frag_offset = %d, stream->frag_offset = %d", segment_info->sequence, stream->sequence, segment_info->frag_offset, stream->frag_offset);
|
||||
if (segment_info->sequence == stream->sequence &&
|
||||
segment_info->frag_offset == stream->frag_offset) {
|
||||
GST_DEBUG
|
||||
("segment_info->sequence = %d, stream->sequence = %d, segment_info->frag_offset = %d, stream->frag_offset = %d",
|
||||
segment_info->sequence, stream->sequence, segment_info->frag_offset,
|
||||
stream->frag_offset);
|
||||
if (segment_info->sequence == stream->sequence
|
||||
&& segment_info->frag_offset == stream->frag_offset) {
|
||||
GstBuffer *new_buffer;
|
||||
|
||||
/* continuing packet */
|
||||
GST_INFO ("A continuation packet");
|
||||
got_bytes = gst_bytestream_peek (bs, &buffer, segment_info->chunk_size);
|
||||
GST_DEBUG ("Copied stream to buffer (%p - %d)", buffer, GST_BUFFER_REFCOUNT_VALUE(buffer));
|
||||
GST_DEBUG ("Copied stream to buffer (%p - %d)", buffer,
|
||||
GST_BUFFER_REFCOUNT_VALUE (buffer));
|
||||
new_buffer = gst_buffer_merge (stream->payload, buffer);
|
||||
GST_DEBUG ("BUFFER: Merged new_buffer (%p - %d) from stream->payload(%p - %d) and buffer (%p - %d)", new_buffer, GST_BUFFER_REFCOUNT_VALUE(new_buffer), stream->payload, GST_BUFFER_REFCOUNT_VALUE(stream->payload), buffer, GST_BUFFER_REFCOUNT_VALUE(buffer));
|
||||
GST_DEBUG
|
||||
("BUFFER: Merged new_buffer (%p - %d) from stream->payload(%p - %d) and buffer (%p - %d)",
|
||||
new_buffer, GST_BUFFER_REFCOUNT_VALUE (new_buffer), stream->payload,
|
||||
GST_BUFFER_REFCOUNT_VALUE (stream->payload), buffer,
|
||||
GST_BUFFER_REFCOUNT_VALUE (buffer));
|
||||
gst_buffer_unref (stream->payload);
|
||||
gst_buffer_unref (buffer);
|
||||
stream->payload = new_buffer;
|
||||
|
@ -1070,7 +1104,8 @@ gst_asf_demux_process_chunk (GstASFDemux *asf_demux,
|
|||
|
||||
stream->frag_offset += segment_info->chunk_size;
|
||||
|
||||
GST_DEBUG ("frag_offset = %d segment_size = %d ", stream->frag_offset, segment_info->segment_size);
|
||||
GST_DEBUG ("frag_offset = %d segment_size = %d ", stream->frag_offset,
|
||||
segment_info->segment_size);
|
||||
|
||||
if (stream->frag_offset < segment_info->segment_size) {
|
||||
/* We don't have the whole packet yet */
|
||||
|
@ -1083,12 +1118,15 @@ gst_asf_demux_process_chunk (GstASFDemux *asf_demux,
|
|||
}
|
||||
|
||||
if (GST_PAD_IS_USABLE (stream->pad)) {
|
||||
GST_DEBUG ("New buffer is at: %p size: %u", GST_BUFFER_DATA(stream->payload), GST_BUFFER_SIZE(stream->payload));
|
||||
GST_DEBUG ("New buffer is at: %p size: %u",
|
||||
GST_BUFFER_DATA (stream->payload), GST_BUFFER_SIZE (stream->payload));
|
||||
|
||||
GST_BUFFER_TIMESTAMP (stream->payload) = (GST_SECOND / 1000) * asf_demux->pts;
|
||||
GST_BUFFER_TIMESTAMP (stream->payload) =
|
||||
(GST_SECOND / 1000) * asf_demux->pts;
|
||||
|
||||
/*!!! Should handle flush events here? */
|
||||
GST_DEBUG ("Sending strem %d of size %d", stream->id , segment_info->chunk_size);
|
||||
GST_DEBUG ("Sending strem %d of size %d", stream->id,
|
||||
segment_info->chunk_size);
|
||||
|
||||
GST_INFO ("Pushing pad");
|
||||
gst_pad_push (stream->pad, GST_DATA (stream->payload));
|
||||
|
@ -1111,8 +1149,7 @@ gst_asf_demux_process_chunk (GstASFDemux *asf_demux,
|
|||
|
||||
static gboolean
|
||||
gst_asf_demux_handle_sink_event (GstASFDemux * asf_demux,
|
||||
GstEvent *event,
|
||||
guint32 remaining)
|
||||
GstEvent * event, guint32 remaining)
|
||||
{
|
||||
GstEventType type;
|
||||
gboolean ret = TRUE;
|
||||
|
@ -1124,6 +1161,7 @@ gst_asf_demux_handle_sink_event (GstASFDemux *asf_demux,
|
|||
asf_stream_context *stream;
|
||||
GstEvent *event = gst_event_new (GST_EVENT_EOS);
|
||||
gint n;
|
||||
|
||||
for (n = 0; n < asf_demux->num_streams; n++) {
|
||||
stream = &asf_demux->stream[n];
|
||||
gst_pad_push (stream->pad, GST_DATA (gst_event_ref (event)));
|
||||
|
@ -1143,9 +1181,11 @@ gst_asf_demux_handle_sink_event (GstASFDemux *asf_demux,
|
|||
asf_stream_context *stream = &asf_demux->stream[i];
|
||||
|
||||
if (GST_PAD_IS_USABLE (stream->pad)) {
|
||||
GST_DEBUG ("sending discont on %d %" G_GINT64_FORMAT " + %" G_GINT64_FORMAT " = %" G_GINT64_FORMAT, i,
|
||||
asf_demux->last_seek, stream->delay, asf_demux->last_seek + stream->delay);
|
||||
discont = gst_event_new_discontinuous (FALSE, GST_FORMAT_TIME,
|
||||
GST_DEBUG ("sending discont on %d %" G_GINT64_FORMAT " + %"
|
||||
G_GINT64_FORMAT " = %" G_GINT64_FORMAT, i, asf_demux->last_seek,
|
||||
stream->delay, asf_demux->last_seek + stream->delay);
|
||||
discont =
|
||||
gst_event_new_discontinuous (FALSE, GST_FORMAT_TIME,
|
||||
asf_demux->last_seek + stream->delay, NULL);
|
||||
gst_pad_push (stream->pad, GST_DATA (discont));
|
||||
}
|
||||
|
@ -1173,7 +1213,8 @@ gst_asf_demux_handle_src_event (GstPad *pad, GstEvent *event)
|
|||
}
|
||||
|
||||
static const GstEventMask *
|
||||
gst_asf_demux_get_src_event_mask (GstPad *pad) {
|
||||
gst_asf_demux_get_src_event_mask (GstPad * pad)
|
||||
{
|
||||
static const GstEventMask masks[] = {
|
||||
{GST_EVENT_SEEK, GST_SEEK_METHOD_SET | GST_SEEK_FLAG_KEY_UNIT},
|
||||
{0,}
|
||||
|
@ -1183,7 +1224,8 @@ gst_asf_demux_get_src_event_mask (GstPad *pad) {
|
|||
}
|
||||
|
||||
static const GstFormat *
|
||||
gst_asf_demux_get_src_formats (GstPad *pad) {
|
||||
gst_asf_demux_get_src_formats (GstPad * pad)
|
||||
{
|
||||
static const GstFormat formats[] = {
|
||||
GST_FORMAT_TIME,
|
||||
0
|
||||
|
@ -1192,7 +1234,8 @@ gst_asf_demux_get_src_formats (GstPad *pad) {
|
|||
}
|
||||
|
||||
static const GstQueryType *
|
||||
gst_asf_demux_get_src_query_types (GstPad *pad) {
|
||||
gst_asf_demux_get_src_query_types (GstPad * pad)
|
||||
{
|
||||
static const GstQueryType types[] = {
|
||||
GST_QUERY_TOTAL,
|
||||
GST_QUERY_POSITION,
|
||||
|
@ -1204,8 +1247,7 @@ gst_asf_demux_get_src_query_types (GstPad *pad) {
|
|||
|
||||
static gboolean
|
||||
gst_asf_demux_handle_src_query (GstPad * pad,
|
||||
GstQueryType type,
|
||||
GstFormat *format, gint64 *value)
|
||||
GstQueryType type, GstFormat * format, gint64 * value)
|
||||
{
|
||||
GstASFDemux *asf_demux;
|
||||
gboolean res = TRUE;
|
||||
|
@ -1247,9 +1289,7 @@ gst_asf_demux_handle_src_query (GstPad *pad,
|
|||
|
||||
static void
|
||||
gst_asf_demux_get_property (GObject * object,
|
||||
guint prop_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec)
|
||||
guint prop_id, GValue * value, GParamSpec * pspec)
|
||||
{
|
||||
GstASFDemux *src;
|
||||
|
||||
|
@ -1294,18 +1334,17 @@ gst_asf_demux_change_state (GstElement *element)
|
|||
|
||||
static guint32
|
||||
gst_asf_demux_identify_guid (GstASFDemux * asf_demux,
|
||||
ASFGuidHash *guids,
|
||||
ASFGuid *guid)
|
||||
ASFGuidHash * guids, ASFGuid * guid)
|
||||
{
|
||||
guint32 i;
|
||||
|
||||
GST_LOG_OBJECT (asf_demux, "identifying 0x%08x/0x%08x/0x%08x/0x%08x", guid->v1, guid->v2, guid->v3, guid->v4);
|
||||
GST_LOG_OBJECT (asf_demux, "identifying 0x%08x/0x%08x/0x%08x/0x%08x",
|
||||
guid->v1, guid->v2, guid->v3, guid->v4);
|
||||
i = 0;
|
||||
while (guids[i].obj_id != ASF_OBJ_UNDEFINED) {
|
||||
if (guids[i].guid.v1 == guid->v1 &&
|
||||
guids[i].guid.v2 == guid->v2 &&
|
||||
guids[i].guid.v3 == guid->v3 &&
|
||||
guids[i].guid.v4 == guid->v4) {
|
||||
guids[i].guid.v3 == guid->v3 && guids[i].guid.v4 == guid->v4) {
|
||||
return guids[i].obj_id;
|
||||
}
|
||||
i++;
|
||||
|
@ -1318,8 +1357,7 @@ gst_asf_demux_identify_guid (GstASFDemux *asf_demux,
|
|||
|
||||
static GstCaps *
|
||||
gst_asf_demux_audio_caps (guint16 codec_id,
|
||||
asf_stream_audio *audio, guint8 *extradata,
|
||||
char **codec_name)
|
||||
asf_stream_audio * audio, guint8 * extradata, char **codec_name)
|
||||
{
|
||||
GstCaps *caps;
|
||||
gint flags1, flags2;
|
||||
|
@ -1346,8 +1384,7 @@ gst_asf_demux_audio_caps (guint16 codec_id,
|
|||
caps = gst_caps_from_string ("audio/x-raw-int, "
|
||||
"endianness = (int) LITTLE_ENDIAN,"
|
||||
"signed = (boolean) { true, false }, "
|
||||
"width = (int) { 8, 16 }, "
|
||||
"depth = (int) { 8, 16 }");
|
||||
"width = (int) { 8, 16 }, " "depth = (int) { 8, 16 }");
|
||||
|
||||
if (audio != NULL) {
|
||||
gint ba = audio->block_align;
|
||||
|
@ -1356,9 +1393,7 @@ gst_asf_demux_audio_caps (guint16 codec_id,
|
|||
|
||||
gst_caps_set_simple (caps,
|
||||
"width", G_TYPE_INT, (int) (ba * 8 / ch),
|
||||
"depth", G_TYPE_INT, ws,
|
||||
"signed", G_TYPE_BOOLEAN, (ws != 8),
|
||||
NULL);
|
||||
"depth", G_TYPE_INT, ws, "signed", G_TYPE_BOOLEAN, (ws != 8), NULL);
|
||||
}
|
||||
if (codec_name)
|
||||
*codec_name = g_strdup ("PCM WAV");
|
||||
|
@ -1392,15 +1427,13 @@ gst_asf_demux_audio_caps (guint16 codec_id,
|
|||
"wmaversion = (int) 1, "
|
||||
"flags1 = (int) [ MIN, MAX ], "
|
||||
"flags2 = (int) [ MIN, MAX ], "
|
||||
"block_align = (int) [ 0, MAX ], "
|
||||
"bitrate = (int) [ 0, MAX ]");
|
||||
"block_align = (int) [ 0, MAX ], " "bitrate = (int) [ 0, MAX ]");
|
||||
if (audio != NULL) {
|
||||
gst_caps_set_simple (caps,
|
||||
"flags1", G_TYPE_INT, flags1,
|
||||
"flags2", G_TYPE_INT, flags2,
|
||||
"block_align", G_TYPE_INT, audio->block_align,
|
||||
"bitrate", G_TYPE_INT, audio->byte_rate * 8,
|
||||
NULL);
|
||||
"bitrate", G_TYPE_INT, audio->byte_rate * 8, NULL);
|
||||
}
|
||||
if (codec_name)
|
||||
*codec_name = g_strdup ("Microsoft WMA V1");
|
||||
|
@ -1417,30 +1450,26 @@ gst_asf_demux_audio_caps (guint16 codec_id,
|
|||
"wmaversion = (int) 2, "
|
||||
"flags1 = (int) [ MIN, MAX ], "
|
||||
"flags2 = (int) [ MIN, MAX ], "
|
||||
"block_align = (int) [ 0, MAX ], "
|
||||
"bitrate = (int) [ 0, MAX ]");
|
||||
"block_align = (int) [ 0, MAX ], " "bitrate = (int) [ 0, MAX ]");
|
||||
if (audio != NULL) {
|
||||
gst_caps_set_simple (caps,
|
||||
"flags1", G_TYPE_INT, flags1,
|
||||
"flags2", G_TYPE_INT, flags2,
|
||||
"block_align", G_TYPE_INT, audio->block_align,
|
||||
"bitrate", G_TYPE_INT, audio->byte_rate * 8,
|
||||
NULL);
|
||||
"bitrate", G_TYPE_INT, audio->byte_rate * 8, NULL);
|
||||
}
|
||||
if (codec_name)
|
||||
*codec_name = g_strdup ("Microsoft WMA V2");
|
||||
break;
|
||||
|
||||
case GST_RIFF_WAVE_FORMAT_WMAV9:
|
||||
caps = gst_caps_from_string("audio/x-wma, "
|
||||
"wmaversion = (int) 9");
|
||||
caps = gst_caps_from_string ("audio/x-wma, " "wmaversion = (int) 9");
|
||||
if (codec_name)
|
||||
*codec_name = g_strdup ("Microsoft WMA V9");
|
||||
break;
|
||||
|
||||
default:
|
||||
GST_WARNING ("asfdemux: unknown audio format 0x%04x",
|
||||
codec_id);
|
||||
GST_WARNING ("asfdemux: unknown audio format 0x%04x", codec_id);
|
||||
return GST_CAPS_ANY;
|
||||
break;
|
||||
}
|
||||
|
@ -1448,13 +1477,11 @@ gst_asf_demux_audio_caps (guint16 codec_id,
|
|||
if (audio != NULL) {
|
||||
gst_caps_set_simple (caps,
|
||||
"rate", G_TYPE_INT, audio->sample_rate,
|
||||
"channels", G_TYPE_INT, audio->channels,
|
||||
NULL);
|
||||
"channels", G_TYPE_INT, audio->channels, NULL);
|
||||
} else {
|
||||
gst_caps_set_simple (caps,
|
||||
"rate", GST_TYPE_INT_RANGE, 8000, 96000,
|
||||
"channels", GST_TYPE_INT_RANGE, 1, 2,
|
||||
NULL);
|
||||
"channels", GST_TYPE_INT_RANGE, 1, 2, NULL);
|
||||
}
|
||||
|
||||
return caps;
|
||||
|
@ -1462,8 +1489,7 @@ gst_asf_demux_audio_caps (guint16 codec_id,
|
|||
|
||||
static gboolean
|
||||
gst_asf_demux_add_audio_stream (GstASFDemux * asf_demux,
|
||||
asf_stream_audio *audio,
|
||||
guint16 id)
|
||||
asf_stream_audio * audio, guint16 id)
|
||||
{
|
||||
GstPad *src_pad;
|
||||
GstCaps *caps;
|
||||
|
@ -1486,7 +1512,8 @@ gst_asf_demux_add_audio_stream (GstASFDemux *asf_demux,
|
|||
if (size_left) {
|
||||
guint8 *extradata;
|
||||
|
||||
GST_WARNING_OBJECT (asf_demux, "asfdemux: Audio header contains %d bytes of surplus data", size_left);
|
||||
GST_WARNING_OBJECT (asf_demux,
|
||||
"asfdemux: Audio header contains %d bytes of surplus data", size_left);
|
||||
gst_bytestream_peek_bytes (asf_demux->bs, &extradata, size_left);
|
||||
caps = gst_asf_demux_audio_caps (audio->codec_tag, audio, extradata,
|
||||
&codec_name);
|
||||
|
@ -1501,12 +1528,11 @@ gst_asf_demux_add_audio_stream (GstASFDemux *asf_demux,
|
|||
codec_name, NULL);
|
||||
gst_element_found_tags (GST_ELEMENT (asf_demux), list);
|
||||
gst_tag_list_free (list);
|
||||
if (codec_name) g_free (codec_name);
|
||||
if (codec_name)
|
||||
g_free (codec_name);
|
||||
|
||||
GST_INFO ("Adding audio stream %u codec %u (0x%x)",
|
||||
asf_demux->num_video_streams,
|
||||
audio->codec_tag,
|
||||
audio->codec_tag);
|
||||
asf_demux->num_video_streams, audio->codec_tag, audio->codec_tag);
|
||||
|
||||
asf_demux->num_audio_streams++;
|
||||
|
||||
|
@ -1515,8 +1541,7 @@ gst_asf_demux_add_audio_stream (GstASFDemux *asf_demux,
|
|||
|
||||
static GstCaps *
|
||||
gst_asf_demux_video_caps (guint32 codec_fcc,
|
||||
asf_stream_video_format *video,
|
||||
char **codec_name)
|
||||
asf_stream_video_format * video, char **codec_name)
|
||||
{
|
||||
GstCaps *caps = NULL;
|
||||
gint width = 0, height = 0;
|
||||
|
@ -1616,8 +1641,8 @@ gst_asf_demux_video_caps (guint32 codec_fcc,
|
|||
break;
|
||||
|
||||
default:
|
||||
GST_WARNING ("asfdemux: unknown video format " GST_FOURCC_FORMAT "(0x%08x)",
|
||||
GST_FOURCC_ARGS(codec_fcc), codec_fcc);
|
||||
GST_WARNING ("asfdemux: unknown video format " GST_FOURCC_FORMAT
|
||||
"(0x%08x)", GST_FOURCC_ARGS (codec_fcc), codec_fcc);
|
||||
return NULL;
|
||||
break;
|
||||
}
|
||||
|
@ -1631,8 +1656,7 @@ gst_asf_demux_video_caps (guint32 codec_fcc,
|
|||
gst_caps_set_simple (caps,
|
||||
"width", GST_TYPE_INT_RANGE, 1, G_MAXINT,
|
||||
"height", GST_TYPE_INT_RANGE, 1, G_MAXINT,
|
||||
"framerate", GST_TYPE_DOUBLE_RANGE, 25.0, G_MAXDOUBLE,
|
||||
NULL);
|
||||
"framerate", GST_TYPE_DOUBLE_RANGE, 25.0, G_MAXDOUBLE, NULL);
|
||||
}
|
||||
|
||||
return caps;
|
||||
|
@ -1640,8 +1664,8 @@ gst_asf_demux_video_caps (guint32 codec_fcc,
|
|||
|
||||
static gboolean
|
||||
gst_asf_demux_add_video_stream (GstASFDemux * asf_demux,
|
||||
asf_stream_video_format *video,
|
||||
guint16 id) {
|
||||
asf_stream_video_format * video, guint16 id)
|
||||
{
|
||||
GstPad *src_pad;
|
||||
GstCaps *caps;
|
||||
gchar *name = NULL;
|
||||
|
@ -1659,11 +1683,10 @@ gst_asf_demux_add_video_stream (GstASFDemux *asf_demux,
|
|||
codec_name, NULL);
|
||||
gst_element_found_tags (GST_ELEMENT (asf_demux), list);
|
||||
gst_tag_list_free (list);
|
||||
if (codec_name) g_free (codec_name);
|
||||
if (codec_name)
|
||||
g_free (codec_name);
|
||||
GST_INFO ("Adding video stream %u codec " GST_FOURCC_FORMAT " (0x%08x)",
|
||||
asf_demux->num_video_streams,
|
||||
GST_FOURCC_ARGS(video->tag),
|
||||
video->tag);
|
||||
asf_demux->num_video_streams, GST_FOURCC_ARGS (video->tag), video->tag);
|
||||
|
||||
asf_demux->num_video_streams++;
|
||||
|
||||
|
@ -1673,9 +1696,7 @@ gst_asf_demux_add_video_stream (GstASFDemux *asf_demux,
|
|||
|
||||
static gboolean
|
||||
gst_asf_demux_setup_pad (GstASFDemux * asf_demux,
|
||||
GstPad *src_pad,
|
||||
GstCaps *caps,
|
||||
guint16 id)
|
||||
GstPad * src_pad, GstCaps * caps, guint16 id)
|
||||
{
|
||||
asf_stream_context *stream;
|
||||
|
||||
|
@ -1696,8 +1717,7 @@ gst_asf_demux_setup_pad (GstASFDemux *asf_demux,
|
|||
|
||||
gst_pad_set_element_private (src_pad, stream);
|
||||
|
||||
GST_INFO ("Adding pad for stream %u",
|
||||
asf_demux->num_streams);
|
||||
GST_INFO ("Adding pad for stream %u", asf_demux->num_streams);
|
||||
|
||||
|
||||
asf_demux->num_streams++;
|
||||
|
@ -1714,8 +1734,10 @@ plugin_init (GstPlugin *plugin)
|
|||
return FALSE;
|
||||
|
||||
/* create an elementfactory for the asf_demux element */
|
||||
if (!gst_element_register (plugin, "asfdemux", GST_RANK_PRIMARY, GST_TYPE_ASF_DEMUX) ||
|
||||
!gst_element_register (plugin, "asfmux", GST_RANK_NONE, GST_TYPE_ASFMUX))
|
||||
if (!gst_element_register (plugin, "asfdemux", GST_RANK_PRIMARY,
|
||||
GST_TYPE_ASF_DEMUX)
|
||||
|| !gst_element_register (plugin, "asfmux", GST_RANK_NONE,
|
||||
GST_TYPE_ASFMUX))
|
||||
return FALSE;
|
||||
|
||||
GST_DEBUG_CATEGORY_INIT (asf_debug, "asfdemux", 0, "asf demuxer element");
|
||||
|
@ -1723,14 +1745,8 @@ plugin_init (GstPlugin *plugin)
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
GST_PLUGIN_DEFINE (
|
||||
GST_VERSION_MAJOR,
|
||||
GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
|
||||
GST_VERSION_MINOR,
|
||||
"asf",
|
||||
"Demuxes and muxes audio and video in Microsofts ASF format",
|
||||
plugin_init,
|
||||
VERSION,
|
||||
"LGPL",
|
||||
GST_PACKAGE,
|
||||
GST_ORIGIN
|
||||
)
|
||||
plugin_init, VERSION, "LGPL", GST_PACKAGE, GST_ORIGIN)
|
||||
|
|
|
@ -26,7 +26,6 @@
|
|||
#include "asfheaders.h"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define GST_TYPE_ASF_DEMUX \
|
||||
(asf_demux_get_type())
|
||||
#define GST_ASF_DEMUX(obj) \
|
||||
|
@ -37,11 +36,11 @@ G_BEGIN_DECLS
|
|||
(G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_ASF_DEMUX))
|
||||
#define GST_IS_ASF_DEMUX_CLASS(obj) \
|
||||
(G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_ASF_DEMUX))
|
||||
|
||||
typedef struct _GstASFDemux GstASFDemux;
|
||||
typedef struct _GstASFDemuxClass GstASFDemuxClass;
|
||||
|
||||
struct _GstASFStreamContext {
|
||||
struct _GstASFStreamContext
|
||||
{
|
||||
GstPad *pad;
|
||||
guint64 pts;
|
||||
};
|
||||
|
@ -57,7 +56,8 @@ typedef struct
|
|||
GstBuffer *payload;
|
||||
} asf_stream_context;
|
||||
|
||||
struct _GstASFDemux {
|
||||
struct _GstASFDemux
|
||||
{
|
||||
GstElement element;
|
||||
|
||||
/* pads */
|
||||
|
@ -103,7 +103,8 @@ struct _GstASFDemux {
|
|||
|
||||
};
|
||||
|
||||
struct _GstASFDemuxClass {
|
||||
struct _GstASFDemuxClass
|
||||
{
|
||||
GstElementClass parent_class;
|
||||
};
|
||||
|
||||
|
@ -114,5 +115,4 @@ gboolean gst_asf_demux_plugin_init (GModule *module, GstPlugin *plugin);
|
|||
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __ASF_DEMUX_H__ */
|
||||
|
|
|
@ -49,9 +49,7 @@
|
|||
#include "gstasfmux.h"
|
||||
|
||||
/* elementfactory information */
|
||||
static GstElementDetails
|
||||
gst_asfmux_details =
|
||||
{
|
||||
static GstElementDetails gst_asfmux_details = {
|
||||
"Asf multiplexer",
|
||||
"Codec/Muxer",
|
||||
"Muxes audio and video streams into an asf stream",
|
||||
|
@ -59,30 +57,29 @@ gst_asfmux_details =
|
|||
};
|
||||
|
||||
/* AsfMux signals and args */
|
||||
enum {
|
||||
enum
|
||||
{
|
||||
/* FILL ME */
|
||||
LAST_SIGNAL
|
||||
};
|
||||
|
||||
enum {
|
||||
enum
|
||||
{
|
||||
ARG_0,
|
||||
};
|
||||
|
||||
static GstStaticPadTemplate gst_asfmux_src_template =
|
||||
GST_STATIC_PAD_TEMPLATE (
|
||||
"src",
|
||||
GST_STATIC_PAD_TEMPLATE ("src",
|
||||
GST_PAD_SRC,
|
||||
GST_PAD_ALWAYS,
|
||||
GST_STATIC_CAPS ("video/x-ms-asf")
|
||||
);
|
||||
|
||||
static GstStaticPadTemplate gst_asfmux_videosink_template =
|
||||
GST_STATIC_PAD_TEMPLATE (
|
||||
"video_%d",
|
||||
GST_STATIC_PAD_TEMPLATE ("video_%d",
|
||||
GST_PAD_SINK,
|
||||
GST_PAD_REQUEST,
|
||||
GST_STATIC_CAPS (
|
||||
"video/x-raw-yuv, "
|
||||
GST_STATIC_CAPS ("video/x-raw-yuv, "
|
||||
"format = (fourcc) { YUY2, I420 }, "
|
||||
"width = (int) [ 1, MAX], "
|
||||
"height = (int) [ 1, MAX]; "
|
||||
|
@ -116,18 +113,14 @@ GST_STATIC_PAD_TEMPLATE (
|
|||
"width = (int) 720,"
|
||||
"height = (int) { 576, 480 };"
|
||||
"video/x-huffyuv, "
|
||||
"width = (int) [ 1, MAX], "
|
||||
"height = (int) [ 1, MAX]"
|
||||
)
|
||||
"width = (int) [ 1, MAX], " "height = (int) [ 1, MAX]")
|
||||
);
|
||||
|
||||
static GstStaticPadTemplate gst_asfmux_audiosink_template =
|
||||
GST_STATIC_PAD_TEMPLATE (
|
||||
"audio_%d",
|
||||
GST_STATIC_PAD_TEMPLATE ("audio_%d",
|
||||
GST_PAD_SINK,
|
||||
GST_PAD_REQUEST,
|
||||
GST_STATIC_CAPS (
|
||||
"audio/x-raw-int, "
|
||||
GST_STATIC_CAPS ("audio/x-raw-int, "
|
||||
"endianness = (int) LITTLE_ENDIAN, "
|
||||
"signed = (boolean) { true, false }, "
|
||||
"width = (int) { 8, 16 }, "
|
||||
|
@ -143,9 +136,7 @@ GST_STATIC_PAD_TEMPLATE (
|
|||
"rate = (int) [ 1000, 96000 ], "
|
||||
"channels = (int) [ 1, 2]; "
|
||||
"audio/x-ac3, "
|
||||
"rate = (int) [ 1000, 96000 ], "
|
||||
"channels = (int) [ 1, 2]"
|
||||
)
|
||||
"rate = (int) [ 1000, 96000 ], " "channels = (int) [ 1, 2]")
|
||||
);
|
||||
|
||||
#define GST_ASF_PACKET_SIZE 3200
|
||||
|
@ -157,14 +148,13 @@ static void gst_asfmux_class_init (GstAsfMuxClass *klass);
|
|||
static void gst_asfmux_init (GstAsfMux * asfmux);
|
||||
|
||||
static void gst_asfmux_loop (GstElement * element);
|
||||
static gboolean gst_asfmux_handle_event (GstPad *pad,
|
||||
GstEvent *event);
|
||||
static gboolean gst_asfmux_handle_event (GstPad * pad, GstEvent * event);
|
||||
static GstPad *gst_asfmux_request_new_pad (GstElement * element,
|
||||
GstPadTemplate *templ,
|
||||
const gchar *name);
|
||||
GstPadTemplate * templ, const gchar * name);
|
||||
static GstElementStateReturn gst_asfmux_change_state (GstElement * element);
|
||||
|
||||
static GstElementClass *parent_class = NULL;
|
||||
|
||||
/*static guint gst_asfmux_signals[LAST_SIGNAL] = { 0 }; */
|
||||
|
||||
GType
|
||||
|
@ -185,8 +175,7 @@ gst_asfmux_get_type (void)
|
|||
(GInstanceInitFunc) gst_asfmux_init,
|
||||
};
|
||||
asfmux_type = g_type_register_static (GST_TYPE_ELEMENT,
|
||||
"GstAsfMux",
|
||||
&asfmux_info, 0);
|
||||
"GstAsfMux", &asfmux_info, 0);
|
||||
}
|
||||
return asfmux_type;
|
||||
}
|
||||
|
@ -234,8 +223,9 @@ gst_asfmux_init (GstAsfMux *asfmux)
|
|||
{
|
||||
gint n;
|
||||
|
||||
asfmux->srcpad = gst_pad_new_from_template (
|
||||
gst_static_pad_template_get (&gst_asfmux_src_template), "src");
|
||||
asfmux->srcpad =
|
||||
gst_pad_new_from_template (gst_static_pad_template_get
|
||||
(&gst_asfmux_src_template), "src");
|
||||
gst_element_add_pad (GST_ELEMENT (asfmux), asfmux->srcpad);
|
||||
|
||||
GST_FLAG_SET (GST_ELEMENT (asfmux), GST_ELEMENT_EVENT_AWARE);
|
||||
|
@ -286,7 +276,8 @@ gst_asfmux_vidsink_link (GstPad *pad, const GstCaps *caps)
|
|||
ret = gst_structure_get_int (structure, "width", &w);
|
||||
ret &= gst_structure_get_int (structure, "height", &h);
|
||||
|
||||
if(!ret) return GST_PAD_LINK_REFUSED;
|
||||
if (!ret)
|
||||
return GST_PAD_LINK_REFUSED;
|
||||
|
||||
stream->header.video.stream.width = w;
|
||||
stream->header.video.stream.height = h;
|
||||
|
@ -299,7 +290,8 @@ gst_asfmux_vidsink_link (GstPad *pad, const GstCaps *caps)
|
|||
guint32 format;
|
||||
|
||||
ret = gst_structure_get_fourcc (structure, "format", &format);
|
||||
if(!ret) return GST_PAD_LINK_REFUSED;
|
||||
if (!ret)
|
||||
return GST_PAD_LINK_REFUSED;
|
||||
|
||||
stream->header.video.format.tag = format;
|
||||
switch (format) {
|
||||
|
@ -326,16 +318,20 @@ gst_asfmux_vidsink_link (GstPad *pad, const GstCaps *caps)
|
|||
stream->header.video.format.tag = GST_MAKE_FOURCC ('M', 'J', 'P', 'G');
|
||||
} else if (!strcmp (mimetype, "video/x-divx")) {
|
||||
gint divxversion;
|
||||
|
||||
gst_structure_get_int (structure, "divxversion", &divxversion);
|
||||
switch (divxversion) {
|
||||
case 3:
|
||||
stream->header.video.format.tag = GST_MAKE_FOURCC ('D','I','V','3');
|
||||
stream->header.video.format.tag =
|
||||
GST_MAKE_FOURCC ('D', 'I', 'V', '3');
|
||||
break;
|
||||
case 4:
|
||||
stream->header.video.format.tag = GST_MAKE_FOURCC ('D','I','V','X');
|
||||
stream->header.video.format.tag =
|
||||
GST_MAKE_FOURCC ('D', 'I', 'V', 'X');
|
||||
break;
|
||||
case 5:
|
||||
stream->header.video.format.tag = GST_MAKE_FOURCC ('D','X','5','0');
|
||||
stream->header.video.format.tag =
|
||||
GST_MAKE_FOURCC ('D', 'X', '5', '0');
|
||||
break;
|
||||
}
|
||||
} else if (!strcmp (mimetype, "video/x-xvid")) {
|
||||
|
@ -344,16 +340,20 @@ gst_asfmux_vidsink_link (GstPad *pad, const GstCaps *caps)
|
|||
stream->header.video.format.tag = GST_MAKE_FOURCC ('3', 'I', 'V', '2');
|
||||
} else if (!strcmp (mimetype, "video/x-msmpeg")) {
|
||||
gint msmpegversion;
|
||||
|
||||
gst_structure_get_int (structure, "msmpegversion", &msmpegversion);
|
||||
switch (msmpegversion) {
|
||||
case 41:
|
||||
stream->header.video.format.tag = GST_MAKE_FOURCC ('M','P','G','4');
|
||||
stream->header.video.format.tag =
|
||||
GST_MAKE_FOURCC ('M', 'P', 'G', '4');
|
||||
break;
|
||||
case 42:
|
||||
stream->header.video.format.tag = GST_MAKE_FOURCC ('M','P','4','2');
|
||||
stream->header.video.format.tag =
|
||||
GST_MAKE_FOURCC ('M', 'P', '4', '2');
|
||||
break;
|
||||
case 43:
|
||||
stream->header.video.format.tag = GST_MAKE_FOURCC ('M','P','4','3');
|
||||
stream->header.video.format.tag =
|
||||
GST_MAKE_FOURCC ('M', 'P', '4', '3');
|
||||
break;
|
||||
}
|
||||
} else if (!strcmp (mimetype, "video/x-dv")) {
|
||||
|
@ -410,8 +410,7 @@ gst_asfmux_audsink_link (GstPad *pad, const GstCaps *caps)
|
|||
g_assert (stream != NULL);
|
||||
g_assert (stream->type == ASF_STREAM_AUDIO);
|
||||
|
||||
GST_DEBUG ("asfmux: audio sink_link triggered on %s",
|
||||
gst_pad_get_name (pad));
|
||||
GST_DEBUG ("asfmux: audio sink_link triggered on %s", gst_pad_get_name (pad));
|
||||
|
||||
structure = gst_caps_get_structure (caps, 0);
|
||||
|
||||
|
@ -419,7 +418,8 @@ gst_asfmux_audsink_link (GstPad *pad, const GstCaps *caps)
|
|||
ret = gst_structure_get_int (structure, "channels", &channels);
|
||||
ret &= gst_structure_get_int (structure, "rate", &rate);
|
||||
|
||||
if (!ret) return GST_PAD_LINK_REFUSED;
|
||||
if (!ret)
|
||||
return GST_PAD_LINK_REFUSED;
|
||||
|
||||
stream->header.audio.sample_rate = rate;
|
||||
stream->header.audio.channels = channels;
|
||||
|
@ -448,12 +448,14 @@ gst_asfmux_audsink_link (GstPad *pad, const GstCaps *caps)
|
|||
|
||||
if (!strcmp (mimetype, "audio/mpeg")) {
|
||||
gint layer = 3;
|
||||
|
||||
gst_structure_get_int (structure, "layer", &layer);
|
||||
switch (layer) {
|
||||
case 3:
|
||||
stream->header.audio.codec_tag = GST_RIFF_WAVE_FORMAT_MPEGL3;
|
||||
break;
|
||||
case 1: case 2:
|
||||
case 1:
|
||||
case 2:
|
||||
stream->header.audio.codec_tag = GST_RIFF_WAVE_FORMAT_MPEGL12;
|
||||
break;
|
||||
}
|
||||
|
@ -482,9 +484,7 @@ done:
|
|||
}
|
||||
|
||||
static void
|
||||
gst_asfmux_pad_link (GstPad *pad,
|
||||
GstPad *peer,
|
||||
gpointer data)
|
||||
gst_asfmux_pad_link (GstPad * pad, GstPad * peer, gpointer data)
|
||||
{
|
||||
GstAsfMux *asfmux;
|
||||
GstAsfMuxStream *stream = NULL;
|
||||
|
@ -506,9 +506,7 @@ gst_asfmux_pad_link (GstPad *pad,
|
|||
}
|
||||
|
||||
static void
|
||||
gst_asfmux_pad_unlink (GstPad *pad,
|
||||
GstPad *peer,
|
||||
gpointer data)
|
||||
gst_asfmux_pad_unlink (GstPad * pad, GstPad * peer, gpointer data)
|
||||
{
|
||||
GstAsfMux *asfmux;
|
||||
GstAsfMuxStream *stream = NULL;
|
||||
|
@ -531,8 +529,7 @@ gst_asfmux_pad_unlink (GstPad *pad,
|
|||
|
||||
static GstPad *
|
||||
gst_asfmux_request_new_pad (GstElement * element,
|
||||
GstPadTemplate *templ,
|
||||
const gchar *req_name)
|
||||
GstPadTemplate * templ, const gchar * req_name)
|
||||
{
|
||||
GstAsfMux *asfmux;
|
||||
GstPad *newpad;
|
||||
|
@ -588,7 +585,8 @@ static gboolean
|
|||
gst_asfmux_can_seek (GstAsfMux * asfmux)
|
||||
{
|
||||
#if 0
|
||||
const GstEventMask *masks = gst_pad_get_event_masks (GST_PAD_PEER (asfmux->srcpad));
|
||||
const GstEventMask *masks =
|
||||
gst_pad_get_event_masks (GST_PAD_PEER (asfmux->srcpad));
|
||||
|
||||
/* this is for stream or file-storage */
|
||||
while (masks != NULL && masks->type != 0) {
|
||||
|
@ -656,8 +654,7 @@ gst_asfmux_fill_queue (GstAsfMux *asfmux)
|
|||
while (stream->queue == NULL &&
|
||||
stream->pad != NULL &&
|
||||
stream->connected == TRUE &&
|
||||
GST_PAD_IS_USABLE (stream->pad) &&
|
||||
stream->eos == FALSE) {
|
||||
GST_PAD_IS_USABLE (stream->pad) && stream->eos == FALSE) {
|
||||
buffer = GST_BUFFER (gst_pad_pull (stream->pad));
|
||||
if (GST_IS_EVENT (buffer)) {
|
||||
gst_asfmux_handle_event (stream->pad, GST_EVENT (buffer));
|
||||
|
@ -683,12 +680,11 @@ gst_asfmux_packet_remaining (GstAsfMux *asfmux)
|
|||
}
|
||||
|
||||
static void
|
||||
gst_asfmux_put_buffer (GstBuffer *packet,
|
||||
guint8 *data,
|
||||
guint length)
|
||||
gst_asfmux_put_buffer (GstBuffer * packet, guint8 * data, guint length)
|
||||
{
|
||||
if ((GST_BUFFER_MAXSIZE (packet) - GST_BUFFER_SIZE (packet)) >= length) {
|
||||
guint8 *pos = GST_BUFFER_DATA (packet) + GST_BUFFER_SIZE (packet);
|
||||
|
||||
memcpy (pos, data, length);
|
||||
GST_BUFFER_SIZE (packet) += length;
|
||||
} else {
|
||||
|
@ -697,11 +693,11 @@ gst_asfmux_put_buffer (GstBuffer *packet,
|
|||
}
|
||||
|
||||
static void
|
||||
gst_asfmux_put_byte (GstBuffer *packet,
|
||||
guint8 data)
|
||||
gst_asfmux_put_byte (GstBuffer * packet, guint8 data)
|
||||
{
|
||||
if ((GST_BUFFER_MAXSIZE (packet) - GST_BUFFER_SIZE (packet)) >= sizeof (data)) {
|
||||
guint8 *pos = GST_BUFFER_DATA (packet) + GST_BUFFER_SIZE (packet);
|
||||
|
||||
*(guint8 *) pos = data;
|
||||
GST_BUFFER_SIZE (packet) += 1;
|
||||
} else {
|
||||
|
@ -710,11 +706,11 @@ gst_asfmux_put_byte (GstBuffer *packet,
|
|||
}
|
||||
|
||||
static void
|
||||
gst_asfmux_put_le16 (GstBuffer *packet,
|
||||
guint16 data)
|
||||
gst_asfmux_put_le16 (GstBuffer * packet, guint16 data)
|
||||
{
|
||||
if ((GST_BUFFER_MAXSIZE (packet) - GST_BUFFER_SIZE (packet)) >= sizeof (data)) {
|
||||
guint8 *pos = GST_BUFFER_DATA (packet) + GST_BUFFER_SIZE (packet);
|
||||
|
||||
*(guint16 *) pos = GUINT16_TO_LE (data);
|
||||
GST_BUFFER_SIZE (packet) += 2;
|
||||
} else {
|
||||
|
@ -723,11 +719,11 @@ gst_asfmux_put_le16 (GstBuffer *packet,
|
|||
}
|
||||
|
||||
static void
|
||||
gst_asfmux_put_le32 (GstBuffer *packet,
|
||||
guint32 data)
|
||||
gst_asfmux_put_le32 (GstBuffer * packet, guint32 data)
|
||||
{
|
||||
if ((GST_BUFFER_MAXSIZE (packet) - GST_BUFFER_SIZE (packet)) >= sizeof (data)) {
|
||||
guint8 *pos = GST_BUFFER_DATA (packet) + GST_BUFFER_SIZE (packet);
|
||||
|
||||
*(guint32 *) pos = GUINT32_TO_LE (data);
|
||||
GST_BUFFER_SIZE (packet) += 4;
|
||||
} else {
|
||||
|
@ -736,11 +732,11 @@ gst_asfmux_put_le32 (GstBuffer *packet,
|
|||
}
|
||||
|
||||
static void
|
||||
gst_asfmux_put_le64 (GstBuffer *packet,
|
||||
guint64 data)
|
||||
gst_asfmux_put_le64 (GstBuffer * packet, guint64 data)
|
||||
{
|
||||
if ((GST_BUFFER_MAXSIZE (packet) - GST_BUFFER_SIZE (packet)) >= sizeof (data)) {
|
||||
guint8 *pos = GST_BUFFER_DATA (packet) + GST_BUFFER_SIZE (packet);
|
||||
|
||||
*(guint64 *) pos = GUINT64_TO_LE (data);
|
||||
GST_BUFFER_SIZE (packet) += 8;
|
||||
} else {
|
||||
|
@ -749,23 +745,19 @@ gst_asfmux_put_le64 (GstBuffer *packet,
|
|||
}
|
||||
|
||||
static void
|
||||
gst_asfmux_put_time (GstBuffer *packet,
|
||||
guint64 time)
|
||||
gst_asfmux_put_time (GstBuffer * packet, guint64 time)
|
||||
{
|
||||
gst_asfmux_put_le64 (packet, time + 116444736000000000LLU);
|
||||
}
|
||||
|
||||
static void
|
||||
gst_asfmux_put_guid (GstBuffer *packet,
|
||||
ASFGuidHash *hash,
|
||||
guint8 id)
|
||||
gst_asfmux_put_guid (GstBuffer * packet, ASFGuidHash * hash, guint8 id)
|
||||
{
|
||||
gint n = 0;
|
||||
ASFGuid *guid;
|
||||
|
||||
/* find GUID */
|
||||
while (hash[n].obj_id != id &&
|
||||
hash[n].obj_id != ASF_OBJ_UNDEFINED) {
|
||||
while (hash[n].obj_id != id && hash[n].obj_id != ASF_OBJ_UNDEFINED) {
|
||||
n++;
|
||||
}
|
||||
guid = &hash[n].guid;
|
||||
|
@ -777,8 +769,7 @@ gst_asfmux_put_guid (GstBuffer *packet,
|
|||
}
|
||||
|
||||
static void
|
||||
gst_asfmux_put_string (GstBuffer *packet,
|
||||
const gchar *str)
|
||||
gst_asfmux_put_string (GstBuffer * packet, const gchar * str)
|
||||
{
|
||||
gunichar2 *utf16_str = g_utf8_to_utf16 (str, strlen (str), NULL, NULL, NULL);
|
||||
gint i, len = strlen (str);
|
||||
|
@ -794,17 +785,13 @@ gst_asfmux_put_string (GstBuffer *packet,
|
|||
static void
|
||||
gst_asfmux_put_flush (GstAsfMux * asfmux)
|
||||
{
|
||||
gst_pad_push (asfmux->srcpad,
|
||||
GST_DATA (gst_event_new_flush ()));
|
||||
gst_pad_push (asfmux->srcpad, GST_DATA (gst_event_new_flush ()));
|
||||
}
|
||||
|
||||
/* write an asf chunk (only used in streaming case) */
|
||||
static void
|
||||
gst_asfmux_put_chunk (GstBuffer * packet,
|
||||
GstAsfMux *asfmux,
|
||||
guint16 type,
|
||||
guint length,
|
||||
gint flags)
|
||||
GstAsfMux * asfmux, guint16 type, guint length, gint flags)
|
||||
{
|
||||
gst_asfmux_put_le16 (packet, type);
|
||||
gst_asfmux_put_le16 (packet, length + 8);
|
||||
|
@ -814,8 +801,7 @@ gst_asfmux_put_chunk (GstBuffer *packet,
|
|||
}
|
||||
|
||||
static void
|
||||
gst_asfmux_put_wav_header (GstBuffer *packet,
|
||||
asf_stream_audio *hdr)
|
||||
gst_asfmux_put_wav_header (GstBuffer * packet, asf_stream_audio * hdr)
|
||||
{
|
||||
gst_asfmux_put_le16 (packet, hdr->codec_tag);
|
||||
gst_asfmux_put_le16 (packet, hdr->channels);
|
||||
|
@ -827,8 +813,7 @@ gst_asfmux_put_wav_header (GstBuffer *packet,
|
|||
}
|
||||
|
||||
static void
|
||||
gst_asfmux_put_vid_header (GstBuffer *packet,
|
||||
asf_stream_video *hdr)
|
||||
gst_asfmux_put_vid_header (GstBuffer * packet, asf_stream_video * hdr)
|
||||
{
|
||||
gst_asfmux_put_le32 (packet, hdr->width);
|
||||
gst_asfmux_put_le32 (packet, hdr->height);
|
||||
|
@ -837,8 +822,7 @@ gst_asfmux_put_vid_header (GstBuffer *packet,
|
|||
}
|
||||
|
||||
static void
|
||||
gst_asfmux_put_bmp_header (GstBuffer *packet,
|
||||
asf_stream_video_format *hdr)
|
||||
gst_asfmux_put_bmp_header (GstBuffer * packet, asf_stream_video_format * hdr)
|
||||
{
|
||||
gst_asfmux_put_le32 (packet, hdr->size);
|
||||
gst_asfmux_put_le32 (packet, hdr->width);
|
||||
|
@ -855,11 +839,10 @@ gst_asfmux_put_bmp_header (GstBuffer *packet,
|
|||
|
||||
/* init header */
|
||||
static guint
|
||||
gst_asfmux_put_header (GstBuffer *packet,
|
||||
ASFGuidHash *hash,
|
||||
guint8 id)
|
||||
gst_asfmux_put_header (GstBuffer * packet, ASFGuidHash * hash, guint8 id)
|
||||
{
|
||||
guint pos = GST_BUFFER_SIZE (packet);
|
||||
|
||||
gst_asfmux_put_guid (packet, hash, id);
|
||||
gst_asfmux_put_le64 (packet, 24);
|
||||
return pos;
|
||||
|
@ -867,19 +850,17 @@ gst_asfmux_put_header (GstBuffer *packet,
|
|||
|
||||
/* update header size */
|
||||
static void
|
||||
gst_asfmux_end_header (GstBuffer *packet,
|
||||
guint pos)
|
||||
gst_asfmux_end_header (GstBuffer * packet, guint pos)
|
||||
{
|
||||
guint cur = GST_BUFFER_SIZE (packet);
|
||||
|
||||
GST_BUFFER_SIZE (packet) = pos + sizeof (ASFGuid);
|
||||
gst_asfmux_put_le64 (packet, cur - pos);
|
||||
GST_BUFFER_SIZE (packet) = cur;
|
||||
}
|
||||
|
||||
static void
|
||||
gst_asfmux_file_start (GstAsfMux *asfmux,
|
||||
guint64 file_size,
|
||||
guint64 data_size)
|
||||
gst_asfmux_file_start (GstAsfMux * asfmux, guint64 file_size, guint64 data_size)
|
||||
{
|
||||
GstBuffer *header = gst_buffer_new_and_alloc (4096);
|
||||
guint bitrate;
|
||||
|
@ -890,6 +871,7 @@ gst_asfmux_file_start (GstAsfMux *asfmux,
|
|||
bitrate = 0;
|
||||
for (n = 0; n < asfmux->num_outputs; n++) {
|
||||
GstAsfMuxStream *stream = &asfmux->output[n];
|
||||
|
||||
bitrate += stream->bitrate;
|
||||
}
|
||||
|
||||
|
@ -940,7 +922,8 @@ gst_asfmux_file_start (GstAsfMux *asfmux,
|
|||
/* title and other infos */
|
||||
#if 0
|
||||
if (has_title) {
|
||||
header_pos = gst_asfmux_put_header (header, asf_object_guids, ASF_OBJ_COMMENT);
|
||||
header_pos =
|
||||
gst_asfmux_put_header (header, asf_object_guids, ASF_OBJ_COMMENT);
|
||||
gst_asfmux_put_le16 (header, 2 * (strlen (title) + 1));
|
||||
gst_asfmux_put_le16 (header, 2 * (strlen (author) + 1));
|
||||
gst_asfmux_put_le16 (header, 2 * (strlen (copyright) + 1));
|
||||
|
@ -960,7 +943,8 @@ gst_asfmux_file_start (GstAsfMux *asfmux,
|
|||
guint obj_size = 0;
|
||||
|
||||
stream->seqnum = 0;
|
||||
header_pos = gst_asfmux_put_header (header, asf_object_guids, ASF_OBJ_STREAM);
|
||||
header_pos =
|
||||
gst_asfmux_put_header (header, asf_object_guids, ASF_OBJ_STREAM);
|
||||
|
||||
switch (stream->type) {
|
||||
case ASF_STREAM_AUDIO:
|
||||
|
@ -997,7 +981,8 @@ gst_asfmux_file_start (GstAsfMux *asfmux,
|
|||
}
|
||||
|
||||
/* media comments */
|
||||
header_pos = gst_asfmux_put_header (header, asf_object_guids, ASF_OBJ_CODEC_COMMENT);
|
||||
header_pos =
|
||||
gst_asfmux_put_header (header, asf_object_guids, ASF_OBJ_CODEC_COMMENT);
|
||||
gst_asfmux_put_guid (header, asf_object_guids, ASF_OBJ_CODEC_COMMENT1);
|
||||
gst_asfmux_put_le32 (header, asfmux->num_outputs);
|
||||
for (n = 0; n < asfmux->num_outputs; n++) {
|
||||
|
@ -1063,6 +1048,7 @@ gst_asfmux_file_stop (GstAsfMux *asfmux)
|
|||
if (gst_asfmux_is_stream (asfmux)) {
|
||||
/* send EOS chunk */
|
||||
GstBuffer *footer = gst_buffer_new_and_alloc (16);
|
||||
|
||||
GST_BUFFER_SIZE (footer) = 0;
|
||||
gst_asfmux_put_chunk (footer, asfmux, 0x4524, 0, 0); /* end of stream */
|
||||
gst_pad_push (asfmux->srcpad, GST_DATA (footer));
|
||||
|
@ -1071,12 +1057,13 @@ gst_asfmux_file_stop (GstAsfMux *asfmux)
|
|||
guint64 filesize;
|
||||
GstFormat fmt = GST_FORMAT_BYTES;
|
||||
GstEvent *event;
|
||||
gst_pad_query (asfmux->srcpad, GST_QUERY_POSITION,
|
||||
&fmt, &filesize);
|
||||
|
||||
gst_pad_query (asfmux->srcpad, GST_QUERY_POSITION, &fmt, &filesize);
|
||||
event = gst_event_new_seek (GST_SEEK_METHOD_SET | GST_FORMAT_BYTES, 0);
|
||||
gst_pad_push (asfmux->srcpad, GST_DATA (event));
|
||||
gst_asfmux_file_start (asfmux, filesize, filesize - asfmux->data_offset);
|
||||
event = gst_event_new_seek (GST_SEEK_METHOD_SET | GST_FORMAT_BYTES, filesize);
|
||||
event =
|
||||
gst_event_new_seek (GST_SEEK_METHOD_SET | GST_FORMAT_BYTES, filesize);
|
||||
gst_pad_push (asfmux->srcpad, GST_DATA (event));
|
||||
}
|
||||
|
||||
|
@ -1114,8 +1101,10 @@ gst_asfmux_packet_header (GstAsfMux *asfmux)
|
|||
} else if (flags & 0x08) {
|
||||
gst_asfmux_put_byte (header, padsize - 1);
|
||||
}
|
||||
gst_asfmux_put_le32 (header, GST_BUFFER_TIMESTAMP (packet) / (GST_SECOND/1000));
|
||||
gst_asfmux_put_le16 (header, GST_BUFFER_DURATION (packet) / (GST_SECOND/1000));
|
||||
gst_asfmux_put_le32 (header,
|
||||
GST_BUFFER_TIMESTAMP (packet) / (GST_SECOND / 1000));
|
||||
gst_asfmux_put_le16 (header,
|
||||
GST_BUFFER_DURATION (packet) / (GST_SECOND / 1000));
|
||||
gst_asfmux_put_byte (header, asfmux->packet_frames | 0x80);
|
||||
|
||||
return header;
|
||||
|
@ -1124,11 +1113,7 @@ gst_asfmux_packet_header (GstAsfMux *asfmux)
|
|||
static void
|
||||
gst_asfmux_frame_header (GstAsfMux * asfmux,
|
||||
GstAsfMuxStream * stream,
|
||||
guint position,
|
||||
guint length,
|
||||
guint total,
|
||||
guint64 time,
|
||||
gboolean key)
|
||||
guint position, guint length, guint total, guint64 time, gboolean key)
|
||||
{
|
||||
/* fill in some values for the packet */
|
||||
if (!GST_CLOCK_TIME_IS_VALID (GST_BUFFER_TIMESTAMP (asfmux->packet))) {
|
||||
|
@ -1147,9 +1132,7 @@ gst_asfmux_frame_header (GstAsfMux *asfmux,
|
|||
}
|
||||
|
||||
static void
|
||||
gst_asfmux_frame_buffer (GstAsfMux *asfmux,
|
||||
guint8 *data,
|
||||
guint length)
|
||||
gst_asfmux_frame_buffer (GstAsfMux * asfmux, guint8 * data, guint length)
|
||||
{
|
||||
gst_asfmux_put_buffer (asfmux->packet, data, length);
|
||||
asfmux->packet_frames++;
|
||||
|
@ -1186,8 +1169,7 @@ gst_asfmux_packet_flush (GstAsfMux *asfmux)
|
|||
|
||||
static void
|
||||
gst_asfmux_write_buffer (GstAsfMux * asfmux,
|
||||
GstAsfMuxStream *stream,
|
||||
GstBuffer *buffer)
|
||||
GstAsfMuxStream * stream, GstBuffer * buffer)
|
||||
{
|
||||
guint position = 0, to_write, size = GST_BUFFER_SIZE (buffer), remaining;
|
||||
|
||||
|
@ -1212,7 +1194,8 @@ gst_asfmux_write_buffer (GstAsfMux *asfmux,
|
|||
gst_asfmux_frame_header (asfmux, stream, position, to_write, size,
|
||||
GST_BUFFER_TIMESTAMP (buffer),
|
||||
GST_BUFFER_FLAG_IS_SET (buffer, GST_BUFFER_KEY_UNIT));
|
||||
gst_asfmux_frame_buffer (asfmux, GST_BUFFER_DATA (buffer) + position, to_write);
|
||||
gst_asfmux_frame_buffer (asfmux, GST_BUFFER_DATA (buffer) + position,
|
||||
to_write);
|
||||
|
||||
position += to_write;
|
||||
}
|
||||
|
@ -1240,8 +1223,7 @@ gst_asfmux_do_one_buffer (GstAsfMux *asfmux)
|
|||
if (chosen == -1) {
|
||||
/* simply finish off the file and send EOS */
|
||||
gst_asfmux_file_stop (asfmux);
|
||||
gst_pad_push (asfmux->srcpad,
|
||||
GST_DATA (gst_event_new (GST_EVENT_EOS)));
|
||||
gst_pad_push (asfmux->srcpad, GST_DATA (gst_event_new (GST_EVENT_EOS)));
|
||||
gst_element_set_eos (GST_ELEMENT (asfmux));
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -1252,7 +1234,8 @@ gst_asfmux_do_one_buffer (GstAsfMux *asfmux)
|
|||
|
||||
/* update stream info after buffer push */
|
||||
gst_buffer_unref (asfmux->output[chosen].queue);
|
||||
asfmux->output[chosen].time = GST_BUFFER_TIMESTAMP (asfmux->output[chosen].queue);
|
||||
asfmux->output[chosen].time =
|
||||
GST_BUFFER_TIMESTAMP (asfmux->output[chosen].queue);
|
||||
asfmux->output[chosen].queue = NULL;
|
||||
|
||||
return TRUE;
|
||||
|
|
|
@ -24,7 +24,8 @@
|
|||
#include "asfheaders.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
extern "C"
|
||||
{
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#define GST_TYPE_ASFMUX \
|
||||
|
@ -40,7 +41,8 @@ extern "C" {
|
|||
|
||||
#define MAX_ASF_OUTPUTS 16
|
||||
|
||||
typedef struct _GstAsfMuxStream {
|
||||
typedef struct _GstAsfMuxStream
|
||||
{
|
||||
guint index;
|
||||
|
||||
gint type; /* ASF_STREAM_VIDEO/AUDIO */
|
||||
|
@ -51,16 +53,19 @@ typedef struct _GstAsfMuxStream {
|
|||
guint seqnum;
|
||||
guint bitrate;
|
||||
|
||||
union {
|
||||
union
|
||||
{
|
||||
asf_stream_audio audio;
|
||||
struct {
|
||||
struct
|
||||
{
|
||||
asf_stream_video stream;
|
||||
asf_stream_video_format format;
|
||||
} video;
|
||||
} header;
|
||||
} GstAsfMuxStream;
|
||||
|
||||
typedef struct _GstAsfMux {
|
||||
typedef struct _GstAsfMux
|
||||
{
|
||||
GstElement element;
|
||||
|
||||
/* pads */
|
||||
|
@ -76,7 +81,8 @@ typedef struct _GstAsfMux {
|
|||
guint64 data_offset;
|
||||
} GstAsfMux;
|
||||
|
||||
typedef struct _GstAsfMuxClass {
|
||||
typedef struct _GstAsfMuxClass
|
||||
{
|
||||
GstElementClass parent_class;
|
||||
} GstAsfMuxClass;
|
||||
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue