[vlc-commits] vlc_es: add defines for priority levels
Francois Cartegnie
git at videolan.org
Mon Nov 4 10:12:41 CET 2013
vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Sun Nov 3 23:16:36 2013 +0900| [46c5bf59b18fae23b04c009e1e6215dd1227cdc8] | committer: Francois Cartegnie
vlc_es: add defines for priority levels
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=46c5bf59b18fae23b04c009e1e6215dd1227cdc8
---
include/vlc_es.h | 4 ++++
modules/access/bd/bd.c | 6 +++---
modules/access/bluray.c | 4 ++--
modules/access/dshow/dshow.cpp | 4 ++--
modules/demux/avformat/demux.c | 2 +-
modules/demux/mkv/matroska_segment.cpp | 8 ++++----
modules/demux/mp4/mp4.c | 4 ++--
modules/demux/ts.c | 5 +++--
modules/video_filter/remoteosd.c | 2 +-
src/input/es_out.c | 2 +-
src/misc/es_format.c | 2 +-
11 files changed, 24 insertions(+), 19 deletions(-)
diff --git a/include/vlc_es.h b/include/vlc_es.h
index 6babdd8..3040c38 100644
--- a/include/vlc_es.h
+++ b/include/vlc_es.h
@@ -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 */
diff --git a/modules/access/bd/bd.c b/modules/access/bd/bd.c
index a73c88c..bf9ccd5 100644
--- a/modules/access/bd/bd.c
+++ b/modules/access/bd/bd.c
@@ -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 );
/* */
diff --git a/modules/access/bluray.c b/modules/access/bluray.c
index a0c4eb6..0b98815 100644
--- a/modules/access/bluray.c
+++ b/modules/access/bluray.c
@@ -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 ;
diff --git a/modules/access/dshow/dshow.cpp b/modules/access/dshow/dshow.cpp
index 83a21c3..82b0917 100644
--- a/modules/access/dshow/dshow.cpp
+++ b/modules/access/dshow/dshow.cpp
@@ -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");
}
}
diff --git a/modules/demux/avformat/demux.c b/modules/demux/avformat/demux.c
index 51ae99b..e340281 100644
--- a/modules/demux/avformat/demux.c
+++ b/modules/demux/avformat/demux.c
@@ -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 )
diff --git a/modules/demux/mkv/matroska_segment.cpp b/modules/demux/mkv/matroska_segment.cpp
index 2244400..756a9c5 100644
--- a/modules/demux/mkv/matroska_segment.cpp
+++ b/modules/demux/mkv/matroska_segment.cpp
@@ -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 )
diff --git a/modules/demux/mp4/mp4.c b/modules/demux/mp4/mp4.c
index c30dc77..78df811 100644
--- a/modules/demux/mp4/mp4.c
+++ b/modules/demux/mp4/mp4.c
@@ -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;
diff --git a/modules/demux/ts.c b/modules/demux/ts.c
index 2039251..ade6ab7 100644
--- a/modules/demux/ts.c
+++ b/modules/demux/ts.c
@@ -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 )
diff --git a/modules/video_filter/remoteosd.c b/modules/video_filter/remoteosd.c
index 09593c2..4b73e21 100644
--- a/modules/video_filter/remoteosd.c
+++ b/modules/video_filter/remoteosd.c
@@ -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();
diff --git a/src/input/es_out.c b/src/input/es_out.c
index d10ab6b..5da85ea 100644
--- a/src/input/es_out.c
+++ b/src/input/es_out.c
@@ -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;
}
diff --git a/src/misc/es_format.c b/src/misc/es_format.c
index 352bd5b..cf329cb 100644
--- a/src/misc/es_format.c
+++ b/src/misc/es_format.c
@@ -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;
More information about the vlc-commits
mailing list