parse_result.h 1.1 KB

12345678910111213141516171819202122232425262728293031
  1. // Copyright 2017 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. #ifndef MEDIA_FORMATS_MP4_PARSE_RESULT_H_
  5. #define MEDIA_FORMATS_MP4_PARSE_RESULT_H_
  6. namespace media {
  7. namespace mp4 {
  8. enum class ParseResult {
  9. kOk, // Parsing was successful.
  10. kError, // The data is invalid (usually unrecoverable).
  11. kNeedMoreData, // More data is required to parse successfully.
  12. };
  13. // Evaluate |expr| once. If the result is not ParseResult::kOk, (early) return
  14. // it from the containing function.
  15. #define RCHECK_OK_PARSE_RESULT(expr) \
  16. do { \
  17. ::media::mp4::ParseResult result = (expr); \
  18. if (result == ::media::mp4::ParseResult::kError) \
  19. DLOG(ERROR) << "Failure while parsing MP4: " #expr; \
  20. if (result != ::media::mp4::ParseResult::kOk) \
  21. return result; \
  22. } while (0)
  23. } // namespace mp4
  24. } // namespace media
  25. #endif // MEDIA_FORMATS_MP4_PARSE_RESULT_H_