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.

1388 lines
39KB

  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. #define LIBAVCODEC_VERSION_INT 0x000406
  12. #define LIBAVCODEC_VERSION "0.4.6"
  13. #define LIBAVCODEC_BUILD 4662
  14. #define LIBAVCODEC_BUILD_STR "4662"
  15. #define LIBAVCODEC_IDENT "FFmpeg" LIBAVCODEC_VERSION "b" LIBAVCODEC_BUILD_STR
  16. enum CodecID {
  17. CODEC_ID_NONE,
  18. CODEC_ID_MPEG1VIDEO,
  19. CODEC_ID_H263,
  20. CODEC_ID_RV10,
  21. CODEC_ID_MP2,
  22. CODEC_ID_MP3LAME,
  23. CODEC_ID_VORBIS,
  24. CODEC_ID_AC3,
  25. CODEC_ID_MJPEG,
  26. CODEC_ID_MJPEGB,
  27. CODEC_ID_MPEG4,
  28. CODEC_ID_RAWVIDEO,
  29. CODEC_ID_MSMPEG4V1,
  30. CODEC_ID_MSMPEG4V2,
  31. CODEC_ID_MSMPEG4V3,
  32. CODEC_ID_WMV1,
  33. CODEC_ID_WMV2,
  34. CODEC_ID_H263P,
  35. CODEC_ID_H263I,
  36. CODEC_ID_SVQ1,
  37. CODEC_ID_DVVIDEO,
  38. CODEC_ID_DVAUDIO,
  39. CODEC_ID_WMAV1,
  40. CODEC_ID_WMAV2,
  41. CODEC_ID_MACE3,
  42. CODEC_ID_MACE6,
  43. CODEC_ID_HUFFYUV,
  44. CODEC_ID_CYUV,
  45. /* various pcm "codecs" */
  46. CODEC_ID_PCM_S16LE,
  47. CODEC_ID_PCM_S16BE,
  48. CODEC_ID_PCM_U16LE,
  49. CODEC_ID_PCM_U16BE,
  50. CODEC_ID_PCM_S8,
  51. CODEC_ID_PCM_U8,
  52. CODEC_ID_PCM_MULAW,
  53. CODEC_ID_PCM_ALAW,
  54. /* various adpcm codecs */
  55. CODEC_ID_ADPCM_IMA_QT,
  56. CODEC_ID_ADPCM_IMA_WAV,
  57. CODEC_ID_ADPCM_MS,
  58. };
  59. enum CodecType {
  60. CODEC_TYPE_UNKNOWN = -1,
  61. CODEC_TYPE_VIDEO,
  62. CODEC_TYPE_AUDIO,
  63. };
  64. /**
  65. * Pixel format.
  66. */
  67. enum PixelFormat {
  68. PIX_FMT_YUV420P,
  69. PIX_FMT_YUV422,
  70. PIX_FMT_RGB24, ///< 3 bytes, R is first
  71. PIX_FMT_BGR24, ///< 3 bytes, B is first
  72. PIX_FMT_YUV422P,
  73. PIX_FMT_YUV444P,
  74. PIX_FMT_RGBA32, ///< always stored in cpu endianness
  75. PIX_FMT_YUV410P,
  76. PIX_FMT_YUV411P,
  77. PIX_FMT_RGB565, ///< always stored in cpu endianness
  78. PIX_FMT_RGB555, ///< always stored in cpu endianness, most significant bit to 1
  79. PIX_FMT_GRAY8,
  80. PIX_FMT_MONOWHITE, ///< 0 is white
  81. PIX_FMT_MONOBLACK, ///< 0 is black
  82. PIX_FMT_PAL8, ///< 8 bit with RGBA palette
  83. PIX_FMT_NB,
  84. };
  85. /* currently unused, may be used if 24/32 bits samples ever supported */
  86. enum SampleFormat {
  87. SAMPLE_FMT_S16 = 0, ///< signed 16 bits
  88. };
  89. /* in bytes */
  90. #define AVCODEC_MAX_AUDIO_FRAME_SIZE 131072
  91. /**
  92. * Required number of zero bytes at the end of the input bitstream for decoding.
  93. * to avoid overreading (and possibly segfaulting)
  94. */
  95. #define FF_INPUT_BUFFER_PADDING_SIZE 8
  96. /* motion estimation type, EPZS by default */
  97. enum Motion_Est_ID {
  98. ME_ZERO = 1,
  99. ME_FULL,
  100. ME_LOG,
  101. ME_PHODS,
  102. ME_EPZS,
  103. ME_X1
  104. };
  105. typedef struct RcOverride{
  106. int start_frame;
  107. int end_frame;
  108. int qscale; // if this is 0 then quality_factor will be used instead
  109. float quality_factor;
  110. } RcOverride;
  111. /* only for ME compatiblity with old apps */
  112. extern int motion_estimation_method;
  113. /* ME algos sorted by quality */
  114. static const int Motion_Est_QTab[] = { ME_ZERO, ME_PHODS, ME_LOG,
  115. ME_X1, ME_EPZS, ME_FULL };
  116. #define FF_MAX_B_FRAMES 8
  117. /* encoding support
  118. these flags can be passed in AVCodecContext.flags before initing
  119. Note: note not everything is supported yet
  120. */
  121. #define CODEC_FLAG_HQ 0x0001 ///< brute force MB-type decission mode (slow)
  122. #define CODEC_FLAG_QSCALE 0x0002 ///< use fixed qscale
  123. #define CODEC_FLAG_4MV 0x0004 ///< 4 MV per MB allowed
  124. #define CODEC_FLAG_QPEL 0x0010 ///< use qpel MC
  125. #define CODEC_FLAG_GMC 0x0020 ///< use GMC
  126. #define CODEC_FLAG_PART 0x0080 ///< use data partitioning
  127. /* parent program gurantees that the input for b-frame containing streams is not written to
  128. for at least s->max_b_frames+1 frames, if this is not set than the input will be copied */
  129. #define CODEC_FLAG_INPUT_PRESERVED 0x0100
  130. #define CODEC_FLAG_PASS1 0x0200 ///< use internal 2pass ratecontrol in first pass mode
  131. #define CODEC_FLAG_PASS2 0x0400 ///< use internal 2pass ratecontrol in second pass mode
  132. #define CODEC_FLAG_EXTERN_HUFF 0x1000 ///< use external huffman table (for mjpeg)
  133. #define CODEC_FLAG_GRAY 0x2000 ///< only decode/encode grayscale
  134. #define CODEC_FLAG_EMU_EDGE 0x4000///< dont draw edges
  135. #define CODEC_FLAG_PSNR 0x8000 ///< error[?] variables will be set during encoding
  136. #define CODEC_FLAG_TRUNCATED 0x00010000 /** input bitstream might be truncated at a random location instead
  137. of only at frame boundaries */
  138. #define CODEC_FLAG_NORMALIZE_AQP 0x00020000 ///< normalize adaptive quantization
  139. #define CODEC_FLAG_INTERLACED_DCT 0x00040000 ///< use interlaced dct
  140. #define CODEC_FLAG_LOW_DELAY 0x00080000 ///< force low delay / will fail on b frames
  141. #define CODEC_FLAG_ALT_SCAN 0x00100000 ///< use alternate scan
  142. #define CODEC_FLAG_TRELLIS_QUANT 0x00200000 ///< use trellis quantization
  143. #define CODEC_FLAG_GLOBAL_HEADER 0x00400000 ///< place global headers in extradata instead of every keyframe
  144. #define CODEC_FLAG_BITEXACT 0x00800000 ///< use only bitexact stuff (except (i)dct)
  145. /* Fx : Flag for h263+ extra options */
  146. #define CODEC_FLAG_H263P_AIC 0x01000000 ///< Advanced intra coding
  147. #define CODEC_FLAG_H263P_UMV 0x02000000 ///< Unlimited motion vector
  148. /* For advanced prediction mode, we reuse the 4MV flag */
  149. /* Unsupported options :
  150. * Syntax Arithmetic coding (SAC)
  151. * Deblocking filter internal loop
  152. * Slice structured
  153. * Reference Picture Selection
  154. * Independant Segment Decoding
  155. * Alternative Inter * VLC
  156. * Modified Quantization */
  157. /* /Fx */
  158. /* codec capabilities */
  159. #define CODEC_CAP_DRAW_HORIZ_BAND 0x0001 ///< decoder can use draw_horiz_band callback
  160. #define CODEC_CAP_DR1 0x0002 ///< direct rendering method 1
  161. /* if 'parse_only' field is true, then avcodec_parse_frame() can be
  162. used */
  163. #define CODEC_CAP_PARSE_ONLY 0x0004
  164. #define CODEC_CAP_TRUNCATED 0x0008
  165. #define FF_COMMON_FRAME \
  166. /**\
  167. * pointer to the picture planes.\
  168. * this might be different from the first allocated byte\
  169. * - encoding: \
  170. * - decoding: \
  171. */\
  172. uint8_t *data[4];\
  173. int linesize[4];\
  174. /**\
  175. * pointer to the first allocated byte of the picture. can be used in get_buffer/release_buffer\
  176. * this isnt used by lavc unless the default get/release_buffer() is used\
  177. * - encoding: \
  178. * - decoding: \
  179. */\
  180. uint8_t *base[4];\
  181. /**\
  182. * 1 -> keyframe, 0-> not\
  183. * - encoding: set by lavc\
  184. * - decoding: set by lavc\
  185. */\
  186. int key_frame;\
  187. \
  188. /**\
  189. * picture type of the frame, see ?_TYPE below\
  190. * - encoding: set by lavc for coded_picture (and set by user for input)\
  191. * - decoding: set by lavc\
  192. */\
  193. int pict_type;\
  194. \
  195. /**\
  196. * presentation timestamp in micro seconds (time when frame should be shown to user)\
  197. * if 0 then the frame_rate will be used as reference\
  198. * - encoding: MUST be set by user\
  199. * - decoding: set by lavc\
  200. */\
  201. long long int pts;\
  202. \
  203. /**\
  204. * picture number in bitstream order.\
  205. * - encoding: set by\
  206. * - decoding: set by lavc\
  207. */\
  208. int coded_picture_number;\
  209. /**\
  210. * picture number in display order.\
  211. * - encoding: set by\
  212. * - decoding: set by lavc\
  213. */\
  214. int display_picture_number;\
  215. \
  216. /**\
  217. * quality (between 1 (good) and 31 (bad)) \
  218. * - encoding: set by lavc for coded_picture (and set by user for input)\
  219. * - decoding: set by lavc\
  220. */\
  221. float quality; \
  222. \
  223. /**\
  224. * buffer age (1->was last buffer and dint change, 2->..., ...).\
  225. * set to something large if the buffer has not been used yet \
  226. * - encoding: unused\
  227. * - decoding: MUST be set by get_buffer()\
  228. */\
  229. int age;\
  230. \
  231. /**\
  232. * is this picture used as reference\
  233. * - encoding: unused\
  234. * - decoding: set by lavc (before get_buffer() call))\
  235. */\
  236. int reference;\
  237. \
  238. /**\
  239. * QP table\
  240. * - encoding: unused\
  241. * - decoding: set by lavc\
  242. */\
  243. int8_t *qscale_table;\
  244. /**\
  245. * QP store stride\
  246. * - encoding: unused\
  247. * - decoding: set by lavc\
  248. */\
  249. int qstride;\
  250. \
  251. /**\
  252. * mbskip_table[mb]>=1 if MB didnt change\
  253. * stride= mb_width = (width+15)>>4\
  254. * - encoding: unused\
  255. * - decoding: set by lavc\
  256. */\
  257. uint8_t *mbskip_table;\
  258. \
  259. /**\
  260. * for some private data of the user\
  261. * - encoding: unused\
  262. * - decoding: set by user\
  263. */\
  264. void *opaque;\
  265. \
  266. /**\
  267. * error\
  268. * - encoding: set by lavc if flags&CODEC_FLAG_PSNR\
  269. * - decoding: unused\
  270. */\
  271. uint64_t error[4];\
  272. \
  273. /**\
  274. * type of the buffer (to keep track of who has to dealloc data[*])\
  275. * - encoding: set by the one who allocs it\
  276. * - decoding: set by the one who allocs it\
  277. * Note: user allocated (direct rendering) & internal buffers can not coexist currently\
  278. */\
  279. int type;\
  280. \
  281. /**\
  282. * when decoding, this signal how much the picture must be delayed.\
  283. * extra_delay = repeat_pict / (2*fps)\
  284. * - encoding: unused\
  285. * - decoding: set by lavc\
  286. */\
  287. int repeat_pict;
  288. #define FF_BUFFER_TYPE_INTERNAL 1
  289. #define FF_BUFFER_TYPE_USER 2 ///< Direct rendering buffers
  290. #define FF_BUFFER_TYPE_SHARED 4 ///< buffer from somewher else, dont dealloc
  291. #define FF_I_TYPE 1 // Intra
  292. #define FF_P_TYPE 2 // Predicted
  293. #define FF_B_TYPE 3 // Bi-dir predicted
  294. #define FF_S_TYPE 4 // S(GMC)-VOP MPEG4
  295. typedef struct AVFrame {
  296. FF_COMMON_FRAME
  297. } AVFrame;
  298. #define DEFAULT_FRAME_RATE_BASE 1001000
  299. /**
  300. * main external api structure.
  301. */
  302. typedef struct AVCodecContext {
  303. /**
  304. * the average bitrate.
  305. * - encoding: set by user. unused for constant quantizer encoding
  306. * - decoding: set by lavc. 0 or some bitrate if this info is available in the stream
  307. */
  308. int bit_rate;
  309. /**
  310. * number of bits the bitstream is allowed to diverge from the reference.
  311. * the reference can be CBR (for CBR pass1) or VBR (for pass2)
  312. * - encoding: set by user. unused for constant quantizer encoding
  313. * - decoding: unused
  314. */
  315. int bit_rate_tolerance;
  316. /**
  317. * CODEC_FLAG_*.
  318. * - encoding: set by user.
  319. * - decoding: set by user.
  320. */
  321. int flags;
  322. /**
  323. * some codecs needs additionnal format info. It is stored here
  324. * - encoding: set by user.
  325. * - decoding: set by lavc. (FIXME is this ok?)
  326. */
  327. int sub_id;
  328. /**
  329. * motion estimation algorithm used for video coding.
  330. * - encoding: MUST be set by user.
  331. * - decoding: unused
  332. */
  333. int me_method;
  334. /**
  335. * some codecs need / can use extra-data like huffman tables.
  336. * mjpeg: huffman tables
  337. * rv10: additional flags
  338. * mpeg4: global headers (they can be in the bitstream or here)
  339. * - encoding: set/allocated/freed by lavc.
  340. * - decoding: set/allocated/freed by user.
  341. */
  342. void *extradata;
  343. int extradata_size;
  344. /* video only */
  345. /**
  346. * frames per sec multiplied by frame_rate_base.
  347. * for variable fps this is the precission, so if the timestamps
  348. * can be specified in msec precssion then this is 1000*frame_rate_base
  349. * - encoding: MUST be set by user
  350. * - decoding: set by lavc. 0 or the frame_rate if available
  351. */
  352. int frame_rate;
  353. /**
  354. * frame_rate_base.
  355. * for variable fps this is 1
  356. * - encoding: set by user.
  357. * - decoding: set by lavc.
  358. */
  359. int frame_rate_base;
  360. /**
  361. * width / height.
  362. * - encoding: MUST be set by user.
  363. * - decoding: set by user, some codecs might override / change it during playback
  364. */
  365. int width, height;
  366. #define FF_ASPECT_SQUARE 1
  367. #define FF_ASPECT_4_3_625 2
  368. #define FF_ASPECT_4_3_525 3
  369. #define FF_ASPECT_16_9_625 4
  370. #define FF_ASPECT_16_9_525 5
  371. #define FF_ASPECT_EXTENDED 15
  372. /**
  373. * the number of pictures in a group of pitures, or 0 for intra_only.
  374. * - encoding: set by user.
  375. * - decoding: unused
  376. */
  377. int gop_size;
  378. /**
  379. * pixel format, see PIX_FMT_xxx.
  380. * - encoding: unused
  381. * - decoding: set by lavc.
  382. */
  383. enum PixelFormat pix_fmt;
  384. /**
  385. * Frame rate emulation. If not zero lower layer (i.e. format handler)
  386. * has to read frames at native frame rate.
  387. * - encoding: set by user.
  388. * - decoding: unused.
  389. */
  390. int rate_emu;
  391. /**
  392. * if non NULL, 'draw_horiz_band' is called by the libavcodec
  393. * decoder to draw an horizontal band. It improve cache usage. Not
  394. * all codecs can do that. You must check the codec capabilities
  395. * before
  396. * - encoding: unused
  397. * - decoding: set by user.
  398. */
  399. void (*draw_horiz_band)(struct AVCodecContext *s,
  400. uint8_t **src_ptr, int linesize,
  401. int y, int width, int height);
  402. /* audio only */
  403. int sample_rate; ///< samples per sec
  404. int channels;
  405. int sample_fmt; ///< sample format, currenly unused
  406. /* the following data should not be initialized */
  407. int frame_size; ///< in samples, initialized when calling 'init'
  408. int frame_number; ///< audio or video frame number
  409. int real_pict_num; ///< returns the real picture number of previous encoded frame
  410. /**
  411. * number of frames the decoded output will be delayed relative to
  412. * the encoded input.
  413. * - encoding: set by lavc.
  414. * - decoding: unused
  415. */
  416. int delay;
  417. /* - encoding parameters */
  418. float qcompress; ///< amount of qscale change between easy & hard scenes (0.0-1.0)
  419. float qblur; ///< amount of qscale smoothing over time (0.0-1.0)
  420. /**
  421. * minimum quantizer.
  422. * - encoding: set by user.
  423. * - decoding: unused
  424. */
  425. int qmin;
  426. /**
  427. * maximum quantizer.
  428. * - encoding: set by user.
  429. * - decoding: unused
  430. */
  431. int qmax;
  432. /**
  433. * maximum quantizer difference etween frames.
  434. * - encoding: set by user.
  435. * - decoding: unused
  436. */
  437. int max_qdiff;
  438. /**
  439. * maximum number of b frames between non b frames.
  440. * note: the output will be delayed by max_b_frames+1 relative to the input
  441. * - encoding: set by user.
  442. * - decoding: unused
  443. */
  444. int max_b_frames;
  445. /**
  446. * qscale factor between ip and b frames.
  447. * - encoding: set by user.
  448. * - decoding: unused
  449. */
  450. float b_quant_factor;
  451. /** obsolete FIXME remove */
  452. int rc_strategy;
  453. int b_frame_strategy;
  454. /**
  455. * hurry up amount.
  456. * - encoding: unused
  457. * - decoding: set by user. 1-> skip b frames, 2-> skip idct/dequant too, 5-> skip everything except header
  458. */
  459. int hurry_up;
  460. struct AVCodec *codec;
  461. void *priv_data;
  462. /* The following data is for RTP friendly coding */
  463. /* By now only H.263/H.263+/MPEG4 coder honours this */
  464. int rtp_mode; /* 1 for activate RTP friendly-mode */
  465. /* highers numbers represent more error-prone */
  466. /* enviroments, by now just "1" exist */
  467. int rtp_payload_size; /* The size of the RTP payload, the coder will */
  468. /* do it's best to deliver a chunk with size */
  469. /* below rtp_payload_size, the chunk will start */
  470. /* with a start code on some codecs like H.263 */
  471. /* This doesn't take account of any particular */
  472. /* headers inside the transmited RTP payload */
  473. /* The RTP callcack: This function is called */
  474. /* every time the encoder as a packet to send */
  475. /* Depends on the encoder if the data starts */
  476. /* with a Start Code (it should) H.263 does */
  477. void (*rtp_callback)(void *data, int size, int packet_number);
  478. /* statistics, used for 2-pass encoding */
  479. int mv_bits;
  480. int header_bits;
  481. int i_tex_bits;
  482. int p_tex_bits;
  483. int i_count;
  484. int p_count;
  485. int skip_count;
  486. int misc_bits;
  487. /**
  488. * number of bits used for the previously encoded frame.
  489. * - encoding: set by lavc
  490. * - decoding: unused
  491. */
  492. int frame_bits;
  493. /**
  494. * private data of the user, can be used to carry app specific stuff.
  495. * - encoding: set by user
  496. * - decoding: set by user
  497. */
  498. void *opaque;
  499. char codec_name[32];
  500. enum CodecType codec_type; /* see CODEC_TYPE_xxx */
  501. enum CodecID codec_id; /* see CODEC_ID_xxx */
  502. /**
  503. * fourcc (LSB first, so "ABCD" -> ('D'<<24) + ('C'<<16) + ('B'<<8) + 'A').
  504. * this is used to workaround some encoder bugs
  505. * - encoding: unused
  506. * - decoding: set by user, will be converted to upper case by lavc during init
  507. */
  508. unsigned int codec_tag;
  509. /**
  510. * workaround bugs in encoders which sometimes cannot be detected automatically.
  511. * - encoding: unused
  512. * - decoding: set by user
  513. */
  514. int workaround_bugs;
  515. #define FF_BUG_AUTODETECT 1 ///< autodetection
  516. #define FF_BUG_OLD_MSMPEG4 2
  517. #define FF_BUG_XVID_ILACE 4
  518. #define FF_BUG_UMP4 8
  519. #define FF_BUG_NO_PADDING 16
  520. #define FF_BUG_AC_VLC 32
  521. #define FF_BUG_QPEL_CHROMA 64
  522. #define FF_BUG_STD_QPEL 128
  523. #define FF_BUG_QPEL_CHROMA2 256
  524. #define FF_BUG_DIRECT_BLOCKSIZE 512
  525. #define FF_BUG_EDGE 1024
  526. //#define FF_BUG_FAKE_SCALABILITY 16 //autodetection should work 100%
  527. /**
  528. * luma single coeff elimination threshold.
  529. * - encoding: set by user
  530. * - decoding: unused
  531. */
  532. int luma_elim_threshold;
  533. /**
  534. * chroma single coeff elimination threshold.
  535. * - encoding: set by user
  536. * - decoding: unused
  537. */
  538. int chroma_elim_threshold;
  539. /**
  540. * strictly follow the std (MPEG4, ...).
  541. * - encoding: set by user
  542. * - decoding: unused
  543. */
  544. int strict_std_compliance;
  545. /**
  546. * qscale offset between ip and b frames.
  547. * if > 0 then the last p frame quantizer will be used (q= lastp_q*factor+offset)
  548. * if < 0 then normal ratecontrol will be done (q= -normal_q*factor+offset)
  549. * - encoding: set by user.
  550. * - decoding: unused
  551. */
  552. float b_quant_offset;
  553. /**
  554. * error resilience higher values will detect more errors but may missdetect
  555. * some more or less valid parts as errors.
  556. * - encoding: unused
  557. * - decoding: set by user
  558. */
  559. int error_resilience;
  560. #define FF_ER_CAREFULL 1
  561. #define FF_ER_COMPLIANT 2
  562. #define FF_ER_AGGRESSIVE 3
  563. #define FF_ER_VERY_AGGRESSIVE 4
  564. /**
  565. * called at the beginning of each frame to get a buffer for it.
  566. * if pic.reference is set then the frame will be read later by lavc
  567. * - encoding: unused
  568. * - decoding: set by lavc, user can override
  569. */
  570. int (*get_buffer)(struct AVCodecContext *c, AVFrame *pic);
  571. /**
  572. * called to release buffers which where allocated with get_buffer.
  573. * a released buffer can be reused in get_buffer()
  574. * pic.data[*] must be set to NULL
  575. * - encoding: unused
  576. * - decoding: set by lavc, user can override
  577. */
  578. void (*release_buffer)(struct AVCodecContext *c, AVFrame *pic);
  579. /**
  580. * is 1 if the decoded stream contains b frames, 0 otherwise.
  581. * - encoding: unused
  582. * - decoding: set by lavc
  583. */
  584. int has_b_frames;
  585. int block_align; ///< used by some WAV based audio codecs
  586. int parse_only; /* - decoding only: if true, only parsing is done
  587. (function avcodec_parse_frame()). The frame
  588. data is returned. Only MPEG codecs support this now. */
  589. /**
  590. * 0-> h263 quant 1-> mpeg quant.
  591. * - encoding: set by user.
  592. * - decoding: unused
  593. */
  594. int mpeg_quant;
  595. /**
  596. * pass1 encoding statistics output buffer.
  597. * - encoding: set by lavc
  598. * - decoding: unused
  599. */
  600. char *stats_out;
  601. /**
  602. * pass2 encoding statistics input buffer.
  603. * concatenated stuff from stats_out of pass1 should be placed here
  604. * - encoding: allocated/set/freed by user
  605. * - decoding: unused
  606. */
  607. char *stats_in;
  608. /**
  609. * ratecontrol qmin qmax limiting method.
  610. * 0-> clipping, 1-> use a nice continous function to limit qscale wthin qmin/qmax
  611. * - encoding: set by user.
  612. * - decoding: unused
  613. */
  614. float rc_qsquish;
  615. float rc_qmod_amp;
  616. int rc_qmod_freq;
  617. /**
  618. * ratecontrol override, see RcOverride.
  619. * - encoding: allocated/set/freed by user.
  620. * - decoding: unused
  621. */
  622. RcOverride *rc_override;
  623. int rc_override_count;
  624. /**
  625. * rate control equation.
  626. * - encoding: set by user
  627. * - decoding: unused
  628. */
  629. char *rc_eq;
  630. /**
  631. * maximum bitrate.
  632. * - encoding: set by user.
  633. * - decoding: unused
  634. */
  635. int rc_max_rate;
  636. /**
  637. * minimum bitrate.
  638. * - encoding: set by user.
  639. * - decoding: unused
  640. */
  641. int rc_min_rate;
  642. /**
  643. * decoder bitstream buffer size.
  644. * - encoding: set by user.
  645. * - decoding: unused
  646. */
  647. int rc_buffer_size;
  648. float rc_buffer_aggressivity;
  649. /**
  650. * qscale factor between p and i frames.
  651. * - encoding: set by user.
  652. * - decoding: unused
  653. */
  654. float i_quant_factor;
  655. /**
  656. * qscale offset between p and i frames.
  657. * if > 0 then the last p frame quantizer will be used (q= lastp_q*factor+offset)
  658. * if < 0 then normal ratecontrol will be done (q= -normal_q*factor+offset)
  659. * - encoding: set by user.
  660. * - decoding: unused
  661. */
  662. float i_quant_offset;
  663. /**
  664. * initial complexity for pass1 ratecontrol.
  665. * - encoding: set by user.
  666. * - decoding: unused
  667. */
  668. float rc_initial_cplx;
  669. /**
  670. * dct algorithm, see FF_DCT_* below.
  671. * - encoding: set by user
  672. * - decoding: unused
  673. */
  674. int dct_algo;
  675. #define FF_DCT_AUTO 0
  676. #define FF_DCT_FASTINT 1
  677. #define FF_DCT_INT 2
  678. #define FF_DCT_MMX 3
  679. #define FF_DCT_MLIB 4
  680. #define FF_DCT_ALTIVEC 5
  681. /**
  682. * luminance masking (0-> disabled).
  683. * - encoding: set by user
  684. * - decoding: unused
  685. */
  686. float lumi_masking;
  687. /**
  688. * temporary complexity masking (0-> disabled).
  689. * - encoding: set by user
  690. * - decoding: unused
  691. */
  692. float temporal_cplx_masking;
  693. /**
  694. * spatial complexity masking (0-> disabled).
  695. * - encoding: set by user
  696. * - decoding: unused
  697. */
  698. float spatial_cplx_masking;
  699. /**
  700. * p block masking (0-> disabled).
  701. * - encoding: set by user
  702. * - decoding: unused
  703. */
  704. float p_masking;
  705. /**
  706. * darkness masking (0-> disabled).
  707. * - encoding: set by user
  708. * - decoding: unused
  709. */
  710. float dark_masking;
  711. /**
  712. * idct algorithm, see FF_IDCT_* below.
  713. * - encoding: set by user
  714. * - decoding: set by user
  715. */
  716. int idct_algo;
  717. #define FF_IDCT_AUTO 0
  718. #define FF_IDCT_INT 1
  719. #define FF_IDCT_SIMPLE 2
  720. #define FF_IDCT_SIMPLEMMX 3
  721. #define FF_IDCT_LIBMPEG2MMX 4
  722. #define FF_IDCT_PS2 5
  723. #define FF_IDCT_MLIB 6
  724. #define FF_IDCT_ARM 7
  725. #define FF_IDCT_ALTIVEC 8
  726. /**
  727. * slice count.
  728. * - encoding: set by lavc
  729. * - decoding: set by user (or 0)
  730. */
  731. int slice_count;
  732. /**
  733. * slice offsets in the frame in bytes.
  734. * - encoding: set/allocated by lavc
  735. * - decoding: set/allocated by user (or NULL)
  736. */
  737. int *slice_offset;
  738. /**
  739. * error concealment flags.
  740. * - encoding: unused
  741. * - decoding: set by user
  742. */
  743. int error_concealment;
  744. #define FF_EC_GUESS_MVS 1
  745. #define FF_EC_DEBLOCK 2
  746. /**
  747. * dsp_mask could be add used to disable unwanted CPU features
  748. * CPU features (i.e. MMX, SSE. ...)
  749. *
  750. * with FORCE flag you may instead enable given CPU features
  751. * (Dangerous: usable in case of misdetection, improper usage however will
  752. * result into program crash)
  753. */
  754. unsigned dsp_mask;
  755. #define FF_MM_FORCE 0x80000000 /* force usage of selected flags (OR) */
  756. /* lower 16 bits - CPU features */
  757. #ifdef HAVE_MMX
  758. #define FF_MM_MMX 0x0001 /* standard MMX */
  759. #define FF_MM_3DNOW 0x0004 /* AMD 3DNOW */
  760. #define FF_MM_MMXEXT 0x0002 /* SSE integer functions or AMD MMX ext */
  761. #define FF_MM_SSE 0x0008 /* SSE functions */
  762. #define FF_MM_SSE2 0x0010 /* PIV SSE2 functions */
  763. #endif /* HAVE_MMX */
  764. /**
  765. * bits per sample/pixel from the demuxer (needed for huffyuv).
  766. * - encoding: set by lavc
  767. * - decoding: set by user
  768. */
  769. int bits_per_sample;
  770. /**
  771. * prediction method (needed for huffyuv).
  772. * - encoding: set by user
  773. * - decoding: unused
  774. */
  775. int prediction_method;
  776. #define FF_PRED_LEFT 0
  777. #define FF_PRED_PLANE 1
  778. #define FF_PRED_MEDIAN 2
  779. /**
  780. * aspect ratio (0 if unknown).
  781. * - encoding: set by user.
  782. * - decoding: set by lavc.
  783. */
  784. float aspect_ratio;
  785. /**
  786. * the picture in the bitstream.
  787. * - encoding: set by lavc
  788. * - decoding: set by lavc
  789. */
  790. AVFrame *coded_frame;
  791. /**
  792. * debug.
  793. * - encoding: set by user.
  794. * - decoding: set by user.
  795. */
  796. int debug;
  797. #define FF_DEBUG_PICT_INFO 1
  798. #define FF_DEBUG_RC 2
  799. #define FF_DEBUG_BITSTREAM 4
  800. #define FF_DEBUG_MB_TYPE 8
  801. #define FF_DEBUG_QP 16
  802. #define FF_DEBUG_MV 32
  803. #define FF_DEBUG_VIS_MV 0x00000040
  804. #define FF_DEBUG_SKIP 0x00000080
  805. #define FF_DEBUG_STARTCODE 0x00000100
  806. #define FF_DEBUG_PTS 0x00000200
  807. #define FF_DEBUG_ER 0x00000400
  808. /**
  809. * error.
  810. * - encoding: set by lavc if flags&CODEC_FLAG_PSNR
  811. * - decoding: unused
  812. */
  813. uint64_t error[4];
  814. /**
  815. * minimum MB quantizer.
  816. * - encoding: set by user.
  817. * - decoding: unused
  818. */
  819. int mb_qmin;
  820. /**
  821. * maximum MB quantizer.
  822. * - encoding: set by user.
  823. * - decoding: unused
  824. */
  825. int mb_qmax;
  826. /**
  827. * motion estimation compare function.
  828. * - encoding: set by user.
  829. * - decoding: unused
  830. */
  831. int me_cmp;
  832. /**
  833. * subpixel motion estimation compare function.
  834. * - encoding: set by user.
  835. * - decoding: unused
  836. */
  837. int me_sub_cmp;
  838. /**
  839. * macroblock compare function (not supported yet).
  840. * - encoding: set by user.
  841. * - decoding: unused
  842. */
  843. int mb_cmp;
  844. #define FF_CMP_SAD 0
  845. #define FF_CMP_SSE 1
  846. #define FF_CMP_SATD 2
  847. #define FF_CMP_DCT 3
  848. #define FF_CMP_PSNR 4
  849. #define FF_CMP_BIT 5
  850. #define FF_CMP_RD 6
  851. #define FF_CMP_ZERO 7
  852. #define FF_CMP_CHROMA 256
  853. /**
  854. * ME diamond size & shape.
  855. * - encoding: set by user.
  856. * - decoding: unused
  857. */
  858. int dia_size;
  859. /**
  860. * amount of previous MV predictors (2a+1 x 2a+1 square).
  861. * - encoding: set by user.
  862. * - decoding: unused
  863. */
  864. int last_predictor_count;
  865. /**
  866. * pre pass for motion estimation.
  867. * - encoding: set by user.
  868. * - decoding: unused
  869. */
  870. int pre_me;
  871. /**
  872. * motion estimation pre pass compare function.
  873. * - encoding: set by user.
  874. * - decoding: unused
  875. */
  876. int me_pre_cmp;
  877. /**
  878. * ME pre pass diamond size & shape.
  879. * - encoding: set by user.
  880. * - decoding: unused
  881. */
  882. int pre_dia_size;
  883. /**
  884. * subpel ME quality.
  885. * - encoding: set by user.
  886. * - decoding: unused
  887. */
  888. int me_subpel_quality;
  889. /**
  890. * callback to negotiate the pixelFormat.
  891. * @param fmt is the list of formats which are supported by the codec,
  892. * its terminated by -1 as 0 is a valid format, the formats are ordered by quality
  893. * the first is allways the native one
  894. * @return the choosen format
  895. * - encoding: unused
  896. * - decoding: set by user, if not set then the native format will always be choosen
  897. */
  898. enum PixelFormat (*get_format)(struct AVCodecContext *s, enum PixelFormat * fmt);
  899. /**
  900. * DTG active format information (additionnal aspect ratio
  901. * information only used in DVB MPEG2 transport streams). 0 if
  902. * not set.
  903. *
  904. * - encoding: unused.
  905. * - decoding: set by decoder
  906. */
  907. int dtg_active_format;
  908. #define FF_DTG_AFD_SAME 8
  909. #define FF_DTG_AFD_4_3 9
  910. #define FF_DTG_AFD_16_9 10
  911. #define FF_DTG_AFD_14_9 11
  912. #define FF_DTG_AFD_4_3_SP_14_9 13
  913. #define FF_DTG_AFD_16_9_SP_14_9 14
  914. #define FF_DTG_AFD_SP_4_3 15
  915. /**
  916. * Maximum motion estimation search range in subpel units.
  917. * if 0 then no limit
  918. *
  919. * - encoding: set by user.
  920. * - decoding: unused.
  921. */
  922. int me_range;
  923. } AVCodecContext;
  924. /**
  925. * AVOption.
  926. */
  927. typedef struct AVOption {
  928. /** options' name */
  929. const char *name; /* if name is NULL, it indicates a link to next */
  930. /** short English text help or const struct AVOption* subpointer */
  931. const char *help; // const struct AVOption* sub;
  932. /** offset to context structure where the parsed value should be stored */
  933. int offset;
  934. /** options' type */
  935. int type;
  936. #define FF_OPT_TYPE_BOOL 1 ///< boolean - true,1,on (or simply presence)
  937. #define FF_OPT_TYPE_DOUBLE 2 ///< double
  938. #define FF_OPT_TYPE_INT 3 ///< integer
  939. #define FF_OPT_TYPE_STRING 4 ///< string (finished with \0)
  940. #define FF_OPT_TYPE_MASK 0x1f ///< mask for types - upper bits are various flags
  941. //#define FF_OPT_TYPE_EXPERT 0x20 // flag for expert option
  942. #define FF_OPT_TYPE_FLAG (FF_OPT_TYPE_BOOL | 0x40)
  943. #define FF_OPT_TYPE_RCOVERRIDE (FF_OPT_TYPE_STRING | 0x80)
  944. /** min value (min == max -> no limits) */
  945. double min;
  946. /** maximum value for double/int */
  947. double max;
  948. /** default boo [0,1]l/double/int value */
  949. double defval;
  950. /**
  951. * default string value (with optional semicolon delimited extra option-list
  952. * i.e. option1;option2;option3
  953. * defval might select other then first argument as default
  954. */
  955. const char *defstr;
  956. #define FF_OPT_MAX_DEPTH 10
  957. } AVOption;
  958. /**
  959. * Parse option(s) and sets fields in passed structure
  960. * @param strct structure where the parsed results will be written
  961. * @param list list with AVOptions
  962. * @param opts string with options for parsing
  963. */
  964. int avoption_parse(void* strct, const AVOption* list, const char* opts);
  965. /**
  966. * AVCodec.
  967. */
  968. typedef struct AVCodec {
  969. const char *name;
  970. int type;
  971. int id;
  972. int priv_data_size;
  973. int (*init)(AVCodecContext *);
  974. int (*encode)(AVCodecContext *, uint8_t *buf, int buf_size, void *data);
  975. int (*close)(AVCodecContext *);
  976. int (*decode)(AVCodecContext *, void *outdata, int *outdata_size,
  977. uint8_t *buf, int buf_size);
  978. int capabilities;
  979. const AVOption *options;
  980. struct AVCodec *next;
  981. } AVCodec;
  982. /**
  983. * four components are given, that's all.
  984. * the last component is alpha
  985. */
  986. typedef struct AVPicture {
  987. uint8_t *data[4];
  988. int linesize[4];
  989. } AVPicture;
  990. extern AVCodec ac3_encoder;
  991. extern AVCodec mp2_encoder;
  992. extern AVCodec mp3lame_encoder;
  993. extern AVCodec oggvorbis_encoder;
  994. extern AVCodec mpeg1video_encoder;
  995. extern AVCodec h263_encoder;
  996. extern AVCodec h263p_encoder;
  997. extern AVCodec rv10_encoder;
  998. extern AVCodec mjpeg_encoder;
  999. extern AVCodec mpeg4_encoder;
  1000. extern AVCodec msmpeg4v1_encoder;
  1001. extern AVCodec msmpeg4v2_encoder;
  1002. extern AVCodec msmpeg4v3_encoder;
  1003. extern AVCodec wmv1_encoder;
  1004. extern AVCodec wmv2_encoder;
  1005. extern AVCodec huffyuv_encoder;
  1006. extern AVCodec h263_decoder;
  1007. extern AVCodec mpeg4_decoder;
  1008. extern AVCodec msmpeg4v1_decoder;
  1009. extern AVCodec msmpeg4v2_decoder;
  1010. extern AVCodec msmpeg4v3_decoder;
  1011. extern AVCodec wmv1_decoder;
  1012. extern AVCodec wmv2_decoder;
  1013. extern AVCodec mpeg_decoder;
  1014. extern AVCodec h263i_decoder;
  1015. extern AVCodec rv10_decoder;
  1016. extern AVCodec svq1_decoder;
  1017. extern AVCodec dvvideo_decoder;
  1018. extern AVCodec dvaudio_decoder;
  1019. extern AVCodec wmav1_decoder;
  1020. extern AVCodec wmav2_decoder;
  1021. extern AVCodec mjpeg_decoder;
  1022. extern AVCodec mjpegb_decoder;
  1023. extern AVCodec mp2_decoder;
  1024. extern AVCodec mp3_decoder;
  1025. extern AVCodec mace3_decoder;
  1026. extern AVCodec mace6_decoder;
  1027. extern AVCodec huffyuv_decoder;
  1028. extern AVCodec oggvorbis_decoder;
  1029. extern AVCodec cyuv_decoder;
  1030. /* pcm codecs */
  1031. #define PCM_CODEC(id, name) \
  1032. extern AVCodec name ## _decoder; \
  1033. extern AVCodec name ## _encoder
  1034. PCM_CODEC(CODEC_ID_PCM_S16LE, pcm_s16le);
  1035. PCM_CODEC(CODEC_ID_PCM_S16BE, pcm_s16be);
  1036. PCM_CODEC(CODEC_ID_PCM_U16LE, pcm_u16le);
  1037. PCM_CODEC(CODEC_ID_PCM_U16BE, pcm_u16be);
  1038. PCM_CODEC(CODEC_ID_PCM_S8, pcm_s8);
  1039. PCM_CODEC(CODEC_ID_PCM_U8, pcm_u8);
  1040. PCM_CODEC(CODEC_ID_PCM_ALAW, pcm_alaw);
  1041. PCM_CODEC(CODEC_ID_PCM_MULAW, pcm_mulaw);
  1042. /* adpcm codecs */
  1043. PCM_CODEC(CODEC_ID_ADPCM_IMA_QT, adpcm_ima_qt);
  1044. PCM_CODEC(CODEC_ID_ADPCM_IMA_WAV, adpcm_ima_wav);
  1045. PCM_CODEC(CODEC_ID_ADPCM_MS, adpcm_ms);
  1046. #undef PCM_CODEC
  1047. /* dummy raw video codec */
  1048. extern AVCodec rawvideo_codec;
  1049. /* the following codecs use external GPL libs */
  1050. extern AVCodec ac3_decoder;
  1051. /* resample.c */
  1052. struct ReSampleContext;
  1053. typedef struct ReSampleContext ReSampleContext;
  1054. ReSampleContext *audio_resample_init(int output_channels, int input_channels,
  1055. int output_rate, int input_rate);
  1056. int audio_resample(ReSampleContext *s, short *output, short *input, int nb_samples);
  1057. void audio_resample_close(ReSampleContext *s);
  1058. /* YUV420 format is assumed ! */
  1059. struct ImgReSampleContext;
  1060. typedef struct ImgReSampleContext ImgReSampleContext;
  1061. ImgReSampleContext *img_resample_init(int output_width, int output_height,
  1062. int input_width, int input_height);
  1063. ImgReSampleContext *img_resample_full_init(int owidth, int oheight,
  1064. int iwidth, int iheight,
  1065. int topBand, int bottomBand,
  1066. int leftBand, int rightBand);
  1067. void img_resample(ImgReSampleContext *s,
  1068. AVPicture *output, AVPicture *input);
  1069. void img_resample_close(ImgReSampleContext *s);
  1070. int avpicture_fill(AVPicture *picture, uint8_t *ptr,
  1071. int pix_fmt, int width, int height);
  1072. int avpicture_get_size(int pix_fmt, int width, int height);
  1073. void avcodec_get_chroma_sub_sample(int pix_fmt, int *h_shift, int *v_shift);
  1074. const char *avcodec_get_pix_fmt_name(int pix_fmt);
  1075. /* convert among pixel formats */
  1076. int img_convert(AVPicture *dst, int dst_pix_fmt,
  1077. AVPicture *src, int pix_fmt,
  1078. int width, int height);
  1079. /* deinterlace a picture */
  1080. int avpicture_deinterlace(AVPicture *dst, AVPicture *src,
  1081. int pix_fmt, int width, int height);
  1082. /* external high level API */
  1083. extern AVCodec *first_avcodec;
  1084. /* returns LIBAVCODEC_VERSION_INT constant */
  1085. unsigned avcodec_version(void);
  1086. /* returns LIBAVCODEC_BUILD constant */
  1087. unsigned avcodec_build(void);
  1088. void avcodec_init(void);
  1089. void register_avcodec(AVCodec *format);
  1090. AVCodec *avcodec_find_encoder(enum CodecID id);
  1091. AVCodec *avcodec_find_encoder_by_name(const char *name);
  1092. AVCodec *avcodec_find_decoder(enum CodecID id);
  1093. AVCodec *avcodec_find_decoder_by_name(const char *name);
  1094. void avcodec_string(char *buf, int buf_size, AVCodecContext *enc, int encode);
  1095. void avcodec_get_context_defaults(AVCodecContext *s);
  1096. AVCodecContext *avcodec_alloc_context(void);
  1097. AVFrame *avcodec_alloc_frame(void);
  1098. int avcodec_default_get_buffer(AVCodecContext *s, AVFrame *pic);
  1099. void avcodec_default_release_buffer(AVCodecContext *s, AVFrame *pic);
  1100. int avcodec_open(AVCodecContext *avctx, AVCodec *codec);
  1101. int avcodec_decode_audio(AVCodecContext *avctx, int16_t *samples,
  1102. int *frame_size_ptr,
  1103. uint8_t *buf, int buf_size);
  1104. int avcodec_decode_video(AVCodecContext *avctx, AVFrame *picture,
  1105. int *got_picture_ptr,
  1106. uint8_t *buf, int buf_size);
  1107. int avcodec_parse_frame(AVCodecContext *avctx, uint8_t **pdata,
  1108. int *data_size_ptr,
  1109. uint8_t *buf, int buf_size);
  1110. int avcodec_encode_audio(AVCodecContext *avctx, uint8_t *buf, int buf_size,
  1111. const short *samples);
  1112. int avcodec_encode_video(AVCodecContext *avctx, uint8_t *buf, int buf_size,
  1113. const AVFrame *pict);
  1114. int avcodec_close(AVCodecContext *avctx);
  1115. void avcodec_register_all(void);
  1116. void avcodec_flush_buffers(AVCodecContext *avctx);
  1117. /* misc usefull functions */
  1118. /**
  1119. * reduce a fraction.
  1120. * this is usefull for framerate calculations
  1121. * @param max the maximum allowed for dst_nom & dst_den
  1122. * @return 1 if exact, 0 otherwise
  1123. */
  1124. int av_reduce(int *dst_nom, int *dst_den, int64_t nom, int64_t den, int64_t max);
  1125. /**
  1126. * rescale a 64bit integer.
  1127. * a simple a*b/c isnt possible as it can overflow
  1128. */
  1129. int64_t av_rescale(int64_t a, int b, int c);
  1130. /**
  1131. * Interface for 0.5.0 version
  1132. *
  1133. * do not even think about it's usage for this moment
  1134. */
  1135. typedef struct {
  1136. /// compressed size used from given memory buffer
  1137. int size;
  1138. /// I/P/B frame type
  1139. int frame_type;
  1140. } avc_enc_result_t;
  1141. /**
  1142. * Commands
  1143. * order can't be changed - once it was defined
  1144. */
  1145. typedef enum {
  1146. // general commands
  1147. AVC_OPEN_BY_NAME = 0xACA000,
  1148. AVC_OPEN_BY_CODEC_ID,
  1149. AVC_OPEN_BY_FOURCC,
  1150. AVC_CLOSE,
  1151. AVC_FLUSH,
  1152. // pin - struct { uint8_t* src, uint_t src_size }
  1153. // pout - struct { AVPicture* img, consumed_bytes,
  1154. AVC_DECODE,
  1155. // pin - struct { AVPicture* img, uint8_t* dest, uint_t dest_size }
  1156. // pout - uint_t used_from_dest_size
  1157. AVC_ENCODE,
  1158. // query/get video commands
  1159. AVC_GET_VERSION = 0xACB000,
  1160. AVC_GET_WIDTH,
  1161. AVC_GET_HEIGHT,
  1162. AVC_GET_DELAY,
  1163. AVC_GET_QUANT_TABLE,
  1164. // ...
  1165. // query/get audio commands
  1166. AVC_GET_FRAME_SIZE = 0xABC000,
  1167. // maybe define some simple structure which
  1168. // might be passed to the user - but they can't
  1169. // contain any codec specific parts and these
  1170. // calls are usualy necessary only few times
  1171. // set video commands
  1172. AVC_SET_WIDTH = 0xACD000,
  1173. AVC_SET_HEIGHT,
  1174. // set video encoding commands
  1175. AVC_SET_FRAME_RATE = 0xACD800,
  1176. AVC_SET_QUALITY,
  1177. AVC_SET_HURRY_UP,
  1178. // set audio commands
  1179. AVC_SET_SAMPLE_RATE = 0xACE000,
  1180. AVC_SET_CHANNELS,
  1181. } avc_cmd_t;
  1182. /**
  1183. * \param handle allocated private structure by libavcodec
  1184. * for initialization pass NULL - will be returned pout
  1185. * user is supposed to know nothing about its structure
  1186. * \param cmd type of operation to be performed
  1187. * \param pint input parameter
  1188. * \param pout output parameter
  1189. *
  1190. * \returns command status - eventually for query command it might return
  1191. * integer resulting value
  1192. */
  1193. int avcodec(void* handle, avc_cmd_t cmd, void* pin, void* pout);
  1194. /* memory */
  1195. void *av_malloc(unsigned int size);
  1196. void *av_mallocz(unsigned int size);
  1197. void *av_realloc(void *ptr, unsigned int size);
  1198. void av_free(void *ptr);
  1199. char *av_strdup(const char *s);
  1200. void __av_freep(void **ptr);
  1201. #define av_freep(p) __av_freep((void **)(p))
  1202. void *av_fast_realloc(void *ptr, unsigned int *size, unsigned int min_size);
  1203. /* for static data only */
  1204. /* call av_free_static to release all staticaly allocated tables */
  1205. void av_free_static(void);
  1206. void *__av_mallocz_static(void** location, unsigned int size);
  1207. #define av_mallocz_static(p, s) __av_mallocz_static((void **)(p), s)
  1208. #ifdef __cplusplus
  1209. }
  1210. #endif
  1211. #endif /* AVCODEC_H */