root/trunk/A52/ACShepA52Decoder.h

Revision 60, 2.9 kB (checked in by gbooker, 1 year ago)

Patches from perian's trac: http://trac.perian.org/ticket/230

Line 
1 /*
2         A52 / AC-3 Decompression Codec
3         2004, Shepmaster <shepmaster@applesolutions.com>
4        
5         Uses code from the liba52 project and the CoreAudio SDK.
6 */
7
8 #if !defined(__ACShepA52Decoder_h__)
9 #define __ACShepA52Decoder_h__
10
11 //=============================================================================
12 //      Includes
13 //=============================================================================
14
15 #include "ACShepA52Codec.h"
16 #include "a52.h"
17
18 //=============================================================================
19 //      ACShepA52Decoder
20 //
21 //      This class decodes A/52 and AC-3 data.
22 //      We support 16- and 32-bit signed integer, as well as floating point.
23 //=============================================================================
24
25 class ACShepA52Decoder
26 :
27         public ACShepA52Codec
28 {
29
30 //      Construction/Destruction
31 public:
32                                         ACShepA52Decoder(UInt32 inInputBufferByteSize = 76800);
33         virtual                 ~ACShepA52Decoder();
34
35         virtual void    Initialize(const AudioStreamBasicDescription* inInputFormat, const AudioStreamBasicDescription* inOutputFormat, const void* inMagicCookie, UInt32 inMagicCookieByteSize);
36         virtual void    Uninitialize();
37         virtual void    Reset();
38
39 //      Information Gathering
40 public:
41         virtual void    GetPropertyInfo(AudioCodecPropertyID inPropertyID, UInt32& outPropertyDataSize, bool& outWritable);
42         virtual void    GetProperty(AudioCodecPropertyID inPropertyID, UInt32& ioPropertyDataSize, void* outPropertyData);
43         virtual void    SetProperty(AudioCodecPropertyID inPropertyID, UInt32 inPropertyDataSize, const void* inPropertyData);
44
45 //      Format Information
46 public:
47         virtual void    SetCurrentInputFormat(const AudioStreamBasicDescription& inInputFormat);
48         virtual void    SetCurrentOutputFormat(const AudioStreamBasicDescription& inOutputFormat);
49         virtual UInt32  GetVersion() const;
50
51 //      Output Data Operations
52 public:
53         virtual void    AppendInputData(const void* inInputData, UInt32& ioInputDataByteSize, UInt32& ioNumberPackets, const AudioStreamPacketDescription* inPacketDescription);
54         virtual UInt32  ProduceOutputPackets(void* outOutputData, UInt32& ioOutputDataByteSize, UInt32& ioNumberPackets, AudioStreamPacketDescription* outPacketDescription);
55
56
57 //      Implementation
58 private:
59         void    ACShepA52Decoder::UpgradeOldPrefs();
60         void    DetermineStreamParameters();
61         UInt32  SyncA52Stream(UInt32 &bytes_to_read, Byte *input_data, int &a52_flags, int &a52_samplerate, int &a52_bitrate, bool shouldResync);
62         UInt32  AppendPacket(const void* inInputData, UInt32 inInputDataSize, UInt32 bufferStartOffset, UInt32 offset, UInt32& packetSize);             
63        
64         a52_state_t *decoder_state;
65        
66         UInt32  kIntPCMOutFormatFlag;
67         UInt32  kFloatPCMOutFormatFlag;
68        
69         UInt32  total_frames;
70         UInt32  total_bytes;
71        
72         bool    firstInput;
73        
74         //For badly packetized data
75         UInt32  remainingBytesFromLastFrame;
76         Byte    beginningOfIncompleteHeader[6];
77         UInt32  beginningOfIncompleteHeaderSize;
78        
79         //Prefs
80         int             TwoChannelMode;
81         double  dynamicRangeCompression;
82         bool    passthrough;
83 };
84
85 #endif
Note: See TracBrowser for help on using the browser.