mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2026-04-18 00:20:21 +00:00
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> |
||
|---|---|---|
| .. | ||
| .gitignore | ||
| api-band-test.c | ||
| api-dump-stream-meta-test.c | ||
| api-enc-parser-test.c | ||
| api-flac-test.c | ||
| api-h264-slice-test.c | ||
| api-h264-test.c | ||
| api-seek-test.c | ||
| api-threadmessage-test.c | ||
| Makefile | ||