}
if (sc->extradata) {
- av_log(c->fc, AV_LOG_ERROR, "Duplicate STSD\n");
+ av_log(c->fc, AV_LOG_ERROR,
+ "Duplicate stsd found in this track.\n");
return AVERROR_INVALIDDATA;
}
+
/* Prepare space for hosting multiple extradata. */
sc->extradata = av_mallocz_array(entries, sizeof(*sc->extradata));
sc->extradata_size = av_mallocz_array(entries, sizeof(*sc->extradata_size));
return 0;
}
-#define mov_stsc_index_valid(index, count) ((index) < (count) - 1)
+static inline int mov_stsc_index_valid(unsigned int index, unsigned int count)
+{
+ return index < count - 1;
+}
/* Compute the samples value for the stsc entry at the given index. */
-static inline int mov_get_stsc_samples(MOVStreamContext *sc, int index)
+static inline int mov_get_stsc_samples(MOVStreamContext *sc, unsigned int index)
{
int chunk_count;
for (i = 0; i < entries && !pb->eof_reached; i++) {
int sample_duration;
- int sample_count;
+ unsigned int sample_count;
sample_count=avio_rb32(pb);
sample_duration = avio_rb32(pb);
- if (sample_count < 0) {
- av_log(c->fc, AV_LOG_ERROR, "Invalid sample_count=%d\n", sample_count);
- return AVERROR_INVALIDDATA;
- }
sc->stts_data[i].count= sample_count;
sc->stts_data[i].duration= sample_duration;
// Increment skip_samples for the first non-zero audio edit list
if (first_non_zero_audio_edit > 0 && st->codecpar->codec_id != AV_CODEC_ID_VORBIS) {
st->skip_samples += frame_duration;
- msc->start_pad = st->skip_samples;
}
}
}
// Update av stream length
st->duration = edit_list_dts_entry_end - start_dts;
+ msc->start_pad = st->skip_samples;
// Free the old index and the old CTTS structures
av_free(e_old);
{
AVStream *st;
MOVStreamContext *sc;
- int size, layout;
+ int size, version, layout;
int32_t yaw, pitch, roll;
uint32_t l = 0, t = 0, r = 0, b = 0;
uint32_t tag, padding = 0;
av_log(c->fc, AV_LOG_ERROR, "Missing spherical video header\n");
return 0;
}
- avio_skip(pb, 4); /* version + flags */
+ version = avio_r8(pb);
+ if (version != 0) {
+ av_log(c->fc, AV_LOG_WARNING, "Unknown spherical version %d\n",
+ version);
+ return 0;
+ }
+ avio_skip(pb, 3); /* flags */
avio_skip(pb, size - 12); /* metadata_source */
size = avio_rb32(pb);
av_log(c->fc, AV_LOG_ERROR, "Missing projection header box\n");
return 0;
}
- avio_skip(pb, 4); /* version + flags */
+ version = avio_r8(pb);
+ if (version != 0) {
+ av_log(c->fc, AV_LOG_WARNING, "Unknown spherical version %d\n",
+ version);
+ return 0;
+ }
+ avio_skip(pb, 3); /* flags */
/* 16.16 fixed point */
yaw = avio_rb32(pb);
return AVERROR_INVALIDDATA;
tag = avio_rl32(pb);
- avio_skip(pb, 4); /* version + flags */
+ version = avio_r8(pb);
+ if (version != 0) {
+ av_log(c->fc, AV_LOG_WARNING, "Unknown spherical version %d\n",
+ version);
+ return 0;
+ }
+ avio_skip(pb, 3); /* flags */
switch (tag) {
case MKTAG('c','b','m','p'):
layout = avio_rb32(pb);
goto out;
/* Check for mandatory keys and values, try to support XML as best-effort */
- if (av_stristr(buffer, "<GSpherical:StitchingSoftware>") &&
+ if (!sc->spherical &&
+ av_stristr(buffer, "<GSpherical:StitchingSoftware>") &&
(val = av_stristr(buffer, "<GSpherical:Spherical>")) &&
av_stristr(val, "true") &&
(val = av_stristr(buffer, "<GSpherical:Stitched>")) &&
sc->spherical->projection = AV_SPHERICAL_EQUIRECTANGULAR;
- if (av_stristr(buffer, "<GSpherical:StereoMode>")) {
+ if (av_stristr(buffer, "<GSpherical:StereoMode>") && !sc->stereo3d) {
enum AVStereo3DType mode;
if (av_stristr(buffer, "left-right"))
{
MOVStreamContext *sc = st->priv_data;
int sample, time_sample;
- int i;
+ unsigned int i;
int ret = mov_seek_fragment(s, st, timestamp);
if (ret < 0)