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.

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