[xiph-commits] r3166 - liboggplay/trunk/src/tools

shans at svn.annodex.net shans at svn.annodex.net
Fri Jul 20 00:29:35 PDT 2007


Author: shans
Date: 2007-07-20 00:29:34 -0700 (Fri, 20 Jul 2007)
New Revision: 3166

Added:
   liboggplay/trunk/src/tools/dump_some_frames.py
Log:
Example using python API (not working yet)


Added: liboggplay/trunk/src/tools/dump_some_frames.py
===================================================================
--- liboggplay/trunk/src/tools/dump_some_frames.py	                        (rev 0)
+++ liboggplay/trunk/src/tools/dump_some_frames.py	2007-07-20 07:29:34 UTC (rev 3166)
@@ -0,0 +1,29 @@
+import sys
+from oggplay import *
+
+video_name = sys.argv[1]
+timelist = sys.argv[2]
+
+if video_name[:7] == "http://":
+  reader = oggplay_tcp_reader_new(video_name, None, 80)
+else:
+  reader = oggplay_file_reader_new(video_name)
+
+player = oggplay_open_with_reader(reader)
+
+for i in range(oggplay_get_num_tracks(player)):
+  global video
+  if oggplay_get_track_type(player, i) == OGGZ_CONTENT_THEORA:
+    oggplay_set_callback_num_frames(player, i, 1)
+    video = i
+  oggplay_set_track_active(player, i)
+
+def data_callback(player, track_info):
+  headers = oggplay_callback_info_get_headers(track_info[video])
+  video_data = oggplay_callback_info_get_video_data(headers[0])
+  print video_data.y
+  return -1
+
+oggplay_set_data_pycallback(player, data_callback)
+print "data callback set"
+oggplay_start_decoding(player)



More information about the commits mailing list