Commit 46c5bf59 authored by Francois Cartegnie's avatar Francois Cartegnie

vlc_es: add defines for priority levels

parent b20aa40e
......@@ -320,6 +320,10 @@ typedef struct extra_languages_t
/**
* ES format definition
*/
#define ES_PRIORITY_NOT_SELECTABLE -2
#define ES_PRIORITY_NOT_DEFAULTABLE -1
#define ES_PRIORITY_SELECTABLE_MIN 0
#define ES_PRIORITY_MIN ES_PRIORITY_NOT_SELECTABLE
struct es_format_t
{
int i_cat; /**< ES category @see es_format_category_e */
......
......@@ -1255,7 +1255,7 @@ static es_out_id_t *EsOutAdd( es_out_t *p_out, const es_format_t *p_fmt )
es_format_t fmt;
es_format_Copy( &fmt, p_fmt );
fmt.i_priority = -2;
fmt.i_priority = ES_PRIORITY_NOT_SELECTABLE;
for( int i = 0; i < p_item->i_stream; i++ )
{
......@@ -1267,7 +1267,7 @@ static es_out_id_t *EsOutAdd( es_out_t *p_out, const es_format_t *p_fmt )
/* TODO improved priority for higher quality stream ?
* if so, extending stream attributes parsing might be a good idea
*/
fmt.i_priority = 0;
fmt.i_priority = ES_PRIORITY_SELECTABLE_MIN;
#if 0
/* Useless, and beside not sure it is the right thing to do */
......@@ -1297,7 +1297,7 @@ static es_out_id_t *EsOutAdd( es_out_t *p_out, const es_format_t *p_fmt )
}
break;
}
if( fmt.i_priority < 0 )
if( fmt.i_priority < ES_PRIORITY_SELECTABLE_MIN )
msg_Dbg( p_demux, "Hiding one stream (pid=%d)", fmt.i_id );
/* */
......
......@@ -525,11 +525,11 @@ static es_out_id_t *esOutAdd(es_out_t *p_out, const es_format_t *p_fmt)
switch (fmt.i_cat) {
case VIDEO_ES:
if (p_sys->i_video_stream != -1 && p_sys->i_video_stream != p_fmt->i_id)
fmt.i_priority = -2;
fmt.i_priority = ES_PRIORITY_NOT_SELECTABLE;
break ;
case AUDIO_ES:
if (p_sys->i_audio_stream != -1 && p_sys->i_audio_stream != p_fmt->i_id)
fmt.i_priority = -2;
fmt.i_priority = ES_PRIORITY_NOT_SELECTABLE;
break ;
case SPU_ES:
break ;
......
......@@ -1400,7 +1400,7 @@ static size_t EnumDeviceCaps( vlc_object_t *p_this, IBaseFilter *p_filter,
BYTE *pSCC= (BYTE *)CoTaskMemAlloc(piSize);
if( NULL != pSCC )
{
int i_priority = -1;
int i_priority = ES_PRIORITY_NOT_DEFAULTABLE;
for( int i=0; i<piCount; ++i )
{
if( SUCCEEDED(pSC->GetStreamCaps(i, &p_mt, pSCC)) )
......@@ -1581,7 +1581,7 @@ static size_t EnumDeviceCaps( vlc_object_t *p_this, IBaseFilter *p_filter,
}
}
CoTaskMemFree( (LPVOID)pSCC );
if( i_priority >= 0 )
if( i_priority >= ES_PRIORITY_SELECTABLE_MIN )
msg_Dbg( p_this, "EnumDeviceCaps: input pin default format configured");
}
}
......
......@@ -427,7 +427,7 @@ int OpenDemux( vlc_object_t *p_this )
fmt.psz_language = strdup( language->value );
if( s->disposition & AV_DISPOSITION_DEFAULT )
fmt.i_priority = 1000;
fmt.i_priority = ES_PRIORITY_SELECTABLE_MIN + 1000;
#ifdef HAVE_AVUTIL_CODEC_ATTACHMENT
if( cc->codec_type != AVMEDIA_TYPE_ATTACHMENT )
......
......@@ -1119,13 +1119,13 @@ void matroska_segment_c::ComputeTrackPriority()
b_has_default_audio = true;
}
if( unlikely( !p_tk->b_enabled ) )
p_tk->fmt.i_priority = -2;
p_tk->fmt.i_priority = ES_PRIORITY_NOT_SELECTABLE;
else if( p_tk->b_forced )
p_tk->fmt.i_priority = 2;
p_tk->fmt.i_priority = ES_PRIORITY_SELECTABLE_MIN + 2;
else if( p_tk->b_default )
p_tk->fmt.i_priority = 1;
p_tk->fmt.i_priority = ES_PRIORITY_SELECTABLE_MIN + 1;
else
p_tk->fmt.i_priority = 0;
p_tk->fmt.i_priority = ES_PRIORITY_SELECTABLE_MIN;
/* Avoid multivideo tracks when unnecessary */
if( p_tk->fmt.i_cat == VIDEO_ES )
......
......@@ -2505,7 +2505,7 @@ static void MP4_TrackCreate( demux_t *p_demux, mp4_track_t *p_track,
p_track->b_enable =
( ( p_tkhd->data.p_tkhd->i_flags&MP4_TRACK_ENABLED ) != 0 );
if( !p_track->b_enable )
p_track->fmt.i_priority = -1;
p_track->fmt.i_priority = ES_PRIORITY_NOT_DEFAULTABLE;
p_track->i_track_ID = p_tkhd->data.p_tkhd->i_track_ID;
......@@ -2666,7 +2666,7 @@ static void MP4_TrackCreate( demux_t *p_demux, mp4_track_t *p_track,
msg_Warn( p_demux, "Enabling track[Id 0x%x] (buggy file without enabled track)",
p_track->i_track_ID );
p_track->b_enable = true;
p_track->fmt.i_priority = 0;
p_track->fmt.i_priority = ES_PRIORITY_SELECTABLE_MIN;
}
p_track->p_es = NULL;
......
......@@ -3527,7 +3527,8 @@ static void PMTSetupEsTeletext( demux_t *p_demux, ts_pid_t *pid,
/* */
const ts_teletext_page_t *p = &p_page[i];
p_es->fmt.i_priority = (p->i_type == 0x02 || p->i_type == 0x05) ? 0 : -1;
p_es->fmt.i_priority = (p->i_type == 0x02 || p->i_type == 0x05) ?
ES_PRIORITY_SELECTABLE_MIN : ES_PRIORITY_NOT_DEFAULTABLE;
p_es->fmt.psz_language = strndup( p->p_iso639, 3 );
p_es->fmt.psz_description = strdup(vlc_gettext(ppsz_teletext_type[p->i_type]));
p_es->fmt.subs.teletext.i_magazine = p->i_magazine;
......@@ -3922,7 +3923,7 @@ static void PMTParseEsIso639( demux_t *p_demux, ts_pid_t *pid,
int type = p_decoded->code[0].i_audio_type;
pid->es->fmt.psz_description = GetAudioTypeDesc(p_demux, type);
if (type == 0)
pid->es->fmt.i_priority = 1; // prioritize normal audio tracks
pid->es->fmt.i_priority = ES_PRIORITY_SELECTABLE_MIN + 1; // prioritize normal audio tracks
pid->es->fmt.i_extra_languages = p_decoded->i_code_count-1;
if( pid->es->fmt.i_extra_languages > 0 )
......
......@@ -308,7 +308,7 @@ static int CreateFilter ( vlc_object_t *p_this )
var_AddCallback( p_filter->p_libvlc, "key-pressed", KeyEvent, p_this );
es_format_Init( &p_filter->fmt_out, SPU_ES, VLC_CODEC_SPU );
p_filter->fmt_out.i_priority = 0;
p_filter->fmt_out.i_priority = ES_PRIORITY_SELECTABLE_MIN;
vlc_gcrypt_init();
......
......@@ -1716,7 +1716,7 @@ static void EsOutSelect( es_out_t *out, es_out_id_t *es, bool b_force )
int i_cat = es->fmt.i_cat;
if( !p_sys->b_active ||
( !b_force && es->fmt.i_priority < 0 ) )
( !b_force && es->fmt.i_priority < ES_PRIORITY_SELECTABLE_MIN ) )
{
return;
}
......
......@@ -296,7 +296,7 @@ void es_format_Init( es_format_t *fmt,
fmt->i_level = -1;
fmt->i_id = -1;
fmt->i_group = 0;
fmt->i_priority = 0;
fmt->i_priority = ES_PRIORITY_SELECTABLE_MIN;
fmt->psz_language = NULL;
fmt->psz_description = NULL;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment