<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-15">
</head>
<body bgcolor="#FFFFFF" text="#000000">
Hey,<br>
<br>
Im writing a program where I have to use custom IO Callbacks because
I have to play video files with a prepended extra header. However,
if I try to play a movie with an offset of e.g. 10 bytes and I seek,
the movie might play on, but audio doesnt:<br>
<br>
<meta name="qrichtext" content="1">
<meta http-equiv="Content-Type" content="text/html;
charset=ISO-8859-15">
<style type="text/css">
p, li { white-space: pre-wrap; }
</style>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px;
margin-right:0px; -qt-block-indent:0; text-indent:0px;"><!--StartFragment--><span
style=" font-family:'Monospace'; font-size:9pt; color:#b20808;">[h264
@ 0x240afc0] left block unavailable for requested intra mode at
0 17</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px;
margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span
style=" font-family:'Monospace'; font-size:9pt; color:#b20808;">[h264
@ 0x240afc0] error while decoding MB 0 17</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px;
margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span
style=" font-family:'Monospace'; font-size:9pt; color:#b20808;">[h264
@ 0x240afc0] AVC: nal size 399</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px;
margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span
style=" font-family:'Monospace'; font-size:9pt; color:#b20808;">[h264
@ 0x240afc0] concealing 229 DC, 229 AC, 229 MV errors</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px;
margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span
style=" font-family:'Monospace'; font-size:9pt; color:#b20808;">[h264
@ 0x240afc0] AVC: nal size 25153</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px;
margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span
style=" font-family:'Monospace'; font-size:9pt; color:#b20808;">[h264
@ 0x240afc0] no frame!</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px;
margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span
style=" font-family:'Monospace'; font-size:9pt; color:#b20808;">packet
didnt contain a complete frame! </span></p>
<span style=" font-family:'Monospace'; font-size:9pt;
color:#b20808;">[aac @ 0x20220a0] channel element 2.14 is not
allocated</span>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px;
margin-right:0px; -qt-block-indent:0; text-indent:0px;"><!--EndFragment--></p>
<br>
This happens sporadic and I cant figure out why. My Seek_Func just
calls a subclassed QFile::seek(...) which returns QFile::seek(... +
offset ). Has anybody an Idea why seek often doesnt work? Maybe I am
missing a parameter when I create my callback? Btw: The format is
recognized correctly, also without seeking the video is played
correctly...<br>
<br>
Many thanks,<br>
Christoph Winter<br>
<br>
<small>MController.cpp:<br>
<br>
</small>
<blockquote><small>ioContext = avio_alloc_context(buffer,
BUFFER_SIZE, 0, fileReader, ReadFunc, NULL, SeekFunc);</small><br>
<small> ioContext->write_flag = 0;</small><br>
<small> ioContext->is_streamed = 1;</small><br>
<small> ioContext->seekable = 1;</small><br>
</blockquote>
<br>
<small>MFile.cpp</small>:<br>
<blockquote><small>bool MFile::seek(qint64 offset)<br>
{<br>
return QFile::seek(offset+10);<br>
}</small><br>
</blockquote>
<small>Utils.h:</small><br>
<blockquote><small>int64_t SeekFunc(void *opaque, int64_t offset,
int whence)</small><br>
<small>{</small><br>
<small> qDebug() << "SeekFunc offset=" << offset
<< " whence=" << whence;</small><br>
<small> QIODevice *io = (MFile*)opaque;</small><br>
<br>
<small> int64_t absolute_pos = 0;</small><br>
<br>
<small> switch(whence)</small><br>
<small> {</small><br>
<small> case AVSEEK_SIZE:</small><br>
<small> return io->size();</small><br>
<small> case SEEK_SET:</small><br>
<small> absolute_pos = offset;</small><br>
<small> break;</small><br>
<small> case SEEK_CUR:</small><br>
<small> absolute_pos = io->pos() + offset;</small><br>
<small> case SEEK_END:</small><br>
<small> absolute_pos = io->size() - offset;</small><br>
<small> default:</small><br>
<small> return -1;</small><br>
<small> }</small><br>
<small> if( absolute_pos < 0 || absolute_pos >
io->size() )</small><br>
<small> return -1;</small><br>
<small> bool ret = io->seek(absolute_pos);</small><small></small><br>
<small> return ret;</small><br>
<small>}</small><br>
</blockquote>
</body>
</html>