From 2e3f3486a037af68f83a11cfee814c76066f43ec Mon Sep 17 00:00:00 2001 From: Rov Juvano Date: Tue, 13 May 2008 08:34:09 -0400 Subject: [PATCH] GObject boilerplate --- autogen.sh | 2 +- src/Makefile.am | 10 +- src/{main.c => demo-main.c} | 27 +-- src/demo-player.c | 158 ++++++++++++++++++ src/demo-player.h | 59 +++++++ src/gst-app.h | 19 --- src/gui.c | 396 -------------------------------------------- src/gui.h | 28 ---- src/play.c | 333 ------------------------------------- src/play.h | 46 ----- src/tui.c | 162 ------------------ src/tui.h | 27 --- 12 files changed, 231 insertions(+), 1036 deletions(-) rename src/{main.c => demo-main.c} (75%) create mode 100644 src/demo-player.c create mode 100644 src/demo-player.h delete mode 100644 src/gst-app.h delete mode 100644 src/gui.c delete mode 100644 src/gui.h delete mode 100644 src/play.c delete mode 100644 src/play.h delete mode 100644 src/tui.c delete mode 100644 src/tui.h diff --git a/autogen.sh b/autogen.sh index 0389840..18b0ea2 100755 --- a/autogen.sh +++ b/autogen.sh @@ -3,7 +3,7 @@ # to the right versions, or leave them unset and get the RedHat 7.3 defaults DIE=0 -package=gst-app +package=scaletempo-demo srcfile=src/main.c # autogen.sh helper functions (copied from GStreamer's common/ CVS module) diff --git a/src/Makefile.am b/src/Makefile.am index b311094..edc84e8 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1,16 +1,16 @@ # name of your binary -bin_PROGRAMS = gst-app +bin_PROGRAMS = scaletempo-demo # list of source files # the prefix is the name of the binary -gst_app_SOURCES = main.c play.c tui.c gui.c +scaletempo_demo_SOURCES = demo-main.c demo-player.c # list of headers we're not going to install -noinst_HEADERS = gst-app.h play.h tui.c gui.h +noinst_HEADERS = demo-player.h # our CFLAGS and LDFLAGS used for compiling and linking # make sure you prefix these with the name of your binary GTK_CFLAGS = $(shell pkg-config --cflags gtk+-2.0) GTK_LIBS = $(shell pkg-config --libs gtk+-2.0) -gst_app_CFLAGS = $(GST_CFLAGS) $(GST_PLUGINS_BASE_CFLAGS) $(GTK_CFLAGS) -Wall -g -gst_app_LDFLAGS = $(GST_LIBS) $(GST_PLUGINS_BASE_LIBS) $(GTK_LIBS) -lgstinterfaces-0.10 +scaletempo_demo_CFLAGS = $(GST_CFLAGS) $(GST_PLUGINS_BASE_CFLAGS) $(GTK_CFLAGS) -Wall -g +scaletempo_demo_LDFLAGS = $(GST_LIBS) $(GST_PLUGINS_BASE_LIBS) $(GTK_LIBS) -lgstinterfaces-0.10 diff --git a/src/main.c b/src/demo-main.c similarity index 75% rename from src/main.c rename to src/demo-main.c index f54b3ae..15fb3b0 100644 --- a/src/main.c +++ b/src/demo-main.c @@ -19,36 +19,30 @@ #include "config.h" #endif -#include "gst-app.h" +#include +#include "demo-player.h" int main (int argc, char *argv[]) { gchar **uris = NULL; - gboolean no_gui = FALSE; gchar *filter_name = "identity"; const GOptionEntry entries[] = { { "filter", '\0', 0, G_OPTION_ARG_STRING, &filter_name, "filter", "NAME" }, - { "no-gui", '\0', 0, G_OPTION_ARG_NONE, &no_gui, - "do not lauch GUI", NULL }, { G_OPTION_REMAINING, 0, 0, G_OPTION_ARG_FILENAME_ARRAY, &uris, "Special option that collects any remaining arguments for us" }, { NULL, } }; - GOptionContext *ctx; - GError *err = NULL; - /* Before calling any GLib or GStreamer function, we must initialise - * the GLib threading system */ if (!g_thread_supported()) g_thread_init (NULL); - ctx = g_option_context_new ("[ --filter= ] uri ..."); + GOptionContext *ctx = g_option_context_new ("[ --filter= ] uri ..."); g_option_context_add_group (ctx, gst_init_get_option_group ()); g_option_context_add_main_entries (ctx, entries, NULL); - + GError *err = NULL; if (!g_option_context_parse (ctx, &argc, &argv, &err)) { g_print ("Error initializing: %s\n", GST_STR_NULL (err->message)); g_error_free (err); @@ -61,17 +55,12 @@ main (int argc, char *argv[]) return -1; } - gint i, num = g_strv_length (uris); - gpointer *window_ref = NULL; + DemoPlayer *player = g_object_new (DEMO_TYPE_PLAYER, "filter", filter_name, NULL); + g_print ("Hello World!\nFilter = %s\n", player->filter); + gint i, num = g_strv_length (uris); for (i = 0; i < num; i++) { - if (no_gui) { - tui_play_uri(uris[i], filter_name); - } else { - if (!window_ref || !*window_ref) - gui_build(argc, argv, &window_ref); - gui_play_uri(uris[i], filter_name); - } + demo_player_play_uri(player, uris[i]); } g_strfreev (uris); diff --git a/src/demo-player.c b/src/demo-player.c new file mode 100644 index 0000000..4a65985 --- /dev/null +++ b/src/demo-player.c @@ -0,0 +1,158 @@ +/* demo-player.c + * Copyright (C) 2008 Rov Juvano + * + * 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 . + */ + +#include "demo-player.h" + +enum +{ + SIGNAL_RATE_CHANGE, + LAST_SIGNAL +}; +static guint demo_player_signals[LAST_SIGNAL] = { 0 }; + +enum +{ + PROP_0, + PROP_RATE, + PROP_FILTER, +}; + +typedef struct _DemoPlayerPrivate +{ + gboolean hello_word; +} DemoPlayerPrivate; + +#define DEMO_PLAYER_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), DEMO_TYPE_PLAYER, DemoPlayerPrivate)) + + +/* method implementations */ +static void demo_player_play_uri_func (DemoPlayer *player, + gchar *uri) +{ + g_print ("Now Playing: %s\n", uri); +} + + +/* Method wrappers */ +void demo_player_play_uri (DemoPlayer *player, + gchar *uri) +{ + DEMO_PLAYER_GET_CLASS (player)->play_uri(player, uri); +} + + +/* GObject overrides */ +static void +demo_player_get_property (GObject *object, + guint property_id, + GValue *value, + GParamSpec *pspec) +{ + DemoPlayer *player = DEMO_PLAYER (object); + switch (property_id) { + case PROP_RATE: + g_value_set_double (value, player->rate); + break; + case PROP_FILTER: + g_value_set_string (value, player->filter); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); + break; + } +} + +static void +demo_player_set_property (GObject *object, + guint property_id, + const GValue *value, + GParamSpec *pspec) +{ + DemoPlayer *player = DEMO_PLAYER (object); + switch (property_id) { + case PROP_FILTER: + player->filter = g_value_dup_string (value); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); + break; + } +} + + +/* GTypeInfo functions */ +static void +demo_player_init (GTypeInstance *instance, + gpointer g_class) +{ + DemoPlayer *player = (DemoPlayer *)instance; + player->rate = 1.0; + player->filter = "identity"; +} + +static void +demo_player_class_init (gpointer g_class, + gpointer class_data) +{ + g_type_class_add_private (g_class, sizeof (DemoPlayerPrivate)); + + /* DemiPlayer */ + DemoPlayerClass *player_class = (DemoPlayerClass *)g_class; + player_class->play_uri = demo_player_play_uri_func; + + /* GObject */ + GObjectClass *as_object_class = G_OBJECT_CLASS (g_class); + as_object_class->get_property = demo_player_get_property; + as_object_class->set_property = demo_player_set_property; + + g_object_class_install_property (as_object_class, PROP_RATE, + g_param_spec_double ("rate", "Rate", "Current playback rate", + -128, 128, 1.0, G_PARAM_READABLE)); + + g_object_class_install_property (as_object_class, PROP_FILTER, + g_param_spec_string ("filter", "Filter", "Filter to handle rate change", + "identity", G_PARAM_READWRITE)); + + demo_player_signals[SIGNAL_RATE_CHANGE] = + g_signal_new ("rate-changed", G_TYPE_FROM_CLASS (g_class), G_SIGNAL_RUN_FIRST, + 0, NULL, NULL, + g_cclosure_marshal_VOID__DOUBLE, G_TYPE_NONE, 1, G_TYPE_DOUBLE); +} + +GType +demo_player_get_type (void) +{ + static GType type = 0; + if (G_UNLIKELY (type == 0)) { + static const GTypeInfo info = { + sizeof (DemoPlayerClass), + NULL, /* base_init */ + NULL, /* base_finalize */ + demo_player_class_init, /* class_init */ + NULL, /* class_finalize */ + NULL, /* class_data */ + sizeof (DemoPlayer), + 0, /* n_preallocs */ + demo_player_init, /* instance_init */ + NULL /* value_table */ + }; + type = g_type_register_static (G_TYPE_OBJECT, + "DemoPlayer", + &info, 0); + } + return type; +} diff --git a/src/demo-player.h b/src/demo-player.h new file mode 100644 index 0000000..b329414 --- /dev/null +++ b/src/demo-player.h @@ -0,0 +1,59 @@ +/* gui.h + * Copyright (C) 2008 Rov Juvano + * + * 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 . + */ + +#ifndef __DEMO_PLAYER_H_INCLUDED_ +#define __DEMO_PLAYER_H_INCLUDED_ + +#include + +G_BEGIN_DECLS + +#define DEMO_TYPE_PLAYER (demo_player_get_type()) +#define DEMO_PLAYER(o) (G_TYPE_CHECK_INSTANCE_CAST((o), DEMO_TYPE_PLAYER, DemoPlayer)) +#define DEMO_IS_PLAYER(o) (G_TYPE_CHECK_INSTANCE_TYPE((o), DEMO_TYPE_PLAYER)) +#define DEMO_PLAYER_TYPE(o) (G_TYPE_FROM_INSTANCE (o)) +#define DEMO_PLAYER_TYPE_NAME(o) (g_type_name (DEMO_PLAYER__TYPE (o))) + +#define DEMO_PLAYER_CLASS(c) (G_TYPE_CHECK_CLASS_CAST((c), DEMO_TYPE_PLAYER, DemoPlayerClass)) +#define DEMO_IS_PLAYER_CLASS(c) (G_TYPE_CHECK_CLASS_TYPE((c), DEMO_TYPE_PLAYER)) +#define DEMO_PLAYER_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), DEMO_TYPE_PLAYER, DemoPlayerClass)) + +typedef struct _DemoPlayer DemoPlayer; +typedef struct _DemoPlayerClass DemoPlayerClass; + +struct _DemoPlayer +{ + GObject parent; + gdouble rate; + gchar *filter; +}; + +struct _DemoPlayerClass +{ + GObjectClass parent; + void (*play_uri) (DemoPlayer *player, + gchar *uri); +}; + +GType demo_player_get_type (void); + +void demo_player_play_uri (DemoPlayer *player, + gchar *uri); + +G_END_DECLS + +#endif /* __DEMO_PLAYER_H_INCLUDED_ */ diff --git a/src/gst-app.h b/src/gst-app.h deleted file mode 100644 index d01adf7..0000000 --- a/src/gst-app.h +++ /dev/null @@ -1,19 +0,0 @@ -/* gst-app.h - * Copyright (C) 2008 Rov Juvano - * - * 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 . - */ - -#include "tui.h" -#include "gui.h" diff --git a/src/gui.c b/src/gui.c deleted file mode 100644 index c4dec86..0000000 --- a/src/gui.c +++ /dev/null @@ -1,396 +0,0 @@ -/* gui.c - * Copyright (C) 2008 Rov Juvano - * - * 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 . - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include -#include -#include -#include -#include - -#include "gui.h" - -#define STATUSBAR_TIMEOUT 2000 - -static GstElement *pipeline; - -static GtkWidget *_rate_entry; -static GtkWidget *_image_playing_start; -static GtkWidget *_image_playing_pause; -static GtkWidget *_play_pause; -static GtkWidget *_status_bar; -static GtkWidget *_pos_label; -static GtkWidget *_video_window; -static gboolean _stop_updating_position; - - -/* Callback for status bar */ -static int -pop_sb_cb (gpointer data) { - gtk_statusbar_remove (GTK_STATUSBAR (_status_bar), 0, GPOINTER_TO_UINT (data)); - return 0; -} - -gboolean update_position (gpointer data) { - gint64 pos; - if (get_position(data, &pos)) { - gchar text[32]; - snprintf(text, 32, "%" GST_TIME_FORMAT, GST_TIME_ARGS (pos)); - gtk_label_set_text (GTK_LABEL (_pos_label), text); - } else { - gtk_label_set_text (GTK_LABEL (_pos_label), "Could not determine position"); - } - if (_stop_updating_position) { - _stop_updating_position = 0; - return 0; - } - return 1; -} - - -/* Callbacks from key presses */ -static void -gui_change_rate (gfloat rate, gboolean abs) -{ - change_rate(pipeline, rate, abs); -} - -static void -gui_seek (GstElement * pipeline, gint seconds, gboolean abs) -{ - gchar msg[32]; - snprintf(msg, 32, (abs?"Seeking to %i":"Seeking %i seconds"), seconds); - guint msg_id = gtk_statusbar_push (GTK_STATUSBAR (_status_bar), 0, msg); - g_timeout_add (STATUSBAR_TIMEOUT, pop_sb_cb, GUINT_TO_POINTER (msg_id)); - - seek(pipeline, seconds, abs); -} - -static void -gui_stop(GstElement * pipeline) { - gtk_main_quit (); -} - - -/* Gtk Callbacks */ -static void -faster_cb (GtkButton * button, gpointer data) -{ - gui_change_rate(1.0594630943593, FALSE); - guint msg_id = gtk_statusbar_push (GTK_STATUSBAR (_status_bar), 0, "Faster."); - g_timeout_add(STATUSBAR_TIMEOUT, pop_sb_cb, GUINT_TO_POINTER (msg_id)); -} - -static void -slower_cb (GtkButton * button, gpointer data) -{ - gui_change_rate(0.943874312681694, FALSE); - guint msg_id = gtk_statusbar_push (GTK_STATUSBAR (_status_bar), 0, "S l o w e r."); - g_timeout_add (STATUSBAR_TIMEOUT, pop_sb_cb, GUINT_TO_POINTER (msg_id)); -} - -static void -change_rate_cb (GtkWidget * widget, gpointer data) -{ - double rate; - sscanf (gtk_entry_get_text (GTK_ENTRY (widget)), "%lf", &rate); - gui_change_rate(rate, TRUE); -} - -static void -play_pause_cb (GtkButton * button, gpointer data) -{ - if (gtk_button_get_image (GTK_BUTTON (button)) == _image_playing_pause ) { - pause (pipeline); - } else { - play (pipeline); - } -} - -static void -rw_button_cb (GtkButton * button, gpointer data) -{ - gui_seek(pipeline, -30, FALSE); -} - -static void -ff_button_cb (GtkButton * button, gpointer data) -{ - gui_seek(pipeline, 30, FALSE); -} - - -/* Callbacks from signals */ -static void -gui_rate_changed (GstElement * pipeline, gdouble new_rate, gpointer data) { - gchar e[6]; - snprintf(e, 6, "%3.2f", new_rate); - gtk_entry_set_text (GTK_ENTRY (_rate_entry), e); - - gchar msg[32]; - snprintf(msg, 32, "Rate changed to %3.2f", new_rate); - guint msg_id = gtk_statusbar_push (GTK_STATUSBAR (_status_bar), 0, msg); - g_timeout_add (STATUSBAR_TIMEOUT, pop_sb_cb, GUINT_TO_POINTER (msg_id)); -} - -static void -gui_playing_started (GstElement * pipeline) { - guint msg_id = gtk_statusbar_push (GTK_STATUSBAR (_status_bar), 0, "PLAYING Started"); - gtk_button_set_image (GTK_BUTTON (_play_pause), _image_playing_pause); - gtk_button_set_label (GTK_BUTTON (_play_pause), "_Pause"); - g_timeout_add (STATUSBAR_TIMEOUT, pop_sb_cb, GUINT_TO_POINTER (msg_id)); - g_timeout_add(1000, update_position, pipeline); -} - -static void -gui_playing_paused (GstElement * pipeline) { - guint msg_id = gtk_statusbar_push (GTK_STATUSBAR (_status_bar), 0, "PLAYING Paused"); - gtk_button_set_image (GTK_BUTTON (_play_pause), _image_playing_start); - gtk_button_set_label (GTK_BUTTON (_play_pause), "_Play"); - g_timeout_add (STATUSBAR_TIMEOUT, pop_sb_cb, GUINT_TO_POINTER (msg_id)); - _stop_updating_position = 1; -} - - -GdkFilterReturn -key_press (GtkWidget *widget, GdkEventKey *event) -{ - switch (event->keyval) { - case 'q': - gtk_main_quit (); - break; - case ']': - gui_change_rate(1.059463094352953, FALSE); - break; - case '}': - gui_change_rate(2.0, FALSE); - break; - case '[': - gui_change_rate(0.9438743126816935, FALSE); - break; - case '{': - gui_change_rate(.5, FALSE); - break; - case 65288: - case '|': - gui_change_rate(1.0, TRUE); - break; - case '-': - gui_change_rate(-1, TRUE); - break; - case 65361: - case 'j': - gui_seek(pipeline, -5, FALSE); - break; - case 65363: - case 'k': - gui_seek(pipeline, 5, FALSE); - break; - case 65362: - case 'J': - gui_seek(pipeline, -30, FALSE); - break; - case 65364: - case 'K': - gui_seek(pipeline, 30, FALSE); - break; - case '0': - gui_seek(pipeline, 0, TRUE); - break; - case ' ': - play_pause (pipeline); - break; - case 65293: - case '\n': - case '\r': - case '\f': { - gui_seek(pipeline, 0, FALSE); - gint64 pos; - GstFormat fmt = GST_FORMAT_TIME; - if ( !gst_element_query_position (pipeline, &fmt, &pos) ) { - g_print ("position query failed!\n"); - } - g_print ("%" GST_TIME_FORMAT "\n", GST_TIME_ARGS(pos)); - break; - } - default: { - g_print ("char: %s (%i)", event->string, event->keyval); - return GDK_FILTER_CONTINUE; - } - } - return GDK_FILTER_REMOVE; -} - -static GtkWidget *create_arrow_button( GtkArrowType arrow_type, - GtkShadowType shadow_type ) -{ - GtkWidget *button; - GtkWidget *arrow; - - button = gtk_button_new (); - arrow = gtk_arrow_new (arrow_type, shadow_type); - - gtk_container_add (GTK_CONTAINER (button), arrow); - - gtk_widget_show (button); - gtk_widget_show (arrow); - - return button; -} - -static GstBusSyncReply -create_window (GstBus * bus, GstMessage * message, GtkWidget * window) -{ - if (GST_MESSAGE_TYPE (message) != GST_MESSAGE_ELEMENT || - !gst_structure_has_name (message->structure, "prepare-xwindow-id")) - return GST_BUS_PASS; - - gst_x_overlay_set_xwindow_id (GST_X_OVERLAY (GST_MESSAGE_SRC (message)), - GDK_WINDOW_XWINDOW (window->window)); - gst_x_overlay_handle_events (GST_X_OVERLAY (GST_MESSAGE_SRC (message)), TRUE); - - /* - const GstStructure *s = gst_message_get_structure (message); - g_print ("\nmessage from \"%s\" (%s): ", - GST_STR_NULL (gst_element_get_name (GST_MESSAGE_SRC (message))), - gst_message_type_get_name (GST_MESSAGE_TYPE (message))); - if (s) { - gchar *sstr = gst_structure_to_string (s); - g_print ("%s\n", sstr); - g_free (sstr); - } else { - g_print ("no message details\n"); - } - */ - - return GST_BUS_PASS; -} - -void -gui_build(int argc, char *argv[], gpointer **window_ref) { - gtk_init (&argc, &argv); - GtkWidget *window = gtk_window_new (GTK_WINDOW_TOPLEVEL); - *window_ref = (gpointer)window; - - GtkWidget *play_pause_button = gtk_button_new_with_mnemonic("_Pause"); - GtkWidget *play_image = gtk_image_new_from_stock(GTK_STOCK_MEDIA_PLAY, GTK_ICON_SIZE_SMALL_TOOLBAR); - GtkWidget *pause_image = gtk_image_new_from_stock(GTK_STOCK_MEDIA_PAUSE, GTK_ICON_SIZE_SMALL_TOOLBAR); - gtk_button_set_image (GTK_BUTTON (play_pause_button), pause_image); - GtkRequisition play_size; - gtk_widget_size_request (play_pause_button, &play_size); - gtk_widget_set_size_request (play_pause_button, play_size.width, -1); - - GtkWidget *stop_button = gtk_button_new_from_stock(GTK_STOCK_MEDIA_STOP); - GtkWidget *rw_button = gtk_button_new_from_stock(GTK_STOCK_MEDIA_REWIND); - GtkWidget *ff_button = gtk_button_new_from_stock(GTK_STOCK_MEDIA_FORWARD); - - GtkWidget *rate_entry = gtk_entry_new (); - GtkWidget *rate_label = gtk_label_new ("Rate:"); - gtk_entry_set_max_length (GTK_ENTRY (rate_entry), 5); - gtk_entry_set_text (GTK_ENTRY (rate_entry), "1.0"); - gtk_entry_set_width_chars (GTK_ENTRY (rate_entry), 5); - GtkWidget *faster_button = create_arrow_button (GTK_ARROW_UP, GTK_SHADOW_OUT); - GtkWidget *slower_button = create_arrow_button (GTK_ARROW_DOWN, GTK_SHADOW_OUT); - GtkWidget *rate_box = gtk_hbox_new (FALSE, 0); - gtk_box_pack_start (GTK_BOX (rate_box), rate_label, FALSE, FALSE, 2); - gtk_box_pack_start (GTK_BOX (rate_box), slower_button, FALSE, FALSE, 2); - gtk_box_pack_start (GTK_BOX (rate_box), rate_entry, FALSE, FALSE, 2); - gtk_box_pack_start (GTK_BOX (rate_box), faster_button, FALSE, FALSE, 2); - - GtkWidget *controls_box = gtk_hbox_new (FALSE, 0); - gtk_box_pack_start (GTK_BOX (controls_box), rate_box, FALSE, FALSE, 2); - gtk_box_pack_start (GTK_BOX (controls_box), play_pause_button, FALSE, FALSE, 2); - gtk_box_pack_start (GTK_BOX (controls_box), stop_button, FALSE, FALSE, 2); - gtk_box_pack_start (GTK_BOX (controls_box), rw_button, FALSE, FALSE, 2); - gtk_box_pack_start (GTK_BOX (controls_box), ff_button, FALSE, FALSE, 2); - - GtkWidget *video_window = gtk_drawing_area_new (); - gtk_drawing_area_size (GTK_DRAWING_AREA (video_window), 640, 360); - g_object_set (G_OBJECT (video_window), "can-focus", TRUE, NULL); - - GtkWidget *pos_label = gtk_label_new ("Position"); - gtk_misc_set_alignment (GTK_MISC (pos_label), 1, 0.5); - gtk_label_set_width_chars (GTK_LABEL (pos_label), 20); - GtkWidget *status_bar = gtk_statusbar_new (); - GtkWidget *status_line = status_bar; - gtk_box_pack_start (GTK_BOX (status_bar), pos_label, FALSE, FALSE, 2); - gtk_box_reorder_child (GTK_BOX (status_bar), pos_label, 0); - - gtk_window_set_title (GTK_WINDOW (window), "Scaletempo Demo"); - GtkWidget *toplevel_box = gtk_vbox_new (FALSE, 0); - gtk_container_set_border_width (GTK_CONTAINER (toplevel_box), 3); - gtk_container_add (GTK_CONTAINER (window), toplevel_box); - gtk_box_pack_start (GTK_BOX (toplevel_box), controls_box, FALSE, FALSE, 2); - gtk_box_pack_start (GTK_BOX (toplevel_box), video_window, TRUE, TRUE, 2); - gtk_box_pack_start (GTK_BOX (toplevel_box), status_line, FALSE, FALSE, 2); - - gtk_widget_ref (play_image); - gtk_widget_ref (pause_image); - _rate_entry = rate_entry; - _play_pause = play_pause_button; - _image_playing_start = play_image; - _image_playing_pause = pause_image; - _video_window = video_window; - _status_bar = status_bar; - _pos_label = pos_label; - - g_signal_connect (G_OBJECT (window), "destroy", gtk_main_quit, NULL); - g_signal_connect (G_OBJECT (window), "destroy", G_CALLBACK(gtk_widget_destroyed), window_ref); - gtk_widget_set_events (video_window, GDK_KEY_PRESS_MASK); - gtk_signal_connect (GTK_OBJECT (video_window), "key_press_event", GTK_SIGNAL_FUNC (key_press), NULL); - - g_signal_connect (G_OBJECT(faster_button), "clicked", G_CALLBACK (faster_cb), NULL); - g_signal_connect (G_OBJECT(slower_button), "clicked", G_CALLBACK (slower_cb), NULL); - g_signal_connect (G_OBJECT(play_pause_button), "clicked", G_CALLBACK (play_pause_cb), NULL); - g_signal_connect (G_OBJECT(stop_button), "clicked", G_CALLBACK (gtk_main_quit), NULL); - g_signal_connect (G_OBJECT(rw_button), "clicked", G_CALLBACK (rw_button_cb), NULL); - g_signal_connect (G_OBJECT(ff_button), "clicked", G_CALLBACK (ff_button_cb), NULL); - g_signal_connect (G_OBJECT(rate_entry), "activate", G_CALLBACK (change_rate_cb), NULL); - - gtk_widget_show_all (window); - gtk_statusbar_push (GTK_STATUSBAR (status_bar), 0, "Welcome to the jungle."); - gtk_widget_grab_focus (video_window); -} - -void -gui_play_uri (const gchar *uri, const gchar *filter_name) -{ - pipeline = build_pipeline (uri, filter_name); - if (!pipeline) { - g_print("An error occured building pipeline for: %s\n", uri); - return; - } - - GstBus *bus = gst_pipeline_get_bus (GST_PIPELINE (pipeline)); - gst_bus_set_sync_handler (bus, (GstBusSyncHandler) create_window, _video_window); - //g_signal_connect (bus, "message::element", G_CALLBACK (create_window), _video_window); - gst_object_unref (bus); - - set_rate_changed_cb (gui_rate_changed); - set_playing_started_cb (gui_playing_started); - set_playing_paused_cb (gui_playing_paused); - set_stop_cb (gui_stop); - - play (pipeline); - gtk_main (); - - gst_element_set_state (pipeline, GST_STATE_NULL); - gst_object_unref (pipeline); -} diff --git a/src/gui.h b/src/gui.h deleted file mode 100644 index 4e73098..0000000 --- a/src/gui.h +++ /dev/null @@ -1,28 +0,0 @@ -/* gui.h - * Copyright (C) 2008 Rov Juvano - * - * 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 . - */ - -#ifndef _MY_APP_GUI_H_INCLUDED_ -#define _MY_APP_GUI_H_INCLUDED_ - -#include -#include "play.h" - -void gui_build(int argc, char *argv[], gpointer **window_ref); -void gui_play_uri (const gchar * uri, const gchar *filter_name); - -#endif /* _MY_APP_GUI_H_INCLUDED_ */ - diff --git a/src/play.c b/src/play.c deleted file mode 100644 index 2058efa..0000000 --- a/src/play.c +++ /dev/null @@ -1,333 +0,0 @@ -/* play.c - * Copyright (C) 2008 Rov Juvano - * - * 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 . - */ - -#include "play.h" - -static gfloat scale = 1.0; -static gboolean ignore_state_changed; - -gboolean -change_rate (GstElement * pipeline, gfloat rate, gboolean abs) -{ - if (!rate) - return pause(pipeline); - - scale = abs?rate:scale*rate; - gint64 pos; - GstFormat fmt = GST_FORMAT_TIME; - if ( !gst_element_query_position (pipeline, &fmt, &pos) ) { - g_print ("position query failed!\n"); // make DEBUG - return 0; - } - gboolean res = gst_element_seek (pipeline, scale, - GST_FORMAT_TIME, GST_SEEK_FLAG_FLUSH | GST_SEEK_FLAG_ACCURATE, - GST_SEEK_TYPE_SET, pos, - GST_SEEK_TYPE_NONE, GST_CLOCK_TIME_NONE); - if (res) { - ignore_state_changed = TRUE; - } - return res; -} - -static gboolean (*change_rate_around)(GstElement * pipeline, gfloat rate, gboolean abs) = change_rate; - -void -set_change_rate_around (gboolean (*func)(GstElement * pipeline, gfloat rate, gboolean abs)) -{ change_rate_around = func; } - - -static void (*rate_changed_cb)(GstElement * object, gdouble new_rate, gpointer data) = NULL; - -static gboolean -rate_changed_handler (GstElement * object, gdouble new_rate, gpointer data) -{ - if (rate_changed_cb) - rate_changed_cb(object, new_rate, data); - return TRUE; -} - -void -set_rate_changed_cb (void (*func)(GstElement * object, gdouble new_rate, gpointer data)) -{ rate_changed_cb = func; } - -gboolean -seek (GstElement * pipeline, gint seconds, gboolean abs) -{ - gint64 new_pos; - if (abs) { - new_pos = seconds * GST_SECOND; - } else { - gint64 pos; - GstFormat fmt = GST_FORMAT_TIME; - if ( !gst_element_query_position (pipeline, &fmt, &pos) ) { - g_print ("position query failed!\n"); // make DEBUG - return 0; - } - new_pos = pos + seconds * GST_SECOND; - } - - if (new_pos < 0) - new_pos = 0; - gboolean res = gst_element_seek (pipeline, scale, - GST_FORMAT_TIME, GST_SEEK_FLAG_FLUSH, - GST_SEEK_TYPE_SET, new_pos, - GST_SEEK_TYPE_NONE, GST_CLOCK_TIME_NONE); - if (res) { - ignore_state_changed = TRUE; - } - return res; -} - -static gboolean (*seek_around)(GstElement * pipeline, gint seconds, gboolean abs) = seek; - -void -set_seek_around (gboolean (*func)(GstElement * pipeline, gint seconds, gboolean abs)) -{ seek_around = func; } - - -gboolean -play (GstElement * pipeline) -{ - if (GST_STATE (pipeline) != GST_STATE_PLAYING) { - GstStateChangeReturn ret = gst_element_set_state (pipeline, GST_STATE_PLAYING); - if (ret == GST_STATE_CHANGE_FAILURE) { - return 0; - } - } - return 1; -} - -static gboolean (*play_around)(GstElement * pipeline) = play; - -void -set_play_around (gboolean (*func)(GstElement * pipeline)) -{ play_around = func; } - - -gboolean -pause (GstElement * pipeline) -{ - if (GST_STATE (pipeline) != GST_STATE_PAUSED) { - GstStateChangeReturn ret = gst_element_set_state (pipeline, GST_STATE_PAUSED); - if (ret == GST_STATE_CHANGE_FAILURE) { - return 0; - } - } - return 1; -} - -static gboolean (*pause_around)(GstElement * pipeline) = pause; -void - -set_pause_around (gboolean (*func)(GstElement * pipeline)) -{ pause_around = func; } - - -gboolean -play_pause (GstElement * pipeline) { - if (GST_STATE (pipeline) == GST_STATE_PLAYING) - return pause_around(pipeline); - else - return play_around(pipeline); -} - -static gboolean (*play_pause_around)(GstElement * pipeline) = play_pause; -void - -set_play_pause_around (gboolean (*func)(GstElement * pipeline)) -{ play_pause_around = func; } - - -static void noop1 (gpointer t) {} - -static void (*playing_started_cb)(GstElement * pipeline) = (void (*)(GstElement * pipeline))noop1; - -void -set_playing_started_cb (void (*func)(GstElement * pipeline)) -{ playing_started_cb = func; } - -static void (*playing_paused_cb)(GstElement * pipeline) = (void (*)(GstElement * pipeline))noop1; - -void -set_playing_paused_cb (void (*func)(GstElement * pipeline)) -{ playing_paused_cb = func; } - - -static void stop (GstElement * pipeline) { exit(1); } - -static void (*stop_cb)(GstElement * pipeline) = stop; - -void -set_stop_cb(void (*func)(GstElement * pipeline)) -{ stop_cb = func; } - - -static void (*unknown_key_cb)(const gchar * key) = (void (*)(const gchar * key))noop1; -void set_unknown_key_cb (void(*func)(const gchar * key)) -{ unknown_key_cb = func; } - - -gboolean -get_position (GstElement * pipeline, gint64 * pos) { - GstFormat time_format = GST_FORMAT_TIME; - return gst_element_query_position (pipeline, &time_format, pos); -} - -gboolean -get_duration (GstElement * pipeline, gint64 * dur) { - GstFormat time_format = GST_FORMAT_TIME; - return gst_element_query_duration (pipeline, &time_format, dur); -} - - -static gboolean is_shift_down = 0; - -static GstElement * get_elder(GstPad * pad) { - GstElement *elder = GST_PAD_PARENT(pad); - GstElement *gp; - while ( ( gp = GST_ELEMENT_PARENT (elder) ) ) { - elder = gp; - } - return elder; -} - -static gboolean -nav_event_cb (GstPad *pad, GstEvent * event) -{ - if (GST_EVENT_TYPE (event) == GST_EVENT_NAVIGATION) { - const GstStructure *s = gst_event_get_structure (event); - const gchar *type = gst_structure_get_string (s, "event"); - - if (!g_str_has_prefix (type, "key-")) - return TRUE; - - GstElement * pipeline = get_elder(pad); - const gchar *key = gst_structure_get_string (s, "key"); - - if (g_str_equal (type, "key-release")) { - if (g_str_equal (key, "bracketright")) - change_rate_around(pipeline, (is_shift_down) ? 2 : 1.059463094352953, FALSE); - else if (g_str_equal (key, "bracketleft")) - change_rate_around(pipeline, (is_shift_down) ? .5 : 0.9438743126816935, FALSE); - else if (g_str_equal (key, "BackSpace")) change_rate_around(pipeline, 1, TRUE); - else if (g_str_equal (key, "Right")) seek_around(pipeline, 5, FALSE); - else if (g_str_equal (key, "Down")) seek_around(pipeline, 30, FALSE); - else if (g_str_equal (key, "Left")) seek_around(pipeline, -5, FALSE); - else if (g_str_equal (key, "Up")) seek_around(pipeline, -30, FALSE); - else if (g_str_equal (key, "0")) seek_around(pipeline, 0, TRUE); - else if (g_str_has_prefix (key, "Shift")) is_shift_down = 0; - else if (g_str_equal (key, "space")) play_pause_around(pipeline); - else if (g_str_equal (key, "q")) stop_cb(pipeline); - else unknown_key_cb(key); - } - else if (g_str_equal (type, "key-press")) { - if (g_str_has_prefix (key, "Shift")) is_shift_down = 1; - } - } - - return 1; -} - -#define MAKE_ELEMENT(line, var, type, name) \ - if ( !(var = gst_element_factory_make (type, name) ) ) { \ - g_print ("element could not be created: %s/%s\n", type, name); \ - return NULL; \ - } \ - if (line) gst_bin_add (GST_BIN (line), var); - -#define LINK_ELEMENTS(src, sink) \ - if (!gst_element_link (src, sink)) { \ - g_warning ("Failed to link elements: %s -> %s", \ - GST_ELEMENT_NAME (src), GST_ELEMENT_NAME (sink) ); \ - return NULL; \ - } - -static void -state_changed_cb (GstBus * bus, GstMessage * message, GstElement * pipeline) -{ - if ( GST_ELEMENT (GST_MESSAGE_SRC (message)) != pipeline ) - return; - - /* - const GstStructure *s = gst_message_get_structure (message); - g_print ("\nmessage from \"%s\" (%s): ", - GST_STR_NULL (gst_element_get_name (GST_MESSAGE_SRC (message))), - gst_message_type_get_name (GST_MESSAGE_TYPE (message))); - if (s) { - gchar *sstr = gst_structure_to_string (s); - g_print ("%s\n", sstr); - g_free (sstr); - } else { - g_print ("no message details\n"); - } - */ - - GstState old, new, pending; - gst_message_parse_state_changed (message, &old, &new, &pending); - - if (pending == GST_STATE_VOID_PENDING) { - if (ignore_state_changed) { - ignore_state_changed = FALSE; - } else if (new == GST_STATE_PAUSED) { - playing_paused_cb (pipeline); - } else if (new == GST_STATE_PLAYING) { - playing_started_cb(pipeline); - } - } -} - -GstElement * -build_pipeline (const gchar * uri, const gchar * filter_name) -{ - g_print ("Trying to play %s ...\n", uri); - g_print (" filter: %s\n", filter_name); - - GstElement *playbin, *vsink; - MAKE_ELEMENT(NULL, playbin, "playbin", "playbin"); - MAKE_ELEMENT(NULL, vsink, "gconfvideosink", "vsink"); - g_object_set (G_OBJECT (playbin), "uri", uri, NULL); - g_object_set (G_OBJECT (playbin), "video_sink", vsink, NULL); - - GstElement *audioline = gst_bin_new ("audioline"); - GstElement *filter, *format, *resample, *asink; - MAKE_ELEMENT(audioline, filter, filter_name, "filter"); - MAKE_ELEMENT(audioline, format, "audioconvert", "format"); - MAKE_ELEMENT(audioline, resample, "audioresample", "resample"); - MAKE_ELEMENT(audioline, asink, "gconfaudiosink", "audio_sink"); - LINK_ELEMENTS(filter, format); - LINK_ELEMENTS(format, resample); - LINK_ELEMENTS(resample, asink); - - if (g_signal_lookup ("rate-changed", G_OBJECT_TYPE (filter))) { - g_signal_connect (G_OBJECT (filter), "rate-changed", G_CALLBACK (rate_changed_handler), NULL); - } else { - g_print (" ** Warning: filter does not emit rate-change: UI will not display rate\n"); - } - - GstPad * ghostpad = gst_element_get_pad (filter, "sink"); - gst_element_add_pad (audioline, gst_ghost_pad_new ("sink", ghostpad)); - gst_object_unref (ghostpad); - g_object_set (G_OBJECT (playbin), "audio-sink", audioline, NULL); - - gst_pad_add_event_probe(gst_element_get_pad(vsink, "sink"), G_CALLBACK (nav_event_cb), NULL); - - GstBus *bus = gst_pipeline_get_bus (GST_PIPELINE (playbin)); - gst_bus_add_signal_watch (bus); - g_signal_connect (bus, "message::state-changed", G_CALLBACK (state_changed_cb), playbin); - gst_object_unref (bus); - return playbin; -} diff --git a/src/play.h b/src/play.h deleted file mode 100644 index 161c2ae..0000000 --- a/src/play.h +++ /dev/null @@ -1,46 +0,0 @@ -/* play.h - * Copyright (C) 2008 Rov Juvano - * - * 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 . - */ - -#ifndef _MY_APP_PLAY_H_INCLUDED_ -#define _MY_APP_PLAY_H_INCLUDED_ - -#include - -GstElement * build_pipeline (const gchar * uri, const gchar * filter_name); - -gboolean change_rate (GstElement * pipeline, gfloat new_rate, gboolean abs); -gboolean seek (GstElement * pipeline, gint seconds, gboolean abs); -gboolean play (GstElement * pipeline); -gboolean pause (GstElement * pipeline); -gboolean play_pause (GstElement * pipeline); - -gboolean get_position (GstElement * pipeline, gint64 * pos); -gboolean get_duration (GstElement * pipeline, gint64 * dur); - -void set_change_rate_around (gboolean (*change_rate)(GstElement * pipeline, gfloat rate, gboolean abs)); -void set_rate_changed_cb (void (*rate_changed)(GstElement * object, gdouble new_rate, gpointer data)); -void set_seek_around (gboolean (*seek)(GstElement * pipeline, gint seconds, gboolean abs)); -void set_play_around (gboolean (*play)(GstElement * pipeline)); -void set_pause_around (gboolean (*pause)(GstElement * pipeline)); -void set_playing_started_cb (void (*func)(GstElement * pipeline)); -void set_playing_paused_cb (void (*func)(GstElement * pipeline)); -void set_play_pause_around (gboolean (*play_pause)(GstElement * pipeline)); -void set_stop_cb (void (*stop)(GstElement * pipeline)); -void set_unknown_key_cb (void(*unknown_key)(const gchar * key)); - -#endif /* _MY_APP_PLAY_H_INCLUDED_ */ - diff --git a/src/tui.c b/src/tui.c deleted file mode 100644 index 3db77d4..0000000 --- a/src/tui.c +++ /dev/null @@ -1,162 +0,0 @@ -/* tui.c - * Copyright (C) 2008 Rov Juvano - * - * 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 . - */ - -#include "tui.h" - -static GMainLoop *loop; - -static int stop_osd = 0; -static int clear_osd = 0; -#define CLEAR_OSD_TIME "\r " -#define CLEAR_OSD_OTHER " " -#define APPEND_OSD(pipe, msg...) \ - g_print (CLEAR_OSD_TIME CLEAR_OSD_OTHER); \ - (pipe)?print_osd_time (pipe):g_print (CLEAR_OSD_TIME); \ - g_print (" " msg); \ - clear_osd = 3; -#define OSD_ERROR(msg...) APPEND_OSD(NULL, msg); - -static void -print_osd_time (GstElement * pipeline) -{ - GstFormat time_format; - gint64 dur, pos; - - if (clear_osd == 1) g_print (CLEAR_OSD_TIME CLEAR_OSD_OTHER); - if (clear_osd > 0) clear_osd--; - - time_format = GST_FORMAT_TIME; - if (gst_element_query_duration (pipeline, &time_format, &dur) && - gst_element_query_position (pipeline, &time_format, &pos) ) { - g_print ("\r %" GST_TIME_FORMAT " / %" GST_TIME_FORMAT, - GST_TIME_ARGS (pos), GST_TIME_ARGS (dur)); - } else { - g_print ("\r Could not read position and duration"); - } -} - -static int print_osd_time_cb (gpointer data) { - print_osd_time(GST_ELEMENT_CAST (data)); - if (stop_osd) { - stop_osd = 0; - return 0; - } - return 1; -} - -static gboolean -tui_change_rate (GstElement * pipeline, gfloat rate, gboolean abs) -{ - if (abs) { APPEND_OSD (pipeline, "changing rate to %3.2f", rate) } - else { APPEND_OSD (pipeline, "changing rate by %3.2f", rate); } - if (!change_rate(pipeline, rate, abs)) { - OSD_ERROR ("rate change failed!\n"); - } - return 1; -} - -static void -tui_rate_changed (GstElement * object, gdouble new_rate, gpointer data) -{ - APPEND_OSD (object, "Rate changed to: %3.2f", new_rate); -} - -static gboolean -tui_seek (GstElement * pipeline, gint seconds, gboolean abs) -{ - if (abs) { APPEND_OSD (pipeline, "seeking to %3i", seconds) } - else { APPEND_OSD (pipeline, "seeking %3i seconds", seconds); } - if (!seek(pipeline, seconds, abs)) { - OSD_ERROR ("seek failed!\n"); - } - return 1; -} - - -static gboolean -tui_play (GstElement * pipeline) -{ - APPEND_OSD (pipeline, "PLAY pipeline"); - if (play(pipeline)) - g_timeout_add(1000, print_osd_time_cb, pipeline); - else { - OSD_ERROR ("PLAY failed\n"); - } - return 1; -} - -static gboolean -tui_pause (GstElement * pipeline) -{ - APPEND_OSD (pipeline, "PAUSE pipeline"); - if (pause(pipeline)) - stop_osd = 1; - else { - OSD_ERROR ("PAUSE failed\n"); - } - return 1; -} - -static void -tui_stop (GstElement * pipeline) { - g_main_loop_quit (loop); -} - - -static void -tui_unknown_key (const gchar * key) { - if (g_str_equal (key, "Return")) { - g_print ("\n"); - } else { - OSD_ERROR ("key: %s", key); - } -} - - -static void tui_playing_started (GstElement * pipeline) { - APPEND_OSD (pipeline, "PLAYING Started"); -} - -static void tui_playing_paused (GstElement * pipeline) { - APPEND_OSD (pipeline, "PLAYING Paused"); -} - - -void tui_play_uri (const gchar *uri, const gchar * filter_name) { - GstElement * pipeline = build_pipeline (uri, filter_name); - if (!pipeline) { - OSD_ERROR ("An error occured building pipeline for: %s\n", uri); - return; - } - - set_change_rate_around (tui_change_rate); - set_rate_changed_cb (tui_rate_changed); - set_seek_around (tui_seek); - set_play_around (tui_play); - set_playing_started_cb (tui_playing_started); - set_playing_paused_cb (tui_playing_paused); - set_pause_around (tui_pause); - set_stop_cb (tui_stop); - set_unknown_key_cb (tui_unknown_key); - - loop = g_main_loop_new (NULL, FALSE); - tui_play (pipeline); - g_main_loop_run (loop); - - gst_element_set_state (pipeline, GST_STATE_NULL); - gst_object_unref (pipeline); -} diff --git a/src/tui.h b/src/tui.h deleted file mode 100644 index 5d56446..0000000 --- a/src/tui.h +++ /dev/null @@ -1,27 +0,0 @@ -/* tui.h - * Copyright (C) 2008 Rov Juvano - * - * 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 . - */ - -#ifndef _MY_APP_TUI_H_INCLUDED_ -#define _MY_APP_TUI_H_INCLUDED_ - -#include -#include "play.h" - -void tui_play_uri (const gchar * uri, const gchar * filter_name); - -#endif /* _MY_APP_TUI_H_INCLUDED_ */ - -- 2.11.4.GIT