Merge "Cleaning up motion compensation code."
[platform/upstream/libvpx.git] / ivfdec.h
1 /*
2  *  Copyright (c) 2013 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 #ifndef IVFDEC_H_
11 #define IVFDEC_H_
12
13 #include "./tools_common.h"
14
15 #ifdef __cplusplus
16 extern "C" {
17 #endif
18
19 int file_is_ivf(struct VpxInputContext *input);
20
21 int ivf_read_frame(FILE *infile, uint8_t **buffer,
22                    size_t *bytes_read, size_t *buffer_size);
23
24 // The following code is work in progress. It is going to be in a separate file
25 // and support transparent reading of IVF and Y4M formats. Right now only IVF
26 // format is supported for simplicity. The main goal the API is to be
27 // simple and easy to use in example code (and probably in vpxenc/vpxdec later).
28 // All low-level details like memory buffer management are hidden from API
29 // users.
30 struct vpx_video;
31 typedef struct vpx_video vpx_video_t;
32
33 // Opens the input file and inspects it to determine file type. Returns an
34 // opaque vpx_video_t* upon success, or NULL upon failure.
35 vpx_video_t *vpx_video_open_file(FILE *file);
36
37 // Frees all resources associated with vpx_video_t returned from
38 // vpx_video_open_file() call
39 void vpx_video_close(vpx_video_t *video);
40
41 int vpx_video_get_width(vpx_video_t *video);
42 int vpx_video_get_height(vpx_video_t *video);
43 unsigned int vpx_video_get_fourcc(vpx_video_t *video);
44
45 // Reads video frame bytes from the file and stores them into internal buffer.
46 int vpx_video_read_frame(vpx_video_t *video);
47
48 // Returns the pointer to internal memory buffer with frame bytes read from
49 // last call to vpx_video_read_frame().
50 const unsigned char *vpx_video_get_frame(vpx_video_t *video, size_t *size);
51
52 #ifdef __cplusplus
53 }  /* extern "C" */
54 #endif
55
56 #endif  // IVFDEC_H_