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 | // Transcoder for ADUized MP3 frames |
19 | // C++ header |
20 | |
21 | #ifndef _MP3_ADU_TRANSCODER_HH |
22 | #define _MP3_ADU_TRANSCODER_HH |
23 | |
24 | #ifndef _FRAMED_FILTER_HH |
25 | #include "FramedFilter.hh" |
26 | #endif |
27 | |
28 | class MP3ADUTranscoder: public FramedFilter { |
29 | public: |
30 | static MP3ADUTranscoder* createNew(UsageEnvironment& env, |
31 | unsigned outBitrate /* in kbps */, |
32 | FramedSource* inputSource); |
33 | |
34 | unsigned outBitrate() const { return fOutBitrate; } |
35 | protected: |
36 | MP3ADUTranscoder(UsageEnvironment& env, |
37 | unsigned outBitrate /* in kbps */, |
38 | FramedSource* inputSource); |
39 | // called only by createNew() |
40 | virtual ~MP3ADUTranscoder(); |
41 | |
42 | private: |
43 | // redefined virtual functions: |
44 | virtual void doGetNextFrame(); |
45 | virtual void getAttributes() const; |
46 | |
47 | private: |
48 | static void afterGettingFrame(void* clientData, |
49 | unsigned numBytesRead, unsigned numTruncatedBytes, |
50 | struct timeval presentationTime, |
51 | unsigned durationInMicroseconds); |
52 | void afterGettingFrame1(unsigned numBytesRead, unsigned numTruncatedBytes, |
53 | struct timeval presentationTime, |
54 | unsigned durationInMicroseconds); |
55 | |
56 | private: |
57 | unsigned fOutBitrate; // in kbps |
58 | unsigned fAvailableBytesForBackpointer; |
59 | |
60 | unsigned char* fOrigADU; |
61 | // used to store incoming ADU prior to transcoding |
62 | }; |
63 | |
64 | #endif |
65 | |