Debian Codegraph @

libavqt/testcodecs.cpp

raw symbols SCIP
1 /**
2 *
3 * Test sample for checking memory leaks in codec quering
4 *
5 * It's good idea to use single threaded operation mode
6 * so modify Cache.cpp to no use thread for precaching #define NOTHREADS
7 *
8 */
9
10 #include <image.h>
11 #include <avm_except.h>
12 #include <avm_creators.h>
13 #include <avm_fourcc.h>
14 #include <infotypes.h>
15 #include <videoencoder.h>
16
17 #include <stdio.h>
18
19 #define __MODULE__ "testcl"
20
21 #include "codecdialog.h"
22
23 #include <qapplication.h>
24
25 int main(int argc, char** argv)
26 {
27
28 BITMAPINFOHEADER bih;
29 bih.biCompression = 0xffffffff;
30 // just to fill video_codecs list
31 avm::CreateDecoderVideo(bih, 0, 0);
32 avm::vector<const avm::CodecInfo*> codecs;
33
34 QApplication a( argc, argv );
35
36 QavmCodecDialog* m = new QavmCodecDialog( 0, codecs );
37
38 return m->exec();
39 //a.setMainWidget(m);
40 return a.exec();
41
42
43 for(int round = 0; round < 5; round++)
44 {
45 int i = 0;
46 avm::VideoEncoderInfo _info;
47 avm::vector<avm::CodecInfo>::iterator it;
48 avm::vector<avm::CodecInfo> private_list;
49 private_list.clear();
50 fourcc_t fcc = 24;
51 switch (round % 3)
52 {
53 case 1: fcc = fccYUY2; break;
54 case 2: fcc = fccYV12; break;
55 }
56 avm::BitmapInfo bi(160, 120, fcc);
57 printf("VideoCodes list size: %d\n", video_codecs.size());
58 for (it = video_codecs.begin(); it != video_codecs.end(); it++)
59 {
60 if(!(it->direction & avm::CodecInfo::Encode))
61 continue;
62 avm::IVideoEncoder* enc = avm::CreateEncoderVideo(it->fourcc, bi);
63 // checking if this code is the one we have asked for...
64 if (!enc)
65 continue;
66 bool ok = (strcmp(it->GetName(), enc->GetCodecInfo().GetName()) == 0);
67 avm::FreeEncoderVideo(enc);
68 if (!ok)
69 continue;
70 private_list.push_back(*it);
71 i++;
72 }
73
74 printf("round: %d (fcc: %d) found: %d\n", round, fcc, i);
75 }
76 return 0;
77 }