From 11c39abc9a99d5fcb0070988ffe0d773d9780875 Mon Sep 17 00:00:00 2001 From: Jan Schmidt Date: Tue, 22 Nov 2005 22:21:37 +0000 Subject: More fractional framerate conversions Original commit message from CVS: * ext/cairo/gsttextoverlay.c: (gst_text_overlay_init), (gst_text_overlay_setcaps), (gst_text_overlay_collected): * ext/cairo/gsttextoverlay.h: * ext/gdk_pixbuf/gstgdkpixbuf.c: (gst_gdk_pixbuf_sink_link): * ext/gdk_pixbuf/gstgdkpixbuf.h: * ext/libpng/gstpngdec.c: (gst_pngdec_init), (gst_pngdec_caps_create_and_set): * ext/libpng/gstpngdec.h: * ext/libpng/gstpngenc.c: (gst_pngenc_setcaps): * gst/alpha/gstalphacolor.c: (gst_alpha_color_set_caps): * gst/avi/gstavimux.c: (gst_avimux_init), (gst_avimux_vidsinkconnect): * gst/flx/gstflxdec.c: (gst_flxdec_chain): * gst/goom/gstgoom.c: (gst_goom_init), (gst_goom_src_setcaps), (gst_goom_src_negotiate), (gst_goom_chain): * gst/goom/gstgoom.h: * gst/matroska/matroska-demux.c: (gst_matroska_demux_video_caps): * gst/matroska/matroska-mux.c: (gst_matroska_mux_video_pad_setcaps): * sys/osxvideo/osxvideosink.h: * sys/osxvideo/osxvideosink.m: More fractional framerate conversions --- ext/libpng/gstpngdec.c | 5 +++-- ext/libpng/gstpngdec.h | 3 ++- ext/libpng/gstpngenc.c | 10 ++++++---- 3 files changed, 11 insertions(+), 7 deletions(-) (limited to 'ext/libpng') diff --git a/ext/libpng/gstpngdec.c b/ext/libpng/gstpngdec.c index 42acbc2c..67a19e7e 100644 --- a/ext/libpng/gstpngdec.c +++ b/ext/libpng/gstpngdec.c @@ -155,7 +155,8 @@ gst_pngdec_init (GstPngDec * pngdec) pngdec->width = -1; pngdec->height = -1; pngdec->bpp = -1; - pngdec->fps = 0.0; + pngdec->fps_n = 0; + pngdec->fps_d = 1; } static void @@ -336,7 +337,7 @@ gst_pngdec_caps_create_and_set (GstPngDec * pngdec) "width", G_TYPE_INT, pngdec->width, "height", G_TYPE_INT, pngdec->height, "bpp", G_TYPE_INT, pngdec->bpp, - "framerate", G_TYPE_DOUBLE, pngdec->fps, NULL); + "framerate", GST_TYPE_FRACTION, pngdec->fps_n, pngdec->fps_d, NULL); templ = gst_static_pad_template_get (&gst_pngdec_src_pad_template); diff --git a/ext/libpng/gstpngdec.h b/ext/libpng/gstpngdec.h index 5f5cdca9..9930b83a 100644 --- a/ext/libpng/gstpngdec.h +++ b/ext/libpng/gstpngdec.h @@ -58,7 +58,8 @@ struct _GstPngDec gint height; gint bpp; gint color_type; - gdouble fps; + gint fps_n; + gint fps_d; }; struct _GstPngDecClass diff --git a/ext/libpng/gstpngenc.c b/ext/libpng/gstpngenc.c index f0ce7b8a..261f4208 100644 --- a/ext/libpng/gstpngenc.c +++ b/ext/libpng/gstpngenc.c @@ -63,7 +63,7 @@ GST_STATIC_PAD_TEMPLATE ("src", GST_PAD_ALWAYS, GST_STATIC_CAPS ("image/png, " "width = (int) [ 16, 4096 ], " - "height = (int) [ 16, 4096 ], " "framerate = (double) [ 0.0, MAX ]") + "height = (int) [ 16, 4096 ], " "framerate = (fraction) [ 0.0, MAX ]") ); static GstStaticPadTemplate pngenc_sink_template = @@ -147,7 +147,7 @@ static gboolean gst_pngenc_setcaps (GstPad * pad, GstCaps * caps) { GstPngEnc *pngenc; - gdouble fps; + const GValue *fps; GstStructure *structure; GstCaps *pcaps; gboolean ret = TRUE; @@ -158,15 +158,17 @@ gst_pngenc_setcaps (GstPad * pad, GstCaps * caps) structure = gst_caps_get_structure (caps, 0); gst_structure_get_int (structure, "width", &pngenc->width); gst_structure_get_int (structure, "height", &pngenc->height); - gst_structure_get_double (structure, "framerate", &fps); + fps = gst_structure_get_value (structure, "framerate"); gst_structure_get_int (structure, "bpp", &pngenc->bpp); opeer = gst_pad_get_peer (pngenc->srcpad); if (opeer) { pcaps = gst_caps_new_simple ("image/png", - "framerate", G_TYPE_DOUBLE, fps, "width", G_TYPE_INT, pngenc->width, "height", G_TYPE_INT, pngenc->height, NULL); + structure = gst_caps_get_structure (pcaps, 0); + gst_structure_set_value (structure, "framerate", fps); + if (gst_pad_accept_caps (opeer, pcaps)) { gst_pad_set_caps (pngenc->srcpad, pcaps); } else -- cgit