blob: 4c4342ebc5efc6178f3c9a0c70646d7e6db258c9 [file] [log] [blame]
Ajit Khare73cfaf42013-01-07 23:28:47 -08001/*
2 *Copyright (c) 2013, The Linux Foundation. All rights reserved.
3 *Not a Contribution, Apache license notifications and license are retained
4 *for attribution purposes only.
5 *
6 * Copyright (C) 2010 The Android Open Source Project
7 *
8 * Licensed under the Apache License, Version 2.0 (the "License");
9 * you may not use this file except in compliance with the License.
10 * You may obtain a copy of the License at
11 *
12 * http://www.apache.org/licenses/LICENSE-2.0
13 *
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
19 */
20
Shalaj Jain65506622013-01-29 18:27:08 -080021//#define LOG_NDEBUG 0
Ajit Khare73cfaf42013-01-07 23:28:47 -080022#define LOG_TAG "DASHFactory"
23#include <media/IMediaPlayer.h>
24#include <utils/Log.h>
25#include "DashPlayerDriver.h"
26#include "MediaPlayerFactory.h"
27
28namespace android {
29
30class DashPlayerFactory : public MediaPlayerFactory::IFactory {
31 public:
32 virtual float scoreFactory(const sp<IMediaPlayer>& client,
33 const char* url,
34 float curScore) {
35 static const float kOurScore = 0.8;
36
37 if (kOurScore <= curScore)
38 return 0.0;
39
40 if (!strncasecmp("http://", url, 7)
41 || !strncasecmp("https://", url, 8)) {
42 size_t len = strlen(url);
43 if (len >= 5 && !strcasecmp(".mpd", &url[len - 4])) {
44 return kOurScore;
45 }
46
47 if (strstr(url,"mpd")) {
48 return kOurScore;
49 }
50 }
51 return 0.0;
52 }
53
54 virtual float scoreFactory(const sp<IMediaPlayer>& client,
55 const sp<IStreamSource> &source,
56 float curScore) {
57 return 0.0;
58 }
59
60 virtual sp<MediaPlayerBase> createPlayer() {
61 ALOGV("DashPlayerFactory::createPlayer");
62 return new DashPlayerDriver;
63 }
64};
65
66extern "C" MediaPlayerFactory::IFactory* CreateDASHFactory()
67{
68 return new DashPlayerFactory();
69}
70
Shalaj Jain65506622013-01-29 18:27:08 -080071} // namespace android