for connected embedded systems
![]() |
![]() |
![]() |
Media API Basics
The Media API consists of a set of states, commands, and data structures that're needed for a plugin to switch from one state to the other. This information is defined in the MvPluginState structure in the <Mv.h> header file.
Plugin states
The following is a list of valid plugin states. A description of each state is in the MvCommandType Descriptions appendix.
MV_CLOSED
MV_DEAD
MV_NOTREADY
MV_OPENING
MV_PAUSED
MV_PLAYBW
MV_PLAYING
MV_PREFETCHING
MV_SCANBW
MV_SCANFW
MV_SLOW
MV_STEP
MV_STOPPED
Command types
The following list details some of the command types defined in <Mv.h>. All commands are mutually exclusive, that is, you can't make two commands into one. A description of each command is in the MvCommandType Descriptions appendix.
CMD_PLUGIN_CLOSE
CMD_PLUGIN_DIRECT_AUDIO
CMD_PLUGIN_DISPLAY_GUI
CMD_PLUGIN_GET_STATUS
CMD_PLUGIN_MUTE
CMD_PLUGIN_OPEN_URLS
CMD_PLUGIN_PAUSE
CMD_PLUGIN_RESERVED_0
CMD_PLUGIN_SCAN_BACK
CMD_PLUGIN_SCAN_FORWARD
CMD_PLUGIN_SEEK_RELATIVE
CMD_PLUGIN_SEEK_TO
CMD_PLUGIN_SEND_MESSAGE
CMD_PLUGIN_SET_GUI_STATUS
CMD_PLUGIN_SET_PARAMETER
CMD_PLUGIN_SET_WINDOW
CMD_PLUGIN_SLOW_MOTION
CMD_PLUGIN_START
CMD_PLUGIN_STEP
CMD_PLUGIN_STOP
CMD_PLUGIN_USER_0
Switching between plugin states
Generally, the flow of execution for a plugin is for phplay to:
- load the plugin and call MvInit() to initialize
- send commands to play, stop, etc.,
- terminate and unload the plugin.
The following diagram details how states switch between the media player and the plugins:

A generalized Plugin State Transition Diagram.
- Note 1
- The phplay media player doesn't allow you to do this because play and pause are the same button, but the plugins can handle this.
- Note 2
- When you want to play a media file, the application must send CMD_PLUGIN_OPEN_URLS to the plugin. If the player doesn't need to change plugins to play the file, it sends CMD_PLUGIN_CLOSE followed by the CMD_PLUGIN_OPEN_URLS command.
- Note 3
- After a CMD_PLUGIN_OPEN_URLS command has been sent, the player waits for the plugin to change its state to MV_STOPPED, and then it sends CMD_PLUGIN_SEEK_TO with an offset of 0 to reposition the file pointer to the beginning of the file.
![]() |
![]() |
![]() |

![[Previous]](prev.gif)
![[Contents]](contents.gif)
![[Next]](next.gif)