Shaka Player Embedded
demuxer.cc
Go to the documentation of this file.
1 // Copyright 2019 Google LLC
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // https://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 
15 #include "shaka/media/demuxer.h"
16 
17 #include <glog/logging.h>
18 
19 #include <atomic>
20 
21 #ifdef HAS_DEMUXER
23 #endif
24 #include "src/util/macros.h"
25 
26 namespace shaka {
27 namespace media {
28 
29 namespace {
30 
31 std::atomic<const DemuxerFactory*> demuxer_factory_{nullptr};
32 
33 } // namespace
34 
35 // \cond Doxygen_Skip
37 Demuxer::~Demuxer() {}
38 
40 Demuxer::Client::~Client() {}
41 // \endcond Doxygen_Skip
42 
43 bool Demuxer::SwitchType(const std::string& mime_type) {
44  return false;
45 }
46 
47 
48 // \cond Doxygen_Skip
50 DemuxerFactory::~DemuxerFactory() {}
51 // \endcond Doxygen_Skip
52 
54  const DemuxerFactory* ret = demuxer_factory_.load(std::memory_order_relaxed);
55  if (ret)
56  return ret;
57 
58 #ifdef HAS_DEMUXER
59  static ffmpeg::FFmpegDemuxerFactory* factory =
61  return factory;
62 #else
63  return nullptr;
64 #endif
65 }
66 
68  demuxer_factory_.store(func, std::memory_order_relaxed);
69 }
70 
71 bool DemuxerFactory::CanSwitchType(const std::string& old_mime_type,
72  const std::string& new_mime_type) const {
73  return false;
74 }
75 
76 } // namespace media
77 } // namespace shaka
static const DemuxerFactory * GetFactory()
Definition: demuxer.cc:53
static void SetFactory(const DemuxerFactory *factory)
Definition: demuxer.cc:67
virtual bool CanSwitchType(const std::string &old_mime_type, const std::string &new_mime_type) const
Definition: demuxer.cc:71
virtual bool SwitchType(const std::string &mime_type)
Definition: demuxer.cc:43