Browse Source

__Android

lizzie/mediatek-stuff-for-fun
lizzie 3 days ago
committed by crueter
parent
commit
6cb358ca67
  1. 8
      src/video_core/host1x/ffmpeg.cpp

8
src/video_core/host1x/ffmpeg.cpp

@ -87,7 +87,7 @@ std::string AVError(int errnum) {
return errbuf; return errbuf;
} }
#ifdef ANDROID
#ifdef __ANDROID__
// Match a 3- or 4-byte annex-B start code at `i`. Returns its length, or 0. // Match a 3- or 4-byte annex-B start code at `i`. Returns its length, or 0.
size_t MatchStartCode(std::span<const u8> data, size_t i) { size_t MatchStartCode(std::span<const u8> data, size_t i) {
const size_t n = data.size(); const size_t n = data.size();
@ -173,7 +173,7 @@ Decoder::Decoder(Tegra::Host1x::NvdecCommon::VideoCodec codec) {
} }
}(); }();
#ifdef ANDROID
#ifdef __ANDROID__
// FFmpeg exposes MediaCodec via dedicated decoders rather than as a // FFmpeg exposes MediaCodec via dedicated decoders rather than as a
// hw_config on the regular ones. // hw_config on the regular ones.
if (Settings::values.nvdec_emulation.GetValue() == Settings::NvdecEmulation::Gpu) { if (Settings::values.nvdec_emulation.GetValue() == Settings::NvdecEmulation::Gpu) {
@ -388,7 +388,7 @@ bool DecodeApi::Initialize(Tegra::Host1x::NvdecCommon::VideoCodec codec) {
m_hardware_context->InitializeForDecoder(*m_decoder_context, *m_decoder); m_hardware_context->InitializeForDecoder(*m_decoder_context, *m_decoder);
} }
#ifdef ANDROID
#ifdef __ANDROID__
// h264_mediacodec needs SPS/PPS in extradata at open. We pull them from // h264_mediacodec needs SPS/PPS in extradata at open. We pull them from
// the first frame's bitstream in SendPacket. // the first frame's bitstream in SendPacket.
m_needs_h264_extradata = m_decoder->GetCodec() && m_needs_h264_extradata = m_decoder->GetCodec() &&
@ -411,7 +411,7 @@ bool DecodeApi::SendPacket(std::span<const u8> packet_data, const FrameOffsets&
std::optional<FrameDimensions> dimensions) { std::optional<FrameDimensions> dimensions) {
if (!m_opened) { if (!m_opened) {
std::vector<u8> extradata; std::vector<u8> extradata;
#ifdef ANDROID
#ifdef __ANDROID__
if (m_needs_h264_extradata) { if (m_needs_h264_extradata) {
extradata = ExtractH264AnnexBExtradata(packet_data); extradata = ExtractH264AnnexBExtradata(packet_data);
if (extradata.empty()) { if (extradata.empty()) {

Loading…
Cancel
Save