Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
F
ffmpeg
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
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
ffmpeg
Commits
d51e08bb
Commit
d51e08bb
authored
May 26, 2012
by
Clément Bœsch
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lavc: switch from ts_end to duration in ff_ass_add_rect.
Make possible a end-to-presentation duration.
parent
e7cb1615
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
19 additions
and
15 deletions
+19
-15
ass.c
libavcodec/ass.c
+6
-3
ass.h
libavcodec/ass.h
+3
-2
jacosubdec.c
libavcodec/jacosubdec.c
+1
-3
microdvddec.c
libavcodec/microdvddec.c
+8
-6
srtdec.c
libavcodec/srtdec.c
+1
-1
No files found.
libavcodec/ass.c
View file @
d51e08bb
...
...
@@ -70,15 +70,18 @@ static int ts_to_string(char *str, int strlen, int ts)
}
int
ff_ass_add_rect
(
AVSubtitle
*
sub
,
const
char
*
dialog
,
int
ts_start
,
int
ts_end
,
int
raw
)
int
ts_start
,
int
duration
,
int
raw
)
{
int
len
=
0
,
dlen
,
duration
=
ts_end
-
ts_start
;
int
len
=
0
,
dlen
;
char
s_start
[
16
],
s_end
[
16
],
header
[
48
]
=
{
0
};
AVSubtitleRect
**
rects
;
if
(
!
raw
)
{
ts_to_string
(
s_start
,
sizeof
(
s_start
),
ts_start
);
ts_to_string
(
s_end
,
sizeof
(
s_end
),
ts_end
);
if
(
duration
==
-
1
)
snprintf
(
s_end
,
sizeof
(
s_end
),
"9:59:59.99"
);
else
ts_to_string
(
s_end
,
sizeof
(
s_end
),
ts_start
+
duration
);
len
=
snprintf
(
header
,
sizeof
(
header
),
"Dialogue: 0,%s,%s,"
,
s_start
,
s_end
);
}
...
...
libavcodec/ass.h
View file @
d51e08bb
...
...
@@ -74,7 +74,8 @@ int ff_ass_subtitle_header_default(AVCodecContext *avctx);
* @param sub pointer to the AVSubtitle
* @param dialog ASS dialog to add to sub
* @param ts_start start timestamp for this dialog (in 1/100 second unit)
* @param ts_end end timestamp for this dialog (in 1/100 second unit)
* @param duration duration for this dialog (in 1/100 second unit), can be -1
* to last until the end of the presentation
* @param raw when set to 1, it indicates that dialog contains a whole ASS
* dialog line which should be copied as is.
* when set to 0, it indicates that dialog contains only the Text
...
...
@@ -85,6 +86,6 @@ int ff_ass_subtitle_header_default(AVCodecContext *avctx);
* A negative value indicates an error.
*/
int
ff_ass_add_rect
(
AVSubtitle
*
sub
,
const
char
*
dialog
,
int
ts_start
,
int
ts_end
,
int
raw
);
int
ts_start
,
int
duration
,
int
raw
);
#endif
/* AVCODEC_ASS_H */
libavcodec/jacosubdec.c
View file @
d51e08bb
...
...
@@ -175,8 +175,6 @@ static int jacosub_decode_frame(AVCodecContext *avctx,
goto
end
;
if
(
*
ptr
)
{
int
ts_start
=
avpkt
->
pts
;
int
ts_end
=
avpkt
->
pts
+
avpkt
->
duration
;
AVBPrint
buffer
;
char
*
dec_sub
;
...
...
@@ -188,7 +186,7 @@ static int jacosub_decode_frame(AVCodecContext *avctx,
av_bprint_init
(
&
buffer
,
JSS_MAX_LINESIZE
,
JSS_MAX_LINESIZE
);
jacosub_to_ass
(
avctx
,
&
buffer
,
ptr
);
av_bprint_finalize
(
&
buffer
,
&
dec_sub
);
ff_ass_add_rect
(
sub
,
dec_sub
,
ts_start
,
ts_end
,
0
);
ff_ass_add_rect
(
sub
,
dec_sub
,
avpkt
->
pts
,
avpkt
->
duration
,
0
);
av_free
(
dec_sub
);
}
...
...
libavcodec/microdvddec.c
View file @
d51e08bb
...
...
@@ -261,10 +261,6 @@ static int microdvd_decode_frame(AVCodecContext *avctx,
char
*
decoded_sub
;
char
*
line
=
avpkt
->
data
;
char
*
end
=
avpkt
->
data
+
avpkt
->
size
;
int64_t
frame_start
=
avpkt
->
pts
;
int64_t
frame_end
=
avpkt
->
pts
+
avpkt
->
duration
;
int
ts_start
=
av_rescale_q
(
frame_start
,
avctx
->
time_base
,
(
AVRational
){
1
,
100
});
int
ts_end
=
av_rescale_q
(
frame_end
,
avctx
->
time_base
,
(
AVRational
){
1
,
100
});
struct
microdvd_tag
tags
[
sizeof
(
MICRODVD_TAGS
)
-
1
]
=
{{
0
}};
if
(
avpkt
->
size
<=
0
)
...
...
@@ -299,8 +295,14 @@ static int microdvd_decode_frame(AVCodecContext *avctx,
end:
av_bprint_finalize
(
&
new_line
,
&
decoded_sub
);
if
(
*
decoded_sub
)
ff_ass_add_rect
(
sub
,
decoded_sub
,
ts_start
,
ts_end
,
0
);
if
(
*
decoded_sub
)
{
int64_t
start
=
avpkt
->
pts
;
int64_t
duration
=
avpkt
->
duration
;
int
ts_start
=
av_rescale_q
(
start
,
avctx
->
time_base
,
(
AVRational
){
1
,
100
});
int
ts_duration
=
duration
!=
-
1
?
av_rescale_q
(
duration
,
avctx
->
time_base
,
(
AVRational
){
1
,
100
})
:
-
1
;
ff_ass_add_rect
(
sub
,
decoded_sub
,
ts_start
,
ts_duration
,
0
);
}
av_free
(
decoded_sub
);
*
got_sub_ptr
=
sub
->
num_rects
>
0
;
...
...
libavcodec/srtdec.c
View file @
d51e08bb
...
...
@@ -222,7 +222,7 @@ static int srt_decode_frame(AVCodecContext *avctx,
break
;
ptr
=
srt_to_ass
(
avctx
,
buffer
,
buffer
+
sizeof
(
buffer
),
ptr
,
x1
,
y1
,
x2
,
y2
);
ff_ass_add_rect
(
sub
,
buffer
,
ts_start
,
ts_end
,
0
);
ff_ass_add_rect
(
sub
,
buffer
,
ts_start
,
ts_end
-
ts_start
,
0
);
}
*
got_sub_ptr
=
sub
->
num_rects
>
0
;
...
...
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