+2006-01-31 Andy Wingo <wingo@pobox.com>
+
+ * sys/v4l/gstv4lsrc.c (gst_v4lsrc_set_caps): Don't segfault if the
+ caps being set doesn't have a framerate value. Basically a stopgap
+ measure.
+
+ * ext/ogg/gstoggmux.c (GST_BUFFER_END_TIME): New macro. Not
+ technically correct enough to put into core though.
+ (gst_ogg_mux_dequeue_page): Use END_TIME instead of TIMESTAMP +
+ DURATION. Fixes theoraenc ! oggmux.
+
+ * sys/v4l/gstv4lsrc.c (gst_v4lsrc_fixate): Fixate to the nearest
+ fraction, not double.
+
2006-01-31 Sebastien Moutte <sebastien@moutte.net>
* win32/vs7:
- add vs7 project files created by Sergey Scobich
+ add vs7 project files created by Sergey Scobich
2006-01-30 Sebastien Moutte <sebastien@moutte.net>
* win32/vs8:
- add vs8 project files created by Sergey Scobich
+ add vs8 project files created by Sergey Scobich
2006-01-30 Andy Wingo <wingo@pobox.com>
#define GST_IS_OGG_MUX(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_OGG_MUX))
#define GST_IS_OGG_MUX_CLASS(obj) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_OGG_MUX))
+/* This isn't generally what you'd want with an end-time macro, because
+ technically the end time of a buffer with invalid duration is invalid. But
+ for sorting ogg pages this is what we want. */
+#define GST_BUFFER_END_TIME(buf) \
+ (GST_BUFFER_DURATION_IS_VALID (buf) \
+ ? GST_BUFFER_TIMESTAMP (buf) + GST_BUFFER_DURATION (buf) \
+ : GST_BUFFER_TIMESTAMP (buf))
+
#define GST_GP_FORMAT "[gp %8" G_GINT64_FORMAT "]"
typedef struct _GstOggMux GstOggMux;
if (buf) {
/* if no oldest buffer yet, take this one */
if (oldest == GST_CLOCK_TIME_NONE) {
- oldest = GST_BUFFER_TIMESTAMP (buf) + GST_BUFFER_DURATION (buf);
+ oldest = GST_BUFFER_END_TIME (buf);
opad = pad;
} else {
/* if we have an oldest, compare with this one */
- if (GST_BUFFER_TIMESTAMP (buf) + GST_BUFFER_DURATION (buf) < oldest) {
- oldest = GST_BUFFER_TIMESTAMP (buf) + GST_BUFFER_DURATION (buf);
+ if (GST_BUFFER_END_TIME (buf) < oldest) {
+ oldest = GST_BUFFER_END_TIME (buf);
opad = pad;
}
}
buf = g_queue_pop_head (opad->pagebuffers);
GST_LOG_OBJECT (opad,
GST_GP_FORMAT " pushing oldest page (end time %" GST_TIME_FORMAT ")",
- GST_BUFFER_OFFSET_END (buf),
- GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (buf) + GST_BUFFER_DURATION (buf)));
+ GST_BUFFER_OFFSET_END (buf), GST_TIME_ARGS (GST_BUFFER_END_TIME (buf)));
*flowret = gst_ogg_mux_push_buffer (mux, buf);
ret = TRUE;
}
gst_structure_fixate_field_nearest_int (structure, "width", targetwidth);
gst_structure_fixate_field_nearest_int (structure, "height", targetheight);
- gst_structure_fixate_field_nearest_double (structure, "framerate", 7.5);
+ gst_structure_fixate_field_nearest_fraction (structure, "framerate", 15, 2);
v = gst_structure_get_value (structure, "format");
if (v && G_VALUE_TYPE (v) != GST_TYPE_FOURCC) {
gst_structure_get_int (structure, "height", &h);
new_fps = gst_structure_get_value (structure, "framerate");
- GST_DEBUG_OBJECT (v4lsrc, "linking with %dx%d at %d/%d fps", w, h,
- gst_value_get_fraction_numerator (new_fps),
- gst_value_get_fraction_denominator (new_fps));
-
/* set framerate if it's not already correct */
if (!gst_v4lsrc_get_fps (v4lsrc, &cur_fps_n, &cur_fps_d))
return FALSE;
- if (gst_value_get_fraction_numerator (new_fps) != cur_fps_n ||
- gst_value_get_fraction_denominator (new_fps) != cur_fps_d) {
- int fps_index = (gst_value_get_fraction_numerator (new_fps) * 16) /
- (gst_value_get_fraction_denominator (new_fps) * 15);
-
- GST_DEBUG_OBJECT (v4lsrc, "Trying to set fps index %d", fps_index);
- /* set bits 16 to 21 to 0 */
- vwin->flags &= (0x3F00 - 1);
- /* set bits 16 to 21 to the index */
- vwin->flags |= fps_index << 16;
- if (!gst_v4l_set_window_properties (GST_V4LELEMENT (v4lsrc))) {
- return FALSE;
+ if (new_fps) {
+ GST_DEBUG_OBJECT (v4lsrc, "linking with %dx%d at %d/%d fps", w, h,
+ gst_value_get_fraction_numerator (new_fps),
+ gst_value_get_fraction_denominator (new_fps));
+
+ if (gst_value_get_fraction_numerator (new_fps) != cur_fps_n ||
+ gst_value_get_fraction_denominator (new_fps) != cur_fps_d) {
+ int fps_index = (gst_value_get_fraction_numerator (new_fps) * 16) /
+ (gst_value_get_fraction_denominator (new_fps) * 15);
+
+ GST_DEBUG_OBJECT (v4lsrc, "Trying to set fps index %d", fps_index);
+ /* set bits 16 to 21 to 0 */
+ vwin->flags &= (0x3F00 - 1);
+ /* set bits 16 to 21 to the index */
+ vwin->flags |= fps_index << 16;
+ if (!gst_v4l_set_window_properties (GST_V4LELEMENT (v4lsrc))) {
+ return FALSE;
+ }
}
}