| 1 | /* |
|---|
| 2 | * FFissionDecoder.h |
|---|
| 3 | * Copyright (c) 2006 David Conrad |
|---|
| 4 | * |
|---|
| 5 | * This file is part of Perian. |
|---|
| 6 | * |
|---|
| 7 | * This library is free software; you can redistribute it and/or |
|---|
| 8 | * modify it under the terms of the GNU Lesser General Public |
|---|
| 9 | * License as published by the Free Software Foundation; either |
|---|
| 10 | * version 2.1 of the License, or (at your option) any later version. |
|---|
| 11 | * |
|---|
| 12 | * This library is distributed in the hope that it will be useful, |
|---|
| 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|---|
| 15 | * Lesser General Public License for more details. |
|---|
| 16 | * |
|---|
| 17 | * You should have received a copy of the GNU Lesser General Public |
|---|
| 18 | * License along with FFmpeg; if not, write to the Free Software |
|---|
| 19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
|---|
| 20 | */ |
|---|
| 21 | |
|---|
| 22 | #ifndef __FFISSIONDECODER_H__ |
|---|
| 23 | #define __FFISSIONDECODER_H__ |
|---|
| 24 | |
|---|
| 25 | #include "FFissionCodec.h" |
|---|
| 26 | #include "RingBuffer.h" |
|---|
| 27 | |
|---|
| 28 | class FFissionDecoder : public FFissionCodec |
|---|
| 29 | { |
|---|
| 30 | public: |
|---|
| 31 | FFissionDecoder(UInt32 inInputBufferByteSize = 76800); |
|---|
| 32 | virtual ~FFissionDecoder(); |
|---|
| 33 | |
|---|
| 34 | virtual void Initialize(const AudioStreamBasicDescription* inInputFormat, const AudioStreamBasicDescription* inOutputFormat, const void* inMagicCookie, UInt32 inMagicCookieByteSize); |
|---|
| 35 | virtual void Uninitialize(); |
|---|
| 36 | virtual void Reset(); |
|---|
| 37 | |
|---|
| 38 | virtual void GetProperty(AudioCodecPropertyID inPropertyID, UInt32& ioPropertyDataSize, void* outPropertyData); |
|---|
| 39 | virtual void SetMagicCookie(const void* inMagicCookieData, UInt32 inMagicCookieDataByteSize); |
|---|
| 40 | |
|---|
| 41 | virtual void SetCurrentInputFormat(const AudioStreamBasicDescription& inInputFormat); |
|---|
| 42 | virtual void SetCurrentOutputFormat(const AudioStreamBasicDescription& inOutputFormat); |
|---|
| 43 | virtual UInt32 GetVersion() const; |
|---|
| 44 | |
|---|
| 45 | virtual void AppendInputData(const void* inInputData, UInt32& ioInputDataByteSize, UInt32& ioNumberPackets, const AudioStreamPacketDescription* inPacketDescription); |
|---|
| 46 | virtual UInt32 ProduceOutputPackets(void* outOutputData, UInt32& ioOutputDataByteSize, UInt32& ioNumberPackets, AudioStreamPacketDescription* outPacketDescription); |
|---|
| 47 | |
|---|
| 48 | private: |
|---|
| 49 | void SetupExtradata(OSType formatID); |
|---|
| 50 | int ConvertXiphVorbisCookie(); |
|---|
| 51 | void OpenAVCodec(); |
|---|
| 52 | |
|---|
| 53 | UInt32 kIntPCMOutFormatFlag; |
|---|
| 54 | Byte *magicCookie; |
|---|
| 55 | UInt32 magicCookieSize; |
|---|
| 56 | |
|---|
| 57 | RingBuffer inputBuffer; |
|---|
| 58 | Byte *outputBuffer; |
|---|
| 59 | int outBufSize; |
|---|
| 60 | int outBufUsed; |
|---|
| 61 | bool dtsPassthrough; |
|---|
| 62 | }; |
|---|
| 63 | |
|---|
| 64 | // kAudioCodecPropertyHasVariablePacketByteSizes is queried before our input format is set, |
|---|
| 65 | // so we can't use that to determine our answer... |
|---|
| 66 | class FFissionVBRDecoder : public FFissionDecoder |
|---|
| 67 | { |
|---|
| 68 | public: |
|---|
| 69 | FFissionVBRDecoder() : FFissionDecoder() { } |
|---|
| 70 | virtual void GetProperty(AudioCodecPropertyID inPropertyID, UInt32& ioPropertyDataSize, void* outPropertyData); |
|---|
| 71 | }; |
|---|
| 72 | |
|---|
| 73 | #endif |
|---|