Esempio n. 1
0
        /// <summary>
        /// Read an index from disk
        /// </summary>
        /// <remarks>
        /// <para>In FFMS2, the equivalent is <c>FFMS_ReadIndex</c>.</para>
        /// </remarks>
        /// <param name="indexFile">Can be an absolute or relative path</param>
        /// <exception cref="System.IO.IOException">Trying to read an invalid index file.</exception>
        /// <exception cref="System.IO.FileNotFoundException">Trying to read an index file that does not exist.</exception>
        /// <exception cref="NotSupportedException">Trying to read an index file for a <see cref="Source">Source</see> that is not available in the ffms2.dll.</exception>
        public Index(string indexFile)
        {
            if (indexFile == null)
            {
                throw new ArgumentNullException(@"indexFile");
            }

            var err = new FFMS_ErrorInfo
            {
                BufferSize = 1024,
                Buffer     = new String((char)0, 1024)
            };

            var indexFileBytes = Encoding.UTF8.GetBytes(indexFile);

            _handle = NativeMethods.FFMS_ReadIndex(indexFileBytes, ref err);

            if (!_handle.IsInvalid)
            {
                return;
            }

            if (err.ErrorType == FFMS_Errors.FFMS_ERROR_PARSER && err.SubType == FFMS_Errors.FFMS_ERROR_FILE_READ)
            {
                throw new System.IO.IOException(err.Buffer);
            }
            if (err.ErrorType == FFMS_Errors.FFMS_ERROR_PARSER && err.SubType == FFMS_Errors.FFMS_ERROR_NO_FILE)
            {
                throw new System.IO.FileNotFoundException(err.Buffer);
            }
            if (err.ErrorType == FFMS_Errors.FFMS_ERROR_INDEX && err.SubType == FFMS_Errors.FFMS_ERROR_NOT_AVAILABLE)
            {
                throw new NotSupportedException(err.Buffer);
            }

            throw new NotImplementedException(string.Format(System.Globalization.CultureInfo.CurrentCulture, "Unknown FFMS2 error encountered: ({0}, {1}, '{2}'). Please report this issue on FFMSSharp's GitHub.", err.ErrorType, err.SubType, err.Buffer));
        }
Esempio n. 2
0
 public static extern int FFMS_GetNumTracks(SafeIndexHandle Index);
Esempio n. 3
0
 public static extern int FFMS_GetFirstIndexedTrackOfType(SafeIndexHandle Index, int TrackType, ref FFMS_ErrorInfo ErrorInfo);
Esempio n. 4
0
 internal Index(SafeIndexHandle index)
 {
     _handle = index;
 }
Esempio n. 5
0
 public static extern int FFMS_GetErrorHandling(SafeIndexHandle Index);
Esempio n. 6
0
 public static extern int FFMS_IndexBelongsToFile(SafeIndexHandle Index, byte[] SourceFile, ref FFMS_ErrorInfo ErrorInfo);
Esempio n. 7
0
 public static extern IntPtr FFMS_CreateAudioSource(byte[] SourceFile, int Track, SafeIndexHandle Index, int DelayMode, ref FFMS_ErrorInfo ErrorInfo);
Esempio n. 8
0
 public static extern int FFMS_GetSourceType(SafeIndexHandle Index);
Esempio n. 9
0
 public static extern IntPtr FFMS_GetTrackFromIndex(SafeIndexHandle Index, int Track);
Esempio n. 10
0
 public static extern int FFMS_GetFirstTrackOfType(SafeIndexHandle Index, int TrackType, ref FFMS_ErrorInfo ErrorInfo);
Esempio n. 11
0
 public static extern int FFMS_GetNumTracks(SafeIndexHandle Index);
Esempio n. 12
0
 public static extern int FFMS_GetErrorHandling(SafeIndexHandle Index);
Esempio n. 13
0
 public static extern IntPtr FFMS_CreateVideoSource(byte[] SourceFile, int Track, SafeIndexHandle Index, int Threads, int SeekMode, ref FFMS_ErrorInfo ErrorInfo);
Esempio n. 14
0
 public static extern IntPtr FFMS_CreateAudioSource(byte[] SourceFile, int Track, SafeIndexHandle Index, int DelayMode, ref FFMS_ErrorInfo ErrorInfo);
Esempio n. 15
0
 internal Index(SafeIndexHandle index)
 {
     _handle = index;
 }
Esempio n. 16
0
 public static extern int FFMS_IndexBelongsToFile(SafeIndexHandle Index, byte[] SourceFile, ref FFMS_ErrorInfo ErrorInfo);
Esempio n. 17
0
 public static extern int FFMS_WriteIndex(byte[] IndexFile, SafeIndexHandle TrackIndices, ref FFMS_ErrorInfo ErrorInfo);
Esempio n. 18
0
 public static extern int FFMS_WriteIndex(byte[] IndexFile, SafeIndexHandle TrackIndices, ref FFMS_ErrorInfo ErrorInfo);
Esempio n. 19
0
 public static extern IntPtr FFMS_CreateVideoSource(byte[] SourceFile, int Track, SafeIndexHandle Index, int Threads, int SeekMode, ref FFMS_ErrorInfo ErrorInfo);
Esempio n. 20
0
 public static extern int FFMS_GetSourceType(SafeIndexHandle Index);
Esempio n. 21
0
 public static extern IntPtr FFMS_GetTrackFromIndex(SafeIndexHandle Index, int Track);
Esempio n. 22
0
        /// <summary>
        /// Read an index from disk
        /// </summary>
        /// <remarks>
        /// <para>In FFMS2, the equivalent is <c>FFMS_ReadIndex</c>.</para>
        /// </remarks>
        /// <param name="indexFile">Can be an absolute or relative path</param>
        /// <exception cref="System.IO.IOException">Trying to read an invalid index file.</exception>
        /// <exception cref="System.IO.FileNotFoundException">Trying to read an index file that does not exist.</exception>
        /// <exception cref="NotSupportedException">Trying to read an index file for a <see cref="Source">Source</see> that is not available in the ffms2.dll.</exception>
        public Index(string indexFile)
        {
            if (indexFile == null) throw new ArgumentNullException(@"indexFile");

            var err = new FFMS_ErrorInfo
            {
                BufferSize = 1024,
                Buffer = new String((char) 0, 1024)
            };

            var indexFileBytes = Encoding.UTF8.GetBytes(indexFile);
            _handle = NativeMethods.FFMS_ReadIndex(indexFileBytes, ref err);

            if (!_handle.IsInvalid) return;

            if (err.ErrorType == FFMS_Errors.FFMS_ERROR_PARSER && err.SubType == FFMS_Errors.FFMS_ERROR_FILE_READ)
                throw new System.IO.IOException(err.Buffer);
            if (err.ErrorType == FFMS_Errors.FFMS_ERROR_PARSER && err.SubType == FFMS_Errors.FFMS_ERROR_NO_FILE)
                throw new System.IO.FileNotFoundException(err.Buffer);
            if (err.ErrorType == FFMS_Errors.FFMS_ERROR_INDEX && err.SubType == FFMS_Errors.FFMS_ERROR_NOT_AVAILABLE)
                throw new NotSupportedException(err.Buffer);

            throw new NotImplementedException(string.Format(System.Globalization.CultureInfo.CurrentCulture, "Unknown FFMS2 error encountered: ({0}, {1}, '{2}'). Please report this issue on FFMSSharp's GitHub.", err.ErrorType, err.SubType, err.Buffer));
        }