Package uk.co.caprica.vlcj.log

Examples of uk.co.caprica.vlcj.log.NativeLog


        // This latch is used simply to cleanly exit the application when the
        // "finished" event is raised
        final CountDownLatch latch = new CountDownLatch(1);

        NativeLog log = mediaPlayerComponent.getMediaPlayerFactory().newLog();
        if (log == null) {
            System.out.println("Native log not available on this platform");
            System.exit(1);
        }

        log.setLevel(libvlc_log_level_e.DEBUG);
        log.addLogListener(new LogEventListener() {
            @Override
            public void log(libvlc_log_level_e level, String module, String file, Integer line, String name, String header, Integer id, String message) {
                System.out.printf("[%-20s] (%-20s) %7s: %s\n", module, name, level, message);
            }
        });

        mediaPlayerComponent.getMediaPlayer().addMediaPlayerEventListener(new MediaPlayerEventAdapter() {
            @Override
            public void finished(MediaPlayer mediaPlayer) {
                latch.countDown();
            }

            @Override
            public void error(MediaPlayer mediaPlayer) {
                latch.countDown();
            }
        });

        mediaPlayerComponent.getMediaPlayer().playMedia(args[0]);

        // Wait for finished/error
        latch.await();

        // Must release the components to exit (otherwise threads are left running)
        log.release();
        mediaPlayerComponent.release(true);
    }
View Full Code Here


     * @return native log component, or <code>null</code> if the native log is not available
     */
    public NativeLog newLog() {
        Logger.debug("newLog()");
        if(LibVlcVersion.getVersion().atLeast(LibVlcVersion.LIBVLC_210)) {
            return new NativeLog(libvlc, instance);
        }
        else {
            Logger.warn("Native log not available on this platform, needs libvlc 2.1.0 or later");
            return null;
        }
View Full Code Here

TOP

Related Classes of uk.co.caprica.vlcj.log.NativeLog

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.