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
eb1e0679
Commit
eb1e0679
authored
May 20, 2008
by
Rafaël Carré
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use pictures reference counting
parent
bb5087cf
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
25 deletions
+16
-25
src/misc/image.c
src/misc/image.c
+16
-25
No files found.
src/misc/image.c
View file @
eb1e0679
...
...
@@ -241,14 +241,11 @@ static picture_t *ImageReadUrl( image_handler_t *p_image, const char *psz_url,
*
*/
void
PicRelease
(
picture_t
*
p_pic
){};
static
block_t
*
ImageWrite
(
image_handler_t
*
p_image
,
picture_t
*
p_pic
,
video_format_t
*
p_fmt_in
,
video_format_t
*
p_fmt_out
)
{
block_t
*
p_block
;
void
(
*
pf_release
)(
picture_t
*
);
/* Check if we can reuse the current encoder */
if
(
p_image
->
p_enc
&&
...
...
@@ -310,11 +307,9 @@ static block_t *ImageWrite( image_handler_t *p_image, picture_t *p_pic,
p_image
->
p_filter
->
fmt_out
.
video
=
p_image
->
p_enc
->
fmt_in
.
video
;
}
pf_release
=
p_pic
->
pf_release
;
p_pic
->
pf_release
=
PicRelease
;
/* Small hack */
p_pic
->
i_refcount
++
;
p_tmp_pic
=
p_image
->
p_filter
->
pf_video_filter
(
p_image
->
p_filter
,
p_pic
);
p_pic
->
pf_release
=
pf_release
;
p_block
=
p_image
->
p_enc
->
pf_encode_video
(
p_image
->
p_enc
,
p_tmp_pic
);
...
...
@@ -377,7 +372,6 @@ static picture_t *ImageConvert( image_handler_t *p_image, picture_t *p_pic,
video_format_t
*
p_fmt_in
,
video_format_t
*
p_fmt_out
)
{
void
(
*
pf_release
)(
picture_t
*
);
picture_t
*
p_pif
;
if
(
!
p_fmt_out
->
i_width
&&
!
p_fmt_out
->
i_height
&&
...
...
@@ -434,10 +428,8 @@ static picture_t *ImageConvert( image_handler_t *p_image, picture_t *p_pic,
p_image
->
p_filter
->
fmt_out
.
video
=
*
p_fmt_out
;
}
pf_release
=
p_pic
->
pf_release
;
p_pic
->
pf_release
=
PicRelease
;
/* Small hack */
p_pic
->
i_refcount
++
;
//pf_video_filter() will decrease the refcount
p_pif
=
p_image
->
p_filter
->
pf_video_filter
(
p_image
->
p_filter
,
p_pic
);
p_pic
->
pf_release
=
pf_release
;
if
(
p_fmt_in
->
i_chroma
==
p_fmt_out
->
i_chroma
&&
p_fmt_in
->
i_width
==
p_fmt_out
->
i_width
&&
...
...
@@ -459,9 +451,6 @@ static picture_t *ImageConvert( image_handler_t *p_image, picture_t *p_pic,
static
picture_t
*
ImageFilter
(
image_handler_t
*
p_image
,
picture_t
*
p_pic
,
video_format_t
*
p_fmt
,
const
char
*
psz_module
)
{
void
(
*
pf_release
)(
picture_t
*
);
picture_t
*
p_pif
;
/* Start a filter */
if
(
!
p_image
->
p_filter
)
{
...
...
@@ -484,12 +473,8 @@ static picture_t *ImageFilter( image_handler_t *p_image, picture_t *p_pic,
p_image
->
p_filter
->
fmt_out
.
video
=
*
p_fmt
;
}
pf_release
=
p_pic
->
pf_release
;
p_pic
->
pf_release
=
PicRelease
;
/* Small hack */
p_pif
=
p_image
->
p_filter
->
pf_video_filter
(
p_image
->
p_filter
,
p_pic
);
p_pic
->
pf_release
=
pf_release
;
return
p_pif
;
p_pic
->
i_refcount
++
;
return
p_image
->
p_filter
->
pf_video_filter
(
p_image
->
p_filter
,
p_pic
);
}
/**
...
...
@@ -562,9 +547,12 @@ static const char *Fourcc2Ext( vlc_fourcc_t i_codec )
static
void
video_release_buffer
(
picture_t
*
p_pic
)
{
if
(
p_pic
&&
p_pic
->
p_data_orig
)
free
(
p_pic
->
p_data_orig
);
if
(
p_pic
&&
p_pic
->
p_sys
)
free
(
p_pic
->
p_sys
);
if
(
p_pic
)
free
(
p_pic
);
if
(
--
p_pic
->
i_refcount
>
0
)
return
;
free
(
p_pic
->
p_data_orig
);
free
(
p_pic
->
p_sys
);
free
(
p_pic
);
}
static
picture_t
*
video_new_buffer
(
decoder_t
*
p_dec
)
...
...
@@ -587,23 +575,26 @@ static picture_t *video_new_buffer( decoder_t *p_dec )
p_pic
->
pf_release
=
video_release_buffer
;
p_pic
->
i_status
=
RESERVED_PICTURE
;
p_pic
->
p_sys
=
NULL
;
p_pic
->
i_refcount
=
1
;
return
p_pic
;
}
static
void
video_del_buffer
(
decoder_t
*
p_dec
,
picture_t
*
p_pic
)
{
if
(
p_pic
&&
p_pic
->
p_data_orig
)
free
(
p_pic
->
p_data_orig
);
if
(
p_pic
&&
p_pic
->
p_sys
)
free
(
p_pic
->
p_sys
);
if
(
p_pic
)
free
(
p_pic
);
free
(
p_pic
->
p_data_orig
);
free
(
p_pic
->
p_sys
);
free
(
p_pic
);
}
static
void
video_link_picture
(
decoder_t
*
p_dec
,
picture_t
*
p_pic
)
{
p_pic
->
i_refcount
++
;
}
static
void
video_unlink_picture
(
decoder_t
*
p_dec
,
picture_t
*
p_pic
)
{
video_release_buffer
(
p_pic
);
}
static
decoder_t
*
CreateDecoder
(
vlc_object_t
*
p_this
,
video_format_t
*
fmt
)
...
...
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