[vlc-devel] Results of GSOC project - ogg seeking

salsaman salsaman at gmail.com
Wed Aug 4 22:24:15 CEST 2010


Hi everybody,
here are the results of my GSOC project to rewrite/improve ogg seeking. I am
presenting this as a set of 9 patches.


1) Non seek related changes

This patch correctly gets the first keyframe number for theora (0 or 1)
depending on the encoder version used.
It also adds support for a non-standard dirac format which I discovered
during testing.


2) This patch refactors ogg.c into ogg.c and ogg.h in preparation for the
following patch


3) Adds the new files modules/demux/oggseek.c and modules/demux/oggseek.h
with generic search functions


4) Adds frame accurate theora seek capabilities to oggseek.c, but does not
enable it (see patch 8)


5) Adds frame accurate dirac seek capabilities to oggseek.c but does not
enable it (see patch 9) *


6) Since one local variable is now replicated in a struct, we can use the
struct version and eliminate a local variable in ogg.c


7) Replace OGG_PAGE_SIZE with OGGSEEK_BYTES_TO_READ in ogg.c (combines two
#defines into one)


8) Enable theora support in ogg.c (activates code from patch 4)


9) Enable dirac seek in ogg.c (activates code from patch 5) *



* Note: there is a problem with dirac seeking, because the ogg container
granulepos which should give the frame number is broken in some (maybe all)
dirac files. To avoid this the demuxer needs to receive a timecode from the
decoder. Also after seeking the demuxer needs to send  the target frame to
the decoder so that the decoder can avoid decoding frames up to the target
(this is not the same as pre-rolling which is also done).

The problem is that there is no channel for demuxer to communicate a
timecode directly to the decoder or vice-versa.

In order to try to solve this problem, I create a dummy block and set this
as block->next, then use pts and dts values of the dummy block to
communicate. However there appears to be a bug with this in vlc, because
even though I override the free() function of the dummy block with a
function that should do nothing, the override is ignored in
block_FifoEmpty() which leads to a segfault as soon as a dirac file is
loaded.

Therefore I recommend NOT applying patch 9 until this issue has been
resolved, or else some other way is devised for demuxer and decoder to
exchange timecodes.




A further recommendation I would like to make is that you extend the set of
flags in stream_Control().
You already have:
STREAM_CAN_SEEK and STREAM_CAN_FASTSEEK.
However if you are intending libvlc to be used for video editing, then I
would suggest adding the following flag:
STREAM_CAN_ACCURATE_SEEK - meaning that the stream can seek to the exact
frame given with no visible loss of quality.
In my tests I found that for example the ffmpeg demuxer can only seek to an
estimated position and frequently retruns partially decoded frames.



Since there is not much time left for the GSOC project, and I will be
travelling from 10th august onwards, I would appreciate any requests to
change anything in the patches ASAP.




Best regards,
Salsaman.



http://lives.sourceforge.net
https://www.ohloh.net/accounts/salsaman
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20100804/7972bbee/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Non-seek-related-ogg-changes.patch
Type: text/x-patch
Size: 4627 bytes
Desc: not available
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20100804/7972bbee/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0002-Refactor-code-into-ogg.c-and-ogg.h.patch
Type: text/x-patch
Size: 7683 bytes
Desc: not available
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20100804/7972bbee/attachment-0001.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0003-Ogg-seek-new-logic-generic-changes.patch
Type: text/x-patch
Size: 20339 bytes
Desc: not available
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20100804/7972bbee/attachment-0002.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0004-New-ogg-seek-logic-theora-specific-changes.patch
Type: text/x-patch
Size: 17592 bytes
Desc: not available
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20100804/7972bbee/attachment-0003.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0005-New-ogg-seek-logic-add-dirac-changes.patch
Type: text/x-patch
Size: 25335 bytes
Desc: not available
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20100804/7972bbee/attachment-0004.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0006-Use-opriv-current-page-in-ogg.c.patch
Type: text/x-patch
Size: 3977 bytes
Desc: not available
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20100804/7972bbee/attachment-0005.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0007-Ogg-page-size-to-oggseek-bytes-to-read.patch
Type: text/x-patch
Size: 1118 bytes
Desc: not available
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20100804/7972bbee/attachment-0006.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0008-Enable-new-theora-seeking-in-ogg.c.patch
Type: text/x-patch
Size: 11261 bytes
Desc: not available
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20100804/7972bbee/attachment-0007.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0009-Enable-new-dirac-seek-in-ogg.c-CAUTION.patch
Type: text/x-patch
Size: 12081 bytes
Desc: not available
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20100804/7972bbee/attachment-0008.bin>


More information about the vlc-devel mailing list