+Changes between 1.0.0-rc1 and 1.1.0-git:
+----------------------------------------
+
+
Changes between 0.9.9a and 1.0.0-rc1:
------------------------------------
OSS or Alsa audio input. Use --input-slave alsa:// or oss:// if needed.
* DVB scanning on linux
* EXPERIMENTAL Blu-Ray Disc and AVCHD Folders support
- * On-the-fly zip file decompression and browsing (MRL of the form zip://file.zip|file.avi to specify the file)
+ * On-the-fly zip file decompression and browsing (MRL of the form zip://file.zip!/file.avi to specify the file - the development form of zip://file.zip|file.avi is not supported anymore)
* Opening of any file descriptor using 'fd://'
* MTP device access on Unix
* CD-Text support on the cdda module (CD-Audio)
static const struct
{
unsigned int i_v4l2;
- int i_fourcc;
+ vlc_fourcc_t i_fourcc;
int i_rmask;
int i_gmask;
int i_bmask;
} v4l2chroma_to_fourcc[] =
{
/* Raw data types */
- { V4L2_PIX_FMT_GREY, VLC_FOURCC('G','R','E','Y'), 0, 0, 0 },
+ { V4L2_PIX_FMT_GREY, VLC_CODEC_GREY, 0, 0, 0 },
{ V4L2_PIX_FMT_HI240, VLC_FOURCC('I','2','4','0'), 0, 0, 0 },
- { V4L2_PIX_FMT_RGB555, VLC_FOURCC('R','V','1','5'), 0x001f,0x03e0,0x7c00 },
- { V4L2_PIX_FMT_RGB565, VLC_FOURCC('R','V','1','6'), 0x001f,0x07e0,0xf800 },
+ { V4L2_PIX_FMT_RGB555, VLC_CODEC_RGB15, 0x001f,0x03e0,0x7c00 },
+ { V4L2_PIX_FMT_RGB565, VLC_CODEC_RGB16, 0x001f,0x07e0,0xf800 },
/* Won't work since we don't know how to handle such gmask values
* correctly
- { V4L2_PIX_FMT_RGB555X, VLC_FOURCC('R','V','1','5'), 0x007c,0xe003,0x1f00 },
- { V4L2_PIX_FMT_RGB565X, VLC_FOURCC('R','V','1','6'), 0x00f8,0xe007,0x1f00 },
+ { V4L2_PIX_FMT_RGB555X, VLC_CODEC_RGB15, 0x007c,0xe003,0x1f00 },
+ { V4L2_PIX_FMT_RGB565X, VLC_CODEC_RGB16, 0x00f8,0xe007,0x1f00 },
*/
- { V4L2_PIX_FMT_BGR24, VLC_FOURCC('R','V','2','4'), 0xff0000,0xff00,0xff },
- { V4L2_PIX_FMT_RGB24, VLC_FOURCC('R','V','2','4'), 0xff,0xff00,0xff0000 },
- { V4L2_PIX_FMT_BGR32, VLC_FOURCC('R','V','3','2'), 0xff0000,0xff00,0xff },
- { V4L2_PIX_FMT_RGB32, VLC_FOURCC('R','V','3','2'), 0xff,0xff00,0xff0000 },
- { V4L2_PIX_FMT_YUYV, VLC_FOURCC('Y','U','Y','2'), 0, 0, 0 },
- { V4L2_PIX_FMT_YUYV, VLC_FOURCC('Y','U','Y','V'), 0, 0, 0 },
- { V4L2_PIX_FMT_UYVY, VLC_FOURCC('U','Y','V','Y'), 0, 0, 0 },
+ { V4L2_PIX_FMT_BGR24, VLC_CODEC_RGB24, 0xff0000,0xff00,0xff },
+ { V4L2_PIX_FMT_RGB24, VLC_CODEC_RGB24, 0xff,0xff00,0xff0000 },
+ { V4L2_PIX_FMT_BGR32, VLC_CODEC_RGB32, 0xff0000,0xff00,0xff },
+ { V4L2_PIX_FMT_RGB32, VLC_CODEC_RGB32, 0xff,0xff00,0xff0000 },
+ { V4L2_PIX_FMT_YUYV, VLC_CODEC_YUYV, 0, 0, 0 },
+ { V4L2_PIX_FMT_UYVY, VLC_CODEC_UYVY, 0, 0, 0 },
{ V4L2_PIX_FMT_Y41P, VLC_FOURCC('I','4','1','N'), 0, 0, 0 },
- { V4L2_PIX_FMT_YUV422P, VLC_FOURCC('I','4','2','2'), 0, 0, 0 },
- { V4L2_PIX_FMT_YVU420, VLC_FOURCC('Y','V','1','2'), 0, 0, 0 },
- { V4L2_PIX_FMT_YUV411P, VLC_FOURCC('I','4','1','1'), 0, 0, 0 },
- { V4L2_PIX_FMT_YUV410, VLC_FOURCC('I','4','1','0'), 0, 0, 0 },
+ { V4L2_PIX_FMT_YUV422P, VLC_CODEC_I422, 0, 0, 0 },
+ { V4L2_PIX_FMT_YVU420, VLC_CODEC_YV12, 0, 0, 0 },
+ { V4L2_PIX_FMT_YUV411P, VLC_CODEC_I411, 0, 0, 0 },
+ { V4L2_PIX_FMT_YUV410, VLC_CODEC_I410, 0, 0, 0 },
/* Raw data types, not in V4L2 spec but still in videodev2.h and supported
* by VLC */
- { V4L2_PIX_FMT_YUV420, VLC_FOURCC('I','4','2','0'), 0, 0, 0 },
- /* FIXME { V4L2_PIX_FMT_RGB444, VLC_FOURCC('R','V','3','2') }, */
+ { V4L2_PIX_FMT_YUV420, VLC_CODEC_I420, 0, 0, 0 },
+ /* FIXME { V4L2_PIX_FMT_RGB444, VLC_CODEC_RGB32 }, */
/* Compressed data types */
- { V4L2_PIX_FMT_MJPEG, VLC_FOURCC('M','J','P','G'), 0, 0, 0 },
+ { V4L2_PIX_FMT_MJPEG, VLC_CODEC_MJPG, 0, 0, 0 },
#if 0
{ V4L2_PIX_FMT_JPEG, VLC_FOURCC('J','P','E','G') },
{ V4L2_PIX_FMT_DV, VLC_FOURCC('?','?','?','?') },
/* Test and set Chroma */
fmt.fmt.pix.pixelformat = 0;
- if( p_sys->psz_requested_chroma && strlen( p_sys->psz_requested_chroma ) > 0 )
+ if( p_sys->psz_requested_chroma && *p_sys->psz_requested_chroma )
{
/* User specified chroma */
- if( strlen( p_sys->psz_requested_chroma ) >= 4 )
+ const vlc_fourcc_t i_requested_fourcc =
+ vlc_fourcc_GetCodecFromString( VIDEO_ES, p_sys->psz_requested_chroma );
+
+ for( int i = 0; v4l2chroma_to_fourcc[i].i_v4l2 != 0; i++ )
{
- int i_requested_fourcc = VLC_FOURCC(
- p_sys->psz_requested_chroma[0], p_sys->psz_requested_chroma[1],
- p_sys->psz_requested_chroma[2], p_sys->psz_requested_chroma[3] );
- for( int i = 0; v4l2chroma_to_fourcc[i].i_v4l2 != 0; i++ )
+ if( v4l2chroma_to_fourcc[i].i_fourcc == i_requested_fourcc )
{
- if( v4l2chroma_to_fourcc[i].i_fourcc == i_requested_fourcc )
- {
- fmt.fmt.pix.pixelformat = v4l2chroma_to_fourcc[i].i_v4l2;
- break;
- }
+ fmt.fmt.pix.pixelformat = v4l2chroma_to_fourcc[i].i_v4l2;
+ break;
}
}
/* Try and set user chroma */
Control( p_obj, p_sys, i_fd, psz_name, i_cid,
strtol( ++psz_assign, &psz_parser, 0) );
}
+ free( name.psz_string );
}
if( psz_parser < psz_assign )
psz_parser = ( *psz_delim ) ? ( psz_delim + 1 ) : psz_delim;
}
}
+ var_Change( p_obj, "allcontrols", VLC_VAR_FREELIST, &val, &text );
}
/*****************************************************************************
if( controls[i].i_cid == queryctrl.id ) break;
name2var( queryctrl.name );
Control( p_obj, p_sys, i_fd,
- controls[i].psz_name ? : (const char *)queryctrl.name,
+ controls[i].psz_name ? controls[i].psz_name
+ : (const char *)queryctrl.name,
queryctrl.id, queryctrl.default_value );
}
queryctrl.id |= V4L2_CTRL_FLAG_NEXT_CTRL;
if( controls[i].i_cid == queryctrl.id ) break;
name2var( queryctrl.name );
Control( p_obj, p_sys, i_fd,
- controls[i].psz_name ? : (const char *)queryctrl.name,
+ controls[i].psz_name ? controls[i].psz_name
+ : (const char *)queryctrl.name,
queryctrl.id, queryctrl.default_value );
}
}
static const char *psz_control_names[] =
{
- "Roomsize", "Width" , "Wet", "Dry", "Damp"
+ "spatializer-roomsize", "spatializer-width" ,
+ "spatializer-wet", "spatializer-dry", "spatializer-damp"
};
static void DoWork( aout_instance_t *, aout_filter_t *,
aout_buffer_t *, aout_buffer_t * );
bool b_fit = true;
msg_Dbg(p_this, "Opening filter spatializer %s %s %d", __FILE__,__func__,__LINE__);
- if( p_filter->input.i_format != VLC_FOURCC('f','l','3','2' ) ||
- p_filter->output.i_format != VLC_FOURCC('f','l','3','2') )
+ if( p_filter->input.i_format != VLC_CODEC_FL32 ||
+ p_filter->output.i_format != VLC_CODEC_FL32 )
{
b_fit = false;
- p_filter->input.i_format = VLC_FOURCC('f','l','3','2');
- p_filter->output.i_format = VLC_FOURCC('f','l','3','2');
+ p_filter->input.i_format = VLC_CODEC_FL32;
+ p_filter->output.i_format = VLC_CODEC_FL32;
msg_Warn( p_filter, "bad input or output format" );
}
if ( !AOUT_FMTS_SIMILAR( &p_filter->input, &p_filter->output ) )
switch( p_dec->fmt_in.i_codec )
{
- case VLC_FOURCC('s','u','b','t'):
- case VLC_FOURCC('s','s','a',' '):
- case VLC_FOURCC('t','1','4','0'):
+ case VLC_CODEC_SUBT:
+ case VLC_CODEC_SSA:
+ case VLC_CODEC_ITU_T140:
break;
default:
return VLC_EGENERIC;
char *psz_charset = NULL;
/* First try demux-specified encoding */
- if( p_dec->fmt_in.i_codec == VLC_FOURCC('t','1','4','0') )
+ if( p_dec->fmt_in.i_codec == VLC_CODEC_ITU_T140 )
psz_charset = strdup( "UTF-8" ); /* IUT T.140 is always using UTF-8 */
else
if( p_dec->fmt_in.subs.psz_encoding && *p_dec->fmt_in.subs.psz_encoding )
{
psz_charset = strdup (p_dec->fmt_in.subs.psz_encoding);
msg_Dbg (p_dec, "trying demuxer-specified character encoding: %s",
- p_dec->fmt_in.subs.psz_encoding ?: "not specified");
+ p_dec->fmt_in.subs.psz_encoding ?
+ p_dec->fmt_in.subs.psz_encoding : "not specified");
}
/* Second, try configured encoding */
{
psz_charset = var_CreateGetNonEmptyString (p_dec, "subsdec-encoding");
msg_Dbg (p_dec, "trying configured character encoding: %s",
- psz_charset ?: "not specified");
+ psz_charset ? psz_charset : "not specified");
}
/* Third, try "local" encoding with optional UTF-8 autodetection */
{
psz_charset = strdup (GetFallbackEncoding ());
msg_Dbg (p_dec, "trying default character encoding: %s",
- psz_charset ?: "not specified");
+ psz_charset ? psz_charset : "not specified");
if (var_CreateGetBool (p_dec, "subsdec-autodetect-utf8"))
{
var_Get( p_dec, "subsdec-align", &val );
p_sys->i_align = val.i_int;
- if( p_dec->fmt_in.i_codec == VLC_FOURCC('s','s','a',' ')
+ if( p_dec->fmt_in.i_codec == VLC_CODEC_SSA
&& var_CreateGetBool( p_dec, "subsdec-formatted" ) )
{
if( p_dec->fmt_in.i_extra > 0 )
/* Create a new subpicture region */
memset( &fmt, 0, sizeof(video_format_t) );
- fmt.i_chroma = VLC_FOURCC('T','E','X','T');
+ fmt.i_chroma = VLC_CODEC_TEXT;
fmt.i_aspect = 0;
fmt.i_width = fmt.i_height = 0;
fmt.i_x_offset = fmt.i_y_offset = 0;
}
/* Decode and format the subpicture unit */
- if( p_dec->fmt_in.i_codec != VLC_FOURCC('s','s','a',' ') )
+ if( p_dec->fmt_in.i_codec != VLC_CODEC_SSA )
{
/* Normal text subs, easy markup */
p_spu->p_region->i_align = SUBPICTURE_ALIGN_BOTTOM | p_sys->i_align;
#define FOURCC_TEXT N_("FOURCC code of raw input format")
#define FOURCC_LONGTEXT N_( \
- "FOURCC code of the raw input format. This is a four character string. Default is s16l." )
+ "FOURCC code of the raw input format. This is a four character string." )
#define LANG_TEXT N_("Forces the audio language.")
#define LANG_LONGTEXT N_("Forces the audio language for the output mux. Three letter ISO639 code. Default is 'eng'. ")
+ #ifdef WORDS_BIGENDIAN
+ # define FOURCC_DEFAULT "s16b"
+ #else
+ # define FOURCC_DEFAULT "s16l"
+ #endif
+
vlc_module_begin();
set_shortname( "Raw Audio" );
set_description( N_("Raw audio demuxer") );
add_shortcut( "rawaud" );
add_integer( "rawaud-channels", 2, 0, CHANNELS_TEXT, CHANNELS_LONGTEXT, false );
add_integer( "rawaud-samplerate", 48000, 0, SAMPLERATE_TEXT, SAMPLERATE_LONGTEXT, false );
- add_string( "rawaud-fourcc", "s16l", NULL, FOURCC_TEXT, FOURCC_LONGTEXT, false );
+ add_string( "rawaud-fourcc", FOURCC_DEFAULT, NULL,
+ FOURCC_TEXT, FOURCC_LONGTEXT, false );
add_string( "rawaud-lang", "eng", NULL, LANG_TEXT, LANG_LONGTEXT, false);
vlc_module_end();
es_format_Init( &p_sys->fmt, AUDIO_ES, 0 );
char *psz_fourcc = var_CreateGetString( p_demux, "rawaud-fourcc" );
+ p_sys->fmt.i_codec = vlc_fourcc_GetCodecFromString( AUDIO_ES, psz_fourcc );
+ free( psz_fourcc );
- if( ( psz_fourcc == NULL ? 0 : strlen( psz_fourcc ) ) != 4 )
+ if( !p_sys->fmt.i_codec )
{
msg_Err( p_demux, "rawaud-fourcc must be a 4 character string");
- free( psz_fourcc );
es_format_Clean( &p_sys->fmt );
free( p_sys );
return VLC_EGENERIC;
}
- p_sys->fmt.i_codec = VLC_FOURCC( psz_fourcc[0], psz_fourcc[1],
- psz_fourcc[2], psz_fourcc[3] );
-
- free( psz_fourcc );
// get the bits per sample ratio based on codec
switch( p_sys->fmt.i_codec )
{
- case VLC_FOURCC( 'f', 'l', '6', '4' ):
+ case VLC_CODEC_FL64:
p_sys->fmt.audio.i_bitspersample = 64;
break;
- case VLC_FOURCC( 'f', 'l', '3', '2' ):
- case VLC_FOURCC( 's', '3', '2', 'l' ):
- case VLC_FOURCC( 's', '3', '2', 'b' ):
- case VLC_FOURCC( 'i', 'n', '3', '2' ):
+ case VLC_CODEC_FL32:
+ case VLC_CODEC_S32L:
+ case VLC_CODEC_S32B:
p_sys->fmt.audio.i_bitspersample = 32;
break;
- case VLC_FOURCC( 's', '2', '4', 'l' ):
- case VLC_FOURCC( 's', '2', '4', 'b' ):
- case VLC_FOURCC( 'i', 'n', '2', '4' ):
- case VLC_FOURCC( '4', '2', 'n', 'i' ):
+ case VLC_CODEC_S24L:
+ case VLC_CODEC_S24B:
p_sys->fmt.audio.i_bitspersample = 24;
break;
- case VLC_FOURCC( 's', '1', '6', 'l' ):
- case VLC_FOURCC( 's', '1', '6', 'b' ):
+ case VLC_CODEC_S16L:
+ case VLC_CODEC_S16B:
p_sys->fmt.audio.i_bitspersample = 16;
break;
- case VLC_FOURCC( 's', '8', ' ', ' ' ):
- case VLC_FOURCC( 'u', '8', ' ', ' ' ):
+ case VLC_CODEC_S8:
+ case VLC_CODEC_U8:
p_sys->fmt.audio.i_bitspersample = 8;
break;
{
i_skip += 1;
}
- else if( pid->es->fmt.i_codec == VLC_FOURCC( 's', 'u', 'b', 't' ) &&
+ else if( pid->es->fmt.i_codec == VLC_CODEC_SUBT &&
pid->es->p_mpeg4desc )
{
decoder_config_descriptor_t *dcd = &pid->es->p_mpeg4desc->dec_descr;
i_skip += 2;
}
#ifdef ZVBI_COMPILED
- else if( pid->es->fmt.i_codec == VLC_FOURCC( 't', 'e', 'l', 'x' ) )
+ else if( pid->es->fmt.i_codec == VLC_CODEC_TELETEXT )
i_skip = 0; /*hack for zvbi support */
#endif
/* skip header */
p_pes->i_length = i_length * 100 / 9;
p_block = block_ChainGather( p_pes );
- if( pid->es->fmt.i_codec == VLC_FOURCC( 's', 'u', 'b', 't' ) )
+ if( pid->es->fmt.i_codec == VLC_CODEC_SUBT )
{
if( i_pes_size > 0 && p_block->i_buffer > i_pes_size )
{
case 0x01: /* MPEG-1 video */
case 0x02: /* MPEG-2 video */
case 0x80: /* MPEG-2 MOTO video */
- es_format_Init( fmt, VIDEO_ES, VLC_FOURCC( 'm', 'p', 'g', 'v' ) );
+ es_format_Init( fmt, VIDEO_ES, VLC_CODEC_MPGV );
break;
case 0x03: /* MPEG-1 audio */
case 0x04: /* MPEG-2 audio */
- es_format_Init( fmt, AUDIO_ES, VLC_FOURCC( 'm', 'p', 'g', 'a' ) );
+ es_format_Init( fmt, AUDIO_ES, VLC_CODEC_MPGA );
break;
case 0x11: /* MPEG4 (audio) */
case 0x0f: /* ISO/IEC 13818-7 Audio with ADTS transport syntax */
- es_format_Init( fmt, AUDIO_ES, VLC_FOURCC( 'm', 'p', '4', 'a' ) );
+ es_format_Init( fmt, AUDIO_ES, VLC_CODEC_MP4A );
break;
case 0x10: /* MPEG4 (video) */
- es_format_Init( fmt, VIDEO_ES, VLC_FOURCC( 'm', 'p', '4', 'v' ) );
+ es_format_Init( fmt, VIDEO_ES, VLC_CODEC_MP4V );
pid->es->b_gather = true;
break;
case 0x1B: /* H264 <- check transport syntax/needed descriptor */
- es_format_Init( fmt, VIDEO_ES, VLC_FOURCC( 'h', '2', '6', '4' ) );
+ es_format_Init( fmt, VIDEO_ES, VLC_CODEC_H264 );
break;
case 0x81: /* A52 (audio) */
- es_format_Init( fmt, AUDIO_ES, VLC_FOURCC( 'a', '5', '2', ' ' ) );
+ es_format_Init( fmt, AUDIO_ES, VLC_CODEC_A52 );
break;
case 0x82: /* DVD_SPU (sub) */
- es_format_Init( fmt, SPU_ES, VLC_FOURCC( 's', 'p', 'u', ' ' ) );
+ es_format_Init( fmt, SPU_ES, VLC_CODEC_SPU );
break;
case 0x83: /* LPCM (audio) */
- es_format_Init( fmt, AUDIO_ES, VLC_FOURCC( 'l', 'p', 'c', 'm' ) );
+ es_format_Init( fmt, AUDIO_ES, VLC_CODEC_DVD_LPCM );
break;
case 0x84: /* SDDS (audio) */
- es_format_Init( fmt, AUDIO_ES, VLC_FOURCC( 's', 'd', 'd', 's' ) );
+ es_format_Init( fmt, AUDIO_ES, VLC_CODEC_SDDS );
break;
case 0x85: /* DTS (audio) */
- es_format_Init( fmt, AUDIO_ES, VLC_FOURCC( 'd', 't', 's', ' ' ) );
+ es_format_Init( fmt, AUDIO_ES, VLC_CODEC_DTS );
break;
case 0x91: /* A52 vls (audio) */
{
case 0x0B: /* mpeg4 sub */
p_fmt->i_cat = SPU_ES;
- p_fmt->i_codec = VLC_FOURCC('s','u','b','t');
+ p_fmt->i_codec = VLC_CODEC_SUBT;
break;
case 0x20: /* mpeg4 */
- p_fmt->i_codec = VLC_FOURCC('m','p','4','v');
+ p_fmt->i_codec = VLC_CODEC_MP4V;
break;
case 0x21: /* h264 */
- p_fmt->i_codec = VLC_FOURCC('h','2','6','4');
+ p_fmt->i_codec = VLC_CODEC_H264;
break;
case 0x60:
case 0x61:
case 0x63:
case 0x64:
case 0x65: /* mpeg2 */
- p_fmt->i_codec = VLC_FOURCC( 'm','p','g','v' );
+ p_fmt->i_codec = VLC_CODEC_MPGV;
break;
case 0x6a: /* mpeg1 */
- p_fmt->i_codec = VLC_FOURCC( 'm','p','g','v' );
+ p_fmt->i_codec = VLC_CODEC_MPGV;
break;
case 0x6c: /* mpeg1 */
- p_fmt->i_codec = VLC_FOURCC( 'j','p','e','g' );
+ p_fmt->i_codec = VLC_CODEC_JPEG;
break;
default:
p_fmt->i_cat = UNKNOWN_ES;
switch( dcd->i_objectTypeIndication )
{
case 0x40: /* mpeg4 */
- p_fmt->i_codec = VLC_FOURCC('m','p','4','a');
+ p_fmt->i_codec = VLC_CODEC_MP4A;
break;
case 0x66:
case 0x67:
case 0x68: /* mpeg2 aac */
- p_fmt->i_codec = VLC_FOURCC('m','p','4','a');
+ p_fmt->i_codec = VLC_CODEC_MP4A;
break;
case 0x69: /* mpeg2 */
- p_fmt->i_codec = VLC_FOURCC('m','p','g','a');
+ p_fmt->i_codec = VLC_CODEC_MPGA;
break;
case 0x6b: /* mpeg1 */
- p_fmt->i_codec = VLC_FOURCC('m','p','g','a');
+ p_fmt->i_codec = VLC_CODEC_MPGA;
break;
default:
p_fmt->i_cat = UNKNOWN_ES;
ts_teletext_page_t *p_dst = &p_page[i_page++];
p_dst->i_type = p_src->i_teletext_type;
- p_dst->i_magazine = p_src->i_teletext_magazine_number ? : 8;
+ p_dst->i_magazine = p_src->i_teletext_magazine_number
+ ? p_src->i_teletext_magazine_number : 8;
p_dst->i_page = p_src->i_teletext_page_number;
memcpy( p_dst->p_iso639, p_src->i_iso6392_language_code, 3 );
}
break;
}
/* FIXME check if it is the right split */
- p_dst->i_magazine = (p_src->i_composition_page_id >> 8) ? : 8;
+ p_dst->i_magazine = (p_src->i_composition_page_id >> 8)
+ ? (p_src->i_composition_page_id >> 8) : 8;
p_dst->i_page = p_src->i_composition_page_id & 0xff;
memcpy( p_dst->p_iso639, p_src->i_iso6392_language_code, 3 );
}
#endif
/* */
- es_format_Init( p_fmt, SPU_ES, VLC_FOURCC( 't', 'e', 'l', 'x' ) );
+ es_format_Init( p_fmt, SPU_ES, VLC_CODEC_TELETEXT );
/* In stream output mode, do not separate the stream by page */
if( p_demux->out->b_sout || i_page <= 0 )
{
es_format_t *p_fmt = &pid->es->fmt;
- es_format_Init( p_fmt, SPU_ES, VLC_FOURCC( 'd', 'v', 'b', 's' ) );
+ es_format_Init( p_fmt, SPU_ES, VLC_CODEC_DVBS );
dvbpsi_descriptor_t *p_dr = PMTEsFindDescriptor( p_es, 0x59 );
int i_page = 0;
PMTEsFindDescriptor( p_es, 0x81 ) )
{
p_fmt->i_cat = AUDIO_ES;
- p_fmt->i_codec = VLC_FOURCC('a','5','2',' ');
+ p_fmt->i_codec = VLC_CODEC_A52;
}
else if( PMTEsFindDescriptor( p_es, 0x7a ) )
{
/* DVB with stream_type 0x06 (ETS EN 300 468) */
p_fmt->i_cat = AUDIO_ES;
- p_fmt->i_codec = VLC_FOURCC( 'e', 'a', 'c', '3' );
+ p_fmt->i_codec = VLC_CODEC_EAC3;
}
else if( PMTEsHasRegistration( p_demux, p_es, "DTS1" ) ||
PMTEsHasRegistration( p_demux, p_es, "DTS2" ) ||
{
/*registration descriptor(ETSI TS 101 154 Annex F)*/
p_fmt->i_cat = AUDIO_ES;
- p_fmt->i_codec = VLC_FOURCC('d','t','s',' ');
+ p_fmt->i_codec = VLC_CODEC_DTS;
}
else if( PMTEsHasRegistration( p_demux, p_es, "BSSD" ) )
{
p_fmt->i_cat = AUDIO_ES;
p_fmt->b_packetized = true;
- p_fmt->i_codec = VLC_FOURCC('a','e','s','3');
+ p_fmt->i_codec = VLC_CODEC_302M;
}
else
{
/* registration descriptor for VC-1 (SMPTE rp227) */
p_fmt->i_cat = VIDEO_ES;
- p_fmt->i_codec = VLC_FOURCC('W','V','C','1');
+ p_fmt->i_codec = VLC_CODEC_VC1;
/* XXX With Simple and Main profile the SEQUENCE
* header is modified: video width and height are
/* registration descriptor for Dirac
* (backwards compatable with VC-2 (SMPTE Sxxxx:2008)) */
p_fmt->i_cat = VIDEO_ES;
- p_fmt->i_codec = VLC_FOURCC('d','r','a','c');
+ p_fmt->i_codec = VLC_CODEC_DIRAC;
}
static void PMTSetupEs0xA0( demux_t *p_demux, ts_pid_t *pid,
{
case 0x80:
p_fmt->i_cat = AUDIO_ES;
- p_fmt->i_codec = VLC_FOURCC( 'b', 'p', 'c', 'm' );
+ p_fmt->i_codec = VLC_CODEC_BD_LPCM;
break;
case 0x82:
case 0x85: /* DTS-HD High resolution audio */
case 0x86: /* DTS-HD Master audio */
case 0xA2: /* Secondary DTS audio */
p_fmt->i_cat = AUDIO_ES;
- p_fmt->i_codec = VLC_FOURCC( 'd', 't', 's', ' ' );
+ p_fmt->i_codec = VLC_CODEC_DTS;
break;
case 0x83: /* TrueHD AC3 */
p_fmt->i_cat = AUDIO_ES;
- p_fmt->i_codec = VLC_FOURCC( 'm', 'l', 'p', ' ' );
+ p_fmt->i_codec = VLC_CODEC_MLP;
break;
case 0x84: /* E-AC3 */
case 0x87: /* E-AC3 */
case 0xA1: /* Secondary E-AC3 */
p_fmt->i_cat = AUDIO_ES;
- p_fmt->i_codec = VLC_FOURCC( 'e', 'a', 'c', '3' );
+ p_fmt->i_codec = VLC_CODEC_EAC3;
break;
case 0x90: /* Presentation graphics */
case 0x91: /* Interactive graphics */
if( pid->es->fmt.i_cat == AUDIO_ES ||
( pid->es->fmt.i_cat == SPU_ES &&
- pid->es->fmt.i_codec != VLC_FOURCC('d','v','b','s') &&
- pid->es->fmt.i_codec != VLC_FOURCC('t','e','l','x') ) )
+ pid->es->fmt.i_codec != VLC_CODEC_DVBS &&
+ pid->es->fmt.i_codec != VLC_CODEC_TELETEXT ) )
{
PMTParseEsIso639( p_demux, pid, p_es );
}
cryptedLabel = NULL;
controls = NULL;
inputC = NULL;
+ b_shouldHide = false;
bgWasVisible = false;
i_bg_height = 0;
/* Final sizing and showing */
setMinimumWidth( __MAX( controls->sizeHint().width(),
menuBar()->sizeHint().width() ) );
- show();
+ setVisible( !b_shouldHide );
/* And switch to minimal view if needed
Must be called after the show() */
if( b_systrayAvailable )
{
b_systrayWanted = true;
- hide();
+ b_shouldHide = true;
}
else
msg_Err( p_intf, "cannot start minimized without system tray bar" );
videoIsActive = false;
/* Try to resize, except when you are in Fullscreen mode */
- if( !isFullScreen() ) doComponentsUpdate();
+ doComponentsUpdate();
}
/* Call from WindowControl function */
pl_dock_e i_pl_dock;
bool isDocked() { return ( i_pl_dock != PL_UNDOCKED ); }
int i_bg_height; ///< Save height of bgWidget
+ bool b_shouldHide;
/* Status Bar */
QLabel *nameLabel;
void askReleaseVideo( );
void askVideoToResize( unsigned int, unsigned int );
void askVideoToShow( unsigned int, unsigned int );
- void askVideoToToggle();
void askBgWidgetToToggle();
void askUpdate();
void minimalViewToggled( bool );
UPDATER_DAYS_TEXT, false )
#endif
add_string( "qt-slider-colours",
- "255;255;255;20;226;20;255;176;15;235;30;20",
+ "255;255;255;20;210;20;255;199;15;245;39;29",
NULL, SLIDERCOL_TEXT, SLIDERCOL_LONGTEXT, false )
add_bool( "qt-privacy-ask", true, NULL, PRIVACY_TEXT, PRIVACY_TEXT,
Q_INIT_RESOURCE( vlc );
-#if !defined(WIN32) && !defined(__APPLE__)
- /* KLUDGE:
- * disables icon theme use because that makes Cleanlooks style bug
- * because it asks gconf for some settings that timeout because of threads
- * see commits 21610 21622 21654 for reference */
-
- /* If you don't have a gconftool-2 binary, you should comment this line */
- if( strcmp( qVersion(), "4.4.0" ) < 0 ) /* fixed in Qt 4.4.0 */
- QApplication::setDesktopSettingsAware( false );
-#endif
-
/* Start the QApplication here */
#ifdef Q_WS_X11
char *display = var_CreateGetNonEmptyString( p_intf, "x11-display" );
RTSP_CMD_TYPE_FORWARD,
} rtsp_cmd_type_t;
+ /* */
+ typedef struct
+ {
+ int i_type;
+ int i_media_id;
+ //vod_media_t *p_media;
+ char *psz_session;
+ char *psz_arg;
+ double f_arg;
+ } rtsp_cmd_t;
+
static vod_media_t *MediaNew( vod_t *, const char *, input_item_t * );
static void MediaDel( vod_t *, vod_media_t * );
static int MediaAddES( vod_t *, vod_media_t *, es_format_t * );
{
vod_t *p_vod = (vod_t *)p_this;
vod_sys_t *p_sys = p_vod->p_sys;
+ block_t *p_block_cmd;
+ rtsp_cmd_t cmd;
/* Stop command thread */
vlc_object_kill( p_vod );
CommandPush( p_vod, RTSP_CMD_TYPE_NONE, NULL, NULL, 0.0, NULL );
vlc_thread_join( p_vod );
+ while( block_FifoCount( p_sys->p_fifo_cmd ) > 0 )
+ {
+ p_block_cmd = block_FifoGet( p_sys->p_fifo_cmd );
+ memcpy( &cmd, p_block_cmd->p_buffer, sizeof(cmd) );
+ block_Release( p_block_cmd );
+ free( cmd.psz_session );
+ free( cmd.psz_arg );
+ }
block_FifoRelease( p_sys->p_fifo_cmd );
httpd_HostDelete( p_sys->p_rtsp_host );
switch( p_fmt->i_codec )
{
- case VLC_FOURCC( 's', '1', '6', 'b' ):
+ case VLC_CODEC_S16B:
if( p_fmt->audio.i_channels == 1 && p_fmt->audio.i_rate == 44100 )
{
p_es->i_payload_type = 11;
p_fmt->audio.i_channels ) == -1 )
p_es->psz_rtpmap = NULL;
break;
- case VLC_FOURCC( 'u', '8', ' ', ' ' ):
+ case VLC_CODEC_U8:
p_es->i_payload_type = p_media->i_payload_type++;
if( asprintf( &p_es->psz_rtpmap, "L8/%d/%d", p_fmt->audio.i_rate,
p_fmt->audio.i_channels ) == -1 )
p_es->psz_rtpmap = NULL;
break;
- case VLC_FOURCC( 'm', 'p', 'g', 'a' ):
- case VLC_FOURCC( 'm', 'p', '3', ' ' ):
+ case VLC_CODEC_MPGA:
p_es->i_payload_type = 14;
p_es->psz_rtpmap = strdup( "MPA/90000" );
break;
- case VLC_FOURCC( 'm', 'p', 'g', 'v' ):
+ case VLC_CODEC_MPGV:
p_es->i_payload_type = 32;
p_es->psz_rtpmap = strdup( "MPV/90000" );
break;
- case VLC_FOURCC( 'a', '5', '2', ' ' ):
+ case VLC_CODEC_A52:
p_es->i_payload_type = p_media->i_payload_type++;
if( asprintf( &p_es->psz_rtpmap, "ac3/%d", p_fmt->audio.i_rate ) == -1 )
p_es->psz_rtpmap = NULL;
break;
- case VLC_FOURCC( 'H', '2', '6', '3' ):
+ case VLC_CODEC_H263:
p_es->i_payload_type = p_media->i_payload_type++;
p_es->psz_rtpmap = strdup( "H263-1998/90000" );
break;
- case VLC_FOURCC( 'h', '2', '6', '4' ):
+ case VLC_CODEC_H264:
p_es->i_payload_type = p_media->i_payload_type++;
p_es->psz_rtpmap = strdup( "H264/90000" );
p_es->psz_fmtp = NULL;
if( !p_es->psz_fmtp )
p_es->psz_fmtp = strdup( "packetization-mode=1" );
break;
- case VLC_FOURCC( 'm', 'p', '4', 'v' ):
+ case VLC_CODEC_MP4V:
p_es->i_payload_type = p_media->i_payload_type++;
p_es->psz_rtpmap = strdup( "MP4V-ES/90000" );
if( p_fmt->i_extra > 0 )
free( p_hexa );
}
break;
- case VLC_FOURCC( 'm', 'p', '4', 'a' ):
+ case VLC_CODEC_MP4A:
p_es->i_payload_type = p_media->i_payload_type++;
if( asprintf( &p_es->psz_rtpmap, "mpeg4-generic/%d", p_fmt->audio.i_rate ) == -1 )
p_es->psz_rtpmap = NULL;
p_es->i_payload_type = p_media->i_payload_type++;
p_es->psz_rtpmap = strdup( "MP2P/90000" );
break;
- case VLC_FOURCC( 's', 'a', 'm', 'r' ):
+ case VLC_CODEC_AMR_NB:
p_es->i_payload_type = p_media->i_payload_type++;
p_es->psz_rtpmap = strdup( p_fmt->audio.i_channels == 2 ?
"AMR/8000/2" : "AMR/8000" );
p_es->psz_fmtp = strdup( "octet-align=1" );
break;
- case VLC_FOURCC( 's', 'a', 'w', 'b' ):
+ case VLC_CODEC_AMR_WB:
p_es->i_payload_type = p_media->i_payload_type++;
p_es->psz_rtpmap = strdup( p_fmt->audio.i_channels == 2 ?
"AMR-WB/16000/2" : "AMR-WB/16000" );
free( p_es );
}
- /* */
- typedef struct
- {
- int i_type;
- int i_media_id;
- //vod_media_t *p_media;
- char *psz_session;
- char *psz_arg;
- double f_arg;
- } rtsp_cmd_t;
-
static void CommandPush( vod_t *p_vod, rtsp_cmd_type_t i_type, vod_media_t *p_media, const char *psz_session,
double f_arg, const char *psz_arg )
{
static int transcode_video_process( sout_stream_t *, sout_stream_id_t *,
block_t *, block_t ** );
-static void video_del_buffer( vlc_object_t *, picture_t * );
static picture_t *video_new_buffer_decoder( decoder_t * );
static void video_del_buffer_decoder( decoder_t *, picture_t * );
static void video_link_picture_decoder( decoder_t *, picture_t * );
static void video_unlink_picture_decoder( decoder_t *, picture_t * );
-static picture_t *video_new_buffer_filter( filter_t * );
-static void video_del_buffer_filter( filter_t *, picture_t * );
static int transcode_spu_new ( sout_stream_t *, sout_stream_id_t * );
static void transcode_spu_close ( sout_stream_id_t * );
struct decoder_owner_sys_t
{
- picture_t *pp_pics[PICTURE_RING_SIZE];
- sout_stream_sys_t *p_sys;
-};
-struct filter_owner_sys_t
-{
- picture_t *pp_pics[PICTURE_RING_SIZE];
sout_stream_sys_t *p_sys;
};
if( p_sys->i_acodec )
{
- if( p_sys->i_acodec == VLC_FOURCC('m','p','3',0) &&
- p_sys->i_channels > 2 )
+ if( ( p_sys->i_acodec == VLC_CODEC_MP3 ||
+ p_sys->i_acodec == VLC_CODEC_MPGA ) && p_sys->i_channels > 2 )
{
msg_Warn( p_stream, "%d channels invalid for mp3, forcing to 2",
p_sys->i_channels );
&p_sys->p_osd_cfg, strdup( "dvbsub") );
free( psz_next );
- p_sys->i_osdcodec = VLC_FOURCC('Y','U','V','P' );
+ p_sys->i_osdcodec = VLC_CODEC_YUVP;
msg_Dbg( p_stream, "codec osd=%4.4s", (char *)&p_sys->i_osdcodec );
p_dst->audio.i_rate );
/* If any filter is needed, convert to fl32 */
- if( current.i_codec != VLC_FOURCC('f','l','3','2') )
+ if( current.i_codec != VLC_CODEC_FL32 )
{
/* First step, convert to fl32 */
current.i_codec =
- current.audio.i_format = VLC_FOURCC('f','l','3','2');
+ current.audio.i_format = VLC_CODEC_FL32;
if( !filter_chain_AppendFilter( p_chain, NULL, NULL, NULL, ¤t ) )
{
aout_BitsPerSample( id->p_decoder->fmt_out.i_codec );
fmt_last = id->p_decoder->fmt_out;
/* Fix AAC SBR changing number of channels and sampling rate */
- if( !(id->p_decoder->fmt_in.i_codec == VLC_FOURCC('m','p','4','a') &&
+ if( !(id->p_decoder->fmt_in.i_codec == VLC_CODEC_MP4A &&
fmt_last.audio.i_rate != id->p_encoder->fmt_in.audio.i_rate &&
fmt_last.audio.i_channels != id->p_encoder->fmt_in.audio.i_channels) )
fmt_last.audio.i_rate = id->p_decoder->fmt_in.audio.i_rate;
{
es_format_t fmt_fl32 = fmt_last;
fmt_fl32.i_codec =
- fmt_fl32.audio.i_format = VLC_FOURCC('f','l','3','2');
+ fmt_fl32.audio.i_format = VLC_CODEC_FL32;
if( transcode_audio_filter_chain_build( p_stream, id->p_uf_chain,
&fmt_fl32, &fmt_last ) )
{
}
fmt_last = id->p_encoder->fmt_in;
- /* FIXME: Hack for mp3 transcoding support */
- if( id->p_encoder->fmt_out.i_codec == VLC_FOURCC( 'm','p','3',' ' ) )
- id->p_encoder->fmt_out.i_codec = VLC_FOURCC( 'm','p','g','a' );
+ /* */
+ id->p_encoder->fmt_out.i_codec =
+ vlc_fourcc_GetCodec( AUDIO_ES, id->p_encoder->fmt_out.i_codec );
return VLC_SUCCESS;
}
* video
*/
+static picture_t *transcode_video_filter_buffer_new( filter_t *p_filter )
+{
+ p_filter->fmt_out.video.i_chroma = p_filter->fmt_out.i_codec;
+ return picture_New( p_filter->fmt_out.video.i_chroma,
+ p_filter->fmt_out.video.i_width,
+ p_filter->fmt_out.video.i_height,
+ p_filter->fmt_out.video.i_aspect );
+}
+static void transcode_video_filter_buffer_del( filter_t *p_filter, picture_t *p_pic )
+{
+ VLC_UNUSED(p_filter);
+ picture_Release( p_pic );
+}
+
static int transcode_video_filter_allocation_init( filter_t *p_filter,
void *p_data )
{
- sout_stream_sys_t *p_sys = (sout_stream_sys_t*)p_data;
- int i;
-
- p_filter->pf_vout_buffer_new = video_new_buffer_filter;
- p_filter->pf_vout_buffer_del = video_del_buffer_filter;
-
- p_filter->p_owner = malloc( sizeof(filter_owner_sys_t) );
- if( !p_filter->p_owner )
- return VLC_EGENERIC;
-
- for( i = 0; i < PICTURE_RING_SIZE; i++ )
- p_filter->p_owner->pp_pics[i] = 0;
- p_filter->p_owner->p_sys = p_sys;
-
+ p_filter->pf_vout_buffer_new = transcode_video_filter_buffer_new;
+ p_filter->pf_vout_buffer_del = transcode_video_filter_buffer_del;
return VLC_SUCCESS;
}
static void transcode_video_filter_allocation_clear( filter_t *p_filter )
{
- int j;
-
- /* Clean-up pictures ring buffer */
- for( j = 0; j < PICTURE_RING_SIZE; j++ )
- {
- if( p_filter->p_owner->pp_pics[j] )
- video_del_buffer( VLC_OBJECT(p_filter),
- p_filter->p_owner->pp_pics[j] );
- }
- free( p_filter->p_owner );
}
static int transcode_video_new( sout_stream_t *p_stream, sout_stream_id_t *id )
{
sout_stream_sys_t *p_sys = p_stream->p_sys;
- int i;
/* Open decoder
* Initialization of decoder structures
if( !id->p_decoder->p_owner )
return VLC_EGENERIC;
- for( i = 0; i < PICTURE_RING_SIZE; i++ )
- id->p_decoder->p_owner->pp_pics[i] = 0;
id->p_decoder->p_owner->p_sys = p_sys;
/* id->p_decoder->p_cfg = p_sys->p_video_cfg; */
/* The dimensions will be set properly later on.
* Just put sensible values so we can test an encoder is available. */
id->p_encoder->fmt_in.video.i_width =
- id->p_encoder->fmt_out.video.i_width ?:
- id->p_decoder->fmt_in.video.i_width ?: 16;
+ id->p_encoder->fmt_out.video.i_width
+ ? id->p_encoder->fmt_out.video.i_width
+ : id->p_decoder->fmt_in.video.i_width
+ ? id->p_decoder->fmt_in.video.i_width : 16;
id->p_encoder->fmt_in.video.i_height =
- id->p_encoder->fmt_out.video.i_height ?:
- id->p_decoder->fmt_in.video.i_height ?: 16;
+ id->p_encoder->fmt_out.video.i_height
+ ? id->p_encoder->fmt_out.video.i_height
+ : id->p_decoder->fmt_in.video.i_height
+ ? id->p_decoder->fmt_in.video.i_height : 16;
id->p_encoder->fmt_in.video.i_frame_rate = ENC_FRAMERATE;
id->p_encoder->fmt_in.video.i_frame_rate_base = ENC_FRAMERATE_BASE;
id->p_encoder->fmt_in.video.i_chroma = id->p_encoder->fmt_in.i_codec;
- /* Hack for mp2v/mp1v transcoding support */
- if( id->p_encoder->fmt_out.i_codec == VLC_FOURCC('m','p','1','v') ||
- id->p_encoder->fmt_out.i_codec == VLC_FOURCC('m','p','2','v') )
- {
- id->p_encoder->fmt_out.i_codec = VLC_FOURCC('m','p','g','v');
- }
+ /* */
+ id->p_encoder->fmt_out.i_codec =
+ vlc_fourcc_GetCodec( VIDEO_ES, id->p_encoder->fmt_out.i_codec );
id->id = sout_StreamIdAdd( p_stream->p_sys->p_out,
&id->p_encoder->fmt_out );
static void transcode_video_close( sout_stream_t *p_stream,
sout_stream_id_t *id )
{
- int i;
-
if( p_stream->p_sys->i_threads >= 1 )
{
vlc_mutex_lock( &p_stream->p_sys->lock_out );
if( id->p_decoder->p_description )
vlc_meta_Delete( id->p_decoder->p_description );
- if( id->p_decoder->p_owner )
- {
- /* Clean-up pictures ring buffer */
- for( i = 0; i < PICTURE_RING_SIZE; i++ )
- {
- if( id->p_decoder->p_owner->pp_pics[i] )
- video_del_buffer( VLC_OBJECT(id->p_decoder),
- id->p_decoder->p_owner->pp_pics[i] );
- }
- free( id->p_decoder->p_owner );
- }
+ free( id->p_decoder->p_owner );
/* Close encoder */
if( id->p_encoder->p_module )
{
msg_Dbg( p_stream, "late picture skipped (%"PRId64")",
current_date + 50000 - p_pic->date );
- p_pic->pf_release( p_pic );
+ picture_Release( p_pic );
continue;
}
}
msg_Dbg( p_stream, "dropping frame (%i)",
(int)(i_video_drift - i_master_drift) );
#endif
- p_pic->pf_release( p_pic );
+ picture_Release( p_pic );
continue;
}
else if( i_video_drift > (i_master_drift + 50000) )
if( transcode_video_encoder_open( p_stream, id ) != VLC_SUCCESS )
{
- p_pic->pf_release( p_pic );
+ picture_Release( p_pic );
transcode_video_close( p_stream, id );
id->b_transcode = false;
return VLC_EGENERIC;
{
video_format_t fmt;
- if( p_pic->i_refcount && !filter_chain_GetLength( id->p_f_chain ) )
+ if( picture_IsReferenced( p_pic ) && !filter_chain_GetLength( id->p_f_chain ) )
{
/* We can't modify the picture, we need to duplicate it */
picture_t *p_tmp = video_new_buffer_decoder( id->p_decoder );
if( p_tmp )
{
picture_Copy( p_tmp, p_pic );
- p_pic->pf_release( p_pic );
+ picture_Release( p_pic );
p_pic = p_tmp;
}
}
if( p_sys->i_threads == 0 )
{
- p_pic->pf_release( p_pic );
+ picture_Release( p_pic );
}
else
{
block_ChainAppend( &p_sys->p_buffers, p_block );
vlc_mutex_unlock( &p_sys->lock_out );
- p_pic->pf_release( p_pic );
+ picture_Release( p_pic );
}
while( p_sys->i_last_pic != p_sys->i_first_pic )
{
p_pic = p_sys->pp_pics[p_sys->i_first_pic++];
p_sys->i_first_pic %= PICTURE_RING_SIZE;
- p_pic->pf_release( p_pic );
+ picture_Release( p_pic );
}
block_ChainRelease( p_sys->p_buffers );
return NULL;
}
-struct picture_sys_t
-{
- vlc_object_t *p_owner;
-};
-
-static void video_release_buffer( picture_t *p_pic )
+static picture_t *video_new_buffer_decoder( decoder_t *p_dec )
{
- if( p_pic && !p_pic->i_refcount && p_pic->pf_release && p_pic->p_sys )
+ sout_stream_sys_t *p_ssys = p_dec->p_owner->p_sys;
+ if( p_ssys->i_threads >= 1 )
{
- video_del_buffer_decoder( (decoder_t *)p_pic->p_sys->p_owner, p_pic );
- }
- else if( p_pic && p_pic->i_refcount > 0 ) p_pic->i_refcount--;
-}
-
-static picture_t *video_new_buffer( vlc_object_t *p_this, picture_t **pp_ring,
- sout_stream_sys_t *p_sys )
-{
- decoder_t *p_dec = (decoder_t *)p_this;
- picture_t *p_pic;
- int i;
+ int i_first_pic = p_ssys->i_first_pic;
- /* Find an empty space in the picture ring buffer */
- for( i = 0; i < PICTURE_RING_SIZE; i++ )
- {
- if( pp_ring[i] != NULL && pp_ring[i]->i_status == DESTROYED_PICTURE )
- {
- pp_ring[i]->i_status = RESERVED_PICTURE;
- return pp_ring[i];
- }
- }
- for( i = 0; i < PICTURE_RING_SIZE; i++ )
- {
- if( pp_ring[i] == NULL ) break;
- }
-
- if( i == PICTURE_RING_SIZE && p_sys->i_threads >= 1 )
- {
- int i_first_pic = p_sys->i_first_pic;
-
- if( p_sys->i_first_pic != p_sys->i_last_pic )
+ if( p_ssys->i_first_pic != p_ssys->i_last_pic )
{
/* Encoder still has stuff to encode, wait to clear-up the list */
- while( p_sys->i_first_pic == i_first_pic )
+ while( p_ssys->i_first_pic == i_first_pic )
msleep( 100000 );
}
-
- /* Find an empty space in the picture ring buffer */
- for( i = 0; i < PICTURE_RING_SIZE; i++ )
- {
- if( pp_ring[i] != NULL && pp_ring[i]->i_status == DESTROYED_PICTURE )
- {
- pp_ring[i]->i_status = RESERVED_PICTURE;
- return pp_ring[i];
- }
- }
- for( i = 0; i < PICTURE_RING_SIZE; i++ )
- {
- if( pp_ring[i] == NULL ) break;
- }
- }
-
- if( i == PICTURE_RING_SIZE )
- {
- msg_Err( p_this, "decoder/filter is leaking pictures, "
- "resetting its ring buffer" );
-
- for( i = 0; i < PICTURE_RING_SIZE; i++ )
- {
- pp_ring[i]->pf_release( pp_ring[i] );
- }
-
- i = 0;
}
p_dec->fmt_out.video.i_chroma = p_dec->fmt_out.i_codec;
- p_pic = picture_New( p_dec->fmt_out.video.i_chroma,
- p_dec->fmt_out.video.i_width,
- p_dec->fmt_out.video.i_height,
- p_dec->fmt_out.video.i_aspect );
- if( !p_pic ) return NULL;
- p_pic->p_sys = calloc( 1, sizeof(picture_sys_t) );
- if( !p_pic->p_sys )
- {
- picture_Release( p_pic );
- return NULL;
- }
- p_pic->pf_release = video_release_buffer;
- p_pic->i_refcount = 0;
-
- pp_ring[i] = p_pic;
- return p_pic;
-}
-
-static picture_t *video_new_buffer_decoder( decoder_t *p_dec )
-{
- return video_new_buffer( VLC_OBJECT(p_dec),
- p_dec->p_owner->pp_pics, p_dec->p_owner->p_sys );
-}
-
-static picture_t *video_new_buffer_filter( filter_t *p_filter )
-{
- return video_new_buffer( VLC_OBJECT(p_filter),
- p_filter->p_owner->pp_pics,
- p_filter->p_owner->p_sys );
-}
-
-static void video_del_buffer( vlc_object_t *p_this, picture_t *p_pic )
-{
- VLC_UNUSED(p_this);
- if( p_pic )
- {
- free( p_pic->p_q );
- free( p_pic->p_data_orig );
- free( p_pic->p_sys );
- free( p_pic );
- }
+ return picture_New( p_dec->fmt_out.video.i_chroma,
+ p_dec->fmt_out.video.i_width,
+ p_dec->fmt_out.video.i_height,
+ p_dec->fmt_out.video.i_aspect );
}
static void video_del_buffer_decoder( decoder_t *p_decoder, picture_t *p_pic )
{
VLC_UNUSED(p_decoder);
- p_pic->i_refcount = 0;
- p_pic->i_status = DESTROYED_PICTURE;
- picture_CleanupQuant( p_pic );
-}
-
-static void video_del_buffer_filter( filter_t *p_filter, picture_t *p_pic )
-{
- VLC_UNUSED(p_filter);
- p_pic->i_refcount = 0;
- p_pic->i_status = DESTROYED_PICTURE;
- picture_CleanupQuant( p_pic );
+ picture_Release( p_pic );
}
static void video_link_picture_decoder( decoder_t *p_dec, picture_t *p_pic )
{
VLC_UNUSED(p_dec);
- p_pic->i_refcount++;
+ picture_Hold( p_pic );
}
static void video_unlink_picture_decoder( decoder_t *p_dec, picture_t *p_pic )
{
VLC_UNUSED(p_dec);
- video_release_buffer( p_pic );
+ picture_Release( p_pic );
}
/*
/* Open encoder */
es_format_Init( &id->p_encoder->fmt_in, id->p_decoder->fmt_in.i_cat,
- VLC_FOURCC('Y','U','V','A') );
+ VLC_CODEC_YUVA );
id->p_encoder->fmt_in.psz_language = strdup( "osd" );
id->p_encoder->p_cfg = p_sys->p_osd_cfg;
#include <vlc_common.h>
#include <vlc_plugin.h>
#include <vlc_sout.h>
-#include <vlc_vout.h>
#include "vlc_filter.h"
#include "filter_picture.h"
*****************************************************************************/
struct filter_sys_t
{
+ vlc_mutex_t lock;
double f_contrast;
double f_brightness;
int i_hue;
p_sys->b_brightness_threshold =
var_CreateGetBoolCommand( p_filter, "brightness-threshold" );
+ vlc_mutex_init( &p_sys->lock );
var_AddCallback( p_filter, "contrast", AdjustCallback, p_sys );
var_AddCallback( p_filter, "brightness", AdjustCallback, p_sys );
var_AddCallback( p_filter, "hue", AdjustCallback, p_sys );
var_DelCallback( p_filter, "brightness-threshold",
AdjustCallback, p_sys );
+ vlc_mutex_destroy( &p_sys->lock );
free( p_sys );
}
return NULL;
}
- /* Getvariables */
+ /* Get variables */
+ vlc_mutex_lock( &p_sys->lock );
i_cont = (int)( p_sys->f_contrast * 255 );
i_lum = (int)( (p_sys->f_brightness - 1.0)*255 );
f_hue = (float)( p_sys->i_hue * M_PI / 180 );
i_sat = (int)( p_sys->f_saturation * 256 );
f_gamma = 1.0 / p_sys->f_gamma;
b_thres = p_sys->b_brightness_threshold;
+ vlc_mutex_unlock( &p_sys->lock );
/*
* Threshold mode drops out everything about luma, contrast and gamma.
return NULL;
}
- p_outpic = p_filter->pf_vout_buffer_new( p_filter );
+ p_outpic = filter_NewPicture( p_filter );
if( !p_outpic )
{
msg_Warn( p_filter, "can't get output picture" );
return NULL;
}
- /* Getvariables */
+ /* Get variables */
+ vlc_mutex_lock( &p_sys->lock );
i_cont = (int)( p_sys->f_contrast * 255 );
i_lum = (int)( (p_sys->f_brightness - 1.0)*255 );
f_hue = (float)( p_sys->i_hue * M_PI / 180 );
i_sat = (int)( p_sys->f_saturation * 256 );
f_gamma = 1.0 / p_sys->f_gamma;
b_thres = p_sys->b_brightness_threshold;
+ vlc_mutex_unlock( &p_sys->lock );
/*
* Threshold mode drops out everything about luma, contrast and gamma.
VLC_UNUSED(p_this); VLC_UNUSED(oldval);
filter_sys_t *p_sys = (filter_sys_t *)p_data;
+ vlc_mutex_lock( &p_sys->lock );
if( !strcmp( psz_var, "contrast" ) )
p_sys->f_contrast = newval.f_float;
else if( !strcmp( psz_var, "brightness" ) )
p_sys->f_gamma = newval.f_float;
else if( !strcmp( psz_var, "brightness-threshold" ) )
p_sys->b_brightness_threshold = newval.b_bool;
- else
- return VLC_EGENERIC;
+ vlc_mutex_unlock( &p_sys->lock );
+
return VLC_SUCCESS;
}
#include <vlc_common.h>
#include <vlc_plugin.h>
-#include <vlc_vout.h>
#include <vlc_image.h>
#include <vlc_filter.h>
filter_sys_t *p_sys;
char *psz_string;
- if( p_filter->fmt_in.video.i_chroma != VLC_FOURCC('Y','U','V','A') )
+ if( p_filter->fmt_in.video.i_chroma != VLC_CODEC_YUVA )
{
msg_Err( p_filter,
"Unsupported input chroma \"%4s\". "
config_ChainParse( p_filter, CFG_PREFIX, ppsz_filter_options,
p_filter->p_cfg );
- vlc_mutex_init( &p_sys->mask_lock );
- psz_string =
- var_CreateGetStringCommand( p_filter, CFG_PREFIX "mask" );
- var_AddCallback( p_filter, CFG_PREFIX "mask", MaskCallback,
- p_filter );
p_sys->p_mask = NULL;
if( psz_string && *psz_string )
{
}
free( psz_string );
+ vlc_mutex_init( &p_sys->mask_lock );
+ psz_string =
+ var_CreateGetStringCommand( p_filter, CFG_PREFIX "mask" );
+ var_AddCallback( p_filter, CFG_PREFIX "mask", MaskCallback,
+ p_filter );
p_filter->pf_video_filter = Filter;
return VLC_SUCCESS;
video_format_t fmt_in, fmt_out;
memset( &fmt_in, 0, sizeof( video_format_t ) );
memset( &fmt_out, 0, sizeof( video_format_t ) );
- fmt_out.i_chroma = VLC_FOURCC('Y','U','V','A');
+ fmt_out.i_chroma = VLC_CODEC_YUVA;
if( p_filter->p_sys->p_mask )
picture_Release( p_filter->p_sys->p_mask );
p_image = image_HandlerCreate( p_filter );
#include <vlc_common.h>
#include <vlc_plugin.h>
-#include <vlc_vout.h>
#include "vlc_filter.h"
struct filter_sys_t
{
+ vlc_mutex_t lock;
int i_u, i_v, i_ut, i_vt;
uint8_t *p_at;
};
filter_t *p_filter = (filter_t *)p_this;
filter_sys_t *p_sys;
- if( p_filter->fmt_in.video.i_chroma != VLC_FOURCC('Y','U','V','A') )
+ if( p_filter->fmt_in.video.i_chroma != VLC_CODEC_YUVA )
{
msg_Err( p_filter,
"Unsupported input chroma \"%4s\". "
config_ChainParse( p_filter, CFG_PREFIX, ppsz_filter_options,
p_filter->p_cfg );
+ int val;
+ vlc_mutex_init( &p_sys->lock );
#define GET_VAR( name, min, max ) \
- p_sys->i_##name = __MIN( max, __MAX( min, \
- var_CreateGetIntegerCommand( p_filter, CFG_PREFIX #name ) ) ); \
+ val = var_CreateGetIntegerCommand( p_filter, CFG_PREFIX #name ); \
+ p_sys->i_##name = __MIN( max, __MAX( min, val ) ); \
var_AddCallback( p_filter, CFG_PREFIX #name, BluescreenCallback, p_sys );
GET_VAR( u, 0x00, 0xff );
var_DelCallback( p_filter, CFG_PREFIX "vt", BluescreenCallback, p_sys );
free( p_sys->p_at );
+ vlc_mutex_destroy( &p_sys->lock );
free( p_sys );
}
uint8_t *p_v = p_pic->p[ V_PLANE ].p_pixels;
uint8_t umin, umax, vmin, vmax;
- if( p_pic->format.i_chroma != VLC_FOURCC('Y','U','V','A') )
+ if( p_pic->format.i_chroma != VLC_CODEC_YUVA )
{
msg_Err( p_filter,
"Unsupported input chroma \"%4s\". "
p_sys->p_at = realloc( p_sys->p_at, i_lines * i_pitch * sizeof( uint8_t ) );
p_at = p_sys->p_at;
+ vlc_mutex_lock( &p_sys->lock );
umin = p_sys->i_u - p_sys->i_ut >= 0x00 ? p_sys->i_u - p_sys->i_ut : 0x00;
umax = p_sys->i_u + p_sys->i_ut <= 0xff ? p_sys->i_u + p_sys->i_ut : 0xff;
vmin = p_sys->i_v - p_sys->i_vt >= 0x00 ? p_sys->i_v - p_sys->i_vt : 0x00;
vmax = p_sys->i_v + p_sys->i_vt <= 0xff ? p_sys->i_v + p_sys->i_vt : 0xff;
+ vlc_mutex_unlock( &p_sys->lock );
for( i = 0; i < i_lines*i_pitch; i++ )
{
VLC_UNUSED(p_this); VLC_UNUSED(oldval);
filter_sys_t *p_sys = (filter_sys_t *) p_data;
+ vlc_mutex_lock( &p_sys->lock );
#define VAR_IS( a ) !strcmp( psz_var, CFG_PREFIX a )
if( VAR_IS( "u" ) )
- {
p_sys->i_u = __MAX( 0, __MIN( 255, newval.i_int ) );
- }
else if( VAR_IS( "v" ) )
- {
p_sys->i_v = __MAX( 0, __MIN( 255, newval.i_int ) );
- }
else if( VAR_IS( "ut" ) )
- {
p_sys->i_ut = __MAX( 0, __MIN( 255, newval.i_int ) );
- }
else if( VAR_IS( "vt" ) )
- {
p_sys->i_vt = __MAX( 0, __MIN( 255, newval.i_int ) );
- }
+ vlc_mutex_unlock( &p_sys->lock );
return VLC_SUCCESS;
}
*****************************************************************************/
struct vout_sys_t
{
+ vlc_mutex_t lock;
vout_thread_t *p_vout;
unsigned int i_x, i_y;
config_GetInt( p_vout, "autocrop-non-black-pixels" );
p_vout->p_sys->i_diff = config_GetInt( p_vout, "autocrop-diff" );
p_vout->p_sys->i_time = config_GetInt( p_vout, "autocrop-time" );
- vlc_value_t val={0};
- var_Get( p_vout, "ratio-crop", &val );
- val.psz_string = "0";
- var_SetString( p_vout, "ratio-crop", val.psz_string);
+ var_SetString( p_vout, "ratio-crop", "0" );
if (p_vout->p_sys->b_autocrop)
p_vout->p_sys->i_ratio = 0;
}
#ifdef BEST_AUTOCROP
+ vlc_mutex_init( &p_vout->p_sys->lock );
var_AddCallback( p_vout, "ratio-crop", FilterCallback, NULL );
#endif
}
vout_filter_ReleaseDirectBuffers( p_vout );
+ var_DelCallback( p_vout, "ratio-crop", FilterCallback, NULL );
+ vlc_mutex_destroy( &p_sys->lock );
}
/*****************************************************************************
memset( &fmt, 0, sizeof(video_format_t) );
#ifdef BEST_AUTOCROP
+ /* XXX: not thread-safe with FilterCallback */
msg_Dbg( p_vout, "cropping at %ix%i+%i+%i, %sautocropping",
p_vout->p_sys->i_width, p_vout->p_sys->i_height,
p_vout->p_sys->i_x, p_vout->p_sys->i_y,
vout_filter_AddChild( p_vout, p_vout->p_sys->p_vout, MouseEvent );
p_vout->p_sys->b_changed = false;
+ vlc_mutex_lock( &p_vout->p_sys->lock );
p_vout->p_sys->i_lastchange = 0;
+ vlc_mutex_unlock( &p_vout->p_sys->lock );
return VLC_SUCCESS;
}
vout_DisplayPicture( p_vout->p_sys->p_vout, p_outpic );
/* The source image may still be in the cache ... parse it! */
+ vlc_mutex_lock( &p_vout->p_sys->lock );
if( p_vout->p_sys->b_autocrop )
- {
UpdateStats( p_vout, p_pic );
- }
+ vlc_mutex_unlock( &p_vout->p_sys->lock );
}
#ifdef BEST_AUTOCROP
switch(i_chroma)
{
// planar YUV
- case VLC_FOURCC('I','4','4','4'):
- case VLC_FOURCC('I','4','2','2'):
- case VLC_FOURCC('I','4','2','0'):
- case VLC_FOURCC('Y','V','1','2'):
- case VLC_FOURCC('I','Y','U','V'):
- case VLC_FOURCC('I','4','1','1'):
- case VLC_FOURCC('I','4','1','0'):
- case VLC_FOURCC('Y','V','U','9'):
- case VLC_FOURCC('Y','U','V','A'):
+ case VLC_CODEC_I444:
+ case VLC_CODEC_I422:
+ case VLC_CODEC_I420:
+ case VLC_CODEC_YV12:
+ case VLC_CODEC_I411:
+ case VLC_CODEC_I410:
+ case VLC_CODEC_YUVA:
i_skipCount = (i_pitch * i_skipCountPercent) / 100;
for (i_index = i_col/2 + i_skipCount/2;
i_index <= i_visible_pitch/2 + i_col/2 - i_skipCount/2;
}
break;
// packed RGB
- case VLC_FOURCC('R','G','B','2'): // packed by 1
+ case VLC_CODEC_RGB8: // packed by 1
i_skipCount = (i_pitch * i_skipCountPercent) / 100;
for (i_index = i_col/2 + i_skipCount/2;
i_index <= i_visible_pitch/2 + i_col/2 - i_skipCount/2;
if (i_count > i_nonBlackPixel) break;
}
break;
- case VLC_FOURCC('R','V','1','5'): // packed by 2
- case VLC_FOURCC('R','V','1','6'): // packed by 2
+ case VLC_CODEC_RGB15: // packed by 2
+ case VLC_CODEC_RGB16: // packed by 2
i_skipCount = (i_pitch * i_skipCountPercent) / 100;
for (i_index = i_col/2 + i_skipCount/2 -
(i_col/2 + i_skipCount/2) % 2;
if (i_count > i_nonBlackPixel) break;
}
break;
- case VLC_FOURCC('R','V','2','4'): // packed by 3
+ case VLC_CODEC_RGB24: // packed by 3
i_skipCount = (i_pitch * i_skipCountPercent) / 100;
for (i_index = i_col/2 + i_skipCount/2 - (i_col/2 + i_skipCount/2) % 3; i_index <= i_visible_pitch/2 + i_col/2 - i_skipCount/2; i_index+=3)
{
if (i_count > i_nonBlackPixel) break;
}
break;
- case VLC_FOURCC('R','V','3','2'): // packed by 4
+ case VLC_CODEC_RGB32: // packed by 4
i_skipCount = (i_pitch * i_skipCountPercent) / 100;
for (i_index = i_col/2 + i_skipCount/2 - (i_col/2 + i_skipCount/2) % 4; i_index <= i_visible_pitch/2 + i_col/2 - i_skipCount/2; i_index+=4)
{
}
break;
// packed YUV
- case VLC_FOURCC('Y','U','Y','2'): // packed by 2
- case VLC_FOURCC('Y','U','N','V'): // packed by 2
- case VLC_FOURCC('U','Y','V','Y'): // packed by 2
- case VLC_FOURCC('U','Y','N','V'): // packed by 2
- case VLC_FOURCC('Y','4','2','2'): // packed by 2
+ case VLC_CODEC_YUYV: // packed by 2
+ case VLC_CODEC_UYVY: // packed by 2
i_skipCount = (i_pitch * i_skipCountPercent) / 100;
for (i_index = (i_col/2 + i_skipCount/2) -
(i_col/2 + i_skipCount/2) % 2;
/* Determine where black borders are */
switch( p_vout->output.i_chroma )
{
- case VLC_FOURCC('I','4','2','0'):
+ case VLC_CODEC_I420:
/* XXX: Do not laugh ! I know this is very naive. But it's just a
* proof of concept code snippet... */
for( i = i_lines ; i-- ; )
if( !strcmp( psz_var, "ratio-crop" ) )
{
+ vlc_mutex_lock( &p_vout->p_sys->lock );
if ( !strcmp( newval.psz_string, "Auto" ) )
p_vout->p_sys->i_ratio = 0;
else
if (p_vout->p_sys->i_ratio < p_vout->output.i_aspect / 432)
p_vout->p_sys->i_ratio = p_vout->output.i_aspect / 432;
}
+ vlc_mutex_unlock( &p_vout->p_sys->lock );
}
return VLC_SUCCESS;
}
#include <vlc_common.h>
#include <vlc_plugin.h>
#include <vlc_sout.h>
-#include <vlc_vout.h>
#include "vlc_image.h"
#include "vlc_filter.h"
picture_t *p_old_mask = p_filter->p_sys->p_mask;
memset( &fmt_in, 0, sizeof( video_format_t ) );
memset( &fmt_out, 0, sizeof( video_format_t ) );
- fmt_out.i_chroma = VLC_FOURCC('Y','U','V','A');
+ fmt_out.i_chroma = VLC_CODEC_YUVA;
p_image = image_HandlerCreate( p_filter );
p_filter->p_sys->p_mask =
image_ReadUrl( p_image, psz_filename, &fmt_in, &fmt_out );
switch( p_filter->fmt_in.video.i_chroma )
{
- case VLC_FOURCC('I','4','2','0'):
- case VLC_FOURCC('I','Y','U','V'):
- case VLC_FOURCC('J','4','2','0'):
- case VLC_FOURCC('Y','V','1','2'):
+ case VLC_CODEC_I420:
+ case VLC_CODEC_J420:
+ case VLC_CODEC_YV12:
- case VLC_FOURCC('I','4','2','2'):
- case VLC_FOURCC('J','4','2','2'):
+ case VLC_CODEC_I422:
+ case VLC_CODEC_J422:
break;
default:
p_sys->i_x = var_CreateGetIntegerCommand( p_filter, CFG_PREFIX "x" );
p_sys->i_y = var_CreateGetIntegerCommand( p_filter, CFG_PREFIX "y" );
+ vlc_mutex_init( &p_sys->lock );
var_AddCallback( p_filter, CFG_PREFIX "x", EraseCallback, p_sys );
var_AddCallback( p_filter, CFG_PREFIX "y", EraseCallback, p_sys );
var_AddCallback( p_filter, CFG_PREFIX "mask", EraseCallback, p_sys );
- vlc_mutex_init( &p_sys->lock );
-
return VLC_SUCCESS;
}
if( p_sys->p_mask )
picture_Release( p_sys->p_mask );
+ var_DelCallback( p_filter, CFG_PREFIX "x", EraseCallback, p_sys );
+ var_DelCallback( p_filter, CFG_PREFIX "y", EraseCallback, p_sys );
+ var_DelCallback( p_filter, CFG_PREFIX "mask", EraseCallback, p_sys );
vlc_mutex_destroy( &p_sys->lock );
free( p_filter->p_sys );
{
filter_sys_t *p_sys = p_filter->p_sys;
- int i_plane;
-
+ vlc_mutex_lock( &p_sys->lock );
const int i_mask_pitch = p_sys->p_mask->A_PITCH;
const int i_mask_visible_pitch = p_sys->p_mask->p[A_PLANE].i_visible_pitch;
const int i_mask_visible_lines = p_sys->p_mask->p[A_PLANE].i_visible_lines;
- for( i_plane = 0; i_plane < p_inpic->i_planes; i_plane++ )
+ for( int i_plane = 0; i_plane < p_inpic->i_planes; i_plane++ )
{
const int i_pitch = p_inpic->p[i_plane].i_pitch;
const int i_2pitch = i_pitch<<1;
uint8_t *p_inpix = p_inpic->p[i_plane].p_pixels;
uint8_t *p_outpix = p_outpic->p[i_plane].p_pixels;
uint8_t *p_mask = p_sys->p_mask->A_PIXELS;
+ int i_x = p_sys->i_x, i_y = p_sys->i_y;
- int i_x = p_sys->i_x,
- i_y = p_sys->i_y;
int x, y;
int i_height = i_mask_visible_lines;
int i_width = i_mask_visible_pitch;
const bool b_line_factor = ( i_plane /* U_PLANE or V_PLANE */ &&
- !( p_inpic->format.i_chroma == VLC_FOURCC('I','4','2','2')
- || p_inpic->format.i_chroma == VLC_FOURCC('J','4','2','2') ) );
+ !( p_inpic->format.i_chroma == VLC_CODEC_I422
+ || p_inpic->format.i_chroma == VLC_CODEC_J422 ) );
if( i_plane ) /* U_PLANE or V_PLANE */
{
}
}
}
+ vlc_mutex_unlock( &p_sys->lock );
}
static int EraseCallback( vlc_object_t *p_this, char const *psz_var,
#include <vlc_common.h>
#include <vlc_plugin.h>
-#include <vlc_vout.h>
#include "vlc_filter.h"
#include "filter_picture.h"
enum { RED=0xFF0000, GREEN=0x00FF00, BLUE=0x0000FF };
struct filter_sys_t
{
- int i_color;
+ vlc_mutex_t lock;
int *projection_matrix;
+ uint32_t i_color;
};
/*****************************************************************************
switch( p_filter->fmt_in.video.i_chroma )
{
- case VLC_FOURCC('I','4','2','0'):
- case VLC_FOURCC('I','Y','U','V'):
- case VLC_FOURCC('J','4','2','0'):
- case VLC_FOURCC('Y','V','1','2'):
+ case VLC_CODEC_I420:
+ case VLC_CODEC_J420:
+ case VLC_CODEC_YV12:
- case VLC_FOURCC('I','4','2','2'):
- case VLC_FOURCC('J','4','2','2'):
+ case VLC_CODEC_I422:
+ case VLC_CODEC_J422:
CASE_PACKED_YUV_422
break;
p_filter->p_sys->i_color = var_CreateGetIntegerCommand( p_filter,
FILTER_PREFIX "component" );
- var_AddCallback( p_filter, FILTER_PREFIX "component",
- ExtractCallback, p_filter->p_sys );
-
/* Matrix won't be used for RED, GREEN or BLUE in planar formats */
make_projection_matrix( p_filter, p_filter->p_sys->i_color,
p_filter->p_sys->projection_matrix );
+ vlc_mutex_init( &p_filter->p_sys->lock );
+ var_AddCallback( p_filter, FILTER_PREFIX "component",
+ ExtractCallback, p_filter->p_sys );
p_filter->pf_video_filter = Filter;
static void Destroy( vlc_object_t *p_this )
{
filter_t *p_filter = (filter_t *)p_this;
+ filter_sys_t *p_sys = p_filter->p_sys;
- free( p_filter->p_sys->projection_matrix );
- free( p_filter->p_sys );
+ var_DelCallback( p_filter, FILTER_PREFIX "component", ExtractCallback,
+ p_sys );
+ vlc_mutex_destroy( &p_sys->lock );
+ free( p_sys->projection_matrix );
+ free( p_sys );
}
/*****************************************************************************
static picture_t *Filter( filter_t *p_filter, picture_t *p_pic )
{
picture_t *p_outpic;
+ filter_sys_t *p_sys = p_filter->p_sys;
if( !p_pic ) return NULL;
return NULL;
}
+ vlc_mutex_lock( &p_sys->lock );
switch( p_pic->format.i_chroma )
{
- case VLC_FOURCC('I','4','2','0'):
- case VLC_FOURCC('I','Y','U','V'):
- case VLC_FOURCC('J','4','2','0'):
- case VLC_FOURCC('Y','V','1','2'):
+ case VLC_CODEC_I420:
+ case VLC_CODEC_J420:
+ case VLC_CODEC_YV12:
- switch( p_filter->p_sys->i_color )
+ switch( p_sys->i_color )
{
case RED:
get_red_from_yuv420( p_pic, p_outpic,
default:
get_custom_from_yuv420( p_pic, p_outpic,
Y_PLANE, U_PLANE, V_PLANE,
- p_filter->p_sys->projection_matrix);
+ p_sys->projection_matrix);
break;
}
break;
- case VLC_FOURCC('I','4','2','2'):
- case VLC_FOURCC('J','4','2','2'):
+ case VLC_CODEC_I422:
+ case VLC_CODEC_J422:
switch( p_filter->p_sys->i_color )
{
case RED:
default:
get_custom_from_yuv422( p_pic, p_outpic,
Y_PLANE, U_PLANE, V_PLANE,
- p_filter->p_sys->projection_matrix);
+ p_sys->projection_matrix);
break;
}
break;
CASE_PACKED_YUV_422
get_custom_from_packedyuv422( p_pic, p_outpic,
- p_filter->p_sys->projection_matrix );
+ p_sys->projection_matrix );
break;
default:
+ vlc_mutex_unlock( &p_sys->lock );
msg_Warn( p_filter, "Unsupported input chroma (%4s)",
(char*)&(p_pic->format.i_chroma) );
picture_Release( p_pic );
return NULL;
}
+ vlc_mutex_unlock( &p_sys->lock );
return CopyInfoAndRelease( p_outpic, p_pic );
}
VLC_UNUSED(oldval);
filter_sys_t *p_sys = (filter_sys_t *)p_data;
+ vlc_mutex_lock( &p_sys->lock );
if( !strcmp( psz_var, FILTER_PREFIX "component" ) )
{
p_sys->i_color = newval.i_int;
{
msg_Warn( p_this, "Unknown callback command." );
}
+ vlc_mutex_unlock( &p_sys->lock );
return VLC_SUCCESS;
}
#include <vlc_common.h>
#include <vlc_plugin.h>
#include <vlc_sout.h>
-#include <vlc_vout.h>
#include "vlc_filter.h"
#include "filter_picture.h"
*****************************************************************************/
struct filter_sys_t
{
+ vlc_mutex_t lock;
int i_mode;
/* For the gradient mode */
p_filter->p_sys->b_cartoon =
var_CreateGetBoolCommand( p_filter, FILTER_PREFIX "cartoon" );
+ vlc_mutex_init( &p_filter->p_sys->lock );
var_AddCallback( p_filter, FILTER_PREFIX "mode",
GradientCallback, p_filter->p_sys );
var_AddCallback( p_filter, FILTER_PREFIX "type",
static void Destroy( vlc_object_t *p_this )
{
filter_t *p_filter = (filter_t *)p_this;
-
- free( p_filter->p_sys->p_buf32 );
- free( p_filter->p_sys->p_buf32_bis );
- free( p_filter->p_sys->p_buf8 );
- free( p_filter->p_sys->p_pre_hough );
-
- free( p_filter->p_sys );
+ filter_sys_t *p_sys = p_filter->p_sys;
+
+ var_DelCallback( p_filter, FILTER_PREFIX "mode",
+ GradientCallback, p_sys );
+ var_DelCallback( p_filter, FILTER_PREFIX "type",
+ GradientCallback, p_sys );
+ var_DelCallback( p_filter, FILTER_PREFIX "cartoon",
+ GradientCallback, p_sys );
+ vlc_mutex_destroy( &p_sys->lock );
+
+ free( p_sys->p_buf32 );
+ free( p_sys->p_buf32_bis );
+ free( p_sys->p_buf8 );
+ free( p_sys->p_pre_hough );
+
+ free( p_sys );
}
/*****************************************************************************
return NULL;
}
+ vlc_mutex_lock( &p_filter->p_sys->lock );
switch( p_filter->p_sys->i_mode )
{
case EDGE:
default:
break;
}
+ vlc_mutex_unlock( &p_filter->p_sys->lock );
return CopyInfoAndRelease( p_outpic, p_pic );
}
{
VLC_UNUSED(oldval);
filter_sys_t *p_sys = (filter_sys_t *)p_data;
+
+ vlc_mutex_lock( &p_sys->lock );
if( !strcmp( psz_var, FILTER_PREFIX "mode" ) )
{
if( !strcmp( newval.psz_string, "gradient" ) )
{
p_sys->b_cartoon = newval.b_bool;
}
+ vlc_mutex_unlock( &p_sys->lock );
+
return VLC_SUCCESS;
}
memset( &fmt_in, 0, sizeof(video_format_t) );
memset( &fmt_out, 0, sizeof(video_format_t) );
- fmt_out.i_chroma = VLC_FOURCC('Y','U','V','A');
+ fmt_out.i_chroma = VLC_CODEC_YUVA;
p_image = image_HandlerCreate( p_this );
p_pic = image_ReadUrl( p_image, psz_filename, &fmt_in, &fmt_out );
image_HandlerDelete( p_image );
p_sys->pos = var_CreateGetIntegerCommand( p_vout, "logo-position" );
p_sys->posx = var_CreateGetIntegerCommand( p_vout, "logo-x" );
p_sys->posy = var_CreateGetIntegerCommand( p_vout, "logo-y" );
- p_logo_list->i_delay = __MAX( __MIN(
- var_CreateGetIntegerCommand( p_vout, "logo-delay" ) , 60000 ), 0 );
+ p_logo_list->i_delay = var_CreateGetIntegerCommand( p_vout, "logo-delay" );
+ p_logo_list->i_delay = __MAX( __MIN( p_logo_list->i_delay, 60000 ), 0 );
p_logo_list->i_repeat = var_CreateGetIntegerCommand( p_vout, "logo-repeat");
- p_logo_list->i_alpha = __MAX( __MIN(
- var_CreateGetIntegerCommand( p_vout, "logo-transparency" ), 255 ), 0 );
+ p_logo_list->i_alpha = var_CreateGetIntegerCommand( p_vout,
+ "logo-transparency" );
+ p_logo_list->i_alpha = __MAX( __MIN( p_logo_list->i_alpha, 255 ), 0 );
LoadLogoList( p_vout, p_logo_list );
p_sys->p_blend->fmt_in.video.i_y_offset = 0;
p_sys->p_blend->fmt_out.video.i_aspect = p_vout->render.i_aspect;
p_sys->p_blend->fmt_out.video.i_chroma = p_vout->output.i_chroma;
- p_sys->p_blend->fmt_in.video.i_chroma = VLC_FOURCC('Y','U','V','A');
+ p_sys->p_blend->fmt_in.video.i_chroma = VLC_CODEC_YUVA;
p_sys->p_blend->fmt_in.video.i_aspect = VOUT_ASPECT_FACTOR;
p_sys->i_width =
p_sys->p_blend->fmt_in.video.i_width =
p_sys->posx = var_CreateGetIntegerCommand( p_filter, "logo-x" );
p_sys->posy = var_CreateGetIntegerCommand( p_filter, "logo-y" );
p_sys->pos = var_CreateGetIntegerCommand( p_filter, "logo-position" );
- p_logo_list->i_alpha = __MAX( __MIN( var_CreateGetIntegerCommand(
- p_filter, "logo-transparency"), 255 ), 0 );
+ p_logo_list->i_alpha = var_CreateGetIntegerCommand( p_filter,
+ "logo-transparency");
+ p_logo_list->i_alpha = __MAX( __MIN( p_logo_list->i_alpha, 255 ), 0 );
p_logo_list->i_delay =
var_CreateGetIntegerCommand( p_filter, "logo-delay" );
p_logo_list->i_repeat =
var_CreateGetIntegerCommand( p_filter, "logo-repeat" );
+ vlc_mutex_init( &p_logo_list->lock );
+ LoadLogoList( p_this, p_logo_list );
+
var_AddCallback( p_filter, "logo-file", LogoCallback, p_sys );
var_AddCallback( p_filter, "logo-x", LogoCallback, p_sys );
var_AddCallback( p_filter, "logo-y", LogoCallback, p_sys );
var_AddCallback( p_filter, "logo-transparency", LogoCallback, p_sys );
var_AddCallback( p_filter, "logo-repeat", LogoCallback, p_sys );
- vlc_mutex_init( &p_logo_list->lock );
- vlc_mutex_lock( &p_logo_list->lock );
-
- LoadLogoList( p_this, p_logo_list );
-
- vlc_mutex_unlock( &p_logo_list->lock );
-
/* Misc init */
p_filter->pf_sub_filter = Filter;
p_sys->b_need_update = true;
/* Create new SPU region */
memset( &fmt, 0, sizeof(video_format_t) );
- fmt.i_chroma = VLC_FOURCC('Y','U','V','A');
+ fmt.i_chroma = VLC_CODEC_YUVA;
fmt.i_aspect = VOUT_ASPECT_FACTOR;
fmt.i_sar_num = fmt.i_sar_den = 1;
fmt.i_width = fmt.i_visible_width = p_pic->p[Y_PLANE].i_visible_pitch;
#include <vlc_common.h>
#include <vlc_plugin.h>
-#include <vlc_vout.h>
#include "vlc_filter.h"
#include "vlc_block.h"
return VLC_ENOMEM;
vlc_mutex_init( &p_sys->lock );
- p_sys->p_style = malloc( sizeof( text_style_t ) );
- memcpy( p_sys->p_style, &default_text_style, sizeof( text_style_t ) );
+ p_sys->p_style = text_style_New();
config_ChainParse( p_filter, CFG_PREFIX, ppsz_filter_options,
p_filter->p_cfg );
+
#define CREATE_VAR( stor, type, var ) \
p_sys->stor = var_CreateGet##type##Command( p_filter, var ); \
var_AddCallback( p_filter, var, MarqueeCallback, p_sys );
+ p_sys->b_need_update = true;
CREATE_VAR( i_xoff, Integer, "marq-x" );
CREATE_VAR( i_yoff, Integer, "marq-y" );
CREATE_VAR( i_timeout,Integer, "marq-timeout" );
- CREATE_VAR( i_refresh,Integer, "marq-refresh" );
- p_sys->i_refresh *= 1000;
+ p_sys->i_refresh = 1000 * var_CreateGetIntegerCommand( p_filter,
+ "marq-refresh" );
+ var_AddCallback( p_filter, "marq-refresh", MarqueeCallback, p_sys );
CREATE_VAR( i_pos, Integer, "marq-position" );
CREATE_VAR( psz_marquee, String, "marq-marquee" );
CREATE_VAR( p_style->i_font_alpha, Integer, "marq-opacity" );
+ p_sys->p_style->i_font_alpha =
+ 255 - var_CreateGetIntegerCommand( p_filter, "marq-opacity" );
+ var_AddCallback( p_filter, "marq-opacity", MarqueeCallback, p_sys );
CREATE_VAR( p_style->i_font_color, Integer, "marq-color" );
CREATE_VAR( p_style->i_font_size, Integer, "marq-size" );
- p_sys->p_style->i_font_alpha = 255 - p_sys->p_style->i_font_alpha ;
-
/* Misc init */
p_filter->pf_sub_filter = Filter;
p_sys->last_time = 0;
- p_sys->b_need_update = true;
return VLC_SUCCESS;
}
filter_t *p_filter = (filter_t *)p_this;
filter_sys_t *p_sys = p_filter->p_sys;
- text_style_Delete( p_sys->p_style );
- free( p_sys->psz_marquee );
-
/* Delete the marquee variables */
#define DEL_VAR(var) \
var_DelCallback( p_filter, var, MarqueeCallback, p_sys ); \
DEL_VAR( "marq-size" );
vlc_mutex_destroy( &p_sys->lock );
- free( p_sys->p_style );
++ text_style_Delete( p_sys->p_style );
+ free( p_sys->psz_marquee );
free( p_sys );
}
goto out;
memset( &fmt, 0, sizeof(video_format_t) );
- fmt.i_chroma = VLC_FOURCC('T','E','X','T');
+ fmt.i_chroma = VLC_CODEC_TEXT;
fmt.i_aspect = 0;
fmt.i_width = fmt.i_height = 0;
fmt.i_x_offset = 0;
p_spu->p_region->i_x = p_sys->i_xoff;
p_spu->p_region->i_y = p_sys->i_yoff;
- p_spu->p_region->p_style = p_sys->p_style;
+ p_spu->p_region->p_style = text_style_Duplicate( p_sys->p_style );
out:
vlc_mutex_unlock( &p_sys->lock );
#include <vlc_common.h>
#include <vlc_plugin.h>
-#include <vlc_vout.h>
#include <math.h>
#include <limits.h> /* INT_MAX */
GET_VAR( align, 0, 10 );
if( p_sys->i_align == 3 || p_sys->i_align == 7 )
- p_sys->i_align = 5;
+ p_sys->i_align = 5; /* FIXME: NOT THREAD SAFE w.r.t. callback */
GET_VAR( borderw, 0, INT_MAX );
GET_VAR( borderh, 0, INT_MAX );
GET_VAR( position, 0, 2 );
GET_VAR( delay, 100, INT_MAX );
#undef GET_VAR
- p_sys->i_delay *= 1000;
+ p_sys->i_delay *= 1000; /* FIXME: NOT THREAD SAFE w.r.t. callback */
p_sys->b_ar = var_CreateGetBoolCommand( p_filter,
CFG_PREFIX "keep-aspect-ratio" );
{
filter_t *p_filter = (filter_t*)p_this;
filter_sys_t *p_sys = p_filter->p_sys;
- int i_index;
- vlc_mutex_lock( &p_sys->lock );
+ /* FIXME: destroy callbacks first! */
if( !p_sys->b_keep )
{
if( p_sys->i_order_length )
{
- for( i_index = 0; i_index < p_sys->i_order_length; i_index++ )
+ for( int i_index = 0; i_index < p_sys->i_order_length; i_index++ )
{
free( p_sys->ppsz_order[i_index] );
}
p_sys->i_offsets_length = 0;
}
- vlc_mutex_unlock( &p_sys->lock );
vlc_mutex_destroy( &p_sys->lock );
free( p_sys );
}
fmt_in.i_height = p_es->p_picture->format.i_height;
fmt_in.i_width = p_es->p_picture->format.i_width;
- if( fmt_in.i_chroma == VLC_FOURCC('Y','U','V','A') ||
- fmt_in.i_chroma == VLC_FOURCC('R','G','B','A') )
- fmt_out.i_chroma = VLC_FOURCC('Y','U','V','A');
+ if( fmt_in.i_chroma == VLC_CODEC_YUVA ||
+ fmt_in.i_chroma == VLC_CODEC_RGBA )
+ fmt_out.i_chroma = VLC_CODEC_YUVA;
else
- fmt_out.i_chroma = VLC_FOURCC('I','4','2','0');
+ fmt_out.i_chroma = VLC_CODEC_I420;
fmt_out.i_width = col_inner_width;
fmt_out.i_height = row_inner_height;
#include <vlc_common.h>
#include <vlc_plugin.h>
#include <vlc_sout.h>
-#include <vlc_vout.h>
#include <vlc_filter.h>
#include "filter_picture.h"
*****************************************************************************/
struct filter_sys_t
{
+ vlc_spinlock_t lock;
int i_factor;
uint8_t **pp_planes;
p_filter->p_sys->i_factor =
var_CreateGetIntegerCommand( p_filter, FILTER_PREFIX "factor" );
+ vlc_spin_init( &p_filter->p_sys->lock );
var_AddCallback( p_filter, FILTER_PREFIX "factor",
MotionBlurCallback, p_filter->p_sys );
{
filter_t *p_filter = (filter_t *)p_this;
+ var_DelCallback( p_filter, FILTER_PREFIX "factor",
+ MotionBlurCallback, p_filter->p_sys );
+ vlc_spin_destroy( &p_filter->p_sys->lock );
+
while( p_filter->p_sys->i_planes-- )
free( p_filter->p_sys->pp_planes[p_filter->p_sys->i_planes] );
free( p_filter->p_sys->pp_planes );
{
VLC_UNUSED(p_this); VLC_UNUSED(oldval);
filter_sys_t *p_sys = (filter_sys_t *)p_data;
+
if( !strcmp( psz_var, FILTER_PREFIX "factor" ) )
+ {
+ vlc_spin_lock( &p_sys->lock );
p_sys->i_factor = __MIN( 127, __MAX( 1, newval.i_int ) );
+ vlc_spin_unlock( &p_sys->lock );
+ }
return VLC_SUCCESS;
}
if( p_sys->p_menu == NULL )
goto error;
+ /* FIXME: this plugin is not at all thread-safe w.r.t. callbacks */
p_sys->p_menu->i_position = p_sys->i_position;
/* Check if menu position was overridden */
MouseEvent, p_sys );
}
- es_format_Init( &p_filter->fmt_out, SPU_ES, VLC_FOURCC( 's','p','u',' ' ) );
+ es_format_Init( &p_filter->fmt_out, SPU_ES, VLC_CODEC_SPU );
p_filter->fmt_out.i_priority = 0;
return VLC_SUCCESS;
var_DelCallback( p_filter, OSD_CFG "update", OSDMenuCallback, p_sys );
var_DelCallback( p_filter, OSD_CFG "alpha", OSDMenuCallback, p_sys );
- if( p_sys )
+ if( p_sys ) /* FIXME: <-- WTF??? what about the 4 ones above? */
{
var_DelCallback( p_sys->p_menu, "osd-menu-update",
OSDMenuUpdateEvent, p_filter );
/* Create new SPU region */
memset( &fmt, 0, sizeof(video_format_t) );
- fmt.i_chroma = VLC_FOURCC( 'T','E','X','T' );
+ fmt.i_chroma = VLC_CODEC_TEXT;
fmt.i_aspect = VOUT_ASPECT_FACTOR;
fmt.i_sar_num = fmt.i_sar_den = 1;
fmt.i_width = fmt.i_visible_width = i_width;
/* Create new SPU region */
memset( &fmt, 0, sizeof(video_format_t) );
- fmt.i_chroma = (p_pic == NULL) ? VLC_FOURCC('Y','U','V','P') : VLC_FOURCC('Y','U','V','A');
+ fmt.i_chroma = (p_pic == NULL) ? VLC_CODEC_YUVP : VLC_CODEC_YUVA;
fmt.i_aspect = VOUT_ASPECT_FACTOR;
fmt.i_sar_num = fmt.i_sar_den = 1;
fmt.i_width = fmt.i_visible_width = i_width;
fmt.i_height = fmt.i_visible_height = i_height;
fmt.i_x_offset = fmt.i_y_offset = 0;
- if( fmt.i_chroma == VLC_FOURCC('Y','U','V','P') )
+ if( fmt.i_chroma == VLC_CODEC_YUVP )
{
fmt.p_palette = &palette;
fmt.p_palette->i_entries = 0;
#include <vlc_common.h>
#include <vlc_plugin.h>
-#include <vlc_vout.h>
+#include <vlc_filter.h>
#include "filter_picture.h"
switch( p_filter->fmt_in.video.i_chroma )
{
- case VLC_FOURCC('I','4','4','4'):
- case VLC_FOURCC('J','4','4','4'):
- /* case VLC_FOURCC('Y','U','V','A'): FIXME Should work but alpha plane needs to be copied manually and I'm kind of feeling too lazy to write the code to do that ATM (i_pitch vs i_visible_pitch...). */
+ case VLC_CODEC_I444:
+ case VLC_CODEC_J444:
+ /* case VLC_CODEC_YUVA: FIXME Should work but alpha plane needs to be copied manually and I'm kind of feeling too lazy to write the code to do that ATM (i_pitch vs i_visible_pitch...). */
i_flags |= PP_FORMAT_444;
break;
- case VLC_FOURCC('I','4','2','2'):
- case VLC_FOURCC('J','4','2','2'):
+ case VLC_CODEC_I422:
+ case VLC_CODEC_J422:
i_flags |= PP_FORMAT_422;
break;
- case VLC_FOURCC('I','4','1','1'):
+ case VLC_CODEC_I411:
i_flags |= PP_FORMAT_411;
break;
- case VLC_FOURCC('I','4','2','0'):
- case VLC_FOURCC('I','Y','U','V'):
- case VLC_FOURCC('J','4','2','0'):
- case VLC_FOURCC('Y','V','1','2'):
+ case VLC_CODEC_I420:
+ case VLC_CODEC_J420:
+ case VLC_CODEC_YV12:
i_flags |= PP_FORMAT_420;
break;
default:
var_AddCallback( p_filter, FILTER_PREFIX "name", PPNameCallback, NULL );
if( val_orig.i_int )
{
- p_sys->pp_mode = pp_get_mode_by_name_and_quality( val.psz_string?:
+ p_sys->pp_mode = pp_get_mode_by_name_and_quality( val.psz_string ?
+ val.psz_string :
"default",
val_orig.i_int );
&val, text.psz_string?&text:NULL );
}
- vlc_mutex_init( &p_sys->lock );
+ vlc_mutex_init( &p_sys->lock ); /* FIXME: too late w.r.t. callback */
p_filter->pf_video_filter = PostprocPict;
p_sys->b_had_matrix = true;
{
filter_t *p_filter = (filter_t *)p_this;
filter_sys_t *p_sys = p_filter->p_sys;
+
+ /* FIXME: delete callbacks before mutex */
vlc_mutex_destroy( &p_sys->lock );
pp_free_context( p_sys->pp_context );
if( p_sys->pp_mode ) pp_free_mode( p_sys->pp_mode );
vlc_mutex_lock( &p_sys->lock );
if( i_quality > 0 )
{
- pp_mode_t *pp_mode = pp_get_mode_by_name_and_quality( psz_name?:
+ pp_mode_t *pp_mode = pp_get_mode_by_name_and_quality( psz_name ?
+ psz_name :
"default",
i_quality );
if( pp_mode )
#include <vlc_common.h>
#include <vlc_plugin.h>
-#include <vlc_vout.h>
#include "vlc_filter.h"
#include "filter_picture.h"
*****************************************************************************/
struct filter_sys_t
{
- int i_angle;
- int i_cos;
- int i_sin;
+ vlc_spinlock_t lock;
+ int i_cos;
+ int i_sin;
};
static inline void cache_trigo( int i_angle, int *i_sin, int *i_cos )
config_ChainParse( p_filter, FILTER_PREFIX, ppsz_filter_options,
p_filter->p_cfg );
- p_sys->i_angle = var_CreateGetIntegerCommand( p_filter,
- FILTER_PREFIX "angle" ) * 10;
+ int i_angle = var_CreateGetIntegerCommand( p_filter,
+ FILTER_PREFIX "angle" ) * 10;
+ cache_trigo( i_angle, &p_sys->i_sin, &p_sys->i_cos );
var_Create( p_filter, FILTER_PREFIX "deciangle",
VLC_VAR_INTEGER|VLC_VAR_ISCOMMAND );
+ vlc_spin_init( &p_sys->lock );
var_AddCallback( p_filter, FILTER_PREFIX "angle", RotateCallback, p_sys );
var_AddCallback( p_filter, FILTER_PREFIX "deciangle",
PreciseRotateCallback, p_sys );
- cache_trigo( p_sys->i_angle, &p_sys->i_sin, &p_sys->i_cos );
return VLC_SUCCESS;
}
var_DelCallback( p_filter, FILTER_PREFIX "angle", RotateCallback, p_filter->p_sys );
var_DelCallback( p_filter, FILTER_PREFIX "deciangle",
PreciseRotateCallback, p_filter->p_sys );
-
+ vlc_spin_destroy( &p_filter->p_sys->lock );
free( p_filter->p_sys );
}
{
picture_t *p_outpic;
filter_sys_t *p_sys = p_filter->p_sys;
- int i_plane;
- const int i_sin = p_sys->i_sin, i_cos = p_sys->i_cos;
+ int i_sin, i_cos;
if( !p_pic ) return NULL;
return NULL;
}
- for( i_plane = 0 ; i_plane < p_pic->i_planes ; i_plane++ )
+ vlc_spin_lock( &p_sys->lock );
+ i_sin = p_sys->i_sin;
+ i_cos = p_sys->i_cos;
+ vlc_spin_unlock( &p_sys->lock );
+
+ for( int i_plane = 0 ; i_plane < p_pic->i_planes ; i_plane++ )
{
const int i_visible_lines = p_pic->p[i_plane].i_visible_lines;
const int i_visible_pitch = p_pic->p[i_plane].i_visible_pitch;
vlc_value_t oldval, vlc_value_t newval,
void *p_data )
{
- VLC_UNUSED(p_this); VLC_UNUSED(psz_var); VLC_UNUSED(oldval);
- filter_sys_t *p_sys = (filter_sys_t *)p_data;
- p_sys->i_angle = newval.i_int*10;
- cache_trigo( p_sys->i_angle, &p_sys->i_sin, &p_sys->i_cos );
- return VLC_SUCCESS;
+ oldval.i_int *= 10;
+ newval.i_int *= 10;
+ return PreciseRotateCallback( p_this, psz_var, oldval, newval, p_data );
}
static int PreciseRotateCallback( vlc_object_t *p_this, char const *psz_var,
{
VLC_UNUSED(p_this); VLC_UNUSED(psz_var); VLC_UNUSED(oldval);
filter_sys_t *p_sys = (filter_sys_t *)p_data;
- p_sys->i_angle = newval.i_int;
- cache_trigo( p_sys->i_angle, &p_sys->i_sin, &p_sys->i_cos );
+ int i_sin, i_cos;
+
+ cache_trigo( newval.i_int, &i_sin, &i_cos );
+ vlc_spin_lock( &p_sys->lock );
+ p_sys->i_sin = i_sin;
+ p_sys->i_cos = i_cos;
+ vlc_spin_unlock( &p_sys->lock );
return VLC_SUCCESS;
}
#include <vlc_common.h>
#include <vlc_plugin.h>
-#include <vlc_vout.h>
#include "vlc_filter.h"
#include "filter_picture.h"
struct filter_sys_t
{
- float f_sigma;
+ vlc_mutex_t lock;
int tab_precalc[512];
};
return (a > 255) ? 255 : (a < 0) ? 0 : a;
}
- static void init_precalc_table(filter_sys_t *p_filter)
+ static void init_precalc_table(filter_sys_t *p_filter, float sigma)
{
- float sigma = p_filter->f_sigma;
-
for(int i = 0; i < 512; ++i)
{
p_filter->tab_precalc[i] = (i - 256) * sigma;
config_ChainParse( p_filter, FILTER_PREFIX, ppsz_filter_options,
p_filter->p_cfg );
- p_filter->p_sys->f_sigma =
- var_CreateGetFloatCommand( p_filter, FILTER_PREFIX "sigma" );
+ float sigma = var_CreateGetFloatCommand( p_filter, FILTER_PREFIX "sigma" );
+ init_precalc_table(p_filter->p_sys, sigma);
+
+ vlc_mutex_init( &p_filter->p_sys->lock );
var_AddCallback( p_filter, FILTER_PREFIX "sigma",
SharpenCallback, p_filter->p_sys );
- init_precalc_table(p_filter->p_sys);
-
return VLC_SUCCESS;
}
static void Destroy( vlc_object_t *p_this )
{
filter_t *p_filter = (filter_t *)p_this;
- var_DelCallback( p_filter, FILTER_PREFIX "sigma",
- SharpenCallback, p_filter->p_sys );
- free( p_filter->p_sys );
+ filter_sys_t *p_sys = p_filter->p_sys;
+
+ var_DelCallback( p_filter, FILTER_PREFIX "sigma", SharpenCallback, p_sys );
+ vlc_mutex_destroy( &p_sys->lock );
+ free( p_sys );
}
/*****************************************************************************
i_src_pitch = p_pic->p[Y_PLANE].i_visible_pitch;
/* perform convolution only on Y plane. Avoid border line. */
+ vlc_mutex_lock( &p_filter->p_sys->lock );
for( i = 0; i < p_pic->p[Y_PLANE].i_visible_lines; i++ )
{
if( (i == 0) || (i == p_pic->p[Y_PLANE].i_visible_lines - 1) )
(p_src[(i + 1) * i_src_pitch + j ] * v1) +
(p_src[(i + 1) * i_src_pitch + j + 1] * v1);
- pix = pix >= 0 ? clip(pix) : -clip(pix * -1);
- p_out[i * i_src_pitch + j] = clip( p_src[i * i_src_pitch + j] +
- p_filter->p_sys->tab_precalc[pix + 256] );
+ pix = pix >= 0 ? clip(pix) : -clip(pix * -1);
+ p_out[i * i_src_pitch + j] = clip( p_src[i * i_src_pitch + j] +
+ p_filter->p_sys->tab_precalc[pix + 256] );
}
}
-
+ vlc_mutex_unlock( &p_filter->p_sys->lock );
vlc_memcpy( p_outpic->p[U_PLANE].p_pixels, p_pic->p[U_PLANE].p_pixels,
p_outpic->p[U_PLANE].i_lines * p_outpic->p[U_PLANE].i_pitch );
vlc_value_t oldval, vlc_value_t newval,
void *p_data )
{
- VLC_UNUSED(p_this); VLC_UNUSED(oldval);
+ VLC_UNUSED(p_this); VLC_UNUSED(oldval); VLC_UNUSED(psz_var);
filter_sys_t *p_sys = (filter_sys_t *)p_data;
- if( !strcmp( psz_var, FILTER_PREFIX "sigma" ) )
- p_sys->f_sigma = __MIN( 2., __MAX( 0., newval.f_float ) );
- init_precalc_table(p_sys);
+
+ vlc_mutex_lock( &p_sys->lock );
+ init_precalc_table(p_sys, __MIN( 2., __MAX( 0., newval.f_float ) ));
+ vlc_mutex_unlock( &p_sys->lock );
return VLC_SUCCESS;
}
/* it sounds like vista does not support YUV surfaces at all */
switch( i_chroma )
{
- case VLC_FOURCC('U','Y','V','Y'):
- case VLC_FOURCC('U','Y','N','V'):
- case VLC_FOURCC('Y','4','2','2'):
+ case VLC_CODEC_UYVY:
{
static const D3DFORMAT formats[] =
{ D3DFMT_UYVY, D3DFMT_YUY2, D3DFMT_X8R8G8B8, D3DFMT_A8R8G8B8, D3DFMT_R5G6B5, D3DFMT_X1R5G5B5 };
return Direct3DVoutSelectFormat(p_vout, target, formats, sizeof(formats)/sizeof(D3DFORMAT));
}
- case VLC_FOURCC('I','4','2','0'):
- case VLC_FOURCC('I','4','2','2'):
- case VLC_FOURCC('Y','V','1','2'):
+ case VLC_CODEC_I420:
+ case VLC_CODEC_I422:
+ case VLC_CODEC_YV12:
{
/* typically 3D textures don't support planar format
** fallback to packed version and use CPU for the conversion
{ D3DFMT_YUY2, D3DFMT_UYVY, D3DFMT_X8R8G8B8, D3DFMT_A8R8G8B8, D3DFMT_R5G6B5, D3DFMT_X1R5G5B5 };
return Direct3DVoutSelectFormat(p_vout, target, formats, sizeof(formats)/sizeof(D3DFORMAT));
}
- case VLC_FOURCC('Y','U','Y','2'):
- case VLC_FOURCC('Y','U','N','V'):
+ case VLC_CODEC_YUYV:
{
static const D3DFORMAT formats[] =
{ D3DFMT_YUY2, D3DFMT_UYVY, D3DFMT_X8R8G8B8, D3DFMT_A8R8G8B8, D3DFMT_R5G6B5, D3DFMT_X1R5G5B5 };
switch( i_chroma )
{
- case VLC_FOURCC('R', 'V', '1', '5'):
+ case VLC_CODEC_RGB15:
{
static const D3DFORMAT formats[] =
{ D3DFMT_X1R5G5B5 };
return Direct3DVoutSelectFormat(p_vout, target, formats, sizeof(formats)/sizeof(D3DFORMAT));
}
- case VLC_FOURCC('R', 'V', '1', '6'):
+ case VLC_CODEC_RGB16:
{
static const D3DFORMAT formats[] =
{ D3DFMT_R5G6B5 };
return Direct3DVoutSelectFormat(p_vout, target, formats, sizeof(formats)/sizeof(D3DFORMAT));
}
- case VLC_FOURCC('R', 'V', '2', '4'):
+ case VLC_CODEC_RGB24:
{
static const D3DFORMAT formats[] =
{ D3DFMT_R8G8B8, D3DFMT_X8R8G8B8, D3DFMT_A8R8G8B8 };
return Direct3DVoutSelectFormat(p_vout, target, formats, sizeof(formats)/sizeof(D3DFORMAT));
}
- case VLC_FOURCC('R', 'V', '3', '2'):
+ case VLC_CODEC_RGB32:
{
static const D3DFORMAT formats[] =
{ D3DFMT_A8R8G8B8, D3DFMT_X8R8G8B8 };
switch( format )
{
case D3DFMT_YUY2:
- p_vout->output.i_chroma = VLC_FOURCC('Y', 'U', 'Y', '2');
+ p_vout->output.i_chroma = VLC_CODEC_YUYV;
break;
case D3DFMT_UYVY:
- p_vout->output.i_chroma = VLC_FOURCC('U', 'Y', 'V', 'Y');
+ p_vout->output.i_chroma = VLC_CODEC_UYVY;
break;
case D3DFMT_R8G8B8:
- p_vout->output.i_chroma = VLC_FOURCC('R', 'V', '2', '4');
+ p_vout->output.i_chroma = VLC_CODEC_RGB24;
p_vout->output.i_rmask = 0xff0000;
p_vout->output.i_gmask = 0x00ff00;
p_vout->output.i_bmask = 0x0000ff;
break;
case D3DFMT_X8R8G8B8:
case D3DFMT_A8R8G8B8:
- p_vout->output.i_chroma = VLC_FOURCC('R', 'V', '3', '2');
+ p_vout->output.i_chroma = VLC_CODEC_RGB32;
p_vout->output.i_rmask = 0x00ff0000;
p_vout->output.i_gmask = 0x0000ff00;
p_vout->output.i_bmask = 0x000000ff;
break;
case D3DFMT_R5G6B5:
- p_vout->output.i_chroma = VLC_FOURCC('R', 'V', '1', '6');
+ p_vout->output.i_chroma = VLC_CODEC_RGB16;
p_vout->output.i_rmask = (0x1fL)<<11;
p_vout->output.i_gmask = (0x3fL)<<5;
p_vout->output.i_bmask = (0x1fL)<<0;
break;
case D3DFMT_X1R5G5B5:
- p_vout->output.i_chroma = VLC_FOURCC('R', 'V', '1', '5');
+ p_vout->output.i_chroma = VLC_CODEC_RGB15;
p_vout->output.i_rmask = (0x1fL)<<10;
p_vout->output.i_gmask = (0x1fL)<<5;
p_vout->output.i_bmask = (0x1fL)<<0;
HRESULT hr;
size_t c;
// if vout is already running, use current chroma, otherwise choose from upstream
- int i_chroma = p_vout->output.i_chroma ? : p_vout->render.i_chroma;
+ int i_chroma = p_vout->output.i_chroma ? p_vout->output.i_chroma
+ : p_vout->render.i_chroma;
I_OUTPUTPICTURES = 0;
* picture_t structures */
switch( p_vout->output.i_chroma )
{
- case VLC_FOURCC('R','G','B','2'):
+ case VLC_CODEC_RGB8:
p_pic->p->i_lines = p_vout->output.i_height;
p_pic->p->i_visible_lines = p_vout->output.i_height;
p_pic->p->i_pixel_pitch = 1;
p_pic->p->i_pixel_pitch;
p_pic->i_planes = 1;
break;
- case VLC_FOURCC('R','V','1','5'):
- case VLC_FOURCC('R','V','1','6'):
+ case VLC_CODEC_RGB15:
+ case VLC_CODEC_RGB16:
p_pic->p->i_lines = p_vout->output.i_height;
p_pic->p->i_visible_lines = p_vout->output.i_height;
p_pic->p->i_pixel_pitch = 2;
p_pic->p->i_pixel_pitch;
p_pic->i_planes = 1;
break;
- case VLC_FOURCC('R','V','2','4'):
+ case VLC_CODEC_RGB24:
p_pic->p->i_lines = p_vout->output.i_height;
p_pic->p->i_visible_lines = p_vout->output.i_height;
p_pic->p->i_pixel_pitch = 3;
p_pic->p->i_pixel_pitch;
p_pic->i_planes = 1;
break;
- case VLC_FOURCC('R','V','3','2'):
+ case VLC_CODEC_RGB32:
p_pic->p->i_lines = p_vout->output.i_height;
p_pic->p->i_visible_lines = p_vout->output.i_height;
p_pic->p->i_pixel_pitch = 4;
p_pic->p->i_pixel_pitch;
p_pic->i_planes = 1;
break;
- case VLC_FOURCC('U','Y','V','Y'):
- case VLC_FOURCC('Y','U','Y','2'):
+ case VLC_CODEC_UYVY:
+ case VLC_CODEC_YUYV:
p_pic->p->i_lines = p_vout->output.i_height;
p_pic->p->i_visible_lines = p_vout->output.i_height;
p_pic->p->i_pixel_pitch = 2;
}
}
}
- p_vout->output.i_chroma = X112VLC_FOURCC(p_vout->output.i_chroma);
+ p_vout->output.i_chroma = vlc_fourcc_GetCodec( VIDEO_ES, X112VLC_FOURCC(p_vout->output.i_chroma) );
#elif defined(MODULE_NAME_IS_glx)
{
int i_opcode, i_evt, i_err = 0;
#if XvVersion < 2 || ( XvVersion == 2 && XvRevision < 2 )
switch( p_vout->output.i_chroma )
{
- case VLC_FOURCC('R','V','1','6'):
+ case VLC_CODEC_RGB16:
#if defined( WORDS_BIGENDIAN )
p_vout->output.i_rmask = 0xf800;
p_vout->output.i_gmask = 0x07e0;
p_vout->output.i_bmask = 0xf800;
#endif
break;
- case VLC_FOURCC('R','V','1','5'):
+ case VLC_CODEC_RGB15:
#if defined( WORDS_BIGENDIAN )
p_vout->output.i_rmask = 0x7c00;
p_vout->output.i_gmask = 0x03e0;
switch( p_vout->p_sys->i_screen_depth )
{
case 8: /* FIXME: set the palette */
- p_vout->output.i_chroma = VLC_FOURCC('R','G','B','2'); break;
+ p_vout->output.i_chroma = VLC_CODEC_RGB8; break;
case 15:
- p_vout->output.i_chroma = VLC_FOURCC('R','V','1','5'); break;
+ p_vout->output.i_chroma = VLC_CODEC_RGB15; break;
case 16:
- p_vout->output.i_chroma = VLC_FOURCC('R','V','1','6'); break;
+ p_vout->output.i_chroma = VLC_CODEC_RGB16; break;
case 24:
case 32:
- p_vout->output.i_chroma = VLC_FOURCC('R','V','3','2'); break;
+ p_vout->output.i_chroma = VLC_CODEC_RGB32; break;
default:
msg_Err( p_vout, "unknown screen depth %i",
p_vout->p_sys->i_screen_depth );
I_OUTPUTPICTURES++;
}
- if( p_vout->output.i_chroma == VLC_FOURCC('Y','V','1','2') )
+ if( p_vout->output.i_chroma == VLC_CODEC_YV12 )
{
/* U and V inverted compared to I420
* Fixme: this should be handled by the vout core */
- p_vout->output.i_chroma = VLC_FOURCC('I','4','2','0');
- p_vout->fmt_out.i_chroma = VLC_FOURCC('I','4','2','0');
+ p_vout->output.i_chroma = VLC_CODEC_I420;
+ p_vout->fmt_out.i_chroma = VLC_CODEC_I420;
}
return VLC_SUCCESS;
val.i_int |= 1;
var_Set( p_vout, "mouse-button-down", val );
+ var_SetBool( p_vout->p_libvlc, "intf-popupmenu", false );
+
/* detect double-clicks */
if( ( ((XButtonEvent *)&xevent)->time -
p_vout->p_sys->i_time_button_last_pressed ) < 300 )
var_Get( p_vout, "mouse-button-down", &val );
val.i_int |= 4;
var_Set( p_vout, "mouse-button-down", val );
+ var_SetBool( p_vout->p_libvlc, "intf-popupmenu", true );
break;
case Button4:
var_Set( p_vout, "mouse-button-down", val );
var_SetBool( p_vout, "mouse-clicked", true );
- var_SetBool( p_vout->p_libvlc, "intf-popupmenu", false );
}
break;
val.i_int &= ~4;
var_Set( p_vout, "mouse-button-down", val );
- var_SetBool( p_vout->p_libvlc, "intf-popupmenu", true );
}
break;
{
p_win->owner_window = vout_RequestXWindow( p_vout, &p_win->i_x,
&p_win->i_y, &p_win->i_width, &p_win->i_height );
+ if( !p_win->owner_window )
+ return VLC_EGENERIC;
xsize_hints.base_width = xsize_hints.width = p_win->i_width;
xsize_hints.base_height = xsize_hints.height = p_win->i_height;
xsize_hints.flags = PSize | PMinSize;
xsize_hints.y = p_win->i_y;
xsize_hints.flags |= PPosition;
}
+
+ /* Select events we are interested in. */
+ XSelectInput( p_vout->p_sys->p_display,
+ p_win->owner_window->handle.xid, StructureNotifyMask );
+
+ /* Get the parent window's geometry information */
+ XGetGeometry( p_vout->p_sys->p_display,
+ p_win->owner_window->handle.xid,
+ &(Window){ 0 }, &(int){ 0 }, &(int){ 0 },
+ &p_win->i_width,
+ &p_win->i_height,
+ &(unsigned){ 0 }, &(unsigned){ 0 } );
+
+ /* From man XSelectInput: only one client at a time can select a
+ * ButtonPress event, so we need to open a new window anyway. */
+ p_win->base_window =
+ XCreateWindow( p_vout->p_sys->p_display,
+ p_win->owner_window->handle.xid,
+ 0, 0,
+ p_win->i_width, p_win->i_height,
+ 0,
+ 0, CopyFromParent, 0,
+ CWBackingStore | CWBackPixel | CWEventMask,
+ &xwindow_attributes );
}
else
{
DisplayWidth( p_vout->p_sys->p_display, p_vout->p_sys->i_screen );
p_win->i_height =
DisplayHeight( p_vout->p_sys->p_display, p_vout->p_sys->i_screen );
- }
- if( !p_win->owner_window )
- {
/* Create the window and set hints - the window must receive
* ConfigureNotify events, and until it is displayed, Expose and
* MapNotify events. */
p_win->base_window, val.psz_string );
}
free( val.psz_string );
-
- if( !p_vout->b_fullscreen )
- {
- const char *argv[] = { "vlc", NULL };
-
- /* Set window manager hints and properties: size hints, command,
- * window's name, and accepted protocols */
- XSetWMNormalHints( p_vout->p_sys->p_display,
- p_win->base_window, &xsize_hints );
- XSetCommand( p_vout->p_sys->p_display, p_win->base_window,
- (char**)argv, 1 );
-
- if( !var_GetBool( p_vout, "video-deco") )
- {
- Atom prop;
- mwmhints_t mwmhints;
-
- mwmhints.flags = MWM_HINTS_DECORATIONS;
- mwmhints.decorations = False;
-
- prop = XInternAtom( p_vout->p_sys->p_display, "_MOTIF_WM_HINTS",
- False );
-
- XChangeProperty( p_vout->p_sys->p_display,
- p_win->base_window,
- prop, prop, 32, PropModeReplace,
- (unsigned char *)&mwmhints,
- PROP_MWM_HINTS_ELEMENTS );
- }
- }
- }
- else
- {
- Window dummy1;
- int dummy2, dummy3;
- unsigned int dummy4, dummy5;
-
- /* Select events we are interested in. */
- XSelectInput( p_vout->p_sys->p_display,
- p_win->owner_window->handle.xid, StructureNotifyMask );
-
- /* Get the parent window's geometry information */
- XGetGeometry( p_vout->p_sys->p_display,
- p_win->owner_window->handle.xid,
- &dummy1, &dummy2, &dummy3,
- &p_win->i_width,
- &p_win->i_height,
- &dummy4, &dummy5 );
-
- /* From man XSelectInput: only one client at a time can select a
- * ButtonPress event, so we need to open a new window anyway. */
- p_win->base_window =
- XCreateWindow( p_vout->p_sys->p_display,
- p_win->owner_window->handle.xid,
- 0, 0,
- p_win->i_width, p_win->i_height,
- 0,
- 0, CopyFromParent, 0,
- CWBackingStore | CWBackPixel | CWEventMask,
- &xwindow_attributes );
}
if( (p_win->wm_protocols == None) /* use WM_DELETE_WINDOW */
#endif
/* Fill in picture_t fields */
- vout_InitPicture( VLC_OBJECT(p_vout), p_pic, p_vout->output.i_chroma,
- p_vout->output.i_width, p_vout->output.i_height,
- p_vout->output.i_aspect );
+ if( picture_Setup( p_pic, p_vout->output.i_chroma,
+ p_vout->output.i_width, p_vout->output.i_height,
+ p_vout->output.i_aspect ) )
+ return -1;
#ifdef HAVE_SYS_SHM_H
if( p_vout->p_sys->i_shm_opcode )
switch( p_vout->output.i_chroma )
{
#if defined(MODULE_NAME_IS_xvideo) || defined(MODULE_NAME_IS_xvmc)
- case VLC_FOURCC('I','4','2','0'):
- case VLC_FOURCC('Y','V','1','2'):
- case VLC_FOURCC('Y','2','1','1'):
- case VLC_FOURCC('Y','U','Y','2'):
- case VLC_FOURCC('U','Y','V','Y'):
- case VLC_FOURCC('R','V','1','5'):
- case VLC_FOURCC('R','V','1','6'):
- case VLC_FOURCC('R','V','2','4'): /* Fixme: pixel pitch == 4 ? */
- case VLC_FOURCC('R','V','3','2'):
+ case VLC_CODEC_I420:
+ case VLC_CODEC_YV12:
+ case VLC_CODEC_Y211:
+ case VLC_CODEC_YUYV:
+ case VLC_CODEC_UYVY:
+ case VLC_CODEC_RGB15:
+ case VLC_CODEC_RGB16:
+ case VLC_CODEC_RGB24: /* Fixme: pixel pitch == 4 ? */
+ case VLC_CODEC_RGB32:
for( i_plane = 0; i_plane < p_pic->p_sys->p_image->num_planes;
i_plane++ )
p_pic->p[i_plane].i_pitch =
p_pic->p_sys->p_image->pitches[i_plane];
}
- if( p_vout->output.i_chroma == VLC_FOURCC('Y','V','1','2') )
+ if( p_vout->output.i_chroma == VLC_CODEC_YV12 )
{
/* U and V inverted compared to I420
* Fixme: this should be handled by the vout core */
break;
#else
- case VLC_FOURCC('R','G','B','2'):
- case VLC_FOURCC('R','V','1','6'):
- case VLC_FOURCC('R','V','1','5'):
- case VLC_FOURCC('R','V','2','4'):
- case VLC_FOURCC('R','V','3','2'):
+ case VLC_CODEC_RGB8:
+ case VLC_CODEC_RGB16:
+ case VLC_CODEC_RGB15:
+ case VLC_CODEC_RGB24:
+ case VLC_CODEC_RGB32:
p_pic->p->i_lines = p_pic->p_sys->p_image->height;
p_pic->p->i_visible_lines = p_pic->p_sys->p_image->height;
p_pic->p->i_pitch = p_pic->p_sys->p_image->bytes_per_line;
/* p_pic->p->i_pixel_pitch = 4 for RV24 but this should be set
- * properly by vout_InitPicture() */
+ * properly by picture_Setup() */
p_pic->p->i_visible_pitch = p_pic->p->i_pixel_pitch
* p_pic->p_sys->p_image->width;
break;
* Copyright (C) 2002-2009 the VideoLAN team
*
* Authors: Damien Fouilleul <Damien.Fouilleul@laposte.net>
- * Jan Paul Dinger <jpd@m2x.nl>
+ * JP Dinger <jpd@m2x.nl>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
{
if( audioObj ) NPN_ReleaseObject(audioObj);
if( inputObj ) NPN_ReleaseObject(inputObj);
- if( logObj ) NPN_ReleaseObject(logObj);
if( playlistObj ) NPN_ReleaseObject(playlistObj);
if( videoObj ) NPN_ReleaseObject(videoObj);
}
{
"audio",
"input",
- "log",
"playlist",
"video",
"VersionInfo",
{
ID_root_audio = 0,
ID_root_input,
- ID_root_log,
ID_root_playlist,
ID_root_video,
ID_root_VersionInfo,
RuntimeNPClass<LibvlcInputNPObject>::getClass());
OBJECT_TO_NPVARIANT(NPN_RetainObject(inputObj), result);
return INVOKERESULT_NO_ERROR;
- case ID_root_log:
- // create child object in lazyman fashion to avoid
- // ownership problem with firefox
- if( ! logObj )
- logObj = NPN_CreateObject(_instance,
- RuntimeNPClass<LibvlcLogNPObject>::getClass());
- OBJECT_TO_NPVARIANT(NPN_RetainObject(logObj), result);
- return INVOKERESULT_NO_ERROR;
case ID_root_playlist:
// create child object in lazyman fashion to avoid
// ownership problem with firefox
OBJECT_TO_NPVARIANT(NPN_RetainObject(videoObj), result);
return INVOKERESULT_NO_ERROR;
case ID_root_VersionInfo:
- {
- const char *s = libvlc_get_version();
- int len = strlen(s);
- NPUTF8 *retval =(NPUTF8*)NPN_MemAlloc(len);
- if( !retval )
- return INVOKERESULT_OUT_OF_MEMORY;
-
- memcpy(retval, s, len);
- STRINGN_TO_NPVARIANT(retval, len, result);
- return INVOKERESULT_NO_ERROR;
- }
+ return invokeResultString(libvlc_get_version(),result);
default:
;
}
switch( index )
{
case ID_root_versionInfo:
- if( argCount == 0 )
- {
- const char *s = libvlc_get_version();
- int len = strlen(s);
- NPUTF8 *retval =(NPUTF8*)NPN_MemAlloc(len);
- if( !retval )
- return INVOKERESULT_OUT_OF_MEMORY;
- memcpy(retval, s, len);
- STRINGN_TO_NPVARIANT(retval, len, result);
- return INVOKERESULT_NO_ERROR;
- }
- return INVOKERESULT_NO_SUCH_METHOD;
+ if( 0 != argCount )
+ return INVOKERESULT_NO_SUCH_METHOD;
+ return invokeResultString(libvlc_get_version(),result);
default:
;
}
COUNTNAMES(LibvlcInputNPObject,methodCount,methodNames);
- /*
- ** implementation of libvlc message object
- */
-
- const NPUTF8 * const LibvlcMessageNPObject::propertyNames[] =
- {
- "severity",
- "type",
- "name",
- "header",
- "message",
- };
- COUNTNAMES(LibvlcMessageNPObject,propertyCount,propertyNames);
-
- enum LibvlcMessageNPObjectPropertyIds
- {
- ID_message_severity,
- ID_message_type,
- ID_message_name,
- ID_message_header,
- ID_message_message,
- };
-
- RuntimeNPObject::InvokeResult
- LibvlcMessageNPObject::getProperty(int index, NPVariant &result)
- {
- /* is plugin still running */
- if( isPluginRunning() )
- {
- switch( index )
- {
- case ID_message_severity:
- {
- INT32_TO_NPVARIANT(_msg.i_severity, result);
- return INVOKERESULT_NO_ERROR;
- }
- case ID_message_type:
- return invokeResultString(_msg.psz_type,result);
- case ID_message_name:
- return invokeResultString(_msg.psz_name,result);
- case ID_message_header:
- return invokeResultString(_msg.psz_header,result);
- case ID_message_message:
- return invokeResultString(_msg.psz_message,result);
- default:
- ;
- }
- }
- return INVOKERESULT_GENERIC_ERROR;
- }
-
- const NPUTF8 * const LibvlcMessageNPObject::methodNames[] =
- {
- /* no methods */
- };
- COUNTNAMES(LibvlcMessageNPObject,methodCount,methodNames);
-
- /*
- ** implementation of libvlc message iterator object
- */
-
- LibvlcMessageIteratorNPObject::LibvlcMessageIteratorNPObject(NPP instance,
- const NPClass *aClass) :
- RuntimeNPObject(instance, aClass),
- _p_iter(NULL)
- {
- // XXX FIXME use _instance or instance in this method?
-
- /* is plugin still running */
- if( instance->pdata )
- {
- VlcPlugin* p_plugin = reinterpret_cast<VlcPlugin*>(instance->pdata);
- libvlc_log_t *p_log = p_plugin->getLog();
- if( p_log )
- {
- _p_iter = libvlc_log_get_iterator(p_log, NULL);
- }
- }
- };
-
- LibvlcMessageIteratorNPObject::~LibvlcMessageIteratorNPObject()
- {
- if( _p_iter )
- libvlc_log_iterator_free(_p_iter, NULL);
- }
-
- const NPUTF8 * const LibvlcMessageIteratorNPObject::propertyNames[] =
- {
- "hasNext",
- };
- COUNTNAMES(LibvlcMessageIteratorNPObject,propertyCount,propertyNames);
-
- enum LibvlcMessageIteratorNPObjectPropertyIds
- {
- ID_messageiterator_hasNext,
- };
-
- RuntimeNPObject::InvokeResult
- LibvlcMessageIteratorNPObject::getProperty(int index, NPVariant &result)
- {
- /* is plugin still running */
- if( isPluginRunning() )
- {
- VlcPlugin* p_plugin = getPrivate<VlcPlugin>();
- switch( index )
- {
- case ID_messageiterator_hasNext:
- {
- if( _p_iter && p_plugin->getLog() )
- {
- libvlc_exception_t ex;
- libvlc_exception_init(&ex);
-
- BOOLEAN_TO_NPVARIANT(
- libvlc_log_iterator_has_next(_p_iter, &ex), result );
- RETURN_ON_EXCEPTION(this,ex);
- }
- else
- {
- BOOLEAN_TO_NPVARIANT(0, result);
- }
- return INVOKERESULT_NO_ERROR;
- }
- default:
- ;
- }
- }
- return INVOKERESULT_GENERIC_ERROR;
- }
-
- const NPUTF8 * const LibvlcMessageIteratorNPObject::methodNames[] =
- {
- "next",
- };
- COUNTNAMES(LibvlcMessageIteratorNPObject,methodCount,methodNames);
-
- enum LibvlcMessageIteratorNPObjectMethodIds
- {
- ID_messageiterator_next,
- };
-
- RuntimeNPObject::InvokeResult
- LibvlcMessageIteratorNPObject::invoke(int index, const NPVariant *args,
- uint32_t argCount, NPVariant &result)
- {
- /* is plugin still running */
- if( isPluginRunning() )
- {
- VlcPlugin* p_plugin = getPrivate<VlcPlugin>();
- libvlc_exception_t ex;
- libvlc_exception_init(&ex);
-
- switch( index )
- {
- case ID_messageiterator_next:
- if( argCount == 0 )
- {
- if( _p_iter && p_plugin->getLog() )
- {
- struct libvlc_log_message_t buffer;
-
- buffer.sizeof_msg = sizeof(buffer);
-
- libvlc_log_iterator_next(_p_iter, &buffer, &ex);
- RETURN_ON_EXCEPTION(this,ex);
-
- LibvlcMessageNPObject* message =
- static_cast<LibvlcMessageNPObject*>(
- NPN_CreateObject(_instance, RuntimeNPClass<
- LibvlcMessageNPObject>::getClass()));
- if( message )
- {
- message->setMessage(buffer);
- OBJECT_TO_NPVARIANT(message, result);
- return INVOKERESULT_NO_ERROR;
- }
- return INVOKERESULT_OUT_OF_MEMORY;
- }
- return INVOKERESULT_GENERIC_ERROR;
- }
- return INVOKERESULT_NO_SUCH_METHOD;
- default:
- ;
- }
- }
- return INVOKERESULT_GENERIC_ERROR;
- }
-
- /*
- ** implementation of libvlc message object
- */
-
- const NPUTF8 * const LibvlcMessagesNPObject::propertyNames[] =
- {
- "count",
- };
- COUNTNAMES(LibvlcMessagesNPObject,propertyCount,propertyNames);
-
- enum LibvlcMessagesNPObjectPropertyIds
- {
- ID_messages_count,
- };
-
- RuntimeNPObject::InvokeResult
- LibvlcMessagesNPObject::getProperty(int index, NPVariant &result)
- {
- /* is plugin still running */
- if( isPluginRunning() )
- {
- VlcPlugin* p_plugin = getPrivate<VlcPlugin>();
- switch( index )
- {
- case ID_messages_count:
- {
- libvlc_log_t *p_log = p_plugin->getLog();
- if( p_log )
- {
- libvlc_exception_t ex;
- libvlc_exception_init(&ex);
-
- INT32_TO_NPVARIANT(libvlc_log_count(p_log, &ex), result);
- RETURN_ON_EXCEPTION(this,ex);
- }
- else
- {
- INT32_TO_NPVARIANT(0, result);
- }
- return INVOKERESULT_NO_ERROR;
- }
- default:
- ;
- }
- }
- return INVOKERESULT_GENERIC_ERROR;
- }
-
- const NPUTF8 * const LibvlcMessagesNPObject::methodNames[] =
- {
- "clear",
- "iterator",
- };
- COUNTNAMES(LibvlcMessagesNPObject,methodCount,methodNames);
-
- enum LibvlcMessagesNPObjectMethodIds
- {
- ID_messages_clear,
- ID_messages_iterator,
- };
-
- RuntimeNPObject::InvokeResult
- LibvlcMessagesNPObject::invoke(int index, const NPVariant *args,
- uint32_t argCount, NPVariant &result)
- {
- /* is plugin still running */
- if( isPluginRunning() )
- {
- VlcPlugin* p_plugin = getPrivate<VlcPlugin>();
- libvlc_exception_t ex;
- libvlc_exception_init(&ex);
-
- switch( index )
- {
- case ID_messages_clear:
- if( argCount == 0 )
- {
- libvlc_log_t *p_log = p_plugin->getLog();
- if( p_log )
- {
- libvlc_log_clear(p_log, &ex);
- RETURN_ON_EXCEPTION(this,ex);
- }
- return INVOKERESULT_NO_ERROR;
- }
- return INVOKERESULT_NO_SUCH_METHOD;
-
- case ID_messages_iterator:
- if( argCount == 0 )
- {
- LibvlcMessageIteratorNPObject* iter =
- static_cast<LibvlcMessageIteratorNPObject*>(
- NPN_CreateObject(_instance, RuntimeNPClass<
- LibvlcMessageIteratorNPObject>::getClass()));
- if( iter )
- {
- OBJECT_TO_NPVARIANT(iter, result);
- return INVOKERESULT_NO_ERROR;
- }
- return INVOKERESULT_OUT_OF_MEMORY;
- }
- return INVOKERESULT_NO_SUCH_METHOD;
-
- default:
- ;
- }
- }
- return INVOKERESULT_GENERIC_ERROR;
- }
-
- /*
- ** implementation of libvlc message object
- */
-
- LibvlcLogNPObject::~LibvlcLogNPObject()
- {
- if( isValid() )
- {
- if( messagesObj ) NPN_ReleaseObject(messagesObj);
- }
- };
-
- const NPUTF8 * const LibvlcLogNPObject::propertyNames[] =
- {
- "messages",
- "verbosity",
- };
- COUNTNAMES(LibvlcLogNPObject,propertyCount,propertyNames);
-
- enum LibvlcLogNPObjectPropertyIds
- {
- ID_log_messages,
- ID_log_verbosity,
- };
-
- RuntimeNPObject::InvokeResult
- LibvlcLogNPObject::getProperty(int index, NPVariant &result)
- {
- /* is plugin still running */
- if( isPluginRunning() )
- {
- VlcPlugin* p_plugin = getPrivate<VlcPlugin>();
- libvlc_exception_t ex;
- libvlc_exception_init(&ex);
-
- switch( index )
- {
- case ID_log_messages:
- {
- // create child object in lazyman fashion to avoid
- // ownership problem with firefox
- if( ! messagesObj )
- messagesObj = NPN_CreateObject(_instance,
- RuntimeNPClass<LibvlcMessagesNPObject>::getClass());
- OBJECT_TO_NPVARIANT(NPN_RetainObject(messagesObj), result);
- return INVOKERESULT_NO_ERROR;
- }
- case ID_log_verbosity:
- {
- if( p_plugin->getLog() )
- {
- INT32_TO_NPVARIANT( libvlc_get_log_verbosity(
- p_plugin->getVLC(), &ex), result);
- RETURN_ON_EXCEPTION(this,ex);
- }
- else
- {
- /* log is not enabled, return -1 */
- DOUBLE_TO_NPVARIANT(-1.0, result);
- }
- return INVOKERESULT_NO_ERROR;
- }
- default:
- ;
- }
- }
- return INVOKERESULT_GENERIC_ERROR;
- }
-
- RuntimeNPObject::InvokeResult
- LibvlcLogNPObject::setProperty(int index, const NPVariant &value)
- {
- /* is plugin still running */
- if( isPluginRunning() )
- {
- VlcPlugin* p_plugin = getPrivate<VlcPlugin>();
- libvlc_exception_t ex;
- libvlc_exception_init(&ex);
-
- switch( index )
- {
- case ID_log_verbosity:
- if( isNumberValue(value) )
- {
- libvlc_instance_t* p_libvlc = p_plugin->getVLC();
- libvlc_log_t *p_log = p_plugin->getLog();
- int verbosity = numberValue(value);
- if( verbosity >= 0 )
- {
- if( !p_log )
- {
- p_log = libvlc_log_open(p_libvlc, &ex);
- RETURN_ON_EXCEPTION(this,ex);
- p_plugin->setLog(p_log);
- }
- libvlc_set_log_verbosity(p_libvlc, (unsigned)verbosity, &ex);
- RETURN_ON_EXCEPTION(this,ex);
- }
- else if( p_log )
- {
- /* close log when verbosity is set to -1 */
- p_plugin->setLog(NULL);
- libvlc_log_close(p_log, &ex);
- RETURN_ON_EXCEPTION(this,ex);
- }
- return INVOKERESULT_NO_ERROR;
- }
- return INVOKERESULT_INVALID_VALUE;
- default:
- ;
- }
- }
- return INVOKERESULT_GENERIC_ERROR;
- }
-
- const NPUTF8 * const LibvlcLogNPObject::methodNames[] =
- {
- /* no methods */
- };
- COUNTNAMES(LibvlcLogNPObject,methodCount,methodNames);
-
/*
** implementation of libvlc playlist items object
*/
LibvlcPlaylistNPObject::~LibvlcPlaylistNPObject()
{
- if( isValid() )
- {
- if( playlistItemsObj ) NPN_ReleaseObject(playlistItemsObj);
- }
+ // Why the isValid()?
+ if( isValid() && playlistItemsObj )
+ NPN_ReleaseObject(playlistItemsObj);
};
const NPUTF8 * const LibvlcPlaylistNPObject::propertyNames[] =
}
}
- int item = p_plugin->playlist_add_extended_untrusted(url, name, i_options,
- const_cast<const char **>(ppsz_options), &ex);
+ int item = p_plugin->playlist_add_extended_untrusted(url, name,
+ i_options, const_cast<const char **>(ppsz_options), &ex);
free(url);
free(name);
for( int i=0; i< i_options; ++i )
<INPUT size=4 value="" id="removeid"><INPUT type=submit value="Delete" onClick="doRemoveItem(document.getElementById('removeid').value);">\r
</TD>\r
</TR>\r
- <TR><TD>Messages:\r
- <INPUT type=button value="Messages" onClick='doMessages();'>\r
- Verbosity:\r
- <INPUT size=2 value="1" id="verbosity" onClick="doVerbosity(document.getElementById('verbosity').value);">\r
- <INPUT type=button value=" + " onClick='doVerbosity(1);'>\r
- <INPUT type=button value=" - " onClick='doVerbosity(-1);'>\r
- </TD>\r
- <TD>\r
- <DIV id="message" style="text-align:center">no message</DIV>\r
- </TD>\r
- </TR>\r
<TR><TD>Audio Channel:\r
<SELECT readonly onClick='doAudioChannel(this.value);'>\r
<OPTION value=1>Stereo</OPTION>\r
vlc.input.rate = -1.0 * vlc.input.rate;\r
}\r
\r
- function doVerbosity(value)\r
- {\r
- var vlc = getVLC("vlc");\r
- if( vlc )\r
- {\r
- vlc.log.verbosity = vlc.log.verbosity + value;\r
- document.getElementById("verbosity").value = vlc.log.verbosity;\r
- }\r
- }\r
- \r
function doAudioChannel(value)\r
{\r
var vlc = getVLC("vlc");\r
}\r
}\r
\r
- function doMessages()\r
- {\r
- var vlc = getVLC("vlc");\r
- \r
- if( vlc )\r
- {\r
- if( vlc.log.messages.count > 0 )\r
- {\r
- // there is one or more messages in the log\r
- var iter = vlc.log.messages.iterator();\r
- while( iter.hasNext )\r
- {\r
- var msg = iter.next();\r
- if( msg.severity <= 1 )\r
- {\r
- document.getElementById("message").innerHTML = msg.message;\r
- }\r
- }\r
- // clear the log once finished to avoid clogging\r
- vlc.log.messages.clear();\r
- }\r
- }\r
- }\r
- \r
function updateVolume(deltaVol)\r
{\r
var vlc = getVLC("vlc");\r
if( vlc )\r
{\r
newState = vlc.input.state;\r
- \r
- if( vlc.log.messages.count > 0 )\r
- {\r
- // there is one or more messages in the log\r
- var iter = vlc.log.messages.iterator();\r
- while( iter.hasNext )\r
- {\r
- var msg = iter.next();\r
- if( msg.severity == 1 )\r
- {\r
- alert( msg.message );\r
- }\r
- document.getElementById("message").innerHTML = msg.message;\r
- }\r
- // clear the log once finished to avoid clogging\r
- vlc.log.messages.clear();\r
- }\r
}\r
\r
if( prevState != newState )\r
var itemId = vlc.playlist.add(targetURL,"",options);\r
if( itemId != -1 )\r
{\r
- // clear the message log and enable error logging\r
- vlc.log.verbosity = 1;\r
- vlc.log.messages.clear();\r
// play MRL\r
vlc.playlist.playItem(itemId);\r
if( monitorTimerId == 0 )\r
}\r
else\r
{\r
- // disable log\r
- vlc.log.verbosity = -1;\r
alert("cannot play at the moment !");\r
}\r
doItemCount();\r
}\r
else if( vlc.playlist.items.count > 0 )\r
{\r
- // clear the message log and enable error logging\r
- vlc.log.verbosity = 1;\r
- vlc.log.messages.clear();\r
vlc.playlist.play();\r
monitor();\r
}\r
else\r
{\r
- // disable log\r
- vlc.log.verbosity = -1;\r
alert('nothing to play !');\r
}\r
}\r
function onEnd()\r
{\r
document.getElementById("state").innerHTML = "End...";\r
+ doStop();\r
}\r
\r
var liveFeedText = new Array("Live", "((Live))", "(( Live ))", "(( Live ))");\r
\r
function onStop()\r
{\r
- // disable logging\r
var vlc = getVLC("vlc");\r
- if( vlc )\r
- vlc.log.verbosity = -1;\r
\r
if( inputTracker )\r
{\r
var vlc = getVLC("vlc");\r
\r
document.getElementById("state").innerHTML = "Error...";\r
- if( vlc )\r
- {\r
- if( vlc.log.messages.count > 0 )\r
- {\r
- // there is one or more messages in the log\r
- var iter = vlc.log.messages.iterator();\r
- while( iter.hasNext )\r
- {\r
- var msg = iter.next();\r
- if( msg.severity <= 1 )\r
- {\r
- alert( msg.message );\r
- }\r
- document.getElementById("message").innerHTML = msg.message;\r
- }\r
- // clear the log once finished to avoid clogging\r
- vlc.log.messages.clear();\r
- }\r
- }\r
}\r
\r
function onInputTrackerScrollStart()\r
libvlc_instance(NULL),
libvlc_media_list(NULL),
libvlc_media_player(NULL),
- libvlc_log(NULL),
p_scriptClass(NULL),
p_browser(instance),
psz_baseURL(NULL)
/* parse plugin arguments */
for( int i = 0; i < argc ; i++ )
{
- fprintf(stderr, "argn=%s, argv=%s\n", argn[i], argv[i]);
+ /* fprintf(stderr, "argn=%s, argv=%s\n", argn[i], argv[i]); */
if( !strcmp( argn[i], "target" )
|| !strcmp( argn[i], "mrl")
}
else if( !strcmp( argn[i], "toolbar" ) )
{
-/* FIXME: Remove this when toolbar functionality has been implemented on\
+/* FIXME: Remove this when toolbar functionality has been implemented on
* MacOS X and Win32 for Firefox/Mozilla/Safari. */
#ifdef XP_UNIX
b_toolbar = boolValue(argv[i]);
libvlc_exception_init(&ex);
libvlc_instance = libvlc_new(ppsz_argc, ppsz_argv, &ex);
-
if( libvlc_exception_raised(&ex) )
{
libvlc_exception_clear(&ex);
{
free(psz_baseURL);
free(psz_target);
- if( libvlc_log )
- libvlc_log_close(libvlc_log, NULL);
if( libvlc_media_player )
libvlc_media_player_release( libvlc_media_player );
if( libvlc_media_list )
if( href )
{
/* prepend base URL */
- strcpy(href, psz_baseURL);
+ memcpy(href, psz_baseURL, baseLen+1);
/*
** relative url could be empty,
/* skip over protocol part */
char *pathstart = strchr(href, ':');
- char *pathend;
+ char *pathend = href+baseLen;
if( pathstart )
{
if( '/' == *(++pathstart) )
}
/* skip over host part */
pathstart = strchr(pathstart, '/');
- pathend = href+baseLen;
if( ! pathstart )
{
// no path, add a / past end of url (over '\0')
return NULL;
}
pathstart = href;
- pathend = href+baseLen;
}
/* relative URL made of an absolute path ? */
p_input_thread = p_mi->p_input_thread;
- /* No one is tracking this input_thread apart from us. Destroy it. */
- if( p_mi->b_own_its_input_thread )
- {
- var_DelCallback( p_input_thread, "can-seek",
- input_seekable_changed, p_mi );
- var_DelCallback( p_input_thread, "can-pause",
- input_pausable_changed, p_mi );
- var_DelCallback( p_input_thread, "intf-event",
- input_event_changed, p_mi );
-
- /* We owned this one */
- input_Stop( p_input_thread, b_input_abort );
- vlc_thread_join( p_input_thread );
-
- var_Destroy( p_input_thread, "drawable-hwnd" );
- var_Destroy( p_input_thread, "drawable-xid" );
- var_Destroy( p_input_thread, "drawable-agl" );
- }
+ var_DelCallback( p_input_thread, "can-seek",
+ input_seekable_changed, p_mi );
+ var_DelCallback( p_input_thread, "can-pause",
+ input_pausable_changed, p_mi );
+ var_DelCallback( p_input_thread, "intf-event",
+ input_event_changed, p_mi );
+
+ /* We owned this one */
+ input_Stop( p_input_thread, b_input_abort );
+ vlc_thread_join( p_input_thread );
+
+ var_Destroy( p_input_thread, "drawable-hwnd" );
+ var_Destroy( p_input_thread, "drawable-xid" );
+ var_Destroy( p_input_thread, "drawable-agl" );
vlc_object_release( p_input_thread );
libvlc_media_set_state( p_mi->p_md, libvlc_state, NULL );
libvlc_event_send( p_mi->p_event_manager, &event );
}
- else if( newval.i_int == INPUT_EVENT_TIMES )
+ else if( newval.i_int == INPUT_EVENT_POSITION )
{
if( var_GetInteger( p_input, "state" ) != PLAYING_S )
return VLC_SUCCESS; /* Don't send the position while stopped */
var_GetTime( p_input, "time" );
libvlc_event_send( p_mi->p_event_manager, &event );
}
+ else if( newval.i_int == INPUT_EVENT_LENGTH )
+ {
+ event.type = libvlc_MediaPlayerLengthChanged;
+ event.u.media_player_length_changed.new_length =
+ var_GetTime( p_input, "length" );
+ libvlc_event_send( p_mi->p_event_manager, &event );
+ }
return VLC_SUCCESS;
}
+static void libvlc_media_player_destroy( libvlc_media_player_t * );
+
/**************************************************************************
* Create a Media Instance object.
*
p_mi->p_libvlc_instance = p_libvlc_instance;
p_mi->p_input_thread = NULL;
p_mi->i_refcount = 1;
- p_mi->b_own_its_input_thread = true;
vlc_mutex_init( &p_mi->object_lock );
p_mi->p_event_manager = libvlc_event_manager_new( p_mi,
p_libvlc_instance, p_e );
libvlc_MediaPlayerPositionChanged, p_e );
libvlc_event_manager_register_event_type( p_mi->p_event_manager,
libvlc_MediaPlayerTimeChanged, p_e );
+ libvlc_event_manager_register_event_type( p_mi->p_event_manager,
+ libvlc_MediaPlayerLengthChanged, p_e );
libvlc_event_manager_register_event_type( p_mi->p_event_manager,
libvlc_MediaPlayerTitleChanged, p_e );
libvlc_event_manager_register_event_type( p_mi->p_event_manager,
/* Snapshot initialization */
libvlc_event_manager_register_event_type( p_mi->p_event_manager,
libvlc_MediaPlayerSnapshotTaken, p_e );
+
/* Attach a var callback to the global object to provide the glue between
vout_thread that generates the event and media_player that re-emits it
with its own event manager
libvlc_exception_t *p_e )
{
libvlc_media_player_t * p_mi;
- p_mi = libvlc_media_player_new( p_md->p_libvlc_instance, p_e );
+ p_mi = libvlc_media_player_new( p_md->p_libvlc_instance, p_e );
if( !p_mi )
return NULL;
return p_mi;
}
-/**************************************************************************
- * Create a new media instance object from an input_thread (Libvlc Internal).
- **************************************************************************/
-libvlc_media_player_t * libvlc_media_player_new_from_input_thread(
- struct libvlc_instance_t *p_libvlc_instance,
- input_thread_t *p_input,
- libvlc_exception_t *p_e )
-{
- libvlc_media_player_t * p_mi;
-
- if( !p_input )
- {
- libvlc_exception_raise( p_e, "invalid input thread" );
- return NULL;
- }
-
- p_mi = libvlc_media_player_new( p_libvlc_instance, p_e );
-
- if( !p_mi )
- return NULL;
-
- p_mi->p_md = libvlc_media_new_from_input_item(
- p_libvlc_instance,
- input_GetItem( p_input ), p_e );
-
- if( !p_mi->p_md )
- {
- libvlc_media_player_destroy( p_mi );
- return NULL;
- }
-
- /* will be released in media_player_release() */
- vlc_object_hold( p_input );
-
- p_mi->p_input_thread = p_input;
- p_mi->b_own_its_input_thread = false;
-
- return p_mi;
-}
-
/**************************************************************************
* Destroy a Media Instance object (libvlc internal)
*
* Warning: No lock held here, but hey, this is internal. Caller must lock.
**************************************************************************/
-void libvlc_media_player_destroy( libvlc_media_player_t *p_mi )
+static void libvlc_media_player_destroy( libvlc_media_player_t *p_mi )
{
input_thread_t *p_input_thread;
libvlc_exception_t p_e;
- libvlc_exception_init( &p_e );
-
- if( !p_mi )
- return;
+ assert( p_mi );
- /* Detach Callback from the main libvlc object */
+ /* Detach Callback from the main libvlc object */
var_DelCallback( p_mi->p_libvlc_instance->p_libvlc_int,
"vout-snapshottaken", SnapshotTakenCallback, p_mi );
+ libvlc_exception_init( &p_e );
p_input_thread = libvlc_get_input_thread( p_mi, &p_e );
if( libvlc_exception_raised( &p_e ) )
- {
- libvlc_event_manager_release( p_mi->p_event_manager );
+ /* no need to worry about no input thread */
libvlc_exception_clear( &p_e );
- free( p_mi );
- return; /* no need to worry about no input thread */
- }
- vlc_mutex_destroy( &p_mi->object_lock );
-
- vlc_object_release( p_input_thread );
-
- libvlc_media_release( p_mi->p_md );
+ else
+ release_input_thread( p_mi, true );
+ libvlc_event_manager_release( p_mi->p_event_manager );
+ if( p_mi->p_md )
+ libvlc_media_release( p_mi->p_md );
+ vlc_mutex_destroy( &p_mi->object_lock );
free( p_mi );
}
**************************************************************************/
void libvlc_media_player_release( libvlc_media_player_t *p_mi )
{
- if( !p_mi )
- return;
+ bool destroy;
+ assert( p_mi );
vlc_mutex_lock( &p_mi->object_lock );
-
- p_mi->i_refcount--;
-
- if( p_mi->i_refcount > 0 )
- {
- vlc_mutex_unlock( &p_mi->object_lock );
- return;
- }
+ destroy = !--p_mi->i_refcount;
vlc_mutex_unlock( &p_mi->object_lock );
- vlc_mutex_destroy( &p_mi->object_lock );
-
- release_input_thread( p_mi, true );
- libvlc_event_manager_release( p_mi->p_event_manager );
-
- libvlc_media_release( p_mi->p_md );
-
- free( p_mi );
+ if( destroy )
+ libvlc_media_player_destroy( p_mi );
}
/**************************************************************************
libvlc_event_send( p_mi->p_event_manager, &event );
}
- if( p_mi->b_own_its_input_thread )
- {
- vlc_mutex_lock( &p_mi->object_lock );
- release_input_thread( p_mi, true ); /* This will stop the input thread */
- vlc_mutex_unlock( &p_mi->object_lock );
- }
- else
- {
- input_thread_t * p_input_thread = libvlc_get_input_thread( p_mi, p_e );
-
- if( !p_input_thread )
- return;
-
- input_Stop( p_input_thread, true );
- vlc_object_release( p_input_thread );
- p_mi->p_input_thread = NULL;
- }
+ vlc_mutex_lock( &p_mi->object_lock );
+ release_input_thread( p_mi, true ); /* This will stop the input thread */
+ vlc_mutex_unlock( &p_mi->object_lock );
}
/**************************************************************************
* set_nsobject
**************************************************************************/
void libvlc_media_player_set_nsobject( libvlc_media_player_t *p_mi,
- void * drawable,
- libvlc_exception_t *p_e )
+ void * drawable,
+ libvlc_exception_t *p_e )
{
(void) p_e;
p_mi->drawable.nsobject = drawable;
var_Change( p_input, psz_variable, VLC_VAR_GETLIST, &val_list, &text_list);
if( val_list.p_list->i_count <= 0 ) /* no tracks */
+ {
+ var_Change( p_input, psz_variable, VLC_VAR_FREELIST, &val_list, &text_list);
return NULL;
+ }
libvlc_track_description_t *p_track_description, *p_actual, *p_previous;
p_track_description = ( libvlc_track_description_t * )
libvlc_video_take_snapshot( libvlc_media_player_t *p_mi, const char *psz_filepath,
unsigned int i_width, unsigned int i_height, libvlc_exception_t *p_e )
{
- vout_thread_t *p_vout = GetVout( p_mi, p_e );
- input_thread_t *p_input_thread;
-
- /* GetVout will raise the exception for us */
- if( !p_vout ) return;
+ vout_thread_t *p_vout;
+ /* The filepath must be not NULL */
if( !psz_filepath )
{
libvlc_exception_raise( p_e, "filepath is null" );
return;
}
-
- var_SetInteger( p_vout, "snapshot-width", i_width );
- var_SetInteger( p_vout, "snapshot-height", i_height );
-
- p_input_thread = p_mi->p_input_thread;
+ /* We must have an input */
if( !p_mi->p_input_thread )
{
libvlc_exception_raise( p_e, "Input does not exist" );
return;
}
+ /* GetVout will raise the exception for us */
+ p_vout = GetVout( p_mi, p_e );
+ if( !p_vout ) return;
+
+ var_SetInteger( p_vout, "snapshot-width", i_width );
+ var_SetInteger( p_vout, "snapshot-height", i_height );
+
var_SetString( p_vout, "snapshot-path", psz_filepath );
var_SetString( p_vout, "snapshot-format", "png" );
return has_vout;
}
-int libvlc_video_reparent( libvlc_media_player_t *p_mi, libvlc_drawable_t d,
- libvlc_exception_t *p_e )
-{
- (void) p_mi; (void) d;
- libvlc_exception_raise(p_e, "Reparenting not supported");
- return -1;
-}
-
-void libvlc_video_resize( libvlc_media_player_t *p_mi, int width, int height, libvlc_exception_t *p_e )
-{
- vout_thread_t *p_vout = GetVout( p_mi, p_e );
- if( p_vout )
- {
- vout_Control( p_vout, VOUT_SET_SIZE, width, height );
- vlc_object_release( p_vout );
- }
-}
-
-void libvlc_video_redraw_rectangle( libvlc_media_player_t *p_mi,
- const libvlc_rectangle_t *area,
- libvlc_exception_t *p_e )
-{
-#ifdef __APPLE__
- if( (NULL != area)
- && ((area->bottom - area->top) > 0)
- && ((area->right - area->left) > 0) )
- {
- vout_thread_t *p_vout = GetVout( p_mi, p_e );
- if( p_vout )
- {
- /* tell running vout to redraw area */
- vout_Control( p_vout , VOUT_REDRAW_RECT,
- area->top, area->left, area->bottom, area->right );
- vlc_object_release( p_vout );
- }
- }
-#else
- (void) p_mi; (void) area; (void) p_e;
-#endif
-}
-
-/* global video settings */
-
-/* Deprecated use libvlc_media_player_set_drawable() */
-void libvlc_video_set_parent( libvlc_instance_t *p_instance, libvlc_drawable_t d,
- libvlc_exception_t *p_e )
-{
- /* set as default for future vout instances */
-#ifdef WIN32
- vlc_value_t val;
-
- if( sizeof(HWND) > sizeof(libvlc_drawable_t) )
- return; /* BOOM! we told you not to use this function! */
- val.p_address = (void *)(uintptr_t)d;
- var_Set( p_instance->p_libvlc_int, "drawable-hwnd", val );
-#elif defined(__APPLE__)
- var_SetInteger( p_instance->p_libvlc_int, "drawable-agl", d );
-#else
- var_SetInteger( p_instance->p_libvlc_int, "drawable-xid", d );
-#endif
-
- libvlc_media_player_t *p_mi = libvlc_playlist_get_media_player(p_instance, p_e);
- if( p_mi )
- {
- libvlc_media_player_set_drawable( p_mi, d, p_e );
- libvlc_media_player_release(p_mi);
- }
-}
-
-/* Deprecated use libvlc_media_player_get_drawable() */
-libvlc_drawable_t libvlc_video_get_parent( libvlc_instance_t *p_instance, libvlc_exception_t *p_e )
-{
- VLC_UNUSED(p_e);
-
-#ifdef WIN32
- vlc_value_t val;
-
- if( sizeof(HWND) > sizeof(libvlc_drawable_t) )
- return 0;
- var_Get( p_instance->p_libvlc_int, "drawable-hwnd", &val );
- return (uintptr_t)val.p_address;
-#elif defined(__APPLE__)
- return var_GetInteger( p_instance->p_libvlc_int, "drawable-agl" );
-#else
- return var_GetInteger( p_instance->p_libvlc_int, "drawable-xid" );
-#endif
-}
-
-void libvlc_video_set_size( libvlc_instance_t *p_instance, int width, int height,
- libvlc_exception_t *p_e )
-{
- /* set as default for future vout instances */
- config_PutInt(p_instance->p_libvlc_int, "width", width);
- config_PutInt(p_instance->p_libvlc_int, "height", height);
-
- libvlc_media_player_t *p_mi = libvlc_playlist_get_media_player(p_instance, p_e);
- if( p_mi )
- {
- vout_thread_t *p_vout = GetVout( p_mi, p_e );
- if( p_vout )
- {
- /* tell running vout to re-size */
- vout_Control( p_vout , VOUT_SET_SIZE, width, height);
- vlc_object_release( p_vout );
- }
- libvlc_media_player_release(p_mi);
- }
-}
-
-void libvlc_video_set_viewport( libvlc_instance_t *p_instance, libvlc_media_player_t *p_mi,
- const libvlc_rectangle_t *view, const libvlc_rectangle_t *clip,
- libvlc_exception_t *p_e )
-{
-#ifdef __APPLE__
- if( !view )
- {
- libvlc_exception_raise( p_e, "viewport is NULL" );
- return;
- }
-
- /* if clip is NULL, then use view rectangle as clip */
- if( !clip )
- clip = view;
-
- /* set as default for future vout instances */
- var_SetInteger( p_instance->p_libvlc_int, "drawable-view-top", view->top );
- var_SetInteger( p_instance->p_libvlc_int, "drawable-view-left", view->left );
- var_SetInteger( p_instance->p_libvlc_int, "drawable-view-bottom", view->bottom );
- var_SetInteger( p_instance->p_libvlc_int, "drawable-view-right", view->right );
- var_SetInteger( p_instance->p_libvlc_int, "drawable-clip-top", clip->top );
- var_SetInteger( p_instance->p_libvlc_int, "drawable-clip-left", clip->left );
- var_SetInteger( p_instance->p_libvlc_int, "drawable-clip-bottom", clip->bottom );
- var_SetInteger( p_instance->p_libvlc_int, "drawable-clip-right", clip->right );
-
- if( p_mi )
- {
- vout_thread_t *p_vout = GetVout( p_mi, p_e );
- if( p_vout )
- {
- /* change viewport for running vout */
- vout_Control( p_vout, VOUT_SET_VIEWPORT,
- view->top, view->left, view->bottom, view->right,
- clip->top, clip->left, clip->bottom, clip->right );
- vlc_object_release( p_vout );
- }
- }
-#else
- (void) p_instance; (void) p_mi; (void) view; (void) clip; (void) p_e;
-#endif
-}
-
float libvlc_video_get_scale( libvlc_media_player_t *p_mp,
libvlc_exception_t *p_e )
{
var_Change( p_input_thread, "spu-es", VLC_VAR_GETCHOICES, &val_list, NULL );
for( i = 0; i < val_list.p_list->i_count; i++ )
{
- vlc_value_t spu_val = val_list.p_list->p_values[i];
- if( val.i_int == spu_val.i_int )
+ if( val.i_int == val_list.p_list->p_values[i].i_int )
{
i_spu = i;
break;
}
}
+ var_Change( p_input_thread, "spu-es", VLC_VAR_FREELIST, &val_list, NULL );
vlc_object_release( p_input_thread );
return i_spu;
}
{
input_thread_t *p_input_thread = libvlc_get_input_thread( p_mi, p_e );
vlc_value_t val_list;
+ int i_spu_count;
if( !p_input_thread )
return -1;
var_Change( p_input_thread, "spu-es", VLC_VAR_GETCHOICES, &val_list, NULL );
+ i_spu_count = val_list.p_list->i_count;
+ var_Change( p_input_thread, "spu-es", VLC_VAR_FREELIST, &val_list, NULL );
+
vlc_object_release( p_input_thread );
- return val_list.p_list->i_count;
+ return i_spu_count;
}
libvlc_track_description_t *
if( val_list.p_list->i_count == 0 )
{
libvlc_exception_raise( p_e, "Subtitle value out of range" );
- vlc_object_release( p_input_thread );
- return;
+ goto end;
}
if( (i_spu < 0) && (i_spu > val_list.p_list->i_count) )
{
libvlc_exception_raise( p_e, "Subtitle value out of range" );
- vlc_object_release( p_input_thread );
- return;
+ goto end;
}
newval = val_list.p_list->p_values[i_spu];
{
libvlc_exception_raise( p_e, "Setting subtitle value failed" );
}
+
+ end:
+ var_Change( p_input_thread, "spu-es", VLC_VAR_FREELIST, &val_list, NULL );
vlc_object_release( p_input_thread );
}
{
input_thread_t *p_input_thread = libvlc_get_input_thread( p_mi, p_e );
vlc_value_t val_list;
+ int i_track_count;
if( !p_input_thread )
return -1;
var_Change( p_input_thread, "video-es", VLC_VAR_GETCHOICES, &val_list, NULL );
+ i_track_count = val_list.p_list->i_count;
+ var_Change( p_input_thread, "video-es", VLC_VAR_FREELIST, &val_list, NULL );
+
vlc_object_release( p_input_thread );
- return val_list.p_list->i_count;
+ return i_track_count;
}
libvlc_track_description_t *
var_Change( p_input_thread, "video-es", VLC_VAR_GETCHOICES, &val_list, NULL );
for( i = 0; i < val_list.p_list->i_count; i++ )
{
- vlc_value_t track_val = val_list.p_list->p_values[i];
- if( track_val.i_int == val.i_int )
+ if( val_list.p_list->p_values[i].i_int == val.i_int )
{
i_track = i;
break;
- }
+ }
}
+ var_Change( p_input_thread, "video-es", VLC_VAR_FREELIST, &val_list, NULL );
vlc_object_release( p_input_thread );
return i_track;
}
i_ret = var_Set( p_input_thread, "audio-es", val );
if( i_ret < 0 )
libvlc_exception_raise( p_e, "Setting video track failed" );
- vlc_object_release( p_input_thread );
- return;
+ goto end;
}
}
libvlc_exception_raise( p_e, "Video track out of range" );
+
+ end:
+ var_Change( p_input_thread, "video-es", VLC_VAR_FREELIST, &val_list, NULL );
vlc_object_release( p_input_thread );
}
-
-int libvlc_video_destroy( libvlc_media_player_t *p_mi,
- libvlc_exception_t *p_e )
-{
- vout_thread_t *p_vout = GetVout( p_mi, p_e );
- vlc_object_detach( p_vout );
- vlc_object_release( p_vout );
- vlc_object_release( p_vout );
-
- return 0;
-}
#include "fetcher.h"
#include "preparser.h"
+ typedef struct playlist_services_discovery_support_t {
+ /* the playlist items for category and onelevel */
+ playlist_item_t *p_cat;
+ playlist_item_t *p_one;
+ services_discovery_t *p_sd; /**< Loaded service discovery modules */
+ char *psz_name;
+ } vlc_sd_internal_t;
+
+
typedef struct playlist_private_t
{
playlist_t public_data;
playlist_item_array_t items_to_delete; /**< Array of items and nodes to
delete... At the very end. This sucks. */
- struct playlist_services_discovery_support_t {
- /* the playlist items for category and onelevel */
- playlist_item_t* p_cat;
- playlist_item_t* p_one;
- services_discovery_t * p_sd; /**< Loaded service discovery modules */
- } ** pp_sds;
+ vlc_sd_internal_t **pp_sds;
int i_sds; /**< Number of service discovery modules */
input_thread_t * p_input; /**< the input thread associated
* with the current item */
/* Tree walking */
playlist_item_t *playlist_ItemFindFromInputAndRoot( playlist_t *p_playlist,
- int i_input_id, playlist_item_t *p_root,
- bool );
+ input_item_t *p_input, playlist_item_t *p_root,
+ bool );
-int playlist_DeleteFromInputInParent( playlist_t *, int, playlist_item_t *, bool );
+int playlist_DeleteFromInputInParent( playlist_t *, input_item_t *,
+ playlist_item_t *, bool );
int playlist_DeleteFromItemId( playlist_t*, int );
int playlist_ItemRelease( playlist_item_t * );
* XXX: Why don't we have a function to ensure that in the playlist code ? */
playlist_Lock( p_parent->p_playlist );
p_pl_item = playlist_ItemFindFromInputAndRoot( p_parent->p_playlist,
- p_input->i_id, p_parent, false );
+ p_input, p_parent, false );
if( p_pl_item && p_pl_item->i_children > -1 )
playlist_NodeDelete( p_parent->p_playlist, p_pl_item, true, false );
else
/* Delete the non-node item normally */
- playlist_DeleteFromInputInParent( p_parent->p_playlist, p_input->i_id,
+ playlist_DeleteFromInputInParent( p_parent->p_playlist, p_input,
p_parent, pl_Locked );
playlist_Unlock( p_parent->p_playlist );
p_sds->p_sd = p_sd;
p_sds->p_one = p_one;
p_sds->p_cat = p_cat;
+ p_sds->psz_name = strdup( psz_module );
PL_LOCK;
TAB_APPEND( pl_priv(p_playlist)->i_sds, pl_priv(p_playlist)->pp_sds, p_sds );
}
int playlist_ServicesDiscoveryRemove( playlist_t * p_playlist,
- const char *psz_module )
+ const char *psz_name )
{
+ playlist_private_t *priv = pl_priv( p_playlist );
struct playlist_services_discovery_support_t * p_sds = NULL;
- int i;
PL_LOCK;
- for( i = 0 ; i< pl_priv(p_playlist)->i_sds ; i ++ )
+ for( int i = 0; i < priv->i_sds; i++ )
{
- if( !strcmp( psz_module, module_get_object( pl_priv(p_playlist)->pp_sds[i]->p_sd->p_module ) ) )
+ if( !strcmp( psz_name, priv->pp_sds[i]->psz_name ) )
{
- p_sds = pl_priv(p_playlist)->pp_sds[i];
- REMOVE_ELEM( pl_priv(p_playlist)->pp_sds, pl_priv(p_playlist)->i_sds, i );
+ p_sds = priv->pp_sds[i];
+ REMOVE_ELEM( priv->pp_sds, priv->i_sds, i );
break;
}
}
if( !p_sds )
{
- msg_Warn( p_playlist, "module %s is not loaded", psz_module );
+ msg_Warn( p_playlist, "discovery %s is not loaded", psz_name );
return VLC_EGENERIC;
}
PL_UNLOCK;
vlc_sd_Destroy( p_sd );
+ free( p_sds->psz_name );
free( p_sds );
return VLC_SUCCESS;
}
bool playlist_IsServicesDiscoveryLoaded( playlist_t * p_playlist,
- const char *psz_module )
+ const char *psz_name )
{
- int i;
+ playlist_private_t *priv = pl_priv( p_playlist );
+ bool found = false;
PL_LOCK;
- for( i = 0 ; i< pl_priv(p_playlist)->i_sds ; i ++ )
+ for( int i = 0; i < priv->i_sds; i++ )
{
- if( !strcmp( psz_module, module_get_object( pl_priv(p_playlist)->pp_sds[i]->p_sd->p_module ) ) )
+ vlc_sd_internal_t *sd = priv->pp_sds[i];
+
+ if( sd->psz_name && !strcmp( psz_name, sd->psz_name ) )
{
- PL_UNLOCK;
- return true;
+ found = true;
+ break;
}
}
PL_UNLOCK;
- return false;
+ return found;
}
void playlist_ServicesDiscoveryKillAll( playlist_t *p_playlist )
{
- while( pl_priv(p_playlist)->i_sds > 0 )
+ playlist_private_t *priv = pl_priv( p_playlist );
+
+ while( priv->i_sds > 0 )
playlist_ServicesDiscoveryRemove( p_playlist,
- module_get_object( pl_priv(p_playlist)->pp_sds[0]->p_sd->p_module ) );
+ priv->pp_sds[0]->psz_name );
}
free( psz_filter_chain );
}
- if( p_vout->fmt_render.i_chroma != p_fmt->i_chroma ||
+ if( p_vout->fmt_render.i_chroma != vlc_fourcc_GetCodec( VIDEO_ES, p_fmt->i_chroma ) ||
p_vout->fmt_render.i_width != p_fmt->i_width ||
p_vout->fmt_render.i_height != p_fmt->i_height ||
p_vout->p->b_filter_change )
unsigned int i_width = p_fmt->i_width;
unsigned int i_height = p_fmt->i_height;
- vlc_fourcc_t i_chroma = p_fmt->i_chroma;
+ vlc_fourcc_t i_chroma = vlc_fourcc_GetCodec( VIDEO_ES, p_fmt->i_chroma );
unsigned int i_aspect = p_fmt->i_aspect;
config_chain_t *p_cfg;
if( !vout_ChromaCmp( p_output->i_chroma, p_render->i_chroma ) )
return false;
- if( p_output->i_chroma != FOURCC_RV15 &&
- p_output->i_chroma != FOURCC_RV16 &&
- p_output->i_chroma != FOURCC_RV24 &&
- p_output->i_chroma != FOURCC_RV32 )
+ if( p_output->i_chroma != VLC_CODEC_RGB15 &&
+ p_output->i_chroma != VLC_CODEC_RGB16 &&
+ p_output->i_chroma != VLC_CODEC_RGB24 &&
+ p_output->i_chroma != VLC_CODEC_RGB32 )
return true;
return p_output->i_rmask == p_render->i_rmask &&
}
}
- /* Link pictures back to their heap */
- for( i = 0 ; i < I_RENDERPICTURES ; i++ )
- {
- PP_RENDERPICTURE[ i ]->p_heap = &p_vout->render;
- }
-
- for( i = 0 ; i < I_OUTPUTPICTURES ; i++ )
- {
- PP_OUTPUTPICTURE[ i ]->p_heap = &p_vout->output;
- }
-
return VLC_SUCCESS;
}
const deinterlace_mode_t *p_mode;
for( p_mode = &p_deinterlace_mode[0]; p_mode->psz_mode; p_mode++ )
{
- if( !strcmp( p_mode->psz_mode, newval.psz_string ?: "" ) )
+ if( !strcmp( p_mode->psz_mode,
+ newval.psz_string ? newval.psz_string : "" ) )
break;
}
if( !p_mode->psz_mode )
else if( DeinterlaceIsPresent( p_vout, false ) )
psz_mode = var_CreateGetNonEmptyString( p_vout, "sout-deinterlace-mode" );
}
- var_SetString( p_vout, "deinterlace", psz_mode ?: "" );
+ var_SetString( p_vout, "deinterlace", psz_mode ? psz_mode : "" );
free( psz_mode );
}