[FFmpeg-cvslog] lavf: Set pos for all packets of AVSTREAM_PARSE_FULL_RAW files.

Michael Niedermayer git at videolan.org
Wed Jul 25 02:17:09 CEST 2012


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Tue Jul 24 17:34:13 2012 +0200| [1c2beff04a661b398266a8655c6e55ab47791002] | committer: Michael Niedermayer

lavf: Set pos for all packets of AVSTREAM_PARSE_FULL_RAW files.

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=1c2beff04a661b398266a8655c6e55ab47791002
---

 libavformat/avformat.h |    4 +++-
 libavformat/utils.c    |    3 +++
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/libavformat/avformat.h b/libavformat/avformat.h
index 1837733..659bd64 100644
--- a/libavformat/avformat.h
+++ b/libavformat/avformat.h
@@ -578,7 +578,9 @@ enum AVStreamParseType {
     AVSTREAM_PARSE_HEADERS,    /**< Only parse headers, do not repack. */
     AVSTREAM_PARSE_TIMESTAMPS, /**< full parsing and interpolation of timestamps for frames not starting on a packet boundary */
     AVSTREAM_PARSE_FULL_ONCE,  /**< full parsing and repack of the first frame only, only implemented for H.264 currently */
-    AVSTREAM_PARSE_FULL_RAW=MKTAG(0,'R','A','W'),       /**< full parsing and repack with timestamp generation for raw */
+    AVSTREAM_PARSE_FULL_RAW=MKTAG(0,'R','A','W'),       /**< full parsing and repack with timestamp and position generation by parser for raw
+                                                             this assumes that each packet in the file contains no demuxer level headers and
+                                                             just codec level data, otherwise position generaion would fail */
 };
 
 typedef struct AVIndexEntry {
diff --git a/libavformat/utils.c b/libavformat/utils.c
index 4dde821..5759f94 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -1216,6 +1216,9 @@ static int parse_packet(AVFormatContext *s, AVPacket *pkt, int stream_index)
         out_pkt.dts = st->parser->dts;
         out_pkt.pos = st->parser->pos;
 
+        if(st->need_parsing == AVSTREAM_PARSE_FULL_RAW)
+            out_pkt.pos = st->parser->frame_offset;
+
         if (st->parser->key_frame == 1 ||
             (st->parser->key_frame == -1 &&
              st->parser->pict_type == AV_PICTURE_TYPE_I))



More information about the ffmpeg-cvslog mailing list