[xiph-commits] r3177 - in liboggplay/trunk: plugin src/liboggplay
src/tools
shans at svn.annodex.net
shans at svn.annodex.net
Wed Aug 1 18:14:59 PDT 2007
Author: shans
Date: 2007-08-01 18:14:58 -0700 (Wed, 01 Aug 2007)
New Revision: 3177
Modified:
liboggplay/trunk/plugin/plugin_gui_linux.c
liboggplay/trunk/src/liboggplay/oggplay.c
liboggplay/trunk/src/liboggplay/oggplay_callback_info.c
liboggplay/trunk/src/liboggplay/oggplay_private.h
liboggplay/trunk/src/liboggplay/oggplay_seek.c
liboggplay/trunk/src/tools/dump_some_frames.py
liboggplay/trunk/src/tools/glut-player.c
Log:
Handle cases when audio finishes before video (linux).
Distinguish between incorrect presentation time and data already present
for a frame cases correctly.
Modified: liboggplay/trunk/plugin/plugin_gui_linux.c
===================================================================
--- liboggplay/trunk/plugin/plugin_gui_linux.c 2007-07-30 11:46:15 UTC (rev 3176)
+++ liboggplay/trunk/plugin/plugin_gui_linux.c 2007-08-02 01:14:58 UTC (rev 3177)
@@ -177,6 +177,7 @@
case OGGPLAY_STREAM_LAST_DATA:
info->playback_finished = TRUE;
+ close_audio(info);
onEndOfMovie(info->pluginInstance);
return TRUE;
@@ -216,6 +217,13 @@
}
}
+ if (frame_data.size == 0) {
+ /* no audio */
+ cur_time = oggplay_sys_time_in_ms();
+ info->playback_target = (cur_time << 16);
+ close_audio(info);
+ }
+
/* buffer audio */
if
(
@@ -226,7 +234,9 @@
)
{
/* can't write data */
- cur_time = oggplay_sys_time_in_ms();
+ cur_time = oggplay_sys_time_in_ms();
+ info->playback_target = cur_time;
+ close_audio(info);
}
/* get audio playback progress */
else if (sa_device_get_position(info->audio_handle,
@@ -250,7 +260,6 @@
info->playback_target += get_callback_period(info->ogg_handle);
offset = (info->playback_target >> 16) - cur_time;
- //printf("target: %lld offset: %lld\n", info->playback_target, offset);
/*
* if we're WAAAY behind, discard the next frame
Modified: liboggplay/trunk/src/liboggplay/oggplay.c
===================================================================
--- liboggplay/trunk/src/liboggplay/oggplay.c 2007-07-30 11:46:15 UTC (rev 3176)
+++ liboggplay/trunk/src/liboggplay/oggplay.c 2007-08-02 01:14:58 UTC (rev 3177)
@@ -63,6 +63,7 @@
me->shutdown = 0;
me->trash = NULL;
me->oggz = NULL;
+ me->pt_update_valid = 1;
return me;
Modified: liboggplay/trunk/src/liboggplay/oggplay_callback_info.c
===================================================================
--- liboggplay/trunk/src/liboggplay/oggplay_callback_info.c 2007-07-30 11:46:15 UTC (rev 3176)
+++ liboggplay/trunk/src/liboggplay/oggplay_callback_info.c 2007-08-02 01:14:58 UTC (rev 3177)
@@ -156,8 +156,8 @@
}
- /*
- printf("%d: %d/%d\t", i,
+
+ /*printf("%d: %d/%d\t", i,
track_info->required_records, count);
if (q != NULL) {
@@ -168,6 +168,31 @@
}
*/
+
+ /*
+ * this statement detects if this track needs records but has none.
+ * We need to be careful - there are 2 cases where this could happen. The
+ * first is where the presentation time is less than it should be, and
+ * there is no data available between now and the target. In this case
+ * we want to set added_required_record to 0 and trigger the presentation
+ * time update code below.
+ * <-------data----------...
+ * ^ ^ ^
+ * pt target current_loc
+ *
+ * The second case occurs when the packet from the last timestamp contained
+ * so much data that there *is* none in this timestamp. In this case we
+ * don't want to set added_required_record to 0.
+ *
+ * <----------data---------------|--------...
+ * <-timeslice1-><-timeslice2-><-timeslice3->
+ * ^ ^ ^
+ * pt target current_loc
+ *
+ * How do we discriminate between these two cases? We assume the pt update
+ * needs to be explicitly required (e.g. by seeking or start of movie), and
+ * create a new member in the player struct called pt_update_valid
+ */
if
(
track->decoded_type != OGGPLAY_CMML
@@ -176,11 +201,10 @@
&&
track->active == 1
&&
- track->current_loc < me->target
+ me->pt_update_valid
) {
- printf("track: %d current_loc: %lld target: %lld\n",
- i, track->current_loc >> 32, me->target >> 32);
added_required_record = 0;
+ me->pt_update_valid = 0;
}
}
Modified: liboggplay/trunk/src/liboggplay/oggplay_private.h
===================================================================
--- liboggplay/trunk/src/liboggplay/oggplay_private.h 2007-07-30 11:46:15 UTC (rev 3176)
+++ liboggplay/trunk/src/liboggplay/oggplay_private.h 2007-08-02 01:14:58 UTC (rev 3177)
@@ -201,6 +201,7 @@
ogg_int64_t presentation_time;
OggPlaySeekTrash * trash;
int shutdown;
+ int pt_update_valid;
};
void
Modified: liboggplay/trunk/src/liboggplay/oggplay_seek.c
===================================================================
--- liboggplay/trunk/src/liboggplay/oggplay_seek.c 2007-07-30 11:46:15 UTC (rev 3176)
+++ liboggplay/trunk/src/liboggplay/oggplay_seek.c 2007-08-02 01:14:58 UTC (rev 3177)
@@ -119,6 +119,7 @@
*/
me->presentation_time = milliseconds;
me->target = me->callback_period - 1;
+ me->pt_update_valid = 1;
trash->next = NULL;
Modified: liboggplay/trunk/src/tools/dump_some_frames.py
===================================================================
--- liboggplay/trunk/src/tools/dump_some_frames.py 2007-07-30 11:46:15 UTC (rev 3176)
+++ liboggplay/trunk/src/tools/dump_some_frames.py 2007-08-02 01:14:58 UTC (rev 3177)
@@ -23,7 +23,7 @@
out += mul * float(stime[-1])
mul *= 60
del stime[-1]
- return (int(out * 1000), time)
+ return (int(out * 1000 + 500), time)
times = map(string_to_ms, times)
@@ -50,7 +50,7 @@
if time >= times[pos][0]:
rgba = oggplay_generate_frame(player, video, headers[0])
image = Image.fromstring("RGBA", rgba[1], rgba[0])
- fname = outname + ".png?t=" + times[pos][1]
+ fname = outname + ".png_t=" + times[pos][1]
pos += 1
print "saving", fname
image.save(fname, "PNG")
Modified: liboggplay/trunk/src/tools/glut-player.c
===================================================================
--- liboggplay/trunk/src/tools/glut-player.c 2007-07-30 11:46:15 UTC (rev 3176)
+++ liboggplay/trunk/src/tools/glut-player.c 2007-08-02 01:14:58 UTC (rev 3177)
@@ -25,7 +25,7 @@
#include <fcntl.h>
#if !(defined(__APPLE__) || defined(WIN32))
-#define USE_AUDIO 1
+#define USE_AUDIO 0
#else
#define USE_AUDIO 0
#endif
More information about the commits
mailing list