summaryrefslogtreecommitdiffstats
path: root/edl.c
diff options
context:
space:
mode:
authorreynaldo <reynaldo@b3059339-0415-0410-9bf9-f77b7e298cf2>2006-07-05 06:54:58 +0000
committerreynaldo <reynaldo@b3059339-0415-0410-9bf9-f77b7e298cf2>2006-07-05 06:54:58 +0000
commit64fbd3f57cb67a6a6a8cfb8f2baff18dce74d4f0 (patch)
treed3cf7c5d76dc8fdba37c7d38f7dce2d03c2a5372 /edl.c
parent31e90a9aae8b79fe241f4fc34e9fff031657da00 (diff)
downloadmpv-64fbd3f57cb67a6a6a8cfb8f2baff18dce74d4f0.tar.bz2
mpv-64fbd3f57cb67a6a6a8cfb8f2baff18dce74d4f0.tar.xz
all cosmetics, mainly denestifying of main edl operation's fill loop
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@18909 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'edl.c')
-rw-r--r--edl.c110
1 files changed, 59 insertions, 51 deletions
diff --git a/edl.c b/edl.c
index fcfebf7c00..7ed58c7821 100644
--- a/edl.c
+++ b/edl.c
@@ -69,63 +69,71 @@ edl_record_ptr edl_parse_file(void)
if ((fd = fopen(edl_filename, "r")) == NULL)
{
return NULL;
- } else
+ }
+
+ while (fgets(line, 99, fd) != NULL)
{
- while (fgets(line, 99, fd) != NULL)
+ lineCount++;
+
+ if ((sscanf(line, "%f %f %d", &start, &stop, &action))
+ != 3)
{
- lineCount++;
- if ((sscanf(line, "%f %f %d", &start, &stop, &action))
- != 3)
- {
- mp_msg(MSGT_CPLAYER, MSGL_WARN, MSGTR_EdlBadlyFormattedLine,
- lineCount);
- 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->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++;
- }
+ 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)
+ {
+ 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++;
}
+
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;
}