]> git.pld-linux.org Git - packages/avifile.git/commitdiff
- converter from wma (or any other supported audio stream) to wave
authorMichal Moskal <michal@moskal.me>
Wed, 2 Jan 2002 15:24:15 +0000 (15:24 +0000)
committercvs2git <feedback@pld-linux.org>
Sun, 24 Jun 2012 12:13:13 +0000 (12:13 +0000)
Changed files:
    avifile-wma2wav.patch -> 1.1

avifile-wma2wav.patch [new file with mode: 0644]

diff --git a/avifile-wma2wav.patch b/avifile-wma2wav.patch
new file mode 100644 (file)
index 0000000..1a6d7ab
--- /dev/null
@@ -0,0 +1,176 @@
+diff -urN avifile-0.6.0.20011207/lib/common/util.cpp avifile-0.6.0.20011207-/lib/common/util.cpp
+--- avifile-0.6.0.20011207/lib/common/util.cpp Wed Nov 21 23:33:02 2001
++++ avifile-0.6.0.20011207-/lib/common/util.cpp        Wed Dec 19 01:58:31 2001
+@@ -440,7 +440,7 @@
+     }
+     fclose(f);
+-    printf("Available CPU flags: %s\n", flags);
++    fprintf(stderr, "Available CPU flags: %s\n", flags);
+     have_tsc = (strstr(flags, "tsc") != 0);
+     have_mmx = (strstr(flags, "mmx") != 0);
+     have_sse = (strstr(flags, "sse") != 0);
+@@ -460,7 +460,7 @@
+     if (freq < 0)
+       freq = old_freq();
+     if (have_tsc)
+-      printf("%f MHz %s processor detected\n", freq/1000., model);
++      fprintf(stderr, "%f MHz %s processor detected\n", freq/1000., model);
+ }
+diff -urN avifile-0.6.0.20011207/samples/misc/Makefile.am avifile-0.6.0.20011207-/samples/misc/Makefile.am
+--- avifile-0.6.0.20011207/samples/misc/Makefile.am    Mon Dec  3 11:38:01 2001
++++ avifile-0.6.0.20011207-/samples/misc/Makefile.am   Wed Dec 19 01:58:31 2001
+@@ -8,6 +8,7 @@
+ avitype_SOURCES=avitype.cpp
+ extractor_SOURCES=extractor.cpp
++wma2wav_SOURCES=wma2wav.cpp
+ test_SOURCES=test.cpp
+ #plustest_SOURCES=plustest.cpp
+ #imtest_SOURCES=imtest.cpp
+@@ -24,6 +25,7 @@
+ avitype_LDADD = $(LIBRARY)
+ extractor_LDADD = $(LIBRARY)
++wma2wav_LDADD = $(LIBRARY)
+ if AMM_USE_JPEGLIB
+ avimake_SOURCES = avimake.cpp
+@@ -33,7 +35,7 @@
+ PROG_AVIMAKE =
+ endif
+-bin_PROGRAMS = avibench avicat avitype $(PROG_AVIMAKE)
++bin_PROGRAMS = avibench avicat avitype $(PROG_AVIMAKE) wma2wav
+ check_PROGRAMS = asfdump asftest avitest extractor test
+ EXTRA_DIST =  imtest.cpp plustest.cpp qualtest.cpp test.cpp
+diff -urN avifile-0.6.0.20011207/samples/misc/wma2wav.cpp avifile-0.6.0.20011207-/samples/misc/wma2wav.cpp
+--- avifile-0.6.0.20011207/samples/misc/wma2wav.cpp    Thu Jan  1 01:00:00 1970
++++ avifile-0.6.0.20011207-/samples/misc/wma2wav.cpp   Wed Dec 19 01:58:51 2001
+@@ -0,0 +1,123 @@
++/*
++ * Convert .wma files to .wav (so they can be treated with lame to produce
++ * more reasonable output :^)
++ * Copyright (c) 2001 Michal Moskal (malekith@pld.org.pl)
++ *
++ * I was motivated to write this simple cuple of lines by Piotr Modrzyk,
++ * and I wish to thank him here ;)
++ *
++ * This program could be probably also used to extract soundtrack from 
++ * movies, but I don't mind and hence the name...
++ */
++
++#include <config.h>
++#include <default.h>
++#include <avifile.h>
++#include <stdio.h>
++#include <aviplay.h>
++#include <except.h>
++#include <version.h>
++#include <unistd.h>
++#include <fcntl.h>
++#include <string.h>
++
++#define __MODULE__ "wma2wav"
++
++using namespace std;
++
++int main(int argc, const char **argv)
++{
++      IAviReadFile *ac = 0;
++      IAviReadStream *as = 0;
++      uint8_t *zz = 0;
++      int out_fd;
++      const char *infile, *outfile;
++
++      if (argc != 2 && argc != 3) {
++              fprintf(stderr, "\n\nUSAGE: %s inputfile [outputfile]\n"
++                              "If outputfile is not present or is \"-\" "
++                              "stdout is used.\n\n",  argv[0]);
++              exit(1);
++      }
++
++      if (GetAvifileVersion() != AVIFILE_VERSION) {
++              fprintf(stderr,
++                      "This binary was compiled for Avifile ver. "
++                      "%f, but the but the library is ver. %f. Aborting.\n",
++                      AVIFILE_VERSION, GetAvifileVersion());
++              exit(1);
++      }
++
++      infile = argv[1];
++      outfile = argv[2];
++      
++      if (outfile && strcmp(outfile, "-") == 0)
++              outfile = NULL;
++      
++      if (outfile == NULL) {
++              // preserve stdout
++              out_fd = dup(1);
++              // copy messages to stderr
++              dup2(2, 1);
++      } else {
++              out_fd = open(outfile, O_WRONLY|O_TRUNC|O_CREAT, 0666);
++              if (out_fd < 0) {
++                      perror(outfile);
++                      exit(1);
++              }
++      }
++
++      try {
++              ac = CreateIAviReadFile(infile);
++              if (ac == NULL) {
++                      fprintf(stderr, "%s: can't read it\n", infile);
++                      exit(1);
++              }
++
++              as = ac->GetStream(0, AviStream::Audio);
++              if (ac == NULL) {
++                      fprintf(stderr, "%s: doesn't contains audio stream\n", 
++                              infile);
++                      exit(1);
++              }
++
++              const int buffer_size = 2 * 1024 * 1024;
++              zz = new uint8_t[buffer_size];
++              size_t samp_read, bytes_read, sz;
++              WAVEFORMATEX hdr;
++
++              memset(&hdr, 0, sizeof(hdr));
++              as->GetAudioFormatInfo(&hdr, NULL);
++
++              write(out_fd, "RIFF\x0f\xff\xff\xffWAVEfmt \x10\0\0\0", 20);
++              // override
++              hdr.wFormatTag = 1;
++              write(out_fd, &hdr, 16);
++              write(out_fd, "data\x0f\xff\xff\xff", 8);
++
++              as->StopStreaming();
++              as->StartStreaming();
++              while (!as->Eof()) {
++                      sz = as->GetFrameSize();
++                      if (sz > (size_t)buffer_size)
++                              sz = buffer_size;
++                      as->ReadFrames(zz, sz, sz, samp_read, bytes_read);
++                      if (write(out_fd, zz, bytes_read) != (int)bytes_read) {
++                              perror("write");
++                              exit(1);
++                      }
++              }
++
++              close(out_fd);
++      } catch(FatalError & error) {
++              fprintf(stderr, "Fatal error:\n");
++              error.Print();
++              exit(1);
++      }
++      if (ac)
++              delete ac;
++      if (zz)
++              delete zz;
++              
++      return 0;
++}
This page took 0.113986 seconds and 4 git commands to generate.