rpms/gstreamer-plugins-base/OLPC-2 gst-theora-alloc-right-buffer-size.patch, NONE, 1.1 gst-theora-discontinuous-buffers.patch, NONE, 1.1 gst-theora-init-fix.patch, NONE, 1.1 gstreamer-plugins-base-0.10.9-docs.patch, NONE, 1.1 gstvideorate-145-146.patch, NONE, 1.1 gstvideorate-146-147.patch, NONE, 1.1 gstvideorate-147-148.patch, NONE, 1.1 gstvideorate-148-149.patch, NONE, 1.1 gstvideorate-leakfix.patch, NONE, 1.1 gstreamer-plugins-base.spec, 1.27, 1.28

John (J5) Palmieri (johnp) fedora-extras-commits at redhat.com
Mon Jun 18 18:53:26 UTC 2007


Author: johnp

Update of /cvs/extras/rpms/gstreamer-plugins-base/OLPC-2
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv15943

Modified Files:
	gstreamer-plugins-base.spec 
Added Files:
	gst-theora-alloc-right-buffer-size.patch 
	gst-theora-discontinuous-buffers.patch 
	gst-theora-init-fix.patch 
	gstreamer-plugins-base-0.10.9-docs.patch 
	gstvideorate-145-146.patch gstvideorate-146-147.patch 
	gstvideorate-147-148.patch gstvideorate-148-149.patch 
	gstvideorate-leakfix.patch 
Log Message:
- add patches for fixing video on the OLPC and rebuild


gst-theora-alloc-right-buffer-size.patch:

--- NEW FILE gst-theora-alloc-right-buffer-size.patch ---
--- gst-plugins-base-0.10.10.1/ext/theora/theoraenc.c	2007/01/29 18:14:25	1.60
+++ gst-plugins-base-0.10.10.1/ext/theora/theoraenc.c	2007/04/15 14:35:53	1.61
@@ -420,14 +420,17 @@
     GstClockTime timestamp, GstClockTime duration, GstBuffer ** buffer)
 {
   GstBuffer *buf;
-  GstFlowReturn ret;
+  GstFlowReturn ret = GST_FLOW_OK;
 
-  ret = gst_pad_alloc_buffer_and_set_caps (enc->srcpad,
-      GST_BUFFER_OFFSET_NONE, packet->bytes, GST_PAD_CAPS (enc->srcpad), &buf);
-  if (ret != GST_FLOW_OK)
-    goto no_buffer;
+  buf = gst_buffer_new_and_alloc (packet->bytes);
+  if (!buf) {
+    GST_WARNING_OBJECT (enc, "Could not allocate buffer");
+    ret = GST_FLOW_ERROR;
+    goto done;
+  }
 
   memcpy (GST_BUFFER_DATA (buf), packet->packet, packet->bytes);
+  gst_buffer_set_caps (buf, GST_PAD_CAPS (enc->srcpad));
   /* see ext/ogg/README; OFFSET_END takes "our" granulepos, OFFSET its
    * time representation */
   GST_BUFFER_OFFSET_END (buf) =
@@ -453,14 +456,9 @@
   }
   enc->packetno++;
 
+done:
   *buffer = buf;
   return ret;
-
-no_buffer:
-  {
-    *buffer = NULL;
-    return ret;
-  }
 }
 
 /* push out the buffer and do internal bookkeeping */
@@ -610,14 +608,15 @@
 
   in_time = GST_BUFFER_TIMESTAMP (buffer);
 
-  /* no packets written yet, setup headers */
   if (enc->packetno == 0) {
+    /* no packets written yet, setup headers */
     GstCaps *caps;
     GstBuffer *buf1, *buf2, *buf3;
 
     enc->granulepos_offset = 0;
     enc->timestamp_offset = 0;
 
+    GST_DEBUG_OBJECT (enc, "output headers");
     /* Theora streams begin with three headers; the initial header (with
        most of the codec setup parameters) which is mandated by the Ogg
        bitstream spec.  The second header holds any comment fields.  The
@@ -717,6 +716,7 @@
     y_size = enc->info_width * enc->info_height;
 
     if (enc->width == enc->info_width && enc->height == enc->info_height) {
+      GST_LOG_OBJECT (enc, "no cropping/conversion needed");
       /* easy case, no cropping/conversion needed */
       pixels = GST_BUFFER_DATA (buffer);
 
@@ -735,6 +735,7 @@
       gint cwidth, cheight;
       gint offset_x, right_x, right_border;
 
+      GST_LOG_OBJECT (enc, "cropping/conversion needed for strides");
       /* source width/height */
       width = enc->width;
       height = enc->height;
@@ -750,11 +751,13 @@
       dst_y_stride = enc->info_width;
       dst_uv_stride = enc->info_width / 2;
 
-      ret = gst_pad_alloc_buffer_and_set_caps (enc->srcpad,
-          GST_BUFFER_OFFSET_NONE, y_size * 3 / 2, GST_PAD_CAPS (enc->srcpad),
-          &newbuf);
-      if (ret != GST_FLOW_OK)
+      newbuf = gst_buffer_new_and_alloc (y_size * 3 / 2);
+      if (!newbuf) {
+        ret = GST_FLOW_ERROR;
         goto no_buffer;
+      }
+      GST_BUFFER_OFFSET (newbuf) = GST_BUFFER_OFFSET_NONE;
+      gst_buffer_set_caps (newbuf, GST_PAD_CAPS (enc->srcpad));
 
       dest_y = yuv.y = GST_BUFFER_DATA (newbuf);
       dest_u = yuv.u = yuv.y + y_size;
@@ -891,7 +894,6 @@
   }
 no_buffer:
   {
-    gst_buffer_unref (buffer);
     return ret;
   }
 data_push:

gst-theora-discontinuous-buffers.patch:

--- NEW FILE gst-theora-discontinuous-buffers.patch ---
--- gst-plugins-base-0.10.10.1/ext/theora/gsttheoraenc.h	2006/06/01 19:19:49	1.5
+++ gst-plugins-base-0.10.10.1/ext/theora/gsttheoraenc.h	2006/11/22 14:34:03	1.6
@@ -93,6 +93,9 @@
   gint fps_n, fps_d;
   GstClockTime next_ts;
 
+  GstClockTime expected_ts;
+  gboolean next_discont;
+
   guint packetno;
   guint64 bytes_out;
   guint64 granulepos_offset;
--- gst-plugins-base-0.10.10.1/ext/theora/theoraenc.c	2006/05/23 20:38:56	1.57
+++ gst-plugins-base-0.10.10.1/ext/theora/theoraenc.c	2006/11/22 14:34:03	1.58
@@ -292,6 +292,7 @@
   GST_DEBUG_OBJECT (enc,
       "keyframe_frequency_force is %d, granule shift is %d",
       enc->info.keyframe_frequency_force, enc->granule_shift);
+  enc->expected_ts = GST_CLOCK_TIME_NONE;
 }
 
 static void
@@ -307,6 +308,26 @@
   G_OBJECT_CLASS (parent_class)->finalize (object);
 }
 
+static void
+theora_enc_reset (GstTheoraEnc * enc)
+{
+  theora_clear (&enc->state);
+  theora_encode_init (&enc->state, &enc->info);
+}
+
+static void
+theora_enc_clear (GstTheoraEnc * enc)
+{
+  enc->packetno = 0;
+  enc->bytes_out = 0;
+  enc->granulepos_offset = 0;
+  enc->timestamp_offset = 0;
+
+  enc->next_ts = GST_CLOCK_TIME_NONE;
+  enc->next_discont = FALSE;
+  enc->expected_ts = GST_CLOCK_TIME_NONE;
+}
+
 static gboolean
 theora_enc_sink_setcaps (GstPad * pad, GstCaps * caps)
 {
@@ -374,7 +395,7 @@
       "keyframe_frequency_force is %d, granule shift is %d",
       enc->info.keyframe_frequency_force, enc->granule_shift);
 
-  theora_encode_init (&enc->state, &enc->info);
+  theora_enc_reset (enc);
 
   gst_object_unref (enc);
 
@@ -418,6 +439,11 @@
   GST_BUFFER_TIMESTAMP (buf) = timestamp + enc->timestamp_offset;
   GST_BUFFER_DURATION (buf) = duration;
 
+  if (enc->next_discont) {
+    GST_BUFFER_FLAG_SET (buf, GST_BUFFER_FLAG_DISCONT);
+    enc->next_discont = FALSE;
+  }
+
   /* the second most significant bit of the first data byte is cleared
    * for keyframes */
   if ((packet->packet[0] & 0x40) == 0) {
@@ -543,6 +569,34 @@
   return res;
 }
 
+static gboolean
+theora_enc_is_discontinuous (GstTheoraEnc * enc, GstBuffer * buffer)
+{
+  GstClockTime ts = GST_BUFFER_TIMESTAMP (buffer);
+  GstClockTimeDiff max_diff;
+
+  /* Allow 3/4 a frame off */
+  max_diff = (enc->info.fps_denominator * GST_SECOND * 3) /
+      (enc->info.fps_numerator * 4);
+
+  if (ts != GST_CLOCK_TIME_NONE && enc->expected_ts != GST_CLOCK_TIME_NONE) {
+    if ((GstClockTimeDiff) (ts - enc->expected_ts) > max_diff) {
+      GST_DEBUG_OBJECT (enc, "Incoming TS %" GST_TIME_FORMAT
+          " exceeds expected value %" GST_TIME_FORMAT
+          " by too much, marking discontinuity",
+          GST_TIME_ARGS (ts), GST_TIME_ARGS (enc->expected_ts));
+      return TRUE;
+    }
+  }
+
+  if (GST_CLOCK_TIME_IS_VALID (GST_BUFFER_DURATION (buffer)))
+    enc->expected_ts = ts + GST_BUFFER_DURATION (buffer);
+  else
+    enc->expected_ts = GST_CLOCK_TIME_NONE;
+
+  return FALSE;
+}
+
 static GstFlowReturn
 theora_enc_chain (GstPad * pad, GstBuffer * buffer)
 {
@@ -784,6 +838,16 @@
       buffer = newbuf;
     }
 
+    if (theora_enc_is_discontinuous (enc, buffer)) {
+      theora_enc_reset (enc);
+      enc->granulepos_offset =
+          gst_util_uint64_scale (GST_BUFFER_TIMESTAMP (buffer), enc->fps_n,
+          GST_SECOND * enc->fps_d);
+      enc->timestamp_offset = GST_BUFFER_TIMESTAMP (buffer);
+      enc->next_ts = 0;
+      enc->next_discont = TRUE;
+    }
+
     res = theora_encode_YUVin (&enc->state, &yuv);
 
     ret = GST_FLOW_OK;
@@ -863,6 +927,8 @@
       theora_clear (&enc->state);
       theora_comment_clear (&enc->comment);
       theora_info_clear (&enc->info);
+
+      theora_enc_clear (enc);
       break;
     case GST_STATE_CHANGE_READY_TO_NULL:
       break;

gst-theora-init-fix.patch:

--- NEW FILE gst-theora-init-fix.patch ---
--- gst-plugins-base-0.10.10.1/ext/theora/gsttheoraenc.h	2006/11/22 14:34:03	1.6
+++ gst-plugins-base-0.10.10.1/ext/theora/gsttheoraenc.h	2007/04/19 16:58:53	1.7
@@ -72,6 +72,7 @@
   theora_state state;
   theora_info info;
   theora_comment comment;
+  gboolean initialised;
 
   gboolean center;
   GstTheoraEncBorderMode border;
--- gst-plugins-base-0.10.10.1/ext/theora/theoraenc.c	2007/04/15 14:35:53	1.61
+++ gst-plugins-base-0.10.10.1/ext/theora/theoraenc.c	2007/04/19 16:58:53	1.62
@@ -396,6 +396,7 @@
       enc->info.keyframe_frequency_force, enc->granule_shift);
 
   theora_enc_reset (enc);
+  enc->initialised = TRUE;
 
   gst_object_unref (enc);
 
@@ -550,14 +551,17 @@
 
   switch (GST_EVENT_TYPE (event)) {
     case GST_EVENT_EOS:
-      /* push last packet with eos flag */
-      while (theora_encode_packetout (&enc->state, 1, &op)) {
-        /* See comment in the chain function */
-        GstClockTime next_time = theora_granule_time (&enc->state,
-            granulepos_add (op.granulepos, 1, enc->granule_shift)) * GST_SECOND;
+      if (enc->initialised) {
+        /* push last packet with eos flag */
+        while (theora_encode_packetout (&enc->state, 1, &op)) {
+          /* See comment in the chain function */
+          GstClockTime next_time = theora_granule_time (&enc->state,
+              granulepos_add (op.granulepos, 1, enc->granule_shift)) *
+              GST_SECOND;
 
-        theora_push_packet (enc, &op, enc->next_ts, next_time - enc->next_ts);
-        enc->next_ts = next_time;
+          theora_push_packet (enc, &op, enc->next_ts, next_time - enc->next_ts);
+          enc->next_ts = next_time;
+        }
       }
       res = gst_pad_push_event (enc->srcpad, event);
       break;
@@ -945,6 +949,7 @@
       theora_info_clear (&enc->info);
 
       theora_enc_clear (enc);
+      enc->initialised = FALSE;
       break;
     case GST_STATE_CHANGE_READY_TO_NULL:
       break;

gstreamer-plugins-base-0.10.9-docs.patch:

--- NEW FILE gstreamer-plugins-base-0.10.9-docs.patch ---
--- gst-plugins-base-0.10.9/docs/Makefile.in.docs	2006-07-28 11:10:58.000000000 -0400
+++ gst-plugins-base-0.10.9/docs/Makefile.in	2006-07-28 11:11:11.000000000 -0400
@@ -384,11 +384,7 @@
 sharedstatedir = @sharedstatedir@
 sysconfdir = @sysconfdir@
 target_alias = @target_alias@
- at ENABLE_GTK_DOC_FALSE@GTK_DOC_DIRS = 
- at ENABLE_GTK_DOC_TRUE@GTK_DOC_DIRS = libs
- at ENABLE_PLUGIN_DOCS_FALSE@PLUGIN_DOCS_DIRS = 
- at ENABLE_PLUGIN_DOCS_TRUE@PLUGIN_DOCS_DIRS = plugins
-SUBDIRS = $(GTK_DOC_DIRS) $(PLUGIN_DOCS_DIRS)
+SUBDIRS = libs plugins
 DIST_SUBDIRS = libs plugins
 EXTRA_DIST = \
         version.entities.in

gstvideorate-145-146.patch:

--- NEW FILE gstvideorate-145-146.patch ---
--- gst-plugins-base-0.10.10.1/gst/videorate/gstvideorate.c	2006/10/10 12:49:02	1.45
+++ gst-plugins-base-0.10.10.1/gst/videorate/gstvideorate.c	2007/02/16 10:15:46	1.46
@@ -354,6 +354,7 @@
         videorate->from_rate_denominator = rate_denominator;
       }
       gst_pad_set_caps (otherpad, caps);
+      gst_caps_unref (caps);
       ret = TRUE;
     }
     gst_object_unref (opeer);

gstvideorate-146-147.patch:

--- NEW FILE gstvideorate-146-147.patch ---
--- gst-plugins-base-0.10.10.1/gst/videorate/gstvideorate.c	2007/02/16 10:15:46	1.46
+++ gst-plugins-base-0.10.10.1/gst/videorate/gstvideorate.c	2007/03/23 12:32:33	1.47
@@ -360,6 +360,10 @@
     gst_object_unref (opeer);
   }
 done:
+  /* After a setcaps, our caps may have changed. In that case, we can't use
+   * the old buffer, if there was one (it might have different dimensions) */
+  gst_video_rate_swap_prev (videorate, NULL, 0);
+
   gst_object_unref (videorate);
   return ret;
 
@@ -385,7 +389,7 @@
   videorate->out = 0;
   videorate->drop = 0;
   videorate->dup = 0;
-  videorate->next_ts = G_GINT64_CONSTANT (0);
+  videorate->next_ts = GST_CLOCK_TIME_NONE;
   gst_video_rate_swap_prev (videorate, NULL, 0);
 
   gst_segment_init (&videorate->segment, GST_FORMAT_TIME);
@@ -570,9 +574,11 @@
   if (videorate->prevbuf == NULL) {
     gst_video_rate_swap_prev (videorate, buffer, intime);
     videorate->in++;
-    /* new buffer, we expect to output a buffer that matches the first
-     * timestamp in the segment */
-    videorate->next_ts = videorate->segment.start;
+    if (!GST_CLOCK_TIME_IS_VALID (videorate->next_ts)) {
+      /* new buffer, we expect to output a buffer that matches the first
+       * timestamp in the segment */
+      videorate->next_ts = videorate->segment.start;
+    }
   } else {
     GstClockTime prevtime;
     gint count = 0;

gstvideorate-147-148.patch:

--- NEW FILE gstvideorate-147-148.patch ---
--- gst-plugins-base-0.10.10.1/gst/videorate/gstvideorate.c	2007/03/23 12:32:33	1.47
+++ gst-plugins-base-0.10.10.1/gst/videorate/gstvideorate.c	2007/03/29 11:24:47	1.48
@@ -438,6 +438,9 @@
   outbuf = gst_buffer_make_metadata_writable
       (gst_buffer_ref (videorate->prevbuf));
 
+  GST_BUFFER_OFFSET (outbuf) = videorate->out;
+  GST_BUFFER_OFFSET_END (outbuf) = videorate->out + 1;
+
   /* this is the timestamp we put on the buffer */
   push_ts = videorate->next_ts;
 

gstvideorate-148-149.patch:

--- NEW FILE gstvideorate-148-149.patch ---
--- gst-plugins-base-0.10.10.1/gst/videorate/gstvideorate.c	2007/03/29 11:24:47	1.48
+++ gst-plugins-base-0.10.10.1/gst/videorate/gstvideorate.c	2007/04/12 15:00:03	1.49
@@ -288,6 +288,8 @@
 
   videorate = GST_VIDEO_RATE (gst_pad_get_parent (pad));
 
+  GST_DEBUG ("setcaps called %" GST_PTR_FORMAT, caps);
+
   structure = gst_caps_get_structure (caps, 0);
   if (!gst_structure_get_fraction (structure, "framerate",
           &rate_numerator, &rate_denominator))
@@ -362,7 +364,8 @@
 done:
   /* After a setcaps, our caps may have changed. In that case, we can't use
    * the old buffer, if there was one (it might have different dimensions) */
-  gst_video_rate_swap_prev (videorate, NULL, 0);
+  GST_DEBUG ("swapping old buffers");
+  gst_video_rate_swap_prev (videorate, NULL, GST_CLOCK_TIME_NONE);
 
   gst_object_unref (videorate);
   return ret;
@@ -612,6 +615,7 @@
 
     /* got 2 buffers, see which one is the best */
     do {
+
       diff1 = prevtime - videorate->next_ts;
       diff2 = intime - videorate->next_ts;
 

gstvideorate-leakfix.patch:

--- NEW FILE gstvideorate-leakfix.patch ---
--- gst-plugins-base-0.10.10.1/gst/videorate/gstvideorate.c.leakfix	2007-04-23 17:25:13.000000000 -0400
+++ gst-plugins-base-0.10.10.1/gst/videorate/gstvideorate.c	2007-04-23 17:26:29.000000000 -0400
@@ -636,8 +636,10 @@
         count++;
 
         /* on error the _flush function posted a warning already */
-        if ((res = gst_video_rate_flush_prev (videorate)) != GST_FLOW_OK)
+        if ((res = gst_video_rate_flush_prev (videorate)) != GST_FLOW_OK) {
+          gst_buffer_unref (buffer);
           goto done;
+        }
       }
       /* continue while the first one was the best */
     }


Index: gstreamer-plugins-base.spec
===================================================================
RCS file: /cvs/extras/rpms/gstreamer-plugins-base/OLPC-2/gstreamer-plugins-base.spec,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -r1.27 -r1.28
--- gstreamer-plugins-base.spec	15 Jun 2007 03:36:58 -0000	1.27
+++ gstreamer-plugins-base.spec	18 Jun 2007 18:52:50 -0000	1.28
@@ -5,13 +5,21 @@
 
 Name: 		%{gstreamer}-plugins-base
 Version: 	0.10.12
-Release:  	3%{?dist}	
+Release:  	4%{?dist}	
 Summary: 	GStreamer streaming media framework base plug-ins
 
 Group: 		Applications/Multimedia
 License: 	LGPL
 URL:		http://gstreamer.freedesktop.org/
 Source:         http://gstreamer.freedesktop.org/src/gst-plugins-base/gst-plugins-base-%{version}.tar.bz2
+Patch2:                gst-theora-alloc-right-buffer-size.patch
+Patch3:                gst-theora-init-fix.patch
+Patch4:                gstvideorate-145-146.patch
+Patch5:                gstvideorate-146-147.patch
+Patch6:                gstvideorate-147-148.patch
+Patch7:                gstvideorate-148-149.patch
+Patch8:                gstvideorate-leakfix.patch
+
 BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 
 Requires:       %{gstreamer} >= %{_gst}
@@ -46,6 +54,13 @@
 
 %prep
 %setup -q -n gst-plugins-base-%{version}
+%patch2 -p1 -b .alloc-buffers
+%patch3 -p1 -b .gst-theora-init
+%patch5 -p1 -b .146-147
+%patch6 -p1 -b .147-148
+%patch7 -p1 -b .148-149
+%patch8 -p1 -b .leakfix
+
 
 %build
 %configure \
@@ -204,6 +219,9 @@
 %doc %{_datadir}/gtk-doc/html/gst-plugins-base-plugins-%{majorminor}
 
 %changelog
+* Mon Jun 18 2007 John (J5) Palmieri <johnp at redhat.com> - 0.10.12-4
+- add patches for fixing video on the OLPC and rebuild
+
 * Thu Jun 14 2007 John (J5) Palmieri <johnp at redhat.com> - 0.10.12-3
 - Remove libcdparanoia and rebuild for olpc2
 




More information about the fedora-extras-commits mailing list