Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(232)

Side by Side Diff: third_party/ffmpeg/include/libavcodec/avcodec.h

Issue 56129: Update public FFmpeg header files from r16647 to r18286. (Closed)
Patch Set: Created 11 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « third_party/ffmpeg/generate_libs.bat ('k') | third_party/ffmpeg/include/libavcodec/opt.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * copyright (c) 2001 Fabrice Bellard 2 * copyright (c) 2001 Fabrice Bellard
3 * 3 *
4 * This file is part of FFmpeg. 4 * This file is part of FFmpeg.
5 * 5 *
6 * FFmpeg is free software; you can redistribute it and/or 6 * FFmpeg is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public 7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either 8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version. 9 * version 2.1 of the License, or (at your option) any later version.
10 * 10 *
11 * FFmpeg is distributed in the hope that it will be useful, 11 * FFmpeg is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details. 14 * Lesser General Public License for more details.
15 * 15 *
16 * You should have received a copy of the GNU Lesser General Public 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 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 18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 */ 19 */
20 20
21 #ifndef AVCODEC_AVCODEC_H 21 #ifndef AVCODEC_AVCODEC_H
22 #define AVCODEC_AVCODEC_H 22 #define AVCODEC_AVCODEC_H
23 23
24 /** 24 /**
25 * @file avcodec.h 25 * @file libavcodec/avcodec.h
26 * external API header 26 * external API header
27 */ 27 */
28 28
29 29 #include <errno.h>
30 #include "libavutil/avutil.h" 30 #include "libavutil/avutil.h"
31 31
32 #define LIBAVCODEC_VERSION_MAJOR 52 32 #define LIBAVCODEC_VERSION_MAJOR 52
33 #define LIBAVCODEC_VERSION_MINOR 10 33 #define LIBAVCODEC_VERSION_MINOR 22
34 #define LIBAVCODEC_VERSION_MICRO 0 34 #define LIBAVCODEC_VERSION_MICRO 3
35 35
36 #define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \ 36 #define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
37 LIBAVCODEC_VERSION_MINOR, \ 37 LIBAVCODEC_VERSION_MINOR, \
38 LIBAVCODEC_VERSION_MICRO) 38 LIBAVCODEC_VERSION_MICRO)
39 #define LIBAVCODEC_VERSION AV_VERSION(LIBAVCODEC_VERSION_MAJOR, \ 39 #define LIBAVCODEC_VERSION AV_VERSION(LIBAVCODEC_VERSION_MAJOR, \
40 LIBAVCODEC_VERSION_MINOR, \ 40 LIBAVCODEC_VERSION_MINOR, \
41 LIBAVCODEC_VERSION_MICRO) 41 LIBAVCODEC_VERSION_MICRO)
42 #define LIBAVCODEC_BUILD LIBAVCODEC_VERSION_INT 42 #define LIBAVCODEC_BUILD LIBAVCODEC_VERSION_INT
43 43
44 #define LIBAVCODEC_IDENT "Lavc" AV_STRINGIFY(LIBAVCODEC_VERSION) 44 #define LIBAVCODEC_IDENT "Lavc" AV_STRINGIFY(LIBAVCODEC_VERSION)
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 CODEC_ID_RL2, 183 CODEC_ID_RL2,
184 CODEC_ID_8SVX_EXP, 184 CODEC_ID_8SVX_EXP,
185 CODEC_ID_8SVX_FIB, 185 CODEC_ID_8SVX_FIB,
186 CODEC_ID_ESCAPE124, 186 CODEC_ID_ESCAPE124,
187 CODEC_ID_DIRAC, 187 CODEC_ID_DIRAC,
188 CODEC_ID_BFI, 188 CODEC_ID_BFI,
189 CODEC_ID_CMV, 189 CODEC_ID_CMV,
190 CODEC_ID_MOTIONPIXELS, 190 CODEC_ID_MOTIONPIXELS,
191 CODEC_ID_TGV, 191 CODEC_ID_TGV,
192 CODEC_ID_TGQ, 192 CODEC_ID_TGQ,
193 193 CODEC_ID_TQI,
194 /* "codecs" for HW decoding with VDPAU */ 194 CODEC_ID_AURA,
195 CODEC_ID_H264_VDPAU= 0x9000, 195 CODEC_ID_AURA2,
196 196
197 /* various PCM "codecs" */ 197 /* various PCM "codecs" */
198 CODEC_ID_PCM_S16LE= 0x10000, 198 CODEC_ID_PCM_S16LE= 0x10000,
199 CODEC_ID_PCM_S16BE, 199 CODEC_ID_PCM_S16BE,
200 CODEC_ID_PCM_U16LE, 200 CODEC_ID_PCM_U16LE,
201 CODEC_ID_PCM_U16BE, 201 CODEC_ID_PCM_U16BE,
202 CODEC_ID_PCM_S8, 202 CODEC_ID_PCM_S8,
203 CODEC_ID_PCM_U8, 203 CODEC_ID_PCM_U8,
204 CODEC_ID_PCM_MULAW, 204 CODEC_ID_PCM_MULAW,
205 CODEC_ID_PCM_ALAW, 205 CODEC_ID_PCM_ALAW,
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
241 CODEC_ID_ADPCM_SBPRO_2, 241 CODEC_ID_ADPCM_SBPRO_2,
242 CODEC_ID_ADPCM_THP, 242 CODEC_ID_ADPCM_THP,
243 CODEC_ID_ADPCM_IMA_AMV, 243 CODEC_ID_ADPCM_IMA_AMV,
244 CODEC_ID_ADPCM_EA_R1, 244 CODEC_ID_ADPCM_EA_R1,
245 CODEC_ID_ADPCM_EA_R3, 245 CODEC_ID_ADPCM_EA_R3,
246 CODEC_ID_ADPCM_EA_R2, 246 CODEC_ID_ADPCM_EA_R2,
247 CODEC_ID_ADPCM_IMA_EA_SEAD, 247 CODEC_ID_ADPCM_IMA_EA_SEAD,
248 CODEC_ID_ADPCM_IMA_EA_EACS, 248 CODEC_ID_ADPCM_IMA_EA_EACS,
249 CODEC_ID_ADPCM_EA_XAS, 249 CODEC_ID_ADPCM_EA_XAS,
250 CODEC_ID_ADPCM_EA_MAXIS_XA, 250 CODEC_ID_ADPCM_EA_MAXIS_XA,
251 CODEC_ID_ADPCM_IMA_ISS,
251 252
252 /* AMR */ 253 /* AMR */
253 CODEC_ID_AMR_NB= 0x12000, 254 CODEC_ID_AMR_NB= 0x12000,
254 CODEC_ID_AMR_WB, 255 CODEC_ID_AMR_WB,
255 256
256 /* RealAudio codecs*/ 257 /* RealAudio codecs*/
257 CODEC_ID_RA_144= 0x13000, 258 CODEC_ID_RA_144= 0x13000,
258 CODEC_ID_RA_288, 259 CODEC_ID_RA_288,
259 260
260 /* various DPCM codecs */ 261 /* various DPCM codecs */
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
303 CODEC_ID_NELLYMOSER, 304 CODEC_ID_NELLYMOSER,
304 CODEC_ID_MUSEPACK8, 305 CODEC_ID_MUSEPACK8,
305 CODEC_ID_SPEEX, 306 CODEC_ID_SPEEX,
306 CODEC_ID_WMAVOICE, 307 CODEC_ID_WMAVOICE,
307 CODEC_ID_WMAPRO, 308 CODEC_ID_WMAPRO,
308 CODEC_ID_WMALOSSLESS, 309 CODEC_ID_WMALOSSLESS,
309 CODEC_ID_ATRAC3P, 310 CODEC_ID_ATRAC3P,
310 CODEC_ID_EAC3, 311 CODEC_ID_EAC3,
311 CODEC_ID_SIPR, 312 CODEC_ID_SIPR,
312 CODEC_ID_MP1, 313 CODEC_ID_MP1,
314 CODEC_ID_TWINVQ,
315 CODEC_ID_TRUEHD,
313 316
314 /* subtitle codecs */ 317 /* subtitle codecs */
315 CODEC_ID_DVD_SUBTITLE= 0x17000, 318 CODEC_ID_DVD_SUBTITLE= 0x17000,
316 CODEC_ID_DVB_SUBTITLE, 319 CODEC_ID_DVB_SUBTITLE,
317 CODEC_ID_TEXT, ///< raw UTF-8 text 320 CODEC_ID_TEXT, ///< raw UTF-8 text
318 CODEC_ID_XSUB, 321 CODEC_ID_XSUB,
319 CODEC_ID_SSA, 322 CODEC_ID_SSA,
320 CODEC_ID_MOV_TEXT, 323 CODEC_ID_MOV_TEXT,
321 324
322 /* other specific kind of codecs (generally used for attachments) */ 325 /* other specific kind of codecs (generally used for attachments) */
(...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after
652 * Set to INT_MAX if the buffer has not been used yet.\ 655 * Set to INT_MAX if the buffer has not been used yet.\
653 * - encoding: unused\ 656 * - encoding: unused\
654 * - decoding: MUST be set by get_buffer().\ 657 * - decoding: MUST be set by get_buffer().\
655 */\ 658 */\
656 int age;\ 659 int age;\
657 \ 660 \
658 /**\ 661 /**\
659 * is this picture used as reference\ 662 * is this picture used as reference\
660 * The values for this are the same as the MpegEncContext.picture_structure\ 663 * The values for this are the same as the MpegEncContext.picture_structure\
661 * variable, that is 1->top field, 2->bottom field, 3->frame/both fields.\ 664 * variable, that is 1->top field, 2->bottom field, 3->frame/both fields.\
665 * Set to 4 for delayed, non-reference frames.\
662 * - encoding: unused\ 666 * - encoding: unused\
663 * - decoding: Set by libavcodec. (before get_buffer() call)).\ 667 * - decoding: Set by libavcodec. (before get_buffer() call)).\
664 */\ 668 */\
665 int reference;\ 669 int reference;\
666 \ 670 \
667 /**\ 671 /**\
668 * QP table\ 672 * QP table\
669 * - encoding: unused\ 673 * - encoding: unused\
670 * - decoding: Set by libavcodec.\ 674 * - decoding: Set by libavcodec.\
671 */\ 675 */\
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
799 */\ 803 */\
800 int8_t *ref_index[2];\ 804 int8_t *ref_index[2];\
801 \ 805 \
802 /**\ 806 /**\
803 * reordered opaque 64bit number (generally a PTS) from AVCodecContext.reord ered_opaque\ 807 * reordered opaque 64bit number (generally a PTS) from AVCodecContext.reord ered_opaque\
804 * output in AVFrame.reordered_opaque\ 808 * output in AVFrame.reordered_opaque\
805 * - encoding: unused\ 809 * - encoding: unused\
806 * - decoding: Read by user.\ 810 * - decoding: Read by user.\
807 */\ 811 */\
808 int64_t reordered_opaque;\ 812 int64_t reordered_opaque;\
813 \
814 /**\
815 * hardware accelerator private data (FFmpeg allocated)\
816 * - encoding: unused\
817 * - decoding: Set by libavcodec\
818 */\
819 void *hwaccel_picture_private;\
809 820
810 821
811 #define FF_QSCALE_TYPE_MPEG1 0 822 #define FF_QSCALE_TYPE_MPEG1 0
812 #define FF_QSCALE_TYPE_MPEG2 1 823 #define FF_QSCALE_TYPE_MPEG2 1
813 #define FF_QSCALE_TYPE_H264 2 824 #define FF_QSCALE_TYPE_H264 2
814 825
815 #define FF_BUFFER_TYPE_INTERNAL 1 826 #define FF_BUFFER_TYPE_INTERNAL 1
816 #define FF_BUFFER_TYPE_USER 2 ///< direct rendering buffers (image is (de)al located by user) 827 #define FF_BUFFER_TYPE_USER 2 ///< direct rendering buffers (image is (de)al located by user)
817 #define FF_BUFFER_TYPE_SHARED 4 ///< Buffer from somewhere else; don't dealloc ate image (data/base), all other tables are not shared. 828 #define FF_BUFFER_TYPE_SHARED 4 ///< Buffer from somewhere else; don't dealloc ate image (data/base), all other tables are not shared.
818 #define FF_BUFFER_TYPE_COPY 8 ///< Just a (modified) copy of some other buff er, don't deallocate anything. 829 #define FF_BUFFER_TYPE_COPY 8 ///< Just a (modified) copy of some other buff er, don't deallocate anything.
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
954 * - encoding: Set by user. 965 * - encoding: Set by user.
955 * - decoding: unused 966 * - decoding: unused
956 */ 967 */
957 int rate_emu; 968 int rate_emu;
958 969
959 /** 970 /**
960 * If non NULL, 'draw_horiz_band' is called by the libavcodec 971 * If non NULL, 'draw_horiz_band' is called by the libavcodec
961 * decoder to draw a horizontal band. It improves cache usage. Not 972 * decoder to draw a horizontal band. It improves cache usage. Not
962 * all codecs can do that. You must check the codec capabilities 973 * all codecs can do that. You must check the codec capabilities
963 * beforehand. 974 * beforehand.
975 * The function is also used by hardware acceleration APIs.
976 * It is called at least once during frame decoding to pass
977 * the data needed for hardware render.
978 * In that mode instead of pixel data, AVFrame points to
979 * a structure specific to the acceleration API. The application
980 * reads the structure and can change some fields to indicate progress
981 * or mark state.
964 * - encoding: unused 982 * - encoding: unused
965 * - decoding: Set by user. 983 * - decoding: Set by user.
966 * @param height the height of the slice 984 * @param height the height of the slice
967 * @param y the y position of the slice 985 * @param y the y position of the slice
968 * @param type 1->top field, 2->bottom field, 3->frame 986 * @param type 1->top field, 2->bottom field, 3->frame
969 * @param offset offset into the AVFrame.data from which the slice should be read 987 * @param offset offset into the AVFrame.data from which the slice should be read
970 */ 988 */
971 void (*draw_horiz_band)(struct AVCodecContext *s, 989 void (*draw_horiz_band)(struct AVCodecContext *s,
972 const AVFrame *src, int offset[4], 990 const AVFrame *src, int offset[4],
973 int y, int type, int height); 991 int y, int type, int height);
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after
1206 /** 1224 /**
1207 * Called to release buffers which were allocated with get_buffer. 1225 * Called to release buffers which were allocated with get_buffer.
1208 * A released buffer can be reused in get_buffer(). 1226 * A released buffer can be reused in get_buffer().
1209 * pic.data[*] must be set to NULL. 1227 * pic.data[*] must be set to NULL.
1210 * - encoding: unused 1228 * - encoding: unused
1211 * - decoding: Set by libavcodec., user can override. 1229 * - decoding: Set by libavcodec., user can override.
1212 */ 1230 */
1213 void (*release_buffer)(struct AVCodecContext *c, AVFrame *pic); 1231 void (*release_buffer)(struct AVCodecContext *c, AVFrame *pic);
1214 1232
1215 /** 1233 /**
1216 * If 1 the stream has a 1 frame delay during decoding. 1234 * Size of the frame reordering buffer in the decoder.
1235 * For MPEG-2 it is 1 IPB or 0 low delay IP.
1217 * - encoding: Set by libavcodec. 1236 * - encoding: Set by libavcodec.
1218 * - decoding: Set by libavcodec. 1237 * - decoding: Set by libavcodec.
1219 */ 1238 */
1220 int has_b_frames; 1239 int has_b_frames;
1221 1240
1222 /** 1241 /**
1223 * number of bytes per packet if constant and known or 0 1242 * number of bytes per packet if constant and known or 0
1224 * Used by some WAV based audio codecs. 1243 * Used by some WAV based audio codecs.
1225 */ 1244 */
1226 int block_align; 1245 int block_align;
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
1393 #define FF_IDCT_IPP 13 1412 #define FF_IDCT_IPP 13
1394 #define FF_IDCT_XVIDMMX 14 1413 #define FF_IDCT_XVIDMMX 14
1395 #define FF_IDCT_CAVS 15 1414 #define FF_IDCT_CAVS 15
1396 #define FF_IDCT_SIMPLEARMV5TE 16 1415 #define FF_IDCT_SIMPLEARMV5TE 16
1397 #define FF_IDCT_SIMPLEARMV6 17 1416 #define FF_IDCT_SIMPLEARMV6 17
1398 #define FF_IDCT_SIMPLEVIS 18 1417 #define FF_IDCT_SIMPLEVIS 18
1399 #define FF_IDCT_WMV2 19 1418 #define FF_IDCT_WMV2 19
1400 #define FF_IDCT_FAAN 20 1419 #define FF_IDCT_FAAN 20
1401 #define FF_IDCT_EA 21 1420 #define FF_IDCT_EA 21
1402 #define FF_IDCT_SIMPLENEON 22 1421 #define FF_IDCT_SIMPLENEON 22
1422 #define FF_IDCT_SIMPLEALPHA 23
1403 1423
1404 /** 1424 /**
1405 * slice count 1425 * slice count
1406 * - encoding: Set by libavcodec. 1426 * - encoding: Set by libavcodec.
1407 * - decoding: Set by user (or 0). 1427 * - decoding: Set by user (or 0).
1408 */ 1428 */
1409 int slice_count; 1429 int slice_count;
1410 /** 1430 /**
1411 * slice offsets in the frame in bytes 1431 * slice offsets in the frame in bytes
1412 * - encoding: Set/allocated by libavcodec. 1432 * - encoding: Set/allocated by libavcodec.
(...skipping 887 matching lines...) Expand 10 before | Expand all | Expand 10 after
2300 * - decoding: unused. 2320 * - decoding: unused.
2301 */ 2321 */
2302 float rc_max_available_vbv_use; 2322 float rc_max_available_vbv_use;
2303 2323
2304 /** 2324 /**
2305 * Ratecontrol attempt to use, at least, <value> times the amount needed to prevent a vbv overflow. 2325 * Ratecontrol attempt to use, at least, <value> times the amount needed to prevent a vbv overflow.
2306 * - encoding: Set by user. 2326 * - encoding: Set by user.
2307 * - decoding: unused. 2327 * - decoding: unused.
2308 */ 2328 */
2309 float rc_min_vbv_overflow_use; 2329 float rc_min_vbv_overflow_use;
2330
2331 /**
2332 * Hardware accelerator in use
2333 * - encoding: unused.
2334 * - decoding: Set by libavcodec
2335 */
2336 struct AVHWAccel *hwaccel;
2337
2338 /**
2339 * For some codecs, the time base is closer to the field rate than the frame rate.
2340 * Most notably, H.264 and MPEG-2 specify time_base as half of frame duratio n
2341 * if no telecine is used ...
2342 *
2343 * Set to time_base ticks per frame. Default 1, e.g., H.264/MPEG-2 set it to 2.
2344 */
2345 int ticks_per_frame;
2346
2347 /**
2348 * Hardware accelerator context.
2349 * For some hardware accelerators, a global context needs to be
2350 * provided by the user. In that case, this holds display-dependent
2351 * data FFmpeg cannot instantiate itself. Please refer to the
2352 * FFmpeg HW accelerator documentation to know how to fill this
2353 * is. e.g. for VA API, this is a struct vaapi_context.
2354 * - encoding: unused
2355 * - decoding: Set by user
2356 */
2357 void *hwaccel_context;
2310 } AVCodecContext; 2358 } AVCodecContext;
2311 2359
2312 /** 2360 /**
2313 * AVCodec. 2361 * AVCodec.
2314 */ 2362 */
2315 typedef struct AVCodec { 2363 typedef struct AVCodec {
2316 /** 2364 /**
2317 * Name of the codec implementation. 2365 * Name of the codec implementation.
2318 * The name is globally unique among encoders and among decoders (but an 2366 * The name is globally unique among encoders and among decoders (but an
2319 * encoder and a decoder can share the same name). 2367 * encoder and a decoder can share the same name).
(...skipping 25 matching lines...) Expand all
2345 * Descriptive name for the codec, meant to be more human readable than \p n ame. 2393 * Descriptive name for the codec, meant to be more human readable than \p n ame.
2346 * You \e should use the NULL_IF_CONFIG_SMALL() macro to define it. 2394 * You \e should use the NULL_IF_CONFIG_SMALL() macro to define it.
2347 */ 2395 */
2348 const char *long_name; 2396 const char *long_name;
2349 const int *supported_samplerates; ///< array of supported audio sample rates, or NULL if unknown, array is terminated by 0 2397 const int *supported_samplerates; ///< array of supported audio sample rates, or NULL if unknown, array is terminated by 0
2350 const enum SampleFormat *sample_fmts; ///< array of supported sample forma ts, or NULL if unknown, array is terminated by -1 2398 const enum SampleFormat *sample_fmts; ///< array of supported sample forma ts, or NULL if unknown, array is terminated by -1
2351 const int64_t *channel_layouts; ///< array of support channel layout s, or NULL if unknown. array is terminated by 0 2399 const int64_t *channel_layouts; ///< array of support channel layout s, or NULL if unknown. array is terminated by 0
2352 } AVCodec; 2400 } AVCodec;
2353 2401
2354 /** 2402 /**
2403 * AVHWAccel.
2404 */
2405 typedef struct AVHWAccel {
2406 /**
2407 * Name of the hardware accelerated codec.
2408 * The name is globally unique among encoders and among decoders (but an
2409 * encoder and a decoder can share the same name).
2410 */
2411 const char *name;
2412
2413 /**
2414 * Type of codec implemented by the hardware accelerator.
2415 *
2416 * See CODEC_TYPE_xxx
2417 */
2418 enum CodecType type;
2419
2420 /**
2421 * Codec implemented by the hardware accelerator.
2422 *
2423 * See CODEC_ID_xxx
2424 */
2425 enum CodecID id;
2426
2427 /**
2428 * Supported pixel format.
2429 *
2430 * Only hardware accelerated formats are supported here.
2431 */
2432 enum PixelFormat pix_fmt;
2433
2434 /**
2435 * Hardware accelerated codec capabilities.
2436 * see FF_HWACCEL_CODEC_CAP_*
2437 */
2438 int capabilities;
2439
2440 struct AVHWAccel *next;
2441
2442 /**
2443 * Called at the beginning of each frame or field picture.
2444 *
2445 * Meaningful frame information (codec specific) is guaranteed to
2446 * be parsed at this point. This function is mandatory.
2447 *
2448 * Note that \p buf can be NULL along with \p buf_size set to 0.
2449 * Otherwise, this means the whole frame is available at this point.
2450 *
2451 * @param avctx the codec context
2452 * @param buf the frame data buffer base
2453 * @param buf_size the size of the frame in bytes
2454 * @return zero if successful, a negative value otherwise
2455 */
2456 int (*start_frame)(AVCodecContext *avctx, const uint8_t *buf, uint32_t buf_s ize);
2457
2458 /**
2459 * Callback for each slice.
2460 *
2461 * Meaningful slice information (codec specific) is guaranteed to
2462 * be parsed at this point. This function is mandatory.
2463 *
2464 * @param avctx the codec context
2465 * @param buf the slice data buffer base
2466 * @param buf_size the size of the slice in bytes
2467 * @return zero if successful, a negative value otherwise
2468 */
2469 int (*decode_slice)(AVCodecContext *avctx, const uint8_t *buf, uint32_t buf_ size);
2470
2471 /**
2472 * Called at the end of each frame or field picture.
2473 *
2474 * The whole picture is parsed at this point and can now be sent
2475 * to the hardware accelerator. This function is mandatory.
2476 *
2477 * @param avctx the codec context
2478 * @return zero if successful, a negative value otherwise
2479 */
2480 int (*end_frame)(AVCodecContext *avctx);
2481
2482 /**
2483 * Size of HW accelerator private data.
2484 *
2485 * Private data is allocated with av_mallocz() before
2486 * AVCodecContext.get_buffer() and deallocated after
2487 * AVCodecContext.release_buffer().
2488 */
2489 int priv_data_size;
2490 } AVHWAccel;
2491
2492 /**
2355 * four components are given, that's all. 2493 * four components are given, that's all.
2356 * the last component is alpha 2494 * the last component is alpha
2357 */ 2495 */
2358 typedef struct AVPicture { 2496 typedef struct AVPicture {
2359 uint8_t *data[4]; 2497 uint8_t *data[4];
2360 int linesize[4]; ///< number of bytes per line 2498 int linesize[4]; ///< number of bytes per line
2361 } AVPicture; 2499 } AVPicture;
2362 2500
2501 #if LIBAVCODEC_VERSION_MAJOR < 53
2363 /** 2502 /**
2364 * AVPaletteControl 2503 * AVPaletteControl
2365 * This structure defines a method for communicating palette changes 2504 * This structure defines a method for communicating palette changes
2366 * between and demuxer and a decoder. 2505 * between and demuxer and a decoder.
2367 * 2506 *
2368 * @deprecated Use AVPacket to send palette changes instead. 2507 * @deprecated Use AVPacket to send palette changes instead.
2369 * This is totally broken. 2508 * This is totally broken.
2370 */ 2509 */
2371 #define AVPALETTE_SIZE 1024 2510 #define AVPALETTE_SIZE 1024
2372 #define AVPALETTE_COUNT 256 2511 #define AVPALETTE_COUNT 256
2373 typedef struct AVPaletteControl { 2512 typedef struct AVPaletteControl {
2374 2513
2375 /* Demuxer sets this to 1 to indicate the palette has changed; 2514 /* Demuxer sets this to 1 to indicate the palette has changed;
2376 * decoder resets to 0. */ 2515 * decoder resets to 0. */
2377 int palette_changed; 2516 int palette_changed;
2378 2517
2379 /* 4-byte ARGB palette entries, stored in native byte order; note that 2518 /* 4-byte ARGB palette entries, stored in native byte order; note that
2380 * the individual palette components should be on a 8-bit scale; if 2519 * the individual palette components should be on a 8-bit scale; if
2381 * the palette data comes from an IBM VGA native format, the component 2520 * the palette data comes from an IBM VGA native format, the component
2382 * data is probably 6 bits in size and needs to be scaled. */ 2521 * data is probably 6 bits in size and needs to be scaled. */
2383 unsigned int palette[AVPALETTE_COUNT]; 2522 unsigned int palette[AVPALETTE_COUNT];
2384 2523
2385 } AVPaletteControl attribute_deprecated; 2524 } AVPaletteControl attribute_deprecated;
2525 #endif
2386 2526
2387 enum AVSubtitleType { 2527 enum AVSubtitleType {
2388 SUBTITLE_NONE, 2528 SUBTITLE_NONE,
2389 2529
2390 SUBTITLE_BITMAP, ///< A bitmap, pict will be set 2530 SUBTITLE_BITMAP, ///< A bitmap, pict will be set
2391 2531
2392 /** 2532 /**
2393 * Plain text, the text field must be set by the decoder and is 2533 * Plain text, the text field must be set by the decoder and is
2394 * authoritative. ass and pict fields may contain approximations. 2534 * authoritative. ass and pict fields may contain approximations.
2395 */ 2535 */
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
2435 } AVSubtitle; 2575 } AVSubtitle;
2436 2576
2437 2577
2438 /* resample.c */ 2578 /* resample.c */
2439 2579
2440 struct ReSampleContext; 2580 struct ReSampleContext;
2441 struct AVResampleContext; 2581 struct AVResampleContext;
2442 2582
2443 typedef struct ReSampleContext ReSampleContext; 2583 typedef struct ReSampleContext ReSampleContext;
2444 2584
2445 ReSampleContext *audio_resample_init(int output_channels, int input_channels, 2585 #if LIBAVCODEC_VERSION_MAJOR < 53
2446 int output_rate, int input_rate); 2586 /**
2587 * @deprecated Use av_audio_resample_init() instead.
2588 */
2589 attribute_deprecated ReSampleContext *audio_resample_init(int output_channels, i nt input_channels,
2590 int output_rate, int i nput_rate);
2591 #endif
2592 /**
2593 * Initializes audio resampling context
2594 *
2595 * @param output_channels number of output channels
2596 * @param input_channels number of input channels
2597 * @param output_rate output sample rate
2598 * @param input_rate input sample rate
2599 * @param sample_fmt_out requested output sample format
2600 * @param sample_fmt_in input sample format
2601 * @param filter_length length of each FIR filter in the filterbank relative to the cutoff freq
2602 * @param log2_phase_count log2 of the number of entries in the polyphase filter bank
2603 * @param linear If 1 then the used FIR filter will be linearly interp olated
2604 between the 2 closest, if 0 the closest will be used
2605 * @param cutoff cutoff frequency, 1.0 corresponds to half the output sampling rate
2606 * @return allocated ReSampleContext, NULL if error occured
2607 */
2608 ReSampleContext *av_audio_resample_init(int output_channels, int input_channels,
2609 int output_rate, int input_rate,
2610 enum SampleFormat sample_fmt_out,
2611 enum SampleFormat sample_fmt_in,
2612 int filter_length, int log2_phase_count,
2613 int linear, double cutoff);
2614
2447 int audio_resample(ReSampleContext *s, short *output, short *input, int nb_sampl es); 2615 int audio_resample(ReSampleContext *s, short *output, short *input, int nb_sampl es);
2448 void audio_resample_close(ReSampleContext *s); 2616 void audio_resample_close(ReSampleContext *s);
2449 2617
2618
2619 /**
2620 * Initializes an audio resampler.
2621 * Note, if either rate is not an integer then simply scale both rates up so the y are.
2622 * @param filter_length length of each FIR filter in the filterbank relative to the cutoff freq
2623 * @param log2_phase_count log2 of the number of entries in the polyphase filter bank
2624 * @param linear If 1 then the used FIR filter will be linearly interpolated
2625 between the 2 closest, if 0 the closest will be used
2626 * @param cutoff cutoff frequency, 1.0 corresponds to half the output sampling r ate
2627 */
2450 struct AVResampleContext *av_resample_init(int out_rate, int in_rate, int filter _length, int log2_phase_count, int linear, double cutoff); 2628 struct AVResampleContext *av_resample_init(int out_rate, int in_rate, int filter _length, int log2_phase_count, int linear, double cutoff);
2629
2630 /**
2631 * resamples.
2632 * @param src an array of unconsumed samples
2633 * @param consumed the number of samples of src which have been consumed are ret urned here
2634 * @param src_size the number of unconsumed samples available
2635 * @param dst_size the amount of space in samples available in dst
2636 * @param update_ctx If this is 0 then the context will not be modified, that wa y several channels can be resampled with the same context.
2637 * @return the number of samples written in dst or -1 if an error occurred
2638 */
2451 int av_resample(struct AVResampleContext *c, short *dst, short *src, int *consum ed, int src_size, int dst_size, int update_ctx); 2639 int av_resample(struct AVResampleContext *c, short *dst, short *src, int *consum ed, int src_size, int dst_size, int update_ctx);
2640
2641
2642 /**
2643 * Compensates samplerate/timestamp drift. The compensation is done by changing
2644 * the resampler parameters, so no audible clicks or similar distortions occur
2645 * @param compensation_distance distance in output samples over which the compen sation should be performed
2646 * @param sample_delta number of output samples which should be output less
2647 *
2648 * example: av_resample_compensate(c, 10, 500)
2649 * here instead of 510 samples only 500 samples would be output
2650 *
2651 * note, due to rounding the actual compensation might be slightly different,
2652 * especially if the compensation_distance is large and the in_rate used during init is small
2653 */
2452 void av_resample_compensate(struct AVResampleContext *c, int sample_delta, int c ompensation_distance); 2654 void av_resample_compensate(struct AVResampleContext *c, int sample_delta, int c ompensation_distance);
2453 void av_resample_close(struct AVResampleContext *c); 2655 void av_resample_close(struct AVResampleContext *c);
2454 2656
2455 /** 2657 /**
2456 * Allocate memory for a picture. Call avpicture_free to free it. 2658 * Allocate memory for a picture. Call avpicture_free to free it.
2457 * 2659 *
2458 * @param picture the picture to be filled in 2660 * @param picture the picture to be filled in
2459 * @param pix_fmt the format of the picture 2661 * @param pix_fmt the format of the picture
2460 * @param width the width of the picture 2662 * @param width the width of the picture
2461 * @param height the height of the picture 2663 * @param height the height of the picture
2462 * @return zero if successful, a negative value if not 2664 * @return zero if successful, a negative value if not
2463 */ 2665 */
2464 int avpicture_alloc(AVPicture *picture, int pix_fmt, int width, int height); 2666 int avpicture_alloc(AVPicture *picture, enum PixelFormat pix_fmt, int width, int height);
2465 2667
2466 /** 2668 /**
2467 * Free a picture previously allocated by avpicture_alloc(). 2669 * Free a picture previously allocated by avpicture_alloc().
2468 * 2670 *
2469 * @param picture the AVPicture to be freed 2671 * @param picture the AVPicture to be freed
2470 */ 2672 */
2471 void avpicture_free(AVPicture *picture); 2673 void avpicture_free(AVPicture *picture);
2472 2674
2473 /** 2675 /**
2474 * Fill in the AVPicture fields. 2676 * Fill in the AVPicture fields.
2475 * The fields of the given AVPicture are filled in by using the 'ptr' address 2677 * The fields of the given AVPicture are filled in by using the 'ptr' address
2476 * which points to the image data buffer. Depending on the specified picture 2678 * which points to the image data buffer. Depending on the specified picture
2477 * format, one or multiple image data pointers and line sizes will be set. 2679 * format, one or multiple image data pointers and line sizes will be set.
2478 * If a planar format is specified, several pointers will be set pointing to 2680 * If a planar format is specified, several pointers will be set pointing to
2479 * the different picture planes and the line sizes of the different planes 2681 * the different picture planes and the line sizes of the different planes
2480 * will be stored in the lines_sizes array. 2682 * will be stored in the lines_sizes array.
2683 * Call with ptr == NULL to get the required size for the ptr buffer.
2481 * 2684 *
2482 * @param picture AVPicture whose fields are to be filled in 2685 * @param picture AVPicture whose fields are to be filled in
2483 * @param ptr Buffer which will contain or contains the actual image data 2686 * @param ptr Buffer which will contain or contains the actual image data
2484 * @param pix_fmt The format in which the picture data is stored. 2687 * @param pix_fmt The format in which the picture data is stored.
2485 * @param width the width of the image in pixels 2688 * @param width the width of the image in pixels
2486 * @param height the height of the image in pixels 2689 * @param height the height of the image in pixels
2487 * @return size of the image data in bytes 2690 * @return size of the image data in bytes
2488 */ 2691 */
2489 int avpicture_fill(AVPicture *picture, uint8_t *ptr, 2692 int avpicture_fill(AVPicture *picture, uint8_t *ptr,
2490 int pix_fmt, int width, int height); 2693 int pix_fmt, int width, int height);
2491 int avpicture_layout(const AVPicture* src, int pix_fmt, int width, int height, 2694 int avpicture_layout(const AVPicture* src, enum PixelFormat pix_fmt, int width, int height,
2492 unsigned char *dest, int dest_size); 2695 unsigned char *dest, int dest_size);
2493 2696
2494 /** 2697 /**
2495 * Calculate the size in bytes that a picture of the given width and height 2698 * Calculate the size in bytes that a picture of the given width and height
2496 * would occupy if stored in the given picture format. 2699 * would occupy if stored in the given picture format.
2700 * Note that this returns the size of a compact representation as generated
2701 * by avpicture_layout, which can be smaller than the size required for e.g.
2702 * avpicture_fill.
2497 * 2703 *
2498 * @param pix_fmt the given picture format 2704 * @param pix_fmt the given picture format
2499 * @param width the width of the image 2705 * @param width the width of the image
2500 * @param height the height of the image 2706 * @param height the height of the image
2501 * @return Image data size in bytes 2707 * @return Image data size in bytes or -1 on error (e.g. too large dimensions).
2502 */ 2708 */
2503 int avpicture_get_size(int pix_fmt, int width, int height); 2709 int avpicture_get_size(enum PixelFormat pix_fmt, int width, int height);
2504 void avcodec_get_chroma_sub_sample(int pix_fmt, int *h_shift, int *v_shift); 2710 void avcodec_get_chroma_sub_sample(enum PixelFormat pix_fmt, int *h_shift, int * v_shift);
2505 const char *avcodec_get_pix_fmt_name(int pix_fmt); 2711 const char *avcodec_get_pix_fmt_name(enum PixelFormat pix_fmt);
2506 void avcodec_set_dimensions(AVCodecContext *s, int width, int height); 2712 void avcodec_set_dimensions(AVCodecContext *s, int width, int height);
2713
2714 /**
2715 * Returns the pixel format corresponding to the name \p name.
2716 *
2717 * If there is no pixel format with name \p name, then looks for a
2718 * pixel format with the name corresponding to the native endian
2719 * format of \p name.
2720 * For example in a little-endian system, first looks for "gray16",
2721 * then for "gray16le".
2722 *
2723 * Finally if no pixel format has been found, returns \c PIX_FMT_NONE.
2724 */
2507 enum PixelFormat avcodec_get_pix_fmt(const char* name); 2725 enum PixelFormat avcodec_get_pix_fmt(const char* name);
2508 unsigned int avcodec_pix_fmt_to_codec_tag(enum PixelFormat p); 2726 unsigned int avcodec_pix_fmt_to_codec_tag(enum PixelFormat p);
2509 2727
2510 #define FF_LOSS_RESOLUTION 0x0001 /**< loss due to resolution change */ 2728 #define FF_LOSS_RESOLUTION 0x0001 /**< loss due to resolution change */
2511 #define FF_LOSS_DEPTH 0x0002 /**< loss due to color depth change */ 2729 #define FF_LOSS_DEPTH 0x0002 /**< loss due to color depth change */
2512 #define FF_LOSS_COLORSPACE 0x0004 /**< loss due to color space conversion */ 2730 #define FF_LOSS_COLORSPACE 0x0004 /**< loss due to color space conversion */
2513 #define FF_LOSS_ALPHA 0x0008 /**< loss of alpha bits */ 2731 #define FF_LOSS_ALPHA 0x0008 /**< loss of alpha bits */
2514 #define FF_LOSS_COLORQUANT 0x0010 /**< loss due to color quantization */ 2732 #define FF_LOSS_COLORQUANT 0x0010 /**< loss due to color quantization */
2515 #define FF_LOSS_CHROMA 0x0020 /**< loss of chroma (e.g. RGB to gray convers ion) */ 2733 #define FF_LOSS_CHROMA 0x0020 /**< loss of chroma (e.g. RGB to gray convers ion) */
2516 2734
2517 /** 2735 /**
2518 * Computes what kind of losses will occur when converting from one specific 2736 * Computes what kind of losses will occur when converting from one specific
2519 * pixel format to another. 2737 * pixel format to another.
2520 * When converting from one pixel format to another, information loss may occur. 2738 * When converting from one pixel format to another, information loss may occur.
2521 * For example, when converting from RGB24 to GRAY, the color information will 2739 * For example, when converting from RGB24 to GRAY, the color information will
2522 * be lost. Similarly, other losses occur when converting from some formats to 2740 * be lost. Similarly, other losses occur when converting from some formats to
2523 * other formats. These losses can involve loss of chroma, but also loss of 2741 * other formats. These losses can involve loss of chroma, but also loss of
2524 * resolution, loss of color depth, loss due to the color space conversion, loss 2742 * resolution, loss of color depth, loss due to the color space conversion, loss
2525 * of the alpha bits or loss due to color quantization. 2743 * of the alpha bits or loss due to color quantization.
2526 * avcodec_get_fix_fmt_loss() informs you about the various types of losses 2744 * avcodec_get_fix_fmt_loss() informs you about the various types of losses
2527 * which will occur when converting from one pixel format to another. 2745 * which will occur when converting from one pixel format to another.
2528 * 2746 *
2529 * @param[in] dst_pix_fmt destination pixel format 2747 * @param[in] dst_pix_fmt destination pixel format
2530 * @param[in] src_pix_fmt source pixel format 2748 * @param[in] src_pix_fmt source pixel format
2531 * @param[in] has_alpha Whether the source pixel format alpha channel is used. 2749 * @param[in] has_alpha Whether the source pixel format alpha channel is used.
2532 * @return Combination of flags informing you what kind of losses will occur. 2750 * @return Combination of flags informing you what kind of losses will occur.
2533 */ 2751 */
2534 int avcodec_get_pix_fmt_loss(int dst_pix_fmt, int src_pix_fmt, 2752 int avcodec_get_pix_fmt_loss(enum PixelFormat dst_pix_fmt, enum PixelFormat src_ pix_fmt,
2535 int has_alpha); 2753 int has_alpha);
2536 2754
2537 /** 2755 /**
2538 * Finds the best pixel format to convert to given a certain source pixel 2756 * Finds the best pixel format to convert to given a certain source pixel
2539 * format. When converting from one pixel format to another, information loss 2757 * format. When converting from one pixel format to another, information loss
2540 * may occur. For example, when converting from RGB24 to GRAY, the color 2758 * may occur. For example, when converting from RGB24 to GRAY, the color
2541 * information will be lost. Similarly, other losses occur when converting from 2759 * information will be lost. Similarly, other losses occur when converting from
2542 * some formats to other formats. avcodec_find_best_pix_fmt() searches which of 2760 * some formats to other formats. avcodec_find_best_pix_fmt() searches which of
2543 * the given pixel formats should be used to suffer the least amount of loss. 2761 * the given pixel formats should be used to suffer the least amount of loss.
2544 * The pixel formats from which it chooses one, are determined by the 2762 * The pixel formats from which it chooses one, are determined by the
2545 * \p pix_fmt_mask parameter. 2763 * \p pix_fmt_mask parameter.
2546 * 2764 *
2547 * @code 2765 * @code
2548 * src_pix_fmt = PIX_FMT_YUV420P; 2766 * src_pix_fmt = PIX_FMT_YUV420P;
2549 * pix_fmt_mask = (1 << PIX_FMT_YUV422P) || (1 << PIX_FMT_RGB24); 2767 * pix_fmt_mask = (1 << PIX_FMT_YUV422P) || (1 << PIX_FMT_RGB24);
2550 * dst_pix_fmt = avcodec_find_best_pix_fmt(pix_fmt_mask, src_pix_fmt, alpha, &lo ss); 2768 * dst_pix_fmt = avcodec_find_best_pix_fmt(pix_fmt_mask, src_pix_fmt, alpha, &lo ss);
2551 * @endcode 2769 * @endcode
2552 * 2770 *
2553 * @param[in] pix_fmt_mask bitmask determining which pixel format to choose from 2771 * @param[in] pix_fmt_mask bitmask determining which pixel format to choose from
2554 * @param[in] src_pix_fmt source pixel format 2772 * @param[in] src_pix_fmt source pixel format
2555 * @param[in] has_alpha Whether the source pixel format alpha channel is used. 2773 * @param[in] has_alpha Whether the source pixel format alpha channel is used.
2556 * @param[out] loss_ptr Combination of flags informing you what kind of losses w ill occur. 2774 * @param[out] loss_ptr Combination of flags informing you what kind of losses w ill occur.
2557 * @return The best pixel format to convert to or -1 if none was found. 2775 * @return The best pixel format to convert to or -1 if none was found.
2558 */ 2776 */
2559 int avcodec_find_best_pix_fmt(int64_t pix_fmt_mask, int src_pix_fmt, 2777 enum PixelFormat avcodec_find_best_pix_fmt(int64_t pix_fmt_mask, enum PixelForma t src_pix_fmt,
2560 int has_alpha, int *loss_ptr); 2778 int has_alpha, int *loss_ptr);
2561 2779
2562 2780
2563 /** 2781 /**
2564 * Print in buf the string corresponding to the pixel format with 2782 * Print in buf the string corresponding to the pixel format with
2565 * number pix_fmt, or an header if pix_fmt is negative. 2783 * number pix_fmt, or an header if pix_fmt is negative.
2566 * 2784 *
2567 * @param[in] buf the buffer where to write the string 2785 * @param[in] buf the buffer where to write the string
2568 * @param[in] buf_size the size of buf 2786 * @param[in] buf_size the size of buf
2569 * @param[in] pix_fmt the number of the pixel format to print the corresponding info string, or 2787 * @param[in] pix_fmt the number of the pixel format to print the corresponding info string, or
2570 * a negative value to print the corresponding header. 2788 * a negative value to print the corresponding header.
2571 * Meaningful values for obtaining a pixel format info vary from 0 to PIX_FMT_NB -1. 2789 * Meaningful values for obtaining a pixel format info vary from 0 to PIX_FMT_NB -1.
2572 */ 2790 */
2573 void avcodec_pix_fmt_string (char *buf, int buf_size, int pix_fmt); 2791 void avcodec_pix_fmt_string (char *buf, int buf_size, enum PixelFormat pix_fmt);
2574 2792
2575 #define FF_ALPHA_TRANSP 0x0001 /* image has some totally transparent pixel s */ 2793 #define FF_ALPHA_TRANSP 0x0001 /* image has some totally transparent pixel s */
2576 #define FF_ALPHA_SEMI_TRANSP 0x0002 /* image has some transparent pixels */ 2794 #define FF_ALPHA_SEMI_TRANSP 0x0002 /* image has some transparent pixels */
2577 2795
2578 /** 2796 /**
2579 * Tell if an image really has transparent alpha values. 2797 * Tell if an image really has transparent alpha values.
2580 * @return ored mask of FF_ALPHA_xxx constants 2798 * @return ored mask of FF_ALPHA_xxx constants
2581 */ 2799 */
2582 int img_get_alpha_info(const AVPicture *src, 2800 int img_get_alpha_info(const AVPicture *src,
2583 int pix_fmt, int width, int height); 2801 enum PixelFormat pix_fmt, int width, int height);
2584 2802
2585 /* deinterlace a picture */ 2803 /* deinterlace a picture */
2586 /* deinterlace - if not supported return -1 */ 2804 /* deinterlace - if not supported return -1 */
2587 int avpicture_deinterlace(AVPicture *dst, const AVPicture *src, 2805 int avpicture_deinterlace(AVPicture *dst, const AVPicture *src,
2588 int pix_fmt, int width, int height); 2806 enum PixelFormat pix_fmt, int width, int height);
2589 2807
2590 /* external high level API */ 2808 /* external high level API */
2591 2809
2810 /**
2811 * If c is NULL, returns the first registered codec,
2812 * if c is non-NULL, returns the next registered codec after c,
2813 * or NULL if c is the last one.
2814 */
2592 AVCodec *av_codec_next(AVCodec *c); 2815 AVCodec *av_codec_next(AVCodec *c);
2593 2816
2594 /** 2817 /**
2595 * Returns the LIBAVCODEC_VERSION_INT constant. 2818 * Returns the LIBAVCODEC_VERSION_INT constant.
2596 */ 2819 */
2597 unsigned avcodec_version(void); 2820 unsigned avcodec_version(void);
2598 2821
2599 /** 2822 /**
2600 * Initializes libavcodec. 2823 * Initializes libavcodec.
2601 * 2824 *
2602 * @warning This function \e must be called before any other libavcodec 2825 * @warning This function \e must be called before any other libavcodec
2603 * function. 2826 * function.
2604 */ 2827 */
2605 void avcodec_init(void); 2828 void avcodec_init(void);
2606 2829
2830 #if LIBAVCODEC_VERSION_MAJOR < 53
2831 /**
2832 * @deprecated Deprecated in favor of avcodec_register().
2833 */
2834 attribute_deprecated void register_avcodec(AVCodec *codec);
2835 #endif
2836
2607 /** 2837 /**
2608 * Register the codec \p codec and initialize libavcodec. 2838 * Register the codec \p codec and initialize libavcodec.
2609 * 2839 *
2610 * @see avcodec_init() 2840 * @see avcodec_init()
2611 */ 2841 */
2612 void register_avcodec(AVCodec *codec); 2842 void avcodec_register(AVCodec *codec);
2613 2843
2614 /** 2844 /**
2615 * Finds a registered encoder with a matching codec ID. 2845 * Finds a registered encoder with a matching codec ID.
2616 * 2846 *
2617 * @param id CodecID of the requested encoder 2847 * @param id CodecID of the requested encoder
2618 * @return An encoder if one was found, NULL otherwise. 2848 * @return An encoder if one was found, NULL otherwise.
2619 */ 2849 */
2620 AVCodec *avcodec_find_encoder(enum CodecID id); 2850 AVCodec *avcodec_find_encoder(enum CodecID id);
2621 2851
2622 /** 2852 /**
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after
2852 * \p pict. To encode it, it makes use of the video codec which was coupled with 3082 * \p pict. To encode it, it makes use of the video codec which was coupled with
2853 * \p avctx using avcodec_open(). The resulting encoded bytes representing the 3083 * \p avctx using avcodec_open(). The resulting encoded bytes representing the
2854 * frame are stored in the output buffer \p buf. The input picture should be 3084 * frame are stored in the output buffer \p buf. The input picture should be
2855 * stored using a specific format, namely \c avctx.pix_fmt. 3085 * stored using a specific format, namely \c avctx.pix_fmt.
2856 * 3086 *
2857 * @param avctx the codec context 3087 * @param avctx the codec context
2858 * @param[out] buf the output buffer for the bitstream of encoded frame 3088 * @param[out] buf the output buffer for the bitstream of encoded frame
2859 * @param[in] buf_size the size of the output buffer in bytes 3089 * @param[in] buf_size the size of the output buffer in bytes
2860 * @param[in] pict the input picture to encode 3090 * @param[in] pict the input picture to encode
2861 * @return On error a negative value is returned, on success zero or the number 3091 * @return On error a negative value is returned, on success zero or the number
2862 * of bytes used from the input buffer. 3092 * of bytes used from the output buffer.
2863 */ 3093 */
2864 int avcodec_encode_video(AVCodecContext *avctx, uint8_t *buf, int buf_size, 3094 int avcodec_encode_video(AVCodecContext *avctx, uint8_t *buf, int buf_size,
2865 const AVFrame *pict); 3095 const AVFrame *pict);
2866 int avcodec_encode_subtitle(AVCodecContext *avctx, uint8_t *buf, int buf_size, 3096 int avcodec_encode_subtitle(AVCodecContext *avctx, uint8_t *buf, int buf_size,
2867 const AVSubtitle *sub); 3097 const AVSubtitle *sub);
2868 3098
2869 int avcodec_close(AVCodecContext *avctx); 3099 int avcodec_close(AVCodecContext *avctx);
2870 3100
2871 /** 3101 /**
2872 * Register all the codecs, parsers and bitstream filters which were enabled at 3102 * Register all the codecs, parsers and bitstream filters which were enabled at
2873 * configuration time. If you do not call this function you can select exactly 3103 * configuration time. If you do not call this function you can select exactly
2874 * which formats you want to support, by using the individual registration 3104 * which formats you want to support, by using the individual registration
2875 * functions. 3105 * functions.
2876 * 3106 *
2877 * @see register_avcodec 3107 * @see avcodec_register
2878 * @see av_register_codec_parser 3108 * @see av_register_codec_parser
2879 * @see av_register_bitstream_filter 3109 * @see av_register_bitstream_filter
2880 */ 3110 */
2881 void avcodec_register_all(void); 3111 void avcodec_register_all(void);
2882 3112
2883 /** 3113 /**
2884 * Flush buffers, should be called when seeking or when switching to a different stream. 3114 * Flush buffers, should be called when seeking or when switching to a different stream.
2885 */ 3115 */
2886 void avcodec_flush_buffers(AVCodecContext *avctx); 3116 void avcodec_flush_buffers(AVCodecContext *avctx);
2887 3117
(...skipping 28 matching lines...) Expand all
2916 /* frame parsing */ 3146 /* frame parsing */
2917 typedef struct AVCodecParserContext { 3147 typedef struct AVCodecParserContext {
2918 void *priv_data; 3148 void *priv_data;
2919 struct AVCodecParser *parser; 3149 struct AVCodecParser *parser;
2920 int64_t frame_offset; /* offset of the current frame */ 3150 int64_t frame_offset; /* offset of the current frame */
2921 int64_t cur_offset; /* current offset 3151 int64_t cur_offset; /* current offset
2922 (incremented by each av_parser_parse()) */ 3152 (incremented by each av_parser_parse()) */
2923 int64_t next_frame_offset; /* offset of the next frame */ 3153 int64_t next_frame_offset; /* offset of the next frame */
2924 /* video info */ 3154 /* video info */
2925 int pict_type; /* XXX: Put it back in AVCodecContext. */ 3155 int pict_type; /* XXX: Put it back in AVCodecContext. */
3156 /**
3157 * This field is used for proper frame duration computation in lavf.
3158 * It signals, how much longer the frame duration of the current frame
3159 * is compared to normal frame duration.
3160 *
3161 * frame_duration = (1 + repeat_pict) * time_base
3162 *
3163 * It is used by codecs like H.264 to display telecined material.
3164 */
2926 int repeat_pict; /* XXX: Put it back in AVCodecContext. */ 3165 int repeat_pict; /* XXX: Put it back in AVCodecContext. */
2927 int64_t pts; /* pts of the current frame */ 3166 int64_t pts; /* pts of the current frame */
2928 int64_t dts; /* dts of the current frame */ 3167 int64_t dts; /* dts of the current frame */
2929 3168
2930 /* private data */ 3169 /* private data */
2931 int64_t last_pts; 3170 int64_t last_pts;
2932 int64_t last_dts; 3171 int64_t last_dts;
2933 int fetch_timestamp; 3172 int fetch_timestamp;
2934 3173
2935 #define AV_PARSER_PTS_NB 4 3174 #define AV_PARSER_PTS_NB 4
2936 int cur_frame_start_index; 3175 int cur_frame_start_index;
2937 int64_t cur_frame_offset[AV_PARSER_PTS_NB]; 3176 int64_t cur_frame_offset[AV_PARSER_PTS_NB];
2938 int64_t cur_frame_pts[AV_PARSER_PTS_NB]; 3177 int64_t cur_frame_pts[AV_PARSER_PTS_NB];
2939 int64_t cur_frame_dts[AV_PARSER_PTS_NB]; 3178 int64_t cur_frame_dts[AV_PARSER_PTS_NB];
2940 3179
2941 int flags; 3180 int flags;
2942 #define PARSER_FLAG_COMPLETE_FRAMES 0x0001 3181 #define PARSER_FLAG_COMPLETE_FRAMES 0x0001
2943 3182
2944 int64_t offset; ///< byte offset from starting packet start 3183 int64_t offset; ///< byte offset from starting packet start
2945 int64_t cur_frame_end[AV_PARSER_PTS_NB]; 3184 int64_t cur_frame_end[AV_PARSER_PTS_NB];
3185
3186 /*!
3187 * Set by parser to 1 for key frames and 0 for non-key frames.
3188 * It is initialized to -1, so if the parser doesn't set this flag,
3189 * old-style fallback using FF_I_TYPE picture type as key frames
3190 * will be used.
3191 */
3192 int key_frame;
3193
3194 /**
3195 * Time difference in stream time base units from the pts of this
3196 * packet to the point at which the output from the decoder has converged
3197 * independent from the availability of previous frames. That is, the
3198 * frames are virtually identical no matter if decoding started from
3199 * the very first frame or from this keyframe.
3200 * Is AV_NOPTS_VALUE if unknown.
3201 * This field is not the display duration of the current frame.
3202 *
3203 * The purpose of this field is to allow seeking in streams that have no
3204 * keyframes in the conventional sense. It corresponds to the
3205 * recovery point SEI in H.264 and match_time_delta in NUT. It is also
3206 * essential for some types of subtitle streams to ensure that all
3207 * subtitles are correctly displayed after seeking.
3208 */
3209 int64_t convergence_duration;
3210
3211 // Timestamp generation support:
3212 /**
3213 * Synchronization point for start of timestamp generation.
3214 *
3215 * Set to >0 for sync point, 0 for no sync point and <0 for undefined
3216 * (default).
3217 *
3218 * For example, this corresponds to presence of H.264 buffering period
3219 * SEI message.
3220 */
3221 int dts_sync_point;
3222
3223 /**
3224 * Offset of the current timestamp against last timestamp sync point in
3225 * units of AVCodecContext.time_base.
3226 *
3227 * Set to INT_MIN when dts_sync_point unused. Otherwise, it must
3228 * contain a valid timestamp offset.
3229 *
3230 * Note that the timestamp of sync point has usually a nonzero
3231 * dts_ref_dts_delta, which refers to the previous sync point. Offset of
3232 * the next frame after timestamp sync point will be usually 1.
3233 *
3234 * For example, this corresponds to H.264 cpb_removal_delay.
3235 */
3236 int dts_ref_dts_delta;
3237
3238 /**
3239 * Presentation delay of current frame in units of AVCodecContext.time_base.
3240 *
3241 * Set to INT_MIN when dts_sync_point unused. Otherwise, it must
3242 * contain valid non-negative timestamp delta (presentation time of a frame
3243 * must not lie in the past).
3244 *
3245 * This delay represents the difference between decoding and presentation
3246 * time of the frame.
3247 *
3248 * For example, this corresponds to H.264 dpb_output_delay.
3249 */
3250 int pts_dts_delta;
3251
3252 /**
3253 * Position of the packet in file.
3254 *
3255 * Analogous to cur_frame_pts/dts
3256 */
3257 int64_t cur_frame_pos[AV_PARSER_PTS_NB];
3258
3259 /**
3260 * Byte position of currently parsed frame in stream.
3261 */
3262 int64_t pos;
3263
3264 /**
3265 * Previous frame byte position.
3266 */
3267 int64_t last_pos;
2946 } AVCodecParserContext; 3268 } AVCodecParserContext;
2947 3269
2948 typedef struct AVCodecParser { 3270 typedef struct AVCodecParser {
2949 int codec_ids[5]; /* several codec IDs are permitted */ 3271 int codec_ids[5]; /* several codec IDs are permitted */
2950 int priv_data_size; 3272 int priv_data_size;
2951 int (*parser_init)(AVCodecParserContext *s); 3273 int (*parser_init)(AVCodecParserContext *s);
2952 int (*parser_parse)(AVCodecParserContext *s, 3274 int (*parser_parse)(AVCodecParserContext *s,
2953 AVCodecContext *avctx, 3275 AVCodecContext *avctx,
2954 const uint8_t **poutbuf, int *poutbuf_size, 3276 const uint8_t **poutbuf, int *poutbuf_size,
2955 const uint8_t *buf, int buf_size); 3277 const uint8_t *buf, int buf_size);
2956 void (*parser_close)(AVCodecParserContext *s); 3278 void (*parser_close)(AVCodecParserContext *s);
2957 int (*split)(AVCodecContext *avctx, const uint8_t *buf, int buf_size); 3279 int (*split)(AVCodecContext *avctx, const uint8_t *buf, int buf_size);
2958 struct AVCodecParser *next; 3280 struct AVCodecParser *next;
2959 } AVCodecParser; 3281 } AVCodecParser;
2960 3282
2961 AVCodecParser *av_parser_next(AVCodecParser *c); 3283 AVCodecParser *av_parser_next(AVCodecParser *c);
2962 3284
2963 void av_register_codec_parser(AVCodecParser *parser); 3285 void av_register_codec_parser(AVCodecParser *parser);
2964 AVCodecParserContext *av_parser_init(int codec_id); 3286 AVCodecParserContext *av_parser_init(int codec_id);
3287
3288 #if LIBAVCODEC_VERSION_MAJOR < 53
3289 attribute_deprecated
2965 int av_parser_parse(AVCodecParserContext *s, 3290 int av_parser_parse(AVCodecParserContext *s,
2966 AVCodecContext *avctx, 3291 AVCodecContext *avctx,
2967 uint8_t **poutbuf, int *poutbuf_size, 3292 uint8_t **poutbuf, int *poutbuf_size,
2968 const uint8_t *buf, int buf_size, 3293 const uint8_t *buf, int buf_size,
2969 int64_t pts, int64_t dts); 3294 int64_t pts, int64_t dts);
3295 #endif
3296
3297 /**
3298 * Parse a packet.
3299 *
3300 * @param s parser context.
3301 * @param avctx codec context.
3302 * @param poutbuf set to pointer to parsed buffer or NULL if not yet finis hed.
3303 * @param poutbuf_size set to size of parsed buffer or zero if not yet finished .
3304 * @param buf input buffer.
3305 * @param buf_size input length, to signal EOF, this should be 0 (so that t he last frame can be output).
3306 * @param pts input presentation timestamp.
3307 * @param dts input decoding timestamp.
3308 * @param pos input byte position in stream.
3309 * @return the number of bytes of the input bitstream used.
3310 *
3311 * Example:
3312 * @code
3313 * while(in_len){
3314 * len = av_parser_parse2(myparser, AVCodecContext, &data, &size,
3315 * in_data, in_len,
3316 * pts, dts, pos);
3317 * in_data += len;
3318 * in_len -= len;
3319 *
3320 * if(size)
3321 * decode_frame(data, size);
3322 * }
3323 * @endcode
3324 */
3325 int av_parser_parse2(AVCodecParserContext *s,
3326 AVCodecContext *avctx,
3327 uint8_t **poutbuf, int *poutbuf_size,
3328 const uint8_t *buf, int buf_size,
3329 int64_t pts, int64_t dts,
3330 int64_t pos);
3331
2970 int av_parser_change(AVCodecParserContext *s, 3332 int av_parser_change(AVCodecParserContext *s,
2971 AVCodecContext *avctx, 3333 AVCodecContext *avctx,
2972 uint8_t **poutbuf, int *poutbuf_size, 3334 uint8_t **poutbuf, int *poutbuf_size,
2973 const uint8_t *buf, int buf_size, int keyframe); 3335 const uint8_t *buf, int buf_size, int keyframe);
2974 void av_parser_close(AVCodecParserContext *s); 3336 void av_parser_close(AVCodecParserContext *s);
2975 3337
2976 3338
2977 typedef struct AVBitStreamFilterContext { 3339 typedef struct AVBitStreamFilterContext {
2978 void *priv_data; 3340 void *priv_data;
2979 struct AVBitStreamFilter *filter; 3341 struct AVBitStreamFilter *filter;
(...skipping 30 matching lines...) Expand all
3010 * does nothing. 3372 * does nothing.
3011 * 3373 *
3012 * @see av_realloc 3374 * @see av_realloc
3013 */ 3375 */
3014 void *av_fast_realloc(void *ptr, unsigned int *size, unsigned int min_size); 3376 void *av_fast_realloc(void *ptr, unsigned int *size, unsigned int min_size);
3015 3377
3016 /** 3378 /**
3017 * Copy image 'src' to 'dst'. 3379 * Copy image 'src' to 'dst'.
3018 */ 3380 */
3019 void av_picture_copy(AVPicture *dst, const AVPicture *src, 3381 void av_picture_copy(AVPicture *dst, const AVPicture *src,
3020 int pix_fmt, int width, int height); 3382 enum PixelFormat pix_fmt, int width, int height);
3021 3383
3022 /** 3384 /**
3023 * Crop image top and left side. 3385 * Crop image top and left side.
3024 */ 3386 */
3025 int av_picture_crop(AVPicture *dst, const AVPicture *src, 3387 int av_picture_crop(AVPicture *dst, const AVPicture *src,
3026 int pix_fmt, int top_band, int left_band); 3388 enum PixelFormat pix_fmt, int top_band, int left_band);
3027 3389
3028 /** 3390 /**
3029 * Pad image. 3391 * Pad image.
3030 */ 3392 */
3031 int av_picture_pad(AVPicture *dst, const AVPicture *src, int height, int width, int pix_fmt, 3393 int av_picture_pad(AVPicture *dst, const AVPicture *src, int height, int width, enum PixelFormat pix_fmt,
3032 int padtop, int padbottom, int padleft, int padright, int *color); 3394 int padtop, int padbottom, int padleft, int padright, int *color);
3033 3395
3034 unsigned int av_xiphlacing(unsigned char *s, unsigned int v); 3396 unsigned int av_xiphlacing(unsigned char *s, unsigned int v);
3035 3397
3036 /** 3398 /**
3037 * Parses \p str and put in \p width_ptr and \p height_ptr the detected values. 3399 * Parses \p str and put in \p width_ptr and \p height_ptr the detected values.
3038 * 3400 *
3039 * @return 0 in case of a successful parsing, a negative value otherwise 3401 * @return 0 in case of a successful parsing, a negative value otherwise
3040 * @param[in] str the string to parse: it has to be a string in the format 3402 * @param[in] str the string to parse: it has to be a string in the format
3041 * <width>x<height> or a valid video frame size abbreviation. 3403 * <width>x<height> or a valid video frame size abbreviation.
3042 * @param[in,out] width_ptr pointer to the variable which will contain the detec ted 3404 * @param[in,out] width_ptr pointer to the variable which will contain the detec ted
3043 * frame width value 3405 * frame width value
3044 * @param[in,out] height_ptr pointer to the variable which will contain the dete cted 3406 * @param[in,out] height_ptr pointer to the variable which will contain the dete cted
3045 * frame height value 3407 * frame height value
3046 */ 3408 */
3047 int av_parse_video_frame_size(int *width_ptr, int *height_ptr, const char *str); 3409 int av_parse_video_frame_size(int *width_ptr, int *height_ptr, const char *str);
3048 3410
3049 /** 3411 /**
3050 * Parses \p str and put in \p frame_rate the detected values. 3412 * Parses \p str and put in \p frame_rate the detected values.
3051 * 3413 *
3052 * @return 0 in case of a successful parsing, a negative value otherwise 3414 * @return 0 in case of a successful parsing, a negative value otherwise
3053 * @param[in] str the string to parse: it has to be a string in the format 3415 * @param[in] str the string to parse: it has to be a string in the format
3054 * <frame_rate_nom>/<frame_rate_den>, a float number or a valid video rate abbre viation 3416 * <frame_rate_num>/<frame_rate_den>, a float number or a valid video rate abbre viation
3055 * @param[in,out] frame_rate pointer to the AVRational which will contain the de tected 3417 * @param[in,out] frame_rate pointer to the AVRational which will contain the de tected
3056 * frame rate 3418 * frame rate
3057 */ 3419 */
3058 int av_parse_video_frame_rate(AVRational *frame_rate, const char *str); 3420 int av_parse_video_frame_rate(AVRational *frame_rate, const char *str);
3059 3421
3060 /* error handling */ 3422 /* error handling */
3061 #if EINVAL > 0 3423 #if EINVAL > 0
3062 #define AVERROR(e) (-(e)) /**< Returns a negative error code from a POSIX error code, to return from library functions. */ 3424 #define AVERROR(e) (-(e)) /**< Returns a negative error code from a POSIX error code, to return from library functions. */
3063 #define AVUNERROR(e) (-(e)) /**< Returns a POSIX error code from a library funct ion error return value. */ 3425 #define AVUNERROR(e) (-(e)) /**< Returns a POSIX error code from a library funct ion error return value. */
3064 #else 3426 #else
3065 /* Some platforms have E* and errno already negated. */ 3427 /* Some platforms have E* and errno already negated. */
3066 #define AVERROR(e) (e) 3428 #define AVERROR(e) (e)
3067 #define AVUNERROR(e) (e) 3429 #define AVUNERROR(e) (e)
3068 #endif 3430 #endif
3069 #define AVERROR_UNKNOWN AVERROR(EINVAL) /**< unknown error */ 3431 #define AVERROR_UNKNOWN AVERROR(EINVAL) /**< unknown error */
3070 #define AVERROR_IO AVERROR(EIO) /**< I/O error */ 3432 #define AVERROR_IO AVERROR(EIO) /**< I/O error */
3071 #define AVERROR_NUMEXPECTED AVERROR(EDOM) /**< Number syntax expected in file name. */ 3433 #define AVERROR_NUMEXPECTED AVERROR(EDOM) /**< Number syntax expected in file name. */
3072 #define AVERROR_INVALIDDATA AVERROR(EINVAL) /**< invalid data found */ 3434 #define AVERROR_INVALIDDATA AVERROR(EINVAL) /**< invalid data found */
3073 #define AVERROR_NOMEM AVERROR(ENOMEM) /**< not enough memory */ 3435 #define AVERROR_NOMEM AVERROR(ENOMEM) /**< not enough memory */
3074 #define AVERROR_NOFMT AVERROR(EILSEQ) /**< unknown format */ 3436 #define AVERROR_NOFMT AVERROR(EILSEQ) /**< unknown format */
3075 #define AVERROR_NOTSUPP AVERROR(ENOSYS) /**< Operation not supported. */ 3437 #define AVERROR_NOTSUPP AVERROR(ENOSYS) /**< Operation not supported. */
3076 #define AVERROR_NOENT AVERROR(ENOENT) /**< No such file or directory. */ 3438 #define AVERROR_NOENT AVERROR(ENOENT) /**< No such file or directory. */
3439 #define AVERROR_EOF AVERROR(EPIPE) /**< End of file. */
3077 #define AVERROR_PATCHWELCOME -MKTAG('P','A','W','E') /**< Not yet implemented in FFmpeg. Patches welcome. */ 3440 #define AVERROR_PATCHWELCOME -MKTAG('P','A','W','E') /**< Not yet implemented in FFmpeg. Patches welcome. */
3078 3441
3442 /**
3443 * Registers the hardware accelerator \p hwaccel.
3444 */
3445 void av_register_hwaccel(AVHWAccel *hwaccel);
3446
3447 /**
3448 * If hwaccel is NULL, returns the first registered hardware accelerator,
3449 * if hwaccel is non-NULL, returns the next registered hardware accelerator
3450 * after hwaccel, or NULL if hwaccel is the last one.
3451 */
3452 AVHWAccel *av_hwaccel_next(AVHWAccel *hwaccel);
3453
3079 #endif /* AVCODEC_AVCODEC_H */ 3454 #endif /* AVCODEC_AVCODEC_H */
OLDNEW
« no previous file with comments | « third_party/ffmpeg/generate_libs.bat ('k') | third_party/ffmpeg/include/libavcodec/opt.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698