コード例 #1
0
ファイル: Media.cs プロジェクト: reddevil1310/libvlcsharp
        /// <summary>
        /// Create a media from a MediaInput
        /// requires libvlc 3.0 or higher
        /// </summary>
        /// <param name="libVLC">the libvlc instance</param>
        /// <param name="input">the media to be used by libvlc. LibVLCSharp will NOT dispose or close it.
        /// Use <see cref="StreamMediaInput"/> or implement your own.</param>
        /// <param name="options">the libvlc options</param>
        public Media(LibVLC libVLC, MediaInput input, params string[] options)
            : base(() => CtorFromInput(libVLC, input), Native.LibVLCMediaRelease)
        {
            foreach (var option in options)
            {
                var optionUtf8 = option.ToUtf8();

                MarshalUtils.PerformInteropAndFree(() => Native.LibVLCMediaAddOption(NativeReference, optionUtf8), optionUtf8);
            }
        }
コード例 #2
0
ファイル: Media.cs プロジェクト: reddevil1310/libvlcsharp
        static IntPtr CtorFromInput(LibVLC libVLC, MediaInput input)
        {
            if (libVLC == null)
            {
                throw new ArgumentNullException(nameof(libVLC));
            }
            if (input == null)
            {
                throw new ArgumentNullException(nameof(input));
            }

            return(Native.LibVLCMediaNewCallbacks(libVLC.NativeReference,
                                                  OpenMediaCallbackHandle,
                                                  ReadMediaCallbackHandle,
                                                  SeekMediaCallbackHandle,
                                                  CloseMediaCallbackHandle,
                                                  GCHandle.ToIntPtr(input.GcHandle)));
        }
コード例 #3
0
 /// <summary>
 /// Create a media from a MediaInput
 /// requires libvlc 3.0 or higher
 /// </summary>
 /// <param name="libVLC">the libvlc instance</param>
 /// <param name="input">the media to be used by libvlc. LibVLCSharp will NOT dispose or close it.
 /// Use <see cref="StreamMediaInput"/> or implement your own.</param>
 /// <param name="options">the libvlc options</param>
 public Media(LibVLC libVLC, MediaInput input, params string[] options)
     : this(() => CtorFromInput(libVLC, input), Native.LibVLCMediaRelease, options)
 {
 }