@ -53,6 +53,7 @@
# include "avformat.h"
# include "avio_internal.h"
# include "dovi_isom.h"
# include "internal.h"
# include "isom.h"
# include "matroska.h"
@ -239,6 +240,13 @@ typedef struct MatroskaTrackOperation {
EbmlList combine_planes ;
} MatroskaTrackOperation ;
typedef struct MatroskaBlockAdditionMapping {
uint64_t value ;
char * name ;
uint64_t type ;
EbmlBin extradata ;
} MatroskaBlockAdditionMapping ;
typedef struct MatroskaTrack {
uint64_t num ;
uint64_t uid ;
@ -269,6 +277,7 @@ typedef struct MatroskaTrack {
int ms_compat ;
int needs_decoding ;
uint64_t max_block_additional_id ;
EbmlList block_addition_mappings ;
uint32_t palette [ AVPALETTE_COUNT ] ;
int has_palette ;
@ -419,8 +428,8 @@ typedef struct MatroskaDemuxContext {
// incomplete type (6.7.2 in C90, 6.9.2 in C99).
// Removing the sizes breaks MSVC.
static EbmlSyntax ebml_syntax [ 3 ] , matroska_segment [ 9 ] , matroska_track_video_color [ 15 ] , matroska_track_video [ 19 ] ,
matroska_track [ 32 ] , matroska_track_encoding [ 6 ] , matroska_track_encodings [ 2 ] ,
matroska_track_combine_planes [ 2 ] , matroska_track_operation [ 2 ] , matroska_tracks [ 2 ] ,
matroska_track [ 33 ] , matroska_track_encoding [ 6 ] , matroska_track_encodings [ 2 ] ,
matroska_track_combine_planes [ 2 ] , matroska_track_operation [ 2 ] , matroska_block_addition_mapping [ 5 ] , matroska_ tracks [ 2 ] ,
matroska_attachments [ 2 ] , matroska_chapter_entry [ 9 ] , matroska_chapter [ 6 ] , matroska_chapters [ 2 ] ,
matroska_index_entry [ 3 ] , matroska_index [ 2 ] , matroska_tag [ 3 ] , matroska_tags [ 2 ] , matroska_seekhead [ 2 ] ,
matroska_blockadditions [ 2 ] , matroska_blockgroup [ 8 ] , matroska_cluster_parsing [ 8 ] ;
@ -570,6 +579,14 @@ static EbmlSyntax matroska_track_operation[] = {
CHILD_OF ( matroska_track )
} ;
static EbmlSyntax matroska_block_addition_mapping [ ] = {
{ MATROSKA_ID_BLKADDIDVALUE , EBML_UINT , 0 , 0 , offsetof ( MatroskaBlockAdditionMapping , value ) } ,
{ MATROSKA_ID_BLKADDIDNAME , EBML_STR , 0 , 0 , offsetof ( MatroskaBlockAdditionMapping , name ) } ,
{ MATROSKA_ID_BLKADDIDTYPE , EBML_UINT , 0 , 0 , offsetof ( MatroskaBlockAdditionMapping , type ) } ,
{ MATROSKA_ID_BLKADDIDEXTRADATA , EBML_BIN , 0 , 0 , offsetof ( MatroskaBlockAdditionMapping , extradata ) } ,
CHILD_OF ( matroska_track )
} ;
static EbmlSyntax matroska_track [ ] = {
{ MATROSKA_ID_TRACKNUMBER , EBML_UINT , 0 , 0 , offsetof ( MatroskaTrack , num ) } ,
{ MATROSKA_ID_TRACKNAME , EBML_UTF8 , 0 , 0 , offsetof ( MatroskaTrack , name ) } ,
@ -593,6 +610,7 @@ static EbmlSyntax matroska_track[] = {
{ MATROSKA_ID_TRACKOPERATION , EBML_NEST , 0 , 0 , offsetof ( MatroskaTrack , operation ) , { . n = matroska_track_operation } } ,
{ MATROSKA_ID_TRACKCONTENTENCODINGS , EBML_NEST , 0 , 0 , 0 , { . n = matroska_track_encodings } } ,
{ MATROSKA_ID_TRACKMAXBLKADDID , EBML_UINT , 0 , 0 , offsetof ( MatroskaTrack , max_block_additional_id ) , { . u = 0 } } ,
{ MATROSKA_ID_TRACKBLKADDMAPPING , EBML_NEST , 0 , sizeof ( MatroskaBlockAdditionMapping ) , offsetof ( MatroskaTrack , block_addition_mappings ) , { . n = matroska_block_addition_mapping } } ,
{ MATROSKA_ID_SEEKPREROLL , EBML_UINT , 0 , 0 , offsetof ( MatroskaTrack , seek_preroll ) , { . u = 0 } } ,
{ MATROSKA_ID_TRACKFLAGENABLED , EBML_NONE } ,
{ MATROSKA_ID_TRACKFLAGLACING , EBML_NONE } ,
@ -2311,6 +2329,38 @@ static int mkv_parse_video_projection(AVStream *st, const MatroskaTrack *track,
return 0 ;
}
static int mkv_parse_dvcc_dvvc ( AVFormatContext * s , AVStream * st , const MatroskaTrack * track ,
EbmlBin * bin )
{
return ff_isom_parse_dvcc_dvvc ( s , st , bin - > data , bin - > size ) ;
}
static int mkv_parse_block_addition_mappings ( AVFormatContext * s , AVStream * st , const MatroskaTrack * track )
{
const EbmlList * mappings_list = & track - > block_addition_mappings ;
MatroskaBlockAdditionMapping * mappings = mappings_list - > elem ;
int ret ;
for ( int i = 0 ; i < mappings_list - > nb_elem ; i + + ) {
MatroskaBlockAdditionMapping * mapping = & mappings [ i ] ;
switch ( mapping - > type ) {
case MKBETAG ( ' d ' , ' v ' , ' c ' , ' C ' ) :
case MKBETAG ( ' d ' , ' v ' , ' v ' , ' C ' ) :
if ( ( ret = mkv_parse_dvcc_dvvc ( s , st , track , & mapping - > extradata ) ) < 0 )
return ret ;
break ;
default :
av_log ( s , AV_LOG_DEBUG ,
" Unknown block additional mapping type 0x% " PRIx64 " , value % " PRIu64 " , name \" %s \" \n " ,
mapping - > type , mapping - > value , mapping - > name ? mapping - > name : " " ) ;
}
}
return 0 ;
}
static int get_qt_codec ( MatroskaTrack * track , uint32_t * fourcc , enum AVCodecID * codec_id )
{
const AVCodecTag * codec_tags ;
@ -2898,6 +2948,10 @@ static int matroska_parse_tracks(AVFormatContext *s)
if ( track - > flag_textdescriptions )
st - > disposition | = AV_DISPOSITION_DESCRIPTIONS ;
}
ret = mkv_parse_block_addition_mappings ( s , st , track ) ;
if ( ret < 0 )
return ret ;
}
return 0 ;