UltraGrid
UltraGrid Low-Latency High-Resolution Transmission System
Loading...
Searching...
No Matches
hwaccel_libav_common.h
Go to the documentation of this file.
1
7/*
8 * Copyright (c) 2018-2021 CESNET z.s.p.o.
9 *
10 * Redistribution and use in source and binary forms, with or without
11 * modification, is permitted provided that the following conditions
12 * are met:
13 *
14 * 1. Redistributions of source code must retain the above copyright
15 * notice, this list of conditions and the following disclaimer.
16 *
17 * 2. Redistributions in binary form must reproduce the above copyright
18 * notice, this list of conditions and the following disclaimer in the
19 * documentation and/or other materials provided with the distribution.
20 *
21 * 3. All advertising materials mentioning features or use of this software
22 * must display the following acknowledgement:
23 *
24 * This product includes software developed by CESNET z.s.p.o.
25 *
26 * 4. Neither the name of the CESNET nor the names of its contributors may be
27 * used to endorse or promote products derived from this software without
28 * specific prior written permission.
29 *
30 * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS
31 * "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING,
32 * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
33 * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
34 * EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
35 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
36 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
37 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
38 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
39 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
40 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
41 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
42 *
43 */
44
45#ifndef HWACCEL_LIBAV_COMMON_H
46#define HWACCEL_LIBAV_COMMON_H
47
48#include "types.h"
49
50#ifdef __cplusplus
51extern "C" {
52#endif
53
54#include <libavcodec/avcodec.h>
55#ifdef HWACC_COMMON_IMPL
56#include <libavutil/hwcontext.h>
57#endif
58
59enum hw_accel_type hw_accel_from_pixfmt(enum AVPixelFormat);
60enum hw_accel_type hw_accel_from_str(const char *str);
62const char *hw_accel_to_str(enum hw_accel_type type);
63
70
71 bool copy;
72 AVFrame *tmp_frame;
73
74 void (*uninit)(struct hw_accel_state*);
75
76 void *ctx;
77};
78
82void hwaccel_state_init(struct hw_accel_state *hwaccel);
83
87void hwaccel_state_reset(struct hw_accel_state *hwaccel);
88
89#ifdef HWACC_COMMON_IMPL
90
96int create_hw_device_ctx(enum AVHWDeviceType type, AVBufferRef **device_ref);
97
106int create_hw_frame_ctx(AVBufferRef *device_ref,
107 int width,
108 int height,
109 enum AVPixelFormat format,
110 enum AVPixelFormat sw_format,
111 int decode_surfaces,
112 AVBufferRef **ctx);
113
120void transfer_frame(struct hw_accel_state *s, AVFrame *frame);
121
122#endif //HWACC_COMMON_IMPL
123
124#ifdef __cplusplus
125}
126#endif
127
128#endif
struct video_frame * frame
const char * hw_accel_to_str(enum hw_accel_type type)
enum hw_accel_type hw_accel_from_pixfmt(enum AVPixelFormat)
void hwaccel_state_init(struct hw_accel_state *hwaccel)
Initializes hw_accel_state structure.
enum hw_accel_type hw_accel_from_str(const char *str)
void hwaccel_state_reset(struct hw_accel_state *hwaccel)
Uninitializes existing acceleration and resets hw_accel_state to initial state.
codec_t hw_accel_to_ug_pixfmt(enum hw_accel_type type)
Option::OptType type
Definition settings.cpp:194
void(* uninit)(struct hw_accel_state *)
Optional uninit function ptr.
AVFrame * tmp_frame
Temporary frame used when copying.
void * ctx
Type depends on hwaccel type.
enum hw_accel_type type
bool copy
Specifies whether to use the copy mode.
This file contains some common data types.
hw_accel_type
Definition types.h:114
codec_t
Definition types.h:65