3
* arch-tag: Implementation of main MonkeyMedia interface
5
* Copyright (C) 2002 Jorn Baayen <jorn@nl.linux.org>
6
* Marco Pesenti Gritti <marco@it.gnome.org>
7
* Bastien Nocera <hadess@hadess.net>
8
* Seth Nickell <snickell@stanford.edu>
10
* This program is free software; you can redistribute it and/or modify
11
* it under the terms of the GNU General Public License as published by
12
* the Free Software Foundation; either version 2 of the License, or
13
* (at your option) any later version.
15
* This program is distributed in the hope that it will be useful,
16
* but WITHOUT ANY WARRANTY; without even the implied warranty of
17
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18
* GNU General Public License for more details.
20
* You should have received a copy of the GNU General Public License
21
* along with this program; if not, write to the Free Software
22
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
28
#include <gconf/gconf.h>
29
#include <gconf/gconf-client.h>
30
#include <libgnomevfs/gnome-vfs-init.h>
31
#include <libgnomevfs/gnome-vfs-utils.h>
32
#include <libgnomevfs/gnome-vfs-mime-utils.h>
33
#include <libgnomevfs/gnome-vfs-mime-info.h>
34
#include <libgnomevfs/gnome-vfs-mime-handlers.h>
35
#include <libgnomevfs/gnome-vfs-application-registry.h>
43
#include <gst/control/control.h>
46
#include "monkey-media.h"
47
#include "monkey-media-stream-info.h"
48
#include "monkey-media-private.h"
50
#include "vorbis-stream-info-impl.h"
51
#include "mp3-stream-info-impl.h"
52
#include "audiocd-stream-info-impl.h"
54
#include "flac-stream-info-impl.h"
57
#include "mp4-stream-info-impl.h"
60
static void monkey_media_init_internal (void);
65
GType stream_info_impl_type;
68
static GPtrArray *impl_array;
70
#define CONF_DIR "/system/monkey_media"
71
#define CONF_KEY_AUDIO_DRIVER "/system/monkey_media/audio_driver"
72
#define CONF_KEY_CD_DRIVE "/system/monkey_media/cd_drive"
73
#define CONF_KEY_CD_PLAYBACK_MODE "/system/monkey_media/cd_playback_mode"
76
monkey_media_init (int *argc, char ***argv)
78
monkey_media_init_internal ();
82
register_type (const char *mime_type,
83
GType stream_info_impl_type)
87
impl = g_new0 (Impl, 1);
89
impl->mime_type = g_strdup (mime_type);
90
impl->stream_info_impl_type = stream_info_impl_type;
92
g_ptr_array_add (impl_array, impl);
96
monkey_media_init_internal (void)
98
/* register mimetypes */
99
impl_array = g_ptr_array_new ();
101
register_type ("application/ogg",
102
TYPE_VORBIS_STREAM_INFO_IMPL);
103
register_type ("application/x-ogg",
104
TYPE_VORBIS_STREAM_INFO_IMPL);
107
register_type ("application/x-flac",
108
TYPE_FLAC_STREAM_INFO_IMPL);
109
register_type ("audio/x-flac",
110
TYPE_FLAC_STREAM_INFO_IMPL);
113
register_type ("audio/x-mp3",
114
TYPE_MP3_STREAM_INFO_IMPL);
115
register_type ("audio/mpeg",
116
TYPE_MP3_STREAM_INFO_IMPL);
117
register_type ("audio/x-wav",
118
TYPE_MP3_STREAM_INFO_IMPL);
121
register_type ("audio/x-m4a",
122
TYPE_MP4_STREAM_INFO_IMPL);
125
register_type ("audiocd",
126
TYPE_AUDIOCD_STREAM_INFO_IMPL);
132
monkey_media_get_supported_filename_extensions (void)
137
for (i = 0; i < impl_array->len; i++) {
138
Impl *impl = g_ptr_array_index (impl_array, i);
139
GList *types = gnome_vfs_mime_get_extensions_list (impl->mime_type);
142
for (tem = types; tem != NULL; tem = g_list_next (tem))
143
ret = g_list_append (ret, tem->data);
152
monkey_media_shutdown (void)
155
for (i = 0; i < impl_array->len; i++)
159
impl = g_ptr_array_index (impl_array, i);
161
g_free (impl->mime_type);
164
g_ptr_array_free (impl_array, FALSE);
168
monkey_media_get_impl_for (const char *uri, char **mimetype)
173
if (strncmp (uri, "audiocd://", 10) == 0)
174
*mimetype = g_strdup ("audiocd");
176
*mimetype = gnome_vfs_get_mime_type (uri);
178
if (*mimetype == NULL)
181
for (i = 0; i < impl_array->len; i++)
185
impl = g_ptr_array_index (impl_array, i);
187
if (strcmp (impl->mime_type, *mimetype) == 0)
198
monkey_media_get_stream_info_impl_for (const char *uri, char **mimetype)
202
impl = monkey_media_get_impl_for (uri, mimetype);
207
return impl->stream_info_impl_type;