]> git.vomp.tv Git - vompclient.git/blob - mediaplayer.h
Compile fix for MVP re: location change of hmsf
[vompclient.git] / mediaplayer.h
1 /*
2     Copyright 2004-2005 Chris Tallon, Andreas Vogel
3
4     This file is part of VOMP.
5
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.
10
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.
15
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.
19 */
20
21 #ifndef MEDIAPLAYER
22 #define MEDIAPLAYER
23
24
25 #include <vector>
26 using namespace std;
27 #include <stdio.h>
28 #include <string.h>
29 #include "mediaprovider.h"
30
31 class MediaProviderHolder;
32
33
34 class MediaPlayer : public MediaPlayerRegister, public MediaProvider
35 {
36   public:
37     MediaPlayer();
38     virtual ~MediaPlayer();
39
40     /**
41       * get the root media list
42       * the returned list has to be destroyed by the caller
43       * if NULL is returned currently no media is available
44       */
45     virtual MediaList* getRootList();
46
47     /**
48       * get a medialist for a given parent
49       * the returned list has to be destroyed by the caller
50       * NULL if no entries found
51       */
52     virtual MediaList* getMediaList(const MediaURI * parent);
53
54     /**
55       * open a media uri
56       * afterwards getBlock or other functions must be possible
57       * currently only one medium is open at the same time
58       * for a given channel
59       * @param channel: channel id, NUMCHANNELS must be supported
60       * @param xsize,ysize: size of the screen
61       * @param size out: the size of the medium
62       * @return != 0 in case of error
63       * 
64       */
65     virtual int openMedium(ULONG channel, const MediaURI * uri, ULLONG * size, ULONG xsize, ULONG ysize);
66
67     /**
68       * get a block for a channel
69       * @param offset - the offset
70       * @param len - the required len
71       * @param outlen out - the read len if 0 this is EOF
72       * @param buffer out the allocated buffer (must be freed with free!)
73       * @return != 0 in case of error
74       */           
75     virtual int getMediaBlock(ULONG channel, ULLONG offset, ULONG len, ULONG * outlen,
76         unsigned char ** buffer);
77
78     /**
79       * close a media channel
80       */
81     virtual int closeMediaChannel(ULONG channel);
82
83     /**
84       * return the media info for a given channel
85       * return != 0 on error
86       * the caller has to provide a pointer to an existing media info
87       */
88     virtual int getMediaInfo(ULONG channel, struct MediaInfo * result);
89     
90     /**
91       * from MediaPlayerRegister
92       */
93     virtual void registerMediaProvider(MediaProvider *p,ULONG providerID,ULONG range);
94
95     /**
96       * the instance
97       */
98     static MediaPlayer * getInstance();
99
100   private:
101     MediaProvider * providerById(ULONG id);
102     typedef vector<MediaProviderHolder *> Tplist;
103     Tplist plist;
104     struct channelInfo {
105       ULONG providerId;
106       MediaProvider *provider;
107       channelInfo() {
108         provider=NULL;
109         providerId=0;
110       }
111       };
112     struct channelInfo info[NUMCHANNELS];
113
114 };
115
116
117 #endif