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