/*****************************************************************************
* Preamble
*****************************************************************************/
-#include <stdio.h>
-#include <stdlib.h>
#include <math.h>
#include <vlc/vlc.h>
-#include <vlc/sout.h>
-#include <vlc/vout.h>
+#include <vlc_sout.h>
+#include <vlc_vout.h>
-#include <charset.h>
-#include <network.h>
+#include <vlc_charset.h>
+#include <vlc_network.h>
#define HAVE_MMX
#ifdef HAVE_FFMPEG_AVCODEC_H
AVCodec *ff_enc;
AVCodecContext *ff_enc_c;
AVFrame *p_frame;
- char *p_buffer_out;
+ uint8_t *p_buffer_out;
int i_nb_pred;
int16_t *p_samples;
};
return VLC_EGENERIC;
}
- sout_CfgParse( p_stream, SOUT_CFG_PREFIX, ppsz_sout_options,
+ config_ChainParse( p_stream, SOUT_CFG_PREFIX, ppsz_sout_options,
p_stream->p_cfg );
var_Get( p_stream, SOUT_CFG_PREFIX "files", &val );
}
var_Get( p_stream, SOUT_CFG_PREFIX "port", &val );
- p_sys->i_fd = net_OpenUDP( p_stream, NULL, val.i_int, NULL, 0 );
+ p_sys->i_fd = net_ListenUDP1( p_stream, NULL, val.i_int );
if ( p_sys->i_fd < 0 )
{
free( p_sys );
id->ff_enc_c = avcodec_alloc_context();
/* Set CPU capabilities */
+ unsigned i_cpu = vlc_CPU();
id->ff_enc_c->dsp_mask = 0;
- if( !(p_stream->p_libvlc->i_cpu & CPU_CAPABILITY_MMX) )
+ if( !(i_cpu & CPU_CAPABILITY_MMX) )
{
id->ff_enc_c->dsp_mask |= FF_MM_MMX;
}
- if( !(p_stream->p_libvlc->i_cpu & CPU_CAPABILITY_MMXEXT) )
+ if( !(i_cpu & CPU_CAPABILITY_MMXEXT) )
{
id->ff_enc_c->dsp_mask |= FF_MM_MMXEXT;
}
- if( !(p_stream->p_libvlc->i_cpu & CPU_CAPABILITY_3DNOW) )
+ if( !(i_cpu & CPU_CAPABILITY_3DNOW) )
{
id->ff_enc_c->dsp_mask |= FF_MM_3DNOW;
}
- if( !(p_stream->p_libvlc->i_cpu & CPU_CAPABILITY_SSE) )
+ if( !(i_cpu & CPU_CAPABILITY_SSE) )
{
id->ff_enc_c->dsp_mask |= FF_MM_SSE;
id->ff_enc_c->dsp_mask |= FF_MM_SSE2;
static void NetCommand( sout_stream_t *p_stream )
{
sout_stream_sys_t *p_sys = p_stream->p_sys;
- char psz_buffer[10];
- int i_len = net_ReadNonBlock( p_stream, p_sys->i_fd, NULL, (char *)&psz_buffer[0],
- sizeof( psz_buffer ), 0 );
+ char psz_buffer[11];
+ int i_len = recv( p_sys->i_fd, psz_buffer, sizeof( psz_buffer ) - 1, 0 );
if ( i_len > 0 )
{
+ psz_buffer[i_len] = '\0';
int i_cmd = strtol( psz_buffer, NULL, 0 );
if ( i_cmd < -1 || i_cmd > p_sys->i_nb_pictures )
{
id->ff_enc_c = avcodec_alloc_context();
/* Set CPU capabilities */
+ unsigned i_cpu = vlc_CPU();
id->ff_enc_c->dsp_mask = 0;
- if( !(p_stream->p_libvlc->i_cpu & CPU_CAPABILITY_MMX) )
+ if( !(i_cpu & CPU_CAPABILITY_MMX) )
{
id->ff_enc_c->dsp_mask |= FF_MM_MMX;
}
- if( !(p_stream->p_libvlc->i_cpu & CPU_CAPABILITY_MMXEXT) )
+ if( !(i_cpu & CPU_CAPABILITY_MMXEXT) )
{
id->ff_enc_c->dsp_mask |= FF_MM_MMXEXT;
}
- if( !(p_stream->p_libvlc->i_cpu & CPU_CAPABILITY_3DNOW) )
+ if( !(i_cpu & CPU_CAPABILITY_3DNOW) )
{
id->ff_enc_c->dsp_mask |= FF_MM_3DNOW;
}
- if( !(p_stream->p_libvlc->i_cpu & CPU_CAPABILITY_SSE) )
+ if( !(i_cpu & CPU_CAPABILITY_SSE) )
{
id->ff_enc_c->dsp_mask |= FF_MM_SSE;
id->ff_enc_c->dsp_mask |= FF_MM_SSE2;
= id->ff_enc_c->coded_frame->motion_subsample_log2;
id->p_frame->mb_type = malloc( ((mb_width + 1) * (mb_height + 1) + 1)
* sizeof(uint32_t) );
- p_stream->p_vlc->pf_memcpy( id->p_frame->mb_type,
+ p_stream->p_libvlc->pf_memcpy( id->p_frame->mb_type,
id->ff_enc_c->coded_frame->mb_type,
(mb_width + 1) * mb_height
* sizeof(id->p_frame->mb_type[0]));
{
id->p_frame->motion_val[i] = malloc( 2 * stride * height
* sizeof(int16_t) );
- p_stream->p_vlc->pf_memcpy( id->p_frame->motion_val[i],
+ p_stream->p_libvlc->pf_memcpy( id->p_frame->motion_val[i],
id->ff_enc_c->coded_frame->motion_val[i],
2 * stride * height * sizeof(int16_t) );
}
{
id->p_frame->ref_index[i] = malloc( b8_stride * 2 * mb_height
* sizeof(int8_t) );
- p_stream->p_vlc->pf_memcpy( id->p_frame->ref_index[i],
+ p_stream->p_libvlc->pf_memcpy( id->p_frame->ref_index[i],
id->ff_enc_c->coded_frame->ref_index[i],
b8_stride * 2 * mb_height * sizeof(int8_t));
}
#endif
p_out = block_New( p_stream, i_out );
- p_stream->p_vlc->pf_memcpy( p_out->p_buffer, id->p_buffer_out, i_out );
+ p_stream->p_libvlc->pf_memcpy( p_out->p_buffer, id->p_buffer_out, i_out );
p_out->i_length = p_buffer->i_length;
p_out->i_pts = p_buffer->i_dts;
p_out->i_dts = p_buffer->i_dts;
return NULL;
p_out = block_New( p_stream, i_out );
- p_stream->p_vlc->pf_memcpy( p_out->p_buffer, id->p_buffer_out, i_out );
+ p_stream->p_libvlc->pf_memcpy( p_out->p_buffer, id->p_buffer_out, i_out );
p_out->i_length = p_buffer->i_length;
p_out->i_pts = p_buffer->i_dts;
p_out->i_dts = p_buffer->i_dts;