Mailing List archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[vdr] Re: vdr cuts recordings with ugly artifacts at cutting-points
On Tue, Apr 15, 2003 at 10:03:06AM +0000, Stefan Huelswitt wrote:
>
> OK, find the attached patch which sets the broken link flag on
> every "cuttIn" frame. I did only a short test. It still cuts
> fine and it seems that the decoder honors the broken link flag.
> The cutting points are smoother.
>
> The problem of missing audio packets due to audio-video delay
> still has to be solved.
Maybe a read ahead buffer could be used to filter out all
audio/ac3 frame with the formular
if (video_PTS >= none_video_PTS)
include audio_or_ac3
else
skip audio_or_ac3
this would require that the last few and next few
none video packages around the cutting point must
be buffered for comparision.
Werner
> diff -urN vdr-1.1.27-orig/cutter.c vdr-1.1.27-cutter/cutter.c
> --- vdr-1.1.27-orig/cutter.c 2002-08-11 13:09:23.000000000 +0200
> +++ vdr-1.1.27-cutter/cutter.c 2003-04-15 10:53:56.000000000 +0200
> @@ -23,6 +23,8 @@
> cFileName *fromFileName, *toFileName;
> cIndexFile *fromIndex, *toIndex;
> cMarks fromMarks, toMarks;
> + //
> + void BrokenLink(uchar *data, int len);
> protected:
> virtual void Action(void);
> public:
> @@ -60,6 +62,26 @@
> delete toIndex;
> }
>
> +void cCuttingThread::BrokenLink(uchar *data, int len)
> +{
> + if(data[0]==0 && data[1]==0 && data[2]==1 && (data[3]&0xE0)==0xE0) {
> + int index=9+data[8]; // skip video packet header
> + for( ; index<len ; index++) {
> + if(data[index]==0 && data[index+1]==0 && data[index+2]==1 && data[index+3]==0xB8) {
> + if(!(data[index+7]&0x40)) {
> + data[index+7] |= 0x20;
> + printf("setting broken link flag in CuttIn GOP\n");
> + }
> + else
> + printf("cuttIn GOP is closed\n");
> + return;
> + }
> + }
> + printf("no GOP header found in cuttIn video packet\n");
> + }
> + else printf("no video packet in cuttIn frame\n");
> +}
> +
> void cCuttingThread::Action(void)
> {
> dsyslog("video cutting thread started (pid=%d)", getpid());
> @@ -77,6 +99,7 @@
> toMarks.Add(0);
> toMarks.Save();
> uchar buffer[MAXFRAMESIZE];
> + bool cuttIn = true;
> while (active) {
> uchar FileNumber;
> int FileOffset, Length;
> @@ -126,6 +149,11 @@
> FileSize = 0;
> }
> LastIFrame = 0;
> +
> + if(cuttIn) {
> + BrokenLink(buffer, Length);
> + cuttIn=false;
> + }
> }
> if (safe_write(toFile, buffer, Length) < 0) {
> error = "safe_write";
> @@ -151,6 +179,7 @@
> Index = Mark->position;
> Mark = fromMarks.Next(Mark);
> CurrentFileNumber = 0; // triggers SetOffset before reading next frame
> + cuttIn = true;
> if (Setup.SplitEditedFiles) {
> toFile = toFileName->NextFile();
> if (toFile < 0) {
>
>
> --
> Stefan Huelswitt
> huels@iname.com | http://home.pages.de/~nathan
--
Info:
To unsubscribe send a mail to listar@linuxtv.org with "unsubscribe vdr" as subject.
Home |
Main Index |
Thread Index