mirror of
https://github.com/Ryujinx/GtkSharp.git
synced 2025-04-28 20:56:21 +00:00
Add GStreamer support
svn path=/trunk/gtk-sharp/; revision=8727
This commit is contained in:
parent
e06e2ba8dd
commit
fc9daa9420
35
gst/Application.cs
Executable file
35
gst/Application.cs
Executable file
|
@ -0,0 +1,35 @@
|
||||||
|
//
|
||||||
|
// Application.cs - Gst initialization
|
||||||
|
//
|
||||||
|
// Author: Alp Toker <alp@atoker.com>
|
||||||
|
//
|
||||||
|
// 2002 (C) Copyright, Alp Toker
|
||||||
|
//
|
||||||
|
|
||||||
|
|
||||||
|
namespace Gst {
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
|
public class Application {
|
||||||
|
|
||||||
|
[DllImport("gstreamer-0.4.1")]
|
||||||
|
static extern void gst_init (int argc, IntPtr argv);
|
||||||
|
|
||||||
|
public static void Init ()
|
||||||
|
{
|
||||||
|
gst_init (0, new IntPtr(0));
|
||||||
|
}
|
||||||
|
|
||||||
|
[DllImport("gstreamer-0.4.1")]
|
||||||
|
static extern void gst_init (ref int argc, ref String[] argv);
|
||||||
|
|
||||||
|
public static void Init (ref string[] args)
|
||||||
|
{
|
||||||
|
int argc = args.Length;
|
||||||
|
gst_init (ref argc, ref args);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
20
gst/Makefile.in
Executable file
20
gst/Makefile.in
Executable file
|
@ -0,0 +1,20 @@
|
||||||
|
MCS=mcs
|
||||||
|
DESTDIR=
|
||||||
|
|
||||||
|
all: linux
|
||||||
|
|
||||||
|
windows:
|
||||||
|
$(CSC) /unsafe /target:library /r:../glib/glib-sharp.dll /out:gst-sharp.dll /recurse:*.cs
|
||||||
|
|
||||||
|
linux: gst-sharp.dll
|
||||||
|
|
||||||
|
gst-sharp.dll: *.cs
|
||||||
|
$(MCS) --unsafe --target library -r glib-sharp.dll -o gst-sharp.dll --recurse '*.cs'
|
||||||
|
|
||||||
|
clean:
|
||||||
|
rm -f *.dll
|
||||||
|
rm -rf generated
|
||||||
|
|
||||||
|
install: all
|
||||||
|
cp gst-sharp.dll $(DESTDIR)@prefix@/lib || exit 1
|
||||||
|
|
46
sample/GstPlayer.cs
Normal file
46
sample/GstPlayer.cs
Normal file
|
@ -0,0 +1,46 @@
|
||||||
|
// GstPlayer.cs - a simple Vorbis media player using GStreamer
|
||||||
|
//
|
||||||
|
// Author: Alp Toker <alp@atoker.com>
|
||||||
|
//
|
||||||
|
// Copyright (c) 2002 Alp Toker
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using Gst;
|
||||||
|
|
||||||
|
public class GstTest
|
||||||
|
{
|
||||||
|
static void Main(string[] args)
|
||||||
|
{
|
||||||
|
Application.Init ();
|
||||||
|
|
||||||
|
/* create a new bin to hold the elements */
|
||||||
|
Pipeline bin = new Pipeline("pipeline");
|
||||||
|
|
||||||
|
/* create a disk reader */
|
||||||
|
Element filesrc = ElementFactory.Make ("filesrc", "disk_source");
|
||||||
|
filesrc.SetProperty ("location", new GLib.Value (args[0]));
|
||||||
|
|
||||||
|
/* now it's time to get the decoder */
|
||||||
|
Element decoder = ElementFactory.Make ("vorbisdec", "decode");
|
||||||
|
|
||||||
|
/* and an audio sink */
|
||||||
|
Element osssink = ElementFactory.Make ("osssink", "play_audio");
|
||||||
|
|
||||||
|
/* add objects to the main pipeline */
|
||||||
|
bin.Add (filesrc);
|
||||||
|
bin.Add (decoder);
|
||||||
|
bin.Add (osssink);
|
||||||
|
|
||||||
|
/* connect the elements */
|
||||||
|
filesrc.Connect (decoder);
|
||||||
|
decoder.Connect (osssink);
|
||||||
|
|
||||||
|
/* start playing */
|
||||||
|
bin.SetState (ElementState.Playing);
|
||||||
|
|
||||||
|
while (bin.Iterate ());
|
||||||
|
|
||||||
|
/* stop the bin */
|
||||||
|
bin.SetState (ElementState.Null);
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue