[SCM] libav/experimental: avconv: add stream-global side data to the first demuxed packet

siretart at users.alioth.debian.org siretart at users.alioth.debian.org
Sun Aug 10 16:02:22 UTC 2014


The following commit has been merged in the experimental branch:
commit 59444c76e6d43529a12dbd80b6dd29c6ba4079a9
Author: Anton Khirnov <anton at khirnov.net>
Date:   Wed Feb 19 18:49:48 2014 +0100

    avconv: add stream-global side data to the first demuxed packet

diff --git a/avconv.c b/avconv.c
index 13e6778..bf40d45 100644
--- a/avconv.c
+++ b/avconv.c
@@ -2223,9 +2223,26 @@ static int process_input(void)
         goto discard_packet;
 
     ist = input_streams[ifile->ist_index + pkt.stream_index];
+    ist->nb_packets++;
     if (ist->discard)
         goto discard_packet;
 
+    /* add the stream-global side data to the first packet */
+    if (ist->nb_packets == 1)
+        for (i = 0; i < ist->st->nb_side_data; i++) {
+            AVPacketSideData *src_sd = &ist->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)
+                exit_program(1);
+
+            memcpy(dst_data, src_sd->data, src_sd->size);
+        }
+
     if (pkt.dts != AV_NOPTS_VALUE)
         pkt.dts += av_rescale_q(ifile->ts_offset, AV_TIME_BASE_Q, ist->st->time_base);
     if (pkt.pts != AV_NOPTS_VALUE)
diff --git a/avconv.h b/avconv.h
index c912fae..1928432 100644
--- a/avconv.h
+++ b/avconv.h
@@ -233,6 +233,9 @@ typedef struct InputStream {
     AVDictionary *opts;
     AVRational framerate;               /* framerate forced with -r */
 
+    /* number of packets successfully read for this stream */
+    uint64_t nb_packets;
+
     int resample_height;
     int resample_width;
     int resample_pix_fmt;

-- 
Libav/FFmpeg packaging



More information about the pkg-multimedia-commits mailing list