2010-06-30 09:55:14 +00:00
|
|
|
/*
|
|
|
|
* MPEG 1.0/2.0/2.5 audio layer I, II, III decoding with libmpg123
|
|
|
|
*
|
2013-10-04 17:22:22 +00:00
|
|
|
* Copyright (C) 2010-2013 Thomas Orgis <thomas@orgis.org>
|
2010-06-30 09:55:14 +00:00
|
|
|
*
|
|
|
|
* MPlayer is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* MPlayer is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License along
|
|
|
|
* with MPlayer; if not, write to the Free Software Foundation, Inc.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <unistd.h>
|
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
|
2013-07-22 12:41:56 +00:00
|
|
|
#include "ad.h"
|
2013-12-17 01:39:45 +00:00
|
|
|
#include "common/msg.h"
|
2010-06-30 09:55:14 +00:00
|
|
|
|
|
|
|
#include <mpg123.h>
|
|
|
|
|
2013-11-12 21:27:36 +00:00
|
|
|
#if (defined MPG123_API_VERSION) && (MPG123_API_VERSION < 33)
|
|
|
|
#error "This should not happen"
|
2012-05-06 16:29:14 +00:00
|
|
|
#endif
|
2010-06-30 09:55:14 +00:00
|
|
|
|
|
|
|
struct ad_mpg123_context {
|
|
|
|
mpg123_handle *handle;
|
audio: add support for using non-interleaved audio from decoders directly
Most libavcodec decoders output non-interleaved audio. Add direct
support for this, and remove the hack that repacked non-interleaved
audio back to packed audio.
Remove the minlen argument from the decoder callback. Instead of
forcing every decoder to have its own decode loop to fill the buffer
until minlen is reached, leave this to the caller. So if a decoder
doesn't return enough data, it's simply called again. (In future, I
even want to change it so that decoders don't read packets directly,
but instead the caller has to pass packets to the decoders. This fits
well with this change, because now the decoder callback typically
decodes at most one packet.)
ad_mpg123.c receives some heavy refactoring. The main problem is that
it wanted to handle format changes when there was no data in the decode
output buffer yet. This sounds reasonable, but actually it would write
data into a buffer prepared for old data, since the caller doesn't know
about the format change yet. (I.e. the best place for a format change
would be _after_ writing the last sample to the output buffer.) It's
possible that this code was not perfectly sane before this commit,
and perhaps lost one frame of data after a format change, but I didn't
confirm this. Trying to fix this, I ended up rewriting the decoding
and also the probing.
2013-11-12 21:27:44 +00:00
|
|
|
int sample_size;
|
2010-06-30 09:55:14 +00:00
|
|
|
/* Running mean for bit rate, stream length estimation. */
|
|
|
|
float mean_rate;
|
|
|
|
unsigned int mean_count;
|
|
|
|
/* Time delay for updates. */
|
|
|
|
short delay;
|
|
|
|
/* If the stream is actually VBR. */
|
|
|
|
char vbr;
|
|
|
|
};
|
|
|
|
|
2013-11-23 20:22:17 +00:00
|
|
|
static void uninit(struct dec_audio *da)
|
audio: add support for using non-interleaved audio from decoders directly
Most libavcodec decoders output non-interleaved audio. Add direct
support for this, and remove the hack that repacked non-interleaved
audio back to packed audio.
Remove the minlen argument from the decoder callback. Instead of
forcing every decoder to have its own decode loop to fill the buffer
until minlen is reached, leave this to the caller. So if a decoder
doesn't return enough data, it's simply called again. (In future, I
even want to change it so that decoders don't read packets directly,
but instead the caller has to pass packets to the decoders. This fits
well with this change, because now the decoder callback typically
decodes at most one packet.)
ad_mpg123.c receives some heavy refactoring. The main problem is that
it wanted to handle format changes when there was no data in the decode
output buffer yet. This sounds reasonable, but actually it would write
data into a buffer prepared for old data, since the caller doesn't know
about the format change yet. (I.e. the best place for a format change
would be _after_ writing the last sample to the output buffer.) It's
possible that this code was not perfectly sane before this commit,
and perhaps lost one frame of data after a format change, but I didn't
confirm this. Trying to fix this, I ended up rewriting the decoding
and also the probing.
2013-11-12 21:27:44 +00:00
|
|
|
{
|
2013-11-23 20:22:17 +00:00
|
|
|
struct ad_mpg123_context *con = da->priv;
|
audio: add support for using non-interleaved audio from decoders directly
Most libavcodec decoders output non-interleaved audio. Add direct
support for this, and remove the hack that repacked non-interleaved
audio back to packed audio.
Remove the minlen argument from the decoder callback. Instead of
forcing every decoder to have its own decode loop to fill the buffer
until minlen is reached, leave this to the caller. So if a decoder
doesn't return enough data, it's simply called again. (In future, I
even want to change it so that decoders don't read packets directly,
but instead the caller has to pass packets to the decoders. This fits
well with this change, because now the decoder callback typically
decodes at most one packet.)
ad_mpg123.c receives some heavy refactoring. The main problem is that
it wanted to handle format changes when there was no data in the decode
output buffer yet. This sounds reasonable, but actually it would write
data into a buffer prepared for old data, since the caller doesn't know
about the format change yet. (I.e. the best place for a format change
would be _after_ writing the last sample to the output buffer.) It's
possible that this code was not perfectly sane before this commit,
and perhaps lost one frame of data after a format change, but I didn't
confirm this. Trying to fix this, I ended up rewriting the decoding
and also the probing.
2013-11-12 21:27:44 +00:00
|
|
|
|
|
|
|
mpg123_close(con->handle);
|
|
|
|
mpg123_delete(con->handle);
|
|
|
|
mpg123_exit();
|
|
|
|
}
|
|
|
|
|
2010-06-30 09:55:14 +00:00
|
|
|
/* This initializes libmpg123 and prepares the handle, including funky
|
|
|
|
* parameters. */
|
2014-07-21 17:29:37 +00:00
|
|
|
static int init(struct dec_audio *da, const char *decoder)
|
2010-06-30 09:55:14 +00:00
|
|
|
{
|
2013-06-12 22:59:27 +00:00
|
|
|
int err;
|
2010-06-30 09:55:14 +00:00
|
|
|
struct ad_mpg123_context *con;
|
|
|
|
/* Assumption: You always call preinit + init + uninit, on every file.
|
|
|
|
* But you stop at preinit in case it fails.
|
|
|
|
* If that is not true, one must ensure not to call mpg123_init / exit
|
|
|
|
* twice in a row. */
|
|
|
|
if (mpg123_init() != MPG123_OK)
|
|
|
|
return 0;
|
|
|
|
|
2013-11-23 20:22:17 +00:00
|
|
|
da->priv = talloc_zero(NULL, struct ad_mpg123_context);
|
|
|
|
con = da->priv;
|
2010-06-30 09:55:14 +00:00
|
|
|
/* Auto-choice of optimized decoder (first argument NULL). */
|
|
|
|
con->handle = mpg123_new(NULL, &err);
|
|
|
|
if (!con->handle)
|
|
|
|
goto bad_end;
|
|
|
|
|
|
|
|
/* Basic settings.
|
|
|
|
* Don't spill messages, enable better resync with non-seekable streams.
|
|
|
|
* Give both flags individually without error checking to keep going with
|
|
|
|
* old libmpg123. Generally, it is not fatal if the flags are not
|
|
|
|
* honored */
|
|
|
|
mpg123_param(con->handle, MPG123_ADD_FLAGS, MPG123_QUIET, 0.0);
|
2010-07-13 15:11:34 +00:00
|
|
|
/* Do not bail out on malformed streams at all.
|
|
|
|
* MPlayer does not handle a decoder throwing the towel on crappy input. */
|
|
|
|
mpg123_param(con->handle, MPG123_RESYNC_LIMIT, -1, 0.0);
|
2010-06-30 09:55:14 +00:00
|
|
|
|
|
|
|
/* Open decisions: Configure libmpg123 to force encoding (or stay open about
|
|
|
|
* library builds that support only float or int32 output), (de)configure
|
|
|
|
* gapless decoding (won't work with seeking in MPlayer, though).
|
|
|
|
* Don't forget to eventually enable ReplayGain/RVA support, too.
|
|
|
|
* Let's try to run with the default for now. */
|
|
|
|
|
2012-05-06 16:29:14 +00:00
|
|
|
/* That would produce floating point output.
|
2013-10-04 17:22:22 +00:00
|
|
|
* You can get 32 and 24 bit ints, even 8 bit via format matrix.
|
|
|
|
* If wanting a specific encoding here, configure format matrix and
|
|
|
|
* make sure it is in set_format(). */
|
2012-05-06 16:29:14 +00:00
|
|
|
/* mpg123_param(con->handle, MPG123_ADD_FLAGS, MPG123_FORCE_FLOAT, 0.); */
|
|
|
|
|
2010-06-30 09:55:14 +00:00
|
|
|
/* Example for RVA choice (available since libmpg123 1.0.0):
|
|
|
|
mpg123_param(con->handle, MPG123_RVA, MPG123_RVA_MIX, 0.0) */
|
|
|
|
|
2012-05-06 16:29:14 +00:00
|
|
|
/* Prevent funky automatic resampling.
|
|
|
|
* This way, we can be sure that one frame will never produce
|
audio: add support for using non-interleaved audio from decoders directly
Most libavcodec decoders output non-interleaved audio. Add direct
support for this, and remove the hack that repacked non-interleaved
audio back to packed audio.
Remove the minlen argument from the decoder callback. Instead of
forcing every decoder to have its own decode loop to fill the buffer
until minlen is reached, leave this to the caller. So if a decoder
doesn't return enough data, it's simply called again. (In future, I
even want to change it so that decoders don't read packets directly,
but instead the caller has to pass packets to the decoders. This fits
well with this change, because now the decoder callback typically
decodes at most one packet.)
ad_mpg123.c receives some heavy refactoring. The main problem is that
it wanted to handle format changes when there was no data in the decode
output buffer yet. This sounds reasonable, but actually it would write
data into a buffer prepared for old data, since the caller doesn't know
about the format change yet. (I.e. the best place for a format change
would be _after_ writing the last sample to the output buffer.) It's
possible that this code was not perfectly sane before this commit,
and perhaps lost one frame of data after a format change, but I didn't
confirm this. Trying to fix this, I ended up rewriting the decoding
and also the probing.
2013-11-12 21:27:44 +00:00
|
|
|
* more than 1152 stereo samples.
|
|
|
|
* Background:
|
|
|
|
* Going to decode directly to the output buffer. It is important to have
|
|
|
|
* MPG123_AUTO_RESAMPLE disabled for the buffer size being an all-time
|
|
|
|
* limit.
|
|
|
|
* We need at least 1152 samples. dec_audio.c normally guarantees this. */
|
2012-05-06 16:29:14 +00:00
|
|
|
mpg123_param(con->handle, MPG123_REMOVE_FLAGS, MPG123_AUTO_RESAMPLE, 0.);
|
|
|
|
|
2014-07-21 17:29:37 +00:00
|
|
|
err = mpg123_open_feed(con->handle);
|
|
|
|
if (err != MPG123_OK)
|
|
|
|
goto bad_end;
|
|
|
|
|
2010-06-30 09:55:14 +00:00
|
|
|
return 1;
|
|
|
|
|
|
|
|
bad_end:
|
2014-07-21 17:29:37 +00:00
|
|
|
if (!con->handle) {
|
|
|
|
MP_ERR(da, "mpg123 preinit error: %s\n", mpg123_plain_strerror(err));
|
|
|
|
} else {
|
|
|
|
MP_ERR(da, "mpg123 preinit error: %s\n", mpg123_strerror(con->handle));
|
|
|
|
}
|
2010-06-30 09:55:14 +00:00
|
|
|
|
2013-11-23 20:22:17 +00:00
|
|
|
uninit(da);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int mpg123_format_to_af(int mpg123_encoding)
|
|
|
|
{
|
|
|
|
/* Without external force, mpg123 will always choose signed encoding,
|
|
|
|
* and non-16-bit only on builds that don't support it.
|
|
|
|
* Be reminded that it doesn't matter to the MPEG file what encoding
|
|
|
|
* is produced from it. */
|
|
|
|
switch (mpg123_encoding) {
|
|
|
|
case MPG123_ENC_SIGNED_8: return AF_FORMAT_S8;
|
|
|
|
case MPG123_ENC_SIGNED_16: return AF_FORMAT_S16;
|
|
|
|
case MPG123_ENC_SIGNED_32: return AF_FORMAT_S32;
|
|
|
|
case MPG123_ENC_FLOAT_32: return AF_FORMAT_FLOAT;
|
|
|
|
}
|
2010-06-30 09:55:14 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
audio: add support for using non-interleaved audio from decoders directly
Most libavcodec decoders output non-interleaved audio. Add direct
support for this, and remove the hack that repacked non-interleaved
audio back to packed audio.
Remove the minlen argument from the decoder callback. Instead of
forcing every decoder to have its own decode loop to fill the buffer
until minlen is reached, leave this to the caller. So if a decoder
doesn't return enough data, it's simply called again. (In future, I
even want to change it so that decoders don't read packets directly,
but instead the caller has to pass packets to the decoders. This fits
well with this change, because now the decoder callback typically
decodes at most one packet.)
ad_mpg123.c receives some heavy refactoring. The main problem is that
it wanted to handle format changes when there was no data in the decode
output buffer yet. This sounds reasonable, but actually it would write
data into a buffer prepared for old data, since the caller doesn't know
about the format change yet. (I.e. the best place for a format change
would be _after_ writing the last sample to the output buffer.) It's
possible that this code was not perfectly sane before this commit,
and perhaps lost one frame of data after a format change, but I didn't
confirm this. Trying to fix this, I ended up rewriting the decoding
and also the probing.
2013-11-12 21:27:44 +00:00
|
|
|
/* Compute bitrate from frame size. */
|
|
|
|
static int compute_bitrate(struct mpg123_frameinfo *i)
|
2010-06-30 09:55:14 +00:00
|
|
|
{
|
audio: add support for using non-interleaved audio from decoders directly
Most libavcodec decoders output non-interleaved audio. Add direct
support for this, and remove the hack that repacked non-interleaved
audio back to packed audio.
Remove the minlen argument from the decoder callback. Instead of
forcing every decoder to have its own decode loop to fill the buffer
until minlen is reached, leave this to the caller. So if a decoder
doesn't return enough data, it's simply called again. (In future, I
even want to change it so that decoders don't read packets directly,
but instead the caller has to pass packets to the decoders. This fits
well with this change, because now the decoder callback typically
decodes at most one packet.)
ad_mpg123.c receives some heavy refactoring. The main problem is that
it wanted to handle format changes when there was no data in the decode
output buffer yet. This sounds reasonable, but actually it would write
data into a buffer prepared for old data, since the caller doesn't know
about the format change yet. (I.e. the best place for a format change
would be _after_ writing the last sample to the output buffer.) It's
possible that this code was not perfectly sane before this commit,
and perhaps lost one frame of data after a format change, but I didn't
confirm this. Trying to fix this, I ended up rewriting the decoding
and also the probing.
2013-11-12 21:27:44 +00:00
|
|
|
static const int samples_per_frame[4][4] = {
|
|
|
|
{-1, 384, 1152, 1152}, /* MPEG 1 */
|
|
|
|
{-1, 384, 1152, 576}, /* MPEG 2 */
|
|
|
|
{-1, 384, 1152, 576}, /* MPEG 2.5 */
|
|
|
|
{-1, -1, -1, -1}, /* Unknown */
|
|
|
|
};
|
2014-05-26 18:16:40 +00:00
|
|
|
return (int) ((i->framesize + 4) * 8 * i->rate /
|
audio: add support for using non-interleaved audio from decoders directly
Most libavcodec decoders output non-interleaved audio. Add direct
support for this, and remove the hack that repacked non-interleaved
audio back to packed audio.
Remove the minlen argument from the decoder callback. Instead of
forcing every decoder to have its own decode loop to fill the buffer
until minlen is reached, leave this to the caller. So if a decoder
doesn't return enough data, it's simply called again. (In future, I
even want to change it so that decoders don't read packets directly,
but instead the caller has to pass packets to the decoders. This fits
well with this change, because now the decoder callback typically
decodes at most one packet.)
ad_mpg123.c receives some heavy refactoring. The main problem is that
it wanted to handle format changes when there was no data in the decode
output buffer yet. This sounds reasonable, but actually it would write
data into a buffer prepared for old data, since the caller doesn't know
about the format change yet. (I.e. the best place for a format change
would be _after_ writing the last sample to the output buffer.) It's
possible that this code was not perfectly sane before this commit,
and perhaps lost one frame of data after a format change, but I didn't
confirm this. Trying to fix this, I ended up rewriting the decoding
and also the probing.
2013-11-12 21:27:44 +00:00
|
|
|
samples_per_frame[i->version][i->layer] + 0.5);
|
2010-06-30 09:55:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Update mean bitrate. This could be dropped if accurate time display
|
|
|
|
* on audio file playback is not desired. */
|
2013-11-23 20:22:17 +00:00
|
|
|
static void update_info(struct dec_audio *da)
|
2010-06-30 09:55:14 +00:00
|
|
|
{
|
2013-11-23 20:22:17 +00:00
|
|
|
struct ad_mpg123_context *con = da->priv;
|
audio: add support for using non-interleaved audio from decoders directly
Most libavcodec decoders output non-interleaved audio. Add direct
support for this, and remove the hack that repacked non-interleaved
audio back to packed audio.
Remove the minlen argument from the decoder callback. Instead of
forcing every decoder to have its own decode loop to fill the buffer
until minlen is reached, leave this to the caller. So if a decoder
doesn't return enough data, it's simply called again. (In future, I
even want to change it so that decoders don't read packets directly,
but instead the caller has to pass packets to the decoders. This fits
well with this change, because now the decoder callback typically
decodes at most one packet.)
ad_mpg123.c receives some heavy refactoring. The main problem is that
it wanted to handle format changes when there was no data in the decode
output buffer yet. This sounds reasonable, but actually it would write
data into a buffer prepared for old data, since the caller doesn't know
about the format change yet. (I.e. the best place for a format change
would be _after_ writing the last sample to the output buffer.) It's
possible that this code was not perfectly sane before this commit,
and perhaps lost one frame of data after a format change, but I didn't
confirm this. Trying to fix this, I ended up rewriting the decoding
and also the probing.
2013-11-12 21:27:44 +00:00
|
|
|
struct mpg123_frameinfo finfo;
|
|
|
|
if (mpg123_info(con->handle, &finfo) != MPG123_OK)
|
|
|
|
return;
|
|
|
|
|
2014-05-26 18:16:40 +00:00
|
|
|
/* finfo.bitrate is expressed in kilobits */
|
|
|
|
const int bitrate = finfo.bitrate * 1000;
|
|
|
|
|
audio: add support for using non-interleaved audio from decoders directly
Most libavcodec decoders output non-interleaved audio. Add direct
support for this, and remove the hack that repacked non-interleaved
audio back to packed audio.
Remove the minlen argument from the decoder callback. Instead of
forcing every decoder to have its own decode loop to fill the buffer
until minlen is reached, leave this to the caller. So if a decoder
doesn't return enough data, it's simply called again. (In future, I
even want to change it so that decoders don't read packets directly,
but instead the caller has to pass packets to the decoders. This fits
well with this change, because now the decoder callback typically
decodes at most one packet.)
ad_mpg123.c receives some heavy refactoring. The main problem is that
it wanted to handle format changes when there was no data in the decode
output buffer yet. This sounds reasonable, but actually it would write
data into a buffer prepared for old data, since the caller doesn't know
about the format change yet. (I.e. the best place for a format change
would be _after_ writing the last sample to the output buffer.) It's
possible that this code was not perfectly sane before this commit,
and perhaps lost one frame of data after a format change, but I didn't
confirm this. Trying to fix this, I ended up rewriting the decoding
and also the probing.
2013-11-12 21:27:44 +00:00
|
|
|
if (finfo.vbr != MPG123_CBR) {
|
|
|
|
if (--con->delay < 1) {
|
2010-06-30 09:55:14 +00:00
|
|
|
if (++con->mean_count > ((unsigned int) -1) / 2)
|
|
|
|
con->mean_count = ((unsigned int) -1) / 4;
|
|
|
|
|
|
|
|
/* Might not be numerically optimal, but works fine enough. */
|
|
|
|
con->mean_rate = ((con->mean_count - 1) * con->mean_rate +
|
2014-05-26 18:16:40 +00:00
|
|
|
bitrate) / con->mean_count;
|
2014-05-26 22:15:41 +00:00
|
|
|
da->bitrate = (int) (con->mean_rate + 0.5);
|
2010-06-30 09:55:14 +00:00
|
|
|
|
|
|
|
con->delay = 10;
|
|
|
|
}
|
audio: add support for using non-interleaved audio from decoders directly
Most libavcodec decoders output non-interleaved audio. Add direct
support for this, and remove the hack that repacked non-interleaved
audio back to packed audio.
Remove the minlen argument from the decoder callback. Instead of
forcing every decoder to have its own decode loop to fill the buffer
until minlen is reached, leave this to the caller. So if a decoder
doesn't return enough data, it's simply called again. (In future, I
even want to change it so that decoders don't read packets directly,
but instead the caller has to pass packets to the decoders. This fits
well with this change, because now the decoder callback typically
decodes at most one packet.)
ad_mpg123.c receives some heavy refactoring. The main problem is that
it wanted to handle format changes when there was no data in the decode
output buffer yet. This sounds reasonable, but actually it would write
data into a buffer prepared for old data, since the caller doesn't know
about the format change yet. (I.e. the best place for a format change
would be _after_ writing the last sample to the output buffer.) It's
possible that this code was not perfectly sane before this commit,
and perhaps lost one frame of data after a format change, but I didn't
confirm this. Trying to fix this, I ended up rewriting the decoding
and also the probing.
2013-11-12 21:27:44 +00:00
|
|
|
} else {
|
2014-05-26 22:15:41 +00:00
|
|
|
da->bitrate = bitrate ? bitrate : compute_bitrate(&finfo);
|
audio: add support for using non-interleaved audio from decoders directly
Most libavcodec decoders output non-interleaved audio. Add direct
support for this, and remove the hack that repacked non-interleaved
audio back to packed audio.
Remove the minlen argument from the decoder callback. Instead of
forcing every decoder to have its own decode loop to fill the buffer
until minlen is reached, leave this to the caller. So if a decoder
doesn't return enough data, it's simply called again. (In future, I
even want to change it so that decoders don't read packets directly,
but instead the caller has to pass packets to the decoders. This fits
well with this change, because now the decoder callback typically
decodes at most one packet.)
ad_mpg123.c receives some heavy refactoring. The main problem is that
it wanted to handle format changes when there was no data in the decode
output buffer yet. This sounds reasonable, but actually it would write
data into a buffer prepared for old data, since the caller doesn't know
about the format change yet. (I.e. the best place for a format change
would be _after_ writing the last sample to the output buffer.) It's
possible that this code was not perfectly sane before this commit,
and perhaps lost one frame of data after a format change, but I didn't
confirm this. Trying to fix this, I ended up rewriting the decoding
and also the probing.
2013-11-12 21:27:44 +00:00
|
|
|
con->delay = 1;
|
|
|
|
con->mean_rate = 0.;
|
|
|
|
con->mean_count = 0;
|
2010-06-30 09:55:14 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-07-21 17:29:37 +00:00
|
|
|
/* libmpg123 has a new format ready; query and store, return return value
|
|
|
|
of mpg123_getformat() */
|
|
|
|
static int set_format(struct dec_audio *da)
|
2010-06-30 09:55:14 +00:00
|
|
|
{
|
2013-11-23 20:22:17 +00:00
|
|
|
struct ad_mpg123_context *con = da->priv;
|
audio: add support for using non-interleaved audio from decoders directly
Most libavcodec decoders output non-interleaved audio. Add direct
support for this, and remove the hack that repacked non-interleaved
audio back to packed audio.
Remove the minlen argument from the decoder callback. Instead of
forcing every decoder to have its own decode loop to fill the buffer
until minlen is reached, leave this to the caller. So if a decoder
doesn't return enough data, it's simply called again. (In future, I
even want to change it so that decoders don't read packets directly,
but instead the caller has to pass packets to the decoders. This fits
well with this change, because now the decoder callback typically
decodes at most one packet.)
ad_mpg123.c receives some heavy refactoring. The main problem is that
it wanted to handle format changes when there was no data in the decode
output buffer yet. This sounds reasonable, but actually it would write
data into a buffer prepared for old data, since the caller doesn't know
about the format change yet. (I.e. the best place for a format change
would be _after_ writing the last sample to the output buffer.) It's
possible that this code was not perfectly sane before this commit,
and perhaps lost one frame of data after a format change, but I didn't
confirm this. Trying to fix this, I ended up rewriting the decoding
and also the probing.
2013-11-12 21:27:44 +00:00
|
|
|
int ret;
|
2014-07-21 17:29:37 +00:00
|
|
|
long rate;
|
|
|
|
int channels;
|
|
|
|
int encoding;
|
|
|
|
ret = mpg123_getformat(con->handle, &rate, &channels, &encoding);
|
|
|
|
if (ret == MPG123_OK) {
|
|
|
|
mp_audio_set_num_channels(&da->decoded, channels);
|
|
|
|
da->decoded.rate = rate;
|
|
|
|
int af = mpg123_format_to_af(encoding);
|
|
|
|
if (!af) {
|
|
|
|
/* This means we got a funny custom build of libmpg123 that only supports an unknown format. */
|
|
|
|
MP_ERR(da, "Bad encoding from mpg123: %i.\n", encoding);
|
|
|
|
return MPG123_ERR;
|
audio: add support for using non-interleaved audio from decoders directly
Most libavcodec decoders output non-interleaved audio. Add direct
support for this, and remove the hack that repacked non-interleaved
audio back to packed audio.
Remove the minlen argument from the decoder callback. Instead of
forcing every decoder to have its own decode loop to fill the buffer
until minlen is reached, leave this to the caller. So if a decoder
doesn't return enough data, it's simply called again. (In future, I
even want to change it so that decoders don't read packets directly,
but instead the caller has to pass packets to the decoders. This fits
well with this change, because now the decoder callback typically
decodes at most one packet.)
ad_mpg123.c receives some heavy refactoring. The main problem is that
it wanted to handle format changes when there was no data in the decode
output buffer yet. This sounds reasonable, but actually it would write
data into a buffer prepared for old data, since the caller doesn't know
about the format change yet. (I.e. the best place for a format change
would be _after_ writing the last sample to the output buffer.) It's
possible that this code was not perfectly sane before this commit,
and perhaps lost one frame of data after a format change, but I didn't
confirm this. Trying to fix this, I ended up rewriting the decoding
and also the probing.
2013-11-12 21:27:44 +00:00
|
|
|
}
|
2014-07-21 17:29:37 +00:00
|
|
|
mp_audio_set_format(&da->decoded, af);
|
|
|
|
con->sample_size = channels * af_fmt2bps(af);
|
audio: add support for using non-interleaved audio from decoders directly
Most libavcodec decoders output non-interleaved audio. Add direct
support for this, and remove the hack that repacked non-interleaved
audio back to packed audio.
Remove the minlen argument from the decoder callback. Instead of
forcing every decoder to have its own decode loop to fill the buffer
until minlen is reached, leave this to the caller. So if a decoder
doesn't return enough data, it's simply called again. (In future, I
even want to change it so that decoders don't read packets directly,
but instead the caller has to pass packets to the decoders. This fits
well with this change, because now the decoder callback typically
decodes at most one packet.)
ad_mpg123.c receives some heavy refactoring. The main problem is that
it wanted to handle format changes when there was no data in the decode
output buffer yet. This sounds reasonable, but actually it would write
data into a buffer prepared for old data, since the caller doesn't know
about the format change yet. (I.e. the best place for a format change
would be _after_ writing the last sample to the output buffer.) It's
possible that this code was not perfectly sane before this commit,
and perhaps lost one frame of data after a format change, but I didn't
confirm this. Trying to fix this, I ended up rewriting the decoding
and also the probing.
2013-11-12 21:27:44 +00:00
|
|
|
}
|
2014-07-21 17:29:37 +00:00
|
|
|
return ret;
|
|
|
|
}
|
audio: add support for using non-interleaved audio from decoders directly
Most libavcodec decoders output non-interleaved audio. Add direct
support for this, and remove the hack that repacked non-interleaved
audio back to packed audio.
Remove the minlen argument from the decoder callback. Instead of
forcing every decoder to have its own decode loop to fill the buffer
until minlen is reached, leave this to the caller. So if a decoder
doesn't return enough data, it's simply called again. (In future, I
even want to change it so that decoders don't read packets directly,
but instead the caller has to pass packets to the decoders. This fits
well with this change, because now the decoder callback typically
decodes at most one packet.)
ad_mpg123.c receives some heavy refactoring. The main problem is that
it wanted to handle format changes when there was no data in the decode
output buffer yet. This sounds reasonable, but actually it would write
data into a buffer prepared for old data, since the caller doesn't know
about the format change yet. (I.e. the best place for a format change
would be _after_ writing the last sample to the output buffer.) It's
possible that this code was not perfectly sane before this commit,
and perhaps lost one frame of data after a format change, but I didn't
confirm this. Trying to fix this, I ended up rewriting the decoding
and also the probing.
2013-11-12 21:27:44 +00:00
|
|
|
|
2014-07-21 17:29:37 +00:00
|
|
|
static int decode_packet(struct dec_audio *da)
|
|
|
|
{
|
|
|
|
struct ad_mpg123_context *con = da->priv;
|
|
|
|
int ret;
|
|
|
|
|
|
|
|
mp_audio_set_null_data(&da->decoded);
|
|
|
|
|
2014-07-28 18:40:43 +00:00
|
|
|
struct demux_packet *pkt;
|
|
|
|
if (demux_read_packet_async(da->header, &pkt) == 0)
|
|
|
|
return AD_WAIT;
|
2014-07-21 17:29:37 +00:00
|
|
|
if (!pkt)
|
|
|
|
return AD_EOF;
|
|
|
|
|
|
|
|
/* Next bytes from that presentation time. */
|
|
|
|
if (pkt->pts != MP_NOPTS_VALUE) {
|
|
|
|
da->pts = pkt->pts;
|
|
|
|
da->pts_offset = 0;
|
audio: add support for using non-interleaved audio from decoders directly
Most libavcodec decoders output non-interleaved audio. Add direct
support for this, and remove the hack that repacked non-interleaved
audio back to packed audio.
Remove the minlen argument from the decoder callback. Instead of
forcing every decoder to have its own decode loop to fill the buffer
until minlen is reached, leave this to the caller. So if a decoder
doesn't return enough data, it's simply called again. (In future, I
even want to change it so that decoders don't read packets directly,
but instead the caller has to pass packets to the decoders. This fits
well with this change, because now the decoder callback typically
decodes at most one packet.)
ad_mpg123.c receives some heavy refactoring. The main problem is that
it wanted to handle format changes when there was no data in the decode
output buffer yet. This sounds reasonable, but actually it would write
data into a buffer prepared for old data, since the caller doesn't know
about the format change yet. (I.e. the best place for a format change
would be _after_ writing the last sample to the output buffer.) It's
possible that this code was not perfectly sane before this commit,
and perhaps lost one frame of data after a format change, but I didn't
confirm this. Trying to fix this, I ended up rewriting the decoding
and also the probing.
2013-11-12 21:27:44 +00:00
|
|
|
}
|
|
|
|
|
2014-07-21 17:29:37 +00:00
|
|
|
/* Have to use mpg123_feed() to avoid decoding here. */
|
|
|
|
ret = mpg123_feed(con->handle, pkt->buffer, pkt->len);
|
|
|
|
talloc_free(pkt);
|
2013-11-18 12:45:35 +00:00
|
|
|
|
audio: add support for using non-interleaved audio from decoders directly
Most libavcodec decoders output non-interleaved audio. Add direct
support for this, and remove the hack that repacked non-interleaved
audio back to packed audio.
Remove the minlen argument from the decoder callback. Instead of
forcing every decoder to have its own decode loop to fill the buffer
until minlen is reached, leave this to the caller. So if a decoder
doesn't return enough data, it's simply called again. (In future, I
even want to change it so that decoders don't read packets directly,
but instead the caller has to pass packets to the decoders. This fits
well with this change, because now the decoder callback typically
decodes at most one packet.)
ad_mpg123.c receives some heavy refactoring. The main problem is that
it wanted to handle format changes when there was no data in the decode
output buffer yet. This sounds reasonable, but actually it would write
data into a buffer prepared for old data, since the caller doesn't know
about the format change yet. (I.e. the best place for a format change
would be _after_ writing the last sample to the output buffer.) It's
possible that this code was not perfectly sane before this commit,
and perhaps lost one frame of data after a format change, but I didn't
confirm this. Trying to fix this, I ended up rewriting the decoding
and also the probing.
2013-11-12 21:27:44 +00:00
|
|
|
if (ret != MPG123_OK)
|
|
|
|
goto mpg123_fail;
|
|
|
|
|
2014-07-21 17:29:37 +00:00
|
|
|
unsigned char *audio = NULL;
|
|
|
|
size_t bytes = 0;
|
|
|
|
ret = mpg123_decode_frame(con->handle, NULL, &audio, &bytes);
|
audio: add support for using non-interleaved audio from decoders directly
Most libavcodec decoders output non-interleaved audio. Add direct
support for this, and remove the hack that repacked non-interleaved
audio back to packed audio.
Remove the minlen argument from the decoder callback. Instead of
forcing every decoder to have its own decode loop to fill the buffer
until minlen is reached, leave this to the caller. So if a decoder
doesn't return enough data, it's simply called again. (In future, I
even want to change it so that decoders don't read packets directly,
but instead the caller has to pass packets to the decoders. This fits
well with this change, because now the decoder callback typically
decodes at most one packet.)
ad_mpg123.c receives some heavy refactoring. The main problem is that
it wanted to handle format changes when there was no data in the decode
output buffer yet. This sounds reasonable, but actually it would write
data into a buffer prepared for old data, since the caller doesn't know
about the format change yet. (I.e. the best place for a format change
would be _after_ writing the last sample to the output buffer.) It's
possible that this code was not perfectly sane before this commit,
and perhaps lost one frame of data after a format change, but I didn't
confirm this. Trying to fix this, I ended up rewriting the decoding
and also the probing.
2013-11-12 21:27:44 +00:00
|
|
|
|
2014-07-21 17:29:37 +00:00
|
|
|
if (ret == MPG123_NEED_MORE)
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
if (ret != MPG123_OK && ret != MPG123_DONE && ret != MPG123_NEW_FORMAT)
|
|
|
|
goto mpg123_fail;
|
audio: add support for using non-interleaved audio from decoders directly
Most libavcodec decoders output non-interleaved audio. Add direct
support for this, and remove the hack that repacked non-interleaved
audio back to packed audio.
Remove the minlen argument from the decoder callback. Instead of
forcing every decoder to have its own decode loop to fill the buffer
until minlen is reached, leave this to the caller. So if a decoder
doesn't return enough data, it's simply called again. (In future, I
even want to change it so that decoders don't read packets directly,
but instead the caller has to pass packets to the decoders. This fits
well with this change, because now the decoder callback typically
decodes at most one packet.)
ad_mpg123.c receives some heavy refactoring. The main problem is that
it wanted to handle format changes when there was no data in the decode
output buffer yet. This sounds reasonable, but actually it would write
data into a buffer prepared for old data, since the caller doesn't know
about the format change yet. (I.e. the best place for a format change
would be _after_ writing the last sample to the output buffer.) It's
possible that this code was not perfectly sane before this commit,
and perhaps lost one frame of data after a format change, but I didn't
confirm this. Trying to fix this, I ended up rewriting the decoding
and also the probing.
2013-11-12 21:27:44 +00:00
|
|
|
|
2014-07-21 17:29:37 +00:00
|
|
|
ret = set_format(da);
|
|
|
|
if (ret != MPG123_OK)
|
audio: add support for using non-interleaved audio from decoders directly
Most libavcodec decoders output non-interleaved audio. Add direct
support for this, and remove the hack that repacked non-interleaved
audio back to packed audio.
Remove the minlen argument from the decoder callback. Instead of
forcing every decoder to have its own decode loop to fill the buffer
until minlen is reached, leave this to the caller. So if a decoder
doesn't return enough data, it's simply called again. (In future, I
even want to change it so that decoders don't read packets directly,
but instead the caller has to pass packets to the decoders. This fits
well with this change, because now the decoder callback typically
decodes at most one packet.)
ad_mpg123.c receives some heavy refactoring. The main problem is that
it wanted to handle format changes when there was no data in the decode
output buffer yet. This sounds reasonable, but actually it would write
data into a buffer prepared for old data, since the caller doesn't know
about the format change yet. (I.e. the best place for a format change
would be _after_ writing the last sample to the output buffer.) It's
possible that this code was not perfectly sane before this commit,
and perhaps lost one frame of data after a format change, but I didn't
confirm this. Trying to fix this, I ended up rewriting the decoding
and also the probing.
2013-11-12 21:27:44 +00:00
|
|
|
goto mpg123_fail;
|
2014-07-21 17:29:37 +00:00
|
|
|
|
|
|
|
if (con->sample_size < 1) {
|
|
|
|
MP_ERR(da, "no sample size\n");
|
|
|
|
return AD_ERR;
|
audio: add support for using non-interleaved audio from decoders directly
Most libavcodec decoders output non-interleaved audio. Add direct
support for this, and remove the hack that repacked non-interleaved
audio back to packed audio.
Remove the minlen argument from the decoder callback. Instead of
forcing every decoder to have its own decode loop to fill the buffer
until minlen is reached, leave this to the caller. So if a decoder
doesn't return enough data, it's simply called again. (In future, I
even want to change it so that decoders don't read packets directly,
but instead the caller has to pass packets to the decoders. This fits
well with this change, because now the decoder callback typically
decodes at most one packet.)
ad_mpg123.c receives some heavy refactoring. The main problem is that
it wanted to handle format changes when there was no data in the decode
output buffer yet. This sounds reasonable, but actually it would write
data into a buffer prepared for old data, since the caller doesn't know
about the format change yet. (I.e. the best place for a format change
would be _after_ writing the last sample to the output buffer.) It's
possible that this code was not perfectly sane before this commit,
and perhaps lost one frame of data after a format change, but I didn't
confirm this. Trying to fix this, I ended up rewriting the decoding
and also the probing.
2013-11-12 21:27:44 +00:00
|
|
|
}
|
2010-06-30 09:55:14 +00:00
|
|
|
|
2014-07-21 17:29:37 +00:00
|
|
|
int got_samples = bytes / con->sample_size;
|
|
|
|
da->decoded.planes[0] = audio;
|
|
|
|
da->decoded.samples = got_samples;
|
|
|
|
|
2013-11-23 20:22:17 +00:00
|
|
|
update_info(da);
|
audio: add support for using non-interleaved audio from decoders directly
Most libavcodec decoders output non-interleaved audio. Add direct
support for this, and remove the hack that repacked non-interleaved
audio back to packed audio.
Remove the minlen argument from the decoder callback. Instead of
forcing every decoder to have its own decode loop to fill the buffer
until minlen is reached, leave this to the caller. So if a decoder
doesn't return enough data, it's simply called again. (In future, I
even want to change it so that decoders don't read packets directly,
but instead the caller has to pass packets to the decoders. This fits
well with this change, because now the decoder callback typically
decodes at most one packet.)
ad_mpg123.c receives some heavy refactoring. The main problem is that
it wanted to handle format changes when there was no data in the decode
output buffer yet. This sounds reasonable, but actually it would write
data into a buffer prepared for old data, since the caller doesn't know
about the format change yet. (I.e. the best place for a format change
would be _after_ writing the last sample to the output buffer.) It's
possible that this code was not perfectly sane before this commit,
and perhaps lost one frame of data after a format change, but I didn't
confirm this. Trying to fix this, I ended up rewriting the decoding
and also the probing.
2013-11-12 21:27:44 +00:00
|
|
|
return 0;
|
|
|
|
|
|
|
|
mpg123_fail:
|
2014-07-20 18:42:03 +00:00
|
|
|
MP_ERR(da, "mpg123 decoding error: %s\n", mpg123_strerror(con->handle));
|
|
|
|
return AD_ERR;
|
2010-06-30 09:55:14 +00:00
|
|
|
}
|
|
|
|
|
2013-11-23 20:22:17 +00:00
|
|
|
static int control(struct dec_audio *da, int cmd, void *arg)
|
2010-06-30 09:55:14 +00:00
|
|
|
{
|
2013-11-23 20:22:17 +00:00
|
|
|
struct ad_mpg123_context *con = da->priv;
|
audio: add support for using non-interleaved audio from decoders directly
Most libavcodec decoders output non-interleaved audio. Add direct
support for this, and remove the hack that repacked non-interleaved
audio back to packed audio.
Remove the minlen argument from the decoder callback. Instead of
forcing every decoder to have its own decode loop to fill the buffer
until minlen is reached, leave this to the caller. So if a decoder
doesn't return enough data, it's simply called again. (In future, I
even want to change it so that decoders don't read packets directly,
but instead the caller has to pass packets to the decoders. This fits
well with this change, because now the decoder callback typically
decodes at most one packet.)
ad_mpg123.c receives some heavy refactoring. The main problem is that
it wanted to handle format changes when there was no data in the decode
output buffer yet. This sounds reasonable, but actually it would write
data into a buffer prepared for old data, since the caller doesn't know
about the format change yet. (I.e. the best place for a format change
would be _after_ writing the last sample to the output buffer.) It's
possible that this code was not perfectly sane before this commit,
and perhaps lost one frame of data after a format change, but I didn't
confirm this. Trying to fix this, I ended up rewriting the decoding
and also the probing.
2013-11-12 21:27:44 +00:00
|
|
|
|
2010-06-30 09:55:14 +00:00
|
|
|
switch (cmd) {
|
2013-11-27 19:54:07 +00:00
|
|
|
case ADCTRL_RESET:
|
2014-07-21 17:29:37 +00:00
|
|
|
mp_audio_set_null_data(&da->decoded);
|
audio: add support for using non-interleaved audio from decoders directly
Most libavcodec decoders output non-interleaved audio. Add direct
support for this, and remove the hack that repacked non-interleaved
audio back to packed audio.
Remove the minlen argument from the decoder callback. Instead of
forcing every decoder to have its own decode loop to fill the buffer
until minlen is reached, leave this to the caller. So if a decoder
doesn't return enough data, it's simply called again. (In future, I
even want to change it so that decoders don't read packets directly,
but instead the caller has to pass packets to the decoders. This fits
well with this change, because now the decoder callback typically
decodes at most one packet.)
ad_mpg123.c receives some heavy refactoring. The main problem is that
it wanted to handle format changes when there was no data in the decode
output buffer yet. This sounds reasonable, but actually it would write
data into a buffer prepared for old data, since the caller doesn't know
about the format change yet. (I.e. the best place for a format change
would be _after_ writing the last sample to the output buffer.) It's
possible that this code was not perfectly sane before this commit,
and perhaps lost one frame of data after a format change, but I didn't
confirm this. Trying to fix this, I ended up rewriting the decoding
and also the probing.
2013-11-12 21:27:44 +00:00
|
|
|
mpg123_close(con->handle);
|
|
|
|
|
|
|
|
if (mpg123_open_feed(con->handle) != MPG123_OK) {
|
2013-12-21 17:23:59 +00:00
|
|
|
MP_ERR(da, "mpg123 failed to reopen stream: %s\n",
|
audio: add support for using non-interleaved audio from decoders directly
Most libavcodec decoders output non-interleaved audio. Add direct
support for this, and remove the hack that repacked non-interleaved
audio back to packed audio.
Remove the minlen argument from the decoder callback. Instead of
forcing every decoder to have its own decode loop to fill the buffer
until minlen is reached, leave this to the caller. So if a decoder
doesn't return enough data, it's simply called again. (In future, I
even want to change it so that decoders don't read packets directly,
but instead the caller has to pass packets to the decoders. This fits
well with this change, because now the decoder callback typically
decodes at most one packet.)
ad_mpg123.c receives some heavy refactoring. The main problem is that
it wanted to handle format changes when there was no data in the decode
output buffer yet. This sounds reasonable, but actually it would write
data into a buffer prepared for old data, since the caller doesn't know
about the format change yet. (I.e. the best place for a format change
would be _after_ writing the last sample to the output buffer.) It's
possible that this code was not perfectly sane before this commit,
and perhaps lost one frame of data after a format change, but I didn't
confirm this. Trying to fix this, I ended up rewriting the decoding
and also the probing.
2013-11-12 21:27:44 +00:00
|
|
|
mpg123_strerror(con->handle));
|
2010-06-30 09:55:14 +00:00
|
|
|
return CONTROL_FALSE;
|
|
|
|
}
|
audio: add support for using non-interleaved audio from decoders directly
Most libavcodec decoders output non-interleaved audio. Add direct
support for this, and remove the hack that repacked non-interleaved
audio back to packed audio.
Remove the minlen argument from the decoder callback. Instead of
forcing every decoder to have its own decode loop to fill the buffer
until minlen is reached, leave this to the caller. So if a decoder
doesn't return enough data, it's simply called again. (In future, I
even want to change it so that decoders don't read packets directly,
but instead the caller has to pass packets to the decoders. This fits
well with this change, because now the decoder callback typically
decodes at most one packet.)
ad_mpg123.c receives some heavy refactoring. The main problem is that
it wanted to handle format changes when there was no data in the decode
output buffer yet. This sounds reasonable, but actually it would write
data into a buffer prepared for old data, since the caller doesn't know
about the format change yet. (I.e. the best place for a format change
would be _after_ writing the last sample to the output buffer.) It's
possible that this code was not perfectly sane before this commit,
and perhaps lost one frame of data after a format change, but I didn't
confirm this. Trying to fix this, I ended up rewriting the decoding
and also the probing.
2013-11-12 21:27:44 +00:00
|
|
|
return CONTROL_TRUE;
|
2010-06-30 09:55:14 +00:00
|
|
|
}
|
|
|
|
return CONTROL_UNKNOWN;
|
|
|
|
}
|
core: redo how codecs are mapped, remove codecs.conf
Use codec names instead of FourCCs to identify codecs. Rewrite how
codecs are selected and initialized. Now each decoder exports a list
of decoders (and the codec it supports) via add_decoders(). The order
matters, and the first decoder for a given decoder is preferred over
the other decoders. E.g. all ad_mpg123 decoders are preferred over
ad_lavc, because it comes first in the mpcodecs_ad_drivers array.
Likewise, decoders within ad_lavc that are enumerated first by
libavcodec (using av_codec_next()) are preferred. (This is actually
critical to select h264 software decoding by default instead of vdpau.
libavcodec and ffmpeg/avconv use the same method to select decoders by
default, so we hope this is sane.)
The codec names follow libavcodec's codec names as defined by
AVCodecDescriptor.name (see libavcodec/codec_desc.c). Some decoders
have names different from the canonical codec name. The AVCodecDescriptor
API is relatively new, so we need a compatibility layer for older
libavcodec versions for codec names that are referenced internally,
and which are different from the decoder name. (Add a configure check
for that, because checking versions is getting way too messy.)
demux/codec_tags.c is generated from the former codecs.conf (minus
"special" decoders like vdpau, and excluding the mappings that are the
same as the mappings libavformat's exported RIFF tables). It contains
all the mappings from FourCCs to codec name. This is needed for
demux_mkv, demux_mpg, demux_avi and demux_asf. demux_lavf will set the
codec as determined by libavformat, while the other demuxers have to do
this on their own, using the mp_set_audio/video_codec_from_tag()
functions. Note that the sh_audio/video->format members don't uniquely
identify the codec anymore, and sh->codec takes over this role.
Replace the --ac/--vc/--afm/--vfm with new --vd/--ad options, which
provide cover the functionality of the removed switched.
Note: there's no CODECS_FLAG_FLIP flag anymore. This means some obscure
container/video combinations (e.g. the sample Film_200_zygo_pro.mov)
are played flipped. ffplay/avplay doesn't handle this properly either,
so we don't care and blame ffmeg/libav instead.
2013-02-09 14:15:19 +00:00
|
|
|
|
|
|
|
static void add_decoders(struct mp_decoder_list *list)
|
|
|
|
{
|
|
|
|
mp_add_decoder(list, "mpg123", "mp3", "mp3",
|
|
|
|
"High-performance decoder using libmpg123");
|
|
|
|
}
|
2013-07-22 12:41:56 +00:00
|
|
|
|
|
|
|
const struct ad_functions ad_mpg123 = {
|
|
|
|
.name = "mpg123",
|
|
|
|
.add_decoders = add_decoders,
|
|
|
|
.init = init,
|
|
|
|
.uninit = uninit,
|
|
|
|
.control = control,
|
2014-07-21 17:29:37 +00:00
|
|
|
.decode_packet = decode_packet,
|
2013-07-22 12:41:56 +00:00
|
|
|
};
|