Merge commit '019d3fccc4dcf5c8379112f697ce9eb08edee9b9'
authorMichael Niedermayer <michaelni@gmx.at>
Wed, 13 Aug 2014 21:02:56 +0000 (23:02 +0200)
committerMichael Niedermayer <michaelni@gmx.at>
Wed, 13 Aug 2014 21:02:56 +0000 (23:02 +0200)
* commit '019d3fccc4dcf5c8379112f697ce9eb08edee9b9':
  Set protocol-level metadata in AVFormatContext any time a packet is read.

Conflicts:
libavformat/utils.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
1  2 
libavformat/utils.c

@@@ -1377,47 -968,19 +1378,55 @@@ static int read_frame_internal(AVFormat
      if (!got_packet && s->parse_queue)
          ret = read_from_packet_buffer(&s->parse_queue, &s->parse_queue_end, pkt);
  
 +    if (ret >= 0) {
 +        AVStream *st = s->streams[pkt->stream_index];
 +        if (st->skip_samples) {
 +            uint8_t *p = av_packet_new_side_data(pkt, AV_PKT_DATA_SKIP_SAMPLES, 10);
 +            if (p) {
 +                AV_WL32(p, st->skip_samples);
 +                av_log(s, AV_LOG_DEBUG, "demuxer injecting skip %d\n", st->skip_samples);
 +            }
 +            st->skip_samples = 0;
 +        }
 +
 +        if (st->inject_global_side_data) {
 +            for (i = 0; i < st->nb_side_data; i++) {
 +                AVPacketSideData *src_sd = &st->side_data[i];
 +                uint8_t *dst_data;
 +
 +                if (av_packet_get_side_data(pkt, src_sd->type, NULL))
 +                    continue;
 +
 +                dst_data = av_packet_new_side_data(pkt, src_sd->type, src_sd->size);
 +                if (!dst_data) {
 +                    av_log(s, AV_LOG_WARNING, "Could not inject global side data\n");
 +                    continue;
 +                }
 +
 +                memcpy(dst_data, src_sd->data, src_sd->size);
 +            }
 +            st->inject_global_side_data = 0;
 +        }
 +
 +        if (!(s->flags & AVFMT_FLAG_KEEP_SIDE_DATA))
 +            av_packet_merge_side_data(pkt);
 +    }
 +
+     av_opt_get_dict_val(s, "metadata", AV_OPT_SEARCH_CHILDREN, &metadata);
+     if (metadata) {
+         s->event_flags |= AVFMT_EVENT_FLAG_METADATA_UPDATED;
+         av_dict_copy(&s->metadata, metadata, 0);
+         av_dict_free(&metadata);
+         av_opt_set_dict_val(s, "metadata", NULL, AV_OPT_SEARCH_CHILDREN);
+     }
      if (s->debug & FF_FDEBUG_TS)
          av_log(s, AV_LOG_DEBUG,
 -               "read_frame_internal stream=%d, pts=%"PRId64", dts=%"PRId64", "
 +               "read_frame_internal stream=%d, pts=%s, dts=%s, "
                 "size=%d, duration=%d, flags=%d\n",
 -               pkt->stream_index, pkt->pts, pkt->dts,
 +               pkt->stream_index,
 +               av_ts2str(pkt->pts),
 +               av_ts2str(pkt->dts),
                 pkt->size, pkt->duration, pkt->flags);
  
      return ret;