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.
This commit is contained in:
wm4
2013-02-09 15:15:19 +01:00
parent bb8da97205
commit 4d016a92c8
54 changed files with 1229 additions and 3935 deletions

View File

@@ -32,7 +32,7 @@
/* Missed vorbis, mad, dshow */
extern const ad_functions_t mpcodecs_ad_mpg123;
extern const ad_functions_t mpcodecs_ad_ffmpeg;
extern const ad_functions_t mpcodecs_ad_lavc;
extern const ad_functions_t mpcodecs_ad_spdif;
const ad_functions_t * const mpcodecs_ad_drivers[] =
@@ -40,7 +40,7 @@ const ad_functions_t * const mpcodecs_ad_drivers[] =
#ifdef CONFIG_MPG123
&mpcodecs_ad_mpg123,
#endif
&mpcodecs_ad_ffmpeg,
&mpcodecs_ad_lavc,
&mpcodecs_ad_spdif,
NULL
};

View File

@@ -19,17 +19,20 @@
#ifndef MPLAYER_AD_H
#define MPLAYER_AD_H
#include "core/mpc_info.h"
#include "core/codecs.h"
#include "demux/stheader.h"
typedef struct mp_codec_info ad_info_t;
struct mp_decoder_list;
/* interface of video decoder drivers */
typedef struct ad_functions
{
const ad_info_t *info;
const char *name;
void (*add_decoders)(struct mp_decoder_list *list);
int (*preinit)(sh_audio_t *sh);
int (*init)(sh_audio_t *sh);
int (*init)(sh_audio_t *sh, const char *decoder);
void (*uninit)(sh_audio_t *sh);
int (*control)(sh_audio_t *sh,int cmd,void* arg, ...);
int (*decode_audio)(sh_audio_t *sh, unsigned char *buffer, int minlen,

View File

@@ -19,7 +19,7 @@
#ifndef MPLAYER_AD_INTERNAL_H
#define MPLAYER_AD_INTERNAL_H
#include "core/codec-cfg.h"
#include "core/codecs.h"
#include "audio/format.h"
#include "stream/stream.h"
@@ -28,14 +28,16 @@
#include "ad.h"
static int init(sh_audio_t *sh);
static void add_decoders(struct mp_decoder_list *list);
static int init(sh_audio_t *sh, const char *decoder);
static int preinit(sh_audio_t *sh);
static void uninit(sh_audio_t *sh);
static int control(sh_audio_t *sh,int cmd,void* arg, ...);
static int decode_audio(sh_audio_t *sh,unsigned char *buffer,int minlen,int maxlen);
#define LIBAD_EXTERN(x) const ad_functions_t mpcodecs_ad_##x = {\
&info,\
#x, \
add_decoders, \
preinit,\
init,\
uninit,\

View File

@@ -28,6 +28,8 @@
#include "talloc.h"
#include "config.h"
#include "core/av_common.h"
#include "core/codecs.h"
#include "core/mp_msg.h"
#include "core/options.h"
@@ -37,17 +39,7 @@
#include "compat/mpbswap.h"
#include "compat/libav.h"
static const ad_info_t info =
{
"libavcodec audio decoders",
"ffmpeg",
"",
"",
"",
.print_name = "libavcodec",
};
LIBAD_EXTERN(ffmpeg)
LIBAD_EXTERN(lavc)
struct priv {
AVCodecContext *avctx;
@@ -189,48 +181,26 @@ static int setup_format(sh_audio_t *sh_audio,
return 0;
}
static int init(sh_audio_t *sh_audio)
static int init(sh_audio_t *sh_audio, const char *decoder)
{
struct MPOpts *opts = sh_audio->opts;
AVCodecContext *lavc_context;
AVCodec *lavc_codec;
const char *dll = sh_audio->codec->dll;
if (sh_audio->wf && dll && strcmp(dll, "pcm") == 0) {
if (sh_audio->format == MKTAG('M', 'P', 'a', 'f')) {
// demuxer_rawaudio convenience (abuses wFormatTag)
dll = find_pcm_decoder(af_map, sh_audio->wf->wFormatTag, 0);
} else {
dll = find_pcm_decoder(tag_map, sh_audio->format,
if (sh_audio->wf && strcmp(decoder, "pcm") == 0) {
decoder = find_pcm_decoder(tag_map, sh_audio->format,
sh_audio->wf->wBitsPerSample);
}
} else if (sh_audio->wf && strcmp(decoder, "mp-pcm") == 0) {
decoder = find_pcm_decoder(af_map, sh_audio->format, 0);
}
if (dll) {
lavc_codec = avcodec_find_decoder_by_name(dll);
if (!lavc_codec) {
mp_tmsg(MSGT_DECAUDIO, MSGL_ERR,
"Cannot find codec '%s' in libavcodec...\n", dll);
return 0;
}
} else if (!sh_audio->libav_codec_id) {
mp_tmsg(MSGT_DECAUDIO, MSGL_INFO, "No Libav codec ID known. "
"Generic lavc decoder is not applicable.\n");
lavc_codec = avcodec_find_decoder_by_name(decoder);
if (!lavc_codec) {
mp_tmsg(MSGT_DECAUDIO, MSGL_ERR,
"Cannot find codec '%s' in libavcodec...\n", decoder);
return 0;
} else {
lavc_codec = avcodec_find_decoder(sh_audio->libav_codec_id);
if (!lavc_codec) {
mp_tmsg(MSGT_DECAUDIO, MSGL_INFO, "Libavcodec has no decoder "
"for this codec\n");
return 0;
}
}
sh_audio->codecname = lavc_codec->long_name;
if (!sh_audio->codecname)
sh_audio->codecname = lavc_codec->name;
struct priv *ctx = talloc_zero(NULL, struct priv);
sh_audio->context = ctx;
lavc_context = avcodec_alloc_context3(lavc_codec);
@@ -303,7 +273,7 @@ static int init(sh_audio_t *sh_audio)
}
if (++tries >= 5) {
mp_msg(MSGT_DECAUDIO, MSGL_ERR,
"ad_ffmpeg: initial decode failed\n");
"ad_lavc: initial decode failed\n");
uninit(sh_audio);
return 0;
}
@@ -328,7 +298,6 @@ static int init(sh_audio_t *sh_audio)
static void uninit(sh_audio_t *sh)
{
sh->codecname = NULL;
struct priv *ctx = sh->context;
if (!ctx)
return;
@@ -494,3 +463,10 @@ static int decode_audio(sh_audio_t *sh_audio, unsigned char *buf, int minlen,
}
return len;
}
static void add_decoders(struct mp_decoder_list *list)
{
mp_add_lavc_decoders(list, AVMEDIA_TYPE_AUDIO);
mp_add_decoder(list, "lavc", "pcm", "pcm", "Raw PCM");
mp_add_decoder(list, "lavc", "mp-pcm", "mp-pcm", "Raw PCM");
}

View File

@@ -26,14 +26,6 @@
#include "ad_internal.h"
static const ad_info_t info = {
"MPEG 1.0/2.0/2.5 layers I, II, III",
"mpg123",
"Thomas Orgis",
"mpg123.org",
"High-performance decoder using libmpg123."
};
LIBAD_EXTERN(mpg123)
/* Reducing the ifdeffery to two main variants:
@@ -327,7 +319,7 @@ static int reopen_stream(sh_audio_t *sh)
* Paranoia note: The mpg123_close() on errors is not really necessary,
* But it ensures that we don't accidentally continue decoding with a
* bad state (possibly interpreting the format badly or whatnot). */
static int init(sh_audio_t *sh)
static int init(sh_audio_t *sh, const char *decoder)
{
long rate = 0;
int channels = 0;
@@ -487,3 +479,9 @@ static int control(sh_audio_t *sh, int cmd, void *arg, ...)
}
return CONTROL_UNKNOWN;
}
static void add_decoders(struct mp_decoder_list *list)
{
mp_add_decoder(list, "mpg123", "mp3", "mp3",
"High-performance decoder using libmpg123");
}

View File

@@ -1,6 +1,8 @@
/*
* This file is part of MPlayer.
*
* Copyright (C) 2012 Naoya OYAMA
*
* 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
@@ -24,16 +26,9 @@
#include "config.h"
#include "core/mp_msg.h"
#include "core/av_common.h"
#include "ad_internal.h"
static const ad_info_t info = {
"libavformat/spdifenc audio pass-through decoder.",
"spdif",
"Naoya OYAMA",
"Naoya OYAMA",
"For ALL hardware decoders"
};
LIBAD_EXTERN(spdif)
#define FILENAME_SPDIFENC "spdif"
@@ -76,22 +71,21 @@ static int preinit(sh_audio_t *sh)
return 1;
}
static int init(sh_audio_t *sh)
static int codecs[] = {
CODEC_ID_AAC,
CODEC_ID_AC3,
CODEC_ID_DTS,
CODEC_ID_EAC3,
CODEC_ID_MP3,
CODEC_ID_TRUEHD,
CODEC_ID_NONE
};
static int init(sh_audio_t *sh, const char *decoder)
{
int i, x, in_size, srate, bps, *dtshd_rate;
int x, in_size, srate, bps, *dtshd_rate;
unsigned char *start;
double pts;
static const struct {
const char *name; enum CodecID id;
} fmt_id_type[] = {
{ "aac" , CODEC_ID_AAC },
{ "ac3" , CODEC_ID_AC3 },
{ "dca" , CODEC_ID_DTS },
{ "eac3", CODEC_ID_EAC3 },
{ "mpa" , CODEC_ID_MP3 },
{ "thd" , CODEC_ID_TRUEHD },
{ NULL , 0 }
};
AVFormatContext *lavf_ctx = NULL;
AVStream *stream = NULL;
const AVOption *opt = NULL;
@@ -122,12 +116,7 @@ static int init(sh_audio_t *sh)
goto fail;
lavf_ctx->duration = AV_NOPTS_VALUE;
lavf_ctx->start_time = AV_NOPTS_VALUE;
for (i = 0; fmt_id_type[i].name; i++) {
if (!strcmp(sh->codec->dll, fmt_id_type[i].name)) {
lavf_ctx->streams[0]->codec->codec_id = fmt_id_type[i].id;
break;
}
}
lavf_ctx->streams[0]->codec->codec_id = mp_codec_to_av_codec_id(decoder);
lavf_ctx->raw_packet_buffer_remaining_size = RAW_PACKET_BUFFER_SIZE;
if (AVERROR_PATCHWELCOME == lavf_ctx->oformat->write_header(lavf_ctx)) {
mp_msg(MSGT_DECAUDIO,MSGL_INFO,
@@ -306,3 +295,14 @@ static void uninit(sh_audio_t *sh)
av_freep(&lavf_ctx);
av_freep(&spdif_ctx);
}
static void add_decoders(struct mp_decoder_list *list)
{
for (int n = 0; codecs[n] != CODEC_ID_NONE; n++) {
const char *format = mp_codec_from_av_codec_id(codecs[n]);
if (format) {
mp_add_decoder(list, "spdif", format, format,
"libavformat/spdifenc audio pass-through decoder");
}
}
}

View File

@@ -21,14 +21,16 @@
#include <unistd.h>
#include <assert.h>
#include "demux/codec_tags.h"
#include "config.h"
#include "core/codecs.h"
#include "core/mp_msg.h"
#include "core/bstr.h"
#include "stream/stream.h"
#include "demux/demux.h"
#include "core/codec-cfg.h"
#include "demux/stheader.h"
#include "dec_audio.h"
@@ -41,27 +43,7 @@ int fakemono = 0;
struct af_cfg af_cfg = {1, NULL}; // Configuration for audio filters
void afm_help(void)
{
int i;
mp_tmsg(MSGT_DECAUDIO, MSGL_INFO,
"Available (compiled-in) audio codec families/drivers:\n");
mp_msg(MSGT_IDENTIFY, MSGL_INFO, "ID_AUDIO_DRIVERS\n");
mp_msg(MSGT_DECAUDIO, MSGL_INFO, " afm: info: (comment)\n");
for (i = 0; mpcodecs_ad_drivers[i] != NULL; i++)
if (mpcodecs_ad_drivers[i]->info->comment
&& mpcodecs_ad_drivers[i]->info->comment[0])
mp_msg(MSGT_DECAUDIO, MSGL_INFO, "%9s %s (%s)\n",
mpcodecs_ad_drivers[i]->info->short_name,
mpcodecs_ad_drivers[i]->info->name,
mpcodecs_ad_drivers[i]->info->comment);
else
mp_msg(MSGT_DECAUDIO, MSGL_INFO, "%9s %s\n",
mpcodecs_ad_drivers[i]->info->short_name,
mpcodecs_ad_drivers[i]->info->name);
}
static int init_audio_codec(sh_audio_t *sh_audio)
static int init_audio_codec(sh_audio_t *sh_audio, const char *decoder)
{
assert(!sh_audio->initialized);
resync_audio_stream(sh_audio);
@@ -77,7 +59,7 @@ static int init_audio_codec(sh_audio_t *sh_audio)
}
sh_audio->audio_out_minsize = 8192; // default, preinit() may change it
if (!sh_audio->ad_driver->preinit(sh_audio)) {
mp_tmsg(MSGT_DECAUDIO, MSGL_ERR, "ADecoder preinit failed :(\n");
mp_tmsg(MSGT_DECAUDIO, MSGL_ERR, "Audio decoder preinit failed.\n");
return 0;
}
@@ -104,8 +86,8 @@ static int init_audio_codec(sh_audio_t *sh_audio)
abort();
sh_audio->a_buffer_len = 0;
if (!sh_audio->ad_driver->init(sh_audio)) {
mp_tmsg(MSGT_DECAUDIO, MSGL_V, "ADecoder init failed :(\n");
if (!sh_audio->ad_driver->init(sh_audio, decoder)) {
mp_tmsg(MSGT_DECAUDIO, MSGL_V, "Audio decoder init failed.\n");
uninit_audio(sh_audio); // free buffers
return 0;
}
@@ -125,140 +107,83 @@ static int init_audio_codec(sh_audio_t *sh_audio)
return 1;
}
static int init_audio(sh_audio_t *sh_audio, char *codecname, char *afm,
int status, stringset_t *selected)
struct mp_decoder_list *mp_audio_decoder_list(void)
{
int force = 0;
if (codecname && codecname[0] == '+') {
codecname = &codecname[1];
force = 1;
}
sh_audio->codec = NULL;
while (1) {
const ad_functions_t *mpadec;
sh_audio->ad_driver = 0;
if (!(sh_audio->codec = find_audio_codec(sh_audio->format, NULL,
sh_audio->codec, force)))
break;
// ok we found one codec
if (stringset_test(selected, sh_audio->codec->name))
continue; // already tried & failed
if (codecname && strcmp(sh_audio->codec->name, codecname))
continue; // -ac
if (afm && strcmp(sh_audio->codec->drv, afm))
continue; // afm doesn't match
if (!force && sh_audio->codec->status < status)
continue; // too unstable
stringset_add(selected, sh_audio->codec->name); // tagging it
// ok, it matches all rules, let's find the driver!
int i;
for (i = 0; mpcodecs_ad_drivers[i] != NULL; i++)
if (!strcmp(mpcodecs_ad_drivers[i]->info->short_name,
sh_audio->codec->drv))
break;
mpadec = mpcodecs_ad_drivers[i];
if (!mpadec) { // driver not available (==compiled in)
mp_tmsg(MSGT_DECAUDIO, MSGL_ERR, "Requested audio codec family "
"[%s] (afm=%s) not available.\nEnable it at compilation.\n",
sh_audio->codec->name, sh_audio->codec->drv);
continue;
}
// it's available, let's try to init!
// init()
mp_tmsg(MSGT_DECAUDIO, MSGL_V, "Opening audio decoder: [%s] %s\n",
mpadec->info->short_name, mpadec->info->name);
sh_audio->ad_driver = mpadec;
if (!init_audio_codec(sh_audio)) {
mp_tmsg(MSGT_DECAUDIO, MSGL_WARN, "Audio decoder init failed for "
"codecs.conf entry \"%s\".\n", sh_audio->codec->name);
continue; // try next...
}
// Yeah! We got it!
return 1;
}
return 0;
struct mp_decoder_list *list = talloc_zero(NULL, struct mp_decoder_list);
for (int i = 0; mpcodecs_ad_drivers[i] != NULL; i++)
mpcodecs_ad_drivers[i]->add_decoders(list);
return list;
}
int init_best_audio_codec(sh_audio_t *sh_audio, char **audio_codec_list,
char **audio_fm_list)
static struct mp_decoder_list *mp_select_audio_decoders(const char *codec,
char *selection)
{
stringset_t selected;
char *ac_l_default[2] = {
"", (char *) NULL
};
// hack:
if (!audio_codec_list)
audio_codec_list = ac_l_default;
// Go through the codec.conf and find the best codec...
sh_audio->initialized = 0;
stringset_init(&selected);
while (!sh_audio->initialized && *audio_codec_list) {
char *audio_codec = *(audio_codec_list++);
if (audio_codec[0]) {
if (audio_codec[0] == '-') {
// disable this codec:
stringset_add(&selected, audio_codec + 1);
} else {
// forced codec by name:
mp_tmsg(MSGT_DECAUDIO, MSGL_INFO, "Forced audio codec: %s\n",
audio_codec);
init_audio(sh_audio, audio_codec, NULL, -1, &selected);
}
} else {
int status;
// try in stability order: UNTESTED, WORKING, BUGGY.
// never try CRASHING.
if (audio_fm_list) {
char **fmlist = audio_fm_list;
// try first the preferred codec families:
while (!sh_audio->initialized && *fmlist) {
char *audio_fm = *(fmlist++);
mp_tmsg(MSGT_DECAUDIO, MSGL_INFO,
"Trying to force audio codec driver family %s...\n",
audio_fm);
for (status = CODECS_STATUS__MAX;
status >= CODECS_STATUS__MIN; --status)
if (init_audio(sh_audio, NULL, audio_fm, status,
&selected))
break;
}
}
if (!sh_audio->initialized)
for (status = CODECS_STATUS__MAX; status >= CODECS_STATUS__MIN;
--status)
if (init_audio(sh_audio, NULL, NULL, status, &selected))
break;
struct mp_decoder_list *list = mp_audio_decoder_list();
struct mp_decoder_list *new = mp_select_decoders(list, codec, selection);
talloc_free(list);
return new;
}
static const struct ad_functions *find_driver(const char *name)
{
for (int i = 0; mpcodecs_ad_drivers[i] != NULL; i++) {
if (strcmp(mpcodecs_ad_drivers[i]->name, name) == 0)
return mpcodecs_ad_drivers[i];
}
return NULL;
}
int init_best_audio_codec(sh_audio_t *sh_audio, char *audio_decoders)
{
assert(!sh_audio->initialized);
struct mp_decoder_entry *decoder = NULL;
struct mp_decoder_list *list =
mp_select_audio_decoders(sh_audio->gsh->codec, audio_decoders);
mp_print_decoders(MSGT_DECAUDIO, MSGL_V, "Codec list:", list);
for (int n = 0; n < list->num_entries; n++) {
struct mp_decoder_entry *sel = &list->entries[n];
const struct ad_functions *driver = find_driver(sel->family);
if (!driver)
continue;
mp_tmsg(MSGT_DECAUDIO, MSGL_V, "Opening audio decoder %s:%s\n",
sel->family, sel->decoder);
sh_audio->ad_driver = driver;
if (init_audio_codec(sh_audio, sel->decoder)) {
decoder = sel;
break;
}
}
stringset_free(&selected);
if (!sh_audio->initialized) {
mp_tmsg(MSGT_DECAUDIO, MSGL_ERR,
"Cannot find codec for audio format 0x%X.\n",
sh_audio->format);
return 0; // failed
sh_audio->ad_driver = NULL;
mp_tmsg(MSGT_DECAUDIO, MSGL_WARN, "Audio decoder init failed for "
"%s:%s\n", sel->family, sel->decoder);
}
mp_tmsg(MSGT_DECAUDIO, MSGL_INFO, "Selected audio codec: %s [%s]\n",
sh_audio->codecname ? sh_audio->codecname : sh_audio->codec->info,
sh_audio->ad_driver->info->print_name ?
sh_audio->ad_driver->info->print_name :
sh_audio->ad_driver->info->short_name);
mp_tmsg(MSGT_DECAUDIO, MSGL_V,
"Audio codecs.conf entry: %s (%s) afm: %s\n",
sh_audio->codec->name, sh_audio->codec->info, sh_audio->codec->drv);
mp_msg(MSGT_DECAUDIO, MSGL_V,
"AUDIO: %d Hz, %d ch, %s, %3.1f kbit/%3.2f%% (ratio: %d->%d)\n",
sh_audio->samplerate, sh_audio->channels,
af_fmt2str_short(sh_audio->sample_format),
sh_audio->i_bps * 8 * 0.001,
((float) sh_audio->i_bps / sh_audio->o_bps) * 100.0,
sh_audio->i_bps, sh_audio->o_bps);
mp_msg(MSGT_IDENTIFY, MSGL_INFO,
"ID_AUDIO_BITRATE=%d\nID_AUDIO_RATE=%d\n" "ID_AUDIO_NCH=%d\n",
sh_audio->i_bps * 8, sh_audio->samplerate, sh_audio->channels);
if (sh_audio->initialized) {
sh_audio->gsh->decoder_desc =
talloc_asprintf(NULL, "%s [%s:%s]", decoder->desc, decoder->family,
decoder->decoder);
mp_msg(MSGT_DECAUDIO, MSGL_INFO, "Selected audio codec: %s\n",
sh_audio->gsh->decoder_desc);
mp_msg(MSGT_DECAUDIO, MSGL_V,
"AUDIO: %d Hz, %d ch, %s, %3.1f kbit/%3.2f%% (ratio: %d->%d)\n",
sh_audio->samplerate, sh_audio->channels,
af_fmt2str_short(sh_audio->sample_format),
sh_audio->i_bps * 8 * 0.001,
((float) sh_audio->i_bps / sh_audio->o_bps) * 100.0,
sh_audio->i_bps, sh_audio->o_bps);
mp_msg(MSGT_IDENTIFY, MSGL_INFO,
"ID_AUDIO_BITRATE=%d\nID_AUDIO_RATE=%d\n" "ID_AUDIO_NCH=%d\n",
sh_audio->i_bps * 8, sh_audio->samplerate, sh_audio->channels);
} else {
mp_msg(MSGT_DECAUDIO, MSGL_ERR,
"Failed to initialize an audio decoder for codec '%s'.\n",
sh_audio->gsh->codec ? sh_audio->gsh->codec : "<unknown>");
}
return 1; // success
talloc_free(list);
return sh_audio->initialized;
}
void uninit_audio(sh_audio_t *sh_audio)
@@ -270,11 +195,12 @@ void uninit_audio(sh_audio_t *sh_audio)
sh_audio->afilter = NULL;
}
if (sh_audio->initialized) {
mp_tmsg(MSGT_DECAUDIO, MSGL_V, "Uninit audio: %s\n",
sh_audio->codec->drv);
mp_tmsg(MSGT_DECAUDIO, MSGL_V, "Uninit audio.\n");
sh_audio->ad_driver->uninit(sh_audio);
sh_audio->initialized = 0;
}
talloc_free(sh_audio->gsh->decoder_desc);
sh_audio->gsh->decoder_desc = NULL;
av_freep(&sh_audio->a_buffer);
av_freep(&sh_audio->a_in_buffer);
}

View File

@@ -22,11 +22,10 @@
#include "demux/stheader.h"
struct bstr;
struct mp_decoder_list;
// dec_audio.c:
void afm_help(void);
int init_best_audio_codec(sh_audio_t *sh_audio, char **audio_codec_list,
char **audio_fm_list);
struct mp_decoder_list *mp_audio_decoder_list(void);
int init_best_audio_codec(sh_audio_t *sh_audio, char *audio_decoders);
int decode_audio(sh_audio_t *sh_audio, struct bstr *outbuf, int minlen);
void decode_audio_prepend_bytes(struct bstr *outbuf, int count, int byte);
void resync_audio_stream(sh_audio_t *sh_audio);