feat(player): demux direct-played containers with ffmpeg on Android
Direct play on Android kept accumulating container patches: AVI with XviD packed-bitstream timestamps and missing VOL csd played broken, ASF/WMV and MPEG-PS/VOB had no media3 extractor at all, and MKV needed a custom extractor stack for zlib-compressed subtitles, LOAS/LATM audio, cueless seeking, and font attachments. Demux progressive containers with libavformat behind media3's extractor API. An AVIO bridge serves libavformat from the ExtractorInput: every position divergence defers into a RESULT_SEEK round trip, header reads replay from a block cache while avformat_open_input restarts, and avformat_seek_file executes seeks with bounded loader round trips. Packets feed media3's TrackOutputs, so decoders, passthrough carriers, Dolby Vision RPU/EL conversion (dvh1 codecs string surfaced from DOVI side data), and the subtitle pipeline are untouched: embedded fonts feed AssHandler over JNI, ASS reaches libass as per-sample dialogue, SRT/VTT render as cues, VobSub maps through media3's VobsubParser, and LOAS/LATM AAC unwraps via LatmTrackOutput. Under the default Auto preference FFmpeg demuxes AVI, ASF/WMV, MPEG-PS, and Matroska/WebM and sits behind media3's list as an any-container fallback; MP4/TS keep media3's extractors. A playback setting exposes auto / FFmpeg first / media3 only, and the JNI load-failure path falls back to stock media3. The custom Matroska extractor stack and its reflection keeps are retired. Verified on Pixel 7 (API 36), Box R 4K Plus TV (API 34), and SHIELD TV (API 30): instrumentation playback suites, the minified R8 reachability gate, and an on-device container matrix with forward and backward seek landings plus visual subtitle checks. close #2052
This commit is contained in:
@@ -19,20 +19,22 @@ else()
|
||||
target_link_libraries(dovi_bridge log)
|
||||
endif()
|
||||
|
||||
foreach(ffmpeg_library avcodec avutil swresample)
|
||||
foreach(ffmpeg_library avcodec avformat avutil swresample)
|
||||
add_library(${ffmpeg_library} SHARED IMPORTED)
|
||||
set_target_properties(${ffmpeg_library} PROPERTIES
|
||||
IMPORTED_LOCATION "${MPV_FFMPEG_ROOT}/native/${ANDROID_ABI}/lib${ffmpeg_library}.so")
|
||||
endforeach()
|
||||
|
||||
add_library(ffmpegJNI SHARED
|
||||
media3_ffmpeg_decoder/ffmpeg_jni.cc)
|
||||
media3_ffmpeg_decoder/ffmpeg_jni.cc
|
||||
media3_ffmpeg_demuxer/ffmpeg_demuxer_jni.cc)
|
||||
target_compile_features(ffmpegJNI PRIVATE cxx_std_17)
|
||||
target_include_directories(ffmpegJNI PRIVATE
|
||||
"${MPV_FFMPEG_ROOT}/include"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/media3_ffmpeg_decoder")
|
||||
target_link_libraries(ffmpegJNI
|
||||
avcodec
|
||||
avformat
|
||||
avutil
|
||||
swresample
|
||||
android
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user