mirror of
https://github.com/outbackdingo/UltraGrid.git
synced 2026-03-20 14:40:10 +00:00
video_compress: del state with compress_done
The whole stuff with generic modules is mostly abandoned and module::deleter should not be used, anyways.
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
* @brief Video compress functions.
|
||||
*/
|
||||
/*
|
||||
* Copyright (c) 2011-2023 CESNET z.s.p.o.
|
||||
* Copyright (c) 2011-2024 CESNET z.s.p.o.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@@ -37,18 +37,13 @@
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
||||
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#include "config_unix.h"
|
||||
#include "config_win32.h"
|
||||
#endif // HAVE_CONFIG_H
|
||||
|
||||
#include <cassert>
|
||||
#include <cinttypes>
|
||||
#include <cstdio>
|
||||
#include <cstring>
|
||||
#include <memory>
|
||||
#include <stdio.h>
|
||||
#include <string>
|
||||
#include <string.h>
|
||||
#include <thread>
|
||||
#include <vector>
|
||||
|
||||
@@ -111,7 +106,6 @@ struct compress_state {
|
||||
|
||||
static shared_ptr<video_frame> compress_frame_tiles(struct compress_state *proxy,
|
||||
shared_ptr<video_frame> frame);
|
||||
static void compress_done(struct module *mod);
|
||||
|
||||
/// @brief Displays list of available compressions.
|
||||
void show_compress_help(bool full)
|
||||
@@ -203,7 +197,6 @@ int compress_init(struct module *parent, const char *config_string, struct compr
|
||||
module_init_default(&proxy->mod);
|
||||
proxy->mod.cls = MODULE_CLASS_COMPRESS;
|
||||
proxy->mod.priv_data = proxy;
|
||||
proxy->mod.deleter = compress_done;
|
||||
|
||||
try {
|
||||
proxy->ptr = compress_state_real::create(&proxy->mod, config_string, proxy);
|
||||
@@ -486,18 +479,20 @@ static shared_ptr<video_frame> compress_frame_tiles(struct compress_state *proxy
|
||||
* @brief Video compression cleanup function.
|
||||
* @param mod video compress module
|
||||
*/
|
||||
static void compress_done(struct module *mod)
|
||||
void
|
||||
compress_done(struct compress_state *proxy)
|
||||
{
|
||||
if(!mod)
|
||||
if (proxy == nullptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
struct compress_state *proxy = (struct compress_state *) mod->priv_data;
|
||||
struct compress_state_real *s = proxy->ptr;
|
||||
if (!proxy->poisoned) { // pass poisoned pill if it wasn't
|
||||
compress_frame(proxy, {});
|
||||
}
|
||||
|
||||
delete s;
|
||||
module_done(&proxy->mod);
|
||||
delete proxy;
|
||||
}
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
* @brief API for video compress drivers.
|
||||
*/
|
||||
/*
|
||||
* Copyright (c) 2009-2023 CESNET, z. s. p. o.
|
||||
* Copyright (c) 2009-2024 CESNET, z. s. p. o.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@@ -93,6 +93,7 @@ typedef struct module *(*compress_init_t)(struct module *parent,
|
||||
void show_compress_help(bool full);
|
||||
// documented at definition
|
||||
int compress_init(struct module *parent, const char *config_string, struct compress_state **);
|
||||
void compress_done(struct compress_state *);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -96,7 +96,7 @@ video_rxtx::video_rxtx(map<string, param_u> const ¶ms): m_port_id("default")
|
||||
|
||||
} catch (...) {
|
||||
if (m_compression) {
|
||||
module_done(CAST_MODULE(m_compression));
|
||||
compress_done(m_compression);
|
||||
}
|
||||
|
||||
module_done(&m_receiver_mod);
|
||||
@@ -112,7 +112,7 @@ video_rxtx::~video_rxtx() {
|
||||
send(NULL);
|
||||
compress_pop(m_compression);
|
||||
}
|
||||
module_done(CAST_MODULE(m_compression));
|
||||
compress_done(m_compression);
|
||||
module_done(&m_receiver_mod);
|
||||
module_done(&m_sender_mod);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user