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.

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