[vlc-commits] avcodec: set decoder error only when it's critical

2016-09-15 Thread Thomas Guillem
vlc | branch: master | Thomas Guillem  | Thu Sep 15 17:29:38 
2016 +0200| [e19a43ebb7a775ab9b09a370661e00fe9adf3f38] | committer: Thomas 
Guillem

avcodec: set decoder error only when it's critical

avcodec decoders can return an error for a frame/pkt, but that doesn't mean you
need to abort.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=e19a43ebb7a775ab9b09a370661e00fe9adf3f38
---

 modules/codec/avcodec/video.c | 12 ++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/modules/codec/avcodec/video.c b/modules/codec/avcodec/video.c
index 42d9e89..5f50167 100644
--- a/modules/codec/avcodec/video.c
+++ b/modules/codec/avcodec/video.c
@@ -829,7 +829,11 @@ static picture_t *DecodeVideo( decoder_t *p_dec, block_t 
**pp_block )
 int ret = avcodec_send_packet(p_context, );
 if( ret != 0 && ret != AVERROR(EAGAIN) )
 {
-p_dec->b_error = true;
+if (ret == AVERROR(ENOMEM) || ret == AVERROR(EINVAL))
+{
+msg_Err(p_dec, "avcodec_send_packet critical error");
+p_dec->b_error = true;
+}
 av_packet_unref(  );
 break;
 }
@@ -846,7 +850,11 @@ static picture_t *DecodeVideo( decoder_t *p_dec, block_t 
**pp_block )
 ret = avcodec_receive_frame(p_context, frame);
 if( ret != 0 && ret != AVERROR(EAGAIN) )
 {
-p_dec->b_error = true;
+if (ret == AVERROR(ENOMEM) || ret == AVERROR(EINVAL))
+{
+msg_Err(p_dec, "avcodec_receive_frame critical error");
+p_dec->b_error = true;
+}
 av_frame_free();
 break;
 }

___
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits


[vlc-commits] Revert "deinterlace: Fix blending of pictures with offset"

2016-09-15 Thread Thomas Guillem
vlc | branch: master | Thomas Guillem  | Thu Sep 15 15:14:57 
2016 +0200| [bf141e7836a09c7a9a2d60394ed3cd8ef17b943e] | committer: Thomas 
Guillem

Revert "deinterlace: Fix blending of pictures with offset"

This broke 16-bytes align requirement needed by some archs.

This reverts commit ccb8f7239183480aba3219a3ef046b538aad697d.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=bf141e7836a09c7a9a2d60394ed3cd8ef17b943e
---

 modules/video_filter/deinterlace/algo_basic.c | 15 +--
 1 file changed, 5 insertions(+), 10 deletions(-)

diff --git a/modules/video_filter/deinterlace/algo_basic.c 
b/modules/video_filter/deinterlace/algo_basic.c
index 8511d89..858ae93 100644
--- a/modules/video_filter/deinterlace/algo_basic.c
+++ b/modules/video_filter/deinterlace/algo_basic.c
@@ -216,32 +216,27 @@ void RenderBlend( filter_t *p_filter,
   picture_t *p_outpic, picture_t *p_pic )
 {
 int i_plane;
-vlc_chroma_description_t* p_desc = p_filter->p_sys->chroma;
 
 /* Copy image and skip lines */
 for( i_plane = 0 ; i_plane < p_pic->i_planes ; i_plane++ )
 {
 uint8_t *p_in, *p_out_end, *p_out;
-size_t i_x_offset = p_pic->format.i_x_offset * 
p_desc->p[i_plane].w.num /
-p_desc->p[i_plane].w.den * p_pic->p[i_plane].i_pixel_pitch;
-size_t i_y_offset = p_pic->format.i_y_offset * 
p_desc->p[i_plane].h.num /
-p_desc->p[i_plane].h.den * p_pic->p[i_plane].i_pitch;
 
-p_in = p_pic->p[i_plane].p_pixels + i_y_offset;
+p_in = p_pic->p[i_plane].p_pixels;
 
-p_out = p_outpic->p[i_plane].p_pixels + i_y_offset;
+p_out = p_outpic->p[i_plane].p_pixels;
 p_out_end = p_out + p_outpic->p[i_plane].i_pitch
  * p_outpic->p[i_plane].i_visible_lines;
 
 /* First line: simple copy */
-memcpy( p_out + i_x_offset, p_in + i_x_offset, 
p_pic->p[i_plane].i_visible_pitch );
+memcpy( p_out, p_in, p_pic->p[i_plane].i_pitch );
 p_out += p_outpic->p[i_plane].i_pitch;
 
 /* Remaining lines: mean value */
 for( ; p_out < p_out_end ; )
 {
-Merge( p_out + i_x_offset, p_in + i_x_offset, p_in + 
p_pic->p[i_plane].i_pitch + i_x_offset,
-   p_pic->p[i_plane].i_visible_pitch );
+Merge( p_out, p_in, p_in + p_pic->p[i_plane].i_pitch,
+   p_pic->p[i_plane].i_pitch );
 
 p_out += p_outpic->p[i_plane].i_pitch;
 p_in  += p_pic->p[i_plane].i_pitch;

___
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits


[vlc-commits] demux: ts: fix si debug format strings

2016-09-15 Thread Francois Cartegnie
vlc | branch: master | Francois Cartegnie  | Wed Sep 14 
21:46:00 2016 +0200| [4000668daf28da7df08427e7d301f2f2729f4b4c] | committer: 
Francois Cartegnie

demux: ts: fix si debug format strings

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=4000668daf28da7df08427e7d301f2f2729f4b4c
---

 modules/demux/mpeg/ts_si.c | 36 ++--
 1 file changed, 18 insertions(+), 18 deletions(-)

diff --git a/modules/demux/mpeg/ts_si.c b/modules/demux/mpeg/ts_si.c
index 66f670d..638c56e 100644
--- a/modules/demux/mpeg/ts_si.c
+++ b/modules/demux/mpeg/ts_si.c
@@ -150,7 +150,7 @@ static void SDTCallBack( demux_t *p_demux, dvbpsi_sdt_t 
*p_sdt )
 {
 sdt->u.p_si->eitpid = eitpid;
 SetPIDFilter( p_demux->p_sys, eitpid, true );
-msg_Dbg( p_demux, "  * pid=%d listening for EIT", 
eitpid->i_pid );
+msg_Dbg( p_demux, "  * pid=%"PRIu16" listening for EIT", 
eitpid->i_pid );
 }
 }
 
@@ -166,13 +166,13 @@ static void SDTCallBack( demux_t *p_demux, dvbpsi_sdt_t 
*p_sdt )
 {
 sdt->u.p_si->tdtpid = tdtpid;
 SetPIDFilter( p_demux->p_sys, tdtpid, true );
-msg_Dbg( p_demux, "  * pid=%d listening for TDT", 
tdtpid->i_pid );
+msg_Dbg( p_demux, "  * pid=%"PRIu16" listening for TDT", 
tdtpid->i_pid );
 }
 }
 }
 
-msg_Dbg( p_demux, "new SDT ts_id=%d version=%d current_next=%d "
- "network_id=%d",
+msg_Dbg( p_demux, "new SDT ts_id=%"PRIu16" version=%"PRIu8" 
current_next=%d "
+ "network_id=%"PRIu16,
  p_sdt->i_extension,
  p_sdt->i_version, p_sdt->b_current_next,
  p_sdt->i_network_id );
@@ -187,8 +187,8 @@ static void SDTCallBack( demux_t *p_demux, dvbpsi_sdt_t 
*p_sdt )
 const char *psz_type = NULL;
 const char *psz_status = NULL;
 
-msg_Dbg( p_demux, "  * service id=%d eit schedule=%d present=%d "
- "running=%d free_ca=%d",
+msg_Dbg( p_demux, "  * service id=%"PRIu16" eit schedule=%d present=%d 
"
+ "running=%"PRIu8" free_ca=%d",
  p_srv->i_service_id, p_srv->b_eit_schedule,
  p_srv->b_eit_present, p_srv->i_running_status,
  p_srv->b_free_ca );
@@ -260,7 +260,7 @@ static void SDTCallBack( demux_t *p_demux, dvbpsi_sdt_t 
*p_sdt )
 pD->i_service_name_length,
 p_sys->b_broken_charset );
 
-msg_Dbg( p_demux, "- type=%d provider=%s name=%s",
+msg_Dbg( p_demux, "- type=%"PRIu8" provider=%s name=%s",
  pD->i_service_type, str1, str2 );
 
 vlc_meta_SetTitle( p_meta, str2 );
@@ -375,9 +375,9 @@ static void EITCallBack( demux_t *p_demux, dvbpsi_eit_t 
*p_eit )
 return;
 }
 
-msg_Dbg( p_demux, "new EIT service_id=%d version=%d current_next=%d "
- "ts_id=%d network_id=%d segment_last_section_number=%d "
- "last_table_id=%d",
+msg_Dbg( p_demux, "new EIT service_id=%"PRIu16" version=%"PRIu8" 
current_next=%d "
+ "ts_id=%"PRIu16" network_id=%"PRIu16" 
segment_last_section_number=%"PRIu8" "
+ "last_table_id=%"PRIu8,
  p_eit->i_extension,
  p_eit->i_version, p_eit->b_current_next,
  p_eit->i_ts_id, p_eit->i_network_id,
@@ -405,9 +405,9 @@ static void EITCallBack( demux_t *p_demux, dvbpsi_eit_t 
*p_eit )
 i_start += 9 * 3600;
 }
 
-msg_Dbg( p_demux, "  * event id=%d start_time:%d duration=%d "
-  "running=%d free_ca=%d",
- p_evt->i_event_id, (int)i_start, (int)i_duration,
+msg_Dbg( p_demux, "  * event id=%"PRIu16" start_time:%"PRId64" 
duration=%d "
+  "running=%"PRIu8" free_ca=%d",
+ p_evt->i_event_id, i_start, i_duration,
  p_evt->i_running_status, p_evt->b_free_ca );
 
 for( p_dr = p_evt->p_first_descriptor; p_dr; p_dr = p_dr->p_next )
@@ -440,7 +440,7 @@ static void EITCallBack( demux_t *p_demux, dvbpsi_eit_t 
*p_eit )
 dvbpsi_extended_event_dr_t *pE = dvbpsi_DecodeExtendedEventDr( 
p_dr );
 if( pE )
 {
-msg_Dbg( p_demux, "- extended event lang=%3.3s 
[%d/%d]",
+msg_Dbg( p_demux, "- extended event lang=%3.3s 
[%"PRIu8"/%"PRIu8"]",
  pE->i_iso_639_code,
  pE->i_descriptor_number, 
pE->i_last_descriptor_number );
 
@@ -523,7 +523,7 @@ static void EITCallBack( demux_t *p_demux, dvbpsi_eit_t 
*p_eit )
 break;
 
 default:
-msg_Dbg( p_demux, "- event unknown dr 0x%x(%d)", 
p_dr->i_tag, p_dr->i_tag );
+msg_Dbg( p_demux, "- event 

[vlc-commits] epg: API changes

2016-09-15 Thread Francois Cartegnie
vlc | branch: master | Francois Cartegnie  | Wed Sep  7 
15:59:29 2016 +0200| [aa8683fd2c0c416b1aa471faf6036f0d7ecee11a] | committer: 
Francois Cartegnie

epg: API changes

EIT structs and Events and should be referenced by their
unique ID.
First step towards in depth changes to epg_t et epg_event_t.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=aa8683fd2c0c416b1aa471faf6036f0d7ecee11a
---

 include/vlc_epg.h|  51 ++-
 include/vlc_plugin.h |   4 +-
 modules/demux/mpeg/ts_psip.c |  28 +++--
 modules/demux/mpeg/ts_si.c   |  36 ---
 modules/demux/ty.c   |  35 +++
 src/input/es_out_timeshift.c |  14 +
 src/input/item.c |  22 +++
 src/libvlccore.sym   |   6 +-
 src/misc/epg.c   | 146 ++-
 src/video_output/video_epg.c |   8 ++-
 test/src/misc/epg.c  |  26 +---
 11 files changed, 241 insertions(+), 135 deletions(-)

Diff:   
http://git.videolan.org/gitweb.cgi/vlc.git/?a=commitdiff;h=aa8683fd2c0c416b1aa471faf6036f0d7ecee11a
___
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits


[vlc-commits] demux: adaptive: add connection manager interface

2016-09-15 Thread Francois Cartegnie
vlc | branch: master | Francois Cartegnie  | Wed Sep 14 
19:13:33 2016 +0200| [3924bed4543c1e39bd567a0116d5f71057ca13db] | committer: 
Francois Cartegnie

demux: adaptive: add connection manager interface

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=3924bed4543c1e39bd567a0116d5f71057ca13db
---

 modules/demux/adaptive/PlaylistManager.cpp |  2 +-
 modules/demux/adaptive/PlaylistManager.h   |  6 ++--
 modules/demux/adaptive/SegmentTracker.cpp  |  3 +-
 modules/demux/adaptive/SegmentTracker.hpp  |  4 +--
 modules/demux/adaptive/Streams.cpp |  2 +-
 modules/demux/adaptive/Streams.hpp |  8 ++---
 modules/demux/adaptive/http/Chunk.cpp  |  8 ++---
 modules/demux/adaptive/http/Chunk.h| 10 +++---
 .../demux/adaptive/http/HTTPConnectionManager.cpp  | 41 +-
 .../demux/adaptive/http/HTTPConnectionManager.h| 35 +-
 modules/demux/adaptive/playlist/Segment.cpp|  4 +--
 modules/demux/adaptive/playlist/Segment.h  |  4 +--
 modules/demux/dash/DASHStream.cpp  |  2 +-
 modules/demux/dash/DASHStream.hpp  |  2 +-
 modules/demux/hls/HLSStreams.cpp   |  2 +-
 modules/demux/hls/HLSStreams.hpp   |  2 +-
 modules/demux/smooth/SmoothStream.cpp  |  2 +-
 modules/demux/smooth/SmoothStream.hpp  |  2 +-
 .../demux/smooth/playlist/ForgedInitSegment.cpp|  2 +-
 .../demux/smooth/playlist/ForgedInitSegment.hpp|  2 +-
 20 files changed, 94 insertions(+), 49 deletions(-)

Diff:   
http://git.videolan.org/gitweb.cgi/vlc.git/?a=commitdiff;h=3924bed4543c1e39bd567a0116d5f71057ca13db
___
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits


[vlc-commits] ttml demux: Fix use of potentially uninitialized variable

2016-09-15 Thread Hugo Beauzée-Luyssen
vlc | branch: master | Hugo Beauzée-Luyssen  | Thu Sep 15 
14:33:31 2016 +0200| [d77f2cc872974529a67fa6864e78ad4de993776c] | committer: 
Hugo Beauzée-Luyssen

ttml demux: Fix use of potentially uninitialized variable

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=d77f2cc872974529a67fa6864e78ad4de993776c
---

 modules/demux/ttml.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/modules/demux/ttml.c b/modules/demux/ttml.c
index 443f560..4b6eeed 100644
--- a/modules/demux/ttml.c
+++ b/modules/demux/ttml.c
@@ -414,13 +414,13 @@ static int ParseTimeOnSpan( demux_sys_t* p_sys, char* 
psz_text )
 if( unlikely( pp_subtitles == NULL ) )
 return VLC_ENOMEM;
 
+int ret = VLC_ENOMEM;
 vlc_array_t* p_times = vlc_array_new();
 if( unlikely( p_times == NULL ) )
 goto error;
 
 const char* psz_node_name;
 int i_nb_span = 0;
-int ret = VLC_ENOMEM;
 
 /*
 * This loop will parse the current p tag and the

___
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits


[vlc-commits] ttml demux: Fix memory leak

2016-09-15 Thread Hugo Beauzée-Luyssen
vlc | branch: master | Hugo Beauzée-Luyssen  | Thu Sep 15 
14:20:10 2016 +0200| [bcb99d55e5095ba2198c29f6dabffa4741b2a763] | committer: 
Hugo Beauzée-Luyssen

ttml demux: Fix memory leak

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=bcb99d55e5095ba2198c29f6dabffa4741b2a763
---

 modules/demux/ttml.c | 9 ++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/modules/demux/ttml.c b/modules/demux/ttml.c
index ce979fd..a3c806b 100644
--- a/modules/demux/ttml.c
+++ b/modules/demux/ttml.c
@@ -701,11 +701,14 @@ static int ReadTTML( demux_t* p_demux )
 
 p_subtitle->psz_text = psz_text;
 p_sys->i_subtitles++;
+ClearNode( p_node );
 }
-else if( ParseTimeOnSpan( p_sys , psz_text ) == VLC_SUCCESS )
-continue;
 else
-goto error;
+{
+ClearNode( p_node );
+if( ParseTimeOnSpan( p_sys , psz_text ) != VLC_SUCCESS )
+goto error;
+}
 }
 else
 {

___
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits


[vlc-commits] ttml demux: Don't try to parse head tag if seeking fails

2016-09-15 Thread Hugo Beauzée-Luyssen
vlc | branch: master | Hugo Beauzée-Luyssen  | Thu Sep 15 
14:21:57 2016 +0200| [9aedcd2584914bc0d60893dd59132d7f3e4827c2] | committer: 
Hugo Beauzée-Luyssen

ttml demux: Don't try to parse head tag if seeking fails

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=9aedcd2584914bc0d60893dd59132d7f3e4827c2
---

 modules/demux/ttml.c | 6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/modules/demux/ttml.c b/modules/demux/ttml.c
index a3c806b..443f560 100644
--- a/modules/demux/ttml.c
+++ b/modules/demux/ttml.c
@@ -775,7 +775,11 @@ static void ParseHead( demux_t* p_demux )
 ssize_t i_read;
 
 // Rewind since the XML parser will have consumed the entire file.
-vlc_stream_Seek( p_demux->s, 0 );
+if ( vlc_stream_Seek( p_demux->s, 0 ) != VLC_SUCCESS )
+{
+msg_Warn( p_demux, "Failed to rewind to parse . No style will be 
available" );
+return;
+}
 
 while( ( i_read = vlc_stream_Read( p_demux->s, (void*)buff, 1024 ) ) > 0 )
 {

___
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits


[vlc-commits] substtml: Fix memory leak

2016-09-15 Thread Hugo Beauzée-Luyssen
vlc | branch: master | Hugo Beauzée-Luyssen  | Thu Sep 15 
14:07:04 2016 +0200| [9c9f6861b01208d4ea61ebd910ce8867a6239019] | committer: 
Hugo Beauzée-Luyssen

substtml: Fix memory leak

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=9c9f6861b01208d4ea61ebd910ce8867a6239019
---

 modules/codec/substtml.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/modules/codec/substtml.c b/modules/codec/substtml.c
index e3e8cba..2a0d23b 100644
--- a/modules/codec/substtml.c
+++ b/modules/codec/substtml.c
@@ -181,6 +181,7 @@ static void PopStyle( style_stack_t** pp_stack )
 if( *pp_stack == NULL )
 return;
 style_stack_t* p_next = (*pp_stack)->p_next;
+CleanupStyle( (*pp_stack)->p_style );
 free( *pp_stack );
 *pp_stack = p_next;
 }
@@ -190,6 +191,7 @@ static void ClearStack( style_stack_t* p_stack )
 while( p_stack != NULL )
 {
 style_stack_t* p_next = p_stack->p_next;
+CleanupStyle( p_stack->p_style );
 free( p_stack );
 p_stack = p_next;
 }

___
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits


[vlc-commits] ttml codec: Fix double free

2016-09-15 Thread Hugo Beauzée-Luyssen
vlc | branch: master | Hugo Beauzée-Luyssen  | Thu Sep 15 
11:55:31 2016 +0200| [a0c528fb2c27c3dbdfe3ddee31a6aab7fb0ae7d9] | committer: 
Hugo Beauzée-Luyssen

ttml codec: Fix double free

fix cid #1372964

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=a0c528fb2c27c3dbdfe3ddee31a6aab7fb0ae7d9
---

 modules/codec/substtml.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/modules/codec/substtml.c b/modules/codec/substtml.c
index b45d8e4..8f23b42 100644
--- a/modules/codec/substtml.c
+++ b/modules/codec/substtml.c
@@ -276,7 +276,6 @@ static ttml_style_t* ParseTTMLStyle( decoder_t *p_dec, 
xml_reader_t* p_reader, c
 if( p_next_style == NULL )
 {
 msg_Warn( p_dec, "Style \"%s\" not found", token );
-free( value );
 break;
 }
 MergeTTMLStyle( p_next_style, p_style );

___
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits


[vlc-commits] ttml: Fix potential leak

2016-09-15 Thread Hugo Beauzée-Luyssen
vlc | branch: master | Hugo Beauzée-Luyssen  | Thu Sep 15 
12:00:42 2016 +0200| [ff9e68c2a2bbdd9ff8fa37f1c4a266ed0de6eb4a] | committer: 
Hugo Beauzée-Luyssen

ttml: Fix potential leak

fix cid #1372946

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=ff9e68c2a2bbdd9ff8fa37f1c4a266ed0de6eb4a
---

 modules/demux/ttml.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/modules/demux/ttml.c b/modules/demux/ttml.c
index c91c62e..c6d68ee 100644
--- a/modules/demux/ttml.c
+++ b/modules/demux/ttml.c
@@ -544,7 +544,10 @@ static int ParseTimeOnSpan( demux_sys_t* p_sys, char* 
psz_text )
 {
 char* psz_transparent= setOpacityToZero( 
pp_subtitles[k]->psz_text );
 if( unlikely( psz_transparent == NULL ) )
+{
+free( psz_sub );
 goto error;
+}
 
 psz_sub = Append( psz_sub, "%s",  psz_transparent );
 free( psz_transparent );

___
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits


[vlc-commits] ttml codec: Fix leak on error

2016-09-15 Thread Hugo Beauzée-Luyssen
vlc | branch: master | Hugo Beauzée-Luyssen  | Thu Sep 15 
12:35:35 2016 +0200| [edb70ceaf74cf81a09d4fc4b9c820231bdae4016] | committer: 
Hugo Beauzée-Luyssen

ttml codec: Fix leak on error

fix cid #1372943

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=edb70ceaf74cf81a09d4fc4b9c820231bdae4016
---

 modules/codec/substtml.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/modules/codec/substtml.c b/modules/codec/substtml.c
index 8f23b42..99462ba 100644
--- a/modules/codec/substtml.c
+++ b/modules/codec/substtml.c
@@ -259,7 +259,10 @@ static ttml_style_t* ParseTTMLStyle( decoder_t *p_dec, 
xml_reader_t* p_reader, c
 char *tmp;
 char *value = strdup( val );
 if( unlikely( value == NULL ) )
+{
+CleanupStyle( p_ttml_style );
 return NULL;
+}
 
 char *token = strtok_r( value , " ",  );
 ttml_style_t* p_style = FindTextStyle( p_dec, token );

___
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits


[vlc-commits] ttml: Fix leak on error

2016-09-15 Thread Hugo Beauzée-Luyssen
vlc | branch: master | Hugo Beauzée-Luyssen  | Thu Sep 15 
12:33:02 2016 +0200| [edcb46430a7368495b92968b98f915c6ca672bc2] | committer: 
Hugo Beauzée-Luyssen

ttml: Fix leak on error

Missing bits from 3502f812
fix cid #1372944

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=edcb46430a7368495b92968b98f915c6ca672bc2
---

 modules/demux/ttml.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/modules/demux/ttml.c b/modules/demux/ttml.c
index c6d68ee..ce979fd 100644
--- a/modules/demux/ttml.c
+++ b/modules/demux/ttml.c
@@ -625,10 +625,7 @@ static int ReadTTML( demux_t* p_demux )
 subtitle_t* p_subtitles = realloc( p_sys->subtitle,
 sizeof( *p_sys->subtitle ) * i_max_sub );
 if( unlikely( p_subtitles == NULL ) )
-{
-ClearNode( p_node );
 goto error;
-}
 p_sys->subtitle = p_subtitles;
 }
 subtitle_t *p_subtitle = 
_sys->subtitle[p_sys->i_subtitles];
@@ -729,6 +726,7 @@ static int ReadTTML( demux_t* p_demux )
 
 error:
 free( psz_text );
+ClearNode( p_node );
 ClearNodeStack( p_parent_node );
 return VLC_EGENERIC;
 }

___
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits


[vlc-commits] ftp: fix memory leaks

2016-09-15 Thread Rémi Denis-Courmont
vlc | branch: master | Rémi Denis-Courmont  | Thu Sep 15 
14:11:58 2016 +0300| [3f63255470e2d4bb97c2ee427b578c05a15cc26f] | committer: 
Rémi Denis-Courmont

ftp: fix memory leaks

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=3f63255470e2d4bb97c2ee427b578c05a15cc26f
---

 modules/access/ftp.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/modules/access/ftp.c b/modules/access/ftp.c
index c30fa46..b75f1c5 100644
--- a/modules/access/ftp.c
+++ b/modules/access/ftp.c
@@ -1137,14 +1137,13 @@ static int ftp_StartStream( vlc_object_t *p_access, 
access_sys_t *p_sys,
 {
 if( p_sys->features.b_mlst &&
 ftp_SendCommand( p_access, p_sys, "MLSD" ) >= 0 &&
-ftp_RecvCommand( p_access, p_sys, NULL, _arg ) <= 2 )
+ftp_RecvCommand( p_access, p_sys, NULL, NULL ) <= 2 )
 {
 msg_Dbg( p_access, "Using MLST extension to list" );
 }
 else
-
 if( ftp_SendCommand( p_access, p_sys, "NLST" ) < 0 ||
-ftp_RecvCommand( p_access, p_sys, NULL, _arg ) > 2 )
+ftp_RecvCommand( p_access, p_sys, NULL, NULL ) > 2 )
 {
 msg_Err( p_access, "cannot list directory contents" );
 return VLC_EGENERIC;

___
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits


[vlc-commits] cookies: missing initializers

2016-09-15 Thread Rémi Denis-Courmont
vlc | branch: master | Rémi Denis-Courmont  | Thu Sep 15 
13:51:44 2016 +0300| [3b63f6e58d316f086f171ecebc9b3636d36efad3] | committer: 
Rémi Denis-Courmont

cookies: missing initializers

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=3b63f6e58d316f086f171ecebc9b3636d36efad3
---

 src/misc/httpcookies.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/misc/httpcookies.c b/src/misc/httpcookies.c
index 5eb4d74..b6d174b 100644
--- a/src/misc/httpcookies.c
+++ b/src/misc/httpcookies.c
@@ -203,6 +203,9 @@ static http_cookie_t *cookie_parse(const char *value,
 if (unlikely(cookie == NULL))
 return NULL;
 
+cookie->psz_domain = NULL;
+cookie->psz_path = NULL;
+
 /* Get the NAME=VALUE part of the Cookie */
 size_t value_length = strcspn(value, ";");
 const char *p = memchr(value, '=', value_length);

___
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits


[vlc-commits] cookies: missing initializers

2016-09-15 Thread Rémi Denis-Courmont
vlc | branch: master | Rémi Denis-Courmont  | Thu Sep 15 
13:51:44 2016 +0300| [a3bf1e0433eed1197e1e463db7f476be67c6fbe7] | committer: 
Rémi Denis-Courmont

cookies: missing initializers

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=a3bf1e0433eed1197e1e463db7f476be67c6fbe7
---

 src/misc/httpcookies.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/misc/httpcookies.c b/src/misc/httpcookies.c
index 5eb4d74..bbfc0e9 100644
--- a/src/misc/httpcookies.c
+++ b/src/misc/httpcookies.c
@@ -203,6 +203,9 @@ static http_cookie_t *cookie_parse(const char *value,
 if (unlikely(cookie == NULL))
 return NULL;
 
+cookie->psz_domain = NULL
+cookie->psz_path = NULL;
+
 /* Get the NAME=VALUE part of the Cookie */
 size_t value_length = strcspn(value, ";");
 const char *p = memchr(value, '=', value_length);

___
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits


[vlc-commits] vmem: fix callback usage (fixes #17187)

2016-09-15 Thread Rémi Denis-Courmont
vlc | branch: master | Rémi Denis-Courmont  | Thu Sep 15 
13:38:47 2016 +0300| [489835e12c124a421ccb3cb7c0a5e38155ad7a55] | committer: 
Rémi Denis-Courmont

vmem: fix callback usage (fixes #17187)

This matches the documentation and behaviour expected by some existing
applications, but it is inefficient.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=489835e12c124a421ccb3cb7c0a5e38155ad7a55
---

 modules/video_output/vmem.c | 91 ++---
 1 file changed, 28 insertions(+), 63 deletions(-)

diff --git a/modules/video_output/vmem.c b/modules/video_output/vmem.c
index 64aefa1..25d8a86 100644
--- a/modules/video_output/vmem.c
+++ b/modules/video_output/vmem.c
@@ -88,9 +88,9 @@ struct picture_sys_t {
 /* NOTE: the callback prototypes must match those of LibVLC */
 struct vout_display_sys_t {
 picture_pool_t *pool;
-unsignedcount;
 
 void *opaque;
+void *pic_opaque;
 void *(*lock)(void *sys, void **plane);
 void (*unlock)(void *sys, void *id, void *const *plane);
 void (*display)(void *sys, void *id);
@@ -104,23 +104,10 @@ typedef unsigned (*vlc_format_cb)(void **, char *, 
unsigned *, unsigned *,
   unsigned *, unsigned *);
 
 static picture_pool_t *Pool  (vout_display_t *, unsigned);
+static void   Prepare(vout_display_t *, picture_t *, subpicture_t *);
 static void   Display(vout_display_t *, picture_t *, subpicture_t *);
 static intControl(vout_display_t *, int, va_list);
 
-static void Unlock(void *data, picture_t *pic)
-{
-vout_display_sys_t *sys = data;
-picture_sys_t *picsys = pic->p_sys;
-void *planes[PICTURE_PLANE_MAX];
-
-assert(!picture_IsReferenced(pic));
-
-for (int i = 0; i < pic->i_planes; i++)
-planes[i] = pic->p[i].p_pixels;
-
-sys->unlock(sys->opaque, picsys->id, planes);
-}
-
 /*
  * Open: allocates video thread
  *
@@ -160,9 +147,8 @@ static int Open(vlc_object_t *object)
 memset(sys->pitches, 0, sizeof(sys->pitches));
 memset(sys->lines, 0, sizeof(sys->lines));
 
-sys->count = setup(>opaque, chroma, _width, _height,
-   sys->pitches, sys->lines);
-if (sys->count == 0) {
+if (setup(>opaque, chroma, _width, _height,
+   sys->pitches, sys->lines) == 0) {
 msg_Err(vd, "video format setup failure (no pictures)");
 free(sys);
 return VLC_EGENERIC;
@@ -183,7 +169,6 @@ static int Open(vlc_object_t *object)
 sys->pitches[i] = sys->pitches[0];
 sys->lines[i] = sys->lines[0];
 }
-sys->count = 1;
 sys->cleanup = NULL;
 }
 fmt.i_x_offset = fmt.i_y_offset = 0;
@@ -231,7 +216,7 @@ static int Open(vlc_object_t *object)
 vd->fmt = fmt;
 vd->info= info;
 vd->pool= Pool;
-vd->prepare = NULL;
+vd->prepare = Prepare;
 vd->display = Display;
 vd->control = Control;
 vd->manage  = NULL;
@@ -250,13 +235,8 @@ static void Close(vlc_object_t *object)
 
 if (sys->cleanup)
 sys->cleanup(sys->opaque);
-
 if (sys->pool)
-{
-if (sys->unlock != NULL)
-picture_pool_Enum(sys->pool, Unlock, sys);
 picture_pool_Release(sys->pool);
-}
 free(sys);
 }
 
@@ -264,50 +244,35 @@ static picture_pool_t *Pool(vout_display_t *vd, unsigned 
count)
 {
 vout_display_sys_t *sys = vd->sys;
 
-if (sys->pool)
-return sys->pool;
-
-if (count > sys->count)
-count = sys->count;
-
-picture_t *pictures[count];
-
-for (unsigned i = 0; i < count; i++) {
-picture_sys_t *picsys = malloc(sizeof (*picsys));
-if (unlikely(picsys == NULL))
-{
-count = i;
-break;
-}
-picsys->id = NULL;
-
-picture_resource_t rsc = { .p_sys = picsys };
-void *planes[PICTURE_PLANE_MAX];
+if (sys->pool == NULL)
+sys->pool = picture_pool_NewFromFormat(>fmt, count);
+return sys->pool;
+}
 
-picsys->id = sys->lock(sys->opaque, planes);
+static void Prepare(vout_display_t *vd, picture_t *pic, subpicture_t *subpic)
+{
+vout_display_sys_t *sys = vd->sys;
+picture_resource_t rsc = { .p_sys = NULL };
+void *planes[PICTURE_PLANE_MAX];
 
-for (unsigned i = 0; i < PICTURE_PLANE_MAX; i++) {
-rsc.p[i].p_pixels = planes[i];
-rsc.p[i].i_lines  = sys->lines[i];
-rsc.p[i].i_pitch  = sys->pitches[i];
-}
+sys->pic_opaque = sys->lock(sys->opaque, planes);
 
-pictures[i] = picture_NewFromResource(>fmt, );
-if (!pictures[i]) {
-free(rsc.p_sys);
-count = i;
-break;
-}
+for (unsigned i = 0; i < PICTURE_PLANE_MAX; i++) {
+  

[vlc-commits] libvlc: warn about vmem being slow

2016-09-15 Thread Rémi Denis-Courmont
vlc | branch: master | Rémi Denis-Courmont  | Thu Sep 15 
13:38:32 2016 +0300| [fb1bae579161a07f0433637a9efa3bb50e2f186a] | committer: 
Rémi Denis-Courmont

libvlc: warn about vmem being slow

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=fb1bae579161a07f0433637a9efa3bb50e2f186a
---

 include/vlc/libvlc_media_player.h | 26 +-
 1 file changed, 25 insertions(+), 1 deletion(-)

diff --git a/include/vlc/libvlc_media_player.h 
b/include/vlc/libvlc_media_player.h
index 2718a33..9153196 100644
--- a/include/vlc/libvlc_media_player.h
+++ b/include/vlc/libvlc_media_player.h
@@ -285,7 +285,7 @@ typedef void *(*libvlc_video_lock_cb)(void *opaque, void 
**planes);
  * This callback might not be needed at all. It is only an indication that the
  * application can now read the pixel values if it needs to.
  *
- * \warning A picture buffer is unlocked after the picture is decoded,
+ * \note A picture buffer is unlocked after the picture is decoded,
  * but before the picture is displayed.
  *
  * \param opaque private pointer as passed to libvlc_video_set_callbacks() [IN]
@@ -355,6 +355,30 @@ typedef void (*libvlc_video_cleanup_cb)(void *opaque);
  * Use libvlc_video_set_format() or libvlc_video_set_format_callbacks()
  * to configure the decoded format.
  *
+ * \warning Rendering video into custom memory buffers is considerably less
+ * efficient than rendering in a custom window as normal.
+ *
+ * For optimal perfomances, VLC media player renders into a custom window, and
+ * does not use this function and associated callbacks. It is highly
+ * recommended that other LibVLC-based application do likewise.
+ * To embed video in a window, use libvlc_media_player_set_xid() or equivalent
+ * depending on the operating system.
+ *
+ * If window embedding does not fit the application use case, then a custom
+ * LibVLC video output display plugin is required to maintain optimal video
+ * rendering performances.
+ *
+ * The following limitations affect performance:
+ * - Hardware video decoding acceleration will either be disabled completely,
+ *   or require (relatively slow) copy from video/DSP memory to main memory.
+ * - Sub-pictures (subtitles, on-screen display, etc.) must be blent into the
+ *   main picture by the CPU instead of the GPU.
+ * - Depending on the video format, pixel format conversion, picture scaling,
+ *   cropping and/or picture re-orientation, must be performed by the CPU
+ *   instead of the GPU.
+ * - Memory copying is required between LibVLC reference picture buffers and
+ *   application buffers (between lock and unlock callbacks).
+ *
  * \param mp the media player
  * \param lock callback to lock video memory (must not be NULL)
  * \param unlock callback to unlock video memory (or NULL if not needed)

___
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits


[vlc-commits] mmdevice: handle AUDCLNT_E_RESOURCES_INVALIDATED

2016-09-15 Thread Thomas Guillem
vlc | branch: master | Thomas Guillem  | Thu Sep 15 11:31:51 
2016 +0200| [c51b78caa4bc8298ba8b1d244382e8da34be1f95] | committer: Thomas 
Guillem

mmdevice: handle AUDCLNT_E_RESOURCES_INVALIDATED

This error is not documented but can be returned instead of
AUDCLNT_E_DEVICE_INVALIDATED when you unplug a sound card in Windows 10.

closes #17392

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=c51b78caa4bc8298ba8b1d244382e8da34be1f95
---

 modules/audio_output/mmdevice.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/modules/audio_output/mmdevice.c b/modules/audio_output/mmdevice.c
index b48dbb3..28bb1e0 100644
--- a/modules/audio_output/mmdevice.c
+++ b/modules/audio_output/mmdevice.c
@@ -118,7 +118,8 @@ static int DeviceSelect(audio_output_t *, const char *);
 static int vlc_FromHR(audio_output_t *aout, HRESULT hr)
 {
 /* Select the default device (and restart) on unplug */
-if (unlikely(hr == AUDCLNT_E_DEVICE_INVALIDATED))
+if (unlikely(hr == AUDCLNT_E_DEVICE_INVALIDATED ||
+ hr == AUDCLNT_E_RESOURCES_INVALIDATED))
 DeviceSelect(aout, NULL);
 return SUCCEEDED(hr) ? 0 : -1;
 }

___
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits


[vlc-commits] ttml codec: Remove trailing whitespace

2016-09-15 Thread Hugo Beauzée-Luyssen
vlc | branch: master | Hugo Beauzée-Luyssen  | Thu Sep 15 
11:09:22 2016 +0200| [1de0ed6d8054e8ec1be29d23893a7fa4a59b458e] | committer: 
Hugo Beauzée-Luyssen

ttml codec: Remove trailing whitespace

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=1de0ed6d8054e8ec1be29d23893a7fa4a59b458e
---

 modules/codec/substtml.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/modules/codec/substtml.c b/modules/codec/substtml.c
index 80514aa..ff7b987 100644
--- a/modules/codec/substtml.c
+++ b/modules/codec/substtml.c
@@ -148,7 +148,7 @@ static void CleanupStyle( ttml_style_t* p_ttml_style )
 
 static ttml_style_t *FindTextStyle( decoder_t *p_dec, const char *psz_style )
 {
-decoder_sys_t  *p_sys = p_dec->p_sys;
+decoder_sys_t  *p_sys = p_dec->p_sys;
 
 for( size_t i = 0; i < p_sys->i_styles; i++ )
 {

___
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits


[vlc-commits] ttml demux: MergeNodeWithParent: Constify iterator

2016-09-15 Thread Hugo Beauzée-Luyssen
vlc | branch: master | Hugo Beauzée-Luyssen  | Thu Sep 15 
10:27:00 2016 +0200| [a7010fd9557236261158a21029b8495467756797] | committer: 
Hugo Beauzée-Luyssen

ttml demux: MergeNodeWithParent: Constify iterator

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=a7010fd9557236261158a21029b8495467756797
---

 modules/demux/ttml.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/modules/demux/ttml.c b/modules/demux/ttml.c
index af71c2b..39b7eb4 100644
--- a/modules/demux/ttml.c
+++ b/modules/demux/ttml.c
@@ -265,7 +265,7 @@ static int MergeStyles(char** pp_dest, char* p_src)
 
 static int MergeNodeWithParents( node_t* p_node )
 {
-node_t *parent = p_node->p_parent;
+const node_t *parent = p_node->p_parent;
 while( parent != NULL)
 {
 if( MergeAttrDict( _node->attr_dict, >attr_dict ) != 
VLC_SUCCESS ||

___
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits


[vlc-commits] ttml codec: Fix leak on error

2016-09-15 Thread Hugo Beauzée-Luyssen
vlc | branch: master | Hugo Beauzée-Luyssen  | Thu Sep 15 
11:14:56 2016 +0200| [17b1391123ae40fa094353a0a4bc87d61372bd99] | committer: 
Hugo Beauzée-Luyssen

ttml codec: Fix leak on error

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=17b1391123ae40fa094353a0a4bc87d61372bd99
---

 modules/codec/substtml.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/modules/codec/substtml.c b/modules/codec/substtml.c
index ff7b987..b45d8e4 100644
--- a/modules/codec/substtml.c
+++ b/modules/codec/substtml.c
@@ -588,7 +588,10 @@ static text_segment_t *ParseTTMLSubtitles( decoder_t 
*p_dec, subpicture_updater_
  MergeTTMLStyle( p_style, p_style_stack->p_style );
 
 if( PushStyle( _style_stack, p_style ) == false )
+{
+CleanupStyle( p_style );
 goto fail;
+}
 
 }
 else if( i_type == XML_READER_TEXT )

___
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits


[vlc-commits] ttml demux: Fix leaks on error

2016-09-15 Thread Hugo Beauzée-Luyssen
vlc | branch: master | Hugo Beauzée-Luyssen  | Thu Sep 15 
10:44:42 2016 +0200| [3502f812ff04c0a781db4502e44d32d0fcb216bc] | committer: 
Hugo Beauzée-Luyssen

ttml demux: Fix leaks on error

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=3502f812ff04c0a781db4502e44d32d0fcb216bc
---

 modules/demux/ttml.c | 25 +++--
 1 file changed, 11 insertions(+), 14 deletions(-)

diff --git a/modules/demux/ttml.c b/modules/demux/ttml.c
index 39b7eb4..e8346a3 100644
--- a/modules/demux/ttml.c
+++ b/modules/demux/ttml.c
@@ -572,6 +572,7 @@ static int ReadTTML( demux_t* p_demux )
 {
 demux_sys_t* p_sys = p_demux->p_sys;
 node_t* p_parent_node = NULL;
+node_t* p_node = NULL;
 char* psz_text = NULL;
 const char* psz_node_name;
 int i_max_sub = 0;
@@ -594,19 +595,12 @@ static int ReadTTML( demux_t* p_demux )
 }
 else if( i_type == XML_READER_STARTELEM && CompareTagName( 
psz_node_name, "tt" ) )
 {
-node_t* p_node = calloc( 1, sizeof( *p_node ) );
+p_node = calloc( 1, sizeof( *p_node ) );
 if( unlikely( p_node == NULL ) )
-{
-ClearNodeStack( p_parent_node );
-return VLC_ENOMEM;
-}
+goto error;
 
 if( ReadAttrNode( p_sys->p_reader, p_node, psz_node_name ) != 
VLC_SUCCESS )
-{
-ClearNode( p_node );
-ClearNodeStack( p_parent_node );
-return VLC_ENOMEM;
-}
+goto error;
 
 p_node->p_parent = p_parent_node;
 
@@ -614,10 +608,7 @@ static int ReadTTML( demux_t* p_demux )
 if( !CompareTagName( psz_node_name, "p" ) )
 {
 if( MergeNodeWithParents( p_node ) != VLC_SUCCESS )
-{
-ClearNodeStack( p_node );
-return VLC_ENOMEM;
-}
+goto error;
 
 psz_text = NodeToStr( p_node );
 if( unlikely( psz_text == NULL ) )
@@ -631,7 +622,10 @@ static int ReadTTML( demux_t* p_demux )
 subtitle_t* p_subtitles = realloc( p_sys->subtitle,
 sizeof( *p_sys->subtitle ) * i_max_sub );
 if( unlikely( p_subtitles == NULL ) )
+{
+ClearNode( p_node );
 goto error;
+}
 p_sys->subtitle = p_subtitles;
 }
 subtitle_t *p_subtitle = 
_sys->subtitle[p_sys->i_subtitles];
@@ -714,7 +708,10 @@ static int ReadTTML( demux_t* p_demux )
 goto error;
 }
 else
+{
 p_parent_node = p_node;
+p_node = NULL;
+}
 }
 /*  end tag after a p tag but inside the body */
 else if( i_type == XML_READER_ENDELEM && CompareTagName( 
psz_node_name, "body" ) )

___
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits