summaryrefslogtreecommitdiffstats
path: root/media/base/filter_factories.h
blob: 4e34c0fb478d43b3db3d9b56fa80dc17ccc489f9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
// 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_FILTER_FACTORIES_H_
#define MEDIA_BASE_FILTER_FACTORIES_H_

#include<string>

#include "base/callback_old.h"
#include "media/base/media_export.h"
#include "media/base/pipeline_status.h"

namespace media {

class DataSource;

// Asynchronous factory interface for building DataSource objects.
class MEDIA_EXPORT DataSourceFactory {
 public:
  // Ownership of the DataSource is transferred through this callback.
  typedef Callback2<PipelineStatus, DataSource*>::Type BuildCallback;

  virtual ~DataSourceFactory();

  // Builds a DataSource for |url| and returns it via |callback|.
  virtual void Build(const std::string& url, BuildCallback* callback) = 0;

  // Makes a copy of this factory.
  // NOTE: Pending requests are not cloned.
  virtual DataSourceFactory* Clone() const = 0;
};

class Demuxer;

// Asynchronous factory interface for building Demuxer objects.
class MEDIA_EXPORT DemuxerFactory {
 public:
  // Ownership of the Demuxer is transferred through this callback.
  typedef Callback2<PipelineStatus, Demuxer*>::Type BuildCallback;

  virtual ~DemuxerFactory();

  // Builds a Demuxer for |url| and returns it via |callback|.
  virtual void Build(const std::string& url, BuildCallback* callback) = 0;

  // Makes a copy of this factory.
  // NOTE: Pending requests are not cloned.
  virtual DemuxerFactory* Clone() const = 0;
};

}  // namespace media

#endif  // MEDIA_BASE_FILTER_FACTORIES_H_