2 Copyright 2004-2005 Chris Tallon, Andreas Vogel
4 This file is part of VOMP.
6 VOMP is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
11 VOMP is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with VOMP; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 #ifndef MEDIAPROVIDER_H
22 #define MEDIAPROVIDER_H
26 #include <arpa/inet.h>
36 this interface has to be implemented by
37 any provider of media data.
38 In all URIs the provider has to insert providerIds out of its range.
40 all operations to one channel are not thread save - so users have to ensure
41 that at most one thread at a time is accesing operations to one channel.
42 Implementers have to ensure that other operations are thread safe.
43 Exception: registering providers is not thread safe (at least at the moment).
46 //the max number of media channels used in parallel
48 //name of a media file
55 virtual ~MediaProvider(){}
58 * get the root media list
59 * the returned list has to be destroyed by the caller
60 * if NULL is returned currently no media is available
62 virtual MediaList* getRootList()=0;
65 * get a medialist for a given parent
66 * the returned list has to be destroyed by the caller
67 * NULL if no entries found
69 virtual MediaList* getMediaList(const MediaURI * parent)=0;
73 * afterwards getBlock or other functions must be possible
74 * currently only one medium is open at the same time
76 * @param channel: channel id, NUMCHANNELS must be supported
77 * @param xsize,ysize: size of the screen
78 * @param size out: the size of the medium
79 * @return != 0 in case of error
82 virtual int openMedium(ULONG channel, const MediaURI * uri, ULLONG * size, ULONG xsize, ULONG ysize)=0;
85 * get a block for a channel
86 * @param offset - the offset
87 * @param len - the required len
88 * @param outlen out - the read len if 0 this is EOF
89 * @param buffer out the allocated buffer (must be freed with free!)
90 * if buffer is set at input the implementation CAN use
91 * this buffer - it is up to the caller to test if the buffer
92 * is at the same value when the method returns.
93 * it is assumed that there is enough room in the buffer if it set
95 * @return != 0 in case of error
97 virtual int getMediaBlock(ULONG channel, ULLONG offset, ULONG len, ULONG * outlen,
98 unsigned char ** buffer)=0;
101 * close a media channel
103 virtual int closeMediaChannel(ULONG channel)=0;
106 * return the media info for a given channel
107 * return != 0 on error
108 * the caller has to provide a pointer to an existing media info
110 virtual int getMediaInfo(ULONG channel, MediaInfo * result)=0;
116 * the mediaplayer to register providers at
117 * can be static ctor's
119 class MediaPlayerRegister {
121 virtual void registerMediaProvider(MediaProvider *pi,ULONG id,ULONG range=1)=0;
122 virtual ~MediaPlayerRegister(){}
123 static MediaPlayerRegister* getInstance();
125 static MediaPlayerRegister *instance;