Commit c6d32327 authored by Pierre Ynard's avatar Pierre Ynard

Merge VoD module into RTP stream output module

Cleaner and better working solution for VoD than the bad hack that we
currently have. Instead of (badly) duplicating large portions of codes,
it reuses the existing RTSP stack and factorizes the RTP payload code,
and provides support for a number of ES not limited to one audio and one
video tracks, as well as for missing features in RTSP headers.

The VoD module is responsible for starting and running the RTSP stack.
When a VoD media instance is started, the VLM passes down media and
session parameters as variables to the RTP stream output object, that
uses them to hook back into the VoD code (and through it, into the RTSP
stack), to retrieve accurate, already set up parameters, and provide
playback data.
parent ef7a981f
......@@ -34,7 +34,7 @@ libvlc_LTLIBRARIES += \
libvlc_LTLIBRARIES += \
libstream_out_rtp_plugin.la
libstream_out_rtp_plugin_la_SOURCES = \
rtp.c rtp.h rtpfmt.c rtcp.c rtsp.c
rtp.c rtp.h rtpfmt.c rtcp.c rtsp.c vod.c
libstream_out_rtp_plugin_la_CFLAGS = $(AM_CFLAGS)
libstream_out_rtp_plugin_la_LIBADD = $(AM_LIBADD)
libstream_out_rtp_plugin_la_DEPENDENCIES =
......
This diff is collapsed.
......@@ -25,24 +25,33 @@
typedef struct rtsp_stream_t rtsp_stream_t;
typedef struct rtsp_stream_id_t rtsp_stream_id_t;
rtsp_stream_t *RtspSetup( sout_stream_t *p_stream, const vlc_url_t *url );
rtsp_stream_t *RtspSetup( vlc_object_t *owner, vod_media_t *media,
const vlc_url_t *url );
void RtspUnsetup( rtsp_stream_t *rtsp );
rtsp_stream_id_t *RtspAddId( rtsp_stream_t *rtsp, sout_stream_id_t *sid,
uint32_t ssrc,
uint32_t ssrc, unsigned clock_rate,
const char *dst, int ttl,
unsigned loport, unsigned hiport );
void RtspDelId( rtsp_stream_t *rtsp, rtsp_stream_id_t * );
char *RtspAppendTrackPath( rtsp_stream_id_t *id, const char *base );
int RtspTrackAttach( rtsp_stream_t *rtsp, const char *name,
rtsp_stream_id_t *id, sout_stream_id_t *sout_id,
uint32_t *ssrc, uint16_t *seq_init );
void RtspTrackDetach( rtsp_stream_t *rtsp, const char *name,
sout_stream_id_t *sout_id);
char *SDPGenerate( sout_stream_t *p_stream, const char *rtsp_url );
char *SDPGenerateVoD( const vod_media_t *p_media, const char *rtsp_url );
uint32_t rtp_compute_ts( const sout_stream_id_t *id, int64_t i_pts );
uint32_t rtp_compute_ts( unsigned i_clock_rate, int64_t i_pts );
int rtp_add_sink( sout_stream_id_t *id, int fd, bool rtcp_mux, uint16_t *seq );
void rtp_del_sink( sout_stream_id_t *id, int fd );
uint16_t rtp_get_seq( sout_stream_id_t *id );
int64_t rtp_get_ts( const sout_stream_t *p_stream );
int64_t rtp_get_ts( const sout_stream_t *p_stream, const sout_stream_id_t *id,
const vod_media_t *p_media, const char *psz_vod_session );
/* RTP packetization */
void rtp_packetize_common (sout_stream_id_t *id, block_t *out,
......@@ -50,26 +59,46 @@ void rtp_packetize_common (sout_stream_id_t *id, block_t *out,
void rtp_packetize_send (sout_stream_id_t *id, block_t *out);
size_t rtp_mtu (const sout_stream_id_t *id);
int rtp_packetize_mpa (sout_stream_id_t *, block_t *);
int rtp_packetize_mpv (sout_stream_id_t *, block_t *);
int rtp_packetize_ac3 (sout_stream_id_t *, block_t *);
int rtp_packetize_split(sout_stream_id_t *, block_t *);
int rtp_packetize_swab (sout_stream_id_t *, block_t *);
int rtp_packetize_mp4a (sout_stream_id_t *, block_t *);
int rtp_packetize_mp4a_latm (sout_stream_id_t *, block_t *);
int rtp_packetize_h263 (sout_stream_id_t *, block_t *);
int rtp_packetize_h264 (sout_stream_id_t *, block_t *);
int rtp_packetize_amr (sout_stream_id_t *, block_t *);
int rtp_packetize_spx (sout_stream_id_t *, block_t *);
int rtp_packetize_t140 (sout_stream_id_t *, block_t *);
int rtp_packetize_g726_16 (sout_stream_id_t *, block_t *);
int rtp_packetize_g726_24 (sout_stream_id_t *, block_t *);
int rtp_packetize_g726_32 (sout_stream_id_t *, block_t *);
int rtp_packetize_g726_40 (sout_stream_id_t *, block_t *);
/* RTCP */
typedef struct rtcp_sender_t rtcp_sender_t;
rtcp_sender_t *OpenRTCP (vlc_object_t *obj, int rtp_fd, int proto,
bool mux);
void CloseRTCP (rtcp_sender_t *rtcp);
void SendRTCP (rtcp_sender_t *restrict rtcp, const block_t *rtp);
typedef int (*pf_rtp_packetizer_t)( sout_stream_id_t *, block_t * );
typedef struct rtp_format_t
{
/* Used for SDP and packetization */
uint8_t payload_type;
unsigned clock_rate;
unsigned channels;
int cat;
/* Used in SDP only */
unsigned bitrate;
const char *ptname;
char *fmtp;
/* Used for packetization only */
pf_rtp_packetizer_t pf_packetize;
} rtp_format_t;
int rtp_get_fmt( vlc_object_t *obj, es_format_t *p_fmt, const char *mux,
rtp_format_t *p_rtp_fmt );
/* VoD */
int OpenVoD ( vlc_object_t * );
void CloseVoD( vlc_object_t * );
void vod_start(vod_media_t *p_media, const char *psz_session);
void vod_toggle_pause(vod_media_t *p_media, const char *psz_session);
void vod_stop(vod_media_t *p_media, const char *psz_session);
void vod_seek(vod_media_t *p_media, const char *psz_session, float time);
const char *vod_get_mux(const vod_media_t *p_media);
int vod_init_id(vod_media_t *p_media, const char *psz_session, int es_id,
sout_stream_id_t *sout_id, rtp_format_t *rtp_fmt,
uint32_t *ssrc, uint16_t *seq_init);
void vod_detach_id(vod_media_t *p_media, const char *psz_session,
sout_stream_id_t *sout_id);
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -981,6 +981,12 @@ static int vlm_ControlMediaInstanceStart( vlm_t *p_vlm, int64_t id, const char *
if( p_instance->p_input )
{
var_AddCallback( p_instance->p_input, "intf-event", InputEvent, p_media );
var_Create( p_instance->p_input, "vod-media", VLC_VAR_ADDRESS );
var_SetAddress( p_instance->p_input, "vod-media",
p_media->vod.p_media );
var_Create( p_instance->p_input, "vod-session", VLC_VAR_STRING );
var_SetString( p_instance->p_input, "vod-session", psz_id );
if( input_Start( p_instance->p_input ) != VLC_SUCCESS )
{
var_DelCallback( p_instance->p_input, "intf-event", InputEvent, p_media );
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment