rtp_fmt->ptname = "L8";
rtp_fmt->pf_packetize = rtp_packetize_split;
break;
+ case VLC_CODEC_S24B:
+ rtp_fmt->ptname = "L24";
+ rtp_fmt->pf_packetize = rtp_packetize_split;
+ break;
case VLC_CODEC_MPGA:
rtp_fmt->payload_type = 14;
rtp_fmt->ptname = "MPA";
if( asprintf( &rtp_fmt->fmtp,
"sampling=YCbCr-4:%d:%d; width=%d; height=%d; "
- "delivery-method=inline; configuration=%s;",
- c1, c2, p_fmt->video.i_width,
- p_fmt->video.i_height, config ) == -1 )
+ "delivery-method=inline; configuration=%s; "
+ "delivery-method=in_band;", c1, c2,
+ p_fmt->video.i_width, p_fmt->video.i_height,
+ config ) == -1 )
rtp_fmt->fmtp = NULL;
free(config);
}
const uint8_t *p_data, int i_data, int64_t i_pts,
int64_t i_dts, bool b_last, int64_t i_length );
+int rtp_packetize_xiph_config( sout_stream_id_t *id, const char *fmtp,
+ int64_t i_pts )
+{
+ if (fmtp == NULL)
+ return VLC_EGENERIC;
+
+ /* extract base64 configuration from fmtp */
+ char *start = strstr(fmtp, "configuration=");
+ assert(start != NULL);
+ start += sizeof("configuration=") - 1;
+ char *end = strchr(start, ';');
+ assert(end != NULL);
+ size_t len = end - start;
+ char b64[len + 1];
+ memcpy(b64, start, len);
+ b64[len] = '\0';
+
+ int i_max = rtp_mtu (id) - 6; /* payload max in one packet */
+
+ uint8_t *p_orig, *p_data;
+ int i_data;
+
+ i_data = vlc_b64_decode_binary(&p_orig, b64);
+ if (i_data == 0)
+ return VLC_EGENERIC;
+ assert(i_data > 9);
+ p_data = p_orig + 9;
+ i_data -= 9;
+
+ int i_count = ( i_data + i_max - 1 ) / i_max;
+
+ for( int i = 0; i < i_count; i++ )
+ {
+ int i_payload = __MIN( i_max, i_data );
+ block_t *out = block_Alloc( 18 + i_payload );
+
+ unsigned fragtype, numpkts;
+ if (i_count == 1)
+ {
+ fragtype = 0;
+ numpkts = 1;
+ }
+ else
+ {
+ numpkts = 0;
+ if (i == 0)
+ fragtype = 1;
+ else if (i == i_count - 1)
+ fragtype = 3;
+ else
+ fragtype = 2;
+ }
+ /* Ident:24, Fragment type:2, Vorbis/Theora Data Type:2, # of pkts:4 */
+ uint32_t header = ((XIPH_IDENT & 0xffffff) << 8) |
+ (fragtype << 6) | (1 << 4) | numpkts;
+
+ /* rtp common header */
+ rtp_packetize_common( id, out, 0, i_pts );
+
+ SetDWBE( out->p_buffer + 12, header);
+ SetWBE( out->p_buffer + 16, i_payload);
+ memcpy( &out->p_buffer[18], p_data, i_payload );
+
+ out->i_buffer = 18 + i_payload;
+ out->i_dts = i_pts;
+
+ rtp_packetize_send( id, out );
+
+ p_data += i_payload;
+ i_data -= i_payload;
+ }
+
+ free(p_orig);
+
+ return VLC_SUCCESS;
+}
+
/* rfc5215 */
static int rtp_packetize_xiph( sout_stream_id_t *id, block_t *in )
{
memcpy( out->p_buffer + 12, p_data, i_payload );
out->i_buffer = 12 + i_payload;
- out->i_dts = out->i_pts;
+ out->i_dts = in->i_pts;
out->i_length = 0;
rtp_packetize_send( id, out );