|
| 1 | +import os |
| 2 | + |
| 3 | +# Check if environment is setup to run the tests |
| 4 | +if os.environ.get('AVTRANSCODER_TEST_VIDEO_MOV_FILE') is None: |
| 5 | + from nose.plugins.skip import SkipTest |
| 6 | + raise SkipTest("Need to define environment variables " |
| 7 | + "AVTRANSCODER_TEST_VIDEO_MOV_FILE") |
| 8 | + |
| 9 | +from nose.tools import * |
| 10 | + |
| 11 | +from pyAvTranscoder import avtranscoder as av |
| 12 | + |
| 13 | + |
| 14 | +@raises(IOError) |
| 15 | +def testCreateInputFileFromUnexistingFilename(): |
| 16 | + """ |
| 17 | + Create an InputFile from an unexisting filename. |
| 18 | + """ |
| 19 | + inputFileName = "testCreateInputFileFromUnexistingFilename" |
| 20 | + av.InputFile( inputFileName ) |
| 21 | + |
| 22 | + |
| 23 | +def testInputFileAnalyseFirstGop(): |
| 24 | + """ |
| 25 | + Analyse the first gop of an InputFile, and check if the correct attributes are filled. |
| 26 | + """ |
| 27 | + inputFileName = os.environ['AVTRANSCODER_TEST_VIDEO_MOV_FILE'] |
| 28 | + inputFile = av.InputFile( inputFileName ) |
| 29 | + |
| 30 | + # The analyse of the first GOP is not done yet |
| 31 | + videoProperties = inputFile.getProperties().getVideoProperties()[0] |
| 32 | + assert_equals(videoProperties.isInterlaced(), False) |
| 33 | + assert_equals(videoProperties.isTopFieldFirst(), False) |
| 34 | + assert_equals(videoProperties.getGopStructure(), ()) |
| 35 | + |
| 36 | + # Analyse first GOP |
| 37 | + progress = av.NoDisplayProgress() |
| 38 | + inputFile.analyse( progress, av.eAnalyseLevelFirstGop ) |
| 39 | + |
| 40 | + # Check properties after GOP analysis |
| 41 | + videoProperties = inputFile.getProperties().getVideoProperties()[0] |
| 42 | + assert_not_equals(videoProperties.getGopStructure(), ()) |
0 commit comments