mirror of
https://github.com/mpv-player/mpv
synced 2025-01-24 16:43:28 +00:00
repack: handle endian in a more general way
Instead of applying this only to "regular" formats, do it with all formats. For some reason, some repackers still have their own endian code. These could probably be removed, but whatever.
This commit is contained in:
parent
7d755020f3
commit
b9069c9dbf
@ -948,12 +948,13 @@ static bool setup_format_ne(struct mp_repack *rp)
|
||||
return false;
|
||||
|
||||
// Endian swapping.
|
||||
if (rp->imgfmt_a != rp->imgfmt_user) {
|
||||
struct mp_regular_imgfmt ndesc;
|
||||
if (!mp_get_regular_imgfmt(&ndesc, rp->imgfmt_a) || ndesc.num_planes > 4)
|
||||
return false;
|
||||
rp->endian_size = ndesc.component_size;
|
||||
if (rp->endian_size != 2 && rp->endian_size != 4)
|
||||
if (rp->imgfmt_a != rp->imgfmt_user &&
|
||||
rp->imgfmt_a == mp_find_other_endian(rp->imgfmt_user))
|
||||
{
|
||||
struct mp_imgfmt_desc desc_a = mp_imgfmt_get_desc(rp->imgfmt_a);
|
||||
struct mp_imgfmt_desc desc_u = mp_imgfmt_get_desc(rp->imgfmt_user);
|
||||
rp->endian_size = 1 << desc_u.endian_shift;
|
||||
if (!desc_a.endian_shift && rp->endian_size != 2 && rp->endian_size != 4)
|
||||
return false;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user