]> git.sesse.net Git - vlc/commitdiff
* modules/packetizer/mpegvideo.c : cut after a complete picture. (Not
authorLaurent Aimar <fenrir@videolan.org>
Wed, 16 Apr 2003 00:12:36 +0000 (00:12 +0000)
committerLaurent Aimar <fenrir@videolan.org>
Wed, 16 Apr 2003 00:12:36 +0000 (00:12 +0000)
before first slice).
 * ffmpeg: use indeo v3 decoder (untested).
 * stream_ouput.c,libvlc.h : take care of:
 --sout-acodec,--sout-vcodec : use transcoding. (You can specify bitrate
using --sout-abitrate and --sout-vbitrate in kilobits/s).
 --sout-display: to display while streaming.
(Btw there is a problem with vout and display, it leads to a ref count = -1)

modules/codec/ffmpeg/ffmpeg.c
modules/codec/ffmpeg/ffmpeg.h
modules/packetizer/mpegvideo.c
src/libvlc.h
src/stream_output/stream_output.c

index 40ca1cc5591dd049f03beaa9075526453019910f..f3bdfef721f87d073154861107e2e6c0c5ebcbeb 100644 (file)
@@ -2,7 +2,7 @@
  * ffmpeg.c: video decoder using ffmpeg library
  *****************************************************************************
  * Copyright (C) 1999-2001 VideoLAN
- * $Id: ffmpeg.c,v 1.28 2003/03/24 13:50:55 hartman Exp $
+ * $Id: ffmpeg.c,v 1.29 2003/04/16 00:12:36 fenrir Exp $
  *
  * Authors: Laurent Aimar <fenrir@via.ecp.fr>
  *
@@ -562,6 +562,17 @@ static int ffmpeg_GetFfmpegCodec( vlc_fourcc_t i_fourcc,
             psz_name ="Windows Media Audio 2";
             break;
 #endif
+
+#if LIBAVCODEC_BUILD >= 4663
+        case FOURCC_IV31:
+        case FOURCC_iv31:
+        case FOURCC_IV32:
+        case FOURCC_iv32:
+            i_cat    = VIDEO_ES;
+            i_codec  = CODEC_ID_INDEO3;
+            psz_name = "Indeo v3";
+            break;
+#endif
         default:
             i_cat = UNKNOWN_ES;
             i_codec = CODEC_ID_NONE;
index 76d87b5ed859775c87d80d465aad9f7589422d5f..02b567723bafe9af40ffb0186751e1b6ab05e36c 100644 (file)
@@ -2,7 +2,7 @@
  * ffmpeg_vdec.h: video decoder using ffmpeg library
  *****************************************************************************
  * Copyright (C) 2001 VideoLAN
- * $Id: ffmpeg.h,v 1.15 2003/03/24 13:50:55 hartman Exp $
+ * $Id: ffmpeg.h,v 1.16 2003/04/16 00:12:36 fenrir Exp $
  *
  * Authors: Laurent Aimar <fenrir@via.ecp.fr>
  * 
@@ -158,6 +158,11 @@ int E_( GetPESData )( u8 *p_buf, int i_max, pes_packet_t *p_pes );
 #define FOURCC_dvc          VLC_FOURCC('d','v','c',' ')
 #define FOURCC_dvp          VLC_FOURCC('d','v','p',' ')
 
+#define FOURCC_IV31         VLC_FOURCC('I','V','3','1')
+#define FOURCC_iv31         VLC_FOURCC('i','v','3','1')
+#define FOURCC_IV32         VLC_FOURCC('I','V','3','2')
+#define FOURCC_iv32         VLC_FOURCC('i','v','3','2')
+
 /*****************************************************************************
  * Audio codec fourcc
  *****************************************************************************/
index dac33d8ef1a390e52a5fded0caf2905aa5dfc516..559b20d95651e4b5cd0625e6a89bda3e4c093959 100644 (file)
@@ -2,7 +2,7 @@
  * mpegvideo.c
  *****************************************************************************
  * Copyright (C) 2001, 2002 VideoLAN
- * $Id: mpegvideo.c,v 1.12 2003/04/13 20:00:21 fenrir Exp $
+ * $Id: mpegvideo.c,v 1.13 2003/04/16 00:12:36 fenrir Exp $
  *
  * Authors: Laurent Aimar <fenrir@via.ecp.fr>
  *          Eric Petit <titer@videolan.org>
@@ -215,6 +215,7 @@ static int CopyUntilNextStartCode( packetizer_t   *p_pack,
 static void PacketizeThread( packetizer_t *p_pack )
 {
     sout_buffer_t *p_sout_buffer = NULL;
+    vlc_bool_t    b_seen_slice = VLC_FALSE;
     int32_t       i_pos;
     int           i_skipped;
     mtime_t       i_duration; /* of the parsed picture */
@@ -338,7 +339,7 @@ static void PacketizeThread( packetizer_t *p_pack )
 
     for( ;; )
     {
-        uint32_t i_code;
+        uint32_t    i_code;
         if( p_pack->p_fifo->b_die || p_pack->p_fifo->b_error )
         {
             break;
@@ -346,6 +347,11 @@ static void PacketizeThread( packetizer_t *p_pack )
 
         i_code = ShowBits( &p_pack->bit_stream, 32 );
 
+        if( b_seen_slice && ( i_code < 0x101 || i_code > 0x1af ) )
+        {
+            break;
+        }
+
         if( i_code == 0x1B8 ) /* GOP */
         {
             /* usefull for bad MPEG-1 : repeat the sequence_header
@@ -358,10 +364,11 @@ static void PacketizeThread( packetizer_t *p_pack )
                i_pos += p_pack->i_sequence_header_length;
                p_pack->i_last_sequence_header = 0;
             }
-
+#if 1
             p_pack->i_last_ref_pts =
                    p_pack->i_last_dts +
                         (mtime_t)( 1000000 / p_pack->d_frame_rate); /* FIXME */
+#endif
             CopyUntilNextStartCode( p_pack, p_sout_buffer, &i_pos );
         }
         else if( i_code == 0x100 ) /* Picture */
@@ -374,7 +381,6 @@ static void PacketizeThread( packetizer_t *p_pack )
             i_temporal_ref = ShowBits( &p_pack->bit_stream, 10 );
 
             CopyUntilNextStartCode( p_pack, p_sout_buffer, &i_pos );
-            break;
         }
         else if( i_code == 0x1b5 )
         {
@@ -402,6 +408,11 @@ static void PacketizeThread( packetizer_t *p_pack )
         }
         else
         {
+            if( i_code >= 0x101 && i_code <= 0x1af )
+            {
+                b_seen_slice = VLC_TRUE;
+            }
+
             if( i_code == 0x1B3 )
             {
                 p_pack->i_last_sequence_header = 0;
index 0bf323879cb09f70c901a1270db502115c49a2ab..8dd09a2f9d861fb7b449c3a56b55d80ab63f54a4 100644 (file)
@@ -2,7 +2,7 @@
  * libvlc.h: main libvlc header
  *****************************************************************************
  * Copyright (C) 1998-2002 VideoLAN
- * $Id: libvlc.h,v 1.56 2003/04/08 08:35:59 massiot Exp $
+ * $Id: libvlc.h,v 1.57 2003/04/16 00:12:36 fenrir Exp $
  *
  * Authors: Vincent Seguin <seguin@via.ecp.fr>
  *          Samuel Hocevar <sam@zoy.org>
@@ -302,6 +302,10 @@ static char *ppsz_sout_vcodec[] = { "", "mpeg1", "mpeg2", "mpeg4", NULL };
 #define SOUT_LONGTEXT N_( \
     "Empty if no stream output.")
 
+#define SOUT_DISPLAY_TEXT N_("display while streaming")
+#define SOUT_DISPLAY_LONGTEXT N_( \
+    "This allows you to play the stream while streaming it.")
+
 #define SOUT_VIDEO_TEXT N_("enable video stream output")
 #define SOUT_VIDEO_LONGTEXT N_( \
     "This allows you to choose if the video stream should be redirected to " \
@@ -311,6 +315,10 @@ static char *ppsz_sout_vcodec[] = { "", "mpeg1", "mpeg2", "mpeg4", NULL };
 #define SOUT_VCODEC_LONGTEXT N_( \
     "This allows you to force video encoding")
 
+#define SOUT_VBITRATE_TEXT N_("video bitrate encoding (kB/s)" )
+#define SOUT_VBITRATE_LONGTEXT N_( \
+    "This allows you to specify video bitrate in kB/s.")
+
 #define SOUT_AUDIO_TEXT N_("enable audio stream output")
 #define SOUT_AUDIO_LONGTEXT N_( \
     "This allows you to choose if the video stream should be redirected to " \
@@ -320,6 +328,10 @@ static char *ppsz_sout_vcodec[] = { "", "mpeg1", "mpeg2", "mpeg4", NULL };
 #define SOUT_ACODEC_LONGTEXT N_( \
     "This allows you to force audio encoding")
 
+#define SOUT_ABITRATE_TEXT N_("audio bitrate encoding (kB/s)" )
+#define SOUT_ABITRATE_LONGTEXT N_( \
+    "This allows you to specify audio bitrate in kB/s.")
+
 #define PACKETIZER_TEXT N_("choose preferred packetizer list")
 #define PACKETIZER_LONGTEXT N_( \
     "This allows you to select the order in which VLC will choose its " \
@@ -536,10 +548,16 @@ vlc_module_begin();
     /* Stream output options */
     add_category_hint( N_("Stream output"), NULL, VLC_TRUE );
     add_string( "sout", NULL, NULL, SOUT_TEXT, SOUT_LONGTEXT, VLC_TRUE );
+    add_bool( "sout-display", VLC_FALSE, NULL, SOUT_DISPLAY_TEXT, SOUT_DISPLAY_LONGTEXT, VLC_TRUE );
+
     add_bool( "sout-audio", 1, NULL, SOUT_AUDIO_TEXT, SOUT_AUDIO_LONGTEXT, VLC_TRUE );
-    add_bool( "sout-video", 1, NULL, SOUT_VIDEO_TEXT, SOUT_VIDEO_LONGTEXT, VLC_TRUE );
     add_string_from_list( "sout-acodec", "", ppsz_sout_acodec, NULL, SOUT_ACODEC_TEXT, SOUT_ACODEC_LONGTEXT, VLC_TRUE );
+    add_bool( "sout-abitrate", 0, NULL, SOUT_ABITRATE_TEXT, SOUT_ABITRATE_LONGTEXT, VLC_TRUE );
+
+    add_bool( "sout-video", 1, NULL, SOUT_VIDEO_TEXT, SOUT_VIDEO_LONGTEXT, VLC_TRUE );
     add_string_from_list( "sout-vcodec", "", ppsz_sout_vcodec, NULL, SOUT_VCODEC_TEXT, SOUT_VCODEC_LONGTEXT, VLC_TRUE );
+    add_bool( "sout-vbitrate", 0, NULL, SOUT_VBITRATE_TEXT, SOUT_VBITRATE_LONGTEXT, VLC_TRUE );
+
     add_module( "packetizer", "packetizer", NULL, NULL,
                 PACKETIZER_TEXT, PACKETIZER_LONGTEXT, VLC_TRUE );
     add_module( "mux", "sout mux", NULL, NULL, MUX_TEXT, MUX_LONGTEXT, VLC_TRUE );
index 92cb1ac4ad29cfe05a57bdc9eea7731548029f66..70ba34e391560a5836bcaeef5dc617b3c23df421 100644 (file)
@@ -2,7 +2,7 @@
  * stream_output.c : stream output module
  *****************************************************************************
  * Copyright (C) 2002 VideoLAN
- * $Id: stream_output.c,v 1.24 2003/04/13 20:00:21 fenrir Exp $
+ * $Id: stream_output.c,v 1.25 2003/04/16 00:12:36 fenrir Exp $
  *
  * Authors: Christophe Massiot <massiot@via.ecp.fr>
  *          Laurent Aimar <fenrir@via.ecp.fr>
@@ -37,7 +37,9 @@
 /*****************************************************************************
  * Local prototypes
  *****************************************************************************/
-static char *sout_stream_chain_to_str( char * );
+#define sout_stream_url_to_chain( p, s ) _sout_stream_url_to_chain( VLC_OBJECT(p), s )
+static char *_sout_stream_url_to_chain( vlc_object_t *, char * );
+
 /*
  * Generic MRL parser
  *
@@ -87,7 +89,8 @@ sout_instance_t * __sout_NewInstance ( vlc_object_t *p_parent,
     }
     else
     {
-        p_sout->psz_chain = sout_stream_chain_to_str( psz_dest );
+        p_sout->psz_chain = sout_stream_url_to_chain( p_sout, psz_dest );
+        msg_Dbg( p_sout, "using sout chain=`%s'", p_sout->psz_chain );
     }
 
     p_sout->p_stream = sout_stream_new( p_sout, p_sout->psz_chain );
@@ -1138,16 +1141,65 @@ void sout_stream_delete( sout_stream_t *p_stream )
     vlc_object_destroy( p_stream );
 }
 
-static char *sout_stream_chain_to_str( char *psz_url )
+static char *_sout_stream_url_to_chain( vlc_object_t *p_this, char *psz_url )
 {
-    mrl_t mrl;
-    char *psz_chain;
+    mrl_t       mrl;
+    char        *psz_chain, *p;
+    char        *psz_vcodec, *psz_acodec;
 
     mrl_Parse( &mrl, psz_url );
+    p = psz_chain = malloc( 500 + strlen( mrl.psz_way ) + strlen( mrl.psz_access ) + strlen( mrl.psz_name ) );
 
-    psz_chain = malloc( 100 + strlen( mrl.psz_way ) + strlen( mrl.psz_access ) + strlen( mrl.psz_name ) );
+    psz_vcodec = config_GetPsz( p_this, "sout-vcodec" );
+    if( psz_vcodec && *psz_vcodec == '\0')
+    {
+        FREE( psz_vcodec );
+    }
+    psz_acodec = config_GetPsz( p_this, "sout-acodec" );
+    if( psz_acodec && *psz_acodec == '\0' )
+    {
+        FREE( psz_acodec );
+    }
+    /* set transcoding */
+    if( psz_vcodec || psz_acodec )
+    {
+        p += sprintf( p, "transcode{" );
+        if( psz_vcodec )
+        {
+            int br;
+
+            p += sprintf( p, "vcodec=%s,", psz_vcodec );
+
+            if( ( br = config_GetInt( p_this, "sout-vbitrate" ) ) > 0 )
+            {
+                p += sprintf( p, "vb=%d,", br * 1000 );
+            }
+            free( psz_vcodec );
+        }
+        if( psz_acodec )
+        {
+            int br;
 
-    sprintf( psz_chain, "std{mux=%s,access=%s,url=\"%s\"", mrl.psz_way, mrl.psz_access, mrl.psz_name );
+            p += sprintf( p, "acodec=%s,", psz_acodec );
+            if( ( br = config_GetInt( p_this, "sout-abitrate" ) ) > 0 )
+            {
+                p += sprintf( p, "ab=%d,", br * 1000 );
+            }
+
+            free( psz_acodec );
+        }
+        p += sprintf( p, "}:" );
+    }
+
+
+    if( config_GetInt( p_this, "sout-display" ) )
+    {
+        p += sprintf( p, "duplicate{dst=display,dst=std{mux=%s,access=%s,url=\"%s\"}}", mrl.psz_way, mrl.psz_access, mrl.psz_name );
+    }
+    else
+    {
+        p += sprintf( p, "std{mux=%s,access=%s,url=\"%s\"}", mrl.psz_way, mrl.psz_access, mrl.psz_name );
+    }
 
     return( psz_chain );
 }