Document how to create a more interesting VideoFont
[vidi-player.git] / create_test_videofont.py
index 40125a6..92f17b5 100755 (executable)
@@ -35,8 +35,19 @@ FILE_PIPELINE_TEMPLATE = """
 """ % (VIDEO_BUFFERS, VIDEO_FRAMERATE, FONT_DESC, AUDIO_BUFFERS,
        AUDIO_SAMPLESPERBUFFER, AUDIO_SAMPLERATE)
 
+PNG_REST_SAMPLE_TEMPLATE = """
+  videotestsrc num-buffers=1 pattern=black ! \
+          textoverlay valignment=center halignment=center font-desc="%s" text="rest" ! \
+          pngenc ! filesink location="{0}/sample_rest.png"
+""" % FONT_DESC
+
 
 def create_test_videofont(pipeline_template, notes_range, destination_dir=None):
+    print("Silence")
+    pipeline_string = pipeline_template.format("rest", 0, destination_dir)
+    player = vidi.Player.from_pipeline_string(pipeline_string)
+    player.play()
+
     for i, note_number in enumerate(notes_range):
         note = vidi.SpnNote(note_number)
 
@@ -72,6 +83,10 @@ def main():
         os.mkdir(destination_dir)
         create_test_videofont(FILE_PIPELINE_TEMPLATE, notes_range,
                               destination_dir)
+
+        pipeline_string = PNG_REST_SAMPLE_TEMPLATE.format(destination_dir)
+        player = vidi.Player.from_pipeline_string(pipeline_string)
+        player.play()
     else:
         create_test_videofont(LIVE_PIPELINE_TEMPLATE, notes_range)