From patchwork Fri May 8 14:11:24 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stebbins X-Patchwork-Id: 19557 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id CD1A444BD9F for ; Fri, 8 May 2020 17:11:57 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id B6C6968A212; Fri, 8 May 2020 17:11:57 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail.jetheaddev.com (mail.jetheaddev.com [70.164.99.34]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 0F3F76880A5 for ; Fri, 8 May 2020 17:11:51 +0300 (EEST) Received: from creator.alpe-d-promontory.fun (192.168.13.165) by cas.jetheaddev.com (192.168.13.27) with Microsoft SMTP Server (TLS) id 14.3.351.0; Fri, 8 May 2020 07:11:49 -0700 From: John Stebbins To: Date: Fri, 8 May 2020 08:11:24 -0600 Message-ID: <20200508141128.2684843-2-jstebbins@jetheaddev.com> X-Mailer: git-send-email 2.25.4 In-Reply-To: <20200508141128.2684843-1-jstebbins@jetheaddev.com> References: <20200508141128.2684843-1-jstebbins@jetheaddev.com> MIME-Version: 1.0 X-Originating-IP: [192.168.13.165] Subject: [FFmpeg-devel] [PATCH 1/5] lavc/pgs_frame_merge_bsf: add bsf to merge PGS segments X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 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" Required to remux m2ts to mkv --- Changelog | 1 + doc/bitstream_filters.texi | 8 ++ libavcodec/Makefile | 1 + libavcodec/bitstream_filters.c | 1 + libavcodec/pgs_frame_merge_bsf.c | 183 +++++++++++++++++++++++++++++++ 5 files changed, 194 insertions(+) create mode 100644 libavcodec/pgs_frame_merge_bsf.c diff --git a/Changelog b/Changelog index b75d2b6b96..0b108e548f 100644 --- a/Changelog +++ b/Changelog @@ -66,6 +66,7 @@ version : - asubboost filter - Pro Pinball Series Soundbank demuxer - pcm_rechunk bitstream filter +- PGS subtitle frame merge bitstream filter version 4.2: diff --git a/doc/bitstream_filters.texi b/doc/bitstream_filters.texi index 8a2f55cc41..de2ddcacc4 100644 --- a/doc/bitstream_filters.texi +++ b/doc/bitstream_filters.texi @@ -578,6 +578,14 @@ for NTSC frame rate using the @option{frame_rate} option. ffmpeg -f lavfi -i sine=r=48000:d=1 -c pcm_s16le -bsf pcm_rechunk=r=30000/1001 -f framecrc - @end example +@section pgs_frame_merge + +Merge a sequence of PGS Subtitle segments ending with an "end of display set" +segment into a single packet. + +This is required by some containers that support PGS subtitles +(muxer @code{matroska}). + @section prores_metadata Modify color property metadata embedded in prores stream. diff --git a/libavcodec/Makefile b/libavcodec/Makefile index 38f6f07680..1a3c411a81 100644 --- a/libavcodec/Makefile +++ b/libavcodec/Makefile @@ -1118,6 +1118,7 @@ OBJS-$(CONFIG_NOISE_BSF) += noise_bsf.o OBJS-$(CONFIG_NULL_BSF) += null_bsf.o OBJS-$(CONFIG_OPUS_METADATA_BSF) += opus_metadata_bsf.o OBJS-$(CONFIG_PCM_RECHUNK_BSF) += pcm_rechunk_bsf.o +OBJS-$(CONFIG_PGS_FRAME_MERGE_BSF) += pgs_frame_merge_bsf.o OBJS-$(CONFIG_PRORES_METADATA_BSF) += prores_metadata_bsf.o OBJS-$(CONFIG_REMOVE_EXTRADATA_BSF) += remove_extradata_bsf.o OBJS-$(CONFIG_TEXT2MOVSUB_BSF) += movsub_bsf.o diff --git a/libavcodec/bitstream_filters.c b/libavcodec/bitstream_filters.c index 359961fedd..b4a9388ee2 100644 --- a/libavcodec/bitstream_filters.c +++ b/libavcodec/bitstream_filters.c @@ -51,6 +51,7 @@ extern const AVBitStreamFilter ff_noise_bsf; extern const AVBitStreamFilter ff_null_bsf; extern const AVBitStreamFilter ff_opus_metadata_bsf; extern const AVBitStreamFilter ff_pcm_rechunk_bsf; +extern const AVBitStreamFilter ff_pgs_frame_merge_bsf; extern const AVBitStreamFilter ff_prores_metadata_bsf; extern const AVBitStreamFilter ff_remove_extradata_bsf; extern const AVBitStreamFilter ff_text2movsub_bsf; diff --git a/libavcodec/pgs_frame_merge_bsf.c b/libavcodec/pgs_frame_merge_bsf.c new file mode 100644 index 0000000000..b064febe13 --- /dev/null +++ b/libavcodec/pgs_frame_merge_bsf.c @@ -0,0 +1,183 @@ +/* + * Copyright (c) 2020 John Stebbins + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +/** + * @file + * This bitstream filter merges PGS subtitle packets containing incomplete + * set of segments into a single packet + * + * Packets already containing a complete set of segments will be passed through + * unchanged. + */ + +#include "libavutil/log.h" +#include "avcodec.h" +#include "bsf.h" +#include "libavutil/intreadwrite.h" + +enum PGSSegmentType { + PALETTE_SEGMENT = 0x14, + OBJECT_SEGMENT = 0x15, + PRESENTATION_SEGMENT = 0x16, + WINDOW_SEGMENT = 0x17, + END_DISPLAY_SET_SEGMENT = 0x80, +}; + +typedef struct PGSMergeContext { + AVPacket *buffer_pkt, *in; + int presentation_found; +} PGSMergeContext; + +static void frame_merge_flush(AVBSFContext *bsf) +{ + PGSMergeContext *ctx = bsf->priv_data; + + ctx->presentation_found = 0; + av_packet_unref(ctx->in); + av_packet_unref(ctx->buffer_pkt); +} + +static int frame_merge_filter(AVBSFContext *bsf, AVPacket *out) +{ + PGSMergeContext *ctx = bsf->priv_data; + AVPacket *in = ctx->in, *pkt = ctx->buffer_pkt; + int ret, size, pos, display = 0, presentation = 0; + unsigned int i; + + if (!in->data) { + ret = ff_bsf_get_packet_ref(bsf, in); + if (ret < 0) + return ret; + } + if (!in->size) { + av_packet_unref(in); + return AVERROR(EAGAIN); + } + in->flags &= ~AV_PKT_FLAG_KEY; // Will be detected in the stream + + // Validate packet data and find display_end segment + size = in->size; + i = 0; + while (i + 3 <= in->size) { + uint8_t segment_type; + int segment_len; + + segment_type = in->data[i]; + segment_len = AV_RB16(in->data + i + 1) + 3; + if (i + segment_len > in->size) + break; // Invalid, segments can't span packets + if (segment_type == PRESENTATION_SEGMENT && ctx->presentation_found) + break; // Invalid, there can be only one + if (segment_type == PRESENTATION_SEGMENT) { + uint8_t state; + if (segment_len < 11) + break; // Invalid presentation segment length + ctx->presentation_found = presentation = 1; + state = in->data[i + 10] & 0xc0; + if (state) + pkt->flags |= AV_PKT_FLAG_KEY; + else + pkt->flags &= ~AV_PKT_FLAG_KEY; + } + i += segment_len; + if (segment_type == END_DISPLAY_SET_SEGMENT) { + size = display = i; + break; + } + } + if (display && pkt->size == 0 && size == in->size) { // passthrough + ctx->presentation_found = 0; + av_packet_move_ref(out, in); + out->flags |= pkt->flags; + return 0; + } + if (!display && i != in->size) { + av_log(bsf, AV_LOG_WARNING, "Failed to parse PGS segments.\n"); + // force output what we have + display = size = in->size; + pkt->flags |= AV_PKT_FLAG_CORRUPT; + } + + if (presentation) { + ret = av_packet_copy_props(pkt, in); + if (ret < 0) + goto fail; + } + pos = pkt->size; + ret = av_grow_packet(pkt, size); + if (ret < 0) + goto fail; + memcpy(pkt->data + pos, in->data, size); + + if (size == in->size) + av_packet_unref(in); + else { + in->data += size; + in->size -= size; + } + + if (display) { + if (!ctx->presentation_found) + pkt->flags |= AV_PKT_FLAG_CORRUPT; + ctx->presentation_found = 0; + av_packet_move_ref(out, pkt); + return 0; + } + return AVERROR(EAGAIN); + +fail: + ctx->presentation_found = 0; + frame_merge_flush(bsf); + return ret; +} + +static int frame_merge_init(AVBSFContext *bsf) +{ + PGSMergeContext *ctx = bsf->priv_data; + + ctx->in = av_packet_alloc(); + ctx->buffer_pkt = av_packet_alloc(); + if (!ctx->in || !ctx->buffer_pkt) + return AVERROR(ENOMEM); + + return 0; +} + +static void frame_merge_close(AVBSFContext *bsf) +{ + PGSMergeContext *ctx = bsf->priv_data; + + av_packet_free(&ctx->in); + av_packet_free(&ctx->buffer_pkt); +} + +static const enum AVCodecID frame_merge_codec_ids[] = { + AV_CODEC_ID_HDMV_PGS_SUBTITLE, AV_CODEC_ID_NONE, +}; + +const AVBitStreamFilter ff_pgs_frame_merge_bsf = { + .name = "pgs_frame_merge", + .priv_data_size = sizeof(PGSMergeContext), + .init = frame_merge_init, + .flush = frame_merge_flush, + .close = frame_merge_close, + .filter = frame_merge_filter, + .codec_ids = frame_merge_codec_ids, +}; From patchwork Fri May 8 14:11:25 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stebbins X-Patchwork-Id: 19558 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id D4988448E3C for ; Fri, 8 May 2020 17:12:35 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id B2ED768A285; Fri, 8 May 2020 17:12:35 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail.jetheaddev.com (mail.jetheaddev.com [70.164.99.34]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id D283D689D3A for ; Fri, 8 May 2020 17:12:28 +0300 (EEST) Received: from creator.alpe-d-promontory.fun (192.168.13.165) by cas.jetheaddev.com (192.168.13.27) with Microsoft SMTP Server (TLS) id 14.3.351.0; Fri, 8 May 2020 07:12:27 -0700 From: John Stebbins To: Date: Fri, 8 May 2020 08:11:25 -0600 Message-ID: <20200508141128.2684843-3-jstebbins@jetheaddev.com> X-Mailer: git-send-email 2.25.4 In-Reply-To: <20200508141128.2684843-1-jstebbins@jetheaddev.com> References: <20200508141128.2684843-1-jstebbins@jetheaddev.com> MIME-Version: 1.0 X-Originating-IP: [192.168.13.165] Subject: [FFmpeg-devel] [PATCH 2/5] lavc/pgs_frame_split_bsf: add bsf to split PGS segments X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 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" Requried to remux mkv to m2ts --- Changelog | 1 + doc/bitstream_filters.texi | 8 ++ libavcodec/Makefile | 1 + libavcodec/bitstream_filters.c | 1 + libavcodec/pgs_frame_split_bsf.c | 179 +++++++++++++++++++++++++++++++ 5 files changed, 190 insertions(+) create mode 100644 libavcodec/pgs_frame_split_bsf.c diff --git a/Changelog b/Changelog index 0b108e548f..7564a55220 100644 --- a/Changelog +++ b/Changelog @@ -67,6 +67,7 @@ version : - Pro Pinball Series Soundbank demuxer - pcm_rechunk bitstream filter - PGS subtitle frame merge bitstream filter +- PGS subtitle frame split bitstream filter version 4.2: diff --git a/doc/bitstream_filters.texi b/doc/bitstream_filters.texi index de2ddcacc4..5b992b1a5d 100644 --- a/doc/bitstream_filters.texi +++ b/doc/bitstream_filters.texi @@ -586,6 +586,14 @@ segment into a single packet. This is required by some containers that support PGS subtitles (muxer @code{matroska}). +@section pgs_frame_split + +Split a packet containing a sequence of PGS Subtitle segments into separate +packets each containing a single segment. + +This is required by some streaming formats, typically the MPEG-2 +transport stream format (muxer @code{mpegts}). + @section prores_metadata Modify color property metadata embedded in prores stream. diff --git a/libavcodec/Makefile b/libavcodec/Makefile index 1a3c411a81..a011e7c3ba 100644 --- a/libavcodec/Makefile +++ b/libavcodec/Makefile @@ -1119,6 +1119,7 @@ OBJS-$(CONFIG_NULL_BSF) += null_bsf.o OBJS-$(CONFIG_OPUS_METADATA_BSF) += opus_metadata_bsf.o OBJS-$(CONFIG_PCM_RECHUNK_BSF) += pcm_rechunk_bsf.o OBJS-$(CONFIG_PGS_FRAME_MERGE_BSF) += pgs_frame_merge_bsf.o +OBJS-$(CONFIG_PGS_FRAME_SPLIT_BSF) += pgs_frame_split_bsf.o OBJS-$(CONFIG_PRORES_METADATA_BSF) += prores_metadata_bsf.o OBJS-$(CONFIG_REMOVE_EXTRADATA_BSF) += remove_extradata_bsf.o OBJS-$(CONFIG_TEXT2MOVSUB_BSF) += movsub_bsf.o diff --git a/libavcodec/bitstream_filters.c b/libavcodec/bitstream_filters.c index b4a9388ee2..7c79bc3e4b 100644 --- a/libavcodec/bitstream_filters.c +++ b/libavcodec/bitstream_filters.c @@ -52,6 +52,7 @@ extern const AVBitStreamFilter ff_null_bsf; extern const AVBitStreamFilter ff_opus_metadata_bsf; extern const AVBitStreamFilter ff_pcm_rechunk_bsf; extern const AVBitStreamFilter ff_pgs_frame_merge_bsf; +extern const AVBitStreamFilter ff_pgs_frame_split_bsf; extern const AVBitStreamFilter ff_prores_metadata_bsf; extern const AVBitStreamFilter ff_remove_extradata_bsf; extern const AVBitStreamFilter ff_text2movsub_bsf; diff --git a/libavcodec/pgs_frame_split_bsf.c b/libavcodec/pgs_frame_split_bsf.c new file mode 100644 index 0000000000..cb60f59a87 --- /dev/null +++ b/libavcodec/pgs_frame_split_bsf.c @@ -0,0 +1,179 @@ +/* + * Copyright (c) 2020 John Stebbins + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +/** + * @file + * This bitstream filter splits PGS subtitle packets into packets containing + * just one segment. + * + * Packets already containing only one segment will be passed through + * unchanged. + */ + +#include "libavutil/log.h" +#include "avcodec.h" +#include "bsf.h" +#include "libavutil/intreadwrite.h" + +enum PGSSegmentType { + PALETTE_SEGMENT = 0x14, + OBJECT_SEGMENT = 0x15, + PRESENTATION_SEGMENT = 0x16, + WINDOW_SEGMENT = 0x17, + END_DISPLAY_SET_SEGMENT = 0x80, +}; + +typedef struct PGSSplitContext { + AVPacket *in; +} PGSSplitContext; + +static int frame_split_filter(AVBSFContext *bsf, AVPacket *out) +{ + PGSSplitContext *ctx = bsf->priv_data; + AVPacket *in = ctx->in; + int ret; + unsigned int i; + uint8_t segment_type; + int segment_len; + int split = !!in->data; + + if (!in->data) { + ret = ff_bsf_get_packet_ref(bsf, in); + if (ret < 0) + return ret; + } + if (!in->size) { + av_packet_unref(in); + return AVERROR(EAGAIN); + } + + // Validate packet data + i = 0; + while (i < in->size) { + segment_type = in->data[i]; + segment_len = AV_RB16(in->data + i + 1) + 3; + i += segment_len; + } + if (i != in->size) { + av_log(bsf, AV_LOG_WARNING, "Failed to parse PGS segments.\n"); + av_packet_move_ref(out, in); + out->flags |= AV_PKT_FLAG_CORRUPT; + return 0; + } + + segment_type = in->data[0]; + segment_len = AV_RB16(in->data + 1) + 3; + if (split || segment_len < in->size) { // Split + int64_t ts_delta, dts; + + ret = av_packet_ref(out, in); + if (ret < 0) + goto fail; + out->size = segment_len; + in->data += segment_len; + in->size -= segment_len; + + // Update PTS/DTS, Stagger timestamps by 3ms + ts_delta = 270; // Assume 90khz tick if no time_base_in + if (bsf->time_base_in.num && bsf->time_base_in.den) + ts_delta = bsf->time_base_in.den / bsf->time_base_in.num / 333; + if (ts_delta == 0) + ts_delta = 1; + + // Compute DTS, it's the same for all packets that carry it + // Assuming input PTS/DTS come from original presentation_segment + if (in->dts <= in->pts - 2 * ts_delta && + in->dts != AV_NOPTS_VALUE) + dts = in->dts; + else if (in->pts != AV_NOPTS_VALUE) + dts = in->pts - 2 * ts_delta; + + switch (segment_type) { + case END_DISPLAY_SET_SEGMENT: + if (in->pts != AV_NOPTS_VALUE) + out->pts = in->pts - ts_delta; + out->dts = AV_NOPTS_VALUE; + break; + case PALETTE_SEGMENT: + if (in->pts != AV_NOPTS_VALUE) + out->pts = in->pts - 2 * ts_delta; + out->dts = AV_NOPTS_VALUE; + break; + case PRESENTATION_SEGMENT: + out->pts = in->pts; + out->dts = dts; + break; + case WINDOW_SEGMENT: + case OBJECT_SEGMENT: + default: + if (in->pts != AV_NOPTS_VALUE) + out->pts = in->pts - ts_delta; + out->dts = dts; + break; + } + } else + av_packet_move_ref(out, in); + + return 0; + +fail: + av_packet_unref(in); + + return ret; +} + +static int frame_split_init(AVBSFContext *bsf) +{ + PGSSplitContext *ctx = bsf->priv_data; + + ctx->in = av_packet_alloc(); + if (!ctx->in) + return AVERROR(ENOMEM); + + return 0; +} + +static void frame_split_flush(AVBSFContext *bsf) +{ + PGSSplitContext *ctx = bsf->priv_data; + + av_packet_unref(ctx->in); +} + +static void frame_split_close(AVBSFContext *bsf) +{ + PGSSplitContext *ctx = bsf->priv_data; + + av_packet_free(&ctx->in); +} + +static const enum AVCodecID frame_split_codec_ids[] = { + AV_CODEC_ID_HDMV_PGS_SUBTITLE, AV_CODEC_ID_NONE, +}; + +const AVBitStreamFilter ff_pgs_frame_split_bsf = { + .name = "pgs_frame_split", + .priv_data_size = sizeof(PGSSplitContext), + .init = frame_split_init, + .flush = frame_split_flush, + .close = frame_split_close, + .filter = frame_split_filter, + .codec_ids = frame_split_codec_ids, +}; From patchwork Fri May 8 14:11:26 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stebbins X-Patchwork-Id: 19559 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id CA58B448E3C for ; Fri, 8 May 2020 17:12:42 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id B1C1868A3AF; Fri, 8 May 2020 17:12:42 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail.jetheaddev.com (mail.jetheaddev.com [70.164.99.34]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id B952E68A14B for ; Fri, 8 May 2020 17:12:36 +0300 (EEST) Received: from creator.alpe-d-promontory.fun (192.168.13.165) by cas.jetheaddev.com (192.168.13.27) with Microsoft SMTP Server (TLS) id 14.3.351.0; Fri, 8 May 2020 07:12:35 -0700 From: John Stebbins To: Date: Fri, 8 May 2020 08:11:26 -0600 Message-ID: <20200508141128.2684843-4-jstebbins@jetheaddev.com> X-Mailer: git-send-email 2.25.4 In-Reply-To: <20200508141128.2684843-1-jstebbins@jetheaddev.com> References: <20200508141128.2684843-1-jstebbins@jetheaddev.com> MIME-Version: 1.0 X-Originating-IP: [192.168.13.165] Subject: [FFmpeg-devel] [PATCH 3/5] lavc/version: Bump minor-version for new PGS bsfs X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 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" --- libavcodec/version.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/version.h b/libavcodec/version.h index 691320b63c..82255d7f38 100644 --- a/libavcodec/version.h +++ b/libavcodec/version.h @@ -28,7 +28,7 @@ #include "libavutil/version.h" #define LIBAVCODEC_VERSION_MAJOR 58 -#define LIBAVCODEC_VERSION_MINOR 83 +#define LIBAVCODEC_VERSION_MINOR 84 #define LIBAVCODEC_VERSION_MICRO 100 #define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \ From patchwork Fri May 8 14:11:27 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stebbins X-Patchwork-Id: 19560 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id A8BD2449281 for ; Fri, 8 May 2020 17:13:16 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 8DA4168A303; Fri, 8 May 2020 17:13:16 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail.jetheaddev.com (mail.jetheaddev.com [70.164.99.34]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 761A4688047 for ; Fri, 8 May 2020 17:13:14 +0300 (EEST) Received: from creator.alpe-d-promontory.fun (192.168.13.165) by cas.jetheaddev.com (192.168.13.27) with Microsoft SMTP Server (TLS) id 14.3.351.0; Fri, 8 May 2020 07:13:12 -0700 From: John Stebbins To: Date: Fri, 8 May 2020 08:11:27 -0600 Message-ID: <20200508141128.2684843-5-jstebbins@jetheaddev.com> X-Mailer: git-send-email 2.25.4 In-Reply-To: <20200508141128.2684843-1-jstebbins@jetheaddev.com> References: <20200508141128.2684843-1-jstebbins@jetheaddev.com> MIME-Version: 1.0 X-Originating-IP: [192.168.13.165] Subject: [FFmpeg-devel] [PATCH 4/5] lavf/matroskaenc: enable PGS merge auto bsf X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 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" PGS segments must be merged to one packet for muxing to mkv --- libavformat/matroskaenc.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c index 99b549ecc4..7f2cda41b9 100644 --- a/libavformat/matroskaenc.c +++ b/libavformat/matroskaenc.c @@ -2735,6 +2735,8 @@ static int mkv_check_bitstream(struct AVFormatContext *s, const AVPacket *pkt) ret = ff_stream_add_bitstream_filter(st, "aac_adtstoasc", NULL); } else if (st->codecpar->codec_id == AV_CODEC_ID_VP9) { ret = ff_stream_add_bitstream_filter(st, "vp9_superframe", NULL); + } else if (st->codecpar->codec_id == AV_CODEC_ID_HDMV_PGS_SUBTITLE) { + ret = ff_stream_add_bitstream_filter(st, "pgs_frame_merge", NULL); } return ret; From patchwork Fri May 8 14:11:28 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stebbins X-Patchwork-Id: 19561 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id 9CB5D449281 for ; Fri, 8 May 2020 17:13:23 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 847F6680D1B; Fri, 8 May 2020 17:13:23 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail.jetheaddev.com (mail.jetheaddev.com [70.164.99.34]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id D5AE168813B for ; Fri, 8 May 2020 17:13:16 +0300 (EEST) Received: from creator.alpe-d-promontory.fun (192.168.13.165) by cas.jetheaddev.com (192.168.13.27) with Microsoft SMTP Server (TLS) id 14.3.351.0; Fri, 8 May 2020 07:13:15 -0700 From: John Stebbins To: Date: Fri, 8 May 2020 08:11:28 -0600 Message-ID: <20200508141128.2684843-6-jstebbins@jetheaddev.com> X-Mailer: git-send-email 2.25.4 In-Reply-To: <20200508141128.2684843-1-jstebbins@jetheaddev.com> References: <20200508141128.2684843-1-jstebbins@jetheaddev.com> MIME-Version: 1.0 X-Originating-IP: [192.168.13.165] Subject: [FFmpeg-devel] [PATCH 5/5] lavf/mpegtsenc: enable PGS split auto bsf X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 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" PGS segments must be one per packet for muxing to m2ts --- libavformat/mpegtsenc.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libavformat/mpegtsenc.c b/libavformat/mpegtsenc.c index f2be6c6632..5b86dffd0e 100644 --- a/libavformat/mpegtsenc.c +++ b/libavformat/mpegtsenc.c @@ -1984,6 +1984,8 @@ static int mpegts_check_bitstream(struct AVFormatContext *s, const AVPacket *pkt (st->codecpar->extradata_size > 0 && st->codecpar->extradata[0] == 1))) ret = ff_stream_add_bitstream_filter(st, "hevc_mp4toannexb", NULL); + } else if (st->codecpar->codec_id == AV_CODEC_ID_HDMV_PGS_SUBTITLE) { + ret = ff_stream_add_bitstream_filter(st, "pgs_frame_split", NULL); } return ret;