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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
21 #ifndef MEDIAPROVIDER_H
22 #define MEDIAPROVIDER_H
27 #include <arpa/inet.h>
41 this interface has to be implemented by
42 any provider of media data.
43 In all URIs the provider has to insert providerIds out of its range.
45 all operations to one channel are not thread save - so users have to ensure
46 that at most one thread at a time is accesing operations to one channel.
47 Implementers have to ensure that other operations are thread safe.
48 Exception: registering providers is not thread safe (at least at the moment).
51 //the max number of media channels used in parallel
53 //name of a media file
60 virtual ~MediaProvider(){}
63 * get the root media list
64 * the returned list has to be destroyed by the caller
65 * if NULL is returned currently no media is available
67 virtual MediaList* getRootList()=0;
70 * get a medialist for a given parent
71 * the returned list has to be destroyed by the caller
72 * NULL if no entries found
74 virtual MediaList* getMediaList(const MediaURI * parent)=0;
78 * afterwards getBlock or other functions must be possible
79 * currently only one medium is open at the same time
81 * @param channel: channel id, NUMCHANNELS must be supported
82 * @param xsize,ysize: size of the screen
83 * @param size out: the size of the medium
84 * @return != 0 in case of error
87 virtual int openMedium(ULONG channel, const MediaURI * uri, ULLONG * size, ULONG xsize, ULONG ysize)=0;
90 * get a block for a channel
91 * @param offset - the offset
92 * @param len - the required len
93 * @param outlen out - the read len if 0 this is EOF
94 * @param buffer out the allocated buffer (must be freed with free!)
95 * if buffer is set at input the implementation CAN use
96 * this buffer - it is up to the caller to test if the buffer
97 * is at the same value when the method returns.
98 * it is assumed that there is enough room in the buffer if it set
100 * @return != 0 in case of error
102 virtual int getMediaBlock(ULONG channel, ULLONG offset, ULONG len, ULONG * outlen,
103 unsigned char ** buffer)=0;
106 * close a media channel
108 virtual int closeMediaChannel(ULONG channel)=0;
111 * return the media info for a given channel
112 * return != 0 on error
113 * the caller has to provide a pointer to an existing media info
115 virtual int getMediaInfo(ULONG channel, MediaInfo * result)=0;
121 * the mediaplayer to register providers at
122 * can be static ctor's
124 class MediaPlayerRegister {
126 virtual void registerMediaProvider(MediaProvider *pi,ULONG id,ULONG range=1)=0;
127 virtual ~MediaPlayerRegister(){}
128 static MediaPlayerRegister* getInstance();
130 static MediaPlayerRegister *instance;