summaryrefslogtreecommitdiffstats
path: root/libhb
diff options
context:
space:
mode:
Diffstat (limited to 'libhb')
-rw-r--r--libhb/common.c115
-rw-r--r--libhb/common.h2
2 files changed, 0 insertions, 117 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);