Ejemplo n.º 1
0
        public VideoFile Convert(string fileName, string format)
        {
            var file         = new VideoFile(fileName);
            var codecFactory = new CodecFactory();
            var sourceCodec  = codecFactory.Extract(file);
            ICompressionCodec destinationCodec;

            if ("mpy4".Equals(format))
            {
                destinationCodec = new MPEG4CompressionCodec();
            }
            else
            {
                destinationCodec = new OggCompressionCodec();
            }

            var buffer = BitrateReader.Read(fileName, sourceCodec);
            var result = BitrateReader.Convert(buffer, destinationCodec);

            var audioMixer = new AudioMixer();

            result = audioMixer.Fix(result);

            return(new VideoFile(result));
        }
Ejemplo n.º 2
0
        public File Convert(String fileName, String format)
        {
            ICodec       destinationCodec;
            VideoFile    file        = new VideoFile(fileName);
            CodecFactory sourceCodec = CodecFactory.Extract(file);

            if (format == "mp4")
            {
                destinationCodec = new MPEG4CompressionCodec();
            }
            else
            {
                destinationCodec = new OggCompressionCodec();
            }
            String buffer = BitrateReader.Read(fileName, sourceCodec);
            String result = BitrateReader.Convert(buffer, destinationCodec);

            result = AudioMixer.Fix(result);
            return(new File(result));
        }
Ejemplo n.º 3
0
            public VideoFile Convert(string filename, string format)
            {
                var file = new VideoFile(filename);

                Codec sourceCodec = new CodecFactory().Extract(file);
                Codec destinationCodec;

                if (format == "mp4")
                {
                    destinationCodec = new MPEG4CompressionCodec();
                }
                else
                {
                    destinationCodec = new OggCompressionCodec();
                }

                string buffer = BitrateReader.Read(filename, sourceCodec);

                byte[] result = BitrateReader.Convert(buffer, destinationCodec);
                result = new AudioMixer().Fix(result);
                return(new VideoFile(result));
            }
        public FileInfo ConvertVideo(String fileName, String format)
        {
            Console.WriteLine("VideoConversionFacade: conversion started.");
            VideoFile file        = new VideoFile(fileName);
            ICodec    sourceCodec = CodecFactory.Extract(file);
            ICodec    destinationCodec;

            if (format.Equals("mp4"))
            {
                destinationCodec = new OggCompressionCodec();
            }
            else
            {
                destinationCodec = new MPEG4CompressionCodec();
            }
            VideoFile buffer             = BitrateReader.Read(file, sourceCodec);
            VideoFile intermediateResult = BitrateReader.Convert(buffer, destinationCodec);
            FileInfo  result             = (new AudioMixer()).Fix(intermediateResult);

            Console.WriteLine("VideoConversionFacade: conversion completed.");
            Console.ReadKey();
            return(result);
        }
Ejemplo n.º 5
0
        public VideoFile Convert(string fileName, string format)
        {
            var file       = new VideoFile(fileName);
            var sourceCode = CodecFactory.Extract(file);

            Console.WriteLine(sourceCode);

            // you could implement switch case for different formats
            if (format == "mp4")
            {
                var destinationCodec = new MPEG4CompressionCodec();
                var buffer           = BitrateReader.read(fileName, sourceCode);
                Console.WriteLine(buffer);
                var result = BitrateReader.convert(buffer, destinationCodec);
                Console.WriteLine(result);
                result = (new AudioMixer()).fix(result);
                Console.WriteLine(result);
                Console.WriteLine("finishing your video convertor");
                return(new VideoFile(result));
            }
            Console.WriteLine("can't convert undefined format");
            return(file);
        }
Ejemplo n.º 6
0
        public FileTest Convert(string fileName, string format)
        {
            var file = new VideoFile(fileName);

            var sourceCodec = new CodecFactory().Extract(file);

            IMyInterface destinationCodec;

            if (format == "mp4")
            {
                destinationCodec = new MPEG4CompressionCodec();
            }
            else
            {
                destinationCodec = new OggCompressionCodec();
            }

            var buffer = BitrateReader.Read(fileName, sourceCodec);
            var result = BitrateReader.Convert(buffer, destinationCodec);

            result = (new AudioMixer()).Fix(result);

            return(new FileTest(result));
        }