blob: a62c6d7109ad7d6ddeabc23686194033dd5ef298 [file] [log] [blame]
Dmitry Kovalev37e6fd32014-02-05 18:34:46 -08001/*
2 * Copyright (c) 2014 The WebM project authors. All Rights Reserved.
3 *
4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree.
9 */
10
11#ifndef VIDEO_READER_H_
12#define VIDEO_READER_H_
13
14#include "./video_common.h"
15
16// The following code is work in progress. It is going to support transparent
17// reading of input files. Right now only IVF format is supported for
18// simplicity. The main goal the API is to be simple and easy to use in example
19// code and in vpxenc/vpxdec later. All low-level details like memory
20// buffer management are hidden from API users.
21struct VpxVideoReaderStruct;
22typedef struct VpxVideoReaderStruct VpxVideoReader;
23
24#ifdef __cplusplus
25extern "C" {
26#endif
27
28// Opens the input file for reading and inspects it to determine file type.
29// Returns an opaque VpxVideoReader* upon success, or NULL upon failure.
30// Right now only IVF format is supported.
31VpxVideoReader *vpx_video_reader_open(const char *filename);
32
33// Frees all resources associated with VpxVideoReader* returned from
34// vpx_video_reader_open() call.
35void vpx_video_reader_close(VpxVideoReader *reader);
36
37// Reads frame from the file and stores it in internal buffer.
38int vpx_video_reader_read_frame(VpxVideoReader *reader);
39
40// Returns the pointer to memory buffer with frame data read by last call to
41// vpx_video_reader_read_frame().
42const uint8_t *vpx_video_reader_get_frame(VpxVideoReader *reader,
43 size_t *size);
44
45// Fills VpxVideoInfo with information from opened video file.
46const VpxVideoInfo *vpx_video_reader_get_info(VpxVideoReader *reader);
47
48#ifdef __cplusplus
49} // extern "C"
50#endif
51
52#endif // VIDEO_READER_H_