mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-06-05 06:58:56 +00:00
Fix samples for all the API changes
This commit is contained in:
parent
d543e568df
commit
3f74ddbae3
4 changed files with 19 additions and 16 deletions
|
@ -46,8 +46,8 @@ public class DecodeBinTranscoder : IDisposable
|
||||||
|
|
||||||
public void Transcode(string inputFile, string outputFile)
|
public void Transcode(string inputFile, string outputFile)
|
||||||
{
|
{
|
||||||
filesrc.SetProperty("location", inputFile);
|
filesrc["location"] = inputFile;
|
||||||
filesink.SetProperty("location", outputFile);
|
filesink["location"] = outputFile;
|
||||||
|
|
||||||
pipeline.SetState(State.Playing);
|
pipeline.SetState(State.Playing);
|
||||||
progress_timeout = GLib.Timeout.Add(250, OnProgressTimeout);
|
progress_timeout = GLib.Timeout.Add(250, OnProgressTimeout);
|
||||||
|
@ -109,7 +109,7 @@ public class DecodeBinTranscoder : IDisposable
|
||||||
|
|
||||||
private void OnNewDecodedPad(object o, NewDecodedPadArgs args)
|
private void OnNewDecodedPad(object o, NewDecodedPadArgs args)
|
||||||
{
|
{
|
||||||
Pad sinkpad = audioconvert.GetPad("sink");
|
Pad sinkpad = audioconvert.GetStaticPad("sink");
|
||||||
|
|
||||||
if(sinkpad.IsLinked) {
|
if(sinkpad.IsLinked) {
|
||||||
return;
|
return;
|
||||||
|
@ -129,10 +129,11 @@ public class DecodeBinTranscoder : IDisposable
|
||||||
{
|
{
|
||||||
switch(message.Type) {
|
switch(message.Type) {
|
||||||
case MessageType.Error:
|
case MessageType.Error:
|
||||||
string error;
|
string msg;
|
||||||
message.ParseError(out error);
|
Enum err;
|
||||||
|
message.ParseError(out err, out msg);
|
||||||
GLib.Source.Remove(progress_timeout);
|
GLib.Source.Remove(progress_timeout);
|
||||||
OnError(error);
|
OnError(msg);
|
||||||
break;
|
break;
|
||||||
case MessageType.Eos:
|
case MessageType.Eos:
|
||||||
pipeline.SetState(State.Null);
|
pipeline.SetState(State.Null);
|
||||||
|
@ -147,9 +148,9 @@ public class DecodeBinTranscoder : IDisposable
|
||||||
private bool OnProgressTimeout()
|
private bool OnProgressTimeout()
|
||||||
{
|
{
|
||||||
long duration, position;
|
long duration, position;
|
||||||
|
Gst.Format fmt = Gst.Format.Time;
|
||||||
|
|
||||||
if(pipeline.QueryDuration(Gst.Format.Time, out duration) &&
|
if(pipeline.QueryDuration(ref fmt, out duration) && fmt == Gst.Format.Time && encoder.QueryPosition(ref fmt, out position) && fmt == Gst.Format.Time) {
|
||||||
encoder.QueryPosition(Gst.Format.Time, out position)) {
|
|
||||||
OnProgress(position, duration);
|
OnProgress(position, duration);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -69,9 +69,10 @@ public class HelloWorld
|
||||||
{
|
{
|
||||||
switch(message.Type) {
|
switch(message.Type) {
|
||||||
case MessageType.Error:
|
case MessageType.Error:
|
||||||
string err = String.Empty;
|
string msg;
|
||||||
message.ParseError(out err);
|
Enum err;
|
||||||
Console.WriteLine ("Gstreamer error: {0}", err);
|
message.ParseError(out err, out msg);
|
||||||
|
Console.WriteLine ("Gstreamer error: {0}", msg);
|
||||||
loop.Quit();
|
loop.Quit();
|
||||||
break;
|
break;
|
||||||
case MessageType.Eos:
|
case MessageType.Eos:
|
||||||
|
@ -95,7 +96,7 @@ public class HelloWorld
|
||||||
void OnPadAdded(object o, PadAddedArgs args)
|
void OnPadAdded(object o, PadAddedArgs args)
|
||||||
{
|
{
|
||||||
Console.WriteLine("Entered OnPadAdded");
|
Console.WriteLine("Entered OnPadAdded");
|
||||||
Pad sinkpad = decoder.GetPad("sink");
|
Pad sinkpad = decoder.GetStaticPad("sink");
|
||||||
args.Pad.Link(sinkpad);
|
args.Pad.Link(sinkpad);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,9 +43,10 @@ public class PlayBinPlayer
|
||||||
{
|
{
|
||||||
switch (message.Type) {
|
switch (message.Type) {
|
||||||
case MessageType.Error:
|
case MessageType.Error:
|
||||||
string err = String.Empty;
|
Enum err;
|
||||||
message.ParseError (out err);
|
string msg;
|
||||||
Console.WriteLine ("Gstreamer error: {0}", err);
|
message.ParseError (out err, out msg);
|
||||||
|
Console.WriteLine ("Gstreamer error: {0}", msg);
|
||||||
loop.Quit ();
|
loop.Quit ();
|
||||||
break;
|
break;
|
||||||
case MessageType.Eos:
|
case MessageType.Eos:
|
||||||
|
|
|
@ -14,7 +14,7 @@ public static class GstTypefindTest
|
||||||
typefind = TypeFindElement.Make("typefind");
|
typefind = TypeFindElement.Make("typefind");
|
||||||
Element sink = ElementFactory.Make("fakesink", "sink");
|
Element sink = ElementFactory.Make("fakesink", "sink");
|
||||||
|
|
||||||
source.SetProperty("location", args[0]);
|
source["location"] = args[0];
|
||||||
|
|
||||||
typefind.HaveType += OnHaveType;
|
typefind.HaveType += OnHaveType;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue