FFmpeg
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
vda.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 "config.h"
20 
21 #include "libavutil/mem.h"
22 
23 #include "vda.h"
24 #include "vda_internal.h"
25 
26 #if CONFIG_H264_VDA_HWACCEL
28 {
29  AVVDAContext *ret = av_mallocz(sizeof(*ret));
30 
31  if (ret)
33 
34  return ret;
35 }
36 
38 {
40  if (!avctx->hwaccel_context)
41  return AVERROR(ENOMEM);
42  return ff_vda_default_init(avctx);
43 }
44 
46 {
47  ff_vda_default_free(avctx);
48  av_freep(&avctx->hwaccel_context);
49 }
50 
52 {
53  AVVDAContext *vda = avctx->hwaccel_context;
54  if (vda && vda->decoder)
55  VDADecoderDestroy(vda->decoder);
56 }
57 
58 #else
60 {
61  return NULL;
62 }
63 
65 {
66  return AVERROR(ENOSYS);
67 }
68 
70 {
71 }
72 #endif