]> git.sesse.net Git - vlc/blobdiff - modules/stream_out/transcode.c
#transcode{vfilter=...} only works with video filter2 filters.
[vlc] / modules / stream_out / transcode.c
index 4880d395a8f34bee67cc0f09aaa6e4858527bd7c..450f4ba8ccea35ebca69144339a8b76837680b12 100644 (file)
  *****************************************************************************/
 #define VENC_TEXT N_("Video encoder")
 #define VENC_LONGTEXT N_( \
-    "Allows you to specify the video encoder to use and its associated " \
-    "options." )
+    "This is the video encoder module that will be used (and its associated "\
+    "options).")
 #define VCODEC_TEXT N_("Destination video codec")
 #define VCODEC_LONGTEXT N_( \
-    "Allows you to specify the destination video codec used for the " \
-    "streaming output." )
+    "This is the video codec that will be used.")
 #define VB_TEXT N_("Video bitrate")
 #define VB_LONGTEXT N_( \
-    "Allows you to specify the video bitrate used for the streaming " \
-    "output." )
+    "Target bitrate of the transcoded video stream." )
 #define SCALE_TEXT N_("Video scaling")
 #define SCALE_LONGTEXT N_( \
-    "Allows you to scale the video before encoding." )
+    "Scale factor to apply to the video while transcoding (eg: 0.25)")
 #define FPS_TEXT N_("Video frame-rate")
 #define FPS_LONGTEXT N_( \
-    "Allows you to specify an output frame rate for the video." )
+    "Target output frame rate for the video stream." )
 #define DEINTERLACE_TEXT N_("Deinterlace video")
 #define DEINTERLACE_LONGTEXT N_( \
-    "Allows you to deinterlace the video before encoding." )
+    "Deinterlace the video before encoding." )
 #define DEINTERLACE_MODULE_TEXT N_("Deinterlace module")
 #define DEINTERLACE_MODULE_LONGTEXT N_( \
-    "Specifies the deinterlace module to use." )
+    "Specify the deinterlace module to use." )
 #define WIDTH_TEXT N_("Video width")
 #define WIDTH_LONGTEXT N_( \
-    "Allows you to specify the output video width." )
+    "Output video width." )
 #define HEIGHT_TEXT N_("Video height")
 #define HEIGHT_LONGTEXT N_( \
-    "Allows you to specify the output video height." )
+    "Output video height." )
 #define MAXWIDTH_TEXT N_("Maximum video width")
 #define MAXWIDTH_LONGTEXT N_( \
-    "Allows you to specify a maximum output video width." )
+    "Maximum output video width." )
 #define MAXHEIGHT_TEXT N_("Maximum video height")
 #define MAXHEIGHT_LONGTEXT N_( \
-    "Allows you to specify a maximum output video height." )
+    "Maximum output video height." )
 #define VFILTER_TEXT N_("Video filter")
 #define VFILTER_LONGTEXT N_( \
-    "Allows you to specify video filters used after the video " \
-    "transcoding and subpictures overlaying." )
+    "Video filters will be applied to the video streams (after overlays " \
+    "are applied). You must enter a comma-separated list of filters." )
 
-#define CROPTOP_TEXT N_("Video crop top")
+#define CROPTOP_TEXT N_("Video crop (top)")
 #define CROPTOP_LONGTEXT N_( \
-    "Allows you to specify the top coordinate for the video cropping." )
-#define CROPLEFT_TEXT N_("Video crop left")
+    "Number of pixels to crop at the top of the video." )
+#define CROPLEFT_TEXT N_("Video crop (left)")
 #define CROPLEFT_LONGTEXT N_( \
-    "Allows you to specify the left coordinate for the video cropping." )
-#define CROPBOTTOM_TEXT N_("Video crop bottom")
+    "Number of pixels to crop at the left of the video." )
+#define CROPBOTTOM_TEXT N_("Video crop (bottom)")
 #define CROPBOTTOM_LONGTEXT N_( \
-    "Allows you to specify the bottom coordinate for the video cropping." )
-#define CROPRIGHT_TEXT N_("Video crop right")
+    "Number of pixels to crop at the bottom of the video." )
+#define CROPRIGHT_TEXT N_("Video crop (right)")
 #define CROPRIGHT_LONGTEXT N_( \
-    "Allows you to specify the right coordinate for the video cropping." )
+    "Number of pixels to crop at the right of the video." )
 
-#define PADDTOP_TEXT N_("Video padd top")
+#define PADDTOP_TEXT N_("Video padding (top)")
 #define PADDTOP_LONGTEXT N_( \
-    "Allows you to specify padding of black lines at the top." )
-#define PADDLEFT_TEXT N_("Video padd left")
+    "Size of the black border to add at the top of the video." )
+#define PADDLEFT_TEXT N_("Video padding (left)")
 #define PADDLEFT_LONGTEXT N_( \
-    "Allows you to specify padding of black lines on the left." )
-#define PADDBOTTOM_TEXT N_("Video padd bottom")
+    "Size of the black border to add at the left of the video." )
+#define PADDBOTTOM_TEXT N_("Video padding (bottom)")
 #define PADDBOTTOM_LONGTEXT N_( \
-    "Allows you to specify padding of black lines at the top." )
-#define PADDRIGHT_TEXT N_("Video padd right")
+    "Size of the black border to add at the bottom of the video." )
+#define PADDRIGHT_TEXT N_("Video padding (right)")
 #define PADDRIGHT_LONGTEXT N_( \
-    "Allows you to specify padding of black lines on the right." )
+    "Size of the black border to add at the right of the video." )
 
 #define CANVAS_WIDTH_TEXT N_("Video canvas width")
 #define CANVAS_WIDTH_LONGTEXT N_( \
-    "Allows to padd or crop the frame to a specified width" )
+    "This will automatically crod and pad the video to a specified width." )
 #define CANVAS_HEIGHT_TEXT N_("Video canvas height")
 #define CANVAS_HEIGHT_LONGTEXT N_( \
-    "Allows to padd or crop the frame to a specified height" )
+    "This will automatically crod and pad the video to a specified height." )
 #define CANVAS_ASPECT_TEXT N_("Video canvas aspect ratio")
 #define CANVAS_ASPECT_LONGTEXT N_( \
-    "Set aspect (like 4:3) of video canvas and letterbox accordingly" )
+    "This sets aspect (like 4:3) of the video canvas and letterbox the video "\
+    "accordingly." )
 
 #define AENC_TEXT N_("Audio encoder")
 #define AENC_LONGTEXT N_( \
-    "Allows you to specify the audio encoder to use and its associated " \
-    "options." )
+    "This is the audio encoder module that will be used (and its associated "\
+    "options).")
 #define ACODEC_TEXT N_("Destination audio codec")
 #define ACODEC_LONGTEXT N_( \
-    "Allows you to specify the destination audio codec used for the " \
-    "streaming output." )
+    "This is the audio codec that will be used.")
 #define AB_TEXT N_("Audio bitrate")
 #define AB_LONGTEXT N_( \
-    "Allows you to specify the audio bitrate used for the streaming " \
-    "output." )
+    "Target bitrate of the transcoded audio stream." )
 #define ARATE_TEXT N_("Audio sample rate")
 #define ARATE_LONGTEXT N_( \
-    "Allows you to specify the audio sample rate used for the streaming " \
-    "output." )
+ "Sample rate of the transcoded audio stream (11250, 22500, 44100 or 48000).")
 #define ACHANS_TEXT N_("Audio channels")
 #define ACHANS_LONGTEXT N_( \
-    "Allows you to specify the number of audio channels used for the " \
-    "streaming output." )
+    "Number of audio channels in the transcoded streams." )
 
 #define SENC_TEXT N_("Subtitles encoder")
 #define SENC_LONGTEXT N_( \
-    "Allows you to specify the subtitles encoder to use and its associated " \
-    "options." )
+    "This is the subtitles encoder module that will be used (and its " \
+    "associated options)." )
 #define SCODEC_TEXT N_("Destination subtitles codec")
 #define SCODEC_LONGTEXT N_( \
-    "Allows you to specify the destination subtitles codec used for the " \
-    "streaming output." )
-#define SFILTER_TEXT N_("Subpictures filter")
+    "This is the subtitles coded that will be used." )
+
+#define SFILTER_TEXT N_("Overlays")
 #define SFILTER_LONGTEXT N_( \
-    "Allows you to specify subpictures filters used during the video " \
-    "transcoding. The subpictures produced by the filters will be overlayed " \
-    "directly onto the video." )
+    "This allows you to add overlays (also known as \"subpictures\" on the "\
+    "transcoded video stream. The subpictures produced by the filters will "\
+    "be overlayed directly onto the video. You must specify a comma-separated "\
+    "list of subpicture modules" )
 
 #define OSD_TEXT N_("OSD menu")
 #define OSD_LONGTEXT N_(\
-    "Enable streaming of the On Screen Display. It uses the osdmenu subfilter." )
-                  
+    "Stream the On Screen Display menu (using the osdmenu subpicture module)." )
+
 #define THREADS_TEXT N_("Number of threads")
 #define THREADS_LONGTEXT N_( \
-    "Allows you to specify the number of threads used for the transcoding." )
+    "Number of threads used for the transcoding." )
 #define HP_TEXT N_("High priority")
 #define HP_LONGTEXT N_( \
     "Runs the optional encoder thread at the OUTPUT priority instead of " \
     "track on the audio track." )
 
 #define HURRYUP_TEXT N_( "Hurry up" )
-#define HURRYUP_LONGTEXT N_( "Allows you to specify if the transcoder " \
-  "should drop frames if your CPU can't keep up with the encoding rate." )
+#define HURRYUP_LONGTEXT N_( "The transcoder will drop frames if your CPU " \
+                "can't keep up with the encoding rate." )
 
 static char *ppsz_deinterlace_type[] =
 {
@@ -221,7 +217,7 @@ vlc_module_begin();
                  MAXWIDTH_LONGTEXT, VLC_TRUE );
     add_integer( SOUT_CFG_PREFIX "maxheight", 0, NULL, MAXHEIGHT_TEXT,
                  MAXHEIGHT_LONGTEXT, VLC_TRUE );
-    add_module_list_cat( SOUT_CFG_PREFIX "vfilter", SUBCAT_VIDEO_VFILTER,
+    add_module_list_cat( SOUT_CFG_PREFIX "vfilter", SUBCAT_VIDEO_VFILTER2,
                      NULL, NULL,
                      VFILTER_TEXT, VFILTER_LONGTEXT, VLC_FALSE );
 
@@ -512,7 +508,7 @@ static int Open( vlc_object_t *p_this )
             msg_Warn( p_stream, "%d channels invalid for mp3, forcing to 2",
                       p_sys->i_channels );
             p_sys->i_channels = 2;
-        }                    
+        }
         msg_Dbg( p_stream, "codec audio=%4.4s %dHz %d channels %dKb/s",
                  (char *)&p_sys->i_acodec, p_sys->i_sample_rate,
                  p_sys->i_channels, p_sys->i_abitrate / 1000 );
@@ -1124,7 +1120,7 @@ static int Send( sout_stream_t *p_stream, sout_stream_id_t *id,
         /* Transcode OSD menu pictures. */
         if( p_sys->b_es_osd )
         {
-            transcode_osd_process( p_stream, id, p_buffer, &p_out );                
+            transcode_osd_process( p_stream, id, p_buffer, &p_out );
         }
         return p_sys->p_out->pf_send( p_sys->p_out, id->id, p_buffer );
     }
@@ -1296,7 +1292,7 @@ static int transcode_audio_new( sout_stream_t *p_stream,
         module_Need( id->p_encoder, "encoder", p_sys->psz_aenc, VLC_TRUE );
     if( !id->p_encoder->p_module )
     {
-        msg_Err( p_stream, "cannot find encoder" );
+        msg_Err( p_stream, "cannot find encoder (%s)", p_sys->psz_aenc );
         module_Unneed( id->p_decoder, id->p_decoder->p_module );
         id->p_decoder->p_module = 0;
         return VLC_EGENERIC;
@@ -1423,12 +1419,18 @@ static int transcode_audio_process( sout_stream_t *p_stream,
     block_t *p_block, *p_audio_block;
     int i;
     *out = NULL;
+    input_thread_t *p_input = NULL;
+    
+    if( p_stream->p_parent->p_parent && p_stream->p_parent->p_parent->
+                                i_object_type == VLC_OBJECT_INPUT )
+        p_input = (input_thread_t *)p_stream->p_parent->p_parent;
 
     while( (p_audio_buf = id->p_decoder->pf_decode_audio( id->p_decoder,
                                                           &in )) )
     {
-        stats_UpdateInteger( p_stream->p_parent->p_parent, STATS_DECODED_AUDIO,
-                             1, NULL );
+        if( p_input )
+            stats_UpdateInteger( p_input, p_input->counters.p_decoded_audio,
+                                 1, NULL );
         if( p_sys->b_master_sync )
         {
             mtime_t i_dts = date_Get( &id->interpolated_pts ) + 1;
@@ -1592,7 +1594,7 @@ static int transcode_video_new( sout_stream_t *p_stream, sout_stream_id_t *id )
         module_Need( id->p_encoder, "encoder", p_sys->psz_venc, VLC_TRUE );
     if( !id->p_encoder->p_module )
     {
-        msg_Err( p_stream, "cannot find encoder" );
+        msg_Err( p_stream, "cannot find encoder (%s)", p_sys->psz_venc );
         module_Unneed( id->p_decoder, id->p_decoder->p_module );
         id->p_decoder->p_module = 0;
         return VLC_EGENERIC;
@@ -1758,7 +1760,7 @@ static int transcode_video_encoder_open( sout_stream_t *p_stream,
              f_scale_height = f_scale_height * f_target_aspect / f_aspect;
          }
          f_aspect = f_target_aspect;
-         msg_Dbg( p_stream, "Canvas scaled pixel aspect is %f:1", f_aspect );
+         msg_Dbg( p_stream, "canvas scaled pixel aspect is %f:1", f_aspect );
      }
 
      /* f_scale_width and f_scale_height are now final */
@@ -1854,7 +1856,7 @@ static int transcode_video_encoder_open( sout_stream_t *p_stream,
      id->p_encoder->fmt_in.video.i_width = i_dst_width;
      id->p_encoder->fmt_in.video.i_height = i_dst_height;
 
-     msg_Dbg( p_stream, "Source %ix%i, crop %ix%i, "
+     msg_Dbg( p_stream, "source %ix%i, crop %ix%i, "
                         "destination %ix%i, padding %ix%i",
          i_src_width, i_src_height,
          p_sys->i_crop_width, p_sys->i_crop_height,
@@ -1905,7 +1907,7 @@ static int transcode_video_encoder_open( sout_stream_t *p_stream,
         module_Need( id->p_encoder, "encoder", p_sys->psz_venc, VLC_TRUE );
     if( !id->p_encoder->p_module )
     {
-        msg_Err( p_stream, "cannot find encoder" );
+        msg_Err( p_stream, "cannot find encoder (%s)", p_sys->psz_venc );
         return VLC_EGENERIC;
     }
 
@@ -2010,12 +2012,18 @@ static int transcode_video_process( sout_stream_t *p_stream,
     int i_duplicate = 1, i;
     picture_t *p_pic, *p_pic2 = NULL;
     *out = NULL;
+    input_thread_t *p_input = NULL;
+    if( p_stream->p_parent->p_parent && p_stream->p_parent->p_parent->
+                                i_object_type == VLC_OBJECT_INPUT )
+        p_input = (input_thread_t *)p_stream->p_parent->p_parent;
+
 
     while( (p_pic = id->p_decoder->pf_decode_video( id->p_decoder, &in )) )
     {
         subpicture_t *p_subpic = 0;
-        stats_UpdateInteger( p_stream->p_parent->p_parent, STATS_DECODED_VIDEO,
-                              1, NULL );
+        if( p_input )
+            stats_UpdateInteger( p_input, p_input->counters.p_decoded_video,
+                                 1, NULL );
 
         if( p_stream->p_sout->i_out_pace_nocontrol && p_sys->b_hurry_up )
         {
@@ -2581,7 +2589,7 @@ static int transcode_spu_new( sout_stream_t *p_stream, sout_stream_id_t *id )
         if( !id->p_encoder->p_module )
         {
             module_Unneed( id->p_decoder, id->p_decoder->p_module );
-            msg_Err( p_stream, "cannot find encoder" );
+            msg_Err( p_stream, "cannot find encoder (%s)", p_sys->psz_senc );
             return VLC_EGENERIC;
         }
     }
@@ -2717,7 +2725,7 @@ static int transcode_osd_new( sout_stream_t *p_stream, sout_stream_id_t *id )
 
         if( !id->p_encoder->p_module )
         {
-            msg_Err( p_stream, "cannot find encoder" );
+            msg_Err( p_stream, "cannot find encoder (%s)", p_sys->psz_osdenc );
             goto error;
         }