author | yan yan <yan.yan@amlogic.com> | 2017-12-28 14:44:07 (GMT) |
---|---|---|
committer | yan yan <yan.yan@amlogic.com> | 2017-12-28 14:44:07 (GMT) |
commit | 322b5b73397b80ef03b6852e5a654c02a65a60f5 (patch) | |
tree | 1ee5b27ab01ddc9250e96db5c2770609b704b254 | |
parent | b0f6ad57ae9678f498e7cf201657b012e6d07a17 (diff) | |
download | TvInput-322b5b73397b80ef03b6852e5a654c02a65a60f5.zip TvInput-322b5b73397b80ef03b6852e5a654c02a65a60f5.tar.gz TvInput-322b5b73397b80ef03b6852e5a654c02a65a60f5.tar.bz2 |
DTVCC: Sync status using static variables.
PD# NONE
Change-Id: If998934457e337f29c0cb6dc442305aa7a764570
-rw-r--r-- | DroidLogicTvInput/src/com/droidlogic/tvinput/widget/DTVSubtitleView.java | 31 |
1 files changed, 17 insertions, 14 deletions
diff --git a/DroidLogicTvInput/src/com/droidlogic/tvinput/widget/DTVSubtitleView.java b/DroidLogicTvInput/src/com/droidlogic/tvinput/widget/DTVSubtitleView.java index 0c5f640..e22b1ff 100644 --- a/DroidLogicTvInput/src/com/droidlogic/tvinput/widget/DTVSubtitleView.java +++ b/DroidLogicTvInput/src/com/droidlogic/tvinput/widget/DTVSubtitleView.java @@ -108,12 +108,12 @@ public class DTVSubtitleView extends View { public static final int CC_COLOR_MAGENTA = 7; public static final int CC_COLOR_CYAN = 8; - private int init_count = 0; - private CaptioningManager captioningManager = null; - private CcImplement.CaptionWindow cw = null; - private CustomFonts cf = null; - private CcImplement ci = null; - private String json_str; + private static int init_count = 0; + private static CaptioningManager captioningManager = null; + private static CcImplement.CaptionWindow cw = null; + private static CustomFonts cf = null; + private static CcImplement ci = null; + private static String json_str; private boolean isPreWindowMode = false; @@ -268,8 +268,8 @@ public class DTVSubtitleView extends View { private static SubParams sub_params; private static TTParams tt_params; private static int play_mode; - private static boolean visible; - private static boolean destroy; + private boolean visible; + private boolean destroy; private static DTVSubtitleView activeView = null; private void update() { //Log.e(TAG, "update"); @@ -380,7 +380,7 @@ public class DTVSubtitleView extends View { Log.e(TAG, "subtitle view init"); } - init_count++; + init_count = 1; } } @@ -427,14 +427,18 @@ public class DTVSubtitleView extends View { * @param active 活跃/不活跃 */ public void setActive(boolean active) { - synchronized(lock) { + synchronized (lock) { + if (active && (activeView != this) && (activeView != null)) { + activeView.stopDecoder(); + activeView.active = false; + } native_sub_set_active(active); this.active = active; if (active) { activeView = this; /*}else if (activeView == this){ activeView = null;*/ - } + } if (!isPreWindowMode) postInvalidate(); } @@ -519,7 +523,7 @@ public class DTVSubtitleView extends View { } } - public static void setCaptionParams(DTVCCParams params) { + public void setCaptionParams(DTVCCParams params) { synchronized(lock) { sub_params.dtv_cc = params; native_sub_set_atsc_cc_options( @@ -854,7 +858,6 @@ public class DTVSubtitleView extends View { public void dispose() { synchronized(lock) { if (!destroy) { - init_count--; destroy = true; if (init_count == 0) { stopDecoder(); @@ -882,7 +885,7 @@ public class DTVSubtitleView extends View { return; if (!str.isEmpty()) { synchronized (json_lock) { - json_str = new String(str); + json_str = str; } } } |