[FFmpeg-trac] #1052(avformat:new): libavformat doesn't preserve some metadata for mov containers

FFmpeg trac at avcodec.org
Wed Jun 6 13:24:13 CEST 2012


#1052: libavformat doesn't preserve some metadata for mov containers
------------------------------------+------------------------------------
             Reporter:  bbraun      |                    Owner:
                 Type:  defect      |                   Status:  new
             Priority:  normal      |                Component:  avformat
              Version:  git-master  |               Resolution:
             Keywords:  mov         |               Blocked By:
             Blocking:              |  Reproduced by developer:  0
Analyzed by developer:  0           |
------------------------------------+------------------------------------

Comment (by michael):

 +static int mov_write_int8_metadata(AVFormatContext *s, AVIOContext *pb,
 +                                     const char *name, const char *tag,
 +                                     int long_style)
 +{
 +    int64_t pos = avio_tell(pb);
 +    AVDictionaryEntry *t = NULL;

 always writen before read, thus =NULL is useless


 +    uint8_t num;
 +
 +    if (!(t = av_dict_get(s->metadata, tag, NULL, 0)))
 +        return 0;

 +    num = t ? atoi(t->value) : 0;

 t cant be NULL here

 +
 +    avio_wb32(pb, 4);
 +    ffio_wfourcc(pb, name);
 +    avio_w8(pb, 0);
 +    avio_w8(pb, 0);
 +    avio_w8(pb, 0);
 +    avio_w8(pb, num);

 +    return update_size(pb, pos);

 you dont need update_size when the size is fixed

 also this function can be factored with the very similar
 mov_write_int8_metadata_no_padding()

-- 
Ticket URL: <https://ffmpeg.org/trac/ffmpeg/ticket/1052#comment:2>
FFmpeg <http://ffmpeg.org>
FFmpeg issue tracker


More information about the FFmpeg-trac mailing list