Ejemplo n.º 1
0
        /// <summary>
        /// Create an indexer of a media file
        /// </summary>
        /// <remarks>
        /// <para>In FFMS2, the equivalent is <c>FFMS_CreateIndexer</c> or <c>FFMS_CreateIndexerWithDemuxer</c>.</para>
        /// <para>The chosen demuxer gets used for both indexing and decoding later on. Only force one if you know what you're doing.</para>
        /// <para>Picking a demuxer that doesn't work on your file will not cause automatic fallback on lavf or automatic probing; it'll just cause indexer creation to fail.</para>
        /// </remarks>
        /// <param name="sourceFile">The media file</param>
        /// <param name="demuxer">What demuxer to use</param>
        /// <exception cref="System.IO.FileLoadException">Failure to load the media file</exception>
        public Indexer(string sourceFile, Source demuxer = Source.Default)
        {
            if (sourceFile == null)
            {
                throw new ArgumentNullException(@"sourceFile");
            }

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

            byte[] sourceFileBytes = Encoding.UTF8.GetBytes(sourceFile);
            _handle = NativeMethods.FFMS_CreateIndexerWithDemuxer(sourceFileBytes, (int)demuxer, 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.FileLoadException(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));
        }
Ejemplo n.º 2
0
 public static extern SafeIndexHandle FFMS_DoIndexing(SafeIndexerHandle Indexer, int IndexMask, int DumpMask, TAudioNameCallback ANC, [MarshalAs(UnmanagedType.LPStr)] string ANCPrivate, int ErrorHandling, TIndexCallback IC, IntPtr ICPrivate, ref FFMS_ErrorInfo ErrorInfo);
Ejemplo n.º 3
0
 public static extern IntPtr FFMS_GetFormatNameI(SafeIndexerHandle Indexer);
Ejemplo n.º 4
0
 public static extern IntPtr FFMS_GetCodecNameI(SafeIndexerHandle Indexer, int Track);
Ejemplo n.º 5
0
 public static extern int FFMS_GetTrackTypeI(SafeIndexerHandle Indexer, int Track);
Ejemplo n.º 6
0
 public static extern int FFMS_GetNumTracksI(SafeIndexerHandle Indexer);
Ejemplo n.º 7
0
 public static extern int FFMS_GetSourceTypeI(SafeIndexerHandle Indexer);
Ejemplo n.º 8
0
 public static extern int FFMS_GetTrackTypeI(SafeIndexerHandle Indexer, int Track);
Ejemplo n.º 9
0
        /// <summary>
        /// Create an indexer of a media file
        /// </summary>
        /// <remarks>
        /// <para>In FFMS2, the equivalent is <c>FFMS_CreateIndexer</c> or <c>FFMS_CreateIndexerWithDemuxer</c>.</para>
        /// <para>The chosen demuxer gets used for both indexing and decoding later on. Only force one if you know what you're doing.</para>
        /// <para>Picking a demuxer that doesn't work on your file will not cause automatic fallback on lavf or automatic probing; it'll just cause indexer creation to fail.</para>
        /// </remarks>
        /// <param name="sourceFile">The media file</param>
        /// <param name="demuxer">What demuxer to use</param>
        /// <exception cref="System.IO.FileLoadException">Failure to load the media file</exception>
        public Indexer(string sourceFile, Source demuxer = Source.Default)
        {
            if (sourceFile == null) throw new ArgumentNullException(@"sourceFile");

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

            byte[] sourceFileBytes = Encoding.UTF8.GetBytes(sourceFile);
            _handle = NativeMethods.FFMS_CreateIndexerWithDemuxer(sourceFileBytes, (int)demuxer, 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.FileLoadException(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));
        }
Ejemplo n.º 10
0
 public static extern int FFMS_GetSourceTypeI(SafeIndexerHandle Indexer);
Ejemplo n.º 11
0
 public static extern int FFMS_GetNumTracksI(SafeIndexerHandle Indexer);
Ejemplo n.º 12
0
 public static extern IntPtr FFMS_GetFormatNameI(SafeIndexerHandle Indexer);
Ejemplo n.º 13
0
 public static extern IntPtr FFMS_GetCodecNameI(SafeIndexerHandle Indexer, int Track);
Ejemplo n.º 14
0
 public static extern SafeIndexHandle FFMS_DoIndexing(SafeIndexerHandle Indexer, int IndexMask, int DumpMask, TAudioNameCallback ANC, [MarshalAs(UnmanagedType.LPStr)] string ANCPrivate, int ErrorHandling, TIndexCallback IC, IntPtr ICPrivate, ref FFMS_ErrorInfo ErrorInfo);