diff --git a/src/libug.cpp b/src/libug.cpp index 81d7d901b..f977a41b9 100644 --- a/src/libug.cpp +++ b/src/libug.cpp @@ -32,6 +32,10 @@ void exit_uv(int status) { LOG(LOG_LEVEL_WARNING) << "Requested exit with code " << status << ".\n"; } +static_assert(static_cast(UG_RGBA) == static_cast(RGBA)); +static_assert(static_cast(UG_I420) == static_cast(I420)); +static_assert(static_cast(UG_CUDA_RGBA) == static_cast(CUDA_RGBA)); + //////////////////////////////////// // SENDER //////////////////////////////////// @@ -221,6 +225,10 @@ struct ug_receiver *ug_receiver_start(struct ug_receiver_parameters *init_params commandline_params["decoder-use-codec"] = get_codec_name((codec_t) init_params->decompress_to); } + if (init_params->force_gpu_decoding) { + commandline_params["decompress"] = "gpujpeg"; + } + if (initialize_video_display(&s->root_module, display, display_cfg, 0, nullptr, &s->display) != 0) { LOG(LOG_LEVEL_ERROR) << "Unable to initialize VRG display!\n"; delete s; diff --git a/src/libug.h b/src/libug.h index a6adb48dc..056a61275 100644 --- a/src/libug.h +++ b/src/libug.h @@ -2,6 +2,7 @@ #define UG_LIB_87DD87FE_8111_4485_B05F_805029047F81 #if ! defined __cplusplus +#include #include #else #include @@ -26,6 +27,7 @@ typedef void (*render_packet_received_callback_t)(void *udata, struct RenderPack typedef enum { UG_RGBA = 1, ///< RGBA 8-bit UG_I420 = 29, ///< planar YUV 4:2:0 in one buffer + UG_CUDA_RGBA = 31, ///< RGBA 8-bit in CUDA buffer (Unified Memory pointer also possible) } libug_pixfmt_t; typedef enum { @@ -69,6 +71,7 @@ struct ug_receiver_parameters { int tx_port; ///< TX port for RTCP (optional, unused if sender unset, default 5004) int rx_port; ///< RX port for RTCP (optional, unused if sender unset, default 5004) libug_pixfmt_t decompress_to; ///< optional - pixel format to decompress to + bool force_gpu_decoding; ///< force GPU decoding (decode with GPUJPEG) }; LIBUG_DLL struct ug_receiver *ug_receiver_start(struct ug_receiver_parameters *init_params); LIBUG_DLL void ug_receiver_done(struct ug_receiver *state);