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
1cf93196
Commit
1cf93196
authored
Apr 03, 2017
by
Matthieu Bouron
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
doc/examples/extract_mvs: make pkt local to the main function
parent
82116bd8
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
12 deletions
+6
-12
extract_mvs.c
doc/examples/extract_mvs.c
+6
-12
No files found.
doc/examples/extract_mvs.c
View file @
1cf93196
...
...
@@ -31,13 +31,11 @@ static const char *src_filename = NULL;
static
int
video_stream_idx
=
-
1
;
static
AVFrame
*
frame
=
NULL
;
static
AVPacket
pkt
;
static
int
video_frame_count
=
0
;
static
int
decode_packet
(
void
)
static
int
decode_packet
(
const
AVPacket
*
pkt
)
{
if
(
pkt
.
stream_index
==
video_stream_idx
)
{
int
ret
=
avcodec_send_packet
(
video_dec_ctx
,
&
pkt
);
int
ret
=
avcodec_send_packet
(
video_dec_ctx
,
pkt
);
if
(
ret
<
0
)
{
fprintf
(
stderr
,
"Error while sending a packet to the decoder: %s
\n
"
,
av_err2str
(
ret
));
return
ret
;
...
...
@@ -71,7 +69,6 @@ static int decode_packet(void)
av_frame_unref
(
frame
);
}
}
}
return
0
;
}
...
...
@@ -124,6 +121,7 @@ static int open_codec_context(AVFormatContext *fmt_ctx, enum AVMediaType type)
int
main
(
int
argc
,
char
**
argv
)
{
int
ret
=
0
;
AVPacket
pkt
=
{
0
};
if
(
argc
!=
2
)
{
fprintf
(
stderr
,
"Usage: %s <video>
\n
"
,
argv
[
0
]);
...
...
@@ -162,21 +160,17 @@ int main(int argc, char **argv)
printf
(
"framenum,source,blockw,blockh,srcx,srcy,dstx,dsty,flags
\n
"
);
/* initialize packet, set data to NULL, let the demuxer fill it */
av_init_packet
(
&
pkt
);
/* read frames from the file */
while
(
av_read_frame
(
fmt_ctx
,
&
pkt
)
>=
0
)
{
ret
=
decode_packet
();
if
(
pkt
.
stream_index
==
video_stream_idx
)
ret
=
decode_packet
(
&
pkt
);
av_packet_unref
(
&
pkt
);
if
(
ret
<
0
)
break
;
}
/* flush cached frames */
pkt
.
data
=
NULL
;
pkt
.
size
=
0
;
decode_packet
();
decode_packet
(
NULL
);
end:
avcodec_free_context
(
&
video_dec_ctx
);
...
...
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