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.

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