diff options
author | Hendrik Leppkes <h.leppkes@gmail.com> | 2016-07-11 12:42:51 +0300 |
---|---|---|
committer | Hendrik Leppkes <h.leppkes@gmail.com> | 2016-07-11 12:56:46 +0300 |
commit | a1f280ecae1f8dc200f8007ba07aeba85f89cc73 (patch) | |
tree | 44b1e09d7207606075f8fa6ad20f9e3752511bf3 /common | |
parent | ae1f01fedee935731bf3e7c1c0f5844ab03ca6af (diff) |
Forward FFMpeg side-data to the decoders
Diffstat (limited to 'common')
-rw-r--r-- | common/DSUtilLite/DShowUtil.cpp | 25 | ||||
-rw-r--r-- | common/DSUtilLite/DShowUtil.h | 4 |
2 files changed, 29 insertions, 0 deletions
diff --git a/common/DSUtilLite/DShowUtil.cpp b/common/DSUtilLite/DShowUtil.cpp index ffea3fe3..577b1180 100644 --- a/common/DSUtilLite/DShowUtil.cpp +++ b/common/DSUtilLite/DShowUtil.cpp @@ -27,6 +27,8 @@ #include "registry.h" +#include "IMediaSideDataFFmpeg.h" + // // Usage: SetThreadName (-1, "MainThread"); // @@ -695,6 +697,29 @@ void getExtraData(const BYTE *format, const GUID *formattype, const size_t forma *extralen = extralength; } +void CopyMediaSideDataFF(AVPacket *dst, const MediaSideDataFFMpeg **sd) +{ + if (!dst) + return; + + if (!sd || !*sd) { + dst->side_data = nullptr; + dst->side_data_elems = 0; + return; + } + + // create an empty dummy packet to copy side-data from + AVPacket sdPacket = { 0 }; + av_init_packet(&sdPacket); + sdPacket.side_data = (*sd)->side_data; + sdPacket.side_data_elems = (*sd)->side_data_elems; + + // copy into the main packet + av_copy_packet_side_data(dst, &sdPacket); + + *sd = nullptr; +} + BOOL IsVistaOrNewer() { // Query OS version info diff --git a/common/DSUtilLite/DShowUtil.h b/common/DSUtilLite/DShowUtil.h index e950d4b0..b7b55541 100644 --- a/common/DSUtilLite/DShowUtil.h +++ b/common/DSUtilLite/DShowUtil.h @@ -132,6 +132,10 @@ void audioFormatTypeHandler(const BYTE *format, const GUID *formattype, DWORD *p void getExtraData(const AM_MEDIA_TYPE &mt, BYTE *extra, size_t *extralen); void getExtraData(const BYTE *format, const GUID *formattype, const size_t formatlen, BYTE *extra, size_t *extralen); +struct AVPacket; +struct MediaSideDataFFMpeg; +void CopyMediaSideDataFF(AVPacket *dst, const MediaSideDataFFMpeg **sd); + BOOL IsVistaOrNewer(); BOOL IsWindows7OrNewer(); BOOL IsWindows8OrNewer(); |