changeset 17065:cf6bfdf41143

Clean up some muxer messages, patch by Corey Hickey bugfood-ml AT -fatooh/org- , small fixes by me
author reynaldo
date Tue, 29 Nov 2005 22:04:57 +0000
parents a6ad13d29a70
children e84e5e9e9ef4
files help/help_mp-en.h libmpdemux/muxer.c libmpdemux/muxer_avi.c libmpdemux/muxer_lavf.c libmpdemux/muxer_mpeg.c mencoder.c
diffstat 6 files changed, 22 insertions(+), 15 deletions(-) [+]
line wrap: on
line diff
--- a/help/help_mp-en.h	Tue Nov 29 19:53:05 2005 +0000
+++ b/help/help_mp-en.h	Tue Nov 29 22:04:57 2005 +0000
@@ -241,7 +241,6 @@
 #define MSGTR_EncoderOpenFailed "Failed to open the encoder.\n"
 #define MSGTR_ForcingOutputFourcc "Forcing output fourcc to %x [%.4s]\n"
 #define MSGTR_ForcingOutputAudiofmtTag "Forcing output audio format tag to 0x%x\n"
-#define MSGTR_WritingAVIHeader "Writing AVI header...\n"
 #define MSGTR_DuplicateFrames "\n%d duplicate frame(s)!\n"
 #define MSGTR_SkipFrame "\nSkipping frame!\n"
 #define MSGTR_ResolutionDoesntMatch "\nNew video file has different resolution or colorspace than the previous one.\n"
@@ -251,8 +250,6 @@
 #define MSGTR_NoSpeedWithFrameCopy "WARNING: -speed is not guaranteed to work correctly with -oac copy!\n"\
 "Your encode might be broken!\n"
 #define MSGTR_ErrorWritingFile "%s: Error writing file.\n"
-#define MSGTR_WritingAVIIndex "\nWriting AVI index...\n"
-#define MSGTR_FixupAVIHeader "Fixing AVI header...\n"
 #define MSGTR_RecommendedVideoBitrate "Recommended video bitrate for %s CD: %d\n"
 #define MSGTR_VideoStreamResult "\nVideo stream: %8.3f kbit/s  (%d B/s)  size: %d bytes  %5.3f secs  %d frames\n"
 #define MSGTR_AudioStreamResult "\nAudio stream: %8.3f kbit/s  (%d B/s)  size: %d bytes  %5.3f secs\n"
@@ -519,12 +516,17 @@
 #define MSGTR_DVDsubtitleChannel "Selected DVD subtitle channel: %d language: %c%c\n"
 #define MSGTR_DVDopenOk "DVD successfully opened.\n"
 
-// muxer_*.c:
+// muxer.c, muxer_*.c:
 #define MSGTR_TooManyStreams "Too many streams!"
 #define MSGTR_RawMuxerOnlyOneStream "Rawaudio muxer supports only one audio stream!\n"
 #define MSGTR_IgnoringVideoStream "Ignoring video stream!\n"
 #define MSGTR_UnknownStreamType "Warning! unknown stream type: %d\n"
 #define MSGTR_WarningLenIsntDivisible "Warning! len isn't divisible by samplesize!\n"
+#define MSGTR_MuxbufMallocErr "Muxer frame buffer cannot allocate memory!\n"
+#define MSGTR_MuxbufReallocErr "Muxer frame buffer cannot reallocate memory!\n"
+#define MSGTR_MuxbufSending "Muxer frame buffer sending %d frame(s) to muxer.\n"
+#define MSGTR_WritingHeader "Writing header...\n"
+#define MSGTR_WritingTrailer "Writing index...\n"
 
 // demuxer.c, demux_*.c:
 #define MSGTR_AudioStreamRedefined "WARNING: Audio stream header %d redefined.\n"
--- a/libmpdemux/muxer.c	Tue Nov 29 19:53:05 2005 +0000
+++ b/libmpdemux/muxer.c	Tue Nov 29 22:04:57 2005 +0000
@@ -62,7 +62,7 @@
       
       tmp = realloc(s->muxer->muxbuf, (num+1) * sizeof(muxbuf_t));
       if(!tmp) {
-        mp_msg(MSGT_MUXER, MSGL_FATAL, "Muxer frame buffer cannot reallocate memory!\n");
+        mp_msg(MSGT_MUXER, MSGL_FATAL, MSGTR_MuxbufReallocErr);
         return;
       }
       s->muxer->muxbuf = tmp;
@@ -75,7 +75,7 @@
       buf->flags = flags;
       buf->buffer = malloc(len * sizeof (unsigned char));
       if (!buf->buffer) {
-        mp_msg(MSGT_MUXER, MSGL_FATAL, "Muxer frame buffer cannot allocate memory!\n");
+        mp_msg(MSGT_MUXER, MSGL_FATAL, MSGTR_MuxbufMallocErr);
         return;
       }
       memcpy(buf->buffer, s->buffer, buf->len);
@@ -91,11 +91,10 @@
       if (s->muxer->muxbuf_skip_buffer) {
         muxbuf_t *tmp_buf = malloc(sizeof(muxbuf_t));
         if (!tmp_buf) {
-          mp_msg(MSGT_MUXER, MSGL_FATAL, "Muxer frame buffer cannot allocate memory!\n");
+          mp_msg(MSGT_MUXER, MSGL_FATAL, MSGTR_MuxbufMallocErr);
           return;
         }
-        mp_msg(MSGT_MUXER, MSGL_V, "Muxer frame buffer sending %d frame(s) to muxer.\n",
-                        s->muxer->muxbuf_num);
+        mp_msg(MSGT_MUXER, MSGL_V, MSGTR_MuxbufSending, s->muxer->muxbuf_num);
         
         /* fix parameters for all streams */
         for (num = 0; s->muxer->streams[num]; ++num) {
@@ -105,7 +104,6 @@
         }
         
         /* write header */
-        mp_msg(MSGT_MUXER, MSGL_INFO, MSGTR_WritingAVIHeader);
         if (s->muxer->cont_write_header)
           muxer_write_header(s->muxer);
         
@@ -139,7 +137,7 @@
     if(s->h.dwSampleSize){
       // CBR
       s->h.dwLength+=len/s->h.dwSampleSize;
-      if(len%s->h.dwSampleSize) mp_msg(MSGT_MUXER, MSGL_WARN, "Warning! len isn't divisable by samplesize!\n");
+      if(len%s->h.dwSampleSize) mp_msg(MSGT_MUXER, MSGL_WARN, MSGTR_WarningLenIsntDivisible);
     } else {
       // VBR
       s->h.dwLength++;
--- a/libmpdemux/muxer_avi.c	Tue Nov 29 19:53:05 2005 +0000
+++ b/libmpdemux/muxer_avi.c	Tue Nov 29 22:04:57 2005 +0000
@@ -18,6 +18,7 @@
 #include "aviheader.h"
 #include "ms_hdr.h"
 #include "mp_msg.h"
+#include "help_mp.h"
 
 extern char *info_name;
 extern char *info_artist;
@@ -277,6 +278,7 @@
   struct avi_stream_info *vsi = muxer->def_v->priv;
   int isodml = vsi->riffofspos > 0;
 
+  mp_msg(MSGT_MUXER, MSGL_INFO, MSGTR_WritingHeader);
   if (aspect == 0) {
     mp_msg(MSGT_MUXER, MSGL_INFO, "ODML: Aspect information not (yet?) available or unspecified, not writing vprp header.\n");
   } else {
@@ -642,6 +644,7 @@
 static void avifile_write_index(muxer_t *muxer){
   struct avi_stream_info *vsi = muxer->def_v->priv;
 
+  mp_msg(MSGT_MUXER, MSGL_INFO, MSGTR_WritingTrailer);
   if (vsi->riffofspos > 0){
     avifile_odml_write_index(muxer);
   } else {
--- a/libmpdemux/muxer_lavf.c	Tue Nov 29 19:53:05 2005 +0000
+++ b/libmpdemux/muxer_lavf.c	Tue Nov 29 22:04:57 2005 +0000
@@ -6,6 +6,7 @@
 #include "config.h"
 #include "version.h"
 #include "mp_msg.h"
+#include "help_mp.h"
 
 #include "bswap.h"
 #include "aviheader.h"
@@ -266,9 +267,9 @@
 {
 	muxer_priv_t *priv = (muxer_priv_t *) muxer->priv;
 	
+	mp_msg(MSGT_MUXER, MSGL_INFO, MSGTR_WritingHeader);
 	av_write_header(priv->oc);
 	muxer->cont_write_header = NULL;
-	mp_msg(MSGT_MUXER, MSGL_INFO, "WRITTEN HEADER\n");
 }
 
 
@@ -277,8 +278,8 @@
 	int i;
 	muxer_priv_t *priv = (muxer_priv_t *) muxer->priv;
 	
+	mp_msg(MSGT_MUXER, MSGL_INFO, MSGTR_WritingTrailer);
 	av_write_trailer(priv->oc);
-	mp_msg(MSGT_MUXER, MSGL_INFO, "WRITTEN TRAILER\n");
 	for(i = 0; i < priv->oc->nb_streams; i++) 
 	{
 		av_freep(&(priv->oc->streams[i]));
--- a/libmpdemux/muxer_mpeg.c	Tue Nov 29 19:53:05 2005 +0000
+++ b/libmpdemux/muxer_mpeg.c	Tue Nov 29 22:04:57 2005 +0000
@@ -7,6 +7,7 @@
 #include "config.h"
 #include "version.h"
 #include "mp_msg.h"
+#include "help_mp.h"
 
 #include "bswap.h"
 
@@ -2555,6 +2556,8 @@
 	double fake_timer;
 	muxer_priv_t *priv = (muxer_priv_t *) muxer->priv;
 
+	mp_msg(MSGT_MUXER, MSGL_INFO, MSGTR_WritingTrailer);
+
 	for(i = 0; i < muxer->avih.dwStreams; i++)
 	{
 		if(muxer->streams[i]->type == MUXER_TYPE_AUDIO)
@@ -2572,6 +2575,8 @@
 {
 	muxer_priv_t *priv = (muxer_priv_t*) muxer->priv;
 	
+	mp_msg(MSGT_MUXER, MSGL_INFO, MSGTR_WritingHeader);
+	
 	priv->headers_cnt++;
 	
 	if((priv->is_genmpeg1 || priv->is_genmpeg2) && (priv->headers_cnt == muxer->avih.dwStreams))
--- a/mencoder.c	Tue Nov 29 19:53:05 2005 +0000
+++ b/mencoder.c	Tue Nov 29 22:04:57 2005 +0000
@@ -1508,10 +1508,8 @@
     if(aencoder->fixup)
         aencoder->fixup(aencoder);
 
-mp_msg(MSGT_MENCODER, MSGL_INFO, MSGTR_WritingAVIIndex);
 if (muxer->cont_write_index) muxer_write_index(muxer);
 muxer_f_size=ftello(muxer_f);
-mp_msg(MSGT_MENCODER, MSGL_INFO, MSGTR_FixupAVIHeader);
 fseek(muxer_f,0,SEEK_SET);
 if (muxer->cont_write_header) muxer_write_header(muxer); // update header
 if(ferror(muxer_f) || fclose(muxer_f) != 0) {