summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRodeo <[email protected]>2012-07-15 17:37:27 +0000
committerRodeo <[email protected]>2012-07-15 17:37:27 +0000
commit62cbe39e294565f429411d8293aa64c41a9d1b30 (patch)
treeb4d32ca476e93b84c45b5a9dd2e5f3386cc09e3d
parentc171ef516b8df74903e38cf7c797c25303aff8be (diff)
Change a few more hb_log() calls to hb_error(), and some cosmetics.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@4840 b64f7644-9d1e-0410-96f1-a4d463321fa5
-rw-r--r--libhb/encavcodecaudio.c60
-rw-r--r--libhb/platform/macosx/encca_aac.c8
2 files changed, 35 insertions, 33 deletions
diff --git a/libhb/encavcodecaudio.c b/libhb/encavcodecaudio.c
index 37cb78769..28eb0d9ae 100644
--- a/libhb/encavcodecaudio.c
+++ b/libhb/encavcodecaudio.c
@@ -41,22 +41,20 @@ hb_work_object_t hb_encavcodeca =
encavcodecaClose
};
-static int encavcodecaInit( hb_work_object_t * w, hb_job_t * job )
+static int encavcodecaInit(hb_work_object_t *w, hb_job_t *job)
{
- AVCodec * codec;
- AVCodecContext * context;
- hb_audio_t * audio = w->audio;
+ AVCodec *codec;
+ AVCodecContext *context;
+ hb_audio_t *audio = w->audio;
- hb_work_private_t * pv = calloc( 1, sizeof( hb_work_private_t ) );
+ hb_work_private_t *pv = calloc(1, sizeof(hb_work_private_t));
w->private_data = pv;
-
pv->job = job;
- codec = avcodec_find_encoder( w->codec_param );
- if( !codec )
+ codec = avcodec_find_encoder(w->codec_param);
+ if (codec == NULL)
{
- hb_log( "encavcodecaInit: avcodec_find_encoder "
- "failed" );
+ hb_error("encavcodecaInit: avcodec_find_encoder() failed");
return 1;
}
context = avcodec_alloc_context3(codec);
@@ -78,40 +76,44 @@ static int encavcodecaInit( hb_work_object_t * w, hb_job_t * job )
av_dict_set(&av_opts, "dsur_mode", "on", 0);
}
- if( audio->config.out.bitrate > 0 )
+ if (audio->config.out.bitrate > 0)
+ {
context->bit_rate = audio->config.out.bitrate * 1000;
- else if( audio->config.out.quality >= 0 )
+ }
+ else if (audio->config.out.quality >= 0)
{
context->global_quality = audio->config.out.quality * FF_QP2LAMBDA;
context->flags |= CODEC_FLAG_QSCALE;
}
- if( audio->config.out.compression_level >= 0 )
+ if (audio->config.out.compression_level >= 0)
+ {
context->compression_level = audio->config.out.compression_level;
+ }
- // Try to set format to float. Fallback to whatever is supported.
- hb_ff_set_sample_fmt( context, codec );
+ // Try to set format to float; fall back to whatever is supported.
+ hb_ff_set_sample_fmt(context, codec);
- if( hb_avcodec_open( context, codec, &av_opts, 0 ) )
+ if (hb_avcodec_open(context, codec, &av_opts, 0))
{
- hb_log( "encavcodecaInit: avcodec_open failed" );
+ hb_error("encavcodecaInit: hb_avcodec_open() failed");
return 1;
}
// avcodec_open populates the opts dictionary with the
// things it didn't recognize.
AVDictionaryEntry *t = NULL;
- while( ( t = av_dict_get( av_opts, "", t, AV_DICT_IGNORE_SUFFIX ) ) )
+ while ((t = av_dict_get(av_opts, "", t, AV_DICT_IGNORE_SUFFIX)))
{
- hb_log( "encavcodecaInit: Unknown avcodec option %s", t->key );
+ hb_log("encavcodecaInit: Unknown avcodec option %s", t->key);
}
- av_dict_free( &av_opts );
+ av_dict_free(&av_opts);
// channel remapping
pv->remap = hb_audio_remap_init(context->channel_layout, &hb_libav_chan_map,
audio->config.in.channel_map);
if (pv->remap == NULL)
{
- hb_log("encavcodecaInit: hb_audio_remap_init() failed");
+ hb_error("encavcodecaInit: hb_audio_remap_init() failed");
}
// sample_fmt conversion
@@ -127,22 +129,22 @@ static int encavcodecaInit( hb_work_object_t * w, hb_job_t * job )
}
pv->context = context;
-
- audio->config.out.samples_per_frame = pv->samples_per_frame = context->frame_size;
+ pv->samples_per_frame = context->frame_size;
+ audio->config.out.samples_per_frame = pv->samples_per_frame;
pv->input_samples = pv->samples_per_frame * pv->out_discrete_channels;
// Set a reasonable maximum output size
- pv->output_bytes = context->frame_size *
- av_get_bytes_per_sample(context->sample_fmt) *
- context->channels;
+ pv->output_bytes = (context->channels * context->frame_size *
+ av_get_bytes_per_sample(context->sample_fmt));
- pv->buf = malloc( pv->input_samples * sizeof( float ) );
+ pv->buf = malloc(pv->input_samples * sizeof(float));
pv->list = hb_list_init();
- if ( context->extradata )
+ if (context->extradata)
{
- memcpy( w->config->extradata.bytes, context->extradata, context->extradata_size );
+ memcpy(w->config->extradata.bytes,
+ context->extradata, context->extradata_size);
w->config->extradata.length = context->extradata_size;
}
diff --git a/libhb/platform/macosx/encca_aac.c b/libhb/platform/macosx/encca_aac.c
index 8ee84276e..5c5069cd4 100644
--- a/libhb/platform/macosx/encca_aac.c
+++ b/libhb/platform/macosx/encca_aac.c
@@ -239,7 +239,7 @@ int encCoreAudioInit(hb_work_object_t *w, hb_job_t *job, enum AAC_MODE mode)
free(bitrates);
if (tmp != audio->config.out.bitrate * 1000)
{
- hb_log("encca_aac: sanitizing track %d audio bitrate %d to %"PRIu32"",
+ hb_log("encCoreAudioInit: sanitizing track %d audio bitrate %d to %"PRIu32"",
audio->config.out.track, audio->config.out.bitrate, tmp / 1000);
}
AudioConverterSetProperty(pv->converter,
@@ -250,7 +250,7 @@ int encCoreAudioInit(hb_work_object_t *w, hb_job_t *job, enum AAC_MODE mode)
{
if (mode != AAC_MODE_LC)
{
- hb_log("encCoreAudioInit: internal error, VBR set but not applicable");
+ hb_error("encCoreAudioInit: internal error, VBR set but not applicable");
return 1;
}
// set encoder bitrate control mode to variable
@@ -267,7 +267,7 @@ int encCoreAudioInit(hb_work_object_t *w, hb_job_t *job, enum AAC_MODE mode)
}
else
{
- hb_log("encCoreAudioInit: internal error, bitrate/quality not set");
+ hb_error("encCoreAudioInit: internal error, bitrate/quality not set");
return 1;
}
@@ -294,7 +294,7 @@ int encCoreAudioInit(hb_work_object_t *w, hb_job_t *job, enum AAC_MODE mode)
audio->config.in.channel_map);
if (pv->remap == NULL)
{
- hb_log("encCoreAudioInit: hb_audio_remap_init() failed");
+ hb_error("encCoreAudioInit: hb_audio_remap_init() failed");
}
// get maximum output size