OLD | NEW |
1 /* Copyright (c) 2010 Xiph.Org Foundation, Skype Limited | 1 /* Copyright (c) 2010 Xiph.Org Foundation, Skype Limited |
2 Written by Jean-Marc Valin and Koen Vos */ | 2 Written by Jean-Marc Valin and Koen Vos */ |
3 /* | 3 /* |
4 Redistribution and use in source and binary forms, with or without | 4 Redistribution and use in source and binary forms, with or without |
5 modification, are permitted provided that the following conditions | 5 modification, are permitted provided that the following conditions |
6 are met: | 6 are met: |
7 | 7 |
8 - Redistributions of source code must retain the above copyright | 8 - Redistributions of source code must retain the above copyright |
9 notice, this list of conditions and the following disclaimer. | 9 notice, this list of conditions and the following disclaimer. |
10 | 10 |
(...skipping 873 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
884 opus_int32 value = va_arg(ap, opus_int32); | 884 opus_int32 value = va_arg(ap, opus_int32); |
885 if (value<-32768 || value>32767) | 885 if (value<-32768 || value>32767) |
886 { | 886 { |
887 goto bad_arg; | 887 goto bad_arg; |
888 } | 888 } |
889 st->decode_gain = value; | 889 st->decode_gain = value; |
890 } | 890 } |
891 break; | 891 break; |
892 case OPUS_GET_LAST_PACKET_DURATION_REQUEST: | 892 case OPUS_GET_LAST_PACKET_DURATION_REQUEST: |
893 { | 893 { |
894 opus_uint32 *value = va_arg(ap, opus_uint32*); | 894 opus_int32 *value = va_arg(ap, opus_int32*); |
895 if (!value) | 895 if (!value) |
896 { | 896 { |
897 goto bad_arg; | 897 goto bad_arg; |
898 } | 898 } |
899 *value = st->last_packet_duration; | 899 *value = st->last_packet_duration; |
900 } | 900 } |
901 break; | 901 break; |
| 902 case OPUS_SET_PHASE_INVERSION_DISABLED_REQUEST: |
| 903 { |
| 904 opus_int32 value = va_arg(ap, opus_int32); |
| 905 if(value<0 || value>1) |
| 906 { |
| 907 goto bad_arg; |
| 908 } |
| 909 celt_decoder_ctl(celt_dec, OPUS_SET_PHASE_INVERSION_DISABLED(value)); |
| 910 } |
| 911 break; |
| 912 case OPUS_GET_PHASE_INVERSION_DISABLED_REQUEST: |
| 913 { |
| 914 opus_int32 *value = va_arg(ap, opus_int32*); |
| 915 if (!value) |
| 916 { |
| 917 goto bad_arg; |
| 918 } |
| 919 celt_decoder_ctl(celt_dec, OPUS_GET_PHASE_INVERSION_DISABLED(value)); |
| 920 } |
| 921 break; |
902 default: | 922 default: |
903 /*fprintf(stderr, "unknown opus_decoder_ctl() request: %d", request);*/ | 923 /*fprintf(stderr, "unknown opus_decoder_ctl() request: %d", request);*/ |
904 ret = OPUS_UNIMPLEMENTED; | 924 ret = OPUS_UNIMPLEMENTED; |
905 break; | 925 break; |
906 } | 926 } |
907 | 927 |
908 va_end(ap); | 928 va_end(ap); |
909 return ret; | 929 return ret; |
910 bad_arg: | 930 bad_arg: |
911 va_end(ap); | 931 va_end(ap); |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
972 return OPUS_INVALID_PACKET; | 992 return OPUS_INVALID_PACKET; |
973 else | 993 else |
974 return samples; | 994 return samples; |
975 } | 995 } |
976 | 996 |
977 int opus_decoder_get_nb_samples(const OpusDecoder *dec, | 997 int opus_decoder_get_nb_samples(const OpusDecoder *dec, |
978 const unsigned char packet[], opus_int32 len) | 998 const unsigned char packet[], opus_int32 len) |
979 { | 999 { |
980 return opus_packet_get_nb_samples(packet, len, dec->Fs); | 1000 return opus_packet_get_nb_samples(packet, len, dec->Fs); |
981 } | 1001 } |
OLD | NEW |