protected override void DoProcessing(FilterProcessingContext inputFrames, Frame outputFrame) { Console.WriteLine("decoding tga frame"); using (var stream = this.OpenStreamForFrame(0)) { using (var decoder = new TGADecoder(stream)) { decoder.Initialize(); decoder.Decode(outputFrame); } } }
protected override void OnClipInitializing(FilterInitializationEventArgs e) { base.OnClipInitializing(e); using (var stream = this.OpenStreamForFrame(0)) { using (var decoder = new TGADecoder(stream)) { decoder.Initialize(); var context = decoder.DecodeHeader(); var header = context.Header; var track = new VideoTrack() { SampleCount = 1, SamplesPerFrame = 1, Width = header.Width, Height = header.Height, }; //track.Format = if (header.BitsPerPixel == 24) { track.Format = ColorFormat.RGB24; } else { track.Format = ColorFormat.RGB32; } track.SamplesPerFrame = 1; track.SampleCount = 1; /* * var track = new VideoTrack(); * track.SampleCount = 1; * track.Width = bitmap.Width; * track.Height = bitmap.Height; * track.Format = bitmap.Format; * track.SamplesPerFrame = 1; * track.Options = TrackOptions.Infinite; */ this.Clip = new Clip(track); } } }
protected override void OnClipInitializing(FilterInitializationEventArgs e) { base.OnClipInitializing(e); using (var stream = this.OpenStreamForFrame(0)) { using (var decoder = new TGADecoder(stream)) { decoder.Initialize(); var context = decoder.DecodeHeader(); var header = context.Header; var track = new VideoTrack() { SampleCount = 1, SamplesPerFrame = 1, Width = header.Width, Height = header.Height, }; //track.Format = if (header.BitsPerPixel == 24) track.Format = ColorFormat.RGB24; else track.Format = ColorFormat.RGB32; track.SamplesPerFrame = 1; track.SampleCount = 1; /* var track = new VideoTrack(); track.SampleCount = 1; track.Width = bitmap.Width; track.Height = bitmap.Height; track.Format = bitmap.Format; track.SamplesPerFrame = 1; track.Options = TrackOptions.Infinite; */ this.Clip = new Clip(track); } } }