summaryrefslogtreecommitdiffstats
path: root/ext
diff options
context:
space:
mode:
authorJan Schmidt <thaytan@mad.scientist.com>2005-11-22 22:21:37 +0000
committerJan Schmidt <thaytan@mad.scientist.com>2005-11-22 22:21:37 +0000
commit11c39abc9a99d5fcb0070988ffe0d773d9780875 (patch)
treec92b2175e0a98b9de7e969cb851c9dc8f0db59fb /ext
parentdad9986cb4646c0090a9c8408c1a1d9e00869ae2 (diff)
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
Diffstat (limited to 'ext')
-rw-r--r--ext/cairo/gsttextoverlay.c19
-rw-r--r--ext/cairo/gsttextoverlay.h3
-rw-r--r--ext/gdk_pixbuf/gstgdkpixbuf.c10
-rw-r--r--ext/gdk_pixbuf/gstgdkpixbuf.h3
-rw-r--r--ext/libpng/gstpngdec.c5
-rw-r--r--ext/libpng/gstpngdec.h3
-rw-r--r--ext/libpng/gstpngenc.c10
7 files changed, 34 insertions, 19 deletions
diff --git a/ext/cairo/gsttextoverlay.c b/ext/cairo/gsttextoverlay.c
index a6a889bd..b8bf1c87 100644
--- a/ext/cairo/gsttextoverlay.c
+++ b/ext/cairo/gsttextoverlay.c
@@ -251,7 +251,8 @@ gst_text_overlay_init (GstTextOverlay * overlay, GstTextOverlayClass * klass)
overlay->scale = 20;
gst_text_overlay_font_init (overlay);
- overlay->framerate = 0.0;
+ overlay->fps_n = 0;
+ overlay->fps_d = 1;
overlay->collect = gst_collect_pads_new ();
@@ -530,7 +531,7 @@ gst_text_overlay_setcaps (GstPad * pad, GstCaps * caps)
GstTextOverlay *overlay;
GstStructure *structure;
gboolean ret = FALSE;
- gdouble fps = 0.0;
+ const GValue *fps;
if (!GST_PAD_IS_SINK (pad))
return TRUE;
@@ -542,13 +543,16 @@ gst_text_overlay_setcaps (GstPad * pad, GstCaps * caps)
overlay->width = 0;
overlay->height = 0;
structure = gst_caps_get_structure (caps, 0);
+ fps = gst_structure_get_value (structure, "framerate");
+
if (gst_structure_get_int (structure, "width", &overlay->width) &&
- gst_structure_get_int (structure, "height", &overlay->height)) {
+ gst_structure_get_int (structure, "height", &overlay->height) &&
+ fps != NULL) {
ret = gst_pad_set_caps (overlay->srcpad, caps);
}
- (void) gst_structure_get_double (structure, "framerate", &fps);
- overlay->framerate = fps;
+ overlay->fps_n = gst_value_get_fraction_numerator (fps);
+ overlay->fps_d = gst_value_get_fraction_denominator (fps);
return ret;
}
@@ -780,8 +784,9 @@ gst_text_overlay_collected (GstCollectPads * pads, gpointer data)
if (GST_BUFFER_DURATION (video_frame) != GST_CLOCK_TIME_NONE) {
frame_end = now + GST_BUFFER_DURATION (video_frame);
- } else if (overlay->framerate > 0.0) {
- frame_end = now + (GST_SECOND / overlay->framerate);
+ } else if (overlay->fps_n > 0) {
+ frame_end = now + gst_util_clock_time_scale (GST_SECOND,
+ overlay->fps_d, overlay->fps_n);
} else {
/* magic value, does not really matter since texts
* tend to span quite a few frames in practice anyway */
diff --git a/ext/cairo/gsttextoverlay.h b/ext/cairo/gsttextoverlay.h
index 66cd11de..8f105ca0 100644
--- a/ext/cairo/gsttextoverlay.h
+++ b/ext/cairo/gsttextoverlay.h
@@ -51,7 +51,8 @@ struct _GstTextOverlay {
gint width;
gint height;
- gdouble framerate;
+ gint fps_n;
+ gint fps_d;
GstTextOverlayVAlign valign;
GstTextOverlayHAlign halign;
diff --git a/ext/gdk_pixbuf/gstgdkpixbuf.c b/ext/gdk_pixbuf/gstgdkpixbuf.c
index 5846b18e..9a602ea8 100644
--- a/ext/gdk_pixbuf/gstgdkpixbuf.c
+++ b/ext/gdk_pixbuf/gstgdkpixbuf.c
@@ -107,14 +107,18 @@ static GstPadLinkReturn
gst_gdk_pixbuf_sink_link (GstPad * pad, const GstCaps * caps)
{
GstGdkPixbuf *filter;
+ const GValue *fps;
filter = GST_GDK_PIXBUF (gst_pad_get_parent (pad));
g_return_val_if_fail (filter != NULL, GST_PAD_LINK_REFUSED);
g_return_val_if_fail (GST_IS_GDK_PIXBUF (filter), GST_PAD_LINK_REFUSED);
- filter->framerate = 1.0;
- gst_structure_get_double (gst_caps_get_structure (caps, 0), "framerate",
- &filter->framerate);
+ fps = gst_structure_get_value (gst_caps_get_structure (caps, 0), "framerate");
+ if (fps != NULL && GST_VALUE_HOLDS_FRACTION (fps)) {
+ filter->fps_n = gst_value_get_fraction_numerator (fps);
+ filter->fps_d = gst_value_get_fraction_denominator (fps);
+ } else
+ return GST_PAD_LINK_REFUSED;
return GST_PAD_LINK_OK;
}
diff --git a/ext/gdk_pixbuf/gstgdkpixbuf.h b/ext/gdk_pixbuf/gstgdkpixbuf.h
index dc308cc7..4a1f9a3d 100644
--- a/ext/gdk_pixbuf/gstgdkpixbuf.h
+++ b/ext/gdk_pixbuf/gstgdkpixbuf.h
@@ -56,7 +56,8 @@ struct _GstGdkPixbuf
int rowstride;
unsigned int image_size;
- double framerate;
+ gint fps_n;
+ gint fps_d;
};
struct _GstGdkPixbufClass
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