avformat/mov: refactor to use avutil/uuid
This commit is contained in:
parent
7c2f029ede
commit
a2c1a439b3
@ -47,6 +47,7 @@
|
|||||||
#include "libavutil/spherical.h"
|
#include "libavutil/spherical.h"
|
||||||
#include "libavutil/stereo3d.h"
|
#include "libavutil/stereo3d.h"
|
||||||
#include "libavutil/timecode.h"
|
#include "libavutil/timecode.h"
|
||||||
|
#include "libavutil/uuid.h"
|
||||||
#include "libavcodec/ac3tab.h"
|
#include "libavcodec/ac3tab.h"
|
||||||
#include "libavcodec/flac.h"
|
#include "libavcodec/flac.h"
|
||||||
#include "libavcodec/hevc.h"
|
#include "libavcodec/hevc.h"
|
||||||
@ -5956,21 +5957,21 @@ static int mov_read_uuid(MOVContext *c, AVIOContext *pb, MOVAtom atom)
|
|||||||
AVStream *st;
|
AVStream *st;
|
||||||
MOVStreamContext *sc;
|
MOVStreamContext *sc;
|
||||||
int64_t ret;
|
int64_t ret;
|
||||||
uint8_t uuid[16];
|
AVUUID uuid;
|
||||||
static const uint8_t uuid_isml_manifest[] = {
|
static const AVUUID uuid_isml_manifest = {
|
||||||
0xa5, 0xd4, 0x0b, 0x30, 0xe8, 0x14, 0x11, 0xdd,
|
0xa5, 0xd4, 0x0b, 0x30, 0xe8, 0x14, 0x11, 0xdd,
|
||||||
0xba, 0x2f, 0x08, 0x00, 0x20, 0x0c, 0x9a, 0x66
|
0xba, 0x2f, 0x08, 0x00, 0x20, 0x0c, 0x9a, 0x66
|
||||||
};
|
};
|
||||||
static const uint8_t uuid_xmp[] = {
|
static const AVUUID uuid_xmp = {
|
||||||
0xbe, 0x7a, 0xcf, 0xcb, 0x97, 0xa9, 0x42, 0xe8,
|
0xbe, 0x7a, 0xcf, 0xcb, 0x97, 0xa9, 0x42, 0xe8,
|
||||||
0x9c, 0x71, 0x99, 0x94, 0x91, 0xe3, 0xaf, 0xac
|
0x9c, 0x71, 0x99, 0x94, 0x91, 0xe3, 0xaf, 0xac
|
||||||
};
|
};
|
||||||
static const uint8_t uuid_spherical[] = {
|
static const AVUUID uuid_spherical = {
|
||||||
0xff, 0xcc, 0x82, 0x63, 0xf8, 0x55, 0x4a, 0x93,
|
0xff, 0xcc, 0x82, 0x63, 0xf8, 0x55, 0x4a, 0x93,
|
||||||
0x88, 0x14, 0x58, 0x7a, 0x02, 0x52, 0x1f, 0xdd,
|
0x88, 0x14, 0x58, 0x7a, 0x02, 0x52, 0x1f, 0xdd,
|
||||||
};
|
};
|
||||||
|
|
||||||
if (atom.size < sizeof(uuid) || atom.size >= FFMIN(INT_MAX, SIZE_MAX))
|
if (atom.size < AV_UUID_LEN || atom.size >= FFMIN(INT_MAX, SIZE_MAX))
|
||||||
return AVERROR_INVALIDDATA;
|
return AVERROR_INVALIDDATA;
|
||||||
|
|
||||||
if (c->fc->nb_streams < 1)
|
if (c->fc->nb_streams < 1)
|
||||||
@ -5978,13 +5979,13 @@ static int mov_read_uuid(MOVContext *c, AVIOContext *pb, MOVAtom atom)
|
|||||||
st = c->fc->streams[c->fc->nb_streams - 1];
|
st = c->fc->streams[c->fc->nb_streams - 1];
|
||||||
sc = st->priv_data;
|
sc = st->priv_data;
|
||||||
|
|
||||||
ret = ffio_read_size(pb, uuid, sizeof(uuid));
|
ret = ffio_read_size(pb, uuid, AV_UUID_LEN);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
return ret;
|
return ret;
|
||||||
if (!memcmp(uuid, uuid_isml_manifest, sizeof(uuid))) {
|
if (av_uuid_equal(uuid, uuid_isml_manifest)) {
|
||||||
uint8_t *buffer, *ptr;
|
uint8_t *buffer, *ptr;
|
||||||
char *endptr;
|
char *endptr;
|
||||||
size_t len = atom.size - sizeof(uuid);
|
size_t len = atom.size - AV_UUID_LEN;
|
||||||
|
|
||||||
if (len < 4) {
|
if (len < 4) {
|
||||||
return AVERROR_INVALIDDATA;
|
return AVERROR_INVALIDDATA;
|
||||||
@ -6022,9 +6023,9 @@ static int mov_read_uuid(MOVContext *c, AVIOContext *pb, MOVAtom atom)
|
|||||||
}
|
}
|
||||||
|
|
||||||
av_free(buffer);
|
av_free(buffer);
|
||||||
} else if (!memcmp(uuid, uuid_xmp, sizeof(uuid))) {
|
} else if (av_uuid_equal(uuid, uuid_xmp)) {
|
||||||
uint8_t *buffer;
|
uint8_t *buffer;
|
||||||
size_t len = atom.size - sizeof(uuid);
|
size_t len = atom.size - AV_UUID_LEN;
|
||||||
if (c->export_xmp) {
|
if (c->export_xmp) {
|
||||||
buffer = av_mallocz(len + 1);
|
buffer = av_mallocz(len + 1);
|
||||||
if (!buffer) {
|
if (!buffer) {
|
||||||
@ -6044,8 +6045,8 @@ static int mov_read_uuid(MOVContext *c, AVIOContext *pb, MOVAtom atom)
|
|||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
} else if (!memcmp(uuid, uuid_spherical, sizeof(uuid))) {
|
} else if (av_uuid_equal(uuid, uuid_spherical)) {
|
||||||
size_t len = atom.size - sizeof(uuid);
|
size_t len = atom.size - AV_UUID_LEN;
|
||||||
ret = mov_parse_uuid_spherical(sc, pb, len);
|
ret = mov_parse_uuid_spherical(sc, pb, len);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -57,6 +57,7 @@
|
|||||||
#include "libavutil/timecode.h"
|
#include "libavutil/timecode.h"
|
||||||
#include "libavutil/dovi_meta.h"
|
#include "libavutil/dovi_meta.h"
|
||||||
#include "libavutil/color_utils.h"
|
#include "libavutil/color_utils.h"
|
||||||
|
#include "libavutil/uuid.h"
|
||||||
#include "hevc.h"
|
#include "hevc.h"
|
||||||
#include "rtpenc.h"
|
#include "rtpenc.h"
|
||||||
#include "mov_chan.h"
|
#include "mov_chan.h"
|
||||||
@ -4487,14 +4488,14 @@ static int mov_write_isml_manifest(AVIOContext *pb, MOVMuxContext *mov, AVFormat
|
|||||||
int64_t pos = avio_tell(pb);
|
int64_t pos = avio_tell(pb);
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
static const uint8_t uuid[] = {
|
static const AVUUID uuid = {
|
||||||
0xa5, 0xd4, 0x0b, 0x30, 0xe8, 0x14, 0x11, 0xdd,
|
0xa5, 0xd4, 0x0b, 0x30, 0xe8, 0x14, 0x11, 0xdd,
|
||||||
0xba, 0x2f, 0x08, 0x00, 0x20, 0x0c, 0x9a, 0x66
|
0xba, 0x2f, 0x08, 0x00, 0x20, 0x0c, 0x9a, 0x66
|
||||||
};
|
};
|
||||||
|
|
||||||
avio_wb32(pb, 0);
|
avio_wb32(pb, 0);
|
||||||
ffio_wfourcc(pb, "uuid");
|
ffio_wfourcc(pb, "uuid");
|
||||||
avio_write(pb, uuid, sizeof(uuid));
|
avio_write(pb, uuid, AV_UUID_LEN);
|
||||||
avio_wb32(pb, 0);
|
avio_wb32(pb, 0);
|
||||||
|
|
||||||
avio_printf(pb, "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n");
|
avio_printf(pb, "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n");
|
||||||
@ -4753,7 +4754,7 @@ static int mov_write_tfxd_tag(AVIOContext *pb, MOVTrack *track)
|
|||||||
|
|
||||||
avio_wb32(pb, 0); /* size placeholder */
|
avio_wb32(pb, 0); /* size placeholder */
|
||||||
ffio_wfourcc(pb, "uuid");
|
ffio_wfourcc(pb, "uuid");
|
||||||
avio_write(pb, uuid, sizeof(uuid));
|
avio_write(pb, uuid, AV_UUID_LEN);
|
||||||
avio_w8(pb, 1);
|
avio_w8(pb, 1);
|
||||||
avio_wb24(pb, 0);
|
avio_wb24(pb, 0);
|
||||||
avio_wb64(pb, track->cluster[0].dts + track->cluster[0].cts);
|
avio_wb64(pb, track->cluster[0].dts + track->cluster[0].cts);
|
||||||
@ -4779,7 +4780,7 @@ static int mov_write_tfrf_tag(AVIOContext *pb, MOVMuxContext *mov,
|
|||||||
avio_seek(pb, track->frag_info[entry].tfrf_offset, SEEK_SET);
|
avio_seek(pb, track->frag_info[entry].tfrf_offset, SEEK_SET);
|
||||||
avio_wb32(pb, size);
|
avio_wb32(pb, size);
|
||||||
ffio_wfourcc(pb, "uuid");
|
ffio_wfourcc(pb, "uuid");
|
||||||
avio_write(pb, uuid, sizeof(uuid));
|
avio_write(pb, uuid, AV_UUID_LEN);
|
||||||
avio_w8(pb, 1);
|
avio_w8(pb, 1);
|
||||||
avio_wb24(pb, 0);
|
avio_wb24(pb, 0);
|
||||||
avio_w8(pb, n);
|
avio_w8(pb, n);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user