[xiph-commits] r3156 - in liboggplay/trunk/plugin: . audio
laser13 at svn.annodex.net
laser13 at svn.annodex.net
Wed Jul 4 02:44:52 PDT 2007
Author: laser13
Date: 2007-07-04 02:44:51 -0700 (Wed, 04 Jul 2007)
New Revision: 3156
Modified:
liboggplay/trunk/plugin/audio/sydney_audio_waveapi.c
liboggplay/trunk/plugin/plugin_gui_win32.c
Log:
1) Fixed GDI objects memory leak.
2) Some debug comments removed from Win32 sydney audio API.
Modified: liboggplay/trunk/plugin/audio/sydney_audio_waveapi.c
===================================================================
--- liboggplay/trunk/plugin/audio/sydney_audio_waveapi.c 2007-07-03 07:16:37 UTC (rev 3155)
+++ liboggplay/trunk/plugin/audio/sydney_audio_waveapi.c 2007-07-04 09:44:51 UTC (rev 3156)
@@ -420,15 +420,12 @@
// reseting audio device and flushing buffers
status = waveOutReset(s->hWaveOut);
HANDLE_WAVE_ERROR(status, "resetting audio device");
-
- /* FIX ME: should the loop below have a timeout option? */
- /* wait for all blocks to complete */
- printf("[audio] waiting fot all audio block to be freed\n");
+
+ /* wait for all blocks to complete */
while(s->waveFreeBlockCount < BLOCK_COUNT)
Sleep(10);
- /* unprepare any blocks that are still prepared */
- printf("[audio] unpreparing audio blocks\n");
+ /* unprepare any blocks that are still prepared */
for(i = 0; i < s->waveFreeBlockCount; i++) {
if(s->waveBlocks[i].dwFlags & WHDR_PREPARED) {
status = waveOutUnprepareHeader(s->hWaveOut, &(s->waveBlocks[i]), sizeof(WAVEHDR));
@@ -442,7 +439,7 @@
DeleteCriticalSection(&(s->waveCriticalSection));
CloseHandle(s->callbackEvent);
- printf("[audio] callback destroyed\n");
+ printf("[audio] audio resources cleanup completed\n");
return SA_SUCCESS;
}
Modified: liboggplay/trunk/plugin/plugin_gui_win32.c
===================================================================
--- liboggplay/trunk/plugin/plugin_gui_win32.c 2007-07-03 07:16:37 UTC (rev 3155)
+++ liboggplay/trunk/plugin/plugin_gui_win32.c 2007-07-04 09:44:51 UTC (rev 3156)
@@ -127,23 +127,22 @@
if (info->new_oggplay_handle != NULL) {
SEM_WAIT(info->oggplay_replace_sem);
- if (info->new_oggplay_handle != NULL) {
+ if (info->new_oggplay_handle != NULL) {
old_ogg_handle = info->oggplay_handle;
info->oggplay_handle = (void *)info->new_oggplay_handle;
- info->new_oggplay_handle = NULL;
+ info->new_oggplay_handle = NULL;
#ifdef USE_AUDIO
- if (info->audio_opened == TRUE) {
- //printf("Closing audio in switch oggplays\n");
+ if (info->audio_opened == TRUE) {
close_audio(info);
}
-#endif
+#endif
if (info->playback_state == PAUSED) {
- info->set_to_pause = TRUE;
+ //info->set_to_pause = TRUE;
}
rv = TRUE;
}
- SEM_SIGNAL(info->oggplay_replace_sem);
- shut_oggplay(old_ogg_handle);
+ SEM_SIGNAL(info->oggplay_replace_sem);
+ shut_oggplay(old_ogg_handle);
}
return rv;
}
@@ -182,7 +181,7 @@
/* audio and synchronisation related variables */
info->playback_target = 0;
info->valid_frame = FALSE;
- info->set_to_pause = FALSE;
+ //info->set_to_pause = FALSE;
#ifdef USE_AUDIO
info->audio_opened = FALSE;
info->audio_handle = NULL;
@@ -221,19 +220,19 @@
shut_gui(void *handle) {
PluginWindowInfo * info = (PluginWindowInfo *)handle;
-
+
#ifdef USE_AUDIO
if (info->audio_opened == TRUE) {
close_audio(info);
}
-#endif
+#endif
KillTimer(info->window, IDT_DISPLAY_TIMER);
+
+ SubclassWindow((HWND)(info->window), (WNDPROC)(info->old_wnd_proc));
- SubclassWindow((HWND)(info->window), (WNDPROC)(info->old_wnd_proc));
-
SEM_CLOSE(info->oggplay_replace_sem);
- shut_oggplay(info->oggplay_handle);
+ shut_oggplay(info->oggplay_handle);
/*if (info->frame_data != NULL) {
free(info->frame_data);
@@ -311,7 +310,7 @@
if ((info->width != info->frame_data->width) ||
(info->height != info->frame_data->height)) {
- SetStretchBltMode(hdc, COLORONCOLOR);
+ SetStretchBltMode(hdc, HALFTONE);
StretchBlt(hdc, r.left, r.top, info->width, info->height,
hdcMem, r.left, r.top, info->frame_data->width, info->frame_data->height,
SRCCOPY);
@@ -322,6 +321,7 @@
//restore the initial state and clean up
SelectObject(hdcMem, hbmOld);
DeleteObject(hbm);
+ DeleteObject(hdcMem);
EndPaint(info->window, &ps);
return;
}
@@ -338,7 +338,7 @@
hWnd = (HWND)(info->window);
- if ((info->playback_state == PAUSED) && (info->set_to_pause == FALSE)) {
+ if ((info->playback_state == PAUSED) /*&& (info->set_to_pause == FALSE)*/) {
#ifdef USE_AUDIO
sa_stream_pause(info->audio_handle);
#endif
@@ -361,6 +361,9 @@
case OGGPLAY_STREAM_LAST_DATA:
info->finished = TRUE;
info->playback_state = FINISHED;
+#ifdef USE_AUDIO1
+ close_audio(info);
+#endif
onEndOfMovie(info->plugin_instance);
return;
@@ -400,8 +403,7 @@
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);*/
+ info->playback_target = oggplay_sys_time_in_ms() << 16;
}
#ifdef USE_AUDIO
@@ -424,8 +426,7 @@
#endif
if (sa_stream_write(info->audio_handle,
info->frame_data->samples,
- info->frame_data->size) != SA_SUCCESS) {
- //printf("Closing audio on faulty write\n");
+ info->frame_data->size) != SA_SUCCESS) {
close_audio(info);
info->playback_target = 0;
}
@@ -457,17 +458,15 @@
/* 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);*/
+
+ offset = (info->playback_target >> 16) - ref_time;
free_oggplay_frame(info->oggplay_handle, info->frame_data);
info->valid_frame = FALSE;
/* check if we are not lagging with display
if (offset < (__int64)OGGPLAY_FRAME_SKIP_OFFSET) {
- get_oggplay_frame(info->oggplay_handle, info->frame_data);
- printf("Hello offset %lld\n", offset);
+ get_oggplay_frame(info->oggplay_handle, info->frame_data);
goto calc_offset;
} else */
if (offset < (__int64)OGGPLAY_MIN_OFFSET) {
@@ -535,9 +534,11 @@
void
gui_play(void *handle) {
PluginWindowInfo * info = (PluginWindowInfo *)handle;
+#ifdef USE_AUDIO
if (info->playback_state == PAUSED) {
sa_stream_resume(info->audio_handle);
}
+#endif
info->playback_state = PLAYING;
}
More information about the commits
mailing list