2
* Copyright (C) 2003-2009 The Music Player Daemon Project
3
* http://www.musicpd.org
5
* This program is free software; you can redistribute it and/or modify
6
* it under the terms of the GNU General Public License as published by
7
* the Free Software Foundation; either version 2 of the License, or
8
* (at your option) any later version.
10
* This program is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
* GNU General Public License for more details.
15
* You should have received a copy of the GNU General Public License along
16
* with this program; if not, write to the Free Software Foundation, Inc.,
17
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20
#include "input/mms_input_plugin.h"
21
#include "input_plugin.h"
24
#include <libmms/mmsx.h>
30
#define G_LOG_DOMAIN "input_mms"
39
input_mms_open(struct input_stream *is, const char *url)
43
if (!g_str_has_prefix(url, "mms://") &&
44
!g_str_has_prefix(url, "mmsh://") &&
45
!g_str_has_prefix(url, "mmst://") &&
46
!g_str_has_prefix(url, "mmsu://"))
49
m = g_new(struct input_mms, 1);
50
m->mms = mmsx_connect(NULL, NULL, url, 128 * 1024);
52
g_warning("mmsx_connect() failed");
56
/* XX is this correct? at least this selects the ffmpeg
57
decoder, which seems to work fine*/
58
is->mime = g_strdup("audio/x-ms-wma");
60
is->plugin = &input_plugin_mms;
67
input_mms_read(struct input_stream *is, void *ptr, size_t size)
69
struct input_mms *m = is->data;
72
ret = mmsx_read(NULL, m->mms, ptr, size);
76
g_warning("mmsx_read() failed: %s", g_strerror(errno));
89
input_mms_close(struct input_stream *is)
91
struct input_mms *m = is->data;
98
input_mms_eof(struct input_stream *is)
100
struct input_mms *m = is->data;
106
input_mms_buffer(G_GNUC_UNUSED struct input_stream *is)
112
input_mms_seek(G_GNUC_UNUSED struct input_stream *is,
113
G_GNUC_UNUSED off_t offset, G_GNUC_UNUSED int whence)
118
const struct input_plugin input_plugin_mms = {
120
.open = input_mms_open,
121
.close = input_mms_close,
122
.buffer = input_mms_buffer,
123
.read = input_mms_read,
124
.eof = input_mms_eof,
125
.seek = input_mms_seek,