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