[xiph-commits] r3129 - in liboggplay/trunk/plugin: . audio
laser13 at svn.annodex.net
laser13 at svn.annodex.net
Thu Jun 28 09:16:41 PDT 2007
Author: laser13
Date: 2007-06-28 09:16:41 -0700 (Thu, 28 Jun 2007)
New Revision: 3129
Modified:
liboggplay/trunk/plugin/audio/sydney_audio_waveapi.c
liboggplay/trunk/plugin/plugin_gui_win32.c
Log:
Some more minor changes to Win32 GUI. Formatting, removed unused variables, etc.
Modified: liboggplay/trunk/plugin/audio/sydney_audio_waveapi.c
===================================================================
--- liboggplay/trunk/plugin/audio/sydney_audio_waveapi.c 2007-06-28 15:23:23 UTC (rev 3128)
+++ liboggplay/trunk/plugin/audio/sydney_audio_waveapi.c 2007-06-28 16:16:41 UTC (rev 3129)
@@ -212,7 +212,10 @@
#define LEFT_CHANNEL_MASK 0x0000FFFF
#define RIGHT_CHANNEL_MASK 0xFFFF0000
-/** volume in hundreths of dB*/
+/**
+ * retrieved volume as an int in a scale from 0x0000 to 0xFFFF
+ * only one value for all channels
+ */
int sa_stream_get_write_volume(sa_stream_t *s, int32_t vol[], unsigned int *n) {
int status;
DWORD volume;
@@ -232,7 +235,7 @@
}
-/** volume in hundreths of dB*/
+/** changes volume as an int in a scale from 0x0000 to 0xFFFF*/
int sa_stream_change_write_volume(sa_stream_t *s, const int32_t vol[], unsigned int n) {
int status;
DWORD volume;
Modified: liboggplay/trunk/plugin/plugin_gui_win32.c
===================================================================
--- liboggplay/trunk/plugin/plugin_gui_win32.c 2007-06-28 15:23:23 UTC (rev 3128)
+++ liboggplay/trunk/plugin/plugin_gui_win32.c 2007-06-28 16:16:41 UTC (rev 3129)
@@ -63,9 +63,7 @@
HANDLE thread;
int shutdown_gui;
void * oggplay_handle;
- semaphore oggplay_replace_sem;
- semaphore playback_sem;
- semaphore synch_sem;
+ semaphore oggplay_replace_sem;
PluginPlaybackState playback_state;
__int64 playback_target;
void * new_oggplay_handle;
@@ -203,17 +201,8 @@
// associate window with our PliuginWindowInfo so we can access
// it in the window procedure
SetWindowLongPtr((HWND)hWnd, GWL_USERDATA, (LONG)info);
-
+
/*
- * create semaphore responsible for playback and playback pausing
- */
- SEM_CREATE(info->playback_sem, 1);
- SEM_WAIT(info->playback_sem);
-
- SEM_CREATE(info->synch_sem, 1);
- SEM_WAIT(info->synch_sem);
-
- /*
* start the main processing loop for the frame data processing
* initial timer is called with a default @ 25fps timout
*/
@@ -237,20 +226,18 @@
if (info->audio_opened == TRUE) {
close_audio(info);
}
-#endif
+#endif
SubclassWindow((HWND)(info->window), (WNDPROC)(info->old_wnd_proc));
- SEM_CLOSE(info->synch_sem);
- SEM_CLOSE(info->oggplay_replace_sem);
- SEM_CLOSE(info->playback_sem);
+ SEM_CLOSE(info->oggplay_replace_sem);
shut_oggplay(info->oggplay_handle);
KillTimer(info->window, IDT_DISPLAY_TIMER);
- /*if (info->frame_data != NULL) {
+ if (info->frame_data != NULL) {
free(info->frame_data);
- }*/
+ }
free(info);
printf("all closed all done\n");
@@ -352,8 +339,10 @@
hWnd = (HWND)(info->window);
if ((info->playback_state == PAUSED) && (info->set_to_pause == FALSE)) {
- SetTimer(hWnd, IDT_DISPLAY_TIMER, OGGPLAY_MIN_OFFSET, NULL);
- printf("Setting short timeout\n");
+#ifdef USE_AUDIO
+ sa_stream_pause(info->audio_handle);
+#endif
+ SetTimer(hWnd, IDT_DISPLAY_TIMER, OGGPLAY_MIN_OFFSET, NULL);
return;
}
@@ -364,7 +353,9 @@
switch (get_oggplay_stream_info(info->oggplay_handle, info->frame_data)) {
case OGGPLAY_STREAM_JUST_SEEKED:
+#ifdef USE_AUDIO
close_audio(info);
+#endif
break;
case OGGPLAY_STREAM_LAST_DATA:
@@ -405,6 +396,14 @@
/* below: audio, timing calculations and frame skipping */
calc_offset:
+#ifdef USE_AUDIO
+ if (info->audio_opened == FALSE)
+#endif
+ {
+ info->playback_target = oggplay_sys_time_in_ms() << 16;
+ /*printf("Hello playback target 1 %lld\n", info->playback_target);*/
+ }
+
#ifdef USE_AUDIO
if (has_audio == TRUE) {
/* open audio if not opened */
@@ -439,12 +438,7 @@
onCMMLData(info->plugin_instance, info->frame_data->cmml_strings, info->frame_data->cmml_size);
}
-#ifdef USE_AUDIO
- if (info->audio_opened == FALSE)
-#endif
- {
- info->playback_target = oggplay_sys_time_in_ms() << 16;
- }
+
#ifdef USE_AUDIO
if (info->audio_opened == TRUE) {
// calculate audio playback progress based on number of audio samples played
@@ -463,22 +457,25 @@
/* calculate how long we should wait with processing the next frame */
info->playback_target += get_callback_period(info->oggplay_handle);
+ /*printf("Hello playback target %lld\n", info->playback_target);*/
offset = (info->playback_target >> 16) - ref_time;
+ /*printf("Ref time %lld & offset %lld \n", ref_time, offset);*/
free_oggplay_frame(info->oggplay_handle, info->frame_data);
info->valid_frame = FALSE;
/* check if we are not lagging with display
- if (offset < OGGPLAY_FRAME_SKIP_OFFSET) {
+ if (offset < (__int64)OGGPLAY_FRAME_SKIP_OFFSET) {
get_oggplay_frame(info->oggplay_handle, info->frame_data);
+ printf("Hello offset %lld\n", offset);
goto calc_offset;
- } else*/
- if (offset < OGGPLAY_MIN_OFFSET) {
+ } else */
+ if (offset < (__int64)OGGPLAY_MIN_OFFSET) {
offset = OGGPLAY_MIN_OFFSET;
- }
+ }
- printf("setting time for %lld milliseconds (target %lld bytes %lld\n", offset,
- info->playback_target, bytes);
+ /*printf("setting time for %lld milliseconds (target %lld bytes %lld\n", offset,
+ info->playback_target, bytes);*/
SetTimer(hWnd, IDT_DISPLAY_TIMER, offset, NULL);
return;
@@ -493,17 +490,13 @@
PluginWindowInfo * info = NULL;
switch (msg) {
- case WM_TIMER:
- printf("timer\n");
+ case WM_TIMER:
info = (PluginWindowInfo*)GetWindowLongPtr(hWnd, GWL_USERDATA);
- process_frame_data(info);
- printf("timed\n");
+ process_frame_data(info);
break;
- case WM_PAINT:
- printf("paint\n");
+ case WM_PAINT:
info = (PluginWindowInfo*)GetWindowLongPtr(hWnd, GWL_USERDATA);
- update_frame(info);
- printf("painted\n");
+ update_frame(info);
break;
case WM_CLOSE :
break;
@@ -530,7 +523,7 @@
shut_oggplay(info->new_oggplay_handle);
}
info->new_oggplay_handle = oggplay_handle;
- SEM_SIGNAL(info->oggplay_replace_sem);
+ SEM_SIGNAL(info->oggplay_replace_sem);
}
void
@@ -541,7 +534,10 @@
void
gui_play(void *handle) {
- PluginWindowInfo * info = (PluginWindowInfo *)handle;
+ PluginWindowInfo * info = (PluginWindowInfo *)handle;
+ if (info->playback_state == PAUSED) {
+ sa_stream_resume(info->audio_handle);
+ }
info->playback_state = PLAYING;
}
More information about the commits
mailing list