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


Java DirectMediaPlayer类代码示例

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


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

示例1: onDisplay

import uk.co.caprica.vlcj.player.direct.DirectMediaPlayer; //导入依赖的package包/类
@Override
		public void onDisplay(DirectMediaPlayer mediaPlayer, int[] data) {
			if (size != data.length) {
				byteBuffer = ByteBuffer.allocateDirect(data.length * 4).order(ByteOrder.nativeOrder());
				size = data.length;
			}
			IntBuffer intBuffer = byteBuffer.asIntBuffer();
			intBuffer.put(data);

			try {
				Gdx2DPixmap pixmapData = new Gdx2DPixmap(byteBuffer, nativeData);
				pixmap = new Pixmap(pixmapData);
//				System.out.println("movie pixmap created : " + mediaPlayer.getTime() + " / " + mediaPlayer.getLength()
//						+ "   data size : " + data.length * 4);
			} catch (Exception e) {
				pixmap = null;
				throw new GdxRuntimeException("Couldn't load pixmap from image data", e);
			}

		}
 
开发者ID:exch-bms2,项目名称:beatoraja,代码行数:21,代码来源:VLCMovieProcessor.java

示例2: initialize

import uk.co.caprica.vlcj.player.direct.DirectMediaPlayer; //导入依赖的package包/类
/**
 * Initialize the instance and create a new player.
 * 
 * @param factory
 *            the factory for creating a new player
 * @param volume
 *            the initial volume
 */
void initialize(final MediaPlayerFactory factory, final float volume) {
    final MediaRenderer instance = this;

    // Release the VLC player instance in the dedicated thread
    mediaManager.executeThreadSafe(new Runnable() {
        @Override
        public void run() {
            // Create the VLC media player instance
            DirectMediaPlayer player = factory.newDirectMediaPlayer("RGBA", width, height, width * 4, instance);
            player.setPlaySubItems(true);
            player.setRepeat(true);
            player.addMediaPlayerEventListener(listener = new PlayerEventListener(instance));
            player.setVolume((int) (volume * 100));

            instance.player = player;
        }
    });
}
 
开发者ID:sk89q,项目名称:playblock,代码行数:27,代码来源:MediaRenderer.java

示例3: display

import uk.co.caprica.vlcj.player.direct.DirectMediaPlayer; //导入依赖的package包/类
@Override
public void display(DirectMediaPlayer mediaPlayer, Memory[] nativeBuffers, BufferFormat bufferFormat)
{
	ByteBuffer buffer = nativeBuffers[0].getByteBuffer(0, bufferFormat.getWidth() * bufferFormat.getHeight() * 4);
	videoImage.setData(buffer);
	videoTexture.setImage(videoImage);
}
 
开发者ID:synergynet,项目名称:synergynet3.1,代码行数:8,代码来源:SimpleMediaPlayer.java

示例4: display

import uk.co.caprica.vlcj.player.direct.DirectMediaPlayer; //导入依赖的package包/类
@Override
public void display(DirectMediaPlayer mediaPlayer, Memory[] nativeBuffers, BufferFormat bufferFormat) {
    if (released) {
        return;
    }

    buffer = nativeBuffers[0].getByteBuffer(0, width * height * 4);
}
 
开发者ID:sk89q,项目名称:playblock,代码行数:9,代码来源:MediaRenderer.java

示例5: display

import uk.co.caprica.vlcj.player.direct.DirectMediaPlayer; //导入依赖的package包/类
@Override
public void display(DirectMediaPlayer mediaPlayer, Memory[] nativeBuffers, BufferFormat bufferFormat) {
    if (writableImage == null) {
        return;
    }
    Platform.runLater(() -> {
        Memory nativeBuffer = mediaPlayer.lock()[0];
        try {
            ByteBuffer byteBuffer = nativeBuffer.getByteBuffer(0, nativeBuffer.size());
            getPixelWriter().setPixels(0, 0, bufferFormat.getWidth(), bufferFormat.getHeight(), pixelFormat, byteBuffer, bufferFormat.getPitches()[0]);
        } finally {
            mediaPlayer.unlock();
        }
    });
}
 
开发者ID:hohonuuli,项目名称:vars,代码行数:16,代码来源:VideoStage.java

示例6: display

import uk.co.caprica.vlcj.player.direct.DirectMediaPlayer; //导入依赖的package包/类
@Override
public void display(DirectMediaPlayer mediaPlayer,
		Memory[] nativeBuffers, final BufferFormat bufferFormat) {
	final Memory nativeBuffer = nativeBuffers[0];
	final ByteBuffer byteBuffer = nativeBuffer.getByteBuffer(0, nativeBuffer.size());

	// we just store the latest references
	tmpbuffer = byteBuffer;
	tmpformat = bufferFormat;
}
 
开发者ID:Vidada-Project,项目名称:vidada-desktop,代码行数:11,代码来源:MediaPlayerVLC.java

示例7: onDisplay

import uk.co.caprica.vlcj.player.direct.DirectMediaPlayer; //导入依赖的package包/类
@Override
protected void onDisplay(DirectMediaPlayer mediaPlayer, int[] rgbBuffer) {
    // Simply copy buffer to the image and repaint
    img.setRGB(0, 0, width, height, rgbBuffer, 0, width);
    mediaPanel.repaint();
}
 
开发者ID:DIT524-V17,项目名称:group-10,代码行数:7,代码来源:controller.java

示例8: start

import uk.co.caprica.vlcj.player.direct.DirectMediaPlayer; //导入依赖的package包/类
@Override
public void start(Stage primaryStage) throws Exception {


    StackPane stack = new StackPane();
    final Canvas canvas = new Canvas(1920, 1080);
    final Label label = new Label("");
    final VBox vBox = new VBox();
    vBox.getChildren().add(label);
    label.setStyle("-fx-font: 36px \"Segoe UI Semibold\";-fx-text-fill: white;");
    StackPane.setMargin(label, new Insets(0, 10, 0, 0));
    stack.getChildren().addAll(canvas, vBox);
    Scene scene = new Scene(stack);
    final PixelWriter pixelWriter = canvas.getGraphicsContext2D().getPixelWriter();


    mp = new DirectMediaPlayerComponent(formatCallback) {

        private AtomicLong totalTime = new AtomicLong(0);
        private long totalFrames;

        @Override
        public void display(DirectMediaPlayer mediaPlayer,
                            Memory[] nativeBuffers, final BufferFormat bufferFormat) {

            final Memory nativeBuffer = nativeBuffers[0];
            final ByteBuffer byteBuffer = nativeBuffer.getByteBuffer(0, nativeBuffer.size());
            totalFrames++;
            Platform.runLater(() -> {
                        long startTime = System.currentTimeMillis();
                        pixelWriter.setPixels(0, 0, WIDTH, HIGHT, byteBgraInstance, byteBuffer, WIDTH * 4);
                        long renderTime = System.currentTimeMillis() - startTime;
                        totalTime.set(totalTime.longValue()+renderTime);
                        String s = String.format("Frames: %4d   Avg.time: %4.1f ms    (Max)FPS: %3.0f fps\n", totalFrames, (double) totalTime.longValue() / totalFrames,  1000.0 / ((double) totalTime.longValue() / totalFrames));
                        label.setText(s);
                    }
            );
        }
    };

    mp.getMediaPlayer().playMedia(MOVIE_FILE);

    primaryStage.setScene(scene);
    primaryStage.show();
}
 
开发者ID:amoAHCP,项目名称:JavaOne2015JavaFXPitfalls,代码行数:46,代码来源:VLCDemo.java

示例9: display

import uk.co.caprica.vlcj.player.direct.DirectMediaPlayer; //导入依赖的package包/类
@Override
public void display(DirectMediaPlayer mediaPlayer, com.sun.jna.Memory[] nativeBuffer, BufferFormat bufferFormat) {
}
 
开发者ID:UiL-OTS-labs-backoffice,项目名称:UiL-OTS-Video-Coding-System,代码行数:4,代码来源:VLCMediaPlayer.java

示例10: onDisplay

import uk.co.caprica.vlcj.player.direct.DirectMediaPlayer; //导入依赖的package包/类
/**
 * Called on render, outputs video frame to image object.
 * 
 * @param mediaPlayer
 *            The VLC Media player object.
 * @param rgbBuffer
 *            The buffer holding the current video frame.
 * 
 */
@Override
protected void onDisplay(DirectMediaPlayer mediaPlayer, int[] rgbBuffer) {
    image.setRGB(0, 0, width, height, rgbBuffer, 0, width);
    jPanel.repaint();
}
 
开发者ID:synergynet,项目名称:synergyview,代码行数:15,代码来源:VLCMedia.java

示例11: getVLCJPlayer

import uk.co.caprica.vlcj.player.direct.DirectMediaPlayer; //导入依赖的package包/类
/**
 * Get the underlying VLCJ player.
 * 
 * @return the player
 */
DirectMediaPlayer getVLCJPlayer() {
    return player;
}
 
开发者ID:sk89q,项目名称:playblock,代码行数:9,代码来源:MediaRenderer.java


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