fix mpeg1 playback
authorRonald S. Bultje <rbultje@ronald.bitfreak.net>
Sun, 29 Dec 2002 22:59:45 +0000 (22:59 +0000)
committerRonald S. Bultje <rbultje@ronald.bitfreak.net>
Sun, 29 Dec 2002 22:59:45 +0000 (22:59 +0000)
Original commit message from CVS:
fix mpeg1 playback

ext/ffmpeg/gstffmpegall.c
ext/ffmpeg/gstffmpegallcodecmap.c

index 23d49bb..f267b0a 100644 (file)
@@ -163,9 +163,9 @@ GST_PAD_TEMPLATE_FACTORY(sink_templ,
     "gstffmpeg_sink_mpeg",
     "video/mpeg",
       "systemstream", GST_PROPS_BOOLEAN(FALSE),
-      "mpegversion",  GST_PROPS_INT(1),
+      "mpegversion",  GST_PROPS_INT(1) /*,
       "width",        GST_PROPS_INT_RANGE (16, 4096),
-      "height",       GST_PROPS_INT_RANGE (16, 4096)
+      "height",       GST_PROPS_INT_RANGE (16, 4096)*/
   ),
   GST_CAPS_NEW (
     "gstffmpeg_sink_jpeg",
@@ -288,18 +288,21 @@ gst_ffmpegdecall_connect (GstPad *pad, GstCaps *caps)
     return GST_PAD_CONNECT_REFUSED;
   }
 
-  /* set caps on src pad based on context.pix_fmt && width/height */
-  newcaps = gst_ffmpeg_codecid_to_caps(CODEC_ID_RAWVIDEO,
-                                       &ffmpegdec->context);
-  if (!newcaps) {
-    GST_DEBUG(GST_CAT_PLUGIN_INFO,
-              "Failed to create caps for other end (pix_fmt=%d)",
-              ffmpegdec->context.pix_fmt);
-    return GST_PAD_CONNECT_REFUSED;
+  if (ffmpegdec->context.width > 0 && ffmpegdec->context.height > 0) {
+    /* set caps on src pad based on context.pix_fmt && width/height */
+    newcaps = gst_ffmpeg_codecid_to_caps(CODEC_ID_RAWVIDEO,
+                                         &ffmpegdec->context);
+    if (!newcaps) {
+      GST_DEBUG(GST_CAT_PLUGIN_INFO,
+                "Failed to create caps for other end (pix_fmt=%d)",
+                ffmpegdec->context.pix_fmt);
+      return GST_PAD_CONNECT_REFUSED;
+    }
+
+    return gst_pad_try_set_caps(ffmpegdec->srcpad, newcaps);
   }
 
-  return gst_pad_try_set_caps(ffmpegdec->srcpad, newcaps);
-  /*return GST_PAD_CONNECT_OK;*/
+  return GST_PAD_CONNECT_OK;
 }
 
 static void
index 9f1638a..3a47db5 100644 (file)
@@ -719,8 +719,10 @@ gst_ffmpeg_caps_to_codecid (GstCaps        *caps,
   }
 
   if (video && context) {
-    gst_caps_get_int(caps, "width", &context->width);
-    gst_caps_get_int(caps, "height", &context->height);
+    if (gst_caps_has_property(caps, "width"))
+      gst_caps_get_int(caps, "width", &context->width);
+    if (gst_caps_has_property(caps, "height"))
+      gst_caps_get_int(caps, "height", &context->height);
 
     /* framerate (context->frame_rate)? but then, we'd need a GstPad* */