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.

83 lines
2.3KB

  1. /*
  2. * Android MediaCodec decoder
  3. *
  4. * Copyright (c) 2015-2016 Matthieu Bouron <matthieu.bouron stupeflix.com>
  5. *
  6. * This file is part of FFmpeg.
  7. *
  8. * FFmpeg is free software; you can redistribute it and/or
  9. * modify it under the terms of the GNU Lesser General Public
  10. * License as published by the Free Software Foundation; either
  11. * version 2.1 of the License, or (at your option) any later version.
  12. *
  13. * FFmpeg is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  16. * Lesser General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU Lesser General Public
  19. * License along with FFmpeg; if not, write to the Free Software
  20. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  21. */
  22. #ifndef AVCODEC_MEDIACODECDEC_H
  23. #define AVCODEC_MEDIACODECDEC_H
  24. #include <stdint.h>
  25. #include <sys/types.h>
  26. #include "libavutil/frame.h"
  27. #include "libavutil/pixfmt.h"
  28. #include "avcodec.h"
  29. #include "mediacodec_wrapper.h"
  30. typedef struct MediaCodecDecContext {
  31. const char *codec_name;
  32. FFAMediaCodec *codec;
  33. FFAMediaFormat *format;
  34. int started;
  35. int flushing;
  36. int width;
  37. int height;
  38. int stride;
  39. int slice_height;
  40. int color_format;
  41. enum AVPixelFormat pix_fmt;
  42. int crop_top;
  43. int crop_bottom;
  44. int crop_left;
  45. int crop_right;
  46. int queued_buffer_nb;
  47. int queued_buffer_max;
  48. uint64_t dequeued_buffer_nb;
  49. int first_buffer;
  50. double first_buffer_at;
  51. } MediaCodecDecContext;
  52. int ff_mediacodec_dec_init(AVCodecContext *avctx,
  53. MediaCodecDecContext *s,
  54. const char *mime,
  55. FFAMediaFormat *format);
  56. int ff_mediacodec_dec_decode(AVCodecContext *avctx,
  57. MediaCodecDecContext *s,
  58. AVFrame *frame,
  59. int *got_frame,
  60. AVPacket *pkt);
  61. int ff_mediacodec_dec_flush(AVCodecContext *avctx,
  62. MediaCodecDecContext *s);
  63. int ff_mediacodec_dec_close(AVCodecContext *avctx,
  64. MediaCodecDecContext *s);
  65. #endif /* AVCODEC_MEDIACODECDEC_H */