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 | // Collects a stream of incoming MPEG Transport Stream packets into |
19 | // a chunk sufficiently large to send in a single outgoing (RTP or UDP) packet. |
20 | // C++ header |
21 | |
22 | #ifndef _MPEG2_TRANSPORT_STREAM_ACCUMULATOR_HH |
23 | #define _MPEG_TRANSPORT_STREAM_ACCUMULATOR_HH |
24 | |
25 | #ifndef _FRAMED_FILTER_HH |
26 | #include "FramedFilter.hh" |
27 | #endif |
28 | |
29 | class MPEG2TransportStreamAccumulator: public FramedFilter { |
30 | public: |
31 | static MPEG2TransportStreamAccumulator* createNew(UsageEnvironment& env, |
32 | FramedSource* inputSource, |
33 | unsigned maxPacketSize = 1456); |
34 | |
35 | protected: |
36 | MPEG2TransportStreamAccumulator(UsageEnvironment& env, |
37 | FramedSource* inputSource, unsigned maxPacketSize); |
38 | // called only by createNew() |
39 | virtual ~MPEG2TransportStreamAccumulator(); |
40 | |
41 | private: |
42 | // redefined virtual functions: |
43 | virtual void doGetNextFrame(); |
44 | |
45 | private: |
46 | static void afterGettingFrame(void* clientData, unsigned frameSize, |
47 | unsigned numTruncatedBytes, |
48 | struct timeval presentationTime, |
49 | unsigned durationInMicroseconds); |
50 | void afterGettingFrame1(unsigned frameSize, |
51 | unsigned numTruncatedBytes, |
52 | struct timeval presentationTime, |
53 | unsigned durationInMicroseconds); |
54 | |
55 | private: |
56 | unsigned const fDesiredPacketSize; |
57 | unsigned fNumBytesGathered; |
58 | }; |
59 | |
60 | #endif |
61 | |
62 | #ifndef _MP3_TRANSCODER_HH |
63 | #define _MP3_TRANSCODER_HH |
64 | |
65 | #ifndef _MP3_ADU_HH |
66 | #include "MP3ADU.hh" |
67 | #endif |
68 | #ifndef _MP3_ADU_TRANSCODER_HH |
69 | #include "MP3ADUTranscoder.hh" |
70 | #endif |
71 | |
72 | class MP3Transcoder: public MP3FromADUSource { |
73 | public: |
74 | static MP3Transcoder* createNew(UsageEnvironment& env, |
75 | unsigned outBitrate /* in kbps */, |
76 | FramedSource* inputSource); |
77 | |
78 | protected: |
79 | MP3Transcoder(UsageEnvironment& env, |
80 | MP3ADUTranscoder* aduTranscoder); |
81 | // called only by createNew() |
82 | virtual ~MP3Transcoder(); |
83 | }; |
84 | |
85 | #endif |
86 | |