Not without further information. Of course i have checked the backwards compatibility before releasing V1.0.2. Ok, i only checked the applications but since they are using the same code as the library this should be sufficient.
Can you decode the file with the V1.0.2 applications?
Can you send me the affected file via email (see my profile)?
Thomas
Hi, Thomas:
I use your new v1.0.2 to encode a new .tak file and decode it. Everything is OK.
But my code did not work.
Here is my sample code.
Can you help me to fix it? It only decode one frame and exit:(
#include <windows.h>
#include <stdio.h>
#include "tak_deco_lib.h"
#pragma comment( lib, "tak_deco_lib")
static TtakBool _CanRead(void * AUser) { return tak_True; }
static TtakBool _CanWrite(void * AUser) { return tak_False; }
static TtakBool _CanSeek(void * AUser) { return tak_True; }
static TtakBool _Read(void * AUser, void * ABuf, TtakInt32 ANum, TtakInt32 * AReadNum)
{
FILE ** fp = (FILE **)AUser;
*AReadNum = fread( (LPBYTE)ABuf, 1, ANum, *fp);
if ( *AReadNum < ANum) {
return tak_False;
} else {
return tak_True;
}
}
static TtakBool _Seek(void * AUser, TtakInt64 APos)
{
return (0 == _fseeki64( *(FILE **)AUser, APos, SEEK_SET)) ? tak_True : tak_False;
}
static TtakBool _GetLength(void * AUser, TtakInt64 * ALength)
{
FILE ** fp = (FILE **)AUser;
TtakInt64 pos = _ftelli64( *fp); // save it
if ( 0 != _fseeki64( *fp, 0, SEEK_END)) return tak_False; // seek to end
*ALength = _ftelli64( *fp); // get length
if ( 0 != _fseeki64( *fp, pos, SEEK_SET)) return tak_False; // restore
return tak_True;
}
int _tmain(int argc, _TCHAR* argv[])
{
FILE * m_fp;
m_fp = _tfopen( _T("test.tak"), _T("r"));
TtakSeekableStreamDecoder m_Decoder;
Ttak_str_StreamInfo m_StreamInfo;
LPBYTE m_TAKBuf; // decoded buffer
// OPEN
TtakSSDOptions opt = { tak_Cpu_Any, 0 };
TtakStreamIoInterface sioi = { _CanRead, _CanWrite, _CanSeek, _Read, NULL, NULL, NULL, _Seek, _GetLength };
m_Decoder = tak_SSD_Create_FromStream( &sioi, &m_fp, &opt, NULL, NULL);
int ret = 0;
if ( (tak_True == tak_SSD_Valid( m_Decoder))
&& (tak_res_Ok == tak_SSD_GetStreamInfo( m_Decoder, &m_StreamInfo))
)
{
// allocate decoding buffer
m_TAKBuf = new BYTE[m_StreamInfo.Sizes.FrameSizeInSamples * m_StreamInfo.Audio.BlockSize];
} else {
tak_SSD_Destroy( m_Decoder);
fclose( m_fp);
return 0;
}
// DECODE
TtakInt32 readNum;
TtakResult takResult;
do {
takResult = tak_SSD_ReadAudio( m_Decoder, m_TAKBuf, m_StreamInfo.Sizes.FrameSizeInSamples, &readNum);
Sleep( 10);
} while ( (takResult == tak_res_Ok) || (takResult == tak_res_ssd_FrameDamaged));
// DESTROY
tak_SSD_Destroy( m_Decoder);
fclose( m_fp);
return 0;
}