Skip to content

Commit

Permalink
[ARC-237] Add Muxer that complements Seek Head and Cues information (#47
Browse files Browse the repository at this point in the history
)

* WIP: working but need review

* Review fixes

* Update XmfMuxer.h

* remove printf
  • Loading branch information
irvingoujAtDevolution authored Jul 17, 2024
1 parent dfacabe commit 28a632e
Show file tree
Hide file tree
Showing 5 changed files with 560 additions and 4 deletions.
17 changes: 15 additions & 2 deletions dotnet/Devolutions.Cadeau.Test/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -562,16 +562,29 @@ static void TestStreamingV3()
streamer.Disconnect();
}

static void TestMuxer() {
XmfMuxer muxer = new XmfMuxer();
string currentDir = Directory.GetCurrentDirectory();
string rootDir = Directory.GetParent(currentDir).Parent.FullName;
string mediaDir = Path.Combine(rootDir, "media");
string mediaFile = Path.Combine(mediaDir, "non-seekable-3.webm");
string outputFile = mediaFile.Replace(".webm", "-muxed.webm");
Console.WriteLine("media dir: {0}", mediaDir);
Console.WriteLine("output file: {0}", outputFile);
muxer.Remux(mediaFile, outputFile);
muxer.Free();
}
static void Main(string[] args)
{
//TestRecorder();
//TestBipBuffer();
//TestMkvStream();
//TestImageFile();
//TestTranscode();
// TestTranscode();
//TestWebSocket();
//TestStreaming();
TestStreamingV3();
//TestStreamingV3();
TestMuxer();
}
}
}
44 changes: 44 additions & 0 deletions dotnet/Devolutions.Cadeau/XmfMuxer.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
using System;
using System.Runtime.InteropServices;

namespace Devolutions.Cadeau
{
public class XmfMuxer
{
private IntPtr muxerHandle;

private static class ffi
{
[DllImport("xmf", EntryPoint = "XmfWebMMuxer_New")]
public static extern IntPtr New();

[DllImport("xmf", EntryPoint = "XmfWebMMuxer_Remux")]
public static extern int Remux(IntPtr muxer, [MarshalAs(UnmanagedType.LPStr)] string inputPath, [MarshalAs(UnmanagedType.LPStr)] string outputPath);

[DllImport("xmf", EntryPoint = "XmfWebMMuxer_Free")]
public static extern void Free(IntPtr muxer);
}

public IntPtr Handle => muxerHandle;

public XmfMuxer()
{
muxerHandle = ffi.New();
}

~XmfMuxer()
{
ffi.Free(muxerHandle);
}

public int Remux(string inputPath, string outputPath)
{
return ffi.Remux(muxerHandle, inputPath, outputPath);
}

public void Cleanup()
{
ffi.Free(muxerHandle);
}
}
}
8 changes: 6 additions & 2 deletions libxmf/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ set(${MODULE_PREFIX}_SOURCES
XmfBipBuffer.c
XmfMkvWriter.c
XmfNamedPipe.c
XmfRecorder.c)
XmfRecorder.c
XmfMuxer.cpp
)

set(${MODULE_PREFIX}_HEADERS
XmfMath.h
Expand All @@ -26,7 +28,9 @@ set(${MODULE_PREFIX}_HEADERS
XmfBipBuffer.h
XmfMkvWriter.h
XmfNamedPipe.h
XmfRecorder.h)
XmfRecorder.h
XmfMuxer.h
)

set(${MODULE_PREFIX}_RESOURCES "")

Expand Down
Loading

0 comments on commit 28a632e

Please sign in to comment.