Re: Theora 1.0 RC2

Romain Beauxis <[email protected]>
Newsgroups gmane.comp.multimedia.ogg.theora.devel
Message-ID <[email protected]>
Le Wednesday 29 October 2008 01:03:54 Ivo Emanuel Gonçalves, vous avez écrit :
> Hello list,

	Hi list !

> Apologies are in order for the delay in getting 1.0 Final out, but the
> big word in the 1.0 release is STABILITY.  The core team has found
> some last minute bugs that needed ironing out and they are being taken
> care of.
>
> In spite of this, we are close to see a proper release very soon and,
> as a stop-gap, all the latest developments have been collected into a
> new Release Candidate which you are invited to try.

Thanks for your work on theora !

I am currently implementing theora for our application.
In our model for generating ogg streams, we may want to stop 
a stream while not providing a new YUV data buffer for encoding.

Current API doesn't allow such thing, since the eos flag is set by the 
packetout function only when the last_p parameter was passed *and* 
there was some data available to output.

Hence, I have written a function that forges this packet, along with NULL 
data, which is allowed by the ogg specifications (and works with other 
encoders, like speex).

Furthermore, since API claims that the 1-1 correspondance with YUV encoded 
buffer and ogg packet might not remain in the futur, I believe such function 
may be usefull in the case when 2, 3 or 4 buffers could be needed to fill a 
new ogg packet..

Patch is attached. I didn't test it yet, but it is mainly packetout's code. I 
believe it is correct, though I don't know if the granulepos and packetno 
should be incremented in this case.


Romain

_______________________________________________
theora-dev mailing list
[email protected]
http://lists.xiph.org/mailman/listinfo/theora-dev
add_async_eos.patch (text/x-diff, 1.4 KB)
--- libtheora-1.0.orig/include/theora/theora.h	2008-10-29 01:18:40.000000000 +0100
+++ libtheora-1.0/include/theora/theora.h	2008-10-29 01:21:29.000000000 +0100
@@ -487,6 +487,16 @@
                                     ogg_packet *op);
 
 /**
+ * Forge an end of stream packet, to close the current ogg logical stream.
+ * \param t A theora_state handle previously initialized for encoding.
+ * \param op An ogg_packet structure to fill. libtheora will set all
+ *           elements of this structure. The data pointer will be NULL.
+ * \retval 1 Success
+ */
+extern int theora_encode_eos( theora_state *t, ogg_packet *op);
+
+
+/**
  * Request a packet containing the initial header.
  * A pointer to the header data is placed in a user-provided ogg_packet
  * structure.
--- libtheora-1.0.orig/lib/enc/encoder_toplevel.c	2008-10-29 01:18:40.000000000 +0100
+++ libtheora-1.0/lib/enc/encoder_toplevel.c	2008-10-29 01:24:55.000000000 +0100
@@ -1147,6 +1147,23 @@
   return 1;
 }
 
+int theora_encode_eos( theora_state *t, ogg_packet *op){
+  CP_INSTANCE *cpi=(CP_INSTANCE *)(t->internal_encode);
+
+  op->packet=NULL;
+  op->bytes=0;
+  op->b_o_s=0;
+  op->e_o_s=1;
+
+  op->packetno=cpi->CurrentFrame;
+  op->granulepos=t->granulepos;
+
+  cpi->packetflag=0;
+  cpi->doneflag=1;
+
+  return 1;
+}
+
 static void _tp_writebuffer(oggpack_buffer *opb, const char *buf, const long len)
 {
   long i;
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.