Home | History | Annotate | Download | only in base
      1 // Copyright 2013 The Chromium Authors. All rights reserved.
      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_BASE_MEDIA_FILE_CHECKER_H_
      6 #define MEDIA_BASE_MEDIA_FILE_CHECKER_H_
      7 
      8 #include "base/basictypes.h"
      9 #include "base/files/file.h"
     10 #include "media/base/media_export.h"
     11 
     12 namespace base {
     13 class TimeDelta;
     14 }
     15 
     16 namespace media {
     17 
     18 // This class tries to determine if a file is a valid media file. The entire
     19 // file is not decoded so a positive result from this class does not make the
     20 // file safe to use in the browser process.
     21 class MEDIA_EXPORT MediaFileChecker {
     22  public:
     23   explicit MediaFileChecker(base::File file);
     24   ~MediaFileChecker();
     25 
     26   // After opening |file|, up to |check_time| amount of wall-clock time is spent
     27   // decoding the file. The amount of audio/video data decoded will depend on
     28   // the bitrate of the file and the speed of the CPU.
     29   bool Start(base::TimeDelta check_time);
     30 
     31  private:
     32   base::File file_;
     33 
     34   DISALLOW_COPY_AND_ASSIGN(MediaFileChecker);
     35 };
     36 
     37 }  // namespace media
     38 
     39 #endif  // MEDIA_BASE_MEDIA_FILE_CHECKER_H_
     40