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.

1931 lines
56KB

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