Commit 7e3972c4 authored by Laurent Aimar's avatar Laurent Aimar

Added a small heuristic to improve MLP detection in AOB.

parent deeb9757
...@@ -87,6 +87,8 @@ struct demux_sys_t ...@@ -87,6 +87,8 @@ struct demux_sys_t
int i_time_track; int i_time_track;
int64_t i_current_pts; int64_t i_current_pts;
int i_aob_mlp_count;
bool b_lost_sync; bool b_lost_sync;
bool b_have_pack; bool b_have_pack;
bool b_seekable; bool b_seekable;
...@@ -135,6 +137,7 @@ static int OpenCommon( vlc_object_t *p_this, bool b_force ) ...@@ -135,6 +137,7 @@ static int OpenCommon( vlc_object_t *p_this, bool b_force )
p_sys->i_length = -1; p_sys->i_length = -1;
p_sys->i_current_pts = (mtime_t) 0; p_sys->i_current_pts = (mtime_t) 0;
p_sys->i_time_track = -1; p_sys->i_time_track = -1;
p_sys->i_aob_mlp_count = 0;
p_sys->b_lost_sync = false; p_sys->b_lost_sync = false;
p_sys->b_have_pack = false; p_sys->b_have_pack = false;
...@@ -355,6 +358,19 @@ static int Demux( demux_t *p_demux ) ...@@ -355,6 +358,19 @@ static int Demux( demux_t *p_demux )
default: default:
if( (i_id = ps_pkt_id( p_pkt )) >= 0xc0 ) if( (i_id = ps_pkt_id( p_pkt )) >= 0xc0 )
{ {
/* Small heuristic to improve MLP detection from AOB */
if( i_id == 0xa001 &&
p_sys->i_aob_mlp_count < 500 )
{
p_sys->i_aob_mlp_count++;
}
else if( i_id == 0xbda1 &&
p_sys->i_aob_mlp_count > 0 )
{
p_sys->i_aob_mlp_count--;
i_id = 0xa001;
}
bool b_new = false; bool b_new = false;
ps_track_t *tk = &p_sys->tk[PS_ID_TO_TK(i_id)]; ps_track_t *tk = &p_sys->tk[PS_ID_TO_TK(i_id)];
......
...@@ -229,7 +229,8 @@ static inline int ps_pkt_id( block_t *p_pkt ) ...@@ -229,7 +229,8 @@ static inline int ps_pkt_id( block_t *p_pkt )
if( (i_sub_id & 0xfe) == 0xa0 && if( (i_sub_id & 0xfe) == 0xa0 &&
p_pkt->i_buffer >= i_start + 7 && p_pkt->i_buffer >= i_start + 7 &&
p_pkt->p_buffer[i_start + 6] != 0x80 ) ( p_pkt->p_buffer[i_start + 5] >= 0xc0 ||
p_pkt->p_buffer[i_start + 6] != 0x80 ) )
{ {
/* AOB LPCM/MLP extension /* AOB LPCM/MLP extension
* XXX for MLP I think that the !=0x80 test is not good and * XXX for MLP I think that the !=0x80 test is not good and
...@@ -485,7 +486,8 @@ static inline int ps_pkt_parse_pes( block_t *p_pes, int i_skip_extra ) ...@@ -485,7 +486,8 @@ static inline int ps_pkt_parse_pes( block_t *p_pes, int i_skip_extra )
if( i_skip_extra >= 0 ) if( i_skip_extra >= 0 )
i_skip += i_skip_extra; i_skip += i_skip_extra;
else if( p_pes->i_buffer > i_skip + 3 && ps_pkt_id( p_pes ) == 0xa001 ) else if( p_pes->i_buffer > i_skip + 3 &&
( ps_pkt_id( p_pes ) == 0xa001 || ps_pkt_id( p_pes ) == 0xbda1 ) )
i_skip += 4 + p_pes->p_buffer[i_skip+3]; i_skip += 4 + p_pes->p_buffer[i_skip+3];
if( p_pes->i_buffer <= i_skip ) if( p_pes->i_buffer <= i_skip )
......
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