Number of segments in a DASH MPD - segment

How can I determine the number of segments of a DASH media if the MPD file doesn't have any segment URL's lists? It only has a segment template, so I don't know how many segments the media associated to this MPD has. This is the MPD I'm talking about:
<MPD type="static" xmlns="urn:mpeg:DASH:schema:MPD:2011" profiles="urn:mpeg:dash:profile:full:2011" minBufferTime="PT1.5S" mediaPresentationDuration="PT0H1M59.89S">
<ProgramInformation moreInformationURL="http://gpac.sourceforge.net">
<Title>Media Presentation Description for file hdworld_0696kbps_ffmpeg_track1.mp4 generated with GPAC </Title>
</ProgramInformation>
<Period start="PT0S" duration="PT0H1M59.89S">
<AdaptationSet>
<ContentComponent id="1" contentType="video"/>
<SegmentTemplate initialization="/$Bandwidth$/hdworld_ffmpeg_track1_dash.mp4" timescale="1000" duration="4920" media="/$Bandwidth$/hdworld_ffmpeg_track1_$Number$.m4s" startNumber="1"/>
<Representation id="1" mimeType="video/mp4" codecs="avc1.64001f" width="1280" height="720" startWithSAP="1" bandwidth="534343"/>
<Representation id="2" mimeType="video/mp4" codecs="avc1.64001f" width="1280" height="720" startWithSAP="1" bandwidth="812553"/>
<Representation id="3" mimeType="video/mp4" codecs="avc1.64001f" width="1280" height="720" startWithSAP="1" bandwidth="1607692"/>
</AdaptationSet>
<AdaptationSet>
<ContentComponent id="2" contentType="audio" lang="und"/>
<SegmentTemplate initialization="/audio/HDWorld_audio_init.mp4"/>
<Representation id="6" mimeType="audio/mp4" codecs="mp4a.40.02" sampleRate="44100" numChannels="2" lang="und" startWithSAP="1" bandwidth="257141">
<SegmentTemplate timescale="1000" duration="9980" media="/audio/hdworld_seg_audio$Number$.m4s" startNumber="1"/>
</Representation>
</AdaptationSet>
</Period>
</MPD>
My goal is to retrieve all existent segments' URIs.

In this example, you can see the audio segments are each 9.98 seconds long (duration=9980, timescale=1000). Since the duration of the presentation is 1m 59.89s, (duration="PT0H1M59.89S"), that's about 13 segments (the last one being shorter).
Use the URL template (/audio/hdworld_seg_audio$Number$.m4s) to retrieve each segment (replace $Number$ with the segment number you want (the first one being 1).
The same applies for video segments (except that they are 4.92 seconds each, so you'll have 25 segments)

Related

determine text length in apache fop?

I'm generating some PDFs and sometimes the User Input is too long to fit into a table cell. So at certain spots, I just truncated Strings longer than x characters. But that is always a guess. Is there any way to figure out what size a certain text will be printed?
my document looks a bit liks this:
<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format" font-family="Helvetica">
<fo:table table-layout="fixed" width="200mm">
<fo:table-column column-width="20mm"/>
<fo:table-column column-width="25mm"/>
...
<fo:table-body>
<fo:table-row>
<fo:table-cell border="black 1pt solid" padding="0.6mm 1mm 0.5mm 1mm">
<fo:block text-align="right" font-weight="bold" font-size="8.4pt">Name:</fo:block>
</fo:table-cell>
<fo:table-cell border="black 1pt solid" padding="0.6mm 1mm 0.5mm 1mm">
<fo:block text-align="left" font-weight="normal" font-size="8.4pt">FirstName LastName</fo:block>
</fo:table-cell>
...
</fo:table-row>
and I'd like to know in advance if "FirstName LastName" will fit into the 25mm when rendered.

Inkscape shell - change text

Is there any verb/action in Inkscape --shell mode to change/edit text in svg? I know I can do it in svg directly, but shell mode without temporary files seems cleaner to me.
BTW any chance of reading/writing files from/to stdin/stdout in shell mode? Same reason - avoid temp. files.
SVG file - critical part almost at the bottom - "text to edit"
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="210mm"
height="297mm"
viewBox="0 0 210 297"
version="1.1"
id="svg1090"
inkscape:version="1.0.2 (e86c870879, 2021-01-15)"
sodipodi:docname="drawing.svg">
<defs
id="defs1084" />
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="0.35"
inkscape:cx="400"
inkscape:cy="560"
inkscape:document-units="mm"
inkscape:current-layer="layer1"
inkscape:document-rotation="0"
showgrid="false"
inkscape:window-width="1920"
inkscape:window-height="1027"
inkscape:window-x="-8"
inkscape:window-y="-8"
inkscape:window-maximized="1" />
<metadata
id="metadata1087">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1">
<text
xml:space="preserve"
style="font-weight:bold;font-size:6.35px;line-height:1.25;font-family:Arial;-inkscape-font-specification:'Arial Bold';letter-spacing:0px;word-spacing:0px;stroke-width:0.264583"
x="42.333332"
y="46.113091"
id="text1655"><tspan
sodipodi:role="line"
id="tspan1653"
x="42.333332"
y="46.113091"
style="stroke-width:0.264583">text to edit</tspan></text>
</g>
</svg>
If you're after modifying the SVG with various different texts, try the https://gitlab.com/Moini/nextgenerator extension.
It should also be possible to run it standalone (never tried that, though).

Dotted border background on Apache FOP

I'm generating some PDF with Apache FOP and I would like to have some dotted borders on some cells. However, it seems that the border background takes its color from the Table itself and not the cell, which is rather odd IMHO.
This is a simple example :
<?xml version="1.0" encoding="UTF-8" ?>
<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format" xml:lang="en">
<fo:layout-master-set>
<fo:simple-page-master master-name="A4-landscape" page-height="210mm" page-width="297mm">
<fo:region-body margin-top="15mm" margin-bottom="15mm" margin-left="15mm" margin-right="15mm" />
<fo:region-before region-name="docHeader"/>
<fo:region-after region-name="docFooter" extent="15mm" />
</fo:simple-page-master>
</fo:layout-master-set>
<fo:page-sequence master-reference="A4-landscape" initial-page-number="1">
<fo:flow flow-name="xsl-region-body">
<fo:block>
<fo:table table-layout="fixed" break-after="page" background-color="red">
<fo:table-column column-width="100.0mm" />
<fo:table-body>
<fo:table-row height="25.0mm">
<fo:table-cell text-align="center" display-align="center" background-color="blue" border-top="0.35277778mm dotted green"
border-bottom="0.35277778mm solid rgb(0,0,0)"
border-left="0.35277778mm solid rgb(0,0,0)"
border-right="0.35277778mm solid rgb(0,0,0)">
<fo:block-container overflow="hidden">
<fo:block wrap-option="no-wrap">test</fo:block>
</fo:block-container>
</fo:table-cell>
</fo:table-row>
</fo:table-body>
</fo:table>
</fo:block>
<fo:block id="endOfDoc"></fo:block>
</fo:flow>
</fo:page-sequence>
</fo:root>
And this is the result :
Do you have any ideas how to set the border's background color?
Id this a normal behaviour?
Yes, this is normal behavior. The cell is drawn inside the border and the dotted border is split between. Using RenderX XEP with miters corners and this becomes a little more obvious in what happens. Look at this zoomed image of the corner:
Now, you could try to juggle around what you are doing as one option. Like this:
<fo:table table-layout="fixed" break-after="page" background-color="red">
<fo:table-column column-width="100.0mm" />
<fo:table-body>
<fo:table-row>
<fo:table-cell background-color="blue" display-align="center"
border-bottom="0.35277778mm solid rgb(0,0,0)"
border-left="0.35277778mm solid rgb(0,0,0)"
border-right="0.35277778mm solid rgb(0,0,0)">
<fo:block-container height="25.0mm" overflow="hidden" border-top="0.35277778mm dotted green" text-align="center" >
<fo:block wrap-option="no-wrap">test</fo:block>
</fo:block-container>
</fo:table-cell>
</fo:table-row>
</fo:table-body>
</fo:table>
and you would get this:

Xpath 1.0 Reference Original Context from Sibling Axes

Using XPath 1.0, and given the following XML:
<Root>
<Line ID="1">
<Key>1</Key>
<Value>10001</Value>
</Line>
<Line ID="2">
<Key>2</Key>
<Value>10020</Value>
</Line>
<Line ID="3">
<Key>1</Key>
<Value>10300</Value>
</Line>
<Line ID="4">
<Key>2</Key>
<Value>14000</Value>
</Line>
</Root>
I need to be able to sum the values of all the lines that match the key of the "current" line being checked. So assuming the context is /Root/Line[2], then the sum should be 24020.
Unfortunately, using following/preceding sibling axes results in not being able to back reference the original "self" to predicate the key. Ex: following-sibling::Line[Key=./Key]/Value would return 10300 instead of 14000 because . is the current node on the sibling axes. I can't figure out how I would reference back to the original context?

Apache FOP: zindex does not appear to be working in overlapping blocks

I am a FOP newb. I am trying to show text on top of an image by using block-container's and zindexes. The image is always on top though. If i remove the image, i can see the text, so the text is under the image.
This is inside of a table cell. here is the relevant code:
<fo:table-cell padding="0.000pt" text-align="left" display-align="before">
<fo:block>
<fo:block-container z-index="2" position="absolute" left="0.913in" top="0.139in" width="0.946in" height="0.198in" overflow="hidden">
<fo:block><fo:inline font-family="Verdana" font-size="8pt">Leasure Station</fo:inline></fo:block>
</fo:block-container>
<fo:block-container z-index="2" position="absolute" left="0.091in" top="0.431in" width="0.302in" height="0.239in" overflow="hidden">
<fo:block><fo:inline font-family="Verdana" font-size="8pt">#1</fo:inline></fo:block>
</fo:block-container>
<fo:block-container z-index="2" position="absolute" left="0.653in" top="0.431in" width="1.186in" height="0.177in" overflow="hidden">
<fo:block><fo:inline font-family="Verdana" font-size="8pt">ASDF1234QWER</fo:inline></fo:block>
</fo:block-container>
<fo:block-container z-index="1" position="absolute" left="0in" top="0in" width="48.5mm" height="20mm" overflow="hidden">
<fo:block><fo:external-graphic src="url(.\fop-1.0\img\orange_s_text.png)" content-width="48.500mm" scaling="non-uniform" content-height="20.000mm"/></fo:block>
</fo:block-container>
</fo:block>
</fo:table-cell>
moved the block with index 1 before all the zindex=2 blocks and it worked. whatever.

Resources