diff -aur -x .o -x '~' old/advancecomp-1.9/remng.cc new/advancecomp-1.9/remng.cc --- old/advancecomp-1.9/remng.cc 2003-11-02 21:10:03.000000000 +0100 +++ new/advancecomp-1.9/remng.cc 2004-01-19 03:54:06.000000000 +0100 @@ -667,7 +667,7 @@ // -------------------------------------------------------------------------- // Extract -void extract(const string& path_src) { +void extract(const string& path_src, int nframe) { adv_fz* f_in; adv_mng* mng; adv_fz* f_out; @@ -722,48 +722,61 @@ first_tick = 1; } - ostringstream path_dst; - path_dst << base << "-"; + if ((nframe == -1) || (counter == nframe)) { - // not optimal code for g++ 2.95.3 - path_dst.setf(ios::right, ios::adjustfield); + ostringstream path_dst; - path_dst << setw(8) << setfill('0') << counter; - path_dst << ".png"; - - if (!opt_quiet) { - cout << path_dst.str() << endl; - } - - f_out = fzopen(path_dst.str().c_str(), "wb"); - if (!f_out) { - fzclose(f_in); - throw error() << "Failed open for writing " << path_dst.str(); - } - - ++counter; + if (nframe == -1) { + path_dst << base << "-"; + // not optimal code for g++ 2.95.3 + path_dst.setf(ios::right, ios::adjustfield); + path_dst << setw(8) << setfill('0') << counter; + } else { + path_dst << base; + } + + path_dst << ".png"; + + if (!opt_quiet) { + cout << path_dst.str() << endl; + } + + f_out = fzopen(path_dst.str().c_str(), "wb"); + if (!f_out) { + fzclose(f_in); + throw error() << "Failed open for writing " << path_dst.str(); + } #if 1 - // convert to 4 byte RGBA format. - // mencoder 0.90 has problems with 3 byte RGB format. - png_convert_4(pix_width, pix_height, pix_pixel, pix_ptr, pix_scanline, pal_ptr, pal_size, &dst_ptr, &dst_pixel, &dst_scanline); + // convert to 4 byte RGBA format. + // mencoder 0.90 has problems with 3 byte RGB format. + png_convert_4(pix_width, pix_height, pix_pixel, pix_ptr, pix_scanline, pal_ptr, pal_size, &dst_ptr, &dst_pixel, &dst_scanline); - png_write(f_out, pix_width, pix_height, dst_pixel, dst_ptr, dst_scanline, 0, 0, 0, 0, opt_level); + png_write(f_out, pix_width, pix_height, dst_pixel, dst_ptr, dst_scanline, 0, 0, 0, 0, opt_level); - free(dst_ptr); + free(dst_ptr); #else - png_write(f_out, pix_width, pix_height, pix_pixel, pix_ptr, pix_scanline, pal_ptr, pal_size, 0, 0, opt_level); + png_write(f_out, pix_width, pix_height, pix_pixel, pix_ptr, pix_scanline, pal_ptr, pal_size, 0, 0, opt_level); #endif - fzclose(f_out); + fzclose(f_out); + + + } + + if (nframe == counter) break; + ++counter; + } - cout << mng_frequency_get(mng) / (double)first_tick << endl; + if (nframe == -1) { + cout << mng_frequency_get(mng) / (double)first_tick << endl; - if (opt_verbose) { - cout << endl; - cout << "Example mencoder call:" << endl; - cout << "mencoder " << base << "-\\*.png -mf on:w=" << mng_width_get(mng) << ":h=" << mng_height_get(mng) << ":fps=" << mng_frequency_get(mng) / first_tick << ":type=png -ovc lavc -lavcopts vcodec=mpeg4:vbitrate=1000:vhq -o " << base << ".avi" << endl; + if (opt_verbose) { + cout << endl; + cout << "Example mencoder call:" << endl; + cout << "mencoder " << base << "-\\*.png -mf on:w=" << mng_width_get(mng) << ":h=" << mng_height_get(mng) << ":fps=" << mng_frequency_get(mng) / first_tick << ":type=png -ovc lavc -lavcopts vcodec=mpeg4:vbitrate=1000:vhq -o " << base << ".avi" << endl; + } } mng_done(mng); @@ -991,16 +1004,24 @@ void extract_all(int argc, char* argv[]) { for(int i=0;i