[xiph-commits] r9064 - experimental/derf/theora-exp/lib

tterribe at motherfish-iii.xiph.org tterribe at motherfish-iii.xiph.org
Fri Mar 11 13:12:49 PST 2005


Author: tterribe
Date: 2005-03-11 13:12:47 -0800 (Fri, 11 Mar 2005)
New Revision: 9064

Modified:
   experimental/derf/theora-exp/lib/encode.c
   experimental/derf/theora-exp/lib/info.c
Log:
Set defaults in theora_info upon initialization so that only a
 minimal number of fields have to be set by the application.

Modified: experimental/derf/theora-exp/lib/encode.c
===================================================================
--- experimental/derf/theora-exp/lib/encode.c	2005-03-11 20:08:06 UTC (rev 9063)
+++ experimental/derf/theora-exp/lib/encode.c	2005-03-11 21:12:47 UTC (rev 9064)
@@ -477,7 +477,7 @@
   _qinfo: The quantization parameters.
           These are described in more detail in theora.h.
           This can be NULL, in which case the default quantization parameters
-           will be used.*
+           will be used.
   Return: 0 on success, or a negative value on error.
           OC_FAULT if _enc is NULL.
           OC_EINVAL if the setup header has already been written, or it cannot
@@ -2461,7 +2461,15 @@
 static int oc_enc_init(oc_enc_ctx *_enc,const theora_info *_info){
   int ret;
   /*Initialize the shared encoder/decoder state.*/
-  ret=oc_state_init(&_enc->state,_info);
+  if(_info->pic_width<=0||_info->pic_height<=0){
+    theora_info info;
+    memcpy(&info,_info,sizeof(info));
+    /*If the picture size is not specified, default to the rest of the frame.*/
+    if(info.pic_width<=0)info.pic_width=info.frame_width-info.pic_x;
+    if(info.pic_height<=0)info.pic_height=info.frame_height-info.pic_y;
+    ret=oc_state_init(&_enc->state,&info);
+  }
+  else ret=oc_state_init(&_enc->state,_info);
   if(ret<0)return ret;
   _enc->block_coded_flags=_ogg_calloc(_enc->state.nfrags,
    sizeof(_enc->block_coded_flags[0]));

Modified: experimental/derf/theora-exp/lib/info.c
===================================================================
--- experimental/derf/theora-exp/lib/info.c	2005-03-11 20:08:06 UTC (rev 9063)
+++ experimental/derf/theora-exp/lib/info.c	2005-03-11 21:12:47 UTC (rev 9064)
@@ -2,6 +2,7 @@
 #include <ctype.h>
 #include <string.h>
 #include "theora/theora.h"
+#include "internal.h"
 
 
 
@@ -21,6 +22,10 @@
 
 void theora_info_init(theora_info *_info){
   memset(_info,0,sizeof(*_info));
+  _info->version_major=OC_VERSION_MAJOR;
+  _info->version_minor=OC_VERSION_MINOR;
+  _info->version_subminor=OC_VERSION_SUB;
+  _info->keyframe_granule_shift=6;
 }
 
 void theora_info_clear(theora_info *_info){



More information about the commits mailing list