diff --git a/project/VS2010Express/XBMC.vcxproj b/project/VS2010Express/XBMC.vcxproj
index 22bb772e17a67..9273ba0eb1084 100644
--- a/project/VS2010Express/XBMC.vcxproj
+++ b/project/VS2010Express/XBMC.vcxproj
@@ -265,6 +265,7 @@
+
@@ -950,6 +951,7 @@
+
diff --git a/project/VS2010Express/XBMC.vcxproj.filters b/project/VS2010Express/XBMC.vcxproj.filters
index e642a0298ce25..8b0b01435bd39 100644
--- a/project/VS2010Express/XBMC.vcxproj.filters
+++ b/project/VS2010Express/XBMC.vcxproj.filters
@@ -3223,6 +3223,9 @@
filesystem\VideoDatabaseDirectory
+
+ cores\VideoPlayer\DVDDemuxers
+
@@ -6245,6 +6248,9 @@
filesystem\VideoDatabaseDirectory
+
+ cores\VideoPlayer\DVDDemuxers
+
diff --git a/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxFFmpeg.cpp b/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxFFmpeg.cpp
index 8ad42db5aa288..cff755ff365b7 100644
--- a/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxFFmpeg.cpp
+++ b/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxFFmpeg.cpp
@@ -192,6 +192,7 @@ CDVDDemuxFFmpeg::CDVDDemuxFFmpeg() : CDVDDemux()
m_currentPts = DVD_NOPTS_VALUE;
m_bMatroska = false;
m_bAVI = false;
+ m_pSSIF = nullptr;
m_speed = DVD_PLAYSPEED_NORMAL;
m_program = UINT_MAX;
m_pkt.result = -1;
@@ -499,7 +500,7 @@ bool CDVDDemuxFFmpeg::Open(CDVDInputStream* pInput, bool streaminfo, bool filein
if (m_checkvideo)
{
// make sure we start video with an i-frame
- //ResetVideoStreams();
+ ResetVideoStreams();
}
}
else
@@ -536,6 +537,8 @@ void CDVDDemuxFFmpeg::Dispose()
m_pkt.result = -1;
av_free_packet(&m_pkt.pkt);
+ SAFE_DELETE(m_pSSIF);
+
if (m_pFormatContext)
{
for (unsigned int i = 0; i < m_pFormatContext->nb_streams; i++)
@@ -583,6 +586,9 @@ void CDVDDemuxFFmpeg::Flush()
m_pkt.result = -1;
av_free_packet(&m_pkt.pkt);
+
+ if (m_pSSIF)
+ m_pSSIF->Flush();
}
void CDVDDemuxFFmpeg::Abort()
@@ -729,7 +735,9 @@ DemuxPacket* CDVDDemuxFFmpeg::Read()
{
Flush();
}
- else if (IsProgramChange())
+ // libavformat is confused by the interleaved SSIF.
+ // Disable program management for those
+ else if (!m_pSSIF && IsProgramChange())
{
// update streams
CreateStreams(m_program);
@@ -756,6 +764,9 @@ DemuxPacket* CDVDDemuxFFmpeg::Read()
m_pkt.result = -1;
av_free_packet(&m_pkt.pkt);
+
+ if (m_pSSIF)
+ m_pSSIF->Flush();
}
else
{
@@ -765,7 +776,9 @@ DemuxPacket* CDVDDemuxFFmpeg::Read()
if (IsVideoReady())
{
- if (m_program != UINT_MAX)
+ // libavformat is confused by the interleaved SSIF.
+ // Disable program management for those
+ if (!m_pSSIF && m_program != UINT_MAX )
{
/* check so packet belongs to selected program */
for (unsigned int i = 0; i < m_pFormatContext->programs[m_program]->nb_stream_indexes; i++)
@@ -906,6 +919,14 @@ DemuxPacket* CDVDDemuxFFmpeg::Read()
stream = AddStream(pPacket->iStreamId);
}
}
+ if (stream && m_pSSIF)
+ {
+ if (stream->type == STREAM_VIDEO ||
+ stream->type == STREAM_DATA)
+ pPacket = m_pSSIF->AddPacket(pPacket);
+ if (stream->type == STREAM_DATA && pPacket->iSize)
+ stream = GetStreamInternal(pPacket->iStreamId);
+ }
if (!stream)
{
CLog::Log(LOGERROR, "CDVDDemuxFFmpeg::AddStream - internal error, stream is null");
@@ -929,6 +950,9 @@ bool CDVDDemuxFFmpeg::SeekTime(int time, bool backwords, double *startpts)
m_pkt.result = -1;
av_free_packet(&m_pkt.pkt);
+ if (m_pSSIF)
+ m_pSSIF->Flush();
+
CDVDInputStream::ISeekTime* ist = dynamic_cast(m_pInput);
if (ist)
{
@@ -996,6 +1020,9 @@ bool CDVDDemuxFFmpeg::SeekByte(int64_t pos)
m_pkt.result = -1;
av_free_packet(&m_pkt.pkt);
+ if (m_pSSIF)
+ m_pSSIF->Flush();
+
return (ret >= 0);
}
@@ -1184,11 +1211,13 @@ CDemuxStream* CDVDDemuxFFmpeg::AddStream(int iId)
{
if (pStream->codec->codec_id == AV_CODEC_ID_H264_MVC)
{
- // ignore MVC extension streams, they are handled specially
+ m_pSSIF = new CDVDDemuxStreamSSIF();
+ m_pSSIF->SetMVCStreamId(iId);
+
stream = new CDemuxStream();
stream->type = STREAM_DATA;
- stream->disabled = true;
pStream->need_parsing = AVSTREAM_PARSE_NONE;
+ pStream->codec->codec_type = AVMEDIA_TYPE_DATA;
break;
}
CDemuxStreamVideoFFmpeg* st = new CDemuxStreamVideoFFmpeg(this, pStream);
@@ -1286,7 +1315,11 @@ CDemuxStream* CDVDDemuxFFmpeg::AddStream(int iId)
{
if (h264_is_annexb(m_pFormatContext->iformat->name, pStream))
{
- // TODO
+ if (m_pSSIF)
+ {
+ m_pSSIF->SetH264StreamId(iId);
+ pStream->codec->codec_tag = MKTAG('M', 'V', 'C', ' ');
+ }
}
else
{
@@ -1402,7 +1435,7 @@ CDemuxStream* CDVDDemuxFFmpeg::AddStream(int iId)
if (langTag)
strncpy(stream->language, langTag->value, 3);
- if( stream->type != STREAM_NONE && pStream->codec->extradata && pStream->codec->extradata_size > 0 )
+ if (stream->type != STREAM_NONE && pStream->codec->extradata && pStream->codec->extradata_size > 0)
{
stream->ExtraSize = pStream->codec->extradata_size;
stream->ExtraData = new uint8_t[pStream->codec->extradata_size];
@@ -1825,6 +1858,7 @@ void CDVDDemuxFFmpeg::ResetVideoStreams()
if (st->codec->extradata)
av_free(st->codec->extradata);
st->codec->extradata = NULL;
+ st->codec->extradata_size = 0;
st->codec->width = 0;
}
}
diff --git a/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxFFmpeg.h b/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxFFmpeg.h
index 7ab4bbac7e542..4360f61e37d54 100644
--- a/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxFFmpeg.h
+++ b/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxFFmpeg.h
@@ -21,6 +21,7 @@
*/
#include "DVDDemux.h"
+#include "DVDDemuxStreamSSIF.h"
#include "threads/CriticalSection.h"
#include "threads/SystemClock.h"
#include