From d5cbc81e0703318219f5748d1d1922eefbabd20c Mon Sep 17 00:00:00 2001 From: reynaldo Date: Wed, 5 Jul 2006 06:33:58 +0000 Subject: reverts previous commit due to mixed cosmetics ... git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@18906 b3059339-0415-0410-9bf9-f77b7e298cf2 --- edl.c | 108 +++++++++++++++++++++++++++++++----------------------------------- 1 file changed, 51 insertions(+), 57 deletions(-) (limited to 'edl.c') diff --git a/edl.c b/edl.c index ac986d7113..bffb5926b6 100644 --- a/edl.c +++ b/edl.c @@ -69,69 +69,63 @@ edl_record_ptr edl_parse_file(void) if ((fd = fopen(edl_filename, "r")) == NULL) { return NULL; - } - - while (fgets(line, 99, fd) != NULL) + } else { - lineCount++; - - if ((sscanf(line, "%f %f %d", &start, &stop, &action)) - != 3) - { - mp_msg(MSGT_CPLAYER, MSGL_WARN, MSGTR_EdlBadlyFormattedLine, - lineCount); - continue; - } - - if (next_edl_record && start <= next_edl_record->stop_sec) - { - mp_msg(MSGT_CPLAYER, MSGL_WARN, MSGTR_EdlNOValidLine, line); - mp_msg(MSGT_CPLAYER, MSGL_WARN, MSGTR_EdlBadLineOverlap, - next_edl_record->stop_sec, start); - continue; - } - - if (stop <= start) + while (fgets(line, 99, fd) != NULL) { - mp_msg(MSGT_CPLAYER, MSGL_WARN, MSGTR_EdlNOValidLine, - line); - mp_msg(MSGT_CPLAYER, MSGL_WARN, MSGTR_EdlBadLineBadStop); - continue; + lineCount++; + if ((sscanf(line, "%f %f %d", &start, &stop, &action)) + != 3) + { + mp_msg(MSGT_CPLAYER, MSGL_WARN, MSGTR_EdlBadlyFormattedLine, + lineCount + 1); + continue; + } else + { + if (next_edl_record && start <= next_edl_record->stop_sec) + { + mp_msg(MSGT_CPLAYER, MSGL_WARN, MSGTR_EdlNOValidLine, line); + mp_msg(MSGT_CPLAYER, MSGL_WARN, MSGTR_EdlBadLineOverlap, + next_edl_record->prev->stop_sec, start); + continue; + } + if (stop <= start) + { + mp_msg(MSGT_CPLAYER, MSGL_WARN, MSGTR_EdlNOValidLine, + line); + mp_msg(MSGT_CPLAYER, MSGL_WARN, MSGTR_EdlBadLineBadStop); + continue; + } + next_edl_record = edl_alloc_new(next_edl_record); + if (!edl_records) edl_records = next_edl_record; + + next_edl_record->action = action; + if (action == EDL_MUTE) + { + next_edl_record->length_sec = 0; + next_edl_record->start_sec = start; + next_edl_record->stop_sec = start; + + next_edl_record = edl_alloc_new(next_edl_record); + + next_edl_record->action = action; + next_edl_record->length_sec = 0; + next_edl_record->start_sec = stop; + next_edl_record->stop_sec = stop; + } else + { + next_edl_record->length_sec = stop - start; + next_edl_record->start_sec = start; + next_edl_record->stop_sec = stop; + } + record_count++; + } } - - next_edl_record = edl_alloc_new(next_edl_record); - if (!edl_records) edl_records = next_edl_record; - - next_edl_record->action = action; - - if (action == EDL_MUTE) - { - next_edl_record->length_sec = 0; - next_edl_record->start_sec = start; - next_edl_record->stop_sec = start; - - next_edl_record = edl_alloc_new(next_edl_record); - - next_edl_record->action = action; - next_edl_record->length_sec = 0; - next_edl_record->start_sec = stop; - next_edl_record->stop_sec = stop; - } else - { - next_edl_record->length_sec = stop - start; - next_edl_record->start_sec = start; - next_edl_record->stop_sec = stop; - } - record_count++; } - fclose(fd); } - - if (edl_records) - mp_msg(MSGT_CPLAYER, MSGL_INFO, MSGTR_EdlRecordsNo, record_count); - else - mp_msg(MSGT_CPLAYER, MSGL_INFO, MSGTR_EdlQueueEmpty); + if (edl_records) mp_msg(MSGT_CPLAYER, MSGL_INFO, MSGTR_EdlRecordsNo, record_count); + else mp_msg(MSGT_CPLAYER, MSGL_INFO, MSGTR_EdlQueueEmpty); return edl_records; } -- cgit v1.2.3