Re: [FFmpeg-devel] [PATCH 3/9] tests: drop api-codec-param test

2020-12-01 Thread James Almer

On 12/1/2020 5:19 PM, Anton Khirnov wrote:

It fundamentally depends on deprecated lavf internals.
---
  tests/api/Makefile   |   1 -
  tests/api/api-codec-param-test.c | 256 ---
  tests/fate/api.mak   |   8 -


Should also delete the two ref files in test/ref/fate.


  3 files changed, 265 deletions(-)
  delete mode 100644 tests/api/api-codec-param-test.c


Fine by me.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-devel] [PATCH 3/9] tests: drop api-codec-param test

2020-12-01 Thread Anton Khirnov
It fundamentally depends on deprecated lavf internals.
---
 tests/api/Makefile   |   1 -
 tests/api/api-codec-param-test.c | 256 ---
 tests/fate/api.mak   |   8 -
 3 files changed, 265 deletions(-)
 delete mode 100644 tests/api/api-codec-param-test.c

diff --git a/tests/api/Makefile b/tests/api/Makefile
index b5c4ccae23..c96e636756 100644
--- a/tests/api/Makefile
+++ b/tests/api/Makefile
@@ -2,7 +2,6 @@ APITESTPROGS-$(call ENCDEC, FLAC, FLAC) += api-flac
 APITESTPROGS-$(call DEMDEC, H264, H264) += api-h264
 APITESTPROGS-$(call DEMDEC, H264, H264) += api-h264-slice
 APITESTPROGS-yes += api-seek
-APITESTPROGS-yes += api-codec-param
 APITESTPROGS-$(call DEMDEC, H263, H263) += api-band
 APITESTPROGS-$(HAVE_THREADS) += api-threadmessage
 APITESTPROGS += $(APITESTPROGS-yes)
diff --git a/tests/api/api-codec-param-test.c b/tests/api/api-codec-param-test.c
deleted file mode 100644
index 0868322cb4..00
--- a/tests/api/api-codec-param-test.c
+++ /dev/null
@@ -1,256 +0,0 @@
-/*
- * Copyright (c) 2015 Matthieu Bouron 
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to 
deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 
FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- * THE SOFTWARE.
- */
-
-#include 
-#include "libavformat/avformat.h"
-#include "libavutil/pixdesc.h"
-#include "libavcodec/internal.h"
-#include "libavutil/avassert.h"
-#include "libavutil/opt.h"
-
-static int try_decode_video_frame(AVCodecContext *codec_ctx, AVPacket *pkt, 
int decode)
-{
-int ret = 0;
-int got_frame = 0;
-AVFrame *frame = NULL;
-int skip_frame = codec_ctx->skip_frame;
-
-if (!avcodec_is_open(codec_ctx)) {
-const AVCodec *codec = avcodec_find_decoder(codec_ctx->codec_id);
-
-ret = avcodec_open2(codec_ctx, codec, NULL);
-if (ret < 0) {
-av_log(codec_ctx, AV_LOG_ERROR, "Failed to open codec\n");
-goto end;
-}
-}
-
-frame = av_frame_alloc();
-if (!frame) {
-av_log(NULL, AV_LOG_ERROR, "Failed to allocate frame\n");
-goto end;
-}
-
-if (!decode && 
avpriv_codec_get_cap_skip_frame_fill_param(codec_ctx->codec)) {
-codec_ctx->skip_frame = AVDISCARD_ALL;
-}
-
-do {
-ret = avcodec_decode_video2(codec_ctx, frame, &got_frame, pkt);
-av_assert0(decode || (!decode && !got_frame));
-if (ret < 0)
-break;
-pkt->data += ret;
-pkt->size -= ret;
-
-if (got_frame) {
-break;
-}
-} while (pkt->size > 0);
-
-end:
-codec_ctx->skip_frame = skip_frame;
-
-av_frame_free(&frame);
-return ret;
-}
-
-static int find_video_stream_info(AVFormatContext *fmt_ctx, int decode)
-{
-int ret = 0;
-int i, done = 0;
-AVPacket pkt;
-
-av_init_packet(&pkt);
-
-while (!done) {
-AVCodecContext *codec_ctx = NULL;
-AVStream *st;
-
-if ((ret = av_read_frame(fmt_ctx, &pkt)) < 0) {
-av_log(fmt_ctx, AV_LOG_ERROR, "Failed to read frame\n");
-goto end;
-}
-
-st = fmt_ctx->streams[pkt.stream_index];
-codec_ctx = st->codec;
-
-/* Writing to AVStream.codec_info_nb_frames must not be done by
- * user applications. It is done here for testing purposing as
- * find_video_stream_info tries to mimic avformat_find_stream_info
- * which writes to this field.
- * */
-if (codec_ctx->codec_type != AVMEDIA_TYPE_VIDEO ||
-st->codec_info_nb_frames++ > 0) {
-av_packet_unref(&pkt);
-continue;
-}
-
-ret = try_decode_video_frame(codec_ctx, &pkt, decode);
-if (ret < 0) {
-av_log(fmt_ctx, AV_LOG_ERROR, "Failed to decode video frame\n");
-goto end;
-}
-
-av_packet_unref(&pkt);
-
-/* check if all video streams have demuxed a packet */
-done = 1;
-for (i = 0; i < fmt_ctx->nb_streams; i++) {
-st = fmt_ctx->streams[i];
-codec_ctx = st->codec;
-
-