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.

1945 lines
57KB

  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. #include "rational.h"
  12. #include <sys/types.h> /* size_t */
  13. #define FFMPEG_VERSION_INT 0x000408
  14. #define FFMPEG_VERSION "0.4.8"
  15. #define LIBAVCODEC_BUILD 4693
  16. #define LIBAVCODEC_VERSION_INT FFMPEG_VERSION_INT
  17. #define LIBAVCODEC_VERSION FFMPEG_VERSION
  18. #define AV_STRINGIFY(s) AV_TOSTRING(s)
  19. #define AV_TOSTRING(s) #s
  20. #define LIBAVCODEC_IDENT "FFmpeg" LIBAVCODEC_VERSION "b" AV_STRINGIFY(LIBAVCODEC_BUILD)
  21. enum CodecID {
  22. CODEC_ID_NONE,
  23. CODEC_ID_MPEG1VIDEO,
  24. CODEC_ID_MPEG2VIDEO, /* prefered ID for MPEG Video 1 or 2 decoding */
  25. CODEC_ID_MPEG2VIDEO_XVMC,
  26. CODEC_ID_H263,
  27. CODEC_ID_RV10,
  28. CODEC_ID_RV20,
  29. CODEC_ID_MP2,
  30. CODEC_ID_MP3, /* prefered ID for MPEG Audio layer 1, 2 or3 decoding */
  31. CODEC_ID_VORBIS,
  32. CODEC_ID_AC3,
  33. CODEC_ID_MJPEG,
  34. CODEC_ID_MJPEGB,
  35. CODEC_ID_LJPEG,
  36. CODEC_ID_SP5X,
  37. CODEC_ID_MPEG4,
  38. CODEC_ID_RAWVIDEO,
  39. CODEC_ID_MSMPEG4V1,
  40. CODEC_ID_MSMPEG4V2,
  41. CODEC_ID_MSMPEG4V3,
  42. CODEC_ID_WMV1,
  43. CODEC_ID_WMV2,
  44. CODEC_ID_H263P,
  45. CODEC_ID_H263I,
  46. CODEC_ID_FLV1,
  47. CODEC_ID_SVQ1,
  48. CODEC_ID_SVQ3,
  49. CODEC_ID_DVVIDEO,
  50. CODEC_ID_DVAUDIO,
  51. CODEC_ID_WMAV1,
  52. CODEC_ID_WMAV2,
  53. CODEC_ID_MACE3,
  54. CODEC_ID_MACE6,
  55. CODEC_ID_HUFFYUV,
  56. CODEC_ID_CYUV,
  57. CODEC_ID_H264,
  58. CODEC_ID_INDEO3,
  59. CODEC_ID_VP3,
  60. CODEC_ID_THEORA,
  61. CODEC_ID_AAC,
  62. CODEC_ID_MPEG4AAC,
  63. CODEC_ID_ASV1,
  64. CODEC_ID_ASV2,
  65. CODEC_ID_FFV1,
  66. CODEC_ID_4XM,
  67. CODEC_ID_VCR1,
  68. CODEC_ID_CLJR,
  69. CODEC_ID_MDEC,
  70. CODEC_ID_ROQ,
  71. CODEC_ID_INTERPLAY_VIDEO,
  72. CODEC_ID_XAN_WC3,
  73. CODEC_ID_XAN_WC4,
  74. CODEC_ID_RPZA,
  75. CODEC_ID_CINEPAK,
  76. CODEC_ID_WS_VQA,
  77. CODEC_ID_MSRLE,
  78. CODEC_ID_MSVIDEO1,
  79. CODEC_ID_IDCIN,
  80. CODEC_ID_8BPS,
  81. CODEC_ID_SMC,
  82. CODEC_ID_FLIC,
  83. /* various pcm "codecs" */
  84. CODEC_ID_PCM_S16LE,
  85. CODEC_ID_PCM_S16BE,
  86. CODEC_ID_PCM_U16LE,
  87. CODEC_ID_PCM_U16BE,
  88. CODEC_ID_PCM_S8,
  89. CODEC_ID_PCM_U8,
  90. CODEC_ID_PCM_MULAW,
  91. CODEC_ID_PCM_ALAW,
  92. /* various adpcm codecs */
  93. CODEC_ID_ADPCM_IMA_QT,
  94. CODEC_ID_ADPCM_IMA_WAV,
  95. CODEC_ID_ADPCM_IMA_DK3,
  96. CODEC_ID_ADPCM_IMA_DK4,
  97. CODEC_ID_ADPCM_IMA_WS,
  98. CODEC_ID_ADPCM_MS,
  99. CODEC_ID_ADPCM_4XM,
  100. CODEC_ID_ADPCM_XA,
  101. CODEC_ID_ADPCM_ADX,
  102. /* AMR */
  103. CODEC_ID_AMR_NB,
  104. CODEC_ID_AMR_WB,
  105. /* RealAudio codecs*/
  106. CODEC_ID_RA_144,
  107. CODEC_ID_RA_288,
  108. /* various DPCM codecs */
  109. CODEC_ID_ROQ_DPCM,
  110. CODEC_ID_INTERPLAY_DPCM,
  111. CODEC_ID_XAN_DPCM,
  112. CODEC_ID_MPEG2TS, /* _FAKE_ codec to indicate a raw MPEG2 transport
  113. stream (only used by libavformat) */
  114. };
  115. /* CODEC_ID_MP3LAME is absolete */
  116. #define CODEC_ID_MP3LAME CODEC_ID_MP3
  117. enum CodecType {
  118. CODEC_TYPE_UNKNOWN = -1,
  119. CODEC_TYPE_VIDEO,
  120. CODEC_TYPE_AUDIO,
  121. CODEC_TYPE_DATA,
  122. };
  123. /**
  124. * Pixel format. Notes:
  125. *
  126. * PIX_FMT_RGBA32 is handled in an endian-specific manner. A RGBA
  127. * color is put together as:
  128. * (A << 24) | (R << 16) | (G << 8) | B
  129. * This is stored as BGRA on little endian CPU architectures and ARGB on
  130. * big endian CPUs.
  131. *
  132. * When the pixel format is palettized RGB (PIX_FMT_PAL8), the palettized
  133. * image data is stored in AVFrame.data[0]. The palette is transported in
  134. * AVFrame.data[1] and, is 1024 bytes long (256 4-byte entries) and is
  135. * formatted the same as in PIX_FMT_RGBA32 described above (i.e., it is
  136. * also endian-specific). Note also that the individual RGB palette
  137. * components stored in AVFrame.data[1] should be in the range 0..255.
  138. * This is important as many custom PAL8 video codecs that were designed
  139. * to run on the IBM VGA graphics adapter use 6-bit palette components.
  140. */
  141. enum PixelFormat {
  142. PIX_FMT_YUV420P, ///< Planar YUV 4:2:0 (1 Cr & Cb sample per 2x2 Y samples)
  143. PIX_FMT_YUV422,
  144. PIX_FMT_RGB24, ///< Packed pixel, 3 bytes per pixel, RGBRGB...
  145. PIX_FMT_BGR24, ///< Packed pixel, 3 bytes per pixel, BGRBGR...
  146. PIX_FMT_YUV422P, ///< Planar YUV 4:2:2 (1 Cr & Cb sample per 2x1 Y samples)
  147. PIX_FMT_YUV444P, ///< Planar YUV 4:4:4 (1 Cr & Cb sample per 1x1 Y samples)
  148. PIX_FMT_RGBA32, ///< Packed pixel, 4 bytes per pixel, BGRABGRA..., stored in cpu endianness
  149. PIX_FMT_YUV410P, ///< Planar YUV 4:1:0 (1 Cr & Cb sample per 4x4 Y samples)
  150. PIX_FMT_YUV411P, ///< Planar YUV 4:1:1 (1 Cr & Cb sample per 4x1 Y samples)
  151. PIX_FMT_RGB565, ///< always stored in cpu endianness
  152. PIX_FMT_RGB555, ///< always stored in cpu endianness, most significant bit to 1
  153. PIX_FMT_GRAY8,
  154. PIX_FMT_MONOWHITE, ///< 0 is white
  155. PIX_FMT_MONOBLACK, ///< 0 is black
  156. PIX_FMT_PAL8, ///< 8 bit with RGBA palette
  157. PIX_FMT_YUVJ420P, ///< Planar YUV 4:2:0 full scale (jpeg)
  158. PIX_FMT_YUVJ422P, ///< Planar YUV 4:2:2 full scale (jpeg)
  159. PIX_FMT_YUVJ444P, ///< Planar YUV 4:4:4 full scale (jpeg)
  160. PIX_FMT_XVMC_MPEG2_MC,///< XVideo Motion Acceleration via common packet passing(xvmc_render.h)
  161. PIX_FMT_XVMC_MPEG2_IDCT,
  162. PIX_FMT_NB,
  163. };
  164. /* currently unused, may be used if 24/32 bits samples ever supported */
  165. enum SampleFormat {
  166. SAMPLE_FMT_S16 = 0, ///< signed 16 bits
  167. };
  168. /* in bytes */
  169. #define AVCODEC_MAX_AUDIO_FRAME_SIZE 131072
  170. /**
  171. * Required number of additionally allocated bytes at the end of the input bitstream for decoding.
  172. * this is mainly needed because some optimized bitstream readers read
  173. * 32 or 64 bit at once and could read over the end<br>
  174. * Note, if the first 23 bits of the additional bytes are not 0 then damaged
  175. * MPEG bitstreams could cause overread and segfault
  176. */
  177. #define FF_INPUT_BUFFER_PADDING_SIZE 8
  178. /* motion estimation type, EPZS by default */
  179. enum Motion_Est_ID {
  180. ME_ZERO = 1,
  181. ME_FULL,
  182. ME_LOG,
  183. ME_PHODS,
  184. ME_EPZS,
  185. ME_X1
  186. };
  187. typedef struct RcOverride{
  188. int start_frame;
  189. int end_frame;
  190. int qscale; // if this is 0 then quality_factor will be used instead
  191. float quality_factor;
  192. } RcOverride;
  193. /* only for ME compatiblity with old apps */
  194. extern int motion_estimation_method;
  195. /* ME algos sorted by quality */
  196. //FIXME remove IMHO
  197. static const __attribute__((unused)) int Motion_Est_QTab[] =
  198. { ME_ZERO, ME_PHODS, ME_LOG, ME_X1, ME_EPZS, ME_FULL };
  199. #define FF_MAX_B_FRAMES 8
  200. /* encoding support
  201. these flags can be passed in AVCodecContext.flags before initing
  202. Note: note not everything is supported yet
  203. */
  204. #define CODEC_FLAG_QSCALE 0x0002 ///< use fixed qscale
  205. #define CODEC_FLAG_4MV 0x0004 ///< 4 MV per MB allowed / Advanced prediction for H263
  206. #define CODEC_FLAG_QPEL 0x0010 ///< use qpel MC
  207. #define CODEC_FLAG_GMC 0x0020 ///< use GMC
  208. #define CODEC_FLAG_MV0 0x0040 ///< always try a MB with MV=<0,0>
  209. #define CODEC_FLAG_PART 0x0080 ///< use data partitioning
  210. /* parent program gurantees that the input for b-frame containing streams is not written to
  211. for at least s->max_b_frames+1 frames, if this is not set than the input will be copied */
  212. #define CODEC_FLAG_INPUT_PRESERVED 0x0100
  213. #define CODEC_FLAG_PASS1 0x0200 ///< use internal 2pass ratecontrol in first pass mode
  214. #define CODEC_FLAG_PASS2 0x0400 ///< use internal 2pass ratecontrol in second pass mode
  215. #define CODEC_FLAG_EXTERN_HUFF 0x1000 ///< use external huffman table (for mjpeg)
  216. #define CODEC_FLAG_GRAY 0x2000 ///< only decode/encode grayscale
  217. #define CODEC_FLAG_EMU_EDGE 0x4000///< dont draw edges
  218. #define CODEC_FLAG_PSNR 0x8000 ///< error[?] variables will be set during encoding
  219. #define CODEC_FLAG_TRUNCATED 0x00010000 /** input bitstream might be truncated at a random location instead
  220. of only at frame boundaries */
  221. #define CODEC_FLAG_NORMALIZE_AQP 0x00020000 ///< normalize adaptive quantization
  222. #define CODEC_FLAG_INTERLACED_DCT 0x00040000 ///< use interlaced dct
  223. #define CODEC_FLAG_LOW_DELAY 0x00080000 ///< force low delay
  224. #define CODEC_FLAG_ALT_SCAN 0x00100000 ///< use alternate scan
  225. #define CODEC_FLAG_TRELLIS_QUANT 0x00200000 ///< use trellis quantization
  226. #define CODEC_FLAG_GLOBAL_HEADER 0x00400000 ///< place global headers in extradata instead of every keyframe
  227. #define CODEC_FLAG_BITEXACT 0x00800000 ///< use only bitexact stuff (except (i)dct)
  228. /* Fx : Flag for h263+ extra options */
  229. #define CODEC_FLAG_H263P_AIC 0x01000000 ///< H263 Advanced intra coding / MPEG4 AC prediction (remove this)
  230. #define CODEC_FLAG_AC_PRED 0x01000000 ///< H263 Advanced intra coding / MPEG4 AC prediction
  231. #define CODEC_FLAG_H263P_UMV 0x02000000 ///< Unlimited motion vector
  232. #define CODEC_FLAG_CBP_RD 0x04000000 ///< use rate distortion optimization for cbp
  233. #define CODEC_FLAG_QP_RD 0x08000000 ///< use rate distortion optimization for qp selectioon
  234. #define CODEC_FLAG_H263P_AIV 0x00000008 ///< H263 Alternative inter vlc
  235. #define CODEC_FLAG_OBMC 0x00000001 ///< OBMC
  236. #define CODEC_FLAG_LOOP_FILTER 0x00000800 ///< loop filter
  237. /* For advanced prediction mode, we reuse the 4MV flag */
  238. /* Unsupported options :
  239. * Syntax Arithmetic coding (SAC)
  240. * Deblocking filter internal loop
  241. * Slice structured
  242. * Reference Picture Selection
  243. * Independant Segment Decoding
  244. * Modified Quantization */
  245. /* /Fx */
  246. /* codec capabilities */
  247. #define CODEC_CAP_DRAW_HORIZ_BAND 0x0001 ///< decoder can use draw_horiz_band callback
  248. /**
  249. * Codec uses get_buffer() for allocating buffers.
  250. * direct rendering method 1
  251. */
  252. #define CODEC_CAP_DR1 0x0002
  253. /* if 'parse_only' field is true, then avcodec_parse_frame() can be
  254. used */
  255. #define CODEC_CAP_PARSE_ONLY 0x0004
  256. #define CODEC_CAP_TRUNCATED 0x0008
  257. /**
  258. * Pan Scan area.
  259. * this specifies the area which should be displayed. Note there may be multiple such areas for one frame
  260. */
  261. typedef struct AVPanScan{
  262. /**
  263. * id.
  264. * - encoding: set by user.
  265. * - decoding: set by lavc
  266. */
  267. int id;
  268. /**
  269. * width and height in 1/16 pel
  270. * - encoding: set by user.
  271. * - decoding: set by lavc
  272. */
  273. int width;
  274. int height;
  275. /**
  276. * position of the top left corner in 1/16 pel for up to 3 fields/frames.
  277. * - encoding: set by user.
  278. * - decoding: set by lavc
  279. */
  280. int16_t position[3][2];
  281. }AVPanScan;
  282. #define FF_COMMON_FRAME \
  283. /**\
  284. * pointer to the picture planes.\
  285. * this might be different from the first allocated byte\
  286. * - encoding: \
  287. * - decoding: \
  288. */\
  289. uint8_t *data[4];\
  290. int linesize[4];\
  291. /**\
  292. * pointer to the first allocated byte of the picture. can be used in get_buffer/release_buffer\
  293. * this isnt used by lavc unless the default get/release_buffer() is used\
  294. * - encoding: \
  295. * - decoding: \
  296. */\
  297. uint8_t *base[4];\
  298. /**\
  299. * 1 -> keyframe, 0-> not\
  300. * - encoding: set by lavc\
  301. * - decoding: set by lavc\
  302. */\
  303. int key_frame;\
  304. \
  305. /**\
  306. * picture type of the frame, see ?_TYPE below.\
  307. * - encoding: set by lavc for coded_picture (and set by user for input)\
  308. * - decoding: set by lavc\
  309. */\
  310. int pict_type;\
  311. \
  312. /**\
  313. * presentation timestamp in micro seconds (time when frame should be shown to user)\
  314. * if 0 then the frame_rate will be used as reference\
  315. * - encoding: MUST be set by user\
  316. * - decoding: set by lavc\
  317. */\
  318. int64_t pts;\
  319. \
  320. /**\
  321. * picture number in bitstream order.\
  322. * - encoding: set by\
  323. * - decoding: set by lavc\
  324. */\
  325. int coded_picture_number;\
  326. /**\
  327. * picture number in display order.\
  328. * - encoding: set by\
  329. * - decoding: set by lavc\
  330. */\
  331. int display_picture_number;\
  332. \
  333. /**\
  334. * quality (between 1 (good) and FF_LAMBDA_MAX (bad)) \
  335. * - encoding: set by lavc for coded_picture (and set by user for input)\
  336. * - decoding: set by lavc\
  337. */\
  338. int quality; \
  339. \
  340. /**\
  341. * buffer age (1->was last buffer and dint change, 2->..., ...).\
  342. * set to INT_MAX if the buffer has not been used yet \
  343. * - encoding: unused\
  344. * - decoding: MUST be set by get_buffer()\
  345. */\
  346. int age;\
  347. \
  348. /**\
  349. * is this picture used as reference\
  350. * - encoding: unused\
  351. * - decoding: set by lavc (before get_buffer() call))\
  352. */\
  353. int reference;\
  354. \
  355. /**\
  356. * QP table\
  357. * - encoding: unused\
  358. * - decoding: set by lavc\
  359. */\
  360. int8_t *qscale_table;\
  361. /**\
  362. * QP store stride\
  363. * - encoding: unused\
  364. * - decoding: set by lavc\
  365. */\
  366. int qstride;\
  367. \
  368. /**\
  369. * mbskip_table[mb]>=1 if MB didnt change\
  370. * stride= mb_width = (width+15)>>4\
  371. * - encoding: unused\
  372. * - decoding: set by lavc\
  373. */\
  374. uint8_t *mbskip_table;\
  375. \
  376. /**\
  377. * for some private data of the user\
  378. * - encoding: unused\
  379. * - decoding: set by user\
  380. */\
  381. void *opaque;\
  382. \
  383. /**\
  384. * error\
  385. * - encoding: set by lavc if flags&CODEC_FLAG_PSNR\
  386. * - decoding: unused\
  387. */\
  388. uint64_t error[4];\
  389. \
  390. /**\
  391. * type of the buffer (to keep track of who has to dealloc data[*])\
  392. * - encoding: set by the one who allocs it\
  393. * - decoding: set by the one who allocs it\
  394. * Note: user allocated (direct rendering) & internal buffers can not coexist currently\
  395. */\
  396. int type;\
  397. \
  398. /**\
  399. * when decoding, this signal how much the picture must be delayed.\
  400. * extra_delay = repeat_pict / (2*fps)\
  401. * - encoding: unused\
  402. * - decoding: set by lavc\
  403. */\
  404. int repeat_pict;\
  405. \
  406. /**\
  407. * \
  408. */\
  409. int qscale_type;\
  410. \
  411. /**\
  412. * The content of the picture is interlaced.\
  413. * - encoding: set by user\
  414. * - decoding: set by lavc (default 0)\
  415. */\
  416. int interlaced_frame;\
  417. \
  418. /**\
  419. * if the content is interlaced, is top field displayed first.\
  420. * - encoding: set by user\
  421. * - decoding: set by lavc\
  422. */\
  423. int top_field_first;\
  424. \
  425. /**\
  426. * Pan scan.\
  427. * - encoding: set by user\
  428. * - decoding: set by lavc\
  429. */\
  430. AVPanScan *pan_scan;\
  431. \
  432. /**\
  433. * tell user application that palette has changed from previous frame.\
  434. * - encoding: ??? (no palette-enabled encoder yet)\
  435. * - decoding: set by lavc (default 0)\
  436. */\
  437. int palette_has_changed;\
  438. \
  439. /**\
  440. * Codec suggestion on buffer type if != 0\
  441. * - encoding: unused\
  442. * - decoding: set by lavc (before get_buffer() call))\
  443. */\
  444. int buffer_hints;\
  445. #define FF_QSCALE_TYPE_MPEG1 0
  446. #define FF_QSCALE_TYPE_MPEG2 1
  447. #define FF_BUFFER_TYPE_INTERNAL 1
  448. #define FF_BUFFER_TYPE_USER 2 ///< Direct rendering buffers (image is (de)allocated by user)
  449. #define FF_BUFFER_TYPE_SHARED 4 ///< buffer from somewher else, dont dealloc image (data/base)
  450. #define FF_BUFFER_TYPE_COPY 8 ///< just a (modified) copy of some other buffer, dont dealloc anything
  451. #define FF_I_TYPE 1 // Intra
  452. #define FF_P_TYPE 2 // Predicted
  453. #define FF_B_TYPE 3 // Bi-dir predicted
  454. #define FF_S_TYPE 4 // S(GMC)-VOP MPEG4
  455. #define FF_SI_TYPE 5
  456. #define FF_SP_TYPE 6
  457. #define FF_BUFFER_HINTS_VALID 0x01 // Buffer hints value is meaningful (if 0 ignore)
  458. #define FF_BUFFER_HINTS_READABLE 0x02 // Codec will read from buffer
  459. #define FF_BUFFER_HINTS_PRESERVE 0x04 // User must not alter buffer content
  460. #define FF_BUFFER_HINTS_REUSABLE 0x08 // Codec will reuse the buffer (update)
  461. /**
  462. * Audio Video Frame.
  463. */
  464. typedef struct AVFrame {
  465. FF_COMMON_FRAME
  466. } AVFrame;
  467. #define DEFAULT_FRAME_RATE_BASE 1001000
  468. /**
  469. * main external api structure.
  470. */
  471. typedef struct AVCodecContext {
  472. /**
  473. * the average bitrate.
  474. * - encoding: set by user. unused for constant quantizer encoding
  475. * - decoding: set by lavc. 0 or some bitrate if this info is available in the stream
  476. */
  477. int bit_rate;
  478. /**
  479. * number of bits the bitstream is allowed to diverge from the reference.
  480. * the reference can be CBR (for CBR pass1) or VBR (for pass2)
  481. * - encoding: set by user. unused for constant quantizer encoding
  482. * - decoding: unused
  483. */
  484. int bit_rate_tolerance;
  485. /**
  486. * CODEC_FLAG_*.
  487. * - encoding: set by user.
  488. * - decoding: set by user.
  489. */
  490. int flags;
  491. /**
  492. * some codecs needs additionnal format info. It is stored here
  493. * - encoding: set by user.
  494. * - decoding: set by lavc. (FIXME is this ok?)
  495. */
  496. int sub_id;
  497. /**
  498. * motion estimation algorithm used for video coding.
  499. * - encoding: MUST be set by user.
  500. * - decoding: unused
  501. */
  502. int me_method;
  503. /**
  504. * some codecs need / can use extra-data like huffman tables.
  505. * mjpeg: huffman tables
  506. * rv10: additional flags
  507. * mpeg4: global headers (they can be in the bitstream or here)
  508. * - encoding: set/allocated/freed by lavc.
  509. * - decoding: set/allocated/freed by user.
  510. */
  511. void *extradata;
  512. int extradata_size;
  513. /* video only */
  514. /**
  515. * frames per sec multiplied by frame_rate_base.
  516. * for variable fps this is the precission, so if the timestamps
  517. * can be specified in msec precssion then this is 1000*frame_rate_base
  518. * - encoding: MUST be set by user
  519. * - decoding: set by lavc. 0 or the frame_rate if available
  520. */
  521. int frame_rate;
  522. /**
  523. * width / height.
  524. * - encoding: MUST be set by user.
  525. * - decoding: set by user if known, codec should override / dynamically change if needed
  526. */
  527. int width, height;
  528. #define FF_ASPECT_SQUARE 1
  529. #define FF_ASPECT_4_3_625 2
  530. #define FF_ASPECT_4_3_525 3
  531. #define FF_ASPECT_16_9_625 4
  532. #define FF_ASPECT_16_9_525 5
  533. #define FF_ASPECT_EXTENDED 15
  534. /**
  535. * the number of pictures in a group of pitures, or 0 for intra_only.
  536. * - encoding: set by user.
  537. * - decoding: unused
  538. */
  539. int gop_size;
  540. /**
  541. * pixel format, see PIX_FMT_xxx.
  542. * - encoding: FIXME: used by ffmpeg to decide whether an pix_fmt
  543. * conversion is in order. This only works for
  544. * codecs with one supported pix_fmt, we should
  545. * do something for a generic case as well.
  546. * - decoding: set by lavc.
  547. */
  548. enum PixelFormat pix_fmt;
  549. /**
  550. * Frame rate emulation. If not zero lower layer (i.e. format handler)
  551. * has to read frames at native frame rate.
  552. * - encoding: set by user.
  553. * - decoding: unused.
  554. */
  555. int rate_emu;
  556. /**
  557. * if non NULL, 'draw_horiz_band' is called by the libavcodec
  558. * decoder to draw an horizontal band. It improve cache usage. Not
  559. * all codecs can do that. You must check the codec capabilities
  560. * before
  561. * - encoding: unused
  562. * - decoding: set by user.
  563. * @param height the height of the slice
  564. * @param y the y position of the slice
  565. * @param type 1->top field, 2->bottom field, 3->frame
  566. * @param offset offset into the AVFrame.data from which the slice should be read
  567. */
  568. void (*draw_horiz_band)(struct AVCodecContext *s,
  569. const AVFrame *src, int offset[4],
  570. int y, int type, int height);
  571. /* audio only */
  572. int sample_rate; ///< samples per sec
  573. int channels;
  574. int sample_fmt; ///< sample format, currenly unused
  575. /* the following data should not be initialized */
  576. int frame_size; ///< in samples, initialized when calling 'init'
  577. int frame_number; ///< audio or video frame number
  578. int real_pict_num; ///< returns the real picture number of previous encoded frame
  579. /**
  580. * number of frames the decoded output will be delayed relative to
  581. * the encoded input.
  582. * - encoding: set by lavc.
  583. * - decoding: unused
  584. */
  585. int delay;
  586. /* - encoding parameters */
  587. float qcompress; ///< amount of qscale change between easy & hard scenes (0.0-1.0)
  588. float qblur; ///< amount of qscale smoothing over time (0.0-1.0)
  589. /**
  590. * minimum quantizer.
  591. * - encoding: set by user.
  592. * - decoding: unused
  593. */
  594. int qmin;
  595. /**
  596. * maximum quantizer.
  597. * - encoding: set by user.
  598. * - decoding: unused
  599. */
  600. int qmax;
  601. /**
  602. * maximum quantizer difference etween frames.
  603. * - encoding: set by user.
  604. * - decoding: unused
  605. */
  606. int max_qdiff;
  607. /**
  608. * maximum number of b frames between non b frames.
  609. * note: the output will be delayed by max_b_frames+1 relative to the input
  610. * - encoding: set by user.
  611. * - decoding: unused
  612. */
  613. int max_b_frames;
  614. /**
  615. * qscale factor between ip and b frames.
  616. * - encoding: set by user.
  617. * - decoding: unused
  618. */
  619. float b_quant_factor;
  620. /** obsolete FIXME remove */
  621. int rc_strategy;
  622. int b_frame_strategy;
  623. /**
  624. * hurry up amount.
  625. * - encoding: unused
  626. * - decoding: set by user. 1-> skip b frames, 2-> skip idct/dequant too, 5-> skip everything except header
  627. */
  628. int hurry_up;
  629. struct AVCodec *codec;
  630. void *priv_data;
  631. /* The following data is for RTP friendly coding */
  632. /* By now only H.263/H.263+/MPEG4 coder honours this */
  633. int rtp_mode; /* 1 for activate RTP friendly-mode */
  634. /* highers numbers represent more error-prone */
  635. /* enviroments, by now just "1" exist */
  636. int rtp_payload_size; /* The size of the RTP payload, the coder will */
  637. /* do it's best to deliver a chunk with size */
  638. /* below rtp_payload_size, the chunk will start */
  639. /* with a start code on some codecs like H.263 */
  640. /* This doesn't take account of any particular */
  641. /* headers inside the transmited RTP payload */
  642. /* The RTP callcack: This function is called */
  643. /* every time the encoder as a packet to send */
  644. /* Depends on the encoder if the data starts */
  645. /* with a Start Code (it should) H.263 does */
  646. void (*rtp_callback)(void *data, int size, int packet_number);
  647. /* statistics, used for 2-pass encoding */
  648. int mv_bits;
  649. int header_bits;
  650. int i_tex_bits;
  651. int p_tex_bits;
  652. int i_count;
  653. int p_count;
  654. int skip_count;
  655. int misc_bits;
  656. /**
  657. * number of bits used for the previously encoded frame.
  658. * - encoding: set by lavc
  659. * - decoding: unused
  660. */
  661. int frame_bits;
  662. /**
  663. * private data of the user, can be used to carry app specific stuff.
  664. * - encoding: set by user
  665. * - decoding: set by user
  666. */
  667. void *opaque;
  668. char codec_name[32];
  669. enum CodecType codec_type; /* see CODEC_TYPE_xxx */
  670. enum CodecID codec_id; /* see CODEC_ID_xxx */
  671. /**
  672. * fourcc (LSB first, so "ABCD" -> ('D'<<24) + ('C'<<16) + ('B'<<8) + 'A').
  673. * this is used to workaround some encoder bugs
  674. * - encoding: set by user, if not then the default based on codec_id will be used
  675. * - decoding: set by user, will be converted to upper case by lavc during init
  676. */
  677. unsigned int codec_tag;
  678. /**
  679. * workaround bugs in encoders which sometimes cannot be detected automatically.
  680. * - encoding: unused
  681. * - decoding: set by user
  682. */
  683. int workaround_bugs;
  684. #define FF_BUG_AUTODETECT 1 ///< autodetection
  685. #define FF_BUG_OLD_MSMPEG4 2
  686. #define FF_BUG_XVID_ILACE 4
  687. #define FF_BUG_UMP4 8
  688. #define FF_BUG_NO_PADDING 16
  689. #define FF_BUG_AC_VLC 0 ///< will be removed, libavcodec can now handle these non compliant files by default
  690. #define FF_BUG_QPEL_CHROMA 64
  691. #define FF_BUG_STD_QPEL 128
  692. #define FF_BUG_QPEL_CHROMA2 256
  693. #define FF_BUG_DIRECT_BLOCKSIZE 512
  694. #define FF_BUG_EDGE 1024
  695. //#define FF_BUG_FAKE_SCALABILITY 16 //autodetection should work 100%
  696. /**
  697. * luma single coeff elimination threshold.
  698. * - encoding: set by user
  699. * - decoding: unused
  700. */
  701. int luma_elim_threshold;
  702. /**
  703. * chroma single coeff elimination threshold.
  704. * - encoding: set by user
  705. * - decoding: unused
  706. */
  707. int chroma_elim_threshold;
  708. /**
  709. * strictly follow the std (MPEG4, ...).
  710. * - encoding: set by user
  711. * - decoding: unused
  712. */
  713. int strict_std_compliance;
  714. /**
  715. * qscale offset between ip and b frames.
  716. * if > 0 then the last p frame quantizer will be used (q= lastp_q*factor+offset)
  717. * if < 0 then normal ratecontrol will be done (q= -normal_q*factor+offset)
  718. * - encoding: set by user.
  719. * - decoding: unused
  720. */
  721. float b_quant_offset;
  722. /**
  723. * error resilience higher values will detect more errors but may missdetect
  724. * some more or less valid parts as errors.
  725. * - encoding: unused
  726. * - decoding: set by user
  727. */
  728. int error_resilience;
  729. #define FF_ER_CAREFULL 1
  730. #define FF_ER_COMPLIANT 2
  731. #define FF_ER_AGGRESSIVE 3
  732. #define FF_ER_VERY_AGGRESSIVE 4
  733. /**
  734. * called at the beginning of each frame to get a buffer for it.
  735. * if pic.reference is set then the frame will be read later by lavc
  736. * width and height should be rounded up to the next multiple of 16
  737. * - encoding: unused
  738. * - decoding: set by lavc, user can override
  739. */
  740. int (*get_buffer)(struct AVCodecContext *c, AVFrame *pic);
  741. /**
  742. * called to release buffers which where allocated with get_buffer.
  743. * a released buffer can be reused in get_buffer()
  744. * pic.data[*] must be set to NULL
  745. * - encoding: unused
  746. * - decoding: set by lavc, user can override
  747. */
  748. void (*release_buffer)(struct AVCodecContext *c, AVFrame *pic);
  749. /**
  750. * is 1 if the decoded stream contains b frames, 0 otherwise.
  751. * - encoding: unused
  752. * - decoding: set by lavc
  753. */
  754. int has_b_frames;
  755. int block_align; ///< used by some WAV based audio codecs
  756. int parse_only; /* - decoding only: if true, only parsing is done
  757. (function avcodec_parse_frame()). The frame
  758. data is returned. Only MPEG codecs support this now. */
  759. /**
  760. * 0-> h263 quant 1-> mpeg quant.
  761. * - encoding: set by user.
  762. * - decoding: unused
  763. */
  764. int mpeg_quant;
  765. /**
  766. * pass1 encoding statistics output buffer.
  767. * - encoding: set by lavc
  768. * - decoding: unused
  769. */
  770. char *stats_out;
  771. /**
  772. * pass2 encoding statistics input buffer.
  773. * concatenated stuff from stats_out of pass1 should be placed here
  774. * - encoding: allocated/set/freed by user
  775. * - decoding: unused
  776. */
  777. char *stats_in;
  778. /**
  779. * ratecontrol qmin qmax limiting method.
  780. * 0-> clipping, 1-> use a nice continous function to limit qscale wthin qmin/qmax
  781. * - encoding: set by user.
  782. * - decoding: unused
  783. */
  784. float rc_qsquish;
  785. float rc_qmod_amp;
  786. int rc_qmod_freq;
  787. /**
  788. * ratecontrol override, see RcOverride.
  789. * - encoding: allocated/set/freed by user.
  790. * - decoding: unused
  791. */
  792. RcOverride *rc_override;
  793. int rc_override_count;
  794. /**
  795. * rate control equation.
  796. * - encoding: set by user
  797. * - decoding: unused
  798. */
  799. char *rc_eq;
  800. /**
  801. * maximum bitrate.
  802. * - encoding: set by user.
  803. * - decoding: unused
  804. */
  805. int rc_max_rate;
  806. /**
  807. * minimum bitrate.
  808. * - encoding: set by user.
  809. * - decoding: unused
  810. */
  811. int rc_min_rate;
  812. /**
  813. * decoder bitstream buffer size.
  814. * - encoding: set by user.
  815. * - decoding: unused
  816. */
  817. int rc_buffer_size;
  818. float rc_buffer_aggressivity;
  819. /**
  820. * qscale factor between p and i frames.
  821. * - encoding: set by user.
  822. * - decoding: unused
  823. */
  824. float i_quant_factor;
  825. /**
  826. * qscale offset between p and i frames.
  827. * if > 0 then the last p frame quantizer will be used (q= lastp_q*factor+offset)
  828. * if < 0 then normal ratecontrol will be done (q= -normal_q*factor+offset)
  829. * - encoding: set by user.
  830. * - decoding: unused
  831. */
  832. float i_quant_offset;
  833. /**
  834. * initial complexity for pass1 ratecontrol.
  835. * - encoding: set by user.
  836. * - decoding: unused
  837. */
  838. float rc_initial_cplx;
  839. /**
  840. * dct algorithm, see FF_DCT_* below.
  841. * - encoding: set by user
  842. * - decoding: unused
  843. */
  844. int dct_algo;
  845. #define FF_DCT_AUTO 0
  846. #define FF_DCT_FASTINT 1
  847. #define FF_DCT_INT 2
  848. #define FF_DCT_MMX 3
  849. #define FF_DCT_MLIB 4
  850. #define FF_DCT_ALTIVEC 5
  851. #define FF_DCT_FAAN 6
  852. /**
  853. * luminance masking (0-> disabled).
  854. * - encoding: set by user
  855. * - decoding: unused
  856. */
  857. float lumi_masking;
  858. /**
  859. * temporary complexity masking (0-> disabled).
  860. * - encoding: set by user
  861. * - decoding: unused
  862. */
  863. float temporal_cplx_masking;
  864. /**
  865. * spatial complexity masking (0-> disabled).
  866. * - encoding: set by user
  867. * - decoding: unused
  868. */
  869. float spatial_cplx_masking;
  870. /**
  871. * p block masking (0-> disabled).
  872. * - encoding: set by user
  873. * - decoding: unused
  874. */
  875. float p_masking;
  876. /**
  877. * darkness masking (0-> disabled).
  878. * - encoding: set by user
  879. * - decoding: unused
  880. */
  881. float dark_masking;
  882. /* for binary compatibility */
  883. int unused;
  884. /**
  885. * idct algorithm, see FF_IDCT_* below.
  886. * - encoding: set by user
  887. * - decoding: set by user
  888. */
  889. int idct_algo;
  890. #define FF_IDCT_AUTO 0
  891. #define FF_IDCT_INT 1
  892. #define FF_IDCT_SIMPLE 2
  893. #define FF_IDCT_SIMPLEMMX 3
  894. #define FF_IDCT_LIBMPEG2MMX 4
  895. #define FF_IDCT_PS2 5
  896. #define FF_IDCT_MLIB 6
  897. #define FF_IDCT_ARM 7
  898. #define FF_IDCT_ALTIVEC 8
  899. #define FF_IDCT_SH4 9
  900. #define FF_IDCT_SIMPLEARM 10
  901. /**
  902. * slice count.
  903. * - encoding: set by lavc
  904. * - decoding: set by user (or 0)
  905. */
  906. int slice_count;
  907. /**
  908. * slice offsets in the frame in bytes.
  909. * - encoding: set/allocated by lavc
  910. * - decoding: set/allocated by user (or NULL)
  911. */
  912. int *slice_offset;
  913. /**
  914. * error concealment flags.
  915. * - encoding: unused
  916. * - decoding: set by user
  917. */
  918. int error_concealment;
  919. #define FF_EC_GUESS_MVS 1
  920. #define FF_EC_DEBLOCK 2
  921. /**
  922. * dsp_mask could be add used to disable unwanted CPU features
  923. * CPU features (i.e. MMX, SSE. ...)
  924. *
  925. * with FORCE flag you may instead enable given CPU features
  926. * (Dangerous: usable in case of misdetection, improper usage however will
  927. * result into program crash)
  928. */
  929. unsigned dsp_mask;
  930. #define FF_MM_FORCE 0x80000000 /* force usage of selected flags (OR) */
  931. /* lower 16 bits - CPU features */
  932. #ifdef HAVE_MMX
  933. #define FF_MM_MMX 0x0001 /* standard MMX */
  934. #define FF_MM_3DNOW 0x0004 /* AMD 3DNOW */
  935. #define FF_MM_MMXEXT 0x0002 /* SSE integer functions or AMD MMX ext */
  936. #define FF_MM_SSE 0x0008 /* SSE functions */
  937. #define FF_MM_SSE2 0x0010 /* PIV SSE2 functions */
  938. #endif /* HAVE_MMX */
  939. /**
  940. * bits per sample/pixel from the demuxer (needed for huffyuv).
  941. * - encoding: set by lavc
  942. * - decoding: set by user
  943. */
  944. int bits_per_sample;
  945. /**
  946. * prediction method (needed for huffyuv).
  947. * - encoding: set by user
  948. * - decoding: unused
  949. */
  950. int prediction_method;
  951. #define FF_PRED_LEFT 0
  952. #define FF_PRED_PLANE 1
  953. #define FF_PRED_MEDIAN 2
  954. /**
  955. * sample aspect ratio (0 if unknown).
  956. * numerator and denominator must be relative prime and smaller then 256 for some video standards
  957. * - encoding: set by user.
  958. * - decoding: set by lavc.
  959. */
  960. AVRational sample_aspect_ratio;
  961. /**
  962. * the picture in the bitstream.
  963. * - encoding: set by lavc
  964. * - decoding: set by lavc
  965. */
  966. AVFrame *coded_frame;
  967. /**
  968. * debug.
  969. * - encoding: set by user.
  970. * - decoding: set by user.
  971. */
  972. int debug;
  973. #define FF_DEBUG_PICT_INFO 1
  974. #define FF_DEBUG_RC 2
  975. #define FF_DEBUG_BITSTREAM 4
  976. #define FF_DEBUG_MB_TYPE 8
  977. #define FF_DEBUG_QP 16
  978. #define FF_DEBUG_MV 32
  979. #define FF_DEBUG_VIS_MV 0x00000040
  980. #define FF_DEBUG_SKIP 0x00000080
  981. #define FF_DEBUG_STARTCODE 0x00000100
  982. #define FF_DEBUG_PTS 0x00000200
  983. #define FF_DEBUG_ER 0x00000400
  984. #define FF_DEBUG_MMCO 0x00000800
  985. #define FF_DEBUG_BUGS 0x00001000
  986. /**
  987. * error.
  988. * - encoding: set by lavc if flags&CODEC_FLAG_PSNR
  989. * - decoding: unused
  990. */
  991. uint64_t error[4];
  992. /**
  993. * minimum MB quantizer.
  994. * - encoding: set by user.
  995. * - decoding: unused
  996. */
  997. int mb_qmin;
  998. /**
  999. * maximum MB quantizer.
  1000. * - encoding: set by user.
  1001. * - decoding: unused
  1002. */
  1003. int mb_qmax;
  1004. /**
  1005. * motion estimation compare function.
  1006. * - encoding: set by user.
  1007. * - decoding: unused
  1008. */
  1009. int me_cmp;
  1010. /**
  1011. * subpixel motion estimation compare function.
  1012. * - encoding: set by user.
  1013. * - decoding: unused
  1014. */
  1015. int me_sub_cmp;
  1016. /**
  1017. * macroblock compare function (not supported yet).
  1018. * - encoding: set by user.
  1019. * - decoding: unused
  1020. */
  1021. int mb_cmp;
  1022. #define FF_CMP_SAD 0
  1023. #define FF_CMP_SSE 1
  1024. #define FF_CMP_SATD 2
  1025. #define FF_CMP_DCT 3
  1026. #define FF_CMP_PSNR 4
  1027. #define FF_CMP_BIT 5
  1028. #define FF_CMP_RD 6
  1029. #define FF_CMP_ZERO 7
  1030. #define FF_CMP_CHROMA 256
  1031. /**
  1032. * ME diamond size & shape.
  1033. * - encoding: set by user.
  1034. * - decoding: unused
  1035. */
  1036. int dia_size;
  1037. /**
  1038. * amount of previous MV predictors (2a+1 x 2a+1 square).
  1039. * - encoding: set by user.
  1040. * - decoding: unused
  1041. */
  1042. int last_predictor_count;
  1043. /**
  1044. * pre pass for motion estimation.
  1045. * - encoding: set by user.
  1046. * - decoding: unused
  1047. */
  1048. int pre_me;
  1049. /**
  1050. * motion estimation pre pass compare function.
  1051. * - encoding: set by user.
  1052. * - decoding: unused
  1053. */
  1054. int me_pre_cmp;
  1055. /**
  1056. * ME pre pass diamond size & shape.
  1057. * - encoding: set by user.
  1058. * - decoding: unused
  1059. */
  1060. int pre_dia_size;
  1061. /**
  1062. * subpel ME quality.
  1063. * - encoding: set by user.
  1064. * - decoding: unused
  1065. */
  1066. int me_subpel_quality;
  1067. /**
  1068. * callback to negotiate the pixelFormat.
  1069. * @param fmt is the list of formats which are supported by the codec,
  1070. * its terminated by -1 as 0 is a valid format, the formats are ordered by quality
  1071. * the first is allways the native one
  1072. * @return the choosen format
  1073. * - encoding: unused
  1074. * - decoding: set by user, if not set then the native format will always be choosen
  1075. */
  1076. enum PixelFormat (*get_format)(struct AVCodecContext *s, enum PixelFormat * fmt);
  1077. /**
  1078. * DTG active format information (additionnal aspect ratio
  1079. * information only used in DVB MPEG2 transport streams). 0 if
  1080. * not set.
  1081. *
  1082. * - encoding: unused.
  1083. * - decoding: set by decoder
  1084. */
  1085. int dtg_active_format;
  1086. #define FF_DTG_AFD_SAME 8
  1087. #define FF_DTG_AFD_4_3 9
  1088. #define FF_DTG_AFD_16_9 10
  1089. #define FF_DTG_AFD_14_9 11
  1090. #define FF_DTG_AFD_4_3_SP_14_9 13
  1091. #define FF_DTG_AFD_16_9_SP_14_9 14
  1092. #define FF_DTG_AFD_SP_4_3 15
  1093. /**
  1094. * Maximum motion estimation search range in subpel units.
  1095. * if 0 then no limit
  1096. *
  1097. * - encoding: set by user.
  1098. * - decoding: unused.
  1099. */
  1100. int me_range;
  1101. /**
  1102. * frame_rate_base.
  1103. * for variable fps this is 1
  1104. * - encoding: set by user.
  1105. * - decoding: set by lavc.
  1106. * @todo move this after frame_rate
  1107. */
  1108. int frame_rate_base;
  1109. /**
  1110. * intra quantizer bias.
  1111. * - encoding: set by user.
  1112. * - decoding: unused
  1113. */
  1114. int intra_quant_bias;
  1115. #define FF_DEFAULT_QUANT_BIAS 999999
  1116. /**
  1117. * inter quantizer bias.
  1118. * - encoding: set by user.
  1119. * - decoding: unused
  1120. */
  1121. int inter_quant_bias;
  1122. /**
  1123. * color table ID.
  1124. * - encoding: unused.
  1125. * - decoding: which clrtable should be used for 8bit RGB images
  1126. * table have to be stored somewhere FIXME
  1127. */
  1128. int color_table_id;
  1129. /**
  1130. * internal_buffer count.
  1131. * Dont touch, used by lavc default_get_buffer()
  1132. */
  1133. int internal_buffer_count;
  1134. /**
  1135. * internal_buffers.
  1136. * Dont touch, used by lavc default_get_buffer()
  1137. */
  1138. void *internal_buffer;
  1139. #define FF_LAMBDA_SHIFT 7
  1140. #define FF_LAMBDA_SCALE (1<<FF_LAMBDA_SHIFT)
  1141. #define FF_QP2LAMBDA 118 ///< factor to convert from H.263 QP to lambda
  1142. #define FF_LAMBDA_MAX (256*128-1)
  1143. #define FF_QUALITY_SCALE FF_LAMBDA_SCALE //FIXME maybe remove
  1144. /**
  1145. * global quality for codecs which cannot change it per frame.
  1146. * this should be proportional to MPEG1/2/4 qscale.
  1147. * - encoding: set by user.
  1148. * - decoding: unused
  1149. */
  1150. int global_quality;
  1151. #define FF_CODER_TYPE_VLC 0
  1152. #define FF_CODER_TYPE_AC 1
  1153. /**
  1154. * coder type
  1155. * - encoding: set by user.
  1156. * - decoding: unused
  1157. */
  1158. int coder_type;
  1159. /**
  1160. * context model
  1161. * - encoding: set by user.
  1162. * - decoding: unused
  1163. */
  1164. int context_model;
  1165. /**
  1166. * slice flags
  1167. * - encoding: unused
  1168. * - decoding: set by user.
  1169. */
  1170. int slice_flags;
  1171. #define SLICE_FLAG_CODED_ORDER 0x0001 ///< draw_horiz_band() is called in coded order instead of display
  1172. #define SLICE_FLAG_ALLOW_FIELD 0x0002 ///< allow draw_horiz_band() with field slices (MPEG2 field pics)
  1173. #define SLICE_FLAG_ALLOW_PLANE 0x0004 ///< allow draw_horiz_band() with 1 component at a time (SVQ1)
  1174. /**
  1175. * XVideo Motion Acceleration
  1176. * - encoding: forbidden
  1177. * - decoding: set by decoder
  1178. */
  1179. int xvmc_acceleration;
  1180. /**
  1181. * macroblock decision mode
  1182. * - encoding: set by user.
  1183. * - decoding: unused
  1184. */
  1185. int mb_decision;
  1186. #define FF_MB_DECISION_SIMPLE 0 ///< uses mb_cmp
  1187. #define FF_MB_DECISION_BITS 1 ///< chooses the one which needs the fewest bits
  1188. #define FF_MB_DECISION_RD 2 ///< rate distoration
  1189. /**
  1190. * custom intra quantization matrix
  1191. * - encoding: set by user, can be NULL
  1192. * - decoding: set by lavc
  1193. */
  1194. uint16_t *intra_matrix;
  1195. /**
  1196. * custom inter quantization matrix
  1197. * - encoding: set by user, can be NULL
  1198. * - decoding: set by lavc
  1199. */
  1200. uint16_t *inter_matrix;
  1201. /**
  1202. * fourcc from the AVI stream header (LSB first, so "ABCD" -> ('D'<<24) + ('C'<<16) + ('B'<<8) + 'A').
  1203. * this is used to workaround some encoder bugs
  1204. * - encoding: unused
  1205. * - decoding: set by user, will be converted to upper case by lavc during init
  1206. */
  1207. unsigned int stream_codec_tag;
  1208. /**
  1209. * scene change detection threshold.
  1210. * 0 is default, larger means fewer detected scene changes
  1211. * - encoding: set by user.
  1212. * - decoding: unused
  1213. */
  1214. int scenechange_threshold;
  1215. /**
  1216. * minimum lagrange multipler
  1217. * - encoding: set by user.
  1218. * - decoding: unused
  1219. */
  1220. int lmin;
  1221. /**
  1222. * maximum lagrange multipler
  1223. * - encoding: set by user.
  1224. * - decoding: unused
  1225. */
  1226. int lmax;
  1227. /**
  1228. * Palette control structure
  1229. * - encoding: ??? (no palette-enabled encoder yet)
  1230. * - decoding: set by user.
  1231. */
  1232. struct AVPaletteControl *palctrl;
  1233. /**
  1234. * noise reduction strength
  1235. * - encoding: set by user.
  1236. * - decoding: unused
  1237. */
  1238. int noise_reduction;
  1239. /**
  1240. * called at the beginning of a frame to get cr buffer for it.
  1241. * buffer type (size, hints) must be the same. lavc won't check it.
  1242. * lavc will pass previous buffer in pic, function should return
  1243. * same buffer or new buffer with old frame "painted" into it.
  1244. * if pic.data[0] == NULL must behave like get_buffer().
  1245. * - encoding: unused
  1246. * - decoding: set by lavc, user can override
  1247. */
  1248. int (*reget_buffer)(struct AVCodecContext *c, AVFrame *pic);
  1249. } AVCodecContext;
  1250. /**
  1251. * AVOption.
  1252. */
  1253. typedef struct AVOption {
  1254. /** options' name */
  1255. const char *name; /* if name is NULL, it indicates a link to next */
  1256. /** short English text help or const struct AVOption* subpointer */
  1257. const char *help; // const struct AVOption* sub;
  1258. /** offset to context structure where the parsed value should be stored */
  1259. int offset;
  1260. /** options' type */
  1261. int type;
  1262. #define FF_OPT_TYPE_BOOL 1 ///< boolean - true,1,on (or simply presence)
  1263. #define FF_OPT_TYPE_DOUBLE 2 ///< double
  1264. #define FF_OPT_TYPE_INT 3 ///< integer
  1265. #define FF_OPT_TYPE_STRING 4 ///< string (finished with \0)
  1266. #define FF_OPT_TYPE_MASK 0x1f ///< mask for types - upper bits are various flags
  1267. //#define FF_OPT_TYPE_EXPERT 0x20 // flag for expert option
  1268. #define FF_OPT_TYPE_FLAG (FF_OPT_TYPE_BOOL | 0x40)
  1269. #define FF_OPT_TYPE_RCOVERRIDE (FF_OPT_TYPE_STRING | 0x80)
  1270. /** min value (min == max -> no limits) */
  1271. double min;
  1272. /** maximum value for double/int */
  1273. double max;
  1274. /** default boo [0,1]l/double/int value */
  1275. double defval;
  1276. /**
  1277. * default string value (with optional semicolon delimited extra option-list
  1278. * i.e. option1;option2;option3
  1279. * defval might select other then first argument as default
  1280. */
  1281. const char *defstr;
  1282. #define FF_OPT_MAX_DEPTH 10
  1283. } AVOption;
  1284. /**
  1285. * Parse option(s) and sets fields in passed structure
  1286. * @param strct structure where the parsed results will be written
  1287. * @param list list with AVOptions
  1288. * @param opts string with options for parsing
  1289. */
  1290. int avoption_parse(void* strct, const AVOption* list, const char* opts);
  1291. /**
  1292. * AVCodec.
  1293. */
  1294. typedef struct AVCodec {
  1295. const char *name;
  1296. enum CodecType type;
  1297. int id;
  1298. int priv_data_size;
  1299. int (*init)(AVCodecContext *);
  1300. int (*encode)(AVCodecContext *, uint8_t *buf, int buf_size, void *data);
  1301. int (*close)(AVCodecContext *);
  1302. int (*decode)(AVCodecContext *, void *outdata, int *outdata_size,
  1303. uint8_t *buf, int buf_size);
  1304. int capabilities;
  1305. const AVOption *options;
  1306. struct AVCodec *next;
  1307. void (*flush)(AVCodecContext *);
  1308. } AVCodec;
  1309. /**
  1310. * four components are given, that's all.
  1311. * the last component is alpha
  1312. */
  1313. typedef struct AVPicture {
  1314. uint8_t *data[4];
  1315. int linesize[4]; ///< number of bytes per line
  1316. } AVPicture;
  1317. /**
  1318. * AVPaletteControl
  1319. * This structure defines a method for communicating palette changes
  1320. * between and demuxer and a decoder.
  1321. */
  1322. #define AVPALETTE_SIZE 1024
  1323. #define AVPALETTE_COUNT 256
  1324. typedef struct AVPaletteControl {
  1325. /* demuxer sets this to 1 to indicate the palette has changed;
  1326. * decoder resets to 0 */
  1327. int palette_changed;
  1328. /* 4-byte ARGB palette entries, stored in native byte order; note that
  1329. * the individual palette components should be on a 8-bit scale; if
  1330. * the palette data comes from a IBM VGA native format, the component
  1331. * data is probably 6 bits in size and needs to be scaled */
  1332. unsigned int palette[AVPALETTE_COUNT];
  1333. } AVPaletteControl;
  1334. extern AVCodec ac3_encoder;
  1335. extern AVCodec mp2_encoder;
  1336. extern AVCodec mp3lame_encoder;
  1337. extern AVCodec oggvorbis_encoder;
  1338. extern AVCodec faac_encoder;
  1339. extern AVCodec mpeg1video_encoder;
  1340. extern AVCodec mpeg2video_encoder;
  1341. extern AVCodec h263_encoder;
  1342. extern AVCodec h263p_encoder;
  1343. extern AVCodec flv_encoder;
  1344. extern AVCodec rv10_encoder;
  1345. extern AVCodec rv20_encoder;
  1346. extern AVCodec mjpeg_encoder;
  1347. extern AVCodec ljpeg_encoder;
  1348. extern AVCodec mpeg4_encoder;
  1349. extern AVCodec msmpeg4v1_encoder;
  1350. extern AVCodec msmpeg4v2_encoder;
  1351. extern AVCodec msmpeg4v3_encoder;
  1352. extern AVCodec wmv1_encoder;
  1353. extern AVCodec wmv2_encoder;
  1354. extern AVCodec huffyuv_encoder;
  1355. extern AVCodec h264_encoder;
  1356. extern AVCodec asv1_encoder;
  1357. extern AVCodec asv2_encoder;
  1358. extern AVCodec vcr1_encoder;
  1359. extern AVCodec ffv1_encoder;
  1360. extern AVCodec mdec_encoder;
  1361. extern AVCodec h263_decoder;
  1362. extern AVCodec mpeg4_decoder;
  1363. extern AVCodec msmpeg4v1_decoder;
  1364. extern AVCodec msmpeg4v2_decoder;
  1365. extern AVCodec msmpeg4v3_decoder;
  1366. extern AVCodec wmv1_decoder;
  1367. extern AVCodec wmv2_decoder;
  1368. extern AVCodec mpeg1video_decoder;
  1369. extern AVCodec mpeg2video_decoder;
  1370. extern AVCodec mpegvideo_decoder;
  1371. extern AVCodec mpeg_xvmc_decoder;
  1372. extern AVCodec h263i_decoder;
  1373. extern AVCodec flv_decoder;
  1374. extern AVCodec rv10_decoder;
  1375. extern AVCodec rv20_decoder;
  1376. extern AVCodec svq1_decoder;
  1377. extern AVCodec svq3_decoder;
  1378. extern AVCodec dvvideo_decoder;
  1379. extern AVCodec wmav1_decoder;
  1380. extern AVCodec wmav2_decoder;
  1381. extern AVCodec mjpeg_decoder;
  1382. extern AVCodec mjpegb_decoder;
  1383. extern AVCodec sp5x_decoder;
  1384. extern AVCodec mp2_decoder;
  1385. extern AVCodec mp3_decoder;
  1386. extern AVCodec mace3_decoder;
  1387. extern AVCodec mace6_decoder;
  1388. extern AVCodec huffyuv_decoder;
  1389. extern AVCodec oggvorbis_decoder;
  1390. extern AVCodec cyuv_decoder;
  1391. extern AVCodec h264_decoder;
  1392. extern AVCodec indeo3_decoder;
  1393. extern AVCodec vp3_decoder;
  1394. extern AVCodec theora_decoder;
  1395. extern AVCodec amr_nb_decoder;
  1396. extern AVCodec amr_nb_encoder;
  1397. extern AVCodec amr_wb_encoder;
  1398. extern AVCodec amr_wb_decoder;
  1399. extern AVCodec aac_decoder;
  1400. extern AVCodec mpeg4aac_decoder;
  1401. extern AVCodec asv1_decoder;
  1402. extern AVCodec asv2_decoder;
  1403. extern AVCodec vcr1_decoder;
  1404. extern AVCodec cljr_decoder;
  1405. extern AVCodec ffv1_decoder;
  1406. extern AVCodec fourxm_decoder;
  1407. extern AVCodec mdec_decoder;
  1408. extern AVCodec roq_decoder;
  1409. extern AVCodec interplay_video_decoder;
  1410. extern AVCodec xan_wc3_decoder;
  1411. extern AVCodec rpza_decoder;
  1412. extern AVCodec cinepak_decoder;
  1413. extern AVCodec msrle_decoder;
  1414. extern AVCodec msvideo1_decoder;
  1415. extern AVCodec vqa_decoder;
  1416. extern AVCodec idcin_decoder;
  1417. extern AVCodec eightbps_decoder;
  1418. extern AVCodec smc_decoder;
  1419. extern AVCodec flic_decoder;
  1420. extern AVCodec ra_144_decoder;
  1421. extern AVCodec ra_288_decoder;
  1422. extern AVCodec roq_dpcm_decoder;
  1423. extern AVCodec interplay_dpcm_decoder;
  1424. extern AVCodec xan_dpcm_decoder;
  1425. /* pcm codecs */
  1426. #define PCM_CODEC(id, name) \
  1427. extern AVCodec name ## _decoder; \
  1428. extern AVCodec name ## _encoder
  1429. PCM_CODEC(CODEC_ID_PCM_S16LE, pcm_s16le);
  1430. PCM_CODEC(CODEC_ID_PCM_S16BE, pcm_s16be);
  1431. PCM_CODEC(CODEC_ID_PCM_U16LE, pcm_u16le);
  1432. PCM_CODEC(CODEC_ID_PCM_U16BE, pcm_u16be);
  1433. PCM_CODEC(CODEC_ID_PCM_S8, pcm_s8);
  1434. PCM_CODEC(CODEC_ID_PCM_U8, pcm_u8);
  1435. PCM_CODEC(CODEC_ID_PCM_ALAW, pcm_alaw);
  1436. PCM_CODEC(CODEC_ID_PCM_MULAW, pcm_mulaw);
  1437. /* adpcm codecs */
  1438. PCM_CODEC(CODEC_ID_ADPCM_IMA_QT, adpcm_ima_qt);
  1439. PCM_CODEC(CODEC_ID_ADPCM_IMA_WAV, adpcm_ima_wav);
  1440. PCM_CODEC(CODEC_ID_ADPCM_IMA_DK3, adpcm_ima_dk3);
  1441. PCM_CODEC(CODEC_ID_ADPCM_IMA_DK4, adpcm_ima_dk4);
  1442. PCM_CODEC(CODEC_ID_ADPCM_IMA_WS, adpcm_ima_ws);
  1443. PCM_CODEC(CODEC_ID_ADPCM_MS, adpcm_ms);
  1444. PCM_CODEC(CODEC_ID_ADPCM_4XM, adpcm_4xm);
  1445. PCM_CODEC(CODEC_ID_ADPCM_XA, adpcm_xa);
  1446. PCM_CODEC(CODEC_ID_ADPCM_ADX, adpcm_adx);
  1447. #undef PCM_CODEC
  1448. /* dummy raw video codec */
  1449. extern AVCodec rawvideo_encoder;
  1450. extern AVCodec rawvideo_decoder;
  1451. /* the following codecs use external GPL libs */
  1452. extern AVCodec ac3_decoder;
  1453. /* resample.c */
  1454. struct ReSampleContext;
  1455. typedef struct ReSampleContext ReSampleContext;
  1456. ReSampleContext *audio_resample_init(int output_channels, int input_channels,
  1457. int output_rate, int input_rate);
  1458. int audio_resample(ReSampleContext *s, short *output, short *input, int nb_samples);
  1459. void audio_resample_close(ReSampleContext *s);
  1460. /* YUV420 format is assumed ! */
  1461. struct ImgReSampleContext;
  1462. typedef struct ImgReSampleContext ImgReSampleContext;
  1463. ImgReSampleContext *img_resample_init(int output_width, int output_height,
  1464. int input_width, int input_height);
  1465. ImgReSampleContext *img_resample_full_init(int owidth, int oheight,
  1466. int iwidth, int iheight,
  1467. int topBand, int bottomBand,
  1468. int leftBand, int rightBand);
  1469. void img_resample(ImgReSampleContext *s,
  1470. AVPicture *output, const AVPicture *input);
  1471. void img_resample_close(ImgReSampleContext *s);
  1472. /**
  1473. * Allocate memory for a picture. Call avpicture_free to free it.
  1474. *
  1475. * @param picture the picture to be filled in.
  1476. * @param pix_fmt the format of the picture.
  1477. * @param width the width of the picture.
  1478. * @param height the height of the picture.
  1479. * @return 0 if successful, -1 if not.
  1480. */
  1481. int avpicture_alloc(AVPicture *picture, int pix_fmt, int width, int height);
  1482. /* Free a picture previously allocated by avpicture_alloc. */
  1483. void avpicture_free(AVPicture *picture);
  1484. int avpicture_fill(AVPicture *picture, uint8_t *ptr,
  1485. int pix_fmt, int width, int height);
  1486. int avpicture_layout(const AVPicture* src, int pix_fmt, int width, int height,
  1487. unsigned char *dest, int dest_size);
  1488. int avpicture_get_size(int pix_fmt, int width, int height);
  1489. void avcodec_get_chroma_sub_sample(int pix_fmt, int *h_shift, int *v_shift);
  1490. const char *avcodec_get_pix_fmt_name(int pix_fmt);
  1491. enum PixelFormat avcodec_get_pix_fmt(const char* name);
  1492. #define FF_LOSS_RESOLUTION 0x0001 /* loss due to resolution change */
  1493. #define FF_LOSS_DEPTH 0x0002 /* loss due to color depth change */
  1494. #define FF_LOSS_COLORSPACE 0x0004 /* loss due to color space conversion */
  1495. #define FF_LOSS_ALPHA 0x0008 /* loss of alpha bits */
  1496. #define FF_LOSS_COLORQUANT 0x0010 /* loss due to color quantization */
  1497. #define FF_LOSS_CHROMA 0x0020 /* loss of chroma (e.g. rgb to gray conversion) */
  1498. int avcodec_get_pix_fmt_loss(int dst_pix_fmt, int src_pix_fmt,
  1499. int has_alpha);
  1500. int avcodec_find_best_pix_fmt(int pix_fmt_mask, int src_pix_fmt,
  1501. int has_alpha, int *loss_ptr);
  1502. #define FF_ALPHA_TRANSP 0x0001 /* image has some totally transparent pixels */
  1503. #define FF_ALPHA_SEMI_TRANSP 0x0002 /* image has some transparent pixels */
  1504. int img_get_alpha_info(const AVPicture *src,
  1505. int pix_fmt, int width, int height);
  1506. /* convert among pixel formats */
  1507. int img_convert(AVPicture *dst, int dst_pix_fmt,
  1508. const AVPicture *src, int pix_fmt,
  1509. int width, int height);
  1510. /* deinterlace a picture */
  1511. int avpicture_deinterlace(AVPicture *dst, const AVPicture *src,
  1512. int pix_fmt, int width, int height);
  1513. /* external high level API */
  1514. extern AVCodec *first_avcodec;
  1515. /* returns LIBAVCODEC_VERSION_INT constant */
  1516. unsigned avcodec_version(void);
  1517. /* returns LIBAVCODEC_BUILD constant */
  1518. unsigned avcodec_build(void);
  1519. void avcodec_init(void);
  1520. void register_avcodec(AVCodec *format);
  1521. AVCodec *avcodec_find_encoder(enum CodecID id);
  1522. AVCodec *avcodec_find_encoder_by_name(const char *name);
  1523. AVCodec *avcodec_find_decoder(enum CodecID id);
  1524. AVCodec *avcodec_find_decoder_by_name(const char *name);
  1525. void avcodec_string(char *buf, int buf_size, AVCodecContext *enc, int encode);
  1526. void avcodec_get_context_defaults(AVCodecContext *s);
  1527. AVCodecContext *avcodec_alloc_context(void);
  1528. AVFrame *avcodec_alloc_frame(void);
  1529. int avcodec_default_get_buffer(AVCodecContext *s, AVFrame *pic);
  1530. void avcodec_default_release_buffer(AVCodecContext *s, AVFrame *pic);
  1531. void avcodec_default_free_buffers(AVCodecContext *s);
  1532. /**
  1533. * opens / inits the AVCodecContext.
  1534. * not thread save!
  1535. */
  1536. int avcodec_open(AVCodecContext *avctx, AVCodec *codec);
  1537. int avcodec_decode_audio(AVCodecContext *avctx, int16_t *samples,
  1538. int *frame_size_ptr,
  1539. uint8_t *buf, int buf_size);
  1540. int avcodec_decode_video(AVCodecContext *avctx, AVFrame *picture,
  1541. int *got_picture_ptr,
  1542. uint8_t *buf, int buf_size);
  1543. int avcodec_parse_frame(AVCodecContext *avctx, uint8_t **pdata,
  1544. int *data_size_ptr,
  1545. uint8_t *buf, int buf_size);
  1546. int avcodec_encode_audio(AVCodecContext *avctx, uint8_t *buf, int buf_size,
  1547. const short *samples);
  1548. int avcodec_encode_video(AVCodecContext *avctx, uint8_t *buf, int buf_size,
  1549. const AVFrame *pict);
  1550. int avcodec_close(AVCodecContext *avctx);
  1551. void avcodec_register_all(void);
  1552. void avcodec_flush_buffers(AVCodecContext *avctx);
  1553. /* misc usefull functions */
  1554. /**
  1555. * returns a single letter to describe the picture type
  1556. */
  1557. char av_get_pict_type_char(int pict_type);
  1558. /**
  1559. * reduce a fraction.
  1560. * this is usefull for framerate calculations
  1561. * @param max the maximum allowed for dst_nom & dst_den
  1562. * @return 1 if exact, 0 otherwise
  1563. */
  1564. int av_reduce(int *dst_nom, int *dst_den, int64_t nom, int64_t den, int64_t max);
  1565. /**
  1566. * rescale a 64bit integer.
  1567. * a simple a*b/c isnt possible as it can overflow
  1568. */
  1569. int64_t av_rescale(int64_t a, int b, int c);
  1570. /**
  1571. * Interface for 0.5.0 version
  1572. *
  1573. * do not even think about it's usage for this moment
  1574. */
  1575. typedef struct {
  1576. /// compressed size used from given memory buffer
  1577. int size;
  1578. /// I/P/B frame type
  1579. int frame_type;
  1580. } avc_enc_result_t;
  1581. /**
  1582. * Commands
  1583. * order can't be changed - once it was defined
  1584. */
  1585. typedef enum {
  1586. // general commands
  1587. AVC_OPEN_BY_NAME = 0xACA000,
  1588. AVC_OPEN_BY_CODEC_ID,
  1589. AVC_OPEN_BY_FOURCC,
  1590. AVC_CLOSE,
  1591. AVC_FLUSH,
  1592. // pin - struct { uint8_t* src, uint_t src_size }
  1593. // pout - struct { AVPicture* img, consumed_bytes,
  1594. AVC_DECODE,
  1595. // pin - struct { AVPicture* img, uint8_t* dest, uint_t dest_size }
  1596. // pout - uint_t used_from_dest_size
  1597. AVC_ENCODE,
  1598. // query/get video commands
  1599. AVC_GET_VERSION = 0xACB000,
  1600. AVC_GET_WIDTH,
  1601. AVC_GET_HEIGHT,
  1602. AVC_GET_DELAY,
  1603. AVC_GET_QUANT_TABLE,
  1604. // ...
  1605. // query/get audio commands
  1606. AVC_GET_FRAME_SIZE = 0xABC000,
  1607. // maybe define some simple structure which
  1608. // might be passed to the user - but they can't
  1609. // contain any codec specific parts and these
  1610. // calls are usualy necessary only few times
  1611. // set video commands
  1612. AVC_SET_WIDTH = 0xACD000,
  1613. AVC_SET_HEIGHT,
  1614. // set video encoding commands
  1615. AVC_SET_FRAME_RATE = 0xACD800,
  1616. AVC_SET_QUALITY,
  1617. AVC_SET_HURRY_UP,
  1618. // set audio commands
  1619. AVC_SET_SAMPLE_RATE = 0xACE000,
  1620. AVC_SET_CHANNELS,
  1621. } avc_cmd_t;
  1622. /**
  1623. * \param handle allocated private structure by libavcodec
  1624. * for initialization pass NULL - will be returned pout
  1625. * user is supposed to know nothing about its structure
  1626. * \param cmd type of operation to be performed
  1627. * \param pint input parameter
  1628. * \param pout output parameter
  1629. *
  1630. * \returns command status - eventually for query command it might return
  1631. * integer resulting value
  1632. */
  1633. int avcodec(void* handle, avc_cmd_t cmd, void* pin, void* pout);
  1634. /* frame parsing */
  1635. typedef struct AVCodecParserContext {
  1636. void *priv_data;
  1637. struct AVCodecParser *parser;
  1638. int64_t frame_offset; /* offset of the current frame */
  1639. int64_t cur_offset; /* current offset
  1640. (incremented by each av_parser_parse()) */
  1641. int64_t last_frame_offset; /* offset of the last frame */
  1642. /* video info */
  1643. int pict_type; /* XXX: put it back in AVCodecContext */
  1644. int repeat_pict; /* XXX: put it back in AVCodecContext */
  1645. int64_t pts; /* in us, if given by the codec (used by raw mpeg4) */
  1646. int64_t dts; /* in us, if given by the codec (used by raw mpeg4) */
  1647. } AVCodecParserContext;
  1648. typedef struct AVCodecParser {
  1649. int codec_ids[3]; /* several codec IDs are permitted */
  1650. int priv_data_size;
  1651. int (*parser_init)(AVCodecParserContext *s);
  1652. int (*parser_parse)(AVCodecParserContext *s,
  1653. AVCodecContext *avctx,
  1654. uint8_t **poutbuf, int *poutbuf_size,
  1655. const uint8_t *buf, int buf_size);
  1656. void (*parser_close)(AVCodecParserContext *s);
  1657. struct AVCodecParser *next;
  1658. } AVCodecParser;
  1659. extern AVCodecParser *av_first_parser;
  1660. void av_register_codec_parser(AVCodecParser *parser);
  1661. AVCodecParserContext *av_parser_init(int codec_id);
  1662. int av_parser_parse(AVCodecParserContext *s,
  1663. AVCodecContext *avctx,
  1664. uint8_t **poutbuf, int *poutbuf_size,
  1665. const uint8_t *buf, int buf_size);
  1666. void av_parser_close(AVCodecParserContext *s);
  1667. extern AVCodecParser mpegvideo_parser;
  1668. extern AVCodecParser mpeg4video_parser;
  1669. extern AVCodecParser h263_parser;
  1670. extern AVCodecParser h264_parser;
  1671. extern AVCodecParser mpegaudio_parser;
  1672. extern AVCodecParser ac3_parser;
  1673. /* memory */
  1674. void *av_malloc(unsigned int size);
  1675. void *av_mallocz(unsigned int size);
  1676. void *av_realloc(void *ptr, unsigned int size);
  1677. void av_free(void *ptr);
  1678. char *av_strdup(const char *s);
  1679. void __av_freep(void **ptr);
  1680. #define av_freep(p) __av_freep((void **)(p))
  1681. void *av_fast_realloc(void *ptr, unsigned int *size, unsigned int min_size);
  1682. /* for static data only */
  1683. /* call av_free_static to release all staticaly allocated tables */
  1684. void av_free_static(void);
  1685. void *__av_mallocz_static(void** location, unsigned int size);
  1686. #define av_mallocz_static(p, s) __av_mallocz_static((void **)(p), s)
  1687. /* add by bero : in adx.c */
  1688. int is_adx(const unsigned char *buf,size_t bufsize);
  1689. void img_copy(AVPicture *dst, const AVPicture *src,
  1690. int pix_fmt, int width, int height);
  1691. /* av_log API */
  1692. #include <stdarg.h>
  1693. #define AV_LOG_ERROR 0
  1694. #define AV_LOG_INFO 1
  1695. #define AV_LOG_DEBUG 2
  1696. extern void av_log(AVCodecContext*, int level, const char *fmt, ...) __attribute__ ((__format__ (__printf__, 3, 4)));
  1697. extern void av_vlog(AVCodecContext*, int level, const char *fmt, va_list);
  1698. extern int av_log_get_level(void);
  1699. extern void av_log_set_level(int);
  1700. extern void av_log_set_callback(void (*)(AVCodecContext*, int, const char*, va_list));
  1701. #undef AV_LOG_TRAP_PRINTF
  1702. #ifdef AV_LOG_TRAP_PRINTF
  1703. #define printf DO NOT USE
  1704. #define fprintf DO NOT USE
  1705. #undef stderr
  1706. #define stderr DO NOT USE
  1707. #endif
  1708. #ifdef __cplusplus
  1709. }
  1710. #endif
  1711. #endif /* AVCODEC_H */