src/atsc3_mmtp_parser.c
void mmtp_sub_flow_remove_mmtp_packet(mmtp_sub_flow_t *mmtp_sub_flow, mmtp_payload_fragments_union_t *mmtp_packet) {
	mmtp_packet->mmtp_packet_header.mmtp_sub_flow = mmtp_sub_flow;

    ssize_t index = -1;

	//	__PRINTF_TRACE("%d:, packet_counter: %d, packet_id: %d, mmtp_payload_type: 0x%x\n", __LINE__, mmtp_packet->mmtp_packet_header.packet_counter, mmtp_packet->mmtp_packet_header.mmtp_packet_id, mmtp_packet->mmtp_packet_header.mmtp_payload_type);
	if(mmtp_packet->mmtp_packet_header.mmtp_payload_type == 0x00) {
        
		mpu_fragments_t* mpu_fragments = mmtp_sub_flow->mpu_fragments;
		if(mpu_fragments && mpu_fragments->all_mpu_fragments_vector.size) {
            atsc3_vector_index_of(&mpu_fragments->all_mpu_fragments_vector, mmtp_packet, &index);
            if(index >-1) {
                atsc3_vector_remove_noshrink(&mpu_fragments->all_mpu_fragments_vector, index);
            }
        
        }
        mpu_data_unit_payload_fragments_t* mpu_metadata_fragments_vector = mpu_data_unit_payload_fragments_find_mpu_sequence_number(&mmtp_sub_flow->mpu_fragments->mpu_metadata_fragments_vector, mmtp_packet->mmtp_mpu_type_packet_header.mpu_sequence_number);

        if(mpu_metadata_fragments_vector && mpu_metadata_fragments_vector->timed_fragments_vector.size){
            atsc3_vector_index_of(&mpu_metadata_fragments_vector->timed_fragments_vector, mmtp_packet, &index);
            if(index >-1) {
                atsc3_vector_remove_noshrink(&mpu_metadata_fragments_vector->timed_fragments_vector, index);
            }
        }


        mpu_data_unit_payload_fragments_t* movie_metadata_fragments = mpu_data_unit_payload_fragments_find_mpu_sequence_number(&mmtp_sub_flow->mpu_fragments->movie_fragment_metadata_vector, mmtp_packet->mmtp_mpu_type_packet_header.mpu_sequence_number);
        if(movie_metadata_fragments && movie_metadata_fragments->timed_fragments_vector.size) {

            atsc3_vector_index_of(&movie_metadata_fragments->timed_fragments_vector, mmtp_packet, &index);
            if(index >-1) {
                atsc3_vector_remove_noshrink(&movie_metadata_fragments->timed_fragments_vector, index);
            }
        }
    
    //don't remove these here, it wil offset the container size
    //
    //			mpu_data_unit_payload_fragments_t* data_unit_payload_types =	mpu_data_unit_payload_fragments_find_mpu_sequence_number(&mmtp_sub_flow->mpu_fragments->media_fragment_unit_vector,	mmtp_packet->mmtp_mpu_type_packet_header.mpu_sequence_number);
    //
    //			atsc3_vector_index_of(&data_unit_payload_types->timed_fragments_vector, mmtp_packet, index);
    //			if(*index >-1) {
    //				atsc3_vector_remove_noshrink(&data_unit_payload_types->timed_fragments_vector, *index);
    //			}

        //	}

	} else if(mmtp_packet->mmtp_packet_header.mmtp_payload_type == 0x01) {
		atsc3_vector_index_of(&mmtp_sub_flow->mmtp_generic_object_fragments_vector, mmtp_packet, &index);
		atsc3_vector_remove(&mmtp_sub_flow->mmtp_generic_object_fragments_vector, index);
	} else if(mmtp_packet->mmtp_packet_header.mmtp_payload_type == 0x02) {
		atsc3_vector_index_of(&mmtp_sub_flow->mmtp_signalling_message_fragements_vector, mmtp_packet, &index);
		atsc3_vector_remove(&mmtp_sub_flow->mmtp_signalling_message_fragements_vector, index);
	} else if(mmtp_packet->mmtp_packet_header.mmtp_payload_type == 0x03) {
		atsc3_vector_index_of(&mmtp_sub_flow->mmtp_repair_symbol_vector, mmtp_packet, &index);
		atsc3_vector_remove(&mmtp_sub_flow->mmtp_repair_symbol_vector, index);
	}
}
/**
 *
 * see atsc3_mmt_listener_bento.c for other places these packets may be apptended to
 */
see atsc3_mmt_listener_bento.c for other places these packets may be apptended to
see atsc3_mmt_listener_bento . c for other places these packets may be apptended to
void mmtp_sub_flow_remove_mmtp_packet(mmtp_sub_flow_t *mmtp_sub_flow, mmtp_payload_fragments_union_t *mmtp_packet) {
	mmtp_packet->mmtp_packet_header.mmtp_sub_flow = mmtp_sub_flow;
    ssize_t index = -1;
	if(mmtp_packet->mmtp_packet_header.mmtp_payload_type == 0x00) {
		mpu_fragments_t* mpu_fragments = mmtp_sub_flow->mpu_fragments;
		if(mpu_fragments && mpu_fragments->all_mpu_fragments_vector.size) {
            atsc3_vector_index_of(&mpu_fragments->all_mpu_fragments_vector, mmtp_packet, &index);
            if(index >-1) {
                atsc3_vector_remove_noshrink(&mpu_fragments->all_mpu_fragments_vector, index);
            }
        }
        mpu_data_unit_payload_fragments_t* mpu_metadata_fragments_vector = mpu_data_unit_payload_fragments_find_mpu_sequence_number(&mmtp_sub_flow->mpu_fragments->mpu_metadata_fragments_vector, mmtp_packet->mmtp_mpu_type_packet_header.mpu_sequence_number);
        if(mpu_metadata_fragments_vector && mpu_metadata_fragments_vector->timed_fragments_vector.size){
            atsc3_vector_index_of(&mpu_metadata_fragments_vector->timed_fragments_vector, mmtp_packet, &index);
            if(index >-1) {
                atsc3_vector_remove_noshrink(&mpu_metadata_fragments_vector->timed_fragments_vector, index);
            }
        }
        mpu_data_unit_payload_fragments_t* movie_metadata_fragments = mpu_data_unit_payload_fragments_find_mpu_sequence_number(&mmtp_sub_flow->mpu_fragments->movie_fragment_metadata_vector, mmtp_packet->mmtp_mpu_type_packet_header.mpu_sequence_number);
        if(movie_metadata_fragments && movie_metadata_fragments->timed_fragments_vector.size) {
            atsc3_vector_index_of(&movie_metadata_fragments->timed_fragments_vector, mmtp_packet, &index);
            if(index >-1) {
                atsc3_vector_remove_noshrink(&movie_metadata_fragments->timed_fragments_vector, index);
            }
        }
    			mpu_data_unit_payload_fragments_t* data_unit_payload_types =	mpu_data_unit_payload_fragments_find_mpu_sequence_number(&mmtp_sub_flow->mpu_fragments->media_fragment_unit_vector,	mmtp_packet->mmtp_mpu_type_packet_header.mpu_sequence_number);
    			atsc3_vector_index_of(&data_unit_payload_types->timed_fragments_vector, mmtp_packet, index);
    			if(*index >-1) {
    				atsc3_vector_remove_noshrink(&data_unit_payload_types->timed_fragments_vector, *index);
    			}
        	}
	} else if(mmtp_packet->mmtp_packet_header.mmtp_payload_type == 0x01) {
		atsc3_vector_index_of(&mmtp_sub_flow->mmtp_generic_object_fragments_vector, mmtp_packet, &index);
		atsc3_vector_remove(&mmtp_sub_flow->mmtp_generic_object_fragments_vector, index);
	} else if(mmtp_packet->mmtp_packet_header.mmtp_payload_type == 0x02) {
		atsc3_vector_index_of(&mmtp_sub_flow->mmtp_signalling_message_fragements_vector, mmtp_packet, &index);
		atsc3_vector_remove(&mmtp_sub_flow->mmtp_signalling_message_fragements_vector, index);
	} else if(mmtp_packet->mmtp_packet_header.mmtp_payload_type == 0x03) {
		atsc3_vector_index_of(&mmtp_sub_flow->mmtp_repair_symbol_vector, mmtp_packet, &index);
		atsc3_vector_remove(&mmtp_sub_flow->mmtp_repair_symbol_vector, index);
	}
}
void mmtp_sub_flow_remove_mmtp_packet ( mmtp_sub_flow_t * mmtp_sub_flow , mmtp_payload_fragments_union_t * mmtp_packet ) { mmtp_packet -> mmtp_packet_header . mmtp_sub_flow = mmtp_sub_flow ; ssize_t index = -1 ; if ( mmtp_packet -> mmtp_packet_header . mmtp_payload_type == 0x00 ) { mpu_fragments_t * mpu_fragments = mmtp_sub_flow -> mpu_fragments ; if ( mpu_fragments && mpu_fragments -> all_mpu_fragments_vector . size ) { atsc3_vector_index_of ( & mpu_fragments -> all_mpu_fragments_vector , mmtp_packet , & index ) ; if ( index > -1 ) { atsc3_vector_remove_noshrink ( & mpu_fragments -> all_mpu_fragments_vector , index ) ; } } mpu_data_unit_payload_fragments_t * mpu_metadata_fragments_vector = mpu_data_unit_payload_fragments_find_mpu_sequence_number ( & mmtp_sub_flow -> mpu_fragments -> mpu_metadata_fragments_vector , mmtp_packet -> mmtp_mpu_type_packet_header . mpu_sequence_number ) ; if ( mpu_metadata_fragments_vector && mpu_metadata_fragments_vector -> timed_fragments_vector . size ) { atsc3_vector_index_of ( & mpu_metadata_fragments_vector -> timed_fragments_vector , mmtp_packet , & index ) ; if ( index > -1 ) { atsc3_vector_remove_noshrink ( & mpu_metadata_fragments_vector -> timed_fragments_vector , index ) ; } } mpu_data_unit_payload_fragments_t * movie_metadata_fragments = mpu_data_unit_payload_fragments_find_mpu_sequence_number ( & mmtp_sub_flow -> mpu_fragments -> movie_fragment_metadata_vector , mmtp_packet -> mmtp_mpu_type_packet_header . mpu_sequence_number ) ; if ( movie_metadata_fragments && movie_metadata_fragments -> timed_fragments_vector . size ) { atsc3_vector_index_of ( & movie_metadata_fragments -> timed_fragments_vector , mmtp_packet , & index ) ; if ( index > -1 ) { atsc3_vector_remove_noshrink ( & movie_metadata_fragments -> timed_fragments_vector , index ) ; } } } else if ( mmtp_packet -> mmtp_packet_header . mmtp_payload_type == 0x01 ) { atsc3_vector_index_of ( & mmtp_sub_flow -> mmtp_generic_object_fragments_vector , mmtp_packet , & index ) ; atsc3_vector_remove ( & mmtp_sub_flow -> mmtp_generic_object_fragments_vector , index ) ; } else if ( mmtp_packet -> mmtp_packet_header . mmtp_payload_type == 0x02 ) { atsc3_vector_index_of ( & mmtp_sub_flow -> mmtp_signalling_message_fragements_vector , mmtp_packet , & index ) ; atsc3_vector_remove ( & mmtp_sub_flow -> mmtp_signalling_message_fragements_vector , index ) ; } else if ( mmtp_packet -> mmtp_packet_header . mmtp_payload_type == 0x03 ) { atsc3_vector_index_of ( & mmtp_sub_flow -> mmtp_repair_symbol_vector , mmtp_packet , & index ) ; atsc3_vector_remove ( & mmtp_sub_flow -> mmtp_repair_symbol_vector , index ) ; } }
see atsc3_mmt_listener_bento.c for other places these packets may be apptended to
see atsc3_mmt_listener_bento . c for other places these packets may be apptended to
//	__PRINTF_TRACE("%d:, packet_counter: %d, packet_id: %d, mmtp_payload_type: 0x%x\n", __LINE__, mmtp_packet->mmtp_packet_header.packet_counter, mmtp_packet->mmtp_packet_header.mmtp_packet_id, mmtp_packet->mmtp_packet_header.mmtp_payload_type); //don't remove these here, it wil offset the container size // //			mpu_data_unit_payload_fragments_t* data_unit_payload_types =	mpu_data_unit_payload_fragments_find_mpu_sequence_number(&mmtp_sub_flow->mpu_fragments->media_fragment_unit_vector,	mmtp_packet->mmtp_mpu_type_packet_header.mpu_sequence_number); // //			atsc3_vector_index_of(&data_unit_payload_types->timed_fragments_vector, mmtp_packet, index); //			if(*index >-1) { //				atsc3_vector_remove_noshrink(&data_unit_payload_types->timed_fragments_vector, *index); //			} //	}