You can subscribe to this list here.
2007 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(28) |
Sep
(20) |
Oct
(20) |
Nov
(6) |
Dec
(1) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2008 |
Jan
(17) |
Feb
(28) |
Mar
(13) |
Apr
|
May
|
Jun
(1) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: <me...@us...> - 2007-08-22 13:06:40
|
Revision: 824 http://gmyth.svn.sourceforge.net/gmyth/?rev=824&view=rev Author: melunko Date: 2007-08-22 06:06:43 -0700 (Wed, 22 Aug 2007) Log Message: ----------- Added db_port field in the GMythBackendInfo Modified Paths: -------------- trunk/gmyth/src/gmyth_backendinfo.c trunk/gmyth/src/gmyth_backendinfo.h Modified: trunk/gmyth/src/gmyth_backendinfo.c =================================================================== --- trunk/gmyth/src/gmyth_backendinfo.c 2007-08-21 19:04:23 UTC (rev 823) +++ trunk/gmyth/src/gmyth_backendinfo.c 2007-08-22 13:06:43 UTC (rev 824) @@ -57,10 +57,11 @@ gmyth_backend_info_init(GMythBackendInfo * backend_info) { backend_info->hostname = NULL; + backend_info->port = -1; backend_info->username = NULL; backend_info->password = NULL; backend_info->db_name = NULL; - backend_info->port = -1; + backend_info->db_port = 0; backend_info->status_port = -1; } @@ -78,10 +79,11 @@ g_object_unref (backend_info->sock); backend_info->hostname = NULL; + backend_info->port = -1; backend_info->username = NULL; backend_info->password = NULL; backend_info->db_name = NULL; - backend_info->port = -1; + backend_info->db_port = 0; backend_info->status_port = -1; backend_info->sock = NULL; @@ -223,6 +225,18 @@ } void +gmyth_backend_info_set_db_port(GMythBackendInfo * backend_info, gint db_port) +{ + g_return_if_fail(backend_info != NULL); + + if (db_port <= 0) { + gmyth_debug("Error trying to set a port less than 0."); + } else { + backend_info->db_port = db_port; + } +} + +void gmyth_backend_info_set_port(GMythBackendInfo * backend_info, gint port) { g_return_if_fail(backend_info != NULL); @@ -281,6 +295,15 @@ } gint +gmyth_backend_info_get_idb_port(GMythBackendInfo * backend_info) +{ + g_return_val_if_fail(backend_info != NULL, -1); + + return backend_info->db_port; +} + + +gint gmyth_backend_info_get_port(GMythBackendInfo * backend_info) { g_return_val_if_fail(backend_info != NULL, -1); Modified: trunk/gmyth/src/gmyth_backendinfo.h =================================================================== --- trunk/gmyth/src/gmyth_backendinfo.h 2007-08-21 19:04:23 UTC (rev 823) +++ trunk/gmyth/src/gmyth_backendinfo.h 2007-08-22 13:06:43 UTC (rev 824) @@ -63,19 +63,21 @@ }; struct _GMythBackendInfo { - GObject parent; + GObject parent; /** The backend hostname or ip address. */ - gchar *hostname; + gchar *hostname; + /** The backend port. */ + gint port; /** The username to connect to the mysql server. */ - gchar *username; + gchar *username; /** The password to connect to the mysql server. */ - gchar *password; + gchar *password; /** The mythtv's mysql database name. */ - gchar *db_name; - /** The backend port. */ - gint port; + gchar *db_name; + /** The mysql database port */ + gint db_port; /** The backend status port for http connection */ - gint status_port; + gint status_port; /* Private */ GMythSocket *sock; @@ -98,6 +100,8 @@ const gchar *password); void gmyth_backend_info_set_db_name (GMythBackendInfo *backend_info, const gchar *db_name); +void gmyth_backend_info_set_db_port (GMythBackendInfo *backend_info, + gint db_port); void gmyth_backend_info_set_port (GMythBackendInfo *backend_info, gint port); void gmyth_backend_info_set_status_port (GMythBackendInfo *backend_info, @@ -106,6 +110,7 @@ const gchar* gmyth_backend_info_get_username (GMythBackendInfo *backend_info); const gchar* gmyth_backend_info_get_password (GMythBackendInfo *backend_info); const gchar* gmyth_backend_info_get_db_name (GMythBackendInfo *backend_info); +gint gmyth_backend_info_get_db_port (GMythBackendInfo *backend_info); gint gmyth_backend_info_get_port (GMythBackendInfo *backend_info); GMythURI* gmyth_backend_info_get_uri (GMythBackendInfo *backend_info); gboolean gmyth_backend_info_is_local_file (GMythBackendInfo *backend_info); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ren...@us...> - 2007-08-21 19:04:20
|
Revision: 823 http://gmyth.svn.sourceforge.net/gmyth/?rev=823&view=rev Author: renatofilho Date: 2007-08-21 12:04:23 -0700 (Tue, 21 Aug 2007) Log Message: ----------- fixed monitor_handler dispose Modified Paths: -------------- trunk/gmyth/src/gmyth_backendinfo.c trunk/gmyth/src/gmyth_file_transfer.c trunk/gmyth/src/gmyth_livetv.c trunk/gmyth/src/gmyth_monitor_handler.c trunk/gmyth/src/gmyth_monitor_handler.h trunk/gmyth/src/gmyth_socket.c Modified: trunk/gmyth/src/gmyth_backendinfo.c =================================================================== --- trunk/gmyth/src/gmyth_backendinfo.c 2007-08-21 16:14:42 UTC (rev 822) +++ trunk/gmyth/src/gmyth_backendinfo.c 2007-08-21 19:04:23 UTC (rev 823) @@ -73,14 +73,17 @@ g_free(backend_info->username); g_free(backend_info->password); g_free(backend_info->db_name); - g_object_unref (backend_info->sock); + if (backend_info->sock) + g_object_unref (backend_info->sock); + backend_info->hostname = NULL; backend_info->username = NULL; backend_info->password = NULL; backend_info->db_name = NULL; backend_info->port = -1; backend_info->status_port = -1; + backend_info->sock = NULL; G_OBJECT_CLASS(gmyth_backend_info_parent_class)->dispose(object); } Modified: trunk/gmyth/src/gmyth_file_transfer.c =================================================================== --- trunk/gmyth/src/gmyth_file_transfer.c 2007-08-21 16:14:42 UTC (rev 822) +++ trunk/gmyth/src/gmyth_file_transfer.c 2007-08-21 19:04:23 UTC (rev 823) @@ -142,8 +142,8 @@ g_signal_connect(G_OBJECT(transfer), "program-info-changed", (GCallback) (GMYTH_FILE_TRANSFER_GET_CLASS - (transfer)-> - program_info_changed_handler), NULL); + (transfer)->program_info_changed_handler), + NULL); } static void Modified: trunk/gmyth/src/gmyth_livetv.c =================================================================== --- trunk/gmyth/src/gmyth_livetv.c 2007-08-21 16:14:42 UTC (rev 822) +++ trunk/gmyth/src/gmyth_livetv.c 2007-08-21 19:04:23 UTC (rev 823) @@ -109,12 +109,12 @@ livetv->monitor = NULL; } + if (livetv->file != NULL) { g_object_unref(livetv->file); livetv->file = NULL; } - if (livetv->recorder != NULL) { // gmyth_recorder_close(livetv->recorder); g_object_unref(livetv->recorder); @@ -131,7 +131,6 @@ livetv->tvchain = NULL; } - if (livetv->proginfo != NULL) { g_object_unref(livetv->proginfo); livetv->proginfo = NULL; @@ -142,7 +141,6 @@ livetv->backend_info = NULL; } - if (livetv->uri != NULL) { g_object_unref(livetv->uri); livetv->uri = NULL; @@ -153,7 +151,6 @@ livetv->mutex = NULL; } - if (livetv->local_hostname != NULL) { g_string_free(livetv->local_hostname, TRUE); livetv->local_hostname = NULL; @@ -321,7 +318,6 @@ } livetv->monitor = gmyth_monitor_handler_new(); - res = gmyth_monitor_handler_open(livetv->monitor, livetv->backend_info->hostname, @@ -403,9 +399,8 @@ g_return_val_if_fail(livetv != NULL, FALSE); - if (NULL == livetv->socket) { + if (livetv->socket == NULL) { livetv->socket = gmyth_socket_new(); - /* * FIME: Implement this at gmyth_socket */ Modified: trunk/gmyth/src/gmyth_monitor_handler.c =================================================================== --- trunk/gmyth/src/gmyth_monitor_handler.c 2007-08-21 16:14:42 UTC (rev 822) +++ trunk/gmyth/src/gmyth_monitor_handler.c 2007-08-21 19:04:23 UTC (rev 823) @@ -70,7 +70,9 @@ #define GMYTHTV_ENABLE_DEBUG 1 #endif -gpointer gmyth_monitor_handler_listener(gpointer data); +gboolean gmyth_monitor_handler_listener (GIOChannel *io_channel, + GIOCondition condition, + gpointer data); static void gmyth_monitor_handler_default_listener(GMythMonitorHandler * monitor, @@ -92,51 +94,10 @@ void gmyth_monitor_handler_close(GMythMonitorHandler * monitor); -G_DEFINE_TYPE(GMythMonitorHandler, gmyth_monitor_handler, G_TYPE_OBJECT) - static void +G_DEFINE_TYPE(GMythMonitorHandler, gmyth_monitor_handler, G_TYPE_OBJECT); - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - gmyth_monitor_handler_class_init(GMythMonitorHandlerClass * klass) +static void +gmyth_monitor_handler_class_init(GMythMonitorHandlerClass * klass) { GObjectClass *gobject_class; GMythMonitorHandlerClass *gmonitor_class; @@ -169,23 +130,11 @@ monitor->hostname = NULL; monitor->port = 0; monitor->actual_index = 0; - monitor->allow_msgs_listener = FALSE; - /* - * monitor->backend_msgs = g_hash_table_new( g_int_hash, g_int_equal - * ); - */ - - /* * it is used for signalizing the event socket consumer thread */ monitor->mutex = g_mutex_new(); - - monitor->th = NULL; - - monitor->gmyth_monitor_handler_listener = - gmyth_monitor_handler_listener; } static void @@ -197,14 +146,9 @@ monitor->allow_msgs_listener = FALSE; - if (monitor->th != NULL) { - gboolean *ret = (gboolean *) g_thread_join(monitor->th); - - if (*ret == FALSE) - gmyth_debug("Error closing GThread listener socket!"); - else - gmyth_debug("Closed GThread listener socket."); - // g_object_unref( monitor->th ); + if (monitor->io_source != 0) { + g_source_remove (monitor->io_source); + monitor->io_source = 0; } /* @@ -226,6 +170,7 @@ monitor->hostname = NULL; } + if (monitor->backend_msgs != NULL) { g_hash_table_destroy(monitor->backend_msgs); monitor->backend_msgs = NULL; @@ -236,6 +181,7 @@ * io_watcher_cond = NULL; } */ + G_OBJECT_CLASS(gmyth_monitor_handler_parent_class)->dispose(object); } @@ -353,30 +299,22 @@ gmyth_debug("Monitor event socket --- hostname: %s, port %d\n", monitor->hostname, monitor->port); - if (NULL != monitor->event_sock) { + if (monitor->event_sock != NULL) { g_object_unref(monitor->event_sock); monitor->event_sock = NULL; } /* - * configure the event socket + * configure the event socket */ - if (NULL == monitor->event_sock) { - if (!gmyth_connect_to_backend_monitor(monitor)) { - gmyth_debug("Connection to backend failed (Event Socket)!"); - ret = FALSE; - } else { - gmyth_debug - ("Remote monitor event socket had been succesfully created. (io_fd == %d)\n", - g_io_channel_unix_get_fd(monitor->event_sock->sd_io_ch)); - } + if (!gmyth_connect_to_backend_monitor(monitor)) { + gmyth_debug("Connection to backend failed (Event Socket)!"); + ret = FALSE; } else { - gmyth_debug - ("ASSERT ERROR: Remote monitor event socket is not NULL at the setup...\n"); + gmyth_debug ("Remote monitor event socket had been succesfully create"); } return ret; - } /** @@ -493,122 +431,73 @@ * @return Pointer to a gboolean <code>true</code> value, if the data was * successfully read. */ -gpointer -gmyth_monitor_handler_listener(gpointer data) +gboolean +gmyth_monitor_handler_listener (GIOChannel *io_channel, + GIOCondition io_cond, + gpointer data) { - GMythMonitorHandler *monitor = (GMythMonitorHandler *) data; + GMythMonitorHandler *monitor; guint recv = 0; - gboolean *ret = g_new0(gboolean, 1); gsize len = 0; - GIOChannel *io_channel = monitor->event_sock->sd_io_ch; - GIOCondition io_cond = - g_io_channel_get_buffer_condition(io_channel); - static guint count = 0; + GMythStringList *strlist = NULL; + gint bytes_sent = 0; - *ret = TRUE; + monitor = (GMythMonitorHandler *) data; gmyth_debug("Entering MONITOR handler listener..."); myth_control_acquire_context(monitor, TRUE); - if ((io_cond & G_IO_HUP) != 0) { - *ret = FALSE; + if (((io_cond & G_IO_HUP) != 0) || + ((io_cond & G_IO_ERR) != 0)) { goto clean_up; } - GMythStringList *strlist = NULL; - if (NULL == io_channel) { - gmyth_debug("Monitor socket is NULL! (GIOChannel)"); - *ret = FALSE; - goto clean_up; - } + gmyth_debug("%d - Listening on Monitor socket...!\n", count); + strlist = gmyth_string_list_new(); - while (monitor->allow_msgs_listener) { - ++count; + len = gmyth_socket_read_stringlist(monitor->event_sock, strlist); + if ((len > 0) && strlist != NULL && gmyth_string_list_length(strlist) > 0) { + gchar *back_msg_action; + gint msg_type; - gmyth_debug("%d - Listening on Monitor socket...!\n", count); + bytes_sent = gmyth_string_list_get_int(strlist, 0); + // on backend error + gmyth_debug ("received data buffer from IO event channel... %d strings gone!\n", len); + recv += len; - do { + /* + * debug purpose: prints out all the string list + * elements + */ + g_list_foreach(strlist->glist, + (GFunc) gmyth_monitor_handler_print, + NULL); - gint bytes_sent = 0; + back_msg_action = g_new0(gchar, 1); + msg_type = gmyth_monitor_handler_is_backend_message(monitor, + strlist, + &back_msg_action); - strlist = gmyth_string_list_new(); - - if (monitor->event_sock != NULL) { - - len = - gmyth_socket_read_stringlist(monitor->event_sock, - strlist); - - if ((len > 0) && strlist != NULL - && gmyth_string_list_length(strlist) > 0) { - bytes_sent = gmyth_string_list_get_int(strlist, 0); // -1 - // - // - // on - // backend - // error - - gmyth_debug - ("[%s] MONITOR: received data buffer from IO event channel... %d strings gone!\n", - __FUNCTION__, len); - - recv += len; - - /* - * debug purpose: prints out all the string list - * elements - */ - g_list_foreach(strlist->glist, - (GFunc) gmyth_monitor_handler_print, - NULL); - - gchar *back_msg_action = g_new0(gchar, 1); - gint msg_type = - gmyth_monitor_handler_is_backend_message(monitor, - strlist, - &back_msg_action); - - if (monitor != NULL - && msg_type != GMYTH_BACKEND_NO_MESSAGE) - g_signal_emit(monitor, GMYTH_MONITOR_HANDLER_GET_CLASS(monitor)->backend_events_handler_signal_id, 0, /* details - */ - msg_type, back_msg_action); - - if (back_msg_action != NULL) - g_free(back_msg_action); - - } - - } - - if (strlist != NULL) { - g_object_unref(strlist); - strlist = NULL; - } - - io_cond = g_io_channel_get_buffer_condition(io_channel); - - g_usleep(500); - + if (msg_type != GMYTH_BACKEND_NO_MESSAGE) { + g_signal_emit(monitor, + GMYTH_MONITOR_HANDLER_GET_CLASS(monitor)->backend_events_handler_signal_id, + 0, msg_type, back_msg_action); } - while (recv <= 0 && ((io_cond & G_IO_HUP) == 0)); - gmyth_debug("\tMONITOR EVENT: Read %d bytes\n", recv); + if (back_msg_action != NULL) + g_free(back_msg_action); - } /* main GThread while */ + g_object_unref(strlist); + } - clean_up: +clean_up: myth_control_release_context(monitor); - - g_thread_exit(ret); - - return (gpointer) ret; - + return TRUE; } -/** +/** * Opens connection events' socket the the Monitor socket on * MythTV backend server. * @@ -616,7 +505,7 @@ * * @return <code>true</code>, if the socket was successfully opened. */ -static gboolean +static gboolean gmyth_connect_to_backend_monitor(GMythMonitorHandler * monitor) { gboolean ret = TRUE; @@ -625,7 +514,7 @@ /* * Connects the socket, send Mythtv ANN Monitor and verify Mythtv - * protocol version + * protocol version */ if (!gmyth_socket_connect_to_backend_events(monitor->event_sock, monitor->hostname, @@ -638,52 +527,38 @@ return ret; } -/** +/** * Opens connection the the Monitor socket on MythTV backend server, * where all status messages are notified to the client. - * + * * @param monitor The GMythMonitorHandler instance. * @param channel The GIOChannel instance to the Monitor socket. - * + * * @return Pointer to the boolean value, and it is <code>true</code> only if the - * GMythMonitorHandler could be configured. + * GMythMonitorHandler could be configured. */ -static gboolean +static gboolean gmyth_monitor_handler_setup(GMythMonitorHandler * monitor, GIOChannel * channel) { - gboolean ret = TRUE; + gboolean ret = TRUE; if (channel != NULL) { monitor->allow_msgs_listener = TRUE; - - monitor->th = - g_thread_create((GThreadFunc) gmyth_monitor_handler_listener, - monitor, TRUE, NULL); - gmyth_debug("MONITOR GThread created!"); + monitor->io_source = g_io_add_watch (channel, G_IO_IN | G_IO_ERR | G_IO_HUP, + gmyth_monitor_handler_listener, + monitor); } else { ret = FALSE; - goto cleanup; } - - if (NULL == monitor->th) { - gmyth_debug - ("[%s] Error adding GThread listener function to the IO control channel!\n", - __FUNCTION__); - ret = FALSE; - goto cleanup; - } - - cleanup: - return ret; } -/** +/** * Starts the MonitorHandler thread to the GIOWatcher. - * + * * @param monitor The GMythMonitorHandler instance. - * + * * @return <code>true</code>, if the MonitorHandler was started. */ gboolean Modified: trunk/gmyth/src/gmyth_monitor_handler.h =================================================================== --- trunk/gmyth/src/gmyth_monitor_handler.h 2007-08-21 16:14:42 UTC (rev 822) +++ trunk/gmyth/src/gmyth_monitor_handler.h 2007-08-21 19:04:23 UTC (rev 823) @@ -63,12 +63,12 @@ GObjectClass parent_class; /* - * callbacks + * callbacks */ guint backend_events_handler_signal_id; /* - * signal default handlers + * signal default handlers */ void (*backend_events_handler) (GMythMonitorHandler * monitor, gint msg_code, @@ -88,14 +88,8 @@ */ GMythSocket *event_sock; + //gpointer(*gmyth_monitor_handler_listener) (gpointer data); - - - - - - gpointer(*gmyth_monitor_handler_listener) (gpointer data); - gchar *hostname; gint port; @@ -109,9 +103,7 @@ GHashTable *backend_msgs; GMutex *mutex; - - GThread *th; - + guint io_source; }; GType gmyth_monitor_handler_get_type(void); Modified: trunk/gmyth/src/gmyth_socket.c =================================================================== --- trunk/gmyth/src/gmyth_socket.c 2007-08-21 16:14:42 UTC (rev 822) +++ trunk/gmyth/src/gmyth_socket.c 2007-08-21 19:04:23 UTC (rev 823) @@ -1071,7 +1071,7 @@ GIOCondition io_cond; /* - * verify if the input (read) buffer is ready to receive data + * verify if the input (read) buffer is ready to receive data */ g_mutex_lock(gmyth_socket->mutex); @@ -1085,10 +1085,10 @@ /* * if ( NULL == gmyth_socket->sd_io_ch->read_buf || ( NULL == * gmyth_socket->sd_io_ch->read_buf->str ) ) gmyth_socket->sd_io_ch = - * g_io_channel_unix_new( gmyth_socket->sd ); + * g_io_channel_unix_new( gmyth_socket->sd ); */ - if (gmyth_socket->sd_io_ch->is_readable /* && !( ( io_cond & G_IO_IN ) + if (gmyth_socket->sd_io_ch->is_readable /* && !( ( io_cond & G_IO_IN ) * == 0 ) */ ) io_status = g_io_channel_read_chars(gmyth_socket->sd_io_ch, buffer, This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ren...@us...> - 2007-08-21 16:14:40
|
Revision: 822 http://gmyth.svn.sourceforge.net/gmyth/?rev=822&view=rev Author: renatofilho Date: 2007-08-21 09:14:42 -0700 (Tue, 21 Aug 2007) Log Message: ----------- redirect log message on service Added Paths: ----------- trunk/gmyth-stream/server/0.3/data/ trunk/gmyth-stream/server/0.3/data/gmsd trunk/gmyth-stream/server/0.3/data/server.conf Added: trunk/gmyth-stream/server/0.3/data/gmsd =================================================================== --- trunk/gmyth-stream/server/0.3/data/gmsd (rev 0) +++ trunk/gmyth-stream/server/0.3/data/gmsd 2007-08-21 16:14:42 UTC (rev 822) @@ -0,0 +1,61 @@ +#!/bin/sh + +PROGRAM_NAME=GMS +PROGRAM_BIN=/usr/bin/gms.py +PIDFILE=/var/run/gms.pid +LOGFILE=/var/log/gms.log + +test -x $PROGRAM_BIN || exit 0 + +set -e + +. /lib/lsb/init-functions +. /etc/default/rcS + +case $1 in + start) + echo -n "Starting $PROGRAM_NAME: " + if [ -f $PIDFILE ] + then + PID=`cat $PIDFILE` + + if ps ax | grep -q "^$PID" + then + echo "$PROGRAM_NAME already running." + else + rm -f $PIDFILE + $PROGRAM_BIN -d > $LOGFILE + echo "OK" + fi + else + $PROGRAM_BIN -d > $LOGFILE + echo "OK" + fi + ;; + + stop) + echo -n "Stopping $PROGRAM_NAME: " + if [ -f $PIDFILE ] + then + PID=`cat $PIDFILE` + if ps ax | grep -q "^$PID" + then + kill -10 $PID + fi + rm $PIDFILE + else + echo "No $PROGRAM_NAME found running; no killed." + fi + ;; + + restart) + $0 stop + sleep 1 + $0 start + ;; + + *) + log_success_msg "Usage: $0 {stop|start|restart}" + exit 1 + ;; +esac Property changes on: trunk/gmyth-stream/server/0.3/data/gmsd ___________________________________________________________________ Name: svn:executable + * Added: trunk/gmyth-stream/server/0.3/data/server.conf =================================================================== --- trunk/gmyth-stream/server/0.3/data/server.conf (rev 0) +++ trunk/gmyth-stream/server/0.3/data/server.conf 2007-08-21 16:14:42 UTC (rev 822) @@ -0,0 +1,2 @@ +[PATHS] +transcoded=/var/gms-media This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ren...@us...> - 2007-08-21 15:04:44
|
Revision: 821 http://gmyth.svn.sourceforge.net/gmyth/?rev=821&view=rev Author: renatofilho Date: 2007-08-21 08:04:44 -0700 (Tue, 21 Aug 2007) Log Message: ----------- created debian packages;\nImplemented server deamon;\n Modified Paths: -------------- trunk/gmyth-stream/server/0.3/gms.py trunk/gmyth-stream/server/0.3/lib/file_handler.py trunk/gmyth-stream/server/0.3/lib/request_handler.py trunk/gmyth-stream/server/0.3/lib/utils.py trunk/gmyth-stream/server/0.3/plugins/transcoders/gmencoder.py Added Paths: ----------- trunk/gmyth-stream/server/0.3/debian/ trunk/gmyth-stream/server/0.3/debian/changelog trunk/gmyth-stream/server/0.3/debian/compat trunk/gmyth-stream/server/0.3/debian/control trunk/gmyth-stream/server/0.3/debian/copyright trunk/gmyth-stream/server/0.3/debian/gms.install trunk/gmyth-stream/server/0.3/debian/gms.postinst trunk/gmyth-stream/server/0.3/debian/gms.postrm trunk/gmyth-stream/server/0.3/debian/rules trunk/gmyth-stream/server/0.3/lib/gmsconfig.py trunk/gmyth-stream/server/0.3/setup.py Added: trunk/gmyth-stream/server/0.3/debian/changelog =================================================================== --- trunk/gmyth-stream/server/0.3/debian/changelog (rev 0) +++ trunk/gmyth-stream/server/0.3/debian/changelog 2007-08-21 15:04:44 UTC (rev 821) @@ -0,0 +1,6 @@ +gms (0.3-indt1) unstable; urgency=low + + * First package + + -- Renato Araujo Oliveira Filho <ren...@in...> Thu, 16 Aug 2007 14:55:00 -0300 + Added: trunk/gmyth-stream/server/0.3/debian/compat =================================================================== --- trunk/gmyth-stream/server/0.3/debian/compat (rev 0) +++ trunk/gmyth-stream/server/0.3/debian/compat 2007-08-21 15:04:44 UTC (rev 821) @@ -0,0 +1 @@ +5 Added: trunk/gmyth-stream/server/0.3/debian/control =================================================================== --- trunk/gmyth-stream/server/0.3/debian/control (rev 0) +++ trunk/gmyth-stream/server/0.3/debian/control 2007-08-21 15:04:44 UTC (rev 821) @@ -0,0 +1,13 @@ +Source: gms +Section: sound +Priority: optional +Maintainer: Renato Araujo Oliveira Filho <ren...@in...> +Build-Depends: debhelper (>= 5.0.38), python-support (>= 0.5), python-central (>= 0.5) +Standards-Version: 3.7.2 + +Package: gms +Architecture: any +Depends: ${python:Depends}, libgstreamer0.10-0, gstreamer0.10-plugins-base, gstreamer0.10-plugins-good +Recommends: gstreamer0.10-plugins-ugly +Description: Media transcoder deamon + Homepage: http://gmyth.sourceforge.net/ Added: trunk/gmyth-stream/server/0.3/debian/copyright =================================================================== --- trunk/gmyth-stream/server/0.3/debian/copyright (rev 0) +++ trunk/gmyth-stream/server/0.3/debian/copyright 2007-08-21 15:04:44 UTC (rev 821) @@ -0,0 +1,19 @@ +It was downloaded from: http://gmyth.sourceforge.net/wiki/ + +License: + This package 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 2 of the License, or + (at your option) any later version. + + This package 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 package; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +On Debian systems, the complete text of the GNU General Public License can +be found in `/usr/share/common-licenses/GPL'. Added: trunk/gmyth-stream/server/0.3/debian/gms.install =================================================================== --- trunk/gmyth-stream/server/0.3/debian/gms.install (rev 0) +++ trunk/gmyth-stream/server/0.3/debian/gms.install 2007-08-21 15:04:44 UTC (rev 821) @@ -0,0 +1,8 @@ +debian/tmp/usr/share/gms/lib/*.py usr/share/gms/lib +debian/tmp/usr/share/gms/plugins/*.py usr/share/gms/plugins +debian/tmp/usr/share/gms/plugins/transcoders/*.py usr/share/gms/plugins/transcoders +debian/tmp/usr/share/gms/plugins/transcoders/mencoder_lib/*.py usr/share/gms/plugins/transcoders/mencoder_lib +debian/tmp/usr/share/gms/html/* usr/share/gms/html +debian/tmp/usr/bin/* usr/bin +debian/etc/init.d/gmsd etc/init.d +debian/etc/gms/*.conf etc/gms/ Property changes on: trunk/gmyth-stream/server/0.3/debian/gms.install ___________________________________________________________________ Name: svn:executable + * Added: trunk/gmyth-stream/server/0.3/debian/gms.postinst =================================================================== --- trunk/gmyth-stream/server/0.3/debian/gms.postinst (rev 0) +++ trunk/gmyth-stream/server/0.3/debian/gms.postinst 2007-08-21 15:04:44 UTC (rev 821) @@ -0,0 +1,29 @@ +#! /bin/sh +# postinst script for gms + +set -e + +case "$1" in + configure) + if ! getent passwd gms >/dev/null; then + adduser --disabled-password --quiet --system \ + --home /var/gms-media \ + --gecos "GMS media dir" --group gms + fi + if ! getent passwd gms | grep -q /var/run/gms; then + usermod -d /var/gms-media gms + fi + update-rc.d gmsd defaults + invoke-rc.d gmsd start + ;; + abort-upgrade|abort-remove|abort-deconfigure) + ;; + *) + echo "postinst called with unknown argument \`$1'" >&2 + exit 1 + ;; +esac + +#DEBHELPER# + +exit 0 Added: trunk/gmyth-stream/server/0.3/debian/gms.postrm =================================================================== --- trunk/gmyth-stream/server/0.3/debian/gms.postrm (rev 0) +++ trunk/gmyth-stream/server/0.3/debian/gms.postrm 2007-08-21 15:04:44 UTC (rev 821) @@ -0,0 +1,13 @@ +#!/bin/sh + +set -e + +#DEBHELPER# + +if [ "$1" = "purge" ] ; then + invoke-rc.d --force gms stop + deluser --quiet --system gms > /dev/null || true + delgroup --quiet --system gms > /dev/null || true +fi + +exit 0 Added: trunk/gmyth-stream/server/0.3/debian/rules =================================================================== --- trunk/gmyth-stream/server/0.3/debian/rules (rev 0) +++ trunk/gmyth-stream/server/0.3/debian/rules 2007-08-21 15:04:44 UTC (rev 821) @@ -0,0 +1,52 @@ +#!/usr/bin/make -f +# -*- makefile -*- + +# Uncomment this to turn on verbose mode. +#export DH_VERBOSE=1 + +PYVER=2.5 +PYTHON=python$(PYVER) + +PREFIX=debian/tmp + +build: build-stamp + +build-stamp: + touch build-stamp + +clean: + dh_testdir + dh_testroot + rm -f build-stamp + dh_clean + +install: build + dh_testdir + dh_testroot + dh_installdirs + dh_clean -k + + @rm -rf build + @$(PYTHON) setup.py install --prefix=$(PREFIX)/usr --no-compile --install-purelib=$(PREFIX)/usr/share/gms + install -D -o root -g root -m 755 $(PREFIX)/usr/etc/init.d/gmsd debian/$(cdbs_curpkg)/etc/init.d/gmsd + install -D -o root -g root -m 755 $(PREFIX)/usr/etc/gms/server.conf debian/$(cdbs_curpkg)/etc/gms/server.conf + + dh_install + +# Build architecture-independent files here. +binary-indep: build install + dh_testdir + dh_testroot + dh_installchangelogs + dh_installdocs + dh_strip + dh_compress + dh_fixperms + dh_installdeb + dh_gencontrol + dh_md5sums + dh_builddeb + +binary: binary-indep +.PHONY: clean binary-indep binary install + Property changes on: trunk/gmyth-stream/server/0.3/debian/rules ___________________________________________________________________ Name: svn:executable + * Modified: trunk/gmyth-stream/server/0.3/gms.py =================================================================== --- trunk/gmyth-stream/server/0.3/gms.py 2007-08-21 15:02:24 UTC (rev 820) +++ trunk/gmyth-stream/server/0.3/gms.py 2007-08-21 15:04:44 UTC (rev 821) @@ -5,12 +5,18 @@ __license__ = "GPL" __version__ = "0.3" __thanks__ = "Gustavo Sverzut Barbieri" +__GMS_DATA_DIR__ = "/usr/share/gms/" import sys import os import mimetypes import logging as log + +if os.path.exists (__GMS_DATA_DIR__): + sys.path.append(__GMS_DATA_DIR__) + from lib.server import serve_forever, load_plugins_transcoders +from lib.utils import config mimetypes.init() log_level = log.INFO @@ -23,9 +29,46 @@ "\t%(message)s"), datefmt="%Y-%m-%d %H:%M:%S") -if not os.path.exists(".transcoded"): - os.mkdir(".transcoded") +if config.get_transcoded_location () is None: + print "Gms not configured" + exit (0) -pd = os.path.join("plugins", "transcoders") -load_plugins_transcoders(pd) +if not os.path.exists(config.get_transcoded_location()): + os.mkdir(config.get_transcoded_location()) + + +if "-d" in sys.argv: + #run with deamon + try: + pid = os.fork() + if pid > 0: + sys.exit(0) + except OSError, e: + print >>sys.stderr, "Fail to start deamon: %d (%s)" % (e.errno, e.strerror) + sys.exit(1) + + os.chdir("/") + os.setsid() + os.umask(0) + + try: + pid = os.fork() + if pid > 0: + fp = open ("/var/run/gms.pid", "w") + fp.write ("%d" % pid) + fp.close () + sys.exit(0) + except OSError, e: + print >>sys.stderr, "Fail to start deamon: %d (%s)" % (e.errno, e.strerror) + sys.exit(1) + +# main deamon +pd = os.path.join(__GMS_DATA_DIR__, "plugins", "transcoders") +if os.path.exists (pd): + load_plugins_transcoders(pd) + +pd = os.path.join("plugins", "transcoders"); +if os.path.exists (pd): + load_plugins_transcoders(pd) + serve_forever() Modified: trunk/gmyth-stream/server/0.3/lib/file_handler.py =================================================================== --- trunk/gmyth-stream/server/0.3/lib/file_handler.py 2007-08-21 15:02:24 UTC (rev 820) +++ trunk/gmyth-stream/server/0.3/lib/file_handler.py 2007-08-21 15:04:44 UTC (rev 821) @@ -32,14 +32,20 @@ name = os.path.basename(self.opts["uri"][0]) self.opts["original"] = [name] output_file = os.path.basename(self.opts["outfile"][0]) - output = open(".transcoded/%s.dat" % \ - os.path.splitext(output_file)[0], "wb") + dat_file = output_file + ".dat"; + dat_path = os.path.join (utils.config.get_transcoded_location(), + dat_file); + + output = open(dat_path, "wb") # dumps data using the highest protocol pickle.dump(self.opts, output, -1) output.close() else: name = os.path.splitext(os.path.basename(filename))[0] - pkl_file = open(".transcoded/%s.dat" % name, "rb") + dat_file = name + ".dat"; + dat_path = os.path.join (utils.config.get_transcoded_location(), + dat_file); + pkl_file = open(dat_path, "rb") self.opts = pickle.load(pkl_file) # __init__() Added: trunk/gmyth-stream/server/0.3/lib/gmsconfig.py =================================================================== --- trunk/gmyth-stream/server/0.3/lib/gmsconfig.py (rev 0) +++ trunk/gmyth-stream/server/0.3/lib/gmsconfig.py 2007-08-21 15:04:44 UTC (rev 821) @@ -0,0 +1,42 @@ +#!/usr/bin/env + +__author__ = "Renato Araujo Oliveira Filho" +__author_email__ = "ren...@in..." +__license__ = "GPL" +__version__ = "0.3" + + +import os +import ConfigParser + +__all__ = ("GmsConfig") + +class GmsConfig: + config = ConfigParser.ConfigParser() + __CONFIG_FILE__ = "server.conf" + + def __init__(self): + file_name = os.path.join (os.path.expanduser("~"), ".gms", self.__CONFIG_FILE__) + print "test config file: %s" % file_name + if os.path.exists (file_name): + fp = open (file_name, "r") + self.config.readfp (fp) + return + + file_name = os.path.join ("/", "etc", "gms", self.__CONFIG_FILE__) + print "test config file: %s" % file_name + if os.path.exists (file_name): + fp = open (file_name, "r") + self.config.readfp (fp) + return + # __init__() + + def get_transcoded_location (self): + try: + return self.config.get("PATHS", "transcoded") + except: + return None + # get_transcoded_location() + + +# GmsConfig Modified: trunk/gmyth-stream/server/0.3/lib/request_handler.py =================================================================== --- trunk/gmyth-stream/server/0.3/lib/request_handler.py 2007-08-21 15:02:24 UTC (rev 820) +++ trunk/gmyth-stream/server/0.3/lib/request_handler.py 2007-08-21 15:04:44 UTC (rev 821) @@ -145,7 +145,7 @@ if body: file_list = [] - files.list_media_files(".transcoded", file_list) + files.list_media_files(utils.config.get_transcoded_location(), file_list) output = files.FileList(map(lambda x, y: x+y, file_list, ["<br>"]*len(file_list))) self.wfile.write(output) @@ -362,7 +362,7 @@ return #Only stream files on .transcode dir - filename = ".transcoded/" + os.path.basename(filename) + filename = os.path.join (utils.config.get_transcoded_location(), os.path.basename(filename)) self.log.error("Stream file: %s" % filename) if not os.path.exists (filename): self.send_error(404, "File not found") Modified: trunk/gmyth-stream/server/0.3/lib/utils.py =================================================================== --- trunk/gmyth-stream/server/0.3/lib/utils.py 2007-08-21 15:02:24 UTC (rev 820) +++ trunk/gmyth-stream/server/0.3/lib/utils.py 2007-08-21 15:04:44 UTC (rev 821) @@ -13,7 +13,10 @@ import gobject import imp +import gmsconfig + log = logging.getLogger("gms.utils") +config = gmsconfig.GmsConfig() __all__ = ("which", "load_plugins", "PluginSet", "getHTML", "progress_bar", "create_tid", "list_media_files") @@ -188,4 +191,3 @@ return tid # create_id() - Modified: trunk/gmyth-stream/server/0.3/plugins/transcoders/gmencoder.py =================================================================== --- trunk/gmyth-stream/server/0.3/plugins/transcoders/gmencoder.py 2007-08-21 15:02:24 UTC (rev 820) +++ trunk/gmyth-stream/server/0.3/plugins/transcoders/gmencoder.py 2007-08-21 15:04:44 UTC (rev 821) @@ -60,7 +60,7 @@ outfile = self.params_first("outfile", "") if outfile != "": - path = os.path.join(sys.path[0], ".transcoded", outfile) + path = os.path.join(utils.config.get_transcoded_location(), outfile) self._insert_param("-o", "file://%s" % path) else: self._insert_param ("-o", "fd://%d" % outfd.fileno()) Added: trunk/gmyth-stream/server/0.3/setup.py =================================================================== --- trunk/gmyth-stream/server/0.3/setup.py (rev 0) +++ trunk/gmyth-stream/server/0.3/setup.py 2007-08-21 15:04:44 UTC (rev 821) @@ -0,0 +1,17 @@ +from distutils.core import setup +from glob import glob + +setup(name='gms', + version='0.6', + description='carman rich view package', + long_description='carman rich view (SDL based) package', + url='http://www.indt.org.br', + scripts=['gms.py'], + package_dir={'lib': 'lib', 'plugins' : 'plugins','data' : 'data' }, + packages=['lib','plugins','plugins.transcoders','plugins.transcoders.mencoder_lib'], + data_files = [ + ('share/gms/html', glob("html/*")), + ('etc/init.d', ['data/gmsd']), + ('etc/gms', ['data/server.conf']) + ], + ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <me...@us...> - 2007-08-21 15:02:20
|
Revision: 820 http://gmyth.svn.sourceforge.net/gmyth/?rev=820&view=rev Author: melunko Date: 2007-08-21 08:02:24 -0700 (Tue, 21 Aug 2007) Log Message: ----------- Added gmyth_scheduler_add_exception() function to remove only one schedule when all occurrences options has been used. Modified Paths: -------------- trunk/gmyth/src/gmyth_scheduler.c trunk/gmyth/src/gmyth_scheduler.h Modified: trunk/gmyth/src/gmyth_scheduler.c =================================================================== --- trunk/gmyth/src/gmyth_scheduler.c 2007-08-20 20:26:20 UTC (rev 819) +++ trunk/gmyth/src/gmyth_scheduler.c 2007-08-21 15:02:24 UTC (rev 820) @@ -418,7 +418,7 @@ _set_int_value(GMythQuery * myth_query, char *field, gint value, gint rec_id) { - gchar *str_value = g_strdup_printf("%d", value); + gchar *str_value = g_strdup_printf("%d", value); _set_value(myth_query, field, str_value, rec_id); g_free(str_value); @@ -500,9 +500,13 @@ _set_value(scheduler->msqlquery, "search", "0", rec_id); if (type == GMYTH_SCHEDULE_ALL_OCCURRENCES) { - _set_value(scheduler->msqlquery, "type", "4", rec_id); - } else { - _set_value(scheduler->msqlquery, "type", "1", rec_id); + _set_int_value(scheduler->msqlquery, "type", 4, rec_id); + } else if (type == GMYTH_SCHEDULE_ONE_OCCURRENCE) { + _set_int_value(scheduler->msqlquery, "type", 1, rec_id); + } else if (type == GMYTH_SCHEDULE_EXCEPTION) { + _set_int_value(scheduler->msqlquery, "type", 8, rec_id); + _set_int_value(scheduler->msqlquery, "parentid", schedule_info->parentid, + rec_id); } _set_value(scheduler->msqlquery, "recpriority", "0", rec_id); @@ -556,26 +560,28 @@ /** Requests the Mysql database in the backend to remove an existing schedule. * * @param scheduler the GMythScheduler instance. - * @param record_id The schedule's record id to be removed + * @param schedule_id The schedule's record id to be removed * @return gboolean TRUE if success, FALSE if error */ gboolean -gmyth_scheduler_delete_schedule(GMythScheduler * scheduler, gint record_id) +gmyth_scheduler_delete_schedule(GMythScheduler * scheduler, gint schedule_id) { MYSQL_RES *msql_res; - GString *query_str = g_string_new(""); + GString *query_str = NULL; - assert(scheduler); + g_return_val_if_fail (scheduler != NULL, FALSE); + if (scheduler->msqlquery == NULL) { g_warning("[%s] Scheduler db connection not initialized", __FUNCTION__); return FALSE; } - // ======================================== + + query_str = g_string_new(""); g_string_printf(query_str, - "DELETE FROM record WHERE recordid=%d", record_id); + "DELETE FROM record WHERE recordid=%d", schedule_id); msql_res = gmyth_query_process_statement(scheduler->msqlquery, @@ -586,9 +592,33 @@ g_string_free(query_str, TRUE); // Notify the backend of the changes - return update_backend(scheduler, record_id); + return update_backend(scheduler, schedule_id); } +/* + * Add an exception program to be removed from the schedule list, when programs + * where scheduled with the GMYTH_SCHEDULE_ALL_OCCURRENCES option. + * @param scheduler the GMythScheduler instance. + * @param schedule_id the schedule id of the all occurrence schedule to be changed + * @param exception_info the ScheduleInfo to be removed from all schedule occurrences + * @return TRUE if success, FALSE if any error happens + */ +gboolean +gmyth_scheduler_add_exception (GMythScheduler *scheduler, gint schedule_id, + ScheduleInfo *exception_info) +{ + GString *query_str; + gboolean res; + + g_return_val_if_fail (scheduler != NULL, FALSE); + g_return_val_if_fail (exception_info != NULL, FALSE); + + exception_info->parentid = schedule_id; + res = gmyth_scheduler_add_schedule_full (scheduler, exception_info, GMYTH_SCHEDULE_EXCEPTION); + + return res; +} + /** Requests the Mysql database in the backend to remove an existing recorded item. * * @param scheduler the GMythScheduler instance. Modified: trunk/gmyth/src/gmyth_scheduler.h =================================================================== --- trunk/gmyth/src/gmyth_scheduler.h 2007-08-20 20:26:20 UTC (rev 819) +++ trunk/gmyth/src/gmyth_scheduler.h 2007-08-21 15:02:24 UTC (rev 820) @@ -39,7 +39,8 @@ typedef enum { GMYTH_SCHEDULE_ONE_OCCURRENCE, - GMYTH_SCHEDULE_ALL_OCCURRENCES + GMYTH_SCHEDULE_ALL_OCCURRENCES, + GMYTH_SCHEDULE_EXCEPTION } GMythScheduleType; @@ -109,6 +110,8 @@ GString *description; GString *category; + gint parentid; + } ScheduleInfo; typedef struct { @@ -153,7 +156,10 @@ ScheduleInfo * schedule_info); gboolean gmyth_scheduler_add_schedule_full (GMythScheduler * scheduler, ScheduleInfo * schedule_info, GMythScheduleType type); +gboolean gmyth_scheduler_add_exception (GMythScheduler *scheduler, gint schedule_id, + ScheduleInfo *exception_info); + gint gmyth_scheduler_delete_schedule (GMythScheduler * scheduler, gint record_id); gint gmyth_scheduler_delete_recorded (GMythScheduler * scheduler, This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ren...@us...> - 2007-08-20 20:26:16
|
Revision: 819 http://gmyth.svn.sourceforge.net/gmyth/?rev=819&view=rev Author: renatofilho Date: 2007-08-20 13:26:20 -0700 (Mon, 20 Aug 2007) Log Message: ----------- video bitrate changed from 600kbps to 300kbps. Frame rate default value set to 10fps Modified Paths: -------------- trunk/gmyth-stream/server/0.3/plugins/transcoders/gmencoder.py Modified: trunk/gmyth-stream/server/0.3/plugins/transcoders/gmencoder.py =================================================================== --- trunk/gmyth-stream/server/0.3/plugins/transcoders/gmencoder.py 2007-08-20 18:03:06 UTC (rev 818) +++ trunk/gmyth-stream/server/0.3/plugins/transcoders/gmencoder.py 2007-08-20 20:26:20 UTC (rev 819) @@ -47,8 +47,9 @@ "%s://%s" % (self.params_first("type", "file"), self.params_first("uri", ""))) self._insert_param("--video-encode", self.params_first("ve", "ffenc_mpeg1video")) - self._insert_param("--video-opts", "bitrate=600000,pass=512,quantizer=0.05,quant-type=1") - self._insert_param("--video-fps", self.params_first("fps", "")) + self._insert_param("--video-opts", "bitrate=300000,pass=512,quantizer=0.01,quant-type=1") + #self._insert_param("--video-fps", self.params_first("fps", "")) + self._insert_param("--video-fps", self.params_first("fps", "10")) self._insert_param("--video-width", self.params_first("width", "320")) self._insert_param("--video-height", self.params_first("height", "240")) self._insert_param("--audio-rate", "32000") This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ren...@us...> - 2007-08-20 18:03:12
|
Revision: 818 http://gmyth.svn.sourceforge.net/gmyth/?rev=818&view=rev Author: renatofilho Date: 2007-08-20 11:03:06 -0700 (Mon, 20 Aug 2007) Log Message: ----------- fixed uri null errorr; Modified Paths: -------------- trunk/gst-gmyth/mythsrc/gstmythtvsrc.c trunk/gst-gmyth/mythsrc/gstmythtvsrc.h Modified: trunk/gst-gmyth/mythsrc/gstmythtvsrc.c =================================================================== --- trunk/gst-gmyth/mythsrc/gstmythtvsrc.c 2007-08-17 21:47:49 UTC (rev 817) +++ trunk/gst-gmyth/mythsrc/gstmythtvsrc.c 2007-08-20 18:03:06 UTC (rev 818) @@ -81,26 +81,15 @@ #include <unistd.h> GST_DEBUG_CATEGORY_STATIC(mythtvsrc_debug); -#define GST_CAT_DEFAULT mythtvsrc_debug - #define GST_GMYTHTV_ID_NUM 1 - #define GST_GMYTHTV_CHANNEL_DEFAULT_NUM (-1) - -#define GMYTHTV_VERSION_DEFAULT 30 - +#define GMYTHTV_VERSION_DEFAULT 30 #define GMYTHTV_TRANSFER_MAX_WAITS 100 - #define GMYTHTV_TRANSFER_MAX_RESENDS 2 - #define GMYTHTV_TRANSFER_MAX_BUFFER (128*1024) - #define MAX_READ_SIZE (4*1024) - #define GST_FLOW_ERROR_NO_DATA (-101) - #define REQUEST_MAX_SIZE (64*1024) - #define INTERNAL_BUFFER_SIZE (90*1024) static const GstElementDetails gst_mythtv_src_details = @@ -121,16 +110,12 @@ enum { PROP_0, PROP_LOCATION, -#ifndef GST_DISABLE_GST_DEBUG - PROP_GMYTHTV_DBG, -#endif PROP_GMYTHTV_VERSION, PROP_GMYTHTV_LIVE, PROP_GMYTHTV_LIVEID, PROP_GMYTHTV_LIVE_CHAINID, PROP_GMYTHTV_ENABLE_TIMING_POSITION, - PROP_GMYTHTV_CHANNEL_NUM, - PROP_GMYTHTV_MAX_TRY + PROP_GMYTHTV_CHANNEL_NUM }; static void gst_mythtv_src_clear(GstMythtvSrc * mythtv_src); @@ -265,21 +250,6 @@ "Change MythTV channel number", "", G_PARAM_READWRITE)); - g_object_class_install_property - (gobject_class, PROP_GMYTHTV_MAX_TRY, - g_param_spec_int("max-try", "max-try", - "Set the max try for get MythTV free recorder", - 0, G_MAXINT, 10, G_PARAM_READWRITE)); - - -#ifndef GST_DISABLE_GST_DEBUG - g_object_class_install_property - (gobject_class, PROP_GMYTHTV_DBG, - g_param_spec_boolean("mythtv-debug", "mythtv-debug", - "Enable MythTV debug messages", FALSE, - G_PARAM_READWRITE)); -#endif - gstbasesrc_class->start = gst_mythtv_src_start; gstbasesrc_class->stop = gst_mythtv_src_stop; gstbasesrc_class->get_size = gst_mythtv_src_get_size; @@ -296,40 +266,24 @@ gst_mythtv_src_init(GstMythtvSrc * this, GstMythtvSrcClass * g_class) { this->file = NULL; - this->unique_setup = FALSE; - this->mythtv_version = GMYTHTV_VERSION_DEFAULT; - this->state = GST_MYTHTV_SRC_FILE_TRANSFER; - this->bytes_read = 0; - this->prev_content_size = 0; - this->content_size = 0; this->read_offset = 0; - this->content_size_last = 0; - this->live_tv = FALSE; - this->enable_timing_position = FALSE; this->update_prog_chain = FALSE; - this->user_agent = g_strdup("mythtvsrc"); this->update_prog_chain = FALSE; - this->channel_name = NULL; - this->eos = FALSE; - this->bytes_queue = NULL; - this->wait_to_transfer = 0; - gst_base_src_set_format(GST_BASE_SRC(this), GST_FORMAT_BYTES); - gst_pad_set_event_function(GST_BASE_SRC_PAD(GST_BASE_SRC(this)), gst_mythtv_src_handle_event); gst_pad_set_query_function(GST_BASE_SRC_PAD(GST_BASE_SRC(this)), @@ -889,12 +843,9 @@ */ if (ret == FALSE) { -#ifndef GST_DISABLE_GST_DEBUG - if (src->mythtv_msgs_dbg) - GST_INFO_OBJECT(src, - "MythTV FileTransfer request failed when setting up socket connection!"); -#endif - goto begin_req_failed; + GST_INFO_OBJECT(src, + "MythTV FileTransfer request failed when setting up socket connection!"); + goto begin_req_failed; } GST_INFO_OBJECT(src, @@ -1032,17 +983,17 @@ gboolean ret = TRUE; switch (GST_EVENT_TYPE(event)) { - case GST_EVENT_EOS: + case GST_EVENT_EOS: if (src->live_tv) { - cont_size = gst_mythtv_src_get_position(src); - if (cont_size > src->content_size) { - src->content_size = cont_size; - src->eos = FALSE; - } else { - src->eos = TRUE; - gst_element_set_state(GST_ELEMENT(src), GST_STATE_NULL); - gst_element_set_locked_state(GST_ELEMENT(src), FALSE); - } + cont_size = gst_mythtv_src_get_position(src); + if (cont_size > src->content_size) { + src->content_size = cont_size; + src->eos = FALSE; + } else { + src->eos = TRUE; + gst_element_set_state(GST_ELEMENT(src), GST_STATE_NULL); + gst_element_set_locked_state(GST_ELEMENT(src), FALSE); + } } break; default: @@ -1068,37 +1019,32 @@ switch (GST_QUERY_TYPE(query)) { - case GST_QUERY_POSITION: - { - gst_query_parse_position(query, &formt, NULL); - if (formt == GST_FORMAT_BYTES) { - gst_query_set_position(query, formt, myth->read_offset); - GST_DEBUG_OBJECT(myth, "POS %" G_GINT64_FORMAT, - myth->read_offset); - res = TRUE; - } else if (formt == GST_FORMAT_TIME) { - res = gst_pad_query_default(pad, query); - } - break; + case GST_QUERY_POSITION: + gst_query_parse_position(query, &formt, NULL); + if (formt == GST_FORMAT_BYTES) { + gst_query_set_position(query, formt, myth->read_offset); + GST_DEBUG_OBJECT(myth, "POS %" G_GINT64_FORMAT, + myth->read_offset); + res = TRUE; + } else if (formt == GST_FORMAT_TIME) { + res = gst_pad_query_default(pad, query); } - case GST_QUERY_DURATION: - { - gst_query_parse_duration(query, &formt, NULL); - if (formt == GST_FORMAT_BYTES) { - gint64 size = myth->content_size; - gst_query_set_duration(query, GST_FORMAT_BYTES, 10); - GST_DEBUG_OBJECT(myth, "SIZE %" G_GINT64_FORMAT, size); - res = TRUE; - } else if (formt == GST_FORMAT_TIME) { - res = gst_pad_query_default(pad, query); - } - break; + break; + case GST_QUERY_DURATION: + gst_query_parse_duration(query, &formt, NULL); + if (formt == GST_FORMAT_BYTES) { + gint64 size = myth->content_size; + + gst_query_set_duration(query, GST_FORMAT_BYTES, 10); + GST_DEBUG_OBJECT(myth, "SIZE %" G_GINT64_FORMAT, size); + res = TRUE; + } else if (formt == GST_FORMAT_TIME) { + res = gst_pad_query_default(pad, query); } - default: - { - res = gst_pad_query_default(pad, query); - break; - } + break; + default: + res = gst_pad_query_default(pad, query); + break; } gst_object_unref(myth); @@ -1117,17 +1063,21 @@ case GST_STATE_CHANGE_NULL_TO_READY: break; case GST_STATE_CHANGE_READY_TO_PAUSED: + if (!src->uri_name) { + GST_WARNING_OBJECT (src, "Invalid location"); + return ret; + } + break; case GST_STATE_CHANGE_PAUSED_TO_PLAYING: - if (src->live_tv) { - if (!gmyth_recorder_send_frontend_ready_command - (src->spawn_livetv->recorder)) - GST_WARNING_OBJECT(src, - "Couldn't send the FRONTEND_READY message to the backend!"); - else - GST_DEBUG_OBJECT(src, - "FRONTEND_READY was sent to the backend"); - } - break; + if (src->live_tv) { + if (!gmyth_recorder_send_frontend_ready_command + (src->spawn_livetv->recorder)) + GST_WARNING_OBJECT(src, + "Couldn't send the FRONTEND_READY message to the backend!"); + else + GST_DEBUG_OBJECT(src, "FRONTEND_READY was sent to the backend"); + } + break; default: break; } @@ -1160,73 +1110,46 @@ GST_OBJECT_LOCK(mythtvsrc); switch (prop_id) { - case PROP_LOCATION: - { - if (!g_value_get_string(value)) { - GST_WARNING("location property cannot be NULL"); - break; - } - - if (mythtvsrc->uri_name != NULL) { - g_free(mythtvsrc->uri_name); - mythtvsrc->uri_name = NULL; - } - mythtvsrc->uri_name = g_value_dup_string(value); - - break; + case PROP_LOCATION: + if (!g_value_get_string(value)) { + GST_WARNING("location property cannot be NULL"); + break; } -#ifndef GST_DISABLE_GST_DEBUG - case PROP_GMYTHTV_DBG: - { - mythtvsrc->mythtv_msgs_dbg = g_value_get_boolean(value); - break; - } -#endif - case PROP_GMYTHTV_VERSION: - { - mythtvsrc->mythtv_version = g_value_get_int(value); - break; - } - case PROP_GMYTHTV_LIVEID: - { - mythtvsrc->live_tv_id = g_value_get_int(value); - break; - } - case PROP_GMYTHTV_LIVE: - { - mythtvsrc->live_tv = g_value_get_boolean(value); - break; - } - case PROP_GMYTHTV_ENABLE_TIMING_POSITION: - { - mythtvsrc->enable_timing_position = g_value_get_boolean(value); - break; - } - case PROP_GMYTHTV_LIVE_CHAINID: - { - if (!g_value_get_string(value)) { - GST_WARNING("MythTV Live chainid property cannot be NULL"); - break; - } - if (mythtvsrc->live_chain_id != NULL) { - g_free(mythtvsrc->live_chain_id); - mythtvsrc->live_chain_id = NULL; - } - mythtvsrc->live_chain_id = g_value_dup_string(value); - break; + if (mythtvsrc->uri_name != NULL) { + g_free(mythtvsrc->uri_name); + mythtvsrc->uri_name = NULL; } - case PROP_GMYTHTV_CHANNEL_NUM: - { - mythtvsrc->channel_name = g_value_dup_string(value); + mythtvsrc->uri_name = g_value_dup_string(value); + break; + case PROP_GMYTHTV_VERSION: + mythtvsrc->mythtv_version = g_value_get_int(value); + break; + case PROP_GMYTHTV_LIVEID: + mythtvsrc->live_tv_id = g_value_get_int(value); + break; + case PROP_GMYTHTV_LIVE: + mythtvsrc->live_tv = g_value_get_boolean(value); + break; + case PROP_GMYTHTV_ENABLE_TIMING_POSITION: + mythtvsrc->enable_timing_position = g_value_get_boolean(value); + break; + case PROP_GMYTHTV_LIVE_CHAINID: + if (!g_value_get_string(value)) { + GST_WARNING_OBJECT(object, "MythTV Live chainid property cannot be NULL"); break; - } - case PROP_GMYTHTV_MAX_TRY: - { - mythtvsrc->max_try = g_value_get_int(value); - break; - } - default: + } + + if (mythtvsrc->live_chain_id != NULL) { + g_free(mythtvsrc->live_chain_id); + mythtvsrc->live_chain_id = NULL; + } + mythtvsrc->live_chain_id = g_value_dup_string(value); + break; + case PROP_GMYTHTV_CHANNEL_NUM: + mythtvsrc->channel_name = g_value_dup_string(value); + break; + default: G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec); break; } @@ -1242,48 +1165,27 @@ GST_OBJECT_LOCK(mythtvsrc); switch (prop_id) { - case PROP_LOCATION: - { - g_value_set_string(value, mythtvsrc->uri_name); - break; - } -#ifndef GST_DISABLE_GST_DEBUG - case PROP_GMYTHTV_DBG: - g_value_set_boolean(value, mythtvsrc->mythtv_msgs_dbg); + case PROP_LOCATION: + g_value_set_string(value, mythtvsrc->uri_name); break; -#endif - case PROP_GMYTHTV_VERSION: - { - g_value_set_int(value, mythtvsrc->mythtv_version); - break; - } - case PROP_GMYTHTV_LIVEID: - { - g_value_set_int(value, mythtvsrc->live_tv_id); - break; - } - case PROP_GMYTHTV_LIVE: + case PROP_GMYTHTV_VERSION: + g_value_set_int(value, mythtvsrc->mythtv_version); + break; + case PROP_GMYTHTV_LIVEID: + g_value_set_int(value, mythtvsrc->live_tv_id); + break; + case PROP_GMYTHTV_LIVE: g_value_set_boolean(value, mythtvsrc->live_tv); break; - case PROP_GMYTHTV_ENABLE_TIMING_POSITION: + case PROP_GMYTHTV_ENABLE_TIMING_POSITION: g_value_set_boolean(value, mythtvsrc->enable_timing_position); break; - case PROP_GMYTHTV_LIVE_CHAINID: - { - g_value_set_string(value, mythtvsrc->live_chain_id); - break; - } - case PROP_GMYTHTV_CHANNEL_NUM: - { - g_value_set_string(value, mythtvsrc->channel_name); - break; - } - case PROP_GMYTHTV_MAX_TRY: - { - g_value_set_int(value, mythtvsrc->max_try); - break; - } - + case PROP_GMYTHTV_LIVE_CHAINID: + g_value_set_string(value, mythtvsrc->live_chain_id); + break; + case PROP_GMYTHTV_CHANNEL_NUM: + g_value_set_string(value, mythtvsrc->channel_name); + break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec); break; Modified: trunk/gst-gmyth/mythsrc/gstmythtvsrc.h =================================================================== --- trunk/gst-gmyth/mythsrc/gstmythtvsrc.h 2007-08-17 21:47:49 UTC (rev 817) +++ trunk/gst-gmyth/mythsrc/gstmythtvsrc.h 2007-08-20 18:03:06 UTC (rev 818) @@ -117,13 +117,6 @@ * stablish a maximum iteration value to the IS_RECORDING message */ guint wait_to_transfer; - - /* - * max try number to get freerecorder - */ - gint max_try; - gint try_number; - }; struct _GstMythtvSrcClass { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <leo...@us...> - 2007-08-17 21:47:46
|
Revision: 817 http://gmyth.svn.sourceforge.net/gmyth/?rev=817&view=rev Author: leo_sobral Date: 2007-08-17 14:47:49 -0700 (Fri, 17 Aug 2007) Log Message: ----------- Fixed volume element bug and added audioconvert to audio pipeline Modified Paths: -------------- trunk/gst-gmyth/playbinmaemo/gstplaybinmaemo.c trunk/gst-gmyth/playbinmaemo/gstplaybinmaemo.h Modified: trunk/gst-gmyth/playbinmaemo/gstplaybinmaemo.c =================================================================== --- trunk/gst-gmyth/playbinmaemo/gstplaybinmaemo.c 2007-08-17 18:28:10 UTC (rev 816) +++ trunk/gst-gmyth/playbinmaemo/gstplaybinmaemo.c 2007-08-17 21:47:49 UTC (rev 817) @@ -35,7 +35,7 @@ GST_DEBUG_CATEGORY_STATIC (gst_play_bin_maemo_debug); #define GST_CAT_DEFAULT gst_play_bin_maemo_debug -#define DEFAULT_VOLUME 10 +#define DEFAULT_VOLUME 1.0 #define DEFAULT_XID -1 /* props */ @@ -73,12 +73,16 @@ static GList *find_compatibles (GstPlayBinMaemo *pbm, const GstCaps *caps); static GstPad *find_sink_pad (GstElement * element); -static void update_volume (GstPlayBinMaemo *pbm); +static void update_volume (GstPlayBinMaemo *pbm, + gfloat volume); static void update_xid (GstPlayBinMaemo *pbm); static void new_decoded_pad_cb (GstElement *object, GstPad* pad, gboolean arg, gpointer user_data); +static void removed_decoded_pad_cb (GstElement *object, + GstPad* pad, + gpointer user_data); static void unknown_type_cb (GstElement *object, GstPad *pad, GstCaps *casp, @@ -125,7 +129,7 @@ g_object_class_install_property (gobject_klass, ARG_VOLUME, g_param_spec_double ("volume", "Audio volume", "volume", - 0.0, 10.0, (gdouble) DEFAULT_VOLUME, G_PARAM_READWRITE)); + 0.0, 10.0, DEFAULT_VOLUME, G_PARAM_READWRITE)); g_object_class_install_property (gobject_klass, ARG_XID, g_param_spec_long ("xid", "xid", "X windown ID", @@ -158,14 +162,16 @@ play_bin_maemo->uri = NULL; play_bin_maemo->source = NULL; - play_bin_maemo->volume = DEFAULT_VOLUME * 65535 / 10; + play_bin_maemo->volume = DEFAULT_VOLUME; play_bin_maemo->xid = DEFAULT_XID; play_bin_maemo->parse_metadata = TRUE; - factories = gst_default_registry_feature_filter ((GstPluginFeatureFilter) factory_filter_sinks, - FALSE, play_bin_maemo); + factories = gst_default_registry_feature_filter ( + (GstPluginFeatureFilter) factory_filter_sinks, + FALSE, play_bin_maemo); - play_bin_maemo->factories = g_list_sort (factories, (GCompareFunc) compare_ranks); + play_bin_maemo->factories = g_list_sort (factories, + (GCompareFunc) compare_ranks); } static void @@ -328,11 +334,17 @@ G_CALLBACK (new_decoded_pad_cb), pbm); + g_signal_connect (G_OBJECT (decoder), + "removed-decoded-pad", + G_CALLBACK (removed_decoded_pad_cb), + pbm); + + queue = gst_element_factory_make ("queue", NULL); add_element (pbm, queue); if (gst_element_link_many (pbm->source, queue, decoder, NULL) == FALSE) { - g_warning ("FAIL TO LINK SRC WITH DECODEBIN2"); + GST_WARNING ("FAIL TO LINK SRC WITH DECODEBIN2"); } } @@ -388,7 +400,7 @@ const gchar *uri = g_value_get_string (value); if (uri == NULL) { - g_warning ("cannot set NULL uri"); + GST_WARNING ("cannot set NULL uri"); return; } /* if we have no previous uri, or the new uri is different from the @@ -404,23 +416,8 @@ break; } case ARG_VOLUME: - { - gdouble d_volume = 0; - guint u_volume = 0; - d_volume = g_value_get_double (value); - - g_debug ("Getting : %5.2f", d_volume); - if (d_volume != 0) { - u_volume = (guint) (65535 * d_volume); - } - - g_debug ("Converting : %d", u_volume); - if (play_bin_maemo->volume != u_volume) { - play_bin_maemo->volume = u_volume; - update_volume (play_bin_maemo); - } + update_volume(play_bin_maemo, g_value_get_double (value)); break; - } case ARG_XID: { long xid; @@ -442,8 +439,10 @@ } static void -gst_play_bin_maemo_get_property (GObject * object, guint prop_id, GValue * value, - GParamSpec * pspec) +gst_play_bin_maemo_get_property (GObject * object, + guint prop_id, + GValue * value, + GParamSpec * pspec) { GstPlayBinMaemo *play_bin_maemo; @@ -459,14 +458,8 @@ g_value_set_object (value, play_bin_maemo->source); break; case ARG_VOLUME: - { - gdouble volume = 0; - if (play_bin_maemo->volume > 0) { - volume = play_bin_maemo->volume / 65535; - } - g_value_set_double (value, volume); + g_value_set_double (value, play_bin_maemo->volume); break; - } case ARG_XID: g_value_set_long (value, play_bin_maemo->xid); break; @@ -480,7 +473,8 @@ } static GstStateChangeReturn -gst_play_bin_maemo_change_state (GstElement * element, GstStateChange transition) +gst_play_bin_maemo_change_state (GstElement * element, + GstStateChange transition) { GstStateChangeReturn ret; GstPlayBinMaemo *play_bin_maemo; @@ -540,7 +534,8 @@ if ((strstr (klass, "Sink/Video") == NULL) && (strstr (klass, "Sink/Audio") == NULL)) return FALSE; - g_debug ("Filtered: %s", gst_element_factory_get_longname ((GST_ELEMENT_FACTORY (feature)))); + GST_DEBUG_OBJECT (pbm, "Filtered: %s", + gst_element_factory_get_longname ((GST_ELEMENT_FACTORY (feature)))); rank = gst_plugin_feature_get_rank (feature); if (rank < GST_RANK_MARGINAL) return FALSE; @@ -549,7 +544,8 @@ } static gint -compare_ranks (GstPluginFeature * f1, GstPluginFeature * f2) +compare_ranks (GstPluginFeature * f1, + GstPluginFeature * f2) { gint diff; const gchar *rname1, *rname2; @@ -568,7 +564,8 @@ static GList * -find_compatibles (GstPlayBinMaemo *pbm, const GstCaps *caps) +find_compatibles (GstPlayBinMaemo *pbm, + const GstCaps *caps) { GList *factories; GList *to_try = NULL; @@ -593,6 +590,7 @@ tmpl_caps = gst_static_caps_get (&templ->static_caps); intersect = gst_caps_intersect (caps, tmpl_caps); + gst_caps_unref (tmpl_caps); /* check if the intersection is empty */ @@ -611,7 +609,6 @@ return to_try; } - static gboolean autoplug_continue_cb (GstElement* object, GstCaps* caps, @@ -623,7 +620,7 @@ pbm = GST_PLAY_BIN_MAEMO (user_data); - //TODO: fix this for work with all metada elements + //TODO: fix this to work with all metadata elements if (pbm->parse_metadata) { gchar *caps_str = gst_caps_to_string (caps); if ((strstr (caps_str, "id3") != NULL) && @@ -651,10 +648,10 @@ GstCaps *caps, gpointer user_data) { - g_debug ("unknown_type_cb: %s", gst_caps_to_string (caps)); + GST_DEBUG ("unknown_type_cb: %s", gst_caps_to_string (caps)); } -static GstPad * +static GstPad* find_sink_pad (GstElement * element) { GstIterator *it; @@ -672,7 +669,8 @@ } static GstElement* -create_element (GstPlayBinMaemo *pbm, GstElementFactory *factory) +create_element (GstPlayBinMaemo *pbm, + GstElementFactory *factory) { GstElement *queue; GstElement *bin = NULL; @@ -681,10 +679,11 @@ element = gst_element_factory_create (factory, NULL); if (element == NULL) - return NULL; + goto error; - bin = gst_bin_new (NULL); + if (bin == NULL) + goto error; queue = gst_element_factory_make ("queue", NULL); gst_bin_add (GST_BIN (bin), queue); @@ -693,10 +692,12 @@ GstElement *colorspace; colorspace = gst_element_factory_make ("ffmpegcolorspace", NULL); + if (colorspace == NULL) + goto error; gst_bin_add (GST_BIN (bin), colorspace); if (gst_element_link (queue, colorspace) == FALSE) { - GST_WARNING_OBJECT (pbm, "Fail to link queue and colorspace"); + GST_WARNING_OBJECT (pbm, "Failed to link queue and colorspace"); gst_element_set_state (colorspace, GST_STATE_NULL); gst_object_unref (colorspace); goto error; @@ -704,7 +705,8 @@ gst_bin_add (GST_BIN (bin), element); if (gst_element_link (colorspace, element) == FALSE) { - GST_WARNING_OBJECT (pbm, "Fail to link colorspace and sink video: %s", GST_ELEMENT_NAME (element)); + GST_WARNING_OBJECT (pbm, "Failed to link colorspace and sink video: %s", + GST_ELEMENT_NAME (element)); gst_element_set_state (colorspace, GST_STATE_NULL); gst_object_unref (colorspace); goto error; @@ -719,35 +721,47 @@ prev = queue; vol_spec = g_object_class_find_property (G_OBJECT_GET_CLASS (element), "volume"); + if (vol_spec == NULL) { + GstElement *conv; GstElement *volume; - bin = gst_bin_new (NULL); + conv = gst_element_factory_make ("audioconvert", "aconv"); + if (conv == NULL) + goto error; + + gst_bin_add (GST_BIN_CAST (bin), conv); + + gst_element_link (queue, conv); + volume = gst_element_factory_make ("volume", "volume"); + if (volume == NULL) + goto error; + gst_bin_add (GST_BIN (bin), volume); - if (gst_element_link (queue, volume) == FALSE) { - GST_WARNING_OBJECT (pbm, "Fail to link queue and volume"); + if (gst_element_link (conv, volume) == FALSE) { + GST_WARNING_OBJECT (pbm, "Failed to link queue and volume"); gst_element_set_state (volume, GST_STATE_NULL); gst_object_unref (volume); goto error; } prev = volume; + } else { g_param_spec_unref (vol_spec); } gst_bin_add (GST_BIN (bin), element); if (gst_element_link (prev, element) == FALSE) { - GST_WARNING_OBJECT (pbm, "Fail to link volume and sink audio: %s", GST_ELEMENT_NAME (element)); + GST_WARNING_OBJECT (pbm, "Failed to link volume and sink audio: %s", GST_ELEMENT_NAME (element)); if (prev != queue) { gst_element_set_state (prev, GST_STATE_NULL); gst_object_unref (prev); } goto error; } - pbm->volume_element = (prev != queue) ? prev : element; - update_volume (pbm); + update_volume (pbm, pbm->volume); } pad = gst_element_get_pad (queue, "sink"); @@ -755,7 +769,9 @@ gst_object_unref (pad); return bin; + error: + GST_WARNING_OBJECT (pbm, "Error creating pipeline"); gst_element_set_state (bin, GST_STATE_NULL); gst_object_unref (bin); @@ -778,13 +794,12 @@ pbm = GST_PLAY_BIN_MAEMO (user_data); caps = gst_pad_get_caps (pad); - g_debug ("new_decoded_pad_cb: %s", gst_caps_to_string (caps)); + GST_DEBUG_OBJECT (pbm, "new_decoded_pad_cb: %s", gst_caps_to_string (caps)); comp = find_compatibles (GST_PLAY_BIN_MAEMO (user_data), caps); - if (comp == NULL) { - g_warning ("flow error: dont find comaptible"); + GST_WARNING ("flow error: dont find comaptible"); return; } @@ -795,51 +810,48 @@ GstElementFactory *factory = (GstElementFactory *) walk->data; GstElement *element; GstPad *sinkpad = NULL; + gint result; if ((element = create_element (pbm, factory)) == NULL) { GST_WARNING_OBJECT (pbm, "Could not create an element from %s", gst_plugin_feature_get_name (GST_PLUGIN_FEATURE (factory))); - g_debug ("Could not create an element from %s", - gst_plugin_feature_get_name (GST_PLUGIN_FEATURE (factory))); + continue; + } + if (!(sinkpad = find_sink_pad (element))) { + GST_WARNING_OBJECT (pbm, "Element %s doesn't have a sink pad", GST_ELEMENT_NAME (element)); + gst_object_unref (element); continue; } if (!(add_element (GST_PLAY_BIN_MAEMO (user_data), element))) { - GST_WARNING_OBJECT (pbm, "Couldn't set %s to READY", GST_ELEMENT_NAME (element)); + GST_WARNING_OBJECT (pbm, "Couldn't add element %s to bin", GST_ELEMENT_NAME (element)); + gst_object_unref (sinkpad); gst_object_unref (element); continue; } if ((gst_element_set_state (element, GST_STATE_READY)) == GST_STATE_CHANGE_FAILURE) { - gst_element_set_state (element, GST_STATE_NULL); + GST_WARNING_OBJECT (pbm, "Couldn't set %s to READY", GST_ELEMENT_NAME (element)); gst_object_unref (sinkpad); gst_bin_remove (GST_BIN (user_data), element); continue; } - if (!(sinkpad = find_sink_pad (element))) { - GST_WARNING_OBJECT (pbm, "Element %s doesn't have a sink pad", GST_ELEMENT_NAME (element)); - g_debug ("Element %s doesn't have a sink pad", GST_ELEMENT_NAME (element)); - gst_object_unref (element); + if (gst_pad_link (pad, sinkpad) != GST_PAD_LINK_OK) { + GST_WARNING_OBJECT (pbm, "Link failed on pad %s:%s", GST_DEBUG_PAD_NAME (sinkpad)); + gst_element_set_state (element, GST_STATE_NULL); + gst_object_unref (sinkpad); + gst_bin_remove (GST_BIN (user_data), element); continue; } - - if ((gst_pad_link (pad, sinkpad)) != GST_PAD_LINK_OK) { - GST_WARNING_OBJECT (pbm, "Link failed on pad %s:%s", GST_DEBUG_PAD_NAME (sinkpad)); - gst_element_set_state (element, GST_STATE_NULL); - gst_object_unref (sinkpad); - gst_bin_remove (GST_BIN (user_data), element); - continue; - } - gst_object_unref (sinkpad); if ((gst_element_set_state (element, GST_STATE_PAUSED)) == GST_STATE_CHANGE_FAILURE) { - gst_element_set_state (element, GST_STATE_NULL); - gst_bin_remove (GST_BIN (user_data), element); + gst_element_set_state (element, GST_STATE_NULL); + gst_bin_remove (GST_BIN (user_data), element); continue; } @@ -849,63 +861,130 @@ g_list_free (comp); if (linked == FALSE) { - g_warning ("GstFlow ERROR"); + g_debug ("GstFlow Error"); + GST_WARNING ("GstFlow ERROR"); } GST_PAD_STREAM_UNLOCK (pad); } static void -update_volume (GstPlayBinMaemo *pbm) +removed_decoded_pad_cb (GstElement *object, + GstPad* pad, + gpointer user_data) { - if (pbm->volume_element != NULL) { - if (pbm->volume > 0) { - g_object_set (G_OBJECT (pbm->volume_element), - "volume", pbm->volume, - NULL); - } else { - g_object_set (G_OBJECT (pbm->volume_element), - "mute", TRUE, - NULL); + GstElement *sink; + + GST_DEBUG("removed_decoded_pad_cb"); + + sink = gst_pad_get_parent_element (pad); + + if (sink) + gst_bin_remove (GST_BIN (user_data), sink); +} + +static GValue* +convert_volume_base (GstPlayBinMaemo *pbm, gfloat volume) +{ + GValue value = { 0, }; + GValue *converted_vol = g_new0(GValue, 1); + + GParamSpec* vol_spec = g_object_class_find_property ( + G_OBJECT_GET_CLASS (pbm->volume_element), "volume"); + + g_value_init (&value, vol_spec->value_type); + g_value_init (converted_vol, vol_spec->value_type); + + g_object_get_property (G_OBJECT (pbm->volume_element), "volume", &value); + + /* convert volume from double to int range if needed */ + switch (G_VALUE_TYPE (&value)) { + case G_TYPE_UINT: + { + GParamSpecUInt *puint = G_PARAM_SPEC_UINT (vol_spec); + guint scale = puint->maximum - puint->minimum; + guint vol_guint = (guint) ((scale * volume) + puint->minimum); + + GST_WARNING ("Range: %u - %u, Converted: %u", + puint->minimum, puint->maximum, vol_guint); + g_value_set_uint (converted_vol, vol_guint); + break; } + case G_TYPE_INT: + { + GParamSpecInt *pint = G_PARAM_SPEC_INT (vol_spec); + gint scale = pint->maximum - pint->minimum; + gint vol_gint = (gint) ((scale * volume) + pint->minimum); + + GST_WARNING ("Range: %d - %d, Converted: %d", + pint->minimum, pint->maximum, vol_gint); + g_value_set_int (converted_vol, vol_gint); + break; + } + case G_TYPE_DOUBLE: + case G_TYPE_FLOAT: + { + GST_WARNING ("Default converted to float: %f", volume); + g_value_set_double (converted_vol, volume); + break; + } + default: + GST_WARNING ("Dont know how to convert volume"); } + + return converted_vol; } static void +update_volume (GstPlayBinMaemo *pbm, gfloat volume) +{ + pbm->volume = volume; + if (pbm->volume_element) { + GValue *converted_vol = convert_volume_base (pbm, volume); + g_object_set_property (G_OBJECT (pbm->volume_element), "volume", + converted_vol); + g_value_unset (converted_vol); + } +} + +static void update_xid (GstPlayBinMaemo *pbm) { - if ((pbm->video_sink != NULL) && - (pbm->xid != -1) && - (GST_IS_X_OVERLAY (pbm->video_sink))) { + if ((pbm->video_sink != NULL) && (pbm->xid != -1) && + (GST_IS_X_OVERLAY (pbm->video_sink))) { Display *display; g_object_set (G_OBJECT (pbm->video_sink), "force-aspect-ratio", TRUE, NULL); + display = XOpenDisplay(NULL); + XMapRaised(display, pbm->xid); - XSetErrorHandler(x_error_handler); XSync (display, FALSE); + XSetErrorHandler(x_error_handler); + gst_x_overlay_set_xwindow_id (GST_X_OVERLAY (pbm->video_sink), pbm->xid); } } static int -x_error_handler(Display *display, XErrorEvent *event) +x_error_handler(Display *display, + XErrorEvent *event) { - g_debug ("In x error handler:"); + GST_DEBUG ("In x error handler:"); switch (event->error_code) { case BadWindow: - g_debug ("got bad window"); + GST_DEBUG ("got bad window"); break; case BadDrawable: - g_debug ("got bad drawable"); + GST_DEBUG ("got bad drawable"); break; case BadGC: - g_debug ("got bad gc"); + GST_DEBUG ("got bad gc"); break; default: - g_debug ("unhandled x error = %d", event->error_code); + GST_DEBUG ("unhandled x error = %d", event->error_code); } return 0; Modified: trunk/gst-gmyth/playbinmaemo/gstplaybinmaemo.h =================================================================== --- trunk/gst-gmyth/playbinmaemo/gstplaybinmaemo.h 2007-08-17 18:28:10 UTC (rev 816) +++ trunk/gst-gmyth/playbinmaemo/gstplaybinmaemo.h 2007-08-17 21:47:49 UTC (rev 817) @@ -48,7 +48,7 @@ gboolean is_stream; gboolean parse_metadata; glong xid; - guint volume; + gfloat volume; /* currently loaded media */ gboolean need_rebuild; @@ -56,7 +56,7 @@ gchar *uri; GstElement *volume_element; GstElement *source; - GstElement *sink_video; + GstElement *video_sink; GList *elements; GList *factories; }; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ren...@us...> - 2007-08-17 18:38:02
|
Revision: 816 http://gmyth.svn.sourceforge.net/gmyth/?rev=816&view=rev Author: renatofilho Date: 2007-08-17 11:28:10 -0700 (Fri, 17 Aug 2007) Log Message: ----------- bug fixes Modified Paths: -------------- trunk/gmyth-stream/gmemcoder/src/gmencoder.c Modified: trunk/gmyth-stream/gmemcoder/src/gmencoder.c =================================================================== --- trunk/gmyth-stream/gmemcoder/src/gmencoder.c 2007-08-16 14:48:57 UTC (rev 815) +++ trunk/gmyth-stream/gmemcoder/src/gmencoder.c 2007-08-17 18:28:10 UTC (rev 816) @@ -655,7 +655,7 @@ if (priv->timeout_id != 0) { g_source_remove (priv->timeout_id); } - priv->timeout_id = g_timeout_add(GMENCODER_TIMEOUT, _process_timeout_cb, self); + //priv->timeout_id = g_timeout_add(GMENCODER_TIMEOUT, _process_timeout_cb, self); } void This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |