[vlc-commits] mtp: use a temporary file descriptor
vlc | branch: master | Rémi Denis-Courmont| Sat Feb 25 09:55:26 2017 +0200| [92e2c27a227c3f97f658d1c0aaedbacd15af9cc4] | committer: Rémi Denis-Courmont mtp: use a temporary file descriptor This fixes insecure use of tempnam(), fixes a potential file leak onto the filesystem and simplifies the code. > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=92e2c27a227c3f97f658d1c0aaedbacd15af9cc4 --- modules/access/mtp.c | 86 +--- 1 file changed, 21 insertions(+), 65 deletions(-) diff --git a/modules/access/mtp.c b/modules/access/mtp.c index 6f90453..65c1624 100644 --- a/modules/access/mtp.c +++ b/modules/access/mtp.c @@ -71,8 +71,6 @@ static int Seek( access_t *, uint64_t ); static ssize_t Read( access_t *, void *, size_t ); static int Control( access_t *, int, va_list ); -static int open_file( access_t *, const char * ); - /* * Open: open the file */ @@ -84,18 +82,16 @@ static int Open( vlc_object_t *p_this ) uint16_t i_product_id; int i_track_id; LIBMTP_raw_device_t *p_rawdevices; -LIBMTP_mtpdevice_t *p_device; int i_numrawdevices; -int i_ret; if( sscanf( p_access->psz_location, "%"SCNu32":%"SCNu8":%"SCNu16":%d", _bus, _dev, _product_id, _track_id ) != 4 ) return VLC_EGENERIC; -i_ret = LIBMTP_Detect_Raw_Devices( _rawdevices, _numrawdevices ); -if( i_ret != 0 || i_numrawdevices <= 0 || !p_rawdevices ) + +if( LIBMTP_Detect_Raw_Devices( _rawdevices, _numrawdevices ) ) return VLC_EGENERIC; -char *path; +int fd = -1; for( int i = 0; i < i_numrawdevices; i++ ) { @@ -103,46 +99,30 @@ static int Open( vlc_object_t *p_this ) i_dev == p_rawdevices[i].devnum && i_product_id == p_rawdevices[i].device_entry.product_id ) { -if( ( p_device = LIBMTP_Open_Raw_Device( _rawdevices[i] ) -) != NULL ) -{ -#warning Oooh no! Not tempnam()! -path = tempnam( NULL, "vlc" ); -if( path == NULL ) -{ -LIBMTP_Release_Device( p_device ); -free( p_rawdevices ); -return VLC_ENOMEM; -} -else -{ -msg_Dbg( p_access, "About to write %s", path ); -LIBMTP_Get_File_To_File( p_device, i_track_id, path, - NULL, NULL ); -LIBMTP_Release_Device( p_device ); -i = i_numrawdevices; -} -} -else -{ -free( p_rawdevices ); -return VLC_EGENERIC; -} +LIBMTP_mtpdevice_t *p_device; + +p_device = LIBMTP_Open_Raw_Device( _rawdevices[i] ); +if( p_device == NULL ) +break; + +fd = vlc_memfd(); +if( unlikely(fd == -1) ) +break; + +msg_Dbg( p_access, "copying to memory" ); +LIBMTP_Get_File_To_File_Descriptor( p_device, i_track_id, fd, +NULL, NULL ); +LIBMTP_Release_Device( p_device ); +break; } } free( p_rawdevices ); -/* Open file */ -msg_Dbg( p_access, "opening file `%s'", path ); -int fd = open_file( p_access, path ); - -if( vlc_unlink( path ) != 0 ) -msg_Err( p_access, "Error deleting file %s, %s", path, - vlc_strerror_c(errno) ); -free( path ); - if( fd == -1 ) +{ +msg_Err( p_access, "cannot find %s", p_access->psz_location ); return VLC_EGENERIC; +} p_access->p_sys = (void *)(intptr_t)fd; ACCESS_SET_CALLBACKS( Read, NULL, Control, Seek ); @@ -253,27 +233,3 @@ static int Control( access_t *p_access, int i_query, va_list args ) } return VLC_SUCCESS; } - -/* - * open_file: Opens a specific file - */ -static int open_file( access_t *p_access, const char *path ) -{ -int fd = vlc_open( path, O_RDONLY | O_NONBLOCK ); -if( fd == -1 ) -{ -msg_Err( p_access, "cannot open file %s: %s", path, - vlc_strerror_c(errno) ); -vlc_dialog_display_error( p_access, _( "File reading failed" ), -_( "VLC could not open the file \"%s\": %s" ), path, -vlc_strerror(errno) ); -return -1; -} -#ifdef F_RDAHEAD -fcntl( fd, F_RDAHEAD, 1 ); -#endif -#ifdef F_NOCACHE -fcntl( fd, F_NOCACHE, 0 ); -#endif -return fd; -} ___ vlc-commits
[vlc-commits] vlc_xml_encode: fix inverted logic
vlc | branch: master | Rémi Denis-Courmont| Sat Feb 25 10:04:36 2017 +0200| [a14539313bf8703d42d17aa8b636fc69b61a4756] | committer: Rémi Denis-Courmont vlc_xml_encode: fix inverted logic > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=a14539313bf8703d42d17aa8b636fc69b61a4756 --- src/text/strings.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/text/strings.c b/src/text/strings.c index 45d72a1..eb45145 100644 --- a/src/text/strings.c +++ b/src/text/strings.c @@ -295,7 +295,7 @@ char *vlc_xml_encode (const char *str) { if (unlikely(n == (size_t)-1)) { -if (vlc_memstream_close()) +if (vlc_memstream_close() == 0) free(stream.ptr); errno = EILSEQ; return NULL; ___ vlc-commits mailing list vlc-commits@videolan.org https://mailman.videolan.org/listinfo/vlc-commits
[vlc-commits] vlc_xml_encode: fix inverted logic
vlc | branch: master | Rémi Denis-Courmont| Sat Feb 25 10:04:36 2017 +0200| [c1dcc288e75e1463e45080f45305f62d417fa24e] | committer: Rémi Denis-Courmont vlc_xml_encode: fix inverted logic > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=c1dcc288e75e1463e45080f45305f62d417fa24e --- src/text/strings.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/text/strings.c b/src/text/strings.c index 45d72a1..eb45145 100644 --- a/src/text/strings.c +++ b/src/text/strings.c @@ -295,7 +295,7 @@ char *vlc_xml_encode (const char *str) { if (unlikely(n == (size_t)-1)) { -if (vlc_memstream_close()) +if (vlc_memstream_close() == 0) free(stream.ptr); errno = EILSEQ; return NULL; ___ vlc-commits mailing list vlc-commits@videolan.org https://mailman.videolan.org/listinfo/vlc-commits
[vlc-commits] mtp: use a temporary file descriptor
vlc | branch: master | Rémi Denis-Courmont| Sat Feb 25 09:55:26 2017 +0200| [502e503e6e23080f388c7ae194c06dba40f61e74] | committer: Rémi Denis-Courmont mtp: use a temporary file descriptor This fixes insecure use of tempnam(), fixes a potential file leak onto the filesystem and simplifies the code. > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=502e503e6e23080f388c7ae194c06dba40f61e74 --- modules/access/mtp.c | 92 +++- 1 file changed, 27 insertions(+), 65 deletions(-) diff --git a/modules/access/mtp.c b/modules/access/mtp.c index 6f90453..97acf51 100644 --- a/modules/access/mtp.c +++ b/modules/access/mtp.c @@ -71,8 +71,6 @@ static int Seek( access_t *, uint64_t ); static ssize_t Read( access_t *, void *, size_t ); static int Control( access_t *, int, va_list ); -static int open_file( access_t *, const char * ); - /* * Open: open the file */ @@ -84,18 +82,16 @@ static int Open( vlc_object_t *p_this ) uint16_t i_product_id; int i_track_id; LIBMTP_raw_device_t *p_rawdevices; -LIBMTP_mtpdevice_t *p_device; int i_numrawdevices; -int i_ret; if( sscanf( p_access->psz_location, "%"SCNu32":%"SCNu8":%"SCNu16":%d", _bus, _dev, _product_id, _track_id ) != 4 ) return VLC_EGENERIC; -i_ret = LIBMTP_Detect_Raw_Devices( _rawdevices, _numrawdevices ); -if( i_ret != 0 || i_numrawdevices <= 0 || !p_rawdevices ) + +if( LIBMTP_Detect_Raw_Devices( _rawdevices, _numrawdevices ) ) return VLC_EGENERIC; -char *path; +int fd = -1; for( int i = 0; i < i_numrawdevices; i++ ) { @@ -103,46 +99,36 @@ static int Open( vlc_object_t *p_this ) i_dev == p_rawdevices[i].devnum && i_product_id == p_rawdevices[i].device_entry.product_id ) { -if( ( p_device = LIBMTP_Open_Raw_Device( _rawdevices[i] ) -) != NULL ) -{ -#warning Oooh no! Not tempnam()! -path = tempnam( NULL, "vlc" ); -if( path == NULL ) -{ -LIBMTP_Release_Device( p_device ); -free( p_rawdevices ); -return VLC_ENOMEM; -} -else -{ -msg_Dbg( p_access, "About to write %s", path ); -LIBMTP_Get_File_To_File( p_device, i_track_id, path, - NULL, NULL ); -LIBMTP_Release_Device( p_device ); -i = i_numrawdevices; -} -} -else -{ -free( p_rawdevices ); -return VLC_EGENERIC; -} +LIBMTP_mtpdevice_t *p_device; + +p_device = LIBMTP_Open_Raw_Device( _rawdevices[i] ); +if( p_device == NULL ) +break; + +fd = vlc_memfd(); +if( unlikely(fd == -1) ) +break; + +msg_Dbg( p_access, "copying to memory" ); +LIBMTP_Get_File_To_File_Descriptor( p_device, i_track_id, fd, +NULL, NULL ); +LIBMTP_Release_Device( p_device ); +break; } } free( p_rawdevices ); -/* Open file */ -msg_Dbg( p_access, "opening file `%s'", path ); -int fd = open_file( p_access, path ); - -if( vlc_unlink( path ) != 0 ) -msg_Err( p_access, "Error deleting file %s, %s", path, - vlc_strerror_c(errno) ); -free( path ); - if( fd == -1 ) +{ +msg_Err( p_access, "cannot find %s", p_access->psz_location ); return VLC_EGENERIC; +} + +if( lseek( fd, 0, SEEK_SET ) ) /* Reset file descriptor offset */ +{ +close( fd ); +return VLC_EGENERIC; +} p_access->p_sys = (void *)(intptr_t)fd; ACCESS_SET_CALLBACKS( Read, NULL, Control, Seek ); @@ -253,27 +239,3 @@ static int Control( access_t *p_access, int i_query, va_list args ) } return VLC_SUCCESS; } - -/* - * open_file: Opens a specific file - */ -static int open_file( access_t *p_access, const char *path ) -{ -int fd = vlc_open( path, O_RDONLY | O_NONBLOCK ); -if( fd == -1 ) -{ -msg_Err( p_access, "cannot open file %s: %s", path, - vlc_strerror_c(errno) ); -vlc_dialog_display_error( p_access, _( "File reading failed" ), -_( "VLC could not open the file \"%s\": %s" ), path, -vlc_strerror(errno) ); -return -1; -} -#ifdef F_RDAHEAD -fcntl( fd, F_RDAHEAD, 1 );
[vlc-commits] sdp: use vlc_memstream
vlc | branch: master | Rémi Denis-Courmont| Sat Feb 25 13:14:01 2017 +0200| [84ec386904a4f08c6bb4af6a488c73b9e3e50043] | committer: Rémi Denis-Courmont sdp: use vlc_memstream > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=84ec386904a4f08c6bb4af6a488c73b9e3e50043 --- include/vlc_sout.h| 17 ++- modules/misc/rtsp.c | 17 +-- modules/stream_out/rtp.c | 27 ++-- modules/stream_out/standard.c | 27 ++-- modules/stream_out/vod.c | 20 +-- src/stream_output/sdp.c | 326 +++--- 6 files changed, 207 insertions(+), 227 deletions(-) diff --git a/include/vlc_sout.h b/include/vlc_sout.h index acbb2cb..c710780 100644 --- a/include/vlc_sout.h +++ b/include/vlc_sout.h @@ -280,10 +280,19 @@ VLC_API void sout_AnnounceUnRegister(vlc_object_t *,session_descriptor_t* ); /** SDP */ struct sockaddr; - -VLC_API char * vlc_sdp_Start( vlc_object_t *obj, const char *cfgpref, const struct sockaddr *src, size_t srclen, const struct sockaddr *addr, size_t addrlen ) VLC_USED; -VLC_API char * sdp_AddMedia(char **sdp, const char *type, const char *protocol, int dport, unsigned pt, bool bw_indep, unsigned bw, const char *ptname, unsigned clockrate, unsigned channels, const char *fmtp); -VLC_API char * sdp_AddAttribute(char **sdp, const char *name, const char *fmt, ...) VLC_FORMAT( 3, 4 ); +struct vlc_memstream; + +VLC_API int vlc_sdp_Start(struct vlc_memstream *, vlc_object_t *obj, + const char *cfgpref, + const struct sockaddr *src, size_t slen, + const struct sockaddr *addr, size_t alen) VLC_USED; +VLC_API void sdp_AddMedia(struct vlc_memstream *, const char *type, + const char *protocol, int dport, unsigned pt, + bool bw_indep, unsigned bw, const char *ptname, + unsigned clockrate, unsigned channels, + const char *fmtp); +VLC_API void sdp_AddAttribute(struct vlc_memstream *, const char *name, + const char *fmt, ...) VLC_FORMAT(3, 4); /** Description module */ typedef struct sout_description_data_t diff --git a/modules/misc/rtsp.c b/modules/misc/rtsp.c index cb0d218..d2a03c1 100644 --- a/modules/misc/rtsp.c +++ b/modules/misc/rtsp.c @@ -44,6 +44,7 @@ #include #include #include +#include #ifndef _WIN32 # include @@ -1499,7 +1500,8 @@ static int RtspCallbackES( httpd_callback_sys_t *p_args, httpd_client_t *cl, */ static char *SDPGenerate( const vod_media_t *p_media, httpd_client_t *cl ) { -char *psz_sdp, ip[NI_MAXNUMERICHOST]; +struct vlc_memstream sdp; +char ip[NI_MAXNUMERICHOST]; const char *psz_control; int port; @@ -1521,15 +1523,14 @@ static char *SDPGenerate( const vod_media_t *p_media, httpd_client_t *cl ) dst.ss_len = dstlen; #endif -psz_sdp = vlc_sdp_Start( VLC_OBJECT( p_media->p_vod ), "sout-rtp-", - NULL, 0, (struct sockaddr *), dstlen ); -if( psz_sdp == NULL ) +if( vlc_sdp_Start( , VLC_OBJECT( p_media->p_vod ), "sout-rtp-", + NULL, 0, (struct sockaddr *), dstlen ) ) return NULL; if( p_media->i_length > 0 ) { lldiv_t d = lldiv( p_media->i_length / 1000, 1000 ); -sdp_AddAttribute( _sdp, "range","npt=0-%lld.%03u", d.quot, +sdp_AddAttribute( , "range","npt=0-%lld.%03u", d.quot, (unsigned)d.rem ); } @@ -1553,13 +1554,13 @@ static char *SDPGenerate( const vod_media_t *p_media, httpd_client_t *cl ) continue; } -sdp_AddMedia( _sdp, mime_major, "RTP/AVP", 0 /* p_es->i_port */, +sdp_AddMedia( , mime_major, "RTP/AVP", 0 /* p_es->i_port */, p_es->i_payload_type, false, 0, p_es->psz_ptname, p_es->i_clock_rate, p_es->i_channels, p_es->psz_fmtp ); -sdp_AddAttribute( _sdp, "control", psz_control, ip, port, i ); +sdp_AddAttribute( , "control", psz_control, ip, port, i ); } -return psz_sdp; +return vlc_memstream_close( ) ? NULL : sdp.ptr; } diff --git a/modules/stream_out/rtp.c b/modules/stream_out/rtp.c index 3f85f2e..c4436a8 100644 --- a/modules/stream_out/rtp.c +++ b/modules/stream_out/rtp.c @@ -41,6 +41,7 @@ #include #include #include +#include #ifdef HAVE_SRTP # include # include @@ -780,8 +781,9 @@ out: char *SDPGenerate( sout_stream_t *p_stream, const char *rtsp_url ) { sout_stream_sys_t *p_sys = p_stream->p_sys; -char *psz_sdp = NULL; +struct vlc_memstream sdp; struct sockaddr_storage dst; +char *psz_sdp = NULL; socklen_t dstlen; int i; /* @@ -836,17 +838,16 @@ char *SDPGenerate( sout_stream_t *p_stream, const char *rtsp_url ) #endif } -
[vlc-commits] xa: handle header read error, fix struct size
vlc | branch: master | Rémi Denis-Courmont| Sat Feb 25 14:08:23 2017 +0200| [72d6528f121b985c0275fd341e1aa7b5e69c1f5d] | committer: Rémi Denis-Courmont xa: handle header read error, fix struct size This fixes the vlc_stream_Read() compiler warning. As pointed out by Filip, some archs could pad the structure to a boundary larger than 8 bytes, defeating the sizeof() value. > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=72d6528f121b985c0275fd341e1aa7b5e69c1f5d --- modules/demux/xa.c | 44 1 file changed, 24 insertions(+), 20 deletions(-) diff --git a/modules/demux/xa.c b/modules/demux/xa.c index bdbd107..cc525cf 100644 --- a/modules/demux/xa.c +++ b/modules/demux/xa.c @@ -29,6 +29,7 @@ # include "config.h" #endif +#include #include #include #include @@ -79,6 +80,8 @@ typedef struct xa_header_t uint16_t wBitsPerSample; } xa_header_t; +static_assert(offsetof(xa_header_t, wBitsPerSample) == 22, "Bad padding"); + #define FRAME_LENGTH 28 /* samples per frame */ /* @@ -87,46 +90,46 @@ typedef struct xa_header_t static int Open( vlc_object_t * p_this ) { demux_t *p_demux = (demux_t*)p_this; -demux_sys_t *p_sys; -xa_header_t p_xa; -const uint8_t *p_buf; +const uint8_t *peek; /* XA file heuristic */ -if( vlc_stream_Peek( p_demux->s, _buf, sizeof( p_xa ) ) -< (signed)sizeof( p_xa ) ) +if( vlc_stream_Peek( p_demux->s, , 10 ) < 10 ) return VLC_EGENERIC; - -memcpy( _xa, p_buf, sizeof( p_xa ) ); -if( ( strncmp( p_xa.xa_id, "XAI", 4 ) - && strncmp( p_xa.xa_id, "XAJ", 4 ) ) - || ( GetWLE( _xa.wFormatTag ) != 0x0001) - || ( GetWLE( _xa.wBitsPerSample ) != 16) ) +if( memcmp( peek, "XAI", 4 ) && memcmp( peek, "XAJ", 4 ) ) +return VLC_EGENERIC; +if( GetWLE( peek + 8 ) != 1 ) /* format tag */ return VLC_EGENERIC; -p_sys = malloc( sizeof( demux_sys_t ) ); +demux_sys_t *p_sys = malloc( sizeof( demux_sys_t ) ); if( unlikely( p_sys == NULL ) ) return VLC_ENOMEM; -/* skip XA header -- cannot fail */ -vlc_stream_Read( p_demux->s, NULL, sizeof( p_xa ) ); +/* read XA header*/ +xa_header_t xa; + +if( vlc_stream_Read( p_demux->s, , 24 ) < 24 ) +{ +free( p_sys ); +return VLC_EGENERIC; +} es_format_t fmt; es_format_Init( , AUDIO_ES, VLC_FOURCC('X','A','J',0) ); msg_Dbg( p_demux, "assuming EA ADPCM audio codec" ); -fmt.audio.i_rate = GetDWLE( _xa.nSamplesPerSec ); -fmt.audio.i_bytes_per_frame = 15 * GetWLE( _xa.nChannels ); +fmt.audio.i_rate = GetDWLE( ); +fmt.audio.i_bytes_per_frame = 15 * GetWLE( ); fmt.audio.i_frame_length = FRAME_LENGTH; -fmt.audio.i_channels = GetWLE ( _xa.nChannels ); +fmt.audio.i_channels = GetWLE ( ); fmt.audio.i_blockalign = fmt.audio.i_bytes_per_frame; -fmt.audio.i_bitspersample = 16; +fmt.audio.i_bitspersample = GetWLE( ); fmt.i_bitrate = (fmt.audio.i_rate * fmt.audio.i_bytes_per_frame * 8) / fmt.audio.i_frame_length; p_sys->i_data_offset = vlc_stream_Tell( p_demux->s ); /* FIXME: better computation */ -p_sys->i_data_size = p_xa.iSize * 15 / 56; +p_sys->i_data_size = xa.iSize * 15 / 56; /* How many frames per block (1:1 is too CPU intensive) */ p_sys->i_block_frames = fmt.audio.i_rate / (FRAME_LENGTH * 20) + 1; p_sys->i_frame_size = fmt.audio.i_bytes_per_frame; @@ -137,7 +140,8 @@ static int Open( vlc_object_t * p_this ) (char *)_codec, fmt.audio.i_channels, fmt.audio.i_rate, fmt.i_bitrate / 8192, fmt.audio.i_blockalign ); -if( fmt.audio.i_rate == 0 || fmt.audio.i_channels == 0 ) +if( fmt.audio.i_rate == 0 || fmt.audio.i_channels == 0 + || fmt.audio.i_bitspersample != 16 ) { free( p_sys ); return VLC_EGENERIC; ___ vlc-commits mailing list vlc-commits@videolan.org https://mailman.videolan.org/listinfo/vlc-commits
[vlc-commits] xa: do not set callbacks on error
vlc | branch: master | Rémi Denis-Courmont| Sat Feb 25 14:00:04 2017 +0200| [e9e23b18f70980a514a8e01a10b257ce6692274a] | committer: Rémi Denis-Courmont xa: do not set callbacks on error > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=e9e23b18f70980a514a8e01a10b257ce6692274a --- modules/demux/xa.c | 8 +++- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/modules/demux/xa.c b/modules/demux/xa.c index 7f9d260..bdbd107 100644 --- a/modules/demux/xa.c +++ b/modules/demux/xa.c @@ -107,11 +107,6 @@ static int Open( vlc_object_t * p_this ) if( unlikely( p_sys == NULL ) ) return VLC_ENOMEM; -p_demux->pf_demux = Demux; -p_demux->pf_control = Control; -p_demux->p_sys = p_sys; -p_sys->p_es = NULL; - /* skip XA header -- cannot fail */ vlc_stream_Read( p_demux->s, NULL, sizeof( p_xa ) ); @@ -153,6 +148,9 @@ static int Open( vlc_object_t * p_this ) date_Init( _sys->pts, fmt.audio.i_rate, 1 ); date_Set( _sys->pts, VLC_TS_0 ); +p_demux->pf_demux = Demux; +p_demux->pf_control = Control; +p_demux->p_sys = p_sys; return VLC_SUCCESS; } ___ vlc-commits mailing list vlc-commits@videolan.org https://mailman.videolan.org/listinfo/vlc-commits
[vlc-commits] memstream: fix vlc_memstream_write() error return
vlc | branch: master | Rémi Denis-Courmont| Sat Feb 25 15:45:45 2017 +0200| [0f16e431062f63dd64198a2bfd583afee97b30fe] | committer: Rémi Denis-Courmont memstream: fix vlc_memstream_write() error return > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=0f16e431062f63dd64198a2bfd583afee97b30fe --- src/text/memstream.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/text/memstream.c b/src/text/memstream.c index 3bfd2e9..b1551ef 100644 --- a/src/text/memstream.c +++ b/src/text/memstream.c @@ -137,7 +137,7 @@ size_t vlc_memstream_write(struct vlc_memstream *ms, const void *ptr, error: ms->error = EOF; -return EOF; +return 0; } int vlc_memstream_putc(struct vlc_memstream *ms, int c) ___ vlc-commits mailing list vlc-commits@videolan.org https://mailman.videolan.org/listinfo/vlc-commits
[vlc-commits] Optimize vlc_memstream_puts() with constant string
vlc | branch: master | Rémi Denis-Courmont| Sat Feb 25 15:55:39 2017 +0200| [0579e0223a5bf2cfcdda7b858ff0dbfb2834413d] | committer: Rémi Denis-Courmont Optimize vlc_memstream_puts() with constant string If the string given to vlc_memstream_puts() is constant, or at least its length is constant, use vlc_memstream_write() instead and let GCC compute the length at build-time. > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=0579e0223a5bf2cfcdda7b858ff0dbfb2834413d --- include/vlc_memstream.h | 11 +++ src/text/memstream.c| 4 ++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/include/vlc_memstream.h b/include/vlc_memstream.h index 6333765..0ed78a7 100644 --- a/include/vlc_memstream.h +++ b/include/vlc_memstream.h @@ -62,4 +62,15 @@ VLC_API int vlc_memstream_printf(struct vlc_memstream *s, const char *fmt, ...) VLC_FORMAT(2,3); +# ifdef __GNUC__ +static inline int vlc_memstream_puts_len(struct vlc_memstream *ms, + const char *str, size_t len) +{ +return (vlc_memstream_write(ms, str, len) == len) ? (int)len : EOF; +} +# define vlc_memstream_puts(ms,s) \ +(__builtin_constant_p(__builtin_strlen(s)) ? \ +vlc_memstream_puts_len(ms,s,__builtin_strlen(s)) : \ +vlc_memstream_puts(ms,s)) +# endif #endif /* VLC_MEMSTREAM_H */ diff --git a/src/text/memstream.c b/src/text/memstream.c index b1551ef..8e96309 100644 --- a/src/text/memstream.c +++ b/src/text/memstream.c @@ -82,7 +82,7 @@ int vlc_memstream_putc(struct vlc_memstream *ms, int c) return fputc(c, ms->stream); } -int vlc_memstream_puts(struct vlc_memstream *ms, const char *str) +int (vlc_memstream_puts)(struct vlc_memstream *ms, const char *str) { if (unlikely(ms->stream == NULL)) return EOF; @@ -145,7 +145,7 @@ int vlc_memstream_putc(struct vlc_memstream *ms, int c) return (vlc_memstream_write(ms, &(unsigned char){ c }, 1u) == 1) ? c : EOF; } -int vlc_memstream_puts(struct vlc_memstream *ms, const char *str) +int (vlc_memstream_puts)(struct vlc_memstream *ms, const char *str) { size_t len = strlen(str); return (vlc_memstream_write(ms, str, len) == len) ? 0 : EOF; ___ vlc-commits mailing list vlc-commits@videolan.org https://mailman.videolan.org/listinfo/vlc-commits
[vlc-commits] Remove ifdefs for GCC version below 4.4
vlc | branch: master | Rémi Denis-Courmont| Sat Feb 25 15:37:38 2017 +0200| [97d669a8c704a19f9bd4cd4b8f995dcc9e9edbb7] | committer: Rémi Denis-Courmont Remove ifdefs for GCC version below 4.4 According to INSTALL, we require GCC 4.8 already. > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=97d669a8c704a19f9bd4cd4b8f995dcc9e9edbb7 --- include/vlc_common.h | 28 +++- include/vlc_cpu.h| 12 ++-- include/vlc_plugin.h | 2 +- include/vlc_threads.h| 2 +- modules/video_filter/deinterlace/yadif.h | 12 5 files changed, 19 insertions(+), 37 deletions(-) diff --git a/include/vlc_common.h b/include/vlc_common.h index db5e6da..6a75753 100644 --- a/include/vlc_common.h +++ b/include/vlc_common.h @@ -84,20 +84,14 @@ #ifdef __GNUC__ # define VLC_DEPRECATED __attribute__((deprecated)) -# if defined( _WIN32 ) && VLC_GCC_VERSION(4,4) +# if defined( _WIN32 ) # define VLC_FORMAT(x,y) __attribute__ ((format(gnu_printf,x,y))) # else # define VLC_FORMAT(x,y) __attribute__ ((format(printf,x,y))) # endif # define VLC_FORMAT_ARG(x) __attribute__ ((format_arg(x))) - # define VLC_MALLOC __attribute__ ((malloc)) - -# if VLC_GCC_VERSION(3,4) -# define VLC_USED __attribute__ ((warn_unused_result)) -# else -# define VLC_USED -# endif +# define VLC_USED __attribute__ ((warn_unused_result)) #else # define VLC_DEPRECATED @@ -130,7 +124,7 @@ #if defined (_WIN32) && defined (DLL_EXPORT) # define VLC_EXPORT __declspec(dllexport) -#elif VLC_GCC_VERSION(4,0) +#elif defined (__GNUC__) # define VLC_EXPORT __attribute__((visibility("default"))) #else # define VLC_EXPORT @@ -477,7 +471,7 @@ struct vlc_common_members struct vlc_common_members: (vlc_object_t *)(&(x)->obj), \ const struct vlc_common_members: (const vlc_object_t *)(&(x)->obj) \ ) -#elif VLC_GCC_VERSION(4,0) +#elif defined (__GNUC__) # ifndef __cplusplus # define VLC_OBJECT( x ) \ __builtin_choose_expr( \ @@ -537,7 +531,7 @@ static inline uint8_t clip_uint8_vlc( int32_t a ) VLC_USED static inline unsigned (clz)(unsigned x) { -#if VLC_GCC_VERSION(3,4) +#ifdef __GNUC__ return __builtin_clz (x); #else unsigned i = sizeof (x) * 8; @@ -560,7 +554,7 @@ static inline unsigned (clz)(unsigned x) VLC_USED static inline unsigned (ctz)(unsigned x) { -#if VLC_GCC_VERSION(3,4) +#ifdef __GNUC__ return __builtin_ctz (x); #else unsigned i = sizeof (x) * 8; @@ -578,7 +572,7 @@ static inline unsigned (ctz)(unsigned x) VLC_USED static inline unsigned (popcount)(unsigned x) { -#if VLC_GCC_VERSION(3,4) +#ifdef __GNUC__ return __builtin_popcount (x); #else unsigned count = 0; @@ -595,7 +589,7 @@ static inline unsigned (popcount)(unsigned x) VLC_USED static inline int (popcountll)(unsigned long long x) { -#if VLC_GCC_VERSION(3,4) +#ifdef __GNUC__ return __builtin_popcountll(x); #else int count = 0; @@ -611,7 +605,7 @@ static inline int (popcountll)(unsigned long long x) VLC_USED static inline unsigned (parity)(unsigned x) { -#if VLC_GCC_VERSION(3,4) +#ifdef __GNUC__ return __builtin_parity (x); #else for (unsigned i = 4 * sizeof (x); i > 0; i /= 2) @@ -631,7 +625,7 @@ static inline uint16_t (bswap16)(uint16_t x) VLC_USED static inline uint32_t (bswap32)(uint32_t x) { -#if VLC_GCC_VERSION(4,3) || defined(__clang__) +#if defined (__GNUC__) || defined(__clang__) return __builtin_bswap32 (x); #else return ((x & 0x00FF) << 24) @@ -645,7 +639,7 @@ static inline uint32_t (bswap32)(uint32_t x) VLC_USED static inline uint64_t (bswap64)(uint64_t x) { -#if VLC_GCC_VERSION(4,3) || defined(__clang__) +#if defined (__GNUC__) || defined(__clang__) return __builtin_bswap64 (x); #elif !defined (__cplusplus) return ((x & 0x00FF) << 56) diff --git a/include/vlc_cpu.h b/include/vlc_cpu.h index 8c520a0..b2f0f45 100644 --- a/include/vlc_cpu.h +++ b/include/vlc_cpu.h @@ -50,11 +50,7 @@ VLC_API unsigned vlc_CPU(void); # define VLC_MMX # else # define vlc_CPU_MMX() ((vlc_CPU() & VLC_CPU_MMX) != 0) -# if VLC_GCC_VERSION(4, 4) || defined(__clang__) -# define VLC_MMX __attribute__ ((__target__ ("mmx"))) -# else -# define VLC_MMX VLC_MMX_is_not_implemented_on_this_compiler -# endif +# define VLC_MMX __attribute__ ((__target__ ("mmx"))) # endif # if defined (__SSE__) @@ -64,11 +60,7 @@ VLC_API unsigned vlc_CPU(void); # else # define vlc_CPU_MMXEXT() ((vlc_CPU() & VLC_CPU_MMXEXT) != 0) # define vlc_CPU_SSE() ((vlc_CPU() & VLC_CPU_SSE) != 0) -# if VLC_GCC_VERSION(4, 4) || defined(__clang__) -# define VLC_SSE __attribute__ ((__target__ ("sse"))) -# else -# define VLC_SSE VLC_SSE_is_not_implemented_on_this_compiler -# endif +# define VLC_SSE __attribute__ ((__target__ ("sse"))) # endif # ifdef __SSE2__ diff --git a/include/vlc_plugin.h b/include/vlc_plugin.h index
[vlc-commits] access/dcp: AESKey::decryptyRSA: fix narrowing-conversion in case-label
vlc | branch: master | Filip Roséen| Sat Feb 25 07:28:21 2017 +0100| [aafa93f8283f6ce324460b211b53a26303d7dd54] | committer: Jean-Baptiste Kempf access/dcp: AESKey::decryptyRSA: fix narrowing-conversion in case-label narrowing-conversions are not allowed in case-statements as of C++11, meaning that the former implementation caused standard-compliant compilers to emit a diagnostic on the line in question. Signed-off-by: Jean-Baptiste Kempf > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=aafa93f8283f6ce324460b211b53a26303d7dd54 --- modules/access/dcp/dcpdecrypt.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/access/dcp/dcpdecrypt.cpp b/modules/access/dcp/dcpdecrypt.cpp index e7dcaa9..88cce85 100644 --- a/modules/access/dcp/dcpdecrypt.cpp +++ b/modules/access/dcp/dcpdecrypt.cpp @@ -327,7 +327,7 @@ int AESKey::decryptRSA( string s_cipher_text_b64 ) if( this->extractInfo( ps_plain_text, false ) ) goto end; break; -case -1: +case static_cast( -1 ): msg_Err( this->p_demux, "could not decrypt" ); goto end; default: ___ vlc-commits mailing list vlc-commits@videolan.org https://mailman.videolan.org/listinfo/vlc-commits
[vlc-commits] sdp: fix compilation after 84ec386
vlc | branch: master | Jean-Baptiste Kempf| Sat Feb 25 15:18:05 2017 +0100| [51f3d6abc966528be44115d2dcdac6ab03f268c6] | committer: Jean-Baptiste Kempf sdp: fix compilation after 84ec386 > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=51f3d6abc966528be44115d2dcdac6ab03f268c6 --- src/missing.c | 12 ++-- 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/missing.c b/src/missing.c index b1e4a81..c76e99a 100644 --- a/src/missing.c +++ b/src/missing.c @@ -196,7 +196,7 @@ httpd_url_t *httpd_UrlNew (httpd_host_t *host, const char *url, #ifndef ENABLE_SOUT # include -char *sdp_AddMedia (char **sdp, const char *type, const char *protocol, +void sdp_AddMedia (struct vlc_memstream *sdp, const char *type, const char *protocol, int dport, unsigned pt, bool bw_indep, unsigned bw, const char *ptname, unsigned clockrate, unsigned channels, const char *fmtp) @@ -205,13 +205,13 @@ char *sdp_AddMedia (char **sdp, const char *type, const char *protocol, VLC_UNUSED (dport); VLC_UNUSED (pt); VLC_UNUSED (bw_indep); VLC_UNUSED (bw); VLC_UNUSED (ptname); VLC_UNUSED (clockrate); VLC_UNUSED (channels); VLC_UNUSED (fmtp); -assert (*sdp == NULL); +assert (sdp == NULL); } -char *sdp_AddAttribute (char **sdp, const char *name, const char *fmt, ...) +void sdp_AddAttribute (struct vlc_memstream *sdp, const char *name, const char *fmt, ...) { VLC_UNUSED (sdp); VLC_UNUSED (name); VLC_UNUSED (fmt); -assert (*sdp == NULL); +assert (sdp == NULL); } int sout_AccessOutControl (sout_access_out_t *out, int query, ...) @@ -335,13 +335,13 @@ sout_stream_t *sout_StreamChainNew (sout_instance_t *p_sout, const char *psz_cha vlc_assert_unreachable (); } -char *vlc_sdp_Start (vlc_object_t *obj, const char *cfg, +int vlc_sdp_Start (struct vlc_memstream *sdp, vlc_object_t *obj, const char *cfg, const struct sockaddr *src, size_t srclen, const struct sockaddr *addr, size_t addrlen) { VLC_UNUSED (obj); VLC_UNUSED (cfg); VLC_UNUSED (src); VLC_UNUSED (srclen); VLC_UNUSED (addr); VLC_UNUSED (addrlen); -return NULL; +return 0; } #endif /* !ENABLE_SOUT */ ___ vlc-commits mailing list vlc-commits@videolan.org https://mailman.videolan.org/listinfo/vlc-commits
[vlc-commits] access/live555: remove unused function strempty
vlc | branch: master | Filip Roséen| Sat Feb 25 07:38:57 2017 +0100| [d96a974bce5776239c436e370874428352d46f68] | committer: Jean-Baptiste Kempf access/live555: remove unused function strempty The last usage of this function was removed by d8314d6. Signed-off-by: Jean-Baptiste Kempf > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=d96a974bce5776239c436e370874428352d46f68 --- modules/access/live555.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/modules/access/live555.cpp b/modules/access/live555.cpp index 720913b..1651ada 100644 --- a/modules/access/live555.cpp +++ b/modules/access/live555.cpp @@ -485,7 +485,6 @@ static void Close( vlc_object_t *p_this ) free( p_sys ); } -static inline const char *strempty( const char *s ) { return s?s:""; } static inline Boolean toBool( bool b ) { return b?True:False; } // silly, no? static void default_live555_callback( RTSPClient* client, int result_code, char* result_string ) ___ vlc-commits mailing list vlc-commits@videolan.org https://mailman.videolan.org/listinfo/vlc-commits
[vlc-commits] codec/kate: remove TigerConfigurationCallback + OnConfigurationChanged ( unused)
vlc | branch: master | Filip Roséen| Sat Feb 25 07:39:02 2017 +0100| [33ec46a8df59b252db1c0ee3b28a1b22574724ec] | committer: Jean-Baptiste Kempf codec/kate: remove TigerConfigurationCallback + OnConfigurationChanged (unused) The last usage of these functions, TigerConfigurationCallback is the only one that ever called OnConfigurationChanged, was removed as part of 231b08e in May 2011. Signed-off-by: Jean-Baptiste Kempf > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=33ec46a8df59b252db1c0ee3b28a1b22574724ec --- modules/codec/kate.c | 113 --- 1 file changed, 113 deletions(-) diff --git a/modules/codec/kate.c b/modules/codec/kate.c index d6bca7e..10ea65f 100644 --- a/modules/codec/kate.c +++ b/modules/codec/kate.c @@ -179,11 +179,6 @@ static void UpdateTigerBackgroundColor( decoder_t *p_dec ); static void UpdateTigerFontEffect( decoder_t *p_dec ); static void UpdateTigerQuality( decoder_t *p_dec ); static void UpdateTigerFontDesc( decoder_t *p_dec ); -static int TigerConfigurationCallback( vlc_object_t *p_this, const char *psz_var, - vlc_value_t oldvar, vlc_value_t newval, - void *p_data ); -static int OnConfigurationChanged( decoder_t *p_dec, const char *psz_var, - vlc_value_t oldval, vlc_value_t newval); #endif #define DEFAULT_NAME "Default" @@ -1025,114 +1020,6 @@ static void UpdateTigerFontEffect( decoder_t *p_dec ) p_sys->b_dirty = true; } -static int OnConfigurationChanged( decoder_t *p_dec, const char *psz_var, - vlc_value_t oldval, vlc_value_t newval ) -{ -decoder_sys_t *p_sys = (decoder_sys_t*)p_dec->p_sys; - -VLC_UNUSED( oldval ); - -vlc_mutex_lock( _sys->lock ); - -msg_Dbg( p_dec, "OnConfigurationChanged: %s", psz_var ); - -if( !p_sys->b_use_tiger || !p_sys->p_tr ) -{ -vlc_mutex_unlock( _sys->lock ); -return VLC_SUCCESS; -} - -#define TEST_TIGER_VAR( name ) \ -if( !strcmp( name, psz_var ) ) - -TEST_TIGER_VAR( "kate-tiger-quality" ) -{ -p_sys->f_tiger_quality = newval.f_float; -UpdateTigerQuality( p_dec ); -} - -TEST_TIGER_VAR( "kate-tiger-default-font-desc" ) -{ -if( p_sys->psz_tiger_default_font_desc ) -{ -free( p_sys->psz_tiger_default_font_desc ); -p_sys->psz_tiger_default_font_desc = NULL; -} -if( newval.psz_string ) -{ -p_sys->psz_tiger_default_font_desc = strdup( newval.psz_string ); -} -UpdateTigerFontDesc( p_dec ); -} - -TEST_TIGER_VAR( "kate-tiger-default-font-color" ) -{ -p_sys->i_tiger_default_font_color = (p_sys->i_tiger_default_font_color & 0xff00U) | newval.i_int; -UpdateTigerFontColor( p_dec ); -} - -TEST_TIGER_VAR( "kate-tiger-default-font-alpha" ) -{ -p_sys->i_tiger_default_font_color = (p_sys->i_tiger_default_font_color & 0x00ff) | (newval.i_int<<24); -UpdateTigerFontColor( p_dec ); -} - -TEST_TIGER_VAR( "kate-tiger-default-background-color" ) -{ -p_sys->i_tiger_default_background_color = (p_sys->i_tiger_default_background_color & 0xff00U) | newval.i_int; -UpdateTigerBackgroundColor( p_dec ); -} - -TEST_TIGER_VAR( "kate-tiger-default-background-alpha" ) -{ -p_sys->i_tiger_default_background_color = (p_sys->i_tiger_default_background_color & 0x00ff) | (newval.i_int<<24); -UpdateTigerBackgroundColor( p_dec ); -} - -TEST_TIGER_VAR( "kate-tiger-default-font-effect" ) -{ -p_sys->e_tiger_default_font_effect = (tiger_font_effect)newval.i_int; -UpdateTigerFontEffect( p_dec ); -} - -TEST_TIGER_VAR( "kate-tiger-default-font-effect-strength" ) -{ -p_sys->f_tiger_default_font_effect_strength = newval.f_float; -UpdateTigerFontEffect( p_dec ); -} - -#undef TEST_TIGER_VAR - -vlc_mutex_unlock( _sys->lock ); - -return VLC_SUCCESS; -} - -static int TigerConfigurationCallback( vlc_object_t *p_this, const char *psz_var, - vlc_value_t oldval, vlc_value_t newval, - void *p_data ) -{ -size_t i_idx; - -VLC_UNUSED( p_this ); -VLC_UNUSED( oldval ); -VLC_UNUSED( newval ); -VLC_UNUSED( p_data ); - -vlc_mutex_lock( _decoder_list_mutex ); - -/* Update all existing decoders from the global user prefs */ -for( i_idx = 0; i_idx < kate_decoder_list_size; i_idx++ ) -{ -decoder_t *p_dec = kate_decoder_list[ i_idx ]; -OnConfigurationChanged( p_dec, psz_var, oldval, newval ); -} - -vlc_mutex_unlock( _decoder_list_mutex ); - -return VLC_SUCCESS; -} - #endif /*
[vlc-commits] gui/qt: extended_panels: refactor ChangeFiltersString
vlc | branch: master | Filip Roséen| Sat Feb 25 07:31:42 2017 +0100| [5f74ae9803b5fbc35792baa7a8d08202c9296454] | committer: Jean-Baptiste Kempf gui/qt: extended_panels: refactor ChangeFiltersString The previous implementation was unnecessary complex, and by using the utilities available for string manipulation in Qt we can drastically reduce the lines of code. These changes also fixes an issue where a user would be unable to remove a video-filter if the command-line specified the same video-filter twice. Signed-off-by: Jean-Baptiste Kempf > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=5f74ae9803b5fbc35792baa7a8d08202c9296454 --- modules/gui/qt/components/extended_panels.cpp | 58 --- 1 file changed, 7 insertions(+), 51 deletions(-) diff --git a/modules/gui/qt/components/extended_panels.cpp b/modules/gui/qt/components/extended_panels.cpp index 4a3d7d3..c2c375d 100644 --- a/modules/gui/qt/components/extended_panels.cpp +++ b/modules/gui/qt/components/extended_panels.cpp @@ -259,61 +259,17 @@ void ExtVideo::clean() static char *ChangeFiltersString( struct intf_thread_t *p_intf, const char *psz_filter_type, const char *psz_name, bool b_add ) { -char *psz_parser, *psz_string; +char* psz_chain = config_GetPsz( p_intf, psz_filter_type ); -psz_string = config_GetPsz( p_intf, psz_filter_type ); +QString const chain = QString( psz_chain ? psz_chain : "" ); +QStringList list = chain.split( ':', QString::SplitBehavior::SkipEmptyParts ); -if( !psz_string ) psz_string = strdup( "" ); +if( b_add ) list << psz_name; +elselist.removeAll( psz_name ); -psz_parser = strstr( psz_string, psz_name ); +free( psz_chain ); -if( b_add ) -{ -if( !psz_parser ) -{ -psz_parser = psz_string; -if( asprintf( _string, ( *psz_string ) ? "%s:%s" : "%s%s", -psz_string, psz_name ) == -1 ) -{ -free( psz_parser ); -return NULL; -} -free( psz_parser ); -} -else -{ -free( psz_string ); -return NULL; -} -} -else -{ -if( psz_parser ) -{ -if( *( psz_parser + strlen( psz_name ) ) == ':' ) -{ -memmove( psz_parser, psz_parser + strlen( psz_name ) + 1, - strlen( psz_parser + strlen( psz_name ) + 1 ) + 1 ); -} -else -{ -*psz_parser = '\0'; -} - -/* Remove trailing : : */ -size_t i_len = strlen( psz_string ); -if( i_len > 0 && *( psz_string + i_len - 1 ) == ':' ) -{ -*( psz_string + i_len - 1 ) = '\0'; -} -} -else -{ -free( psz_string ); -return NULL; -} -} -return psz_string; +return strdup( qtu( list.join( ':' ) ) ); } static void ChangeAFiltersString( struct intf_thread_t *p_intf, const char *psz_name, bool b_add ) ___ vlc-commits mailing list vlc-commits@videolan.org https://mailman.videolan.org/listinfo/vlc-commits
[vlc-commits] gui/qt: update look and feel related to extra metadata
vlc | branch: master | Filip Roséen| Sat Feb 25 07:36:17 2017 +0100| [28e94cc9561834e0a8da59da4d84891cf8913ff5] | committer: Jean-Baptiste Kempf gui/qt: update look and feel related to extra metadata These changes allow for several cosmetic/functional advantages, such as: - automatically expand right-most column to fill entire width - automatically expand rows to the contents within them - scroll the table by pixel instead of by row - remove edit triggers (as these do not have any meaning currently) fixes #17656 Signed-off-by: Jean-Baptiste Kempf > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=28e94cc9561834e0a8da59da4d84891cf8913ff5 --- modules/gui/qt/components/info_panels.cpp | 19 ++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/modules/gui/qt/components/info_panels.cpp b/modules/gui/qt/components/info_panels.cpp index 111474d..f008922 100644 --- a/modules/gui/qt/components/info_panels.cpp +++ b/modules/gui/qt/components/info_panels.cpp @@ -402,6 +402,18 @@ ExtraMetaPanel::ExtraMetaPanel( QWidget *parent ) : QWidget( parent ) extraMeta->setColumnCount( 2 ); extraMeta->horizontalHeader()->hide(); extraMeta->verticalHeader()->hide(); + + extraMeta->horizontalHeader()->setStretchLastSection(true); + extraMeta->resizeRowsToContents(); + + extraMeta->setVerticalScrollMode( QAbstractItemView::ScrollPerPixel ); + extraMeta->setHorizontalScrollMode( QAbstractItemView::ScrollPerPixel ); + + extraMeta->setSelectionBehavior( QAbstractItemView::SelectRows ); + + extraMeta->setEditTriggers( QAbstractItemView::NoEditTriggers ); + extraMeta->setSelectionMode( QAbstractItemView::SingleSelection ); + layout->addWidget( extraMeta, 1, 0 ); } @@ -430,7 +442,12 @@ void ExtraMetaPanel::update( input_item_t *p_item ) target->insertRow( idx ); -target->setItem( idx, 0, new QTableWidgetItem( qfu( psz_key ) ) ); +QTableWidgetItem *key = new QTableWidgetItem( qfu( psz_key ) ); + +key->setTextAlignment( Qt::AlignRight ); +key->setFlags( key->flags() ^ Qt::ItemIsSelectable ); + +target->setItem( idx, 0, key ); target->setItem( idx, 1, new QTableWidgetItem( qfu( psz_value ) ) ); } ___ vlc-commits mailing list vlc-commits@videolan.org https://mailman.videolan.org/listinfo/vlc-commits
[vlc-commits] demux/adaptive: SubSegment: remove unused private data-member
vlc | branch: master | Filip Roséen| Sat Feb 25 07:39:00 2017 +0100| [5f2d569e831b7a85c4a38bdde206c6ff96b81ef1] | committer: Jean-Baptiste Kempf demux/adaptive: SubSegment: remove unused private data-member Signed-off-by: Jean-Baptiste Kempf > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=5f2d569e831b7a85c4a38bdde206c6ff96b81ef1 --- modules/demux/adaptive/playlist/Segment.cpp | 2 +- modules/demux/adaptive/playlist/Segment.h | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/modules/demux/adaptive/playlist/Segment.cpp b/modules/demux/adaptive/playlist/Segment.cpp index ad70f3d..b0cc2d8 100644 --- a/modules/demux/adaptive/playlist/Segment.cpp +++ b/modules/demux/adaptive/playlist/Segment.cpp @@ -259,7 +259,7 @@ IndexSegment::IndexSegment(ICanonicalUrl *parent) : } SubSegment::SubSegment(ISegment *main, size_t start, size_t end) : -ISegment(main), parent(main) +ISegment(main) { setByteRange(start, end); debugName = "SubSegment"; diff --git a/modules/demux/adaptive/playlist/Segment.h b/modules/demux/adaptive/playlist/Segment.h index 82b0be3..8dca5e9 100644 --- a/modules/demux/adaptive/playlist/Segment.h +++ b/modules/demux/adaptive/playlist/Segment.h @@ -130,8 +130,6 @@ namespace adaptive virtual std::vector subSegments(); virtual void addSubSegment(SubSegment *); static const int CLASSID_SUBSEGMENT = 4; -private: -ISegment *parent; }; } } ___ vlc-commits mailing list vlc-commits@videolan.org https://mailman.videolan.org/listinfo/vlc-commits
[vlc-commits] gui/qt: info_panels: remove comments containing legacy code
vlc | branch: master | Filip Roséen| Sat Feb 25 07:38:58 2017 +0100| [e289d0bfcb6be739a5f794e999ab1617877da2e3] | committer: Jean-Baptiste Kempf gui/qt: info_panels: remove comments containing legacy code These sections were commented out as part of 86a25b2c1b9 and fe3beadd6b0 (2007-09), and has been unchanged ever since. Signed-off-by: Jean-Baptiste Kempf > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=e289d0bfcb6be739a5f794e999ab1617877da2e3 --- modules/gui/qt/components/info_panels.cpp | 9 - modules/gui/qt/components/info_panels.hpp | 1 - 2 files changed, 10 deletions(-) diff --git a/modules/gui/qt/components/info_panels.cpp b/modules/gui/qt/components/info_panels.cpp index f4b3028..6e2fdce 100644 --- a/modules/gui/qt/components/info_panels.cpp +++ b/modules/gui/qt/components/info_panels.cpp @@ -122,13 +122,6 @@ MetaPanel::MetaPanel( QWidget *parent, metaLayout->addWidget( seqtot_text, line, 9, 1, 1 ); line++; -/* Rating - on the same line */ -/* -metaLayout->addWidget( new QLabel( qtr( VLC_META_RATING ) ), line, 4, 1, 2 ); -rating_text = new QSpinBox; setSpinBounds( rating_text ); -metaLayout->addWidget( rating_text, line, 6, 1, 1 ); -*/ - /* Now Playing - Useful for live feeds (HTTP, DVB, ETC...) */ ADD_META( VLC_META_NOW_PLAYING, nowplaying_text, 0, 7 ); nowplaying_text->setReadOnly( true ); line--; @@ -182,7 +175,6 @@ MetaPanel::MetaPanel( QWidget *parent, CONNECT( date_text, textEdited( QString ), this, enterEditMode() ); //CONNECT( THEMIM->getIM(), artChanged( QString ), this, enterEditMode() ); -/*CONNECT( rating_text, valueChanged( QString ), this, enterEditMode( QString ) );*/ /* We are not yet in Edit Mode */ b_inEditMode = false; @@ -249,7 +241,6 @@ void MetaPanel::update( input_item_t *p_item ) UPDATE_META( TrackNum, seqnum_text ); UPDATE_META( TrackTotal, seqtot_text ); //UPDATE_META( Setting, setting_text ); -//UPDATE_META_INT( Rating, rating_text ); /* Now Playing || ES Now Playing */ psz_meta = input_item_GetNowPlayingFb( p_item ); diff --git a/modules/gui/qt/components/info_panels.hpp b/modules/gui/qt/components/info_panels.hpp index f6b5e1b..a80d392 100644 --- a/modules/gui/qt/components/info_panels.hpp +++ b/modules/gui/qt/components/info_panels.hpp @@ -70,7 +70,6 @@ private: QLineEdit *seqtot_text; QTextEdit *description_text; -//QSpinBox *rating_text; QLineEdit *date_text; //QLineEdit *setting_text; QLineEdit *language_text; ___ vlc-commits mailing list vlc-commits@videolan.org https://mailman.videolan.org/listinfo/vlc-commits
[vlc-commits] gui/qt: rename ExtraMetaPanel::extraMetaTree to extraMeta
vlc | branch: master | Filip Roséen| Sat Feb 25 07:36:15 2017 +0100| [60973aadbb2609fbfb6d8ee360d76360a8a8b8b4] | committer: Jean-Baptiste Kempf gui/qt: rename ExtraMetaPanel::extraMetaTree to extraMeta If the name of a data-member's type is present in its name, changing the type of said data-member makes it so that the patch is hard to follow. These changes simply removes the unnecessary type-indication from the data-members name, mostly to make future refactoring easier to follow. Signed-off-by: Jean-Baptiste Kempf > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=60973aadbb2609fbfb6d8ee360d76360a8a8b8b4 --- modules/gui/qt/components/info_panels.cpp | 24 modules/gui/qt/components/info_panels.hpp | 2 +- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/modules/gui/qt/components/info_panels.cpp b/modules/gui/qt/components/info_panels.cpp index b771eb6..340e524 100644 --- a/modules/gui/qt/components/info_panels.cpp +++ b/modules/gui/qt/components/info_panels.cpp @@ -396,12 +396,12 @@ ExtraMetaPanel::ExtraMetaPanel( QWidget *parent ) : QWidget( parent ) topLabel->setWordWrap( true ); layout->addWidget( topLabel, 0, 0 ); - extraMetaTree = new QTreeWidget( this ); - extraMetaTree->setAlternatingRowColors( true ); - extraMetaTree->setColumnCount( 2 ); - extraMetaTree->resizeColumnToContents( 0 ); - extraMetaTree->setHeaderHidden( true ); - layout->addWidget( extraMetaTree, 1, 0 ); + extraMeta = new QTreeWidget( this ); + extraMeta->setAlternatingRowColors( true ); + extraMeta->setColumnCount( 2 ); + extraMeta->resizeColumnToContents( 0 ); + extraMeta->setHeaderHidden( true ); + layout->addWidget( extraMeta, 1, 0 ); } /** @@ -417,7 +417,7 @@ void ExtraMetaPanel::update( input_item_t *p_item ) QList items; -extraMetaTree->clear(); +extraMeta->clear(); vlc_mutex_lock( _item->lock ); vlc_meta_t *p_meta = p_item->p_meta; @@ -433,7 +433,7 @@ void ExtraMetaPanel::update( input_item_t *p_item ) QStringList tempItem; tempItem.append( VLC_META_DISCNUMBER ); tempItem.append( qfu( psz_disc_number ) ); -items.append( new QTreeWidgetItem ( extraMetaTree, tempItem ) ); +items.append( new QTreeWidgetItem ( extraMeta, tempItem ) ); } char ** ppsz_allkey = vlc_meta_CopyExtraNames( p_meta); @@ -444,14 +444,14 @@ void ExtraMetaPanel::update( input_item_t *p_item ) QStringList tempItem; tempItem.append( qfu( ppsz_allkey[i] ) + " : "); tempItem.append( qfu( psz_value ) ); -items.append( new QTreeWidgetItem ( extraMetaTree, tempItem ) ); +items.append( new QTreeWidgetItem ( extraMeta, tempItem ) ); free( ppsz_allkey[i] ); } vlc_mutex_unlock( _item->lock ); free( ppsz_allkey ); -extraMetaTree->addTopLevelItems( items ); -extraMetaTree->resizeColumnToContents( 0 ); +extraMeta->addTopLevelItems( items ); +extraMeta->resizeColumnToContents( 0 ); } /** @@ -459,7 +459,7 @@ void ExtraMetaPanel::update( input_item_t *p_item ) **/ void ExtraMetaPanel::clear() { -extraMetaTree->clear(); +extraMeta->clear(); } /** diff --git a/modules/gui/qt/components/info_panels.hpp b/modules/gui/qt/components/info_panels.hpp index 6f984da..d0af544 100644 --- a/modules/gui/qt/components/info_panels.hpp +++ b/modules/gui/qt/components/info_panels.hpp @@ -103,7 +103,7 @@ class ExtraMetaPanel: public QWidget public: ExtraMetaPanel( QWidget * ); private: -QTreeWidget *extraMetaTree; +QTreeWidget *extraMeta; public slots: void update( input_item_t * ); void clear(); ___ vlc-commits mailing list vlc-commits@videolan.org https://mailman.videolan.org/listinfo/vlc-commits
[vlc-commits] gui/qt: info_panels: remove things related to QSpinBox
vlc | branch: master | Filip Roséen| Sat Feb 25 07:56:14 2017 +0100| [db9d20eea6818d81038c29165344dfbf6a3ae6a3] | committer: Jean-Baptiste Kempf gui/qt: info_panels: remove things related to QSpinBox These are no longer required as there is nothing that uses it anymore. Signed-off-by: Jean-Baptiste Kempf > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=db9d20eea6818d81038c29165344dfbf6a3ae6a3 --- modules/gui/qt/components/info_panels.cpp | 1 - modules/gui/qt/components/info_panels.hpp | 1 - 2 files changed, 2 deletions(-) diff --git a/modules/gui/qt/components/info_panels.cpp b/modules/gui/qt/components/info_panels.cpp index 9341c90..aa94d5f 100644 --- a/modules/gui/qt/components/info_panels.cpp +++ b/modules/gui/qt/components/info_panels.cpp @@ -46,7 +46,6 @@ #include #include #include -#include #include / diff --git a/modules/gui/qt/components/info_panels.hpp b/modules/gui/qt/components/info_panels.hpp index 57d6f25..ae3eac0 100644 --- a/modules/gui/qt/components/info_panels.hpp +++ b/modules/gui/qt/components/info_panels.hpp @@ -38,7 +38,6 @@ class QTreeWidget; class QTreeWidgetItem; class QTableWidget; -class QSpinBox; class QLineEdit; class CoverArtLabel; class QTextEdit; ___ vlc-commits mailing list vlc-commits@videolan.org https://mailman.videolan.org/listinfo/vlc-commits
[vlc-commits] record: protect against arbitrary file overwrite
vlc | branch: master | Rémi Denis-Courmont| Sat Feb 25 16:38:44 2017 +0200| [0c166ad1b9798c00a0ce9bf52d561be598c4842c] | committer: Rémi Denis-Courmont record: protect against arbitrary file overwrite Setting the no-overwrite flag of the file access output ensures that record will not indirectly trigger overwriting of an unintended file. There are two occurences to this problem: - While probing the muxer format, VLC uses the notoriously insecure and obsolescent (in POSIX.2008) tempnam() function. This leads to an arbitrary file overwrite vulnerability via symbolic links. However, the record plugin really should not need to create temporary files to probe a muxer format. - While actually recording content to a permanent file, overwriting an existing file is not a good idea. This is presumably not a vulnerability insofar as the output directory belongs to the user. Regardless, the record plugin should ensure that the output filename does not already exists (e.g. by creating the file). So basically, this is a stopgap measure. > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=0c166ad1b9798c00a0ce9bf52d561be598c4842c --- modules/stream_out/record.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/modules/stream_out/record.c b/modules/stream_out/record.c index 4b3a84c..5dd0342 100644 --- a/modules/stream_out/record.c +++ b/modules/stream_out/record.c @@ -329,7 +329,8 @@ static int OutputNew( sout_stream_t *p_stream, } free( psz_tmp ); -if( asprintf( _output, "std{access=file{no-append,no-format}," +if( asprintf( _output, + "std{access=file{no-append,no-format,no-overwrite}," "mux='%s',dst='%s'}", psz_muxer, psz_file ) < 0 ) { psz_output = NULL; ___ vlc-commits mailing list vlc-commits@videolan.org https://mailman.videolan.org/listinfo/vlc-commits
[vlc-commits] gui/qt: simple_preferences: combine ppsz_language and ppsz_language_map
vlc | branch: master | Filip Roséen| Sat Feb 25 07:30:39 2017 +0100| [0c4aae9e7da64328e130c2b567f48c6323e2bf1c] | committer: Jean-Baptiste Kempf gui/qt: simple_preferences: combine ppsz_language and ppsz_language_map Having things as two separate arrays is very hard to maintain as one entry in ppsz_language must correctly correspond to one element in ppsz_language_text. These changes refactors the implementation so that a single array is used, where each element has two members so that it is easier to see what corresponds to what. Signed-off-by: Jean-Baptiste Kempf > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=0c4aae9e7da64328e130c2b567f48c6323e2bf1c --- modules/gui/qt/components/simple_preferences.cpp | 201 --- 1 file changed, 70 insertions(+), 131 deletions(-) diff --git a/modules/gui/qt/components/simple_preferences.cpp b/modules/gui/qt/components/simple_preferences.cpp index e9c0133..b9e1d01 100644 --- a/modules/gui/qt/components/simple_preferences.cpp +++ b/modules/gui/qt/components/simple_preferences.cpp @@ -54,134 +54,73 @@ # include #endif #include - -static const char *const ppsz_language[] = -{ -"auto", -"en", -"ar", -"bn", -"pt_BR", -"en_GB", -"el", -"bg", -"ca", -"zh_TW", -"cs", -"cy", -"da", -"nl", -"fi", -"et", -"eu", -"fr", -"ga", -"gd", -"gl", -"ka", -"de", -"he", -"hr", -"hu", -"hy", -"is", -"id", -"it", -"ja", -"ko", -"lt", -"mn", -"ms", -"nb", -"nn", -"kk", -"km", -"ne", -"oc", -"fa", -"pl", -"pt_PT", -"pa", -"ro", -"ru", -"zh_CN", -"si", -"sr", -"sk", -"sl", -"ckb", -"es", -"sv", -"te", -"tr", -"uk", -"vi", -"wa", -NULL, -}; - -static const char *const ppsz_language_text[] = -{ -N_("Auto"), -"American English", -"ﻉﺮﺒﻳ", -"বাংলা", -"Português Brasileiro", -"British English", -"Νέα Ελληνικά", -"български език", -"Català", -"正體中文", -"Čeština", -"Cymraeg", -"Dansk", -"Nederlands", -"Suomi", -"eesti keel", -"Euskara", -"Français", -"Gaeilge", -"Gàidhlig", -"Galego", -"ქართული", -"Deutsch", -"עברית", -"hrvatski", -"Magyar", -"հայերեն", -"íslenska", -"Bahasa Indonesia", -"Italiano", -"日本語", -"한국어", -"lietuvių", -"Монгол хэл", -"Melayu", -"Bokmål", -"Nynorsk", -"Қазақ тілі", -"ភាសាខ្មែរ", -"नेपाली", -"Occitan", -"ﻑﺍﺮﺳی", -"Polski", -"Português", -"ਪੰਜਾਬੀ", -"Română", -"Русский", -"简体中文", -"සිංහල", -"српски", -"Slovensky", -"slovenščina", -"کوردیی سۆرانی", -"Español", -"Svenska", -"తెలుగు", -"Türkçe", -"украї́нська мо́ва", -"tiếng Việt", -"Walon", +#include + +static struct { +const char iso[6]; +const char name[34]; + +} const language_map[] = { +{ "auto", N_("Auto") }, +{ "en","American English" }, +{ "ar","ﻉﺮﺒﻳ" }, +{ "bn","বাংলা" }, +{ "pt_BR", "Português Brasileiro" }, +{ "en_GB", "British English" }, +{ "el","Νέα Ελληνικά" }, +{ "bg","български език" }, +{ "ca","Català" }, +{ "zh_TW", "正體中文" }, +{ "cs","Čeština" }, +{ "cy","Cymraeg" }, +{ "da","Dansk" }, +{ "nl","Nederlands" }, +{ "fi","Suomi" }, +{ "et","eesti keel" }, +{ "eu","Euskara" }, +{ "fr","Français" }, +{ "ga","Gaeilge" }, +{ "gd","Gàidhlig" }, +{ "gl","Galego" }, +{ "ka","ქართული" }, +{ "de","Deutsch" }, +{ "he","עברית" }, +{ "hr","hrvatski" }, +{ "hu","Magyar" }, +{ "hy","հայերեն" }, +{ "is","íslenska" }, +{ "id","Bahasa Indonesia" }, +{ "it","Italiano" }, +{ "ja","日本語" }, +{ "ko","한국어" }, +{ "lt","lietuvių" }, +{ "mn","Монгол хэл" }, +{ "ms","Melayu" }, +{ "nb","Bokmål" }, +{ "nn","Nynorsk" }, +{ "kk","Қазақ тілі" }, +{ "km","ភាសាខ្មែរ" }, +{ "ne","नेपाली" }, +{ "oc","Occitan" }, +{ "fa","ﻑﺍﺮﺳی" }, +{ "pl","Polski" }, +{ "pt_PT", "Português" }, +{ "pa","ਪੰਜਾਬੀ" }, +{ "ro","Română" }, +{ "ru","Русский" }, +{ "zh_CN", "简体中文" }, +{ "si","සිංහල" }, +{ "sr","српски" }, +{ "sk","Slovensky" }, +{ "sl","slovenščina" }, +{ "ckb", "کوردیی سۆرانی" }, +{ "es","Español" }, +{ "sv","Svenska" }, +{ "te","తెలుగు" }, +{ "tr","Türkçe" }, +{ "uk","украї́нська мо́ва" }, +{ "vi","tiếng Việt" }, +{ "wa","Walon" } }; static int getDefaultAudioVolume(vlc_object_t *obj, const char *aout) @@ -721,8 +660,8 @@ SPrefsPanel::SPrefsPanel(
[vlc-commits] gui/qt: info_panels: remove function setSpinBounds (unused)
vlc | branch: master | Filip Roséen| Sat Feb 25 07:38:56 2017 +0100| [78905f626dcc30e780db64db40eb4085b990bdf3] | committer: Jean-Baptiste Kempf gui/qt: info_panels: remove function setSpinBounds (unused) The usage of setSpinBounds was removed in September 2007 (by e6e2ad0572dce549b74d15ebb23727714b3590b2), Signed-off-by: Jean-Baptiste Kempf > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=78905f626dcc30e780db64db40eb4085b990bdf3 --- modules/gui/qt/components/info_panels.cpp | 8 1 file changed, 8 deletions(-) diff --git a/modules/gui/qt/components/info_panels.cpp b/modules/gui/qt/components/info_panels.cpp index f008922..f4b3028 100644 --- a/modules/gui/qt/components/info_panels.cpp +++ b/modules/gui/qt/components/info_panels.cpp @@ -49,14 +49,6 @@ #include #include -static inline void setSpinBounds( QSpinBox *spinbox ) { -spinbox->setRange( 0, INT_MAX ); -spinbox->setAccelerated( true ); -spinbox->setAlignment( Qt::AlignRight ); -spinbox->setSpecialValueText(""); -} - - / * Single panels / ___ vlc-commits mailing list vlc-commits@videolan.org https://mailman.videolan.org/listinfo/vlc-commits
[vlc-commits] gui/qt: extended_panels: declare helper-functions as static
vlc | branch: master | Filip Roséen| Sat Feb 25 07:31:41 2017 +0100| [7a728a6f4d6aa70198b45563936e54c221b4353a] | committer: Jean-Baptiste Kempf gui/qt: extended_panels: declare helper-functions as static These functions are only used within the translation-unit in question, and as such it does not make sense for them to have external linkage. Signed-off-by: Jean-Baptiste Kempf > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=7a728a6f4d6aa70198b45563936e54c221b4353a --- modules/gui/qt/components/extended_panels.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/gui/qt/components/extended_panels.cpp b/modules/gui/qt/components/extended_panels.cpp index 52325d8..4a3d7d3 100644 --- a/modules/gui/qt/components/extended_panels.cpp +++ b/modules/gui/qt/components/extended_panels.cpp @@ -56,12 +56,12 @@ static char *ChangeFiltersString( struct intf_thread_t *p_intf, const char *psz_ static void ChangeAFiltersString( struct intf_thread_t *p_intf, const char *psz_name, bool b_add ); static void ChangeVFiltersString( struct intf_thread_t *p_intf, const char *psz_name, bool b_add ); -const QString ModuleFromWidgetName( QObject *obj ) +static const QString ModuleFromWidgetName( QObject *obj ) { return obj->objectName().replace( "Enable","" ); } -QString OptionFromWidgetName( QObject *obj ) +static QString OptionFromWidgetName( QObject *obj ) { /* Gruik ? ... nah */ QString option = obj->objectName().replace( "Slider", "" ) ___ vlc-commits mailing list vlc-commits@videolan.org https://mailman.videolan.org/listinfo/vlc-commits
[vlc-commits] gui/qt: use QTableWidget instead of QTreeWidget for extra-metadata
vlc | branch: master | Filip Roséen| Sat Feb 25 07:36:16 2017 +0100| [cad48c999e9b0939d63fb2888e80d0dc1cc9891d] | committer: Jean-Baptiste Kempf gui/qt: use QTableWidget instead of QTreeWidget for extra-metadata In terms of applicability, it makes more sense to store the extra metadata in a table than in a tree, especially given that we don't support nested metadata in either case. Signed-off-by: Jean-Baptiste Kempf > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=cad48c999e9b0939d63fb2888e80d0dc1cc9891d --- modules/gui/qt/components/info_panels.cpp | 66 +++ modules/gui/qt/components/info_panels.hpp | 3 +- 2 files changed, 34 insertions(+), 35 deletions(-) diff --git a/modules/gui/qt/components/info_panels.cpp b/modules/gui/qt/components/info_panels.cpp index 340e524..111474d 100644 --- a/modules/gui/qt/components/info_panels.cpp +++ b/modules/gui/qt/components/info_panels.cpp @@ -39,6 +39,7 @@ #include #include +#include #include #include #include @@ -396,11 +397,11 @@ ExtraMetaPanel::ExtraMetaPanel( QWidget *parent ) : QWidget( parent ) topLabel->setWordWrap( true ); layout->addWidget( topLabel, 0, 0 ); - extraMeta = new QTreeWidget( this ); + extraMeta = new QTableWidget( this ); extraMeta->setAlternatingRowColors( true ); extraMeta->setColumnCount( 2 ); - extraMeta->resizeColumnToContents( 0 ); - extraMeta->setHeaderHidden( true ); + extraMeta->horizontalHeader()->hide(); + extraMeta->verticalHeader()->hide(); layout->addWidget( extraMeta, 1, 0 ); } @@ -409,49 +410,46 @@ ExtraMetaPanel::ExtraMetaPanel( QWidget *parent ) : QWidget( parent ) **/ void ExtraMetaPanel::update( input_item_t *p_item ) { +extraMeta->setRowCount(0); + if( !p_item ) -{ -clear(); return; -} - -QList items; -extraMeta->clear(); - -vlc_mutex_lock( _item->lock ); +vlc_mutex_locker meta_lock( _item->lock ); vlc_meta_t *p_meta = p_item->p_meta; + if( !p_meta ) -{ -vlc_mutex_unlock( _item->lock ); return; -} -const char *psz_disc_number = vlc_meta_Get( p_meta, vlc_meta_DiscNumber); -if( psz_disc_number ) -{ -QStringList tempItem; -tempItem.append( VLC_META_DISCNUMBER ); -tempItem.append( qfu( psz_disc_number ) ); -items.append( new QTreeWidgetItem ( extraMeta, tempItem ) ); -} +struct AddRowHelper { +AddRowHelper( QTableWidget* target ) : target( target ) { } + +void operator()( char const* psz_key, char const* psz_value ) +{ +int idx = target->rowCount(); + +target->insertRow( idx ); + +target->setItem( idx, 0, new QTableWidgetItem( qfu( psz_key ) ) ); +target->setItem( idx, 1, new QTableWidgetItem( qfu( psz_value ) ) ); +} + +QTableWidget* target; + +} add_row ( extraMeta ); + +if( char const* psz_disc = vlc_meta_Get( p_meta, vlc_meta_DiscNumber ) ) +add_row( VLC_META_DISCNUMBER, psz_disc ); -char ** ppsz_allkey = vlc_meta_CopyExtraNames( p_meta); +char ** ppsz_keys = vlc_meta_CopyExtraNames( p_meta ); -for( int i = 0; ppsz_allkey[i] ; i++ ) +for( int i = 0; ppsz_keys[i]; ++i ) { -const char * psz_value = vlc_meta_GetExtra( p_meta, ppsz_allkey[i] ); -QStringList tempItem; -tempItem.append( qfu( ppsz_allkey[i] ) + " : "); -tempItem.append( qfu( psz_value ) ); -items.append( new QTreeWidgetItem ( extraMeta, tempItem ) ); -free( ppsz_allkey[i] ); +add_row( ppsz_keys[i], vlc_meta_GetExtra( p_meta, ppsz_keys[i] ) ); +free( ppsz_keys[i] ); } -vlc_mutex_unlock( _item->lock ); -free( ppsz_allkey ); -extraMeta->addTopLevelItems( items ); -extraMeta->resizeColumnToContents( 0 ); +extraMeta->verticalHeader()->resizeSections( QHeaderView::ResizeToContents ); } /** diff --git a/modules/gui/qt/components/info_panels.hpp b/modules/gui/qt/components/info_panels.hpp index d0af544..f6b5e1b 100644 --- a/modules/gui/qt/components/info_panels.hpp +++ b/modules/gui/qt/components/info_panels.hpp @@ -37,6 +37,7 @@ class QTreeWidget; class QTreeWidgetItem; +class QTableWidget; class QSpinBox; class QLineEdit; class CoverArtLabel; @@ -103,7 +104,7 @@ class ExtraMetaPanel: public QWidget public: ExtraMetaPanel( QWidget * ); private: -QTreeWidget *extraMeta; +QTableWidget *extraMeta; public slots: void update( input_item_t * ); void clear(); ___ vlc-commits mailing list vlc-commits@videolan.org https://mailman.videolan.org/listinfo/vlc-commits
[vlc-commits] gui/qt: extended_panels: change return-type of ChangeFiltersString
vlc | branch: master | Filip Roséen| Sat Feb 25 07:31:43 2017 +0100| [ac96c33de43d0780f7c20f643f3774a2bd7e95d4] | committer: Jean-Baptiste Kempf gui/qt: extended_panels: change return-type of ChangeFiltersString By returning a QString instead of a heap-allocated c-style string we reduce complexity, and hopefully increase correctness as there is less manual memory-management to worry about. Signed-off-by: Jean-Baptiste Kempf > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=ac96c33de43d0780f7c20f643f3774a2bd7e95d4 --- modules/gui/qt/components/extended_panels.cpp | 30 --- 1 file changed, 9 insertions(+), 21 deletions(-) diff --git a/modules/gui/qt/components/extended_panels.cpp b/modules/gui/qt/components/extended_panels.cpp index c2c375d..837932e 100644 --- a/modules/gui/qt/components/extended_panels.cpp +++ b/modules/gui/qt/components/extended_panels.cpp @@ -52,7 +52,7 @@ #include #include -static char *ChangeFiltersString( struct intf_thread_t *p_intf, const char *psz_filter_type, const char *psz_name, bool b_add ); +static QString ChangeFiltersString( struct intf_thread_t *p_intf, const char *psz_filter_type, const char *psz_name, bool b_add ); static void ChangeAFiltersString( struct intf_thread_t *p_intf, const char *psz_name, bool b_add ); static void ChangeVFiltersString( struct intf_thread_t *p_intf, const char *psz_name, bool b_add ); @@ -257,7 +257,7 @@ void ExtVideo::clean() ui.cropRightPx->setValue( 0 ); } -static char *ChangeFiltersString( struct intf_thread_t *p_intf, const char *psz_filter_type, const char *psz_name, bool b_add ) +static QString ChangeFiltersString( struct intf_thread_t *p_intf, const char *psz_filter_type, const char *psz_name, bool b_add ) { char* psz_chain = config_GetPsz( p_intf, psz_filter_type ); @@ -269,13 +269,11 @@ static char *ChangeFiltersString( struct intf_thread_t *p_intf, const char *psz_ free( psz_chain ); -return strdup( qtu( list.join( ':' ) ) ); +return list.join( ':' ); } static void ChangeAFiltersString( struct intf_thread_t *p_intf, const char *psz_name, bool b_add ) { -char *psz_string; - module_t *p_obj = module_find( psz_name ); if( !p_obj ) { @@ -283,13 +281,8 @@ static void ChangeAFiltersString( struct intf_thread_t *p_intf, const char *psz_ return; } -psz_string = ChangeFiltersString( p_intf, "audio-filter", psz_name, b_add ); -if( !psz_string ) -return; - -config_PutPsz( p_intf, "audio-filter", psz_string ); - -free( psz_string ); +QString result = ChangeFiltersString( p_intf, "audio-filteR", psz_name, b_add ); +config_PutPsz( p_intf, "audio-filter", qtu( result ) ); } static const char* GetVFilterType( struct intf_thread_t *p_intf, const char *psz_name ) @@ -318,33 +311,28 @@ static const char* GetVFilterType( struct intf_thread_t *p_intf, const char *psz static void ChangeVFiltersString( struct intf_thread_t *p_intf, const char *psz_name, bool b_add ) { -char *psz_string; const char *psz_filter_type = GetVFilterType( p_intf, psz_name ); -psz_string = ChangeFiltersString( p_intf, psz_filter_type, psz_name, b_add ); -if( !psz_string ) -return; +QString result = ChangeFiltersString( p_intf, psz_filter_type, psz_name, b_add ); /* Vout is not kept, so put that in the config */ -config_PutPsz( p_intf, psz_filter_type, psz_string ); +config_PutPsz( p_intf, psz_filter_type, qtu( result ) ); /* Try to set on the fly */ if( !strcmp( psz_filter_type, "video-splitter" ) ) { playlist_t *p_playlist = THEPL; -var_SetString( p_playlist, psz_filter_type, psz_string ); +var_SetString( p_playlist, psz_filter_type, qtu( result ) ); } else { vout_thread_t *p_vout = THEMIM->getVout(); if( p_vout ) { -var_SetString( p_vout, psz_filter_type, psz_string ); +var_SetString( p_vout, psz_filter_type, qtu( result ) ); vlc_object_release( p_vout ); } } - -free( psz_string ); } void ExtVideo::updateFilters() ___ vlc-commits mailing list vlc-commits@videolan.org https://mailman.videolan.org/listinfo/vlc-commits
[vlc-commits] gui/qt: info_panels: remove comments containing legacy code
vlc | branch: master | Filip Roséen| Sat Feb 25 07:38:59 2017 +0100| [78f6276dd570e74a2520a0544240c60e1603fbfc] | committer: Jean-Baptiste Kempf gui/qt: info_panels: remove comments containing legacy code These two lines were commented out by 9794062c2b1 and has remained untouched since aug 2007. Signed-off-by: Jean-Baptiste Kempf > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=78f6276dd570e74a2520a0544240c60e1603fbfc --- modules/gui/qt/components/info_panels.cpp | 1 - modules/gui/qt/components/info_panels.hpp | 1 - 2 files changed, 2 deletions(-) diff --git a/modules/gui/qt/components/info_panels.cpp b/modules/gui/qt/components/info_panels.cpp index 6e2fdce..9341c90 100644 --- a/modules/gui/qt/components/info_panels.cpp +++ b/modules/gui/qt/components/info_panels.cpp @@ -240,7 +240,6 @@ void MetaPanel::update( input_item_t *p_item ) UPDATE_META( Date, date_text ); UPDATE_META( TrackNum, seqnum_text ); UPDATE_META( TrackTotal, seqtot_text ); -//UPDATE_META( Setting, setting_text ); /* Now Playing || ES Now Playing */ psz_meta = input_item_GetNowPlayingFb( p_item ); diff --git a/modules/gui/qt/components/info_panels.hpp b/modules/gui/qt/components/info_panels.hpp index a80d392..57d6f25 100644 --- a/modules/gui/qt/components/info_panels.hpp +++ b/modules/gui/qt/components/info_panels.hpp @@ -71,7 +71,6 @@ private: QTextEdit *description_text; QLineEdit *date_text; -//QLineEdit *setting_text; QLineEdit *language_text; QLineEdit *nowplaying_text; QLineEdit *publisher_text; ___ vlc-commits mailing list vlc-commits@videolan.org https://mailman.videolan.org/listinfo/vlc-commits
[vlc-commits] gui/qt: extended_panels: ChangeVFiltersString: NULL check
vlc | branch: master | Filip Roséen| Sat Feb 25 07:31:45 2017 +0100| [0a92e09c2995eb62ba62f45ba2201856c85a2341] | committer: Jean-Baptiste Kempf gui/qt: extended_panels: ChangeVFiltersString: NULL check GetVFilterType returns NULL on error, meaning that it is not guaranteed that psz_filter_type contains what we require: this change make sure that we abort ChangeVFiltersString if the type is unknown. Signed-off-by: Jean-Baptiste Kempf > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=0a92e09c2995eb62ba62f45ba2201856c85a2341 --- modules/gui/qt/components/extended_panels.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/modules/gui/qt/components/extended_panels.cpp b/modules/gui/qt/components/extended_panels.cpp index 6a9c947..e1469ba 100644 --- a/modules/gui/qt/components/extended_panels.cpp +++ b/modules/gui/qt/components/extended_panels.cpp @@ -306,6 +306,9 @@ static void ChangeVFiltersString( struct intf_thread_t *p_intf, const char *psz_ { const char *psz_filter_type = GetVFilterType( p_intf, psz_name ); +if( psz_filter_type == NULL ) +return; + QString result = ChangeFiltersString( p_intf, psz_filter_type, psz_name, b_add ); /* Vout is not kept, so put that in the config */ ___ vlc-commits mailing list vlc-commits@videolan.org https://mailman.videolan.org/listinfo/vlc-commits
[vlc-commits] gui/qt: extended_panels: refactor OptionFromWidgetName
vlc | branch: master | Filip Roséen| Sat Feb 25 07:31:44 2017 +0100| [8a961e000682d252ed727cd838c46e6dd9076c3b] | committer: Jean-Baptiste Kempf gui/qt: extended_panels: refactor OptionFromWidgetName Signed-off-by: Jean-Baptiste Kempf > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=8a961e000682d252ed727cd838c46e6dd9076c3b --- modules/gui/qt/components/extended_panels.cpp | 17 + 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/modules/gui/qt/components/extended_panels.cpp b/modules/gui/qt/components/extended_panels.cpp index 837932e..6a9c947 100644 --- a/modules/gui/qt/components/extended_panels.cpp +++ b/modules/gui/qt/components/extended_panels.cpp @@ -39,6 +39,7 @@ #include #include #include +#include #include "components/extended_panels.hpp" #include "dialogs/preferences.hpp" @@ -64,18 +65,10 @@ static const QString ModuleFromWidgetName( QObject *obj ) static QString OptionFromWidgetName( QObject *obj ) { /* Gruik ? ... nah */ -QString option = obj->objectName().replace( "Slider", "" ) - .replace( "Combo" , "" ) - .replace( "Dial" , "" ) - .replace( "Check" , "" ) - .replace( "Spin" , "" ) - .replace( "Text" , "" ); -for( char a = 'A'; a <= 'Z'; a++ ) -{ -option = option.replace( QString( a ), - QString( '-' ) + QString( a + 'a' - 'A' ) ); -} -return option; +return obj->objectName() +.remove( QRegExp( "Slider|Combo|Dial|Check|Spin|Text" ) ) +.replace( QRegExp( "([A-Z])" ), "-\\1" ) +.toLower(); } static inline void setup_vfilter( intf_thread_t *p_intf, const char* psz_name, QWidget *widget ) ___ vlc-commits mailing list vlc-commits@videolan.org https://mailman.videolan.org/listinfo/vlc-commits
[vlc-commits] macOS: Rework dmg creation
vlc | branch: master | Marvin Scholz| Sat Feb 25 19:30:23 2017 +0100| [a7847f6fd681c9bc7c90b501f4dcb766072f240b] | committer: Marvin Scholz macOS: Rework dmg creation This adds the possibility to build fancy DMGs with background, dmg icon and special icon positions using the dmgbuild python tool. If dmgbuild is not available, it will fallback and make a normal DMG. > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=a7847f6fd681c9bc7c90b501f4dcb766072f240b --- extras/package/macosx/dmg/dmg_settings.py | 73 +++ extras/package/macosx/dmg_setup.scpt | 25 --- extras/package/macosx/package.mak | 35 --- 3 files changed, 92 insertions(+), 41 deletions(-) diff --git a/extras/package/macosx/dmg/dmg_settings.py b/extras/package/macosx/dmg/dmg_settings.py new file mode 100644 index 000..19cb215 --- /dev/null +++ b/extras/package/macosx/dmg/dmg_settings.py @@ -0,0 +1,73 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals +import os + +# Configuration file for the dmgbuild tool, used to build +# a fancy DMG for VLC, with background image and aligned +# icons. +# +# This is python, so make sure to write valid python, +# do NOT indent using tabs. +# +# To build a fancy dmg, make sure configure finds dmgbuild +# in your PATH and just do: +#make package-macosx +# +# To use directly, use this: +#dmgbuild -s dmgsettings.py "VLC Media Player" VLC.dmg +# +# To specify a different App location: +#dmgbuild -s dmgsettings.py -D app=/path/to/My.app "My Application" MyApp.dmg + +# Application settings +application = defines.get('app', 'VLC.app') +appname = os.path.basename(application) + +# Volume format (see hdiutil create -help) +format = defines.get('format', 'UDBZ') + +# Volume size (must be large enough for your files) +size = defines.get('size', '150M') + +# Files to include +files = [ application ] + +# Symlinks to create +symlinks = { 'Applications': '/Applications' } + +# Location of the icons +icon_locations = { +appname:(181, 108), +'Applications': (392, 108), +} + +# Background +background = 'background.tiff' + +# Window configuration +show_status_bar = False +show_tab_view = False +show_toolbar = False +show_pathbar = False +show_sidebar = False +sidebar_width = 180 +default_view = 'icon-view' + +# Window rect in ((x, y), (w, h)) format +window_rect = ((100, 100), (573, 340)) + +# Volume icon or badge icon +icon = 'disk_image.icns' +#badge_icon = '/path/to/icon.icns' + +# General view configuration +show_icon_preview = False + +# Icon view configuration +arrange_by = None +grid_offset = (0, 0) +grid_spacing = 100 +scroll_position = (0, 0) +label_pos = 'bottom' # or 'right' +text_size = 14 +icon_size = 95 diff --git a/extras/package/macosx/dmg_setup.scpt b/extras/package/macosx/dmg_setup.scpt deleted file mode 100644 index 678175e..000 --- a/extras/package/macosx/dmg_setup.scpt +++ /dev/null @@ -1,25 +0,0 @@ -on run argv -tell application "Finder" -tell disk (item 1 of argv) -open -set current view of container window to icon view -set toolbar visible of container window to false -set statusbar visible of container window to false -set the bounds of container window to {300, 100, 750, 500} -set theViewOptions to the icon view options of container window -set arrangement of theViewOptions to not arranged -set icon size of theViewOptions to 104 -# Don't set a background image, for now -# set background picture of theViewOptions to file ".background/background.png" -set position of item "VLC.app" of container window to {110, 100} -set position of item "Applications" of container window to {335, 100} -set position of item "Read Me.rtf" of container window to {110, 275} -set position of item "Goodies" of container window to {335, 275} -# Force saving changes to the disk by closing and opening the window -close -open -update without registering applications -delay 5 -end tell -end tell -end run diff --git a/extras/package/macosx/package.mak b/extras/package/macosx/package.mak index 1d912d7..1c35e92 100644 --- a/extras/package/macosx/package.mak +++ b/extras/package/macosx/package.mak @@ -57,23 +57,24 @@ endif package-macosx: VLC.app - mkdir -p "$(top_builddir)/vlc-$(VERSION)/Goodies/" +if HAVE_DMGBUILD + @echo "Packaging fancy DMG using dmgbuild" + cd "$(top_srcdir)/extras/package/macosx/dmg" && dmgbuild -s "dmg_settings.py" \ + -D app="$(abs_top_builddir)/VLC.app" "VLC Media Player" "$(abs_top_builddir)/vlc-$(VERSION).dmg" +else !HAVE_DMGBUILD + @echo "Packaging non-fancy DMG" + ## Create directory for DMG contents + mkdir -p "$(top_builddir)/vlc-$(VERSION)" +
[vlc-commits] macOS: Add DMG icon and background
vlc | branch: master | Doney den Ouden| Sat Feb 25 19:17:34 2017 +0100| [4da07f203b91a155c0779ea9a56e611f56b6fb47] | committer: Marvin Scholz macOS: Add DMG icon and background > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=4da07f203b91a155c0779ea9a56e611f56b6fb47 --- extras/package/macosx/dmg/background.tiff | Bin 0 -> 50082 bytes extras/package/macosx/dmg/disk_image.icns | Bin 0 -> 890416 bytes 2 files changed, 0 insertions(+), 0 deletions(-) diff --git a/extras/package/macosx/dmg/background.tiff b/extras/package/macosx/dmg/background.tiff new file mode 100644 index 000..77be620 Binary files /dev/null and b/extras/package/macosx/dmg/background.tiff differ diff --git a/extras/package/macosx/dmg/disk_image.icns b/extras/package/macosx/dmg/disk_image.icns new file mode 100644 index 000..a558a8c Binary files /dev/null and b/extras/package/macosx/dmg/disk_image.icns differ ___ vlc-commits mailing list vlc-commits@videolan.org https://mailman.videolan.org/listinfo/vlc-commits
[vlc-commits] configure: Check for dmgbuild on macOS
vlc | branch: master | Marvin Scholz| Sat Feb 25 19:22:16 2017 +0100| [5074dc0c5cfe7f3a1232a8721c072596103fc226] | committer: Marvin Scholz configure: Check for dmgbuild on macOS > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=5074dc0c5cfe7f3a1232a8721c072596103fc226 --- configure.ac | 12 1 file changed, 12 insertions(+) diff --git a/configure.ac b/configure.ac index b9ef4df..5c25e91 100644 --- a/configure.ac +++ b/configure.ac @@ -3903,6 +3903,18 @@ then fi dnl +dnl Mac OS X fancy dmg build tool +dnl +if test "${HAVE_OSX}" = "1" +then + AC_PATH_PROG(DMGBUILD, dmgbuild, no) + AS_IF([test "x${DMGBUILD}" = "xno"], [ +AC_MSG_WARN([dmgbuild not found -- unable to build fancy DMGs]) + ]) + AM_CONDITIONAL(HAVE_DMGBUILD, [test "x$DMGBUILD" != "xno"]) +fi + +dnl dnl VideoToolbox plugins AC_CHECK_HEADERS(VideoToolbox/VideoToolbox.h, [ VLC_ADD_PLUGIN([videotoolbox]) ___ vlc-commits mailing list vlc-commits@videolan.org https://mailman.videolan.org/listinfo/vlc-commits
[vlc-commits] demux/mkv: fix playback of files with invalid A_AAC/MPEG{2, 3}/ specification
vlc | branch: master | Filip Roséen| Sat Feb 25 20:44:22 2017 +0100| [5c83aea8accd40210c86cd12fbe92f811ef76a1d] | committer: Jean-Baptiste Kempf demux/mkv: fix playback of files with invalid A_AAC/MPEG{2, 3}/ specification Tracks matching the two introduced statements are invalid, but we still played them fine prior to the refactoring (perhaps intentionally). In order to stay somewhat back-compatible with earlier versions the two cases are now added back (since there are actual files in the wild with the invalid spec). refs #4250 Signed-off-by: Jean-Baptiste Kempf > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=5c83aea8accd40210c86cd12fbe92f811ef76a1d --- modules/demux/mkv/matroska_segment_parse.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/modules/demux/mkv/matroska_segment_parse.cpp b/modules/demux/mkv/matroska_segment_parse.cpp index 30aa550..e6debba 100644 --- a/modules/demux/mkv/matroska_segment_parse.cpp +++ b/modules/demux/mkv/matroska_segment_parse.cpp @@ -1634,6 +1634,8 @@ int32_t matroska_segment_c::TrackInit( mkv_track_t * p_tk ) S_CASE("A_AAC/MPEG4/LTP"){ A_AAC_MPEG__helper( vars, 3 ); } S_CASE("A_AAC/MPEG2/LC/SBR") { A_AAC_MPEG__helper( vars, 1, true ); } S_CASE("A_AAC/MPEG4/LC/SBR") { A_AAC_MPEG__helper( vars, 1, true ); } +S_CASE("A_AAC/MPEG4/") { A_AAC_MPEG__helper( vars, 3 ); } // see #4250 +S_CASE("A_AAC/MPEG2/") { A_AAC_MPEG__helper( vars, 3 ); } // backward compatibility S_CASE("A_AAC") { vars.p_tk->fmt.i_codec = VLC_CODEC_MP4A; fill_extra_data( vars.p_tk, 0 ); ___ vlc-commits mailing list vlc-commits@videolan.org https://mailman.videolan.org/listinfo/vlc-commits
[vlc-commits] configure: use AM_CONDITIONAL outside of if statement
vlc | branch: master | Jean-Baptiste Kempf| Sat Feb 25 20:14:27 2017 +0100| [75fd376361e796dc25c8cf44542af75e7a931f82] | committer: Jean-Baptiste Kempf configure: use AM_CONDITIONAL outside of if statement > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=75fd376361e796dc25c8cf44542af75e7a931f82 --- configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 5c25e91..5387d71 100644 --- a/configure.ac +++ b/configure.ac @@ -3911,8 +3911,8 @@ then AS_IF([test "x${DMGBUILD}" = "xno"], [ AC_MSG_WARN([dmgbuild not found -- unable to build fancy DMGs]) ]) - AM_CONDITIONAL(HAVE_DMGBUILD, [test "x$DMGBUILD" != "xno"]) fi +AM_CONDITIONAL(HAVE_DMGBUILD, [test "x$DMGBUILD" != "xno" -a "${HAVE_OSX}" = "1"]) dnl dnl VideoToolbox plugins ___ vlc-commits mailing list vlc-commits@videolan.org https://mailman.videolan.org/listinfo/vlc-commits
[vlc-commits] demux/mkv: silence warning related to struct vs class
vlc | branch: master | Filip Roséen| Sat Feb 25 20:21:53 2017 +0100| [031f9a0d6738a944b159123781529e81861a0b71] | committer: Jean-Baptiste Kempf demux/mkv: silence warning related to struct vs class Signed-off-by: Jean-Baptiste Kempf > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=031f9a0d6738a944b159123781529e81861a0b71 --- modules/demux/mkv/matroska_segment.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/demux/mkv/matroska_segment.hpp b/modules/demux/mkv/matroska_segment.hpp index f8df9f6..a77a7f73 100644 --- a/modules/demux/mkv/matroska_segment.hpp +++ b/modules/demux/mkv/matroska_segment.hpp @@ -39,7 +39,7 @@ class chapter_edition_c; class chapter_translation_c; class chapter_item_c; -struct mkv_track_t; +class mkv_track_t; struct mkv_index_t; typedef enum ___ vlc-commits mailing list vlc-commits@videolan.org https://mailman.videolan.org/listinfo/vlc-commits
[vlc-commits] demux/mkv: removed unused forward-declaration
vlc | branch: master | Filip Roséen| Sat Feb 25 20:21:54 2017 +0100| [832d4955002ab42366c2b3d911eaaaf71764a1a5] | committer: Jean-Baptiste Kempf demux/mkv: removed unused forward-declaration There is not a single reference to struct mkv_index_t within the demuxer. Signed-off-by: Jean-Baptiste Kempf > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=832d4955002ab42366c2b3d911eaaaf71764a1a5 --- modules/demux/mkv/matroska_segment.hpp | 1 - 1 file changed, 1 deletion(-) diff --git a/modules/demux/mkv/matroska_segment.hpp b/modules/demux/mkv/matroska_segment.hpp index a77a7f73..edf3600 100644 --- a/modules/demux/mkv/matroska_segment.hpp +++ b/modules/demux/mkv/matroska_segment.hpp @@ -40,7 +40,6 @@ class chapter_translation_c; class chapter_item_c; class mkv_track_t; -struct mkv_index_t; typedef enum { ___ vlc-commits mailing list vlc-commits@videolan.org https://mailman.videolan.org/listinfo/vlc-commits
[vlc-commits] demux/mkv: use appropriate helper for A_ALAC
vlc | branch: master | Filip Roséen| Sat Feb 25 20:21:55 2017 +0100| [b2d56b247bc4cb975f9734f2ecb0cbd630e51d1d] | committer: Jean-Baptiste Kempf demux/mkv: use appropriate helper for A_ALAC The correct helper-function is named fill_extra_data_alac, and not fill_extra_data. The errournous usage seems to have been introduced during the big refactoring of the demuxer. Signed-off-by: Jean-Baptiste Kempf > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=b2d56b247bc4cb975f9734f2ecb0cbd630e51d1d --- modules/demux/mkv/matroska_segment_parse.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/demux/mkv/matroska_segment_parse.cpp b/modules/demux/mkv/matroska_segment_parse.cpp index 0f96ffa..30aa550 100644 --- a/modules/demux/mkv/matroska_segment_parse.cpp +++ b/modules/demux/mkv/matroska_segment_parse.cpp @@ -1640,7 +1640,7 @@ int32_t matroska_segment_c::TrackInit( mkv_track_t * p_tk ) } S_CASE("A_ALAC") { vars.p_tk->fmt.i_codec = VLC_CODEC_ALAC; -fill_extra_data( vars.p_tk, 0); +fill_extra_data_alac( vars.p_tk ); } S_CASE("A_WAVPACK4") { vars.p_tk->fmt.i_codec = VLC_CODEC_WAVPACK; ___ vlc-commits mailing list vlc-commits@videolan.org https://mailman.videolan.org/listinfo/vlc-commits
[vlc-commits] tls: revector
vlc | branch: master | Rémi Denis-Courmont| Sat Feb 25 22:09:05 2017 +0200| [e2583c430e391b9397f89f35765ea3f4c6e402f8] | committer: Rémi Denis-Courmont tls: revector > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=e2583c430e391b9397f89f35765ea3f4c6e402f8 --- src/network/tls.c | 189 +++--- 1 file changed, 137 insertions(+), 52 deletions(-) diff --git a/src/network/tls.c b/src/network/tls.c index a4f35c9..2d04eb4 100644 --- a/src/network/tls.c +++ b/src/network/tls.c @@ -35,6 +35,7 @@ #include #include #include +#include #ifdef HAVE_SYS_UIO_H # include #endif @@ -328,6 +329,8 @@ typedef struct vlc_tls_socket { struct vlc_tls tls; int fd; +socklen_t peerlen; +struct sockaddr peer[]; } vlc_tls_socket_t; static int vlc_tls_SocketGetFD(vlc_tls_t *tls) @@ -372,9 +375,11 @@ static void vlc_tls_SocketClose(vlc_tls_t *tls) free(tls); } -vlc_tls_t *vlc_tls_SocketOpen(int fd) +static vlc_tls_t *vlc_tls_SocketAlloc(int fd, + const struct sockaddr *restrict peer, + socklen_t peerlen) { -vlc_tls_socket_t *sock = malloc(sizeof (*sock)); +vlc_tls_socket_t *sock = malloc(sizeof (*sock) + peerlen); if (unlikely(sock == NULL)) return NULL; @@ -386,72 +391,115 @@ vlc_tls_t *vlc_tls_SocketOpen(int fd) tls->shutdown = vlc_tls_SocketShutdown; tls->close = vlc_tls_SocketClose; tls->p = NULL; + sock->fd = fd; +sock->peerlen = peerlen; +if (peerlen > 0) +memcpy(sock->peer, peer, peerlen); return tls; } -static vlc_tls_t *vlc_tls_SocketOpenAddrInfoSingle(vlc_object_t *obj, - const struct addrinfo *restrict info) +vlc_tls_t *vlc_tls_SocketOpen(int fd) +{ +return vlc_tls_SocketAlloc(fd, NULL, 0); +} + +/** + * Allocates an unconnected transport layer socket. + */ +static vlc_tls_t *vlc_tls_SocketAddrInfo(const struct addrinfo *restrict info) { int fd = vlc_socket(info->ai_family, info->ai_socktype, info->ai_protocol, true /* nonblocking */); if (fd == -1) -{ -msg_Warn(obj, "socket error: %s", vlc_strerror_c(errno)); return NULL; -} setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &(int){ 1 }, sizeof (int)); -int val = connect(fd, info->ai_addr, info->ai_addrlen); -if (val != 0) -{ -if (errno != EINPROGRESS) -{ -msg_Err(obj, "connection error: %s", vlc_strerror_c(errno)); -goto giveup; -} +vlc_tls_t *sk = vlc_tls_SocketAlloc(fd, info->ai_addr, info->ai_addrlen); +if (unlikely(sk == NULL)) +net_Close(fd); +return sk; +} -struct pollfd ufd; +/** + * Waits for pending transport layer socket connection. + */ +static int vlc_tls_WaitConnect(vlc_tls_t *tls) +{ +const int fd = vlc_tls_GetFD(tls); +struct pollfd ufd; -ufd.fd = fd; -ufd.events = POLLOUT; +ufd.fd = fd; +ufd.events = POLLOUT; -do +do +{ +if (vlc_killed()) { -if (vlc_killed()) -{ -errno = EINTR; -goto giveup; -} +errno = EINTR; +return -1; } -while (vlc_poll_i11e(, 1, -1) <= 0); +} +while (vlc_poll_i11e(, 1, -1) <= 0); -socklen_t len = sizeof (val); -if (getsockopt(fd, SOL_SOCKET, SO_ERROR, , )) -{ -msg_Err(obj, "socket option error: %s", -vlc_strerror_c(errno)); -goto giveup; -} +int val; +socklen_t len = sizeof (val); -if (val != 0) -{ -msg_Err(obj, "connection error: %s", vlc_strerror_c(val)); -errno = val; -goto giveup; -} +if (getsockopt(fd, SOL_SOCKET, SO_ERROR, , )) +return -1; + +if (val != 0) +{ +errno = val; +return -1; } +return 0; +} -vlc_tls_t *tls = vlc_tls_SocketOpen(fd); -if (unlikely(tls == NULL)) -goto giveup; +/** + * Connects a transport layer socket. + */ +static ssize_t vlc_tls_Connect(vlc_tls_t *tls) +{ +const vlc_tls_socket_t *sock = (vlc_tls_socket_t *)tls; + +if (connect(sock->fd, sock->peer, sock->peerlen) == 0) +return 0; +#ifndef _WIN32 +if (errno != EINPROGRESS) +return -1; +#else +if (WSAGetLastError() != WSAEWOULDBLOCK) +return -1; +#endif +return vlc_tls_WaitConnect(tls); +} -return tls; +/* Callback for combined connection establishment and initial send */ +static ssize_t vlc_tls_ConnectWrite(vlc_tls_t *tls, +const struct iovec *iov,unsigned count) +{ +if (vlc_tls_Connect(tls)) +return -1; -giveup: -net_Close(fd); -return NULL; +/* Next time, write directly. Do not retry to connect. */ +
[vlc-commits] http: use vlc_tls_t for HTTP 2 connection test
vlc | branch: master | Rémi Denis-Courmont| Sat Feb 25 23:29:26 2017 +0200| [cb30cb28179c2935fed68a3ea02eafbab684136a] | committer: Rémi Denis-Courmont http: use vlc_tls_t for HTTP 2 connection test > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=cb30cb28179c2935fed68a3ea02eafbab684136a --- modules/access/http/h2conn_test.c | 25 +++-- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/modules/access/http/h2conn_test.c b/modules/access/http/h2conn_test.c index 5a40a7e..109e6c0 100644 --- a/modules/access/http/h2conn_test.c +++ b/modules/access/http/h2conn_test.c @@ -39,14 +39,14 @@ #include "message.h" static struct vlc_http_conn *conn; -static int external_fd; +static struct vlc_tls *external_tls; static void conn_send(struct vlc_h2_frame *f) { assert(f != NULL); size_t len = vlc_h2_frame_size(f); -ssize_t val = write(external_fd, f->data, len); +ssize_t val = vlc_tls_Write(external_tls, f->data, len); assert((size_t)val == len); free(f); } @@ -64,7 +64,7 @@ static void conn_expect(uint_fast8_t wanted) uint8_t got; do { -val = recv(external_fd, hdr, 9, MSG_WAITALL); +val = vlc_tls_Read(external_tls, hdr, 9, true); assert(val == 9); assert(hdr[0] == 0); @@ -77,7 +77,7 @@ static void conn_expect(uint_fast8_t wanted) { char buf[len]; -val = recv(external_fd, buf, len, MSG_WAITALL); +val = vlc_tls_Read(external_tls, buf, len, true); assert(val == (ssize_t)len); } } @@ -87,22 +87,19 @@ static void conn_expect(uint_fast8_t wanted) static void conn_create(void) { ssize_t val; -int fds[2]; +vlc_tls_t *tlsv[2]; char hello[24]; -if (vlc_socketpair(PF_LOCAL, SOCK_STREAM, 0, fds, false)) +if (vlc_tls_SocketPair(PF_LOCAL, 0, tlsv)) assert(!"socketpair"); -struct vlc_tls *tls = vlc_tls_SocketOpen(fds[1]); -assert(tls != NULL); +external_tls = tlsv[0]; -external_fd = fds[0]; - -conn = vlc_h2_conn_create(NULL, tls); +conn = vlc_h2_conn_create(NULL, tlsv[1]); assert(conn != NULL); conn_send(vlc_h2_frame_settings()); -val = recv(external_fd, hello, 24, MSG_WAITALL); +val = vlc_tls_Read(external_tls, hello, 24, true); assert(val == 24); assert(!memcmp(hello, "PRI * HTTP/2.0\r\n", 16)); conn_expect(SETTINGS); @@ -111,9 +108,9 @@ static void conn_create(void) static void conn_destroy(void) { -shutdown(external_fd, SHUT_WR); +vlc_tls_Shutdown(external_tls, false); vlc_http_conn_release(conn); -vlc_close(external_fd); +vlc_tls_SessionDelete(external_tls); } static struct vlc_http_stream *stream_open(void) ___ vlc-commits mailing list vlc-commits@videolan.org https://mailman.videolan.org/listinfo/vlc-commits
[vlc-commits] http: add opaque data pointer to connection structures
vlc | branch: master | Rémi Denis-Courmont| Sat Feb 25 19:07:20 2017 +0200| [1d384b96dbce33149eb1c47781736c8784a53ce9] | committer: Rémi Denis-Courmont http: add opaque data pointer to connection structures This is to pass a VLC object (so far for logging only). > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=1d384b96dbce33149eb1c47781736c8784a53ce9 --- modules/access/http/conn.h | 8 +++- modules/access/http/connmgr.c | 29 +++--- modules/access/http/h1conn.c | 12 +++--- modules/access/http/h1conn_test.c | 4 +- modules/access/http/h2conn.c | 79 +++--- modules/access/http/h2conn_test.c | 2 +- modules/access/http/h2frame.c | 17 modules/access/http/h2frame.h | 6 +-- modules/access/http/h2frame_test.c | 11 ++ modules/access/http/h2output.c | 2 - modules/access/http/transport.h| 2 +- modules/access/http/tunnel.c | 6 +-- modules/access/http/tunnel_test.c | 8 ++-- 13 files changed, 116 insertions(+), 70 deletions(-) diff --git a/modules/access/http/conn.h b/modules/access/http/conn.h index 59aa8c9..27f0e31 100644 --- a/modules/access/http/conn.h +++ b/modules/access/http/conn.h @@ -54,11 +54,15 @@ static inline void vlc_http_conn_release(struct vlc_http_conn *conn) conn->cbs->release(conn); } +void vlc_http_err(void *, const char *msg, ...) VLC_FORMAT(2, 3); +void vlc_http_dbg(void *, const char *msg, ...) VLC_FORMAT(2, 3); + /** * \defgroup http1 HTTP/1.x * @{ */ -struct vlc_http_conn *vlc_h1_conn_create(struct vlc_tls *, bool proxy); +struct vlc_http_conn *vlc_h1_conn_create(void *ctx, struct vlc_tls *, + bool proxy); struct vlc_http_stream *vlc_chunked_open(struct vlc_http_stream *, struct vlc_tls *); @@ -68,7 +72,7 @@ struct vlc_http_stream *vlc_chunked_open(struct vlc_http_stream *, * \defgroup h2 HTTP/2.0 * @{ */ -struct vlc_http_conn *vlc_h2_conn_create(struct vlc_tls *); +struct vlc_http_conn *vlc_h2_conn_create(void *ctx, struct vlc_tls *); /** @} */ diff --git a/modules/access/http/connmgr.c b/modules/access/http/connmgr.c index c8f8b39..9bc374d 100644 --- a/modules/access/http/connmgr.c +++ b/modules/access/http/connmgr.c @@ -34,6 +34,24 @@ #pragma GCC visibility push(default) +void vlc_http_err(void *ctx, const char *fmt, ...) +{ +va_list ap; + +va_start(ap, fmt); +msg_GenericVa((vlc_object_t *)ctx, VLC_MSG_ERR, fmt, ap); +va_end(ap); +} + +void vlc_http_dbg(void *ctx, const char *fmt, ...) +{ +va_list ap; + +va_start(ap, fmt); +msg_GenericVa((vlc_object_t *)ctx, VLC_MSG_DBG, fmt, ap); +va_end(ap); +} + static char *vlc_http_proxy_find(const char *hostname, unsigned port, bool secure) { @@ -62,7 +80,8 @@ static vlc_tls_t *vlc_https_connect_i11e(vlc_tls_creds_t *creds, char *proxy = vlc_http_proxy_find(host, port, true); if (proxy != NULL) { -tls = vlc_https_connect_proxy(creds, host, port, http_two, proxy); +tls = vlc_https_connect_proxy(creds->obj.parent, creds, host, port, + http_two, proxy); free(proxy); } else @@ -186,9 +205,9 @@ static struct vlc_http_msg *vlc_https_request(struct vlc_http_mgr *mgr, * NOTE: We do not enforce TLS version 1.2 for HTTP 2.0 explicitly. */ if (http2) -conn = vlc_h2_conn_create(tls); +conn = vlc_h2_conn_create(mgr->obj, tls); else -conn = vlc_h1_conn_create(tls, false); +conn = vlc_h1_conn_create(mgr->obj, tls, false); if (unlikely(conn == NULL)) { @@ -220,9 +239,9 @@ static struct vlc_http_msg *vlc_http_request(struct vlc_http_mgr *mgr, struct vlc_http_conn *conn; if (mgr->use_h2c) -conn = vlc_h2_conn_create(tls); +conn = vlc_h2_conn_create(mgr->obj, tls); else -conn = vlc_h1_conn_create(tls, proxy); +conn = vlc_h1_conn_create(mgr->obj, tls, proxy); if (unlikely(conn == NULL)) { diff --git a/modules/access/http/h1conn.c b/modules/access/http/h1conn.c index bc4ac48..eaedcbf 100644 --- a/modules/access/http/h1conn.c +++ b/modules/access/http/h1conn.c @@ -116,9 +116,10 @@ struct vlc_h1_conn bool active; bool released; bool proxy; +void *opaque; }; -#define CO(conn) ((conn)->conn.tls->obj) +#define CO(conn) ((conn)->opaque) static void vlc_h1_conn_destroy(struct vlc_h1_conn *conn); @@ -126,7 +127,7 @@ static void *vlc_h1_stream_fatal(struct vlc_h1_conn *conn) { if (conn->conn.tls != NULL) { -msg_Dbg(CO(conn), "connection failed"); +vlc_http_dbg(CO(conn), "connection failed"); vlc_tls_Shutdown(conn->conn.tls, true); vlc_tls_Close(conn->conn.tls); conn->conn.tls = NULL; @@ -155,7 +156,7 @@ static struct vlc_http_stream
[vlc-commits] http: use vlc_tls_SocketOpenTLS()
vlc | branch: master | Rémi Denis-Courmont| Sat Feb 25 21:44:21 2017 +0200| [1f85fe4be5c1490e328c0c308a0c73f047137834] | committer: Rémi Denis-Courmont http: use vlc_tls_SocketOpenTLS() > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=1f85fe4be5c1490e328c0c308a0c73f047137834 --- modules/access/http/Makefile.am | 2 +- modules/access/http/connmgr.c | 20 ++ modules/access/http/transport.c | 58 - 3 files changed, 21 insertions(+), 59 deletions(-) diff --git a/modules/access/http/Makefile.am b/modules/access/http/Makefile.am index d447a42..8e6f041 100644 --- a/modules/access/http/Makefile.am +++ b/modules/access/http/Makefile.am @@ -3,7 +3,7 @@ libhttps_plugin_la_LIBADD = libvlc_http.la access_LTLIBRARIES += libhttps_plugin.la libvlc_http_la_SOURCES = \ - access/http/transport.c access/http/transport.h \ + access/http/transport.h \ access/http/message.c access/http/message.h \ access/http/resource.c access/http/resource.h \ access/http/file.c access/http/file.h \ diff --git a/modules/access/http/connmgr.c b/modules/access/http/connmgr.c index 9bc374d..5554744 100644 --- a/modules/access/http/connmgr.c +++ b/modules/access/http/connmgr.c @@ -52,6 +52,26 @@ void vlc_http_dbg(void *ctx, const char *fmt, ...) va_end(ap); } +vlc_tls_t *vlc_https_connect(vlc_tls_creds_t *creds, const char *name, + unsigned port, bool *restrict two) +{ +if (port == 0) +port = 443; + +/* TLS with ALPN */ +const char *alpn[] = { "h2", "http/1.1", NULL }; +char *alp; + +vlc_tls_t *tls = vlc_tls_SocketOpenTLS(creds, name, port, "https", + alpn + !*two, ); +if (tls != NULL) +{ +*two = (alp != NULL) && !strcmp(alp, "h2"); +free(alp); +} +return tls; +} + static char *vlc_http_proxy_find(const char *hostname, unsigned port, bool secure) { diff --git a/modules/access/http/transport.c b/modules/access/http/transport.c deleted file mode 100644 index 2a1247a..000 --- a/modules/access/http/transport.c +++ /dev/null @@ -1,58 +0,0 @@ -/* - * transport.c: HTTP/TLS TCP transport layer - * - * Copyright © 2015 Rémi Denis-Courmont - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation; either version 2.1 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. - */ - -#ifdef HAVE_CONFIG_H -# include -#endif - -#include -#include -#include - -#include "transport.h" - -vlc_tls_t *vlc_https_connect(vlc_tls_creds_t *creds, const char *name, - unsigned port, bool *restrict two) -{ -if (port == 0) -port = 443; - -/* TODO: implement fast open. This requires merging vlc_tls_SocketOpenTCP() - * and vlc_tls_ClientSessionCreate() though. */ -vlc_tls_t *sock = vlc_tls_SocketOpenTCP(creds->obj.parent, name, port); -if (sock == NULL) -return NULL; - -/* TLS with ALPN */ -const char *alpn[] = { "h2", "http/1.1", NULL }; -char *alp; - -vlc_tls_t *tls = vlc_tls_ClientSessionCreate(creds, sock, name, "https", - alpn + !*two, ); -if (tls == NULL) -{ -vlc_tls_Close(sock); -return NULL; -} - -*two = (alp != NULL) && !strcmp(alp, "h2"); -free(alp); -return tls; -} ___ vlc-commits mailing list vlc-commits@videolan.org https://mailman.videolan.org/listinfo/vlc-commits
[vlc-commits] tls: introduce vlc_tls_SocketPair()
vlc | branch: master | Rémi Denis-Courmont| Sat Feb 25 23:28:42 2017 +0200| [e70e33564351d2500f19cc5aa46f4ab2811d3880] | committer: Rémi Denis-Courmont tls: introduce vlc_tls_SocketPair() This creates a pair of mutually connected stream vlc_tls_t. > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=e70e33564351d2500f19cc5aa46f4ab2811d3880 --- include/vlc_tls.h | 5 + src/libvlccore.sym | 1 + src/network/tls.c | 26 ++ 3 files changed, 32 insertions(+) diff --git a/include/vlc_tls.h b/include/vlc_tls.h index 38a41f7..3a00b40 100644 --- a/include/vlc_tls.h +++ b/include/vlc_tls.h @@ -232,6 +232,11 @@ VLC_API void vlc_tls_Delete (vlc_tls_creds_t *); */ VLC_API vlc_tls_t *vlc_tls_SocketOpen(int fd); +/** + * Creates a connected pair of transport-layer sockets. + */ +VLC_API int vlc_tls_SocketPair(int family, int protocol, vlc_tls_t *[2]); + struct addrinfo; /** diff --git a/src/libvlccore.sym b/src/libvlccore.sym index b4bdd98..343638d 100644 --- a/src/libvlccore.sym +++ b/src/libvlccore.sym @@ -445,6 +445,7 @@ vlc_tls_GetLine vlc_tls_SocketOpen vlc_tls_SocketOpenTCP vlc_tls_SocketOpenTLS +vlc_tls_SocketPair ToCharset update_Check update_Delete diff --git a/src/network/tls.c b/src/network/tls.c index d7450d2..9cde48e 100644 --- a/src/network/tls.c +++ b/src/network/tls.c @@ -404,6 +404,32 @@ vlc_tls_t *vlc_tls_SocketOpen(int fd) return vlc_tls_SocketAlloc(fd, NULL, 0); } +int vlc_tls_SocketPair(int family, int protocol, vlc_tls_t *pair[2]) +{ +int fds[2]; + +if (vlc_socketpair(family, SOCK_STREAM, protocol, fds, true)) +return -1; + +for (size_t i = 0; i < 2; i++) +{ +setsockopt(fds[i], SOL_SOCKET, SO_REUSEADDR, + &(int){ 1 }, sizeof (int)); + +pair[i] = vlc_tls_SocketAlloc(fds[i], NULL, 0); +if (unlikely(pair[i] == NULL)) +{ +net_Close(fds[i]); +if (i) +vlc_tls_SessionDelete(pair[0]); +else +net_Close(fds[1]); +return -1; +} +} +return 0; +} + /** * Allocates an unconnected transport layer socket. */ ___ vlc-commits mailing list vlc-commits@videolan.org https://mailman.videolan.org/listinfo/vlc-commits
[vlc-commits] tls: add support for TCP Fast Open (refs #16067)
vlc | branch: master | Rémi Denis-Courmont| Sat Feb 25 23:07:16 2017 +0200| [72f0a2e63548685870403f51d725cd0650c5e8be] | committer: Rémi Denis-Courmont tls: add support for TCP Fast Open (refs #16067) This only works underneath client-side TLS so far. > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=72f0a2e63548685870403f51d725cd0650c5e8be --- src/network/tls.c | 25 + 1 file changed, 25 insertions(+) diff --git a/src/network/tls.c b/src/network/tls.c index 2d04eb4..d7450d2 100644 --- a/src/network/tls.c +++ b/src/network/tls.c @@ -480,6 +480,31 @@ static ssize_t vlc_tls_Connect(vlc_tls_t *tls) static ssize_t vlc_tls_ConnectWrite(vlc_tls_t *tls, const struct iovec *iov,unsigned count) { +#ifdef MSG_FASTOPEN +vlc_tls_socket_t *sock = (vlc_tls_socket_t *)tls; +const struct msghdr msg = +{ +.msg_name = sock->peer, +.msg_namelen = sock->peerlen, +.msg_iov = (struct iovec *)iov, +.msg_iovlen = count, +}; +ssize_t ret; + +ret = sendmsg(vlc_tls_SocketGetFD(tls), , MSG_NOSIGNAL|MSG_FASTOPEN); +if (ret >= 0) +{ /* Fast open in progress */ +tls->writev = vlc_tls_SocketWrite; +return ret; +} + +if (errno == EINPROGRESS) +return vlc_tls_WaitConnect(tls); +if (errno != EOPNOTSUPP) +return -1; +/* Fast open not supported or disabled... fallback to normal mode */ +#endif + if (vlc_tls_Connect(tls)) return -1; ___ vlc-commits mailing list vlc-commits@videolan.org https://mailman.videolan.org/listinfo/vlc-commits
[vlc-commits] tls: add vlc_tls_SocketOpenTLS()
vlc | branch: master | Rémi Denis-Courmont| Sat Feb 25 21:40:45 2017 +0200| [7509e1f829d11797179337603c6affc2fe13607b] | committer: Rémi Denis-Courmont tls: add vlc_tls_SocketOpenTLS() > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=7509e1f829d11797179337603c6affc2fe13607b --- include/vlc_tls.h | 8 src/libvlccore.sym | 1 + src/network/tls.c | 15 +++ 3 files changed, 24 insertions(+) diff --git a/include/vlc_tls.h b/include/vlc_tls.h index 623436f..38a41f7 100644 --- a/include/vlc_tls.h +++ b/include/vlc_tls.h @@ -252,6 +252,14 @@ vlc_tls_t *vlc_tls_SocketOpenAddrInfo(vlc_object_t *obj, VLC_API vlc_tls_t *vlc_tls_SocketOpenTCP(vlc_object_t *obj, const char *hostname, unsigned port); +/** + * Initiates a TLS session over TCP. + */ +VLC_API vlc_tls_t *vlc_tls_SocketOpenTLS(vlc_tls_creds_t *crd, + const char *hostname, unsigned port, + const char *service, + const char *const *alpn, char **alp); + VLC_DEPRECATED static inline vlc_tls_t * vlc_tls_ClientSessionCreateFD(vlc_tls_creds_t *crd, int fd, const char *host, diff --git a/src/libvlccore.sym b/src/libvlccore.sym index 8a29141..b4bdd98 100644 --- a/src/libvlccore.sym +++ b/src/libvlccore.sym @@ -444,6 +444,7 @@ vlc_tls_Write vlc_tls_GetLine vlc_tls_SocketOpen vlc_tls_SocketOpenTCP +vlc_tls_SocketOpenTLS ToCharset update_Check update_Delete diff --git a/src/network/tls.c b/src/network/tls.c index 286c70c..a4f35c9 100644 --- a/src/network/tls.c +++ b/src/network/tls.c @@ -493,3 +493,18 @@ vlc_tls_t *vlc_tls_SocketOpenTCP(vlc_object_t *obj, const char *name, freeaddrinfo(res); return tls; } + +vlc_tls_t *vlc_tls_SocketOpenTLS(vlc_tls_creds_t *creds, const char *name, + unsigned port, const char *service, + const char *const *alpn, char **alp) +{ +vlc_tls_t *tcp = vlc_tls_SocketOpenTCP(VLC_OBJECT(creds), name, port); +if (tcp == NULL) +return NULL; + +vlc_tls_t *tls = vlc_tls_ClientSessionCreate(creds, tcp, name, service, + alpn, alp); +if (tls == NULL) +vlc_tls_SessionDelete(tcp); +return tls; +} ___ vlc-commits mailing list vlc-commits@videolan.org https://mailman.videolan.org/listinfo/vlc-commits
[vlc-commits] tls: drop obj and sys from vlc_tls_t
vlc | branch: master | Rémi Denis-Courmont| Sat Feb 25 19:36:24 2017 +0200| [16d88a1a386724202f3fb8c2efc81e9fd9e941c2] | committer: Rémi Denis-Courmont tls: drop obj and sys from vlc_tls_t > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=16d88a1a386724202f3fb8c2efc81e9fd9e941c2 --- include/vlc_tls.h| 7 +-- modules/access/http/tunnel.c | 49 +++ modules/misc/gnutls.c| 111 +++ src/network/tls.c| 66 - 4 files changed, 132 insertions(+), 101 deletions(-) diff --git a/include/vlc_tls.h b/include/vlc_tls.h index 2e5da35..81772a6 100644 --- a/include/vlc_tls.h +++ b/include/vlc_tls.h @@ -38,9 +38,6 @@ typedef struct vlc_tls_creds vlc_tls_creds_t; /** TLS session */ struct vlc_tls { -vlc_object_t *obj; -void *sys; - int (*get_fd)(struct vlc_tls *); ssize_t (*readv)(struct vlc_tls *, struct iovec *, unsigned); ssize_t (*writev)(struct vlc_tls *, const struct iovec *, unsigned); @@ -180,8 +177,8 @@ struct vlc_tls_creds module_t *module; void *sys; -int (*open)(vlc_tls_creds_t *, vlc_tls_t *session, vlc_tls_t *sock, -const char *host, const char *const *alpn); +vlc_tls_t *(*open)(vlc_tls_creds_t *, vlc_tls_t *sock, + const char *host, const char *const *alpn); int (*handshake)(vlc_tls_creds_t *, vlc_tls_t *session, const char *host, const char *service, char ** /*restrict*/ alp); }; diff --git a/modules/access/http/tunnel.c b/modules/access/http/tunnel.c index fcebafd..f311ecf 100644 --- a/modules/access/http/tunnel.c +++ b/modules/access/http/tunnel.c @@ -88,17 +88,24 @@ static struct vlc_http_msg *vlc_http_tunnel_open(struct vlc_http_conn *conn, return resp; } +typedef struct vlc_tls_proxy +{ +vlc_tls_t tls; +vlc_tls_t *sock; +} vlc_tls_proxy_t; + static int vlc_tls_ProxyGetFD(vlc_tls_t *tls) { -struct vlc_tls *sock = tls->sys; +vlc_tls_proxy_t *proxy = (vlc_tls_proxy_t *)tls; -return vlc_tls_GetFD(sock); +return vlc_tls_GetFD(proxy->sock); } static ssize_t vlc_tls_ProxyRead(vlc_tls_t *tls, struct iovec *iov, unsigned count) { -struct vlc_tls *sock = tls->sys; +vlc_tls_proxy_t *proxy = (vlc_tls_proxy_t *)tls; +vlc_tls_t *sock = proxy->sock; return sock->readv(sock, iov, count); } @@ -106,21 +113,24 @@ static ssize_t vlc_tls_ProxyRead(vlc_tls_t *tls, struct iovec *iov, static ssize_t vlc_tls_ProxyWrite(vlc_tls_t *tls, const struct iovec *iov, unsigned count) { -struct vlc_tls *sock = tls->sys; +vlc_tls_proxy_t *proxy = (vlc_tls_proxy_t *)tls; +vlc_tls_t *sock = proxy->sock; return sock->writev(sock, iov, count); } static int vlc_tls_ProxyShutdown(vlc_tls_t *tls, bool duplex) { -struct vlc_tls *sock = tls->sys; +vlc_tls_proxy_t *proxy = (vlc_tls_proxy_t *)tls; -return vlc_tls_Shutdown(sock, duplex); +return vlc_tls_Shutdown(proxy->sock, duplex); } static void vlc_tls_ProxyClose(vlc_tls_t *tls) { -(void) tls; +vlc_tls_proxy_t *proxy = (vlc_tls_proxy_t *)tls; + +free(proxy); } vlc_tls_t *vlc_https_connect_proxy(void *ctx, vlc_tls_creds_t *creds, @@ -164,27 +174,26 @@ vlc_tls_t *vlc_https_connect_proxy(void *ctx, vlc_tls_creds_t *creds, assert(!ptwo); /* HTTP/2 proxy not supported yet */ -struct vlc_tls *psock = malloc(sizeof (*psock)); +vlc_tls_proxy_t *psock = malloc(sizeof (*psock)); if (unlikely(psock == NULL)) { vlc_UrlClean(); goto error; } -psock->obj = VLC_OBJECT(creds); -psock->sys = sock; -psock->get_fd = vlc_tls_ProxyGetFD; -psock->readv = vlc_tls_ProxyRead; -psock->writev = vlc_tls_ProxyWrite; -psock->shutdown = vlc_tls_ProxyShutdown; -psock->close = vlc_tls_ProxyClose; -psock->p = NULL; - -struct vlc_http_conn *conn = /*ptwo ? vlc_h2_conn_create(ctx, psock) - :*/ vlc_h1_conn_create(ctx, psock, false); +psock->tls.get_fd = vlc_tls_ProxyGetFD; +psock->tls.readv = vlc_tls_ProxyRead; +psock->tls.writev = vlc_tls_ProxyWrite; +psock->tls.shutdown = vlc_tls_ProxyShutdown; +psock->tls.close = vlc_tls_ProxyClose; +psock->tls.p = NULL; +psock->sock = sock; + +struct vlc_http_conn *conn = /*ptwo ? vlc_h2_conn_create(ctx, >tls) + :*/ vlc_h1_conn_create(ctx, >tls, false); if (unlikely(conn == NULL)) { -vlc_tls_Close(psock); +vlc_tls_Close(>tls); vlc_UrlClean(); goto error; } diff --git a/modules/misc/gnutls.c b/modules/misc/gnutls.c index e45110e..f6440ea 100644 --- a/modules/misc/gnutls.c +++ b/modules/misc/gnutls.c @@ -1,7 +1,7 @@ /* * gnutls.c
[vlc-commits] http: use vlc_tls_t for HTTP 1 connection test
vlc | branch: master | Rémi Denis-Courmont| Sat Feb 25 23:29:26 2017 +0200| [13a131c31a4b8cf645dc0f40f483e500275b7482] | committer: Rémi Denis-Courmont http: use vlc_tls_t for HTTP 1 connection test > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=13a131c31a4b8cf645dc0f40f483e500275b7482 --- modules/access/http/h1conn_test.c | 25 +++-- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/modules/access/http/h1conn_test.c b/modules/access/http/h1conn_test.c index 3979c5f..2817b45 100644 --- a/modules/access/http/h1conn_test.c +++ b/modules/access/http/h1conn_test.c @@ -38,27 +38,24 @@ #include "message.h" static struct vlc_http_conn *conn; -static int external_fd; +static struct vlc_tls *external_tls; static void conn_create(void) { -int fds[2]; +vlc_tls_t *tlsv[2]; -if (vlc_socketpair(PF_LOCAL, SOCK_STREAM, 0, fds, false)) -assert(!"socketpair"); +if (vlc_tls_SocketPair(PF_LOCAL, 0, tlsv)) +assert(!"vlc_tls_SocketPair"); -struct vlc_tls *tls = vlc_tls_SocketOpen(fds[1]); -assert(tls != NULL); +external_tls = tlsv[0]; -external_fd = fds[0]; - -conn = vlc_h1_conn_create(NULL, tls, false); +conn = vlc_h1_conn_create(NULL, tlsv[1], false); assert(conn != NULL); } static void conn_send_raw(const void *buf, size_t len) { -ssize_t val = write(external_fd, buf, len); +ssize_t val = vlc_tls_Write(external_tls, buf, len); assert((size_t)val == len); } @@ -67,16 +64,16 @@ static void conn_send(const char *str) return conn_send_raw(str, strlen(str)); } -static void conn_shutdown(int how) +static void conn_shutdown(bool duplex) { -shutdown(external_fd, how); +vlc_tls_Shutdown(external_tls, duplex); } static void conn_destroy(void) { -conn_shutdown(SHUT_WR); +conn_shutdown(false); vlc_http_conn_release(conn); -vlc_close(external_fd); +vlc_tls_SessionDelete(external_tls); } static struct vlc_http_stream *stream_open(void) ___ vlc-commits mailing list vlc-commits@videolan.org https://mailman.videolan.org/listinfo/vlc-commits
[vlc-commits] tls: drop unused vlc_tls_SocketOpen() parameter
vlc | branch: master | Rémi Denis-Courmont| Sat Feb 25 19:38:34 2017 +0200| [074d87769266efa4ffda57e7251da409144e46cd] | committer: Rémi Denis-Courmont tls: drop unused vlc_tls_SocketOpen() parameter > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=074d87769266efa4ffda57e7251da409144e46cd --- include/vlc_tls.h | 4 ++-- modules/access/http/h1conn_test.c | 2 +- modules/access/http/h2conn_test.c | 2 +- src/network/tls.c | 6 +++--- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/include/vlc_tls.h b/include/vlc_tls.h index 81772a6..623436f 100644 --- a/include/vlc_tls.h +++ b/include/vlc_tls.h @@ -230,7 +230,7 @@ VLC_API void vlc_tls_Delete (vlc_tls_creds_t *); * * This function is not a cancellation point. */ -VLC_API vlc_tls_t *vlc_tls_SocketOpen(vlc_object_t *obj, int fd); +VLC_API vlc_tls_t *vlc_tls_SocketOpen(int fd); struct addrinfo; @@ -257,7 +257,7 @@ static inline vlc_tls_t * vlc_tls_ClientSessionCreateFD(vlc_tls_creds_t *crd, int fd, const char *host, const char *srv, const char *const *lp, char **p) { -vlc_tls_t *sock = vlc_tls_SocketOpen(VLC_OBJECT(crd), fd); +vlc_tls_t *sock = vlc_tls_SocketOpen(fd); if (unlikely(sock == NULL)) return NULL; diff --git a/modules/access/http/h1conn_test.c b/modules/access/http/h1conn_test.c index a6f8222..3979c5f 100644 --- a/modules/access/http/h1conn_test.c +++ b/modules/access/http/h1conn_test.c @@ -47,7 +47,7 @@ static void conn_create(void) if (vlc_socketpair(PF_LOCAL, SOCK_STREAM, 0, fds, false)) assert(!"socketpair"); -struct vlc_tls *tls = vlc_tls_SocketOpen(NULL, fds[1]); +struct vlc_tls *tls = vlc_tls_SocketOpen(fds[1]); assert(tls != NULL); external_fd = fds[0]; diff --git a/modules/access/http/h2conn_test.c b/modules/access/http/h2conn_test.c index 308529d..5a40a7e 100644 --- a/modules/access/http/h2conn_test.c +++ b/modules/access/http/h2conn_test.c @@ -93,7 +93,7 @@ static void conn_create(void) if (vlc_socketpair(PF_LOCAL, SOCK_STREAM, 0, fds, false)) assert(!"socketpair"); -struct vlc_tls *tls = vlc_tls_SocketOpen(NULL, fds[1]); +struct vlc_tls *tls = vlc_tls_SocketOpen(fds[1]); assert(tls != NULL); external_fd = fds[0]; diff --git a/src/network/tls.c b/src/network/tls.c index e7b4c47..286c70c 100644 --- a/src/network/tls.c +++ b/src/network/tls.c @@ -211,7 +211,7 @@ error: vlc_tls_t *vlc_tls_ServerSessionCreate(vlc_tls_creds_t *crd, int fd, const char *const *alpn) { -vlc_tls_t *sock = vlc_tls_SocketOpen(VLC_OBJECT(crd), fd); +vlc_tls_t *sock = vlc_tls_SocketOpen(fd); if (unlikely(sock == NULL)) return NULL; @@ -372,7 +372,7 @@ static void vlc_tls_SocketClose(vlc_tls_t *tls) free(tls); } -vlc_tls_t *vlc_tls_SocketOpen(vlc_object_t *obj, int fd) +vlc_tls_t *vlc_tls_SocketOpen(int fd) { vlc_tls_socket_t *sock = malloc(sizeof (*sock)); if (unlikely(sock == NULL)) @@ -443,7 +443,7 @@ static vlc_tls_t *vlc_tls_SocketOpenAddrInfoSingle(vlc_object_t *obj, } } -vlc_tls_t *tls = vlc_tls_SocketOpen(obj, fd); +vlc_tls_t *tls = vlc_tls_SocketOpen(fd); if (unlikely(tls == NULL)) goto giveup; ___ vlc-commits mailing list vlc-commits@videolan.org https://mailman.videolan.org/listinfo/vlc-commits