Updated WavPack decoder binary to v5.1.0 (2017-01-20), compiled with ICL 18.0 and...
[LameXP.git] / etc / Patches / deprecated / OpusTools-Git20130616-Progress+NoResample.diff
blob8f7a92d8166a15adb6758093a85bc5facc808ce4
1 diff --git a/src/opusdec.c b/src/opusdec.c
2 index 2ed4ba3..b104954 100644
3 --- a/src/opusdec.c
4 +++ b/src/opusdec.c
5 @@ -53,6 +53,7 @@
6 # include <io.h>
7 # include <fcntl.h>
8 # define I64FORMAT "I64d"
9 +# define ftello64(_x) _ftelli64((_x))
10 #else
11 # define I64FORMAT "lld"
12 # define fopen_utf8(_x,_y) fopen((_x),(_y))
13 @@ -653,6 +654,7 @@ int main(int argc, char **argv)
14 {"force-wav", no_argument, NULL, 0},
15 {"packet-loss", required_argument, NULL, 0},
16 {"save-range", required_argument, NULL, 0},
17 + {"no-resample", no_argument, NULL, 0},
18 {0, 0, 0, 0}
20 ogg_sync_state oy;
21 @@ -662,6 +664,7 @@ int main(int argc, char **argv)
22 int close_in=0;
23 int eos=0;
24 ogg_int64_t audio_size=0;
25 + ogg_int64_t input_size=0;
26 double last_coded_seconds=0;
27 float loss_percent=-1;
28 float manual_gain=0;
29 @@ -677,6 +680,7 @@ int main(int argc, char **argv)
30 int dither=1;
31 shapestate shapemem;
32 SpeexResamplerState *resampler=NULL;
33 + int no_resample = 0;
34 float gain=1;
35 int streams=0;
36 size_t last_spin=0;
37 @@ -738,7 +742,10 @@ int main(int argc, char **argv)
38 forcewav=1;
39 } else if (strcmp(long_options[option_index].name,"rate")==0)
41 - rate=atoi (optarg);
42 + rate=((no_resample) ? 48000 : atoi(optarg));
43 + } else if (strcmp(long_options[option_index].name,"no-resample")==0)
44 + {
45 + no_resample=1; rate=48000;
46 } else if (strcmp(long_options[option_index].name,"gain")==0)
48 manual_gain=atof (optarg);
49 @@ -820,6 +827,16 @@ int main(int argc, char **argv)
50 close_in=1;
53 + /*detect input size*/
54 + if(fin != stdin)
55 + {
56 + struct _stat64 info;
57 + if(_fstati64(_fileno(fin), &info) == 0)
58 + {
59 + input_size = info.st_size;
60 + }
61 + }
63 /* .opus files use the Ogg container to provide framing and timekeeping.
64 * http://tools.ietf.org/html/draft-terriberry-oggopus
65 * The easiest way to decode the Ogg container is to use libogg, so
66 @@ -984,10 +1001,11 @@ int main(int argc, char **argv)
67 /*Display a progress spinner while decoding.*/
68 static const char spinner[]="|/-\\";
69 double coded_seconds = (double)audio_size/(channels*rate*sizeof(short));
70 + double percent = (input_size>0) ? ((double)ftello64(fin))/((double)input_size) : 0.0;
71 if(coded_seconds>=last_coded_seconds+1){
72 - fprintf(stderr,"\r[%c] %02d:%02d:%02d", spinner[last_spin&3],
73 + fprintf(stderr,"\r[%c] %02d:%02d:%02d (%.f%%)", spinner[last_spin&3],
74 (int)(coded_seconds/3600),(int)(coded_seconds/60)%60,
75 - (int)(coded_seconds)%60);
76 + (int)(coded_seconds)%60,percent*100.0);
77 fflush(stderr);
78 last_spin++;
79 last_coded_seconds=coded_seconds;
80 diff --git a/src/opusenc.c b/src/opusenc.c
81 index a2355d8..2f13414 100644
82 --- a/src/opusenc.c
83 +++ b/src/opusenc.c
84 @@ -1047,6 +1047,7 @@ int main(int argc, char **argv)
85 double estbitrate;
86 double coded_seconds=nb_encoded/(double)coding_rate;
87 double wall_time=(stop_time-start_time)+1e-6;
88 + double percent = 0.0;
89 char sbuf[55];
90 static const char spinner[]="|/-\\";
91 if(!with_hard_cbr){
92 @@ -1054,20 +1055,16 @@ int main(int argc, char **argv)
93 estbitrate=(total_bytes*8.0/coded_seconds)*tweight+
94 bitrate*(1.-tweight);
95 }else estbitrate=nbBytes*8*((double)coding_rate/frame_size);
96 + if(inopt.total_samples_per_channel>0){
97 + percent = ((double)nb_encoded) / ((double)inopt.total_samples_per_channel);
98 + }
99 fprintf(stderr,"\r");
100 for(i=0;i<last_spin_len;i++)fprintf(stderr," ");
101 - if(inopt.total_samples_per_channel>0 && inopt.total_samples_per_channel<nb_encoded){
102 - snprintf(sbuf,54,"\r[%c] %02d%% ",spinner[last_spin&3],
103 - (int)floor(nb_encoded/(double)(inopt.total_samples_per_channel+inopt.skip)*100.));
104 - }else{
105 - snprintf(sbuf,54,"\r[%c] ",spinner[last_spin&3]);
107 - last_spin_len=strlen(sbuf);
108 - snprintf(sbuf+last_spin_len,54-last_spin_len,
109 - "%02d:%02d:%02d.%02d %4.3gx realtime, %5.4gkbit/s",
110 + snprintf(sbuf,54,"\r[%c] %02d:%02d:%02d.%02d (%.f%%) %4.3gx realtime, %5.4gkbit/s",
111 + spinner[last_spin&3],
112 (int)(coded_seconds/3600),(int)(coded_seconds/60)%60,
113 (int)(coded_seconds)%60,(int)(coded_seconds*100)%100,
114 - coded_seconds/wall_time,
115 + percent*100.0,coded_seconds/wall_time,
116 estbitrate/1000.);
117 fprintf(stderr,"%s",sbuf);
118 fflush(stderr);