com.google.android.exoplayer2.metadata.emsg.EventMessage Java Examples

The following examples show how to use com.google.android.exoplayer2.metadata.emsg.EventMessage. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: PlayerEmsgHandler.java    From Telegram with GNU General Public License v2.0 6 votes vote down vote up
private void parseAndDiscardSamples() {
  while (sampleQueue.hasNextSample()) {
    MetadataInputBuffer inputBuffer = dequeueSample();
    if (inputBuffer == null) {
      continue;
    }
    long eventTimeUs = inputBuffer.timeUs;
    Metadata metadata = decoder.decode(inputBuffer);
    if (metadata == null) {
      continue;
    }
    EventMessage eventMessage = (EventMessage) metadata.get(0);
    if (isPlayerEmsgEvent(eventMessage.schemeIdUri, eventMessage.value)) {
      parsePlayerEmsgEvent(eventTimeUs, eventMessage);
    }
  }
  sampleQueue.discardToRead();
}
 
Example #2
Source File: DashManifestParser.java    From MediaSDK with Apache License 2.0 6 votes vote down vote up
/**
 * Parses a single Event node in the manifest.
 *
 * @param xpp The current xml parser.
 * @param schemeIdUri The schemeIdUri of the parent EventStream.
 * @param value The schemeIdUri of the parent EventStream.
 * @param timescale The timescale of the parent EventStream.
 * @param scratchOutputStream A {@link ByteArrayOutputStream} that is used when parsing event
 *     objects.
 * @return A pair containing the node's presentation timestamp in microseconds and the parsed
 *     {@link EventMessage}.
 * @throws XmlPullParserException If there is any error parsing this node.
 * @throws IOException If there is any error reading from the underlying input stream.
 */
protected Pair<Long, EventMessage> parseEvent(
    XmlPullParser xpp,
    String schemeIdUri,
    String value,
    long timescale,
    ByteArrayOutputStream scratchOutputStream)
    throws IOException, XmlPullParserException {
  long id = parseLong(xpp, "id", 0);
  long duration = parseLong(xpp, "duration", C.TIME_UNSET);
  long presentationTime = parseLong(xpp, "presentationTime", 0);
  long durationMs = Util.scaleLargeTimestamp(duration, C.MILLIS_PER_SECOND, timescale);
  long presentationTimesUs = Util.scaleLargeTimestamp(presentationTime, C.MICROS_PER_SECOND,
      timescale);
  String messageData = parseString(xpp, "messageData", null);
  byte[] eventObject = parseEventObject(xpp, scratchOutputStream);
  return Pair.create(
      presentationTimesUs,
      buildEvent(
          schemeIdUri,
          value,
          id,
          durationMs,
          messageData == null ? eventObject : Util.getUtf8Bytes(messageData)));
}
 
Example #3
Source File: DashManifestParser.java    From Telegram with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Parses a single Event node in the manifest.
 *
 * @param xpp The current xml parser.
 * @param schemeIdUri The schemeIdUri of the parent EventStream.
 * @param value The schemeIdUri of the parent EventStream.
 * @param timescale The timescale of the parent EventStream.
 * @param scratchOutputStream A {@link ByteArrayOutputStream} that is used when parsing event
 *     objects.
 * @return A pair containing the node's presentation timestamp in microseconds and the parsed
 *     {@link EventMessage}.
 * @throws XmlPullParserException If there is any error parsing this node.
 * @throws IOException If there is any error reading from the underlying input stream.
 */
protected Pair<Long, EventMessage> parseEvent(
    XmlPullParser xpp,
    String schemeIdUri,
    String value,
    long timescale,
    ByteArrayOutputStream scratchOutputStream)
    throws IOException, XmlPullParserException {
  long id = parseLong(xpp, "id", 0);
  long duration = parseLong(xpp, "duration", C.TIME_UNSET);
  long presentationTime = parseLong(xpp, "presentationTime", 0);
  long durationMs = Util.scaleLargeTimestamp(duration, C.MILLIS_PER_SECOND, timescale);
  long presentationTimesUs = Util.scaleLargeTimestamp(presentationTime, C.MICROS_PER_SECOND,
      timescale);
  String messageData = parseString(xpp, "messageData", null);
  byte[] eventObject = parseEventObject(xpp, scratchOutputStream);
  return Pair.create(
      presentationTimesUs,
      buildEvent(
          schemeIdUri,
          value,
          id,
          durationMs,
          messageData == null ? eventObject : Util.getUtf8Bytes(messageData)));
}
 
Example #4
Source File: DashManifestParser.java    From TelePlus-Android with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Parses a single Event node in the manifest.
 *
 * @param xpp The current xml parser.
 * @param schemeIdUri The schemeIdUri of the parent EventStream.
 * @param value The schemeIdUri of the parent EventStream.
 * @param timescale The timescale of the parent EventStream.
 * @param scratchOutputStream A {@link ByteArrayOutputStream} that is used when parsing event
 *     objects.
 * @return The {@link EventMessage} parsed from this EventStream node.
 * @throws XmlPullParserException If there is any error parsing this node.
 * @throws IOException If there is any error reading from the underlying input stream.
 */
protected EventMessage parseEvent(
    XmlPullParser xpp,
    String schemeIdUri,
    String value,
    long timescale,
    ByteArrayOutputStream scratchOutputStream)
    throws IOException, XmlPullParserException {
  long id = parseLong(xpp, "id", 0);
  long duration = parseLong(xpp, "duration", C.TIME_UNSET);
  long presentationTime = parseLong(xpp, "presentationTime", 0);
  long durationMs = Util.scaleLargeTimestamp(duration, 1000, timescale);
  long presentationTimesUs = Util.scaleLargeTimestamp(presentationTime, C.MICROS_PER_SECOND,
      timescale);
  byte[] eventObject = parseEventObject(xpp, scratchOutputStream);
  return buildEvent(schemeIdUri, value, id, durationMs, eventObject, presentationTimesUs);
}
 
Example #5
Source File: PlayerEmsgHandler.java    From Telegram-FOSS with GNU General Public License v2.0 6 votes vote down vote up
private void parseAndDiscardSamples() {
  while (sampleQueue.hasNextSample()) {
    MetadataInputBuffer inputBuffer = dequeueSample();
    if (inputBuffer == null) {
      continue;
    }
    long eventTimeUs = inputBuffer.timeUs;
    Metadata metadata = decoder.decode(inputBuffer);
    if (metadata == null) {
      continue;
    }
    EventMessage eventMessage = (EventMessage) metadata.get(0);
    if (isPlayerEmsgEvent(eventMessage.schemeIdUri, eventMessage.value)) {
      parsePlayerEmsgEvent(eventTimeUs, eventMessage);
    }
  }
  sampleQueue.discardToRead();
}
 
Example #6
Source File: DashManifestParser.java    From TelePlus-Android with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Parses a single Event node in the manifest.
 *
 * @param xpp The current xml parser.
 * @param schemeIdUri The schemeIdUri of the parent EventStream.
 * @param value The schemeIdUri of the parent EventStream.
 * @param timescale The timescale of the parent EventStream.
 * @param scratchOutputStream A {@link ByteArrayOutputStream} that is used when parsing event
 *     objects.
 * @return The {@link EventMessage} parsed from this EventStream node.
 * @throws XmlPullParserException If there is any error parsing this node.
 * @throws IOException If there is any error reading from the underlying input stream.
 */
protected EventMessage parseEvent(
    XmlPullParser xpp,
    String schemeIdUri,
    String value,
    long timescale,
    ByteArrayOutputStream scratchOutputStream)
    throws IOException, XmlPullParserException {
  long id = parseLong(xpp, "id", 0);
  long duration = parseLong(xpp, "duration", C.TIME_UNSET);
  long presentationTime = parseLong(xpp, "presentationTime", 0);
  long durationMs = Util.scaleLargeTimestamp(duration, 1000, timescale);
  long presentationTimesUs = Util.scaleLargeTimestamp(presentationTime, C.MICROS_PER_SECOND,
      timescale);
  byte[] eventObject = parseEventObject(xpp, scratchOutputStream);
  return buildEvent(schemeIdUri, value, id, durationMs, eventObject, presentationTimesUs);
}
 
Example #7
Source File: DashManifestParser.java    From Telegram-FOSS with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Parses a single Event node in the manifest.
 *
 * @param xpp The current xml parser.
 * @param schemeIdUri The schemeIdUri of the parent EventStream.
 * @param value The schemeIdUri of the parent EventStream.
 * @param timescale The timescale of the parent EventStream.
 * @param scratchOutputStream A {@link ByteArrayOutputStream} that is used when parsing event
 *     objects.
 * @return A pair containing the node's presentation timestamp in microseconds and the parsed
 *     {@link EventMessage}.
 * @throws XmlPullParserException If there is any error parsing this node.
 * @throws IOException If there is any error reading from the underlying input stream.
 */
protected Pair<Long, EventMessage> parseEvent(
    XmlPullParser xpp,
    String schemeIdUri,
    String value,
    long timescale,
    ByteArrayOutputStream scratchOutputStream)
    throws IOException, XmlPullParserException {
  long id = parseLong(xpp, "id", 0);
  long duration = parseLong(xpp, "duration", C.TIME_UNSET);
  long presentationTime = parseLong(xpp, "presentationTime", 0);
  long durationMs = Util.scaleLargeTimestamp(duration, C.MILLIS_PER_SECOND, timescale);
  long presentationTimesUs = Util.scaleLargeTimestamp(presentationTime, C.MICROS_PER_SECOND,
      timescale);
  String messageData = parseString(xpp, "messageData", null);
  byte[] eventObject = parseEventObject(xpp, scratchOutputStream);
  return Pair.create(
      presentationTimesUs,
      buildEvent(
          schemeIdUri,
          value,
          id,
          durationMs,
          messageData == null ? eventObject : Util.getUtf8Bytes(messageData)));
}
 
Example #8
Source File: PlayerEmsgHandler.java    From TelePlus-Android with GNU General Public License v2.0 5 votes vote down vote up
private void parseAndDiscardSamples() {
  while (sampleQueue.hasNextSample()) {
    MetadataInputBuffer inputBuffer = dequeueSample();
    if (inputBuffer == null) {
      continue;
    }
    long eventTimeUs = inputBuffer.timeUs;
    Metadata metadata = decoder.decode(inputBuffer);
    EventMessage eventMessage = (EventMessage) metadata.get(0);
    if (isPlayerEmsgEvent(eventMessage.schemeIdUri, eventMessage.value)) {
      parsePlayerEmsgEvent(eventTimeUs, eventMessage);
    }
  }
  sampleQueue.discardToRead();
}
 
Example #9
Source File: PlayerEmsgHandler.java    From TelePlus-Android with GNU General Public License v2.0 5 votes vote down vote up
private void parsePlayerEmsgEvent(long eventTimeUs, EventMessage eventMessage) {
  long manifestPublishTimeMsInEmsg = getManifestPublishTimeMsInEmsg(eventMessage);
  if (manifestPublishTimeMsInEmsg == C.TIME_UNSET) {
    return;
  }

  if (isMessageSignalingMediaPresentationEnded(eventMessage)) {
    onMediaPresentationEndedMessageEncountered();
  } else {
    onManifestExpiredMessageEncountered(eventTimeUs, manifestPublishTimeMsInEmsg);
  }
}
 
Example #10
Source File: EventLogger.java    From TubiPlayer with MIT License 5 votes vote down vote up
private void printMetadata(Metadata metadata, String prefix) {
    for (int i = 0; i < metadata.length(); i++) {
        Metadata.Entry entry = metadata.get(i);
        if (entry instanceof TextInformationFrame) {
            TextInformationFrame textInformationFrame = (TextInformationFrame) entry;
            Log.d(TAG, prefix + String.format("%s: value=%s", textInformationFrame.id,
                    textInformationFrame.value));
        } else if (entry instanceof UrlLinkFrame) {
            UrlLinkFrame urlLinkFrame = (UrlLinkFrame) entry;
            Log.d(TAG, prefix + String.format("%s: url=%s", urlLinkFrame.id, urlLinkFrame.url));
        } else if (entry instanceof PrivFrame) {
            PrivFrame privFrame = (PrivFrame) entry;
            Log.d(TAG, prefix + String.format("%s: owner=%s", privFrame.id, privFrame.owner));
        } else if (entry instanceof GeobFrame) {
            GeobFrame geobFrame = (GeobFrame) entry;
            Log.d(TAG, prefix + String.format("%s: mimeType=%s, filename=%s, description=%s",
                    geobFrame.id, geobFrame.mimeType, geobFrame.filename, geobFrame.description));
        } else if (entry instanceof ApicFrame) {
            ApicFrame apicFrame = (ApicFrame) entry;
            Log.d(TAG, prefix + String.format("%s: mimeType=%s, description=%s",
                    apicFrame.id, apicFrame.mimeType, apicFrame.description));
        } else if (entry instanceof CommentFrame) {
            CommentFrame commentFrame = (CommentFrame) entry;
            Log.d(TAG, prefix + String.format("%s: language=%s, description=%s", commentFrame.id,
                    commentFrame.language, commentFrame.description));
        } else if (entry instanceof Id3Frame) {
            Id3Frame id3Frame = (Id3Frame) entry;
            Log.d(TAG, prefix + String.format("%s", id3Frame.id));
        } else if (entry instanceof EventMessage) {
            EventMessage eventMessage = (EventMessage) entry;
            Log.d(TAG, prefix + String.format("EMSG: scheme=%s, id=%d, value=%s",
                    eventMessage.schemeIdUri, eventMessage.id, eventMessage.value));
        }
    }
}
 
Example #11
Source File: EventLogger.java    From ExoPlayer-Offline with Apache License 2.0 5 votes vote down vote up
private void printMetadata(Metadata metadata, String prefix) {
  for (int i = 0; i < metadata.length(); i++) {
    Metadata.Entry entry = metadata.get(i);
    if (entry instanceof TextInformationFrame) {
      TextInformationFrame textInformationFrame = (TextInformationFrame) entry;
      Log.d(TAG, prefix + String.format("%s: value=%s", textInformationFrame.id,
          textInformationFrame.value));
    } else if (entry instanceof UrlLinkFrame) {
      UrlLinkFrame urlLinkFrame = (UrlLinkFrame) entry;
      Log.d(TAG, prefix + String.format("%s: url=%s", urlLinkFrame.id, urlLinkFrame.url));
    } else if (entry instanceof PrivFrame) {
      PrivFrame privFrame = (PrivFrame) entry;
      Log.d(TAG, prefix + String.format("%s: owner=%s", privFrame.id, privFrame.owner));
    } else if (entry instanceof GeobFrame) {
      GeobFrame geobFrame = (GeobFrame) entry;
      Log.d(TAG, prefix + String.format("%s: mimeType=%s, filename=%s, description=%s",
          geobFrame.id, geobFrame.mimeType, geobFrame.filename, geobFrame.description));
    } else if (entry instanceof ApicFrame) {
      ApicFrame apicFrame = (ApicFrame) entry;
      Log.d(TAG, prefix + String.format("%s: mimeType=%s, description=%s",
          apicFrame.id, apicFrame.mimeType, apicFrame.description));
    } else if (entry instanceof CommentFrame) {
      CommentFrame commentFrame = (CommentFrame) entry;
      Log.d(TAG, prefix + String.format("%s: language=%s, description=%s", commentFrame.id,
          commentFrame.language, commentFrame.description));
    } else if (entry instanceof Id3Frame) {
      Id3Frame id3Frame = (Id3Frame) entry;
      Log.d(TAG, prefix + String.format("%s", id3Frame.id));
    } else if (entry instanceof EventMessage) {
      EventMessage eventMessage = (EventMessage) entry;
      Log.d(TAG, prefix + String.format("EMSG: scheme=%s, id=%d, value=%s",
          eventMessage.schemeIdUri, eventMessage.id, eventMessage.value));
    }
  }
}
 
Example #12
Source File: EventLogger.java    From LiveVideoBroadcaster with Apache License 2.0 5 votes vote down vote up
private void printMetadata(Metadata metadata, String prefix) {
  for (int i = 0; i < metadata.length(); i++) {
    Metadata.Entry entry = metadata.get(i);
    if (entry instanceof TextInformationFrame) {
      TextInformationFrame textInformationFrame = (TextInformationFrame) entry;
      Log.d(TAG, prefix + String.format("%s: value=%s", textInformationFrame.id,
          textInformationFrame.value));
    } else if (entry instanceof UrlLinkFrame) {
      UrlLinkFrame urlLinkFrame = (UrlLinkFrame) entry;
      Log.d(TAG, prefix + String.format("%s: url=%s", urlLinkFrame.id, urlLinkFrame.url));
    } else if (entry instanceof PrivFrame) {
      PrivFrame privFrame = (PrivFrame) entry;
      Log.d(TAG, prefix + String.format("%s: owner=%s", privFrame.id, privFrame.owner));
    } else if (entry instanceof GeobFrame) {
      GeobFrame geobFrame = (GeobFrame) entry;
      Log.d(TAG, prefix + String.format("%s: mimeType=%s, filename=%s, description=%s",
          geobFrame.id, geobFrame.mimeType, geobFrame.filename, geobFrame.description));
    } else if (entry instanceof ApicFrame) {
      ApicFrame apicFrame = (ApicFrame) entry;
      Log.d(TAG, prefix + String.format("%s: mimeType=%s, description=%s",
          apicFrame.id, apicFrame.mimeType, apicFrame.description));
    } else if (entry instanceof CommentFrame) {
      CommentFrame commentFrame = (CommentFrame) entry;
      Log.d(TAG, prefix + String.format("%s: language=%s, description=%s", commentFrame.id,
          commentFrame.language, commentFrame.description));
    } else if (entry instanceof Id3Frame) {
      Id3Frame id3Frame = (Id3Frame) entry;
      Log.d(TAG, prefix + String.format("%s", id3Frame.id));
    } else if (entry instanceof EventMessage) {
      EventMessage eventMessage = (EventMessage) entry;
      Log.d(TAG, prefix + String.format("EMSG: scheme=%s, id=%d, value=%s",
          eventMessage.schemeIdUri, eventMessage.id, eventMessage.value));
    }
  }
}
 
Example #13
Source File: EventLogger.java    From mimi-reader with Apache License 2.0 5 votes vote down vote up
private void printMetadata(Metadata metadata, String prefix) {
    for (int i = 0; i < metadata.length(); i++) {
        Metadata.Entry entry = metadata.get(i);
        if (entry instanceof TextInformationFrame) {
            TextInformationFrame textInformationFrame = (TextInformationFrame) entry;
            Log.d(TAG, prefix + String.format("%s: value=%s", textInformationFrame.id,
                    textInformationFrame.value));
        } else if (entry instanceof UrlLinkFrame) {
            UrlLinkFrame urlLinkFrame = (UrlLinkFrame) entry;
            Log.d(TAG, prefix + String.format("%s: url=%s", urlLinkFrame.id, urlLinkFrame.url));
        } else if (entry instanceof PrivFrame) {
            PrivFrame privFrame = (PrivFrame) entry;
            Log.d(TAG, prefix + String.format("%s: owner=%s", privFrame.id, privFrame.owner));
        } else if (entry instanceof GeobFrame) {
            GeobFrame geobFrame = (GeobFrame) entry;
            Log.d(TAG, prefix + String.format("%s: mimeType=%s, filename=%s, description=%s",
                    geobFrame.id, geobFrame.mimeType, geobFrame.filename, geobFrame.description));
        } else if (entry instanceof ApicFrame) {
            ApicFrame apicFrame = (ApicFrame) entry;
            Log.d(TAG, prefix + String.format("%s: mimeType=%s, description=%s",
                    apicFrame.id, apicFrame.mimeType, apicFrame.description));
        } else if (entry instanceof CommentFrame) {
            CommentFrame commentFrame = (CommentFrame) entry;
            Log.d(TAG, prefix + String.format("%s: language=%s, description=%s", commentFrame.id,
                    commentFrame.language, commentFrame.description));
        } else if (entry instanceof Id3Frame) {
            Id3Frame id3Frame = (Id3Frame) entry;
            Log.d(TAG, prefix + String.format("%s", id3Frame.id));
        } else if (entry instanceof EventMessage) {
            EventMessage eventMessage = (EventMessage) entry;
            Log.d(TAG, prefix + String.format("EMSG: scheme=%s, id=%d, value=%s",
                    eventMessage.schemeIdUri, eventMessage.id, eventMessage.value));
        }
    }
}
 
Example #14
Source File: EventLogger.java    From GSYVideoPlayer with Apache License 2.0 5 votes vote down vote up
private void printMetadata(Metadata metadata, String prefix) {
    for (int i = 0; i < metadata.length(); i++) {
        Metadata.Entry entry = metadata.get(i);
        if (entry instanceof TextInformationFrame) {
            TextInformationFrame textInformationFrame = (TextInformationFrame) entry;
            Log.d(TAG, prefix + String.format("%s: value=%s", textInformationFrame.id,
                    textInformationFrame.value));
        } else if (entry instanceof UrlLinkFrame) {
            UrlLinkFrame urlLinkFrame = (UrlLinkFrame) entry;
            Log.d(TAG, prefix + String.format("%s: url=%s", urlLinkFrame.id, urlLinkFrame.url));
        } else if (entry instanceof PrivFrame) {
            PrivFrame privFrame = (PrivFrame) entry;
            Log.d(TAG, prefix + String.format("%s: owner=%s", privFrame.id, privFrame.owner));
        } else if (entry instanceof GeobFrame) {
            GeobFrame geobFrame = (GeobFrame) entry;
            Log.d(TAG, prefix + String.format("%s: mimeType=%s, filename=%s, description=%s",
                    geobFrame.id, geobFrame.mimeType, geobFrame.filename, geobFrame.description));
        } else if (entry instanceof ApicFrame) {
            ApicFrame apicFrame = (ApicFrame) entry;
            Log.d(TAG, prefix + String.format("%s: mimeType=%s, description=%s",
                    apicFrame.id, apicFrame.mimeType, apicFrame.description));
        } else if (entry instanceof CommentFrame) {
            CommentFrame commentFrame = (CommentFrame) entry;
            Log.d(TAG, prefix + String.format("%s: language=%s, description=%s", commentFrame.id,
                    commentFrame.language, commentFrame.description));
        } else if (entry instanceof Id3Frame) {
            Id3Frame id3Frame = (Id3Frame) entry;
            Log.d(TAG, prefix + String.format("%s", id3Frame.id));
        } else if (entry instanceof EventMessage) {
            EventMessage eventMessage = (EventMessage) entry;
            Log.d(TAG, prefix + String.format("EMSG: scheme=%s, id=%d, value=%s",
                    eventMessage.schemeIdUri, eventMessage.id, eventMessage.value));
        }
    }
}
 
Example #15
Source File: EventLogger.java    From TigerVideo with Apache License 2.0 5 votes vote down vote up
private void printMetadata(Metadata metadata, String prefix) {
    for (int i = 0; i < metadata.length(); i++) {
        Metadata.Entry entry = metadata.get(i);
        if (entry instanceof TextInformationFrame) {
            TextInformationFrame textInformationFrame = (TextInformationFrame) entry;
            Log.d(TAG, prefix + String.format("%s: value=%s", textInformationFrame.id,
                    textInformationFrame.value));
        } else if (entry instanceof UrlLinkFrame) {
            UrlLinkFrame urlLinkFrame = (UrlLinkFrame) entry;
            Log.d(TAG, prefix + String.format("%s: url=%s", urlLinkFrame.id, urlLinkFrame.url));
        } else if (entry instanceof PrivFrame) {
            PrivFrame privFrame = (PrivFrame) entry;
            Log.d(TAG, prefix + String.format("%s: owner=%s", privFrame.id, privFrame.owner));
        } else if (entry instanceof GeobFrame) {
            GeobFrame geobFrame = (GeobFrame) entry;
            Log.d(TAG, prefix + String.format("%s: mimeType=%s, filename=%s, description=%s",
                    geobFrame.id, geobFrame.mimeType, geobFrame.filename, geobFrame.description));
        } else if (entry instanceof ApicFrame) {
            ApicFrame apicFrame = (ApicFrame) entry;
            Log.d(TAG, prefix + String.format("%s: mimeType=%s, description=%s",
                    apicFrame.id, apicFrame.mimeType, apicFrame.description));
        } else if (entry instanceof CommentFrame) {
            CommentFrame commentFrame = (CommentFrame) entry;
            Log.d(TAG, prefix + String.format("%s: language=%s, description=%s", commentFrame.id,
                    commentFrame.language, commentFrame.description));
        } else if (entry instanceof Id3Frame) {
            Id3Frame id3Frame = (Id3Frame) entry;
            Log.d(TAG, prefix + String.format("%s", id3Frame.id));
        } else if (entry instanceof EventMessage) {
            EventMessage eventMessage = (EventMessage) entry;
            Log.d(TAG, prefix + String.format("EMSG: scheme=%s, id=%d, value=%s",
                    eventMessage.schemeIdUri, eventMessage.id, eventMessage.value));
        }
    }
}
 
Example #16
Source File: EventLogger.java    From K-Sonic with MIT License 5 votes vote down vote up
private void printMetadata(Metadata metadata, String prefix) {
  for (int i = 0; i < metadata.length(); i++) {
    Metadata.Entry entry = metadata.get(i);
    if (entry instanceof TextInformationFrame) {
      TextInformationFrame textInformationFrame = (TextInformationFrame) entry;
      Log.d(TAG, prefix + String.format("%s: value=%s", textInformationFrame.id,
              textInformationFrame.value));
    } else if (entry instanceof UrlLinkFrame) {
      UrlLinkFrame urlLinkFrame = (UrlLinkFrame) entry;
      Log.d(TAG, prefix + String.format("%s: url=%s", urlLinkFrame.id, urlLinkFrame.url));
    } else if (entry instanceof PrivFrame) {
      PrivFrame privFrame = (PrivFrame) entry;
      Log.d(TAG, prefix + String.format("%s: owner=%s", privFrame.id, privFrame.owner));
    } else if (entry instanceof GeobFrame) {
      GeobFrame geobFrame = (GeobFrame) entry;
      Log.d(TAG, prefix + String.format("%s: mimeType=%s, filename=%s, description=%s",
              geobFrame.id, geobFrame.mimeType, geobFrame.filename, geobFrame.description));
    } else if (entry instanceof ApicFrame) {
      ApicFrame apicFrame = (ApicFrame) entry;
      Log.d(TAG, prefix + String.format("%s: mimeType=%s, description=%s",
              apicFrame.id, apicFrame.mimeType, apicFrame.description));
    } else if (entry instanceof CommentFrame) {
      CommentFrame commentFrame = (CommentFrame) entry;
      Log.d(TAG, prefix + String.format("%s: language=%s, description=%s", commentFrame.id,
              commentFrame.language, commentFrame.description));
    } else if (entry instanceof Id3Frame) {
      Id3Frame id3Frame = (Id3Frame) entry;
      Log.d(TAG, prefix + String.format("%s", id3Frame.id));
    } else if (entry instanceof EventMessage) {
      EventMessage eventMessage = (EventMessage) entry;
      Log.d(TAG, prefix + String.format("EMSG: scheme=%s, id=%d, value=%s",
              eventMessage.schemeIdUri, eventMessage.id, eventMessage.value));
    }
  }
}
 
Example #17
Source File: EventLogger.java    From evercam-android with GNU Affero General Public License v3.0 5 votes vote down vote up
private void printMetadata(Metadata metadata, String prefix) {
  for (int i = 0; i < metadata.length(); i++) {
    Metadata.Entry entry = metadata.get(i);
    if (entry instanceof TextInformationFrame) {
      TextInformationFrame textInformationFrame = (TextInformationFrame) entry;
      Log.d(TAG, prefix + String.format("%s: value=%s", textInformationFrame.id,
              textInformationFrame.value));
    } else if (entry instanceof UrlLinkFrame) {
      UrlLinkFrame urlLinkFrame = (UrlLinkFrame) entry;
      Log.d(TAG, prefix + String.format("%s: url=%s", urlLinkFrame.id, urlLinkFrame.url));
    } else if (entry instanceof PrivFrame) {
      PrivFrame privFrame = (PrivFrame) entry;
      Log.d(TAG, prefix + String.format("%s: owner=%s", privFrame.id, privFrame.owner));
    } else if (entry instanceof GeobFrame) {
      GeobFrame geobFrame = (GeobFrame) entry;
      Log.d(TAG, prefix + String.format("%s: mimeType=%s, filename=%s, description=%s",
              geobFrame.id, geobFrame.mimeType, geobFrame.filename, geobFrame.description));
    } else if (entry instanceof ApicFrame) {
      ApicFrame apicFrame = (ApicFrame) entry;
      Log.d(TAG, prefix + String.format("%s: mimeType=%s, description=%s",
              apicFrame.id, apicFrame.mimeType, apicFrame.description));
    } else if (entry instanceof CommentFrame) {
      CommentFrame commentFrame = (CommentFrame) entry;
      Log.d(TAG, prefix + String.format("%s: language=%s, description=%s", commentFrame.id,
              commentFrame.language, commentFrame.description));
    } else if (entry instanceof Id3Frame) {
      Id3Frame id3Frame = (Id3Frame) entry;
      Log.d(TAG, prefix + String.format("%s", id3Frame.id));
    } else if (entry instanceof EventMessage) {
      EventMessage eventMessage = (EventMessage) entry;
      Log.d(TAG, prefix + String.format("EMSG: scheme=%s, id=%d, value=%s",
              eventMessage.schemeIdUri, eventMessage.id, eventMessage.value));
    }
  }
}
 
Example #18
Source File: EventStream.java    From Telegram-FOSS with GNU General Public License v2.0 5 votes vote down vote up
public EventStream(String schemeIdUri, String value, long timescale, long[] presentationTimesUs,
    EventMessage[] events) {
  this.schemeIdUri = schemeIdUri;
  this.value = value;
  this.timescale = timescale;
  this.presentationTimesUs = presentationTimesUs;
  this.events = events;
}
 
Example #19
Source File: PlayerEmsgHandler.java    From Telegram-FOSS with GNU General Public License v2.0 5 votes vote down vote up
private static long getManifestPublishTimeMsInEmsg(EventMessage eventMessage) {
  try {
    return parseXsDateTime(Util.fromUtf8Bytes(eventMessage.messageData));
  } catch (ParserException ignored) {
    // if we can't parse this event, ignore
    return C.TIME_UNSET;
  }
}
 
Example #20
Source File: PlayerEmsgHandler.java    From Telegram-FOSS with GNU General Public License v2.0 5 votes vote down vote up
private void parsePlayerEmsgEvent(long eventTimeUs, EventMessage eventMessage) {
  long manifestPublishTimeMsInEmsg = getManifestPublishTimeMsInEmsg(eventMessage);
  if (manifestPublishTimeMsInEmsg == C.TIME_UNSET) {
    return;
  }
  onManifestExpiredMessageEncountered(eventTimeUs, manifestPublishTimeMsInEmsg);
}
 
Example #21
Source File: EventStream.java    From Telegram with GNU General Public License v2.0 5 votes vote down vote up
public EventStream(String schemeIdUri, String value, long timescale, long[] presentationTimesUs,
    EventMessage[] events) {
  this.schemeIdUri = schemeIdUri;
  this.value = value;
  this.timescale = timescale;
  this.presentationTimesUs = presentationTimesUs;
  this.events = events;
}
 
Example #22
Source File: PlayerEmsgHandler.java    From Telegram with GNU General Public License v2.0 5 votes vote down vote up
private static long getManifestPublishTimeMsInEmsg(EventMessage eventMessage) {
  try {
    return parseXsDateTime(Util.fromUtf8Bytes(eventMessage.messageData));
  } catch (ParserException ignored) {
    // if we can't parse this event, ignore
    return C.TIME_UNSET;
  }
}
 
Example #23
Source File: PlayerEmsgHandler.java    From Telegram with GNU General Public License v2.0 5 votes vote down vote up
private void parsePlayerEmsgEvent(long eventTimeUs, EventMessage eventMessage) {
  long manifestPublishTimeMsInEmsg = getManifestPublishTimeMsInEmsg(eventMessage);
  if (manifestPublishTimeMsInEmsg == C.TIME_UNSET) {
    return;
  }
  onManifestExpiredMessageEncountered(eventTimeUs, manifestPublishTimeMsInEmsg);
}
 
Example #24
Source File: PlayerEmsgHandler.java    From TelePlus-Android with GNU General Public License v2.0 5 votes vote down vote up
private void parseAndDiscardSamples() {
  while (sampleQueue.hasNextSample()) {
    MetadataInputBuffer inputBuffer = dequeueSample();
    if (inputBuffer == null) {
      continue;
    }
    long eventTimeUs = inputBuffer.timeUs;
    Metadata metadata = decoder.decode(inputBuffer);
    EventMessage eventMessage = (EventMessage) metadata.get(0);
    if (isPlayerEmsgEvent(eventMessage.schemeIdUri, eventMessage.value)) {
      parsePlayerEmsgEvent(eventTimeUs, eventMessage);
    }
  }
  sampleQueue.discardToRead();
}
 
Example #25
Source File: EventStream.java    From TelePlus-Android with GNU General Public License v2.0 5 votes vote down vote up
public EventStream(String schemeIdUri, String value, long timescale, long[] presentationTimesUs,
    EventMessage[] events) {
  this.schemeIdUri = schemeIdUri;
  this.value = value;
  this.timescale = timescale;
  this.presentationTimesUs = presentationTimesUs;
  this.events = events;
}
 
Example #26
Source File: PlayerEmsgHandler.java    From MediaSDK with Apache License 2.0 5 votes vote down vote up
private void parsePlayerEmsgEvent(long eventTimeUs, EventMessage eventMessage) {
  long manifestPublishTimeMsInEmsg = getManifestPublishTimeMsInEmsg(eventMessage);
  if (manifestPublishTimeMsInEmsg == C.TIME_UNSET) {
    return;
  }
  onManifestExpiredMessageEncountered(eventTimeUs, manifestPublishTimeMsInEmsg);
}
 
Example #27
Source File: PlayerEmsgHandler.java    From MediaSDK with Apache License 2.0 5 votes vote down vote up
private void parseAndDiscardSamples() {
  while (sampleQueue.isReady(/* loadingFinished= */ false)) {
    MetadataInputBuffer inputBuffer = dequeueSample();
    if (inputBuffer == null) {
      continue;
    }
    long eventTimeUs = inputBuffer.timeUs;
    Metadata metadata = decoder.decode(inputBuffer);
    EventMessage eventMessage = (EventMessage) metadata.get(0);
    if (isPlayerEmsgEvent(eventMessage.schemeIdUri, eventMessage.value)) {
      parsePlayerEmsgEvent(eventTimeUs, eventMessage);
    }
  }
  sampleQueue.discardToRead();
}
 
Example #28
Source File: PlayerEmsgHandler.java    From TelePlus-Android with GNU General Public License v2.0 5 votes vote down vote up
private static long getManifestPublishTimeMsInEmsg(EventMessage eventMessage) {
  try {
    return parseXsDateTime(new String(eventMessage.messageData));
  } catch (ParserException ignored) {
    // if we can't parse this event, ignore
    return C.TIME_UNSET;
  }
}
 
Example #29
Source File: PlayerEmsgHandler.java    From MediaSDK with Apache License 2.0 5 votes vote down vote up
private static long getManifestPublishTimeMsInEmsg(EventMessage eventMessage) {
  try {
    return parseXsDateTime(Util.fromUtf8Bytes(eventMessage.messageData));
  } catch (ParserException ignored) {
    // if we can't parse this event, ignore
    return C.TIME_UNSET;
  }
}
 
Example #30
Source File: PlayerEmsgHandler.java    From TelePlus-Android with GNU General Public License v2.0 5 votes vote down vote up
private void parsePlayerEmsgEvent(long eventTimeUs, EventMessage eventMessage) {
  long manifestPublishTimeMsInEmsg = getManifestPublishTimeMsInEmsg(eventMessage);
  if (manifestPublishTimeMsInEmsg == C.TIME_UNSET) {
    return;
  }

  if (isMessageSignalingMediaPresentationEnded(eventMessage)) {
    onMediaPresentationEndedMessageEncountered();
  } else {
    onManifestExpiredMessageEncountered(eventTimeUs, manifestPublishTimeMsInEmsg);
  }
}