OSDN Git Service

RTMP to VLC
[porridge/main.git] / rtmpstream.c
1 #include <stdio.h>
2 #include <string.h>
3 #include <stdlib.h>
4
5 #include "rtmpstream.h"
6
7 RtmpStream* n_RtmpStream(char* URL, char* N, char* ticket)
8 {
9     RtmpStream* stream = (RtmpStream *)malloc(sizeof(RtmpStream));
10     stream->URL = URL;
11     stream->N = N;
12     stream->ticket = ticket;
13     stream->swfpath = "http://live.nicovideo.jp/fda9d312_nicoliveplayer.swf";
14     stream->swfver = "MAC 10,0,32,18";
15     stream->player = "/Applications/VLC.app/Contents/MacOS/VLC";
16     stream->dumper = "rtmpdump";
17 }
18
19 void open_Stream(RtmpStream* stream)
20 {
21     char command[1024];
22     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);
23     printf("%s\n", command);
24     system(command);
25 }
26
27 void d_RtmpStream(RtmpStream* stream)
28 {
29     if (stream != NULL)
30     {
31         free(stream);
32     }
33 }
34
35 /*int main()
36 {
37     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");
38     open_Stream(stream);
39     d_RtmpStream(stream);
40     return 0;
41 }*/
42