Skip to content

Commit

Permalink
#445: x265 encoding support
Browse files Browse the repository at this point in the history
git-svn-id: https://xpra.org/svn/Xpra/trunk@5562 3bb7dfac-3a0b-4e04-842a-767bc560f471
  • Loading branch information
totaam committed Feb 23, 2014
1 parent a1dab1e commit a014ff7
Show file tree
Hide file tree
Showing 7 changed files with 543 additions and 8 deletions.
24 changes: 24 additions & 0 deletions src/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,9 @@

enc_proxy_ENABLED = True
enc_x264_ENABLED = True
enc_x265_ENABLED = False
x264_static_ENABLED = False
x265_static_ENABLED = False
vpx_ENABLED = True
vpx_static_ENABLED = False
dec_avcodec_ENABLED = True
Expand All @@ -79,6 +81,7 @@

#allow some of these flags to be modified on the command line:
SWITCHES = ("enc_x264", "x264_static",
"enc_x265", "x265_static",
"nvenc",
"dec_avcodec", "avcodec_static",
"dec_avcodec2", "avcodec2_static",
Expand Down Expand Up @@ -520,6 +523,7 @@ def pkgconfig(*packages_options, **ekw):
"xpra/codecs/nvenc/encoder.c",
"xpra/codecs/nvenc/constants.pxi",
"xpra/codecs/enc_x264/encoder.c",
"xpra/codecs/enc_x265/encoder.c",
"xpra/codecs/dec_avcodec/decoder.c",
"xpra/codecs/dec_avcodec/constants.pxi",
"xpra/codecs/dec_avcodec2/decoder.c",
Expand Down Expand Up @@ -637,6 +641,11 @@ def glob_recurse(srcdir):
libffmpeg_include_dir = os.path.join(libffmpeg_path, "include")
libffmpeg_lib_dir = os.path.join(libffmpeg_path, "lib")
libffmpeg_bin_dir = os.path.join(libffmpeg_path, "bin")
#x265
x265_path ="C:\\x265"
x265_include_dir = x265_path
x265_lib_dir = x265_path
x265_bin_dir = x265_path
#x264 (direct from build dir.. yuk - sorry!):
x264_path ="C:\\x264"
x264_include_dir = x264_path
Expand Down Expand Up @@ -717,6 +726,14 @@ def add_to_PATH(bindir):
add_to_keywords(kw, 'extra_link_args', "/LIBPATH:%s" % x264_lib_dir)
add_to_keywords(kw, 'extra_link_args', "/OPT:NOREF")
checkdirs(x264_include_dir, x264_lib_dir)
elif "x265" in packages[0]:
add_to_PATH(libffmpeg_bin_dir)
add_to_PATH(x265_bin_dir)
add_to_keywords(kw, 'include_dirs', win32_include_dir, x265_include_dir)
add_to_keywords(kw, 'libraries', "libx265")
add_to_keywords(kw, 'extra_link_args', "/LIBPATH:%s" % x265_lib_dir)
add_to_keywords(kw, 'extra_link_args', "/OPT:NOREF")
checkdirs(x265_include_dir, x265_lib_dir)
elif "vpx" in packages[0]:
add_to_PATH(libffmpeg_bin_dir)
add_to_keywords(kw, 'include_dirs', win32_include_dir, vpx_include_dir)
Expand Down Expand Up @@ -1090,6 +1107,13 @@ def pkgconfig(*packages_options, **ekw):
["xpra/codecs/enc_x264/encoder.pyx"],
**x264_pkgconfig), min_version=(0, 16))

toggle_packages(enc_x265_ENABLED, "xpra.codecs.enc_x265")
if enc_x265_ENABLED:
x265_pkgconfig = pkgconfig("x265", static=x265_static_ENABLED)
cython_add(Extension("xpra.codecs.enc_x265.encoder",
["xpra/codecs/enc_x265/encoder.pyx"],
**x265_pkgconfig), min_version=(0, 16))

toggle_packages(dec_avcodec_ENABLED, "xpra.codecs.dec_avcodec")
if dec_avcodec_ENABLED:
make_constants("xpra", "codecs", "dec_avcodec", "constants")
Expand Down
8 changes: 3 additions & 5 deletions src/tests/xpra/codecs/test_enc_x264.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,15 @@

from tests.xpra.codecs.test_encoder import test_encoder, test_performance

TEST_DIMENSIONS = ((32, 32), (1920, 1080), (512, 512))

def test_nvenc():
print("test_nvenc()")
def test_enc_x264():
print("test_enc_x264()")
from xpra.codecs.enc_x264 import encoder #@UnresolvedImport
test_encoder(encoder)
test_performance(encoder)


def main():
test_nvenc()
test_enc_x264()


if __name__ == "__main__":
Expand Down
21 changes: 21 additions & 0 deletions src/tests/xpra/codecs/test_enc_x265.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/usr/bin/env python
# This file is part of Xpra.
# Copyright (C) 2013 Antoine Martin <[email protected]>
# Xpra is released under the terms of the GNU GPL v2, or, at your option, any
# later version. See the file COPYING for details.

from tests.xpra.codecs.test_encoder import test_encoder, test_performance

def test_enc_x265():
print("test_enc_x265()")
from xpra.codecs.enc_x265 import encoder #@UnresolvedImport
test_encoder(encoder)
test_performance(encoder)


def main():
test_enc_x265()


if __name__ == "__main__":
main()
4 changes: 4 additions & 0 deletions src/xpra/codecs/enc_x265/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# This file is part of Xpra.
# Copyright (C) 2014 Antoine Martin <[email protected]>
# Xpra is released under the terms of the GNU GPL v2, or, at your option, any
# later version. See the file COPYING for details.
Loading

0 comments on commit a014ff7

Please sign in to comment.