From patchwork Sat Sep 11 08:15:14 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Soft Works X-Patchwork-Id: 30129 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6602:2a4a:0:0:0:0 with SMTP id k10csp2235822iov; Sat, 11 Sep 2021 01:15:27 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzrB6KTz7bSJZnSZKqgrAR/3RnPXqKB8PDXps4CqthcFLbkUB0XGJvcZ0EaGPHySg3i8Z4r X-Received: by 2002:a17:906:f43:: with SMTP id h3mr1750294ejj.267.1631348127312; Sat, 11 Sep 2021 01:15:27 -0700 (PDT) Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id bz5si1241469ejc.506.2021.09.11.01.15.26; Sat, 11 Sep 2021 01:15:27 -0700 (PDT) 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=@hotmail.com header.s=selector1 header.b=qq1wyM9H; 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=NONE dis=NONE) header.from=hotmail.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id C08656809C3; Sat, 11 Sep 2021 11:15:23 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from NAM02-SN1-obe.outbound.protection.outlook.com (mail-sn1anam02olkn2100.outbound.protection.outlook.com [40.92.44.100]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 07CC86809C3 for ; Sat, 11 Sep 2021 11:15:17 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=LQjKzfw775Xb3Kt4ralJw6H1V2hkCq/WNXI22n0fC5NBSkGOOyVfNGyGQiMJ+UF+aH/ZDtObs59gloTMkWKaYWTs/Hg4QyfQQTdcdziPK2YwOhQSvWVQysXbas/hTxYvPw0QJqHkzazMWhpdRzz3/43M/zkGf2BI8RKCiAYkRa29rd18Kv61B0gJ6cLB6yNWWJh/zGtzp7jIXTPc0FF8uxlNZJDD9JTArFJYfsB+Sv24JJ7VEiTSs426hkxQhIwGxrB52hEkLlRZyjhAWRWarMIqqSBcs6fApVNZ/HzEgIsIB4arU59VOh4QL5fTbAiMBM6K+xbaSUnG3V89C55+6A== 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; bh=eBC+QpROCscMiwdQPyx9W6eXpaZyeZaKRmaQ5Tn0IrE=; b=e27xYN1Xtk/fDnxiMCuWxmzzhP+/wptfrI9nD1MlJH+ffivtRlV7emV05mSs95XrFmf5b2z7LzZ1wMOT9RJu3Xzj8PDFEeQcQ1qZK72srb6nB75P2KOmFo/MC95+pPUHQ0TcGPi1iq7BxMDe63RPDEXdg3Wyo1nTTFjNyNdF19sjH2ZkUgtmMOMIg9gZRgXK1Dfwf0ZjeYCDubdLXAXgF9tw9+L3fQ8M6Hd2IDIdY5re97ASSB23KidlORtAdWz3UWblvekySv1j1H8/a0n50ntbh1DhCTK5SHKOPQ9QGT7lJ6ImFrsUDKPLHjxPjAuVCPH8nSGxMIbLmsAKyxZ2Xg== 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=hotmail.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=eBC+QpROCscMiwdQPyx9W6eXpaZyeZaKRmaQ5Tn0IrE=; b=qq1wyM9Ho9wliOkeeqnyNu6f0gcVAHpHqipoM2wzxQ63CndOOdUs4iP2WB+MT6msbD48OoKTB7RwiBKvE31gcKHGOaxpXjKkdByti0qgmQKFzwxXGGJFHocrGGoXeSeufcgDMhsno6Y4Gz19Hks+JgM6yKkVAxLNh07rcrTQgaDVpZl6XYvmVzuWVFJlBKdd96XHJ9KsPmTiof1bQWpLV9rMWFkBz5Cja9YZDjpslIS5Q5RX70OrFhy902rjq62qD7ko2CNUYHJcO9IjS6mqDs2cbxPMdkVvrIpSjZpMbQ8E/EIL68qzh9f9lMWOtqx6fDb3+5bVumVSutd8pZ4qVw== Received: from MN2PR04MB5981.namprd04.prod.outlook.com (2603:10b6:208:da::10) by MN2PR04MB6048.namprd04.prod.outlook.com (2603:10b6:208:e5::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4500.16; Sat, 11 Sep 2021 08:15:14 +0000 Received: from MN2PR04MB5981.namprd04.prod.outlook.com ([fe80::ecfe:2528:2012:22cb]) by MN2PR04MB5981.namprd04.prod.outlook.com ([fe80::ecfe:2528:2012:22cb%5]) with mapi id 15.20.4500.018; Sat, 11 Sep 2021 08:15:14 +0000 From: Soft Works To: "ffmpeg-devel@ffmpeg.org" Thread-Topic: [PATCH v4 03/18] avcodec/avcodec: Remove AVSubtitleType, AVSubtitle and AVSubtitleRect from avcodec Thread-Index: AdemwYDET5VOomxFS1i7sZMIFeVY2A== Date: Sat, 11 Sep 2021 08:15:14 +0000 Message-ID: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-exchange-messagesentrepresentingtype: 1 x-tmn: [3uNyweGdNRXxfvY5J0r6DD3jzrITl7mFfwNWWvPNxh8=] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 6e2fbb55-8693-48b9-dd31-08d974fc488b x-ms-traffictypediagnostic: MN2PR04MB6048: x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: olS6N1mt4Z5n6fgAPn3gYd6fvmRFar5DXo8LoDgs2W/uQmH5GPd74iK23BBRX7Lbiz7Pv1pCskeA93CpZwoE/8g65JfmyNvcQsSF8KpCFL3/KYiWrxD8PHfd8v/X9v9slZ3OcYwCezdFagf8d08V2Eqjp/zlSt68CPA94od9gbEXd3BG/OfmK4VnsI/jzt6f4nD7s+SmNmVnhiItBfqp47AbWOZatB+Md8l6YBhLsl+srub4weq3EyHOKfXwtYrre497PB3xNwZgsqbWYeKQdN82/l4AXp3EowQFf/vVwqAG5F3wYkJMPlaY+EmkBL8EZBA4WXgMEduiMnfw9OvTDwUs5A2IvVhsIxZCh36hW1EwC5r14U35aXU8hen3B3iytj1XUK9ykyh0Ojl/ld0IRLZi/kOV15aaJU/xVFreDNd83yg5UiA+dafl1rNx+t5g x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: z7O6hNpQTuPr3ynJqLBNT0wPtY3r//wL0LtMv8x3ns3MUCg52P3jLCOBpSz5j/Qi+7mnmixE9Z5n+uIa2BNtW+fYUQZBBn0wGuI/F2GeD20hQhFAK1RfyScPv5LYwuXfAnWXaqJzvj/jH1F/O9IfrQ== x-ms-exchange-transport-forked: True MIME-Version: 1.0 X-OriginatorOrg: sct-15-20-3174-20-msonline-outlook-529c7.templateTenant X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: MN2PR04MB5981.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-CrossTenant-Network-Message-Id: 6e2fbb55-8693-48b9-dd31-08d974fc488b X-MS-Exchange-CrossTenant-originalarrivaltime: 11 Sep 2021 08:15:14.6812 (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: MN2PR04MB6048 Subject: [FFmpeg-devel] [PATCH v4 03/18] avcodec/avcodec: Remove AVSubtitleType, AVSubtitle and AVSubtitleRect from avcodec 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: TzW/n5IKe1IA Moved to libavutil/subfmt, include subfmt.h from avcodec.h Signed-off-by: softworkz --- libavcodec/ass.c | 2 +- libavcodec/ass.h | 6 +-- libavcodec/assdec.c | 2 +- libavcodec/assenc.c | 4 +- libavcodec/avcodec.c | 19 ---------- libavcodec/avcodec.h | 65 +------------------------------- libavcodec/dvbsubdec.c | 2 +- libavcodec/dvdsubdec.c | 2 +- libavcodec/dvdsubenc.c | 2 +- libavcodec/libzvbi-teletextdec.c | 14 +++---- libavcodec/movtextenc.c | 4 +- libavcodec/pgssubdec.c | 4 +- libavcodec/srtenc.c | 4 +- libavcodec/ttmlenc.c | 4 +- libavcodec/webvttenc.c | 4 +- libavcodec/xsubdec.c | 2 +- 16 files changed, 30 insertions(+), 110 deletions(-) diff --git a/libavcodec/ass.c b/libavcodec/ass.c index 907e2d7b88..fe8150d559 100644 --- a/libavcodec/ass.c +++ b/libavcodec/ass.c @@ -128,7 +128,7 @@ int ff_ass_add_rect(AVSubtitle *sub, const char *dialog, rects[sub->num_rects] = av_mallocz(sizeof(*rects[0])); if (!rects[sub->num_rects]) return AVERROR(ENOMEM); - rects[sub->num_rects]->type = SUBTITLE_ASS; + rects[sub->num_rects]->type = AV_SUBTITLE_FMT_ASS; ass_str = ff_ass_get_dialog(readorder, layer, style, speaker, dialog); if (!ass_str) return AVERROR(ENOMEM); diff --git a/libavcodec/ass.h b/libavcodec/ass.h index 2c260e4e78..e9d49628cc 100644 --- a/libavcodec/ass.h +++ b/libavcodec/ass.h @@ -48,7 +48,7 @@ typedef struct FFASSDecoderContext { } FFASSDecoderContext; /** - * Generate a suitable AVCodecContext.subtitle_header for SUBTITLE_ASS. + * Generate a suitable AVCodecContext.subtitle_header for AV_SUBTITLE_FMT_ASS. * Can specify all fields explicitly * * @param avctx pointer to the AVCodecContext @@ -76,7 +76,7 @@ int ff_ass_subtitle_header_full(AVCodecContext *avctx, int bold, int italic, int underline, int border_style, int alignment); /** - * Generate a suitable AVCodecContext.subtitle_header for SUBTITLE_ASS. + * Generate a suitable AVCodecContext.subtitle_header for AV_SUBTITLE_FMT_ASS. * * @param avctx pointer to the AVCodecContext * @param font name of the default font face to use @@ -97,7 +97,7 @@ int ff_ass_subtitle_header(AVCodecContext *avctx, int border_style, int alignment); /** - * Generate a suitable AVCodecContext.subtitle_header for SUBTITLE_ASS + * Generate a suitable AVCodecContext.subtitle_header for AV_SUBTITLE_FMT_ASS * with default style. * * @param avctx pointer to the AVCodecContext diff --git a/libavcodec/assdec.c b/libavcodec/assdec.c index 319279490c..fd80436eb2 100644 --- a/libavcodec/assdec.c +++ b/libavcodec/assdec.c @@ -54,7 +54,7 @@ static int ass_decode_frame(AVCodecContext *avctx, void *data, int *got_sub_ptr, if (!sub->rects[0]) return AVERROR(ENOMEM); sub->num_rects = 1; - sub->rects[0]->type = SUBTITLE_ASS; + sub->rects[0]->type = AV_SUBTITLE_FMT_ASS; sub->rects[0]->ass = av_strdup(avpkt->data); if (!sub->rects[0]->ass) return AVERROR(ENOMEM); diff --git a/libavcodec/assenc.c b/libavcodec/assenc.c index a6d107ded2..0e78414adb 100644 --- a/libavcodec/assenc.c +++ b/libavcodec/assenc.c @@ -48,8 +48,8 @@ static int ass_encode_frame(AVCodecContext *avctx, for (i=0; inum_rects; i++) { const char *ass = sub->rects[i]->ass; - if (sub->rects[i]->type != SUBTITLE_ASS) { - av_log(avctx, AV_LOG_ERROR, "Only SUBTITLE_ASS type supported.\n"); + if (sub->rects[i]->type != AV_SUBTITLE_FMT_ASS) { + av_log(avctx, AV_LOG_ERROR, "Only AV_SUBTITLE_FMT_ASS type supported.\n"); return AVERROR(EINVAL); } diff --git a/libavcodec/avcodec.c b/libavcodec/avcodec.c index 2dd7dd84e0..963f52c4bd 100644 --- a/libavcodec/avcodec.c +++ b/libavcodec/avcodec.c @@ -426,25 +426,6 @@ void avcodec_flush_buffers(AVCodecContext *avctx) av_bsf_flush(avci->bsf); } -void avsubtitle_free(AVSubtitle *sub) -{ - int i; - - for (i = 0; i < sub->num_rects; i++) { - av_freep(&sub->rects[i]->data[0]); - av_freep(&sub->rects[i]->data[1]); - av_freep(&sub->rects[i]->data[2]); - av_freep(&sub->rects[i]->data[3]); - av_freep(&sub->rects[i]->text); - av_freep(&sub->rects[i]->ass); - av_freep(&sub->rects[i]); - } - - av_freep(&sub->rects); - - memset(sub, 0, sizeof(*sub)); -} - av_cold int avcodec_close(AVCodecContext *avctx) { int i; diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h index ffd58c333f..b459c23ac7 100644 --- a/libavcodec/avcodec.h +++ b/libavcodec/avcodec.h @@ -35,6 +35,7 @@ #include "libavutil/frame.h" #include "libavutil/log.h" #include "libavutil/pixfmt.h" +#include "libavutil/subfmt.h" #include "libavutil/rational.h" #include "codec.h" @@ -1670,7 +1671,7 @@ typedef struct AVCodecContext { /** * Header containing style information for text subtitles. - * For SUBTITLE_ASS subtitle type, it should contain the whole ASS + * For AV_SUBTITLE_FMT_ASS subtitle type, it should contain the whole ASS * [Script Info] and [V4+ Styles] section, plus the [Events] line and * the Format line following. It shouldn't include any Dialogue line. * - encoding: Set/allocated/freed by user (before avcodec_open2()) @@ -2233,63 +2234,8 @@ typedef struct AVHWAccel { * @} */ -enum AVSubtitleType { - SUBTITLE_NONE, - - SUBTITLE_BITMAP, ///< A bitmap, pict will be set - - /** - * Plain text, the text field must be set by the decoder and is - * authoritative. ass and pict fields may contain approximations. - */ - SUBTITLE_TEXT, - - /** - * Formatted text, the ass field must be set by the decoder and is - * authoritative. pict and text fields may contain approximations. - */ - SUBTITLE_ASS, -}; - #define AV_SUBTITLE_FLAG_FORCED 0x00000001 -typedef struct AVSubtitleRect { - int x; ///< top left corner of pict, undefined when pict is not set - int y; ///< top left corner of pict, undefined when pict is not set - int w; ///< width of pict, undefined when pict is not set - int h; ///< height of pict, undefined when pict is not set - int nb_colors; ///< number of colors in pict, undefined when pict is not set - - /** - * data+linesize for the bitmap of this subtitle. - * Can be set for text/ass as well once they are rendered. - */ - uint8_t *data[4]; - int linesize[4]; - - enum AVSubtitleType type; - - char *text; ///< 0 terminated plain UTF-8 text - - /** - * 0 terminated ASS/SSA compatible event line. - * The presentation of this is unaffected by the other values in this - * struct. - */ - char *ass; - - int flags; -} AVSubtitleRect; - -typedef struct AVSubtitle { - uint16_t format; /* 0 = graphics */ - uint32_t start_display_time; /* relative to packet pts, in ms */ - uint32_t end_display_time; /* relative to packet pts, in ms */ - unsigned num_rects; - AVSubtitleRect **rects; - int64_t pts; ///< Same as packet pts, in AV_TIME_BASE -} AVSubtitle; - /** * Return the LIBAVCODEC_VERSION_INT constant. */ @@ -2425,13 +2371,6 @@ int avcodec_open2(AVCodecContext *avctx, const AVCodec *codec, AVDictionary **op */ int avcodec_close(AVCodecContext *avctx); -/** - * Free all allocated data in the given subtitle struct. - * - * @param sub AVSubtitle to free. - */ -void avsubtitle_free(AVSubtitle *sub); - /** * @} */ diff --git a/libavcodec/dvbsubdec.c b/libavcodec/dvbsubdec.c index e45c14e878..1e13d784bb 100644 --- a/libavcodec/dvbsubdec.c +++ b/libavcodec/dvbsubdec.c @@ -795,7 +795,7 @@ static int save_subtitle_set(AVCodecContext *avctx, AVSubtitle *sub, int *got_ou rect->w = region->width; rect->h = region->height; rect->nb_colors = (1 << region->depth); - rect->type = SUBTITLE_BITMAP; + rect->type = AV_SUBTITLE_FMT_BITMAP; rect->linesize[0] = region->width; clut = get_clut(ctx, region->clut); diff --git a/libavcodec/dvdsubdec.c b/libavcodec/dvdsubdec.c index 52259f0730..b39b3d1838 100644 --- a/libavcodec/dvdsubdec.c +++ b/libavcodec/dvdsubdec.c @@ -406,7 +406,7 @@ static int decode_dvd_subtitles(DVDSubContext *ctx, AVSubtitle *sub_header, sub_header->rects[0]->y = y1; sub_header->rects[0]->w = w; sub_header->rects[0]->h = h; - sub_header->rects[0]->type = SUBTITLE_BITMAP; + sub_header->rects[0]->type = AV_SUBTITLE_FMT_BITMAP; sub_header->rects[0]->linesize[0] = w; sub_header->rects[0]->flags = is_menu ? AV_SUBTITLE_FLAG_FORCED : 0; } diff --git a/libavcodec/dvdsubenc.c b/libavcodec/dvdsubenc.c index ff4fbed39d..943a7466d9 100644 --- a/libavcodec/dvdsubenc.c +++ b/libavcodec/dvdsubenc.c @@ -268,7 +268,7 @@ static int encode_dvd_subtitles(AVCodecContext *avctx, if (rects == 0 || !h->rects) return AVERROR(EINVAL); for (i = 0; i < rects; i++) - if (h->rects[i]->type != SUBTITLE_BITMAP) { + if (h->rects[i]->type != AV_SUBTITLE_FMT_BITMAP) { av_log(avctx, AV_LOG_ERROR, "Bitmap subtitle required\n"); return AVERROR(EINVAL); } diff --git a/libavcodec/libzvbi-teletextdec.c b/libavcodec/libzvbi-teletextdec.c index 1073d6a0bd..995648c9ec 100644 --- a/libavcodec/libzvbi-teletextdec.c +++ b/libavcodec/libzvbi-teletextdec.c @@ -215,7 +215,7 @@ static int gen_sub_text(TeletextContext *ctx, AVSubtitleRect *sub_rect, vbi_page } if (buf.len) { - sub_rect->type = SUBTITLE_ASS; + sub_rect->type = AV_SUBTITLE_FMT_ASS; sub_rect->ass = create_ass_text(ctx, buf.str); if (!sub_rect->ass) { @@ -224,7 +224,7 @@ static int gen_sub_text(TeletextContext *ctx, AVSubtitleRect *sub_rect, vbi_page } av_log(ctx, AV_LOG_DEBUG, "subtext:%s:txetbus\n", sub_rect->ass); } else { - sub_rect->type = SUBTITLE_NONE; + sub_rect->type = AV_SUBTITLE_FMT_NONE; } av_bprint_finalize(&buf, NULL); return 0; @@ -393,7 +393,7 @@ static int gen_sub_ass(TeletextContext *ctx, AVSubtitleRect *sub_rect, vbi_page } if (buf.len) { - sub_rect->type = SUBTITLE_ASS; + sub_rect->type = AV_SUBTITLE_FMT_ASS; sub_rect->ass = ff_ass_get_dialog(ctx->readorder++, 0, is_subtitle_page ? "Subtitle" : "Teletext", NULL, buf.str); if (!sub_rect->ass) { @@ -402,7 +402,7 @@ static int gen_sub_ass(TeletextContext *ctx, AVSubtitleRect *sub_rect, vbi_page } av_log(ctx, AV_LOG_DEBUG, "subtext:%s:txetbus\n", sub_rect->ass); } else { - sub_rect->type = SUBTITLE_NONE; + sub_rect->type = AV_SUBTITLE_FMT_NONE; } av_bprint_finalize(&buf, NULL); return 0; @@ -462,7 +462,7 @@ static int gen_sub_bitmap(TeletextContext *ctx, AVSubtitleRect *sub_rect, vbi_pa if (vc >= vcend) { av_log(ctx, AV_LOG_DEBUG, "dropping empty page %3x\n", page->pgno); - sub_rect->type = SUBTITLE_NONE; + sub_rect->type = AV_SUBTITLE_FMT_NONE; return 0; } @@ -500,7 +500,7 @@ static int gen_sub_bitmap(TeletextContext *ctx, AVSubtitleRect *sub_rect, vbi_pa } ((uint32_t *)sub_rect->data[1])[VBI_TRANSPARENT_BLACK] = RGBA(0, 0, 0, 0); ((uint32_t *)sub_rect->data[1])[VBI_TRANSPARENT_BLACK + VBI_NB_COLORS] = RGBA(0, 0, 0, 0); - sub_rect->type = SUBTITLE_BITMAP; + sub_rect->type = AV_SUBTITLE_FMT_BITMAP; return 0; } @@ -695,7 +695,7 @@ static int teletext_decode_frame(AVCodecContext *avctx, void *data, int *got_sub sub->num_rects = 0; sub->pts = ctx->pages->pts; - if (ctx->pages->sub_rect->type != SUBTITLE_NONE) { + if (ctx->pages->sub_rect->type != AV_SUBTITLE_FMT_NONE) { sub->rects = av_malloc(sizeof(*sub->rects)); if (sub->rects) { sub->num_rects = 1; diff --git a/libavcodec/movtextenc.c b/libavcodec/movtextenc.c index 2ae5a9bf0b..a4a963a9f2 100644 --- a/libavcodec/movtextenc.c +++ b/libavcodec/movtextenc.c @@ -649,8 +649,8 @@ static int mov_text_encode_frame(AVCodecContext *avctx, unsigned char *buf, for (i = 0; i < sub->num_rects; i++) { const char *ass = sub->rects[i]->ass; - if (sub->rects[i]->type != SUBTITLE_ASS) { - av_log(avctx, AV_LOG_ERROR, "Only SUBTITLE_ASS type supported.\n"); + if (sub->rects[i]->type != AV_SUBTITLE_FMT_ASS) { + av_log(avctx, AV_LOG_ERROR, "Only AV_SUBTITLE_FMT_ASS type supported.\n"); return AVERROR(EINVAL); } diff --git a/libavcodec/pgssubdec.c b/libavcodec/pgssubdec.c index 55eda4c2a9..ef4778cd1b 100644 --- a/libavcodec/pgssubdec.c +++ b/libavcodec/pgssubdec.c @@ -513,7 +513,7 @@ static int display_end_segment(AVCodecContext *avctx, void *data, // is defined by the start of the next sub which may contain no // objects (i.e. clears the previous sub) sub->end_display_time = UINT32_MAX; - sub->format = 0; + sub->format = AV_SUBTITLE_FMT_BITMAP; // Blank if last object_count was 0. if (!ctx->presentation.object_count) @@ -539,7 +539,7 @@ static int display_end_segment(AVCodecContext *avctx, void *data, return AVERROR(ENOMEM); } sub->num_rects++; - sub->rects[i]->type = SUBTITLE_BITMAP; + sub->rects[i]->type = AV_SUBTITLE_FMT_BITMAP; /* Process bitmap */ object = find_object(ctx->presentation.objects[i].id, &ctx->objects); diff --git a/libavcodec/srtenc.c b/libavcodec/srtenc.c index 2e3ac55770..9a550b9e23 100644 --- a/libavcodec/srtenc.c +++ b/libavcodec/srtenc.c @@ -240,8 +240,8 @@ static int encode_frame(AVCodecContext *avctx, for (i=0; inum_rects; i++) { const char *ass = sub->rects[i]->ass; - if (sub->rects[i]->type != SUBTITLE_ASS) { - av_log(avctx, AV_LOG_ERROR, "Only SUBTITLE_ASS type supported.\n"); + if (sub->rects[i]->type != AV_SUBTITLE_FMT_ASS) { + av_log(avctx, AV_LOG_ERROR, "Only AV_SUBTITLE_FMT_ASS type supported.\n"); return AVERROR(EINVAL); } diff --git a/libavcodec/ttmlenc.c b/libavcodec/ttmlenc.c index ad2eddfdd5..891b4f496f 100644 --- a/libavcodec/ttmlenc.c +++ b/libavcodec/ttmlenc.c @@ -90,8 +90,8 @@ static int ttml_encode_frame(AVCodecContext *avctx, uint8_t *buf, const char *ass = sub->rects[i]->ass; int ret; - if (sub->rects[i]->type != SUBTITLE_ASS) { - av_log(avctx, AV_LOG_ERROR, "Only SUBTITLE_ASS type supported.\n"); + if (sub->rects[i]->type != AV_SUBTITLE_FMT_ASS) { + av_log(avctx, AV_LOG_ERROR, "Only AV_SUBTITLE_FMT_ASS type supported.\n"); return AVERROR(EINVAL); } diff --git a/libavcodec/webvttenc.c b/libavcodec/webvttenc.c index 89b49e42bf..23ad6c32d3 100644 --- a/libavcodec/webvttenc.c +++ b/libavcodec/webvttenc.c @@ -167,8 +167,8 @@ static int webvtt_encode_frame(AVCodecContext *avctx, for (i=0; inum_rects; i++) { const char *ass = sub->rects[i]->ass; - if (sub->rects[i]->type != SUBTITLE_ASS) { - av_log(avctx, AV_LOG_ERROR, "Only SUBTITLE_ASS type supported.\n"); + if (sub->rects[i]->type != AV_SUBTITLE_FMT_ASS) { + av_log(avctx, AV_LOG_ERROR, "Only AV_SUBTITLE_FMT_ASS type supported.\n"); return AVERROR(EINVAL); } diff --git a/libavcodec/xsubdec.c b/libavcodec/xsubdec.c index 979399bae6..5c9e65f737 100644 --- a/libavcodec/xsubdec.c +++ b/libavcodec/xsubdec.c @@ -107,7 +107,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_sub_ptr, } sub->rects[0]->x = x; sub->rects[0]->y = y; sub->rects[0]->w = w; sub->rects[0]->h = h; - sub->rects[0]->type = SUBTITLE_BITMAP; + sub->rects[0]->type = AV_SUBTITLE_FMT_BITMAP; sub->rects[0]->linesize[0] = w; sub->rects[0]->data[0] = av_malloc(w * h); sub->rects[0]->nb_colors = 4;