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.

1947 lines
57KB

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