Merge "Fix intra mode update process in vp9_pick_inter_mode"
[aom.git] / webmdec.h
blob29b815da12501f039a538622a8cfb3d7c6914cad
1 /*
2 * Copyright (c) 2013 The WebM project authors. All Rights Reserved.
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 WEBMDEC_H_
11 #define WEBMDEC_H_
13 #include "./tools_common.h"
15 #ifdef __cplusplus
16 extern "C" {
17 #endif
19 struct VpxInputContext;
21 struct WebmInputContext {
22 void *reader;
23 void *segment;
24 uint8_t *buffer;
25 const void *cluster;
26 const void *block_entry;
27 const void *block;
28 int block_frame_index;
29 int video_track_index;
30 uint64_t timestamp_ns;
33 // Checks if the input is a WebM file. If so, initializes WebMInputContext so
34 // that webm_read_frame can be called to retrieve a video frame.
35 // Returns 1 on success and 0 on failure or input is not WebM file.
36 // TODO(vigneshv): Refactor this function into two smaller functions specific
37 // to their task.
38 int file_is_webm(struct WebmInputContext *webm_ctx,
39 struct VpxInputContext *vpx_ctx);
41 // Reads a WebM Video Frame. Memory for the buffer is created, owned and managed
42 // by this function. For the first call, |buffer| should be NULL and
43 // |*bytes_in_buffer| should be 0. Once all the frames are read and used,
44 // webm_free() should be called, otherwise there will be a leak.
45 // Parameters:
46 // webm_ctx - WebmInputContext object
47 // buffer - pointer where the frame data will be filled.
48 // bytes_in_buffer - pointer to buffer size.
49 // buffer_size - unused TODO(vigneshv): remove this
50 // Return values:
51 // 0 - Success
52 // 1 - End of Stream
53 // -1 - Error
54 // TODO(vigneshv): Make the return values consistent across all functions in
55 // this file.
56 int webm_read_frame(struct WebmInputContext *webm_ctx,
57 uint8_t **buffer,
58 size_t *bytes_in_buffer,
59 size_t *buffer_size);
61 // Guesses the frame rate of the input file based on the container timestamps.
62 int webm_guess_framerate(struct WebmInputContext *webm_ctx,
63 struct VpxInputContext *vpx_ctx);
65 // Resets the WebMInputContext.
66 void webm_free(struct WebmInputContext *webm_ctx);
68 #ifdef __cplusplus
69 } // extern "C"
70 #endif
72 #endif // WEBMDEC_H_