Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • videolan/vlc
  • chouquette/vlc
  • bakiewicz.marek122/vlc
  • devnexen/vlc
  • rohanrajpal/vlc
  • blurrrb/vlc
  • gsoc/gsoc2019/darkapex/vlc
  • b1ue/vlc
  • fkuehne/vlc
  • magsoft/vlc
  • chub/vlc
  • cramiro9/vlc
  • robUx4/vlc
  • rom1v/vlc
  • akshayaky/vlc
  • tmk907/vlc
  • akymaster/vlc
  • govind.sharma/vlc
  • psilokos/vlc
  • xjbeta/vlc
  • jahan/vlc
  • 1480c1/vlc
  • amanchande/vlc
  • aaqib/vlc
  • rist/vlc
  • apol/vlc
  • mindfreeze/vlc
  • alexandre-janniaux/vlc
  • sandsmark/vlc
  • jagannatharjun/vlc
  • gsoc/gsoc2020/matiaslgonzalez/vlc
  • gsoc/gsoc2020/jagannatharjun/vlc
  • mstorsjo/vlc
  • gsoc/gsoc2020/vedenta/vlc
  • gsoc/gsoc2020/arnav-ishaan/vlc
  • gsoc/gsoc2020/andreduong/vlc
  • fuzun/vlc
  • gsoc/gsoc2020/vatsin/vlc
  • gsoc/gsoc2020/sagid/vlc
  • yaron/vlc
  • Phoenix/vlc
  • Garf/vlc
  • ePiratWorkarounds/vlc
  • tguillem/vlc
  • jnqnfe/vlc
  • mdc/vlc
  • Vedaa/vlc
  • rasa/vlc
  • quink/vlc
  • yealo/vlc
  • aleksey_ak/vlc
  • ePirat/vlc
  • ilya.yanok/vlc
  • asenat/vlc
  • m/vlc
  • bunjee/vlc
  • BLumia/vlc
  • sagudev/vlc
  • hamedmonji30/vlc
  • nullgemm/vlc
  • DivyamAhuja/vlc
  • thesamesam/vlc
  • dag7/vlc
  • snehil101/vlc
  • haasn/vlc
  • jbk/vlc
  • ValZapod/vlc
  • mfkl/vlc
  • WangChuan/vlc
  • core1024/vlc
  • GhostVaibhav/vlc
  • dfuhrmann/vlc
  • davide.prade/vlc
  • tmatth/vlc
  • Courmisch/vlc
  • zouya/vlc
  • hpi/vlc
  • EwoutH/vlc
  • aleung27/vlc
  • hengwu0/vlc
  • saladin/vlc
  • ashuio/vlc
  • richselwood/vlc
  • verma16Ayush/vlc
  • chemicalflash/vlc
  • PoignardAzur/vlc
  • huangjieNT/vlc
  • Blake-Haydon/vlc
  • AnuthaDev/vlc
  • gsoc/gsoc2021/mpd/vlc
  • nicolas_lequec/vlc
  • sambassaly/vlc
  • thresh/vlc
  • bonniegong/vlc
  • myaashish/vlc
  • stavros.vagionitis/vlc
  • ileoo/vlc
  • louis-santucci/vlc
  • cchristiansen/vlc
  • sabyasachi07/vlc
  • AbduAmeen/vlc
  • ashishb0410/vlc
  • urbanhusky/vlc
  • davidepietrasanta/vlc
  • riksleutelstad/vlc
  • jeremyVignelles/vlc
  • komh/vlc
  • iamjithinjohn/vlc
  • JohannesKauffmann/vlc2
  • kunglao/vlc
  • natzberg/vlc
  • jill/vlc
  • cwendling/vlc
  • adufou/vlc
  • ErwanAirone/vlc
  • HasinduDilshan10/vlc
  • vagrantc/vlc
  • rafiv/macos-bigsur-icon
  • Aymeriic/vlc
  • saranshg20/vlc
  • metzlove24/vlc
  • linkfanel/vlc
  • Ds886/vlc
  • metehan-arslan/vlc
  • Skantes/vlc
  • kgsandundananjaya96/vlc
  • mitchcapper/vlc
  • advaitgupta/vlc
  • StefanBruens/vlc
  • ratajs/vlc
  • T.M.F.B.3761/vlc
  • m222059/vlc
  • casemerrick/vlc
  • joshuaword2alt/vlc
  • sjwaddy/vlc
  • dima/vlc
  • Ybalrid/vlc
  • umxprime/vlc
  • eschmidt/vlc
  • vannieuwenhuysenmichelle/vlc
  • badcf00d/vlc
  • wesinator/vlc
  • louis/vlc
  • xqq/vlc
  • EmperorYP7/vlc
  • NicoLiam/vlc
  • loveleen/vlc
  • rofferom/vlc
  • rbultje/vlc
  • TheUnamed/vlc
  • pratiksharma341/vlc
  • Saurab17/vlc
  • purist.coder/vlc
  • Shuicheng/vlc
  • mdrrubel292/vlc
  • silverbleu00/vlc
  • metif12/vlc
  • asher-m/vlc
  • jeffk/vlc
  • Brandonbr1/vlc
  • beautyyuyanli/vlc
  • rego21/vlc
  • muyangren907/vlc
  • collectionbylawrencejason/vlc
  • evelez/vlc
  • GSMgeeth/vlc
  • Oneric/vlc
  • TJ5/vlc
  • XuanTung95/vlc
  • darrenjenny21/vlc
  • Trenly/vlc
  • RockyTDR/vlc
  • mjakubowski/vlc
  • caprica/vlc
  • ForteFrankie/vlc
  • seannamiller19/vlc
  • junlon2006/vlc
  • kiwiren6666/vlc
  • iuseiphonexs/vlc
  • fenngtun/vlc
  • Rajdutt999/vlc
  • typx/vlc
  • leon.vitanos/vlc
  • robertogarci0938/vlc
  • gsoc/gsoc2022/luc65r/vlc-mpd
  • skeller/vlc
  • MCJack123/vlc
  • luc65r/vlc-mpd
  • popov895/vlc
  • claucambra/vlc
  • brad/vlc
  • matthewmurua88/vlc
  • Tomas8874/vlc
  • philenotfound/vlc
  • makita-do3/vlc
  • LZXCorp/vlc
  • mar0x/vlc
  • senojetkennedy0102/vlc
  • shaneb243/vlc
  • ahmadbader/vlc
  • rajduttcse26/vlc-audio-filters
  • Juniorzito8415/vlc
  • achernyakov/vlc
  • lucasjetgroup/vlc
  • pupdoggy666/vlc
  • gmde9363/vlc
  • alexnwayne/vlc
  • bahareebrahimi781/vlc
  • hamad633666/vlc
  • umghof3112/vlc
  • joe0199771874/vlc
  • Octocats66666666/vlc
  • jjm_223/vlc
  • btech10110.19/vlc
  • sunnykfc028/vlc-audio-filters
  • loic/vlc
  • nguyenminhducmx1/vlc
  • JanekKrueger/vlc
  • bstubbington2/vlc
  • rcombs/vlc
  • Ordissimo/vlc
  • king7532/vlc
  • noobsauce101/vlc
  • schong0525/vlc
  • myQwil/vlc
  • apisbg91/vlc
  • geeboy0101017/vlc
  • kim.faughey/vlc
  • nurupo/vlc
  • yyusea/vlc
  • 0711235879.khco/vlc
  • ialo/vlc
  • iloveyeye2/vlc
  • gdtdftdqtd/vlc
  • leandroconsiglio/vlc
  • AndyHTML2012/vlc
  • ncz/vlc
  • lucenticus/vlc
  • knr1931/vlc
  • kjoonlee/vlc
  • chandrakant100/vlc-qt
  • johge42/vlc
  • polter/vlc
  • hexchain/vlc
  • Tushwrld/vlc
  • mztea928/vlc
  • jbelloncastro/vlc
  • alvinhochun/vlc
  • ghostpiratecrow/vlc
  • ujjwaltwitx/vlc
  • alexsonarin06/vlc
  • adrianbon76/vlc
  • altsod/vlc
  • damien.lucas44/vlc
  • dmytrivtaisa/vlc
  • utk202/vlc
  • aaxhrj/vlc
  • thomas.hermes/vlc
  • structurenewworldorder/vlc
  • slomo/vlc
  • wantlamy/vlc
  • musc.o3cminc/vlc
  • thebarshablog/vlc
  • kerrick/vlc
  • kratos142518/vlc
  • leogps/vlc
  • vacantron/vlc
  • luna_koly/vlc
  • Ratio2/vlc
  • anuoshemohammad/vlc
  • apsun/vlc
  • aaa1115910/vlc
  • alimotmoyo/vlc
  • Ambossmann/vlc
  • Sam-LearnsToCode/vlc
  • Chilledheart/vlc
  • Labnann/vlc
  • ktcoooot1/vlc
  • mohit-marathe/vlc
  • johnddx/vlc
  • manstabuk/vlc
  • Omar-ahmed314/vlc
  • vineethkm/vlc
  • 9Enemi86/vlc
  • radoslav.m.panteleev/vlc
  • ashishami2002/vlc
  • Corbax/vlc
  • firnasahmed/vlc
  • pelayarmalam4/vlc
  • c0ff330k/vlc
  • shikhindahikar/vlc
  • l342723951/vlc
  • christianschwandner/vlc
  • douniwan5788/vlc
  • 7damian7/vlc
  • ferdnyc/vlc
  • f.ales1/vlc
  • pandagby/vlc
  • BaaBaa/vlc
  • jewe37/vlc
  • w00drow/vlc
  • russelltg/vlc
  • ironicallygod/vlc
  • soumyaDghosh/vlc
  • linzihao1999/vlc
  • deyayush6/vlc
  • mibi88/vlc
  • newabdallah10/vlc
  • jhorbincolombia/vlc
  • rimvihaqueshupto/vlc
  • andrewkhon98/vlc
  • fab78/vlc
  • lapaz17/vlc
  • amanna13/vlc
  • mdakram28/vlc
  • 07jw1980/vlc
  • sohamgupta/vlc
  • Eson-Jia1/vlc
  • Sumou/vlc
  • vikram-kangotra/vlc
  • chalice191/vlc
  • olivercalder/vlc
  • aaasg4001/vlc
  • zipdox/vlc
  • kwizart/vlc
  • Dragon-S/vlc
  • jdemeule/vlc
  • gabriel_lt/vlc
  • locutusofborg/vlc
  • sammirata/vlc-librist
  • another/vlc
  • Benjamin_Loison/vlc
  • ahmedmoselhi/vlc
  • petergaal/vlc
  • huynhsontung/vlc
  • dariusmihut/vlc
  • tvermaashutosh/vlc
  • buti/vlc
  • Niram7777/vlc
  • rohan-here/vlc
  • balaji-sivasakthi/vlc
  • rlindner81/vlc
  • Kakadus/vlc
  • djain/vlc
  • ABBurmeister/vlc
  • craighuggins/vlc
  • orbea/vlc
  • maxos/vlc
  • aakarshmj/vlc
  • kblaschke/vlc
  • ankitm/vlc
  • advait-0/vlc
  • mohak2003/vlc
  • yselkowitz/vlc
  • AZM999/vlc-azm
  • andrey.turkin/vlc
  • Disha-Baghel/vlc
  • nowrep/vlc
  • Apeng/vlc
  • Choucroute_melba/vlc
  • autra/vlc
  • eclipseo/vlc
  • fhuber/vlc
  • olafhering/vlc
  • sdasda7777/vlc
  • 1div0/vlc
  • skosnits/vlc-extended-playlist-support
  • dnicolson/vlc
  • Timshel/vlc
  • octopols/vlc
  • MangalK/vlc
  • nima64/vlc
  • misawai/vlc
  • Alexander-Wilms/vlc
  • Maxime2/vlc-fork-for-visualizer
  • ww/vlc
  • jeske/vlc
  • sgross-emlix/vlc
  • morenonatural/vlc
  • freakingLovesVLC/vlc
  • borisgolovnev/vlc
  • mpromonet/vlc
  • diogo.simao-marques/vlc
  • masstock/vlc
  • pratikpatel8982/vlc
  • hugok79/vlc
  • longervision/vlc
  • abhiudaysurya/vlc
  • rishabhgarg/vlc
  • tumic/vlc
  • cart/vlc
  • shubham442/vlc
  • Aditya692005/vlc
  • sammirata/vlc4
  • syrykh/vlc
  • Vvorcun/macos-new-icon
  • AyaanshC/vlc
  • nasso/vlc
  • Quark/vlc
  • sebastinas/vlc
  • rhstone/vlc
  • talregev/vlc
  • Managor/vlc
403 results
Show changes
Commits on Source (9)
......@@ -57,6 +57,95 @@
# define IPPROTO_UDPLITE 136 /* from IANA */
#endif
struct vlc_rtp_es_id {
struct vlc_rtp_es es;
es_out_t *out;
es_out_id_t *id;
};
static void vlc_rtp_es_id_destroy(struct vlc_rtp_es *es)
{
struct vlc_rtp_es_id *ei = container_of(es, struct vlc_rtp_es_id, es);
es_out_Del(ei->out, ei->id);
free(ei);
}
static void vlc_rtp_es_id_send(struct vlc_rtp_es *es, block_t *block)
{
struct vlc_rtp_es_id *ei = container_of(es, struct vlc_rtp_es_id, es);
/* TODO: Don't set PCR here. Breaks multiple sources (in a session)
* and more importantly eventually multiple sessions. */
es_out_SetPCR(ei->out, block->i_pts);
es_out_Send(ei->out, ei->id, block);
}
static const struct vlc_rtp_es_operations vlc_rtp_es_id_ops = {
vlc_rtp_es_id_destroy, vlc_rtp_es_id_send,
};
struct vlc_rtp_es *vlc_rtp_es_request(void *data,
const es_format_t *restrict fmt)
{
demux_t *demux = data;
struct vlc_rtp_es_id *ei = malloc(sizeof (*ei));
if (unlikely(ei == NULL))
return vlc_rtp_es_dummy;
ei->es.ops = &vlc_rtp_es_id_ops;
ei->out = demux->out;
ei->id = es_out_Add(demux->out, fmt);
if (ei->id == NULL) {
free(ei);
return NULL;
}
return &ei->es;
}
struct vlc_rtp_es_mux {
struct vlc_rtp_es es;
vlc_demux_chained_t *chained_demux;
};
static void vlc_rtp_es_mux_destroy(struct vlc_rtp_es *es)
{
struct vlc_rtp_es_mux *em = container_of(es, struct vlc_rtp_es_mux, es);
vlc_demux_chained_Delete(em->chained_demux);
free(em);
}
static void vlc_rtp_es_mux_send(struct vlc_rtp_es *es, block_t *block)
{
struct vlc_rtp_es_mux *em = container_of(es, struct vlc_rtp_es_mux, es);
vlc_demux_chained_Send(em->chained_demux, block);
}
static const struct vlc_rtp_es_operations vlc_rtp_es_mux_ops = {
vlc_rtp_es_mux_destroy, vlc_rtp_es_mux_send,
};
struct vlc_rtp_es *vlc_rtp_mux_request(void *data, const char *name)
{
demux_t *demux = data;
struct vlc_rtp_es_mux *em = malloc(sizeof (*em));
if (unlikely(em == NULL))
return vlc_rtp_es_dummy;
em->es.ops = &vlc_rtp_es_mux_ops;
em->chained_demux = vlc_demux_chained_New(VLC_OBJECT(demux), name,
demux->out);
if (em->chained_demux == NULL) {
free(em);
return NULL;
}
return &em->es;
}
/**
* Extracts port number from "[host]:port" or "host:port" strings,
* and remove brackets from the host name.
......
......@@ -20,34 +20,104 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
****************************************************************************/
/**
* \defgroup rtp RTP
* Real-time Transport Protocol
* \ingroup net
*
* @{
* \file
*/
typedef struct vlc_rtp_pt rtp_pt_t;
typedef struct rtp_session_t rtp_session_t;
struct vlc_demux_chained_t;
struct vlc_sdp_media;
/** @section RTP payload format */
/**
* \defgroup rtp_pt RTP payload format
* @{
*/
/**
* Payload type mapping.
*
* This structure represents a mapping for an RTP payload format
* extracted from an \ref sdp description.
*/
struct vlc_sdp_pt {
const struct vlc_sdp_media *media;
char name[16];
unsigned int clock_rate;
unsigned char channel_count;
const char *parameters;
const struct vlc_sdp_media *media; /**< Containant SDP media description */
char name[16]; /**< RTP payload format name, i.e. MIME subtype */
unsigned int clock_rate; /**< RTP clock rate (in Hertz) */
unsigned char channel_count; /**< Number of channels (0 if unspecified) */
const char *parameters; /**< Format parameters from the a=fmtp line */
};
/**
* RTP payload format operations.
*
* This structures contains the callbacks provided by an RTP payload format.
*/
struct vlc_rtp_pt_operations {
void *(*init)(struct vlc_rtp_pt *, demux_t *);
void (*destroy)(demux_t *, void *);
void (*decode)(demux_t *, void *, block_t *);
/**
* Releases the payload format.
*
* This optional callback releases any resources associated with the
* payload format, such as copies of the payload format parameters.
*
* \param pt RTP payload format that is being released
*/
void (*release)(struct vlc_rtp_pt *pt);
/**
* Starts using a payload format.
*
* This required callback initialises per-source resources for the payload
* format, such as an elementary stream output.
*
* \note There may be multiple RTP sources using the same payload format
* concurrently within single given RTP session. This callback is invoked
* for each source.
*
* \param pt RTP payload format being taken into use
* \return a data pointer for decode() and destroy() callbacks
*/
void *(*init)(struct vlc_rtp_pt *pt, demux_t *);
/**
* Stops using a payload format.
*
* This optional callback deinitialises per-source resources.
*
* \param pt RTP payload format to relinquish
* \param data data pointer returned by init()
*/
void (*destroy)(struct vlc_rtp_pt *pt, void *data);
/**
* Processes a data payload.
*
* \param pt RTP payload format of the payload
* \param data data pointer returned by init()
* \param block payload of a received RTP packet
*/
void (*decode)(struct vlc_rtp_pt *pt, void *data, block_t *block);
};
/**
* RTP payload format.
*
* This structures represents a payload format within an RTP session
* (\ref vlc_rtp_session_t).
*/
struct vlc_rtp_pt
{
const struct vlc_rtp_pt_operations *ops;
uint32_t frequency; /* RTP clock rate (Hz) */
uint8_t number;
uint8_t channel_count;
const struct vlc_rtp_pt_operations *ops; /**< Payload format callbacks */
void *opaque; /**< Private data pointer */
uint32_t frequency; /**< RTP clock rate (Hz) */
uint8_t number; /**< RTP payload type number within the session (0-127) */
uint8_t channel_count; /**< Channel count (zero if unspecified) */
};
/**
......@@ -79,14 +149,12 @@ static inline void *vlc_rtp_pt_begin(struct vlc_rtp_pt *pt, demux_t *demux)
* This destroys an instance of a payload type created by vlc_rtp_pt_begin().
*
* @param pt RTP payload type to deinstantiate
* @param demux demux object that was used by the instance
* @param data instance private data as returned by vlc_rtp_pt_begin()
*/
static inline void vlc_rtp_pt_end(struct vlc_rtp_pt *pt, demux_t *demux,
void *data)
static inline void vlc_rtp_pt_end(struct vlc_rtp_pt *pt, void *data)
{
if (pt->ops->destroy != NULL)
pt->ops->destroy(demux, data);
pt->ops->destroy(pt, data);
}
/**
......@@ -95,14 +163,65 @@ static inline void vlc_rtp_pt_end(struct vlc_rtp_pt *pt, demux_t *demux,
* This passes a data payload of an RTP packet to the instance of the
* payload type specified in the packet (PT and SSRC fields).
*/
static inline void vlc_rtp_pt_decode(const struct vlc_rtp_pt *pt,
demux_t *demux,
static inline void vlc_rtp_pt_decode(struct vlc_rtp_pt *pt,
void *data, block_t *pkt)
{
assert(pt->ops->decode != NULL);
pt->ops->decode(demux, data, pkt);
pt->ops->decode(pt, data, pkt);
}
struct vlc_rtp_es;
/**
* RTP elementary output stream operations.
*/
struct vlc_rtp_es_operations {
void (*destroy)(struct vlc_rtp_es *es);
void (*send)(struct vlc_rtp_es *es, block_t *block);
};
/**
* RTP elementary output stream.
*
* This structure represents a data sink for an active instance of a payload
* format, typically an output elementary stream (ES) \ref es_out_id_t.
*/
struct vlc_rtp_es {
const struct vlc_rtp_es_operations *ops;
};
/**
* Destroys an \ref vlc_rtp_es.
*
* \param es object to release
*/
static inline void vlc_rtp_es_destroy(struct vlc_rtp_es *es)
{
assert(es->ops->destroy != NULL);
es->ops->destroy(es);
}
/**
* Sends coded data for output.
*
* \param es output stream to send the data to
* \param block data block to process
*/
static inline void vlc_rtp_es_send(struct vlc_rtp_es *es, block_t *block)
{
assert(es->ops->send != NULL);
es->ops->send(es, block);
}
/**
* A dummy output that discards data.
*/
extern struct vlc_rtp_es *const vlc_rtp_es_dummy;
struct vlc_rtp_es *vlc_rtp_es_request(void *, const es_format_t *fmt);
struct vlc_rtp_es *vlc_rtp_mux_request(void *, const char *name);
void rtp_autodetect(vlc_object_t *, rtp_session_t *, const block_t *);
static inline uint8_t rtp_ptype (const block_t *block)
......@@ -110,13 +229,14 @@ static inline uint8_t rtp_ptype (const block_t *block)
return block->p_buffer[1] & 0x7F;
}
void *codec_init (demux_t *demux, es_format_t *fmt);
void codec_destroy (demux_t *demux, void *data);
void codec_decode (demux_t *demux, void *data, block_t *block);
extern const struct vlc_rtp_pt_operations rtp_video_theora;
/** @section RTP session */
/** @} */
/**
* \defgroup rtp_session RTP session
* @{
*/
rtp_session_t *rtp_session_create (demux_t *);
void rtp_session_destroy (demux_t *, rtp_session_t *);
void rtp_queue (demux_t *, rtp_session_t *, block_t *);
......@@ -127,6 +247,9 @@ int vlc_rtp_add_media_types(vlc_object_t *obj, rtp_session_t *ses,
void *rtp_dgram_thread (void *data);
/** @} */
/** @} */
/* Global data */
typedef struct
{
......
......@@ -39,62 +39,18 @@
* Generic packet handlers
*/
void *codec_init (demux_t *demux, es_format_t *fmt)
static void codec_destroy(struct vlc_rtp_pt *pt, void *data)
{
if (fmt->i_cat == AUDIO_ES)
aout_FormatPrepare (&fmt->audio);
return es_out_Add (demux->out, fmt);
}
void codec_destroy (demux_t *demux, void *data)
{
if (data)
es_out_Del (demux->out, (es_out_id_t *)data);
}
/* Send a packet to decoder */
void codec_decode (demux_t *demux, void *data, block_t *block)
{
if (data)
{
block->i_dts = VLC_TICK_INVALID; /* RTP does not specify this */
es_out_SetPCR(demux->out, block->i_pts);
es_out_Send (demux->out, (es_out_id_t *)data, block);
}
else
block_Release (block);
}
static void *stream_init (demux_t *demux, const char *name)
{
demux_sys_t *p_sys = demux->p_sys;
if (p_sys->chained_demux != NULL)
return NULL;
p_sys->chained_demux = vlc_demux_chained_New(VLC_OBJECT(demux), name,
demux->out);
return p_sys->chained_demux;
}
static void stream_destroy (demux_t *demux, void *data)
{
demux_sys_t *p_sys = demux->p_sys;
if (data)
{
vlc_demux_chained_Delete(data);
p_sys->chained_demux = NULL;
}
(void) pt;
vlc_rtp_es_destroy(data);
}
/* Send a packet to a chained demuxer */
static void stream_decode (demux_t *demux, void *data, block_t *block)
/* Send a packet to ES */
static void codec_decode(struct vlc_rtp_pt *pt, void *data, block_t *block)
{
if (data)
vlc_demux_chained_Send(data, block);
else
block_Release (block);
(void)demux;
(void) pt;
block->i_dts = VLC_TICK_INVALID;
vlc_rtp_es_send(data, block);
}
/*
......@@ -110,12 +66,12 @@ static void *pcmu_init(struct vlc_rtp_pt *pt, demux_t *demux)
es_format_Init (&fmt, AUDIO_ES, VLC_CODEC_MULAW);
fmt.audio.i_rate = pt->frequency;
fmt.audio.i_physical_channels = AOUT_CHAN_CENTER;
return codec_init (demux, &fmt);
fmt.audio.i_channels = pt->channel_count ? pt->channel_count : 1;
return vlc_rtp_es_request(demux, &fmt);
}
static const struct vlc_rtp_pt_operations rtp_audio_pcmu = {
pcmu_init, codec_destroy, codec_decode,
NULL, pcmu_init, codec_destroy, codec_decode,
};
/* PT=3
......@@ -129,11 +85,11 @@ static void *gsm_init(struct vlc_rtp_pt *pt, demux_t *demux)
fmt.audio.i_rate = 8000;
fmt.audio.i_physical_channels = AOUT_CHAN_CENTER;
(void) pt;
return codec_init (demux, &fmt);
return vlc_rtp_es_request(demux, &fmt);
}
static const struct vlc_rtp_pt_operations rtp_audio_gsm = {
gsm_init, codec_destroy, codec_decode,
NULL, gsm_init, codec_destroy, codec_decode,
};
/* PT=8
......@@ -145,12 +101,12 @@ static void *pcma_init(struct vlc_rtp_pt *pt, demux_t *demux)
es_format_Init (&fmt, AUDIO_ES, VLC_CODEC_ALAW);
fmt.audio.i_rate = pt->frequency;
fmt.audio.i_physical_channels = AOUT_CHAN_CENTER;
return codec_init (demux, &fmt);
fmt.audio.i_channels = pt->channel_count ? pt->channel_count : 1;
return vlc_rtp_es_request(demux, &fmt);
}
static const struct vlc_rtp_pt_operations rtp_audio_pcma = {
pcma_init, codec_destroy, codec_decode,
NULL, pcma_init, codec_destroy, codec_decode,
};
/* PT=10,11
......@@ -163,11 +119,11 @@ static void *l16_init(struct vlc_rtp_pt *pt, demux_t *demux)
es_format_Init (&fmt, AUDIO_ES, VLC_CODEC_S16B);
fmt.audio.i_rate = pt->frequency;
fmt.audio.i_channels = pt->channel_count ? pt->channel_count : 1;
return codec_init (demux, &fmt);
return vlc_rtp_es_request(demux, &fmt);
}
static const struct vlc_rtp_pt_operations rtp_audio_l16 = {
l16_init, codec_destroy, codec_decode,
NULL, l16_init, codec_destroy, codec_decode,
};
/* PT=12
......@@ -181,11 +137,11 @@ static void *qcelp_init(struct vlc_rtp_pt *pt, demux_t *demux)
fmt.audio.i_rate = 8000;
fmt.audio.i_physical_channels = AOUT_CHAN_CENTER;
(void) pt;
return codec_init (demux, &fmt);
return vlc_rtp_es_request(demux, &fmt);
}
static const struct vlc_rtp_pt_operations rtp_audio_qcelp = {
qcelp_init, codec_destroy, codec_decode,
NULL, qcelp_init, codec_destroy, codec_decode,
};
/* PT=14
......@@ -196,13 +152,12 @@ static void *mpa_init(struct vlc_rtp_pt *pt, demux_t *demux)
es_format_t fmt;
es_format_Init (&fmt, AUDIO_ES, VLC_CODEC_MPGA);
fmt.audio.i_physical_channels = AOUT_CHANS_STEREO;
fmt.b_packetized = false;
(void) pt;
return codec_init (demux, &fmt);
return vlc_rtp_es_request(demux, &fmt);
}
static void mpa_decode (demux_t *demux, void *data, block_t *block)
static void mpa_decode(struct vlc_rtp_pt *pt, void *data, block_t *block)
{
if (block->i_buffer < 4)
{
......@@ -212,12 +167,13 @@ static void mpa_decode (demux_t *demux, void *data, block_t *block)
block->i_buffer -= 4; /* 32-bits RTP/MPA header */
block->p_buffer += 4;
codec_decode (demux, data, block);
block->i_dts = VLC_TICK_INVALID;
vlc_rtp_es_send(data, block);
(void) pt;
}
static const struct vlc_rtp_pt_operations rtp_audio_mpa = {
mpa_init, codec_destroy, mpa_decode,
NULL, mpa_init, codec_destroy, mpa_decode,
};
/* PT=32
......@@ -230,10 +186,10 @@ static void *mpv_init(struct vlc_rtp_pt *pt, demux_t *demux)
es_format_Init (&fmt, VIDEO_ES, VLC_CODEC_MPGV);
fmt.b_packetized = false;
(void) pt;
return codec_init (demux, &fmt);
return vlc_rtp_es_request(demux, &fmt);
}
static void mpv_decode (demux_t *demux, void *data, block_t *block)
static void mpv_decode(struct vlc_rtp_pt *pt, void *data, block_t *block)
{
if (block->i_buffer < 4)
{
......@@ -243,6 +199,7 @@ static void mpv_decode (demux_t *demux, void *data, block_t *block)
block->i_buffer -= 4; /* 32-bits RTP/MPV header */
block->p_buffer += 4;
block->i_dts = VLC_TICK_INVALID;
#if 0
if (block->p_buffer[-3] & 0x4)
{
......@@ -250,11 +207,12 @@ static void mpv_decode (demux_t *demux, void *data, block_t *block)
/* TODO: shouldn't we skip this too ? */
}
#endif
codec_decode (demux, data, block);
vlc_rtp_es_send(data, block);
(void) pt;
}
static const struct vlc_rtp_pt_operations rtp_video_mpv = {
mpv_init, codec_destroy, mpv_decode,
NULL, mpv_init, codec_destroy, mpv_decode,
};
/* PT=33
......@@ -263,11 +221,11 @@ static const struct vlc_rtp_pt_operations rtp_video_mpv = {
static void *ts_init(struct vlc_rtp_pt *pt, demux_t *demux)
{
(void) pt;
return stream_init (demux, "ts");
return vlc_rtp_mux_request(demux, "ts");
}
static const struct vlc_rtp_pt_operations rtp_av_ts = {
ts_init, stream_destroy, stream_decode,
NULL, ts_init, codec_destroy, codec_decode,
};
/* Not using SDP, we need to guess the payload format used */
......@@ -352,6 +310,8 @@ static struct vlc_rtp_pt *vlc_rtp_pt_create(vlc_object_t *obj,
void vlc_rtp_pt_release(struct vlc_rtp_pt *pt)
{
if (pt->ops->release != NULL)
pt->ops->release(pt);
free(pt);
}
......@@ -504,3 +464,24 @@ int vlc_rtp_add_media_types(vlc_object_t *obj, rtp_session_t *session,
return errors;
}
static void es_dummy_destroy(struct vlc_rtp_es *es)
{
assert(es == vlc_rtp_es_dummy);
}
static void es_dummy_decode(struct vlc_rtp_es *es, block_t *block)
{
assert(es == vlc_rtp_es_dummy);
block_Release(block);
}
static const struct vlc_rtp_es_operations vlc_rtp_es_dummy_ops = {
es_dummy_destroy, es_dummy_decode,
};
static struct vlc_rtp_es vlc_rtp_es_dummy_instance = {
&vlc_rtp_es_dummy_ops,
};
struct vlc_rtp_es *const vlc_rtp_es_dummy = &vlc_rtp_es_dummy_instance;
......@@ -166,7 +166,8 @@ rtp_source_destroy (demux_t *demux, const rtp_session_t *session,
msg_Dbg (demux, "removing RTP source (%08x)", source->ssrc);
for (unsigned i = 0; i < session->ptc; i++)
vlc_rtp_pt_end(session->ptv[i], demux, source->opaque[i]);
vlc_rtp_pt_end(session->ptv[i], source->opaque[i]);
block_ChainRelease (source->blocks);
free (source);
}
......@@ -183,7 +184,7 @@ static inline uint32_t rtp_timestamp (const block_t *block)
return GetDWBE (block->p_buffer + 4);
}
static const struct vlc_rtp_pt *
static struct vlc_rtp_pt *
rtp_find_ptype (const rtp_session_t *session, rtp_source_t *source,
const block_t *block, void **pt_data)
{
......@@ -306,8 +307,8 @@ rtp_queue (demux_t *demux, rtp_session_t *session, block_t *block)
int16_t s;
} delta_seq = { .u = seq - src->max_seq };
if ((delta_seq.s > 0) ? (delta_seq.u > p_sys->max_dropout)
: (delta_seq.u < p_sys->max_misorder))
if ((delta_seq.s >= 0) ? (delta_seq.u > p_sys->max_dropout)
: (delta_seq.u < p_sys->max_misorder))
{
msg_Dbg (demux, "sequence discontinuity"
" (got: %"PRIu16", expected: %"PRIu16")", seq, src->max_seq);
......@@ -469,7 +470,7 @@ rtp_decode (demux_t *demux, const rtp_session_t *session, rtp_source_t *src)
/* Match the payload type */
void *pt_data;
const rtp_pt_t *pt = rtp_find_ptype (session, src, block, &pt_data);
struct vlc_rtp_pt *pt = rtp_find_ptype (session, src, block, &pt_data);
if (pt == NULL)
{
msg_Dbg (demux, "unknown payload (%"PRIu8")",
......@@ -512,7 +513,7 @@ rtp_decode (demux_t *demux, const rtp_session_t *session, rtp_source_t *src)
block->p_buffer += skip;
block->i_buffer -= skip;
vlc_rtp_pt_decode(pt, demux, pt_data, block);
vlc_rtp_pt_decode(pt, pt_data, block);
return;
drop:
......
......@@ -37,7 +37,7 @@
typedef struct rtp_xiph_t
{
es_out_id_t *id;
struct vlc_rtp_es *id;
block_t *block;
uint32_t ident;
bool vorbis;
......@@ -73,11 +73,11 @@ static void *vorbis_init (demux_t *demux)
*/
static void *theora_init(struct vlc_rtp_pt *pt, demux_t *demux)
{
(void) pt; (void) demux;
pt->opaque = demux;
return xiph_init (false);
}
static void xiph_destroy(demux_t *demux, void *data)
static void xiph_destroy(struct vlc_rtp_pt *pt, void *data)
{
rtp_xiph_t *self = data;
......@@ -86,10 +86,11 @@ static void xiph_destroy(demux_t *demux, void *data)
if (self->block)
{
self->block->i_flags |= BLOCK_FLAG_CORRUPTED;
codec_decode (demux, self->id, self->block);
vlc_rtp_es_send(self->id, self->block);
}
codec_destroy (demux, self->id);
vlc_rtp_es_destroy(self->id);
free (self);
(void) pt;
}
/* Convert configuration from RTP to VLC format */
......@@ -142,9 +143,10 @@ static ssize_t xiph_header (void **pextra, const uint8_t *buf, size_t len)
return extra_size;
}
static void xiph_decode(demux_t *demux, void *data, block_t *block)
static void xiph_decode(struct vlc_rtp_pt *pt, void *data, block_t *block)
{
rtp_xiph_t *self = data;
demux_t *demux = pt->opaque;
if (!data || block->i_buffer < 4)
goto drop;
......@@ -246,7 +248,8 @@ static void xiph_decode(demux_t *demux, void *data, block_t *block)
block_t *raw = block_Alloc (len);
memcpy (raw->p_buffer, block->p_buffer, len);
raw->i_pts = block->i_pts; /* FIXME: what about pkts > 1 */
codec_decode (demux, self->id, raw);
block->i_dts = VLC_TICK_INVALID;
vlc_rtp_es_send(self->id, raw);
break;
}
......@@ -266,13 +269,13 @@ static void xiph_decode(demux_t *demux, void *data, block_t *block)
: VLC_CODEC_THEORA);
fmt.p_extra = extv;
fmt.i_extra = extc;
codec_destroy (demux, self->id);
vlc_rtp_es_destroy(self->id);
msg_Dbg (demux, self->vorbis ?
"Vorbis packed configuration received (%06"PRIx32")" :
"Theora packed configuration received (%06"PRIx32")",
ident);
self->ident = ident;
self->id = codec_init (demux, &fmt);
self->id = vlc_rtp_es_request(demux, &fmt);
break;
}
}
......@@ -287,5 +290,5 @@ drop:
}
const struct vlc_rtp_pt_operations rtp_video_theora = {
theora_init, xiph_destroy, xiph_decode,
NULL, theora_init, xiph_destroy, xiph_decode,
};