refactor session create methods

This commit is contained in:
Taner Sener 2022-08-24 01:57:40 +01:00
parent eac6cd5a06
commit 99bd946030
19 changed files with 200 additions and 208 deletions

View File

@ -115,7 +115,7 @@ public abstract class AbstractSession implements Session {
* @param logCallback session specific log callback * @param logCallback session specific log callback
* @param logRedirectionStrategy session specific log redirection strategy * @param logRedirectionStrategy session specific log redirection strategy
*/ */
public AbstractSession(final String[] arguments, protected AbstractSession(final String[] arguments,
final LogCallback logCallback, final LogCallback logCallback,
final LogRedirectionStrategy logRedirectionStrategy) { final LogRedirectionStrategy logRedirectionStrategy) {
this.sessionId = sessionIdGenerator.getAndIncrement(); this.sessionId = sessionIdGenerator.getAndIncrement();

View File

@ -55,7 +55,7 @@ public class FFmpegKit {
* @return FFmpeg session created for this execution * @return FFmpeg session created for this execution
*/ */
public static FFmpegSession executeWithArguments(final String[] arguments) { public static FFmpegSession executeWithArguments(final String[] arguments) {
final FFmpegSession session = new FFmpegSession(arguments); final FFmpegSession session = FFmpegSession.create(arguments);
FFmpegKitConfig.ffmpegExecute(session); FFmpegKitConfig.ffmpegExecute(session);
@ -75,7 +75,7 @@ public class FFmpegKit {
*/ */
public static FFmpegSession executeWithArgumentsAsync(final String[] arguments, public static FFmpegSession executeWithArgumentsAsync(final String[] arguments,
final FFmpegSessionCompleteCallback completeCallback) { final FFmpegSessionCompleteCallback completeCallback) {
final FFmpegSession session = new FFmpegSession(arguments, completeCallback); final FFmpegSession session = FFmpegSession.create(arguments, completeCallback);
FFmpegKitConfig.asyncFFmpegExecute(session); FFmpegKitConfig.asyncFFmpegExecute(session);
@ -99,7 +99,7 @@ public class FFmpegKit {
final FFmpegSessionCompleteCallback completeCallback, final FFmpegSessionCompleteCallback completeCallback,
final LogCallback logCallback, final LogCallback logCallback,
final StatisticsCallback statisticsCallback) { final StatisticsCallback statisticsCallback) {
final FFmpegSession session = new FFmpegSession(arguments, completeCallback, logCallback, statisticsCallback); final FFmpegSession session = FFmpegSession.create(arguments, completeCallback, logCallback, statisticsCallback);
FFmpegKitConfig.asyncFFmpegExecute(session); FFmpegKitConfig.asyncFFmpegExecute(session);
@ -121,7 +121,7 @@ public class FFmpegKit {
public static FFmpegSession executeWithArgumentsAsync(final String[] arguments, public static FFmpegSession executeWithArgumentsAsync(final String[] arguments,
final FFmpegSessionCompleteCallback completeCallback, final FFmpegSessionCompleteCallback completeCallback,
final ExecutorService executorService) { final ExecutorService executorService) {
final FFmpegSession session = new FFmpegSession(arguments, completeCallback); final FFmpegSession session = FFmpegSession.create(arguments, completeCallback);
FFmpegKitConfig.asyncFFmpegExecute(session, executorService); FFmpegKitConfig.asyncFFmpegExecute(session, executorService);
@ -148,7 +148,7 @@ public class FFmpegKit {
final LogCallback logCallback, final LogCallback logCallback,
final StatisticsCallback statisticsCallback, final StatisticsCallback statisticsCallback,
final ExecutorService executorService) { final ExecutorService executorService) {
final FFmpegSession session = new FFmpegSession(arguments, completeCallback, logCallback, statisticsCallback); final FFmpegSession session = FFmpegSession.create(arguments, completeCallback, logCallback, statisticsCallback);
FFmpegKitConfig.asyncFFmpegExecute(session, executorService); FFmpegKitConfig.asyncFFmpegExecute(session, executorService);
@ -224,7 +224,7 @@ public class FFmpegKit {
public static FFmpegSession executeAsync(final String command, public static FFmpegSession executeAsync(final String command,
final FFmpegSessionCompleteCallback completeCallback, final FFmpegSessionCompleteCallback completeCallback,
final ExecutorService executorService) { final ExecutorService executorService) {
final FFmpegSession session = new FFmpegSession(FFmpegKitConfig.parseArguments(command), completeCallback); final FFmpegSession session = FFmpegSession.create(FFmpegKitConfig.parseArguments(command), completeCallback);
FFmpegKitConfig.asyncFFmpegExecute(session, executorService); FFmpegKitConfig.asyncFFmpegExecute(session, executorService);
@ -252,7 +252,7 @@ public class FFmpegKit {
final LogCallback logCallback, final LogCallback logCallback,
final StatisticsCallback statisticsCallback, final StatisticsCallback statisticsCallback,
final ExecutorService executorService) { final ExecutorService executorService) {
final FFmpegSession session = new FFmpegSession(FFmpegKitConfig.parseArguments(command), completeCallback, logCallback, statisticsCallback); final FFmpegSession session = FFmpegSession.create(FFmpegKitConfig.parseArguments(command), completeCallback, logCallback, statisticsCallback);
FFmpegKitConfig.asyncFFmpegExecute(session, executorService); FFmpegKitConfig.asyncFFmpegExecute(session, executorService);

View File

@ -52,8 +52,8 @@ public class FFmpegSession extends AbstractSession implements Session {
* *
* @param arguments command arguments * @param arguments command arguments
*/ */
public FFmpegSession(final String[] arguments) { public static FFmpegSession create(final String[] arguments) {
this(arguments, null); return new FFmpegSession(arguments, null, null, null, FFmpegKitConfig.getLogRedirectionStrategy());
} }
/** /**
@ -62,8 +62,8 @@ public class FFmpegSession extends AbstractSession implements Session {
* @param arguments command arguments * @param arguments command arguments
* @param completeCallback session specific complete callback * @param completeCallback session specific complete callback
*/ */
public FFmpegSession(final String[] arguments, final FFmpegSessionCompleteCallback completeCallback) { public static FFmpegSession create(final String[] arguments, final FFmpegSessionCompleteCallback completeCallback) {
this(arguments, completeCallback, null, null); return new FFmpegSession(arguments, completeCallback, null, null, FFmpegKitConfig.getLogRedirectionStrategy());
} }
/** /**
@ -74,11 +74,11 @@ public class FFmpegSession extends AbstractSession implements Session {
* @param logCallback session specific log callback * @param logCallback session specific log callback
* @param statisticsCallback session specific statistics callback * @param statisticsCallback session specific statistics callback
*/ */
public FFmpegSession(final String[] arguments, public static FFmpegSession create(final String[] arguments,
final FFmpegSessionCompleteCallback completeCallback, final FFmpegSessionCompleteCallback completeCallback,
final LogCallback logCallback, final LogCallback logCallback,
final StatisticsCallback statisticsCallback) { final StatisticsCallback statisticsCallback) {
this(arguments, completeCallback, logCallback, statisticsCallback, FFmpegKitConfig.getLogRedirectionStrategy()); return new FFmpegSession(arguments, completeCallback, logCallback, statisticsCallback, FFmpegKitConfig.getLogRedirectionStrategy());
} }
/** /**
@ -90,7 +90,24 @@ public class FFmpegSession extends AbstractSession implements Session {
* @param statisticsCallback session specific statistics callback * @param statisticsCallback session specific statistics callback
* @param logRedirectionStrategy session specific log redirection strategy * @param logRedirectionStrategy session specific log redirection strategy
*/ */
public FFmpegSession(final String[] arguments, public static FFmpegSession create(final String[] arguments,
final FFmpegSessionCompleteCallback completeCallback,
final LogCallback logCallback,
final StatisticsCallback statisticsCallback,
final LogRedirectionStrategy logRedirectionStrategy) {
return new FFmpegSession(arguments, completeCallback, logCallback, statisticsCallback, logRedirectionStrategy);
}
/**
* Builds a new FFmpeg session.
*
* @param arguments command arguments
* @param completeCallback session specific complete callback
* @param logCallback session specific log callback
* @param statisticsCallback session specific statistics callback
* @param logRedirectionStrategy session specific log redirection strategy
*/
private FFmpegSession(final String[] arguments,
final FFmpegSessionCompleteCallback completeCallback, final FFmpegSessionCompleteCallback completeCallback,
final LogCallback logCallback, final LogCallback logCallback,
final StatisticsCallback statisticsCallback, final StatisticsCallback statisticsCallback,

View File

@ -69,7 +69,7 @@ public class FFprobeKit {
* @return FFprobe session created for this execution * @return FFprobe session created for this execution
*/ */
public static FFprobeSession executeWithArguments(final String[] arguments) { public static FFprobeSession executeWithArguments(final String[] arguments) {
final FFprobeSession session = new FFprobeSession(arguments); final FFprobeSession session = FFprobeSession.create(arguments);
FFmpegKitConfig.ffprobeExecute(session); FFmpegKitConfig.ffprobeExecute(session);
@ -89,7 +89,7 @@ public class FFprobeKit {
*/ */
public static FFprobeSession executeWithArgumentsAsync(final String[] arguments, public static FFprobeSession executeWithArgumentsAsync(final String[] arguments,
final FFprobeSessionCompleteCallback completeCallback) { final FFprobeSessionCompleteCallback completeCallback) {
final FFprobeSession session = new FFprobeSession(arguments, completeCallback); final FFprobeSession session = FFprobeSession.create(arguments, completeCallback);
FFmpegKitConfig.asyncFFprobeExecute(session); FFmpegKitConfig.asyncFFprobeExecute(session);
@ -111,7 +111,7 @@ public class FFprobeKit {
public static FFprobeSession executeWithArgumentsAsync(final String[] arguments, public static FFprobeSession executeWithArgumentsAsync(final String[] arguments,
final FFprobeSessionCompleteCallback completeCallback, final FFprobeSessionCompleteCallback completeCallback,
final LogCallback logCallback) { final LogCallback logCallback) {
final FFprobeSession session = new FFprobeSession(arguments, completeCallback, logCallback); final FFprobeSession session = FFprobeSession.create(arguments, completeCallback, logCallback);
FFmpegKitConfig.asyncFFprobeExecute(session); FFmpegKitConfig.asyncFFprobeExecute(session);
@ -133,7 +133,7 @@ public class FFprobeKit {
public static FFprobeSession executeWithArgumentsAsync(final String[] arguments, public static FFprobeSession executeWithArgumentsAsync(final String[] arguments,
final FFprobeSessionCompleteCallback completeCallback, final FFprobeSessionCompleteCallback completeCallback,
final ExecutorService executorService) { final ExecutorService executorService) {
final FFprobeSession session = new FFprobeSession(arguments, completeCallback); final FFprobeSession session = FFprobeSession.create(arguments, completeCallback);
FFmpegKitConfig.asyncFFprobeExecute(session, executorService); FFmpegKitConfig.asyncFFprobeExecute(session, executorService);
@ -157,7 +157,7 @@ public class FFprobeKit {
final FFprobeSessionCompleteCallback completeCallback, final FFprobeSessionCompleteCallback completeCallback,
final LogCallback logCallback, final LogCallback logCallback,
final ExecutorService executorService) { final ExecutorService executorService) {
final FFprobeSession session = new FFprobeSession(arguments, completeCallback, logCallback); final FFprobeSession session = FFprobeSession.create(arguments, completeCallback, logCallback);
FFmpegKitConfig.asyncFFprobeExecute(session, executorService); FFmpegKitConfig.asyncFFprobeExecute(session, executorService);
@ -231,7 +231,7 @@ public class FFprobeKit {
public static FFprobeSession executeAsync(final String command, public static FFprobeSession executeAsync(final String command,
final FFprobeSessionCompleteCallback completeCallback, final FFprobeSessionCompleteCallback completeCallback,
final ExecutorService executorService) { final ExecutorService executorService) {
final FFprobeSession session = new FFprobeSession(FFmpegKitConfig.parseArguments(command), completeCallback); final FFprobeSession session = FFprobeSession.create(FFmpegKitConfig.parseArguments(command), completeCallback);
FFmpegKitConfig.asyncFFprobeExecute(session, executorService); FFmpegKitConfig.asyncFFprobeExecute(session, executorService);
@ -257,7 +257,7 @@ public class FFprobeKit {
final FFprobeSessionCompleteCallback completeCallback, final FFprobeSessionCompleteCallback completeCallback,
final LogCallback logCallback, final LogCallback logCallback,
final ExecutorService executorService) { final ExecutorService executorService) {
final FFprobeSession session = new FFprobeSession(FFmpegKitConfig.parseArguments(command), completeCallback, logCallback); final FFprobeSession session = FFprobeSession.create(FFmpegKitConfig.parseArguments(command), completeCallback, logCallback);
FFmpegKitConfig.asyncFFprobeExecute(session, executorService); FFmpegKitConfig.asyncFFprobeExecute(session, executorService);
@ -271,7 +271,7 @@ public class FFprobeKit {
* @return media information session created for this execution * @return media information session created for this execution
*/ */
public static MediaInformationSession getMediaInformation(final String path) { public static MediaInformationSession getMediaInformation(final String path) {
final MediaInformationSession session = new MediaInformationSession(defaultGetMediaInformationCommandArguments(path)); final MediaInformationSession session = MediaInformationSession.create(defaultGetMediaInformationCommandArguments(path));
FFmpegKitConfig.getMediaInformationExecute(session, AbstractSession.DEFAULT_TIMEOUT_FOR_ASYNCHRONOUS_MESSAGES_IN_TRANSMIT); FFmpegKitConfig.getMediaInformationExecute(session, AbstractSession.DEFAULT_TIMEOUT_FOR_ASYNCHRONOUS_MESSAGES_IN_TRANSMIT);
@ -287,7 +287,7 @@ public class FFprobeKit {
*/ */
public static MediaInformationSession getMediaInformation(final String path, public static MediaInformationSession getMediaInformation(final String path,
final int waitTimeout) { final int waitTimeout) {
final MediaInformationSession session = new MediaInformationSession(defaultGetMediaInformationCommandArguments(path)); final MediaInformationSession session = MediaInformationSession.create(defaultGetMediaInformationCommandArguments(path));
FFmpegKitConfig.getMediaInformationExecute(session, waitTimeout); FFmpegKitConfig.getMediaInformationExecute(session, waitTimeout);
@ -308,7 +308,7 @@ public class FFprobeKit {
*/ */
public static MediaInformationSession getMediaInformationAsync(final String path, public static MediaInformationSession getMediaInformationAsync(final String path,
final MediaInformationSessionCompleteCallback completeCallback) { final MediaInformationSessionCompleteCallback completeCallback) {
final MediaInformationSession session = new MediaInformationSession(defaultGetMediaInformationCommandArguments(path), completeCallback); final MediaInformationSession session = MediaInformationSession.create(defaultGetMediaInformationCommandArguments(path), completeCallback);
FFmpegKitConfig.asyncGetMediaInformationExecute(session, AbstractSession.DEFAULT_TIMEOUT_FOR_ASYNCHRONOUS_MESSAGES_IN_TRANSMIT); FFmpegKitConfig.asyncGetMediaInformationExecute(session, AbstractSession.DEFAULT_TIMEOUT_FOR_ASYNCHRONOUS_MESSAGES_IN_TRANSMIT);
@ -333,7 +333,7 @@ public class FFprobeKit {
final MediaInformationSessionCompleteCallback completeCallback, final MediaInformationSessionCompleteCallback completeCallback,
final LogCallback logCallback, final LogCallback logCallback,
final int waitTimeout) { final int waitTimeout) {
final MediaInformationSession session = new MediaInformationSession(defaultGetMediaInformationCommandArguments(path), completeCallback, logCallback); final MediaInformationSession session = MediaInformationSession.create(defaultGetMediaInformationCommandArguments(path), completeCallback, logCallback);
FFmpegKitConfig.asyncGetMediaInformationExecute(session, waitTimeout); FFmpegKitConfig.asyncGetMediaInformationExecute(session, waitTimeout);
@ -356,7 +356,7 @@ public class FFprobeKit {
public static MediaInformationSession getMediaInformationAsync(final String path, public static MediaInformationSession getMediaInformationAsync(final String path,
final MediaInformationSessionCompleteCallback completeCallback, final MediaInformationSessionCompleteCallback completeCallback,
final ExecutorService executorService) { final ExecutorService executorService) {
final MediaInformationSession session = new MediaInformationSession(defaultGetMediaInformationCommandArguments(path), completeCallback); final MediaInformationSession session = MediaInformationSession.create(defaultGetMediaInformationCommandArguments(path), completeCallback);
FFmpegKitConfig.asyncGetMediaInformationExecute(session, executorService, AbstractSession.DEFAULT_TIMEOUT_FOR_ASYNCHRONOUS_MESSAGES_IN_TRANSMIT); FFmpegKitConfig.asyncGetMediaInformationExecute(session, executorService, AbstractSession.DEFAULT_TIMEOUT_FOR_ASYNCHRONOUS_MESSAGES_IN_TRANSMIT);
@ -383,7 +383,7 @@ public class FFprobeKit {
final LogCallback logCallback, final LogCallback logCallback,
final ExecutorService executorService, final ExecutorService executorService,
final int waitTimeout) { final int waitTimeout) {
final MediaInformationSession session = new MediaInformationSession(defaultGetMediaInformationCommandArguments(path), completeCallback, logCallback); final MediaInformationSession session = MediaInformationSession.create(defaultGetMediaInformationCommandArguments(path), completeCallback, logCallback);
FFmpegKitConfig.asyncGetMediaInformationExecute(session, executorService, waitTimeout); FFmpegKitConfig.asyncGetMediaInformationExecute(session, executorService, waitTimeout);
@ -397,7 +397,7 @@ public class FFprobeKit {
* @return media information session created for this execution * @return media information session created for this execution
*/ */
public static MediaInformationSession getMediaInformationFromCommand(final String command) { public static MediaInformationSession getMediaInformationFromCommand(final String command) {
final MediaInformationSession session = new MediaInformationSession(FFmpegKitConfig.parseArguments(command)); final MediaInformationSession session = MediaInformationSession.create(FFmpegKitConfig.parseArguments(command));
FFmpegKitConfig.getMediaInformationExecute(session, AbstractSession.DEFAULT_TIMEOUT_FOR_ASYNCHRONOUS_MESSAGES_IN_TRANSMIT); FFmpegKitConfig.getMediaInformationExecute(session, AbstractSession.DEFAULT_TIMEOUT_FOR_ASYNCHRONOUS_MESSAGES_IN_TRANSMIT);
@ -447,7 +447,7 @@ public class FFprobeKit {
final MediaInformationSessionCompleteCallback completeCallback, final MediaInformationSessionCompleteCallback completeCallback,
final LogCallback logCallback, final LogCallback logCallback,
final int waitTimeout) { final int waitTimeout) {
final MediaInformationSession session = new MediaInformationSession(arguments, completeCallback, logCallback); final MediaInformationSession session = MediaInformationSession.create(arguments, completeCallback, logCallback);
FFmpegKitConfig.asyncGetMediaInformationExecute(session, waitTimeout); FFmpegKitConfig.asyncGetMediaInformationExecute(session, waitTimeout);

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2020-2021 Taner Sener * Copyright (c) 2020-2022 Taner Sener
* *
* This file is part of FFmpegKit. * This file is part of FFmpegKit.
* *
@ -34,8 +34,8 @@ public class FFprobeSession extends AbstractSession implements Session {
* *
* @param arguments command arguments * @param arguments command arguments
*/ */
public FFprobeSession(final String[] arguments) { public static FFprobeSession create(final String[] arguments) {
this(arguments, null); return new FFprobeSession(arguments, null, null, FFmpegKitConfig.getLogRedirectionStrategy());
} }
/** /**
@ -44,8 +44,8 @@ public class FFprobeSession extends AbstractSession implements Session {
* @param arguments command arguments * @param arguments command arguments
* @param completeCallback session specific complete callback * @param completeCallback session specific complete callback
*/ */
public FFprobeSession(final String[] arguments, final FFprobeSessionCompleteCallback completeCallback) { public static FFprobeSession create(final String[] arguments, final FFprobeSessionCompleteCallback completeCallback) {
this(arguments, completeCallback, null); return new FFprobeSession(arguments, completeCallback, null, FFmpegKitConfig.getLogRedirectionStrategy());
} }
/** /**
@ -55,10 +55,10 @@ public class FFprobeSession extends AbstractSession implements Session {
* @param completeCallback session specific complete callback * @param completeCallback session specific complete callback
* @param logCallback session specific log callback * @param logCallback session specific log callback
*/ */
public FFprobeSession(final String[] arguments, public static FFprobeSession create(final String[] arguments,
final FFprobeSessionCompleteCallback completeCallback, final FFprobeSessionCompleteCallback completeCallback,
final LogCallback logCallback) { final LogCallback logCallback) {
this(arguments, completeCallback, logCallback, FFmpegKitConfig.getLogRedirectionStrategy()); return new FFprobeSession(arguments, completeCallback, logCallback, FFmpegKitConfig.getLogRedirectionStrategy());
} }
/** /**
@ -69,7 +69,22 @@ public class FFprobeSession extends AbstractSession implements Session {
* @param logCallback session specific log callback * @param logCallback session specific log callback
* @param logRedirectionStrategy session specific log redirection strategy * @param logRedirectionStrategy session specific log redirection strategy
*/ */
public FFprobeSession(final String[] arguments, public static FFprobeSession create(final String[] arguments,
final FFprobeSessionCompleteCallback completeCallback,
final LogCallback logCallback,
final LogRedirectionStrategy logRedirectionStrategy) {
return new FFprobeSession(arguments, completeCallback, logCallback, logRedirectionStrategy);
}
/**
* Builds a new FFprobe session.
*
* @param arguments command arguments
* @param completeCallback session specific complete callback
* @param logCallback session specific log callback
* @param logRedirectionStrategy session specific log redirection strategy
*/
private FFprobeSession(final String[] arguments,
final FFprobeSessionCompleteCallback completeCallback, final FFprobeSessionCompleteCallback completeCallback,
final LogCallback logCallback, final LogCallback logCallback,
final LogRedirectionStrategy logRedirectionStrategy) { final LogRedirectionStrategy logRedirectionStrategy) {

View File

@ -40,8 +40,8 @@ public class MediaInformationSession extends AbstractSession implements Session
* *
* @param arguments command arguments * @param arguments command arguments
*/ */
public MediaInformationSession(final String[] arguments) { public static MediaInformationSession create(final String[] arguments) {
this(arguments, null); return new MediaInformationSession(arguments, null, null);
} }
/** /**
@ -50,8 +50,8 @@ public class MediaInformationSession extends AbstractSession implements Session
* @param arguments command arguments * @param arguments command arguments
* @param completeCallback session specific complete callback * @param completeCallback session specific complete callback
*/ */
public MediaInformationSession(final String[] arguments, final MediaInformationSessionCompleteCallback completeCallback) { public static MediaInformationSession create(final String[] arguments, final MediaInformationSessionCompleteCallback completeCallback) {
this(arguments, completeCallback, null); return new MediaInformationSession(arguments, completeCallback, null);
} }
/** /**
@ -61,7 +61,18 @@ public class MediaInformationSession extends AbstractSession implements Session
* @param completeCallback session specific complete callback * @param completeCallback session specific complete callback
* @param logCallback session specific log callback * @param logCallback session specific log callback
*/ */
public MediaInformationSession(final String[] arguments, final MediaInformationSessionCompleteCallback completeCallback, final LogCallback logCallback) { public static MediaInformationSession create(final String[] arguments, final MediaInformationSessionCompleteCallback completeCallback, final LogCallback logCallback) {
return new MediaInformationSession(arguments, completeCallback, logCallback);
}
/**
* Creates a new media information session.
*
* @param arguments command arguments
* @param completeCallback session specific complete callback
* @param logCallback session specific log callback
*/
private MediaInformationSession(final String[] arguments, final MediaInformationSessionCompleteCallback completeCallback, final LogCallback logCallback) {
super(arguments, logCallback, LogRedirectionStrategy.NEVER_PRINT_LOGS); super(arguments, logCallback, LogRedirectionStrategy.NEVER_PRINT_LOGS);
this.completeCallback = completeCallback; this.completeCallback = completeCallback;

View File

@ -175,14 +175,14 @@ public class FFmpegKitConfigTest {
FFmpegKitConfig.setSessionHistorySize(newSize); FFmpegKitConfig.setSessionHistorySize(newSize);
for (int i = 1; i <= (newSize + 5); i++) { for (int i = 1; i <= (newSize + 5); i++) {
new FFmpegSession(TEST_ARGUMENTS); FFmpegSession.create(TEST_ARGUMENTS);
Assert.assertTrue(FFmpegKitConfig.getSessions().size() <= newSize); Assert.assertTrue(FFmpegKitConfig.getSessions().size() <= newSize);
} }
newSize = 3; newSize = 3;
FFmpegKitConfig.setSessionHistorySize(newSize); FFmpegKitConfig.setSessionHistorySize(newSize);
for (int i = 1; i <= (newSize + 5); i++) { for (int i = 1; i <= (newSize + 5); i++) {
new FFmpegSession(TEST_ARGUMENTS); FFmpegSession.create(TEST_ARGUMENTS);
Assert.assertTrue(FFmpegKitConfig.getSessions().size() <= newSize); Assert.assertTrue(FFmpegKitConfig.getSessions().size() <= newSize);
} }
} }

View File

@ -30,7 +30,7 @@ public class FFmpegSessionTest {
@Test @Test
public void constructorTest() { public void constructorTest() {
FFmpegSession ffmpegSession = new FFmpegSession(TEST_ARGUMENTS); FFmpegSession ffmpegSession = FFmpegSession.create(TEST_ARGUMENTS);
// 1. getCompleteCallback // 1. getCompleteCallback
Assert.assertNull(ffmpegSession.getCompleteCallback()); Assert.assertNull(ffmpegSession.getCompleteCallback());
@ -100,7 +100,7 @@ public class FFmpegSessionTest {
} }
}; };
FFmpegSession ffmpegSession = new FFmpegSession(TEST_ARGUMENTS, completeCallback); FFmpegSession ffmpegSession = FFmpegSession.create(TEST_ARGUMENTS, completeCallback);
// 1. getCompleteCallback // 1. getCompleteCallback
Assert.assertEquals(ffmpegSession.getCompleteCallback(), completeCallback); Assert.assertEquals(ffmpegSession.getCompleteCallback(), completeCallback);
@ -184,7 +184,7 @@ public class FFmpegSessionTest {
} }
}; };
FFmpegSession ffmpegSession = new FFmpegSession(TEST_ARGUMENTS, completeCallback, logCallback, statisticsCallback); FFmpegSession ffmpegSession = FFmpegSession.create(TEST_ARGUMENTS, completeCallback, logCallback, statisticsCallback);
// 1. getCompleteCallback // 1. getCompleteCallback
Assert.assertEquals(ffmpegSession.getCompleteCallback(), completeCallback); Assert.assertEquals(ffmpegSession.getCompleteCallback(), completeCallback);
@ -247,9 +247,9 @@ public class FFmpegSessionTest {
@Test @Test
public void getSessionIdTest() { public void getSessionIdTest() {
FFmpegSession ffmpegSession1 = new FFmpegSession(TEST_ARGUMENTS); FFmpegSession ffmpegSession1 = FFmpegSession.create(TEST_ARGUMENTS);
FFmpegSession ffmpegSession2 = new FFmpegSession(TEST_ARGUMENTS); FFmpegSession ffmpegSession2 = FFmpegSession.create(TEST_ARGUMENTS);
FFmpegSession ffmpegSession3 = new FFmpegSession(TEST_ARGUMENTS); FFmpegSession ffmpegSession3 = FFmpegSession.create(TEST_ARGUMENTS);
Assert.assertTrue(ffmpegSession3.getSessionId() > ffmpegSession2.getSessionId()); Assert.assertTrue(ffmpegSession3.getSessionId() > ffmpegSession2.getSessionId());
Assert.assertTrue(ffmpegSession3.getSessionId() > ffmpegSession1.getSessionId()); Assert.assertTrue(ffmpegSession3.getSessionId() > ffmpegSession1.getSessionId());
@ -262,7 +262,7 @@ public class FFmpegSessionTest {
@Test @Test
public void getLogs() { public void getLogs() {
final FFmpegSession ffmpegSession = new FFmpegSession(TEST_ARGUMENTS); final FFmpegSession ffmpegSession = FFmpegSession.create(TEST_ARGUMENTS);
String logMessage1 = "i am log one"; String logMessage1 = "i am log one";
String logMessage2 = "i am log two"; String logMessage2 = "i am log two";
@ -279,7 +279,7 @@ public class FFmpegSessionTest {
@Test @Test
public void getLogsAsStringTest() { public void getLogsAsStringTest() {
final FFmpegSession ffmpegSession = new FFmpegSession(TEST_ARGUMENTS); final FFmpegSession ffmpegSession = FFmpegSession.create(TEST_ARGUMENTS);
String logMessage1 = "i am log one"; String logMessage1 = "i am log one";
String logMessage2 = "i am log two"; String logMessage2 = "i am log two";
@ -296,18 +296,18 @@ public class FFmpegSessionTest {
public void getLogRedirectionStrategy() { public void getLogRedirectionStrategy() {
FFmpegKitConfig.setLogRedirectionStrategy(LogRedirectionStrategy.NEVER_PRINT_LOGS); FFmpegKitConfig.setLogRedirectionStrategy(LogRedirectionStrategy.NEVER_PRINT_LOGS);
final FFmpegSession ffmpegSession1 = new FFmpegSession(TEST_ARGUMENTS); final FFmpegSession ffmpegSession1 = FFmpegSession.create(TEST_ARGUMENTS);
Assert.assertEquals(FFmpegKitConfig.getLogRedirectionStrategy(), ffmpegSession1.getLogRedirectionStrategy()); Assert.assertEquals(FFmpegKitConfig.getLogRedirectionStrategy(), ffmpegSession1.getLogRedirectionStrategy());
FFmpegKitConfig.setLogRedirectionStrategy(LogRedirectionStrategy.PRINT_LOGS_WHEN_SESSION_CALLBACK_NOT_DEFINED); FFmpegKitConfig.setLogRedirectionStrategy(LogRedirectionStrategy.PRINT_LOGS_WHEN_SESSION_CALLBACK_NOT_DEFINED);
final FFmpegSession ffmpegSession2 = new FFmpegSession(TEST_ARGUMENTS); final FFmpegSession ffmpegSession2 = FFmpegSession.create(TEST_ARGUMENTS);
Assert.assertEquals(FFmpegKitConfig.getLogRedirectionStrategy(), ffmpegSession2.getLogRedirectionStrategy()); Assert.assertEquals(FFmpegKitConfig.getLogRedirectionStrategy(), ffmpegSession2.getLogRedirectionStrategy());
} }
@Test @Test
public void startRunningTest() { public void startRunningTest() {
FFmpegSession ffmpegSession = new FFmpegSession(TEST_ARGUMENTS); FFmpegSession ffmpegSession = FFmpegSession.create(TEST_ARGUMENTS);
ffmpegSession.startRunning(); ffmpegSession.startRunning();
@ -318,7 +318,7 @@ public class FFmpegSessionTest {
@Test @Test
public void completeTest() { public void completeTest() {
FFmpegSession ffmpegSession = new FFmpegSession(TEST_ARGUMENTS); FFmpegSession ffmpegSession = FFmpegSession.create(TEST_ARGUMENTS);
ffmpegSession.startRunning(); ffmpegSession.startRunning();
ffmpegSession.complete(new ReturnCode(100)); ffmpegSession.complete(new ReturnCode(100));
@ -331,7 +331,7 @@ public class FFmpegSessionTest {
@Test @Test
public void failTest() { public void failTest() {
FFmpegSession ffmpegSession = new FFmpegSession(TEST_ARGUMENTS); FFmpegSession ffmpegSession = FFmpegSession.create(TEST_ARGUMENTS);
ffmpegSession.startRunning(); ffmpegSession.startRunning();
ffmpegSession.fail(new Exception("")); ffmpegSession.fail(new Exception(""));

View File

@ -30,7 +30,7 @@ public class FFprobeSessionTest {
@Test @Test
public void constructorTest() { public void constructorTest() {
FFprobeSession ffprobeSession = new FFprobeSession(TEST_ARGUMENTS); FFprobeSession ffprobeSession = FFprobeSession.create(TEST_ARGUMENTS);
// 1. getCompleteCallback // 1. getCompleteCallback
Assert.assertNull(ffprobeSession.getCompleteCallback()); Assert.assertNull(ffprobeSession.getCompleteCallback());
@ -97,7 +97,7 @@ public class FFprobeSessionTest {
} }
}; };
FFprobeSession ffprobeSession = new FFprobeSession(TEST_ARGUMENTS, completeCallback); FFprobeSession ffprobeSession = FFprobeSession.create(TEST_ARGUMENTS, completeCallback);
// 1. getCompleteCallback // 1. getCompleteCallback
Assert.assertEquals(ffprobeSession.getCompleteCallback(), completeCallback); Assert.assertEquals(ffprobeSession.getCompleteCallback(), completeCallback);
@ -171,7 +171,7 @@ public class FFprobeSessionTest {
} }
}; };
FFprobeSession ffprobeSession = new FFprobeSession(TEST_ARGUMENTS, completeCallback, logCallback); FFprobeSession ffprobeSession = FFprobeSession.create(TEST_ARGUMENTS, completeCallback, logCallback);
// 1. getCompleteCallback // 1. getCompleteCallback
Assert.assertEquals(ffprobeSession.getCompleteCallback(), completeCallback); Assert.assertEquals(ffprobeSession.getCompleteCallback(), completeCallback);
@ -231,9 +231,9 @@ public class FFprobeSessionTest {
@Test @Test
public void getSessionIdTest() { public void getSessionIdTest() {
FFprobeSession ffprobeSession1 = new FFprobeSession(TEST_ARGUMENTS); FFprobeSession ffprobeSession1 = FFprobeSession.create(TEST_ARGUMENTS);
FFprobeSession ffprobeSession2 = new FFprobeSession(TEST_ARGUMENTS); FFprobeSession ffprobeSession2 = FFprobeSession.create(TEST_ARGUMENTS);
FFprobeSession ffprobeSession3 = new FFprobeSession(TEST_ARGUMENTS); FFprobeSession ffprobeSession3 = FFprobeSession.create(TEST_ARGUMENTS);
Assert.assertTrue(ffprobeSession3.getSessionId() > ffprobeSession2.getSessionId()); Assert.assertTrue(ffprobeSession3.getSessionId() > ffprobeSession2.getSessionId());
Assert.assertTrue(ffprobeSession3.getSessionId() > ffprobeSession1.getSessionId()); Assert.assertTrue(ffprobeSession3.getSessionId() > ffprobeSession1.getSessionId());
@ -246,7 +246,7 @@ public class FFprobeSessionTest {
@Test @Test
public void getLogs() { public void getLogs() {
final FFprobeSession ffprobeSession = new FFprobeSession(TEST_ARGUMENTS); final FFprobeSession ffprobeSession = FFprobeSession.create(TEST_ARGUMENTS);
String logMessage1 = "i am log one"; String logMessage1 = "i am log one";
String logMessage2 = "i am log two"; String logMessage2 = "i am log two";
@ -263,7 +263,7 @@ public class FFprobeSessionTest {
@Test @Test
public void getLogsAsStringTest() { public void getLogsAsStringTest() {
final FFprobeSession ffprobeSession = new FFprobeSession(TEST_ARGUMENTS); final FFprobeSession ffprobeSession = FFprobeSession.create(TEST_ARGUMENTS);
String logMessage1 = "i am log one"; String logMessage1 = "i am log one";
String logMessage2 = "i am log two"; String logMessage2 = "i am log two";
@ -280,18 +280,18 @@ public class FFprobeSessionTest {
public void getLogRedirectionStrategy() { public void getLogRedirectionStrategy() {
FFmpegKitConfig.setLogRedirectionStrategy(LogRedirectionStrategy.NEVER_PRINT_LOGS); FFmpegKitConfig.setLogRedirectionStrategy(LogRedirectionStrategy.NEVER_PRINT_LOGS);
final FFprobeSession ffprobeSession1 = new FFprobeSession(TEST_ARGUMENTS); final FFprobeSession ffprobeSession1 = FFprobeSession.create(TEST_ARGUMENTS);
Assert.assertEquals(FFmpegKitConfig.getLogRedirectionStrategy(), ffprobeSession1.getLogRedirectionStrategy()); Assert.assertEquals(FFmpegKitConfig.getLogRedirectionStrategy(), ffprobeSession1.getLogRedirectionStrategy());
FFmpegKitConfig.setLogRedirectionStrategy(LogRedirectionStrategy.PRINT_LOGS_WHEN_SESSION_CALLBACK_NOT_DEFINED); FFmpegKitConfig.setLogRedirectionStrategy(LogRedirectionStrategy.PRINT_LOGS_WHEN_SESSION_CALLBACK_NOT_DEFINED);
final FFprobeSession ffprobeSession2 = new FFprobeSession(TEST_ARGUMENTS); final FFprobeSession ffprobeSession2 = FFprobeSession.create(TEST_ARGUMENTS);
Assert.assertEquals(FFmpegKitConfig.getLogRedirectionStrategy(), ffprobeSession2.getLogRedirectionStrategy()); Assert.assertEquals(FFmpegKitConfig.getLogRedirectionStrategy(), ffprobeSession2.getLogRedirectionStrategy());
} }
@Test @Test
public void startRunningTest() { public void startRunningTest() {
FFprobeSession ffprobeSession = new FFprobeSession(TEST_ARGUMENTS); FFprobeSession ffprobeSession = FFprobeSession.create(TEST_ARGUMENTS);
ffprobeSession.startRunning(); ffprobeSession.startRunning();
@ -302,7 +302,7 @@ public class FFprobeSessionTest {
@Test @Test
public void completeTest() { public void completeTest() {
FFprobeSession ffprobeSession = new FFprobeSession(TEST_ARGUMENTS); FFprobeSession ffprobeSession = FFprobeSession.create(TEST_ARGUMENTS);
ffprobeSession.startRunning(); ffprobeSession.startRunning();
ffprobeSession.complete(new ReturnCode(100)); ffprobeSession.complete(new ReturnCode(100));
@ -315,7 +315,7 @@ public class FFprobeSessionTest {
@Test @Test
public void failTest() { public void failTest() {
FFprobeSession ffprobeSession = new FFprobeSession(TEST_ARGUMENTS); FFprobeSession ffprobeSession = FFprobeSession.create(TEST_ARGUMENTS);
ffprobeSession.startRunning(); ffprobeSession.startRunning();
ffprobeSession.fail(new Exception("")); ffprobeSession.fail(new Exception(""));

View File

@ -229,6 +229,7 @@ ETAGS = @ETAGS@
EXEEXT = @EXEEXT@ EXEEXT = @EXEEXT@
FFMPEG_FRAMEWORKS = @FFMPEG_FRAMEWORKS@ FFMPEG_FRAMEWORKS = @FFMPEG_FRAMEWORKS@
FGREP = @FGREP@ FGREP = @FGREP@
FILECMD = @FILECMD@
GREP = @GREP@ GREP = @GREP@
INSTALL = @INSTALL@ INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@ INSTALL_DATA = @INSTALL_DATA@

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2018-2021 Taner Sener * Copyright (c) 2018-2022 Taner Sener
* *
* This file is part of FFmpegKit. * This file is part of FFmpegKit.
* *
@ -35,61 +35,61 @@
} }
+ (FFmpegSession*)executeWithArguments:(NSArray*)arguments { + (FFmpegSession*)executeWithArguments:(NSArray*)arguments {
FFmpegSession* session = [[FFmpegSession alloc] init:arguments]; FFmpegSession* session = [FFmpegSession create:arguments];
[FFmpegKitConfig ffmpegExecute:session]; [FFmpegKitConfig ffmpegExecute:session];
return session; return session;
} }
+ (FFmpegSession*)executeWithArgumentsAsync:(NSArray*)arguments withCompleteCallback:(FFmpegSessionCompleteCallback)completeCallback { + (FFmpegSession*)executeWithArgumentsAsync:(NSArray*)arguments withCompleteCallback:(FFmpegSessionCompleteCallback)completeCallback {
FFmpegSession* session = [[FFmpegSession alloc] init:arguments withCompleteCallback:completeCallback]; FFmpegSession* session = [FFmpegSession create:arguments withCompleteCallback:completeCallback];
[FFmpegKitConfig asyncFFmpegExecute:session]; [FFmpegKitConfig asyncFFmpegExecute:session];
return session; return session;
} }
+ (FFmpegSession*)executeWithArgumentsAsync:(NSArray*)arguments withCompleteCallback:(FFmpegSessionCompleteCallback)completeCallback withLogCallback:(LogCallback)logCallback withStatisticsCallback:(StatisticsCallback)statisticsCallback { + (FFmpegSession*)executeWithArgumentsAsync:(NSArray*)arguments withCompleteCallback:(FFmpegSessionCompleteCallback)completeCallback withLogCallback:(LogCallback)logCallback withStatisticsCallback:(StatisticsCallback)statisticsCallback {
FFmpegSession* session = [[FFmpegSession alloc] init:arguments withCompleteCallback:completeCallback withLogCallback:logCallback withStatisticsCallback:statisticsCallback]; FFmpegSession* session = [FFmpegSession create:arguments withCompleteCallback:completeCallback withLogCallback:logCallback withStatisticsCallback:statisticsCallback];
[FFmpegKitConfig asyncFFmpegExecute:session]; [FFmpegKitConfig asyncFFmpegExecute:session];
return session; return session;
} }
+ (FFmpegSession*)executeWithArgumentsAsync:(NSArray*)arguments withCompleteCallback:(FFmpegSessionCompleteCallback)completeCallback onDispatchQueue:(dispatch_queue_t)queue { + (FFmpegSession*)executeWithArgumentsAsync:(NSArray*)arguments withCompleteCallback:(FFmpegSessionCompleteCallback)completeCallback onDispatchQueue:(dispatch_queue_t)queue {
FFmpegSession* session = [[FFmpegSession alloc] init:arguments withCompleteCallback:completeCallback]; FFmpegSession* session = [FFmpegSession create:arguments withCompleteCallback:completeCallback];
[FFmpegKitConfig asyncFFmpegExecute:session onDispatchQueue:queue]; [FFmpegKitConfig asyncFFmpegExecute:session onDispatchQueue:queue];
return session; return session;
} }
+ (FFmpegSession*)executeWithArgumentsAsync:(NSArray*)arguments withCompleteCallback:(FFmpegSessionCompleteCallback)completeCallback withLogCallback:(LogCallback)logCallback withStatisticsCallback:(StatisticsCallback)statisticsCallback onDispatchQueue:(dispatch_queue_t)queue { + (FFmpegSession*)executeWithArgumentsAsync:(NSArray*)arguments withCompleteCallback:(FFmpegSessionCompleteCallback)completeCallback withLogCallback:(LogCallback)logCallback withStatisticsCallback:(StatisticsCallback)statisticsCallback onDispatchQueue:(dispatch_queue_t)queue {
FFmpegSession* session = [[FFmpegSession alloc] init:arguments withCompleteCallback:completeCallback withLogCallback:logCallback withStatisticsCallback:statisticsCallback]; FFmpegSession* session = [FFmpegSession create:arguments withCompleteCallback:completeCallback withLogCallback:logCallback withStatisticsCallback:statisticsCallback];
[FFmpegKitConfig asyncFFmpegExecute:session onDispatchQueue:queue]; [FFmpegKitConfig asyncFFmpegExecute:session onDispatchQueue:queue];
return session; return session;
} }
+ (FFmpegSession*)execute:(NSString*)command { + (FFmpegSession*)execute:(NSString*)command {
FFmpegSession* session = [[FFmpegSession alloc] init:[FFmpegKitConfig parseArguments:command]]; FFmpegSession* session = [FFmpegSession create:[FFmpegKitConfig parseArguments:command]];
[FFmpegKitConfig ffmpegExecute:session]; [FFmpegKitConfig ffmpegExecute:session];
return session; return session;
} }
+ (FFmpegSession*)executeAsync:(NSString*)command withCompleteCallback:(FFmpegSessionCompleteCallback)completeCallback { + (FFmpegSession*)executeAsync:(NSString*)command withCompleteCallback:(FFmpegSessionCompleteCallback)completeCallback {
FFmpegSession* session = [[FFmpegSession alloc] init:[FFmpegKitConfig parseArguments:command] withCompleteCallback:completeCallback]; FFmpegSession* session = [FFmpegSession create:[FFmpegKitConfig parseArguments:command] withCompleteCallback:completeCallback];
[FFmpegKitConfig asyncFFmpegExecute:session]; [FFmpegKitConfig asyncFFmpegExecute:session];
return session; return session;
} }
+ (FFmpegSession*)executeAsync:(NSString*)command withCompleteCallback:(FFmpegSessionCompleteCallback)completeCallback withLogCallback:(LogCallback)logCallback withStatisticsCallback:(StatisticsCallback)statisticsCallback { + (FFmpegSession*)executeAsync:(NSString*)command withCompleteCallback:(FFmpegSessionCompleteCallback)completeCallback withLogCallback:(LogCallback)logCallback withStatisticsCallback:(StatisticsCallback)statisticsCallback {
FFmpegSession* session = [[FFmpegSession alloc] init:[FFmpegKitConfig parseArguments:command] withCompleteCallback:completeCallback withLogCallback:logCallback withStatisticsCallback:statisticsCallback]; FFmpegSession* session = [FFmpegSession create:[FFmpegKitConfig parseArguments:command] withCompleteCallback:completeCallback withLogCallback:logCallback withStatisticsCallback:statisticsCallback];
[FFmpegKitConfig asyncFFmpegExecute:session]; [FFmpegKitConfig asyncFFmpegExecute:session];
return session; return session;
} }
+ (FFmpegSession*)executeAsync:(NSString*)command withCompleteCallback:(FFmpegSessionCompleteCallback)completeCallback onDispatchQueue:(dispatch_queue_t)queue { + (FFmpegSession*)executeAsync:(NSString*)command withCompleteCallback:(FFmpegSessionCompleteCallback)completeCallback onDispatchQueue:(dispatch_queue_t)queue {
FFmpegSession* session = [[FFmpegSession alloc] init:[FFmpegKitConfig parseArguments:command] withCompleteCallback:completeCallback]; FFmpegSession* session = [FFmpegSession create:[FFmpegKitConfig parseArguments:command] withCompleteCallback:completeCallback];
[FFmpegKitConfig asyncFFmpegExecute:session onDispatchQueue:queue]; [FFmpegKitConfig asyncFFmpegExecute:session onDispatchQueue:queue];
return session; return session;
} }
+ (FFmpegSession*)executeAsync:(NSString*)command withCompleteCallback:(FFmpegSessionCompleteCallback)completeCallback withLogCallback:(LogCallback)logCallback withStatisticsCallback:(StatisticsCallback)statisticsCallback onDispatchQueue:(dispatch_queue_t)queue { + (FFmpegSession*)executeAsync:(NSString*)command withCompleteCallback:(FFmpegSessionCompleteCallback)completeCallback withLogCallback:(LogCallback)logCallback withStatisticsCallback:(StatisticsCallback)statisticsCallback onDispatchQueue:(dispatch_queue_t)queue {
FFmpegSession* session = [[FFmpegSession alloc] init:[FFmpegKitConfig parseArguments:command] withCompleteCallback:completeCallback withLogCallback:logCallback withStatisticsCallback:statisticsCallback]; FFmpegSession* session = [FFmpegSession create:[FFmpegKitConfig parseArguments:command] withCompleteCallback:completeCallback withLogCallback:logCallback withStatisticsCallback:statisticsCallback];
[FFmpegKitConfig asyncFFmpegExecute:session onDispatchQueue:queue]; [FFmpegKitConfig asyncFFmpegExecute:session onDispatchQueue:queue];
return session; return session;
} }

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2021 Taner Sener * Copyright (c) 2021-2022 Taner Sener
* *
* This file is part of FFmpegKit. * This file is part of FFmpegKit.
* *
@ -35,7 +35,7 @@
* *
* @param arguments command arguments * @param arguments command arguments
*/ */
- (instancetype)init:(NSArray*)arguments; + (instancetype)create:(NSArray*)arguments;
/** /**
* Builds a new FFmpeg session. * Builds a new FFmpeg session.
@ -43,7 +43,7 @@
* @param arguments command arguments * @param arguments command arguments
* @param completeCallback session specific complete callback * @param completeCallback session specific complete callback
*/ */
- (instancetype)init:(NSArray*)arguments withCompleteCallback:(FFmpegSessionCompleteCallback)completeCallback; + (instancetype)create:(NSArray*)arguments withCompleteCallback:(FFmpegSessionCompleteCallback)completeCallback;
/** /**
* Builds a new FFmpeg session. * Builds a new FFmpeg session.
@ -53,7 +53,7 @@
* @param logCallback session specific log callback * @param logCallback session specific log callback
* @param statisticsCallback session specific statistics callback * @param statisticsCallback session specific statistics callback
*/ */
- (instancetype)init:(NSArray*)arguments withCompleteCallback:(FFmpegSessionCompleteCallback)completeCallback withLogCallback:(LogCallback)logCallback withStatisticsCallback:(StatisticsCallback)statisticsCallback; + (instancetype)create:(NSArray*)arguments withCompleteCallback:(FFmpegSessionCompleteCallback)completeCallback withLogCallback:(LogCallback)logCallback withStatisticsCallback:(StatisticsCallback)statisticsCallback;
/** /**
* Builds a new FFmpeg session. * Builds a new FFmpeg session.
@ -64,7 +64,7 @@
* @param statisticsCallback session specific statistics callback * @param statisticsCallback session specific statistics callback
* @param logRedirectionStrategy session specific log redirection strategy * @param logRedirectionStrategy session specific log redirection strategy
*/ */
- (instancetype)init:(NSArray*)arguments withCompleteCallback:(FFmpegSessionCompleteCallback)completeCallback withLogCallback:(LogCallback)logCallback withStatisticsCallback:(StatisticsCallback)statisticsCallback withLogRedirectionStrategy:(LogRedirectionStrategy)logRedirectionStrategy; + (instancetype)create:(NSArray*)arguments withCompleteCallback:(FFmpegSessionCompleteCallback)completeCallback withLogCallback:(LogCallback)logCallback withStatisticsCallback:(StatisticsCallback)statisticsCallback withLogRedirectionStrategy:(LogRedirectionStrategy)logRedirectionStrategy;
/** /**
* Returns the session specific statistics callback. * Returns the session specific statistics callback.

View File

@ -33,46 +33,20 @@
// EMPTY INITIALIZE // EMPTY INITIALIZE
} }
- (instancetype)init:(NSArray*)arguments { + (instancetype)create:(NSArray*)arguments {
return [[self alloc] init:arguments withCompleteCallback:nil withLogCallback:nil withStatisticsCallback:nil withLogRedirectionStrategy:[FFmpegKitConfig getLogRedirectionStrategy]];
self = [super init:arguments withLogCallback:nil withLogRedirectionStrategy:[FFmpegKitConfig getLogRedirectionStrategy]];
if (self) {
_statisticsCallback = nil;
_completeCallback = nil;
_statistics = [[NSMutableArray alloc] init];
_statisticsLock = [[NSRecursiveLock alloc] init];
} }
return self; + (instancetype)create:(NSArray*)arguments withCompleteCallback:(FFmpegSessionCompleteCallback)completeCallback {
return [[self alloc] init:arguments withCompleteCallback:completeCallback withLogCallback:nil withStatisticsCallback:nil withLogRedirectionStrategy:[FFmpegKitConfig getLogRedirectionStrategy]];
} }
- (instancetype)init:(NSArray*)arguments withCompleteCallback:(FFmpegSessionCompleteCallback)completeCallback { + (instancetype)create:(NSArray*)arguments withCompleteCallback:(FFmpegSessionCompleteCallback)completeCallback withLogCallback:(LogCallback)logCallback withStatisticsCallback:(StatisticsCallback)statisticsCallback {
return [[self alloc] init:arguments withCompleteCallback:completeCallback withLogCallback:logCallback withStatisticsCallback:statisticsCallback withLogRedirectionStrategy:[FFmpegKitConfig getLogRedirectionStrategy]];
self = [super init:arguments withLogCallback:nil withLogRedirectionStrategy:[FFmpegKitConfig getLogRedirectionStrategy]];
if (self) {
_statisticsCallback = nil;
_completeCallback = completeCallback;
_statistics = [[NSMutableArray alloc] init];
_statisticsLock = [[NSRecursiveLock alloc] init];
} }
return self; + (instancetype)create:(NSArray*)arguments withCompleteCallback:(FFmpegSessionCompleteCallback)completeCallback withLogCallback:(LogCallback)logCallback withStatisticsCallback:(StatisticsCallback)statisticsCallback withLogRedirectionStrategy:(LogRedirectionStrategy)logRedirectionStrategy {
} return [[self alloc] init:arguments withCompleteCallback:completeCallback withLogCallback:logCallback withStatisticsCallback:statisticsCallback withLogRedirectionStrategy:logRedirectionStrategy];
- (instancetype)init:(NSArray*)arguments withCompleteCallback:(FFmpegSessionCompleteCallback)completeCallback withLogCallback:(LogCallback)logCallback withStatisticsCallback:(StatisticsCallback)statisticsCallback {
self = [super init:arguments withLogCallback:logCallback withLogRedirectionStrategy:[FFmpegKitConfig getLogRedirectionStrategy]];
if (self) {
_statisticsCallback = statisticsCallback;
_completeCallback = completeCallback;
_statistics = [[NSMutableArray alloc] init];
_statisticsLock = [[NSRecursiveLock alloc] init];
}
return self;
} }
- (instancetype)init:(NSArray*)arguments withCompleteCallback:(FFmpegSessionCompleteCallback)completeCallback withLogCallback:(LogCallback)logCallback withStatisticsCallback:(StatisticsCallback)statisticsCallback withLogRedirectionStrategy:(LogRedirectionStrategy)logRedirectionStrategy { - (instancetype)init:(NSArray*)arguments withCompleteCallback:(FFmpegSessionCompleteCallback)completeCallback withLogCallback:(LogCallback)logCallback withStatisticsCallback:(StatisticsCallback)statisticsCallback withLogRedirectionStrategy:(LogRedirectionStrategy)logRedirectionStrategy {

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2020-2021 Taner Sener * Copyright (c) 2020-2022 Taner Sener
* *
* This file is part of FFmpegKit. * This file is part of FFmpegKit.
* *
@ -33,121 +33,121 @@
} }
+ (FFprobeSession*)executeWithArguments:(NSArray*)arguments { + (FFprobeSession*)executeWithArguments:(NSArray*)arguments {
FFprobeSession* session = [[FFprobeSession alloc] init:arguments]; FFprobeSession* session = [FFprobeSession create:arguments];
[FFmpegKitConfig ffprobeExecute:session]; [FFmpegKitConfig ffprobeExecute:session];
return session; return session;
} }
+ (FFprobeSession*)executeWithArgumentsAsync:(NSArray*)arguments withCompleteCallback:(FFprobeSessionCompleteCallback)completeCallback { + (FFprobeSession*)executeWithArgumentsAsync:(NSArray*)arguments withCompleteCallback:(FFprobeSessionCompleteCallback)completeCallback {
FFprobeSession* session = [[FFprobeSession alloc] init:arguments withCompleteCallback:completeCallback]; FFprobeSession* session = [FFprobeSession create:arguments withCompleteCallback:completeCallback];
[FFmpegKitConfig asyncFFprobeExecute:session]; [FFmpegKitConfig asyncFFprobeExecute:session];
return session; return session;
} }
+ (FFprobeSession*)executeWithArgumentsAsync:(NSArray*)arguments withCompleteCallback:(FFprobeSessionCompleteCallback)completeCallback withLogCallback:(LogCallback)logCallback { + (FFprobeSession*)executeWithArgumentsAsync:(NSArray*)arguments withCompleteCallback:(FFprobeSessionCompleteCallback)completeCallback withLogCallback:(LogCallback)logCallback {
FFprobeSession* session = [[FFprobeSession alloc] init:arguments withCompleteCallback:completeCallback withLogCallback:logCallback]; FFprobeSession* session = [FFprobeSession create:arguments withCompleteCallback:completeCallback withLogCallback:logCallback];
[FFmpegKitConfig asyncFFprobeExecute:session]; [FFmpegKitConfig asyncFFprobeExecute:session];
return session; return session;
} }
+ (FFprobeSession*)executeWithArgumentsAsync:(NSArray*)arguments withCompleteCallback:(FFprobeSessionCompleteCallback)completeCallback onDispatchQueue:(dispatch_queue_t)queue { + (FFprobeSession*)executeWithArgumentsAsync:(NSArray*)arguments withCompleteCallback:(FFprobeSessionCompleteCallback)completeCallback onDispatchQueue:(dispatch_queue_t)queue {
FFprobeSession* session = [[FFprobeSession alloc] init:arguments withCompleteCallback:completeCallback]; FFprobeSession* session = [FFprobeSession create:arguments withCompleteCallback:completeCallback];
[FFmpegKitConfig asyncFFprobeExecute:session onDispatchQueue:queue]; [FFmpegKitConfig asyncFFprobeExecute:session onDispatchQueue:queue];
return session; return session;
} }
+ (FFprobeSession*)executeWithArgumentsAsync:(NSArray*)arguments withCompleteCallback:(FFprobeSessionCompleteCallback)completeCallback withLogCallback:(LogCallback)logCallback onDispatchQueue:(dispatch_queue_t)queue { + (FFprobeSession*)executeWithArgumentsAsync:(NSArray*)arguments withCompleteCallback:(FFprobeSessionCompleteCallback)completeCallback withLogCallback:(LogCallback)logCallback onDispatchQueue:(dispatch_queue_t)queue {
FFprobeSession* session = [[FFprobeSession alloc] init:arguments withCompleteCallback:completeCallback withLogCallback:logCallback]; FFprobeSession* session = [FFprobeSession create:arguments withCompleteCallback:completeCallback withLogCallback:logCallback];
[FFmpegKitConfig asyncFFprobeExecute:session onDispatchQueue:queue]; [FFmpegKitConfig asyncFFprobeExecute:session onDispatchQueue:queue];
return session; return session;
} }
+ (FFprobeSession*)execute:(NSString*)command { + (FFprobeSession*)execute:(NSString*)command {
FFprobeSession* session = [[FFprobeSession alloc] init:[FFmpegKitConfig parseArguments:command]]; FFprobeSession* session = [FFprobeSession create:[FFmpegKitConfig parseArguments:command]];
[FFmpegKitConfig ffprobeExecute:session]; [FFmpegKitConfig ffprobeExecute:session];
return session; return session;
} }
+ (FFprobeSession*)executeAsync:(NSString*)command withCompleteCallback:(FFprobeSessionCompleteCallback)completeCallback { + (FFprobeSession*)executeAsync:(NSString*)command withCompleteCallback:(FFprobeSessionCompleteCallback)completeCallback {
FFprobeSession* session = [[FFprobeSession alloc] init:[FFmpegKitConfig parseArguments:command] withCompleteCallback:completeCallback]; FFprobeSession* session = [FFprobeSession create:[FFmpegKitConfig parseArguments:command] withCompleteCallback:completeCallback];
[FFmpegKitConfig asyncFFprobeExecute:session]; [FFmpegKitConfig asyncFFprobeExecute:session];
return session; return session;
} }
+ (FFprobeSession*)executeAsync:(NSString*)command withCompleteCallback:(FFprobeSessionCompleteCallback)completeCallback withLogCallback:(LogCallback)logCallback { + (FFprobeSession*)executeAsync:(NSString*)command withCompleteCallback:(FFprobeSessionCompleteCallback)completeCallback withLogCallback:(LogCallback)logCallback {
FFprobeSession* session = [[FFprobeSession alloc] init:[FFmpegKitConfig parseArguments:command] withCompleteCallback:completeCallback withLogCallback:logCallback]; FFprobeSession* session = [FFprobeSession create:[FFmpegKitConfig parseArguments:command] withCompleteCallback:completeCallback withLogCallback:logCallback];
[FFmpegKitConfig asyncFFprobeExecute:session]; [FFmpegKitConfig asyncFFprobeExecute:session];
return session; return session;
} }
+ (FFprobeSession*)executeAsync:(NSString*)command withCompleteCallback:(FFprobeSessionCompleteCallback)completeCallback onDispatchQueue:(dispatch_queue_t)queue { + (FFprobeSession*)executeAsync:(NSString*)command withCompleteCallback:(FFprobeSessionCompleteCallback)completeCallback onDispatchQueue:(dispatch_queue_t)queue {
FFprobeSession* session = [[FFprobeSession alloc] init:[FFmpegKitConfig parseArguments:command] withCompleteCallback:completeCallback]; FFprobeSession* session = [FFprobeSession create:[FFmpegKitConfig parseArguments:command] withCompleteCallback:completeCallback];
[FFmpegKitConfig asyncFFprobeExecute:session onDispatchQueue:queue]; [FFmpegKitConfig asyncFFprobeExecute:session onDispatchQueue:queue];
return session; return session;
} }
+ (FFprobeSession*)executeAsync:(NSString*)command withCompleteCallback:(FFprobeSessionCompleteCallback)completeCallback withLogCallback:(LogCallback)logCallback onDispatchQueue:(dispatch_queue_t)queue { + (FFprobeSession*)executeAsync:(NSString*)command withCompleteCallback:(FFprobeSessionCompleteCallback)completeCallback withLogCallback:(LogCallback)logCallback onDispatchQueue:(dispatch_queue_t)queue {
FFprobeSession* session = [[FFprobeSession alloc] init:[FFmpegKitConfig parseArguments:command] withCompleteCallback:completeCallback withLogCallback:logCallback]; FFprobeSession* session = [FFprobeSession create:[FFmpegKitConfig parseArguments:command] withCompleteCallback:completeCallback withLogCallback:logCallback];
[FFmpegKitConfig asyncFFprobeExecute:session onDispatchQueue:queue]; [FFmpegKitConfig asyncFFprobeExecute:session onDispatchQueue:queue];
return session; return session;
} }
+ (MediaInformationSession*)getMediaInformation:(NSString*)path { + (MediaInformationSession*)getMediaInformation:(NSString*)path {
NSArray* arguments = [FFprobeKit defaultGetMediaInformationCommandArguments:path]; NSArray* arguments = [FFprobeKit defaultGetMediaInformationCommandArguments:path];
MediaInformationSession* session = [[MediaInformationSession alloc] init:arguments]; MediaInformationSession* session = [MediaInformationSession create:arguments];
[FFmpegKitConfig getMediaInformationExecute:session withTimeout:AbstractSessionDefaultTimeoutForAsynchronousMessagesInTransmit]; [FFmpegKitConfig getMediaInformationExecute:session withTimeout:AbstractSessionDefaultTimeoutForAsynchronousMessagesInTransmit];
return session; return session;
} }
+ (MediaInformationSession*)getMediaInformation:(NSString*)path withTimeout:(int)waitTimeout { + (MediaInformationSession*)getMediaInformation:(NSString*)path withTimeout:(int)waitTimeout {
NSArray* arguments = [FFprobeKit defaultGetMediaInformationCommandArguments:path]; NSArray* arguments = [FFprobeKit defaultGetMediaInformationCommandArguments:path];
MediaInformationSession* session = [[MediaInformationSession alloc] init:arguments]; MediaInformationSession* session = [MediaInformationSession create:arguments];
[FFmpegKitConfig getMediaInformationExecute:session withTimeout:waitTimeout]; [FFmpegKitConfig getMediaInformationExecute:session withTimeout:waitTimeout];
return session; return session;
} }
+ (MediaInformationSession*)getMediaInformationAsync:(NSString*)path withCompleteCallback:(MediaInformationSessionCompleteCallback)completeCallback { + (MediaInformationSession*)getMediaInformationAsync:(NSString*)path withCompleteCallback:(MediaInformationSessionCompleteCallback)completeCallback {
NSArray* arguments = [FFprobeKit defaultGetMediaInformationCommandArguments:path]; NSArray* arguments = [FFprobeKit defaultGetMediaInformationCommandArguments:path];
MediaInformationSession* session = [[MediaInformationSession alloc] init:arguments withCompleteCallback:completeCallback]; MediaInformationSession* session = [MediaInformationSession create:arguments withCompleteCallback:completeCallback];
[FFmpegKitConfig asyncGetMediaInformationExecute:session withTimeout:AbstractSessionDefaultTimeoutForAsynchronousMessagesInTransmit]; [FFmpegKitConfig asyncGetMediaInformationExecute:session withTimeout:AbstractSessionDefaultTimeoutForAsynchronousMessagesInTransmit];
return session; return session;
} }
+ (MediaInformationSession*)getMediaInformationAsync:(NSString*)path withCompleteCallback:(MediaInformationSessionCompleteCallback)completeCallback withLogCallback:(LogCallback)logCallback withTimeout:(int)waitTimeout { + (MediaInformationSession*)getMediaInformationAsync:(NSString*)path withCompleteCallback:(MediaInformationSessionCompleteCallback)completeCallback withLogCallback:(LogCallback)logCallback withTimeout:(int)waitTimeout {
NSArray* arguments = [FFprobeKit defaultGetMediaInformationCommandArguments:path]; NSArray* arguments = [FFprobeKit defaultGetMediaInformationCommandArguments:path];
MediaInformationSession* session = [[MediaInformationSession alloc] init:arguments withCompleteCallback:completeCallback withLogCallback:logCallback]; MediaInformationSession* session = [MediaInformationSession create:arguments withCompleteCallback:completeCallback withLogCallback:logCallback];
[FFmpegKitConfig asyncGetMediaInformationExecute:session withTimeout:waitTimeout]; [FFmpegKitConfig asyncGetMediaInformationExecute:session withTimeout:waitTimeout];
return session; return session;
} }
+ (MediaInformationSession*)getMediaInformationAsync:(NSString*)path withCompleteCallback:(MediaInformationSessionCompleteCallback)completeCallback onDispatchQueue:(dispatch_queue_t)queue { + (MediaInformationSession*)getMediaInformationAsync:(NSString*)path withCompleteCallback:(MediaInformationSessionCompleteCallback)completeCallback onDispatchQueue:(dispatch_queue_t)queue {
NSArray* arguments = [FFprobeKit defaultGetMediaInformationCommandArguments:path]; NSArray* arguments = [FFprobeKit defaultGetMediaInformationCommandArguments:path];
MediaInformationSession* session = [[MediaInformationSession alloc] init:arguments withCompleteCallback:completeCallback]; MediaInformationSession* session = [MediaInformationSession create:arguments withCompleteCallback:completeCallback];
[FFmpegKitConfig asyncGetMediaInformationExecute:session onDispatchQueue:queue withTimeout:AbstractSessionDefaultTimeoutForAsynchronousMessagesInTransmit]; [FFmpegKitConfig asyncGetMediaInformationExecute:session onDispatchQueue:queue withTimeout:AbstractSessionDefaultTimeoutForAsynchronousMessagesInTransmit];
return session; return session;
} }
+ (MediaInformationSession*)getMediaInformationAsync:(NSString*)path withCompleteCallback:(MediaInformationSessionCompleteCallback)completeCallback withLogCallback:(LogCallback)logCallback onDispatchQueue:(dispatch_queue_t)queue withTimeout:(int)waitTimeout { + (MediaInformationSession*)getMediaInformationAsync:(NSString*)path withCompleteCallback:(MediaInformationSessionCompleteCallback)completeCallback withLogCallback:(LogCallback)logCallback onDispatchQueue:(dispatch_queue_t)queue withTimeout:(int)waitTimeout {
NSArray* arguments = [FFprobeKit defaultGetMediaInformationCommandArguments:path]; NSArray* arguments = [FFprobeKit defaultGetMediaInformationCommandArguments:path];
MediaInformationSession* session = [[MediaInformationSession alloc] init:arguments withCompleteCallback:completeCallback]; MediaInformationSession* session = [MediaInformationSession create:arguments withCompleteCallback:completeCallback];
[FFmpegKitConfig asyncGetMediaInformationExecute:session onDispatchQueue:queue withTimeout:waitTimeout]; [FFmpegKitConfig asyncGetMediaInformationExecute:session onDispatchQueue:queue withTimeout:waitTimeout];
return session; return session;
} }
+ (MediaInformationSession*)getMediaInformationFromCommand:(NSString*)command { + (MediaInformationSession*)getMediaInformationFromCommand:(NSString*)command {
MediaInformationSession* session = [[MediaInformationSession alloc] init:[FFmpegKitConfig parseArguments:command]]; MediaInformationSession* session = [MediaInformationSession create:[FFmpegKitConfig parseArguments:command]];
[FFmpegKitConfig getMediaInformationExecute:session withTimeout:AbstractSessionDefaultTimeoutForAsynchronousMessagesInTransmit]; [FFmpegKitConfig getMediaInformationExecute:session withTimeout:AbstractSessionDefaultTimeoutForAsynchronousMessagesInTransmit];
return session; return session;
} }
+ (MediaInformationSession*)getMediaInformationFromCommandAsync:(NSString*)command withCompleteCallback:(MediaInformationSessionCompleteCallback)completeCallback withLogCallback:(LogCallback)logCallback onDispatchQueue:(dispatch_queue_t)queue withTimeout:(int)waitTimeout { + (MediaInformationSession*)getMediaInformationFromCommandAsync:(NSString*)command withCompleteCallback:(MediaInformationSessionCompleteCallback)completeCallback withLogCallback:(LogCallback)logCallback onDispatchQueue:(dispatch_queue_t)queue withTimeout:(int)waitTimeout {
MediaInformationSession* session = [[MediaInformationSession alloc] init:[FFmpegKitConfig parseArguments:command] withCompleteCallback:completeCallback withLogCallback:logCallback]; MediaInformationSession* session = [MediaInformationSession create:[FFmpegKitConfig parseArguments:command] withCompleteCallback:completeCallback withLogCallback:logCallback];
[FFmpegKitConfig asyncGetMediaInformationExecute:session onDispatchQueue:queue withTimeout:waitTimeout]; [FFmpegKitConfig asyncGetMediaInformationExecute:session onDispatchQueue:queue withTimeout:waitTimeout];
return session; return session;
} }
+ (MediaInformationSession*)getMediaInformationFromCommandArgumentsAsync:(NSArray*)arguments withCompleteCallback:(MediaInformationSessionCompleteCallback)completeCallback withLogCallback:(LogCallback)logCallback onDispatchQueue:(dispatch_queue_t)queue withTimeout:(int)waitTimeout { + (MediaInformationSession*)getMediaInformationFromCommandArgumentsAsync:(NSArray*)arguments withCompleteCallback:(MediaInformationSessionCompleteCallback)completeCallback withLogCallback:(LogCallback)logCallback onDispatchQueue:(dispatch_queue_t)queue withTimeout:(int)waitTimeout {
MediaInformationSession* session = [[MediaInformationSession alloc] init:arguments withCompleteCallback:completeCallback withLogCallback:logCallback]; MediaInformationSession* session = [MediaInformationSession create:arguments withCompleteCallback:completeCallback withLogCallback:logCallback];
[FFmpegKitConfig asyncGetMediaInformationExecute:session onDispatchQueue:queue withTimeout:waitTimeout]; [FFmpegKitConfig asyncGetMediaInformationExecute:session onDispatchQueue:queue withTimeout:waitTimeout];
return session; return session;
} }

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2021 Taner Sener * Copyright (c) 2021-2022 Taner Sener
* *
* This file is part of FFmpegKit. * This file is part of FFmpegKit.
* *
@ -34,7 +34,7 @@
* *
* @param arguments command arguments * @param arguments command arguments
*/ */
- (instancetype)init:(NSArray*)arguments; + (instancetype)create:(NSArray*)arguments;
/** /**
* Builds a new FFprobe session. * Builds a new FFprobe session.
@ -42,7 +42,7 @@
* @param arguments command arguments * @param arguments command arguments
* @param completeCallback session specific complete callback * @param completeCallback session specific complete callback
*/ */
- (instancetype)init:(NSArray*)arguments withCompleteCallback:(FFprobeSessionCompleteCallback)completeCallback; + (instancetype)create:(NSArray*)arguments withCompleteCallback:(FFprobeSessionCompleteCallback)completeCallback;
/** /**
* Builds a new FFprobe session. * Builds a new FFprobe session.
@ -51,7 +51,7 @@
* @param completeCallback session specific complete callback * @param completeCallback session specific complete callback
* @param logCallback session specific log callback * @param logCallback session specific log callback
*/ */
- (instancetype)init:(NSArray*)arguments withCompleteCallback:(FFprobeSessionCompleteCallback)completeCallback withLogCallback:(LogCallback)logCallback; + (instancetype)create:(NSArray*)arguments withCompleteCallback:(FFprobeSessionCompleteCallback)completeCallback withLogCallback:(LogCallback)logCallback;
/** /**
* Builds a new FFprobe session. * Builds a new FFprobe session.
@ -61,7 +61,7 @@
* @param logCallback session specific log callback * @param logCallback session specific log callback
* @param logRedirectionStrategy session specific log redirection strategy * @param logRedirectionStrategy session specific log redirection strategy
*/ */
- (instancetype)init:(NSArray*)arguments withCompleteCallback:(FFprobeSessionCompleteCallback)completeCallback withLogCallback:(LogCallback)logCallback withLogRedirectionStrategy:(LogRedirectionStrategy)logRedirectionStrategy; + (instancetype)create:(NSArray*)arguments withCompleteCallback:(FFprobeSessionCompleteCallback)completeCallback withLogCallback:(LogCallback)logCallback withLogRedirectionStrategy:(LogRedirectionStrategy)logRedirectionStrategy;
/** /**
* Returns the session specific complete callback. * Returns the session specific complete callback.

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2021 Taner Sener * Copyright (c) 2021-2022 Taner Sener
* *
* This file is part of FFmpegKit. * This file is part of FFmpegKit.
* *
@ -29,37 +29,20 @@
// EMPTY INITIALIZE // EMPTY INITIALIZE
} }
- (instancetype)init:(NSArray*)arguments { + (instancetype)create:(NSArray*)arguments {
return [[self alloc] init:arguments withCompleteCallback:nil withLogCallback:nil withLogRedirectionStrategy:[FFmpegKitConfig getLogRedirectionStrategy]];
self = [super init:arguments withLogCallback:nil withLogRedirectionStrategy:[FFmpegKitConfig getLogRedirectionStrategy]];
if (self) {
_completeCallback = nil;
} }
return self; + (instancetype)create:(NSArray*)arguments withCompleteCallback:(FFprobeSessionCompleteCallback)completeCallback {
return [[self alloc] init:arguments withCompleteCallback:completeCallback withLogCallback:nil withLogRedirectionStrategy:[FFmpegKitConfig getLogRedirectionStrategy]];
} }
- (instancetype)init:(NSArray*)arguments withCompleteCallback:(FFprobeSessionCompleteCallback)completeCallback { + (instancetype)create:(NSArray*)arguments withCompleteCallback:(FFprobeSessionCompleteCallback)completeCallback withLogCallback:(LogCallback)logCallback {
return [[self alloc] init:arguments withCompleteCallback:completeCallback withLogCallback:logCallback withLogRedirectionStrategy:[FFmpegKitConfig getLogRedirectionStrategy]];
self = [super init:arguments withLogCallback:nil withLogRedirectionStrategy:[FFmpegKitConfig getLogRedirectionStrategy]];
if (self) {
_completeCallback = completeCallback;
} }
return self; + (instancetype)create:(NSArray*)arguments withCompleteCallback:(FFprobeSessionCompleteCallback)completeCallback withLogCallback:(LogCallback)logCallback withLogRedirectionStrategy:(LogRedirectionStrategy)logRedirectionStrategy {
} return [[self alloc] init:arguments withCompleteCallback:completeCallback withLogCallback:logCallback withLogRedirectionStrategy:logRedirectionStrategy];
- (instancetype)init:(NSArray*)arguments withCompleteCallback:(FFprobeSessionCompleteCallback)completeCallback withLogCallback:(LogCallback)logCallback {
self = [super init:arguments withLogCallback:logCallback withLogRedirectionStrategy:[FFmpegKitConfig getLogRedirectionStrategy]];
if (self) {
_completeCallback = completeCallback;
}
return self;
} }
- (instancetype)init:(NSArray*)arguments withCompleteCallback:(FFprobeSessionCompleteCallback)completeCallback withLogCallback:(LogCallback)logCallback withLogRedirectionStrategy:(LogRedirectionStrategy)logRedirectionStrategy { - (instancetype)init:(NSArray*)arguments withCompleteCallback:(FFprobeSessionCompleteCallback)completeCallback withLogCallback:(LogCallback)logCallback withLogRedirectionStrategy:(LogRedirectionStrategy)logRedirectionStrategy {

View File

@ -303,6 +303,7 @@ ETAGS = @ETAGS@
EXEEXT = @EXEEXT@ EXEEXT = @EXEEXT@
FFMPEG_FRAMEWORKS = @FFMPEG_FRAMEWORKS@ FFMPEG_FRAMEWORKS = @FFMPEG_FRAMEWORKS@
FGREP = @FGREP@ FGREP = @FGREP@
FILECMD = @FILECMD@
GREP = @GREP@ GREP = @GREP@
INSTALL = @INSTALL@ INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@ INSTALL_DATA = @INSTALL_DATA@

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2021 Taner Sener * Copyright (c) 2021-2022 Taner Sener
* *
* This file is part of FFmpegKit. * This file is part of FFmpegKit.
* *
@ -36,7 +36,7 @@
* *
* @param arguments command arguments * @param arguments command arguments
*/ */
- (instancetype)init:(NSArray*)arguments; + (instancetype)create:(NSArray*)arguments;
/** /**
* Creates a new media information session. * Creates a new media information session.
@ -44,7 +44,7 @@
* @param arguments command arguments * @param arguments command arguments
* @param completeCallback session specific complete callback * @param completeCallback session specific complete callback
*/ */
- (instancetype)init:(NSArray*)arguments withCompleteCallback:(MediaInformationSessionCompleteCallback)completeCallback; + (instancetype)create:(NSArray*)arguments withCompleteCallback:(MediaInformationSessionCompleteCallback)completeCallback;
/** /**
* Creates a new media information session. * Creates a new media information session.
@ -53,7 +53,7 @@
* @param completeCallback session specific complete callback * @param completeCallback session specific complete callback
* @param logCallback session specific log callback * @param logCallback session specific log callback
*/ */
- (instancetype)init:(NSArray*)arguments withCompleteCallback:(MediaInformationSessionCompleteCallback)completeCallback withLogCallback:(LogCallback)logCallback; + (instancetype)create:(NSArray*)arguments withCompleteCallback:(MediaInformationSessionCompleteCallback)completeCallback withLogCallback:(LogCallback)logCallback;
/** /**
* Returns the media information extracted in this session. * Returns the media information extracted in this session.

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2021 Taner Sener * Copyright (c) 2021-2022 Taner Sener
* *
* This file is part of FFmpegKit. * This file is part of FFmpegKit.
* *
@ -30,26 +30,16 @@
// EMPTY INITIALIZE // EMPTY INITIALIZE
} }
- (instancetype)init:(NSArray*)arguments { + (instancetype)create:(NSArray*)arguments {
return [[self alloc] init:arguments withCompleteCallback:nil withLogCallback:nil];
self = [super init:arguments withLogCallback:nil withLogRedirectionStrategy:LogRedirectionStrategyNeverPrintLogs];
if (self) {
_completeCallback = nil;
} }
return self; + (instancetype)create:(NSArray*)arguments withCompleteCallback:(MediaInformationSessionCompleteCallback)completeCallback {
return [[self alloc] init:arguments withCompleteCallback:completeCallback withLogCallback:nil];
} }
- (instancetype)init:(NSArray*)arguments withCompleteCallback:(MediaInformationSessionCompleteCallback)completeCallback { + (instancetype)create:(NSArray*)arguments withCompleteCallback:(MediaInformationSessionCompleteCallback)completeCallback withLogCallback:(LogCallback)logCallback {
return [[self alloc] init:arguments withCompleteCallback:completeCallback withLogCallback:logCallback];
self = [super init:arguments withLogCallback:nil withLogRedirectionStrategy:LogRedirectionStrategyNeverPrintLogs];
if (self) {
_completeCallback = completeCallback;
}
return self;
} }
- (instancetype)init:(NSArray*)arguments withCompleteCallback:(MediaInformationSessionCompleteCallback)completeCallback withLogCallback:(LogCallback)logCallback { - (instancetype)init:(NSArray*)arguments withCompleteCallback:(MediaInformationSessionCompleteCallback)completeCallback withLogCallback:(LogCallback)logCallback {