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.

1934 lines
56KB

  1. #ifndef AVCODEC_H
  2. #define AVCODEC_H
  3. /**
  4. * @file avcodec.h
  5. * external api header.
  6. */
  7. #ifdef __cplusplus
  8. extern "C" {
  9. #endif
  10. #include "common.h"
  11. #include "rational.h"
  12. #define FFMPEG_VERSION_INT 0x000408
  13. #define FFMPEG_VERSION "0.4.8"
  14. #define LIBAVCODEC_BUILD 4692
  15. #define LIBAVCODEC_VERSION_INT FFMPEG_VERSION_INT
  16. #define LIBAVCODEC_VERSION FFMPEG_VERSION
  17. #define AV_STRINGIFY(s) AV_TOSTRING(s)
  18. #define AV_TOSTRING(s) #s
  19. #define LIBAVCODEC_IDENT "FFmpeg" LIBAVCODEC_VERSION "b" AV_STRINGIFY(LIBAVCODEC_BUILD)
  20. enum CodecID {
  21. CODEC_ID_NONE,
  22. CODEC_ID_MPEG1VIDEO,
  23. CODEC_ID_MPEG2VIDEO, /* prefered ID for MPEG Video 1 or 2 decoding */
  24. CODEC_ID_MPEG2VIDEO_XVMC,
  25. CODEC_ID_H263,
  26. CODEC_ID_RV10,
  27. CODEC_ID_MP2,
  28. CODEC_ID_MP3, /* prefered ID for MPEG Audio layer 1, 2 or3 decoding */
  29. CODEC_ID_VORBIS,
  30. CODEC_ID_AC3,
  31. CODEC_ID_MJPEG,
  32. CODEC_ID_MJPEGB,
  33. CODEC_ID_LJPEG,
  34. CODEC_ID_SP5X,
  35. CODEC_ID_MPEG4,
  36. CODEC_ID_RAWVIDEO,
  37. CODEC_ID_MSMPEG4V1,
  38. CODEC_ID_MSMPEG4V2,
  39. CODEC_ID_MSMPEG4V3,
  40. CODEC_ID_WMV1,
  41. CODEC_ID_WMV2,
  42. CODEC_ID_H263P,
  43. CODEC_ID_H263I,
  44. CODEC_ID_FLV1,
  45. CODEC_ID_SVQ1,
  46. CODEC_ID_SVQ3,
  47. CODEC_ID_DVVIDEO,
  48. CODEC_ID_DVAUDIO,
  49. CODEC_ID_WMAV1,
  50. CODEC_ID_WMAV2,
  51. CODEC_ID_MACE3,
  52. CODEC_ID_MACE6,
  53. CODEC_ID_HUFFYUV,
  54. CODEC_ID_CYUV,
  55. CODEC_ID_H264,
  56. CODEC_ID_INDEO3,
  57. CODEC_ID_VP3,
  58. CODEC_ID_THEORA,
  59. CODEC_ID_AAC,
  60. CODEC_ID_MPEG4AAC,
  61. CODEC_ID_ASV1,
  62. CODEC_ID_ASV2,
  63. CODEC_ID_FFV1,
  64. CODEC_ID_4XM,
  65. CODEC_ID_VCR1,
  66. CODEC_ID_CLJR,
  67. CODEC_ID_MDEC,
  68. CODEC_ID_ROQ,
  69. CODEC_ID_INTERPLAY_VIDEO,
  70. CODEC_ID_XAN_WC3,
  71. CODEC_ID_XAN_WC4,
  72. CODEC_ID_RPZA,
  73. CODEC_ID_CINEPAK,
  74. CODEC_ID_WS_VQA,
  75. CODEC_ID_MSRLE,
  76. CODEC_ID_MSVIDEO1,
  77. CODEC_ID_IDCIN,
  78. CODEC_ID_8BPS,
  79. CODEC_ID_SMC,
  80. /* various pcm "codecs" */
  81. CODEC_ID_PCM_S16LE,
  82. CODEC_ID_PCM_S16BE,
  83. CODEC_ID_PCM_U16LE,
  84. CODEC_ID_PCM_U16BE,
  85. CODEC_ID_PCM_S8,
  86. CODEC_ID_PCM_U8,
  87. CODEC_ID_PCM_MULAW,
  88. CODEC_ID_PCM_ALAW,
  89. /* various adpcm codecs */
  90. CODEC_ID_ADPCM_IMA_QT,
  91. CODEC_ID_ADPCM_IMA_WAV,
  92. CODEC_ID_ADPCM_IMA_DK3,
  93. CODEC_ID_ADPCM_IMA_DK4,
  94. CODEC_ID_ADPCM_IMA_WS,
  95. CODEC_ID_ADPCM_MS,
  96. CODEC_ID_ADPCM_4XM,
  97. CODEC_ID_ADPCM_XA,
  98. CODEC_ID_ADPCM_ADX,
  99. /* AMR */
  100. CODEC_ID_AMR_NB,
  101. CODEC_ID_AMR_WB,
  102. /* RealAudio codecs*/
  103. CODEC_ID_RA_144,
  104. CODEC_ID_RA_288,
  105. /* various DPCM codecs */
  106. CODEC_ID_ROQ_DPCM,
  107. CODEC_ID_INTERPLAY_DPCM,
  108. CODEC_ID_XAN_DPCM,
  109. CODEC_ID_MPEG2TS, /* _FAKE_ codec to indicate a raw MPEG2 transport
  110. stream (only used by libavformat) */
  111. };
  112. /* CODEC_ID_MP3LAME is absolete */
  113. #define CODEC_ID_MP3LAME CODEC_ID_MP3
  114. enum CodecType {
  115. CODEC_TYPE_UNKNOWN = -1,
  116. CODEC_TYPE_VIDEO,
  117. CODEC_TYPE_AUDIO,
  118. CODEC_TYPE_DATA,
  119. };
  120. /**
  121. * Pixel format. Notes:
  122. *
  123. * PIX_FMT_RGBA32 is handled in an endian-specific manner. A RGBA
  124. * color is put together as:
  125. * (A << 24) | (R << 16) | (G << 8) | B
  126. * This is stored as BGRA on little endian CPU architectures and ARGB on
  127. * big endian CPUs.
  128. *
  129. * When the pixel format is palettized RGB (PIX_FMT_PAL8), the palettized
  130. * image data is stored in AVFrame.data[0]. The palette is transported in
  131. * AVFrame.data[1] and, is 1024 bytes long (256 4-byte entries) and is
  132. * formatted the same as in PIX_FMT_RGBA32 described above (i.e., it is
  133. * also endian-specific). Note also that the individual RGB palette
  134. * components stored in AVFrame.data[1] should be in the range 0..255.
  135. * This is important as many custom PAL8 video codecs that were designed
  136. * to run on the IBM VGA graphics adapter use 6-bit palette components.
  137. */
  138. enum PixelFormat {
  139. PIX_FMT_YUV420P, ///< Planar YUV 4:2:0 (1 Cr & Cb sample per 2x2 Y samples)
  140. PIX_FMT_YUV422,
  141. PIX_FMT_RGB24, ///< Packed pixel, 3 bytes per pixel, RGBRGB...
  142. PIX_FMT_BGR24, ///< Packed pixel, 3 bytes per pixel, BGRBGR...
  143. PIX_FMT_YUV422P, ///< Planar YUV 4:2:2 (1 Cr & Cb sample per 2x1 Y samples)
  144. PIX_FMT_YUV444P, ///< Planar YUV 4:4:4 (1 Cr & Cb sample per 1x1 Y samples)
  145. PIX_FMT_RGBA32, ///< Packed pixel, 4 bytes per pixel, BGRABGRA..., stored in cpu endianness
  146. PIX_FMT_YUV410P, ///< Planar YUV 4:1:0 (1 Cr & Cb sample per 4x4 Y samples)
  147. PIX_FMT_YUV411P, ///< Planar YUV 4:1:1 (1 Cr & Cb sample per 4x1 Y samples)
  148. PIX_FMT_RGB565, ///< always stored in cpu endianness
  149. PIX_FMT_RGB555, ///< always stored in cpu endianness, most significant bit to 1
  150. PIX_FMT_GRAY8,
  151. PIX_FMT_MONOWHITE, ///< 0 is white
  152. PIX_FMT_MONOBLACK, ///< 0 is black
  153. PIX_FMT_PAL8, ///< 8 bit with RGBA palette
  154. PIX_FMT_YUVJ420P, ///< Planar YUV 4:2:0 full scale (jpeg)
  155. PIX_FMT_YUVJ422P, ///< Planar YUV 4:2:2 full scale (jpeg)
  156. PIX_FMT_YUVJ444P, ///< Planar YUV 4:4:4 full scale (jpeg)
  157. PIX_FMT_XVMC_MPEG2_MC,///< XVideo Motion Acceleration via common packet passing(xvmc_render.h)
  158. PIX_FMT_XVMC_MPEG2_IDCT,
  159. PIX_FMT_NB,
  160. };
  161. /* currently unused, may be used if 24/32 bits samples ever supported */
  162. enum SampleFormat {
  163. SAMPLE_FMT_S16 = 0, ///< signed 16 bits
  164. };
  165. /* in bytes */
  166. #define AVCODEC_MAX_AUDIO_FRAME_SIZE 131072
  167. /**
  168. * Required number of additionally allocated bytes at the end of the input bitstream for decoding.
  169. * this is mainly needed because some optimized bitstream readers read
  170. * 32 or 64 bit at once and could read over the end<br>
  171. * Note, if the first 23 bits of the additional bytes are not 0 then damaged
  172. * MPEG bitstreams could cause overread and segfault
  173. */
  174. #define FF_INPUT_BUFFER_PADDING_SIZE 8
  175. /* motion estimation type, EPZS by default */
  176. enum Motion_Est_ID {
  177. ME_ZERO = 1,
  178. ME_FULL,
  179. ME_LOG,
  180. ME_PHODS,
  181. ME_EPZS,
  182. ME_X1
  183. };
  184. typedef struct RcOverride{
  185. int start_frame;
  186. int end_frame;
  187. int qscale; // if this is 0 then quality_factor will be used instead
  188. float quality_factor;
  189. } RcOverride;
  190. /* only for ME compatiblity with old apps */
  191. extern int motion_estimation_method;
  192. /* ME algos sorted by quality */
  193. //FIXME remove IMHO
  194. static const __attribute__((unused)) int Motion_Est_QTab[] =
  195. { ME_ZERO, ME_PHODS, ME_LOG, ME_X1, ME_EPZS, ME_FULL };
  196. #define FF_MAX_B_FRAMES 8
  197. /* encoding support
  198. these flags can be passed in AVCodecContext.flags before initing
  199. Note: note not everything is supported yet
  200. */
  201. #define CODEC_FLAG_QSCALE 0x0002 ///< use fixed qscale
  202. #define CODEC_FLAG_4MV 0x0004 ///< 4 MV per MB allowed
  203. #define CODEC_FLAG_QPEL 0x0010 ///< use qpel MC
  204. #define CODEC_FLAG_GMC 0x0020 ///< use GMC
  205. #define CODEC_FLAG_MV0 0x0040 ///< always try a MB with MV=<0,0>
  206. #define CODEC_FLAG_PART 0x0080 ///< use data partitioning
  207. /* parent program gurantees that the input for b-frame containing streams is not written to
  208. for at least s->max_b_frames+1 frames, if this is not set than the input will be copied */
  209. #define CODEC_FLAG_INPUT_PRESERVED 0x0100
  210. #define CODEC_FLAG_PASS1 0x0200 ///< use internal 2pass ratecontrol in first pass mode
  211. #define CODEC_FLAG_PASS2 0x0400 ///< use internal 2pass ratecontrol in second pass mode
  212. #define CODEC_FLAG_EXTERN_HUFF 0x1000 ///< use external huffman table (for mjpeg)
  213. #define CODEC_FLAG_GRAY 0x2000 ///< only decode/encode grayscale
  214. #define CODEC_FLAG_EMU_EDGE 0x4000///< dont draw edges
  215. #define CODEC_FLAG_PSNR 0x8000 ///< error[?] variables will be set during encoding
  216. #define CODEC_FLAG_TRUNCATED 0x00010000 /** input bitstream might be truncated at a random location instead
  217. of only at frame boundaries */
  218. #define CODEC_FLAG_NORMALIZE_AQP 0x00020000 ///< normalize adaptive quantization
  219. #define CODEC_FLAG_INTERLACED_DCT 0x00040000 ///< use interlaced dct
  220. #define CODEC_FLAG_LOW_DELAY 0x00080000 ///< force low delay
  221. #define CODEC_FLAG_ALT_SCAN 0x00100000 ///< use alternate scan
  222. #define CODEC_FLAG_TRELLIS_QUANT 0x00200000 ///< use trellis quantization
  223. #define CODEC_FLAG_GLOBAL_HEADER 0x00400000 ///< place global headers in extradata instead of every keyframe
  224. #define CODEC_FLAG_BITEXACT 0x00800000 ///< use only bitexact stuff (except (i)dct)
  225. /* Fx : Flag for h263+ extra options */
  226. #define CODEC_FLAG_H263P_AIC 0x01000000 ///< H263 Advanced intra coding / MPEG4 AC prediction (remove this)
  227. #define CODEC_FLAG_AC_PRED 0x01000000 ///< H263 Advanced intra coding / MPEG4 AC prediction
  228. #define CODEC_FLAG_H263P_UMV 0x02000000 ///< Unlimited motion vector
  229. #define CODEC_FLAG_CBP_RD 0x04000000 ///< use rate distortion optimization for cbp
  230. #define CODEC_FLAG_QP_RD 0x08000000 ///< use rate distortion optimization for qp selectioon
  231. /* For advanced prediction mode, we reuse the 4MV flag */
  232. /* Unsupported options :
  233. * Syntax Arithmetic coding (SAC)
  234. * Deblocking filter internal loop
  235. * Slice structured
  236. * Reference Picture Selection
  237. * Independant Segment Decoding
  238. * Alternative Inter * VLC
  239. * Modified Quantization */
  240. /* /Fx */
  241. /* codec capabilities */
  242. #define CODEC_CAP_DRAW_HORIZ_BAND 0x0001 ///< decoder can use draw_horiz_band callback
  243. /**
  244. * Codec uses get_buffer() for allocating buffers.
  245. * direct rendering method 1
  246. */
  247. #define CODEC_CAP_DR1 0x0002
  248. /* if 'parse_only' field is true, then avcodec_parse_frame() can be
  249. used */
  250. #define CODEC_CAP_PARSE_ONLY 0x0004
  251. #define CODEC_CAP_TRUNCATED 0x0008
  252. /*
  253. * Codec can use conditional replenishment if available.
  254. */
  255. #define CODEC_CAP_CR 0x0010
  256. /**
  257. * Pan Scan area.
  258. * this specifies the area which should be displayed. Note there may be multiple such areas for one frame
  259. */
  260. typedef struct AVPanScan{
  261. /**
  262. * id.
  263. * - encoding: set by user.
  264. * - decoding: set by lavc
  265. */
  266. int id;
  267. /**
  268. * width and height in 1/16 pel
  269. * - encoding: set by user.
  270. * - decoding: set by lavc
  271. */
  272. int width;
  273. int height;
  274. /**
  275. * position of the top left corner in 1/16 pel for up to 3 fields/frames.
  276. * - encoding: set by user.
  277. * - decoding: set by lavc
  278. */
  279. int16_t position[3][2];
  280. }AVPanScan;
  281. #define FF_COMMON_FRAME \
  282. /**\
  283. * pointer to the picture planes.\
  284. * this might be different from the first allocated byte\
  285. * - encoding: \
  286. * - decoding: \
  287. */\
  288. uint8_t *data[4];\
  289. int linesize[4];\
  290. /**\
  291. * pointer to the first allocated byte of the picture. can be used in get_buffer/release_buffer\
  292. * this isnt used by lavc unless the default get/release_buffer() is used\
  293. * - encoding: \
  294. * - decoding: \
  295. */\
  296. uint8_t *base[4];\
  297. /**\
  298. * 1 -> keyframe, 0-> not\
  299. * - encoding: set by lavc\
  300. * - decoding: set by lavc\
  301. */\
  302. int key_frame;\
  303. \
  304. /**\
  305. * picture type of the frame, see ?_TYPE below.\
  306. * - encoding: set by lavc for coded_picture (and set by user for input)\
  307. * - decoding: set by lavc\
  308. */\
  309. int pict_type;\
  310. \
  311. /**\
  312. * presentation timestamp in micro seconds (time when frame should be shown to user)\
  313. * if 0 then the frame_rate will be used as reference\
  314. * - encoding: MUST be set by user\
  315. * - decoding: set by lavc\
  316. */\
  317. int64_t pts;\
  318. \
  319. /**\
  320. * picture number in bitstream order.\
  321. * - encoding: set by\
  322. * - decoding: set by lavc\
  323. */\
  324. int coded_picture_number;\
  325. /**\
  326. * picture number in display order.\
  327. * - encoding: set by\
  328. * - decoding: set by lavc\
  329. */\
  330. int display_picture_number;\
  331. \
  332. /**\
  333. * quality (between 1 (good) and FF_LAMBDA_MAX (bad)) \
  334. * - encoding: set by lavc for coded_picture (and set by user for input)\
  335. * - decoding: set by lavc\
  336. */\
  337. int quality; \
  338. \
  339. /**\
  340. * buffer age (1->was last buffer and dint change, 2->..., ...).\
  341. * set to INT_MAX if the buffer has not been used yet \
  342. * - encoding: unused\
  343. * - decoding: MUST be set by get_buffer()\
  344. */\
  345. int age;\
  346. \
  347. /**\
  348. * is this picture used as reference\
  349. * - encoding: unused\
  350. * - decoding: set by lavc (before get_buffer() call))\
  351. */\
  352. int reference;\
  353. \
  354. /**\
  355. * QP table\
  356. * - encoding: unused\
  357. * - decoding: set by lavc\
  358. */\
  359. int8_t *qscale_table;\
  360. /**\
  361. * QP store stride\
  362. * - encoding: unused\
  363. * - decoding: set by lavc\
  364. */\
  365. int qstride;\
  366. \
  367. /**\
  368. * mbskip_table[mb]>=1 if MB didnt change\
  369. * stride= mb_width = (width+15)>>4\
  370. * - encoding: unused\
  371. * - decoding: set by lavc\
  372. */\
  373. uint8_t *mbskip_table;\
  374. \
  375. /**\
  376. * for some private data of the user\
  377. * - encoding: unused\
  378. * - decoding: set by user\
  379. */\
  380. void *opaque;\
  381. \
  382. /**\
  383. * error\
  384. * - encoding: set by lavc if flags&CODEC_FLAG_PSNR\
  385. * - decoding: unused\
  386. */\
  387. uint64_t error[4];\
  388. \
  389. /**\
  390. * type of the buffer (to keep track of who has to dealloc data[*])\
  391. * - encoding: set by the one who allocs it\
  392. * - decoding: set by the one who allocs it\
  393. * Note: user allocated (direct rendering) & internal buffers can not coexist currently\
  394. */\
  395. int type;\
  396. \
  397. /**\
  398. * when decoding, this signal how much the picture must be delayed.\
  399. * extra_delay = repeat_pict / (2*fps)\
  400. * - encoding: unused\
  401. * - decoding: set by lavc\
  402. */\
  403. int repeat_pict;\
  404. \
  405. /**\
  406. * \
  407. */\
  408. int qscale_type;\
  409. \
  410. /**\
  411. * The content of the picture is interlaced.\
  412. * - encoding: set by user\
  413. * - decoding: set by lavc (default 0)\
  414. */\
  415. int interlaced_frame;\
  416. \
  417. /**\
  418. * if the content is interlaced, is top field displayed first.\
  419. * - encoding: set by user\
  420. * - decoding: set by lavc\
  421. */\
  422. int top_field_first;\
  423. \
  424. /**\
  425. * Pan scan.\
  426. * - encoding: set by user\
  427. * - decoding: set by lavc\
  428. */\
  429. AVPanScan *pan_scan;\
  430. \
  431. /**\
  432. * tell user application that palette has changed from previous frame.\
  433. * - encoding: ??? (no palette-enabled encoder yet)\
  434. * - decoding: set by lavc (default 0)\
  435. */\
  436. int palette_has_changed;\
  437. \
  438. /**\
  439. * Codec suggestion on buffer type if != 0\
  440. * - encoding: unused\
  441. * - decoding: set by lavc (before get_buffer() call))\
  442. */\
  443. int buffer_hints;\
  444. #define FF_QSCALE_TYPE_MPEG1 0
  445. #define FF_QSCALE_TYPE_MPEG2 1
  446. #define FF_BUFFER_TYPE_INTERNAL 1
  447. #define FF_BUFFER_TYPE_USER 2 ///< Direct rendering buffers (image is (de)allocated by user)
  448. #define FF_BUFFER_TYPE_SHARED 4 ///< buffer from somewher else, dont dealloc image (data/base)
  449. #define FF_BUFFER_TYPE_COPY 8 ///< just a (modified) copy of some other buffer, dont dealloc anything
  450. #define FF_I_TYPE 1 // Intra
  451. #define FF_P_TYPE 2 // Predicted
  452. #define FF_B_TYPE 3 // Bi-dir predicted
  453. #define FF_S_TYPE 4 // S(GMC)-VOP MPEG4
  454. #define FF_SI_TYPE 5
  455. #define FF_SP_TYPE 6
  456. #define FF_BUFFER_HINTS_VALID 0x01 // Buffer hints value is meaningful (if 0 ignore)
  457. #define FF_BUFFER_HINTS_READABLE 0x02 // Codec will read from buffer
  458. #define FF_BUFFER_HINTS_PRESERVE 0x04 // User must not alter buffer content
  459. #define FF_BUFFER_HINTS_REUSABLE 0x08 // Codec will reuse the buffer (update)
  460. /**
  461. * Audio Video Frame.
  462. */
  463. typedef struct AVFrame {
  464. FF_COMMON_FRAME
  465. } AVFrame;
  466. #define DEFAULT_FRAME_RATE_BASE 1001000
  467. /**
  468. * main external api structure.
  469. */
  470. typedef struct AVCodecContext {
  471. /**
  472. * the average bitrate.
  473. * - encoding: set by user. unused for constant quantizer encoding
  474. * - decoding: set by lavc. 0 or some bitrate if this info is available in the stream
  475. */
  476. int bit_rate;
  477. /**
  478. * number of bits the bitstream is allowed to diverge from the reference.
  479. * the reference can be CBR (for CBR pass1) or VBR (for pass2)
  480. * - encoding: set by user. unused for constant quantizer encoding
  481. * - decoding: unused
  482. */
  483. int bit_rate_tolerance;
  484. /**
  485. * CODEC_FLAG_*.
  486. * - encoding: set by user.
  487. * - decoding: set by user.
  488. */
  489. int flags;
  490. /**
  491. * some codecs needs additionnal format info. It is stored here
  492. * - encoding: set by user.
  493. * - decoding: set by lavc. (FIXME is this ok?)
  494. */
  495. int sub_id;
  496. /**
  497. * motion estimation algorithm used for video coding.
  498. * - encoding: MUST be set by user.
  499. * - decoding: unused
  500. */
  501. int me_method;
  502. /**
  503. * some codecs need / can use extra-data like huffman tables.
  504. * mjpeg: huffman tables
  505. * rv10: additional flags
  506. * mpeg4: global headers (they can be in the bitstream or here)
  507. * - encoding: set/allocated/freed by lavc.
  508. * - decoding: set/allocated/freed by user.
  509. */
  510. void *extradata;
  511. int extradata_size;
  512. /* video only */
  513. /**
  514. * frames per sec multiplied by frame_rate_base.
  515. * for variable fps this is the precission, so if the timestamps
  516. * can be specified in msec precssion then this is 1000*frame_rate_base
  517. * - encoding: MUST be set by user
  518. * - decoding: set by lavc. 0 or the frame_rate if available
  519. */
  520. int frame_rate;
  521. /**
  522. * width / height.
  523. * - encoding: MUST be set by user.
  524. * - decoding: set by user if known, codec should override / dynamically change if needed
  525. */
  526. int width, height;
  527. #define FF_ASPECT_SQUARE 1
  528. #define FF_ASPECT_4_3_625 2
  529. #define FF_ASPECT_4_3_525 3
  530. #define FF_ASPECT_16_9_625 4
  531. #define FF_ASPECT_16_9_525 5
  532. #define FF_ASPECT_EXTENDED 15
  533. /**
  534. * the number of pictures in a group of pitures, or 0 for intra_only.
  535. * - encoding: set by user.
  536. * - decoding: unused
  537. */
  538. int gop_size;
  539. /**
  540. * pixel format, see PIX_FMT_xxx.
  541. * - encoding: FIXME: used by ffmpeg to decide whether an pix_fmt
  542. * conversion is in order. This only works for
  543. * codecs with one supported pix_fmt, we should
  544. * do something for a generic case as well.
  545. * - decoding: set by lavc.
  546. */
  547. enum PixelFormat pix_fmt;
  548. /**
  549. * Frame rate emulation. If not zero lower layer (i.e. format handler)
  550. * has to read frames at native frame rate.
  551. * - encoding: set by user.
  552. * - decoding: unused.
  553. */
  554. int rate_emu;
  555. /**
  556. * if non NULL, 'draw_horiz_band' is called by the libavcodec
  557. * decoder to draw an horizontal band. It improve cache usage. Not
  558. * all codecs can do that. You must check the codec capabilities
  559. * before
  560. * - encoding: unused
  561. * - decoding: set by user.
  562. * @param height the height of the slice
  563. * @param y the y position of the slice
  564. * @param type 1->top field, 2->bottom field, 3->frame
  565. * @param offset offset into the AVFrame.data from which the slice should be read
  566. */
  567. void (*draw_horiz_band)(struct AVCodecContext *s,
  568. const AVFrame *src, int offset[4],
  569. int y, int type, int height);
  570. /* audio only */
  571. int sample_rate; ///< samples per sec
  572. int channels;
  573. int sample_fmt; ///< sample format, currenly unused
  574. /* the following data should not be initialized */
  575. int frame_size; ///< in samples, initialized when calling 'init'
  576. int frame_number; ///< audio or video frame number
  577. int real_pict_num; ///< returns the real picture number of previous encoded frame
  578. /**
  579. * number of frames the decoded output will be delayed relative to
  580. * the encoded input.
  581. * - encoding: set by lavc.
  582. * - decoding: unused
  583. */
  584. int delay;
  585. /* - encoding parameters */
  586. float qcompress; ///< amount of qscale change between easy & hard scenes (0.0-1.0)
  587. float qblur; ///< amount of qscale smoothing over time (0.0-1.0)
  588. /**
  589. * minimum quantizer.
  590. * - encoding: set by user.
  591. * - decoding: unused
  592. */
  593. int qmin;
  594. /**
  595. * maximum quantizer.
  596. * - encoding: set by user.
  597. * - decoding: unused
  598. */
  599. int qmax;
  600. /**
  601. * maximum quantizer difference etween frames.
  602. * - encoding: set by user.
  603. * - decoding: unused
  604. */
  605. int max_qdiff;
  606. /**
  607. * maximum number of b frames between non b frames.
  608. * note: the output will be delayed by max_b_frames+1 relative to the input
  609. * - encoding: set by user.
  610. * - decoding: unused
  611. */
  612. int max_b_frames;
  613. /**
  614. * qscale factor between ip and b frames.
  615. * - encoding: set by user.
  616. * - decoding: unused
  617. */
  618. float b_quant_factor;
  619. /** obsolete FIXME remove */
  620. int rc_strategy;
  621. int b_frame_strategy;
  622. /**
  623. * hurry up amount.
  624. * - encoding: unused
  625. * - decoding: set by user. 1-> skip b frames, 2-> skip idct/dequant too, 5-> skip everything except header
  626. */
  627. int hurry_up;
  628. struct AVCodec *codec;
  629. void *priv_data;
  630. /* The following data is for RTP friendly coding */
  631. /* By now only H.263/H.263+/MPEG4 coder honours this */
  632. int rtp_mode; /* 1 for activate RTP friendly-mode */
  633. /* highers numbers represent more error-prone */
  634. /* enviroments, by now just "1" exist */
  635. int rtp_payload_size; /* The size of the RTP payload, the coder will */
  636. /* do it's best to deliver a chunk with size */
  637. /* below rtp_payload_size, the chunk will start */
  638. /* with a start code on some codecs like H.263 */
  639. /* This doesn't take account of any particular */
  640. /* headers inside the transmited RTP payload */
  641. /* The RTP callcack: This function is called */
  642. /* every time the encoder as a packet to send */
  643. /* Depends on the encoder if the data starts */
  644. /* with a Start Code (it should) H.263 does */
  645. void (*rtp_callback)(void *data, int size, int packet_number);
  646. /* statistics, used for 2-pass encoding */
  647. int mv_bits;
  648. int header_bits;
  649. int i_tex_bits;
  650. int p_tex_bits;
  651. int i_count;
  652. int p_count;
  653. int skip_count;
  654. int misc_bits;
  655. /**
  656. * number of bits used for the previously encoded frame.
  657. * - encoding: set by lavc
  658. * - decoding: unused
  659. */
  660. int frame_bits;
  661. /**
  662. * private data of the user, can be used to carry app specific stuff.
  663. * - encoding: set by user
  664. * - decoding: set by user
  665. */
  666. void *opaque;
  667. char codec_name[32];
  668. enum CodecType codec_type; /* see CODEC_TYPE_xxx */
  669. enum CodecID codec_id; /* see CODEC_ID_xxx */
  670. /**
  671. * fourcc (LSB first, so "ABCD" -> ('D'<<24) + ('C'<<16) + ('B'<<8) + 'A').
  672. * this is used to workaround some encoder bugs
  673. * - encoding: set by user, if not then the default based on codec_id will be used
  674. * - decoding: set by user, will be converted to upper case by lavc during init
  675. */
  676. unsigned int codec_tag;
  677. /**
  678. * workaround bugs in encoders which sometimes cannot be detected automatically.
  679. * - encoding: unused
  680. * - decoding: set by user
  681. */
  682. int workaround_bugs;
  683. #define FF_BUG_AUTODETECT 1 ///< autodetection
  684. #define FF_BUG_OLD_MSMPEG4 2
  685. #define FF_BUG_XVID_ILACE 4
  686. #define FF_BUG_UMP4 8
  687. #define FF_BUG_NO_PADDING 16
  688. #define FF_BUG_AC_VLC 0 ///< will be removed, libavcodec can now handle these non compliant files by default
  689. #define FF_BUG_QPEL_CHROMA 64
  690. #define FF_BUG_STD_QPEL 128
  691. #define FF_BUG_QPEL_CHROMA2 256
  692. #define FF_BUG_DIRECT_BLOCKSIZE 512
  693. #define FF_BUG_EDGE 1024
  694. //#define FF_BUG_FAKE_SCALABILITY 16 //autodetection should work 100%
  695. /**
  696. * luma single coeff elimination threshold.
  697. * - encoding: set by user
  698. * - decoding: unused
  699. */
  700. int luma_elim_threshold;
  701. /**
  702. * chroma single coeff elimination threshold.
  703. * - encoding: set by user
  704. * - decoding: unused
  705. */
  706. int chroma_elim_threshold;
  707. /**
  708. * strictly follow the std (MPEG4, ...).
  709. * - encoding: set by user
  710. * - decoding: unused
  711. */
  712. int strict_std_compliance;
  713. /**
  714. * qscale offset between ip and b frames.
  715. * if > 0 then the last p frame quantizer will be used (q= lastp_q*factor+offset)
  716. * if < 0 then normal ratecontrol will be done (q= -normal_q*factor+offset)
  717. * - encoding: set by user.
  718. * - decoding: unused
  719. */
  720. float b_quant_offset;
  721. /**
  722. * error resilience higher values will detect more errors but may missdetect
  723. * some more or less valid parts as errors.
  724. * - encoding: unused
  725. * - decoding: set by user
  726. */
  727. int error_resilience;
  728. #define FF_ER_CAREFULL 1
  729. #define FF_ER_COMPLIANT 2
  730. #define FF_ER_AGGRESSIVE 3
  731. #define FF_ER_VERY_AGGRESSIVE 4
  732. /**
  733. * called at the beginning of each frame to get a buffer for it.
  734. * if pic.reference is set then the frame will be read later by lavc
  735. * width and height should be rounded up to the next multiple of 16
  736. * - encoding: unused
  737. * - decoding: set by lavc, user can override
  738. */
  739. int (*get_buffer)(struct AVCodecContext *c, AVFrame *pic);
  740. /**
  741. * called to release buffers which where allocated with get_buffer.
  742. * a released buffer can be reused in get_buffer()
  743. * pic.data[*] must be set to NULL
  744. * - encoding: unused
  745. * - decoding: set by lavc, user can override
  746. */
  747. void (*release_buffer)(struct AVCodecContext *c, AVFrame *pic);
  748. /**
  749. * is 1 if the decoded stream contains b frames, 0 otherwise.
  750. * - encoding: unused
  751. * - decoding: set by lavc
  752. */
  753. int has_b_frames;
  754. int block_align; ///< used by some WAV based audio codecs
  755. int parse_only; /* - decoding only: if true, only parsing is done
  756. (function avcodec_parse_frame()). The frame
  757. data is returned. Only MPEG codecs support this now. */
  758. /**
  759. * 0-> h263 quant 1-> mpeg quant.
  760. * - encoding: set by user.
  761. * - decoding: unused
  762. */
  763. int mpeg_quant;
  764. /**
  765. * pass1 encoding statistics output buffer.
  766. * - encoding: set by lavc
  767. * - decoding: unused
  768. */
  769. char *stats_out;
  770. /**
  771. * pass2 encoding statistics input buffer.
  772. * concatenated stuff from stats_out of pass1 should be placed here
  773. * - encoding: allocated/set/freed by user
  774. * - decoding: unused
  775. */
  776. char *stats_in;
  777. /**
  778. * ratecontrol qmin qmax limiting method.
  779. * 0-> clipping, 1-> use a nice continous function to limit qscale wthin qmin/qmax
  780. * - encoding: set by user.
  781. * - decoding: unused
  782. */
  783. float rc_qsquish;
  784. float rc_qmod_amp;
  785. int rc_qmod_freq;
  786. /**
  787. * ratecontrol override, see RcOverride.
  788. * - encoding: allocated/set/freed by user.
  789. * - decoding: unused
  790. */
  791. RcOverride *rc_override;
  792. int rc_override_count;
  793. /**
  794. * rate control equation.
  795. * - encoding: set by user
  796. * - decoding: unused
  797. */
  798. char *rc_eq;
  799. /**
  800. * maximum bitrate.
  801. * - encoding: set by user.
  802. * - decoding: unused
  803. */
  804. int rc_max_rate;
  805. /**
  806. * minimum bitrate.
  807. * - encoding: set by user.
  808. * - decoding: unused
  809. */
  810. int rc_min_rate;
  811. /**
  812. * decoder bitstream buffer size.
  813. * - encoding: set by user.
  814. * - decoding: unused
  815. */
  816. int rc_buffer_size;
  817. float rc_buffer_aggressivity;
  818. /**
  819. * qscale factor between p and i frames.
  820. * - encoding: set by user.
  821. * - decoding: unused
  822. */
  823. float i_quant_factor;
  824. /**
  825. * qscale offset between p and i frames.
  826. * if > 0 then the last p frame quantizer will be used (q= lastp_q*factor+offset)
  827. * if < 0 then normal ratecontrol will be done (q= -normal_q*factor+offset)
  828. * - encoding: set by user.
  829. * - decoding: unused
  830. */
  831. float i_quant_offset;
  832. /**
  833. * initial complexity for pass1 ratecontrol.
  834. * - encoding: set by user.
  835. * - decoding: unused
  836. */
  837. float rc_initial_cplx;
  838. /**
  839. * dct algorithm, see FF_DCT_* below.
  840. * - encoding: set by user
  841. * - decoding: unused
  842. */
  843. int dct_algo;
  844. #define FF_DCT_AUTO 0
  845. #define FF_DCT_FASTINT 1
  846. #define FF_DCT_INT 2
  847. #define FF_DCT_MMX 3
  848. #define FF_DCT_MLIB 4
  849. #define FF_DCT_ALTIVEC 5
  850. #define FF_DCT_FAAN 6
  851. /**
  852. * luminance masking (0-> disabled).
  853. * - encoding: set by user
  854. * - decoding: unused
  855. */
  856. float lumi_masking;
  857. /**
  858. * temporary complexity masking (0-> disabled).
  859. * - encoding: set by user
  860. * - decoding: unused
  861. */
  862. float temporal_cplx_masking;
  863. /**
  864. * spatial complexity masking (0-> disabled).
  865. * - encoding: set by user
  866. * - decoding: unused
  867. */
  868. float spatial_cplx_masking;
  869. /**
  870. * p block masking (0-> disabled).
  871. * - encoding: set by user
  872. * - decoding: unused
  873. */
  874. float p_masking;
  875. /**
  876. * darkness masking (0-> disabled).
  877. * - encoding: set by user
  878. * - decoding: unused
  879. */
  880. float dark_masking;
  881. /* for binary compatibility */
  882. int unused;
  883. /**
  884. * idct algorithm, see FF_IDCT_* below.
  885. * - encoding: set by user
  886. * - decoding: set by user
  887. */
  888. int idct_algo;
  889. #define FF_IDCT_AUTO 0
  890. #define FF_IDCT_INT 1
  891. #define FF_IDCT_SIMPLE 2
  892. #define FF_IDCT_SIMPLEMMX 3
  893. #define FF_IDCT_LIBMPEG2MMX 4
  894. #define FF_IDCT_PS2 5
  895. #define FF_IDCT_MLIB 6
  896. #define FF_IDCT_ARM 7
  897. #define FF_IDCT_ALTIVEC 8
  898. #define FF_IDCT_SH4 9
  899. #define FF_IDCT_SIMPLEARM 10
  900. /**
  901. * slice count.
  902. * - encoding: set by lavc
  903. * - decoding: set by user (or 0)
  904. */
  905. int slice_count;
  906. /**
  907. * slice offsets in the frame in bytes.
  908. * - encoding: set/allocated by lavc
  909. * - decoding: set/allocated by user (or NULL)
  910. */
  911. int *slice_offset;
  912. /**
  913. * error concealment flags.
  914. * - encoding: unused
  915. * - decoding: set by user
  916. */
  917. int error_concealment;
  918. #define FF_EC_GUESS_MVS 1
  919. #define FF_EC_DEBLOCK 2
  920. /**
  921. * dsp_mask could be add used to disable unwanted CPU features
  922. * CPU features (i.e. MMX, SSE. ...)
  923. *
  924. * with FORCE flag you may instead enable given CPU features
  925. * (Dangerous: usable in case of misdetection, improper usage however will
  926. * result into program crash)
  927. */
  928. unsigned dsp_mask;
  929. #define FF_MM_FORCE 0x80000000 /* force usage of selected flags (OR) */
  930. /* lower 16 bits - CPU features */
  931. #ifdef HAVE_MMX
  932. #define FF_MM_MMX 0x0001 /* standard MMX */
  933. #define FF_MM_3DNOW 0x0004 /* AMD 3DNOW */
  934. #define FF_MM_MMXEXT 0x0002 /* SSE integer functions or AMD MMX ext */
  935. #define FF_MM_SSE 0x0008 /* SSE functions */
  936. #define FF_MM_SSE2 0x0010 /* PIV SSE2 functions */
  937. #endif /* HAVE_MMX */
  938. /**
  939. * bits per sample/pixel from the demuxer (needed for huffyuv).
  940. * - encoding: set by lavc
  941. * - decoding: set by user
  942. */
  943. int bits_per_sample;
  944. /**
  945. * prediction method (needed for huffyuv).
  946. * - encoding: set by user
  947. * - decoding: unused
  948. */
  949. int prediction_method;
  950. #define FF_PRED_LEFT 0
  951. #define FF_PRED_PLANE 1
  952. #define FF_PRED_MEDIAN 2
  953. /**
  954. * sample aspect ratio (0 if unknown).
  955. * numerator and denominator must be relative prime and smaller then 256 for some video standards
  956. * - encoding: set by user.
  957. * - decoding: set by lavc.
  958. */
  959. AVRational sample_aspect_ratio;
  960. /**
  961. * the picture in the bitstream.
  962. * - encoding: set by lavc
  963. * - decoding: set by lavc
  964. */
  965. AVFrame *coded_frame;
  966. /**
  967. * debug.
  968. * - encoding: set by user.
  969. * - decoding: set by user.
  970. */
  971. int debug;
  972. #define FF_DEBUG_PICT_INFO 1
  973. #define FF_DEBUG_RC 2
  974. #define FF_DEBUG_BITSTREAM 4
  975. #define FF_DEBUG_MB_TYPE 8
  976. #define FF_DEBUG_QP 16
  977. #define FF_DEBUG_MV 32
  978. #define FF_DEBUG_VIS_MV 0x00000040
  979. #define FF_DEBUG_SKIP 0x00000080
  980. #define FF_DEBUG_STARTCODE 0x00000100
  981. #define FF_DEBUG_PTS 0x00000200
  982. #define FF_DEBUG_ER 0x00000400
  983. #define FF_DEBUG_MMCO 0x00000800
  984. #define FF_DEBUG_BUGS 0x00001000
  985. /**
  986. * error.
  987. * - encoding: set by lavc if flags&CODEC_FLAG_PSNR
  988. * - decoding: unused
  989. */
  990. uint64_t error[4];
  991. /**
  992. * minimum MB quantizer.
  993. * - encoding: set by user.
  994. * - decoding: unused
  995. */
  996. int mb_qmin;
  997. /**
  998. * maximum MB quantizer.
  999. * - encoding: set by user.
  1000. * - decoding: unused
  1001. */
  1002. int mb_qmax;
  1003. /**
  1004. * motion estimation compare function.
  1005. * - encoding: set by user.
  1006. * - decoding: unused
  1007. */
  1008. int me_cmp;
  1009. /**
  1010. * subpixel motion estimation compare function.
  1011. * - encoding: set by user.
  1012. * - decoding: unused
  1013. */
  1014. int me_sub_cmp;
  1015. /**
  1016. * macroblock compare function (not supported yet).
  1017. * - encoding: set by user.
  1018. * - decoding: unused
  1019. */
  1020. int mb_cmp;
  1021. #define FF_CMP_SAD 0
  1022. #define FF_CMP_SSE 1
  1023. #define FF_CMP_SATD 2
  1024. #define FF_CMP_DCT 3
  1025. #define FF_CMP_PSNR 4
  1026. #define FF_CMP_BIT 5
  1027. #define FF_CMP_RD 6
  1028. #define FF_CMP_ZERO 7
  1029. #define FF_CMP_CHROMA 256
  1030. /**
  1031. * ME diamond size & shape.
  1032. * - encoding: set by user.
  1033. * - decoding: unused
  1034. */
  1035. int dia_size;
  1036. /**
  1037. * amount of previous MV predictors (2a+1 x 2a+1 square).
  1038. * - encoding: set by user.
  1039. * - decoding: unused
  1040. */
  1041. int last_predictor_count;
  1042. /**
  1043. * pre pass for motion estimation.
  1044. * - encoding: set by user.
  1045. * - decoding: unused
  1046. */
  1047. int pre_me;
  1048. /**
  1049. * motion estimation pre pass compare function.
  1050. * - encoding: set by user.
  1051. * - decoding: unused
  1052. */
  1053. int me_pre_cmp;
  1054. /**
  1055. * ME pre pass diamond size & shape.
  1056. * - encoding: set by user.
  1057. * - decoding: unused
  1058. */
  1059. int pre_dia_size;
  1060. /**
  1061. * subpel ME quality.
  1062. * - encoding: set by user.
  1063. * - decoding: unused
  1064. */
  1065. int me_subpel_quality;
  1066. /**
  1067. * callback to negotiate the pixelFormat.
  1068. * @param fmt is the list of formats which are supported by the codec,
  1069. * its terminated by -1 as 0 is a valid format, the formats are ordered by quality
  1070. * the first is allways the native one
  1071. * @return the choosen format
  1072. * - encoding: unused
  1073. * - decoding: set by user, if not set then the native format will always be choosen
  1074. */
  1075. enum PixelFormat (*get_format)(struct AVCodecContext *s, enum PixelFormat * fmt);
  1076. /**
  1077. * DTG active format information (additionnal aspect ratio
  1078. * information only used in DVB MPEG2 transport streams). 0 if
  1079. * not set.
  1080. *
  1081. * - encoding: unused.
  1082. * - decoding: set by decoder
  1083. */
  1084. int dtg_active_format;
  1085. #define FF_DTG_AFD_SAME 8
  1086. #define FF_DTG_AFD_4_3 9
  1087. #define FF_DTG_AFD_16_9 10
  1088. #define FF_DTG_AFD_14_9 11
  1089. #define FF_DTG_AFD_4_3_SP_14_9 13
  1090. #define FF_DTG_AFD_16_9_SP_14_9 14
  1091. #define FF_DTG_AFD_SP_4_3 15
  1092. /**
  1093. * Maximum motion estimation search range in subpel units.
  1094. * if 0 then no limit
  1095. *
  1096. * - encoding: set by user.
  1097. * - decoding: unused.
  1098. */
  1099. int me_range;
  1100. /**
  1101. * frame_rate_base.
  1102. * for variable fps this is 1
  1103. * - encoding: set by user.
  1104. * - decoding: set by lavc.
  1105. * @todo move this after frame_rate
  1106. */
  1107. int frame_rate_base;
  1108. /**
  1109. * intra quantizer bias.
  1110. * - encoding: set by user.
  1111. * - decoding: unused
  1112. */
  1113. int intra_quant_bias;
  1114. #define FF_DEFAULT_QUANT_BIAS 999999
  1115. /**
  1116. * inter quantizer bias.
  1117. * - encoding: set by user.
  1118. * - decoding: unused
  1119. */
  1120. int inter_quant_bias;
  1121. /**
  1122. * color table ID.
  1123. * - encoding: unused.
  1124. * - decoding: which clrtable should be used for 8bit RGB images
  1125. * table have to be stored somewhere FIXME
  1126. */
  1127. int color_table_id;
  1128. /**
  1129. * internal_buffer count.
  1130. * Dont touch, used by lavc default_get_buffer()
  1131. */
  1132. int internal_buffer_count;
  1133. /**
  1134. * internal_buffers.
  1135. * Dont touch, used by lavc default_get_buffer()
  1136. */
  1137. void *internal_buffer;
  1138. #define FF_LAMBDA_SHIFT 7
  1139. #define FF_LAMBDA_SCALE (1<<FF_LAMBDA_SHIFT)
  1140. #define FF_QP2LAMBDA 118 ///< factor to convert from H.263 QP to lambda
  1141. #define FF_LAMBDA_MAX (256*128-1)
  1142. #define FF_QUALITY_SCALE FF_LAMBDA_SCALE //FIXME maybe remove
  1143. /**
  1144. * global quality for codecs which cannot change it per frame.
  1145. * this should be proportional to MPEG1/2/4 qscale.
  1146. * - encoding: set by user.
  1147. * - decoding: unused
  1148. */
  1149. int global_quality;
  1150. #define FF_CODER_TYPE_VLC 0
  1151. #define FF_CODER_TYPE_AC 1
  1152. /**
  1153. * coder type
  1154. * - encoding: set by user.
  1155. * - decoding: unused
  1156. */
  1157. int coder_type;
  1158. /**
  1159. * context model
  1160. * - encoding: set by user.
  1161. * - decoding: unused
  1162. */
  1163. int context_model;
  1164. /**
  1165. * slice flags
  1166. * - encoding: unused
  1167. * - decoding: set by user.
  1168. */
  1169. int slice_flags;
  1170. #define SLICE_FLAG_CODED_ORDER 0x0001 ///< draw_horiz_band() is called in coded order instead of display
  1171. #define SLICE_FLAG_ALLOW_FIELD 0x0002 ///< allow draw_horiz_band() with field slices (MPEG2 field pics)
  1172. #define SLICE_FLAG_ALLOW_PLANE 0x0004 ///< allow draw_horiz_band() with 1 component at a time (SVQ1)
  1173. /**
  1174. * XVideo Motion Acceleration
  1175. * - encoding: forbidden
  1176. * - decoding: set by decoder
  1177. */
  1178. int xvmc_acceleration;
  1179. /**
  1180. * macroblock decision mode
  1181. * - encoding: set by user.
  1182. * - decoding: unused
  1183. */
  1184. int mb_decision;
  1185. #define FF_MB_DECISION_SIMPLE 0 ///< uses mb_cmp
  1186. #define FF_MB_DECISION_BITS 1 ///< chooses the one which needs the fewest bits
  1187. #define FF_MB_DECISION_RD 2 ///< rate distoration
  1188. /**
  1189. * custom intra quantization matrix
  1190. * - encoding: set by user, can be NULL
  1191. * - decoding: set by lavc
  1192. */
  1193. uint16_t *intra_matrix;
  1194. /**
  1195. * custom inter quantization matrix
  1196. * - encoding: set by user, can be NULL
  1197. * - decoding: set by lavc
  1198. */
  1199. uint16_t *inter_matrix;
  1200. /**
  1201. * fourcc from the AVI stream header (LSB first, so "ABCD" -> ('D'<<24) + ('C'<<16) + ('B'<<8) + 'A').
  1202. * this is used to workaround some encoder bugs
  1203. * - encoding: unused
  1204. * - decoding: set by user, will be converted to upper case by lavc during init
  1205. */
  1206. unsigned int stream_codec_tag;
  1207. /**
  1208. * scene change detection threshold.
  1209. * 0 is default, larger means fewer detected scene changes
  1210. * - encoding: set by user.
  1211. * - decoding: unused
  1212. */
  1213. int scenechange_threshold;
  1214. /**
  1215. * minimum lagrange multipler
  1216. * - encoding: set by user.
  1217. * - decoding: unused
  1218. */
  1219. int lmin;
  1220. /**
  1221. * maximum lagrange multipler
  1222. * - encoding: set by user.
  1223. * - decoding: unused
  1224. */
  1225. int lmax;
  1226. /**
  1227. * Palette control structure
  1228. * - encoding: ??? (no palette-enabled encoder yet)
  1229. * - decoding: set by user.
  1230. */
  1231. struct AVPaletteControl *palctrl;
  1232. /**
  1233. * noise reduction strength
  1234. * - encoding: set by user.
  1235. * - decoding: unused
  1236. */
  1237. int noise_reduction;
  1238. /**
  1239. * Conditional replenishment support
  1240. * - encoding: unused
  1241. * - decoding: set by user, if 1 user can allocate reusable buffers
  1242. */
  1243. int cr_available;
  1244. } AVCodecContext;
  1245. /**
  1246. * AVOption.
  1247. */
  1248. typedef struct AVOption {
  1249. /** options' name */
  1250. const char *name; /* if name is NULL, it indicates a link to next */
  1251. /** short English text help or const struct AVOption* subpointer */
  1252. const char *help; // const struct AVOption* sub;
  1253. /** offset to context structure where the parsed value should be stored */
  1254. int offset;
  1255. /** options' type */
  1256. int type;
  1257. #define FF_OPT_TYPE_BOOL 1 ///< boolean - true,1,on (or simply presence)
  1258. #define FF_OPT_TYPE_DOUBLE 2 ///< double
  1259. #define FF_OPT_TYPE_INT 3 ///< integer
  1260. #define FF_OPT_TYPE_STRING 4 ///< string (finished with \0)
  1261. #define FF_OPT_TYPE_MASK 0x1f ///< mask for types - upper bits are various flags
  1262. //#define FF_OPT_TYPE_EXPERT 0x20 // flag for expert option
  1263. #define FF_OPT_TYPE_FLAG (FF_OPT_TYPE_BOOL | 0x40)
  1264. #define FF_OPT_TYPE_RCOVERRIDE (FF_OPT_TYPE_STRING | 0x80)
  1265. /** min value (min == max -> no limits) */
  1266. double min;
  1267. /** maximum value for double/int */
  1268. double max;
  1269. /** default boo [0,1]l/double/int value */
  1270. double defval;
  1271. /**
  1272. * default string value (with optional semicolon delimited extra option-list
  1273. * i.e. option1;option2;option3
  1274. * defval might select other then first argument as default
  1275. */
  1276. const char *defstr;
  1277. #define FF_OPT_MAX_DEPTH 10
  1278. } AVOption;
  1279. /**
  1280. * Parse option(s) and sets fields in passed structure
  1281. * @param strct structure where the parsed results will be written
  1282. * @param list list with AVOptions
  1283. * @param opts string with options for parsing
  1284. */
  1285. int avoption_parse(void* strct, const AVOption* list, const char* opts);
  1286. /**
  1287. * AVCodec.
  1288. */
  1289. typedef struct AVCodec {
  1290. const char *name;
  1291. enum CodecType type;
  1292. int id;
  1293. int priv_data_size;
  1294. int (*init)(AVCodecContext *);
  1295. int (*encode)(AVCodecContext *, uint8_t *buf, int buf_size, void *data);
  1296. int (*close)(AVCodecContext *);
  1297. int (*decode)(AVCodecContext *, void *outdata, int *outdata_size,
  1298. uint8_t *buf, int buf_size);
  1299. int capabilities;
  1300. const AVOption *options;
  1301. struct AVCodec *next;
  1302. void (*flush)(AVCodecContext *);
  1303. } AVCodec;
  1304. /**
  1305. * four components are given, that's all.
  1306. * the last component is alpha
  1307. */
  1308. typedef struct AVPicture {
  1309. uint8_t *data[4];
  1310. int linesize[4]; ///< number of bytes per line
  1311. } AVPicture;
  1312. /**
  1313. * AVPaletteControl
  1314. * This structure defines a method for communicating palette changes
  1315. * between and demuxer and a decoder.
  1316. */
  1317. #define AVPALETTE_SIZE 1024
  1318. #define AVPALETTE_COUNT 256
  1319. typedef struct AVPaletteControl {
  1320. /* demuxer sets this to 1 to indicate the palette has changed;
  1321. * decoder resets to 0 */
  1322. int palette_changed;
  1323. /* 4-byte ARGB palette entries, stored in native byte order; note that
  1324. * the individual palette components should be on a 8-bit scale; if
  1325. * the palette data comes from a IBM VGA native format, the component
  1326. * data is probably 6 bits in size and needs to be scaled */
  1327. unsigned int palette[AVPALETTE_COUNT];
  1328. } AVPaletteControl;
  1329. extern AVCodec ac3_encoder;
  1330. extern AVCodec mp2_encoder;
  1331. extern AVCodec mp3lame_encoder;
  1332. extern AVCodec oggvorbis_encoder;
  1333. extern AVCodec faac_encoder;
  1334. extern AVCodec mpeg1video_encoder;
  1335. extern AVCodec mpeg2video_encoder;
  1336. extern AVCodec h263_encoder;
  1337. extern AVCodec h263p_encoder;
  1338. extern AVCodec flv_encoder;
  1339. extern AVCodec rv10_encoder;
  1340. extern AVCodec mjpeg_encoder;
  1341. extern AVCodec ljpeg_encoder;
  1342. extern AVCodec mpeg4_encoder;
  1343. extern AVCodec msmpeg4v1_encoder;
  1344. extern AVCodec msmpeg4v2_encoder;
  1345. extern AVCodec msmpeg4v3_encoder;
  1346. extern AVCodec wmv1_encoder;
  1347. extern AVCodec wmv2_encoder;
  1348. extern AVCodec huffyuv_encoder;
  1349. extern AVCodec h264_encoder;
  1350. extern AVCodec asv1_encoder;
  1351. extern AVCodec asv2_encoder;
  1352. extern AVCodec vcr1_encoder;
  1353. extern AVCodec ffv1_encoder;
  1354. extern AVCodec mdec_encoder;
  1355. extern AVCodec h263_decoder;
  1356. extern AVCodec mpeg4_decoder;
  1357. extern AVCodec msmpeg4v1_decoder;
  1358. extern AVCodec msmpeg4v2_decoder;
  1359. extern AVCodec msmpeg4v3_decoder;
  1360. extern AVCodec wmv1_decoder;
  1361. extern AVCodec wmv2_decoder;
  1362. extern AVCodec mpeg1video_decoder;
  1363. extern AVCodec mpeg2video_decoder;
  1364. extern AVCodec mpegvideo_decoder;
  1365. extern AVCodec mpeg_xvmc_decoder;
  1366. extern AVCodec h263i_decoder;
  1367. extern AVCodec flv_decoder;
  1368. extern AVCodec rv10_decoder;
  1369. extern AVCodec svq1_decoder;
  1370. extern AVCodec svq3_decoder;
  1371. extern AVCodec dvvideo_decoder;
  1372. extern AVCodec wmav1_decoder;
  1373. extern AVCodec wmav2_decoder;
  1374. extern AVCodec mjpeg_decoder;
  1375. extern AVCodec mjpegb_decoder;
  1376. extern AVCodec sp5x_decoder;
  1377. extern AVCodec mp2_decoder;
  1378. extern AVCodec mp3_decoder;
  1379. extern AVCodec mace3_decoder;
  1380. extern AVCodec mace6_decoder;
  1381. extern AVCodec huffyuv_decoder;
  1382. extern AVCodec oggvorbis_decoder;
  1383. extern AVCodec cyuv_decoder;
  1384. extern AVCodec h264_decoder;
  1385. extern AVCodec indeo3_decoder;
  1386. extern AVCodec vp3_decoder;
  1387. extern AVCodec theora_decoder;
  1388. extern AVCodec amr_nb_decoder;
  1389. extern AVCodec amr_nb_encoder;
  1390. extern AVCodec amr_wb_encoder;
  1391. extern AVCodec amr_wb_decoder;
  1392. extern AVCodec aac_decoder;
  1393. extern AVCodec mpeg4aac_decoder;
  1394. extern AVCodec asv1_decoder;
  1395. extern AVCodec asv2_decoder;
  1396. extern AVCodec vcr1_decoder;
  1397. extern AVCodec cljr_decoder;
  1398. extern AVCodec ffv1_decoder;
  1399. extern AVCodec fourxm_decoder;
  1400. extern AVCodec mdec_decoder;
  1401. extern AVCodec roq_decoder;
  1402. extern AVCodec interplay_video_decoder;
  1403. extern AVCodec xan_wc3_decoder;
  1404. extern AVCodec rpza_decoder;
  1405. extern AVCodec cinepak_decoder;
  1406. extern AVCodec msrle_decoder;
  1407. extern AVCodec msvideo1_decoder;
  1408. extern AVCodec vqa_decoder;
  1409. extern AVCodec idcin_decoder;
  1410. extern AVCodec eightbps_decoder;
  1411. extern AVCodec smc_decoder;
  1412. extern AVCodec ra_144_decoder;
  1413. extern AVCodec ra_288_decoder;
  1414. extern AVCodec roq_dpcm_decoder;
  1415. extern AVCodec interplay_dpcm_decoder;
  1416. extern AVCodec xan_dpcm_decoder;
  1417. /* pcm codecs */
  1418. #define PCM_CODEC(id, name) \
  1419. extern AVCodec name ## _decoder; \
  1420. extern AVCodec name ## _encoder
  1421. PCM_CODEC(CODEC_ID_PCM_S16LE, pcm_s16le);
  1422. PCM_CODEC(CODEC_ID_PCM_S16BE, pcm_s16be);
  1423. PCM_CODEC(CODEC_ID_PCM_U16LE, pcm_u16le);
  1424. PCM_CODEC(CODEC_ID_PCM_U16BE, pcm_u16be);
  1425. PCM_CODEC(CODEC_ID_PCM_S8, pcm_s8);
  1426. PCM_CODEC(CODEC_ID_PCM_U8, pcm_u8);
  1427. PCM_CODEC(CODEC_ID_PCM_ALAW, pcm_alaw);
  1428. PCM_CODEC(CODEC_ID_PCM_MULAW, pcm_mulaw);
  1429. /* adpcm codecs */
  1430. PCM_CODEC(CODEC_ID_ADPCM_IMA_QT, adpcm_ima_qt);
  1431. PCM_CODEC(CODEC_ID_ADPCM_IMA_WAV, adpcm_ima_wav);
  1432. PCM_CODEC(CODEC_ID_ADPCM_IMA_DK3, adpcm_ima_dk3);
  1433. PCM_CODEC(CODEC_ID_ADPCM_IMA_DK4, adpcm_ima_dk4);
  1434. PCM_CODEC(CODEC_ID_ADPCM_IMA_WS, adpcm_ima_ws);
  1435. PCM_CODEC(CODEC_ID_ADPCM_MS, adpcm_ms);
  1436. PCM_CODEC(CODEC_ID_ADPCM_4XM, adpcm_4xm);
  1437. PCM_CODEC(CODEC_ID_ADPCM_XA, adpcm_xa);
  1438. PCM_CODEC(CODEC_ID_ADPCM_ADX, adpcm_adx);
  1439. #undef PCM_CODEC
  1440. /* dummy raw video codec */
  1441. extern AVCodec rawvideo_encoder;
  1442. extern AVCodec rawvideo_decoder;
  1443. /* the following codecs use external GPL libs */
  1444. extern AVCodec ac3_decoder;
  1445. /* resample.c */
  1446. struct ReSampleContext;
  1447. typedef struct ReSampleContext ReSampleContext;
  1448. ReSampleContext *audio_resample_init(int output_channels, int input_channels,
  1449. int output_rate, int input_rate);
  1450. int audio_resample(ReSampleContext *s, short *output, short *input, int nb_samples);
  1451. void audio_resample_close(ReSampleContext *s);
  1452. /* YUV420 format is assumed ! */
  1453. struct ImgReSampleContext;
  1454. typedef struct ImgReSampleContext ImgReSampleContext;
  1455. ImgReSampleContext *img_resample_init(int output_width, int output_height,
  1456. int input_width, int input_height);
  1457. ImgReSampleContext *img_resample_full_init(int owidth, int oheight,
  1458. int iwidth, int iheight,
  1459. int topBand, int bottomBand,
  1460. int leftBand, int rightBand);
  1461. void img_resample(ImgReSampleContext *s,
  1462. AVPicture *output, const AVPicture *input);
  1463. void img_resample_close(ImgReSampleContext *s);
  1464. /**
  1465. * Allocate memory for a picture. Call avpicture_free to free it.
  1466. *
  1467. * @param picture the picture to be filled in.
  1468. * @param pix_fmt the format of the picture.
  1469. * @param width the width of the picture.
  1470. * @param height the height of the picture.
  1471. * @return 0 if successful, -1 if not.
  1472. */
  1473. int avpicture_alloc(AVPicture *picture, int pix_fmt, int width, int height);
  1474. /* Free a picture previously allocated by avpicture_alloc. */
  1475. void avpicture_free(AVPicture *picture);
  1476. int avpicture_fill(AVPicture *picture, uint8_t *ptr,
  1477. int pix_fmt, int width, int height);
  1478. int avpicture_layout(const AVPicture* src, int pix_fmt, int width, int height,
  1479. unsigned char *dest, int dest_size);
  1480. int avpicture_get_size(int pix_fmt, int width, int height);
  1481. void avcodec_get_chroma_sub_sample(int pix_fmt, int *h_shift, int *v_shift);
  1482. const char *avcodec_get_pix_fmt_name(int pix_fmt);
  1483. enum PixelFormat avcodec_get_pix_fmt(const char* name);
  1484. #define FF_LOSS_RESOLUTION 0x0001 /* loss due to resolution change */
  1485. #define FF_LOSS_DEPTH 0x0002 /* loss due to color depth change */
  1486. #define FF_LOSS_COLORSPACE 0x0004 /* loss due to color space conversion */
  1487. #define FF_LOSS_ALPHA 0x0008 /* loss of alpha bits */
  1488. #define FF_LOSS_COLORQUANT 0x0010 /* loss due to color quantization */
  1489. #define FF_LOSS_CHROMA 0x0020 /* loss of chroma (e.g. rgb to gray conversion) */
  1490. int avcodec_get_pix_fmt_loss(int dst_pix_fmt, int src_pix_fmt,
  1491. int has_alpha);
  1492. int avcodec_find_best_pix_fmt(int pix_fmt_mask, int src_pix_fmt,
  1493. int has_alpha, int *loss_ptr);
  1494. #define FF_ALPHA_TRANSP 0x0001 /* image has some totally transparent pixels */
  1495. #define FF_ALPHA_SEMI_TRANSP 0x0002 /* image has some transparent pixels */
  1496. int img_get_alpha_info(const AVPicture *src,
  1497. int pix_fmt, int width, int height);
  1498. /* convert among pixel formats */
  1499. int img_convert(AVPicture *dst, int dst_pix_fmt,
  1500. const AVPicture *src, int pix_fmt,
  1501. int width, int height);
  1502. /* deinterlace a picture */
  1503. int avpicture_deinterlace(AVPicture *dst, const AVPicture *src,
  1504. int pix_fmt, int width, int height);
  1505. /* external high level API */
  1506. extern AVCodec *first_avcodec;
  1507. /* returns LIBAVCODEC_VERSION_INT constant */
  1508. unsigned avcodec_version(void);
  1509. /* returns LIBAVCODEC_BUILD constant */
  1510. unsigned avcodec_build(void);
  1511. void avcodec_init(void);
  1512. void register_avcodec(AVCodec *format);
  1513. AVCodec *avcodec_find_encoder(enum CodecID id);
  1514. AVCodec *avcodec_find_encoder_by_name(const char *name);
  1515. AVCodec *avcodec_find_decoder(enum CodecID id);
  1516. AVCodec *avcodec_find_decoder_by_name(const char *name);
  1517. void avcodec_string(char *buf, int buf_size, AVCodecContext *enc, int encode);
  1518. void avcodec_get_context_defaults(AVCodecContext *s);
  1519. AVCodecContext *avcodec_alloc_context(void);
  1520. AVFrame *avcodec_alloc_frame(void);
  1521. int avcodec_default_get_buffer(AVCodecContext *s, AVFrame *pic);
  1522. void avcodec_default_release_buffer(AVCodecContext *s, AVFrame *pic);
  1523. void avcodec_default_free_buffers(AVCodecContext *s);
  1524. /**
  1525. * opens / inits the AVCodecContext.
  1526. * not thread save!
  1527. */
  1528. int avcodec_open(AVCodecContext *avctx, AVCodec *codec);
  1529. int avcodec_decode_audio(AVCodecContext *avctx, int16_t *samples,
  1530. int *frame_size_ptr,
  1531. uint8_t *buf, int buf_size);
  1532. int avcodec_decode_video(AVCodecContext *avctx, AVFrame *picture,
  1533. int *got_picture_ptr,
  1534. uint8_t *buf, int buf_size);
  1535. int avcodec_parse_frame(AVCodecContext *avctx, uint8_t **pdata,
  1536. int *data_size_ptr,
  1537. uint8_t *buf, int buf_size);
  1538. int avcodec_encode_audio(AVCodecContext *avctx, uint8_t *buf, int buf_size,
  1539. const short *samples);
  1540. int avcodec_encode_video(AVCodecContext *avctx, uint8_t *buf, int buf_size,
  1541. const AVFrame *pict);
  1542. int avcodec_close(AVCodecContext *avctx);
  1543. void avcodec_register_all(void);
  1544. void avcodec_flush_buffers(AVCodecContext *avctx);
  1545. /* misc usefull functions */
  1546. /**
  1547. * returns a single letter to describe the picture type
  1548. */
  1549. char av_get_pict_type_char(int pict_type);
  1550. /**
  1551. * reduce a fraction.
  1552. * this is usefull for framerate calculations
  1553. * @param max the maximum allowed for dst_nom & dst_den
  1554. * @return 1 if exact, 0 otherwise
  1555. */
  1556. int av_reduce(int *dst_nom, int *dst_den, int64_t nom, int64_t den, int64_t max);
  1557. /**
  1558. * rescale a 64bit integer.
  1559. * a simple a*b/c isnt possible as it can overflow
  1560. */
  1561. int64_t av_rescale(int64_t a, int b, int c);
  1562. /**
  1563. * Interface for 0.5.0 version
  1564. *
  1565. * do not even think about it's usage for this moment
  1566. */
  1567. typedef struct {
  1568. /// compressed size used from given memory buffer
  1569. int size;
  1570. /// I/P/B frame type
  1571. int frame_type;
  1572. } avc_enc_result_t;
  1573. /**
  1574. * Commands
  1575. * order can't be changed - once it was defined
  1576. */
  1577. typedef enum {
  1578. // general commands
  1579. AVC_OPEN_BY_NAME = 0xACA000,
  1580. AVC_OPEN_BY_CODEC_ID,
  1581. AVC_OPEN_BY_FOURCC,
  1582. AVC_CLOSE,
  1583. AVC_FLUSH,
  1584. // pin - struct { uint8_t* src, uint_t src_size }
  1585. // pout - struct { AVPicture* img, consumed_bytes,
  1586. AVC_DECODE,
  1587. // pin - struct { AVPicture* img, uint8_t* dest, uint_t dest_size }
  1588. // pout - uint_t used_from_dest_size
  1589. AVC_ENCODE,
  1590. // query/get video commands
  1591. AVC_GET_VERSION = 0xACB000,
  1592. AVC_GET_WIDTH,
  1593. AVC_GET_HEIGHT,
  1594. AVC_GET_DELAY,
  1595. AVC_GET_QUANT_TABLE,
  1596. // ...
  1597. // query/get audio commands
  1598. AVC_GET_FRAME_SIZE = 0xABC000,
  1599. // maybe define some simple structure which
  1600. // might be passed to the user - but they can't
  1601. // contain any codec specific parts and these
  1602. // calls are usualy necessary only few times
  1603. // set video commands
  1604. AVC_SET_WIDTH = 0xACD000,
  1605. AVC_SET_HEIGHT,
  1606. // set video encoding commands
  1607. AVC_SET_FRAME_RATE = 0xACD800,
  1608. AVC_SET_QUALITY,
  1609. AVC_SET_HURRY_UP,
  1610. // set audio commands
  1611. AVC_SET_SAMPLE_RATE = 0xACE000,
  1612. AVC_SET_CHANNELS,
  1613. } avc_cmd_t;
  1614. /**
  1615. * \param handle allocated private structure by libavcodec
  1616. * for initialization pass NULL - will be returned pout
  1617. * user is supposed to know nothing about its structure
  1618. * \param cmd type of operation to be performed
  1619. * \param pint input parameter
  1620. * \param pout output parameter
  1621. *
  1622. * \returns command status - eventually for query command it might return
  1623. * integer resulting value
  1624. */
  1625. int avcodec(void* handle, avc_cmd_t cmd, void* pin, void* pout);
  1626. /* frame parsing */
  1627. typedef struct AVCodecParserContext {
  1628. void *priv_data;
  1629. struct AVCodecParser *parser;
  1630. int64_t frame_offset; /* offset of the current frame */
  1631. int64_t cur_offset; /* current offset
  1632. (incremented by each av_parser_parse()) */
  1633. int64_t last_frame_offset; /* offset of the last frame */
  1634. /* video info */
  1635. int pict_type; /* XXX: put it back in AVCodecContext */
  1636. int repeat_pict; /* XXX: put it back in AVCodecContext */
  1637. int64_t pts; /* in us, if given by the codec (used by raw mpeg4) */
  1638. int64_t dts; /* in us, if given by the codec (used by raw mpeg4) */
  1639. } AVCodecParserContext;
  1640. typedef struct AVCodecParser {
  1641. int codec_ids[3]; /* several codec IDs are permitted */
  1642. int priv_data_size;
  1643. int (*parser_init)(AVCodecParserContext *s);
  1644. int (*parser_parse)(AVCodecParserContext *s,
  1645. AVCodecContext *avctx,
  1646. uint8_t **poutbuf, int *poutbuf_size,
  1647. const uint8_t *buf, int buf_size);
  1648. void (*parser_close)(AVCodecParserContext *s);
  1649. struct AVCodecParser *next;
  1650. } AVCodecParser;
  1651. extern AVCodecParser *av_first_parser;
  1652. void av_register_codec_parser(AVCodecParser *parser);
  1653. AVCodecParserContext *av_parser_init(int codec_id);
  1654. int av_parser_parse(AVCodecParserContext *s,
  1655. AVCodecContext *avctx,
  1656. uint8_t **poutbuf, int *poutbuf_size,
  1657. const uint8_t *buf, int buf_size);
  1658. void av_parser_close(AVCodecParserContext *s);
  1659. extern AVCodecParser mpegvideo_parser;
  1660. extern AVCodecParser mpeg4video_parser;
  1661. extern AVCodecParser h263_parser;
  1662. extern AVCodecParser h264_parser;
  1663. extern AVCodecParser mpegaudio_parser;
  1664. extern AVCodecParser ac3_parser;
  1665. /* memory */
  1666. void *av_malloc(unsigned int size);
  1667. void *av_mallocz(unsigned int size);
  1668. void *av_realloc(void *ptr, unsigned int size);
  1669. void av_free(void *ptr);
  1670. char *av_strdup(const char *s);
  1671. void __av_freep(void **ptr);
  1672. #define av_freep(p) __av_freep((void **)(p))
  1673. void *av_fast_realloc(void *ptr, unsigned int *size, unsigned int min_size);
  1674. /* for static data only */
  1675. /* call av_free_static to release all staticaly allocated tables */
  1676. void av_free_static(void);
  1677. void *__av_mallocz_static(void** location, unsigned int size);
  1678. #define av_mallocz_static(p, s) __av_mallocz_static((void **)(p), s)
  1679. /* add by bero : in adx.c */
  1680. int is_adx(const unsigned char *buf,size_t bufsize);
  1681. /* av_log API */
  1682. #include <stdarg.h>
  1683. #define AV_LOG_ERROR 0
  1684. #define AV_LOG_INFO 1
  1685. #define AV_LOG_DEBUG 2
  1686. extern void av_log(AVCodecContext*, int level, const char *fmt, ...) __attribute__ ((__format__ (__printf__, 3, 4)));
  1687. extern void av_vlog(AVCodecContext*, int level, const char *fmt, va_list);
  1688. extern int av_log_get_level(void);
  1689. extern void av_log_set_level(int);
  1690. extern void av_log_set_callback(void (*)(AVCodecContext*, int, const char*, va_list));
  1691. #undef AV_LOG_TRAP_PRINTF
  1692. #ifdef AV_LOG_TRAP_PRINTF
  1693. #define printf DO NOT USE
  1694. #define fprintf DO NOT USE
  1695. #undef stderr
  1696. #define stderr DO NOT USE
  1697. #endif
  1698. #ifdef __cplusplus
  1699. }
  1700. #endif
  1701. #endif /* AVCODEC_H */