Message ID | DM8P223MB03651B126BFB50522D556769BA719@DM8P223MB0365.NAMP223.PROD.OUTLOOK.COM |
---|---|
State | New |
Headers | show |
Series | Subtitle Filtering | expand |
Context | Check | Description |
---|---|---|
andriy/make_x86 | success | Make finished |
andriy/make_fate_x86 | success | Make fate finished |
andriy/make_ppc | success | Make finished |
andriy/make_fate_ppc | success | Make fate finished |
On Fri, Dec 10, 2021 at 09:37:53PM +0000, Soft Works wrote: > - textmod {S -> S) > Modify subtitle text in a number of ways > > - censor {S -> S) > Censor subtitles using a word list > > - show_speaker {S -> S) > Prepend speaker names from ASS subtitles to the visible text lines > > Signed-off-by: softworkz <softworkz@hotmail.com> > --- > doc/filters.texi | 206 ++++++++++++ > libavfilter/Makefile | 5 + > libavfilter/allfilters.c | 3 + > libavfilter/sf_textmod.c | 697 +++++++++++++++++++++++++++++++++++++++ > 4 files changed, 911 insertions(+) > create mode 100644 libavfilter/sf_textmod.c doesnt apply (using git am with the email, the other patches with lower numbers all applied with no such issues) Applying: avfilter/textmod: Add textmod, censor and show_speaker filters .git/rebase-apply/patch:269: trailing whitespace. /* .git/rebase-apply/patch:270: trailing whitespace. * Copyright (c) 2021 softworkz .git/rebase-apply/patch:271: trailing whitespace. * .git/rebase-apply/patch:272: trailing whitespace. * This file is part of FFmpeg. .git/rebase-apply/patch:273: trailing whitespace. * warning: squelched 692 whitespace errors warning: 697 lines add whitespace errors. Using index info to reconstruct a base tree... M libavfilter/Makefile M libavfilter/allfilters.c .git/rebase-apply/patch:269: trailing whitespace. /* .git/rebase-apply/patch:270: trailing whitespace. * Copyright (c) 2021 softworkz .git/rebase-apply/patch:271: trailing whitespace. * .git/rebase-apply/patch:272: trailing whitespace. * This file is part of FFmpeg. .git/rebase-apply/patch:273: trailing whitespace. * error: patch failed: doc/filters.texi:25644 error: doc/filters.texi: patch does not apply error: patch failed: libavfilter/Makefile:553 error: libavfilter/Makefile: patch does not apply error: patch failed: libavfilter/allfilters.c:544 error: libavfilter/allfilters.c: patch does not apply error: Did you hand edit your patch? It does not apply to blobs recorded in its index. Patch failed at 0001 avfilter/textmod: Add textmod, censor and show_speaker filters Use 'git am --show-current-patch' to see the failed patch When you have resolved this problem, run "git am --continue". If you prefer to skip this patch, run "git am --skip" instead. To restore the original branch and stop patching, run "git am --abort". [...]
> -----Original Message----- > From: ffmpeg-devel <ffmpeg-devel-bounces@ffmpeg.org> On Behalf Of Michael > Niedermayer > Sent: Saturday, December 11, 2021 4:33 PM > To: FFmpeg development discussions and patches <ffmpeg-devel@ffmpeg.org> > Subject: Re: [FFmpeg-devel] [PATCH v23 16/21] avfilter/textmod: Add textmod, > censor and show_speaker filters > > On Fri, Dec 10, 2021 at 09:37:53PM +0000, Soft Works wrote: > > - textmod {S -> S) > > Modify subtitle text in a number of ways > > > > - censor {S -> S) > > Censor subtitles using a word list > > > > - show_speaker {S -> S) > > Prepend speaker names from ASS subtitles to the visible text lines > > > > Signed-off-by: softworkz <softworkz@hotmail.com> > > --- > > doc/filters.texi | 206 ++++++++++++ > > libavfilter/Makefile | 5 + > > libavfilter/allfilters.c | 3 + > > libavfilter/sf_textmod.c | 697 +++++++++++++++++++++++++++++++++++++++ > > 4 files changed, 911 insertions(+) > > create mode 100644 libavfilter/sf_textmod.c > > doesnt apply (using git am with the email, the other patches > with lower numbers all applied with no such issues) > > Applying: avfilter/textmod: Add textmod, censor and show_speaker filters > .git/rebase-apply/patch:269: trailing whitespace. > /* > .git/rebase-apply/patch:270: trailing whitespace. > * Copyright (c) 2021 softworkz > .git/rebase-apply/patch:271: trailing whitespace. > * > .git/rebase-apply/patch:272: trailing whitespace. > * This file is part of FFmpeg. > .git/rebase-apply/patch:273: trailing whitespace. > * > warning: squelched 692 whitespace errors > warning: 697 lines add whitespace errors. > Using index info to reconstruct a base tree... > M libavfilter/Makefile > M libavfilter/allfilters.c > .git/rebase-apply/patch:269: trailing whitespace. > /* > .git/rebase-apply/patch:270: trailing whitespace. > * Copyright (c) 2021 softworkz > .git/rebase-apply/patch:271: trailing whitespace. > * > .git/rebase-apply/patch:272: trailing whitespace. > * This file is part of FFmpeg. > .git/rebase-apply/patch:273: trailing whitespace. > * > error: patch failed: doc/filters.texi:25644 > error: doc/filters.texi: patch does not apply > error: patch failed: libavfilter/Makefile:553 > error: libavfilter/Makefile: patch does not apply > error: patch failed: libavfilter/allfilters.c:544 > error: libavfilter/allfilters.c: patch does not apply > error: Did you hand edit your patch? > It does not apply to blobs recorded in its index. > Patch failed at 0001 avfilter/textmod: Add textmod, censor and show_speaker > filters > Use 'git am --show-current-patch' to see the failed patch > When you have resolved this problem, run "git am --continue". > If you prefer to skip this patch, run "git am --skip" instead. > To restore the original branch and stop patching, run "git am --abort". > > [...] > -- Hi Michael, I have no idea what is going on here. When I look at those lines in the file that was generated by git format-patch, there isn't any trailing white space. Same is true when I look at this e-mail as I have received it from the ML, and when downloading the M-Box from patchwork, it hasn't any trailing whitespace either. There are lines with a single space between hunks, but all files generated by git format-patch have that. I have double-checked all involved source files and none of them has any trailing white space anymore. Yesterday, Andreas had pointed out the whitespace messages would only be warnings, but then I wouldn't know what's causing this, as it doesn't seem to be a line ending issue either. Patchwork could apply it, interestingly. I have attached the full patchset as zip. Hopefully this will apply at least. Thanks, softworkz Application: Microsoft.Office.Interop.Outlook.ApplicationClass Class: 43 Session: System.__ComObject Parent: System.__ComObject Actions: System.__ComObject Attachments: System.__ComObject BillingInformation: Body: > -----Original Message----- > From: ffmpeg-devel <ffmpeg-devel-bounces@ffmpeg.org> On Behalf Of Michael > Niedermayer > Sent: Saturday, December 11, 2021 4:33 PM > To: FFmpeg development discussions and patches <ffmpeg-devel@ffmpeg.org> > Subject: Re: [FFmpeg-devel] [PATCH v23 16/21] avfilter/textmod: Add textmod, > censor and show_speaker filters > > On Fri, Dec 10, 2021 at 09:37:53PM +0000, Soft Works wrote: > > - textmod {S -> S) > > Modify subtitle text in a number of ways > > > > - censor {S -> S) > > Censor subtitles using a word list > > > > - show_speaker {S -> S) > > Prepend speaker names from ASS subtitles to the visible text lines > > > > Signed-off-by: softworkz <softworkz@hotmail.com> > > --- > > doc/filters.texi | 206 ++++++++++++ > > libavfilter/Makefile | 5 + > > libavfilter/allfilters.c | 3 + > > libavfilter/sf_textmod.c | 697 +++++++++++++++++++++++++++++++++++++++ > > 4 files changed, 911 insertions(+) > > create mode 100644 libavfilter/sf_textmod.c > > doesnt apply (using git am with the email, the other patches > with lower numbers all applied with no such issues) > > Applying: avfilter/textmod: Add textmod, censor and show_speaker filters > .git/rebase-apply/patch:269: trailing whitespace. > /* > .git/rebase-apply/patch:270: trailing whitespace. > * Copyright (c) 2021 softworkz > .git/rebase-apply/patch:271: trailing whitespace. > * > .git/rebase-apply/patch:272: trailing whitespace. > * This file is part of FFmpeg. > .git/rebase-apply/patch:273: trailing whitespace. > * > warning: squelched 692 whitespace errors > warning: 697 lines add whitespace errors. > Using index info to reconstruct a base tree... > M libavfilter/Makefile > M libavfilter/allfilters.c > .git/rebase-apply/patch:269: trailing whitespace. > /* > .git/rebase-apply/patch:270: trailing whitespace. > * Copyright (c) 2021 softworkz > .git/rebase-apply/patch:271: trailing whitespace. > * > .git/rebase-apply/patch:272: trailing whitespace. > * This file is part of FFmpeg. > .git/rebase-apply/patch:273: trailing whitespace. > * > error: patch failed: doc/filters.texi:25644 > error: doc/filters.texi: patch does not apply > error: patch failed: libavfilter/Makefile:553 > error: libavfilter/Makefile: patch does not apply > error: patch failed: libavfilter/allfilters.c:544 > error: libavfilter/allfilters.c: patch does not apply > error: Did you hand edit your patch? > It does not apply to blobs recorded in its index. > Patch failed at 0001 avfilter/textmod: Add textmod, censor and show_speaker > filters > Use 'git am --show-current-patch' to see the failed patch > When you have resolved this problem, run "git am --continue". > If you prefer to skip this patch, run "git am --skip" instead. > To restore the original branch and stop patching, run "git am --abort". > > [...] > -- Hi Michael, I have no idea what is going on here. When I look at those lines in the file that was generated by git format-patch, there isn't any trailing white space. Same is true when I look at this e-mail as I have received it from the ML, and when downloading the M-Box from patchwork, it hasn't any trailing whitespace either. There are lines with a single space between hunks, but all files generated by git format-patch have that. I have double-checked all involved source files and none of them has any trailing white space anymore. Yesterday, Andreas had pointed out the whitespace messages would only be warnings, but then I wouldn't know what's causing this, as it doesn't seem to be a line ending issue either. Patchwork could apply it, interestingly. I have attached the full patchset as zip. Hopefully this will apply at least. Thanks, softworkz Categories: Companies: ConversationIndex: 0101D7EE0E3097BC542CE25E8F449EA54DC82CBAE9E7AC2D6CB800800008FC40 ConversationTopic: [PATCH 1/1] Test ref file change CreationTime: 11 Dec 2021 17:05:25 EntryID: 00000000BEFAAEED30DFDF43976487F12A562A600700DEB68488D92E8146A5C16995B1AE958D00000000010F0000DEB68488D92E8146A5C16995B1AE958D000570B7A2E30000 FormDescription: System.__ComObject GetInspector: System.__ComObject Importance: 1 LastModificationTime: 11 Dec 2021 17:05:25 MessageClass: IPM.Note Mileage: NoAging: False OutlookInternalVersion: 1614701 OutlookVersion: 16.0 Saved: False Sensitivity: 0 Size: 12686 Subject: RE: [FFmpeg-devel] [PATCH v23 16/21] avfilter/textmod: Add textmod, censor and show_speaker filters UnRead: True UserProperties: System.__ComObject AlternateRecipientAllowed: True AutoForwarded: False BCC: CC: DeferredDeliveryTime: 1 Jan 4501 00:00:00 DeleteAfterSubmit: False ExpiryTime: 1 Jan 4501 00:00:00 FlagRequest: HTMLBody: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN"> <HTML> <HEAD> <META NAME="Generator" CONTENT="MS Exchange Server version 16.0.14701.20038"> <TITLE></TITLE> </HEAD> <BODY> <!-- Converted from text/plain format --> <BR> <BR> <P><FONT SIZE=2>> -----Original Message-----<BR> > From: ffmpeg-devel <ffmpeg-devel-bounces@ffmpeg.org> On Behalf Of Michael<BR> > Niedermayer<BR> > Sent: Saturday, December 11, 2021 4:33 PM<BR> > To: FFmpeg development discussions and patches <ffmpeg-devel@ffmpeg.org><BR> > Subject: Re: [FFmpeg-devel] [PATCH v23 16/21] avfilter/textmod: Add textmod,<BR> > censor and show_speaker filters<BR> ><BR> > On Fri, Dec 10, 2021 at 09:37:53PM +0000, Soft Works wrote:<BR> > > - textmod {S -> S)<BR> > > Modify subtitle text in a number of ways<BR> > ><BR> > > - censor {S -> S)<BR> > > Censor subtitles using a word list<BR> > ><BR> > > - show_speaker {S -> S)<BR> > > Prepend speaker names from ASS subtitles to the visible text lines<BR> > ><BR> > > Signed-off-by: softworkz <softworkz@hotmail.com><BR> > > ---<BR> > > doc/filters.texi | 206 ++++++++++++<BR> > > libavfilter/Makefile | 5 +<BR> > > libavfilter/allfilters.c | 3 +<BR> > > libavfilter/sf_textmod.c | 697 +++++++++++++++++++++++++++++++++++++++<BR> > > 4 files changed, 911 insertions(+)<BR> > > create mode 100644 libavfilter/sf_textmod.c<BR> ><BR> > doesnt apply (using git am with the email, the other patches<BR> > with lower numbers all applied with no such issues)<BR> ><BR> > Applying: avfilter/textmod: Add textmod, censor and show_speaker filters<BR> > .git/rebase-apply/patch:269: trailing whitespace.<BR> > /*<BR> > .git/rebase-apply/patch:270: trailing whitespace.<BR> > * Copyright (c) 2021 softworkz<BR> > .git/rebase-apply/patch:271: trailing whitespace.<BR> > *<BR> > .git/rebase-apply/patch:272: trailing whitespace.<BR> > * This file is part of FFmpeg.<BR> > .git/rebase-apply/patch:273: trailing whitespace.<BR> > *<BR> > warning: squelched 692 whitespace errors<BR> > warning: 697 lines add whitespace errors.<BR> > Using index info to reconstruct a base tree...<BR> > M libavfilter/Makefile<BR> > M libavfilter/allfilters.c<BR> > .git/rebase-apply/patch:269: trailing whitespace.<BR> > /*<BR> > .git/rebase-apply/patch:270: trailing whitespace.<BR> > * Copyright (c) 2021 softworkz<BR> > .git/rebase-apply/patch:271: trailing whitespace.<BR> > *<BR> > .git/rebase-apply/patch:272: trailing whitespace.<BR> > * This file is part of FFmpeg.<BR> > .git/rebase-apply/patch:273: trailing whitespace.<BR> > *<BR> > error: patch failed: doc/filters.texi:25644<BR> > error: doc/filters.texi: patch does not apply<BR> > error: patch failed: libavfilter/Makefile:553<BR> > error: libavfilter/Makefile: patch does not apply<BR> > error: patch failed: libavfilter/allfilters.c:544<BR> > error: libavfilter/allfilters.c: patch does not apply<BR> > error: Did you hand edit your patch?<BR> > It does not apply to blobs recorded in its index.<BR> > Patch failed at 0001 avfilter/textmod: Add textmod, censor and show_speaker<BR> > filters<BR> > Use 'git am --show-current-patch' to see the failed patch<BR> > When you have resolved this problem, run "git am --continue".<BR> > If you prefer to skip this patch, run "git am --skip" instead.<BR> > To restore the original branch and stop patching, run "git am --abort".<BR> ><BR> > [...]<BR> > --<BR> <BR> <BR> Hi Michael,<BR> <BR> I have no idea what is going on here.<BR> <BR> When I look at those lines in the file that was generated<BR> by git format-patch, there isn't any trailing white space.<BR> Same is true when I look at this e-mail as I have received<BR> it from the ML, and when downloading the M-Box from patchwork,<BR> it hasn't any trailing whitespace either.<BR> <BR> There are lines with a single space between hunks,<BR> but all files generated by git format-patch have that.<BR> I have double-checked all involved source files and none of them<BR> has any trailing white space anymore.<BR> <BR> Yesterday, Andreas had pointed out the whitespace messages<BR> would only be warnings, but then I wouldn't know what's<BR> causing this, as it doesn't seem to be a line ending issue<BR> either. Patchwork could apply it, interestingly.<BR> <BR> I have attached the full patchset as zip. Hopefully this will<BR> apply at least.<BR> <BR> Thanks,<BR> softworkz<BR> <BR> <BR> <BR> <BR> </FONT> </P> </BODY> </HTML> OriginatorDeliveryReportRequested: False ReadReceiptRequested: False ReceivedByEntryID: ReceivedByName: ReceivedOnBehalfOfEntryID: ReceivedOnBehalfOfName: ReceivedTime: 11 Dec 2021 17:24:00 RecipientReassignmentProhibited: False Recipients: System.__ComObject ReminderOverrideDefault: False ReminderPlaySound: False ReminderSet: False ReminderSoundFile: ReminderTime: 1 Jan 4501 00:00:00 RemoteStatus: 0 ReplyRecipientNames: ReplyRecipients: System.__ComObject SaveSentMessageFolder: System.__ComObject SenderName: Sent: False SentOn: 1 Jan 4501 00:00:00 SentOnBehalfOfName: softworkz@hotmail.com Submitted: False To: FFmpeg development discussions and patches VotingOptions: VotingResponse: ItemProperties: System.__ComObject BodyFormat: 1 DownloadState: 1 InternetCodepage: 65001 MarkForDownload: 0 IsConflict: False AutoResolvedWinner: False Conflicts: System.__ComObject SenderEmailAddress: softworkz@hotmail.com SenderEmailType: EX Permission: 0 PermissionService: 0 PropertyAccessor: System.__ComObject SendUsingAccount: System.__ComObject TaskSubject: RE: [FFmpeg-devel] [PATCH v23 16/21] avfilter/textmod: Add textmod, censor and show_speaker filters TaskDueDate: 1 Jan 4501 00:00:00 TaskStartDate: 1 Jan 4501 00:00:00 TaskCompletedDate: 1 Jan 4501 00:00:00 ToDoTaskOrdinal: 1 Jan 4501 00:00:00 IsMarkedAsTask: False ConversationID: Sender: System.__ComObject RTFBody: System.Byte[] RetentionExpirationDate: 1 Jan 4501 00:00:00
On Sat, Dec 11, 2021 at 04:24:14PM +0000, Soft Works wrote: > > > > -----Original Message----- > > From: ffmpeg-devel <ffmpeg-devel-bounces@ffmpeg.org> On Behalf Of Michael > > Niedermayer > > Sent: Saturday, December 11, 2021 4:33 PM > > To: FFmpeg development discussions and patches <ffmpeg-devel@ffmpeg.org> > > Subject: Re: [FFmpeg-devel] [PATCH v23 16/21] avfilter/textmod: Add textmod, > > censor and show_speaker filters > > > > On Fri, Dec 10, 2021 at 09:37:53PM +0000, Soft Works wrote: > > > - textmod {S -> S) > > > Modify subtitle text in a number of ways > > > > > > - censor {S -> S) > > > Censor subtitles using a word list > > > > > > - show_speaker {S -> S) > > > Prepend speaker names from ASS subtitles to the visible text lines > > > > > > Signed-off-by: softworkz <softworkz@hotmail.com> > > > --- > > > doc/filters.texi | 206 ++++++++++++ > > > libavfilter/Makefile | 5 + > > > libavfilter/allfilters.c | 3 + > > > libavfilter/sf_textmod.c | 697 +++++++++++++++++++++++++++++++++++++++ > > > 4 files changed, 911 insertions(+) > > > create mode 100644 libavfilter/sf_textmod.c > > > > doesnt apply (using git am with the email, the other patches > > with lower numbers all applied with no such issues) > > > > Applying: avfilter/textmod: Add textmod, censor and show_speaker filters > > .git/rebase-apply/patch:269: trailing whitespace. > > /* > > .git/rebase-apply/patch:270: trailing whitespace. > > * Copyright (c) 2021 softworkz > > .git/rebase-apply/patch:271: trailing whitespace. > > * > > .git/rebase-apply/patch:272: trailing whitespace. > > * This file is part of FFmpeg. > > .git/rebase-apply/patch:273: trailing whitespace. > > * > > warning: squelched 692 whitespace errors > > warning: 697 lines add whitespace errors. > > Using index info to reconstruct a base tree... > > M libavfilter/Makefile > > M libavfilter/allfilters.c > > .git/rebase-apply/patch:269: trailing whitespace. > > /* > > .git/rebase-apply/patch:270: trailing whitespace. > > * Copyright (c) 2021 softworkz > > .git/rebase-apply/patch:271: trailing whitespace. > > * > > .git/rebase-apply/patch:272: trailing whitespace. > > * This file is part of FFmpeg. > > .git/rebase-apply/patch:273: trailing whitespace. > > * > > error: patch failed: doc/filters.texi:25644 > > error: doc/filters.texi: patch does not apply > > error: patch failed: libavfilter/Makefile:553 > > error: libavfilter/Makefile: patch does not apply > > error: patch failed: libavfilter/allfilters.c:544 > > error: libavfilter/allfilters.c: patch does not apply > > error: Did you hand edit your patch? > > It does not apply to blobs recorded in its index. > > Patch failed at 0001 avfilter/textmod: Add textmod, censor and show_speaker > > filters > > Use 'git am --show-current-patch' to see the failed patch > > When you have resolved this problem, run "git am --continue". > > If you prefer to skip this patch, run "git am --skip" instead. > > To restore the original branch and stop patching, run "git am --abort". > > > > [...] > > -- > > > Hi Michael, > > I have no idea what is going on here. > > When I look at those lines in the file that was generated > by git format-patch, there isn't any trailing white space. > Same is true when I look at this e-mail as I have received > it from the ML, and when downloading the M-Box from patchwork, > it hasn't any trailing whitespace either. > > There are lines with a single space between hunks, > but all files generated by git format-patch have that. > I have double-checked all involved source files and none of them > has any trailing white space anymore. > > Yesterday, Andreas had pointed out the whitespace messages > would only be warnings, but then I wouldn't know what's > causing this, as it doesn't seem to be a line ending issue > either. Patchwork could apply it, interestingly. patchwork uses different code to apply patches we already determined this last time. heres what patch does: patch -p1 --dry-run <.git/rebase-apply/patch (Stripping trailing CRs from patch; use --binary to disable.) checking file doc/filters.texi (Stripping trailing CRs from patch; use --binary to disable.) checking file libavfilter/Makefile Hunk #1 succeeded at 554 (offset 1 line). (Stripping trailing CRs from patch; use --binary to disable.) checking file libavfilter/allfilters.c Hunk #1 succeeded at 545 (offset 1 line). (Stripping trailing CRs from patch; use --binary to disable.) checking file libavfilter/sf_textmod.c it applies it but it still complains about issues, OTOH git am refuses this. also using --binary patch also refuses this patch -p1 --dry-run --binary <.git/rebase-apply/patch checking file doc/filters.texi Hunk #1 FAILED at 25644 (different line endings). Hunk #2 FAILED at 25811 (different line endings). 2 out of 2 hunks FAILED checking file libavfilter/Makefile Hunk #1 FAILED at 553 (different line endings). 1 out of 1 hunk FAILED checking file libavfilter/allfilters.c Hunk #1 FAILED at 544 (different line endings). 1 out of 1 hunk FAILED checking file libavfilter/sf_textmod.c I dont want all of a sudden random files to change their cr/lf line endings which this is smelling like it could result in > > I have attached the full patchset as zip. Hopefully this will > apply at least. please provide a git repository, github or whatever, working with attached zip files is not reasonable when it involves repeatedly sent patchsets thx [...]
> -----Original Message----- > From: ffmpeg-devel <ffmpeg-devel-bounces@ffmpeg.org> On Behalf Of Michael > Niedermayer > Sent: Saturday, December 11, 2021 6:03 PM > To: FFmpeg development discussions and patches <ffmpeg-devel@ffmpeg.org> > Subject: Re: [FFmpeg-devel] [PATCH v23 16/21] avfilter/textmod: Add textmod, > censor and show_speaker filters > > On Sat, Dec 11, 2021 at 04:24:14PM +0000, Soft Works wrote: > > > > > > > -----Original Message----- > > > From: ffmpeg-devel <ffmpeg-devel-bounces@ffmpeg.org> On Behalf Of Michael > > > Niedermayer > > > Sent: Saturday, December 11, 2021 4:33 PM > > > To: FFmpeg development discussions and patches <ffmpeg-devel@ffmpeg.org> > > > Subject: Re: [FFmpeg-devel] [PATCH v23 16/21] avfilter/textmod: Add > textmod, > > > censor and show_speaker filters > > > > > > On Fri, Dec 10, 2021 at 09:37:53PM +0000, Soft Works wrote: > > > > - textmod {S -> S) > > > > Modify subtitle text in a number of ways > > > > > > > > - censor {S -> S) > > > > Censor subtitles using a word list > > > > > > > > - show_speaker {S -> S) > > > > Prepend speaker names from ASS subtitles to the visible text lines > > > > > > > > Signed-off-by: softworkz <softworkz@hotmail.com> > > > > --- > > > > doc/filters.texi | 206 ++++++++++++ > > > > libavfilter/Makefile | 5 + > > > > libavfilter/allfilters.c | 3 + > > > > libavfilter/sf_textmod.c | 697 +++++++++++++++++++++++++++++++++++++++ > > > > 4 files changed, 911 insertions(+) > > > > create mode 100644 libavfilter/sf_textmod.c > > > > > > doesnt apply (using git am with the email, the other patches > > > with lower numbers all applied with no such issues) > > > > > > Applying: avfilter/textmod: Add textmod, censor and show_speaker filters > > > .git/rebase-apply/patch:269: trailing whitespace. > > > /* > > > .git/rebase-apply/patch:270: trailing whitespace. > > > * Copyright (c) 2021 softworkz > > > .git/rebase-apply/patch:271: trailing whitespace. > > > * > > > .git/rebase-apply/patch:272: trailing whitespace. > > > * This file is part of FFmpeg. > > > .git/rebase-apply/patch:273: trailing whitespace. > > > * > > > warning: squelched 692 whitespace errors > > > warning: 697 lines add whitespace errors. > > > Using index info to reconstruct a base tree... > > > M libavfilter/Makefile > > > M libavfilter/allfilters.c > > > .git/rebase-apply/patch:269: trailing whitespace. > > > /* > > > .git/rebase-apply/patch:270: trailing whitespace. > > > * Copyright (c) 2021 softworkz > > > .git/rebase-apply/patch:271: trailing whitespace. > > > * > > > .git/rebase-apply/patch:272: trailing whitespace. > > > * This file is part of FFmpeg. > > > .git/rebase-apply/patch:273: trailing whitespace. > > > * > > > error: patch failed: doc/filters.texi:25644 > > > error: doc/filters.texi: patch does not apply > > > error: patch failed: libavfilter/Makefile:553 > > > error: libavfilter/Makefile: patch does not apply > > > error: patch failed: libavfilter/allfilters.c:544 > > > error: libavfilter/allfilters.c: patch does not apply > > > error: Did you hand edit your patch? > > > It does not apply to blobs recorded in its index. > > > Patch failed at 0001 avfilter/textmod: Add textmod, censor and > show_speaker > > > filters > > > Use 'git am --show-current-patch' to see the failed patch > > > When you have resolved this problem, run "git am --continue". > > > If you prefer to skip this patch, run "git am --skip" instead. > > > To restore the original branch and stop patching, run "git am --abort". > > > > > > [...] > > > -- > > > > > > Hi Michael, > > > > I have no idea what is going on here. > > > > When I look at those lines in the file that was generated > > by git format-patch, there isn't any trailing white space. > > Same is true when I look at this e-mail as I have received > > it from the ML, and when downloading the M-Box from patchwork, > > it hasn't any trailing whitespace either. > > > > There are lines with a single space between hunks, > > but all files generated by git format-patch have that. > > I have double-checked all involved source files and none of them > > has any trailing white space anymore. > > > > Yesterday, Andreas had pointed out the whitespace messages > > would only be warnings, but then I wouldn't know what's > > causing this, as it doesn't seem to be a line ending issue > > either. Patchwork could apply it, interestingly. > > patchwork uses different code to apply patches we already determined this > last time. > > heres what patch does: > > patch -p1 --dry-run <.git/rebase-apply/patch > (Stripping trailing CRs from patch; use --binary to disable.) > checking file doc/filters.texi > (Stripping trailing CRs from patch; use --binary to disable.) > checking file libavfilter/Makefile > Hunk #1 succeeded at 554 (offset 1 line). > (Stripping trailing CRs from patch; use --binary to disable.) > checking file libavfilter/allfilters.c > Hunk #1 succeeded at 545 (offset 1 line). > (Stripping trailing CRs from patch; use --binary to disable.) > checking file libavfilter/sf_textmod.c > > it applies it but it still complains about issues, OTOH git am > refuses this. > also using --binary patch also refuses this > > patch -p1 --dry-run --binary <.git/rebase-apply/patch > checking file doc/filters.texi > Hunk #1 FAILED at 25644 (different line endings). > Hunk #2 FAILED at 25811 (different line endings). > 2 out of 2 hunks FAILED > checking file libavfilter/Makefile > Hunk #1 FAILED at 553 (different line endings). > 1 out of 1 hunk FAILED > checking file libavfilter/allfilters.c > Hunk #1 FAILED at 544 (different line endings). > 1 out of 1 hunk FAILED > checking file libavfilter/sf_textmod.c > > I dont want all of a sudden random files to change their cr/lf line endings > which this is smelling like it could result in > > > > > > I have attached the full patchset as zip. Hopefully this will > > apply at least. > > please provide a git repository, github or whatever, working with attached > zip files is not reasonable when it involves repeatedly sent patchsets OMG - there's hardly anything I'd like to do more than that :-) Please hold on.. swApplication: Microsoft.Office.Interop.Outlook.ApplicationClass Class: 43 Session: System.__ComObject Parent: System.__ComObject Attachments: System.__ComObject BillingInformation: Body: > -----Original Message----- > From: ffmpeg-devel <ffmpeg-devel-bounces@ffmpeg.org> On Behalf Of Michael > Niedermayer > Sent: Saturday, December 11, 2021 6:03 PM > To: FFmpeg development discussions and patches <ffmpeg-devel@ffmpeg.org> > Subject: Re: [FFmpeg-devel] [PATCH v23 16/21] avfilter/textmod: Add textmod, > censor and show_speaker filters > > On Sat, Dec 11, 2021 at 04:24:14PM +0000, Soft Works wrote: > > > > > > > -----Original Message----- > > > From: ffmpeg-devel <ffmpeg-devel-bounces@ffmpeg.org> On Behalf Of Michael > > > Niedermayer > > > Sent: Saturday, December 11, 2021 4:33 PM > > > To: FFmpeg development discussions and patches <ffmpeg-devel@ffmpeg.org> > > > Subject: Re: [FFmpeg-devel] [PATCH v23 16/21] avfilter/textmod: Add > textmod, > > > censor and show_speaker filters > > > > > > On Fri, Dec 10, 2021 at 09:37:53PM +0000, Soft Works wrote: > > > > - textmod {S -> S) > > > > Modify subtitle text in a number of ways > > > > > > > > - censor {S -> S) > > > > Censor subtitles using a word list > > > > > > > > - show_speaker {S -> S) > > > > Prepend speaker names from ASS subtitles to the visible text lines > > > > > > > > Signed-off-by: softworkz <softworkz@hotmail.com> > > > > --- > > > > doc/filters.texi | 206 ++++++++++++ > > > > libavfilter/Makefile | 5 + > > > > libavfilter/allfilters.c | 3 + > > > > libavfilter/sf_textmod.c | 697 +++++++++++++++++++++++++++++++++++++++ > > > > 4 files changed, 911 insertions(+) > > > > create mode 100644 libavfilter/sf_textmod.c > > > > > > doesnt apply (using git am with the email, the other patches > > > with lower numbers all applied with no such issues) > > > > > > Applying: avfilter/textmod: Add textmod, censor and show_speaker filters > > > .git/rebase-apply/patch:269: trailing whitespace. > > > /* > > > .git/rebase-apply/patch:270: trailing whitespace. > > > * Copyright (c) 2021 softworkz > > > .git/rebase-apply/patch:271: trailing whitespace. > > > * > > > .git/rebase-apply/patch:272: trailing whitespace. > > > * This file is part of FFmpeg. > > > .git/rebase-apply/patch:273: trailing whitespace. > > > * > > > warning: squelched 692 whitespace errors > > > warning: 697 lines add whitespace errors. > > > Using index info to reconstruct a base tree... > > > M libavfilter/Makefile > > > M libavfilter/allfilters.c > > > .git/rebase-apply/patch:269: trailing whitespace. > > > /* > > > .git/rebase-apply/patch:270: trailing whitespace. > > > * Copyright (c) 2021 softworkz > > > .git/rebase-apply/patch:271: trailing whitespace. > > > * > > > .git/rebase-apply/patch:272: trailing whitespace. > > > * This file is part of FFmpeg. > > > .git/rebase-apply/patch:273: trailing whitespace. > > > * > > > error: patch failed: doc/filters.texi:25644 > > > error: doc/filters.texi: patch does not apply > > > error: patch failed: libavfilter/Makefile:553 > > > error: libavfilter/Makefile: patch does not apply > > > error: patch failed: libavfilter/allfilters.c:544 > > > error: libavfilter/allfilters.c: patch does not apply > > > error: Did you hand edit your patch? > > > It does not apply to blobs recorded in its index. > > > Patch failed at 0001 avfilter/textmod: Add textmod, censor and > show_speaker > > > filters > > > Use 'git am --show-current-patch' to see the failed patch > > > When you have resolved this problem, run "git am --continue". > > > If you prefer to skip this patch, run "git am --skip" instead. > > > To restore the original branch and stop patching, run "git am --abort". > > > > > > [...] > > > -- > > > > > > Hi Michael, > > > > I have no idea what is going on here. > > > > When I look at those lines in the file that was generated > > by git format-patch, there isn't any trailing white space. > > Same is true when I look at this e-mail as I have received > > it from the ML, and when downloading the M-Box from patchwork, > > it hasn't any trailing whitespace either. > > > > There are lines with a single space between hunks, > > but all files generated by git format-patch have that. > > I have double-checked all involved source files and none of them > > has any trailing white space anymore. > > > > Yesterday, Andreas had pointed out the whitespace messages > > would only be warnings, but then I wouldn't know what's > > causing this, as it doesn't seem to be a line ending issue > > either. Patchwork could apply it, interestingly. > > patchwork uses different code to apply patches we already determined this > last time. > > heres what patch does: > > patch -p1 --dry-run <.git/rebase-apply/patch > (Stripping trailing CRs from patch; use --binary to disable.) > checking file doc/filters.texi > (Stripping trailing CRs from patch; use --binary to disable.) > checking file libavfilter/Makefile > Hunk #1 succeeded at 554 (offset 1 line). > (Stripping trailing CRs from patch; use --binary to disable.) > checking file libavfilter/allfilters.c > Hunk #1 succeeded at 545 (offset 1 line). > (Stripping trailing CRs from patch; use --binary to disable.) > checking file libavfilter/sf_textmod.c > > it applies it but it still complains about issues, OTOH git am > refuses this. > also using --binary patch also refuses this > > patch -p1 --dry-run --binary <.git/rebase-apply/patch > checking file doc/filters.texi > Hunk #1 FAILED at 25644 (different line endings). > Hunk #2 FAILED at 25811 (different line endings). > 2 out of 2 hunks FAILED > checking file libavfilter/Makefile > Hunk #1 FAILED at 553 (different line endings). > 1 out of 1 hunk FAILED > checking file libavfilter/allfilters.c > Hunk #1 FAILED at 544 (different line endings). > 1 out of 1 hunk FAILED > checking file libavfilter/sf_textmod.c > > I dont want all of a sudden random files to change their cr/lf line endings > which this is smelling like it could result in > > > > > > I have attached the full patchset as zip. Hopefully this will > > apply at least. > > please provide a git repository, github or whatever, working with attached > zip files is not reasonable when it involves repeatedly sent patchsets OMG - there's hardly anything I'd like to do more than that :-) Please hold on.. sw Categories: Companies: ConversationIndex: 0101D7EE0E3097BC542CE25E8F449EA54DC82CBAE9E7AC2D6CB800800008FC4080001009808000015320 ConversationTopic: [PATCH 1/1] Test ref file change CreationTime: 1 Jan 4501 00:00:00 EntryID: FormDescription: System.__ComObject GetInspector: System.__ComObject Importance: 1 LastModificationTime: 1 Jan 4501 00:00:00 MessageClass: IPM.Note Mileage: NoAging: False OutlookInternalVersion: 0 OutlookVersion: Saved: False Sensitivity: 0 Size: 0 Subject: RE: [FFmpeg-devel] [PATCH v23 16/21] avfilter/textmod: Add textmod, censor and show_speaker filters UnRead: True UserProperties: System.__ComObject AlternateRecipientAllowed: True AutoForwarded: False BCC: CC: DeferredDeliveryTime: 1 Jan 4501 00:00:00 DeleteAfterSubmit: False ExpiryTime: 1 Jan 4501 00:00:00 FlagRequest: HTMLBody: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN"> <HTML> <HEAD> <META NAME="Generator" CONTENT="MS Exchange Server version 16.0.14701.20038"> <TITLE></TITLE> </HEAD> <BODY> <!-- Converted from text/plain format --> <BR> <BR> <P><FONT SIZE=2>> -----Original Message-----<BR> > From: ffmpeg-devel <ffmpeg-devel-bounces@ffmpeg.org> On Behalf Of Michael<BR> > Niedermayer<BR> > Sent: Saturday, December 11, 2021 6:03 PM<BR> > To: FFmpeg development discussions and patches <ffmpeg-devel@ffmpeg.org><BR> > Subject: Re: [FFmpeg-devel] [PATCH v23 16/21] avfilter/textmod: Add textmod,<BR> > censor and show_speaker filters<BR> ><BR> > On Sat, Dec 11, 2021 at 04:24:14PM +0000, Soft Works wrote:<BR> > ><BR> > ><BR> > > > -----Original Message-----<BR> > > > From: ffmpeg-devel <ffmpeg-devel-bounces@ffmpeg.org> On Behalf Of Michael<BR> > > > Niedermayer<BR> > > > Sent: Saturday, December 11, 2021 4:33 PM<BR> > > > To: FFmpeg development discussions and patches <ffmpeg-devel@ffmpeg.org><BR> > > > Subject: Re: [FFmpeg-devel] [PATCH v23 16/21] avfilter/textmod: Add<BR> > textmod,<BR> > > > censor and show_speaker filters<BR> > > ><BR> > > > On Fri, Dec 10, 2021 at 09:37:53PM +0000, Soft Works wrote:<BR> > > > > - textmod {S -> S)<BR> > > > > Modify subtitle text in a number of ways<BR> > > > ><BR> > > > > - censor {S -> S)<BR> > > > > Censor subtitles using a word list<BR> > > > ><BR> > > > > - show_speaker {S -> S)<BR> > > > > Prepend speaker names from ASS subtitles to the visible text lines<BR> > > > ><BR> > > > > Signed-off-by: softworkz <softworkz@hotmail.com><BR> > > > > ---<BR> > > > > doc/filters.texi | 206 ++++++++++++<BR> > > > > libavfilter/Makefile | 5 +<BR> > > > > libavfilter/allfilters.c | 3 +<BR> > > > > libavfilter/sf_textmod.c | 697 +++++++++++++++++++++++++++++++++++++++<BR> > > > > 4 files changed, 911 insertions(+)<BR> > > > > create mode 100644 libavfilter/sf_textmod.c<BR> > > ><BR> > > > doesnt apply (using git am with the email, the other patches<BR> > > > with lower numbers all applied with no such issues)<BR> > > ><BR> > > > Applying: avfilter/textmod: Add textmod, censor and show_speaker filters<BR> > > > .git/rebase-apply/patch:269: trailing whitespace.<BR> > > > /*<BR> > > > .git/rebase-apply/patch:270: trailing whitespace.<BR> > > > * Copyright (c) 2021 softworkz<BR> > > > .git/rebase-apply/patch:271: trailing whitespace.<BR> > > > *<BR> > > > .git/rebase-apply/patch:272: trailing whitespace.<BR> > > > * This file is part of FFmpeg.<BR> > > > .git/rebase-apply/patch:273: trailing whitespace.<BR> > > > *<BR> > > > warning: squelched 692 whitespace errors<BR> > > > warning: 697 lines add whitespace errors.<BR> > > > Using index info to reconstruct a base tree...<BR> > > > M libavfilter/Makefile<BR> > > > M libavfilter/allfilters.c<BR> > > > .git/rebase-apply/patch:269: trailing whitespace.<BR> > > > /*<BR> > > > .git/rebase-apply/patch:270: trailing whitespace.<BR> > > > * Copyright (c) 2021 softworkz<BR> > > > .git/rebase-apply/patch:271: trailing whitespace.<BR> > > > *<BR> > > > .git/rebase-apply/patch:272: trailing whitespace.<BR> > > > * This file is part of FFmpeg.<BR> > > > .git/rebase-apply/patch:273: trailing whitespace.<BR> > > > *<BR> > > > error: patch failed: doc/filters.texi:25644<BR> > > > error: doc/filters.texi: patch does not apply<BR> > > > error: patch failed: libavfilter/Makefile:553<BR> > > > error: libavfilter/Makefile: patch does not apply<BR> > > > error: patch failed: libavfilter/allfilters.c:544<BR> > > > error: libavfilter/allfilters.c: patch does not apply<BR> > > > error: Did you hand edit your patch?<BR> > > > It does not apply to blobs recorded in its index.<BR> > > > Patch failed at 0001 avfilter/textmod: Add textmod, censor and<BR> > show_speaker<BR> > > > filters<BR> > > > Use 'git am --show-current-patch' to see the failed patch<BR> > > > When you have resolved this problem, run "git am --continue".<BR> > > > If you prefer to skip this patch, run "git am --skip" instead.<BR> > > > To restore the original branch and stop patching, run "git am --abort".<BR> > > ><BR> > > > [...]<BR> > > > --<BR> > ><BR> > ><BR> > > Hi Michael,<BR> > ><BR> > > I have no idea what is going on here.<BR> > ><BR> > > When I look at those lines in the file that was generated<BR> > > by git format-patch, there isn't any trailing white space.<BR> > > Same is true when I look at this e-mail as I have received<BR> > > it from the ML, and when downloading the M-Box from patchwork,<BR> > > it hasn't any trailing whitespace either.<BR> > ><BR> > > There are lines with a single space between hunks,<BR> > > but all files generated by git format-patch have that.<BR> > > I have double-checked all involved source files and none of them<BR> > > has any trailing white space anymore.<BR> > ><BR> > > Yesterday, Andreas had pointed out the whitespace messages<BR> > > would only be warnings, but then I wouldn't know what's<BR> > > causing this, as it doesn't seem to be a line ending issue<BR> > > either. Patchwork could apply it, interestingly.<BR> ><BR> > patchwork uses different code to apply patches we already determined this<BR> > last time.<BR> ><BR> > heres what patch does:<BR> ><BR> > patch -p1 --dry-run <.git/rebase-apply/patch<BR> > (Stripping trailing CRs from patch; use --binary to disable.)<BR> > checking file doc/filters.texi<BR> > (Stripping trailing CRs from patch; use --binary to disable.)<BR> > checking file libavfilter/Makefile<BR> > Hunk #1 succeeded at 554 (offset 1 line).<BR> > (Stripping trailing CRs from patch; use --binary to disable.)<BR> > checking file libavfilter/allfilters.c<BR> > Hunk #1 succeeded at 545 (offset 1 line).<BR> > (Stripping trailing CRs from patch; use --binary to disable.)<BR> > checking file libavfilter/sf_textmod.c<BR> ><BR> > it applies it but it still complains about issues, OTOH git am<BR> > refuses this.<BR> > also using --binary patch also refuses this<BR> ><BR> > patch -p1 --dry-run --binary <.git/rebase-apply/patch<BR> > checking file doc/filters.texi<BR> > Hunk #1 FAILED at 25644 (different line endings).<BR> > Hunk #2 FAILED at 25811 (different line endings).<BR> > 2 out of 2 hunks FAILED<BR> > checking file libavfilter/Makefile<BR> > Hunk #1 FAILED at 553 (different line endings).<BR> > 1 out of 1 hunk FAILED<BR> > checking file libavfilter/allfilters.c<BR> > Hunk #1 FAILED at 544 (different line endings).<BR> > 1 out of 1 hunk FAILED<BR> > checking file libavfilter/sf_textmod.c<BR> ><BR> > I dont want all of a sudden random files to change their cr/lf line endings<BR> > which this is smelling like it could result in<BR> ><BR> ><BR> > ><BR> > > I have attached the full patchset as zip. Hopefully this will<BR> > > apply at least.<BR> ><BR> > please provide a git repository, github or whatever, working with attached<BR> > zip files is not reasonable when it involves repeatedly sent patchsets<BR> <BR> OMG - there's hardly anything I'd like to do more than that :-) <BR> <BR> Please hold on..<BR> <BR> sw<BR> </FONT> </P> </BODY> </HTML> OriginatorDeliveryReportRequested: False ReadReceiptRequested: False ReceivedByEntryID: ReceivedByName: ReceivedOnBehalfOfEntryID: ReceivedOnBehalfOfName: ReceivedTime: 11 Dec 2021 18:10:00 RecipientReassignmentProhibited: False Recipients: System.__ComObject ReminderOverrideDefault: False ReminderPlaySound: False ReminderSet: False ReminderSoundFile: ReminderTime: 1 Jan 4501 00:00:00 RemoteStatus: 0 ReplyRecipientNames: ReplyRecipients: System.__ComObject SaveSentMessageFolder: System.__ComObject SenderName: Sent: False SentOn: 1 Jan 4501 00:00:00 SentOnBehalfOfName: /o=First Organization/ou=Exchange Administrative Group(FYDIBOHF23SPDLT)/cn=Recipients/cn=0006400084329506 Submitted: False To: FFmpeg development discussions and patches VotingOptions: VotingResponse: ItemProperties: System.__ComObject BodyFormat: 1 DownloadState: 1 InternetCodepage: 65001 MarkForDownload: 0 IsConflict: False AutoResolvedWinner: False Conflicts: System.__ComObject SenderEmailAddress: softworkz@hotmail.com SenderEmailType: EX Permission: 0 PermissionService: 0 PropertyAccessor: System.__ComObject SendUsingAccount: System.__ComObject TaskSubject: RE: [FFmpeg-devel] [PATCH v23 16/21] avfilter/textmod: Add textmod, censor and show_speaker filters TaskDueDate: 1 Jan 4501 00:00:00 TaskStartDate: 1 Jan 4501 00:00:00 TaskCompletedDate: 1 Jan 4501 00:00:00 ToDoTaskOrdinal: 1 Jan 4501 00:00:00 IsMarkedAsTask: False ConversationID: Sender: System.__ComObject RTFBody: System.Byte[] RetentionExpirationDate: 1 Jan 4501 00:00:00
> -----Original Message----- > From: ffmpeg-devel <ffmpeg-devel-bounces@ffmpeg.org> On Behalf Of Michael > Niedermayer > Sent: Saturday, December 11, 2021 6:03 PM > To: FFmpeg development discussions and patches <ffmpeg-devel@ffmpeg.org> > Subject: Re: [FFmpeg-devel] [PATCH v23 16/21] avfilter/textmod: Add textmod, > censor and show_speaker filters > > On Sat, Dec 11, 2021 at 04:24:14PM +0000, Soft Works wrote: > > > > > > > -----Original Message----- > > > From: ffmpeg-devel <ffmpeg-devel-bounces@ffmpeg.org> On Behalf Of Michael > > > Niedermayer > > > Sent: Saturday, December 11, 2021 4:33 PM > > > To: FFmpeg development discussions and patches <ffmpeg-devel@ffmpeg.org> > > > Subject: Re: [FFmpeg-devel] [PATCH v23 16/21] avfilter/textmod: Add > textmod, > > > censor and show_speaker filters > > > > > > On Fri, Dec 10, 2021 at 09:37:53PM +0000, Soft Works wrote: > > > > - textmod {S -> S) > > > > Modify subtitle text in a number of ways > > > > > > > > - censor {S -> S) > > > > Censor subtitles using a word list > > > > > > > > - show_speaker {S -> S) > > > > Prepend speaker names from ASS subtitles to the visible text lines > > > > > > > > Signed-off-by: softworkz <softworkz@hotmail.com> > > > > --- > > > > doc/filters.texi | 206 ++++++++++++ > > > > libavfilter/Makefile | 5 + > > > > libavfilter/allfilters.c | 3 + > > > > libavfilter/sf_textmod.c | 697 +++++++++++++++++++++++++++++++++++++++ > > > > 4 files changed, 911 insertions(+) > > > > create mode 100644 libavfilter/sf_textmod.c > > > > > > doesnt apply (using git am with the email, the other patches > > > with lower numbers all applied with no such issues) > > > > > > Applying: avfilter/textmod: Add textmod, censor and show_speaker filters > > > .git/rebase-apply/patch:269: trailing whitespace. > > > /* > > > .git/rebase-apply/patch:270: trailing whitespace. > > > * Copyright (c) 2021 softworkz > > > .git/rebase-apply/patch:271: trailing whitespace. > > > * > > > .git/rebase-apply/patch:272: trailing whitespace. > > > * This file is part of FFmpeg. > > > .git/rebase-apply/patch:273: trailing whitespace. > > > * > > > warning: squelched 692 whitespace errors > > > warning: 697 lines add whitespace errors. > > > Using index info to reconstruct a base tree... > > > M libavfilter/Makefile > > > M libavfilter/allfilters.c > > > .git/rebase-apply/patch:269: trailing whitespace. > > > /* > > > .git/rebase-apply/patch:270: trailing whitespace. > > > * Copyright (c) 2021 softworkz > > > .git/rebase-apply/patch:271: trailing whitespace. > > > * > > > .git/rebase-apply/patch:272: trailing whitespace. > > > * This file is part of FFmpeg. > > > .git/rebase-apply/patch:273: trailing whitespace. > > > * > > > error: patch failed: doc/filters.texi:25644 > > > error: doc/filters.texi: patch does not apply > > > error: patch failed: libavfilter/Makefile:553 > > > error: libavfilter/Makefile: patch does not apply > > > error: patch failed: libavfilter/allfilters.c:544 > > > error: libavfilter/allfilters.c: patch does not apply > > > error: Did you hand edit your patch? > > > It does not apply to blobs recorded in its index. > > > Patch failed at 0001 avfilter/textmod: Add textmod, censor and > show_speaker > > > filters > > > Use 'git am --show-current-patch' to see the failed patch > > > When you have resolved this problem, run "git am --continue". > > > If you prefer to skip this patch, run "git am --skip" instead. > > > To restore the original branch and stop patching, run "git am --abort". > > > > > > [...] > > > -- > > > > > > Hi Michael, > > > > I have no idea what is going on here. > > > > When I look at those lines in the file that was generated > > by git format-patch, there isn't any trailing white space. > > Same is true when I look at this e-mail as I have received > > it from the ML, and when downloading the M-Box from patchwork, > > it hasn't any trailing whitespace either. > > > > There are lines with a single space between hunks, > > but all files generated by git format-patch have that. > > I have double-checked all involved source files and none of them > > has any trailing white space anymore. > > > > Yesterday, Andreas had pointed out the whitespace messages > > would only be warnings, but then I wouldn't know what's > > causing this, as it doesn't seem to be a line ending issue > > either. Patchwork could apply it, interestingly. > > patchwork uses different code to apply patches we already determined this > last time. > > heres what patch does: > > patch -p1 --dry-run <.git/rebase-apply/patch > (Stripping trailing CRs from patch; use --binary to disable.) > checking file doc/filters.texi > (Stripping trailing CRs from patch; use --binary to disable.) > checking file libavfilter/Makefile > Hunk #1 succeeded at 554 (offset 1 line). > (Stripping trailing CRs from patch; use --binary to disable.) > checking file libavfilter/allfilters.c > Hunk #1 succeeded at 545 (offset 1 line). > (Stripping trailing CRs from patch; use --binary to disable.) > checking file libavfilter/sf_textmod.c > > it applies it but it still complains about issues, OTOH git am > refuses this. > also using --binary patch also refuses this > > patch -p1 --dry-run --binary <.git/rebase-apply/patch > checking file doc/filters.texi > Hunk #1 FAILED at 25644 (different line endings). > Hunk #2 FAILED at 25811 (different line endings). > 2 out of 2 hunks FAILED > checking file libavfilter/Makefile > Hunk #1 FAILED at 553 (different line endings). > 1 out of 1 hunk FAILED > checking file libavfilter/allfilters.c > Hunk #1 FAILED at 544 (different line endings). > 1 out of 1 hunk FAILED > checking file libavfilter/sf_textmod.c > > I dont want all of a sudden random files to change their cr/lf line endings > which this is smelling like it could result in > > > > > > I have attached the full patchset as zip. Hopefully this will > > apply at least. > > please provide a git repository, github or whatever, working with attached > zip files is not reasonable when it involves repeatedly sent patchsets This is a fresh fork to which I pushed my v32 subtitles branch: https://github.com/softworkz/FFmpeg/tree/subs_v23 And this one additionally has the dvbsubdec fix and the fix for hard-space parsing which patchwork didn't take (due to mixed line endings). https://github.com/softworkz/FFmpeg/tree/subs_v23_plus Thanks again, softworkz
diff --git a/doc/filters.texi b/doc/filters.texi index 7041f9031e..e87d3993df 100644 --- a/doc/filters.texi +++ b/doc/filters.texi @@ -25644,6 +25644,145 @@ existing filters using @code{--disable-filters}. Below is a description of the currently available subtitle filters. + +@section censor + +Censor selected words in text subtitles. + +Inputs: +@itemize +@item 0: Subtitles[TEXT] +@end itemize + +Outputs: +@itemize +@item 0: Subtitles[TEXT] +@end itemize + +It accepts the following parameters: + +@table @option +@item mode +The censoring mode to apply. + +Supported censoring modes are: + +@table @var +@item 0, keep_first_last +Replace all characters with the 'censor_char' except the first and the last character of a word. +For words with less than 4 characters, the last character will be replaced as well. +For words with less than 3 characters, the first character will be replaced as well. +@item 1, keep_first +Replace all characters with the 'censor_char' except the first character of a word. +For words with less than 3 characters, the first character will be replaced as well. +@item 2, all +Replace all characters with the 'censor_char'. +@end table + +@item words +A list of words to censor, separated by 'separator'. + +@item words_file +Specify a file from which to load the contents for the 'words' parameter. + +@item censor_char +Single character used as replacement for censoring. + +@item separator +Delimiter character for words. Used with replace_words and remove_words- Must be a single character. +The default is '.'. + +@end table + +@subsection Examples + +@itemize +@item +Censor a few given words with a pound character. +@example +ffmpeg -i "http://streams.videolan.org/samples/sub/SSA/subtitle_testing_complex.mkv" -filter_complex "[0:1]censor=words='diss,louder,hope,beam,word':censor_char='#'" -map 0 -y output.mkv +@end example +@end itemize + + +@section textmod + +Modify subtitle text in a number of ways. + +Inputs: +@itemize +@item 0: Subtitles[TEXT] +@end itemize + +Outputs: +@itemize +@item 0: Subtitles[TEXT] +@end itemize + +It accepts the following parameters: + +@table @option +@item mode +The kind of text modification to apply + +Supported operation modes are: + +@table @var +@item 0, leet +Convert subtitle text to 'leet speak'. It's primarily useful for testing as the modification will be visible with almost all text lines. +@item 1, to_upper +Change all text to upper case. Might improve readability. +@item 2, to_lower +Change all text to lower case. +@item 3, replace_chars +Replace one or more characters. Requires the find and replace parameters to be specified. +Both need to be equal in length. +The first char in find is replaced by the first char in replace, same for all subsequent chars. +@item 4, remove_chars +Remove certain characters. Requires the find parameter to be specified. +All chars in the find parameter string will be removed from all subtitle text. +@item 5, replace_words +Replace one or more words. Requires the find and replace parameters to be specified. Multiple words must be separated by the delimiter char specified vie the separator parameter (default: ','). +The number of words in the find and replace parameters needs to be equal. +The first word in find is replaced by the first word in replace, same for all subsequent words +@item 6, remove_words +Remove certain words. Requires the find parameter to be specified. Multiple words must be separated by the delimiter char specified vie the separator parameter (default: ','). +All words in the find parameter string will be removed from all subtitle text. +@end table + +@item find +Required for replace_chars, remove_chars, replace_words and remove_words. + +@item find_file +Specify a file from which to load the contents for the 'find' parameter. + +@item replace +Required for replace_chars and replace_words. + +@item replace_file +Specify a file from which to load the contents for the 'replace' parameter. + +@item separator +Delimiter character for words. Used with replace_words and remove_words- Must be a single character. +The default is '.'. + +@end table + +@subsection Examples + +@itemize +@item +Change all characters to upper case while keeping all styles and animations: +@example +ffmpeg -i "https://streams.videolan.org/ffmpeg/mkv_subtitles.mkv" -filter_complex "[0:s]textmod=mode=to_upper" -map 0 -y out.mkv +@end example +@item +Remove a set of symbol characters for am improved and smoother visual apperance: +@example +ffmpeg -i "https://streams.videolan.org/ffmpeg/mkv_subtitles.mkv" -filter_complex "[0:s]textmod=mode=remove_chars:find='$&#@*§'" -map 0 -y out.mkv +@end example +@end itemize + @section graphicsub2video Renders graphic subtitles as video frames. @@ -25811,6 +25950,73 @@ ffmpeg -i "http://streams.videolan.org/samples/sub/SSA/subtitle_testing_complex. @end example @end itemize +@section showspeaker + +Prepend speaker names to subtitle lines (when available). + +Subtitles in ASS/SSA format are often including the names of the persons +or character for each subtitle line. The showspeaker filter adds those names +to the actual subtitle text to make it visible on playback. + +Inputs: +@itemize +@item 0: Subtitles[TEXT] +@end itemize + +Outputs: +@itemize +@item 0: Subtitles[TEXT] +@end itemize + +It accepts the following parameters: + +@table @option +@item format +The format for prepending speaker names. Default is 'square_brackets'. + +Supported operation modes are: + +@table @var +@item 0, square_brackets +Enclose the speaker name in square brackets, followed by space ('[speaker] text'). +@item 1, round_brackets +Enclose the speaker name in round brackets, followed by space ('(speaker) text'). +@item 2, colon +Separate the speaker name with a colon and space ('speaker: text'). +@item 3, plain +Separate the speaker name with a space only ('speaker text'). +@end table + +@item line_break +Set thÃs parameter to insert a line break between speaker name and text instead of the space character. + +@item style +Allows to set a specific style for the speaker name text. + +This can be either a named style that exists in the ass subtitle header script (e.g. 'Default') or an ass style override code. +Example: @{\\c&HDD0000&\\be1\\i1\\bord10@} +This sets the color to blue, enables edge blurring, italic font and a border of size 10. + +The behavior is as follows: + +- When the style parameter is not provided, the filter will find the first position in the event string that is actual text. + The speaker name will be inserted at this position. This allows to have the speaker name shown in the same style like the + regular text, in case the string would start with a sequence of style codes. +- When the style parameter is provided, everything will be prepended to the original text: + Style Code or Style name >> Speaker Name >> Style Reset Code >> Original Text + +@end table + +@subsection Examples + +@itemize +@item +Prepend speaker names with blue text, smooth edges and blend/overlay that onto the video. +@example +ffmpeg -i INPUT -filter_complex "showspeaker=format=colon:style='@{\\c&HDD0000&\\be1@}',[0:v]overlay_textsubs" +@end example +@end itemize + @section textsub2video Converts text subtitles to video frames. diff --git a/libavfilter/Makefile b/libavfilter/Makefile index a49369e7f5..d2995fbec6 100644 --- a/libavfilter/Makefile +++ b/libavfilter/Makefile @@ -553,6 +553,11 @@ OBJS-$(CONFIG_YUVTESTSRC_FILTER) += vsrc_testsrc.o OBJS-$(CONFIG_NULLSINK_FILTER) += vsink_nullsink.o +# subtitle filters +OBJS-$(CONFIG_CENSOR_FILTER) += sf_textmod.o +OBJS-$(CONFIG_SHOW_SPEAKER_FILTER) += sf_textmod.o +OBJS-$(CONFIG_TEXTMOD_FILTER) += sf_textmod.o + # multimedia filters OBJS-$(CONFIG_ABITSCOPE_FILTER) += avf_abitscope.o OBJS-$(CONFIG_ADRAWGRAPH_FILTER) += f_drawgraph.o diff --git a/libavfilter/allfilters.c b/libavfilter/allfilters.c index dca38cd57b..673f9fb839 100644 --- a/libavfilter/allfilters.c +++ b/libavfilter/allfilters.c @@ -544,6 +544,9 @@ extern const AVFilter ff_avf_showvolume; extern const AVFilter ff_avf_showwaves; extern const AVFilter ff_avf_showwavespic; extern const AVFilter ff_vaf_spectrumsynth; +extern const AVFilter ff_sf_censor; +extern const AVFilter ff_sf_showspeaker; +extern const AVFilter ff_sf_textmod; extern const AVFilter ff_svf_graphicsub2video; extern const AVFilter ff_svf_textsub2video; diff --git a/libavfilter/sf_textmod.c b/libavfilter/sf_textmod.c new file mode 100644 index 0000000000..d73f329b87 --- /dev/null +++ b/libavfilter/sf_textmod.c @@ -0,0 +1,697 @@ +/* + * Copyright (c) 2021 softworkz + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +/** + * @file + * text subtitle filter which allows to modify subtitle text in several ways + */ + +#include <libavutil/ass_internal.h> + +#include "libavutil/opt.h" +#include "internal.h" +#include "libavutil/ass_split_internal.h" +#include "libavutil/bprint.h" +#include "libavutil/file.h" + +static const char* leet_src = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; +static const char* leet_dst = "abcd3f6#1jklmn0pq257uvwxyzAB(D3F6#1JKLMN0PQ257UVWXYZ"; + +enum TextModFilterType { + TM_TEXTMOD, + TM_CENSOR, + TM_SHOW_SPEAKER, +}; + +enum TextModOperation { + OP_LEET, + OP_TO_UPPER, + OP_TO_LOWER, + OP_REPLACE_CHARS, + OP_REMOVE_CHARS, + OP_REPLACE_WORDS, + OP_REMOVE_WORDS, + NB_OPS, +}; + +enum CensorMode { + CM_KEEP_FIRST_LAST, + CM_KEEP_FIRST, + CM_ALL, +}; + +enum ShowSpeakerMode { + SM_SQUARE_BRACKETS, + SM_ROUND_BRACKETS, + SM_COLON, + SM_PLAIN, +}; + +typedef struct TextModContext { + const AVClass *class; + enum AVSubtitleType format; + enum TextModFilterType filter_type; + enum TextModOperation operation; + enum CensorMode censor_mode; + enum ShowSpeakerMode speaker_mode; + char *find; + char *find_file; + char *style; + char *replace; + char *replace_file; + char *separator; + char *censor_char; + char **find_list; + int line_break; + int nb_find_list; + char **replace_list; + int nb_replace_list; +} TextModContext; + +static char **split_string(char *source, int *nb_elems, const char *delim) +{ + char **list = NULL; + char *temp = NULL; + char *ptr = av_strtok(source, delim, &temp); + + while (ptr) { + if (strlen(ptr)) { + av_dynarray_add(&list, nb_elems, ptr); + if (!list) + return NULL; + } + + ptr = av_strtok(NULL, delim, &temp); + } + + if (!list) + return NULL; + + for (int i = 0; i < *nb_elems; i++) { + list[i] = av_strdup(list[i]); + if (!list[i]) { + for (int n = 0; n < i; n++) + av_free(list[n]); + av_free(list); + return NULL; + } + } + + return list; +} + +static int load_text_from_file(AVFilterContext *ctx, const char *file_name, char **text, char separator) +{ + int err; + uint8_t *textbuf; + char *tmp; + size_t textbuf_size; + int offset = 0; + + if ((err = av_file_map(file_name, &textbuf, &textbuf_size, 0, ctx)) < 0) { + av_log(ctx, AV_LOG_ERROR, "The text file '%s' could not be read or is empty\n", file_name); + return err; + } + + if (textbuf_size > 1 && + (textbuf[0] == 0xFF && textbuf[1] == 0xFE + || textbuf[0] == 0xFE && textbuf[1] == 0xFF)) { + av_log(ctx, AV_LOG_ERROR, "UTF text files are not supported. File: %s\n", file_name); + return AVERROR(EINVAL); + } + + if (textbuf_size > 2 && textbuf[0] == 0xEF && textbuf[1] == 0xBB && textbuf[2] == 0xBF) + offset = 3; // UTF-8 + + if (textbuf_size > SIZE_MAX - 1 || !((tmp = av_strndup((char *)textbuf + offset, textbuf_size - offset)))) { + av_file_unmap(textbuf, textbuf_size); + return AVERROR(ENOMEM); + } + + av_file_unmap(textbuf, textbuf_size); + + for (size_t i = 0; i < strlen(tmp); i++) { + switch (tmp[i]) { + case '\n': + case '\r': + case '\f': + case '\v': + tmp[i] = separator; + } + } + + *text = tmp; + + return 0; +} + +static int load_files(AVFilterContext *ctx) +{ + TextModContext *s = ctx->priv; + int ret; + + if (!s->separator || strlen(s->separator) != 1) { + av_log(ctx, AV_LOG_ERROR, "A single character needs to be specified for the separator parameter.\n"); + return AVERROR(EINVAL); + } + + if (s->find_file && strlen(s->find_file)) { + ret = load_text_from_file(ctx, s->find_file, &s->find, s->separator[0]); + if (ret < 0 ) + return ret; + } + + if (s->replace_file && strlen(s->replace_file)) { + ret = load_text_from_file(ctx, s->replace_file, &s->replace, s->separator[0]); + if (ret < 0 ) + return ret; + } + + return 0; +} + +static int init_censor(AVFilterContext *ctx) +{ + TextModContext *s = ctx->priv; + int ret; + + s->filter_type = TM_CENSOR; + s->operation = OP_REPLACE_WORDS; + + ret = load_files(ctx); + if (ret < 0 ) + return ret; + + if (!s->find || !strlen(s->find)) { + av_log(ctx, AV_LOG_ERROR, "Either the 'words' or the 'words_file' parameter needs to be specified\n"); + return AVERROR(EINVAL); + } + + if (!s->censor_char || strlen(s->censor_char) != 1) { + av_log(ctx, AV_LOG_ERROR, "A single character needs to be specified for the censor_char parameter\n"); + return AVERROR(EINVAL); + } + + s->find_list = split_string(s->find, &s->nb_find_list, s->separator); + if (!s->find_list) + return AVERROR(ENOMEM); + + s->replace_list = av_calloc(s->nb_find_list, sizeof(char *)); + if (!s->replace_list) + return AVERROR(ENOMEM); + + for (int i = 0; i < s->nb_find_list; i++) { + size_t len, start = 0, end; + char *item = av_strdup(s->find_list[i]); + if (!item) + return AVERROR(ENOMEM); + + len = end = strlen(item); + + switch (s->censor_mode) { + case CM_KEEP_FIRST_LAST: + + if (len > 2) + start = 1; + if (len > 3) + end--; + + break; + case CM_KEEP_FIRST: + + if (len > 2) + start = 1; + + break; + } + + for (size_t n = start; n < end; n++) + item[n] = s->censor_char[0]; + + s->replace_list[i] = item; + } + + return 0; +} + +static int init_showspeaker(AVFilterContext *ctx) +{ + TextModContext *s = ctx->priv; + s->filter_type = TM_SHOW_SPEAKER; + + return 0; +} + +static int init(AVFilterContext *ctx) +{ + TextModContext *s = ctx->priv; + int ret; + + ret = load_files(ctx); + if (ret < 0 ) + return ret; + + switch (s->operation) { + case OP_REPLACE_CHARS: + case OP_REMOVE_CHARS: + case OP_REPLACE_WORDS: + case OP_REMOVE_WORDS: + if (!s->find || !strlen(s->find)) { + av_log(ctx, AV_LOG_ERROR, "Selected mode requires the 'find' parameter to be specified\n"); + return AVERROR(EINVAL); + } + break; + } + + switch (s->operation) { + case OP_REPLACE_CHARS: + case OP_REPLACE_WORDS: + if (!s->replace || !strlen(s->replace)) { + av_log(ctx, AV_LOG_ERROR, "Selected mode requires the 'replace' parameter to be specified\n"); + return AVERROR(EINVAL); + } + break; + } + + if (s->operation == OP_REPLACE_CHARS && strlen(s->find) != strlen(s->replace)) { + av_log(ctx, AV_LOG_ERROR, "Selected mode requires the 'find' and 'replace' parameters to have the same length\n"); + return AVERROR(EINVAL); + } + + if (s->operation == OP_REPLACE_WORDS || s->operation == OP_REMOVE_WORDS) { + if (!s->separator || strlen(s->separator) != 1) { + av_log(ctx, AV_LOG_ERROR, "Selected mode requires a single separator char to be specified\n"); + return AVERROR(EINVAL); + } + + s->find_list = split_string(s->find, &s->nb_find_list, s->separator); + if (!s->find_list) + return AVERROR(ENOMEM); + + if (s->operation == OP_REPLACE_WORDS) { + + s->replace_list = split_string(s->replace, &s->nb_replace_list, s->separator); + if (!s->replace_list) + return AVERROR(ENOMEM); + + if (s->nb_find_list != s->nb_replace_list) { + av_log(ctx, AV_LOG_ERROR, "The number of words in 'find' and 'replace' needs to be equal\n"); + return AVERROR(EINVAL); + } + } + } + + return 0; +} + +static void uninit(AVFilterContext *ctx) +{ + TextModContext *s = ctx->priv; + + for (int i = 0; i < s->nb_find_list; i++) + av_freep(&s->find_list[i]); + + s->nb_find_list = 0; + av_freep(&s->find_list); + + for (int i = 0; i < s->nb_replace_list; i++) + av_freep(&s->replace_list[i]); + + s->nb_replace_list = 0; + av_freep(&s->replace_list); +} + +static char *process_text(TextModContext *s, char *text) +{ + const char *char_src = s->find; + const char *char_dst = s->replace; + char *result = NULL; + int escape_level = 0, k = 0; + + switch (s->operation) { + case OP_LEET: + case OP_REPLACE_CHARS: + + if (s->operation == OP_LEET) { + char_src = leet_src; + char_dst = leet_dst; + } + + result = av_strdup(text); + if (!result) + return NULL; + + for (size_t n = 0; n < strlen(result); n++) { + if (result[n] == '{') + escape_level++; + + if (!escape_level) { + size_t len = strlen(char_src); + for (size_t t = 0; t < len; t++) { + if (result[n] == char_src[t]) { + result[n] = char_dst[t]; + break; + } + } + } + + if (result[n] == '}') + escape_level--; + } + + break; + case OP_TO_UPPER: + case OP_TO_LOWER: + + result = av_strdup(text); + if (!result) + return NULL; + + for (size_t n = 0; n < strlen(result); n++) { + if (result[n] == '{') + escape_level++; + if (!escape_level) + result[n] = s->operation == OP_TO_LOWER ? av_tolower(result[n]) : av_toupper(result[n]); + if (result[n] == '}') + escape_level--; + } + + break; + case OP_REMOVE_CHARS: + + result = av_strdup(text); + if (!result) + return NULL; + + for (size_t n = 0; n < strlen(result); n++) { + int skip_char = 0; + + if (result[n] == '{') + escape_level++; + + if (!escape_level) { + size_t len = strlen(char_src); + for (size_t t = 0; t < len; t++) { + if (result[n] == char_src[t]) { + skip_char = 1; + break; + } + } + } + + if (!skip_char) + result[k++] = result[n]; + + if (result[n] == '}') + escape_level--; + } + + result[k] = 0; + + break; + case OP_REPLACE_WORDS: + case OP_REMOVE_WORDS: + + result = av_strdup(text); + if (!result) + return NULL; + + for (int n = 0; n < s->nb_find_list; n++) { + char *tmp = result; + const char *replace = (s->operation == OP_REPLACE_WORDS) ? s->replace_list[n] : ""; + + result = av_strireplace(result, s->find_list[n], replace); + if (!result) + return NULL; + + av_free(tmp); + } + + break; + } + + return result; +} + +static char *process_dialog_show_speaker(TextModContext *s, char *ass_line) +{ + ASSDialog *dialog = avpriv_ass_split_dialog(NULL, ass_line); + int escape_level = 0; + unsigned pos = 0, len; + char *result, *text; + AVBPrint pbuf; + + if (!dialog) + return NULL; + + text = process_text(s, dialog->text); + if (!text) + return NULL; + + if (!dialog->name || !strlen(dialog->name) || !dialog->text || !strlen(dialog->text)) + return av_strdup(ass_line); + + // Find insertion point in case the line starts with style codes + len = (unsigned)strlen(dialog->text); + for (unsigned i = 0; i < len; i++) { + + if (dialog->text[i] == '{') + escape_level++; + + if (dialog->text[i] == '}') + escape_level--; + + if (escape_level == 0) { + pos = i; + break; + } + } + + if (s->style && strlen(s->style)) + // When a style is specified reset the insertion point + // (always add speaker plus style at the start in that case) + pos = 0; + + if (pos >= len - 1) + return av_strdup(ass_line); + + av_bprint_init(&pbuf, 1, AV_BPRINT_SIZE_UNLIMITED); + + if (pos > 0) { + av_bprint_append_data(&pbuf, dialog->text, pos); + } + + if (s->style && strlen(s->style)) { + if (s->style[0] == '{') + // Assume complete and valid style code, e.g. {\c&HFF0000&} + av_bprintf(&pbuf, "%s", s->style); + else + // Otherwise it must be a style name + av_bprintf(&pbuf, "{\\r%s}", s->style); + } + + switch (s->speaker_mode) { + case SM_SQUARE_BRACKETS: + av_bprintf(&pbuf, "[%s]", dialog->name); + break; + case SM_ROUND_BRACKETS: + av_bprintf(&pbuf, "(%s)", dialog->name); + break; + case SM_COLON: + av_bprintf(&pbuf, "%s:", dialog->name); + break; + case SM_PLAIN: + av_bprintf(&pbuf, "%s", dialog->name); + break; + } + + if (s->style && strlen(s->style)) { + // Reset line style + if (dialog->style && strlen(dialog->style) && !av_strcasecmp(dialog->style, "default")) + av_bprintf(&pbuf, "{\\r%s}", dialog->style); + else + av_bprintf(&pbuf, "{\\r}"); + } + + if (s->line_break) + av_bprintf(&pbuf, "\\N"); + else + av_bprintf(&pbuf, " "); + + av_bprint_append_data(&pbuf, dialog->text + pos, len - pos); + + av_bprint_finalize(&pbuf, &text); + + result = avpriv_ass_get_dialog(dialog->readorder, dialog->layer, dialog->style, dialog->name, text); + + av_free(text); + avpriv_ass_free_dialog(&dialog); + return result; +} + +static char *process_dialog(TextModContext *s, char *ass_line) +{ + ASSDialog *dialog; + char *result, *text; + + if (s->filter_type == TM_SHOW_SPEAKER) + return process_dialog_show_speaker(s, ass_line); + + dialog = avpriv_ass_split_dialog(NULL, ass_line); + if (!dialog) + return NULL; + + text = process_text(s, dialog->text); + if (!text) + return NULL; + + result = avpriv_ass_get_dialog(dialog->readorder, dialog->layer, dialog->style, dialog->name, text); + + av_free(text); + avpriv_ass_free_dialog(&dialog); + return result; +} + +static int filter_frame(AVFilterLink *inlink, AVFrame *frame) +{ + TextModContext *s = inlink->dst->priv; + AVFilterLink *outlink = inlink->dst->outputs[0]; + int ret; + + outlink->format = inlink->format; + + ret = av_frame_make_writable(frame); + if (ret < 0) + return ret; + + for (unsigned i = 0; i < frame->num_subtitle_areas; i++) { + + AVSubtitleArea *area = frame->subtitle_areas[i]; + + if (area->ass) { + char *tmp = area->ass; + area->ass = process_dialog(s, area->ass); + av_free(tmp); + if (!area->ass) + return AVERROR(ENOMEM); + } + } + + return ff_filter_frame(outlink, frame); +} + +#define OFFSET(x) offsetof(TextModContext, x) +#define FLAGS (AV_OPT_FLAG_SUBTITLE_PARAM | AV_OPT_FLAG_FILTERING_PARAM) + +static const AVOption textmod_options[] = { + { "mode", "set operation mode", OFFSET(operation), AV_OPT_TYPE_INT, {.i64=OP_LEET}, OP_LEET, NB_OPS-1, FLAGS, "mode" }, + { "leet", "convert text to 'leet speak'", 0, AV_OPT_TYPE_CONST, {.i64=OP_LEET}, 0, 0, FLAGS, "mode" }, + { "to_upper", "change to upper case", 0, AV_OPT_TYPE_CONST, {.i64=OP_TO_UPPER}, 0, 0, FLAGS, "mode" }, + { "to_lower", "change to lower case", 0, AV_OPT_TYPE_CONST, {.i64=OP_TO_LOWER}, 0, 0, FLAGS, "mode" }, + { "replace_chars", "replace characters", 0, AV_OPT_TYPE_CONST, {.i64=OP_REPLACE_CHARS}, 0, 0, FLAGS, "mode" }, + { "remove_chars", "remove characters", 0, AV_OPT_TYPE_CONST, {.i64=OP_REMOVE_CHARS}, 0, 0, FLAGS, "mode" }, + { "replace_words", "replace words", 0, AV_OPT_TYPE_CONST, {.i64=OP_REPLACE_WORDS}, 0, 0, FLAGS, "mode" }, + { "remove_words", "remove words", 0, AV_OPT_TYPE_CONST, {.i64=OP_REMOVE_WORDS}, 0, 0, FLAGS, "mode" }, + { "find", "chars/words to find or remove", OFFSET(find), AV_OPT_TYPE_STRING, {.str = NULL}, 0, 0, FLAGS, NULL }, + { "find_file", "load find param from file", OFFSET(find_file), AV_OPT_TYPE_STRING, {.str = NULL}, 0, 0, FLAGS, NULL }, + { "replace", "chars/words to replace", OFFSET(replace), AV_OPT_TYPE_STRING, {.str = NULL}, 0, 0, FLAGS, NULL }, + { "replace_file", "load replace param from file", OFFSET(replace_file), AV_OPT_TYPE_STRING, {.str = NULL}, 0, 0, FLAGS, NULL }, + { "separator", "word separator", OFFSET(separator), AV_OPT_TYPE_STRING, {.str = ","}, 0, 0, FLAGS, NULL }, + { NULL }, +}; + + +static const AVOption censor_options[] = { + { "mode", "set censoring mode", OFFSET(censor_mode), AV_OPT_TYPE_INT, {.i64=CM_KEEP_FIRST_LAST}, 0, 2, FLAGS, "mode" }, + { "keep_first_last", "censor inner chars", 0, AV_OPT_TYPE_CONST, {.i64=CM_KEEP_FIRST_LAST}, 0, 0, FLAGS, "mode" }, + { "keep_first", "censor all but first char", 0, AV_OPT_TYPE_CONST, {.i64=CM_KEEP_FIRST}, 0, 0, FLAGS, "mode" }, + { "all", "censor all chars", 0, AV_OPT_TYPE_CONST, {.i64=CM_ALL}, 0, 0, FLAGS, "mode" }, + { "words", "list of words to censor", OFFSET(find), AV_OPT_TYPE_STRING, {.str = NULL}, 0, 0, FLAGS, NULL }, + { "words_file", "path to word list file", OFFSET(find_file), AV_OPT_TYPE_STRING, {.str = NULL}, 0, 0, FLAGS, NULL }, + { "separator", "word separator", OFFSET(separator), AV_OPT_TYPE_STRING, {.str = ","}, 0, 0, FLAGS, NULL }, + { "censor_char", "replacement character", OFFSET(censor_char), AV_OPT_TYPE_STRING, {.str = "*"}, 0, 0, FLAGS, NULL }, + { NULL }, +}; + +static const AVOption showspeaker_options[] = { + { "format", "speaker name formatting", OFFSET(speaker_mode), AV_OPT_TYPE_INT, {.i64=SM_SQUARE_BRACKETS}, 0, 2, FLAGS, "format" }, + { "square_brackets", "[speaker] text", 0, AV_OPT_TYPE_CONST, {.i64=SM_SQUARE_BRACKETS}, 0, 0, FLAGS, "format" }, + { "round_brackets", "(speaker) text", 0, AV_OPT_TYPE_CONST, {.i64=SM_ROUND_BRACKETS}, 0, 0, FLAGS, "format" }, + { "colon", "speaker: text", 0, AV_OPT_TYPE_CONST, {.i64=SM_COLON}, 0, 0, FLAGS, "format" }, + { "plain", "speaker text", 0, AV_OPT_TYPE_CONST, {.i64=SM_PLAIN}, 0, 0, FLAGS, "format" }, + { "line_break", "insert line break", OFFSET(line_break), AV_OPT_TYPE_BOOL, {.i64=0}, 0, 1, FLAGS, NULL }, + { "style", "ass type name or style code", OFFSET(style), AV_OPT_TYPE_STRING, {.str = NULL}, 0, 0, FLAGS, NULL }, + { NULL }, +}; + +AVFILTER_DEFINE_CLASS(textmod); +AVFILTER_DEFINE_CLASS(censor); +AVFILTER_DEFINE_CLASS(showspeaker); + +static const AVFilterPad inputs[] = { + { + .name = "default", + .type = AVMEDIA_TYPE_SUBTITLE, + .filter_frame = filter_frame, + }, +}; + +static const AVFilterPad outputs[] = { + { + .name = "default", + .type = AVMEDIA_TYPE_SUBTITLE, + }, +}; + +const AVFilter ff_sf_textmod = { + .name = "textmod", + .description = NULL_IF_CONFIG_SMALL("Modify subtitle text in several ways"), + .init = init, + .uninit = uninit, + .priv_size = sizeof(TextModContext), + .priv_class = &textmod_class, + FILTER_INPUTS(inputs), + FILTER_OUTPUTS(outputs), + FILTER_SINGLE_SUBFMT(AV_SUBTITLE_FMT_ASS), +}; + +const AVFilter ff_sf_censor = { + .name = "censor", + .description = NULL_IF_CONFIG_SMALL("Censor words in subtitle text"), + .init = init_censor, + .uninit = uninit, + .priv_size = sizeof(TextModContext), + .priv_class = &censor_class, + FILTER_INPUTS(inputs), + FILTER_OUTPUTS(outputs), + FILTER_SINGLE_SUBFMT(AV_SUBTITLE_FMT_ASS), +}; + +const AVFilter ff_sf_showspeaker = { + .name = "showspeaker", + .description = NULL_IF_CONFIG_SMALL("Prepend speaker names to text subtitles (when available)"), + .init = init_showspeaker, + .uninit = uninit, + .priv_size = sizeof(TextModContext), + .priv_class = &showspeaker_class, + FILTER_INPUTS(inputs), + FILTER_OUTPUTS(outputs), + FILTER_SINGLE_SUBFMT(AV_SUBTITLE_FMT_ASS), +};
- textmod {S -> S) Modify subtitle text in a number of ways - censor {S -> S) Censor subtitles using a word list - show_speaker {S -> S) Prepend speaker names from ASS subtitles to the visible text lines Signed-off-by: softworkz <softworkz@hotmail.com> --- doc/filters.texi | 206 ++++++++++++ libavfilter/Makefile | 5 + libavfilter/allfilters.c | 3 + libavfilter/sf_textmod.c | 697 +++++++++++++++++++++++++++++++++++++++ 4 files changed, 911 insertions(+) create mode 100644 libavfilter/sf_textmod.c