forked from avTranscoder/avTranscoder
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtestVideoFrame.py
More file actions
49 lines (39 loc) · 1.31 KB
/
Copy pathtestVideoFrame.py
File metadata and controls
49 lines (39 loc) · 1.31 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
from nose.tools import *
from pyAvTranscoder import avtranscoder as av
@raises(MemoryError)
def testInvalidVideoFrameAutoAllocated():
"""
Try to create an invalid VideoFrame automatically allocated.
"""
desc = av.VideoFrameDesc(1920, 1080, "toto")
av.VideoFrame(desc)
@raises(MemoryError)
def testInvalidVideoFrameManualAllocated():
"""
Try to create an invalid VideoFrame manually allocated.
"""
width = 1920
height = 1080
pixelFormat = "titi"
desc = av.VideoFrameDesc(width, height, pixelFormat)
frame = av.VideoFrame(desc, False)
assert_equals(frame.isDataAllocated(), False)
assert_equals(frame.getDataSize(), 0)
assert_equals(frame.getWidth(), width)
assert_equals(frame.getHeight(), height)
assert_equals(av.getPixelFormatName(frame.getPixelFormat()), "")
frame.allocateData()
def testVideoFrame():
"""
Check the size and the data buffer of a VideoFrame.
"""
width = 1920
height = 1080
pixelFormat = "yuv420p"
desc = av.VideoFrameDesc(width, height, pixelFormat)
frame = av.VideoFrame(desc)
assert_equals(frame.isDataAllocated(), True)
assert_equals(frame.isVideoFrame(), True)
assert_equals(frame.getDataSize(), width * height * 1.5)
frame.freeData()
assert_equals(frame.isDataAllocated(), False)