public void videoencoder_encode()
        {
            //VideoEncoder *ve = new VideoEncoder(L"C:\\Users\\user\\Dropbox\\Cloud\\GitHub\\MusicianHelper\\TEST\\Images\\paper-stained-3-texture.bmp", L"C:\\Users\\user\\Dropbox\\Cloud\\GitHub\\MusicianHelper\\TEST\\Audio\\sorry_dave.wav", L"output.wmv", vs);
            //VideoEncoder *ve = new VideoEncoder(L"C:\\Users\\chpink\\Home\\sandbox\\MusicianHelper\\TEST\\Images\\paper-stained-3-texture.bmp", L"C:\\Users\\chpink\\Home\\sandbox\\MusicianHelper\\TEST\\Audio\\sorry_dave.wav", L"output.wmv", vs);

            //const string imageFilePath = "C:\\Users\\chpink\\Home\\sandbox\\MusicianHelper\\TEST\\Images\\paper-stained-3-texture.bmp";
            //const string audioFilePath = "C:\\Users\\chpink\\Home\\sandbox\\MusicianHelper\\TEST\\Audio\\sorry_dave.wav";
            const string imageFilePath = "C:\\Users\\user\\Dropbox\\Cloud\\GitHub\\MusicianHelper\\TEST\\test.bmp";
            const string audioFilePath = "C:\\Users\\user\\Dropbox\\Cloud\\GitHub\\MusicianHelper\\TEST\\sorry_dave.wav";
            const string videoOutputPath = "output.wmv";

            if (File.Exists(videoOutputPath))
                File.Delete(videoOutputPath);

            var encoder = new VideoEncoder();
            encoder.ImageFilePath = imageFilePath;
            encoder.AudioFilePath = audioFilePath;
            encoder.VideoOutputPath = videoOutputPath;

            encoder.Encode();

            Assert.True(File.Exists(videoOutputPath));

            var fi = new FileInfo(videoOutputPath);

            Assert.NotEqual(0, fi.Length);
        }
 static void Main(string[] args)
 {
     var encoder = new VideoEncoder();
     encoder.RegisterNotificationChannel(new MailNotificationChannel());
     encoder.RegisterNotificationChannel(new SmsNotificationChannel());
     encoder.Encode(new Video());
 }
Example #3
0
        public static void Demo()
        {
            var encoder = new VideoEncoder();

            encoder.RegisterNotificationChannel(new MailNotificationChannel());
            encoder.RegisterNotificationChannel(new SmsNotificationChannel());
            encoder.Encode(new Video());
        }
Example #4
0
        static void UsePolymorphism()
        {
            var encoder = new VideoEncoder();

            encoder.RegisterNotificationChannel(new MailNotificationChannel());
            encoder.RegisterNotificationChannel(new SMSNotificationChannel());
            encoder.Encode(new Video());
        }
Example #5
0
        public void InterfacesAndPolymorphism()
        {
            var encoder = new VideoEncoder();

            encoder.RegisterNotificationChannel(new MailNotificationChannel());
            encoder.RegisterNotificationChannel(new SmsNotificationChannel());
            encoder.Encode(new Video());
        }
Example #6
0
        static void Main(string[] args)
        {
            Console.WriteLine("Ffmpeg Interop Test Console");

            FfmpegInit.Initialise();

            VideoEncoder vp8Encoder = new VideoEncoder(FFmpeg.AutoGen.AVCodecID.AV_CODEC_ID_VP8, FRAME_WIDTH, FRAME_HEIGHT, FRAMES_PER_SECOND);

            int linesz = ffmpeg.av_image_get_linesize(AVPixelFormat.AV_PIX_FMT_YUV420P, FRAME_WIDTH, 0);

            AVFrame *frame = ffmpeg.av_frame_alloc();

            frame->format = (int)AVPixelFormat.AV_PIX_FMT_YUV420P;
            frame->width  = FRAME_WIDTH;
            frame->height = FRAME_HEIGHT;
            frame->pts    = 0;

            ffmpeg.av_frame_get_buffer(frame, 0).ThrowExceptionIfError();
            ffmpeg.av_frame_make_writable(frame).ThrowExceptionIfError();

            for (int y = 0; y < FRAME_HEIGHT; y++)
            {
                for (int x = 0; x < FRAME_WIDTH; x++)
                {
                    frame->data[0][y * frame->linesize[0] + x] = (byte)(x + y + 1 * 3);
                }
            }

            for (int y = 0; y < FRAME_HEIGHT / 2; y++)
            {
                for (int x = 0; x < FRAME_WIDTH / 2; x++)
                {
                    frame->data[1][y * frame->linesize[1] + x] = (byte)(128 + y + 2);
                    frame->data[2][y * frame->linesize[2] + x] = (byte)(64 + y + 5);
                }
            }

            byte[] encoded = vp8Encoder.Encode(frame);

            if (encoded == null)
            {
                Console.WriteLine("Video encode failed.");
            }
            else
            {
                Console.WriteLine($"Video encode succeeded, encoded frame size {encoded.Length}.");
            }

            //var videoFrameConverter = new VideoFrameConverter(
            //    new Size(frameWidth, frameHeight),
            //    AVPixelFormat.AV_PIX_FMT_RGB24,
            //    new Size(frameWidth, frameHeight),
            //    AVPixelFormat.AV_PIX_FMT_YUV420P);

            //Console.WriteLine($"VP8 decoder successfully initialised {vp8Decoder.GetDecoderName()}.");

            ffmpeg.av_frame_free(&frame);
        }
Example #7
0
        static void Main(string[] args)
        {
            var encoder = new VideoEncoder();

            encoder.RegisterNotificationchannel(new EmailNotificaton());
            encoder.RegisterNotificationchannel(new SmsNotification());

            encoder.Encode();
        }
Example #8
0
        static void Main(string[] args)
        {
            var encoder = new VideoEncoder();

            encoder.RegisterNotificationChannel(new MailNotificationChannel());
            encoder.RegisterNotificationChannel(new SMSNotificationChannel());

            encoder.Encode(new Video());
        }
        public void PublishSubscribe()
        {
            publisher.VideoEncoded += subscriber1.OnVideoEncoded;
            publisher.VideoEncoded += subscriber2.OnVideoEncoded;

            publisher.Encode(new Video {
                Title = "Jaws 3D"
            });
        }
Example #10
0
 public void EncodeUsingCommandLine(VideoEncoder encoder, string sourceFilePath, string targetFilePath)
 {
     if (!string.IsNullOrEmpty(sourceFilePath) && File.Exists(sourceFilePath))
     {
         OnEncodingProgressChanged(-1);
         encoder.Encode(sourceFilePath, targetFilePath);
         OnEncodingProgressChanged(100);
     }
 }
Example #11
0
        static void Main(string[] args)
        {
            var messenger = new Messenger();
            var video     = new Video {
                Title = "ojioij"
            };
            var VideoEncoder = new VideoEncoder(video);

            VideoEncoder.OnVideoEncoded += messenger.OnVideoEncoded;
            VideoEncoder.Encode();
        }
Example #12
0
 /// <summary>
 /// 捕捉到视频数据事件
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void VC_VideoDataCapturered(object sender, VideoCapturedEventArgs e)
 {
     if (VE != null)
     {
         Console.WriteLine(e.Data.Length.ToString() + ":" + VE.Encode(e.Data).Length.ToString());
         //this.AVcommunication1.SendVideo(VE.Encode(e.Data));//将视频数据编码后发送给对方
         //byte[] data=new byte[e.Data.Length];
         //Array.Copy(e.Data, data, data.Length);
         VR.DrawVideo(e.Data);
     }
 }
Example #13
0
        static void Main()
        {
            var video = new Video();

            var videoEncoder = new VideoEncoder();

            var mailService = new MailService();

            videoEncoder.VideoEncoded += mailService.VideoEncoded;

            videoEncoder.Encode(video);
        }
        static void Main(string[] args)
        {
            Video video = new Video {
                Title = "My Video"
            };
            VideoEncoder encoder     = new VideoEncoder();
            MailService  mailService = new MailService();

            encoder.VideoEncoded += mailService.OnVideoEncoded;

            encoder.Encode(video);
        }
Example #15
0
        public void EventoClick(object sender, EventArgs args)
        {
            var video = new Video()
            {
                Nome = "novo_video.mp4"
            };
            var encoder = new VideoEncoder();

            encoder.Encoded += new Email().EnviarMensagem;
            encoder.Encoded += new SMS().EnviarMensagem;

            encoder.Encode(video);
        }
        static void Main(string[] args)
        {
            var encoder = new VideoEncoder();

            MailService mailService = new MailService();

            encoder.VideoEncoded += mailService.OnVideoEncoded;

            encoder.Encode(new Video()
            {
                Title = "Title"
            });
        }
Example #17
0
        static void Main(string[] args)
        {
            VideoEncoder video = new VideoEncoder();

            FileLogger flog  = new FileLogger();
            DBLogger   dblog = new DBLogger();

            video.LogEncoded += flog.log;
            video.LogEncoded += dblog.log;

            video.Encode();
            Console.ReadKey();
        }
Example #18
0
        public static void Run()
        {
            var video = new Video()
            {
                Title = "video 1"
            };
            var videoEncoder   = new VideoEncoder();   // publisher
            var mailService    = new MailService();    // subscriber
            var messageService = new MessageService(); // subscriber

            videoEncoder.VideoEncoded += mailService.OnVideoEncoded;
            videoEncoder.VideoEncoded += messageService.OnVideoEncoded;
            videoEncoder.Encode(video);
        }
Example #19
0
        static void Main(string[] args)
        {
            var video = new Video()
            {
                Title = "Video 1"
            };
            var videoEncoder   = new VideoEncoder(); //publisher
            var mailService    = new MailService();  //subscriber
            var messageService = new MessageService();

            videoEncoder.VideoEncoded += mailService.OnVideoEncoded; //no brackets that means its just a reference or a pointer to that method
            videoEncoder.VideoEncoded += messageService.OnVideoEncoded;
            videoEncoder.Encode(video);
        }
Example #20
0
        static void Main(string[] args)
        {
            var video = new Video()
            {
                Title = "Video 1"
            };
            var videoEncoder = new VideoEncoder();
            var mailService  = new MailService();
            var textService  = new TextService();

            mailService.EmailSent     += textService.OnEmailSent;
            videoEncoder.VideoEncoded += mailService.OnVideoEncoded;
            videoEncoder.Encode(video);
        }
Example #21
0
        private static void Main(string[] args)
        {
            var video = new Video {
                Title = "Video1"
            };
            var videoEncoder   = new VideoEncoder();   //publisher
            var mailService    = new MailService();    //subsciber
            var messageService = new MessageService(); //subsciber

            videoEncoder.VideoEncoded += mailService.onVideoEncoded;
            videoEncoder.VideoEncoded += messageService.onVideoEncoded;

            videoEncoder.Encode(video);
        }
Example #22
0
        static void Main(string[] args)
        {
            var video = new Video()
            {
                Title = "Video 1"
            };
            var videoEncoder   = new VideoEncoder();  //publisher
            var emailService   = new EmailService();  //subscriber
            var messageService = new MessageSerice(); //subscriber

            videoEncoder.VideoEncoded += emailService.OnVideoEncoded;
            videoEncoder.VideoEncoded += messageService.OnVideoEncoded;
            videoEncoder.Encode(video);
        }
        static void Main(string[] args)
        {
            var video = new Video()
            {
                Title = "Video 1"
            };
            var videoEncoder   = new VideoEncoder(); // publisher
            var mailService    = new MailService();  // subscriber
            var messageService = new MessageService();

            videoEncoder.VideoEncoded += mailService.OnVideoEncoded; // pointer to an event handler method
            videoEncoder.VideoEncoded += messageService.OnVideoEncoded;
            videoEncoder.Encode(video);
        }
Example #24
0
        static void Main(string[] args)
        {
            var video = new Video()
            {
                Title = "Video 1"
            };
            var videoEncoder  = new VideoEncoder();
            var mailService   = new MailService();
            var messageSerice = new MessageService();

            videoEncoder.VideoEncoded += mailService.OnVideoEncoded;
            videoEncoder.VideoEncoded += messageSerice.OnVideoEncoded;
            videoEncoder.Encode(video);
        }
Example #25
0
        static void Main(string[] args)
        {
//1) TypeValueValidation tv = new TypeValueValidation();
            Video video = new Video()
            {
                Title = "Video 1"
            };
            var videoEncoder   = new VideoEncoder();   //Publisher
            var mailservice    = new MailService();    //Subscriber
            var messageservice = new MessageService(); //Subscriber

            videoEncoder.VideoEncoded += mailservice.onVideoEncoded;
            videoEncoder.VideoEncoded += messageservice.onVideoEncoded;
            videoEncoder.Encode(video);
        }
Example #26
0
        static void Main(string[] args)
        {
            var video = new Video()
            {
                Title = "The Big Lebowsky"
            };
            var videoEncoder   = new VideoEncoder();                 // publisher
            var mailService    = new MailService();                  // subscriber 1
            var messageService = new MessageService();               // subscriber 2

            videoEncoder.VideoEncoded += mailService.OnVideoEncoded; // Add reference to subscriber
            videoEncoder.VideoEncoded += messageService.OnVideoEncoded;

            videoEncoder.Encode(video);
        }
Example #27
0
        static void Main(string[] args)
        {
            var video = new Video()
            {
                Title = "Video 2"
            };
            var videoEncoder   = new VideoEncoder();                 //publisher
            var mailService    = new MailService();                  // subscriber
            var messageService = new MessageService();               // subscriber

            videoEncoder.VideoEncoded += mailService.OnVideoEncoded; // pointer to mail service
            videoEncoder.VideoEncoded += messageService.OnMessageService;

            videoEncoder.Encode(video);
        }
Example #28
0
        static void Main(string[] args)
        {
            var video = new Video()
            {
                Title = "Video 1"
            };
            var videoEncoder   = new VideoEncoder();                 //publisher
            var mailService    = new MailService();                  //subscriber
            var messageService = new MessageService();               //subscriber

            videoEncoder.VideoEncoded += mailService.OnVideoEncoded; //+= to register the handler for that event
            videoEncoder.VideoEncoded += messageService.OnVideoEncoded;

            videoEncoder.Encode(video);
        }
Example #29
0
        static void Main(string[] args)
        {
            var video = new Video()
            {
                Title = "Video 1"
            };
            var videoEncoder   = new VideoEncoder();   // publisher
            var mailService    = new MailService();    // subscriber
            var messageService = new MessageService(); // subscriber

            // references / pointers to the event
            videoEncoder.VideoEncoded += mailService.OnVideoEncoded;
            videoEncoder.VideoEncoded += messageService.OnVideoEncoded;

            videoEncoder.Encode(video);
        }
Example #30
0
        public static void Main(string[] args)
        {
            var video = new Video {
                Title = "video 1"
            };
            var videoEncoder = new VideoEncoder();   // publisher
            var mailService  = new MailService();    // subscriber
            var msgService   = new MessageService(); //subscriber II

            //below the mail service is subscribing to the event VideoEncoded (or the event publisher Video Encoder)
            videoEncoder.VideoEncoded += mailService.OnVideoEncoded;
            videoEncoder.VideoEncoded += msgService.OnVideoEncoded;


            videoEncoder.Encode(video);
        }
        static void Main(string[] args)
        {
            var encoder         = new VideoEncoder();
            var facebookService = new FacebookService();
            var youtubeService  = new YouTubeService();
            var spotifyService  = new SpotifyService();

            // Subscribe
            encoder.VideoEncoded += facebookService.OnVideoEncoded;
            encoder.VideoEncoded += youtubeService.OnVideoEncoded;

            encoder.AudioEncoded += spotifyService.OnAudioEncoded;

            // Execute Encode
            encoder.Encode();
        }
Example #32
0
        public void MainMethod()
        {
            var video = new Video()
            {
                Title = "Kitty and puppy"
            };
            var encoder        = new VideoEncoder(); // publisher
            var mailService    = new MailService();  // subscriber
            var messageService = new MessageService();

            encoder.VideoEncodedTwo += mailService.OnVideoEncoded;
            encoder.VideoEncoded    += messageService.OnVideoEncoded;
            encoder.Encode(video);

            /* Creating subscribers */
        }
Example #33
-1
        public static void Main(string[] args)
        {
            var video = new Video() { Title = "Video 1"};
            var videoEncoder = new VideoEncoder(); //publisher
            var mailService = new MailService(); //subscriber
            var messageService = new MessageService();

            videoEncoder.VideoEncoded += mailService.OnVideoEncoded;
            videoEncoder.VideoEncoded += messageService.OnVideoEncoded;

            videoEncoder.Encode(video);
        }
Example #34
-1
        static void Main(string[] args)
        {
            Video myVideo = new Video();
            myVideo.Title = "Video 1";

            VideoEncoder myVideoEncoder = new VideoEncoder();       // Publisher
            MailService myMailService = new MailService();          // Subscriber
            MessageService myMessageService = new MessageService(); // Another subscriber

            myVideoEncoder.VideoEncoded += myMessageService.OnVideoEncoded;
            myVideoEncoder.VideoEncoded += myMailService.OnVideoEncoded; /* Code explanation:
                                                                         * the object "myVideoEncoder" has an event called "VideoEncoded",
                                                                         * we then add the "OnVideoEncoded" method from "myMailService" as a subscriber,
                                                                         * so that when "myVideoEncoder" raises the event "VideoEncoded", the
                                                                         * function: "OnVideoEncoded" is called from the class: "myMailService".
                                                                         */

            myVideoEncoder.Encode(myVideo);
        }