From patchwork Sat Sep 11 06:02:42 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Soft Works X-Patchwork-Id: 30123 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6602:2a4a:0:0:0:0 with SMTP id k10csp2167527iov; Fri, 10 Sep 2021 23:03:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz8FQfwy5yUOylESP47S5/r1iilB1x0+M4JOSAP3zCYeWnsAYNIFGTsQzz79mWjm5/25ztt X-Received: by 2002:a17:907:7697:: with SMTP id jv23mr1383467ejc.451.1631340235850; Fri, 10 Sep 2021 23:03:55 -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 v11si1321305ejf.205.2021.09.10.23.03.55; Fri, 10 Sep 2021 23:03:55 -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=HScZmeJC; 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 2FC0E68A126; Sat, 11 Sep 2021 09:03:04 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12olkn2093.outbound.protection.outlook.com [40.92.23.93]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 32DAA6804A0 for ; Sat, 11 Sep 2021 09:02:56 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=it7FPqYs8k7lcBkJxhgxPAGITUK5MLmZZAo4XwM/AUQDVD9pzUmFYVo7TGDIvsB+Umr5AGKErTRqvSRZRRBPUetqPbOCjUuEtmYbByh6EmosjfV2MeqTPL9SAeh6xrxW/4yos0JqmRZJzdW3+Fwayt8ZbXFCr0KiwRWOLJq6iigYsCAA9MK7MX15EBTXP/jg0Bjuj/GtSWZhfpBg+sMUSpy9Nyuli8ixmwqj2+n6e1AxH3nxzg9DShzRhUp6CIF0ulpJlL8e+jMtjM1OU1YBLImkW9yWrjS8r/BBkIe1YwXa7nxwguV5khPky/qFnV+YV/hGBrchOyCwQxew5ITsPQ== 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=lMaTGMN8WfX+661jLe/MzHNpLj1IPgeS+nQtvfR8lAr5071Shb85NHLZHSnG6XGYnI6BoTRw6nIRx3bPMkVCEYBFzOifFEgutBErmMGrFZS9QFeovcMKJ5o3pRiolecwNCRAR6L1Hj3+kbMpfPjVau1n7chZkenkNuVQ+sbvPxFstahjlOt6zQF/KockBEndFg/Xekw1Zka78974HOvaLGhwSzkQoxfJneEpEkLtbxFe+gyWAkKalZCcOPSe68RrKmpbngDEeHVdwC9KBGy4M5gbXuU+fDMt15KDibtjUIWMty5DueyWvXoKUoKJkFBXH++apL82KbrmuOfLiruS3w== 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=HScZmeJCFxvY3DkgAQ8upheL5C2noyV/i1uZ5HvhcxjE+u8rIzsrx5/Psd5mMXMhX1jucc7BNVxy1RA6R5Yre4rJnD8Tq9IdTM3z7i82Eu62wLL8NbLb8BFJBf868GjBLq58u5fsGrSAdVpvMqPEjaq27FkY4IcpoKKQh+PiC5JLiL9+EG1iMqLtf+SOIdIWw7vR2Ds5iFQEYRwdxkM+3YRgoFBi1px7Dyi2Qm/eh7RvUEmiAkC38fTIAncToYc+27+pX5tPWtZOI44J80jSwGQrzJoK75mnZOu2aPwYGqR/mMBT2o9zpgAik0OZX2OZg/LkYWRxZJZUxDtNcxy1wQ== Received: from MN2PR04MB5981.namprd04.prod.outlook.com (2603:10b6:208:da::10) by MN2PR04MB5629.namprd04.prod.outlook.com (2603:10b6:208:a6::23) 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 06:02:42 +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 06:02:42 +0000 From: Soft Works To: "ffmpeg-devel@ffmpeg.org" Thread-Topic: [PATCH v3 03/18] avcodec/avcodec: Remove AVSubtitleType, AVSubtitle and AVSubtitleRect from avcodec Thread-Index: AdemwYDET2/nJO2uTHOyc1gzt1TYXQ== Date: Sat, 11 Sep 2021 06:02:42 +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: [ulBEgLwsI/LVMl3xWVwsctduSCD9d8XUd3nC7wkxeJQ=] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 921bad05-fef1-4e59-0b70-08d974e9c499 x-ms-traffictypediagnostic: MN2PR04MB5629: x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: 64hiPQN13tn9MtSkUIpBMZCKIRQ3sq7d993lDhfTSrVhmN+08RPxAH8NySflg0F8neBK/DRP/FJJtw/qTSS2Q+EV6GSrzoSn8NfQlw+DMy8pJLlVsU+tkXnKWdRZtX1Zxeb6B/9ZPZOtzcG85inJDsV8ivd7lGPHhyLfdzpWaniiKocYmGBKbXi1xgjLZgpmk+zIAgZ+8pmaWEdzvwC4dBokUe0wc1unDbcdxnUu22Bdj8n8e29L++gT+mTzRscfgGpQ5PGuViD5KjyrHoP2rc3dukRAkE8mtdrSCQIm/InJS/GcHTuurN0+uj61l8oXyvr+Flufwhh0p4HzqLfqcd5xelyf20ULYlsb4WWVsE8Z4ZIkdH23HtNjOlf7t8NsTEzgKPUbSF+jwMQDS1t1TaQ9a/L+KdeXgY5+WMYWdgIv7Km9jia5kldCEFKQF6US x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: c5gFivrhBkRYTBBRESigtvqQ5LHe5ss3ACvbgUX2Iv6b773RmIdT4JQDWT3+v1/WfFI4P3oVO0ayP4kNCrUzFn16ona5czLnbAv/PgaqjO6Pww1h4K9v7s86ss6LiL3gT9/c2stqjhUkjUzhBdc42g== 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: 921bad05-fef1-4e59-0b70-08d974e9c499 X-MS-Exchange-CrossTenant-originalarrivaltime: 11 Sep 2021 06:02:42.3542 (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: MN2PR04MB5629 Subject: [FFmpeg-devel] [PATCH v3 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: 4dWdxrMhPA0W 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;