You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

4255 lines
138KB

  1. /*
  2. * copyright (c) 2001 Fabrice Bellard
  3. *
  4. * This file is part of Libav.
  5. *
  6. * Libav is free software; you can redistribute it and/or
  7. * modify it under the terms of the GNU Lesser General Public
  8. * License as published by the Free Software Foundation; either
  9. * version 2.1 of the License, or (at your option) any later version.
  10. *
  11. * Libav is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  14. * Lesser General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU Lesser General Public
  17. * License along with Libav; if not, write to the Free Software
  18. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  19. */
  20. #ifndef AVCODEC_AVCODEC_H
  21. #define AVCODEC_AVCODEC_H
  22. /**
  23. * @file
  24. * external API header
  25. */
  26. #include <errno.h>
  27. #include "libavutil/samplefmt.h"
  28. #include "libavutil/avutil.h"
  29. #include "libavutil/cpu.h"
  30. #include "libavutil/dict.h"
  31. #include "libavutil/log.h"
  32. #include "libavutil/pixfmt.h"
  33. #include "libavutil/rational.h"
  34. #include "libavcodec/version.h"
  35. /**
  36. * @defgroup libavc Encoding/Decoding Library
  37. * @{
  38. *
  39. * @defgroup lavc_decoding Decoding
  40. * @{
  41. * @}
  42. *
  43. * @defgroup lavc_encoding Encoding
  44. * @{
  45. * @}
  46. *
  47. * @defgroup lavc_codec Codecs
  48. * @{
  49. * @defgroup lavc_codec_native Native Codecs
  50. * @{
  51. * @}
  52. * @defgroup lavc_codec_wrappers External library wrappers
  53. * @{
  54. * @}
  55. * @defgroup lavc_codec_hwaccel Hardware Accelerators bridge
  56. * @{
  57. * @}
  58. * @}
  59. * @defgroup lavc_internal Internal
  60. * @{
  61. * @}
  62. * @}
  63. *
  64. */
  65. /**
  66. * Identify the syntax and semantics of the bitstream.
  67. * The principle is roughly:
  68. * Two decoders with the same ID can decode the same streams.
  69. * Two encoders with the same ID can encode compatible streams.
  70. * There may be slight deviations from the principle due to implementation
  71. * details.
  72. *
  73. * If you add a codec ID to this list, add it so that
  74. * 1. no value of a existing codec ID changes (that would break ABI),
  75. * 2. it is as close as possible to similar codecs.
  76. */
  77. enum CodecID {
  78. CODEC_ID_NONE,
  79. /* video codecs */
  80. CODEC_ID_MPEG1VIDEO,
  81. CODEC_ID_MPEG2VIDEO, ///< preferred ID for MPEG-1/2 video decoding
  82. CODEC_ID_MPEG2VIDEO_XVMC,
  83. CODEC_ID_H261,
  84. CODEC_ID_H263,
  85. CODEC_ID_RV10,
  86. CODEC_ID_RV20,
  87. CODEC_ID_MJPEG,
  88. CODEC_ID_MJPEGB,
  89. CODEC_ID_LJPEG,
  90. CODEC_ID_SP5X,
  91. CODEC_ID_JPEGLS,
  92. CODEC_ID_MPEG4,
  93. CODEC_ID_RAWVIDEO,
  94. CODEC_ID_MSMPEG4V1,
  95. CODEC_ID_MSMPEG4V2,
  96. CODEC_ID_MSMPEG4V3,
  97. CODEC_ID_WMV1,
  98. CODEC_ID_WMV2,
  99. CODEC_ID_H263P,
  100. CODEC_ID_H263I,
  101. CODEC_ID_FLV1,
  102. CODEC_ID_SVQ1,
  103. CODEC_ID_SVQ3,
  104. CODEC_ID_DVVIDEO,
  105. CODEC_ID_HUFFYUV,
  106. CODEC_ID_CYUV,
  107. CODEC_ID_H264,
  108. CODEC_ID_INDEO3,
  109. CODEC_ID_VP3,
  110. CODEC_ID_THEORA,
  111. CODEC_ID_ASV1,
  112. CODEC_ID_ASV2,
  113. CODEC_ID_FFV1,
  114. CODEC_ID_4XM,
  115. CODEC_ID_VCR1,
  116. CODEC_ID_CLJR,
  117. CODEC_ID_MDEC,
  118. CODEC_ID_ROQ,
  119. CODEC_ID_INTERPLAY_VIDEO,
  120. CODEC_ID_XAN_WC3,
  121. CODEC_ID_XAN_WC4,
  122. CODEC_ID_RPZA,
  123. CODEC_ID_CINEPAK,
  124. CODEC_ID_WS_VQA,
  125. CODEC_ID_MSRLE,
  126. CODEC_ID_MSVIDEO1,
  127. CODEC_ID_IDCIN,
  128. CODEC_ID_8BPS,
  129. CODEC_ID_SMC,
  130. CODEC_ID_FLIC,
  131. CODEC_ID_TRUEMOTION1,
  132. CODEC_ID_VMDVIDEO,
  133. CODEC_ID_MSZH,
  134. CODEC_ID_ZLIB,
  135. CODEC_ID_QTRLE,
  136. CODEC_ID_SNOW,
  137. CODEC_ID_TSCC,
  138. CODEC_ID_ULTI,
  139. CODEC_ID_QDRAW,
  140. CODEC_ID_VIXL,
  141. CODEC_ID_QPEG,
  142. CODEC_ID_PNG,
  143. CODEC_ID_PPM,
  144. CODEC_ID_PBM,
  145. CODEC_ID_PGM,
  146. CODEC_ID_PGMYUV,
  147. CODEC_ID_PAM,
  148. CODEC_ID_FFVHUFF,
  149. CODEC_ID_RV30,
  150. CODEC_ID_RV40,
  151. CODEC_ID_VC1,
  152. CODEC_ID_WMV3,
  153. CODEC_ID_LOCO,
  154. CODEC_ID_WNV1,
  155. CODEC_ID_AASC,
  156. CODEC_ID_INDEO2,
  157. CODEC_ID_FRAPS,
  158. CODEC_ID_TRUEMOTION2,
  159. CODEC_ID_BMP,
  160. CODEC_ID_CSCD,
  161. CODEC_ID_MMVIDEO,
  162. CODEC_ID_ZMBV,
  163. CODEC_ID_AVS,
  164. CODEC_ID_SMACKVIDEO,
  165. CODEC_ID_NUV,
  166. CODEC_ID_KMVC,
  167. CODEC_ID_FLASHSV,
  168. CODEC_ID_CAVS,
  169. CODEC_ID_JPEG2000,
  170. CODEC_ID_VMNC,
  171. CODEC_ID_VP5,
  172. CODEC_ID_VP6,
  173. CODEC_ID_VP6F,
  174. CODEC_ID_TARGA,
  175. CODEC_ID_DSICINVIDEO,
  176. CODEC_ID_TIERTEXSEQVIDEO,
  177. CODEC_ID_TIFF,
  178. CODEC_ID_GIF,
  179. #if LIBAVCODEC_VERSION_MAJOR == 53
  180. CODEC_ID_FFH264,
  181. #endif
  182. CODEC_ID_DXA,
  183. CODEC_ID_DNXHD,
  184. CODEC_ID_THP,
  185. CODEC_ID_SGI,
  186. CODEC_ID_C93,
  187. CODEC_ID_BETHSOFTVID,
  188. CODEC_ID_PTX,
  189. CODEC_ID_TXD,
  190. CODEC_ID_VP6A,
  191. CODEC_ID_AMV,
  192. CODEC_ID_VB,
  193. CODEC_ID_PCX,
  194. CODEC_ID_SUNRAST,
  195. CODEC_ID_INDEO4,
  196. CODEC_ID_INDEO5,
  197. CODEC_ID_MIMIC,
  198. CODEC_ID_RL2,
  199. #if LIBAVCODEC_VERSION_MAJOR == 53
  200. CODEC_ID_8SVX_EXP,
  201. CODEC_ID_8SVX_FIB,
  202. #endif
  203. CODEC_ID_ESCAPE124,
  204. CODEC_ID_DIRAC,
  205. CODEC_ID_BFI,
  206. CODEC_ID_CMV,
  207. CODEC_ID_MOTIONPIXELS,
  208. CODEC_ID_TGV,
  209. CODEC_ID_TGQ,
  210. CODEC_ID_TQI,
  211. CODEC_ID_AURA,
  212. CODEC_ID_AURA2,
  213. CODEC_ID_V210X,
  214. CODEC_ID_TMV,
  215. CODEC_ID_V210,
  216. CODEC_ID_DPX,
  217. CODEC_ID_MAD,
  218. CODEC_ID_FRWU,
  219. CODEC_ID_FLASHSV2,
  220. CODEC_ID_CDGRAPHICS,
  221. CODEC_ID_R210,
  222. CODEC_ID_ANM,
  223. CODEC_ID_BINKVIDEO,
  224. CODEC_ID_IFF_ILBM,
  225. CODEC_ID_IFF_BYTERUN1,
  226. CODEC_ID_KGV1,
  227. CODEC_ID_YOP,
  228. CODEC_ID_VP8,
  229. CODEC_ID_PICTOR,
  230. CODEC_ID_ANSI,
  231. CODEC_ID_A64_MULTI,
  232. CODEC_ID_A64_MULTI5,
  233. CODEC_ID_R10K,
  234. CODEC_ID_MXPEG,
  235. CODEC_ID_LAGARITH,
  236. CODEC_ID_PRORES,
  237. CODEC_ID_JV,
  238. CODEC_ID_DFA,
  239. CODEC_ID_WMV3IMAGE,
  240. CODEC_ID_VC1IMAGE,
  241. #if LIBAVCODEC_VERSION_MAJOR == 53
  242. CODEC_ID_G723_1,
  243. CODEC_ID_G729,
  244. #endif
  245. CODEC_ID_UTVIDEO,
  246. CODEC_ID_BMV_VIDEO,
  247. CODEC_ID_VBLE,
  248. CODEC_ID_DXTORY,
  249. CODEC_ID_V410,
  250. CODEC_ID_XWD,
  251. /* various PCM "codecs" */
  252. CODEC_ID_FIRST_AUDIO = 0x10000, ///< A dummy id pointing at the start of audio codecs
  253. CODEC_ID_PCM_S16LE = 0x10000,
  254. CODEC_ID_PCM_S16BE,
  255. CODEC_ID_PCM_U16LE,
  256. CODEC_ID_PCM_U16BE,
  257. CODEC_ID_PCM_S8,
  258. CODEC_ID_PCM_U8,
  259. CODEC_ID_PCM_MULAW,
  260. CODEC_ID_PCM_ALAW,
  261. CODEC_ID_PCM_S32LE,
  262. CODEC_ID_PCM_S32BE,
  263. CODEC_ID_PCM_U32LE,
  264. CODEC_ID_PCM_U32BE,
  265. CODEC_ID_PCM_S24LE,
  266. CODEC_ID_PCM_S24BE,
  267. CODEC_ID_PCM_U24LE,
  268. CODEC_ID_PCM_U24BE,
  269. CODEC_ID_PCM_S24DAUD,
  270. CODEC_ID_PCM_ZORK,
  271. CODEC_ID_PCM_S16LE_PLANAR,
  272. CODEC_ID_PCM_DVD,
  273. CODEC_ID_PCM_F32BE,
  274. CODEC_ID_PCM_F32LE,
  275. CODEC_ID_PCM_F64BE,
  276. CODEC_ID_PCM_F64LE,
  277. CODEC_ID_PCM_BLURAY,
  278. CODEC_ID_PCM_LXF,
  279. CODEC_ID_S302M,
  280. CODEC_ID_PCM_S8_PLANAR,
  281. /* various ADPCM codecs */
  282. CODEC_ID_ADPCM_IMA_QT = 0x11000,
  283. CODEC_ID_ADPCM_IMA_WAV,
  284. CODEC_ID_ADPCM_IMA_DK3,
  285. CODEC_ID_ADPCM_IMA_DK4,
  286. CODEC_ID_ADPCM_IMA_WS,
  287. CODEC_ID_ADPCM_IMA_SMJPEG,
  288. CODEC_ID_ADPCM_MS,
  289. CODEC_ID_ADPCM_4XM,
  290. CODEC_ID_ADPCM_XA,
  291. CODEC_ID_ADPCM_ADX,
  292. CODEC_ID_ADPCM_EA,
  293. CODEC_ID_ADPCM_G726,
  294. CODEC_ID_ADPCM_CT,
  295. CODEC_ID_ADPCM_SWF,
  296. CODEC_ID_ADPCM_YAMAHA,
  297. CODEC_ID_ADPCM_SBPRO_4,
  298. CODEC_ID_ADPCM_SBPRO_3,
  299. CODEC_ID_ADPCM_SBPRO_2,
  300. CODEC_ID_ADPCM_THP,
  301. CODEC_ID_ADPCM_IMA_AMV,
  302. CODEC_ID_ADPCM_EA_R1,
  303. CODEC_ID_ADPCM_EA_R3,
  304. CODEC_ID_ADPCM_EA_R2,
  305. CODEC_ID_ADPCM_IMA_EA_SEAD,
  306. CODEC_ID_ADPCM_IMA_EA_EACS,
  307. CODEC_ID_ADPCM_EA_XAS,
  308. CODEC_ID_ADPCM_EA_MAXIS_XA,
  309. CODEC_ID_ADPCM_IMA_ISS,
  310. CODEC_ID_ADPCM_G722,
  311. CODEC_ID_ADPCM_IMA_APC,
  312. /* AMR */
  313. CODEC_ID_AMR_NB = 0x12000,
  314. CODEC_ID_AMR_WB,
  315. /* RealAudio codecs*/
  316. CODEC_ID_RA_144 = 0x13000,
  317. CODEC_ID_RA_288,
  318. /* various DPCM codecs */
  319. CODEC_ID_ROQ_DPCM = 0x14000,
  320. CODEC_ID_INTERPLAY_DPCM,
  321. CODEC_ID_XAN_DPCM,
  322. CODEC_ID_SOL_DPCM,
  323. /* audio codecs */
  324. CODEC_ID_MP2 = 0x15000,
  325. CODEC_ID_MP3, ///< preferred ID for decoding MPEG audio layer 1, 2 or 3
  326. CODEC_ID_AAC,
  327. CODEC_ID_AC3,
  328. CODEC_ID_DTS,
  329. CODEC_ID_VORBIS,
  330. CODEC_ID_DVAUDIO,
  331. CODEC_ID_WMAV1,
  332. CODEC_ID_WMAV2,
  333. CODEC_ID_MACE3,
  334. CODEC_ID_MACE6,
  335. CODEC_ID_VMDAUDIO,
  336. #if LIBAVCODEC_VERSION_MAJOR == 53
  337. CODEC_ID_SONIC,
  338. CODEC_ID_SONIC_LS,
  339. #endif
  340. CODEC_ID_FLAC,
  341. CODEC_ID_MP3ADU,
  342. CODEC_ID_MP3ON4,
  343. CODEC_ID_SHORTEN,
  344. CODEC_ID_ALAC,
  345. CODEC_ID_WESTWOOD_SND1,
  346. CODEC_ID_GSM, ///< as in Berlin toast format
  347. CODEC_ID_QDM2,
  348. CODEC_ID_COOK,
  349. CODEC_ID_TRUESPEECH,
  350. CODEC_ID_TTA,
  351. CODEC_ID_SMACKAUDIO,
  352. CODEC_ID_QCELP,
  353. CODEC_ID_WAVPACK,
  354. CODEC_ID_DSICINAUDIO,
  355. CODEC_ID_IMC,
  356. CODEC_ID_MUSEPACK7,
  357. CODEC_ID_MLP,
  358. CODEC_ID_GSM_MS, /* as found in WAV */
  359. CODEC_ID_ATRAC3,
  360. CODEC_ID_VOXWARE,
  361. CODEC_ID_APE,
  362. CODEC_ID_NELLYMOSER,
  363. CODEC_ID_MUSEPACK8,
  364. CODEC_ID_SPEEX,
  365. CODEC_ID_WMAVOICE,
  366. CODEC_ID_WMAPRO,
  367. CODEC_ID_WMALOSSLESS,
  368. CODEC_ID_ATRAC3P,
  369. CODEC_ID_EAC3,
  370. CODEC_ID_SIPR,
  371. CODEC_ID_MP1,
  372. CODEC_ID_TWINVQ,
  373. CODEC_ID_TRUEHD,
  374. CODEC_ID_MP4ALS,
  375. CODEC_ID_ATRAC1,
  376. CODEC_ID_BINKAUDIO_RDFT,
  377. CODEC_ID_BINKAUDIO_DCT,
  378. CODEC_ID_AAC_LATM,
  379. CODEC_ID_QDMC,
  380. CODEC_ID_CELT,
  381. #if LIBAVCODEC_VERSION_MAJOR > 53
  382. CODEC_ID_G723_1,
  383. CODEC_ID_G729,
  384. CODEC_ID_8SVX_EXP,
  385. CODEC_ID_8SVX_FIB,
  386. #endif
  387. CODEC_ID_BMV_AUDIO,
  388. /* subtitle codecs */
  389. CODEC_ID_FIRST_SUBTITLE = 0x17000, ///< A dummy ID pointing at the start of subtitle codecs.
  390. CODEC_ID_DVD_SUBTITLE = 0x17000,
  391. CODEC_ID_DVB_SUBTITLE,
  392. CODEC_ID_TEXT, ///< raw UTF-8 text
  393. CODEC_ID_XSUB,
  394. CODEC_ID_SSA,
  395. CODEC_ID_MOV_TEXT,
  396. CODEC_ID_HDMV_PGS_SUBTITLE,
  397. CODEC_ID_DVB_TELETEXT,
  398. CODEC_ID_SRT,
  399. /* other specific kind of codecs (generally used for attachments) */
  400. CODEC_ID_FIRST_UNKNOWN = 0x18000, ///< A dummy ID pointing at the start of various fake codecs.
  401. CODEC_ID_TTF = 0x18000,
  402. CODEC_ID_PROBE = 0x19000, ///< codec_id is not known (like CODEC_ID_NONE) but lavf should attempt to identify it
  403. CODEC_ID_MPEG2TS = 0x20000, /**< _FAKE_ codec to indicate a raw MPEG-2 TS
  404. * stream (only used by libavformat) */
  405. CODEC_ID_MPEG4SYSTEMS = 0x20001, /**< _FAKE_ codec to indicate a MPEG-4 Systems
  406. * stream (only used by libavformat) */
  407. CODEC_ID_FFMETADATA = 0x21000, ///< Dummy codec for streams containing only metadata information.
  408. };
  409. #if FF_API_OLD_DECODE_AUDIO
  410. /* in bytes */
  411. #define AVCODEC_MAX_AUDIO_FRAME_SIZE 192000 // 1 second of 48khz 32bit audio
  412. #endif
  413. /**
  414. * Required number of additionally allocated bytes at the end of the input bitstream for decoding.
  415. * This is mainly needed because some optimized bitstream readers read
  416. * 32 or 64 bit at once and could read over the end.<br>
  417. * Note: If the first 23 bits of the additional bytes are not 0, then damaged
  418. * MPEG bitstreams could cause overread and segfault.
  419. */
  420. #define FF_INPUT_BUFFER_PADDING_SIZE 8
  421. /**
  422. * minimum encoding buffer size
  423. * Used to avoid some checks during header writing.
  424. */
  425. #define FF_MIN_BUFFER_SIZE 16384
  426. /**
  427. * motion estimation type.
  428. */
  429. enum Motion_Est_ID {
  430. ME_ZERO = 1, ///< no search, that is use 0,0 vector whenever one is needed
  431. ME_FULL,
  432. ME_LOG,
  433. ME_PHODS,
  434. ME_EPZS, ///< enhanced predictive zonal search
  435. ME_X1, ///< reserved for experiments
  436. ME_HEX, ///< hexagon based search
  437. ME_UMH, ///< uneven multi-hexagon search
  438. ME_ITER, ///< iterative search
  439. ME_TESA, ///< transformed exhaustive search algorithm
  440. };
  441. enum AVDiscard{
  442. /* We leave some space between them for extensions (drop some
  443. * keyframes for intra-only or drop just some bidir frames). */
  444. AVDISCARD_NONE =-16, ///< discard nothing
  445. AVDISCARD_DEFAULT= 0, ///< discard useless packets like 0 size packets in avi
  446. AVDISCARD_NONREF = 8, ///< discard all non reference
  447. AVDISCARD_BIDIR = 16, ///< discard all bidirectional frames
  448. AVDISCARD_NONKEY = 32, ///< discard all frames except keyframes
  449. AVDISCARD_ALL = 48, ///< discard all
  450. };
  451. enum AVColorPrimaries{
  452. AVCOL_PRI_BT709 =1, ///< also ITU-R BT1361 / IEC 61966-2-4 / SMPTE RP177 Annex B
  453. AVCOL_PRI_UNSPECIFIED=2,
  454. AVCOL_PRI_BT470M =4,
  455. AVCOL_PRI_BT470BG =5, ///< also ITU-R BT601-6 625 / ITU-R BT1358 625 / ITU-R BT1700 625 PAL & SECAM
  456. AVCOL_PRI_SMPTE170M =6, ///< also ITU-R BT601-6 525 / ITU-R BT1358 525 / ITU-R BT1700 NTSC
  457. AVCOL_PRI_SMPTE240M =7, ///< functionally identical to above
  458. AVCOL_PRI_FILM =8,
  459. AVCOL_PRI_NB , ///< Not part of ABI
  460. };
  461. enum AVColorTransferCharacteristic{
  462. AVCOL_TRC_BT709 =1, ///< also ITU-R BT1361
  463. AVCOL_TRC_UNSPECIFIED=2,
  464. AVCOL_TRC_GAMMA22 =4, ///< also ITU-R BT470M / ITU-R BT1700 625 PAL & SECAM
  465. AVCOL_TRC_GAMMA28 =5, ///< also ITU-R BT470BG
  466. AVCOL_TRC_NB , ///< Not part of ABI
  467. };
  468. enum AVColorSpace{
  469. AVCOL_SPC_RGB =0,
  470. AVCOL_SPC_BT709 =1, ///< also ITU-R BT1361 / IEC 61966-2-4 xvYCC709 / SMPTE RP177 Annex B
  471. AVCOL_SPC_UNSPECIFIED=2,
  472. AVCOL_SPC_FCC =4,
  473. AVCOL_SPC_BT470BG =5, ///< also ITU-R BT601-6 625 / ITU-R BT1358 625 / ITU-R BT1700 625 PAL & SECAM / IEC 61966-2-4 xvYCC601
  474. AVCOL_SPC_SMPTE170M =6, ///< also ITU-R BT601-6 525 / ITU-R BT1358 525 / ITU-R BT1700 NTSC / functionally identical to above
  475. AVCOL_SPC_SMPTE240M =7,
  476. AVCOL_SPC_NB , ///< Not part of ABI
  477. };
  478. enum AVColorRange{
  479. AVCOL_RANGE_UNSPECIFIED=0,
  480. AVCOL_RANGE_MPEG =1, ///< the normal 219*2^(n-8) "MPEG" YUV ranges
  481. AVCOL_RANGE_JPEG =2, ///< the normal 2^n-1 "JPEG" YUV ranges
  482. AVCOL_RANGE_NB , ///< Not part of ABI
  483. };
  484. /**
  485. * X X 3 4 X X are luma samples,
  486. * 1 2 1-6 are possible chroma positions
  487. * X X 5 6 X 0 is undefined/unknown position
  488. */
  489. enum AVChromaLocation{
  490. AVCHROMA_LOC_UNSPECIFIED=0,
  491. AVCHROMA_LOC_LEFT =1, ///< mpeg2/4, h264 default
  492. AVCHROMA_LOC_CENTER =2, ///< mpeg1, jpeg, h263
  493. AVCHROMA_LOC_TOPLEFT =3, ///< DV
  494. AVCHROMA_LOC_TOP =4,
  495. AVCHROMA_LOC_BOTTOMLEFT =5,
  496. AVCHROMA_LOC_BOTTOM =6,
  497. AVCHROMA_LOC_NB , ///< Not part of ABI
  498. };
  499. enum AVAudioServiceType {
  500. AV_AUDIO_SERVICE_TYPE_MAIN = 0,
  501. AV_AUDIO_SERVICE_TYPE_EFFECTS = 1,
  502. AV_AUDIO_SERVICE_TYPE_VISUALLY_IMPAIRED = 2,
  503. AV_AUDIO_SERVICE_TYPE_HEARING_IMPAIRED = 3,
  504. AV_AUDIO_SERVICE_TYPE_DIALOGUE = 4,
  505. AV_AUDIO_SERVICE_TYPE_COMMENTARY = 5,
  506. AV_AUDIO_SERVICE_TYPE_EMERGENCY = 6,
  507. AV_AUDIO_SERVICE_TYPE_VOICE_OVER = 7,
  508. AV_AUDIO_SERVICE_TYPE_KARAOKE = 8,
  509. AV_AUDIO_SERVICE_TYPE_NB , ///< Not part of ABI
  510. };
  511. typedef struct RcOverride{
  512. int start_frame;
  513. int end_frame;
  514. int qscale; // If this is 0 then quality_factor will be used instead.
  515. float quality_factor;
  516. } RcOverride;
  517. #define FF_MAX_B_FRAMES 16
  518. /* encoding support
  519. These flags can be passed in AVCodecContext.flags before initialization.
  520. Note: Not everything is supported yet.
  521. */
  522. #define CODEC_FLAG_QSCALE 0x0002 ///< Use fixed qscale.
  523. #define CODEC_FLAG_4MV 0x0004 ///< 4 MV per MB allowed / advanced prediction for H.263.
  524. #define CODEC_FLAG_QPEL 0x0010 ///< Use qpel MC.
  525. #define CODEC_FLAG_GMC 0x0020 ///< Use GMC.
  526. #define CODEC_FLAG_MV0 0x0040 ///< Always try a MB with MV=<0,0>.
  527. /**
  528. * The parent program guarantees that the input for B-frames containing
  529. * streams is not written to for at least s->max_b_frames+1 frames, if
  530. * this is not set the input will be copied.
  531. */
  532. #define CODEC_FLAG_INPUT_PRESERVED 0x0100
  533. #define CODEC_FLAG_PASS1 0x0200 ///< Use internal 2pass ratecontrol in first pass mode.
  534. #define CODEC_FLAG_PASS2 0x0400 ///< Use internal 2pass ratecontrol in second pass mode.
  535. #define CODEC_FLAG_GRAY 0x2000 ///< Only decode/encode grayscale.
  536. #define CODEC_FLAG_EMU_EDGE 0x4000 ///< Don't draw edges.
  537. #define CODEC_FLAG_PSNR 0x8000 ///< error[?] variables will be set during encoding.
  538. #define CODEC_FLAG_TRUNCATED 0x00010000 /** Input bitstream might be truncated at a random
  539. location instead of only at frame boundaries. */
  540. #define CODEC_FLAG_NORMALIZE_AQP 0x00020000 ///< Normalize adaptive quantization.
  541. #define CODEC_FLAG_INTERLACED_DCT 0x00040000 ///< Use interlaced DCT.
  542. #define CODEC_FLAG_LOW_DELAY 0x00080000 ///< Force low delay.
  543. #define CODEC_FLAG_GLOBAL_HEADER 0x00400000 ///< Place global headers in extradata instead of every keyframe.
  544. #define CODEC_FLAG_BITEXACT 0x00800000 ///< Use only bitexact stuff (except (I)DCT).
  545. /* Fx : Flag for h263+ extra options */
  546. #define CODEC_FLAG_AC_PRED 0x01000000 ///< H.263 advanced intra coding / MPEG-4 AC prediction
  547. #define CODEC_FLAG_CBP_RD 0x04000000 ///< Use rate distortion optimization for cbp.
  548. #define CODEC_FLAG_QP_RD 0x08000000 ///< Use rate distortion optimization for qp selectioon.
  549. #define CODEC_FLAG_LOOP_FILTER 0x00000800 ///< loop filter
  550. #define CODEC_FLAG_INTERLACED_ME 0x20000000 ///< interlaced motion estimation
  551. #define CODEC_FLAG_CLOSED_GOP 0x80000000
  552. #define CODEC_FLAG2_FAST 0x00000001 ///< Allow non spec compliant speedup tricks.
  553. #define CODEC_FLAG2_STRICT_GOP 0x00000002 ///< Strictly enforce GOP size.
  554. #define CODEC_FLAG2_NO_OUTPUT 0x00000004 ///< Skip bitstream encoding.
  555. #define CODEC_FLAG2_LOCAL_HEADER 0x00000008 ///< Place global headers at every keyframe instead of in extradata.
  556. #define CODEC_FLAG2_SKIP_RD 0x00004000 ///< RD optimal MB level residual skipping
  557. #define CODEC_FLAG2_CHUNKS 0x00008000 ///< Input bitstream might be truncated at a packet boundaries instead of only at frame boundaries.
  558. /**
  559. * @defgroup deprecated_flags Deprecated codec flags
  560. * Use corresponding private codec options instead.
  561. * @{
  562. */
  563. #if FF_API_MJPEG_GLOBAL_OPTS
  564. #define CODEC_FLAG_EXTERN_HUFF 0x1000 ///< Use external Huffman table (for MJPEG).
  565. #endif
  566. /**
  567. * @}
  568. */
  569. /* Unsupported options :
  570. * Syntax Arithmetic coding (SAC)
  571. * Reference Picture Selection
  572. * Independent Segment Decoding */
  573. /* /Fx */
  574. /* codec capabilities */
  575. #define CODEC_CAP_DRAW_HORIZ_BAND 0x0001 ///< Decoder can use draw_horiz_band callback.
  576. /**
  577. * Codec uses get_buffer() for allocating buffers and supports custom allocators.
  578. * If not set, it might not use get_buffer() at all or use operations that
  579. * assume the buffer was allocated by avcodec_default_get_buffer.
  580. */
  581. #define CODEC_CAP_DR1 0x0002
  582. #if FF_API_PARSE_FRAME
  583. /* If 'parse_only' field is true, then avcodec_parse_frame() can be used. */
  584. #define CODEC_CAP_PARSE_ONLY 0x0004
  585. #endif
  586. #define CODEC_CAP_TRUNCATED 0x0008
  587. /* Codec can export data for HW decoding (XvMC). */
  588. #define CODEC_CAP_HWACCEL 0x0010
  589. /**
  590. * Encoder or decoder requires flushing with NULL input at the end in order to
  591. * give the complete and correct output.
  592. *
  593. * NOTE: If this flag is not set, the codec is guaranteed to never be fed with
  594. * with NULL data. The user can still send NULL data to the public encode
  595. * or decode function, but libavcodec will not pass it along to the codec
  596. * unless this flag is set.
  597. *
  598. * Decoders:
  599. * The decoder has a non-zero delay and needs to be fed with avpkt->data=NULL,
  600. * avpkt->size=0 at the end to get the delayed data until the decoder no longer
  601. * returns frames.
  602. *
  603. * Encoders:
  604. * The encoder needs to be fed with NULL data at the end of encoding until the
  605. * encoder no longer returns data.
  606. *
  607. * NOTE: For encoders implementing the AVCodec.encode2() function, setting this
  608. * flag also means that the encoder must set the pts and duration for
  609. * each output packet. If this flag is not set, the pts and duration will
  610. * be determined by libavcodec from the input frame.
  611. */
  612. #define CODEC_CAP_DELAY 0x0020
  613. /**
  614. * Codec can be fed a final frame with a smaller size.
  615. * This can be used to prevent truncation of the last audio samples.
  616. */
  617. #define CODEC_CAP_SMALL_LAST_FRAME 0x0040
  618. /**
  619. * Codec can export data for HW decoding (VDPAU).
  620. */
  621. #define CODEC_CAP_HWACCEL_VDPAU 0x0080
  622. /**
  623. * Codec can output multiple frames per AVPacket
  624. * Normally demuxers return one frame at a time, demuxers which do not do
  625. * are connected to a parser to split what they return into proper frames.
  626. * This flag is reserved to the very rare category of codecs which have a
  627. * bitstream that cannot be split into frames without timeconsuming
  628. * operations like full decoding. Demuxers carring such bitstreams thus
  629. * may return multiple frames in a packet. This has many disadvantages like
  630. * prohibiting stream copy in many cases thus it should only be considered
  631. * as a last resort.
  632. */
  633. #define CODEC_CAP_SUBFRAMES 0x0100
  634. /**
  635. * Codec is experimental and is thus avoided in favor of non experimental
  636. * encoders
  637. */
  638. #define CODEC_CAP_EXPERIMENTAL 0x0200
  639. /**
  640. * Codec should fill in channel configuration and samplerate instead of container
  641. */
  642. #define CODEC_CAP_CHANNEL_CONF 0x0400
  643. /**
  644. * Codec is able to deal with negative linesizes
  645. */
  646. #define CODEC_CAP_NEG_LINESIZES 0x0800
  647. /**
  648. * Codec supports frame-level multithreading.
  649. */
  650. #define CODEC_CAP_FRAME_THREADS 0x1000
  651. /**
  652. * Codec supports slice-based (or partition-based) multithreading.
  653. */
  654. #define CODEC_CAP_SLICE_THREADS 0x2000
  655. /**
  656. * Codec supports changed parameters at any point.
  657. */
  658. #define CODEC_CAP_PARAM_CHANGE 0x4000
  659. /**
  660. * Codec supports avctx->thread_count == 0 (auto).
  661. */
  662. #define CODEC_CAP_AUTO_THREADS 0x8000
  663. /**
  664. * Audio encoder supports receiving a different number of samples in each call.
  665. */
  666. #define CODEC_CAP_VARIABLE_FRAME_SIZE 0x10000
  667. //The following defines may change, don't expect compatibility if you use them.
  668. #define MB_TYPE_INTRA4x4 0x0001
  669. #define MB_TYPE_INTRA16x16 0x0002 //FIXME H.264-specific
  670. #define MB_TYPE_INTRA_PCM 0x0004 //FIXME H.264-specific
  671. #define MB_TYPE_16x16 0x0008
  672. #define MB_TYPE_16x8 0x0010
  673. #define MB_TYPE_8x16 0x0020
  674. #define MB_TYPE_8x8 0x0040
  675. #define MB_TYPE_INTERLACED 0x0080
  676. #define MB_TYPE_DIRECT2 0x0100 //FIXME
  677. #define MB_TYPE_ACPRED 0x0200
  678. #define MB_TYPE_GMC 0x0400
  679. #define MB_TYPE_SKIP 0x0800
  680. #define MB_TYPE_P0L0 0x1000
  681. #define MB_TYPE_P1L0 0x2000
  682. #define MB_TYPE_P0L1 0x4000
  683. #define MB_TYPE_P1L1 0x8000
  684. #define MB_TYPE_L0 (MB_TYPE_P0L0 | MB_TYPE_P1L0)
  685. #define MB_TYPE_L1 (MB_TYPE_P0L1 | MB_TYPE_P1L1)
  686. #define MB_TYPE_L0L1 (MB_TYPE_L0 | MB_TYPE_L1)
  687. #define MB_TYPE_QUANT 0x00010000
  688. #define MB_TYPE_CBP 0x00020000
  689. //Note bits 24-31 are reserved for codec specific use (h264 ref0, mpeg1 0mv, ...)
  690. /**
  691. * Pan Scan area.
  692. * This specifies the area which should be displayed.
  693. * Note there may be multiple such areas for one frame.
  694. */
  695. typedef struct AVPanScan{
  696. /**
  697. * id
  698. * - encoding: Set by user.
  699. * - decoding: Set by libavcodec.
  700. */
  701. int id;
  702. /**
  703. * width and height in 1/16 pel
  704. * - encoding: Set by user.
  705. * - decoding: Set by libavcodec.
  706. */
  707. int width;
  708. int height;
  709. /**
  710. * position of the top left corner in 1/16 pel for up to 3 fields/frames
  711. * - encoding: Set by user.
  712. * - decoding: Set by libavcodec.
  713. */
  714. int16_t position[3][2];
  715. }AVPanScan;
  716. #define FF_QSCALE_TYPE_MPEG1 0
  717. #define FF_QSCALE_TYPE_MPEG2 1
  718. #define FF_QSCALE_TYPE_H264 2
  719. #define FF_QSCALE_TYPE_VP56 3
  720. #define FF_BUFFER_TYPE_INTERNAL 1
  721. #define FF_BUFFER_TYPE_USER 2 ///< direct rendering buffers (image is (de)allocated by user)
  722. #define FF_BUFFER_TYPE_SHARED 4 ///< Buffer from somewhere else; don't deallocate image (data/base), all other tables are not shared.
  723. #define FF_BUFFER_TYPE_COPY 8 ///< Just a (modified) copy of some other buffer, don't deallocate anything.
  724. #define FF_BUFFER_HINTS_VALID 0x01 // Buffer hints value is meaningful (if 0 ignore).
  725. #define FF_BUFFER_HINTS_READABLE 0x02 // Codec will read from buffer.
  726. #define FF_BUFFER_HINTS_PRESERVE 0x04 // User must not alter buffer content.
  727. #define FF_BUFFER_HINTS_REUSABLE 0x08 // Codec will reuse the buffer (update).
  728. enum AVPacketSideDataType {
  729. AV_PKT_DATA_PALETTE,
  730. AV_PKT_DATA_NEW_EXTRADATA,
  731. AV_PKT_DATA_PARAM_CHANGE,
  732. };
  733. typedef struct AVPacket {
  734. /**
  735. * Presentation timestamp in AVStream->time_base units; the time at which
  736. * the decompressed packet will be presented to the user.
  737. * Can be AV_NOPTS_VALUE if it is not stored in the file.
  738. * pts MUST be larger or equal to dts as presentation cannot happen before
  739. * decompression, unless one wants to view hex dumps. Some formats misuse
  740. * the terms dts and pts/cts to mean something different. Such timestamps
  741. * must be converted to true pts/dts before they are stored in AVPacket.
  742. */
  743. int64_t pts;
  744. /**
  745. * Decompression timestamp in AVStream->time_base units; the time at which
  746. * the packet is decompressed.
  747. * Can be AV_NOPTS_VALUE if it is not stored in the file.
  748. */
  749. int64_t dts;
  750. uint8_t *data;
  751. int size;
  752. int stream_index;
  753. /**
  754. * A combination of AV_PKT_FLAG values
  755. */
  756. int flags;
  757. /**
  758. * Additional packet data that can be provided by the container.
  759. * Packet can contain several types of side information.
  760. */
  761. struct {
  762. uint8_t *data;
  763. int size;
  764. enum AVPacketSideDataType type;
  765. } *side_data;
  766. int side_data_elems;
  767. /**
  768. * Duration of this packet in AVStream->time_base units, 0 if unknown.
  769. * Equals next_pts - this_pts in presentation order.
  770. */
  771. int duration;
  772. void (*destruct)(struct AVPacket *);
  773. void *priv;
  774. int64_t pos; ///< byte position in stream, -1 if unknown
  775. /**
  776. * Time difference in AVStream->time_base units from the pts of this
  777. * packet to the point at which the output from the decoder has converged
  778. * independent from the availability of previous frames. That is, the
  779. * frames are virtually identical no matter if decoding started from
  780. * the very first frame or from this keyframe.
  781. * Is AV_NOPTS_VALUE if unknown.
  782. * This field is not the display duration of the current packet.
  783. * This field has no meaning if the packet does not have AV_PKT_FLAG_KEY
  784. * set.
  785. *
  786. * The purpose of this field is to allow seeking in streams that have no
  787. * keyframes in the conventional sense. It corresponds to the
  788. * recovery point SEI in H.264 and match_time_delta in NUT. It is also
  789. * essential for some types of subtitle streams to ensure that all
  790. * subtitles are correctly displayed after seeking.
  791. */
  792. int64_t convergence_duration;
  793. } AVPacket;
  794. #define AV_PKT_FLAG_KEY 0x0001 ///< The packet contains a keyframe
  795. #define AV_PKT_FLAG_CORRUPT 0x0002 ///< The packet content is corrupted
  796. /**
  797. * An AV_PKT_DATA_PARAM_CHANGE side data packet is laid out as follows:
  798. * u32le param_flags
  799. * if (param_flags & AV_SIDE_DATA_PARAM_CHANGE_CHANNEL_COUNT)
  800. * s32le channel_count
  801. * if (param_flags & AV_SIDE_DATA_PARAM_CHANGE_CHANNEL_LAYOUT)
  802. * u64le channel_layout
  803. * if (param_flags & AV_SIDE_DATA_PARAM_CHANGE_SAMPLE_RATE)
  804. * s32le sample_rate
  805. * if (param_flags & AV_SIDE_DATA_PARAM_CHANGE_DIMENSIONS)
  806. * s32le width
  807. * s32le height
  808. */
  809. enum AVSideDataParamChangeFlags {
  810. AV_SIDE_DATA_PARAM_CHANGE_CHANNEL_COUNT = 0x0001,
  811. AV_SIDE_DATA_PARAM_CHANGE_CHANNEL_LAYOUT = 0x0002,
  812. AV_SIDE_DATA_PARAM_CHANGE_SAMPLE_RATE = 0x0004,
  813. AV_SIDE_DATA_PARAM_CHANGE_DIMENSIONS = 0x0008,
  814. };
  815. /**
  816. * Audio Video Frame.
  817. * New fields can be added to the end of AVFRAME with minor version
  818. * bumps. Removal, reordering and changes to existing fields require
  819. * a major version bump.
  820. * sizeof(AVFrame) must not be used outside libav*.
  821. */
  822. typedef struct AVFrame {
  823. #if FF_API_DATA_POINTERS
  824. #define AV_NUM_DATA_POINTERS 4
  825. #else
  826. #define AV_NUM_DATA_POINTERS 8
  827. #endif
  828. /**
  829. * pointer to the picture/channel planes.
  830. * This might be different from the first allocated byte
  831. * - encoding: Set by user
  832. * - decoding: set by AVCodecContext.get_buffer()
  833. */
  834. uint8_t *data[AV_NUM_DATA_POINTERS];
  835. /**
  836. * Size, in bytes, of the data for each picture/channel plane.
  837. *
  838. * For audio, only linesize[0] may be set. For planar audio, each channel
  839. * plane must be the same size.
  840. *
  841. * - encoding: Set by user (video only)
  842. * - decoding: set by AVCodecContext.get_buffer()
  843. */
  844. int linesize[AV_NUM_DATA_POINTERS];
  845. /**
  846. * pointer to the first allocated byte of the picture. Can be used in get_buffer/release_buffer.
  847. * This isn't used by libavcodec unless the default get/release_buffer() is used.
  848. * - encoding:
  849. * - decoding:
  850. */
  851. uint8_t *base[AV_NUM_DATA_POINTERS];
  852. /**
  853. * 1 -> keyframe, 0-> not
  854. * - encoding: Set by libavcodec.
  855. * - decoding: Set by libavcodec.
  856. */
  857. int key_frame;
  858. /**
  859. * Picture type of the frame, see ?_TYPE below.
  860. * - encoding: Set by libavcodec. for coded_picture (and set by user for input).
  861. * - decoding: Set by libavcodec.
  862. */
  863. enum AVPictureType pict_type;
  864. /**
  865. * presentation timestamp in time_base units (time when frame should be shown to user)
  866. * If AV_NOPTS_VALUE then frame_rate = 1/time_base will be assumed.
  867. * - encoding: MUST be set by user.
  868. * - decoding: Set by libavcodec.
  869. */
  870. int64_t pts;
  871. /**
  872. * picture number in bitstream order
  873. * - encoding: set by
  874. * - decoding: Set by libavcodec.
  875. */
  876. int coded_picture_number;
  877. /**
  878. * picture number in display order
  879. * - encoding: set by
  880. * - decoding: Set by libavcodec.
  881. */
  882. int display_picture_number;
  883. /**
  884. * quality (between 1 (good) and FF_LAMBDA_MAX (bad))
  885. * - encoding: Set by libavcodec. for coded_picture (and set by user for input).
  886. * - decoding: Set by libavcodec.
  887. */
  888. int quality;
  889. #if FF_API_AVFRAME_AGE
  890. /**
  891. * @deprecated unused
  892. */
  893. attribute_deprecated int age;
  894. #endif
  895. /**
  896. * is this picture used as reference
  897. * The values for this are the same as the MpegEncContext.picture_structure
  898. * variable, that is 1->top field, 2->bottom field, 3->frame/both fields.
  899. * Set to 4 for delayed, non-reference frames.
  900. * - encoding: unused
  901. * - decoding: Set by libavcodec. (before get_buffer() call)).
  902. */
  903. int reference;
  904. /**
  905. * QP table
  906. * - encoding: unused
  907. * - decoding: Set by libavcodec.
  908. */
  909. int8_t *qscale_table;
  910. /**
  911. * QP store stride
  912. * - encoding: unused
  913. * - decoding: Set by libavcodec.
  914. */
  915. int qstride;
  916. /**
  917. * mbskip_table[mb]>=1 if MB didn't change
  918. * stride= mb_width = (width+15)>>4
  919. * - encoding: unused
  920. * - decoding: Set by libavcodec.
  921. */
  922. uint8_t *mbskip_table;
  923. /**
  924. * motion vector table
  925. * @code
  926. * example:
  927. * int mv_sample_log2= 4 - motion_subsample_log2;
  928. * int mb_width= (width+15)>>4;
  929. * int mv_stride= (mb_width << mv_sample_log2) + 1;
  930. * motion_val[direction][x + y*mv_stride][0->mv_x, 1->mv_y];
  931. * @endcode
  932. * - encoding: Set by user.
  933. * - decoding: Set by libavcodec.
  934. */
  935. int16_t (*motion_val[2])[2];
  936. /**
  937. * macroblock type table
  938. * mb_type_base + mb_width + 2
  939. * - encoding: Set by user.
  940. * - decoding: Set by libavcodec.
  941. */
  942. uint32_t *mb_type;
  943. /**
  944. * log2 of the size of the block which a single vector in motion_val represents:
  945. * (4->16x16, 3->8x8, 2-> 4x4, 1-> 2x2)
  946. * - encoding: unused
  947. * - decoding: Set by libavcodec.
  948. */
  949. uint8_t motion_subsample_log2;
  950. /**
  951. * for some private data of the user
  952. * - encoding: unused
  953. * - decoding: Set by user.
  954. */
  955. void *opaque;
  956. /**
  957. * error
  958. * - encoding: Set by libavcodec. if flags&CODEC_FLAG_PSNR.
  959. * - decoding: unused
  960. */
  961. uint64_t error[AV_NUM_DATA_POINTERS];
  962. /**
  963. * type of the buffer (to keep track of who has to deallocate data[*])
  964. * - encoding: Set by the one who allocates it.
  965. * - decoding: Set by the one who allocates it.
  966. * Note: User allocated (direct rendering) & internal buffers cannot coexist currently.
  967. */
  968. int type;
  969. /**
  970. * When decoding, this signals how much the picture must be delayed.
  971. * extra_delay = repeat_pict / (2*fps)
  972. * - encoding: unused
  973. * - decoding: Set by libavcodec.
  974. */
  975. int repeat_pict;
  976. /**
  977. *
  978. */
  979. int qscale_type;
  980. /**
  981. * The content of the picture is interlaced.
  982. * - encoding: Set by user.
  983. * - decoding: Set by libavcodec. (default 0)
  984. */
  985. int interlaced_frame;
  986. /**
  987. * If the content is interlaced, is top field displayed first.
  988. * - encoding: Set by user.
  989. * - decoding: Set by libavcodec.
  990. */
  991. int top_field_first;
  992. /**
  993. * Pan scan.
  994. * - encoding: Set by user.
  995. * - decoding: Set by libavcodec.
  996. */
  997. AVPanScan *pan_scan;
  998. /**
  999. * Tell user application that palette has changed from previous frame.
  1000. * - encoding: ??? (no palette-enabled encoder yet)
  1001. * - decoding: Set by libavcodec. (default 0).
  1002. */
  1003. int palette_has_changed;
  1004. /**
  1005. * codec suggestion on buffer type if != 0
  1006. * - encoding: unused
  1007. * - decoding: Set by libavcodec. (before get_buffer() call)).
  1008. */
  1009. int buffer_hints;
  1010. /**
  1011. * DCT coefficients
  1012. * - encoding: unused
  1013. * - decoding: Set by libavcodec.
  1014. */
  1015. short *dct_coeff;
  1016. /**
  1017. * motion reference frame index
  1018. * the order in which these are stored can depend on the codec.
  1019. * - encoding: Set by user.
  1020. * - decoding: Set by libavcodec.
  1021. */
  1022. int8_t *ref_index[2];
  1023. /**
  1024. * reordered opaque 64bit (generally an integer or a double precision float
  1025. * PTS but can be anything).
  1026. * The user sets AVCodecContext.reordered_opaque to represent the input at
  1027. * that time,
  1028. * the decoder reorders values as needed and sets AVFrame.reordered_opaque
  1029. * to exactly one of the values provided by the user through AVCodecContext.reordered_opaque
  1030. * @deprecated in favor of pkt_pts
  1031. * - encoding: unused
  1032. * - decoding: Read by user.
  1033. */
  1034. int64_t reordered_opaque;
  1035. /**
  1036. * hardware accelerator private data (Libav-allocated)
  1037. * - encoding: unused
  1038. * - decoding: Set by libavcodec
  1039. */
  1040. void *hwaccel_picture_private;
  1041. /**
  1042. * reordered pts from the last AVPacket that has been input into the decoder
  1043. * - encoding: unused
  1044. * - decoding: Read by user.
  1045. */
  1046. int64_t pkt_pts;
  1047. /**
  1048. * dts from the last AVPacket that has been input into the decoder
  1049. * - encoding: unused
  1050. * - decoding: Read by user.
  1051. */
  1052. int64_t pkt_dts;
  1053. /**
  1054. * the AVCodecContext which ff_thread_get_buffer() was last called on
  1055. * - encoding: Set by libavcodec.
  1056. * - decoding: Set by libavcodec.
  1057. */
  1058. struct AVCodecContext *owner;
  1059. /**
  1060. * used by multithreading to store frame-specific info
  1061. * - encoding: Set by libavcodec.
  1062. * - decoding: Set by libavcodec.
  1063. */
  1064. void *thread_opaque;
  1065. /**
  1066. * number of audio samples (per channel) described by this frame
  1067. * - encoding: unused
  1068. * - decoding: Set by libavcodec
  1069. */
  1070. int nb_samples;
  1071. /**
  1072. * pointers to the data planes/channels.
  1073. *
  1074. * For video, this should simply point to data[].
  1075. *
  1076. * For planar audio, each channel has a separate data pointer, and
  1077. * linesize[0] contains the size of each channel buffer.
  1078. * For packed audio, there is just one data pointer, and linesize[0]
  1079. * contains the total size of the buffer for all channels.
  1080. *
  1081. * Note: Both data and extended_data will always be set by get_buffer(),
  1082. * but for planar audio with more channels that can fit in data,
  1083. * extended_data must be used by the decoder in order to access all
  1084. * channels.
  1085. *
  1086. * encoding: unused
  1087. * decoding: set by AVCodecContext.get_buffer()
  1088. */
  1089. uint8_t **extended_data;
  1090. /**
  1091. * sample aspect ratio for the video frame, 0/1 if unknown\unspecified
  1092. * - encoding: unused
  1093. * - decoding: Read by user.
  1094. */
  1095. AVRational sample_aspect_ratio;
  1096. /**
  1097. * width and height of the video frame
  1098. * - encoding: unused
  1099. * - decoding: Read by user.
  1100. */
  1101. int width, height;
  1102. /**
  1103. * format of the frame, -1 if unknown or unset
  1104. * Values correspond to enum PixelFormat for video frames,
  1105. * enum AVSampleFormat for audio)
  1106. * - encoding: unused
  1107. * - decoding: Read by user.
  1108. */
  1109. int format;
  1110. } AVFrame;
  1111. struct AVCodecInternal;
  1112. enum AVFieldOrder {
  1113. AV_FIELD_UNKNOWN,
  1114. AV_FIELD_PROGRESSIVE,
  1115. AV_FIELD_TT, //< Top coded_first, top displayed first
  1116. AV_FIELD_BB, //< Bottom coded first, bottom displayed first
  1117. AV_FIELD_TB, //< Top coded first, bottom displayed first
  1118. AV_FIELD_BT, //< Bottom coded first, top displayed first
  1119. };
  1120. /**
  1121. * main external API structure.
  1122. * New fields can be added to the end with minor version bumps.
  1123. * Removal, reordering and changes to existing fields require a major
  1124. * version bump.
  1125. * sizeof(AVCodecContext) must not be used outside libav*.
  1126. */
  1127. typedef struct AVCodecContext {
  1128. /**
  1129. * information on struct for av_log
  1130. * - set by avcodec_alloc_context3
  1131. */
  1132. const AVClass *av_class;
  1133. /**
  1134. * the average bitrate
  1135. * - encoding: Set by user; unused for constant quantizer encoding.
  1136. * - decoding: Set by libavcodec. 0 or some bitrate if this info is available in the stream.
  1137. */
  1138. int bit_rate;
  1139. /**
  1140. * number of bits the bitstream is allowed to diverge from the reference.
  1141. * the reference can be CBR (for CBR pass1) or VBR (for pass2)
  1142. * - encoding: Set by user; unused for constant quantizer encoding.
  1143. * - decoding: unused
  1144. */
  1145. int bit_rate_tolerance;
  1146. /**
  1147. * CODEC_FLAG_*.
  1148. * - encoding: Set by user.
  1149. * - decoding: Set by user.
  1150. */
  1151. int flags;
  1152. /**
  1153. * Some codecs need additional format info. It is stored here.
  1154. * If any muxer uses this then ALL demuxers/parsers AND encoders for the
  1155. * specific codec MUST set it correctly otherwise stream copy breaks.
  1156. * In general use of this field by muxers is not recommended.
  1157. * - encoding: Set by libavcodec.
  1158. * - decoding: Set by libavcodec. (FIXME: Is this OK?)
  1159. */
  1160. int sub_id;
  1161. /**
  1162. * Motion estimation algorithm used for video coding.
  1163. * 1 (zero), 2 (full), 3 (log), 4 (phods), 5 (epzs), 6 (x1), 7 (hex),
  1164. * 8 (umh), 9 (iter), 10 (tesa) [7, 8, 10 are x264 specific, 9 is snow specific]
  1165. * - encoding: MUST be set by user.
  1166. * - decoding: unused
  1167. */
  1168. int me_method;
  1169. /**
  1170. * some codecs need / can use extradata like Huffman tables.
  1171. * mjpeg: Huffman tables
  1172. * rv10: additional flags
  1173. * mpeg4: global headers (they can be in the bitstream or here)
  1174. * The allocated memory should be FF_INPUT_BUFFER_PADDING_SIZE bytes larger
  1175. * than extradata_size to avoid prolems if it is read with the bitstream reader.
  1176. * The bytewise contents of extradata must not depend on the architecture or CPU endianness.
  1177. * - encoding: Set/allocated/freed by libavcodec.
  1178. * - decoding: Set/allocated/freed by user.
  1179. */
  1180. uint8_t *extradata;
  1181. int extradata_size;
  1182. /**
  1183. * This is the fundamental unit of time (in seconds) in terms
  1184. * of which frame timestamps are represented. For fixed-fps content,
  1185. * timebase should be 1/framerate and timestamp increments should be
  1186. * identically 1.
  1187. * - encoding: MUST be set by user.
  1188. * - decoding: Set by libavcodec.
  1189. */
  1190. AVRational time_base;
  1191. /* video only */
  1192. /**
  1193. * picture width / height.
  1194. * - encoding: MUST be set by user.
  1195. * - decoding: Set by libavcodec.
  1196. * Note: For compatibility it is possible to set this instead of
  1197. * coded_width/height before decoding.
  1198. */
  1199. int width, height;
  1200. #define FF_ASPECT_EXTENDED 15
  1201. /**
  1202. * the number of pictures in a group of pictures, or 0 for intra_only
  1203. * - encoding: Set by user.
  1204. * - decoding: unused
  1205. */
  1206. int gop_size;
  1207. /**
  1208. * Pixel format, see PIX_FMT_xxx.
  1209. * May be set by the demuxer if known from headers.
  1210. * May be overriden by the decoder if it knows better.
  1211. * - encoding: Set by user.
  1212. * - decoding: Set by user if known, overridden by libavcodec if known
  1213. */
  1214. enum PixelFormat pix_fmt;
  1215. /**
  1216. * If non NULL, 'draw_horiz_band' is called by the libavcodec
  1217. * decoder to draw a horizontal band. It improves cache usage. Not
  1218. * all codecs can do that. You must check the codec capabilities
  1219. * beforehand.
  1220. * When multithreading is used, it may be called from multiple threads
  1221. * at the same time; threads might draw different parts of the same AVFrame,
  1222. * or multiple AVFrames, and there is no guarantee that slices will be drawn
  1223. * in order.
  1224. * The function is also used by hardware acceleration APIs.
  1225. * It is called at least once during frame decoding to pass
  1226. * the data needed for hardware render.
  1227. * In that mode instead of pixel data, AVFrame points to
  1228. * a structure specific to the acceleration API. The application
  1229. * reads the structure and can change some fields to indicate progress
  1230. * or mark state.
  1231. * - encoding: unused
  1232. * - decoding: Set by user.
  1233. * @param height the height of the slice
  1234. * @param y the y position of the slice
  1235. * @param type 1->top field, 2->bottom field, 3->frame
  1236. * @param offset offset into the AVFrame.data from which the slice should be read
  1237. */
  1238. void (*draw_horiz_band)(struct AVCodecContext *s,
  1239. const AVFrame *src, int offset[AV_NUM_DATA_POINTERS],
  1240. int y, int type, int height);
  1241. /* audio only */
  1242. int sample_rate; ///< samples per second
  1243. int channels; ///< number of audio channels
  1244. /**
  1245. * audio sample format
  1246. * - encoding: Set by user.
  1247. * - decoding: Set by libavcodec.
  1248. */
  1249. enum AVSampleFormat sample_fmt; ///< sample format
  1250. /* The following data should not be initialized. */
  1251. /**
  1252. * Samples per packet, initialized when calling 'init'.
  1253. */
  1254. int frame_size;
  1255. int frame_number; ///< audio or video frame number
  1256. /**
  1257. * Number of frames the decoded output will be delayed relative to
  1258. * the encoded input.
  1259. * - encoding: Set by libavcodec.
  1260. * - decoding: unused
  1261. */
  1262. int delay;
  1263. /* - encoding parameters */
  1264. float qcompress; ///< amount of qscale change between easy & hard scenes (0.0-1.0)
  1265. float qblur; ///< amount of qscale smoothing over time (0.0-1.0)
  1266. /**
  1267. * minimum quantizer
  1268. * - encoding: Set by user.
  1269. * - decoding: unused
  1270. */
  1271. int qmin;
  1272. /**
  1273. * maximum quantizer
  1274. * - encoding: Set by user.
  1275. * - decoding: unused
  1276. */
  1277. int qmax;
  1278. /**
  1279. * maximum quantizer difference between frames
  1280. * - encoding: Set by user.
  1281. * - decoding: unused
  1282. */
  1283. int max_qdiff;
  1284. /**
  1285. * maximum number of B-frames between non-B-frames
  1286. * Note: The output will be delayed by max_b_frames+1 relative to the input.
  1287. * - encoding: Set by user.
  1288. * - decoding: unused
  1289. */
  1290. int max_b_frames;
  1291. /**
  1292. * qscale factor between IP and B-frames
  1293. * If > 0 then the last P-frame quantizer will be used (q= lastp_q*factor+offset).
  1294. * If < 0 then normal ratecontrol will be done (q= -normal_q*factor+offset).
  1295. * - encoding: Set by user.
  1296. * - decoding: unused
  1297. */
  1298. float b_quant_factor;
  1299. /** obsolete FIXME remove */
  1300. int rc_strategy;
  1301. #define FF_RC_STRATEGY_XVID 1
  1302. int b_frame_strategy;
  1303. struct AVCodec *codec;
  1304. void *priv_data;
  1305. int rtp_payload_size; /* The size of the RTP payload: the coder will */
  1306. /* do its best to deliver a chunk with size */
  1307. /* below rtp_payload_size, the chunk will start */
  1308. /* with a start code on some codecs like H.263. */
  1309. /* This doesn't take account of any particular */
  1310. /* headers inside the transmitted RTP payload. */
  1311. /* The RTP callback: This function is called */
  1312. /* every time the encoder has a packet to send. */
  1313. /* It depends on the encoder if the data starts */
  1314. /* with a Start Code (it should). H.263 does. */
  1315. /* mb_nb contains the number of macroblocks */
  1316. /* encoded in the RTP payload. */
  1317. void (*rtp_callback)(struct AVCodecContext *avctx, void *data, int size, int mb_nb);
  1318. /* statistics, used for 2-pass encoding */
  1319. int mv_bits;
  1320. int header_bits;
  1321. int i_tex_bits;
  1322. int p_tex_bits;
  1323. int i_count;
  1324. int p_count;
  1325. int skip_count;
  1326. int misc_bits;
  1327. /**
  1328. * number of bits used for the previously encoded frame
  1329. * - encoding: Set by libavcodec.
  1330. * - decoding: unused
  1331. */
  1332. int frame_bits;
  1333. /**
  1334. * Private data of the user, can be used to carry app specific stuff.
  1335. * - encoding: Set by user.
  1336. * - decoding: Set by user.
  1337. */
  1338. void *opaque;
  1339. char codec_name[32];
  1340. enum AVMediaType codec_type; /* see AVMEDIA_TYPE_xxx */
  1341. enum CodecID codec_id; /* see CODEC_ID_xxx */
  1342. /**
  1343. * fourcc (LSB first, so "ABCD" -> ('D'<<24) + ('C'<<16) + ('B'<<8) + 'A').
  1344. * This is used to work around some encoder bugs.
  1345. * A demuxer should set this to what is stored in the field used to identify the codec.
  1346. * If there are multiple such fields in a container then the demuxer should choose the one
  1347. * which maximizes the information about the used codec.
  1348. * If the codec tag field in a container is larger than 32 bits then the demuxer should
  1349. * remap the longer ID to 32 bits with a table or other structure. Alternatively a new
  1350. * extra_codec_tag + size could be added but for this a clear advantage must be demonstrated
  1351. * first.
  1352. * - encoding: Set by user, if not then the default based on codec_id will be used.
  1353. * - decoding: Set by user, will be converted to uppercase by libavcodec during init.
  1354. */
  1355. unsigned int codec_tag;
  1356. /**
  1357. * Work around bugs in encoders which sometimes cannot be detected automatically.
  1358. * - encoding: Set by user
  1359. * - decoding: Set by user
  1360. */
  1361. int workaround_bugs;
  1362. #define FF_BUG_AUTODETECT 1 ///< autodetection
  1363. #define FF_BUG_OLD_MSMPEG4 2
  1364. #define FF_BUG_XVID_ILACE 4
  1365. #define FF_BUG_UMP4 8
  1366. #define FF_BUG_NO_PADDING 16
  1367. #define FF_BUG_AMV 32
  1368. #define FF_BUG_AC_VLC 0 ///< Will be removed, libavcodec can now handle these non-compliant files by default.
  1369. #define FF_BUG_QPEL_CHROMA 64
  1370. #define FF_BUG_STD_QPEL 128
  1371. #define FF_BUG_QPEL_CHROMA2 256
  1372. #define FF_BUG_DIRECT_BLOCKSIZE 512
  1373. #define FF_BUG_EDGE 1024
  1374. #define FF_BUG_HPEL_CHROMA 2048
  1375. #define FF_BUG_DC_CLIP 4096
  1376. #define FF_BUG_MS 8192 ///< Work around various bugs in Microsoft's broken decoders.
  1377. #define FF_BUG_TRUNCATED 16384
  1378. //#define FF_BUG_FAKE_SCALABILITY 16 //Autodetection should work 100%.
  1379. /**
  1380. * luma single coefficient elimination threshold
  1381. * - encoding: Set by user.
  1382. * - decoding: unused
  1383. */
  1384. int luma_elim_threshold;
  1385. /**
  1386. * chroma single coeff elimination threshold
  1387. * - encoding: Set by user.
  1388. * - decoding: unused
  1389. */
  1390. int chroma_elim_threshold;
  1391. /**
  1392. * strictly follow the standard (MPEG4, ...).
  1393. * - encoding: Set by user.
  1394. * - decoding: Set by user.
  1395. * Setting this to STRICT or higher means the encoder and decoder will
  1396. * generally do stupid things, whereas setting it to unofficial or lower
  1397. * will mean the encoder might produce output that is not supported by all
  1398. * spec-compliant decoders. Decoders don't differentiate between normal,
  1399. * unofficial and experimental (that is, they always try to decode things
  1400. * when they can) unless they are explicitly asked to behave stupidly
  1401. * (=strictly conform to the specs)
  1402. */
  1403. int strict_std_compliance;
  1404. #define FF_COMPLIANCE_VERY_STRICT 2 ///< Strictly conform to an older more strict version of the spec or reference software.
  1405. #define FF_COMPLIANCE_STRICT 1 ///< Strictly conform to all the things in the spec no matter what consequences.
  1406. #define FF_COMPLIANCE_NORMAL 0
  1407. #define FF_COMPLIANCE_UNOFFICIAL -1 ///< Allow unofficial extensions
  1408. #define FF_COMPLIANCE_EXPERIMENTAL -2 ///< Allow nonstandardized experimental things.
  1409. /**
  1410. * qscale offset between IP and B-frames
  1411. * - encoding: Set by user.
  1412. * - decoding: unused
  1413. */
  1414. float b_quant_offset;
  1415. /**
  1416. * Called at the beginning of each frame to get a buffer for it.
  1417. *
  1418. * The function will set AVFrame.data[], AVFrame.linesize[].
  1419. * AVFrame.extended_data[] must also be set, but it should be the same as
  1420. * AVFrame.data[] except for planar audio with more channels than can fit
  1421. * in AVFrame.data[]. In that case, AVFrame.data[] shall still contain as
  1422. * many data pointers as it can hold.
  1423. *
  1424. * if CODEC_CAP_DR1 is not set then get_buffer() must call
  1425. * avcodec_default_get_buffer() instead of providing buffers allocated by
  1426. * some other means.
  1427. *
  1428. * AVFrame.data[] should be 32- or 16-byte-aligned unless the CPU doesn't
  1429. * need it. avcodec_default_get_buffer() aligns the output buffer properly,
  1430. * but if get_buffer() is overridden then alignment considerations should
  1431. * be taken into account.
  1432. *
  1433. * @see avcodec_default_get_buffer()
  1434. *
  1435. * Video:
  1436. *
  1437. * If pic.reference is set then the frame will be read later by libavcodec.
  1438. * avcodec_align_dimensions2() should be used to find the required width and
  1439. * height, as they normally need to be rounded up to the next multiple of 16.
  1440. *
  1441. * If frame multithreading is used and thread_safe_callbacks is set,
  1442. * it may be called from a different thread, but not from more than one at
  1443. * once. Does not need to be reentrant.
  1444. *
  1445. * @see release_buffer(), reget_buffer()
  1446. * @see avcodec_align_dimensions2()
  1447. *
  1448. * Audio:
  1449. *
  1450. * Decoders request a buffer of a particular size by setting
  1451. * AVFrame.nb_samples prior to calling get_buffer(). The decoder may,
  1452. * however, utilize only part of the buffer by setting AVFrame.nb_samples
  1453. * to a smaller value in the output frame.
  1454. *
  1455. * Decoders cannot use the buffer after returning from
  1456. * avcodec_decode_audio4(), so they will not call release_buffer(), as it
  1457. * is assumed to be released immediately upon return.
  1458. *
  1459. * As a convenience, av_samples_get_buffer_size() and
  1460. * av_samples_fill_arrays() in libavutil may be used by custom get_buffer()
  1461. * functions to find the required data size and to fill data pointers and
  1462. * linesize. In AVFrame.linesize, only linesize[0] may be set for audio
  1463. * since all planes must be the same size.
  1464. *
  1465. * @see av_samples_get_buffer_size(), av_samples_fill_arrays()
  1466. *
  1467. * - encoding: unused
  1468. * - decoding: Set by libavcodec, user can override.
  1469. */
  1470. int (*get_buffer)(struct AVCodecContext *c, AVFrame *pic);
  1471. /**
  1472. * Called to release buffers which were allocated with get_buffer.
  1473. * A released buffer can be reused in get_buffer().
  1474. * pic.data[*] must be set to NULL.
  1475. * May be called from a different thread if frame multithreading is used,
  1476. * but not by more than one thread at once, so does not need to be reentrant.
  1477. * - encoding: unused
  1478. * - decoding: Set by libavcodec, user can override.
  1479. */
  1480. void (*release_buffer)(struct AVCodecContext *c, AVFrame *pic);
  1481. /**
  1482. * Size of the frame reordering buffer in the decoder.
  1483. * For MPEG-2 it is 1 IPB or 0 low delay IP.
  1484. * - encoding: Set by libavcodec.
  1485. * - decoding: Set by libavcodec.
  1486. */
  1487. int has_b_frames;
  1488. /**
  1489. * number of bytes per packet if constant and known or 0
  1490. * Used by some WAV based audio codecs.
  1491. */
  1492. int block_align;
  1493. #if FF_API_PARSE_FRAME
  1494. /**
  1495. * If true, only parsing is done. The frame data is returned.
  1496. * Only MPEG audio decoders support this now.
  1497. * - encoding: unused
  1498. * - decoding: Set by user
  1499. */
  1500. attribute_deprecated int parse_only;
  1501. #endif
  1502. /**
  1503. * 0-> h263 quant 1-> mpeg quant
  1504. * - encoding: Set by user.
  1505. * - decoding: unused
  1506. */
  1507. int mpeg_quant;
  1508. /**
  1509. * pass1 encoding statistics output buffer
  1510. * - encoding: Set by libavcodec.
  1511. * - decoding: unused
  1512. */
  1513. char *stats_out;
  1514. /**
  1515. * pass2 encoding statistics input buffer
  1516. * Concatenated stuff from stats_out of pass1 should be placed here.
  1517. * - encoding: Allocated/set/freed by user.
  1518. * - decoding: unused
  1519. */
  1520. char *stats_in;
  1521. /**
  1522. * ratecontrol qmin qmax limiting method
  1523. * 0-> clipping, 1-> use a nice continous function to limit qscale wthin qmin/qmax.
  1524. * - encoding: Set by user.
  1525. * - decoding: unused
  1526. */
  1527. float rc_qsquish;
  1528. float rc_qmod_amp;
  1529. int rc_qmod_freq;
  1530. /**
  1531. * ratecontrol override, see RcOverride
  1532. * - encoding: Allocated/set/freed by user.
  1533. * - decoding: unused
  1534. */
  1535. RcOverride *rc_override;
  1536. int rc_override_count;
  1537. /**
  1538. * rate control equation
  1539. * - encoding: Set by user
  1540. * - decoding: unused
  1541. */
  1542. const char *rc_eq;
  1543. /**
  1544. * maximum bitrate
  1545. * - encoding: Set by user.
  1546. * - decoding: unused
  1547. */
  1548. int rc_max_rate;
  1549. /**
  1550. * minimum bitrate
  1551. * - encoding: Set by user.
  1552. * - decoding: unused
  1553. */
  1554. int rc_min_rate;
  1555. /**
  1556. * decoder bitstream buffer size
  1557. * - encoding: Set by user.
  1558. * - decoding: unused
  1559. */
  1560. int rc_buffer_size;
  1561. float rc_buffer_aggressivity;
  1562. /**
  1563. * qscale factor between P and I-frames
  1564. * If > 0 then the last p frame quantizer will be used (q= lastp_q*factor+offset).
  1565. * If < 0 then normal ratecontrol will be done (q= -normal_q*factor+offset).
  1566. * - encoding: Set by user.
  1567. * - decoding: unused
  1568. */
  1569. float i_quant_factor;
  1570. /**
  1571. * qscale offset between P and I-frames
  1572. * - encoding: Set by user.
  1573. * - decoding: unused
  1574. */
  1575. float i_quant_offset;
  1576. /**
  1577. * initial complexity for pass1 ratecontrol
  1578. * - encoding: Set by user.
  1579. * - decoding: unused
  1580. */
  1581. float rc_initial_cplx;
  1582. /**
  1583. * DCT algorithm, see FF_DCT_* below
  1584. * - encoding: Set by user.
  1585. * - decoding: unused
  1586. */
  1587. int dct_algo;
  1588. #define FF_DCT_AUTO 0
  1589. #define FF_DCT_FASTINT 1
  1590. #define FF_DCT_INT 2
  1591. #define FF_DCT_MMX 3
  1592. #define FF_DCT_MLIB 4
  1593. #define FF_DCT_ALTIVEC 5
  1594. #define FF_DCT_FAAN 6
  1595. /**
  1596. * luminance masking (0-> disabled)
  1597. * - encoding: Set by user.
  1598. * - decoding: unused
  1599. */
  1600. float lumi_masking;
  1601. /**
  1602. * temporary complexity masking (0-> disabled)
  1603. * - encoding: Set by user.
  1604. * - decoding: unused
  1605. */
  1606. float temporal_cplx_masking;
  1607. /**
  1608. * spatial complexity masking (0-> disabled)
  1609. * - encoding: Set by user.
  1610. * - decoding: unused
  1611. */
  1612. float spatial_cplx_masking;
  1613. /**
  1614. * p block masking (0-> disabled)
  1615. * - encoding: Set by user.
  1616. * - decoding: unused
  1617. */
  1618. float p_masking;
  1619. /**
  1620. * darkness masking (0-> disabled)
  1621. * - encoding: Set by user.
  1622. * - decoding: unused
  1623. */
  1624. float dark_masking;
  1625. /**
  1626. * IDCT algorithm, see FF_IDCT_* below.
  1627. * - encoding: Set by user.
  1628. * - decoding: Set by user.
  1629. */
  1630. int idct_algo;
  1631. #define FF_IDCT_AUTO 0
  1632. #define FF_IDCT_INT 1
  1633. #define FF_IDCT_SIMPLE 2
  1634. #define FF_IDCT_SIMPLEMMX 3
  1635. #define FF_IDCT_LIBMPEG2MMX 4
  1636. #define FF_IDCT_PS2 5
  1637. #define FF_IDCT_MLIB 6
  1638. #define FF_IDCT_ARM 7
  1639. #define FF_IDCT_ALTIVEC 8
  1640. #define FF_IDCT_SH4 9
  1641. #define FF_IDCT_SIMPLEARM 10
  1642. #define FF_IDCT_H264 11
  1643. #define FF_IDCT_VP3 12
  1644. #define FF_IDCT_IPP 13
  1645. #define FF_IDCT_XVIDMMX 14
  1646. #define FF_IDCT_CAVS 15
  1647. #define FF_IDCT_SIMPLEARMV5TE 16
  1648. #define FF_IDCT_SIMPLEARMV6 17
  1649. #define FF_IDCT_SIMPLEVIS 18
  1650. #define FF_IDCT_WMV2 19
  1651. #define FF_IDCT_FAAN 20
  1652. #define FF_IDCT_EA 21
  1653. #define FF_IDCT_SIMPLENEON 22
  1654. #define FF_IDCT_SIMPLEALPHA 23
  1655. #define FF_IDCT_BINK 24
  1656. /**
  1657. * slice count
  1658. * - encoding: Set by libavcodec.
  1659. * - decoding: Set by user (or 0).
  1660. */
  1661. int slice_count;
  1662. /**
  1663. * slice offsets in the frame in bytes
  1664. * - encoding: Set/allocated by libavcodec.
  1665. * - decoding: Set/allocated by user (or NULL).
  1666. */
  1667. int *slice_offset;
  1668. /**
  1669. * error concealment flags
  1670. * - encoding: unused
  1671. * - decoding: Set by user.
  1672. */
  1673. int error_concealment;
  1674. #define FF_EC_GUESS_MVS 1
  1675. #define FF_EC_DEBLOCK 2
  1676. /**
  1677. * dsp_mask could be add used to disable unwanted CPU features
  1678. * CPU features (i.e. MMX, SSE. ...)
  1679. *
  1680. * With the FORCE flag you may instead enable given CPU features.
  1681. * (Dangerous: Usable in case of misdetection, improper usage however will
  1682. * result into program crash.)
  1683. */
  1684. unsigned dsp_mask;
  1685. /**
  1686. * bits per sample/pixel from the demuxer (needed for huffyuv).
  1687. * - encoding: Set by libavcodec.
  1688. * - decoding: Set by user.
  1689. */
  1690. int bits_per_coded_sample;
  1691. /**
  1692. * prediction method (needed for huffyuv)
  1693. * - encoding: Set by user.
  1694. * - decoding: unused
  1695. */
  1696. int prediction_method;
  1697. #define FF_PRED_LEFT 0
  1698. #define FF_PRED_PLANE 1
  1699. #define FF_PRED_MEDIAN 2
  1700. /**
  1701. * sample aspect ratio (0 if unknown)
  1702. * That is the width of a pixel divided by the height of the pixel.
  1703. * Numerator and denominator must be relatively prime and smaller than 256 for some video standards.
  1704. * - encoding: Set by user.
  1705. * - decoding: Set by libavcodec.
  1706. */
  1707. AVRational sample_aspect_ratio;
  1708. /**
  1709. * the picture in the bitstream
  1710. * - encoding: Set by libavcodec.
  1711. * - decoding: Set by libavcodec.
  1712. */
  1713. AVFrame *coded_frame;
  1714. /**
  1715. * debug
  1716. * - encoding: Set by user.
  1717. * - decoding: Set by user.
  1718. */
  1719. int debug;
  1720. #define FF_DEBUG_PICT_INFO 1
  1721. #define FF_DEBUG_RC 2
  1722. #define FF_DEBUG_BITSTREAM 4
  1723. #define FF_DEBUG_MB_TYPE 8
  1724. #define FF_DEBUG_QP 16
  1725. #define FF_DEBUG_MV 32
  1726. #define FF_DEBUG_DCT_COEFF 0x00000040
  1727. #define FF_DEBUG_SKIP 0x00000080
  1728. #define FF_DEBUG_STARTCODE 0x00000100
  1729. #define FF_DEBUG_PTS 0x00000200
  1730. #define FF_DEBUG_ER 0x00000400
  1731. #define FF_DEBUG_MMCO 0x00000800
  1732. #define FF_DEBUG_BUGS 0x00001000
  1733. #define FF_DEBUG_VIS_QP 0x00002000
  1734. #define FF_DEBUG_VIS_MB_TYPE 0x00004000
  1735. #define FF_DEBUG_BUFFERS 0x00008000
  1736. #define FF_DEBUG_THREADS 0x00010000
  1737. /**
  1738. * debug
  1739. * - encoding: Set by user.
  1740. * - decoding: Set by user.
  1741. */
  1742. int debug_mv;
  1743. #define FF_DEBUG_VIS_MV_P_FOR 0x00000001 //visualize forward predicted MVs of P frames
  1744. #define FF_DEBUG_VIS_MV_B_FOR 0x00000002 //visualize forward predicted MVs of B frames
  1745. #define FF_DEBUG_VIS_MV_B_BACK 0x00000004 //visualize backward predicted MVs of B frames
  1746. /**
  1747. * error
  1748. * - encoding: Set by libavcodec if flags&CODEC_FLAG_PSNR.
  1749. * - decoding: unused
  1750. */
  1751. uint64_t error[AV_NUM_DATA_POINTERS];
  1752. /**
  1753. * motion estimation comparison function
  1754. * - encoding: Set by user.
  1755. * - decoding: unused
  1756. */
  1757. int me_cmp;
  1758. /**
  1759. * subpixel motion estimation comparison function
  1760. * - encoding: Set by user.
  1761. * - decoding: unused
  1762. */
  1763. int me_sub_cmp;
  1764. /**
  1765. * macroblock comparison function (not supported yet)
  1766. * - encoding: Set by user.
  1767. * - decoding: unused
  1768. */
  1769. int mb_cmp;
  1770. /**
  1771. * interlaced DCT comparison function
  1772. * - encoding: Set by user.
  1773. * - decoding: unused
  1774. */
  1775. int ildct_cmp;
  1776. #define FF_CMP_SAD 0
  1777. #define FF_CMP_SSE 1
  1778. #define FF_CMP_SATD 2
  1779. #define FF_CMP_DCT 3
  1780. #define FF_CMP_PSNR 4
  1781. #define FF_CMP_BIT 5
  1782. #define FF_CMP_RD 6
  1783. #define FF_CMP_ZERO 7
  1784. #define FF_CMP_VSAD 8
  1785. #define FF_CMP_VSSE 9
  1786. #define FF_CMP_NSSE 10
  1787. #define FF_CMP_W53 11
  1788. #define FF_CMP_W97 12
  1789. #define FF_CMP_DCTMAX 13
  1790. #define FF_CMP_DCT264 14
  1791. #define FF_CMP_CHROMA 256
  1792. /**
  1793. * ME diamond size & shape
  1794. * - encoding: Set by user.
  1795. * - decoding: unused
  1796. */
  1797. int dia_size;
  1798. /**
  1799. * amount of previous MV predictors (2a+1 x 2a+1 square)
  1800. * - encoding: Set by user.
  1801. * - decoding: unused
  1802. */
  1803. int last_predictor_count;
  1804. /**
  1805. * prepass for motion estimation
  1806. * - encoding: Set by user.
  1807. * - decoding: unused
  1808. */
  1809. int pre_me;
  1810. /**
  1811. * motion estimation prepass comparison function
  1812. * - encoding: Set by user.
  1813. * - decoding: unused
  1814. */
  1815. int me_pre_cmp;
  1816. /**
  1817. * ME prepass diamond size & shape
  1818. * - encoding: Set by user.
  1819. * - decoding: unused
  1820. */
  1821. int pre_dia_size;
  1822. /**
  1823. * subpel ME quality
  1824. * - encoding: Set by user.
  1825. * - decoding: unused
  1826. */
  1827. int me_subpel_quality;
  1828. /**
  1829. * callback to negotiate the pixelFormat
  1830. * @param fmt is the list of formats which are supported by the codec,
  1831. * it is terminated by -1 as 0 is a valid format, the formats are ordered by quality.
  1832. * The first is always the native one.
  1833. * @return the chosen format
  1834. * - encoding: unused
  1835. * - decoding: Set by user, if not set the native format will be chosen.
  1836. */
  1837. enum PixelFormat (*get_format)(struct AVCodecContext *s, const enum PixelFormat * fmt);
  1838. /**
  1839. * DTG active format information (additional aspect ratio
  1840. * information only used in DVB MPEG-2 transport streams)
  1841. * 0 if not set.
  1842. *
  1843. * - encoding: unused
  1844. * - decoding: Set by decoder.
  1845. */
  1846. int dtg_active_format;
  1847. #define FF_DTG_AFD_SAME 8
  1848. #define FF_DTG_AFD_4_3 9
  1849. #define FF_DTG_AFD_16_9 10
  1850. #define FF_DTG_AFD_14_9 11
  1851. #define FF_DTG_AFD_4_3_SP_14_9 13
  1852. #define FF_DTG_AFD_16_9_SP_14_9 14
  1853. #define FF_DTG_AFD_SP_4_3 15
  1854. /**
  1855. * maximum motion estimation search range in subpel units
  1856. * If 0 then no limit.
  1857. *
  1858. * - encoding: Set by user.
  1859. * - decoding: unused
  1860. */
  1861. int me_range;
  1862. /**
  1863. * intra quantizer bias
  1864. * - encoding: Set by user.
  1865. * - decoding: unused
  1866. */
  1867. int intra_quant_bias;
  1868. #define FF_DEFAULT_QUANT_BIAS 999999
  1869. /**
  1870. * inter quantizer bias
  1871. * - encoding: Set by user.
  1872. * - decoding: unused
  1873. */
  1874. int inter_quant_bias;
  1875. /**
  1876. * color table ID
  1877. * - encoding: unused
  1878. * - decoding: Which clrtable should be used for 8bit RGB images.
  1879. * Tables have to be stored somewhere. FIXME
  1880. */
  1881. int color_table_id;
  1882. #if FF_API_INTERNAL_CONTEXT
  1883. /**
  1884. * internal_buffer count
  1885. * Don't touch, used by libavcodec default_get_buffer().
  1886. * @deprecated this field was moved to an internal context
  1887. */
  1888. attribute_deprecated int internal_buffer_count;
  1889. /**
  1890. * internal_buffers
  1891. * Don't touch, used by libavcodec default_get_buffer().
  1892. * @deprecated this field was moved to an internal context
  1893. */
  1894. attribute_deprecated void *internal_buffer;
  1895. #endif
  1896. /**
  1897. * Global quality for codecs which cannot change it per frame.
  1898. * This should be proportional to MPEG-1/2/4 qscale.
  1899. * - encoding: Set by user.
  1900. * - decoding: unused
  1901. */
  1902. int global_quality;
  1903. #define FF_CODER_TYPE_VLC 0
  1904. #define FF_CODER_TYPE_AC 1
  1905. #define FF_CODER_TYPE_RAW 2
  1906. #define FF_CODER_TYPE_RLE 3
  1907. #define FF_CODER_TYPE_DEFLATE 4
  1908. /**
  1909. * coder type
  1910. * - encoding: Set by user.
  1911. * - decoding: unused
  1912. */
  1913. int coder_type;
  1914. /**
  1915. * context model
  1916. * - encoding: Set by user.
  1917. * - decoding: unused
  1918. */
  1919. int context_model;
  1920. #if 0
  1921. /**
  1922. *
  1923. * - encoding: unused
  1924. * - decoding: Set by user.
  1925. */
  1926. uint8_t * (*realloc)(struct AVCodecContext *s, uint8_t *buf, int buf_size);
  1927. #endif
  1928. /**
  1929. * slice flags
  1930. * - encoding: unused
  1931. * - decoding: Set by user.
  1932. */
  1933. int slice_flags;
  1934. #define SLICE_FLAG_CODED_ORDER 0x0001 ///< draw_horiz_band() is called in coded order instead of display
  1935. #define SLICE_FLAG_ALLOW_FIELD 0x0002 ///< allow draw_horiz_band() with field slices (MPEG2 field pics)
  1936. #define SLICE_FLAG_ALLOW_PLANE 0x0004 ///< allow draw_horiz_band() with 1 component at a time (SVQ1)
  1937. /**
  1938. * XVideo Motion Acceleration
  1939. * - encoding: forbidden
  1940. * - decoding: set by decoder
  1941. */
  1942. int xvmc_acceleration;
  1943. /**
  1944. * macroblock decision mode
  1945. * - encoding: Set by user.
  1946. * - decoding: unused
  1947. */
  1948. int mb_decision;
  1949. #define FF_MB_DECISION_SIMPLE 0 ///< uses mb_cmp
  1950. #define FF_MB_DECISION_BITS 1 ///< chooses the one which needs the fewest bits
  1951. #define FF_MB_DECISION_RD 2 ///< rate distortion
  1952. /**
  1953. * custom intra quantization matrix
  1954. * - encoding: Set by user, can be NULL.
  1955. * - decoding: Set by libavcodec.
  1956. */
  1957. uint16_t *intra_matrix;
  1958. /**
  1959. * custom inter quantization matrix
  1960. * - encoding: Set by user, can be NULL.
  1961. * - decoding: Set by libavcodec.
  1962. */
  1963. uint16_t *inter_matrix;
  1964. /**
  1965. * fourcc from the AVI stream header (LSB first, so "ABCD" -> ('D'<<24) + ('C'<<16) + ('B'<<8) + 'A').
  1966. * This is used to work around some encoder bugs.
  1967. * - encoding: unused
  1968. * - decoding: Set by user, will be converted to uppercase by libavcodec during init.
  1969. */
  1970. unsigned int stream_codec_tag;
  1971. /**
  1972. * scene change detection threshold
  1973. * 0 is default, larger means fewer detected scene changes.
  1974. * - encoding: Set by user.
  1975. * - decoding: unused
  1976. */
  1977. int scenechange_threshold;
  1978. /**
  1979. * minimum Lagrange multipler
  1980. * - encoding: Set by user.
  1981. * - decoding: unused
  1982. */
  1983. int lmin;
  1984. /**
  1985. * maximum Lagrange multipler
  1986. * - encoding: Set by user.
  1987. * - decoding: unused
  1988. */
  1989. int lmax;
  1990. /**
  1991. * noise reduction strength
  1992. * - encoding: Set by user.
  1993. * - decoding: unused
  1994. */
  1995. int noise_reduction;
  1996. /**
  1997. * Called at the beginning of a frame to get cr buffer for it.
  1998. * Buffer type (size, hints) must be the same. libavcodec won't check it.
  1999. * libavcodec will pass previous buffer in pic, function should return
  2000. * same buffer or new buffer with old frame "painted" into it.
  2001. * If pic.data[0] == NULL must behave like get_buffer().
  2002. * if CODEC_CAP_DR1 is not set then reget_buffer() must call
  2003. * avcodec_default_reget_buffer() instead of providing buffers allocated by
  2004. * some other means.
  2005. * - encoding: unused
  2006. * - decoding: Set by libavcodec, user can override.
  2007. */
  2008. int (*reget_buffer)(struct AVCodecContext *c, AVFrame *pic);
  2009. /**
  2010. * Number of bits which should be loaded into the rc buffer before decoding starts.
  2011. * - encoding: Set by user.
  2012. * - decoding: unused
  2013. */
  2014. int rc_initial_buffer_occupancy;
  2015. /**
  2016. *
  2017. * - encoding: Set by user.
  2018. * - decoding: unused
  2019. */
  2020. int inter_threshold;
  2021. /**
  2022. * CODEC_FLAG2_*
  2023. * - encoding: Set by user.
  2024. * - decoding: Set by user.
  2025. */
  2026. int flags2;
  2027. /**
  2028. * Simulates errors in the bitstream to test error concealment.
  2029. * - encoding: Set by user.
  2030. * - decoding: unused
  2031. */
  2032. int error_rate;
  2033. /**
  2034. * quantizer noise shaping
  2035. * - encoding: Set by user.
  2036. * - decoding: unused
  2037. */
  2038. int quantizer_noise_shaping;
  2039. /**
  2040. * thread count
  2041. * is used to decide how many independent tasks should be passed to execute()
  2042. * - encoding: Set by user.
  2043. * - decoding: Set by user.
  2044. */
  2045. int thread_count;
  2046. /**
  2047. * The codec may call this to execute several independent things.
  2048. * It will return only after finishing all tasks.
  2049. * The user may replace this with some multithreaded implementation,
  2050. * the default implementation will execute the parts serially.
  2051. * @param count the number of things to execute
  2052. * - encoding: Set by libavcodec, user can override.
  2053. * - decoding: Set by libavcodec, user can override.
  2054. */
  2055. int (*execute)(struct AVCodecContext *c, int (*func)(struct AVCodecContext *c2, void *arg), void *arg2, int *ret, int count, int size);
  2056. /**
  2057. * thread opaque
  2058. * Can be used by execute() to store some per AVCodecContext stuff.
  2059. * - encoding: set by execute()
  2060. * - decoding: set by execute()
  2061. */
  2062. void *thread_opaque;
  2063. /**
  2064. * Motion estimation threshold below which no motion estimation is
  2065. * performed, but instead the user specified motion vectors are used.
  2066. *
  2067. * - encoding: Set by user.
  2068. * - decoding: unused
  2069. */
  2070. int me_threshold;
  2071. /**
  2072. * Macroblock threshold below which the user specified macroblock types will be used.
  2073. * - encoding: Set by user.
  2074. * - decoding: unused
  2075. */
  2076. int mb_threshold;
  2077. /**
  2078. * precision of the intra DC coefficient - 8
  2079. * - encoding: Set by user.
  2080. * - decoding: unused
  2081. */
  2082. int intra_dc_precision;
  2083. /**
  2084. * noise vs. sse weight for the nsse comparsion function
  2085. * - encoding: Set by user.
  2086. * - decoding: unused
  2087. */
  2088. int nsse_weight;
  2089. /**
  2090. * Number of macroblock rows at the top which are skipped.
  2091. * - encoding: unused
  2092. * - decoding: Set by user.
  2093. */
  2094. int skip_top;
  2095. /**
  2096. * Number of macroblock rows at the bottom which are skipped.
  2097. * - encoding: unused
  2098. * - decoding: Set by user.
  2099. */
  2100. int skip_bottom;
  2101. /**
  2102. * profile
  2103. * - encoding: Set by user.
  2104. * - decoding: Set by libavcodec.
  2105. */
  2106. int profile;
  2107. #define FF_PROFILE_UNKNOWN -99
  2108. #define FF_PROFILE_RESERVED -100
  2109. #define FF_PROFILE_AAC_MAIN 0
  2110. #define FF_PROFILE_AAC_LOW 1
  2111. #define FF_PROFILE_AAC_SSR 2
  2112. #define FF_PROFILE_AAC_LTP 3
  2113. #define FF_PROFILE_DTS 20
  2114. #define FF_PROFILE_DTS_ES 30
  2115. #define FF_PROFILE_DTS_96_24 40
  2116. #define FF_PROFILE_DTS_HD_HRA 50
  2117. #define FF_PROFILE_DTS_HD_MA 60
  2118. #define FF_PROFILE_MPEG2_422 0
  2119. #define FF_PROFILE_MPEG2_HIGH 1
  2120. #define FF_PROFILE_MPEG2_SS 2
  2121. #define FF_PROFILE_MPEG2_SNR_SCALABLE 3
  2122. #define FF_PROFILE_MPEG2_MAIN 4
  2123. #define FF_PROFILE_MPEG2_SIMPLE 5
  2124. #define FF_PROFILE_H264_CONSTRAINED (1<<9) // 8+1; constraint_set1_flag
  2125. #define FF_PROFILE_H264_INTRA (1<<11) // 8+3; constraint_set3_flag
  2126. #define FF_PROFILE_H264_BASELINE 66
  2127. #define FF_PROFILE_H264_CONSTRAINED_BASELINE (66|FF_PROFILE_H264_CONSTRAINED)
  2128. #define FF_PROFILE_H264_MAIN 77
  2129. #define FF_PROFILE_H264_EXTENDED 88
  2130. #define FF_PROFILE_H264_HIGH 100
  2131. #define FF_PROFILE_H264_HIGH_10 110
  2132. #define FF_PROFILE_H264_HIGH_10_INTRA (110|FF_PROFILE_H264_INTRA)
  2133. #define FF_PROFILE_H264_HIGH_422 122
  2134. #define FF_PROFILE_H264_HIGH_422_INTRA (122|FF_PROFILE_H264_INTRA)
  2135. #define FF_PROFILE_H264_HIGH_444 144
  2136. #define FF_PROFILE_H264_HIGH_444_PREDICTIVE 244
  2137. #define FF_PROFILE_H264_HIGH_444_INTRA (244|FF_PROFILE_H264_INTRA)
  2138. #define FF_PROFILE_H264_CAVLC_444 44
  2139. #define FF_PROFILE_VC1_SIMPLE 0
  2140. #define FF_PROFILE_VC1_MAIN 1
  2141. #define FF_PROFILE_VC1_COMPLEX 2
  2142. #define FF_PROFILE_VC1_ADVANCED 3
  2143. #define FF_PROFILE_MPEG4_SIMPLE 0
  2144. #define FF_PROFILE_MPEG4_SIMPLE_SCALABLE 1
  2145. #define FF_PROFILE_MPEG4_CORE 2
  2146. #define FF_PROFILE_MPEG4_MAIN 3
  2147. #define FF_PROFILE_MPEG4_N_BIT 4
  2148. #define FF_PROFILE_MPEG4_SCALABLE_TEXTURE 5
  2149. #define FF_PROFILE_MPEG4_SIMPLE_FACE_ANIMATION 6
  2150. #define FF_PROFILE_MPEG4_BASIC_ANIMATED_TEXTURE 7
  2151. #define FF_PROFILE_MPEG4_HYBRID 8
  2152. #define FF_PROFILE_MPEG4_ADVANCED_REAL_TIME 9
  2153. #define FF_PROFILE_MPEG4_CORE_SCALABLE 10
  2154. #define FF_PROFILE_MPEG4_ADVANCED_CODING 11
  2155. #define FF_PROFILE_MPEG4_ADVANCED_CORE 12
  2156. #define FF_PROFILE_MPEG4_ADVANCED_SCALABLE_TEXTURE 13
  2157. #define FF_PROFILE_MPEG4_SIMPLE_STUDIO 14
  2158. #define FF_PROFILE_MPEG4_ADVANCED_SIMPLE 15
  2159. /**
  2160. * level
  2161. * - encoding: Set by user.
  2162. * - decoding: Set by libavcodec.
  2163. */
  2164. int level;
  2165. #define FF_LEVEL_UNKNOWN -99
  2166. /**
  2167. * low resolution decoding, 1-> 1/2 size, 2->1/4 size
  2168. * - encoding: unused
  2169. * - decoding: Set by user.
  2170. */
  2171. int lowres;
  2172. /**
  2173. * Bitstream width / height, may be different from width/height if lowres enabled.
  2174. * - encoding: unused
  2175. * - decoding: Set by user before init if known. Codec should override / dynamically change if needed.
  2176. */
  2177. int coded_width, coded_height;
  2178. /**
  2179. * frame skip threshold
  2180. * - encoding: Set by user.
  2181. * - decoding: unused
  2182. */
  2183. int frame_skip_threshold;
  2184. /**
  2185. * frame skip factor
  2186. * - encoding: Set by user.
  2187. * - decoding: unused
  2188. */
  2189. int frame_skip_factor;
  2190. /**
  2191. * frame skip exponent
  2192. * - encoding: Set by user.
  2193. * - decoding: unused
  2194. */
  2195. int frame_skip_exp;
  2196. /**
  2197. * frame skip comparison function
  2198. * - encoding: Set by user.
  2199. * - decoding: unused
  2200. */
  2201. int frame_skip_cmp;
  2202. /**
  2203. * Border processing masking, raises the quantizer for mbs on the borders
  2204. * of the picture.
  2205. * - encoding: Set by user.
  2206. * - decoding: unused
  2207. */
  2208. float border_masking;
  2209. /**
  2210. * minimum MB lagrange multipler
  2211. * - encoding: Set by user.
  2212. * - decoding: unused
  2213. */
  2214. int mb_lmin;
  2215. /**
  2216. * maximum MB lagrange multipler
  2217. * - encoding: Set by user.
  2218. * - decoding: unused
  2219. */
  2220. int mb_lmax;
  2221. /**
  2222. *
  2223. * - encoding: Set by user.
  2224. * - decoding: unused
  2225. */
  2226. int me_penalty_compensation;
  2227. /**
  2228. *
  2229. * - encoding: unused
  2230. * - decoding: Set by user.
  2231. */
  2232. enum AVDiscard skip_loop_filter;
  2233. /**
  2234. *
  2235. * - encoding: unused
  2236. * - decoding: Set by user.
  2237. */
  2238. enum AVDiscard skip_idct;
  2239. /**
  2240. *
  2241. * - encoding: unused
  2242. * - decoding: Set by user.
  2243. */
  2244. enum AVDiscard skip_frame;
  2245. /**
  2246. *
  2247. * - encoding: Set by user.
  2248. * - decoding: unused
  2249. */
  2250. int bidir_refine;
  2251. /**
  2252. *
  2253. * - encoding: Set by user.
  2254. * - decoding: unused
  2255. */
  2256. int brd_scale;
  2257. /**
  2258. * minimum GOP size
  2259. * - encoding: Set by user.
  2260. * - decoding: unused
  2261. */
  2262. int keyint_min;
  2263. /**
  2264. * number of reference frames
  2265. * - encoding: Set by user.
  2266. * - decoding: Set by lavc.
  2267. */
  2268. int refs;
  2269. /**
  2270. * chroma qp offset from luma
  2271. * - encoding: Set by user.
  2272. * - decoding: unused
  2273. */
  2274. int chromaoffset;
  2275. /**
  2276. * trellis RD quantization
  2277. * - encoding: Set by user.
  2278. * - decoding: unused
  2279. */
  2280. int trellis;
  2281. /**
  2282. * Audio cutoff bandwidth (0 means "automatic")
  2283. * - encoding: Set by user.
  2284. * - decoding: unused
  2285. */
  2286. int cutoff;
  2287. /**
  2288. * Multiplied by qscale for each frame and added to scene_change_score.
  2289. * - encoding: Set by user.
  2290. * - decoding: unused
  2291. */
  2292. int scenechange_factor;
  2293. /**
  2294. *
  2295. * Note: Value depends upon the compare function used for fullpel ME.
  2296. * - encoding: Set by user.
  2297. * - decoding: unused
  2298. */
  2299. int mv0_threshold;
  2300. /**
  2301. * Adjust sensitivity of b_frame_strategy 1.
  2302. * - encoding: Set by user.
  2303. * - decoding: unused
  2304. */
  2305. int b_sensitivity;
  2306. /**
  2307. * - encoding: Set by user.
  2308. * - decoding: unused
  2309. */
  2310. int compression_level;
  2311. #define FF_COMPRESSION_DEFAULT -1
  2312. /**
  2313. * - encoding: Set by user.
  2314. * - decoding: unused
  2315. */
  2316. int min_prediction_order;
  2317. /**
  2318. * - encoding: Set by user.
  2319. * - decoding: unused
  2320. */
  2321. int max_prediction_order;
  2322. /**
  2323. * GOP timecode frame start number, in non drop frame format
  2324. * - encoding: Set by user.
  2325. * - decoding: unused
  2326. */
  2327. int64_t timecode_frame_start;
  2328. #if FF_API_REQUEST_CHANNELS
  2329. /**
  2330. * Decoder should decode to this many channels if it can (0 for default)
  2331. * - encoding: unused
  2332. * - decoding: Set by user.
  2333. * @deprecated Deprecated in favor of request_channel_layout.
  2334. */
  2335. int request_channels;
  2336. #endif
  2337. /**
  2338. * opaque 64bit number (generally a PTS) that will be reordered and
  2339. * output in AVFrame.reordered_opaque
  2340. * @deprecated in favor of pkt_pts
  2341. * - encoding: unused
  2342. * - decoding: Set by user.
  2343. */
  2344. int64_t reordered_opaque;
  2345. /**
  2346. * Bits per sample/pixel of internal libavcodec pixel/sample format.
  2347. * - encoding: set by user.
  2348. * - decoding: set by libavcodec.
  2349. */
  2350. int bits_per_raw_sample;
  2351. /**
  2352. * Audio channel layout.
  2353. * - encoding: set by user.
  2354. * - decoding: set by libavcodec.
  2355. */
  2356. uint64_t channel_layout;
  2357. /**
  2358. * Request decoder to use this channel layout if it can (0 for default)
  2359. * - encoding: unused
  2360. * - decoding: Set by user.
  2361. */
  2362. uint64_t request_channel_layout;
  2363. /**
  2364. * Ratecontrol attempt to use, at maximum, <value> of what can be used without an underflow.
  2365. * - encoding: Set by user.
  2366. * - decoding: unused.
  2367. */
  2368. float rc_max_available_vbv_use;
  2369. /**
  2370. * Ratecontrol attempt to use, at least, <value> times the amount needed to prevent a vbv overflow.
  2371. * - encoding: Set by user.
  2372. * - decoding: unused.
  2373. */
  2374. float rc_min_vbv_overflow_use;
  2375. /**
  2376. * Hardware accelerator in use
  2377. * - encoding: unused.
  2378. * - decoding: Set by libavcodec
  2379. */
  2380. struct AVHWAccel *hwaccel;
  2381. /**
  2382. * For some codecs, the time base is closer to the field rate than the frame rate.
  2383. * Most notably, H.264 and MPEG-2 specify time_base as half of frame duration
  2384. * if no telecine is used ...
  2385. *
  2386. * Set to time_base ticks per frame. Default 1, e.g., H.264/MPEG-2 set it to 2.
  2387. */
  2388. int ticks_per_frame;
  2389. /**
  2390. * Hardware accelerator context.
  2391. * For some hardware accelerators, a global context needs to be
  2392. * provided by the user. In that case, this holds display-dependent
  2393. * data Libav cannot instantiate itself. Please refer to the
  2394. * Libav HW accelerator documentation to know how to fill this
  2395. * is. e.g. for VA API, this is a struct vaapi_context.
  2396. * - encoding: unused
  2397. * - decoding: Set by user
  2398. */
  2399. void *hwaccel_context;
  2400. /**
  2401. * Chromaticity coordinates of the source primaries.
  2402. * - encoding: Set by user
  2403. * - decoding: Set by libavcodec
  2404. */
  2405. enum AVColorPrimaries color_primaries;
  2406. /**
  2407. * Color Transfer Characteristic.
  2408. * - encoding: Set by user
  2409. * - decoding: Set by libavcodec
  2410. */
  2411. enum AVColorTransferCharacteristic color_trc;
  2412. /**
  2413. * YUV colorspace type.
  2414. * - encoding: Set by user
  2415. * - decoding: Set by libavcodec
  2416. */
  2417. enum AVColorSpace colorspace;
  2418. /**
  2419. * MPEG vs JPEG YUV range.
  2420. * - encoding: Set by user
  2421. * - decoding: Set by libavcodec
  2422. */
  2423. enum AVColorRange color_range;
  2424. /**
  2425. * This defines the location of chroma samples.
  2426. * - encoding: Set by user
  2427. * - decoding: Set by libavcodec
  2428. */
  2429. enum AVChromaLocation chroma_sample_location;
  2430. /**
  2431. * The codec may call this to execute several independent things.
  2432. * It will return only after finishing all tasks.
  2433. * The user may replace this with some multithreaded implementation,
  2434. * the default implementation will execute the parts serially.
  2435. * Also see avcodec_thread_init and e.g. the --enable-pthread configure option.
  2436. * @param c context passed also to func
  2437. * @param count the number of things to execute
  2438. * @param arg2 argument passed unchanged to func
  2439. * @param ret return values of executed functions, must have space for "count" values. May be NULL.
  2440. * @param func function that will be called count times, with jobnr from 0 to count-1.
  2441. * threadnr will be in the range 0 to c->thread_count-1 < MAX_THREADS and so that no
  2442. * two instances of func executing at the same time will have the same threadnr.
  2443. * @return always 0 currently, but code should handle a future improvement where when any call to func
  2444. * returns < 0 no further calls to func may be done and < 0 is returned.
  2445. * - encoding: Set by libavcodec, user can override.
  2446. * - decoding: Set by libavcodec, user can override.
  2447. */
  2448. int (*execute2)(struct AVCodecContext *c, int (*func)(struct AVCodecContext *c2, void *arg, int jobnr, int threadnr), void *arg2, int *ret, int count);
  2449. int log_level_offset;
  2450. /**
  2451. * Number of slices.
  2452. * Indicates number of picture subdivisions. Used for parallelized
  2453. * decoding.
  2454. * - encoding: Set by user
  2455. * - decoding: unused
  2456. */
  2457. int slices;
  2458. /**
  2459. * Header containing style information for text subtitles.
  2460. * For SUBTITLE_ASS subtitle type, it should contain the whole ASS
  2461. * [Script Info] and [V4+ Styles] section, plus the [Events] line and
  2462. * the Format line following. It shouldn't include any Dialogue line.
  2463. * - encoding: Set/allocated/freed by user (before avcodec_open2())
  2464. * - decoding: Set/allocated/freed by libavcodec (by avcodec_open2())
  2465. */
  2466. uint8_t *subtitle_header;
  2467. int subtitle_header_size;
  2468. /**
  2469. * Current packet as passed into the decoder, to avoid having
  2470. * to pass the packet into every function. Currently only valid
  2471. * inside lavc and get/release_buffer callbacks.
  2472. * - decoding: set by avcodec_decode_*, read by get_buffer() for setting pkt_pts
  2473. * - encoding: unused
  2474. */
  2475. AVPacket *pkt;
  2476. #if FF_API_INTERNAL_CONTEXT
  2477. /**
  2478. * Whether this is a copy of the context which had init() called on it.
  2479. * This is used by multithreading - shared tables and picture pointers
  2480. * should be freed from the original context only.
  2481. * - encoding: Set by libavcodec.
  2482. * - decoding: Set by libavcodec.
  2483. *
  2484. * @deprecated this field has been moved to an internal context
  2485. */
  2486. attribute_deprecated int is_copy;
  2487. #endif
  2488. /**
  2489. * Which multithreading methods to use.
  2490. * Use of FF_THREAD_FRAME will increase decoding delay by one frame per thread,
  2491. * so clients which cannot provide future frames should not use it.
  2492. *
  2493. * - encoding: Set by user, otherwise the default is used.
  2494. * - decoding: Set by user, otherwise the default is used.
  2495. */
  2496. int thread_type;
  2497. #define FF_THREAD_FRAME 1 ///< Decode more than one frame at once
  2498. #define FF_THREAD_SLICE 2 ///< Decode more than one part of a single frame at once
  2499. /**
  2500. * Which multithreading methods are in use by the codec.
  2501. * - encoding: Set by libavcodec.
  2502. * - decoding: Set by libavcodec.
  2503. */
  2504. int active_thread_type;
  2505. /**
  2506. * Set by the client if its custom get_buffer() callback can be called
  2507. * from another thread, which allows faster multithreaded decoding.
  2508. * draw_horiz_band() will be called from other threads regardless of this setting.
  2509. * Ignored if the default get_buffer() is used.
  2510. * - encoding: Set by user.
  2511. * - decoding: Set by user.
  2512. */
  2513. int thread_safe_callbacks;
  2514. /**
  2515. * VBV delay coded in the last frame (in periods of a 27 MHz clock).
  2516. * Used for compliant TS muxing.
  2517. * - encoding: Set by libavcodec.
  2518. * - decoding: unused.
  2519. */
  2520. uint64_t vbv_delay;
  2521. /**
  2522. * Type of service that the audio stream conveys.
  2523. * - encoding: Set by user.
  2524. * - decoding: Set by libavcodec.
  2525. */
  2526. enum AVAudioServiceType audio_service_type;
  2527. /**
  2528. * Used to request a sample format from the decoder.
  2529. * - encoding: unused.
  2530. * - decoding: Set by user.
  2531. */
  2532. enum AVSampleFormat request_sample_fmt;
  2533. /**
  2534. * Error recognition; may misdetect some more or less valid parts as errors.
  2535. * - encoding: unused
  2536. * - decoding: Set by user.
  2537. */
  2538. int err_recognition;
  2539. #define AV_EF_CRCCHECK (1<<0)
  2540. #define AV_EF_BITSTREAM (1<<1)
  2541. #define AV_EF_BUFFER (1<<2)
  2542. #define AV_EF_EXPLODE (1<<3)
  2543. /**
  2544. * Private context used for internal data.
  2545. *
  2546. * Unlike priv_data, this is not codec-specific. It is used in general
  2547. * libavcodec functions.
  2548. */
  2549. struct AVCodecInternal *internal;
  2550. /** Field order
  2551. * - encoding: set by libavcodec
  2552. * - decoding: Set by libavcodec
  2553. */
  2554. enum AVFieldOrder field_order;
  2555. } AVCodecContext;
  2556. /**
  2557. * AVProfile.
  2558. */
  2559. typedef struct AVProfile {
  2560. int profile;
  2561. const char *name; ///< short name for the profile
  2562. } AVProfile;
  2563. typedef struct AVCodecDefault AVCodecDefault;
  2564. /**
  2565. * AVCodec.
  2566. */
  2567. typedef struct AVCodec {
  2568. /**
  2569. * Name of the codec implementation.
  2570. * The name is globally unique among encoders and among decoders (but an
  2571. * encoder and a decoder can share the same name).
  2572. * This is the primary way to find a codec from the user perspective.
  2573. */
  2574. const char *name;
  2575. enum AVMediaType type;
  2576. enum CodecID id;
  2577. int priv_data_size;
  2578. int (*init)(AVCodecContext *);
  2579. int (*encode)(AVCodecContext *, uint8_t *buf, int buf_size, void *data);
  2580. int (*close)(AVCodecContext *);
  2581. int (*decode)(AVCodecContext *, void *outdata, int *outdata_size, AVPacket *avpkt);
  2582. /**
  2583. * Codec capabilities.
  2584. * see CODEC_CAP_*
  2585. */
  2586. int capabilities;
  2587. struct AVCodec *next;
  2588. /**
  2589. * Flush buffers.
  2590. * Will be called when seeking
  2591. */
  2592. void (*flush)(AVCodecContext *);
  2593. const AVRational *supported_framerates; ///< array of supported framerates, or NULL if any, array is terminated by {0,0}
  2594. const enum PixelFormat *pix_fmts; ///< array of supported pixel formats, or NULL if unknown, array is terminated by -1
  2595. /**
  2596. * Descriptive name for the codec, meant to be more human readable than name.
  2597. * You should use the NULL_IF_CONFIG_SMALL() macro to define it.
  2598. */
  2599. const char *long_name;
  2600. const int *supported_samplerates; ///< array of supported audio samplerates, or NULL if unknown, array is terminated by 0
  2601. const enum AVSampleFormat *sample_fmts; ///< array of supported sample formats, or NULL if unknown, array is terminated by -1
  2602. const uint64_t *channel_layouts; ///< array of support channel layouts, or NULL if unknown. array is terminated by 0
  2603. uint8_t max_lowres; ///< maximum value for lowres supported by the decoder
  2604. const AVClass *priv_class; ///< AVClass for the private context
  2605. const AVProfile *profiles; ///< array of recognized profiles, or NULL if unknown, array is terminated by {FF_PROFILE_UNKNOWN}
  2606. /**
  2607. * @name Frame-level threading support functions
  2608. * @{
  2609. */
  2610. /**
  2611. * If defined, called on thread contexts when they are created.
  2612. * If the codec allocates writable tables in init(), re-allocate them here.
  2613. * priv_data will be set to a copy of the original.
  2614. */
  2615. int (*init_thread_copy)(AVCodecContext *);
  2616. /**
  2617. * Copy necessary context variables from a previous thread context to the current one.
  2618. * If not defined, the next thread will start automatically; otherwise, the codec
  2619. * must call ff_thread_finish_setup().
  2620. *
  2621. * dst and src will (rarely) point to the same context, in which case memcpy should be skipped.
  2622. */
  2623. int (*update_thread_context)(AVCodecContext *dst, const AVCodecContext *src);
  2624. /** @} */
  2625. /**
  2626. * Private codec-specific defaults.
  2627. */
  2628. const AVCodecDefault *defaults;
  2629. /**
  2630. * Initialize codec static data, called from avcodec_register().
  2631. */
  2632. void (*init_static_data)(struct AVCodec *codec);
  2633. /**
  2634. * Encode data to an AVPacket.
  2635. *
  2636. * @param avctx codec context
  2637. * @param avpkt output AVPacket (may contain a user-provided buffer)
  2638. * @param[in] frame AVFrame containing the raw data to be encoded
  2639. * @param[out] got_packet_ptr encoder sets to 0 or 1 to indicate that a
  2640. * non-empty packet was returned in avpkt.
  2641. * @return 0 on success, negative error code on failure
  2642. */
  2643. int (*encode2)(AVCodecContext *avctx, AVPacket *avpkt, const AVFrame *frame,
  2644. int *got_packet_ptr);
  2645. } AVCodec;
  2646. /**
  2647. * AVHWAccel.
  2648. */
  2649. typedef struct AVHWAccel {
  2650. /**
  2651. * Name of the hardware accelerated codec.
  2652. * The name is globally unique among encoders and among decoders (but an
  2653. * encoder and a decoder can share the same name).
  2654. */
  2655. const char *name;
  2656. /**
  2657. * Type of codec implemented by the hardware accelerator.
  2658. *
  2659. * See AVMEDIA_TYPE_xxx
  2660. */
  2661. enum AVMediaType type;
  2662. /**
  2663. * Codec implemented by the hardware accelerator.
  2664. *
  2665. * See CODEC_ID_xxx
  2666. */
  2667. enum CodecID id;
  2668. /**
  2669. * Supported pixel format.
  2670. *
  2671. * Only hardware accelerated formats are supported here.
  2672. */
  2673. enum PixelFormat pix_fmt;
  2674. /**
  2675. * Hardware accelerated codec capabilities.
  2676. * see FF_HWACCEL_CODEC_CAP_*
  2677. */
  2678. int capabilities;
  2679. struct AVHWAccel *next;
  2680. /**
  2681. * Called at the beginning of each frame or field picture.
  2682. *
  2683. * Meaningful frame information (codec specific) is guaranteed to
  2684. * be parsed at this point. This function is mandatory.
  2685. *
  2686. * Note that buf can be NULL along with buf_size set to 0.
  2687. * Otherwise, this means the whole frame is available at this point.
  2688. *
  2689. * @param avctx the codec context
  2690. * @param buf the frame data buffer base
  2691. * @param buf_size the size of the frame in bytes
  2692. * @return zero if successful, a negative value otherwise
  2693. */
  2694. int (*start_frame)(AVCodecContext *avctx, const uint8_t *buf, uint32_t buf_size);
  2695. /**
  2696. * Callback for each slice.
  2697. *
  2698. * Meaningful slice information (codec specific) is guaranteed to
  2699. * be parsed at this point. This function is mandatory.
  2700. *
  2701. * @param avctx the codec context
  2702. * @param buf the slice data buffer base
  2703. * @param buf_size the size of the slice in bytes
  2704. * @return zero if successful, a negative value otherwise
  2705. */
  2706. int (*decode_slice)(AVCodecContext *avctx, const uint8_t *buf, uint32_t buf_size);
  2707. /**
  2708. * Called at the end of each frame or field picture.
  2709. *
  2710. * The whole picture is parsed at this point and can now be sent
  2711. * to the hardware accelerator. This function is mandatory.
  2712. *
  2713. * @param avctx the codec context
  2714. * @return zero if successful, a negative value otherwise
  2715. */
  2716. int (*end_frame)(AVCodecContext *avctx);
  2717. /**
  2718. * Size of HW accelerator private data.
  2719. *
  2720. * Private data is allocated with av_mallocz() before
  2721. * AVCodecContext.get_buffer() and deallocated after
  2722. * AVCodecContext.release_buffer().
  2723. */
  2724. int priv_data_size;
  2725. } AVHWAccel;
  2726. /**
  2727. * four components are given, that's all.
  2728. * the last component is alpha
  2729. */
  2730. typedef struct AVPicture {
  2731. uint8_t *data[AV_NUM_DATA_POINTERS];
  2732. int linesize[AV_NUM_DATA_POINTERS]; ///< number of bytes per line
  2733. } AVPicture;
  2734. #define AVPALETTE_SIZE 1024
  2735. #define AVPALETTE_COUNT 256
  2736. enum AVSubtitleType {
  2737. SUBTITLE_NONE,
  2738. SUBTITLE_BITMAP, ///< A bitmap, pict will be set
  2739. /**
  2740. * Plain text, the text field must be set by the decoder and is
  2741. * authoritative. ass and pict fields may contain approximations.
  2742. */
  2743. SUBTITLE_TEXT,
  2744. /**
  2745. * Formatted text, the ass field must be set by the decoder and is
  2746. * authoritative. pict and text fields may contain approximations.
  2747. */
  2748. SUBTITLE_ASS,
  2749. };
  2750. typedef struct AVSubtitleRect {
  2751. int x; ///< top left corner of pict, undefined when pict is not set
  2752. int y; ///< top left corner of pict, undefined when pict is not set
  2753. int w; ///< width of pict, undefined when pict is not set
  2754. int h; ///< height of pict, undefined when pict is not set
  2755. int nb_colors; ///< number of colors in pict, undefined when pict is not set
  2756. /**
  2757. * data+linesize for the bitmap of this subtitle.
  2758. * can be set for text/ass as well once they where rendered
  2759. */
  2760. AVPicture pict;
  2761. enum AVSubtitleType type;
  2762. char *text; ///< 0 terminated plain UTF-8 text
  2763. /**
  2764. * 0 terminated ASS/SSA compatible event line.
  2765. * The pressentation of this is unaffected by the other values in this
  2766. * struct.
  2767. */
  2768. char *ass;
  2769. } AVSubtitleRect;
  2770. typedef struct AVSubtitle {
  2771. uint16_t format; /* 0 = graphics */
  2772. uint32_t start_display_time; /* relative to packet pts, in ms */
  2773. uint32_t end_display_time; /* relative to packet pts, in ms */
  2774. unsigned num_rects;
  2775. AVSubtitleRect **rects;
  2776. int64_t pts; ///< Same as packet pts, in AV_TIME_BASE
  2777. } AVSubtitle;
  2778. /* packet functions */
  2779. /**
  2780. * @deprecated use NULL instead
  2781. */
  2782. attribute_deprecated void av_destruct_packet_nofree(AVPacket *pkt);
  2783. /**
  2784. * Default packet destructor.
  2785. */
  2786. void av_destruct_packet(AVPacket *pkt);
  2787. /**
  2788. * Initialize optional fields of a packet with default values.
  2789. *
  2790. * @param pkt packet
  2791. */
  2792. void av_init_packet(AVPacket *pkt);
  2793. /**
  2794. * Allocate the payload of a packet and initialize its fields with
  2795. * default values.
  2796. *
  2797. * @param pkt packet
  2798. * @param size wanted payload size
  2799. * @return 0 if OK, AVERROR_xxx otherwise
  2800. */
  2801. int av_new_packet(AVPacket *pkt, int size);
  2802. /**
  2803. * Reduce packet size, correctly zeroing padding
  2804. *
  2805. * @param pkt packet
  2806. * @param size new size
  2807. */
  2808. void av_shrink_packet(AVPacket *pkt, int size);
  2809. /**
  2810. * Increase packet size, correctly zeroing padding
  2811. *
  2812. * @param pkt packet
  2813. * @param grow_by number of bytes by which to increase the size of the packet
  2814. */
  2815. int av_grow_packet(AVPacket *pkt, int grow_by);
  2816. /**
  2817. * @warning This is a hack - the packet memory allocation stuff is broken. The
  2818. * packet is allocated if it was not really allocated.
  2819. */
  2820. int av_dup_packet(AVPacket *pkt);
  2821. /**
  2822. * Free a packet.
  2823. *
  2824. * @param pkt packet to free
  2825. */
  2826. void av_free_packet(AVPacket *pkt);
  2827. /**
  2828. * Allocate new information of a packet.
  2829. *
  2830. * @param pkt packet
  2831. * @param type side information type
  2832. * @param size side information size
  2833. * @return pointer to fresh allocated data or NULL otherwise
  2834. */
  2835. uint8_t* av_packet_new_side_data(AVPacket *pkt, enum AVPacketSideDataType type,
  2836. int size);
  2837. /**
  2838. * Get side information from packet.
  2839. *
  2840. * @param pkt packet
  2841. * @param type desired side information type
  2842. * @param size pointer for side information size to store (optional)
  2843. * @return pointer to data if present or NULL otherwise
  2844. */
  2845. uint8_t* av_packet_get_side_data(AVPacket *pkt, enum AVPacketSideDataType type,
  2846. int *size);
  2847. /* resample.c */
  2848. struct ReSampleContext;
  2849. struct AVResampleContext;
  2850. typedef struct ReSampleContext ReSampleContext;
  2851. /**
  2852. * Initialize audio resampling context.
  2853. *
  2854. * @param output_channels number of output channels
  2855. * @param input_channels number of input channels
  2856. * @param output_rate output sample rate
  2857. * @param input_rate input sample rate
  2858. * @param sample_fmt_out requested output sample format
  2859. * @param sample_fmt_in input sample format
  2860. * @param filter_length length of each FIR filter in the filterbank relative to the cutoff frequency
  2861. * @param log2_phase_count log2 of the number of entries in the polyphase filterbank
  2862. * @param linear if 1 then the used FIR filter will be linearly interpolated
  2863. between the 2 closest, if 0 the closest will be used
  2864. * @param cutoff cutoff frequency, 1.0 corresponds to half the output sampling rate
  2865. * @return allocated ReSampleContext, NULL if error occurred
  2866. */
  2867. ReSampleContext *av_audio_resample_init(int output_channels, int input_channels,
  2868. int output_rate, int input_rate,
  2869. enum AVSampleFormat sample_fmt_out,
  2870. enum AVSampleFormat sample_fmt_in,
  2871. int filter_length, int log2_phase_count,
  2872. int linear, double cutoff);
  2873. int audio_resample(ReSampleContext *s, short *output, short *input, int nb_samples);
  2874. /**
  2875. * Free resample context.
  2876. *
  2877. * @param s a non-NULL pointer to a resample context previously
  2878. * created with av_audio_resample_init()
  2879. */
  2880. void audio_resample_close(ReSampleContext *s);
  2881. /**
  2882. * Initialize an audio resampler.
  2883. * Note, if either rate is not an integer then simply scale both rates up so they are.
  2884. * @param filter_length length of each FIR filter in the filterbank relative to the cutoff freq
  2885. * @param log2_phase_count log2 of the number of entries in the polyphase filterbank
  2886. * @param linear If 1 then the used FIR filter will be linearly interpolated
  2887. between the 2 closest, if 0 the closest will be used
  2888. * @param cutoff cutoff frequency, 1.0 corresponds to half the output sampling rate
  2889. */
  2890. struct AVResampleContext *av_resample_init(int out_rate, int in_rate, int filter_length, int log2_phase_count, int linear, double cutoff);
  2891. /**
  2892. * Resample an array of samples using a previously configured context.
  2893. * @param src an array of unconsumed samples
  2894. * @param consumed the number of samples of src which have been consumed are returned here
  2895. * @param src_size the number of unconsumed samples available
  2896. * @param dst_size the amount of space in samples available in dst
  2897. * @param update_ctx If this is 0 then the context will not be modified, that way several channels can be resampled with the same context.
  2898. * @return the number of samples written in dst or -1 if an error occurred
  2899. */
  2900. int av_resample(struct AVResampleContext *c, short *dst, short *src, int *consumed, int src_size, int dst_size, int update_ctx);
  2901. /**
  2902. * Compensate samplerate/timestamp drift. The compensation is done by changing
  2903. * the resampler parameters, so no audible clicks or similar distortions occur
  2904. * @param compensation_distance distance in output samples over which the compensation should be performed
  2905. * @param sample_delta number of output samples which should be output less
  2906. *
  2907. * example: av_resample_compensate(c, 10, 500)
  2908. * here instead of 510 samples only 500 samples would be output
  2909. *
  2910. * note, due to rounding the actual compensation might be slightly different,
  2911. * especially if the compensation_distance is large and the in_rate used during init is small
  2912. */
  2913. void av_resample_compensate(struct AVResampleContext *c, int sample_delta, int compensation_distance);
  2914. void av_resample_close(struct AVResampleContext *c);
  2915. /**
  2916. * Allocate memory for a picture. Call avpicture_free() to free it.
  2917. *
  2918. * @see avpicture_fill()
  2919. *
  2920. * @param picture the picture to be filled in
  2921. * @param pix_fmt the format of the picture
  2922. * @param width the width of the picture
  2923. * @param height the height of the picture
  2924. * @return zero if successful, a negative value if not
  2925. */
  2926. int avpicture_alloc(AVPicture *picture, enum PixelFormat pix_fmt, int width, int height);
  2927. /**
  2928. * Free a picture previously allocated by avpicture_alloc().
  2929. * The data buffer used by the AVPicture is freed, but the AVPicture structure
  2930. * itself is not.
  2931. *
  2932. * @param picture the AVPicture to be freed
  2933. */
  2934. void avpicture_free(AVPicture *picture);
  2935. /**
  2936. * Fill in the AVPicture fields.
  2937. * The fields of the given AVPicture are filled in by using the 'ptr' address
  2938. * which points to the image data buffer. Depending on the specified picture
  2939. * format, one or multiple image data pointers and line sizes will be set.
  2940. * If a planar format is specified, several pointers will be set pointing to
  2941. * the different picture planes and the line sizes of the different planes
  2942. * will be stored in the lines_sizes array.
  2943. * Call with ptr == NULL to get the required size for the ptr buffer.
  2944. *
  2945. * To allocate the buffer and fill in the AVPicture fields in one call,
  2946. * use avpicture_alloc().
  2947. *
  2948. * @param picture AVPicture whose fields are to be filled in
  2949. * @param ptr Buffer which will contain or contains the actual image data
  2950. * @param pix_fmt The format in which the picture data is stored.
  2951. * @param width the width of the image in pixels
  2952. * @param height the height of the image in pixels
  2953. * @return size of the image data in bytes
  2954. */
  2955. int avpicture_fill(AVPicture *picture, uint8_t *ptr,
  2956. enum PixelFormat pix_fmt, int width, int height);
  2957. /**
  2958. * Copy pixel data from an AVPicture into a buffer.
  2959. * The data is stored compactly, without any gaps for alignment or padding
  2960. * which may be applied by avpicture_fill().
  2961. *
  2962. * @see avpicture_get_size()
  2963. *
  2964. * @param[in] src AVPicture containing image data
  2965. * @param[in] pix_fmt The format in which the picture data is stored.
  2966. * @param[in] width the width of the image in pixels.
  2967. * @param[in] height the height of the image in pixels.
  2968. * @param[out] dest A buffer into which picture data will be copied.
  2969. * @param[in] dest_size The size of 'dest'.
  2970. * @return The number of bytes written to dest, or a negative value (error code) on error.
  2971. */
  2972. int avpicture_layout(const AVPicture* src, enum PixelFormat pix_fmt, int width, int height,
  2973. unsigned char *dest, int dest_size);
  2974. /**
  2975. * Calculate the size in bytes that a picture of the given width and height
  2976. * would occupy if stored in the given picture format.
  2977. * Note that this returns the size of a compact representation as generated
  2978. * by avpicture_layout(), which can be smaller than the size required for e.g.
  2979. * avpicture_fill().
  2980. *
  2981. * @param pix_fmt the given picture format
  2982. * @param width the width of the image
  2983. * @param height the height of the image
  2984. * @return Image data size in bytes or -1 on error (e.g. too large dimensions).
  2985. */
  2986. int avpicture_get_size(enum PixelFormat pix_fmt, int width, int height);
  2987. void avcodec_get_chroma_sub_sample(enum PixelFormat pix_fmt, int *h_shift, int *v_shift);
  2988. void avcodec_set_dimensions(AVCodecContext *s, int width, int height);
  2989. /**
  2990. * Return a value representing the fourCC code associated to the
  2991. * pixel format pix_fmt, or 0 if no associated fourCC code can be
  2992. * found.
  2993. */
  2994. unsigned int avcodec_pix_fmt_to_codec_tag(enum PixelFormat pix_fmt);
  2995. /**
  2996. * Put a string representing the codec tag codec_tag in buf.
  2997. *
  2998. * @param buf_size size in bytes of buf
  2999. * @return the length of the string that would have been generated if
  3000. * enough space had been available, excluding the trailing null
  3001. */
  3002. size_t av_get_codec_tag_string(char *buf, size_t buf_size, unsigned int codec_tag);
  3003. #define FF_LOSS_RESOLUTION 0x0001 /**< loss due to resolution change */
  3004. #define FF_LOSS_DEPTH 0x0002 /**< loss due to color depth change */
  3005. #define FF_LOSS_COLORSPACE 0x0004 /**< loss due to color space conversion */
  3006. #define FF_LOSS_ALPHA 0x0008 /**< loss of alpha bits */
  3007. #define FF_LOSS_COLORQUANT 0x0010 /**< loss due to color quantization */
  3008. #define FF_LOSS_CHROMA 0x0020 /**< loss of chroma (e.g. RGB to gray conversion) */
  3009. /**
  3010. * Compute what kind of losses will occur when converting from one specific
  3011. * pixel format to another.
  3012. * When converting from one pixel format to another, information loss may occur.
  3013. * For example, when converting from RGB24 to GRAY, the color information will
  3014. * be lost. Similarly, other losses occur when converting from some formats to
  3015. * other formats. These losses can involve loss of chroma, but also loss of
  3016. * resolution, loss of color depth, loss due to the color space conversion, loss
  3017. * of the alpha bits or loss due to color quantization.
  3018. * avcodec_get_fix_fmt_loss() informs you about the various types of losses
  3019. * which will occur when converting from one pixel format to another.
  3020. *
  3021. * @param[in] dst_pix_fmt destination pixel format
  3022. * @param[in] src_pix_fmt source pixel format
  3023. * @param[in] has_alpha Whether the source pixel format alpha channel is used.
  3024. * @return Combination of flags informing you what kind of losses will occur.
  3025. */
  3026. int avcodec_get_pix_fmt_loss(enum PixelFormat dst_pix_fmt, enum PixelFormat src_pix_fmt,
  3027. int has_alpha);
  3028. /**
  3029. * Find the best pixel format to convert to given a certain source pixel
  3030. * format. When converting from one pixel format to another, information loss
  3031. * may occur. For example, when converting from RGB24 to GRAY, the color
  3032. * information will be lost. Similarly, other losses occur when converting from
  3033. * some formats to other formats. avcodec_find_best_pix_fmt() searches which of
  3034. * the given pixel formats should be used to suffer the least amount of loss.
  3035. * The pixel formats from which it chooses one, are determined by the
  3036. * pix_fmt_mask parameter.
  3037. *
  3038. * @code
  3039. * src_pix_fmt = PIX_FMT_YUV420P;
  3040. * pix_fmt_mask = (1 << PIX_FMT_YUV422P) || (1 << PIX_FMT_RGB24);
  3041. * dst_pix_fmt = avcodec_find_best_pix_fmt(pix_fmt_mask, src_pix_fmt, alpha, &loss);
  3042. * @endcode
  3043. *
  3044. * @param[in] pix_fmt_mask bitmask determining which pixel format to choose from
  3045. * @param[in] src_pix_fmt source pixel format
  3046. * @param[in] has_alpha Whether the source pixel format alpha channel is used.
  3047. * @param[out] loss_ptr Combination of flags informing you what kind of losses will occur.
  3048. * @return The best pixel format to convert to or -1 if none was found.
  3049. */
  3050. enum PixelFormat avcodec_find_best_pix_fmt(int64_t pix_fmt_mask, enum PixelFormat src_pix_fmt,
  3051. int has_alpha, int *loss_ptr);
  3052. #if FF_API_GET_ALPHA_INFO
  3053. #define FF_ALPHA_TRANSP 0x0001 /* image has some totally transparent pixels */
  3054. #define FF_ALPHA_SEMI_TRANSP 0x0002 /* image has some transparent pixels */
  3055. /**
  3056. * Tell if an image really has transparent alpha values.
  3057. * @return ored mask of FF_ALPHA_xxx constants
  3058. */
  3059. attribute_deprecated
  3060. int img_get_alpha_info(const AVPicture *src,
  3061. enum PixelFormat pix_fmt, int width, int height);
  3062. #endif
  3063. /* deinterlace a picture */
  3064. /* deinterlace - if not supported return -1 */
  3065. int avpicture_deinterlace(AVPicture *dst, const AVPicture *src,
  3066. enum PixelFormat pix_fmt, int width, int height);
  3067. /* external high level API */
  3068. /**
  3069. * If c is NULL, returns the first registered codec,
  3070. * if c is non-NULL, returns the next registered codec after c,
  3071. * or NULL if c is the last one.
  3072. */
  3073. AVCodec *av_codec_next(AVCodec *c);
  3074. /**
  3075. * Return the LIBAVCODEC_VERSION_INT constant.
  3076. */
  3077. unsigned avcodec_version(void);
  3078. /**
  3079. * Return the libavcodec build-time configuration.
  3080. */
  3081. const char *avcodec_configuration(void);
  3082. /**
  3083. * Return the libavcodec license.
  3084. */
  3085. const char *avcodec_license(void);
  3086. /**
  3087. * Register the codec codec and initialize libavcodec.
  3088. *
  3089. * @warning either this function or avcodec_register_all() must be called
  3090. * before any other libavcodec functions.
  3091. *
  3092. * @see avcodec_register_all()
  3093. */
  3094. void avcodec_register(AVCodec *codec);
  3095. /**
  3096. * Find a registered encoder with a matching codec ID.
  3097. *
  3098. * @param id CodecID of the requested encoder
  3099. * @return An encoder if one was found, NULL otherwise.
  3100. */
  3101. AVCodec *avcodec_find_encoder(enum CodecID id);
  3102. /**
  3103. * Find a registered encoder with the specified name.
  3104. *
  3105. * @param name name of the requested encoder
  3106. * @return An encoder if one was found, NULL otherwise.
  3107. */
  3108. AVCodec *avcodec_find_encoder_by_name(const char *name);
  3109. /**
  3110. * Find a registered decoder with a matching codec ID.
  3111. *
  3112. * @param id CodecID of the requested decoder
  3113. * @return A decoder if one was found, NULL otherwise.
  3114. */
  3115. AVCodec *avcodec_find_decoder(enum CodecID id);
  3116. /**
  3117. * Find a registered decoder with the specified name.
  3118. *
  3119. * @param name name of the requested decoder
  3120. * @return A decoder if one was found, NULL otherwise.
  3121. */
  3122. AVCodec *avcodec_find_decoder_by_name(const char *name);
  3123. void avcodec_string(char *buf, int buf_size, AVCodecContext *enc, int encode);
  3124. /**
  3125. * Return a name for the specified profile, if available.
  3126. *
  3127. * @param codec the codec that is searched for the given profile
  3128. * @param profile the profile value for which a name is requested
  3129. * @return A name for the profile if found, NULL otherwise.
  3130. */
  3131. const char *av_get_profile_name(const AVCodec *codec, int profile);
  3132. /**
  3133. * Set the fields of the given AVCodecContext to default values corresponding
  3134. * to the given codec (defaults may be codec-dependent).
  3135. *
  3136. * Do not call this function if a non-NULL codec has been passed
  3137. * to avcodec_alloc_context3() that allocated this AVCodecContext.
  3138. * If codec is non-NULL, it is illegal to call avcodec_open2() with a
  3139. * different codec on this AVCodecContext.
  3140. */
  3141. int avcodec_get_context_defaults3(AVCodecContext *s, AVCodec *codec);
  3142. /**
  3143. * Allocate an AVCodecContext and set its fields to default values. The
  3144. * resulting struct can be deallocated by simply calling av_free().
  3145. *
  3146. * @param codec if non-NULL, allocate private data and initialize defaults
  3147. * for the given codec. It is illegal to then call avcodec_open2()
  3148. * with a different codec.
  3149. *
  3150. * @return An AVCodecContext filled with default values or NULL on failure.
  3151. * @see avcodec_get_context_defaults
  3152. */
  3153. AVCodecContext *avcodec_alloc_context3(AVCodec *codec);
  3154. /**
  3155. * Copy the settings of the source AVCodecContext into the destination
  3156. * AVCodecContext. The resulting destination codec context will be
  3157. * unopened, i.e. you are required to call avcodec_open2() before you
  3158. * can use this AVCodecContext to decode/encode video/audio data.
  3159. *
  3160. * @param dest target codec context, should be initialized with
  3161. * avcodec_alloc_context3(), but otherwise uninitialized
  3162. * @param src source codec context
  3163. * @return AVERROR() on error (e.g. memory allocation error), 0 on success
  3164. */
  3165. int avcodec_copy_context(AVCodecContext *dest, const AVCodecContext *src);
  3166. /**
  3167. * Set the fields of the given AVFrame to default values.
  3168. *
  3169. * @param pic The AVFrame of which the fields should be set to default values.
  3170. */
  3171. void avcodec_get_frame_defaults(AVFrame *pic);
  3172. /**
  3173. * Allocate an AVFrame and set its fields to default values. The resulting
  3174. * struct can be deallocated by simply calling av_free().
  3175. *
  3176. * @return An AVFrame filled with default values or NULL on failure.
  3177. * @see avcodec_get_frame_defaults
  3178. */
  3179. AVFrame *avcodec_alloc_frame(void);
  3180. int avcodec_default_get_buffer(AVCodecContext *s, AVFrame *pic);
  3181. void avcodec_default_release_buffer(AVCodecContext *s, AVFrame *pic);
  3182. int avcodec_default_reget_buffer(AVCodecContext *s, AVFrame *pic);
  3183. /**
  3184. * Return the amount of padding in pixels which the get_buffer callback must
  3185. * provide around the edge of the image for codecs which do not have the
  3186. * CODEC_FLAG_EMU_EDGE flag.
  3187. *
  3188. * @return Required padding in pixels.
  3189. */
  3190. unsigned avcodec_get_edge_width(void);
  3191. /**
  3192. * Modify width and height values so that they will result in a memory
  3193. * buffer that is acceptable for the codec if you do not use any horizontal
  3194. * padding.
  3195. *
  3196. * May only be used if a codec with CODEC_CAP_DR1 has been opened.
  3197. * If CODEC_FLAG_EMU_EDGE is not set, the dimensions must have been increased
  3198. * according to avcodec_get_edge_width() before.
  3199. */
  3200. void avcodec_align_dimensions(AVCodecContext *s, int *width, int *height);
  3201. /**
  3202. * Modify width and height values so that they will result in a memory
  3203. * buffer that is acceptable for the codec if you also ensure that all
  3204. * line sizes are a multiple of the respective linesize_align[i].
  3205. *
  3206. * May only be used if a codec with CODEC_CAP_DR1 has been opened.
  3207. * If CODEC_FLAG_EMU_EDGE is not set, the dimensions must have been increased
  3208. * according to avcodec_get_edge_width() before.
  3209. */
  3210. void avcodec_align_dimensions2(AVCodecContext *s, int *width, int *height,
  3211. int linesize_align[AV_NUM_DATA_POINTERS]);
  3212. enum PixelFormat avcodec_default_get_format(struct AVCodecContext *s, const enum PixelFormat * fmt);
  3213. int avcodec_default_execute(AVCodecContext *c, int (*func)(AVCodecContext *c2, void *arg2),void *arg, int *ret, int count, int size);
  3214. int avcodec_default_execute2(AVCodecContext *c, int (*func)(AVCodecContext *c2, void *arg2, int, int),void *arg, int *ret, int count);
  3215. //FIXME func typedef
  3216. /**
  3217. * Initialize the AVCodecContext to use the given AVCodec. Prior to using this
  3218. * function the context has to be allocated with avcodec_alloc_context3().
  3219. *
  3220. * The functions avcodec_find_decoder_by_name(), avcodec_find_encoder_by_name(),
  3221. * avcodec_find_decoder() and avcodec_find_encoder() provide an easy way for
  3222. * retrieving a codec.
  3223. *
  3224. * @warning This function is not thread safe!
  3225. *
  3226. * @code
  3227. * avcodec_register_all();
  3228. * av_dict_set(&opts, "b", "2.5M", 0);
  3229. * codec = avcodec_find_decoder(CODEC_ID_H264);
  3230. * if (!codec)
  3231. * exit(1);
  3232. *
  3233. * context = avcodec_alloc_context3(codec);
  3234. *
  3235. * if (avcodec_open2(context, codec, opts) < 0)
  3236. * exit(1);
  3237. * @endcode
  3238. *
  3239. * @param avctx The context to initialize.
  3240. * @param options A dictionary filled with AVCodecContext and codec-private options.
  3241. * On return this object will be filled with options that were not found.
  3242. *
  3243. * @return zero on success, a negative value on error
  3244. * @see avcodec_alloc_context3(), avcodec_find_decoder(), avcodec_find_encoder(),
  3245. * av_dict_set(), av_opt_find().
  3246. */
  3247. int avcodec_open2(AVCodecContext *avctx, AVCodec *codec, AVDictionary **options);
  3248. #if FF_API_OLD_DECODE_AUDIO
  3249. /**
  3250. * Wrapper function which calls avcodec_decode_audio4.
  3251. *
  3252. * @deprecated Use avcodec_decode_audio4 instead.
  3253. *
  3254. * Decode the audio frame of size avpkt->size from avpkt->data into samples.
  3255. * Some decoders may support multiple frames in a single AVPacket, such
  3256. * decoders would then just decode the first frame. In this case,
  3257. * avcodec_decode_audio3 has to be called again with an AVPacket that contains
  3258. * the remaining data in order to decode the second frame etc.
  3259. * If no frame
  3260. * could be outputted, frame_size_ptr is zero. Otherwise, it is the
  3261. * decompressed frame size in bytes.
  3262. *
  3263. * @warning You must set frame_size_ptr to the allocated size of the
  3264. * output buffer before calling avcodec_decode_audio3().
  3265. *
  3266. * @warning The input buffer must be FF_INPUT_BUFFER_PADDING_SIZE larger than
  3267. * the actual read bytes because some optimized bitstream readers read 32 or 64
  3268. * bits at once and could read over the end.
  3269. *
  3270. * @warning The end of the input buffer avpkt->data should be set to 0 to ensure that
  3271. * no overreading happens for damaged MPEG streams.
  3272. *
  3273. * @warning You must not provide a custom get_buffer() when using
  3274. * avcodec_decode_audio3(). Doing so will override it with
  3275. * avcodec_default_get_buffer. Use avcodec_decode_audio4() instead,
  3276. * which does allow the application to provide a custom get_buffer().
  3277. *
  3278. * @note You might have to align the input buffer avpkt->data and output buffer
  3279. * samples. The alignment requirements depend on the CPU: On some CPUs it isn't
  3280. * necessary at all, on others it won't work at all if not aligned and on others
  3281. * it will work but it will have an impact on performance.
  3282. *
  3283. * In practice, avpkt->data should have 4 byte alignment at minimum and
  3284. * samples should be 16 byte aligned unless the CPU doesn't need it
  3285. * (AltiVec and SSE do).
  3286. *
  3287. * @note Codecs which have the CODEC_CAP_DELAY capability set have a delay
  3288. * between input and output, these need to be fed with avpkt->data=NULL,
  3289. * avpkt->size=0 at the end to return the remaining frames.
  3290. *
  3291. * @param avctx the codec context
  3292. * @param[out] samples the output buffer, sample type in avctx->sample_fmt
  3293. * If the sample format is planar, each channel plane will
  3294. * be the same size, with no padding between channels.
  3295. * @param[in,out] frame_size_ptr the output buffer size in bytes
  3296. * @param[in] avpkt The input AVPacket containing the input buffer.
  3297. * You can create such packet with av_init_packet() and by then setting
  3298. * data and size, some decoders might in addition need other fields.
  3299. * All decoders are designed to use the least fields possible though.
  3300. * @return On error a negative value is returned, otherwise the number of bytes
  3301. * used or zero if no frame data was decompressed (used) from the input AVPacket.
  3302. */
  3303. attribute_deprecated int avcodec_decode_audio3(AVCodecContext *avctx, int16_t *samples,
  3304. int *frame_size_ptr,
  3305. AVPacket *avpkt);
  3306. #endif
  3307. /**
  3308. * Decode the audio frame of size avpkt->size from avpkt->data into frame.
  3309. *
  3310. * Some decoders may support multiple frames in a single AVPacket. Such
  3311. * decoders would then just decode the first frame. In this case,
  3312. * avcodec_decode_audio4 has to be called again with an AVPacket containing
  3313. * the remaining data in order to decode the second frame, etc...
  3314. * Even if no frames are returned, the packet needs to be fed to the decoder
  3315. * with remaining data until it is completely consumed or an error occurs.
  3316. *
  3317. * @warning The input buffer, avpkt->data must be FF_INPUT_BUFFER_PADDING_SIZE
  3318. * larger than the actual read bytes because some optimized bitstream
  3319. * readers read 32 or 64 bits at once and could read over the end.
  3320. *
  3321. * @note You might have to align the input buffer. The alignment requirements
  3322. * depend on the CPU and the decoder.
  3323. *
  3324. * @param avctx the codec context
  3325. * @param[out] frame The AVFrame in which to store decoded audio samples.
  3326. * Decoders request a buffer of a particular size by setting
  3327. * AVFrame.nb_samples prior to calling get_buffer(). The
  3328. * decoder may, however, only utilize part of the buffer by
  3329. * setting AVFrame.nb_samples to a smaller value in the
  3330. * output frame.
  3331. * @param[out] got_frame_ptr Zero if no frame could be decoded, otherwise it is
  3332. * non-zero.
  3333. * @param[in] avpkt The input AVPacket containing the input buffer.
  3334. * At least avpkt->data and avpkt->size should be set. Some
  3335. * decoders might also require additional fields to be set.
  3336. * @return A negative error code is returned if an error occurred during
  3337. * decoding, otherwise the number of bytes consumed from the input
  3338. * AVPacket is returned.
  3339. */
  3340. int avcodec_decode_audio4(AVCodecContext *avctx, AVFrame *frame,
  3341. int *got_frame_ptr, AVPacket *avpkt);
  3342. /**
  3343. * Decode the video frame of size avpkt->size from avpkt->data into picture.
  3344. * Some decoders may support multiple frames in a single AVPacket, such
  3345. * decoders would then just decode the first frame.
  3346. *
  3347. * @warning The input buffer must be FF_INPUT_BUFFER_PADDING_SIZE larger than
  3348. * the actual read bytes because some optimized bitstream readers read 32 or 64
  3349. * bits at once and could read over the end.
  3350. *
  3351. * @warning The end of the input buffer buf should be set to 0 to ensure that
  3352. * no overreading happens for damaged MPEG streams.
  3353. *
  3354. * @note You might have to align the input buffer avpkt->data.
  3355. * The alignment requirements depend on the CPU: on some CPUs it isn't
  3356. * necessary at all, on others it won't work at all if not aligned and on others
  3357. * it will work but it will have an impact on performance.
  3358. *
  3359. * In practice, avpkt->data should have 4 byte alignment at minimum.
  3360. *
  3361. * @note Codecs which have the CODEC_CAP_DELAY capability set have a delay
  3362. * between input and output, these need to be fed with avpkt->data=NULL,
  3363. * avpkt->size=0 at the end to return the remaining frames.
  3364. *
  3365. * @param avctx the codec context
  3366. * @param[out] picture The AVFrame in which the decoded video frame will be stored.
  3367. * Use avcodec_alloc_frame to get an AVFrame, the codec will
  3368. * allocate memory for the actual bitmap.
  3369. * with default get/release_buffer(), the decoder frees/reuses the bitmap as it sees fit.
  3370. * with overridden get/release_buffer() (needs CODEC_CAP_DR1) the user decides into what buffer the decoder
  3371. * decodes and the decoder tells the user once it does not need the data anymore,
  3372. * the user app can at this point free/reuse/keep the memory as it sees fit.
  3373. *
  3374. * @param[in] avpkt The input AVpacket containing the input buffer.
  3375. * You can create such packet with av_init_packet() and by then setting
  3376. * data and size, some decoders might in addition need other fields like
  3377. * flags&AV_PKT_FLAG_KEY. All decoders are designed to use the least
  3378. * fields possible.
  3379. * @param[in,out] got_picture_ptr Zero if no frame could be decompressed, otherwise, it is nonzero.
  3380. * @return On error a negative value is returned, otherwise the number of bytes
  3381. * used or zero if no frame could be decompressed.
  3382. */
  3383. int avcodec_decode_video2(AVCodecContext *avctx, AVFrame *picture,
  3384. int *got_picture_ptr,
  3385. AVPacket *avpkt);
  3386. /**
  3387. * Decode a subtitle message.
  3388. * Return a negative value on error, otherwise return the number of bytes used.
  3389. * If no subtitle could be decompressed, got_sub_ptr is zero.
  3390. * Otherwise, the subtitle is stored in *sub.
  3391. * Note that CODEC_CAP_DR1 is not available for subtitle codecs. This is for
  3392. * simplicity, because the performance difference is expect to be negligible
  3393. * and reusing a get_buffer written for video codecs would probably perform badly
  3394. * due to a potentially very different allocation pattern.
  3395. *
  3396. * @param avctx the codec context
  3397. * @param[out] sub The AVSubtitle in which the decoded subtitle will be stored, must be
  3398. freed with avsubtitle_free if *got_sub_ptr is set.
  3399. * @param[in,out] got_sub_ptr Zero if no subtitle could be decompressed, otherwise, it is nonzero.
  3400. * @param[in] avpkt The input AVPacket containing the input buffer.
  3401. */
  3402. int avcodec_decode_subtitle2(AVCodecContext *avctx, AVSubtitle *sub,
  3403. int *got_sub_ptr,
  3404. AVPacket *avpkt);
  3405. /**
  3406. * Free all allocated data in the given subtitle struct.
  3407. *
  3408. * @param sub AVSubtitle to free.
  3409. */
  3410. void avsubtitle_free(AVSubtitle *sub);
  3411. #if FF_API_OLD_ENCODE_AUDIO
  3412. /**
  3413. * Encode an audio frame from samples into buf.
  3414. *
  3415. * @deprecated Use avcodec_encode_audio2 instead.
  3416. *
  3417. * @note The output buffer should be at least FF_MIN_BUFFER_SIZE bytes large.
  3418. * However, for codecs with avctx->frame_size equal to 0 (e.g. PCM) the user
  3419. * will know how much space is needed because it depends on the value passed
  3420. * in buf_size as described below. In that case a lower value can be used.
  3421. *
  3422. * @param avctx the codec context
  3423. * @param[out] buf the output buffer
  3424. * @param[in] buf_size the output buffer size
  3425. * @param[in] samples the input buffer containing the samples
  3426. * The number of samples read from this buffer is frame_size*channels,
  3427. * both of which are defined in avctx.
  3428. * For codecs which have avctx->frame_size equal to 0 (e.g. PCM) the number of
  3429. * samples read from samples is equal to:
  3430. * buf_size * 8 / (avctx->channels * av_get_bits_per_sample(avctx->codec_id))
  3431. * This also implies that av_get_bits_per_sample() must not return 0 for these
  3432. * codecs.
  3433. * @return On error a negative value is returned, on success zero or the number
  3434. * of bytes used to encode the data read from the input buffer.
  3435. */
  3436. int attribute_deprecated avcodec_encode_audio(AVCodecContext *avctx,
  3437. uint8_t *buf, int buf_size,
  3438. const short *samples);
  3439. #endif
  3440. /**
  3441. * Encode a frame of audio.
  3442. *
  3443. * Takes input samples from frame and writes the next output packet, if
  3444. * available, to avpkt. The output packet does not necessarily contain data for
  3445. * the most recent frame, as encoders can delay, split, and combine input frames
  3446. * internally as needed.
  3447. *
  3448. * @param avctx codec context
  3449. * @param avpkt output AVPacket.
  3450. * The user can supply an output buffer by setting
  3451. * avpkt->data and avpkt->size prior to calling the
  3452. * function, but if the size of the user-provided data is not
  3453. * large enough, encoding will fail. All other AVPacket fields
  3454. * will be reset by the encoder using av_init_packet(). If
  3455. * avpkt->data is NULL, the encoder will allocate it.
  3456. * The encoder will set avpkt->size to the size of the
  3457. * output packet.
  3458. * @param[in] frame AVFrame containing the raw audio data to be encoded.
  3459. * May be NULL when flushing an encoder that has the
  3460. * CODEC_CAP_DELAY capability set.
  3461. * There are 2 codec capabilities that affect the allowed
  3462. * values of frame->nb_samples.
  3463. * If CODEC_CAP_SMALL_LAST_FRAME is set, then only the final
  3464. * frame may be smaller than avctx->frame_size, and all other
  3465. * frames must be equal to avctx->frame_size.
  3466. * If CODEC_CAP_VARIABLE_FRAME_SIZE is set, then each frame
  3467. * can have any number of samples.
  3468. * If neither is set, frame->nb_samples must be equal to
  3469. * avctx->frame_size for all frames.
  3470. * @param[out] got_packet_ptr This field is set to 1 by libavcodec if the
  3471. * output packet is non-empty, and to 0 if it is
  3472. * empty. If the function returns an error, the
  3473. * packet can be assumed to be invalid, and the
  3474. * value of got_packet_ptr is undefined and should
  3475. * not be used.
  3476. * @return 0 on success, negative error code on failure
  3477. */
  3478. int avcodec_encode_audio2(AVCodecContext *avctx, AVPacket *avpkt,
  3479. const AVFrame *frame, int *got_packet_ptr);
  3480. /**
  3481. * Fill audio frame data and linesize.
  3482. * AVFrame extended_data channel pointers are allocated if necessary for
  3483. * planar audio.
  3484. *
  3485. * @param frame the AVFrame
  3486. * frame->nb_samples must be set prior to calling the
  3487. * function. This function fills in frame->data,
  3488. * frame->extended_data, frame->linesize[0].
  3489. * @param nb_channels channel count
  3490. * @param sample_fmt sample format
  3491. * @param buf buffer to use for frame data
  3492. * @param buf_size size of buffer
  3493. * @param align plane size sample alignment
  3494. * @return 0 on success, negative error code on failure
  3495. */
  3496. int avcodec_fill_audio_frame(AVFrame *frame, int nb_channels,
  3497. enum AVSampleFormat sample_fmt, const uint8_t *buf,
  3498. int buf_size, int align);
  3499. /**
  3500. * Encode a video frame from pict into buf.
  3501. * The input picture should be
  3502. * stored using a specific format, namely avctx.pix_fmt.
  3503. *
  3504. * @param avctx the codec context
  3505. * @param[out] buf the output buffer for the bitstream of encoded frame
  3506. * @param[in] buf_size the size of the output buffer in bytes
  3507. * @param[in] pict the input picture to encode
  3508. * @return On error a negative value is returned, on success zero or the number
  3509. * of bytes used from the output buffer.
  3510. */
  3511. int avcodec_encode_video(AVCodecContext *avctx, uint8_t *buf, int buf_size,
  3512. const AVFrame *pict);
  3513. int avcodec_encode_subtitle(AVCodecContext *avctx, uint8_t *buf, int buf_size,
  3514. const AVSubtitle *sub);
  3515. int avcodec_close(AVCodecContext *avctx);
  3516. /**
  3517. * Register all the codecs, parsers and bitstream filters which were enabled at
  3518. * configuration time. If you do not call this function you can select exactly
  3519. * which formats you want to support, by using the individual registration
  3520. * functions.
  3521. *
  3522. * @see avcodec_register
  3523. * @see av_register_codec_parser
  3524. * @see av_register_bitstream_filter
  3525. */
  3526. void avcodec_register_all(void);
  3527. /**
  3528. * Flush buffers, should be called when seeking or when switching to a different stream.
  3529. */
  3530. void avcodec_flush_buffers(AVCodecContext *avctx);
  3531. void avcodec_default_free_buffers(AVCodecContext *s);
  3532. /* misc useful functions */
  3533. /**
  3534. * Return codec bits per sample.
  3535. *
  3536. * @param[in] codec_id the codec
  3537. * @return Number of bits per sample or zero if unknown for the given codec.
  3538. */
  3539. int av_get_bits_per_sample(enum CodecID codec_id);
  3540. /* frame parsing */
  3541. typedef struct AVCodecParserContext {
  3542. void *priv_data;
  3543. struct AVCodecParser *parser;
  3544. int64_t frame_offset; /* offset of the current frame */
  3545. int64_t cur_offset; /* current offset
  3546. (incremented by each av_parser_parse()) */
  3547. int64_t next_frame_offset; /* offset of the next frame */
  3548. /* video info */
  3549. int pict_type; /* XXX: Put it back in AVCodecContext. */
  3550. /**
  3551. * This field is used for proper frame duration computation in lavf.
  3552. * It signals, how much longer the frame duration of the current frame
  3553. * is compared to normal frame duration.
  3554. *
  3555. * frame_duration = (1 + repeat_pict) * time_base
  3556. *
  3557. * It is used by codecs like H.264 to display telecined material.
  3558. */
  3559. int repeat_pict; /* XXX: Put it back in AVCodecContext. */
  3560. int64_t pts; /* pts of the current frame */
  3561. int64_t dts; /* dts of the current frame */
  3562. /* private data */
  3563. int64_t last_pts;
  3564. int64_t last_dts;
  3565. int fetch_timestamp;
  3566. #define AV_PARSER_PTS_NB 4
  3567. int cur_frame_start_index;
  3568. int64_t cur_frame_offset[AV_PARSER_PTS_NB];
  3569. int64_t cur_frame_pts[AV_PARSER_PTS_NB];
  3570. int64_t cur_frame_dts[AV_PARSER_PTS_NB];
  3571. int flags;
  3572. #define PARSER_FLAG_COMPLETE_FRAMES 0x0001
  3573. #define PARSER_FLAG_ONCE 0x0002
  3574. /// Set if the parser has a valid file offset
  3575. #define PARSER_FLAG_FETCHED_OFFSET 0x0004
  3576. int64_t offset; ///< byte offset from starting packet start
  3577. int64_t cur_frame_end[AV_PARSER_PTS_NB];
  3578. /**
  3579. * Set by parser to 1 for key frames and 0 for non-key frames.
  3580. * It is initialized to -1, so if the parser doesn't set this flag,
  3581. * old-style fallback using AV_PICTURE_TYPE_I picture type as key frames
  3582. * will be used.
  3583. */
  3584. int key_frame;
  3585. /**
  3586. * Time difference in stream time base units from the pts of this
  3587. * packet to the point at which the output from the decoder has converged
  3588. * independent from the availability of previous frames. That is, the
  3589. * frames are virtually identical no matter if decoding started from
  3590. * the very first frame or from this keyframe.
  3591. * Is AV_NOPTS_VALUE if unknown.
  3592. * This field is not the display duration of the current frame.
  3593. * This field has no meaning if the packet does not have AV_PKT_FLAG_KEY
  3594. * set.
  3595. *
  3596. * The purpose of this field is to allow seeking in streams that have no
  3597. * keyframes in the conventional sense. It corresponds to the
  3598. * recovery point SEI in H.264 and match_time_delta in NUT. It is also
  3599. * essential for some types of subtitle streams to ensure that all
  3600. * subtitles are correctly displayed after seeking.
  3601. */
  3602. int64_t convergence_duration;
  3603. // Timestamp generation support:
  3604. /**
  3605. * Synchronization point for start of timestamp generation.
  3606. *
  3607. * Set to >0 for sync point, 0 for no sync point and <0 for undefined
  3608. * (default).
  3609. *
  3610. * For example, this corresponds to presence of H.264 buffering period
  3611. * SEI message.
  3612. */
  3613. int dts_sync_point;
  3614. /**
  3615. * Offset of the current timestamp against last timestamp sync point in
  3616. * units of AVCodecContext.time_base.
  3617. *
  3618. * Set to INT_MIN when dts_sync_point unused. Otherwise, it must
  3619. * contain a valid timestamp offset.
  3620. *
  3621. * Note that the timestamp of sync point has usually a nonzero
  3622. * dts_ref_dts_delta, which refers to the previous sync point. Offset of
  3623. * the next frame after timestamp sync point will be usually 1.
  3624. *
  3625. * For example, this corresponds to H.264 cpb_removal_delay.
  3626. */
  3627. int dts_ref_dts_delta;
  3628. /**
  3629. * Presentation delay of current frame in units of AVCodecContext.time_base.
  3630. *
  3631. * Set to INT_MIN when dts_sync_point unused. Otherwise, it must
  3632. * contain valid non-negative timestamp delta (presentation time of a frame
  3633. * must not lie in the past).
  3634. *
  3635. * This delay represents the difference between decoding and presentation
  3636. * time of the frame.
  3637. *
  3638. * For example, this corresponds to H.264 dpb_output_delay.
  3639. */
  3640. int pts_dts_delta;
  3641. /**
  3642. * Position of the packet in file.
  3643. *
  3644. * Analogous to cur_frame_pts/dts
  3645. */
  3646. int64_t cur_frame_pos[AV_PARSER_PTS_NB];
  3647. /**
  3648. * Byte position of currently parsed frame in stream.
  3649. */
  3650. int64_t pos;
  3651. /**
  3652. * Previous frame byte position.
  3653. */
  3654. int64_t last_pos;
  3655. } AVCodecParserContext;
  3656. typedef struct AVCodecParser {
  3657. int codec_ids[5]; /* several codec IDs are permitted */
  3658. int priv_data_size;
  3659. int (*parser_init)(AVCodecParserContext *s);
  3660. int (*parser_parse)(AVCodecParserContext *s,
  3661. AVCodecContext *avctx,
  3662. const uint8_t **poutbuf, int *poutbuf_size,
  3663. const uint8_t *buf, int buf_size);
  3664. void (*parser_close)(AVCodecParserContext *s);
  3665. int (*split)(AVCodecContext *avctx, const uint8_t *buf, int buf_size);
  3666. struct AVCodecParser *next;
  3667. } AVCodecParser;
  3668. AVCodecParser *av_parser_next(AVCodecParser *c);
  3669. void av_register_codec_parser(AVCodecParser *parser);
  3670. AVCodecParserContext *av_parser_init(int codec_id);
  3671. /**
  3672. * Parse a packet.
  3673. *
  3674. * @param s parser context.
  3675. * @param avctx codec context.
  3676. * @param poutbuf set to pointer to parsed buffer or NULL if not yet finished.
  3677. * @param poutbuf_size set to size of parsed buffer or zero if not yet finished.
  3678. * @param buf input buffer.
  3679. * @param buf_size input length, to signal EOF, this should be 0 (so that the last frame can be output).
  3680. * @param pts input presentation timestamp.
  3681. * @param dts input decoding timestamp.
  3682. * @param pos input byte position in stream.
  3683. * @return the number of bytes of the input bitstream used.
  3684. *
  3685. * Example:
  3686. * @code
  3687. * while(in_len){
  3688. * len = av_parser_parse2(myparser, AVCodecContext, &data, &size,
  3689. * in_data, in_len,
  3690. * pts, dts, pos);
  3691. * in_data += len;
  3692. * in_len -= len;
  3693. *
  3694. * if(size)
  3695. * decode_frame(data, size);
  3696. * }
  3697. * @endcode
  3698. */
  3699. int av_parser_parse2(AVCodecParserContext *s,
  3700. AVCodecContext *avctx,
  3701. uint8_t **poutbuf, int *poutbuf_size,
  3702. const uint8_t *buf, int buf_size,
  3703. int64_t pts, int64_t dts,
  3704. int64_t pos);
  3705. int av_parser_change(AVCodecParserContext *s,
  3706. AVCodecContext *avctx,
  3707. uint8_t **poutbuf, int *poutbuf_size,
  3708. const uint8_t *buf, int buf_size, int keyframe);
  3709. void av_parser_close(AVCodecParserContext *s);
  3710. typedef struct AVBitStreamFilterContext {
  3711. void *priv_data;
  3712. struct AVBitStreamFilter *filter;
  3713. AVCodecParserContext *parser;
  3714. struct AVBitStreamFilterContext *next;
  3715. } AVBitStreamFilterContext;
  3716. typedef struct AVBitStreamFilter {
  3717. const char *name;
  3718. int priv_data_size;
  3719. int (*filter)(AVBitStreamFilterContext *bsfc,
  3720. AVCodecContext *avctx, const char *args,
  3721. uint8_t **poutbuf, int *poutbuf_size,
  3722. const uint8_t *buf, int buf_size, int keyframe);
  3723. void (*close)(AVBitStreamFilterContext *bsfc);
  3724. struct AVBitStreamFilter *next;
  3725. } AVBitStreamFilter;
  3726. void av_register_bitstream_filter(AVBitStreamFilter *bsf);
  3727. AVBitStreamFilterContext *av_bitstream_filter_init(const char *name);
  3728. int av_bitstream_filter_filter(AVBitStreamFilterContext *bsfc,
  3729. AVCodecContext *avctx, const char *args,
  3730. uint8_t **poutbuf, int *poutbuf_size,
  3731. const uint8_t *buf, int buf_size, int keyframe);
  3732. void av_bitstream_filter_close(AVBitStreamFilterContext *bsf);
  3733. AVBitStreamFilter *av_bitstream_filter_next(AVBitStreamFilter *f);
  3734. /* memory */
  3735. /**
  3736. * Reallocate the given block if it is not large enough, otherwise do nothing.
  3737. *
  3738. * @see av_realloc
  3739. */
  3740. void *av_fast_realloc(void *ptr, unsigned int *size, size_t min_size);
  3741. /**
  3742. * Allocate a buffer, reusing the given one if large enough.
  3743. *
  3744. * Contrary to av_fast_realloc the current buffer contents might not be
  3745. * preserved and on error the old buffer is freed, thus no special
  3746. * handling to avoid memleaks is necessary.
  3747. *
  3748. * @param ptr pointer to pointer to already allocated buffer, overwritten with pointer to new buffer
  3749. * @param size size of the buffer *ptr points to
  3750. * @param min_size minimum size of *ptr buffer after returning, *ptr will be NULL and
  3751. * *size 0 if an error occurred.
  3752. */
  3753. void av_fast_malloc(void *ptr, unsigned int *size, size_t min_size);
  3754. /**
  3755. * Copy image src to dst. Wraps av_picture_data_copy() above.
  3756. */
  3757. void av_picture_copy(AVPicture *dst, const AVPicture *src,
  3758. enum PixelFormat pix_fmt, int width, int height);
  3759. /**
  3760. * Crop image top and left side.
  3761. */
  3762. int av_picture_crop(AVPicture *dst, const AVPicture *src,
  3763. enum PixelFormat pix_fmt, int top_band, int left_band);
  3764. /**
  3765. * Pad image.
  3766. */
  3767. int av_picture_pad(AVPicture *dst, const AVPicture *src, int height, int width, enum PixelFormat pix_fmt,
  3768. int padtop, int padbottom, int padleft, int padright, int *color);
  3769. /**
  3770. * Encode extradata length to a buffer. Used by xiph codecs.
  3771. *
  3772. * @param s buffer to write to; must be at least (v/255+1) bytes long
  3773. * @param v size of extradata in bytes
  3774. * @return number of bytes written to the buffer.
  3775. */
  3776. unsigned int av_xiphlacing(unsigned char *s, unsigned int v);
  3777. /**
  3778. * Log a generic warning message about a missing feature. This function is
  3779. * intended to be used internally by Libav (libavcodec, libavformat, etc.)
  3780. * only, and would normally not be used by applications.
  3781. * @param[in] avc a pointer to an arbitrary struct of which the first field is
  3782. * a pointer to an AVClass struct
  3783. * @param[in] feature string containing the name of the missing feature
  3784. * @param[in] want_sample indicates if samples are wanted which exhibit this feature.
  3785. * If want_sample is non-zero, additional verbage will be added to the log
  3786. * message which tells the user how to report samples to the development
  3787. * mailing list.
  3788. */
  3789. void av_log_missing_feature(void *avc, const char *feature, int want_sample);
  3790. /**
  3791. * Log a generic warning message asking for a sample. This function is
  3792. * intended to be used internally by Libav (libavcodec, libavformat, etc.)
  3793. * only, and would normally not be used by applications.
  3794. * @param[in] avc a pointer to an arbitrary struct of which the first field is
  3795. * a pointer to an AVClass struct
  3796. * @param[in] msg string containing an optional message, or NULL if no message
  3797. */
  3798. void av_log_ask_for_sample(void *avc, const char *msg, ...) av_printf_format(2, 3);
  3799. /**
  3800. * Register the hardware accelerator hwaccel.
  3801. */
  3802. void av_register_hwaccel(AVHWAccel *hwaccel);
  3803. /**
  3804. * If hwaccel is NULL, returns the first registered hardware accelerator,
  3805. * if hwaccel is non-NULL, returns the next registered hardware accelerator
  3806. * after hwaccel, or NULL if hwaccel is the last one.
  3807. */
  3808. AVHWAccel *av_hwaccel_next(AVHWAccel *hwaccel);
  3809. /**
  3810. * Lock operation used by lockmgr
  3811. */
  3812. enum AVLockOp {
  3813. AV_LOCK_CREATE, ///< Create a mutex
  3814. AV_LOCK_OBTAIN, ///< Lock the mutex
  3815. AV_LOCK_RELEASE, ///< Unlock the mutex
  3816. AV_LOCK_DESTROY, ///< Free mutex resources
  3817. };
  3818. /**
  3819. * Register a user provided lock manager supporting the operations
  3820. * specified by AVLockOp. mutex points to a (void *) where the
  3821. * lockmgr should store/get a pointer to a user allocated mutex. It's
  3822. * NULL upon AV_LOCK_CREATE and != NULL for all other ops.
  3823. *
  3824. * @param cb User defined callback. Note: Libav may invoke calls to this
  3825. * callback during the call to av_lockmgr_register().
  3826. * Thus, the application must be prepared to handle that.
  3827. * If cb is set to NULL the lockmgr will be unregistered.
  3828. * Also note that during unregistration the previously registered
  3829. * lockmgr callback may also be invoked.
  3830. */
  3831. int av_lockmgr_register(int (*cb)(void **mutex, enum AVLockOp op));
  3832. /**
  3833. * Get the type of the given codec.
  3834. */
  3835. enum AVMediaType avcodec_get_type(enum CodecID codec_id);
  3836. /**
  3837. * Get the AVClass for AVCodecContext. It can be used in combination with
  3838. * AV_OPT_SEARCH_FAKE_OBJ for examining options.
  3839. *
  3840. * @see av_opt_find().
  3841. */
  3842. const AVClass *avcodec_get_class(void);
  3843. #endif /* AVCODEC_AVCODEC_H */