Commit Graph

27 Commits

Author SHA1 Message Date
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 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 113ec0aba1 af_lavcac3enc: use new AVFrame API 2014-03-16 13:19:29 +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 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 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 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 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 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 91626b1c06 audio: replace af_fmt2str_short -> af_fmt_to_str
Also, remove all af_fmt2str usages.
2013-11-07 22:12:36 +01: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 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 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 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 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
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
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