ffmpeg: move media codecs config & seccomp policy to device

* 71ac744017
This commit is contained in:
Konsta
2025-04-07 21:07:48 +03:00
parent 1b4858762d
commit 2103ad1dea
3 changed files with 169 additions and 0 deletions

View File

@@ -163,6 +163,10 @@ PRODUCT_COPY_FILES += \
PRODUCT_PACKAGES += \
android.hardware.media.c2@1.2-service-ffmpeg
PRODUCT_COPY_FILES += \
$(DEVICE_PATH)/media/media_codecs_ffmpeg_c2.xml:$(TARGET_COPY_OUT_VENDOR)/etc/media_codecs_ffmpeg_c2.xml \
$(DEVICE_PATH)/seccomp_policy/android.hardware.media.c2-ffmpeg.policy:$(TARGET_COPY_OUT_VENDOR)/etc/seccomp_policy/android.hardware.media.c2-ffmpeg.policy
# Gatekeeper
PRODUCT_PACKAGES += \
com.android.hardware.gatekeeper.nonsecure

View File

@@ -0,0 +1,108 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2022 Michael Goffioul <michael.goffioul@gmail.com>
Copyright (C) 2025 KonstaKANG
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<MediaCodecs>
<Decoders>
<!-- Audio codecs -->
<MediaCodec name="c2.ffmpeg.aac.decoder" type="audio/mp4a-latm">
<Alias name="OMX.ffmpeg.aac.decoder" />
<Limit name="channel-count" max="8" />
<Limit name="sample-rate" ranges="8000-192000" />
</MediaCodec>
<MediaCodec name="c2.ffmpeg.ac3.decoder" type="audio/ac3">
<Alias name="OMX.ffmpeg.ac3.decoder" />
<Limit name="channel-count" max="8" />
<Limit name="sample-rate" ranges="8000-192000" />
</MediaCodec>
<MediaCodec name="c2.ffmpeg.alac.decoder" type="audio/alac">
<Alias name="OMX.ffmpeg.alac.decoder" />
<Limit name="channel-count" max="8" />
<Limit name="sample-rate" ranges="8000-192000" />
</MediaCodec>
<MediaCodec name="c2.ffmpeg.flac.decoder" type="audio/flac">
<Alias name="OMX.ffmpeg.flac.decoder" />
<Limit name="channel-count" max="8" />
<Limit name="sample-rate" ranges="8000-192000" />
</MediaCodec>
<MediaCodec name="c2.ffmpeg.mp2.decoder" type="audio/mpeg-L2">
<Alias name="OMX.ffmpeg.mp2.decoder" />
<Limit name="channel-count" max="8" />
<Limit name="sample-rate" ranges="8000-192000" />
</MediaCodec>
<MediaCodec name="c2.ffmpeg.mp3.decoder" type="audio/mpeg">
<Alias name="OMX.ffmpeg.mp3.decoder" />
<Limit name="channel-count" max="8" />
<Limit name="sample-rate" ranges="8000-192000" />
</MediaCodec>
<MediaCodec name="c2.ffmpeg.vorbis.decoder" type="audio/vorbis">
<Alias name="OMX.ffmpeg.vorbisac3.decoder" />
<Limit name="channel-count" max="8" />
<Limit name="sample-rate" ranges="8000-192000" />
</MediaCodec>
<!-- Video codecs -->
<MediaCodec name="c2.ffmpeg.av1.decoder" type="video/av01">
<Alias name="OMX.ffmpeg.av1.decoder" />
<Limit name="size" min="2x2" max="2048x2048" />
<Limit name="alignment" value="2x2" />
<Feature name="adaptive-playback" />
</MediaCodec>
<MediaCodec name="c2.ffmpeg.h263.decoder" type="video/3gpp">
<Alias name="OMX.ffmpeg.h263.decoder" />
<Limit name="size" min="2x2" max="2048x2048" />
<Limit name="alignment" value="2x2" />
<Feature name="adaptive-playback" />
</MediaCodec>
<MediaCodec name="c2.ffmpeg.h264.decoder" type="video/avc">
<Alias name="OMX.ffmpeg.h264.decoder" />
<Limit name="size" min="2x2" max="4080x4080" />
<Limit name="alignment" value="2x2" />
<Feature name="adaptive-playback" />
</MediaCodec>
<MediaCodec name="c2.ffmpeg.hevc.decoder" type="video/hevc">
<Alias name="OMX.ffmpeg.hevc.decoder" />
<Limit name="size" min="2x2" max="4096x4096" />
<Limit name="alignment" value="2x2" />
<Feature name="adaptive-playback" />
</MediaCodec>
<MediaCodec name="c2.ffmpeg.mpeg2.decoder" type="video/mpeg2">
<Alias name="OMX.ffmpeg.mpeg2.decoder" />
<Limit name="size" min="2x2" max="2048x2048" />
<Limit name="alignment" value="2x2" />
<Feature name="adaptive-playback" />
</MediaCodec>
<MediaCodec name="c2.ffmpeg.mpeg4.decoder" type="video/mp4v-es">
<Alias name="OMX.ffmpeg.mpeg4.decoder" />
<Limit name="size" min="2x2" max="2048x2048" />
<Limit name="alignment" value="2x2" />
<Feature name="adaptive-playback" />
</MediaCodec>
<MediaCodec name="c2.ffmpeg.vp8.decoder" type="video/x-vnd.on2.vp8">
<Alias name="OMX.ffmpeg.vp8.decoder" />
<Limit name="size" min="2x2" max="2048x2048" />
<Limit name="alignment" value="2x2" />
<Feature name="adaptive-playback" />
</MediaCodec>
<MediaCodec name="c2.ffmpeg.vp9.decoder" type="video/x-vnd.on2.vp9">
<Alias name="OMX.ffmpeg.vp9.decoder" />
<Limit name="size" min="2x2" max="2048x2048" />
<Limit name="alignment" value="2x2" />
<Feature name="adaptive-playback" />
</MediaCodec>
</Decoders>
</MediaCodecs>

View File

@@ -0,0 +1,57 @@
# device specific syscalls
clock_gettime: 1
clone: 1
close: 1
dup: 1
eventfd2: 1
exit_group: 1
exit: 1
faccessat: 1
fstat: 1
fstatfs: 1
ftruncate: 1
futex: 1
getdents64: 1
getegid: 1
geteuid: 1
getgid: 1
getgroups: 1
getpid: 1
getrandom: 1
getrlimit: 1
gettid: 1
gettimeofday: 1
getuid: 1
ioctl: 1
lseek: 1
madvise: 1
memfd_create: 1
mmap: arg2 in ~PROT_EXEC || arg2 in ~PROT_WRITE
mprotect: arg2 in ~PROT_EXEC || arg2 in ~PROT_WRITE
mremap: arg3 == 3 || arg3 == MREMAP_MAYMOVE
munmap: 1
nanosleep: 1
newfstatat: 1
openat: 1
pipe2: 1
ppoll: 1
prctl: 1
pread64: 1
process_vm_readv: 1
read: 1
readlinkat: 1
recvmsg: 1
restart_syscall: 1
rt_sigaction: 1
rt_sigprocmask: 1
rt_sigreturn: 1
rt_tgsigqueueinfo: 1
sched_getaffinity: 1
sched_yield: 1
set_tid_address: 1
setpriority: 1
sigaltstack: 1
sysinfo: 1
tgkill: 1
write: 1
writev: 1