August'24: Kamaelia is in maintenance mode and will recieve periodic updates, about twice a year, primarily targeted around Python 3 and ecosystem compatibility. PRs are always welcome. Latest Release: 1.14.32 (2024/3/24)

Cookbook Example

How can I...?

Example 10: Simple dirac player. Shows how to play a specific file. Components used:ReadFileAdaptor, DiracDecoder, MessageRateLimit, VideoOverlay

#!/usr/bin/python

from Kamaelia.Util.PipelineComponent import pipeline
from Kamaelia.Codec.Dirac import DiracDecoder
from Kamaelia.ReadFileAdaptor import ReadFileAdaptor
from Kamaelia.Util.RateFilter import MessageRateLimit
from Kamaelia.UI.Pygame.VideoOverlay import VideoOverlay

file = "snowboard-jum-352x288x75.dirac.drc"
framerate = 15

pipeline(
         ReadFileAdaptor(file, readmode="bitrate",
                         bitrate = 300000*8/5),
         DiracDecoder(),
         MessageRateLimit(framerate),
         VideoOverlay(),
).run()

Source: Examples/example10/SimpleDiracPlayer.py