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 <android/native_window.h>
22 #include <dlfcn.h>
23 #include <media/NdkMediaCodec.h>
24
30
33
37
38
41 {
45
46 if (device && device[0]) {
49 }
50
52 if (!strcmp(
entry->key,
"create_window"))
54 }
55
58
59 return 0;
60 }
61
63 {
66 ANativeWindow *native_window =
NULL;
67
69 return 0;
70
72 return 0;
73
74 // For backward compatibility, don't return error for a dummy
75 // AVHWDeviceContext without surface or native_window.
77 return 0;
78
79 s->libmedia = dlopen(
"libmediandk.so", RTLD_NOW);
82
83 s->create_surface = dlsym(
s->libmedia,
"AMediaCodec_createPersistentInputSurface");
84 if (!
s->create_surface)
86
87 s->create_surface(&native_window);
89 return 0;
90 }
91
93 {
97 return;
98
102 }
103 dlclose(
s->libmedia);
105 }
106
109 .name = "mediacodec",
110
112
116
120 },
121 };