live
AC3AudioStreamFramer.hh
Go to the documentation of this file.
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-2024 Live Networks, Inc. All rights reserved.
18// A filter that breaks up an AC3 audio elementary stream into frames
19// C++ header
20
21#ifndef _AC3_AUDIO_STREAM_FRAMER_HH
22#define _AC3_AUDIO_STREAM_FRAMER_HH
23
24#ifndef _FRAMED_FILTER_HH
25#include "FramedFilter.hh"
26#endif
27
29public:
32 unsigned char streamCode = 0);
33 // If "streamCode" != 0, then we assume that there's a 1-byte code at the beginning of each chunk of data that we read from
34 // our source. If that code is not the value we want, we discard the chunk of data.
35 // However, if "streamCode" == 0 (the default), then we don't expect this 1-byte code.
36
37 unsigned samplingRate();
38
39 void flushInput(); // called if there is a discontinuity (seeking) in the input
40
41private:
43 unsigned char streamCode);
44 // called only by createNew()
46
47 static void handleNewData(void* clientData,
48 unsigned char* ptr, unsigned size,
49 struct timeval presentationTime);
50 void handleNewData(unsigned char* ptr, unsigned size);
51
53
54private:
55 // redefined virtual functions:
56 virtual void doGetNextFrame();
57
58private:
59 struct timeval currentFramePlayTime() const;
60
61private:
63
64private: // parsing state
66 unsigned char fOurStreamCode;
67 friend class AC3AudioStreamParser; // hack
68};
69
70#endif
AC3AudioStreamFramer(UsageEnvironment &env, FramedSource *inputSource, unsigned char streamCode)
struct timeval fNextFramePresentationTime
class AC3AudioStreamParser * fParser
unsigned samplingRate()
struct timeval currentFramePlayTime() const
static AC3AudioStreamFramer * createNew(UsageEnvironment &env, FramedSource *inputSource, unsigned char streamCode=0)
void handleNewData(unsigned char *ptr, unsigned size)
virtual ~AC3AudioStreamFramer()
static void handleNewData(void *clientData, unsigned char *ptr, unsigned size, struct timeval presentationTime)
virtual void doGetNextFrame()
FramedSource * inputSource() const
Definition: FramedFilter.hh:30