ref: 5524cc87923b18c1d023583821df885b6d23097f
parent: 07d15f66940b8ece17611e2c89506fb923822f95
author: Gregory Maxwell <greg@xiph.org>
date: Sat Jul 14 07:05:52 EDT 2012
Preface error messages with error, make set_lsb failures non-fatal.
--- a/src/opusenc.c
+++ b/src/opusenc.c
@@ -550,13 +550,13 @@
st=opus_multistream_encoder_create(coding_rate, chan, header.nb_streams, header.nb_coupled,
mapping, frame_size<480/(48000/coding_rate)?OPUS_APPLICATION_RESTRICTED_LOWDELAY:OPUS_APPLICATION_AUDIO, &ret);
if(ret!=OPUS_OK){
- fprintf(stderr, "Cannot create encoder: %s\n", opus_strerror(ret));
+ fprintf(stderr, "Error cannot create encoder: %s\n", opus_strerror(ret));
exit(1);
}
ret=opus_multistream_encoder_ctl(st, OPUS_SET_SIGNAL(signal));
if(ret!=OPUS_OK){
- fprintf(stderr,"OPUS_SET_SIGNAL returned: %s\n",opus_strerror(ret));
+ fprintf(stderr,"Error OPUS_SET_SIGNAL returned: %s\n",opus_strerror(ret));
exit(1);
}
@@ -567,7 +567,7 @@
opus_multistream_encoder_ctl(st,OPUS_MULTISTREAM_GET_ENCODER_STATE(i,&oe));
ret=opus_encoder_ctl(oe, OPUS_SET_MAX_BANDWIDTH(OPUS_BANDWIDTH_NARROWBAND));
if(ret!=OPUS_OK){
- fprintf(stderr,"OPUS_SET_MAX_BANDWIDTH on stream %d returned: %s\n",i,opus_strerror(ret));
+ fprintf(stderr,"Error OPUS_SET_MAX_BANDWIDTH on stream %d returned: %s\n",i,opus_strerror(ret));
exit(1);
}
}
@@ -585,13 +585,13 @@
ret=opus_multistream_encoder_ctl(st, OPUS_SET_BITRATE(bitrate));
if(ret!=OPUS_OK){
- fprintf(stderr,"OPUS_SET_BITRATE returned: %s\n",opus_strerror(ret));
+ fprintf(stderr,"Error OPUS_SET_BITRATE returned: %s\n",opus_strerror(ret));
exit(1);
}
ret=opus_multistream_encoder_ctl(st, OPUS_SET_VBR(!with_hard_cbr));
if(ret!=OPUS_OK){
- fprintf(stderr,"OPUS_SET_VBR returned: %s\n",opus_strerror(ret));
+ fprintf(stderr,"Error OPUS_SET_VBR returned: %s\n",opus_strerror(ret));
exit(1);
}
@@ -598,7 +598,7 @@
if(!with_hard_cbr){
ret=opus_multistream_encoder_ctl(st, OPUS_SET_VBR_CONSTRAINT(with_cvbr));
if(ret!=OPUS_OK){
- fprintf(stderr,"OPUS_SET_VBR_CONSTRAINT returned: %s\n",opus_strerror(ret));
+ fprintf(stderr,"Error OPUS_SET_VBR_CONSTRAINT returned: %s\n",opus_strerror(ret));
exit(1);
}
}
@@ -605,13 +605,13 @@
ret=opus_multistream_encoder_ctl(st, OPUS_SET_COMPLEXITY(complexity));
if(ret!=OPUS_OK){
- fprintf(stderr,"OPUS_SET_COMPLEXITY returned: %s\n",opus_strerror(ret));
+ fprintf(stderr,"Error OPUS_SET_COMPLEXITY returned: %s\n",opus_strerror(ret));
exit(1);
}
ret=opus_multistream_encoder_ctl(st, OPUS_SET_PACKET_LOSS_PERC(expect_loss));
if(ret!=OPUS_OK){
- fprintf(stderr,"OPUS_SET_PACKET_LOSS_PERC returned: %s\n",opus_strerror(ret));
+ fprintf(stderr,"Error OPUS_SET_PACKET_LOSS_PERC returned: %s\n",opus_strerror(ret));
exit(1);
}
@@ -618,8 +618,7 @@
#ifdef OPUS_SET_LSB_DEPTH
ret=opus_multistream_encoder_ctl(st, OPUS_SET_LSB_DEPTH(IMAX(8,IMIN(24,inopt.samplesize))));
if(ret!=OPUS_OK){
- fprintf(stderr,"OPUS_SET_LSB_DEPTH returned: %s\n",opus_strerror(ret));
- exit(1);
+ fprintf(stderr,"Warning OPUS_SET_LSB_DEPTH returned: %s\n",opus_strerror(ret));
}
#endif
@@ -629,7 +628,7 @@
if(target==-1){
ret=opus_multistream_encoder_ctl(st,opt_ctls_ctlval[i*3+1],opt_ctls_ctlval[i*3+2]);
if(ret!=OPUS_OK){
- fprintf(stderr,"opus_multistream_encoder_ctl(st,%d,%d) returned: %s\n",opt_ctls_ctlval[i*3+1],opt_ctls_ctlval[i*3+2],opus_strerror(ret));
+ fprintf(stderr,"Error opus_multistream_encoder_ctl(st,%d,%d) returned: %s\n",opt_ctls_ctlval[i*3+1],opt_ctls_ctlval[i*3+2],opus_strerror(ret));
exit(1);
}
}else if(target<header.nb_streams){
@@ -637,11 +636,11 @@
opus_multistream_encoder_ctl(st,OPUS_MULTISTREAM_GET_ENCODER_STATE(i,&oe));
ret=opus_encoder_ctl(oe, opt_ctls_ctlval[i*3+1],opt_ctls_ctlval[i*3+2]);
if(ret!=OPUS_OK){
- fprintf(stderr,"opus_encoder_ctl(st[%d],%d,%d) returned: %s\n",target,opt_ctls_ctlval[i*3+1],opt_ctls_ctlval[i*3+2],opus_strerror(ret));
+ fprintf(stderr,"Error opus_encoder_ctl(st[%d],%d,%d) returned: %s\n",target,opt_ctls_ctlval[i*3+1],opt_ctls_ctlval[i*3+2],opus_strerror(ret));
exit(1);
}
}else{
- fprintf(stderr,"--set-ctl-int target stream %d is higher than the maximum stream number %d.\n",target,header.nb_streams-1);
+ fprintf(stderr,"Error --set-ctl-int target stream %d is higher than the maximum stream number %d.\n",target,header.nb_streams-1);
exit(1);
}
}
@@ -649,7 +648,7 @@
/*We do the lookahead check late so user CTLs can change it*/
ret=opus_multistream_encoder_ctl(st, OPUS_GET_LOOKAHEAD(&lookahead));
if(ret!=OPUS_OK){
- fprintf(stderr,"OPUS_GET_LOOKAHEAD returned: %s\n",opus_strerror(ret));
+ fprintf(stderr,"Error OPUS_GET_LOOKAHEAD returned: %s\n",opus_strerror(ret));
exit(1);
}
inopt.skip+=lookahead;