Revision 7f88a5bf ffmpeg.c

View differences:

ffmpeg.c
1862 1862

  
1863 1863
    for (i = 0; i < is->nb_chapters; i++) {
1864 1864
        AVChapter *in_ch = is->chapters[i], *out_ch;
1865
        AVMetadataTag *t = NULL;
1866 1865
        int64_t ts_off   = av_rescale_q(start_time - input_files_ts_offset[infile],
1867 1866
                                      AV_TIME_BASE_Q, in_ch->time_base);
1868 1867
        int64_t rt       = (recording_time == INT64_MAX) ? INT64_MAX :
......
1884 1883
        out_ch->end       = FFMIN(rt, in_ch->end   - ts_off);
1885 1884

  
1886 1885
        if (metadata_chapters_autocopy)
1887
            while ((t = av_metadata_get(in_ch->metadata, "", t, AV_METADATA_IGNORE_SUFFIX)))
1888
                av_metadata_set2(&out_ch->metadata, t->key, t->value, 0);
1886
            av_metadata_copy(&out_ch->metadata, in_ch->metadata, 0);
1889 1887

  
1890 1888
        os->nb_chapters++;
1891 1889
        os->chapters = av_realloc(os->chapters, sizeof(AVChapter)*os->nb_chapters);
......
2105 2103

  
2106 2104
    /* for each output stream, we compute the right encoding parameters */
2107 2105
    for(i=0;i<nb_ostreams;i++) {
2108
        AVMetadataTag *t = NULL;
2109 2106
        ost = ost_table[i];
2110 2107
        os = output_files[ost->file_index];
2111 2108
        ist = ist_table[ost->source_index];
......
2114 2111
        icodec = ist->st->codec;
2115 2112

  
2116 2113
        if (metadata_streams_autocopy)
2117
            while ((t = av_metadata_get(ist->st->metadata, "", t, AV_METADATA_IGNORE_SUFFIX))) {
2118
                av_metadata_set2(&ost->st->metadata, t->key, t->value, AV_METADATA_DONT_OVERWRITE);
2119
            }
2114
            av_metadata_copy(&ost->st->metadata, ist->st->metadata,
2115
                             AV_METADATA_DONT_OVERWRITE);
2120 2116

  
2121 2117
        ost->st->disposition = ist->st->disposition;
2122 2118
        codec->bits_per_raw_sample= icodec->bits_per_raw_sample;
......
2368 2364
    for (i=0;i<nb_meta_data_maps;i++) {
2369 2365
        AVFormatContext *files[2];
2370 2366
        AVMetadata      **meta[2];
2371
        AVMetadataTag *mtag;
2372 2367
        int j;
2373 2368

  
2374 2369
#define METADATA_CHECK_INDEX(index, nb_elems, desc)\
......
2411 2406
            }
2412 2407
        }
2413 2408

  
2414
        mtag=NULL;
2415
        while((mtag=av_metadata_get(*meta[1], "", mtag, AV_METADATA_IGNORE_SUFFIX)))
2416
            av_metadata_set2(meta[0], mtag->key, mtag->value, AV_METADATA_DONT_OVERWRITE);
2409
        av_metadata_copy(meta[0], *meta[1], AV_METADATA_DONT_OVERWRITE);
2417 2410
    }
2418 2411

  
2419 2412
    /* copy global metadata by default */
2420 2413
    if (metadata_global_autocopy) {
2421
        AVMetadataTag *t = NULL;
2422 2414

  
2423
        while ((t = av_metadata_get(input_files[0]->metadata, "", t, AV_METADATA_IGNORE_SUFFIX)))
2424 2415
            for (i = 0; i < nb_output_files; i++)
2425
                av_metadata_set2(&output_files[i]->metadata, t->key, t->value, AV_METADATA_DONT_OVERWRITE);
2416
            av_metadata_copy(&output_files[i]->metadata, input_files[0]->metadata,
2417
                             AV_METADATA_DONT_OVERWRITE);
2426 2418
    }
2427 2419

  
2428 2420
    /* copy chapters according to chapter maps */
......
3692 3684
    int input_has_video, input_has_audio, input_has_subtitle;
3693 3685
    AVFormatParameters params, *ap = &params;
3694 3686
    AVOutputFormat *file_oformat;
3695
    AVMetadataTag *tag = NULL;
3696 3687

  
3697 3688
    if (!strcmp(filename, "-"))
3698 3689
        filename = "pipe:";
......
3760 3751

  
3761 3752
        oc->timestamp = recording_timestamp;
3762 3753

  
3763
        while ((tag = av_metadata_get(metadata, "", tag, AV_METADATA_IGNORE_SUFFIX)))
3764
            av_metadata_set2(&oc->metadata, tag->key, tag->value, 0);
3754
        av_metadata_copy(&oc->metadata, metadata, 0);
3765 3755
        av_metadata_free(&metadata);
3766 3756
    }
3767 3757

  

Also available in: Unified diff