From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id 2170B4460E for ; Mon, 19 Sep 2022 17:56:03 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 6E4E168BA2D; Mon, 19 Sep 2022 20:56:00 +0300 (EEST) Received: from mail-qk1-f179.google.com (mail-qk1-f179.google.com [209.85.222.179]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 82D3468B726 for ; Mon, 19 Sep 2022 20:55:54 +0300 (EEST) Received: by mail-qk1-f179.google.com with SMTP id d17so20265045qko.13 for ; Mon, 19 Sep 2022 10:55:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date; bh=YCOU+jK+pRlMnkNQw2oyhVb5OteKtIVEu+1G69b5XwE=; b=I/PnBl/8sWLtJy5GF/9EDnFpVID505t7l1zJpiVklaXSFZyDP56P81KuDP150k7WKY T4xC5n4zkKYsQbwIivW9/LJGtBIaXuy1vMQ3T395qKRV+kb4/q1edhuk3RwUvlYvIwSf mbKBDd9W3BiWffgEP93q6Zxska1DN3pdnKz2wCUTTVetYadIaPUcWSrIVePY70J47J1c SivCbNcs66txTkOMnlYMriaOBeRJnh+4w7nipw5sBIrUzCodpzHLN5FlOBdWA4p0pfbu VLOBi32+X/CIAMWS1QSJww9LzLrhBzrm6ypBWdkqnNTismq+IdQ/MhGmkv6gndIkPBLq K97A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date; bh=YCOU+jK+pRlMnkNQw2oyhVb5OteKtIVEu+1G69b5XwE=; b=i36uWGEQBZ0x6BQirHHWdBZb5/ZHMa3EcfWxFXDCbDRX5qrevcvZgK9gcLW6+u5jsE lfo2WQoMtIdhRjVGrFRBRmLxVYGnhkzuZ4QGM1SUAt4ZUpqMrEKpIoGYJ+37lYQbLwlC 81zyY9t8F0GD8uz87tArb9ijiyUF7mqum6n2wHb14awdOWI8DtKzZcYKBALSNi7omLjd YYqvAw358bzSd+QcfN/8ky6JRmtGiSgc4cHNeX4qtQVRVNk+Hi62iFNPWBe2CDcec0vc 3zHXwktwYFq/xOMK7KLG1jvk/BkusZHOSTgwKuTRLzxG8ywm6nmZdBf02cRiVhNr9yeq T6iQ== X-Gm-Message-State: ACrzQf3tesL+dKhRDan01Ff4dcWXy0iM/7dk4HgRe5dc97O5meAcp27n ST34u1Zvk2r5HWHH4ZPsqcNQoYjEq54= X-Google-Smtp-Source: AMsMyM468zKPxBcMGhD9tZhuG7ClmATVjnxs9oZGSBGlrXyE447Gsw/lFiz6h1lo8BtsQfMji2Mzcg== X-Received: by 2002:a05:620a:240f:b0:6ce:9ac3:5f92 with SMTP id d15-20020a05620a240f00b006ce9ac35f92mr14119875qkn.707.1663610152334; Mon, 19 Sep 2022 10:55:52 -0700 (PDT) Received: from scott-desktop.. (pool-71-114-80-52.washdc.fios.verizon.net. [71.114.80.52]) by smtp.gmail.com with ESMTPSA id k13-20020a05620a414d00b006c479acd82fsm14279166qko.7.2022.09.19.10.55.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Sep 2022 10:55:51 -0700 (PDT) From: Scott Theisen To: ffmpeg-devel@ffmpeg.org Date: Mon, 19 Sep 2022 13:55:34 -0400 Message-Id: <20220919175534.102124-1-scott.the.elm@gmail.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH] lavc: add detection of forced subtitles 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 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: This is from the following MythTV commits: libavcodec: add support for detecting forced subtitle segments. https://github.com/MythTV/mythtv/commit/5099f1a5777966fba482b623e581c1eef5c8fc09 This adds forced subtitle segment detection to the PGS subtitle decoder and copies the result to AVSubtitle. Subtitles: Flag forced DVD subtitles. https://github.com/MythTV/mythtv/commit/78f71eecdbd53ba92af2ad639b32564c01f24563 --- libavcodec/avcodec.h | 1 + libavcodec/dvdsubdec.c | 4 +++- libavcodec/pgssubdec.c | 4 ++++ 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h index 7db5d1b1c5..b9aa9efb2f 100644 --- a/libavcodec/avcodec.h +++ b/libavcodec/avcodec.h @@ -2331,6 +2331,7 @@ typedef struct AVSubtitle { unsigned num_rects; AVSubtitleRect **rects; int64_t pts; ///< Same as packet pts, in AV_TIME_BASE + int forced; } AVSubtitle; /** diff --git a/libavcodec/dvdsubdec.c b/libavcodec/dvdsubdec.c index a5da0d7b08..1504706d52 100644 --- a/libavcodec/dvdsubdec.c +++ b/libavcodec/dvdsubdec.c @@ -418,8 +418,10 @@ static int decode_dvd_subtitles(DVDSubContext *ctx, AVSubtitle *sub_header, break; cmd_pos = next_cmd_pos; } - if (sub_header->num_rects > 0) + if (sub_header->num_rects > 0) { + sub_header->forced = is_menu; return is_menu; + } fail: reset_rects(sub_header); return -1; diff --git a/libavcodec/pgssubdec.c b/libavcodec/pgssubdec.c index 5f76f12615..7c953263bb 100644 --- a/libavcodec/pgssubdec.c +++ b/libavcodec/pgssubdec.c @@ -62,6 +62,7 @@ typedef struct PGSSubPresentation { int id_number; int palette_id; int object_count; + int object_forced; PGSSubObjectRef objects[MAX_OBJECT_REFS]; int64_t pts; } PGSSubPresentation; @@ -466,6 +467,8 @@ static int parse_presentation_segment(AVCodecContext *avctx, object->crop_h = bytestream_get_be16(&buf); } + ctx->presentation.object_forced = (ctx->presentation.objects[i].composition_flag & 0x40) >> 6; + ff_dlog(avctx, "Subtitle Placement x=%d, y=%d\n", object->x, object->y); @@ -505,6 +508,7 @@ static int display_end_segment(AVCodecContext *avctx, AVSubtitle *sub, memset(sub, 0, sizeof(*sub)); sub->pts = pts; ctx->presentation.pts = AV_NOPTS_VALUE; + sub->forced = ctx->presentation.object_forced; sub->start_display_time = 0; // There is no explicit end time for PGS subtitles. The end time // is defined by the start of the next sub which may contain no -- 2.34.1 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".