? ChangeLog ? patch Index: osxvideosink.m =================================================================== RCS file: /cvs/gstreamer/gst-plugins-good/sys/osxvideo/osxvideosink.m,v retrieving revision 1.5 diff -u -r1.5 osxvideosink.m --- osxvideosink.m 23 Nov 2005 14:22:18 -0000 1.5 +++ osxvideosink.m 17 Dec 2006 04:42:49 -0000 @@ -282,49 +282,22 @@ /* Element stuff */ -static GstCaps * -gst_osxvideosink_fixate (GstPad * pad, const GstCaps * caps) +static gboolean +gst_osxvideosink_set_caps (GstBaseSink *sink, GstCaps *caps) { - GstStructure *structure; - GstCaps *newcaps; - GValue target_fps = { 0 }; - - if (gst_caps_get_size (caps) > 1) - return NULL; - - newcaps = gst_caps_copy (caps); - structure = gst_caps_get_structure (newcaps, 0); - - if (gst_structure_fixate_field_nearest_int (structure, "width", 320)) { - return newcaps; - } - if (gst_structure_fixate_field_nearest_int (structure, "height", 240)) { - return newcaps; - } - g_value_init (&target_fps, GST_TYPE_FRACTION); - gst_value_set_fraction (&target_fps, 25, 1); - gst_structure_fixate_field_nearest_fraction (s, "framerate", &target_fps); - - if (gst_structure_fixate_field_nearest_fraction (structure, "framerate", - &target_fps)) { - return newcaps; - } + GstOSXVideoSink *osxvideosink; - gst_caps_free (newcaps); - return NULL; -} + osxvideosink = GST_OSXVIDEOSINK (sink); -static GstCaps * -gst_osxvideosink_getcaps (GstPad * pad) -{ - GstOSXVideoSink *osxvideosink; + structure = gst_caps_get_structure (caps, 0); - osxvideosink = GST_OSXVIDEOSINK (gst_pad_get_parent (pad)); + gst_structure_get_int (structure, "width", &osxvideosink->width); + gst_structure_get_int (structure, "height", &osxvideosink->width); + gst_structure_get_fourcc (structure, "format", &osxvideosink->format); + gst_structure_get_fraction (structure, "framerate", + &osxvideosink->fps_n, &osxvideosink->fps_d); - return gst_caps_from_string ("video/x-raw-yuv, " - "format = (fourcc) YUY2, " - "framerate = (double) [ 1, 100 ], " - "width = (int) [ 0, MAX ], " "height = (int) [ 0, MAX ] "); + return TRUE; } static GstPadLinkReturn @@ -643,8 +616,6 @@ gst_osxvideosink_chain); gst_pad_set_link_function (GST_VIDEOSINK_PAD (osxvideosink), gst_osxvideosink_sink_link); - gst_pad_set_getcaps_function (GST_VIDEOSINK_PAD (osxvideosink), - gst_osxvideosink_getcaps); gst_pad_set_fixate_function (GST_VIDEOSINK_PAD (osxvideosink), gst_osxvideosink_fixate); gst_pad_set_bufferalloc_function (GST_VIDEOSINK_PAD (osxvideosink), @@ -707,6 +678,8 @@ G_PARAM_READWRITE)); gst_osxvideosink_signals[SIGNAL_VIEW_CREATED] = g_signal_new("view-created", G_TYPE_FROM_CLASS(klass), G_SIGNAL_RUN_CLEANUP, G_STRUCT_OFFSET (GstOSXVideoSinkClass, view_created), NULL, NULL, g_cclosure_marshal_VOID__POINTER, G_TYPE_NONE, 1, G_TYPE_POINTER); + + basesink_class->set_caps = gst_osxvideosink_set_caps; } /* ============================================================= */