xref: /aosp_15_r20/external/libgav1/src/status_code.cc (revision 095378508e87ed692bf8dfeb34008b65b3735891)
1*09537850SAkhilesh Sanikop // Copyright 2019 The libgav1 Authors
2*09537850SAkhilesh Sanikop //
3*09537850SAkhilesh Sanikop // Licensed under the Apache License, Version 2.0 (the "License");
4*09537850SAkhilesh Sanikop // you may not use this file except in compliance with the License.
5*09537850SAkhilesh Sanikop // You may obtain a copy of the License at
6*09537850SAkhilesh Sanikop //
7*09537850SAkhilesh Sanikop //      http://www.apache.org/licenses/LICENSE-2.0
8*09537850SAkhilesh Sanikop //
9*09537850SAkhilesh Sanikop // Unless required by applicable law or agreed to in writing, software
10*09537850SAkhilesh Sanikop // distributed under the License is distributed on an "AS IS" BASIS,
11*09537850SAkhilesh Sanikop // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12*09537850SAkhilesh Sanikop // See the License for the specific language governing permissions and
13*09537850SAkhilesh Sanikop // limitations under the License.
14*09537850SAkhilesh Sanikop 
15*09537850SAkhilesh Sanikop #include "src/gav1/status_code.h"
16*09537850SAkhilesh Sanikop 
17*09537850SAkhilesh Sanikop extern "C" {
18*09537850SAkhilesh Sanikop 
Libgav1GetErrorString(Libgav1StatusCode status)19*09537850SAkhilesh Sanikop const char* Libgav1GetErrorString(Libgav1StatusCode status) {
20*09537850SAkhilesh Sanikop   switch (status) {
21*09537850SAkhilesh Sanikop     case kLibgav1StatusOk:
22*09537850SAkhilesh Sanikop       return "Success.";
23*09537850SAkhilesh Sanikop     case kLibgav1StatusUnknownError:
24*09537850SAkhilesh Sanikop       return "Unknown error.";
25*09537850SAkhilesh Sanikop     case kLibgav1StatusInvalidArgument:
26*09537850SAkhilesh Sanikop       return "Invalid function argument.";
27*09537850SAkhilesh Sanikop     case kLibgav1StatusOutOfMemory:
28*09537850SAkhilesh Sanikop       return "Memory allocation failure.";
29*09537850SAkhilesh Sanikop     case kLibgav1StatusResourceExhausted:
30*09537850SAkhilesh Sanikop       return "Ran out of a resource (other than memory).";
31*09537850SAkhilesh Sanikop     case kLibgav1StatusNotInitialized:
32*09537850SAkhilesh Sanikop       return "The object is not initialized.";
33*09537850SAkhilesh Sanikop     case kLibgav1StatusAlready:
34*09537850SAkhilesh Sanikop       return "An operation that can only be performed once has already been "
35*09537850SAkhilesh Sanikop              "performed.";
36*09537850SAkhilesh Sanikop     case kLibgav1StatusUnimplemented:
37*09537850SAkhilesh Sanikop       return "Not implemented.";
38*09537850SAkhilesh Sanikop     case kLibgav1StatusInternalError:
39*09537850SAkhilesh Sanikop       return "Internal error in libgav1.";
40*09537850SAkhilesh Sanikop     case kLibgav1StatusBitstreamError:
41*09537850SAkhilesh Sanikop       return "The bitstream is not encoded correctly or violates a bitstream "
42*09537850SAkhilesh Sanikop              "conformance requirement.";
43*09537850SAkhilesh Sanikop     case kLibgav1StatusTryAgain:
44*09537850SAkhilesh Sanikop       return "The operation is not allowed at the moment. Try again later.";
45*09537850SAkhilesh Sanikop     case kLibgav1StatusNothingToDequeue:
46*09537850SAkhilesh Sanikop       return "There are no enqueued frames, so there is nothing to dequeue. "
47*09537850SAkhilesh Sanikop              "Try enqueuing a frame before trying to dequeue again.";
48*09537850SAkhilesh Sanikop     // This switch statement does not have a default case. This way the compiler
49*09537850SAkhilesh Sanikop     // will warn if we neglect to update this function after adding a new value
50*09537850SAkhilesh Sanikop     // to the Libgav1StatusCode enum type.
51*09537850SAkhilesh Sanikop     case kLibgav1StatusReservedForFutureExpansionUseDefaultInSwitchInstead_:
52*09537850SAkhilesh Sanikop       break;
53*09537850SAkhilesh Sanikop   }
54*09537850SAkhilesh Sanikop   return "Unrecognized status code.";
55*09537850SAkhilesh Sanikop }
56*09537850SAkhilesh Sanikop 
57*09537850SAkhilesh Sanikop }  // extern "C"
58