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

The following examples show how to use com.google.android.exoplayer2.metadata.emsg.EventMessageDecoder. 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: MetadataDecoderFactory.java    From MediaSDK with Apache License 2.0 6 votes vote down vote up
@Override
public MetadataDecoder createDecoder(Format format) {
  @Nullable String mimeType = format.sampleMimeType;
  if (mimeType != null) {
    switch (mimeType) {
      case MimeTypes.APPLICATION_ID3:
        return new Id3Decoder();
      case MimeTypes.APPLICATION_EMSG:
        return new EventMessageDecoder();
      case MimeTypes.APPLICATION_SCTE35:
        return new SpliceInfoDecoder();
      case MimeTypes.APPLICATION_ICY:
        return new IcyDecoder();
      default:
        break;
    }
  }
  throw new IllegalArgumentException(
      "Attempted to create decoder for unsupported MIME type: " + mimeType);
}
 
Example #2
Source File: HlsSampleStreamWrapper.java    From MediaSDK with Apache License 2.0 6 votes vote down vote up
public EmsgUnwrappingTrackOutput(
    TrackOutput delegate, @HlsMediaSource.MetadataType int metadataType) {
  this.emsgDecoder = new EventMessageDecoder();
  this.delegate = delegate;
  switch (metadataType) {
    case HlsMediaSource.METADATA_TYPE_ID3:
      delegateFormat = ID3_FORMAT;
      break;
    case HlsMediaSource.METADATA_TYPE_EMSG:
      delegateFormat = EMSG_FORMAT;
      break;
    default:
      throw new IllegalArgumentException("Unknown metadataType: " + metadataType);
  }

  this.buffer = new byte[0];
  this.bufferPosition = 0;
}
 
Example #3
Source File: MetadataDecoderFactory.java    From Telegram-FOSS with GNU General Public License v2.0 6 votes vote down vote up
@Override
public MetadataDecoder createDecoder(Format format) {
  switch (format.sampleMimeType) {
    case MimeTypes.APPLICATION_ID3:
      return new Id3Decoder();
    case MimeTypes.APPLICATION_EMSG:
      return new EventMessageDecoder();
    case MimeTypes.APPLICATION_SCTE35:
      return new SpliceInfoDecoder();
    case MimeTypes.APPLICATION_ICY:
      return new IcyDecoder();
    default:
      throw new IllegalArgumentException(
          "Attempted to create decoder for unsupported format");
  }
}
 
Example #4
Source File: HlsSampleStreamWrapper.java    From Telegram-FOSS with GNU General Public License v2.0 6 votes vote down vote up
public EmsgUnwrappingTrackOutput(TrackOutput delegate, @HlsMetadataType int metadataType) {
  this.emsgDecoder = new EventMessageDecoder();
  this.delegate = delegate;
  switch (metadataType) {
    case HlsMetadataType.ID3:
      delegateFormat = ID3_FORMAT;
      break;
    case HlsMetadataType.EMSG:
      delegateFormat = EMSG_FORMAT;
      break;
    default:
      throw new IllegalArgumentException("Unknown metadataType: " + metadataType);
  }

  this.buffer = new byte[0];
  this.bufferPosition = 0;
}
 
Example #5
Source File: MetadataDecoderFactory.java    From Telegram with GNU General Public License v2.0 6 votes vote down vote up
@Override
public MetadataDecoder createDecoder(Format format) {
  switch (format.sampleMimeType) {
    case MimeTypes.APPLICATION_ID3:
      return new Id3Decoder();
    case MimeTypes.APPLICATION_EMSG:
      return new EventMessageDecoder();
    case MimeTypes.APPLICATION_SCTE35:
      return new SpliceInfoDecoder();
    case MimeTypes.APPLICATION_ICY:
      return new IcyDecoder();
    default:
      throw new IllegalArgumentException(
          "Attempted to create decoder for unsupported format");
  }
}
 
Example #6
Source File: HlsSampleStreamWrapper.java    From Telegram with GNU General Public License v2.0 6 votes vote down vote up
public EmsgUnwrappingTrackOutput(TrackOutput delegate, @HlsMetadataType int metadataType) {
  this.emsgDecoder = new EventMessageDecoder();
  this.delegate = delegate;
  switch (metadataType) {
    case HlsMetadataType.ID3:
      delegateFormat = ID3_FORMAT;
      break;
    case HlsMetadataType.EMSG:
      delegateFormat = EMSG_FORMAT;
      break;
    default:
      throw new IllegalArgumentException("Unknown metadataType: " + metadataType);
  }

  this.buffer = new byte[0];
  this.bufferPosition = 0;
}
 
Example #7
Source File: PlayerEmsgHandler.java    From MediaSDK with Apache License 2.0 5 votes vote down vote up
/**
 * @param manifest The initial manifest.
 * @param playerEmsgCallback The callback that this event handler can invoke when handling emsg
 *     messages that generate DASH media source events.
 * @param allocator An {@link Allocator} from which allocations can be obtained.
 */
public PlayerEmsgHandler(
    DashManifest manifest, PlayerEmsgCallback playerEmsgCallback, Allocator allocator) {
  this.manifest = manifest;
  this.playerEmsgCallback = playerEmsgCallback;
  this.allocator = allocator;

  manifestPublishTimeToExpiryTimeUs = new TreeMap<>();
  handler = Util.createHandler(/* callback= */ this);
  decoder = new EventMessageDecoder();
  lastLoadedChunkEndTimeUs = C.TIME_UNSET;
  lastLoadedChunkEndTimeBeforeRefreshUs = C.TIME_UNSET;
}
 
Example #8
Source File: MetadataDecoderFactory.java    From TelePlus-Android with GNU General Public License v2.0 5 votes vote down vote up
@Override
public MetadataDecoder createDecoder(Format format) {
  switch (format.sampleMimeType) {
    case MimeTypes.APPLICATION_ID3:
      return new Id3Decoder();
    case MimeTypes.APPLICATION_EMSG:
      return new EventMessageDecoder();
    case MimeTypes.APPLICATION_SCTE35:
      return new SpliceInfoDecoder();
    default:
      throw new IllegalArgumentException("Attempted to create decoder for unsupported format");
  }
}
 
Example #9
Source File: PlayerEmsgHandler.java    From TelePlus-Android with GNU General Public License v2.0 5 votes vote down vote up
/**
 * @param manifest The initial manifest.
 * @param playerEmsgCallback The callback that this event handler can invoke when handling emsg
 *     messages that generate DASH media source events.
 * @param allocator An {@link Allocator} from which allocations can be obtained.
 */
public PlayerEmsgHandler(
    DashManifest manifest, PlayerEmsgCallback playerEmsgCallback, Allocator allocator) {
  this.manifest = manifest;
  this.playerEmsgCallback = playerEmsgCallback;
  this.allocator = allocator;

  manifestPublishTimeToExpiryTimeUs = new TreeMap<>();
  handler = Util.createHandler(/* callback= */ this);
  decoder = new EventMessageDecoder();
  lastLoadedChunkEndTimeUs = C.TIME_UNSET;
  lastLoadedChunkEndTimeBeforeRefreshUs = C.TIME_UNSET;
}
 
Example #10
Source File: MetadataDecoderFactory.java    From TelePlus-Android with GNU General Public License v2.0 5 votes vote down vote up
@Override
public MetadataDecoder createDecoder(Format format) {
  switch (format.sampleMimeType) {
    case MimeTypes.APPLICATION_ID3:
      return new Id3Decoder();
    case MimeTypes.APPLICATION_EMSG:
      return new EventMessageDecoder();
    case MimeTypes.APPLICATION_SCTE35:
      return new SpliceInfoDecoder();
    default:
      throw new IllegalArgumentException("Attempted to create decoder for unsupported format");
  }
}
 
Example #11
Source File: PlayerEmsgHandler.java    From TelePlus-Android with GNU General Public License v2.0 5 votes vote down vote up
/**
 * @param manifest The initial manifest.
 * @param playerEmsgCallback The callback that this event handler can invoke when handling emsg
 *     messages that generate DASH media source events.
 * @param allocator An {@link Allocator} from which allocations can be obtained.
 */
public PlayerEmsgHandler(
    DashManifest manifest, PlayerEmsgCallback playerEmsgCallback, Allocator allocator) {
  this.manifest = manifest;
  this.playerEmsgCallback = playerEmsgCallback;
  this.allocator = allocator;

  manifestPublishTimeToExpiryTimeUs = new TreeMap<>();
  handler = Util.createHandler(/* callback= */ this);
  decoder = new EventMessageDecoder();
  lastLoadedChunkEndTimeUs = C.TIME_UNSET;
  lastLoadedChunkEndTimeBeforeRefreshUs = C.TIME_UNSET;
}
 
Example #12
Source File: PlayerEmsgHandler.java    From Telegram-FOSS with GNU General Public License v2.0 5 votes vote down vote up
/**
 * @param manifest The initial manifest.
 * @param playerEmsgCallback The callback that this event handler can invoke when handling emsg
 *     messages that generate DASH media source events.
 * @param allocator An {@link Allocator} from which allocations can be obtained.
 */
public PlayerEmsgHandler(
    DashManifest manifest, PlayerEmsgCallback playerEmsgCallback, Allocator allocator) {
  this.manifest = manifest;
  this.playerEmsgCallback = playerEmsgCallback;
  this.allocator = allocator;

  manifestPublishTimeToExpiryTimeUs = new TreeMap<>();
  handler = Util.createHandler(/* callback= */ this);
  decoder = new EventMessageDecoder();
  lastLoadedChunkEndTimeUs = C.TIME_UNSET;
  lastLoadedChunkEndTimeBeforeRefreshUs = C.TIME_UNSET;
}
 
Example #13
Source File: PlayerEmsgHandler.java    From Telegram with GNU General Public License v2.0 5 votes vote down vote up
/**
 * @param manifest The initial manifest.
 * @param playerEmsgCallback The callback that this event handler can invoke when handling emsg
 *     messages that generate DASH media source events.
 * @param allocator An {@link Allocator} from which allocations can be obtained.
 */
public PlayerEmsgHandler(
    DashManifest manifest, PlayerEmsgCallback playerEmsgCallback, Allocator allocator) {
  this.manifest = manifest;
  this.playerEmsgCallback = playerEmsgCallback;
  this.allocator = allocator;

  manifestPublishTimeToExpiryTimeUs = new TreeMap<>();
  handler = Util.createHandler(/* callback= */ this);
  decoder = new EventMessageDecoder();
  lastLoadedChunkEndTimeUs = C.TIME_UNSET;
  lastLoadedChunkEndTimeBeforeRefreshUs = C.TIME_UNSET;
}