Skip to content

Commit

Permalink
Merge pull request #6313 from bdach/fix-decode-android
Browse files Browse the repository at this point in the history
Fix video decoding failing on Android due to missing `av_dict_{set,free}`
  • Loading branch information
peppy authored Jun 25, 2024
2 parents 98617ab + 52e12f8 commit 94cd76a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
5 changes: 5 additions & 0 deletions osu.Framework/Graphics/Video/FFmpegFuncs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

using System.Runtime.InteropServices;
using FFmpeg.AutoGen;
using JetBrains.Annotations;

// ReSharper disable InconsistentNaming
#pragma warning disable IDE1006 // Naming style
Expand Down Expand Up @@ -93,8 +94,12 @@ public unsafe class FFmpegFuncs

#endregion

[CanBeNull]
public AvDictSetDelegate av_dict_set;

[CanBeNull]
public AvDictFreeDelegate av_dict_free;

public AvFrameAllocDelegate av_frame_alloc;
public AvFrameFreeDelegate av_frame_free;
public AvFrameUnrefDelegate av_frame_unref;
Expand Down
4 changes: 2 additions & 2 deletions osu.Framework/Graphics/Video/VideoDecoder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -351,9 +351,9 @@ private void prepareDecoding()

AVDictionary* options = null;
// see https://github.com/ppy/osu/issues/13696 for reasoning
ffmpeg.av_dict_set(&options, "ignore_editlist", "1", 0);
ffmpeg.av_dict_set?.Invoke(&options, "ignore_editlist", "1", 0);
int openInputResult = ffmpeg.avformat_open_input(&fcPtr, "pipe:", null, &options);
ffmpeg.av_dict_free(&options);
ffmpeg.av_dict_free?.Invoke(&options);

inputOpened = openInputResult >= 0;
if (!inputOpened)
Expand Down

0 comments on commit 94cd76a

Please sign in to comment.