[PATCH 2/2] Make ffplay pass the packet.pos information to the filterchain, get it again from the filterchain and pass it back to output_picture2().

Stefano Sabatini stefano.sabatini-lala
Sat Mar 6 18:45:22 CET 2010


---
 ffplay.c |   10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/ffplay.c b/ffplay.c
index ce1d5a2..963be06 100644
--- a/ffplay.c
+++ b/ffplay.c
@@ -1570,6 +1570,7 @@ static int input_request_frame(AVFilterLink *link)
     av_free_packet(&pkt);
 
     picref->pts = pts;
+    picref->pos = pkt.pos;
     picref->pixel_aspect = priv->is->video_st->codec->sample_aspect_ratio;
     avfilter_start_frame(link, avfilter_ref_pic(picref, ~0));
     avfilter_draw_slice(link, 0, link->h, 1);
@@ -1633,7 +1634,7 @@ static int output_query_formats(AVFilterContext *ctx)
 }
 
 static int get_filtered_video_frame(AVFilterContext *ctx, AVFrame *frame,
-                                    int64_t *pts)
+                                    int64_t *pts, int64_t *pos)
 {
     AVFilterPicRef *pic;
 
@@ -1645,6 +1646,7 @@ static int get_filtered_video_frame(AVFilterContext *ctx, AVFrame *frame,
 
     frame->opaque = pic;
     *pts          = pic->pts;
+    *pos          = pic->pos;
 
     memcpy(frame->data,     pic->data,     sizeof(frame->data));
     memcpy(frame->linesize, pic->linesize, sizeof(frame->linesize));
@@ -1671,7 +1673,7 @@ static int video_thread(void *arg)
 {
     VideoState *is = arg;
     AVFrame *frame= avcodec_alloc_frame();
-    int64_t pts_int;
+    int64_t pts_int, pos;
     double pts;
     int ret;
 
@@ -1724,7 +1726,7 @@ static int video_thread(void *arg)
         while (is->paused && !is->videoq.abort_request)
             SDL_Delay(10);
 #if CONFIG_AVFILTER
-        ret = get_filtered_video_frame(filt_out, frame, &pts_int);
+        ret = get_filtered_video_frame(filt_out, frame, &pts_int, &pos);
 #else
         ret = get_video_frame(is, frame, &pts_int, &pkt);
 #endif
@@ -1737,7 +1739,7 @@ static int video_thread(void *arg)
         pts = pts_int*av_q2d(is->video_st->time_base);
 
 #if CONFIG_AVFILTER
-        ret = output_picture2(is, frame, pts,  -1); /* fixme: unknown pos */
+        ret = output_picture2(is, frame, pts, pos);
 #else
         ret = output_picture2(is, frame, pts,  pkt.pos);
         av_free_packet(&pkt);
-- 
1.6.6.1


--UlVJffcvxoiEqYs2--



More information about the ffmpeg-devel mailing list