HVD
HVD Hardware Video Decoder library
hvd.h
Go to the documentation of this file.
1 /*
2  * HVD Hardware Video Decoder C library header
3  *
4  * Copyright 2019-2020 (C) Bartosz Meglicki <meglickib@gmail.com>
5  *
6  * This Source Code Form is subject to the terms of the Mozilla Public
7  * License, v. 2.0. If a copy of the MPL was not distributed with this
8  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9  *
10  */
11 
25 #ifndef HVD_H
26 #define HVD_H
27 
28 #ifdef __cplusplus
29 extern "C" {
30 #endif
31 
32 #include <libavcodec/avcodec.h>
33 
43 struct hvd;
44 
105 {
106  const char *hardware;
107  const char *codec;
108  const char *device;
109  const char *pixel_format;
110  int width;
111  int height;
112  int profile;
113 };
114 
131 {
132  uint8_t *data;
133  int size;
134 };
135 
140 {
141  HVD_AGAIN=AVERROR(EAGAIN),
143  HVD_OK=0,
144 };
145 
155 struct hvd *hvd_init(const struct hvd_config *config);
156 
166 void hvd_close(struct hvd *h);
167 
219 int hvd_send_packet(struct hvd *h, struct hvd_packet *packet);
220 
221 
257 AVFrame *hvd_receive_frame(struct hvd *h, int *error);
258 
261 #ifdef __cplusplus
262 }
263 #endif
264 
265 #endif
succesfull execution
Definition: hvd.h:143
int size
size of encoded data
Definition: hvd.h:133
void hvd_close(struct hvd *h)
Free library resources.
Definition: hvd.c:156
AVFrame * hvd_receive_frame(struct hvd *h, int *error)
Retrieve decoded frame data from hardware.
Definition: hvd.c:211
uint8_t * data
pointer to encoded data
Definition: hvd.h:132
const char * pixel_format
NULL / "" for default or format, e.g. "rgb0", "bgr0", "nv12", "yuv420p".
Definition: hvd.h:109
Decoder configuration.
Definition: hvd.h:104
hvd_retval_enum
Constants returned by most of library functions.
Definition: hvd.h:139
int profile
0 to leave as FF_PROFILE_UNKNOWN or profile e.g. FF_PROFILE_HEVC_MAIN, ...
Definition: hvd.h:112
int hvd_send_packet(struct hvd *h, struct hvd_packet *packet)
Send packet to hardware for decoding.
Definition: hvd.c:180
Encoded data packet.
Definition: hvd.h:130
const char * codec
codec name, e.g. "h264", "vp8"
Definition: hvd.h:107
int width
0 to not specify, needed by some codecs
Definition: hvd.h:110
int height
0 to not specify, needed by some codecs
Definition: hvd.h:111
Internal library data passed around by the user.
Definition: hvd.c:23
struct hvd * hvd_init(const struct hvd_config *config)
Initialize internal library data.
Definition: hvd.c:41
hvd_send_packet was not accepted (e.g. buffers full), use hvd_receive_frame before next call ...
Definition: hvd.h:141
error occured
Definition: hvd.h:142
const char * hardware
hardware type for decoding, e.g. "vaapi"
Definition: hvd.h:106
const char * device
NULL / "" or device, e.g. "/dev/dri/renderD128".
Definition: hvd.h:108