Commit 0ba5299a authored by Anton Khirnov's avatar Anton Khirnov

movenc: use the "encoder" metadata tag to write stsd Compressorname

This mirrors the demuxer behaviour and avoids accessing
AVCodecContext.codec, which should not be done in muxers.
parent 6656370b
......@@ -1003,6 +1003,7 @@ static int mov_write_pasp_tag(AVIOContext *pb, MOVTrack *track)
static int mov_write_video_tag(AVIOContext *pb, MOVTrack *track)
{
AVDictionaryEntry *encoder;
int64_t pos = avio_tell(pb);
char compressor_name[32] = { 0 };
......@@ -1036,8 +1037,9 @@ static int mov_write_video_tag(AVIOContext *pb, MOVTrack *track)
avio_wb16(pb, 1); /* Frame count (= 1) */
/* FIXME not sure, ISO 14496-1 draft where it shall be set to 0 */
if (track->mode == MODE_MOV && track->enc->codec && track->enc->codec->name)
av_strlcpy(compressor_name, track->enc->codec->name, 32);
if (track->mode == MODE_MOV &&
(encoder = av_dict_get(track->st->metadata, "encoder", NULL, 0)))
av_strlcpy(compressor_name, encoder->value, 32);
avio_w8(pb, strlen(compressor_name));
avio_write(pb, compressor_name, 31);
......@@ -3366,6 +3368,7 @@ static int mov_write_header(AVFormatContext *s)
MOVTrack *track= &mov->tracks[i];
AVDictionaryEntry *lang = av_dict_get(st->metadata, "language", NULL,0);
track->st = st;
track->enc = st->codec;
track->language = ff_mov_iso639_to_lang(lang?lang->value:"und", mov->mode!=MODE_MOV);
if (track->language < 0)
......
......@@ -91,6 +91,7 @@ typedef struct MOVTrack {
int language;
int track_id;
int tag; ///< stsd fourcc
AVStream *st;
AVCodecContext *enc;
int vos_len;
......
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