Update to 2.0.0 tree from current Fremantle build
[opencv] / tests / swig_python / highgui / cvCreateFileCapture.py
1 """
2 This script will test highgui's video reading functionality
3 for a given parameter RAW formats.
4 """
5
6 # needed for sys.exit(int) and .works file handling
7 import os
8 import sys
9 import works
10 from works import *
11
12 # import the necessary things for OpenCV
13 from highgui import *
14 from cv import *
15
16
17 # some defines
18 TESTNAME = "cvCreateFileCapture"
19 REQUIRED = []
20 PREFIX   = os.path.join(os.environ["srcdir"],"../../opencv_extra/testdata/python/videos/qcif_")
21 EXTENSION= ".avi"
22
23
24 # this functions tries to open a videofile
25 # using the filename PREFIX+FORMAT+.EXTENSION  and returns True/False 
26 # on success/fail.
27
28 def video_ok( FORMAT ):
29         
30         # check requirements and delete old .works file
31         if not works.check_files( REQUIRED, TESTNAME+FORMAT ):
32                 return false
33
34         filename = PREFIX+FORMAT+EXTENSION
35         video = cvCreateFileCapture(PREFIX+FORMAT+EXTENSION)
36         if video is None:
37                 sys.exit(1)
38         works.set_file( TESTNAME+FORMAT )
39         return True