Tentative 0.4.2 version
[Fobs.git] / test / reencoder.cpp
blob08bd8f5e75ffe01cf1894e805590d269cab628d2
1 /******************************************************************************
2 * FOBS Video API test application
3 * Copyright (c) 2004 Omnividea Multimedia S.L
4 * Coded by JosŽ San Pedro Wandelmer
6 * This file is part of FOBS.
8 * FOBS is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU Lesser General Public License as
10 * published by the Free Software Foundation; either version 2.1
11 * of the License, or (at your option) any later version.
13 * FOBS is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU Lesser General Public License for more details.
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with FOBS; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 ******************************************************************************/
23 #include "Transcoder.h"
24 #include <time.h>
25 #include <iostream>
26 #include <unistd.h>
28 using namespace omnividea::fobs;
29 using namespace std;
32 int main(int argc, char *argv[])
34 if(argc != 3)
36 cerr << "Syntax: "<<argv[0]<<" inputfile outputfile"<<endl;
37 return -1;
39 Transcoder d(argv[1], argv[2]);
40 Decoder dec = Decoder(argv[1]);
41 ReturnCode error = dec.open();
43 error = d.chooseFormat("avi");
44 if(!isOk(error))
46 cerr << "Format not supported" << endl;
48 error = d.chooseVideoCodec(300, 300, 600.0, dec.getFrameRate(), "mpeg4");
49 if(!isOk(error))
51 cerr << "Video codec not supported" << endl;
53 dec.close();
55 error = d.chooseAudioCodec(22050, 2, 32.0, "libmp3lame");
56 if(!isOk(error))
58 cerr << "Audio codec not supported" << endl;
61 cout << "Loop begin...\n";
62 clock_t time0 = clock();
63 error = d.transcode();
64 if(isError(error)) cout << "Error: " << getErrorMessage(error)<< endl;
65 clock_t timef = clock();
66 cout << "Loop end...Time spent= " << ((timef-time0)/(double)CLOCKS_PER_SEC) << endl;
70 return 0;