[PATCH 1/2] Add AVFilterPic.pos field and make libavfilter propagate stream byte position information, as stored in the pkt.pos, through the filterchain.

Stefano Sabatini stefano.sabatini-lala
Sat Mar 6 18:41:23 CET 2010


---
 libavfilter/avfilter.c |    5 +++--
 libavfilter/avfilter.h |    1 +
 libavfilter/defaults.c |    1 +
 3 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c
index e28f1c7..2ee19e7 100644
--- a/libavfilter/avfilter.c
+++ b/libavfilter/avfilter.c
@@ -171,11 +171,11 @@ int avfilter_config_links(AVFilterContext *filter)
 static void dprintf_picref(void *ctx, AVFilterPicRef *picref, int end)
 {
     dprintf(ctx,
-            "picref[%p data[%p, %p, %p, %p] linesize[%d, %d, %d, %d] pts:%"PRId64" s:%dx%d]%s",
+            "picref[%p data[%p, %p, %p, %p] linesize[%d, %d, %d, %d] pts:%"PRId64" pos:%"PRId64" s:%dx%d]%s",
             picref,
             picref->data    [0], picref->data    [1], picref->data    [2], picref->data    [3],
             picref->linesize[0], picref->linesize[1], picref->linesize[2], picref->linesize[3],
-            picref->pts, picref->w, picref->h,
+            picref->pts, picref->pos, picref->w, picref->h,
             end ? "\n" : "");
 }
 
@@ -263,6 +263,7 @@ void avfilter_start_frame(AVFilterLink *link, AVFilterPicRef *picref)
         link->cur_pic = avfilter_default_get_video_buffer(link, dst->min_perms, link->w, link->h);
         link->srcpic = picref;
         link->cur_pic->pts = link->srcpic->pts;
+        link->cur_pic->pos = link->srcpic->pos;
         link->cur_pic->pixel_aspect = link->srcpic->pixel_aspect;
     }
     else
diff --git a/libavfilter/avfilter.h b/libavfilter/avfilter.h
index 832f421..f181689 100644
--- a/libavfilter/avfilter.h
+++ b/libavfilter/avfilter.h
@@ -105,6 +105,7 @@ typedef struct AVFilterPicRef
     int h;                      ///< image height
 
     int64_t pts;                ///< presentation timestamp in units of 1/AV_TIME_BASE
+    int64_t pos;                ///< byte position in stream, -1 if unknown
 
     AVRational pixel_aspect;    ///< pixel aspect ratio
 
diff --git a/libavfilter/defaults.c b/libavfilter/defaults.c
index 7e02ea8..3af1d8f 100644
--- a/libavfilter/defaults.c
+++ b/libavfilter/defaults.c
@@ -74,6 +74,7 @@ void avfilter_default_start_frame(AVFilterLink *link, AVFilterPicRef *picref)
     if(out) {
         out->outpic      = avfilter_get_video_buffer(out, AV_PERM_WRITE, out->w, out->h);
         out->outpic->pts = picref->pts;
+        out->outpic->pos = picref->pos;
         avfilter_start_frame(out, avfilter_ref_pic(out->outpic, ~0));
     }
 }
-- 
1.6.6.1


--UlVJffcvxoiEqYs2
Content-Type: text/x-diff; charset=us-ascii
Content-Disposition: attachment; filename="0002-Make-ffplay-pass-the-packet.pos-information-to-the-f.patch"




More information about the ffmpeg-devel mailing list