This patch may fix issues on older libsdl version, but I did not check it
because libsdl 1.2.14 is already 2 years old.
---
avplay.c | 36 +++++++++++++++++++++++++++---------
1 files changed, 27 insertions(+), 9 deletions(-)
diff --git a/avplay.c b/avplay.c
index 225f81a..14bde45 100644
--- a/avplay.c
+++ b/avplay.c
@@ -1214,18 +1214,14 @@ retry:
}
}
-static void stream_close(VideoState *is)
+static void free_all_pictures(VideoState *is)
{
VideoPicture *vp;
int i;
- /* XXX: use a special url_shutdown call to abort parse cleanly */
- is->abort_request = 1;
- SDL_WaitThread(is->parse_tid, NULL);
- SDL_WaitThread(is->refresh_tid, NULL);
-
+
/* free all pictures */
for(i=0;i<VIDEO_PICTURE_QUEUE_SIZE; i++) {
- vp = &is->pictq[i];
+ vp = &cur_stream->pictq[i];
#if CONFIG_AVFILTER
if (vp->picref) {
avfilter_unref_buffer(vp->picref);
@@ -1237,6 +1233,17 @@ static void stream_close(VideoState *is)
vp->bmp = NULL;
}
}
+}
+
+static void stream_close(VideoState *is)
+{
+ /* XXX: use a special url_shutdown call to abort parse cleanly */
+ is->abort_request = 1;
+ SDL_WaitThread(is->parse_tid, NULL);
+ SDL_WaitThread(is->refresh_tid, NULL);
+
+ free_all_pictures(is);
+
SDL_DestroyMutex(is->pictq_mutex);
SDL_DestroyCond(is->pictq_cond);
SDL_DestroyMutex(is->subpq_mutex);
@@ -2677,11 +2684,16 @@ static void stream_cycle_channel(VideoState *is, int
codec_type)
stream_component_open(is, stream_index);
}
-
static void toggle_full_screen(void)
{
is_full_screen = !is_full_screen;
- video_open(cur_stream);
+
+#if defined(__APPLE__) && SDL_VERSION_ATLEAST(1, 2, 14)
+ /* OSX needs to empty the picturequeue */
+ free_all_pictures(cur_stream);
+#else
+ video_open();
+#endif
}
static void toggle_pause(void)
@@ -2836,8 +2848,14 @@ static void event_loop(void)
break;
case SDL_VIDEORESIZE:
if (cur_stream) {
+#if defined(__APPLE__) && !SDL_VERSION_ATLEAST(1, 2, 14)
+ /* setting bits_per_pixel = 0 or 32 causes blank video on OS X
and older SDL */
+ screen = SDL_SetVideoMode(event.resize.w, event.resize.h, 24,
+
SDL_HWSURFACE|SDL_RESIZABLE|SDL_ASYNCBLIT|SDL_HWACCEL);
+#else
screen = SDL_SetVideoMode(event.resize.w, event.resize.h, 0,
SDL_HWSURFACE|SDL_RESIZABLE|SDL_ASYNCBLIT|SDL_HWACCEL);
+#endif
screen_width = cur_stream->width = event.resize.w;
screen_height= cur_stream->height= event.resize.h;
}
--
1.7.6.1
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel