diff -r 47de5c5976bf -r d32867e8767b gmyth-stream/gmemcoder/src/gmencoder.c --- a/gmyth-stream/gmemcoder/src/gmencoder.c Tue Jul 03 22:45:24 2007 +0100 +++ b/gmyth-stream/gmemcoder/src/gmencoder.c Wed Jul 04 15:03:53 2007 +0100 @@ -75,7 +75,8 @@ static GstElement *_create_video_bin(const gchar * encode, gchar ** encode_prop, gdouble fps, - gint rate, guint width, guint height); + gint rate, guint width, guint height, + gboolean use_deinterlace); static gboolean _pipeline_bus_cb(GstBus * bus, GstMessage * msg, gpointer user_data); @@ -103,7 +104,8 @@ guint video_height, const gchar * audio_encode, gchar ** audio_encode_prop, - guint audio_rate); + guint audio_rate, + gboolean deinterlace); #ifdef USE_MANUAL_SINK static void _flush_queue (GMencoder *self); static void _buffer_arrive_cb (GstElement* object, @@ -240,7 +242,8 @@ g_value_set_float(&p, (float) atof (prop_val)); break; default: - g_warning ("Property %s of type %s. Not supported", + g_value_set_enum(&p, atoi(prop_val)); + g_warning ("Property %s of type %s. Not supported using default enum", prop_name, g_type_name (s->value_type)); return; } @@ -357,7 +360,8 @@ static GstElement * _create_video_bin(const gchar * encode, gchar ** encode_prop, - gdouble fps, gint rate, guint width, guint height) + gdouble fps, gint rate, guint width, guint height, + gboolean use_deinterlace) { GstElement *vbin = NULL; GstElement *vqueue = NULL; @@ -365,6 +369,8 @@ GstElement *vcolorspace = NULL; GstElement *vencode = NULL; GstElement *vrate = NULL; + GstElement *deinterlace = NULL; + GstElement *walk = NULL; GstPad *vpad = NULL; vbin = gst_bin_new("vbin"); @@ -372,6 +378,14 @@ vcolorspace = gst_element_factory_make("ffmpegcolorspace", "colorspace"); + if (use_deinterlace) { + deinterlace = gst_element_factory_make ("ffdeinterlace", "deinterlace"); + if (deinterlace == NULL) { + g_warning ("Fail to create deinterlace element: Continue without deinterlace."); + } + } + + vencode = _create_element_with_prop((encode != NULL ? encode : "ffenc_mpeg1video"), "vencode", @@ -387,19 +401,29 @@ gst_bin_add_many(GST_BIN(vbin), vqueue, vcolorspace, vencode, vqueue_src, NULL); + if (deinterlace != NULL) { + gst_bin_add(GST_BIN(vbin), deinterlace); + gst_element_link (vqueue, deinterlace); + walk = deinterlace; + } else { + walk = vqueue; + } + if ((width > 0) && (height > 0)) { // Scalling video GstCaps *vcaps; GstElement *vscale = gst_element_factory_make("videoscale", "vscale"); + g_object_set (G_OBJECT (vscale), "method", 1, NULL); + gst_bin_add(GST_BIN(vbin), vscale); vcaps = gst_caps_new_simple("video/x-raw-yuv", "width", G_TYPE_INT, width, "height", G_TYPE_INT, height, NULL); - gst_element_link(vqueue, vscale); + gst_element_link(walk, vscale); if (gst_element_link_filtered(vscale, vcolorspace, vcaps) == FALSE) { g_warning("Fail to resize video"); @@ -409,7 +433,7 @@ } gst_caps_unref(vcaps); } else { - gst_element_link(vqueue, vcolorspace); + gst_element_link(walk, vcolorspace); } if (fps > 0) { @@ -480,6 +504,7 @@ gboolean g_mencoder_setup_stream(GMencoder * self, gboolean chunked, + gboolean deinterlace, const gchar * mux_name, const gchar * video_encode, gchar ** video_encode_prop, @@ -513,7 +538,8 @@ video_width, video_height, audio_encode, audio_encode_prop, - audio_rate); + audio_rate, + deinterlace); return (priv->pipe != NULL); } @@ -674,7 +700,8 @@ guint video_width, guint video_height, const gchar * audio_encode, - gchar ** audio_encode_prop, guint audio_rate) + gchar ** audio_encode_prop, guint audio_rate, + gboolean deinterlace) { GstBus *bus = NULL; GstElement *pipe = NULL; @@ -729,7 +756,7 @@ vbin = _create_video_bin(video_encode, video_encode_prop, video_fps, - video_rate, video_width, video_height); + video_rate, video_width, video_height, deinterlace); if (vbin == NULL) goto error;