Search in sources :

Example 1 with DefaultTrackOutput

use of com.google.android.exoplayer2.extractor.DefaultTrackOutput in project ExoPlayer by google.

the class ChunkSampleStream method onLoadCanceled.

@Override
public void onLoadCanceled(Chunk loadable, long elapsedRealtimeMs, long loadDurationMs, boolean released) {
    eventDispatcher.loadCanceled(loadable.dataSpec, loadable.type, primaryTrackType, loadable.trackFormat, loadable.trackSelectionReason, loadable.trackSelectionData, loadable.startTimeUs, loadable.endTimeUs, elapsedRealtimeMs, loadDurationMs, loadable.bytesLoaded());
    if (!released) {
        primarySampleQueue.reset(true);
        for (DefaultTrackOutput embeddedSampleQueue : embeddedSampleQueues) {
            embeddedSampleQueue.reset(true);
        }
        callback.onContinueLoadingRequested(this);
    }
}
Also used : DefaultTrackOutput(com.google.android.exoplayer2.extractor.DefaultTrackOutput)

Example 2 with DefaultTrackOutput

use of com.google.android.exoplayer2.extractor.DefaultTrackOutput in project ExoPlayer by google.

the class ChunkSampleStream method release.

/**
   * Releases the stream.
   * <p>
   * This method should be called when the stream is no longer required.
   */
public void release() {
    primarySampleQueue.disable();
    for (DefaultTrackOutput embeddedSampleQueue : embeddedSampleQueues) {
        embeddedSampleQueue.disable();
    }
    loader.release();
}
Also used : DefaultTrackOutput(com.google.android.exoplayer2.extractor.DefaultTrackOutput)

Example 3 with DefaultTrackOutput

use of com.google.android.exoplayer2.extractor.DefaultTrackOutput in project ExoPlayer by google.

the class HlsSampleStreamWrapper method track.

// ExtractorOutput implementation. Called by the loading thread.
@Override
public DefaultTrackOutput track(int id, int type) {
    if (sampleQueues.indexOfKey(id) >= 0) {
        return sampleQueues.get(id);
    }
    DefaultTrackOutput trackOutput = new DefaultTrackOutput(allocator);
    trackOutput.setUpstreamFormatChangeListener(this);
    trackOutput.sourceId(upstreamChunkUid);
    sampleQueues.put(id, trackOutput);
    return trackOutput;
}
Also used : DefaultTrackOutput(com.google.android.exoplayer2.extractor.DefaultTrackOutput)

Example 4 with DefaultTrackOutput

use of com.google.android.exoplayer2.extractor.DefaultTrackOutput in project ExoPlayer by google.

the class ChunkSampleStream method seekToUs.

/**
   * Seeks to the specified position in microseconds.
   *
   * @param positionUs The seek position in microseconds.
   */
public void seekToUs(long positionUs) {
    lastSeekPositionUs = positionUs;
    // If we're not pending a reset, see if we can seek within the primary sample queue.
    boolean seekInsideBuffer = !isPendingReset() && primarySampleQueue.skipToKeyframeBefore(positionUs, positionUs < getNextLoadPositionUs());
    if (seekInsideBuffer) {
        // any embedded streams as well.
        while (mediaChunks.size() > 1 && mediaChunks.get(1).getFirstSampleIndex(0) <= primarySampleQueue.getReadIndex()) {
            mediaChunks.removeFirst();
        }
        // sample queues beyond the current read position of the primary stream.
        for (DefaultTrackOutput embeddedSampleQueue : embeddedSampleQueues) {
            embeddedSampleQueue.skipToKeyframeBefore(positionUs);
        }
    } else {
        // We failed, and need to restart.
        pendingResetPositionUs = positionUs;
        loadingFinished = false;
        mediaChunks.clear();
        if (loader.isLoading()) {
            loader.cancelLoading();
        } else {
            primarySampleQueue.reset(true);
            for (DefaultTrackOutput embeddedSampleQueue : embeddedSampleQueues) {
                embeddedSampleQueue.reset(true);
            }
        }
    }
}
Also used : DefaultTrackOutput(com.google.android.exoplayer2.extractor.DefaultTrackOutput)

Example 5 with DefaultTrackOutput

use of com.google.android.exoplayer2.extractor.DefaultTrackOutput in project ExoPlayer by google.

the class ExtractorMediaPeriod method track.

// ExtractorOutput implementation. Called by the loading thread.
@Override
public TrackOutput track(int id, int type) {
    DefaultTrackOutput trackOutput = sampleQueues.get(id);
    if (trackOutput == null) {
        trackOutput = new DefaultTrackOutput(allocator);
        trackOutput.setUpstreamFormatChangeListener(this);
        sampleQueues.put(id, trackOutput);
    }
    return trackOutput;
}
Also used : DefaultTrackOutput(com.google.android.exoplayer2.extractor.DefaultTrackOutput)

Aggregations

DefaultTrackOutput (com.google.android.exoplayer2.extractor.DefaultTrackOutput)5