1/**********
2This library is free software; you can redistribute it and/or modify it under
3the terms of the GNU Lesser General Public License as published by the
4Free Software Foundation; either version 3 of the License, or (at your
5option) any later version. (See <http://www.gnu.org/copyleft/lesser.html>.)
6
7This library is distributed in the hope that it will be useful, but WITHOUT
8ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
9FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for
10more details.
11
12You should have received a copy of the GNU Lesser General Public License
13along with this library; if not, write to the Free Software Foundation, Inc.,
1451 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
15**********/
16// "liveMedia"
17// Copyright (c) 1996-2020 Live Networks, Inc. All rights reserved.
18// A source that consists of multiple byte-stream files, read sequentially.
19// (The input is an array of file names, with a terminating 'file name' of NULL.)
20// C++ header
21
22#ifndef _BYTE_STREAM_MULTI_FILE_SOURCE_HH
23#define _BYTE_STREAM_MULTI_FILE_SOURCE_HH
24
25#ifndef _BYTE_STREAM_FILE_SOURCE_HH
26#include "ByteStreamFileSource.hh"
27#endif
28
29class ByteStreamMultiFileSource: public FramedSource {
30public:
31 static ByteStreamMultiFileSource*
32 createNew(UsageEnvironment& env, char const** fileNameArray,
33 unsigned preferredFrameSize = 0, unsigned playTimePerFrame = 0);
34 // "fileNameArray" is a pointer to an array of (char const*) file names, with
35 // A 'file name' of NULL indicating the end of the array
36
37 Boolean haveStartedNewFile() const { return fHaveStartedNewFile; }
38 // True iff the most recently delivered frame was the first from a newly-opened file
39
40protected:
41 ByteStreamMultiFileSource(UsageEnvironment& env, char const** fileNameArray,
42 unsigned preferredFrameSize, unsigned playTimePerFrame);
43 // called only by createNew()
44
45 virtual ~ByteStreamMultiFileSource();
46
47private:
48 // redefined virtual functions:
49 virtual void doGetNextFrame();
50
51private:
52 static void onSourceClosure(void* clientData);
53 void onSourceClosure1();
54 static void afterGettingFrame(void* clientData,
55 unsigned frameSize, unsigned numTruncatedBytes,
56 struct timeval presentationTime,
57 unsigned durationInMicroseconds);
58
59private:
60 unsigned fPreferredFrameSize;
61 unsigned fPlayTimePerFrame;
62 unsigned fNumSources;
63 unsigned fCurrentlyReadSourceNumber;
64 Boolean fHaveStartedNewFile;
65 char const** fFileNameArray;
66 ByteStreamFileSource** fSourceArray;
67};
68
69#endif
70