File: test_containerformat.py

package info (click to toggle)
python-av 16.0.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,684 kB
  • sloc: python: 7,607; sh: 182; ansic: 174; makefile: 135
file content (60 lines) | stat: -rw-r--r-- 1,987 bytes parent folder | download | duplicates (2)
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
50
51
52
53
54
55
56
57
58
59
60
from av import ContainerFormat, formats_available, open


def test_matroska() -> None:
    with open("test.mkv", "w") as container:
        assert container.default_video_codec != "none"
        assert container.default_audio_codec != "none"
        assert container.default_subtitle_codec == "ass"
        assert "ass" in container.supported_codecs

    fmt = ContainerFormat("matroska")
    assert fmt.is_input and fmt.is_output
    assert fmt.name == "matroska"
    assert fmt.long_name == "Matroska"
    assert "mkv" in fmt.extensions
    assert not fmt.no_file


def test_mov() -> None:
    with open("test.mov", "w") as container:
        assert container.default_video_codec != "none"
        assert container.default_audio_codec != "none"
        assert container.default_subtitle_codec == "none"
        assert "h264" in container.supported_codecs

    fmt = ContainerFormat("mov")
    assert fmt.is_input and fmt.is_output
    assert fmt.name == "mov"
    assert fmt.long_name == "QuickTime / MOV"
    assert "mov" in fmt.extensions
    assert not fmt.no_file


def test_gif() -> None:
    with open("test.gif", "w") as container:
        assert container.default_video_codec == "gif"
        assert container.default_audio_codec == "none"
        assert container.default_subtitle_codec == "none"
        assert "gif" in container.supported_codecs


def test_stream_segment() -> None:
    # This format goes by two names, check both.
    fmt = ContainerFormat("stream_segment")
    assert not fmt.is_input and fmt.is_output
    assert fmt.name == "stream_segment"
    assert fmt.long_name == "streaming segment muxer"
    assert fmt.extensions == set()
    assert fmt.no_file

    fmt = ContainerFormat("ssegment")
    assert not fmt.is_input and fmt.is_output
    assert fmt.name == "ssegment"
    assert fmt.long_name == "streaming segment muxer"
    assert fmt.extensions == set()
    assert fmt.no_file


def test_formats_available() -> None:
    assert formats_available