include memory.h
[swftools.git] / m4 / avi2swf.m4
1 AC_DEFUN(RFX_CHECK_AVI2SWF,
2 [
3 AC_MSG_CHECKING([whether we can compile the avifile test program])
4
5 cat > conftest.cpp << EOF
6 #include <avifile/version.h>
7 #if (AVIFILE_MAJOR_VERSION == 0) && (AVIFILE_MINOR_VERSION>=6) 
8    #include <avifile.h>
9    #include <aviplay.h>
10    #include <fourcc.h>
11    #include <creators.h>
12    #include <StreamInfo.h>
13    #define VERSION6
14 #else
15    #include <avifile.h>
16    #include <aviplay.h>
17    #include <aviutil.h>
18    #define Width width
19    #define Height height
20    #define Data data
21    #define Bpp bpp
22 #endif
23
24 int test()
25 {
26   IAviReadFile* player;
27   IAviReadStream* astream;
28   IAviReadStream* vstream;
29   player = CreateIAviReadFile(0);
30   astream = player->GetStream(0, AviStream::Audio);
31   vstream = player->GetStream(0, AviStream::Video);
32   vstream -> StartStreaming();
33   astream -> StartStreaming();
34 #ifndef VERSION6
35   MainAVIHeader head;
36   player->GetFileHeader(&head);
37   head.dwMicroSecPerFrame;
38   head.dwTotalFrames;
39   head.dwStreams;
40   head.dwWidth;
41   head.dwHeight;
42   head.dwMicroSecPerFrame;
43   astream->GetEndPos(),
44   astream->GetEndTime());
45   player->StreamCount();
46 #else
47   StreamInfo*audioinfo;
48   StreamInfo*videoinfo;
49   audioinfo = astream->GetStreamInfo();
50   videoinfo = vstream->GetStreamInfo();
51   videoinfo->GetVideoWidth();
52   videoinfo->GetVideoHeight();
53   audioinfo->GetAudioSamplesPerSec();
54   videoinfo->GetFps();
55 #endif
56   CImage*img = vstream->GetFrame();
57   img->ToRGB();
58   img->Data();
59   img->Bpp();
60   img->Width();
61   img->Height();
62   WAVEFORMATEX wave;
63   astream->GetAudioFormatInfo(&wave,0);
64   uint_t a,b;
65   astream->ReadFrames(0,0,0,a,b);
66 }
67 int main (int argc, char*argv[])
68 {
69     return 0;
70 }
71 EOF
72
73 ac_link='$CXX $CPPFLAGS $CXXFLAGS `avifile-config --cflags` `avifile-config --libs` conftest.cpp -o conftest${ac_exeext}'
74 ##if {(eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
75 if { (eval echo avi2swf.m4:71: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && ./conftest${ac_exeext}; then
76   AC_MSG_RESULT(yes)
77   AVIFILE=true
78   export AVIFILE
79   AC_DEFINE_UNQUOTED(AVIFILE, true)
80 else
81   echo "configure: failed program was:" >&5
82   cat conftest.$ac_ext >&5
83   AC_MSG_RESULT(no)
84 fi
85 rm -f conftest*
86 ])
87
88