[vlc-devel] [PATCH] asf muxer cleanup + feature

Georgi Chorbadzhiyski gf at unixsol.org
Tue Jul 1 16:52:09 CEST 2008


Hi, I've regenerated patches against 0.9-git and they are attached
to this message.

I tried to send them using git send-email, vlc mail server accepts
the emails but nothing is received in the ML, so I'm sending
the patches here manually.

-- 
Georgi Chorbadzhiyski
http://georgi.unixsol.org/
-------------- next part --------------
Return-Path: <gf at unixsol.org>
From: Georgi Chorbadzhiyski <gf at unixsol.org>
Date: Mon, 30 Jun 2008 11:45:09 +0300
Subject: [PATCH] Small cleanup in asf muxer. Use SOUT_CFG_PREFIX in options setup.

Small cleanup in asf muxer. Use SOUT_CFG_PREFIX in options setup.

---
 modules/mux/asf.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/modules/mux/asf.c b/modules/mux/asf.c
index dad3aee..789da06 100644
--- a/modules/mux/asf.c
+++ b/modules/mux/asf.c
@@ -83,7 +83,8 @@ vlc_module_begin();
                                  COMMENT_LONGTEXT, true );
     add_string( SOUT_CFG_PREFIX "rating",  "", NULL, RATING_TEXT,
                                  RATING_LONGTEXT, true );
-    add_integer( "sout-asf-packet-size", 4096, NULL, PACKETSIZE_TEXT, PACKETSIZE_LONGTEXT, true );
+    add_integer( SOUT_CFG_PREFIX "packet-size", 4096, NULL, PACKETSIZE_TEXT,
+                                 PACKETSIZE_LONGTEXT, VLC_TRUE );
 
 vlc_module_end();
 
-- 
1.5.5

-------------- next part --------------
Return-Path: <gf at unixsol.org>
From: Georgi Chorbadzhiyski <gf at unixsol.org>
Date: Mon, 30 Jun 2008 11:49:11 +0300
Subject: [PATCH] When guessing bitrate in ASF muxer add only 128K for audio and 512K for video stream

When guessing bitrate in ASF muxer add only 128K for audio and 512K for video stream

---
 modules/mux/asf.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/modules/mux/asf.c b/modules/mux/asf.c
index 789da06..07be679 100644
--- a/modules/mux/asf.c
+++ b/modules/mux/asf.c
@@ -479,7 +479,7 @@ static int AddStream( sout_mux_t *p_mux, sout_input_t *p_input )
             }
             else
             {
-                p_sys->i_bitrate += 512000;
+                p_sys->i_bitrate += 128000;
             }
             break;
         }
@@ -563,7 +563,7 @@ static int AddStream( sout_mux_t *p_mux, sout_input_t *p_input )
             }
             else
             {
-                p_sys->i_bitrate += 1000000;
+                p_sys->i_bitrate += 512000;
             }
             break;
         }
-- 
1.5.5

-------------- next part --------------
Return-Path: <gf at unixsol.org>
From: Georgi Chorbadzhiyski <gf at unixsol.org>
Date: Mon, 30 Jun 2008 11:52:13 +0300
Subject: [PATCH] Add --sout-asf-bitrate-override setting to ASF muxer

This patch adds setting to override calculated bit rate outputted
into ASF stream. This is needed in the cases where ASF muxer
receives stream in TS (for example) and can't correctly determine
what output bit rate should be.

Windows Media Player actually uses ASF bitrate setting to calculate
how much to cache and if the output bit rate is wrong it tries to
cache too much or too little.

To test the behaviour before this patch try to stream WMV in TS
container to another VLC that remuxes it into ASF. Open the remuxed
stream into WMP and you'll see how it tries to cache 1%, 2%, 3%
and so on...
---
 modules/mux/asf.c |   14 ++++++++++++++
 1 files changed, 14 insertions(+), 0 deletions(-)

diff --git a/modules/mux/asf.c b/modules/mux/asf.c
index 07be679..7a491a5 100644
--- a/modules/mux/asf.c
+++ b/modules/mux/asf.c
@@ -61,6 +61,9 @@ static void Close  ( vlc_object_t * );
 #define RATING_LONGTEXT N_("\"Rating\" to put in ASF comments." )
 #define PACKETSIZE_TEXT N_("Packet Size")
 #define PACKETSIZE_LONGTEXT N_("ASF packet size -- default is 4096 bytes")
+#define BITRATE_TEXT N_("Bitrate override")
+#define BITRATE_LONGTEXT N_("Do not try to guess ASF bitrate. Setting this, allows you to control how Windows Media Player will cache streamed content. Set to audio+video bitrate in bytes")
+
 
 vlc_module_begin();
     set_description( N_("ASF muxer") );
@@ -85,6 +88,8 @@ vlc_module_begin();
                                  RATING_LONGTEXT, true );
     add_integer( SOUT_CFG_PREFIX "packet-size", 4096, NULL, PACKETSIZE_TEXT,
                                  PACKETSIZE_LONGTEXT, VLC_TRUE );
+    add_integer( SOUT_CFG_PREFIX "bitrate-override", 0, NULL, BITRATE_TEXT,
+                                 BITRATE_LONGTEXT, VLC_TRUE );
 
 vlc_module_end();
 
@@ -130,6 +135,7 @@ struct sout_mux_sys_t
     mtime_t         i_dts_last;
     mtime_t         i_preroll_time;
     int64_t         i_bitrate;
+    int64_t         i_bitrate_override;
 
     int             i_track;
     asf_track_t     track[MAX_ASF_TRACKS];
@@ -207,12 +213,16 @@ static int Open( vlc_object_t *p_this )
     p_sys->i_dts_last   = 0;
     p_sys->i_preroll_time = 2000;
     p_sys->i_bitrate    = 0;
+    p_sys->i_bitrate_override = 0;
     p_sys->i_seq        = 0;
 
     p_sys->b_write_header = true;
     p_sys->i_track = 0;
     p_sys->i_packet_size = config_GetInt( p_mux, "sout-asf-packet-size" );
+    p_sys->i_bitrate_override = config_GetInt( p_mux, "sout-asf-bitrate-override" );
     msg_Dbg( p_mux, "Packet size %d", p_sys->i_packet_size);
+    if (p_sys->i_bitrate_override)
+        msg_Dbg( p_mux, "Bitrate override %d", p_sys->i_bitrate_override);
     p_sys->i_packet_count= 0;
 
     /* Generate a random fid */
@@ -481,6 +491,8 @@ static int AddStream( sout_mux_t *p_mux, sout_input_t *p_input )
             {
                 p_sys->i_bitrate += 128000;
             }
+            if (p_sys->i_bitrate_override)
+                p_sys->i_bitrate = p_sys->i_bitrate_override;
             break;
         }
         case VIDEO_ES:
@@ -565,6 +577,8 @@ static int AddStream( sout_mux_t *p_mux, sout_input_t *p_input )
             {
                 p_sys->i_bitrate += 512000;
             }
+            if (p_sys->i_bitrate_override)
+                p_sys->i_bitrate = p_sys->i_bitrate_override;
             break;
         }
         default:
-- 
1.5.5



More information about the vlc-devel mailing list