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
39321c06
Commit
39321c06
authored
May 30, 2009
by
Laurent Aimar
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added a picture_fifo_t helper.
parent
a1cd0034
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
213 additions
and
0 deletions
+213
-0
include/vlc_picture_fifo.h
include/vlc_picture_fifo.h
+89
-0
src/libvlccore.sym
src/libvlccore.sym
+7
-0
src/video_output/vout_pictures.c
src/video_output/vout_pictures.c
+117
-0
No files found.
include/vlc_picture_fifo.h
0 → 100644
View file @
39321c06
/*****************************************************************************
* vlc_picture_fifo.h: picture fifo definitions
*****************************************************************************
* Copyright (C) 2009 the VideoLAN team
* $Id$
*
* Authors: Laurent Aimar <fenrir _AT_ videolan _DOT_ org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#ifndef VLC_PICTURE_FIFO_H
#define VLC_PICTURE_FIFO_H 1
/**
* \file
* This file defines picture fifo structures and functions in vlc
*/
#include <vlc_picture.h>
/**
* Picture fifo handle
*
* It is thread safe (push/pop).
*/
typedef
struct
picture_fifo_t
picture_fifo_t
;
/**
* It creates an empty picture_fifo_t.
*/
VLC_EXPORT
(
picture_fifo_t
*
,
picture_fifo_New
,
(
void
)
LIBVLC_USED
);
/**
* It destroys a fifo created by picture_fifo_New.
*
* All pictures inside the fifo will be released by picture_Release.
*/
VLC_EXPORT
(
void
,
picture_fifo_Delete
,
(
picture_fifo_t
*
)
);
/**
* It retreives a picture_t from the fifo.
*
* If the fifo is empty, it return NULL without waiting.
*/
VLC_EXPORT
(
picture_t
*
,
picture_fifo_Pop
,
(
picture_fifo_t
*
)
LIBVLC_USED
);
/**
* It returns the first picture_t pointer from the fifo but does not
* remove it. The picture returned has been hold for you so you
* must call picture_Release on it.
*
* If the fifo is empty, it return NULL without waiting.
*/
VLC_EXPORT
(
picture_t
*
,
picture_fifo_Peek
,
(
picture_fifo_t
*
)
LIBVLC_USED
);
/**
* It saves a picture_t into the fifo.
*/
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
* if b_below or higher or equal to not b_below than the given one.
*
* 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
)
);
/**
* It applies a delta on all the picture timestamp.
*/
VLC_EXPORT
(
void
,
picture_fifo_OffsetDate
,
(
picture_fifo_t
*
,
mtime_t
i_delta
)
);
#endif
/* VLC_PICTURE_FIFO_H */
src/libvlccore.sym
View file @
39321c06
...
...
@@ -276,6 +276,13 @@ path_sanitize
picture_CopyPixels
picture_Delete
picture_Export
picture_fifo_Delete
picture_fifo_Flush
picture_fifo_New
picture_fifo_OffsetDate
picture_fifo_Peek
picture_fifo_Pop
picture_fifo_Push
picture_New
picture_Reset
picture_Setup
...
...
src/video_output/vout_pictures.c
View file @
39321c06
...
...
@@ -38,6 +38,7 @@
#include <vlc_filter.h>
#include <vlc_image.h>
#include <vlc_block.h>
#include <vlc_picture_fifo.h>
#include "vout_pictures.h"
#include "vout_internal.h"
...
...
@@ -1070,3 +1071,119 @@ int picture_Export( vlc_object_t *p_obj,
/*****************************************************************************
*
*****************************************************************************/
struct
picture_fifo_t
{
vlc_mutex_t
lock
;
picture_t
*
p_first
;
picture_t
**
pp_last
;
};
static
void
PictureFifoReset
(
picture_fifo_t
*
p_fifo
)
{
p_fifo
->
p_first
=
NULL
;
p_fifo
->
pp_last
=
&
p_fifo
->
p_first
;
}
static
void
PictureFifoPush
(
picture_fifo_t
*
p_fifo
,
picture_t
*
p_picture
)
{
assert
(
!
p_picture
->
p_next
);
*
p_fifo
->
pp_last
=
p_picture
;
p_fifo
->
pp_last
=
&
p_picture
->
p_next
;
}
static
picture_t
*
PictureFifoPop
(
picture_fifo_t
*
p_fifo
)
{
picture_t
*
p_picture
=
p_fifo
->
p_first
;
if
(
p_picture
)
{
p_fifo
->
p_first
=
p_picture
->
p_next
;
if
(
!
p_fifo
->
p_first
)
p_fifo
->
pp_last
=
&
p_fifo
->
p_first
;
}
return
p_picture
;
}
picture_fifo_t
*
picture_fifo_New
(
void
)
{
picture_fifo_t
*
p_fifo
=
malloc
(
sizeof
(
*
p_fifo
)
);
if
(
!
p_fifo
)
return
NULL
;
vlc_mutex_init
(
&
p_fifo
->
lock
);
PictureFifoReset
(
p_fifo
);
return
p_fifo
;
}
void
picture_fifo_Push
(
picture_fifo_t
*
p_fifo
,
picture_t
*
p_picture
)
{
vlc_mutex_lock
(
&
p_fifo
->
lock
);
PictureFifoPush
(
p_fifo
,
p_picture
);
vlc_mutex_unlock
(
&
p_fifo
->
lock
);
}
picture_t
*
picture_fifo_Pop
(
picture_fifo_t
*
p_fifo
)
{
vlc_mutex_lock
(
&
p_fifo
->
lock
);
picture_t
*
p_picture
=
PictureFifoPop
(
p_fifo
);
vlc_mutex_unlock
(
&
p_fifo
->
lock
);
return
p_picture
;
}
picture_t
*
picture_fifo_Peek
(
picture_fifo_t
*
p_fifo
)
{
vlc_mutex_lock
(
&
p_fifo
->
lock
);
picture_t
*
p_picture
=
p_fifo
->
p_first
;
if
(
p_picture
)
picture_Hold
(
p_picture
);
vlc_mutex_unlock
(
&
p_fifo
->
lock
);
return
p_picture
;
}
void
picture_fifo_Flush
(
picture_fifo_t
*
p_fifo
,
mtime_t
i_date
,
bool
b_below
)
{
picture_t
*
p_picture
;
vlc_mutex_lock
(
&
p_fifo
->
lock
);
p_picture
=
p_fifo
->
p_first
;
PictureFifoReset
(
p_fifo
);
picture_fifo_t
tmp
;
PictureFifoReset
(
&
tmp
);
while
(
p_picture
)
{
picture_t
*
p_next
=
p_picture
->
p_next
;
p_picture
->
p_next
=
NULL
;
if
(
(
b_below
&&
p_picture
->
date
<=
i_date
)
||
(
!
b_below
&&
p_picture
->
date
>=
i_date
)
)
PictureFifoPush
(
&
tmp
,
p_picture
);
else
PictureFifoPush
(
p_fifo
,
p_picture
);
p_picture
=
p_next
;
}
vlc_mutex_unlock
(
&
p_fifo
->
lock
);
for
(
;;
)
{
picture_t
*
p_picture
=
PictureFifoPop
(
&
tmp
);
if
(
!
p_picture
)
break
;
picture_Release
(
p_picture
);
}
}
void
picture_fifo_OffsetDate
(
picture_fifo_t
*
p_fifo
,
mtime_t
i_delta
)
{
vlc_mutex_lock
(
&
p_fifo
->
lock
);
for
(
picture_t
*
p_picture
=
p_fifo
->
p_first
;
p_picture
!=
NULL
;
)
{
p_picture
->
date
+=
i_delta
;
p_picture
=
p_picture
->
p_next
;
}
vlc_mutex_unlock
(
&
p_fifo
->
lock
);
}
void
picture_fifo_Delete
(
picture_fifo_t
*
p_fifo
)
{
picture_fifo_Flush
(
p_fifo
,
INT64_MAX
,
true
);
vlc_mutex_destroy
(
&
p_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