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// 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
28class MP3ADUTranscoder: public FramedFilter {
29public:
30 static MP3ADUTranscoder* createNew(UsageEnvironment& env,
31 unsigned outBitrate /* in kbps */,
32 FramedSource* inputSource);
33
34 unsigned outBitrate() const { return fOutBitrate; }
35protected:
36 MP3ADUTranscoder(UsageEnvironment& env,
37 unsigned outBitrate /* in kbps */,
38 FramedSource* inputSource);
39 // called only by createNew()
40 virtual ~MP3ADUTranscoder();
41
42private:
43 // redefined virtual functions:
44 virtual void doGetNextFrame();
45 virtual void getAttributes() const;
46
47private:
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
56private:
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