video_reader.h 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. /*
  2. * Copyright (c) 2016, Alliance for Open Media. All rights reserved
  3. *
  4. * This source code is subject to the terms of the BSD 2 Clause License and
  5. * the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License
  6. * was not distributed with this source code in the LICENSE file, you can
  7. * obtain it at www.aomedia.org/license/software. If the Alliance for Open
  8. * Media Patent License 1.0 was not distributed with this source code in the
  9. * PATENTS file, you can obtain it at www.aomedia.org/license/patent.
  10. */
  11. #ifndef AOM_COMMON_VIDEO_READER_H_
  12. #define AOM_COMMON_VIDEO_READER_H_
  13. #include "common/video_common.h"
  14. // The following code is work in progress. It is going to support transparent
  15. // reading of input files. Right now only IVF format is supported for
  16. // simplicity. The main goal the API is to be simple and easy to use in example
  17. // code and in aomenc/aomdec later. All low-level details like memory
  18. // buffer management are hidden from API users.
  19. struct AvxVideoReaderStruct;
  20. typedef struct AvxVideoReaderStruct AvxVideoReader;
  21. #ifdef __cplusplus
  22. extern "C" {
  23. #endif
  24. // Opens the input file for reading and inspects it to determine file type.
  25. // Returns an opaque AvxVideoReader* upon success, or NULL upon failure.
  26. // Right now only IVF format is supported.
  27. AvxVideoReader *aom_video_reader_open(const char *filename);
  28. // Frees all resources associated with AvxVideoReader* returned from
  29. // aom_video_reader_open() call.
  30. void aom_video_reader_close(AvxVideoReader *reader);
  31. // Reads frame from the file and stores it in internal buffer.
  32. int aom_video_reader_read_frame(AvxVideoReader *reader);
  33. // Returns the pointer to memory buffer with frame data read by last call to
  34. // aom_video_reader_read_frame().
  35. const uint8_t *aom_video_reader_get_frame(AvxVideoReader *reader, size_t *size);
  36. // Returns the pts of the frame.
  37. int64_t aom_video_reader_get_frame_pts(AvxVideoReader *reader);
  38. // Return the reader file.
  39. FILE *aom_video_reader_get_file(AvxVideoReader *reader);
  40. // Fills AvxVideoInfo with information from opened video file.
  41. const AvxVideoInfo *aom_video_reader_get_info(AvxVideoReader *reader);
  42. // Set fourcc.
  43. void aom_video_reader_set_fourcc(AvxVideoReader *reader, uint32_t fourcc);
  44. #ifdef __cplusplus
  45. } // extern "C"
  46. #endif
  47. #endif // AOM_COMMON_VIDEO_READER_H_