Bug 513999 - Backed out changeset 8217d78ccdaf, liboggz update from bug 512327 on CLOSED TREE.

This commit is contained in:
Chris Pearce 2009-09-02 11:11:05 +12:00
parent 7a52974576
commit 18eb84e9ce
23 changed files with 761 additions and 772 deletions

View File

@ -1,212 +1,3 @@
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:
@ -216,126 +7,12 @@ Sun Jan 13 13:27:57 JST 2008
* 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:
@ -365,76 +42,6 @@ Mon Jul 11 22:14:14 CST 2005 Conrad Parker <conrad@metadecks.org>
* 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
@ -447,7 +54,6 @@ 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

View File

@ -118,7 +118,6 @@ 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.

View File

@ -4,14 +4,15 @@ 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 20609d34c41fa611fe3dbb4853d4f328bd0a6185
from git://git.xiph.org/liboggz.git
The git commit id used was 7df1eb 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.
@ -19,3 +20,6 @@ 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)

View File

@ -0,0 +1,332 @@
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;

View File

@ -1,12 +1,8 @@
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
@@ -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;
@@ -142,17 +142,23 @@ oggz_dlist_prepend(OggzDList *dlist, void *elem) {
return 0;
}
@ -32,14 +28,7 @@ diff --git a/media/liboggz/src/liboggz/oggz_dlist.c b/media/liboggz/src/liboggz/
}
void
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;
}
@@ -167,13 +173,19 @@ oggz_dlist_reverse_iter(OggzDList *dlist, OggzDListIterFunc func) {
}
}
@ -61,9 +50,7 @@ diff --git a/media/liboggz/src/liboggz/oggz_dlist.c b/media/liboggz/src/liboggz/
break;
}
q = p->next;
p->prev->next = p->next;
p->next->prev = p->prev;
@@ -183,7 +195,7 @@ oggz_dlist_deliter(OggzDList *dlist, OggzDListIterFunc func) {
oggz_free(p);
}
@ -72,11 +59,7 @@ diff --git a/media/liboggz/src/liboggz/oggz_dlist.c b/media/liboggz/src/liboggz/
}
void
oggz_dlist_reverse_deliter(OggzDList *dlist, OggzDListIterFunc func) {
OggzDListElem *p, *q;
for (p = dlist->tail->prev; p != dlist->head; p = q) {
@@ -195,7 +207,6 @@ oggz_dlist_reverse_deliter(OggzDList *dlist, OggzDListIterFunc func) {
if (func(p->data) == DLIST_ITER_CANCEL) {
break;
}
@ -84,20 +67,11 @@ diff --git a/media/liboggz/src/liboggz/oggz_dlist.c b/media/liboggz/src/liboggz/
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
@@ -31,17 +31,17 @@
*/
#ifndef __OGGZ_DLIST_H__
#define __OGGZ_DLIST_H__
@@ -36,7 +36,7 @@
struct _OggzDList;
typedef struct _OggzDList OggzDList;
@ -106,17 +80,7 @@ diff --git a/media/liboggz/src/liboggz/oggz_dlist.h b/media/liboggz/src/liboggz/
typedef OggzDListIterResponse (*OggzDListIterFunc) (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);
@@ -55,13 +55,13 @@ oggz_dlist_append(OggzDList *dlist, void *elem);
int
oggz_dlist_prepend(OggzDList *dlist, void *elem);
@ -132,6 +96,61 @@ diff --git a/media/liboggz/src/liboggz/oggz_dlist.h b/media/liboggz/src/liboggz/
oggz_dlist_deliter(OggzDList *dlist, OggzDListIterFunc func);
void
oggz_dlist_reverse_deliter(OggzDList *dlist, OggzDListIterFunc func);
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) {
oggz_get_unit (p->oggz, p->serialno, p->calced_granulepos);
if (p->stream->read_packet) {
- p->stream->read_packet(p->oggz, &(p->packet), p->serialno,
- p->stream->read_user_data);
+ if (p->stream->read_packet(p->oggz, &(p->packet), p->serialno,
+ p->stream->read_user_data) != 0) {
+ return DLIST_ITER_ERROR;
+ }
} else if (p->reader->read_packet) {
- p->reader->read_packet(p->oggz, &(p->packet), p->serialno,
- p->reader->read_user_data);
+ if (p->reader->read_packet(p->oggz, &(p->packet), p->serialno,
+ p->reader->read_user_data) != 0) {
+ return DLIST_ITER_ERROR;
+ }
}
p->reader->current_granulepos = gp_stored;
@@ -455,7 +459,9 @@ oggz_read_sync (OGGZ * oggz)
ogg_int64_t gp_stored = stream->last_granulepos;
stream->last_packet = &packet;
oggz_dlist_reverse_iter(oggz->packet_buffer, oggz_read_update_gp);
- oggz_dlist_deliter(oggz->packet_buffer, oggz_read_deliver_packet);
+ if (oggz_dlist_deliter(oggz->packet_buffer, oggz_read_deliver_packet) == -1) {
+ return OGGZ_ERR_HOLE_IN_DATA;
+ }
/*
* fix up the stream granulepos
@@ -493,7 +499,10 @@ oggz_read_sync (OGGZ * oggz)
}
/* If we've got a stop already, don't read more data in */
- if (cb_ret == OGGZ_STOP_OK || cb_ret == OGGZ_STOP_ERR) return cb_ret;
+ if (cb_ret == OGGZ_STOP_OK ||
+ cb_ret == OGGZ_STOP_ERR ||
+ cb_ret == OGGZ_ERR_HOLE_IN_DATA)
+ return cb_ret;
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)
nread += bytes_read;
cb_ret = oggz_read_sync (oggz);
- if (cb_ret == OGGZ_ERR_OUT_OF_MEMORY)
+ if (cb_ret == OGGZ_ERR_OUT_OF_MEMORY || cb_ret == OGGZ_ERR_HOLE_IN_DATA) {
return cb_ret;
+ }
}
}
#endif

View File

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

View File

@ -1,25 +1,12 @@
diff --git a/media/liboggz/include/oggz/config_gcc.h b/media/liboggz/include/oggz/config_gcc.h
diff --git a/media/liboggz/include/oggz/config.h b/media/liboggz/include/oggz/config.h
index d645685..19d20f5 100644
--- a/media/liboggz/include/oggz/config_gcc.h
+++ b/media/liboggz/include/oggz/config_gcc.h
@@ -117,16 +117,21 @@
# ifndef WORDS_BIGENDIAN
/* # undef WORDS_BIGENDIAN */
# endif
#endif
/* Number of bits in a file offset, on hosts where this is settable. */
#define _FILE_OFFSET_BITS 64
@@ -126,3 +126,8 @@
/* Define to `unsigned int' if <sys/types.h> does not define. */
/* #undef size_t */
+
+#include "prcpucfg.h"
+#ifdef IS_BIG_ENDIAN
+#define WORDS_BIGENDIAN
+#endif
+
/* Define to make fseeko etc. visible, on some hosts. */
#define _LARGEFILE_SOURCE 1
/* Define for large files, on AIX-style hosts. */
/* #undef _LARGE_FILES */
/* Some systems need _XOPEN_SOURCE for timezone */
/* #undef _XOPEN_SOURCE */

View File

@ -25,6 +25,10 @@
/* 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
@ -142,5 +146,8 @@
/* 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 */
/* Define to `unsigned int' if <sys/types.h> does not define. */
/* #undef size_t */

View File

@ -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

View File

@ -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
@@ -931,8 +931,131 @@ oggz_seek_byorder (OGGZ * oggz, void * t
@@ -935,8 +935,131 @@ oggz_seek_byorder (OGGZ * oggz, void * t
long
oggz_seek_packets (OGGZ * oggz, long serialno, long packets, int whence)

View File

@ -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
@@ -176,42 +176,44 @@ oggz_set_read_page (OGGZ * oggz, long se
@@ -180,61 +180,47 @@ 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,9 @@ 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 more;
+ long more, page_offset = 0;
- long bytes = 0, more;
- oggz_off_t page_offset = 0, ret;
+ long more = 0, page_offset = 0;
int found = 0;
/* Increment oggz->offset by length of the last page processed */
@ -22,14 +23,15 @@ 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);
@ -39,19 +41,35 @@ 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 {
ogg_packet packet;
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
@@ -115,16 +115,18 @@ oggz_seek_raw (OGGZ * oggz, oggz_off_t o
@@ -119,16 +119,18 @@ oggz_seek_raw (OGGZ * oggz, oggz_off_t o
offset_at = oggz_io_tell (oggz);
oggz->offset = offset_at;
@ -70,7 +88,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;
@@ -196,74 +198,70 @@ oggz_purge (OGGZ * oggz)
@@ -200,74 +202,70 @@ oggz_purge (OGGZ * oggz)
* returns -2 if EOF was encountered
*/
static oggz_off_t

View File

@ -0,0 +1,22 @@
diff --git a/media/liboggz/include/oggz/oggz_off_t_generated.h b/media/liboggz/include/oggz/oggz_off_t_generated.h
--- a/media/liboggz/include/oggz/oggz_off_t_generated.h
+++ b/media/liboggz/include/oggz/oggz_off_t_generated.h
@@ -54,17 +54,17 @@
<pre>
echo "gcc -E oggz.h | grep oggz_off_t
</pre>
*
*/
#include <sys/types.h>
-#if defined(__APPLE__) || defined(SOLARIS)
+#if defined(__APPLE__) || defined(SOLARIS) || defined(OS2)
typedef off_t oggz_off_t;
#else
typedef loff_t oggz_off_t;
#endif
#define PRI_OGGZ_OFF_T "PRId64"
#endif /* __OGGZ_OFF_T_GENERATED__ */

62
media/liboggz/seek.patch Normal file
View File

@ -0,0 +1,62 @@
diff --git a/mozilla/media/liboggz/src/liboggz/oggz_seek.c b/mozilla/media/liboggz/src/liboggz/oggz_seek.c
index f933d4d..23ffb57 100644
--- a/mozilla/media/liboggz/src/liboggz/oggz_seek.c
+++ b/mozilla/media/liboggz/src/liboggz/oggz_seek.c
@@ -486,16 +486,18 @@ oggz_scan_for_page (OGGZ * oggz, ogg_page * og, ogg_int64_t unit_target,
serialno = ogg_page_serialno (og);
granule_at = ogg_page_granulepos (og);
unit_at = oggz_get_unit (oggz, serialno, granule_at);
break;
#else
do {
offset_at = oggz_get_prev_start_page(oggz, og, &granule_at, &serialno);
+ if (offset_at == -1)
+ return -1;
unit_at = oggz_get_unit(oggz, serialno, granule_at);
} while (unit_at > unit_target);
return offset_at;
#endif
} else if (unit_at == unit_target) {
#ifdef DEBUG
printf (" scan: (%lld) == (%lld)\n", unit_at, unit_target);
#endif
@@ -552,16 +554,19 @@ oggz_seek_guess (ogg_int64_t unit_at, ogg_int64_t unit_target,
printf ("oggz_seek_guess: unit_end <= unit_begin (ERROR)\n");
#endif
offset_guess = -1;
} else {
offset_guess = guess (unit_at, unit_target, unit_begin, unit_end,
offset_begin, offset_end);
}
+ if (offset_end != -1 && guess >= offset_end)
+ offset_guess = offset_begin + (offset_end - offset_begin)/2;
+
#ifdef DEBUG
printf ("oggz_seek_guess: guessed %" PRI_OGGZ_OFF_T "d\n", offset_guess);
#endif
return offset_guess;
}
static oggz_off_t
@@ -759,16 +764,18 @@ oggz_seek_set (OGGZ * oggz, ogg_int64_t unit_target)
} else {
break;
}
}
found:
do {
offset_at = oggz_get_prev_start_page (oggz, og, &granule_at, &serialno);
+ if (offset_at == -1)
+ break;
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;
}

View File

@ -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,7 @@ oggz_metric_default_granuleshift (OGGZ * oggz, long serialno,
iframe = granulepos >> stream->granuleshift;
pframe = granulepos - (iframe << stream->granuleshift);
granulepos = (iframe + pframe) - stream->first_granule;
granulepos = (iframe + pframe);
units = granulepos * stream->granulerate_d / stream->granulerate_n;
@ -200,22 +200,6 @@ 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,

View File

@ -347,7 +347,6 @@ 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;

View File

@ -45,7 +45,7 @@
#include "oggz_byteorder.h"
#include "dirac.h"
#include "oggz/oggz_stream.h"
#include <oggz/oggz_stream.h>
/*#define DEBUG*/
@ -58,6 +58,10 @@ 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)
{
@ -82,7 +86,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
@ -91,7 +95,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;
@ -105,7 +109,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
@ -130,13 +134,10 @@ 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;
@ -144,8 +145,6 @@ 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]);
@ -174,8 +173,6 @@ 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);
@ -199,8 +196,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);
@ -249,7 +246,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;
@ -288,14 +285,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;
@ -310,8 +307,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
@ -342,8 +339,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]);
@ -395,13 +392,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

View File

@ -116,28 +116,7 @@ _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] ;
}
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;
return (c [0] << 24) + (c [1] << 16) + (c [2] << 8) + c [3] ;
}
#endif /* __OGGZ_BYTEORDER_H__ */

View File

@ -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,31 +354,7 @@ oggz_comment_next_byname (OGGZ * oggz, long serialno,
return NULL;
}
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);
}
#define _oggz_comment_add(f,c) oggz_vector_insert_p ((f)->comments, (c))
int
oggz_comment_add (OGGZ * oggz, long serialno, const OggzComment * comment)
@ -400,7 +376,10 @@ 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 (_oggz_comment_add_byname (stream, comment->name, comment->value) == NULL)
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)
return OGGZ_ERR_OUT_OF_MEMORY;
return 0;
@ -433,7 +412,10 @@ oggz_comment_add_byname (OGGZ * oggz, long serialno,
if (!oggz_comment_validate_byname (name, value))
return OGGZ_ERR_COMMENT_INVALID;
if (_oggz_comment_add_byname (stream, name, value) == NULL)
if ((new_comment = oggz_comment_new (name, value)) == NULL)
return OGGZ_ERR_OUT_OF_MEMORY;
if (_oggz_comment_add (stream, new_comment) == NULL)
return OGGZ_ERR_OUT_OF_MEMORY;
return 0;
@ -588,10 +570,8 @@ 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) {
oggz_free (nvalue);
if (_oggz_comment_set_vendor (oggz, serialno, nvalue) == OGGZ_ERR_OUT_OF_MEMORY)
return OGGZ_ERR_OUT_OF_MEMORY;
}
oggz_free (nvalue);
}
@ -629,20 +609,22 @@ oggz_comments_decode (OGGZ * oggz, long serialno,
printf ("oggz_comments_decode: %s -> %s (length %d)\n",
name, nvalue, n);
#endif
if (_oggz_comment_add_byname (stream, name, nvalue) == NULL) {
oggz_free (nvalue);
if ((comment = oggz_comment_new (name, nvalue)) == NULL)
return OGGZ_ERR_OUT_OF_MEMORY;
if (_oggz_comment_add (stream, comment) == NULL)
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 (_oggz_comment_add_byname (stream, nvalue, NULL) == NULL) {
oggz_free (nvalue);
if ((comment = oggz_comment_new (nvalue, NULL)) == NULL)
return OGGZ_ERR_OUT_OF_MEMORY;
if (_oggz_comment_add (stream, comment) == NULL)
return OGGZ_ERR_OUT_OF_MEMORY;
}
oggz_free (nvalue);
}

View File

@ -86,7 +86,6 @@ 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;
@ -283,8 +282,6 @@ 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);

View File

@ -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 */
@ -181,7 +181,7 @@ static oggz_off_t
oggz_read_get_next_page (OGGZ * oggz, ogg_page * og)
{
OggzReader * reader = &oggz->x.reader;
long more, page_offset = 0;
long more = 0, page_offset = 0;
int found = 0;
/* Increment oggz->offset by length of the last page processed */
@ -208,6 +208,7 @@ oggz_read_get_next_page (OGGZ * oggz, ogg_page * og)
}
} while (!found);
oggz->offset += page_offset;
return oggz->offset;
@ -258,12 +259,6 @@ 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);
@ -296,11 +291,15 @@ oggz_read_deliver_packet(void *elem) {
oggz_get_unit (p->oggz, p->serialno, p->calced_granulepos);
if (p->stream->read_packet) {
p->stream->read_packet(p->oggz, &(p->packet), p->serialno,
p->stream->read_user_data);
if (p->stream->read_packet(p->oggz, &(p->packet), p->serialno,
p->stream->read_user_data) != 0) {
return DLIST_ITER_ERROR;
}
} else if (p->reader->read_packet) {
p->reader->read_packet(p->oggz, &(p->packet), p->serialno,
p->reader->read_user_data);
if (p->reader->read_packet(p->oggz, &(p->packet), p->serialno,
p->reader->read_user_data) != 0) {
return DLIST_ITER_ERROR;
}
}
p->reader->current_granulepos = gp_stored;
@ -392,28 +391,32 @@ oggz_read_sync (OGGZ * oggz)
granulepos = op->granulepos;
content = oggz_stream_get_content(oggz, serialno);
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);
}
/*
* 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) {
reader->current_granulepos = granulepos;
}
} else {
/* 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;
}
stream->last_granulepos = reader->current_granulepos;
/* set unit on last packet of page */
@ -452,7 +455,9 @@ oggz_read_sync (OGGZ * oggz)
ogg_int64_t gp_stored = stream->last_granulepos;
stream->last_packet = &packet;
oggz_dlist_reverse_iter(oggz->packet_buffer, oggz_read_update_gp);
oggz_dlist_deliter(oggz->packet_buffer, oggz_read_deliver_packet);
if (oggz_dlist_deliter(oggz->packet_buffer, oggz_read_deliver_packet) == -1) {
return OGGZ_ERR_HOLE_IN_DATA;
}
/*
* fix up the stream granulepos
@ -490,7 +495,10 @@ oggz_read_sync (OGGZ * oggz)
}
/* If we've got a stop already, don't read more data in */
if (cb_ret == OGGZ_STOP_OK || cb_ret == OGGZ_STOP_ERR) return cb_ret;
if (cb_ret == OGGZ_STOP_OK ||
cb_ret == OGGZ_STOP_ERR ||
cb_ret == OGGZ_ERR_HOLE_IN_DATA)
return cb_ret;
if(oggz_read_get_next_page (oggz, &og) < 0)
return OGGZ_READ_EMPTY; /* eof. leave uninitialized */
@ -592,8 +600,9 @@ oggz_read (OGGZ * oggz, long n)
nread += bytes_read;
cb_ret = oggz_read_sync (oggz);
if (cb_ret == OGGZ_ERR_OUT_OF_MEMORY)
if (cb_ret == OGGZ_ERR_OUT_OF_MEMORY || cb_ret == OGGZ_ERR_HOLE_IN_DATA) {
return cb_ret;
}
}
}

View File

@ -806,13 +806,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);

View File

@ -51,8 +51,9 @@ 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

View File

@ -1,12 +1,7 @@
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
@@ -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.
@@ -39,6 +39,10 @@
*/
#ifdef _WIN32
@ -17,20 +12,10 @@ 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
@@ -556,21 +556,24 @@ oggz_seek_guess (ogg_int64_t unit_at, og
#endif
return offset_guess;
}
@@ -572,32 +572,41 @@ static oggz_off_t
static oggz_off_t
oggz_offset_end (OGGZ * oggz)
{
@ -50,7 +35,11 @@ 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;
@@ -582,16 +585,22 @@ oggz_offset_end (OGGZ * oggz)
}
if (oggz_stat_regular (statbuf.st_mode)) {
offset_end = statbuf.st_size;
#ifdef DEBUG
printf ("oggz_offset_end: stat size %" PRI_OGGZ_OFF_T "d\n", offset_end);
#endif
} else {
@ -68,8 +57,3 @@ 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;
}