[xiph-commits] r14974 - trunk/theora/examples
giles at svn.xiph.org
giles at svn.xiph.org
Tue May 27 14:39:23 PDT 2008
Author: giles
Date: 2008-05-27 14:39:21 -0700 (Tue, 27 May 2008)
New Revision: 14974
Modified:
trunk/theora/examples/png2theora.c
Log:
Set eos properly in png2theora.
Modified: trunk/theora/examples/png2theora.c
===================================================================
--- trunk/theora/examples/png2theora.c 2008-05-27 21:27:51 UTC (rev 14973)
+++ trunk/theora/examples/png2theora.c 2008-05-27 21:39:21 UTC (rev 14974)
@@ -159,7 +159,7 @@
}
static int
-theora_write_frame(unsigned long w, unsigned long h, unsigned char *yuv)
+theora_write_frame(unsigned long w, unsigned long h, unsigned char *yuv, int last)
{
yuv_buffer yuv_buf;
ogg_packet op;
@@ -229,7 +229,7 @@
return 1;
}
- if(!theora_encode_packetout(&theora_td, 0, &op)) {
+ if(!theora_encode_packetout(&theora_td, last, &op)) {
fprintf(stderr, "%s: error: could not read packets\n",
option_output);
return 1;
@@ -474,11 +474,12 @@
input_directory, input_filter);
#endif
n = scandir (input_directory, &png_files, include_files, alphasort);
- for(i=0;i< n;i++) {
+ for(i=0;i<n;i++) {
unsigned int w;
unsigned int h;
unsigned char *yuv;
char input_png[1024];
+ int last = 0;
sprintf(input_png, "%s/%s", input_directory, png_files[i]->d_name);
@@ -523,7 +524,8 @@
theora_initialized = 1;
}
- if(theora_write_frame(w, h, yuv)) {
+ if(i >= n-1) last = 1;
+ if(theora_write_frame(w, h, yuv, last)) {
theora_close();
free(input_directory);
free(input_filter);
More information about the commits
mailing list