Skip to content

Commit 9a5507c

Browse files
Eukliosbramp
authored andcommitted
Fix #260: FFmpeg.codecs() returns empty list
1 parent 2b5cb9d commit 9a5507c

File tree

4 files changed

+935
-655
lines changed

4 files changed

+935
-655
lines changed

src/main/java/net/bramp/ffmpeg/FFmpeg.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,7 @@ public class FFmpeg extends FFcommon {
6262
public static final int AUDIO_SAMPLE_48000 = 48000;
6363
public static final int AUDIO_SAMPLE_96000 = 96000;
6464

65-
static final Pattern CODECS_REGEX =
66-
Pattern.compile("^ ([ D][ E][VAS][ S][ D][ T]) (\\S+)\\s+(.*)$");
65+
static final Pattern CODECS_REGEX = Pattern.compile("^ ([.D][.E][VASD][.I][.L][.S]) (\\S{2,})\\s+(.*)$");
6766
static final Pattern FORMATS_REGEX = Pattern.compile("^ ([ D][ E]) (\\S+)\\s+(.*)$");
6867

6968
/** Supported codecs */

src/main/java/net/bramp/ffmpeg/info/Codec.java

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ public class Codec {
1616
enum Type {
1717
VIDEO,
1818
AUDIO,
19-
SUBTITLE
19+
SUBTITLE,
20+
DATA
2021
}
2122

2223
final String name;
@@ -41,9 +42,9 @@ enum Type {
4142
* ..V... = Video codec
4243
* ..A... = Audio codec
4344
* ..S... = Subtitle codec
44-
* ...S.. = Supports draw_horiz_band
45-
* ....D. = Supports direct rendering method 1
46-
* .....T = Supports weird frame truncation
45+
* ...I.. = Intra frame-only codec
46+
* ....L. = Lossy compression
47+
* .....S = Lossless compression
4748
* </pre>
4849
*/
4950
public Codec(String name, String longName, String flags) {
@@ -65,8 +66,11 @@ public Codec(String name, String longName, String flags) {
6566
case 'S':
6667
this.type = Type.SUBTITLE;
6768
break;
69+
case 'D':
70+
this.type = Type.DATA;
71+
break;
6872
default:
69-
throw new IllegalArgumentException("Invalid codec type '" + flags.charAt(3) + "'");
73+
throw new IllegalArgumentException("Invalid codec type '" + flags.charAt(2) + "'");
7074
}
7175

7276
// TODO There are more flags to parse

0 commit comments

Comments
 (0)