Re: [FFmpeg-devel] [PATCH v3 2/5] ffbuild/libversion.sh: add shebang

2024-04-09 Thread Marth64
Regardless -- it can be left as is . I digress from the topic.

Thank you,
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [PATCH v3 2/5] ffbuild/libversion.sh: add shebang

2024-04-09 Thread Marth64
> so that seems like a terrible idea that would achieve
> the opposite result.

I respectfully disagree.

Neither approach is universal or POSIX specified.
So while I agree it can be left as-is since only
a basic Bourne shell is needed, I would not just
dismiss it/write it off as a terrible idea.

There are reasons why #!/usr/bin/env is colloquially preferred
to launch an interpreter in most shell script cases.
For example, there are systems where /bin/sh is NOT
a POSIX compliant shell. Alternatively, what if I have a different
or compliant `sh` in my PATH, but not necessarily in /bin?
This is not a scenario I made up, one can quickly research to see.

I will not bikeshed the topic further, we can go either way,
but I don't think it qualifies as a "terrible idea".
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [PATCH v3 2/5] ffbuild/libversion.sh: add shebang

2024-04-09 Thread Marth64
> +#!/bin/sh
Might I suggest `#!/usr/bin/env sh` instead for this case?
I tend to prefer it from a portability and usability perspective,
but I can imagine for sh it might not matter.

I am not close to the patch that you are working on.
But thought to throw this out there in case there is a
platform or user relying on unique behaviour here.

Thank you for your time,
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [PATCH v4 2/4] avcodec/{ass, webvttdec}: fix handling of backslashes

2024-04-04 Thread Marth64
>  Is \N a special sequence in ASS-speak
\N is the special line break sequence in ASS

I’m not sure of other special sequences following the \ character, I yield
to Oneric on this question.

Best,
Marth64
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [PATCH v4 2/4] avcodec/{ass, webvttdec}: fix handling of backslashes

2024-04-04 Thread Marth64
> I'm confused by this, what kind of \N
> sequences might appear in an ASS file?
> Can you show an offending sequence?

Good day Stefano,

The one I tested with was something like :
Jim\Nancy

I made this up while testing. But I have seen similar in real world
scenarios particularly in ASS files originating from subtitles that are
“summarized”. In legacy content this is common, to fit content in a 4:3
screen the subtitle writer would shorten or abbreviate what is spoken on
the screen and slashes are a replacement for “and”.

Hope this helps.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [PATCH] Changelog: fix typos for 7.0 section

2024-04-04 Thread Marth64
Works for me. Looks great now. Thank you!
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH] Changelog: fix typos for 7.0 section

2024-04-04 Thread Marth64
If it's not too late, I thought these fixes would make
the section look nicer for this big release.

---
 Changelog | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/Changelog b/Changelog
index a65c8ceee5..7ed638514b 100644
--- a/Changelog
+++ b/Changelog
@@ -40,17 +40,17 @@ version 7.0:
 - ffmpeg CLI loopback decoders
 - Support PacketTypeMetadata of PacketType in enhanced flv format
 - ffplay with hwaccel decoding support (depends on vulkan renderer via 
libplacebo)
-- dnn filter libtorch backend
+- dnn filter now has libtorch backend
 - Android content URIs protocol
 - AOMedia Film Grain Synthesis 1 (AFGS1)
-- RISC-V optimizations for AAC, FLAC, JPEG-2000,LPC, RV4.0, SVQ, VC1, VP8 and 
more
+- RISC-V optimizations for AAC, FLAC, JPEG-2000, LPC, RV4.0, SVQ, VC1, VP8, 
and more
 - Loongarch optimizations for HEVC decoding
 - Important AArch64 optimizations for HEVC
 - IAMF support inside MP4/ISOBMFF
 - Support for HEIF/AVIF still images and tiled still images
 - Dolby Vision profile 10 support in AV1
 - Support for Ambient Viewing Environment metadata in MP4/ISOBMFF
-- HDR10 metadata passthrough when encoding with libx264, libx265 and libsvtav1
+- HDR10 metadata passthrough when encoding with libx264, libx265, and libsvtav1
 
 
 version 6.1:
-- 
2.34.1

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [PATCH v11 0/6] RCWT Closed Captions demuxer (v11)

2024-04-02 Thread Marth64
Thank you Stefano & all who helped facilitate this through.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] 7.0 Name

2024-04-02 Thread Marth64
Djikstra is nice
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH v11 6/6] doc/indevs: update CC extraction example to use RCWT muxer

2024-04-01 Thread Marth64
Signed-off-by: Marth64 
---
 doc/indevs.texi | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/doc/indevs.texi b/doc/indevs.texi
index d1b2bacf8b..734fc65752 100644
--- a/doc/indevs.texi
+++ b/doc/indevs.texi
@@ -1069,9 +1069,9 @@ ffplay -f lavfi 
"movie=test.avi[out0];amovie=test.wav[out1]"
 @end example
 
 @item
-Dump decoded frames to images and closed captions to a file (experimental):
+Dump decoded frames to images and Closed Captions to an RCWT backup:
 @example
-ffmpeg -f lavfi -i "movie=test.ts[out0+subcc]" -map v frame%08d.png -map s -c 
copy -f rawvideo subcc.bin
+ffmpeg -f lavfi -i "movie=test.ts[out0+subcc]" -map v frame%08d.png -map s -c 
copy -f rcwt subcc.bin
 @end example
 
 @end itemize
-- 
2.34.1

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH v11 5/6] doc/muxers: refresh the RCWT muxer's doc to be consistent with the demuxer

2024-04-01 Thread Marth64
Signed-off-by: Marth64 
---
 doc/muxers.texi | 29 +++--
 1 file changed, 19 insertions(+), 10 deletions(-)

diff --git a/doc/muxers.texi b/doc/muxers.texi
index a10a8e216f..c960af1bdc 100644
--- a/doc/muxers.texi
+++ b/doc/muxers.texi
@@ -3038,19 +3038,18 @@ ogg files can be safely chained.
 
 @end table
 
-@anchor{rcwt}
+@anchor{rcwtenc}
 @section rcwt
 
-Raw Captions With Time (RCWT) is a format native to ccextractor, a commonly
-used open source tool for processing 608/708 closed caption (CC) sources.
-It can be used to archive the original, raw CC bitstream and to produce
-a source file for later CC processing or conversion. As a result,
-it also allows for interopability with ccextractor for processing CC data
-extracted via ffmpeg. The format is simple to parse and can be used
-to retain all lines and variants of CC.
+RCWT (Raw Captions With Time) is a format native to ccextractor, a commonly
+used open source tool for processing 608/708 Closed Captions (CC) sources.
+It can be used to archive the original extracted CC bitstream and to produce
+a source file for later processing or conversion. The format allows
+for interoperability between ccextractor and FFmpeg, is simple to parse,
+and can be used to create a backup of the CC presentation.
 
-This muxer implements the specification as of 2024-01-05, which has
-been stable and unchanged for 10 years as of this writing.
+This muxer implements the specification as of March 2024, which has
+been stable and unchanged since April 2014.
 
 This muxer will have some nuances from the way that ccextractor muxes RCWT.
 No compatibility issues when processing the output with ccextractor
@@ -3060,6 +3059,16 @@ and outputs will not be a bit-exact match.
 A free specification of RCWT can be found here:
 
@url{https://github.com/CCExtractor/ccextractor/blob/master/docs/BINARY_FILE_FORMAT.TXT}
 
+@subsection Examples
+
+@itemize
+@item
+Extract Closed Captions to RCWT using lavfi:
+@example
+ffmpeg -f lavfi -i "movie=INPUT.mkv[out+subcc]" -map 0:s:0 -c:s copy -f rcwt 
CC.rcwt.bin
+@end example
+@end itemize
+
 @anchor{segment}
 @section segment, stream_segment, ssegment
 
-- 
2.34.1

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH v11 4/6] avformat/rcwtenc: remove repeated documentation

2024-04-01 Thread Marth64
The high level summary of RCWT can be delegated doc/muxers, which
makes it easier to maintain and more consistent with the documentation
of the demuxer.

Signed-off-by: Marth64 
---
 libavformat/rcwtenc.c | 5 -
 1 file changed, 5 deletions(-)

diff --git a/libavformat/rcwtenc.c b/libavformat/rcwtenc.c
index ed613d45f5..270154b701 100644
--- a/libavformat/rcwtenc.c
+++ b/libavformat/rcwtenc.c
@@ -21,11 +21,6 @@
 /*
  * RCWT (Raw Captions With Time) is a format native to ccextractor, a commonly
  * used open source tool for processing 608/708 Closed Captions (CC) sources.
- * It can be used to archive the original, raw CC bitstream and to produce
- * a source file for later CC processing or conversion. As a result,
- * it also allows for interopability with ccextractor for processing CC data
- * extracted via ffmpeg. The format is simple to parse and can be used
- * to retain all lines and variants of CC.
  *
  * This muxer implements the specification as of March 2024, which has
  * been stable and unchanged since April 2014.
-- 
2.34.1

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH v11 3/6] avformat/rcwtenc: don't assume .bin extension

2024-04-01 Thread Marth64
Signed-off-by: Marth64 
---
 libavformat/rcwtenc.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/libavformat/rcwtenc.c b/libavformat/rcwtenc.c
index f2459ef1d3..ed613d45f5 100644
--- a/libavformat/rcwtenc.c
+++ b/libavformat/rcwtenc.c
@@ -159,7 +159,6 @@ static int rcwt_write_trailer(AVFormatContext *avf)
 const FFOutputFormat ff_rcwt_muxer = {
 .p.name = "rcwt",
 .p.long_name= NULL_IF_CONFIG_SMALL("RCWT (Raw Captions With 
Time)"),
-.p.extensions   = "bin",
 .p.flags= AVFMT_GLOBALHEADER | AVFMT_VARIABLE_FPS | 
AVFMT_TS_NONSTRICT,
 .p.video_codec  = AV_CODEC_ID_NONE,
 .p.audio_codec  = AV_CODEC_ID_NONE,
-- 
2.34.1

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH v11 2/6] avformat/rcwtdec: add RCWT Closed Captions demuxer

2024-04-01 Thread Marth64
RCWT (Raw Captions With Time) is a format native to ccextractor,
a commonly used OSS tool for processing 608/708 Closed Captions (CC).
RCWT can be used to archive the original extracted CC bitstream.
The muxer was added in January 2024. In this commit, add the demuxer.

One can now demux RCWT files for rendering in ccaption_dec or interop
with ccextractor (which produces RCWT). Using the muxer/demuxer combo,
the CC bits can be kept for processing or rendering with either tool.
This can be an effective way to backup an original CC stream, including
format extensions like EIA-708 and overall original presentation.

Signed-off-by: Marth64 
---
 doc/demuxers.texi|  30 ++
 libavformat/Makefile |   1 +
 libavformat/allformats.c |   1 +
 libavformat/rcwtdec.c| 122 +++
 4 files changed, 154 insertions(+)
 create mode 100644 libavformat/rcwtdec.c

diff --git a/doc/demuxers.texi b/doc/demuxers.texi
index b70f3a38d7..04293c4813 100644
--- a/doc/demuxers.texi
+++ b/doc/demuxers.texi
@@ -1038,6 +1038,36 @@ the command:
 ffplay -f rawvideo -pixel_format rgb24 -video_size 320x240 -framerate 10 
input.raw
 @end example
 
+@anchor{rcwtdec}
+@section rcwt
+
+RCWT (Raw Captions With Time) is a format native to ccextractor, a commonly
+used open source tool for processing 608/708 Closed Captions (CC) sources.
+For more information on the format, see @ref{rcwtenc,,,ffmpeg-formats}.
+
+This demuxer implements the specification as of March 2024, which has
+been stable and unchanged since April 2014.
+
+@subsection Examples
+
+@itemize
+@item
+Render CC to ASS using the built-in decoder:
+@example
+ffmpeg -i CC.rcwt.bin CC.ass
+@end example
+Note that if your output appears to be empty, you may have to manually
+set the decoder's @option{data_field} option to pick the desired CC substream.
+
+@item
+Convert an RCWT backup to Scenarist (SCC) format:
+@example
+ffmpeg -i CC.rcwt.bin -c:s copy CC.scc
+@end example
+Note that the SCC format does not support all of the possible CC extensions
+that can be stored in RCWT (such as EIA-708).
+@end itemize
+
 @section sbg
 
 SBaGen script demuxer.
diff --git a/libavformat/Makefile b/libavformat/Makefile
index 44aa485029..5d77cba7f1 100644
--- a/libavformat/Makefile
+++ b/libavformat/Makefile
@@ -493,6 +493,7 @@ OBJS-$(CONFIG_QOA_DEMUXER)   += qoadec.o
 OBJS-$(CONFIG_R3D_DEMUXER)   += r3d.o
 OBJS-$(CONFIG_RAWVIDEO_DEMUXER)  += rawvideodec.o
 OBJS-$(CONFIG_RAWVIDEO_MUXER)+= rawenc.o
+OBJS-$(CONFIG_RCWT_DEMUXER)  += rcwtdec.o subtitles.o
 OBJS-$(CONFIG_RCWT_MUXER)+= rcwtenc.o subtitles.o
 OBJS-$(CONFIG_REALTEXT_DEMUXER)  += realtextdec.o subtitles.o
 OBJS-$(CONFIG_REDSPARK_DEMUXER)  += redspark.o
diff --git a/libavformat/allformats.c b/libavformat/allformats.c
index 9df42bb87a..ae925dcf60 100644
--- a/libavformat/allformats.c
+++ b/libavformat/allformats.c
@@ -391,6 +391,7 @@ extern const FFInputFormat  ff_qoa_demuxer;
 extern const FFInputFormat  ff_r3d_demuxer;
 extern const FFInputFormat  ff_rawvideo_demuxer;
 extern const FFOutputFormat ff_rawvideo_muxer;
+extern const FFInputFormat  ff_rcwt_demuxer;
 extern const FFOutputFormat ff_rcwt_muxer;
 extern const FFInputFormat  ff_realtext_demuxer;
 extern const FFInputFormat  ff_redspark_demuxer;
diff --git a/libavformat/rcwtdec.c b/libavformat/rcwtdec.c
new file mode 100644
index 00..f6a007cbdb
--- /dev/null
+++ b/libavformat/rcwtdec.c
@@ -0,0 +1,122 @@
+/*
+ * RCWT (Raw Captions With Time) demuxer
+ *
+ * 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
+ */
+
+/*
+ * RCWT (Raw Captions With Time) is a format native to ccextractor, a commonly
+ * used open source tool for processing 608/708 Closed Captions (CC) sources.
+ *
+ * This demuxer implements the specification as of March 2024, which has
+ * been stable and unchanged since April 2014.
+ *
+ * A free specification of RCWT can be found here:
+ * 
@url{https://github.com/CCExtractor/ccextractor/blob/master/docs/BINARY_FILE_FORMAT.TXT}
+ */
+
+#include "avformat.h"
+#include "demux.h"
+#include "internal.h"
+#include "subtitles.h"
+#include "libavutil/intreadwrite.h"
+
+#define

[FFmpeg-devel] [PATCH v11 1/6] avformat/subtitles: extend ff_subtitles_queue_insert() to support not yet available events

2024-04-01 Thread Marth64
If ff_subtitles_queue_insert() were given a NULL buffer
with 0 length, it would still attempt to grow the packet
or memcpy depending on if merge option is enabled.

In this commit, allow passing a NULL buffer with 0 length
without attempting to do such operations. This way, if a
subtitle demuxer happens to pass an empty cue or wants to
use av_get_packet() to read bytes, there are no unnecessary
operations on the packet after it is allocated.

Signed-off-by: Marth64 
---
 libavformat/subtitles.c | 23 +++
 libavformat/subtitles.h |  2 +-
 2 files changed, 16 insertions(+), 9 deletions(-)

diff --git a/libavformat/subtitles.c b/libavformat/subtitles.c
index d7723c497f..69e4df88a3 100644
--- a/libavformat/subtitles.c
+++ b/libavformat/subtitles.c
@@ -21,6 +21,7 @@
 #include "avformat.h"
 #include "subtitles.h"
 #include "avio_internal.h"
+#include "libavutil/avassert.h"
 #include "libavutil/avstring.h"
 #include "libavutil/mem.h"
 
@@ -112,15 +113,19 @@ AVPacket *ff_subtitles_queue_insert(FFDemuxSubtitlesQueue 
*q,
 {
 AVPacket **subs, *sub;
 
+av_assert1(event || len == 0);
+
 if (merge && q->nb_subs > 0) {
 /* merge with previous event */
 
 int old_len;
 sub = q->subs[q->nb_subs - 1];
 old_len = sub->size;
-if (av_grow_packet(sub, len) < 0)
-return NULL;
-memcpy(sub->data + old_len, event, len);
+if (event) {
+if (av_grow_packet(sub, len) < 0)
+return NULL;
+memcpy(sub->data + old_len, event, len);
+}
 } else {
 /* new event */
 
@@ -134,14 +139,16 @@ AVPacket *ff_subtitles_queue_insert(FFDemuxSubtitlesQueue 
*q,
 sub = av_packet_alloc();
 if (!sub)
 return NULL;
-if (av_new_packet(sub, len) < 0) {
-av_packet_free();
-return NULL;
+if (event) {
+if (av_new_packet(sub, len) < 0) {
+av_packet_free();
+return NULL;
+}
+memcpy(sub->data, event, len);
 }
-subs[q->nb_subs++] = sub;
 sub->flags |= AV_PKT_FLAG_KEY;
 sub->pts = sub->dts = 0;
-memcpy(sub->data, event, len);
+subs[q->nb_subs++] = sub;
 }
 return sub;
 }
diff --git a/libavformat/subtitles.h b/libavformat/subtitles.h
index 88665663c5..ad6b96ca6a 100644
--- a/libavformat/subtitles.h
+++ b/libavformat/subtitles.h
@@ -112,7 +112,7 @@ typedef struct {
 /**
  * Insert a new subtitle event.
  *
- * @param event the subtitle line, may not be zero terminated
+ * @param event the subtitle line (not zero terminated) or NULL on not yet 
available event
  * @param len   the length of the event (in strlen() sense, so without '\0')
  * @param merge set to 1 if the current event should be concatenated with the
  *  previous one instead of adding a new entry, 0 otherwise
-- 
2.34.1

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH v11 0/6] RCWT Closed Captions demuxer (v11)

2024-04-01 Thread Marth64
Since v9:
* Removes .bin extension association in demuxer and muxer
* Updates examples in documentation

Signed-off-by: Marth64 
-- 
2.34.1

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [PATCH v10 2/5] avformat/rcwtdec: add RCWT Closed Captions demuxer

2024-04-01 Thread Marth64
Sorry for the delay, v11 coming shortly with the fix.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [PATCH v10 2/5] avformat/rcwtdec: add RCWT Closed Captions demuxer

2024-03-30 Thread Marth64
> i think the entry for extensions should be removed (which fixes this)
> having a ".bin" is not a strong indication that its rcwt

> Is this blocking or can it be addressed later? Also, if this needs to
> be modified the muxer should be as well.

I can address both today in a new set. .bin is pretty generic
(although it is what ccextractor uses), so I get it. Thanks.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [PATCH v10 2/5] avformat/rcwtdec: add RCWT Closed Captions demuxer

2024-03-29 Thread Marth64
Tomas Härdin :
> once I get my srtdec patchset through there will
> be something to follow.
I see the patch now. I agree, this looks like a good step. Thank you!

> Nah it can be done at a later point as an enhancement if you prefer
Yes, please. I am happy to do it, but I think will be
smoother to do after an example is there (since it introduces
a new pattern for subtitles). Thank you for understanding.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [PATCH v10 2/5] avformat/rcwtdec: add RCWT Closed Captions demuxer

2024-03-29 Thread Marth64
Tomas Härdin:
> Can we please get away from this way of reading subtitles? Every other
> type of media (audio, video) are capable of being streamed, but not
> subtitles, precisely because all of them do all parsing in the
> read_header() call. We have a perfectly good generic index and seeking
> functionality. My recent experiment with srt shows it's possible to
> read packets in read_packet() like every other demuxer..

Is there an example I can follow?  Is this something that can be fixed
in an enhancement patch or is it a deal-breaker to merge this?
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH v10 5/5] doc/indevs: update CC extraction example to use RCWT muxer

2024-03-28 Thread Marth64
Signed-off-by: Marth64 
---
 doc/indevs.texi | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/doc/indevs.texi b/doc/indevs.texi
index d1b2bacf8b..fc14737181 100644
--- a/doc/indevs.texi
+++ b/doc/indevs.texi
@@ -1069,9 +1069,9 @@ ffplay -f lavfi 
"movie=test.avi[out0];amovie=test.wav[out1]"
 @end example
 
 @item
-Dump decoded frames to images and closed captions to a file (experimental):
+Dump decoded frames to images and Closed Captions to an RCWT backup:
 @example
-ffmpeg -f lavfi -i "movie=test.ts[out0+subcc]" -map v frame%08d.png -map s -c 
copy -f rawvideo subcc.bin
+ffmpeg -f lavfi -i "movie=test.ts[out0+subcc]" -map v frame%08d.png -map s -c 
copy subcc.bin
 @end example
 
 @end itemize
-- 
2.34.1

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH v10 4/5] doc/muxers: refresh the RCWT muxer's doc to be consistent with the demuxer

2024-03-28 Thread Marth64
Signed-off-by: Marth64 
---
 doc/muxers.texi | 29 +++--
 1 file changed, 19 insertions(+), 10 deletions(-)

diff --git a/doc/muxers.texi b/doc/muxers.texi
index a10a8e216f..4161401059 100644
--- a/doc/muxers.texi
+++ b/doc/muxers.texi
@@ -3038,19 +3038,18 @@ ogg files can be safely chained.
 
 @end table
 
-@anchor{rcwt}
+@anchor{rcwtenc}
 @section rcwt
 
-Raw Captions With Time (RCWT) is a format native to ccextractor, a commonly
-used open source tool for processing 608/708 closed caption (CC) sources.
-It can be used to archive the original, raw CC bitstream and to produce
-a source file for later CC processing or conversion. As a result,
-it also allows for interopability with ccextractor for processing CC data
-extracted via ffmpeg. The format is simple to parse and can be used
-to retain all lines and variants of CC.
+RCWT (Raw Captions With Time) is a format native to ccextractor, a commonly
+used open source tool for processing 608/708 Closed Captions (CC) sources.
+It can be used to archive the original extracted CC bitstream and to produce
+a source file for later processing or conversion. The format allows
+for interoperability between ccextractor and FFmpeg, is simple to parse,
+and can be used to create a backup of the CC presentation.
 
-This muxer implements the specification as of 2024-01-05, which has
-been stable and unchanged for 10 years as of this writing.
+This muxer implements the specification as of March 2024, which has
+been stable and unchanged since April 2014.
 
 This muxer will have some nuances from the way that ccextractor muxes RCWT.
 No compatibility issues when processing the output with ccextractor
@@ -3060,6 +3059,16 @@ and outputs will not be a bit-exact match.
 A free specification of RCWT can be found here:
 
@url{https://github.com/CCExtractor/ccextractor/blob/master/docs/BINARY_FILE_FORMAT.TXT}
 
+@subsection Examples
+
+@itemize
+@item
+Extract Closed Captions to RCWT using lavfi:
+@example
+ffmpeg -f lavfi -i "movie=INPUT.mkv[out+subcc]" -map 0:s:0 -c:s copy 
CC.rcwt.bin
+@end example
+@end itemize
+
 @anchor{segment}
 @section segment, stream_segment, ssegment
 
-- 
2.34.1

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH v10 3/5] avformat/rcwtenc: remove repeated documentation

2024-03-28 Thread Marth64
The high level summary of RCWT can be delegated doc/muxers, which
makes it easier to maintain and more consistent with the documentation
of the demuxer.

Signed-off-by: Marth64 
---
 libavformat/rcwtenc.c | 5 -
 1 file changed, 5 deletions(-)

diff --git a/libavformat/rcwtenc.c b/libavformat/rcwtenc.c
index f2459ef1d3..e06bc4b734 100644
--- a/libavformat/rcwtenc.c
+++ b/libavformat/rcwtenc.c
@@ -21,11 +21,6 @@
 /*
  * RCWT (Raw Captions With Time) is a format native to ccextractor, a commonly
  * used open source tool for processing 608/708 Closed Captions (CC) sources.
- * It can be used to archive the original, raw CC bitstream and to produce
- * a source file for later CC processing or conversion. As a result,
- * it also allows for interopability with ccextractor for processing CC data
- * extracted via ffmpeg. The format is simple to parse and can be used
- * to retain all lines and variants of CC.
  *
  * This muxer implements the specification as of March 2024, which has
  * been stable and unchanged since April 2014.
-- 
2.34.1

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH v10 2/5] avformat/rcwtdec: add RCWT Closed Captions demuxer

2024-03-28 Thread Marth64
RCWT (Raw Captions With Time) is a format native to ccextractor,
a commonly used OSS tool for processing 608/708 Closed Captions (CC).
RCWT can be used to archive the original extracted CC bitstream.
The muxer was added in January 2024. In this commit, add the demuxer.

One can now demux RCWT files for rendering in ccaption_dec or interop
with ccextractor (which produces RCWT). Using the muxer/demuxer combo,
the CC bits can be kept for processing or rendering with either tool.
This can be an effective way to backup an original CC stream, including
format extensions like EIA-708 and overall original presentation.

Signed-off-by: Marth64 
---
 doc/demuxers.texi|  30 ++
 libavformat/Makefile |   1 +
 libavformat/allformats.c |   1 +
 libavformat/rcwtdec.c| 123 +++
 4 files changed, 155 insertions(+)
 create mode 100644 libavformat/rcwtdec.c

diff --git a/doc/demuxers.texi b/doc/demuxers.texi
index b70f3a38d7..04293c4813 100644
--- a/doc/demuxers.texi
+++ b/doc/demuxers.texi
@@ -1038,6 +1038,36 @@ the command:
 ffplay -f rawvideo -pixel_format rgb24 -video_size 320x240 -framerate 10 
input.raw
 @end example
 
+@anchor{rcwtdec}
+@section rcwt
+
+RCWT (Raw Captions With Time) is a format native to ccextractor, a commonly
+used open source tool for processing 608/708 Closed Captions (CC) sources.
+For more information on the format, see @ref{rcwtenc,,,ffmpeg-formats}.
+
+This demuxer implements the specification as of March 2024, which has
+been stable and unchanged since April 2014.
+
+@subsection Examples
+
+@itemize
+@item
+Render CC to ASS using the built-in decoder:
+@example
+ffmpeg -i CC.rcwt.bin CC.ass
+@end example
+Note that if your output appears to be empty, you may have to manually
+set the decoder's @option{data_field} option to pick the desired CC substream.
+
+@item
+Convert an RCWT backup to Scenarist (SCC) format:
+@example
+ffmpeg -i CC.rcwt.bin -c:s copy CC.scc
+@end example
+Note that the SCC format does not support all of the possible CC extensions
+that can be stored in RCWT (such as EIA-708).
+@end itemize
+
 @section sbg
 
 SBaGen script demuxer.
diff --git a/libavformat/Makefile b/libavformat/Makefile
index 44aa485029..5d77cba7f1 100644
--- a/libavformat/Makefile
+++ b/libavformat/Makefile
@@ -493,6 +493,7 @@ OBJS-$(CONFIG_QOA_DEMUXER)   += qoadec.o
 OBJS-$(CONFIG_R3D_DEMUXER)   += r3d.o
 OBJS-$(CONFIG_RAWVIDEO_DEMUXER)  += rawvideodec.o
 OBJS-$(CONFIG_RAWVIDEO_MUXER)+= rawenc.o
+OBJS-$(CONFIG_RCWT_DEMUXER)  += rcwtdec.o subtitles.o
 OBJS-$(CONFIG_RCWT_MUXER)+= rcwtenc.o subtitles.o
 OBJS-$(CONFIG_REALTEXT_DEMUXER)  += realtextdec.o subtitles.o
 OBJS-$(CONFIG_REDSPARK_DEMUXER)  += redspark.o
diff --git a/libavformat/allformats.c b/libavformat/allformats.c
index 9df42bb87a..ae925dcf60 100644
--- a/libavformat/allformats.c
+++ b/libavformat/allformats.c
@@ -391,6 +391,7 @@ extern const FFInputFormat  ff_qoa_demuxer;
 extern const FFInputFormat  ff_r3d_demuxer;
 extern const FFInputFormat  ff_rawvideo_demuxer;
 extern const FFOutputFormat ff_rawvideo_muxer;
+extern const FFInputFormat  ff_rcwt_demuxer;
 extern const FFOutputFormat ff_rcwt_muxer;
 extern const FFInputFormat  ff_realtext_demuxer;
 extern const FFInputFormat  ff_redspark_demuxer;
diff --git a/libavformat/rcwtdec.c b/libavformat/rcwtdec.c
new file mode 100644
index 00..91f994c3ab
--- /dev/null
+++ b/libavformat/rcwtdec.c
@@ -0,0 +1,123 @@
+/*
+ * RCWT (Raw Captions With Time) demuxer
+ *
+ * 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
+ */
+
+/*
+ * RCWT (Raw Captions With Time) is a format native to ccextractor, a commonly
+ * used open source tool for processing 608/708 Closed Captions (CC) sources.
+ *
+ * This demuxer implements the specification as of March 2024, which has
+ * been stable and unchanged since April 2014.
+ *
+ * A free specification of RCWT can be found here:
+ * 
@url{https://github.com/CCExtractor/ccextractor/blob/master/docs/BINARY_FILE_FORMAT.TXT}
+ */
+
+#include "avformat.h"
+#include "demux.h"
+#include "internal.h"
+#include "subtitles.h"
+#include "libavutil/intreadwrite.h"
+
+#define

[FFmpeg-devel] [PATCH v10 1/5] avformat/subtitles: extend ff_subtitles_queue_insert() to support not yet available events

2024-03-28 Thread Marth64
If ff_subtitles_queue_insert() were given a NULL buffer
with 0 length, it would still attempt to grow the packet
or memcpy depending on if merge option is enabled.

In this commit, allow passing a NULL buffer with 0 length
without attempting to do such operations. This way, if a
subtitle demuxer happens to pass an empty cue or wants to
use av_get_packet() to read bytes, there are no unnecessary
operations on the packet after it is allocated.

Signed-off-by: Marth64 
---
 libavformat/subtitles.c | 23 +++
 libavformat/subtitles.h |  2 +-
 2 files changed, 16 insertions(+), 9 deletions(-)

diff --git a/libavformat/subtitles.c b/libavformat/subtitles.c
index 3413763c7b..1c9b229f5b 100644
--- a/libavformat/subtitles.c
+++ b/libavformat/subtitles.c
@@ -21,6 +21,7 @@
 #include "avformat.h"
 #include "subtitles.h"
 #include "avio_internal.h"
+#include "libavutil/avassert.h"
 #include "libavutil/avstring.h"
 
 void ff_text_init_avio(void *s, FFTextReader *r, AVIOContext *pb)
@@ -111,15 +112,19 @@ AVPacket *ff_subtitles_queue_insert(FFDemuxSubtitlesQueue 
*q,
 {
 AVPacket **subs, *sub;
 
+av_assert1(event || len == 0);
+
 if (merge && q->nb_subs > 0) {
 /* merge with previous event */
 
 int old_len;
 sub = q->subs[q->nb_subs - 1];
 old_len = sub->size;
-if (av_grow_packet(sub, len) < 0)
-return NULL;
-memcpy(sub->data + old_len, event, len);
+if (event) {
+if (av_grow_packet(sub, len) < 0)
+return NULL;
+memcpy(sub->data + old_len, event, len);
+}
 } else {
 /* new event */
 
@@ -133,14 +138,16 @@ AVPacket *ff_subtitles_queue_insert(FFDemuxSubtitlesQueue 
*q,
 sub = av_packet_alloc();
 if (!sub)
 return NULL;
-if (av_new_packet(sub, len) < 0) {
-av_packet_free();
-return NULL;
+if (event) {
+if (av_new_packet(sub, len) < 0) {
+av_packet_free();
+return NULL;
+}
+memcpy(sub->data, event, len);
 }
-subs[q->nb_subs++] = sub;
 sub->flags |= AV_PKT_FLAG_KEY;
 sub->pts = sub->dts = 0;
-memcpy(sub->data, event, len);
+subs[q->nb_subs++] = sub;
 }
 return sub;
 }
diff --git a/libavformat/subtitles.h b/libavformat/subtitles.h
index 88665663c5..ad6b96ca6a 100644
--- a/libavformat/subtitles.h
+++ b/libavformat/subtitles.h
@@ -112,7 +112,7 @@ typedef struct {
 /**
  * Insert a new subtitle event.
  *
- * @param event the subtitle line, may not be zero terminated
+ * @param event the subtitle line (not zero terminated) or NULL on not yet 
available event
  * @param len   the length of the event (in strlen() sense, so without '\0')
  * @param merge set to 1 if the current event should be concatenated with the
  *  previous one instead of adding a new entry, 0 otherwise
-- 
2.34.1

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH v10 0/5] RCWT Closed Captions demuxer (v10)

2024-03-28 Thread Marth64
Since v7/8:
* Addresses last known feedback (about av_assert call)
* Changelog entry removed, since v7.0 is cut and there is no "next" space yet
(will make patch once available)

Signed-off-by: Marth64 
-- 
2.34.1

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [PATCH v9 0/5] RCWT Closed Captions demuxer (v9)

2024-03-28 Thread Marth64
Stefano, v10 coming shortly. Thank you!
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [PATCH v9 0/5] RCWT Closed Captions demuxer (v9)

2024-03-28 Thread Marth64
Thanks for checking Stefano, I have been behind a bit. I will follow up
with the fix once possible.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [PATCH] avformat/dvdvideodec: remove `if ((ret = ...) < 0)` pattern

2024-03-28 Thread Marth64
Thanks all for the feedback. I think I took the idea too literally here,
and agree in retrospect it’s not necessary at this point. The good news is
while I made this change, I didn’t find any pre-existing bugs in this
demuxer due to using the pattern. (Because while I was writing it, I had
made the mistake a few times and was able to correct them :D)

I think we can skip this and if it becomes an issue down the line I’ll make
the changes surgically. Going forward for my own contributions, I’ll avoid
the pattern unless it truly offers readability gain.

Apologies for the inconvenience.

Best,
Marth64
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [PATCH v3 1/6] avcodec/mpeg12dec: extract only one type of CC substream

2024-03-28 Thread Marth64
>Is it not possible to extract all of them simultaneously?

Each of the extractable CC bitstreams would need to be exposed as an
independent eia608 AVStream, because each represents a distinct stream.
They can’t be commingled (which is what this patch addressed). I’m not sure
of a way to sanely present multiple eia608 streams to the end user.
AVStreamGroup gives me hope for the future, but I can’t think of a
technique in present day.

This is because: as it stands now the only way I know of to open a context
on an mpeg2/h26x source with an eia608 AVStream exposed is via the lavfi
movie=in[out+subcc] technique - but that only exposes one stream.

I guess the subcc keyword in the filter can be expanded to expose multiple
bitstreams, even via AVStreamGroup, but user would have to be aware and
opt-in. Otherwise it could get confusing. How would the user easily know
which bitstreams are in the source file? We can probe this to some extent,
but what if the eia608 bytes don’t show until halfway through the source?

Open to ideas, thoughts, as I’m gathering my own on this in a notebook over
the past few weeks.

Respectfully,
Marth64
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH] avformat/dvdvideodec: remove `if ((ret = ...) < 0)` pattern

2024-03-26 Thread Marth64
Recent advice plus my own experience agree that this pattern
is error-prone. Instead, set `ret` in its own line and do
the error validation after. Also, explicitly return 0 on success
in dvdvideo_chapters_setup_preindex()

Signed-off-by: Marth64 
---
 libavformat/dvdvideodec.c | 132 +-
 1 file changed, 86 insertions(+), 46 deletions(-)

diff --git a/libavformat/dvdvideodec.c b/libavformat/dvdvideodec.c
index c94e7f7fe6..000f9c5c9b 100644
--- a/libavformat/dvdvideodec.c
+++ b/libavformat/dvdvideodec.c
@@ -900,7 +900,7 @@ static int dvdvideo_chapters_setup_preindex(AVFormatContext 
*s)
 {
 DVDVideoDemuxContext *c = s->priv_data;
 
-int ret = 0, interrupt = 0;
+int ret, interrupt = 0;
 int nb_chapters = 0, last_ptt = c->opt_chapter_start;
 uint64_t cur_chapter_offset = 0, cur_chapter_duration = 0;
 DVDVideoPlaybackState state = {0};
@@ -909,9 +909,10 @@ static int 
dvdvideo_chapters_setup_preindex(AVFormatContext *s)
 int nav_event;
 
 if (c->opt_chapter_start == c->opt_chapter_end)
-return ret;
+return 0;
 
-if ((ret = dvdvideo_play_open(s, )) < 0)
+ret = dvdvideo_play_open(s, );
+if (ret < 0)
 return ret;
 
 if (state.pgc->nr_of_programs == 1)
@@ -1058,7 +1059,7 @@ static int dvdvideo_video_stream_setup(AVFormatContext *s)
 {
 DVDVideoDemuxContext *c = s->priv_data;
 
-int ret = 0;
+int ret;
 DVDVideoVTSVideoStreamEntry entry = {0};
 video_attr_t video_attr;
 
@@ -1068,14 +1069,11 @@ static int dvdvideo_video_stream_setup(AVFormatContext 
*s)
 else
 video_attr = c->vts_ifo->vtsi_mat->vts_video_attr;
 
-if ((ret = dvdvideo_video_stream_analyze(s, video_attr, )) < 0 ||
-(ret = dvdvideo_video_stream_add(s, , AVSTREAM_PARSE_HEADERS)) < 
0) {
-
-av_log(s, AV_LOG_ERROR, "Unable to add video stream\n");
+ret = dvdvideo_video_stream_analyze(s, video_attr, );
+if (ret < 0)
 return ret;
-}
 
-return 0;
+return dvdvideo_video_stream_add(s, , AVSTREAM_PARSE_HEADERS);
 }
 
 static int dvdvideo_audio_stream_analyze(AVFormatContext *s, audio_attr_t 
audio_attr,
@@ -1219,7 +1217,7 @@ static int dvdvideo_audio_stream_add_all(AVFormatContext 
*s)
 {
 DVDVideoDemuxContext *c = s->priv_data;
 
-int ret = 0;
+int ret;
 int nb_streams;
 
 if (c->opt_menu)
@@ -1241,8 +1239,9 @@ static int dvdvideo_audio_stream_add_all(AVFormatContext 
*s)
 if (!(c->play_state.pgc->audio_control[i] & 0x8000))
 continue;
 
-if ((ret = dvdvideo_audio_stream_analyze(s, audio_attr, 
c->play_state.pgc->audio_control[i],
- )) < 0)
+ret = dvdvideo_audio_stream_analyze(s, audio_attr, 
c->play_state.pgc->audio_control[i],
+);
+if (ret < 0)
 goto break_error;
 
 /* IFO structures can declare duplicate entries for the same startcode 
*/
@@ -1250,7 +1249,8 @@ static int dvdvideo_audio_stream_add_all(AVFormatContext 
*s)
 if (s->streams[j]->id == entry.startcode)
 continue;
 
-if ((ret = dvdvideo_audio_stream_add(s, , 
AVSTREAM_PARSE_HEADERS)) < 0)
+ret = dvdvideo_audio_stream_add(s, , AVSTREAM_PARSE_HEADERS);
+if (ret < 0)
 goto break_error;
 
 continue;
@@ -1302,7 +1302,8 @@ static int dvdvideo_subp_stream_add(AVFormatContext *s, 
DVDVideoPGCSubtitleStrea
 st->codecpar->codec_type = AVMEDIA_TYPE_SUBTITLE;
 st->codecpar->codec_id = AV_CODEC_ID_DVD_SUBTITLE;
 
-if ((ret = ff_dvdclut_palette_extradata_cat(entry->clut, 
FF_DVDCLUT_CLUT_SIZE, st->codecpar)) < 0)
+ret = ff_dvdclut_palette_extradata_cat(entry->clut, FF_DVDCLUT_CLUT_SIZE, 
st->codecpar);
+if (ret < 0)
 return ret;
 
 if (entry->lang_iso)
@@ -1326,12 +1327,13 @@ static int 
dvdvideo_subp_stream_add_internal(AVFormatContext *s, uint32_t offset
  subp_attr_t subp_attr,
  enum DVDVideoSubpictureViewport 
viewport)
 {
-int ret = 0;
+int ret;
 DVDVideoPGCSubtitleStreamEntry entry = {0};
 
 entry.viewport = viewport;
 
-if ((ret = dvdvideo_subp_stream_analyze(s, offset, subp_attr, )) < 0)
+ret = dvdvideo_subp_stream_analyze(s, offset, subp_attr, );
+if (ret < 0)
 goto end_error;
 
 /* IFO structures can declare duplicate entries for the same startcode */
@@ -1339,7 +1341,8 @@ static int 
dvdvideo_subp_stream_add_internal(AVFormatContext *s, uint32_t offset
 if (s->streams[i]->id == entry.startcode)
 return 0;
 
-if ((ret = dvdvideo_subp_stream_add(s, , AVSTREAM_PARSE_HEADERS)) < 
0)
+ret = dvdvideo_subp_stream_add(s, , AVSTREAM_PARSE_HEADE

Re: [FFmpeg-devel] [PATCH v4 0/4] Fix some active sequences in subtitles

2024-03-26 Thread Marth64
Ping on this set authored by Oneric as well.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [PATCH v2] avformat/dvdvideodec: add explicit inttypes.h include

2024-03-26 Thread Marth64
Was already applied. Thanks Stefano and Leo!
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [PATCH v9 1/5] avformat/subtitles: extend ff_subtitles_queue_insert() to support not yet available events

2024-03-26 Thread Marth64
> is the move needed? (but not blocking)
It is not needed, but the code flows better I think in terms of
readability. I think it feels cleaner to say, "set up `sub` then add it to
the array" vs. "set up sub's data, add it to the array, then set up its
other fields". But, I am good either way and on stand by if you request me
to change it.

Thank you for the review.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [PATCH v9 0/5] RCWT Closed Captions demuxer (v9)

2024-03-26 Thread Marth64
Ping if possible. The patches still apply. 3 of the 5 patches are
documentation only and the demuxer itself is much smaller now. The muxer
already made it in, so was hoping the demuxer could go too :fingers_crossed:
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [PATCH v4 1/2] avcodec/ccaption_dec: don't print multiple \an and \pos tags

2024-03-25 Thread Marth64
This should be withheld until after 7.0. In the same bug report it appears
that 1 user is making use of the erroneous tags via an external script for
a valid purpose. I don’t want to break people’s workflow even though it’s
invalid ASS.

After 7.0 I will revive this patchset and with additional fixes.

I apologize for the inconvenience. Please don’t merge, and I’ll be more
careful next time..
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [PATCH v4 1/2] avcodec/ccaption_dec: don't print multiple \an and \pos tags

2024-03-25 Thread Marth64
This also fixes https://trac.ffmpeg.org/ticket/10927 (recently reported by
a user)
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [PATCH 13/13] fftools/ffmpeg_mux_init: Fix double-free on error

2024-03-25 Thread Marth64
I had actually applied this patch while looking into a ticket near the same
code path. LGTM.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [PATCH] avformat/dvdvideodec: add explicit inttypes.h include

2024-03-25 Thread Marth64
v2 on the way.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH v2] avformat/dvdvideodec: add explicit inttypes.h include

2024-03-25 Thread Marth64
Since log statements printing int64 were made portable in
4464b7eeb194e98ac115f18d2b6be67361407c8a, let us include
inttypes.h explicitly (as it is unclear where PRId64 and
such are coming from now).

Reported-by: Traneptora
Signed-off-by: Marth64 
---
 libavformat/dvdvideodec.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/libavformat/dvdvideodec.c b/libavformat/dvdvideodec.c
index 761ac97ec6..4959edab5c 100644
--- a/libavformat/dvdvideodec.c
+++ b/libavformat/dvdvideodec.c
@@ -30,6 +30,8 @@
  * 7) Close the dvdnav VM, and free dvdread's IFO structures
  */
 
+#include 
+
 #include 
 #include 
 #include 
-- 
2.34.1

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [PATCH] avformat/dvdvideodec: add explicit inttypes.h include

2024-03-24 Thread Marth64
Will send v2 with fix. I actually prefer it, I wasn't sure if it would be
seen the same way.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH v4 2/2] avformat/ccaption_dec: use NTSC resolution base

2024-03-23 Thread Marth64
Closed Captions are an NTSC concept, but the base resolution
used for x/y calculation is the default PAL base in ASS encoder.
This causes subtle positioning issues especially in 16:9
content.

Use NTSC 240 TVL (360x240) as the base instead, and compensate
the font size of the style. Update tests accordingly.

Signed-off-by: Marth64 
---
 libavcodec/ccaption_dec.c |  34 ++--
 tests/ref/fate/ffmpeg-fix_sub_duration|  14 +-
 .../fate/ffmpeg-fix_sub_duration_heartbeat|  16 +-
 tests/ref/fate/sub-cc |  10 +-
 tests/ref/fate/sub-cc-realtime|  22 +-
 tests/ref/fate/sub-cc-scte20  |  12 +-
 tests/ref/fate/sub-scc| 190 +-
 7 files changed, 153 insertions(+), 145 deletions(-)

diff --git a/libavcodec/ccaption_dec.c b/libavcodec/ccaption_dec.c
index 0b01765ccf..5f32fd6e1f 100644
--- a/libavcodec/ccaption_dec.c
+++ b/libavcodec/ccaption_dec.c
@@ -27,8 +27,11 @@
 #include "codec_internal.h"
 #include "libavutil/opt.h"
 
-#define SCREEN_ROWS 15
-#define SCREEN_COLUMNS 32
+#define CC_PLAYRESX 360
+#define CC_PLAYRESY 240
+#define CC_FONT_SIZE14
+#define SCREEN_ROWS 15
+#define SCREEN_COLUMNS  32
 
 #define SET_FLAG(var, val)   ( (var) |=   ( 1 << (val)) )
 #define UNSET_FLAG(var, val) ( (var) &=  ~( 1 << (val)) )
@@ -289,15 +292,20 @@ static av_cold int init_decoder(AVCodecContext *avctx)
 ctx->bg_color = CCCOL_BLACK;
 ctx->rollup = 2;
 ctx->cursor_row = 10;
-return ff_ass_subtitle_header(avctx, "Monospace",
- ASS_DEFAULT_FONT_SIZE,
- ASS_DEFAULT_COLOR,
- ASS_DEFAULT_BACK_COLOR,
- ASS_DEFAULT_BOLD,
- ASS_DEFAULT_ITALIC,
- ASS_DEFAULT_UNDERLINE,
- 3,
- ASS_DEFAULT_ALIGNMENT);
+return ff_ass_subtitle_header_full(avctx,
+   CC_PLAYRESX,
+   CC_PLAYRESY,
+   "Monospace",
+   CC_FONT_SIZE,
+   ASS_DEFAULT_COLOR,
+   ASS_DEFAULT_COLOR,
+   ASS_DEFAULT_BACK_COLOR,
+   ASS_DEFAULT_BACK_COLOR,
+   ASS_DEFAULT_BOLD,
+   ASS_DEFAULT_ITALIC,
+   ASS_DEFAULT_UNDERLINE,
+   3,
+   ASS_DEFAULT_ALIGNMENT);
 }
 
 static av_cold int close_decoder(AVCodecContext *avctx)
@@ -497,8 +505,8 @@ static int capture_screen(CCaptionSubContext *ctx)
 while (row[j] == ' ' && charset[j] == CCSET_BASIC_AMERICAN && j < 
tab)
 j++;
 
-x = ASS_DEFAULT_PLAYRESX * (0.1 + 0.0250 * j);
-y = ASS_DEFAULT_PLAYRESY * (0.1 + 0.0533 * i);
+x = CC_PLAYRESX * (0.1 + 0.0250 * j);
+y = CC_PLAYRESY * (0.1 + 0.0533 * i);
 
 if (!seen_row) {
 av_bprintf(>buffer[bidx], "{\\an7}{\\pos(%d,%d)}", x, y);
diff --git a/tests/ref/fate/ffmpeg-fix_sub_duration 
b/tests/ref/fate/ffmpeg-fix_sub_duration
index 9cd36d4888..0e0ab27a8e 100644
--- a/tests/ref/fate/ffmpeg-fix_sub_duration
+++ b/tests/ref/fate/ffmpeg-fix_sub_duration
@@ -1,31 +1,31 @@
 1
 00:00:00,968 --> 00:00:01,168
-{\an7}(
+{\an7}(
 
 2
 00:00:01,168 --> 00:00:01,368
-{\an7}( inaudibl
+{\an7}( inaudibl
 
 3
 00:00:01,368 --> 00:00:01,568
-{\an7}( inaudible radio chat
+{\an7}( inaudible radio chat
 
 4
 00:00:01,568 --> 00:00:03,103
-{\an7}( inaudible radio chatter )
+{\an7}( inaudible radio chatter 
)
 
 5
 00:00:03,103 --> 00:00:03,303
-{\an7}( inaudible radio chatter )
+{\an7}( inaudible radio chatter )
 >>
 
 6
 00:00:03,303 --> 00:00:03,503
-{\an7}( inaudible radio chatter )
+{\an7}( inaudible radio chatter )
 >> Safety rema
 
 7
 00:00:03,504 --> 00:00:03,704
-{\an7}( inaudible radio chatter )
+{\an7}( inaudible radio chatter )
 >> Safety remains our numb
 
diff --git a/tests/ref/fate/ffmpeg-fix_sub_duration_heartbeat 
b/tests/ref/fate/ffmpeg-fix_sub_duration_heartbeat
index 3a3ec96637..5c18c1eb97 100644
--- a/tests/ref/fate/ffmpeg-fix_sub_duration_heartbeat
+++ b/tests/ref/fate/ffmpeg-fix_sub_duration_heartbeat
@@ -1,35 +1,35 @@
 1
 00:00:00,968 --> 00:00:01,168
-{\an7}(
+{\an7}(
 
 2
 00:00:01,168 --> 00:00:01,368
-{\an7}( inaudibl
+{\an7}( inaudibl
 
 3
 00:00:01,368 --> 00:00:01,568
-{\an7}( inaudible radio chat
+{\an7}( inaudible radio chat
 
 4
 00:00:01,568 --> 00:00:02,002
-{\an7}( ina

[FFmpeg-devel] [PATCH v4 1/2] avcodec/ccaption_dec: don't print multiple \an and \pos tags

2024-03-23 Thread Marth64
Closed Captions decoder prints multiple \pos ASS tags per cue,
and preceding the \pos tag is a fixed \an7 that fixes rendering
position from the top left corner and enforces justification.

Printing multiple \an and \pos tags in this way is invalid behavior,
because only the first \pos tag in a cue is honored by ASS anyway.
Don't write multiple \an and \pos tags. Also, update tests accordingly.

Note that when applying the patch, whitespace warnings may appear
about the test data. The subtitle stream in this test data has
intentional whitespace at the end of line for some cues, this is OK.

Signed-off-by: Marth64 
---
 libavcodec/ccaption_dec.c  |  13 ++-
 tests/ref/fate/sub-cc  |   2 +-
 tests/ref/fate/sub-cc-realtime |   8 +-
 tests/ref/fate/sub-cc-scte20   |   4 +-
 tests/ref/fate/sub-scc | 146 -
 5 files changed, 91 insertions(+), 82 deletions(-)

diff --git a/libavcodec/ccaption_dec.c b/libavcodec/ccaption_dec.c
index d8b992bb94..0b01765ccf 100644
--- a/libavcodec/ccaption_dec.c
+++ b/libavcodec/ccaption_dec.c
@@ -20,6 +20,8 @@
  */
 
 #include 
+#include 
+
 #include "avcodec.h"
 #include "ass.h"
 #include "codec_internal.h"
@@ -457,7 +459,7 @@ static void roll_up(CCaptionSubContext *ctx)
 
 static int capture_screen(CCaptionSubContext *ctx)
 {
-int i, j, tab = 0;
+int i, j, tab = 0, seen_row = 0;
 struct Screen *screen = ctx->screen + ctx->active_screen;
 enum cc_font prev_font = CCFONT_REGULAR;
 enum cc_color_code prev_color = CCCOL_WHITE;
@@ -497,7 +499,14 @@ static int capture_screen(CCaptionSubContext *ctx)
 
 x = ASS_DEFAULT_PLAYRESX * (0.1 + 0.0250 * j);
 y = ASS_DEFAULT_PLAYRESY * (0.1 + 0.0533 * i);
-av_bprintf(>buffer[bidx], "{\\an7}{\\pos(%d,%d)}", x, y);
+
+if (!seen_row) {
+av_bprintf(>buffer[bidx], "{\\an7}{\\pos(%d,%d)}", x, y);
+seen_row = 1;
+}
+av_log(ctx, AV_LOG_TRACE, "rendering row: start_pts=%" PRId64 " 
end_pts=%" PRId64 " "
+  "x=%d y=%d\n",
+  ctx->buffer_time[0], 
ctx->buffer_time[1], x, y);
 
 for (; j < SCREEN_COLUMNS; j++) {
 const char *e_tag = "", *s_tag = "", *c_tag = "", *b_tag = "";
diff --git a/tests/ref/fate/sub-cc b/tests/ref/fate/sub-cc
index f5216b3de2..d4ab974c2f 100644
--- a/tests/ref/fate/sub-cc
+++ b/tests/ref/fate/sub-cc
@@ -13,4 +13,4 @@ Style: 
Default,Monospace,16,0,0,0,0,100,100,0,0,3,1,0,
 [Events]
 Format: Layer, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text
 Dialogue: 0,0:00:00.83,0:00:02.97,Default,,0,0,0,,{\an7}{\pos(38,44)}({\i1} 
inaudible radio chatter{\i0} )
-Dialogue: 0,0:00:02.97,0:00:04.34,Default,,0,0,0,,{\an7}{\pos(38,28)}({\i1} 
inaudible radio chatter{\i0} )\N{\an7}{\pos(38,44)}>> Safety remains our number 
one
+Dialogue: 0,0:00:02.97,0:00:04.34,Default,,0,0,0,,{\an7}{\pos(38,28)}({\i1} 
inaudible radio chatter{\i0} )\N>> Safety remains our number one
diff --git a/tests/ref/fate/sub-cc-realtime b/tests/ref/fate/sub-cc-realtime
index bda890bfe5..da06307221 100644
--- a/tests/ref/fate/sub-cc-realtime
+++ b/tests/ref/fate/sub-cc-realtime
@@ -16,7 +16,7 @@ Dialogue: 
0,0:00:00.97,9:59:59.99,Default,,0,0,0,,{\an7}{\pos(38,44)}(
 Dialogue: 0,0:00:01.17,9:59:59.99,Default,,0,0,0,,{\an7}{\pos(38,44)}({\i1} 
inaudibl
 Dialogue: 0,0:00:01.37,9:59:59.99,Default,,0,0,0,,{\an7}{\pos(38,44)}({\i1} 
inaudible radio chat
 Dialogue: 0,0:00:01.57,9:59:59.99,Default,,0,0,0,,{\an7}{\pos(38,44)}({\i1} 
inaudible radio chatter{\i0} )
-Dialogue: 0,0:00:03.10,9:59:59.99,Default,,0,0,0,,{\an7}{\pos(38,28)}({\i1} 
inaudible radio chatter{\i0} )\N{\an7}{\pos(38,44)}>>
-Dialogue: 0,0:00:03.30,9:59:59.99,Default,,0,0,0,,{\an7}{\pos(38,28)}({\i1} 
inaudible radio chatter{\i0} )\N{\an7}{\pos(38,44)}>> Safety rema
-Dialogue: 0,0:00:03.50,9:59:59.99,Default,,0,0,0,,{\an7}{\pos(38,28)}({\i1} 
inaudible radio chatter{\i0} )\N{\an7}{\pos(38,44)}>> Safety remains our numb
-Dialogue: 0,0:00:03.70,9:59:59.99,Default,,0,0,0,,{\an7}{\pos(38,28)}({\i1} 
inaudible radio chatter{\i0} )\N{\an7}{\pos(38,44)}>> Safety remains our number 
one
+Dialogue: 0,0:00:03.10,9:59:59.99,Default,,0,0,0,,{\an7}{\pos(38,28)}({\i1} 
inaudible radio chatter{\i0} )\N>>
+Dialogue: 0,0:00:03.30,9:59:59.99,Default,,0,0,0,,{\an7}{\pos(38,28)}({\i1} 
inaudible radio chatter{\i0} )\N>> Safety rema
+Dialogue: 0,0:00:03.50,9:59:59.99,Default,,0,0,0,,{\an7}{\pos(38,28)}({\i1} 
inaudible radio chatter{\i0} )\N>> Safety remains our numb
+Dialogue: 0,0:00:03.70,9:59:59.99,Default,,0,0,0,,{\an7}{\pos(38,28)}({\i1} 
inaudible radio chatter{\i0} )\N>> Safety remains our number one
diff --git a/t

[FFmpeg-devel] [PATCH v4 0/2] Closed Captions decoder improvements (v4)

2024-03-23 Thread Marth64
Since v3:
* Added trace logging of coordinates (requested in feedback)
* Improved calculation of coordinates by using NTSC base resolution

Signed-off-by: Marth64 
-- 
2.34.1

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH v9 5/5] doc/indevs: update CC extraction example to use RCWT muxer

2024-03-23 Thread Marth64
Signed-off-by: Marth64 
---
 doc/indevs.texi | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/doc/indevs.texi b/doc/indevs.texi
index d1b2bacf8b..fc14737181 100644
--- a/doc/indevs.texi
+++ b/doc/indevs.texi
@@ -1069,9 +1069,9 @@ ffplay -f lavfi 
"movie=test.avi[out0];amovie=test.wav[out1]"
 @end example
 
 @item
-Dump decoded frames to images and closed captions to a file (experimental):
+Dump decoded frames to images and Closed Captions to an RCWT backup:
 @example
-ffmpeg -f lavfi -i "movie=test.ts[out0+subcc]" -map v frame%08d.png -map s -c 
copy -f rawvideo subcc.bin
+ffmpeg -f lavfi -i "movie=test.ts[out0+subcc]" -map v frame%08d.png -map s -c 
copy subcc.bin
 @end example
 
 @end itemize
-- 
2.34.1

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH v9 4/5] doc/muxers: refresh the RCWT muxer's doc to be consistent with the demuxer

2024-03-23 Thread Marth64
Signed-off-by: Marth64 
---
 doc/muxers.texi | 29 +++--
 1 file changed, 19 insertions(+), 10 deletions(-)

diff --git a/doc/muxers.texi b/doc/muxers.texi
index a10a8e216f..4161401059 100644
--- a/doc/muxers.texi
+++ b/doc/muxers.texi
@@ -3038,19 +3038,18 @@ ogg files can be safely chained.
 
 @end table
 
-@anchor{rcwt}
+@anchor{rcwtenc}
 @section rcwt
 
-Raw Captions With Time (RCWT) is a format native to ccextractor, a commonly
-used open source tool for processing 608/708 closed caption (CC) sources.
-It can be used to archive the original, raw CC bitstream and to produce
-a source file for later CC processing or conversion. As a result,
-it also allows for interopability with ccextractor for processing CC data
-extracted via ffmpeg. The format is simple to parse and can be used
-to retain all lines and variants of CC.
+RCWT (Raw Captions With Time) is a format native to ccextractor, a commonly
+used open source tool for processing 608/708 Closed Captions (CC) sources.
+It can be used to archive the original extracted CC bitstream and to produce
+a source file for later processing or conversion. The format allows
+for interoperability between ccextractor and FFmpeg, is simple to parse,
+and can be used to create a backup of the CC presentation.
 
-This muxer implements the specification as of 2024-01-05, which has
-been stable and unchanged for 10 years as of this writing.
+This muxer implements the specification as of March 2024, which has
+been stable and unchanged since April 2014.
 
 This muxer will have some nuances from the way that ccextractor muxes RCWT.
 No compatibility issues when processing the output with ccextractor
@@ -3060,6 +3059,16 @@ and outputs will not be a bit-exact match.
 A free specification of RCWT can be found here:
 
@url{https://github.com/CCExtractor/ccextractor/blob/master/docs/BINARY_FILE_FORMAT.TXT}
 
+@subsection Examples
+
+@itemize
+@item
+Extract Closed Captions to RCWT using lavfi:
+@example
+ffmpeg -f lavfi -i "movie=INPUT.mkv[out+subcc]" -map 0:s:0 -c:s copy 
CC.rcwt.bin
+@end example
+@end itemize
+
 @anchor{segment}
 @section segment, stream_segment, ssegment
 
-- 
2.34.1

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH v9 3/5] avformat/rcwtenc: remove repeated documentation

2024-03-23 Thread Marth64
The high level summary of RCWT can be delegated doc/muxers, which
makes it easier to maintain and more consistent with the documentation
of the demuxer.

Signed-off-by: Marth64 
---
 libavformat/rcwtenc.c | 5 -
 1 file changed, 5 deletions(-)

diff --git a/libavformat/rcwtenc.c b/libavformat/rcwtenc.c
index f2459ef1d3..e06bc4b734 100644
--- a/libavformat/rcwtenc.c
+++ b/libavformat/rcwtenc.c
@@ -21,11 +21,6 @@
 /*
  * RCWT (Raw Captions With Time) is a format native to ccextractor, a commonly
  * used open source tool for processing 608/708 Closed Captions (CC) sources.
- * It can be used to archive the original, raw CC bitstream and to produce
- * a source file for later CC processing or conversion. As a result,
- * it also allows for interopability with ccextractor for processing CC data
- * extracted via ffmpeg. The format is simple to parse and can be used
- * to retain all lines and variants of CC.
  *
  * This muxer implements the specification as of March 2024, which has
  * been stable and unchanged since April 2014.
-- 
2.34.1

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH v9 2/5] avformat/rcwtdec: add RCWT Closed Captions demuxer

2024-03-23 Thread Marth64
RCWT (Raw Captions With Time) is a format native to ccextractor,
a commonly used OSS tool for processing 608/708 Closed Captions (CC).
RCWT can be used to archive the original extracted CC bitstream.
The muxer was added in January 2024. In this commit, add the demuxer.

One can now demux RCWT files for rendering in ccaption_dec or interop
with ccextractor (which produces RCWT). Using the muxer/demuxer combo,
the CC bits can be kept for processing or rendering with either tool.
This can be an effective way to backup an original CC stream, including
format extensions like EIA-708 and overall original presentation.

Signed-off-by: Marth64 
---
 Changelog|   2 +-
 doc/demuxers.texi|  30 ++
 libavformat/Makefile |   1 +
 libavformat/allformats.c |   1 +
 libavformat/rcwtdec.c| 123 +++
 5 files changed, 156 insertions(+), 1 deletion(-)
 create mode 100644 libavformat/rcwtdec.c

diff --git a/Changelog b/Changelog
index 934241a965..4587d0d511 100644
--- a/Changelog
+++ b/Changelog
@@ -19,7 +19,7 @@ version :
 - lavu/eval: introduce randomi() function in expressions
 - VVC decoder
 - fsync filter
-- Raw Captions with Time (RCWT) closed caption muxer
+- RCWT (Raw Captions with Time) Closed Captions muxer and demuxer
 - ffmpeg CLI -bsf option may now be used for input as well as output
 - ffmpeg CLI options may now be used as -/opt , which is equivalent
   to -opt >
diff --git a/doc/demuxers.texi b/doc/demuxers.texi
index b70f3a38d7..04293c4813 100644
--- a/doc/demuxers.texi
+++ b/doc/demuxers.texi
@@ -1038,6 +1038,36 @@ the command:
 ffplay -f rawvideo -pixel_format rgb24 -video_size 320x240 -framerate 10 
input.raw
 @end example
 
+@anchor{rcwtdec}
+@section rcwt
+
+RCWT (Raw Captions With Time) is a format native to ccextractor, a commonly
+used open source tool for processing 608/708 Closed Captions (CC) sources.
+For more information on the format, see @ref{rcwtenc,,,ffmpeg-formats}.
+
+This demuxer implements the specification as of March 2024, which has
+been stable and unchanged since April 2014.
+
+@subsection Examples
+
+@itemize
+@item
+Render CC to ASS using the built-in decoder:
+@example
+ffmpeg -i CC.rcwt.bin CC.ass
+@end example
+Note that if your output appears to be empty, you may have to manually
+set the decoder's @option{data_field} option to pick the desired CC substream.
+
+@item
+Convert an RCWT backup to Scenarist (SCC) format:
+@example
+ffmpeg -i CC.rcwt.bin -c:s copy CC.scc
+@end example
+Note that the SCC format does not support all of the possible CC extensions
+that can be stored in RCWT (such as EIA-708).
+@end itemize
+
 @section sbg
 
 SBaGen script demuxer.
diff --git a/libavformat/Makefile b/libavformat/Makefile
index 44aa485029..5d77cba7f1 100644
--- a/libavformat/Makefile
+++ b/libavformat/Makefile
@@ -493,6 +493,7 @@ OBJS-$(CONFIG_QOA_DEMUXER)   += qoadec.o
 OBJS-$(CONFIG_R3D_DEMUXER)   += r3d.o
 OBJS-$(CONFIG_RAWVIDEO_DEMUXER)  += rawvideodec.o
 OBJS-$(CONFIG_RAWVIDEO_MUXER)+= rawenc.o
+OBJS-$(CONFIG_RCWT_DEMUXER)  += rcwtdec.o subtitles.o
 OBJS-$(CONFIG_RCWT_MUXER)+= rcwtenc.o subtitles.o
 OBJS-$(CONFIG_REALTEXT_DEMUXER)  += realtextdec.o subtitles.o
 OBJS-$(CONFIG_REDSPARK_DEMUXER)  += redspark.o
diff --git a/libavformat/allformats.c b/libavformat/allformats.c
index e15d0fa6d7..3140018f8d 100644
--- a/libavformat/allformats.c
+++ b/libavformat/allformats.c
@@ -391,6 +391,7 @@ extern const FFInputFormat  ff_qoa_demuxer;
 extern const FFInputFormat  ff_r3d_demuxer;
 extern const FFInputFormat  ff_rawvideo_demuxer;
 extern const FFOutputFormat ff_rawvideo_muxer;
+extern const FFInputFormat  ff_rcwt_demuxer;
 extern const FFOutputFormat ff_rcwt_muxer;
 extern const FFInputFormat  ff_realtext_demuxer;
 extern const FFInputFormat  ff_redspark_demuxer;
diff --git a/libavformat/rcwtdec.c b/libavformat/rcwtdec.c
new file mode 100644
index 00..9b0d60fe35
--- /dev/null
+++ b/libavformat/rcwtdec.c
@@ -0,0 +1,123 @@
+/*
+ * RCWT (Raw Captions With Time) demuxer
+ *
+ * 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
+ */
+
+/*
+ * RCWT (Raw Captions With Time) is a format native to ccextractor, a commonly
+ * u

[FFmpeg-devel] [PATCH v9 1/5] avformat/subtitles: extend ff_subtitles_queue_insert() to support not yet available events

2024-03-23 Thread Marth64
If ff_subtitles_queue_insert() were given a NULL buffer
with 0 length, it would still attempt to grow the packet
or memcpy depending on if merge option is enabled.

In this commit, allow passing a NULL buffer with 0 length
without attempting to do such operations. This way, if a
subtitle demuxer happens to pass an empty cue or wants to
use av_get_packet() to read bytes, there are no unnecessary
operations on the packet after it is allocated.

Signed-off-by: Marth64 
---
 libavformat/subtitles.c | 24 
 libavformat/subtitles.h |  2 +-
 2 files changed, 17 insertions(+), 9 deletions(-)

diff --git a/libavformat/subtitles.c b/libavformat/subtitles.c
index 3413763c7b..4742ca0667 100644
--- a/libavformat/subtitles.c
+++ b/libavformat/subtitles.c
@@ -21,6 +21,7 @@
 #include "avformat.h"
 #include "subtitles.h"
 #include "avio_internal.h"
+#include "libavutil/avassert.h"
 #include "libavutil/avstring.h"
 
 void ff_text_init_avio(void *s, FFTextReader *r, AVIOContext *pb)
@@ -111,15 +112,20 @@ AVPacket *ff_subtitles_queue_insert(FFDemuxSubtitlesQueue 
*q,
 {
 AVPacket **subs, *sub;
 
+if (!event)
+av_assert1(len == 0);
+
 if (merge && q->nb_subs > 0) {
 /* merge with previous event */
 
 int old_len;
 sub = q->subs[q->nb_subs - 1];
 old_len = sub->size;
-if (av_grow_packet(sub, len) < 0)
-return NULL;
-memcpy(sub->data + old_len, event, len);
+if (event) {
+if (av_grow_packet(sub, len) < 0)
+return NULL;
+memcpy(sub->data + old_len, event, len);
+}
 } else {
 /* new event */
 
@@ -133,14 +139,16 @@ AVPacket *ff_subtitles_queue_insert(FFDemuxSubtitlesQueue 
*q,
 sub = av_packet_alloc();
 if (!sub)
 return NULL;
-if (av_new_packet(sub, len) < 0) {
-av_packet_free();
-return NULL;
+if (event) {
+if (av_new_packet(sub, len) < 0) {
+av_packet_free();
+return NULL;
+}
+memcpy(sub->data, event, len);
 }
-subs[q->nb_subs++] = sub;
 sub->flags |= AV_PKT_FLAG_KEY;
 sub->pts = sub->dts = 0;
-memcpy(sub->data, event, len);
+subs[q->nb_subs++] = sub;
 }
 return sub;
 }
diff --git a/libavformat/subtitles.h b/libavformat/subtitles.h
index 88665663c5..ad6b96ca6a 100644
--- a/libavformat/subtitles.h
+++ b/libavformat/subtitles.h
@@ -112,7 +112,7 @@ typedef struct {
 /**
  * Insert a new subtitle event.
  *
- * @param event the subtitle line, may not be zero terminated
+ * @param event the subtitle line (not zero terminated) or NULL on not yet 
available event
  * @param len   the length of the event (in strlen() sense, so without '\0')
  * @param merge set to 1 if the current event should be concatenated with the
  *  previous one instead of adding a new entry, 0 otherwise
-- 
2.34.1

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH v9 0/5] RCWT Closed Captions demuxer (v9)

2024-03-23 Thread Marth64
Since v7/8:
* Simplified demuxer error handling logic
* Fixes buggy change to ff_subtitles_queue_insert()
* Documentation improvements

Signed-off-by: Marth64 
-- 
2.34.1

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH] avformat/dvdvideodec: add explicit inttypes.h include

2024-03-23 Thread Marth64
Since log statements printing int64 were made portable in
4464b7eeb194e98ac115f18d2b6be67361407c8a, let us include
inttypes.h explicitly (as it is unclear where PRId64 and
such are coming from now).

Reported-by: Traneptora
Signed-off-by: Marth64 
---
 libavformat/dvdvideodec.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/libavformat/dvdvideodec.c b/libavformat/dvdvideodec.c
index 761ac97ec6..959b267e69 100644
--- a/libavformat/dvdvideodec.c
+++ b/libavformat/dvdvideodec.c
@@ -30,6 +30,7 @@
  * 7) Close the dvdnav VM, and free dvdread's IFO structures
  */
 
+#include 
 #include 
 #include 
 #include 
-- 
2.34.1

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [PATCH v7 1/5] avformat/subtitles: extend ff_subtitles_queue_insert() to support empty events

2024-03-21 Thread Marth64
Thank you Andreas, for walking me through this in detail.
I will update accordingly and test.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH v8] avformat/rcwtdec: add RCWT Closed Captions demuxer

2024-03-20 Thread Marth64
RCWT (Raw Captions With Time) is a format native to ccextractor,
a commonly used OSS tool for processing 608/708 Closed Captions (CC).
RCWT can be used to archive the original extracted CC bitstream.
The muxer was added in January 2024. In this commit, add the demuxer.

One can now demux RCWT files for rendering in ccaption_dec or interop
with ccextractor (which produces RCWT). Using the muxer/demuxer combo,
the CC bits can be kept for processing or rendering with either tool.
This can be an effective way to backup an original CC stream, including
format extensions like EIA-708 and overall original presentation.

Signed-off-by: Marth64 
---
 Changelog|   2 +-
 doc/demuxers.texi|  30 ++
 libavformat/Makefile |   1 +
 libavformat/allformats.c |   1 +
 libavformat/rcwtdec.c| 125 +++
 5 files changed, 158 insertions(+), 1 deletion(-)
 create mode 100644 libavformat/rcwtdec.c

diff --git a/Changelog b/Changelog
index e3ca52430c..0ae05c6cce 100644
--- a/Changelog
+++ b/Changelog
@@ -19,7 +19,7 @@ version :
 - lavu/eval: introduce randomi() function in expressions
 - VVC decoder
 - fsync filter
-- Raw Captions with Time (RCWT) closed caption muxer
+- RCWT (Raw Captions with Time) Closed Captions muxer and demuxer
 - ffmpeg CLI -bsf option may now be used for input as well as output
 - ffmpeg CLI options may now be used as -/opt , which is equivalent
   to -opt >
diff --git a/doc/demuxers.texi b/doc/demuxers.texi
index b70f3a38d7..b4c4daacd9 100644
--- a/doc/demuxers.texi
+++ b/doc/demuxers.texi
@@ -1038,6 +1038,36 @@ the command:
 ffplay -f rawvideo -pixel_format rgb24 -video_size 320x240 -framerate 10 
input.raw
 @end example
 
+@anchor{rcwtdec}
+@section rcwt
+
+RCWT (Raw Captions With Time) is a format native to ccextractor, a commonly
+used open source tool for processing 608/708 Closed Captions (CC) sources.
+For more information on the format, see @ref{rcwtenc,,,ffmpeg-formats}.
+
+This demuxer implements the specification as of March 2024, which has
+been stable and unchanged since April 2014.
+
+@subsection Examples
+
+@itemize
+@item
+Render Closed Captions to ASS, using the CC decoder (cc_dec):
+@example
+ffmpeg -i CC.rcwt.bin CC.ass
+@end example
+Note that if your output appears to be empty, you may have to manually
+set the decoder's @option{data_field} option to pick the desired CC substream.
+
+@item
+Convert an RCWT backup to SCC format, using the SCC muxer (scc):
+@example
+ffmpeg -i CC.rcwt.bin -c:s copy CC.scc
+@end example
+Note that the SCC format does not support all of the possible CC formats
+that can be stored in RCWT.
+@end itemize
+
 @section sbg
 
 SBaGen script demuxer.
diff --git a/libavformat/Makefile b/libavformat/Makefile
index 94a949f555..a6de720d8c 100644
--- a/libavformat/Makefile
+++ b/libavformat/Makefile
@@ -493,6 +493,7 @@ OBJS-$(CONFIG_QOA_DEMUXER)   += qoadec.o
 OBJS-$(CONFIG_R3D_DEMUXER)   += r3d.o
 OBJS-$(CONFIG_RAWVIDEO_DEMUXER)  += rawvideodec.o
 OBJS-$(CONFIG_RAWVIDEO_MUXER)+= rawenc.o
+OBJS-$(CONFIG_RCWT_DEMUXER)  += rcwtdec.o subtitles.o
 OBJS-$(CONFIG_RCWT_MUXER)+= rcwtenc.o subtitles.o
 OBJS-$(CONFIG_REALTEXT_DEMUXER)  += realtextdec.o subtitles.o
 OBJS-$(CONFIG_REDSPARK_DEMUXER)  += redspark.o
diff --git a/libavformat/allformats.c b/libavformat/allformats.c
index e15d0fa6d7..3140018f8d 100644
--- a/libavformat/allformats.c
+++ b/libavformat/allformats.c
@@ -391,6 +391,7 @@ extern const FFInputFormat  ff_qoa_demuxer;
 extern const FFInputFormat  ff_r3d_demuxer;
 extern const FFInputFormat  ff_rawvideo_demuxer;
 extern const FFOutputFormat ff_rawvideo_muxer;
+extern const FFInputFormat  ff_rcwt_demuxer;
 extern const FFOutputFormat ff_rcwt_muxer;
 extern const FFInputFormat  ff_realtext_demuxer;
 extern const FFInputFormat  ff_redspark_demuxer;
diff --git a/libavformat/rcwtdec.c b/libavformat/rcwtdec.c
new file mode 100644
index 00..ca5bdc1940
--- /dev/null
+++ b/libavformat/rcwtdec.c
@@ -0,0 +1,125 @@
+/*
+ * RCWT (Raw Captions With Time) demuxer
+ *
+ * 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
+ */
+
+/*
+ * RCWT (Raw Captions With Time) is a format native to ccextrac

Re: [FFmpeg-devel] [PATCH v7 1/5] avformat/subtitles: extend ff_subtitles_queue_insert() to support empty events

2024-03-20 Thread Marth64
This is in response to the last paragraph of feedback in
https://ffmpeg.org//pipermail/ffmpeg-devel/2024-March/323858.html
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH v7 5/5] doc/indevs: update CC extraction example to use RCWT muxer

2024-03-20 Thread Marth64
Signed-off-by: Marth64 
---
 doc/indevs.texi | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/doc/indevs.texi b/doc/indevs.texi
index d1b2bacf8b..fc14737181 100644
--- a/doc/indevs.texi
+++ b/doc/indevs.texi
@@ -1069,9 +1069,9 @@ ffplay -f lavfi 
"movie=test.avi[out0];amovie=test.wav[out1]"
 @end example
 
 @item
-Dump decoded frames to images and closed captions to a file (experimental):
+Dump decoded frames to images and Closed Captions to an RCWT backup:
 @example
-ffmpeg -f lavfi -i "movie=test.ts[out0+subcc]" -map v frame%08d.png -map s -c 
copy -f rawvideo subcc.bin
+ffmpeg -f lavfi -i "movie=test.ts[out0+subcc]" -map v frame%08d.png -map s -c 
copy subcc.bin
 @end example
 
 @end itemize
-- 
2.34.1

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH v7 4/5] doc/muxers: refresh the RCWT muxer's doc to be consistent with the demuxer

2024-03-20 Thread Marth64
Signed-off-by: Marth64 
---
 doc/muxers.texi | 29 +++--
 1 file changed, 19 insertions(+), 10 deletions(-)

diff --git a/doc/muxers.texi b/doc/muxers.texi
index d9dd72e613..0695a317d4 100644
--- a/doc/muxers.texi
+++ b/doc/muxers.texi
@@ -2987,19 +2987,18 @@ ogg files can be safely chained.
 
 @end table
 
-@anchor{rcwt}
+@anchor{rcwtenc}
 @section rcwt
 
-Raw Captions With Time (RCWT) is a format native to ccextractor, a commonly
-used open source tool for processing 608/708 closed caption (CC) sources.
-It can be used to archive the original, raw CC bitstream and to produce
-a source file for later CC processing or conversion. As a result,
-it also allows for interopability with ccextractor for processing CC data
-extracted via ffmpeg. The format is simple to parse and can be used
-to retain all lines and variants of CC.
+RCWT (Raw Captions With Time) is a format native to ccextractor, a commonly
+used open source tool for processing 608/708 Closed Captions (CC) sources.
+It can be used to archive the original extracted CC bitstream and to produce
+a source file for later processing or conversion. The format allows
+for interoperability between ccextractor and FFmpeg, is simple to parse,
+and can be used to create a backup of the CC presentation.
 
-This muxer implements the specification as of 2024-01-05, which has
-been stable and unchanged for 10 years as of this writing.
+This muxer implements the specification as of March 2024, which has
+been stable and unchanged since April 2014.
 
 This muxer will have some nuances from the way that ccextractor muxes RCWT.
 No compatibility issues when processing the output with ccextractor
@@ -3009,6 +3008,16 @@ and outputs will not be a bit-exact match.
 A free specification of RCWT can be found here:
 
@url{https://github.com/CCExtractor/ccextractor/blob/master/docs/BINARY_FILE_FORMAT.TXT}
 
+@subsection Examples
+
+@itemize
+@item
+Extract Closed Captions to RCWT using lavfi:
+@example
+ffmpeg -f lavfi -i "movie=INPUT.mkv[out+subcc]" -map 0:s:0 -c:s copy 
CC.rcwt.bin
+@end example
+@end itemize
+
 @anchor{segment}
 @section segment, stream_segment, ssegment
 
-- 
2.34.1

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH v7 3/5] avformat/rcwtenc: remove repeated documentation

2024-03-20 Thread Marth64
The high level summary of RCWT can be delegated doc/muxers, which
makes it easier to maintain and more consistent with the documentation
of the demuxer.

Signed-off-by: Marth64 
---
 libavformat/rcwtenc.c | 5 -
 1 file changed, 5 deletions(-)

diff --git a/libavformat/rcwtenc.c b/libavformat/rcwtenc.c
index ed72de81ef..a1a8c06533 100644
--- a/libavformat/rcwtenc.c
+++ b/libavformat/rcwtenc.c
@@ -21,11 +21,6 @@
 /*
  * RCWT (Raw Captions With Time) is a format native to ccextractor, a commonly
  * used open source tool for processing 608/708 Closed Captions (CC) sources.
- * It can be used to archive the original, raw CC bitstream and to produce
- * a source file for later CC processing or conversion. As a result,
- * it also allows for interopability with ccextractor for processing CC data
- * extracted via ffmpeg. The format is simple to parse and can be used
- * to retain all lines and variants of CC.
  *
  * This muxer implements the specification as of March 2024, which has
  * been stable and unchanged since April 2014.
-- 
2.34.1

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH v7 2/5] avformat/rcwtdec: add RCWT Closed Captions demuxer

2024-03-20 Thread Marth64
RCWT (Raw Captions With Time) is a format native to ccextractor,
a commonly used OSS tool for processing 608/708 Closed Captions (CC).
RCWT can be used to archive the original extracted CC bitstream.
The muxer was added in January 2024. In this commit, add the demuxer.

One can now demux RCWT files for rendering in ccaption_dec or interop
with ccextractor (which produces RCWT). Using the muxer/demuxer combo,
the CC bits can be kept for processing or rendering with either tool.
This can be an effective way to backup an original CC stream, including
format extensions like EIA-708 and overall original presentation.

Signed-off-by: Marth64 
---
 Changelog|   2 +-
 doc/demuxers.texi|  30 ++
 libavformat/Makefile |   1 +
 libavformat/allformats.c |   1 +
 libavformat/rcwtdec.c| 123 +++
 5 files changed, 156 insertions(+), 1 deletion(-)
 create mode 100644 libavformat/rcwtdec.c

diff --git a/Changelog b/Changelog
index e3ca52430c..0ae05c6cce 100644
--- a/Changelog
+++ b/Changelog
@@ -19,7 +19,7 @@ version :
 - lavu/eval: introduce randomi() function in expressions
 - VVC decoder
 - fsync filter
-- Raw Captions with Time (RCWT) closed caption muxer
+- RCWT (Raw Captions with Time) Closed Captions muxer and demuxer
 - ffmpeg CLI -bsf option may now be used for input as well as output
 - ffmpeg CLI options may now be used as -/opt , which is equivalent
   to -opt >
diff --git a/doc/demuxers.texi b/doc/demuxers.texi
index b70f3a38d7..b4c4daacd9 100644
--- a/doc/demuxers.texi
+++ b/doc/demuxers.texi
@@ -1038,6 +1038,36 @@ the command:
 ffplay -f rawvideo -pixel_format rgb24 -video_size 320x240 -framerate 10 
input.raw
 @end example
 
+@anchor{rcwtdec}
+@section rcwt
+
+RCWT (Raw Captions With Time) is a format native to ccextractor, a commonly
+used open source tool for processing 608/708 Closed Captions (CC) sources.
+For more information on the format, see @ref{rcwtenc,,,ffmpeg-formats}.
+
+This demuxer implements the specification as of March 2024, which has
+been stable and unchanged since April 2014.
+
+@subsection Examples
+
+@itemize
+@item
+Render Closed Captions to ASS, using the CC decoder (cc_dec):
+@example
+ffmpeg -i CC.rcwt.bin CC.ass
+@end example
+Note that if your output appears to be empty, you may have to manually
+set the decoder's @option{data_field} option to pick the desired CC substream.
+
+@item
+Convert an RCWT backup to SCC format, using the SCC muxer (scc):
+@example
+ffmpeg -i CC.rcwt.bin -c:s copy CC.scc
+@end example
+Note that the SCC format does not support all of the possible CC formats
+that can be stored in RCWT.
+@end itemize
+
 @section sbg
 
 SBaGen script demuxer.
diff --git a/libavformat/Makefile b/libavformat/Makefile
index 94a949f555..a6de720d8c 100644
--- a/libavformat/Makefile
+++ b/libavformat/Makefile
@@ -493,6 +493,7 @@ OBJS-$(CONFIG_QOA_DEMUXER)   += qoadec.o
 OBJS-$(CONFIG_R3D_DEMUXER)   += r3d.o
 OBJS-$(CONFIG_RAWVIDEO_DEMUXER)  += rawvideodec.o
 OBJS-$(CONFIG_RAWVIDEO_MUXER)+= rawenc.o
+OBJS-$(CONFIG_RCWT_DEMUXER)  += rcwtdec.o subtitles.o
 OBJS-$(CONFIG_RCWT_MUXER)+= rcwtenc.o subtitles.o
 OBJS-$(CONFIG_REALTEXT_DEMUXER)  += realtextdec.o subtitles.o
 OBJS-$(CONFIG_REDSPARK_DEMUXER)  += redspark.o
diff --git a/libavformat/allformats.c b/libavformat/allformats.c
index e15d0fa6d7..3140018f8d 100644
--- a/libavformat/allformats.c
+++ b/libavformat/allformats.c
@@ -391,6 +391,7 @@ extern const FFInputFormat  ff_qoa_demuxer;
 extern const FFInputFormat  ff_r3d_demuxer;
 extern const FFInputFormat  ff_rawvideo_demuxer;
 extern const FFOutputFormat ff_rawvideo_muxer;
+extern const FFInputFormat  ff_rcwt_demuxer;
 extern const FFOutputFormat ff_rcwt_muxer;
 extern const FFInputFormat  ff_realtext_demuxer;
 extern const FFInputFormat  ff_redspark_demuxer;
diff --git a/libavformat/rcwtdec.c b/libavformat/rcwtdec.c
new file mode 100644
index 00..e5cd05ea3e
--- /dev/null
+++ b/libavformat/rcwtdec.c
@@ -0,0 +1,123 @@
+/*
+ * RCWT (Raw Captions With Time) demuxer
+ *
+ * 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
+ */
+
+/*
+ * RCWT (Raw Captions With Time) is a format native to ccextrac

[FFmpeg-devel] [PATCH v7 1/5] avformat/subtitles: extend ff_subtitles_queue_insert() to support empty events

2024-03-20 Thread Marth64
If ff_subtitles_queue_insert() were to given a NULL buffer
with 0 length, it would still attempt to grow the packet
or memcpy depending on if merge option is enabled.

In this commit, consider a NULL buffer with 0 length as
an empty event and do not attempt to modify the packet.
This way, if a subtitle demuxer happens to pass an empty
cue or wants to use av_get_packet() to read bytes, there
are no unnecessary operations on the packet after it is
allocated.

Signed-off-by: Marth64 
---
 libavformat/subtitles.c | 4 
 libavformat/subtitles.h | 2 +-
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/libavformat/subtitles.c b/libavformat/subtitles.c
index 3413763c7b..38d2ffb8a9 100644
--- a/libavformat/subtitles.c
+++ b/libavformat/subtitles.c
@@ -117,6 +117,8 @@ AVPacket *ff_subtitles_queue_insert(FFDemuxSubtitlesQueue 
*q,
 int old_len;
 sub = q->subs[q->nb_subs - 1];
 old_len = sub->size;
+if (event == NULL && len == 0)
+return sub;
 if (av_grow_packet(sub, len) < 0)
 return NULL;
 memcpy(sub->data + old_len, event, len);
@@ -140,6 +142,8 @@ AVPacket *ff_subtitles_queue_insert(FFDemuxSubtitlesQueue 
*q,
 subs[q->nb_subs++] = sub;
 sub->flags |= AV_PKT_FLAG_KEY;
 sub->pts = sub->dts = 0;
+if (event == NULL && len == 0)
+return sub;
 memcpy(sub->data, event, len);
 }
 return sub;
diff --git a/libavformat/subtitles.h b/libavformat/subtitles.h
index 88665663c5..ba162fa503 100644
--- a/libavformat/subtitles.h
+++ b/libavformat/subtitles.h
@@ -112,7 +112,7 @@ typedef struct {
 /**
  * Insert a new subtitle event.
  *
- * @param event the subtitle line, may not be zero terminated
+ * @param event the subtitle line (not zero terminated), or NULL on empty event
  * @param len   the length of the event (in strlen() sense, so without '\0')
  * @param merge set to 1 if the current event should be concatenated with the
  *  previous one instead of adding a new entry, 0 otherwise
-- 
2.34.1

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH v7 0/5] RCWT Closed Captions demuxer (meta)

2024-03-20 Thread Marth64
Since v7:
* Demuxer is simplified, reduced to 92 LOC
* Documentation feedback addressed

Signed-off-by: Marth64 
-- 
2.34.1

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [PATCH v6 3/4] doc/{muxers, demuxers}: add RCWT demuxer doc and refresh the muxer's doc to be consistent

2024-03-20 Thread Marth64
> what is ASSA?
This should just be ASS, will update

> let's expand SCC
> for the sake of exclicitness, I'd avoid more acronyms, I'd guess this
> is source Closed Caption?
Actually SCC is a format itself (Scenarist Closed Caption) of which FFmpeg
has a muxer and demuxer.
SCC is one of the standard proprietary formats to exchange Closed Captions.
I'll update the doc to highlight the fact better that this is a different
format.

Thank you for the reviews. Working on updates, will send a v7 when ready.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH v6 4/4] doc/indevs: update CC extraction example to use RCWT muxer

2024-03-19 Thread Marth64
Signed-off-by: Marth64 
---
 doc/indevs.texi | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/doc/indevs.texi b/doc/indevs.texi
index d1b2bacf8b..fc14737181 100644
--- a/doc/indevs.texi
+++ b/doc/indevs.texi
@@ -1069,9 +1069,9 @@ ffplay -f lavfi 
"movie=test.avi[out0];amovie=test.wav[out1]"
 @end example
 
 @item
-Dump decoded frames to images and closed captions to a file (experimental):
+Dump decoded frames to images and Closed Captions to an RCWT backup:
 @example
-ffmpeg -f lavfi -i "movie=test.ts[out0+subcc]" -map v frame%08d.png -map s -c 
copy -f rawvideo subcc.bin
+ffmpeg -f lavfi -i "movie=test.ts[out0+subcc]" -map v frame%08d.png -map s -c 
copy subcc.bin
 @end example
 
 @end itemize
-- 
2.34.1

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH v6 3/4] doc/{muxers, demuxers}: add RCWT demuxer doc and refresh the muxer's doc to be consistent

2024-03-19 Thread Marth64
Signed-off-by: Marth64 
---
 doc/demuxers.texi | 26 ++
 doc/muxers.texi   | 29 +++--
 2 files changed, 45 insertions(+), 10 deletions(-)

diff --git a/doc/demuxers.texi b/doc/demuxers.texi
index b70f3a38d7..47e82eda55 100644
--- a/doc/demuxers.texi
+++ b/doc/demuxers.texi
@@ -1038,6 +1038,32 @@ the command:
 ffplay -f rawvideo -pixel_format rgb24 -video_size 320x240 -framerate 10 
input.raw
 @end example
 
+@anchor{rcwtdec}
+@section rcwt
+
+RCWT (Raw Captions With Time) is a format native to ccextractor, a commonly
+used open source tool for processing 608/708 Closed Captions (CC) sources.
+For more information on the format, see @ref{rcwtenc,,,ffmpeg-formats}.
+
+This demuxer implements the specification as of March 2024, which has
+been stable and unchanged since April 2014.
+
+@subsection Examples
+
+@itemize
+@item
+Render Closed Captions to ASSA (using FFmpeg's CC decoder):
+@example
+ffmpeg -i CC.rcwt.bin CC.ass
+@end example
+
+@item
+Convert an RCWT backup to SCC:
+@example
+ffmpeg -i CC.rcwt.bin -c:s copy CC.scc
+@end example
+@end itemize
+
 @section sbg
 
 SBaGen script demuxer.
diff --git a/doc/muxers.texi b/doc/muxers.texi
index d9dd72e613..0695a317d4 100644
--- a/doc/muxers.texi
+++ b/doc/muxers.texi
@@ -2987,19 +2987,18 @@ ogg files can be safely chained.
 
 @end table
 
-@anchor{rcwt}
+@anchor{rcwtenc}
 @section rcwt
 
-Raw Captions With Time (RCWT) is a format native to ccextractor, a commonly
-used open source tool for processing 608/708 closed caption (CC) sources.
-It can be used to archive the original, raw CC bitstream and to produce
-a source file for later CC processing or conversion. As a result,
-it also allows for interopability with ccextractor for processing CC data
-extracted via ffmpeg. The format is simple to parse and can be used
-to retain all lines and variants of CC.
+RCWT (Raw Captions With Time) is a format native to ccextractor, a commonly
+used open source tool for processing 608/708 Closed Captions (CC) sources.
+It can be used to archive the original extracted CC bitstream and to produce
+a source file for later processing or conversion. The format allows
+for interoperability between ccextractor and FFmpeg, is simple to parse,
+and can be used to create a backup of the CC presentation.
 
-This muxer implements the specification as of 2024-01-05, which has
-been stable and unchanged for 10 years as of this writing.
+This muxer implements the specification as of March 2024, which has
+been stable and unchanged since April 2014.
 
 This muxer will have some nuances from the way that ccextractor muxes RCWT.
 No compatibility issues when processing the output with ccextractor
@@ -3009,6 +3008,16 @@ and outputs will not be a bit-exact match.
 A free specification of RCWT can be found here:
 
@url{https://github.com/CCExtractor/ccextractor/blob/master/docs/BINARY_FILE_FORMAT.TXT}
 
+@subsection Examples
+
+@itemize
+@item
+Extract Closed Captions to RCWT using lavfi:
+@example
+ffmpeg -f lavfi -i "movie=INPUT.mkv[out+subcc]" -map 0:s:0 -c:s copy 
CC.rcwt.bin
+@end example
+@end itemize
+
 @anchor{segment}
 @section segment, stream_segment, ssegment
 
-- 
2.34.1

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH v6 2/4] avformat/rcwtenc: remove repeated documentation

2024-03-19 Thread Marth64
The high level summary of RCWT can be delegated doc/muxers, which
makes it easier to maintain and more consistent with the documentation
of the demuxer.

Signed-off-by: Marth64 
---
 libavformat/rcwtenc.c | 5 -
 1 file changed, 5 deletions(-)

diff --git a/libavformat/rcwtenc.c b/libavformat/rcwtenc.c
index ed72de81ef..a1a8c06533 100644
--- a/libavformat/rcwtenc.c
+++ b/libavformat/rcwtenc.c
@@ -21,11 +21,6 @@
 /*
  * RCWT (Raw Captions With Time) is a format native to ccextractor, a commonly
  * used open source tool for processing 608/708 Closed Captions (CC) sources.
- * It can be used to archive the original, raw CC bitstream and to produce
- * a source file for later CC processing or conversion. As a result,
- * it also allows for interopability with ccextractor for processing CC data
- * extracted via ffmpeg. The format is simple to parse and can be used
- * to retain all lines and variants of CC.
  *
  * This muxer implements the specification as of March 2024, which has
  * been stable and unchanged since April 2014.
-- 
2.34.1

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH v6 1/4] avformat/rcwtdec: add RCWT Closed Captions demuxer

2024-03-19 Thread Marth64
Raw Captions With Time (RCWT) is a format native to ccextractor, a commonly
used open source tool for processing 608/708 Closed Captions (CC) sources.
RCWT can be used to archive the original CC bitstream. The muxer was added
in January 2024. In this commit, add the demuxer.

One can now demux RCWT files for rendering in ccaption_dec or interoperate
with ccextractor (which produces RCWT). Using the muxer/demuxer combination,
the CC bits can be kept for further processing or rendering with either tool.
This can be an effective approach to backup original CC presentations.

Prior to this, the next best solution was FFmpeg's SCC muxer, but SCC itself
is not compatible with ccextractor (which is a de facto OSS CC processing tool)
and it is a proprietary format.

Tests will follow.

Signed-off-by: Marth64 
---
 Changelog|   2 +-
 libavformat/Makefile |   1 +
 libavformat/allformats.c |   1 +
 libavformat/rcwtdec.c| 150 +++
 4 files changed, 153 insertions(+), 1 deletion(-)
 create mode 100644 libavformat/rcwtdec.c

diff --git a/Changelog b/Changelog
index e3ca52430c..abe5f79b85 100644
--- a/Changelog
+++ b/Changelog
@@ -19,7 +19,7 @@ version :
 - lavu/eval: introduce randomi() function in expressions
 - VVC decoder
 - fsync filter
-- Raw Captions with Time (RCWT) closed caption muxer
+- RCWT (Raw Captions with Time) Closed Captions muxer and demuxer
 - ffmpeg CLI -bsf option may now be used for input as well as output
 - ffmpeg CLI options may now be used as -/opt , which is equivalent
   to -opt >
diff --git a/libavformat/Makefile b/libavformat/Makefile
index 94a949f555..a6de720d8c 100644
--- a/libavformat/Makefile
+++ b/libavformat/Makefile
@@ -493,6 +493,7 @@ OBJS-$(CONFIG_QOA_DEMUXER)   += qoadec.o
 OBJS-$(CONFIG_R3D_DEMUXER)   += r3d.o
 OBJS-$(CONFIG_RAWVIDEO_DEMUXER)  += rawvideodec.o
 OBJS-$(CONFIG_RAWVIDEO_MUXER)+= rawenc.o
+OBJS-$(CONFIG_RCWT_DEMUXER)  += rcwtdec.o subtitles.o
 OBJS-$(CONFIG_RCWT_MUXER)+= rcwtenc.o subtitles.o
 OBJS-$(CONFIG_REALTEXT_DEMUXER)  += realtextdec.o subtitles.o
 OBJS-$(CONFIG_REDSPARK_DEMUXER)  += redspark.o
diff --git a/libavformat/allformats.c b/libavformat/allformats.c
index e15d0fa6d7..3140018f8d 100644
--- a/libavformat/allformats.c
+++ b/libavformat/allformats.c
@@ -391,6 +391,7 @@ extern const FFInputFormat  ff_qoa_demuxer;
 extern const FFInputFormat  ff_r3d_demuxer;
 extern const FFInputFormat  ff_rawvideo_demuxer;
 extern const FFOutputFormat ff_rawvideo_muxer;
+extern const FFInputFormat  ff_rcwt_demuxer;
 extern const FFOutputFormat ff_rcwt_muxer;
 extern const FFInputFormat  ff_realtext_demuxer;
 extern const FFInputFormat  ff_redspark_demuxer;
diff --git a/libavformat/rcwtdec.c b/libavformat/rcwtdec.c
new file mode 100644
index 00..0d9eba025a
--- /dev/null
+++ b/libavformat/rcwtdec.c
@@ -0,0 +1,150 @@
+/*
+ * RCWT (Raw Captions With Time) demuxer
+ *
+ * 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
+ */
+
+/*
+ * RCWT (Raw Captions With Time) is a format native to ccextractor, a commonly
+ * used open source tool for processing 608/708 Closed Captions (CC) sources.
+ *
+ * This demuxer implements the specification as of March 2024, which has
+ * been stable and unchanged since April 2014.
+ *
+ * A free specification of RCWT can be found here:
+ * 
@url{https://github.com/CCExtractor/ccextractor/blob/master/docs/BINARY_FILE_FORMAT.TXT}
+ */
+
+#include "avformat.h"
+#include "demux.h"
+#include "internal.h"
+#include "subtitles.h"
+#include "libavutil/intreadwrite.h"
+
+#define RCWT_CLUSTER_MAX_BLOCKS 65535
+#define RCWT_BLOCK_SIZE 3
+#define RCWT_HEADER_SIZE11
+
+typedef struct RCWTContext {
+FFDemuxSubtitlesQueue q;
+} RCWTContext;
+
+static int rcwt_read_header(AVFormatContext *avf)
+{
+RCWTContext *rcwt = avf->priv_data;
+
+AVPacket  *sub = NULL;
+AVStream  *st;
+uint8_t   header[RCWT_HEADER_SIZE] = {0};
+int   nb_bytes = 0;
+
+/* validate the header */
+nb_bytes = avio_read(avf->pb, header, RCWT_HEADER_SIZE);
+if (nb_bytes != RCW

[FFmpeg-devel] [PATCH v6 0/4] RCWT Closed Captions demuxer (meta)

2024-03-19 Thread Marth64
Since v5:
* probe check is more strict, passes probetest fuzz
* documentation typos

Signed-off-by: Marth64 
-- 
2.34.1

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [PATCH v5 1/4] avformat/rcwtdec: add RCWT Closed Captions demuxer

2024-03-19 Thread Marth64
Yes, v6 is on the way with fix (validated working with probetest parameters
above). I can check the format version, of which there is only 1 known
version.

Thanks for catching this.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [PATCH v4 0/4] Fix some active sequences in subtitles

2024-03-19 Thread Marth64
Hi Oneric,

I was able to validate the whole set. Here are the tests I did ...
(1) test conversion from vtt->ass with bidi mark and visually check display
-- pass
(2) test slash escape fix with a string e.g. \\Nancy, verify broken before
and fixed by patch -- pass
(3) test curly brace escape fix doesn't break SRT titles with ass
positioning tags -- pass
(4) compare sha256sum before/after results for line breaks change -- pass

LGTM from a validation perspective on a Linux machine.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH v5 4/4] doc/indevs: update CC extraction example to use RCWT muxer

2024-03-19 Thread Marth64
Signed-off-by: Marth64 
---
 doc/indevs.texi | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/doc/indevs.texi b/doc/indevs.texi
index d1b2bacf8b..fc14737181 100644
--- a/doc/indevs.texi
+++ b/doc/indevs.texi
@@ -1069,9 +1069,9 @@ ffplay -f lavfi 
"movie=test.avi[out0];amovie=test.wav[out1]"
 @end example
 
 @item
-Dump decoded frames to images and closed captions to a file (experimental):
+Dump decoded frames to images and Closed Captions to an RCWT backup:
 @example
-ffmpeg -f lavfi -i "movie=test.ts[out0+subcc]" -map v frame%08d.png -map s -c 
copy -f rawvideo subcc.bin
+ffmpeg -f lavfi -i "movie=test.ts[out0+subcc]" -map v frame%08d.png -map s -c 
copy subcc.bin
 @end example
 
 @end itemize
-- 
2.34.1

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH v5 3/4] doc/muxers: refresh and simplify RCWT muxer documentation

2024-03-19 Thread Marth64
Signed-off-by: Marth64 
---
 doc/muxers.texi | 25 +
 1 file changed, 17 insertions(+), 8 deletions(-)

diff --git a/doc/muxers.texi b/doc/muxers.texi
index d9dd72e613..9e8de3dc42 100644
--- a/doc/muxers.texi
+++ b/doc/muxers.texi
@@ -2987,16 +2987,15 @@ ogg files can be safely chained.
 
 @end table
 
-@anchor{rcwt}
+@anchor{rcwtenc}
 @section rcwt
 
 Raw Captions With Time (RCWT) is a format native to ccextractor, a commonly
-used open source tool for processing 608/708 closed caption (CC) sources.
-It can be used to archive the original, raw CC bitstream and to produce
-a source file for later CC processing or conversion. As a result,
-it also allows for interopability with ccextractor for processing CC data
-extracted via ffmpeg. The format is simple to parse and can be used
-to retain all lines and variants of CC.
+used open source tool for processing 608/708 Closed Captions (CC) sources.
+It can be used to archive the original extracted CC bitstream and to produce
+a source file for later processing or conversion. The format allows
+for interopability between ccextractor and FFmpeg, is simple to parse,
+and can be used to create a backup of the CC presentation.
 
 This muxer implements the specification as of 2024-01-05, which has
 been stable and unchanged for 10 years as of this writing.
@@ -3006,9 +3005,19 @@ No compatibility issues when processing the output with 
ccextractor
 have been observed as a result of this so far, but mileage may vary
 and outputs will not be a bit-exact match.
 
-A free specification of RCWT can be found here:
+A free specification of RCWT can be found at:
 
@url{https://github.com/CCExtractor/ccextractor/blob/master/docs/BINARY_FILE_FORMAT.TXT}
 
+@subsection Examples
+
+@itemize
+@item
+Extract Closed Captions to RCWT using lavfi:
+@example
+ffmpeg -f lavfi -i "movie=INPUT.mkv[out+subcc]" -map 0:s:0 -c:s copy 
CC.rcwt.bin
+@end example
+@end itemize
+
 @anchor{segment}
 @section segment, stream_segment, ssegment
 
-- 
2.34.1

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH v5 2/4] avformat/rcwtenc: remove repeated documentation

2024-03-19 Thread Marth64
The high level summary of RCWT can be delegated doc/muxers, which
makes it easier to maintain and more consistent with the documentation
of the demuxer.

Signed-off-by: Marth64 
---
 libavformat/rcwtenc.c | 5 -
 1 file changed, 5 deletions(-)

diff --git a/libavformat/rcwtenc.c b/libavformat/rcwtenc.c
index ed72de81ef..a1a8c06533 100644
--- a/libavformat/rcwtenc.c
+++ b/libavformat/rcwtenc.c
@@ -21,11 +21,6 @@
 /*
  * RCWT (Raw Captions With Time) is a format native to ccextractor, a commonly
  * used open source tool for processing 608/708 Closed Captions (CC) sources.
- * It can be used to archive the original, raw CC bitstream and to produce
- * a source file for later CC processing or conversion. As a result,
- * it also allows for interopability with ccextractor for processing CC data
- * extracted via ffmpeg. The format is simple to parse and can be used
- * to retain all lines and variants of CC.
  *
  * This muxer implements the specification as of March 2024, which has
  * been stable and unchanged since April 2014.
-- 
2.34.1

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH v5 1/4] avformat/rcwtdec: add RCWT Closed Captions demuxer

2024-03-19 Thread Marth64
Signed-off-by: Marth64 
---
 Changelog|   2 +-
 doc/demuxers.texi|  29 
 libavformat/Makefile |   1 +
 libavformat/allformats.c |   1 +
 libavformat/rcwtdec.c| 148 +++
 5 files changed, 180 insertions(+), 1 deletion(-)
 create mode 100644 libavformat/rcwtdec.c

diff --git a/Changelog b/Changelog
index e3ca52430c..be871f75cd 100644
--- a/Changelog
+++ b/Changelog
@@ -19,7 +19,7 @@ version :
 - lavu/eval: introduce randomi() function in expressions
 - VVC decoder
 - fsync filter
-- Raw Captions with Time (RCWT) closed caption muxer
+- Raw Captions with Time (RCWT) closed caption muxer and demuxer
 - ffmpeg CLI -bsf option may now be used for input as well as output
 - ffmpeg CLI options may now be used as -/opt , which is equivalent
   to -opt >
diff --git a/doc/demuxers.texi b/doc/demuxers.texi
index b70f3a38d7..26d4ba18a1 100644
--- a/doc/demuxers.texi
+++ b/doc/demuxers.texi
@@ -1038,6 +1038,35 @@ the command:
 ffplay -f rawvideo -pixel_format rgb24 -video_size 320x240 -framerate 10 
input.raw
 @end example
 
+@anchor{rcwtdec}
+@section rcwt
+
+RCWT (Raw Captions With Time) is a format native to ccextractor, a commonly
+used open source tool for processing 608/708 Closed Captions (CC) sources.
+It can be used to archive the original, raw CC bitstream and to produce
+a source file for later CC processing or conversion. This demuxer can process
+RCWT sources created by ccextractor or FFmpeg. For more information on the 
format,
+see @ref{rcwtenc,,,ffmpeg-formats}.
+
+This demuxer implements the specification as of March 2024, which has
+been stable and unchanged since April 2014.
+
+@subsection Examples
+
+@itemize
+@item
+Render Closed Captions to ASSA (using FFmpeg's CC decoder):
+@example
+ffmpeg -i CC.rcwt.bin CC.ass
+@end example
+
+@item
+Convert an RCWT backup to SCC:
+@example
+ffmpeg -i CC.rcwt.bin -c:s copy CC.scc
+@end example
+@end itemize
+
 @section sbg
 
 SBaGen script demuxer.
diff --git a/libavformat/Makefile b/libavformat/Makefile
index 94a949f555..a6de720d8c 100644
--- a/libavformat/Makefile
+++ b/libavformat/Makefile
@@ -493,6 +493,7 @@ OBJS-$(CONFIG_QOA_DEMUXER)   += qoadec.o
 OBJS-$(CONFIG_R3D_DEMUXER)   += r3d.o
 OBJS-$(CONFIG_RAWVIDEO_DEMUXER)  += rawvideodec.o
 OBJS-$(CONFIG_RAWVIDEO_MUXER)+= rawenc.o
+OBJS-$(CONFIG_RCWT_DEMUXER)  += rcwtdec.o subtitles.o
 OBJS-$(CONFIG_RCWT_MUXER)+= rcwtenc.o subtitles.o
 OBJS-$(CONFIG_REALTEXT_DEMUXER)  += realtextdec.o subtitles.o
 OBJS-$(CONFIG_REDSPARK_DEMUXER)  += redspark.o
diff --git a/libavformat/allformats.c b/libavformat/allformats.c
index e15d0fa6d7..3140018f8d 100644
--- a/libavformat/allformats.c
+++ b/libavformat/allformats.c
@@ -391,6 +391,7 @@ extern const FFInputFormat  ff_qoa_demuxer;
 extern const FFInputFormat  ff_r3d_demuxer;
 extern const FFInputFormat  ff_rawvideo_demuxer;
 extern const FFOutputFormat ff_rawvideo_muxer;
+extern const FFInputFormat  ff_rcwt_demuxer;
 extern const FFOutputFormat ff_rcwt_muxer;
 extern const FFInputFormat  ff_realtext_demuxer;
 extern const FFInputFormat  ff_redspark_demuxer;
diff --git a/libavformat/rcwtdec.c b/libavformat/rcwtdec.c
new file mode 100644
index 00..1baa571231
--- /dev/null
+++ b/libavformat/rcwtdec.c
@@ -0,0 +1,148 @@
+/*
+ * RCWT (Raw Captions With Time) demuxer
+ *
+ * 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
+ */
+
+/*
+ * RCWT (Raw Captions With Time) is a format native to ccextractor, a commonly
+ * used open source tool for processing 608/708 Closed Captions (CC) sources.
+ *
+ * This demuxer implements the specification as of March 2024, which has
+ * been stable and unchanged since April 2014.
+ *
+ * A free specification of RCWT can be found here:
+ * 
@url{https://github.com/CCExtractor/ccextractor/blob/master/docs/BINARY_FILE_FORMAT.TXT}
+ */
+
+#include "avformat.h"
+#include "demux.h"
+#include "internal.h"
+#include "subtitles.h"
+#include "libavutil/intreadwrite.h"
+
+#define RCWT_CLUSTER_MAX_BLOCKS 65535
+#define RCWT_BLOCK_SIZE 3
+#define RCWT_HEADER_SIZE11
+
+type

Re: [FFmpeg-devel] [PATCH v4] avformat/rcwtdec: add RCWT Closed Captions demuxer

2024-03-19 Thread Marth64
Thank you, v5 on the way with documentation updates and examples.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [PATCH v4] avformat/rcwtdec: add RCWT Closed Captions demuxer

2024-03-18 Thread Marth64
Bump on this small demuxer if possible. v4 in the last reply. Thank you.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH v4] avformat/rcwtdec: add RCWT Closed Captions demuxer

2024-03-16 Thread Marth64
Raw Captions With Time (RCWT) is a format native to ccextractor, a commonly
used open source tool for processing 608/708 Closed Captions (CC) sources.
RCWT can be used to archive the original CC bitstream. The muxer was added
in January 2024. In this commit, add the demuxer.

One can now demux RCWT files for rendering in ccaption_dec or interoperate
with ccextractor (which produces RCWT). Using the muxer/demuxer combination,
the CC bits can be kept for further processing or rendering with either tool.
This can be an effective approach to backup original CC presentations.

Prior to this, the next best solution was FFmpeg's SCC muxer, but SCC itself
is not compatible with ccextractor (which is a de facto OSS CC processing tool)
and it is a proprietary format.

Tests will follow.

Signed-off-by: Marth64 
---
 libavformat/Makefile |   1 +
 libavformat/allformats.c |   1 +
 libavformat/rcwtdec.c| 153 +++
 3 files changed, 155 insertions(+)
 create mode 100644 libavformat/rcwtdec.c

diff --git a/libavformat/Makefile b/libavformat/Makefile
index 94a949f555..a6de720d8c 100644
--- a/libavformat/Makefile
+++ b/libavformat/Makefile
@@ -493,6 +493,7 @@ OBJS-$(CONFIG_QOA_DEMUXER)   += qoadec.o
 OBJS-$(CONFIG_R3D_DEMUXER)   += r3d.o
 OBJS-$(CONFIG_RAWVIDEO_DEMUXER)  += rawvideodec.o
 OBJS-$(CONFIG_RAWVIDEO_MUXER)+= rawenc.o
+OBJS-$(CONFIG_RCWT_DEMUXER)  += rcwtdec.o subtitles.o
 OBJS-$(CONFIG_RCWT_MUXER)+= rcwtenc.o subtitles.o
 OBJS-$(CONFIG_REALTEXT_DEMUXER)  += realtextdec.o subtitles.o
 OBJS-$(CONFIG_REDSPARK_DEMUXER)  += redspark.o
diff --git a/libavformat/allformats.c b/libavformat/allformats.c
index e15d0fa6d7..3140018f8d 100644
--- a/libavformat/allformats.c
+++ b/libavformat/allformats.c
@@ -391,6 +391,7 @@ extern const FFInputFormat  ff_qoa_demuxer;
 extern const FFInputFormat  ff_r3d_demuxer;
 extern const FFInputFormat  ff_rawvideo_demuxer;
 extern const FFOutputFormat ff_rawvideo_muxer;
+extern const FFInputFormat  ff_rcwt_demuxer;
 extern const FFOutputFormat ff_rcwt_muxer;
 extern const FFInputFormat  ff_realtext_demuxer;
 extern const FFInputFormat  ff_redspark_demuxer;
diff --git a/libavformat/rcwtdec.c b/libavformat/rcwtdec.c
new file mode 100644
index 00..1fd35be41b
--- /dev/null
+++ b/libavformat/rcwtdec.c
@@ -0,0 +1,153 @@
+/*
+ * RCWT (Raw Captions With Time) demuxer
+ *
+ * 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
+ */
+
+/*
+ * RCWT (Raw Captions With Time) is a format native to ccextractor, a commonly
+ * used open source tool for processing 608/708 Closed Captions (CC) sources.
+ * It can be used to archive the original, raw CC bitstream and to produce
+ * a source file for later CC processing or conversion. As a result,
+ * it also allows for interopability with ccextractor for processing CC data
+ * extracted via ffmpeg. The format is simple to parse and can be used
+ * to retain all lines and variants of CC.
+ *
+ * This demuxer implements the specification as of March 2024, which has
+ * been stable and unchanged since April 2014.
+ *
+ * A free specification of RCWT can be found here:
+ * 
@url{https://github.com/CCExtractor/ccextractor/blob/master/docs/BINARY_FILE_FORMAT.TXT}
+ */
+
+#include "avformat.h"
+#include "demux.h"
+#include "internal.h"
+#include "subtitles.h"
+#include "libavutil/intreadwrite.h"
+
+#define RCWT_CLUSTER_MAX_BLOCKS 65535
+#define RCWT_BLOCK_SIZE 3
+#define RCWT_HEADER_SIZE11
+
+typedef struct RCWTContext {
+FFDemuxSubtitlesQueue q;
+} RCWTContext;
+
+static int rcwt_read_header(AVFormatContext *avf)
+{
+RCWTContext *rcwt = avf->priv_data;
+
+AVPacket  *sub = NULL;
+AVStream  *st;
+uint8_t   header[RCWT_HEADER_SIZE] = {0};
+int   nb_bytes = 0;
+
+/* validate the header */
+nb_bytes = avio_read(avf->pb, header, RCWT_HEADER_SIZE);
+if (nb_bytes != RCWT_HEADER_SIZE) {
+av_log(avf, AV_LOG_ERROR, "Header does not have the expected size "
+  "(expected=%d actual=%d)\n",
+  

Re: [FFmpeg-devel] [PATCH v3 3/6] avcodec/ccaption_dec: ignore leading non-breaking spaces

2024-03-16 Thread Marth64
Hi Stefano,

I would like to withdraw this patch for now.
I have found content where this breaks center
justified text further (which is already not supported).

I will instead try to implement center justification
and incorporate this through that route.

Please ignore it.

Thank you for understanding,
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [PATCH] fftools/opt_common: remove dead code in print_buildconf()

2024-03-12 Thread Marth64
I get it now. Disregard patch. Thanks.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [PATCH] fftools/opt_common: remove dead code in print_buildconf()

2024-03-12 Thread Marth64
> The code block changes str and str is later accessed (via splitconf).
Sorry, for the lack of awareness, but I am confused how.
strstr() shouldn't modify the string right?
The only change I see is in the unused remove_tilde[]

Thank you, for taking a look and explaining.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH] fftools/opt_common: remove dead code in print_buildconf()

2024-03-12 Thread Marth64
I found this code block when looking at this warning thrown in my
compiler (gcc 11.4.0 x86_64-linux-gnu):

```
In function ‘print_buildconf’,
inlined from ‘show_buildconf’ at fftools/opt_common.c:260:5:
fftools/opt_common.c:226:49: warning: writing 1 byte into a region of size 0 
[-Wstringop-overflow=]
  226 | remove_tilde[sizeof("pkg-config~") - 2] = ' ';
  | ^
fftools/opt_common.c: In function ‘show_buildconf’:
fftools/opt_common.c:214:10: note: at offset [10, 11] into destination object 
‘str’ of size 1
  214 | char str[] = { FFMPEG_CONFIGURATION };
  |  ^~~
```

Upon further inspection, I am convinced that remove_tilde does not serve
a functional purpose. There are no other occurences in the FFmpeg
tree via grep, and we are setting a value in it but never using.
The original code traces back to 69cf626f9c1ba29e66ff62e2b835dcfc3031db8d
and even there, I cannot find a purpose for it.

Remove the variable and it's related loop where the assignment occurs,
which resolves the warning.

Signed-off-by: Marth64 
---
 fftools/opt_common.c | 8 +---
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/fftools/opt_common.c b/fftools/opt_common.c
index 947a226d8d..e4a63f565e 100644
--- a/fftools/opt_common.c
+++ b/fftools/opt_common.c
@@ -212,7 +212,7 @@ static void print_buildconf(int flags, int level)
 {
 const char *indent = flags & INDENT ? "  " : "";
 char str[] = { FFMPEG_CONFIGURATION };
-char *conflist, *remove_tilde, *splitconf;
+char *conflist, *splitconf;
 
 // Change all the ' --' strings to '~--' so that
 // they can be identified as tokens.
@@ -220,12 +220,6 @@ static void print_buildconf(int flags, int level)
 conflist[0] = '~';
 }
 
-// Compensate for the weirdness this would cause
-// when passing 'pkg-config --static'.
-while ((remove_tilde = strstr(str, "pkg-config~")) != NULL) {
-remove_tilde[sizeof("pkg-config~") - 2] = ' ';
-}
-
 splitconf = strtok(str, "~");
 av_log(NULL, level, "\n%sconfiguration:\n", indent);
 while (splitconf != NULL) {
-- 
2.34.1

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] Indefinite ban request [RFC] Was: Re: [FFmpeg-trac] #10882(undetermined:new): swscale wastefully scales luma during yuv420p -> yuv422p

2024-03-12 Thread Marth64
I have not interacted with this user and I am just a mediocre contributor.
But from my experience running forums and IRC networks in the past,
this always ends in one process...

   1. toxic user comes along
   2. upsets people repeatedly, which also wastes time
   3. admins ponder ban, which wastes time
   4. they get banned anyway
   5. repeat for the next toxic user that comes along

imo you have the right to /mode +b toxic_user!*@*
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [PATCH 1/2] doc/muxers: add film_cpk

2024-03-12 Thread Marth64
> SEGA FILM (.cpk) muxer.
> This format was used as internal format for several SEGA games.
> For more information regarding the Sega FILM file format

(trivial nit) Sega should be capitalized SEGA I believe, this would make it
consistent in all 3 lines.
But it's still fine.

LGTM.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [PATCH] doc/muxers: add flac

2024-03-12 Thread Marth64
LGTM

On Tue, Mar 12, 2024 at 4:01 PM Stefano Sabatini  wrote:

> ---
>  doc/muxers.texi | 11 +++
>  1 file changed, 11 insertions(+)
>
> diff --git a/doc/muxers.texi b/doc/muxers.texi
> index de4b9b01f5..64d9221198 100644
> --- a/doc/muxers.texi
> +++ b/doc/muxers.texi
> @@ -1612,6 +1612,17 @@ This image format is used to store astronomical
> data.
>  For more information regarding the format, visit
>  @url{https://fits.gsfc.nasa.gov}.
>
> +@section flac
> +Raw FLAC audio muxer.
> +
> +This muxer accepts exactly one FLAC audio stream. Additionally, it is
> possible to add a
> +single 32x32 PNG image as attached picture.
> +
> +@table @option
> +@item write_header @var{bool}
> +write the file header if set to @code{true}, default is @code{true}
> +@end table
> +
>  @section flv
>
>  Adobe Flash Video Format muxer.
> --
> 2.34.1
>
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
>
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH v3] avformat/dvdvideodec: use int64_t for menu blocks_read and make format expressions portable

2024-03-12 Thread Marth64
Signed-off-by: Marth64 
---
 libavformat/dvdvideodec.c | 15 ---
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/libavformat/dvdvideodec.c b/libavformat/dvdvideodec.c
index a182f95097..761ac97ec6 100644
--- a/libavformat/dvdvideodec.c
+++ b/libavformat/dvdvideodec.c
@@ -392,7 +392,7 @@ static int dvdvideo_menu_next_ps_block(AVFormatContext *s, 
DVDVideoPlaybackState
uint8_t *buf, int buf_size,
void (*flush_cb)(AVFormatContext *s))
 {
-ssize_t blocks_read   = 0;
+int64_t blocks_read   = 0;
 uint8_t read_buf[DVDVIDEO_BLOCK_SIZE] = {0};
 pci_t pci = (pci_t) {0};
 dsi_t dsi = (dsi_t) {0};
@@ -423,7 +423,7 @@ static int dvdvideo_menu_next_ps_block(AVFormatContext *s, 
DVDVideoPlaybackState
 
 blocks_read = DVDReadBlocks(state->vob_file, state->sector_offset, 1, 
read_buf);
 if (blocks_read != 1) {
-av_log(s, AV_LOG_ERROR, "Unable to read VOB block: offset=%d 
blocks_read=%d\n",
+av_log(s, AV_LOG_ERROR, "Unable to read VOB block: offset=%d 
blocks_read=%" PRId64 "\n",
 state->sector_offset, blocks_read);
 
 return AVERROR_INVALIDDATA;
@@ -475,7 +475,7 @@ static int dvdvideo_menu_next_ps_block(AVFormatContext *s, 
DVDVideoPlaybackState
 state->vobu_e_ptm= pci.pci_gi.vobu_e_ptm;
 
 av_log(s, AV_LOG_DEBUG, "NAV packet: sector=%d "
-"vobu_s_ptm=%d vobu_e_ptm=%d ts_offset=%ld\n",
+"vobu_s_ptm=%d vobu_e_ptm=%d ts_offset=%" 
PRId64 "\n",
 dsi.dsi_gi.nv_pck_lbn,
 pci.pci_gi.vobu_s_ptm, pci.pci_gi.vobu_e_ptm, 
state->ts_offset);
 
@@ -758,7 +758,7 @@ static int dvdvideo_play_next_ps_block(AVFormatContext *s, 
DVDVideoPlaybackState
 
 av_log(s, AV_LOG_DEBUG,
"NAV packet: s_ptm=%d e_ptm=%d "
-   "scr=%d lbn=%d vobu_duration=%d nav_pts=%ld\n",
+   "scr=%d lbn=%d vobu_duration=%d nav_pts=%" PRId64 "\n",
e_pci->pci_gi.vobu_s_ptm, e_pci->pci_gi.vobu_e_ptm,
e_dsi->dsi_gi.nv_pck_scr,
e_pci->pci_gi.nv_pck_lbn, state->vobu_duration, 
state->nav_pts);
@@ -1639,18 +1639,19 @@ static int dvdvideo_read_packet(AVFormatContext *s, 
AVPacket *pkt)
 pkt->dts += c->play_state.ts_offset - c->first_pts;
 
 if (pkt->pts < 0) {
-av_log(s, AV_LOG_VERBOSE, "Discarding packet with negative PTS 
(st=%d pts=%ld), "
+av_log(s, AV_LOG_VERBOSE, "Discarding packet with negative PTS 
(st=%d pts=%" PRId64 "), "
   "this is OK at start of playback\n",
   pkt->stream_index, pkt->pts);
 
 return FFERROR_REDO;
 }
 } else {
-av_log(s, AV_LOG_WARNING, "Unset PTS or DTS @ st=%d pts=%ld dts=%ld\n",
+av_log(s, AV_LOG_WARNING, "Unset PTS or DTS @ st=%d pts=%" PRId64 " 
dts=%" PRId64 "\n",
   pkt->stream_index, pkt->pts, pkt->dts);
 }
 
-av_log(s, AV_LOG_TRACE, "st=%d pts=%ld dts=%ld ts_offset=%ld 
first_pts=%ld\n",
+av_log(s, AV_LOG_TRACE, "st=%d pts=%" PRId64 " dts=%" PRId64 " "
+"ts_offset=%" PRId64 " first_pts=%" PRId64 "\n",
 pkt->stream_index, pkt->pts, pkt->dts,
 c->play_state.ts_offset, c->first_pts);
 
-- 
2.34.1

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [PATCH v2] avformat/dvdvideodec: use int64_t for menu blocks_read and fix format statement

2024-03-12 Thread Marth64
Fix on the way with PRId64
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH v2] avformat/dvdvideodec: use int64_t for menu blocks_read and fix format statement

2024-03-12 Thread Marth64
Signed-off-by: Marth64 
---
 libavformat/dvdvideodec.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavformat/dvdvideodec.c b/libavformat/dvdvideodec.c
index a182f95097..19efc068cb 100644
--- a/libavformat/dvdvideodec.c
+++ b/libavformat/dvdvideodec.c
@@ -392,7 +392,7 @@ static int dvdvideo_menu_next_ps_block(AVFormatContext *s, 
DVDVideoPlaybackState
uint8_t *buf, int buf_size,
void (*flush_cb)(AVFormatContext *s))
 {
-ssize_t blocks_read   = 0;
+int64_t blocks_read   = 0;
 uint8_t read_buf[DVDVIDEO_BLOCK_SIZE] = {0};
 pci_t pci = (pci_t) {0};
 dsi_t dsi = (dsi_t) {0};
@@ -423,7 +423,7 @@ static int dvdvideo_menu_next_ps_block(AVFormatContext *s, 
DVDVideoPlaybackState
 
 blocks_read = DVDReadBlocks(state->vob_file, state->sector_offset, 1, 
read_buf);
 if (blocks_read != 1) {
-av_log(s, AV_LOG_ERROR, "Unable to read VOB block: offset=%d 
blocks_read=%d\n",
+av_log(s, AV_LOG_ERROR, "Unable to read VOB block: offset=%d 
blocks_read=%ld\n",
 state->sector_offset, blocks_read);
 
 return AVERROR_INVALIDDATA;
-- 
2.34.1

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [PATCH] avformat/dvdvideodec: use correct format string for menu read error, fixes compiler warning

2024-03-12 Thread Marth64
v2 on the way
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH v4] avcodec/mpeg12dec: extract only one type of CC substream

2024-03-12 Thread Marth64
In MPEG-2 user data, there can be different types of Closed Captions
formats embedded (A53, SCTE-20, or DVD). The current behavior of the
CC extraction code in the MPEG-2 decoder is to not be aware of
multiple formats if multiple exist, therefore allowing one format
to overwrite the other during the extraction process since the CC
extraction shares one output buffer for the normalized bytes.

This causes sources that have two CC formats to produce flawed output.
There exist real-world samples which contain both A53 and SCTE-20 captions
in the same MPEG-2 stream, and that manifest this problem. Example of symptom:
THANK YOU (expected) --> THTHANANK K YOYOUU (actual)

The solution is to pick only the first CC substream observed with valid bytes,
and ignore the other types. Additionally, provide an option for users
to manually "force" a type in the event that this matters for a particular
source.

Signed-off-by: Marth64 
---
 libavcodec/mpeg12dec.c | 64 --
 1 file changed, 61 insertions(+), 3 deletions(-)

diff --git a/libavcodec/mpeg12dec.c b/libavcodec/mpeg12dec.c
index 3a2f17e508..4ad1eb6572 100644
--- a/libavcodec/mpeg12dec.c
+++ b/libavcodec/mpeg12dec.c
@@ -62,6 +62,13 @@
 
 #define A53_MAX_CC_COUNT 2000
 
+enum Mpeg2ClosedCaptionsFormat {
+CC_FORMAT_AUTO,
+CC_FORMAT_A53_PART4,
+CC_FORMAT_SCTE20,
+CC_FORMAT_DVD
+};
+
 typedef struct Mpeg1Context {
 MpegEncContext mpeg_enc_ctx;
 int mpeg_enc_ctx_allocated; /* true if decoding context allocated */
@@ -70,6 +77,7 @@ typedef struct Mpeg1Context {
 AVStereo3D stereo3d;
 int has_stereo3d;
 AVBufferRef *a53_buf_ref;
+enum Mpeg2ClosedCaptionsFormat cc_format;
 uint8_t afd;
 int has_afd;
 int slice_count;
@@ -1903,12 +1911,27 @@ static int vcr2_init_sequence(AVCodecContext *avctx)
 return 0;
 }
 
+static void mpeg_set_cc_format(AVCodecContext *avctx, enum 
Mpeg2ClosedCaptionsFormat format,
+   const char *label)
+{
+Mpeg1Context *s1 = avctx->priv_data;
+
+av_assert2(format != CC_FORMAT_AUTO);
+
+if (!s1->cc_format) {
+s1->cc_format = format;
+
+av_log(avctx, AV_LOG_DEBUG, "CC: first seen substream is %s format\n", 
label);
+}
+}
+
 static int mpeg_decode_a53_cc(AVCodecContext *avctx,
   const uint8_t *p, int buf_size)
 {
 Mpeg1Context *s1 = avctx->priv_data;
 
-if (buf_size >= 6 &&
+if ((!s1->cc_format || s1->cc_format == CC_FORMAT_A53_PART4) &&
+buf_size >= 6 &&
 p[0] == 'G' && p[1] == 'A' && p[2] == '9' && p[3] == '4' &&
 p[4] == 3 && (p[5] & 0x40)) {
 /* extract A53 Part 4 CC data */
@@ -1927,9 +1950,11 @@ static int mpeg_decode_a53_cc(AVCodecContext *avctx,
 memcpy(s1->a53_buf_ref->data + old_size, p + 7, cc_count * 
UINT64_C(3));
 
 avctx->properties |= FF_CODEC_PROPERTY_CLOSED_CAPTIONS;
+mpeg_set_cc_format(avctx, CC_FORMAT_A53_PART4, "A/53 Part 4");
 }
 return 1;
-} else if (buf_size >= 2 &&
+} else if ((!s1->cc_format || s1->cc_format == CC_FORMAT_SCTE20) &&
+   buf_size >= 2 &&
p[0] == 0x03 && (p[1]&0x7f) == 0x01) {
 /* extract SCTE-20 CC data */
 GetBitContext gb;
@@ -1973,10 +1998,13 @@ static int mpeg_decode_a53_cc(AVCodecContext *avctx,
 cap += 3;
 }
 }
+
 avctx->properties |= FF_CODEC_PROPERTY_CLOSED_CAPTIONS;
+mpeg_set_cc_format(avctx, CC_FORMAT_SCTE20, "SCTE-20");
 }
 return 1;
-} else if (buf_size >= 11 &&
+} else if ((!s1->cc_format || s1->cc_format == CC_FORMAT_DVD) &&
+   buf_size >= 11 &&
p[0] == 'C' && p[1] == 'C' && p[2] == 0x01 && p[3] == 0xf8) {
 /* extract DVD CC data
  *
@@ -2033,7 +2061,9 @@ static int mpeg_decode_a53_cc(AVCodecContext *avctx,
 p += 6;
 }
 }
+
 avctx->properties |= FF_CODEC_PROPERTY_CLOSED_CAPTIONS;
+mpeg_set_cc_format(avctx, CC_FORMAT_DVD, "DVD");
 }
 return 1;
 }
@@ -2598,11 +2628,39 @@ const FFCodec ff_mpeg1video_decoder = {
},
 };
 
+#define M2V_OFFSET(x) offsetof(Mpeg1Context, x)
+#define M2V_PARAM AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_DECODING_PARAM
+
+static const AVOption mpeg2video_options[] = {
+{ "cc_format", "extract a specific Closed Captions format",
+   M2V_OFFSET(cc_format), AV_OPT_TYPE_INT, { .i64 = CC_FORMAT_AUTO },
+CC_FORMAT_AUTO, CC_FORMAT_DVD, M2V_PARAM, .unit = "cc_format" },
+
+   { "auto

[FFmpeg-devel] [PATCH] avformat/dvdvideodec: use correct format string for menu read error, fixes compiler warning

2024-03-12 Thread Marth64
Signed-off-by: Marth64 
---
 libavformat/dvdvideodec.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavformat/dvdvideodec.c b/libavformat/dvdvideodec.c
index a182f95097..0ae2110cd2 100644
--- a/libavformat/dvdvideodec.c
+++ b/libavformat/dvdvideodec.c
@@ -423,7 +423,7 @@ static int dvdvideo_menu_next_ps_block(AVFormatContext *s, 
DVDVideoPlaybackState
 
 blocks_read = DVDReadBlocks(state->vob_file, state->sector_offset, 1, 
read_buf);
 if (blocks_read != 1) {
-av_log(s, AV_LOG_ERROR, "Unable to read VOB block: offset=%d 
blocks_read=%d\n",
+av_log(s, AV_LOG_ERROR, "Unable to read VOB block: offset=%d 
blocks_read=%ld\n",
 state->sector_offset, blocks_read);
 
 return AVERROR_INVALIDDATA;
-- 
2.34.1

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [PATCH v3 5/6] avformat/rcwtdec: add RCWT Closed Captions demuxer

2024-03-12 Thread Marth64
Will address, thanks for the review.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH v3 6/6] avformat/sccdec: remove unused bprint.h include

2024-03-12 Thread Marth64
Signed-off-by: Marth64 
---
 libavformat/sccdec.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/libavformat/sccdec.c b/libavformat/sccdec.c
index 5f2f95d80e..f6d5f29a0a 100644
--- a/libavformat/sccdec.c
+++ b/libavformat/sccdec.c
@@ -24,7 +24,6 @@
 #include "internal.h"
 #include "subtitles.h"
 #include "libavutil/avstring.h"
-#include "libavutil/bprint.h"
 #include "libavutil/intreadwrite.h"
 
 typedef struct SCCContext {
-- 
2.34.1

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH v3 5/6] avformat/rcwtdec: add RCWT Closed Captions demuxer

2024-03-12 Thread Marth64
Raw Captions With Time (RCWT) is a format native to ccextractor, a commonly
used open source tool for processing 608/708 Closed Captions (CC) sources.
RCWT can be used to archive the original CC bitstream. The muxer was added
in January 2024. In this commit, add the demuxer.

One can now demux RCWT files for rendering in ccaption_dec or interoperate
with ccextractor (which produces RCWT). Using the muxer/demuxer combination,
the CC bits can be kept for further processing or rendering with either tool.
This can be an effective approach to backup original CC presentations.

Prior to this, the next best solution was FFmpeg's SCC muxer, but SCC itself
is not compatible with ccextractor (which is a de facto OSS CC processing tool)
and it is a proprietary format.

Tests will follow.

Signed-off-by: Marth64 
---
 libavformat/Makefile |   1 +
 libavformat/allformats.c |   1 +
 libavformat/rcwtdec.c| 158 +++
 3 files changed, 160 insertions(+)
 create mode 100644 libavformat/rcwtdec.c

diff --git a/libavformat/Makefile b/libavformat/Makefile
index 8811a0ffc9..2092ca9f38 100644
--- a/libavformat/Makefile
+++ b/libavformat/Makefile
@@ -493,6 +493,7 @@ OBJS-$(CONFIG_QOA_DEMUXER)   += qoadec.o
 OBJS-$(CONFIG_R3D_DEMUXER)   += r3d.o
 OBJS-$(CONFIG_RAWVIDEO_DEMUXER)  += rawvideodec.o
 OBJS-$(CONFIG_RAWVIDEO_MUXER)+= rawenc.o
+OBJS-$(CONFIG_RCWT_DEMUXER)  += rcwtdec.o subtitles.o
 OBJS-$(CONFIG_RCWT_MUXER)+= rcwtenc.o subtitles.o
 OBJS-$(CONFIG_REALTEXT_DEMUXER)  += realtextdec.o subtitles.o
 OBJS-$(CONFIG_REDSPARK_DEMUXER)  += redspark.o
diff --git a/libavformat/allformats.c b/libavformat/allformats.c
index 0a0e76138f..b89a49b6ec 100644
--- a/libavformat/allformats.c
+++ b/libavformat/allformats.c
@@ -391,6 +391,7 @@ extern const FFInputFormat  ff_qoa_demuxer;
 extern const FFInputFormat  ff_r3d_demuxer;
 extern const FFInputFormat  ff_rawvideo_demuxer;
 extern const FFOutputFormat ff_rawvideo_muxer;
+extern const FFInputFormat  ff_rcwt_demuxer;
 extern const FFOutputFormat ff_rcwt_muxer;
 extern const FFInputFormat  ff_realtext_demuxer;
 extern const FFInputFormat  ff_redspark_demuxer;
diff --git a/libavformat/rcwtdec.c b/libavformat/rcwtdec.c
new file mode 100644
index 00..f553f13366
--- /dev/null
+++ b/libavformat/rcwtdec.c
@@ -0,0 +1,158 @@
+/*
+ * RCWT (Raw Captions With Time) demuxer
+ *
+ * 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
+ */
+
+/*
+ * RCWT (Raw Captions With Time) is a format native to ccextractor, a commonly
+ * used open source tool for processing 608/708 Closed Captions (CC) sources.
+ * It can be used to archive the original, raw CC bitstream and to produce
+ * a source file for later CC processing or conversion. As a result,
+ * it also allows for interopability with ccextractor for processing CC data
+ * extracted via ffmpeg. The format is simple to parse and can be used
+ * to retain all lines and variants of CC.
+ *
+ * This demuxer implements the specification as of March 2024, which has
+ * been stable and unchanged since April 2014.
+ *
+ * A free specification of RCWT can be found here:
+ * 
@url{https://github.com/CCExtractor/ccextractor/blob/master/docs/BINARY_FILE_FORMAT.TXT}
+ */
+
+#include "avformat.h"
+#include "demux.h"
+#include "internal.h"
+#include "subtitles.h"
+#include "libavutil/avstring.h"
+#include "libavutil/intreadwrite.h"
+
+#define RCWT_CLUSTER_MAX_BLOCKS 65535
+#define RCWT_BLOCK_SIZE 3
+#define RCWT_HEADER_SIZE11
+
+typedef struct RCWTContext {
+FFDemuxSubtitlesQueue q;
+} RCWTContext;
+
+static int rcwt_read_header(AVFormatContext *avf)
+{
+RCWTContext *rcwt = avf->priv_data;
+
+AVPacket  *sub = NULL;
+AVStream  *st;
+uint8_t   header[RCWT_HEADER_SIZE] = {0};
+int   nb_bytes = 0;
+
+int64_t   cluster_pts = AV_NOPTS_VALUE;
+int   cluster_nb_blocks = 0;
+int   cluster_size = 0;
+uint8_t   *cluster_buf;
+
+/* validate the header */
+nb_bytes = avio_read(avf->pb, header, RCWT_HEADER_SIZE);
+if (nb_bytes != R

[FFmpeg-devel] [PATCH v3 4/6] avcodec/rcwtenc: canonize name and refresh documentation

2024-03-12 Thread Marth64
The formal title of the muxer according to the specification
is "RCWT (Raw Captions With Time)", so canonize this
in the long name of the codec and docs.

In the documentation section, point #2 was wrong: ccextractor
extracts the Closed Captions data and stores normalized bits
similarly to this muxer.

Signed-off-by: Marth64 
---
 libavformat/rcwtenc.c | 21 +++--
 1 file changed, 7 insertions(+), 14 deletions(-)

diff --git a/libavformat/rcwtenc.c b/libavformat/rcwtenc.c
index a6060ba7c4..ed72de81ef 100644
--- a/libavformat/rcwtenc.c
+++ b/libavformat/rcwtenc.c
@@ -1,6 +1,5 @@
 /*
- * Raw Captions With Time (RCWT) muxer
- * Author: Marth64 
+ * RCWT (Raw Captions With Time) muxer
  *
  * This file is part of FFmpeg.
  *
@@ -20,16 +19,16 @@
  */
 
 /*
- * Raw Captions With Time (RCWT) is a format native to ccextractor, a commonly
- * used open source tool for processing 608/708 closed caption (CC) sources.
+ * RCWT (Raw Captions With Time) is a format native to ccextractor, a commonly
+ * used open source tool for processing 608/708 Closed Captions (CC) sources.
  * It can be used to archive the original, raw CC bitstream and to produce
  * a source file for later CC processing or conversion. As a result,
  * it also allows for interopability with ccextractor for processing CC data
  * extracted via ffmpeg. The format is simple to parse and can be used
  * to retain all lines and variants of CC.
  *
- * This muxer implements the specification as of 2024-01-05, which has
- * been stable and unchanged for 10 years as of this writing.
+ * This muxer implements the specification as of March 2024, which has
+ * been stable and unchanged since April 2014.
  *
  * This muxer will have some nuances from the way that ccextractor muxes RCWT.
  * No compatibility issues when processing the output with ccextractor
@@ -40,13 +39,7 @@
  * (1) This muxer will identify as "FF" as the writing program identifier, so
  * as to be honest about the output's origin.
  *
- * (2) ffmpeg's MPEG-1/2, H264, HEVC, etc. decoders extract closed captioning
- * data differently than ccextractor from embedded SEI/user data.
- * For example, DVD captioning bytes will be translated to ATSC A53 format.
- * This allows ffmpeg to handle 608/708 in a consistant way downstream.
- * This is a lossless conversion and the meaningful data is retained.
- *
- * (3) This muxer will not alter the extracted data except to remove invalid
+ * (2) This muxer will not alter the extracted data except to remove invalid
  * packets in between valid CC blocks. On the other hand, ccextractor
  * will by default remove mid-stream padding, and add padding at the end
  * of the stream (in order to convey the end time of the source video).
@@ -172,7 +165,7 @@ static int rcwt_write_trailer(AVFormatContext *avf)
 
 const FFOutputFormat ff_rcwt_muxer = {
 .p.name = "rcwt",
-.p.long_name= NULL_IF_CONFIG_SMALL("Raw Captions With Time"),
+.p.long_name= NULL_IF_CONFIG_SMALL("RCWT (Raw Captions With 
Time)"),
 .p.extensions   = "bin",
 .p.flags= AVFMT_GLOBALHEADER | AVFMT_VARIABLE_FPS | 
AVFMT_TS_NONSTRICT,
 .p.subtitle_codec   = AV_CODEC_ID_EIA_608,
-- 
2.34.1

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH v3 3/6] avcodec/ccaption_dec: ignore leading non-breaking spaces

2024-03-12 Thread Marth64
In Closed Captions (US), the non-breaking space (0xA0) can be used to
align text horizontally from the left when used as a leading character.
However, CC decoder does not ignore it as a leading character
like it does an ordinary space, so a blank padding is rendered
on the black CC box. This is not the intended viewing experience.

Ignore the leading non-breaking spaces, thus creating the intended
transparency which aligns the text. Since all characters are
fixed-width in CC, it can be handled the same way as we currently
treat leading ordinary spaces.

Also, as a nit, lowercase the NBSP's hex code in the entry table to match
casing of the other hex codes.

Signed-off-by: Marth64 
---
 libavcodec/ccaption_dec.c | 9 ++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/libavcodec/ccaption_dec.c b/libavcodec/ccaption_dec.c
index 9d4a93647c..25b0f2e064 100644
--- a/libavcodec/ccaption_dec.c
+++ b/libavcodec/ccaption_dec.c
@@ -91,7 +91,7 @@ enum cc_charset {
 ENTRY(0x36, "\u00a3")\
 ENTRY(0x37, "\u266a")\
 ENTRY(0x38, "\u00e0")\
-ENTRY(0x39, "\u00A0")\
+ENTRY(0x39, "\u00a0")\
 ENTRY(0x3a, "\u00e8")\
 ENTRY(0x3b, "\u00e2")\
 ENTRY(0x3c, "\u00ea")\
@@ -471,7 +471,8 @@ static int capture_screen(CCaptionSubContext *ctx)
 const char *row = screen->characters[i];
 const char *charset = screen->charsets[i];
 j = 0;
-while (row[j] == ' ' && charset[j] == CCSET_BASIC_AMERICAN)
+while ((row[j] == ' '  && charset[j] == CCSET_BASIC_AMERICAN) ||
+   (row[j] == 0x39 && charset[j] == CCSET_SPECIAL_AMERICAN))
 j++;
 if (!tab || j < tab)
 tab = j;
@@ -491,7 +492,9 @@ static int capture_screen(CCaptionSubContext *ctx)
 j = 0;
 
 /* skip leading space */
-while (row[j] == ' ' && charset[j] == CCSET_BASIC_AMERICAN && j < 
tab)
+while (j < tab &&
+   (row[j] == ' '  && charset[j] == CCSET_BASIC_AMERICAN) ||
+   (row[j] == 0x39 && charset[j] == CCSET_SPECIAL_AMERICAN))
 j++;
 
 x = ASS_DEFAULT_PLAYRESX * (0.1 + 0.0250 * j);
-- 
2.34.1

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH v3 0/6] Closed Captions improvements (phase 1)

2024-03-12 Thread Marth64
In this patchset are improvements for Closed Captions. This set overrides
the 3 patches I sent in the past few days, hence the v3 moniker.
Feedback should be addressed. Details about each change is in the commit.

Narrative:
(1) First, fix the MPEG-2 decoder so it does not try to overlap different
CC streams when content has mixed CC formats
(2) Fix invalid ASS tags produced by ccaption_dec, as well as the tests
(3) Fix leading padding produced by ccaption_dec (ignore leading NBSP)
(4) Correct wrong documentation on rcwtenc
(5) Add a RCWT demuxer. Now, one can fully mux/demux extracted
CCs in a bit-exact way from both ffmpeg and ccextractor.
The added benefit is this allows for easy archival of CCs
for later processing.
(6) Fix an unused include in SCC demuxer

FATE tests pass.
There is still more to do, I will slowly work on this.

Thank you,

Signed-off-by: Marth64 
-- 
2.34.1

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH v3 2/6] avcodec/ccaption_dec: don't print multiple \an and \pos tags

2024-03-12 Thread Marth64
Closed Captions decoder prints multiple \pos ASS tags per cue,
and preceding the \pos tag is a fixed \an7 that fixes rendering
position from the top left corner and enforces justification.

Printing multiple \an and \pos tags in this way is invalid behavior,
because only the first \pos tag in a cue is honored by ASS anyway.
Don't write multiple \an and \pos tags.

Also, update tests accordingly.

Signed-off-by: Marth64 
---
 libavcodec/ccaption_dec.c  |   8 +-
 tests/ref/fate/sub-cc  |   2 +-
 tests/ref/fate/sub-cc-realtime |   8 +-
 tests/ref/fate/sub-cc-scte20   |   4 +-
 tests/ref/fate/sub-scc | 146 -
 5 files changed, 86 insertions(+), 82 deletions(-)

diff --git a/libavcodec/ccaption_dec.c b/libavcodec/ccaption_dec.c
index faf058ce97..9d4a93647c 100644
--- a/libavcodec/ccaption_dec.c
+++ b/libavcodec/ccaption_dec.c
@@ -456,7 +456,7 @@ static void roll_up(CCaptionSubContext *ctx)
 
 static int capture_screen(CCaptionSubContext *ctx)
 {
-int i, j, tab = 0;
+int i, j, tab = 0, seen_row = 0;
 struct Screen *screen = ctx->screen + ctx->active_screen;
 enum cc_font prev_font = CCFONT_REGULAR;
 enum cc_color_code prev_color = CCCOL_WHITE;
@@ -496,7 +496,11 @@ static int capture_screen(CCaptionSubContext *ctx)
 
 x = ASS_DEFAULT_PLAYRESX * (0.1 + 0.0250 * j);
 y = ASS_DEFAULT_PLAYRESY * (0.1 + 0.0533 * i);
-av_bprintf(>buffer[bidx], "{\\an7}{\\pos(%d,%d)}", x, y);
+
+if (!seen_row) {
+av_bprintf(>buffer[bidx], "{\\an7}{\\pos(%d,%d)}", x, y);
+seen_row = 1;
+}
 
 for (; j < SCREEN_COLUMNS; j++) {
 const char *e_tag = "", *s_tag = "", *c_tag = "", *b_tag = "";
diff --git a/tests/ref/fate/sub-cc b/tests/ref/fate/sub-cc
index f5216b3de2..d4ab974c2f 100644
--- a/tests/ref/fate/sub-cc
+++ b/tests/ref/fate/sub-cc
@@ -13,4 +13,4 @@ Style: 
Default,Monospace,16,0,0,0,0,100,100,0,0,3,1,0,
 [Events]
 Format: Layer, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text
 Dialogue: 0,0:00:00.83,0:00:02.97,Default,,0,0,0,,{\an7}{\pos(38,44)}({\i1} 
inaudible radio chatter{\i0} )
-Dialogue: 0,0:00:02.97,0:00:04.34,Default,,0,0,0,,{\an7}{\pos(38,28)}({\i1} 
inaudible radio chatter{\i0} )\N{\an7}{\pos(38,44)}>> Safety remains our number 
one
+Dialogue: 0,0:00:02.97,0:00:04.34,Default,,0,0,0,,{\an7}{\pos(38,28)}({\i1} 
inaudible radio chatter{\i0} )\N>> Safety remains our number one
diff --git a/tests/ref/fate/sub-cc-realtime b/tests/ref/fate/sub-cc-realtime
index bda890bfe5..da06307221 100644
--- a/tests/ref/fate/sub-cc-realtime
+++ b/tests/ref/fate/sub-cc-realtime
@@ -16,7 +16,7 @@ Dialogue: 
0,0:00:00.97,9:59:59.99,Default,,0,0,0,,{\an7}{\pos(38,44)}(
 Dialogue: 0,0:00:01.17,9:59:59.99,Default,,0,0,0,,{\an7}{\pos(38,44)}({\i1} 
inaudibl
 Dialogue: 0,0:00:01.37,9:59:59.99,Default,,0,0,0,,{\an7}{\pos(38,44)}({\i1} 
inaudible radio chat
 Dialogue: 0,0:00:01.57,9:59:59.99,Default,,0,0,0,,{\an7}{\pos(38,44)}({\i1} 
inaudible radio chatter{\i0} )
-Dialogue: 0,0:00:03.10,9:59:59.99,Default,,0,0,0,,{\an7}{\pos(38,28)}({\i1} 
inaudible radio chatter{\i0} )\N{\an7}{\pos(38,44)}>>
-Dialogue: 0,0:00:03.30,9:59:59.99,Default,,0,0,0,,{\an7}{\pos(38,28)}({\i1} 
inaudible radio chatter{\i0} )\N{\an7}{\pos(38,44)}>> Safety rema
-Dialogue: 0,0:00:03.50,9:59:59.99,Default,,0,0,0,,{\an7}{\pos(38,28)}({\i1} 
inaudible radio chatter{\i0} )\N{\an7}{\pos(38,44)}>> Safety remains our numb
-Dialogue: 0,0:00:03.70,9:59:59.99,Default,,0,0,0,,{\an7}{\pos(38,28)}({\i1} 
inaudible radio chatter{\i0} )\N{\an7}{\pos(38,44)}>> Safety remains our number 
one
+Dialogue: 0,0:00:03.10,9:59:59.99,Default,,0,0,0,,{\an7}{\pos(38,28)}({\i1} 
inaudible radio chatter{\i0} )\N>>
+Dialogue: 0,0:00:03.30,9:59:59.99,Default,,0,0,0,,{\an7}{\pos(38,28)}({\i1} 
inaudible radio chatter{\i0} )\N>> Safety rema
+Dialogue: 0,0:00:03.50,9:59:59.99,Default,,0,0,0,,{\an7}{\pos(38,28)}({\i1} 
inaudible radio chatter{\i0} )\N>> Safety remains our numb
+Dialogue: 0,0:00:03.70,9:59:59.99,Default,,0,0,0,,{\an7}{\pos(38,28)}({\i1} 
inaudible radio chatter{\i0} )\N>> Safety remains our number one
diff --git a/tests/ref/fate/sub-cc-scte20 b/tests/ref/fate/sub-cc-scte20
index 49715301de..09fa3fb330 100644
--- a/tests/ref/fate/sub-cc-scte20
+++ b/tests/ref/fate/sub-cc-scte20
@@ -13,5 +13,5 @@ Style: 
Default,Monospace,16,0,0,0,0,100,100,0,0,3,1,0,
 [Events]
 Format: Layer, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text
 Dialogue: 0,0:00:00.00,0:00:01.44,Default,,0,0,0,,{\an7}{\pos(48,182)}BESIDES 
THE 
-Dialogue: 
0,0:00:01.43,0:00:03.93,Default,,0,0,0,,{\an7}{\pos(38,166)}\hBESIDES THE 
\N{\an7}{\pos(38,197)}SPENDING AND THIS, IS THAT CAR 
-Dialogue: 0,0:00:03.94,0:00:06.31,Default,,0,0,0,,{\an7}{\pos(38,182)}SPENDING 
AND THI

[FFmpeg-devel] [PATCH v3 1/6] avcodec/mpeg12dec: extract only one type of CC substream

2024-03-12 Thread Marth64
In MPEG-2 user data, there can be different types of Closed Captions
formats embedded (A53, SCTE-20, or DVD). The current behavior of the
CC extraction code in the MPEG-2 decoder is to not be aware of
multiple formats if multiple exist, therefore allowing one format
to overwrite the other during the extraction process since the CC
extraction shares one output buffer for the normalized bytes.

This causes sources that have two CC formats to produce flawed output.
There exist real-world samples which contain both A53 and SCTE-20 captions
in the same MPEG-2 stream, and that manifest this problem. Example of symptom:
THANK YOU (expected) --> THTHANANK K YOYOUU (actual)

The solution is to pick only the first CC substream observed with valid bytes,
and ignore the other types. Additionally, provide an option for users
to manually "force" a type in the event that this matters for a particular
source.

Signed-off-by: Marth64 
---
 libavcodec/mpeg12dec.c | 67 --
 1 file changed, 64 insertions(+), 3 deletions(-)

diff --git a/libavcodec/mpeg12dec.c b/libavcodec/mpeg12dec.c
index 3a2f17e508..8961a290a3 100644
--- a/libavcodec/mpeg12dec.c
+++ b/libavcodec/mpeg12dec.c
@@ -62,6 +62,16 @@
 
 #define A53_MAX_CC_COUNT 2000
 
+enum Mpeg2ClosedCaptionsFormat {
+CC_FORMAT_AUTO,
+CC_FORMAT_A53_PART4,
+CC_FORMAT_SCTE20,
+CC_FORMAT_DVD
+};
+static const char mpeg2_cc_format_labels[4][12] = {
+"Unknown", "A/53 Part 4", "SCTE-20", "DVD"
+};
+
 typedef struct Mpeg1Context {
 MpegEncContext mpeg_enc_ctx;
 int mpeg_enc_ctx_allocated; /* true if decoding context allocated */
@@ -70,6 +80,7 @@ typedef struct Mpeg1Context {
 AVStereo3D stereo3d;
 int has_stereo3d;
 AVBufferRef *a53_buf_ref;
+enum Mpeg2ClosedCaptionsFormat cc_format;
 uint8_t afd;
 int has_afd;
 int slice_count;
@@ -1903,12 +1914,27 @@ static int vcr2_init_sequence(AVCodecContext *avctx)
 return 0;
 }
 
+static void mpeg_set_cc_format(AVCodecContext *avctx, enum 
Mpeg2ClosedCaptionsFormat format)
+{
+Mpeg1Context *s1 = avctx->priv_data;
+
+av_assert2(format != CC_FORMAT_AUTO);
+
+if (!s1->cc_format) {
+s1->cc_format = format;
+
+av_log(avctx, AV_LOG_DEBUG, "CC: first seen substream is %s format\n",
+   mpeg2_cc_format_labels[format]);
+}
+}
+
 static int mpeg_decode_a53_cc(AVCodecContext *avctx,
   const uint8_t *p, int buf_size)
 {
 Mpeg1Context *s1 = avctx->priv_data;
 
-if (buf_size >= 6 &&
+if ((!s1->cc_format || s1->cc_format == CC_FORMAT_A53_PART4) &&
+buf_size >= 6 &&
 p[0] == 'G' && p[1] == 'A' && p[2] == '9' && p[3] == '4' &&
 p[4] == 3 && (p[5] & 0x40)) {
 /* extract A53 Part 4 CC data */
@@ -1927,9 +1953,11 @@ static int mpeg_decode_a53_cc(AVCodecContext *avctx,
 memcpy(s1->a53_buf_ref->data + old_size, p + 7, cc_count * 
UINT64_C(3));
 
 avctx->properties |= FF_CODEC_PROPERTY_CLOSED_CAPTIONS;
+mpeg_set_cc_format(avctx, CC_FORMAT_A53_PART4);
 }
 return 1;
-} else if (buf_size >= 2 &&
+} else if ((!s1->cc_format || s1->cc_format == CC_FORMAT_SCTE20) &&
+   buf_size >= 2 &&
p[0] == 0x03 && (p[1]&0x7f) == 0x01) {
 /* extract SCTE-20 CC data */
 GetBitContext gb;
@@ -1973,10 +2001,13 @@ static int mpeg_decode_a53_cc(AVCodecContext *avctx,
 cap += 3;
 }
 }
+
 avctx->properties |= FF_CODEC_PROPERTY_CLOSED_CAPTIONS;
+mpeg_set_cc_format(avctx, CC_FORMAT_SCTE20);
 }
 return 1;
-} else if (buf_size >= 11 &&
+} else if ((!s1->cc_format || s1->cc_format == CC_FORMAT_DVD) &&
+   buf_size >= 11 &&
p[0] == 'C' && p[1] == 'C' && p[2] == 0x01 && p[3] == 0xf8) {
 /* extract DVD CC data
  *
@@ -2033,7 +2064,9 @@ static int mpeg_decode_a53_cc(AVCodecContext *avctx,
 p += 6;
 }
 }
+
 avctx->properties |= FF_CODEC_PROPERTY_CLOSED_CAPTIONS;
+mpeg_set_cc_format(avctx, CC_FORMAT_DVD);
 }
 return 1;
 }
@@ -2598,11 +2631,39 @@ const FFCodec ff_mpeg1video_decoder = {
},
 };
 
+#define M2V_OFFSET(x) offsetof(Mpeg1Context, x)
+#define M2V_PARAM AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_DECODING_PARAM
+
+static const AVOption mpeg2video_options[] = {
+{ "cc_format", "extract a specific Closed Captions format",
+   M2V_OFFSET(cc_format), AV_OPT_TYPE_INT, { .i64 = CC_FORMAT_AUTO },
+CC_FORMAT_AUTO

Re: [FFmpeg-devel] [PATCH v2] avcodec/ccaption_dec: honor transparency of leading non-breaking space

2024-03-11 Thread Marth64
I am working on an improved patchset to consolidate these patches, also
address feedback and other improvements. Will submit soon, thank you!

On Mon, Mar 11, 2024 at 11:38 AM Stefano Sabatini 
wrote:

> On date Sunday 2024-03-10 19:44:11 -0500, Marth64 wrote:
> > In Closed Captions (US), the non-breaking space (0xA0) can be used to
> align
> > text horizontally from the left by using it as a leading character.
> > However, CC decoder does not ignore it as a leading character like it
> does
> > an ordinary space, so a blank padding is rendered over the black CC box.
> > This is not the intended viewing experience.
> >
> > Ignore the leading non-breaking spaces, thus creating the intended
> transparency
> > which aligns the text. Since all characters are fixed-width in CC, it
> > can be handled the same way as we currently treat leading ordinary
> spaces.
> > Also, as a nit, lowercase the NBSP's hex code in the entry table to match
> > casing of the other hex codes.
> >
> > v2 only updates the commit message which mistakenly referenced avformat.
> >
> > Signed-off-by: Marth64 
> > ---
> >  libavcodec/ccaption_dec.c | 9 ++---
> >  1 file changed, 6 insertions(+), 3 deletions(-)
> >
> > diff --git a/libavcodec/ccaption_dec.c b/libavcodec/ccaption_dec.c
> > index faf058ce97..591013d202 100644
> > --- a/libavcodec/ccaption_dec.c
> > +++ b/libavcodec/ccaption_dec.c
> > @@ -91,7 +91,7 @@ enum cc_charset {
> >  ENTRY(0x36, "\u00a3")\
> >  ENTRY(0x37, "\u266a")\
> >  ENTRY(0x38, "\u00e0")\
> > -ENTRY(0x39, "\u00A0")\
> > +ENTRY(0x39, "\u00a0")\
> >  ENTRY(0x3a, "\u00e8")\
> >  ENTRY(0x3b, "\u00e2")\
> >  ENTRY(0x3c, "\u00ea")\
> > @@ -471,7 +471,8 @@ static int capture_screen(CCaptionSubContext *ctx)
> >  const char *row = screen->characters[i];
> >  const char *charset = screen->charsets[i];
> >  j = 0;
> > -while (row[j] == ' ' && charset[j] == CCSET_BASIC_AMERICAN)
> > +while ((row[j] == ' '  && charset[j] ==
> CCSET_BASIC_AMERICAN) ||
> > +   (row[j] == 0x39 && charset[j] ==
> CCSET_SPECIAL_AMERICAN))
> >  j++;
> >  if (!tab || j < tab)
> >  tab = j;
> > @@ -491,7 +492,9 @@ static int capture_screen(CCaptionSubContext *ctx)
> >  j = 0;
> >
> >  /* skip leading space */
> > -while (row[j] == ' ' && charset[j] == CCSET_BASIC_AMERICAN
> && j < tab)
> > +while (j < tab &&
> > +   (row[j] == ' '  && charset[j] ==
> CCSET_BASIC_AMERICAN) ||
> > +   (row[j] == 0x39 && charset[j] ==
> CCSET_SPECIAL_AMERICAN))
> >  j++;
>
> Patch LGTM, will apply the complete patcheset if I see no comments
> after a few days.
>
> Thanks.
>
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [PATCH] avcodec/ccaption_dec: don't print multiple \pos tags per cue

2024-03-11 Thread Marth64
Thanks, will follow up with a v3 set (consolidating/resolving feedback on
the other CC fixes as well).
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [PATCH] avcodec/mpeg12dec: extract only one type of CC substream

2024-03-11 Thread Marth64
Agreed on both points, I will address them. Thanks.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [PATCH] avcodec/ccaption_dec: don't print multiple \pos tags per cue

2024-03-11 Thread Marth64
> This breaks fate
Looking into it - thanks.

PS, sorry for previous top-posting in replies. Will be more cautious of
that.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


  1   2   3   >