Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-1.1
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc-1.1
Commits
618b891b
Commit
618b891b
authored
Jan 08, 2001
by
Arnaud de Bossoreille de Ribou
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
- cleaning of SDL Lock/Unlock Surface.
parent
c25e25c4
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
62 deletions
+26
-62
plugins/sdl/intf_sdl.c
plugins/sdl/intf_sdl.c
+3
-4
plugins/sdl/vout_sdl.c
plugins/sdl/vout_sdl.c
+23
-58
No files found.
plugins/sdl/intf_sdl.c
View file @
618b891b
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
* intf_sdl.c: SDL interface plugin
* intf_sdl.c: SDL interface plugin
*****************************************************************************
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
* Copyright (C) 1999, 2000 VideoLAN
* $Id: intf_sdl.c,v 1.
19 2001/01/05 18:46:43 massiot
Exp $
* $Id: intf_sdl.c,v 1.
20 2001/01/08 01:07:21 bozo
Exp $
*
*
* Authors:
* Authors:
*
*
...
@@ -70,7 +70,6 @@ typedef struct vout_sys_s
...
@@ -70,7 +70,6 @@ typedef struct vout_sys_s
boolean_t
b_reopen_display
;
boolean_t
b_reopen_display
;
Uint8
*
p_buffer
[
2
];
Uint8
*
p_buffer
[
2
];
/* Buffers informations */
/* Buffers informations */
boolean_t
b_must_acquire
;
/* must be acquired before writing */
}
vout_sys_t
;
}
vout_sys_t
;
...
@@ -161,6 +160,7 @@ void intf_SDLManage( intf_thread_t *p_intf )
...
@@ -161,6 +160,7 @@ void intf_SDLManage( intf_thread_t *p_intf )
switch
(
event
.
type
)
{
switch
(
event
.
type
)
{
case
SDL_VIDEORESIZE
:
/* Resizing of window */
case
SDL_VIDEORESIZE
:
/* Resizing of window */
intf_SDL_Resize
(
p_intf
,
event
.
resize
.
w
,
event
.
resize
.
h
);
intf_SDL_Resize
(
p_intf
,
event
.
resize
.
w
,
event
.
resize
.
h
);
break
;
case
SDL_KEYDOWN
:
/* if a key is pressed */
case
SDL_KEYDOWN
:
/* if a key is pressed */
switch
(
i_key
)
{
switch
(
i_key
)
{
/* switch to fullscreen */
/* switch to fullscreen */
...
@@ -179,7 +179,6 @@ void intf_SDLManage( intf_thread_t *p_intf )
...
@@ -179,7 +179,6 @@ void intf_SDLManage( intf_thread_t *p_intf )
break
;
break
;
}
}
break
;
break
;
case
SDL_QUIT
:
case
SDL_QUIT
:
intf_ProcessKey
(
p_intf
,
INTF_KEY_QUIT
);
intf_ProcessKey
(
p_intf
,
INTF_KEY_QUIT
);
break
;
break
;
...
@@ -202,7 +201,7 @@ void intf_SDL_Resize( intf_thread_t * p_intf, int width, int height )
...
@@ -202,7 +201,7 @@ void intf_SDL_Resize( intf_thread_t * p_intf, int width, int height )
void
intf_SDL_YUVSwitch
(
intf_thread_t
*
p_intf
)
void
intf_SDL_YUVSwitch
(
intf_thread_t
*
p_intf
)
{
{
vlc_mutex_lock
(
&
p_intf
->
p_vout
->
change_lock
);
vlc_mutex_lock
(
&
p_intf
->
p_vout
->
change_lock
);
p_intf
->
p_vout
->
p_sys
->
b_must_acquire
=
0
;
//
p_intf->p_vout->p_sys->b_must_acquire = 0;
p_intf
->
p_vout
->
b_need_render
=
1
-
p_intf
->
p_vout
->
b_need_render
;
p_intf
->
p_vout
->
b_need_render
=
1
-
p_intf
->
p_vout
->
b_need_render
;
intf_DbgMsg
(
"need render now : '%d'"
,
p_intf
->
p_vout
->
b_need_render
);
intf_DbgMsg
(
"need render now : '%d'"
,
p_intf
->
p_vout
->
b_need_render
);
p_intf
->
p_vout
->
p_sys
->
b_reopen_display
=
1
;
p_intf
->
p_vout
->
p_sys
->
b_reopen_display
=
1
;
...
...
plugins/sdl/vout_sdl.c
View file @
618b891b
...
@@ -58,7 +58,6 @@ typedef struct vout_sys_s
...
@@ -58,7 +58,6 @@ typedef struct vout_sys_s
boolean_t
b_reopen_display
;
boolean_t
b_reopen_display
;
Uint8
*
p_buffer
[
2
];
Uint8
*
p_buffer
[
2
];
/* Buffers informations */
/* Buffers informations */
boolean_t
b_must_acquire
;
/* must be acquired before writing */
}
vout_sys_t
;
}
vout_sys_t
;
/*****************************************************************************
/*****************************************************************************
...
@@ -87,7 +86,6 @@ int vout_SDLCreate( vout_thread_t *p_vout, char *psz_display,
...
@@ -87,7 +86,6 @@ int vout_SDLCreate( vout_thread_t *p_vout, char *psz_display,
p_vout
->
p_sys
->
p_display
=
NULL
;
p_vout
->
p_sys
->
p_display
=
NULL
;
p_vout
->
p_sys
->
p_overlay
=
NULL
;
p_vout
->
p_sys
->
p_overlay
=
NULL
;
p_vout
->
p_sys
->
b_must_acquire
=
0
;
/* Initialize library */
/* Initialize library */
if
(
SDL_Init
(
SDL_INIT_VIDEO
)
<
0
)
if
(
SDL_Init
(
SDL_INIT_VIDEO
)
<
0
)
...
@@ -115,15 +113,7 @@ int vout_SDLCreate( vout_thread_t *p_vout, char *psz_display,
...
@@ -115,15 +113,7 @@ int vout_SDLCreate( vout_thread_t *p_vout, char *psz_display,
p_vout
->
p_sys
->
i_width
=
VOUT_WIDTH_DEFAULT
;
p_vout
->
p_sys
->
i_width
=
VOUT_WIDTH_DEFAULT
;
p_vout
->
p_sys
->
i_height
=
VOUT_HEIGHT_DEFAULT
;
p_vout
->
p_sys
->
i_height
=
VOUT_HEIGHT_DEFAULT
;
p_vout
->
p_sys
->
b_reopen_display
=
0
;
p_vout
->
p_sys
->
b_reopen_display
=
1
;
if
(
SDLOpenDisplay
(
p_vout
)
)
{
intf_ErrMsg
(
"error: can't initialize SDL library: %s"
,
SDL_GetError
()
);
free
(
p_vout
->
p_sys
);
return
(
1
);
}
return
(
0
);
return
(
0
);
}
}
...
@@ -135,10 +125,11 @@ int vout_SDLCreate( vout_thread_t *p_vout, char *psz_display,
...
@@ -135,10 +125,11 @@ int vout_SDLCreate( vout_thread_t *p_vout, char *psz_display,
*****************************************************************************/
*****************************************************************************/
int
vout_SDLInit
(
vout_thread_t
*
p_vout
)
int
vout_SDLInit
(
vout_thread_t
*
p_vout
)
{
{
/* Acquire first buffer */
if
(
SDLOpenDisplay
(
p_vout
)
)
if
(
p_vout
->
p_sys
->
b_must_acquire
)
{
{
SDL_LockSurface
(
p_vout
->
p_sys
->
p_display
);
intf_ErrMsg
(
"error: can't initialize SDL library: %s"
,
SDL_GetError
()
);
return
(
1
);
}
}
return
(
0
);
return
(
0
);
...
@@ -151,12 +142,8 @@ int vout_SDLInit( vout_thread_t *p_vout )
...
@@ -151,12 +142,8 @@ int vout_SDLInit( vout_thread_t *p_vout )
*****************************************************************************/
*****************************************************************************/
void
vout_SDLEnd
(
vout_thread_t
*
p_vout
)
void
vout_SDLEnd
(
vout_thread_t
*
p_vout
)
{
{
/* Release buffer */
SDLCloseDisplay
(
p_vout
);
if
(
p_vout
->
p_sys
->
b_must_acquire
)
SDL_Quit
();
{
SDL_UnlockSurface
(
p_vout
->
p_sys
->
p_display
);
}
free
(
p_vout
->
p_sys
);
}
}
/*****************************************************************************
/*****************************************************************************
...
@@ -166,7 +153,6 @@ void vout_SDLEnd( vout_thread_t *p_vout )
...
@@ -166,7 +153,6 @@ void vout_SDLEnd( vout_thread_t *p_vout )
*****************************************************************************/
*****************************************************************************/
void
vout_SDLDestroy
(
vout_thread_t
*
p_vout
)
void
vout_SDLDestroy
(
vout_thread_t
*
p_vout
)
{
{
SDLCloseDisplay
(
p_vout
);
free
(
p_vout
->
p_sys
);
free
(
p_vout
->
p_sys
);
}
}
...
@@ -181,24 +167,13 @@ int vout_SDLManage( vout_thread_t *p_vout )
...
@@ -181,24 +167,13 @@ int vout_SDLManage( vout_thread_t *p_vout )
/* If the display has to be reopened we do so */
/* If the display has to be reopened we do so */
if
(
p_vout
->
p_sys
->
b_reopen_display
)
if
(
p_vout
->
p_sys
->
b_reopen_display
)
{
{
p_vout
->
p_sys
->
b_must_acquire
=
0
;
SDLCloseDisplay
(
p_vout
);
if
(
p_vout
->
p_sys
->
p_display
)
{
if
(
p_vout
->
p_sys
->
p_overlay
)
{
SDL_FreeYUVOverlay
(
p_vout
->
p_sys
->
p_overlay
);
p_vout
->
p_sys
->
p_overlay
=
NULL
;
}
SDL_FreeSurface
(
p_vout
->
p_sys
->
p_display
);
p_vout
->
p_sys
->
p_display
=
NULL
;
}
if
(
SDLOpenDisplay
(
p_vout
)
)
if
(
SDLOpenDisplay
(
p_vout
)
)
{
{
intf_ErrMsg
(
"error: can't open DISPLAY default display"
);
intf_ErrMsg
(
"error: can't open DISPLAY default display"
);
return
(
1
);
return
(
1
);
}
}
p_vout
->
p_sys
->
b_reopen_display
=
0
;
}
}
return
(
0
);
return
(
0
);
}
}
...
@@ -212,26 +187,20 @@ int vout_SDLManage( vout_thread_t *p_vout )
...
@@ -212,26 +187,20 @@ int vout_SDLManage( vout_thread_t *p_vout )
void
vout_SDLDisplay
(
vout_thread_t
*
p_vout
)
void
vout_SDLDisplay
(
vout_thread_t
*
p_vout
)
{
{
SDL_Rect
disp
;
SDL_Rect
disp
;
if
(
p_vout
->
b_need_render
)
if
(
p_vout
->
p_sys
->
p_display
&&
!
p_vout
->
p_sys
->
b_reopen_display
)
{
{
/* Change display frame */
if
(
p_vout
->
b_need_render
)
if
(
p_vout
->
p_sys
->
b_must_acquire
)
{
{
/* Change display frame */
SDL_Flip
(
p_vout
->
p_sys
->
p_display
);
SDL_Flip
(
p_vout
->
p_sys
->
p_display
);
/* Swap buffers and change write frame */
//SDL_LockSurface ( p_vout->p_sys->p_display );
}
}
}
else
else
{
/*
* p_vout->p_rendered_pic->p_y/u/v contains the YUV buffers to render
*/
if
(
p_vout
->
p_sys
->
b_must_acquire
)
{
{
/*
* p_vout->p_rendered_pic->p_y/u/v contains the YUV buffers to
* render
*/
/* TODO: support for streams other than 4:2:0 */
/* TODO: support for streams other than 4:2:0 */
/* create the overlay if necessary */
/* create the overlay if necessary */
if
(
p_vout
->
p_sys
->
p_overlay
==
NULL
)
if
(
p_vout
->
p_sys
->
p_overlay
==
NULL
)
...
@@ -325,6 +294,8 @@ static int SDLOpenDisplay( vout_thread_t *p_vout )
...
@@ -325,6 +294,8 @@ static int SDLOpenDisplay( vout_thread_t *p_vout )
return
(
1
);
return
(
1
);
}
}
SDL_LockSurface
(
p_vout
->
p_sys
->
p_display
);
if
(
p_vout
->
p_sys
->
b_fullscreen
)
if
(
p_vout
->
p_sys
->
b_fullscreen
)
SDL_ShowCursor
(
0
);
SDL_ShowCursor
(
0
);
else
else
...
@@ -382,8 +353,7 @@ static int SDLOpenDisplay( vout_thread_t *p_vout )
...
@@ -382,8 +353,7 @@ static int SDLOpenDisplay( vout_thread_t *p_vout )
p_vout
->
i_changes
|=
VOUT_YUV_CHANGE
;
p_vout
->
i_changes
|=
VOUT_YUV_CHANGE
;
/* Check buffers properties */
p_vout
->
p_sys
->
b_reopen_display
=
0
;
p_vout
->
p_sys
->
b_must_acquire
=
1
;
/* always acquire */
return
(
0
);
return
(
0
);
}
}
...
@@ -396,10 +366,9 @@ static int SDLOpenDisplay( vout_thread_t *p_vout )
...
@@ -396,10 +366,9 @@ static int SDLOpenDisplay( vout_thread_t *p_vout )
*****************************************************************************/
*****************************************************************************/
static
void
SDLCloseDisplay
(
vout_thread_t
*
p_vout
)
static
void
SDLCloseDisplay
(
vout_thread_t
*
p_vout
)
{
{
/*
if
(
p_vout
->
p_sys
->
p_display
!=
NULL
)
if
(
p_vout
->
p_sys
->
p_display
!=
NULL
)
{
{
p_vout->p_sys->b_must_acquire = 0
;
SDL_UnlockSurface
(
p_vout
->
p_sys
->
p_display
)
;
if
(
p_vout
->
p_sys
->
p_overlay
!=
NULL
)
if
(
p_vout
->
p_sys
->
p_overlay
!=
NULL
)
{
{
SDL_FreeYUVOverlay
(
p_vout
->
p_sys
->
p_overlay
);
SDL_FreeYUVOverlay
(
p_vout
->
p_sys
->
p_overlay
);
...
@@ -408,9 +377,5 @@ static void SDLCloseDisplay( vout_thread_t *p_vout )
...
@@ -408,9 +377,5 @@ static void SDLCloseDisplay( vout_thread_t *p_vout )
SDL_FreeSurface
(
p_vout
->
p_sys
->
p_display
);
SDL_FreeSurface
(
p_vout
->
p_sys
->
p_display
);
p_vout
->
p_sys
->
p_display
=
NULL
;
p_vout
->
p_sys
->
p_display
=
NULL
;
}
}
*/
SDL_Quit
();
/* Prevents from cleaning, but prevents from SEGfaulting */
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment