From patchwork Fri Nov 19 19:15:20 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 31508 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a6b:d206:0:0:0:0:0 with SMTP id q6csp2860359iob; Fri, 19 Nov 2021 11:15:47 -0800 (PST) X-Google-Smtp-Source: ABdhPJxdO6lvYqdN+v9+Oag7GYNaFDvzgTbhLhDWhH6AwbWFpXEM5YxoZLXAaQyXAyYJOqJYowzu X-Received: by 2002:a17:906:7304:: with SMTP id di4mr10770721ejc.474.1637349347701; Fri, 19 Nov 2021 11:15:47 -0800 (PST) Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id 4si1017148ejc.763.2021.11.19.11.15.46; Fri, 19 Nov 2021 11:15:47 -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; dkim=neutral (body hash did not verify) header.i=@outlook.com header.s=selector1 header.b="HFv6Bt/G"; arc=fail (body hash mismatch); 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=outlook.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 19DCB68A744; Fri, 19 Nov 2021 21:15:42 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR03-DB5-obe.outbound.protection.outlook.com (mail-oln040092071055.outbound.protection.outlook.com [40.92.71.55]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id CB04268A132 for ; Fri, 19 Nov 2021 21:15:34 +0200 (EET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=bS7mOeYF4WuE5x3XHHLEyLZepPSFPYS+KlAzkLJgzFCTkyvveHsAydpFXe2zMIJc785YWNDoL2wfcJ/vPPdVozT5IGRZKGqQ/7wBAJiXP4dl6qpXA+bLyhTDRvbS5Z86ohIwykG1G+9W25FASqag7katZfZSau0tMs/bAYxz8vcjkW8moZPdF3jN/hU93KDOMYUIN33Th8/DAKiMEmmr6wPRay5KzyyMPPxXynuzZuKFqUkfM4BuNQsXnBenRuU68H6zNiNKcfC/nGubCG+QkQby1sAXtlZnc3Js3tKwfSx4wkJqYUTh1wetFyQSn4tXr8EQcqEHwzZZHoYoIxXM6A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=bwyKiRBq0L2AStf7KfWlXV0K++jw6LdgisVYogs8FYw=; b=LDgEX6HYFYR37O9yE1kk83XOM+Sic24EYY19rO1rAvZsqzQ/aOi8K6+dwMelapgl8eqtbvujcXTl46tLt3VzDnNb53OpInxJJPDzDfx4lawyk8RRf5KBvqyTAM8XcSzA8eOkG2Y5xew5s+r0+Zk0ZeXdzcd8wlfQAGYMVquGSSI/0lgHW1KzFLzE4+hAslAyF2ClJzVsIYQZuCodYOfDVzib2NP2lmh2XLnT+ROzLozU1RK3i8zHAtI7khrfZEu3DiHtEaNMmqG+meKjh8LCoejQMKygJ4zc7uo6GhvyG00oRPaqvzQIIu7bPAYuuRpNGhRy2zgIoAbxf0TDeYLZ3Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outlook.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=bwyKiRBq0L2AStf7KfWlXV0K++jw6LdgisVYogs8FYw=; b=HFv6Bt/GnTk2pU/pEQgjecMEDkx8Zm6geAKEiBl0R+DH5LvWIUBwdtyyPDffUSgQES5gKssiaf4k0V8WmkzBfMkLu6vXGdJH9XKw6Rz/nHZQ0tuau+Q6emdSPgViFzRSL1U81WhtKGyC0M5WVj0OBwsfEsNWLOpaRHe6vN3YwlEbr8m1jtSZBIy0eKiTXN0+kdxwXoyAjcbtUZzLosiTYBHOsUUABF19brC7VkemErRV551C0NQrZtFOn/JUe6Y0VHCMVAQL0m/x7bEJUo/Y2Y2AbhOkt4zW5TtJubFNd0JLfGpbr3OEWjhYQIkS+BRPkCRhbg1FWh1huRSfBOsTdQ== Received: from AM7PR03MB6660.eurprd03.prod.outlook.com (2603:10a6:20b:1c1::22) by AM6PR03MB4886.eurprd03.prod.outlook.com (2603:10a6:20b:85::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4713.22; Fri, 19 Nov 2021 19:15:32 +0000 Received: from AM7PR03MB6660.eurprd03.prod.outlook.com ([fe80::700f:d70b:3bb8:4d51]) by AM7PR03MB6660.eurprd03.prod.outlook.com ([fe80::700f:d70b:3bb8:4d51%9]) with mapi id 15.20.4713.022; Fri, 19 Nov 2021 19:15:32 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Fri, 19 Nov 2021 20:15:20 +0100 Message-ID: X-Mailer: git-send-email 2.30.2 X-TMN: [BBpOX+4rHgDhOhExnEY2FIMZBAPoVpND] X-ClientProxiedBy: AS8PR04CA0111.eurprd04.prod.outlook.com (2603:10a6:20b:31e::26) To AM7PR03MB6660.eurprd03.prod.outlook.com (2603:10a6:20b:1c1::22) X-Microsoft-Original-Message-ID: <20211119191524.1025835-1-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from sblaptop.fritz.box (188.192.137.12) by AS8PR04CA0111.eurprd04.prod.outlook.com (2603:10a6:20b:31e::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4713.22 via Frontend Transport; Fri, 19 Nov 2021 19:15:31 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 3208d861-0316-42fe-bd46-08d9ab90f4da X-MS-Exchange-SLBlob-MailProps: EpEO96k6WolGhf8HUbp7Tbhr2SS12qUIprPxQJy4D0azqbbmRDofrG3PDYDiD01FTJ0/zP5arBu1AhoCam1gT7SYwLRBQ04vVjOF39u6I8vUHIjwtY61ISF4cTFv33VNO2wACbOsZsxmsvkm4i9kzpapxvCdorl/D+gUG/m6ZjG5NjtmlrE7KIrEY8ObE5uoSo/Qbq+g9LcnMvca1JY+xI0By+e/2htRZdx9h0Z6kK6vryXkzf283cqhUOlpgOaB3XuKnzeT9yRDRtm9PPo7rfm25ap8jiWAQwXH20wNZ/ytX+JPg5LFM1v8vAiLO0cPEORv3gAH24hqOIACJRKKFtRZ8+yt3OcDcf/Qxntb9u5/b3H49SuK+NN56uD3mQXeZoBrMYJkefRUVUH/3PDIL1PXZnpWjIlnPhjrtrEJAee45Ra+gFcH43SWY30WNixPs17z9n9lL3zQY7mhyzmmSQCp9EfgDsrzwfl1tYMQ3tzWJ9+DTeCcviF8psTv4okLe/6o6Z5eTySqh3PT/WY9scSEI6/CoenBTtitjcv7eULDBSBMynheeVw4DXo6iQDHVZl3R+HVCBjJvcsj3bAXGCyuoyhK66nxGM4bJ+az2LaPkCFCW914xNO4cdzxG188h6T4S/lWDDPTb27/AuxLFSE4BGW0AR65x6hzQfIS1EQ/DR52o74nvUCugKH05Li+wUeAuMG6+16YUh4PTVgAaNmXWgU0RHt4W2ju5Z2RWjmC7xGUV9wNBi6UEplDkaaKfc8ZslXzSAc= X-MS-TrafficTypeDiagnostic: AM6PR03MB4886: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: eQAUbe0U3kt0saVXFacmrCUkEpmUiOatoJq7ePVkYdBIFGt5sPSwfZIyp6Ya3nc2suWm3eYBPZ87SEEb5ZgFBe6LVFf1yAaG7W3qXRn7LuqScUETrW2CEvo3aDnYknBWj9V9DtiyBsk6KVk8hltkjVdZbrWDtZn2qV7ew91sE+IEDwkTzCNYe4TNReaNYPgW1Et6EcQZNpSteKfCkLO7hFJDH+seU+0+ZSVIPNaGujX5S3+xQ6/ru83dqf0TAb9rjBtGh8zmG/w+vKPFFaxYRs2FgXQ6OJxAtlNu9mD6XFuEciwVvZHFASyOIU5hOKPdKeOzevYbWO3zsH6D0DcGo2YYxFDCEPYcEjkdf9klYSjzYz3Quy7p8+fKNMbR6N8eKEb2IwbdzdbZ7uMPqGQd64KfydxdLXEKUFV2yh/OdV+x/PH/2cFWyGVam/hQecxAE7OQBhTlXIZ4C4Q/UzeoWmK3eRUWnJA//BcQAP/saaGir6xOInkEGB0bvxHXkBQqPlznw44yuqBEDfMQe7smIupVwbkaBhghIDBpTYH5Rqv77RK70nsXM60mAvVkG1ZFWAmhtj9evX1mddZZzHNgWw== X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: iVHcYKnPUU6gi7lk1mtP6R91FZZUFHToMlbjSkVvUpLhHQix0lDqkntknc9/M6gY9cbU7obUqNO3VWqh7Z+Z/4iCkpUyBiC6eI5iJK0YlrxXMhl9dJ1AQaM+KzVp/Rhbc+mDkmmfr77rca7P/qNuXdrlt8SDZx9z+SpHZm2iovIocYuTzcJU+Tizhw4VGfXM2oRr5plKzammzEsMccMqWRQxCF+c3ljo7RrvzlXus3TsIwIU7sEqMe+122O273AvnpmT8z25k7fY++qJ0ph5n0IDFZuux/SypVY8JO2Z5SZK9RHxja0OqZ8cRA8Sr5UtHoG40JcMrS25wYwESAidHbB6UjKTYe5MDUVHEX1ktn/HD+X/zREL1NlMbOkej9wxU69KeHV4xtAjzz5ZmQoIEajRlA7L/YknZhvIeiF0kbNC+XRbHJkco1RCbmQ7Y0bwO2JrJ5F4zZcjxyJsZEvwmeNXFRu6Vw0yqpPPlo72OrkPKON6Jw/1AEMMhZYjeXMpduo07vuAqq7IQeiCb3xOc61SgNcy3pcVuwbRGCJ9fPm/XJ9rqLJmUlNBxxL20D0L3wSkMzcJmnS6nBGv7yVlXNzO/oR/mthsZJDM/+pGleAwLMoj5fgZGcgm//m5kEh8YCygDJi75hu5ABslQLm5vOfVjqio0kG4ERsw25KXSGnh6DrzCIlkz1iIagKcghdMGsHJ+klNrk2Dgc10l18K/w== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3208d861-0316-42fe-bd46-08d9ab90f4da X-MS-Exchange-CrossTenant-AuthSource: AM7PR03MB6660.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Nov 2021 19:15:32.4916 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR03MB4886 Subject: [FFmpeg-devel] [PATCH 1/5] avformat/avformat: Add AVStream parameter to check_bitstream() sig 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: Andreas Rheinhardt Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: 4vsvxwzAv4nm For most check_bitstream() functions this just avoids having to dereference s->streams[pkt->stream_index] themselves; but for meta-muxers it will allow to forward the packet to stream with a different stream_index (belonging to a different AVFormatContext) without using a spare packet. Signed-off-by: Andreas Rheinhardt --- libavformat/avformat.h | 7 ++++++- libavformat/dashenc.c | 12 +++++++----- libavformat/flvenc.c | 4 ++-- libavformat/latmenc.c | 4 ++-- libavformat/matroskaenc.c | 4 ++-- libavformat/movenc.c | 4 ++-- libavformat/mpegtsenc.c | 4 ++-- libavformat/mux.c | 2 +- libavformat/rawenc.c | 12 ++++++------ libavformat/segment.c | 10 ++++++---- 10 files changed, 36 insertions(+), 27 deletions(-) diff --git a/libavformat/avformat.h b/libavformat/avformat.h index 0343825aa0..75699f3a32 100644 --- a/libavformat/avformat.h +++ b/libavformat/avformat.h @@ -322,6 +322,7 @@ #include "libavformat/version.h" struct AVFormatContext; +struct AVStream; struct AVDeviceInfoList; struct AVDeviceCapabilitiesQuery; @@ -623,9 +624,13 @@ typedef struct AVOutputFormat { /** * Set up any necessary bitstream filtering and extract any extra data needed * for the global header. + * + * @note pkt might have been directly forwarded by a meta-muxer; therefore + * pkt->stream_index as well as the pkt's timebase might be invalid. * Return 0 if more packets from this stream must be checked; 1 if not. */ - int (*check_bitstream)(struct AVFormatContext *, const AVPacket *pkt); + int (*check_bitstream)(struct AVFormatContext *s, struct AVStream *st, + const AVPacket *pkt); } AVOutputFormat; /** * @} diff --git a/libavformat/dashenc.c b/libavformat/dashenc.c index 5faf06e11d..dd2b34afbb 100644 --- a/libavformat/dashenc.c +++ b/libavformat/dashenc.c @@ -2333,19 +2333,21 @@ static int dash_write_trailer(AVFormatContext *s) return 0; } -static int dash_check_bitstream(struct AVFormatContext *s, const AVPacket *avpkt) +static int dash_check_bitstream(AVFormatContext *s, AVStream *st, + const AVPacket *avpkt) { DASHContext *c = s->priv_data; - OutputStream *os = &c->streams[avpkt->stream_index]; + OutputStream *os = &c->streams[st->index]; AVFormatContext *oc = os->ctx; if (oc->oformat->check_bitstream) { + AVStream *const ost = oc->streams[0]; int ret; AVPacket pkt = *avpkt; pkt.stream_index = 0; - ret = oc->oformat->check_bitstream(oc, &pkt); + ret = oc->oformat->check_bitstream(oc, ost, &pkt); if (ret == 1) { - FFStream *const sti = ffstream(s->streams[avpkt->stream_index]); - FFStream *const osti = ffstream(oc->streams[0]); + FFStream *const sti = ffstream(st); + FFStream *const osti = ffstream(ost); sti->bsfc = osti->bsfc; osti->bsfc = NULL; } diff --git a/libavformat/flvenc.c b/libavformat/flvenc.c index 3f24c7e192..c5926575a1 100644 --- a/libavformat/flvenc.c +++ b/libavformat/flvenc.c @@ -1083,10 +1083,10 @@ fail: return ret; } -static int flv_check_bitstream(struct AVFormatContext *s, const AVPacket *pkt) +static int flv_check_bitstream(AVFormatContext *s, AVStream *st, + const AVPacket *pkt) { int ret = 1; - AVStream *st = s->streams[pkt->stream_index]; if (st->codecpar->codec_id == AV_CODEC_ID_AAC) { if (pkt->size > 2 && (AV_RB16(pkt->data) & 0xfff0) == 0xfff0) diff --git a/libavformat/latmenc.c b/libavformat/latmenc.c index 21bb614f67..72865c9565 100644 --- a/libavformat/latmenc.c +++ b/libavformat/latmenc.c @@ -245,10 +245,10 @@ too_large: return AVERROR_INVALIDDATA; } -static int latm_check_bitstream(struct AVFormatContext *s, const AVPacket *pkt) +static int latm_check_bitstream(AVFormatContext *s, AVStream *st, + const AVPacket *pkt) { int ret = 1; - AVStream *st = s->streams[pkt->stream_index]; if (st->codecpar->codec_id == AV_CODEC_ID_AAC) { if (pkt->size > 2 && (AV_RB16(pkt->data) & 0xfff0) == 0xfff0) diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c index 6945c26f5a..f08ead0a96 100644 --- a/libavformat/matroskaenc.c +++ b/libavformat/matroskaenc.c @@ -2731,10 +2731,10 @@ static int mkv_init(struct AVFormatContext *s) return 0; } -static int mkv_check_bitstream(struct AVFormatContext *s, const AVPacket *pkt) +static int mkv_check_bitstream(AVFormatContext *s, AVStream *st, + const AVPacket *pkt) { int ret = 1; - AVStream *st = s->streams[pkt->stream_index]; if (st->codecpar->codec_id == AV_CODEC_ID_AAC) { if (pkt->size > 2 && (AV_RB16(pkt->data) & 0xfff0) == 0xfff0) diff --git a/libavformat/movenc.c b/libavformat/movenc.c index 37d4403f7a..fec467979a 100644 --- a/libavformat/movenc.c +++ b/libavformat/movenc.c @@ -7343,10 +7343,10 @@ static int mov_write_trailer(AVFormatContext *s) return res; } -static int mov_check_bitstream(struct AVFormatContext *s, const AVPacket *pkt) +static int mov_check_bitstream(AVFormatContext *s, AVStream *st, + const AVPacket *pkt) { int ret = 1; - AVStream *st = s->streams[pkt->stream_index]; if (st->codecpar->codec_id == AV_CODEC_ID_AAC) { if (pkt->size > 2 && (AV_RB16(pkt->data) & 0xfff0) == 0xfff0) diff --git a/libavformat/mpegtsenc.c b/libavformat/mpegtsenc.c index e3fba54939..79ec1a7e5f 100644 --- a/libavformat/mpegtsenc.c +++ b/libavformat/mpegtsenc.c @@ -2208,10 +2208,10 @@ static void mpegts_deinit(AVFormatContext *s) av_freep(&ts->services); } -static int mpegts_check_bitstream(struct AVFormatContext *s, const AVPacket *pkt) +static int mpegts_check_bitstream(AVFormatContext *s, AVStream *st, + const AVPacket *pkt) { int ret = 1; - AVStream *st = s->streams[pkt->stream_index]; if (st->codecpar->codec_id == AV_CODEC_ID_H264) { if (pkt->size >= 5 && AV_RB32(pkt->data) != 0x0000001 && diff --git a/libavformat/mux.c b/libavformat/mux.c index 1389bcc003..d93dc73f8e 100644 --- a/libavformat/mux.c +++ b/libavformat/mux.c @@ -1074,7 +1074,7 @@ static int check_bitstream(AVFormatContext *s, FFStream *sti, AVPacket *pkt) if (s->oformat->check_bitstream) { if (!sti->bitstream_checked) { - if ((ret = s->oformat->check_bitstream(s, pkt)) < 0) + if ((ret = s->oformat->check_bitstream(s, &sti->pub, pkt)) < 0) return ret; else if (ret == 1) sti->bitstream_checked = 1; diff --git a/libavformat/rawenc.c b/libavformat/rawenc.c index 15e7051873..4bbae7717b 100644 --- a/libavformat/rawenc.c +++ b/libavformat/rawenc.c @@ -341,9 +341,9 @@ const AVOutputFormat ff_h263_muxer = { #endif #if CONFIG_H264_MUXER -static int h264_check_bitstream(struct AVFormatContext *s, const AVPacket *pkt) +static int h264_check_bitstream(AVFormatContext *s, AVStream *st, + const AVPacket *pkt) { - AVStream *st = s->streams[0]; if (pkt->size >= 5 && AV_RB32(pkt->data) != 0x0000001 && AV_RB24(pkt->data) != 0x000001) return ff_stream_add_bitstream_filter(st, "h264_mp4toannexb", NULL); @@ -364,9 +364,9 @@ const AVOutputFormat ff_h264_muxer = { #endif #if CONFIG_HEVC_MUXER -static int hevc_check_bitstream(struct AVFormatContext *s, const AVPacket *pkt) +static int hevc_check_bitstream(AVFormatContext *s, AVStream *st, + const AVPacket *pkt) { - AVStream *st = s->streams[0]; if (pkt->size >= 5 && AV_RB32(pkt->data) != 0x0000001 && AV_RB24(pkt->data) != 0x000001) return ff_stream_add_bitstream_filter(st, "hevc_mp4toannexb", NULL); @@ -468,9 +468,9 @@ const AVOutputFormat ff_mpeg2video_muxer = { #endif #if CONFIG_OBU_MUXER -static int obu_check_bitstream(struct AVFormatContext *s, const AVPacket *pkt) +static int obu_check_bitstream(AVFormatContext *s, AVStream *st, + const AVPacket *pkt) { - AVStream *st = s->streams[0]; return ff_stream_add_bitstream_filter(st, "av1_metadata", "td=insert"); } diff --git a/libavformat/segment.c b/libavformat/segment.c index 2b024fd373..9861462405 100644 --- a/libavformat/segment.c +++ b/libavformat/segment.c @@ -984,15 +984,17 @@ static int seg_write_trailer(struct AVFormatContext *s) return ret; } -static int seg_check_bitstream(struct AVFormatContext *s, const AVPacket *pkt) +static int seg_check_bitstream(AVFormatContext *s, AVStream *st, + const AVPacket *pkt) { SegmentContext *seg = s->priv_data; AVFormatContext *oc = seg->avf; if (oc->oformat->check_bitstream) { - int ret = oc->oformat->check_bitstream(oc, pkt); + AVStream *const ost = oc->streams[st->index]; + int ret = oc->oformat->check_bitstream(oc, ost, pkt); if (ret == 1) { - FFStream *const sti = ffstream( s->streams[pkt->stream_index]); - FFStream *const osti = ffstream(oc->streams[pkt->stream_index]); + FFStream *const sti = ffstream(st); + FFStream *const osti = ffstream(ost); sti->bsfc = osti->bsfc; osti->bsfc = NULL; }