summaryrefslogtreecommitdiffstats
path: root/libhb/common.c
diff options
context:
space:
mode:
authorsr55 <[email protected]>2011-05-21 13:13:48 +0000
committersr55 <[email protected]>2011-05-21 13:13:48 +0000
commitbaf266c1ab47c8f7308ad69b34d94561d06c64a7 (patch)
treee687e7a193864d67fd97fbbff028cccabcb554e2 /libhb/common.c
parent4da86152462698eab575dc00411e92f825bb1548 (diff)
Remove the depreciated hb_calc_bitrate method
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@3987 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'libhb/common.c')
-rw-r--r--libhb/common.c115
1 files changed, 0 insertions, 115 deletions
diff --git a/libhb/common.c b/libhb/common.c
index b2581ec5e..731409e2b 100644
--- a/libhb/common.c
+++ b/libhb/common.c
@@ -562,121 +562,6 @@ void hb_fix_aspect( hb_job_t * job, int keep )
}
/**********************************************************************
- * hb_calc_bitrate
- **********************************************************************
- * size: in megabytes
- *********************************************************************/
-int hb_calc_bitrate( hb_job_t * job, int size )
-{
- int64_t avail = (int64_t) size * 1024 * 1024;
- int64_t length;
- int overhead;
- int samples_per_frame;
- int i;
-
- hb_title_t * title = job->title;
- hb_chapter_t * chapter;
- hb_audio_t * audio;
-
- /* How many overhead bytes are used for each frame
- (quite guessed) */
- switch( job->mux )
- {
- case HB_MUX_MP4:
- case HB_MUX_MKV:
- overhead = 6;
- break;
- default:
- return 0;
- }
-
- /* Get the duration in seconds */
- length = 0;
- for( i = job->chapter_start; i <= job->chapter_end; i++ )
- {
- chapter = hb_list_item( title->list_chapter, i - 1 );
- length += chapter->duration;
- }
- length += 135000;
- length /= 90000;
-
- if( size == -1 )
- {
- avail = job->vbitrate * 125 * length;
- avail += length * job->vrate * overhead / job->vrate_base;
- }
-
- /* Video overhead */
- avail -= length * job->vrate * overhead / job->vrate_base;
-
- if( size == -1 )
- {
- goto ret;
- }
-
- for( i = 0; i < hb_list_count(job->list_audio); i++ )
- {
- /* Audio data */
- int abitrate;
- audio = hb_list_item( job->list_audio, i);
-
- /* How many audio samples we put in each frame */
- switch( audio->config.out.codec )
- {
- case HB_ACODEC_FAAC:
- case HB_ACODEC_CA_AAC:
- case HB_ACODEC_VORBIS:
- samples_per_frame = 1024;
- break;
- case HB_ACODEC_LAME:
- samples_per_frame = 1152;
- break;
- case HB_ACODEC_AC3_PASS:
- case HB_ACODEC_DCA_PASS:
- case HB_ACODEC_AC3:
- case HB_ACODEC_DCA:
- samples_per_frame = 1536;
- break;
- case HB_ACODEC_CA_HAAC:
- samples_per_frame = 2048;
- break;
- default:
- return 0;
- }
-
- if( audio->config.out.codec == HB_ACODEC_AC3_PASS ||
- audio->config.out.codec == HB_ACODEC_DCA_PASS)
- {
- /*
- * For pass through we take the bitrate from the input audio
- * bitrate as we are simply passing it through.
- */
- abitrate = audio->config.in.bitrate / 8;
- }
- else
- {
- /*
- * Where we are transcoding the audio we use the destination
- * bitrate.
- */
- abitrate = audio->config.out.bitrate * 1000 / 8;
- }
- avail -= length * abitrate;
-
- /* Audio overhead */
- avail -= length * audio->config.out.samplerate * overhead / samples_per_frame;
- }
-
-ret:
- if( avail < 0 )
- {
- return 0;
- }
-
- return ( avail / ( 125 * length ) );
-}
-
-/**********************************************************************
* hb_list implementation
**********************************************************************
* Basic and slow, but enough for what we need