Skip to contentSkip to conversation

DocBook: Use base64 for gif/png files

PATCH In review Mauro Carvalho Chehab 2 participants 3 messages Jun 16, 2011

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 DocBook: Use base64 for gif/png files

The patch utility doesn't work with non-binary files. This causes some tools to break, like generating tarball targets and the scripts that generate diff patches at http://www.kernel.org/pub/linux/kernel/v2.6/.

So, let's convert all binaries to ascii using base64, and add a logic at Makefile to convert them back into binaries at runtime.

Documentation/DocBook/.gitignore +1 -9
index 2c8c882..25214a5 100644
@@ -8,13 +8,5 @@
 *.dvi
 *.log
 *.out
-crop.gif
-dvbstb.png
-fieldseq_bt.gif
-fieldseq_tb.gif
 media-indices.tmpl
-nv12mt.gif
-nv12mt_example.gif
-vbi_525.gif
-vbi_625.gif
-vbi_hsync.gif
+media-entities.tmpl
Documentation/DocBook/Makefile +1 -0
index 5125277..66725a3 100644
@@ -50,6 +50,7 @@ HTML := $(sort $(patsubst %.xml, %.html, $(BOOKS)))
 htmldocs: $(HTML)
 	$(call build_main_index)
 	$(call build_images)
+	$(call install_media_images)
 
 MAN := $(patsubst %.xml, %.9, $(BOOKS))
 mandocs: $(MAN)
Documentation/DocBook/media/Makefile +10 -5
index b7627e1..8cb27f3 100644
@@ -18,13 +18,14 @@ MEDIA_TEMP =  media-entities.tmpl \
 	      net.h.xml \
 	      video.h.xml \
 
-IMGFILES := $(addprefix $(MEDIA_OBJ_DIR)/media/, $(notdir $(shell ls $(MEDIA_SRC_DIR)/*/*.gif $(MEDIA_SRC_DIR)/*/*.png)))
+IMGFILES := $(patsubst %.b64,%, $(notdir $(shell ls $(MEDIA_SRC_DIR)/*.b64)))
+OBJIMGFILES := $(addprefix $(MEDIA_OBJ_DIR)/, $(IMGFILES))
 GENFILES := $(addprefix $(MEDIA_OBJ_DIR)/, $(MEDIA_TEMP))
 
 PHONY += cleanmediadocs
 
 cleanmediadocs:
-	-@rm `find $(MEDIA_OBJ_DIR) -type l` $(GENFILES) $(IMGFILES) 2>/dev/null
+	-@rm `find $(MEDIA_OBJ_DIR) -type l` $(GENFILES) $(OBJIMGFILES) 2>/dev/null
 
 $(obj)/media_api.xml: $(GENFILES) FORCE
 
@@ -155,10 +156,14 @@ DVB_DOCUMENTED = \
 # Media targets and dependencies
 #
 
-$(MEDIA_OBJ_DIR)/v4l2.xml:
+install_media_images = \
+	$(Q)cp $(OBJIMGFILES) $(MEDIA_OBJ_DIR)/media_api
+
+$(MEDIA_OBJ_DIR)/%: $(MEDIA_SRC_DIR)/%.b64
+	$(Q)base64 -d $< >$@
+
+$(MEDIA_OBJ_DIR)/v4l2.xml: $(OBJIMGFILES)
 	@$($(quiet)gen_xml)
-	@(mkdir -p $(MEDIA_OBJ_DIR)/media)
-	@(cp $(MEDIA_SRC_DIR)/dvb/*.png $(MEDIA_SRC_DIR)/v4l/*.gif $(MEDIA_OBJ_DIR)/media/)
 	@(ln -sf $(MEDIA_SRC_DIR)/v4l/*xml $(MEDIA_OBJ_DIR)/)
 	@(ln -sf $(MEDIA_SRC_DIR)/dvb/*xml $(MEDIA_OBJ_DIR)/)
 
Documentation/DocBook/media/bayer.png.b64 new file +171 -0

171 lines not on this page · raw message

Documentation/DocBook/media/crop.gif.b64 new file +105 -0

105 lines not on this page · raw message

Documentation/DocBook/media/dvb/dvbstb.png deleted binary +0 -0
deleted file mode 100644
index 9b8f372..0000000
Binary files a/Documentation/DocBook/media/dvb/dvbstb.png and /dev/null differ
Documentation/DocBook/media/dvbstb.png.b64 new file +398 -0

398 lines not on this page · raw message

Documentation/DocBook/media/fieldseq_bt.gif.b64 new file +447 -0

447 lines not on this page · raw message

Documentation/DocBook/media/fieldseq_tb.gif.b64 new file +445 -0

445 lines not on this page · raw message

Documentation/DocBook/media/nv12mt.gif.b64 new file +37 -0
new file mode 100644
index 0000000..083a7c8
@@ -0,0 +1,37 @@
+R0lGODlhFgFnAMZnAAAAAAYCAgAASAwFBQAAdEgAACQODkgASCoQEEgAdHQAADATEjUVFHQASDsX
+F3QAdE0eHVMhIABISABInEhIAIM0Mok2NI84Nk9PT5o9O5xIAHRInFlZWaxEQbhJRgB0v75LSLhQ
+TbRTUcBRTrBXVatcWsJWVKdfXW9vb6VhX0h0v8RcWZhpaJJubpBwb8ZiX8ZiYI5zc4t1dYd4eMhn
+Zb90AIN8fH9/f8pracpta8ttasxzcM51dM52dM53dc94dkic39F+fNOEgpmZmdWJh9ePjdiTkt+c
+SNuamd2gnt6lo3S//5y/nOCqqeKwr+S1tOa7uv+/dOjBwOrGxuzKye3KyuzMy5zf/7/fnO/S0fHX
+1//fnPPd3fTe3vXj4vfo6Pnu7r////v09N////35+f//v///3///////////////////////////
+/////////////////////////////////////////////////////////////////////////yH+
+FE5WMTJNVCBtZW1vcnkgbGF5b3V0ACwAAAAAFgFnAAAH/oBngoOEhYaHiImKi4yNjo+QkZKTlJWW
+l5iZmpucnZ6foKGio6SlpqeoqaqrrK2ur7CxsrO0tba3uLm6u7y9vr/AwcLDxMXGmkM3ysvMzc7P
+0NHS0CjT1tfY19XZ3N3Y297h4sxDlQDj6OLn6ezZ6+3w0u/x9M0A5r/3vvq9/Lz+kQDqEpiLIC6D
+txAyUliLIS2HsyDKkniIIiyLrzC60tiKoyCPq0CqEpmKJCqQJk+lNLWyVEtSKPPJ3Ddz0stRN0Xl
+DLUTVEyaQPvVlNTzU1FPRzsl5fRTaNB/QwNGHTi1IL6nu5Zu0qqpKVSsVME+4pqJLCazl9Ba8oqp
+jAIA/gTCIOXkVsAVo52OAABgV6kmMxr2Cgbil9LLGh/OIJ6r6QgBLAfuMm48YYzPT1siF7a5qUyD
+u1HibtaUWfLoS55NT+a0+DSklqXPxK5EJkuhm7NdV8pMYW9i3YJsT8q99Wqm2MQn/cihZRBuzasv
+RenrdgnwM8uFQzpSOfrrTcihW5KyogiYM89VF9cUWq7i3+sRTVlB5Lyj6ngNd/58pn0mMUmY4ER6
++R2nGWCEMbUIGQE2QUYj3Fnm3VibIPgeJ178kEFz4Imn4F8aEJbcWY18Ec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CJM/oSi
+R0gShWs5Q4aYY4kaiKiLlvDCBUjZCNcRMYh3zMSXFuEDHGAJS1e65Y20xKVGvPJNurTSjUbQox8N
+6ZhAosEf3ZIkADxQXsHU0QWI6SNkIrNIKlJAHSkpwEvIUEKK6AKfxrmncZbJT4BSxBZUIIgTlsic
+ZyrnE1bQJkws8gxkgieaIEDPFkaiBlCapR21dxwn7UWQTErEpCqlCMBQEJRrKdQKnkAaVFKiUB2g
+aEEPCk5YEpRshygV7VwRAU3lbRaZQsIA+qc+kBLCVriKhaos0CpcqIpVNpxaNwNXCGTJoldWyJ5C
+fcVDl35Up0blKVJjyT6lNvUgW/TfUp+6jzkhJhWqBqxfJQ+4Pqd6FXZXrepUv8rHsWK1q2e1qlnF
+SlVbsKWt4wurW6O6saxKFa5gZCn+5mrXiijNZn8FWmDTEbTBuqMSHDDsODCgWHEwtrHeeCxkucGB
+Y1j2spjNrGY3y9nOevazoA2taEdL2tKa9rSoTa1qV8va1rr2tbCNrWxnS9va2va2uM3tLQIBADs=
Documentation/DocBook/media/nv12mt_example.gif.b64 new file +121 -0

121 lines not on this page · raw message

Documentation/DocBook/media/pipeline.png.b64 new file +213 -0

213 lines not on this page · raw message

Documentation/DocBook/media/v4l/bayer.pdf deleted binary +0 -0
deleted file mode 100644
index 905e60e..0000000
Binary files a/Documentation/DocBook/media/v4l/bayer.pdf and /dev/null differ
Documentation/DocBook/media/v4l/bayer.png deleted binary +0 -0
deleted file mode 100644
index 9b15fb2..0000000
Binary files a/Documentation/DocBook/media/v4l/bayer.png and /dev/null differ
Documentation/DocBook/media/v4l/crop.gif deleted binary +0 -0
deleted file mode 100644
index 3b9e7d8..0000000
Binary files a/Documentation/DocBook/media/v4l/crop.gif and /dev/null differ
Documentation/DocBook/media/v4l/fieldseq_bt.gif deleted binary +0 -0
deleted file mode 100644
index 60e8569..0000000
Binary files a/Documentation/DocBook/media/v4l/fieldseq_bt.gif and /dev/null differ
Documentation/DocBook/media/v4l/fieldseq_tb.gif deleted binary +0 -0
deleted file mode 100644
index 718492f..0000000
Binary files a/Documentation/DocBook/media/v4l/fieldseq_tb.gif and /dev/null differ
Documentation/DocBook/media/v4l/nv12mt.gif deleted binary +0 -0
deleted file mode 100644
index ef2d4cf..0000000
Binary files a/Documentation/DocBook/media/v4l/nv12mt.gif and /dev/null differ
Documentation/DocBook/media/v4l/nv12mt_example.gif deleted binary +0 -0
deleted file mode 100644
index df81d68..0000000
Binary files a/Documentation/DocBook/media/v4l/nv12mt_example.gif and /dev/null differ
Documentation/DocBook/media/v4l/pipeline.png deleted binary +0 -0
deleted file mode 100644
index f19b86c..0000000
Binary files a/Documentation/DocBook/media/v4l/pipeline.png and /dev/null differ
Documentation/DocBook/media/v4l/subdev-formats.xml +0 -3
index 8d3409d..bab7071 100644
@@ -380,9 +380,6 @@
 	<title>Bayer Patterns</title>
 	<mediaobject>
 	  <imageobject>
-	    <imagedata fileref="bayer.pdf" format="PS" />
-	  </imageobject>
-	  <imageobject>
 	    <imagedata fileref="bayer.png" format="PNG" />
 	  </imageobject>
 	  <textobject>
Documentation/DocBook/media/v4l/vbi_525.gif deleted binary +0 -0
deleted file mode 100644
index 5580b69..0000000
Binary files a/Documentation/DocBook/media/v4l/vbi_525.gif and /dev/null differ
Documentation/DocBook/media/v4l/vbi_625.gif deleted binary +0 -0
deleted file mode 100644
index 34e3251..0000000
Binary files a/Documentation/DocBook/media/v4l/vbi_625.gif and /dev/null differ
Documentation/DocBook/media/v4l/vbi_hsync.gif deleted binary +0 -0
deleted file mode 100644
index b02434d..0000000
Binary files a/Documentation/DocBook/media/v4l/vbi_hsync.gif and /dev/null differ
Documentation/DocBook/media/vbi_525.gif.b64 new file +84 -0

84 lines not on this page · raw message

Documentation/DocBook/media/vbi_625.gif.b64 new file +90 -0

90 lines not on this page · raw message

Documentation/DocBook/media/vbi_hsync.gif.b64 new file +43 -0

43 lines not on this page · raw message

#1 lore raw
Quoted 6 lines · Mauro Carvalho Chehab

The patch utility doesn't work with non-binary files. This causes some tools to break, like generating tarball targets and the scripts that generate diff patches at http://www.kernel.org/pub/linux/kernel/v2.6/.

So, let's convert all binaries to ascii using base64, and add a logic at Makefile to convert them back into binaries at runtime.

Given that all the gifs are not just relatively trivial, but also things that looks like they originated or at least should as vector graphics I'd recommend to replace them by SVG files. These also have the benefit of actually beeing practically patchable.

#2 lore raw

Em 16-06-2011 11:25, Christoph Hellwig escreveu:

Quoted 5 lines · Mauro Carvalho Chehab
Quoted 4 lines

The patch utility doesn't work with non-binary files. This causes some tools to break, like generating tarball targets and the scripts that generate diff patches at http://www.kernel.org/pub/linux/kernel/v2.6/.

Quoted 7 lines
Quoted 2 lines

So, let's convert all binaries to ascii using base64, and add a logic at Makefile to convert them back into binaries at runtime.

Given that all the gifs are not just relatively trivial, but also things that looks like they originated or at least should as vector graphics I'd recommend to replace them by SVG files. These also have the benefit of actually beeing practically patchable.

This is a good idea, but it would require to re-draw everything, as we don't have those files vectorized (I might have one or two svg files on an older tree, as I had to re-generate some graphics that used to be just pdf).

One of the reasons why SVG was not used in the past is that there used to have a target to generate pdf files, and I think that the DocBook tools available on that time weren't capable of working with svg. Not sure if xmlto currently supports it, but, as we've removed the pdf generation for the media API, changing them to svg is ok.

Mauro.