vlc | branch: master | Francois Cartegnie <[email protected]> | Mon Jun 3 15:18:28 2019 +0200| [40efcd42a7cf585322b96ebd4eab836e229d9b0d] | committer: Francois Cartegnie
access: cdrom: parse cdtext blockinfo > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=40efcd42a7cf585322b96ebd4eab836e229d9b0d --- modules/access/vcd/cdrom.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/modules/access/vcd/cdrom.c b/modules/access/vcd/cdrom.c index 129949aadd..04b9627fc0 100644 --- a/modules/access/vcd/cdrom.c +++ b/modules/access/vcd/cdrom.c @@ -1209,6 +1209,32 @@ static int CdTextParse( vlc_meta_t ***ppp_tracks, int *pi_tracks, p_buffer += 4; i_buffer -= 4; + /* block size information is split in a sequence of 3 */ + const uint8_t *bsznfopayl[3] = { NULL, NULL, NULL }; + for( int i = 0; i < i_buffer/CDTEXT_PACK_SIZE; i++ ) + { + const uint8_t *p_pack = &p_buffer[CDTEXT_PACK_SIZE*i]; + const uint8_t i_block_number = (p_pack[3] >> 4) & 0x07; + if( i_block_number > 0 ) + continue; + if( p_pack[0] == 0x8f ) + { + const int i_track = p_pack[1] & 0x7f; + /* can't be higher than 3 blocks */ + if( i_track > 2 ) + return -1; + /* duplicate should not happen */ + if( bsznfopayl[i_track] != NULL ) + return -1; + /* point to payload (12) */ + bsznfopayl[i_track] = &p_pack[CDTEXT_PACK_HEADER]; + } + } + /* incomplete ? */ + if( (!bsznfopayl[0] ^ !bsznfopayl[1]) || + (!bsznfopayl[1] ^ !bsznfopayl[2]) ) + return -1; + memset( pppsz_info, 0, sizeof(pppsz_info) ); for( int i = 0; i < i_buffer/CDTEXT_PACK_SIZE; i++ ) _______________________________________________ vlc-commits mailing list [email protected] https://mailman.videolan.org/listinfo/vlc-commits
