UltraGrid
UltraGrid Low-Latency High-Resolution Transmission System
Loading...
Searching...
No Matches
video_compress.h
Go to the documentation of this file.
10/*
11 * Copyright (c) 2009-2024 CESNET, z. s. p. o.
12 * All rights reserved.
13 *
14 * Redistribution and use in source and binary forms, with or without
15 * modification, is permitted provided that the following conditions
16 * are met:
17 *
18 * 1. Redistributions of source code must retain the above copyright
19 * notice, this list of conditions and the following disclaimer.
20 *
21 * 2. Redistributions in binary form must reproduce the above copyright
22 * notice, this list of conditions and the following disclaimer in the
23 * documentation and/or other materials provided with the distribution.
24 *
25 * 3. Neither the name of CESNET nor the names of its contributors may be
26 * used to endorse or promote products derived from this software without
27 * specific prior written permission.
28 *
29 * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS
30 * "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING,
31 * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
32 * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
33 * EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
34 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
35 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
36 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
37 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
38 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
39 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
40 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
41 */
42
66#ifndef __video_compress_h
67#define __video_compress_h
68
69#include "types.h"
70
71#define VIDEO_COMPRESS_ABI_VERSION 12
72
73#ifdef __cplusplus
74extern "C" {
75#endif
76
77struct compress_state;
78struct module;
79
80//
81// Begins external API for video compression use
82//
90typedef struct module *(*compress_init_t)(struct module *parent,
91 const char *cfg);
92// documented at definition
93void show_compress_help(bool full);
94// documented at definition
95int compress_init(struct module *parent, const char *config_string, struct compress_state **);
96void compress_done(struct compress_state *);
97#ifdef __cplusplus
98}
99#endif
100#ifdef __cplusplus
101#include <memory>
102// documented at definition
103void compress_frame(struct compress_state *, std::shared_ptr<video_frame>);
104// documented at definition
105std::shared_ptr<video_frame> compress_pop(struct compress_state *);
106
107//
108// Begins API for individual video compression modules
109//
110#include <list>
111#include <string>
112#include <vector>
113
122typedef std::shared_ptr<video_frame> (*compress_frame_t)(struct module *state, std::shared_ptr<video_frame> frame);
123
132typedef std::shared_ptr<video_frame> (*compress_tile_t)(struct module *state, std::shared_ptr<video_frame> in_frame);
133
142typedef void (*compress_frame_async_push_t)(struct module *state, std::shared_ptr<video_frame> in_frame);
143
151typedef std::shared_ptr<video_frame> (*compress_frame_async_pop_t)(struct module *state);
152
161typedef void (*compress_tile_async_push_t)(struct module *state, std::shared_ptr<video_frame> in_frame);
162
170typedef std::shared_ptr<video_frame> (*compress_tile_async_pop_t)(struct module *state);
171
173 std::string display_name; //Name displayed to user
174 std::string display_desc; //Description displayed to user
175 std::string placeholder_text; //Displayed placeholder text if opt is a line edit
176
177 /* internal name of option, options that are used in the same way should
178 * have the same key (e.g. both bitrate for libavcodec and quality for jpeg
179 * should have the same key). This allows using different labels displayed
180 * to user */
181 std::string key;
182 std::string opt_str; //Option string to pass to ug (e.g. ":bitrate=")
183
184 bool is_boolean; //If true, GUI shows a checkbox instead of text edit
185};
186
187struct encoder{
188 std::string name;
189 std::string opt_str;
190};
191
192struct codec{
193 std::string name;
194 std::vector<encoder> encoders;
196};
197
199 std::string name;
200 std::vector<module_option> opts;
201 std::vector<codec> codecs;
202};
203
230
231#endif // __cplusplus
232
233#endif /* __video_compress_h */
234 // end of video_compress
235
void ** state
struct video_frame * frame
std::shared_ptr< video_frame >(* compress_frame_t)(struct module *state, std::shared_ptr< video_frame > frame)
Compresses video frame.
struct module *(* compress_init_t)(struct module *parent, const char *cfg)
Initializes video compression.
void show_compress_help(bool full)
Displays list of available compressions.
std::shared_ptr< video_frame > compress_pop(struct compress_state *)
void compress_frame(struct compress_state *, std::shared_ptr< video_frame >)
std::shared_ptr< video_frame >(* compress_tile_async_pop_t)(struct module *state)
Fetches compressed tile passed with compress_tile_async_push()
int compress_init(struct module *parent, const char *config_string, struct compress_state **)
This function initializes video compression.
std::shared_ptr< video_frame >(* compress_tile_t)(struct module *state, std::shared_ptr< video_frame > in_frame)
Compresses tile of a video frame.
void(* compress_tile_async_push_t)(struct module *state, std::shared_ptr< video_frame > in_frame)
Passes tile to compress module for async processing.
std::shared_ptr< video_frame >(* compress_frame_async_pop_t)(struct module *state)
Fetches compressed frame passed with compress_frame_async_push()
void compress_done(struct compress_state *)
Video compression cleanup function.
void(* compress_frame_async_push_t)(struct module *state, std::shared_ptr< video_frame > in_frame)
Passes frame to compress module for async processing.
const char * parent
Definition settings.cpp:198
std::string name
std::vector< encoder > encoders
std::vector< codec > codecs
std::vector< module_option > opts
Video compress state.
std::string name
std::string opt_str
std::string opt_str
std::string display_desc
std::string placeholder_text
std::string key
std::string display_name
compress_tile_async_push_t compress_tile_async_push_func
Async tile API.
compress_frame_async_pop_t compress_frame_async_pop_func
Async API.
compress_init_t init_func
compress driver initialization function
compress_frame_async_push_t compress_frame_async_push_func
Async API.
const char * name
not used
compress_module_info(* get_module_info)()
compress_frame_t compress_frame_func
compress function for Frame API
compress_tile_t compress_tile_func
compress function for Tile API
compress_tile_async_pop_t compress_tile_async_pop_func
Async tile API.
This file contains some common data types.