From patchwork Thu Apr 1 21:26:08 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 26695 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 3E08E44A5B2 for ; Fri, 2 Apr 2021 00:26:52 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 2854D68A2B1; Fri, 2 Apr 2021 00:26:52 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05olkn2061.outbound.protection.outlook.com [40.92.89.61]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id EFCC568A2B1 for ; Fri, 2 Apr 2021 00:26:44 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=SVbxKKeLaDQ7SKpYL+9bRz3d6wDtK+uD7RzM+gD3jaLUpZsUehx2U9BWkXiU4e00G2fy0pB/cZKv2px2Jx4mrCKDk43JUVotM1c9rmIlXx5i3qRkhuvppRHeB+IeVTBszrvu+zSNMTOdTk4h4M+In5yO6Ehbn3zESDndZLJ9LbL0rftsdPS+LPgM1xRJ9dVvWqVMhN3HExWYK1hQOg4HtSRj7y8JBZf+o00jKEO0FYBbaJ6rlRH6q1yatqYeIsnsm90diMi21Tmab3ls9r+68Fpm2qKiHZ7CCbb7d3L1i5sLPY2C74xsFMysqIBDyC8VacRkSy0EC6c7wX3UR1WmRA== 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-SenderADCheck; bh=08aFqB6BAh7qZJSpF1TuLwgxRwNO8laIHOCbEWd3NHY=; b=U8yladeu7xBCZv2r0WetRz+gm9IsqxGl6NtoVCkw8vWQj1np4mAF046DUWrZyjZTLIDpyhZysj0YYRbTbJu1clt5mGHf3vG+G7/BqQhFU3WRXjPpCZVw/YKcMWqlJBlFrrmd3MQ7w1G9hCadU6+d5qFRBeP5y2e2zkM3j51OCu6c5Pvg2dEdKdtDBhp5juc6cn/JPIe56cGLfpJ75Cm46xnuT5BXzKIQ+7V9FUW6Ze4fSlx0EuN2dlgwE+hG6HGDTVDl262o3wMMQj8t7b7D+H0IXIpx4UNfRqgF/8mrldbDkCdTWyhDn3Fcy+yhAJPBKN7FHBY0KPcv5HjQc6L4ig== 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=08aFqB6BAh7qZJSpF1TuLwgxRwNO8laIHOCbEWd3NHY=; b=cGxWgmNQ22ofbNW246BNntTh2kjb5ocRipFP9/ozg/w4fvOzMXVMcINM4WaHk23c2nytKjfkfJLNaW1MOU3krJw+Ub0fAf2kmhhg+Z2ZySVw3rrl2xvZ9RVwPsbtttg44W3dwhtdbZQkJmcGregP/63EKJ0AOMpmVmHdbNvYJl122Tur04NUjOx/EpWgod8HUMbnuzuHkLjlQEb/ZaUJwXEjeT71qmj5dato6bra92nweYxkn7sZJRBKeViWHCch6avQmuKvf1fwdy6Rs5vVtZiDG0xyqA37E20BrwbNX1JIrSRNeOQtBqtwJGWpGSFDPUOcUV34YckZO8Sn8Bn9MQ== Received: from DB8EUR05FT053.eop-eur05.prod.protection.outlook.com (2a01:111:e400:fc0f::4b) by DB8EUR05HT120.eop-eur05.prod.protection.outlook.com (2a01:111:e400:fc0f::466) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3977.29; Thu, 1 Apr 2021 21:26:42 +0000 Received: from HE1PR0301MB2154.eurprd03.prod.outlook.com (2a01:111:e400:fc0f::51) by DB8EUR05FT053.mail.protection.outlook.com (2a01:111:e400:fc0f::98) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3999.28 via Frontend Transport; Thu, 1 Apr 2021 21:26:42 +0000 X-IncomingTopHeaderMarker: OriginalChecksum:B07FC3EB3E1058F9C1A92C90ABE9B9EC6CADD7F3FADE96DCBDBD4A2DE8B7ADB2; UpperCasedChecksum:0583F52EDFAF7AB913B0509D63D56111480059ACFB666EBD4091215B4122F7E2; SizeAsReceived:7597; Count:48 Received: from HE1PR0301MB2154.eurprd03.prod.outlook.com ([fe80::8128:5de5:4e94:9a21]) by HE1PR0301MB2154.eurprd03.prod.outlook.com ([fe80::8128:5de5:4e94:9a21%3]) with mapi id 15.20.3999.028; Thu, 1 Apr 2021 21:26:42 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Thu, 1 Apr 2021 23:26:08 +0200 Message-ID: X-Mailer: git-send-email 2.27.0 In-Reply-To: References: X-TMN: [8EPRrWG8hc8xKBxoR4QQXJ2aJPP3eI5s] X-ClientProxiedBy: AM0PR10CA0016.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:208:17c::26) To HE1PR0301MB2154.eurprd03.prod.outlook.com (2603:10a6:3:2a::22) X-Microsoft-Original-Message-ID: <20210401212612.2343423-2-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from sblaptop.fritz.box (188.192.137.96) by AM0PR10CA0016.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:208:17c::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3999.28 via Frontend Transport; Thu, 1 Apr 2021 21:26:42 +0000 X-MS-PublicTrafficType: Email X-IncomingHeaderCount: 48 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-Correlation-Id: 363485ef-4cde-4ff8-12c1-08d8f554d825 X-MS-Exchange-SLBlob-MailProps: q+fD6XS3/UKNJu80vzaGCFsmWhGxAbOXJFCuOy1RE4M6qDrJsQLxK5zRxgVkLU7rYYwvrHzjKZcLSFTXSxrLQ43mFdED82khnNu6GMfUv7wvhGD9y7NDsYHcYsx8Oup92bJEtrIDzMBrPx70EJWve84zeQAaFo2Ew1A1d0qb1RY21jlylUYXJo7lFcUWiXVidl1GTLCdm8HFWcYV6DBg9VJE/vVIGfOZAwuDSuCaXrIuQSTx9J4lmUV/1rq6oSKJ/KUXZDhsHVkdQ+GjQHf/fWCAB7o05fWcb6DgXfYqA22R1E88GZPWl01WnKEhLoEErIWbPVodgi7ZsqDdvSiWJjJ0Q0W4oxP82THKVpvoAHWxHxTwDPh6V8m8N/Vb+2R90j45v93fY/seDzbQn+pdvJQ7Q9lgawBFGER1z3XVmSNn94LrxJZnuSL3TkHtQKkcl+cfMDOJbYp40BYjwlnfscrFKYqm8t/ZFuesRWIZrdsJehvOrbdPdxZqIdPdJ21cXYpStE8CvYb60YlDPiZybrQvfSTFZJyaskZi27P2hw9lpBswAOMhoyp1UHVHu7G9NMG3hKi2e/g9dn0evIb/G0oI/Xjyh5oycQrh107vGzYMnwB7MEQNyPsE18JLcziY5WjZ51YJcTY+zvgZbbpJ3yaGmghPyA50ryIIT64kgVY9t+yDDMXk5VlnCh1PFFo1k+ObHel0EGjACAVwj952Sw== X-MS-TrafficTypeDiagnostic: DB8EUR05HT120: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: BTnv+adFFDLUTf4ZmPhO/WadAwt7c7xEtR5v8u9PC11cM0LeE8L9LSEAvV5NwJP447gHmScZR+gLIWFf7z94jrLd+Pc7FHlMCUZabaLLdZau200qeam3bji9dwRxCAc3XcAzRF5muLsj3ichL3ihkT85y7ywoHXRTYFbJRl7XlYtNfB7jNUHtKeNWRgKehTjaVeV2Xn5yqIOjyRP2ePDfoa1drZ3gZr36HEjYywaX680C9iUDi1GwTMbqloh8uS2T9KEvjZelXYTdG0f58eyBQrxI2Ypx/h8UlGjUJIR+O+iVYMYHXZjCx8gGzaSxQ22iePiMc7D5Z+/URulEatHNqUYY0hI6TBDW4qLjhrq5CKSa1nGlLO8o183pYe32g7ZnV1P+uSTopVO9EpdGID8Ow== X-MS-Exchange-AntiSpam-MessageData: zd2pZ10TMLM4JSwjSBRbBzTdJ3CwDU3Us+F9SbioMkkzdHkgGT8Ul7/g1faPUIqMmkSYSDHGlJPk6S5NnBY4/1Lm0uVwjSPZeFPN1thskuG5jDyJpbin9XiQnL7Qz68ThlC0iLO+KgBkVrEhjpbPcA== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 363485ef-4cde-4ff8-12c1-08d8f554d825 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Apr 2021 21:26:42.7000 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-AuthSource: DB8EUR05FT053.eop-eur05.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: Internet X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB8EUR05HT120 Subject: [FFmpeg-devel] [PATCH 3/7] avformat/dss: Set values known during read_header in read_header 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 Cc: Andreas Rheinhardt Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Signed-off-by: Andreas Rheinhardt --- libavformat/dss.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/libavformat/dss.c b/libavformat/dss.c index 468de3fe84..0b6d68af99 100644 --- a/libavformat/dss.c +++ b/libavformat/dss.c @@ -144,6 +144,8 @@ static int dss_read_header(AVFormatContext *s) if (ctx->audio_codec == DSS_ACODEC_DSS_SP) { st->codecpar->codec_id = AV_CODEC_ID_DSS_SP; st->codecpar->sample_rate = 11025; + s->bit_rate = 8 * (DSS_FRAME_SIZE - 1) * st->codecpar->sample_rate + * 512 / (506 * 264); } else if (ctx->audio_codec == DSS_ACODEC_G723_1) { st->codecpar->codec_id = AV_CODEC_ID_G723_1; st->codecpar->sample_rate = 8000; @@ -206,7 +208,6 @@ static void dss_sp_byte_swap(DSSDemuxContext *ctx, static int dss_sp_read_packet(AVFormatContext *s, AVPacket *pkt) { DSSDemuxContext *ctx = s->priv_data; - AVStream *st = s->streams[0]; int read_size, ret, offset = 0, buff_offset = 0; int64_t pos = avio_tell(s->pb); @@ -219,8 +220,6 @@ static int dss_sp_read_packet(AVFormatContext *s, AVPacket *pkt) } else read_size = DSS_FRAME_SIZE; - ctx->packet_size = DSS_FRAME_SIZE - 1; - ret = av_new_packet(pkt, DSS_FRAME_SIZE); if (ret < 0) return ret; @@ -228,7 +227,6 @@ static int dss_sp_read_packet(AVFormatContext *s, AVPacket *pkt) pkt->duration = 264; pkt->pos = pos; pkt->stream_index = 0; - s->bit_rate = 8LL * ctx->packet_size * st->codecpar->sample_rate * 512 / (506 * pkt->duration); if (ctx->counter < read_size) { ret = avio_read(s->pb, ctx->dss_sp_buf + buff_offset,