Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Gautam Chitnis
web-ui-redesign
Commits
8547ffaa
Commit
8547ffaa
authored
Mar 11, 2004
by
Laurent Aimar
Browse files
* stream_out: sout_buffer_t -> block_t.
parent
298f0e46
Changes
11
Hide whitespace changes
Inline
Side-by-side
modules/stream_out/display.c
View file @
8547ffaa
...
...
@@ -31,21 +31,12 @@
#include
<vlc/input.h>
#include
<vlc/sout.h>
#include
"codecs.h"
/*****************************************************************************
* Exported prototypes
*****************************************************************************/
static
int
Open
(
vlc_object_t
*
);
static
void
Close
(
vlc_object_t
*
);
static
sout_stream_id_t
*
Add
(
sout_stream_t
*
,
es_format_t
*
);
static
int
Del
(
sout_stream_t
*
,
sout_stream_id_t
*
);
static
int
Send
(
sout_stream_t
*
,
sout_stream_id_t
*
,
sout_buffer_t
*
);
/*****************************************************************************
* Module descriptor
*****************************************************************************/
static
int
Open
(
vlc_object_t
*
);
static
void
Close
(
vlc_object_t
*
);
vlc_module_begin
();
set_description
(
_
(
"Display stream output"
)
);
set_capability
(
"sout stream"
,
50
);
...
...
@@ -53,6 +44,14 @@ vlc_module_begin();
set_callbacks
(
Open
,
Close
);
vlc_module_end
();
/*****************************************************************************
* Exported prototypes
*****************************************************************************/
static
sout_stream_id_t
*
Add
(
sout_stream_t
*
,
es_format_t
*
);
static
int
Del
(
sout_stream_t
*
,
sout_stream_id_t
*
);
static
int
Send
(
sout_stream_t
*
,
sout_stream_id_t
*
,
block_t
*
);
struct
sout_stream_sys_t
{
input_thread_t
*
p_input
;
...
...
@@ -175,32 +174,31 @@ static int Del( sout_stream_t *p_stream, sout_stream_id_t *id )
}
static
int
Send
(
sout_stream_t
*
p_stream
,
sout_stream_id_t
*
id
,
sout_buffer
_t
*
p_buffer
)
block
_t
*
p_buffer
)
{
sout_stream_sys_t
*
p_sys
=
p_stream
->
p_sys
;
while
(
p_buffer
)
{
sout_buffer_t
*
p_next
;
block_t
*
p_block
;
block_t
*
p_next
=
p_buffer
->
p_next
;
p_buffer
->
p_next
=
NULL
;
if
(
id
->
p_es
->
p_dec
&&
p_buffer
->
i_size
>
0
&&
(
p_block
=
block_New
(
p_stream
,
p_buffer
->
i_size
))
)
if
(
id
->
p_es
->
p_dec
&&
p_buffer
->
i_buffer
>
0
)
{
p_block
->
i_dts
=
p_buffer
->
i_dts
<=
0
?
0
:
p_buffer
->
i_dts
+
p_sys
->
i_delay
;
p_block
->
i_pts
=
p_buffer
->
i_pts
<=
0
?
0
:
p_buffer
->
i_
p
ts
+
p_sys
->
i_delay
;
if
(
p_buffer
->
i_dts
<=
0
)
p_buffer
->
i_dts
=
0
;
else
p_buffer
->
i_
d
ts
+
=
p_sys
->
i_delay
;
p_stream
->
p_vlc
->
pf_memcpy
(
p_block
->
p_buffer
,
p_buffer
->
p_buffer
,
p_buffer
->
i_size
);
if
(
p_buffer
->
i_pts
<=
0
)
p_buffer
->
i_pts
=
0
;
else
p_buffer
->
i_pts
+=
p_sys
->
i_delay
;
input_DecodeBlock
(
id
->
p_es
->
p_dec
,
p_b
lock
);
input_DecodeBlock
(
id
->
p_es
->
p_dec
,
p_b
uffer
);
}
/* *** go to next buffer *** */
p_next
=
p_buffer
->
p_next
;
sout_BufferDelete
(
p_stream
->
p_sout
,
p_buffer
);
p_buffer
=
p_next
;
}
...
...
modules/stream_out/dummy.c
View file @
8547ffaa
...
...
@@ -2,7 +2,7 @@
* dummy.c: dummy stream output module
*****************************************************************************
* Copyright (C) 2003-2004 VideoLAN
* $Id
: dummy.c,v 1.4 2004/01/25 14:34:25 gbazin Exp
$
* $Id$
*
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
*
...
...
@@ -38,7 +38,7 @@ static void Close ( vlc_object_t * );
static
sout_stream_id_t
*
Add
(
sout_stream_t
*
,
es_format_t
*
);
static
int
Del
(
sout_stream_t
*
,
sout_stream_id_t
*
);
static
int
Send
(
sout_stream_t
*
,
sout_stream_id_t
*
,
sout_buffer
_t
*
);
static
int
Send
(
sout_stream_t
*
,
sout_stream_id_t
*
,
block
_t
*
);
/*****************************************************************************
* Module descriptor
...
...
@@ -99,18 +99,9 @@ static int Del( sout_stream_t *p_stream, sout_stream_id_t *id )
}
static
int
Send
(
sout_stream_t
*
p_stream
,
sout_stream_id_t
*
id
,
sout_buffer
_t
*
p_buffer
)
block
_t
*
p_buffer
)
{
sout_buffer_t
*
p_next
;
while
(
p_buffer
)
{
p_next
=
p_buffer
->
p_next
;
sout_BufferDelete
(
p_stream
->
p_sout
,
p_buffer
);
p_buffer
=
p_next
;
}
block_ChainRelease
(
p_buffer
);
return
VLC_SUCCESS
;
}
modules/stream_out/duplicate.c
View file @
8547ffaa
...
...
@@ -2,7 +2,7 @@
* duplicate.c: duplicate stream output module
*****************************************************************************
* Copyright (C) 2003-2004 VideoLAN
* $Id
: duplicate.c,v 1.12 2004/01/25 14:34:25 gbazin Exp
$
* $Id$
*
* Author: Laurent Aimar <fenrir@via.ecp.fr>
*
...
...
@@ -31,19 +31,11 @@
#include
<vlc/sout.h>
/*****************************************************************************
*
Exported prototypes
*
Module descriptor
*****************************************************************************/
static
int
Open
(
vlc_object_t
*
);
static
void
Close
(
vlc_object_t
*
);
static
sout_stream_id_t
*
Add
(
sout_stream_t
*
,
es_format_t
*
);
static
int
Del
(
sout_stream_t
*
,
sout_stream_id_t
*
);
static
int
Send
(
sout_stream_t
*
,
sout_stream_id_t
*
,
sout_buffer_t
*
);
/*****************************************************************************
* Module descriptor
*****************************************************************************/
vlc_module_begin
();
set_description
(
_
(
"Duplicate stream output"
)
);
set_capability
(
"sout stream"
,
50
);
...
...
@@ -52,6 +44,15 @@ vlc_module_begin();
set_callbacks
(
Open
,
Close
);
vlc_module_end
();
/*****************************************************************************
* Exported prototypes
*****************************************************************************/
static
sout_stream_id_t
*
Add
(
sout_stream_t
*
,
es_format_t
*
);
static
int
Del
(
sout_stream_t
*
,
sout_stream_id_t
*
);
static
int
Send
(
sout_stream_t
*
,
sout_stream_id_t
*
,
block_t
*
);
struct
sout_stream_sys_t
{
int
i_nb_streams
;
...
...
@@ -242,7 +243,7 @@ static int Del( sout_stream_t *p_stream, sout_stream_id_t *id )
* Send:
*****************************************************************************/
static
int
Send
(
sout_stream_t
*
p_stream
,
sout_stream_id_t
*
id
,
sout_buffer
_t
*
p_buffer
)
block
_t
*
p_buffer
)
{
sout_stream_sys_t
*
p_sys
=
p_stream
->
p_sys
;
sout_stream_t
*
p_dup_stream
;
...
...
@@ -251,18 +252,18 @@ static int Send( sout_stream_t *p_stream, sout_stream_id_t *id,
/* Loop through the linked list of buffers */
while
(
p_buffer
)
{
sout_buffer
_t
*
p_next
=
p_buffer
->
p_next
;
block
_t
*
p_next
=
p_buffer
->
p_next
;
p_buffer
->
p_next
=
NULL
;
for
(
i_stream
=
0
;
i_stream
<
p_sys
->
i_nb_streams
-
1
;
i_stream
++
)
{
sout_buffer
_t
*
p_dup
;
block
_t
*
p_dup
;
p_dup_stream
=
p_sys
->
pp_streams
[
i_stream
];
if
(
id
->
pp_ids
[
i_stream
]
)
{
p_dup
=
sout_BufferDuplicate
(
p_stream
->
p_sout
,
p_buffer
);
p_dup
=
block_Duplicate
(
p_buffer
);
p_dup_stream
->
pf_send
(
p_dup_stream
,
id
->
pp_ids
[
i_stream
],
p_dup
);
...
...
@@ -277,7 +278,7 @@ static int Send( sout_stream_t *p_stream, sout_stream_id_t *id,
}
else
{
sout_BufferDelete
(
p_stream
->
p_sout
,
p_buffer
);
block_Release
(
p_buffer
);
}
p_buffer
=
p_next
;
...
...
modules/stream_out/es.c
View file @
8547ffaa
...
...
@@ -2,7 +2,7 @@
* es.c: Elementary stream output module
*****************************************************************************
* Copyright (C) 2003-2004 VideoLAN
* $Id
: es.c,v 1.5 2004/01/25 14:34:25 gbazin Exp
$
* $Id$
*
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
*
...
...
@@ -40,7 +40,7 @@ static void Close ( vlc_object_t * );
static
sout_stream_id_t
*
Add
(
sout_stream_t
*
,
es_format_t
*
);
static
int
Del
(
sout_stream_t
*
,
sout_stream_id_t
*
);
static
int
Send
(
sout_stream_t
*
,
sout_stream_id_t
*
,
sout_buffer
_t
*
);
static
int
Send
(
sout_stream_t
*
,
sout_stream_id_t
*
,
block
_t
*
);
/*****************************************************************************
* Module descriptor
...
...
@@ -288,9 +288,6 @@ static sout_stream_id_t *Add( sout_stream_t *p_stream, es_format_t *p_fmt )
return
(
NULL
);
}
/* XXX beurk */
p_sout
->
i_preheader
=
__MAX
(
p_sout
->
i_preheader
,
p_mux
->
i_preheader
);
id
=
malloc
(
sizeof
(
sout_stream_id_t
)
);
id
->
p_mux
=
p_mux
;
id
->
p_input
=
sout_MuxAddStream
(
p_mux
,
p_fmt
);
...
...
@@ -320,7 +317,7 @@ static int Del( sout_stream_t *p_stream, sout_stream_id_t *id )
}
static
int
Send
(
sout_stream_t
*
p_stream
,
sout_stream_id_t
*
id
,
sout_buffer
_t
*
p_buffer
)
block
_t
*
p_buffer
)
{
sout_MuxSendBuffer
(
id
->
p_mux
,
id
->
p_input
,
p_buffer
);
...
...
modules/stream_out/gather.c
View file @
8547ffaa
...
...
@@ -2,7 +2,7 @@
* gather.c: gathering stream output module
*****************************************************************************
* Copyright (C) 2003-2004 VideoLAN
* $Id
: gather.c,v 1.3 2004/01/25 14:34:25 gbazin Exp
$
* $Id$
*
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
*
...
...
@@ -49,7 +49,7 @@ vlc_module_end();
static
sout_stream_id_t
*
Add
(
sout_stream_t
*
,
es_format_t
*
);
static
int
Del
(
sout_stream_t
*
,
sout_stream_id_t
*
);
static
int
Send
(
sout_stream_t
*
,
sout_stream_id_t
*
,
sout_buffer
_t
*
);
block
_t
*
);
struct
sout_stream_id_t
{
...
...
@@ -187,7 +187,7 @@ static int Del( sout_stream_t *p_stream, sout_stream_id_t *id )
* Send:
*****************************************************************************/
static
int
Send
(
sout_stream_t
*
p_stream
,
sout_stream_id_t
*
id
,
sout_buffer
_t
*
p_buffer
)
sout_stream_id_t
*
id
,
block
_t
*
p_buffer
)
{
sout_stream_sys_t
*
p_sys
=
p_stream
->
p_sys
;
...
...
modules/stream_out/rtp.c
View file @
8547ffaa
...
...
@@ -52,7 +52,7 @@ vlc_module_end();
static
sout_stream_id_t
*
Add
(
sout_stream_t
*
,
es_format_t
*
);
static
int
Del
(
sout_stream_t
*
,
sout_stream_id_t
*
);
static
int
Send
(
sout_stream_t
*
,
sout_stream_id_t
*
,
sout_buffer
_t
*
);
block
_t
*
);
struct
sout_stream_sys_t
{
...
...
@@ -87,7 +87,7 @@ struct sout_stream_sys_t
uint16_t
i_sequence
;
uint32_t
i_timestamp_start
;
uint8_t
ssrc
[
4
];
sout_buffer
_t
*
packet
;
block
_t
*
packet
;
/* */
int
i_es
;
...
...
@@ -95,7 +95,7 @@ struct sout_stream_sys_t
};
typedef
int
(
*
pf_rtp_packetizer_t
)(
sout_stream_t
*
,
sout_stream_id_t
*
,
sout_buffer
_t
*
);
block
_t
*
);
struct
sout_stream_id_t
{
...
...
@@ -125,7 +125,7 @@ struct sout_stream_id_t
httpd_url_t
*
p_rtsp_url
;
};
static
int
AccessOutGrabberWrite
(
sout_access_out_t
*
,
sout_buffer
_t
*
);
static
int
AccessOutGrabberWrite
(
sout_access_out_t
*
,
block
_t
*
);
static
int
HttpSetup
(
sout_stream_t
*
p_stream
,
vlc_url_t
*
);
static
int
RtspSetup
(
sout_stream_t
*
p_stream
,
vlc_url_t
*
);
...
...
@@ -274,8 +274,6 @@ static int Open( vlc_object_t *p_this )
free
(
p_sys
);
return
VLC_EGENERIC
;
}
p_sout
->
i_preheader
=
__MAX
(
p_sout
->
i_preheader
,
p_sys
->
p_mux
->
i_preheader
);
/* create the SDP only once */
p_sys
->
psz_sdp
=
...
...
@@ -362,7 +360,7 @@ static void Close( vlc_object_t * p_this )
sout_AccessOutDelete
(
p_sys
->
p_grab
);
if
(
p_sys
->
packet
)
{
sout_BufferDelete
(
p_stream
->
p_sout
,
p_sys
->
packet
);
block_Release
(
p_sys
->
packet
);
}
}
...
...
@@ -475,13 +473,13 @@ static char *SDPGenerate( sout_stream_t *p_stream, char *psz_destination, vlc_bo
/*****************************************************************************
*
*****************************************************************************/
static
int
rtp_packetize_l16
(
sout_stream_t
*
,
sout_stream_id_t
*
,
sout_buffer
_t
*
);
static
int
rtp_packetize_l8
(
sout_stream_t
*
,
sout_stream_id_t
*
,
sout_buffer
_t
*
);
static
int
rtp_packetize_mpa
(
sout_stream_t
*
,
sout_stream_id_t
*
,
sout_buffer
_t
*
);
static
int
rtp_packetize_mpv
(
sout_stream_t
*
,
sout_stream_id_t
*
,
sout_buffer
_t
*
);
static
int
rtp_packetize_ac3
(
sout_stream_t
*
,
sout_stream_id_t
*
,
sout_buffer
_t
*
);
static
int
rtp_packetize_split
(
sout_stream_t
*
,
sout_stream_id_t
*
,
sout_buffer
_t
*
);
static
int
rtp_packetize_mp4a
(
sout_stream_t
*
,
sout_stream_id_t
*
,
sout_buffer
_t
*
);
static
int
rtp_packetize_l16
(
sout_stream_t
*
,
sout_stream_id_t
*
,
block
_t
*
);
static
int
rtp_packetize_l8
(
sout_stream_t
*
,
sout_stream_id_t
*
,
block
_t
*
);
static
int
rtp_packetize_mpa
(
sout_stream_t
*
,
sout_stream_id_t
*
,
block
_t
*
);
static
int
rtp_packetize_mpv
(
sout_stream_t
*
,
sout_stream_id_t
*
,
block
_t
*
);
static
int
rtp_packetize_ac3
(
sout_stream_t
*
,
sout_stream_id_t
*
,
block
_t
*
);
static
int
rtp_packetize_split
(
sout_stream_t
*
,
sout_stream_id_t
*
,
block
_t
*
);
static
int
rtp_packetize_mp4a
(
sout_stream_t
*
,
sout_stream_id_t
*
,
block
_t
*
);
static
void
sprintf_hexa
(
char
*
s
,
uint8_t
*
p_data
,
int
i_data
)
{
...
...
@@ -728,9 +726,9 @@ static int Del( sout_stream_t *p_stream, sout_stream_id_t *id )
}
static
int
Send
(
sout_stream_t
*
p_stream
,
sout_stream_id_t
*
id
,
sout_buffer
_t
*
p_buffer
)
block
_t
*
p_buffer
)
{
sout_buffer
_t
*
p_next
;
block
_t
*
p_next
;
if
(
p_stream
->
p_sys
->
p_mux
)
{
...
...
@@ -745,7 +743,7 @@ static int Send( sout_stream_t *p_stream, sout_stream_id_t *id,
{
break
;
}
sout_BufferDelete
(
p_stream
->
p_sout
,
p_buffer
);
block_Release
(
p_buffer
);
p_buffer
=
p_next
;
}
}
...
...
@@ -754,7 +752,7 @@ static int Send( sout_stream_t *p_stream, sout_stream_id_t *id,
static
int
AccessOutGrabberWriteBuffer
(
sout_stream_t
*
p_stream
,
sout_buffer
_t
*
p_buffer
)
block
_t
*
p_buffer
)
{
sout_stream_sys_t
*
p_sys
=
p_stream
->
p_sys
;
...
...
@@ -762,10 +760,10 @@ static int AccessOutGrabberWriteBuffer( sout_stream_t *p_stream,
uint32_t
i_timestamp
=
i_dts
*
9
/
100
;
uint8_t
*
p_data
=
p_buffer
->
p_buffer
;
unsigned
int
i_data
=
p_buffer
->
i_
size
;
unsigned
int
i_data
=
p_buffer
->
i_
buffer
;
unsigned
int
i_max
=
p_sys
->
i_mtu
-
12
;
int
i_packet
=
(
p_buffer
->
i_
size
+
i_max
-
1
)
/
i_max
;
int
i_packet
=
(
p_buffer
->
i_
buffer
+
i_max
-
1
)
/
i_max
;
while
(
i_data
>
0
)
{
...
...
@@ -773,7 +771,7 @@ static int AccessOutGrabberWriteBuffer( sout_stream_t *p_stream,
/* output complete packet */
if
(
p_sys
->
packet
&&
p_sys
->
packet
->
i_
size
+
i_data
>
i_max
)
p_sys
->
packet
->
i_
buffer
+
i_data
>
i_max
)
{
sout_AccessOutWrite
(
p_sys
->
p_access
,
p_sys
->
packet
);
p_sys
->
packet
=
NULL
;
...
...
@@ -782,7 +780,7 @@ static int AccessOutGrabberWriteBuffer( sout_stream_t *p_stream,
if
(
p_sys
->
packet
==
NULL
)
{
/* allocate a new packet */
p_sys
->
packet
=
sout_Buffer
New
(
p_stream
->
p_sout
,
p_sys
->
i_mtu
);
p_sys
->
packet
=
block_
New
(
p_stream
,
p_sys
->
i_mtu
);
p_sys
->
packet
->
p_buffer
[
0
]
=
0x80
;
p_sys
->
packet
->
p_buffer
[
1
]
=
p_sys
->
i_payload_type
;
p_sys
->
packet
->
p_buffer
[
2
]
=
(
p_sys
->
i_sequence
>>
8
)
&
0xff
;
...
...
@@ -795,7 +793,7 @@ static int AccessOutGrabberWriteBuffer( sout_stream_t *p_stream,
p_sys
->
packet
->
p_buffer
[
9
]
=
p_sys
->
ssrc
[
1
];
p_sys
->
packet
->
p_buffer
[
10
]
=
p_sys
->
ssrc
[
2
];
p_sys
->
packet
->
p_buffer
[
11
]
=
p_sys
->
ssrc
[
3
];
p_sys
->
packet
->
i_
size
=
12
;
p_sys
->
packet
->
i_
buffer
=
12
;
p_sys
->
packet
->
i_dts
=
i_dts
;
p_sys
->
packet
->
i_length
=
p_buffer
->
i_length
/
i_packet
;
...
...
@@ -804,13 +802,12 @@ static int AccessOutGrabberWriteBuffer( sout_stream_t *p_stream,
p_sys
->
i_sequence
++
;
}
i_size
=
__MIN
(
i_data
,
p_sys
->
i_mtu
-
p_sys
->
packet
->
i_
size
);
i_size
=
__MIN
(
i_data
,
p_sys
->
i_mtu
-
p_sys
->
packet
->
i_
buffer
);
memcpy
(
&
p_sys
->
packet
->
p_buffer
[
p_sys
->
packet
->
i_size
],
p_data
,
i_size
);
memcpy
(
&
p_sys
->
packet
->
p_buffer
[
p_sys
->
packet
->
i_buffer
],
p_data
,
i_size
);
p_sys
->
packet
->
i_
size
+=
i_size
;
p_sys
->
packet
->
i_
buffer
+=
i_size
;
p_data
+=
i_size
;
i_data
-=
i_size
;
}
...
...
@@ -819,20 +816,20 @@ static int AccessOutGrabberWriteBuffer( sout_stream_t *p_stream,
}
static
int
AccessOutGrabberWrite
(
sout_access_out_t
*
p_access
,
sout_buffer
_t
*
p_buffer
)
block
_t
*
p_buffer
)
{
sout_stream_t
*
p_stream
=
(
sout_stream_t
*
)
p_access
->
p_sys
;
//fprintf( stderr, "received buffer size=%d\n", p_buffer->i_
size
);
//fprintf( stderr, "received buffer size=%d\n", p_buffer->i_
buffer
);
//
while
(
p_buffer
)
{
sout_buffer
_t
*
p_next
;
block
_t
*
p_next
;
AccessOutGrabberWriteBuffer
(
p_stream
,
p_buffer
);
p_next
=
p_buffer
->
p_next
;
sout_BufferDelete
(
p_access
->
p_sout
,
p_buffer
);
block_Release
(
p_buffer
);
p_buffer
=
p_next
;
}
...
...
@@ -1032,7 +1029,7 @@ static int RtspCallback( httpd_callback_sys_t *p_args,
/****************************************************************************
* rtp_packetize_*:
****************************************************************************/
static
void
rtp_packetize_common
(
sout_stream_id_t
*
id
,
sout_buffer
_t
*
out
,
static
void
rtp_packetize_common
(
sout_stream_id_t
*
id
,
block
_t
*
out
,
int
b_marker
,
int64_t
i_pts
)
{
uint32_t
i_timestamp
=
i_pts
*
(
int64_t
)
id
->
i_clock_rate
/
I64C
(
1000000
);
...
...
@@ -1051,24 +1048,24 @@ static void rtp_packetize_common( sout_stream_id_t *id, sout_buffer_t *out,
out
->
p_buffer
[
10
]
=
id
->
ssrc
[
2
];
out
->
p_buffer
[
11
]
=
id
->
ssrc
[
3
];
out
->
i_
size
=
12
;
out
->
i_
buffer
=
12
;
id
->
i_sequence
++
;
}
static
int
rtp_packetize_mpa
(
sout_stream_t
*
p_stream
,
sout_stream_id_t
*
id
,
sout_buffer
_t
*
in
)
block
_t
*
in
)
{
int
i_max
=
id
->
i_mtu
-
12
-
4
;
/* payload max in one packet */
int
i_count
=
(
in
->
i_
size
+
i_max
-
1
)
/
i_max
;
int
i_count
=
(
in
->
i_
buffer
+
i_max
-
1
)
/
i_max
;
uint8_t
*
p_data
=
in
->
p_buffer
;
int
i_data
=
in
->
i_
size
;
int
i_data
=
in
->
i_
buffer
;
int
i
;
for
(
i
=
0
;
i
<
i_count
;
i
++
)
{
int
i_payload
=
__MIN
(
i_max
,
i_data
);
sout_buffer_t
*
out
=
sout_Buffer
New
(
p_stream
->
p_sout
,
16
+
i_payload
);
block_t
*
out
=
block_
New
(
p_stream
,
16
+
i_payload
);
/* rtp common header */
rtp_packetize_common
(
id
,
out
,
(
i
==
i_count
-
1
)
?
1
:
0
,
in
->
i_pts
);
...
...
@@ -1080,7 +1077,7 @@ static int rtp_packetize_mpa( sout_stream_t *p_stream, sout_stream_id_t *id,
out
->
p_buffer
[
15
]
=
(
(
i
*
i_max
)
)
&
0xff
;
memcpy
(
&
out
->
p_buffer
[
16
],
p_data
,
i_payload
);
out
->
i_
size
=
16
+
i_payload
;
out
->
i_
buffer
=
16
+
i_payload
;
out
->
i_dts
=
in
->
i_dts
+
i
*
in
->
i_length
/
i_count
;
out
->
i_length
=
in
->
i_length
/
i_count
;
...
...
@@ -1095,13 +1092,13 @@ static int rtp_packetize_mpa( sout_stream_t *p_stream, sout_stream_id_t *id,
/* rfc2250 */
static
int
rtp_packetize_mpv
(
sout_stream_t
*
p_stream
,
sout_stream_id_t
*
id
,
sout_buffer
_t
*
in
)
block
_t
*
in
)
{
int
i_max
=
id
->
i_mtu
-
12
-
4
;
/* payload max in one packet */
int
i_count
=
(
in
->
i_
size
+
i_max
-
1
)
/
i_max
;
int
i_count
=
(
in
->
i_
buffer
+
i_max
-
1
)
/
i_max
;
uint8_t
*
p_data
=
in
->
p_buffer
;
int
i_data
=
in
->
i_
size
;
int
i_data
=
in
->
i_
buffer
;
int
i
;
int
b_sequence_start
=
0
;
int
i_temporal_ref
=
0
;
...
...
@@ -1110,10 +1107,10 @@ static int rtp_packetize_mpv( sout_stream_t *p_stream, sout_stream_id_t *id,
int
b_start_slice
=
0
;
/* preparse this packet to get some info */
if
(
in
->
i_
size
>
4
)
if
(
in
->
i_
buffer
>
4
)
{
uint8_t
*
p
=
p_data
;
int
i_rest
=
in
->
i_
size
;
int
i_rest
=
in
->
i_
buffer
;
for
(
;;
)
{
...
...
@@ -1163,7 +1160,7 @@ static int rtp_packetize_mpv( sout_stream_t *p_stream, sout_stream_id_t *id,
for
(
i
=
0
;
i
<
i_count
;
i
++
)
{
int
i_payload
=
__MIN
(
i_max
,
i_data
);
sout_buffer_t
*
out
=
sout_Buffer
New
(
p_stream
->
p_sout
,
block_t
*
out
=
block_
New
(
p_stream
,
16
+
i_payload
);
uint32_t
h
=
(
i_temporal_ref
<<
16
)
|
(
b_sequence_start
<<
13
)
|
...
...
@@ -1184,7 +1181,7 @@ static int rtp_packetize_mpv( sout_stream_t *p_stream, sout_stream_id_t *id,
memcpy
(
&
out
->
p_buffer
[
16
],
p_data
,
i_payload
);
out
->
i_
size
=
16
+
i_payload
;
out
->
i_
buffer
=
16
+
i_payload
;
out
->
i_dts
=
in
->
i_dts
+
i
*
in
->
i_length
/
i_count
;
out
->
i_length
=
in
->
i_length
/
i_count
;
...
...
@@ -1197,19 +1194,19 @@ static int rtp_packetize_mpv( sout_stream_t *p_stream, sout_stream_id_t *id,
return
VLC_SUCCESS
;
}
static
int
rtp_packetize_ac3
(
sout_stream_t
*
p_stream
,
sout_stream_id_t
*
id
,
sout_buffer
_t
*
in
)
block
_t
*
in
)
{
int
i_max
=
id
->
i_mtu
-
12
-
2
;
/* payload max in one packet */
int
i_count
=
(
in
->
i_
size
+
i_max
-
1
)
/
i_max
;
int
i_count
=
(
in
->
i_
buffer
+
i_max
-
1
)
/
i_max
;
uint8_t
*
p_data
=
in
->
p_buffer
;
int
i_data
=
in
->
i_
size
;
int
i_data
=
in
->
i_
buffer
;
int
i
;
for
(
i
=
0
;
i
<
i_count
;
i
++
)
{
int
i_payload
=
__MIN
(
i_max
,
i_data
);
sout_buffer_t
*
out
=
sout_Buffer
New
(
p_stream
->
p_sout
,
14
+
i_payload
);
block_t
*
out
=
block_
New
(
p_stream
,
14
+
i_payload
);
/* rtp common header */
rtp_packetize_common
(
id
,
out
,
(
i
==
i_count
-
1
)
?
1
:
0
,
in
->
i_pts
);
...
...
@@ -1220,7 +1217,7 @@ static int rtp_packetize_ac3( sout_stream_t *p_stream, sout_stream_id_t *id,
/* data */
memcpy
(
&
out
->
p_buffer
[
14
],
p_data
,
i_payload
);
out
->
i_
size
=
14
+
i_payload
;
out
->
i_
buffer
=
14
+
i_payload
;
out
->
i_dts
=
in
->
i_dts
+
i
*
in
->
i_length
/
i_count
;
out
->
i_length
=
in
->
i_length
/
i_count
;
...
...
@@ -1234,26 +1231,26 @@ static int rtp_packetize_ac3( sout_stream_t *p_stream, sout_stream_id_t *id,
}
static
int
rtp_packetize_split
(
sout_stream_t
*
p_stream
,
sout_stream_id_t
*
id
,
sout_buffer
_t
*
in
)
block
_t
*
in
)
{
int
i_max
=
id
->
i_mtu
-
12
;
/* payload max in one packet */
int
i_count
=
(
in
->
i_
size
+
i_max
-
1
)
/
i_max
;
int
i_count
=
(
in
->
i_
buffer
+
i_max
-
1
)
/
i_max
;
uint8_t
*
p_data
=
in
->
p_buffer
;
int
i_data
=
in
->
i_
size
;
int
i_data
=
in
->
i_
buffer
;
int
i
;
for
(
i
=
0
;
i
<
i_count
;
i
++
)
{
int
i_payload
=
__MIN
(
i_max
,
i_data
);
sout_buffer_t
*
out
=
sout_Buffer
New
(
p_stream
->
p_sout
,
12
+
i_payload
);
block_t
*
out
=
block_
New
(
p_stream
,
12
+
i_payload
);
/* rtp common header */
rtp_packetize_common
(
id
,
out
,
((
i
==
i_count
-
1
)
?
1
:
0
),
(
in
->
i_pts
>
0
?
in
->
i_pts
:
in
->
i_dts
)
);
memcpy
(
&
out
->
p_buffer
[
12
],
p_data
,
i_payload
);
out
->
i_
size
=
12
+
i_payload
;
out
->
i_
buffer
=
12
+
i_payload
;
out
->
i_dts
=
in
->
i_dts
+
i
*
in
->
i_length
/
i_count
;
out
->
i_length
=
in
->
i_length
/
i_count
;
...
...
@@ -1267,26 +1264,26 @@ static int rtp_packetize_split( sout_stream_t *p_stream, sout_stream_id_t *id,
}
static
int
rtp_packetize_l16
(
sout_stream_t
*
p_stream
,
sout_stream_id_t
*
id
,
sout_buffer
_t
*
in
)