Ejemplo n.º 1
0
        public FlacReader(string input, WavWriter output)
        {
            if (output == null)
            {
                throw new ArgumentNullException("WavWriter");
            }

            stream = File.OpenRead(input);
            reader = new BinaryReader(stream);
            writer = output;

            context = FLAC__stream_decoder_new();

            if (context == IntPtr.Zero)
            {
                throw new ApplicationException("FLAC: Could not initialize stream decoder!");
            }

            write    = new WriteCallback(Write);
            metadata = new MetadataCallback(Metadata);
            error    = new ErrorCallback(Error);

            if (FLAC__stream_decoder_init_file(context,
                                               input, write, metadata, error,
                                               IntPtr.Zero) != 0)
            {
                throw new ApplicationException("FLAC: Could not open stream for reading!");
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Detect a text
        /// </summary>
        /// <param name="callback">Callback to be invoked with the detected text</param>
        /// <param name="detectOnce">If true, at most one text will be detected</param>
        public static void DetectText(MetadataCallback <Text> callback, bool detectOnce = true)   // NCDOC
        {
            if (!Implementation.SupportsMetadata)
            {
                Util.LogError("Current platform does not support metadata detection");
                return;
            }
            if (callback == null)
            {
                Util.LogError("Cannot detect text with no callback");
                return;
            }
            MetadataCallback <IMetadata> callbackWrapper = null;

            callbackWrapper = text => {
                if (!(text is Text))
                {
                    return;
                }
                if (detectOnce)
                {
                    Implementation.OnMetadata -= callbackWrapper;
                }
                callback((Text)text);
            };
            Implementation.OnMetadata += callbackWrapper;
        }
        public FlacReader(Stream input, WavWriter output)
        {
            if (output == null)
            {
                throw new ArgumentNullException("output");
            }

            stream = input;
            writer = output;

            context = _flacStreamDecoderNew();

            if (context == IntPtr.Zero)
            {
                throw new ApplicationException("FLAC: Could not initialize stream decoder!");
            }

            write    = Write;
            metadata = Metadata;
            error    = Error;
            read     = Read;
            seek     = Seek;
            tell     = Tell;
            length   = Length;
            eof      = Eof;

            if (_flacStreamDecoderInitStream(context, read, seek, tell, length, eof, write, metadata,
                                             error, IntPtr.Zero) != 0)
            {
                throw new ApplicationException("FLAC: Could not open stream for reading!");
            }
        }
Ejemplo n.º 4
0
        public static void DetectBarcode(MetadataCallback <Barcode> callback, BarcodeFormat format = BarcodeFormat.ALL, bool detectOnce = true)
        {
            if (!Implementation.SupportsMetadata)
            {
                Util.LogError("Current platform does not support metadata detection");
                return;
            }
            if (callback == null)
            {
                Util.LogError("Cannot detect barcode with no callback");
                return;
            }
            MetadataCallback <IMetadata> callbackWrapper = null;

            callbackWrapper = barcode => {
                if (!(barcode is Barcode))
                {
                    return;
                }
                if ((((Barcode)barcode).format & format) == 0)
                {
                    return;
                }
                if (detectOnce)
                {
                    Implementation.OnMetadata -= callbackWrapper;
                }
                callback((Barcode)barcode);
            };
            Implementation.OnMetadata += callbackWrapper;
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Detect a face
        /// </summary>
        /// <param name="callback">Callback to be invoked with the detected face</param>
        public static void DetectFace(MetadataCallback <Face> callback)   // NCDOC
        {
            if (!Implementation.SupportsMetadata)
            {
                Util.LogError("Current platform does not support metadata detection");
                return;
            }
            if (callback == null)
            {
                Util.LogError("Cannot detect face with no callback");
                return;
            }
            MetadataCallback <IMetadata> callbackWrapper = null;

            callbackWrapper = face => {
                if (face is Face)
                {
                    callback((Face)face);
                }
            };
            Implementation.OnMetadata += callbackWrapper;
        }
Ejemplo n.º 6
0
        public FlacReader(string input, WavWriter output)
        {
            if (output == null)
                throw new ArgumentNullException("WavWriter");

            stream = File.OpenRead(input);
            reader = new BinaryReader(stream);
            writer = output;

            context = FLAC__stream_decoder_new();

            if (context == IntPtr.Zero)
                throw new ApplicationException("FLAC: Could not initialize stream decoder!");

            write = new WriteCallback(Write);
            metadata = new MetadataCallback(Metadata);
            error = new ErrorCallback(Error);

            if (FLAC__stream_decoder_init_file(context,
                                               input, write, metadata, error,
                                               IntPtr.Zero) != 0)
                throw new ApplicationException("FLAC: Could not open stream for reading!");
        }
Ejemplo n.º 7
0
	public  void getMetadata(MetadataCallback successCallback) {}
Ejemplo n.º 8
0
 public void SetMetadata(MetadataCallback successCallback, FileErrorCallback errorCallback, Metadata metadataObject)
 {
 }
Ejemplo n.º 9
0
 public void GetMetadata(MetadataCallback successCallback, FileErrorCallback errorCallback)
 {
 }
Ejemplo n.º 10
0
 public void GetMetadata(MetadataCallback successCallback)
 {
 }
Ejemplo n.º 11
0
 public void getMetadata(MetadataCallback successCallback, ErrorCallback errorCallback)
 {
 }
Ejemplo n.º 12
0
 static extern int FLAC__stream_encoder_init_stream(IntPtr context, WriteCallback write, SeekCallback seek, TellCallback tell, MetadataCallback metadata, IntPtr userData);
Ejemplo n.º 13
0
	public  void getMetadata(MetadataCallback successCallback, ErrorCallback errorCallback) {}
Ejemplo n.º 14
0
 public void SetMetadata(MetadataCallback successCallback, FileErrorCallback errorCallback, Metadata metadataObject) { }
Ejemplo n.º 15
0
 public void GetMetadata(MetadataCallback successCallback, FileErrorCallback errorCallback) { }
Ejemplo n.º 16
0
 private void OnDestroy()
 {
     callbacks = (MetadataCallback)Delegate.Remove(callbacks, new MetadataCallback(MetadataChangedInternal));
 }
Ejemplo n.º 17
0
 private void Awake()
 {
     callbacks = (MetadataCallback)Delegate.Combine(callbacks, new MetadataCallback(MetadataChangedInternal));
 }
Ejemplo n.º 18
0
 static extern int FLAC__stream_encoder_init_stream(IntPtr context, WriteCallback write, SeekCallback seek, TellCallback tell, MetadataCallback metadata, IntPtr userData);
Ejemplo n.º 19
0
 static extern int FLAC__stream_decoder_init_file(IntPtr context, string filename, WriteCallback write, MetadataCallback metadata, ErrorCallback error, IntPtr userData);
Ejemplo n.º 20
0
 public static void DetectBarcode(Color32[] frame, int width, int height, IDispatch dispatch, MetadataCallback <IMetadata> callback)
 {
     if (frame == null || dispatch == null || callback == null)
     {
         return;
     }
     #if ZXING_API
     var results = reader.DecodeMultiple(frame, width, height);
     dispatch.Dispatch(() => results.ForEach(result => callback(NatCamBarcode(result))));
     #endif
 }
Ejemplo n.º 21
0
 static extern int FLAC__stream_decoder_init_file(IntPtr context, string filename, WriteCallback write, MetadataCallback metadata, ErrorCallback error, IntPtr userData);