# HG changeset patch # User morphbr # Date 1171144420 0 # Node ID ff82d527d26ae59b479fa4bc7e1940299eda5456 # Parent 7005e696052c50e07f467f792ee731a3a1e875ef [svn r352] - Fixed memory leak on gmyth_vlc.c (command send) diff -r 7005e696052c -r ff82d527d26a gmyth/src/gmyth_vlc.c --- a/gmyth/src/gmyth_vlc.c Sat Feb 10 20:01:54 2007 +0000 +++ b/gmyth/src/gmyth_vlc.c Sat Feb 10 21:53:40 2007 +0000 @@ -45,9 +45,9 @@ */ int socket_send(int socket, gchar* msg) { - size_t size = strlen(msg) + 1; + size_t size = strlen(msg) + 2; // (\n + \0) gchar* final = (gchar *)g_malloc0(sizeof(gchar) * size); - g_snprintf(final, size+1, "%s\n", msg); + g_snprintf(final, size, "%s\n", msg); if (send(socket, final, strlen(final), 0) == -1) perror("GMyth_VLC: send error"); @@ -163,7 +163,7 @@ * @return 0 if success */ int gmyth_vlc_create_channel(GMythVlc *vlc, gchar* type,\ - int port) + int port, int vcodec) { int ret; size_t size = 40; @@ -182,16 +182,26 @@ size = 256; msg = (gchar *)g_malloc0(sizeof(gchar) * size); - // Best transcode option for N800 - g_snprintf(msg, size, "#transcode{vcodec=mp1v,vb=384," - "fps=25.0,scale=0.5,acodec=mpga," - "ab=64,channels=1}:duplicate{dst=" - "std{access=http,mux=mpeg1,dst=" - ":%d}}", port); + if ( vcodec == MPEG1 ) + + // Best transcode option for N800 (MP1V) + g_snprintf(msg, size, "#transcode{vcodec=mp1v,vb=384," + "fps=25.0,scale=1,acodec=mpga," + "ab=64,channels=1}:duplicate{dst=" + "std{access=http,mux=mpeg1,dst=" + ":%d}}", port); + else + + // Best transcode option for N800 (THEORA) + g_snprintf(msg, size, "#transcode{vcodec=theo,vb=384," + "fps=25.0,scale=1,acodec=vorb," + "ab=64,channels=1}:duplicate{dst=" + "std{access=http,mux=ogg,dst=" + ":%d}}", port); ret = gmyth_vlc_setup_output(vlc, vlc->n_outputs, "output", \ msg); - + vlc->n_outputs++; } diff -r 7005e696052c -r ff82d527d26a gmyth/src/gmyth_vlc.h --- a/gmyth/src/gmyth_vlc.h Sat Feb 10 20:01:54 2007 +0000 +++ b/gmyth/src/gmyth_vlc.h Sat Feb 10 21:53:40 2007 +0000 @@ -50,6 +50,10 @@ #define VLC_TELNET_PORT 4212 #define BUFFER 512 +#define MPEG1 0 +#define THEORA 1 + + typedef struct _GMythVlc GMythVlc; struct _GMythVlc @@ -85,7 +89,7 @@ gchar* file); int gmyth_vlc_create_channel(GMythVlc *vlc, gchar* type,\ - int port); + int port, int vcodec); int gmyth_vlc_connect(GMythVlc *vlc, GMythBackendInfo *backend_info,\ gchar* passwd, int port); diff -r 7005e696052c -r ff82d527d26a gmyth/tests/gmyth_test_vlc.c --- a/gmyth/tests/gmyth_test_vlc.c Sat Feb 10 20:01:54 2007 +0000 +++ b/gmyth/tests/gmyth_test_vlc.c Sat Feb 10 21:53:40 2007 +0000 @@ -22,7 +22,7 @@ if ( res >= 0 ) { - gmyth_vlc_create_channel(&vlc, "broadcast", 8080); + gmyth_vlc_create_channel(&vlc, "broadcast", 8080, THEORA); gmyth_vlc_create_input(&vlc, 0, "/tmp/grande.nuv"); gmyth_vlc_control_input(&vlc, 0, "play"); gmyth_vlc_disconnect(&vlc);