bool omx_time_stamp_reorder::insert_timestamp(OMX_BUFFERHEADERTYPE *header) { OMX_TICKS *table_entry = NULL; if (!reorder_ts || error || !header) { if (error || !header) DEBUG("\n Invalid condition in insert_timestamp %p", header); return false; } if(!get_current_list()) { handle_error(); return false; } if (pcurrent->entries_filled > (TIME_SZ - 1)) { DEBUG("\n Table full return error"); handle_error(); return false; } if (header->nFlags & OMX_BUFFERFLAG_CODECCONFIG) { return true; } if ((header->nFlags & OMX_BUFFERFLAG_EOS) && !header->nFilledLen) { DEBUG("\n EOS with zero length recieved"); if (!add_new_list()) { handle_error(); return false; } return true; } for(int i = 0; i < TIME_SZ && !table_entry; i++) { if (!pcurrent->input_timestamps[i].in_use) { table_entry = &pcurrent->input_timestamps[i].timestamps; pcurrent->input_timestamps[i].in_use = true; pcurrent->entries_filled++; } } if (!table_entry) { DEBUG("\n All entries in use"); handle_error(); return false; } *table_entry = header->nTimeStamp; if (print_debug) DEBUG("Time stamp inserted %lld", header->nTimeStamp); if (header->nFlags & OMX_BUFFERFLAG_EOS) { if (!add_new_list()) { handle_error(); return false; } } return true; }
bool omx_time_stamp_reorder::get_current_list() { if (!phead) { if(!add_new_list()) { handle_error(); return false; } } pcurrent = phead->prev; return true; }
void cesar_cipher_menu() { // initialisation des variables char str[400]; // la phrase à crypter list node = NULL; // la liste chainée int i, choice, key; // le compteur, le choix, la clé srand(time(NULL)); // préparation de la fonction random // Présentation printf("Cryptage - Cesar : \n\n"); printf("Veuillez saisir votre phrase a crypter : "); S_GETS(str); // Mise en place de la liste chainée for(i=0; i<strlen(str); i++) add_new_list(&node,&str[i],i); // Menu du choix de la clé printf("\n\n1 - Cle connue \n"); printf("2 - Cle inconnue \n\n"); s_scanf(&choice,1,2); if(choice == 1) { printf("Veuillez saisir votre cle (valeur entiere) : "); SAISIE(key); // clé saisie manuellement cesar_cipher(&node,&key); // Algo de chiffrage } else if(choice == 2) { key = RAND(); // clé random cesar_cipher(&node,&key); // Algo de chiffrage random } // On met la liste dans une chaine de caractère printf("Phrase cryptee : "); show_list(node); // La petite phrase d'avertissement printf("\n\nVeuillez notez votre phrase... \n"); printf("\n"); // Vidage de la mémoire free_list(&node); }