UltraGrid
UltraGrid Low-Latency High-Resolution Transmission System
Loading...
Searching...
No Matches
none.cpp
Go to the documentation of this file.
1
5/*
6 * Copyright (c) 2012-2023 CESNET, z. s. p. o.
7 * All rights reserved.
8 *
9 * Redistribution and use in source and binary forms, with or without
10 * modification, is permitted provided that the following conditions
11 * are met:
12 *
13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 *
16 * 2. Redistributions in binary form must reproduce the above copyright
17 * notice, this list of conditions and the following disclaimer in the
18 * documentation and/or other materials provided with the distribution.
19 *
20 * 3. Neither the name of CESNET nor the names of its contributors may be
21 * used to endorse or promote products derived from this software without
22 * specific prior written permission.
23 *
24 * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS
25 * "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING,
26 * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
27 * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
28 * EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
29 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
30 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
31 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
32 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
33 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
34 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
35 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36 */
37
38#ifdef HAVE_CONFIG_H
39#include "config.h"
40#include "config_unix.h"
41#include "config_win32.h"
42#endif /* HAVE_CONFIG_H */
43
44#include <stdlib.h>
45
46#include "debug.h"
47#include "host.h"
48#include "lib_common.h"
49#include "module.h"
50#include "video_codec.h"
51#include "video_compress.h"
52#include "video_frame.h"
53
54namespace {
55
56#define MAGIC 0x45bb3321
57
58static void none_compress_done(struct module *mod);
59
60struct state_video_compress_none {
61 struct module module_data;
62
63 uint32_t magic;
64};
65
66struct module * none_compress_init(struct module *parent, const char *)
67{
68 struct state_video_compress_none *s;
69
70 s = (struct state_video_compress_none *) malloc(sizeof(struct state_video_compress_none));
71 s->magic = MAGIC;
72 module_init_default(&s->module_data);
73 s->module_data.cls = MODULE_CLASS_DATA;
74 s->module_data.priv_data = s;
75 s->module_data.deleter = none_compress_done;
76 module_register(&s->module_data, parent);
77
78 return &s->module_data;
79}
80
81std::shared_ptr<video_frame> none_compress(struct module *mod, std::shared_ptr<video_frame> tx)
82{
83 struct state_video_compress_none *s = (struct state_video_compress_none *) mod->priv_data;
84
85 assert(s->magic == MAGIC);
86
87 return tx;
88}
89
90static void none_compress_done(struct module *mod)
91{
92 struct state_video_compress_none *s = (struct state_video_compress_none *) mod->priv_data;
93
94 assert(s->magic == MAGIC);
95
96 free(s);
97}
98
99const struct video_compress_info none_info = {
100 "none",
101 none_compress_init,
102 none_compress,
103 NULL,
104 NULL,
105 NULL,
106 NULL,
107 NULL,
108 NULL
109};
110
112
113} // end of anonymous namespace
114
void module_init_default(struct module *module_data)
Definition module.c:48
void module_register(struct module *module_data, struct module *parent)
Definition module.c:82
@ MODULE_CLASS_DATA
Definition module.h:86
#define VIDEO_COMPRESS_ABI_VERSION
@ LIBRARY_CLASS_VIDEO_COMPRESS
Definition lib_common.h:82
#define REGISTER_MODULE(name, info, lclass, abi)
Registers module to global modules' registry.
Definition lib_common.h:144
#define MAGIC
Definition none.cpp:56
const char * parent
Definition settings.cpp:198
enum module_class cls
Definition module.h:115
void * priv_data
Definition module.h:126
module_deleter_t deleter
Definition module.h:118
API for video compress drivers.