--- ../ffmpeg-11312/libavfilter/vf_overlay.c	2007-12-24 09:58:23.700402000 +0100
+++ vf_overlay.c	2007-12-31 13:03:31.174942600 +0100
@@ -25,6 +25,7 @@
 
 typedef struct {
     int x, y;                   //< position of subpicture
+    int pts_chosen;             //< -1=lowest pts, 0=main image, 1=sub image
 
     /** pics[0][0..1] are pictures for the main image.
      *  pics[1][0..1] are pictures for the sub image */
@@ -38,9 +39,14 @@
 {
     OverlayContext *over = ctx->priv;
 
-    if(!args || sscanf(args, "%d:%d", &over->x, &over->y) != 2) {
         over->x =
         over->y = 0;
+    over->pts_chosen = -1;
+    sscanf(args, "%d:%d:%d", &over->x, &over->y, &over->pts_chosen);
+    if ((over->pts_chosen < -1)||(over->pts_chosen > 1) {
+        av_log(ctx, AV_LOG_ERROR, 
+            "overlay::init PTS chosen must be either -1=lowest pts, 0=main image, or 1=sub image\n");
+        return -1
     }
 
     return 0;
@@ -175,8 +181,11 @@
         copy_image(pic, x, y, over->pics[1][0], w, h,
                    over->bpp, over->hsub, over->vsub);
 
+    if (-1 == over->pts_chosen)
     /* we give the output frame the higher of the two current pts values */
     pic->pts = over->pics[!lower_timestamp(over)][0]->pts;
+    else
+        pic->pts = over->pics[over->pts_chosen][0]->pts;
 
     /* and send it to the next filter */
     avfilter_start_frame(link, avfilter_ref_pic(pic, ~0));
