Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/main/java/net/bramp/ffmpeg/FFmpeg.java
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public class FFmpeg extends FFcommon {

static final Pattern CODECS_REGEX =
Pattern.compile("^ ([.D][.E][VASD][.I][.L][.S]) (\\S{2,})\\s+(.*)$");
static final Pattern FORMATS_REGEX = Pattern.compile("^ ([ D][ E]) (\\S+)\\s+(.*)$");
static final Pattern FORMATS_REGEX = Pattern.compile("^ ([ D][ E])[ d]? (\\S+)\\s+(.*)$");
static final Pattern PIXEL_FORMATS_REGEX =
Pattern.compile("^([.I][.O][.H][.P][.B]) (\\S{2,})\\s+(\\d+)\\s+(\\d+)$");
static final Pattern FILTERS_REGEX =
Expand Down
21 changes: 21 additions & 0 deletions src/test/java/net/bramp/ffmpeg/FFmpegTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import net.bramp.ffmpeg.fixtures.PixelFormats;
import net.bramp.ffmpeg.fixtures.Samples;
import net.bramp.ffmpeg.info.Filter;
import net.bramp.ffmpeg.info.Format;
import net.bramp.ffmpeg.lang.NewProcessAnswer;
import org.junit.Before;
import org.junit.Test;
Expand Down Expand Up @@ -122,6 +123,26 @@ public void testFormats() throws IOException {
verify(runFunc, times(1)).run(argThatHasItem("-formats"));
}

@Test
public void testFormatsModern() throws IOException {
when(runFunc.run(argThatHasItem("-formats")))
.thenAnswer(new NewProcessAnswer("ffmpeg-formats-modern"));
List<Format> expected =
Lists.newArrayList(
new Format("aac", "raw ADTS AAC (Advanced Audio Coding)", "D "),
new Format("adts", "ADTS AAC (Advanced Audio Coding)", " E"),
new Format("matroska,webm", "Matroska / WebM", "DE"),
new Format("avfoundation", "AVFoundation input device", "D "),
new Format("audiotoolbox", "AudioToolbox output device", " E"),
new Format("alsa", "ALSA audio output", "DE"));

// Run twice, the second should be cached
assertEquals(expected, ffmpeg.formats());
assertEquals(expected, ffmpeg.formats());

verify(runFunc, times(1)).run(argThatHasItem("-formats"));
}

@Test
public void testReadProcessStreams() throws IOException {
// process input stream
Expand Down
19 changes: 19 additions & 0 deletions src/test/resources/net/bramp/ffmpeg/fixtures/ffmpeg-formats-modern
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
File formats:
D.. = Demuxing supported
.E. = Muxing supported
..d = Is a device
---

D aac raw ADTS AAC (Advanced Audio Coding)
E adts ADTS AAC (Advanced Audio Coding)
DE matroska,webm Matroska / WebM
D d avfoundation AVFoundation input device
Ed audiotoolbox AudioToolbox output device
DEd alsa ALSA audio output

unrelated text
X invalid Unexpected demux capability
DX invalid Unexpected mux capability
DEx invalid Unexpected device capability
DE
DEd
Loading