/******************************************************** Windows ACM-based audio decoder Copyright 2000 Eugene Kuznetsov (divx@euro.ru) *********************************************************/ #include #include #include "acm.h" #include #include #include #define __MODULE__ "ACM decoder" //#define TIMING using namespace std; /*char cfmt[]={0x61, 0x01, 0x02, 0x00, 0x22, 0x56, 0x00, 0x00, 0xa5, 0x0f, 0x00, 0x00, 0xba, 0x00, 0x10, 0x00, 0x0a, 0x00, 0x00, 0x04, 0x00, 0x00, 0x01, 0x00, 0xba, 0x00, 0x00, 0x00}; */ ACM_Decoder::ACM_Decoder(WAVEFORMATEX* pwf, void* extension):m_status(0) { // cerr<<"Entering ACM_Decoder::Init\n"<in_size)srcsize=in_size; // printf("%d\n", srcsize); ACMSTREAMHEADER ash; memset(&ash, 0, sizeof(ash)); ash.cbStruct=sizeof(ash); ash.fdwStatus=0; ash.dwUser=0; ash.pbSrc=in_data; ash.cbSrcLength=srcsize; ash.pbDst=out_data; ash.cbDstLength=out_size; #ifdef TIMING printf("ACM_Decoder: src: %X %X %X\n", ash.cbStruct, srcsize, out_size); #endif hr=acmStreamPrepareHeader( srcstream, &ash, 0); if(hr!=S_OK) { // cerr<<"ACM_Decoder: acmStreamPrepareHeader error "<in_size) ash.cbSrcLengthUsed=in_size; if(size_read)*size_read=ash.cbSrcLengthUsed; if(size_written)*size_written=ash.cbDstLengthUsed; hr=acmStreamUnprepareHeader( srcstream, &ash, 0); return 0; fail: if(size_read){*size_read=0; *size_written=0;} in_size=0; return -1; } int ACM_Decoder::GetMinSize() { // static int zz=0; if(m_status!=1) // { // cerr<<"Bad status"<