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
1138eb55
Commit
1138eb55
authored
Feb 10, 2016
by
Anton Khirnov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
vsrc_movie: convert to codecpar
parent
ac6d5358
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
4 deletions
+12
-4
vsrc_movie.c
libavfilter/vsrc_movie.c
+12
-4
No files found.
libavfilter/vsrc_movie.c
View file @
1138eb55
...
@@ -86,6 +86,7 @@ static av_cold int movie_init(AVFilterContext *ctx)
...
@@ -86,6 +86,7 @@ static av_cold int movie_init(AVFilterContext *ctx)
{
{
MovieContext
*
movie
=
ctx
->
priv
;
MovieContext
*
movie
=
ctx
->
priv
;
AVInputFormat
*
iformat
=
NULL
;
AVInputFormat
*
iformat
=
NULL
;
AVStream
*
st
;
AVCodec
*
codec
;
AVCodec
*
codec
;
int
ret
;
int
ret
;
int64_t
timestamp
;
int64_t
timestamp
;
...
@@ -132,18 +133,26 @@ static av_cold int movie_init(AVFilterContext *ctx)
...
@@ -132,18 +133,26 @@ static av_cold int movie_init(AVFilterContext *ctx)
return
ret
;
return
ret
;
}
}
movie
->
stream_index
=
ret
;
movie
->
stream_index
=
ret
;
movie
->
codec_ctx
=
movie
->
format_ctx
->
streams
[
movie
->
stream_index
]
->
codec
;
st
=
movie
->
format_ctx
->
streams
[
movie
->
stream_index
]
;
/*
/*
* So now we've got a pointer to the so-called codec context for our video
* So now we've got a pointer to the so-called codec context for our video
* stream, but we still have to find the actual codec and open it.
* stream, but we still have to find the actual codec and open it.
*/
*/
codec
=
avcodec_find_decoder
(
movie
->
codec_ctx
->
codec_id
);
codec
=
avcodec_find_decoder
(
st
->
codecpar
->
codec_id
);
if
(
!
codec
)
{
if
(
!
codec
)
{
av_log
(
ctx
,
AV_LOG_ERROR
,
"Failed to find any codec
\n
"
);
av_log
(
ctx
,
AV_LOG_ERROR
,
"Failed to find any codec
\n
"
);
return
AVERROR
(
EINVAL
);
return
AVERROR
(
EINVAL
);
}
}
movie
->
codec_ctx
=
avcodec_alloc_context3
(
codec
);
if
(
!
movie
->
codec_ctx
)
return
AVERROR
(
ENOMEM
);
ret
=
avcodec_parameters_to_context
(
movie
->
codec_ctx
,
st
->
codecpar
);
if
(
ret
<
0
)
return
ret
;
movie
->
codec_ctx
->
refcounted_frames
=
1
;
movie
->
codec_ctx
->
refcounted_frames
=
1
;
if
((
ret
=
avcodec_open2
(
movie
->
codec_ctx
,
codec
,
NULL
))
<
0
)
{
if
((
ret
=
avcodec_open2
(
movie
->
codec_ctx
,
codec
,
NULL
))
<
0
)
{
...
@@ -174,8 +183,7 @@ static av_cold void uninit(AVFilterContext *ctx)
...
@@ -174,8 +183,7 @@ static av_cold void uninit(AVFilterContext *ctx)
{
{
MovieContext
*
movie
=
ctx
->
priv
;
MovieContext
*
movie
=
ctx
->
priv
;
if
(
movie
->
codec_ctx
)
avcodec_free_context
(
&
movie
->
codec_ctx
);
avcodec_close
(
movie
->
codec_ctx
);
if
(
movie
->
format_ctx
)
if
(
movie
->
format_ctx
)
avformat_close_input
(
&
movie
->
format_ctx
);
avformat_close_input
(
&
movie
->
format_ctx
);
av_frame_free
(
&
movie
->
frame
);
av_frame_free
(
&
movie
->
frame
);
...
...
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