FFmpeg
ffmpeg_hw.c
Go to the documentation of this file.
1 /*
2  * This file is part of FFmpeg.
3  *
4  * FFmpeg is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2.1 of the License, or (at your option) any later version.
8  *
9  * FFmpeg is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with FFmpeg; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17  */
18 
19 #include <string.h>
20 
21 #include "libavutil/avstring.h"
22 #include "libavutil/pixdesc.h"
23 #include "libavfilter/buffersink.h"
24 
25 #include "ffmpeg.h"
26 
27 static int nb_hw_devices;
29 
31 {
32  HWDevice *found = NULL;
33  int i;
34  for (i = 0; i < nb_hw_devices; i++) {
35  if (hw_devices[i]->type == type) {
36  if (found)
37  return NULL;
38  found = hw_devices[i];
39  }
40  }
41  return found;
42 }
43 
45 {
46  int i;
47  for (i = 0; i < nb_hw_devices; i++) {
48  if (!strcmp(hw_devices[i]->name, name))
49  return hw_devices[i];
50  }
51  return NULL;
52 }
53 
54 static HWDevice *hw_device_add(void)
55 {
56  int err;
58  sizeof(*hw_devices));
59  if (err) {
60  nb_hw_devices = 0;
61  return NULL;
62  }
65  return NULL;
66  return hw_devices[nb_hw_devices++];
67 }
68 
70 {
71  // Make an automatic name of the form "type%d". We arbitrarily
72  // limit at 1000 anonymous devices of the same type - there is
73  // probably something else very wrong if you get to this limit.
74  const char *type_name = av_hwdevice_get_type_name(type);
75  char *name;
76  size_t index_pos;
77  int index, index_limit = 1000;
78  index_pos = strlen(type_name);
79  name = av_malloc(index_pos + 4);
80  if (!name)
81  return NULL;
82  for (index = 0; index < index_limit; index++) {
83  snprintf(name, index_pos + 4, "%s%d", type_name, index);
85  break;
86  }
87  if (index >= index_limit) {
88  av_freep(&name);
89  return NULL;
90  }
91  return name;
92 }
93 
94 int hw_device_init_from_string(const char *arg, HWDevice **dev_out)
95 {
96  // "type=name:device,key=value,key2=value2"
97  // "type:device,key=value,key2=value2"
98  // -> av_hwdevice_ctx_create()
99  // "type=name@name"
100  // "type@name"
101  // -> av_hwdevice_ctx_create_derived()
102 
104  const char *type_name = NULL, *name = NULL, *device = NULL;
105  enum AVHWDeviceType type;
106  HWDevice *dev, *src;
107  AVBufferRef *device_ref = NULL;
108  int err;
109  const char *errmsg, *p, *q;
110  size_t k;
111 
112  k = strcspn(arg, ":=@");
113  p = arg + k;
114 
115  type_name = av_strndup(arg, k);
116  if (!type_name) {
117  err = AVERROR(ENOMEM);
118  goto fail;
119  }
120  type = av_hwdevice_find_type_by_name(type_name);
121  if (type == AV_HWDEVICE_TYPE_NONE) {
122  errmsg = "unknown device type";
123  goto invalid;
124  }
125 
126  if (*p == '=') {
127  k = strcspn(p + 1, ":@");
128 
129  name = av_strndup(p + 1, k);
130  if (!name) {
131  err = AVERROR(ENOMEM);
132  goto fail;
133  }
135  errmsg = "named device already exists";
136  goto invalid;
137  }
138 
139  p += 1 + k;
140  } else {
142  if (!name) {
143  err = AVERROR(ENOMEM);
144  goto fail;
145  }
146  }
147 
148  if (!*p) {
149  // New device with no parameters.
150  err = av_hwdevice_ctx_create(&device_ref, type,
151  NULL, NULL, 0);
152  if (err < 0)
153  goto fail;
154 
155  } else if (*p == ':') {
156  // New device with some parameters.
157  ++p;
158  q = strchr(p, ',');
159  if (q) {
160  if (q - p > 0) {
161  device = av_strndup(p, q - p);
162  if (!device) {
163  err = AVERROR(ENOMEM);
164  goto fail;
165  }
166  }
167  err = av_dict_parse_string(&options, q + 1, "=", ",", 0);
168  if (err < 0) {
169  errmsg = "failed to parse options";
170  goto invalid;
171  }
172  }
173 
174  err = av_hwdevice_ctx_create(&device_ref, type,
175  q ? device : p[0] ? p : NULL,
176  options, 0);
177  if (err < 0)
178  goto fail;
179 
180  } else if (*p == '@') {
181  // Derive from existing device.
182 
183  src = hw_device_get_by_name(p + 1);
184  if (!src) {
185  errmsg = "invalid source device name";
186  goto invalid;
187  }
188 
189  err = av_hwdevice_ctx_create_derived(&device_ref, type,
190  src->device_ref, 0);
191  if (err < 0)
192  goto fail;
193  } else {
194  errmsg = "parse error";
195  goto invalid;
196  }
197 
198  dev = hw_device_add();
199  if (!dev) {
200  err = AVERROR(ENOMEM);
201  goto fail;
202  }
203 
204  dev->name = name;
205  dev->type = type;
206  dev->device_ref = device_ref;
207 
208  if (dev_out)
209  *dev_out = dev;
210 
211  name = NULL;
212  err = 0;
213 done:
214  av_freep(&type_name);
215  av_freep(&name);
216  av_freep(&device);
218  return err;
219 invalid:
221  "Invalid device specification \"%s\": %s\n", arg, errmsg);
222  err = AVERROR(EINVAL);
223  goto done;
224 fail:
226  "Device creation failed: %d.\n", err);
227  av_buffer_unref(&device_ref);
228  goto done;
229 }
230 
232  const char *device,
233  HWDevice **dev_out)
234 {
235  AVBufferRef *device_ref = NULL;
236  HWDevice *dev;
237  char *name;
238  int err;
239 
241  if (!name) {
242  err = AVERROR(ENOMEM);
243  goto fail;
244  }
245 
246  err = av_hwdevice_ctx_create(&device_ref, type, device, NULL, 0);
247  if (err < 0) {
249  "Device creation failed: %d.\n", err);
250  goto fail;
251  }
252 
253  dev = hw_device_add();
254  if (!dev) {
255  err = AVERROR(ENOMEM);
256  goto fail;
257  }
258 
259  dev->name = name;
260  dev->type = type;
261  dev->device_ref = device_ref;
262 
263  if (dev_out)
264  *dev_out = dev;
265 
266  return 0;
267 
268 fail:
269  av_freep(&name);
270  av_buffer_unref(&device_ref);
271  return err;
272 }
273 
275 {
276  int i;
277  for (i = 0; i < nb_hw_devices; i++) {
279  av_buffer_unref(&hw_devices[i]->device_ref);
280  av_freep(&hw_devices[i]);
281  }
283  nb_hw_devices = 0;
284 }
285 
287 {
288  const AVCodecHWConfig *config;
289  HWDevice *dev;
290  int i;
291  for (i = 0;; i++) {
292  config = avcodec_get_hw_config(codec, i);
293  if (!config)
294  return NULL;
296  continue;
297  dev = hw_device_get_by_type(config->device_type);
298  if (dev)
299  return dev;
300  }
301 }
302 
304 {
305  const AVCodecHWConfig *config;
306  enum AVHWDeviceType type;
307  HWDevice *dev = NULL;
308  int err, auto_device = 0;
309 
310  if (ist->hwaccel_device) {
311  dev = hw_device_get_by_name(ist->hwaccel_device);
312  if (!dev) {
313  if (ist->hwaccel_id == HWACCEL_AUTO) {
314  auto_device = 1;
315  } else if (ist->hwaccel_id == HWACCEL_GENERIC) {
316  type = ist->hwaccel_device_type;
317  err = hw_device_init_from_type(type, ist->hwaccel_device,
318  &dev);
319  } else {
320  // This will be dealt with by API-specific initialisation
321  // (using hwaccel_device), so nothing further needed here.
322  return 0;
323  }
324  } else {
325  if (ist->hwaccel_id == HWACCEL_AUTO) {
326  ist->hwaccel_device_type = dev->type;
327  } else if (ist->hwaccel_device_type != dev->type) {
328  av_log(ist->dec_ctx, AV_LOG_ERROR, "Invalid hwaccel device "
329  "specified for decoder: device %s of type %s is not "
330  "usable with hwaccel %s.\n", dev->name,
332  av_hwdevice_get_type_name(ist->hwaccel_device_type));
333  return AVERROR(EINVAL);
334  }
335  }
336  } else {
337  if (ist->hwaccel_id == HWACCEL_AUTO) {
338  auto_device = 1;
339  } else if (ist->hwaccel_id == HWACCEL_GENERIC) {
340  type = ist->hwaccel_device_type;
342  if (!dev)
343  err = hw_device_init_from_type(type, NULL, &dev);
344  } else {
345  dev = hw_device_match_by_codec(ist->dec);
346  if (!dev) {
347  // No device for this codec, but not using generic hwaccel
348  // and therefore may well not need one - ignore.
349  return 0;
350  }
351  }
352  }
353 
354  if (auto_device) {
355  int i;
356  if (!avcodec_get_hw_config(ist->dec, 0)) {
357  // Decoder does not support any hardware devices.
358  return 0;
359  }
360  for (i = 0; !dev; i++) {
362  if (!config)
363  break;
364  type = config->device_type;
366  if (dev) {
367  av_log(ist->dec_ctx, AV_LOG_INFO, "Using auto "
368  "hwaccel type %s with existing device %s.\n",
370  }
371  }
372  for (i = 0; !dev; i++) {
374  if (!config)
375  break;
376  type = config->device_type;
377  // Try to make a new device of this type.
378  err = hw_device_init_from_type(type, ist->hwaccel_device,
379  &dev);
380  if (err < 0) {
381  // Can't make a device of this type.
382  continue;
383  }
384  if (ist->hwaccel_device) {
385  av_log(ist->dec_ctx, AV_LOG_INFO, "Using auto "
386  "hwaccel type %s with new device created "
387  "from %s.\n", av_hwdevice_get_type_name(type),
388  ist->hwaccel_device);
389  } else {
390  av_log(ist->dec_ctx, AV_LOG_INFO, "Using auto "
391  "hwaccel type %s with new default device.\n",
393  }
394  }
395  if (dev) {
396  ist->hwaccel_device_type = type;
397  } else {
398  av_log(ist->dec_ctx, AV_LOG_INFO, "Auto hwaccel "
399  "disabled: no device found.\n");
400  ist->hwaccel_id = HWACCEL_NONE;
401  return 0;
402  }
403  }
404 
405  if (!dev) {
406  av_log(ist->dec_ctx, AV_LOG_ERROR, "No device available "
407  "for decoder: device type %s needed for codec %s.\n",
408  av_hwdevice_get_type_name(type), ist->dec->name);
409  return err;
410  }
411 
412  ist->dec_ctx->hw_device_ctx = av_buffer_ref(dev->device_ref);
413  if (!ist->dec_ctx->hw_device_ctx)
414  return AVERROR(ENOMEM);
415 
416  return 0;
417 }
418 
420 {
421  const AVCodecHWConfig *config;
422  HWDevice *dev = NULL;
423  AVBufferRef *frames_ref = NULL;
424  int i;
425 
426  if (ost->filter) {
428  if (frames_ref &&
429  ((AVHWFramesContext*)frames_ref->data)->format ==
430  ost->enc_ctx->pix_fmt) {
431  // Matching format, will try to use hw_frames_ctx.
432  } else {
433  frames_ref = NULL;
434  }
435  }
436 
437  for (i = 0;; i++) {
439  if (!config)
440  break;
441 
442  if (frames_ref &&
444  (config->pix_fmt == AV_PIX_FMT_NONE ||
445  config->pix_fmt == ost->enc_ctx->pix_fmt)) {
446  av_log(ost->enc_ctx, AV_LOG_VERBOSE, "Using input "
447  "frames context (format %s) with %s encoder.\n",
449  ost->enc->name);
450  ost->enc_ctx->hw_frames_ctx = av_buffer_ref(frames_ref);
451  if (!ost->enc_ctx->hw_frames_ctx)
452  return AVERROR(ENOMEM);
453  return 0;
454  }
455 
456  if (!dev &&
458  dev = hw_device_get_by_type(config->device_type);
459  }
460 
461  if (dev) {
462  av_log(ost->enc_ctx, AV_LOG_VERBOSE, "Using device %s "
463  "(type %s) with %s encoder.\n", dev->name,
464  av_hwdevice_get_type_name(dev->type), ost->enc->name);
466  if (!ost->enc_ctx->hw_device_ctx)
467  return AVERROR(ENOMEM);
468  } else {
469  // No device required, or no device available.
470  }
471  return 0;
472 }
473 
475 {
476  InputStream *ist = avctx->opaque;
477  AVFrame *output = NULL;
478  enum AVPixelFormat output_format = ist->hwaccel_output_format;
479  int err;
480 
481  if (input->format == output_format) {
482  // Nothing to do.
483  return 0;
484  }
485 
487  if (!output)
488  return AVERROR(ENOMEM);
489 
490  output->format = output_format;
491 
493  if (err < 0) {
494  av_log(avctx, AV_LOG_ERROR, "Failed to transfer data to "
495  "output frame: %d.\n", err);
496  goto fail;
497  }
498 
500  if (err < 0) {
502  goto fail;
503  }
504 
508 
509  return 0;
510 
511 fail:
513  return err;
514 }
515 
517 {
518  InputStream *ist = avctx->opaque;
519 
520  ist->hwaccel_retrieve_data = &hwaccel_retrieve_data;
521 
522  return 0;
523 }
524 
526 {
527  HWDevice *dev;
528  int i;
529 
530  // If the user has supplied exactly one hardware device then just
531  // give it straight to every filter for convenience. If more than
532  // one device is available then the user needs to pick one explcitly
533  // with the filter_hw_device option.
534  if (filter_hw_device)
535  dev = filter_hw_device;
536  else if (nb_hw_devices == 1)
537  dev = hw_devices[0];
538  else
539  dev = NULL;
540 
541  if (dev) {
542  for (i = 0; i < fg->graph->nb_filters; i++) {
543  fg->graph->filters[i]->hw_device_ctx =
545  if (!fg->graph->filters[i]->hw_device_ctx)
546  return AVERROR(ENOMEM);
547  }
548  }
549 
550  return 0;
551 }
AVCodec
AVCodec.
Definition: codec.h:197
AVPixelFormat
AVPixelFormat
Pixel format.
Definition: pixfmt.h:64
name
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this just let it vf default minimum maximum flags name is the option name
Definition: writing_filters.txt:88
AVERROR
Filter the word “frame” indicates either a video frame or a group of audio as stored in an AVFrame structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel sample they are references to shared objects When the negotiation mechanism computes the intersection of the formats supported at each end of a all references to both lists are replaced with a reference to the intersection And when a single format is eventually chosen for a link amongst the remaining all references to the list are updated That means that if a filter requires that its input and output have the same format amongst a supported all it has to do is use a reference to the same list of formats query_formats can leave some formats unset and return AVERROR(EAGAIN) to cause the negotiation mechanism toagain later. That can be used by filters with complex requirements to use the format negotiated on one link to set the formats supported on another. Frame references ownership and permissions
OutputStream::enc
AVCodecContext * enc
Definition: muxing.c:56
OutputStream::enc_ctx
AVCodecContext * enc_ctx
Definition: ffmpeg.h:475
AVBufferRef::data
uint8_t * data
The data buffer.
Definition: buffer.h:92
output
filter_frame For filters that do not use the this method is called when a frame is pushed to the filter s input It can be called at any time except in a reentrant way If the input frame is enough to produce output
Definition: filter_design.txt:225
av_frame_free
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
Definition: frame.c:111
AVFrame
This structure describes decoded (raw) audio or video data.
Definition: frame.h:303
pixdesc.h
index
fg index
Definition: ffmpeg_filter.c:168
AV_HWDEVICE_TYPE_NONE
@ AV_HWDEVICE_TYPE_NONE
Definition: hwcontext.h:28
av_hwdevice_find_type_by_name
enum AVHWDeviceType av_hwdevice_find_type_by_name(const char *name)
Look up an AVHWDeviceType by name.
Definition: hwcontext.c:82
ffmpeg.h
AV_LOG_VERBOSE
#define AV_LOG_VERBOSE
Detailed information.
Definition: log.h:197
AVFilterContext::hw_device_ctx
AVBufferRef * hw_device_ctx
For filters which will create hardware frames, sets the device the filter should create them in.
Definition: avfilter.h:389
AVDictionary
Definition: dict.c:30
HWDevice
Definition: ffmpeg.h:73
hw_device_default_name
static char * hw_device_default_name(enum AVHWDeviceType type)
Definition: ffmpeg_hw.c:69
av_buffersink_get_hw_frames_ctx
AVBufferRef * av_buffersink_get_hw_frames_ctx(const AVFilterContext *ctx)
tf_sess_config.config
config
Definition: tf_sess_config.py:33
av_malloc
#define av_malloc(s)
Definition: tableprint_vlc.h:31
InputStream
Definition: ffmpeg.h:300
fail
#define fail()
Definition: checkasm.h:134
type
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this just let it vf type
Definition: writing_filters.txt:86
ist
fg inputs[0] ist
Definition: ffmpeg_filter.c:182
hw_device_free_all
void hw_device_free_all(void)
Definition: ffmpeg_hw.c:274
av_frame_alloc
AVFrame * av_frame_alloc(void)
Allocate an AVFrame and set its fields to default values.
Definition: frame.c:98
hw_device_init_from_type
static int hw_device_init_from_type(enum AVHWDeviceType type, const char *device, HWDevice **dev_out)
Definition: ffmpeg_hw.c:231
AV_LOG_ERROR
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
Definition: log.h:181
nb_hw_devices
static int nb_hw_devices
Definition: ffmpeg_hw.c:27
AV_CODEC_HW_CONFIG_METHOD_HW_FRAMES_CTX
@ AV_CODEC_HW_CONFIG_METHOD_HW_FRAMES_CTX
The codec supports this format via the hw_frames_ctx interface.
Definition: codec.h:435
HWACCEL_GENERIC
@ HWACCEL_GENERIC
Definition: ffmpeg.h:61
AVHWDeviceType
AVHWDeviceType
Definition: hwcontext.h:27
av_hwdevice_get_type_name
const char * av_hwdevice_get_type_name(enum AVHWDeviceType type)
Get the string name of an AVHWDeviceType.
Definition: hwcontext.c:92
hw_device_get_by_name
HWDevice * hw_device_get_by_name(const char *name)
Definition: ffmpeg_hw.c:44
arg
const char * arg
Definition: jacosubdec.c:67
NULL
#define NULL
Definition: coverity.c:32
av_frame_copy_props
int av_frame_copy_props(AVFrame *dst, const AVFrame *src)
Copy only "metadata" fields from src to dst.
Definition: frame.c:536
av_buffer_unref
void av_buffer_unref(AVBufferRef **buf)
Free a given reference and automatically free the buffer if there are no more references to it.
Definition: buffer.c:125
AVFilterGraph::filters
AVFilterContext ** filters
Definition: avfilter.h:800
AV_CODEC_HW_CONFIG_METHOD_HW_DEVICE_CTX
@ AV_CODEC_HW_CONFIG_METHOD_HW_DEVICE_CTX
The codec supports this format via the hw_device_ctx interface.
Definition: codec.h:422
hw_devices
static HWDevice ** hw_devices
Definition: ffmpeg_hw.c:28
src
#define src
Definition: vp8dsp.c:255
hw_device_add
static HWDevice * hw_device_add(void)
Definition: ffmpeg_hw.c:54
hwaccel_retrieve_data
static int hwaccel_retrieve_data(AVCodecContext *avctx, AVFrame *input)
Definition: ffmpeg_hw.c:474
hwaccel_decode_init
int hwaccel_decode_init(AVCodecContext *avctx)
Definition: ffmpeg_hw.c:516
FilterGraph
Definition: ffmpeg.h:287
hw_device_match_by_codec
static HWDevice * hw_device_match_by_codec(const AVCodec *codec)
Definition: ffmpeg_hw.c:286
options
const OptionDef options[]
OutputStream::filter
OutputFilter * filter
Definition: ffmpeg.h:515
FilterGraph::graph
AVFilterGraph * graph
Definition: ffmpeg.h:291
HWDevice::device_ref
AVBufferRef * device_ref
Definition: ffmpeg.h:76
OutputFilter::filter
AVFilterContext * filter
Definition: ffmpeg.h:265
av_reallocp_array
int av_reallocp_array(void *ptr, size_t nmemb, size_t size)
Allocate, reallocate, or free an array through a pointer to a pointer.
Definition: mem.c:213
av_dict_free
void av_dict_free(AVDictionary **pm)
Free all the memory allocated for an AVDictionary struct and all keys and values.
Definition: dict.c:203
input
and forward the test the status of outputs and forward it to the corresponding return FFERROR_NOT_READY If the filters stores internally one or a few frame for some input
Definition: filter_design.txt:172
AV_LOG_INFO
#define AV_LOG_INFO
Standard information.
Definition: log.h:192
buffersink.h
HWACCEL_AUTO
@ HWACCEL_AUTO
Definition: ffmpeg.h:60
i
int i
Definition: input.c:407
av_hwdevice_ctx_create_derived
int av_hwdevice_ctx_create_derived(AVBufferRef **dst_ref_ptr, enum AVHWDeviceType type, AVBufferRef *src_ref, int flags)
Create a new device of the specified type from an existing device.
Definition: hwcontext.c:714
hw_device_setup_for_decode
int hw_device_setup_for_decode(InputStream *ist)
Definition: ffmpeg_hw.c:303
av_frame_move_ref
void av_frame_move_ref(AVFrame *dst, AVFrame *src)
Move everything contained in src to dst and reset src.
Definition: frame.c:460
av_frame_unref
void av_frame_unref(AVFrame *frame)
Unreference all the buffers referenced by frame and reset the frame fields.
Definition: frame.c:436
av_mallocz
void * av_mallocz(size_t size)
Allocate a memory block with alignment suitable for all memory accesses (including vectors if availab...
Definition: mem.c:244
AVCodecContext::hw_device_ctx
AVBufferRef * hw_device_ctx
A reference to the AVHWDeviceContext describing the device which will be used by a hardware encoder/d...
Definition: avcodec.h:1895
AVCodecContext::pix_fmt
enum AVPixelFormat pix_fmt
Pixel format, see AV_PIX_FMT_xxx.
Definition: avcodec.h:594
AVCodecContext::hw_frames_ctx
AVBufferRef * hw_frames_ctx
A reference to the AVHWFramesContext describing the input (for encoding) or output (decoding) frames.
Definition: avcodec.h:1846
AVHWFramesContext
This struct describes a set or pool of "hardware" frames (i.e.
Definition: hwcontext.h:124
av_hwdevice_ctx_create
int av_hwdevice_ctx_create(AVBufferRef **pdevice_ref, enum AVHWDeviceType type, const char *device, AVDictionary *opts, int flags)
Open a device of the specified type and create an AVHWDeviceContext for it.
Definition: hwcontext.c:610
AVCodecContext::opaque
void * opaque
Private data of the user, can be used to carry app specific stuff.
Definition: avcodec.h:426
av_hwframe_transfer_data
int av_hwframe_transfer_data(AVFrame *dst, const AVFrame *src, int flags)
Copy data to or from a hw surface.
Definition: hwcontext.c:443
ost
OutputStream * ost
Definition: ffmpeg_filter.c:163
filter_hw_device
HWDevice * filter_hw_device
Definition: ffmpeg_opt.c:145
AVCodecContext
main external API structure.
Definition: avcodec.h:384
HWDevice::name
const char * name
Definition: ffmpeg.h:74
AV_PIX_FMT_NONE
@ AV_PIX_FMT_NONE
Definition: pixfmt.h:65
av_dict_parse_string
int av_dict_parse_string(AVDictionary **pm, const char *str, const char *key_val_sep, const char *pairs_sep, int flags)
Parse the key/value pairs list and add the parsed entries to a dictionary.
Definition: dict.c:180
hw_device_setup_for_encode
int hw_device_setup_for_encode(OutputStream *ost)
Definition: ffmpeg_hw.c:419
hw_device_init_from_string
int hw_device_init_from_string(const char *arg, HWDevice **dev_out)
Definition: ffmpeg_hw.c:94
av_buffer_ref
AVBufferRef * av_buffer_ref(AVBufferRef *buf)
Create a new reference to an AVBuffer.
Definition: buffer.c:93
HWACCEL_NONE
@ HWACCEL_NONE
Definition: ffmpeg.h:59
avcodec_get_hw_config
const AVCodecHWConfig * avcodec_get_hw_config(const AVCodec *codec, int index)
Retrieve supported hardware configurations for a codec.
Definition: utils.c:858
AVBufferRef
A reference to a data buffer.
Definition: buffer.h:84
av_freep
#define av_freep(p)
Definition: tableprint_vlc.h:35
HWDevice::type
enum AVHWDeviceType type
Definition: ffmpeg.h:75
OutputStream
Definition: muxing.c:54
av_log
#define av_log(a,...)
Definition: tableprint_vlc.h:28
AVCodecHWConfig
Definition: codec.h:454
hw_device_setup_for_filter
int hw_device_setup_for_filter(FilterGraph *fg)
Definition: ffmpeg_hw.c:525
AVFilterGraph::nb_filters
unsigned nb_filters
Definition: avfilter.h:801
avstring.h
av_strndup
char * av_strndup(const char *s, size_t len)
Duplicate a substring of a string.
Definition: mem.c:272
snprintf
#define snprintf
Definition: snprintf.h:34
av_get_pix_fmt_name
const char * av_get_pix_fmt_name(enum AVPixelFormat pix_fmt)
Return the short name for a pixel format, NULL in case pix_fmt is unknown.
Definition: pixdesc.c:2461
hw_device_get_by_type
static HWDevice * hw_device_get_by_type(enum AVHWDeviceType type)
Definition: ffmpeg_hw.c:30