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