st(0x0e, N, 0, 0, "ISO 13818-1 auxiliary"),
st(0x0f, A, HB_ACODEC_MPGA, CODEC_ID_AAC, "ISO 13818-7 AAC Audio"),
st(0x10, V, WORK_DECAVCODECV, CODEC_ID_MPEG4, "MPEG4"),
+#if defined(OLD_LATM_PATCH)
st(0x11, A, HB_ACODEC_MPGA, CODEC_ID_AAC_LATM, "MPEG4 LATM AAC"),
+#else
+ st(0x11, N, 0, 0, "MPEG4 LATM AAC"),
+#endif
st(0x12, U, 0, 0, "MPEG4 generic"),
st(0x14, N, 0, 0, "ISO 13818-6 DSM-CC download"),
st(0x80, N, HB_ACODEC_MPGA, CODEC_ID_PCM_BLURAY, "DigiCipher II Video"),
st(0x81, A, HB_ACODEC_AC3, 0, "AC-3"),
st(0x82, A, HB_ACODEC_DCA, 0, "HDMV DTS"),
- st(0x83, A, HB_ACODEC_LPCM, 0, "LPCM"),
- st(0x84, A, 0, 0, "SDDS"),
+ st(0x83, A, HB_ACODEC_LPCM, 0, "LPCM/TrueHD"),
+ st(0x84, A, 0, 0, "SDDS/EAC3"),
st(0x85, U, 0, 0, "ATSC Program ID"),
st(0x86, A, HB_ACODEC_DCA, 0, "DTS-HD"),
- st(0x87, A, 0, 0, "E-AC-3"),
+ st(0x87, A, HB_ACODEC_MPGA, CODEC_ID_EAC3, "EAC3"),
st(0x8a, A, HB_ACODEC_DCA, 0, "DTS"),
d->ts_multiplexed[d->ts_number_pids] = 0x71;
d->ts_stream_type[d->ts_number_pids] = 0x82;
}
+ if ( d->ts_stream_type[d->ts_number_pids] == 0x84 &&
+ title->reg_desc == STR4_TO_UINT32("HDMV") )
+ {
+ // EAC3 audio in bluray has an stype of 0x84
+ // which conflicts with SDDS
+ // To distinguish, Bluray streams have a reg_desc of HDMV
+ d->ts_stream_type[d->ts_number_pids] = 0x87;
+ }
d->ts_number_pids++;
}
stream->ts_stream_type[idx] = 0x82;
kind = A;
}
+ if ( stype == 0x84 &&
+ stream->pmt_info.reg_desc == STR4_TO_UINT32("HDMV") )
+ {
+ // EAC3 audio in bluray has an stype of 0x84
+ // which conflicts with SDDS
+ // To distinguish, Bluray streams have a reg_desc of HDMV
+ stype = 0x87;
+ stream->ts_stream_type[idx] = 0x87;
+ kind = A;
+ }
}
else if ((buf[3] & 0xe0) == 0xc0)
{
stream->ts_stream_type[esindx] = 0x81;
break;
+ case 0x7a: // DVB EAC-3 descriptor
+ stream->ts_stream_type[esindx] = 0x87;
+ break;
+
default:
break;
}
( pkt[10] >> 7 );
++stream->ts_pcr_in;
stream->ts_found_pcr = 1;
+ stream->ts_flags |= TS_HAS_PCR;
}
}
return 0;
}
// if we have a dts use it otherwise use the pts
- stream->ts_pcr = pes_timestamp( pes + ( pes[7] & 0x40? 14 : 9 ) );
+ stream->ts_pcr = pes_timestamp( pes + ( pes[7] & 0x40?14:9 ) );
++stream->ts_pcr_in;
}
}
void *hb_ffmpeg_context( int codec_param )
{
+ if ( ffmpeg_streams == NULL )
+ return NULL;
+
int slot = codec_param & (ffmpeg_sl_size - 1);
int stream_index = codec_param >> ffmpeg_sl_bits;
return ffmpeg_streams[slot]->ffmpeg_ic->streams[stream_index]->codec;
void *hb_ffmpeg_avstream( int codec_param )
{
+ if ( ffmpeg_streams == NULL )
+ return NULL;
+
int slot = codec_param & (ffmpeg_sl_size - 1);
int stream_index = codec_param >> ffmpeg_sl_bits;
return ffmpeg_streams[slot]->ffmpeg_ic->streams[stream_index];
{
return 0;
}
- if ( av_find_stream_info( ic ) < 0 )
+ if ( hb_av_find_stream_info( ic ) < 0 )
goto fail;
stream->ffmpeg_ic = ic;
strcpy( subtitle->lang, language->eng_name );
strncpy( subtitle->iso639_2, language->iso639_2, 4 );
+ // Copy the extradata for the subtitle track
+ subtitle->extradata = malloc( codec->extradata_size );
+ memcpy( subtitle->extradata, codec->extradata, codec->extradata_size );
+ subtitle->extradata_size = codec->extradata_size;
+
hb_list_add(title->list_subtitle, subtitle);
}
+static char *get_ffmpeg_metadata_value( AVMetadata *m, char *key )
+{
+ AVMetadataTag *tag = NULL;
+ while ( (tag = av_metadata_get(m, "", tag, AV_METADATA_IGNORE_SUFFIX)) )
+ {
+ if ( !strcmp( key, tag->key ) )
+ {
+ return tag->value;
+ }
+ }
+ return NULL;
+}
+
+static void add_ffmpeg_attachment( hb_title_t *title, hb_stream_t *stream, int id )
+{
+ AVStream *st = stream->ffmpeg_ic->streams[id];
+ AVCodecContext *codec = st->codec;
+
+ enum attachtype type;
+ switch ( codec->codec_id )
+ {
+ case CODEC_ID_TTF:
+ type = FONT_TTF_ATTACH;
+ break;
+ default:
+ // Ignore unrecognized attachment type
+ return;
+ }
+
+ hb_attachment_t *attachment = calloc( 1, sizeof(*attachment) );
+
+ // Copy the attachment name and data
+ attachment->type = type;
+ attachment->name = strdup( get_ffmpeg_metadata_value( st->metadata, "filename" ) );
+ attachment->data = malloc( codec->extradata_size );
+ memcpy( attachment->data, codec->extradata, codec->extradata_size );
+ attachment->size = codec->extradata_size;
+
+ hb_list_add(title->list_attachment, attachment);
+}
+
static hb_title_t *ffmpeg_title_scan( hb_stream_t *stream )
{
AVFormatContext *ic = stream->ffmpeg_ic;
{
add_ffmpeg_subtitle( title, stream, i );
}
+ else if ( ic->streams[i]->codec->codec_type == CODEC_TYPE_ATTACHMENT )
+ {
+ add_ffmpeg_attachment( title, stream, i );
+ }
}
title->container_name = strdup( ic->iformat->name );