FFmpegKit Linux API 6.0
Loading...
Searching...
No Matches
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 "FFmpegKit.h"
21#include "FFmpegKitConfig.h"
22#include "FFprobeKit.h"
23
24extern void* ffmpegKitInitialize();
25
27
28static std::list<std::string> defaultGetMediaInformationCommandArguments(const std::string& path) {
29 return std::list<std::string>{"-v", "error", "-hide_banner", "-print_format", "json", "-show_format", "-show_streams", "-show_chapters", "-i", path};
30}
31
32std::shared_ptr<ffmpegkit::FFprobeSession> ffmpegkit::FFprobeKit::executeWithArguments(const std::list<std::string>& arguments) {
33 auto session = ffmpegkit::FFprobeSession::create(arguments);
35 return session;
36}
37
38std::shared_ptr<ffmpegkit::FFprobeSession> ffmpegkit::FFprobeKit::executeWithArgumentsAsync(const std::list<std::string>& arguments, FFprobeSessionCompleteCallback completeCallback) {
39 auto session = ffmpegkit::FFprobeSession::create(arguments, completeCallback);
41 return session;
42}
43
44std::shared_ptr<ffmpegkit::FFprobeSession> ffmpegkit::FFprobeKit::executeWithArgumentsAsync(const std::list<std::string>& arguments, FFprobeSessionCompleteCallback completeCallback, ffmpegkit::LogCallback logCallback) {
45 auto session = ffmpegkit::FFprobeSession::create(arguments, completeCallback, logCallback);
47 return session;
48}
49
50std::shared_ptr<ffmpegkit::FFprobeSession> ffmpegkit::FFprobeKit::execute(const std::string command) {
53 return session;
54}
55
56std::shared_ptr<ffmpegkit::FFprobeSession> ffmpegkit::FFprobeKit::executeAsync(const std::string command, FFprobeSessionCompleteCallback completeCallback) {
57 auto session = ffmpegkit::FFprobeSession::create(FFmpegKitConfig::parseArguments(command.c_str()), completeCallback);
59 return session;
60}
61
62std::shared_ptr<ffmpegkit::FFprobeSession> ffmpegkit::FFprobeKit::executeAsync(const std::string command, FFprobeSessionCompleteCallback completeCallback, ffmpegkit::LogCallback logCallback){
63 auto session = ffmpegkit::FFprobeSession::create(FFmpegKitConfig::parseArguments(command.c_str()), completeCallback, logCallback);
65 return session;
66}
67
68std::shared_ptr<ffmpegkit::MediaInformationSession> ffmpegkit::FFprobeKit::getMediaInformation(const std::string path) {
69 auto arguments = defaultGetMediaInformationCommandArguments(path);
70 auto session = ffmpegkit::MediaInformationSession::create(arguments);
72 return session;
73}
74
75std::shared_ptr<ffmpegkit::MediaInformationSession> ffmpegkit::FFprobeKit::getMediaInformation(const std::string path, const int waitTimeout) {
76 auto arguments = defaultGetMediaInformationCommandArguments(path);
77 auto session = ffmpegkit::MediaInformationSession::create(arguments);
79 return session;
80}
81
82std::shared_ptr<ffmpegkit::MediaInformationSession> ffmpegkit::FFprobeKit::getMediaInformationAsync(const std::string path, MediaInformationSessionCompleteCallback completeCallback) {
83 auto arguments = defaultGetMediaInformationCommandArguments(path);
84 auto session = ffmpegkit::MediaInformationSession::create(arguments, completeCallback);
86 return session;
87}
88
89std::shared_ptr<ffmpegkit::MediaInformationSession> ffmpegkit::FFprobeKit::getMediaInformationAsync(const std::string path, MediaInformationSessionCompleteCallback completeCallback, ffmpegkit::LogCallback logCallback, const int waitTimeout) {
90 auto arguments = defaultGetMediaInformationCommandArguments(path);
91 auto session = ffmpegkit::MediaInformationSession::create(arguments, completeCallback, logCallback);
93 return session;
94}
95
96std::shared_ptr<ffmpegkit::MediaInformationSession> ffmpegkit::FFprobeKit::getMediaInformationFromCommand(const std::string command) {
99 return session;
100}
101
102std::shared_ptr<std::list<std::shared_ptr<ffmpegkit::FFprobeSession>>> ffmpegkit::FFprobeKit::listFFprobeSessions() {
104}
105
106std::shared_ptr<std::list<std::shared_ptr<ffmpegkit::MediaInformationSession>>> ffmpegkit::FFprobeKit::listMediaInformationSessions() {
108}
static ffmpegkit::LogCallback logCallback
static std::list< std::string > defaultGetMediaInformationCommandArguments(const std::string &path)
const void * _ffprobeKitInitializer
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()
static std::shared_ptr< ffmpegkit::MediaInformationSession > getMediaInformation(const std::string path)
static std::shared_ptr< ffmpegkit::FFprobeSession > executeWithArgumentsAsync(const std::list< std::string > &arguments, FFprobeSessionCompleteCallback completeCallback)
static std::shared_ptr< ffmpegkit::MediaInformationSession > getMediaInformationFromCommand(const std::string command)
static std::shared_ptr< ffmpegkit::FFprobeSession > executeAsync(const std::string command, FFprobeSessionCompleteCallback completeCallback)
static std::shared_ptr< ffmpegkit::FFprobeSession > executeWithArguments(const std::list< std::string > &arguments)
static std::shared_ptr< std::list< std::shared_ptr< ffmpegkit::FFprobeSession > > > listFFprobeSessions()
static std::shared_ptr< ffmpegkit::FFprobeSession > execute(const std::string command)
static std::shared_ptr< ffmpegkit::MediaInformationSession > getMediaInformationAsync(const std::string path, MediaInformationSessionCompleteCallback completeCallback)
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