From patchwork Mon Aug 2 20:55:01 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Derek Buitenhuis X-Patchwork-Id: 29206 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a6b:6c0f:0:0:0:0:0 with SMTP id a15csp1906099ioh; Mon, 2 Aug 2021 14:17:20 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzDU7NJ9q5kfz6jcoH0sT0DQnr29ji1ySgPHaDRtQWJ7lPKb3ldeF3n8YSxiJZhPr12g+50 X-Received: by 2002:a17:906:c2d7:: with SMTP id ch23mr16646199ejb.298.1627939040658; Mon, 02 Aug 2021 14:17:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1627939040; cv=none; d=google.com; s=arc-20160816; b=KlewUjkGo+qsgq0bleUNM0fndvaP8TaFWztWW8loueu1ocWUu9MZM3xT/62yL4vQJI 2Mw9AHvx1lK1G0RUjAanvaYvpgtIDL2MisADjZZjkjgm7UYV2EQIdha1JNmxbe32DxQ/ RpIUAUPcCMpCjCTWobZxHvI6g5TvSQzpk9Va//aN5eGxMupYbd/C+ebLCnfhTUGlewFN Pc6+d3yC/50iobliGRxHNMcr0Q+nd6KPsEiexsP3C230a8yeEhKR1XjtxHRNg1K7eKmQ aUq+ZbyTOtMwIsBepCh/e+M9jt5mDvLsvn9rjEYqp7PRd4cNcG+HFO/vaqrkEwU9pJky 3Peg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:reply-to:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:mime-version:message-id:date:to:from :dkim-signature:delivered-to; bh=5w8Per3fLnqaGOVgpuB9UNqbfh0EWaQkZt9tZMmv7rI=; b=g8QI2nxIikUHi4cYYTGXqUz9bLC3tWTLte3+QS3TYu6yip5Bg+yNOAomg7hPMAB2r2 3v7yE7ktD18dXH9+2xiuHVb7UXJz0lY2uP6Bucw/IPWc6gABecHpX2dEzDhjLrULeoz+ jsJdwHqHrm5a68P9VgqrH7hAdSM2c+Xg78W3DIgxc7Q1pMq+51FJeUa8/W7esjglM1tk yusTYyzvH+hgJcp0O36LOx+Kl4JA3PToKKroc/L+wGieomAJPYE9BwNP+frOD5kLNCl9 oDrpwi9OqP6QvRVs8ILSMa3f+Vh33Zxx7ZdMiyp4e47noKEdl3Js2s06tnmJ2wN40Mq1 LE5A== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20161025 header.b=fsmao5MH; 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 dh13si10262614edb.447.2021.08.02.14.17.19; Mon, 02 Aug 2021 14:17:20 -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=20161025 header.b=fsmao5MH; 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 31308689BD5; Tue, 3 Aug 2021 00:17:16 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-lf1-f41.google.com (mail-lf1-f41.google.com [209.85.167.41]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id A1ACE680518 for ; Tue, 3 Aug 2021 00:17:09 +0300 (EEST) Received: by mail-lf1-f41.google.com with SMTP id p38so21245068lfa.0 for ; Mon, 02 Aug 2021 14:17:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=GG9jOUx57OE0UZXp2TALhjpWBI7Zw/aoms57XjHc3XY=; b=fsmao5MHYJtTBSFWrdlRGOjb3NV2jAkYWujzTi5SBaY96du5C0i6rW+7YluXkNO7Bs Tab+qN7OoGkWuVdRYL+U5iQfB1q2r/VmcIDEl9StuTXDOP5E7vy8YvyIXhW4ABvA3G8w OEcN7+DyKubwfKoXX89c125XWdXoiJ7afT43al33iv5m+Zmdr6o4+CnrcRADK9EnMuZ+ LWW/C/8KpWIftj4Z0wy0v7cjsIiCNo6ydQ8Fwu8sM0LbDulUFpHFxoOT4UlA84s+bmh+ Dajuodpa2dt40+wbYUkg3ylh79re6uXQPsCm8zcVo/WQpgoeG1BvGzl/4LbjAvHVisS0 TfPg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=GG9jOUx57OE0UZXp2TALhjpWBI7Zw/aoms57XjHc3XY=; b=jUV1OD5cL16gWCVJhLPd78Eqkc1a2XtYEFE2Nj3GZAtck48EPL7RNNeUKelf4VBVJK zTOVZ8OTTqGsYuD6mxP4WbnBKfg4RH/H6qGPKPPhEv9GD4qFwnS2zeD7Qp6n7BZzQWsz 8l0CA74bF/rg2RpzRhdGno3htrdOJeIEQt7gMkB34TmdbsP02cbRdWi6/ua7coMTM9im 4pGJTF5NQ3rlNDiri9bdRzbKrD5herlYTaVP/TmY2L/V9f1CNU0O9jhwhjjD4YJJeokt EcnXDXFB6sNZ67Ek0B1N6cM+D+l+WCgYiv1DkLdzkBBiX9Uecu/lwa8Sc/tdYQ1jZ1Gq iveg== X-Gm-Message-State: AOAM532VmS2eqmmiJ80EI7oVHEkIwCGzXETwht1DiI5mKKzlDMFmIxNd QrUq8UpCe3opanT8hZhw8D7uJ24Db+k= X-Received: by 2002:a5d:518a:: with SMTP id k10mr19509896wrv.400.1627937714457; Mon, 02 Aug 2021 13:55:14 -0700 (PDT) Received: from localhost.localdomain ([154.57.241.242]) by smtp.gmail.com with ESMTPSA id j14sm12509042wru.58.2021.08.02.13.55.13 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Aug 2021 13:55:13 -0700 (PDT) From: Derek Buitenhuis To: ffmpeg-devel@ffmpeg.org Date: Mon, 2 Aug 2021 21:55:01 +0100 Message-Id: <20210802205501.1792236-1-derek.buitenhuis@gmail.com> X-Mailer: git-send-email 2.32.0 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH] ffprobe: Rename Audio Service Type 'type' field to 'service_type' 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: m7tnWK5t8m6e 677a030b26045acb50353d7954ae984ceefcd807 introduced more printable side data types in ffprobe, however the Audio Service Type side data 'type' field that was introduced aliases an existing field of the same name within the side data array, which can lead to JSON output like: "side_data_list": [ { "side_data_type": "Audio Service Type", "type": 0 }, { "side_data_type": "Stereo 3D", "type": "side by side", "inverted": 1 } ] This, while technically valid JSON, is considered bad practice, since it forces all downstream users to manually parse it and check all types; it makes simple deserialization impossible. Worse, in som loosely type languages, it can lead to silent bugs if exising code assumed it was a different type. As such, rename this second "type" field to "service_type". Signed-off-by: Derek Buitenhuis --- Not sure if this is considered a "break"? I am open to other ideas, but I do thinking leaving it as-is is not a very good idea - JSON should be simply deserializable. --- fftools/ffprobe.c | 2 +- tests/ref/fate/hls-fmp4_ac3 | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/fftools/ffprobe.c b/fftools/ffprobe.c index f411ba35b5..9165523b29 100644 --- a/fftools/ffprobe.c +++ b/fftools/ffprobe.c @@ -2032,7 +2032,7 @@ static void print_pkt_side_data(WriterContext *w, print_int("dv_bl_signal_compatibility_id", dovi->dv_bl_signal_compatibility_id); } else if (sd->type == AV_PKT_DATA_AUDIO_SERVICE_TYPE) { enum AVAudioServiceType *t = (enum AVAudioServiceType *)sd->data; - print_int("type", *t); + print_int("service_type", *t); } else if (sd->type == AV_PKT_DATA_MPEGTS_STREAM_ID) { print_int("id", *sd->data); } else if (sd->type == AV_PKT_DATA_CPB_PROPERTIES) { diff --git a/tests/ref/fate/hls-fmp4_ac3 b/tests/ref/fate/hls-fmp4_ac3 index ce7367de4d..cbe3ea1f1f 100644 --- a/tests/ref/fate/hls-fmp4_ac3 +++ b/tests/ref/fate/hls-fmp4_ac3 @@ -5,6 +5,6 @@ channels=6 channel_layout=5.1(side) [SIDE_DATA] side_data_type=Audio Service Type -type=0 +service_type=0 [/SIDE_DATA] [/STREAM]