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
60d9ee1b
Commit
60d9ee1b
authored
Oct 20, 2012
by
Clément Bœsch
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lavc/utils: make sub decode consistent with A/V.
This allows side data to be transmitted properly with subtitles.
parent
a96b39de
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
3 deletions
+20
-3
utils.c
libavcodec/utils.c
+20
-3
No files found.
libavcodec/utils.c
View file @
60d9ee1b
...
@@ -1852,22 +1852,39 @@ int avcodec_decode_subtitle2(AVCodecContext *avctx, AVSubtitle *sub,
...
@@ -1852,22 +1852,39 @@ int avcodec_decode_subtitle2(AVCodecContext *avctx, AVSubtitle *sub,
int
*
got_sub_ptr
,
int
*
got_sub_ptr
,
AVPacket
*
avpkt
)
AVPacket
*
avpkt
)
{
{
int
ret
;
int
ret
=
0
;
if
(
avctx
->
codec
->
type
!=
AVMEDIA_TYPE_SUBTITLE
)
{
if
(
avctx
->
codec
->
type
!=
AVMEDIA_TYPE_SUBTITLE
)
{
av_log
(
avctx
,
AV_LOG_ERROR
,
"Invalid media type for subtitles
\n
"
);
av_log
(
avctx
,
AV_LOG_ERROR
,
"Invalid media type for subtitles
\n
"
);
return
AVERROR
(
EINVAL
);
return
AVERROR
(
EINVAL
);
}
}
avctx
->
pkt
=
avpkt
;
*
got_sub_ptr
=
0
;
*
got_sub_ptr
=
0
;
avcodec_get_subtitle_defaults
(
sub
);
avcodec_get_subtitle_defaults
(
sub
);
if
(
avpkt
->
size
)
{
AVPacket
tmp
=
*
avpkt
;
int
did_split
=
av_packet_split_side_data
(
&
tmp
);
//apply_param_change(avctx, &tmp);
avctx
->
pkt
=
&
tmp
;
if
(
avctx
->
pkt_timebase
.
den
&&
avpkt
->
pts
!=
AV_NOPTS_VALUE
)
if
(
avctx
->
pkt_timebase
.
den
&&
avpkt
->
pts
!=
AV_NOPTS_VALUE
)
sub
->
pts
=
av_rescale_q
(
avpkt
->
pts
,
sub
->
pts
=
av_rescale_q
(
avpkt
->
pts
,
avctx
->
pkt_timebase
,
AV_TIME_BASE_Q
);
avctx
->
pkt_timebase
,
AV_TIME_BASE_Q
);
ret
=
avctx
->
codec
->
decode
(
avctx
,
sub
,
got_sub_ptr
,
avpkt
);
ret
=
avctx
->
codec
->
decode
(
avctx
,
sub
,
got_sub_ptr
,
&
tmp
);
avctx
->
pkt
=
NULL
;
if
(
did_split
)
{
ff_packet_free_side_data
(
&
tmp
);
if
(
ret
==
tmp
.
size
)
ret
=
avpkt
->
size
;
}
if
(
*
got_sub_ptr
)
if
(
*
got_sub_ptr
)
avctx
->
frame_number
++
;
avctx
->
frame_number
++
;
}
return
ret
;
return
ret
;
}
}
...
...
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