lbrandy / ffmpeg-fas

ffmpeg - Frame Accurate Seeking Extension - A library to accomplish frame-accurate seeking, and frame-counting, for video processing applications

ffmpeg-fas / ffmpeg_fas.h
170d3bca » lbrandy 2009-01-02 Transition from sourceforce... 1 /*****************************************************************************
2 * Copyright 2008. Pittsburgh Pattern Recognition, Inc.
3 *
4 * This file is part of the Frame Accurate Seeking extension library to
5 * ffmpeg (ffmpeg-fas).
6 *
7 * ffmpeg-fas is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU Lesser General Public License as published by
9 * the Free Software Foundation; either version 3 of the License, or (at your
10 * option) any later version.
11 *
12 * The ffmpeg-fas library is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
14 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
15 * License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public License
18 * along with the ffmpeg-fas library. If not, see <http://www.gnu.org/licenses/>.
19 *
20 ******************************************************************************/
21
22 #ifndef FFMPEG_FAS_H
23 #define FFMPEG_FAS_H
24
25 /* If C++ then we need to __extern "C". Compiler defines __cplusplus */
26 #ifdef __cplusplus
27 #define __extern extern "C"
28 #else
29 #define __extern extern
30 #endif
31
32 #include "seek_indices.h"
33
34
35 typedef enum
36 {
37 FAS_GRAY8 = 1,
38 FAS_RGB24 = 2,
39 FAS_BGR24 = 3,
40 FAS_ARGB32 = 4,
41 FAS_ABGR32 = 5,
42 FAS_YUV420P = 6,
43 FAS_YUYV422 = 7,
44 FAS_UYVY422 = 8,
45 FAS_YUV422P = 9,
46 FAS_YUV444P = 10,
47 } fas_color_space_type;
48
49 typedef struct
50 {
51 unsigned char *data;
52 int width;
53 int height;
54 int bytes_per_line;
55 fas_color_space_type color_space;
56 } fas_raw_image_type;
57
58
59 /**********************************************************************
60 * Video IO Types
61 **********************************************************************/
62
63 typedef struct fas_context_struct* fas_context_ref_type;
64
65 typedef enum
66 {
67 FAS_SUCCESS,
68 FAS_FAILURE,
69 FAS_INVALID_ARGUMENT,
70 FAS_OUT_OF_MEMORY,
71 FAS_UNSUPPORTED_FORMAT,
72 FAS_UNSUPPORTED_CODEC,
73 FAS_NO_MORE_FRAMES,
74 FAS_DECODING_ERROR,
75 FAS_SEEK_ERROR,
76 } fas_error_type;
77
78 typedef enum
79 {
80 FAS_FALSE = 0,
81 FAS_TRUE = 1
82 } fas_boolean_type;
83
84
85 __extern void fas_initialize (fas_boolean_type logging, fas_color_space_type format);
86 __extern void fas_set_format (fas_color_space_type format);
87
88 __extern fas_error_type fas_open_video (fas_context_ref_type *context_ptr, char *file_path);
89 __extern fas_error_type fas_close_video (fas_context_ref_type context);
90
91 __extern char* fas_error_message (fas_error_type error);
92
93 __extern fas_boolean_type fas_frame_available (fas_context_ref_type context);
94 __extern int fas_get_frame_index (fas_context_ref_type context);
95 __extern fas_error_type fas_step_forward (fas_context_ref_type context);
96
97 __extern fas_error_type fas_get_frame (fas_context_ref_type context, fas_raw_image_type *image_ptr);
98 __extern void fas_free_frame (fas_raw_image_type image);
99
100 __extern fas_error_type fas_seek_to_nearest_key (fas_context_ref_type context, int target_index);
101 __extern fas_error_type fas_seek_to_frame (fas_context_ref_type context, int target_index);
102
103 __extern int fas_get_frame_count (fas_context_ref_type context);
104 __extern int fas_get_frame_count_fast (fas_context_ref_type context);
105
106 __extern fas_error_type fas_put_seek_table (fas_context_ref_type context, seek_table_type table);
107 __extern seek_table_type fas_get_seek_table (fas_context_ref_type context);
108
109 /* will extract raw 420p if the video is in that format -- needs to be alloced ahead of time*/
110 __extern fas_error_type fas_fill_420p_ptrs (fas_context_ref_type context, unsigned char *y, unsigned char *u, unsigned char *v);
111
112 /* will extract gray8 data from movie (will convert to ensure you get it) -- need to be alloc'ed ahead of time*/
113 __extern fas_error_type fas_fill_gray8_ptr(fas_context_ref_type context, unsigned char *y);
114
115 __extern int fas_get_current_width(fas_context_ref_type context);
116 __extern int fas_get_current_height(fas_context_ref_type context);
117
118 __extern unsigned long long fas_get_frame_duration(fas_context_ref_type context);
119
120 #endif