mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-28 03:00:35 +00:00
315cb1ab96
Original commit message from CVS: Patch by: Rov Juvano <rovjuvano at users dot sourceforge dot net> * configure.ac: * docs/plugins/Makefile.am: * docs/plugins/gst-plugins-bad-plugins-docs.sgml: * docs/plugins/gst-plugins-bad-plugins-sections.txt: * docs/plugins/inspect/plugin-scaletempo.xml: * examples/scaletempo/Makefile.am: * examples/scaletempo/demo-gui.c: (pop_status_bar), (status_bar_printf), (demo_gui_seek_bar_format), (update_position), (demo_gui_seek_bar_change), (demo_gui_do_change_rate), (demo_gui_do_set_rate), (demo_gui_do_rate_entered), (demo_gui_do_toggle_advanced), (demo_gui_do_toggle_disabled), (demo_gui_do_seek), (demo_gui_do_play), (demo_gui_do_pause), (demo_gui_do_play_pause), (demo_gui_do_open_file), (demo_gui_do_playlist_prev), (demo_gui_do_playlist_next), (demo_gui_do_about_dialog), (demo_gui_do_quit), (demo_gui_request_set_stride), (demo_gui_request_set_overlap), (demo_gui_request_set_search), (demo_gui_rate_changed), (demo_gui_playing_started), (demo_gui_playing_paused), (demo_gui_playing_ended), (demo_gui_player_errored), (demo_gui_stride_changed), (demo_gui_overlap_changed), (demo_gui_search_changed), (demo_gui_set_player_func), (demo_gui_set_playlist_func), (build_gvalue_array), (create_action), (demo_gui_show_func), (demo_gui_set_player), (demo_gui_set_playlist), (demo_gui_show), (demo_gui_get_property), (demo_gui_set_property), (demo_gui_init), (demo_gui_class_init), (demo_gui_get_type): * examples/scaletempo/demo-gui.h: * examples/scaletempo/demo-main.c: (handle_error_message), (handle_quit), (main): * examples/scaletempo/demo-player.c: (no_pipeline), (demo_player_event_listener), (demo_player_state_changed_cb), (demo_player_eos_cb), (demo_player_build_pipeline), (_set_rate), (demo_player_scale_rate_func), (demo_player_set_rate_func), (_set_state_and_wait), (demo_player_load_uri_func), (demo_player_play_func), (demo_player_pause_func), (_seek_to), (demo_player_seek_by_func), (demo_player_seek_to_func), (demo_player_get_position_func), (demo_player_get_duration_func), (demo_player_scale_rate), (demo_player_set_rate), (demo_player_load_uri), (demo_player_play), (demo_player_pause), (demo_player_seek_by), (demo_player_seek_to), (demo_player_get_position), (demo_player_get_duration), (demo_player_get_property), (demo_player_set_property), (demo_player_init), (demo_player_class_init), (demo_player_get_type): * examples/scaletempo/demo-player.h: * gst/scaletempo/Makefile.am: * gst/scaletempo/gstscaletempo.c: (best_overlap_offset_float), (best_overlap_offset_s16), (output_overlap_float), (output_overlap_s16), (fill_queue), (reinit_buffers), (gst_scaletempo_transform), (gst_scaletempo_transform_size), (gst_scaletempo_sink_event), (gst_scaletempo_set_caps), (gst_scaletempo_get_property), (gst_scaletempo_set_property), (gst_scaletempo_base_init), (gst_scaletempo_class_init), (gst_scaletempo_init): * gst/scaletempo/gstscaletempo.h: * gst/scaletempo/gstscaletempoplugin.c: (plugin_init): Add scaletempo plugin, which allows to scale the speed of audio without changing the pitch by handling seeks with a rate!=1.0. Integrate it into the docs and add the example application for it. Fixes bug #537700.
95 lines
2.7 KiB
C
95 lines
2.7 KiB
C
/* main.c
|
|
* Copyright (C) 2008 Rov Juvano <rovjuvano@users.sourceforge.net>
|
|
*
|
|
* This program is free software: you can redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License as published by
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
* (at your option) any later version.
|
|
*
|
|
* This program is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU General Public License
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
*/
|
|
|
|
#ifdef HAVE_CONFIG_H
|
|
#include "config.h"
|
|
#endif
|
|
|
|
#include "demo-player.h"
|
|
#include "demo-gui.h"
|
|
|
|
extern GOptionGroup *gtk_get_option_group (gboolean);
|
|
extern GOptionGroup *gst_init_get_option_group (void);
|
|
|
|
static void
|
|
handle_error_message (DemoPlayer * player, const gchar * msg, gpointer data)
|
|
{
|
|
const gchar *format = (const gchar *) data;
|
|
g_print (format, msg);
|
|
}
|
|
|
|
static void
|
|
handle_quit (gpointer source, gpointer data)
|
|
{
|
|
g_main_loop_quit ((GMainLoop *) data);
|
|
}
|
|
|
|
|
|
int
|
|
main (int argc, char *argv[])
|
|
{
|
|
DemoGui *gui;
|
|
DemoPlayer *player;
|
|
gchar **uris = NULL;
|
|
GOptionContext *ctx;
|
|
GError *err = NULL;
|
|
GMainLoop *loop;
|
|
|
|
const GOptionEntry entries[] = {
|
|
{G_OPTION_REMAINING, 0, 0, G_OPTION_ARG_FILENAME_ARRAY, &uris,
|
|
"Special option that collects any remaining arguments for us"},
|
|
{NULL,}
|
|
};
|
|
|
|
if (!g_thread_supported ())
|
|
g_thread_init (NULL);
|
|
|
|
ctx = g_option_context_new ("uri ...");
|
|
g_option_context_add_group (ctx, gst_init_get_option_group ());
|
|
g_option_context_add_group (ctx, gtk_get_option_group (FALSE));
|
|
g_option_context_add_main_entries (ctx, entries, NULL);
|
|
if (!g_option_context_parse (ctx, &argc, &argv, &err)) {
|
|
g_print ("Error initializing: %s\n", err->message);
|
|
g_error_free (err);
|
|
return -1;
|
|
}
|
|
g_option_context_free (ctx);
|
|
|
|
gui = g_object_new (DEMO_TYPE_GUI, NULL);
|
|
player = g_object_new (DEMO_TYPE_PLAYER, NULL);
|
|
g_signal_connect (player, "error", G_CALLBACK (handle_error_message),
|
|
"PLAYER ERROR: %s\n");
|
|
g_signal_connect (gui, "error", G_CALLBACK (handle_error_message),
|
|
"GUI ERROR: %s\n");
|
|
demo_gui_set_player (gui, player);
|
|
|
|
loop = g_main_loop_new (NULL, FALSE);
|
|
g_signal_connect (gui, "quiting", G_CALLBACK (handle_quit), loop);
|
|
|
|
if (uris != NULL) {
|
|
int i, num = g_strv_length (uris);
|
|
GList *uri_list = NULL;
|
|
for (i = 0; i < num; i++) {
|
|
uri_list = g_list_append (uri_list, uris[i]);
|
|
}
|
|
demo_gui_set_playlist (gui, uri_list);
|
|
}
|
|
demo_gui_show (gui);
|
|
g_main_loop_run (loop);
|
|
|
|
return 0;
|
|
}
|