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
03fafd80
Commit
03fafd80
authored
Mar 08, 2013
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
v4l2: use buffer PTS where available (fix #5474)
parent
7f52b2ae
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
22 additions
and
2 deletions
+22
-2
modules/access/v4l2/demux.c
modules/access/v4l2/demux.c
+1
-2
modules/access/v4l2/v4l2.h
modules/access/v4l2/v4l2.h
+1
-0
modules/access/v4l2/video.c
modules/access/v4l2/video.c
+20
-0
No files found.
modules/access/v4l2/demux.c
View file @
03fafd80
...
@@ -566,7 +566,7 @@ static void *UserPtrThread (void *data)
...
@@ -566,7 +566,7 @@ static void *UserPtrThread (void *data)
assert
(
block
->
p_buffer
==
(
void
*
)
buf
.
m
.
userptr
);
assert
(
block
->
p_buffer
==
(
void
*
)
buf
.
m
.
userptr
);
block
->
i_buffer
=
buf
.
length
;
block
->
i_buffer
=
buf
.
length
;
block
->
i_pts
=
block
->
i_dts
=
mdate
(
);
block
->
i_pts
=
block
->
i_dts
=
GetBufferPTS
(
&
buf
);
block
->
i_flags
|=
sys
->
block_flags
;
block
->
i_flags
|=
sys
->
block_flags
;
es_out_Control
(
demux
->
out
,
ES_OUT_SET_PCR
,
block
->
i_pts
);
es_out_Control
(
demux
->
out
,
ES_OUT_SET_PCR
,
block
->
i_pts
);
es_out_Send
(
demux
->
out
,
sys
->
es
,
block
);
es_out_Send
(
demux
->
out
,
sys
->
es
,
block
);
...
@@ -611,7 +611,6 @@ static void *MmapThread (void *data)
...
@@ -611,7 +611,6 @@ static void *MmapThread (void *data)
block_t
*
block
=
GrabVideo
(
VLC_OBJECT
(
demux
),
fd
,
sys
->
bufv
);
block_t
*
block
=
GrabVideo
(
VLC_OBJECT
(
demux
),
fd
,
sys
->
bufv
);
if
(
block
!=
NULL
)
if
(
block
!=
NULL
)
{
{
block
->
i_pts
=
block
->
i_dts
=
mdate
();
block
->
i_flags
|=
sys
->
block_flags
;
block
->
i_flags
|=
sys
->
block_flags
;
es_out_Control
(
demux
->
out
,
ES_OUT_SET_PCR
,
block
->
i_pts
);
es_out_Control
(
demux
->
out
,
ES_OUT_SET_PCR
,
block
->
i_pts
);
es_out_Send
(
demux
->
out
,
sys
->
es
,
block
);
es_out_Send
(
demux
->
out
,
sys
->
es
,
block
);
...
...
modules/access/v4l2/v4l2.h
View file @
03fafd80
...
@@ -55,6 +55,7 @@ int StartUserPtr (vlc_object_t *, int);
...
@@ -55,6 +55,7 @@ int StartUserPtr (vlc_object_t *, int);
struct
buffer_t
*
StartMmap
(
vlc_object_t
*
,
int
,
uint32_t
*
);
struct
buffer_t
*
StartMmap
(
vlc_object_t
*
,
int
,
uint32_t
*
);
void
StopMmap
(
int
,
struct
buffer_t
*
,
uint32_t
);
void
StopMmap
(
int
,
struct
buffer_t
*
,
uint32_t
);
mtime_t
GetBufferPTS
(
const
struct
v4l2_buffer
*
);
block_t
*
GrabVideo
(
vlc_object_t
*
,
int
,
const
struct
buffer_t
*
);
block_t
*
GrabVideo
(
vlc_object_t
*
,
int
,
const
struct
buffer_t
*
);
#ifdef ZVBI_COMPILED
#ifdef ZVBI_COMPILED
...
...
modules/access/v4l2/video.c
View file @
03fafd80
...
@@ -28,6 +28,7 @@
...
@@ -28,6 +28,7 @@
# include "config.h"
# include "config.h"
#endif
#endif
#include <assert.h>
#include <errno.h>
#include <errno.h>
#include <sys/ioctl.h>
#include <sys/ioctl.h>
#include <sys/mman.h>
#include <sys/mman.h>
...
@@ -513,6 +514,24 @@ int SetupFormat (vlc_object_t *obj, int fd, uint32_t fourcc,
...
@@ -513,6 +514,24 @@ int SetupFormat (vlc_object_t *obj, int fd, uint32_t fourcc,
return
0
;
return
0
;
}
}
mtime_t
GetBufferPTS
(
const
struct
v4l2_buffer
*
buf
)
{
mtime_t
pts
;
switch
(
buf
->
flags
&
V4L2_BUF_FLAG_TIMESTAMP_MASK
)
{
case
V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC
:
pts
=
(
buf
->
timestamp
.
tv_sec
*
CLOCK_FREQ
)
+
buf
->
timestamp
.
tv_usec
;
static_assert
(
CLOCK_FREQ
==
1000000
,
"Clock unit mismatch"
);
break
;
case
V4L2_BUF_FLAG_TIMESTAMP_UNKNOWN
:
default:
pts
=
mdate
();
break
;
}
return
pts
;
}
/*****************************************************************************
/*****************************************************************************
* GrabVideo: Grab a video frame
* GrabVideo: Grab a video frame
...
@@ -545,6 +564,7 @@ block_t *GrabVideo (vlc_object_t *demux, int fd,
...
@@ -545,6 +564,7 @@ block_t *GrabVideo (vlc_object_t *demux, int fd,
block_t
*
block
=
block_Alloc
(
buf
.
bytesused
);
block_t
*
block
=
block_Alloc
(
buf
.
bytesused
);
if
(
unlikely
(
block
==
NULL
))
if
(
unlikely
(
block
==
NULL
))
return
NULL
;
return
NULL
;
block
->
i_pts
=
block
->
i_dts
=
GetBufferPTS
(
&
buf
);
memcpy
(
block
->
p_buffer
,
bufv
[
buf
.
index
].
start
,
buf
.
bytesused
);
memcpy
(
block
->
p_buffer
,
bufv
[
buf
.
index
].
start
,
buf
.
bytesused
);
/* Unlock */
/* Unlock */
...
...
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