diff --git a/src/main.cpp b/src/main.cpp index 6baaa5781..09feed3bc 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -860,7 +860,7 @@ int main(int argc, char *argv[]) #ifdef HAVE_GPUJPEG if(strcmp("help", optarg) == 0) { struct compress_state *compression; - int ret = compress_init(&uv.root_module, "JPEG:list_devices", &compression); + int ret = compress_init(&uv.root_module, "GPUJPEG:list_devices", &compression); if(ret >= 0) { if(ret == 0) { module_done(CAST_MODULE(compression)); diff --git a/src/video_compress/jpeg.cpp b/src/video_compress/jpeg.cpp index 59c6750f1..911e76b7e 100644 --- a/src/video_compress/jpeg.cpp +++ b/src/video_compress/jpeg.cpp @@ -3,7 +3,7 @@ * @author Martin Pulec */ /* - * Copyright (c) 2011-2018 CESNET, z. s. p. o. + * Copyright (c) 2011-2019 CESNET, z. s. p. o. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -59,6 +59,8 @@ #include #include +#define MOD_NAME "[GPUJPEG enc.] " + using namespace std; // compat @@ -403,8 +405,8 @@ struct module * jpeg_compress_init(struct module *parent, const char *opts) struct state_video_compress_jpeg *s; if(opts && strcmp(opts, "help") == 0) { - cout << "JPEG comperssion usage:\n"; - cout << "\t" << rang::fg::red << rang::style::bold << "-c JPEG" << rang::fg::reset << "[:[:]][:interleaved][:RGB|:UYVY]\n" << rang::style::reset; + cout << "GPUJPEG comperssion usage:\n"; + cout << "\t" << rang::fg::red << rang::style::bold << "-c GPUJPEG" << rang::fg::reset << "[:[:]][:interleaved][:RGB|:UYVY]\n" << rang::style::reset; cout << "where\n"; cout << rang::style::bold << "\tinterleaved\n" << rang::style::reset << "\t\tforce interleaved encoding (default for YCbCr input formats)\n"; @@ -589,8 +591,8 @@ start: } } -const struct video_compress_info jpeg_info = { - "JPEG", +const struct video_compress_info gpujpeg_info = { + "GPUJPEG", jpeg_compress_init, NULL, NULL, @@ -614,7 +616,30 @@ const struct video_compress_info jpeg_info = { } }; -REGISTER_MODULE(jpeg, &jpeg_info, LIBRARY_CLASS_VIDEO_COMPRESS, VIDEO_COMPRESS_ABI_VERSION); +const struct video_compress_info jpeg_info = { + "JPEG", + [](struct module *parent, const char *opts) { + LOG(LOG_LEVEL_WARNING) << MOD_NAME "Name \"-c JPEG\" deprecated, use \"-c GPUJPEG\" instead.\n"; + return jpeg_compress_init(parent, opts); + }, + NULL, + NULL, + [](struct module *mod, std::shared_ptr in_frame) { + static_cast(mod->priv_data)->push(in_frame); + }, + [](struct module *mod) { + return static_cast(mod->priv_data)->pop(); + }, + NULL, + NULL, + [] { + return list{}; + } +}; + + +REGISTER_MODULE(gpujpeg, &gpujpeg_info, LIBRARY_CLASS_VIDEO_COMPRESS, VIDEO_COMPRESS_ABI_VERSION); +REGISTER_HIDDEN_MODULE(jpeg, &jpeg_info, LIBRARY_CLASS_VIDEO_COMPRESS, VIDEO_COMPRESS_ABI_VERSION); } // end of anonymous namespace