]> git.sesse.net Git - vlc/blobdiff - modules/mux/mpeg/ts.c
Removes trailing spaces. Removes tabs.
[vlc] / modules / mux / mpeg / ts.c
index 109caeab02c995f09aa18f747469b5084b071928..80e8d47589b12aed23d319a4360b1763c852d552 100644 (file)
 /*****************************************************************************
  * Preamble
  *****************************************************************************/
-#include <stdlib.h>
 
 #include <vlc/vlc.h>
-#include <vlc/input.h>
-#include <vlc/sout.h>
+#include <vlc_sout.h>
+#include <vlc_codecs.h>
+#include <vlc_block.h>
 
 #include "iso_lang.h"
 
@@ -156,10 +156,9 @@ static void    Close  ( vlc_object_t * );
   "16 char string (8 hexadecimal bytes).")
 
 #define CPKT_TEXT N_("Packet size in bytes to encrypt")
-/// \bug [String] Extra space
 #define CPKT_LONGTEXT N_("Size of the TS packet to encrypt. " \
     "The encryption routines subtract the TS-header from the value before " \
-    "encrypting. " )
+    "encrypting." )
 
 #define SOUT_CFG_PREFIX "sout-ts-"
 #ifdef HAVE_BSEARCH
@@ -1054,7 +1053,7 @@ static int AddStream( sout_mux_t *p_mux, sout_input_t *p_input )
         {
             char *psz = p_input->p_fmt->p_extra_languages[i-1].psz_language;
             const iso639_lang_t *pl = NULL;
-            
             if( strlen( psz ) == 2 )
             {
                 pl = GetLang_1( psz );
@@ -1072,7 +1071,7 @@ static int AddStream( sout_mux_t *p_mux, sout_input_t *p_input )
                 p_stream->lang[i*3+0] = pl->psz_iso639_2T[0];
                 p_stream->lang[i*3+1] = pl->psz_iso639_2T[1];
                 p_stream->lang[i*3+2] = pl->psz_iso639_2T[2];
-                
                 msg_Dbg( p_mux, "    - lang=%c%c%c",
                          p_stream->lang[i*3+0], p_stream->lang[i*3+1],
                          p_stream->lang[i*3+2] );
@@ -1481,6 +1480,12 @@ static int Mux( sout_mux_t *p_mux )
                                 i_header_size = 0x24;
                                 b_data_alignment = 1;
                             }
+                            else if( p_input->p_fmt->i_codec ==
+                                       VLC_FOURCC('d','v','b','s') )
+                            {
+                                /* EN 300 743 */
+                                b_data_alignment = 1;
+                            }
                         }
                         else if( p_data->i_length < 0 ||
                                  p_data->i_length > 2000000 )
@@ -2496,33 +2501,48 @@ static void GetPMT( sout_mux_t *p_mux, sout_buffer_chain_t *c )
         }
         else if( p_stream->i_codec == VLC_FOURCC('t','e','l','x') )
         {
-            dvbpsi_PMTESAddDescriptor( p_es, 0x56,
-                                       p_stream->i_decoder_specific_info,
-                                       p_stream->p_decoder_specific_info );
+            if( p_stream->i_decoder_specific_info )
+            {
+                dvbpsi_PMTESAddDescriptor( p_es, 0x56,
+                                           p_stream->i_decoder_specific_info,
+                                           p_stream->p_decoder_specific_info );
+            }
+            continue;
         }
-#ifdef _DVBPSI_DR_59_H_
         else if( p_stream->i_codec == VLC_FOURCC('d','v','b','s') )
         {
             /* DVB subtitles */
-            dvbpsi_subtitling_dr_t descr;
-            dvbpsi_subtitle_t sub;
-            dvbpsi_descriptor_t *p_descr;
-
-            memcpy( sub.i_iso6392_language_code, p_stream->lang, 3 );
-            sub.i_subtitling_type = 0x10; /* no aspect-ratio criticality */
-            sub.i_composition_page_id = p_stream->i_es_id & 0xFF;
-            sub.i_ancillary_page_id = p_stream->i_es_id >> 16;
-
-            descr.i_subtitles_number = 1;
-            descr.p_subtitle[0] = sub;
-
-            p_descr = dvbpsi_GenSubtitlingDr( &descr, 0 );
-            /* Work around bug in old libdvbpsi */ p_descr->i_length = 8;
-            dvbpsi_PMTESAddDescriptor( p_es, p_descr->i_tag,
-                                       p_descr->i_length, p_descr->p_data );
+            if( p_stream->i_decoder_specific_info )
+            {
+                /* pass-through from the TS demux */
+                dvbpsi_PMTESAddDescriptor( p_es, 0x59,
+                                           p_stream->i_decoder_specific_info,
+                                           p_stream->p_decoder_specific_info );
+            }
+#ifdef _DVBPSI_DR_59_H_
+            else
+            {
+                /* from the dvbsub transcoder */
+                dvbpsi_subtitling_dr_t descr;
+                dvbpsi_subtitle_t sub;
+                dvbpsi_descriptor_t *p_descr;
+
+                memcpy( sub.i_iso6392_language_code, p_stream->lang, 3 );
+                sub.i_subtitling_type = 0x10; /* no aspect-ratio criticality */
+                sub.i_composition_page_id = p_stream->i_es_id & 0xFF;
+                sub.i_ancillary_page_id = p_stream->i_es_id >> 16;
+
+                descr.i_subtitles_number = 1;
+                descr.p_subtitle[0] = sub;
+
+                p_descr = dvbpsi_GenSubtitlingDr( &descr, 0 );
+                /* Work around bug in old libdvbpsi */ p_descr->i_length = 8;
+                dvbpsi_PMTESAddDescriptor( p_es, p_descr->i_tag,
+                                           p_descr->i_length, p_descr->p_data );
+            }
+#endif /* _DVBPSI_DR_59_H_ */
             continue;
         }
-#endif /* _DVBPSI_DR_59_H_ */
 
         if( p_stream->lang[0] != 0 )
         {