1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
|
/*
* player.c: Web video plugin for the Video Disk Recorder
*
* See the README file for copyright information and how to reach the author.
*
* $Id$
*/
#include <stdio.h>
#include <string.h>
#include <vdr/plugin.h>
#include "player.h"
#include "common.h"
bool cXineliboutputPlayer::Launch(const char *url) {
debug("launching xinelib player, url = %s", url);
char *url2;
if (strncmp(url, "file://", 7) == 0) {
url2 = (char *)malloc(strlen(url)+1);
strcpy(url2, "fifo://");
strcat(url2, url+7);
} else {
url2 = strdup(url);
}
/*
* xineliboutput plugin insists on percent encoding (certain
* characters in) the URL. A properly encoded URL will get broken if
* we let xineliboutput to encode it the second time. For example,
* current (Feb 2009) Youtube URLs are affected by this. We will
* decode the URL before passing it to xineliboutput to fix Youtube
*
* On the other hand, some URLs will get broken if the encoding is
* removed here. There simply isn't a way to make all URLs work
* because of the way xineliboutput handles the encoding.
*/
char *decoded = URLdecode(url2);
debug("decoded = %s", decoded);
bool ret = cPluginManager::CallFirstService("MediaPlayer-1.0", (void *)decoded);
free(decoded);
free(url2);
return ret;
}
bool cMPlayerPlayer::Launch(const char *url) {
/*
* This code for launching mplayer plugin is just for testing, and
* most likely does not work.
*/
debug("launching MPlayer");
warning("Support for MPlayer is experimental. Don't expect this to work!");
struct MPlayerServiceData
{
int result;
union
{
const char *filename;
} data;
};
const char* const tmpPlayListFileName = "/tmp/webvideo.m3u";
FILE *f = fopen(tmpPlayListFileName, "w");
fwrite(url, strlen(url), 1, f);
fclose(f);
MPlayerServiceData mplayerdata;
mplayerdata.data.filename = tmpPlayListFileName;
if (!cPluginManager::CallFirstService("MPlayer-Play-v1", &mplayerdata)) {
debug("Failed to locate Mplayer service");
return false;
}
if (!mplayerdata.result) {
debug("Mplayer service failed");
return false;
}
return true;
}
|