@@ -250,8 +250,8 @@ class Mp4Demux
250250 gst_buffer_unref (pssh);
251251 }
252252
253- void dump_auxiliary_information ( void )
254- {
253+ void process_auxiliary_information ( void )
254+ { // redundant with parseSampleEncryptionBox?
255255 size_t sample_count = cenc_aux_info_sizes.size ();
256256 if ( sample_count && got_auxiliary_information_offset )
257257 {
@@ -367,7 +367,7 @@ class Mp4Demux
367367 PRINTF ( " \n " );
368368 }
369369 }
370- dump_auxiliary_information ();
370+ process_auxiliary_information ();
371371 }
372372
373373 void parseAuxInfo ( void )
@@ -404,7 +404,7 @@ class Mp4Demux
404404 }
405405 PRINTF ( " %sauxiliary_information_offset = 0x%" PRIu64 " \n " , INDENT (), auxiliary_information_offset );
406406 got_auxiliary_information_offset = true ;
407- dump_auxiliary_information ();
407+ process_auxiliary_information ();
408408 }
409409
410410 void parseSampleEncryptionBox ( void )
@@ -448,7 +448,6 @@ class Mp4Demux
448448 ptr += subsamples_size;
449449 }
450450 }
451- sencPresent = true ;
452451 }
453452
454453 void parseMovieFragmentHeaderBox ( void )
@@ -537,6 +536,8 @@ class Mp4Demux
537536 if (flags & 0x0100 )
538537 {
539538 sample_duration = ReadU32 ();
539+ PRINTF ( " duration=%" PRIu32, sample_duration );
540+ sample.duration = sample_duration / (double )timescale;
540541 }
541542 if (flags & 0x0200 )
542543 {
@@ -558,8 +559,7 @@ class Mp4Demux
558559 }
559560 sample.dts = dts/(double )timescale;
560561 sample.pts = (dts+sample_composition_time_offset)/(double )timescale;
561- sample.duration = sample_duration / (double )timescale;
562- PRINTF ( " duration:%f dts=%f pts=%f" , sample.duration , sample.dts , sample.pts );
562+ PRINTF ( " dts=%f pts=%f" , sample.dts , sample.pts );
563563 dts += sample_duration;
564564 samples.push_back ( std::move (sample) );
565565 PRINTF ( " \n " );
@@ -888,21 +888,7 @@ class Mp4Demux
888888
889889 case MultiChar_Constant (" moof" ): // Movie Fragment
890890 moof_ptr = ptr-8 ;
891- // For LLD streams, we may have multiple moof boxes
892- // so we need to track sampleOffset to map samples to mdat
893- sampleOffset = samples.size ();
894- // Reset encryption state for each moof
895- got_auxiliary_information_offset = false ;
896- cenc_aux_info_sizes.clear ();
897- sencPresent = false ;
898-
899891 DemuxHelper (next );
900-
901- if (!sencPresent && got_auxiliary_information_offset)
902- {
903- // If no 'senc' box, we need to get IVs and subsample data from auxiliary info
904- process_auxiliary_information ();
905- }
906892 break ;
907893
908894 case MultiChar_Constant (" schi" ): // Scheme Information
@@ -943,24 +929,7 @@ class Mp4Demux
943929 }
944930 }
945931
946- Mp4Demux ( bool verbose=false ):
947- audio{}, video{}, stream_format(),
948- data_reference_index (), codec_type(),
949- codec_data (), is_encrypted(), iv_size(),
950- crypt_byte_block (), skip_byte_block(),
951- constant_iv_size (), constant_iv(), timescale(),
952- samples (), default_kid(), got_auxiliary_information_offset(),
953- auxiliary_information_offset (), scheme_type(), scheme_version(),
954- original_media_type (), cenc_aux_info_sizes(), protectionEvents(),
955- moof_ptr (), ptr(), indent(),
956- version (), flags(), baseMediaDecodeTime(),
957- fragment_duration (), track_id(), base_data_offset(),
958- default_sample_description_index (), default_sample_duration(), default_sample_size(),
959- default_sample_flags (), creation_time(), modification_time(),
960- duration (), rate(), volume(),
961- matrix{}, layer(), alternate_group(),
962- width_fixed (), height_fixed(), language(),
963- verbose (verbose), sampleOffset(), sencPresent(false )
932+ Mp4Demux ( bool verbose=false ) : audio{}, video{}, stream_format(), data_reference_index(), codec_type(), codec_data(), is_encrypted(), iv_size(), crypt_byte_block(), skip_byte_block(), constant_iv_size(), constant_iv(), timescale(), samples(), default_kid(), got_auxiliary_information_offset(), auxiliary_information_offset(), scheme_type(), scheme_version(), original_media_type(), cenc_aux_info_sizes(), protectionEvents(), moof_ptr(), ptr(), indent(), version(), flags(), baseMediaDecodeTime(), fragment_duration(), track_id(), base_data_offset(), default_sample_description_index(), default_sample_duration(), default_sample_size(), default_sample_flags(), creation_time(), modification_time(), duration(), rate(), volume(), matrix{}, layer(), alternate_group(), width_fixed(), height_fixed(), language(), verbose(verbose)
964933 {
965934 }
966935
@@ -1072,15 +1041,6 @@ class Mp4Demux
10721041 g_print ( " unk codec_type: %" PRIu32 " \n " , codec_type );
10731042 return ;
10741043 }
1075- if (caps && is_encrypted)
1076- {
1077- GstStructure *s = gst_caps_get_structure (caps, 0 );
1078- gst_structure_set (s,
1079- " original-media-type" , G_TYPE_STRING, gst_structure_get_name (s),
1080- GST_PROTECTION_SYSTEM_ID_CAPS_FIELD, G_TYPE_STRING, " edef8ba9-79d6-4ace-a3c8-27dcd51d21ed" ,
1081- NULL );
1082- gst_structure_set_name (s, " application/x-cenc" );
1083- }
10841044 gst_app_src_set_caps (appsrc, caps);
10851045 gst_caps_unref (caps);
10861046 gst_buffer_unref (buf);
@@ -1150,19 +1110,13 @@ class Mp4Demux
11501110 NULL );
11511111 gst_buffer_unref (subsamples_buf);
11521112 }
1153- else
1154- {
1155- gst_structure_set (metadata,
1156- " subsample_count" , G_TYPE_UINT, 0 ,
1157- NULL );
1158- }
11591113
11601114 if ( scheme_type == MultiChar_Constant (" cbcs" ) )
11611115 {
11621116 GstBuffer *constant_iv_buf = _gst_buffer_new_memdup ( (gpointer)constant_iv.c_str (), (gsize)constant_iv_size);
11631117 gst_structure_set (metadata,
11641118 " iv" , GST_TYPE_BUFFER, constant_iv_buf,
1165- " iv_size " , G_TYPE_UINT, constant_iv_size,
1119+ " constant_iv_size " , G_TYPE_UINT, constant_iv_size,
11661120 " crypt_byte_block" , G_TYPE_UINT, crypt_byte_block,
11671121 " skip_byte_block" , G_TYPE_UINT, skip_byte_block,
11681122 NULL );
@@ -1173,8 +1127,11 @@ class Mp4Demux
11731127 if ( metadata )
11741128 { // serialize and print the metadata
11751129 gchar *structure_string = gst_structure_to_string ( metadata );
1176- PRINTF (" metadata: %s\n " , structure_string);
1130+ g_print (" metadata: %s\n " , structure_string);
11771131 g_free (structure_string);
1132+
1133+ // gst_structure_free( metadata );
1134+ // metadata = NULL;
11781135 }
11791136
11801137 return metadata;
0 commit comments