From patchwork Fri Nov 12 16:32:50 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Khirnov X-Patchwork-Id: 31389 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a6b:d206:0:0:0:0:0 with SMTP id q6csp2052318iob; Fri, 12 Nov 2021 08:33:10 -0800 (PST) X-Google-Smtp-Source: ABdhPJygrqGhXyiwaf0YFQic0Gfs3HfUw8dImpUGSEx3lgjGt90vHjMgvkL6tSC7KUruaXcCPq9s X-Received: by 2002:a17:907:160a:: with SMTP id hb10mr21032937ejc.83.1636734790682; Fri, 12 Nov 2021 08:33:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1636734790; cv=none; d=google.com; s=arc-20160816; b=rHD7VhWrWs47mtrE0N9d9QTkGvKUGCeyRmPeHxrOjKCy8kauP4PbCqX5RryAO1cK+7 fgrihOxzASygafqNSuE4vkS6VWurmVdMZjS0jXokOGqpdY4+xKcyP2iTNpN0h8uaMKXe ota2sZUPPlbKwbI58Cm77+jlianeBwvq6HFEr8riQ5RgGTFVvlDa8bObgHTzoJ0gWLON 3aDmfMAdmbQjkSizBM+ZQv3QbwivSJ9sgcIggLYCHsKi2hcmFeurZUTRqjpCL/lscsnG UUxF2y/zNoqRO0J76k0OLE7lW1pyzNfCnXAzzO80iCCkKxTDt0sQPiNJ9AzevbtLeO08 otWA== 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 :delivered-to; bh=N0FIcxqIxe6OdWsfpialP2SdHz+pHSgmvA5/J5QFKko=; b=mNmYCdJ4+AtDGRNSFyoBpnZz01BkRaHslkCg0tG+Artq8RHic8rH0UBJJmPL9lemrB CcHoE4ilWnoxZini/p63+cMWeURTrmuZ63G4+KRrD4hDqluDX4+PhYx1pPTCSaKYqyPt Mg8XqdJS9iAoBlZ1yULxo348RfZ8r9cqge3QguDB3CVJXNrdYjB898vj20yorCmqjzis fMzIWFXLCo7/mp3bsCKz56m5e88kJTG6Mqr3WLZk5BwcGSSUndRCv38YULUwZlCdH4eE xzAUO3eFLi4Q5sunurb79gamh68x3ZlLZuN61R29qunMsZkxgn32x0yZZhesOxYZufvU obww== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id v8si148935ede.195.2021.11.12.08.33.10; Fri, 12 Nov 2021 08:33:10 -0800 (PST) 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; 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 Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 94CBF68A8FD; Fri, 12 Nov 2021 18:33:06 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail0.khirnov.net (red.khirnov.net [176.97.15.12]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id E923068A1A7 for ; Fri, 12 Nov 2021 18:32:59 +0200 (EET) Received: from localhost (localhost [IPv6:::1]) by mail0.khirnov.net (Postfix) with ESMTP id 768C824050B for ; Fri, 12 Nov 2021 17:32:59 +0100 (CET) Received: from mail0.khirnov.net ([IPv6:::1]) by localhost (mail0.khirnov.net [IPv6:::1]) (amavisd-new, port 10024) with ESMTP id GCVrfYwFAhtz for ; Fri, 12 Nov 2021 17:32:58 +0100 (CET) Received: from libav.khirnov.net (libav.khirnov.net [IPv6:2a00:c500:561:201::7]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "libav.khirnov.net", Issuer "smtp.khirnov.net SMTP CA" (verified OK)) by mail0.khirnov.net (Postfix) with ESMTPS id D9F68240175 for ; Fri, 12 Nov 2021 17:32:58 +0100 (CET) Received: by libav.khirnov.net (Postfix, from userid 1000) id EF03B3A0631; Fri, 12 Nov 2021 17:32:58 +0100 (CET) From: Anton Khirnov To: ffmpeg-devel@ffmpeg.org Date: Fri, 12 Nov 2021 17:32:50 +0100 Message-Id: <20211112163255.20522-1-anton@khirnov.net> X-Mailer: git-send-email 2.33.0 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 1/6] lavf: improve AV_DISPOSITION_* doxy 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: J7GMs21T/Xq9 Also switch the values definition to the (1 << N) style, which is easier to read. --- libavformat/avformat.h | 96 +++++++++++++++++++++++++++++++++--------- 1 file changed, 77 insertions(+), 19 deletions(-) diff --git a/libavformat/avformat.h b/libavformat/avformat.h index a2af7e9f89..7d8ad08f07 100644 --- a/libavformat/avformat.h +++ b/libavformat/avformat.h @@ -803,22 +803,56 @@ typedef struct AVIndexEntry { int min_distance; /**< Minimum distance between this and the previous keyframe, used to avoid unneeded searching. */ } AVIndexEntry; -#define AV_DISPOSITION_DEFAULT 0x0001 -#define AV_DISPOSITION_DUB 0x0002 -#define AV_DISPOSITION_ORIGINAL 0x0004 -#define AV_DISPOSITION_COMMENT 0x0008 -#define AV_DISPOSITION_LYRICS 0x0010 -#define AV_DISPOSITION_KARAOKE 0x0020 +/** + * The stream should be chosen by default among other streams of the same time, + * unless the user has explicitly specified otherwise. + */ +#define AV_DISPOSITION_DEFAULT (1 << 0) +/** + * The stream is not in original language. + * + * @note AV_DISPOSITION_ORIGINAL is the inverse of this disposition. At most of + * them should be set in properly tagged streams. + * @note This disposition may apply to any stream type, not just audio. + */ +#define AV_DISPOSITION_DUB (1 << 1) +/** + * The stream is in original language. + * + * @see the notes for AV_DISPOSITION_DUB + */ +#define AV_DISPOSITION_ORIGINAL (1 << 2) +/** + * The stream is a commentary track. + */ +#define AV_DISPOSITION_COMMENT (1 << 3) +/** + * The stream contains song lyrics. + */ +#define AV_DISPOSITION_LYRICS (1 << 4) +/** + * The stream contains karaoke audio. + */ +#define AV_DISPOSITION_KARAOKE (1 << 5) /** * Track should be used during playback by default. * Useful for subtitle track that should be displayed * even when user did not explicitly ask for subtitles. */ -#define AV_DISPOSITION_FORCED 0x0040 -#define AV_DISPOSITION_HEARING_IMPAIRED 0x0080 /**< stream for hearing impaired audiences */ -#define AV_DISPOSITION_VISUAL_IMPAIRED 0x0100 /**< stream for visual impaired audiences */ -#define AV_DISPOSITION_CLEAN_EFFECTS 0x0200 /**< stream without voice */ +#define AV_DISPOSITION_FORCED (1 << 6) +/** + * The stream is intended for hearing impaired audiences. + */ +#define AV_DISPOSITION_HEARING_IMPAIRED (1 << 7) +/** + * The stream is intended for visually impaired audiences. + */ +#define AV_DISPOSITION_VISUAL_IMPAIRED (1 << 8) +/** + * The audio stream contains music and sound effects without voice. + */ +#define AV_DISPOSITION_CLEAN_EFFECTS (1 << 9) /** * The stream is stored in the file as an attached picture/"cover art" (e.g. * APIC frame in ID3v2). The first (usually only) packet associated with it @@ -826,21 +860,39 @@ typedef struct AVIndexEntry { * seeking takes place. It can also be accessed at any time in * AVStream.attached_pic. */ -#define AV_DISPOSITION_ATTACHED_PIC 0x0400 +#define AV_DISPOSITION_ATTACHED_PIC (1 << 10) /** * The stream is sparse, and contains thumbnail images, often corresponding * to chapter markers. Only ever used with AV_DISPOSITION_ATTACHED_PIC. */ -#define AV_DISPOSITION_TIMED_THUMBNAILS 0x0800 +#define AV_DISPOSITION_TIMED_THUMBNAILS (1 << 11) /** - * To specify text track kind (different from subtitles default). + * The subtitle stream contains captions, providing a transcription and possibly + * a translation of audio. Typically intended for hearing-impaired audiences. + */ +#define AV_DISPOSITION_CAPTIONS (1 << 16) +/** + * The subtitle stream contains a textual description of the video content. + * Typically intended for visually-impaired audiences or for the cases where the + * video cannot be seen. + */ +#define AV_DISPOSITION_DESCRIPTIONS (1 << 17) +/** + * The subtitle stream contains time-aligned metadata that is not intended to be + * directly presented to the user. */ -#define AV_DISPOSITION_CAPTIONS 0x10000 -#define AV_DISPOSITION_DESCRIPTIONS 0x20000 -#define AV_DISPOSITION_METADATA 0x40000 -#define AV_DISPOSITION_DEPENDENT 0x80000 ///< dependent audio stream (mix_type=0 in mpegts) -#define AV_DISPOSITION_STILL_IMAGE 0x100000 ///< still images in video stream (still_picture_flag=1 in mpegts) +#define AV_DISPOSITION_METADATA (1 << 18) +/** + * The audio stream is intended to be mixed with another stream before + * presentation. + * Corresponds to mix_type=0 in mpegts. + */ +#define AV_DISPOSITION_DEPENDENT (1 << 19) +/** + * The video stream contains still images. + */ +#define AV_DISPOSITION_STILL_IMAGE (1 << 20) /** * Options for behavior on timestamp wrap detection. @@ -903,7 +955,13 @@ typedef struct AVStream { int64_t nb_frames; ///< number of frames in this stream if known or 0 - int disposition; /**< AV_DISPOSITION_* bit field */ + /** + * Stream disposition - a combination of AV_DISPOSITION_* flags. + * - demuxing: set by libavformat when creating the stream or in + * avformat_find_stream_info(). + * - muxing: may be set by the caller before avformat_write_header(). + */ + int disposition; enum AVDiscard discard; ///< Selects which packets can be discarded at will and do not need to be demuxed.