OSDN Git Service

RTMP to VLC master
authorYoshinobu Date <espelanzalinux@git.sourceforge.jp>
Wed, 9 Oct 2013 14:50:47 +0000 (23:50 +0900)
committerYoshinobu Date <espelanzalinux@git.sourceforge.jp>
Wed, 9 Oct 2013 14:50:47 +0000 (23:50 +0900)
cookie.c
gui.c
makefile
playerstatus.c
rtmpstream.c [new file with mode: 0644]
rtmpstream.h [new file with mode: 0644]

index d09c870..ce486be 100644 (file)
--- a/cookie.c
+++ b/cookie.c
@@ -8,7 +8,7 @@
 
 // /info 6 /info 7 = emergency
 
-
+//"select value from moz_cookies where host = '.nicovideo.jp' and name = 'user_session';"
 
 //char (*browser_get[])(void) = {&chrome_get_user_session};
 
diff --git a/gui.c b/gui.c
index 481babc..f446292 100644 (file)
--- a/gui.c
+++ b/gui.c
@@ -11,6 +11,7 @@
 #include "playerstatus.h"
 
 #include "nicolive_comment.h"
+#include "rtmpstream.h"
 
 GtkWidget *comment_view;
 
@@ -98,6 +99,11 @@ connect (GtkWidget *widget,
     printf("放送タイトル:%s\n説明:%s\n放送主:%s\n",(*broadcast).title,(*broadcast).description,(*broadcast).owner_name);
     //printf("コメ鯖:%s\nポート:%d\nスレッド:%d\n",(*broadcast).msg_addr,(*broadcast).msg_port,(*broadcast).thread);
     
+    /*外部プレーヤー*/
+    
+    RtmpStream* stream = n_RtmpStream(broadcast->url, broadcast->contents, broadcast->ticket);
+    open_Stream(stream);
+    
     //一旦クリア
     memset(path, 0, sizeof(char)*64);
     memset(header, 0, malloc_size(header));
@@ -117,6 +123,9 @@ connect (GtkWidget *widget,
     (*info).postkey = contents + 8;
     http_close(session);
     
+
+//    d_RtmpStream(stream);
+    
  /*   sleep(1000);
     
     nicolive_comment_close(info);
index 21c4b5e..5841057 100644 (file)
--- a/makefile
+++ b/makefile
@@ -4,7 +4,7 @@
 CC      = gcc
 GUIOBJS = gui.o
 CUIOBJS = main.o
-BASEOBJS    = http.o playerstatus.o XmlSocket.o nicolive_comment.o cookie.o chrome.o
+BASEOBJS    = http.o playerstatus.o XmlSocket.o nicolive_comment.o cookie.o chrome.o rtmpstream.o
 GTKDEP = `pkg-config --cflags gtk+-2.0` -L/opt/local/lib -lgtk-quartz-2.0.0 -lgobject-2.0.0 -lglib-2.0.0
 SQLITEDEP      = -lsqlite3
 XMLDEP = `xml2-config --cflags --libs`
index e409c90..c96ac06 100644 (file)
@@ -168,8 +168,8 @@ void processNode(xmlTextReaderPtr reader, NICO_LIVE* session)
             //
         } else if ( state == STATE_CONTENTS ) {
             //printf("N: %s\n", value);
-            (*session).contents = (char*)malloc( strlen(value) + 1 );
-            strcpy((*session).contents, (const char *)value);
+            (*session).contents = (char*)malloc( strlen(value) + 1 - 5);
+            strcpy((*session).contents, (const char *)value + 5);
         } else if ( state == STATE_RTMP ) {
             //
         } else if ( state == STATE_URL ) {
diff --git a/rtmpstream.c b/rtmpstream.c
new file mode 100644 (file)
index 0000000..10c5196
--- /dev/null
@@ -0,0 +1,42 @@
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+
+#include "rtmpstream.h"
+
+RtmpStream* n_RtmpStream(char* URL, char* N, char* ticket)
+{
+    RtmpStream* stream = (RtmpStream *)malloc(sizeof(RtmpStream));
+    stream->URL = URL;
+    stream->N = N;
+    stream->ticket = ticket;
+    stream->swfpath = "http://live.nicovideo.jp/fda9d312_nicoliveplayer.swf";
+    stream->swfver = "MAC 10,0,32,18";
+    stream->player = "/Applications/VLC.app/Contents/MacOS/VLC";
+    stream->dumper = "rtmpdump";
+}
+
+void open_Stream(RtmpStream* stream)
+{
+    char command[1024];
+    sprintf(command, "%s -vr \"%s\" -C S:\"%s\" -N \"%s\" -f \"%s\" -s \"%s\" -o - | %s - &", stream->dumper, stream->URL, stream->ticket, stream->N, stream->swfver, stream->swfpath, stream->player);
+    printf("%s\n", command);
+    system(command);
+}
+
+void d_RtmpStream(RtmpStream* stream)
+{
+    if (stream != NULL)
+    {
+        free(stream);
+    }
+}
+
+/*int main()
+{
+    RtmpStream* stream = n_RtmpStream("rtmp://nleja04.live.nicovideo.jp:1935/liveedge/live_132008_21_0", "rtmp://nlpoca60.live.nicovideo.jp:1935/publicorigin/132008_21_0/,lv155320983?1381236011:30:fe85d2dd2bb927c6", "654502:lv155320983:0:1381236011:4e629ed7f4ba8f9e");
+    open_Stream(stream);
+    d_RtmpStream(stream);
+    return 0;
+}*/
+
diff --git a/rtmpstream.h b/rtmpstream.h
new file mode 100644 (file)
index 0000000..df1aae2
--- /dev/null
@@ -0,0 +1,18 @@
+#ifndef _RTMPSTREAM_H
+#define _RTMPSTREAM_H
+
+typedef struct {
+    char* URL;
+    char* swfpath;
+    char* swfver;
+    char* N;
+    char* ticket;
+    char* player;
+    char* dumper;
+} RtmpStream;
+
+RtmpStream* n_RtmpStream(char* URL, char* N, char* ticket);
+void open_Stream(RtmpStream* stream);
+void d_RtmpStream(RtmpStream* stream);
+
+#endif /* _RTMPSTREAM_H */