From patchwork Sat Sep 1 20:03:49 2007 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Reinhard Nissl X-Patchwork-Id: 12523 Received: from mail.gmx.net ([213.165.64.20]) by www.linuxtv.org with smtp (Exim 4.63) (envelope-from ) id 1IRZCf-0004fd-BV for vdr@linuxtv.org; Sat, 01 Sep 2007 22:04:21 +0200 Received: (qmail invoked by alias); 01 Sep 2007 20:03:51 -0000 Received: from p54930859.dip0.t-ipconnect.de (EHLO [192.168.101.15]) [84.147.8.89] by mail.gmx.net (mp029) with SMTP; 01 Sep 2007 22:03:51 +0200 X-Authenticated: #527675 X-Provags-ID: V01U2FsdGVkX1+uCscx8oqurn4Wma9Ckb7hOMyDseCYNN13TNxScA 7lRdVvxc4n0QYb Message-ID: <46D9C5A5.8050008@gmx.de> Date: Sat, 01 Sep 2007 22:03:49 +0200 From: Reinhard Nissl User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.0.12) Gecko/20060911 SUSE/1.5.0.12-3.4 Thunderbird/1.5.0.12 Mnenhy/0.7.4.666 MIME-Version: 1.0 To: VDR Mailing List References: <46D4A316.8090409@gmx.de> In-Reply-To: <46D4A316.8090409@gmx.de> X-Y-GMX-Trusted: 0 Subject: Re: [vdr] [ANNOUNCE] H.264 updates for VDR-1.5.9 X-BeenThere: vdr@linuxtv.org X-Mailman-Version: 2.1.9 Precedence: list Reply-To: VDR Mailing List List-Id: VDR Mailing List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 01 Sep 2007 20:04:21 -0000 Status: O X-Status: X-Keywords: X-UID: 14003 Hi, Reinhard Nissl wrote: > the attached vdr-1.5.9-h264.patch adds H.264 support to VDR's remuxer. After the above patch, my "sync early" patch fails to apply. Attached you'll find an updated version which should apply cleanly. Bye. diff -Nurp ../vdr-1.5.2-orig/device.c ./device.c --- ../vdr-1.5.2-orig/device.c 2007-01-13 13:05:00.000000000 +0100 +++ ./device.c 2007-05-06 21:13:58.000000000 +0200 @@ -735,7 +735,7 @@ eSetChannelResult cDevice::SetChannel(co for (int i = 0; i < MAXDPIDS; i++) SetAvailableTrack(ttDolby, i, Channel->Dpid(i), Channel->Dlang(i)); } - if (!NeedsTransferMode) + if (!NeedsTransferMode || GetCurrentAudioTrack() == ttNone) EnsureAudioTrack(true); } cStatus::MsgChannelSwitch(this, Channel->Number()); // only report status if channel switch successfull diff -Nurp ../vdr-1.5.2-orig/remux.c ./remux.c --- ../vdr-1.5.2-orig/remux.c 2007-02-24 17:36:10.000000000 +0100 +++ ./remux.c 2007-05-06 21:13:58.000000000 +0200 @@ -2166,14 +2166,15 @@ void cTS2PES::ts_to_pes(const uint8_t *B #define RESULTBUFFERSIZE KILOBYTE(256) -cRemux::cRemux(int VPid, const int *APids, const int *DPids, const int *SPids, bool ExitOnFailure) +cRemux::cRemux(int VPid, const int *APids, const int *DPids, const int *SPids, bool ExitOnFailure, bool SyncEarly) { h264 = VPID_IS_H264(VPid); VPid = VPID_FROM_ANY(VPid); exitOnFailure = ExitOnFailure; isRadio = VPid == 0 || VPid == 1 || VPid == 0x1FFF; numUPTerrors = 0; synced = false; + syncEarly = SyncEarly; skipped = 0; numTracks = 0; resultSkipped = 0; @@ -2438,12 +2439,14 @@ uchar *cRemux::Get(int &Count, uchar *Pi ShutdownHandler.RequestEmergencyExit(); } else if (!synced) { - if (pt == I_FRAME) { + if (pt == I_FRAME || syncEarly) { if (PictureType) *PictureType = pt; resultSkipped = i; // will drop everything before this position - SetBrokenLink(data + i, l); synced = true; + if (pt == I_FRAME) // syncEarly: it's ok but there is no need to call SetBrokenLink() + SetBrokenLink(data + i, l); +else fprintf(stderr, "video: synced early\n"); } } else if (Count) @@ -2456,12 +2459,13 @@ uchar *cRemux::Get(int &Count, uchar *Pi l = GetPacketLength(data, resultCount, i); if (l < 0) return resultData; - if (isRadio) { + if (isRadio || !synced && syncEarly) { if (!synced) { - if (PictureType) + if (PictureType && isRadio) *PictureType = I_FRAME; resultSkipped = i; // will drop everything before this position synced = true; +if (!isRadio) fprintf(stderr, "audio: synced early\n"); } else if (Count) return resultData; diff -Nurp ../vdr-1.5.2-orig/remux.h ./remux.h --- ../vdr-1.5.2-orig/remux.h 2006-03-25 13:27:30.000000000 +0100 +++ ./remux.h 2007-05-06 21:13:58.000000000 +0200 @@ -41,6 +41,7 @@ private: bool h264; int numUPTerrors; bool synced; + bool syncEarly; int skipped; cTS2PES *ts2pes[MAXTRACKS]; int numTracks; @@ -49,12 +50,13 @@ private: int GetPid(const uchar *Data); int ScanVideoPacket(const uchar *Data, int Count, int Offset, uchar &PictureType); public: - cRemux(int VPid, const int *APids, const int *DPids, const int *SPids, bool ExitOnFailure = false); + cRemux(int VPid, const int *APids, const int *DPids, const int *SPids, bool ExitOnFailure = false, bool SyncEarly = false); ///< Creates a new remuxer for the given PIDs. VPid is the video PID, while ///< APids, DPids and SPids are pointers to zero terminated lists of audio, ///< dolby and subtitle PIDs (the pointers may be NULL if there is no such ///< PID). If ExitOnFailure is true, the remuxer will initiate an "emergency - ///< exit" in case of problems with the data stream. + ///< exit" in case of problems with the data stream. SyncEarly causes cRemux + ///< to sync as soon as a video or audio frame is seen. ~cRemux(); void SetTimeouts(int PutTimeout, int GetTimeout) { resultBuffer->SetTimeouts(PutTimeout, GetTimeout); } ///< By default cRemux assumes that Put() and Get() are called from different diff -Nurp ../vdr-1.5.2-orig/transfer.c ./transfer.c --- ../vdr-1.5.2-orig/transfer.c 2007-01-05 11:45:28.000000000 +0100 +++ ./transfer.c 2007-05-06 21:14:39.000000000 +0200 @@ -19,7 +19,7 @@ cTransfer::cTransfer(tChannelID ChannelI ,cThread("transfer") { ringBuffer = new cRingBufferLinear(TRANSFERBUFSIZE, TS_SIZE * 2, true, "Transfer"); - remux = new cRemux(VPid, APids, Setup.UseDolbyDigital ? DPids : NULL, SPids); + remux = new cRemux(VPid, APids, Setup.UseDolbyDigital ? DPids : NULL, SPids, false, true); } cTransfer::~cTransfer()