[Mplayer-cvslog] CVS: main edl.h, 1.3, 1.4 edl.c, 1.1, 1.2 mplayer.c, 1.787, 1.788

Diego Biurrun CVS syncmail at mplayerhq.hu
Fri Sep 17 04:28:46 CEST 2004


CVS change done by Diego Biurrun CVS

Update of /cvsroot/mplayer/main
In directory mail:/var2/tmp/cvs-serv32534

Modified Files:
	edl.h edl.c mplayer.c 
Log Message:
Hardcoded EDL messages moved to help_mp-en.h, Doxygen comments added, patch
by "Reynaldo H. Verdejo Pinochet" <reynaldo at opendot dot cl>, spelling
and wording corrections by me.


Index: edl.h
===================================================================
RCS file: /cvsroot/mplayer/main/edl.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- edl.h	28 Aug 2004 00:46:05 -0000	1.3
+++ edl.h	17 Sep 2004 02:28:44 -0000	1.4
@@ -23,11 +23,11 @@
 
 typedef struct edl_record* edl_record_ptr;
 
-char *edl_filename; // file to extract edl entries from (-edl)
-char *edl_output_filename; // file to put edl entries in (-edlout)
+char *edl_filename; // file to extract EDL entries from (-edl)
+char *edl_output_filename; // file to put EDL entries in (-edlout)
 
 int edl_check_mode(void); // we cannot do -edl and -edlout at the same time
-int edl_count_entries(void); // returns total No of entries needed
-int edl_parse_file(edl_record_ptr edl_records); // fills edl stack
+int edl_count_entries(void); // returns total number of entries needed
+int edl_parse_file(edl_record_ptr edl_records); // fills EDL stack
 
 #endif

Index: edl.c
===================================================================
RCS file: /cvsroot/mplayer/main/edl.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- edl.c	28 Aug 2004 00:46:05 -0000	1.1
+++ edl.c	17 Sep 2004 02:28:44 -0000	1.2
@@ -3,9 +3,18 @@
 #include "config.h"
 #include "mp_msg.h"
 #include "edl.h"
+#include "help_mp.h"
 
 #ifdef USE_EDL
 
+/**
+ *  We can't do -edl and -edlout at the same time
+ *  so we check that here.
+ *
+ *  \return EDL_ERROR on error and 1 otherwise.
+ *  \brief Makes sure EDL has been called correctly.
+ */
+
 int edl_check_mode(void)
 {
     if (edl_filename && edl_output_filename)
@@ -16,6 +25,13 @@
     return (1);
 }
 
+/** Calculates the total amount of edl_records we will need
+ *  to hold the EDL operations queue, we need one edl_record
+ *  for each SKIP and two for each MUTE.
+ *  \return Number of necessary EDL entries, EDL_ERROR when file can't be read.
+ *  \brief Counts needed EDL entries.
+ */
+
 int edl_count_entries(void)
 {
     FILE *fd = NULL;
@@ -29,8 +45,7 @@
     {
         if ((fd = fopen(edl_filename, "r")) == NULL)
         {
-            mp_msg(MSGT_CPLAYER, MSGL_WARN,
-                   "Invalid EDL file, cant open '%s' for reading!\n",
+            mp_msg(MSGT_CPLAYER, MSGL_WARN, MSGTR_EdlCantOpenForRead,
                    edl_filename);
             return (EDL_ERROR);
         } else
@@ -46,8 +61,7 @@
                         entries += 2;
                 } else
                 {
-                    mp_msg(MSGT_CPLAYER, MSGL_WARN,
-                           "Invalid EDL line: %s\n", line);
+                    mp_msg(MSGT_CPLAYER, MSGL_WARN, MSGTR_EdlNOValidLine, line);
                     return (EDL_ERROR);
                 }
 
@@ -61,6 +75,11 @@
     return (entries);
 }
 
+/** Parses edl_filename to fill EDL operations queue.
+ *  \return Number of stored EDL records or EDL_ERROR when file can't be read.
+ *  \brief Fills EDL operations queue.
+ */
+
 int edl_parse_file(edl_record_ptr edl_records)
 {
     FILE *fd;
@@ -84,9 +103,8 @@
                 if ((sscanf(line, "%f %f %d", &start, &stop, &action))
                     != 3)
                 {
-                    mp_msg(MSGT_CPLAYER, MSGL_WARN,
-                           "Badly formated EDL line [%d]. Discarding!\n",
-                           lineCount + 1, line);
+                    mp_msg(MSGT_CPLAYER, MSGL_WARN, MSGTR_EdlBadlyFormattedLine,
+                           lineCount + 1);
                     continue;
                 } else
                 {
@@ -95,21 +113,18 @@
                         if (start <= (next_edl_record - 1)->stop_sec)
                         {
                             mp_msg(MSGT_CPLAYER, MSGL_WARN,
-                                   "Invalid EDL line [%d]: %s",
-                                   lineCount, line);
+                                   MSGTR_EdlNOValidLine, line);
                             mp_msg(MSGT_CPLAYER, MSGL_WARN,
-                                   "Last stop position was [%f]; next start is [%f]. Entries must be in chronological order and cannot overlap. Discarding!\n",
+                                   MSGTR_EdlBadLineOverlap,
                                    (next_edl_record - 1)->stop_sec, start);
                             continue;
                         }
                     }
                     if (stop <= start)
                     {
-                        mp_msg(MSGT_CPLAYER, MSGL_WARN,
-                               "Invalid EDL line [%d]: %s", lineCount,
+                        mp_msg(MSGT_CPLAYER, MSGL_WARN, MSGTR_EdlNOValidLine,
                                line);
-                        mp_msg(MSGT_CPLAYER, MSGL_WARN,
-                               "Stop time must follow start time. Discarding!\n");
+                        mp_msg(MSGT_CPLAYER, MSGL_WARN, MSGTR_EdlBadLineBadStop);
                         continue;
                     }
                     next_edl_record->action = action;

Index: mplayer.c
===================================================================
RCS file: /cvsroot/mplayer/main/mplayer.c,v
retrieving revision 1.787
retrieving revision 1.788
diff -u -r1.787 -r1.788
--- mplayer.c	16 Sep 2004 09:25:56 -0000	1.787
+++ mplayer.c	17 Sep 2004 02:28:44 -0000	1.788
@@ -348,13 +348,13 @@
 #endif
 
 #ifdef USE_EDL
-edl_record_ptr edl_records = NULL; // EDL entries memory area
-edl_record_ptr next_edl_record = NULL; // only for traversing edl_records
-int edl_memory_slots = 0; // No of EDL entries (1 for skip + 2 for each mute)
-int edl_operations = 0; // No of EDL operations, skip + mute
-short edl_decision = 0; // 1 when an EDL operation has been made
-FILE* edl_fd = NULL; // fd to write to when in -edlout mode
-int edl_mute_count = 0; // even number when mute has been matched mute/unmute
+edl_record_ptr edl_records = NULL; /// EDL entries memory area
+edl_record_ptr next_edl_record = NULL; /// only for traversing edl_records
+int edl_memory_slots = 0; /// number of EDL entries (1 for skip + 2 for each mute)
+int edl_operations = 0; /// number of EDL operations, skip + mute
+short edl_decision = 0; /// 1 when an EDL operation has been made
+FILE* edl_fd = NULL; /// fd to write to when in -edlout mode
+int edl_mute_count = 0; /// even number when mute and unmute has been matched
 #endif
 
 static unsigned int inited_flags=0;
@@ -476,6 +476,9 @@
 
   current_module="exit_player";
 
+#ifdef USE_EDL
+  if(edl_records != NULL) free(edl_records); // free mem allocated for EDL
+#endif
   if(how) mp_msg(MSGT_CPLAYER,MSGL_INFO,MSGTR_ExitingHow,mp_gettext(how));
   mp_msg(MSGT_CPLAYER,MSGL_DBG2,"max framesize was %d bytes\n",max_framesize);
 
@@ -975,13 +978,8 @@
 #ifdef USE_EDL
 if (edl_check_mode() == EDL_ERROR && edl_filename)
 {
-    mp_msg(MSGT_CPLAYER, MSGL_WARN,
-           "Cant use -edl and -edlout at the same time\n");
-    mp_msg(MSGT_CPLAYER, MSGL_WARN, "Not using EDL at all!!!\n");
-    edl_filename = NULL;
-    edl_output_filename = NULL;
-    edl_records = NULL;
-    next_edl_record = edl_records;
+    mp_msg(MSGT_CPLAYER, MSGL_ERR, MSGTR_EdlCantUseBothModes);
+    exit_player(NULL);
 } else if (edl_filename)
 {
     edl_memory_slots = edl_count_entries();
@@ -990,20 +988,18 @@
         edl_records = calloc(edl_memory_slots, sizeof(struct edl_record));
         if (edl_records == NULL)
         {
-            mp_msg(MSGT_CPLAYER, MSGL_FATAL,
-                   "Cant allocate enough memory to hold EDL data, exiting!\n");
+            mp_msg(MSGT_CPLAYER, MSGL_FATAL, MSGTR_EdlOutOfMem);
             exit_player(NULL);	    
         } else
         {
             if ((edl_operations = edl_parse_file(edl_records)) > 0)
             {
-                mp_msg(MSGT_CPLAYER, MSGL_INFO, "Readed %d EDL actions\n",
+                mp_msg(MSGT_CPLAYER, MSGL_INFO, MSGTR_EdlRecordsNo,
                        edl_operations);
             } else
             {
 
-                mp_msg(MSGT_CPLAYER, MSGL_INFO,
-                       "There are no EDL actions to take care of\n");
+                mp_msg(MSGT_CPLAYER, MSGL_INFO, MSGTR_EdlQueueEmpty);
             }
         }
     }
@@ -1014,11 +1010,9 @@
 {
     if ((edl_fd = fopen(edl_output_filename, "w")) == NULL)
     {
-        mp_msg(MSGT_CPLAYER, MSGL_WARN, 
-	       "Error opening file [%s] for writing!\n",
+        mp_msg(MSGT_CPLAYER, MSGL_ERR, MSGTR_EdlCantOpenForWrite,
                edl_output_filename);
-        edl_output_filename = NULL;
-        next_edl_record = edl_records;
+        exit_player(NULL);
     }
 }
 #endif
@@ -2450,7 +2444,7 @@
 #ifdef USE_EDL
  if( next_edl_record ) { // Are we (still?) doing EDL?
   if ( !sh_video ) {
-    mp_msg( MSGT_CPLAYER, MSGL_ERR, "Cannot use edit list without video. EDL disabled.\n" );
+    mp_msg( MSGT_CPLAYER, MSGL_ERR, MSGTR_EdlNOsh_video );
     next_edl_record->next = NULL;
   } else {
    if( sh_video->pts >= next_edl_record->start_sec ) {
@@ -2464,7 +2458,7 @@
        edl_decision = 1;
      } else if( next_edl_record->action == EDL_MUTE ) {
        mixer_mute(&mixer);
-       edl_mute_count++; // new edl seek behavior need this
+       edl_mute_count++; // new EDL seek behavior needs this
 #ifdef DEBUG_EDL
        printf( "\nEDL_MUTE: [%f]\n", next_edl_record->start_sec );
 #endif
@@ -3524,16 +3518,16 @@
   }
 #ifdef USE_EDL
 /*
- * We Saw a seek, have to rewind the edl operations stak
- * and find the next edl action to take care off
+ * We saw a seek, have to rewind the EDL operations stack
+ * and find the next EDL action to take care of.
  */
 
 next_edl_record = edl_records;
 
 while (next_edl_record)
 {
-    /* trying to remember if we need to mute/unmute first
-     * prior edl implementation lacks this
+    /* Trying to remember if we need to mute/unmute first;
+     * prior EDL implementation lacks this.
      */
   
     if (next_edl_record->start_sec >= sh_video->pts)




More information about the MPlayer-cvslog mailing list