Java Code Examples for org.videolan.libvlc.Media#addOption()

The following examples show how to use org.videolan.libvlc.Media#addOption() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MediaBrowser.java    From libvlc-android-sdk with GNU Lesser General Public License v2.1 6 votes vote down vote up
/**
 * Browse to the specified media.
 *
 * @param media Can be a media returned by MediaBrowser.
 * @param flags see {@link Flag}
 */
@MainThread
public void browse(Media media, int flags) {
    /* media can be associated with a medialist,
     * so increment ref count in order to don't clean it with the medialist
     */
    media.retain();
    media.addOption(IGNORE_LIST_OPTION + mIgnoreList);
    if ((flags & Flag.NoSlavesAutodetect) != 0)
        media.addOption(":no-sub-autodetect-file");
    if ((flags & Flag.ShowHiddenFiles) != 0)
        media.addOption(":show-hiddenfiles");
    int mediaFlags = Media.Parse.ParseNetwork;
    if ((flags & Flag.Interact) != 0)
        mediaFlags |= Media.Parse.DoInteract;
    reset();
    mBrowserMediaList = media.subItems();
    mBrowserMediaList.setEventListener(mBrowserMediaListEventListener, mHandler);
    media.parseAsync(mediaFlags, 0);
    mMedia = media;
}
 
Example 2
Source File: MediaBrowser.java    From OTTLivePlayer_vlc with MIT License 6 votes vote down vote up
/**
 * Browse to the specified media.
 *
 * @param media Can be a media returned by MediaBrowser.
 * @param flags see {@link MediaBrowser.Flag}
 */
@MainThread
public void browse(Media media, int flags) {
    /* media can be associated with a medialist,
     * so increment ref count in order to don't clean it with the medialist
     */
    media.retain();
    media.addOption(IGNORE_LIST_OPTION + mIgnoreList);
    if ((flags & Flag.NoSlavesAutodetect) != 0)
        media.addOption(":no-sub-autodetect-file");
    if ((flags & Flag.ShowHiddenFiles) != 0)
        media.addOption(":show-hiddenfiles");
    int mediaFlags = Media.Parse.ParseNetwork;
    if ((flags & Flag.Interact) != 0)
        mediaFlags |= Media.Parse.DoInteract;
    reset();
    mBrowserMediaList = media.subItems();
    mBrowserMediaList.setEventListener(mBrowserMediaListEventListener, mHandler);
    media.parseAsync(mediaFlags, 0);
    mMedia = media;
}
 
Example 3
Source File: MediaBrowser.java    From OTTLivePlayer_vlc with MIT License 6 votes vote down vote up
/**
 * Browse to the specified media.
 *
 * @param media Can be a media returned by MediaBrowser.
 * @param flags see {@link MediaBrowser.Flag}
 */
@MainThread
public void browse(Media media, int flags) {
    /* media can be associated with a medialist,
     * so increment ref count in order to don't clean it with the medialist
     */
    media.retain();
    media.addOption(IGNORE_LIST_OPTION + mIgnoreList);
    if ((flags & Flag.NoSlavesAutodetect) != 0)
        media.addOption(":no-sub-autodetect-file");
    if ((flags & Flag.ShowHiddenFiles) != 0)
        media.addOption(":show-hiddenfiles");
    int mediaFlags = Media.Parse.ParseNetwork;
    if ((flags & Flag.Interact) != 0)
        mediaFlags |= Media.Parse.DoInteract;
    reset();
    mBrowserMediaList = media.subItems();
    mBrowserMediaList.setEventListener(mBrowserMediaListEventListener, mHandler);
    media.parseAsync(mediaFlags, 0);
    mMedia = media;
}
 
Example 4
Source File: MediaBrowser.java    From vlc-example-streamplayer with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Browse to the specified media.
 *
 * @param media Can be a media returned by MediaBrowser.
 * @param flags see {@link Flag}
 */
@MainThread
public void browse(Media media, int flags) {
    /* media can be associated with a medialist,
     * so increment ref count in order to don't clean it with the medialist
     */
    media.retain();
    media.addOption(IGNORE_LIST_OPTION + mIgnoreList);
    if ((flags & Flag.NoSlavesAutodetect) != 0)
        media.addOption(":no-sub-autodetect-file");
    if ((flags & Flag.ShowHiddenFiles) != 0)
        media.addOption(":show-hiddenfiles");
    int mediaFlags = Media.Parse.ParseNetwork;
    if ((flags & Flag.Interact) != 0)
        mediaFlags |= Media.Parse.DoInteract;
    reset();
    mBrowserMediaList = media.subItems();
    mBrowserMediaList.setEventListener(mBrowserMediaListEventListener, mHandler);
    media.parseAsync(mediaFlags, 0);
    mMedia = media;
}
 
Example 5
Source File: MediaBrowser.java    From libvlc-sdk-android with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Browse to the specified media.
 *
 * @param media Can be a media returned by MediaBrowser.
 * @param flags see {@link MediaBrowser.Flag}
 */
@MainThread
public void browse(Media media, int flags) {
    /* media can be associated with a medialist,
     * so increment ref count in order to don't clean it with the medialist
     */
    media.retain();
    media.addOption(IGNORE_LIST_OPTION + mIgnoreList);
    if ((flags & Flag.NoSlavesAutodetect) != 0)
        media.addOption(":no-sub-autodetect-file");
    if ((flags & Flag.ShowHiddenFiles) != 0)
        media.addOption(":show-hiddenfiles");
    int mediaFlags = Media.Parse.ParseNetwork;
    if ((flags & Flag.Interact) != 0)
        mediaFlags |= Media.Parse.DoInteract;
    reset();
    mBrowserMediaList = media.subItems();
    mBrowserMediaList.setEventListener(mBrowserMediaListEventListener, mHandler);
    media.parseAsync(mediaFlags, 0);
    mMedia = media;
}
 
Example 6
Source File: VLCUtil.java    From libvlc-android-sdk with GNU Lesser General Public License v2.1 5 votes vote down vote up
public static byte[] getThumbnail(Media media, int i_width, int i_height) {
    media.addOption(":no-audio");
    media.addOption(":no-spu");
    media.addOption(":no-osd");
    media.addOption(":input-fast-seek");
    return nativeGetThumbnail(media, i_width, i_height);
}
 
Example 7
Source File: VLCUtil.java    From OTTLivePlayer_vlc with MIT License 5 votes vote down vote up
public static byte[] getThumbnail(Media media, int i_width, int i_height) {
    media.addOption(":no-audio");
    media.addOption(":no-spu");
    media.addOption(":no-osd");
    media.addOption(":input-fast-seek");
    return nativeGetThumbnail(media, i_width, i_height);
}
 
Example 8
Source File: VLCUtil.java    From OTTLivePlayer_vlc with MIT License 5 votes vote down vote up
public static byte[] getThumbnail(Media media, int i_width, int i_height) {
    media.addOption(":no-audio");
    media.addOption(":no-spu");
    media.addOption(":no-osd");
    media.addOption(":input-fast-seek");
    return nativeGetThumbnail(media, i_width, i_height);
}
 
Example 9
Source File: VLCUtil.java    From vlc-example-streamplayer with GNU General Public License v3.0 5 votes vote down vote up
public static byte[] getThumbnail(Media media, int i_width, int i_height) {
    media.addOption(":no-audio");
    media.addOption(":no-spu");
    media.addOption(":no-osd");
    media.addOption(":input-fast-seek");
    return nativeGetThumbnail(media, i_width, i_height);
}
 
Example 10
Source File: VlcVideoLibrary.java    From vlc-example-streamplayer with GNU General Public License v3.0 5 votes vote down vote up
private void setMedia(Media media) {
  //delay = network buffer + file buffer
  //media.addOption(":network-caching=" + Constants.BUFFER);
  //media.addOption(":file-caching=" + Constants.BUFFER);
  if (options != null) {
    for (String s : options) {
      media.addOption(s);
    }
  }
  media.setHWDecoderEnabled(true, false);
  player = new MediaPlayer(vlcInstance);
  player.setMedia(media);
  player.setEventListener(this);

  IVLCVout vlcOut = player.getVLCVout();
  //set correct class for render depend of constructor called
  if (surfaceView != null) {
    vlcOut.setVideoView(surfaceView);
    width = surfaceView.getWidth();
    height = surfaceView.getHeight();
  } else if (textureView != null) {
    vlcOut.setVideoView(textureView);
    width = textureView.getWidth();
    height = textureView.getHeight();
  } else if (surfaceTexture != null) {
    vlcOut.setVideoSurface(surfaceTexture);
  } else if (surface != null) {
    vlcOut.setVideoSurface(surface, surfaceHolder);
  } else {
    throw new RuntimeException("You cant set a null render object");
  }
  if (width != 0 && height != 0) vlcOut.setWindowSize(width, height);
  vlcOut.attachViews();
  player.setVideoTrackEnabled(true);
  player.play();
}
 
Example 11
Source File: VLCUtil.java    From libvlc-sdk-android with GNU General Public License v2.0 5 votes vote down vote up
public static byte[] getThumbnail(Media media, int i_width, int i_height) {
    media.addOption(":no-audio");
    media.addOption(":no-spu");
    media.addOption(":no-osd");
    media.addOption(":input-fast-seek");
    return nativeGetThumbnail(media, i_width, i_height);
}
 
Example 12
Source File: MediaBrowser.java    From VCL-Android with Apache License 2.0 5 votes vote down vote up
/**
 * Browse to the specified media.
 *
 * @param media Can be a media returned by MediaBrowser.
 */
public synchronized void browse(Media media) {
    /* media can be associated with a medialist,
     * so increment ref count in order to don't clean it with the medialist
     */
    media.retain();
    media.addOption(IGNORE_LIST_OPTION+mIgnoreList);
    reset();
    mBrowserMediaList = media.subItems();
    mBrowserMediaList.setEventListener(mBrowserMediaListEventListener);
    media.parseAsync(Media.Parse.ParseNetwork);
    mMedia = media;
}
 
Example 13
Source File: VLCOptions.java    From VCL-Android with Apache License 2.0 5 votes vote down vote up
public static void setMediaOptions(Media media, Context context, int flags) {
    boolean noHardwareAcceleration = (flags & MediaWrapper.MEDIA_NO_HWACCEL) != 0;
    boolean noVideo = (flags & MediaWrapper.MEDIA_VIDEO) == 0;
    final boolean paused = (flags & MediaWrapper.MEDIA_PAUSED) != 0;
    int hardwareAcceleration = HW_ACCELERATION_DISABLED;

    if (!noHardwareAcceleration) {
        try {
            final SharedPreferences pref = PreferenceManager.getDefaultSharedPreferences(context);
            hardwareAcceleration = Integer.parseInt(pref.getString("hardware_acceleration", "-1"));
        } catch (NumberFormatException ignored) {}
    }
    if (hardwareAcceleration == HW_ACCELERATION_DISABLED)
        media.setHWDecoderEnabled(false, false);
    else if (hardwareAcceleration == HW_ACCELERATION_FULL || hardwareAcceleration == HW_ACCELERATION_DECODING) {
        media.setHWDecoderEnabled(true, true);
        if (hardwareAcceleration == HW_ACCELERATION_DECODING) {
            media.addOption(":no-mediacodec-dr");
            media.addOption(":no-omxil-dr");
        }
    } /* else automatic: use default options */

    if (noVideo)
        media.addOption(":no-video");
    if (paused)
        media.addOption(":start-paused");
}
 
Example 14
Source File: VLCUtil.java    From VCL-Android with Apache License 2.0 4 votes vote down vote up
public static byte[] getThumbnail(Media media, int i_width, int i_height) {
    media.addOption(":no-audio");
    media.addOption(":no-spu");
    media.addOption(":no-osd");
    return nativeGetThumbnail(media, i_width, i_height);
}