2 Copyright 2004-2006 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.
35 #include "threadwin.h"
46 class ImageReader : public Thread_TYPE, public Callback
50 //create an image reader for a media channel
51 //the channel must already been opened
52 ImageReader(int channel,MediaProvider *p);
53 //call shutdown before destroying the reader!
54 virtual ~ImageReader();
55 //request the next image block
56 //will return the current block (if already read) and request the next from the server
57 //rsize will return the received len: 0 on EOF, -1 on error
58 //the returned buffer has to be freed outside (really use free!)
59 //if the buffer is not filled it will wait until the chunk is received!
60 int getImageChunk(ULLONG offset,UINT len, UINT * rsize,UCHAR **buffer);
62 //is the reader still running?
63 bool isReaderRunning();
67 //stop the reader (waits until the reader thread does not access anything)
71 virtual void call(void * caller);
76 void threadPostStopCleanup();
79 MediaProvider * provider;
81 static const int MAXCHUNKS=2;
82 //start the player thread
88 void waitTimed(int ms);
100 UCHAR * buffer; //receive buffer (to be deallocated with free)
101 ULLONG offset; //offset within stream/file
102 UINT reqlen; //requested len
103 ULONG len; //received len
104 rstate state; //current state
114 //setting state in this array requires the thread lock
115 Chunk data[MAXCHUNKS];