[vlc-commits] file out: make time formatting optional (fixes #7768)

Rémi Denis-Courmont git at videolan.org
Tue Nov 20 21:46:11 CET 2012


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Tue Nov 20 22:42:57 2012 +0200| [400b9b643686981eb0224f5e380a424b468bbdac] | committer: Rémi Denis-Courmont

file out: make time formatting optional (fixes #7768)

This feature has broken far too many scripts and code as it fails the
principle of least surprise.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=400b9b643686981eb0224f5e380a424b468bbdac
---

 modules/access_output/file.c |   19 ++++++++++++++++---
 modules/codec/aes3.c         |    8 ++++----
 2 files changed, 20 insertions(+), 7 deletions(-)

diff --git a/modules/access_output/file.c b/modules/access_output/file.c
index 852ba11..5b2ec29 100644
--- a/modules/access_output/file.c
+++ b/modules/access_output/file.c
@@ -68,6 +68,9 @@ static void Close( vlc_object_t * );
 #define APPEND_TEXT N_("Append to file")
 #define APPEND_LONGTEXT N_( "Append to file if it exists instead " \
                             "of replacing it.")
+#define FORMAT_TEXT N_("Format time and date")
+#define FORMAT_LONGTEXT N_("Perform ISO C time and date formatting " \
+    "on the file path")
 #define SYNC_TEXT N_("Synchronous writing")
 #define SYNC_LONGTEXT N_( "Open the file with synchronous writing.")
 
@@ -82,6 +85,8 @@ vlc_module_begin ()
               OVERWRITE_LONGTEXT, true )
     add_bool( SOUT_CFG_PREFIX "append", false, APPEND_TEXT,APPEND_LONGTEXT,
               true )
+    add_bool( SOUT_CFG_PREFIX "format", false, FORMAT_TEXT, FORMAT_LONGTEXT,
+              true )
 #ifdef O_SYNC
     add_bool( SOUT_CFG_PREFIX "sync", false, SYNC_TEXT,SYNC_LONGTEXT,
               false )
@@ -95,6 +100,7 @@ vlc_module_end ()
  *****************************************************************************/
 static const char *const ppsz_sout_options[] = {
     "append",
+    "format",
     "overwrite",
 #ifdef O_SYNC
     "sync",
@@ -160,8 +166,15 @@ static int Open( vlc_object_t *p_this )
     }
     else
     {
-        char *path = str_format_time (p_access->psz_path);
-        path_sanitize (path);
+        const char *path = p_access->psz_path;
+        char *buf = NULL;
+
+        if (var_InheritBool (p_access, SOUT_CFG_PREFIX"format"))
+        {
+            buf = str_format_time (path);
+            path_sanitize (buf);
+            path = buf;
+        }
 
         int flags = O_RDWR | O_CREAT | O_LARGEFILE;
         if (!overwrite)
@@ -189,7 +202,7 @@ static int Open( vlc_object_t *p_this )
                                 "overridden and its content will be lost."),
                                 _("Keep existing file"),
                                 _("Overwrite"), NULL) == 2);
-        free (path);
+        free (buf);
         if (fd == -1)
             return VLC_EGENERIC;
     }
diff --git a/modules/codec/aes3.c b/modules/codec/aes3.c
index ea9ceae..33af926 100644
--- a/modules/codec/aes3.c
+++ b/modules/codec/aes3.c
@@ -159,7 +159,7 @@ static block_t *Decode( decoder_t *p_dec, block_t **pp_block )
 
     if( i_bits == 24 )
     {
-        uint8_t *p_out = p_aout_buffer->p_buffer;
+        uint32_t *p_out = p_aout_buffer->p_buffer;
 
         while( p_block->i_buffer / 7 )
         {
@@ -182,7 +182,7 @@ static block_t *Decode( decoder_t *p_dec, block_t **pp_block )
     }
     else if( i_bits == 20 )
     {
-        uint8_t *p_out = p_aout_buffer->p_buffer;
+        uint32_t *p_out = p_aout_buffer->p_buffer;
 
         while( p_block->i_buffer / 6 )
         {
@@ -372,8 +372,8 @@ static block_t *Parse( decoder_t *p_dec, int *pi_frame_length, int *pi_bits,
     }
     else
     {
-        p_dec->fmt_out.i_codec = i_bits == 16 ? VLC_CODEC_S16L : VLC_CODEC_S24L;
-        p_dec->fmt_out.audio.i_bitspersample = i_bits == 16 ? 16 : 24;
+        p_dec->fmt_out.i_codec = i_bits == 16 ? VLC_CODEC_S16N : VLC_CODEC_S32N;
+        p_dec->fmt_out.audio.i_bitspersample = i_bits == 16 ? 16 : 32;
     }
 
     p_dec->fmt_out.audio.i_channels = i_channels;



More information about the vlc-commits mailing list