Update the changelog
[opencv] / tests / 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 import python
14 from python.highgui import *
15 from python.cv import *
16
17
18 # some defines
19 TESTNAME = "cvCreateFileCapture"
20 REQUIRED = []
21 PREFIX   = os.environ["top_srcdir"]+"/tests/python/testdata/videos/qcif_"
22 EXTENSION= ".avi"
23
24
25 # this functions tries to open a videofile
26 # using the filename PREFIX+FORMAT+.EXTENSION  and returns True/False 
27 # on success/fail.
28
29 def video_ok( FORMAT ):
30         
31         # check requirements and delete old .works file
32         if not works.check_files( REQUIRED, TESTNAME+FORMAT ):
33                 return false
34
35         filename = PREFIX+FORMAT+EXTENSION
36         video = cvCreateFileCapture(PREFIX+FORMAT+EXTENSION)
37         if video is None:
38                 sys.exit(1)
39         works.set_file( TESTNAME+FORMAT )
40         return True