[vlc-commits] flac: reset decoder on end of stream (fixes #9298)

2014-09-29 Thread Tristan Matthews
vlc | branch: master | Tristan Matthews  | Mon Sep 29 
21:05:23 2014 -0400| [033cdd9009df398c3fedffd8b5c31655f60256e4] | committer: 
Tristan Matthews

flac: reset decoder on end of stream (fixes #9298)

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

 modules/codec/flac.c |   12 +---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/modules/codec/flac.c b/modules/codec/flac.c
index f2e3cda..32ae7fb 100644
--- a/modules/codec/flac.c
+++ b/modules/codec/flac.c
@@ -526,10 +526,16 @@ static block_t *DecodeBlock( decoder_t *p_dec, block_t 
**pp_block )
 
 /* If the decoder is in the "aborted" state,
  * FLAC__stream_decoder_process_single() won't return an error. */
-if( FLAC__stream_decoder_get_state(p_dec->p_sys->p_flac)
-== FLAC__STREAM_DECODER_ABORTED )
+switch ( FLAC__stream_decoder_get_state(p_dec->p_sys->p_flac) )
 {
-FLAC__stream_decoder_flush( p_dec->p_sys->p_flac );
+case FLAC__STREAM_DECODER_ABORTED:
+FLAC__stream_decoder_flush( p_dec->p_sys->p_flac );
+break;
+case FLAC__STREAM_DECODER_END_OF_STREAM:
+FLAC__stream_decoder_reset( p_dec->p_sys->p_flac );
+break;
+default:
+break;
 }
 
 block_Release( p_sys->p_block );

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


[vlc-commits] twolame: add error checking

2014-09-29 Thread Tristan Matthews
vlc | branch: master | Tristan Matthews  | Sat Sep 27 
13:47:06 2014 -0400| [9b196c6333e8973ba3704af22b1d8b9d600bbd6f] | committer: 
Tristan Matthews

twolame: add error checking

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

 modules/codec/twolame.c |   15 +++
 1 file changed, 15 insertions(+)

diff --git a/modules/codec/twolame.c b/modules/codec/twolame.c
index 20ef952..3257b76 100644
--- a/modules/codec/twolame.c
+++ b/modules/codec/twolame.c
@@ -274,6 +274,8 @@ static block_t *Encode( encoder_t *p_enc, block_t 
*p_aout_buf )
 return NULL;
 
 p_block = block_Alloc( i_used );
+if( !p_block )
+return NULL;
 memcpy( p_block->p_buffer, p_sys->p_out_buffer, i_used );
 p_block->i_length = CLOCK_FREQ *
 (mtime_t)MPEG_FRAME_SIZE / 
(mtime_t)p_enc->fmt_out.audio.i_rate;
@@ -302,8 +304,21 @@ static block_t *Encode( encoder_t *p_enc, block_t 
*p_aout_buf )
 i_used = twolame_encode_buffer_interleaved( p_sys->p_twolame,
p_sys->p_buffer, MPEG_FRAME_SIZE,
p_sys->p_out_buffer, MAX_CODED_FRAME_SIZE );
+/* On error, buffer samples and return what was already encoded */
+if( i_used < 0 )
+{
+msg_Err( p_enc, "encoder error: %d", i_used );
+break;
+}
+
 p_sys->i_nb_samples = 0;
 p_block = block_Alloc( i_used );
+if( !p_block )
+{
+if( p_chain )
+block_Release( p_chain );
+return NULL;
+}
 memcpy( p_block->p_buffer, p_sys->p_out_buffer, i_used );
 p_block->i_length = CLOCK_FREQ *
 (mtime_t)MPEG_FRAME_SIZE / 
(mtime_t)p_enc->fmt_out.audio.i_rate;

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


[vlc-commits] twolame: avoid buffer overflow

2014-09-29 Thread Tristan Matthews
vlc | branch: master | Tristan Matthews  | Sat Sep 27 
15:07:51 2014 -0400| [9ab9aa37080ed6e8d34717bdf416509c7e38bbf9] | committer: 
Tristan Matthews

twolame: avoid buffer overflow

Refs #12298

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

 modules/codec/twolame.c |   22 +-
 1 file changed, 17 insertions(+), 5 deletions(-)

diff --git a/modules/codec/twolame.c b/modules/codec/twolame.c
index 3257b76..b44647e 100644
--- a/modules/codec/twolame.c
+++ b/modules/codec/twolame.c
@@ -251,12 +251,24 @@ static int OpenEncoder( vlc_object_t *p_this )
  /
 static void Bufferize( encoder_t *p_enc, int16_t *p_in, int i_nb_samples )
 {
-int16_t *p_buffer = p_enc->p_sys->p_buffer
- + (p_enc->p_sys->i_nb_samples
- * p_enc->fmt_in.audio.i_channels);
+encoder_sys_t *p_sys = p_enc->p_sys;
+const unsigned i_offset = p_sys->i_nb_samples * 
p_enc->fmt_in.audio.i_channels;
+const unsigned i_len = ARRAY_SIZE(p_sys->p_buffer);
+
+if( i_offset >= i_len )
+{
+msg_Err( p_enc, "buffer full" );
+return;
+}
+
+unsigned i_copy = i_nb_samples * p_enc->fmt_in.audio.i_channels;
+if( i_copy + i_offset > i_len)
+{
+msg_Err( p_enc, "dropping samples" );
+i_copy = i_len - i_offset;
+}
 
-memcpy( p_buffer, p_in, i_nb_samples * p_enc->fmt_in.audio.i_channels
- * sizeof(int16_t) );
+memcpy( p_sys->p_buffer + i_offset, p_in, i_copy * sizeof(int16_t) );
 }
 
 static block_t *Encode( encoder_t *p_enc, block_t *p_aout_buf )

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


[vlc-commits] en50221: avoid one memory copy (refs #12307)

2014-09-29 Thread Rémi Denis-Courmont
vlc | branch: master | Rémi Denis-Courmont  | Mon Sep 29 
21:59:47 2014 +0300| [34c1ae55153af567ee6d51f53046bbbc3ef39c0c] | committer: 
Rémi Denis-Courmont

en50221: avoid one memory copy (refs #12307)

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

 modules/access/dtv/en50221.c |   62 ++
 1 file changed, 14 insertions(+), 48 deletions(-)

diff --git a/modules/access/dtv/en50221.c b/modules/access/dtv/en50221.c
index 4294363..81a3a75 100644
--- a/modules/access/dtv/en50221.c
+++ b/modules/access/dtv/en50221.c
@@ -34,6 +34,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 
@@ -243,64 +244,29 @@ static void Dump( bool b_outgoing, uint8_t *p_data, int 
i_size )
  * TPDUSend
  */
 static int TPDUSend( cam_t * p_cam, uint8_t i_slot, uint8_t i_tag,
- const uint8_t *p_content, int i_length )
+ const uint8_t *p_content, size_t i_length )
 {
-uint8_t i_tcid = i_slot + 1;
-uint8_t p_data[MAX_TPDU_SIZE];
-int i_size;
-
-i_size = 0;
-p_data[0] = i_slot;
-p_data[1] = i_tcid;
-p_data[2] = i_tag;
-
-switch ( i_tag )
-{
-case T_RCV:
-case T_CREATE_TC:
-case T_CTC_REPLY:
-case T_DELETE_TC:
-case T_DTC_REPLY:
-case T_REQUEST_TC:
-p_data[3] = 1; /* length */
-p_data[4] = i_tcid;
-i_size = 5;
-break;
-
-case T_NEW_TC:
-case T_TC_ERROR:
-p_data[3] = 2; /* length */
-p_data[4] = i_tcid;
-p_data[5] = p_content[0];
-i_size = 6;
-break;
+uint8_t p_data[9], *p = p_data;
 
-case T_DATA_LAST:
-case T_DATA_MORE:
-{
-/* i_length <= MAX_TPDU_DATA */
-uint8_t *p = p_data + 3;
-p = SetLength( p, i_length + 1 );
-*p++ = i_tcid;
+*(p++) = i_slot;
+*(p++) = i_slot + 1; /* TCID */
+*(p++) = i_tag;
+p = SetLength( p, i_length + 1 );
 
-if ( i_length )
-memcpy( p, p_content, i_length );
-i_size = i_length + (p - p_data);
-break;
-}
+*(p++) = i_slot + 1;
+Dump( true, p_data, p - p_data );
 
-default:
-break;
-}
-Dump( true, p_data, i_size );
+const struct iovec iov[2] = {
+{ p_data, p - p_data },
+{ (void *)p_content, i_length },
+};
 
-if ( write( p_cam->fd, p_data, i_size ) != i_size )
+if ( writev( p_cam->fd, iov, 2 ) <= 0 )
 {
 msg_Err( p_cam->obj, "cannot write to CAM device: %s",
  vlc_strerror_c(errno) );
 return VLC_EGENERIC;
 }
-
 return VLC_SUCCESS;
 }
 

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


[vlc-commits] input: stream_memory: handle skip reads

2014-09-29 Thread Francois Cartegnie
vlc | branch: master | Francois Cartegnie  | Mon Sep 29 
20:06:05 2014 +0200| [426d82731aa74530af562c3fa09ce7a2eeb45c6a] | committer: 
Francois Cartegnie

input: stream_memory: handle skip reads

Regular streams skip if p_read is NULL.

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

 src/input/stream_memory.c |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/input/stream_memory.c b/src/input/stream_memory.c
index 491ab02..25caa2e 100644
--- a/src/input/stream_memory.c
+++ b/src/input/stream_memory.c
@@ -157,7 +157,8 @@ static int Read( stream_t *s, void *p_read, unsigned int 
i_read )
 {
 stream_sys_t *p_sys = s->p_sys;
 int i_res = __MIN( i_read, p_sys->i_size - p_sys->i_pos );
-memcpy( p_read, p_sys->p_buffer + p_sys->i_pos, i_res );
+if ( p_read )
+memcpy( p_read, p_sys->p_buffer + p_sys->i_pos, i_res );
 p_sys->i_pos += i_res;
 return i_res;
 }

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


[vlc-commits] demux: mp4: set pointer to relase function into box

2014-09-29 Thread Francois Cartegnie
vlc | branch: master | Francois Cartegnie  | Mon Sep 29 
18:31:44 2014 +0200| [0ad6f449b6741c7c2c7c7058e72310eb2138d860] | committer: 
Francois Cartegnie

demux: mp4: set pointer to relase function into box

Possible could crash because release function was
not correctly matched du to missing parent id check.

Better save it into box instead of doing another lookup,
and because box could have been detached from parent.

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

 modules/demux/mp4/libmp4.c |   15 ---
 modules/demux/mp4/libmp4.h |6 --
 2 files changed, 8 insertions(+), 13 deletions(-)

diff --git a/modules/demux/mp4/libmp4.c b/modules/demux/mp4/libmp4.c
index b6cf91c..075bc0b 100644
--- a/modules/demux/mp4/libmp4.c
+++ b/modules/demux/mp4/libmp4.c
@@ -3677,6 +3677,8 @@ static MP4_Box_t *MP4_ReadBox( stream_t *p_stream, 
MP4_Box_t *p_father )
 return NULL;
 }
 
+p_box->pf_free = MP4_Box_Function[i_index].MP4_FreeBox_function;
+
 return p_box;
 }
 
@@ -3686,7 +3688,6 @@ static MP4_Box_t *MP4_ReadBox( stream_t *p_stream, 
MP4_Box_t *p_father )
  */
 void MP4_BoxFree( stream_t *s, MP4_Box_t *p_box )
 {
-unsigned int i_index;
 MP4_Box_t*p_child;
 
 if( !p_box )
@@ -3704,15 +3705,7 @@ void MP4_BoxFree( stream_t *s, MP4_Box_t *p_box )
 /* Now search function to call */
 if( p_box->data.p_payload )
 {
-for( i_index = 0; ; i_index++ )
-{
-if( ( MP4_Box_Function[i_index].i_type == p_box->i_type )||
-( MP4_Box_Function[i_index].i_type == 0 ) )
-{
-break;
-}
-}
-if( MP4_Box_Function[i_index].MP4_FreeBox_function == NULL )
+if (unlikely( p_box->pf_free == NULL ))
 {
 /* Should not happen */
 if MP4_BOX_TYPE_ASCII()
@@ -3726,7 +3719,7 @@ void MP4_BoxFree( stream_t *s, MP4_Box_t *p_box )
 }
 else
 {
-MP4_Box_Function[i_index].MP4_FreeBox_function( p_box );
+p_box->pf_free( p_box );
 }
 free( p_box->data.p_payload );
 }
diff --git a/modules/demux/mp4/libmp4.h b/modules/demux/mp4/libmp4.h
index 643e922..b8315cb 100644
--- a/modules/demux/mp4/libmp4.h
+++ b/modules/demux/mp4/libmp4.h
@@ -1368,8 +1368,9 @@ typedef union MP4_Box_data_s
 
 
 
+typedef struct MP4_Box_s MP4_Box_t;
 /* the most basic structure */
-typedef struct MP4_Box_s
+struct MP4_Box_s
 {
 off_ti_pos;  /* absolute position */
 
@@ -1397,7 +1398,8 @@ typedef struct MP4_Box_s
 
 struct MP4_Box_s *p_next;   /* pointer on the next boxes at the same level 
*/
 
-} MP4_Box_t;
+void (*pf_free)( MP4_Box_t *p_box ); /* pointer to free function for this 
box */
+};
 
 static inline size_t mp4_box_headersize( MP4_Box_t *p_box )
 {

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


[vlc-commits] demux: mkv: move mp4 include off top level

2014-09-29 Thread Francois Cartegnie
vlc | branch: master | Francois Cartegnie  | Sat Sep 27 
19:16:17 2014 +0200| [2afb8fbc9b09c9df33228c79ba342645fb8c5cd4] | committer: 
Francois Cartegnie

demux: mkv: move mp4 include off top level

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

 modules/demux/mkv/matroska_segment_parse.cpp |1 +
 modules/demux/mkv/mkv.hpp|3 ---
 2 files changed, 1 insertion(+), 3 deletions(-)

diff --git a/modules/demux/mkv/matroska_segment_parse.cpp 
b/modules/demux/mkv/matroska_segment_parse.cpp
index 975b053..d1943e5 100644
--- a/modules/demux/mkv/matroska_segment_parse.cpp
+++ b/modules/demux/mkv/matroska_segment_parse.cpp
@@ -32,6 +32,7 @@ extern "C" {
 #include "../vobsub.h"
 #include "../xiph.h"
 #include "../windows_audio_commons.h"
+#include "../mp4/libmp4.h"
 }
 
 #include 
diff --git a/modules/demux/mkv/mkv.hpp b/modules/demux/mkv/mkv.hpp
index 0638914..8c5af80 100644
--- a/modules/demux/mkv/mkv.hpp
+++ b/modules/demux/mkv/mkv.hpp
@@ -97,9 +97,6 @@
 
 #include "ebml/StdIOCallback.h"
 
-extern "C" {
-   #include "../mp4/libmp4.h"
-}
 #ifdef HAVE_ZLIB_H
 #   include 
 #endif

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


[vlc-commits] demux: mp4: add restriction for frma atom

2014-09-29 Thread Francois Cartegnie
vlc | branch: master | Francois Cartegnie  | Sat Sep 27 
19:33:37 2014 +0200| [9b2d5c0f234aceb910c96edfd064716d5a7d7732] | committer: 
Francois Cartegnie

demux: mp4: add restriction for frma atom

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

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

diff --git a/modules/demux/mp4/libmp4.c b/modules/demux/mp4/libmp4.c
index 84b3f80..a7c2de0 100644
--- a/modules/demux/mp4/libmp4.c
+++ b/modules/demux/mp4/libmp4.c
@@ -3547,7 +3547,7 @@ static const struct
 { ATOM_key, MP4_ReadBox_drms, MP4_FreeBox_Common, 0 },
 { ATOM_iviv,MP4_ReadBox_drms, MP4_FreeBox_Common, 0 },
 { ATOM_priv,MP4_ReadBox_drms, MP4_FreeBox_Common, 0 },
-{ ATOM_frma,MP4_ReadBox_frma, MP4_FreeBox_Common, 0 },
+{ ATOM_frma,MP4_ReadBox_frma, MP4_FreeBox_Common, ATOM_sinf }, 
/* and rinf */
 { ATOM_skcr,MP4_ReadBox_skcr, MP4_FreeBox_Common, 0 },
 
 /* found in udta */

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


[vlc-commits] demux: libmp4: add mp4a/mp4v esds restrictions

2014-09-29 Thread Francois Cartegnie
vlc | branch: master | Francois Cartegnie  | Mon Sep 29 
15:37:08 2014 +0200| [ab27e26c207e1c7f4f687e349d46940c586db0bd] | committer: 
Francois Cartegnie

demux: libmp4: add mp4a/mp4v esds restrictions

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

 modules/demux/mp4/libmp4.c |8 +---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/modules/demux/mp4/libmp4.c b/modules/demux/mp4/libmp4.c
index a7c2de0..064f6f5 100644
--- a/modules/demux/mp4/libmp4.c
+++ b/modules/demux/mp4/libmp4.c
@@ -3390,7 +3390,7 @@ static const struct
 { ATOM_rmda,MP4_ReadBoxContainer, MP4_FreeBox_Common, ATOM_rmra },
 { ATOM_tref,MP4_ReadBoxContainer, MP4_FreeBox_Common, ATOM_trak },
 { ATOM_gmhd,MP4_ReadBoxContainer, MP4_FreeBox_Common, ATOM_minf },
-{ ATOM_wave,MP4_ReadBoxContainer, MP4_FreeBox_Common, 0 },
+{ ATOM_wave,MP4_ReadBoxContainer, MP4_FreeBox_Common, ATOM_stsd },
 { ATOM_ilst,MP4_ReadBoxContainer, MP4_FreeBox_Common, ATOM_meta },
 { ATOM_mvex,MP4_ReadBoxContainer, MP4_FreeBox_Common, ATOM_moov },
 { ATOM_mvex,MP4_ReadBoxContainer, MP4_FreeBox_Common, ATOM_ftyp },
@@ -3425,10 +3425,12 @@ static const struct
 { ATOM_padb,MP4_ReadBox_padb, MP4_FreeBox_padb, 0 },
 { ATOM_elst,MP4_ReadBox_elst, MP4_FreeBox_elst, ATOM_edts },
 { ATOM_cprt,MP4_ReadBox_cprt, MP4_FreeBox_cprt, 0 },
-{ ATOM_esds,MP4_ReadBox_esds, MP4_FreeBox_esds, 0 },
+{ ATOM_esds,MP4_ReadBox_esds, MP4_FreeBox_esds, ATOM_wave }, 
/* mp4a in wave chunk */
+{ ATOM_esds,MP4_ReadBox_esds, MP4_FreeBox_esds, ATOM_mp4a },
+{ ATOM_esds,MP4_ReadBox_esds, MP4_FreeBox_esds, ATOM_mp4v },
 { ATOM_dcom,MP4_ReadBox_dcom, MP4_FreeBox_Common, 0 },
 { ATOM_cmvd,MP4_ReadBox_cmvd, MP4_FreeBox_cmvd, 0 },
-{ ATOM_avcC,MP4_ReadBox_avcC, MP4_FreeBox_avcC, 0 },
+{ ATOM_avcC,MP4_ReadBox_avcC, MP4_FreeBox_avcC, ATOM_avc1 },
 { ATOM_hvcC,MP4_ReadBox_hvcC, MP4_FreeBox_hvcC, 0 },
 { ATOM_dac3,MP4_ReadBox_dac3, MP4_FreeBox_Common, 0 },
 { ATOM_dec3,MP4_ReadBox_dec3, MP4_FreeBox_Common, 0 },

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


[vlc-commits] demux: mp4: fix naming of objectProfileIndication

2014-09-29 Thread Francois Cartegnie
vlc | branch: master | Francois Cartegnie  | Mon Sep 29 
15:35:55 2014 +0200| [01f05de90bd3e4dbb735c6408e39e2ffc2dc25f0] | committer: 
Francois Cartegnie

demux: mp4: fix naming of objectProfileIndication

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

 modules/demux/mp4/libmp4.c |8 
 modules/demux/mp4/libmp4.h |2 +-
 modules/demux/mp4/mp4.c|8 +---
 3 files changed, 10 insertions(+), 8 deletions(-)

diff --git a/modules/demux/mp4/libmp4.c b/modules/demux/mp4/libmp4.c
index 064f6f5..b6cf91c 100644
--- a/modules/demux/mp4/libmp4.c
+++ b/modules/demux/mp4/libmp4.c
@@ -1212,7 +1212,7 @@ static int MP4_ReadBox_esds( stream_t *p_stream, 
MP4_Box_t *p_box )
 
 
 MP4_GET1BYTE( i_type );
-if( i_type == 0x03 ) /* MP4ESDescrTag */
+if( i_type == 0x03 ) /* MP4ESDescrTag ISO/IEC 14496-1 8.3.3 */
 {
 i_len = MP4_ReadLengthDescriptor( &p_peek, &i_read );
 
@@ -1258,7 +1258,7 @@ static int MP4_ReadBox_esds( stream_t *p_stream, 
MP4_Box_t *p_box )
 MP4_GET1BYTE( i_type ); /* get next type */
 }
 
-if( i_type != 0x04)/* MP4DecConfigDescrTag */
+if( i_type != 0x04)/* MP4DecConfigDescrTag ISO/IEC 14496-1 8.3.4 */
 {
  es_descriptor.p_decConfigDescr = NULL;
  MP4_READBOX_EXIT( 1 ); /* rest isn't interesting up to now */
@@ -1276,7 +1276,7 @@ static int MP4_ReadBox_esds( stream_t *p_stream, 
MP4_Box_t *p_box )
 if( unlikely( es_descriptor.p_decConfigDescr == NULL ) )
 MP4_READBOX_EXIT( 0 );
 
-MP4_GET1BYTE( es_descriptor.p_decConfigDescr->i_objectTypeIndication );
+MP4_GET1BYTE( es_descriptor.p_decConfigDescr->i_objectProfileIndication );
 MP4_GET1BYTE( i_flags );
 es_descriptor.p_decConfigDescr->i_streamType = i_flags >> 2;
 es_descriptor.p_decConfigDescr->b_upStream = ( i_flags >> 1 )&0x01;
@@ -1284,7 +1284,7 @@ static int MP4_ReadBox_esds( stream_t *p_stream, 
MP4_Box_t *p_box )
 MP4_GET4BYTES( es_descriptor.p_decConfigDescr->i_max_bitrate );
 MP4_GET4BYTES( es_descriptor.p_decConfigDescr->i_avg_bitrate );
 MP4_GET1BYTE( i_type );
-if( i_type !=  0x05 )/* MP4DecSpecificDescrTag */
+if( i_type !=  0x05 )/* MP4DecSpecificDescrTag ISO/IEC 14496-1 8.3.5 */
 {
 es_descriptor.p_decConfigDescr->i_decoder_specific_info_len = 0;
 es_descriptor.p_decConfigDescr->p_decoder_specific_info  = NULL;
diff --git a/modules/demux/mp4/libmp4.h b/modules/demux/mp4/libmp4.h
index 683b677..643e922 100644
--- a/modules/demux/mp4/libmp4.h
+++ b/modules/demux/mp4/libmp4.h
@@ -766,7 +766,7 @@ typedef struct MP4_Box_data_cprt_s
 /* DecoderConfigDescriptor */
 typedef struct MP4_descriptor_decoder_config_s
 {
-uint8_t i_objectTypeIndication;
+uint8_t i_objectProfileIndication;
 uint8_t i_streamType;
 int b_upStream;
 int i_buffer_sizeDB;
diff --git a/modules/demux/mp4/mp4.c b/modules/demux/mp4/mp4.c
index a146de7..42c718d 100644
--- a/modules/demux/mp4/mp4.c
+++ b/modules/demux/mp4/mp4.c
@@ -2709,6 +2709,8 @@ static int TrackCreateES( demux_t *p_demux, mp4_track_t 
*p_track,
 
 /* now see if esds is present and if so create a data packet
 with decoder_specific_info  */
+
+/* Only if MP4V */
 #define p_decconfig p_esds->data.p_esds->es_descriptor.p_decConfigDescr
 if( ( ( p_esds = MP4_BoxGet( p_sample, "esds" ) ) ||
   ( p_esds = MP4_BoxGet( p_sample, "wave/esds" ) ) )&&
@@ -2716,7 +2718,7 @@ static int TrackCreateES( demux_t *p_demux, mp4_track_t 
*p_track,
 ( p_decconfig ) )
 {
 /* First update information based on i_objectTypeIndication */
-switch( p_decconfig->i_objectTypeIndication )
+switch( p_decconfig->i_objectProfileIndication )
 {
 case( 0x20 ): /* MPEG4 VIDEO */
 p_track->fmt.i_codec = VLC_CODEC_MP4V;
@@ -2809,8 +2811,8 @@ static int TrackCreateES( demux_t *p_demux, mp4_track_t 
*p_track,
 default:
 /* Unknown entry, but don't touch i_fourcc */
 msg_Warn( p_demux,
-  "unknown objectTypeIndication(0x%x) (Track[ID 
0x%x])",
-  p_decconfig->i_objectTypeIndication,
+  "unknown objectProfileIndication(0x%x) (Track[ID 
0x%x])",
+  p_decconfig->i_objectProfileIndication,
   p_track->i_track_ID );
 break;
 }

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