live
OggFileServerDemux.hh
Go to the documentation of this file.
1 /**********
2 This library is free software; you can redistribute it and/or modify it under
3 the terms of the GNU Lesser General Public License as published by the
4 Free Software Foundation; either version 3 of the License, or (at your
5 option) any later version. (See <http://www.gnu.org/copyleft/lesser.html>.)
6 
7 This library is distributed in the hope that it will be useful, but WITHOUT
8 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
9 FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for
10 more details.
11 
12 You should have received a copy of the GNU Lesser General Public License
13 along with this library; if not, write to the Free Software Foundation, Inc.,
14 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
15 **********/
16 // "liveMedia"
17 // Copyright (c) 1996-2021 Live Networks, Inc. All rights reserved.
18 // A server demultiplexor for an Ogg file
19 // C++ header
20 
21 #ifndef _OGG_FILE_SERVER_DEMUX_HH
22 #define _OGG_FILE_SERVER_DEMUX_HH
23 
24 #ifndef _SERVER_MEDIA_SESSION_HH
25 #include "ServerMediaSession.hh"
26 #endif
27 
28 #ifndef _OGG_FILE_HH
29 #include "OggFile.hh"
30 #endif
31 
32 class OggFileServerDemux: public Medium {
33 public:
34  typedef void (onCreationFunc)(OggFileServerDemux* newDemux, void* clientData);
35  static void createNew(UsageEnvironment& env, char const* fileName,
36  onCreationFunc* onCreation, void* onCreationClientData);
37  // Note: Unlike most "createNew()" functions, this one doesn't return a new object immediately. Instead, because this class
38  // requires file reading (to parse the Ogg 'Track' headers) before a new object can be initialized, the creation of a new
39  // object is signalled by calling - from the event loop - an 'onCreationFunc' that is passed as a parameter to "createNew()".
40 
42  ServerMediaSubsession* newServerMediaSubsession(u_int32_t& resultTrackNumber);
43  // Returns a new "ServerMediaSubsession" object that represents the next media track
44  // from the file. This function returns NULL when no more media tracks exist.
45 
47  // As above, but creates a new "ServerMediaSubsession" object for a specific track number
48  // within the Ogg file.
49  // (You should not call this function more than once with the same track number.)
50 
51  // The following public: member functions are called only by the "ServerMediaSubsession" objects:
52 
54  char const* fileName() const { return fFileName; }
55 
56  FramedSource* newDemuxedTrack(unsigned clientSessionId, u_int32_t trackNumber);
57  // Used by the "ServerMediaSubsession" objects to implement their "createNewStreamSource()" virtual function.
58 
59 private:
61  onCreationFunc* onCreation, void* onCreationClientData);
62  // called only by createNew()
64 
65  static void onOggFileCreation(OggFile* newFile, void* clientData);
66  void onOggFileCreation(OggFile* newFile);
67 
68  static void onDemuxDeletion(void* clientData, OggDemux* demuxBeingDeleted);
69  void onDemuxDeletion(OggDemux* demuxBeingDeleted);
70 
71 private:
72  char const* fFileName;
76 
77  // Used to implement "newServerMediaSubsession()":
79 
80  // Used to set up demuxing, to implement "newDemuxedTrack()":
83 };
84 
85 #endif
Definition: Media.hh:50
virtual ~OggFileServerDemux()
void onDemuxDeletion(OggDemux *demuxBeingDeleted)
void() onCreationFunc(OggFileServerDemux *newDemux, void *clientData)
ServerMediaSubsession * newServerMediaSubsession(u_int32_t &resultTrackNumber)
OggFileServerDemux(UsageEnvironment &env, char const *fileName, onCreationFunc *onCreation, void *onCreationClientData)
static void onOggFileCreation(OggFile *newFile, void *clientData)
FramedSource * newDemuxedTrack(unsigned clientSessionId, u_int32_t trackNumber)
ServerMediaSubsession * newServerMediaSubsession()
void onOggFileCreation(OggFile *newFile)
ServerMediaSubsession * newServerMediaSubsessionByTrackNumber(u_int32_t trackNumber)
static void createNew(UsageEnvironment &env, char const *fileName, onCreationFunc *onCreation, void *onCreationClientData)
onCreationFunc * fOnCreation
OggTrackTableIterator * fIter
char const * fileName() const
static void onDemuxDeletion(void *clientData, OggDemux *demuxBeingDeleted)