Bug 512327 - Update liboggz to cf5feeaab69b05e24. r=doublec

This commit is contained in:
Chris Pearce 2009-09-16 15:45:16 +12:00
Родитель 3f2c74fef2
Коммит 57be2c2f34
24 изменённых файлов: 860 добавлений и 650 удалений

Просмотреть файл

@ -1,3 +1,212 @@
Thu Apr 10 11:14:43 JST 2009 Conrad Parker <conrad@metadecks.org>
* Version 0.9.9
This release adds Dirac support, security fixes, improved low-memory
behaviour, and a new 'oggz' wrapper tool with bash completion.
Security:
* Handle allocation failure due to out of memory throughout, for Mozilla
bug 468280. Adds new error return OGGZ_ERR_OUT_OF_MEMORY
* skeleton.c::ogg_from_fisbone(): avoid memcpy of NULL
fp->message_header_fields. Fixes ticket:408, reported by j^
* Mozilla bug 463756: return an error when a hole (ie. missing sequence
number) is detected in the headers of a track
* Remove dead code from oggz_read.c for ticket:439, reported by Coverity
* Check for NULL return value of val in cgi.c
(ticket:438, reported by Coverity)
* Add NULL return checks
(ticket:440, reported by Coverity)
* Check for integer overflows in calculations for realloc and when using
strlen returns. For Mozilla bug 480014
* Don't map all errors to OGGZ_ERR_STOP_ERR
Required for Mozilla bug 481933
Exposes detected HOLE_IN_DATA as return value from oggz_read(),
oggz_read_input(), and add documentation for extra return values
* Apply patch by Jim Blandy from Mozilla bug 480521
Avoid overflow in comment lengths
oggz-chop:
* Added "X-Accept-TimeURI: application/ogg" HTTP response header to
oggz-chop CGI output.
* Added video/ogg and audio/ogg to example apache config for oggz-chop
CGI (Ivo)
* Added a check if PATH_TRANSLATED is defined, warn about CGI
configuration error otherwise (to stderr, ie. we
* Added customization for DocumentRoot, for servers that don't provide
PATH_TRANSLATED
Documentation:
* oggz_constants.h: document use of OGGZ_PREFIX and OGGZ_SUFFIX
Build:
* Build fixes for Mac OS X (rillian)
* Allow compilation of the library on win32 using Visual Studio 2003
and 2005. The project files have been updated to fix previous errors
with compiling using both of these IDEs.
Patch by Barry Duncan, and regenerated by ogg.k.ogg.k
Internal:
* Add oggz_content_type() public API function:
Returns a human-readable string representation of a content type
* Add API functions for getting and seting preroll:
oggz_get_preroll(), oggz_set_preroll()
Set preroll in oggz_auto.c for vorbis and speex
* Kate updates (ogg.k.ogg.k)
* Parse BOS page before calling first page reader callback.
Fixes ticket:416, "oggz-chop writes wrong granulerate in fisbone"
* Apply patch from dryeo, "off_t not always in stdio.h"
Closes ticket:413
* Apply patch from dryeo, "OS/2 also needs to set stdin/stdout to
binary" Closes ticket:414
* Apply patch by j^, Closes ticket:406 "oggzinfo Video-Height is
wrong"
* Fix oggz-comment writing bad data into streams
Patch by ogg.k.ogg.k:
* Updated shared version info to 6:0:5
Fri Jul 4 19:06:54 JST 2008 Conrad Parker <conrad@metadecks.org>
* Version 0.9.8
This release adds a new oggz-chop tool, which can be used to serve time
ranges of Ogg media over HTTP.
It also includes support for the Ogg mapping of the experimental Kate
codec (http://wiki.xiph.org/index.php/OggKate).
Tools:
* Added new oggz-chop tool: Extract the part of an Ogg file between
given start and/or end times. See below for usage information.
* oggz-sort: Detect and fix page granulepos that should be -1 but
isn't; fixes file error "on page with no completed packets, must be
-1" reported by oggz-validate. (Timothy B. Terriberry)
* oggz-validate: Handle tracking of bos and eos when checking pages,
not packets.
* oggz-validate: Generalized A/V header ordering to handle more audio
types (PCM, FLAC0, FLAC, CELT)
* oggz-comment: Fixed a crash when writing output to stdout, eg. by
running "oggz-comment file.ogv -a". Reported by j^
* oggz-comment: Fixed a bug where files with skeleton could not have
their comments modified or listed. Reported by j^
* oggzinfo: Fixed crash if a skeleton track refers to a track not
found in the physical stream. (ogg.k.ogg.k)
* oggzinfo: Fixed an overflow in standard deviation calculation,
and avoided a divide by zero, in the unlikely case where we have
only one packet. (ogg.k.ogg.k)
* oggzinfo: remove memory leak from allocated message headers
(ogg.k.ogg.k)
* oggzinfo: Fixed byte offsets for reporting skeleton basetime.
* oggzinfo: Corrected calculation of Content-Duration to take the
Presentation-Time reported in skeleton
* oggzinfo: Display percentage overhead of Ogg framing for each
track. (ogg.k.ogg.k)
* oggz-basetime: Use new API call oggz_stream_get_numheaders(),
rather than hardcoding to 3. (ogg.k.ogg.k)
* oggzdiff: Allow diffing files with the same name if they are in
different directories. (ogg.k.ogg.k)
Documentation:
* Added a usage example to oggzrip man page, showing how to create an
Ogg Vorbis I file from any file containing a vorbis audio track. Adapted
from: http://lists.xiph.org/pipermail/vorbis-dev/2008-April/019320.html
* Clarified documentation of oggz_table_insert()
* Added link to celt-codec.org in oggz_seek docs
Build:
* Fixed out-of-tree builds in configure and Makefile.am throughout
Internal:
* Added support for the Kate codec throughout (ogg.k.ogg.k)
* tools/skeleton.c: add fisbone_clear() function, for deallocating
message headers. (ogg.k.ogg.k)
Fri Feb 15 16:52:21 JST 2008 Conrad Parker <conrad@metadecks.org>
* Version 0.9.7
This release adds a new oggz-sort tool, includes fixes for serialno
generation on 64bit (LP64) platforms, and adds decoding of FLAC
vorbiscomment packets and basic support for the Ogg mapping of the
experimental CELT codec. It also includes various API additions,
documentation updates and new example code.
Tools:
* Added new oggz-sort tool: Sort the pages of an Ogg file in order
of presentation time. (See below for rationale and usage).
* 'oggzdiff --revert' fixes for long oggzdump packetinfo lines
* oggz-comment: Modified to copy data pages verbatim.
* oggzinfo: Fixed for skeleton interpretation on big-endian hosts.
* oggzinfo: Various cleanups in skeleton.c (ogg.k.ogg.k)
Documentation:
* Updated known (non-experimental) content types in all man pages.
* Added information about the use of oggz_tell_granulepos() in
OggzReadCallbacks for retrieving calculated granulepos values.
Examples:
* Added modify-headers example, demonstrating how to write a program
which modifies Ogg header packets but leaves data pages intact.
liboggz API:
* Added oggz_comments_copy().
* Added oggz_comments_generate(), which does not require a
packet_type argument. Deprecate oggz_comment_generate().
* Added oggz_stream_get_numheaders(), implemented for all known codecs
* oggz_serialno_new() now only generates serialnos which will fit
within a 32bit integer.
* oggz_write_feed() now fails with OGGZ_ERR_BAD_SERIALNO if it is
passed a serialno outside of the 32bit range.
* Added OGGZ_CONTENT_CELT to the public OggzStreamContent enum.
Internal:
* Fixed a bunch of x86-64 compiler warnings. (Erik de Castro Lopo)
* Updated acinclude.m4 to latest ogg.m4. (Ivo Gonçalves)
* Added basic support for (experimental) Ogg mapping for CELT codec.
* libtool shared version info updated to 5:0:4
Sun Jan 13 13:27:57 JST 2008
* Version 0.9.6
This release adds a new oggz-comment tool, and improvements to
liboggz's determination of timestamps and seeking. Specifically,
liboggz now inspects the encoded data in order reconstruct the
expected granulepos (corresponding to a timestamp) for every packet
in an Ogg stream. This allows applications to use reliable
timestamps, even though these are only sparsely recorded in most
Ogg streams.
Tools:
* Added new oggz-comment tool (Kangyuan Niu)
* Added Skeleton support to oggzinfo (Tahseen Mohammad)
* Report FLAC samplerate, channels in oggzinfo (Conrad Parker)
Documentation:
* Improved oggzmerge documentation (Debian bug #280550)
liboggz API:
* Added content type detection and retrieval functions
oggz_stream_get_content(), oggz_stream_get_content_type()
(Shane Stephens)
* Added oggz_tell_granulepos function to query liboggz for
granulepos values. (Shane Stephens)
* Added Vorbiscomment API oggz_comment_*() for manipulating comments
in Ogg Vorbis, Speex, Theora, FLAC files (Conrad Parker, Ian Malone)
* Added oggz_get_numtracks() (Conrad Parker)
Internal:
* Added automatic calculation of missing granulepos values
in Vorbis, Speex, Theora (Shane Stephens) and FLAC (Conrad Parker)
* Seeking improvements (Shane Stephens)
* Corrections for C standards support (Erik de Castro Lopo)
* GNU Autotools build system updates (Ralph Giles, Thomas van der
Stichele)
* Updated Win32 build system (Alex Krumm-Heller, Marcin Lubonski)
* libtool shared version info updated to 4:0:3
2007-01-12 Thomas Vander Stichele <thomas at apestaart dot org>
* Makefile.am:
@ -7,12 +216,126 @@
* configure.ac:
increase package version so liboggplay can require > 0.9.5
Mon Mar 13 14:58:23 EST 2006 Conrad Parker <conrad@metadecks.org>
* Version 0.9.5
* Fixed and updated Windows (Visual Studio) support
- added missing exported symbols, projects for oggz tools.
(Alex Krumm-Heller, Silvia Pfeiffer)
* Support for OggPCM (Draft 2, Main header)
OggPCM is an experimental specification for storing uncompressed
PCM audio in Ogg bitstreams.
- liboggz: Recognition of OggPCM timestamps, and support for
seeking in files that contain OggPCM logical bitstreams.
- oggzinfo: Display OggPCM header details
- oggzdump, oggzrip: New [--content-type pcm, -c pcm] option
to filter on OggPCM
- oggz-validate: Validate framing of OggPCM logical bitstreams
This version is installed on http://validator.annodex.org/ for
online validation of OggPCM files.
For more information about OggPCM, see:
http://wiki.xiph.org/index.php/OggPCM
* ./configure support for large (>2GB) files
This version adds build configuration support for large files,
allowing liboggz to operate on files >2GB. This version does
not introduce any API changes; interfaces such as oggz_tell()
continue to use off_t externally. However, sequential reading
and validation of large files is now possible.
* bug fixes and cleanups:
- oggz-validate, oggzmerge, oggzdump, oggz-scan, oggzinfo: handle
unknown content types (Ian Malone)
- remove deprecated oggzed example
- various code and documentation build cleanups
Tue Feb 14 10:14:09 EST 2006 Conrad Parker <conrad@metadecks.org>
* Version 0.9.4
* liboggz: Added new oggz_run() convenience function
- equivalent to calling oggz_read() or oggz_write() in a loop,
but only returns upon completion or error
- added new oggz_run_set_blocksize() function
- updated libtool shared version info to 3:0:2
* liboggz: Improved callback handling
- added delayed callback error handling for oggz_read*() and
oggz_write*() functions. When a reading or writing operation is
stopped by a user callback returning OGGZ_STOP_OK or OGGZ_STOP_ERR,
that return value is cached and reported by the subsequent call
to oggz_read*() or oggz_write*() (unless no data has been read or
written, in which case it is reported immediately as before). This
ensures that a user callback returning OGGZ_STOP_OK or
OGGZ_STOP_ERR is always explicitly acknowledged without requiring
the application to track its own errors.
* Improvements to oggz-validate:
- added ability to run oggz-validate on stdin, using "-" as filename
- added --prefix, --suffix and --partial options to suppress errors
when only validating the specified portion of a complete stream
- add --max-errors num option to specify the maximum number of
errors to bail out after, or 0 to show all errors (ticket:154)
- if an input file fails oggz_open(), continue processing other
files on the commandline rather than exiting immediately
- improved documentation of errors detected by oggz-validate
- added --help-errors (-E) option to just list known errors,
without other help text around
* oggzmerge: When merging Vorbis and Theora streams, ensure the
Theora header appears first in the output file in conformance with
the Ogg Theora bitstream specification. (ticket:189)
2005-11-17 Thomas Vander Stichele <thomas at apestaart dot org>
* configure.ac:
* doc/Makefile.am:
Work also with docbook2man as installed on Fedora
Fri Oct 7 16:59:32 EST 2005 Conrad Parker <conrad@metadecks.org>
* Version 0.9.3
* New oggz-scan tool (silvia)
oggz-scan displays timestamps of characteristic features in an Ogg
file. 'oggz-scan --keyframes file.ogg' displays timestamps of
unforced Theora keyframes, which are a useful rough approximation of
shot boundaries. Results can be output as plain text, CMML or HTML.
* Improvements to oggz-validate:
- added page-level validation, ensuring that a page that ends zero
packets has the correct granulepos, -1. (MikeS)
- added a check that any Theora bos pages come before Vorbis and
Speex bos pages. (ticket:156) (conrad)
- correct handling of chained files (ticket: 162) (conrad)
* win32 build fix for oggz tools (j^)
* liboggz: replace internal typedef of oggz_off_t, use off_t instead
of long (ticket:161) (Grayfox)
* examples/fix-eos: discard trailing incomplete packets from the end
of the stream. (MikeS)
* remove autogenerated manpages (ticket:155) (conrad, silvia)
Mon Jul 11 22:14:14 CST 2005 Conrad Parker <conrad@metadecks.org>
* Version 0.9.2
* added rewrite-pages example code stub to build tools from
* added fix-eos example tool to fix missing EOS flags (MikeS)
* Build system improvements (thomasvs)
* oggzinfo: Fix calculation of content duration. (ticket:117)
* oggzmerge: Fix an interleaving error in oggzmerge. (ticket:121)
* oggzrip: fix memory corruption detected by glibc on Fedora Core
(reported/fixed by thomasvs)
* oggz-validate: report streams with missing *** eos (ticket:146)
* oggz-validate: report and fail on non-Ogg files (ticket:147)
* Removed need for ./configure --disable-shared when running tests
under valgrind
2005-06-13 Thomas Vander Stichele <thomas at apestaart dot org>
* autogen.sh:
@ -42,6 +365,76 @@
* include/oggz/Makefile.am:
don't override includedir
Fri Apr 8 23:52:31 EST 2005 Conrad Parker <conrad@metadecks.org>
* Version 0.9.1
* Added new oggzinfo tool
* Added new oggz-validate tool
* oggzdump now displays packet lengths (in bytes, kB, MB, GB ;-)
and timestamps (rather than just byte offsets).
* oggzdump now interprets theora granulepos as a split of keyframe|pframe
* oggzdump now also has a --content-type (or -c) option for
specifying the name of a particular bitstream to dump
* r1176: fix some typos in oggzdiff which prevented multiple hide
options from being specified
* r1092: fix a bug in raw seeking, where doing a raw seek by bytes
and back again by time (to the original time point) hadn't
invalidated the cached time offset, hence the second seek was
considered unnecessary and skipped. This change correctly
invalidates the cached time offset when doing a raw byte seek.
* oggzrip filtering decisions are now made at the start of each logical
bitstream, not at every packet. Additionally, the hardcoded limit of
extracting no more than 64 logical bitstreams from the input file was removed.
Mon Feb 14 16:51:28 PST 2005 Conrad Parker <conrad@metadecks.org>
* Version 0.9.0
* updates for keyframe seeking in Theora and files with Ogg Skeleton
metaheaders (http://wiki.xiph.org/index.php/OggSkeleton)
* added missing header file definitions for oggz_get_granulerate()
and oggz_get_granuleshift()
* build fix for Symbian, adding missing file oggz_seek.c (Colin Ward)
* general code cleanups
* updated libtool shared version info to 2:0:1
Mon Feb 7 13:18:33 EST 2005 Conrad Parker <conrad@metadecks.org>
* Version 0.8.6
* new oggzrip tool, for ripping individual tracks from Ogg files;
by David Kuehling
* added inbuilt parsing of FLAC headers for seeking hints, by
Tobias Gehrig. This allows Ogg FLAC files to be used with oggzmerge
and similar tools.
* fixed oggzmerge binary open bug on Win32 (Colin Ward)
* updated Win32 project by Orum
* added inbuilt parsing of Ogg Skeleton and CMML binary headers
* simplified documentation related to seeking
* added oggz_{get,set}_{granulerate,granuleshift}() query functions
* Applied patch from Erik de Castro Lopo. Now builds on MingGW:
+ add pkg-config check for Ogg
+ add vorbis and speex CFLAGS to various Makefile.am's
Wed Oct 6 15:49:25 EST 2004 Conrad Parker <conrad@metadecks.org>
* Version 0.8.5
* new oggzmerge tool, for time-wise interleaving of bitstreams.
Via OggzAuto, merges files containing any number of Vorbis, Speex,
Theora and Annodex bitstreams automatically.
* updated support for Win32
* added OggzReadPage API
* many improvements to seeking behaviour
* added seek-stress example program
* fixed theora keyframe shift interpretation in oggz_auto
Wed Sep 8 15:23:04 EST 2004 Conrad Parker <conrad@metadecks.org>
* Version 0.8.4
* added support for building on Symbian OS (by Colin Ward)
* new OGGZ_ERR_IO_AGAIN handling for network reads
* added test for reading packets one-by-one
* expanded --help output for oggzdump tool
* added option to run test suite under valgrind
Fri Jan 21 17:38:33 EST 2005 Conrad Parker <conrad@annodex.net>
* added FLAC header parsing from Tobias Gehrig
@ -54,6 +447,7 @@ Fri May 28 11:08:34 EST 2004 Conrad Parker <conrad@annodex.net>
Fri May 21 16:48:34 EST 2004 Conrad Parker <conrad@annodex.net>
* Version 0.8.3
* Theora header parsing updated for Theora alpha3
* fixes for win32 build procedure
* improved API documentation for seeking, OGGZ_AUTO and OggzIO

Просмотреть файл

@ -1,5 +1,20 @@
Documentation files for Oggz
----------------------------
PATCHES: Instructions for generating patches
README: this file
README.symbian: Instructions for building for Symbian
README.win32: Instructions for building on Win32
Run:
----
$ oggz help
for documentation of the various oggz commands.
About Oggz
----------
==========
Oggz comprises liboggz and the tool oggz, which provides commands to
inspect, edit and validate Ogg files. The oggz-chop tool can also be
@ -43,26 +58,21 @@ README.symbian for information about building for Symbian devices.
Source layout
-------------
The src/ directory contains the source code.
The src/liboggz/ directory has the library source code.
The src/tools/ directory has some command line tools for analysing
Ogg files.
The src/examples/ directory contains example programs using liboggz.
The src/tests/ directory contains unit and functional tests.
doc/
doc/liboggz autocreated by the doxygen tool from comments
contained in the public C header files
The include/ directory contains the oggz include files that will
be installed into the system include directory.
include/ public C header files
The doc/ directory contains some documentation for oggz. The
subdirectory liboggz is autocreated by doxygen from comments contained
in the source code.
The win32/ directory contains the files necessary to compile the
library and tools for MS Windows.
The symbian/ directory contains the files necessary to compile the
library for Symbian.
src/
src/liboggz/ library source code.
src/tools/ command line tools
src/examples/ example programs using liboggz
src/tests/ unit and functional tests
symbian/ files necessary to compile the library for Symbian
win32/ files necessary to compile the library and tools for
Microsoft Windows
Programming with liboggz
------------------------
@ -102,7 +112,7 @@ presenting the following API niceties:
Full documentation of the liboggz API, customization and installation,
and mux and demux examples can be read online at:
http://www.annodex.net/software/liboggz/html/
http://www.xiph.org/oggz/doc/
oggz tool
---------
@ -118,6 +128,7 @@ Commands:
help Display help for a specific subcommand (eg. "oggz help chop")
Reporting:
codecs Display the codecs present in an Ogg file
diff Hexdump the packets of two Ogg files and output differences.
dump Hexdump packets of an Ogg file, or revert an Ogg file from
such a hexdump.
@ -173,7 +184,7 @@ Oggz is Free Software, available under a BSD style license.
More information is available online at the Oggz homepage:
http://www.annodex.net/software/liboggz/
http://xiph.org/oggz/
enjoy :)

Просмотреть файл

@ -4,23 +4,20 @@ were those applied by update.sh, which applies patches described
below, and the addition/upate of Makefile.in files for the
Mozilla build system.
The git commit id used was 7df1eb from git://git.xiph.org/liboggz.git
The git commit id used was cf5feeaab69b05 from git://git.xiph.org/liboggz.git
The wince.patch addresses the lack of posix file IO support on windows ce,
see bug 461844 for details.
endian.patch is applied to fix bug 452698.
bounded_seek.patch is applied to fix bug 469408.
key_frame_seek.patch fixes bug 463358.
offset_next.patch fixes bug 495366.
bug487519.patch: Fix for bug 487519.
bug496063.patch: Fix for infinite loop during seek while shutting down.
oggz_os2.patch: Bug 448918 - add OS/2 support (this patch should be
removed when OS/2 support is added upstream)
faster_seek.patch: Fix for bug 501031, make seeking faster over HTTP.

Просмотреть файл

@ -1,332 +0,0 @@
diff --git a/media/liboggz/include/oggz/oggz_seek.h b/media/liboggz/include/oggz/oggz_seek.h
--- a/media/liboggz/include/oggz/oggz_seek.h
+++ b/media/liboggz/include/oggz/oggz_seek.h
@@ -470,9 +470,28 @@ long oggz_seek_byorder (OGGZ * oggz, voi
* \param oggz An OGGZ handle previously opened for reading
* \param offset The offset of the start of data
* \returns 0 on success, -1 on failure.
*/
int oggz_set_data_start (OGGZ * oggz, oggz_off_t offset);
/** \}
*/
+/**
+ * Seeks Oggz to time unit_target, but with the bounds of the offset range
+ * [offset_begin, offset_end]. This is useful when seeking in network streams
+ * where only parts of a media are buffered, and retrieving unbuffered
+ * parts is expensive.
+ * \param oggz An OGGZ handle previously opened for reading
+ * \param unit_target The seek target, in milliseconds, or custom units
+ * \param offset_begin Start of offset range to seek inside, in bytes
+ * \param offset_end End of offset range to seek inside, in bytes,
+ pass -1 for end of media
+ * \returns The new position, in milliseconds or custom units
+ * \retval -1 on failure (unit_target is not within range)
+ */
+ogg_int64_t
+oggz_bounded_seek_set (OGGZ * oggz,
+ ogg_int64_t unit_target,
+ ogg_int64_t offset_begin,
+ ogg_int64_t offset_end);
+
#endif /* __OGGZ_SEEK_H__ */
diff --git a/media/liboggz/src/liboggz/oggz_seek.c b/media/liboggz/src/liboggz/oggz_seek.c
--- a/media/liboggz/src/liboggz/oggz_seek.c
+++ b/media/liboggz/src/liboggz/oggz_seek.c
@@ -617,205 +617,182 @@ oggz_offset_end (OGGZ * oggz)
if (oggz_io_seek (oggz, offset_save, SEEK_SET) == -1) {
return -1; /* fubar */
}
}
return offset_end;
}
-static ogg_int64_t
-oggz_seek_set (OGGZ * oggz, ogg_int64_t unit_target)
+ogg_int64_t
+oggz_bounded_seek_set (OGGZ * oggz,
+ ogg_int64_t unit_target,
+ ogg_int64_t offset_begin,
+ ogg_int64_t offset_end)
{
OggzReader * reader;
oggz_off_t offset_orig, offset_at, offset_guess;
- oggz_off_t offset_begin, offset_end = -1, offset_next;
+ oggz_off_t offset_next;
ogg_int64_t granule_at;
- ogg_int64_t unit_at, unit_begin = 0, unit_end = -1, unit_last_iter = -1;
+ ogg_int64_t unit_at, unit_begin = -1, unit_end = -1, unit_last_iter = -1;
long serialno;
ogg_page * og;
int hit_eof = 0;
if (oggz == NULL) {
return -1;
}
if (unit_target > 0 && !oggz_has_metrics (oggz)) {
#ifdef DEBUG
- printf ("oggz_seek_set: No metric defined, FAIL\n");
+ printf ("oggz_bounded_seek_set: No metric defined, FAIL\n");
#endif
return -1;
}
-
- if ((offset_end = oggz_offset_end (oggz)) == -1) {
+
+ if (offset_end == -1 && (offset_end = oggz_offset_end (oggz)) == -1) {
#ifdef DEBUG
- printf ("oggz_seek_set: oggz_offset_end == -1, FAIL\n");
+ printf ("oggz_bounded_seek_set: oggz_offset_end == -1, FAIL\n");
#endif
return -1;
}
reader = &oggz->x.reader;
if (unit_target == reader->current_unit) {
#ifdef DEBUG
- printf ("oggz_seek_set: unit_target == reader->current_unit, SKIP\n");
+ printf ("oggz_bounded_seek_set: unit_target == reader->current_unit, SKIP\n");
#endif
return (long)reader->current_unit;
}
if (unit_target == 0) {
offset_at = oggz_reset (oggz, oggz->offset_data_begin, 0, SEEK_SET);
if (offset_at == -1) return -1;
return 0;
}
offset_at = oggz_tell_raw (oggz);
if (offset_at == -1) return -1;
offset_orig = oggz->offset;
- offset_begin = 0;
-
unit_at = reader->current_unit;
- unit_begin = 0;
og = &oggz->current_page;
- if (oggz_seek_raw (oggz, 0, SEEK_END) >= 0) {
+ if (unit_end == -1 && oggz_seek_raw (oggz, offset_end, SEEK_SET) >= 0) {
ogg_int64_t granulepos;
if (oggz_get_prev_start_page (oggz, og, &granulepos, &serialno) >= 0) {
unit_end = oggz_get_unit (oggz, serialno, granulepos);
}
}
+ if (unit_begin == -1 && oggz_seek_raw (oggz, offset_begin, SEEK_SET) >= 0) {
+ ogg_int64_t granulepos;
+ if (oggz_get_next_start_page (oggz, og) >= 0) {
+ serialno = ogg_page_serialno (og);
+ granulepos = ogg_page_granulepos (og);
+ unit_begin = oggz_get_unit (oggz, serialno, granulepos);
+ }
+ }
+
+ /* Fail if target isn't in specified range. */
+ if (unit_target < unit_begin || unit_target > unit_end)
+ return -1;
+
+ /* Reduce the search range if possible using read cursor position. */
+ if (unit_at > unit_begin && unit_at < unit_end) {
+ if (unit_target < unit_at) {
+ unit_end = unit_at;
+ offset_end = offset_at;
+ } else {
+ unit_begin = unit_at;
+ offset_begin = offset_at;
+ }
+ }
+
og = &oggz->current_page;
for ( ; ; ) {
unit_last_iter = unit_at;
hit_eof = 0;
#ifdef DEBUG
- printf ("oggz_seek_set: [A] want u%lld: (u%lld - u%lld) [@%" PRI_OGGZ_OFF_T "d - @%" PRI_OGGZ_OFF_T "d]\n",
+ printf ("oggz_bounded_seek_set: [A] want u%lld: (u%lld - u%lld) [@%" PRI_OGGZ_OFF_T "d - @%" PRI_OGGZ_OFF_T "d]\n",
unit_target, unit_begin, unit_end, offset_begin, offset_end);
#endif
offset_guess = oggz_seek_guess (unit_at, unit_target,
unit_begin, unit_end,
offset_at,
offset_begin, offset_end);
if (offset_guess == -1) break;
if (offset_guess == offset_at) {
/* Already there, looping */
break;
}
if (offset_guess > offset_end) {
offset_guess = offset_end;
- }
-
- offset_at = oggz_seek_raw (oggz, offset_guess, SEEK_SET);
- if (offset_at == -1) {
- goto notfound;
- }
-
- offset_next = oggz_get_next_start_page (oggz, og);
-
-#ifdef DEBUG
- printf ("oggz_seek_set: offset_next %" PRI_OGGZ_OFF_T "d\n", offset_next);
-#endif
-
- if (/*unit_end == -1 &&*/ offset_next == -2) { /* reached eof, backtrack */
- hit_eof = 1;
- offset_next = oggz_get_prev_start_page (oggz, og, &granule_at,
- &serialno);
- unit_end = oggz_get_unit (oggz, serialno, granule_at);
-#ifdef DEBUG
- printf ("oggz_seek_set: [C] offset_next @%" PRI_OGGZ_OFF_T "d, g%lld, (s%ld)\n",
- offset_next, granule_at, serialno);
- printf ("oggz_seek_set: [c] u%lld\n",
- oggz_get_unit (oggz, serialno, granule_at));
-#endif
- } else if (offset_next >= 0) {
+ offset_at = oggz_seek_raw (oggz, offset_guess, SEEK_SET);
+ offset_next = oggz_get_prev_start_page (oggz, og, &granule_at, &serialno);
+ } else {
+ offset_at = oggz_seek_raw (oggz, offset_guess, SEEK_SET);
+ offset_next = oggz_get_next_start_page (oggz, og);
serialno = ogg_page_serialno (og);
granule_at = ogg_page_granulepos (og);
}
- if (offset_next < 0) {
- goto notfound;
- }
-
- if (hit_eof || offset_next > offset_end) {
- offset_next =
- oggz_scan_for_page (oggz, og, unit_target, offset_begin, offset_end);
- if (offset_next < 0) goto notfound;
-
- offset_at = offset_next;
- serialno = ogg_page_serialno (og);
- granule_at = ogg_page_granulepos (og);
-
- unit_at = oggz_get_unit (oggz, serialno, granule_at);
-
- goto found;
- }
-
- offset_at = offset_next;
-
unit_at = oggz_get_unit (oggz, serialno, granule_at);
+#ifdef DEBUG
+ printf ("oggz_bounded_seek_set: offset_next %" PRI_OGGZ_OFF_T "d\n", offset_next);
+#endif
if (unit_at == unit_last_iter) break;
#ifdef DEBUG
- printf ("oggz_seek_set: [D] want u%lld, got page u%lld @%" PRI_OGGZ_OFF_T "d g%lld\n",
+ printf ("oggz_bounded_seek_set: [D] want u%lld, got page u%lld @%" PRI_OGGZ_OFF_T "d g%lld\n",
unit_target, unit_at, offset_at, granule_at);
#endif
if (unit_at < unit_target) {
offset_begin = offset_at;
unit_begin = unit_at;
if (unit_end == unit_begin) break;
} else if (unit_at > unit_target) {
offset_end = offset_at-1;
unit_end = unit_at;
if (unit_end == unit_begin) break;
} else {
break;
}
}
- found:
do {
offset_at = oggz_get_prev_start_page (oggz, og, &granule_at, &serialno);
unit_at = oggz_get_unit (oggz, serialno, granule_at);
} while (unit_at > unit_target);
if (offset_at < 0) {
oggz_reset (oggz, offset_orig, -1, SEEK_SET);
return -1;
}
offset_at = oggz_reset (oggz, offset_at, unit_at, SEEK_SET);
if (offset_at == -1) return -1;
#ifdef DEBUG
- printf ("oggz_seek_set: FOUND (%lld)\n", unit_at);
+ printf ("oggz_bounded_seek_set: FOUND (%lld)\n", unit_at);
#endif
return (long)reader->current_unit;
-
- notfound:
-#ifdef DEBUG
- printf ("oggz_seek_set: NOT FOUND\n");
-#endif
-
- oggz_reset (oggz, offset_orig, -1, SEEK_SET);
-
- return -1;
}
static ogg_int64_t
oggz_seek_end (OGGZ * oggz, ogg_int64_t unit_offset)
{
oggz_off_t offset_orig, offset_at, offset_end;
ogg_int64_t granulepos;
ogg_int64_t unit_end;
@@ -838,17 +815,17 @@ oggz_seek_end (OGGZ * oggz, ogg_int64_t
return -1;
}
#ifdef DEBUG
printf ("*** oggz_seek_end: found packet (%lld) at @%" PRI_OGGZ_OFF_T "d [%lld]\n",
unit_end, offset_end, granulepos);
#endif
- return oggz_seek_set (oggz, unit_end + unit_offset);
+ return oggz_bounded_seek_set (oggz, unit_end + unit_offset, 0, -1);
}
off_t
oggz_seek (OGGZ * oggz, oggz_off_t offset, int whence)
{
OggzReader * reader;
ogg_int64_t units = -1;
@@ -897,21 +874,21 @@ oggz_seek_units (OGGZ * oggz, ogg_int64_
#endif
return -1;
}
reader = &oggz->x.reader;
switch (whence) {
case SEEK_SET:
- r = oggz_seek_set (oggz, units);
+ r = oggz_bounded_seek_set (oggz, units, 0, -1);
break;
case SEEK_CUR:
units += reader->current_unit;
- r = oggz_seek_set (oggz, units);
+ r = oggz_bounded_seek_set (oggz, units, 0, -1);
break;
case SEEK_END:
r = oggz_seek_end (oggz, units);
break;
default:
/*oggz_set_error (oggz, OGGZ_EINVALID);*/
r = -1;
break;

Просмотреть файл

@ -1,8 +1,12 @@
diff --git a/media/liboggz/src/liboggz/oggz_dlist.c b/media/liboggz/src/liboggz/oggz_dlist.c
index 7b26070..541563a 100644
--- a/media/liboggz/src/liboggz/oggz_dlist.c
+++ b/media/liboggz/src/liboggz/oggz_dlist.c
@@ -142,17 +142,23 @@ oggz_dlist_prepend(OggzDList *dlist, void *elem) {
@@ -133,70 +133,81 @@ oggz_dlist_prepend(OggzDList *dlist, voi
new_elem->prev = dlist->head;
new_elem->next = dlist->head->next;
new_elem->prev->next = new_elem;
new_elem->next->prev = new_elem;
return 0;
}
@ -28,7 +32,14 @@ index 7b26070..541563a 100644
}
void
@@ -167,13 +173,19 @@ oggz_dlist_reverse_iter(OggzDList *dlist, OggzDListIterFunc func) {
oggz_dlist_reverse_iter(OggzDList *dlist, OggzDListIterFunc func) {
OggzDListElem *p;
for (p = dlist->tail->prev; p != dlist->head; p = p->prev) {
if (func(p->data) == DLIST_ITER_CANCEL) {
break;
}
}
}
@ -50,7 +61,9 @@ index 7b26070..541563a 100644
break;
}
@@ -183,7 +195,7 @@ oggz_dlist_deliter(OggzDList *dlist, OggzDListIterFunc func) {
q = p->next;
p->prev->next = p->next;
p->next->prev = p->prev;
oggz_free(p);
}
@ -59,7 +72,11 @@ index 7b26070..541563a 100644
}
void
@@ -195,7 +207,6 @@ oggz_dlist_reverse_deliter(OggzDList *dlist, OggzDListIterFunc func) {
oggz_dlist_reverse_deliter(OggzDList *dlist, OggzDListIterFunc func) {
OggzDListElem *p, *q;
for (p = dlist->tail->prev; p != dlist->head; p = q) {
if (func(p->data) == DLIST_ITER_CANCEL) {
break;
}
@ -67,11 +84,20 @@ index 7b26070..541563a 100644
q = p->prev;
p->prev->next = p->next;
p->next->prev = p->prev;
oggz_free(p);
}
}
diff --git a/media/liboggz/src/liboggz/oggz_dlist.h b/media/liboggz/src/liboggz/oggz_dlist.h
index 8913e73..8955250 100644
--- a/media/liboggz/src/liboggz/oggz_dlist.h
+++ b/media/liboggz/src/liboggz/oggz_dlist.h
@@ -36,7 +36,7 @@
@@ -31,17 +31,17 @@
*/
#ifndef __OGGZ_DLIST_H__
#define __OGGZ_DLIST_H__
struct _OggzDList;
typedef struct _OggzDList OggzDList;
@ -80,7 +106,17 @@ index 8913e73..8955250 100644
typedef OggzDListIterResponse (*OggzDListIterFunc) (void *elem);
@@ -55,13 +55,13 @@ oggz_dlist_append(OggzDList *dlist, void *elem);
OggzDList *
oggz_dlist_new (void);
void
oggz_dlist_delete(OggzDList *dlist);
@@ -50,21 +50,21 @@ int
oggz_dlist_is_empty(OggzDList *dlist);
int
oggz_dlist_append(OggzDList *dlist, void *elem);
int
oggz_dlist_prepend(OggzDList *dlist, void *elem);
@ -96,11 +132,18 @@ index 8913e73..8955250 100644
oggz_dlist_deliter(OggzDList *dlist, OggzDListIterFunc func);
void
oggz_dlist_reverse_deliter(OggzDList *dlist, OggzDListIterFunc func);
#endif
diff --git a/media/liboggz/src/liboggz/oggz_read.c b/media/liboggz/src/liboggz/oggz_read.c
index 81eeb9e..98e25e8 100644
--- a/media/liboggz/src/liboggz/oggz_read.c
+++ b/media/liboggz/src/liboggz/oggz_read.c
@@ -295,11 +295,15 @@ oggz_read_deliver_packet(void *elem) {
@@ -292,21 +292,25 @@ oggz_read_deliver_packet(void *elem) {
unit_stored = p->reader->current_unit;
p->reader->current_granulepos = p->calced_granulepos;
p->reader->current_unit =
oggz_get_unit (p->oggz, p->serialno, p->calced_granulepos);
if (p->stream->read_packet) {
@ -120,7 +163,17 @@ index 81eeb9e..98e25e8 100644
}
p->reader->current_granulepos = gp_stored;
@@ -455,7 +459,9 @@ oggz_read_sync (OGGZ * oggz)
p->reader->current_unit = unit_stored;
oggz_read_free_pbuffer_entry(p);
return DLIST_ITER_CONTINUE;
@@ -448,17 +452,19 @@ oggz_read_sync (OGGZ * oggz)
* move backward through the list assigning gp values based upon
* the granulepos we just recieved. Then move forward through
* the list delivering any packets at the beginning with valid
* gp values
*/
ogg_int64_t gp_stored = stream->last_granulepos;
stream->last_packet = &packet;
oggz_dlist_reverse_iter(oggz->packet_buffer, oggz_read_update_gp);
@ -131,7 +184,17 @@ index 81eeb9e..98e25e8 100644
/*
* fix up the stream granulepos
@@ -493,7 +499,10 @@ oggz_read_sync (OGGZ * oggz)
*/
stream->last_granulepos = gp_stored;
if (!oggz_dlist_is_empty(oggz->packet_buffer)) {
OggzBufferedPacket *p = oggz_read_new_pbuffer_entry(
@@ -486,17 +492,20 @@ oggz_read_sync (OGGZ * oggz)
if (!op->b_o_s) stream->delivered_non_b_o_s = 1;
}
else
break;
}
}
/* If we've got a stop already, don't read more data in */
@ -143,7 +206,17 @@ index 81eeb9e..98e25e8 100644
if(oggz_read_get_next_page (oggz, &og) < 0)
return OGGZ_READ_EMPTY; /* eof. leave uninitialized */
@@ -595,8 +604,9 @@ oggz_read (OGGZ * oggz, long n)
serialno = ogg_page_serialno (&og);
reader->current_serialno = serialno; /* XXX: maybe not necessary */
stream = oggz_get_stream (oggz, serialno);
@@ -588,18 +597,19 @@ oggz_read (OGGZ * oggz, long n)
if (bytes_read > 0) {
ogg_sync_wrote (&reader->ogg_sync, bytes_read);
remaining -= bytes_read;
nread += bytes_read;
cb_ret = oggz_read_sync (oggz);
@ -154,3 +227,8 @@ index 81eeb9e..98e25e8 100644
}
}
if (cb_ret == OGGZ_STOP_ERR) oggz_purge (oggz);
/* Don't return 0 unless it's actually an EOF condition */
if (nread == 0) {
switch (bytes_read) {

Просмотреть файл

@ -1,8 +1,7 @@
diff --git a/media/liboggz/src/liboggz/oggz_seek.c b/media/liboggz/src/liboggz/oggz_seek.c
index fff5158..f457244 100644
--- a/media/liboggz/src/liboggz/oggz_seek.c
+++ b/media/liboggz/src/liboggz/oggz_seek.c
@@ -476,16 +476,18 @@ oggz_scan_for_page (OGGZ * oggz, ogg_page * og, ogg_int64_t unit_target,
@@ -472,16 +472,18 @@ oggz_scan_for_page (OGGZ * oggz, ogg_pag
serialno = ogg_page_serialno (og);
granule_at = ogg_page_granulepos (og);
unit_at = oggz_get_unit (oggz, serialno, granule_at);
@ -21,7 +20,7 @@ index fff5158..f457244 100644
#ifdef DEBUG
printf (" scan: (%lld) == (%lld)\n", unit_at, unit_target);
#endif
@@ -765,16 +767,18 @@ oggz_bounded_seek_set (OGGZ * oggz,
@@ -761,16 +763,18 @@ oggz_bounded_seek_set (OGGZ * oggz,
if (unit_end == unit_begin) break;
} else {
break;

Просмотреть файл

@ -1,12 +1,19 @@
diff --git a/media/liboggz/include/oggz/config.h b/media/liboggz/include/oggz/config.h
index d645685..19d20f5 100644
diff --git a/media/liboggz/include/oggz/config_gcc.h b/media/liboggz/include/oggz/config_gcc.h
--- a/media/liboggz/include/oggz/config_gcc.h
+++ b/media/liboggz/include/oggz/config_gcc.h
@@ -126,3 +126,8 @@
/* Define to `unsigned int' if <sys/types.h> does not define. */
/* #undef size_t */
+
@@ -121,10 +121,15 @@
/* #undef _XOPEN_SOURCE */
/* Define to empty if `const' does not conform to ANSI C. */
/* #undef const */
/* Define to `long int' if <sys/types.h> does not define. */
/* #undef off_t */
+#include "prcpucfg.h"
+#ifdef IS_BIG_ENDIAN
+#define WORDS_BIGENDIAN
+#endif
+
/* Define to `unsigned int' if <sys/types.h> does not define. */
/* #undef size_t */

Просмотреть файл

@ -260,8 +260,8 @@ diff --git a/media/liboggz/src/liboggz/oggz_seek.c b/media/liboggz/src/liboggz/o
{
oggz_off_t offset_orig, offset_at, offset_end;
@@ -813,17 +801,17 @@ oggz_seek_end (OGGZ * oggz, ogg_int64_t
return -1;
}
unit_end = oggz_get_unit (oggz, serialno, granulepos);
#ifdef DEBUG
printf ("*** oggz_seek_end: found packet (%lld) at @%" PRI_OGGZ_OFF_T "d [%lld]\n",

Просмотреть файл

@ -1,9 +1,6 @@
/* config.h. Generated from config.h.in by configure. */
/* config.h.in. Generated from configure.ac by autoheader. */
/* Define if building universal (internal helper macro) */
/* #undef AC_APPLE_UNIVERSAL_BUILD */
/* Define if the compiler implements enums as signed values. */
/* #undef ALLOW_SIGNED_ENUMS */
@ -14,7 +11,7 @@
#define HAVE_FCNTL_H 1
/* Define to 1 if you have the 'getopt_long' function */
#define HAVE_GETOPT_LONG /**/
#define HAVE_GETOPT_LONG
/* Define to 1 if you have the <inttypes.h> header file. */
#define HAVE_INTTYPES_H 1
@ -25,10 +22,6 @@
/* Define to 1 if you have the <memory.h> header file. */
#define HAVE_MEMORY_H 1
/* Define to 1 if your system has a GNU libc compatible `realloc' function,
and to 0 otherwise. */
#define HAVE_REALLOC 1
/* Define to 1 if the system has the type `ssize_t'. */
#define HAVE_SSIZE_T 1
@ -70,7 +63,7 @@
#define OGGZ_OFF_MAX 0x7FFFFFFFFFFFFFFFLL
/* Define if <ogg/ogg.h> is const-correct */
#define OGG_H_CONST_CORRECT /**/
/* #undef OGG_H_CONST_CORRECT */
/* Name of package */
#define PACKAGE "liboggz"
@ -111,26 +104,13 @@
/* Version number of package */
#define VERSION "0.9.9"
/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most
significant byte first (like Motorola and SPARC, unlike Intel). */
#if defined AC_APPLE_UNIVERSAL_BUILD
# if defined __BIG_ENDIAN__
# define WORDS_BIGENDIAN 1
# endif
#else
# ifndef WORDS_BIGENDIAN
/* # undef WORDS_BIGENDIAN */
# endif
#endif
/* Define to 1 if your processor stores words with the most significant byte
first (like Motorola and SPARC, unlike Intel and VAX). */
/* #undef WORDS_BIGENDIAN */
/* Number of bits in a file offset, on hosts where this is settable. */
#define _FILE_OFFSET_BITS 64
#include "prcpucfg.h"
#ifdef IS_BIG_ENDIAN
#define WORDS_BIGENDIAN
#endif
/* Define to make fseeko etc. visible, on some hosts. */
#define _LARGEFILE_SOURCE 1
@ -146,8 +126,10 @@
/* Define to `long int' if <sys/types.h> does not define. */
/* #undef off_t */
/* Define to rpl_realloc if the replacement function should be used. */
/* #undef realloc */
#include "prcpucfg.h"
#ifdef IS_BIG_ENDIAN
#define WORDS_BIGENDIAN
#endif
/* Define to `unsigned int' if <sys/types.h> does not define. */
/* #undef size_t */

Просмотреть файл

@ -1,138 +1,138 @@
/* config.h. Generated by configure. */
/* config.h.in. Generated from configure.ac by autoheader. */
/* Define to 1 if you have the <dlfcn.h> header file. */
#undef HAVE_DLFCN_H
/* Define to 1 if you have the <fcntl.h> header file. */
#define HAVE_FCNTL_H 1
/* Define to 1 if you have the 'getopt_long' function */
#undef HAVE_GETOPT_LONG
/* Define to 1 if you have the <inttypes.h> header file. */
#undef HAVE_INTTYPES_H
/* Define to 1 if you have the `memmove' function. */
#undef HAVE_MEMMOVE
/* Define to 1 if you have the <memory.h> header file. */
#define HAVE_MEMORY_H 1
/* Define to 1 if you have the `random' function. */
#undef HAVE_RANDOM
/* Define to 1 if your system has a GNU libc compatible `realloc' function,
and to 0 otherwise. */
#undef HAVE_REALLOC
/* Define to 1 if the system has the type `ssize_t'. */
#define HAVE_SSIZE_T 1
/* Define to 1 if you have the <stdint.h> header file. */
#undef HAVE_STDINT_H
/* Define to 1 if you have the <stdlib.h> header file. */
#define HAVE_STDLIB_H 1
/* Define to 1 if you have the <strings.h> header file. */
#define HAVE_STRINGS_H 1
/* Define to 1 if you have the <string.h> header file. */
#define HAVE_STRING_H 1
/* Define to 1 if you have the <sys/stat.h> header file. */
#define HAVE_SYS_STAT_H 1
/* Define to 1 if you have the <sys/types.h> header file. */
#define HAVE_SYS_TYPES_H 1
/* Define to 1 if you have the <unistd.h> header file. */
#undef HAVE_UNISTD_H
/* Define to build experimental code */
/* #undef OGGZ_CONFIG_EXPERIMENTAL */
/* Do not build reading support */
#define OGGZ_CONFIG_READ 1
/* Do not build writing support */
#define OGGZ_CONFIG_WRITE 1
/* Set to maximum allowed value of sf_count_t type. */
#define OGGZ_OFF_MAX 0x7FFFFFFFFFFFFFFFLL
/* Name of package */
#define PACKAGE "liboggz"
/* Define to the address where bug reports for this package should be sent. */
#define PACKAGE_BUGREPORT ""
/* Define to the full name of this package. */
#define PACKAGE_NAME ""
/* Define to the full name and version of this package. */
#define PACKAGE_STRING ""
/* Define to the one symbol short name of this package. */
#define PACKAGE_TARNAME ""
/* Define to the version of this package. */
#define PACKAGE_VERSION ""
/* The size of a `loff_t', as computed by sizeof. */
/* #undef SIZEOF_LOFF_T */
/* The size of a `off64_t', as computed by sizeof. */
/* #undef SIZEOF_OFF64_T */
/* The size of a `off_t', as computed by sizeof. */
/* #define SIZEOF_OFF_T 8 */
/* Set to sizeof (long) if unknown. */
/* #define SIZEOF_OGGZ_OFF_T 8 */
/* The size of a `ssize_t', as computed by sizeof. */
/* #define SIZEOF_SSIZE_T 4 */
/* Define to 1 if you have the ANSI C header files. */
#define STDC_HEADERS 1
/* Set to long if unknown. */
#define TYPEOF_OGGZ_OFF_T off_t
/* Version number of package */
#define VERSION "0.9.8"
/* Define to 1 if your processor stores words with the most significant byte
first (like Motorola and SPARC, unlike Intel and VAX). */
/* #undef WORDS_BIGENDIAN */
/* Number of bits in a file offset, on hosts where this is settable. */
/* #undef _FILE_OFFSET_BITS */
/* Define to make fseeko etc. visible, on some hosts. */
/* #undef _LARGEFILE_SOURCE */
/* Define for large files, on AIX-style hosts. */
/* #undef _LARGE_FILES */
/* Define to empty if `const' does not conform to ANSI C. */
/* #undef const */
/* Define to empty if `const' does not conform to ANSI C. */
#undef const
/* Define to `long' if <sys/types.h> does not define. */
/* #undef off_t */
/* Define to rpl_realloc if the replacement function should be used. */
#undef realloc
/* Define to `unsigned' if <sys/types.h> does not define. */
#undef size_t
/* Define for MSVC as <stdint.h> is unavailable there */
typedef unsigned char uint8_t;
/* config.h. Generated by configure. */
/* config.h.in. Generated from configure.ac by autoheader. */
/* Define to 1 if you have the <dlfcn.h> header file. */
#undef HAVE_DLFCN_H
/* Define to 1 if you have the <fcntl.h> header file. */
#define HAVE_FCNTL_H 1
/* Define to 1 if you have the 'getopt_long' function */
#undef HAVE_GETOPT_LONG
/* Define to 1 if you have the <inttypes.h> header file. */
#undef HAVE_INTTYPES_H
/* Define to 1 if you have the `memmove' function. */
#undef HAVE_MEMMOVE
/* Define to 1 if you have the <memory.h> header file. */
#define HAVE_MEMORY_H 1
/* Define to 1 if you have the `random' function. */
#undef HAVE_RANDOM
/* Define to 1 if your system has a GNU libc compatible `realloc' function,
and to 0 otherwise. */
#undef HAVE_REALLOC
/* Define to 1 if the system has the type `ssize_t'. */
#define HAVE_SSIZE_T 1
/* Define to 1 if you have the <stdint.h> header file. */
#undef HAVE_STDINT_H
/* Define to 1 if you have the <stdlib.h> header file. */
#define HAVE_STDLIB_H 1
/* Define to 1 if you have the <strings.h> header file. */
#define HAVE_STRINGS_H 1
/* Define to 1 if you have the <string.h> header file. */
#define HAVE_STRING_H 1
/* Define to 1 if you have the <sys/stat.h> header file. */
#define HAVE_SYS_STAT_H 1
/* Define to 1 if you have the <sys/types.h> header file. */
#define HAVE_SYS_TYPES_H 1
/* Define to 1 if you have the <unistd.h> header file. */
#undef HAVE_UNISTD_H
/* Define to build experimental code */
/* #undef OGGZ_CONFIG_EXPERIMENTAL */
/* Do not build reading support */
#define OGGZ_CONFIG_READ 1
/* Do not build writing support */
#define OGGZ_CONFIG_WRITE 1
/* Set to maximum allowed value of sf_count_t type. */
#define OGGZ_OFF_MAX 0x7FFFFFFFFFFFFFFFLL
/* Name of package */
#define PACKAGE "liboggz"
/* Define to the address where bug reports for this package should be sent. */
#define PACKAGE_BUGREPORT ""
/* Define to the full name of this package. */
#define PACKAGE_NAME ""
/* Define to the full name and version of this package. */
#define PACKAGE_STRING ""
/* Define to the one symbol short name of this package. */
#define PACKAGE_TARNAME ""
/* Define to the version of this package. */
#define PACKAGE_VERSION ""
/* The size of a `loff_t', as computed by sizeof. */
/* #undef SIZEOF_LOFF_T */
/* The size of a `off64_t', as computed by sizeof. */
/* #undef SIZEOF_OFF64_T */
/* The size of a `off_t', as computed by sizeof. */
/* #define SIZEOF_OFF_T 8 */
/* Set to sizeof (long) if unknown. */
/* #define SIZEOF_OGGZ_OFF_T 8 */
/* The size of a `ssize_t', as computed by sizeof. */
/* #define SIZEOF_SSIZE_T 4 */
/* Define to 1 if you have the ANSI C header files. */
#define STDC_HEADERS 1
/* Set to long if unknown. */
#define TYPEOF_OGGZ_OFF_T off_t
/* Version number of package */
#define VERSION "0.9.8"
/* Define to 1 if your processor stores words with the most significant byte
first (like Motorola and SPARC, unlike Intel and VAX). */
/* #undef WORDS_BIGENDIAN */
/* Number of bits in a file offset, on hosts where this is settable. */
/* #undef _FILE_OFFSET_BITS */
/* Define to make fseeko etc. visible, on some hosts. */
/* #undef _LARGEFILE_SOURCE */
/* Define for large files, on AIX-style hosts. */
/* #undef _LARGE_FILES */
/* Define to empty if `const' does not conform to ANSI C. */
/* #undef const */
/* Define to empty if `const' does not conform to ANSI C. */
#undef const
/* Define to `long' if <sys/types.h> does not define. */
/* #undef off_t */
/* Define to rpl_realloc if the replacement function should be used. */
#undef realloc
/* Define to `unsigned' if <sys/types.h> does not define. */
#undef size_t
/* Define for MSVC as <stdint.h> is unavailable there */
typedef unsigned char uint8_t;
#define inline __inline // MSVC

Просмотреть файл

@ -27,7 +27,7 @@ diff --git a/media/liboggz/include/oggz/oggz_seek.h b/media/liboggz/include/oggz
diff --git a/media/liboggz/src/liboggz/oggz_seek.c b/media/liboggz/src/liboggz/oggz_seek.c
--- a/media/liboggz/src/liboggz/oggz_seek.c
+++ b/media/liboggz/src/liboggz/oggz_seek.c
@@ -935,8 +935,131 @@ oggz_seek_byorder (OGGZ * oggz, void * t
@@ -931,8 +931,131 @@ oggz_seek_byorder (OGGZ * oggz, void * t
long
oggz_seek_packets (OGGZ * oggz, long serialno, long packets, int whence)

Просмотреть файл

@ -1,7 +1,7 @@
diff --git a/media/liboggz/src/liboggz/oggz_read.c b/media/liboggz/src/liboggz/oggz_read.c
--- a/media/liboggz/src/liboggz/oggz_read.c
+++ b/media/liboggz/src/liboggz/oggz_read.c
@@ -180,61 +180,47 @@ oggz_set_read_page (OGGZ * oggz, long se
@@ -176,43 +176,46 @@ oggz_set_read_page (OGGZ * oggz, long se
* returns >= 0 if found; return value is offset of page start
* returns -1 on error
* returns -2 if EOF was encountered
@ -10,8 +10,7 @@ diff --git a/media/liboggz/src/liboggz/oggz_read.c b/media/liboggz/src/liboggz/o
oggz_read_get_next_page (OGGZ * oggz, ogg_page * og)
{
OggzReader * reader = &oggz->x.reader;
- long bytes = 0, more;
- oggz_off_t page_offset = 0, ret;
- long more;
+ long more = 0, page_offset = 0;
int found = 0;
@ -23,15 +22,14 @@ diff --git a/media/liboggz/src/liboggz/oggz_read.c b/media/liboggz/src/liboggz/o
if (more == 0) {
/* No page available */
- page_offset = 0;
+ reader->current_page_bytes = 0;
return -2;
} else if (more < 0) {
#ifdef DEBUG_VERBOSE
printf ("get_next_page: skipped %ld bytes\n", -more);
#endif
page_offset += (-more);
- oggz->offset += (-more);
+ page_offset += (-more);
} else {
#ifdef DEBUG_VERBOSE
printf ("get_next_page: page has %ld bytes\n", more);
@ -42,22 +40,9 @@ diff --git a/media/liboggz/src/liboggz/oggz_read.c b/media/liboggz/src/liboggz/o
} while (!found);
-#if 0 /* This is now done by the increment at the top of the file */
- /* Calculate the byte offset of the page which was found */
- if (bytes > 0) {
- oggz->offset = oggz_io_tell (oggz) - bytes + page_offset;
- ret = oggz->offset;
- } else {
- /* didn't need to do any reading -- accumulate the page_offset */
- ret = oggz->offset + page_offset;
- oggz->offset += page_offset + more;
- }
+ oggz->offset += page_offset;
- return ret;
-#else
+
return oggz->offset;
-#endif
}
typedef struct {
@ -65,11 +50,10 @@ diff --git a/media/liboggz/src/liboggz/oggz_read.c b/media/liboggz/src/liboggz/o
ogg_int64_t calced_granulepos;
oggz_stream_t * stream;
OggzReader * reader;
OGGZ * oggz;
diff --git a/media/liboggz/src/liboggz/oggz_seek.c b/media/liboggz/src/liboggz/oggz_seek.c
--- a/media/liboggz/src/liboggz/oggz_seek.c
+++ b/media/liboggz/src/liboggz/oggz_seek.c
@@ -119,16 +119,18 @@ oggz_seek_raw (OGGZ * oggz, oggz_off_t o
@@ -115,16 +115,18 @@ oggz_seek_raw (OGGZ * oggz, oggz_off_t o
offset_at = oggz_io_tell (oggz);
oggz->offset = offset_at;
@ -88,7 +72,7 @@ diff --git a/media/liboggz/src/liboggz/oggz_seek.c b/media/liboggz/src/liboggz/o
{
oggz_stream_t * stream = (oggz_stream_t *) data;
@@ -200,74 +202,70 @@ oggz_purge (OGGZ * oggz)
@@ -196,74 +198,70 @@ oggz_purge (OGGZ * oggz)
* returns -2 if EOF was encountered
*/
static oggz_off_t

Просмотреть файл

@ -109,7 +109,7 @@ dirac_bool ( dirac_bs_t *p_bs )
return dirac_bs_read ( p_bs, 1 );
}
void
int
dirac_parse_info (dirac_info *info, unsigned char * data, long len)
{
dirac_bs_t bs;
@ -152,6 +152,10 @@ dirac_parse_info (dirac_info *info, unsigned char * data, long len)
info->level = dirac_uint( &bs ); /* level */
info->video_format = video_format = dirac_uint( &bs ); /* index */
if (video_format >= (sizeof(dirac_fsize_tbl) / sizeof(dirac_fsize_tbl[0]))) {
return -1;
}
info->width = dirac_fsize_tbl[video_format].width;
info->height = dirac_fsize_tbl[video_format].height;
if (dirac_bool( &bs )) {
@ -187,4 +191,6 @@ dirac_parse_info (dirac_info *info, unsigned char * data, long len)
info->fps_denominator = dirac_uint( &bs );
}
}
}
return 0;
}

Просмотреть файл

@ -24,6 +24,10 @@ typedef struct {
ogg_uint32_t top_field_first;
} dirac_info;
extern void dirac_parse_info (dirac_info *info, unsigned char *data, long len);
/**
* \return -1 Error: parse failure, invalid size index
* \return 0 Success
*/
extern int dirac_parse_info (dirac_info *info, unsigned char *data, long len);
#endif

Просмотреть файл

@ -34,7 +34,7 @@
#include "oggz_private.h"
#include <oggz/oggz_stream.h>
#include "oggz/oggz_stream.h"
static ogg_int64_t
oggz_metric_dirac (OGGZ * oggz, long serialno,
@ -80,7 +80,8 @@ oggz_metric_default_granuleshift (OGGZ * oggz, long serialno,
iframe = granulepos >> stream->granuleshift;
pframe = granulepos - (iframe << stream->granuleshift);
granulepos = (iframe + pframe);
granulepos = iframe + pframe;
if (granulepos > 0) granulepos -= stream->first_granule;
units = granulepos * stream->granulerate_d / stream->granulerate_n;
@ -200,6 +201,22 @@ oggz_get_granulerate (OGGZ * oggz, long serialno,
return 0;
}
int
oggz_set_first_granule (OGGZ * oggz, long serialno,
ogg_int64_t first_granule)
{
oggz_stream_t * stream;
if (oggz == NULL) return OGGZ_ERR_BAD_OGGZ;
stream = oggz_get_stream (oggz, serialno);
if (stream == NULL) return OGGZ_ERR_BAD_SERIALNO;
stream->first_granule = first_granule;
return oggz_metric_update (oggz, serialno);
}
/** DEPRECATED **/
int
oggz_set_metric_linear (OGGZ * oggz, long serialno,

Просмотреть файл

@ -347,6 +347,7 @@ oggz_add_stream (OGGZ * oggz, long serialno)
stream->preroll = 0;
stream->granulerate_n = 1;
stream->granulerate_d = 1;
stream->first_granule = 0;
stream->basegranule = 0;
stream->granuleshift = 0;

Просмотреть файл

@ -45,7 +45,7 @@
#include "oggz_byteorder.h"
#include "dirac.h"
#include <oggz/oggz_stream.h>
#include "oggz/oggz_stream.h"
/*#define DEBUG*/
@ -58,10 +58,6 @@ int oggz_set_metric_linear (OGGZ * oggz, long serialno,
ogg_int64_t granule_rate_numerator,
ogg_int64_t granule_rate_denominator);
#define INT16_BE_AT(x) _be_16((*(ogg_int32_t *)(x)))
#define INT32_LE_AT(x) _le_32((*(ogg_int32_t *)(x)))
#define INT64_LE_AT(x) _le_64((*(ogg_int64_t *)(x)))
static int
oggz_stream_set_numheaders (OGGZ * oggz, long serialno, int numheaders)
{
@ -86,7 +82,7 @@ auto_speex (OGGZ * oggz, long serialno, unsigned char * data, long length, void
if (length < 68) return 0;
granule_rate = (ogg_int64_t) INT32_LE_AT(&header[36]);
granule_rate = (ogg_int64_t) int32_le_at(&header[36]);
#ifdef DEBUG
printf ("Got speex rate %d\n", (int)granule_rate);
#endif
@ -95,7 +91,7 @@ auto_speex (OGGZ * oggz, long serialno, unsigned char * data, long length, void
oggz_set_preroll (oggz, serialno, 3);
numheaders = (ogg_int64_t) INT32_LE_AT(&header[68]) + 2;
numheaders = (ogg_int64_t) int32_le_at(&header[68]) + 2;
oggz_stream_set_numheaders (oggz, serialno, numheaders);
return 1;
@ -109,7 +105,7 @@ auto_vorbis (OGGZ * oggz, long serialno, unsigned char * data, long length, void
if (length < 30) return 0;
granule_rate = (ogg_int64_t) INT32_LE_AT(&header[12]);
granule_rate = (ogg_int64_t) int32_le_at(&header[12]);
#ifdef DEBUG
printf ("Got vorbis rate %d\n", (int)granule_rate);
#endif
@ -134,10 +130,13 @@ static int intlog(int num) {
}
#endif
#define THEORA_VERSION(maj,min,rev) ((maj<<16)+(min<<8)+rev)
static int
auto_theora (OGGZ * oggz, long serialno, unsigned char * data, long length, void * user_data)
{
unsigned char * header = data;
int version;
ogg_int32_t fps_numerator, fps_denominator;
char keyframe_granule_shift = 0;
int keyframe_shift;
@ -145,6 +144,8 @@ auto_theora (OGGZ * oggz, long serialno, unsigned char * data, long length, void
/* TODO: this should check against 42 for the relevant version numbers */
if (length < 41) return 0;
version = THEORA_VERSION(header[7], header[8], header[9]);
fps_numerator = int32_be_at(&header[22]);
fps_denominator = int32_be_at(&header[26]);
@ -173,6 +174,8 @@ auto_theora (OGGZ * oggz, long serialno, unsigned char * data, long length, void
OGGZ_AUTO_MULT * (ogg_int64_t)fps_denominator);
oggz_set_granuleshift (oggz, serialno, keyframe_shift);
if (version > THEORA_VERSION(3,2,0))
oggz_set_first_granule (oggz, serialno, 1);
oggz_stream_set_numheaders (oggz, serialno, 3);
@ -196,8 +199,8 @@ auto_anxdata (OGGZ * oggz, long serialno, unsigned char * data, long length, voi
if (length < 28) return 0;
granule_rate_numerator = INT64_LE_AT(&header[8]);
granule_rate_denominator = INT64_LE_AT(&header[16]);
granule_rate_numerator = int64_le_at(&header[8]);
granule_rate_denominator = int64_le_at(&header[16]);
#ifdef DEBUG
printf ("Got AnxData rate %lld/%lld\n", granule_rate_numerator,
granule_rate_denominator);
@ -246,7 +249,7 @@ auto_flac (OGGZ * oggz, long serialno, unsigned char * data, long length, void *
oggz_set_granulerate (oggz, serialno, granule_rate, OGGZ_AUTO_MULT);
numheaders = INT16_BE_AT(&header[7]);
numheaders = int16_be_at(&header[7]);
oggz_stream_set_numheaders (oggz, serialno, numheaders);
return 1;
@ -285,14 +288,14 @@ auto_celt (OGGZ * oggz, long serialno, unsigned char * data, long length, void *
if (length < 56) return 0;
granule_rate = (ogg_int64_t) INT32_LE_AT(&header[40]);
granule_rate = (ogg_int64_t) int32_le_at(&header[40]);
#ifdef DEBUG
printf ("Got celt sample rate %d\n", (int)granule_rate);
#endif
oggz_set_granulerate (oggz, serialno, granule_rate, OGGZ_AUTO_MULT);
numheaders = (ogg_int64_t) INT32_LE_AT(&header[52]) + 2;
numheaders = (ogg_int64_t) int32_le_at(&header[52]) + 2;
oggz_stream_set_numheaders (oggz, serialno, numheaders);
return 1;
@ -307,8 +310,8 @@ auto_cmml (OGGZ * oggz, long serialno, unsigned char * data, long length, void *
if (length < 28) return 0;
granule_rate_numerator = INT64_LE_AT(&header[12]);
granule_rate_denominator = INT64_LE_AT(&header[20]);
granule_rate_numerator = int64_le_at(&header[12]);
granule_rate_denominator = int64_le_at(&header[20]);
if (length > 28)
granuleshift = (int)header[28];
else
@ -339,8 +342,8 @@ auto_kate (OGGZ * oggz, long serialno, unsigned char * data, long length, void *
if (length < 64) return 0;
gps_numerator = INT32_LE_AT(&header[24]);
gps_denominator = INT32_LE_AT(&header[28]);
gps_numerator = int32_le_at(&header[24]);
gps_denominator = int32_le_at(&header[28]);
granule_shift = (header[15]);
numheaders = (header[11]);
@ -368,7 +371,8 @@ auto_dirac (OGGZ * oggz, long serialno, unsigned char * data, long length, void
info = oggz_malloc(sizeof(dirac_info));
if (info == NULL) return -1;
dirac_parse_info(info, data, length);
if (dirac_parse_info(info, data, length) == -1)
return -1;
/* the granulerate is twice the frame rate (in order to handle interlace) */
oggz_set_granulerate (oggz, serialno,
@ -392,13 +396,13 @@ auto_fisbone (OGGZ * oggz, long serialno, unsigned char * data, long length, voi
if (length < 48) return 0;
fisbone_serialno = (long) INT32_LE_AT(&header[12]);
fisbone_serialno = (long) int32_le_at(&header[12]);
/* Don't override an already assigned metric */
if (oggz_stream_has_metric (oggz, fisbone_serialno)) return 1;
granule_rate_numerator = INT64_LE_AT(&header[20]);
granule_rate_denominator = INT64_LE_AT(&header[28]);
granule_rate_numerator = int64_le_at(&header[20]);
granule_rate_denominator = int64_le_at(&header[28]);
granuleshift = (int)header[48];
#ifdef DEBUG

Просмотреть файл

@ -116,7 +116,28 @@ _le_64 (ogg_int64_t l)
static ogg_int32_t
int32_be_at (unsigned char *c)
{
return (c [0] << 24) + (c [1] << 16) + (c [2] << 8) + c [3] ;
return (c [0] << 24) | (c [1] << 16) | (c [2] << 8) | c [3] ;
}
static unsigned short
int16_be_at (unsigned char *c)
{
return (c [0] << 8) | c [1];
}
static ogg_int32_t
int32_le_at (unsigned char *c)
{
return c [0] | (c [1] << 8) | (c [2] << 16) | (c [3] << 24);
}
static ogg_int64_t
int64_le_at (unsigned char *c)
{
ogg_uint32_t a = c [0] | (c [1] << 8) | (c [2] << 16) | (c [3] << 24);
ogg_uint32_t b = c [4] | (c [5] << 8) | (c [6] << 16) | (c [7] << 24);
return (((ogg_int64_t)b) << 32) | a;
}
#endif /* __OGGZ_BYTEORDER_H__ */

Просмотреть файл

@ -45,7 +45,7 @@
#include "oggz_private.h"
#include "oggz_vector.h"
#include <oggz/oggz_stream.h>
#include "oggz/oggz_stream.h"
/*#define DEBUG*/
@ -354,7 +354,31 @@ oggz_comment_next_byname (OGGZ * oggz, long serialno,
return NULL;
}
#define _oggz_comment_add(f,c) oggz_vector_insert_p ((f)->comments, (c))
static OggzComment *
_oggz_comment_add_byname (oggz_stream_t * stream, const char * name, const char * value)
{
OggzComment * comment, * new_comment;
int i;
/* Check that the same name=value pair is not already present */
for (i = 0; i < oggz_vector_size (stream->comments); i++) {
comment = (OggzComment *) oggz_vector_nth_p (stream->comments, i);
if (comment->name && !strcasecmp (name, comment->name)) {
if (comment->value == NULL) {
if (value == NULL) return comment;
} else if ((value && !strcmp (value, comment->value)) ||
(value == NULL && comment->value == NULL)) {
return comment;
}
}
}
/* Allocate new comment and insert it */
if ((new_comment = oggz_comment_new (name, value)) == NULL)
return NULL;
return oggz_vector_insert_p (stream->comments, new_comment);
}
int
oggz_comment_add (OGGZ * oggz, long serialno, const OggzComment * comment)
@ -376,10 +400,7 @@ oggz_comment_add (OGGZ * oggz, long serialno, const OggzComment * comment)
if (!oggz_comment_validate_byname (comment->name, comment->value))
return OGGZ_ERR_COMMENT_INVALID;
if ((new_comment = oggz_comment_new (comment->name, comment->value)) == NULL)
return OGGZ_ERR_OUT_OF_MEMORY;
if (_oggz_comment_add (stream, new_comment) == NULL)
if (_oggz_comment_add_byname (stream, comment->name, comment->value) == NULL)
return OGGZ_ERR_OUT_OF_MEMORY;
return 0;
@ -412,10 +433,7 @@ oggz_comment_add_byname (OGGZ * oggz, long serialno,
if (!oggz_comment_validate_byname (name, value))
return OGGZ_ERR_COMMENT_INVALID;
if ((new_comment = oggz_comment_new (name, value)) == NULL)
return OGGZ_ERR_OUT_OF_MEMORY;
if (_oggz_comment_add (stream, new_comment) == NULL)
if (_oggz_comment_add_byname (stream, name, value) == NULL)
return OGGZ_ERR_OUT_OF_MEMORY;
return 0;
@ -570,8 +588,10 @@ oggz_comments_decode (OGGZ * oggz, long serialno,
if ((nvalue = oggz_strdup_len (c, len)) == NULL)
return OGGZ_ERR_OUT_OF_MEMORY;
if (_oggz_comment_set_vendor (oggz, serialno, nvalue) == OGGZ_ERR_OUT_OF_MEMORY)
if (_oggz_comment_set_vendor (oggz, serialno, nvalue) == OGGZ_ERR_OUT_OF_MEMORY) {
oggz_free (nvalue);
return OGGZ_ERR_OUT_OF_MEMORY;
}
oggz_free (nvalue);
}
@ -609,22 +629,20 @@ oggz_comments_decode (OGGZ * oggz, long serialno,
printf ("oggz_comments_decode: %s -> %s (length %d)\n",
name, nvalue, n);
#endif
if ((comment = oggz_comment_new (name, nvalue)) == NULL)
return OGGZ_ERR_OUT_OF_MEMORY;
if (_oggz_comment_add (stream, comment) == NULL)
if (_oggz_comment_add_byname (stream, name, nvalue) == NULL) {
oggz_free (nvalue);
return OGGZ_ERR_OUT_OF_MEMORY;
}
oggz_free (nvalue);
} else {
if ((nvalue = oggz_strdup_len (name, len)) == NULL)
return OGGZ_ERR_OUT_OF_MEMORY;
if ((comment = oggz_comment_new (nvalue, NULL)) == NULL)
return OGGZ_ERR_OUT_OF_MEMORY;
if (_oggz_comment_add (stream, comment) == NULL)
if (_oggz_comment_add_byname (stream, nvalue, NULL) == NULL) {
oggz_free (nvalue);
return OGGZ_ERR_OUT_OF_MEMORY;
}
oggz_free (nvalue);
}

Просмотреть файл

@ -86,6 +86,7 @@ struct _oggz_stream_t {
int preroll;
ogg_int64_t granulerate_n;
ogg_int64_t granulerate_d;
ogg_int64_t first_granule;
ogg_int64_t basegranule;
int granuleshift;
@ -282,6 +283,8 @@ oggz_get_granulerate (OGGZ * oggz, long serialno,
int oggz_set_granuleshift (OGGZ * oggz, long serialno, int granuleshift);
int oggz_get_granuleshift (OGGZ * oggz, long serialno);
int oggz_set_first_granule (OGGZ * oggz, long serialno, ogg_int64_t first_granule);
int oggz_set_preroll (OGGZ * oggz, long serialno, int preroll);
int oggz_get_preroll (OGGZ * oggz, long serialno);

Просмотреть файл

@ -60,7 +60,7 @@
#include "oggz_compat.h"
#include "oggz_private.h"
#include <oggz/oggz_stream.h>
#include "oggz/oggz_stream.h"
/* #define DEBUG */
/* #define DEBUG_VERBOSE */
@ -259,6 +259,12 @@ oggz_read_update_gp(void *elem) {
if (p->calced_granulepos == -1 && p->stream->last_granulepos != -1) {
int content = oggz_stream_get_content(p->oggz, p->serialno);
/* Cancel the iteration (backwards through buffered packets)
* if we don't know the codec */
if (content < 0 || content >= OGGZ_CONTENT_UNKNOWN)
return DLIST_ITER_CANCEL;
p->calced_granulepos =
oggz_auto_calculate_gp_backwards(content, p->stream->last_granulepos,
p->stream, &(p->packet), p->stream->last_packet);
@ -391,32 +397,28 @@ oggz_read_sync (OGGZ * oggz)
granulepos = op->granulepos;
content = oggz_stream_get_content(oggz, serialno);
/*
* if we have no metrics for this stream yet, then generate them
*/
if
(
(!stream->metric || (content == OGGZ_CONTENT_SKELETON))
&&
(oggz->flags & OGGZ_AUTO)
)
{
oggz_auto_read_bos_packet (oggz, op, serialno, NULL);
}
if (content < 0 || content >= OGGZ_CONTENT_UNKNOWN) {
reader->current_granulepos = granulepos;
} else {
/* if we have no metrics for this stream yet, then generate them */
if ((!stream->metric || content == OGGZ_CONTENT_SKELETON) &&
(oggz->flags & OGGZ_AUTO)) {
oggz_auto_read_bos_packet (oggz, op, serialno, NULL);
}
/* attempt to determine granulepos for this packet */
if (oggz->flags & OGGZ_AUTO) {
reader->current_granulepos =
oggz_auto_calculate_granulepos (content, granulepos, stream, op);
/* make sure that we accept any "real" gaps in the granulepos
*/
if (granulepos != -1 && reader->current_granulepos < granulepos) {
/* attempt to determine granulepos for this packet */
if (oggz->flags & OGGZ_AUTO) {
reader->current_granulepos =
oggz_auto_calculate_granulepos (content, granulepos, stream, op);
/* make sure that we accept any "real" gaps in the granulepos */
if (granulepos != -1 && reader->current_granulepos < granulepos) {
reader->current_granulepos = granulepos;
}
} else {
reader->current_granulepos = granulepos;
}
} else {
reader->current_granulepos = granulepos;
}
}
stream->last_granulepos = reader->current_granulepos;
/* set unit on last packet of page */

Просмотреть файл

@ -794,13 +794,13 @@ oggz_seek_end (OGGZ * oggz, ogg_int64_t unit_offset)
offset_end = oggz_get_prev_start_page (oggz, og, &granulepos, &serialno);
unit_end = oggz_get_unit (oggz, serialno, granulepos);
if (offset_end < 0) {
oggz_reset (oggz, offset_orig, -1, SEEK_SET);
return -1;
}
unit_end = oggz_get_unit (oggz, serialno, granulepos);
#ifdef DEBUG
printf ("*** oggz_seek_end: found packet (%lld) at @%" PRI_OGGZ_OFF_T "d [%lld]\n",
unit_end, offset_end, granulepos);

Просмотреть файл

@ -51,10 +51,8 @@ cp $1/src/liboggz/dirac.c ./src/liboggz/dirac.c
cp $1/AUTHORS ./AUTHORS
patch -p3 <wince.patch
patch -p3 <endian.patch
patch -p3 <bounded_seek.patch
patch -p3 <key_frame_seek.patch
patch -p3 <offset_next.patch
patch -p3 <bug487519.patch
patch -p3 <bug496063.patch
patch -p3 <oggz_os2.patch
patch -p3 <faster_seek.patch

Просмотреть файл

@ -1,7 +1,12 @@
diff --git a/media/liboggz/include/oggz/oggz_off_t.h b/media/liboggz/include/oggz/oggz_off_t.h
--- a/media/liboggz/include/oggz/oggz_off_t.h
+++ b/media/liboggz/include/oggz/oggz_off_t.h
@@ -39,6 +39,10 @@
@@ -34,16 +34,20 @@
#define __OGGZ_OFF_T_H__
/** \file
* Architecture-dependent type and printf format for file position.
* Allows Large File Sizes on systems supporting 64-bit off_t types.
*/
#ifdef _WIN32
@ -12,10 +17,20 @@ diff --git a/media/liboggz/include/oggz/oggz_off_t.h b/media/liboggz/include/ogg
/* MSVC/Borland & Cygwin */
typedef off_t oggz_off_t;
#define PRI_OGGZ_OFF_T "l"
#else
#include <oggz/oggz_off_t_generated.h>
#endif
diff --git a/media/liboggz/src/liboggz/oggz_seek.c b/media/liboggz/src/liboggz/oggz_seek.c
--- a/media/liboggz/src/liboggz/oggz_seek.c
+++ b/media/liboggz/src/liboggz/oggz_seek.c
@@ -572,32 +572,41 @@ static oggz_off_t
@@ -556,21 +556,24 @@ oggz_seek_guess (ogg_int64_t unit_at, og
#endif
return offset_guess;
}
static oggz_off_t
oggz_offset_end (OGGZ * oggz)
{
@ -35,11 +50,7 @@ diff --git a/media/liboggz/src/liboggz/oggz_seek.c b/media/liboggz/src/liboggz/o
if (fstat (fd, &statbuf) == -1) {
/*oggz_set_error (oggz, OGGZ_ERR_SYSTEM);*/
return -1;
}
if (oggz_stat_regular (statbuf.st_mode)) {
offset_end = statbuf.st_size;
#ifdef DEBUG
@@ -582,16 +585,22 @@ oggz_offset_end (OGGZ * oggz)
printf ("oggz_offset_end: stat size %" PRI_OGGZ_OFF_T "d\n", offset_end);
#endif
} else {
@ -57,3 +68,8 @@ diff --git a/media/liboggz/src/liboggz/oggz_seek.c b/media/liboggz/src/liboggz/o
} else {
oggz_off_t offset_save;
if (oggz->io == NULL || oggz->io->seek == NULL) {
/* No file, and no io seek method */
return -1;
}