Upload upstream chromium 108.0.5359.1
[platform/framework/web/chromium-efl.git] / media / filters / media_file_checker.h
1 // Copyright 2013 The Chromium Authors
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef MEDIA_FILTERS_MEDIA_FILE_CHECKER_H_
6 #define MEDIA_FILTERS_MEDIA_FILE_CHECKER_H_
7
8 #include "base/files/file.h"
9 #include "media/base/media_export.h"
10
11 namespace base {
12 class TimeDelta;
13 }
14
15 namespace media {
16
17 // This class tries to determine if a file is a valid media file. The entire
18 // file is not decoded so a positive result from this class does not make the
19 // file safe to use in the browser process.
20 class MEDIA_EXPORT MediaFileChecker {
21  public:
22   explicit MediaFileChecker(base::File file);
23
24   MediaFileChecker(const MediaFileChecker&) = delete;
25   MediaFileChecker& operator=(const MediaFileChecker&) = delete;
26
27   ~MediaFileChecker();
28
29   // After opening |file|, up to |check_time| amount of wall-clock time is spent
30   // decoding the file. The amount of audio/video data decoded will depend on
31   // the bitrate of the file and the speed of the CPU.
32   bool Start(base::TimeDelta check_time);
33
34  private:
35   base::File file_;
36 };
37
38 }  // namespace media
39
40 #endif  // MEDIA_FILTERS_MEDIA_FILE_CHECKER_H_