Changeset 68cdf347da595e7a6975a21cf61b24bffa1bdbea
- Timestamp:
- 09/01/07 16:11:39
(1 year ago)
- Author:
- Rémi Denis-Courmont <rem@videolan.org>
- git-committer:
- Rémi Denis-Courmont <rem@videolan.org> 1188655899 +0000
- git-parent:
[be9cd599a925a002e5e7f57721385178be2d6ec9]
- git-author:
- Rémi Denis-Courmont <rem@videolan.org> 1188655899 +0000
- Message:
DSO friendliness
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
| r9160f1e |
r68cdf34 |
|
| 135 | 135 | set_capability( "sout access", 100 ); |
|---|
| 136 | 136 | add_shortcut( "udp" ); |
|---|
| 137 | | add_shortcut( "rtp" ); // Will work only with ts muxer |
|---|
| 138 | 137 | set_callbacks( Open, Close ); |
|---|
| 139 | 138 | vlc_module_end(); |
|---|
| … | … | |
| 204 | 203 | { |
|---|
| 205 | 204 | int i_mtu; |
|---|
| 206 | | |
|---|
| 207 | | vlc_bool_t b_rtpts; // true for RTP/MP2 encapsulation |
|---|
| 208 | 205 | vlc_bool_t b_mtu_warning; |
|---|
| 209 | | uint16_t i_sequence_number; |
|---|
| 210 | | uint32_t i_ssrc; |
|---|
| 211 | 206 | |
|---|
| 212 | 207 | block_t *p_buffer; |
|---|
| … | … | |
| 257 | 252 | } |
|---|
| 258 | 253 | p_access->p_sys = p_sys; |
|---|
| 259 | | |
|---|
| 260 | | if( p_access->psz_access != NULL ) |
|---|
| 261 | | { |
|---|
| 262 | | if (strcmp (p_access->psz_access, "rtp") == 0) |
|---|
| 263 | | p_sys->b_rtpts = VLC_TRUE; |
|---|
| 264 | | } |
|---|
| 265 | 254 | |
|---|
| 266 | 255 | if (var_GetBool (p_access, SOUT_CFG_PREFIX"lite")) |
|---|
| … | … | |
| 382 | 371 | |
|---|
| 383 | 372 | p_sys->i_mtu = var_CreateGetInteger( p_this, "mtu" ); |
|---|
| 384 | | if( p_sys->b_rtpts && ( p_sys->i_mtu < RTP_HEADER_LENGTH ) ) |
|---|
| 385 | | p_sys->i_mtu = 576 - 20 - 8; |
|---|
| 386 | | |
|---|
| 387 | | srand( (uint32_t)mdate()); |
|---|
| 388 | | p_sys->p_buffer = NULL; |
|---|
| 389 | | p_sys->i_sequence_number = rand()&0xffff; |
|---|
| 390 | | p_sys->i_ssrc = rand()&0xffffffff; |
|---|
| | 373 | p_sys->p_buffer = NULL; |
|---|
| 391 | 374 | |
|---|
| 392 | 375 | if (i_rtcp_port && OpenRTCP (VLC_OBJECT (p_access), &p_sys->p_thread->rtcp, |
|---|
| … | … | |
| 500 | 483 | { |
|---|
| 501 | 484 | int i_payload_size = p_sys->i_mtu; |
|---|
| 502 | | if( p_sys->b_rtpts ) |
|---|
| 503 | | i_payload_size -= RTP_HEADER_LENGTH; |
|---|
| 504 | 485 | |
|---|
| 505 | 486 | int i_write = __MIN( p_buffer->i_buffer, i_payload_size ); |
|---|
| … | … | |
| 605 | 586 | p_buffer->i_dts = i_dts; |
|---|
| 606 | 587 | p_buffer->i_buffer = 0; |
|---|
| 607 | | |
|---|
| 608 | | if( p_sys->b_rtpts ) |
|---|
| 609 | | { |
|---|
| 610 | | mtime_t i_timestamp = p_buffer->i_dts * 9 / 100; |
|---|
| 611 | | |
|---|
| 612 | | /* add rtp/ts header */ |
|---|
| 613 | | p_buffer->p_buffer[0] = 0x80; |
|---|
| 614 | | p_buffer->p_buffer[1] = 33; // mpeg2-ts |
|---|
| 615 | | |
|---|
| 616 | | SetWBE( p_buffer->p_buffer + 2, p_sys->i_sequence_number ); |
|---|
| 617 | | p_sys->i_sequence_number++; |
|---|
| 618 | | SetDWBE( p_buffer->p_buffer + 4, i_timestamp ); |
|---|
| 619 | | SetDWBE( p_buffer->p_buffer + 8, p_sys->i_ssrc ); |
|---|
| 620 | | |
|---|
| 621 | | p_buffer->i_buffer = RTP_HEADER_LENGTH; |
|---|
| 622 | | } |
|---|
| 623 | 588 | |
|---|
| 624 | 589 | return p_buffer; |
|---|
| r38ce066 |
r68cdf34 |
|
| 180 | 180 | { |
|---|
| 181 | 181 | /* by extension */ |
|---|
| 182 | | static struct { const char *ext; const char *mux; } exttomux[] = |
|---|
| | 182 | static struct { const char ext[6]; const char mux[16]; } exttomux[] = |
|---|
| 183 | 183 | { |
|---|
| 184 | 184 | { "avi", "avi" }, |
|---|
| … | … | |
| 197 | 197 | { "ps", "ps" }, |
|---|
| 198 | 198 | { "mpeg1","mpeg1" }, |
|---|
| 199 | | { "wav","wav" }, |
|---|
| | 199 | { "wav", "wav" }, |
|---|
| 200 | 200 | { "flv", "ffmpeg{mux=flv}" }, |
|---|
| 201 | | { NULL, NULL } |
|---|
| | 201 | { "", "" } |
|---|
| 202 | 202 | }; |
|---|
| 203 | 203 | const char *psz_ext = strrchr( psz_url, '.' ) + 1; |
|---|
| … | … | |
| 205 | 205 | |
|---|
| 206 | 206 | msg_Dbg( p_this, "extension is %s", psz_ext ); |
|---|
| 207 | | for( i = 0; exttomux[i].ext != NULL; i++ ) |
|---|
| | 207 | for( i = 0; exttomux[i].ext[0]; i++ ) |
|---|
| 208 | 208 | { |
|---|
| 209 | 209 | if( !strcasecmp( psz_ext, exttomux[i].ext ) ) |
|---|