[gst-devel] How to make GNonLin not to decode videoclip?
wl2776
wl2776 at gmail.com
Mon Aug 9 13:03:06 CEST 2010
Edward Hervey wrote:
>
> Set the caps property of the gnlfilesource to the format you want
> (ex : video/mpeg,mpegversion=2 for mpeg2 video)
>
Looks like it doesn't work. At least, with gstreamer-sharp.
Here is my code.
If I set caps on gnlfilesources, "pad-added" handler is simply not called.
//"pad-added" signal handler
void comp_PadAdded(object o, PadAddedArgs args)
{
Trace.WriteLine("pad-added: "+args.Pad.Parent.Name);
}
// another function:
// It retrieves messages from the bus and processes them by itself.
Gst.Pipeline pipeline = new Pipeline("cut");
Gst.Element comp = Gst.ElementFactory.Make("gnlcomposition","compbin");
pipeline.Add(comp);
comp.PadAdded += new PadAddedHandler(comp_PadAdded);
//FIXME: replace with proper muxer and filesink
Gst.Element asink = Gst.ElementFactory.Make("fakesink", "asink");
Gst.Element vsink = Gst.ElementFactory.Make("fakesink", "vsink");
pipeline.Add(asink);
pipeline.Add(vsink);
fragment[] fr = optimize_fragment_list(get_included_fragment_list());
Gst.Element[] filesource = new Gst.Element[fr.Length];
ulong begin = 0;
for (int i = 0; i < fr.Length; i++) {
filesource[i] =
Gst.ElementFactory.Make("gnlfilesource","fr"+i.ToString());
((Gst.Bin)comp).Add(filesource[i]);
filesource[i]["location"] = Hyena.SafeUri.FilenameToUri(cur_filename);
//I've stolen this from the Banshee :)
Gst.Caps cps = Gst.Caps.FromString("video/mpeg,mpegversion=2");
filesource[i]["caps"] = cps;
filesource[i]["start"] = (UInt64)(begin * (ulong)pos_divisor *
Gst.Clock.MSecond);
filesource[i]["duration"] = (Int64)((ulong)(fr[i].end-fr[i].begin) *
(ulong)pos_divisor * Gst.Clock.MSecond);
filesource[i]["media-start"] = (UInt64)((ulong)fr[i].begin *
(ulong)pos_divisor * Gst.Clock.MSecond);
filesource[i]["media-duration"] = (Int64)((ulong)(fr[i].end - fr[i].begin)
* (ulong)pos_divisor * Gst.Clock.MSecond);
begin += (ulong)(fr[i].end - fr[i].begin);
}
pipeline.SetState(State.Playing);
while(!save.CancellationPending){ //this is intended to run from
BackgroundWorker
Gst.Message msg = pipeline.Bus.Pop(1000);
bool r=true;
if(msg!=null)
r=BusCall(pipeline.Bus, msg);
if (!r)
break;
}
--
View this message in context: http://gstreamer-devel.966125.n4.nabble.com/How-to-make-GNonLin-not-to-decode-videoclip-tp2316321p2318390.html
Sent from the GStreamer-devel mailing list archive at Nabble.com.
More information about the gstreamer-devel
mailing list