FFmpeg
mediacodecdec_common.h
Go to the documentation of this file.
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_COMMON_H
24 #define AVCODEC_MEDIACODECDEC_COMMON_H
25 
26 #include <stdint.h>
27 #include <stdatomic.h>
28 #include <stdbool.h>
29 #include <sys/types.h>
30 
31 #include "libavutil/frame.h"
32 #include "libavutil/pixfmt.h"
33 
34 #include "avcodec.h"
35 #include "mediacodec_wrapper.h"
36 
37 typedef struct MediaCodecDecContext {
38 
42 
43  char *codec_name;
44 
47 
48  void *surface;
49 
50  int started;
51  int draining;
52  int flushing;
53  int eos;
54 
55  int width;
56  int height;
57  int stride;
60  int crop_top;
62  int crop_left;
66 
69 
72 
74 
77  const char *mime,
79 
82  AVPacket *pkt,
83  bool wait);
84 
87  AVFrame *frame,
88  bool wait);
89 
92 
95 
98 
99 typedef struct MediaCodecBuffer {
100 
102  ssize_t index;
103  int64_t pts;
105  int serial;
106 
108 
109 #endif /* AVCODEC_MEDIACODECDEC_COMMON_H */
This structure describes decoded (raw) audio or video data.
Definition: frame.h:295
int ff_mediacodec_dec_is_flushing(AVCodecContext *avctx, MediaCodecDecContext *s)
int ff_mediacodec_dec_init(AVCodecContext *avctx, MediaCodecDecContext *s, const char *mime, FFAMediaFormat *format)
static AVPacket pkt
intptr_t atomic_int
Definition: stdatomic.h:55
int ff_mediacodec_dec_close(AVCodecContext *avctx, MediaCodecDecContext *s)
Opaque structure representing a MediaCodec buffer to render.
int ff_mediacodec_dec_receive(AVCodecContext *avctx, MediaCodecDecContext *s, AVFrame *frame, bool wait)
int ff_mediacodec_dec_flush(AVCodecContext *avctx, MediaCodecDecContext *s)
int ff_mediacodec_dec_send(AVCodecContext *avctx, MediaCodecDecContext *s, AVPacket *pkt, bool wait)
reference-counted frame API
MediaCodecDecContext * ctx
these buffered frames must be flushed immediately if a new input produces new the filter must not call request_frame to get more It must just process the frame or queue it The task of requesting more frames is left to the filter s request_frame method or the application If a filter has several the filter must be ready for frames arriving randomly on any input any filter with several inputs will most likely require some kind of queuing mechanism It is perfectly acceptable to have a limited queue and to drop frames when the inputs are too unbalanced request_frame For filters that do not use the this method is called when a frame is wanted on an output For a it should directly call filter_frame on the corresponding output For a if there are queued frames already one of these frames should be pushed If the filter should request a frame on one of its repeatedly until at least one frame has been pushed Return or at least make progress towards producing a frame
#define s(width, name)
Definition: cbs_vp9.c:257
Libavcodec external API header.
main external API structure.
Definition: avcodec.h:1566
pixel format definitions
This structure stores compressed data.
Definition: avcodec.h:1455