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-2020 Live Networks, Inc. All rights reserved. |
18 | // A 'ServerMediaSubsession' object that creates new, unicast, "RTPSink"s |
19 | // on demand, from a MPEG-1 or 2 demuxer. |
20 | // C++ header |
21 | |
22 | #ifndef _MPEG_1OR2_DEMUXED_SERVER_MEDIA_SUBSESSION_HH |
23 | #define _MPEG_1OR2_DEMUXED_SERVER_MEDIA_SUBSESSION_HH |
24 | |
25 | #ifndef _ON_DEMAND_SERVER_MEDIA_SUBSESSION_HH |
26 | #include "OnDemandServerMediaSubsession.hh" |
27 | #endif |
28 | #ifndef _MPEG_1OR2_FILE_SERVER_DEMUX_HH |
29 | #include "MPEG1or2FileServerDemux.hh" |
30 | #endif |
31 | |
32 | class MPEG1or2DemuxedServerMediaSubsession: public OnDemandServerMediaSubsession{ |
33 | public: |
34 | static MPEG1or2DemuxedServerMediaSubsession* |
35 | createNew(MPEG1or2FileServerDemux& demux, u_int8_t streamIdTag, |
36 | Boolean reuseFirstSource, |
37 | Boolean iFramesOnly = False, double vshPeriod = 5.0); |
38 | // The last two parameters are relevant for video streams only |
39 | |
40 | private: |
41 | MPEG1or2DemuxedServerMediaSubsession(MPEG1or2FileServerDemux& demux, |
42 | u_int8_t streamIdTag, Boolean reuseFirstSource, |
43 | Boolean iFramesOnly, double vshPeriod); |
44 | // called only by createNew(); |
45 | virtual ~MPEG1or2DemuxedServerMediaSubsession(); |
46 | |
47 | private: // redefined virtual functions |
48 | virtual void seekStreamSource(FramedSource* inputSource, double& seekNPT, double streamDuration, u_int64_t& numBytes); |
49 | virtual FramedSource* createNewStreamSource(unsigned clientSessionId, |
50 | unsigned& estBitrate); |
51 | virtual RTPSink* createNewRTPSink(Groupsock* rtpGroupsock, |
52 | unsigned char rtpPayloadTypeIfDynamic, |
53 | FramedSource* inputSource); |
54 | virtual float duration() const; |
55 | |
56 | private: |
57 | MPEG1or2FileServerDemux& fOurDemux; |
58 | u_int8_t fStreamIdTag; |
59 | Boolean fIFramesOnly; // for video streams |
60 | double fVSHPeriod; // for video streams |
61 | }; |
62 | |
63 | #endif |
64 | |