summaryrefslogtreecommitdiffstats
path: root/ffplay.c
diff options
context:
space:
mode:
authorMarton Balint <cus@passwd.hu>2011-10-20 20:34:20 +0200
committerMarton Balint <cus@passwd.hu>2011-10-20 23:12:27 +0200
commit8085a5b7cdcc91bc9e2d52be04dea6c24759d732 (patch)
tree7c37969b71eebb5a721b3bfb482068e28bf776d1 /ffplay.c
parente6e86e64c34dcf91d6b75b91accc998bd02fcd51 (diff)
downloadffmpeg-streaming-8085a5b7cdcc91bc9e2d52be04dea6c24759d732.zip
ffmpeg-streaming-8085a5b7cdcc91bc9e2d52be04dea6c24759d732.tar.gz
ffplay: reallocate SDL overlays for OSX when changing full screen
Fixes missing blue channel when switching from/to fullscren on OSX and libsdl 1.2.14. Fixes issue 548. Thanks for Jean First for the original patch and for testing. Signed-off-by: Marton Balint <cus@passwd.hu>
Diffstat (limited to 'ffplay.c')
-rw-r--r--ffplay.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/ffplay.c b/ffplay.c
index b41820c..6ae0515 100644
--- a/ffplay.c
+++ b/ffplay.c
@@ -102,6 +102,7 @@ typedef struct VideoPicture {
SDL_Overlay *bmp;
int width, height; /* source height & width */
int allocated;
+ int reallocate;
enum PixelFormat pix_fmt;
#if CONFIG_AVFILTER
@@ -1338,7 +1339,7 @@ static int queue_picture(VideoState *is, AVFrame *src_frame, double pts1, int64_
vp->duration = frame_delay;
/* alloc or resize hardware picture buffer */
- if (!vp->bmp ||
+ if (!vp->bmp || vp->reallocate ||
#if CONFIG_AVFILTER
vp->width != is->out_video_filter->inputs[0]->w ||
vp->height != is->out_video_filter->inputs[0]->h) {
@@ -1349,6 +1350,7 @@ static int queue_picture(VideoState *is, AVFrame *src_frame, double pts1, int64_
SDL_Event event;
vp->allocated = 0;
+ vp->reallocate = 0;
/* the allocation must be done in the main thread to avoid
locking problems */
@@ -2703,6 +2705,12 @@ static void stream_cycle_channel(VideoState *is, int codec_type)
static void toggle_full_screen(VideoState *is)
{
is_full_screen = !is_full_screen;
+#if defined(__APPLE__) && SDL_VERSION_ATLEAST(1, 2, 14)
+ /* OSX needs to reallocate the SDL overlays */
+ for (int i = 0; i < VIDEO_PICTURE_QUEUE_SIZE; i++) {
+ is->pictq[i].reallocate = 1;
+ }
+#endif
video_open(is);
}
OpenPOWER on IntegriCloud