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
a4270c7d
Commit
a4270c7d
authored
Jul 20, 2008
by
Laurent Aimar
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added picture_New/picture_Delete/picture_CopyPixels/picture_Copy
helpers.
parent
71c4969b
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
106 additions
and
10 deletions
+106
-10
include/vlc_vout.h
include/vlc_vout.h
+34
-0
src/libvlccore.sym
src/libvlccore.sym
+3
-0
src/video_output/vout_pictures.c
src/video_output/vout_pictures.c
+69
-10
No files found.
include/vlc_vout.h
View file @
a4270c7d
...
...
@@ -115,6 +115,23 @@ struct picture_t
struct
picture_t
*
p_next
;
};
/**
* This function will create a new picture.
* The picture created will implement a default release management compatible
* with picture_Yield and picture_Release. This default management will release
* picture_sys_t *p_sys field if non NULL.
*/
VLC_EXPORT
(
picture_t
*
,
picture_New
,
(
vlc_fourcc_t
i_chroma
,
int
i_width
,
int
i_height
,
int
i_aspect
)
);
/**
* This function will force the destruction a picture.
* The value of the picture reference count should be 0 before entering this
* function.
* Unless used for reimplementing pf_release, you should not use this
* function but picture_Release.
*/
VLC_EXPORT
(
void
,
picture_Delete
,
(
picture_t
*
)
);
/**
* This function will increase the picture reference count.
* It will not have any effect on picture obtained from vout
...
...
@@ -148,6 +165,23 @@ static inline void picture_CopyProperties( picture_t *p_dst, const picture_t *p_
p_dst
->
b_top_field_first
=
p_src
->
b_top_field_first
;
}
/**
* This function will copy the picture pixels.
*/
VLC_EXPORT
(
void
,
picture_CopyPixels
,
(
picture_t
*
p_dst
,
const
picture_t
*
p_src
)
);
/**
* This function will copy both picture dynamic properties and pixels.
* You have to notice that sometime a simple picture_Yield may do what
* you want without the copy overhead.
* Provided for convenience.
*/
static
inline
void
picture_Copy
(
picture_t
*
p_dst
,
const
picture_t
*
p_src
)
{
picture_CopyPixels
(
p_dst
,
p_src
);
picture_CopyProperties
(
p_dst
,
p_src
);
}
/**
* Video picture heap, either render (to store pictures used
* by the decoder) or output (to store pictures displayed by the vout plugin)
...
...
src/libvlccore.sym
View file @
a4270c7d
...
...
@@ -236,6 +236,9 @@ osd_ShowTextRelative
osd_Slider
__osd_Volume
path_sanitize
picture_CopyPixels
picture_Delete
picture_New
playlist_Add
playlist_AddExt
playlist_AddInput
...
...
src/video_output/vout_pictures.c
View file @
a4270c7d
...
...
@@ -849,8 +849,9 @@ int __vout_InitPicture( vlc_object_t *p_this, picture_t *p_pic,
break
;
default:
msg_Err
(
p_this
,
"unknown chroma type 0x%.8x (%4.4s)"
,
i_chroma
,
(
char
*
)
&
i_chroma
);
if
(
p_this
)
msg_Err
(
p_this
,
"unknown chroma type 0x%.8x (%4.4s)"
,
i_chroma
,
(
char
*
)
&
i_chroma
);
p_pic
->
i_planes
=
0
;
return
VLC_EGENERIC
;
}
...
...
@@ -944,35 +945,93 @@ int vout_ChromaCmp( vlc_fourcc_t i_chroma, vlc_fourcc_t i_amorhc )
void
__vout_CopyPicture
(
vlc_object_t
*
p_this
,
picture_t
*
p_dest
,
picture_t
*
p_src
)
{
VLC_UNUSED
(
p_this
);
VLC_UNUSED
(
p_this
);
picture_Copy
(
p_dest
,
p_src
);
}
/*****************************************************************************
*
*****************************************************************************/
static
void
PictureReleaseCallback
(
picture_t
*
p_picture
)
{
if
(
--
p_picture
->
i_refcount
>
0
)
return
;
picture_Delete
(
p_picture
);
}
/*****************************************************************************
*
*****************************************************************************/
picture_t
*
picture_New
(
vlc_fourcc_t
i_chroma
,
int
i_width
,
int
i_height
,
int
i_aspect
)
{
picture_t
*
p_picture
=
malloc
(
sizeof
(
*
p_picture
)
);
if
(
!
p_picture
)
return
NULL
;
memset
(
p_picture
,
0
,
sizeof
(
*
p_picture
)
);
if
(
__vout_AllocatePicture
(
NULL
,
p_picture
,
i_chroma
,
i_width
,
i_height
,
i_aspect
)
)
{
free
(
p_picture
);
return
NULL
;
}
p_picture
->
i_refcount
=
1
;
p_picture
->
pf_release
=
PictureReleaseCallback
;
p_picture
->
i_status
=
RESERVED_PICTURE
;
return
p_picture
;
}
/*****************************************************************************
*
*****************************************************************************/
void
picture_Delete
(
picture_t
*
p_picture
)
{
assert
(
p_picture
&&
p_picture
->
i_refcount
==
0
);
free
(
p_picture
->
p_data_orig
);
free
(
p_picture
->
p_sys
);
free
(
p_picture
);
}
/*****************************************************************************
*
*****************************************************************************/
void
picture_CopyPixels
(
picture_t
*
p_dst
,
const
picture_t
*
p_src
)
{
int
i
;
for
(
i
=
0
;
i
<
p_src
->
i_planes
;
i
++
)
{
if
(
p_src
->
p
[
i
].
i_pitch
==
p_d
e
st
->
p
[
i
].
i_pitch
)
if
(
p_src
->
p
[
i
].
i_pitch
==
p_dst
->
p
[
i
].
i_pitch
)
{
/* There are margins, but with the same width : perfect ! */
vlc_memcpy
(
p_d
e
st
->
p
[
i
].
p_pixels
,
p_src
->
p
[
i
].
p_pixels
,
vlc_memcpy
(
p_dst
->
p
[
i
].
p_pixels
,
p_src
->
p
[
i
].
p_pixels
,
p_src
->
p
[
i
].
i_pitch
*
p_src
->
p
[
i
].
i_visible_lines
);
}
else
{
/* We need to proceed line by line */
uint8_t
*
p_in
=
p_src
->
p
[
i
].
p_pixels
;
uint8_t
*
p_out
=
p_dst
->
p
[
i
].
p_pixels
;
int
i_line
;
assert
(
p_in
);
uint8_t
*
p_out
=
p_dest
->
p
[
i
].
p_pixels
;
assert
(
p_out
);
int
i_line
;
for
(
i_line
=
p_src
->
p
[
i
].
i_visible_lines
;
i_line
--
;
)
{
vlc_memcpy
(
p_out
,
p_in
,
p_src
->
p
[
i
].
i_visible_pitch
);
p_in
+=
p_src
->
p
[
i
].
i_pitch
;
p_out
+=
p_d
e
st
->
p
[
i
].
i_pitch
;
p_out
+=
p_dst
->
p
[
i
].
i_pitch
;
}
}
}
picture_CopyProperties
(
p_dest
,
p_src
);
}
/*****************************************************************************
*
*****************************************************************************/
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