blob: 65a9253f6827bd5e7c533d281deca91b88d5ada9 (
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
55
56
57
58
59
60
61
62
63
64
65
|
/*
* Copyright (C) 2005-2020 Team Kodi
* This file is part of Kodi - https://kodi.tv
*
* SPDX-License-Identifier: GPL-2.0-or-later
* See LICENSES/README.md for more information.
*/
#include "video/VideoFileItemClassify.h"
#include "FileItem.h"
#include "ServiceBroker.h"
#include "utils/FileExtensionProvider.h"
#include "utils/StringUtils.h"
#include "utils/URIUtils.h"
namespace KODI::VIDEO
{
bool IsVideo(const CFileItem& item)
{
/* check preset mime type */
if (StringUtils::StartsWithNoCase(item.GetMimeType(), "video/"))
return true;
if (item.HasVideoInfoTag())
return true;
if (item.HasGameInfoTag())
return false;
if (item.HasMusicInfoTag())
return false;
if (item.HasPictureInfoTag())
return false;
// TV recordings are videos...
if (!item.m_bIsFolder && URIUtils::IsPVRTVRecordingFileOrFolder(item.GetPath()))
return true;
// ... all other PVR items are not.
if (item.IsPVR())
return false;
if (URIUtils::IsDVD(item.GetPath()))
return true;
std::string extension;
if (StringUtils::StartsWithNoCase(item.GetMimeType(), "application/"))
{ /* check for some standard types */
extension = item.GetMimeType().substr(12);
if (StringUtils::EqualsNoCase(extension, "ogg") ||
StringUtils::EqualsNoCase(extension, "mp4") || StringUtils::EqualsNoCase(extension, "mxf"))
return true;
}
//! @todo If the file is a zip file, ask the game clients if any support this
// file before assuming it is video.
return URIUtils::HasExtension(item.GetPath(),
CServiceBroker::GetFileExtensionProvider().GetVideoExtensions());
}
} // namespace KODI::VIDEO
|