73 Commits
Author SHA1 Message Date
Jun Zhao 2bec125932 tests/api: add a test for AC-3 flush preserving options
Set non-default values for the AC-3, E-AC-3 and fixed-point AC-3
decoder options, decode a frame so that the exported downmix fields
hold values set from the frame header, flush with
avcodec_flush_buffers(), and check that all values are still readable
afterwards. This is a regression test for the decoders forgetting
options such as drc_scale on flush.

Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
2026-10-25 13:03:41 +00:00
Romain Beauxis 9edc0748b6 tests/api: add a test of the samples skipped and discarded by decoders
Decode one PCM packet carrying AV_PKT_DATA_SKIP_SAMPLES and print how
many samples are output, for samples skipped at the start of the frame
and padding discarded at its end, alone, together, overlapping, and with
a padding larger than the frame.

The reference records the current behaviour.
2026-10-23 15:38:04 +00:00
Jun Zhao dd74f3dca1 tests/fate/api: add api-hevc-mp4toannexb test
Add an API test for hevc_mp4toannexb parameter set deduplication,
covering extradata insertion, exact payload deduplication, retaining
differing parameter sets (PPS 0 vs PPS 1), filler SEI preservation,
many nonmatching in-band PPS copies, duplicate extradata parameter set
deduplication, exceeding MAX_EXTRADATA_NALS limit rejection, leading
prefix SEI before matching VPS/SPS, out-of-order in-band parameter sets,
and prefix SEI dependency barriers across multiple parameter sets.

Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
2026-10-04 08:09:26 +08:00
Sahitya Chandra c0e8b139fd tests/api: cover mov_text fallback font table size
Print the serialized sample descriptions for ASS headers without styles
and with an explicit Serif style, and compare them with a FATE reference.

Signed-off-by: Sahitya Chandra <sahityajb@gmail.com>
Assisted-by: Fairy
2026-09-24 12:35:59 +00:00
Jun Zhao 9a71d6a640 fate: add ASTC LDR/HDR round-trip and container tests
Add self-contained FATE coverage for ASTC LDR, HDR, profile mismatch,
3D-block, and ASTC/KTX container paths. Exercise both KTX color profiles
and inspect the generated KTX enum and single-mipmap header fields directly
so the test does not rely solely on FFmpeg's matching demuxer.

Cover the KTX linear default as well: the linear GL internal format says
nothing about the endpoint formats the blocks use, so a linear texture
carrying HDR endpoints has to decode like an explicit -dec_profile
hdr-ldr-a request instead of coming back as the magenta mismatch colour.

Declare the lavfi, filter, codec, muxer, and demuxer dependencies used by
each test, and keep generated negative-test files in the FATE cleanup set.
The HDR test hashes frames converted to the explicitly little-endian
gbrapf32le, so its bytewise output does not depend on the host endianness.

Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
2026-09-14 12:44:07 +00:00
James Almer 818cecc6e1 tests/api/movenc: add a test for fragmented output with no samples
Covers the fix from 9f35e220ff.

Signed-off-by: James Almer <jamrial@gmail.com>
2026-08-30 16:03:25 +00:00
Andreas Rheinhardt dea13cca4f tests/api/Makefile: Don't undef main
Should be unnecessary since fde3bb16f9.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2026-08-23 13:46:55 +02:00
Andreas Rheinhardt 89f58356b3 avcodec/tests/encinfo: Convert into API test
It doesn't use any internals of lavc. Converting it to an API
test tool reduces disk usage for shared builds.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2026-08-23 13:46:55 +02:00
Andreas Rheinhardt a1d860a00d avformat/tests/movenc: Convert to API test tool
This is possible because it only uses the public API;
and beneficial when using shared builds (as not all
the internals of lavf are linked statically in the binary).

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2026-08-17 21:06:01 +02:00
Soham Kute 9bf999c24f avcodec/tests: add encoder-parser API test for H.261
Add tests/api/api-enc-parser-test.c, a generic encoder+parser round-trip
test that takes codec_name, width, and height on the command line
(defaults: h261 176 144).

Three cases are tested:

garbage - a single av_parser_parse2() call on 8 bytes with no Picture
Start Code; verifies out_size == 0 so the parser emits no spurious data.

bulk - encodes 2 frames, concatenates the raw packets, feeds the whole
buffer to a fresh parser in one call, then flushes.  Verifies that
exactly 2 non-empty frames come out and that the parser found the PSC
boundary between them.

split - the same buffer fed in two halves (chunk boundary falls inside
frame 0).  Verifies the parser still emits exactly 2 frames when input
arrives incrementally, and that the collected bytes are identical to
the bulk output (checked with memcmp).

Implementation notes: avcodec_get_supported_config() selects the pixel
format; chroma height uses AV_CEIL_RSHIFT with log2_chroma_h from
AVPixFmtDescriptor; data[1] and data[2] are checked independently so
semi-planar formats work; the encoded buffer is given
AV_INPUT_BUFFER_PADDING_SIZE zero bytes at the end; parse_stream()
skips the fed chunk if consumed==0 to prevent an infinite loop.

Two FATE entries in tests/fate/api.mak: QCIF (176x144) and CIF
(352x288), both standard H.261 resolutions.

Signed-off-by: Soham Kute <officialsohamkute@gmail.com>
2026-03-29 23:01:39 +00:00
Kacper Michajłow dd4c524dbc api-h264-test: indent output
This matches tests/ref files.

Signed-off-by: Kacper Michajłow <kasper93@gmail.com>
2025-10-25 11:11:41 +02:00
Timo Rothenpieler 0362cb3806 build: link with CXX when -lstdc++ on linker commandline 2025-09-14 11:45:11 +00:00
Andreas Rheinhardt 62f7b43b53 tests/api/api-dump-stream-meta-test: Fix leaks
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-05-05 17:03:39 +02:00
Romain Beauxis 2431fd0b27 tests: Add stream dump test API util, use it to dump stream data for chained ogg/{vorbis, opus, flac} streams.
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-04-30 00:03:00 +02:00
Andreas Rheinhardt edcfa846cf api/api-band-test: Query codec capabilities to decide admissibility
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-06-12 14:29:30 +02:00
Andreas Rheinhardt b8cc5cf233 api/api-band-test: Perform codec admissibility check earlier
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-06-12 14:29:30 +02:00
Andreas Rheinhardt 4c22b00780 api/api-band-test: Remove write-only variable
Besides being write only it had the wrong type:
An uint8_t is definitely not enough to store the size
of these buffers.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-06-12 14:29:30 +02:00
Andreas Rheinhardt 790f793844 avutil/common: Don't auto-include mem.h
There are lots of files that don't need it: The number of object
files that actually need it went down from 2011 to 884 here.

Keep it for external users in order to not cause breakages.

Also improve the other headers a bit while just at it.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-03-31 00:08:43 +01:00
Anton Khirnov 9c0401bd59 tests/api: use AVFrame.duration instead of AVFrame.pkt_duration 2022-07-19 12:27:18 +02:00
James Almer 7d532f474d tests: convert to new channel layout-API
Signed-off-by: James Almer <jamrial@gmail.com>
2022-03-15 09:42:47 -03:00
Andreas Rheinhardt 1ea3650823 Replace all occurences of av_mallocz_array() by av_calloc()
They do the same.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-09-20 01:03:52 +02:00
Andreas Rheinhardt 1be3d8a0cb avcodec/avcodec: Stop including channel_layout.h in avcodec.h
Also include channel_layout.h directly wherever used.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-07-22 11:14:31 +02:00
Andreas Rheinhardt 626535f6a1 avcodec/codec, allcodecs: Constify the AVCodec API
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2021-04-27 10:43:14 -03:00
Andreas Rheinhardt a240097ecd avutil: Switch crypto APIs to size_t
Announced in e435beb1ea.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2021-04-27 10:43:13 -03:00
James Almer 7643a35474 tests/api/api-flac-test: use av_packet_alloc() to allocate packets
Signed-off-by: James Almer <jamrial@gmail.com>
2021-03-17 15:19:37 -03:00
Anton Khirnov 8369a2873c tests/api-flac-test: reindent 2021-03-08 09:29:50 +01:00
Anton Khirnov f942e14884 tests/api-flac-test: convert to new encoding/decoding API 2021-03-08 09:29:50 +01:00
Anton Khirnov ba30fd6c81 tests/api-flac-test: ensure the frame is writable before writing to it
The encoder may keep a reference to frames that were sent to it, so the
caller cannot modify them without checking first.
2021-03-08 09:29:50 +01:00
Anton Khirnov a5b737e625 tests/api-band-test: simplify code 2021-02-25 11:46:28 +01:00
Anton Khirnov bb2651a921 api-seek-test: use non-obsolete decoding API 2021-01-01 14:33:08 +01:00
Anton Khirnov 88e098029d api-band-test: use non-obsolete decoding API 2021-01-01 14:33:03 +01:00
Anton Khirnov 94988f9107 api-h264-test: use non-obsolete decoding API 2021-01-01 14:32:48 +01:00
Anton Khirnov fe7f0d366f tests: drop api-codec-param test
It fundamentally depends on deprecated lavf internals.
2020-12-10 09:46:30 +01:00
Anton Khirnov 0d6b4351c6 Remove unnecessary use of avcodec_close().
Replace it with avcodec_free_context() or drop it completely as
appropriate.
2020-06-10 11:31:16 +02:00
Anton Khirnov f30a41a608 Stop hardcoding align=32 in av_frame_get_buffer() calls.
Use 0, which selects the alignment automatically.
2020-05-22 14:38:57 +02:00
Linjie Fu e3510fb178 tests/api/api-h264-slice-test: remove unused bool header
Signed-off-by: Linjie Fu <linjie.fu@intel.com>
Signed-off-by: Josh de Kock <josh@itanimul.li>
2020-04-29 13:30:46 +01:00
Jun Zhao 84e7aff608 tests/api/api-h264-test: Add AV_NOPTS_VALUE check for AVFrame.pkt_dts/pts
Use av_ts2str() for AVFrame.pkt_dts/pts to avoid print the
pkt_dts/pts as negative number like:
"0,    3616613, -9223372036854775808,     1001,  3110400, 0x75e37a65"

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Jun Zhao <mypopydev@gmail.com>
2019-02-12 22:28:15 +08:00
Rafaël Carré 75ea329b78 api-h264-slice-test: fix arguments and help
This program only takes 2 arguments
Remove comment that was never right

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-01-14 17:16:55 +01:00
Carl Eugen Hoyos 464aa60eb5 tests/api-flac-test: Rename NUMBER_OF_FRAMES as NUMBER_OF_AUDIO_FRAMES.
In system header /usr/include/sys/mstsave.h, aix defines NUMBER_OF_FRAMES,
causing redefinition warnings.
2018-12-11 19:14:02 +01:00
Peter Ross 3fc7b69496 fate-api-h264-slice: use the heap for nal buffer
nal buffer is 512 kilobytes

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2018-11-21 00:33:38 +01:00
Peter Ross 7cda7d217c api-h264-slice-test: use av_be2ne16 instead of ntohs
avformat/network.h is not required here.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2018-11-21 00:33:38 +01:00
Josh de Kock 1052578dad fate/api-h264-slice-test: use cleaner error handling
Signed-off-by: James Almer <jamrial@gmail.com>
2018-11-03 12:49:00 -03:00
Josh de Kock 8096f52049 fate/api-h264-slice-test: don't use ssize_t
Fixes ticket #7521

Signed-off-by: James Almer <jamrial@gmail.com>
2018-11-03 12:46:45 -03:00
James Almer 59a35fe1f6 tests/api-h264-slice-test: use the correct function to free the AVHashContext
Fixes memleaks.

Signed-off-by: James Almer <jamrial@gmail.com>
2018-10-27 00:12:30 -03:00
Josh de Kock fb7925ba2f fate: add api-h264-slice test
This test ensures that you are able to send N number of slice NALUs in slice threaded mode to be decoded simultaneously
2018-10-26 11:51:04 +01:00
Clément Bœsch 71fa82bed6 lavu/threadmessage: add av_thread_message_queue_nb_elems() 2018-04-26 19:41:19 +02:00
Josh de Kock 89029bd2c7 lav*,tests: remove several register_all calls
avdevice_register_all() is still required to register devices into
lavf (this is required due to lavd being somewhat of a hack).

Signed-off-by: Josh de Kock <josh@itanimul.li>
2018-04-02 03:26:22 +01:00
Muhammad Faiz cdd3048134 tests: do not use AVFrame accessor
Reviewed-by: wm4 <nfxjfg@googlemail.com>
Signed-off-by: Muhammad Faiz <mfcc64@gmail.com>
2017-04-23 14:47:54 +07:00
Clément Bœsch 210678d3c5 Merge commit '3794062ab1a13442b06f6d76c54dce51ffa54697'
* commit '3794062ab1a13442b06f6d76c54dce51ffa54697':
  Remove Plan 9 support

Merged-by: Clément Bœsch <u@pkh.me>
2017-04-09 14:52:00 +02:00
James Almer ff17c76e92 tests/api-seek: fix memory leak on realloc() failure
Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: James Almer <jamrial@gmail.com>
2017-03-12 14:29:11 -03:00