summaryrefslogtreecommitdiffstats
path: root/libmpcodecs
diff options
context:
space:
mode:
Diffstat (limited to 'libmpcodecs')
-rw-r--r--libmpcodecs/ad_dmo.c6
-rw-r--r--libmpcodecs/ad_faad.c10
-rw-r--r--libmpcodecs/ad_ffmpeg.c2
-rw-r--r--libmpcodecs/ad_internal.h1
-rw-r--r--libmpcodecs/ad_liba52.c5
-rw-r--r--libmpcodecs/ad_libdca.c11
-rw-r--r--libmpcodecs/dec_audio.c2
7 files changed, 22 insertions, 15 deletions
diff --git a/libmpcodecs/ad_dmo.c b/libmpcodecs/ad_dmo.c
index 1501c21078..714651a7e4 100644
--- a/libmpcodecs/ad_dmo.c
+++ b/libmpcodecs/ad_dmo.c
@@ -21,6 +21,7 @@
#include <unistd.h>
#include "config.h"
+#include "options.h"
#include "mp_msg.h"
#include "ad_internal.h"
@@ -46,9 +47,10 @@ static int init(sh_audio_t *sh)
static int preinit(sh_audio_t *sh_audio)
{
+ struct MPOpts *opts = sh_audio->opts;
DMO_AudioDecoder* ds_adec;
- int chans=(audio_output_channels==sh_audio->wf->nChannels) ?
- audio_output_channels : (sh_audio->wf->nChannels>=2 ? 2 : 1);
+ int chans=(opts->audio_output_channels==sh_audio->wf->nChannels) ?
+ opts->audio_output_channels : (sh_audio->wf->nChannels>=2 ? 2 : 1);
if(!(ds_adec=DMO_AudioDecoder_Open(sh_audio->codec->dll,&sh_audio->codec->guid,sh_audio->wf,chans)))
{
mp_tmsg(MSGT_DECAUDIO,MSGL_ERR,"ERROR: Could not open required DirectShow codec %s.\n",sh_audio->codec->dll);
diff --git a/libmpcodecs/ad_faad.c b/libmpcodecs/ad_faad.c
index 2dc6c1f580..96abaa5a6d 100644
--- a/libmpcodecs/ad_faad.c
+++ b/libmpcodecs/ad_faad.c
@@ -25,6 +25,7 @@
#include <unistd.h>
#include "config.h"
+#include "options.h"
#include "ad_internal.h"
#include "libaf/reorder_ch.h"
@@ -83,6 +84,7 @@ static int aac_probe(unsigned char *buffer, int len)
static int init(sh_audio_t *sh)
{
+ struct MPOpts *opts = sh->opts;
unsigned long faac_samplerate;
unsigned char faac_channels;
int faac_init, pos = 0;
@@ -105,7 +107,8 @@ static int init(sh_audio_t *sh)
/* XXX: FAAD support FLOAT output, how do we handle
* that (FAAD_FMT_FLOAT)? ::atmos
*/
- if (audio_output_channels <= 2) faac_conf->downMatrix = 1;
+ if (opts->audio_output_channels <= 2)
+ faac_conf->downMatrix = 1;
switch(sh->samplesize){
case 1: // 8Bit
mp_msg(MSGT_DECAUDIO,MSGL_WARN,"FAAD: 8Bit samplesize not supported by FAAD, assuming 16Bit!\n");
@@ -177,7 +180,7 @@ static int init(sh_audio_t *sh)
} else { // We have ES DS in codecdata
faacDecConfigurationPtr faac_conf = faacDecGetCurrentConfiguration(faac_hdec);
- if (audio_output_channels <= 2) {
+ if (opts->audio_output_channels <= 2) {
faac_conf->downMatrix = 1;
faacDecSetConfiguration(faac_hdec, faac_conf);
}
@@ -199,7 +202,8 @@ static int init(sh_audio_t *sh)
mp_msg(MSGT_DECAUDIO,MSGL_V,"FAAD: Negotiated samplerate: %ldHz channels: %d\n", faac_samplerate, faac_channels);
// 8 channels is aac channel order #7.
sh->channels = faac_channels == 7 ? 8 : faac_channels;
- if (audio_output_channels <= 2) sh->channels = faac_channels > 1 ? 2 : 1;
+ if (opts->audio_output_channels <= 2)
+ sh->channels = faac_channels > 1 ? 2 : 1;
sh->samplerate = faac_samplerate;
sh->samplesize=2;
//sh->o_bps = sh->samplesize*faac_channels*faac_samplerate;
diff --git a/libmpcodecs/ad_ffmpeg.c b/libmpcodecs/ad_ffmpeg.c
index 7c398af5b0..7d945794b8 100644
--- a/libmpcodecs/ad_ffmpeg.c
+++ b/libmpcodecs/ad_ffmpeg.c
@@ -120,7 +120,7 @@ static int init(sh_audio_t *sh_audio)
lavc_context->block_align = sh_audio->wf->nBlockAlign;
lavc_context->bits_per_coded_sample = sh_audio->wf->wBitsPerSample;
}
- lavc_context->request_channels = audio_output_channels;
+ lavc_context->request_channels = opts->audio_output_channels;
lavc_context->codec_tag = sh_audio->format; //FOURCC
lavc_context->codec_type = CODEC_TYPE_AUDIO;
lavc_context->codec_id = lavc_codec->id; // not sure if required, imho not --A'rpi
diff --git a/libmpcodecs/ad_internal.h b/libmpcodecs/ad_internal.h
index 2a5dbc43ea..a04d3f6165 100644
--- a/libmpcodecs/ad_internal.h
+++ b/libmpcodecs/ad_internal.h
@@ -28,7 +28,6 @@
#include "ad.h"
-extern int audio_output_channels;
static int init(sh_audio_t *sh);
static int preinit(sh_audio_t *sh);
static void uninit(sh_audio_t *sh);
diff --git a/libmpcodecs/ad_liba52.c b/libmpcodecs/ad_liba52.c
index 0cc282776d..abd6a7ac54 100644
--- a/libmpcodecs/ad_liba52.c
+++ b/libmpcodecs/ad_liba52.c
@@ -141,10 +141,11 @@ static sample_t dynrng_call (sample_t c, void *data)
static int preinit(sh_audio_t *sh)
{
+ struct MPOpts *opts = sh->opts;
/* Dolby AC3 audio: */
/* however many channels, 2 bytes in a word, 256 samples in a block, 6 blocks in a frame */
if (sh->samplesize < 4) sh->samplesize = 4;
- sh->audio_out_minsize=audio_output_channels*sh->samplesize*256*6;
+ sh->audio_out_minsize=opts->audio_output_channels*sh->samplesize*256*6;
sh->audio_in_minsize=3840;
a52_level = 1.0;
return 1;
@@ -219,7 +220,7 @@ static int init(sh_audio_t *sh_audio)
/* 'a52 cannot upmix' hotfix:*/
a52_printinfo(sh_audio);
- sh_audio->channels=audio_output_channels;
+ sh_audio->channels=opts->audio_output_channels;
while(sh_audio->channels>0){
switch(sh_audio->channels){
case 1: a52_flags=A52_MONO; break;
diff --git a/libmpcodecs/ad_libdca.c b/libmpcodecs/ad_libdca.c
index c167c92490..a550cbb8d7 100644
--- a/libmpcodecs/ad_libdca.c
+++ b/libmpcodecs/ad_libdca.c
@@ -25,8 +25,9 @@
#include <stdlib.h>
#include <unistd.h>
#include <assert.h>
-#include "config.h"
+#include "config.h"
+#include "options.h"
#include "mp_msg.h"
#include "ad_internal.h"
@@ -280,8 +281,10 @@ end:
static int preinit(sh_audio_t *sh)
{
+ struct MPOpts *opts = sh->opts;
+
/* 256 = samples per block, 16 = max number of blocks */
- sh->audio_out_minsize = audio_output_channels * sizeof(int16_t) * 256 * 16;
+ sh->audio_out_minsize = opts->audio_output_channels * sizeof(int16_t) * 256 * 16;
sh->audio_in_minsize = DTSBUFFER_SIZE;
sh->samplesize=2;
@@ -308,8 +311,8 @@ static int init(sh_audio_t *sh)
}
channels_info(flags);
- assert(audio_output_channels >= 1 && audio_output_channels <= 6);
- sh->channels = audio_output_channels;
+ assert(opts->audio_output_channels >= 1 && opts->audio_output_channels <= 6);
+ sh->channels = opts->audio_output_channels;
decoded_bytes = decode_audio(sh, sh->a_buffer, 1, sh->a_buffer_size);
if(decoded_bytes > 0)
diff --git a/libmpcodecs/dec_audio.c b/libmpcodecs/dec_audio.c
index ade2429dc0..572e06a8a1 100644
--- a/libmpcodecs/dec_audio.c
+++ b/libmpcodecs/dec_audio.c
@@ -44,8 +44,6 @@
int fakemono = 0;
#endif
-/* used for ac3surround decoder - set using -channels option */
-int audio_output_channels = 2;
af_cfg_t af_cfg = { 1, NULL }; // Configuration for audio filters
void afm_help(void)