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
237a788b
Commit
237a788b
authored
Sep 07, 2009
by
Laurent Aimar
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Cosmetics (K&R of picture_fifo).
parent
2deed367
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
69 additions
and
74 deletions
+69
-74
include/vlc_picture_fifo.h
include/vlc_picture_fifo.h
+3
-3
src/misc/picture_fifo.c
src/misc/picture_fifo.c
+66
-71
No files found.
include/vlc_picture_fifo.h
View file @
237a788b
...
@@ -73,16 +73,16 @@ VLC_EXPORT( void, picture_fifo_Push, ( picture_fifo_t *, picture_t * ) );
...
@@ -73,16 +73,16 @@ VLC_EXPORT( void, picture_fifo_Push, ( picture_fifo_t *, picture_t * ) );
/**
/**
* It release all picture inside the fifo that have a lower or equal date
* It release all picture inside the fifo that have a lower or equal date
* if
b_below or higher or equal to not b_below
than the given one.
* if
flush_before or higher or equal to if not flush_before
than the given one.
*
*
* All pictures inside the fifo will be released by picture_Release.
* All pictures inside the fifo will be released by picture_Release.
*/
*/
VLC_EXPORT
(
void
,
picture_fifo_Flush
,
(
picture_fifo_t
*
,
mtime_t
i_date
,
bool
b_below
)
);
VLC_EXPORT
(
void
,
picture_fifo_Flush
,
(
picture_fifo_t
*
,
mtime_t
date
,
bool
flush_before
)
);
/**
/**
* It applies a delta on all the picture timestamp.
* It applies a delta on all the picture timestamp.
*/
*/
VLC_EXPORT
(
void
,
picture_fifo_OffsetDate
,
(
picture_fifo_t
*
,
mtime_t
i_
delta
)
);
VLC_EXPORT
(
void
,
picture_fifo_OffsetDate
,
(
picture_fifo_t
*
,
mtime_t
delta
)
);
#endif
/* VLC_PICTURE_FIFO_H */
#endif
/* VLC_PICTURE_FIFO_H */
...
...
src/misc/picture_fifo.c
View file @
237a788b
...
@@ -37,119 +37,114 @@
...
@@ -37,119 +37,114 @@
/*****************************************************************************
/*****************************************************************************
*
*
*****************************************************************************/
*****************************************************************************/
struct
picture_fifo_t
struct
picture_fifo_t
{
{
vlc_mutex_t
lock
;
vlc_mutex_t
lock
;
picture_t
*
p_
first
;
picture_t
*
first
;
picture_t
**
pp_last
;
picture_t
**
last_ptr
;
};
};
static
void
PictureFifoReset
(
picture_fifo_t
*
p_fifo
)
static
void
PictureFifoReset
(
picture_fifo_t
*
fifo
)
{
{
p_fifo
->
p_first
=
NULL
;
fifo
->
first
=
NULL
;
p_fifo
->
pp_last
=
&
p_fifo
->
p_
first
;
fifo
->
last_ptr
=
&
fifo
->
first
;
}
}
static
void
PictureFifoPush
(
picture_fifo_t
*
p_fifo
,
picture_t
*
p_picture
)
static
void
PictureFifoPush
(
picture_fifo_t
*
fifo
,
picture_t
*
picture
)
{
{
assert
(
!
p_picture
->
p_next
);
assert
(
!
picture
->
p_next
);
*
p_fifo
->
pp_last
=
p_
picture
;
*
fifo
->
last_ptr
=
picture
;
p_fifo
->
pp_last
=
&
p_
picture
->
p_next
;
fifo
->
last_ptr
=
&
picture
->
p_next
;
}
}
static
picture_t
*
PictureFifoPop
(
picture_fifo_t
*
p_fifo
)
static
picture_t
*
PictureFifoPop
(
picture_fifo_t
*
fifo
)
{
{
picture_t
*
p
_picture
=
p_fifo
->
p_
first
;
picture_t
*
p
icture
=
fifo
->
first
;
if
(
p_picture
)
if
(
picture
)
{
{
fifo
->
first
=
picture
->
p_next
;
p_fifo
->
p_first
=
p_picture
->
p_next
;
if
(
!
fifo
->
first
)
if
(
!
p_fifo
->
p_first
)
fifo
->
last_ptr
=
&
fifo
->
first
;
p_fifo
->
pp_last
=
&
p_fifo
->
p_first
;
}
}
return
p
_p
icture
;
return
picture
;
}
}
picture_fifo_t
*
picture_fifo_New
(
void
)
picture_fifo_t
*
picture_fifo_New
(
void
)
{
{
picture_fifo_t
*
p_fifo
=
malloc
(
sizeof
(
*
p_fifo
)
);
picture_fifo_t
*
fifo
=
malloc
(
sizeof
(
*
fifo
)
);
if
(
!
p_fifo
)
if
(
!
fifo
)
return
NULL
;
return
NULL
;
vlc_mutex_init
(
&
p_fifo
->
lock
);
vlc_mutex_init
(
&
fifo
->
lock
);
PictureFifoReset
(
p_fifo
);
PictureFifoReset
(
fifo
);
return
p_
fifo
;
return
fifo
;
}
}
void
picture_fifo_Push
(
picture_fifo_t
*
p_fifo
,
picture_t
*
p_picture
)
void
picture_fifo_Push
(
picture_fifo_t
*
fifo
,
picture_t
*
picture
)
{
{
vlc_mutex_lock
(
&
p_fifo
->
lock
);
vlc_mutex_lock
(
&
fifo
->
lock
);
PictureFifoPush
(
p_fifo
,
p_picture
);
PictureFifoPush
(
fifo
,
picture
);
vlc_mutex_unlock
(
&
p_fifo
->
lock
);
vlc_mutex_unlock
(
&
fifo
->
lock
);
}
}
picture_t
*
picture_fifo_Pop
(
picture_fifo_t
*
p_fifo
)
picture_t
*
picture_fifo_Pop
(
picture_fifo_t
*
fifo
)
{
{
vlc_mutex_lock
(
&
p_fifo
->
lock
);
vlc_mutex_lock
(
&
fifo
->
lock
);
picture_t
*
p
_picture
=
PictureFifoPop
(
p_fifo
);
picture_t
*
p
icture
=
PictureFifoPop
(
fifo
);
vlc_mutex_unlock
(
&
p_fifo
->
lock
);
vlc_mutex_unlock
(
&
fifo
->
lock
);
return
p
_p
icture
;
return
picture
;
}
}
picture_t
*
picture_fifo_Peek
(
picture_fifo_t
*
p_fifo
)
picture_t
*
picture_fifo_Peek
(
picture_fifo_t
*
fifo
)
{
{
vlc_mutex_lock
(
&
p_fifo
->
lock
);
vlc_mutex_lock
(
&
fifo
->
lock
);
picture_t
*
p
_picture
=
p_fifo
->
p_
first
;
picture_t
*
p
icture
=
fifo
->
first
;
if
(
p_picture
)
if
(
picture
)
picture_Hold
(
p_picture
);
picture_Hold
(
picture
);
vlc_mutex_unlock
(
&
p_fifo
->
lock
);
vlc_mutex_unlock
(
&
fifo
->
lock
);
return
p
_p
icture
;
return
picture
;
}
}
void
picture_fifo_Flush
(
picture_fifo_t
*
p_fifo
,
mtime_t
i_date
,
bool
b_below
)
void
picture_fifo_Flush
(
picture_fifo_t
*
fifo
,
mtime_t
date
,
bool
flush_before
)
{
{
picture_t
*
p
_p
icture
;
picture_t
*
picture
;
vlc_mutex_lock
(
&
p_fifo
->
lock
);
vlc_mutex_lock
(
&
fifo
->
lock
);
p
_picture
=
p_fifo
->
p_
first
;
p
icture
=
fifo
->
first
;
PictureFifoReset
(
p_fifo
);
PictureFifoReset
(
fifo
);
picture_fifo_t
tmp
;
picture_fifo_t
tmp
;
PictureFifoReset
(
&
tmp
);
PictureFifoReset
(
&
tmp
);
while
(
p_picture
)
while
(
picture
)
{
{
picture_t
*
next
=
picture
->
p_next
;
picture_t
*
p_next
=
p_picture
->
p_next
;
p
_p
icture
->
p_next
=
NULL
;
picture
->
p_next
=
NULL
;
if
(
(
b_below
&&
p_picture
->
date
<=
i_date
)
||
if
((
flush_before
&&
picture
->
date
<=
date
)
||
(
!
b_below
&&
p_picture
->
date
>=
i_date
)
)
(
!
flush_before
&&
picture
->
date
>=
date
)
)
PictureFifoPush
(
&
tmp
,
p_picture
);
PictureFifoPush
(
&
tmp
,
picture
);
else
else
PictureFifoPush
(
p_fifo
,
p_picture
);
PictureFifoPush
(
fifo
,
picture
);
p
_picture
=
p_
next
;
p
icture
=
next
;
}
}
vlc_mutex_unlock
(
&
p_fifo
->
lock
);
vlc_mutex_unlock
(
&
fifo
->
lock
);
for
(
;;
)
for
(;;)
{
{
picture_t
*
picture
=
PictureFifoPop
(
&
tmp
);
picture_t
*
p_picture
=
PictureFifoPop
(
&
tmp
);
if
(
!
picture
)
if
(
!
p_picture
)
break
;
break
;
picture_Release
(
p_picture
);
picture_Release
(
picture
);
}
}
}
}
void
picture_fifo_OffsetDate
(
picture_fifo_t
*
p_fifo
,
mtime_t
i_delta
)
void
picture_fifo_OffsetDate
(
picture_fifo_t
*
fifo
,
mtime_t
delta
)
{
{
vlc_mutex_lock
(
&
p_fifo
->
lock
);
vlc_mutex_lock
(
&
fifo
->
lock
);
for
(
picture_t
*
p_picture
=
p_fifo
->
p_first
;
p_picture
!=
NULL
;
)
for
(
picture_t
*
picture
=
fifo
->
first
;
picture
!=
NULL
;)
{
{
picture
->
date
+=
delta
;
p_picture
->
date
+=
i_delta
;
picture
=
picture
->
p_next
;
p_picture
=
p_picture
->
p_next
;
}
}
vlc_mutex_unlock
(
&
p_fifo
->
lock
);
vlc_mutex_unlock
(
&
fifo
->
lock
);
}
}
void
picture_fifo_Delete
(
picture_fifo_t
*
p_fifo
)
void
picture_fifo_Delete
(
picture_fifo_t
*
fifo
)
{
{
picture_fifo_Flush
(
p_fifo
,
INT64_MAX
,
true
);
picture_fifo_Flush
(
fifo
,
INT64_MAX
,
true
);
vlc_mutex_destroy
(
&
p_fifo
->
lock
);
vlc_mutex_destroy
(
&
fifo
->
lock
);
}
}
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