[vlc-commits] [Git][videolan/vlc][master] 5 commits: fourcc: add farbfeld
Tristan Matthews (@tmatth)
gitlab at videolan.org
Wed Dec 18 22:12:16 UTC 2024
Tristan Matthews pushed to branch master at VideoLAN / VLC
Commits:
7977b3f7 by Tristan Matthews at 2024-12-18T21:58:07+00:00
fourcc: add farbfeld
- - - - -
80ac3bb1 by Tristan Matthews at 2024-12-18T21:58:07+00:00
image: add farbfeld
- - - - -
f0c33208 by Tristan Matthews at 2024-12-18T21:58:07+00:00
demux: image: handle farbfeld
"farbfeld is a lossless image format which is easy to parse, pipe and compress."
- https://tools.suckless.org/farbfeld/
- - - - -
80c1d506 by Tristan Matthews at 2024-12-18T21:58:07+00:00
NEWS: add entry for farbeld
- - - - -
8af0af8b by Tristan Matthews at 2024-12-18T21:58:07+00:00
fixup! demux: image: handle farbfeld
- - - - -
5 changed files:
- NEWS
- include/vlc_fourcc.h
- modules/demux/image.c
- src/misc/fourcc_list.h
- src/misc/image.c
Changes:
=====================================
NEWS
=====================================
@@ -39,6 +39,7 @@ Audio output:
Demuxer:
* Support for HEIF image and grid image formats
+ * Support for Farbfeld images
* Support for DASH WebM
* Support for DVBSUB in mkv
* Support for DAV video files
=====================================
include/vlc_fourcc.h
=====================================
@@ -502,6 +502,7 @@
#define VLC_CODEC_BPG VLC_FOURCC('B','P','G',0xFB)
#define VLC_CODEC_JPEGLS VLC_FOURCC('M','J','L','S')
#define VLC_CODEC_BMP VLC_FOURCC('b','m','p',' ')
+#define VLC_CODEC_FARBFELD VLC_FOURCC('f','a','r','b')
#define VLC_CODEC_TIFF VLC_FOURCC('t','i','f','f')
#define VLC_CODEC_GIF VLC_FOURCC('g','i','f',' ')
#define VLC_CODEC_TARGA VLC_FOURCC('t','g','a',' ')
=====================================
modules/demux/image.c
=====================================
@@ -660,6 +660,10 @@ static const image_format_t formats[] = {
{ .codec = VLC_CODEC_WEBP,
.detect = IsWebP,
},
+ { .codec = VLC_CODEC_FARBFELD,
+ .marker_size = 8,
+ .marker = { 'f', 'a', 'r', 'b', 'f', 'e', 'l', 'd' },
+ },
{ .codec = VLC_CODEC_BPG,
.marker_size = 4,
.marker = { 'B', 'P', 'G', 0xFB },
@@ -708,6 +712,30 @@ static vlc_fourcc_t Detect(stream_t *s)
return 0;
}
+static int parse_farbfeld_header(vlc_object_t *object, es_format_t *fmt)
+{
+ demux_t *demux = (demux_t*)object;
+
+ const uint8_t *p_peek;
+ if (vlc_stream_Peek(demux->s, &p_peek, 16) < 16)
+ return VLC_EGENERIC;
+
+ uint32_t width = GetDWBE(p_peek + 8);
+ uint32_t height = GetDWBE(p_peek + 12);
+
+ if (width == 0 || height == 0)
+ return VLC_EGENERIC;
+
+ /* Farbfeld is essentially just a header followed by pixels. */
+ fmt->video.i_width = width;
+ fmt->video.i_height = height;
+ fmt->video.i_chroma = fmt->i_codec = VLC_CODEC_RGBA64;
+
+ vlc_stream_Read(demux->s, NULL, 16);
+
+ return VLC_SUCCESS;
+}
+
static int Open(vlc_object_t *object)
{
demux_t *demux = (demux_t*)object;
@@ -728,6 +756,12 @@ static int Open(vlc_object_t *object)
es_format_Init(&fmt, VIDEO_ES, codec);
fmt.video.i_chroma = fmt.i_codec;
+ if (codec == VLC_CODEC_FARBFELD)
+ {
+ if (parse_farbfeld_header(object, &fmt))
+ return VLC_EGENERIC;
+ }
+
block_t *data = Load(demux);
if (data && var_InheritBool(demux, "image-decode")) {
char *string = var_InheritString(demux, "image-chroma");
=====================================
src/misc/fourcc_list.h
=====================================
@@ -1051,6 +1051,9 @@ static const staticentry_t p_list_video[] = {
B(VLC_CODEC_BMP, "BMP Image"),
A("bmp "),
+ B(VLC_CODEC_FARBFELD, "Farbfeld Image"),
+ A("farb"),
+
B(VLC_CODEC_TIFF, "TIFF Image"),
A("tiff"),
=====================================
src/misc/image.c
=====================================
@@ -581,6 +581,7 @@ static const struct
{ VLC_FOURCC('p','a','m',' '), "pam" },
{ VLC_CODEC_TARGA, "tga" },
{ VLC_CODEC_BMP, "bmp" },
+ { VLC_CODEC_FARBFELD, "farb" },
{ VLC_CODEC_PNM, "pnm" },
{ VLC_FOURCC('x','p','m',' '), "xpm" },
{ VLC_FOURCC('x','c','f',' '), "xcf" },
@@ -630,6 +631,7 @@ static const struct
{ VLC_CODEC_GIF, "image/gif" },
{ VLC_CODEC_JPEG, "image/jpeg" },
{ VLC_CODEC_BPG, "image/bpg" },
+ { VLC_CODEC_FARBFELD, "image/farbfeld" },
{ VLC_CODEC_PCX, "image/pcx" },
{ VLC_CODEC_PNG, "image/png" },
{ VLC_CODEC_QOI, "image/qoi" },
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/3c07c3369a5313b2d79e95dec20c1f6a1041ad23...8af0af8b47b3dba0f1f6ec9b065a7a0b23fa8edf
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/3c07c3369a5313b2d79e95dec20c1f6a1041ad23...8af0af8b47b3dba0f1f6ec9b065a7a0b23fa8edf
You're receiving this email because of your account on code.videolan.org.
VideoLAN code repository instance
More information about the vlc-commits
mailing list