FFmpegKit Linux API 5.1
FFprobeKit.cpp
Go to the documentation of this file.
1/*
2 * Copyright (c) 2022 Taner Sener
3 *
4 * This file is part of FFmpegKit.
5 *
6 * FFmpegKit is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU Lesser General Public License as published by
8 * the Free Software Foundation, either version 3 of the License, or
9 * (at your option) any later version.
10 *
11 * FFmpegKit is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public License
17 * along with FFmpegKit. If not, see <http://www.gnu.org/licenses/>.
18 */
19
20#include "fftools_ffmpeg.h"
21#include "FFmpegKit.h"
22#include "FFmpegKitConfig.h"
23#include "FFprobeKit.h"
24
25extern void* ffmpegKitInitialize();
26
28
29static std::list<std::string> defaultGetMediaInformationCommandArguments(const std::string& path) {
30 return std::list<std::string>{"-v", "error", "-hide_banner", "-print_format", "json", "-show_format", "-show_streams", "-show_chapters", "-i", path};
31}
32
33std::shared_ptr<ffmpegkit::FFprobeSession> ffmpegkit::FFprobeKit::executeWithArguments(const std::list<std::string>& arguments) {
34 auto session = ffmpegkit::FFprobeSession::create(arguments);
36 return session;
37}
38
39std::shared_ptr<ffmpegkit::FFprobeSession> ffmpegkit::FFprobeKit::executeWithArgumentsAsync(const std::list<std::string>& arguments, FFprobeSessionCompleteCallback completeCallback) {
40 auto session = ffmpegkit::FFprobeSession::create(arguments, completeCallback);
42 return session;
43}
44
45std::shared_ptr<ffmpegkit::FFprobeSession> ffmpegkit::FFprobeKit::executeWithArgumentsAsync(const std::list<std::string>& arguments, FFprobeSessionCompleteCallback completeCallback, ffmpegkit::LogCallback logCallback) {
46 auto session = ffmpegkit::FFprobeSession::create(arguments, completeCallback, logCallback);
48 return session;
49}
50
51std::shared_ptr<ffmpegkit::FFprobeSession> ffmpegkit::FFprobeKit::execute(const std::string command) {
54 return session;
55}
56
57std::shared_ptr<ffmpegkit::FFprobeSession> ffmpegkit::FFprobeKit::executeAsync(const std::string command, FFprobeSessionCompleteCallback completeCallback) {
58 auto session = ffmpegkit::FFprobeSession::create(FFmpegKitConfig::parseArguments(command.c_str()), completeCallback);
60 return session;
61}
62
63std::shared_ptr<ffmpegkit::FFprobeSession> ffmpegkit::FFprobeKit::executeAsync(const std::string command, FFprobeSessionCompleteCallback completeCallback, ffmpegkit::LogCallback logCallback){
64 auto session = ffmpegkit::FFprobeSession::create(FFmpegKitConfig::parseArguments(command.c_str()), completeCallback, logCallback);
66 return session;
67}
68
69std::shared_ptr<ffmpegkit::MediaInformationSession> ffmpegkit::FFprobeKit::getMediaInformation(const std::string path) {
70 auto arguments = defaultGetMediaInformationCommandArguments(path);
71 auto session = ffmpegkit::MediaInformationSession::create(arguments);
73 return session;
74}
75
76std::shared_ptr<ffmpegkit::MediaInformationSession> ffmpegkit::FFprobeKit::getMediaInformation(const std::string path, const int waitTimeout) {
77 auto arguments = defaultGetMediaInformationCommandArguments(path);
78 auto session = ffmpegkit::MediaInformationSession::create(arguments);
80 return session;
81}
82
83std::shared_ptr<ffmpegkit::MediaInformationSession> ffmpegkit::FFprobeKit::getMediaInformationAsync(const std::string path, MediaInformationSessionCompleteCallback completeCallback) {
84 auto arguments = defaultGetMediaInformationCommandArguments(path);
85 auto session = ffmpegkit::MediaInformationSession::create(arguments, completeCallback);
87 return session;
88}
89
90std::shared_ptr<ffmpegkit::MediaInformationSession> ffmpegkit::FFprobeKit::getMediaInformationAsync(const std::string path, MediaInformationSessionCompleteCallback completeCallback, ffmpegkit::LogCallback logCallback, const int waitTimeout) {
91 auto arguments = defaultGetMediaInformationCommandArguments(path);
92 auto session = ffmpegkit::MediaInformationSession::create(arguments, completeCallback, logCallback);
94 return session;
95}
96
97std::shared_ptr<ffmpegkit::MediaInformationSession> ffmpegkit::FFprobeKit::getMediaInformationFromCommand(const std::string command) {
100 return session;
101}
102
103std::shared_ptr<std::list<std::shared_ptr<ffmpegkit::FFprobeSession>>> ffmpegkit::FFprobeKit::listFFprobeSessions() {
105}
106
107std::shared_ptr<std::list<std::shared_ptr<ffmpegkit::MediaInformationSession>>> ffmpegkit::FFprobeKit::listMediaInformationSessions() {
109}
static ffmpegkit::LogCallback logCallback
static std::list< std::string > defaultGetMediaInformationCommandArguments(const std::string &path)
Definition: FFprobeKit.cpp:29
const void * _ffprobeKitInitializer
Definition: FFprobeKit.cpp:27
void * ffmpegKitInitialize()
static constexpr int DefaultTimeoutForAsynchronousMessagesInTransmit
static std::shared_ptr< std::list< std::shared_ptr< ffmpegkit::MediaInformationSession > > > getMediaInformationSessions()
static std::shared_ptr< std::list< std::shared_ptr< ffmpegkit::FFprobeSession > > > getFFprobeSessions()
static void asyncFFprobeExecute(const std::shared_ptr< ffmpegkit::FFprobeSession > ffprobeSession)
static void asyncGetMediaInformationExecute(const std::shared_ptr< ffmpegkit::MediaInformationSession > mediaInformationSession, int waitTimeout)
static void getMediaInformationExecute(const std::shared_ptr< ffmpegkit::MediaInformationSession > mediaInformationSession, const int waitTimeout)
static std::list< std::string > parseArguments(const std::string &command)
static void ffprobeExecute(const std::shared_ptr< ffmpegkit::FFprobeSession > ffprobeSession)
static std::shared_ptr< std::list< std::shared_ptr< ffmpegkit::MediaInformationSession > > > listMediaInformationSessions()
Definition: FFprobeKit.cpp:107
static std::shared_ptr< ffmpegkit::MediaInformationSession > getMediaInformation(const std::string path)
Definition: FFprobeKit.cpp:69
static std::shared_ptr< ffmpegkit::FFprobeSession > executeWithArgumentsAsync(const std::list< std::string > &arguments, FFprobeSessionCompleteCallback completeCallback)
Definition: FFprobeKit.cpp:39
static std::shared_ptr< ffmpegkit::MediaInformationSession > getMediaInformationFromCommand(const std::string command)
Definition: FFprobeKit.cpp:97
static std::shared_ptr< ffmpegkit::FFprobeSession > executeAsync(const std::string command, FFprobeSessionCompleteCallback completeCallback)
Definition: FFprobeKit.cpp:57
static std::shared_ptr< ffmpegkit::FFprobeSession > executeWithArguments(const std::list< std::string > &arguments)
Definition: FFprobeKit.cpp:33
static std::shared_ptr< std::list< std::shared_ptr< ffmpegkit::FFprobeSession > > > listFFprobeSessions()
Definition: FFprobeKit.cpp:103
static std::shared_ptr< ffmpegkit::FFprobeSession > execute(const std::string command)
Definition: FFprobeKit.cpp:51
static std::shared_ptr< ffmpegkit::MediaInformationSession > getMediaInformationAsync(const std::string path, MediaInformationSessionCompleteCallback completeCallback)
Definition: FFprobeKit.cpp:83
static std::shared_ptr< ffmpegkit::FFprobeSession > create(const std::list< std::string > &arguments)
static std::shared_ptr< ffmpegkit::MediaInformationSession > create(const std::list< std::string > &arguments)
std::function< void(const std::shared_ptr< ffmpegkit::MediaInformationSession > session)> MediaInformationSessionCompleteCallback
std::function< void(const std::shared_ptr< ffmpegkit::Log > log)> LogCallback
Definition: LogCallback.h:35
std::function< void(const std::shared_ptr< ffmpegkit::FFprobeSession > session)> FFprobeSessionCompleteCallback