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
25 #include "mediaprovider.h"
28 class MediaFile : public MediaProvider
31 MediaFile(ULONG providerId);
34 * get the root media list
35 * the returned list has to be destroyed by the caller
36 * if NULL is returned currently no media is available
38 virtual MediaList* getRootList();
41 * get a medialist for a given parent
42 * the returned list has to be destroyed by the caller
43 * NULL if no entries found
45 virtual MediaList* getMediaList(const MediaURI * parent);
49 * afterwards getBlock or other functions must be possible
50 * currently only one medium is open at the same time
52 * @param channel: channel id, NUMCHANNELS must be supported
53 * @param xsize,ysize: size of the screen
54 * @param size out: the size of the medium
55 * @return != 0 in case of error
58 virtual int openMedium(ULONG channel, const MediaURI * uri, ULLONG * size, ULONG xsize, ULONG ysize);
61 * get a block for a channel
62 * @param offset - the offset
63 * @param len - the required len
64 * @param outlen out - the read len if 0 this is EOF
65 * @param buffer out the allocated buffer (must be freed with free!)
66 * @return != 0 in case of error
68 virtual int getMediaBlock(ULONG channel, ULLONG offset, ULONG len, ULONG * outlen,
69 unsigned char ** buffer);
72 * close a media channel
74 virtual int closeMediaChannel(ULONG channel);
77 * return the media info for a given channel
78 * return != 0 on error
79 * the caller has to provide a pointer to an existing media info
81 virtual int getMediaInfo(ULONG channel, MediaInfo * result);
86 * create a Media out of a given file
87 * the Media object ha sto be deleted by the caller
88 * return NULL if not there or no matching type
90 Media * createMedia(const char * dirname, const char * filename, bool withURI=false);
104 if (filename) delete[]filename;
105 if (file) fclose(file);
107 void setFilename(const char *f) {
108 if (filename) delete[] filename;
111 filename=new char[strlen(f)+1];
116 if (file) fclose(file);
118 if (filename) delete [] filename;
122 struct ChannelInfo channels[NUMCHANNELS];
125 virtual ULONG getMediaType(const char *filename);