1*a7871de2Sbeveloper /* 2*a7871de2Sbeveloper * Copyright (c) 2003-2004, Marcus Overhagen 3*a7871de2Sbeveloper * All rights reserved. 4*a7871de2Sbeveloper * 5*a7871de2Sbeveloper * Redistribution and use in source and binary forms, with or without modification, 6*a7871de2Sbeveloper * are permitted provided that the following conditions are met: 7*a7871de2Sbeveloper * 8*a7871de2Sbeveloper * * Redistributions of source code must retain the above copyright notice, 9*a7871de2Sbeveloper * this list of conditions and the following disclaimer. 10*a7871de2Sbeveloper * * Redistributions in binary form must reproduce the above copyright notice, 11*a7871de2Sbeveloper * this list of conditions and the following disclaimer in the documentation 12*a7871de2Sbeveloper * and/or other materials provided with the distribution. 13*a7871de2Sbeveloper * 14*a7871de2Sbeveloper * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 15*a7871de2Sbeveloper * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 16*a7871de2Sbeveloper * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 17*a7871de2Sbeveloper * IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 18*a7871de2Sbeveloper * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 19*a7871de2Sbeveloper * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 20*a7871de2Sbeveloper * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 21*a7871de2Sbeveloper * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE 22*a7871de2Sbeveloper * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 23*a7871de2Sbeveloper * OF THE POSSIBILITY OF SUCH DAMAGE. 24*a7871de2Sbeveloper */ 25*a7871de2Sbeveloper #ifndef _RAW_DECODER_PLUGIN_H 26*a7871de2Sbeveloper #define _RAW_DECODER_PLUGIN_H 27*a7871de2Sbeveloper 28ca16f5cbSbeveloper #include "DecoderPlugin.h" 29ca16f5cbSbeveloper 30ca16f5cbSbeveloper class RawDecoder : public Decoder 31ca16f5cbSbeveloper { 32ca16f5cbSbeveloper public: 336e04e144Sbeveloper void GetCodecInfo(media_codec_info *info); 34a0a20160SAxel Dörfler 3525305239Sbeveloper status_t Setup(media_format *ioEncodedFormat, 36bce1ab5eSbeveloper const void *infoBuffer, int32 infoSize); 37ca16f5cbSbeveloper 3825305239Sbeveloper status_t NegotiateOutputFormat(media_format *ioDecodedFormat); 3925305239Sbeveloper 40d8591482Sbeveloper status_t Seek(uint32 seekTo, 41bce1ab5eSbeveloper int64 seekFrame, int64 *frame, 42bce1ab5eSbeveloper bigtime_t seekTime, bigtime_t *time); 43ca16f5cbSbeveloper 44ca16f5cbSbeveloper status_t Decode(void *buffer, int64 *frameCount, 45ca16f5cbSbeveloper media_header *mediaHeader, media_decode_info *info); 46bb1d6ef2Sbeveloper 47ca16f5cbSbeveloper private: 48bb1d6ef2Sbeveloper status_t NegotiateVideoOutputFormat(media_format *ioDecodedFormat); 49bb1d6ef2Sbeveloper status_t NegotiateAudioOutputFormat(media_format *ioDecodedFormat); 50bb1d6ef2Sbeveloper 51bb1d6ef2Sbeveloper private: 52bb1d6ef2Sbeveloper int32 fFrameRate; 53bb1d6ef2Sbeveloper int32 fInputFrameSize; 54bb1d6ef2Sbeveloper int32 fOutputFrameSize; 55bb1d6ef2Sbeveloper int32 fInputSampleSize; 56bb1d6ef2Sbeveloper int32 fOutputSampleSize; 57bb1d6ef2Sbeveloper int32 fOutputBufferFrameCount; 58bb1d6ef2Sbeveloper void (*fSwapInput)(void *data, int32 count); 59bb1d6ef2Sbeveloper void (*fConvert)(void *dst, void *src, int32 count); 60bb1d6ef2Sbeveloper void (*fSwapOutput)(void *data, int32 count); 61bb1d6ef2Sbeveloper 62bb1d6ef2Sbeveloper char * fChunkBuffer; 63bb1d6ef2Sbeveloper int32 fChunkSize; 64bb1d6ef2Sbeveloper 65bb1d6ef2Sbeveloper bigtime_t fStartTime; 66bb1d6ef2Sbeveloper 6725305239Sbeveloper media_format fInputFormat; 68ca16f5cbSbeveloper }; 69ca16f5cbSbeveloper 70ca16f5cbSbeveloper 71ca16f5cbSbeveloper class RawDecoderPlugin : public DecoderPlugin 72ca16f5cbSbeveloper { 73ca16f5cbSbeveloper public: 74fa8dbc01Sshatty Decoder * NewDecoder(uint index); 75fa8dbc01Sshatty status_t GetSupportedFormats(media_format ** formats, size_t * count); 76ca16f5cbSbeveloper }; 77*a7871de2Sbeveloper 78*a7871de2Sbeveloper #endif 79