From: <tho...@fr...> - 2004-08-02 10:04:30
|
CVS Root: /home/cvs/gstreamer Module: gst-plugins Changes by: thomasvs Date: Mon Aug 02 2004 20:04:20 EST Log message: sync xvimagesink with ximagesink Modified files: . : ChangeLog sys/xvimage : xvimagesink.c xvimagesink.h Links: http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gst-plugins/ChangeLog.diff?r1=1.957&r2=1.958 http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gst-plugins/sys/xvimage/xvimagesink.c.diff?r1=1.81&r2=1.82 http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gst-plugins/sys/xvimage/xvimagesink.h.diff?r1=1.23&r2=1.24 ====Begin Diffs==== Index: ChangeLog =================================================================== RCS file: /home/cvs/gstreamer/gst-plugins/ChangeLog,v retrieving revision 1.957 retrieving revision 1.958 diff -u -d -r1.957 -r1.958 --- ChangeLog 2 Aug 2004 09:16:14 -0000 1.957 +++ ChangeLog 2 Aug 2004 10:04:08 -0000 1.958 @@ -1,5 +1,16 @@ 2004-08-02 Thomas Vander Stichele <thomas at apestaart dot org> + * sys/xvimage/xvimagesink.c: + (gst_xvimagesink_calculate_pixel_aspect_ratio), + (gst_xvimagesink_xcontext_clear), (gst_xvimagesink_sink_link), + (gst_xvimagesink_change_state), (gst_xvimagesink_buffer_alloc), + (gst_xvimagesink_set_property), (gst_xvimagesink_get_property), + (gst_xvimagesink_init), (gst_xvimagesink_class_init): + * sys/xvimage/xvimagesink.h: + apply similar PAR fixes as to ximagesink + +2004-08-02 Thomas Vander Stichele <thomas at apestaart dot org> patch from: Benjamin Otte * ext/lame/gstlame.c: (gst_lame_src_link), (gst_lame_init): Index: xvimagesink.c RCS file: /home/cvs/gstreamer/gst-plugins/sys/xvimage/xvimagesink.c,v retrieving revision 1.81 retrieving revision 1.82 diff -u -d -r1.81 -r1.82 --- xvimagesink.c 27 Jul 2004 16:43:24 -0000 1.81 +++ xvimagesink.c 2 Aug 2004 10:04:08 -0000 1.82 @@ -840,6 +840,11 @@ * which is the "physical" w/h divided by the w/h in pixels of the display */ ratio = xcontext->widthmm * xcontext->height / (xcontext->heightmm * xcontext->width); + /* DirectFB's X in 720x576 reports the physical dimensions wrong, so + * override here */ + if (xcontext->width == 720 && xcontext->height == 576) { + ratio = 4.0 * 576 / (3.0 * 720); + } GST_DEBUG ("calculated pixel aspect ratio: %f", ratio); /* now find the one from par[][2] with the lowest delta to the real one */ delta = DELTA (0); @@ -857,8 +862,13 @@ GST_DEBUG ("Decided on index %d (%d/%d)", index, par[index][0], par[index][1]); - g_value_init (&xcontext->par, GST_TYPE_FRACTION); - gst_value_set_fraction (&xcontext->par, par[index][0], par[index][1]); + g_free (xcontext->par); + xcontext->par = g_new0 (GValue, 1); + g_value_init (xcontext->par, GST_TYPE_FRACTION); + gst_value_set_fraction (xcontext->par, par[index][0], par[index][1]); + GST_DEBUG ("set xcontext PAR to %d/%d", + gst_value_get_fraction_numerator (xcontext->par), + gst_value_get_fraction_denominator (xcontext->par)); } /* This function gets the X Display and global info about it. Everything is @@ -1058,6 +1068,7 @@ g_list_free (xvimagesink->xcontext->channels_list); gst_caps_free (xvimagesink->xcontext->caps); + g_free (xvimagesink->xcontext->par); g_mutex_lock (xvimagesink->x_lock); @@ -1212,8 +1223,13 @@ video_par_d = 1; } /* get display's PAR */ - display_par_n = gst_value_get_fraction_numerator (&xvimagesink->par); - display_par_d = gst_value_get_fraction_denominator (&xvimagesink->par); + if (xvimagesink->par) { + display_par_n = gst_value_get_fraction_numerator (xvimagesink->par); + display_par_d = gst_value_get_fraction_denominator (xvimagesink->par); + } else { + display_par_n = 1; + display_par_d = 1; gst_value_set_fraction (&display_ratio, video_width * video_par_n * display_par_d, @@ -1296,6 +1312,12 @@ if (!xvimagesink->xcontext && !(xvimagesink->xcontext = gst_xvimagesink_xcontext_get (xvimagesink))) return GST_STATE_FAILURE; + /* update object's par with calculated one if not set yet */ + if (!xvimagesink->par) { + xvimagesink->par = g_new0 (GValue, 1); + gst_value_init_and_copy (xvimagesink->par, xvimagesink->xcontext->par); + GST_DEBUG_OBJECT (xvimagesink, "set calculated PAR on object's PAR"); + } /* call XSynchronize with the current value of synchronous */ GST_DEBUG_OBJECT (xvimagesink, "XSynchronize called with %s", xvimagesink->synchronous ? "TRUE" : "FALSE"); @@ -1445,7 +1467,7 @@ g_mutex_lock (xvimagesink->pool_lock); - /* Walking through the pool cleaning unsuable images and searching for a + /* Walking through the pool cleaning unusable images and searching for a suitable one */ while (not_found && xvimagesink->image_pool) { xvimage = xvimagesink->image_pool->data; @@ -1783,11 +1805,16 @@ } break; case ARG_PIXEL_ASPECT_RATIO: - if (!g_value_transform (value, &xvimagesink->par)) + g_free (xvimagesink->par); + xvimagesink->par = g_new0 (GValue, 1); + g_value_init (xvimagesink->par, GST_TYPE_FRACTION); + if (!g_value_transform (value, xvimagesink->par)) { g_warning ("Could not transform string to aspect ratio"); + gst_value_set_fraction (xvimagesink->par, 1, 1); GST_DEBUG_OBJECT (xvimagesink, "set PAR to %d/%d", - gst_value_get_fraction_numerator (&xvimagesink->par), - gst_value_get_fraction_denominator (&xvimagesink->par)); + gst_value_get_fraction_numerator (xvimagesink->par), + gst_value_get_fraction_denominator (xvimagesink->par)); default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); @@ -1825,7 +1852,8 @@ g_value_set_boolean (value, xvimagesink->synchronous); - g_value_transform (&xvimagesink->par, value); + if (xvimagesink->par) + g_value_transform (xvimagesink->par, value); @@ -1889,13 +1917,11 @@ xvimagesink->x_lock = g_mutex_new (); - g_value_init (&xvimagesink->par, GST_TYPE_FRACTION); - gst_value_set_fraction (&xvimagesink->par, 1, 1); - xvimagesink->image_pool = NULL; xvimagesink->pool_lock = g_mutex_new (); xvimagesink->synchronous = FALSE; + xvimagesink->par = NULL; GST_FLAG_SET (xvimagesink, GST_ELEMENT_THREAD_SUGGESTED); GST_FLAG_SET (xvimagesink, GST_ELEMENT_EVENT_AWARE); Index: xvimagesink.h RCS file: /home/cvs/gstreamer/gst-plugins/sys/xvimage/xvimagesink.h,v retrieving revision 1.23 retrieving revision 1.24 diff -u -d -r1.23 -r1.24 --- xvimagesink.h 27 Jul 2004 16:43:24 -0000 1.23 +++ xvimagesink.h 2 Aug 2004 10:04:08 -0000 1.24 @@ -81,7 +81,7 @@ gint width, height; gint widthmm, heightmm; - GValue par; /* calculated pixel aspect ratio */ + GValue *par; /* calculated pixel aspect ratio */ gboolean use_xshm; @@ -145,7 +145,7 @@ guint video_width, video_height; /* size of incoming video; * used as the size for XvImage */ - GValue par; /* object-set pixel aspect ratio */ + GValue *par; /* object-set pixel aspect ratio */ GstClockTime time; |