FFmpeg
null.c
Go to the documentation of this file.
1 /*
2  * Null codecs
3  *
4  * This file is part of FFmpeg.
5  *
6  * FFmpeg is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * FFmpeg 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 GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with FFmpeg; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19  */
20 
21 #include "config_components.h"
22 
23 #include "codec_internal.h"
24 #include "decode.h"
25 #include "encode.h"
26 
27 #if CONFIG_VNULL_DECODER || CONFIG_ANULL_DECODER
28 static int null_decode(AVCodecContext *avctx, AVFrame *frame,
29  int *got_frame, AVPacket *avpkt)
30 {
31  *got_frame = 0;
32  return avpkt->size;
33 }
34 
35 #if CONFIG_VNULL_DECODER
36 const FFCodec ff_vnull_decoder = {
37  .p.name = "vnull",
38  CODEC_LONG_NAME("null video"),
39  .p.type = AVMEDIA_TYPE_VIDEO,
40  .p.id = AV_CODEC_ID_VNULL,
41  .p.capabilities = AV_CODEC_CAP_DR1,
42  FF_CODEC_DECODE_CB(null_decode),
43 };
44 #endif
45 
46 #if CONFIG_ANULL_DECODER
47 const FFCodec ff_anull_decoder = {
48  .p.name = "anull",
49  CODEC_LONG_NAME("null audio"),
50  .p.type = AVMEDIA_TYPE_AUDIO,
51  .p.id = AV_CODEC_ID_ANULL,
52  .p.capabilities = AV_CODEC_CAP_DR1,
53  FF_CODEC_DECODE_CB(null_decode),
54 };
55 #endif
56 
57 #endif
58 
59 #if CONFIG_VNULL_ENCODER || CONFIG_ANULL_ENCODER
60 static int null_encode(AVCodecContext *avctx, AVPacket *pkt,
61  const AVFrame *frame, int *got_packet)
62 {
63  *got_packet = 0;
64  return 0;
65 }
66 
67 #if CONFIG_VNULL_ENCODER
68 const FFCodec ff_vnull_encoder = {
69  .p.name = "vnull",
70  CODEC_LONG_NAME("null video"),
71  .p.type = AVMEDIA_TYPE_VIDEO,
72  .p.id = AV_CODEC_ID_VNULL,
73  FF_CODEC_ENCODE_CB(null_encode),
74 };
75 #endif
76 
77 #if CONFIG_ANULL_ENCODER
78 const FFCodec ff_anull_encoder = {
79  .p.name = "anull",
80  CODEC_LONG_NAME("null audio"),
81  .p.type = AVMEDIA_TYPE_AUDIO,
82  .p.id = AV_CODEC_ID_ANULL,
83  .p.capabilities = AV_CODEC_CAP_VARIABLE_FRAME_SIZE,
84  .p.sample_fmts = (const enum AVSampleFormat[]){
92  },
93  FF_CODEC_ENCODE_CB(null_encode),
94 };
95 #endif
96 
97 #endif
AV_SAMPLE_FMT_FLTP
@ AV_SAMPLE_FMT_FLTP
float, planar
Definition: samplefmt.h:66
ff_vnull_decoder
const FFCodec ff_vnull_decoder
AVFrame
This structure describes decoded (raw) audio or video data.
Definition: frame.h:344
encode.h
AV_SAMPLE_FMT_S32P
@ AV_SAMPLE_FMT_S32P
signed 32 bits, planar
Definition: samplefmt.h:65
FFCodec
Definition: codec_internal.h:127
AV_CODEC_ID_VNULL
@ AV_CODEC_ID_VNULL
Dummy null video codec, useful mainly for development and debugging.
Definition: codec_id.h:605
FFCodec::p
AVCodec p
The public AVCodec.
Definition: codec_internal.h:131
ff_anull_encoder
const FFCodec ff_anull_encoder
AV_SAMPLE_FMT_S64P
@ AV_SAMPLE_FMT_S64P
signed 64 bits, planar
Definition: samplefmt.h:69
FF_CODEC_ENCODE_CB
#define FF_CODEC_ENCODE_CB(func)
Definition: codec_internal.h:296
pkt
AVPacket * pkt
Definition: movenc.c:59
FF_CODEC_DECODE_CB
#define FF_CODEC_DECODE_CB(func)
Definition: codec_internal.h:287
AVMEDIA_TYPE_AUDIO
@ AVMEDIA_TYPE_AUDIO
Definition: avutil.h:202
decode.h
CODEC_LONG_NAME
#define CODEC_LONG_NAME(str)
Definition: codec_internal.h:272
frame
static AVFrame * frame
Definition: demux_decode.c:54
ff_vnull_encoder
const FFCodec ff_vnull_encoder
AV_CODEC_CAP_VARIABLE_FRAME_SIZE
#define AV_CODEC_CAP_VARIABLE_FRAME_SIZE
Audio encoder supports receiving a different number of samples in each call.
Definition: codec.h:128
AV_CODEC_CAP_DR1
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() or get_encode_buffer() for allocating buffers and supports custom allocators.
Definition: codec.h:52
AVPacket::size
int size
Definition: packet.h:523
AV_SAMPLE_FMT_U8P
@ AV_SAMPLE_FMT_U8P
unsigned 8 bits, planar
Definition: samplefmt.h:63
codec_internal.h
AV_CODEC_ID_ANULL
@ AV_CODEC_ID_ANULL
Dummy null audio codec, useful mainly for development and debugging.
Definition: codec_id.h:610
AV_SAMPLE_FMT_NONE
@ AV_SAMPLE_FMT_NONE
Definition: samplefmt.h:56
AV_SAMPLE_FMT_S16P
@ AV_SAMPLE_FMT_S16P
signed 16 bits, planar
Definition: samplefmt.h:64
AV_SAMPLE_FMT_U8
@ AV_SAMPLE_FMT_U8
unsigned 8 bits
Definition: samplefmt.h:57
AVSampleFormat
AVSampleFormat
Audio sample formats.
Definition: samplefmt.h:55
AV_SAMPLE_FMT_S16
@ AV_SAMPLE_FMT_S16
signed 16 bits
Definition: samplefmt.h:58
ff_anull_decoder
const FFCodec ff_anull_decoder
AVCodec::name
const char * name
Name of the codec implementation.
Definition: codec.h:194
AVCodecContext
main external API structure.
Definition: avcodec.h:445
AV_SAMPLE_FMT_DBLP
@ AV_SAMPLE_FMT_DBLP
double, planar
Definition: samplefmt.h:67
AVMEDIA_TYPE_VIDEO
@ AVMEDIA_TYPE_VIDEO
Definition: avutil.h:201
AVPacket
This structure stores compressed data.
Definition: packet.h:499
AV_SAMPLE_FMT_DBL
@ AV_SAMPLE_FMT_DBL
double
Definition: samplefmt.h:61
AV_SAMPLE_FMT_S32
@ AV_SAMPLE_FMT_S32
signed 32 bits
Definition: samplefmt.h:59
AV_SAMPLE_FMT_FLT
@ AV_SAMPLE_FMT_FLT
float
Definition: samplefmt.h:60
AV_SAMPLE_FMT_S64
@ AV_SAMPLE_FMT_S64
signed 64 bits
Definition: samplefmt.h:68