Commit 265adf9a by Oliver Woodman

Move chunk trigger constants into Chunk.

parent a17ffa66
...@@ -35,6 +35,27 @@ import java.io.IOException; ...@@ -35,6 +35,27 @@ import java.io.IOException;
public abstract class Chunk implements Loadable { public abstract class Chunk implements Loadable {
/** /**
* Value of {@link #trigger} for a load whose reason is unspecified.
*/
public static final int TRIGGER_UNSPECIFIED = 0;
/**
* Value of {@link #trigger} for a load triggered by an initial format selection.
*/
public static final int TRIGGER_INITIAL = 1;
/**
* Value of {@link #trigger} for a load triggered by a user initiated format selection.
*/
public static final int TRIGGER_MANUAL = 2;
/**
* Value of {@link #trigger} for a load triggered by an adaptive format selection.
*/
public static final int TRIGGER_ADAPTIVE = 3;
/**
* Implementations may define custom {@link #trigger} codes greater than or equal to this value.
*/
public static final int TRIGGER_CUSTOM_BASE = 10000;
/**
* The format associated with the data being loaded. * The format associated with the data being loaded.
*/ */
// TODO: Consider removing this and pushing it down into MediaChunk instead. // TODO: Consider removing this and pushing it down into MediaChunk instead.
......
...@@ -26,23 +26,6 @@ import java.util.Random; ...@@ -26,23 +26,6 @@ import java.util.Random;
public interface FormatEvaluator { public interface FormatEvaluator {
/** /**
* The trigger for the initial format selection.
*/
static final int TRIGGER_INITIAL = 0;
/**
* The trigger for a format selection that was triggered by the user.
*/
static final int TRIGGER_MANUAL = 1;
/**
* The trigger for an adaptive format selection.
*/
static final int TRIGGER_ADAPTIVE = 2;
/**
* Implementations may define custom trigger codes greater than or equal to this value.
*/
static final int TRIGGER_CUSTOM_BASE = 10000;
/**
* Enables the evaluator. * Enables the evaluator.
*/ */
void enable(); void enable();
...@@ -93,7 +76,7 @@ public interface FormatEvaluator { ...@@ -93,7 +76,7 @@ public interface FormatEvaluator {
public Format format; public Format format;
public Evaluation() { public Evaluation() {
trigger = TRIGGER_INITIAL; trigger = Chunk.TRIGGER_INITIAL;
} }
} }
...@@ -147,7 +130,7 @@ public interface FormatEvaluator { ...@@ -147,7 +130,7 @@ public interface FormatEvaluator {
Format[] formats, Evaluation evaluation) { Format[] formats, Evaluation evaluation) {
Format newFormat = formats[random.nextInt(formats.length)]; Format newFormat = formats[random.nextInt(formats.length)];
if (evaluation.format != null && !evaluation.format.id.equals(newFormat.id)) { if (evaluation.format != null && !evaluation.format.id.equals(newFormat.id)) {
evaluation.trigger = TRIGGER_ADAPTIVE; evaluation.trigger = Chunk.TRIGGER_ADAPTIVE;
} }
evaluation.format = newFormat; evaluation.format = newFormat;
} }
...@@ -268,7 +251,7 @@ public interface FormatEvaluator { ...@@ -268,7 +251,7 @@ public interface FormatEvaluator {
ideal = current; ideal = current;
} }
if (current != null && ideal != current) { if (current != null && ideal != current) {
evaluation.trigger = FormatEvaluator.TRIGGER_ADAPTIVE; evaluation.trigger = Chunk.TRIGGER_ADAPTIVE;
} }
evaluation.format = ideal; evaluation.format = ideal;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment