Andre Noll [Sat, 10 Mar 2007 19:31:00 +0000 (20:31 +0100)]
ogg_afh.c: Switch to ogg vorbis callbacks
This allows to call ov_clear() already during ogg_get_file_info() which
in turn simplifies ogg_close_audio_file().
This is a preparation for moving the close function of the audio
format handlers to the virtual streaming system as they all do
essentially the same now.
Andre Noll [Sun, 4 Mar 2007 22:54:17 +0000 (23:54 +0100)]
simplify ogg_compute_chunk_table()
it rewinds the input file on entry and on exit. Do this in the caller instead
which allows to get rid of the file parameter in ogg_compute_chunk_table().
Andre Noll [Sun, 4 Mar 2007 22:22:43 +0000 (23:22 +0100)]
simplify vss_read_chunk()
All its parameters are known globally within vss.c, so omit them.
Also, return an int instead of the pointer to the inbuffer which is
also known to the caller.
This patch also introduces para_fseek() in fd.c which is used by
mp3.c and vss.c and changes the mp3 audio format handler so that it
uses the new function and always check the return value.
Andre Noll [Sun, 4 Mar 2007 20:07:33 +0000 (21:07 +0100)]
unify all audio format handlers
This changes the ogg vorbis audio format handler such that its read_chunk and
reposition_stream functions coincide with those of the other audio format
handlers.
Andre Noll [Sun, 4 Mar 2007 19:18:34 +0000 (20:18 +0100)]
unify aac and mp3 audio format handlers
This makes the mp3 audio format handler use a chunk table just like
m4a and ogg vorbis already do. Moreover, the aac and mp3 audio format
handlers now have identical read_chunk and reposition_stream handlers.
Next step is to tweak the ogg vorbis audio format handler so that
it also fits into this scheme. In the end, this allows to move
read_chunk() and reposition_stream() from the audio format handlers
one layer up to the virtual streaming system and to kill the function
pointers in struct audio_format.
The advantage of this change that it avoids duplicated/similar code, and
that new audio format handlers can added easier.
Andre Noll [Fri, 2 Mar 2007 09:14:31 +0000 (10:14 +0100)]
osx_write.c: Kill sleep() on buffer underruns
This was a leftover from the mpg123 patch for mac os which does
more harm than good. It could cause para_write/para_audiod to
block under certain circumstances.
Andre Noll [Thu, 1 Mar 2007 19:42:32 +0000 (20:42 +0100)]
filter.c: Register tasks in proper order
The order is important as it determines the order in which
the pre_select functions are going to be called by the scheduler.
In the previous code, the scheduler called stdin->pre_select _before_
filter_chain->pre_select() which gave rise to the following scenario
(note that there's no filter_chain->post_select()):
stdin->pre_select(): set stdin for reading
filter_chain->pre_select(): nothing to do
stdin->post_select(): read buffer
stdin->pre_select(): do _not_ set stdin for reading as stdin buffer is full
For para_filter, after the last there are no fds set which causes the
scheduler to use the default timeout of 1s. This had the effect that
decoding of aac files started only after a few seconds.
With the roles of interchanged tasks the scenario is as follows:
filter_chain->pre_select(): nothing to do
stdin->pre_select(): set stdin for reading
stdin->post_select(): read buffer
filter_chain->pre_select(): convert buffer
stdin->pre_select(): set stdin _again_ as stdin buffer is not full
Alternative fix might be to use filter_pre_select() also for post_select.
Andre Noll [Thu, 15 Feb 2007 17:42:24 +0000 (18:42 +0100)]
Makefile.in: only build and install man pages for supported binaries
This makes it possible again to install from the git repo even if not
all binaries can be build, e.g. Mac OS which always lacks para_fade
(reverts a858de7cf9437cf9a3569eb4bc297c5b0e768994).
Also, don't refuse to install and don't complain if $VARDIR
(/var/paraslash) can not be created, as this is non-fatal.
Andre Noll [Sun, 11 Feb 2007 22:45:52 +0000 (23:45 +0100)]
recv_common: fix memory leak and invalid free in error path
As split_args() returns pointers that point within the given string,
it is wrong to free the individual pieces. However, the array of
substrings must be freed. parse_receiver_args() got both of these
wrong :(
Andre Noll [Sun, 11 Feb 2007 21:37:49 +0000 (22:37 +0100)]
fix a memory leak in the RSA key handling
RSA keys must be freed by using openssl's RSA_free() rather than the
usual free(). This leak turns out to be more serious as the amount
of leaked memory increased by about 300 bytes every time para_server
reread the user list (i.e. the hup command was executed or para_server
received SIGHUP).
Andre Noll [Sun, 11 Feb 2007 20:57:49 +0000 (21:57 +0100)]
simplify lookup_user()
It's easier to just pass the name of the user to be looked up. This
fixes a memory leak btw. because u.name was strdupped and never freed.
That leak wasn't serious though as is happened in the child process.
Andre Noll [Mon, 5 Feb 2007 20:44:01 +0000 (21:44 +0100)]
audiod: kill handle_signal()
It was only called from singal_event_handler(), so move the code there.
Also, remove the redundant check for t->ret != -E_SIGNAL_CAUGHT which
can never happen.
Now, the status task no longer has an event handler as both its pre_select
and its post_select functions always succeed and the status task is supposed
to never terminate. Unlike the client task whose event handler now does all
the cleanup if the connection to para_server breaks down for whatever reason.
Andre Noll [Sun, 4 Feb 2007 17:55:12 +0000 (18:55 +0100)]
client: combine client_open() and client_parse_config()
Both users (client.c and audiod.c) called client_open() right
after calling client_parse_config(), so call client_open() from
client_parse_config() and make client_open() static.
While we're at it, rename client_open() to client_connect() as this
is what the function does. Also rename client_parse_config() to
client_open() and change audiod.c and client.c to call client_open()
instead of client_parse_config().
This patch fixes a segfault in para_client was it was run without
specifying a command. In this case, the private client data struct
was used by para_log after being freed -- Ouch. Fortunately, this
bug didn't affect para_audiod as it never calls these functions with
no command.
Another bug due to a typo in client_close() is also fixed. This code
needs closer investigation and lacks documentation btw.