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.

80 lines
2.0KB

  1. #include "common.h"
  2. enum CodecID {
  3. CODEC_ID_NONE,
  4. CODEC_ID_MPEG1VIDEO,
  5. CODEC_ID_H263,
  6. CODEC_ID_RV10,
  7. CODEC_ID_MP2,
  8. CODEC_ID_AC3,
  9. CODEC_ID_MJPEG,
  10. };
  11. enum CodecType {
  12. CODEC_TYPE_VIDEO,
  13. CODEC_TYPE_AUDIO,
  14. };
  15. typedef struct AVEncodeContext {
  16. int bit_rate;
  17. int rate; /* frames per sec or samples per sec */
  18. /* video only */
  19. int width, height;
  20. int gop_size; /* 0 = intra only */
  21. /* audio only */
  22. int channels;
  23. /* the following data should not be initialized */
  24. int frame_size; /* in samples, initialized when calling 'init' */
  25. int frame_number; /* audio or video frame number */
  26. int key_frame; /* true if the previous compressed frame was
  27. a key frame (intra, or seekable) */
  28. struct AVEncoder *codec;
  29. void *priv_data;
  30. } AVEncodeContext;
  31. typedef struct AVEncoder {
  32. char *name;
  33. int type;
  34. int id;
  35. int priv_data_size;
  36. int (*init)(AVEncodeContext *);
  37. int (*encode)(AVEncodeContext *, UINT8 *buf, int buf_size, void *data);
  38. int (*close)(AVEncodeContext *);
  39. struct AVEncoder *next;
  40. } AVEncoder;
  41. extern AVEncoder ac3_encoder;
  42. extern AVEncoder mp2_encoder;
  43. extern AVEncoder mpeg1video_encoder;
  44. extern AVEncoder h263_encoder;
  45. extern AVEncoder rv10_encoder;
  46. extern AVEncoder mjpeg_encoder;
  47. /* resample.c */
  48. typedef struct {
  49. /* fractional resampling */
  50. UINT32 incr; /* fractional increment */
  51. UINT32 frac;
  52. int last_sample;
  53. /* integer down sample */
  54. int iratio; /* integer divison ratio */
  55. int icount, isum;
  56. int inv;
  57. } ReSampleChannelContext;
  58. typedef struct {
  59. ReSampleChannelContext channel_ctx[2];
  60. float ratio;
  61. /* channel convert */
  62. int input_channels, output_channels;
  63. } ReSampleContext;
  64. int audio_resample_init(ReSampleContext *s,
  65. int output_channels, int input_channels,
  66. int output_rate, int input_rate);
  67. int audio_resample(ReSampleContext *s, short *output, short *input, int nb_samples);