media: ffmpeg: Add binding to obtain the required buffer alignment.

FFmpeg requires buffer alignment in case of SIMD-accelerated codec
implementations. This patch prepares for exposing the
respective requirement in the virtio-video interface.

BUG=None
TEST=cargo build -p ffmpeg

Change-Id: Ia8f3b2987571ddb8cf84b1201019ded83547e8f0
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3822430
Commit-Queue: Tatsuyuki Ishi <ishitatsuyuki@google.com>
Tested-by: Tatsuyuki Ishi <ishitatsuyuki@google.com>
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
This commit is contained in:
Tatsuyuki Ishi 2022-08-09 11:24:09 +09:00 committed by crosvm LUCI
parent abe55a9e95
commit d06145a1ce

View file

@ -2,4 +2,13 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
use crate::ffi;
pub const AV_NOPTS_VALUE: u64 = 0x8000000000000000;
/// Get the maximum data alignment that may be required by FFmpeg.
/// This could change depending on FFmpeg's build configuration (AVX etc.).
pub fn max_buffer_alignment() -> usize {
// Safe because this function has no side effects and just returns an integer.
unsafe { ffi::av_cpu_max_align() as usize }
}