Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • videolan/vlc
  • chouquette/vlc
  • bakiewicz.marek122/vlc
  • devnexen/vlc
  • rohanrajpal/vlc
  • blurrrb/vlc
  • gsoc/gsoc2019/darkapex/vlc
  • b1ue/vlc
  • fkuehne/vlc
  • magsoft/vlc
  • chub/vlc
  • cramiro9/vlc
  • robUx4/vlc
  • rom1v/vlc
  • akshayaky/vlc
  • tmk907/vlc
  • akymaster/vlc
  • govind.sharma/vlc
  • psilokos/vlc
  • xjbeta/vlc
  • jahan/vlc
  • 1480c1/vlc
  • amanchande/vlc
  • aaqib/vlc
  • rist/vlc
  • apol/vlc
  • mindfreeze/vlc
  • alexandre-janniaux/vlc
  • sandsmark/vlc
  • jagannatharjun/vlc
  • gsoc/gsoc2020/matiaslgonzalez/vlc
  • gsoc/gsoc2020/jagannatharjun/vlc
  • mstorsjo/vlc
  • gsoc/gsoc2020/vedenta/vlc
  • gsoc/gsoc2020/arnav-ishaan/vlc
  • gsoc/gsoc2020/andreduong/vlc
  • fuzun/vlc
  • gsoc/gsoc2020/vatsin/vlc
  • gsoc/gsoc2020/sagid/vlc
  • yaron/vlc
  • Phoenix/vlc
  • Garf/vlc
  • ePiratWorkarounds/vlc
  • tguillem/vlc
  • jnqnfe/vlc
  • mdc/vlc
  • Vedaa/vlc
  • rasa/vlc
  • quink/vlc
  • yealo/vlc
  • aleksey_ak/vlc
  • ePirat/vlc
  • ilya.yanok/vlc
  • asenat/vlc
  • m/vlc
  • bunjee/vlc
  • BLumia/vlc
  • sagudev/vlc
  • hamedmonji30/vlc
  • nullgemm/vlc
  • DivyamAhuja/vlc
  • thesamesam/vlc
  • dag7/vlc
  • snehil101/vlc
  • haasn/vlc
  • jbk/vlc
  • ValZapod/vlc
  • mfkl/vlc
  • WangChuan/vlc
  • core1024/vlc
  • GhostVaibhav/vlc
  • dfuhrmann/vlc
  • davide.prade/vlc
  • tmatth/vlc
  • Courmisch/vlc
  • zouya/vlc
  • hpi/vlc
  • EwoutH/vlc
  • aleung27/vlc
  • hengwu0/vlc
  • saladin/vlc
  • ashuio/vlc
  • richselwood/vlc
  • verma16Ayush/vlc
  • chemicalflash/vlc
  • PoignardAzur/vlc
  • huangjieNT/vlc
  • Blake-Haydon/vlc
  • AnuthaDev/vlc
  • gsoc/gsoc2021/mpd/vlc
  • nicolas_lequec/vlc
  • sambassaly/vlc
  • thresh/vlc
  • bonniegong/vlc
  • myaashish/vlc
  • stavros.vagionitis/vlc
  • ileoo/vlc
  • louis-santucci/vlc
  • cchristiansen/vlc
  • sabyasachi07/vlc
  • AbduAmeen/vlc
  • ashishb0410/vlc
  • urbanhusky/vlc
  • davidepietrasanta/vlc
  • riksleutelstad/vlc
  • jeremyVignelles/vlc
  • komh/vlc
  • iamjithinjohn/vlc
  • JohannesKauffmann/vlc2
  • kunglao/vlc
  • natzberg/vlc
  • jill/vlc
  • cwendling/vlc
  • adufou/vlc
  • ErwanAirone/vlc
  • HasinduDilshan10/vlc
  • vagrantc/vlc
  • rafiv/macos-bigsur-icon
  • Aymeriic/vlc
  • saranshg20/vlc
  • metzlove24/vlc
  • linkfanel/vlc
  • Ds886/vlc
  • metehan-arslan/vlc
  • Skantes/vlc
  • kgsandundananjaya96/vlc
  • mitchcapper/vlc
  • advaitgupta/vlc
  • StefanBruens/vlc
  • ratajs/vlc
  • T.M.F.B.3761/vlc
  • m222059/vlc
  • casemerrick/vlc
  • joshuaword2alt/vlc
  • sjwaddy/vlc
  • dima/vlc
  • Ybalrid/vlc
  • umxprime/vlc
  • eschmidt/vlc
  • vannieuwenhuysenmichelle/vlc
  • badcf00d/vlc
  • wesinator/vlc
  • louis/vlc
  • xqq/vlc
  • EmperorYP7/vlc
  • NicoLiam/vlc
  • loveleen/vlc
  • rofferom/vlc
  • rbultje/vlc
  • TheUnamed/vlc
  • pratiksharma341/vlc
  • Saurab17/vlc
  • purist.coder/vlc
  • Shuicheng/vlc
  • mdrrubel292/vlc
  • silverbleu00/vlc
  • metif12/vlc
  • asher-m/vlc
  • jeffk/vlc
  • Brandonbr1/vlc
  • beautyyuyanli/vlc
  • rego21/vlc
  • muyangren907/vlc
  • collectionbylawrencejason/vlc
  • evelez/vlc
  • GSMgeeth/vlc
  • Oneric/vlc
  • TJ5/vlc
  • XuanTung95/vlc
  • darrenjenny21/vlc
  • Trenly/vlc
  • RockyTDR/vlc
  • mjakubowski/vlc
  • caprica/vlc
  • ForteFrankie/vlc
  • seannamiller19/vlc
  • junlon2006/vlc
  • kiwiren6666/vlc
  • iuseiphonexs/vlc
  • fenngtun/vlc
  • Rajdutt999/vlc
  • typx/vlc
  • leon.vitanos/vlc
  • robertogarci0938/vlc
  • gsoc/gsoc2022/luc65r/vlc-mpd
  • skeller/vlc
  • MCJack123/vlc
  • luc65r/vlc-mpd
  • popov895/vlc
  • claucambra/vlc
  • brad/vlc
  • matthewmurua88/vlc
  • Tomas8874/vlc
  • philenotfound/vlc
  • makita-do3/vlc
  • LZXCorp/vlc
  • mar0x/vlc
  • senojetkennedy0102/vlc
  • shaneb243/vlc
  • ahmadbader/vlc
  • rajduttcse26/vlc-audio-filters
  • Juniorzito8415/vlc
  • achernyakov/vlc
  • lucasjetgroup/vlc
  • pupdoggy666/vlc
  • gmde9363/vlc
  • alexnwayne/vlc
  • bahareebrahimi781/vlc
  • hamad633666/vlc
  • umghof3112/vlc
  • joe0199771874/vlc
  • Octocats66666666/vlc
  • jjm_223/vlc
  • btech10110.19/vlc
  • sunnykfc028/vlc-audio-filters
  • loic/vlc
  • nguyenminhducmx1/vlc
  • JanekKrueger/vlc
  • bstubbington2/vlc
  • rcombs/vlc
  • Ordissimo/vlc
  • king7532/vlc
  • noobsauce101/vlc
  • schong0525/vlc
  • myQwil/vlc
  • apisbg91/vlc
  • geeboy0101017/vlc
  • kim.faughey/vlc
  • nurupo/vlc
  • yyusea/vlc
  • 0711235879.khco/vlc
  • ialo/vlc
  • iloveyeye2/vlc
  • gdtdftdqtd/vlc
  • leandroconsiglio/vlc
  • AndyHTML2012/vlc
  • ncz/vlc
  • lucenticus/vlc
  • knr1931/vlc
  • kjoonlee/vlc
  • chandrakant100/vlc-qt
  • johge42/vlc
  • polter/vlc
  • hexchain/vlc
  • Tushwrld/vlc
  • mztea928/vlc
  • jbelloncastro/vlc
  • alvinhochun/vlc
  • ghostpiratecrow/vlc
  • ujjwaltwitx/vlc
  • alexsonarin06/vlc
  • adrianbon76/vlc
  • altsod/vlc
  • damien.lucas44/vlc
  • dmytrivtaisa/vlc
  • utk202/vlc
  • aaxhrj/vlc
  • thomas.hermes/vlc
  • structurenewworldorder/vlc
  • slomo/vlc
  • wantlamy/vlc
  • musc.o3cminc/vlc
  • thebarshablog/vlc
  • kerrick/vlc
  • kratos142518/vlc
  • leogps/vlc
  • vacantron/vlc
  • luna_koly/vlc
  • Ratio2/vlc
  • anuoshemohammad/vlc
  • apsun/vlc
  • aaa1115910/vlc
  • alimotmoyo/vlc
  • Ambossmann/vlc
  • Sam-LearnsToCode/vlc
  • Chilledheart/vlc
  • Labnann/vlc
  • ktcoooot1/vlc
  • mohit-marathe/vlc
  • johnddx/vlc
  • manstabuk/vlc
  • Omar-ahmed314/vlc
  • vineethkm/vlc
  • 9Enemi86/vlc
  • radoslav.m.panteleev/vlc
  • ashishami2002/vlc
  • Corbax/vlc
  • firnasahmed/vlc
  • pelayarmalam4/vlc
  • c0ff330k/vlc
  • shikhindahikar/vlc
  • l342723951/vlc
  • christianschwandner/vlc
  • douniwan5788/vlc
  • 7damian7/vlc
  • ferdnyc/vlc
  • f.ales1/vlc
  • pandagby/vlc
  • BaaBaa/vlc
  • jewe37/vlc
  • w00drow/vlc
  • russelltg/vlc
  • ironicallygod/vlc
  • soumyaDghosh/vlc
  • linzihao1999/vlc
  • deyayush6/vlc
  • mibi88/vlc
  • newabdallah10/vlc
  • jhorbincolombia/vlc
  • rimvihaqueshupto/vlc
  • andrewkhon98/vlc
  • fab78/vlc
  • lapaz17/vlc
  • amanna13/vlc
  • mdakram28/vlc
  • 07jw1980/vlc
  • sohamgupta/vlc
  • Eson-Jia1/vlc
  • Sumou/vlc
  • vikram-kangotra/vlc
  • chalice191/vlc
  • olivercalder/vlc
  • aaasg4001/vlc
  • zipdox/vlc
  • kwizart/vlc
  • Dragon-S/vlc
  • jdemeule/vlc
  • gabriel_lt/vlc
  • locutusofborg/vlc
  • sammirata/vlc-librist
  • another/vlc
  • Benjamin_Loison/vlc
  • ahmedmoselhi/vlc
  • petergaal/vlc
  • huynhsontung/vlc
  • dariusmihut/vlc
  • tvermaashutosh/vlc
  • buti/vlc
  • Niram7777/vlc
  • rohan-here/vlc
  • balaji-sivasakthi/vlc
  • rlindner81/vlc
  • Kakadus/vlc
  • djain/vlc
  • ABBurmeister/vlc
  • craighuggins/vlc
  • orbea/vlc
  • maxos/vlc
  • aakarshmj/vlc
  • kblaschke/vlc
  • ankitm/vlc
  • advait-0/vlc
  • mohak2003/vlc
  • yselkowitz/vlc
  • AZM999/vlc-azm
  • andrey.turkin/vlc
  • Disha-Baghel/vlc
  • nowrep/vlc
  • Apeng/vlc
  • Choucroute_melba/vlc
  • autra/vlc
  • eclipseo/vlc
  • fhuber/vlc
  • olafhering/vlc
  • sdasda7777/vlc
  • 1div0/vlc
  • skosnits/vlc-extended-playlist-support
  • dnicolson/vlc
  • Timshel/vlc
  • octopols/vlc
  • MangalK/vlc
  • nima64/vlc
  • misawai/vlc
  • Alexander-Wilms/vlc
  • Maxime2/vlc-fork-for-visualizer
  • ww/vlc
  • jeske/vlc
  • sgross-emlix/vlc
  • morenonatural/vlc
  • freakingLovesVLC/vlc
  • borisgolovnev/vlc
  • mpromonet/vlc
  • diogo.simao-marques/vlc
  • masstock/vlc
  • pratikpatel8982/vlc
  • hugok79/vlc
  • longervision/vlc
  • abhiudaysurya/vlc
  • rishabhgarg/vlc
  • tumic/vlc
  • cart/vlc
  • shubham442/vlc
  • Aditya692005/vlc
  • sammirata/vlc4
  • syrykh/vlc
  • Vvorcun/macos-new-icon
  • AyaanshC/vlc
  • nasso/vlc
  • Quark/vlc
  • sebastinas/vlc
  • rhstone/vlc
  • talregev/vlc
  • Managor/vlc
403 results
Show changes
Commits on Source (22)
Showing
with 146 additions and 165 deletions
......@@ -93,7 +93,7 @@ struct decoder_owner_callbacks
};
/*
* BIG FAT WARNING : the code relies in the first 4 members of filter_t
* BIG FAT WARNING : the code relies in the first 3 members of filter_t
* and decoder_t to be the same, so if you have anything to add, do it
* at the end of the structure.
*/
......
......@@ -143,18 +143,12 @@ struct vlc_filter_operations
void (*close)(filter_t *);
};
typedef int (*vlc_open_deinterlace)(filter_t *);
typedef int (*vlc_video_converter_open)(filter_t *);
typedef int (*vlc_video_filter_open)(filter_t *);
typedef int (*vlc_video_text_renderer_open)(filter_t *);
typedef int (*vlc_video_sub_filter_open)(filter_t *);
typedef int (*vlc_video_sub_source_open)(filter_t *);
typedef int (*vlc_video_blending_open)(filter_t *);
typedef int (*vlc_filter_open)(filter_t *);
#define set_deinterlace_callback( activate ) \
{ \
vlc_open_deinterlace open__ = activate; \
vlc_filter_open open__ = activate; \
(void) open__; \
set_callback(activate) \
} \
......@@ -163,7 +157,7 @@ typedef int (*vlc_video_blending_open)(filter_t *);
#define set_callback_video_filter( activate ) \
{ \
vlc_video_filter_open open__ = activate; \
vlc_filter_open open__ = activate; \
(void) open__; \
set_callback(activate) \
} \
......@@ -171,7 +165,7 @@ typedef int (*vlc_video_blending_open)(filter_t *);
#define set_callback_video_converter( activate, priority ) \
{ \
vlc_video_converter_open open__ = activate; \
vlc_filter_open open__ = activate; \
(void) open__; \
set_callback(activate) \
} \
......@@ -179,7 +173,7 @@ typedef int (*vlc_video_blending_open)(filter_t *);
#define set_callback_text_renderer( activate, priority ) \
{ \
vlc_video_text_renderer_open open__ = activate; \
vlc_filter_open open__ = activate; \
(void) open__; \
set_callback(activate) \
} \
......@@ -187,7 +181,7 @@ typedef int (*vlc_video_blending_open)(filter_t *);
#define set_callback_sub_filter( activate ) \
{ \
vlc_video_sub_filter_open open__ = activate; \
vlc_filter_open open__ = activate; \
(void) open__; \
set_callback(activate) \
} \
......@@ -195,7 +189,7 @@ typedef int (*vlc_video_blending_open)(filter_t *);
#define set_callback_sub_source( activate, priority ) \
{ \
vlc_video_sub_source_open open__ = activate; \
vlc_filter_open open__ = activate; \
(void) open__; \
set_callback(activate) \
} \
......@@ -203,14 +197,14 @@ typedef int (*vlc_video_blending_open)(filter_t *);
#define set_callback_video_blending( activate, priority ) \
{ \
vlc_video_blending_open open__ = activate; \
vlc_filter_open open__ = activate; \
(void) open__; \
set_callback(activate) \
} \
set_capability( "video blending", priority )
/** Structure describing a filter
* @warning BIG FAT WARNING : the code relies on the first 4 members of
* @warning BIG FAT WARNING : the code relies on the first 3 members of
* filter_t and decoder_t to be the same, so if you have anything to add,
* do it at the end of the structure.
*/
......@@ -243,10 +237,14 @@ struct filter_t
filter_owner_t owner;
};
static inline void filter_Close( filter_t *p_filter )
VLC_API module_t *vlc_filter_LoadModule(filter_t *, const char *cap,
const char *name, bool strict);
VLC_API void vlc_filter_UnloadModule(filter_t *);
static inline void vlc_filter_Delete(filter_t *p_filter)
{
if ( p_filter->ops->close )
p_filter->ops->close( p_filter );
vlc_filter_UnloadModule(p_filter);
vlc_object_delete(p_filter);
}
/**
......
......@@ -31,7 +31,6 @@
#include <vlc_common.h>
#include <vlc_plugin.h>
#include <vlc_modules.h> /* module_need for "video blending" */
#include <vlc_filter.h>
#include <vlc_url.h>
#include "screen.h"
......
......@@ -30,7 +30,6 @@
#include <vlc_common.h>
#include <vlc_plugin.h>
#include <vlc_modules.h> /* module_need for "video blending" */
#include <vlc_filter.h>
#include "screen.h"
......@@ -184,9 +183,7 @@ void screen_CloseCapture( void *opaque )
#ifdef SCREEN_MOUSE
if( p_data->p_blend )
{
filter_Close( p_data->p_blend );
module_unneed( p_data->p_blend, p_data->p_blend->p_module );
vlc_object_delete(p_data->p_blend);
vlc_filter_Delete( p_data->p_blend );
}
#endif
......@@ -310,7 +307,7 @@ static void RenderCursor( demux_t *p_demux, int i_x, int i_y,
p_data->p_blend->fmt_in.video = p_sys->p_mouse->format;
p_data->p_blend->fmt_out = p_sys->fmt;
p_data->p_blend->p_module =
module_need( p_data->p_blend, "video blending", NULL, false );
vlc_filter_LoadModule( p_data->p_blend, "video blending", NULL, false );
if( !p_data->p_blend->p_module )
{
msg_Err( p_demux, "Could not load video blending module" );
......
......@@ -541,9 +541,7 @@ static void ClosePitch( filter_t *p_filter )
vlc_object_t *p_aout = vlc_object_parent(p_filter);
var_DelCallback( p_aout, "pitch-shift", PitchCallback, p_sys );
var_Destroy( p_aout, "pitch-shift" );
filter_Close( p_sys->resampler );
module_unneed( p_sys->resampler, p_sys->resampler->p_module );
vlc_object_delete(p_sys->resampler);
vlc_filter_Delete( p_sys->resampler );
Close( p_filter );
}
#endif
......
......@@ -31,7 +31,6 @@
#include <vlc_common.h>
#include <vlc_filter.h>
#include <vlc_picture.h>
#include <vlc_modules.h>
#include <assert.h>
......@@ -460,11 +459,7 @@ static void D3D11_RGBA(filter_t *p_filter, picture_t *src, picture_t *dst)
static void DeleteFilter( filter_t * p_filter )
{
if( p_filter->p_module )
{
filter_Close( p_filter );
module_unneed( p_filter, p_filter->p_module );
}
vlc_filter_UnloadModule( p_filter );
es_format_Clean( &p_filter->fmt_in );
es_format_Clean( &p_filter->fmt_out );
......@@ -503,7 +498,7 @@ static filter_t *CreateCPUtoGPUFilter( filter_t *p_this, const es_format_t *p_fm
es_format_InitFromVideo( &p_filter->fmt_in, &p_fmt_in->video );
es_format_InitFromVideo( &p_filter->fmt_out, &p_fmt_in->video );
p_filter->fmt_out.i_codec = p_filter->fmt_out.video.i_chroma = dst_chroma;
p_filter->p_module = module_need( p_filter, "video converter", NULL, false );
p_filter->p_module = vlc_filter_LoadModule( p_filter, "video converter", NULL, false );
if( !p_filter->p_module )
{
......
......@@ -31,7 +31,6 @@
#include <vlc_common.h>
#include <vlc_filter.h>
#include <vlc_picture.h>
#include <vlc_modules.h>
#include "d3d9_filters.h"
......@@ -169,11 +168,7 @@ static void DXA9_NV12(filter_t *p_filter, picture_t *src, picture_t *dst)
static void DeleteFilter( filter_t * p_filter )
{
if( p_filter->p_module )
{
filter_Close( p_filter );
module_unneed( p_filter, p_filter->p_module );
}
vlc_filter_UnloadModule( p_filter );
es_format_Clean( &p_filter->fmt_in );
es_format_Clean( &p_filter->fmt_out );
......@@ -212,7 +207,7 @@ static filter_t *CreateFilter( filter_t *p_this, const es_format_t *p_fmt_in,
es_format_InitFromVideo( &p_filter->fmt_in, &p_fmt_in->video );
es_format_InitFromVideo( &p_filter->fmt_out, &p_fmt_in->video );
p_filter->fmt_out.i_codec = p_filter->fmt_out.video.i_chroma = dst_chroma;
p_filter->p_module = module_need( p_filter, "video converter", NULL, false );
p_filter->p_module = vlc_filter_LoadModule (p_filter, "video converter", NULL, false );
if( !p_filter->p_module )
{
......
......@@ -32,7 +32,6 @@
#include <vlc_configuration.h>
#include <vlc_plugin.h>
#include <vlc_sout.h>
#include <vlc_modules.h>
#include <vlc_filter.h>
#include <vlc_picture.h>
......@@ -243,7 +242,7 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_pic )
}
p_blend->fmt_out.video = p_sys->p_base_image->format;
p_blend->fmt_in.video = p_sys->p_blend_image->format;
p_blend->p_module = module_need( p_blend, "video blending", NULL, false );
p_blend->p_module = vlc_filter_LoadModule( p_blend, "video blending", NULL, false );
if( !p_blend->p_module )
{
picture_Release( p_pic );
......@@ -268,10 +267,7 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_pic )
p_sys->p_blend_image->p[Y_PLANE].i_visible_pitch *
p_sys->p_blend_image->p[Y_PLANE].i_visible_lines );
filter_Close( p_blend );
module_unneed( p_blend, p_blend->p_module );
vlc_object_delete(p_blend);
vlc_filter_Delete( p_blend );
p_sys->b_done = true;
return p_pic;
......
......@@ -31,7 +31,6 @@
#include <vlc_filter.h>
#include <vlc_picture.h>
#include <vlc_plugin.h>
#include <vlc_modules.h>
#include <vlc_mouse.h>
#include "filter_picture.h"
#include "vt_utils.h"
......@@ -530,15 +529,11 @@ cvpx_video_context_Destroy(void *priv)
if (ctx->src_converter)
{
filter_Close( ctx->src_converter );
module_unneed(ctx->src_converter, ctx->src_converter->p_module);
vlc_object_delete(ctx->src_converter);
vlc_filter_Delete( ctx->src_converter );
}
if (ctx->dst_converter)
{
filter_Close( ctx->dst_converter );
module_unneed(ctx->dst_converter, ctx->dst_converter->p_module);
vlc_object_delete(ctx->dst_converter);
vlc_filter_Delete( ctx->dst_converter );
}
if (ctx->cvpx_pool)
......@@ -566,7 +561,7 @@ CVPX_to_CVPX_converter_Create(filter_t *filter, bool to_rgba)
converter->fmt_in.i_codec = VLC_CODEC_CVPX_BGRA;
}
converter->p_module = module_need(converter, "video converter", NULL, false);
converter->p_module = vlc_filter_LoadModule(converter, "video converter", NULL, false);
if (!converter->p_module)
{
vlc_object_delete(converter);
......
......@@ -233,11 +233,9 @@ error:
return VLC_EGENERIC;
}
static int OpenVideoFilter(vlc_object_t *obj)
static int OpenVideoFilter(filter_t *filter)
{
filter_t *filter = (filter_t*)obj;
char *mode = var_InheritString(obj, "deinterlace-mode");
char *mode = var_InheritString(filter, "deinterlace-mode");
bool is_supported = !mode
|| !strcmp(mode, "auto")
|| !strcmp(mode, "blend");
......@@ -258,8 +256,7 @@ vlc_module_begin()
set_description("OpenGL blend deinterlace filter")
set_subcategory(SUBCAT_VIDEO_VFILTER)
set_capability("video filter", 0)
set_callback(OpenVideoFilter)
set_callback_video_filter(OpenVideoFilter)
add_shortcut("glblend")
add_submodule()
......
......@@ -266,9 +266,7 @@ static void Destroy( filter_t* p_filter )
ReleaseImages( p_filter );
// Release the internal OpenCV filter.
filter_Close( p_sys->p_opencv );
module_unneed( p_sys->p_opencv, p_sys->p_opencv->p_module );
vlc_object_delete(p_sys->p_opencv);
vlc_filter_Delete( p_sys->p_opencv );
free( p_sys );
}
......
......@@ -223,10 +223,8 @@ end:
#endif
}
static int OpenOpenGL(vlc_object_t *obj)
static int OpenOpenGL(filter_t *filter)
{
filter_t *filter = (filter_t *)obj;
filter_sys_t *sys
= filter->p_sys
= malloc(sizeof *sys);
......@@ -240,7 +238,7 @@ static int OpenOpenGL(vlc_object_t *obj)
struct vlc_decoder_device *device = filter_HoldDecoderDevice(filter);
sys->gl = CreateGL(obj, device, width, height);
sys->gl = CreateGL(VLC_OBJECT(filter), device, width, height);
/* The vlc_gl_t instance must have hold the device if it needs it. */
if (device)
......@@ -248,13 +246,13 @@ static int OpenOpenGL(vlc_object_t *obj)
if (sys->gl == NULL)
{
msg_Err(obj, "Failed to create opengl context");
msg_Err(filter, "Failed to create opengl context");
goto gl_create_failure;
}
if (vlc_gl_MakeCurrent (sys->gl) != VLC_SUCCESS)
{
msg_Err(obj, "Failed to gl make current");
msg_Err(filter, "Failed to gl make current");
assert(false);
goto make_current_failure;
}
......@@ -262,7 +260,7 @@ static int OpenOpenGL(vlc_object_t *obj)
struct vlc_gl_api *api = &sys->api;
if (vlc_gl_api_Init(api, sys->gl) != VLC_SUCCESS)
{
msg_Err(obj, "Failed to init vlc_gl_api");
msg_Err(filter, "Failed to init vlc_gl_api");
goto gl_api_failure;
}
......@@ -270,7 +268,7 @@ static int OpenOpenGL(vlc_object_t *obj)
&filter->fmt_in.video);
if (!sys->interop)
{
msg_Err(obj, "Could not create interop");
msg_Err(filter, "Could not create interop");
goto gl_interop_failure;
}
......@@ -278,7 +276,7 @@ static int OpenOpenGL(vlc_object_t *obj)
var_InheritString(filter, OPENGL_CFG_PREFIX "filter");
if (!glfilters_config)
{
msg_Err(obj, "No filters requested");
msg_Err(filter, "No filters requested");
goto filter_config_failure;
}
......@@ -286,7 +284,7 @@ static int OpenOpenGL(vlc_object_t *obj)
sys->filters = vlc_gl_filters_New(sys->gl, api, sys->interop, ORIENT_NORMAL);
if (!sys->filters)
{
msg_Err(obj, "Could not create filters");
msg_Err(filter, "Could not create filters");
free(glfilters_config);
goto filters_new_failure;
}
......@@ -296,7 +294,7 @@ static int OpenOpenGL(vlc_object_t *obj)
ret = LoadFilters(sys, glfilters_config);
if (ret != VLC_SUCCESS)
{
msg_Err(obj, "Could not load filters: %s", glfilters_config);
msg_Err(filter, "Could not load filters: %s", glfilters_config);
free(glfilters_config);
goto filters_load_failure;
}
......@@ -314,7 +312,7 @@ static int OpenOpenGL(vlc_object_t *obj)
ret = vlc_gl_filters_InitFramebuffers(sys->filters);
if (ret != VLC_SUCCESS)
{
msg_Err(obj, "Could not init filters framebuffers");
msg_Err(filter, "Could not init filters framebuffers");
goto init_framebuffer_failure;
}
......@@ -365,9 +363,8 @@ vlc_module_begin()
set_shortname( N_("opengl") )
set_description( N_("Opengl filter executor") )
set_subcategory( SUBCAT_VIDEO_VFILTER )
set_capability( "video filter", 1 )
add_shortcut( "opengl" )
set_callback( OpenOpenGL )
set_callback_video_filter( OpenOpenGL )
add_module_list( "opengl-filter", "opengl filter", NULL,
FILTER_LIST_TEXT, FILTER_LIST_LONGTEXT )
add_module( "opengl-gl", "opengl offscreen", "", "OpenGL provider",
......
......@@ -29,7 +29,6 @@
#include <vlc_common.h>
#include <vlc_filter.h>
#include <vlc_plugin.h>
#include <vlc_modules.h>
#include <vlc_vout_display.h>
#include <vlc_atomic.h>
......@@ -84,7 +83,7 @@ CreateCVPXConverter(vout_display_t *vd)
converter->fmt_out.video.i_chroma =
converter->fmt_out.i_codec = VLC_CODEC_CVPX_BGRA;
converter->p_module = module_need(converter, "video converter", NULL, false);
converter->p_module = vlc_filter_LoadModule(converter, "video converter", NULL, false);
if (!converter->p_module)
{
vlc_object_delete(converter);
......@@ -101,11 +100,7 @@ static void DeleteCVPXConverter( filter_t * p_converter )
if (!p_converter)
return;
if( p_converter->p_module )
{
filter_Close( p_converter );
module_unneed( p_converter, p_converter->p_module );
}
vlc_filter_UnloadModule( p_converter );
es_format_Clean( &p_converter->fmt_in );
es_format_Clean( &p_converter->fmt_out );
......
......@@ -215,7 +215,7 @@ vlc_gl_WrapOpenGLFilter(filter_t *filter, const char *opengl_filter_name)
var_SetString(filter, "opengl-filter", opengl_filter_name);
filter->p_cfg = NULL;
module_t *module = module_need(filter, "video filter", "opengl", true);
module_t *module = vlc_filter_LoadModule(filter, "video filter", "opengl", true);
filter->p_cfg = prev_chain;
var_Destroy(filter, "opengl-filter");
......
......@@ -124,13 +124,6 @@ static filter_t *FindResampler (vlc_object_t *obj,
return filter;
}
static void aout_FilterDestroy(filter_t *filter)
{
filter_Close(filter);
module_unneed(filter, filter->p_module);
vlc_object_delete(filter);
}
/**
* Destroys a chain of audio filters.
*/
......@@ -140,7 +133,7 @@ static void aout_FiltersPipelineDestroy(struct aout_filter *tab, unsigned n)
{
filter_t *p_filter = tab[i].f;
aout_FilterDestroy(p_filter);
vlc_filter_Delete(p_filter);
if (tab[i].vout != NULL)
vout_Close(tab[i].vout);
if (tab[i].clock != NULL)
......@@ -486,7 +479,7 @@ static int AppendFilter(vlc_object_t *obj, const char *type, const char *name,
max - 1, infmt, &filter->fmt_in.audio))
{
msg_Err (filter, "cannot add user %s \"%s\" (skipped)", type, name);
aout_FilterDestroy(filter);
vlc_filter_Delete(filter);
if (owner_sys.vout != NULL)
vout_Close(owner_sys.vout);
if (owner_sys.clock != NULL)
......
......@@ -26,7 +26,6 @@
#include <vlc_common.h>
#include <vlc_configuration.h>
#include <vlc_modules.h>
#include <vlc_aout.h>
#include "aout_internal.h"
......@@ -137,9 +136,7 @@ vlc_audio_meter_RemovePlugin(struct vlc_audio_meter *meter, vlc_audio_meter_plug
if (plugin->filter != NULL)
{
filter_Close(plugin->filter);
module_unneed(plugin->filter, plugin->filter->p_module);
vlc_object_delete(plugin->filter);
vlc_filter_Delete(plugin->filter);
}
if (plugin->cfg != NULL)
......@@ -167,9 +164,7 @@ vlc_audio_meter_Reset(struct vlc_audio_meter *meter, const audio_sample_format_t
{
if (plugin->filter != NULL)
{
filter_Close(plugin->filter);
module_unneed(plugin->filter, plugin->filter->p_module);
vlc_object_delete(plugin->filter);
vlc_filter_Delete(plugin->filter);
plugin->filter = NULL;
}
plugin->last_date = VLC_TICK_INVALID;
......
......@@ -135,6 +135,8 @@ filter_chain_ForEach
filter_ConfigureBlend
filter_DeleteBlend
filter_NewBlend
vlc_filter_LoadModule
vlc_filter_UnloadModule
FromCharset
vlc_find_iso639
vlc_http_auth_Init
......
......@@ -132,8 +132,7 @@ int filter_ConfigureBlend( vlc_blender_t *p_blend,
!video_format_IsSameChroma( &p_blend->fmt_in.video, p_src ) )
{
/* The chroma is not the same, we need to reload the blend module */
filter_Close( p_blend );
module_unneed( p_blend, p_blend->p_module );
vlc_filter_UnloadModule( p_blend );
p_blend->p_module = NULL;
}
......@@ -150,7 +149,7 @@ int filter_ConfigureBlend( vlc_blender_t *p_blend,
/* */
if( !p_blend->p_module )
p_blend->p_module = module_need( p_blend, "video blending", NULL, false );
p_blend->p_module = vlc_filter_LoadModule( p_blend, "video blending", NULL, false );
if( !p_blend->p_module )
return VLC_EGENERIC;
assert( p_blend->ops != NULL );
......@@ -170,13 +169,7 @@ int filter_Blend( vlc_blender_t *p_blend,
void filter_DeleteBlend( vlc_blender_t *p_blend )
{
if( p_blend->p_module )
{
filter_Close( p_blend );
module_unneed( p_blend, p_blend->p_module );
}
vlc_object_delete(p_blend);
vlc_filter_Delete( p_blend );
}
/* */
......
......@@ -33,6 +33,90 @@
#include <libvlc.h>
#include <assert.h>
module_t *vlc_filter_LoadModule(filter_t *p_filter, const char *capability,
const char *name, bool strict)
{
const bool b_force_backup = p_filter->obj.force; /* FIXME: remove this */
if (name == NULL || name[0] == '\0')
name = "any";
/* Find matching modules */
module_t **mods;
size_t strict_total;
ssize_t total = vlc_module_match(capability, name, strict,
&mods, &strict_total);
if (unlikely(total < 0))
return NULL;
struct vlc_logger *log = p_filter->obj.logger;
vlc_debug(log, "looking for %s module matching \"%s\": %zd candidates",
capability, name, total);
p_filter->p_module = NULL;
for (size_t i = 0; i < (size_t)total; i++) {
module_t *cand = mods[i];
int ret = VLC_EGENERIC;
vlc_filter_open cb = vlc_module_map(log, cand);
if (cb == NULL)
continue;
p_filter->p_module = cand;
p_filter->obj.force = i < strict_total;
ret = cb(p_filter);
if (ret == VLC_SUCCESS)
{
vlc_debug(log, "using %s module \"%s\"", capability,
module_get_object(cand));
assert( p_filter->ops != NULL );
break;
}
vlc_objres_clear(&p_filter->obj);
p_filter->p_module = NULL;
if (ret == VLC_ETIMEOUT)
break;
if (ret == VLC_ENOMEM)
{
free(mods);
return NULL;
}
}
if (p_filter->p_module == NULL)
vlc_debug(log, "no %s modules matched with name %s", capability, name);
free(mods);
if (p_filter->p_module != NULL) {
var_Create(p_filter, "module-name", VLC_VAR_STRING);
var_SetString(p_filter, "module-name", module_get_object(p_filter->p_module));
}
p_filter->obj.force = b_force_backup;
return p_filter->p_module;
}
void vlc_filter_UnloadModule(filter_t *p_filter)
{
if (likely(p_filter->p_module))
{
if ( p_filter->ops->close )
p_filter->ops->close( p_filter );
msg_Dbg(p_filter, "removing \"%s\" module \"%s\"", module_get_capability(p_filter->p_module),
module_get_object(p_filter->p_module));
var_Destroy(p_filter, "module-name");
p_filter->p_module = NULL;
}
vlc_objres_clear(&p_filter->obj);
}
typedef struct chained_filter_t
{
/* Public part of the filter structure */
......@@ -252,54 +336,13 @@ static filter_t *filter_chain_AppendInner( filter_chain_t *chain,
goto error;
module_name = name_chained;
}
else if (name == NULL || name[0] != '\0')
module_name = "any";
struct vlc_logger *logger = vlc_object_logger(chain->obj);
module_t **modules;
size_t strict_total;
ssize_t count = vlc_module_match(capability, module_name, name != NULL,
&modules, &strict_total);
filter->p_module =
vlc_filter_LoadModule(filter, capability, module_name, name != NULL);
if (count < 0)
{
free(name_chained);
goto error;
}
vlc_debug(logger, "looking for %s module matching \"%s\": %zd candidates",
capability, module_name, count);
free(name_chained);
int ret = VLC_ENOTSUP;
for (size_t i = 0; i < (size_t)count; ++i)
{
module_t *mod = modules[i];
int (*activate)(filter_t *) = vlc_module_map(logger, mod);
if (activate == NULL)
continue;
filter->p_module = mod;
filter->obj.force = i < strict_total;
ret = (*activate)(filter);
switch (ret)
{
case VLC_SUCCESS:
goto done;
case VLC_ENOMEM:
goto error;
default:
vlc_objres_clear(&filter->obj);
continue;
}
}
if (ret != VLC_SUCCESS)
if (filter->p_module == NULL)
goto error;
done:
assert( filter->ops != NULL );
vlc_list_append( &chained->node, &chain->filter_list );
vlc_mouse_Init( &chained->mouse );
......@@ -344,8 +387,7 @@ void filter_chain_DeleteFilter( filter_chain_t *chain, filter_t *filter )
/* Remove it from the chain */
vlc_list_remove( &chained->node );
filter_Close( filter );
module_unneed( filter, filter->p_module );
vlc_filter_UnloadModule( filter );
msg_Dbg( chain->obj, "Filter %p removed from chain", (void *)filter );
FilterDeletePictures( &chained->pending );
......
......@@ -768,7 +768,7 @@ static filter_t *CreateConverter( vlc_object_t *p_this,
p_filter->fmt_out.i_codec = p_fmt_out->i_chroma;
p_filter->vctx_in = p_vctx_in;
p_filter->p_module = module_need( p_filter, "video converter", NULL, false );
p_filter->p_module = vlc_filter_LoadModule( p_filter, "video converter", NULL, false );
if( !p_filter->p_module )
{
......@@ -783,11 +783,7 @@ static filter_t *CreateConverter( vlc_object_t *p_this,
static void DeleteConverter( filter_t * p_filter )
{
if( p_filter->p_module )
{
filter_Close( p_filter );
module_unneed( p_filter, p_filter->p_module );
}
vlc_filter_UnloadModule( p_filter );
es_format_Clean( &p_filter->fmt_in );
es_format_Clean( &p_filter->fmt_out );
......