Beispiel #1
0
    public bool StartVideoFromMemory(string name, System.IntPtr moviePointer, uint movieLength, bool loop, bool allowNativeFormat, bool useBT709)
    {
        Filename = name;
        if (moviePointer != System.IntPtr.Zero && movieLength > 0)
        {
            if (_movieHandle < 0)
            {
                _movieHandle = AVProWindowsMediaPlugin.GetInstanceHandle();
            }

            if (AVProWindowsMediaPlugin.LoadMovieFromMemory(_movieHandle, moviePointer, movieLength, loop, allowNativeFormat))
            {
                CompleteVideoLoad(useBT709);
            }
            else
            {
                Debug.LogWarning("[AVProWindowsMedia] Movie failed to load");
                Close();
            }
        }
        else
        {
            Debug.LogWarning("[AVProWindowsMedia] No movie file specified");
            Close();
        }

        return(_movieHandle >= 0);
    }
Beispiel #2
0
    public bool StartVideoFromMemory(string name, System.IntPtr moviePointer, long movieLength, bool allowNativeFormat, bool useBT709, bool allowAudio, bool useAudioDelay, bool useAudioMixer, bool useDisplaySync, bool ignoreFlips, FilterMode textureFilterMode, TextureWrapMode textureWrapMode)
    {
        Filename = name;
        if (moviePointer != System.IntPtr.Zero && movieLength > 0)
        {
            if (_movieHandle < 0)
            {
                _movieHandle = AVProWindowsMediaPlugin.GetInstanceHandle();
            }

            if (AVProWindowsMediaPlugin.LoadMovieFromMemory(_movieHandle, moviePointer, movieLength, allowNativeFormat, allowAudio, useAudioDelay, useAudioMixer, useDisplaySync))
            {
                CompleteVideoLoad(useBT709, ignoreFlips, textureFilterMode, textureWrapMode);
            }
            else
            {
                Debug.LogWarning("[AVProWindowsMedia] Movie failed to load");
                Close();
            }
        }
        else
        {
            Debug.LogWarning("[AVProWindowsMedia] No movie file specified");
            Close();
        }

        return(_movieHandle >= 0);
    }
Beispiel #3
0
    //-------------------------------------------------------------------------

    public bool StartVideo(string filename, bool loop, bool allowNativeFormat, bool useBT709)
    {
        Filename = filename;
        if (!string.IsNullOrEmpty(Filename))
        {
            if (_movieHandle < 0)
            {
                _movieHandle = AVProWindowsMediaPlugin.GetInstanceHandle();
            }

            // Note: we're marshaling the string to IntPtr as the pointer of type wchar_t
            System.IntPtr filenamePtr = Marshal.StringToHGlobalUni(Filename);
            if (AVProWindowsMediaPlugin.LoadMovie(_movieHandle, filenamePtr, loop, false, allowNativeFormat))
            {
                CompleteVideoLoad(useBT709);
            }
            else
            {
                Debug.LogWarning("[AVProWindowsMedia] Movie failed to load");
                Close();
            }
            Marshal.FreeHGlobal(filenamePtr);
        }
        else
        {
            Debug.LogWarning("[AVProWindowsMedia] No movie file specified");
            Close();
        }

        return(_movieHandle >= 0);
    }
Beispiel #4
0
    //-------------------------------------------------------------------------

    public bool StartVideo(string filename, bool allowNativeFormat, bool useBT709, bool allowAudio, bool useAudioDelay, bool useAudioMixer, bool useDisplaySync, bool ignoreFlips, FilterMode textureFilterMode, TextureWrapMode textureWrapMode)
    {
        Filename = filename;
        if (!string.IsNullOrEmpty(Filename))
        {
            if (System.IO.File.Exists(filename))
            {
                if (_movieHandle < 0)
                {
                    _movieHandle = AVProWindowsMediaPlugin.GetInstanceHandle();
                }

                // Note: we're marshaling the string to IntPtr as the pointer of type wchar_t
                System.IntPtr filenamePtr = Marshal.StringToHGlobalUni(Filename);
                if (AVProWindowsMediaPlugin.LoadMovie(_movieHandle, filenamePtr, false, allowNativeFormat, allowAudio, useAudioDelay, useAudioMixer, useDisplaySync))
                {
                    CompleteVideoLoad(useBT709, ignoreFlips, textureFilterMode, textureWrapMode);
                }
                else
                {
                    Debug.LogError("[AVProWindowsMedia] Movie failed to load - do you have the required codecs installed?  See documentation for details.");
                    if (filename.ToLower().EndsWith(".mp4"))
                    {
                        Debug.LogError("[AVProWindowsMedia] For MP4 files you need an MP4 splitter such as Haali Media Splitter or GDCL.");
                        Debug.LogError("[AVProWindowsMedia] For HIGH profile H.264 videos you need to install an external H.264 decoder.  See documentation for details.");
                    }
                    Close();
                }
                Marshal.FreeHGlobal(filenamePtr);
            }
            else
            {
                Debug.LogError("[AVProWindowsMedia] File not found " + filename);
                Close();
            }
        }
        else
        {
            Debug.LogError("[AVProWindowsMedia] No movie file specified");
            Close();
        }

        return(_movieHandle >= 0);
    }
Beispiel #5
0
    public bool StartAudio(string filename, bool loop)
    {
        Filename = filename;
        Width    = Height = 0;
        if (!string.IsNullOrEmpty(Filename))
        {
            if (_movieHandle < 0)
            {
                _movieHandle = AVProWindowsMediaPlugin.GetInstanceHandle();
            }

            if (_formatConverter != null)
            {
                _formatConverter.Dispose();
                _formatConverter = null;
            }

            // Note: we're marshaling the string to IntPtr as the pointer of type wchar_t
            System.IntPtr filenamePtr = Marshal.StringToHGlobalUni(Filename);
            if (AVProWindowsMediaPlugin.LoadAudio(_movieHandle, filenamePtr, loop))
            {
                Volume          = _volume;
                DurationSeconds = AVProWindowsMediaPlugin.GetDurationSeconds(_movieHandle);

                Debug.Log("[AVProWindowsMedia] Loaded audio " + Filename + " " + DurationSeconds.ToString("F2") + " sec");
            }
            else
            {
                Debug.LogWarning("[AVProWindowsMedia] Movie failed to load");
                Close();
            }
            Marshal.FreeHGlobal(filenamePtr);
        }
        else
        {
            Debug.LogWarning("[AVProWindowsMedia] No movie file specified");
            Close();
        }

        return(_movieHandle >= 0);
    }