X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=modules%2Fmux%2Fmpeg%2Fts.c;h=80e8d47589b12aed23d319a4360b1763c852d552;hb=6ee1e193fd896ab9a4729fde14f009d9ce629815;hp=3759c44d33065805cb198ec13c11d6cb6ed93714;hpb=62fffadfea2834f7ff57a6ec1b15f8be35e68916;p=vlc diff --git a/modules/mux/mpeg/ts.c b/modules/mux/mpeg/ts.c index 3759c44d33..80e8d47589 100644 --- a/modules/mux/mpeg/ts.c +++ b/modules/mux/mpeg/ts.c @@ -27,11 +27,11 @@ /***************************************************************************** * Preamble *****************************************************************************/ -#include #include -#include -#include +#include +#include +#include #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 ) @@ -1500,7 +1505,7 @@ static int Mux( sout_mux_t *p_mux ) if( p_stream->i_stream_id == 0xa0 && p_data->i_pts <= 0 ) { - /* XXX yes I know, it's awfull, but it's needed, + /* XXX yes I know, it's awful, but it's needed, * so don't remove it ... */ p_data->i_pts = p_data->i_dts; } @@ -1586,7 +1591,6 @@ static int Mux( sout_mux_t *p_mux ) /* Select stream (lowest dts) */ for( i = 0, i_stream = -1, i_dts = 0; i < p_mux->i_nb_inputs; i++ ) { - p_input = p_mux->pp_inputs[i]; p_stream = (ts_stream_t*)p_mux->pp_inputs[i]->p_sys; if( p_stream->i_pes_dts == 0 ) @@ -1606,6 +1610,7 @@ static int Mux( sout_mux_t *p_mux ) break; } p_stream = (ts_stream_t*)p_mux->pp_inputs[i_stream]->p_sys; + p_input = p_mux->pp_inputs[i_stream]; /* do we need to issue pcr */ b_pcr = VLC_FALSE; @@ -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 ) {