Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc
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
Commits
bfd2978e
Commit
bfd2978e
authored
May 11, 2012
by
Jean-Paul Saman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revert "video_filter/scene.c: write pictures in a separate thread."
This reverts commit
8bc285bd
.
parent
7ebcfcf4
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
112 deletions
+23
-112
modules/video_filter/scene.c
modules/video_filter/scene.c
+23
-112
No files found.
modules/video_filter/scene.c
View file @
bfd2978e
/*****************************************************************************
* scene.c : scene video filter (based on modules/video_output/image.c)
*****************************************************************************
* Copyright (C) 2004-20
12
the VideoLAN team
* Copyright (C) 2004-20
08
the VideoLAN team
* $Id$
*
* Authors: Jean-Paul Saman <jpsaman@videolan.org>
...
...
@@ -40,8 +40,6 @@
#include <vlc_strings.h>
#include <vlc_fs.h>
#include <vlc_picture_fifo.h>
/*****************************************************************************
* Local prototypes
*****************************************************************************/
...
...
@@ -52,7 +50,6 @@ static picture_t *Filter( filter_t *, picture_t * );
static
void
SnapshotRatio
(
filter_t
*
p_filter
,
picture_t
*
p_pic
);
static
void
SavePicture
(
filter_t
*
,
picture_t
*
);
static
void
*
WriteThread
(
void
*
);
/*****************************************************************************
* Module descriptor
...
...
@@ -126,12 +123,8 @@ static const char *const ppsz_vfilter_options[] = {
};
typedef
struct
scene_t
{
picture_fifo_t
*
fifo
;
vlc_mutex_t
lock
;
vlc_cond_t
wait
;
bool
empty
;
bool
stop
;
picture_t
*
p_pic
;
video_format_t
format
;
}
scene_t
;
/*****************************************************************************
...
...
@@ -139,8 +132,6 @@ typedef struct scene_t {
*****************************************************************************/
struct
filter_sys_t
{
vlc_thread_t
thread
;
image_handler_t
*
p_image
;
scene_t
scene
;
...
...
@@ -170,13 +161,6 @@ static int Create( vlc_object_t *p_this )
if
(
p_filter
->
p_sys
==
NULL
)
return
VLC_ENOMEM
;
p_sys
->
scene
.
fifo
=
picture_fifo_New
();
if
(
!
p_sys
->
scene
.
fifo
)
{
free
(
p_sys
);
return
VLC_ENOMEM
;
}
p_sys
->
p_image
=
image_HandlerCreate
(
p_this
);
if
(
!
p_sys
->
p_image
)
{
...
...
@@ -205,28 +189,8 @@ static int Create( vlc_object_t *p_this )
if
(
p_sys
->
psz_path
==
NULL
)
p_sys
->
psz_path
=
config_GetUserDir
(
VLC_PICTURES_DIR
);
p_sys
->
scene
.
stop
=
false
;
p_sys
->
scene
.
empty
=
true
;
vlc_mutex_init
(
&
p_sys
->
scene
.
lock
);
vlc_cond_init
(
&
p_sys
->
scene
.
wait
);
p_filter
->
pf_video_filter
=
Filter
;
if
(
vlc_clone
(
&
p_sys
->
thread
,
WriteThread
,
(
void
*
)
p_filter
,
VLC_THREAD_PRIORITY_OUTPUT
)
)
{
image_HandlerDelete
(
p_sys
->
p_image
);
if
(
p_sys
->
scene
.
fifo
)
picture_fifo_Delete
(
p_sys
->
scene
.
fifo
);
free
(
p_sys
->
psz_format
);
free
(
p_sys
->
psz_prefix
);
free
(
p_sys
->
psz_path
);
free
(
p_sys
);
return
VLC_EGENERIC
;
}
return
VLC_SUCCESS
;
}
...
...
@@ -238,21 +202,10 @@ static void Destroy( vlc_object_t *p_this )
filter_t
*
p_filter
=
(
filter_t
*
)
p_this
;
filter_sys_t
*
p_sys
=
(
filter_sys_t
*
)
p_filter
->
p_sys
;
vlc_mutex_lock
(
&
p_sys
->
scene
.
lock
);
p_sys
->
scene
.
stop
=
true
;
vlc_cond_signal
(
&
p_sys
->
scene
.
wait
);
vlc_mutex_unlock
(
&
p_sys
->
scene
.
lock
);
vlc_join
(
p_sys
->
thread
,
NULL
);
vlc_cond_destroy
(
&
p_sys
->
scene
.
wait
);
vlc_mutex_destroy
(
&
p_sys
->
scene
.
lock
);
image_HandlerDelete
(
p_sys
->
p_image
);
if
(
p_sys
->
scene
.
fifo
)
picture_fifo_Delete
(
p_sys
->
scene
.
fifo
);
if
(
p_sys
->
scene
.
p_pic
)
picture_Release
(
p_sys
->
scene
.
p_pic
);
free
(
p_sys
->
psz_format
);
free
(
p_sys
->
psz_prefix
);
free
(
p_sys
->
psz_path
);
...
...
@@ -282,56 +235,29 @@ static void SnapshotRatio( filter_t *p_filter, picture_t *p_pic )
}
p_sys
->
i_frames
++
;
picture_t
*
p_newpic
=
picture_NewFromFormat
(
&
p_pic
->
format
);
if
(
p_newpic
)
{
picture_Copy
(
p_newpic
,
p_pic
);
picture_fifo_Push
(
p_sys
->
scene
.
fifo
,
p_newpic
);
if
(
p_sys
->
scene
.
p_pic
)
picture_Release
(
p_sys
->
scene
.
p_pic
);
vlc_mutex_lock
(
&
p_sys
->
scene
.
lock
);
if
(
p_sys
->
scene
.
empty
)
{
p_sys
->
scene
.
empty
=
false
;
vlc_cond_signal
(
&
p_sys
->
scene
.
wait
);
}
vlc_mutex_unlock
(
&
p_sys
->
scene
.
lock
);
if
(
(
p_sys
->
i_width
<=
0
)
&&
(
p_sys
->
i_height
>
0
)
)
{
p_sys
->
i_width
=
(
p_pic
->
format
.
i_width
*
p_sys
->
i_height
)
/
p_pic
->
format
.
i_height
;
}
}
static
void
*
WriteThread
(
void
*
data
)
{
filter_t
*
p_filter
=
(
filter_t
*
)
data
;
filter_sys_t
*
p_sys
=
(
filter_sys_t
*
)
p_filter
->
p_sys
;
picture_t
*
p_pic
=
NULL
;
for
(;;)
else
if
(
(
p_sys
->
i_height
<=
0
)
&&
(
p_sys
->
i_width
>
0
)
)
{
p_pic
=
picture_fifo_Pop
(
p_sys
->
scene
.
fifo
);
if
(
!
p_pic
)
{
vlc_mutex_lock
(
&
p_sys
->
scene
.
lock
);
p_sys
->
scene
.
empty
=
true
;
while
(
p_sys
->
scene
.
empty
&&
!
p_sys
->
scene
.
stop
)
vlc_cond_wait
(
&
p_sys
->
scene
.
wait
,
&
p_sys
->
scene
.
lock
);
if
(
p_sys
->
scene
.
stop
)
{
vlc_mutex_unlock
(
&
p_sys
->
scene
.
lock
);
break
;
}
vlc_mutex_unlock
(
&
p_sys
->
scene
.
lock
);
continue
;
}
SavePicture
(
p_filter
,
p_pic
);
picture_Release
(
p_pic
);
p_pic
=
NULL
;
p_sys
->
i_height
=
(
p_pic
->
format
.
i_height
*
p_sys
->
i_width
)
/
p_pic
->
format
.
i_width
;
}
else
if
(
(
p_sys
->
i_width
<=
0
)
&&
(
p_sys
->
i_height
<=
0
)
)
{
p_sys
->
i_width
=
p_pic
->
format
.
i_width
;
p_sys
->
i_height
=
p_pic
->
format
.
i_height
;
}
if
(
p_pic
)
picture_Release
(
p_pic
);
return
NULL
;
p_sys
->
scene
.
p_pic
=
picture_NewFromFormat
(
&
p_pic
->
format
);
if
(
p_sys
->
scene
.
p_pic
)
{
picture_Copy
(
p_sys
->
scene
.
p_pic
,
p_pic
);
SavePicture
(
p_filter
,
p_sys
->
scene
.
p_pic
);
}
}
/*****************************************************************************
...
...
@@ -348,21 +274,6 @@ static void SavePicture( filter_t *p_filter, picture_t *p_pic )
memset
(
&
fmt_in
,
0
,
sizeof
(
video_format_t
)
);
memset
(
&
fmt_out
,
0
,
sizeof
(
video_format_t
)
);
/* Aspect */
if
(
(
p_sys
->
i_width
<=
0
)
&&
(
p_sys
->
i_height
>
0
)
)
{
p_sys
->
i_width
=
(
p_pic
->
format
.
i_width
*
p_sys
->
i_height
)
/
p_pic
->
format
.
i_height
;
}
else
if
(
(
p_sys
->
i_height
<=
0
)
&&
(
p_sys
->
i_width
>
0
)
)
{
p_sys
->
i_height
=
(
p_pic
->
format
.
i_height
*
p_sys
->
i_width
)
/
p_pic
->
format
.
i_width
;
}
else
if
(
(
p_sys
->
i_width
<=
0
)
&&
(
p_sys
->
i_height
<=
0
)
)
{
p_sys
->
i_width
=
p_pic
->
format
.
i_width
;
p_sys
->
i_height
=
p_pic
->
format
.
i_height
;
}
/* Save snapshot psz_format to a memory zone */
fmt_in
=
p_pic
->
format
;
fmt_out
.
i_sar_num
=
fmt_out
.
i_sar_den
=
1
;
...
...
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