diff --git a/Source/Common/mp4/mp4_moov_trak_mdia_minf_stbl_stsd_xxxx_clap.cpp b/Source/Common/mp4/mp4_moov_trak_mdia_minf_stbl_stsd_xxxx_clap.cpp index fe1aca1..014915e 100644 --- a/Source/Common/mp4/mp4_moov_trak_mdia_minf_stbl_stsd_xxxx_clap.cpp +++ b/Source/Common/mp4/mp4_moov_trak_mdia_minf_stbl_stsd_xxxx_clap.cpp @@ -17,21 +17,23 @@ //--------------------------------------------------------------------------- void mp4_moov_trak_mdia_minf_stbl_stsd_xxxx_clap::Read_Internal() { - if (Global->moov_trak_mdia_minf_stbl_stsd_xxxx_clap) + Chunk.trak_Index=Global->moov_trak.size()-1; + + if (Global->moov_trak_mdia_minf_stbl_stsd_xxxx_clap.count(Chunk.trak_Index)) throw exception_read_block("2 moov trak mdia minf stbl stsd xxxx clap blocks"); - Global->moov_trak_mdia_minf_stbl_stsd_xxxx_clap=new global::block_moov_trak_mdia_minf_stbl_stsd_xxxx_clap(); + Global->moov_trak_mdia_minf_stbl_stsd_xxxx_clap[Chunk.trak_Index]=new global::block_moov_trak_mdia_minf_stbl_stsd_xxxx_clap(); Read_Internal_ReadAllInBuffer(); - Get_B4(Global->moov_trak_mdia_minf_stbl_stsd_xxxx_clap->Aperture_Width_Num); - Get_B4(Global->moov_trak_mdia_minf_stbl_stsd_xxxx_clap->Aperture_Width_Den); - Get_B4(Global->moov_trak_mdia_minf_stbl_stsd_xxxx_clap->Aperture_Height_Num); - Get_B4(Global->moov_trak_mdia_minf_stbl_stsd_xxxx_clap->Aperture_Height_Den); - Get_B4(Global->moov_trak_mdia_minf_stbl_stsd_xxxx_clap->Horizontal_Offset_Num); - Get_B4(Global->moov_trak_mdia_minf_stbl_stsd_xxxx_clap->Horizontal_Offset_Den); - Get_B4(Global->moov_trak_mdia_minf_stbl_stsd_xxxx_clap->Vertical_Offset_Num); - Get_B4(Global->moov_trak_mdia_minf_stbl_stsd_xxxx_clap->Vertical_Offset_Den); + Get_B4(Global->moov_trak_mdia_minf_stbl_stsd_xxxx_clap[Chunk.trak_Index]->Aperture_Width_Num); + Get_B4(Global->moov_trak_mdia_minf_stbl_stsd_xxxx_clap[Chunk.trak_Index]->Aperture_Width_Den); + Get_B4(Global->moov_trak_mdia_minf_stbl_stsd_xxxx_clap[Chunk.trak_Index]->Aperture_Height_Num); + Get_B4(Global->moov_trak_mdia_minf_stbl_stsd_xxxx_clap[Chunk.trak_Index]->Aperture_Height_Den); + Get_B4(Global->moov_trak_mdia_minf_stbl_stsd_xxxx_clap[Chunk.trak_Index]->Horizontal_Offset_Num); + Get_B4(Global->moov_trak_mdia_minf_stbl_stsd_xxxx_clap[Chunk.trak_Index]->Horizontal_Offset_Den); + Get_B4(Global->moov_trak_mdia_minf_stbl_stsd_xxxx_clap[Chunk.trak_Index]->Vertical_Offset_Num); + Get_B4(Global->moov_trak_mdia_minf_stbl_stsd_xxxx_clap[Chunk.trak_Index]->Vertical_Offset_Den); } //*************************************************************************** @@ -44,7 +46,7 @@ void mp4_moov_trak_mdia_minf_stbl_stsd_xxxx_clap::Modify_Internal() if (Chunk.Content.IsModified) return; - if (!Global->moov_trak_mdia_minf_stbl_stsd_xxxx_clap) + if (!Global->moov_trak_mdia_minf_stbl_stsd_xxxx_clap.count(Chunk.trak_Index)) { Chunk.Content.IsRemovable = true; return; @@ -56,14 +58,14 @@ void mp4_moov_trak_mdia_minf_stbl_stsd_xxxx_clap::Modify_Internal() Chunk.Content.Size = 32; Chunk.Content.Buffer = new int8u[Chunk.Content.Size]; - Put_B4(Global->moov_trak_mdia_minf_stbl_stsd_xxxx_clap->Aperture_Width_Num); - Put_B4(Global->moov_trak_mdia_minf_stbl_stsd_xxxx_clap->Aperture_Width_Den); - Put_B4(Global->moov_trak_mdia_minf_stbl_stsd_xxxx_clap->Aperture_Height_Num); - Put_B4(Global->moov_trak_mdia_minf_stbl_stsd_xxxx_clap->Aperture_Height_Den); - Put_B4(Global->moov_trak_mdia_minf_stbl_stsd_xxxx_clap->Horizontal_Offset_Num); - Put_B4(Global->moov_trak_mdia_minf_stbl_stsd_xxxx_clap->Horizontal_Offset_Den); - Put_B4(Global->moov_trak_mdia_minf_stbl_stsd_xxxx_clap->Vertical_Offset_Num); - Put_B4(Global->moov_trak_mdia_minf_stbl_stsd_xxxx_clap->Vertical_Offset_Den); + Put_B4(Global->moov_trak_mdia_minf_stbl_stsd_xxxx_clap[Chunk.trak_Index]->Aperture_Width_Num); + Put_B4(Global->moov_trak_mdia_minf_stbl_stsd_xxxx_clap[Chunk.trak_Index]->Aperture_Width_Den); + Put_B4(Global->moov_trak_mdia_minf_stbl_stsd_xxxx_clap[Chunk.trak_Index]->Aperture_Height_Num); + Put_B4(Global->moov_trak_mdia_minf_stbl_stsd_xxxx_clap[Chunk.trak_Index]->Aperture_Height_Den); + Put_B4(Global->moov_trak_mdia_minf_stbl_stsd_xxxx_clap[Chunk.trak_Index]->Horizontal_Offset_Num); + Put_B4(Global->moov_trak_mdia_minf_stbl_stsd_xxxx_clap[Chunk.trak_Index]->Horizontal_Offset_Den); + Put_B4(Global->moov_trak_mdia_minf_stbl_stsd_xxxx_clap[Chunk.trak_Index]->Vertical_Offset_Num); + Put_B4(Global->moov_trak_mdia_minf_stbl_stsd_xxxx_clap[Chunk.trak_Index]->Vertical_Offset_Den); Chunk.Content.IsModified=true; Chunk.Content.Size_IsModified=true; diff --git a/Source/Common/mp4/mp4_moov_trak_mdia_minf_stbl_stsd_xxxx_clli.cpp b/Source/Common/mp4/mp4_moov_trak_mdia_minf_stbl_stsd_xxxx_clli.cpp index c2d745b..3f8f856 100644 --- a/Source/Common/mp4/mp4_moov_trak_mdia_minf_stbl_stsd_xxxx_clli.cpp +++ b/Source/Common/mp4/mp4_moov_trak_mdia_minf_stbl_stsd_xxxx_clli.cpp @@ -18,18 +18,20 @@ //--------------------------------------------------------------------------- void mp4_moov_trak_mdia_minf_stbl_stsd_xxxx_clli::Read_Internal() { - if (Global->moov_trak_mdia_minf_stbl_stsd_xxxx_clli) + Chunk.trak_Index=Global->moov_trak.size()-1; + + if (Global->moov_trak_mdia_minf_stbl_stsd_xxxx_clli.count(Chunk.trak_Index)) throw exception_read_block("2 moov trak mdia minf stbl stsd xxxx clli blocks"); - Global->moov_trak_mdia_minf_stbl_stsd_xxxx_clli = new global::block_moov_trak_mdia_minf_stbl_stsd_xxxx_clli(); + Global->moov_trak_mdia_minf_stbl_stsd_xxxx_clli[Chunk.trak_Index] = new global::block_moov_trak_mdia_minf_stbl_stsd_xxxx_clli(); Read_Internal_ReadAllInBuffer(); int16u Temp; Get_B2(Temp); - Global->moov_trak_mdia_minf_stbl_stsd_xxxx_clli->maximum_content_light_level=(double)Temp; + Global->moov_trak_mdia_minf_stbl_stsd_xxxx_clli[Chunk.trak_Index]->maximum_content_light_level=(double)Temp; Get_B2(Temp); - Global->moov_trak_mdia_minf_stbl_stsd_xxxx_clli->maximum_frame_average_light_level=(double)Temp; + Global->moov_trak_mdia_minf_stbl_stsd_xxxx_clli[Chunk.trak_Index]->maximum_frame_average_light_level=(double)Temp; } //*************************************************************************** @@ -42,7 +44,7 @@ void mp4_moov_trak_mdia_minf_stbl_stsd_xxxx_clli::Modify_Internal() if (Chunk.Content.IsModified) return; - if (!Global->moov_trak_mdia_minf_stbl_stsd_xxxx_clli) + if (!Global->moov_trak_mdia_minf_stbl_stsd_xxxx_clli.count(Chunk.trak_Index)) { Chunk.Content.IsRemovable = true; return; @@ -54,8 +56,8 @@ void mp4_moov_trak_mdia_minf_stbl_stsd_xxxx_clli::Modify_Internal() Chunk.Content.Size = 4; Chunk.Content.Buffer = new int8u[Chunk.Content.Size]; - Put_B2((int16u)round(Global->moov_trak_mdia_minf_stbl_stsd_xxxx_clli->maximum_content_light_level)); - Put_B2((int16u)round(Global->moov_trak_mdia_minf_stbl_stsd_xxxx_clli->maximum_frame_average_light_level)); + Put_B2((int16u)round(Global->moov_trak_mdia_minf_stbl_stsd_xxxx_clli[Chunk.trak_Index]->maximum_content_light_level)); + Put_B2((int16u)round(Global->moov_trak_mdia_minf_stbl_stsd_xxxx_clli[Chunk.trak_Index]->maximum_frame_average_light_level)); Chunk.Content.IsModified=true; Chunk.Content.Size_IsModified=true; diff --git a/Source/Common/mp4/mp4_moov_trak_mdia_minf_stbl_stsd_xxxx_colr.cpp b/Source/Common/mp4/mp4_moov_trak_mdia_minf_stbl_stsd_xxxx_colr.cpp index e9fd1a8..dc1d4be 100644 --- a/Source/Common/mp4/mp4_moov_trak_mdia_minf_stbl_stsd_xxxx_colr.cpp +++ b/Source/Common/mp4/mp4_moov_trak_mdia_minf_stbl_stsd_xxxx_colr.cpp @@ -17,10 +17,12 @@ //--------------------------------------------------------------------------- void mp4_moov_trak_mdia_minf_stbl_stsd_xxxx_colr::Read_Internal() { - if (Global->moov_trak_mdia_minf_stbl_stsd_xxxx_colr) + Chunk.trak_Index=Global->moov_trak.size()-1; + + if (Global->moov_trak_mdia_minf_stbl_stsd_xxxx_colr.count(Chunk.trak_Index)) throw exception_read_block("2 moov trak mdia minf stbl stsd xxxx colr blocks"); - Global->moov_trak_mdia_minf_stbl_stsd_xxxx_colr=new global::block_moov_trak_mdia_minf_stbl_stsd_xxxx_colr(); + Global->moov_trak_mdia_minf_stbl_stsd_xxxx_colr[Chunk.trak_Index]=new global::block_moov_trak_mdia_minf_stbl_stsd_xxxx_colr(); Read_Internal_ReadAllInBuffer(); @@ -30,9 +32,9 @@ void mp4_moov_trak_mdia_minf_stbl_stsd_xxxx_colr::Read_Internal() if (Type!=0x6E636C63) //nclc throw exception_read_block("unsupported colr type"); - Get_B2(Global->moov_trak_mdia_minf_stbl_stsd_xxxx_colr->Primaries); - Get_B2(Global->moov_trak_mdia_minf_stbl_stsd_xxxx_colr->Transfer); - Get_B2(Global->moov_trak_mdia_minf_stbl_stsd_xxxx_colr->Matrix); + Get_B2(Global->moov_trak_mdia_minf_stbl_stsd_xxxx_colr[Chunk.trak_Index]->Primaries); + Get_B2(Global->moov_trak_mdia_minf_stbl_stsd_xxxx_colr[Chunk.trak_Index]->Transfer); + Get_B2(Global->moov_trak_mdia_minf_stbl_stsd_xxxx_colr[Chunk.trak_Index]->Matrix); } //*************************************************************************** @@ -45,7 +47,7 @@ void mp4_moov_trak_mdia_minf_stbl_stsd_xxxx_colr::Modify_Internal() if (Chunk.Content.IsModified) return; - if (!Global->moov_trak_mdia_minf_stbl_stsd_xxxx_colr) + if (!Global->moov_trak_mdia_minf_stbl_stsd_xxxx_colr.count(Chunk.trak_Index)) { Chunk.Content.IsRemovable = true; return; @@ -58,9 +60,9 @@ void mp4_moov_trak_mdia_minf_stbl_stsd_xxxx_colr::Modify_Internal() Chunk.Content.Buffer = new int8u[Chunk.Content.Size]; Put_B4(0x6E636C63); // nclc - Put_B2(Global->moov_trak_mdia_minf_stbl_stsd_xxxx_colr->Primaries); - Put_B2(Global->moov_trak_mdia_minf_stbl_stsd_xxxx_colr->Transfer); - Put_B2(Global->moov_trak_mdia_minf_stbl_stsd_xxxx_colr->Matrix); + Put_B2(Global->moov_trak_mdia_minf_stbl_stsd_xxxx_colr[Chunk.trak_Index]->Primaries); + Put_B2(Global->moov_trak_mdia_minf_stbl_stsd_xxxx_colr[Chunk.trak_Index]->Transfer); + Put_B2(Global->moov_trak_mdia_minf_stbl_stsd_xxxx_colr[Chunk.trak_Index]->Matrix); Chunk.Content.IsModified=true; Chunk.Content.Size_IsModified=true; diff --git a/Source/Common/mp4/mp4_moov_trak_mdia_minf_stbl_stsd_xxxx_fiel.cpp b/Source/Common/mp4/mp4_moov_trak_mdia_minf_stbl_stsd_xxxx_fiel.cpp index 8fabe6c..ffb0541 100644 --- a/Source/Common/mp4/mp4_moov_trak_mdia_minf_stbl_stsd_xxxx_fiel.cpp +++ b/Source/Common/mp4/mp4_moov_trak_mdia_minf_stbl_stsd_xxxx_fiel.cpp @@ -17,15 +17,17 @@ //--------------------------------------------------------------------------- void mp4_moov_trak_mdia_minf_stbl_stsd_xxxx_fiel::Read_Internal() { - if (Global->moov_trak_mdia_minf_stbl_stsd_xxxx_fiel) + Chunk.trak_Index=Global->moov_trak.size()-1; + + if (Global->moov_trak_mdia_minf_stbl_stsd_xxxx_fiel.count(Chunk.trak_Index)) throw exception_read_block("2 moov trak mdia minf stbl stsd xxxx fiel blocks"); - Global->moov_trak_mdia_minf_stbl_stsd_xxxx_fiel=new global::block_moov_trak_mdia_minf_stbl_stsd_xxxx_fiel(); + Global->moov_trak_mdia_minf_stbl_stsd_xxxx_fiel[Chunk.trak_Index]=new global::block_moov_trak_mdia_minf_stbl_stsd_xxxx_fiel(); Read_Internal_ReadAllInBuffer(); - Get_B1(Global->moov_trak_mdia_minf_stbl_stsd_xxxx_fiel->Fields); - Get_B1(Global->moov_trak_mdia_minf_stbl_stsd_xxxx_fiel->Detail); + Get_B1(Global->moov_trak_mdia_minf_stbl_stsd_xxxx_fiel[Chunk.trak_Index]->Fields); + Get_B1(Global->moov_trak_mdia_minf_stbl_stsd_xxxx_fiel[Chunk.trak_Index]->Detail); } //*************************************************************************** @@ -38,7 +40,7 @@ void mp4_moov_trak_mdia_minf_stbl_stsd_xxxx_fiel::Modify_Internal() if (Chunk.Content.IsModified) return; - if (!Global->moov_trak_mdia_minf_stbl_stsd_xxxx_fiel) + if (!Global->moov_trak_mdia_minf_stbl_stsd_xxxx_fiel.count(Chunk.trak_Index)) { Chunk.Content.IsRemovable = true; return; @@ -50,8 +52,8 @@ void mp4_moov_trak_mdia_minf_stbl_stsd_xxxx_fiel::Modify_Internal() Chunk.Content.Size = 2; Chunk.Content.Buffer = new int8u[Chunk.Content.Size]; - Put_B1(Global->moov_trak_mdia_minf_stbl_stsd_xxxx_fiel->Fields); - Put_B1(Global->moov_trak_mdia_minf_stbl_stsd_xxxx_fiel->Detail); + Put_B1(Global->moov_trak_mdia_minf_stbl_stsd_xxxx_fiel[Chunk.trak_Index]->Fields); + Put_B1(Global->moov_trak_mdia_minf_stbl_stsd_xxxx_fiel[Chunk.trak_Index]->Detail); Chunk.Content.IsModified=true; Chunk.Content.Size_IsModified=true; diff --git a/Source/Common/mp4/mp4_moov_trak_mdia_minf_stbl_stsd_xxxx_gama.cpp b/Source/Common/mp4/mp4_moov_trak_mdia_minf_stbl_stsd_xxxx_gama.cpp index db8c840..7493bb1 100644 --- a/Source/Common/mp4/mp4_moov_trak_mdia_minf_stbl_stsd_xxxx_gama.cpp +++ b/Source/Common/mp4/mp4_moov_trak_mdia_minf_stbl_stsd_xxxx_gama.cpp @@ -17,16 +17,18 @@ //--------------------------------------------------------------------------- void mp4_moov_trak_mdia_minf_stbl_stsd_xxxx_gama::Read_Internal() { - if (Global->moov_trak_mdia_minf_stbl_stsd_xxxx_gama) + Chunk.trak_Index=Global->moov_trak.size()-1; + + if (Global->moov_trak_mdia_minf_stbl_stsd_xxxx_gama.count(Chunk.trak_Index)) throw exception_read_block("2 moov trak mdia minf stbl stsd xxxx gama blocks"); - Global->moov_trak_mdia_minf_stbl_stsd_xxxx_gama=new global::block_moov_trak_mdia_minf_stbl_stsd_xxxx_gama(); + Global->moov_trak_mdia_minf_stbl_stsd_xxxx_gama[Chunk.trak_Index]=new global::block_moov_trak_mdia_minf_stbl_stsd_xxxx_gama(); Read_Internal_ReadAllInBuffer(); uint32_t Gamma; Get_B4(Gamma); - Global->moov_trak_mdia_minf_stbl_stsd_xxxx_gama->Gamma=((double)Gamma/(double)(1<<16)); + Global->moov_trak_mdia_minf_stbl_stsd_xxxx_gama[Chunk.trak_Index]->Gamma=((double)Gamma/(double)(1<<16)); } //*************************************************************************** @@ -39,7 +41,7 @@ void mp4_moov_trak_mdia_minf_stbl_stsd_xxxx_gama::Modify_Internal() if (Chunk.Content.IsModified) return; - if (!Global->moov_trak_mdia_minf_stbl_stsd_xxxx_gama) + if (!Global->moov_trak_mdia_minf_stbl_stsd_xxxx_gama.count(Chunk.trak_Index)) { Chunk.Content.IsRemovable = true; return; @@ -51,7 +53,7 @@ void mp4_moov_trak_mdia_minf_stbl_stsd_xxxx_gama::Modify_Internal() Chunk.Content.Size = 4; Chunk.Content.Buffer = new int8u[Chunk.Content.Size]; - Put_B4((uint32_t)(Global->moov_trak_mdia_minf_stbl_stsd_xxxx_gama->Gamma*(1<<16))); + Put_B4((uint32_t)(Global->moov_trak_mdia_minf_stbl_stsd_xxxx_gama[Chunk.trak_Index]->Gamma*(1<<16))); Chunk.Content.IsModified=true; Chunk.Content.Size_IsModified=true; diff --git a/Source/Common/mp4/mp4_moov_trak_mdia_minf_stbl_stsd_xxxx_mdcv.cpp b/Source/Common/mp4/mp4_moov_trak_mdia_minf_stbl_stsd_xxxx_mdcv.cpp index d46ae07..0d5d5ed 100644 --- a/Source/Common/mp4/mp4_moov_trak_mdia_minf_stbl_stsd_xxxx_mdcv.cpp +++ b/Source/Common/mp4/mp4_moov_trak_mdia_minf_stbl_stsd_xxxx_mdcv.cpp @@ -18,10 +18,12 @@ //--------------------------------------------------------------------------- void mp4_moov_trak_mdia_minf_stbl_stsd_xxxx_mdcv::Read_Internal() { - if (Global->moov_trak_mdia_minf_stbl_stsd_xxxx_mdcv) + Chunk.trak_Index=Global->moov_trak.size()-1; + + if (Global->moov_trak_mdia_minf_stbl_stsd_xxxx_mdcv.count(Chunk.trak_Index)) throw exception_read_block("2 moov trak mdia minf stbl stsd xxxx mdcv blocks"); - Global->moov_trak_mdia_minf_stbl_stsd_xxxx_mdcv = new global::block_moov_trak_mdia_minf_stbl_stsd_xxxx_mdcv(); + Global->moov_trak_mdia_minf_stbl_stsd_xxxx_mdcv[Chunk.trak_Index] = new global::block_moov_trak_mdia_minf_stbl_stsd_xxxx_mdcv(); Read_Internal_ReadAllInBuffer(); @@ -29,14 +31,14 @@ void mp4_moov_trak_mdia_minf_stbl_stsd_xxxx_mdcv::Read_Internal() { int16u Temp; Get_B2(Temp); - Global->moov_trak_mdia_minf_stbl_stsd_xxxx_mdcv->Primaries[c] = (double)Temp/50000; + Global->moov_trak_mdia_minf_stbl_stsd_xxxx_mdcv[Chunk.trak_Index]->Primaries[c] = (double)Temp/50000; } int32u Temp; Get_B4(Temp); - Global->moov_trak_mdia_minf_stbl_stsd_xxxx_mdcv->Luminance[0] = (double)Temp/10000; + Global->moov_trak_mdia_minf_stbl_stsd_xxxx_mdcv[Chunk.trak_Index]->Luminance[0] = (double)Temp/10000; Get_B4(Temp); - Global->moov_trak_mdia_minf_stbl_stsd_xxxx_mdcv->Luminance[1] = (double)Temp/10000; + Global->moov_trak_mdia_minf_stbl_stsd_xxxx_mdcv[Chunk.trak_Index]->Luminance[1] = (double)Temp/10000; } //*************************************************************************** @@ -49,7 +51,7 @@ void mp4_moov_trak_mdia_minf_stbl_stsd_xxxx_mdcv::Modify_Internal() if (Chunk.Content.IsModified) return; - if (!Global->moov_trak_mdia_minf_stbl_stsd_xxxx_mdcv) + if (!Global->moov_trak_mdia_minf_stbl_stsd_xxxx_mdcv.count(Chunk.trak_Index)) { Chunk.Content.IsRemovable = true; return; @@ -62,10 +64,10 @@ void mp4_moov_trak_mdia_minf_stbl_stsd_xxxx_mdcv::Modify_Internal() Chunk.Content.Buffer = new int8u[Chunk.Content.Size]; for (size_t c = 0; c < 8; c++) - Put_B2((int16u)round(Global->moov_trak_mdia_minf_stbl_stsd_xxxx_mdcv->Primaries[c]*50000)); + Put_B2((int16u)round(Global->moov_trak_mdia_minf_stbl_stsd_xxxx_mdcv[Chunk.trak_Index]->Primaries[c]*50000)); - Put_B4((int32u)round(Global->moov_trak_mdia_minf_stbl_stsd_xxxx_mdcv->Luminance[0]*10000)); - Put_B4((int32u)round(Global->moov_trak_mdia_minf_stbl_stsd_xxxx_mdcv->Luminance[1]*10000)); + Put_B4((int32u)round(Global->moov_trak_mdia_minf_stbl_stsd_xxxx_mdcv[Chunk.trak_Index]->Luminance[0]*10000)); + Put_B4((int32u)round(Global->moov_trak_mdia_minf_stbl_stsd_xxxx_mdcv[Chunk.trak_Index]->Luminance[1]*10000)); Chunk.Content.IsModified=true; Chunk.Content.Size_IsModified=true; diff --git a/Source/Common/mp4/mp4_moov_trak_mdia_minf_stbl_stsd_xxxx_pasp.cpp b/Source/Common/mp4/mp4_moov_trak_mdia_minf_stbl_stsd_xxxx_pasp.cpp index 1ffd1c9..216ee44 100644 --- a/Source/Common/mp4/mp4_moov_trak_mdia_minf_stbl_stsd_xxxx_pasp.cpp +++ b/Source/Common/mp4/mp4_moov_trak_mdia_minf_stbl_stsd_xxxx_pasp.cpp @@ -17,15 +17,17 @@ //--------------------------------------------------------------------------- void mp4_moov_trak_mdia_minf_stbl_stsd_xxxx_pasp::Read_Internal() { - if (Global->moov_trak_mdia_minf_stbl_stsd_xxxx_pasp) + Chunk.trak_Index=Global->moov_trak.size()-1; + + if (Global->moov_trak_mdia_minf_stbl_stsd_xxxx_pasp.count(Chunk.trak_Index)) throw exception_read_block("2 moov trak mdia minf stbl stsd xxxx pasp blocks"); - Global->moov_trak_mdia_minf_stbl_stsd_xxxx_pasp=new global::block_moov_trak_mdia_minf_stbl_stsd_xxxx_pasp(); + Global->moov_trak_mdia_minf_stbl_stsd_xxxx_pasp[Chunk.trak_Index]=new global::block_moov_trak_mdia_minf_stbl_stsd_xxxx_pasp(); Read_Internal_ReadAllInBuffer(); - Get_B4(Global->moov_trak_mdia_minf_stbl_stsd_xxxx_pasp->hSpacing); - Get_B4(Global->moov_trak_mdia_minf_stbl_stsd_xxxx_pasp->vSpacing); + Get_B4(Global->moov_trak_mdia_minf_stbl_stsd_xxxx_pasp[Chunk.trak_Index]->hSpacing); + Get_B4(Global->moov_trak_mdia_minf_stbl_stsd_xxxx_pasp[Chunk.trak_Index]->vSpacing); } //*************************************************************************** @@ -38,7 +40,7 @@ void mp4_moov_trak_mdia_minf_stbl_stsd_xxxx_pasp::Modify_Internal() if (Chunk.Content.IsModified) return; - if (!Global->moov_trak_mdia_minf_stbl_stsd_xxxx_pasp) + if (!Global->moov_trak_mdia_minf_stbl_stsd_xxxx_pasp.count(Chunk.trak_Index)) { Chunk.Content.IsRemovable = true; return; @@ -50,8 +52,8 @@ void mp4_moov_trak_mdia_minf_stbl_stsd_xxxx_pasp::Modify_Internal() Chunk.Content.Size = 8; Chunk.Content.Buffer = new int8u[Chunk.Content.Size]; - Put_B4(Global->moov_trak_mdia_minf_stbl_stsd_xxxx_pasp->hSpacing); - Put_B4(Global->moov_trak_mdia_minf_stbl_stsd_xxxx_pasp->vSpacing); + Put_B4(Global->moov_trak_mdia_minf_stbl_stsd_xxxx_pasp[Chunk.trak_Index]->hSpacing); + Put_B4(Global->moov_trak_mdia_minf_stbl_stsd_xxxx_pasp[Chunk.trak_Index]->vSpacing); Chunk.Content.IsModified=true; Chunk.Content.Size_IsModified=true; diff --git a/Source/Common/mp4/mp4_moov_trak_tapt_xxxx.cpp b/Source/Common/mp4/mp4_moov_trak_tapt_xxxx.cpp index 95793dc..127c628 100644 --- a/Source/Common/mp4/mp4_moov_trak_tapt_xxxx.cpp +++ b/Source/Common/mp4/mp4_moov_trak_tapt_xxxx.cpp @@ -18,10 +18,12 @@ #define mp4_moov_trak_tapt_(name) \ void mp4_moov_trak_tapt_##name::Read_Internal() \ { \ - if (Global->moov_trak_tapt_##name) \ + Chunk.trak_Index=Global->moov_trak.size()-1;\ +\ + if (Global->moov_trak_tapt_##name.count(Chunk.trak_Index)) \ throw exception_read_block("2 moov trak tapt " #name " blocks"); \ \ - Global->moov_trak_tapt_##name=new global::block_moov_trak_tapt_xxxx(); \ + Global->moov_trak_tapt_##name[Chunk.trak_Index]=new global::block_moov_trak_tapt_xxxx(); \ \ Read_Internal_ReadAllInBuffer(); \ \ @@ -31,9 +33,9 @@ void mp4_moov_trak_tapt_##name::Read_Internal() \ \ uint32_t Width, Height; \ Get_B4(Width); \ - Global->moov_trak_tapt_##name->Width=((double)Width/(double)(1<<16)); \ + Global->moov_trak_tapt_##name[Chunk.trak_Index]->Width=((double)Width/(double)(1<<16)); \ Get_B4(Height); \ - Global->moov_trak_tapt_##name->Height=((double)Height/(double)(1<<16)); \ + Global->moov_trak_tapt_##name[Chunk.trak_Index]->Height=((double)Height/(double)(1<<16)); \ } \ \ void mp4_moov_trak_tapt_##name::Modify_Internal() \ @@ -41,7 +43,7 @@ void mp4_moov_trak_tapt_##name::Modify_Internal() \ if (Chunk.Content.IsModified) \ return; \ \ - if (!Global->moov_trak_tapt_##name) \ + if (!Global->moov_trak_tapt_##name.count(Chunk.trak_Index)) \ { \ Chunk.Content.IsRemovable = true; \ return; \ @@ -55,8 +57,8 @@ void mp4_moov_trak_tapt_##name::Modify_Internal() \ \ Put_B1(0x00); \ Put_B3(0x000000); \ - Put_B4((uint32_t)(Global->moov_trak_tapt_##name->Width*(1<<16))); \ - Put_B4((uint32_t)(Global->moov_trak_tapt_##name->Height*(1<<16))); \ + Put_B4((uint32_t)(Global->moov_trak_tapt_##name[Chunk.trak_Index]->Width*(1<<16))); \ + Put_B4((uint32_t)(Global->moov_trak_tapt_##name[Chunk.trak_Index]->Height*(1<<16))); \ \ Chunk.Content.IsModified=true; \ Chunk.Content.Size_IsModified=true; \ diff --git a/Source/Common/mp4_Base.h b/Source/Common/mp4_Base.h index 1cd6e1f..b778146 100644 --- a/Source/Common/mp4_Base.h +++ b/Source/Common/mp4_Base.h @@ -431,26 +431,26 @@ class mp4_Base block_mdat *mdat; vector moov; vector moov_trak; - block_moov_trak_tapt_xxxx* moov_trak_tapt_clef; - bool moov_trak_tapt_clef_Modified; - block_moov_trak_tapt_xxxx* moov_trak_tapt_prof; - bool moov_trak_tapt_prof_Modified; - block_moov_trak_tapt_xxxx* moov_trak_tapt_enof; - bool moov_trak_tapt_enof_Modified; - block_moov_trak_mdia_minf_stbl_stsd_xxxx_clap* moov_trak_mdia_minf_stbl_stsd_xxxx_clap; - bool moov_trak_mdia_minf_stbl_stsd_xxxx_clap_Modified; - block_moov_trak_mdia_minf_stbl_stsd_xxxx_colr* moov_trak_mdia_minf_stbl_stsd_xxxx_colr; - bool moov_trak_mdia_minf_stbl_stsd_xxxx_colr_Modified; - block_moov_trak_mdia_minf_stbl_stsd_xxxx_fiel* moov_trak_mdia_minf_stbl_stsd_xxxx_fiel; - bool moov_trak_mdia_minf_stbl_stsd_xxxx_fiel_Modified; - block_moov_trak_mdia_minf_stbl_stsd_xxxx_gama* moov_trak_mdia_minf_stbl_stsd_xxxx_gama; - bool moov_trak_mdia_minf_stbl_stsd_xxxx_gama_Modified; - block_moov_trak_mdia_minf_stbl_stsd_xxxx_pasp* moov_trak_mdia_minf_stbl_stsd_xxxx_pasp; - bool moov_trak_mdia_minf_stbl_stsd_xxxx_pasp_Modified; - block_moov_trak_mdia_minf_stbl_stsd_xxxx_mdcv* moov_trak_mdia_minf_stbl_stsd_xxxx_mdcv; - bool moov_trak_mdia_minf_stbl_stsd_xxxx_mdcv_Modified; - block_moov_trak_mdia_minf_stbl_stsd_xxxx_clli* moov_trak_mdia_minf_stbl_stsd_xxxx_clli; - bool moov_trak_mdia_minf_stbl_stsd_xxxx_clli_Modified; + map moov_trak_tapt_clef; + bool moov_trak_tapt_clef_Modified; // For FirstVideoIndex + map moov_trak_tapt_prof; + bool moov_trak_tapt_prof_Modified; // For FirstVideoIndex + map moov_trak_tapt_enof; + bool moov_trak_tapt_enof_Modified; // For FirstVideoIndex + map moov_trak_mdia_minf_stbl_stsd_xxxx_clap; + bool moov_trak_mdia_minf_stbl_stsd_xxxx_clap_Modified; // For FirstVideoIndex + map moov_trak_mdia_minf_stbl_stsd_xxxx_colr; + bool moov_trak_mdia_minf_stbl_stsd_xxxx_colr_Modified; // For FirstVideoIndex + map moov_trak_mdia_minf_stbl_stsd_xxxx_fiel; + bool moov_trak_mdia_minf_stbl_stsd_xxxx_fiel_Modified; // For FirstVideoIndex + map moov_trak_mdia_minf_stbl_stsd_xxxx_gama; + bool moov_trak_mdia_minf_stbl_stsd_xxxx_gama_Modified; // For FirstVideoIndex + map moov_trak_mdia_minf_stbl_stsd_xxxx_pasp; + bool moov_trak_mdia_minf_stbl_stsd_xxxx_pasp_Modified; // For FirstVideoIndex + map moov_trak_mdia_minf_stbl_stsd_xxxx_mdcv; + bool moov_trak_mdia_minf_stbl_stsd_xxxx_mdcv_Modified; // For FirstVideoIndex + map moov_trak_mdia_minf_stbl_stsd_xxxx_clli; + bool moov_trak_mdia_minf_stbl_stsd_xxxx_clli_Modified; // For FirstVideoIndex map moov_trak_mdia_minf_stbl_stsd_xxxx_chan; bool moov_trak_mdia_minf_stbl_stsd_xxxx_chan_Modified; map moov_trak_mdia_mdhd; @@ -480,25 +480,15 @@ class mp4_Base { File_Size=0; mdat=NULL; - moov_trak_tapt_clef=NULL; moov_trak_tapt_clef_Modified=false; - moov_trak_tapt_prof=NULL; moov_trak_tapt_prof_Modified=false; - moov_trak_tapt_enof=NULL; moov_trak_tapt_enof_Modified=false; - moov_trak_mdia_minf_stbl_stsd_xxxx_clap=NULL; moov_trak_mdia_minf_stbl_stsd_xxxx_clap_Modified=false; - moov_trak_mdia_minf_stbl_stsd_xxxx_colr=NULL; moov_trak_mdia_minf_stbl_stsd_xxxx_colr_Modified=false; - moov_trak_mdia_minf_stbl_stsd_xxxx_fiel=NULL; moov_trak_mdia_minf_stbl_stsd_xxxx_fiel_Modified=false; - moov_trak_mdia_minf_stbl_stsd_xxxx_gama=NULL; moov_trak_mdia_minf_stbl_stsd_xxxx_gama_Modified=false; - moov_trak_mdia_minf_stbl_stsd_xxxx_pasp=NULL; moov_trak_mdia_minf_stbl_stsd_xxxx_pasp_Modified=false; - moov_trak_mdia_minf_stbl_stsd_xxxx_mdcv=NULL; moov_trak_mdia_minf_stbl_stsd_xxxx_mdcv_Modified=false; - moov_trak_mdia_minf_stbl_stsd_xxxx_clli=NULL; moov_trak_mdia_minf_stbl_stsd_xxxx_clli_Modified=false; moov_trak_mdia_minf_stbl_stsd_xxxx_chan_Modified=false; moov_trak_mdia_mdhd_Modified=false; @@ -524,16 +514,6 @@ class mp4_Base ~global() { delete mdat; - delete moov_trak_tapt_clef; - delete moov_trak_tapt_prof; - delete moov_trak_tapt_enof; - delete moov_trak_mdia_minf_stbl_stsd_xxxx_clap; - delete moov_trak_mdia_minf_stbl_stsd_xxxx_colr; - delete moov_trak_mdia_minf_stbl_stsd_xxxx_fiel; - delete moov_trak_mdia_minf_stbl_stsd_xxxx_gama; - delete moov_trak_mdia_minf_stbl_stsd_xxxx_pasp; - delete moov_trak_mdia_minf_stbl_stsd_xxxx_mdcv; - delete moov_trak_mdia_minf_stbl_stsd_xxxx_clli; delete moov_trak_tkhd; delete moov_meta_hdlr; delete moov_meta_ilst; @@ -542,12 +522,41 @@ class mp4_Base for (size_t Pos=0; Pos::iterator It=moov_trak_mdia_minf_stbl_stsd_xxxx_chan.begin(); - It!=moov_trak_mdia_minf_stbl_stsd_xxxx_chan.end(); It++) - delete It->second; + for (size_t Pos=0; Pos::iterator It=moov_trak_mdia_mdhd.begin(); It!=moov_trak_mdia_mdhd.end(); It++) - delete It->second; + for (size_t Pos=0; PosGlobal->moov_trak_tapt_clef) + if (Chunks->Global->moov_trak_FirstVideoIndex==(size_t)-1 || !Chunks->Global->moov_trak_tapt_clef.count(Chunks->Global->moov_trak_FirstVideoIndex)) return string(); - stringstream ss; ss << Chunks->Global->moov_trak_tapt_clef->Width << "x" << Chunks->Global->moov_trak_tapt_clef->Height; + stringstream ss; ss << Chunks->Global->moov_trak_tapt_clef[Chunks->Global->moov_trak_FirstVideoIndex]->Width << "x" + << Chunks->Global->moov_trak_tapt_clef[Chunks->Global->moov_trak_FirstVideoIndex]->Height; return ss.str(); } else if (Field=="prof") { - if (!Chunks->Global->moov_trak_tapt_prof) + if (Chunks->Global->moov_trak_FirstVideoIndex==(size_t)-1 || !Chunks->Global->moov_trak_tapt_prof.count(Chunks->Global->moov_trak_FirstVideoIndex)) return string(); - stringstream ss; ss << Chunks->Global->moov_trak_tapt_prof->Width << "x" << Chunks->Global->moov_trak_tapt_prof->Height; + stringstream ss; ss << Chunks->Global->moov_trak_tapt_prof[Chunks->Global->moov_trak_FirstVideoIndex]->Width << "x" + << Chunks->Global->moov_trak_tapt_prof[Chunks->Global->moov_trak_FirstVideoIndex]->Height; return ss.str(); } else if (Field=="enof") { - if (!Chunks->Global->moov_trak_tapt_enof) + if (Chunks->Global->moov_trak_FirstVideoIndex==(size_t)-1 || !Chunks->Global->moov_trak_tapt_enof.count(Chunks->Global->moov_trak_FirstVideoIndex)) return string(); - stringstream ss; ss << Chunks->Global->moov_trak_tapt_enof->Width << "x" << Chunks->Global->moov_trak_tapt_enof->Height; + stringstream ss; ss << Chunks->Global->moov_trak_tapt_enof[Chunks->Global->moov_trak_FirstVideoIndex]->Width << "x" + << Chunks->Global->moov_trak_tapt_enof[Chunks->Global->moov_trak_FirstVideoIndex]->Height; return ss.str(); } else if (Field=="fiel") { - if (!Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_fiel) + if (Chunks->Global->moov_trak_FirstVideoIndex==(size_t)-1 || !Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_fiel.count(Chunks->Global->moov_trak_FirstVideoIndex)) return string(); - stringstream ss; ss << (uint16_t)Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_fiel->Fields << "," - << (uint16_t)Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_fiel->Detail; + stringstream ss; ss << (uint16_t)Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_fiel[Chunks->Global->moov_trak_FirstVideoIndex]->Fields << "," + << (uint16_t)Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_fiel[Chunks->Global->moov_trak_FirstVideoIndex]->Detail; return ss.str(); } else if (Field=="colr") { - if (!Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_colr) + if (Chunks->Global->moov_trak_FirstVideoIndex==(size_t)-1 || !Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_colr.count(Chunks->Global->moov_trak_FirstVideoIndex)) return string(); - stringstream ss; ss << Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_colr->Primaries << "," - << Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_colr->Transfer << "," - << Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_colr->Matrix; + stringstream ss; ss << Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_colr[Chunks->Global->moov_trak_FirstVideoIndex]->Primaries << "," + << Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_colr[Chunks->Global->moov_trak_FirstVideoIndex]->Transfer << "," + << Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_colr[Chunks->Global->moov_trak_FirstVideoIndex]->Matrix; return ss.str(); } else if (Field=="gama") { - if (!Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_gama) + if (Chunks->Global->moov_trak_FirstVideoIndex==(size_t)-1 || !Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_gama.count(Chunks->Global->moov_trak_FirstVideoIndex)) return string(); - stringstream ss; ss << setprecision(3) << fixed << Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_gama->Gamma; + stringstream ss; ss << setprecision(3) << fixed << Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_gama[Chunks->Global->moov_trak_FirstVideoIndex]->Gamma; return ss.str(); } else if (Field=="pasp") { - if (!Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_pasp) + if (Chunks->Global->moov_trak_FirstVideoIndex==(size_t)-1 || !Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_pasp.count(Chunks->Global->moov_trak_FirstVideoIndex)) return string(); - stringstream ss; ss << Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_pasp->hSpacing << ":" - << Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_pasp->vSpacing; + stringstream ss; ss << Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_pasp[Chunks->Global->moov_trak_FirstVideoIndex]->hSpacing << ":" + << Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_pasp[Chunks->Global->moov_trak_FirstVideoIndex]->vSpacing; return ss.str(); } else if (Field=="display_primaries") { - if (!Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_mdcv) + if (Chunks->Global->moov_trak_FirstVideoIndex==(size_t)-1 || !Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_mdcv.count(Chunks->Global->moov_trak_FirstVideoIndex)) return string(); stringstream ss; - for (size_t c = 0; c < Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_mdcv->Primaries.size(); c++) - ss << (c ? "," : "") << setprecision(3) << fixed << Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_mdcv->Primaries[c]; + for (size_t c = 0; c < Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_mdcv[Chunks->Global->moov_trak_FirstVideoIndex]->Primaries.size(); c++) + ss << (c ? "," : "") << setprecision(3) << fixed << Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_mdcv[Chunks->Global->moov_trak_FirstVideoIndex]->Primaries[c]; return ss.str(); } else if (Field=="luminance") { - if (!Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_mdcv) + if (Chunks->Global->moov_trak_FirstVideoIndex==(size_t)-1 || !Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_mdcv.count(Chunks->Global->moov_trak_FirstVideoIndex)) return string(); stringstream ss; - ss << setprecision(4) << fixed << Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_mdcv->Luminance[0] << "," - << setprecision(4) << fixed << Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_mdcv->Luminance[1]; + ss << setprecision(4) << fixed << Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_mdcv[Chunks->Global->moov_trak_FirstVideoIndex]->Luminance[0] << "," + << setprecision(4) << fixed << Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_mdcv[Chunks->Global->moov_trak_FirstVideoIndex]->Luminance[1]; return ss.str(); } else if (Field=="maximum_content_light_level") { - if (!Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_clli) + if (Chunks->Global->moov_trak_FirstVideoIndex==(size_t)-1 || !Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_clli.count(Chunks->Global->moov_trak_FirstVideoIndex)) return string(); stringstream ss; - ss << setprecision(4) << fixed << round(Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_clli->maximum_content_light_level); + ss << setprecision(4) << fixed << round(Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_clli[Chunks->Global->moov_trak_FirstVideoIndex]->maximum_content_light_level); return ss.str(); } else if (Field=="maximum_frame_average_light_level") { - if (!Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_clli) + if (Chunks->Global->moov_trak_FirstVideoIndex==(size_t)-1 || !Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_clli.count(Chunks->Global->moov_trak_FirstVideoIndex)) return string(); stringstream ss; - ss << setprecision(4) << fixed << round(Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_clli->maximum_frame_average_light_level); + ss << setprecision(4) << fixed << round(Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_clli[Chunks->Global->moov_trak_FirstVideoIndex]->maximum_frame_average_light_level); return ss.str(); } @@ -969,22 +972,22 @@ string mp4_Handler::Get(const string &Field) } else if (Field=="clap") { - if (!Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_clap) + if (Chunks->Global->moov_trak_FirstVideoIndex==(size_t)-1 || !Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_clap.count(Chunks->Global->moov_trak_FirstVideoIndex)) return string(); stringstream ss; - ss << Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_clap->Aperture_Width_Num; - if (Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_clap->Aperture_Width_Den!=1) - ss << ":" << Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_clap->Aperture_Width_Den; - ss << "," << Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_clap->Aperture_Height_Num; - if (Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_clap->Aperture_Height_Den!=1) - ss << ":" << Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_clap->Aperture_Height_Den; - ss << "," << Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_clap->Horizontal_Offset_Num; - if (Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_clap->Horizontal_Offset_Den!=1) - ss << ":" << Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_clap->Horizontal_Offset_Den; - ss << "," << Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_clap->Vertical_Offset_Num; - if (Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_clap->Vertical_Offset_Den!=1) - ss << ":" << Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_clap->Vertical_Offset_Den; + ss << Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_clap[Chunks->Global->moov_trak_FirstVideoIndex]->Aperture_Width_Num; + if (Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_clap[Chunks->Global->moov_trak_FirstVideoIndex]->Aperture_Width_Den!=1) + ss << ":" << Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_clap[Chunks->Global->moov_trak_FirstVideoIndex]->Aperture_Width_Den; + ss << "," << Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_clap[Chunks->Global->moov_trak_FirstVideoIndex]->Aperture_Height_Num; + if (Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_clap[Chunks->Global->moov_trak_FirstVideoIndex]->Aperture_Height_Den!=1) + ss << ":" << Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_clap[Chunks->Global->moov_trak_FirstVideoIndex]->Aperture_Height_Den; + ss << "," << Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_clap[Chunks->Global->moov_trak_FirstVideoIndex]->Horizontal_Offset_Num; + if (Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_clap[Chunks->Global->moov_trak_FirstVideoIndex]->Horizontal_Offset_Den!=1) + ss << ":" << Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_clap[Chunks->Global->moov_trak_FirstVideoIndex]->Horizontal_Offset_Den; + ss << "," << Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_clap[Chunks->Global->moov_trak_FirstVideoIndex]->Vertical_Offset_Num; + if (Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_clap[Chunks->Global->moov_trak_FirstVideoIndex]->Vertical_Offset_Den!=1) + ss << ":" << Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_clap[Chunks->Global->moov_trak_FirstVideoIndex]->Vertical_Offset_Den; return ss.str(); } @@ -1089,29 +1092,38 @@ bool mp4_Handler::Set(const string &Field, const string &Value, bool Simulate) if (!Simulate && Field=="clef") { - if (!Chunks->Global->moov_trak_tapt_clef) - Chunks->Global->moov_trak_tapt_clef=new mp4_Base::global::block_moov_trak_tapt_xxxx(); + if (Chunks->Global->moov_trak_FirstVideoIndex==(size_t)-1) + return false; + + if (!Chunks->Global->moov_trak_tapt_clef.count(Chunks->Global->moov_trak_FirstVideoIndex)) + Chunks->Global->moov_trak_tapt_clef[Chunks->Global->moov_trak_FirstVideoIndex]=new mp4_Base::global::block_moov_trak_tapt_xxxx(); - Chunks->Global->moov_trak_tapt_clef->Width=Width; - Chunks->Global->moov_trak_tapt_clef->Height=Height; + Chunks->Global->moov_trak_tapt_clef[Chunks->Global->moov_trak_FirstVideoIndex]->Width=Width; + Chunks->Global->moov_trak_tapt_clef[Chunks->Global->moov_trak_FirstVideoIndex]->Height=Height; Chunks->Global->moov_trak_tapt_clef_Modified=true; } else if (!Simulate && Field=="prof") { - if (!Chunks->Global->moov_trak_tapt_prof) - Chunks->Global->moov_trak_tapt_prof=new mp4_Base::global::block_moov_trak_tapt_xxxx(); + if (Chunks->Global->moov_trak_FirstVideoIndex==(size_t)-1) + return false; - Chunks->Global->moov_trak_tapt_prof->Width=Width; - Chunks->Global->moov_trak_tapt_prof->Height=Height; + if (!Chunks->Global->moov_trak_tapt_prof.count(Chunks->Global->moov_trak_FirstVideoIndex)) + Chunks->Global->moov_trak_tapt_prof[Chunks->Global->moov_trak_FirstVideoIndex]=new mp4_Base::global::block_moov_trak_tapt_xxxx(); + + Chunks->Global->moov_trak_tapt_prof[Chunks->Global->moov_trak_FirstVideoIndex]->Width=Width; + Chunks->Global->moov_trak_tapt_prof[Chunks->Global->moov_trak_FirstVideoIndex]->Height=Height; Chunks->Global->moov_trak_tapt_prof_Modified=true; } else if (!Simulate && Field=="enof") { - if (!Chunks->Global->moov_trak_tapt_enof) - Chunks->Global->moov_trak_tapt_enof=new mp4_Base::global::block_moov_trak_tapt_xxxx(); + if (Chunks->Global->moov_trak_FirstVideoIndex==(size_t)-1) + return false; - Chunks->Global->moov_trak_tapt_enof->Width=Width; - Chunks->Global->moov_trak_tapt_enof->Height=Height; + if (!Chunks->Global->moov_trak_tapt_enof.count(Chunks->Global->moov_trak_FirstVideoIndex)) + Chunks->Global->moov_trak_tapt_enof[Chunks->Global->moov_trak_FirstVideoIndex]=new mp4_Base::global::block_moov_trak_tapt_xxxx(); + + Chunks->Global->moov_trak_tapt_enof[Chunks->Global->moov_trak_FirstVideoIndex]->Width=Width; + Chunks->Global->moov_trak_tapt_enof[Chunks->Global->moov_trak_FirstVideoIndex]->Height=Height; Chunks->Global->moov_trak_tapt_enof_Modified=true; } return true; @@ -1127,11 +1139,11 @@ bool mp4_Handler::Set(const string &Field, const string &Value, bool Simulate) if (!Simulate) { - if (!Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_fiel) - Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_fiel=new mp4_Base::global::block_moov_trak_mdia_minf_stbl_stsd_xxxx_fiel(); + if (!Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_fiel.count(Chunks->Global->moov_trak_FirstVideoIndex)) + Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_fiel[Chunks->Global->moov_trak_FirstVideoIndex]=new mp4_Base::global::block_moov_trak_mdia_minf_stbl_stsd_xxxx_fiel(); - Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_fiel->Fields=Fields; - Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_fiel->Detail=Detail; + Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_fiel[Chunks->Global->moov_trak_FirstVideoIndex]->Fields=Fields; + Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_fiel[Chunks->Global->moov_trak_FirstVideoIndex]->Detail=Detail; Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_fiel_Modified=true; } return true; @@ -1148,12 +1160,12 @@ bool mp4_Handler::Set(const string &Field, const string &Value, bool Simulate) if (!Simulate) { - if (!Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_colr) - Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_colr=new mp4_Base::global::block_moov_trak_mdia_minf_stbl_stsd_xxxx_colr(); + if (!Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_colr.count(Chunks->Global->moov_trak_FirstVideoIndex)) + Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_colr[Chunks->Global->moov_trak_FirstVideoIndex]=new mp4_Base::global::block_moov_trak_mdia_minf_stbl_stsd_xxxx_colr(); - Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_colr->Primaries=Primaries; - Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_colr->Transfer=Transfer; - Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_colr->Matrix=Matrix; + Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_colr[Chunks->Global->moov_trak_FirstVideoIndex]->Primaries=Primaries; + Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_colr[Chunks->Global->moov_trak_FirstVideoIndex]->Transfer=Transfer; + Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_colr[Chunks->Global->moov_trak_FirstVideoIndex]->Matrix=Matrix; Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_colr_Modified=true; } return true; @@ -1169,10 +1181,10 @@ bool mp4_Handler::Set(const string &Field, const string &Value, bool Simulate) if (!Simulate) { - if (!Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_gama) - Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_gama=new mp4_Base::global::block_moov_trak_mdia_minf_stbl_stsd_xxxx_gama(); + if (!Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_gama.count(Chunks->Global->moov_trak_FirstVideoIndex)) + Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_gama[Chunks->Global->moov_trak_FirstVideoIndex]=new mp4_Base::global::block_moov_trak_mdia_minf_stbl_stsd_xxxx_gama(); - Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_gama->Gamma=Gamma; + Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_gama[Chunks->Global->moov_trak_FirstVideoIndex]->Gamma=Gamma; Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_gama_Modified=true; } return true; @@ -1188,11 +1200,11 @@ bool mp4_Handler::Set(const string &Field, const string &Value, bool Simulate) if (!Simulate) { - if (!Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_pasp) - Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_pasp=new mp4_Base::global::block_moov_trak_mdia_minf_stbl_stsd_xxxx_pasp(); + if (!Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_pasp.count(Chunks->Global->moov_trak_FirstVideoIndex)) + Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_pasp[Chunks->Global->moov_trak_FirstVideoIndex]=new mp4_Base::global::block_moov_trak_mdia_minf_stbl_stsd_xxxx_pasp(); - Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_pasp->hSpacing=hSpacing; - Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_pasp->vSpacing=vSpacing; + Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_pasp[Chunks->Global->moov_trak_FirstVideoIndex]->hSpacing=hSpacing; + Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_pasp[Chunks->Global->moov_trak_FirstVideoIndex]->vSpacing=vSpacing; Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_pasp_Modified=true; } return true; @@ -1208,17 +1220,17 @@ bool mp4_Handler::Set(const string &Field, const string &Value, bool Simulate) if (!Simulate) { - if (!Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_mdcv) - Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_mdcv=new mp4_Base::global::block_moov_trak_mdia_minf_stbl_stsd_xxxx_mdcv(); - - Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_mdcv->Primaries[0]=x1; - Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_mdcv->Primaries[1]=y1; - Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_mdcv->Primaries[2]=x2; - Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_mdcv->Primaries[3]=y2; - Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_mdcv->Primaries[4]=x3; - Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_mdcv->Primaries[5]=y3; - Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_mdcv->Primaries[6]=wp_x; - Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_mdcv->Primaries[7]=wp_y; + if (!Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_mdcv.count(Chunks->Global->moov_trak_FirstVideoIndex)) + Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_mdcv[Chunks->Global->moov_trak_FirstVideoIndex]=new mp4_Base::global::block_moov_trak_mdia_minf_stbl_stsd_xxxx_mdcv(); + + Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_mdcv[Chunks->Global->moov_trak_FirstVideoIndex]->Primaries[0]=x1; + Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_mdcv[Chunks->Global->moov_trak_FirstVideoIndex]->Primaries[1]=y1; + Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_mdcv[Chunks->Global->moov_trak_FirstVideoIndex]->Primaries[2]=x2; + Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_mdcv[Chunks->Global->moov_trak_FirstVideoIndex]->Primaries[3]=y2; + Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_mdcv[Chunks->Global->moov_trak_FirstVideoIndex]->Primaries[4]=x3; + Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_mdcv[Chunks->Global->moov_trak_FirstVideoIndex]->Primaries[5]=y3; + Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_mdcv[Chunks->Global->moov_trak_FirstVideoIndex]->Primaries[6]=wp_x; + Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_mdcv[Chunks->Global->moov_trak_FirstVideoIndex]->Primaries[7]=wp_y; Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_mdcv_Modified=true; } return true; @@ -1237,16 +1249,16 @@ bool mp4_Handler::Set(const string &Field, const string &Value, bool Simulate) double temp(max); max=min; min=temp; } - if (!Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_mdcv) // Check if primaries values are present + if (!Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_mdcv.count(Chunks->Global->moov_trak_FirstVideoIndex)) // Check if primaries values are present return false; if (!Simulate) { - if (!Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_mdcv) - Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_mdcv=new mp4_Base::global::block_moov_trak_mdia_minf_stbl_stsd_xxxx_mdcv(); + if (!Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_mdcv.count(Chunks->Global->moov_trak_FirstVideoIndex)) + Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_mdcv[Chunks->Global->moov_trak_FirstVideoIndex]=new mp4_Base::global::block_moov_trak_mdia_minf_stbl_stsd_xxxx_mdcv(); - Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_mdcv->Luminance[0]=max; - Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_mdcv->Luminance[1]=min; + Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_mdcv[Chunks->Global->moov_trak_FirstVideoIndex]->Luminance[0]=max; + Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_mdcv[Chunks->Global->moov_trak_FirstVideoIndex]->Luminance[1]=min; Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_mdcv_Modified=true; } return true; @@ -1262,10 +1274,10 @@ bool mp4_Handler::Set(const string &Field, const string &Value, bool Simulate) if (!Simulate) { - if (!Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_clli) - Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_clli=new mp4_Base::global::block_moov_trak_mdia_minf_stbl_stsd_xxxx_clli(); + if (!Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_clli.count(Chunks->Global->moov_trak_FirstVideoIndex)) + Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_clli[Chunks->Global->moov_trak_FirstVideoIndex]=new mp4_Base::global::block_moov_trak_mdia_minf_stbl_stsd_xxxx_clli(); - Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_clli->maximum_content_light_level=max; + Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_clli[Chunks->Global->moov_trak_FirstVideoIndex]->maximum_content_light_level=max; Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_clli_Modified=true; } return true; @@ -1281,10 +1293,10 @@ bool mp4_Handler::Set(const string &Field, const string &Value, bool Simulate) if (!Simulate) { - if (!Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_clli) - Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_clli=new mp4_Base::global::block_moov_trak_mdia_minf_stbl_stsd_xxxx_clli(); + if (!Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_clli.count(Chunks->Global->moov_trak_FirstVideoIndex)) + Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_clli[Chunks->Global->moov_trak_FirstVideoIndex]=new mp4_Base::global::block_moov_trak_mdia_minf_stbl_stsd_xxxx_clli(); - Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_clli->maximum_frame_average_light_level=max; + Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_clli[Chunks->Global->moov_trak_FirstVideoIndex]->maximum_frame_average_light_level=max; Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_clli_Modified=true; } return true; @@ -1448,33 +1460,36 @@ bool mp4_Handler::Set(const string &Field, const string &Value, bool Simulate) mdcv=true; + if (Chunks->Global->moov_trak_FirstVideoIndex==(size_t)-1) + return false; + if (!Simulate) { if (mdcv) { - if (!Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_mdcv) - Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_mdcv=new mp4_Base::global::block_moov_trak_mdia_minf_stbl_stsd_xxxx_mdcv(); - - Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_mdcv->Primaries[4]=x1; - Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_mdcv->Primaries[5]=y1; - Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_mdcv->Primaries[0]=x2; - Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_mdcv->Primaries[1]=y2; - Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_mdcv->Primaries[2]=x3; - Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_mdcv->Primaries[3]=y3; - Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_mdcv->Primaries[6]=wp_x; - Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_mdcv->Primaries[7]=wp_y; - Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_mdcv->Luminance[0]=luminance_max; - Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_mdcv->Luminance[1]=luminance_min; + if (!Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_mdcv.count(Chunks->Global->moov_trak_FirstVideoIndex)) + Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_mdcv[Chunks->Global->moov_trak_FirstVideoIndex]=new mp4_Base::global::block_moov_trak_mdia_minf_stbl_stsd_xxxx_mdcv(); + + Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_mdcv[Chunks->Global->moov_trak_FirstVideoIndex]->Primaries[4]=x1; + Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_mdcv[Chunks->Global->moov_trak_FirstVideoIndex]->Primaries[5]=y1; + Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_mdcv[Chunks->Global->moov_trak_FirstVideoIndex]->Primaries[0]=x2; + Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_mdcv[Chunks->Global->moov_trak_FirstVideoIndex]->Primaries[1]=y2; + Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_mdcv[Chunks->Global->moov_trak_FirstVideoIndex]->Primaries[2]=x3; + Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_mdcv[Chunks->Global->moov_trak_FirstVideoIndex]->Primaries[3]=y3; + Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_mdcv[Chunks->Global->moov_trak_FirstVideoIndex]->Primaries[6]=wp_x; + Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_mdcv[Chunks->Global->moov_trak_FirstVideoIndex]->Primaries[7]=wp_y; + Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_mdcv[Chunks->Global->moov_trak_FirstVideoIndex]->Luminance[0]=luminance_max; + Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_mdcv[Chunks->Global->moov_trak_FirstVideoIndex]->Luminance[1]=luminance_min; Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_mdcv_Modified=true; } if (clli) { - if (!Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_clli) - Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_clli=new mp4_Base::global::block_moov_trak_mdia_minf_stbl_stsd_xxxx_clli(); + if (!Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_clli.count(Chunks->Global->moov_trak_FirstVideoIndex)) + Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_clli[Chunks->Global->moov_trak_FirstVideoIndex]=new mp4_Base::global::block_moov_trak_mdia_minf_stbl_stsd_xxxx_clli(); - Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_clli->maximum_content_light_level=max_cll; - Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_clli->maximum_frame_average_light_level=max_fall; + Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_clli[Chunks->Global->moov_trak_FirstVideoIndex]->maximum_content_light_level=max_cll; + Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_clli[Chunks->Global->moov_trak_FirstVideoIndex]->maximum_frame_average_light_level=max_fall; Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_clli_Modified=true; } } @@ -1542,17 +1557,17 @@ bool mp4_Handler::Set(const string &Field, const string &Value, bool Simulate) if (!Simulate) { - if (!Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_clap) - Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_clap=new mp4_Base::global::block_moov_trak_mdia_minf_stbl_stsd_xxxx_clap(); - - Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_clap->Aperture_Width_Num=Aperture_Width_Num; - Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_clap->Aperture_Width_Den=Aperture_Width_Den; - Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_clap->Aperture_Height_Num=Aperture_Height_Num; - Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_clap->Aperture_Height_Den=Aperture_Height_Den; - Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_clap->Horizontal_Offset_Num=Horizontal_Offset_Num; - Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_clap->Horizontal_Offset_Den=Horizontal_Offset_Den; - Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_clap->Vertical_Offset_Num=Vertical_Offset_Num; - Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_clap->Vertical_Offset_Den=Vertical_Offset_Den; + if (!Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_clap.count(Chunks->Global->moov_trak_FirstVideoIndex)) + Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_clap[Chunks->Global->moov_trak_FirstVideoIndex]=new mp4_Base::global::block_moov_trak_mdia_minf_stbl_stsd_xxxx_clap(); + + Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_clap[Chunks->Global->moov_trak_FirstVideoIndex]->Aperture_Width_Num=Aperture_Width_Num; + Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_clap[Chunks->Global->moov_trak_FirstVideoIndex]->Aperture_Width_Den=Aperture_Width_Den; + Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_clap[Chunks->Global->moov_trak_FirstVideoIndex]->Aperture_Height_Num=Aperture_Height_Num; + Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_clap[Chunks->Global->moov_trak_FirstVideoIndex]->Aperture_Height_Den=Aperture_Height_Den; + Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_clap[Chunks->Global->moov_trak_FirstVideoIndex]->Horizontal_Offset_Num=Horizontal_Offset_Num; + Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_clap[Chunks->Global->moov_trak_FirstVideoIndex]->Horizontal_Offset_Den=Horizontal_Offset_Den; + Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_clap[Chunks->Global->moov_trak_FirstVideoIndex]->Vertical_Offset_Num=Vertical_Offset_Num; + Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_clap[Chunks->Global->moov_trak_FirstVideoIndex]->Vertical_Offset_Den=Vertical_Offset_Den; Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_clap_Modified=true; } return true; @@ -1761,10 +1776,10 @@ bool mp4_Handler::Remove(const string &Field) if (Field=="clef") { - if (Chunks->Global->moov_trak_tapt_clef) + if (Chunks->Global->moov_trak_FirstVideoIndex!=(size_t)-1 && Chunks->Global->moov_trak_tapt_clef.count(Chunks->Global->moov_trak_FirstVideoIndex)) { - delete Chunks->Global->moov_trak_tapt_clef; - Chunks->Global->moov_trak_tapt_clef=NULL; + delete Chunks->Global->moov_trak_tapt_clef[Chunks->Global->moov_trak_FirstVideoIndex]; + Chunks->Global->moov_trak_tapt_clef.erase(Chunks->Global->moov_trak_FirstVideoIndex); Chunks->Global->moov_trak_tapt_clef_Modified=true; } @@ -1772,10 +1787,10 @@ bool mp4_Handler::Remove(const string &Field) } else if (Field=="prof") { - if (Chunks->Global->moov_trak_tapt_prof) + if (Chunks->Global->moov_trak_FirstVideoIndex!=(size_t)-1 && Chunks->Global->moov_trak_tapt_prof.count(Chunks->Global->moov_trak_FirstVideoIndex)) { - delete Chunks->Global->moov_trak_tapt_prof; - Chunks->Global->moov_trak_tapt_prof=NULL; + delete Chunks->Global->moov_trak_tapt_prof[Chunks->Global->moov_trak_FirstVideoIndex]; + Chunks->Global->moov_trak_tapt_prof.erase(Chunks->Global->moov_trak_FirstVideoIndex); Chunks->Global->moov_trak_tapt_prof_Modified=true; } @@ -1783,10 +1798,10 @@ bool mp4_Handler::Remove(const string &Field) } else if (Field=="enof") { - if (Chunks->Global->moov_trak_tapt_enof) + if (Chunks->Global->moov_trak_FirstVideoIndex!=(size_t)-1 && Chunks->Global->moov_trak_tapt_enof.count(Chunks->Global->moov_trak_FirstVideoIndex)) { - delete Chunks->Global->moov_trak_tapt_enof; - Chunks->Global->moov_trak_tapt_enof=NULL; + delete Chunks->Global->moov_trak_tapt_enof[Chunks->Global->moov_trak_FirstVideoIndex]; + Chunks->Global->moov_trak_tapt_enof.erase(Chunks->Global->moov_trak_FirstVideoIndex); Chunks->Global->moov_trak_tapt_enof_Modified=true; } @@ -1794,10 +1809,10 @@ bool mp4_Handler::Remove(const string &Field) } else if (Field=="fiel") { - if (Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_fiel) + if (Chunks->Global->moov_trak_FirstVideoIndex!=(size_t)-1 && Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_fiel.count(Chunks->Global->moov_trak_FirstVideoIndex)) { - delete Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_fiel; - Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_fiel=NULL; + delete Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_fiel[Chunks->Global->moov_trak_FirstVideoIndex]; + Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_fiel.erase(Chunks->Global->moov_trak_FirstVideoIndex); Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_fiel_Modified=true; } @@ -1805,10 +1820,10 @@ bool mp4_Handler::Remove(const string &Field) } else if (Field=="colr") { - if (Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_colr) + if (Chunks->Global->moov_trak_FirstVideoIndex!=(size_t)-1 && Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_colr.count(Chunks->Global->moov_trak_FirstVideoIndex)) { - delete Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_colr; - Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_colr=NULL; + delete Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_colr[Chunks->Global->moov_trak_FirstVideoIndex]; + Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_colr.erase(Chunks->Global->moov_trak_FirstVideoIndex); Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_colr_Modified=true; } @@ -1816,10 +1831,10 @@ bool mp4_Handler::Remove(const string &Field) } else if (Field=="gama") { - if (Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_gama) + if (Chunks->Global->moov_trak_FirstVideoIndex!=(size_t)-1 && Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_gama.count(Chunks->Global->moov_trak_FirstVideoIndex)) { - delete Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_gama; - Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_gama=NULL; + delete Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_gama[Chunks->Global->moov_trak_FirstVideoIndex]; + Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_gama.erase(Chunks->Global->moov_trak_FirstVideoIndex); Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_gama_Modified=true; } @@ -1827,10 +1842,10 @@ bool mp4_Handler::Remove(const string &Field) } else if (Field=="pasp") { - if (Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_pasp) + if (Chunks->Global->moov_trak_FirstVideoIndex!=(size_t)-1 && Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_pasp.count(Chunks->Global->moov_trak_FirstVideoIndex)) { - delete Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_pasp; - Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_pasp=NULL; + delete Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_pasp[Chunks->Global->moov_trak_FirstVideoIndex]; + Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_pasp.erase(Chunks->Global->moov_trak_FirstVideoIndex); Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_pasp_Modified=true; } @@ -1838,10 +1853,10 @@ bool mp4_Handler::Remove(const string &Field) } else if (Field=="mdcv") { - if (Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_mdcv) + if (Chunks->Global->moov_trak_FirstVideoIndex!=(size_t)-1 && Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_mdcv.count(Chunks->Global->moov_trak_FirstVideoIndex)) { - delete Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_mdcv; - Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_mdcv=NULL; + delete Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_mdcv[Chunks->Global->moov_trak_FirstVideoIndex]; + Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_mdcv.erase(Chunks->Global->moov_trak_FirstVideoIndex); Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_mdcv_Modified=true; } @@ -1849,10 +1864,10 @@ bool mp4_Handler::Remove(const string &Field) } else if (Field=="clli") { - if (Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_clli) + if (Chunks->Global->moov_trak_FirstVideoIndex!=(size_t)-1 && Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_clli.count(Chunks->Global->moov_trak_FirstVideoIndex)) { - delete Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_clli; - Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_clli=NULL; + delete Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_clli[Chunks->Global->moov_trak_FirstVideoIndex]; + Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_clli.erase(Chunks->Global->moov_trak_FirstVideoIndex); Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_clli_Modified=true; } @@ -1860,10 +1875,10 @@ bool mp4_Handler::Remove(const string &Field) } else if (Field=="clap") { - if (Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_clap) + if (Chunks->Global->moov_trak_FirstVideoIndex!=(size_t)-1 && Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_clap.count(Chunks->Global->moov_trak_FirstVideoIndex)) { - delete Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_clap; - Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_clap=NULL; + delete Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_clap[Chunks->Global->moov_trak_FirstVideoIndex]; + Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_clap.erase(Chunks->Global->moov_trak_FirstVideoIndex); Chunks->Global->moov_trak_mdia_minf_stbl_stsd_xxxx_clap_Modified=true; }