Commit e8821e74 authored by Michael Niedermayer's avatar Michael Niedermayer

Merge commit '00d751d4'

* commit '00d751d4':
  movenc: Set tfhd default sample flags based on actual samples, if possible
Merged-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parents 6453fddb 00d751d4
...@@ -3335,6 +3335,12 @@ static int mov_write_mfhd_tag(AVIOContext *pb, MOVMuxContext *mov) ...@@ -3335,6 +3335,12 @@ static int mov_write_mfhd_tag(AVIOContext *pb, MOVMuxContext *mov)
return 0; return 0;
} }
static uint32_t get_sample_flags(MOVTrack *track, MOVIentry *entry)
{
return entry->flags & MOV_SYNC_SAMPLE ? MOV_FRAG_SAMPLE_FLAG_DEPENDS_NO :
(MOV_FRAG_SAMPLE_FLAG_DEPENDS_YES | MOV_FRAG_SAMPLE_FLAG_IS_NON_SYNC);
}
static int mov_write_tfhd_tag(AVIOContext *pb, MOVMuxContext *mov, static int mov_write_tfhd_tag(AVIOContext *pb, MOVMuxContext *mov,
MOVTrack *track, int64_t moof_offset) MOVTrack *track, int64_t moof_offset)
{ {
...@@ -3380,22 +3386,21 @@ static int mov_write_tfhd_tag(AVIOContext *pb, MOVMuxContext *mov, ...@@ -3380,22 +3386,21 @@ static int mov_write_tfhd_tag(AVIOContext *pb, MOVMuxContext *mov,
track->default_size = -1; track->default_size = -1;
if (flags & MOV_TFHD_DEFAULT_FLAGS) { if (flags & MOV_TFHD_DEFAULT_FLAGS) {
track->default_sample_flags = /* Set the default flags based on the second sample, if available.
track->enc->codec_type == AVMEDIA_TYPE_VIDEO ? * If the first sample is different, that can be signaled via a separate field. */
(MOV_FRAG_SAMPLE_FLAG_DEPENDS_YES | MOV_FRAG_SAMPLE_FLAG_IS_NON_SYNC) : if (track->entry > 1)
MOV_FRAG_SAMPLE_FLAG_DEPENDS_NO; track->default_sample_flags = get_sample_flags(track, &track->cluster[1]);
else
track->default_sample_flags =
track->enc->codec_type == AVMEDIA_TYPE_VIDEO ?
(MOV_FRAG_SAMPLE_FLAG_DEPENDS_YES | MOV_FRAG_SAMPLE_FLAG_IS_NON_SYNC) :
MOV_FRAG_SAMPLE_FLAG_DEPENDS_NO;
avio_wb32(pb, track->default_sample_flags); avio_wb32(pb, track->default_sample_flags);
} }
return update_size(pb, pos); return update_size(pb, pos);
} }
static uint32_t get_sample_flags(MOVTrack *track, MOVIentry *entry)
{
return entry->flags & MOV_SYNC_SAMPLE ? MOV_FRAG_SAMPLE_FLAG_DEPENDS_NO :
(MOV_FRAG_SAMPLE_FLAG_DEPENDS_YES | MOV_FRAG_SAMPLE_FLAG_IS_NON_SYNC);
}
static int mov_write_trun_tag(AVIOContext *pb, MOVMuxContext *mov, static int mov_write_trun_tag(AVIOContext *pb, MOVMuxContext *mov,
MOVTrack *track, int moof_size) MOVTrack *track, int moof_size)
{ {
......
bb762c178bd8c437a9101c748c1ccb4d 930cfa0d91434f46a8a197a2165a734a
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment