Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-gpu
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-gpu
Commits
96c54f23
Commit
96c54f23
authored
Jun 04, 2004
by
Olivier Aubert
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Coding-style updates (whitespace related)
parent
88c64058
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
127 additions
and
127 deletions
+127
-127
modules/video_output/snapshot.c
modules/video_output/snapshot.c
+127
-127
No files found.
modules/video_output/snapshot.c
View file @
96c54f23
...
...
@@ -2,7 +2,7 @@
* snapshot.c : snapshot plugin for vlc
*****************************************************************************
* Copyright (C) 2002 VideoLAN
* $Id
: snapshot.c,v 1.5 2004/01/30 11:26:20 oaubert Exp
$
* $Id$
*
* Authors: Olivier Aubert <oaubert@lisi.univ-lyon1.fr>
*
...
...
@@ -43,26 +43,26 @@ static void Display ( vout_thread_t *, picture_t * );
/*****************************************************************************
* Module descriptor
*****************************************************************************/
#define WIDTH_TEXT N_(
"snapshot width"
)
#define WIDTH_LONGTEXT N_(
"Set the width of the snapshot image"
)
#define WIDTH_TEXT N_(
"snapshot width"
)
#define WIDTH_LONGTEXT N_(
"Set the width of the snapshot image"
)
#define HEIGHT_TEXT N_(
"snapshot height"
)
#define HEIGHT_LONGTEXT N_(
"Set the height of the snapshot image"
)
#define HEIGHT_TEXT N_(
"snapshot height"
)
#define HEIGHT_LONGTEXT N_(
"Set the height of the snapshot image"
)
#define CHROMA_TEXT N_(
"chroma"
)
#define CHROMA_LONGTEXT N_(
"Set the desired chroma for the snapshot image (a 4 character string)"
)
#define CHROMA_TEXT N_(
"chroma"
)
#define CHROMA_LONGTEXT N_(
"Set the desired chroma for the snapshot image (a 4 character string)"
)
#define CACHE_TEXT N_(
"cache size (number of images)"
)
#define CACHE_LONGTEXT N_(
"Set the cache size (number of images to keep)"
)
#define CACHE_TEXT N_(
"cache size (number of images)"
)
#define CACHE_LONGTEXT N_(
"Set the cache size (number of images to keep)"
)
vlc_module_begin
(
);
set_description
(
_
(
"snapshot module"
)
);
vlc_module_begin
(
);
set_description
(
_
(
"snapshot module"
)
);
set_capability
(
"video output"
,
0
);
add_integer
(
"snapshot-width"
,
320
,
NULL
,
WIDTH_TEXT
,
WIDTH_LONGTEXT
,
VLC_FALSE
);
add_integer
(
"snapshot-height"
,
200
,
NULL
,
HEIGHT_TEXT
,
HEIGHT_LONGTEXT
,
VLC_FALSE
);
add_string
(
"snapshot-chroma"
,
"RV32"
,
NULL
,
CHROMA_TEXT
,
CHROMA_LONGTEXT
,
VLC_TRUE
);
add_string
(
"snapshot-chroma"
,
"RV32"
,
NULL
,
CHROMA_TEXT
,
CHROMA_LONGTEXT
,
VLC_TRUE
);
add_integer
(
"snapshot-cache-size"
,
50
,
NULL
,
CACHE_TEXT
,
CACHE_LONGTEXT
,
VLC_TRUE
);
set_callbacks
(
Create
,
Destroy
);
...
...
@@ -87,18 +87,18 @@ struct vout_sys_t
*****************************************************************************/
static
int
Create
(
vlc_object_t
*
p_this
)
{
vout_thread_t
*
p_vout
=
(
vout_thread_t
*
)
p_this
;
vout_thread_t
*
p_vout
=
(
vout_thread_t
*
)
p_this
;
/* Allocate instance and initialize some members */
p_vout
->
p_sys
=
malloc
(
sizeof
(
vout_sys_t
)
);
if
(
!
p_vout
->
p_sys
)
if
(
!
p_vout
->
p_sys
)
return
VLC_ENOMEM
;
var_Create
(
p_this
,
"snapshot-width"
,
VLC_VAR_INTEGER
);
var_Create
(
p_this
,
"snapshot-height"
,
VLC_VAR_INTEGER
);
var_Create
(
p_this
,
"snapshot-datasize"
,
VLC_VAR_INTEGER
);
var_Create
(
p_this
,
"snapshot-cache-size"
,
VLC_VAR_INTEGER
);
var_Create
(
p_this
,
"snapshot-list-pointer"
,
VLC_VAR_ADDRESS
);
var_Create
(
p_this
,
"snapshot-width"
,
VLC_VAR_INTEGER
);
var_Create
(
p_this
,
"snapshot-height"
,
VLC_VAR_INTEGER
);
var_Create
(
p_this
,
"snapshot-datasize"
,
VLC_VAR_INTEGER
);
var_Create
(
p_this
,
"snapshot-cache-size"
,
VLC_VAR_INTEGER
);
var_Create
(
p_this
,
"snapshot-list-pointer"
,
VLC_VAR_ADDRESS
);
p_vout
->
pf_init
=
Init
;
p_vout
->
pf_end
=
NULL
;
...
...
@@ -127,23 +127,23 @@ static int Init( vout_thread_t *p_vout )
i_height
=
config_GetInt
(
p_vout
,
"snapshot-height"
);
psz_chroma
=
config_GetPsz
(
p_vout
,
"snapshot-chroma"
);
if
(
psz_chroma
)
if
(
psz_chroma
)
{
if
(
strlen
(
psz_chroma
)
<
4
)
if
(
strlen
(
psz_chroma
)
<
4
)
{
msg_Err
(
p_vout
,
"snapshot-chroma should be 4 characters long.
\n
"
);
msg_Err
(
p_vout
,
"snapshot-chroma should be 4 characters long.
\n
"
);
return
VLC_EGENERIC
;
}
i_chroma
=
VLC_FOURCC
(
psz_chroma
[
0
],
i_chroma
=
VLC_FOURCC
(
psz_chroma
[
0
],
psz_chroma
[
1
],
psz_chroma
[
2
],
psz_chroma
[
3
]
);
free
(
psz_chroma
);
psz_chroma
[
3
]
);
free
(
psz_chroma
);
}
else
{
msg_Err
(
p_vout
,
"Cannot find chroma information.
\n
"
);
msg_Err
(
p_vout
,
"Cannot find chroma information.
\n
"
);
return
VLC_EGENERIC
;
}
...
...
@@ -161,25 +161,25 @@ static int Init( vout_thread_t *p_vout )
/* Define the bitmasks */
switch
(
i_chroma
)
{
case
VLC_FOURCC
(
'R'
,
'V'
,
'1'
,
'5'
):
case
VLC_FOURCC
(
'R'
,
'V'
,
'1'
,
'5'
):
p_vout
->
output
.
i_rmask
=
0x001f
;
p_vout
->
output
.
i_gmask
=
0x03e0
;
p_vout
->
output
.
i_bmask
=
0x7c00
;
break
;
case
VLC_FOURCC
(
'R'
,
'V'
,
'1'
,
'6'
):
case
VLC_FOURCC
(
'R'
,
'V'
,
'1'
,
'6'
):
p_vout
->
output
.
i_rmask
=
0x001f
;
p_vout
->
output
.
i_gmask
=
0x07e0
;
p_vout
->
output
.
i_bmask
=
0xf800
;
break
;
case
VLC_FOURCC
(
'R'
,
'V'
,
'2'
,
'4'
):
case
VLC_FOURCC
(
'R'
,
'V'
,
'2'
,
'4'
):
p_vout
->
output
.
i_rmask
=
0xff0000
;
p_vout
->
output
.
i_gmask
=
0x00ff00
;
p_vout
->
output
.
i_bmask
=
0x0000ff
;
break
;
case
VLC_FOURCC
(
'R'
,
'V'
,
'3'
,
'2'
):
case
VLC_FOURCC
(
'R'
,
'V'
,
'3'
,
'2'
):
p_vout
->
output
.
i_rmask
=
0xff0000
;
p_vout
->
output
.
i_gmask
=
0x00ff00
;
p_vout
->
output
.
i_bmask
=
0x0000ff
;
...
...
@@ -229,22 +229,22 @@ static int Init( vout_thread_t *p_vout )
p_vout
->
p_sys
->
i_index
=
0
;
p_vout
->
p_sys
->
i_size
=
config_GetInt
(
p_vout
,
"snapshot-cache-size"
);
if
(
p_vout
->
p_sys
->
i_size
<
2
)
if
(
p_vout
->
p_sys
->
i_size
<
2
)
{
msg_Err
(
p_vout
,
"snapshot-cache-size must be at least 1."
);
msg_Err
(
p_vout
,
"snapshot-cache-size must be at least 1."
);
return
VLC_EGENERIC
;
}
p_vout
->
p_sys
->
p_list
=
(
snapshot_t
**
)
malloc
(
p_vout
->
p_sys
->
i_size
*
sizeof
(
snapshot_t
*
)
);
p_vout
->
p_sys
->
p_list
=
(
snapshot_t
**
)
malloc
(
p_vout
->
p_sys
->
i_size
*
sizeof
(
snapshot_t
*
)
);
if
(
p_vout
->
p_sys
->
p_list
==
NULL
)
return
VLC_ENOMEM
;
/* Initialize the structures for the circular buffer */
for
(
i_index
=
0
;
i_index
<
p_vout
->
p_sys
->
i_size
;
i_index
++
)
for
(
i_index
=
0
;
i_index
<
p_vout
->
p_sys
->
i_size
;
i_index
++
)
{
snapshot_t
*
p_snapshot
;
p_snapshot
=
(
snapshot_t
*
)
malloc
(
sizeof
(
snapshot_t
)
);
p_snapshot
=
(
snapshot_t
*
)
malloc
(
sizeof
(
snapshot_t
)
);
if
(
p_snapshot
==
NULL
)
return
VLC_ENOMEM
;
...
...
@@ -253,44 +253,45 @@ static int Init( vout_thread_t *p_vout )
p_snapshot
->
i_height
=
i_height
;
p_snapshot
->
i_datasize
=
i_datasize
;
p_snapshot
->
date
=
0
;
p_snapshot
->
p_data
=
(
char
*
)
malloc
(
i_datasize
);
p_snapshot
->
p_data
=
(
char
*
)
malloc
(
i_datasize
);
if
(
p_snapshot
->
p_data
==
NULL
)
return
VLC_ENOMEM
;
p_vout
->
p_sys
->
p_list
[
i_index
]
=
p_snapshot
;
p_vout
->
p_sys
->
p_list
[
i_index
]
=
p_snapshot
;
}
val
.
i_int
=
i_width
;
var_Set
(
p_vout
,
"snapshot-width"
,
val
);
var_Set
(
p_vout
,
"snapshot-width"
,
val
);
val
.
i_int
=
i_height
;
var_Set
(
p_vout
,
"snapshot-height"
,
val
);
var_Set
(
p_vout
,
"snapshot-height"
,
val
);
val
.
i_int
=
i_datasize
;
var_Set
(
p_vout
,
"snapshot-datasize"
,
val
);
var_Set
(
p_vout
,
"snapshot-datasize"
,
val
);
val
.
i_int
=
p_vout
->
p_sys
->
i_size
;
var_Set
(
p_vout
,
"snapshot-cache-size"
,
val
);
var_Set
(
p_vout
,
"snapshot-cache-size"
,
val
);
val
.
p_address
=
p_vout
->
p_sys
->
p_list
;
var_Set
(
p_vout
,
"snapshot-list-pointer"
,
val
);
var_Set
(
p_vout
,
"snapshot-list-pointer"
,
val
);
/* Get the p_input pointer (to access video times) */
p_vout
->
p_sys
->
p_input
=
vlc_object_find
(
p_vout
,
VLC_OBJECT_INPUT
,
FIND_PARENT
);
if
(
!
p_vout
->
p_sys
->
p_input
)
if
(
!
p_vout
->
p_sys
->
p_input
)
return
VLC_ENOOBJ
;
if
(
var_Create
(
p_vout
->
p_sys
->
p_input
,
"snapshot-id"
,
VLC_VAR_INTEGER
)
!=
VLC_SUCCESS
)
if
(
var_Create
(
p_vout
->
p_sys
->
p_input
,
"snapshot-id"
,
VLC_VAR_INTEGER
)
!=
VLC_SUCCESS
)
{
msg_Err
(
p_vout
,
"Cannot create snapshot-id variable in p_input (%d)."
,
p_vout
->
p_sys
->
p_input
->
i_object_id
);
msg_Err
(
p_vout
,
"Cannot create snapshot-id variable in p_input (%d)."
,
p_vout
->
p_sys
->
p_input
->
i_object_id
);
return
VLC_EGENERIC
;
}
/* Register the snapshot vout module at the input level */
val
.
i_int
=
p_vout
->
i_object_id
;
if
(
var_Set
(
p_vout
->
p_sys
->
p_input
,
"snapshot-id"
,
val
)
!=
VLC_SUCCESS
)
if
(
var_Set
(
p_vout
->
p_sys
->
p_input
,
"snapshot-id"
,
val
)
!=
VLC_SUCCESS
)
{
msg_Err
(
p_vout
,
"Cannot register snapshot-id in p_input (%d)."
,
p_vout
->
p_sys
->
p_input
->
i_object_id
);
msg_Err
(
p_vout
,
"Cannot register snapshot-id in p_input (%d)."
,
p_vout
->
p_sys
->
p_input
->
i_object_id
);
return
VLC_EGENERIC
;
}
...
...
@@ -304,43 +305,42 @@ static int Init( vout_thread_t *p_vout )
*****************************************************************************/
static
void
Destroy
(
vlc_object_t
*
p_this
)
{
vout_thread_t
*
p_vout
=
(
vout_thread_t
*
)
p_this
;
vout_thread_t
*
p_vout
=
(
vout_thread_t
*
)
p_this
;
vlc_object_t
*
p_vlc
;
int
i_index
;
fprintf
(
stderr
,
"Destroying snapshot module
\n
"
);
vlc_object_release
(
p_vout
->
p_sys
->
p_input
);
var_Destroy
(
p_this
,
"snapshot-width"
);
var_Destroy
(
p_this
,
"snapshot-height"
);
var_Destroy
(
p_this
,
"snapshot-datasize"
);
vlc_object_release
(
p_vout
->
p_sys
->
p_input
);
var_Destroy
(
p_this
,
"snapshot-width"
);
var_Destroy
(
p_this
,
"snapshot-height"
);
var_Destroy
(
p_this
,
"snapshot-datasize"
);
p_vlc
=
vlc_object_find
(
p_this
,
VLC_OBJECT_ROOT
,
FIND_PARENT
);
if
(
p_vlc
)
p_vlc
=
vlc_object_find
(
p_this
,
VLC_OBJECT_ROOT
,
FIND_PARENT
);
if
(
p_vlc
)
{
/* UnRegister the snapshot vout module at the root level */
/* var_Destroy (p_vlc, "snapshot-id"); */
var_Destroy
(
p_this
->
p_libvlc
,
"snapshot-id"
);
vlc_object_release
(
p_vlc
);
var_Destroy
(
p_this
->
p_libvlc
,
"snapshot-id"
);
vlc_object_release
(
p_vlc
);
}
for
(
i_index
=
0
;
i_index
<
p_vout
->
p_sys
->
i_size
;
i_index
++
)
for
(
i_index
=
0
;
i_index
<
p_vout
->
p_sys
->
i_size
;
i_index
++
)
{
free
(
p_vout
->
p_sys
->
p_list
[
i_index
]
->
p_data
);
free
(
p_vout
->
p_sys
->
p_list
[
i_index
]
->
p_data
);
}
free
(
p_vout
->
p_sys
->
p_list
);
free
(
p_vout
->
p_sys
->
p_list
);
/* Destroy structure */
free
(
p_vout
->
p_sys
);
}
/* Return the position in ms from the start of the movie */
mtime_t
get_movietime
(
vout_thread_t
*
p_vout
)
mtime_t
snapshot_GetMovietime
(
vout_thread_t
*
p_vout
)
{
input_thread_t
*
p_input
;
vlc_value_t
val
;
mtime_t
result
;
p_input
=
p_vout
->
p_sys
->
p_input
;
if
(
!
p_input
)
if
(
!
p_input
)
return
0
;
var_Get
(
p_input
,
"time"
,
&
val
);
...
...
@@ -354,10 +354,10 @@ mtime_t get_movietime(vout_thread_t *p_vout)
another method. */
stream_position_t
pos
;
input_Tell
(
p_input
,
&
pos
);
input_Tell
(
p_input
,
&
pos
);
result
=
pos
.
i_mux_rate
*
50
*
pos
.
i_tell
;
}
return
(
result
/
1000
);
return
(
result
/
1000
);
}
/*****************************************************************************
...
...
@@ -375,15 +375,15 @@ static void Display( vout_thread_t *p_vout, picture_t *p_pic )
p_vout
->
p_vlc
->
pf_memcpy
(
p_vout
->
p_sys
->
p_list
[
i_index
]
->
p_data
,
p_pic
->
p
->
p_pixels
,
p_vout
->
p_sys
->
i_datasize
);
p_vout
->
p_sys
->
i_datasize
);
date
=
get_movietime
(
p_vout
);
date
=
snapshot_GetMovietime
(
p_vout
);
p_vout
->
p_sys
->
p_list
[
i_index
]
->
date
=
date
;
p_vout
->
p_sys
->
p_list
[
i_index
]
->
date
=
date
;
i_index
++
;
if
(
i_index
>=
p_vout
->
p_sys
->
i_size
)
if
(
i_index
>=
p_vout
->
p_sys
->
i_size
)
{
i_index
=
0
;
}
...
...
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