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
9a174d20
Commit
9a174d20
authored
Aug 30, 2017
by
James Almer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avfilter/lavfutils: remove usage of AVStream->codec
Signed-off-by:
James Almer
<
jamrial@gmail.com
>
parent
837c55e0
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
3 deletions
+17
-3
lavfutils.c
libavfilter/lavfutils.c
+17
-3
No files found.
libavfilter/lavfutils.c
View file @
9a174d20
...
...
@@ -29,6 +29,7 @@ int ff_load_image(uint8_t *data[4], int linesize[4],
AVFormatContext
*
format_ctx
=
NULL
;
AVCodec
*
codec
;
AVCodecContext
*
codec_ctx
;
AVCodecParameters
*
par
;
AVFrame
*
frame
;
int
frame_decoded
,
ret
=
0
;
AVPacket
pkt
;
...
...
@@ -50,14 +51,27 @@ int ff_load_image(uint8_t *data[4], int linesize[4],
return
ret
;
}
codec_ctx
=
format_ctx
->
streams
[
0
]
->
codec
;
codec
=
avcodec_find_decoder
(
codec_ctx
->
codec_id
);
par
=
format_ctx
->
streams
[
0
]
->
codecpar
;
codec
=
avcodec_find_decoder
(
par
->
codec_id
);
if
(
!
codec
)
{
av_log
(
log_ctx
,
AV_LOG_ERROR
,
"Failed to find codec
\n
"
);
ret
=
AVERROR
(
EINVAL
);
goto
end
;
}
codec_ctx
=
avcodec_alloc_context3
(
codec
);
if
(
!
codec_ctx
)
{
av_log
(
log_ctx
,
AV_LOG_ERROR
,
"Failed to alloc video decoder context
\n
"
);
ret
=
AVERROR
(
ENOMEM
);
goto
end
;
}
ret
=
avcodec_parameters_to_context
(
codec_ctx
,
par
);
if
(
ret
<
0
)
{
av_log
(
log_ctx
,
AV_LOG_ERROR
,
"Failed to copy codec parameters to decoder context
\n
"
);
goto
end
;
}
av_dict_set
(
&
opt
,
"thread_type"
,
"slice"
,
0
);
if
((
ret
=
avcodec_open2
(
codec_ctx
,
codec
,
&
opt
))
<
0
)
{
av_log
(
log_ctx
,
AV_LOG_ERROR
,
"Failed to open codec
\n
"
);
...
...
@@ -96,7 +110,7 @@ int ff_load_image(uint8_t *data[4], int linesize[4],
end:
av_packet_unref
(
&
pkt
);
avcodec_
close
(
codec_ctx
);
avcodec_
free_context
(
&
codec_ctx
);
avformat_close_input
(
&
format_ctx
);
av_frame_free
(
&
frame
);
av_dict_free
(
&
opt
);
...
...
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