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.

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