Server: ACMP: INFO output invalid

Created on 20 Nov 2018  路  8Comments  路  Source: CasparCG/server

When using the INFO command with CHANNEL-LAYER syntax the expected output is an XML containing specific information about the layer.
e.g. (output from 2.1 on linux):

INFO 2-10
201 INFO OK
<?xml version="1.0" encoding="utf-8"?>
<layer>
   <auto_delta>null</auto_delta>
   <frame-number>4112</frame-number>
   <nb_frames>4177</nb_frames>
   <frames-left>65</frames-left>
   <frame-age>81</frame-age>
   <foreground>
      <producer>
         <type>ffmpeg-producer</type>
         <filename>/data/media//REDACTED/2897.mp4</filename>
         <width>1920</width>
         <height>1080</height>
         <progressive>true</progressive>
         <fps>25</fps>
         <loop>false</loop>
         <frame-number>4112</frame-number>
         <nb-frames>4177</nb-frames>
         <file-frame-number>4113</file-frame-number>
         <file-nb-frames>4177</file-nb-frames>
      </producer>
   </foreground>
   <background>
      <producer>
         <type>empty-producer</type>
      </producer>
   </background>
   <index>10</index>
</layer>

instead we get output for the entire channel:

INFO 1-10
201 INFO OK
<?xml version="1.0" encoding="utf-8"?>
<channel>
   <framerate>50</framerate>
   <framerate>1</framerate>
   <mixer>
      <audio>
         <volume>0</volume>
         <volume>0</volume>
         <volume>0</volume>
         <volume>0</volume>
         <volume>0</volume>
         <volume>0</volume>
         <volume>0</volume>
         <volume>0</volume>
      </audio>
   </mixer>
   <stage>
      <layer>
         <10>
            <background>
               <file>
                  <name>REDACTED/2897.mp4</name>
                  <path>/data/media//REDACTED/2897.mp4</path>
                  <stime>0</stime>
                  <stime>0</stime>
                  <streams>
                     <0>
                        <fps>0</fps>
                        <fps>0</fps>
                     </0>
                     <1>
                        <fps>25</fps>
                        <fps>1</fps>
                     </1>
                  </streams>
                  <time>0</time>
                  <time>0</time>
               </file>
               <loop>false</loop>
               <producer>transition</producer>
               <transition>
                  <frame>0</frame>
                  <frame>0</frame>
                  <type>cut</type>
               </transition>
            </background>
            <foreground>
               <file>
                  <name>REDACTED/1299.mp4</name>
                  <path>/data/media//REDACTED/1299.mp4</path>
                  <stime>3.04</stime>
                  <stime>3.0800000000000001</stime>
                  <streams>
                     <0>
                        <fps>25</fps>
                        <fps>1</fps>
                     </0>
                     <1>
                        <fps>0</fps>
                        <fps>0</fps>
                     </1>
                  </streams>
                  <time>3.04</time>
                  <time>-9223372036851.6992</time>
               </file>
               <loop>false</loop>
               <paused>false</paused>
               <producer>ffmpeg</producer>
            </foreground>
         </10>
         <15>
            <background>
               <producer>empty</producer>
            </background>
            <foreground>
               <file>
                  <path>file:///data/media/redacted/redacted.html?artist=AYA+NAKAMURA&amp;title=DJadja</path>
               </file>
               <paused>false</paused>
               <producer>html</producer>
            </foreground>
         </15>
         <20>
            <background>
               <producer>empty</producer>
            </background>
            <foreground>
               <file>
                  <path>/data/media/REDACTED/fullscreen_wh.png</path>
               </file>
               <paused>false</paused>
               <producer>image</producer>
            </foreground>
         </20>
      </layer>
   </stage>
</channel>

Not only does this not match expectations, the output XML also fails XML validation tests. And does not parse in for example PHP simplexml_load_string.

Also it contains multiple identical keynames, making automated processing difficult.

This is on CasparCG on ubuntu 18.04 from master git

amcp typbug

Most helpful comment

All 8 comments

To clarify, the XML fails verification due to not conforming to spec:
according to https://www.w3schools.com/xml/xml_elements.asp

XML Naming Rules

XML elements must follow these naming rules:

    Element names are case-sensitive
    Element names must start with a letter or underscore
    Element names cannot start with the letters xml (or XML, or Xml, etc)
    Element names can contain letters, digits, hyphens, underscores, and periods
    Element names cannot contain spaces

Any name can be used, no words are reserved (except xml).

Those that are in breach of the spec are the layers and streams, as both start with a number instead of a letter or underscore.

I would suggest renaming them to layer_num and stream_num

1064 does indeed resolve the XML spec violations

From #1064:

For example <0> will now be

That fixes the XML spec. violations.

@gizahNL Also it contains multiple identical keynames, making automated processing difficult.

What would you suggest to improve it? I rarely touch xml, so don't know what would be best.
This xml is being generated from the osc data, so it needs to be a generic rule that can apply to the whole thing.

The options I can think of are

<stime>
  <value>3.04</value>
  <value>3.0800000000000001</value>
</stime>
<stime val1="3.04" val2="3.0800000000000001" />



md5-aac4c01249a17d35b3377896cf0832be



<stime>3.04</stime>
<stime_2>3.0800000000000001</stime_2>

@gizahNL Also it contains multiple identical keynames, making automated processing difficult.

See the quote below. More information about this can be found in #923.

@ronag It's a consequence of converting OSC data into XML. In osc fpsis `25,1麓 where the first value is the numerator and the second one is the denominator. I'll see what I can do to improve this.

Another observation is that it is possible to generate some technically valid, but really weird looking xml, that I expect will be difficult to parse:

<timecode>
   00:02:48:25
   <smpte>00:02:48:12</smpte>
</timecode>

I haven't seen it in anything in master, but am in a custom branch

The xml appears valid now, and as this was released with some 'quirks' in 2.2, I would rather not change it unless necessary

Was this page helpful?
0 / 5 - 0 ratings