Ralph Giles [Fri, 2 Nov 2012 01:56:57 +0000 (18:56 -0700)]
Attempt to fix the autotools linking issue on jenkins.
The jenkins autotools build has never worked because we try to
build against uninstalled versions of the opus and ogg libraries,
whose pkg-config files export a static library. This works fine
for executables, but libtool seemingly can't link a dynamic library
against a static library.
We could change the -uninstalled.pc files to reference the libtool
versions of the libraries, but that breaks the unix makefile builds,
which of course don't use libtool.
As a work around, write out our own versions of the pc files and
use those to reference the file we need.
Also sets -x on both continuous integration scripts so it's more
clear what steps are being applied.
Ralph Giles [Thu, 1 Nov 2012 23:25:52 +0000 (16:25 -0700)]
Document where to put release packages.
Timothy B. Terriberry [Sun, 28 Oct 2012 11:37:40 +0000 (04:37 -0700)]
Fix potential memory leaks added in
3bc74807.
Timothy B. Terriberry [Sat, 27 Oct 2012 13:52:11 +0000 (06:52 -0700)]
A few small updates to the hostname verification.
Fixes the case where a raw IPv6 address would be rejected as not
looking like a FQDN.
Also simplifies the wildcard comparison a little.
Timothy B. Terriberry [Sat, 27 Oct 2012 03:13:24 +0000 (20:13 -0700)]
Remove OP_SSL_SKIP_CERTIFICATE_CHECK from opusfile_example.
a7c5b93c flipped the argument to it from true to false, since it
made certificate checking actually work.
This commit removes the option entirely to avoid encouraging people
to use it now that that checking does work.
seeking_example still disables checking (since it's not really
needed).
Timothy B. Terriberry [Sat, 27 Oct 2012 02:59:48 +0000 (19:59 -0700)]
Make SSL/TLS certificate checking actually work.
We weren't loading the default certificate store, so there were no
trusted certificates to validate hosts with, and all checks would
fail (unless explicitly disabled with
OP_SSL_SKIP_CERTIFICATE_CHECK(0)).
This adds that call, and also adds hostname verification (which
OpenSSL does not do for us, because they are morons).
I've done my best to get the latter right by reading the RFCs, but
this stuff is complex, it's easy to make mistakes, and I only have
a limited ability to test it, so caveat emptor.
Ralph Giles [Fri, 26 Oct 2012 17:48:24 +0000 (10:48 -0700)]
Document the release process.
This is, as far as I can remember, the process I went through
to produce the 0.1 source and win32 binary packages.
I also added a few things I wish I'd done, like stripping
the binaries and including release notes and dependency versions
in the README to help us remember next time.
Ralph Giles [Wed, 24 Oct 2012 22:04:39 +0000 (15:04 -0700)]
Update git-version for the vN.M release tagging scheme.
We need the sed invocation to strip the 'v' prefix
when naming the dist tarball.
Ralph Giles [Wed, 24 Oct 2012 20:10:58 +0000 (13:10 -0700)]
Fix mingw warnings with -U__STRICT_ANSI__.
We use some C99 features (like lrintf) despite passing
-std=c89 -pedantic. This works on normal linux and mac
builds because we define _GNU_SOURCE, which enables
them, but the mingw32 headers ignore this, generating
warnings for lrintf and _putenv, the later hacked in
by libtool.
Avoid these by undefining __STRICT_ANSI__ in mingw builds,
which allows the default extensions and fixes the warnings.
Ralph Giles [Wed, 24 Oct 2012 18:10:31 +0000 (11:10 -0700)]
Print a warning when disabling http support for dependencies.
This should make mingw32-configure --enable-http less confusing.
Ralph Giles [Wed, 24 Oct 2012 18:00:39 +0000 (11:00 -0700)]
Disable HTTP support if sys/socket.h isn't present.
This avoids trying to build in http support when cross-compiling
for windows.
Also cleans up some adjacent formatting.
Timothy B. Terriberry [Wed, 24 Oct 2012 16:57:25 +0000 (09:57 -0700)]
Replace return code checks with OP_ALWAYS_TRUE().
Instead of assigning the return code to a local variable and then
using OP_ASSERT(), define a new OP_ALWAYS_TRUE() macro that still
evaluates its argument when assertions are disabled.
This avoids -Wunused-but-set-variable warnings from clang and
useless scan-build reports (if scan-build is run without
assertions enabled).
Timothy B. Terriberry [Tue, 23 Oct 2012 23:55:35 +0000 (16:55 -0700)]
Fix some printf format warnings in the examples.
Ralph Giles [Tue, 23 Oct 2012 23:50:53 +0000 (16:50 -0700)]
Don't build the API docs if doxygen isn't available.
Updates the configure check to match the one in the Opus
repository.
Ralph Giles [Mon, 1 Oct 2012 18:30:41 +0000 (11:30 -0700)]
Set the autoconf version from git.
AC_INIT requires that the version string passed in be 'static'
so we can't use the output of a shell invocation. However, it
can be computed by an m4 shell invocation. This is what autoconf
itself does to embed its git version number in PACKAGE_VERSION.
Doing this necessitates the 'echo -n' in git-version.sh. Make
is smart enough to strip the trailing newline, but AC_INIT is
not. We must also add -f to autoreconf. Otherwise, autogen.sh
will only update configure when configure.ac changes, even if
the output of git-version.sh has changed.
This is still not ideal, since it runs at autogen.sh time, not
at 'make' time, which is what we want. This seems to be a limitation
of an upcoming automake release, which removes the old style
with PACKAGE and VERSION set by shell variables.
Timothy B. Terriberry [Tue, 23 Oct 2012 18:21:04 +0000 (11:21 -0700)]
Don't discard timestamps from invalid packets.
Instead put them on the most recent valid packet on the page.
Also bullet-proof the offset checking to the "use the current
position when seeking" code added in
6d61f3f1.
The previous code relied on the file not changing out from under
us, which we shouldn't do.
Timothy B. Terriberry [Tue, 23 Oct 2012 17:04:22 +0000 (10:04 -0700)]
Fix an assertion failure.
This is no longer guaranteed after the change in
e7661191, so test
for it explicitly.
Thanks to Greg Maxwell for the test case.
Timothy B. Terriberry [Tue, 23 Oct 2012 03:42:15 +0000 (20:42 -0700)]
One small addendum to
7c52622f.
This case can basically only get hit if there's another stream
multiplexed in with ours, but this avoids re-scanning the same
data multiple times when it happens.
Timothy B. Terriberry [Tue, 23 Oct 2012 03:05:08 +0000 (20:05 -0700)]
Bisect from the current file position when seeking.
In most cases, this is a minor speed-up at best, but in some it can
be a big win.
Also, when forcing a true bisection instead of a secant-step,
don't add the negative bias to the result.
This can significantly improve the worst-case.
Timothy B. Terriberry [Tue, 23 Oct 2012 02:37:41 +0000 (19:37 -0700)]
Some http improvements.
- Attempt to re-use connections when we've already received enough
data to do so immediately.
- Make sure when seeking near the end, if the current chunk size is
such that the _next_ chunk will be half the normal size or less,
we just ask for the rest of the resource.
With these two changes, a normal open of a single-chain Opus-only
file requires exactly two HTTP requests.
- Also use the response buffer as a dummy buffer when skipping
data.
This will avoid helgrind errors for multiple writes from
different threads without locking (should someone be reading
multiple streams from different threads).
It's also better for SMP cache contention.
Timothy B. Terriberry [Tue, 23 Oct 2012 02:18:07 +0000 (19:18 -0700)]
Be more scrupulous about reading extra data.
This can be quite expensive with the http backend, especially if it
causes us to pass a chunk threshold and issue a new request.
It also lets us error out more quickly if the underlying stream
data changes.
Timothy B. Terriberry [Mon, 22 Oct 2012 01:14:29 +0000 (18:14 -0700)]
Bias the offsets in op_predict_link_start().
We apply a positive bias when the previous bisection point was
inside the current link, causing us to scan forward a bit instead
of seeking to a new location.
This knocks up to 18% off the number of seeks required to open very
large files with lots of links.
Timothy B. Terriberry [Mon, 22 Oct 2012 01:09:59 +0000 (18:09 -0700)]
Fix a few minor nits.
- The DIGIT character sets shouldn't need to list "0" twice.
- Avoid a lookup for the port number in getaddrinfo().
- Resolve the OPUS_SET_GAIN TODO (by refusing to implement a fallback).
- A few more minor things.
Timothy B. Terriberry [Sat, 20 Oct 2012 21:12:46 +0000 (14:12 -0700)]
Re-do abstract stream reader API.
This changes op_read_func to
a) Take a single byte count to read instead of an "item" count
(which the http backend couldn't properly support anyway).
b) Use integers for buffer sizes to avoid having to worry about
sign differences and whether size_t is larger or smaller than
opus_int64, etc.
c) Return an explicit error code (instead of using errno like
fread).
We had already eliminated the use of errno, but we did it by
treating read errors and EOF identically in all cases.
This was preventing us from reporting SSL truncation attacks
from the https backend.
The https backend now properly reports such errors.
This commit also fixes a bug introduced in
9b57b0c2, where we
accidentally started passing absolute offsets to the _boundary
parameter of op_get_next_page() instead of relative offsets.
We now use absolute offsets in all places, as it is the simpler
choice.
This matters now, because the error reported when encountering EOF
before hitting the _boundary is no longer suppressed (but instead
reported as OP_EBADLINK).
Finally, it removes the op_page_seek() function.
Except for the time needed to decode forward after seeking, this
function was identical in performance to op_pcm_seek(), and Opus
requires decoding 80 ms of data after seek anyway, so the relative
benefit is much smaller than with Vorbis.
A survey of open-source code using libvorbisfile showed that the
only usages of ov_page_seek() in the wild were calling it to seek
to the start of the stream, for which op_pcm_seek() already has a
special case that makes it just as fast.
The documentation was also updated to describe all of these chanes.
This is an incompatible API change.
Timothy B. Terriberry [Sat, 20 Oct 2012 16:54:16 +0000 (09:54 -0700)]
Make the URL API more extensible.
Right now we have no way to add any more parameters beyond a set of
basic binary flags.
This unifies op_url_stream_create() and
op_url_stream_create_with_proxy() into a single function that
takes a variable-length list of arguments, which can be extended
in the future to include more options of any type.
This is an incompatible API change.
Timothy B. Terriberry [Sat, 20 Oct 2012 16:14:21 +0000 (09:14 -0700)]
Fix op_http_parse_connection().
We were computing the return value correctly, but then not
returning it.
Timothy B. Terriberry [Sat, 20 Oct 2012 14:10:29 +0000 (07:10 -0700)]
Some http robustness improvements.
- Increase the maximum response header buffer size up to ~32 kB.
This also moves it into a heap-allocated buffer instead of the
stack, as 32 kB is really too much for the stack.
- Treat LF as CR LF when parsing headers.
This is necessary when parsing the load-balancer response in
front of <http://lazaradio.hu:8100/bermuda.opus>.
The response returned by that server is invalid in lots of ways,
but with these two changes we can read it.
- In addition, we now peek ahead at a large chunk of data when
reading the response instead of reading 2 to 4 bytes at a time.
This allows a typical response to be read with two syscalls
(one peek, one read) instead of several hundred.
- Stop trying to read more data when the connection is closed.
Timothy B. Terriberry [Sat, 20 Oct 2012 13:24:27 +0000 (06:24 -0700)]
Documentation revisions and a leak fix.
Thanks to Jean-Marc Valin for providing documentation feedback.
This also changes op_tags() to allow the tags to be queried on a
partially-open file (because they've already been read and are
available), and fixes a leak when a partially open file is freed
instead of being fully opened.
Timothy B. Terriberry [Sun, 14 Oct 2012 18:31:08 +0000 (11:31 -0700)]
Fix some socket connection bugs.
The big one was that if the connect() call failed, it would loop
forever (thanks to some code re-factoring, the loop was no longer
advancing to the next address as originally designed).
Timothy B. Terriberry [Sat, 13 Oct 2012 00:57:46 +0000 (17:57 -0700)]
Remove an assert.
On the first request made by a connection, the value it was testing
might be uninitialized, so we can't guarantee it'll pass.
Timothy B. Terriberry [Fri, 12 Oct 2012 22:29:52 +0000 (15:29 -0700)]
Major updates to the http backend.
* Now supports HTTP/1.1 persistent connections with pipelining.
This speeds up chain enumeration on large files by almost a
factor of 2 over http, and by roughly a factor of 4 over https.
The difference between http and https is now much smaller.
* Add timeouts to all the socket I/O.
* Estimate the number of available bytes to read and use it when
making connection re-use decisions.
* Add support for https with proxies using HTTP/1.1 CONNECT
tunnels.
* Fix TLS session re-use (it requires clean shutdown).
* Various other code re-organization and minor improvements.
Timothy B. Terriberry [Tue, 9 Oct 2012 01:36:46 +0000 (18:36 -0700)]
Fix a couple of MSVC warnings.
Timothy B. Terriberry [Tue, 9 Oct 2012 01:02:32 +0000 (18:02 -0700)]
Disable excessive warnings about parentheses.
Doing this in the source keeps them disabled when someone doesn't
use one of our build systems.
Gregory Maxwell [Sun, 7 Oct 2012 15:01:34 +0000 (11:01 -0400)]
remove GNUism from install doc command
Timothy B. Terriberry [Tue, 2 Oct 2012 14:58:06 +0000 (07:58 -0700)]
Fix a 10L bug in the memory stream reader.
It's helpful if we don't always read from the start of the array.
Thanks to Matti Virolainen for the report.
Ralph Giles [Mon, 1 Oct 2012 18:25:57 +0000 (11:25 -0700)]
Fix git-version.sh invocation.
Making it exectutable doesn't put it in the path, so we have to
call it ./git-version.sh from inside the doc directory.
Jenkins didn't catch this because the $(shell ...) return code
doesn't seem to be propagated to make itself. It prints a warning
but doesn't abort. I don't know if there's a way to fix that.
Ralph Giles [Mon, 1 Oct 2012 18:01:38 +0000 (11:01 -0700)]
Make git-version.sh executable.
Lets us call it directly without /bin/sh which saves space.
Ralph Giles [Mon, 1 Oct 2012 17:04:16 +0000 (10:04 -0700)]
Keep the continuous integration build scripts in the repo.
We use scripts like these with jenkins to do automatic build
and test runs on every commit. Keeping the build instructions
in the source repository itself makes it easier to track changes,
and easier to make atomic updates when something is moved in
the build system which breaks the jenkins runs.
Ralph Giles [Mon, 1 Oct 2012 16:29:08 +0000 (09:29 -0700)]
Adjectival hyphen.
Ralph Giles [Mon, 1 Oct 2012 16:24:24 +0000 (09:24 -0700)]
Remove 'lib' from the package name.
This matches what the opus package does, and is consistent with
what the pkg-config files were already doing.
Ralph Giles [Mon, 1 Oct 2012 16:17:07 +0000 (09:17 -0700)]
Remove FILE_VERSION_FILTER from the doxygen config.
This is redundant now that we have PROJECT_NUMBER
substitution implemented. The file version is for
displaying per-file versioning from CVS, etc.
Ralph Giles [Mon, 1 Oct 2012 16:15:58 +0000 (09:15 -0700)]
Substitute the package name as well.
Ralph Giles [Mon, 1 Oct 2012 16:09:36 +0000 (09:09 -0700)]
Use input redirect instead of explicit cat.
Saves an indent stop. Thanks to Tim for the suggestion.
Ralph Giles [Mon, 1 Oct 2012 16:01:28 +0000 (09:01 -0700)]
Make the configure summary more legible.
This almost, but doesn't quite, copy the layout the opus
configure script uses.
Timothy B. Terriberry [Mon, 1 Oct 2012 15:41:36 +0000 (08:41 -0700)]
Multiple small fixes.
* Tags were being freed even if not initialized if
op_fetch_headers() failed on the first link.
The logic for handling completely empty links would leak, also.
* Ignore fragment identifiers in http URLs instead of rejecting
them.
* Get the current link in seeking_example's verify_seek when
op_read_native() fails to return it for us.
Timothy B. Terriberry [Mon, 1 Oct 2012 15:04:40 +0000 (08:04 -0700)]
Fix scan_build static analysis reports.
Most of these were dead code left around from rewriting things and
things llvm doesn't have enough global information to prove by
itself.
The one real error was the missing NULL check in
opus_tags_parse_impl().
Timothy B. Terriberry [Mon, 1 Oct 2012 07:14:12 +0000 (00:14 -0700)]
Move installed include files under the opus dir.
Also use Libs.private for libm.
Timothy B. Terriberry [Mon, 1 Oct 2012 06:57:04 +0000 (23:57 -0700)]
Add pkg-config files.
Timothy B. Terriberry [Mon, 1 Oct 2012 06:30:37 +0000 (23:30 -0700)]
Add status output to opusfile_example.
This displays the current raw position, PCM position, and
instantaneous bitrate once per second of output.
This is useful when testing against long-running streams.
Timothy B. Terriberry [Mon, 1 Oct 2012 06:24:58 +0000 (23:24 -0700)]
Make seeking_example continue after failures.
This makes it more useful for testing invalid files, where the goal
is merely not to crash, assert, or trip valgrind warnings.
Timothy B. Terriberry [Mon, 1 Oct 2012 06:23:05 +0000 (23:23 -0700)]
Documentation updates.
* Add Opus logo.
* Use @VERSION@ consistently.
* Fix some warnings/formatting exposed by a newer Doxygen versions.
Timothy B. Terriberry [Mon, 1 Oct 2012 05:53:48 +0000 (22:53 -0700)]
Fix an uninitialized warning from
cf594de6.
The warning was correct, as far as it goes, but the use was
actually harmless.
Timothy B. Terriberry [Mon, 1 Oct 2012 04:59:30 +0000 (21:59 -0700)]
Fix file: <host> comparison.
The previous comparison would have succeeded on things like
"localhost123" instead of just "localhost".
Timothy B. Terriberry [Mon, 1 Oct 2012 04:49:51 +0000 (21:49 -0700)]
Clean up page seeking a bit.
* Guarantee pcm_start and pcm_end stay in range (not just move in
the right direction).
* When we fail to find a page in the interval, back up by increasing
chunk sizes just like op_get_prev_page_serial().
* Eliminate the special case for the last page in the interval.
* Force a straight bisection if we're backing up, but not decreasing
the interval size rapidly enough, to limit the worst-case.
This is guaranteed not to affect the first two iterations, so it
has minimal impact on seeking in the normal case.
Ralph Giles [Sun, 30 Sep 2012 17:18:12 +0000 (10:18 -0700)]
Fix the doc makefile.
The autoconf build replaced the static Doxyfile with a Doxyfile.in
template. In the autoconf build, the config.status script applies
substitutions to generate the actual Doxyfile. This made the generic
doc/Makefile non-functional.
Apply similar substitutions directly with the makefile so we can
still build documentation outside the context of the autoconf build.
Also add a 'distclean' target to remove the generated Doxyfile.
Timothy B. Terriberry [Sat, 29 Sep 2012 19:43:06 +0000 (12:43 -0700)]
Fix handling of holes.
We have to call op_collect_audio_packets() again to drain any
buffered packets from the page.
Diego Elio Pettenò [Sat, 29 Sep 2012 14:31:26 +0000 (07:31 -0700)]
build: implement autotools build system for libopusfile. (v4)
Includes
- A make debug target that disables optimizations and enables
assertions,
- Proper ./configure switches for the optional features,
- A configuration summary,
- libtool versioning information,
- Visibility and warning flags,
- API documentation, and
- Support for out-of-tree builds.
Signed-off-by: Diego Elio Pettenò <flameeyes@flameeyes.eu>
Timothy B. Terriberry [Sat, 29 Sep 2012 14:17:33 +0000 (07:17 -0700)]
Clean-up for alternate configurations.
* s/op_read_stereo_float/op_read_float_stereo/ for the fixed-point
API.
* Fix compiler warnings exposed when optimizations are enabled.
* Fix opusfile_example to work with --enable-fixed-point
--disable-float
* Fix seeking_example to not re-define OP_FIXED_POINT if it's
already been defined.
Gregory Maxwell [Sat, 29 Sep 2012 02:15:33 +0000 (22:15 -0400)]
Make seeking_example show maximums.
Ralph Giles [Mon, 24 Sep 2012 16:01:46 +0000 (09:01 -0700)]
Use $(AR) for ar to support cross-compiling.
GNU make provides a default definition for this variable.
I've no idea what's special about mingw32-ar vs native ar,
but it seems to be required.
Timothy B. Terriberry [Mon, 24 Sep 2012 07:27:42 +0000 (00:27 -0700)]
A bunch of minor improvements.
The most important for the https backend:
- Implement RFC 6066 Server Name Indication.
- Implement SSL session resumption.
This gives less of a speed improvement than you might think.
Timothy B. Terriberry [Mon, 24 Sep 2012 04:03:22 +0000 (21:03 -0700)]
Fix URL flags documentation link.
Timothy B. Terriberry [Mon, 24 Sep 2012 02:54:40 +0000 (19:54 -0700)]
Add copyright information.
Timothy B. Terriberry [Mon, 24 Sep 2012 02:44:26 +0000 (19:44 -0700)]
More minor documentation updates.
Timothy B. Terriberry [Mon, 24 Sep 2012 02:15:06 +0000 (19:15 -0700)]
More minor documentation updates.
Timothy B. Terriberry [Sun, 23 Sep 2012 23:31:23 +0000 (16:31 -0700)]
Disable linear scan/matching in seeking_example.
It's served its purpose, and isn't worth the time it takes now.
Leaving the code around to make it easy to re-enable if necessary.
Timothy B. Terriberry [Sun, 23 Sep 2012 23:18:40 +0000 (16:18 -0700)]
Documentation clean-up and updates.
Splits the documentation into sections and provides an overview.
Also explicitly document which functions can and cannot be called on
partially-open streams, and fix-up a few things to behave as
documented.
Timothy B. Terriberry [Sun, 23 Sep 2012 18:10:06 +0000 (11:10 -0700)]
Abstract position indicator tracking slightly.
There are now a couple of places where we need to know the actual
stream position indicator, not just the offset of the data we've
read out of the ogg_sync_state.
Make a function to compute this, document it, and use it.
Timothy B. Terriberry [Sun, 23 Sep 2012 18:07:34 +0000 (11:07 -0700)]
Fix end_offset tracking bug from
007ec4e4.
end_offset should be the _start_ of the last Opus page in a link,
to guarantee we seek before it to have enough information to do
end-trimming.
After the changes in
007ec4e4, it would be set to the start of the
next link if we cached the last page granule position.
Also add more comments.
Timothy B. Terriberry [Sun, 23 Sep 2012 15:49:37 +0000 (08:49 -0700)]
Minor 16-bit int fix.
Timothy B. Terriberry [Sun, 23 Sep 2012 15:42:58 +0000 (08:42 -0700)]
More link enumeration improvements.
1) Remember the granule position of the last page we've seen from
the current link and save the first page of the next link as
long as we're scanning forward.
This knocks almost 10% off the number of seeks for large links.
For smaller links the improvement is much larger.
2) Only use pairs of close-by serial numbers to estimate link
start locations (assuming they're above our start threshold).
This gives a minor (<2%) improvement, which might be in the
noise, but as it doesn't appear to hurt and is faster, might as
well.
3) Eliminate a redundant check in op_pcm_seek_page_impl().
Timothy B. Terriberry [Sun, 23 Sep 2012 08:45:33 +0000 (01:45 -0700)]
Further reduce seeks per bisection search.
If we encounter the first page after the target while scanning
forward, we no longer seek back and read it again after we exit the
bisection search, but just hold on to the copy we already have.
Timothy B. Terriberry [Sun, 23 Sep 2012 06:19:58 +0000 (23:19 -0700)]
Fix typo in
e4f32131.
Teach me to change something right before committing.
Timothy B. Terriberry [Sun, 23 Sep 2012 06:12:41 +0000 (23:12 -0700)]
Estimate http connection latency and bandwidth.
This gives us a better idea when to re-use a connection.
Timothy B. Terriberry [Sun, 23 Sep 2012 02:51:07 +0000 (19:51 -0700)]
Extrapolate in op_bisect_forward_serialno().
This uses two sightings of a valid granule position from the same
future stream to extrapolate where the start of that stream is
during link enumeration.
This can cut out more than 20% of the seeks required to open large
files with lots of long links.
Timothy B. Terriberry [Sun, 23 Sep 2012 01:11:35 +0000 (18:11 -0700)]
Fix an uninitialized value in the http reader.
Timothy B. Terriberry [Sun, 23 Sep 2012 01:02:12 +0000 (18:02 -0700)]
Save more stream state on seekable open.
2df5f786 did not quite save enough.
The ogg_stream_state and initial ogg_packet list also need to be
saved, and the starting granule position and pre-skip need to be
restored.
Otherwise, if the stream has more than one link, the first packets
decoded will come from the wrong one.
Timothy B. Terriberry [Sat, 22 Sep 2012 23:09:25 +0000 (16:09 -0700)]
Save initial stream state on seekable open.
This means that in the normal case, after identifying the chain
boundaries, we will seek back exactly where we were before.
With the http backend, that gives us a good chance of re-using our
initial connection to continue reading the stream.
Currently the LRU connection expiration algorithm means that is
unlikely with lots of links, however.
Timothy B. Terriberry [Sat, 22 Sep 2012 22:08:02 +0000 (15:08 -0700)]
Small speed-up to op_bisect_forward_serialno().
Try to guess that the next link will be approximately the average
size of all previous links, for files with many links.
This cuts off 6-17% of the seeks.
Also remove a variable that was left unused after
5e36109d.
Timothy B. Terriberry [Sat, 22 Sep 2012 21:40:03 +0000 (14:40 -0700)]
Clean up offset tracking.
Reduce the number of places we modify 'offset' so that
op_seek_helper() can always skip seeks to the current offset.
The checks we were doing before already covered all the places
where this was useful in the normal case, but this lets us
centralize that logic.
This commit also includes a few minor follow-ups to
9b57b0c2:
* Use a smaller type for ret_size and initialize it.
* Verify 'end' is at least as large as data we've already read.
Timothy B. Terriberry [Sat, 22 Sep 2012 20:37:38 +0000 (13:37 -0700)]
Fix some issues with trailing junk in files.
1) We were treating EOF in op_get_next_page() as a read error when
called from op_get_prev_page_serial().
2) We also assumed op_get_prev_page_serial() stopped scanning at the
end of the page it returned, in order to compute the size of
that page.
Return the page size explicitly instead.
3) Finally, once we discover where the last page is, there is no
reason to ever look at data past it.
Update 'end' once we find it, and always pass that to
op_get_next_page().
Timothy B. Terriberry [Sat, 22 Sep 2012 19:35:29 +0000 (12:35 -0700)]
Minor http redirect clean-ups.
Actually close the old socket.
Don't initialize SSL more than once.
Timothy B. Terriberry [Sat, 22 Sep 2012 17:16:14 +0000 (10:16 -0700)]
Add URL support to seeking_example.
Also fixes some indenting in opusfile_example.
Timothy B. Terriberry [Sat, 22 Sep 2012 15:54:04 +0000 (08:54 -0700)]
Add support for http, https, and file URLs.
This is pretty preliminary for now.
Seeking performance isn't great, and there's no caching.
I'm sure there's also lots of bugs.
Timothy B. Terriberry [Fri, 21 Sep 2012 02:12:46 +0000 (19:12 -0700)]
Fix crash in seeking_example.
When a match fails, the index of the position in the link needs to
be 64 bits.
Timothy B. Terriberry [Wed, 19 Sep 2012 22:43:43 +0000 (15:43 -0700)]
Fix hole reporting discrepancy.
op_find_initial_pcm_offset() would swallow any holes at the start
of a link, but seekable streams did not use it when crossing a
link boundary, so they would report a hole.
This unifies the hole reporting between the two, and also
simplifies the seeking code (which also needs to ignore holes) a
bit.
Timothy B. Terriberry [Wed, 19 Sep 2012 21:13:18 +0000 (14:13 -0700)]
A couple of seeking_example improvements.
1) Check for allocation failure and fall back to merely scanning a
file for consistent timestamps instead of loading it to RAM.
2) Report holes, but do not quit scanning/loading unless they cause
a discontinuity in the timestamps.
Ralph Giles [Tue, 18 Sep 2012 08:05:43 +0000 (01:05 -0700)]
Embed the git revision in the doxygen documentation.
The simple git-version script asks git for the current
revision, and falls back to 'unknown' if the result is
empty. This will have little effect until we have tags
in the repository.
We use the FILE_VERSION_FILTER option on doxygen to
embed this in the documentation with each file reference.
Unfortunately, there doesn't seem to be a way to
set PROJECT_NUMBER globally in the same way. This
commit unsets that option to avoid confusing references
in the generated documentation.
Ralph Giles [Tue, 18 Sep 2012 07:41:18 +0000 (00:41 -0700)]
Add a rough makefile for the documentation.
Just runs doxygen for us, an optionally latex.
The 'clean' target removes the doxygen output
directories.
Ralph Giles [Tue, 18 Sep 2012 00:54:56 +0000 (17:54 -0700)]
Add a doc directory with a minimal doxygen configuration.
This is just to help us validate the api docs as they're
added. By using a minimal Doxyfile we save space, make
it easier to read, and avoid warnings from deprecated
and unknown options across different doxygen versions.
Timothy B. Terriberry [Tue, 18 Sep 2012 00:07:48 +0000 (17:07 -0700)]
Finish implementing the OpusTags API.
Apparently just declaring the functions in the header is not good
enough.
Currently completely untested.
Timothy B. Terriberry [Mon, 17 Sep 2012 22:47:39 +0000 (15:47 -0700)]
Update opusfile.h's include guard.
3f18c55f moved it out of opus/, so strip the prefix.
Ralph Giles [Mon, 17 Sep 2012 16:12:28 +0000 (09:12 -0700)]
Don't include deps during 'make clean'.
If a source file moves (as in the previous commit), any stale
dependencies will block execution of 'make' because they
define a dependency relationship to an non-existant file.
The obvious thing to do is 'make clean' to get rid of the
dependency files, but of course that fails the same way.
To support this recovery, skip the include directive if
the GNU make variable MAKECMDGOALS is 'clean', exempting
this target from dependency checks.
Based on an example in the GNU make manual.
Ralph Giles [Mon, 17 Sep 2012 15:43:28 +0000 (08:43 -0700)]
Move opusfile.h up a level.
This matches the convention used by opus itself, where
headers are included without a prefix, and the build
must do -I/path/to/opus to find the appropriate versions.
Timothy B. Terriberry [Mon, 17 Sep 2012 15:34:15 +0000 (08:34 -0700)]
Public header cleanups.
More consistent formatting, s/file/stream/g, and finish adding
function warning attributes.
Timothy B. Terriberry [Mon, 17 Sep 2012 14:35:21 +0000 (07:35 -0700)]
Revert
ea2412ea.
The actual problem was that opus-uninstalled.pc was forcing static
linking, but not including all the relevant libraries.
Timothy B. Terriberry [Mon, 17 Sep 2012 14:25:32 +0000 (07:25 -0700)]
Use --static with pkg-config.
This is needed to pick up -lm for libopus when it requires it.
Timothy B. Terriberry [Mon, 17 Sep 2012 04:39:09 +0000 (21:39 -0700)]
Implement stereo downmixing functions.
Move this out of opusfile_example and into the API proper.
Timothy B. Terriberry [Mon, 17 Sep 2012 02:06:14 +0000 (19:06 -0700)]
Remove libm altogether.
It's not actually used by the examples anymore.
Ralph Giles [Mon, 17 Sep 2012 01:16:16 +0000 (18:16 -0700)]
Fix link order and add libm to the seeking example.
Needed to build on my Fedora 16 machine.