diff options
author | jmarshallnz <jcmarsha@gmail.com> | 2014-08-02 13:28:34 +1200 |
---|---|---|
committer | Jonathan Marshall <jmarshall@xbmc.org> | 2014-08-02 15:59:14 +1200 |
commit | 7da666df43d37263c0fc3c4c7b41d98176c4d84a (patch) | |
tree | 8a16355d95d638b796896fd4b46b595f546d1b25 | |
parent | a55eaa3871a0debac99a7c6a254c3d433d775c5e (diff) |
Merge pull request #5042 from koying/fixbitstream
FIX: Upstream Annex-B bitstream conversion fix for some BD mkv iso rips
-rw-r--r-- | xbmc/utils/BitstreamConverter.cpp | 12 | ||||
-rw-r--r-- | xbmc/utils/BitstreamConverter.h | 1 |
2 files changed, 11 insertions, 2 deletions
diff --git a/xbmc/utils/BitstreamConverter.cpp b/xbmc/utils/BitstreamConverter.cpp index 80b4a22179..96516c7a14 100644 --- a/xbmc/utils/BitstreamConverter.cpp +++ b/xbmc/utils/BitstreamConverter.cpp @@ -645,6 +645,7 @@ pps: m_sps_pps_context.sps_pps_data = out; m_sps_pps_context.size = total_size; m_sps_pps_context.first_idr = 1; + m_sps_pps_context.idr_sps_pps_seen = 0; return true; } @@ -677,8 +678,12 @@ bool CBitstreamConverter::BitstreamConvert(uint8_t* pData, int iSize, uint8_t ** if (buf + nal_size > buf_end || nal_size < 0) goto fail; - // prepend only to the first type 5 NAL unit of an IDR picture - if (m_sps_pps_context.first_idr && unit_type == 5) + // Don't add sps/pps if the unit already contain them + if (m_sps_pps_context.first_idr && (unit_type == 7 || unit_type == 8)) + m_sps_pps_context.idr_sps_pps_seen = 1; + + // prepend only to the first access unit of an IDR picture, if no sps/pps already present + if (m_sps_pps_context.first_idr && unit_type == 5 && !m_sps_pps_context.idr_sps_pps_seen) { BitstreamAllocAndCopy(poutbuf, poutbuf_size, m_sps_pps_context.sps_pps_data, m_sps_pps_context.size, buf, nal_size); @@ -688,7 +693,10 @@ bool CBitstreamConverter::BitstreamConvert(uint8_t* pData, int iSize, uint8_t ** { BitstreamAllocAndCopy(poutbuf, poutbuf_size, NULL, 0, buf, nal_size); if (!m_sps_pps_context.first_idr && unit_type == 1) + { m_sps_pps_context.first_idr = 1; + m_sps_pps_context.idr_sps_pps_seen = 0; + } } buf += nal_size; diff --git a/xbmc/utils/BitstreamConverter.h b/xbmc/utils/BitstreamConverter.h index d3ad34672a..f6f53125c2 100644 --- a/xbmc/utils/BitstreamConverter.h +++ b/xbmc/utils/BitstreamConverter.h @@ -182,6 +182,7 @@ protected: typedef struct omx_bitstream_ctx { uint8_t length_size; uint8_t first_idr; + uint8_t idr_sps_pps_seen; uint8_t *sps_pps_data; uint32_t size; } omx_bitstream_ctx; |