They discard all input without ever returning any output. Useful for development.
Unified · Split
| @@ -219,6 +219,8 @@ OBJS-$(CONFIG_AMRWB_DECODER) += amrwbdec.o celp_filters.o \ · 218 unmodified lines | ||
| 219 | 219 | acelp_pitch_delay.o |
| 220 | 220 | OBJS-$(CONFIG_AMV_ENCODER) += mjpegenc.o mjpegenc_common.o |
| 221 | 221 | OBJS-$(CONFIG_ANM_DECODER) += anm.o |
| 222 | +OBJS-$(CONFIG_ANULL_DECODER) += null.o | |
| 223 | +OBJS-$(CONFIG_ANULL_ENCODER) += null.o | |
| 222 | 224 | OBJS-$(CONFIG_ANSI_DECODER) += ansi.o cga_data.o |
| 223 | 225 | OBJS-$(CONFIG_APAC_DECODER) += apac.o |
| 224 | 226 | OBJS-$(CONFIG_APE_DECODER) += apedec.o |
| @@ -747,6 +749,8 @@ OBJS-$(CONFIG_VCR1_DECODER) += vcr1.o · 522 unmodified lines | ||
| 747 | 749 | OBJS-$(CONFIG_VMDAUDIO_DECODER) += vmdaudio.o |
| 748 | 750 | OBJS-$(CONFIG_VMDVIDEO_DECODER) += vmdvideo.o |
| 749 | 751 | OBJS-$(CONFIG_VMNC_DECODER) += vmnc.o |
| 752 | +OBJS-$(CONFIG_VNULL_DECODER) += null.o | |
| 753 | +OBJS-$(CONFIG_VNULL_ENCODER) += null.o | |
| 750 | 754 | OBJS-$(CONFIG_VORBIS_DECODER) += vorbisdec.o vorbisdsp.o vorbis.o \ |
| 751 | 755 | vorbis_data.o |
| 752 | 756 | OBJS-$(CONFIG_VORBIS_ENCODER) += vorbisenc.o vorbis.o \ |
| @@ -884,6 +884,12 @@ extern const FFCodec ff_vp9_qsv_decoder; · 883 unmodified lines | ||
| 884 | 884 | extern const FFCodec ff_vp9_vaapi_encoder; |
| 885 | 885 | extern const FFCodec ff_vp9_qsv_encoder; |
| 886 | 886 | |
| 887 | +// null codecs | |
| 888 | +extern const FFCodec ff_vnull_decoder; | |
| 889 | +extern const FFCodec ff_vnull_encoder; | |
| 890 | +extern const FFCodec ff_anull_decoder; | |
| 891 | +extern const FFCodec ff_anull_encoder; | |
| 892 | + | |
| 887 | 893 | // The iterate API is not usable with ossfuzz due to the excessive size of binaries created |
| 888 | 894 | #if CONFIG_OSSFUZZ |
| 889 | 895 | const FFCodec * codec_list[] = { |
| @@ -3625,6 +3625,18 @@ static const AVCodecDescriptor codec_descriptors[] = { · 3624 unmodified lines | ||
| 3625 | 3625 | .long_name = NULL_IF_CONFIG_SMALL("AVFrame to AVPacket passthrough"), |
| 3626 | 3626 | .props = AV_CODEC_PROP_LOSSLESS, |
| 3627 | 3627 | }, |
| 3628 | + { | |
| 3629 | + .id = AV_CODEC_ID_VNULL, | |
| 3630 | + .type = AVMEDIA_TYPE_VIDEO, | |
| 3631 | + .name = "vnull", | |
| 3632 | + .long_name = NULL_IF_CONFIG_SMALL("Null video codec"), | |
| 3633 | + }, | |
| 3634 | + { | |
| 3635 | + .id = AV_CODEC_ID_ANULL, | |
| 3636 | + .type = AVMEDIA_TYPE_AUDIO, | |
| 3637 | + .name = "anull", | |
| 3638 | + .long_name = NULL_IF_CONFIG_SMALL("Null audio codec"), | |
| 3639 | + }, | |
| 3628 | 3640 | }; |
| 3629 | 3641 | |
| 3630 | 3642 | static int descriptor_compare(const void *key, const void *member) |
| @@ -590,6 +590,16 @@ enum AVCodecID { · 589 unmodified lines | ||
| 590 | 590 | * stream (only used by libavformat) */ |
| 591 | 591 | AV_CODEC_ID_FFMETADATA = 0x21000, ///< Dummy codec for streams containing only metadata information. |
| 592 | 592 | AV_CODEC_ID_WRAPPED_AVFRAME = 0x21001, ///< Passthrough codec, AVFrames wrapped in AVPacket |
| 593 | + /** | |
| 594 | + * Dummy null video codec, useful mainly for development and debugging. | |
| 595 | + * Null encoder/decoder discard all input and never return any output. | |
| 596 | + */ | |
| 597 | + AV_CODEC_ID_VNULL, | |
| 598 | + /** | |
| 599 | + * Dummy null audio codec, useful mainly for development and debugging. | |
| 600 | + * Null encoder/decoder discard all input and never return any output. | |
| 601 | + */ | |
| 602 | + AV_CODEC_ID_ANULL, | |
| 593 | 603 | }; |
| 594 | 604 | |
| 595 | 605 | /** |
| @@ -0,0 +1,97 @@ | ||
| 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[]){ | |
| 85 | + AV_SAMPLE_FMT_U8, AV_SAMPLE_FMT_U8P, | |
| 86 | + AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_S16P, | |
| 87 | + AV_SAMPLE_FMT_S32, AV_SAMPLE_FMT_S32P, | |
| 88 | + AV_SAMPLE_FMT_S64, AV_SAMPLE_FMT_S64P, | |
| 89 | + AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_FLTP, | |
| 90 | + AV_SAMPLE_FMT_DBL, AV_SAMPLE_FMT_DBLP, | |
| 91 | + AV_SAMPLE_FMT_NONE, | |
| 92 | + }, | |
| 93 | + FF_CODEC_ENCODE_CB(null_encode), | |
| 94 | +}; | |
| 95 | +#endif | |
| 96 | + | |
| 97 | +#endif | |