OLD | NEW |
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 * |
(...skipping 12 matching lines...) Expand all Loading... |
23 | 23 |
24 /** | 24 /** |
25 * @file libavcodec/avcodec.h | 25 * @file libavcodec/avcodec.h |
26 * external API header | 26 * external API header |
27 */ | 27 */ |
28 | 28 |
29 #include <errno.h> | 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 22 | 33 #define LIBAVCODEC_VERSION_MINOR 28 |
34 #define LIBAVCODEC_VERSION_MICRO 3 | 34 #define LIBAVCODEC_VERSION_MICRO 0 |
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 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 CODEC_ID_TQI, | 193 CODEC_ID_TQI, |
194 CODEC_ID_AURA, | 194 CODEC_ID_AURA, |
195 CODEC_ID_AURA2, | 195 CODEC_ID_AURA2, |
| 196 CODEC_ID_V210X, |
| 197 CODEC_ID_TMV, |
196 | 198 |
197 /* various PCM "codecs" */ | 199 /* various PCM "codecs" */ |
198 CODEC_ID_PCM_S16LE= 0x10000, | 200 CODEC_ID_PCM_S16LE= 0x10000, |
199 CODEC_ID_PCM_S16BE, | 201 CODEC_ID_PCM_S16BE, |
200 CODEC_ID_PCM_U16LE, | 202 CODEC_ID_PCM_U16LE, |
201 CODEC_ID_PCM_U16BE, | 203 CODEC_ID_PCM_U16BE, |
202 CODEC_ID_PCM_S8, | 204 CODEC_ID_PCM_S8, |
203 CODEC_ID_PCM_U8, | 205 CODEC_ID_PCM_U8, |
204 CODEC_ID_PCM_MULAW, | 206 CODEC_ID_PCM_MULAW, |
205 CODEC_ID_PCM_ALAW, | 207 CODEC_ID_PCM_ALAW, |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
306 CODEC_ID_SPEEX, | 308 CODEC_ID_SPEEX, |
307 CODEC_ID_WMAVOICE, | 309 CODEC_ID_WMAVOICE, |
308 CODEC_ID_WMAPRO, | 310 CODEC_ID_WMAPRO, |
309 CODEC_ID_WMALOSSLESS, | 311 CODEC_ID_WMALOSSLESS, |
310 CODEC_ID_ATRAC3P, | 312 CODEC_ID_ATRAC3P, |
311 CODEC_ID_EAC3, | 313 CODEC_ID_EAC3, |
312 CODEC_ID_SIPR, | 314 CODEC_ID_SIPR, |
313 CODEC_ID_MP1, | 315 CODEC_ID_MP1, |
314 CODEC_ID_TWINVQ, | 316 CODEC_ID_TWINVQ, |
315 CODEC_ID_TRUEHD, | 317 CODEC_ID_TRUEHD, |
| 318 CODEC_ID_MP4ALS, |
316 | 319 |
317 /* subtitle codecs */ | 320 /* subtitle codecs */ |
318 CODEC_ID_DVD_SUBTITLE= 0x17000, | 321 CODEC_ID_DVD_SUBTITLE= 0x17000, |
319 CODEC_ID_DVB_SUBTITLE, | 322 CODEC_ID_DVB_SUBTITLE, |
320 CODEC_ID_TEXT, ///< raw UTF-8 text | 323 CODEC_ID_TEXT, ///< raw UTF-8 text |
321 CODEC_ID_XSUB, | 324 CODEC_ID_XSUB, |
322 CODEC_ID_SSA, | 325 CODEC_ID_SSA, |
323 CODEC_ID_MOV_TEXT, | 326 CODEC_ID_MOV_TEXT, |
324 | 327 |
325 /* other specific kind of codecs (generally used for attachments) */ | 328 /* other specific kind of codecs (generally used for attachments) */ |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
372 #define CH_TOP_FRONT_RIGHT 0x00004000 | 375 #define CH_TOP_FRONT_RIGHT 0x00004000 |
373 #define CH_TOP_BACK_LEFT 0x00008000 | 376 #define CH_TOP_BACK_LEFT 0x00008000 |
374 #define CH_TOP_BACK_CENTER 0x00010000 | 377 #define CH_TOP_BACK_CENTER 0x00010000 |
375 #define CH_TOP_BACK_RIGHT 0x00020000 | 378 #define CH_TOP_BACK_RIGHT 0x00020000 |
376 #define CH_STEREO_LEFT 0x20000000 ///< Stereo downmix. | 379 #define CH_STEREO_LEFT 0x20000000 ///< Stereo downmix. |
377 #define CH_STEREO_RIGHT 0x40000000 ///< See CH_STEREO_LEFT. | 380 #define CH_STEREO_RIGHT 0x40000000 ///< See CH_STEREO_LEFT. |
378 | 381 |
379 /* Audio channel convenience macros */ | 382 /* Audio channel convenience macros */ |
380 #define CH_LAYOUT_MONO (CH_FRONT_CENTER) | 383 #define CH_LAYOUT_MONO (CH_FRONT_CENTER) |
381 #define CH_LAYOUT_STEREO (CH_FRONT_LEFT|CH_FRONT_RIGHT) | 384 #define CH_LAYOUT_STEREO (CH_FRONT_LEFT|CH_FRONT_RIGHT) |
| 385 #define CH_LAYOUT_2_1 (CH_LAYOUT_STEREO|CH_BACK_CENTER) |
382 #define CH_LAYOUT_SURROUND (CH_LAYOUT_STEREO|CH_FRONT_CENTER) | 386 #define CH_LAYOUT_SURROUND (CH_LAYOUT_STEREO|CH_FRONT_CENTER) |
| 387 #define CH_LAYOUT_4POINT0 (CH_LAYOUT_SURROUND|CH_BACK_CENTER) |
| 388 #define CH_LAYOUT_2_2 (CH_LAYOUT_STEREO|CH_SIDE_LEFT|CH_SIDE_RIGHT
) |
383 #define CH_LAYOUT_QUAD (CH_LAYOUT_STEREO|CH_BACK_LEFT|CH_BACK_RIGHT
) | 389 #define CH_LAYOUT_QUAD (CH_LAYOUT_STEREO|CH_BACK_LEFT|CH_BACK_RIGHT
) |
384 #define CH_LAYOUT_5POINT0 (CH_LAYOUT_SURROUND|CH_SIDE_LEFT|CH_SIDE_RIG
HT) | 390 #define CH_LAYOUT_5POINT0 (CH_LAYOUT_SURROUND|CH_SIDE_LEFT|CH_SIDE_RIG
HT) |
385 #define CH_LAYOUT_5POINT1 (CH_LAYOUT_5POINT0|CH_LOW_FREQUENCY) | 391 #define CH_LAYOUT_5POINT1 (CH_LAYOUT_5POINT0|CH_LOW_FREQUENCY) |
| 392 #define CH_LAYOUT_5POINT0_BACK (CH_LAYOUT_SURROUND|CH_BACK_LEFT|CH_BACK_RIG
HT) |
| 393 #define CH_LAYOUT_5POINT1_BACK (CH_LAYOUT_5POINT0_BACK|CH_LOW_FREQUENCY) |
386 #define CH_LAYOUT_7POINT1 (CH_LAYOUT_5POINT1|CH_BACK_LEFT|CH_BACK_RIGH
T) | 394 #define CH_LAYOUT_7POINT1 (CH_LAYOUT_5POINT1|CH_BACK_LEFT|CH_BACK_RIGH
T) |
387 #define CH_LAYOUT_7POINT1_WIDE (CH_LAYOUT_SURROUND|CH_LOW_FREQUENCY|\ | 395 #define CH_LAYOUT_7POINT1_WIDE (CH_LAYOUT_5POINT1_BACK|\ |
388 CH_BACK_LEFT|CH_BACK_RIGHT|\ | |
389 CH_FRONT_LEFT_OF_CENTER|CH_FRONT_RIGHT
_OF_CENTER) | 396 CH_FRONT_LEFT_OF_CENTER|CH_FRONT_RIGHT
_OF_CENTER) |
390 #define CH_LAYOUT_STEREO_DOWNMIX (CH_STEREO_LEFT|CH_STEREO_RIGHT) | 397 #define CH_LAYOUT_STEREO_DOWNMIX (CH_STEREO_LEFT|CH_STEREO_RIGHT) |
391 | 398 |
392 /* in bytes */ | 399 /* in bytes */ |
393 #define AVCODEC_MAX_AUDIO_FRAME_SIZE 192000 // 1 second of 48khz 32bit audio | 400 #define AVCODEC_MAX_AUDIO_FRAME_SIZE 192000 // 1 second of 48khz 32bit audio |
394 | 401 |
395 /** | 402 /** |
396 * Required number of additionally allocated bytes at the end of the input bitst
ream for decoding. | 403 * Required number of additionally allocated bytes at the end of the input bitst
ream for decoding. |
397 * This is mainly needed because some optimized bitstream readers read | 404 * This is mainly needed because some optimized bitstream readers read |
398 * 32 or 64 bit at once and could read over the end.<br> | 405 * 32 or 64 bit at once and could read over the end.<br> |
(...skipping 29 matching lines...) Expand all Loading... |
428 /* We leave some space between them for extensions (drop some | 435 /* We leave some space between them for extensions (drop some |
429 * keyframes for intra-only or drop just some bidir frames). */ | 436 * keyframes for intra-only or drop just some bidir frames). */ |
430 AVDISCARD_NONE =-16, ///< discard nothing | 437 AVDISCARD_NONE =-16, ///< discard nothing |
431 AVDISCARD_DEFAULT= 0, ///< discard useless packets like 0 size packets in a
vi | 438 AVDISCARD_DEFAULT= 0, ///< discard useless packets like 0 size packets in a
vi |
432 AVDISCARD_NONREF = 8, ///< discard all non reference | 439 AVDISCARD_NONREF = 8, ///< discard all non reference |
433 AVDISCARD_BIDIR = 16, ///< discard all bidirectional frames | 440 AVDISCARD_BIDIR = 16, ///< discard all bidirectional frames |
434 AVDISCARD_NONKEY = 32, ///< discard all frames except keyframes | 441 AVDISCARD_NONKEY = 32, ///< discard all frames except keyframes |
435 AVDISCARD_ALL = 48, ///< discard all | 442 AVDISCARD_ALL = 48, ///< discard all |
436 }; | 443 }; |
437 | 444 |
| 445 enum AVColorPrimaries{ |
| 446 AVCOL_PRI_BT709 =1, ///< also ITU-R BT1361 / IEC 61966-2-4 / SMPTE RP17
7 Annex B |
| 447 AVCOL_PRI_UNSPECIFIED=2, |
| 448 AVCOL_PRI_BT470M =4, |
| 449 AVCOL_PRI_BT470BG =5, ///< also ITU-R BT601-6 625 / ITU-R BT1358 625 / IT
U-R BT1700 625 PAL & SECAM |
| 450 AVCOL_PRI_SMPTE170M =6, ///< also ITU-R BT601-6 525 / ITU-R BT1358 525 / IT
U-R BT1700 NTSC |
| 451 AVCOL_PRI_SMPTE240M =7, ///< functionally identical to above |
| 452 AVCOL_PRI_FILM =8, |
| 453 AVCOL_PRI_NB , ///< Not part of ABI |
| 454 }; |
| 455 |
| 456 enum AVColorTransferCharacteristic{ |
| 457 AVCOL_TRC_BT709 =1, ///< also ITU-R BT1361 |
| 458 AVCOL_TRC_UNSPECIFIED=2, |
| 459 AVCOL_TRC_GAMMA22 =4, ///< also ITU-R BT470M / ITU-R BT1700 625 PAL & SEC
AM |
| 460 AVCOL_TRC_GAMMA28 =5, ///< also ITU-R BT470BG |
| 461 AVCOL_TRC_NB , ///< Not part of ABI |
| 462 }; |
| 463 |
| 464 enum AVColorSpace{ |
| 465 AVCOL_SPC_RGB =0, |
| 466 AVCOL_SPC_BT709 =1, ///< also ITU-R BT1361 / IEC 61966-2-4 xvYCC709 / S
MPTE RP177 Annex B |
| 467 AVCOL_SPC_UNSPECIFIED=2, |
| 468 AVCOL_SPC_FCC =4, |
| 469 AVCOL_SPC_BT470BG =5, ///< also ITU-R BT601-6 625 / ITU-R BT1358 625 / IT
U-R BT1700 625 PAL & SECAM / IEC 61966-2-4 xvYCC601 |
| 470 AVCOL_SPC_SMPTE170M =6, ///< also ITU-R BT601-6 525 / ITU-R BT1358 525 / IT
U-R BT1700 NTSC / functionally identical to above |
| 471 AVCOL_SPC_SMPTE240M =7, |
| 472 AVCOL_SPC_NB , ///< Not part of ABI |
| 473 }; |
| 474 |
| 475 enum AVColorRange{ |
| 476 AVCOL_RANGE_UNSPECIFIED=0, |
| 477 AVCOL_RANGE_MPEG =1, ///< the normal 219*2^(n-8) "MPEG" YUV ranges |
| 478 AVCOL_RANGE_JPEG =2, ///< the normal 2^n-1 "JPEG" YUV ranges |
| 479 AVCOL_RANGE_NB , ///< Not part of ABI |
| 480 }; |
| 481 |
438 typedef struct RcOverride{ | 482 typedef struct RcOverride{ |
439 int start_frame; | 483 int start_frame; |
440 int end_frame; | 484 int end_frame; |
441 int qscale; // If this is 0 then quality_factor will be used instead. | 485 int qscale; // If this is 0 then quality_factor will be used instead. |
442 float quality_factor; | 486 float quality_factor; |
443 } RcOverride; | 487 } RcOverride; |
444 | 488 |
445 #define FF_MAX_B_FRAMES 16 | 489 #define FF_MAX_B_FRAMES 16 |
446 | 490 |
447 /* encoding support | 491 /* encoding support |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
531 #define CODEC_CAP_DELAY 0x0020 | 575 #define CODEC_CAP_DELAY 0x0020 |
532 /** | 576 /** |
533 * Codec can be fed a final frame with a smaller size. | 577 * Codec can be fed a final frame with a smaller size. |
534 * This can be used to prevent truncation of the last audio samples. | 578 * This can be used to prevent truncation of the last audio samples. |
535 */ | 579 */ |
536 #define CODEC_CAP_SMALL_LAST_FRAME 0x0040 | 580 #define CODEC_CAP_SMALL_LAST_FRAME 0x0040 |
537 /** | 581 /** |
538 * Codec can export data for HW decoding (VDPAU). | 582 * Codec can export data for HW decoding (VDPAU). |
539 */ | 583 */ |
540 #define CODEC_CAP_HWACCEL_VDPAU 0x0080 | 584 #define CODEC_CAP_HWACCEL_VDPAU 0x0080 |
| 585 /** |
| 586 * Codec supports frame-based multithreading. |
| 587 */ |
| 588 #define CODEC_CAP_FRAME_THREADS 0x0100 |
541 | 589 |
542 //The following defines may change, don't expect compatibility if you use them. | 590 //The following defines may change, don't expect compatibility if you use them. |
543 #define MB_TYPE_INTRA4x4 0x0001 | 591 #define MB_TYPE_INTRA4x4 0x0001 |
544 #define MB_TYPE_INTRA16x16 0x0002 //FIXME H.264-specific | 592 #define MB_TYPE_INTRA16x16 0x0002 //FIXME H.264-specific |
545 #define MB_TYPE_INTRA_PCM 0x0004 //FIXME H.264-specific | 593 #define MB_TYPE_INTRA_PCM 0x0004 //FIXME H.264-specific |
546 #define MB_TYPE_16x16 0x0008 | 594 #define MB_TYPE_16x16 0x0008 |
547 #define MB_TYPE_16x8 0x0010 | 595 #define MB_TYPE_16x8 0x0010 |
548 #define MB_TYPE_8x16 0x0020 | 596 #define MB_TYPE_8x16 0x0020 |
549 #define MB_TYPE_8x8 0x0040 | 597 #define MB_TYPE_8x8 0x0040 |
550 #define MB_TYPE_INTERLACED 0x0080 | 598 #define MB_TYPE_INTERLACED 0x0080 |
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
810 * - decoding: Read by user.\ | 858 * - decoding: Read by user.\ |
811 */\ | 859 */\ |
812 int64_t reordered_opaque;\ | 860 int64_t reordered_opaque;\ |
813 \ | 861 \ |
814 /**\ | 862 /**\ |
815 * hardware accelerator private data (FFmpeg allocated)\ | 863 * hardware accelerator private data (FFmpeg allocated)\ |
816 * - encoding: unused\ | 864 * - encoding: unused\ |
817 * - decoding: Set by libavcodec\ | 865 * - decoding: Set by libavcodec\ |
818 */\ | 866 */\ |
819 void *hwaccel_picture_private;\ | 867 void *hwaccel_picture_private;\ |
820 | 868 \ |
| 869 /**\ |
| 870 * the AVCodecContext which ff_get_buffer was last called on\ |
| 871 * - encoding: Set by libavcodec.\ |
| 872 * - decoding: Set by libavcodec.\ |
| 873 */\ |
| 874 struct AVCodecContext *owner;\ |
| 875 \ |
| 876 /**\ |
| 877 * used by multithreading to store frame-specific info\ |
| 878 * - encoding: Set by libavcodec.\ |
| 879 * - decoding: Set by libavcodec.\ |
| 880 */\ |
| 881 void *thread_opaque; |
821 | 882 |
822 #define FF_QSCALE_TYPE_MPEG1 0 | 883 #define FF_QSCALE_TYPE_MPEG1 0 |
823 #define FF_QSCALE_TYPE_MPEG2 1 | 884 #define FF_QSCALE_TYPE_MPEG2 1 |
824 #define FF_QSCALE_TYPE_H264 2 | 885 #define FF_QSCALE_TYPE_H264 2 |
825 | 886 |
826 #define FF_BUFFER_TYPE_INTERNAL 1 | 887 #define FF_BUFFER_TYPE_INTERNAL 1 |
827 #define FF_BUFFER_TYPE_USER 2 ///< direct rendering buffers (image is (de)al
located by user) | 888 #define FF_BUFFER_TYPE_USER 2 ///< direct rendering buffers (image is (de)al
located by user) |
828 #define FF_BUFFER_TYPE_SHARED 4 ///< Buffer from somewhere else; don't dealloc
ate image (data/base), all other tables are not shared. | 889 #define FF_BUFFER_TYPE_SHARED 4 ///< Buffer from somewhere else; don't dealloc
ate image (data/base), all other tables are not shared. |
829 #define FF_BUFFER_TYPE_COPY 8 ///< Just a (modified) copy of some other buff
er, don't deallocate anything. | 890 #define FF_BUFFER_TYPE_COPY 8 ///< Just a (modified) copy of some other buff
er, don't deallocate anything. |
830 | 891 |
831 | 892 |
832 #define FF_I_TYPE 1 ///< Intra | 893 #define FF_I_TYPE 1 ///< Intra |
833 #define FF_P_TYPE 2 ///< Predicted | 894 #define FF_P_TYPE 2 ///< Predicted |
834 #define FF_B_TYPE 3 ///< Bi-dir predicted | 895 #define FF_B_TYPE 3 ///< Bi-dir predicted |
835 #define FF_S_TYPE 4 ///< S(GMC)-VOP MPEG4 | 896 #define FF_S_TYPE 4 ///< S(GMC)-VOP MPEG4 |
836 #define FF_SI_TYPE 5 ///< Switching Intra | 897 #define FF_SI_TYPE 5 ///< Switching Intra |
837 #define FF_SP_TYPE 6 ///< Switching Predicted | 898 #define FF_SP_TYPE 6 ///< Switching Predicted |
838 #define FF_BI_TYPE 7 | 899 #define FF_BI_TYPE 7 |
839 | 900 |
840 #define FF_BUFFER_HINTS_VALID 0x01 // Buffer hints value is meaningful (if 0
ignore). | 901 #define FF_BUFFER_HINTS_VALID 0x01 // Buffer hints value is meaningful (if 0
ignore). |
841 #define FF_BUFFER_HINTS_READABLE 0x02 // Codec will read from buffer. | 902 #define FF_BUFFER_HINTS_READABLE 0x02 // Codec will read from buffer. |
842 #define FF_BUFFER_HINTS_PRESERVE 0x04 // User must not alter buffer content. | 903 #define FF_BUFFER_HINTS_PRESERVE 0x04 // User must not alter buffer content. |
843 #define FF_BUFFER_HINTS_REUSABLE 0x08 // Codec will reuse the buffer (update). | 904 #define FF_BUFFER_HINTS_REUSABLE 0x08 // Codec will reuse the buffer (update). |
844 | 905 |
| 906 typedef struct AVPacket { |
| 907 /** |
| 908 * Presentation timestamp in AVStream->time_base units; the time at which |
| 909 * the decompressed packet will be presented to the user. |
| 910 * Can be AV_NOPTS_VALUE if it is not stored in the file. |
| 911 * pts MUST be larger or equal to dts as presentation cannot happen before |
| 912 * decompression, unless one wants to view hex dumps. Some formats misuse |
| 913 * the terms dts and pts/cts to mean something different. Such timestamps |
| 914 * must be converted to true pts/dts before they are stored in AVPacket. |
| 915 */ |
| 916 int64_t pts; |
| 917 /** |
| 918 * Decompression timestamp in AVStream->time_base units; the time at which |
| 919 * the packet is decompressed. |
| 920 * Can be AV_NOPTS_VALUE if it is not stored in the file. |
| 921 */ |
| 922 int64_t dts; |
| 923 uint8_t *data; |
| 924 int size; |
| 925 int stream_index; |
| 926 int flags; |
| 927 /** |
| 928 * Duration of this packet in AVStream->time_base units, 0 if unknown. |
| 929 * Equals next_pts - this_pts in presentation order. |
| 930 */ |
| 931 int duration; |
| 932 void (*destruct)(struct AVPacket *); |
| 933 void *priv; |
| 934 int64_t pos; ///< byte position in stream, -1 if
unknown |
| 935 |
| 936 /** |
| 937 * Time difference in AVStream->time_base units from the pts of this |
| 938 * packet to the point at which the output from the decoder has converged |
| 939 * independent from the availability of previous frames. That is, the |
| 940 * frames are virtually identical no matter if decoding started from |
| 941 * the very first frame or from this keyframe. |
| 942 * Is AV_NOPTS_VALUE if unknown. |
| 943 * This field is not the display duration of the current packet. |
| 944 * |
| 945 * The purpose of this field is to allow seeking in streams that have no |
| 946 * keyframes in the conventional sense. It corresponds to the |
| 947 * recovery point SEI in H.264 and match_time_delta in NUT. It is also |
| 948 * essential for some types of subtitle streams to ensure that all |
| 949 * subtitles are correctly displayed after seeking. |
| 950 */ |
| 951 int64_t convergence_duration; |
| 952 } AVPacket; |
| 953 #define PKT_FLAG_KEY 0x0001 |
| 954 |
845 /** | 955 /** |
846 * Audio Video Frame. | 956 * Audio Video Frame. |
847 * New fields can be added to the end of FF_COMMON_FRAME with minor version | 957 * New fields can be added to the end of FF_COMMON_FRAME with minor version |
848 * bumps. | 958 * bumps. |
849 * Removal, reordering and changes to existing fields require a major | 959 * Removal, reordering and changes to existing fields require a major |
850 * version bump. No fields should be added into AVFrame before or after | 960 * version bump. No fields should be added into AVFrame before or after |
851 * FF_COMMON_FRAME! | 961 * FF_COMMON_FRAME! |
852 * sizeof(AVFrame) must not be used outside libav*. | 962 * sizeof(AVFrame) must not be used outside libav*. |
853 */ | 963 */ |
854 typedef struct AVFrame { | 964 typedef struct AVFrame { |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
964 * has to read frames at native frame rate. | 1074 * has to read frames at native frame rate. |
965 * - encoding: Set by user. | 1075 * - encoding: Set by user. |
966 * - decoding: unused | 1076 * - decoding: unused |
967 */ | 1077 */ |
968 int rate_emu; | 1078 int rate_emu; |
969 | 1079 |
970 /** | 1080 /** |
971 * If non NULL, 'draw_horiz_band' is called by the libavcodec | 1081 * If non NULL, 'draw_horiz_band' is called by the libavcodec |
972 * decoder to draw a horizontal band. It improves cache usage. Not | 1082 * decoder to draw a horizontal band. It improves cache usage. Not |
973 * all codecs can do that. You must check the codec capabilities | 1083 * all codecs can do that. You must check the codec capabilities |
974 * beforehand. | 1084 * beforehand. May be called by different threads at the same time. |
975 * The function is also used by hardware acceleration APIs. | 1085 * The function is also used by hardware acceleration APIs. |
976 * It is called at least once during frame decoding to pass | 1086 * It is called at least once during frame decoding to pass |
977 * the data needed for hardware render. | 1087 * the data needed for hardware render. |
978 * In that mode instead of pixel data, AVFrame points to | 1088 * In that mode instead of pixel data, AVFrame points to |
979 * a structure specific to the acceleration API. The application | 1089 * a structure specific to the acceleration API. The application |
980 * reads the structure and can change some fields to indicate progress | 1090 * reads the structure and can change some fields to indicate progress |
981 * or mark state. | 1091 * or mark state. |
982 * - encoding: unused | 1092 * - encoding: unused |
983 * - decoding: Set by user. | 1093 * - decoding: Set by user. |
984 * @param height the height of the slice | 1094 * @param height the height of the slice |
(...skipping 14 matching lines...) Expand all Loading... |
999 * - encoding: Set by user. | 1109 * - encoding: Set by user. |
1000 * - decoding: Set by libavcodec. | 1110 * - decoding: Set by libavcodec. |
1001 */ | 1111 */ |
1002 enum SampleFormat sample_fmt; ///< sample format, currently unused | 1112 enum SampleFormat sample_fmt; ///< sample format, currently unused |
1003 | 1113 |
1004 /* The following data should not be initialized. */ | 1114 /* The following data should not be initialized. */ |
1005 /** | 1115 /** |
1006 * Samples per packet, initialized when calling 'init'. | 1116 * Samples per packet, initialized when calling 'init'. |
1007 */ | 1117 */ |
1008 int frame_size; | 1118 int frame_size; |
1009 int frame_number; ///< audio or video frame number | 1119 int frame_number; ///< Number of audio or video frames returned so far |
1010 int real_pict_num; ///< Returns the real picture number of previous encoded
frame. | 1120 int real_pict_num; ///< Returns the real picture number of previous encoded
frame. |
1011 | 1121 |
1012 /** | 1122 /** |
1013 * Number of frames the decoded output will be delayed relative to | 1123 * Number of frames the decoded output will be delayed relative to |
1014 * the encoded input. | 1124 * the encoded input. |
1015 * - encoding: Set by libavcodec. | 1125 * - encoding: Set by libavcodec. |
1016 * - decoding: unused | 1126 * - decoding: unused |
1017 */ | 1127 */ |
1018 int delay; | 1128 int delay; |
1019 | 1129 |
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1209 #define FF_ER_CAREFUL 1 | 1319 #define FF_ER_CAREFUL 1 |
1210 #define FF_ER_COMPLIANT 2 | 1320 #define FF_ER_COMPLIANT 2 |
1211 #define FF_ER_AGGRESSIVE 3 | 1321 #define FF_ER_AGGRESSIVE 3 |
1212 #define FF_ER_VERY_AGGRESSIVE 4 | 1322 #define FF_ER_VERY_AGGRESSIVE 4 |
1213 | 1323 |
1214 /** | 1324 /** |
1215 * Called at the beginning of each frame to get a buffer for it. | 1325 * Called at the beginning of each frame to get a buffer for it. |
1216 * If pic.reference is set then the frame will be read later by libavcodec. | 1326 * If pic.reference is set then the frame will be read later by libavcodec. |
1217 * avcodec_align_dimensions() should be used to find the required width and | 1327 * avcodec_align_dimensions() should be used to find the required width and |
1218 * height, as they normally need to be rounded up to the next multiple of 16
. | 1328 * height, as they normally need to be rounded up to the next multiple of 16
. |
| 1329 * May be called by different threads if frame threading is enabled, but not |
| 1330 * by more than one at the same time. |
1219 * - encoding: unused | 1331 * - encoding: unused |
1220 * - decoding: Set by libavcodec., user can override. | 1332 * - decoding: Set by libavcodec., user can override. |
1221 */ | 1333 */ |
1222 int (*get_buffer)(struct AVCodecContext *c, AVFrame *pic); | 1334 int (*get_buffer)(struct AVCodecContext *c, AVFrame *pic); |
1223 | 1335 |
1224 /** | 1336 /** |
1225 * Called to release buffers which were allocated with get_buffer. | 1337 * Called to release buffers which were allocated with get_buffer. |
1226 * A released buffer can be reused in get_buffer(). | 1338 * A released buffer can be reused in get_buffer(). |
1227 * pic.data[*] must be set to NULL. | 1339 * pic.data[*] must be set to NULL. May be called by different threads |
| 1340 * if frame threading is enabled, but not more than one at the same time. |
| 1341 * |
1228 * - encoding: unused | 1342 * - encoding: unused |
1229 * - decoding: Set by libavcodec., user can override. | 1343 * - decoding: Set by libavcodec., user can override. |
1230 */ | 1344 */ |
1231 void (*release_buffer)(struct AVCodecContext *c, AVFrame *pic); | 1345 void (*release_buffer)(struct AVCodecContext *c, AVFrame *pic); |
1232 | 1346 |
1233 /** | 1347 /** |
1234 * Size of the frame reordering buffer in the decoder. | 1348 * Size of the frame reordering buffer in the decoder. |
1235 * For MPEG-2 it is 1 IPB or 0 low delay IP. | 1349 * For MPEG-2 it is 1 IPB or 0 low delay IP. |
1236 * - encoding: Set by libavcodec. | 1350 * - encoding: Set by libavcodec. |
1237 * - decoding: Set by libavcodec. | 1351 * - decoding: Set by libavcodec. |
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1449 * | 1563 * |
1450 * With the FORCE flag you may instead enable given CPU features. | 1564 * With the FORCE flag you may instead enable given CPU features. |
1451 * (Dangerous: Usable in case of misdetection, improper usage however will | 1565 * (Dangerous: Usable in case of misdetection, improper usage however will |
1452 * result into program crash.) | 1566 * result into program crash.) |
1453 */ | 1567 */ |
1454 unsigned dsp_mask; | 1568 unsigned dsp_mask; |
1455 #define FF_MM_FORCE 0x80000000 /* Force usage of selected flags (OR) */ | 1569 #define FF_MM_FORCE 0x80000000 /* Force usage of selected flags (OR) */ |
1456 /* lower 16 bits - CPU features */ | 1570 /* lower 16 bits - CPU features */ |
1457 #define FF_MM_MMX 0x0001 ///< standard MMX | 1571 #define FF_MM_MMX 0x0001 ///< standard MMX |
1458 #define FF_MM_3DNOW 0x0004 ///< AMD 3DNOW | 1572 #define FF_MM_3DNOW 0x0004 ///< AMD 3DNOW |
| 1573 #if LIBAVCODEC_VERSION_MAJOR < 53 |
1459 #define FF_MM_MMXEXT 0x0002 ///< SSE integer functions or AMD MMX ext | 1574 #define FF_MM_MMXEXT 0x0002 ///< SSE integer functions or AMD MMX ext |
| 1575 #endif |
| 1576 #define FF_MM_MMX2 0x0002 ///< SSE integer functions or AMD MMX ext |
1460 #define FF_MM_SSE 0x0008 ///< SSE functions | 1577 #define FF_MM_SSE 0x0008 ///< SSE functions |
1461 #define FF_MM_SSE2 0x0010 ///< PIV SSE2 functions | 1578 #define FF_MM_SSE2 0x0010 ///< PIV SSE2 functions |
1462 #define FF_MM_3DNOWEXT 0x0020 ///< AMD 3DNowExt | 1579 #define FF_MM_3DNOWEXT 0x0020 ///< AMD 3DNowExt |
1463 #define FF_MM_SSE3 0x0040 ///< Prescott SSE3 functions | 1580 #define FF_MM_SSE3 0x0040 ///< Prescott SSE3 functions |
1464 #define FF_MM_SSSE3 0x0080 ///< Conroe SSSE3 functions | 1581 #define FF_MM_SSSE3 0x0080 ///< Conroe SSSE3 functions |
| 1582 #define FF_MM_SSE4 0x0100 ///< Penryn SSE4.1 functions |
| 1583 #define FF_MM_SSE42 0x0200 ///< Nehalem SSE4.2 functions |
1465 #define FF_MM_IWMMXT 0x0100 ///< XScale IWMMXT | 1584 #define FF_MM_IWMMXT 0x0100 ///< XScale IWMMXT |
1466 #define FF_MM_ALTIVEC 0x0001 ///< standard AltiVec | 1585 #define FF_MM_ALTIVEC 0x0001 ///< standard AltiVec |
1467 | 1586 |
1468 /** | 1587 /** |
1469 * bits per sample/pixel from the demuxer (needed for huffyuv). | 1588 * bits per sample/pixel from the demuxer (needed for huffyuv). |
1470 * - encoding: Set by libavcodec. | 1589 * - encoding: Set by libavcodec. |
1471 * - decoding: Set by user. | 1590 * - decoding: Set by user. |
1472 */ | 1591 */ |
1473 int bits_per_coded_sample; | 1592 int bits_per_coded_sample; |
1474 | 1593 |
(...skipping 846 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2321 */ | 2440 */ |
2322 float rc_max_available_vbv_use; | 2441 float rc_max_available_vbv_use; |
2323 | 2442 |
2324 /** | 2443 /** |
2325 * Ratecontrol attempt to use, at least, <value> times the amount needed to
prevent a vbv overflow. | 2444 * Ratecontrol attempt to use, at least, <value> times the amount needed to
prevent a vbv overflow. |
2326 * - encoding: Set by user. | 2445 * - encoding: Set by user. |
2327 * - decoding: unused. | 2446 * - decoding: unused. |
2328 */ | 2447 */ |
2329 float rc_min_vbv_overflow_use; | 2448 float rc_min_vbv_overflow_use; |
2330 | 2449 |
2331 /** | 2450 » /** |
2332 * Hardware accelerator in use | 2451 * Hardware accelerator in use |
2333 * - encoding: unused. | 2452 * - encoding: unused. |
2334 * - decoding: Set by libavcodec | 2453 * - decoding: Set by libavcodec |
2335 */ | 2454 */ |
2336 struct AVHWAccel *hwaccel; | 2455 struct AVHWAccel *hwaccel; |
2337 | 2456 |
2338 /** | 2457 /** |
2339 * For some codecs, the time base is closer to the field rate than the frame
rate. | 2458 * 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 | 2459 * Most notably, H.264 and MPEG-2 specify time_base as half of frame duratio
n |
2341 * if no telecine is used ... | 2460 * if no telecine is used ... |
2342 * | 2461 * |
2343 * Set to time_base ticks per frame. Default 1, e.g., H.264/MPEG-2 set it to
2. | 2462 * Set to time_base ticks per frame. Default 1, e.g., H.264/MPEG-2 set it to
2. |
2344 */ | 2463 */ |
2345 int ticks_per_frame; | 2464 int ticks_per_frame; |
2346 | 2465 |
2347 /** | 2466 /** |
2348 * Hardware accelerator context. | 2467 * Hardware accelerator context. |
2349 * For some hardware accelerators, a global context needs to be | 2468 * For some hardware accelerators, a global context needs to be |
2350 * provided by the user. In that case, this holds display-dependent | 2469 * provided by the user. In that case, this holds display-dependent |
2351 * data FFmpeg cannot instantiate itself. Please refer to the | 2470 * data FFmpeg cannot instantiate itself. Please refer to the |
2352 * FFmpeg HW accelerator documentation to know how to fill this | 2471 * FFmpeg HW accelerator documentation to know how to fill this |
2353 * is. e.g. for VA API, this is a struct vaapi_context. | 2472 * is. e.g. for VA API, this is a struct vaapi_context. |
2354 * - encoding: unused | 2473 * - encoding: unused |
2355 * - decoding: Set by user | 2474 * - decoding: Set by user |
2356 */ | 2475 */ |
2357 void *hwaccel_context; | 2476 void *hwaccel_context; |
| 2477 |
| 2478 /** |
| 2479 * Chromaticity coordinates of the source primaries. |
| 2480 * - encoding: Set by user |
| 2481 * - decoding: Set by libavcodec |
| 2482 */ |
| 2483 enum AVColorPrimaries color_primaries; |
| 2484 |
| 2485 /** |
| 2486 * Color Transfer Characteristic. |
| 2487 * - encoding: Set by user |
| 2488 * - decoding: Set by libavcodec |
| 2489 */ |
| 2490 enum AVColorTransferCharacteristic color_trc; |
| 2491 |
| 2492 /** |
| 2493 * YUV colorspace type. |
| 2494 * - encoding: Set by user |
| 2495 * - decoding: Set by libavcodec |
| 2496 */ |
| 2497 enum AVColorSpace colorspace; |
| 2498 |
| 2499 /** |
| 2500 * MPEG vs JPEG YUV range. |
| 2501 * - encoding: Set by user |
| 2502 * - decoding: Set by libavcodec |
| 2503 */ |
| 2504 enum AVColorRange color_range; |
| 2505 |
| 2506 /** |
| 2507 * Whether this is a copy of the context which had init() called on it. |
| 2508 * This is used by multithreading - shared tables and picture pointers |
| 2509 * should be freed from the original context only. |
| 2510 * - encoding: Set by libavcodec. |
| 2511 * - decoding: Set by libavcodec. |
| 2512 */ |
| 2513 int is_copy; |
| 2514 |
| 2515 /** |
| 2516 * Which multithreading methods to use, for codecs that support more than on
e. |
| 2517 * - encoding: Set by user, otherwise the default is used. |
| 2518 * - decoding: Set by user, otherwise the default is used. |
| 2519 */ |
| 2520 int thread_type; |
| 2521 #define FF_THREAD_FRAME 1 //< Decode more than one frame at once |
| 2522 #define FF_THREAD_SLICE 2 //< Decode more than one part of a single frame at o
nce |
| 2523 #define FF_THREAD_DEFAULT 3 //< Use both if possible. |
| 2524 |
| 2525 /** |
| 2526 * Which multithreading methods are actually active at the moment. |
| 2527 * - encoding: Set by libavcodec. |
| 2528 * - decoding: Set by libavcodec. |
| 2529 */ |
| 2530 int active_thread_type; |
2358 } AVCodecContext; | 2531 } AVCodecContext; |
2359 | 2532 |
2360 /** | 2533 /** |
2361 * AVCodec. | 2534 * AVCodec. |
2362 */ | 2535 */ |
2363 typedef struct AVCodec { | 2536 typedef struct AVCodec { |
2364 /** | 2537 /** |
2365 * Name of the codec implementation. | 2538 * Name of the codec implementation. |
2366 * The name is globally unique among encoders and among decoders (but an | 2539 * The name is globally unique among encoders and among decoders (but an |
2367 * encoder and a decoder can share the same name). | 2540 * encoder and a decoder can share the same name). |
2368 * This is the primary way to find a codec from the user perspective. | 2541 * This is the primary way to find a codec from the user perspective. |
2369 */ | 2542 */ |
2370 const char *name; | 2543 const char *name; |
2371 enum CodecType type; | 2544 enum CodecType type; |
2372 enum CodecID id; | 2545 enum CodecID id; |
2373 int priv_data_size; | 2546 int priv_data_size; |
2374 int (*init)(AVCodecContext *); | 2547 int (*init)(AVCodecContext *); |
2375 int (*encode)(AVCodecContext *, uint8_t *buf, int buf_size, void *data); | 2548 int (*encode)(AVCodecContext *, uint8_t *buf, int buf_size, void *data); |
2376 int (*close)(AVCodecContext *); | 2549 int (*close)(AVCodecContext *); |
2377 int (*decode)(AVCodecContext *, void *outdata, int *outdata_size, | 2550 int (*decode)(AVCodecContext *, void *outdata, int *outdata_size, AVPacket *
avpkt); |
2378 const uint8_t *buf, int buf_size); | |
2379 /** | 2551 /** |
2380 * Codec capabilities. | 2552 * Codec capabilities. |
2381 * see CODEC_CAP_* | 2553 * see CODEC_CAP_* |
2382 */ | 2554 */ |
2383 int capabilities; | 2555 int capabilities; |
2384 struct AVCodec *next; | 2556 struct AVCodec *next; |
2385 /** | 2557 /** |
2386 * Flush buffers. | 2558 * Flush buffers. |
2387 * Will be called when seeking | 2559 * Will be called when seeking |
2388 */ | 2560 */ |
2389 void (*flush)(AVCodecContext *); | 2561 void (*flush)(AVCodecContext *); |
2390 const AVRational *supported_framerates; ///< array of supported framerates,
or NULL if any, array is terminated by {0,0} | 2562 const AVRational *supported_framerates; ///< array of supported framerates,
or NULL if any, array is terminated by {0,0} |
2391 const enum PixelFormat *pix_fmts; ///< array of supported pixel format
s, or NULL if unknown, array is terminated by -1 | 2563 const enum PixelFormat *pix_fmts; ///< array of supported pixel format
s, or NULL if unknown, array is terminated by -1 |
2392 /** | 2564 /** |
2393 * Descriptive name for the codec, meant to be more human readable than \p n
ame. | 2565 * Descriptive name for the codec, meant to be more human readable than \p n
ame. |
2394 * You \e should use the NULL_IF_CONFIG_SMALL() macro to define it. | 2566 * You \e should use the NULL_IF_CONFIG_SMALL() macro to define it. |
2395 */ | 2567 */ |
2396 const char *long_name; | 2568 const char *long_name; |
2397 const int *supported_samplerates; ///< array of supported audio sample
rates, or NULL if unknown, array is terminated by 0 | 2569 const int *supported_samplerates; ///< array of supported audio sample
rates, or NULL if unknown, array is terminated by 0 |
2398 const enum SampleFormat *sample_fmts; ///< array of supported sample forma
ts, or NULL if unknown, array is terminated by -1 | 2570 const enum SampleFormat *sample_fmts; ///< array of supported sample forma
ts, or NULL if unknown, array is terminated by -1 |
2399 const int64_t *channel_layouts; ///< array of support channel layout
s, or NULL if unknown. array is terminated by 0 | 2571 const int64_t *channel_layouts; ///< array of support channel layout
s, or NULL if unknown. array is terminated by 0 |
| 2572 |
| 2573 /** |
| 2574 * @defgroup framethreading Frame threading support functions. |
| 2575 * @{ |
| 2576 */ |
| 2577 /** |
| 2578 * If the codec allocates writable tables in init(), define init_copy() to r
e-allocate |
| 2579 * them in the copied contexts. Before calling it, priv_data will be set to
a copy of |
| 2580 * the original. |
| 2581 */ |
| 2582 int (*init_copy)(AVCodecContext *); |
| 2583 /** |
| 2584 * Copy all necessary context variables from the last thread before starting
the next one. |
| 2585 * If the codec doesn't define this, the next thread will start automaticall
y; otherwise, |
| 2586 * the codec must call ff_report_frame_setup_done(). Do not assume anything
about the |
| 2587 * contents of priv data except that it has been copied from the original so
me time after |
| 2588 * codec init. Will not be called if frame threading is disabled. |
| 2589 */ |
| 2590 int (*update_context)(AVCodecContext *, AVCodecContext *from); |
| 2591 /** @} */ |
2400 } AVCodec; | 2592 } AVCodec; |
2401 | 2593 |
2402 /** | 2594 /** |
2403 * AVHWAccel. | 2595 * AVHWAccel. |
2404 */ | 2596 */ |
2405 typedef struct AVHWAccel { | 2597 typedef struct AVHWAccel { |
2406 /** | 2598 /** |
2407 * Name of the hardware accelerated codec. | 2599 * Name of the hardware accelerated codec. |
2408 * The name is globally unique among encoders and among decoders (but an | 2600 * The name is globally unique among encoders and among decoders (but an |
2409 * encoder and a decoder can share the same name). | 2601 * encoder and a decoder can share the same name). |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2567 } AVSubtitleRect; | 2759 } AVSubtitleRect; |
2568 | 2760 |
2569 typedef struct AVSubtitle { | 2761 typedef struct AVSubtitle { |
2570 uint16_t format; /* 0 = graphics */ | 2762 uint16_t format; /* 0 = graphics */ |
2571 uint32_t start_display_time; /* relative to packet pts, in ms */ | 2763 uint32_t start_display_time; /* relative to packet pts, in ms */ |
2572 uint32_t end_display_time; /* relative to packet pts, in ms */ | 2764 uint32_t end_display_time; /* relative to packet pts, in ms */ |
2573 unsigned num_rects; | 2765 unsigned num_rects; |
2574 AVSubtitleRect **rects; | 2766 AVSubtitleRect **rects; |
2575 } AVSubtitle; | 2767 } AVSubtitle; |
2576 | 2768 |
| 2769 /* packet functions */ |
| 2770 |
| 2771 /** |
| 2772 * @deprecated use NULL instead |
| 2773 */ |
| 2774 attribute_deprecated void av_destruct_packet_nofree(AVPacket *pkt); |
| 2775 |
| 2776 /** |
| 2777 * Default packet destructor. |
| 2778 */ |
| 2779 void av_destruct_packet(AVPacket *pkt); |
| 2780 |
| 2781 /** |
| 2782 * Initialize optional fields of a packet with default values. |
| 2783 * |
| 2784 * @param pkt packet |
| 2785 */ |
| 2786 void av_init_packet(AVPacket *pkt); |
| 2787 |
| 2788 /** |
| 2789 * Allocate the payload of a packet and initialize its fields with |
| 2790 * default values. |
| 2791 * |
| 2792 * @param pkt packet |
| 2793 * @param size wanted payload size |
| 2794 * @return 0 if OK, AVERROR_xxx otherwise |
| 2795 */ |
| 2796 int av_new_packet(AVPacket *pkt, int size); |
| 2797 |
| 2798 /** |
| 2799 * Reduce packet size, correctly zeroing padding |
| 2800 * |
| 2801 * @param pkt packet |
| 2802 * @param size new size |
| 2803 */ |
| 2804 void av_shrink_packet(AVPacket *pkt, int size); |
| 2805 |
| 2806 /** |
| 2807 * @warning This is a hack - the packet memory allocation stuff is broken. The |
| 2808 * packet is allocated if it was not really allocated. |
| 2809 */ |
| 2810 int av_dup_packet(AVPacket *pkt); |
| 2811 |
| 2812 /** |
| 2813 * Free a packet. |
| 2814 * |
| 2815 * @param pkt packet to free |
| 2816 */ |
| 2817 void av_free_packet(AVPacket *pkt); |
2577 | 2818 |
2578 /* resample.c */ | 2819 /* resample.c */ |
2579 | 2820 |
2580 struct ReSampleContext; | 2821 struct ReSampleContext; |
2581 struct AVResampleContext; | 2822 struct AVResampleContext; |
2582 | 2823 |
2583 typedef struct ReSampleContext ReSampleContext; | 2824 typedef struct ReSampleContext ReSampleContext; |
2584 | 2825 |
2585 #if LIBAVCODEC_VERSION_MAJOR < 53 | 2826 #if LIBAVCODEC_VERSION_MAJOR < 53 |
2586 /** | 2827 /** |
(...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2958 * exit(1); | 3199 * exit(1); |
2959 * @endcode | 3200 * @endcode |
2960 * | 3201 * |
2961 * @param avctx The context which will be set up to use the given codec. | 3202 * @param avctx The context which will be set up to use the given codec. |
2962 * @param codec The codec to use within the context. | 3203 * @param codec The codec to use within the context. |
2963 * @return zero on success, a negative value on error | 3204 * @return zero on success, a negative value on error |
2964 * @see avcodec_alloc_context, avcodec_find_decoder, avcodec_find_encoder | 3205 * @see avcodec_alloc_context, avcodec_find_decoder, avcodec_find_encoder |
2965 */ | 3206 */ |
2966 int avcodec_open(AVCodecContext *avctx, AVCodec *codec); | 3207 int avcodec_open(AVCodecContext *avctx, AVCodec *codec); |
2967 | 3208 |
| 3209 #if LIBAVCODEC_VERSION_MAJOR < 53 |
2968 /** | 3210 /** |
2969 * Decodes an audio frame from \p buf into \p samples. | 3211 * Decodes an audio frame from \p buf into \p samples. |
2970 * The avcodec_decode_audio2() function decodes an audio frame from the input | 3212 * Wrapper function which calls avcodec_decode_audio3. |
2971 * buffer \p buf of size \p buf_size. To decode it, it makes use of the | 3213 * |
2972 * audio codec which was coupled with \p avctx using avcodec_open(). The | 3214 * @deprecated Use avcodec_decode_audio3 instead. |
2973 * resulting decoded frame is stored in output buffer \p samples. If no frame | 3215 * @param avctx the codec context |
| 3216 * @param[out] samples the output buffer |
| 3217 * @param[in,out] frame_size_ptr the output buffer size in bytes |
| 3218 * @param[in] buf the input buffer |
| 3219 * @param[in] buf_size the input buffer size in bytes |
| 3220 * @return On error a negative value is returned, otherwise the number of bytes |
| 3221 * used or zero if no frame could be decompressed. |
| 3222 */ |
| 3223 attribute_deprecated int avcodec_decode_audio2(AVCodecContext *avctx, int16_t *s
amples, |
| 3224 int *frame_size_ptr, |
| 3225 const uint8_t *buf, int buf_size); |
| 3226 #endif |
| 3227 |
| 3228 /** |
| 3229 * Decodes the audio frame of size avpkt->size from avpkt->data into samples. |
| 3230 * Some decoders may support multiple frames in a single AVPacket, such |
| 3231 * decoders would then just decode the first frame. |
| 3232 * If no frame |
2974 * could be decompressed, \p frame_size_ptr is zero. Otherwise, it is the | 3233 * could be decompressed, \p frame_size_ptr is zero. Otherwise, it is the |
2975 * decompressed frame size in \e bytes. | 3234 * decompressed frame size in \e bytes. |
2976 * | 3235 * |
2977 * @warning You \e must set \p frame_size_ptr to the allocated size of the | 3236 * @warning You \e must set \p frame_size_ptr to the allocated size of the |
2978 * output buffer before calling avcodec_decode_audio2(). | 3237 * output buffer before calling avcodec_decode_audio3(). |
2979 * | 3238 * |
2980 * @warning The input buffer must be \c FF_INPUT_BUFFER_PADDING_SIZE larger than | 3239 * @warning The input buffer must be \c FF_INPUT_BUFFER_PADDING_SIZE larger than |
2981 * the actual read bytes because some optimized bitstream readers read 32 or 64 | 3240 * the actual read bytes because some optimized bitstream readers read 32 or 64 |
2982 * bits at once and could read over the end. | 3241 * bits at once and could read over the end. |
2983 * | 3242 * |
2984 * @warning The end of the input buffer \p buf should be set to 0 to ensure that | 3243 * @warning The end of the input buffer \p avpkt->data should be set to 0 to ens
ure that |
2985 * no overreading happens for damaged MPEG streams. | 3244 * no overreading happens for damaged MPEG streams. |
2986 * | 3245 * |
2987 * @note You might have to align the input buffer \p buf and output buffer \p | 3246 * @note You might have to align the input buffer \p avpkt->data and output buff
er \p |
2988 * samples. The alignment requirements depend on the CPU: On some CPUs it isn't | 3247 * samples. The alignment requirements depend on the CPU: On some CPUs it isn't |
2989 * necessary at all, on others it won't work at all if not aligned and on others | 3248 * necessary at all, on others it won't work at all if not aligned and on others |
2990 * it will work but it will have an impact on performance. In practice, the | 3249 * it will work but it will have an impact on performance. In practice, the |
2991 * bitstream should have 4 byte alignment at minimum and all sample data should | 3250 * bitstream should have 4 byte alignment at minimum and all sample data should |
2992 * be 16 byte aligned unless the CPU doesn't need it (AltiVec and SSE do). If | 3251 * be 16 byte aligned unless the CPU doesn't need it (AltiVec and SSE do). If |
2993 * the linesize is not a multiple of 16 then there's no sense in aligning the | 3252 * the linesize is not a multiple of 16 then there's no sense in aligning the |
2994 * start of the buffer to 16. | 3253 * start of the buffer to 16. |
2995 * | 3254 * |
2996 * @param avctx the codec context | 3255 * @param avctx the codec context |
2997 * @param[out] samples the output buffer | 3256 * @param[out] samples the output buffer |
2998 * @param[in,out] frame_size_ptr the output buffer size in bytes | 3257 * @param[in,out] frame_size_ptr the output buffer size in bytes |
2999 * @param[in] buf the input buffer | 3258 * @param[in] avpkt The input AVPacket containing the input buffer. |
3000 * @param[in] buf_size the input buffer size in bytes | |
3001 * @return On error a negative value is returned, otherwise the number of bytes | 3259 * @return On error a negative value is returned, otherwise the number of bytes |
3002 * used or zero if no frame could be decompressed. | 3260 * used or zero if no frame could be decompressed. |
3003 */ | 3261 */ |
3004 int avcodec_decode_audio2(AVCodecContext *avctx, int16_t *samples, | 3262 int avcodec_decode_audio3(AVCodecContext *avctx, int16_t *samples, |
3005 int *frame_size_ptr, | 3263 int *frame_size_ptr, |
| 3264 AVPacket *avpkt); |
| 3265 |
| 3266 #if LIBAVCODEC_VERSION_MAJOR < 53 |
| 3267 /** |
| 3268 * Decodes a video frame from \p buf into \p picture. |
| 3269 * Wrapper function which calls avcodec_decode_video2. |
| 3270 * |
| 3271 * @deprecated Use avcodec_decode_video2 instead. |
| 3272 * @param avctx the codec context |
| 3273 * @param[out] picture The AVFrame in which the decoded video frame will be stor
ed. |
| 3274 * @param[in] buf the input buffer |
| 3275 * @param[in] buf_size the size of the input buffer in bytes |
| 3276 * @param[in,out] got_picture_ptr Zero if no frame could be decompressed, otherw
ise, it is nonzero. |
| 3277 * @return On error a negative value is returned, otherwise the number of bytes |
| 3278 * used or zero if no frame could be decompressed. |
| 3279 */ |
| 3280 attribute_deprecated int avcodec_decode_video(AVCodecContext *avctx, AVFrame *pi
cture, |
| 3281 int *got_picture_ptr, |
3006 const uint8_t *buf, int buf_size); | 3282 const uint8_t *buf, int buf_size); |
| 3283 #endif |
3007 | 3284 |
3008 /** | 3285 /** |
3009 * Decodes a video frame from \p buf into \p picture. | 3286 * Decodes the video frame of size avpkt->size from avpkt->data into picture. |
3010 * The avcodec_decode_video() function decodes a video frame from the input | 3287 * Some decoders may support multiple frames in a single AVPacket, such |
3011 * buffer \p buf of size \p buf_size. To decode it, it makes use of the | 3288 * decoders would then just decode the first frame. |
3012 * video codec which was coupled with \p avctx using avcodec_open(). The | |
3013 * resulting decoded frame is stored in \p picture. | |
3014 * | 3289 * |
3015 * @warning The input buffer must be \c FF_INPUT_BUFFER_PADDING_SIZE larger than | 3290 * @warning The input buffer must be \c FF_INPUT_BUFFER_PADDING_SIZE larger than |
3016 * the actual read bytes because some optimized bitstream readers read 32 or 64 | 3291 * the actual read bytes because some optimized bitstream readers read 32 or 64 |
3017 * bits at once and could read over the end. | 3292 * bits at once and could read over the end. |
3018 * | 3293 * |
3019 * @warning The end of the input buffer \p buf should be set to 0 to ensure that | 3294 * @warning The end of the input buffer \p buf should be set to 0 to ensure that |
3020 * no overreading happens for damaged MPEG streams. | 3295 * no overreading happens for damaged MPEG streams. |
3021 * | 3296 * |
3022 * @note You might have to align the input buffer \p buf and output buffer \p | 3297 * @note You might have to align the input buffer \p avpkt->data and output buff
er \p |
3023 * samples. The alignment requirements depend on the CPU: on some CPUs it isn't | 3298 * samples. The alignment requirements depend on the CPU: on some CPUs it isn't |
3024 * necessary at all, on others it won't work at all if not aligned and on others | 3299 * necessary at all, on others it won't work at all if not aligned and on others |
3025 * it will work but it will have an impact on performance. In practice, the | 3300 * it will work but it will have an impact on performance. In practice, the |
3026 * bitstream should have 4 byte alignment at minimum and all sample data should | 3301 * bitstream should have 4 byte alignment at minimum and all sample data should |
3027 * be 16 byte aligned unless the CPU doesn't need it (AltiVec and SSE do). If | 3302 * be 16 byte aligned unless the CPU doesn't need it (AltiVec and SSE do). If |
3028 * the linesize is not a multiple of 16 then there's no sense in aligning the | 3303 * the linesize is not a multiple of 16 then there's no sense in aligning the |
3029 * start of the buffer to 16. | 3304 * start of the buffer to 16. |
3030 * | 3305 * |
3031 * @note Some codecs have a delay between input and output, these need to be | 3306 * @note Some codecs have a delay between input and output, these need to be |
3032 * feeded with buf=NULL, buf_size=0 at the end to return the remaining frames. | 3307 * feeded with avpkt->data=NULL, avpkt->size=0 at the end to return the remainin
g frames. |
3033 * | 3308 * |
3034 * @param avctx the codec context | 3309 * @param avctx the codec context |
3035 * @param[out] picture The AVFrame in which the decoded video frame will be stor
ed. | 3310 * @param[out] picture The AVFrame in which the decoded video frame will be stor
ed. |
3036 * @param[in] buf the input buffer | 3311 * @param[in] avpkt The input AVpacket containing the input buffer. |
3037 * @param[in] buf_size the size of the input buffer in bytes | |
3038 * @param[in,out] got_picture_ptr Zero if no frame could be decompressed, otherw
ise, it is nonzero. | 3312 * @param[in,out] got_picture_ptr Zero if no frame could be decompressed, otherw
ise, it is nonzero. |
3039 * @return On error a negative value is returned, otherwise the number of bytes | 3313 * @return On error a negative value is returned, otherwise the number of bytes |
3040 * used or zero if no frame could be decompressed. | 3314 * used or zero if no frame could be decompressed. |
3041 */ | 3315 */ |
3042 int avcodec_decode_video(AVCodecContext *avctx, AVFrame *picture, | 3316 int avcodec_decode_video2(AVCodecContext *avctx, AVFrame *picture, |
3043 int *got_picture_ptr, | 3317 int *got_picture_ptr, |
3044 const uint8_t *buf, int buf_size); | 3318 AVPacket *avpkt); |
3045 | 3319 |
| 3320 #if LIBAVCODEC_VERSION_MAJOR < 53 |
3046 /* Decode a subtitle message. Return -1 if error, otherwise return the | 3321 /* Decode a subtitle message. Return -1 if error, otherwise return the |
3047 * number of bytes used. If no subtitle could be decompressed, | 3322 * number of bytes used. If no subtitle could be decompressed, |
3048 * got_sub_ptr is zero. Otherwise, the subtitle is stored in *sub. */ | 3323 * got_sub_ptr is zero. Otherwise, the subtitle is stored in *sub. */ |
3049 int avcodec_decode_subtitle(AVCodecContext *avctx, AVSubtitle *sub, | 3324 attribute_deprecated int avcodec_decode_subtitle(AVCodecContext *avctx, AVSubtit
le *sub, |
3050 int *got_sub_ptr, | 3325 int *got_sub_ptr, |
3051 const uint8_t *buf, int buf_size); | 3326 const uint8_t *buf, int buf_size); |
| 3327 #endif |
| 3328 |
| 3329 /** |
| 3330 * Decodes a subtitle message. |
| 3331 * Returns a negative value on error, otherwise returns the number of bytes used
. |
| 3332 * If no subtitle could be decompressed, \p got_sub_ptr is zero. |
| 3333 * Otherwise, the subtitle is stored in \p *sub. |
| 3334 * |
| 3335 * @param avctx the codec context |
| 3336 * @param[out] sub The AVSubtitle in which the decoded subtitle will be stored. |
| 3337 * @param[in,out] got_sub_ptr Zero if no subtitle could be decompressed, otherwi
se, it is nonzero. |
| 3338 * @param[in] avpkt The input AVPacket containing the input buffer. |
| 3339 */ |
| 3340 int avcodec_decode_subtitle2(AVCodecContext *avctx, AVSubtitle *sub, |
| 3341 int *got_sub_ptr, |
| 3342 AVPacket *avpkt); |
3052 int avcodec_parse_frame(AVCodecContext *avctx, uint8_t **pdata, | 3343 int avcodec_parse_frame(AVCodecContext *avctx, uint8_t **pdata, |
3053 int *data_size_ptr, | 3344 int *data_size_ptr, |
3054 uint8_t *buf, int buf_size); | 3345 uint8_t *buf, int buf_size); |
3055 | 3346 |
3056 /** | 3347 /** |
3057 * Encodes an audio frame from \p samples into \p buf. | 3348 * Encodes an audio frame from \p samples into \p buf. |
3058 * The avcodec_encode_audio() function encodes an audio frame from the input | |
3059 * buffer \p samples. To encode it, it makes use of the audio codec which was | |
3060 * coupled with \p avctx using avcodec_open(). The resulting encoded frame is | |
3061 * stored in output buffer \p buf. | |
3062 * | 3349 * |
3063 * @note The output buffer should be at least \c FF_MIN_BUFFER_SIZE bytes large. | 3350 * @note The output buffer should be at least \c FF_MIN_BUFFER_SIZE bytes large. |
| 3351 * However, for PCM audio the user will know how much space is needed |
| 3352 * because it depends on the value passed in \p buf_size as described |
| 3353 * below. In that case a lower value can be used. |
3064 * | 3354 * |
3065 * @param avctx the codec context | 3355 * @param avctx the codec context |
3066 * @param[out] buf the output buffer | 3356 * @param[out] buf the output buffer |
3067 * @param[in] buf_size the output buffer size | 3357 * @param[in] buf_size the output buffer size |
3068 * @param[in] samples the input buffer containing the samples | 3358 * @param[in] samples the input buffer containing the samples |
3069 * The number of samples read from this buffer is frame_size*channels, | 3359 * The number of samples read from this buffer is frame_size*channels, |
3070 * both of which are defined in \p avctx. | 3360 * both of which are defined in \p avctx. |
3071 * For PCM audio the number of samples read from \p samples is equal to | 3361 * For PCM audio the number of samples read from \p samples is equal to |
3072 * \p buf_size * input_sample_size / output_sample_size. | 3362 * \p buf_size * input_sample_size / output_sample_size. |
3073 * @return On error a negative value is returned, on success zero or the number | 3363 * @return On error a negative value is returned, on success zero or the number |
3074 * of bytes used to encode the data read from the input buffer. | 3364 * of bytes used to encode the data read from the input buffer. |
3075 */ | 3365 */ |
3076 int avcodec_encode_audio(AVCodecContext *avctx, uint8_t *buf, int buf_size, | 3366 int avcodec_encode_audio(AVCodecContext *avctx, uint8_t *buf, int buf_size, |
3077 const short *samples); | 3367 const short *samples); |
3078 | 3368 |
3079 /** | 3369 /** |
3080 * Encodes a video frame from \p pict into \p buf. | 3370 * Encodes a video frame from \p pict into \p buf. |
3081 * The avcodec_encode_video() function encodes a video frame from the input | 3371 * The input picture should be |
3082 * \p pict. To encode it, it makes use of the video codec which was coupled with | |
3083 * \p avctx using avcodec_open(). The resulting encoded bytes representing the | |
3084 * frame are stored in the output buffer \p buf. The input picture should be | |
3085 * stored using a specific format, namely \c avctx.pix_fmt. | 3372 * stored using a specific format, namely \c avctx.pix_fmt. |
3086 * | 3373 * |
3087 * @param avctx the codec context | 3374 * @param avctx the codec context |
3088 * @param[out] buf the output buffer for the bitstream of encoded frame | 3375 * @param[out] buf the output buffer for the bitstream of encoded frame |
3089 * @param[in] buf_size the size of the output buffer in bytes | 3376 * @param[in] buf_size the size of the output buffer in bytes |
3090 * @param[in] pict the input picture to encode | 3377 * @param[in] pict the input picture to encode |
3091 * @return On error a negative value is returned, on success zero or the number | 3378 * @return On error a negative value is returned, on success zero or the number |
3092 * of bytes used from the output buffer. | 3379 * of bytes used from the output buffer. |
3093 */ | 3380 */ |
3094 int avcodec_encode_video(AVCodecContext *avctx, uint8_t *buf, int buf_size, | 3381 int avcodec_encode_video(AVCodecContext *avctx, uint8_t *buf, int buf_size, |
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3369 | 3656 |
3370 /** | 3657 /** |
3371 * Reallocates the given block if it is not large enough, otherwise it | 3658 * Reallocates the given block if it is not large enough, otherwise it |
3372 * does nothing. | 3659 * does nothing. |
3373 * | 3660 * |
3374 * @see av_realloc | 3661 * @see av_realloc |
3375 */ | 3662 */ |
3376 void *av_fast_realloc(void *ptr, unsigned int *size, unsigned int min_size); | 3663 void *av_fast_realloc(void *ptr, unsigned int *size, unsigned int min_size); |
3377 | 3664 |
3378 /** | 3665 /** |
| 3666 * Allocates a buffer, reusing the given one if large enough. |
| 3667 * |
| 3668 * Contrary to av_fast_realloc the current buffer contents might not be |
| 3669 * preserved and on error the old buffer is freed, thus no special |
| 3670 * handling to avoid memleaks is necessary. |
| 3671 * |
| 3672 * @param ptr pointer to pointer to already allocated buffer, overwritten with p
ointer to new buffer |
| 3673 * @param size size of the buffer *ptr points to |
| 3674 * @param min_size minimum size of *ptr buffer after returning, *ptr will be NUL
L and |
| 3675 * *size 0 if an error occurred. |
| 3676 */ |
| 3677 void av_fast_malloc(void *ptr, unsigned int *size, unsigned int min_size); |
| 3678 |
| 3679 /** |
3379 * Copy image 'src' to 'dst'. | 3680 * Copy image 'src' to 'dst'. |
3380 */ | 3681 */ |
3381 void av_picture_copy(AVPicture *dst, const AVPicture *src, | 3682 void av_picture_copy(AVPicture *dst, const AVPicture *src, |
3382 enum PixelFormat pix_fmt, int width, int height); | 3683 enum PixelFormat pix_fmt, int width, int height); |
3383 | 3684 |
3384 /** | 3685 /** |
3385 * Crop image top and left side. | 3686 * Crop image top and left side. |
3386 */ | 3687 */ |
3387 int av_picture_crop(AVPicture *dst, const AVPicture *src, | 3688 int av_picture_crop(AVPicture *dst, const AVPicture *src, |
3388 enum PixelFormat pix_fmt, int top_band, int left_band); | 3689 enum PixelFormat pix_fmt, int top_band, int left_band); |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3445 void av_register_hwaccel(AVHWAccel *hwaccel); | 3746 void av_register_hwaccel(AVHWAccel *hwaccel); |
3446 | 3747 |
3447 /** | 3748 /** |
3448 * If hwaccel is NULL, returns the first registered hardware accelerator, | 3749 * If hwaccel is NULL, returns the first registered hardware accelerator, |
3449 * if hwaccel is non-NULL, returns the next registered hardware accelerator | 3750 * if hwaccel is non-NULL, returns the next registered hardware accelerator |
3450 * after hwaccel, or NULL if hwaccel is the last one. | 3751 * after hwaccel, or NULL if hwaccel is the last one. |
3451 */ | 3752 */ |
3452 AVHWAccel *av_hwaccel_next(AVHWAccel *hwaccel); | 3753 AVHWAccel *av_hwaccel_next(AVHWAccel *hwaccel); |
3453 | 3754 |
3454 #endif /* AVCODEC_AVCODEC_H */ | 3755 #endif /* AVCODEC_AVCODEC_H */ |
OLD | NEW |