Exemplo n.º 1
0
def load_codecs(encoders=True, decoders=True, csc=True):
    global loaded
    if loaded:
        return
    loaded = True
    show = []
    log("loading codecs")
    if encoders or decoders:
        codec_import_check("PIL", "Python Imaging Library", "PIL", "PIL", "Image")
        add_codec_version("PIL", "PIL.Image", "PILLOW_VERSION", "VERSION")

    if encoders:
        show += list(ENCODER_CODECS)
        codec_import_check("enc_pillow", "Pillow encoder", "xpra.codecs.pillow", "xpra.codecs.pillow.encode", "encode")
        add_codec_version("enc_pillow", "xpra.codecs.pillow.encode")

        if not OSX:
            #causes crashes with osx shadow servers, disabled in setup.py:
            codec_import_check("enc_vpx", "vpx encoder", "xpra.codecs.vpx", "xpra.codecs.vpx.encoder", "Encoder")
            add_codec_version("vpx", "xpra.codecs.vpx.decoder")

        codec_import_check("enc_x264", "x264 encoder", "xpra.codecs.enc_x264", "xpra.codecs.enc_x264.encoder", "Encoder")
        add_codec_version("x264", "xpra.codecs.enc_x264.encoder")

        codec_import_check("enc_x265", "x265 encoder", "xpra.codecs.enc_x265", "xpra.codecs.enc_x265.encoder", "Encoder")
        add_codec_version("x265", "xpra.codecs.enc_x265.encoder")

        for v in (7, ):
            codec_import_check("nvenc%s" % v, "nvenc encoder", "xpra.codecs.nvenc%s" % v, "xpra.codecs.nvenc%s.encoder" % v, "Encoder")
            add_codec_version("nvenc%s" % v, "xpra.codecs.nvenc%s.encoder" % v)

        codec_import_check("enc_ffmpeg", "ffmpeg encoder", "xpra.codecs.enc_ffmpeg", "xpra.codecs.enc_ffmpeg.encoder", "Encoder")
        add_codec_version("ffmpeg", "xpra.codecs.enc_ffmpeg.encoder")

    if csc:
        show += list(CSC_CODECS)
        codec_import_check("csc_swscale", "swscale colorspace conversion", "xpra.codecs.csc_swscale", "xpra.codecs.csc_swscale.colorspace_converter", "ColorspaceConverter")
        add_codec_version("swscale", "xpra.codecs.csc_swscale.colorspace_converter")

        codec_import_check("csc_libyuv", "libyuv colorspace conversion", "xpra.codecs.csc_libyuv", "xpra.codecs.csc_libyuv.colorspace_converter", "ColorspaceConverter")
        add_codec_version("libyuv", "xpra.codecs.csc_libyuv.colorspace_converter")

    if decoders:
        show += list(DECODER_CODECS)
        codec_import_check("dec_pillow", "Pillow decoder", "xpra.codecs.pillow", "xpra.codecs.pillow.decode", "decode")
        add_codec_version("dec_pillow", "xpra.codecs.pillow.decode")

        codec_import_check("dec_vpx", "vpx decoder", "xpra.codecs.vpx", "xpra.codecs.vpx.decoder", "Decoder")
        add_codec_version("vpx", "xpra.codecs.vpx.encoder")

        codec_import_check("dec_avcodec2", "avcodec2 decoder", "xpra.codecs.dec_avcodec2", "xpra.codecs.dec_avcodec2.decoder", "Decoder")
        add_codec_version("avcodec2", "xpra.codecs.dec_avcodec2.decoder")

    #not really a codec, but gets used by codecs, so include version info:
    add_codec_version("numpy", "numpy")
    try:
        from xpra.codecs.argb.argb import buffer_api_version            #@UnresolvedImport
        codec_versions["buffer_api"] = buffer_api_version()
    except Exception as e:
        log("unknown buffer api version: %s", e)

    log("done loading codecs")
    log("found:")
    #print("codec_status=%s" % codecs)
    for name in sorted(ALL_CODECS):
        log("* %s : %s %s" % (name.ljust(20), str(name in codecs).ljust(10), codecs.get(name, "")))
    log("codecs versions:")
    for name, version in codec_versions.items():
        log("* %s : %s" % (name.ljust(20), version))
Exemplo n.º 2
0
def load_codecs(encoders=True, decoders=True, csc=True):
    global loaded
    if loaded:
        return
    loaded = True
    show = []
    log("loading codecs")
    if encoders or decoders:
        codec_import_check("PIL", "Python Imaging Library", "PIL", "PIL",
                           "Image")
        add_codec_version("PIL", "PIL.Image", "PILLOW_VERSION", "VERSION")

    if encoders:
        show += list(ENCODER_CODECS)
        codec_import_check("enc_pillow", "Pillow encoder",
                           "xpra.codecs.pillow", "xpra.codecs.pillow.encode",
                           "encode")
        add_codec_version("enc_pillow", "xpra.codecs.pillow.encode")

        codec_import_check("enc_webp", "webp encoder", "xpra.codecs.webp",
                           "xpra.codecs.webp.encode", "compress")
        add_codec_version("enc_webp", "xpra.codecs.webp.encode")

        if not sys.platform.startswith("darwin"):
            #causes crashes with osx shadow servers, disabled in setup.py:
            codec_import_check("enc_vpx", "vpx encoder", "xpra.codecs.vpx",
                               "xpra.codecs.vpx.encoder", "Encoder")
            add_codec_version("vpx", "xpra.codecs.vpx.decoder")

        codec_import_check("enc_x264", "x264 encoder", "xpra.codecs.enc_x264",
                           "xpra.codecs.enc_x264.encoder", "Encoder")
        add_codec_version("x264", "xpra.codecs.enc_x264.encoder")

        codec_import_check("enc_x265", "x265 encoder", "xpra.codecs.enc_x265",
                           "xpra.codecs.enc_x265.encoder", "Encoder")
        add_codec_version("x265", "xpra.codecs.enc_x265.encoder")

        for v in (7, ):
            codec_import_check("nvenc%s" % v, "nvenc encoder",
                               "xpra.codecs.nvenc%s" % v,
                               "xpra.codecs.nvenc%s.encoder" % v, "Encoder")
            add_codec_version("nvenc%s" % v, "xpra.codecs.nvenc%s.encoder" % v)

        codec_import_check("enc_xvid", "xvid encoder", "xpra.codecs.enc_xvid",
                           "xpra.codecs.enc_xvid.encoder", "Encoder")
        add_codec_version("xvid", "xpra.codecs.enc_xvid.encoder")

        codec_import_check("enc_ffmpeg", "ffmpeg encoder",
                           "xpra.codecs.enc_ffmpeg",
                           "xpra.codecs.enc_ffmpeg.encoder", "Encoder")
        add_codec_version("ffmpeg", "xpra.codecs.enc_ffmpeg.encoder")

    if csc:
        show += list(CSC_CODECS)
        codec_import_check("csc_swscale", "swscale colorspace conversion",
                           "xpra.codecs.csc_swscale",
                           "xpra.codecs.csc_swscale.colorspace_converter",
                           "ColorspaceConverter")
        add_codec_version("swscale",
                          "xpra.codecs.csc_swscale.colorspace_converter")

        codec_import_check("csc_cython", "cython colorspace conversion",
                           "xpra.codecs.csc_cython",
                           "xpra.codecs.csc_cython.colorspace_converter",
                           "ColorspaceConverter")
        add_codec_version("cython",
                          "xpra.codecs.csc_cython.colorspace_converter")

        codec_import_check("csc_opencl", "OpenCL colorspace conversion",
                           "xpra.codecs.csc_opencl",
                           "xpra.codecs.csc_opencl.colorspace_converter",
                           "ColorspaceConverter")
        add_codec_version("opencl",
                          "xpra.codecs.csc_opencl.colorspace_converter")

        codec_import_check("csc_libyuv", "libyuv colorspace conversion",
                           "xpra.codecs.csc_libyuv",
                           "xpra.codecs.csc_libyuv.colorspace_converter",
                           "ColorspaceConverter")
        add_codec_version("libyuv",
                          "xpra.codecs.csc_libyuv.colorspace_converter")

        codec_import_check("csc_opencv", "OpenCV colorspace conversion",
                           "xpra.codecs.csc_opencv",
                           "xpra.codecs.csc_opencv.colorspace_converter",
                           "ColorspaceConverter")
        add_codec_version("opencv",
                          "xpra.codecs.csc_opencv.colorspace_converter")

    if decoders:
        show += list(DECODER_CODECS)
        codec_import_check("dec_pillow", "Pillow decoder",
                           "xpra.codecs.pillow", "xpra.codecs.pillow.decode",
                           "decode")
        add_codec_version("dec_pillow", "xpra.codecs.pillow.decode")

        codec_import_check("dec_webp", "webp decoder", "xpra.codecs.webp",
                           "xpra.codecs.webp.decode", "decompress")
        add_codec_version("dec_webp", "xpra.codecs.webp.decode")

        codec_import_check("dec_vpx", "vpx decoder", "xpra.codecs.vpx",
                           "xpra.codecs.vpx.decoder", "Decoder")
        add_codec_version("vpx", "xpra.codecs.vpx.encoder")

        codec_import_check("dec_avcodec2", "avcodec2 decoder",
                           "xpra.codecs.dec_avcodec2",
                           "xpra.codecs.dec_avcodec2.decoder", "Decoder")
        add_codec_version("avcodec2", "xpra.codecs.dec_avcodec2.decoder")

    #not really a codec, but gets used by codecs, so include version info:
    add_codec_version("numpy", "numpy")
    try:
        from xpra.codecs.argb.argb import buffer_api_version  #@UnresolvedImport
        codec_versions["buffer_api"] = buffer_api_version()
    except Exception as e:
        log("unknown buffer api version: %s", e)

    log("done loading codecs")
    log("found:")
    #print("codec_status=%s" % codecs)
    for name in sorted(ALL_CODECS):
        log("* %s : %s %s" % (name.ljust(20), str(name in codecs).ljust(10),
                              codecs.get(name, "")))
    log("codecs versions:")
    for name, version in codec_versions.items():
        log("* %s : %s" % (name.ljust(20), version))
Exemplo n.º 3
0
def load_codecs(encoders=True, decoders=True, csc=True):
    global loaded
    if loaded:
        return
    loaded = True
    show = []
    log("loading codecs")
    if encoders or decoders:
        codec_import_check("PIL", "Python Imaging Library", "PIL", "PIL", "Image")
        add_codec_version("PIL", "PIL.Image", "PILLOW_VERSION", "VERSION")

    if encoders:
        show += list(ENCODER_CODECS)
        codec_import_check("enc_pillow", "Pillow encoder", "xpra.codecs.pillow", "xpra.codecs.pillow.encode", "encode")
        add_codec_version("enc_pillow", "xpra.codecs.pillow.encode")

        codec_import_check("enc_jpeg", "JPEG decoder", "xpra.codecs.jpeg", "xpra.codecs.jpeg.encoder", "encoder")
        add_codec_version("enc_jpeg", "xpra.codecs.jpeg.encoder")

        codec_import_check("enc_vpx", "vpx encoder", "xpra.codecs.vpx", "xpra.codecs.vpx.encoder", "Encoder")
        add_codec_version("vpx", "xpra.codecs.vpx.decoder")

        codec_import_check("enc_x264", "x264 encoder", "xpra.codecs.enc_x264", "xpra.codecs.enc_x264.encoder", "Encoder")
        add_codec_version("x264", "xpra.codecs.enc_x264.encoder")

        codec_import_check("enc_x265", "x265 encoder", "xpra.codecs.enc_x265", "xpra.codecs.enc_x265.encoder", "Encoder")
        add_codec_version("x265", "xpra.codecs.enc_x265.encoder")

        codec_import_check("nvenc", "nvenc encoder", "xpra.codecs.nvenc", "xpra.codecs.nvenc.encoder", "Encoder")
        add_codec_version("nvenc", "xpra.codecs.nvenc.encoder")

        codec_import_check("enc_ffmpeg", "ffmpeg encoder", "xpra.codecs.enc_ffmpeg", "xpra.codecs.enc_ffmpeg.encoder", "Encoder")
        add_codec_version("ffmpeg", "xpra.codecs.enc_ffmpeg.encoder")

    if csc:
        show += list(CSC_CODECS)
        codec_import_check("csc_swscale", "swscale colorspace conversion", "xpra.codecs.csc_swscale", "xpra.codecs.csc_swscale.colorspace_converter", "ColorspaceConverter")
        add_codec_version("swscale", "xpra.codecs.csc_swscale.colorspace_converter")

        codec_import_check("csc_libyuv", "libyuv colorspace conversion", "xpra.codecs.csc_libyuv", "xpra.codecs.csc_libyuv.colorspace_converter", "ColorspaceConverter")
        add_codec_version("libyuv", "xpra.codecs.csc_libyuv.colorspace_converter")

    if decoders:
        show += list(DECODER_CODECS)
        codec_import_check("dec_pillow", "Pillow decoder", "xpra.codecs.pillow", "xpra.codecs.pillow.decode", "decode")
        add_codec_version("dec_pillow", "xpra.codecs.pillow.decode")

        codec_import_check("dec_jpeg", "JPEG decoder", "xpra.codecs.jpeg", "xpra.codecs.jpeg.decoder", "decoder")
        add_codec_version("dec_jpeg", "xpra.codecs.jpeg.decoder")

        codec_import_check("dec_vpx", "vpx decoder", "xpra.codecs.vpx", "xpra.codecs.vpx.decoder", "Decoder")
        add_codec_version("vpx", "xpra.codecs.vpx.encoder")

        codec_import_check("dec_avcodec2", "avcodec2 decoder", "xpra.codecs.dec_avcodec2", "xpra.codecs.dec_avcodec2.decoder", "Decoder")
        add_codec_version("avcodec2", "xpra.codecs.dec_avcodec2.decoder")

    #not really a codec, but gets used by codecs, so include version info:
    add_codec_version("numpy", "numpy")
    try:
        from xpra.codecs.argb.argb import buffer_api_version            #@UnresolvedImport
        codec_versions["buffer_api"] = buffer_api_version()
    except Exception as e:
        log("unknown buffer api version: %s", e)

    log("done loading codecs")
    log("found:")
    #print("codec_status=%s" % codecs)
    for name in sorted(ALL_CODECS):
        log("* %s : %s %s" % (name.ljust(20), str(name in codecs).ljust(10), codecs.get(name, "")))
    log("codecs versions:")
    for name, version in codec_versions.items():
        log("* %s : %s" % (name.ljust(20), version))