Beispiel #1
0
  public static void main(final String[] args) throws Exception {
    LibVlc libVlc = LibVlcFactory.factory().create();

    Logger.info("  version: {}", libVlc.libvlc_get_version());
    Logger.info(" compiler: {}", libVlc.libvlc_get_compiler());
    Logger.info("changeset: {}", libVlc.libvlc_get_changeset());

    setLookAndFeel();

    SwingUtilities.invokeLater(
        new Runnable() {
          @Override
          public void run() {
            new TestPlayer(args);
          }
        });
  }
Beispiel #2
0
    @Override
    public void videoOutput(MediaPlayer mediaPlayer, int newCount) {
      Logger.debug("videoOutput(mediaPlayer={},newCount={})", mediaPlayer, newCount);
      if (newCount == 0) {
        return;
      }

      MediaDetails mediaDetails = mediaPlayer.getMediaDetails();
      Logger.info("mediaDetails={}", mediaDetails);

      MediaMeta mediaMeta = mediaPlayer.getMediaMeta();
      Logger.info("mediaMeta={}", mediaMeta);

      final Dimension dimension = mediaPlayer.getVideoDimension();
      Logger.debug("dimension={}", dimension);
      if (dimension != null) {
        SwingUtilities.invokeLater(
            new Runnable() {
              @Override
              public void run() {
                videoSurface.setSize(dimension);
                mainFrame.pack();
              }
            });
      }

      // You can set a logo like this if you like...
      File logoFile = new File("./etc/vlcj-logo.png");
      if (logoFile.exists()) {
        mediaPlayer.setLogoFile(logoFile.getAbsolutePath());
        mediaPlayer.setLogoOpacity(0.5f);
        mediaPlayer.setLogoLocation(10, 10);
        mediaPlayer.enableLogo(true);
      }

      // Demo the marquee
      mediaPlayer.setMarqueeText("vlcj java bindings for vlc");
      mediaPlayer.setMarqueeSize(40);
      mediaPlayer.setMarqueeOpacity(95);
      mediaPlayer.setMarqueeColour(Color.white);
      mediaPlayer.setMarqueeTimeout(5000);
      mediaPlayer.setMarqueeLocation(50, 120);
      mediaPlayer.enableMarquee(true);

      // Not quite sure how crop geometry is supposed to work...
      //
      // Assertions in libvlc code:
      //
      // top + height must be less than visible height
      // left + width must be less than visible width
      //
      // With DVD source material:
      //
      // Reported size is 1024x576 - this is what libvlc reports when you call
      // get video size
      //
      // mpeg size is 720x576 - this is what is reported in the native log
      //
      // The crop geometry relates to the mpeg size, not the size reported
      // through the API
      //
      // For 720x576, attempting to set geometry to anything bigger than
      // 719x575 results in the assertion failures above (seems like it should
      // allow 720x576) to me

      // mediaPlayer.setCropGeometry("4:3");
    }
Beispiel #3
0
 @Override
 public void playing(MediaPlayer mediaPlayer) {
   Logger.debug("playing(mediaPlayer={})", mediaPlayer);
   MediaDetails mediaDetails = mediaPlayer.getMediaDetails();
   Logger.info("mediaDetails={}", mediaDetails);
 }