Commit 3d6ef15b authored by hark's avatar hark
Browse files

some stuff

parent 97bea5d9
...@@ -11,3 +11,7 @@ c-player-debug ...@@ -11,3 +11,7 @@ c-player-debug
rot13 rot13
switchs switchs
tcpclient tcpclient
c-player-np
midicontrol
valgrind.sh
...@@ -31,13 +31,16 @@ c-player-0.10 : c-player.c ...@@ -31,13 +31,16 @@ c-player-0.10 : c-player.c
gcc -DTESTING -DGTK -g c-player.c wraps.c playlist.c snowbin.c teebin.c -o c-player-0.10 `pkg-config --cflags --libs gstreamer-interfaces-0.10 gstreamer-pbutils-0.10 gtk+-2.0 gstreamer-0.10` $(CFLAGS) gcc -DTESTING -DGTK -g c-player.c wraps.c playlist.c snowbin.c teebin.c -o c-player-0.10 `pkg-config --cflags --libs gstreamer-interfaces-0.10 gstreamer-pbutils-0.10 gtk+-2.0 gstreamer-0.10` $(CFLAGS)
c-player-debug : c-player.c c-player-debug : c-player.c
gcc -D TT -DTESTING -DGTK -DGST1 -g c-player.c wraps.c playlist.c snowbin.c teebin.c -o c-player-debug `pkg-config --cflags --libs gtk+-2.0 gstreamer-1.0 gstreamer-pbutils-1.0 gstreamer-video-1.0` $(CFLAGS) gcc -DTT -DTESTING -DGTK -DGST1 -g c-player.c wraps.c playlist.c snowbin.c teebin.c -o c-player-debug `pkg-config --cflags --libs gtk+-2.0 gstreamer-1.0 gstreamer-pbutils-1.0 gstreamer-video-1.0` $(CFLAGS)
c-player : c-player.c snowbin.c playlist.c teebin.c wraps.c c-player-np : c-player.c snowbin.c teebin.c wraps.c common.h
gcc -DFP -DGTK -DGST1 -g c-player.c wraps.c playlist.c snowbin.c teebin.c -o c-player `pkg-config --cflags --libs gtk+-2.0 gstreamer-1.0 gstreamer-pbutils-1.0 gstreamer-video-1.0` $(CFLAGS) gcc -DFP -DGTK -DGST1 -g c-player.c wraps.c snowbin.c teebin.c -o c-player-np `pkg-config --cflags --libs gtk+-2.0 gstreamer-1.0 gstreamer-pbutils-1.0 gstreamer-video-1.0` $(CFLAGS)
c-player-cli : c-player.c c-player : c-player.c snowbin.c playlist.c teebin.c wraps.c common.h playlist.h teebin.h
gcc -DGST1 -g c-player.c wraps.c playlist.c snowbin.c teebin.c -o c-player-cli `pkg-config --cflags --libs gtk+-2.0 gstreamer-1.0 gstreamer-pbutils-1.0 gstreamer-video-1.0` $(CFLAGS) gcc -DSNOWBIN -DFP -DPL -DGTK -DGST1 -g c-player.c wraps.c playlist.c snowbin.c teebin.c -o c-player `pkg-config --cflags --libs gtk+-2.0 gstreamer-1.0 gstreamer-pbutils-1.0 gstreamer-video-1.0` $(CFLAGS)
c-player-cli : c-player.c snowbin.c teebin.c wraps.c common.h
gcc -DGST1 -g c-player.c wraps.c snowbin.c teebin.c -o c-player-cli `pkg-config --cflags --libs gtk+-2.0 gstreamer-1.0 gstreamer-pbutils-1.0 gstreamer-video-1.0` $(CFLAGS)
......
...@@ -19,14 +19,20 @@ ...@@ -19,14 +19,20 @@
#include <string.h> #include <string.h>
#include "common.h" #include "common.h"
#ifdef PL
#include "playlist.h" #include "playlist.h"
#include "teebin.h" #endif
#include "rtmpbin.h" #include "rtmpbin.h"
//#ifndef GST1
#ifdef SNOWBIN
#include "teebin.h"
#include "snowbin.h" #include "snowbin.h"
//#endif #endif
// player things // player things
/*
static const char *playuri = NULL; static const char *playuri = NULL;
static char *feedname = NULL; static char *feedname = NULL;
static int preview = 0; static int preview = 0;
...@@ -34,7 +40,7 @@ static GstStateChangeReturn ret; ...@@ -34,7 +40,7 @@ static GstStateChangeReturn ret;
static GstBus *bus; static GstBus *bus;
// snowbin or auto // snowbin or auto
static gchar *sink = "snowbin"; static gchar *sink = "snowbin";
*/
//Gtk things //Gtk things
#ifdef GTK #ifdef GTK
...@@ -52,25 +58,32 @@ GError *error = NULL; ...@@ -52,25 +58,32 @@ GError *error = NULL;
#endif #endif
#ifdef TT #ifdef TT
static GSourceFunc set_time (char * markup_time)
{
gtk_label_set_text(GTK_LABEL(label_time), markup_time );
printf("test: %s", markup_time);
}
static gpointer thread_time_func( gpointer data ) static gpointer thread_time_func( gpointer data )
{ {
int i; auto int i;
gchar * markup_time;
auto gchar * markup_time;
while(1) while(1)
{ {
sleep(0.2); sleep(1);
i = i + 1; i = i + 1;
gchar *markup_time = g_markup_printf_escaped ("Time fucktime, i:%u", i); markup_time = g_markup_printf_escaped ("i:%u", i);
gdk_threads_enter(); // > that is depreciated gdk_threads_enter();
gdk_threads_add_idle ((GSourceFunc)set_time,markup_time);
gtk_label_set_text(GTK_LABEL(data), markup_time ); // > that is depreciated gdk_threads_leave();
gdk_threads_leave();
g_free(markup_time); g_free(markup_time);
} }
g_free(i);
} }
#endif #endif
...@@ -83,7 +96,7 @@ static gpointer thread_time_func( gpointer data ) ...@@ -83,7 +96,7 @@ static gpointer thread_time_func( gpointer data )
static void static void
realize_cb (GtkWidget * widget, PlayerData * data) realize_cb (GtkWidget * widget, PlayerData * data)
{ {
GdkWindow *window = gtk_widget_get_window (widget); auto GdkWindow *window = gtk_widget_get_window (widget);
static guintptr window_handle; static guintptr window_handle;
if (!gdk_window_ensure_native (window)) if (!gdk_window_ensure_native (window))
...@@ -148,7 +161,7 @@ load_uri (const gchar * uri) ...@@ -148,7 +161,7 @@ load_uri (const gchar * uri)
#ifdef GTK #ifdef GTK
markup = markup =
g_markup_printf_escaped g_markup_printf_escaped
("<span foreground=\"red\" size=\"x-large\">%s</span>", uri); ("<span foreground=\"red\" size=\"x-small\">%s</span>", uri);
gtk_label_set_markup (GTK_LABEL (loaded_label), markup); gtk_label_set_markup (GTK_LABEL (loaded_label), markup);
#endif #endif
// gst_element_set_state (pData->playbin2, GST_STATE_PLAYING); // gst_element_set_state (pData->playbin2, GST_STATE_PLAYING);
...@@ -158,23 +171,20 @@ load_uri (const gchar * uri) ...@@ -158,23 +171,20 @@ load_uri (const gchar * uri)
static void static void
preview_cb (GtkCheckButton * preview_check, PlayerData * data) preview_cb (GtkCheckButton * preview_check, PlayerData * data)
{ {
while (TRUE) if (data->preview == 0)
{
if (preview == 0)
{ {
g_print ("turning on preview checkcb \n"); // g_print ("turning on preview checkcb \n");
teebin_preview_on(data); teebin_preview_on(data);
preview = 1; data->preview = 1;
break; return;
} }
if (preview == 1) if (data->preview == 1)
{ {
g_print ("turning off preview checkcb \n"); // g_print ("turning off preview checkcb \n");
teebin_preview_off(data); teebin_preview_off(data);
preview = 0; data->preview = 0;
break; return;
} }
}
} }
#endif #endif
...@@ -222,7 +232,7 @@ expose_cb (GtkWidget * widget, GdkEventExpose * event, PlayerData * data) ...@@ -222,7 +232,7 @@ expose_cb (GtkWidget * widget, GdkEventExpose * event, PlayerData * data)
static void static void
slider_cb (GtkRange * range, PlayerData * data) slider_cb (GtkRange * range, PlayerData * data)
{ {
gdouble value = gtk_range_get_value (GTK_RANGE (data->slider)); auto gdouble value = gtk_range_get_value (GTK_RANGE (data->slider));
gst_element_seek_simple (data->playbin2, GST_FORMAT_TIME, gst_element_seek_simple (data->playbin2, GST_FORMAT_TIME,
GST_SEEK_FLAG_FLUSH | GST_SEEK_FLAG_KEY_UNIT, GST_SEEK_FLAG_FLUSH | GST_SEEK_FLAG_KEY_UNIT,
(gint64) (value * GST_SECOND)); (gint64) (value * GST_SECOND));
...@@ -243,7 +253,7 @@ create_ui (PlayerData * data) ...@@ -243,7 +253,7 @@ create_ui (PlayerData * data)
static GtkWidget *options; /* HBox to hold the options and current uri */ static GtkWidget *options; /* HBox to hold the options and current uri */
static GtkWidget *play_button, *pause_button, *stop_button, *open_button, *add_button; /* Buttons */ static GtkWidget *play_button, *pause_button, *stop_button, *open_button, *add_button; /* Buttons */
static GtkWidget *test_button, *previous_button, *next_button; static GtkWidget *test_button, *previous_button, *next_button;
static GtkWidget *preview_check; /* Checkbuttons */ // static GtkWidget *preview_check; /* Checkbuttons */
// this should be done by playlist // this should be done by playlist
// GtkWidget *loop_check; /* Checkbuttons */ // GtkWidget *loop_check; /* Checkbuttons */
...@@ -261,18 +271,19 @@ create_ui (PlayerData * data) ...@@ -261,18 +271,19 @@ create_ui (PlayerData * data)
data); data);
/* make the feed label that will change color based on playing state */ /* make the feed label that will change color based on playing state */
feed_label = gtk_label_new(NULL);
markup = markup =
g_markup_printf_escaped g_markup_printf_escaped
("<span foreground=\"red\" size=\"x-large\">%s</span>", feedname); ("<span foreground=\"red\" size=\"x-large\">F: %u --</span>", data->feedid);
feed_label = gtk_label_new (feedname); gtk_label_set_markup (GTK_LABEL(feed_label), markup);
gtk_label_set_markup (GTK_LABEL (feed_label), markup);
g_free (markup); g_free (markup);
loaded_label = gtk_label_new(NULL);
markup = markup =
g_markup_printf_escaped g_markup_printf_escaped
("<span foreground=\"red\" size=\"x-large\">currently loaded uri</span>"); ("<span foreground=\"red\" size=\"x-small\">currently loaded uri</span>");
loaded_label = gtk_label_new (feedname); gtk_label_set_markup (GTK_LABEL(loaded_label), markup);
gtk_label_set_markup (GTK_LABEL (loaded_label), markup);
g_free (markup); g_free (markup);
markup = markup =
...@@ -296,11 +307,11 @@ create_ui (PlayerData * data) ...@@ -296,11 +307,11 @@ create_ui (PlayerData * data)
g_signal_connect (G_OBJECT (stop_button), "clicked", G_CALLBACK (stop_cb), g_signal_connect (G_OBJECT (stop_button), "clicked", G_CALLBACK (stop_cb),
data); data);
preview_check = gtk_check_button_new_with_label ("preview current video"); data->preview_check = gtk_check_button_new_with_label ("preview current video");
g_signal_connect (G_OBJECT (preview_check), "toggled", g_signal_connect (G_OBJECT (data->preview_check), "toggled",
G_CALLBACK (preview_cb), data); G_CALLBACK (preview_cb), data);
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(preview_check), TRUE); // gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(preview_check), TRUE);
// uri_entrybox = gtk_entry_new (); // uri_entrybox = gtk_entry_new ();
...@@ -326,10 +337,7 @@ thread_time = g_thread_create( thread_time_func, (gpointer)label_time, FALSE, &e ...@@ -326,10 +337,7 @@ thread_time = g_thread_create( thread_time_func, (gpointer)label_time, FALSE, &e
gtk_box_pack_start (GTK_BOX (controls), play_button, FALSE, FALSE, 2); gtk_box_pack_start (GTK_BOX (controls), play_button, FALSE, FALSE, 2);
gtk_box_pack_start (GTK_BOX (controls), pause_button, FALSE, FALSE, 2); gtk_box_pack_start (GTK_BOX (controls), pause_button, FALSE, FALSE, 2);
gtk_box_pack_start (GTK_BOX (controls), stop_button, FALSE, FALSE, 2); gtk_box_pack_start (GTK_BOX (controls), stop_button, FALSE, FALSE, 2);
gtk_box_pack_start (GTK_BOX (controls), preview_check, FALSE, FALSE, 2); gtk_box_pack_start (GTK_BOX (controls), data->preview_check, FALSE, FALSE, 2);
/* options */ /* options */
options = gtk_vbox_new (FALSE, 0); options = gtk_vbox_new (FALSE, 0);
...@@ -356,13 +364,15 @@ thread_time = g_thread_create( thread_time_func, (gpointer)label_time, FALSE, &e ...@@ -356,13 +364,15 @@ thread_time = g_thread_create( thread_time_func, (gpointer)label_time, FALSE, &e
gtk_box_pack_start (GTK_BOX (main_box), options, FALSE, FALSE, 0); gtk_box_pack_start (GTK_BOX (main_box), options, FALSE, FALSE, 0);
gtk_box_pack_start (GTK_BOX (main_box), controls, FALSE, FALSE, 0); gtk_box_pack_start (GTK_BOX (main_box), controls, FALSE, FALSE, 0);
#ifdef PL
/* init playlist */ /* init playlist */
playlist_box = playlist_init_gtk (); playlist_box = playlist_init_gtk ();
// pack the playlist // pack the playlist
gtk_box_pack_start (GTK_BOX (main_box), playlist_box, TRUE, TRUE, 0); gtk_box_pack_start (GTK_BOX (main_box), playlist_box, TRUE, TRUE, 0);
load_uri (playlist_get_current ()); load_uri (playlist_get_current ());
#endif
gtk_container_add (GTK_CONTAINER (main_window), main_box); gtk_container_add (GTK_CONTAINER (main_window), main_box);
gtk_window_set_default_size (GTK_WINDOW (main_window), 640, 480); gtk_window_set_default_size (GTK_WINDOW (main_window), 640, 480);
...@@ -376,9 +386,11 @@ thread_time = g_thread_create( thread_time_func, (gpointer)label_time, FALSE, &e ...@@ -376,9 +386,11 @@ thread_time = g_thread_create( thread_time_func, (gpointer)label_time, FALSE, &e
static int static int
refresh_ui (PlayerData * data) refresh_ui (PlayerData * data)
{ {
GstFormat fmt = GST_FORMAT_TIME; auto GstFormat fmt = GST_FORMAT_TIME;
gint64 current = -1; auto gint64 current = -1;
// printf("refresh_ui state: %u paused=%u \n", data->state, GST_STATE_PAUSED); auto char *nicetime;
auto int sec, min, hour, time;
// printf("refresh_ui state: %u paused=%u \n", data->state, GST_STATE_PAUSED);
/* We do not want to update anything unless we are in the PAUSED or PLAYING states */ /* We do not want to update anything unless we are in the PAUSED or PLAYING states */
if (data->state < GST_STATE_PAUSED) if (data->state < GST_STATE_PAUSED)
return TRUE; return TRUE;
...@@ -422,9 +434,7 @@ refresh_ui (PlayerData * data) ...@@ -422,9 +434,7 @@ refresh_ui (PlayerData * data)
/* Re-enable the signal */ /* Re-enable the signal */
g_signal_handler_unblock (data->slider, data->slider_update_signal_id); g_signal_handler_unblock (data->slider, data->slider_update_signal_id);
//char *nicetime = "00:00:00"; //char *nicetime = "00:00:00";
char *nicetime; time = current / GST_SECOND;
int sec, min, hour, time;
time = current / GST_SECOND;
hour = time / 3600; hour = time / 3600;
min = time % 3600 / 60; min = time % 3600 / 60;
sec = time % 60; sec = time % 60;
...@@ -447,10 +457,11 @@ player_reset_and_play () ...@@ -447,10 +457,11 @@ player_reset_and_play ()
/* stop playing */ /* stop playing */
gst_element_set_state (pData->playbin2, GST_STATE_READY); gst_element_set_state (pData->playbin2, GST_STATE_READY);
#ifdef PL
printf("current uri: %s", playlist_get_current()); printf("current uri: %s", playlist_get_current());
load_uri(playlist_get_current()); load_uri(playlist_get_current());
#endif
// static int ret; int ret = 0;
/* Start playing */ /* Start playing */
ret = gst_element_set_state (pData->playbin2, GST_STATE_PLAYING); ret = gst_element_set_state (pData->playbin2, GST_STATE_PLAYING);
if (ret == GST_STATE_CHANGE_FAILURE) if (ret == GST_STATE_CHANGE_FAILURE)
...@@ -486,8 +497,8 @@ tags_cb (GstElement * playbin2, gint stream, PlayerData * data) ...@@ -486,8 +497,8 @@ tags_cb (GstElement * playbin2, gint stream, PlayerData * data)
static void static void
error_cb (GstBus * bus, GstMessage * msg, PlayerData * data) error_cb (GstBus * bus, GstMessage * msg, PlayerData * data)
{ {
GError *err; auto GError *err;
gchar *debug_info; auto gchar *debug_info;
/* Print error details on the screen */ /* Print error details on the screen */
gst_message_parse_error (msg, &err, &debug_info); gst_message_parse_error (msg, &err, &debug_info);
...@@ -547,10 +558,13 @@ eos_cb (GstBus * bus, GstMessage * msg, PlayerData * data) ...@@ -547,10 +558,13 @@ eos_cb (GstBus * bus, GstMessage * msg, PlayerData * data)
static void static void
state_changed_cb (GstBus * bus, GstMessage * msg, PlayerData * data) state_changed_cb (GstBus * bus, GstMessage * msg, PlayerData * data)
{ {
GstState old_state, new_state, pending_state; auto GstState old_state, new_state, pending_state;
auto GstFormat fmt = GST_FORMAT_TIME;
char feedname[10] = "F:00";
snprintf(&feedname, sizeof(feedname), "F:%u", data->feedid);
gst_message_parse_state_changed (msg, &old_state, &new_state, gst_message_parse_state_changed (msg, &old_state, &new_state,
&pending_state); &pending_state);
GstFormat fmt = GST_FORMAT_TIME;
#ifdef GTK #ifdef GTK
refresh_ui(data); refresh_ui(data);
#endif #endif
...@@ -664,13 +678,14 @@ state_changed_cb (GstBus * bus, GstMessage * msg, PlayerData * data) ...@@ -664,13 +678,14 @@ state_changed_cb (GstBus * bus, GstMessage * msg, PlayerData * data)
static void static void
analyze_streams (PlayerData * data) analyze_streams (PlayerData * data)
{ {
gint i; auto gint i;
GstTagList *tags; auto GstTagList *tags;
gchar *str, *total_str; auto gchar *str, *total_str;
guint rate; auto guint rate;
gint n_video, n_audio, n_text; auto gint n_video, n_audio, n_text;
GtkTextBuffer *text;
#ifdef GTK #ifdef GTK
auto GtkTextBuffer *text;
/* Clean current contents of the widget */ /* Clean current contents of the widget */
text = gtk_text_view_get_buffer (GTK_TEXT_VIEW (data->streams_list)); text = gtk_text_view_get_buffer (GTK_TEXT_VIEW (data->streams_list));
gtk_text_buffer_set_text (text, "", -1); gtk_text_buffer_set_text (text, "", -1);
...@@ -724,7 +739,9 @@ analyze_streams (PlayerData * data) ...@@ -724,7 +739,9 @@ analyze_streams (PlayerData * data)
if (gst_tag_list_get_string (tags, GST_TAG_AUDIO_CODEC, &str)) if (gst_tag_list_get_string (tags, GST_TAG_AUDIO_CODEC, &str))
{ {
total_str = g_strdup_printf (" codec: %s\n", str); total_str = g_strdup_printf (" codec: %s\n", str);
#ifdef GTK
gtk_text_buffer_insert_at_cursor (text, total_str, -1); gtk_text_buffer_insert_at_cursor (text, total_str, -1);
#endif
g_free (total_str); g_free (total_str);
g_free (str); g_free (str);
} }
...@@ -808,47 +825,48 @@ application_cb (GstBus * bus, GstMessage * msg, PlayerData * data) ...@@ -808,47 +825,48 @@ application_cb (GstBus * bus, GstMessage * msg, PlayerData * data)
#endif #endif
} }
static void init_media() static void init_media(PlayerData *data)
{ {
GstBus *bus;
pData->duration = GST_CLOCK_TIME_NONE;
pData->state = GST_STATE_NULL;
/* Initialize GStreamer */ /* Initialize GStreamer */
gst_init (NULL, NULL); gst_init (NULL, NULL);
pData->duration = GST_CLOCK_TIME_NONE; /* Create the elements */
/* Create the elements */
#ifdef GST1 #ifdef GST1
pData->playbin2 = gst_element_factory_make ("playbin", "playbin2"); pData->playbin2 = gst_element_factory_make ("playbin", "playbin2");
#else #else
pData->playbin2 = gst_element_factory_make ("playbin2", "playbin2"); pData->playbin2 = gst_element_factory_make ("playbin2", "playbin2");
#endif #endif
// g_print ("sink: %s \n", sink);
GstElement *videosink, *audiosink;
videosink = gst_element_factory_make("xvimagesink", "xvimagesink");
// videosink = gst_element_factory_make("fakesink", "fakesink");
g_print ("sink: %s \n", sink);
#define SNOWBIN
#ifdef SNOWBIN
GstElement *audiosink, *xvimagesink;
xvimagesink = gst_element_factory_make("xvimagesink", "xvimagesink"); #ifdef SNOWBIN
gst_element_factory_make("xvimagesink", "xvimagesink");
/*set snowvideobin as sink */ /*set snowvideobin as sink */
g_object_set (pData->playbin2, "video-sink", g_object_set (pData->playbin2, "video-sink",
create_teebin(xvimagesink, get_snowvideobin(pData->snow)), NULL); create_teebin(videosink, get_snowvideobin(pData->snow)), NULL);
/*set snowaudiobin as sink */ /*set snowaudiobin as sink */
audiosink = get_snowaudiobin(pData->snow); audiosink = get_snowaudiobin(pData->snow);
g_object_set (pData->playbin2, "audio-sink",audiosink, NULL); g_object_set (pData->playbin2, "audio-sink",audiosink, NULL);
#else #else
/*
g_print ("autosink \n"); g_print ("autosink \n");
GstElement *videosink, *audiosink;
videosink = gst_element_factory_make ("xvimagesink", "xvimagesink");
audiosink = gst_element_factory_make ("autoaudiosink", "autoaudiosink"); audiosink = gst_element_factory_make ("autoaudiosink", "autoaudiosink");
// audiosink = gst_element_factory_make ("fakesink", "fakesink");
g_object_set (pData->playbin2, "video-sink", videosink, NULL); g_object_set (pData->playbin2, "video-sink", videosink, NULL);
g_object_set (pData->playbin2, "audio-sink", audiosink, NULL); g_object_set (pData->playbin2, "audio-sink", audiosink, NULL);
g_print (" SNOWBIN is not defined (port it to gst1.0)");
*/ g_print (" SNOWBIN is not defined, so we are not using it! \n ");
#endif #endif
if (!pData->playbin2) if (!pData->playbin2)
...@@ -889,34 +907,95 @@ static void init_media() ...@@ -889,34 +907,95 @@ static void init_media()
} }
static void cleanup() {
// this needs to be called from the main thread!
//global pData
g_print ("Cleaning up\n");
g_print ("Deleting pipeline\n");
gst_element_set_state (pData->playbin2, GST_STATE_NULL);
gst_object_unref (GST_OBJECT (pData->playbin2));
// g_source_remove (bus_watch_id);
#ifdef GTK
gtk_main_quit();
#else
g_main_loop_unref (pData->loop);
#endif
free(pData);
exit(0);
}
static int signal_handler(PlayerData * data) {
printf(" \n Signal caught: %u \n ", 10);
cleanup();
}
int int
main (int argc, char *argv[]) main (int argc, char *argv[])
{ {
/* deal with command line arguments */ /* deal with command line arguments */
// feed, filename, // feed, filename,
int opt = 0; auto int opt = 0;
int feedid = 1; // auto int feedid = 1;
int audiosink = 23; auto int audiosink = 23;
g_unix_signal_add(SIGUSR1, (GSourceFunc)signal_handler, pData);
g_unix_signal_add(SIGTERM, (GSourceFunc)signal_handler, pData);
g_unix_signal_add(SIGINT, (GSourceFunc)signal_handler, pData);
//test for valgrind
malloc(10);
// signal(15, signal_handler);
// signal(9, signal_handler);
// signal(15, signal_handler);
/*
if (signal(SIGTERM, signal_handler)) {
fputs("An error occurred while setting a signal handler.\n", stderr);
return EXIT_FAILURE;
}
*/
/* Initialize our global data structures */ /* Initialize our global data structures */
pData = (PlayerData*)malloc(sizeof(struct PlayerData)); pData = (PlayerData*)malloc(sizeof(struct PlayerData));
snowbin_init_snowData(pData);
#ifdef SNOWBIN
snowbin_init_snowData(pData);
#endif
while ((opt = getopt (argc, argv, "i:f:a:s:")) != -1) while ((opt = getopt (argc, argv, "i:f:a:s:")) != -1)
{ {
switch (opt) switch (opt)
{ {
// this is something for the playlist // this only gets loaded without playlist