Commit Graph

364 Commits

Author SHA1 Message Date
wm4 61b0163d58 af_lavrresample: minor cosmetics 2014-08-17 03:29:09 +02:00
wm4 defa0a20e0 af_lavcac3enc: lower minimum channel number to 3
It seems only stereo PCM should be passed through.
2014-08-12 23:45:41 +02:00
wm4 be792c085a af_lavcac3enc: change default bitrate to 640
No reason to use less.

Since the name "default" is misleading now, replace it with "auto"
(still recognize the old name).
2014-08-12 23:34:28 +02:00
wm4 d68a759fa4 Improve setting AVOptions
Use OPT_KEYVALUELIST() for all places where AVOptions are directly set
from mpv command line options. This allows escaping values, better
diagnostics (also no more "pal"), and somehow reduces code size.

Remove the old crappy option parser (av_opts.c).
2014-08-02 03:12:33 +02:00
wm4 967add9f0f audio: remove unused metadata field
This was used for replaygain at some point, until replaygain info was
passed through explicitly.
2014-07-21 19:29:58 +02:00
wm4 417ffa8b40 Remove some mp_msg calls with no trailing \n
The final goal is all mp_msg calls produce complete lines. We want this
because otherwise, race conditions could corrupt the terminal output,
and it's inconvenient for the client API too. This commit works towards
this goal. There's still code that has this not fixed yet, though.
2014-07-13 20:12:13 +02:00
Mohammad Alsaleh 8b06fc86f3 af_volume: fix calculations including replay-gain
rgain is not an additive value. It's a multiplier/gain.

Previous behaviour produced negative level values in some cases
(when rgain < 1.0) which caused volume to be louder when its value
was lowered.

CC: @mpv-player/stable

Signed-off-by: Mohammad Alsaleh <CE.Mohammad.AlSaleh@gmail.com>
Signed-off-by: wm4 <wm4@nowhere>
2014-06-28 15:56:16 +02:00
wm4 99f5fef0ea Add more const
While I'm not very fond of "const", it's important for declarations
(it decides whether a symbol is emitted in a read-only or read/write
section). Fix all these cases, so we have writeable global data only
when we really need.
2014-06-11 00:39:14 +02:00
wm4 6fcec75baa af_lavcac3enc: detach on any passthrough format, not just ac3 2014-04-16 00:30:34 +02:00
wm4 78128bddda Kill all tabs
I hate tabs.

This replaces all tabs in all source files with spaces. The only
exception is old-makefile. The replacement was made by running the
GNU coreutils "expand" command on every file. Since the replacement was
automatic, it's possible that some formatting was destroyed (but perhaps
only if it was assuming that the end of a tab does not correspond to
aligning the end to multiples of 8 spaces).
2014-04-13 18:03:01 +02:00
Kevin Mitchell 44f382cf98 af_volume: fix clang -Wsometimes-uninitialized 2014-04-13 18:03:01 +02:00
Kevin Mitchell 09528da0e2 af_lavfi: fix graph parse deprecation warning 2014-04-13 18:03:01 +02:00
Alessandro Ghedini 60e24fa842 demux: move metadata-based replaygain decoding out of af_volume 2014-04-04 18:35:30 +02:00
Alessandro Ghedini da984c3648 af_volume: use replaygain side data 2014-04-04 18:35:29 +02:00
Alessandro Ghedini e7977ec875 af: add replaygain_data field to af_stream and af_instance
Closes #664
2014-04-04 18:35:29 +02:00
wm4 cd2d4ebf3b af_volume: fix replaygain
This was accidentally broken in commit b72ba3f7. I somehow made the
wild assumption that replaygain adjusted the volume relative to 0%
instead of 100%.

The detach suboption was similarly broken.
2014-03-27 21:15:15 +01:00
wm4 113ec0aba1 af_lavcac3enc: use new AVFrame API 2014-03-16 13:19:29 +01:00
wm4 98cd2c4122 build: simplify libavfilter configure checks
This is all not needed anymore. In particular, remove all configure
switches except --enable-libavfilter.
2014-03-16 13:19:29 +01:00
wm4 64c01a814c Remove some more unneeded version checks
All of these check against things that happened before the latest
supported FFmpeg/Libav release.
2014-03-16 13:19:28 +01:00
wm4 c7e620df96 af_lavrresample: remove avresample_set_channel_mapping() fallbacks
This function is now always available.

Also remove includes of reorder_ch.h from some AOs (these are just old
relicts).
2014-03-16 13:19:28 +01:00
wm4 c473635f66 af_volume: don't print missing replaygain tags as error
There's no reason to. Audio files often lack them.
2014-03-14 22:37:46 +01:00
wm4 dc0f2308d1 af_volume: add detach option
Maybe this should be default. On the other hand, this filter does
something even if the volume is neutral: it clips samples against the
allowed range, should the decoder or a previous filter output garbage.
2014-03-14 22:37:46 +01:00
wm4 b72ba3f744 af_volume: separate softvol volume control from replaygain level
Currently, both replaygain adjustment and user volume control (if
softvol is enabled) share the same variable. Sharing the variable would
cause especially if --volume is used; then the replaygain volume would
always be overwritten.

Now both gain values are simple added right before doing filtering.
2014-03-14 22:37:46 +01:00
wm4 f8f69cdffe af_volume: remove double-negated suboption
You had to use "no-replaygain-noclip" to set this option. Rename it, so
that only one negation is needed.
2014-03-14 22:37:45 +01:00
Alessandro Ghedini d80dc885c6 af_volume: add support for replaygain pre-amp and clipping prevention 2014-03-13 14:36:20 +01:00
Alessandro Ghedini 3f0139e5db af_volume: add replaygain support
This adds the options replaygain-track and replaygain-album. If either is set,
the replaygain track or album gain will be automatically read from the track
metadata and the volume adjusted accordingly.

This only supports reading REPLAYGAIN_(TRACK|ALBUM)_GAIN tags. Other formats
like LAME's info header would probably require support from libav.
2014-03-13 14:36:20 +01:00
Alessandro Ghedini 04e14ec8f6 af: add metadata field to af_stream and af_instance
This allows to propagate metadata information to audio filters.

Closes #632
2014-03-13 14:36:20 +01:00
wm4 3bc78a84cd af_lavfi: beat it into working with Libav
The main incompatibility was that Libav didn't have av_opt_set_int_list.
But since that function is excessively ugly and idiotic (look how it
handles types), I'm not missing it much. Use an aformat filter instead
to handle the functionality that was indirectly provided by it. This is
similar to how vf_lavfi works.

The other incompatibility was channel handling. Libav consistently uses
channel layouts only, why ffmpeg still requires messing with channel
counts to some degree. Get rid of most channel count uses (and hope
channel layouts are "exact" enough). Only in one case FFmpeg fails with
a runtime check if we feed it AVFrames with channel count unset.

Another issue were AVFrame accessor functions. FFmpeg introduced these
for ABI compatibility with Libav. I refuse to use them, and it's not my
problem if FFmpeg doesn't manage to provide a stable ABI for fields
provided both by FFmpeg and Libav.
2014-03-13 00:29:17 +01:00
wm4 39b40e1ffb audio/filter: remove redundant log message prefixes
These are now appended automatically, so you'd get them twice before
this commit.
2014-01-24 21:30:15 +01:00
wm4 8b0cfdc81e audio: fix balance control
Balance controls as used by mixer.c was broken, because af_pan.c stopped
accepting its arguments. We have to allow 0 channels explicitly. Also,
fix null pointer access if the matrix parameter is not used.

Regression from commit 82983970.
2014-01-23 15:53:36 +01:00
11rcombs a0cc204528 af: fixed out-of-bounds accesses caused by NUM_FMT and co.
Signed-off-by: wm4 <wm4@nowhere>

This merges pull request #496. The problem was that at least the
initialization of the distance[] array accessed af_fmtstr_table[]
entries that were out of bounds. Small cosmetic changes applied to
the original pull request.
2014-01-19 21:15:54 +01:00
wm4 232b8de095 af_export: require filename argument
Since mp_find_user_config_file() is going to get a context argument,
which would be annoying to do in the audio chain (actually I'm just
lazy).
2013-12-21 21:43:17 +01:00
wm4 d8d42b44fc m_option, m_config: mp_msg conversions
Always pass around mp_log contexts in the option parser code. This of
course affects all users of this API as well.

In stream.c, pass a mp_null_log, because we can't do it properly yet.
This will be fixed later.
2013-12-21 21:05:02 +01:00
wm4 60c06fec1e audio/fmt-conversion.c: remove unknown audio format messages
Same deal as with video/fmt-conversion.c.
2013-12-21 20:50:12 +01:00
wm4 1974c9b49d audio: mp_msg conversions 2013-12-21 20:50:12 +01:00
wm4 2c08bf1bd7 Reduce recursive config.h inclusions in headers
In my opinion, config.h inclusions should be kept to a minimum. MPlayer
code really liked including config.h everywhere, though, even in often
used header files. Try to reduce this.
2013-12-18 17:12:21 +01:00
wm4 4ed83fe2e5 Remove the _ macro
This was a gettext-style macro to mark strings that should be
translated.
2013-12-18 17:12:07 +01:00
wm4 0112143fda Split mpvcore/ into common/, misc/, bstr/ 2013-12-17 02:39:45 +01:00
wm4 eb15151705 Move options/config related files from mpvcore/ to options/
Since m_option.h and options.h are extremely often included, a lot of
files have to be changed.

Moving path.c/h to options/ is a bit questionable, but since this is
mainly about access to config files (which are also handled in
options/), it's probably ok.
2013-12-17 02:07:57 +01:00
wm4 7dc7b900c6 Replace mp_tmsg, mp_dbg -> mp_msg, remove mp_gtext(), remove set_osd_tmsg
The tmsg stuff was for the internal gettext() based translation system,
which nobody ever attempted to use and thus was removed. mp_gtext() and
set_osd_tmsg() were also for this.

mp_dbg was once enabled in debug mode only, but since we have log level
for enabling debug messages, it seems utterly useless.
2013-12-16 20:41:08 +01:00
wm4 84cfe0d8b2 audio: flush remaining data from the filter chain on EOF
This can be reproduced with:

   mpv short.wav -af 'lavfi="aecho=0.8:0.9:5000|6800:0.3|0.25"'

An audio file that is just 1-2 seconds long should play for 8-9 seconds,
which audible echo towards the end.

The code assumes that when playing with AF_FILTER_FLAG_EOF, the filter
will either produce output, or has all remaining data flushed. I'm not
really sure whether this really works if there are multiple filters with
EOF handling in the chain. To handle it correctly, af_lavfi should retry
filtering if 1. EOF flag is set, 2. there were input samples, and 3. no
output samples were produced. But currently it seems to work well enough
anyway.
2013-12-05 00:31:55 +01:00
wm4 ed024aadb6 audio/filter: change filter callback signature
The new signature is actually closer to how it actually works, and
someone who is not familiar to the API and how it works might make fewer
fatal mistakes with the new signature than the old one. Pretty weird.

Do this to sneak in a flags parameter, which will later be used to flush
remaining data of at least vf_lavfi.
2013-12-05 00:01:46 +01:00
wm4 193930ac3b af: remove af->setup field
Used to be used by filters that didn't use the option parser.
2013-12-04 23:13:46 +01:00
wm4 09bd19e59e af: remove legacy option parsing hacks 2013-12-04 23:13:46 +01:00
wm4 82983970b3 af_pan: change options, use option parser
Similar to af_channels etc...
2013-12-04 23:13:46 +01:00
wm4 adc843f984 af_ladspa: change options, use option parser 2013-12-04 23:13:46 +01:00
wm4 bcd8afc2ad af_delay: change option parsing, fix bugs, use option parser
Similar situation to af_channels.
2013-12-04 23:13:46 +01:00
wm4 71b6115d66 af_channels: use "unknown" channel layouts
This will make af_channels output a channel layout that is compatible
with any destination layout. Not sure if that's a good idea though,
since the way the AO choses a layout is perhaps less predictable. On the
other hand, using the old MPlayer standard layouts doesn't make much
sense either. We'll see whether this improves or breaks someone's use
case.
2013-12-04 23:13:46 +01:00
wm4 4f581a781b af_channels: change options, fix bugs, use option parser
Apparently this stopped working after some planar changes (broken format
negotiation). Radically change option parsing in an incompatible way.
Suggest alternatives to this filter, since it barely has any importance
anymore.
2013-12-04 23:13:42 +01:00
wm4 ad8e3d8c30 af_sweep: use option parser 2013-12-04 23:12:52 +01:00
wm4 d74419e6f0 af_surround: use option parser 2013-12-04 23:12:52 +01:00
wm4 54b8a7150a af_sub: use option parser 2013-12-04 23:12:52 +01:00
wm4 ee7ff874ba af_sinesuppress: use option parser 2013-12-04 23:12:52 +01:00
wm4 98905f668f af_hrtf: use option parser 2013-12-04 23:12:52 +01:00
wm4 aaccf9d5e9 af_extrastereo: use option parser 2013-12-04 23:12:51 +01:00
wm4 2c23fae344 af_export: use option parser
Probably requires the user to quote the shared buffer filename.
2013-12-04 23:12:51 +01:00
wm4 5b7eb713a1 af_equalizer: use option parser 2013-12-04 23:12:51 +01:00
wm4 349376aa5c af_drc: use option parser 2013-12-04 23:12:51 +01:00
wm4 0205f3d214 af_center: use option parser 2013-12-04 23:12:51 +01:00
wm4 a27114bb4b af: returning NULL on filtering means error
This code used to be ok, until the assert() was added. Simplify the loop
statement, since the other NULL check for data doesn't make sense
anymore.
2013-12-04 23:12:51 +01:00
wm4 b18f02d1ad options: add options that set defaults for af/vf/ao/vo
There are some use cases for this. For example, you can use it to set
defaults of automatically inserted filters (like af_lavrresample). It's
also useful if you have a non-trivial VO configuration, and want to use
--vo to quickly change between the drivers without repeating the whole
configuration in the --vo argument.
2013-12-01 00:12:10 +01:00
wm4 95cfe58e3d Use O_CLOEXEC when creating FDs
This is needed so that new processes (created with fork+exec) don't
inherit open files, which can be important for a number of reasons.

Since O_CLOEXEC is relatively new (POSIX.1-2008, before that Linux
specific), we #define it to 0 in io.h to prevent compilation errors on
older/crappy systems. At least this is the plan.

input.c creates a pipe. For that, add a mp_set_cloexec() function (which
is based on Weston's code in vo_wayland.c, but more correct). We could
use pipe2() instead, but that is Linux specific. Technically, we have a
race condition, but it won't matter.
2013-11-30 22:40:51 +01:00
wm4 6e2ac4d40a af_lavi: actually free the filter graph on uninit
This was a memory leak.

Also remove the AF_CONTROL_COMMAND_LINE code, which was inactive. (It's
never called if the new option parser is used.)
2013-11-27 21:14:39 +01:00
wm4 85f6349c78 audio/filter: rename af_tools.c to tools.c
This always bothered me.
2013-11-18 18:48:00 +01:00
wm4 d5bc4ee798 audio: drop buffered filter data when seeking
This could lead to (barely) audible artifacts with --af=scaletempo and
modified playback speed.
2013-11-18 14:21:01 +01:00
wm4 5594718b6b audio/filter: remove unneeded AF_CONTROLs, convert to enum
The AF control commands used an elaborate and unnecessary organization
for the command constants. Get rid of all that and convert the
definitions to a simple enum. Also remove the control commands that
were not really needed, because they were not used outside of the
filters that implemented them.
2013-11-18 14:21:01 +01:00
wm4 93852b08f3 af: cleanup documentation comments
And by "cleanup", I mean "remove". Actually, only remove the parts that
are redundant and doxygen noise. Move useful parts to the comment above
the function's implementation in the C source file.
2013-11-18 14:21:01 +01:00
wm4 8f1151a00e audio: fix mid-stream audio reconfiguration
Commit 22b3f522 not only redid major aspects of audio decoding, but also
attempted to fix audio format change handling. Before that commit, data
that was already decoded but not yet filtered was thrown away on a
format change. After that commit, data was supposed to finish playing
before rebuilding filters and so on.

It was still buggy, though: the decoder buffer was initialized to the
new format too early, triggering an assertion failure. Move the reinit
call below filtering to fix this.

ad_mpg123.c needs to be adjusted so that it doesn't decode new data
before the format change is actually executed.

Add some more assertions to af_play() (audio filtering) to make sure
input data and configured format don't mismatch. This will also catch
filters which don't set the format on their output data correctly.

Regression due to planar_audio branch.
2013-11-18 14:20:59 +01:00
wm4 2556f45f2e af_lavrresample: set cutoff as double, not int
Regression introduced with commit a89549e8.
2013-11-17 16:22:35 +01:00
wm4 514c454770 audio: drop "_NE"/"ne" suffix from audio formats
You get the native format by not appending any suffix to the format.

This change includes user-facing names, e.g. for the --format option.
2013-11-15 21:25:05 +01:00
wm4 7f7e9a9fff af_lavcac3enc: use option parser
This changes option parsing as well as filter defaults slightly. The
default is now to encode to spdif (this is way more useful than writing
raw AC3 - what was this even useful for, other than writing broken ac3
-in-wav files?). The bitrate parameter is now always in kbps.
2013-11-15 00:24:03 +01:00
wm4 6f557aef42 af_lavcac3enc: use planar formats
Remove the awkward planarization. It had to be done because the AC3
encoder requires planar formats, but now we support them natively.

Try to simplify buffer management with mp_audio_buffer.

Improve checking for buffer overflows and out of bound writes. In
theory, these shouldn't happen due to AC3 fixed frame sizes, but being
paranoid is better.
2013-11-12 23:34:49 +01:00
wm4 a72072c605 af_lavcac3enc: simplify format negotiation
The format negotiation is the same, except don't confusingly copy the
input format into af->data, just to overwrite it later. af->data should
alwass contain the output format, and the existing code was just a very
misguided use of the af_test_output() helper function.

Just set af->data to the output format immediately, and modify the input
format properly.

Also, if format negotiation fails (and needs another iteration), don't
initialize the libavcodec encoder.
2013-11-12 23:34:37 +01:00
wm4 824e6550f8 audio/filter: fix mul/delay scale and values
Before this commit, the af_instance->mul/delay values were in bytes.
Using bytes is confusing for non-interleaved audio, so switch mul to
samples, and delay to seconds. For delay, seconds are more intuitive
than bytes or samples, because it's used for the latency calculation.
We also might want to replace the delay mechanism with real PTS
tracking inside the filter chain some time in the future, and PTS
will also require time-adjustments to be done in seconds.

For most filters, we just remove the redundant mul=1 initialization.
(Setting this used to be required, but not anymore.)
2013-11-12 23:34:35 +01:00
wm4 d115fb3b0e af: don't require filters to allocate af_instance->data, redo buffers
Allocate af_instance->data in generic code before filter initialization.
Every filter needs af->data (since it contains the output
configuration), so there's no reason why every filter should allocate
and free it.

Remove RESIZE_LOCAL_BUFFER(), and replace it with mp_audio_realloc_min().
Interestingly, most code becomes simpler, because the new function takes
the size in samples, and not in bytes. There are larger change in
af_scaletempo.c and af_lavcac3enc.c, because these had copied and
modified versions of the RESIZE_LOCAL_BUFFER macro/function.
2013-11-12 23:27:03 +01:00
wm4 e763d528e2 af_lavfi: add support for non-interleaved audio 2013-11-12 23:16:31 +01:00
wm4 4f31d56eb1 af_volume: add support for non-interleaved audio 2013-11-12 23:16:31 +01:00
wm4 45d1510e4e af_lavrresample: add support for non-interleaved audio 2013-11-12 23:16:31 +01:00
wm4 d2e7467eb2 audio/filter: prepare filter chain for non-interleaved audio
Based on earlier work by Stefano Pigozzi.

There are 2 changes:

1. Instead of mp_audio.audio, mp_audio.planes[0] must be used.

2. mp_audio.len used to contain the size of the audio in bytes. Now
   mp_audio.samples must be used. (Where 1 sample is the smallest unit
   of audio that covers all channels.)

Also, some filters need changes to reject non-interleaved formats
properly.

Nothing uses the non-interleaved features yet, but this is needed so
that things don't just break when doing so.
2013-11-12 23:16:31 +01:00
wm4 6ec1f31765 af: don't skip filtering if there's no more audio
My main problem with this is that the output format will be incorrect.
(This doesn't matter right, because there are no samples output.)

This assumes all audio filters can deal with len==0 passed in for
filtering (though I wouldn't see why not).

A filter can still signal an error by returning NULL.

af_lavrresample has to be fixed, since resampling 0 samples makes
libavresample fail and return a negative error code. (Even though it's
not documented to return an error code!)
2013-11-10 22:49:39 +01:00
wm4 d6abfcd578 af_volume: use only one volume setting for all channels
In theory, af_volume could use separate volume levels for each channel.
But this was never used anywhere.

MPlayer implemented something similar before (svn r36498), but kept the
old path for some reason.
2013-11-09 23:32:58 +01:00
wm4 0ff863c179 af_scaletempo: uncrustify
Also do some cosmetic changes, like merging definition and
initialization of local variables.

Remove an annoying debug mp_msg() from af_open(). It just printed the
command line parameters; if this is really needed, it could be added
to af.c instead (similar as to what vf.c does).
2013-11-09 23:32:58 +01:00
wm4 142d5c985e af_lavrresample: reconfigure libavresample only on successful init
If filter initialization fails anyway, we don't need to reconfigure
libavresample.
2013-11-09 23:32:58 +01:00
wm4 a89549e8db af_lavrresample: move libavresample setup to separate function
Helps with readability. Also remove the ctx_opt_set_* helper macros and
use av_opt_set_* directly (I think these macros were used because the
lines ended up too long, but this commit removes two indentation levels,
giving more space).
2013-11-09 23:32:57 +01:00
wm4 5735b684de af_convert24: fix complicated and incorrect format negotiation
The conversion works for native endian only. The correct check lists
supported format combination explicitly, but is also much simpler.
2013-11-09 23:32:52 +01:00
wm4 31f409a3c5 af_surround: fix format negotiation
This did strange things; perhaps caused by the channel layout changes.
2013-11-09 23:32:52 +01:00
wm4 65571dd0d5 af: allow filters to return AF_OK, even if format doesn't match
This should allow to make format negotiation much simpler, since it
takes the responsibility to compare actual input and accepted input
formats from the filters. It's also backwards compatible. Filters which
have expensive initialization still can use the old method.
2013-11-09 23:32:52 +01:00
wm4 370c5cc834 af: always remove auto-inserted filters, improve error message
It's probably better if all auto-inserted filters are removed when doing
an af_add operation. If they're really needed, they will be
automatically re-added.

Fix the error message. It used to be for an actual internal error, but
now it happens when format negotiation fails, e.g. when trying to use
spdif and real audio filters.
2013-11-09 01:27:03 +01:00
wm4 1889c62b85 af: remove a pointless macro
The code should be equivalent; a compatibility macro definition is left.
(It should be mass-replaced later.)
2013-11-07 22:15:44 +01:00
wm4 91626b1c06 audio: replace af_fmt2str_short -> af_fmt_to_str
Also, remove all af_fmt2str usages.
2013-11-07 22:12:36 +01:00
Stefano Pigozzi 37388ebb0e configure: uniform the defines to #define HAVE_xxx (0|1)
The configure followed 5 different convetions of defines because the next guy
always wanted to introduce a new better way to uniform it[1]. For an
hypothetic feature 'hurr' you could have had:

  * #define HAVE_HURR 1   / #undef HAVE_DURR
  * #define HAVE_HURR     / #undef HAVE_DURR
  * #define CONFIG_HURR 1 / #undef CONFIG_DURR
  * #define HAVE_HURR 1   / #define HAVE_DURR 0
  * #define CONFIG_HURR 1 / #define CONFIG_DURR 0

All is now uniform and uses:
  * #define HAVE_HURR 1
  * #define HAVE_DURR 0

We like definining to 0 as opposed to `undef` bcause it can help spot typos
and is very helpful when doing big reorganizations in the code.

[1]: http://xkcd.com/927/ related
2013-11-03 21:59:54 +01:00
wm4 7abc1bef40 af: replace macros with too generic names
Defining names like min, max etc. in an often used header is not really
a good idea.

Somewhat similar to MPlayer svn commit 36491, but don't use libavutil,
because that typically causes us sorrow.
2013-10-26 15:05:59 +02:00
wm4 6ac5474790 af_volume: some more cosmetics 2013-10-26 14:04:38 +02:00
wm4 13fcb1925a af_volume: switch to new option parsing 2013-10-26 13:36:46 +02:00
wm4 f2660c0a29 af_volume: uncrustify
Also, use more C99 and remove "register" keywords.
2013-10-26 13:36:46 +02:00
wm4 b890093c44 af_volume: don't change volume if nothing is to be changed
On the float path. Note that this skips clipping, but we expect that
everything on the audio-path is pre-clipped anyway.
2013-10-26 13:36:34 +02:00
wm4 3b5657f0c1 af_volume: remove unused features
Roughly follows MPlayer svn commits 36492 and 36493. We also remove
the volume peak reporting. (There are much better libavfilter filters
for this, I think.)
2013-10-26 13:36:34 +02:00
wm4 b08617ff71 audio/filter: remove useless af_info fields
Drop the author and comment fields. They were completely unused - not
even printed in verbose mode, just dead weight.

Also use designated initializers and drop redundant flags.
2013-10-23 19:30:01 +02:00
wm4 a46453347f af_force: set format early for better debug output
Set the input/output format in filter init. This doesn't change anything
functionally, but it makes the forced format show up in the filter chain
init verbose output (which sometimes prints the filter chain before all
filters have been configured).
2013-10-23 19:30:01 +02:00
wm4 247c89d6ba af_force: minor simplifications 2013-10-23 19:30:01 +02:00
wm4 943c785619 audio/filter: rename af_force.c to af_format.c
The filter itself was already renamed earlier - but rename the file too.
2013-10-23 19:29:30 +02:00
wm4 e60b8f181d audio/filter: split af_format into separate filters, rename af_force
af_format is the old audio conversion filter. It could do all possible
conversions supported by the audio chain. However, ever since the
addition of af_lavrresample, most conversions are done by
libav/swresample, and af_format is used as fallback.

Separate out the fallback cases and remove af_format. af_convert24 does
24 bit <-> 32 bit conversions, while af_convertsignendian does sign and
endian conversions. Maybe the way the conversions are split sounds a bit
odd. But the former changes the size of the audio data, while the latter
is fully in-place, so there's at least different buffer management.

This requires a quite complicated algorithm to make sure all these
"partial" conversion filters can actually get from one format to
another. E.g. s24le->s32be always requires convertsignendian and
convert24, but af.c has no idea what the intermediate format should
be. So I added a graph search (trying every possible format and
filter) to determine required format and filter. When I wrote this,
it seemed this was still better than messing everything into
af_lavrresample, but maybe this is overkill and I'll change my
opinion. For now, it seems nice to get rid of af_format though.

The AC3->IEC61937 conversion isn't supported anymore, but I don't think
this is needed anywhere. Most AOs test all formats explicitly, or use
the AF_FORMAT_IS_IEC61937() macro (which includes AC3).

One positive consequence of this change is that conversions always
include dithering (done by libav/swresample), instead of possibly going
through af_format, which doesn't do anything fancy.

Rename af_force to af_format. It's essentially compatible with command
line uses of af_format. We retain a compatibility alias for af_force.
2013-10-23 10:04:12 +02:00
wm4 c01feaaa79 af_lavrresample: actually free resampler
Fixes #304.
2013-10-19 13:19:35 +02:00
wm4 542086dd45 af: merge af_reinit() and fix_output_format()
Calling them separately doesn't really make sense, and all existing
calls to them usually combined them. One subtitle difference was that
af_init() didn't wipe the filter chain if initialization of the chain
itself failed, but that didn't really make sense anyway.

Also remove af_init() from the code for setting balance in mixer.c. The
mixer should be in the initialized state only if audio is fully
initialized, so the af_init() call made no sense.

Note that the filter "editing" code in command.c doesn't really do a
nice job of handling errors in case recreating an _old_ (known to work)
filter chain unexpectedly fails, and this obscure/rare case might be
differently handled after this change.
2013-09-20 13:43:00 +02:00
wm4 4ba52a9e82 mixer, af_volume: use linear values instead of dB
Softvol always used a linear multiplier for volume control. This was
converted to dB, and then back to linear in af_volume. Remove this non-
sense. We still try to keep the command line argument to af_volume in
dB, though.
2013-09-19 14:31:55 +02:00
wm4 69e272dad7 af_export: fix compilation warning
Blargh.
2013-09-19 14:30:53 +02:00
wm4 5249cccfcf Config path functions can return NULL
It's quite unlikely, but functions like mp_find_user_config_file() can
return NULL, e.g. if $HOME is unset.

Fix all the code that didn't check for this correctly yet.
2013-09-18 19:56:15 +02:00
wm4 53b5227270 audio: make internal audio format 0 an invalid format
Having to use -1 for that is generally quite annoying.

Audio formats are created from bitmasks, and it can't be excluded that
0 is not a valid format. Fix this by adjusting AF_FORMAT_I so that it
is never 0. Along with AF_FORMAT_F and the special formats, all valid
formats are covered and guaranteed to be non-0.

It's possible that this commit will cause some regressions, as the
check for invalid audio formats changes a bit.
2013-08-26 10:09:41 +02:00
Stefano Pigozzi 406241005e core: move contents to mpvcore (2/2)
Followup commit. Fixes all the files references.
2013-08-06 22:52:31 +02:00
wm4 ee2e3b3374 core: change speed option/property to double
The --speed option and the speed property used float. Change them to
double.

Change the commands that manipulate the property (speed_mult/add) to
double as well. Since the cycle command shares code with the add
command, we change that as well.

The reason for this change is that this allows better control over
speed, such as stepping by semitones. Using floats is also just plain
unnecessary.
2013-08-05 00:00:26 +02:00
wm4 e83cbde1a4 Fix some -Wshadow warnings
In general, this warning can hint to actual bugs. We don't enable it
yet, because it would conflict with some unmerged code, and we should
check with clang too (this commit was done by testing with gcc).
2013-07-23 00:45:23 +02:00
wm4 78ebb3c6fa options: make legacy hacks for AFs/VFs more explicit
This means that AOs/VOs with no options set do not take the legacy
option parsing path, but instead report that they have no options.
2013-07-22 23:07:23 +02:00
wm4 c729df3d10 af_bs2b: use new option API 2013-07-22 15:11:04 +02:00
wm4 74146a855c af_lavfi: switch to new option API
This makes it actually possible to use the filter with more complicated
filter graphs (such as graphs containing the "," character).
2013-07-22 15:11:04 +02:00
wm4 465b162d13 af_scaletempo: use new option API 2013-07-22 15:11:04 +02:00
wm4 7c2bf06615 af_lavrresample: switch to new option API
Also add a "o" suboption, which should allow fine control over
libavresample.
2013-07-22 15:11:04 +02:00
wm4 1189f64dd1 af_force: use new option API 2013-07-22 15:11:04 +02:00
wm4 3b8dfddb4c audio/filter: use new option API
Make the VF/VO/AO option parser available to audio filters. No audio
filter uses this yet, but it's still a quite intrusive change.

In particular, the commands for manipulating filters at runtime
completely change. We delete the old code, and use the same
infrastructure as for video filters. (This forces complete
reinitialization of the filter chain, which hopefully isn't a problem
for any use cases. The old code forced reinitialization too, but it
could potentially allow a filter to cache things; e.g. consider loaded
ladspa plugins and such.)
2013-07-22 15:11:03 +02:00
wm4 221ef23d0d af_force: add option that causes filter to fail at initialization
This is useful for debugging.
2013-07-22 15:06:43 +02:00
wm4 0c9b0ba40d af: fix recovery code for filter insertion (changing volume with spdif crash)
This code is supposed to run if dynamic filter insertion (such as when
inserting a volume filter in mixer.c) fails. Then it removes all filters
and recreates the default list of filters. But the code just blew up and
entered an endless loop, because it removed even the sentinel in/out
filters. This could happen when trying to use softvol controls while
using spdif, but also other situations. Fix it by calling the correct
code.

Also remove these obnoxious yoda-conditions.
2013-07-22 15:06:07 +02:00
wm4 60a7f3b8bc af_lavfi: add libavfilter bridge
Mostly copied from vf_lavfi. The parts that could be shared are minor,
because most code is about setting up audio and video, which are too
different.

This won't work with Libav. I used ffplay.c as guide, and noticed too
late that their setup methods are incompatible with Libav's. Trying to
make it work with both would be too much effort. The configure test for
av_opt_set_int_list() should disable af_lavfi gracefully when compiling
with Libav.

Due to option parser chaos, you currently can't have a "," as part of
the filter graph string - not even with quoting or escaping. This will
probably be fixed later.

The audio filter chain is not PTS aware. So we have to do some hacks
to make up a fake PTS, and we have to map the output PTS back to the
filter chain's method of tracking PTS changes and buffering, by
adjusting af->delay.
2013-05-23 17:44:06 +02:00
wm4 636e1edd9e af_lavrresample: fix inverted condition
This was added with the previous commit. It likely broke some obscure
special-cases, which (hopefully) do not happen with normal playback.
2013-05-13 18:05:37 +02:00
wm4 279f4b59dc audio: fix compilation with older libavresample versions
The libavresample version of the current Libav stable release lacks the
avresample_set_channel_mapping() function. (FFmpeg's libswresample seems
to be fine, because they added swr_set_channel_mapping() first.)

Add a cheap/slow workaround to do channel reordering on our own. We
don't use the recently removed MPlayer code (see commit 586b75a),
because that is not generic enough.

The functionality should be the same as with full-featured
libavresample, and any differences are bugs. It's probably slower,
though.
2013-05-13 00:39:07 +02:00
wm4 48f9431151 af: improve filter chain setup retry limit
af_reinit() is responsible for inserting automatic conversion filters
for channel remixing, format conversion, and resampling. We don't
require that a single filter can do all these (even though
af_lavrresample does nearly all of this, sometimes af_format has to be
used instead for format conversions). This makes setting up the chain
more complicated, and a way is needed to prevent endless appending of
conversion filters if a conversion is not possible.

Until now, this used a stupidly simple yet robust static retry limit to
detect failure. This is perfectly fine, and the limit (20) was good
enough to handle about ~5 filters. But with more filters, and if each
filter requires 3 additional conversion filters, this would fail. So
raise the limit to 4 retries per filter. This is still stupidly simple
and robust, but won't arbitrarily fail if the filter count is too large.
2013-05-12 21:45:05 +02:00
wm4 5c0c141a55 af_lavrresample: avoid channel reordering with unknown layouts
If one of the input or output is an unknown layout, but the other is
known, it can still happen that channels are remixed randomly. Avoid
this by forcing default layouts in this case. (Doesn't work if the
channel counts are different.)
2013-05-12 21:24:56 +02:00
wm4 d9582ad0a4 audio/filters: add af_force
Its main purpose is for testing in case channel layout stuff breaks, in
particular in connection with old audio filters.
2013-05-12 21:24:56 +02:00
eng 74487b8430 af_ladspa: code cleanup
Cleanup based on results from cppcheck-1.59
Reduce the scope of several variables
Fix memory leak
2013-05-12 21:24:56 +02:00
wm4 3b1956608d audio: print channel map additionally to channel count on terminal 2013-05-12 21:24:56 +02:00
wm4 9afad5180c af: print filter chain info on error
The filter chain was only visible with -v. Always print it if the filter
chain could not be configured.
2013-05-12 21:24:56 +02:00
wm4 586b75ad08 reorder_ch: remove old channel reorder functions
This is done in af_lavrresample now, and as part of format negotiation.

Also remove the remaining reorder_channel calls. They were redundant
and did nothing.
2013-05-12 21:24:55 +02:00
wm4 408b7eecee audio: let libavresample do channel reordering 2013-05-12 21:24:55 +02:00
wm4 b20026c29b af_lavrresample: context is always allocated here 2013-05-12 21:24:55 +02:00
wm4 37325f2796 af_pan: set unknown channel layout for output 2013-05-12 21:24:54 +02:00
wm4 7971bb87cb af: use mp_chmap for mp_audio, include channel map in format negotiation
Now af_lavrresample pretends to reorder the channels, although it
doesn't yet, and nothing sets non-standard layouts either.
2013-05-12 21:24:54 +02:00
wm4 f7a427676c audio: add some setters for mp_audio, and require filters to use them
mp_audio has some redundant fields. Setters like mp_audio_set_format()
initialize these properly.

Also move the mp_audio struct to a the file audio.c.

We can remove a mysterious line of code from af.c:

    in.format |= af_bits2fmt(in.bps * 8);

I'm not sure if this was ever actually needed, or if it was some kind of
"make it work" quick-fix that works against the way things were supposed
to work. All filters etc. now set the format correctly, so if there ever
was a need for this code, it's definitely gone.
2013-05-12 21:24:54 +02:00
wm4 0042735d7a audio: add channel map API
Unused, will be used in the following commits.

Let chmap.h define the number of maximum channels, because that is most
convenient.
2013-05-12 21:24:54 +02:00
wm4 1e37d35970 audio/filter: remove unused AF_CONTROLs
Was unused, has never been used.
2013-05-12 20:55:50 +02:00
wm4 0d939a6847 af: fix negotiation endless loop
Yeah... ok.

Can be reproduced by having AF_CONTROL_CHANNELS not really set the
correct channel map.
2013-04-13 04:21:29 +02:00
wm4 fd6302631a af: streamline format negotiation
Add dummy input and output filters to remove special cases in the format
negotiation code (af_fix_format_conversion() etc.). The output of the
filter chain is now negotiated in exactly the same way as normal
filters.

Negotiate setting the sample rate in the same way as other audio
parameters. As a side effect, the resampler is inserted at the start of
the filter chain instead of the end, but that shouldn't matter much,
especially since conversion and channel mixing are conflated into the
same filter (due to libavresample's API).
2013-04-13 04:21:29 +02:00
wm4 ff6342a311 af_lavrresample: add no-detach suboption
Normally, af_lavrresample detaches itself immediately if the input and
output audio parameters are the same. no-detach prevents this.
2013-04-13 04:21:29 +02:00
wm4 abd5e8a2e7 options: remove --af-adv
Anything this option did has been removed in the preceding 3 commits.
Note that even though these options sounded like a good idea (like
setting accuracy vs. speed tradeoffs), they were not really properly
implemented.
2013-04-13 04:21:29 +02:00
wm4 08eecf070e af: remove accuracy option
All this option did was deciding whether the resample filter was to be
insert at the beginning or end of the filter chain. Always do what the
option set for accuracy did. I doubt it makes much of a difference.
libavresample does most things in just one go anyway, so it won't
matter.
2013-04-13 04:21:28 +02:00
wm4 f9a6b1c3f8 af: remove force option
Dangerous and misleading. If it turns out that this is actually needed
to make certain setups work right, it should be added back in a better
way (in a way it doesn't cause random crashes).
2013-04-13 04:21:28 +02:00
wm4 bc268b313e audio: remove float processing option
The only thing this option did was changing the behavior of af_volume.
The option decided what sample format af_volume would use, but only if
the sample format was not already float. If the option was set, it would
default to float, otherwise to S16.

Remove use of the option and all associated code, and make af_volume
always use float (unless a af_volume specific sub-option is set).

Silence maximum value tracking. This message is printed when the filter
is destroyed, and it's slightly annoying. Was enabled due to enabling
float by default.
2013-04-13 04:21:28 +02:00
wm4 41aefce730 audio: switch to libavcodec channel order, use libavresample for mixing
Switch the internal channel order to libavcodec's. If the channel number
mismatches at some point, use libavresample for up- or downmixing.
Remove the old af_pan automatic downmixing.

The libavcodec channel order should be equivalent to WAVEFORMATEX order,
at least nowadays. reorder_ch.h assumes that WAVEFORMATEX and libavcodec
might be different, but all defined channels have the same mappings.

Remove the downmixing with af_pan as well as the channel conversion with
af_channels from af.c, and prefer af_lavrresample for this. The
automatic downmixing behavior should be the same as before (if the
--channels option is set to 2, which is the default, the audio output
is forced to 2 channels, and libavresample does all downmixing).

Note that mpv still can't do channel layouts. It will pick the default
channel layout according to the channel count. This will be fixed later
by passing down the channel layout as well.

af_hrtf depends on the order of the input channels, so reorder to ALSA
(for which this code was written). This is better than changing the
filter code, which is more risky.

ao_pulse can accept waveext order directly, so set that as channel
mapping.
2013-04-13 04:21:28 +02:00
wm4 e4da671820 af: simplification
If format negotiation fails, and additional filters are inserted to fix
this, don't try to reinitialize the filter immediately. Instead, correct
the audio format, and let the caller retry.

Add a retry counter to af_reinit() to ensure that misbehaving filters
can't put the format negotiation into an endless loop.
2013-04-13 04:21:28 +02:00
wm4 8a53b3f523 af: factor channel filter insertion
Do this just like it has been done for the format filter.
2013-04-13 04:21:27 +02:00
wm4 c866583e1e af: use af_lavrresample for format conversions, if possible
Refactor to remove the duplicated format filter insertion code. Allow
other format converting filters to be inserted on format mismatches.
af_info.test_conversion checks whether conversion between two formats
would work with the given filter; do this to avoid having to insert
multiple conversion filters at once and such things. (Although this
isn't ideal: what if we want to avoid af_format for some conversions?
What if we want to split af_format in endian-swapping filters etc.?)

Prefer af_lavrresample for conversions that it supports natively,
otherwise let af_format handle the full conversion.
2013-04-13 04:21:27 +02:00
wm4 5a958921a7 af: remove automatically inserted filters on full reinit
Make sure automatically inserted filters are removed on full reinit
(they are re-added later if they are really needed). Automatically
inserted filters were never explicitly removed, instead, it was
expected that redundant conversion filters detach themselves. This
didn't work if there were several chained format conversion filters,
e.g. s16le->floatle->s16le, which could result from repeated filter
insertion and removal. (format filters detach only if input format and
output format are the same.)

Further, the dummy filter (which exists only because af.c can't handle
an empty filter chain for some reason) could introduce bad conversions
due to how the format negotiation works. Change the code so that the
dummy filter never takes part on format negotiation. (It would be better
to fix format negotiation, but that would be much more complicated and
would involving fixing all filters.)

Simplify af_reinit() and remove the start audio filter parameter. This
means format negotiation and filter initialization is run more often,
but should be harmless.
2013-04-13 04:21:27 +02:00
wm4 0a136ece5a af_lavrresample: allow other ffmpeg sample formats for input/output
The format was locked to s16. Extend it to accept all other ffmpeg
sample formats, and even allow different in- and output formats. The
generic filter code will still insert af_format on format mismatches,
though.
2013-04-13 04:21:27 +02:00
wm4 fc24ab9298 audio/filter: replace pointless memcpys with assignments
The change in af_scaletempo actually fixes a memory leak. af->data
contained a pointer to an allocated buffer, which was overwritten
during format negotiation. Set the format explicitly instead.
2013-04-13 04:21:27 +02:00
wm4 8bf759e888 af: uncrustify 2013-04-13 04:21:27 +02:00
Stefano Pigozzi 048ceef655 af_lavrresample: add new resampling filter to replace the old ones
Remove `af_resample` and `af_lavcresample`. The former is a mess while the
latter uses an API that was long deprecated in libavcodec and is now removed.

`af_lavrresample` rougly has the same features and structure of
`af_lavcresample`.

libswresample fallback by wm4.
2013-03-13 23:51:30 +01:00
wm4 fd8750c25b af_lavcac3enc: switch to avcodec_encode_audio2()
avcodec_encode_audio() was deprecated, and was finally removed from
Libav and FFmpeg git.

This appears to work. I get heavy A/V desync with -ao alsa and -ao pcm,
but this was already so before this change.
2013-03-13 23:51:29 +01:00
Martin 1f7decc1a0 Rename af_volnorm to af_drc
The previous name of this filter was misleading, because it doesn’t actually
normalize volume levels. What it does is closer to performing low-quality
dynamic range compression, hence it is now called af_drc.
2013-02-12 09:53:33 +01:00
wm4 20c9dfa616 Replace strsep() uses
This function sucks and apparently is not very portable (at least on
mingw, the configure check fails). Also remove the emulation of that
function from osdep/strsep*, and remove the configure check.
2013-01-13 17:32:39 +01:00
Uoti Urpala 3f7526d641 af_volnorm: fix output range with float input
af_volnorm can process either int16_t or float audio data. The float
version used 0 to INT_MAX as full value range, when it should be 0 to
1. This effectively disabled the filter (due to all input being
considered to fall in the silence range). Fix.

Reported by Tobias Jacobi <liquid.acid@gmx.net>.
2013-01-13 13:26:07 +01:00
Stefano Pigozzi fab9febdc3 path: add mp_find_config_file and reorganize some of the code
Add `mp_find_config_file` to search different known paths and use that in
ass_mp to look for the fontconfig configuration file.

Some incidental changes spawned by this feature where:

 * Buffer allocation for the strings containing the paths is now performed
   with talloc. All of the allocations are done on a NULL context, but it still
   improves readability of the code.
 * Move the OSX function for lookup inside of a bundle: this code path was
   currently not used by the bundle generated with `make osxbundle`. The plan
   is to use it again in a future commit to get a fontconfig config file.
2012-12-15 17:38:00 +01:00
wm4 74ab902dea audio: remove support for native alaw/mulaw/adpcm output
This is considered a worthless feature. Note that alaw/mulaw/adpcm input
is unaffected: such data is handed to libavcodec and "decoded" to linear
PCM.
2012-12-11 00:37:54 +01:00
reimar a4177fd581 audio: make AC3 pass-through with ad_spdif work
Do not fall back to 0 for samplerate when parser is not initialized.

Might fix some issues with using -ac spdifenc with audio in MKV
or MP4.

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@35517 b3059339-0415-0410-9bf9-f77b7e298cf2

Replace outdated list of unsupported formats by list of supported formats.

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@35534 b3059339-0415-0410-9bf9-f77b7e298cf2

Do not call af_fmt2str on the same data over and over.

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@35535 b3059339-0415-0410-9bf9-f77b7e298cf2

ad_spdif: use the more specific AF_FORMAT_AC3_LE when
we handle AC3.

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@35536 b3059339-0415-0410-9bf9-f77b7e298cf2

Make AF_FORMAT_IS_IEC61937 include AF_FORMAT_IS_AC3.

Our AC3 "sample format" is also iec61937.

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@35537 b3059339-0415-0410-9bf9-f77b7e298cf2

af_format: support endianness conversion also for iec61937
formats in general, not just AC3.

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@35538 b3059339-0415-0410-9bf9-f77b7e298cf2

Conflicts:
	audio/filter/af_format.c

af_format: Fix check_format, non-special formats are of course supported.

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@35545 b3059339-0415-0410-9bf9-f77b7e298cf2

Note: see mplayer bug #2110
2012-12-03 21:08:52 +01:00
Rudolf Polzer 1085539bde af_lavcac3enc, encode: support planar formats
This fixes operation with current ffmpeg releases.

Note that this planarization is slow and should be reverted once proper
planar audio support is there in mpv.
2012-12-03 20:16:17 +01:00
reimar 3f85094d4e Fix potential bugs and issues, general cleanups
Most of these are reimar fixing issues found by Coverity static
analyzer, and possibly some more cleanup commits independent from
this.

Since these commits are rather noisy, squash them all together.

Try to make code a bit clearer.

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@35294 b3059339-0415-0410-9bf9-f77b7e298cf2

Conflicts:
	audio/out/ao_alsa.c

Check the correct variable for NULL.

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@35323 b3059339-0415-0410-9bf9-f77b7e298cf2

Remove pointless unreachable code (the loop condition already checks
the 0xff case).

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@35325 b3059339-0415-0410-9bf9-f77b7e298cf2

Fix typo that might have caused reading beyond the string end.

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@35326 b3059339-0415-0410-9bf9-f77b7e298cf2

Do not needlessly use "long" types.

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@35331 b3059339-0415-0410-9bf9-f77b7e298cf2

Use AV_RB32 to avoid sign extension issues and validate offset before using it.

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@35332 b3059339-0415-0410-9bf9-f77b7e298cf2

Remove nonsense casts.

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@35343 b3059339-0415-0410-9bf9-f77b7e298cf2

Fix crash in case sh_audio allocation failed.

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@35348 b3059339-0415-0410-9bf9-f77b7e298cf2

Fix potential NULL dereference.

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@35351 b3059339-0415-0410-9bf9-f77b7e298cf2

Conflicts:
	libmpcodecs/ad_ffmpeg.c

Note: Slightly modified.

Fix malloc failure check to check the correct variable.

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@35353 b3059339-0415-0410-9bf9-f77b7e298cf2

Avoid code duplication and pointless casts.

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@35363 b3059339-0415-0410-9bf9-f77b7e298cf2

Conflicts:
	stream/tv.c

Error out if an invalid channel list name was specified
instead of continuing and reading outside array bounds
all over the place.

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@35364 b3059339-0415-0410-9bf9-f77b7e298cf2

Conflicts:
	stream/tv.c

Make array "static const".

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@35365 b3059339-0415-0410-9bf9-f77b7e298cf2

Properly free resources even when encountering many
parse errors.

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@35367 b3059339-0415-0410-9bf9-f77b7e298cf2

Conflicts:
	parser-cfg.c

Avoid leaks in error handling.

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@35380 b3059339-0415-0410-9bf9-f77b7e298cf2

Do not do sign comparisons on "char" type which can be both signed or unsigned.

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@35381 b3059339-0415-0410-9bf9-f77b7e298cf2

Free cookies file data after parsing it.

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@35382 b3059339-0415-0410-9bf9-f77b7e298cf2

http_set_field only makes a copy of the string, so we still need to
free it.

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@35383 b3059339-0415-0410-9bf9-f77b7e298cf2

check4proxies does not modify input URL, so mark it const.

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@35390 b3059339-0415-0410-9bf9-f77b7e298cf2

Remove proxy "support" from stream_rtp and stream_upd, trying
to use a http proxy for UDP connections makes no sense.

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@35394 b3059339-0415-0410-9bf9-f77b7e298cf2

Conflicts:
	stream/stream_rtp.c
	stream/stream_udp.c

Add url_new_with_proxy function to reduce code duplication and memleaks.

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@35395 b3059339-0415-0410-9bf9-f77b7e298cf2

Conflicts:
	stream/pnm.c
	stream/stream_live555.c
	stream/stream_nemesi.c
	stream/stream_rtsp.c

Fix off-by-one errors in file descriptor validity checks.

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@35402 b3059339-0415-0410-9bf9-f77b7e298cf2

Remove pointless cast.

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@35403 b3059339-0415-0410-9bf9-f77b7e298cf2

Abort when opening the file failed instead of calling
"write" with an invalid descriptor.

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@35404 b3059339-0415-0410-9bf9-f77b7e298cf2

Remove pointless local variable.

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@35411 b3059339-0415-0410-9bf9-f77b7e298cf2

Conflicts:
	stream/http.c
2012-11-20 18:00:14 +01:00
wm4 4873b32c59 Rename directories, move files (step 2 of 2)
Finish renaming directories and moving files. Adjust all include
statements to make the previous commit compile.

The two commits are separate, because git is bad at tracking renames
and content changes at the same time.

Also take this as an opportunity to remove the separation between
"common" and "mplayer" sources in the Makefile. ("common" used to be
shared between mplayer and mencoder.)
2012-11-12 20:08:18 +01:00
wm4 d4bdd0473d Rename directories, move files (step 1 of 2) (does not compile)
Tis drops the silly lib prefixes, and attempts to organize the tree in
a more logical way. Make the top-level directory less cluttered as
well.

Renames the following directories:
    libaf -> audio/filter
    libao2 -> audio/out
    libvo -> video/out
    libmpdemux -> demux

Split libmpcodecs:
    vf* -> video/filter
    vd*, dec_video.* -> video/decode
    mp_image*, img_format*, ... -> video/
    ad*, dec_audio.* -> audio/decode

libaf/format.* is moved to audio/ - this is similar to how mp_image.*
is located in video/.

Move most top-level .c/.h files to core. (talloc.c/.h is left on top-
level, because it's external.) Park some of the more annoying files
in compat/. Some of these are relicts from the time mplayer used
ffmpeg internals.

sub/ is not split, because it's too much of a mess (subtitle code is
mixed with OSD display and rendering).

Maybe the organization of core is not ideal: it mixes playback core
(like mplayer.c) and utility helpers (like bstr.c/h). Should the need
arise, the playback core will be moved somewhere else, while core
contains all helper and common code.
2012-11-12 20:06:14 +01:00