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.

1419 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. #define CODEC_CAP_DR1 0x0002 ///< direct rendering method 1
  163. /* if 'parse_only' field is true, then avcodec_parse_frame() can be
  164. used */
  165. #define CODEC_CAP_PARSE_ONLY 0x0004
  166. #define CODEC_CAP_TRUNCATED 0x0008
  167. #define FF_COMMON_FRAME \
  168. /**\
  169. * pointer to the picture planes.\
  170. * this might be different from the first allocated byte\
  171. * - encoding: \
  172. * - decoding: \
  173. */\
  174. uint8_t *data[4];\
  175. int linesize[4];\
  176. /**\
  177. * pointer to the first allocated byte of the picture. can be used in get_buffer/release_buffer\
  178. * this isnt used by lavc unless the default get/release_buffer() is used\
  179. * - encoding: \
  180. * - decoding: \
  181. */\
  182. uint8_t *base[4];\
  183. /**\
  184. * 1 -> keyframe, 0-> not\
  185. * - encoding: set by lavc\
  186. * - decoding: set by lavc\
  187. */\
  188. int key_frame;\
  189. \
  190. /**\
  191. * picture type of the frame, see ?_TYPE below.\
  192. * - encoding: set by lavc for coded_picture (and set by user for input)\
  193. * - decoding: set by lavc\
  194. */\
  195. int pict_type;\
  196. \
  197. /**\
  198. * presentation timestamp in micro seconds (time when frame should be shown to user)\
  199. * if 0 then the frame_rate will be used as reference\
  200. * - encoding: MUST be set by user\
  201. * - decoding: set by lavc\
  202. */\
  203. int64_t pts;\
  204. \
  205. /**\
  206. * picture number in bitstream order.\
  207. * - encoding: set by\
  208. * - decoding: set by lavc\
  209. */\
  210. int coded_picture_number;\
  211. /**\
  212. * picture number in display order.\
  213. * - encoding: set by\
  214. * - decoding: set by lavc\
  215. */\
  216. int display_picture_number;\
  217. \
  218. /**\
  219. * quality (between 1 (good) and 31 (bad)) \
  220. * - encoding: set by lavc for coded_picture (and set by user for input)\
  221. * - decoding: set by lavc\
  222. */\
  223. float quality; \
  224. \
  225. /**\
  226. * buffer age (1->was last buffer and dint change, 2->..., ...).\
  227. * set to something large if the buffer has not been used yet \
  228. * - encoding: unused\
  229. * - decoding: MUST be set by get_buffer()\
  230. */\
  231. int age;\
  232. \
  233. /**\
  234. * is this picture used as reference\
  235. * - encoding: unused\
  236. * - decoding: set by lavc (before get_buffer() call))\
  237. */\
  238. int reference;\
  239. \
  240. /**\
  241. * QP table\
  242. * - encoding: unused\
  243. * - decoding: set by lavc\
  244. */\
  245. int8_t *qscale_table;\
  246. /**\
  247. * QP store stride\
  248. * - encoding: unused\
  249. * - decoding: set by lavc\
  250. */\
  251. int qstride;\
  252. \
  253. /**\
  254. * mbskip_table[mb]>=1 if MB didnt change\
  255. * stride= mb_width = (width+15)>>4\
  256. * - encoding: unused\
  257. * - decoding: set by lavc\
  258. */\
  259. uint8_t *mbskip_table;\
  260. \
  261. /**\
  262. * for some private data of the user\
  263. * - encoding: unused\
  264. * - decoding: set by user\
  265. */\
  266. void *opaque;\
  267. \
  268. /**\
  269. * error\
  270. * - encoding: set by lavc if flags&CODEC_FLAG_PSNR\
  271. * - decoding: unused\
  272. */\
  273. uint64_t error[4];\
  274. \
  275. /**\
  276. * type of the buffer (to keep track of who has to dealloc data[*])\
  277. * - encoding: set by the one who allocs it\
  278. * - decoding: set by the one who allocs it\
  279. * Note: user allocated (direct rendering) & internal buffers can not coexist currently\
  280. */\
  281. int type;\
  282. \
  283. /**\
  284. * when decoding, this signal how much the picture must be delayed.\
  285. * extra_delay = repeat_pict / (2*fps)\
  286. * - encoding: unused\
  287. * - decoding: set by lavc\
  288. */\
  289. int repeat_pict;
  290. #define FF_BUFFER_TYPE_INTERNAL 1
  291. #define FF_BUFFER_TYPE_USER 2 ///< Direct rendering buffers
  292. #define FF_BUFFER_TYPE_SHARED 4 ///< buffer from somewher else, dont dealloc
  293. #define FF_I_TYPE 1 // Intra
  294. #define FF_P_TYPE 2 // Predicted
  295. #define FF_B_TYPE 3 // Bi-dir predicted
  296. #define FF_S_TYPE 4 // S(GMC)-VOP MPEG4
  297. #define FF_SI_TYPE 5
  298. #define FF_SP_TYPE 6
  299. /**
  300. * Audio Video Frame.
  301. */
  302. typedef struct AVFrame {
  303. FF_COMMON_FRAME
  304. } AVFrame;
  305. #define DEFAULT_FRAME_RATE_BASE 1001000
  306. /**
  307. * main external api structure.
  308. */
  309. typedef struct AVCodecContext {
  310. /**
  311. * the average bitrate.
  312. * - encoding: set by user. unused for constant quantizer encoding
  313. * - decoding: set by lavc. 0 or some bitrate if this info is available in the stream
  314. */
  315. int bit_rate;
  316. /**
  317. * number of bits the bitstream is allowed to diverge from the reference.
  318. * the reference can be CBR (for CBR pass1) or VBR (for pass2)
  319. * - encoding: set by user. unused for constant quantizer encoding
  320. * - decoding: unused
  321. */
  322. int bit_rate_tolerance;
  323. /**
  324. * CODEC_FLAG_*.
  325. * - encoding: set by user.
  326. * - decoding: set by user.
  327. */
  328. int flags;
  329. /**
  330. * some codecs needs additionnal format info. It is stored here
  331. * - encoding: set by user.
  332. * - decoding: set by lavc. (FIXME is this ok?)
  333. */
  334. int sub_id;
  335. /**
  336. * motion estimation algorithm used for video coding.
  337. * - encoding: MUST be set by user.
  338. * - decoding: unused
  339. */
  340. int me_method;
  341. /**
  342. * some codecs need / can use extra-data like huffman tables.
  343. * mjpeg: huffman tables
  344. * rv10: additional flags
  345. * mpeg4: global headers (they can be in the bitstream or here)
  346. * - encoding: set/allocated/freed by lavc.
  347. * - decoding: set/allocated/freed by user.
  348. */
  349. void *extradata;
  350. int extradata_size;
  351. /* video only */
  352. /**
  353. * frames per sec multiplied by frame_rate_base.
  354. * for variable fps this is the precission, so if the timestamps
  355. * can be specified in msec precssion then this is 1000*frame_rate_base
  356. * - encoding: MUST be set by user
  357. * - decoding: set by lavc. 0 or the frame_rate if available
  358. */
  359. int frame_rate;
  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. /* for binary compatibility */
  712. int unused;
  713. /**
  714. * idct algorithm, see FF_IDCT_* below.
  715. * - encoding: set by user
  716. * - decoding: set by user
  717. */
  718. int idct_algo;
  719. #define FF_IDCT_AUTO 0
  720. #define FF_IDCT_INT 1
  721. #define FF_IDCT_SIMPLE 2
  722. #define FF_IDCT_SIMPLEMMX 3
  723. #define FF_IDCT_LIBMPEG2MMX 4
  724. #define FF_IDCT_PS2 5
  725. #define FF_IDCT_MLIB 6
  726. #define FF_IDCT_ARM 7
  727. #define FF_IDCT_ALTIVEC 8
  728. /**
  729. * slice count.
  730. * - encoding: set by lavc
  731. * - decoding: set by user (or 0)
  732. */
  733. int slice_count;
  734. /**
  735. * slice offsets in the frame in bytes.
  736. * - encoding: set/allocated by lavc
  737. * - decoding: set/allocated by user (or NULL)
  738. */
  739. int *slice_offset;
  740. /**
  741. * error concealment flags.
  742. * - encoding: unused
  743. * - decoding: set by user
  744. */
  745. int error_concealment;
  746. #define FF_EC_GUESS_MVS 1
  747. #define FF_EC_DEBLOCK 2
  748. /**
  749. * dsp_mask could be add used to disable unwanted CPU features
  750. * CPU features (i.e. MMX, SSE. ...)
  751. *
  752. * with FORCE flag you may instead enable given CPU features
  753. * (Dangerous: usable in case of misdetection, improper usage however will
  754. * result into program crash)
  755. */
  756. unsigned dsp_mask;
  757. #define FF_MM_FORCE 0x80000000 /* force usage of selected flags (OR) */
  758. /* lower 16 bits - CPU features */
  759. #ifdef HAVE_MMX
  760. #define FF_MM_MMX 0x0001 /* standard MMX */
  761. #define FF_MM_3DNOW 0x0004 /* AMD 3DNOW */
  762. #define FF_MM_MMXEXT 0x0002 /* SSE integer functions or AMD MMX ext */
  763. #define FF_MM_SSE 0x0008 /* SSE functions */
  764. #define FF_MM_SSE2 0x0010 /* PIV SSE2 functions */
  765. #endif /* HAVE_MMX */
  766. /**
  767. * bits per sample/pixel from the demuxer (needed for huffyuv).
  768. * - encoding: set by lavc
  769. * - decoding: set by user
  770. */
  771. int bits_per_sample;
  772. /**
  773. * prediction method (needed for huffyuv).
  774. * - encoding: set by user
  775. * - decoding: unused
  776. */
  777. int prediction_method;
  778. #define FF_PRED_LEFT 0
  779. #define FF_PRED_PLANE 1
  780. #define FF_PRED_MEDIAN 2
  781. /**
  782. * aspect ratio (0 if unknown).
  783. * - encoding: set by user.
  784. * - decoding: set by lavc.
  785. */
  786. float aspect_ratio;
  787. /**
  788. * the picture in the bitstream.
  789. * - encoding: set by lavc
  790. * - decoding: set by lavc
  791. */
  792. AVFrame *coded_frame;
  793. /**
  794. * debug.
  795. * - encoding: set by user.
  796. * - decoding: set by user.
  797. */
  798. int debug;
  799. #define FF_DEBUG_PICT_INFO 1
  800. #define FF_DEBUG_RC 2
  801. #define FF_DEBUG_BITSTREAM 4
  802. #define FF_DEBUG_MB_TYPE 8
  803. #define FF_DEBUG_QP 16
  804. #define FF_DEBUG_MV 32
  805. #define FF_DEBUG_VIS_MV 0x00000040
  806. #define FF_DEBUG_SKIP 0x00000080
  807. #define FF_DEBUG_STARTCODE 0x00000100
  808. #define FF_DEBUG_PTS 0x00000200
  809. #define FF_DEBUG_ER 0x00000400
  810. #define FF_DEBUG_MMCO 0x00000800
  811. /**
  812. * error.
  813. * - encoding: set by lavc if flags&CODEC_FLAG_PSNR
  814. * - decoding: unused
  815. */
  816. uint64_t error[4];
  817. /**
  818. * minimum MB quantizer.
  819. * - encoding: set by user.
  820. * - decoding: unused
  821. */
  822. int mb_qmin;
  823. /**
  824. * maximum MB quantizer.
  825. * - encoding: set by user.
  826. * - decoding: unused
  827. */
  828. int mb_qmax;
  829. /**
  830. * motion estimation compare function.
  831. * - encoding: set by user.
  832. * - decoding: unused
  833. */
  834. int me_cmp;
  835. /**
  836. * subpixel motion estimation compare function.
  837. * - encoding: set by user.
  838. * - decoding: unused
  839. */
  840. int me_sub_cmp;
  841. /**
  842. * macroblock compare function (not supported yet).
  843. * - encoding: set by user.
  844. * - decoding: unused
  845. */
  846. int mb_cmp;
  847. #define FF_CMP_SAD 0
  848. #define FF_CMP_SSE 1
  849. #define FF_CMP_SATD 2
  850. #define FF_CMP_DCT 3
  851. #define FF_CMP_PSNR 4
  852. #define FF_CMP_BIT 5
  853. #define FF_CMP_RD 6
  854. #define FF_CMP_ZERO 7
  855. #define FF_CMP_CHROMA 256
  856. /**
  857. * ME diamond size & shape.
  858. * - encoding: set by user.
  859. * - decoding: unused
  860. */
  861. int dia_size;
  862. /**
  863. * amount of previous MV predictors (2a+1 x 2a+1 square).
  864. * - encoding: set by user.
  865. * - decoding: unused
  866. */
  867. int last_predictor_count;
  868. /**
  869. * pre pass for motion estimation.
  870. * - encoding: set by user.
  871. * - decoding: unused
  872. */
  873. int pre_me;
  874. /**
  875. * motion estimation pre pass compare function.
  876. * - encoding: set by user.
  877. * - decoding: unused
  878. */
  879. int me_pre_cmp;
  880. /**
  881. * ME pre pass diamond size & shape.
  882. * - encoding: set by user.
  883. * - decoding: unused
  884. */
  885. int pre_dia_size;
  886. /**
  887. * subpel ME quality.
  888. * - encoding: set by user.
  889. * - decoding: unused
  890. */
  891. int me_subpel_quality;
  892. /**
  893. * callback to negotiate the pixelFormat.
  894. * @param fmt is the list of formats which are supported by the codec,
  895. * its terminated by -1 as 0 is a valid format, the formats are ordered by quality
  896. * the first is allways the native one
  897. * @return the choosen format
  898. * - encoding: unused
  899. * - decoding: set by user, if not set then the native format will always be choosen
  900. */
  901. enum PixelFormat (*get_format)(struct AVCodecContext *s, enum PixelFormat * fmt);
  902. /**
  903. * DTG active format information (additionnal aspect ratio
  904. * information only used in DVB MPEG2 transport streams). 0 if
  905. * not set.
  906. *
  907. * - encoding: unused.
  908. * - decoding: set by decoder
  909. */
  910. int dtg_active_format;
  911. #define FF_DTG_AFD_SAME 8
  912. #define FF_DTG_AFD_4_3 9
  913. #define FF_DTG_AFD_16_9 10
  914. #define FF_DTG_AFD_14_9 11
  915. #define FF_DTG_AFD_4_3_SP_14_9 13
  916. #define FF_DTG_AFD_16_9_SP_14_9 14
  917. #define FF_DTG_AFD_SP_4_3 15
  918. /**
  919. * Maximum motion estimation search range in subpel units.
  920. * if 0 then no limit
  921. *
  922. * - encoding: set by user.
  923. * - decoding: unused.
  924. */
  925. int me_range;
  926. /**
  927. * frame_rate_base.
  928. * for variable fps this is 1
  929. * - encoding: set by user.
  930. * - decoding: set by lavc.
  931. * @todo move this after frame_rate
  932. */
  933. int frame_rate_base;
  934. /**
  935. * intra quantizer bias.
  936. * - encoding: set by user.
  937. * - decoding: unused
  938. */
  939. int intra_quant_bias;
  940. #define FF_DEFAULT_QUANT_BIAS 999999
  941. /**
  942. * inter quantizer bias.
  943. * - encoding: set by user.
  944. * - decoding: unused
  945. */
  946. int inter_quant_bias;
  947. } AVCodecContext;
  948. /**
  949. * AVOption.
  950. */
  951. typedef struct AVOption {
  952. /** options' name */
  953. const char *name; /* if name is NULL, it indicates a link to next */
  954. /** short English text help or const struct AVOption* subpointer */
  955. const char *help; // const struct AVOption* sub;
  956. /** offset to context structure where the parsed value should be stored */
  957. int offset;
  958. /** options' type */
  959. int type;
  960. #define FF_OPT_TYPE_BOOL 1 ///< boolean - true,1,on (or simply presence)
  961. #define FF_OPT_TYPE_DOUBLE 2 ///< double
  962. #define FF_OPT_TYPE_INT 3 ///< integer
  963. #define FF_OPT_TYPE_STRING 4 ///< string (finished with \0)
  964. #define FF_OPT_TYPE_MASK 0x1f ///< mask for types - upper bits are various flags
  965. //#define FF_OPT_TYPE_EXPERT 0x20 // flag for expert option
  966. #define FF_OPT_TYPE_FLAG (FF_OPT_TYPE_BOOL | 0x40)
  967. #define FF_OPT_TYPE_RCOVERRIDE (FF_OPT_TYPE_STRING | 0x80)
  968. /** min value (min == max -> no limits) */
  969. double min;
  970. /** maximum value for double/int */
  971. double max;
  972. /** default boo [0,1]l/double/int value */
  973. double defval;
  974. /**
  975. * default string value (with optional semicolon delimited extra option-list
  976. * i.e. option1;option2;option3
  977. * defval might select other then first argument as default
  978. */
  979. const char *defstr;
  980. #define FF_OPT_MAX_DEPTH 10
  981. } AVOption;
  982. /**
  983. * Parse option(s) and sets fields in passed structure
  984. * @param strct structure where the parsed results will be written
  985. * @param list list with AVOptions
  986. * @param opts string with options for parsing
  987. */
  988. int avoption_parse(void* strct, const AVOption* list, const char* opts);
  989. /**
  990. * AVCodec.
  991. */
  992. typedef struct AVCodec {
  993. const char *name;
  994. int type;
  995. int id;
  996. int priv_data_size;
  997. int (*init)(AVCodecContext *);
  998. int (*encode)(AVCodecContext *, uint8_t *buf, int buf_size, void *data);
  999. int (*close)(AVCodecContext *);
  1000. int (*decode)(AVCodecContext *, void *outdata, int *outdata_size,
  1001. uint8_t *buf, int buf_size);
  1002. int capabilities;
  1003. const AVOption *options;
  1004. struct AVCodec *next;
  1005. } AVCodec;
  1006. /**
  1007. * four components are given, that's all.
  1008. * the last component is alpha
  1009. */
  1010. typedef struct AVPicture {
  1011. uint8_t *data[4];
  1012. int linesize[4];
  1013. } AVPicture;
  1014. extern AVCodec ac3_encoder;
  1015. extern AVCodec mp2_encoder;
  1016. extern AVCodec mp3lame_encoder;
  1017. extern AVCodec oggvorbis_encoder;
  1018. extern AVCodec mpeg1video_encoder;
  1019. extern AVCodec h263_encoder;
  1020. extern AVCodec h263p_encoder;
  1021. extern AVCodec rv10_encoder;
  1022. extern AVCodec mjpeg_encoder;
  1023. extern AVCodec mpeg4_encoder;
  1024. extern AVCodec msmpeg4v1_encoder;
  1025. extern AVCodec msmpeg4v2_encoder;
  1026. extern AVCodec msmpeg4v3_encoder;
  1027. extern AVCodec wmv1_encoder;
  1028. extern AVCodec wmv2_encoder;
  1029. extern AVCodec huffyuv_encoder;
  1030. extern AVCodec h264_encoder;
  1031. extern AVCodec h263_decoder;
  1032. extern AVCodec mpeg4_decoder;
  1033. extern AVCodec msmpeg4v1_decoder;
  1034. extern AVCodec msmpeg4v2_decoder;
  1035. extern AVCodec msmpeg4v3_decoder;
  1036. extern AVCodec wmv1_decoder;
  1037. extern AVCodec wmv2_decoder;
  1038. extern AVCodec mpeg_decoder;
  1039. extern AVCodec h263i_decoder;
  1040. extern AVCodec rv10_decoder;
  1041. extern AVCodec svq1_decoder;
  1042. extern AVCodec dvvideo_decoder;
  1043. extern AVCodec dvaudio_decoder;
  1044. extern AVCodec wmav1_decoder;
  1045. extern AVCodec wmav2_decoder;
  1046. extern AVCodec mjpeg_decoder;
  1047. extern AVCodec mjpegb_decoder;
  1048. extern AVCodec mp2_decoder;
  1049. extern AVCodec mp3_decoder;
  1050. extern AVCodec mace3_decoder;
  1051. extern AVCodec mace6_decoder;
  1052. extern AVCodec huffyuv_decoder;
  1053. extern AVCodec oggvorbis_decoder;
  1054. extern AVCodec cyuv_decoder;
  1055. extern AVCodec h264_decoder;
  1056. extern AVCodec indeo3_decoder;
  1057. /* pcm codecs */
  1058. #define PCM_CODEC(id, name) \
  1059. extern AVCodec name ## _decoder; \
  1060. extern AVCodec name ## _encoder
  1061. PCM_CODEC(CODEC_ID_PCM_S16LE, pcm_s16le);
  1062. PCM_CODEC(CODEC_ID_PCM_S16BE, pcm_s16be);
  1063. PCM_CODEC(CODEC_ID_PCM_U16LE, pcm_u16le);
  1064. PCM_CODEC(CODEC_ID_PCM_U16BE, pcm_u16be);
  1065. PCM_CODEC(CODEC_ID_PCM_S8, pcm_s8);
  1066. PCM_CODEC(CODEC_ID_PCM_U8, pcm_u8);
  1067. PCM_CODEC(CODEC_ID_PCM_ALAW, pcm_alaw);
  1068. PCM_CODEC(CODEC_ID_PCM_MULAW, pcm_mulaw);
  1069. /* adpcm codecs */
  1070. PCM_CODEC(CODEC_ID_ADPCM_IMA_QT, adpcm_ima_qt);
  1071. PCM_CODEC(CODEC_ID_ADPCM_IMA_WAV, adpcm_ima_wav);
  1072. PCM_CODEC(CODEC_ID_ADPCM_MS, adpcm_ms);
  1073. #undef PCM_CODEC
  1074. /* dummy raw video codec */
  1075. extern AVCodec rawvideo_codec;
  1076. /* the following codecs use external GPL libs */
  1077. extern AVCodec ac3_decoder;
  1078. /* resample.c */
  1079. struct ReSampleContext;
  1080. typedef struct ReSampleContext ReSampleContext;
  1081. ReSampleContext *audio_resample_init(int output_channels, int input_channels,
  1082. int output_rate, int input_rate);
  1083. int audio_resample(ReSampleContext *s, short *output, short *input, int nb_samples);
  1084. void audio_resample_close(ReSampleContext *s);
  1085. /* YUV420 format is assumed ! */
  1086. struct ImgReSampleContext;
  1087. typedef struct ImgReSampleContext ImgReSampleContext;
  1088. ImgReSampleContext *img_resample_init(int output_width, int output_height,
  1089. int input_width, int input_height);
  1090. ImgReSampleContext *img_resample_full_init(int owidth, int oheight,
  1091. int iwidth, int iheight,
  1092. int topBand, int bottomBand,
  1093. int leftBand, int rightBand);
  1094. void img_resample(ImgReSampleContext *s,
  1095. AVPicture *output, AVPicture *input);
  1096. void img_resample_close(ImgReSampleContext *s);
  1097. int avpicture_fill(AVPicture *picture, uint8_t *ptr,
  1098. int pix_fmt, int width, int height);
  1099. int avpicture_get_size(int pix_fmt, int width, int height);
  1100. void avcodec_get_chroma_sub_sample(int pix_fmt, int *h_shift, int *v_shift);
  1101. const char *avcodec_get_pix_fmt_name(int pix_fmt);
  1102. /* convert among pixel formats */
  1103. int img_convert(AVPicture *dst, int dst_pix_fmt,
  1104. AVPicture *src, int pix_fmt,
  1105. int width, int height);
  1106. /* deinterlace a picture */
  1107. int avpicture_deinterlace(AVPicture *dst, AVPicture *src,
  1108. int pix_fmt, int width, int height);
  1109. /* external high level API */
  1110. extern AVCodec *first_avcodec;
  1111. /* returns LIBAVCODEC_VERSION_INT constant */
  1112. unsigned avcodec_version(void);
  1113. /* returns LIBAVCODEC_BUILD constant */
  1114. unsigned avcodec_build(void);
  1115. void avcodec_init(void);
  1116. void register_avcodec(AVCodec *format);
  1117. AVCodec *avcodec_find_encoder(enum CodecID id);
  1118. AVCodec *avcodec_find_encoder_by_name(const char *name);
  1119. AVCodec *avcodec_find_decoder(enum CodecID id);
  1120. AVCodec *avcodec_find_decoder_by_name(const char *name);
  1121. void avcodec_string(char *buf, int buf_size, AVCodecContext *enc, int encode);
  1122. void avcodec_get_context_defaults(AVCodecContext *s);
  1123. AVCodecContext *avcodec_alloc_context(void);
  1124. AVFrame *avcodec_alloc_frame(void);
  1125. int avcodec_default_get_buffer(AVCodecContext *s, AVFrame *pic);
  1126. void avcodec_default_release_buffer(AVCodecContext *s, AVFrame *pic);
  1127. int avcodec_open(AVCodecContext *avctx, AVCodec *codec);
  1128. int avcodec_decode_audio(AVCodecContext *avctx, int16_t *samples,
  1129. int *frame_size_ptr,
  1130. uint8_t *buf, int buf_size);
  1131. int avcodec_decode_video(AVCodecContext *avctx, AVFrame *picture,
  1132. int *got_picture_ptr,
  1133. uint8_t *buf, int buf_size);
  1134. int avcodec_parse_frame(AVCodecContext *avctx, uint8_t **pdata,
  1135. int *data_size_ptr,
  1136. uint8_t *buf, int buf_size);
  1137. int avcodec_encode_audio(AVCodecContext *avctx, uint8_t *buf, int buf_size,
  1138. const short *samples);
  1139. int avcodec_encode_video(AVCodecContext *avctx, uint8_t *buf, int buf_size,
  1140. const AVFrame *pict);
  1141. int avcodec_close(AVCodecContext *avctx);
  1142. void avcodec_register_all(void);
  1143. void avcodec_flush_buffers(AVCodecContext *avctx);
  1144. /* misc usefull functions */
  1145. /**
  1146. * reduce a fraction.
  1147. * this is usefull for framerate calculations
  1148. * @param max the maximum allowed for dst_nom & dst_den
  1149. * @return 1 if exact, 0 otherwise
  1150. */
  1151. int av_reduce(int *dst_nom, int *dst_den, int64_t nom, int64_t den, int64_t max);
  1152. /**
  1153. * rescale a 64bit integer.
  1154. * a simple a*b/c isnt possible as it can overflow
  1155. */
  1156. int64_t av_rescale(int64_t a, int b, int c);
  1157. /**
  1158. * Interface for 0.5.0 version
  1159. *
  1160. * do not even think about it's usage for this moment
  1161. */
  1162. typedef struct {
  1163. /// compressed size used from given memory buffer
  1164. int size;
  1165. /// I/P/B frame type
  1166. int frame_type;
  1167. } avc_enc_result_t;
  1168. /**
  1169. * Commands
  1170. * order can't be changed - once it was defined
  1171. */
  1172. typedef enum {
  1173. // general commands
  1174. AVC_OPEN_BY_NAME = 0xACA000,
  1175. AVC_OPEN_BY_CODEC_ID,
  1176. AVC_OPEN_BY_FOURCC,
  1177. AVC_CLOSE,
  1178. AVC_FLUSH,
  1179. // pin - struct { uint8_t* src, uint_t src_size }
  1180. // pout - struct { AVPicture* img, consumed_bytes,
  1181. AVC_DECODE,
  1182. // pin - struct { AVPicture* img, uint8_t* dest, uint_t dest_size }
  1183. // pout - uint_t used_from_dest_size
  1184. AVC_ENCODE,
  1185. // query/get video commands
  1186. AVC_GET_VERSION = 0xACB000,
  1187. AVC_GET_WIDTH,
  1188. AVC_GET_HEIGHT,
  1189. AVC_GET_DELAY,
  1190. AVC_GET_QUANT_TABLE,
  1191. // ...
  1192. // query/get audio commands
  1193. AVC_GET_FRAME_SIZE = 0xABC000,
  1194. // maybe define some simple structure which
  1195. // might be passed to the user - but they can't
  1196. // contain any codec specific parts and these
  1197. // calls are usualy necessary only few times
  1198. // set video commands
  1199. AVC_SET_WIDTH = 0xACD000,
  1200. AVC_SET_HEIGHT,
  1201. // set video encoding commands
  1202. AVC_SET_FRAME_RATE = 0xACD800,
  1203. AVC_SET_QUALITY,
  1204. AVC_SET_HURRY_UP,
  1205. // set audio commands
  1206. AVC_SET_SAMPLE_RATE = 0xACE000,
  1207. AVC_SET_CHANNELS,
  1208. } avc_cmd_t;
  1209. /**
  1210. * \param handle allocated private structure by libavcodec
  1211. * for initialization pass NULL - will be returned pout
  1212. * user is supposed to know nothing about its structure
  1213. * \param cmd type of operation to be performed
  1214. * \param pint input parameter
  1215. * \param pout output parameter
  1216. *
  1217. * \returns command status - eventually for query command it might return
  1218. * integer resulting value
  1219. */
  1220. int avcodec(void* handle, avc_cmd_t cmd, void* pin, void* pout);
  1221. /* memory */
  1222. void *av_malloc(unsigned int size);
  1223. void *av_mallocz(unsigned int size);
  1224. void *av_realloc(void *ptr, unsigned int size);
  1225. void av_free(void *ptr);
  1226. char *av_strdup(const char *s);
  1227. void __av_freep(void **ptr);
  1228. #define av_freep(p) __av_freep((void **)(p))
  1229. void *av_fast_realloc(void *ptr, unsigned int *size, unsigned int min_size);
  1230. /* for static data only */
  1231. /* call av_free_static to release all staticaly allocated tables */
  1232. void av_free_static(void);
  1233. void *__av_mallocz_static(void** location, unsigned int size);
  1234. #define av_mallocz_static(p, s) __av_mallocz_static((void **)(p), s)
  1235. #ifdef __cplusplus
  1236. }
  1237. #endif
  1238. #endif /* AVCODEC_H */