Skip to content

Commit

Permalink
Fix flatpak builds not being able to record video
Browse files Browse the repository at this point in the history
  • Loading branch information
exelix11 committed Jan 4, 2024
1 parent 0971a91 commit 6df1330
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
7 changes: 5 additions & 2 deletions Client/GUI/PlayerView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -568,8 +568,11 @@ void ButtonToggleRecording()
catch (Exception ex)
{
MessageUi("Failed to start recording: " + ex.ToString());
}
}

videoRecorder?.Dispose();
videoRecorder = null;
}
}
else
{
player.Manager.UnchainTargets(videoRecorder.VideoTarget, videoRecorder.AudioTarget);
Expand Down
3 changes: 1 addition & 2 deletions Client/Platform/Linux/com.github.exelix11.sysdvr.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,7 @@
"--disable-static",
"--enable-gnutls",
"--disable-doc",
"--disable-programs",
"--disable-encoders"
"--disable-programs"
],
"sources": [{
"type": "archive",
Expand Down
5 changes: 4 additions & 1 deletion Client/Targets/FileOutput/Mp4Streams.cs
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,12 @@ public void StartWithContext(AVFormatContext* ctx, object sync, int id)
timebase_den = outCtx->streams[id]->time_base.den;

var encoder = avcodec_find_encoder(AVCodecID.AV_CODEC_ID_MP2);
if (encoder == null)
throw new Exception("Couldn't find MP2 encoder");

codecCtx = avcodec_alloc_context3(encoder);
if (codecCtx == null) throw new Exception("Couldn't allocate MP2 encoder");
if (codecCtx == null)
throw new Exception("Couldn't allocate MP2 encoder");

codecCtx->sample_rate = StreamInfo.AudioSampleRate;
av_channel_layout_default(&codecCtx->ch_layout, StreamInfo.AudioChannels);
Expand Down

0 comments on commit 6df1330

Please sign in to comment.