Download SDK 5.0 User Manual - grass valley developers

Transcript
Playing a list of movies
Playing a list of movies
Example 4, play_multi.c shows you how to play a list of movies in the JPEG compression
format. First, the command line is parsed for a list of movies. Up to five movies are
concatenated together and stored in an array. Each movie will be played in its entirety,
immediately followed by the next movie.
As always, the appropriate resources must be allocated for later use. Therefore, the program
establishes a connection to the local machine with RemOpenConnection, and opens a port
using VdrOpenPortConnection. Next, the program determines the standard video format for
the machine with CfgGetStandard, and with VdrSetVideoFormat, sets the format.
Then the code allocates a JPEG codec resource with VdrAllocateResource, and attached to
the port with a call to VdrGetResourceConnectionHandle. The codec allows video
decoding to occur on the specified port. Similarly, the program allocates two audio codecs,
again with VdrAllocateResource, one for each stereo channel. The video input and output
resources are then allocated and attached to the port using similar calls. Finally, default events
(VdrDefaultEvent) and scheduled events (VdrScheduleEvent) are setup that describe the
connections that occur when the port is in various states. (See Example 9, stateevt.c on
page 100 in for more information about these events and how to gain more control over their
behavior.)
Once the resources are obtained, the code performs the playback. The program opens each
movie with PdrOpenMovie and a call to the function VdrAttachOpenMovie attaches each
movie to the timeline. In this example, each movie in succession is attached to the end of the
timeline. Other applications could use different insertion methods to place movies in a
different order, shifting before or after other media files. After attachment, the port is cued for
play with VdrCuePlay. It begins playing the movies in succession when the Profile is
instructed to shuttle (VdrShuttle). After all the movies have finished playing, idle mode is set
with VdrIdle and the movies are detached with VdrDetachMovie and closed with
PdrCloseMovie.
Finally, the resources acquired during execution must be released. The Profile is told to release
all of the handles acquired during the setup phase (VdrReleaseResource), and the port is
closed (VdrClosePort).
Preliminary — 12 July 2001
Profile Software Development Kit User
69