| 1 | /***************************************************************************** |
| 2 | ** QNapi |
| 3 | ** Copyright (C) 2008-2017 Piotr KrzemiĆski <[email protected]> |
| 4 | ** |
| 5 | ** This program is free software; you can redistribute it and/or modify |
| 6 | ** it under the terms of the GNU General Public License as published by |
| 7 | ** the Free Software Foundation; either version 2 of the License, or |
| 8 | ** (at your option) any later version. |
| 9 | ** |
| 10 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
| 11 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
| 12 | ** |
| 13 | *****************************************************************************/ |
| 14 | |
| 15 | #include "libmediainfomovieinfoprovider.h"cxx . . $ `<file>/libqnapi/src/movieinfo/libmediainfomovieinfoprovider.h`/ |
| 16 | #include <QRegExp> |
| 17 | #include <string> |
| 18 | |
| 19 | #ifndef UNICODE |
| 20 | #define UNICODEcxx . . $ `libqnapi/src/movieinfo/libmediainfomovieinfoprovider.cpp:20:9`! |
| 21 | #endif |
| 22 | |
| 23 | #ifdef UNICODEcxx . . $ `libqnapi/src/movieinfo/libmediainfomovieinfoprovider.cpp:20:9`! |
| 24 | #define _UNICODEcxx . . $ `libqnapi/src/movieinfo/libmediainfomovieinfoprovider.cpp:24:9`! |
| 25 | #endif |
| 26 | |
| 27 | #if defined(Q_OS_WIN) || defined(Q_OS_MAC) |
| 28 | #include "MediaInfoDLL/MediaInfoDLL.h" //Dynamicly-loaded library (.dll or .so) |
| 29 | #define MediaInfoNameSpace MediaInfoDLL; |
| 30 | #else |
| 31 | #include "MediaInfo/MediaInfo.h" //Staticly-loaded library (.lib or .a or .so) |
| 32 | #define MediaInfoNameSpacecxx . . $ `libqnapi/src/movieinfo/libmediainfomovieinfoprovider.cpp:32:9`! MediaInfoLib; |
| 33 | #endif |
| 34 | using namespace MediaInfoNameSpacecxx . . $ `libqnapi/src/movieinfo/libmediainfomovieinfoprovider.cpp:32:9`!; |
| 35 | |
| 36 | const Maybecxx . . $ Maybe#<MovieInfocxx . . $ MovieInfo#> LibmediainfoMovieInfoProvidercxx . . $ LibmediainfoMovieInfoProvider#::getMovieInfocxx . . $ LibmediainfoMovieInfoProvider#getMovieInfo(7c952fc59654f98e).( |
| 37 | const QStringcxx . . $ QString#& moviePath) const { |
| 38 | MediaInfocxx . . $ MediaInfoLib/MediaInfo# micxx . . $ MediaInfoLib/MediaInfo#MediaInfo(49f6e7a06ebc5aa8).; |
| 39 | mi.Optioncxx . . $ MediaInfoLib/MediaInfo#Option(7cb2c0d5f2028ad2).(__Tcxx . . $ `<external>/1311968951023156013/MediaInfo_Const.h:119:13`!("Internet"), __Tcxx . . $ `<external>/1311968951023156013/MediaInfo_Const.h:119:13`!("No")); |
| 40 | |
| 41 | mi.Opencxx . . $ MediaInfoLib/MediaInfo#Open(9ec422848e523e73).(moviePath.toStdWStringcxx . . $ QString#toStdWString(d07e96ea086800fd).()); |
| 42 | |
| 43 | #define GET_VIDEO_INFOcxx . . $ `libqnapi/src/movieinfo/libmediainfomovieinfoprovider.cpp:43:9`!(__streamIdx, __key) \ |
| 44 | QString::fromStdWString( \ |
| 45 | std::wstring(mi.Get(Stream_Video, __streamIdx, __Tcxx . . $ `<external>/1311968951023156013/MediaInfo_Const.h:119:13`!(__key), Info_Text))) |
| 46 | |
| 47 | QStringcxx . . $ QString# widthS = GET_VIDEO_INFOcxx . . $ `libqnapi/src/movieinfo/libmediainfomovieinfoprovider.cpp:43:9`!(0, "Width"); |
| 48 | QStringcxx . . $ QString# heightS = GET_VIDEO_INFOcxx . . $ `libqnapi/src/movieinfo/libmediainfomovieinfoprovider.cpp:43:9`!(0, "Height"); |
| 49 | QStringcxx . . $ QString# frameRateS = GET_VIDEO_INFOcxx . . $ `libqnapi/src/movieinfo/libmediainfomovieinfoprovider.cpp:43:9`!(0, "FrameRate"); |
| 50 | QStringcxx . . $ QString# durationS = GET_VIDEO_INFOcxx . . $ `libqnapi/src/movieinfo/libmediainfomovieinfoprovider.cpp:43:9`!(0, "Duration"); |
| 51 | |
| 52 | mi.Closecxx . . $ MediaInfoLib/MediaInfo#Close(49f6e7a06ebc5aa8).(); |
| 53 | |
| 54 | QRegExpcxx . . $ QRegExp# rWidthcxx . . $ QRegExp#QRegExp(31e086911ff70bd0).("(\\d+)"cxx . . $ QString#QString(85c52e162fed56f9).); |
| 55 | if (rWidth.indexIncxx . . $ QRegExp#indexIn(46f502bdfc4aeb33).(widthS) == -1) return nothingcxx . . $ nothing(adb11f779fe07013).(); |
| 56 | |
| 57 | QRegExpcxx . . $ QRegExp# rHeightcxx . . $ QRegExp#QRegExp(31e086911ff70bd0).("(\\d+)"cxx . . $ QString#QString(85c52e162fed56f9).); |
| 58 | if (rHeight.indexIncxx . . $ QRegExp#indexIn(46f502bdfc4aeb33).(heightS) == -1) return nothingcxx . . $ nothing(adb11f779fe07013).(); |
| 59 | |
| 60 | QRegExpcxx . . $ QRegExp# rFrameRatecxx . . $ QRegExp#QRegExp(31e086911ff70bd0).("(\\d+).(\\d+)"cxx . . $ QString#QString(85c52e162fed56f9).); |
| 61 | if (rFrameRate.indexIncxx . . $ QRegExp#indexIn(46f502bdfc4aeb33).(frameRateS) == -1) return nothingcxx . . $ nothing(adb11f779fe07013).(); |
| 62 | long frFloor = rFrameRate.capcxx . . $ QRegExp#cap(ce915ed341d4a7f0).(1).toLongcxx . . $ QString#toLong(9627c40b2a14c302).(); |
| 63 | long frFrac = rFrameRate.capcxx . . $ QRegExp#cap(ce915ed341d4a7f0).(2).toLongcxx . . $ QString#toLong(9627c40b2a14c302).(); |
| 64 | |
| 65 | QRegExpcxx . . $ QRegExp# rDurationcxx . . $ QRegExp#QRegExp(31e086911ff70bd0).("(\\d+)"cxx . . $ QString#QString(85c52e162fed56f9).); |
| 66 | if (rDuration.indexIncxx . . $ QRegExp#indexIn(46f502bdfc4aeb33).(durationS) == -1) return nothingcxx . . $ nothing(adb11f779fe07013).(); |
| 67 | |
| 68 | MovieInfocxx . . $ MovieInfo# infocxx . . $ MovieInfo#MovieInfo(37e84e2efb9d205c).(rWidth.capcxx . . $ QRegExp#cap(ce915ed341d4a7f0).(1).toIntcxx . . $ QString#toInt(d7972accae11ee1f).(), rHeight.capcxx . . $ QRegExp#cap(ce915ed341d4a7f0).(1).toIntcxx . . $ QString#toInt(d7972accae11ee1f).(), |
| 69 | (double)frFloor + (double)frFrac / 1000.0, |
| 70 | rDuration.capcxx . . $ QRegExp#cap(ce915ed341d4a7f0).(1).toDoublecxx . . $ QString#toDouble(1bd8e57dd4a29c14).() / 1000.0); |
| 71 | |
| 72 | return justcxx . . $ just(62f398f3cea75aa5).<MovieInfocxx . . $ MovieInfo#>(info); |
| 73 | } |