Skip to content

Commit

Permalink
Add preliminary support for FLAC per the Matroska mapping.
Browse files Browse the repository at this point in the history
The Matroska mapping is very simple: https://matroska.org/technical/specs/codecid/index.html

I haven't found more detailed documentation of the FLAC in Matroska mapping.
The Ogg mapping (https://xiph.org/flac/ogg_mapping.html) is also quite
simple due to the FLAC format being included inside the Ogg mapping.  Given
this, the FLAC in Matroska mapping is likely similar.
  • Loading branch information
kinetiknz committed Jan 7, 2020
1 parent b50521d commit 3b6054d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
2 changes: 2 additions & 0 deletions include/nestegg/nestegg.h
Expand Up @@ -72,6 +72,7 @@ extern "C" {
#define NESTEGG_CODEC_VP9 2 /**< Track uses Google On2 VP9 codec. */
#define NESTEGG_CODEC_OPUS 3 /**< Track uses Xiph Opus codec. */
#define NESTEGG_CODEC_AV1 4 /**< Track uses AOMedia AV1 codec. */
#define NESTEGG_CODEC_FLAC 5 /**< Track uses Xiph FLAC codec. */
#define NESTEGG_CODEC_UNKNOWN INT_MAX /**< Track uses unknown codec. */

#define NESTEGG_VIDEO_MONO 0 /**< Track is mono video. */
Expand Down Expand Up @@ -276,6 +277,7 @@ int nestegg_track_type(nestegg * context, unsigned int track);
@retval #NESTEGG_CODEC_AV1 Track codec is AV1.
@retval #NESTEGG_CODEC_VORBIS Track codec is Vorbis.
@retval #NESTEGG_CODEC_OPUS Track codec is Opus.
@retval #NESTEGG_CODEC_FLAC Track codec is FLAC.
@retval #NESTEGG_CODEC_UNKNOWN Track codec is unknown.
@retval -1 Error. */
int nestegg_track_codec_id(nestegg * context, unsigned int track);
Expand Down
4 changes: 4 additions & 0 deletions src/nestegg.c
Expand Up @@ -177,6 +177,7 @@ enum ebml_type_enum {
#define TRACK_ID_AV1 "V_AV1"
#define TRACK_ID_VORBIS "A_VORBIS"
#define TRACK_ID_OPUS "A_OPUS"
#define TRACK_ID_FLAC "A_FLAC"

/* Track Encryption */
#define CONTENT_ENC_ALGO_AES 5
Expand Down Expand Up @@ -2482,6 +2483,9 @@ nestegg_track_codec_id(nestegg * ctx, unsigned int track)
if (strcmp(codec_id, TRACK_ID_OPUS) == 0)
return NESTEGG_CODEC_OPUS;

if (strcmp(codec_id, TRACK_ID_FLAC) == 0)
return NESTEGG_CODEC_FLAC;

return NESTEGG_CODEC_UNKNOWN;
}

Expand Down

0 comments on commit 3b6054d

Please sign in to comment.