MediaProcessors
ffmpeg_audio.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2017 Rafael Antoniello
3  *
4  * This file is part of MediaProcessors.
5  *
6  * MediaProcessors is free software: you can redistribute it and/or modify
7  * it under the terms of the GNU Lesser General Public License as published by
8  * the Free Software Foundation, either version 3 of the License, or
9  * (at your option) any later version.
10  *
11  * MediaProcessors is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public License
17  * along with MediaProcessors. If not, see <http://www.gnu.org/licenses/>.
18  */
19 
27 #ifndef MEDIAPROCESSORS_SRC_FFMPEG_AUDIO_H_
28 #define MEDIAPROCESSORS_SRC_FFMPEG_AUDIO_H_
29 
30 #include <libmediaprocsutils/mem_utils.h>
31 #include <libmediaprocs/proc.h>
32 
33 /* **** Definitions **** */
34 
35 /* Forward declarations */
36 typedef struct AVCodec AVCodec;
37 typedef struct AVCodecContext AVCodecContext;
38 typedef struct AVFrame AVFrame;
39 typedef struct AVPacket AVPacket;
42 
46 typedef struct ffmpeg_audio_enc_ctx_s {
55  const AVCodec *avcodec;
59  AVCodecContext *avcodecctx;
61 
65 typedef struct ffmpeg_audio_dec_ctx_s {
74  const AVCodec *avcodec;
78  AVCodecContext *avcodecctx;
85 
86 /* **** Prototypes **** */
87 
100 int ffmpeg_audio_enc_ctx_init(ffmpeg_audio_enc_ctx_t *ffmpeg_audio_enc_ctx,
101  int avcodecid, const audio_settings_enc_ctx_t *audio_settings_enc_ctx,
102  log_ctx_t *log_ctx);
103 
112 void ffmpeg_audio_enc_ctx_deinit(ffmpeg_audio_enc_ctx_t *ffmpeg_audio_enc_ctx,
113  log_ctx_t *log_ctx);
114 
126 int ffmpeg_audio_enc_frame(ffmpeg_audio_enc_ctx_t *ffmpeg_audio_enc_ctx,
127  AVFrame *avframe_iput, fifo_ctx_t* oput_fifo_ctx, log_ctx_t *log_ctx);
128 
141 int ffmpeg_audio_dec_ctx_init(ffmpeg_audio_dec_ctx_t *ffmpeg_audio_dec_ctx,
142  int avcodecid, const audio_settings_dec_ctx_t *audio_settings_dec_ctx,
143  log_ctx_t *log_ctx);
144 
153 void ffmpeg_audio_dec_ctx_deinit(ffmpeg_audio_dec_ctx_t *ffmpeg_audio_dec_ctx,
154  log_ctx_t *log_ctx);
155 
167 int ffmpeg_audio_dec_frame(ffmpeg_audio_dec_ctx_t *ffmpeg_audio_dec_ctx,
168  AVPacket *avpacket_iput, fifo_ctx_t* oput_fifo_ctx, log_ctx_t *log_ctx);
169 
182  volatile void *audio_settings_opaque, int flag_is_encoder,
183  log_ctx_t *log_ctx);
184 
185 #endif /* MEDIAPROCESSORS_SRC_FFMPEG_AUDIO_H_ */
AVCodecContext * avcodecctx
Definition: ffmpeg_audio.h:78
struct ffmpeg_audio_dec_ctx_s ffmpeg_audio_dec_ctx_t
int ffmpeg_audio_enc_frame(ffmpeg_audio_enc_ctx_t *ffmpeg_audio_enc_ctx, AVFrame *avframe_iput, fifo_ctx_t *oput_fifo_ctx, log_ctx_t *log_ctx)
Definition: ffmpeg_audio.c:149
void ffmpeg_audio_dec_ctx_deinit(ffmpeg_audio_dec_ctx_t *ffmpeg_audio_dec_ctx, log_ctx_t *log_ctx)
Definition: ffmpeg_audio.c:301
const AVCodec * avcodec
Definition: ffmpeg_audio.h:74
struct ffmpeg_audio_enc_ctx_s ffmpeg_audio_enc_ctx_t
AVCodecContext * avcodecctx
Definition: ffmpeg_audio.h:59
void ffmpeg_audio_reset_on_new_settings(proc_ctx_t *proc_ctx, volatile void *audio_settings_opaque, int flag_is_encoder, log_ctx_t *log_ctx)
Definition: ffmpeg_audio.c:392
struct proc_ctx_s proc_ctx
Definition: ffmpeg_audio.h:51
const AVCodec * avcodec
Definition: ffmpeg_audio.h:55
Definition: log.c:102
int ffmpeg_audio_enc_ctx_init(ffmpeg_audio_enc_ctx_t *ffmpeg_audio_enc_ctx, int avcodecid, const audio_settings_enc_ctx_t *audio_settings_enc_ctx, log_ctx_t *log_ctx)
Definition: ffmpeg_audio.c:55
int ffmpeg_audio_dec_frame(ffmpeg_audio_dec_ctx_t *ffmpeg_audio_dec_ctx, AVPacket *avpacket_iput, fifo_ctx_t *oput_fifo_ctx, log_ctx_t *log_ctx)
Definition: ffmpeg_audio.c:311
void ffmpeg_audio_enc_ctx_deinit(ffmpeg_audio_enc_ctx_t *ffmpeg_audio_enc_ctx, log_ctx_t *log_ctx)
Definition: ffmpeg_audio.c:139
log_ctx_t * log_ctx
Definition: proc.h:103
int ffmpeg_audio_dec_ctx_init(ffmpeg_audio_dec_ctx_t *ffmpeg_audio_dec_ctx, int avcodecid, const audio_settings_dec_ctx_t *audio_settings_dec_ctx, log_ctx_t *log_ctx)
Definition: ffmpeg_audio.c:229