FFmpeg
stereo3d.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2013 Vittorio Giovara <vittorio.giovara@gmail.com>
3  *
4  * This file is part of FFmpeg.
5  *
6  * FFmpeg is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * FFmpeg is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with FFmpeg; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19  */
20 
21 /**
22  * @file
23  * Stereoscopic video
24  */
25 
26 #ifndef AVUTIL_STEREO3D_H
27 #define AVUTIL_STEREO3D_H
28 
29 #include <stdint.h>
30 
31 #include "frame.h"
32 
33 /**
34  * @addtogroup lavu_video
35  * @{
36  *
37  * @defgroup lavu_video_stereo3d Stereo3D types and functions
38  * @{
39  */
40 
41 /**
42  * @addtogroup lavu_video_stereo3d
43  * A stereoscopic video file consists in multiple views embedded in a single
44  * frame, usually describing two views of a scene. This file describes all
45  * possible codec-independent view arrangements.
46  * */
47 
48 /**
49  * List of possible 3D Types
50  */
52  /**
53  * Video is not stereoscopic (and metadata has to be there).
54  */
56 
57  /**
58  * Views are next to each other.
59  *
60  * @code{.unparsed}
61  * LLLLRRRR
62  * LLLLRRRR
63  * LLLLRRRR
64  * ...
65  * @endcode
66  */
68 
69  /**
70  * Views are on top of each other.
71  *
72  * @code{.unparsed}
73  * LLLLLLLL
74  * LLLLLLLL
75  * RRRRRRRR
76  * RRRRRRRR
77  * @endcode
78  */
80 
81  /**
82  * Views are alternated temporally.
83  *
84  * @code{.unparsed}
85  * frame0 frame1 frame2 ...
86  * LLLLLLLL RRRRRRRR LLLLLLLL
87  * LLLLLLLL RRRRRRRR LLLLLLLL
88  * LLLLLLLL RRRRRRRR LLLLLLLL
89  * ... ... ...
90  * @endcode
91  */
93 
94  /**
95  * Views are packed in a checkerboard-like structure per pixel.
96  *
97  * @code{.unparsed}
98  * LRLRLRLR
99  * RLRLRLRL
100  * LRLRLRLR
101  * ...
102  * @endcode
103  */
105 
106  /**
107  * Views are next to each other, but when upscaling
108  * apply a checkerboard pattern.
109  *
110  * @code{.unparsed}
111  * LLLLRRRR L L L L R R R R
112  * LLLLRRRR => L L L L R R R R
113  * LLLLRRRR L L L L R R R R
114  * LLLLRRRR L L L L R R R R
115  * @endcode
116  */
118 
119  /**
120  * Views are packed per line, as if interlaced.
121  *
122  * @code{.unparsed}
123  * LLLLLLLL
124  * RRRRRRRR
125  * LLLLLLLL
126  * ...
127  * @endcode
128  */
130 
131  /**
132  * Views are packed per column.
133  *
134  * @code{.unparsed}
135  * LRLRLRLR
136  * LRLRLRLR
137  * LRLRLRLR
138  * ...
139  * @endcode
140  */
142 };
143 
144 /**
145  * List of possible view types.
146  */
148  /**
149  * Frame contains two packed views.
150  */
152 
153  /**
154  * Frame contains only the left view.
155  */
157 
158  /**
159  * Frame contains only the right view.
160  */
162 };
163 
164 /**
165  * Inverted views, Right/Bottom represents the left view.
166  */
167 #define AV_STEREO3D_FLAG_INVERT (1 << 0)
168 
169 /**
170  * Stereo 3D type: this structure describes how two videos are packed
171  * within a single video surface, with additional information as needed.
172  *
173  * @note The struct must be allocated with av_stereo3d_alloc() and
174  * its size is not a part of the public ABI.
175  */
176 typedef struct AVStereo3D {
177  /**
178  * How views are packed within the video.
179  */
181 
182  /**
183  * Additional information about the frame packing.
184  */
185  int flags;
186 
187  /**
188  * Determines which views are packed.
189  */
191 } AVStereo3D;
192 
193 /**
194  * Allocate an AVStereo3D structure and set its fields to default values.
195  * The resulting struct can be freed using av_freep().
196  *
197  * @return An AVStereo3D filled with default values or NULL on failure.
198  */
200 
201 /**
202  * Allocate a complete AVFrameSideData and add it to the frame.
203  *
204  * @param frame The frame which side data is added to.
205  *
206  * @return The AVStereo3D structure to be filled by caller.
207  */
209 
210 /**
211  * Provide a human-readable name of a given stereo3d type.
212  *
213  * @param type The input stereo3d type value.
214  *
215  * @return The name of the stereo3d value, or "unknown".
216  */
217 const char *av_stereo3d_type_name(unsigned int type);
218 
219 /**
220  * Get the AVStereo3DType form a human-readable name.
221  *
222  * @param name The input string.
223  *
224  * @return The AVStereo3DType value, or -1 if not found.
225  */
226 int av_stereo3d_from_name(const char *name);
227 
228 /**
229  * @}
230  * @}
231  */
232 
233 #endif /* AVUTIL_STEREO3D_H */
name
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this just let it vf default minimum maximum flags name is the option name
Definition: writing_filters.txt:88
AV_STEREO3D_VIEW_LEFT
@ AV_STEREO3D_VIEW_LEFT
Frame contains only the left view.
Definition: stereo3d.h:156
AV_STEREO3D_SIDEBYSIDE_QUINCUNX
@ AV_STEREO3D_SIDEBYSIDE_QUINCUNX
Views are next to each other, but when upscaling apply a checkerboard pattern.
Definition: stereo3d.h:117
AVFrame
This structure describes decoded (raw) audio or video data.
Definition: frame.h:317
AV_STEREO3D_VIEW_RIGHT
@ AV_STEREO3D_VIEW_RIGHT
Frame contains only the right view.
Definition: stereo3d.h:161
AV_STEREO3D_SIDEBYSIDE
@ AV_STEREO3D_SIDEBYSIDE
Views are next to each other.
Definition: stereo3d.h:67
AV_STEREO3D_VIEW_PACKED
@ AV_STEREO3D_VIEW_PACKED
Frame contains two packed views.
Definition: stereo3d.h:151
AV_STEREO3D_2D
@ AV_STEREO3D_2D
Video is not stereoscopic (and metadata has to be there).
Definition: stereo3d.h:55
type
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this just let it vf type
Definition: writing_filters.txt:86
AV_STEREO3D_FRAMESEQUENCE
@ AV_STEREO3D_FRAMESEQUENCE
Views are alternated temporally.
Definition: stereo3d.h:92
AV_STEREO3D_LINES
@ AV_STEREO3D_LINES
Views are packed per line, as if interlaced.
Definition: stereo3d.h:129
AVStereo3D::flags
int flags
Additional information about the frame packing.
Definition: stereo3d.h:185
AV_STEREO3D_CHECKERBOARD
@ AV_STEREO3D_CHECKERBOARD
Views are packed in a checkerboard-like structure per pixel.
Definition: stereo3d.h:104
frame.h
AV_STEREO3D_TOPBOTTOM
@ AV_STEREO3D_TOPBOTTOM
Views are on top of each other.
Definition: stereo3d.h:79
av_stereo3d_alloc
AVStereo3D * av_stereo3d_alloc(void)
Allocate an AVStereo3D structure and set its fields to default values.
Definition: stereo3d.c:28
frame
these buffered frames must be flushed immediately if a new input produces new the filter must not call request_frame to get more It must just process the frame or queue it The task of requesting more frames is left to the filter s request_frame method or the application If a filter has several the filter must be ready for frames arriving randomly on any input any filter with several inputs will most likely require some kind of queuing mechanism It is perfectly acceptable to have a limited queue and to drop frames when the inputs are too unbalanced request_frame For filters that do not use the this method is called when a frame is wanted on an output For a it should directly call filter_frame on the corresponding output For a if there are queued frames already one of these frames should be pushed If the filter should request a frame on one of its repeatedly until at least one frame has been pushed Return or at least make progress towards producing a frame
Definition: filter_design.txt:264
AV_STEREO3D_COLUMNS
@ AV_STEREO3D_COLUMNS
Views are packed per column.
Definition: stereo3d.h:141
AVStereo3D::type
enum AVStereo3DType type
How views are packed within the video.
Definition: stereo3d.h:180
av_stereo3d_create_side_data
AVStereo3D * av_stereo3d_create_side_data(AVFrame *frame)
Allocate a complete AVFrameSideData and add it to the frame.
Definition: stereo3d.c:33
AVStereo3D::view
enum AVStereo3DView view
Determines which views are packed.
Definition: stereo3d.h:190
AVStereo3DView
AVStereo3DView
List of possible view types.
Definition: stereo3d.h:147
AVStereo3DType
AVStereo3DType
List of possible 3D Types.
Definition: stereo3d.h:51
av_stereo3d_type_name
const char * av_stereo3d_type_name(unsigned int type)
Provide a human-readable name of a given stereo3d type.
Definition: stereo3d.c:57
AVStereo3D
Stereo 3D type: this structure describes how two videos are packed within a single video surface,...
Definition: stereo3d.h:176
av_stereo3d_from_name
int av_stereo3d_from_name(const char *name)
Get the AVStereo3DType form a human-readable name.
Definition: stereo3d.c:65