changeset 3:328eadb3f37e src

Added initial example programs directory and make sure all debug/error output goes to stderr.
author richwareham
date Mon, 01 Apr 2002 18:56:28 +0000
parents 80d67d4570b7
children 99bed5d6db2f
files dvdnav.c highlight.c read_cache.c searching.c vm.c
diffstat 5 files changed, 42 insertions(+), 36 deletions(-) [+]
line wrap: on
line diff
--- a/dvdnav.c	Wed Mar 20 23:41:30 2002 +0000
+++ b/dvdnav.c	Mon Apr 01 18:56:28 2002 +0000
@@ -106,10 +106,10 @@
     printerr("Passed a NULL pointer");
     return S_ERR;
   }
-  printf("dvdnav:close:called\n");
+  fprintf(stderr,"dvdnav:close:called\n");
   if (self->file) {
     DVDCloseFile(self->file);
-    printf("dvdnav:close:file closing\n");
+    fprintf(stderr,"dvdnav:close:file closing\n");
     self->file = NULL;
   }
 
@@ -119,7 +119,7 @@
   }
   if (self->file) {
     DVDCloseFile(self->file);
-    printf("dvdnav:close2:file closing\n");
+    fprintf(stderr,"dvdnav:close2:file closing\n");
     self->file = NULL;
   }
   pthread_mutex_destroy(&self->vm_lock);
@@ -143,7 +143,7 @@
 char* dvdnav_err_to_string(dvdnav_t *self) {
   if(!self) {
     /* Shold this be "passed a NULL pointer?" */
-    return NULL;
+    return "Hey! You gave me a NULL pointer you naughty person!";
   }
   
   return self->err_str;
@@ -165,7 +165,7 @@
 
 
   if (p==NULL) {
-    printf("Passed a NULL pointer.\n");
+    fprintf(stderr,"Passed a NULL pointer.\n");
     return 0;
   }
 
@@ -198,7 +198,7 @@
   /* we should now have a PES packet here */
 
   if (p[0] || p[1] || (p[2] != 1)) {
-    printf("demux error! %02x %02x %02x (should be 0x000001) \n",p[0],p[1],p[2]);
+    fprintf(stderr,"demux error! %02x %02x %02x (should be 0x000001) \n",p[0],p[1],p[2]);
     return 0;
   }
 
@@ -329,11 +329,11 @@
 
   if(self->spu_clut_changed) {
     (*event) = DVDNAV_SPU_CLUT_CHANGE;
-    printf("libdvdnav:SPU_CLUT_CHANGE\n");
+    fprintf(stderr,"libdvdnav:SPU_CLUT_CHANGE\n");
     (*len) = sizeof(dvdnav_still_event_t);
     memcpy(buf, &(state->pgc->palette), 16 * sizeof(uint32_t));
     self->spu_clut_changed = 0;
-    printf("libdvdnav:SPU_CLUT_CHANGE returning S_OK\n");
+    fprintf(stderr,"libdvdnav:SPU_CLUT_CHANGE returning S_OK\n");
     pthread_mutex_unlock(&self->vm_lock); 
     return S_OK;
   }
@@ -341,12 +341,12 @@
   if(self->spu_stream_changed) {
     dvdnav_stream_change_event_t stream_change;
     (*event) = DVDNAV_SPU_STREAM_CHANGE;
-    printf("libdvdnav:SPU_STREAM_CHANGE\n");
+    fprintf(stderr,"libdvdnav:SPU_STREAM_CHANGE\n");
     (*len) = sizeof(dvdnav_stream_change_event_t);
     stream_change.physical= vm_get_subp_active_stream( self->vm );
     memcpy(buf, &(stream_change), sizeof( dvdnav_stream_change_event_t));
     self->spu_stream_changed = 0;
-    printf("libdvdnav:SPU_STREAM_CHANGE stream_id=%d returning S_OK\n",stream_change.physical);
+    fprintf(stderr,"libdvdnav:SPU_STREAM_CHANGE stream_id=%d returning S_OK\n",stream_change.physical);
     pthread_mutex_unlock(&self->vm_lock); 
     return S_OK;
   }
@@ -354,12 +354,12 @@
   if(self->audio_stream_changed) {
     dvdnav_stream_change_event_t stream_change;
     (*event) = DVDNAV_AUDIO_STREAM_CHANGE;
-    printf("libdvdnav:AUDIO_STREAM_CHANGE\n");
+    fprintf(stderr,"libdvdnav:AUDIO_STREAM_CHANGE\n");
     (*len) = sizeof(dvdnav_stream_change_event_t);
     stream_change.physical= vm_get_audio_active_stream( self->vm );
     memcpy(buf, &(stream_change), sizeof( dvdnav_stream_change_event_t));
     self->audio_stream_changed = 0;
-    printf("libdvdnav:AUDIO_STREAM_CHANGE stream_id=%d returning S_OK\n",stream_change.physical);
+    fprintf(stderr,"libdvdnav:AUDIO_STREAM_CHANGE stream_id=%d returning S_OK\n",stream_change.physical);
     pthread_mutex_unlock(&self->vm_lock); 
     return S_OK;
   }
@@ -508,7 +508,7 @@
       /* FIXME:Need to handle seeking outside current cell. */
       vobu_admap_t *admap = NULL;
 	
-      printf("Seeking to target %u ...\n",
+      fprintf(stderr,"Seeking to target %u ...\n",
               self->seekto_block);
 
       /* Search through the VOBU_ADMAP for the nearest VOBU
@@ -531,7 +531,7 @@
           admap = self->vm->vtsi->vts_vobu_admap;
           break;
         default:
-          printf("Error: Unknown domain for seeking seek.\n");
+          fprintf(stderr,"Error: Unknown domain for seeking seek.\n");
       }
 
       if(admap) {
@@ -566,13 +566,13 @@
           pthread_mutex_unlock(&self->vm_lock); 
           return S_OK;
         } else {
-          printf("Could not locate block\n");
+          fprintf(stderr,"Could not locate block\n");
           return -1;
         }
       }
     }   
     if(self->jumping) {
-      printf("doing jumping\n");
+      fprintf(stderr,"doing jumping\n");
       self->vobu_start = self->jmp_vobu_start;
       self->blockN = self->jmp_blockN;
       self->jumping = 0;
@@ -603,9 +603,9 @@
     nav_event.dsi = &(self->dsi);
 
     (*event) = DVDNAV_NAV_PACKET;
-    //memcpy(buf, &(nav_event), sizeof(dvdnav_nav_packet_event_t));
-    //(*len) = sizeof(dvdnav_nav_packet_event_t);
-    (*len) = 2048;
+    /* memcpy(buf, &(nav_event), sizeof(dvdnav_nav_packet_event_t));
+    (*len) = sizeof(dvdnav_nav_packet_event_t); */
+    (*len) = 2048; 
     pthread_mutex_unlock(&self->vm_lock); 
     return S_OK;
   }
@@ -931,8 +931,11 @@
 
 /*
  * $Log$
- * Revision 1.1  2002/03/12 19:45:57  richwareham
- * Initial revision
+ * Revision 1.2  2002/04/01 18:56:28  richwareham
+ * Added initial example programs directory and make sure all debug/error output goes to stderr.
+ *
+ * Revision 1.1.1.1  2002/03/12 19:45:57  richwareham
+ * Initial import
  *
  * Revision 1.28  2002/02/02 23:26:20  richwareham
  * Restored title selection
--- a/highlight.c	Wed Mar 20 23:41:30 2002 +0000
+++ b/highlight.c	Mon Apr 01 18:56:28 2002 +0000
@@ -182,7 +182,7 @@
    return S_ERR;
   }
  
-  printf("Button select %i\n", button); 
+  fprintf(stderr,"Button select %i\n", button); 
   
   /* Set the highlight SPRM if the passed button was valid*/
   if((button <= 0) || (button > self->pci.hli.hl_gi.btn_ns)) {
@@ -214,7 +214,7 @@
   self->hli_buttonN = button;
   self->highlight_changed = 1;
 #ifdef BUTTON_TESTING
-  printf("highlight.c:Highlight area is (%u,%u)-(%u,%u), display = %i, button = %u\n",
+  fprintf(stderr,"highlight.c:Highlight area is (%u,%u)-(%u,%u), display = %i, button = %u\n",
 	       button_ptr->x_start, button_ptr->y_start,
 	       button_ptr->x_end, button_ptr->y_end,
 	       1,
--- a/read_cache.c	Wed Mar 20 23:41:30 2002 +0000
+++ b/read_cache.c	Mon Apr 01 18:56:28 2002 +0000
@@ -83,7 +83,7 @@
     return result;
   }
   
-  printf("DVD read cache miss! sector=%d, start=%d\n", sector, self->cache_start_sector); 
+  fprintf(stderr,"DVD read cache miss! sector=%d, start=%d\n", sector, self->cache_start_sector); 
   result = DVDReadBlocks( self->file, sector, block_count, buf);
   return result;
 }
--- a/searching.c	Wed Mar 20 23:41:30 2002 +0000
+++ b/searching.c	Mon Apr 01 18:56:28 2002 +0000
@@ -125,7 +125,7 @@
   }
 
   if(fnd_cell_nr <= last_cell_nr) {
-    printf("Seeking to cell %i from choice of %i to %i\n",
+    fprintf(stderr,"Seeking to cell %i from choice of %i to %i\n",
 	   fnd_cell_nr, first_cell_nr, last_cell_nr);
     self->seekto_block = target;
     self->seeking = 1;
@@ -148,7 +148,7 @@
 
 
 
-  printf("FIXME: Implement seeking to location %u\n", target); 
+  fprintf(stderr,"FIXME: Implement seeking to location %u\n", target); 
 
 //  self->seekto_block=target;
 //  self->seeking = 1;
@@ -167,20 +167,20 @@
   /* Make sure this is not the first chapter */
   
   if(state->pgN <= 1 ) {
-    printf("dvdnav: at first chapter. prev chapter failed.\n");
+    fprintf(stderr,"dvdnav: at first chapter. prev chapter failed.\n");
     return S_ERR;
   }
-  printf("dvdnav: previous chapter\n");
+  fprintf(stderr,"dvdnav: previous chapter\n");
   vm_jump_prog(self->vm, state->pgN - 1);
   dvdnav_do_post_jump(self);
-  printf("dvdnav: previous chapter done\n");
+  fprintf(stderr,"dvdnav: previous chapter done\n");
 
   return S_OK;
 }
 
 dvdnav_status_t dvdnav_top_pg_search(dvdnav_t *self) {
 
-  printf("dvdnav: top chapter. NOP.\n");
+  fprintf(stderr,"dvdnav: top chapter. NOP.\n");
   
   return S_OK;
 }
@@ -190,13 +190,13 @@
   state = &(self->vm->state);
   /* Make sure this is not the last chapter */
   if(state->pgN >= state->pgc->nr_of_programs) {
-    printf("dvdnav: at last chapter. next chapter failed.\n");
+    fprintf(stderr,"dvdnav: at last chapter. next chapter failed.\n");
     return S_ERR;
   }
-  printf("dvdnav: next chapter\n");
+  fprintf(stderr,"dvdnav: next chapter\n");
   vm_jump_prog(self->vm, state->pgN + 1);
   dvdnav_do_post_jump(self);
-  printf("dvdnav: next chapter done\n");
+  fprintf(stderr,"dvdnav: next chapter done\n");
 
   return S_OK;
 }
--- a/vm.c	Wed Mar 20 23:41:30 2002 +0000
+++ b/vm.c	Mon Apr 01 18:56:28 2002 +0000
@@ -453,7 +453,7 @@
 int vm_get_audio_stream(vm_t *self, int audioN)
 {
   int streamN = -1;
-  printf("dvdnav:vm.c:get_audio_stream audioN=%d\n",audioN); 
+  fprintf(stderr,"dvdnav:vm.c:get_audio_stream audioN=%d\n",audioN); 
   if((self->state).domain == VTSM_DOMAIN 
      || (self->state).domain == VMGM_DOMAIN
      || (self->state).domain == FP_DOMAIN) {
@@ -1522,8 +1522,11 @@
 
 /*
  * $Log$
- * Revision 1.1  2002/03/12 19:45:55  richwareham
- * Initial revision
+ * Revision 1.2  2002/04/01 18:56:28  richwareham
+ * Added initial example programs directory and make sure all debug/error output goes to stderr.
+ *
+ * Revision 1.1.1.1  2002/03/12 19:45:55  richwareham
+ * Initial import
  *
  * Revision 1.18  2002/01/22 16:56:49  jcdutton
  * Fix clut after seeking.