Bug 1161718 - Distinguish unknown track types from errors in libnestegg. r=rillian

This commit is contained in:
Matthew Gregan 2015-05-11 14:25:33 +12:00
parent 27db02bc0c
commit e2b35dbcb9
3 changed files with 20 additions and 13 deletions

View File

@ -5,4 +5,4 @@ Makefile.in build files for the Mozilla build system.
The nestegg git repository is: git://github.com/kinetiknz/nestegg.git
The git commit ID used was 17ae8cd3cb5d87c2ebdcd48cae4910f5dd86ae93.
The git commit ID used was 493fb475842db86de657101ffac9a06a0cf688de.

View File

@ -7,6 +7,7 @@
#if !defined(NESTEGG_671cac2a_365d_ed69_d7a3_4491d3538d79)
#define NESTEGG_671cac2a_365d_ed69_d7a3_4491d3538d79
#include <limits.h>
#include <nestegg/nestegg-stdint.h>
#if defined(__cplusplus)
@ -62,13 +63,15 @@ extern "C" {
/** @file
The <tt>libnestegg</tt> C API. */
#define NESTEGG_TRACK_VIDEO 0 /**< Track is of type video. */
#define NESTEGG_TRACK_AUDIO 1 /**< Track is of type audio. */
#define NESTEGG_TRACK_VIDEO 0 /**< Track is of type video. */
#define NESTEGG_TRACK_AUDIO 1 /**< Track is of type audio. */
#define NESTEGG_TRACK_UNKNOWN INT_MAX /**< Track is of type unknown. */
#define NESTEGG_CODEC_VP8 0 /**< Track uses Google On2 VP8 codec. */
#define NESTEGG_CODEC_VORBIS 1 /**< Track uses Xiph Vorbis codec. */
#define NESTEGG_CODEC_VP9 2 /**< Track uses Google On2 VP9 codec. */
#define NESTEGG_CODEC_OPUS 3 /**< Track uses Xiph Opus codec. */
#define NESTEGG_CODEC_VP8 0 /**< Track uses Google On2 VP8 codec. */
#define NESTEGG_CODEC_VORBIS 1 /**< Track uses Xiph Vorbis codec. */
#define NESTEGG_CODEC_VP9 2 /**< Track uses Google On2 VP9 codec. */
#define NESTEGG_CODEC_OPUS 3 /**< Track uses Xiph Opus codec. */
#define NESTEGG_CODEC_UNKNOWN INT_MAX /**< Track uses unknown codec. */
#define NESTEGG_VIDEO_MONO 0 /**< Track is mono video. */
#define NESTEGG_VIDEO_STEREO_LEFT_RIGHT 1 /**< Track is side-by-side stereo video. Left first. */
@ -222,16 +225,20 @@ int nestegg_track_seek(nestegg * context, unsigned int track, uint64_t tstamp);
/** Query the type specified by @a track.
@param context Stream context initialized by #nestegg_init.
@param track Zero based track number.
@retval #NESTEGG_TRACK_VIDEO Track type is video.
@retval #NESTEGG_TRACK_AUDIO Track type is audio.
@retval #NESTEGG_TRACK_VIDEO Track type is video.
@retval #NESTEGG_TRACK_AUDIO Track type is audio.
@retval #NESTEGG_TRACK_UNKNOWN Track type is unknown.
@retval -1 Error. */
int nestegg_track_type(nestegg * context, unsigned int track);
/** Query the codec ID specified by @a track.
@param context Stream context initialized by #nestegg_init.
@param track Zero based track number.
@retval #NESTEGG_CODEC_VP8 Track codec is VP8.
@retval #NESTEGG_CODEC_VORBIS Track codec is Vorbis.
@retval #NESTEGG_CODEC_VP8 Track codec is VP8.
@retval #NESTEGG_CODEC_VP9 Track codec is VP9.
@retval #NESTEGG_CODEC_VORBIS Track codec is Vorbis.
@retval #NESTEGG_CODEC_OPUS Track codec is Opus.
@retval #NESTEGG_CODEC_UNKNOWN Track codec is unknown.
@retval -1 Error. */
int nestegg_track_codec_id(nestegg * context, unsigned int track);

View File

@ -2187,7 +2187,7 @@ nestegg_track_type(nestegg * ctx, unsigned int track)
if (type & TRACK_TYPE_AUDIO)
return NESTEGG_TRACK_AUDIO;
return -1;
return NESTEGG_TRACK_UNKNOWN;
}
int
@ -2215,7 +2215,7 @@ nestegg_track_codec_id(nestegg * ctx, unsigned int track)
if (strcmp(codec_id, TRACK_ID_OPUS) == 0)
return NESTEGG_CODEC_OPUS;
return -1;
return NESTEGG_CODEC_UNKNOWN;
}
int