X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libavformat%2Fnutenc.c;h=f89882b69f19f7a26f24d5769e3483f9a73d9e00;hb=9ed3afcb7fe524dee315e800d17f94aa34b8d0b1;hp=edcb2c7219909a680c008412e07f9fcbcb7364d1;hpb=6a5d31ac25f55248af5725287833d007ff78b188;p=ffmpeg diff --git a/libavformat/nutenc.c b/libavformat/nutenc.c index edcb2c72199..f89882b69f1 100644 --- a/libavformat/nutenc.c +++ b/libavformat/nutenc.c @@ -109,7 +109,7 @@ static void build_elision_headers(AVFormatContext *s){ int i; //FIXME this is lame //FIXME write a 2pass mode to find the maximal headers - const static uint8_t headers[][5]={ + static const uint8_t headers[][5]={ {3, 0x00, 0x00, 0x01}, {4, 0x00, 0x00, 0x01, 0xB6}, {2, 0xFF, 0xFA}, //mp3+crc @@ -448,6 +448,7 @@ static int add_info(ByteIOContext *bc, const char *type, const char *value){ static int write_globalinfo(NUTContext *nut, ByteIOContext *bc){ AVFormatContext *s= nut->avf; + AVMetadataTag *title, *author, *copyright; ByteIOContext *dyn_bc; uint8_t *dyn_buf=NULL; int count=0, dyn_size; @@ -455,9 +456,13 @@ static int write_globalinfo(NUTContext *nut, ByteIOContext *bc){ if(ret < 0) return ret; - if(s->title [0]) count+= add_info(dyn_bc, "Title" , s->title); - if(s->author [0]) count+= add_info(dyn_bc, "Author" , s->author); - if(s->copyright[0]) count+= add_info(dyn_bc, "Copyright", s->copyright); + title = av_metadata_get(s->metadata, "Title" , NULL, 0); + author = av_metadata_get(s->metadata, "Author" , NULL, 0); + copyright = av_metadata_get(s->metadata, "Copyright", NULL, 0); + + if(title ) count+= add_info(dyn_bc, "Title" , title->value); + if(author ) count+= add_info(dyn_bc, "Author" , author->value); + if(copyright) count+= add_info(dyn_bc, "Copyright", copyright->value); if(!(s->streams[0]->codec->flags & CODEC_FLAG_BITEXACT)) count+= add_info(dyn_bc, "Encoder" , LIBAVFORMAT_IDENT); @@ -809,9 +814,9 @@ AVOutputFormat nut_muxer = { "video/x-nut", "nut", sizeof(NUTContext), -#ifdef CONFIG_LIBVORBIS +#if CONFIG_LIBVORBIS CODEC_ID_VORBIS, -#elif defined(CONFIG_LIBMP3LAME) +#elif CONFIG_LIBMP3LAME CODEC_ID_MP3, #else CODEC_ID_MP2, @@ -820,6 +825,6 @@ AVOutputFormat nut_muxer = { write_header, write_packet, write_trailer, - .flags = AVFMT_GLOBALHEADER, + .flags = AVFMT_GLOBALHEADER | AVFMT_VARIABLE_FPS, .codec_tag= (const AVCodecTag* const []){codec_bmp_tags, codec_wav_tags, ff_nut_subtitle_tags, 0}, };