summaryrefslogtreecommitdiff
path: root/src/liblame_wrapper.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/liblame_wrapper.cc')
-rw-r--r--src/liblame_wrapper.cc44
1 files changed, 41 insertions, 3 deletions
diff --git a/src/liblame_wrapper.cc b/src/liblame_wrapper.cc
index 6d78380..08765b7 100644
--- a/src/liblame_wrapper.cc
+++ b/src/liblame_wrapper.cc
@@ -42,7 +42,8 @@ LibLAMEWrapper::LibLAMEWrapper(Info *i)
lame_set_out_samplerate(gfp, OUTPUT_SAMPLE_RATE);
lame_set_num_channels(gfp, CHANNELS);
- lame_set_num_samples(gfp, SAMPLES);
+ lame_set_num_samples(gfp, 1152);
+ // lame_set_num_samples(gfp, SAMPLES);
lame_set_quality(gfp, config->readInt("mp3_quality"));
lame_set_mode(gfp, STEREO);
@@ -79,6 +80,9 @@ LibLAMEWrapper::LibLAMEWrapper(Info *i)
// And now for the dv decoder!
decoder = NULL;
+
+ calc_bitrate = 0;
+ frame_number = 0;
}
LibLAMEWrapper::~LibLAMEWrapper()
@@ -195,9 +199,43 @@ Frame *LibLAMEWrapper::encode(Frame *dvframe)
mp3buf_size - val); // number of valid octets in this stream
audio_frame->size = val + flush_sz;
+ /*
+
+ int bitrate_kbps[14];
+ // lame_bitrate_kbps(gfp, bitrate_kbps);
+ lame_bitrate_hist(gfp, bitrate_kbps);
+ // 32 40 48 56 64 80 96 112 128 160 192 224 256 320
+ info->info("%d %d %d %d %d %d %d %d %d %d %d %d %d %d",
+ bitrate_kbps[0],
+ bitrate_kbps[1],
+ bitrate_kbps[2],
+ bitrate_kbps[3],
+ bitrate_kbps[4],
+ bitrate_kbps[5],
+ bitrate_kbps[6],
+ bitrate_kbps[7],
+ bitrate_kbps[8],
+ bitrate_kbps[9],
+ bitrate_kbps[10],
+ bitrate_kbps[11],
+ bitrate_kbps[12],
+ bitrate_kbps[13]);
+ */
+ // while(frame_number != lame_get_frameNum(gfp)) {
+
+ calc_bitrate += audio_frame->size;//lame_get_framesize(gfp);
+ frame_number ++;//= 1;//lame_get_frameNum(gfp);
+
+ // info->info("lame_get_frameNum(gfp) %d ?= frame_number %d", lame_get_frameNum(gfp), frame_number);
+ // }
// Bits pr. second
- audio_frame->bitrate = config->readInt("mp3_bitrate") * 1000;
-
+ // 25 * 7 frames pr.second (it seems!)
+ audio_frame->bitrate = (unsigned int)((double)calc_bitrate / (double)(frame_number)) * 25;
+ /*
+ info->info("Audio size: %d, bitrate: %.4f",
+ audio_frame->bitrate,
+ (float)(config->readInt("mp3_bitrate") * 1000)/(float)(audio_frame->bitrate));
+ */
return audio_frame;
}