changeset 31220:002cdc635c03

Use the -a52drc option also for the libavcodec decoder.
author reimar
date Sun, 30 May 2010 16:46:31 +0000
parents e02877d8647e
children 456417526407
files cfg-common-opts.h cfg-common.h libmpcodecs/ad.c libmpcodecs/ad_ffmpeg.c libmpcodecs/ad_liba52.c
diffstat 5 files changed, 14 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/cfg-common-opts.h	Sun May 30 14:29:18 2010 +0000
+++ b/cfg-common-opts.h	Sun May 30 16:46:31 2010 +0000
@@ -19,9 +19,8 @@
 #ifndef MPLAYER_CFG_COMMON_OPTS_H
 #define MPLAYER_CFG_COMMON_OPTS_H
 
-#include "config.h"
-#include "libmpcodecs/vd.h"
-#include "osdep/priority.h"
+// you may _not_ include any files here since this is included
+// in the middle of an array declaration
 
 // ------------------------- common options --------------------
     {"quiet", &quiet, CONF_TYPE_FLAG, CONF_GLOBAL, 0, 1, NULL},
@@ -218,9 +217,7 @@
     {"ignore-start", &ignore_start, CONF_TYPE_FLAG, 0, 0, 1, NULL},
     {"noignore-start", &ignore_start, CONF_TYPE_FLAG, 0, 1, 0, NULL},
 
-#ifdef CONFIG_LIBA52
-    {"a52drc", &a52_drc_level, CONF_TYPE_FLOAT, CONF_RANGE, 0, 1, NULL},
-#endif
+    {"a52drc", &drc_level, CONF_TYPE_FLOAT, CONF_RANGE, 0, 1, NULL},
 
 // ------------------------- codec/vfilter options --------------------
 
--- a/cfg-common.h	Sun May 30 14:29:18 2010 +0000
+++ b/cfg-common.h	Sun May 30 16:46:31 2010 +0000
@@ -24,6 +24,10 @@
 #include "m_config.h"
 #include "m_option.h"
 
+#include "libmpcodecs/ad.h"
+#include "libmpcodecs/vd.h"
+#include "osdep/priority.h"
+
 extern char *mp_msg_charset;
 extern int mp_msg_color;
 extern int mp_msg_module;
@@ -52,8 +56,6 @@
 
 extern int dvd_speed; /* stream/stream_dvd.c */
 
-extern float a52_drc_level;
-
 /* defined in libmpdemux: */
 extern int hr_mp3_seek;
 extern const m_option_t demux_rawaudio_opts[];
--- a/libmpcodecs/ad.c	Sun May 30 14:29:18 2010 +0000
+++ b/libmpcodecs/ad.c	Sun May 30 16:46:31 2010 +0000
@@ -29,6 +29,8 @@
 #include "libmpdemux/stheader.h"
 #include "ad.h"
 
+float drc_level = 1.0;
+
 /* Missed vorbis, mad, dshow */
 
 //extern ad_functions_t mpcodecs_ad_null;
--- a/libmpcodecs/ad_ffmpeg.c	Sun May 30 14:29:18 2010 +0000
+++ b/libmpcodecs/ad_ffmpeg.c	Sun May 30 16:46:31 2010 +0000
@@ -75,6 +75,7 @@
     lavc_context = avcodec_alloc_context();
     sh_audio->context=lavc_context;
 
+    lavc_context->drc_scale = drc_level;
     lavc_context->sample_rate = sh_audio->samplerate;
     lavc_context->bit_rate = sh_audio->i_bps * 8;
     if(sh_audio->wf){
--- a/libmpcodecs/ad_liba52.c	Sun May 30 14:29:18 2010 +0000
+++ b/libmpcodecs/ad_liba52.c	Sun May 30 16:46:31 2010 +0000
@@ -54,8 +54,6 @@
 
 /** The output is multiplied by this var.  Used for volume control */
 static sample_t a52_level = 1;
-/** The value of the -a52drc switch. */
-float a52_drc_level = 1.0;
 static int a52_drc_action = DRC_NO_ACTION;
 
 static const ad_info_t info =
@@ -136,8 +134,8 @@
 
 static sample_t dynrng_call (sample_t c, void *data)
 {
-//	fprintf(stderr, "(%lf, %lf): %lf\n", (double)c, (double)a52_drc_level, (double)pow((double)c, a52_drc_level));
-	return pow((double)c, a52_drc_level);
+//	fprintf(stderr, "(%lf, %lf): %lf\n", (double)c, (double)drc_level, (double)pow((double)c, drc_level));
+	return pow((double)c, drc_level);
 }
 
 
@@ -207,10 +205,10 @@
 
 
   /* Init a52 dynrng */
-  if (a52_drc_level < 0.001) {
+  if (drc_level < 0.001) {
 	  /* level == 0 --> no compression, init library without callback */
 	  a52_drc_action = DRC_NO_COMPRESSION;
-  } else if (a52_drc_level > 0.999) {
+  } else if (drc_level > 0.999) {
 	  /* level == 1 --> full compression, do nothing at all (library default = full compression) */
 	  a52_drc_action = DRC_NO_ACTION;
   } else {