diff options
author | sr55 <[email protected]> | 2011-05-21 13:13:48 +0000 |
---|---|---|
committer | sr55 <[email protected]> | 2011-05-21 13:13:48 +0000 |
commit | baf266c1ab47c8f7308ad69b34d94561d06c64a7 (patch) | |
tree | e687e7a193864d67fd97fbbff028cccabcb554e2 | |
parent | 4da86152462698eab575dc00411e92f825bb1548 (diff) |
Remove the depreciated hb_calc_bitrate method
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@3987 b64f7644-9d1e-0410-96f1-a4d463321fa5
-rw-r--r-- | libhb/common.c | 115 | ||||
-rw-r--r-- | libhb/common.h | 2 | ||||
-rw-r--r-- | test/test.c | 13 |
3 files changed, 0 insertions, 130 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 diff --git a/libhb/common.h b/libhb/common.h index 295ef9241..14af50d8a 100644 --- a/libhb/common.h +++ b/libhb/common.h @@ -99,8 +99,6 @@ void hb_limit_rational64( int64_t *x, int64_t *y, int64_t num, int64_t den, int6 #define HB_KEEP_HEIGHT 1 void hb_fix_aspect( hb_job_t * job, int keep ); -int hb_calc_bitrate( hb_job_t *, int size ); - hb_audio_t *hb_audio_copy(const hb_audio_t *src); void hb_audio_config_init(hb_audio_config_t * audiocfg); int hb_audio_add(const hb_job_t * job, const hb_audio_config_t * audiocfg); diff --git a/test/test.c b/test/test.c index 7cf65a5cf..e1f2bc29a 100644 --- a/test/test.c +++ b/test/test.c @@ -95,7 +95,6 @@ static int crop[4] = { -1,-1,-1,-1 }; static int vrate = 0; static float vquality = -1.0; static int vbitrate = 0; -static int size = 0; static int mux = 0; static int anamorphic_mode = 0; static int modulus = 0; @@ -1962,13 +1961,6 @@ static int HandleEvents( hb_handle_t * h ) i++; } - if( size ) - { - job->vbitrate = hb_calc_bitrate( job, size ); - fprintf( stderr, "Calculated bitrate: %d kbps\n", - job->vbitrate ); - } - if( subtracks ) { char * token; @@ -2498,7 +2490,6 @@ static void ShowHelp() " same style as mencoder (x264 and ffmpeg only):\n" " option1=value1:option2=value2\n" " -q, --quality <number> Set video quality\n" - " -S, --size <MB> Set target size\n" " -b, --vb <kb/s> Set video bitrate (default: 1000)\n" " -2, --two-pass Use two-pass mode\n" " -T, --turbo When using 2-pass use the turbo options\n" @@ -2885,7 +2876,6 @@ static int ParseOptions( int argc, char ** argv ) { "vb", required_argument, NULL, 'b' }, { "quality", required_argument, NULL, 'q' }, - { "size", required_argument, NULL, 'S' }, { "ab", required_argument, NULL, 'B' }, { "rate", required_argument, NULL, 'r' }, { "arate", required_argument, NULL, 'R' }, @@ -3294,9 +3284,6 @@ static int ParseOptions( int argc, char ** argv ) case 'q': vquality = atof( optarg ); break; - case 'S': - size = atoi( optarg ); - break; case 'B': if( optarg != NULL ) { |