Exemplo n.º 1
0
 public void Unload()
 {
     if (_lame == null)
     {
         return;
     }
     _lame.Unload();
     _lame = null;
 }
Exemplo n.º 2
0
 public Scanner(Lame lame, VirusLib vdb)
 {
     if (lame == null || vdb == null)
     {
         throw new Exception("Unknown Excepiton");
     }
     this.lame = lame;
     this.vdb  = vdb;
 }
Exemplo n.º 3
0
        private void DoEncodeAudio(EncodeInfo job)
        {
            FfMpeg     ffmpeg = new FfMpeg();
            OggEnc     oggEnc = new OggEnc();
            Lame       lame   = new Lame();
            NeroAACEnc aacEnc = new NeroAACEnc();

            switch (job.AudioProfile.Type)
            {
            case ProfileType.AC3:
                ffmpeg.SetJob(job);
                _worker.DoWork += ffmpeg.DoEncodeAc3;
                Log.Info("ffmpeg.DoEncodeAC3()");
                break;

            case ProfileType.OGG:
                oggEnc.SetJob(job);
                _worker.DoWork += oggEnc.DoEncode;
                Log.Info("oggenc.DoEncode()");
                break;

            case ProfileType.AAC:
                aacEnc.SetJob(job);
                _worker.DoWork += aacEnc.DoEncode;
                Log.Info("NeroAacEnc.DoEncode()");
                break;

            case ProfileType.MP3:
                lame.SetJob(job);
                _worker.DoWork += lame.DoEncode;
                Log.Info("lame.DoEncode()");
                break;

            case ProfileType.Copy:
                if (job.EncodingProfile.OutFormat == OutputType.OutputDvd &&
                    !Processing.CheckAudioDvdCompatible(job.AudioStreams[job.StreamId]))
                {
                    ffmpeg.SetJob(job);
                    _worker.DoWork += ffmpeg.DoEncodeAc3;
                    Log.Info("ffmpeg.DoEncodeAC3()");
                }
                break;
            }
        }
Exemplo n.º 4
0
        static void LameTest(VirusLib vdb, string path)
        {
            if (vdb == null)
            {
                return;
            }


            // 1. load
            Lame _lame = new Lame();

            if (!_lame.Load(vdb))
            {
                return;
            }

            //2. scan
            if (File.Exists(path))
            {
                LameScanResult _result = _lame.ScanFile(path);
                PrintScanResult(path, _result);
            }
            else if (Directory.Exists(path))
            {
                string[] files = Directory.GetFiles(path);
                foreach (string f in files)
                {
                    LameScanResult _result = _lame.ScanFile(f);
                    PrintScanResult(f, _result);
                }

                //travel dir......
            }



            //3.
            _lame.Unload();
        }
Exemplo n.º 5
0
 public Mp3WriterConfig(WaveFormat InFormat, Lame.BE_CONFIG beconfig)
   :base(InFormat)
 {
   m_BeConfig = beconfig;
 }
Exemplo n.º 6
0
        public Mp3Decoder(string mp3File)
        {
            // encoder modules
            lame  = new Lame();
            gaud  = new GetAudio();
            ga    = new GainAnalysis();
            bs    = new BitStream();
            p     = new Presets();
            qupvt = new QuantizePVT();
            qu    = new Quantize();
            vbr   = new VBRTag();
            ver   = new Mp3Version();
            id3   = new ID3Tag();
            rv    = new Reservoir();
            tak   = new Takehiro();
            parse = new Parse();

            mpg    = new MPGLib();
            intf   = new Interface();
            common = new Mpg.Common();

            lame.setModules(ga, bs, p, qupvt, qu, vbr, ver, id3, mpg);
            bs.setModules(ga, mpg, ver, vbr);
            id3.setModules(bs, ver);
            p.Modules = lame;
            qu.setModules(bs, rv, qupvt, tak);
            qupvt.setModules(tak, rv, lame.enc.psy);
            rv.Modules  = bs;
            tak.Modules = qupvt;
            vbr.setModules(lame, bs, ver);
            gaud.setModules(parse, mpg);
            parse.setModules(ver, id3, p);

            // decoder modules
            mpg.setModules(intf, common);
            intf.setModules(vbr, common);

            gfp = lame.lame_init();

            /*
             * turn off automatic writing of ID3 tag data into mp3 stream we have to
             * call it before 'lame_init_params', because that function would spit
             * out ID3v2 tag data.
             */
            gfp.write_id3tag_automatic = false;

            /*
             * Now that all the options are set, lame needs to analyze them and set
             * some more internal options and check for problems
             */
            lame.lame_init_params(gfp);

            parse.input_format = GetAudio.sound_file_format.sf_mp3;

            var inPath = new StringBuilder(mp3File);
            var enc    = new Enc();

            gaud.init_infile(gfp, inPath.ToString(), enc);

            var skip_start = 0;
            var skip_end   = 0;

            if (parse.silent < 10)
            {
                Console.Write(
                    "\rinput:  {0}{1}({2:g} kHz, {3:D} channel{4}, ",
                    inPath,
                    inPath.Length > 26 ? "\n\t" : "  ",
                    gfp.in_samplerate / 1000,
                    gfp.num_channels,
                    gfp.num_channels != 1 ? "s" : "");
            }

            if (enc.enc_delay > -1 || enc.enc_padding > -1)
            {
                if (enc.enc_delay > -1)
                {
                    skip_start = enc.enc_delay + 528 + 1;
                }

                if (enc.enc_padding > -1)
                {
                    skip_end = enc.enc_padding - (528 + 1);
                }
            }
            else
            {
                skip_start = gfp.encoder_delay + 528 + 1;
            }

            Console.Write("MPEG-{0:D}{1} Layer {2}", 2 - gfp.version, gfp.out_samplerate < 16000 ? ".5" : "", "III");

            Console.Write(")\noutput: (16 bit, Microsoft WAVE)\n");

            if (skip_start > 0)
            {
                Console.Write("skipping initial {0:D} samples (encoder+decoder delay)\n", skip_start);
            }

            if (skip_end > 0)
            {
                Console.Write("skipping final {0:D} samples (encoder padding-decoder delay)\n", skip_end);
            }

            wavsize = -(skip_start + skip_end);
            parse.mp3input_data.totalframes = parse.mp3input_data.nsamp / parse.mp3input_data.framesize;

            Debug.Assert(gfp.num_channels >= 1 && gfp.num_channels <= 2);
        }
Exemplo n.º 7
0
 internal void setModules(Lame lame, BitStream bs, Mp3Version v)
 {
     this.lame = lame;
     this.bs   = bs;
     this.v    = v;
 }
Exemplo n.º 8
0
        public static void GetAppVersions(string encPath = "", string javaPath = "")
        {
            if (String.IsNullOrEmpty(encPath))
            {
                encPath = AppSettings.ToolsPath;
            }
            if (String.IsNullOrEmpty(javaPath))
            {
                javaPath = AppSettings.JavaInstallPath;
            }

            X264 x264Enc = new X264();

            AppSettings.Lastx264Ver = x264Enc.GetVersionInfo(encPath, false);

            if (Environment.Is64BitOperatingSystem)
            {
                AppSettings.Lastx26464Ver = x264Enc.GetVersionInfo(encPath, true);
            }

            FfMpeg ffmpeg = new FfMpeg();

            AppSettings.LastffmpegVer = ffmpeg.GetVersionInfo(encPath, false);

            if (Environment.Is64BitOperatingSystem)
            {
                AppSettings.Lastffmpeg64Ver = ffmpeg.GetVersionInfo(encPath, true);
            }

            Eac3To eac3To = new Eac3To();

            AppSettings.Lasteac3ToVer = eac3To.GetVersionInfo(encPath);

            LsDvd lsdvd = new LsDvd();

            AppSettings.LastlsdvdVer = lsdvd.GetVersionInfo(encPath);

            MkvMerge mkvMerge = new MkvMerge();

            AppSettings.LastMKVMergeVer = mkvMerge.GetVersionInfo(encPath);

            MPlayer mplayer = new MPlayer();

            AppSettings.LastMplayerVer = mplayer.GetVersionInfo(encPath);

            TsMuxeR tsmuxer = new TsMuxeR();

            AppSettings.LastTSMuxerVer = tsmuxer.GetVersionInfo(encPath);

            MJpeg mjpeg = new MJpeg();

            AppSettings.LastMJPEGToolsVer = mjpeg.GetVersionInfo(encPath);

            DvdAuthor dvdauthor = new DvdAuthor();

            AppSettings.LastDVDAuthorVer = dvdauthor.GetVersionInfo(encPath);

            MP4Box mp4Box = new MP4Box();

            AppSettings.LastMp4BoxVer = mp4Box.GetVersionInfo(encPath);

            HcEnc hcenc = new HcEnc();

            AppSettings.LastHcEncVer = hcenc.GetVersionInfo(encPath);

            OggEnc ogg = new OggEnc();

            AppSettings.LastOggEncVer = ogg.GetVersionInfo(encPath, false);

            if (AppSettings.UseOptimizedEncoders)
            {
                AppSettings.LastOggEncLancerVer = ogg.GetVersionInfo(encPath, true);
            }

            NeroAACEnc aac = new NeroAACEnc();

            AppSettings.LastNeroAacEncVer = aac.GetVersionInfo(encPath);

            Lame lame = new Lame();

            AppSettings.LastLameVer = lame.GetVersionInfo(encPath);

            VpxEnc vpxEnc = new VpxEnc();

            AppSettings.LastVpxEncVer = vpxEnc.GetVersionInfo(encPath);

            XvidEnc xvidEnc = new XvidEnc();
            string  myVer   = xvidEnc.GetVersionInfo(encPath);

            if (!String.IsNullOrEmpty(javaPath))
            {
                BdSup2SubTool bdSup2Sub = new BdSup2SubTool();
                AppSettings.LastBDSup2SubVer = bdSup2Sub.GetVersionInfo(encPath, javaPath);
            }

            #region Get AviSynth Version

            IGraphBuilder graphBuilder = (IGraphBuilder) new FilterGraph();

            string avsFile = AviSynthGenerator.GenerateTestFile();

            int result = graphBuilder.RenderFile(avsFile, null);

            Log.DebugFormat("RenderFile Result: {0}", result);

            if (result < 0)
            {
                Log.Debug("AviSynth is not installed");
            }
            else
            {
                FileVersionInfo ver    = FileVersionInfo.GetVersionInfo(Path.Combine(Environment.SystemDirectory, "avisynth.dll"));
                string          appVer = String.Format("{0:g}.{1:g}.{2:g}.{3:g}", ver.FileMajorPart, ver.FileMinorPart,
                                                       ver.FileBuildPart, ver.FilePrivatePart);
                Log.DebugFormat("Avisynth version {0:s} installed", appVer);
                AppSettings.LastAviSynthVer = appVer;
            }

            File.Delete(avsFile);
            #endregion

            GetAviSynthPluginsVer();
            GetUpdaterVersion();

            AppSettings.UpdateVersions = false;
            AppSettings.SaveSettings();
        }
Exemplo n.º 9
0
        public Mp3Decoder(Stream mp3Stream)
        {
            // encoder modules
            lame  = new Lame();
            gaud  = new GetAudio();
            ga    = new GainAnalysis();
            bs    = new BitStream();
            p     = new Presets();
            qupvt = new QuantizePVT();
            qu    = new Quantize();
            vbr   = new VBRTag();
            ver   = new Mp3Version();
            id3   = new ID3Tag();
            rv    = new Reservoir();
            tak   = new Takehiro();
            parse = new Parse();

            mpg    = new MPGLib();
            intf   = new Interface();
            common = new Mpg.Common();

            lame.setModules(ga, bs, p, qupvt, qu, vbr, ver, id3, mpg);
            bs.setModules(ga, mpg, ver, vbr);
            id3.setModules(bs, ver);
            p.Modules = lame;
            qu.setModules(bs, rv, qupvt, tak);
            qupvt.setModules(tak, rv, lame.enc.psy);
            rv.Modules  = bs;
            tak.Modules = qupvt;
            vbr.setModules(lame, bs, ver);
            gaud.setModules(parse, mpg);
            parse.setModules(ver, id3, p);

            // decoder modules
            mpg.setModules(intf, common);
            intf.setModules(vbr, common);

            gfp = lame.lame_init();

            /*
             * turn off automatic writing of ID3 tag data into mp3 stream we have to
             * call it before 'lame_init_params', because that function would spit
             * out ID3v2 tag data.
             */
            gfp.write_id3tag_automatic = false;

            /*
             * Now that all the options are set, lame needs to analyze them and set
             * some more internal options and check for problems
             */
            lame.lame_init_params(gfp);

            parse.input_format = GetAudio.sound_file_format.sf_mp3;

            var enc = new Enc();

            gaud.init_infile(gfp, mp3Stream, enc);

            SkipStart = 0;
            SkipEnd   = 0;

            if (enc.enc_delay > -1 || enc.enc_padding > -1)
            {
                if (enc.enc_delay > -1)
                {
                    SkipStart = enc.enc_delay + 528 + 1;
                }

                if (enc.enc_padding > -1)
                {
                    SkipEnd = enc.enc_padding - (528 + 1);
                }
            }
            else
            {
                SkipStart = gfp.encoder_delay + 528 + 1;
            }

            WavSize = -(SkipStart + SkipEnd);
            parse.mp3input_data.totalframes = parse.mp3input_data.nsamp / parse.mp3input_data.framesize;

            Framesize  = parse.mp3input_data.framesize;
            SampleRate = parse.mp3input_data.samplerate;
            Length     = parse.mp3input_data.nsamp;
            Channels   = gfp.num_channels;

            Debug.Assert(gfp.num_channels >= 1 && gfp.num_channels <= 2);
        }