Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc
Commits
0e623d01
Commit
0e623d01
authored
Aug 13, 2014
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
subtitle demux: avoid upconversion to double precision
parent
dce22e69
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
19 deletions
+20
-19
modules/demux/Makefile.am
modules/demux/Makefile.am
+1
-0
modules/demux/subtitle.c
modules/demux/subtitle.c
+19
-19
No files found.
modules/demux/Makefile.am
View file @
0e623d01
...
@@ -57,6 +57,7 @@ libmjpeg_plugin_la_SOURCES = demux/mjpeg.c demux/mxpeg_helper.h
...
@@ -57,6 +57,7 @@ libmjpeg_plugin_la_SOURCES = demux/mjpeg.c demux/mxpeg_helper.h
demux_LTLIBRARIES
+=
libmjpeg_plugin.la
demux_LTLIBRARIES
+=
libmjpeg_plugin.la
libsubtitle_plugin_la_SOURCES
=
demux/subtitle.c
libsubtitle_plugin_la_SOURCES
=
demux/subtitle.c
libsubtitle_plugin_la_LIBADD
=
$(LIBM)
demux_LTLIBRARIES
+=
libsubtitle_plugin.la
demux_LTLIBRARIES
+=
libsubtitle_plugin.la
libty_plugin_la_SOURCES
=
demux/ty.c codec/cc.h
libty_plugin_la_SOURCES
=
demux/ty.c codec/cc.h
...
...
modules/demux/subtitle.c
View file @
0e623d01
...
@@ -37,6 +37,7 @@
...
@@ -37,6 +37,7 @@
#include <vlc_memory.h>
#include <vlc_memory.h>
#include <ctype.h>
#include <ctype.h>
#include <math.h>
#include <vlc_demux.h>
#include <vlc_demux.h>
#include <vlc_charset.h>
#include <vlc_charset.h>
...
@@ -261,17 +262,17 @@ static int Open ( vlc_object_t *p_this )
...
@@ -261,17 +262,17 @@ static int Open ( vlc_object_t *p_this )
/* Get the FPS */
/* Get the FPS */
f_fps
=
var_CreateGetFloat
(
p_demux
,
"sub-original-fps"
);
/* FIXME */
f_fps
=
var_CreateGetFloat
(
p_demux
,
"sub-original-fps"
);
/* FIXME */
if
(
f_fps
>=
1
.
0
)
if
(
f_fps
>=
1
.
f
)
p_sys
->
i_microsecperframe
=
(
int64_t
)(
(
float
)
1000000
/
f_fps
);
p_sys
->
i_microsecperframe
=
llroundf
(
1000000
.
f
/
f_fps
);
msg_Dbg
(
p_demux
,
"Movie fps: %f"
,
f_fps
);
msg_Dbg
(
p_demux
,
"Movie fps: %f"
,
(
double
)
f_fps
);
/* Check for override of the fps */
/* Check for override of the fps */
f_fps
=
var_CreateGetFloat
(
p_demux
,
"sub-fps"
);
f_fps
=
var_CreateGetFloat
(
p_demux
,
"sub-fps"
);
if
(
f_fps
>=
1
.
0
)
if
(
f_fps
>=
1
.
f
)
{
{
p_sys
->
i_microsecperframe
=
(
int64_t
)(
(
float
)
1000000
/
f_fps
);
p_sys
->
i_microsecperframe
=
llroundf
(
1000000
.
f
/
f_fps
);
msg_Dbg
(
p_demux
,
"Override subtitle fps %f"
,
f_fps
);
msg_Dbg
(
p_demux
,
"Override subtitle fps %f"
,
(
double
)
f_fps
);
}
}
/* Get or probe the type */
/* Get or probe the type */
...
@@ -872,15 +873,14 @@ static int ParseMicroDvd( demux_t *p_demux, subtitle_t *p_subtitle,
...
@@ -872,15 +873,14 @@ static int ParseMicroDvd( demux_t *p_demux, subtitle_t *p_subtitle,
if
(
sscanf
(
s
,
"{%d}{}%[^
\r\n
]"
,
&
i_start
,
psz_text
)
==
2
||
if
(
sscanf
(
s
,
"{%d}{}%[^
\r\n
]"
,
&
i_start
,
psz_text
)
==
2
||
sscanf
(
s
,
"{%d}{%d}%[^
\r\n
]"
,
&
i_start
,
&
i_stop
,
psz_text
)
==
3
)
sscanf
(
s
,
"{%d}{%d}%[^
\r\n
]"
,
&
i_start
,
&
i_stop
,
psz_text
)
==
3
)
{
{
float
f_fps
;
if
(
i_start
!=
1
||
i_stop
!=
1
)
if
(
i_start
!=
1
||
i_stop
!=
1
)
break
;
break
;
/* We found a possible setting of the framerate "{1}{1}23.976" */
/* We found a possible setting of the framerate "{1}{1}23.976" */
/* Check if it's usable, and if the sub-fps is not set */
/* Check if it's usable, and if the sub-fps is not set */
f
_fps
=
us_strtod
(
psz_text
,
NULL
);
f
loat
f_fps
=
us_strtof
(
psz_text
,
NULL
);
if
(
f_fps
>
0
.
0
&&
var_GetFloat
(
p_demux
,
"sub-fps"
)
<=
0
.
0
)
if
(
f_fps
>
0
.
f
&&
var_GetFloat
(
p_demux
,
"sub-fps"
)
<=
0
.
f
)
p_sys
->
i_microsecperframe
=
(
int64_t
)((
float
)
1000000
/
f_fps
);
p_sys
->
i_microsecperframe
=
llroundf
(
1000000
.
f
/
f_fps
);
}
}
free
(
psz_text
);
free
(
psz_text
);
}
}
...
@@ -1573,7 +1573,6 @@ static int ParseMPSub( demux_t *p_demux, subtitle_t *p_subtitle, int i_idx )
...
@@ -1573,7 +1573,6 @@ static int ParseMPSub( demux_t *p_demux, subtitle_t *p_subtitle, int i_idx )
for
(
;;
)
for
(
;;
)
{
{
float
f1
,
f2
;
char
p_dummy
;
char
p_dummy
;
char
*
psz_temp
;
char
*
psz_temp
;
...
@@ -1601,26 +1600,27 @@ static int ParseMPSub( demux_t *p_demux, subtitle_t *p_subtitle, int i_idx )
...
@@ -1601,26 +1600,27 @@ static int ParseMPSub( demux_t *p_demux, subtitle_t *p_subtitle, int i_idx )
if
(
sscanf
(
s
,
"FORMAT=%[^
\r\n
]"
,
psz_temp
)
)
if
(
sscanf
(
s
,
"FORMAT=%[^
\r\n
]"
,
psz_temp
)
)
{
{
float
f_fps
;
float
f_fps
=
us_strtof
(
psz_temp
,
NULL
)
;
f_fps
=
us_strtod
(
psz_temp
,
NULL
);
if
(
f_fps
>
0
.
0
&&
var_GetFloat
(
p_demux
,
"sub-fps"
)
<=
0
.
0
)
if
(
f_fps
>
0
.
f
&&
var_GetFloat
(
p_demux
,
"sub-fps"
)
<=
0
.
f
)
var_SetFloat
(
p_demux
,
"sub-fps"
,
f_fps
);
var_SetFloat
(
p_demux
,
"sub-fps"
,
f_fps
);
p_sys
->
mpsub
.
f_factor
=
1
.
0
;
p_sys
->
mpsub
.
f_factor
=
1
.
f
;
free
(
psz_temp
);
free
(
psz_temp
);
break
;
break
;
}
}
free
(
psz_temp
);
free
(
psz_temp
);
}
}
/* Data Lines */
/* Data Lines */
f
1
=
us_strtod
(
s
,
&
psz_temp
);
f
loat
f1
=
us_strtof
(
s
,
&
psz_temp
);
if
(
*
psz_temp
)
if
(
*
psz_temp
)
{
{
f
2
=
us_strtod
(
psz_temp
,
NULL
);
f
loat
f2
=
us_strtof
(
psz_temp
,
NULL
);
p_sys
->
mpsub
.
f_total
+=
f1
*
p_sys
->
mpsub
.
f_factor
;
p_sys
->
mpsub
.
f_total
+=
f1
*
p_sys
->
mpsub
.
f_factor
;
p_subtitle
->
i_start
=
(
int64_t
)(
10000
.
0
*
p_sys
->
mpsub
.
f_total
);
p_subtitle
->
i_start
=
llroundf
(
10000
.
f
*
p_sys
->
mpsub
.
f_total
);
p_sys
->
mpsub
.
f_total
+=
f2
*
p_sys
->
mpsub
.
f_factor
;
p_sys
->
mpsub
.
f_total
+=
f2
*
p_sys
->
mpsub
.
f_factor
;
p_subtitle
->
i_stop
=
(
int64_t
)(
10000
.
0
*
p_sys
->
mpsub
.
f_total
);
p_subtitle
->
i_stop
=
llroundf
(
10000
.
f
*
p_sys
->
mpsub
.
f_total
);
break
;
break
;
}
}
}
}
...
...
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