[FFmpeg-trac] #5168(undetermined:new): Why I read the memory data, use the "av_seek_frame" return “-32”?
FFmpeg
trac at avcodec.org
Mon Jan 18 12:54:10 CET 2016
#5168: Why I read the memory data, use the "av_seek_frame" return “-32”?
-------------------------------------+-------------------------------------
Reporter: maya8maya85 | Type: defect
Status: new | Priority: normal
Component: | Version:
undetermined | unspecified
Keywords: | Blocked By:
Blocking: | Reproduced by developer: 0
Analyzed by developer: 0 |
-------------------------------------+-------------------------------------
//callback
uint64_t g_uFileLength = 0;
char *g_pData = NULL;
uint64_t g_uCurrentPos = 0;
int CXXXXXDlg::ReadBuffer(void *opaque, uint8_t *buf, int buf_size)
{
if (g_uCurrentPos != (g_uFileLength-1))
{
size_t size = ((g_uCurrentPos + buf_size + 1) >
g_uFileLength) ? (g_uFileLength - g_uCurrentPos) : buf_size;
memcpy(buf, &g_pData[g_uCurrentPos], size);
g_uCurrentPos += size;
return size;
}
else
{
return -1;
}
}
........
if (IDOK == dlg.DoModal())
{
m_sourceFile = dlg.GetPathName();
CFile* file;
char * data;
file = new CFile;
file->Open(m_sourceFile, CFile::modeReadWrite);
g_uFileLength = file->GetLength();
data = new char[g_uFileLength];
memset(data, 0, g_uFileLength);
file->Read(data, g_uFileLength);
file->Close();
delete file;
g_pData = new char[g_uFileLength];
memcpy(g_pData, data, g_uFileLength);
delete[] data;
g_uCurrentPos = 0;
m_streamstate->pFormatCtx = avformat_alloc_context();
unsigned char *aviobuffer = (unsigned char *)av_malloc(32768);
AVIOContext *avio = avio_alloc_context(aviobuffer,32768,0,NULL,
ReadBuffer,NULL,NULL);
m_streamstate->pFormatCtx->pb = avio;
AVDictionary * avdic = NULL;
av_dict_set(&avdic,"probesize","20480",0);
av_dict_set(&avdic,"max_analyze_duration","10000",0);
if (avformat_open_input(&m_streamstate->pFormatCtx, NULL, NULL,
NULL) < 0){}
}
.....
error = av_seek_frame(pDlg->m_streamstate->pFormatCtx, stream_index,
seek_target, pDlg->m_streamstate->seek_flags);
....
If read "m_sourceFile", it return >=0, changed char data , it change the
"-32"?why?
--
Ticket URL: <https://trac.ffmpeg.org/ticket/5168>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker
More information about the FFmpeg-trac
mailing list