[xiph-commits] r2882 - in liboggplay/trunk: include/oggplay plugin plugin/test src/liboggplay

shans at svn.annodex.net shans at svn.annodex.net
Fri Jun 8 01:34:00 PDT 2007


Author: shans
Date: 2007-06-08 01:34:00 -0700 (Fri, 08 Jun 2007)
New Revision: 2882

Modified:
   liboggplay/trunk/include/oggplay/oggplay_enums.h
   liboggplay/trunk/include/oggplay/oggplay_tools.h
   liboggplay/trunk/plugin/plugin_gui_linux.c
   liboggplay/trunk/plugin/plugin_oggplay.c
   liboggplay/trunk/plugin/plugin_tools.c
   liboggplay/trunk/plugin/test/test.html
   liboggplay/trunk/src/liboggplay/Version_script.in
   liboggplay/trunk/src/liboggplay/oggplay.c
   liboggplay/trunk/src/liboggplay/oggplay_callback.c
   liboggplay/trunk/src/liboggplay/oggplay_callback_info.c
   liboggplay/trunk/src/liboggplay/oggplay_data.c
   liboggplay/trunk/src/liboggplay/oggplay_private.h
Log:
1) some small fixes to account for moving timing functions into oggplay_tools
2) added OggPlayStreamInfo enum and accessor functions, to retrieve per-stream
information (uninitialised / first data / initialised / last data)
3) playing around with CMML callback code



Modified: liboggplay/trunk/include/oggplay/oggplay_enums.h
===================================================================
--- liboggplay/trunk/include/oggplay/oggplay_enums.h	2007-06-08 08:32:30 UTC (rev 2881)
+++ liboggplay/trunk/include/oggplay/oggplay_enums.h	2007-06-08 08:34:00 UTC (rev 2882)
@@ -71,6 +71,13 @@
   OGGPLAY_TYPE_UNKNOWN  = 3000
 } OggPlayDataType;
 
+typedef enum OggPlayStreamInfo {
+  OGGPLAY_STREAM_UNINITIALISED = 0,
+  OGGPLAY_STREAM_FIRST_DATA = 1,
+  OGGPLAY_STREAM_INITIALISED = 2,
+  OGGPLAY_STREAM_LAST_DATA = 3
+} OggPlayStreamInfo;
+
 typedef enum OggPlayStreamState {
     UNINITIALISED	= 0,
     STREAM_STARTED 	= 1,

Modified: liboggplay/trunk/include/oggplay/oggplay_tools.h
===================================================================
--- liboggplay/trunk/include/oggplay/oggplay_tools.h	2007-06-08 08:32:30 UTC (rev 2881)
+++ liboggplay/trunk/include/oggplay/oggplay_tools.h	2007-06-08 08:34:00 UTC (rev 2882)
@@ -40,6 +40,8 @@
 #ifndef __OGGPLAY_TOOLS_H__
 #define __OGGPLAY_TOOLS_H__
 
+#include <ogg/ogg.h>
+
 #ifdef __cplusplus
 extern "C" {
 #endif

Modified: liboggplay/trunk/plugin/plugin_gui_linux.c
===================================================================
--- liboggplay/trunk/plugin/plugin_gui_linux.c	2007-06-08 08:32:30 UTC (rev 2881)
+++ liboggplay/trunk/plugin/plugin_gui_linux.c	2007-06-08 08:34:00 UTC (rev 2882)
@@ -47,6 +47,7 @@
 #include <sys/time.h>
 #include <time.h>
 
+#include <oggplay/oggplay_tools.h>
 #include "plugin_tools.h"
 
 #ifdef USE_AUDIO

Modified: liboggplay/trunk/plugin/plugin_oggplay.c
===================================================================
--- liboggplay/trunk/plugin/plugin_oggplay.c	2007-06-08 08:32:30 UTC (rev 2881)
+++ liboggplay/trunk/plugin/plugin_oggplay.c	2007-06-08 08:34:00 UTC (rev 2882)
@@ -50,6 +50,7 @@
 #include <stdlib.h>
 #include <oggplay/oggplay.h>
 #include "plugin_oggplay.h"
+#include <oggplay/oggplay_tools.h>
 #include "plugin_tools.h"
 
 #define LIBOGGPLAY_BUFFER_SIZE 20

Modified: liboggplay/trunk/plugin/plugin_tools.c
===================================================================
--- liboggplay/trunk/plugin/plugin_tools.c	2007-06-08 08:32:30 UTC (rev 2881)
+++ liboggplay/trunk/plugin/plugin_tools.c	2007-06-08 08:34:00 UTC (rev 2882)
@@ -107,4 +107,6 @@
   for (i = 0; i < cmml_size; i++) {
     printf("CMML annotations: %s\n", cmml_data[i]);
   }
+  NPN_GetURL(info->plugin_instance, 
+                  "javascript:alert(\"CMML data recieved\");", NULL);
 }

Modified: liboggplay/trunk/plugin/test/test.html
===================================================================
--- liboggplay/trunk/plugin/test/test.html	2007-06-08 08:32:30 UTC (rev 2881)
+++ liboggplay/trunk/plugin/test/test.html	2007-06-08 08:34:00 UTC (rev 2882)
@@ -91,7 +91,7 @@
 <table>
 <tr>
 <td align="right">
-<input type="button" value="Change Dat Funky Movah!" onclick='ChangeMovie("http://media.annodex.net/cmmlwiki/SFD2005-Trailer.axv")'>
+<input type="button" value="Change Dat Funky Movah!" onclick='ChangeMovie("http://media.annodex.net/cmmlwiki/OSSForum-Intro.axv")'>
 </td>
 <td align="left">
 <input type="button" value="Roll back!" onclick='ChangeMovie("http://media.annodex.net/cmmlwiki/CCFilm.axv")'>

Modified: liboggplay/trunk/src/liboggplay/Version_script.in
===================================================================
--- liboggplay/trunk/src/liboggplay/Version_script.in	2007-06-08 08:32:30 UTC (rev 2881)
+++ liboggplay/trunk/src/liboggplay/Version_script.in	2007-06-08 08:34:00 UTC (rev 2882)
@@ -43,6 +43,7 @@
                 oggplay_callback_info_get_audio_data;
                 oggplay_callback_info_get_text_data;
                 oggplay_callback_info_get_presentation_time;
+                oggplay_callback_info_get_stream_info;
 
                 oggplay_buffer_retrieve_next;
                 oggplay_buffer_free_info;
@@ -53,7 +54,10 @@
                 oggplay_callback_info_unlock_item;
 
                 oggplay_yuv2rgb;
-		oggplay_yuv2bgr;                
+                oggplay_yuv2bgr;
+
+                oggplay_sys_time_in_ms;
+                oggplay_millisleep;
         local:
                 *;
 };

Modified: liboggplay/trunk/src/liboggplay/oggplay.c
===================================================================
--- liboggplay/trunk/src/liboggplay/oggplay.c	2007-06-08 08:32:30 UTC (rev 2881)
+++ liboggplay/trunk/src/liboggplay/oggplay.c	2007-06-08 08:34:00 UTC (rev 2882)
@@ -47,6 +47,8 @@
 #include <sys/time.h>
 #endif
 
+#include <time.h>
+
 OggPlay *
 oggplay_new_with_reader(OggPlayReader *reader, char *location) {
 
@@ -114,7 +116,7 @@
       break;
     }
   }
- 
+
   /*
    * set all the tracks to inactive
    */
@@ -414,6 +416,7 @@
       if (remaining == 0)
         return E_OGGPLAY_OK;
     }
+
     /*
      * if any of the tracks have not yet met the target (modified by that
      * track's offset), then retrieve more data
@@ -435,6 +438,7 @@
         break;
       }
     }
+
     if (!need_data)
       break;
     
@@ -452,6 +456,7 @@
       }
       return E_OGGPLAY_OK;
     }
+
     /*
      * feed it into oggz
      */

Modified: liboggplay/trunk/src/liboggplay/oggplay_callback.c
===================================================================
--- liboggplay/trunk/src/liboggplay/oggplay_callback.c	2007-06-08 08:32:30 UTC (rev 2881)
+++ liboggplay/trunk/src/liboggplay/oggplay_callback.c	2007-06-08 08:34:00 UTC (rev 2882)
@@ -131,39 +131,13 @@
     common->current_loc = 0;
   
   /*
-   * there is exactly one frame per libtheora callback
-   * 
-   * why are we doing this and not calculating the frame position from
-   * the granulepos directly?
-   */
-  /* 
-  if (granulepos != common->last_granulepos)
-    common->current_loc += common->granuleperiod;
-
-  common->last_granulepos = granulepos;
-  */
-
-  /*
-    if (!decoder->granulepos_seen) {
-      decoder->granulepos_seen = 1;
-      decoder->frame_delta = frame - decoder->frame_delta;
-    }
-
-    frame -= decoder->frame_delta;
-    common->current_loc = frame * common->granuleperiod;
-  }
-  
-  if (!decoder->granulepos_seen) decoder->frame_delta++;
-  */
-
-  /*
    * Decode the frame
    */
 
 #if TIME_THEORA_DECODE  
   gettimeofday(&tv, NULL);
 #endif
- 
+
   theora_decode_packetin(&(decoder->video_handle), op);
   theora_decode_YUVout(&(decoder->video_handle), &buffer);
 
@@ -325,6 +299,8 @@
     (common->current_loc >= common->player->presentation_time)
   )
   {
+
+
     /*
      * store the frame
      */
@@ -428,6 +404,11 @@
   decoder->decoded_type = OGGPLAY_TYPE_UNKNOWN;
 
   /*
+   * set the StreamInfo to unitialised until we get some real data in
+   */
+  decoder->stream_info = OGGPLAY_STREAM_UNINITIALISED;
+
+  /*
    * set to -1 until headers decoded
    */
   decoder->current_loc = -1;
@@ -502,6 +483,9 @@
       /*
        * call appropriate callback
        */
+      printf("calling back %p for %s\n",
+            callbacks[content_type].callback,
+            oggz_stream_get_content_type(me->oggz, serialno));
       if (callbacks[content_type].callback != NULL) {
         callbacks[content_type].callback(oggz, op, serialno, 
                                           me->decode_data[i]);
@@ -514,6 +498,9 @@
 
         serialno = me->decode_data[i]->serialno;
         content_type = oggz_stream_get_content (me->oggz, serialno);
+        printf("setting permanent callback %p for %s\n",
+              callbacks[content_type].callback,
+              oggz_stream_get_content_type(me->oggz, serialno));
         oggz_set_read_callback(me->oggz, serialno, 
                         callbacks[content_type].callback, me->decode_data[i]);
       }
@@ -537,6 +524,9 @@
   /*
    * call appropriate callback
    */
+  printf("calling back %p for %s\n",
+        callbacks[content_type].callback,
+        oggz_stream_get_content_type(me->oggz, serialno));
   if (callbacks[content_type].callback != NULL) {
     callbacks[content_type].callback(oggz, op, serialno, 
                                           me->decode_data[me->num_tracks - 1]);

Modified: liboggplay/trunk/src/liboggplay/oggplay_callback_info.c
===================================================================
--- liboggplay/trunk/src/liboggplay/oggplay_callback_info.c	2007-06-08 08:32:30 UTC (rev 2881)
+++ liboggplay/trunk/src/liboggplay/oggplay_callback_info.c	2007-06-08 08:34:00 UTC (rev 2882)
@@ -67,10 +67,11 @@
     
     (*info)[i] = track_info;
 
-    if (track->active == 0) {
+    if (track->active == 0 && track->data_list == NULL) {
       track_info->data_type = OGGPLAY_INACTIVE;
       track_info->available_records = track_info->required_records = 0;
       track_info->records = NULL;
+      track_info->stream_info = OGGPLAY_STREAM_UNINITIALISED;
       continue;
     }
  
@@ -87,7 +88,40 @@
       }
     }
     
-    if (count > 0) tcount = 1;
+    if (count > 0) {
+      tcount = 1;
+
+      /*
+       * set this track's StreamState.  If the track isn't active and there's
+       * only one timestamp's worth of data in the data list, then this is
+       * the last data!
+       */
+      if 
+      (
+        track->active == 0 
+        && 
+        (
+          track->end_of_data_list->presentation_time
+          <=
+          me->target + track->offset
+        )
+      ) 
+      {
+        track_info->stream_info = OGGPLAY_STREAM_LAST_DATA;
+      } else {
+        track_info->stream_info = track->stream_info;
+      }
+
+      /*
+       * if the StreamState is FIRST_DATA then update it to INITIALISED, 
+       * as we've marked the first data instance
+       */
+      if (track->stream_info == OGGPLAY_STREAM_FIRST_DATA) {
+        track->stream_info = OGGPLAY_STREAM_INITIALISED;
+      }
+    } else {
+      track_info->stream_info = OGGPLAY_STREAM_UNINITIALISED;
+    }
     
     track_info->records = malloc (count * sizeof (OggPlayDataHeader *));
     track_info->available_records = count;
@@ -174,7 +208,7 @@
     (*info) = NULL;
 
   }
-    
+
   return me->num_tracks;
   
 }
@@ -229,6 +263,16 @@
 
 }
 
+OggPlayStreamInfo
+oggplay_callback_info_get_stream_info(OggPlayCallbackInfo *info) {
+
+  if (info == NULL) {
+    return E_OGGPLAY_BAD_CALLBACK_INFO;
+  }
+
+  return info->stream_info;
+}
+
 OggPlayDataHeader **
 oggplay_callback_info_get_headers(OggPlayCallbackInfo *info) {
 

Modified: liboggplay/trunk/src/liboggplay/oggplay_data.c
===================================================================
--- liboggplay/trunk/src/liboggplay/oggplay_data.c	2007-06-08 08:32:30 UTC (rev 2881)
+++ liboggplay/trunk/src/liboggplay/oggplay_data.c	2007-06-08 08:34:00 UTC (rev 2882)
@@ -137,6 +137,16 @@
   
     oggplay_data_add_to_list_end(decode, data);
 
+    /*
+     * if the StreamInfo is still at uninitialised, then this is the first
+     * meaningful data packet!  StreamInfo will be updated to 
+     * OGGPLAY_STREAM_INITIALISED in oggplay_callback_info.c as part of the
+     * callback process.
+     */
+    if (decode->stream_info == OGGPLAY_STREAM_UNINITIALISED) {
+      decode->stream_info = OGGPLAY_STREAM_FIRST_DATA;
+    }
+      
   }
 
 }

Modified: liboggplay/trunk/src/liboggplay/oggplay_private.h
===================================================================
--- liboggplay/trunk/src/liboggplay/oggplay_private.h	2007-06-08 08:32:30 UTC (rev 2881)
+++ liboggplay/trunk/src/liboggplay/oggplay_private.h	2007-06-08 08:34:00 UTC (rev 2882)
@@ -79,6 +79,7 @@
   OggPlayDataType       data_type;
   int                   available_records;
   int                   required_records;
+  OggPlayStreamInfo     stream_info;
   OggPlayDataHeader **  records;
 };
 
@@ -117,7 +118,7 @@
   OggPlayDataHeader   * data_list;
   OggPlayDataHeader   * end_of_data_list;
   OggPlayDataHeader   * untimed_data_list;
-  //OggPlayCallbackInfo * callback_info;
+  OggPlayStreamInfo     stream_info;
   int                   preroll;
 } OggPlayDecode;
 



More information about the commits mailing list