2 * Android MediaCodec decoder
4 * Copyright (c) 2015-2016 Matthieu Bouron <matthieu.bouron stupeflix.com>
6 * This file is part of FFmpeg.
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.
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.
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
23 #ifndef AVCODEC_MEDIACODECDEC_H
24 #define AVCODEC_MEDIACODECDEC_H
27 #include <sys/types.h>
29 #include "libavutil/frame.h"
30 #include "libavutil/pixfmt.h"
33 #include "mediacodec_wrapper.h"
35 typedef struct MediaCodecDecContext {
37 volatile int refcount;
42 FFAMediaFormat *format;
56 enum AVPixelFormat pix_fmt;
62 uint64_t dequeued_buffer_nb;
65 double first_buffer_at;
67 } MediaCodecDecContext;
69 int ff_mediacodec_dec_init(AVCodecContext *avctx,
70 MediaCodecDecContext *s,
72 FFAMediaFormat *format);
74 int ff_mediacodec_dec_decode(AVCodecContext *avctx,
75 MediaCodecDecContext *s,
80 int ff_mediacodec_dec_flush(AVCodecContext *avctx,
81 MediaCodecDecContext *s);
83 int ff_mediacodec_dec_close(AVCodecContext *avctx,
84 MediaCodecDecContext *s);
86 int ff_mediacodec_dec_is_flushing(AVCodecContext *avctx,
87 MediaCodecDecContext *s);
89 typedef struct MediaCodecBuffer {
91 MediaCodecDecContext *ctx;
94 volatile int released;
98 #endif /* AVCODEC_MEDIACODECDEC_H */