Commit ff2901af authored by Romain Vimont's avatar Romain Vimont Committed by Jean-Baptiste Kempf

core: remove global *_sys_t typedefs

Do not declare *_sys_t typedefs globally in vlc_common.h. Instead,
declare them locally in each module that provides a definition.

This paves the way to move C++ definitions into anonymous namespaces in
order to respect C++ ODR.

The picture_resource_t and sout_stream_id_sys_t typedefs will be handled
separately, since they require specific additional changes.

See #18033
Signed-off-by: Jean-Baptiste Kempf's avatarJean-Baptiste Kempf <jb@videolan.org>
parent 1bbd0eb5
......@@ -338,7 +338,6 @@ typedef struct date_t date_t;
typedef struct playlist_t playlist_t;
typedef struct playlist_item_t playlist_item_t;
typedef struct services_discovery_t services_discovery_t;
typedef struct services_discovery_sys_t services_discovery_sys_t;
typedef struct vlc_renderer_discovery_t vlc_renderer_discovery_t;
typedef struct vlc_renderer_item_t vlc_renderer_item_t;
......@@ -352,14 +351,10 @@ typedef struct config_category_t config_category_t;
typedef struct input_thread_t input_thread_t;
typedef struct input_item_t input_item_t;
typedef struct input_item_node_t input_item_node_t;
typedef struct access_sys_t access_sys_t;
typedef struct stream_t stream_t;
typedef struct stream_sys_t stream_sys_t;
typedef struct stream_t demux_t;
typedef struct demux_sys_t demux_sys_t;
typedef struct es_out_t es_out_t;
typedef struct es_out_id_t es_out_id_t;
typedef struct es_out_sys_t es_out_sys_t;
typedef struct seekpoint_t seekpoint_t;
typedef struct info_t info_t;
typedef struct info_category_t info_category_t;
......@@ -374,7 +369,6 @@ typedef struct video_palette_t video_palette_t;
/* Audio */
typedef struct audio_output audio_output_t;
typedef struct aout_sys_t aout_sys_t;
typedef audio_format_t audio_sample_format_t;
/* Video */
......@@ -399,29 +393,23 @@ typedef struct sout_input_t sout_input_t;
typedef struct sout_packetizer_input_t sout_packetizer_input_t;
typedef struct sout_access_out_t sout_access_out_t;
typedef struct sout_access_out_sys_t sout_access_out_sys_t;
typedef struct sout_mux_t sout_mux_t;
typedef struct sout_mux_sys_t sout_mux_sys_t;
typedef struct sout_stream_t sout_stream_t;
typedef struct sout_stream_sys_t sout_stream_sys_t;
typedef struct config_chain_t config_chain_t;
typedef struct session_descriptor_t session_descriptor_t;
/* Decoders */
typedef struct decoder_t decoder_t;
typedef struct decoder_sys_t decoder_sys_t;
typedef struct decoder_synchro_t decoder_synchro_t;
/* Encoders */
typedef struct encoder_t encoder_t;
typedef struct encoder_sys_t encoder_sys_t;
/* Filters */
typedef struct filter_t filter_t;
typedef struct filter_sys_t filter_sys_t;
/* Network */
typedef struct vlc_url_t vlc_url_t;
......@@ -438,13 +426,10 @@ typedef struct md5_s md5_t;
/* XML */
typedef struct xml_t xml_t;
typedef struct xml_sys_t xml_sys_t;
typedef struct xml_reader_t xml_reader_t;
typedef struct xml_reader_sys_t xml_reader_sys_t;
/* vod server */
typedef struct vod_t vod_t;
typedef struct vod_sys_t vod_sys_t;
typedef struct vod_media_t vod_media_t;
/* VLM */
......
......@@ -122,7 +122,7 @@ static void DumpDeviceStatus (vlc_object_t *obj, snd_pcm_t *pcm)
#define DumpDeviceStatus(o, p) DumpDeviceStatus(VLC_OBJECT(o), p)
struct demux_sys_t
typedef struct
{
snd_pcm_t *pcm;
es_out_id_t *es;
......@@ -132,7 +132,7 @@ struct demux_sys_t
mtime_t caching;
snd_pcm_uframes_t period_size;
unsigned rate;
};
} demux_sys_t;
static void Poll (snd_pcm_t *pcm, int canc)
{
......
......@@ -58,11 +58,11 @@ static ssize_t Read(stream_t *, void *, size_t);
static int Seek(stream_t *, uint64_t);
static int Control(stream_t *, int, va_list);
struct access_sys_t
typedef struct
{
input_attachment_t *attachment;
size_t offset;
};
} access_sys_t;
/* */
static int Open(vlc_object_t *object)
......
......@@ -228,7 +228,7 @@ didOutputSampleBuffer:(CMSampleBufferRef)sampleBuffer
* Struct
*****************************************************************************/
struct demux_sys_t
typedef struct demux_sys_t
{
CFTypeRef _Nullable session; // AVCaptureSession
CFTypeRef _Nullable device; // AVCaptureDevice
......@@ -237,7 +237,7 @@ struct demux_sys_t
es_format_t fmt;
int height, width;
BOOL b_es_setup;
};
} demux_sys_t;
/*****************************************************************************
* Open:
......
......@@ -65,15 +65,16 @@ static int UrlInterruptCallback(void *access)
return vlc_killed();
}
struct access_sys_t
typedef struct
{
AVIOContext *context;
int64_t size;
};
} access_sys_t;
struct sout_access_out_sys_t {
typedef struct
{
AVIOContext *context;
};
} sout_access_out_sys_t;
/* */
......
......@@ -145,7 +145,7 @@ typedef struct bluray_overlay_t
struct subpicture_updater_sys_t *p_updater;
} bluray_overlay_t;
struct demux_sys_t
typedef struct
{
BLURAY *bluray;
......@@ -200,7 +200,7 @@ struct demux_sys_t
/* Used to store bluray disc path */
char *psz_bd_path;
};
} demux_sys_t;
struct subpicture_updater_sys_t
{
......@@ -921,9 +921,10 @@ static void blurayClose(vlc_object_t *object)
* Elementary streams handling
*****************************************************************************/
struct es_out_sys_t {
typedef struct
{
demux_t *p_demux;
};
} es_out_sys_t;
typedef struct fmt_es_pair {
int i_id;
......
......@@ -115,7 +115,7 @@ static vcddev_t *DiscOpen(vlc_object_t *obj, const char *location,
/* how many blocks Demux() will read in each iteration */
#define CDDA_BLOCKS_ONCE 20
struct demux_sys_t
typedef struct
{
vcddev_t *vcddev; /* vcd device descriptor */
es_out_id_t *es;
......@@ -124,7 +124,7 @@ struct demux_sys_t
unsigned start; /**< Track first sector */
unsigned length; /**< Track total sectors */
unsigned position; /**< Current offset within track sectors */
};
} demux_sys_t;
static int Demux(demux_t *demux)
{
......@@ -269,7 +269,7 @@ error:
/*****************************************************************************
* Access: local prototypes
*****************************************************************************/
struct access_sys_t
typedef struct
{
vcddev_t *vcddev; /* vcd device descriptor */
int *p_sectors; /* Track sectors */
......@@ -279,7 +279,7 @@ struct access_sys_t
#ifdef HAVE_LIBCDDB
cddb_disc_t *cddb;
#endif
};
} access_sys_t;
#ifdef HAVE_LIBCDDB
static cddb_disc_t *GetCDDBInfo( vlc_object_t *obj, int i_titles, int *p_sectors )
......
......@@ -35,7 +35,7 @@ struct access_entry
char mrl[1];
};
struct access_sys_t
typedef struct
{
stream_t *access;
struct access_entry *next;
......@@ -46,7 +46,7 @@ struct access_sys_t
bool can_control_pace;
uint64_t size;
int64_t caching;
};
} access_sys_t;
static stream_t *GetAccess(stream_t *access)
{
......
......@@ -54,7 +54,7 @@ vlc_module_begin()
set_callbacks( Open, Close )
vlc_module_end()
struct demux_sys_t
typedef struct
{
/* camera info */
dc1394_t *p_dccontext;
......@@ -77,7 +77,7 @@ struct demux_sys_t
unsigned int focus;
es_out_id_t *p_es_video;
dc1394video_frame_t *frame;
};
} demux_sys_t;
/*****************************************************************************
* Local prototypes
......
......@@ -42,11 +42,11 @@
#include <vlc_fs.h>
#include <vlc_url.h>
struct access_sys_t
typedef struct
{
char *base_uri;
DIR *dir;
};
} access_sys_t;
/*****************************************************************************
* DirInit: Init the directory access with a directory stream
......
......@@ -33,6 +33,8 @@
#include <wrl/client.h>
using Microsoft::WRL::ComPtr;
typedef struct demux_sys_t demux_sys_t;
/****************************************************************************
* Crossbar stuff
****************************************************************************/
......@@ -47,6 +49,8 @@ struct CrossbarRoute
LONG AudioOutputIndex;
};
struct access_sys_t;
void DeleteCrossbarRoutes( access_sys_t * );
HRESULT FindCrossbarRoutes( vlc_object_t *, access_sys_t *,
IPin *, LONG, int = 0 );
......
......@@ -51,11 +51,11 @@ struct entry_item
input_item_t *p_item;
};
struct services_discovery_sys_t
typedef struct
{
netbios_ns *p_ns;
vlc_array_t entry_item_list;
};
} services_discovery_sys_t;
static void entry_item_append( services_discovery_t *p_sd,
netbios_ns_entry *p_entry,
......
......@@ -426,12 +426,12 @@ vlc_module_begin ()
#endif
vlc_module_end ()
struct access_sys_t
typedef struct
{
dvb_device_t *dev;
uint8_t signal_poll;
tuner_setup_t pf_setup;
};
} access_sys_t;
static block_t *Read (stream_t *, bool *);
static int Control (stream_t *, int, va_list);
......
......@@ -92,7 +92,7 @@ static int AVCPlay( stream_t *, int );
static int AVCPause( stream_t *, int );
static int AVCStop( stream_t *, int );
struct access_sys_t
typedef struct
{
raw1394handle_t p_avc1394;
raw1394handle_t p_raw1394;
......@@ -108,7 +108,7 @@ struct access_sys_t
event_thread_t *p_ev;
vlc_mutex_t lock;
block_t *p_frame;
};
} access_sys_t;
#define ISOCHRONOUS_QUEUE_LENGTH 1000
#define ISOCHRONOUS_MAX_PACKET_SIZE 4096
......
......@@ -47,7 +47,7 @@
#include "dvb.h"
#include "scan.h"
struct access_sys_t
typedef struct
{
demux_handle_t p_demux_handles[MAX_DEMUX];
dvb_sys_t dvb;
......@@ -55,7 +55,7 @@ struct access_sys_t
/* Scan */
struct scan_t *scan;
bool done;
};
} access_sys_t;
/*****************************************************************************
* Module descriptor
......
......@@ -120,7 +120,7 @@ vlc_module_end ()
/*****************************************************************************
* Local prototypes
*****************************************************************************/
struct demux_sys_t
typedef struct
{
dvdnav_t *dvdnav;
......@@ -165,7 +165,7 @@ struct demux_sys_t
mtime_t i_pgc_length;
int i_vobu_index;
int i_vobu_flush;
};
} demux_sys_t;
static int Control( demux_t *, int, va_list );
static int Demux( demux_t * );
......
......@@ -92,7 +92,7 @@ vlc_module_end ()
* Local prototypes
*****************************************************************************/
struct demux_sys_t
typedef struct
{
/* DVDRead state */
dvd_reader_t *p_dvdread;
......@@ -145,7 +145,7 @@ struct demux_sys_t
/* SPU */
uint32_t clut[16];
};
} demux_sys_t;
static int Control ( demux_t *, int, va_list );
static int Demux ( demux_t * );
......
......@@ -64,12 +64,12 @@
#include <vlc_url.h>
#include <vlc_interrupt.h>
struct access_sys_t
typedef struct
{
int fd;
bool b_pace_control;
};
} access_sys_t;
#if !defined (_WIN32) && !defined (__OS2__)
static bool IsRemote (int fd)
......
......@@ -107,6 +107,9 @@ vlc_module_end ()
/*****************************************************************************
* Local prototypes
*****************************************************************************/
typedef struct access_sys_t access_sys_t;
static ssize_t Read( stream_t *, void *, size_t );
static int Seek( stream_t *, uint64_t );
static int Control( stream_t *, int, va_list );
......
......@@ -79,7 +79,7 @@ vlc_module_end ()
* Local prototypes
*****************************************************************************/
struct access_sys_t
typedef struct
{
int fd;
......@@ -115,7 +115,7 @@ struct access_sys_t
bool b_reconnect;
bool b_has_size;
};
} access_sys_t;
/* */
static ssize_t Read( stream_t *, void *, size_t );
......
......@@ -38,11 +38,11 @@
#include "file.h"
#include "live.h"
struct access_sys_t
typedef struct
{
struct vlc_http_mgr *manager;
struct vlc_http_resource *resource;
};
} access_sys_t;
static block_t *FileRead(stream_t *access, bool *restrict eof)
{
......
......@@ -60,11 +60,11 @@ static int DemuxHold( demux_t *demux )
return 1;
}
struct demux_sys_t
typedef struct
{
mtime_t end;
mtime_t length;
};
} demux_sys_t;
static int DemuxPause( demux_t *demux )
{
......
......@@ -28,14 +28,14 @@
#include <vlc_access.h>
#include <vlc_plugin.h>
struct access_sys_t
typedef struct
{
void *opaque;
ssize_t (*read_cb)(void *, unsigned char *, size_t);
int (*seek_cb)(void *, uint64_t);
void (*close_cb)(void *);
uint64_t size;
};
} access_sys_t;
static ssize_t Read(stream_t *access, void *buf, size_t len)
{
......
......@@ -306,7 +306,7 @@ static int OpenAccess(vlc_object_t *object)
access->pf_read = NULL;
access->pf_block = Block;
access->pf_seek = NULL;
access->p_sys = (access_sys_t*)sys;
access->p_sys = sys;
return VLC_SUCCESS;
}
......@@ -495,7 +495,7 @@ static int OpenDemux(vlc_object_t *object)
/* */
demux->pf_control = ControlDemux;
demux->pf_demux = Demux;
demux->p_sys = (demux_sys_t*)sys;
demux->p_sys = sys;
return VLC_SUCCESS;
}
......
......@@ -83,7 +83,7 @@ vlc_module_end ()
* Local prototypes
*****************************************************************************/
struct demux_sys_t
typedef struct
{
/* Audio properties */
vlc_fourcc_t i_acodec_raw;
......@@ -106,7 +106,7 @@ struct demux_sys_t
char *psz_ports;
char **pp_jack_port_table;
char i_match_ports;
};
} demux_sys_t;
static int Demux( demux_t * );
static int Control( demux_t *p_demux, int i_query, va_list args );
......
......@@ -121,7 +121,7 @@ typedef struct hdsdi_audio_t
es_out_id_t *p_es;
} hdsdi_audio_t;
struct demux_sys_t
typedef struct
{
/* video device reader */
int i_vfd;
......@@ -157,7 +157,7 @@ struct demux_sys_t
pthread_t thread;
int evfd;
};
} demux_sys_t;
static int Control( demux_t *, int, va_list );
static void *Demux( void * );
......
......@@ -146,7 +146,7 @@ enum {
STATE_SYNC,
};
struct demux_sys_t
typedef struct
{
/* device reader */
int i_fd;
......@@ -186,7 +186,7 @@ struct demux_sys_t
es_out_id_t *p_es_video;
sdi_audio_t p_audios[MAX_AUDIOS];
es_out_id_t *p_es_telx;
};
} demux_sys_t;
static int Control( demux_t *, int, va_list );
static int DemuxControl( demux_t *, int, va_list );
......
......@@ -80,10 +80,10 @@ vlc_module_end ()
/*****************************************************************************
* Local prototypes
*****************************************************************************/
struct access_sys_t
typedef struct
{
int i_proto;
};
} access_sys_t;
/*****************************************************************************
* Open:
......
......@@ -40,7 +40,7 @@ typedef struct
} chunk_t;
#define BUFFER_SIZE 65536
struct access_sys_t
typedef struct
{
int i_proto;
......@@ -69,6 +69,6 @@ struct access_sys_t
asf_header_t asfh;
guid_t guid;
};
} access_sys_t;
#endif
......@@ -34,7 +34,7 @@
#define MMS_BUFFER_SIZE 100000
struct access_sys_t
typedef struct
{
int i_proto; /* MMS_PROTO_TCP, MMS_PROTO_UDP */
int i_handle_tcp; /* TCP socket for communication with server */
......@@ -100,6 +100,6 @@ struct access_sys_t
vlc_mutex_t lock_netwrite;
bool b_keep_alive;
vlc_thread_t keep_alive;
};
} access_sys_t;
#endif
......@@ -64,7 +64,7 @@ vlc_module_begin()
set_callbacks(Open, Close)
vlc_module_end()
struct access_sys_t
typedef struct