]> git.sesse.net Git - ffmpeg/blob - libavcodec/mediacodecdec.h
Merge commit '0372e73f917e72c40b09270f771046fc142be4a7'
[ffmpeg] / libavcodec / mediacodecdec.h
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
23 #ifndef AVCODEC_MEDIACODECDEC_H
24 #define AVCODEC_MEDIACODECDEC_H
25
26 #include <stdint.h>
27 #include <sys/types.h>
28
29 #include "libavutil/frame.h"
30 #include "libavutil/pixfmt.h"
31
32 #include "avcodec.h"
33 #include "mediacodec_wrapper.h"
34
35 typedef struct MediaCodecDecContext {
36
37     char *codec_name;
38
39     FFAMediaCodec *codec;
40     FFAMediaFormat *format;
41
42     int started;
43     int flushing;
44
45     int width;
46     int height;
47     int stride;
48     int slice_height;
49     int color_format;
50     enum AVPixelFormat pix_fmt;
51     int crop_top;
52     int crop_bottom;
53     int crop_left;
54     int crop_right;
55
56     int queued_buffer_nb;
57     int queued_buffer_max;
58     uint64_t dequeued_buffer_nb;
59
60     int first_buffer;
61     double first_buffer_at;
62
63 } MediaCodecDecContext;
64
65 int ff_mediacodec_dec_init(AVCodecContext *avctx,
66                            MediaCodecDecContext *s,
67                            const char *mime,
68                            FFAMediaFormat *format);
69
70 int ff_mediacodec_dec_decode(AVCodecContext *avctx,
71                              MediaCodecDecContext *s,
72                              AVFrame *frame,
73                              int *got_frame,
74                              AVPacket *pkt);
75
76 int ff_mediacodec_dec_flush(AVCodecContext *avctx,
77                             MediaCodecDecContext *s);
78
79 int ff_mediacodec_dec_close(AVCodecContext *avctx,
80                             MediaCodecDecContext *s);
81
82 #endif /* AVCODEC_MEDIACODECDEC_H */