Index: configure.ac
===================================================================
RCS file: /cvs/gstreamer/gst-ffmpeg/configure.ac,v
retrieving revision 1.30
diff -u -r1.30 configure.ac
--- configure.ac	20 Jun 2005 13:07:51 -0000	1.30
+++ configure.ac	26 Jul 2005 13:41:27 -0000
@@ -86,8 +86,10 @@
 
 AC_DEFINE_UNQUOTED(HAVE_FFMPEG_UNINSTALLED, 1,
                    [Defined if building against uninstalled FFmpeg source])
+old_args=$ac_configure_args
 ac_configure_args="$ac_configure_args --disable-v4l --disable-audio-oss --disable-dv1394 --disable-vhook --disable-ffmpeg --disable-ffserver --enable-pp"
 AC_CONFIG_SUBDIRS(gst-libs/ext/ffmpeg)
+ac_configure_args=$old_args
 
 AC_CONFIG_FILES(
 Makefile
Index: ext/ffmpeg/gstffmpegdec.c
===================================================================
RCS file: /cvs/gstreamer/gst-ffmpeg/ext/ffmpeg/gstffmpegdec.c,v
retrieving revision 1.109
diff -u -r1.109 gstffmpegdec.c
--- ext/ffmpeg/gstffmpegdec.c	22 Jul 2005 16:07:02 -0000	1.109
+++ ext/ffmpeg/gstffmpegdec.c	26 Jul 2005 13:41:27 -0000
@@ -453,6 +453,10 @@
   /* get size and so */
   gst_ffmpeg_caps_with_codecid (oclass->in_plugin->id,
       oclass->in_plugin->type, caps, ffmpegdec->context);
+  if (!ffmpegdec->context->time_base.num) {
+    ffmpegdec->context->time_base.num = 1;
+    ffmpegdec->context->time_base.den = 25;
+  }
 
   /* get pixel aspect ratio if it's set */
   structure = gst_caps_get_structure (caps, 0);
@@ -807,7 +811,8 @@
             (2 * ffmpegdec->context->channels *
             ffmpegdec->context->sample_rate);
         ffmpegdec->next_ts += GST_BUFFER_DURATION (outbuf);
-        *in_ts += GST_BUFFER_DURATION (outbuf);
+	if (GST_CLOCK_TIME_IS_VALID (*in_ts))
+          *in_ts += GST_BUFFER_DURATION (outbuf);
       } else if (len > 0 && have_data == 0) {
         /* cache output, because it may be used for caching (in-place) */
         ffmpegdec->last_buffer = outbuf;
@@ -973,8 +978,12 @@
       gint res;
       gint64 ffpts;
       AVRational bq = { 1, 1000000000 };
-      
-      ffpts = av_rescale_q (in_ts, bq, ffmpegdec->context->time_base);
+
+      if (GST_CLOCK_TIME_IS_VALID (in_ts)) {
+        ffpts = av_rescale_q (in_ts, bq, ffmpegdec->context->time_base);
+      } else {
+        ffpts = AV_NOPTS_VALUE;
+      }
 
       res = av_parser_parse (ffmpegdec->pctx, ffmpegdec->context,
           &data, &size, bdata, bsize,
@@ -982,8 +991,13 @@
 
       GST_DEBUG_OBJECT (ffmpegdec, "Parsed video frame, res=%d, size=%d",
           res, size);
-      
-      in_ts = av_rescale_q (in_ts, ffmpegdec->context->time_base, bq);
+
+      if (ffmpegdec->pctx->pts != AV_NOPTS_VALUE) {
+        in_ts = av_rescale_q (ffmpegdec->pctx->pts,
+            ffmpegdec->context->time_base, bq);
+      } else {
+        in_ts = GST_CLOCK_TIME_NONE;
+      }
 
       if (res == 0 || size == 0)
         break;
Index: ext/ffmpeg/gstffmpegenc.c
===================================================================
RCS file: /cvs/gstreamer/gst-ffmpeg/ext/ffmpeg/gstffmpegenc.c,v
retrieving revision 1.69
diff -u -r1.69 gstffmpegenc.c
--- ext/ffmpeg/gstffmpegenc.c	20 Jul 2005 15:40:57 -0000	1.69
+++ ext/ffmpeg/gstffmpegenc.c	26 Jul 2005 13:41:27 -0000
@@ -479,9 +479,12 @@
       ffmpegenc->context->width, ffmpegenc->context->height);
   g_return_if_fail (frame_size == GST_BUFFER_SIZE (inbuf));
 
-  ffmpegenc->picture->pts =
-      av_rescale_q (GST_BUFFER_TIMESTAMP (inbuf),
-          bq, ffmpegenc->context->time_base);
+  if (GST_BUFFER_TIMESTAMP_IS_VALID (inbuf)) {
+    av_rescale_q (GST_BUFFER_TIMESTAMP (inbuf),
+        bq, ffmpegenc->context->time_base);
+  } else {
+    ffmpegenc->picture->pts = AV_NOPTS_VALUE;
+  }
 
   outbuf = gst_buffer_new_and_alloc (ffmpegenc->buffer_size);
   ret_size = avcodec_encode_video (ffmpegenc->context,
Index: ext/ffmpeg/gstffmpegmux.c
===================================================================
RCS file: /cvs/gstreamer/gst-ffmpeg/ext/ffmpeg/gstffmpegmux.c,v
retrieving revision 1.32
diff -u -r1.32 gstffmpegmux.c
--- ext/ffmpeg/gstffmpegmux.c	20 Jul 2005 15:40:57 -0000	1.32
+++ ext/ffmpeg/gstffmpegmux.c	26 Jul 2005 13:41:27 -0000
@@ -481,8 +487,12 @@
     ffmpegmux->context->streams[bufnum]->codec->frame_number++;
 
     /* set time */
-    pkt.pts = av_rescale_q (GST_BUFFER_TIMESTAMP (buf),
-        bq, ffmpegmux->context->streams[bufnum]->time_base);
+    if (GST_BUFFER_TIMESTAMP_IS_VALID (buf)) {
+      pkt.pts = av_rescale_q (GST_BUFFER_TIMESTAMP (buf),
+          bq, ffmpegmux->context->streams[bufnum]->time_base);
+    } else {
+      pkt.pts = AV_NOPTS_VALUE;
+    }
     pkt.dts = pkt.pts;
     pkt.data = GST_BUFFER_DATA (buf);
     pkt.size = GST_BUFFER_SIZE (buf);
