summaryrefslogtreecommitdiff
authorTellen Yu <tellen.yu@amlogic.com>2016-11-21 08:59:44 (GMT)
committer Gerrit Code Review <gituser@git.myamlogic.com>2016-11-21 08:59:45 (GMT)
commitc9d17cb39877d673c20d6a3ca466e9f21eb63603 (patch)
tree3f4e422d042df2883e2af926a2fd09f435e3dea6
parentfef5ee18b4239e442935d69b30f77f445ffac3af (diff)
parent281e85ab90524a110ae2107b97569b4436ea9f43 (diff)
downloadSubTitle-c9d17cb39877d673c20d6a3ca466e9f21eb63603.zip
SubTitle-c9d17cb39877d673c20d6a3ca466e9f21eb63603.tar.gz
SubTitle-c9d17cb39877d673c20d6a3ca466e9f21eb63603.tar.bz2
Merge "pd#134670:change subtitle rate according to value read from decode information" into m-amlogic
Diffstat
-rw-r--r--jni/subtitle/sub_api.c26
-rw-r--r--jni/subtitle/sub_api.h6
2 files changed, 19 insertions, 13 deletions
diff --git a/jni/subtitle/sub_api.c b/jni/subtitle/sub_api.c
index c27c5db..cab588f 100644
--- a/jni/subtitle/sub_api.c
+++ b/jni/subtitle/sub_api.c
@@ -49,6 +49,7 @@ static unsigned subfile_read;
//init pts rate
int ptsrate = 24;
+bool ptsRateGot = true;
static inline int subtitle_uni_Utf16toUtf8(const UTF16 *in, int inLen,
UTF8 *out, int outMax)
@@ -733,18 +734,17 @@ subtitle_t *internal_sub_read_line_microdvd(int fd, subtitle_t *current)
char line2[LINE_LEN + 1];
char *p, *next;
int i;
- /*int ptsrate = 0;
- /*ptsrate = get_subtitle_fps() / 100;
-
- if (get_subtitle_fps() % 100)
- ptsrate ++;
-
- if (ptsrate <= 0)
- {
- ptsrate = 24; //30;
- }
-
- log_print("--------internal_sub_read_line_microdvd---get frame rate: %f--\n", ptsrate); */
+ if (!ptsRateGot) {
+ ptsrate = get_subtitle_fps() / 100;
+ if (get_subtitle_fps() % 100) {
+ ptsrate ++;
+ }
+ if (ptsrate <= 0) {
+ ptsrate = 24; //30;
+ }
+ ptsRateGot = true;
+ log_print("--------internal_sub_read_line_microdvd---get frame rate: %f--\n", ptsrate);
+ }
current->end = 0;
do
{
@@ -813,6 +813,7 @@ subtitle_t *internal_sub_read_line_mpl1(int fd, subtitle_t *current)
&& current->start == current->end == 1))
{
ptsrate = atoi(line2);
+ ptsRateGot = true;
}
current->start = (current->start * 100) / ptsrate;
current->end = (current->end * 100) / ptsrate;
@@ -2190,6 +2191,7 @@ static int internal_sub_autodetect(int fd)
}
SUBAPI void reset_variate() {
+ ptsRateGot = false;
mpsub_position = 0;
}
diff --git a/jni/subtitle/sub_api.h b/jni/subtitle/sub_api.h
index cecb2b3..986c58f 100644
--- a/jni/subtitle/sub_api.h
+++ b/jni/subtitle/sub_api.h
@@ -28,7 +28,11 @@
/* Maximal length of line of a subtitle */
#define LINE_LEN 1024*5
-
+typedef enum
+ {
+ false,
+ true
+} bool;
typedef enum
{
SUB_ALIGNMENT_BOTTOMLEFT = 1,