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 
75 
78  const char *mime,
80 
83  AVPacket *pkt,
84  bool wait);
85 
88  AVFrame *frame,
89  bool wait);
90 
93 
96 
99 
100 typedef struct MediaCodecBuffer {
101 
103  ssize_t index;
104  int64_t pts;
106  int serial;
107 
109 
110 #endif /* AVCODEC_MEDIACODECDEC_COMMON_H */
MediaCodecDecContext::format
FFAMediaFormat * format
Definition: mediacodecdec_common.h:46
MediaCodecDecContext
Definition: mediacodecdec_common.h:37
ff_mediacodec_dec_flush
int ff_mediacodec_dec_flush(AVCodecContext *avctx, MediaCodecDecContext *s)
Definition: mediacodecdec_common.c:824
MediaCodecBuffer::serial
int serial
Definition: mediacodecdec_common.h:106
MediaCodecDecContext::current_input_buffer
ssize_t current_input_buffer
Definition: mediacodecdec_common.h:68
MediaCodecDecContext::surface
void * surface
Definition: mediacodecdec_common.h:48
AVFrame
This structure describes decoded (raw) audio or video data.
Definition: frame.h:340
MediaCodecBuffer::pts
int64_t pts
Definition: mediacodecdec_common.h:104
MediaCodecDecContext::slice_height
int slice_height
Definition: mediacodecdec_common.h:58
atomic_int
intptr_t atomic_int
Definition: stdatomic.h:55
MediaCodecDecContext::display_height
int display_height
Definition: mediacodecdec_common.h:65
MediaCodecDecContext::output_buffer_count
uint64_t output_buffer_count
Definition: mediacodecdec_common.h:67
MediaCodecDecContext::crop_left
int crop_left
Definition: mediacodecdec_common.h:62
MediaCodecDecContext::flushing
int flushing
Definition: mediacodecdec_common.h:52
MediaCodecBuffer::index
ssize_t index
Definition: mediacodecdec_common.h:103
MediaCodecDecContext::stride
int stride
Definition: mediacodecdec_common.h:57
pkt
AVPacket * pkt
Definition: movenc.c:59
MediaCodecDecContext::use_ndk_codec
bool use_ndk_codec
Definition: mediacodecdec_common.h:73
MediaCodecDecContext::codec_name
char * codec_name
Definition: mediacodecdec_common.h:43
ff_mediacodec_dec_close
int ff_mediacodec_dec_close(AVCodecContext *avctx, MediaCodecDecContext *s)
Definition: mediacodecdec_common.c:842
s
#define s(width, name)
Definition: cbs_vp9.c:198
ff_mediacodec_dec_receive
int ff_mediacodec_dec_receive(AVCodecContext *avctx, MediaCodecDecContext *s, AVFrame *frame, bool wait)
Definition: mediacodecdec_common.c:699
format
Filter the word “frame” indicates either a video frame or a group of audio as stored in an AVFrame structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel sample format(the sample packing is implied by the sample format) and sample rate. The lists are not just lists
MediaCodecDecContext::eos
int eos
Definition: mediacodecdec_common.h:53
frame
static AVFrame * frame
Definition: demux_decode.c:54
MediaCodecBuffer::ctx
MediaCodecDecContext * ctx
Definition: mediacodecdec_common.h:102
MediaCodecBuffer
Opaque structure representing a MediaCodec buffer to render.
Definition: mediacodecdec_common.h:100
MediaCodecDecContext::display_width
int display_width
Definition: mediacodecdec_common.h:64
ff_mediacodec_dec_is_flushing
int ff_mediacodec_dec_is_flushing(AVCodecContext *avctx, MediaCodecDecContext *s)
Definition: mediacodecdec_common.c:849
frame.h
MediaCodecDecContext::crop_top
int crop_top
Definition: mediacodecdec_common.h:60
MediaCodecDecContext::crop_right
int crop_right
Definition: mediacodecdec_common.h:63
MediaCodecDecContext::started
int started
Definition: mediacodecdec_common.h:50
mediacodec_wrapper.h
ff_mediacodec_dec_send
int ff_mediacodec_dec_send(AVCodecContext *avctx, MediaCodecDecContext *s, AVPacket *pkt, bool wait)
Definition: mediacodecdec_common.c:605
FFAMediaCodec
Definition: mediacodec_wrapper.h:181
MediaCodecDecContext::color_format
int color_format
Definition: mediacodecdec_common.h:59
MediaCodecDecContext::avctx
AVCodecContext * avctx
Definition: mediacodecdec_common.h:39
avcodec.h
pixfmt.h
ff_mediacodec_dec_init
int ff_mediacodec_dec_init(AVCodecContext *avctx, MediaCodecDecContext *s, const char *mime, FFAMediaFormat *format)
Definition: mediacodecdec_common.c:489
AVCodecContext
main external API structure.
Definition: avcodec.h:441
MediaCodecDecContext::crop_bottom
int crop_bottom
Definition: mediacodecdec_common.h:61
MediaCodecDecContext::width
int width
Definition: mediacodecdec_common.h:55
MediaCodecDecContext::height
int height
Definition: mediacodecdec_common.h:56
MediaCodecDecContext::serial
atomic_int serial
Definition: mediacodecdec_common.h:71
MediaCodecDecContext::refcount
atomic_int refcount
Definition: mediacodecdec_common.h:40
AVPacket
This structure stores compressed data.
Definition: packet.h:468
MediaCodecDecContext::delay_flush
bool delay_flush
Definition: mediacodecdec_common.h:70
MediaCodecDecContext::hw_buffer_count
atomic_int hw_buffer_count
Definition: mediacodecdec_common.h:41
MediaCodecBuffer::released
atomic_int released
Definition: mediacodecdec_common.h:105
MediaCodecDecContext::draining
int draining
Definition: mediacodecdec_common.h:51
MediaCodecDecContext::codec
FFAMediaCodec * codec
Definition: mediacodecdec_common.h:45
FFAMediaFormat
Definition: mediacodec_wrapper.h:63