summaryrefslogtreecommitdiff
authorJian Wang <jian.wang@amlogic.com>2017-02-14 10:55:59 (GMT)
committer Jian Wang <jian.wang@amlogic.com>2017-03-17 07:49:18 (GMT)
commitf0b764c03d98469613662ee12f7109195794ba28 (patch)
tree608d93cf611cb324cf37fb8355182a3f89eff225
parent5f6b4e12b03e3f366fa50a46c0d085d08a4b6fb0 (diff)
downloadffmpeg-f0b764c03d98469613662ee12f7109195794ba28.zip
ffmpeg-f0b764c03d98469613662ee12f7109195794ba28.tar.gz
ffmpeg-f0b764c03d98469613662ee12f7109195794ba28.tar.bz2
PD#138967: modify for amnuplayer use ffmpeg dumux
1.fix some ts with trueHD and dts play err 2.add metadata iTunSMPB for acc skip data 3.add fomart audio DRA Change-Id: Ia1a4419c1ddf5ec5ccd4f2d0bc0d602a100e90c4
Diffstat
-rw-r--r--libavcodec/avcodec.h1
-rw-r--r--libavformat/mov.c1
-rwxr-xr-xlibavformat/mpegts.c51
3 files changed, 52 insertions, 1 deletions
diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index f7be037..3a40c4b 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -469,6 +469,7 @@ enum AVCodecID {
AV_CODEC_ID_TAK = MKBETAG('t','B','a','K'),
AV_CODEC_ID_EVRC = MKBETAG('s','e','v','c'),
AV_CODEC_ID_SMV = MKBETAG('s','s','m','v'),
+ AV_CODEC_ID_DRA = MKBETAG('D','A','R','1'),
/* subtitle codecs */
AV_CODEC_ID_FIRST_SUBTITLE = 0x17000, ///< A dummy ID pointing at the start of subtitle codecs.
diff --git a/libavformat/mov.c b/libavformat/mov.c
index 0fb4dde..2b6c4bf 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -183,6 +183,7 @@ static int mov_read_custom_metadata(MOVContext *c, AVIOContext *pb, MOVAtom atom
if (*key && *data) {
if (strcmp(key, "iTunSMPB") == 0) {
+ av_dict_set(&st->metadata, key, data, 0);
int priming, remainder, samples;
if(sscanf(data, "%*X %X %X %X", &priming, &remainder, &samples) == 3){
if(priming>0 && priming<16384)
diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c
index 22fb33c..a9c5ca0 100755
--- a/libavformat/mpegts.c
+++ b/libavformat/mpegts.c
@@ -639,6 +639,7 @@ static const StreamType REGD_types[] = {
{ MKTAG('H','E','V','C'), AVMEDIA_TYPE_VIDEO, AV_CODEC_ID_HEVC },
{ MKTAG('K','L','V','A'), AVMEDIA_TYPE_DATA, AV_CODEC_ID_SMPTE_KLV },
{ MKTAG('V','C','-','1'), AVMEDIA_TYPE_VIDEO, AV_CODEC_ID_VC1 },
+ { MKTAG('D','R','A','1'), AVMEDIA_TYPE_AUDIO, AV_CODEC_ID_DRA },
{ 0 },
};
@@ -729,7 +730,53 @@ static int mpegts_set_stream_info(AVStream *st, PESContext *pes,
sub_st->need_parsing = AVSTREAM_PARSE_FULL;
sub_pes->sub_st = pes->sub_st = sub_st;
}
+ if (pes->stream_type == 0x81) {
+ // HDMV AC3 streams also contain an TRUEHD coded version of the
+ // audio track - add a second stream for this
+ AVStream *sub_st;
+ // priv_data cannot be shared between streams
+ PESContext *sub_pes = av_malloc(sizeof(*sub_pes));
+ if (!sub_pes)
+ return AVERROR(ENOMEM);
+ memcpy(sub_pes, pes, sizeof(*sub_pes));
+
+ sub_st = avformat_new_stream(pes->stream, NULL);
+ if (!sub_st) {
+ av_free(sub_pes);
+ return AVERROR(ENOMEM);
+ }
+
+ sub_st->id = pes->pid;
+ avpriv_set_pts_info(sub_st, 33, 1, 90000);
+ sub_st->priv_data = sub_pes;
+ sub_st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
+ sub_st->codec->codec_id = AV_CODEC_ID_TRUEHD;
+ sub_st->need_parsing = AVSTREAM_PARSE_FULL;
+ sub_st->discard = AVDISCARD_ALL;
+ sub_pes->sub_st = pes->sub_st = sub_st;
+ }
+ }
+ if (st->codec->codec_id == AV_CODEC_ID_NONE && pes->stream_type == 0x82) {
+ AVStream *sub_st;
+ PESContext *sub_pes = av_malloc(sizeof(*sub_pes));
+ if (!sub_pes)
+ return AVERROR(ENOMEM);
+ memcpy(sub_pes, pes, sizeof(*sub_pes));
+ sub_st = avformat_new_stream(pes->stream, NULL);
+ if (!sub_st) {
+ av_free(sub_pes);
+ return AVERROR(ENOMEM);
+ }
+
+ sub_st->id = pes->pid;
+ av_set_pts_info(sub_st, 33, 1, 90000);
+ sub_st->priv_data = sub_pes;
+ sub_st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
+ sub_st->codec->codec_id = CODEC_ID_DTS;
+ sub_st->need_parsing = AVSTREAM_PARSE_FULL;
+ sub_pes->sub_st = pes->sub_st = sub_st;
}
+
if (st->codec->codec_id == AV_CODEC_ID_NONE)
mpegts_find_stream_type(st, pes->stream_type, MISC_types);
if (st->codec->codec_id == AV_CODEC_ID_NONE){
@@ -758,6 +805,8 @@ static void new_pes_packet(PESContext *pes, AVPacket *pkt)
// Separate out the AC3 substream from an HDMV combined TrueHD/AC3 PID
if (pes->sub_st && pes->stream_type == 0x83 && pes->extended_stream_id == 0x76)
pkt->stream_index = pes->sub_st->index;
+ else if (pes->sub_st && pes->stream_type == 0x81 && pes->extended_stream_id == 0x72)
+ pkt->stream_index = pes->sub_st->index;
else
pkt->stream_index = pes->st->index;
pkt->pts = pes->pts;
@@ -1659,7 +1708,7 @@ static void pmt_cb(MpegTSFilter *filter, const uint8_t *section, int section_len
mp4_descr, mp4_descr_count, pid, ts) < 0)
break;
- if (pes && prog_reg_desc == AV_RL32("HDMV") && stream_type == 0x83 && pes->sub_st) {
+ if (pes && prog_reg_desc == AV_RL32("HDMV") && (stream_type == 0x83 || stream_type == 0x81) && pes->sub_st) {
ff_program_add_stream_index(ts->stream, h->id, pes->sub_st->index);
pes->sub_st->codec->codec_tag = st->codec->codec_tag;
}