summaryrefslogtreecommitdiffstats
path: root/sub
diff options
context:
space:
mode:
authorNiklas Haas <git@haasn.dev>2022-01-11 21:03:27 +0100
committerJan Ekström <jeebjp@gmail.com>2022-01-11 23:45:08 +0200
commit9e2c0b8baa3f9ccba997129a1c1023f61611e4dd (patch)
treefff3693f77deeef422f91fb817c028ef54f76e63 /sub
parent429402cb087f3a052cb9645af1e42156fd413c6c (diff)
downloadmpv-9e2c0b8baa3f9ccba997129a1c1023f61611e4dd.tar.bz2
mpv-9e2c0b8baa3f9ccba997129a1c1023f61611e4dd.tar.xz
sub: rename SUBBITMAP_RGBA to SUBBITMAP_BGRA
This was a misnomer, the actual channel order is IMGFMT_BGRA (as the comment explicitly point out). Rename the enum for consistency.
Diffstat (limited to 'sub')
-rw-r--r--sub/ass_mp.c6
-rw-r--r--sub/draw_bmp.c8
-rw-r--r--sub/osd.c2
-rw-r--r--sub/osd.h8
-rw-r--r--sub/sd_lavc.c2
5 files changed, 13 insertions, 13 deletions
diff --git a/sub/ass_mp.c b/sub/ass_mp.c
index 45328fb920..8d0ab96e7d 100644
--- a/sub/ass_mp.c
+++ b/sub/ass_mp.c
@@ -285,7 +285,7 @@ static bool pack_rgba(struct mp_ass_packer *p, struct sub_bitmaps *res)
struct sub_bitmaps imgs = {
.change_id = res->change_id,
- .format = SUBBITMAP_RGBA,
+ .format = SUBBITMAP_BGRA,
.parts = p->rgba_imgs,
.num_parts = num_bb,
};
@@ -341,7 +341,7 @@ void mp_ass_packer_pack(struct mp_ass_packer *p, ASS_Image **image_lists,
int num_image_lists, bool image_lists_changed,
int preferred_osd_format, struct sub_bitmaps *out)
{
- int format = preferred_osd_format == SUBBITMAP_RGBA ? SUBBITMAP_RGBA
+ int format = preferred_osd_format == SUBBITMAP_BGRA ? SUBBITMAP_BGRA
: SUBBITMAP_LIBASS;
if (p->cached_subs_valid && !image_lists_changed &&
@@ -379,7 +379,7 @@ void mp_ass_packer_pack(struct mp_ass_packer *p, ASS_Image **image_lists,
}
bool r = false;
- if (format == SUBBITMAP_RGBA) {
+ if (format == SUBBITMAP_BGRA) {
r = pack_rgba(p, &res);
} else {
r = pack_libass(p, &res);
diff --git a/sub/draw_bmp.c b/sub/draw_bmp.c
index f7f8982051..37e57a1991 100644
--- a/sub/draw_bmp.c
+++ b/sub/draw_bmp.c
@@ -32,7 +32,7 @@
const bool mp_draw_sub_formats[SUBBITMAP_COUNT] = {
[SUBBITMAP_LIBASS] = true,
- [SUBBITMAP_RGBA] = true,
+ [SUBBITMAP_BGRA] = true,
};
struct part {
@@ -84,7 +84,7 @@ struct mp_draw_sub_cache
struct mp_sws_context *alpha_to_calpha; // scaler for overlay -> calpha
bool scale_in_tiles;
- struct mp_sws_context *sub_scale; // scaler for SUBBITMAP_RGBA
+ struct mp_sws_context *sub_scale; // scaler for SUBBITMAP_BGRA
struct mp_repack *overlay_to_f32; // convert video_overlay to float
struct mp_image *overlay_tmp; // slice in float32
@@ -363,7 +363,7 @@ static void draw_rgba(uint8_t *dst, ptrdiff_t dst_stride,
static bool render_rgba(struct mp_draw_sub_cache *p, struct part *part,
struct sub_bitmaps *sb)
{
- assert(sb->format == SUBBITMAP_RGBA);
+ assert(sb->format == SUBBITMAP_BGRA);
if (part->change_id != sb->change_id) {
for (int n = 0; n < part->num_imgs; n++)
@@ -462,7 +462,7 @@ static bool render_sb(struct mp_draw_sub_cache *p, struct sub_bitmaps *sb)
case SUBBITMAP_LIBASS:
render_ass(p, sb);
return true;
- case SUBBITMAP_RGBA:
+ case SUBBITMAP_BGRA:
return render_rgba(p, part, sb);
}
diff --git a/sub/osd.c b/sub/osd.c
index b06fd242a3..e422716ada 100644
--- a/sub/osd.c
+++ b/sub/osd.c
@@ -284,7 +284,7 @@ static struct sub_bitmaps *render_object(struct osd_state *osd,
{
int format = SUBBITMAP_LIBASS;
if (!sub_formats[format] || osd->opts->force_rgba_osd)
- format = SUBBITMAP_RGBA;
+ format = SUBBITMAP_BGRA;
struct sub_bitmaps *res = NULL;
diff --git a/sub/osd.h b/sub/osd.h
index 9b680b8bf8..168f86320e 100644
--- a/sub/osd.h
+++ b/sub/osd.h
@@ -24,11 +24,11 @@
#include "options/m_option.h"
-// NOTE: VOs must support at least SUBBITMAP_RGBA.
+// NOTE: VOs must support at least SUBBITMAP_BGRA.
enum sub_bitmap_format {
SUBBITMAP_EMPTY = 0,// no bitmaps; always has num_parts==0
SUBBITMAP_LIBASS, // A8, with a per-surface blend color (libass.color)
- SUBBITMAP_RGBA, // IMGFMT_BGRA (MSB=A, LSB=B), scaled, premultiplied alpha
+ SUBBITMAP_BGRA, // IMGFMT_BGRA (MSB=A, LSB=B), scaled, premultiplied alpha
SUBBITMAP_COUNT
};
@@ -64,7 +64,7 @@ struct sub_bitmaps {
// Packed representation of the bitmap data. If non-NULL, then the
// parts[].bitmap pointer points into the image data here (and stride will
// correspond to packed->stride[0]).
- // SUBBITMAP_RGBA: IMGFMT_BGRA (exact match)
+ // SUBBITMAP_BGRA: IMGFMT_BGRA (exact match)
// SUBBITMAP_LIBASS: IMGFMT_Y8 (not the same, but compatible layout)
// Other formats have this set to NULL.
struct mp_image *packed;
@@ -82,7 +82,7 @@ struct sub_bitmap_list {
int64_t change_id;
// Bounding box for rendering. It's notable that SUBBITMAP_LIBASS images are
- // always within these bounds, while SUBBITMAP_RGBA is not necessarily.
+ // always within these bounds, while SUBBITMAP_BGRA is not necessarily.
int w, h;
// Sorted by sub_bitmaps.render_index. Unused parts are not in the array,
diff --git a/sub/sd_lavc.c b/sub/sd_lavc.c
index e8da942a76..ce0ef11a0a 100644
--- a/sub/sd_lavc.c
+++ b/sub/sd_lavc.c
@@ -433,7 +433,7 @@ static struct sub_bitmaps *get_bitmaps(struct sd *sd, struct mp_osd_res d,
res->packed = current->data;
res->packed_w = current->bound_w;
res->packed_h = current->bound_h;
- res->format = SUBBITMAP_RGBA;
+ res->format = SUBBITMAP_BGRA;
double video_par = 0;
if (priv->avctx->codec_id == AV_CODEC_ID_DVD_SUBTITLE &&