FFmpeg
4.0
libavcodec
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
39
AVCodecContext
*
avctx
;
40
atomic_int
refcount
;
41
atomic_int
hw_buffer_count
;
42
43
char
*
codec_name
;
44
45
FFAMediaCodec
*
codec
;
46
FFAMediaFormat
*
format
;
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
;
58
int
slice_height
;
59
int
color_format
;
60
int
crop_top
;
61
int
crop_bottom
;
62
int
crop_left
;
63
int
crop_right
;
64
int
display_width
;
65
int
display_height
;
66
67
uint64_t
output_buffer_count
;
68
69
bool
delay_flush
;
70
atomic_int
serial
;
71
72
}
MediaCodecDecContext
;
73
74
int
ff_mediacodec_dec_init
(
AVCodecContext
*
avctx
,
75
MediaCodecDecContext
*
s
,
76
const
char
*mime,
77
FFAMediaFormat
*
format
);
78
79
int
ff_mediacodec_dec_send
(
AVCodecContext
*
avctx
,
80
MediaCodecDecContext
*
s
,
81
AVPacket
*
pkt
);
82
83
int
ff_mediacodec_dec_receive
(
AVCodecContext
*
avctx
,
84
MediaCodecDecContext
*
s
,
85
AVFrame
*
frame
,
86
bool
wait);
87
88
int
ff_mediacodec_dec_flush
(
AVCodecContext
*
avctx
,
89
MediaCodecDecContext
*
s
);
90
91
int
ff_mediacodec_dec_close
(
AVCodecContext
*
avctx
,
92
MediaCodecDecContext
*
s
);
93
94
int
ff_mediacodec_dec_is_flushing
(
AVCodecContext
*
avctx
,
95
MediaCodecDecContext
*
s
);
96
97
typedef
struct
MediaCodecBuffer
{
98
99
MediaCodecDecContext
*
ctx
;
100
ssize_t
index
;
101
int64_t
pts
;
102
atomic_int
released
;
103
int
serial
;
104
105
}
MediaCodecBuffer
;
106
107
#endif
/* AVCODEC_MEDIACODECDEC_COMMON_H */
mediacodec_wrapper.h
s
const char * s
Definition:
avisynth_c.h:768
MediaCodecBuffer::serial
int serial
Definition:
mediacodecdec_common.h:103
AVFrame
This structure describes decoded (raw) audio or video data.
Definition:
frame.h:218
MediaCodecDecContext
Definition:
mediacodecdec_common.h:37
MediaCodecDecContext::stride
int stride
Definition:
mediacodecdec_common.h:57
ff_mediacodec_dec_is_flushing
int ff_mediacodec_dec_is_flushing(AVCodecContext *avctx, MediaCodecDecContext *s)
Definition:
mediacodecdec_common.c:792
ff_mediacodec_dec_init
int ff_mediacodec_dec_init(AVCodecContext *avctx, MediaCodecDecContext *s, const char *mime, FFAMediaFormat *format)
Definition:
mediacodecdec_common.c:463
MediaCodecDecContext::eos
int eos
Definition:
mediacodecdec_common.h:53
MediaCodecDecContext::height
int height
Definition:
mediacodecdec_common.h:56
FFAMediaFormat
Definition:
mediacodec_wrapper.c:162
pkt
static AVPacket pkt
Definition:
demuxing_decoding.c:54
atomic_int
intptr_t atomic_int
Definition:
stdatomic.h:55
MediaCodecDecContext::width
int width
Definition:
mediacodecdec_common.h:55
ff_mediacodec_dec_close
int ff_mediacodec_dec_close(AVCodecContext *avctx, MediaCodecDecContext *s)
Definition:
mediacodecdec_common.c:785
MediaCodecDecContext::display_width
int display_width
Definition:
mediacodecdec_common.h:64
MediaCodecBuffer
Opaque structure representing a MediaCodec buffer to render.
Definition:
mediacodecdec_common.h:97
ff_mediacodec_dec_receive
int ff_mediacodec_dec_receive(AVCodecContext *avctx, MediaCodecDecContext *s, AVFrame *frame, bool wait)
Definition:
mediacodecdec_common.c:656
MediaCodecBuffer::pts
int64_t pts
Definition:
mediacodecdec_common.h:101
MediaCodecDecContext::hw_buffer_count
atomic_int hw_buffer_count
Definition:
mediacodecdec_common.h:41
MediaCodecBuffer::index
ssize_t index
Definition:
mediacodecdec_common.h:100
frame
static AVFrame * frame
Definition:
demuxing_decoding.c:53
MediaCodecDecContext::crop_right
int crop_right
Definition:
mediacodecdec_common.h:63
MediaCodecDecContext::started
int started
Definition:
mediacodecdec_common.h:50
ff_mediacodec_dec_flush
int ff_mediacodec_dec_flush(AVCodecContext *avctx, MediaCodecDecContext *s)
Definition:
mediacodecdec_common.c:767
MediaCodecDecContext::surface
void * surface
Definition:
mediacodecdec_common.h:48
MediaCodecDecContext::output_buffer_count
uint64_t output_buffer_count
Definition:
mediacodecdec_common.h:67
frame.h
reference-counted frame API
ff_mediacodec_dec_send
int ff_mediacodec_dec_send(AVCodecContext *avctx, MediaCodecDecContext *s, AVPacket *pkt)
Definition:
mediacodecdec_common.c:563
MediaCodecDecContext::color_format
int color_format
Definition:
mediacodecdec_common.h:59
MediaCodecDecContext::crop_bottom
int crop_bottom
Definition:
mediacodecdec_common.h:61
MediaCodecDecContext::display_height
int display_height
Definition:
mediacodecdec_common.h:65
MediaCodecBuffer::ctx
MediaCodecDecContext * ctx
Definition:
mediacodecdec_common.h:99
MediaCodecDecContext::flushing
int flushing
Definition:
mediacodecdec_common.h:52
MediaCodecDecContext::refcount
atomic_int refcount
Definition:
mediacodecdec_common.h:40
MediaCodecDecContext::delay_flush
bool delay_flush
Definition:
mediacodecdec_common.h:69
MediaCodecDecContext::crop_left
int crop_left
Definition:
mediacodecdec_common.h:62
MediaCodecDecContext::draining
int draining
Definition:
mediacodecdec_common.h:51
MediaCodecDecContext::serial
atomic_int serial
Definition:
mediacodecdec_common.h:70
avcodec.h
Libavcodec external API header.
AVCodecContext
main external API structure.
Definition:
avcodec.h:1518
MediaCodecDecContext::codec
FFAMediaCodec * codec
Definition:
mediacodecdec_common.h:45
MediaCodecDecContext::format
FFAMediaFormat * format
Definition:
mediacodecdec_common.h:46
FFAMediaCodec
Definition:
mediacodec_wrapper.c:274
MediaCodecDecContext::crop_top
int crop_top
Definition:
mediacodecdec_common.h:60
pixfmt.h
pixel format definitions
MediaCodecDecContext::slice_height
int slice_height
Definition:
mediacodecdec_common.h:58
MediaCodecBuffer::released
atomic_int released
Definition:
mediacodecdec_common.h:102
AVPacket
This structure stores compressed data.
Definition:
avcodec.h:1407
MediaCodecDecContext::avctx
AVCodecContext * avctx
Definition:
mediacodecdec_common.h:39
MediaCodecDecContext::codec_name
char * codec_name
Definition:
mediacodecdec_common.h:43
Generated on Tue May 22 2018 07:06:35 for FFmpeg by
1.8.13