Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
F
ffmpeg.wasm-core
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Linshizhi
ffmpeg.wasm-core
Commits
246007d3
Commit
246007d3
authored
Dec 27, 2011
by
Luca Barbato
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
v4l2: simplify away io_method
Only mmap is supported.
parent
a896d7f4
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
40 deletions
+5
-40
v4l2.c
libavdevice/v4l2.c
+5
-40
No files found.
libavdevice/v4l2.c
View file @
246007d3
...
...
@@ -51,17 +51,10 @@
static
const
int
desired_video_buffers
=
256
;
enum
io_method
{
io_read
,
io_mmap
,
io_userptr
};
struct
video_data
{
AVClass
*
class
;
int
fd
;
int
frame_format
;
/* V4L2_PIX_FMT_* */
enum
io_method
io_method
;
int
width
,
height
;
int
frame_size
;
int
interlaced
;
...
...
@@ -337,11 +330,6 @@ static int mmap_init(AVFormatContext *ctx)
return
0
;
}
static
int
read_init
(
AVFormatContext
*
ctx
)
{
return
-
1
;
}
static
void
mmap_release_buffer
(
AVPacket
*
pkt
)
{
struct
v4l2_buffer
buf
;
...
...
@@ -422,11 +410,6 @@ static int mmap_read_frame(AVFormatContext *ctx, AVPacket *pkt)
return
s
->
buf_len
[
buf
.
index
];
}
static
int
read_frame
(
AVFormatContext
*
ctx
,
AVPacket
*
pkt
)
{
return
-
1
;
}
static
int
mmap_start
(
AVFormatContext
*
ctx
)
{
struct
video_data
*
s
=
ctx
->
priv_data
;
...
...
@@ -693,19 +676,13 @@ static int v4l2_read_header(AVFormatContext *s1, AVFormatParameters *ap)
avpicture_get_size
(
st
->
codec
->
pix_fmt
,
s
->
width
,
s
->
height
);
if
(
capabilities
&
V4L2_CAP_STREAMING
)
{
s
->
io_method
=
io_mmap
;
res
=
mmap_init
(
s1
);
if
(
res
==
0
)
{
if
(
!
(
res
=
mmap_init
(
s1
)))
res
=
mmap_start
(
s1
);
}
}
else
{
s
->
io_method
=
io_read
;
res
=
read_init
(
s1
);
res
=
AVERROR
(
ENOSYS
);
}
if
(
res
<
0
)
{
close
(
s
->
fd
);
res
=
AVERROR
(
EIO
);
goto
out
;
}
s
->
top_field_first
=
first_field
(
s
->
fd
);
...
...
@@ -726,18 +703,8 @@ static int v4l2_read_packet(AVFormatContext *s1, AVPacket *pkt)
AVFrame
*
frame
=
s1
->
streams
[
0
]
->
codec
->
coded_frame
;
int
res
;
if
(
s
->
io_method
==
io_mmap
)
{
av_init_packet
(
pkt
);
res
=
mmap_read_frame
(
s1
,
pkt
);
}
else
if
(
s
->
io_method
==
io_read
)
{
if
(
av_new_packet
(
pkt
,
s
->
frame_size
)
<
0
)
return
AVERROR
(
EIO
);
res
=
read_frame
(
s1
,
pkt
);
}
else
{
return
AVERROR
(
EIO
);
}
if
(
res
<
0
)
{
av_init_packet
(
pkt
);
if
((
res
=
mmap_read_frame
(
s1
,
pkt
))
<
0
)
{
return
res
;
}
...
...
@@ -753,9 +720,7 @@ static int v4l2_read_close(AVFormatContext *s1)
{
struct
video_data
*
s
=
s1
->
priv_data
;
if
(
s
->
io_method
==
io_mmap
)
{
mmap_close
(
s
);
}
mmap_close
(
s
);
close
(
s
->
fd
);
return
0
;
...
...
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