Opened 3 years ago

Closed 3 years ago

#5168 closed defect (needs_more_info)

Why I read the memory data, use the "av_seek_frame" return “-32”?

Reported by: maya8maya85 Owned by:
Priority: normal Component: undetermined
Version: unspecified Keywords:
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

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?

Change History (2)

comment:1 Changed 3 years ago by cehoyos

Do you want to report a bug in FFmpeg? If yes, please provide the source code that allows to reproduce the issue.
If you need support, please ask on the mailing list: http://ffmpeg.org/mailman/listinfo/libav-user

comment:2 Changed 3 years ago by cehoyos

  • Resolution set to needs_more_info
  • Status changed from new to closed
Note: See TracTickets for help on using tickets.