UltraGrid
UltraGrid Low-Latency High-Resolution Transmission System
Loading...
Searching...
No Matches
video_frame.h
Go to the documentation of this file.
1
12/* Copyright (c) 2005-2013 CESNET z.s.p.o.
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. All advertising materials mentioning features or use of this software
26 * must display the following acknowledgement:
27 *
28 * This product includes software developed by CESNET z.s.p.o.
29 *
30 * 4. Neither the name of the CESNET nor the names of its contributors may be
31 * used to endorse or promote products derived from this software without
32 * specific prior written permission.
33 *
34 * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS
35 * "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING,
36 * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
37 * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
38 * EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
39 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
40 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
41 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
42 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
43 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
44 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
45 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
46 *
47 */
48#ifndef video_frame_h_
49#define video_frame_h_
50
51#ifndef __cplusplus
52#include <stdbool.h>
53#endif
54
55#ifdef __cplusplus
56extern "C" {
57#endif
58
59#include "types.h"
60
63#define PARAM_WIDTH (1<<0u)
64#define PARAM_HEIGHT (1<<2u)
65#define PARAM_CODEC (1<<3u)
66#define PARAM_INTERLACING (1<<4u)
67#define PARAM_FPS (1<<5u)
68#define PARAM_TILE_COUNT (1<<6u)
76#define VIDEO_FRAME_DISPOSE(frame) if ((frame) && (frame)->callbacks.dispose) \
77 (frame)->callbacks.dispose(frame)
78
84struct video_frame * vf_alloc(int count);
106
113void vf_free(struct video_frame *buf);
114
122void vf_recycle(struct video_frame *buf);
123
128void vf_data_deleter(struct video_frame *buf);
129
134struct tile * vf_get_tile(struct video_frame *buf, int pos);
140struct video_frame * vf_get_copy(struct video_frame *original_frame);
148bool video_desc_eq(struct video_desc, struct video_desc);
155bool video_desc_eq_excl_param(struct video_desc a, struct video_desc b, unsigned int excluded_params);
171
172void il_lower_to_merged(char *dst, char *src, int linesize, int height, void **stored_state);
173/* these functions transcode one interlacing format to another */
177void il_upper_to_merged(char *dst, char *src, int linesize, int height, void **stored_state);
181void il_merged_to_upper(char *dst, char *src, int linesize, int height, void **stored_state);
182
189double compute_fps(int fps, int fpsd, int fd, int fi);
190bool parse_fps(const char *fps, struct video_desc *desc);
191
192bool save_video_frame_as_pnm(struct video_frame *frame, const char *name);
193const char *save_video_frame(struct video_frame *frame, const char *name, bool raw);
194struct video_frame *load_video_frame(const char *name, codec_t codec, int width,
195 int height);
196
197void vf_copy_metadata(struct video_frame *dest, const struct video_frame *src);
198void vf_store_metadata(const struct video_frame *f, void *);
199void vf_restore_metadata(struct video_frame *f, void *);
200
204unsigned int vf_get_data_len(struct video_frame *f);
205
212void buf_get_planes(int width, int height, codec_t color_spec, char *data, char **planes);
213void buf_get_linesizes(int width, codec_t color_spec, int *linesize);
214
215void vf_clear(struct video_frame *f);
216
220#define AUX_INTERLACED (1<<0)
221#define AUX_PROGRESSIVE (1<<1)
222#define AUX_SF (1<<2)
223#define AUX_RGB (1<<3) /* if device supports both, set both */
224#define AUX_YUV (1<<4)
225#define AUX_10Bit (1<<5)
228#ifdef __cplusplus
229}
230#endif
231
232#endif
233
struct video_desc desc
struct video_frame * frame
#define suffix(x, y)
int count
Definition hd-rum.c:44
const char * name
Definition settings.cpp:193
Struct tile is an area of video_frame.
Definition types.h:279
enum interlacing_t interlacing
Definition types.h:184
double fps
Definition types.h:183
unsigned int height
height of every tile (!)
Definition types.h:180
Struct video_frame represents a video frame and contains video description.
Definition types.h:305
codec_t color_spec
Definition types.h:306
This file contains some common data types.
interlacing_t
Definition types.h:163
codec_t
Definition types.h:65
struct video_frame * vf_alloc(int count)
Allocates blank video frame.
void vf_free(struct video_frame *buf)
Frees video_frame structure.
struct video_desc video_desc_from_frame(const struct video_frame *frame)
Returns struct video_desc from video frame.
enum interlacing_t get_interlacing_from_suffix(const char *suffix)
void vf_clear(struct video_frame *f)
void buf_get_linesizes(int width, codec_t color_spec, int *linesize)
void vf_data_deleter(struct video_frame *buf)
const char * save_video_frame(struct video_frame *frame, const char *name, bool raw)
bool video_desc_eq_excl_param(struct video_desc a, struct video_desc b, unsigned int excluded_params)
Compares two video descriptions.
const char * get_interlacing_suffix(enum interlacing_t interlacing)
Returns suffix describing interlacing Eg. p, i or psf.
double compute_fps(int fps, int fpsd, int fd, int fi)
Computes FPS as a double from packet fields.
void il_upper_to_merged(char *dst, char *src, int linesize, int height, void **stored_state)
Converts upper-field-first to interlaced merged.
struct video_frame * vf_alloc_desc(struct video_desc desc)
Allocates video frame accordig given desc.
void il_merged_to_upper(char *dst, char *src, int linesize, int height, void **stored_state)
Converts interlaced merged to upper-field-first.
bool parse_fps(const char *fps, struct video_desc *desc)
void vf_restore_metadata(struct video_frame *f, void *)
unsigned int vf_get_data_len(struct video_frame *f)
void il_lower_to_merged(char *dst, char *src, int linesize, int height, void **stored_state)
bool video_desc_eq(struct video_desc, struct video_desc)
Compares two video descriptions.
void vf_recycle(struct video_frame *buf)
This function should be called before returning a frame back to a frame pool. Currently this is used ...
bool save_video_frame_as_pnm(struct video_frame *frame, const char *name)
struct video_frame * vf_get_copy(struct video_frame *original_frame)
Makes deep copy of the video frame.
struct tile * vf_get_tile(struct video_frame *buf, int pos)
Returns pointer to n-th tile from video frame Equivalent to &video_frame::tiles[pos].
struct video_frame * vf_alloc_desc_data(struct video_desc desc)
allocates struct video_frame including data pointers in RAM
void vf_store_metadata(const struct video_frame *f, void *)
const char * get_interlacing_description(enum interlacing_t interlacing)
Returns description of interlacing Eg. "progressive".
void buf_get_planes(int width, int height, codec_t color_spec, char *data, char **planes)
void vf_copy_metadata(struct video_frame *dest, const struct video_frame *src)
struct video_frame * load_video_frame(const char *name, codec_t codec, int width, int height)