コード例 #1
0
ファイル: Mp3Functions.cs プロジェクト: 4dvn/yeti
        /// <summary>
        /// Combines files into one in the order they are passed in..
        /// </summary>
        /// <param name="bufferMultiplier">The multiplier to use against the OptimalBufferSize of the file for the read buffer, sometimes a larger than optimal buffer size is better.</param>
        /// <param name="filepaths">The file paths to combine</param>
        /// <param name="outputStream">The stream to save the combined file to.</param>
        public static void Combine(Stream outputStream, int bufferMultiplier, params string[] filepaths)
        {
            var inputStreams = new Stream[filepaths.Length];

            for (var i = 0; i < filepaths.Length; i++)
            {
                inputStreams[i] = new WmaStreamReader(filepaths[i]);
            }

            Combine(outputStream, bufferMultiplier, inputStreams);
        }
コード例 #2
0
ファイル: WmaFunctions.cs プロジェクト: mtscout6/yeti
        /// <summary>
        /// Combines files into one in the order they are passed in..
        /// </summary>
        /// <param name="bufferMultiplier">The multiplier to use against the OptimalBufferSize of the file for the read buffer, sometimes a larger than optimal buffer size is better.</param>
        /// <param name="filepaths">The file paths to combine</param>
        /// <param name="outputStream">The stream to save the combined file to.</param>
        public static void Combine(Stream outputStream, int bufferMultiplier, params string[] filepaths)
        {
            var inputStreams = new Stream[filepaths.Length];

            for (var i = 0; i < filepaths.Length; i++)
            {
                inputStreams[i] = new WmaStreamReader(filepaths[i]);
            }

            Combine(outputStream, bufferMultiplier, inputStreams);
        }
コード例 #3
0
ファイル: Mp3Functions.cs プロジェクト: 4dvn/yeti
        private static void WriteFile(Mp3Writer wmaOutput, WmaStreamReader wmaInput, byte[] buffer, long stopPosition)
        {
            if (stopPosition == -1)
            {
                stopPosition = wmaInput.Length + 1;
            }
            int read;

            //Read the file until we hit our stop position, or the end of the file.
            while (wmaInput.Position < stopPosition && (read = wmaInput.Read(buffer, 0, buffer.Length)) > 0)
            {
                wmaOutput.Write(buffer, 0, read);
            }
        }
コード例 #4
0
ファイル: Mp3Functions.cs プロジェクト: 4dvn/yeti
 private static void WriteFile(Mp3Writer wmaOutput, WmaStreamReader wmaInput, byte[] buffer)
 {
     WriteFile(wmaOutput, wmaInput, buffer, -1);
 }
コード例 #5
0
ファイル: WmaFunctions.cs プロジェクト: mtscout6/yeti
 private static void WriteFile(WmaWriter wmaOutput, WmaStreamReader wmaInput, byte[] buffer, long stopPosition)
 {
     if (stopPosition == -1)
     {
         stopPosition = wmaInput.Length + 1;
     }
     int read;
     //Read the file until we hit our stop position, or the end of the file.
     while (wmaInput.Position < stopPosition && (read = wmaInput.Read(buffer, 0, buffer.Length)) > 0)
     {
         wmaOutput.Write(buffer, 0, read);
     }
 }
コード例 #6
0
ファイル: WmaFunctions.cs プロジェクト: mtscout6/yeti
 private static void WriteFile(WmaWriter wmaOutput, WmaStreamReader wmaInput, byte[] buffer)
 {
     WriteFile(wmaOutput, wmaInput, buffer, -1);
 }
コード例 #7
0
ファイル: WmaConversions.cs プロジェクト: pclancy/yeti
        public static void WmaToMp3(Stream wmaInputStream, Stream outputStream, Mp3WriterConfig mp3Format, int bufferMultiplier)
        {
            WmaToMp3Delegate convert = wmaStream =>
                                       {
                                           var writer = new Mp3Writer(outputStream,
                                                            mp3Format ?? new Mp3WriterConfig(wmaStream.Format, new BE_CONFIG(wmaStream.Format)));
                                           var buffer = new byte[writer.OptimalBufferSize*bufferMultiplier];
                                           WriteToStream(writer, wmaStream, buffer);
                                       };

            var tempStream = wmaInputStream as WmaStreamReader;
            if (tempStream != null)
            {
                convert(tempStream);
            }
            else
            {
                using (var wmaStream = new WmaStreamReader(wmaInputStream))
                {
                    convert(wmaStream);
                }
            }
        }
コード例 #8
0
ファイル: WmaConversions.cs プロジェクト: pclancy/yeti
 public static void WmaToWma(
     string wmafilePath, Stream outputStream, WmaWriterConfig wmaFormat, int bufferMultiplier)
 {
     using (var wmaStream = new WmaStreamReader(wmafilePath))
     {
         var writer = new WmaWriter(outputStream, wmaFormat);
         var buffer = new byte[writer.OptimalBufferSize*bufferMultiplier];
         WriteToStream(writer, wmaStream, buffer);
     }
 }