From: Jorg S. <Jor...@gm...> - 2005-10-19 16:07:47
|
Hi Marc, > Yep, i succeed to transfer .ogg files into mp3 on my ipod.... ;) Great! > In fact i "hard-coded" the strings to convert the ogg file into wav and > wav into mp3. > > conversion->decoder="oggdec -o %T %f"; > conversion->encoder="lame --tt %t --ta %a %T %F"; > Where %T is the temporary file. > This executables are called thanks g_spawn_sync() function. > > The tricky part was to "fake" the size of the file with the "mp3-file" > size and not the "ogg-file" for the ipod because it seems that ipod is > using this size to stop playing (guess in fact it's more due to > pre-buffering with next file). That shouldn't be difficult: just call mp3_get_file_info()/wav_get_file_info()/mp4_get_file_info() and copy the relevant information. I assume ogg_get_file_info() now exists as well? > I added the vorbisinfo library to get "tags" (and bitrate,lenght) from > an ogg file, and i ammended th_copy to preform the conversion. Then you should make ogg support optional (see mp4file.c for details). > I tried to make a cvs update but the directory organisation changed so > i will do a full "cvs co" and then merge my patches. > > As you said, we can use "extern scripts" that will > perform the conversion so i will look at it. About parameters to be > passed to scripts, we "only" need: > - input file (i.e. ogg file) > - output file (i.e. mp3 file) I don't like the decoder/encoder concept -- sometimes you may need it, at other times the conversion may be possible right away. A script will probably be better, but we need know somehow what the conversion will lead to. I see two possibilities: 1) The script tells us (call 'script -output_format') 2) User specifies in the prefs 3) Combination: prefs window tries to identify output by script name, but user can override. > The status of the result will be given by the return code (0=ok, else = > error). This way no parsing is required. > > Rq: in my version, tags could be passed to the encoder (if fed by > vorbisinfo library) but all this stuff could be done in the script, > i.e.: > - call ogginfo to get tags > - call oggdec to transform into wav > - call lame to encode into mp3 with tags > This way process in gtkpod will be lighted. > > The output file will be 'unlinked' when transfer to ipod is complete > (currently done), and any temporary file (wav) should be unlinked by > the script itself. Ack. > About the script themselves, i'm not very familiar with sh but > really-more with PERL. Do you think it's more portable to write sh > scripts ? (rq: i can first do a "PERL" version to develop and once this > is ok convert it to sh). sh should be easier (my preference, since some people do not even have pearl installed). You will just call a number of commands, so pearl is overkill... > So my action plan is the following: > - get the "newest" CVS version > - merge my changes > - do a script version (PERL) > - migrate to a sh-script version > - optimize (for speed: when copying a lot of stuff, launch the > conversions (uses a lot of CPU) at the beginning to allow "simple-copy" > to be done in parallel (uses more i/o than CPU) and then perform copy > of conveted tracks). > > I hope to have something working (i.e. with PERL-script) the next week. > Any comment/remark is welcome. Looking forward to your patches! Optimization would probably be that the conversion starts in the background as soon as you add the track to an IPOD itdb. But don't worry about that stuff yet... You should worry about provisions for future other conversions, however: flac and maybe even wav. Cheers, JCS. PS: I copy to gtkpod-devel -- maybe someone there has some opinion as well. |