mediastreamer2 5.2.0
|
Video streaming API - Easily run video streams from camera capture or static picture files to RTP. More...
Data Structures | |
struct | _MediastreamVideoStat |
struct | _VideoStream |
Macros | |
#define | video_preview_set_event_callback(p, c, u) video_stream_set_event_callback(p,c,u) |
#define | video_preview_set_size(p, s) video_stream_set_sent_video_size(p,s) |
#define | video_preview_set_display_filter_name(p, dt) video_stream_set_display_filter_name(p,dt) |
#define | video_preview_create_native_window_id(p) video_stream_create_native_preview_window_id(p) |
#define | video_preview_set_native_window_id(p, id) video_stream_set_native_preview_window_id(p,id) |
#define | video_preview_get_native_window_id(p) video_stream_get_native_preview_window_id(p) |
#define | video_preview_set_fps(p, fps) video_stream_set_fps((VideoStream*)p,fps) |
#define | video_preview_set_device_rotation(p, r) video_stream_set_device_rotation(p, r) |
Typedefs | |
typedef void(* | VideoStreamRenderCallback) (void *user_pointer, const MSPicture *local_view, const MSPicture *remote_view) |
typedef void(* | VideoStreamEventCallback) (void *user_pointer, const MSFilter *f, const unsigned int event_id, const void *args) |
typedef void(* | VideoStreamCameraNotWorkingCallback) (void *user_pointer, const MSWebCam *old_webcam) |
typedef void(* | VideoStreamEncoderControlCb) (struct _VideoStream *, unsigned int method_id, void *arg, void *user_data) |
typedef void(* | VideoStreamCsrcChangedCb) (void *user_pointer, uint32_t new_csrc) |
typedef struct _MediastreamVideoStat | MediaStreamVideoStat |
typedef enum _MSVideoContent | MSVideoContent |
typedef struct _VideoStream | VideoStream |
typedef VideoStream | VideoPreview |
Enumerations | |
enum | _MSVideoContent { MSVideoContentDefault , MSVideoContentSpeaker , MSVideoContentThumbnail } |
Functions | |
VideoStream * | video_stream_new (MSFactory *factory, int loc_rtp_port, int loc_rtcp_port, bool_t use_ipv6) |
VideoStream * | video_stream_new2 (MSFactory *factory, const char *ip, int loc_rtp_port, int loc_rtcp_port) |
VideoStream * | video_stream_new_with_sessions (MSFactory *factory, const MSMediaStreamSessions *sessions) |
void | video_stream_set_direction (VideoStream *vs, MediaStreamDir dir) |
void | video_stream_set_render_callback (VideoStream *s, VideoStreamRenderCallback cb, void *user_pointer) |
void | video_stream_set_event_callback (VideoStream *s, VideoStreamEventCallback cb, void *user_pointer) |
void | video_stream_set_camera_not_working_callback (VideoStream *s, VideoStreamCameraNotWorkingCallback cb, void *user_pointer) |
void | video_stream_set_display_filter_name (VideoStream *s, const char *fname) |
void | video_stream_set_label (VideoStream *s, const char *label) |
void | video_stream_set_content (VideoStream *s, MSVideoContent content) |
MSVideoContent | video_stream_get_content (const VideoStream *vs) |
int | video_stream_start_with_source (VideoStream *stream, RtpProfile *profile, const char *rem_rtp_ip, int rem_rtp_port, const char *rem_rtcp_ip, int rem_rtcp_port, int payload, int jitt_comp, MSWebCam *cam, MSFilter *source) |
int | video_stream_start (VideoStream *stream, RtpProfile *profile, const char *rem_rtp_ip, int rem_rtp_port, const char *rem_rtcp_ip, int rem_rtcp_port, int payload, int jitt_comp, MSWebCam *device) |
int | video_stream_start_with_files (VideoStream *stream, RtpProfile *profile, const char *rem_rtp_ip, int rem_rtp_port, const char *rem_rtcp_ip, int rem_rtcp_port, int payload_type, const char *play_file, const char *record_file) |
int | video_stream_start_from_io (VideoStream *stream, RtpProfile *profile, const char *rem_rtp_ip, int rem_rtp_port, const char *rem_rtcp_ip, int rem_rtcp_port, int payload_type, const MSMediaStreamIO *io) |
void | link_video_stream_with_itc_sink (VideoStream *stream) |
void | video_stream_prepare_video (VideoStream *stream) |
void | video_stream_unprepare_video (VideoStream *stream) |
void | video_stream_set_relay_session_id (VideoStream *stream, const char *relay_session_id) |
const MSWebCam * | video_stream_get_camera (const VideoStream *stream) |
MSFilter * | video_stream_get_source_filter (const VideoStream *stream) |
void | video_preview_stream_change_camera (VideoStream *stream, MSWebCam *cam) |
void | video_stream_change_camera (VideoStream *stream, MSWebCam *cam) |
void | video_stream_change_camera_skip_bitrate (VideoStream *stream, MSWebCam *cam) |
MSFilter * | video_stream_change_source_filter (VideoStream *stream, MSWebCam *cam, MSFilter *filter, bool_t keep_previous_source) |
This functions changes the source filter for the passed video stream. | |
void | video_stream_forward_source_stream (VideoStream *stream, VideoStream *source) |
This function forwards the video from the source stream to the specifed one. | |
MSFilter * | video_stream_change_camera_keep_previous_source (VideoStream *stream, MSWebCam *cam) |
This is the same function as video_stream_change_source_filter() called with keep_source=1, but the new filter will be created from the MSWebcam that is passed as argument. | |
void | video_preview_stream_update_video_params (VideoStream *stream) |
void | video_stream_update_video_params (VideoStream *stream) |
void | video_stream_iterate (VideoStream *stream) |
void | video_stream_set_encoder_control_callback (VideoStream *stream, VideoStreamEncoderControlCb cb, void *user_data) |
void | video_stream_send_fir (VideoStream *stream) |
void | video_stream_send_vfu (VideoStream *stream) |
void | video_stream_stop (VideoStream *stream) |
MSFilter * | video_stream_stop_keep_source (VideoStream *stream) |
bool_t | video_stream_started (VideoStream *stream) |
void | video_stream_set_sent_video_size (VideoStream *stream, MSVideoSize vsize) |
MSVideoSize | video_stream_get_sent_video_size (const VideoStream *stream) |
MSVideoSize | video_stream_get_received_video_size (const VideoStream *stream) |
float | video_stream_get_sent_framerate (const VideoStream *stream) |
float | video_stream_get_received_framerate (const VideoStream *stream) |
void | video_stream_enable_self_view (VideoStream *stream, bool_t val) |
void * | video_stream_create_native_window_id (VideoStream *stream) |
void * | video_stream_get_native_window_id (VideoStream *stream) |
void | video_stream_set_native_window_id (VideoStream *stream, void *id) |
void * | video_stream_create_native_preview_window_id (VideoStream *stream) |
void | video_stream_set_native_preview_window_id (VideoStream *stream, void *id) |
void * | video_stream_get_native_preview_window_id (VideoStream *stream) |
void | video_stream_use_preview_video_window (VideoStream *stream, bool_t yesno) |
void | video_stream_set_device_rotation (VideoStream *stream, int orientation) |
void | video_stream_show_video (VideoStream *stream, bool_t show) |
void | video_stream_set_freeze_on_error (VideoStream *stream, bool_t yesno) |
void | video_stream_set_display_mode (VideoStream *stream, MSVideoDisplayMode mode) |
int | video_stream_get_camera_sensor_rotation (VideoStream *stream) |
Gets the camera sensor rotation. | |
int | video_stream_recv_only_start (VideoStream *videostream, RtpProfile *profile, const char *addr, int port, int used_pt, int jitt_comp) |
int | video_stream_send_only_start (VideoStream *videostream, RtpProfile *profile, const char *addr, int port, int rtcp_port, int used_pt, int jitt_comp, MSWebCam *device) |
void | video_stream_recv_only_stop (VideoStream *vs) |
void | video_stream_send_only_stop (VideoStream *vs) |
void | video_stream_enable_zrtp (VideoStream *vstream, AudioStream *astream) |
void | video_stream_start_zrtp (VideoStream *stream) |
void | video_stream_enable_display_filter_auto_rotate (VideoStream *stream, bool_t enable) |
bool_t | video_stream_is_decoding_error_to_be_reported (VideoStream *stream, uint32_t ms) |
void | video_stream_decoding_error_reported (VideoStream *stream) |
void | video_stream_decoding_error_recovered (VideoStream *stream) |
void | video_stream_set_preview_size (VideoStream *stream, MSVideoSize vsize) |
void | video_stream_set_fps (VideoStream *stream, float fps) |
void | audio_stream_link_video (AudioStream *stream, VideoStream *video) |
void | audio_stream_unlink_video (AudioStream *stream, VideoStream *video) |
void | video_stream_use_video_preset (VideoStream *stream, const char *preset) |
const char * | video_stream_get_video_preset (VideoStream *stream) |
void | video_stream_set_frame_marking_extension_id (VideoStream *stream, int extension_id) |
MSFilter * | video_stream_open_remote_play (VideoStream *stream, const char *filename) |
void | video_stream_close_remote_play (VideoStream *stream) |
MSFilter * | video_stream_open_remote_record (VideoStream *stream, const char *filename) |
void | video_stream_close_remote_record (VideoStream *stream) |
void | video_stream_enable_retransmission_on_nack (VideoStream *stream, bool_t enable) |
void | video_stream_set_retransmission_on_nack_max_packet (VideoStream *stream, unsigned int max) |
void | video_stream_enable_fec (VideoStream *stream, char *local_ip, int local_port, int local_rtcp_port, char *remote_ip, int remote_port, int L, int D) |
void | video_stream_set_sent_video_size_max (VideoStream *stream, MSVideoSize max) |
void | video_stream_set_csrc_changed_callback (VideoStream *stream, VideoStreamCsrcChangedCb cb, void *user_pointer) |
VideoPreview * | video_preview_new (MSFactory *factory) |
void | video_preview_start (VideoPreview *stream, MSWebCam *device) |
void | video_preview_enable_qrcode (VideoPreview *stream, bool_t enable) |
void | video_preview_set_decode_rect (VideoPreview *stream, MSRect rect) |
bool_t | video_preview_qrcode_enabled (VideoPreview *stream) |
MSVideoSize | video_preview_get_current_size (VideoPreview *stream) |
void | video_preview_stop (VideoPreview *stream) |
void | video_preview_change_camera (VideoPreview *stream, MSWebCam *cam) |
void | video_preview_update_video_params (VideoPreview *stream) |
MSFilter * | video_preview_stop_reuse_source (VideoPreview *stream) |
MSWebCamDesc * | ms_mire_webcam_desc_get (void) |
RtpSession * | ms_create_duplex_rtp_session (const char *local_ip, int loc_rtp_port, int loc_rtcp_port, int mtu) |
void | audio_stream_set_audio_route (AudioStream *stream, MSAudioRoute route) |
void | audio_stream_set_audio_route_changed_callback (AudioStream *stream, MSAudioRouteChangedCallback callback, void *audio_route_changed_cb_user_data) |
int | audio_stream_set_input_ms_snd_card (AudioStream *stream, MSSndCard *sndcard_capture) |
int | audio_stream_set_output_ms_snd_card (AudioStream *stream, MSSndCard *sndcard_playback) |
MSSndCard * | audio_stream_get_input_ms_snd_card (AudioStream *stream) |
MSSndCard * | audio_stream_get_output_ms_snd_card (AudioStream *stream) |
Video streaming API - Easily run video streams from camera capture or static picture files to RTP.
typedef VideoStream VideoPreview |
Small API to display a local preview window.
MSSndCard * audio_stream_get_input_ms_snd_card | ( | AudioStream * | stream | ) |
Retrieve the current sound card from the audio capture filter (currently only used for AAudio and OpenSLES)
[in] | stream | The AudioStream object |
MSSndCard * audio_stream_get_output_ms_snd_card | ( | AudioStream * | stream | ) |
Retrieve the current sound card from the audio playback filter (currently only used for AAudio and OpenSLES)
[in] | stream | The AudioStream object |
void audio_stream_link_video | ( | AudioStream * | stream, |
VideoStream * | video | ||
) |
Link the audio stream with an existing video stream. This is necessary to enable recording of audio & video into a multimedia file.
void audio_stream_set_audio_route | ( | AudioStream * | stream, |
MSAudioRoute | route | ||
) |
Asks the audio playback filter to route to the selected device (currently only used for blackberry)
[in] | stream | The AudioStream object |
[in] | route | The wanted audio output device (earpiece, speaker) |
void audio_stream_set_audio_route_changed_callback | ( | AudioStream * | stream, |
MSAudioRouteChangedCallback | callback, | ||
void * | audio_route_changed_cb_user_data | ||
) |
Set a callback to be called when an audio route change is notified (IOS only)
[in] | stream | The AudioStream object |
[in] | callback | The function to call when receiving the route change event |
[in] | audio_route_changed_cb_user_data | Context for the callback |
int audio_stream_set_input_ms_snd_card | ( | AudioStream * | stream, |
MSSndCard * | sndcard_capture | ||
) |
Asks the audio capture filter to route to the selected sound card (currently only used for AAudio and OpenSLES)
[in] | stream | The AudioStream object |
[in] | sndcard_capture | The wanted audio input soundcard |
int audio_stream_set_output_ms_snd_card | ( | AudioStream * | stream, |
MSSndCard * | sndcard_playback | ||
) |
Asks the audio playback filter to route to the selected sound card (currently only used for AAudio and OpenSLES)
[in] | stream | The AudioStream object |
[in] | sndcard_playback | The wanted audio output soundcard |
void audio_stream_unlink_video | ( | AudioStream * | stream, |
VideoStream * | video | ||
) |
Unlink the audio stream from the video stream. This must be done if the video stream is about to be stopped.
void link_video_stream_with_itc_sink | ( | VideoStream * | stream | ) |
Link a video stream with ItcSink filter. Used for starting another video stream.
[in] | stream | VideoStream object previously created with video_stream_new(). |
RtpSession * ms_create_duplex_rtp_session | ( | const char * | local_ip, |
int | loc_rtp_port, | ||
int | loc_rtcp_port, | ||
int | mtu | ||
) |
Create an RTP session for duplex communication.
[in] | local_ip | The local IP to bind the RTP and RTCP sockets to. |
[in] | local_rtp_port | The local port to bind the RTP socket to. |
[in] | local_rtcp_port | The local port to bind the RTCP socket to. |
MSFilter * video_preview_stop_reuse_source | ( | VideoPreview * | stream | ) |
Stops the video preview graph but keep the source filter for reuse. This is useful when transitioning from a preview-only to a duplex video. The filter needs to be passed to the video_stream_start_with_source function, otherwise you should destroy it.
[in] | stream | VideoPreview object |
MSFilter * video_stream_change_camera_keep_previous_source | ( | VideoStream * | stream, |
MSWebCam * | cam | ||
) |
This is the same function as video_stream_change_source_filter() called with keep_source=1, but the new filter will be created from the MSWebcam that is passed as argument.
stream | the video stream |
cam | the MSWebcam from which the new source filter should be created. |
MSFilter * video_stream_change_source_filter | ( | VideoStream * | stream, |
MSWebCam * | cam, | ||
MSFilter * | filter, | ||
bool_t | keep_previous_source | ||
) |
This functions changes the source filter for the passed video stream.
This is quite the same function as video_stream_change_camera, but this one allows you to pass the source filter that is created for the camera and reuse it. This gives you the ability to switch rapidly between two streams, whereas re-creating them each time would be costly (especially with webcams).
Example usage:
video_stream_start(stream, profile, [...], noWebcamDevice); // We manage the sources for the stream ourselves: MSFilter* noWebCamFilter = video_stream_get_source_filter(stream); MSFilter* frontCamFilter = ms_web_cam_create_reader(frontCamDevice); sleep(1); video_stream_change_source_filter(stream, frontCamDevice, frontCamFilter, TRUE); // will keep the previous filter sleep(1); video_stream_change_source_filter(stream, noWebcamDevice, noWebCamFilter, TRUE); // keep the previous filter sleep(1) video_stream_stop_keep_source(stream); ms_filter_destroy(noWebCamFilter); ms_filter_destroy(frontCamFilter);
stream | the video stream to modify |
cam | the camera that you want to set as the new source |
cam_filter | the filter for this camera. It can be obtained with ms_web_cam_create_reader(cam) |
void video_stream_decoding_error_recovered | ( | VideoStream * | stream | ) |
Tell the video stream that a decoding error has been recovered so that new decoding can be reported sooner.
[in] | stream | The VideoStream object. |
void video_stream_decoding_error_reported | ( | VideoStream * | stream | ) |
Tell the video stream that a decoding error has been reported.
[in] | stream | The VideoStream object. |
void video_stream_forward_source_stream | ( | VideoStream * | stream, |
VideoStream * | source | ||
) |
This function forwards the video from the source stream to the specifed one.
This will connect the received video stream from source and will pass it to current stream to send. Using video_stream_change_camera will stop the forwarding and use the provided camera. If the source stream is stopped before this stream, a call to video_stream_change_camera is also required in order to restart the graph.
stream | the video stream to modify |
source | the video stream that will be used as a source |
int video_stream_get_camera_sensor_rotation | ( | VideoStream * | stream | ) |
Gets the camera sensor rotation.
This is needed on some mobile platforms to get the number of degrees the camera sensor is rotated relative to the screen.
stream | The video stream related to the operation |
float video_stream_get_received_framerate | ( | const VideoStream * | stream | ) |
Gets the framerate of the video that is received.
[in] | stream | The videostream. |
MSVideoSize video_stream_get_received_video_size | ( | const VideoStream * | stream | ) |
Gets the size of the video that is received.
[in] | stream | The videostream for which to get the received video size. |
float video_stream_get_sent_framerate | ( | const VideoStream * | stream | ) |
Gets the framerate of the video that is sent.
[in] | stream | The videostream. |
MSVideoSize video_stream_get_sent_video_size | ( | const VideoStream * | stream | ) |
Gets the size of the video that is sent.
[in] | stream | The videostream for which to get the sent video size. |
MSFilter * video_stream_get_source_filter | ( | const VideoStream * | stream | ) |
Returns the current video stream source filter. Be careful, this source will be destroyed if the stream is stopped.
const char * video_stream_get_video_preset | ( | VideoStream * | stream | ) |
Returns the name of the video preset used for the video stream.
[in] | stream | VideoStream object |
bool_t video_stream_is_decoding_error_to_be_reported | ( | VideoStream * | stream, |
uint32_t | ms | ||
) |
Ask the video stream whether a decoding error should be reported (eg. to send a VFU request).
[in] | stream | The VideoStream object. |
[in] | ms | The minimum interval in milliseconds between to decoding error report. |
VideoStream * video_stream_new2 | ( | MSFactory * | factory, |
const char * | ip, | ||
int | loc_rtp_port, | ||
int | loc_rtcp_port | ||
) |
Creates a VideoStream object listening on a RTP port for a dedicated address.
loc_ip | the local ip to listen for RTP packets. Can be ::, O.O.O.O or any ip4/6 addresses | |
[in] | loc_rtp_port | the local UDP port to listen for RTP packets. |
[in] | loc_rtcp_port | the local UDP port to listen for RTCP packets |
MSFilter * video_stream_open_remote_play | ( | VideoStream * | stream, |
const char * | filename | ||
) |
Open a player to play a video file (mkv) to remote end. The player is returned as a MSFilter so that application can make usual player controls on it using the MSPlayerInterface.
MSFilter * video_stream_open_remote_record | ( | VideoStream * | stream, |
const char * | filename | ||
) |
Open a recorder to record the video coming from remote end into a mkv file. This must be done before the stream is started.
void video_stream_send_fir | ( | VideoStream * | stream | ) |
Asks the video stream to send a Full-Intra Request.
[in] | stream | The videostream object. |
void video_stream_send_vfu | ( | VideoStream * | stream | ) |
Asks the video stream to generate a Video Fast Update (generally after receiving a Full-Intra Request.
[in] | stream | The videostream object. |
void video_stream_set_direction | ( | VideoStream * | vs, |
MediaStreamDir | dir | ||
) |
Use media_stream_set_direction() instead
void video_stream_set_fps | ( | VideoStream * | stream, |
float | fps | ||
) |
Force a resolution for the preview.
[in] | stream | The VideoStream object. |
[in] | fps | the frame rate in frame/seconds. A value of zero means "use encoder default value". |
void video_stream_set_frame_marking_extension_id | ( | VideoStream * | stream, |
int | extension_id | ||
) |
Sets the header extension id for frame marking. This has to be called before starting the video stream.
stream | the video stream |
extension_id | the extension id |
void video_stream_set_preview_size | ( | VideoStream * | stream, |
MSVideoSize | vsize | ||
) |
Force a resolution for the preview.
[in] | stream | The VideoStream object. |
[in] | vsize | video resolution. |
void video_stream_set_sent_video_size | ( | VideoStream * | stream, |
MSVideoSize | vsize | ||
) |
Try to set the size of the video that is sent. Since this relies also on the bitrate specified, make sure to set the payload bitrate accordingly with rtp_profile_get_payload and normal_bitrate value otherwise the best possible resolution will be taken instead of the requested one.
[in] | stream | The videostream for which to get the sent video size. |
[in] | vsize | The sent video size wished. |
void video_stream_set_sent_video_size_max | ( | VideoStream * | stream, |
MSVideoSize | max | ||
) |
Sets the max size the sent video stream can reach.
stream | the video stream |
max | the max size the sent videostream can reach. 0x0 will remove this limitation. |
int video_stream_start_from_io | ( | VideoStream * | stream, |
RtpProfile * | profile, | ||
const char * | rem_rtp_ip, | ||
int | rem_rtp_port, | ||
const char * | rem_rtcp_ip, | ||
int | rem_rtcp_port, | ||
int | payload_type, | ||
const MSMediaStreamIO * | io | ||
) |
Start a video stream according to the specified VideoStreamIO.
[in] | stream | VideoStream object previously created with video_stream_new(). |
[in] | profile | RtpProfile object holding the PayloadType that can be used during the video session. |
[in] | rem_rtp_ip | The remote IP address where to send the encoded video to. |
[in] | rem_rtp_port | The remote port where to send the encoded video to. |
[in] | rem_rtcp_ip | The remote IP address for RTCP. |
[in] | rem_rtcp_port | The remote port for RTCP. |
[in] | payload_type | The payload type number used to send the video stream. A valid PayloadType must be available at this index in the profile. |
[in] | io | A VideoStreamIO describing the input/output of the video stream. |
MSFilter * video_stream_stop_keep_source | ( | VideoStream * | stream | ) |
Stop the video stream, but does not destroy the source of the video. This function can be use in conjunction with video_stream_change_source_filter() to allow manual management of the source filters for a video stream.
stream | the stream to stop |
void video_stream_use_video_preset | ( | VideoStream * | stream, |
const char * | preset | ||
) |
Set a video preset to be used for the video stream.
[in] | stream | VideoStream object |
[in] | preset | The name of the video preset to be used. |