summaryrefslogtreecommitdiffstats
path: root/libhb
diff options
context:
space:
mode:
authorjstebbins <[email protected]>2011-08-12 22:00:51 +0000
committerjstebbins <[email protected]>2011-08-12 22:00:51 +0000
commit5fe02b451576dbf5c914126aae1b982f6d07c4f8 (patch)
tree36e6233f5d63e0f43f9c9ef9bfdf16780e8b1af2 /libhb
parentc7dc5e69f2244206a41dea18a2f4c502c25bafb4 (diff)
libhb: fix setting Libav codec private options
and logging of Libav advanced options. Thanks to Rodeo for spotting git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@4170 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'libhb')
-rw-r--r--libhb/encavcodec.c6
-rw-r--r--libhb/encavcodecaudio.c17
-rw-r--r--libhb/hb.c14
-rw-r--r--libhb/hbffmpeg.h1
-rw-r--r--libhb/work.c9
5 files changed, 37 insertions, 10 deletions
diff --git a/libhb/encavcodec.c b/libhb/encavcodec.c
index c613fa717..965752aa9 100644
--- a/libhb/encavcodec.c
+++ b/libhb/encavcodec.c
@@ -196,13 +196,15 @@ int encavcodecInit( hb_work_object_t * w, hb_job_t * job )
}
/* Here's where the strings are passed to avutil for parsing. */
- ret = av_set_string3( context, name, value, 1, NULL );
+ ret = hb_av_set_string( context, codec, name, value );
/* Let avutil sanity check the options for us*/
if( ret == AVERROR_OPTION_NOT_FOUND )
hb_log( "avcodec options: Unknown option %s", name );
+
if( ret == AVERROR(EINVAL) )
- hb_log( "avcodec options: Bad argument %s=%s", name, value ? value : "(null)" );
+ hb_log( "avcodec options: Bad argument %s=%s",
+ name, value ? value : "(null)" );
}
}
free(opts_start);
diff --git a/libhb/encavcodecaudio.c b/libhb/encavcodecaudio.c
index ebf2fd8f2..92d2e36d6 100644
--- a/libhb/encavcodecaudio.c
+++ b/libhb/encavcodecaudio.c
@@ -58,12 +58,17 @@ static int encavcodecaInit( hb_work_object_t * w, hb_job_t * job )
}
context = avcodec_alloc_context3(codec);
- int ret = av_set_string3( context, "stereo_mode", "ms_off", 1, NULL );
- /* Let avutil sanity check the options for us*/
- if( ret == AVERROR(ENOENT) )
- hb_log( "avcodec options: Unknown option %s", "stereo_mode" );
- if( ret == AVERROR(EINVAL) )
- hb_log( "avcodec options: Bad argument %s=%s", "stereo_mode", "ms_off" ? "ms_off" : "(null)" );
+ if ( w->codec_param == CODEC_ID_AAC )
+ {
+ int ret = hb_av_set_string( context, codec, "stereo_mode", "ms_off" );
+ /* Let avutil sanity check the options for us*/
+ if( ret == AVERROR_OPTION_NOT_FOUND )
+ hb_log( "avcodec options: Unknown option %s", "stereo_mode" );
+
+ if( ret == AVERROR(EINVAL) )
+ hb_log( "avcodec options: Bad argument %s=%s",
+ "stereo_mode", "ms_off" ? "ms_off" : "(null)" );
+ }
context->channel_layout = AV_CH_LAYOUT_STEREO;
switch( audio->config.out.mixdown )
diff --git a/libhb/hb.c b/libhb/hb.c
index d3d1d5668..f9bbcdc83 100644
--- a/libhb/hb.c
+++ b/libhb/hb.c
@@ -127,6 +127,20 @@ int hb_avcodec_close(AVCodecContext *avctx)
return ret;
}
+int hb_av_set_string( AVCodecContext *c, AVCodec *codec, const char *name, const char *val )
+{
+ void * priv_context = NULL;
+
+ if ( c && codec && codec->priv_class && c->priv_data )
+ priv_context = c->priv_data;
+
+ int ret = av_set_string3( c, name, val, 1, NULL );
+ if ( ret == AVERROR_OPTION_NOT_FOUND && priv_context )
+ ret = av_set_string3( priv_context, name, val, 1, NULL );
+
+ return ret;
+}
+
static int handle_jpeg(enum PixelFormat *format)
{
switch (*format) {
diff --git a/libhb/hbffmpeg.h b/libhb/hbffmpeg.h
index 21108211e..495e90e67 100644
--- a/libhb/hbffmpeg.h
+++ b/libhb/hbffmpeg.h
@@ -18,3 +18,4 @@ hb_sws_get_context(int srcW, int srcH, enum PixelFormat srcFormat,
int dstW, int dstH, enum PixelFormat dstFormat,
int flags);
void hb_ff_set_sample_fmt(AVCodecContext *context, AVCodec *codec);
+int hb_av_set_string( AVCodecContext *c, AVCodec *codec, const char *name, const char *val );
diff --git a/libhb/work.c b/libhb/work.c
index 9ab11fec9..035d9c664 100644
--- a/libhb/work.c
+++ b/libhb/work.c
@@ -291,8 +291,6 @@ void hb_display_job_info( hb_job_t * job )
case HB_VCODEC_X264:
hb_log( " + encoder: x264" );
- if( job->advanced_opts != NULL && *job->advanced_opts != '\0' )
- hb_log( " + options: %s", job->advanced_opts);
break;
case HB_VCODEC_THEORA:
@@ -300,6 +298,13 @@ void hb_display_job_info( hb_job_t * job )
break;
}
+ if ( job->advanced_opts && *job->advanced_opts &&
+ ( ( job->vcodec & HB_VCODEC_FFMPEG_MASK ) ||
+ job->vcodec == HB_VCODEC_X264 ) )
+ {
+ hb_log( " + options: %s", job->advanced_opts);
+ }
+
if( job->vquality >= 0 )
{
hb_log( " + quality: %.2f %s", job->vquality, job->vcodec == HB_VCODEC_X264 ? "(RF)" : "(QP)" );