bugfixes.
[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.$ac_ext << 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 main (int argc, char*argv[])
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 EOF
68
69 ac_link='$CXX $CPPFLAGS $CXXFLAGS `avifile-config --cflags` `avifile-config --libs` conftest.$ac_ext -o conftest${ac_exeext}'
70 ##if {(eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
71 if { (eval echo avi2swf.m4:71: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
72   AC_MSG_RESULT(yes)
73   AVIFILE=true
74   export AVIFILE
75   AC_DEFINE_UNQUOTED(AVIFILE, true)
76 else
77   echo "configure: failed program was:" >&5
78   cat conftest.$ac_ext >&5
79   AC_MSG_RESULT(no)
80 fi
81 rm -f conftest*
82 ])
83
84