LibMedia+Meta: Enable FFmpeg under Android and remove the stubs

The licensing issue seems to be resolved (#2214).
The stubs are not longer necessary. Even if they were, they do not
compile properly.
This commit is contained in:
Olekoop 2025-07-03 19:25:39 +02:00 committed by Andrew Kaster
commit af2d46bd3d
Notes: github-actions[bot] 2025-07-10 21:46:32 +00:00
5 changed files with 15 additions and 112 deletions

View file

@ -1,8 +1,6 @@
include(audio)
if (NOT ANDROID)
include(ffmpeg)
endif()
include(ffmpeg)
set(SOURCES
Audio/Loader.cpp
@ -19,20 +17,19 @@ set(SOURCES
ladybird_lib(LibMedia media)
target_link_libraries(LibMedia PRIVATE LibCore LibCrypto LibIPC LibGfx LibThreading LibUnicode)
target_sources(LibMedia PRIVATE
Audio/FFmpegLoader.cpp
FFmpeg/FFmpegDemuxer.cpp
FFmpeg/FFmpegIOContext.cpp
FFmpeg/FFmpegVideoDecoder.cpp
)
if (NOT ANDROID)
target_sources(LibMedia PRIVATE
Audio/FFmpegLoader.cpp
FFmpeg/FFmpegDemuxer.cpp
FFmpeg/FFmpegIOContext.cpp
FFmpeg/FFmpegVideoDecoder.cpp
)
target_link_libraries(LibMedia PRIVATE PkgConfig::AVCODEC PkgConfig::AVFORMAT PkgConfig::AVUTIL)
else()
# FIXME: Need to figure out how to build or replace ffmpeg libs on Android and Windows
target_sources(LibMedia PRIVATE
FFmpeg/FFmpegDemuxerStub.cpp
FFmpeg/FFmpegVideoDecoderStub.cpp
)
target_include_directories(LibMedia PRIVATE ${FFMPEG_INCLUDE_DIRS})
target_link_directories(LibMedia PRIVATE ${FFMPEG_LIBRARY_DIRS})
target_link_libraries(LibMedia PRIVATE ${FFMPEG_LIBRARIES})
endif()
if (LADYBIRD_AUDIO_BACKEND STREQUAL "PULSE")

View file

@ -1,48 +0,0 @@
/*
* Copyright (c) 2025, Luke Wilde <luke@ladybird.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <LibMedia/FFmpeg/FFmpegDemuxer.h>
namespace Media::FFmpeg {
DecoderErrorOr<Vector<Track>> FFmpegDemuxer::get_tracks_for_type(TrackType type)
{
(void)type;
return DecoderError::format(DecoderErrorCategory::NotImplemented, "FFmpeg not available on this platform");
}
DecoderErrorOr<Optional<AK::Duration>> FFmpegDemuxer::seek_to_most_recent_keyframe(Track track, AK::Duration timestamp, Optional<AK::Duration> earliest_available_sample = OptionalNone())
{
(void)track;
(void)timestamp;
(void)earliest_available_sample;
return DecoderError::format(DecoderErrorCategory::NotImplemented, "FFmpeg not available on this platform");
}
DecoderErrorOr<AK::Duration> FFmpegDemuxer::duration()
{
return DecoderError::format(DecoderErrorCategory::NotImplemented, "FFmpeg not available on this platform");
}
DecoderErrorOr<CodecID> FFmpegDemuxer::get_codec_id_for_track(Track track)
{
(void)track;
return DecoderError::format(DecoderErrorCategory::NotImplemented, "FFmpeg not available on this platform");
}
DecoderErrorOr<ReadonlyBytes> FFmpegDemuxer::get_codec_initialization_data_for_track(Track track)
{
(void)track;
return DecoderError::format(DecoderErrorCategory::NotImplemented, "FFmpeg not available on this platform");
}
DecoderErrorOr<Sample> FFmpegDemuxer::get_next_sample_for_track(Track track)
{
(void)track;
return DecoderError::format(DecoderErrorCategory::NotImplemented, "FFmpeg not available on this platform");
}
}

View file

@ -1,49 +0,0 @@
/*
* Copyright (c) 2024, Alex Studer <alex@studer.dev>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <LibCore/System.h>
#include <LibMedia/VideoFrame.h>
#include "FFmpegForward.h"
#include "FFmpegVideoDecoder.h"
namespace Media::FFmpeg {
DecoderErrorOr<NonnullOwnPtr<FFmpegVideoDecoder>> FFmpegVideoDecoder::try_create(CodecID codec_id, ReadonlyBytes codec_initialization_data)
{
(void)codec_id;
(void)codec_initialization_data;
return DecoderError::format(DecoderErrorCategory::NotImplemented, "FFmpeg not available on this platform");
}
FFmpegVideoDecoder::FFmpegVideoDecoder(AVCodecContext* codec_context, AVPacket* packet, AVFrame* frame)
: m_codec_context(codec_context)
, m_packet(packet)
, m_frame(frame)
{
}
FFmpegVideoDecoder::~FFmpegVideoDecoder()
{
}
DecoderErrorOr<void> FFmpegVideoDecoder::receive_sample(AK::Duration timestamp, ReadonlyBytes sample)
{
(void)timestamp;
(void)sample;
return DecoderError::format(DecoderErrorCategory::NotImplemented, "FFmpeg not available on this platform");
}
DecoderErrorOr<NonnullOwnPtr<VideoFrame>> FFmpegVideoDecoder::get_decoded_frame()
{
return DecoderError::format(DecoderErrorCategory::NotImplemented, "FFmpeg not available on this platform");
}
void FFmpegVideoDecoder::flush()
{
}
}

View file

@ -1,6 +1,10 @@
include_guard()
if (NOT ANDROID)
find_package(PkgConfig REQUIRED)
pkg_check_modules(AVCODEC REQUIRED IMPORTED_TARGET libavcodec)
pkg_check_modules(AVFORMAT REQUIRED IMPORTED_TARGET libavformat)
pkg_check_modules(AVUTIL REQUIRED IMPORTED_TARGET libavutil)
else()
find_package(FFMPEG REQUIRED)
endif()

View file

@ -31,7 +31,6 @@
"fast-float",
{
"name": "ffmpeg",
"platform": "!android",
"features": [
"avcodec",
"avformat",