[theora-dev] [PATCH] Fix for YUV4MPEG support in encoder_example
Henry Mason
hip245 at operamail.com
Mon Jun 9 19:50:33 PDT 2003
As was briefly discussed on IRC, ffmpeg and mplayer currently output
two somewhat incompatible YUV4MPEG streams. This meant that
encoder_example could take input from mplayer, but not ffmpeg or
movtoy4m (a QuickTime->Y4M tool).
This is a patch that fixes this issue and should allow encoder_example to
take input from either format:
diff -urd xiph-cvs/theora/examples/encoder_example.c xiph-cvs-new/
theora/examples/encoder_example.c
--- xiph-cvs/theora/examples/encoder_example.c Mon Jun
9 07:18:01 2003
+++ xiph-cvs-new/theora/examples/encoder_example.c Mon Jun
9 21:41:03 2003
@@ -375,11 +375,33 @@
for(i=state;i<2;i++){
char frame[6];
int ret=fread(frame,1,6,video);
-
+
+ /*
+ yuv4mpeg specs say this:
+
+ FRAMEHEADER consists of
+ string "FRAME " (note the space after the 'E')
+ unlimited number of ' ' (single space) separated TAGGEDFIELDs
+ single 'n' line terminator
+
+ ( http://roguelife.org/~fujita/MJPEG/yuv4mpeg.html )
+ MPlayer 0.9.0 writes "FRAME" with no space at the end, however.
+ To deal with this....
+ */
+
if(ret<6)break;
if(memcmp(frame,"FRAME\n",6)){
- fprintf(stderr,"Loss of framing in YUV input data\n");
- exit(1);
+ if(memcmp(frame,"FRAME ",6)){
+ fprintf(stderr,"Loss of framing in YUV input data\n");
+ exit(1);
+ } else {
+ ret=fread(frame,1,1,video);
+ if(ret<1)break;
+ if(memcmp(frame,"\n",1)){
+ fprintf(stderr,"Loss of framing in YUV input data\n");
+ exit(1);
+ }
+ }
}
/* read the Y plane into our frame buffer with centering */
<p>
--
____________________________________________
http://www.operamail.com
Get OperaMail Premium today - USD 29.99/year
<p>Powered by Outblaze
--- >8 ----
List archives: http://www.xiph.org/archives/
Ogg project homepage: http://www.xiph.org/ogg/
To unsubscribe from this list, send a message to 'theora-dev-request at xiph.org'
containing only the word 'unsubscribe' in the body. No subject is needed.
Unsubscribe messages sent to the list will be ignored/filtered.
More information about the Theora-dev
mailing list