From 57d07f9c77cef8e9729044ec90d5cbaee9bb6c64 Mon Sep 17 00:00:00 2001 From: Stephan Raue Date: Fri, 10 May 2013 07:40:58 +0200 Subject: [PATCH] xbmc: add PR2586 Signed-off-by: Stephan Raue --- .../patches/12.2.0/xbmc-990.12-PR2586.patch | 555 ++++++++++++++++++ 1 file changed, 555 insertions(+) create mode 100644 packages/mediacenter/xbmc/patches/12.2.0/xbmc-990.12-PR2586.patch diff --git a/packages/mediacenter/xbmc/patches/12.2.0/xbmc-990.12-PR2586.patch b/packages/mediacenter/xbmc/patches/12.2.0/xbmc-990.12-PR2586.patch new file mode 100644 index 0000000000..63357752c3 --- /dev/null +++ b/packages/mediacenter/xbmc/patches/12.2.0/xbmc-990.12-PR2586.patch @@ -0,0 +1,555 @@ +diff -Naur xbmc-12.2.0/xbmc/cores/dvdplayer/DVDDemuxers/DVDDemuxCDDA.cpp xbmc-12.2.0.patch/xbmc/cores/dvdplayer/DVDDemuxers/DVDDemuxCDDA.cpp +--- xbmc-12.2.0/xbmc/cores/dvdplayer/DVDDemuxers/DVDDemuxCDDA.cpp 1970-01-01 01:00:00.000000000 +0100 ++++ xbmc-12.2.0.patch/xbmc/cores/dvdplayer/DVDDemuxers/DVDDemuxCDDA.cpp 2013-05-10 07:16:56.061904946 +0200 +@@ -0,0 +1,180 @@ ++/* ++ * Copyright (C) 2013 Team XBMC ++ * http://www.xbmc.org ++ * ++ * This Program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License as published by ++ * the Free Software Foundation; either version 2, or (at your option) ++ * any later version. ++ * ++ * This Program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with XBMC; see the file COPYING. If not, see ++ * . ++ * ++ */ ++ ++#include "DVDInputStreams/DVDInputStream.h" ++#include "DVDDemuxCDDA.h" ++#include "DVDDemuxUtils.h" ++#include "utils/log.h" ++#include "../DVDClock.h" ++ ++// CDDA audio demuxer based on AirTunes audio Demuxer. ++ ++using namespace std; ++ ++class CDemuxStreamAudioCDDA ++ : public CDemuxStreamAudio ++{ ++public: ++ void GetStreamInfo(string& strInfo) ++ { ++ strInfo = "pcm"; ++ } ++}; ++ ++CDVDDemuxCDDA::CDVDDemuxCDDA() : CDVDDemux() ++{ ++ m_pInput = NULL; ++ m_stream = NULL; ++ m_bytes = 0; ++} ++ ++CDVDDemuxCDDA::~CDVDDemuxCDDA() ++{ ++ Dispose(); ++} ++ ++bool CDVDDemuxCDDA::Open(CDVDInputStream* pInput) ++{ ++ Abort(); ++ ++ Dispose(); ++ ++ if(!pInput || !pInput->IsStreamType(DVDSTREAM_TYPE_FILE)) ++ return false; ++ ++ m_pInput = pInput; ++ ++ m_stream = new CDemuxStreamAudioCDDA(); ++ ++ if(!m_stream) ++ return false; ++ ++ m_stream->iSampleRate = 44100; ++ m_stream->iBitsPerSample = 16; ++ m_stream->iBitRate = 44100 * 2 * 16; ++ m_stream->iChannels = 2; ++ m_stream->type = STREAM_AUDIO; ++ m_stream->codec = CODEC_ID_PCM_S16LE; ++ ++ return true; ++} ++ ++void CDVDDemuxCDDA::Dispose() ++{ ++ delete m_stream; ++ m_stream = NULL; ++ ++ m_pInput = NULL; ++ m_bytes = 0; ++} ++ ++void CDVDDemuxCDDA::Reset() ++{ ++ CDVDInputStream* pInputStream = m_pInput; ++ Dispose(); ++ Open(pInputStream); ++} ++ ++void CDVDDemuxCDDA::Abort() ++{ ++ if(m_pInput) ++ return m_pInput->Abort(); ++} ++ ++void CDVDDemuxCDDA::Flush() ++{ ++} ++ ++#define CDDA_READ_SIZE 4096 ++DemuxPacket* CDVDDemuxCDDA::Read() ++{ ++ if(!m_pInput) ++ return NULL; ++ ++ DemuxPacket* pPacket = CDVDDemuxUtils::AllocateDemuxPacket(CDDA_READ_SIZE); ++ ++ if (!pPacket) ++ { ++ if (m_pInput) ++ m_pInput->Close(); ++ return NULL; ++ } ++ ++ pPacket->iSize = m_pInput->Read(pPacket->pData, CDDA_READ_SIZE); ++ pPacket->iStreamId = 0; ++ ++ if(pPacket->iSize < 1) ++ { ++ delete pPacket; ++ pPacket = NULL; ++ } ++ else ++ { ++ int n = m_stream->iBitRate>>3; ++ if (n > 0) ++ { ++ m_bytes += pPacket->iSize; ++ pPacket->dts = (double)m_bytes * DVD_TIME_BASE / n; ++ pPacket->pts = pPacket->dts; ++ } ++ else ++ { ++ pPacket->dts = DVD_NOPTS_VALUE; ++ pPacket->pts = DVD_NOPTS_VALUE; ++ } ++ } ++ ++ return pPacket; ++} ++ ++int CDVDDemuxCDDA::GetStreamLength() ++{ ++ int64_t num_track_bytes = m_pInput->GetLength(); ++ int bytes_per_second = (m_stream->iBitRate>>3); ++ int64_t track_mseconds = num_track_bytes*1000 / bytes_per_second; ++ return (int)track_mseconds; ++} ++ ++CDemuxStream* CDVDDemuxCDDA::GetStream(int iStreamId) ++{ ++ if(iStreamId != 0) ++ return NULL; ++ ++ return m_stream; ++} ++ ++int CDVDDemuxCDDA::GetNrOfStreams() ++{ ++ return (m_stream == NULL ? 0 : 1); ++} ++ ++std::string CDVDDemuxCDDA::GetFileName() ++{ ++ if(m_pInput) ++ return m_pInput->GetFileName(); ++ else ++ return ""; ++} ++ ++void CDVDDemuxCDDA::GetStreamCodecName(int iStreamId, CStdString &strName) ++{ ++ if (m_stream && iStreamId == 0) ++ strName = "pcm"; ++} +diff -Naur xbmc-12.2.0/xbmc/cores/dvdplayer/DVDDemuxers/DVDDemuxCDDA.h xbmc-12.2.0.patch/xbmc/cores/dvdplayer/DVDDemuxers/DVDDemuxCDDA.h +--- xbmc-12.2.0/xbmc/cores/dvdplayer/DVDDemuxers/DVDDemuxCDDA.h 1970-01-01 01:00:00.000000000 +0100 ++++ xbmc-12.2.0.patch/xbmc/cores/dvdplayer/DVDDemuxers/DVDDemuxCDDA.h 2013-05-10 07:16:56.061904946 +0200 +@@ -0,0 +1,59 @@ ++#pragma once ++/* ++ * Copyright (C) 2013 Team XBMC ++ * http://www.xbmc.org ++ * ++ * This Program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License as published by ++ * the Free Software Foundation; either version 2, or (at your option) ++ * any later version. ++ * ++ * This Program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with XBMC; see the file COPYING. If not, see ++ * . ++ * ++ */ ++ ++#include "DVDDemux.h" ++ ++#ifdef _WIN32 ++#define __attribute__(dummy_val) ++#else ++#include ++#endif ++ ++class CDemuxStreamAudioCDDA; ++ ++class CDVDDemuxCDDA : public CDVDDemux ++{ ++public: ++ ++ CDVDDemuxCDDA(); ++ ~CDVDDemuxCDDA(); ++ ++ bool Open(CDVDInputStream* pInput); ++ void Dispose(); ++ void Reset(); ++ void Abort(); ++ void Flush(); ++ DemuxPacket* Read(); ++ bool SeekTime(int time, bool backwords = false, double* startpts = NULL) { return false; }; ++ void SetSpeed(int iSpeed) {}; ++ int GetStreamLength() ; ++ CDemuxStream* GetStream(int iStreamId); ++ int GetNrOfStreams(); ++ std::string GetFileName(); ++ virtual void GetStreamCodecName(int iStreamId, CStdString &strName); ++ ++protected: ++ friend class CDemuxStreamAudioCDDA; ++ CDVDInputStream* m_pInput; ++ int64_t m_bytes; ++ ++ CDemuxStreamAudioCDDA *m_stream; ++}; +diff -Naur xbmc-12.2.0/xbmc/cores/dvdplayer/DVDDemuxers/DVDFactoryDemuxer.cpp xbmc-12.2.0.patch/xbmc/cores/dvdplayer/DVDDemuxers/DVDFactoryDemuxer.cpp +--- xbmc-12.2.0/xbmc/cores/dvdplayer/DVDDemuxers/DVDFactoryDemuxer.cpp 2013-05-02 17:00:07.000000000 +0200 ++++ xbmc-12.2.0.patch/xbmc/cores/dvdplayer/DVDDemuxers/DVDFactoryDemuxer.cpp 2013-05-10 07:16:56.061904946 +0200 +@@ -31,6 +31,7 @@ + #include "DVDDemuxHTSP.h" + #endif + #include "DVDDemuxBXA.h" ++#include "DVDDemuxCDDA.h" + #include "DVDDemuxPVRClient.h" + #include "pvr/PVRManager.h" + #include "pvr/addons/PVRClients.h" +@@ -51,6 +52,22 @@ + else + return NULL; + } ++ ++ // Try to open CDDA demuxer ++ if (pInputStream->IsStreamType(DVDSTREAM_TYPE_FILE) && pInputStream->GetContent().compare("application/octet-stream") == 0) ++ { ++ std::string filename = pInputStream->GetFileName(); ++ if (filename.substr(0, 7) == "cdda://") ++ { ++ CLog::Log(LOGDEBUG, "DVDFactoryDemuxer: Stream is probably CD audio. Creating CDDA demuxer."); ++ ++ auto_ptr demuxer(new CDVDDemuxCDDA()); ++ if (demuxer->Open(pInputStream)) ++ { ++ return demuxer.release(); ++ } ++ } ++ } + + if (pInputStream->IsStreamType(DVDSTREAM_TYPE_HTTP)) + { +diff -Naur xbmc-12.2.0/xbmc/cores/dvdplayer/DVDDemuxers/DVDFactoryDemuxer.cpp.orig xbmc-12.2.0.patch/xbmc/cores/dvdplayer/DVDDemuxers/DVDFactoryDemuxer.cpp.orig +diff -Naur xbmc-12.2.0/xbmc/cores/dvdplayer/DVDDemuxers/Makefile.in xbmc-12.2.0.patch/xbmc/cores/dvdplayer/DVDDemuxers/Makefile.in +--- xbmc-12.2.0/xbmc/cores/dvdplayer/DVDDemuxers/Makefile.in 2013-05-02 17:00:07.000000000 +0200 ++++ xbmc-12.2.0.patch/xbmc/cores/dvdplayer/DVDDemuxers/Makefile.in 2013-05-10 07:16:56.061904946 +0200 +@@ -2,6 +2,7 @@ + + SRCS = DVDDemux.cpp + SRCS += DVDDemuxBXA.cpp ++SRCS += DVDDemuxCDDA.cpp + SRCS += DVDDemuxFFmpeg.cpp + SRCS += DVDDemuxHTSP.cpp + SRCS += DVDDemuxPVRClient.cpp +diff -Naur xbmc-12.2.0/xbmc/cores/paplayer/CDDAcodec.cpp xbmc-12.2.0.patch/xbmc/cores/paplayer/CDDAcodec.cpp +--- xbmc-12.2.0/xbmc/cores/paplayer/CDDAcodec.cpp 2013-05-02 17:00:08.000000000 +0200 ++++ xbmc-12.2.0.patch/xbmc/cores/paplayer/CDDAcodec.cpp 1970-01-01 01:00:00.000000000 +0100 +@@ -1,159 +0,0 @@ +-/* +- * Copyright (C) 2005-2012 Team XBMC +- * http://www.xbmc.org +- * +- * This Program is free software; you can redistribute it and/or modify +- * it under the terms of the GNU General Public License as published by +- * the Free Software Foundation; either version 2, or (at your option) +- * any later version. +- * +- * This Program is distributed in the hope that it will be useful, +- * but WITHOUT ANY WARRANTY; without even the implied warranty of +- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +- * GNU General Public License for more details. +- * +- * You should have received a copy of the GNU General Public License +- * along with XBMC; see the file COPYING. If not, see +- * . +- * +- */ +- +-#include "CDDAcodec.h" +-#if !defined(TARGET_DARWIN_IOS) +-#include +-#else +-typedef int32_t lsn_t; +-#define CDIO_CD_FRAMESIZE_RAW 2352 +-#define CDIO_CD_FRAMES_PER_SEC 75 +-#endif +-#include "cores/AudioEngine/Utils/AEUtil.h" +- +-#define SECTOR_COUNT 55 // max. sectors that can be read at once +-#define MAX_BUFFER_SIZE 2*SECTOR_COUNT*CDIO_CD_FRAMESIZE_RAW +- +-CDDACodec::CDDACodec() +-{ +- m_SampleRate = 44100; +- m_Channels = 2; +- m_BitsPerSample = 16; +- m_DataFormat = AE_FMT_S16NE; +- m_TotalTime = 0; +- m_Bitrate = 0; +- m_CodecName = "cdda"; +- +- m_BufferSize=0; +- m_Buffer = new BYTE[MAX_BUFFER_SIZE]; +- m_BufferPos = 0; +-} +- +-CDDACodec::~CDDACodec() +-{ +- DeInit(); +- +- if (m_Buffer) +- { +- delete[] m_Buffer; +- m_Buffer = NULL; +- } +-} +- +-bool CDDACodec::Init(const CStdString &strFile, unsigned int filecache) +-{ +- if (!m_file.Open(strFile, READ_CACHED)) +- return false; +- +- // Calculate total time of the track +- m_TotalTime=(m_file.GetLength()/CDIO_CD_FRAMESIZE_RAW)/CDIO_CD_FRAMES_PER_SEC; +- if (m_TotalTime > 0) +- m_Bitrate = (int)((m_file.GetLength() * 8) / m_TotalTime); +- else +- m_Bitrate = 0; +- m_TotalTime*=1000; // ms +- return true; +-} +- +-void CDDACodec::DeInit() +-{ +- m_file.Close(); +-} +- +-int64_t CDDACodec::Seek(int64_t iSeekTime) +-{ +- // Calculate the next full second... +- int iSeekTimeFullSec=(int)(iSeekTime+(1000-(iSeekTime%1000)))/1000; +- +- // ...and the logical sector on the cd... +- lsn_t lsnSeek=iSeekTimeFullSec*CDIO_CD_FRAMES_PER_SEC; +- +- // ... then seek to its position... +- int iNewOffset=(int)m_file.Seek(lsnSeek*CDIO_CD_FRAMESIZE_RAW, SEEK_SET); +- m_BufferSize=m_BufferPos=0; +- +- // ... and look if we really got there. +- int iNewSeekTime=(iNewOffset/CDIO_CD_FRAMESIZE_RAW)/CDIO_CD_FRAMES_PER_SEC; +- return iNewSeekTime*(int64_t)1000; // ms +-} +- +-int CDDACodec::ReadPCM(BYTE *pBuffer, int size, int *actualsize) +-{ +- *actualsize=0; +- +- bool bEof=false; +- // Reached end of track? +- if (m_file.GetLength()==m_file.GetPosition()) +- bEof=true; +- +- // Do we have to refill our audio buffer? +- if (m_BufferSize-m_BufferPos=size) +- { // we have enough data in our buffer +- memcpy(pBuffer, m_Buffer + m_BufferPos, size); +- m_BufferPos+=size; +- *actualsize=size; +- } +- else +- { // Only a smaller amount of data left as the player wants +- memcpy(pBuffer, m_Buffer + m_BufferPos, m_BufferSize-m_BufferPos); +- *actualsize=m_BufferSize-m_BufferPos; +- m_BufferPos+=m_BufferSize-m_BufferPos; +- } +- +- return READ_SUCCESS; +-} +- +-bool CDDACodec::CanInit() +-{ +- return true; +-} +- +-CAEChannelInfo CDDACodec::GetChannelInfo() +-{ +- static enum AEChannel map[2][3] = { +- {AE_CH_FC, AE_CH_NULL}, +- {AE_CH_FL, AE_CH_FR , AE_CH_NULL} +- }; +- +- if (m_Channels > 2) +- return CAEUtil::GuessChLayout(m_Channels); +- +- return CAEChannelInfo(map[m_Channels - 1]); +-} +diff -Naur xbmc-12.2.0/xbmc/cores/paplayer/CDDAcodec.h xbmc-12.2.0.patch/xbmc/cores/paplayer/CDDAcodec.h +--- xbmc-12.2.0/xbmc/cores/paplayer/CDDAcodec.h 2013-05-02 17:00:08.000000000 +0200 ++++ xbmc-12.2.0.patch/xbmc/cores/paplayer/CDDAcodec.h 1970-01-01 01:00:00.000000000 +0100 +@@ -1,43 +0,0 @@ +-#pragma once +- +-/* +- * Copyright (C) 2005-2012 Team XBMC +- * http://www.xbmc.org +- * +- * This Program is free software; you can redistribute it and/or modify +- * it under the terms of the GNU General Public License as published by +- * the Free Software Foundation; either version 2, or (at your option) +- * any later version. +- * +- * This Program is distributed in the hope that it will be useful, +- * but WITHOUT ANY WARRANTY; without even the implied warranty of +- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +- * GNU General Public License for more details. +- * +- * You should have received a copy of the GNU General Public License +- * along with XBMC; see the file COPYING. If not, see +- * . +- * +- */ +- +-#include "CachingCodec.h" +- +-class CDDACodec : public CachingCodec +-{ +-public: +- CDDACodec(); +- virtual ~CDDACodec(); +- +- virtual bool Init(const CStdString &strFile, unsigned int filecache); +- virtual void DeInit(); +- virtual int64_t Seek(int64_t iSeekTime); +- virtual int ReadPCM(BYTE *pBuffer, int size, int *actualsize); +- virtual bool CanInit(); +- virtual CAEChannelInfo GetChannelInfo(); +- +-private: +- // Input buffer to read our cdda data into +- BYTE* m_Buffer; +- int m_BufferSize; +- int m_BufferPos; +-}; +diff -Naur xbmc-12.2.0/xbmc/cores/paplayer/CodecFactory.cpp xbmc-12.2.0.patch/xbmc/cores/paplayer/CodecFactory.cpp +--- xbmc-12.2.0/xbmc/cores/paplayer/CodecFactory.cpp 2013-05-02 17:00:08.000000000 +0200 ++++ xbmc-12.2.0.patch/xbmc/cores/paplayer/CodecFactory.cpp 2013-05-10 07:16:56.061904946 +0200 +@@ -21,7 +21,6 @@ + #include "system.h" + #include "CodecFactory.h" + #include "MP3codec.h" +-#include "CDDAcodec.h" + #include "OGGcodec.h" + #include "FLACcodec.h" + #include "WAVcodec.h" +@@ -51,7 +50,7 @@ + else if (strFileType.Equals("ape") || strFileType.Equals("mac")) + return new DVDPlayerCodec(); + else if (strFileType.Equals("cdda")) +- return new CDDACodec(); ++ return new DVDPlayerCodec(); + else if (strFileType.Equals("mpc") || strFileType.Equals("mp+") || strFileType.Equals("mpp")) + return new DVDPlayerCodec(); + else if (strFileType.Equals("shn")) +@@ -183,20 +182,6 @@ + } + delete codec; + } +- if (urlFile.GetFileType().Equals("cdda")) +- { +- //lets see what it contains... +- //this kinda sucks 'cause if it's plain cdda the file +- //will be opened, sniffed and closed before it is opened *again* for cdda +- //would be better if the papcodecs could work with bitstreams instead of filenames. +- DVDPlayerCodec *dvdcodec = new DVDPlayerCodec(); +- dvdcodec->SetContentType("audio/x-spdif-compressed"); +- if (dvdcodec->Init(strFile, filecache)) +- { +- return dvdcodec; +- } +- delete dvdcodec; +- } + else if (urlFile.GetFileType().Equals("ogg") || urlFile.GetFileType().Equals("oggstream") || urlFile.GetFileType().Equals("oga")) + return CreateOGGCodec(strFile,filecache); + +diff -Naur xbmc-12.2.0/xbmc/cores/paplayer/Makefile.in xbmc-12.2.0.patch/xbmc/cores/paplayer/Makefile.in +--- xbmc-12.2.0/xbmc/cores/paplayer/Makefile.in 2013-05-02 17:00:08.000000000 +0200 ++++ xbmc-12.2.0.patch/xbmc/cores/paplayer/Makefile.in 2013-05-10 07:16:56.062904942 +0200 +@@ -9,7 +9,6 @@ + + SRCS = ADPCMCodec.cpp + SRCS += AudioDecoder.cpp +-SRCS += CDDAcodec.cpp + SRCS += CodecFactory.cpp + SRCS += DVDPlayerCodec.cpp + SRCS += FLACcodec.cpp