diff --git a/configure b/configure index 424ab36d77..2a6481b199 100755 --- a/configure +++ b/configure @@ -1325,7 +1325,7 @@ if test -z "$_target" ; then sh3|sh4|sh4a) host_arch=sh ;; s390) host_arch=s390 ;; s390x) host_arch=s390x ;; - mips*) host_arch=mips ;; + *mips*) host_arch=mips ;; vax) host_arch=vax ;; xtensa*) host_arch=xtensa ;; *) host_arch=UNKNOWN ;; diff --git a/libaf/af_lavcac3enc.c b/libaf/af_lavcac3enc.c index e217ffc86c..628c397002 100644 --- a/libaf/af_lavcac3enc.c +++ b/libaf/af_lavcac3enc.c @@ -212,7 +212,7 @@ static af_data_t* play(struct af_instance_s* af, af_data_t* data) if (c->nch >= 5) reorder_channel_nch(s->pending_data, AF_CHANNEL_LAYOUT_MPLAYER_DEFAULT, - AF_CHANNEL_LAYOUT_LAVC_AC3_DEFAULT, + AF_CHANNEL_LAYOUT_LAVC_DEFAULT, c->nch, s->expect_len / 2, 2); @@ -224,7 +224,7 @@ static af_data_t* play(struct af_instance_s* af, af_data_t* data) if (c->nch >= 5) reorder_channel_nch(src, AF_CHANNEL_LAYOUT_MPLAYER_DEFAULT, - AF_CHANNEL_LAYOUT_LAVC_AC3_DEFAULT, + AF_CHANNEL_LAYOUT_LAVC_DEFAULT, c->nch, s->expect_len / 2, 2); len = avcodec_encode_audio(s->lavc_actx,dest,destsize,(void *)src); diff --git a/libaf/reorder_ch.c b/libaf/reorder_ch.c index 88b1aa21dc..b85a45737d 100644 --- a/libaf/reorder_ch.c +++ b/libaf/reorder_ch.c @@ -85,6 +85,7 @@ static int reorder_copy_5ch(void *dest, const void *src, dest_8[i+13] = src_8[i+s4*3+1]; dest_8[i+14] = src_8[i+s4*3+2]; } + break; } case 4: { @@ -163,6 +164,7 @@ static int reorder_copy_6ch(void *dest, const void *src, dest_8[i+16] = src_8[i+s5*3+1]; dest_8[i+17] = src_8[i+s5*3+2]; } + break; } case 4: { @@ -293,6 +295,9 @@ void reorder_channel_copy(void *src, case AF_CHANNEL_LAYOUT_5_1_E << 16 | AF_CHANNEL_LAYOUT_5_1_B: reorder_copy_6ch(dest, src, samples, samplesize, 1, 3, 4, 5, 2, 0); break; + case AF_CHANNEL_LAYOUT_5_1_F << 16 | AF_CHANNEL_LAYOUT_5_1_B: + reorder_copy_6ch(dest, src, samples, samplesize, 1, 2, 4, 5, 0, 3); + break; default: mp_msg(MSGT_GLOBAL, MSGL_WARN, "[reorder_channel_copy] unsupport " "from %x to %x, %d * %d\n", src_layout, dest_layout, @@ -357,6 +362,7 @@ static int reorder_self_2(void *src, unsigned int samples, src_8[i+s1*3+1] = tmp1; src_8[i+s1*3+2] = tmp2; } + break; } case 4: { @@ -623,6 +629,7 @@ static int reorder_self_4_step_2(void *src, unsigned int samples, src_8[i+s3*3+1] = tmp1; src_8[i+s3*3+2] = tmp2; } + break; } default: mp_msg(MSGT_GLOBAL, MSGL_WARN, @@ -1099,6 +1106,9 @@ void reorder_channel(void *src, case AF_CHANNEL_LAYOUT_5_1_E << 16 | AF_CHANNEL_LAYOUT_5_1_B: reorder_self_2_4(src, samples, samplesize, 2, 4, 0, 1, 3, 5); break; + case AF_CHANNEL_LAYOUT_5_1_F << 16 | AF_CHANNEL_LAYOUT_5_1_B: + reorder_self_2_4(src, samples, samplesize, 3, 5, 0, 1, 2, 4); + break; default: mp_msg(MSGT_GLOBAL, MSGL_WARN, "[reorder_channel] unsupported from %x to %x, %d * %d\n", @@ -1111,22 +1121,18 @@ static int channel_layout_mapping_5ch[AF_CHANNEL_LAYOUT_SOURCE_NUM] = { AF_CHANNEL_LAYOUT_ALSA_5CH_DEFAULT, AF_CHANNEL_LAYOUT_AAC_5CH_DEFAULT, AF_CHANNEL_LAYOUT_WAVEEX_5CH_DEFAULT, - AF_CHANNEL_LAYOUT_LAVC_AC3_5CH_DEFAULT, - AF_CHANNEL_LAYOUT_LAVC_LIBA52_5CH_DEFAULT, - AF_CHANNEL_LAYOUT_LAVC_DCA_5CH_DEFAULT, + AF_CHANNEL_LAYOUT_LAVC_5CH_DEFAULT, AF_CHANNEL_LAYOUT_VORBIS_5CH_DEFAULT, - AF_CHANNEL_LAYOUT_FLAC_5CH_DEFAULT, + AF_CHANNEL_LAYOUT_LAVC_AAC_DEC_5CH_DEFAULT, }; static int channel_layout_mapping_6ch[AF_CHANNEL_LAYOUT_SOURCE_NUM] = { AF_CHANNEL_LAYOUT_ALSA_6CH_DEFAULT, AF_CHANNEL_LAYOUT_AAC_6CH_DEFAULT, AF_CHANNEL_LAYOUT_WAVEEX_6CH_DEFAULT, - AF_CHANNEL_LAYOUT_LAVC_AC3_6CH_DEFAULT, - AF_CHANNEL_LAYOUT_LAVC_LIBA52_6CH_DEFAULT, - AF_CHANNEL_LAYOUT_LAVC_DCA_6CH_DEFAULT, + AF_CHANNEL_LAYOUT_LAVC_6CH_DEFAULT, AF_CHANNEL_LAYOUT_VORBIS_6CH_DEFAULT, - AF_CHANNEL_LAYOUT_FLAC_6CH_DEFAULT, + AF_CHANNEL_LAYOUT_LAVC_AAC_DEC_6CH_DEFAULT, }; void reorder_channel_copy_nch(void *src, diff --git a/libaf/reorder_ch.h b/libaf/reorder_ch.h index 72bfccf1e1..cd32fa7808 100644 --- a/libaf/reorder_ch.h +++ b/libaf/reorder_ch.h @@ -53,8 +53,9 @@ #define AF_CHANNEL_LAYOUT_5_1_C ((114<<8)|6|AF_LFE) // L C R Ls Rs LFE #define AF_CHANNEL_LAYOUT_5_1_D ((115<<8)|6|AF_LFE) // C L R Ls Rs LFE #define AF_CHANNEL_LAYOUT_5_1_E ((116<<8)|6|AF_LFE) // LFE L C R Ls Rs -#define AF_CHANNEL_LAYOUT_6_1_A ((117<<8)|7|AF_LFE) // L R C LFE Ls Rs Cs -#define AF_CHANNEL_LAYOUT_7_1_A ((118<<8)|8|AF_LFE) // L R C LFE Ls Rs Rls Rrs +#define AF_CHANNEL_LAYOUT_5_1_F ((117<<8)|6|AF_LFE) // C L R LFE Ls Rs +#define AF_CHANNEL_LAYOUT_6_1_A ((118<<8)|7|AF_LFE) // L R C LFE Ls Rs Cs +#define AF_CHANNEL_LAYOUT_7_1_A ((119<<8)|8|AF_LFE) // L R C LFE Ls Rs Rls Rrs #define AF_CHANNEL_LAYOUT_ALSA_5CH_DEFAULT AF_CHANNEL_LAYOUT_5_0_B @@ -65,16 +66,12 @@ #define AF_CHANNEL_LAYOUT_AAC_6CH_DEFAULT AF_CHANNEL_LAYOUT_5_1_D #define AF_CHANNEL_LAYOUT_WAVEEX_5CH_DEFAULT AF_CHANNEL_LAYOUT_5_0_A #define AF_CHANNEL_LAYOUT_WAVEEX_6CH_DEFAULT AF_CHANNEL_LAYOUT_5_1_A -#define AF_CHANNEL_LAYOUT_LAVC_AC3_5CH_DEFAULT AF_CHANNEL_LAYOUT_5_0_C -#define AF_CHANNEL_LAYOUT_LAVC_AC3_6CH_DEFAULT AF_CHANNEL_LAYOUT_5_1_C -#define AF_CHANNEL_LAYOUT_LAVC_LIBA52_5CH_DEFAULT AF_CHANNEL_LAYOUT_5_0_C -#define AF_CHANNEL_LAYOUT_LAVC_LIBA52_6CH_DEFAULT AF_CHANNEL_LAYOUT_5_1_E -#define AF_CHANNEL_LAYOUT_LAVC_DCA_5CH_DEFAULT AF_CHANNEL_LAYOUT_5_0_D -#define AF_CHANNEL_LAYOUT_LAVC_DCA_6CH_DEFAULT AF_CHANNEL_LAYOUT_5_1_D +#define AF_CHANNEL_LAYOUT_LAVC_5CH_DEFAULT AF_CHANNEL_LAYOUT_5_0_A +#define AF_CHANNEL_LAYOUT_LAVC_6CH_DEFAULT AF_CHANNEL_LAYOUT_5_1_A #define AF_CHANNEL_LAYOUT_VORBIS_5CH_DEFAULT AF_CHANNEL_LAYOUT_5_0_C #define AF_CHANNEL_LAYOUT_VORBIS_6CH_DEFAULT AF_CHANNEL_LAYOUT_5_1_C -#define AF_CHANNEL_LAYOUT_FLAC_5CH_DEFAULT AF_CHANNEL_LAYOUT_5_0_A -#define AF_CHANNEL_LAYOUT_FLAC_6CH_DEFAULT AF_CHANNEL_LAYOUT_5_1_A +#define AF_CHANNEL_LAYOUT_LAVC_AAC_DEC_5CH_DEFAULT AF_CHANNEL_LAYOUT_5_0_D +#define AF_CHANNEL_LAYOUT_LAVC_AAC_DEC_6CH_DEFAULT AF_CHANNEL_LAYOUT_5_1_F #define AF_CHANNEL_MASK 0xFF #define AF_GET_CH_NUM(A) ((A)&0x7F) @@ -100,15 +97,13 @@ void reorder_channel(void *buf, // Channel layout definitions for different audio sources or targets // When specified channel number, they will be map to the specific layouts. -#define AF_CHANNEL_LAYOUT_ALSA_DEFAULT 0 -#define AF_CHANNEL_LAYOUT_AAC_DEFAULT 1 -#define AF_CHANNEL_LAYOUT_WAVEEX_DEFAULT 2 -#define AF_CHANNEL_LAYOUT_LAVC_AC3_DEFAULT 3 -#define AF_CHANNEL_LAYOUT_LAVC_LIBA52_DEFAULT 4 -#define AF_CHANNEL_LAYOUT_LAVC_DCA_DEFAULT 5 -#define AF_CHANNEL_LAYOUT_VORBIS_DEFAULT 6 -#define AF_CHANNEL_LAYOUT_FLAC_DEFAULT 7 -#define AF_CHANNEL_LAYOUT_SOURCE_NUM 8 +#define AF_CHANNEL_LAYOUT_ALSA_DEFAULT 0 +#define AF_CHANNEL_LAYOUT_AAC_DEFAULT 1 +#define AF_CHANNEL_LAYOUT_WAVEEX_DEFAULT 2 +#define AF_CHANNEL_LAYOUT_LAVC_DEFAULT 3 +#define AF_CHANNEL_LAYOUT_VORBIS_DEFAULT 4 +#define AF_CHANNEL_LAYOUT_LAVC_AAC_DEC_DEFAULT 5 +#define AF_CHANNEL_LAYOUT_SOURCE_NUM 6 #define AF_CHANNEL_LAYOUT_MPLAYER_DEFAULT AF_CHANNEL_LAYOUT_ALSA_DEFAULT /// Optimized channel reorder between different audio sources and targets. diff --git a/libao2/ao_dart.c b/libao2/ao_dart.c index e9bff8df1b..6038418203 100644 --- a/libao2/ao_dart.c +++ b/libao2/ao_dart.c @@ -38,6 +38,7 @@ #include "mp_msg.h" #include "libvo/fastmemcpy.h" #include "subopt-helper.h" +#include "libavutil/fifo.h" static const ao_info_t info = { "DART audio output", @@ -53,85 +54,30 @@ LIBAO_EXTERN(dart) #define CHUNK_SIZE ao_data.outburst -static uint8_t *m_audioBuf = NULL; +static AVFifoBuffer *m_audioBuf; static int m_nBufSize = 0; static volatile int m_fQuit = FALSE; -// may only be modified by DART's playback thread or while it is stopped -static volatile int m_iBufReadPos = 0; -// may only be modified by MPlayer's thread -static volatile int m_iBufWritePos = 0; - -// may only be called by MPlayer's thread -// return value may change between immediately following two calls, -// and the real number of free bytes might be larger! -static int buf_free(void) -{ - int nFree = m_iBufReadPos - m_iBufWritePos - CHUNK_SIZE; - - if (nFree < 0) - nFree += m_nBufSize; - - return nFree; -} - -// may only be called by DART's playback thread -// return value may change between immediately following two calls, -// and the real number of buffered bytes might be larger! -static int buf_used(void) -{ - int nUsed = m_iBufWritePos - m_iBufReadPos; - - if (nUsed < 0) - nUsed += m_nBufSize; - - return nUsed; -} static int write_buffer(unsigned char *data, int len) { - int nFirstLen = m_nBufSize - m_iBufWritePos; - int nFree = buf_free(); + int nFree = av_fifo_space(m_audioBuf); if (len > nFree) len = nFree; - if (nFirstLen > len) - nFirstLen = len; - - // till end of buffer - fast_memcpy(m_audioBuf + m_iBufWritePos, data, nFirstLen); - if (len > nFirstLen) { // we have to wrap around - // remaining part from beginning of buffer - fast_memcpy(m_audioBuf, data + nFirstLen, len - nFirstLen); - } - - m_iBufWritePos = (m_iBufWritePos + len) % m_nBufSize; - - return len; + return av_fifo_generic_write(m_audioBuf, data, len, NULL); } static int read_buffer(unsigned char *data, int len) { - int nFirstLen = m_nBufSize - m_iBufReadPos; - int nBuffered = buf_used(); + int nBuffered = av_fifo_size(m_audioBuf); if (len > nBuffered) len = nBuffered; - if (nFirstLen > len) - nFirstLen = len; - - // till end of buffer - fast_memcpy(data, m_audioBuf + m_iBufReadPos, nFirstLen); - if (len > nFirstLen) { // we have to wrap around - // remaining part from beginning of buffer - fast_memcpy(data + nFirstLen, m_audioBuf, len - nFirstLen); - } - - m_iBufReadPos = (m_iBufReadPos + len) % m_nBufSize; - + av_fifo_generic_read(m_audioBuf, data, len, NULL); return len; } @@ -253,10 +199,7 @@ static int init(int rate, int channels, int format, int flags) // and one more chunk plus round up m_nBufSize += 2 * CHUNK_SIZE; - m_audioBuf = malloc(m_nBufSize); - - m_iBufReadPos = 0; - m_iBufWritePos = 0; + m_audioBuf = av_fifo_alloc(m_nBufSize); dartPlay(); @@ -280,7 +223,7 @@ static void uninit(int immed) dartClose(); - free(m_audioBuf); + av_fifo_free(m_audioBuf); } // stop playing and empty buffers (for seeking/pause) @@ -289,8 +232,7 @@ static void reset(void) dartPause(); // Reset ring-buffer state - m_iBufReadPos = 0; - m_iBufWritePos = 0; + av_fifo_reset(m_audioBuf); dartResume(); } @@ -310,7 +252,7 @@ static void audio_resume(void) // return: how many bytes can be played without blocking static int get_space(void) { - return buf_free(); + return av_fifo_space(m_audioBuf); } // plays 'len' bytes of 'data' @@ -328,7 +270,7 @@ static int play(void *data, int len, int flags) // return: delay in seconds between first and last sample in buffer static float get_delay(void) { - int nBuffered = m_nBufSize - CHUNK_SIZE - buf_free(); // could be less + int nBuffered = av_fifo_size(m_audioBuf); // could be less return (float)nBuffered / (float)ao_data.bps; } diff --git a/libao2/ao_openal.c b/libao2/ao_openal.c index b00a77364a..3cf7d43a9d 100644 --- a/libao2/ao_openal.c +++ b/libao2/ao_openal.c @@ -52,7 +52,7 @@ static const ao_info_t info = LIBAO_EXTERN(openal) -#define MAX_CHANS 6 +#define MAX_CHANS 8 #define NUM_BUF 128 #define CHUNK_SIZE 512 static ALuint buffers[MAX_CHANS][NUM_BUF]; @@ -95,10 +95,11 @@ static void print_help(void) { static int init(int rate, int channels, int format, int flags) { float position[3] = {0, 0, 0}; float direction[6] = {0, 0, 1, 0, -1, 0}; - float sppos[6][3] = { + float sppos[MAX_CHANS][3] = { {-1, 0, 0.5}, {1, 0, 0.5}, {-1, 0, -1}, {1, 0, -1}, {0, 0, 1}, {0, 0, 0.1}, + {-1, 0, 0}, {1, 0, 0}, }; ALCdevice *dev = NULL; ALCcontext *ctx = NULL; diff --git a/libmpcodecs/ad_ffmpeg.c b/libmpcodecs/ad_ffmpeg.c index 0a4db6c600..9829e57975 100644 --- a/libmpcodecs/ad_ffmpeg.c +++ b/libmpcodecs/ad_ffmpeg.c @@ -174,27 +174,19 @@ static int decode_audio(sh_audio_t *sh_audio,unsigned char *buf,int minlen,int m if(len2>0){ if (((AVCodecContext *)sh_audio->context)->channels >= 5) { int src_ch_layout = AF_CHANNEL_LAYOUT_MPLAYER_DEFAULT; + int samplesize = av_get_bits_per_sample_format(((AVCodecContext *) + sh_audio->context)->sample_fmt) / 8; const char *codec=((AVCodecContext*)sh_audio->context)->codec->name; - if (!strcasecmp(codec, "ac3") - || !strcasecmp(codec, "eac3")) - src_ch_layout = AF_CHANNEL_LAYOUT_LAVC_AC3_DEFAULT; - else if (!strcasecmp(codec, "dca")) - src_ch_layout = AF_CHANNEL_LAYOUT_LAVC_DCA_DEFAULT; - else if (!strcasecmp(codec, "libfaad") - || !strcasecmp(codec, "mpeg4aac")) - src_ch_layout = AF_CHANNEL_LAYOUT_AAC_DEFAULT; - else if (!strcasecmp(codec, "liba52")) - src_ch_layout = AF_CHANNEL_LAYOUT_LAVC_LIBA52_DEFAULT; + if (!strcasecmp(codec, "aac")) + src_ch_layout = AF_CHANNEL_LAYOUT_LAVC_AAC_DEC_DEFAULT; else if (!strcasecmp(codec, "vorbis")) src_ch_layout = AF_CHANNEL_LAYOUT_VORBIS_DEFAULT; - else if (!strcasecmp(codec, "flac")) - src_ch_layout = AF_CHANNEL_LAYOUT_FLAC_DEFAULT; else - src_ch_layout = AF_CHANNEL_LAYOUT_MPLAYER_DEFAULT; + src_ch_layout = AF_CHANNEL_LAYOUT_LAVC_DEFAULT; reorder_channel_nch(buf, src_ch_layout, AF_CHANNEL_LAYOUT_MPLAYER_DEFAULT, ((AVCodecContext *)sh_audio->context)->channels, - len2 / 2, 2); + len2 / samplesize, samplesize); } //len=len2;break; if(len<0) len=len2; else len+=len2; diff --git a/libmpcodecs/ae_lavc.c b/libmpcodecs/ae_lavc.c index 205893189b..81b76ee062 100644 --- a/libmpcodecs/ae_lavc.c +++ b/libmpcodecs/ae_lavc.c @@ -106,7 +106,7 @@ static int encode_lavc(audio_encoder_t *encoder, uint8_t *dest, void *src, int s !strcmp(lavc_acodec->name,"libfaac"))) { int isac3 = !strcmp(lavc_acodec->name,"ac3"); reorder_channel_nch(src, AF_CHANNEL_LAYOUT_MPLAYER_DEFAULT, - isac3 ? AF_CHANNEL_LAYOUT_LAVC_AC3_DEFAULT + isac3 ? AF_CHANNEL_LAYOUT_LAVC_DEFAULT : AF_CHANNEL_LAYOUT_AAC_DEFAULT, encoder->params.channels, size / 2, 2); diff --git a/libmpdemux/demux_ts.c b/libmpdemux/demux_ts.c index 938793bdc4..109275a7fa 100644 --- a/libmpdemux/demux_ts.c +++ b/libmpdemux/demux_ts.c @@ -80,6 +80,7 @@ typedef enum AUDIO_TRUEHD = mmioFOURCC('T', 'R', 'H', 'D'), SPU_DVD = 0x3000000, SPU_DVB = 0x3000001, + SPU_TELETEXT = 0x3000002, PES_PRIVATE1 = 0xBD00000, SL_PES_STREAM = 0xD000000, SL_SECTION = 0xD100000, @@ -247,6 +248,7 @@ typedef struct { #define IS_AUDIO(x) (((x) == AUDIO_MP2) || ((x) == AUDIO_A52) || ((x) == AUDIO_LPCM_BE) || ((x) == AUDIO_AAC) || ((x) == AUDIO_DTS) || ((x) == AUDIO_TRUEHD)) #define IS_VIDEO(x) (((x) == VIDEO_MPEG1) || ((x) == VIDEO_MPEG2) || ((x) == VIDEO_MPEG4) || ((x) == VIDEO_H264) || ((x) == VIDEO_AVC) || ((x) == VIDEO_VC1)) +#define IS_SUB(x) (((x) == SPU_DVD) || ((x) == SPU_DVB) || ((x) == SPU_TELETEXT)) static int ts_parse(demuxer_t *demuxer, ES_stream_t *es, unsigned char *packet, int probe); @@ -695,7 +697,7 @@ static off_t ts_detect_streams(demuxer_t *demuxer, tsdemux_init_t *param) is_audio = IS_AUDIO(es.type) || ((es.type==SL_PES_STREAM) && IS_AUDIO(es.subtype)); is_video = IS_VIDEO(es.type) || ((es.type==SL_PES_STREAM) && IS_VIDEO(es.subtype)); - is_sub = ((es.type == SPU_DVD) || (es.type == SPU_DVB)); + is_sub = IS_SUB(es.type); if((! is_audio) && (! is_video) && (! is_sub)) @@ -882,8 +884,8 @@ static off_t ts_detect_streams(demuxer_t *demuxer, tsdemux_init_t *param) mp_msg(MSGT_DEMUXER, MSGL_INFO, "NO AUDIO! "); } - if(param->stype == SPU_DVD || param->stype == SPU_DVB) - mp_msg(MSGT_DEMUXER, MSGL_INFO, " SUB %s(pid=%d) ", (param->stype==SPU_DVD ? "DVD" : "DVB"), param->spid); + if(IS_SUB(param->stype)) + mp_msg(MSGT_DEMUXER, MSGL_INFO, " SUB %s(pid=%d) ", (param->stype==SPU_DVD ? "DVD" : param->stype==SPU_DVB ? "DVB" : "Teletext"), param->spid); else { param->stype = UNKNOWN; @@ -2250,6 +2252,14 @@ static int parse_descriptors(struct pmt_es_t *es, uint8_t *ptr) mp_msg(MSGT_DEMUX, MSGL_DBG2, "DVB DTS Descriptor\n"); } } + else if(ptr[j] == 0x56) // Teletext + { + if(descr_len >= 5) { + memcpy(es->lang, ptr+2, 3); + es->lang[3] = 0; + } + es->type = SPU_TELETEXT; + } else if(ptr[j] == 0x59) //Subtitling Descriptor { uint8_t subtype; @@ -2880,7 +2890,7 @@ static int ts_parse(demuxer_t *demuxer , ES_stream_t *es, unsigned char *packet, is_video = IS_VIDEO(tss->type) || (tss->type==SL_PES_STREAM && IS_VIDEO(tss->subtype)); is_audio = IS_AUDIO(tss->type) || (tss->type==SL_PES_STREAM && IS_AUDIO(tss->subtype)) || (tss->type == PES_PRIVATE1); - is_sub = ((tss->type == SPU_DVD) || (tss->type == SPU_DVB)); + is_sub = IS_SUB(tss->type); pid_type = pid_type_from_pmt(priv, pid); // PES CONTENT STARTS HERE @@ -2913,7 +2923,7 @@ static int ts_parse(demuxer_t *demuxer , ES_stream_t *es, unsigned char *packet, si = &priv->astr; } else if(is_sub - || (pid_type == SPU_DVD) || (pid_type == SPU_DVB)) + || IS_SUB(pid_type)) { //SUBS are infrequent, so the initial detection may fail // and we may need to add them at play-time @@ -3062,7 +3072,7 @@ static int ts_parse(demuxer_t *demuxer , ES_stream_t *es, unsigned char *packet, tss->is_synced |= es->is_synced || rap_flag; tss->payload_size = es->payload_size; - if(is_audio && (lang = pid_lang_from_pmt(priv, es->pid))) + if((is_sub || is_audio) && (lang = pid_lang_from_pmt(priv, es->pid))) { memcpy(es->lang, lang, 3); es->lang[3] = 0;