mirror of https://git.ffmpeg.org/ffmpeg.git
avformat/movenc: write reel_name metadata to tmcd atom
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
parent
4b63bcef90
commit
d6af706eee
|
@ -1340,12 +1340,23 @@ static int mov_write_rtp_tag(AVIOContext *pb, MOVTrack *track)
|
|||
return update_size(pb, pos);
|
||||
}
|
||||
|
||||
static int mov_write_source_reference_tag(AVIOContext *pb, MOVTrack *track, const char *reel_name){
|
||||
int64_t pos = avio_tell(pb);
|
||||
avio_wb32(pb, 0); /* size */
|
||||
ffio_wfourcc(pb, "name"); /* Data format */
|
||||
avio_wb16(pb, strlen(reel_name)); /* string size */
|
||||
avio_wb16(pb, track->language); /* langcode */
|
||||
avio_write(pb, reel_name, strlen(reel_name)); /* reel name */
|
||||
return update_size(pb,pos);
|
||||
}
|
||||
|
||||
static int mov_write_tmcd_tag(AVIOContext *pb, MOVTrack *track)
|
||||
{
|
||||
int64_t pos = avio_tell(pb);
|
||||
#if 1
|
||||
int frame_duration = av_rescale(track->timescale, track->enc->time_base.num, track->enc->time_base.den);
|
||||
int nb_frames = 1.0/av_q2d(track->enc->time_base) + 0.5;
|
||||
AVDictionaryEntry *t = NULL;
|
||||
|
||||
if (nb_frames > 255) {
|
||||
av_log(NULL, AV_LOG_ERROR, "fps %d is too large\n", nb_frames);
|
||||
|
@ -1361,8 +1372,15 @@ static int mov_write_tmcd_tag(AVIOContext *pb, MOVTrack *track)
|
|||
avio_wb32(pb, track->timescale); /* Timescale */
|
||||
avio_wb32(pb, frame_duration); /* Frame duration */
|
||||
avio_w8(pb, nb_frames); /* Number of frames */
|
||||
avio_wb24(pb, 0); /* Reserved */
|
||||
/* TODO: source reference string */
|
||||
avio_w8(pb, 0); /* Reserved */
|
||||
|
||||
if (track->st)
|
||||
t = av_dict_get(track->st->metadata, "reel_name", NULL, 0);
|
||||
|
||||
if (t && utf8len(t->value))
|
||||
mov_write_source_reference_tag(pb, track, t->value);
|
||||
else
|
||||
avio_wb16(pb, 0); /* zero size */
|
||||
#else
|
||||
|
||||
avio_wb32(pb, 0); /* size */
|
||||
|
@ -3809,6 +3827,9 @@ static int mov_create_timecode_track(AVFormatContext *s, int index, int src_inde
|
|||
if (tc.flags & AV_TIMECODE_FLAG_DROPFRAME)
|
||||
track->timecode_flags |= MOV_TIMECODE_FLAG_DROPFRAME;
|
||||
|
||||
/* set st to src_st for metadata access*/
|
||||
track->st = src_st;
|
||||
|
||||
/* encode context: tmcd data stream */
|
||||
track->enc = avcodec_alloc_context3(NULL);
|
||||
track->enc->codec_type = AVMEDIA_TYPE_DATA;
|
||||
|
|
Loading…
Reference in New Issue