Hi,
I'm trying to feed mpeg 1 layer 2 data from satellite into Icecast, after recoding to layer 3. LAME codes data ok, but I don't understand quite clearly, how to use LAME's own decoder, so I have to use another library for decoding, which violates KISS principle.


I've got rather small chunk of data from satellite, 5376 bytes in length. mpg123 plays it ok, and command-line frontend to LAME recodes it to mp3 fine, too, but when I'm trying to decode it ``by hands'', using code below, debugger shows that decoder found correct header(bitrate, samplerate, number of channels, frame length), but returned 0 samples. What am I doing wrong?

/* "tst" is 5376 bytes long file. */
#include <fcntl.h>
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <lame/lame.h>

char buf[5376];
short left[1024000], right[1024000];

int main(void) {
int cnt, cnt2, fid1 = open("tst", O_RDONLY);
lame_global_flags *gf = lame_init();
mp3data_struct mpd;

lame_set_decode_only(gf, 1); lame_init_params(gf); lame_decode_init();
cnt = read(fid1, buf, 5376); cnt2 = lame_decode_headers(buf, cnt, left, right, &mpd);
return 0;
}


_______________________________________________
mp3encoder mailing list
[EMAIL PROTECTED]
http://minnie.tuhs.org/mailman/listinfo/mp3encoder

Reply via email to