Advertisement
rotrevrep

Untitled

Sep 28th, 2013
3,256
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Vala 1.54 KB | None | 0 0
  1. using Gst;
  2.  
  3. namespace MeeGst
  4. {
  5.     static PadTemplate src_template;
  6.     static PadTemplate sink_template;
  7.    
  8.     static void init_template(){
  9.         src_template = new PadTemplate("src",PadDirection.SRC,PadPresence.ALWAYS,new Caps.any ());
  10.         sink_template = new PadTemplate("sink",PadDirection.SINK,PadPresence.ALWAYS,new Caps.any ());
  11.     }
  12.    
  13.     public class MyFilter : Element
  14.     {
  15.         public MyFilter(){
  16.         }
  17.        
  18.         public signal void test_changed(string value);
  19.        
  20.         construct {
  21.             init_template();
  22.             set_static_metadata ("MyFilter","ugly","my first plugin","Bibi");
  23.             add_pad_template (src_template);
  24.             add_pad_template (sink_template);
  25.             sinkpad = new Pad.from_template (sink_template, "sink");
  26.             srcpad = new Pad.from_template (src_template, "src");
  27.             notify.connect(spec => {
  28.                 if(spec.name == "test"){
  29.                     test_changed(test);
  30.                 }
  31.             });
  32.         }
  33.        
  34.         public string test { get; set; }
  35.        
  36.         public Pad sinkpad;
  37.         public Pad srcpad;
  38.     }
  39.    
  40.     static bool myfilter_init (Gst.Plugin plugin){
  41.         return Gst.Element.register (plugin, "myfilter", 0, typeof(MyFilter));
  42.     }
  43.  
  44.     public static bool init(string[] args){
  45.         Gst.init (ref args);
  46.         return Plugin.register_static (1,0,"myfilter","Custom filter",myfilter_init,"0.1","LGPL","GStreamer","MeeGst","http://gstreamer.net/");
  47.     }
  48. }
  49.  
  50. /***/
  51.  
  52. using MeeGst;
  53.  
  54. void main(string[] args){
  55.     init(args);
  56.     var filter = Gst.ElementFactory.make("myfilter","filter");
  57.     filter["test"] = "value";
  58. }
  59.  
  60. /**
  61. * (main:12967): GStreamer-WARNING **: Element factory metadata for 'myfilter' has no valid long-name field
  62. */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement