From patchwork Sun May 15 19:55:43 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Scott Theisen X-Patchwork-Id: 35779 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:a885:b0:7f:4be2:bd17 with SMTP id ca5csp1247299pzb; Sun, 15 May 2022 12:56:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzuTyH5SEuBI7Ki1lXh4TWNHAnuGokEbKCq3uxGmuXMGCjR2+U17Ke8jarBFxk/kI4/Z2qa X-Received: by 2002:a05:6402:3684:b0:42a:4fc2:644c with SMTP id ej4-20020a056402368400b0042a4fc2644cmr9805445edb.56.1652644571720; Sun, 15 May 2022 12:56:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652644571; cv=none; d=google.com; s=arc-20160816; b=i8Z4JgLtPpRTUE8kf06NFLDnNKgf4cbQPOey5aqHOHYGuDxXDbHwV4xk5NmgF10WFc 04v9rFp8TNR0pS1VfMB3mUcrg5yQFLf3bme7jOopkY9bufBW0ecYYCdofvtkb+9Y4nCy nb3wBWpuv3h8ksbjBEvr05TsrKeqgDIcMLM/7no2+f0FlW+olT0Yg/jXnzxy5APAkOIp 4eipWC/xb1rqVlpsqS9iM0RHO1yayGhv3X9GlTC6vpFjn8RxWO/WFBXYZlrCbsvtwS7Z UK7Y7QEg6/4Qjbfp6YwWIiAgP2XhrB0bnw7c8QU+PfGeLHHn4/FygvcSqYuWgOgErfIh 6s4g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature:delivered-to; bh=llT+cTt87b0JfSZ5Bb9D7EymndV/2cXZ2Pnt57d5m18=; b=KBm556kf72UAr97E5lE4eT1FJcaY2e8e8jjPVdDEt1RBrEAWJhZZD51/mcmW3sW7Q9 Sefg0kaFxsW0dCKp+1nwE6wg3wfn/4zXkJMDy/NOnPgwMtiTlYxSU5eMgtnCHIB9Atfx bh6MVkNYMCI5PIiY73GRyd9leKOgW/WpkHEy5MEjtQdM9/uQCjTs82HCL1OzIwPTMTEo v2V2tirQqPJVkX/OTtoB/P198dXypQB6OTP18gcQRaa7FGbuoAVkA/IRvL5b1uzucKde MMfzPLtHLwhpMueKuVhwo9FYhNU7uZtt6JNDXCDYqhN1YWhr/Nuk3Bulr0gZmDIyOdxD OIzA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20210112 header.b="j/LH5WvF"; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id a12-20020aa7d90c000000b0042aae338f71si1463623edr.236.2022.05.15.12.56.11; Sun, 15 May 2022 12:56:11 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20210112 header.b="j/LH5WvF"; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 40E2668B4E3; Sun, 15 May 2022 22:56:02 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-qk1-f175.google.com (mail-qk1-f175.google.com [209.85.222.175]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 126FE68AFAB for ; Sun, 15 May 2022 22:55:55 +0300 (EEST) Received: by mail-qk1-f175.google.com with SMTP id b20so10994759qkc.6 for ; Sun, 15 May 2022 12:55:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=1TUqa8OLojPcab0NetDLqtUPladDTV1wBZJ3Oi8K7iA=; b=j/LH5WvFaWxvX37KE5UtkRNyOPo0Fevyj0TO3BkBB0ZsItrftrgKhOFehNleEJoEHL 9eLydlYwEZMLDKsA71dQ0JMptAVwha3cFC3OhkKfwm8sgh9sYXs6gpOh8epesi9gRYWU NhxIrybEWGp/KJi9uWjpTnJL/4gMQGipZ/roYeVmakCNqa9h/mThBNK52bs2RgP2A5Hf VuTPPJVUJYKz0JP2Qo861PP9jIN4X7TVbiCWlRJSe7i96YsVNDryCQAYB5+Syi6Iv+Z5 6fHdu0qC+BpIWD31RIuTHqkM5x7C9RvpsBKOi5doZchA7gFuFd4nE7slv9LLiyT2nbrK gArw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=1TUqa8OLojPcab0NetDLqtUPladDTV1wBZJ3Oi8K7iA=; b=0zY4PfCyUkzsDpKz4oICjYbPfHBALnRhGylNxlzB3DnEBKffbQ8YMivcpHdGPewj1a cj4nM6R3+HlmSWgAZ1da7Kv8VzAiJV3PSXmFsTMoiCGVyarw0BcgRDVOa7jqVou+UHAX E0sXganGpOOZIlPSfj6C5tf1E0mNhtIUXanZpSw2AHIoHe83UDXyhwOFsfzWq+r0+OOs kQaNpUVtSwoyHta+NcFGI3WOdHNc7dVbCrrL8JHY8TGxvcn6VGs7n5Zu3736J7DecTkI eX+v4JWXXS+uk/mcKGYt9Evb5fyKV/pIQ1SHV65s+qkkUxYpuBLSw7ObIJgIvkjrZsDs C5hw== X-Gm-Message-State: AOAM531MErsEvPYSYjRX/In/p71l21Y1SJmnOw10ajSjPIoB/1vU2tOO NVmXgRl/10ewAWUjPyR9Skfsfw1Xjd4= X-Received: by 2002:a05:620a:4691:b0:6a0:3684:fc2d with SMTP id bq17-20020a05620a469100b006a03684fc2dmr10413043qkb.208.1652644553222; Sun, 15 May 2022 12:55:53 -0700 (PDT) Received: from scott-desktop.. ([151.200.235.219]) by smtp.gmail.com with ESMTPSA id p5-20020a37bf05000000b0069fc13ce206sm4642271qkf.55.2022.05.15.12.55.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 15 May 2022 12:55:52 -0700 (PDT) From: Scott Theisen To: ffmpeg-devel@ffmpeg.org Date: Sun, 15 May 2022 15:55:43 -0400 Message-Id: <20220515195544.280890-2-scott.the.elm@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220515195544.280890-1-scott.the.elm@gmail.com> References: <20220201223058.31090-1-scott.the.elm@gmail.com> <20220515195544.280890-1-scott.the.elm@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v4 1/2] libavutil: create av_media_type_get_string() X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Cc: Scott Theisen Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: HOfq0vBQBybS This deprecates av_get_media_type_string() which does return NULL. printf %s with a null pointer is undefined behavior This also matches behavior with avcodec_get_name() which never returns NULL, instead it returns "unknown_codec". --- doc/APIchanges | 3 +++ libavutil/avutil.h | 10 ++++++++++ libavutil/utils.c | 13 +++++++++++++ 3 files changed, 26 insertions(+) diff --git a/doc/APIchanges b/doc/APIchanges index 1a9f0a303e..53f4378a50 100644 --- a/doc/APIchanges +++ b/doc/APIchanges @@ -14,6 +14,9 @@ libavutil: 2021-04-27 API changes, most recent first: +2022-05-XX - xxxxxxxxxxx - lavu 57.19.100 - avutil.h + Add av_media_type_get_string() which deprecates av_get_media_type_string(). + 2022-03-16 - xxxxxxxxxx - all libraries - version_major.h Add lib/version_major.h as new installed headers, which only contain the major version number (and corresponding API deprecation diff --git a/libavutil/avutil.h b/libavutil/avutil.h index 4d633156d1..0f03080dcb 100644 --- a/libavutil/avutil.h +++ b/libavutil/avutil.h @@ -21,6 +21,8 @@ #ifndef AVUTIL_AVUTIL_H #define AVUTIL_AVUTIL_H +#include "attributes.h" + /** * @file * @ingroup lavu @@ -209,9 +211,17 @@ enum AVMediaType { /** * Return a string describing the media_type enum, NULL if media_type * is unknown. + * + * @deprecated Use av_media_type_get_string() instead. */ +attribute_deprecated const char *av_get_media_type_string(enum AVMediaType media_type); +/** + * Return a string describing the media_type enum, never NULL. + */ +const char *av_media_type_get_string(enum AVMediaType media_type); + /** * @defgroup lavu_const Constants * @{ diff --git a/libavutil/utils.c b/libavutil/utils.c index 94d247bbee..5e0be8361f 100644 --- a/libavutil/utils.c +++ b/libavutil/utils.c @@ -37,6 +37,19 @@ const char *av_get_media_type_string(enum AVMediaType media_type) } } +const char *av_media_type_get_string(enum AVMediaType media_type) +{ + switch (media_type) { + case AVMEDIA_TYPE_UNKNOWN: return "unknown"; + case AVMEDIA_TYPE_VIDEO: return "video"; + case AVMEDIA_TYPE_AUDIO: return "audio"; + case AVMEDIA_TYPE_DATA: return "data"; + case AVMEDIA_TYPE_SUBTITLE: return "subtitle"; + case AVMEDIA_TYPE_ATTACHMENT: return "attachment"; + default: return "invalid_media_type"; + } +} + char av_get_picture_type_char(enum AVPictureType pict_type) { switch (pict_type) { From patchwork Sun May 15 19:55:44 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Scott Theisen X-Patchwork-Id: 35780 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:a885:b0:7f:4be2:bd17 with SMTP id ca5csp1247342pzb; Sun, 15 May 2022 12:56:20 -0700 (PDT) X-Google-Smtp-Source: ABdhPJylCV4X1cwVdb3A49g006eg56VUk9bdsuM9S3rdKZqhd0rTzPG47gJe9o+EKFzqdBUUrb2V X-Received: by 2002:aa7:dd91:0:b0:427:b2c4:1c7a with SMTP id g17-20020aa7dd91000000b00427b2c41c7amr9762278edv.91.1652644579951; Sun, 15 May 2022 12:56:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652644579; cv=none; d=google.com; s=arc-20160816; b=g5z7cFM31vh/ADaP3x0w7EKxaM0lyS7NsBNRKQzhHOf3ODICUTYWOwTX4+5fpNciQx MB199B2LSBtRLDtKPWylzQ7/5/mIaqnOKB1YheaVDz0GBjE+6rKwZG+nx0X76T3cWw9D UP65HRz9O9ASkq1HMlVGqumVkNasi8J6/PpgKoUWDFaggj0Q8inFZ328dUNMcBBPy4JG BS3JM8Ww27tvLsSpbXTAJHWud2yKnIH8FvyC3K+EVZ5NcTfBlqDquqKtv0wtahv03TOM EoBeZrsmNjqG+ydGtaMCItYX2rObBR/10/eJh4KsxZqWYiXZIenZy1cskGpWnp7GX5UO yFGw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature:delivered-to; bh=Xe+GHECiJQmqjQCrloLxPW5GzknaO4yMynDNAfCf1ho=; b=KTW3Et2giAdw7BHpxQt8JwkWujV0AjqJpZ5KYsYHlDzG/SeSgk7TRN5ZZxIHy+dVQT Xu1FliNA3bA2n4tWCtu5ITPAPS4nLRg6aBmpwmUEcSStX14qyeG6kuKrRC+VKe6aDzWK tMCyJ+8+I26VTwR5n9/iTRkqcO5BVwFi/FYbQZK6nhvPbI+5Djdb/UPwgxB3g9p7UDJp 0hjY3umkLdZiKU5COjT0nsk7tCdJjcYJ/Wa7aXFpWsyDc3dTZE8Xjr6L4Tt7Zm8SSWrm cQbMeLcWXjTqVo3mIWvRrEcfythtqV+y5rjPzZoBKq4mbfH1A/CrPRgOGBSdtmrsMVWi hbcg== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20210112 header.b=aREMzdxA; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id g13-20020aa7c84d000000b00425f5f6e2easi7383528edt.553.2022.05.15.12.56.19; Sun, 15 May 2022 12:56:19 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20210112 header.b=aREMzdxA; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 26A1668B4EA; Sun, 15 May 2022 22:56:03 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-qt1-f171.google.com (mail-qt1-f171.google.com [209.85.160.171]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id F2F1E68B34D for ; Sun, 15 May 2022 22:55:55 +0300 (EEST) Received: by mail-qt1-f171.google.com with SMTP id g3so9601558qtb.7 for ; Sun, 15 May 2022 12:55:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=wAxESXAgCJW0rhSd+PlSXPbLhFE59UI/RuiYNj9w0JM=; b=aREMzdxAzFm0kMj7PFjn60GZQ4SmH0u8XQ+fpWFZClb3OMZkZXM254hs1pc7Bh0tkV CV7VOo8ygRhP8FM9pi0iQ0rvY/Gvy7uW5MLazFDS/AovA99dStjP8bwq7XOhF7Xz9FIc sW1zaSlpo1bStT/IAUtTe/QLlt2gg6FJNA2o/laE+SFWxKId/uhZvhWY5SS7BKi8H4t8 Wy0Bg0hG1GTQiamY1mxATS8F+5Yiy28DmyTaPsrm68eUcNEmx+wuK0ot2xOV5+nJgTkn cWvGN9Wc972YqR+slRdMviRPbdek4uZfxH9kOWeCQyT2IQSl6nFlkCJCzZCqb37m42eZ D2jg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=wAxESXAgCJW0rhSd+PlSXPbLhFE59UI/RuiYNj9w0JM=; b=Wae2Xh70eqVbqTLUfQS0E148bDwyo7u1yQXhahoqNP/0eyzgF4yFIbh+l56IbJLUsP p02SMZCkMq8CjmKZS7UvVXRJZDrhcM3G0Vh1vbQLsqFhDHK4t7YDZb1hQDvIBXqxpUOT DNufmYWG/JbZoqujneE3WRcVUy/dbzo0h0N/ohtDKqcdNtYZxcCqbRqmSezGb/zUvJI9 Vle9P9TS+ywgAFFWPlU0Xc7QHTYAB4Ji7A5gR7qZM7zY1lbtrFYT6WBmwOMr1nTaqfFW 6JM11Zx6lb7oEyMnrNKVjV9WzP9JCPhPSj0NH/obb2iAodPmJXrNEQyzlh3xbUL2IjU+ 4rcQ== X-Gm-Message-State: AOAM532Bd76ywq2gn7Yi5wliqYat8Pfl/yPJkaKyJl3h5lNhbMwOpMbD CURrAn55w0Vs4OwNQ3BdTlLqwPGkUhA= X-Received: by 2002:a05:622a:20d:b0:2f8:f3e9:5047 with SMTP id b13-20020a05622a020d00b002f8f3e95047mr1430062qtx.436.1652644553995; Sun, 15 May 2022 12:55:53 -0700 (PDT) Received: from scott-desktop.. ([151.200.235.219]) by smtp.gmail.com with ESMTPSA id p5-20020a37bf05000000b0069fc13ce206sm4642271qkf.55.2022.05.15.12.55.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 15 May 2022 12:55:53 -0700 (PDT) From: Scott Theisen To: ffmpeg-devel@ffmpeg.org Date: Sun, 15 May 2022 15:55:44 -0400 Message-Id: <20220515195544.280890-3-scott.the.elm@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220515195544.280890-1-scott.the.elm@gmail.com> References: <20220201223058.31090-1-scott.the.elm@gmail.com> <20220515195544.280890-1-scott.the.elm@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v4 2/2] av_get_media_type_string(): replace with av_media_type_get_string() X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Cc: Scott Theisen Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: lCU1/g6WEnD6 printf %s with a null pointer is undefined behavior. --- doc/examples/demuxing_decoding.c | 10 +++++----- doc/examples/extract_mvs.c | 4 ++-- fftools/ffmpeg.c | 12 ++++++------ fftools/ffmpeg_mux.c | 2 +- fftools/ffmpeg_opt.c | 2 +- fftools/ffplay.c | 4 ++-- fftools/ffprobe.c | 13 +++---------- fftools/opt_common.c | 7 +++---- libavcodec/avcodec.c | 2 +- libavcodec/tests/avcodec.c | 10 ++-------- libavdevice/dshow.c | 4 ++-- libavfilter/avfilter.c | 4 ++-- libavfilter/avfiltergraph.c | 4 ++-- libavfilter/src_movie.c | 6 +++--- libavformat/avienc.c | 2 +- libavformat/flvenc.c | 2 +- libavformat/framehash.c | 2 +- libavformat/mov.c | 2 +- libavformat/mpegenc.c | 2 +- libavformat/mpegts.c | 2 +- libavformat/mxfdec.c | 2 +- libavformat/segment.c | 2 +- libavformat/tee.c | 2 +- libavformat/uncodedframecrcenc.c | 4 +--- 24 files changed, 45 insertions(+), 61 deletions(-) diff --git a/doc/examples/demuxing_decoding.c b/doc/examples/demuxing_decoding.c index 999a78db0d..467eda8a51 100644 --- a/doc/examples/demuxing_decoding.c +++ b/doc/examples/demuxing_decoding.c @@ -155,7 +155,7 @@ static int open_codec_context(int *stream_idx, ret = av_find_best_stream(fmt_ctx, type, -1, -1, NULL, 0); if (ret < 0) { fprintf(stderr, "Could not find %s stream in input file '%s'\n", - av_get_media_type_string(type), src_filename); + av_media_type_get_string(type), src_filename); return ret; } else { stream_index = ret; @@ -165,7 +165,7 @@ static int open_codec_context(int *stream_idx, dec = avcodec_find_decoder(st->codecpar->codec_id); if (!dec) { fprintf(stderr, "Failed to find %s codec\n", - av_get_media_type_string(type)); + av_media_type_get_string(type)); return AVERROR(EINVAL); } @@ -173,21 +173,21 @@ static int open_codec_context(int *stream_idx, *dec_ctx = avcodec_alloc_context3(dec); if (!*dec_ctx) { fprintf(stderr, "Failed to allocate the %s codec context\n", - av_get_media_type_string(type)); + av_media_type_get_string(type)); return AVERROR(ENOMEM); } /* Copy codec parameters from input stream to output codec context */ if ((ret = avcodec_parameters_to_context(*dec_ctx, st->codecpar)) < 0) { fprintf(stderr, "Failed to copy %s codec parameters to decoder context\n", - av_get_media_type_string(type)); + av_media_type_get_string(type)); return ret; } /* Init the decoders */ if ((ret = avcodec_open2(*dec_ctx, dec, NULL)) < 0) { fprintf(stderr, "Failed to open %s codec\n", - av_get_media_type_string(type)); + av_media_type_get_string(type)); return ret; } *stream_idx = stream_index; diff --git a/doc/examples/extract_mvs.c b/doc/examples/extract_mvs.c index cc1311da91..2fb5517708 100644 --- a/doc/examples/extract_mvs.c +++ b/doc/examples/extract_mvs.c @@ -85,7 +85,7 @@ static int open_codec_context(AVFormatContext *fmt_ctx, enum AVMediaType type) ret = av_find_best_stream(fmt_ctx, type, -1, -1, &dec, 0); if (ret < 0) { fprintf(stderr, "Could not find %s stream in input file '%s'\n", - av_get_media_type_string(type), src_filename); + av_media_type_get_string(type), src_filename); return ret; } else { int stream_idx = ret; @@ -109,7 +109,7 @@ static int open_codec_context(AVFormatContext *fmt_ctx, enum AVMediaType type) av_dict_free(&opts); if (ret < 0) { fprintf(stderr, "Failed to open %s codec\n", - av_get_media_type_string(type)); + av_media_type_get_string(type)); return ret; } diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c index a85ed18b08..0382c80bd1 100644 --- a/fftools/ffmpeg.c +++ b/fftools/ffmpeg.c @@ -1447,7 +1447,7 @@ static void print_final_stats(int64_t total_size) total_packets += ist->nb_packets; av_log(NULL, AV_LOG_VERBOSE, " Input stream #%d:%d (%s): ", - i, j, av_get_media_type_string(type)); + i, j, av_media_type_get_string(type)); av_log(NULL, AV_LOG_VERBOSE, "%"PRIu64" packets read (%"PRIu64" bytes); ", ist->nb_packets, ist->data_size); @@ -1481,7 +1481,7 @@ static void print_final_stats(int64_t total_size) total_packets += ost->packets_written; av_log(NULL, AV_LOG_VERBOSE, " Output stream #%d:%d (%s): ", - i, j, av_get_media_type_string(type)); + i, j, av_media_type_get_string(type)); if (ost->encoding_needed) { av_log(NULL, AV_LOG_VERBOSE, "%"PRIu64" frames encoded", ost->frames_encoded); @@ -3321,7 +3321,7 @@ static void report_new_stream(int input_index, AVPacket *pkt) return; av_log(file->ctx, AV_LOG_WARNING, "New %s stream %d:%d at pos:%"PRId64" and DTS:%ss\n", - av_get_media_type_string(st->codecpar->codec_type), + av_media_type_get_string(st->codecpar->codec_type), input_index, pkt->stream_index, pkt->pos, av_ts2timestr(pkt->dts, &st->time_base)); file->nb_streams_warn = pkt->stream_index + 1; @@ -4055,7 +4055,7 @@ static int process_input(int file_index) if (debug_ts) { av_log(NULL, AV_LOG_INFO, "demuxer -> ist_index:%d type:%s " "next_dts:%s next_dts_time:%s next_pts:%s next_pts_time:%s pkt_pts:%s pkt_pts_time:%s pkt_dts:%s pkt_dts_time:%s duration:%s duration_time:%s off:%s off_time:%s\n", - ifile->ist_index + pkt->stream_index, av_get_media_type_string(ist->dec_ctx->codec_type), + ifile->ist_index + pkt->stream_index, av_media_type_get_string(ist->dec_ctx->codec_type), av_ts2str(ist->next_dts), av_ts2timestr(ist->next_dts, &AV_TIME_BASE_Q), av_ts2str(ist->next_pts), av_ts2timestr(ist->next_pts, &AV_TIME_BASE_Q), av_ts2str(pkt->pts), av_ts2timestr(pkt->pts, &ist->st->time_base), @@ -4183,7 +4183,7 @@ static int process_input(int file_index) "timestamp discontinuity for stream #%d:%d " "(id=%d, type=%s): %"PRId64", new offset= %"PRId64"\n", ist->file_index, ist->st->index, ist->st->id, - av_get_media_type_string(ist->dec_ctx->codec_type), + av_media_type_get_string(ist->dec_ctx->codec_type), delta, ifile->ts_offset); pkt->dts -= av_rescale_q(delta, AV_TIME_BASE_Q, ist->st->time_base); if (pkt->pts != AV_NOPTS_VALUE) @@ -4212,7 +4212,7 @@ static int process_input(int file_index) if (debug_ts) { av_log(NULL, AV_LOG_INFO, "demuxer+ffmpeg -> ist_index:%d type:%s pkt_pts:%s pkt_pts_time:%s pkt_dts:%s pkt_dts_time:%s duration:%s duration_time:%s off:%s off_time:%s\n", - ifile->ist_index + pkt->stream_index, av_get_media_type_string(ist->dec_ctx->codec_type), + ifile->ist_index + pkt->stream_index, av_media_type_get_string(ist->dec_ctx->codec_type), av_ts2str(pkt->pts), av_ts2timestr(pkt->pts, &ist->st->time_base), av_ts2str(pkt->dts), av_ts2timestr(pkt->dts, &ist->st->time_base), av_ts2str(pkt->duration), av_ts2timestr(pkt->duration, &ist->st->time_base), diff --git a/fftools/ffmpeg_mux.c b/fftools/ffmpeg_mux.c index 3cdaa494d7..234819e942 100644 --- a/fftools/ffmpeg_mux.c +++ b/fftools/ffmpeg_mux.c @@ -170,7 +170,7 @@ void of_write_packet(OutputFile *of, AVPacket *pkt, OutputStream *ost, if (debug_ts) { av_log(NULL, AV_LOG_INFO, "muxer <- type:%s " "pkt_pts:%s pkt_pts_time:%s pkt_dts:%s pkt_dts_time:%s duration:%s duration_time:%s size:%d\n", - av_get_media_type_string(ost->enc_ctx->codec_type), + av_media_type_get_string(ost->enc_ctx->codec_type), av_ts2str(pkt->pts), av_ts2timestr(pkt->pts, &ost->st->time_base), av_ts2str(pkt->dts), av_ts2timestr(pkt->dts, &ost->st->time_base), av_ts2str(pkt->duration), av_ts2timestr(pkt->duration, &ost->st->time_base), diff --git a/fftools/ffmpeg_opt.c b/fftools/ffmpeg_opt.c index 47e8b9b7bd..890476c46b 100644 --- a/fftools/ffmpeg_opt.c +++ b/fftools/ffmpeg_opt.c @@ -1704,7 +1704,7 @@ static void check_streamcopy_filters(OptionsContext *o, AVFormatContext *oc, "Filtering and streamcopy cannot be used together.\n", ost->filters ? "Filtergraph" : "Filtergraph script", ost->filters ? ost->filters : ost->filters_script, - av_get_media_type_string(type), ost->file_index, ost->index); + av_media_type_get_string(type), ost->file_index, ost->index); exit_program(1); } } diff --git a/fftools/ffplay.c b/fftools/ffplay.c index 040afa0189..c44c5e4ea6 100644 --- a/fftools/ffplay.c +++ b/fftools/ffplay.c @@ -2860,7 +2860,7 @@ static int read_thread(void *arg) } for (i = 0; i < AVMEDIA_TYPE_NB; i++) { if (wanted_stream_spec[i] && st_index[i] == -1) { - av_log(NULL, AV_LOG_ERROR, "Stream specifier %s does not match any %s stream\n", wanted_stream_spec[i], av_get_media_type_string(i)); + av_log(NULL, AV_LOG_ERROR, "Stream specifier %s does not match any %s stream\n", wanted_stream_spec[i], av_media_type_get_string(i)); st_index[i] = INT_MAX; } } @@ -3191,7 +3191,7 @@ static void stream_cycle_channel(VideoState *is, int codec_type) if (p && stream_index != -1) stream_index = p->stream_index[stream_index]; av_log(NULL, AV_LOG_INFO, "Switch %s stream from #%d to #%d\n", - av_get_media_type_string(codec_type), + av_media_type_get_string(codec_type), old_index, stream_index); diff --git a/fftools/ffprobe.c b/fftools/ffprobe.c index c51c82ff65..d5590be133 100644 --- a/fftools/ffprobe.c +++ b/fftools/ffprobe.c @@ -2404,15 +2404,12 @@ static void show_packet(WriterContext *w, InputFile *ifile, AVPacket *pkt, int p char val_str[128]; AVStream *st = ifile->streams[pkt->stream_index].st; AVBPrint pbuf; - const char *s; av_bprint_init(&pbuf, 1, AV_BPRINT_SIZE_UNLIMITED); writer_print_section_header(w, SECTION_ID_PACKET); - s = av_get_media_type_string(st->codecpar->codec_type); - if (s) print_str ("codec_type", s); - else print_str_opt("codec_type", "unknown"); + print_str("codec_type", av_media_type_get_string(st->codecpar->codec_type)); print_int("stream_index", pkt->stream_index); print_ts ("pts", pkt->pts); print_time("pts_time", pkt->pts, &st->time_base); @@ -2487,9 +2484,7 @@ static void show_frame(WriterContext *w, AVFrame *frame, AVStream *stream, writer_print_section_header(w, SECTION_ID_FRAME); - s = av_get_media_type_string(stream->codecpar->codec_type); - if (s) print_str ("media_type", s); - else print_str_opt("media_type", "unknown"); + print_str("media_type", av_media_type_get_string(stream->codecpar->codec_type)); print_int("stream_index", stream->index); print_int("key_frame", frame->key_frame); print_ts ("pts", frame->pts); @@ -2890,9 +2885,7 @@ static int show_stream(WriterContext *w, AVFormatContext *fmt_ctx, int stream_id print_str_opt("profile", "unknown"); } - s = av_get_media_type_string(par->codec_type); - if (s) print_str ("codec_type", s); - else print_str_opt("codec_type", "unknown"); + print_str("codec_type", av_media_type_get_string(par->codec_type)); /* print AVI/FourCC tag */ print_str("codec_tag_string", av_fourcc2str(par->codec_tag)); diff --git a/fftools/opt_common.c b/fftools/opt_common.c index c303db4d09..064bbec002 100644 --- a/fftools/opt_common.c +++ b/fftools/opt_common.c @@ -519,7 +519,7 @@ static void show_help_filter(const char *name) count = avfilter_filter_pad_count(f, 0); for (i = 0; i < count; i++) { printf(" #%d: %s (%s)\n", i, avfilter_pad_get_name(f->inputs, i), - av_get_media_type_string(avfilter_pad_get_type(f->inputs, i))); + av_media_type_get_string(avfilter_pad_get_type(f->inputs, i))); } if (f->flags & AVFILTER_FLAG_DYNAMIC_INPUTS) printf(" dynamic (depending on the options)\n"); @@ -530,7 +530,7 @@ static void show_help_filter(const char *name) count = avfilter_filter_pad_count(f, 1); for (i = 0; i < count; i++) { printf(" #%d: %s (%s)\n", i, avfilter_pad_get_name(f->outputs, i), - av_get_media_type_string(avfilter_pad_get_type(f->outputs, i))); + av_media_type_get_string(avfilter_pad_get_type(f->outputs, i))); } if (f->flags & AVFILTER_FLAG_DYNAMIC_OUTPUTS) printf(" dynamic (depending on the options)\n"); @@ -1308,10 +1308,9 @@ static void print_device_list(const AVDeviceInfoList *device_list) device->device_name, device->device_description); if (device->nb_media_types > 0) { for (int j = 0; j < device->nb_media_types; ++j) { - const char* media_type = av_get_media_type_string(device->media_types[j]); if (j > 0) printf(", "); - printf("%s", media_type ? media_type : "unknown"); + printf("%s", av_media_type_get_string(device->media_types[j])); } } else { printf("none"); diff --git a/libavcodec/avcodec.c b/libavcodec/avcodec.c index 5f6e71a39e..e02ac2e630 100644 --- a/libavcodec/avcodec.c +++ b/libavcodec/avcodec.c @@ -528,7 +528,7 @@ void avcodec_string(char *buf, int buf_size, AVCodecContext *enc, int encode) if (!buf || buf_size <= 0) return; av_bprint_init_for_buffer(&bprint, buf, buf_size); - codec_type = av_get_media_type_string(enc->codec_type); + codec_type = av_media_type_get_string(enc->codec_type); codec_name = avcodec_get_name(enc->codec_id); profile = avcodec_profile_name(enc->codec_id, enc->profile); diff --git a/libavcodec/tests/avcodec.c b/libavcodec/tests/avcodec.c index 08b5fbede1..c10a90fa92 100644 --- a/libavcodec/tests/avcodec.c +++ b/libavcodec/tests/avcodec.c @@ -22,12 +22,6 @@ #include "libavcodec/codec_internal.h" #include "libavcodec/internal.h" -static const char *get_type_string(enum AVMediaType type) -{ - const char *ret = av_get_media_type_string(type); - return ret ? ret : "unknown"; -} - #define AV_LOG(...) av_log(NULL, AV_LOG_FATAL, __VA_ARGS__) #define ERR_INTERNAL(msg, ...) \ do { \ @@ -76,7 +70,7 @@ int main(void){ codec->type != AVMEDIA_TYPE_AUDIO && codec->type != AVMEDIA_TYPE_SUBTITLE) ERR_EXT("Codec %s has unsupported type %s\n", - get_type_string(codec->type)); + av_media_type_get_string(codec->type)); if (codec->type != AVMEDIA_TYPE_AUDIO) { if (codec->ch_layouts || codec->sample_fmts || codec->supported_samplerates) @@ -179,7 +173,7 @@ int main(void){ } else if (desc->type != codec->type) ERR_EXT("The type of AVCodec %s and its AVCodecDescriptor differ: " "%s vs %s\n", - get_type_string(codec->type), get_type_string(desc->type)); + av_media_type_get_string(codec->type), av_media_type_get_string(desc->type)); } return ret; } diff --git a/libavdevice/dshow.c b/libavdevice/dshow.c index 5946a72cc2..7b36ea4bc9 100644 --- a/libavdevice/dshow.c +++ b/libavdevice/dshow.c @@ -577,10 +577,10 @@ dshow_cycle_devices(AVFormatContext *avctx, ICreateDevEnum *devenum, else { av_log(avctx, AV_LOG_INFO, "\"%s\"", friendly_name); if (nb_media_types > 0) { - const char* media_type = av_get_media_type_string(media_types[0]); + const char* media_type = av_media_type_get_string(media_types[0]); av_log(avctx, AV_LOG_INFO, " (%s", media_type ? media_type : "unknown"); for (int i = 1; i < nb_media_types; ++i) { - media_type = av_get_media_type_string(media_types[i]); + media_type = av_media_type_get_string(media_types[i]); av_log(avctx, AV_LOG_INFO, ", %s", media_type ? media_type : "unknown"); } av_log(avctx, AV_LOG_INFO, ")"); diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c index 965f5d0f63..b9be2eb6fe 100644 --- a/libavfilter/avfilter.c +++ b/libavfilter/avfilter.c @@ -153,8 +153,8 @@ int avfilter_link(AVFilterContext *src, unsigned srcpad, if (src->output_pads[srcpad].type != dst->input_pads[dstpad].type) { av_log(src, AV_LOG_ERROR, "Media type mismatch between the '%s' filter output pad %d (%s) and the '%s' filter input pad %d (%s)\n", - src->name, srcpad, (char *)av_x_if_null(av_get_media_type_string(src->output_pads[srcpad].type), "?"), - dst->name, dstpad, (char *)av_x_if_null(av_get_media_type_string(dst-> input_pads[dstpad].type), "?")); + src->name, srcpad, av_media_type_get_string(src->output_pads[srcpad].type), + dst->name, dstpad, av_media_type_get_string(dst-> input_pads[dstpad].type)); return AVERROR(EINVAL); } diff --git a/libavfilter/avfiltergraph.c b/libavfilter/avfiltergraph.c index b7dbfc063b..b466c5c55c 100644 --- a/libavfilter/avfiltergraph.c +++ b/libavfilter/avfiltergraph.c @@ -218,7 +218,7 @@ static int graph_check_validity(AVFilterGraph *graph, void *log_ctx) pad = &filt->input_pads[j]; av_log(log_ctx, AV_LOG_ERROR, "Input pad \"%s\" with type %s of the filter instance \"%s\" of %s not connected to any source\n", - pad->name, av_get_media_type_string(pad->type), filt->name, filt->filter->name); + pad->name, av_media_type_get_string(pad->type), filt->name, filt->filter->name); return AVERROR(EINVAL); } } @@ -228,7 +228,7 @@ static int graph_check_validity(AVFilterGraph *graph, void *log_ctx) pad = &filt->output_pads[j]; av_log(log_ctx, AV_LOG_ERROR, "Output pad \"%s\" with type %s of the filter instance \"%s\" of %s not connected to any destination\n", - pad->name, av_get_media_type_string(pad->type), filt->name, filt->filter->name); + pad->name, av_media_type_get_string(pad->type), filt->name, filt->filter->name); return AVERROR(EINVAL); } } diff --git a/libavfilter/src_movie.c b/libavfilter/src_movie.c index 711854c23c..6484005921 100644 --- a/libavfilter/src_movie.c +++ b/libavfilter/src_movie.c @@ -115,7 +115,7 @@ static AVStream *find_stream(void *log, AVFormatContext *avf, const char *spec) ret = av_find_best_stream(avf, type, stream_id, -1, NULL, 0); if (ret < 0) { av_log(log, AV_LOG_ERROR, "No %s stream with index '%d' found\n", - av_get_media_type_string(type), stream_id); + av_media_type_get_string(type), stream_id); return NULL; } return avf->streams[ret]; @@ -150,7 +150,7 @@ static AVStream *find_stream(void *log, AVFormatContext *avf, const char *spec) found->codecpar->codec_type != AVMEDIA_TYPE_AUDIO) { av_log(log, AV_LOG_ERROR, "Stream specifier \"%s\" matched a %s stream," "currently unsupported by libavfilter\n", spec, - av_get_media_type_string(found->codecpar->codec_type)); + av_media_type_get_string(found->codecpar->codec_type)); return NULL; } return found; @@ -429,7 +429,7 @@ static char *describe_frame_to_str(char *dst, size_t dst_size, frame->nb_samples); break; default: - snprintf(dst, dst_size, "%s BUG", av_get_media_type_string(frame_type)); + snprintf(dst, dst_size, "%s BUG", av_media_type_get_string(frame_type)); break; } return dst; diff --git a/libavformat/avienc.c b/libavformat/avienc.c index 2264241d57..7a4e73807c 100644 --- a/libavformat/avienc.c +++ b/libavformat/avienc.c @@ -475,7 +475,7 @@ static int avi_write_header(AVFormatContext *s) default: av_log(s, AV_LOG_ERROR, "Invalid or not supported codec type '%s' found in the input\n", - (char *)av_x_if_null(av_get_media_type_string(par->codec_type), "?")); + av_media_type_get_string(par->codec_type)); return AVERROR(EINVAL); } ff_end_tag(pb, strf); diff --git a/libavformat/flvenc.c b/libavformat/flvenc.c index 4e65ba4066..8324d51db6 100644 --- a/libavformat/flvenc.c +++ b/libavformat/flvenc.c @@ -669,7 +669,7 @@ static int flv_init(struct AVFormatContext *s) break; default: av_log(s, AV_LOG_ERROR, "Codec type '%s' for stream %d is not compatible with FLV\n", - av_get_media_type_string(par->codec_type), i); + av_media_type_get_string(par->codec_type), i); return AVERROR(EINVAL); } avpriv_set_pts_info(s->streams[i], 32, 1, 1000); /* 32 bit pts in ms */ diff --git a/libavformat/framehash.c b/libavformat/framehash.c index 654996e8e0..07c29da82c 100644 --- a/libavformat/framehash.c +++ b/libavformat/framehash.c @@ -33,7 +33,7 @@ int ff_framehash_write_header(AVFormatContext *s) AVCodecParameters *avctx = st->codecpar; char buf[256] = { 0 }; avio_printf(s->pb, "#tb %d: %d/%d\n", i, st->time_base.num, st->time_base.den); - avio_printf(s->pb, "#media_type %d: %s\n", i, av_get_media_type_string(avctx->codec_type)); + avio_printf(s->pb, "#media_type %d: %s\n", i, av_media_type_get_string(avctx->codec_type)); avio_printf(s->pb, "#codec_id %d: %s\n", i, avcodec_get_name(avctx->codec_id)); switch (avctx->codec_type) { case AVMEDIA_TYPE_AUDIO: { diff --git a/libavformat/mov.c b/libavformat/mov.c index d7be593a86..9514598718 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -7306,7 +7306,7 @@ static int mov_read_kind(MOVContext *c, AVIOContext *pb, MOVAtom atom) av_log(ctx, AV_LOG_TRACE, "%s stream %d KindBox(scheme: %s, value: %s)\n", - av_get_media_type_string(st->codecpar->codec_type), + av_media_type_get_string(st->codecpar->codec_type), st->index, scheme_buf.str, value_buf.str); diff --git a/libavformat/mpegenc.c b/libavformat/mpegenc.c index 62692bfcd1..3e44663715 100644 --- a/libavformat/mpegenc.c +++ b/libavformat/mpegenc.c @@ -458,7 +458,7 @@ static av_cold int mpeg_mux_init(AVFormatContext *ctx) break; default: av_log(ctx, AV_LOG_ERROR, "Invalid media type %s for output stream #%d\n", - av_get_media_type_string(st->codecpar->codec_type), i); + av_media_type_get_string(st->codecpar->codec_type), i); return AVERROR(EINVAL); } stream->fifo = av_fifo_alloc2(16, 1, 0); diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c index 6e761c07f1..13292f8041 100644 --- a/libavformat/mpegts.c +++ b/libavformat/mpegts.c @@ -2258,7 +2258,7 @@ static AVStream *find_matching_stream(MpegTSContext *ts, int pid, unsigned int p if (found) { av_log(ts->stream, AV_LOG_VERBOSE, "re-using existing %s stream %d (pid=0x%x) for new pid=0x%x\n", - av_get_media_type_string(found->codecpar->codec_type), + av_media_type_get_string(found->codecpar->codec_type), found->index, found->id, pid); } diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c index 6a22c33995..0af77c681e 100644 --- a/libavformat/mxfdec.c +++ b/libavformat/mxfdec.c @@ -2418,7 +2418,7 @@ static int mxf_add_metadata_stream(MXFContext *mxf, MXFTrack *track) av_dict_set(&st->metadata, "track_name", track->name, 0); codec_ul = mxf_get_codec_ul(ff_mxf_data_definition_uls, &track->sequence->data_definition_ul); - av_dict_set(&st->metadata, "data_type", av_get_media_type_string(codec_ul->id), 0); + av_dict_set(&st->metadata, "data_type", av_media_type_get_string(codec_ul->id), 0); return 0; } diff --git a/libavformat/segment.c b/libavformat/segment.c index fa435d9f32..231d845ab3 100644 --- a/libavformat/segment.c +++ b/libavformat/segment.c @@ -738,7 +738,7 @@ static int seg_init(AVFormatContext *s) return ret; av_log(s, AV_LOG_VERBOSE, "Selected stream id:%d type:%s\n", seg->reference_stream_index, - av_get_media_type_string(s->streams[seg->reference_stream_index]->codecpar->codec_type)); + av_media_type_get_string(s->streams[seg->reference_stream_index]->codecpar->codec_type)); seg->oformat = av_guess_format(seg->format, s->url, NULL); diff --git a/libavformat/tee.c b/libavformat/tee.c index f1f2a9d2a5..3144ab4000 100644 --- a/libavformat/tee.c +++ b/libavformat/tee.c @@ -419,7 +419,7 @@ static void log_slave(TeeSlave *slave, void *log_ctx, int log_level) av_log(log_ctx, log_level, " stream:%d codec:%s type:%s", i, avcodec_get_name(st->codecpar->codec_id), - av_get_media_type_string(st->codecpar->codec_type)); + av_media_type_get_string(st->codecpar->codec_type)); bsf_name = bsf->filter->priv_class ? bsf->filter->priv_class->item_name(bsf) : bsf->filter->name; diff --git a/libavformat/uncodedframecrcenc.c b/libavformat/uncodedframecrcenc.c index 99990616d3..c6476a4c43 100644 --- a/libavformat/uncodedframecrcenc.c +++ b/libavformat/uncodedframecrcenc.c @@ -131,7 +131,6 @@ static int write_frame(struct AVFormatContext *s, int stream_index, AVBPrint bp; int ret = 0; enum AVMediaType type; - const char *type_name; if ((flags & AV_WRITE_UNCODED_FRAME_QUERY)) return 0; @@ -140,8 +139,7 @@ static int write_frame(struct AVFormatContext *s, int stream_index, av_bprintf(&bp, "%d, %10"PRId64"", stream_index, (*frame)->pts); type = s->streams[stream_index]->codecpar->codec_type; - type_name = av_get_media_type_string(type); - av_bprintf(&bp, ", %s", type_name ? type_name : "unknown"); + av_bprintf(&bp, ", %s", av_media_type_get_string(type)); switch (type) { case AVMEDIA_TYPE_VIDEO: video_frame_cksum(&bp, *frame);