当前位置: 首页>>代码示例>>Java>>正文


Java Gst类代码示例

本文整理汇总了Java中org.gstreamer.Gst的典型用法代码示例。如果您正苦于以下问题:Java Gst类的具体用法?Java Gst怎么用?Java Gst使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Gst类属于org.gstreamer包,在下文中一共展示了Gst类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: main

import org.gstreamer.Gst; //导入依赖的package包/类
public static void main(String[] args) {
    args = Gst.init("Dynamic Pad Test", args);
    /* create elements */
    Pipeline pipeline = new Pipeline("my_pipeline");
    Element source = ElementFactory.make("filesrc", "source");
    source.set("location", args[0]);
    Element demux = ElementFactory.make("oggdemux", "demuxer");
    
    /* you would normally check that the elements were created properly */
    
    /* put together a pipeline */
    pipeline.addMany(source, demux);
    Element.linkPads(source, "src", demux, "sink");
    
    /* listen for newly created pads */
    demux.connect(new Element.PAD_ADDED() {
        public void padAdded(Element element, Pad pad) {
           System.out.println("New Pad " + pad.getName() + " was created");
        }
    });
    
    /* start the pipeline */
    pipeline.play();
    Gst.main();
}
 
开发者ID:gstreamer-java,项目名称:gstreamer1.x-java,代码行数:26,代码来源:DynamicPadTest.java

示例2: main

import org.gstreamer.Gst; //导入依赖的package包/类
public static void main(String[] args) {
    //
    // Initialize the gstreamer framework, and let it interpret any command
    // line flags it is interested in.
    //
    args = Gst.init("SimplePipeline", args);
    
    Pipeline pipe = new Pipeline("SimplePipeline");
    Element src = ElementFactory.make("fakesrc", "Source");
    Element sink = ElementFactory.make("fakesink", "Destination");
    
    
    // Add the elements to the Bin
    pipe.addMany(src, sink);
    
    // Link fakesrc to fakesink so data can flow
    src.link(sink);
    
    // Start the pipeline playing
    pipe.play();
    Gst.main();
    pipe.stop();
}
 
开发者ID:gstreamer-java,项目名称:gstreamer1.x-java,代码行数:24,代码来源:SimplePipeline.java

示例3: main

import org.gstreamer.Gst; //导入依赖的package包/类
public static void main(String[] args) {
    //
    // Initialize the gstreamer framework, and let it interpret any command
    // line flags it is interested in.
    //
    args = Gst.init("DoubleQuit", args);
    
    for (int i = 0; i < 2; ++i) {
        Pipeline pipe = makePipe();
        Gst.getScheduledExecutorService().schedule(new Runnable() {

            public void run() {
                Gst.quit();
            }
        }, 1, TimeUnit.SECONDS);
        // Start the pipeline playing
        pipe.play();
        System.out.println("Running main loop " + i);
        Gst.main();
        // Clean up (gstreamer requires elements to be in State.NULL before disposal)
        pipe.stop();
    }
}
 
开发者ID:gstreamer-java,项目名称:gstreamer1.x-java,代码行数:24,代码来源:DoubleQuit.java

示例4: invokeLater

import org.gstreamer.Gst; //导入依赖的package包/类
/**
 * Invokes a task on the main loop thread.
 * <p> This method returns immediately, without waiting for the task to 
 * complete.
 * 
 * @param r the task to invoke.
 */
public void invokeLater(final Runnable r) {
    //        System.out.println("Scheduling idle callbacks");
    synchronized (bgTasks) {
        boolean empty = bgTasks.isEmpty();
        bgTasks.add(r);
        // Only trigger the callback if there were no existing elements in the list
        // otherwise it is already triggered
        if (empty) {
            GSource source = GLIB_API.g_idle_source_new();
            GLIB_API.g_source_set_callback(source, bgCallback, source, null);
            source.attach(Gst.getMainContext());
            source.disown(); // gets destroyed in the callback
        }
    }
}
 
开发者ID:gstreamer-java,项目名称:gstreamer1.x-java,代码行数:23,代码来源:MainLoop.java

示例5: startPoll

import org.gstreamer.Gst; //导入依赖的package包/类
private synchronized void startPoll() {
    Runnable task = new Runnable() {

        public void run() {
            final long position = pipeline.queryPosition(scaleUnit);
            final long duration = pipeline.queryDuration(scaleUnit);
            SwingUtilities.invokeLater(new Runnable() {
                public void run() {
                    updatePosition(duration, position);
                }
            });
        }
    };
    updateTask = Gst.getScheduledExecutorService().scheduleAtFixedRate(task, 
            UPDATE_INTERVAL, UPDATE_INTERVAL, TimeUnit.MILLISECONDS);
}
 
开发者ID:gstreamer-java,项目名称:gstreamer1.x-java,代码行数:17,代码来源:PipelinePositionModel.java

示例6: main

import org.gstreamer.Gst; //导入依赖的package包/类
public static void main(String[] args) {
    args = Gst.init("TypeFind Test", args);
    /* create elements */
    Pipeline pipeline = new Pipeline("my_pipeline");
    Element source = ElementFactory.make("filesrc", "source");
    source.set("location", args[0]);
    TypeFind typefind = new TypeFind("typefinder");
    
    /* you would normally check that the elements were created properly */
    
    /* put together a pipeline */
    pipeline.addMany(source, typefind);
    Element.linkMany(source, typefind);
    
    /* listen for types found */
    typefind.connect(new TypeFind.HAVE_TYPE() {

        public void typeFound(Element elem, int probability, Caps caps) {
            System.out.printf("New type found: probability=%d caps=%s\n",
                    probability, caps.toString());
        }
    });
    
    /* start the pipeline */
    pipeline.play();
    
    Gst.main();
}
 
开发者ID:gstreamer-java,项目名称:gstreamer1.x-java,代码行数:29,代码来源:TypeFindTest.java

示例7: main

import org.gstreamer.Gst; //导入依赖的package包/类
public static void main(String[] args) {
    //
    // Initialize the gstreamer framework, and let it interpret any command
    // line flags it is interested in.
    //
    args = Gst.init("AudioPlayer", args);
    
    if (args.length < 1) {
        System.out.println("Usage: AudioPlayer <file to play>");
        System.exit(1);
    }
    //
    // Create a PlayBin to play the media file.  A PlayBin is a Pipeline that
    // creates all the needed elements and automatically links them together.
    //
    PlayBin playbin = new PlayBin("AudioPlayer");
    
    // Make sure a video window does not appear.
    playbin.setVideoSink(ElementFactory.make("fakesink", "videosink"));
    
    // Set the file to play
    playbin.setInputFile(new File(args[0]));
    
    // Start the pipeline playing
    playbin.play();
    Gst.main();
    
    // Clean up (gstreamer requires elements to be in State.NULL before disposal)
    playbin.stop();
}
 
开发者ID:gstreamer-java,项目名称:gstreamer1.x-java,代码行数:31,代码来源:AudioPlayer.java

示例8: main

import org.gstreamer.Gst; //导入依赖的package包/类
public static void main(String[] args) {
    // Load some gstreamer dependencies
    args = Gst.init("foo", args);
    System.out.println("Creating fakesrc element");
    Element fakesrc = ElementFactory.make("fakesrc", "fakesrc");
    System.out.println("fakesrc element created");
    System.out.println("Element name = " + fakesrc.getName());
    System.out.println("Creating fakesink element");
    Element fakesink = ElementFactory.make("fakesink", "fakesink");
    System.out.println("fakesink element created");
    System.out.println("Element name = " + fakesink.getName());
}
 
开发者ID:gstreamer-java,项目名称:gstreamer1.x-java,代码行数:13,代码来源:ElementTest.java

示例9: main

import org.gstreamer.Gst; //导入依赖的package包/类
public static void main(String[] args) {
	args = Gst.init("ColorBalance video test", args);

	Pipeline pipe = new Pipeline("pipeline");
	final Element videosrc = ElementFactory.make("v4l2src", "source");
	videosrc.set("device", "/dev/video0");
	final Element videosink = ElementFactory.make("xvimagesink", "xv");

	pipe.addMany(videosrc, videosink);
	Element.linkMany(videosrc, videosink);
					
	pipe.play();

	Tuner tun = Tuner.wrap(videosrc);

	List<TunerNorm> normList = tun.getNormList();
	for (TunerNorm n : normList) {
		System.out.println("Available norm: " + n.getLabel());
	}

	List<TunerChannel> chList = tun.getChannelList();

	for (TunerChannel ch: chList) {
		System.out.println("Channel ["+ch.getLabel()+"]: "+ch.isTuningChannel());
	}
	
	for (int i=0;;i++) {
		tun.setChannel(chList.get(i%chList.size()));
		try {
			Thread.sleep(1000);
		} catch (Exception e) {
		}			
	}
	
	
}
 
开发者ID:gstreamer-java,项目名称:gstreamer1.x-java,代码行数:37,代码来源:TunerTest.java

示例10: main

import org.gstreamer.Gst; //导入依赖的package包/类
public static void main(String[] args) {
    args = Gst.init("foo", args);
    Version version = Gst.getVersion();
    System.out.printf("Gstreamer version %d.%d.%d%s initialized!",
            version.getMajor(), version.getMinor(), version.getMicro(),
            version.getNano() == 1 ? " (CVS)" : version.getNano() >= 2 ? " (Pre-release)" : "");
}
 
开发者ID:gstreamer-java,项目名称:gstreamer1.x-java,代码行数:8,代码来源:InitTest.java

示例11: main

import org.gstreamer.Gst; //导入依赖的package包/类
/**
 * Launches a pipeline from command-line pipeline description.
 * You can find examples for command-line pipeline syntax in the manual page
 * for the Gstreamer <code>gst-launch</code> utility.
 *
 * For example: <pre>
 * java org.gstreamer.example.PipelineLauncher videotestsrc ! autovideosink
 * </pre>
 *
 * @param args pipline definition
 */
public static void main(String[] args) {
    //
    // Initialize the gstreamer framework, and let it interpret any command
    // line flags it is interested in.
    //
    args = Gst.init("PipelineLauncher", args);

    if (args.length == 0) {
        args = new String[]{"videotestsrc", "!", "autovideosink"};
    }

    StringBuilder sb = new StringBuilder();

    for (String s: args) {
        sb.append(" ");
        sb.append(s);
    }
    
    Pipeline pipe = Pipeline.launch(sb.substring(1));

    pipe.play();

    Gst.main();

    pipe.stop();
}
 
开发者ID:gstreamer-java,项目名称:gstreamer1.x-java,代码行数:38,代码来源:PipelineLauncher.java

示例12: addMediaListener

import org.gstreamer.Gst; //导入依赖的package包/类
@Override
public synchronized void addMediaListener(MediaListener listener) {
    // Only run the timer when needed
    if (getMediaListeners().isEmpty()) {
        positionTimer = Gst.getScheduledExecutorService().scheduleAtFixedRate(positionUpdater, 1, 1, TimeUnit.SECONDS);
    }
    super.addMediaListener(listener);
}
 
开发者ID:gstreamer-java,项目名称:gstreamer1.x-java,代码行数:9,代码来源:PipelineMediaPlayer.java

示例13: segmentSeek

import org.gstreamer.Gst; //导入依赖的package包/类
private void segmentSeek(final long position) {
    isSeeking.set(true);
    seekingPos = position;
    Gst.getExecutor().execute(new Runnable() {

        public void run() {
            // Play for 50ms after the seek
            long stop = position + TimeUnit.MILLISECONDS.toNanos(50);
            int flags = SeekFlags.FLUSH | SeekFlags.SEGMENT;
            pipeline.seek(1.0, Format.TIME, flags,
                    SeekType.SET, position, SeekType.SET, stop);
        }
    });
}
 
开发者ID:gstreamer-java,项目名称:gstreamer1.x-java,代码行数:15,代码来源:PipelinePositionModel.java

示例14: seekTo

import org.gstreamer.Gst; //导入依赖的package包/类
private void seekTo(final long position) {
    isSeeking.set(true);
    seekingPos = position;
    Gst.getExecutor().execute(new Runnable() {

        public void run() {
        	int flags = SeekFlags.FLUSH | SeekFlags.ACCURATE;
            pipeline.seek(1.0, Format.TIME, flags, SeekType.SET, position, SeekType.NONE, -1);
            isSeeking.set(false);
        }
    });
}
 
开发者ID:gstreamer-java,项目名称:gstreamer1.x-java,代码行数:13,代码来源:PipelinePositionModel.java

示例15: segmentDone

import org.gstreamer.Gst; //导入依赖的package包/类
private void segmentDone(final long position) {
        long pos = scaleUnit.toNanos(getValue());
//        System.out.println("Segment done position=" + position 
//                + ", seekingPos=" + seekingPos + ", getValue()=" + pos);
        
        if (pos != seekingPos) {
            //
            // If the slider moved since this segment seek began, just start a new seek
            //
            segmentSeek(pos);
        } else {
            // Continue playing from this position
            Gst.getExecutor().execute(new Runnable() {

            public void run() {
                pipeline.seek(1.0, Format.TIME, 
                    SeekFlags.FLUSH | SeekFlags.KEY_UNIT,
                    SeekType.SET, position, SeekType.SET, -1);
                    pipeline.getState(50, TimeUnit.MILLISECONDS);
                    SwingUtilities.invokeLater(new Runnable() {
                        public void run() {
                            seekFinished();
                        }
                    });
                }
            });
        }
    }
 
开发者ID:gstreamer-java,项目名称:gstreamer1.x-java,代码行数:29,代码来源:PipelinePositionModel.java


注:本文中的org.gstreamer.Gst类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。