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
5d0f85f1
Commit
5d0f85f1
authored
Jul 13, 2016
by
Vittorio Giovara
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
libdc1394: Fill in packet data directly
Drop the packet embedded in the context.
parent
e344e651
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
23 deletions
+21
-23
libdc1394.c
libavdevice/libdc1394.c
+21
-23
No files found.
libavdevice/libdc1394.c
View file @
5d0f85f1
...
...
@@ -69,7 +69,8 @@ typedef struct dc1394_data {
char
*
pixel_format
;
/**< Set by a private option. */
char
*
framerate
;
/**< Set by a private option. */
AVPacket
packet
;
int
size
;
int
stream_index
;
}
dc1394_data
;
struct
dc1394_frame_format
{
...
...
@@ -177,16 +178,13 @@ static inline int dc1394_read_common(AVFormatContext *c,
vst
->
codecpar
->
format
=
fmt
->
pix_fmt
;
vst
->
avg_frame_rate
=
framerate
;
/* packet init */
av_init_packet
(
&
dc1394
->
packet
);
dc1394
->
packet
.
size
=
av_image_get_buffer_size
(
fmt
->
pix_fmt
,
fmt
->
width
,
fmt
->
height
,
1
);
dc1394
->
packet
.
stream_index
=
vst
->
index
;
dc1394
->
packet
.
flags
|=
AV_PKT_FLAG_KEY
;
dc1394
->
current_frame
=
0
;
dc1394
->
stream_index
=
vst
->
index
;
dc1394
->
size
=
av_image_get_buffer_size
(
fmt
->
pix_fmt
,
fmt
->
width
,
fmt
->
height
,
1
);
vst
->
codecpar
->
bit_rate
=
av_rescale
(
dc1394
->
packet
.
size
*
8
,
fps
->
frame_rate
,
1000
);
vst
->
codecpar
->
bit_rate
=
av_rescale
(
dc1394
->
size
*
8
,
fps
->
frame_rate
,
1000
);
*
select_fps
=
fps
;
*
select_fmt
=
fmt
;
out:
...
...
@@ -262,17 +260,17 @@ static int dc1394_v1_read_packet(AVFormatContext *c, AVPacket *pkt)
res
=
dc1394_dma_single_capture
(
&
dc1394
->
camera
);
if
(
res
==
DC1394_SUCCESS
)
{
dc1394
->
packet
.
data
=
(
uint8_t
*
)(
dc1394
->
camera
.
capture_buffer
);
dc1394
->
packet
.
pts
=
(
dc1394
->
current_frame
*
1000000
)
/
dc1394
->
frame_rate
;
res
=
dc1394
->
packet
.
size
;
pkt
->
data
=
(
uint8_t
*
)
dc1394
->
camera
.
capture_buffer
;
pkt
->
size
=
dc1394
->
size
;
pkt
->
pts
=
(
dc1394
->
current_frame
*
1000000
)
/
dc1394
->
frame_rate
;
pkt
->
flags
|=
AV_PKT_FLAG_KEY
;
pkt
->
stream_index
=
dc1394
->
stream_index
;
}
else
{
av_log
(
c
,
AV_LOG_ERROR
,
"DMA capture failed
\n
"
);
dc1394
->
packet
.
data
=
NULL
;
res
=
-
1
;
return
AVERROR_INVALIDDATA
;
}
*
pkt
=
dc1394
->
packet
;
return
res
;
return
pkt
->
size
;
}
static
int
dc1394_v1_close
(
AVFormatContext
*
context
)
...
...
@@ -374,17 +372,17 @@ static int dc1394_v2_read_packet(AVFormatContext *c, AVPacket *pkt)
res
=
dc1394_capture_dequeue
(
dc1394
->
camera
,
DC1394_CAPTURE_POLICY_WAIT
,
&
dc1394
->
frame
);
if
(
res
==
DC1394_SUCCESS
)
{
dc1394
->
packet
.
data
=
(
uint8_t
*
)
dc1394
->
frame
->
image
;
dc1394
->
packet
.
pts
=
dc1394
->
current_frame
*
1000000
/
dc1394
->
frame_rate
;
res
=
dc1394
->
frame
->
image_bytes
;
pkt
->
data
=
(
uint8_t
*
)
dc1394
->
frame
->
image
;
pkt
->
size
=
dc1394
->
frame
->
image_bytes
;
pkt
->
pts
=
dc1394
->
current_frame
*
1000000
/
dc1394
->
frame_rate
;
pkt
->
flags
|=
AV_PKT_FLAG_KEY
;
pkt
->
stream_index
=
dc1394
->
stream_index
;
}
else
{
av_log
(
c
,
AV_LOG_ERROR
,
"DMA capture failed
\n
"
);
dc1394
->
packet
.
data
=
NULL
;
res
=
-
1
;
return
AVERROR_INVALIDDATA
;
}
*
pkt
=
dc1394
->
packet
;
return
res
;
return
pkt
->
size
;
}
static
int
dc1394_v2_close
(
AVFormatContext
*
context
)
...
...
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