blob: 07dfe7119647b493b33bbed23269c7355d80bef5 [file] [log] [blame]
// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef MEDIA_BASE_DEMUXER_STREAM_H_
#define MEDIA_BASE_DEMUXER_STREAM_H_
#include "base/callback.h"
#include "base/memory/ref_counted.h"
#include "media/base/media_export.h"
struct AVStream;
namespace media {
class AudioDecoderConfig;
class Buffer;
class VideoDecoderConfig;
class MEDIA_EXPORT DemuxerStream
: public base::RefCountedThreadSafe<DemuxerStream> {
public:
typedef base::Callback<void(Buffer*)> ReadCallback;
enum Type {
UNKNOWN,
AUDIO,
VIDEO,
NUM_TYPES, // Always keep this entry as the last one!
};
// Schedules a read. When the |read_callback| is called, the downstream
// object takes ownership of the buffer by AddRef()'ing the buffer.
virtual void Read(const ReadCallback& read_callback) = 0;
// Returns the audio decoder configuration. It is an error to call this method
// if type() != AUDIO.
virtual const AudioDecoderConfig& audio_decoder_config() = 0;
// Returns the video decoder configuration. It is an error to call this method
// if type() != VIDEO.
virtual const VideoDecoderConfig& video_decoder_config() = 0;
// Returns the type of stream.
virtual Type type() = 0;
virtual void EnableBitstreamConverter() = 0;
protected:
friend class base::RefCountedThreadSafe<DemuxerStream>;
virtual ~DemuxerStream();
};
} // namespace media
#endif // MEDIA_BASE_DEMUXER_STREAM_H_