summaryrefslogtreecommitdiff
path: root/server/liblame_wrapper.cc
diff options
context:
space:
mode:
Diffstat (limited to 'server/liblame_wrapper.cc')
-rw-r--r--server/liblame_wrapper.cc29
1 files changed, 14 insertions, 15 deletions
diff --git a/server/liblame_wrapper.cc b/server/liblame_wrapper.cc
index 137ac6a..9bac35b 100644
--- a/server/liblame_wrapper.cc
+++ b/server/liblame_wrapper.cc
@@ -27,14 +27,13 @@
#include <config.h>
#include "liblame_wrapper.h"
#include "miav_config.h"
+#include "info.h"
-LibLAMEWrapper::LibLAMEWrapper(Info *i)
+LibLAMEWrapper::LibLAMEWrapper()
{
- info = i;
-
// Init library.
if( (gfp = lame_init()) == NULL) {
- info->error("LAME initialization failed (due to malloc failure!)");
+ MIaV::info->error("LAME initialization failed (due to malloc failure!)");
return;
}
@@ -72,7 +71,7 @@ LibLAMEWrapper::LibLAMEWrapper(Info *i)
if (lame_init_params(gfp) < 0) {
- info->error("LAME parameter initialization failed.");
+ MIaV::info->error("LAME parameter initialization failed.");
return;
}
@@ -193,24 +192,24 @@ Frame *LibLAMEWrapper::encode(Frame *dvframe)
val = lame_encode_buffer(gfp, buffer_l, buffer_r, nsamples, mp3buf, mp3buf_size);
// val = lame_encode_mp3_frame(gfp, buffer_l, buffer_r, mp3buf, mp3buf_size);
- // info->info("Framenr: %d", lame_get_frameNum(gfp));
+ // MIaV::info->info("Framenr: %d", lame_get_frameNum(gfp));
if(val < 0) {
switch(val) {
case -1: // mp3buf was too small
- info->error("Lame encoding failed, mp3buf was too small.");
+ MIaV::info->error("Lame encoding failed, mp3buf was too small.");
break;
case -2: // malloc() problem
- info->error("Lame encoding failed, due to malloc() problem.");
+ MIaV::info->error("Lame encoding failed, due to malloc() problem.");
break;
case -3: // lame_init_params() not called
- info->error("Lame encoding failed, lame_init_params() not called.");
+ MIaV::info->error("Lame encoding failed, lame_init_params() not called.");
break;
case -4: // psycho acoustic problems
- info->error("Lame encoding failed, due to psycho acoustic problems.");
+ MIaV::info->error("Lame encoding failed, due to psycho acoustic problems.");
break;
default:
- info->error("Lame encoding failed, due to unknown error.");
+ MIaV::info->error("Lame encoding failed, due to unknown error.");
break;
}
}
@@ -241,7 +240,7 @@ Frame *LibLAMEWrapper::encode(Frame *dvframe)
mp3buf_size - val); // number of valid octets in this stream
*/
- // info->info("VAL: %d - FLUSH_SZ: %d - TOTAL: %d", val, flush_sz, (val + flush_sz));
+ // MIaV::info->info("VAL: %d - FLUSH_SZ: %d - TOTAL: %d", val, flush_sz, (val + flush_sz));
audio_frame->size = val + flush_sz;
@@ -251,7 +250,7 @@ Frame *LibLAMEWrapper::encode(Frame *dvframe)
// 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",
+ MIaV::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],
@@ -272,14 +271,14 @@ Frame *LibLAMEWrapper::encode(Frame *dvframe)
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);
+ // MIaV::info->info("lame_get_frameNum(gfp) %d ?= frame_number %d", lame_get_frameNum(gfp), frame_number);
// }
// Bits pr. second
// 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",
+ MIaV::info->info("Audio size: %d, bitrate: %.4f",
audio_frame->bitrate,
(float)(config->readInt("mp3_bitrate") * 1000)/(float)(audio_frame->bitrate));
*/