[vlc-commits] demux: mp4: split closed captioning setup
Francois Cartegnie
git at videolan.org
Sun Jun 14 16:03:31 CEST 2015
vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Sun Jun 14 12:19:09 2015 +0200| [8d2fd6f42765ae9b09a8bd6d08de30410bb4b553] | committer: Francois Cartegnie
demux: mp4: split closed captioning setup
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=8d2fd6f42765ae9b09a8bd6d08de30410bb4b553
---
modules/demux/mp4/essetup.c | 25 +++++++++++++++++++++----
modules/demux/mp4/mp4.c | 19 ++++++++++++-------
modules/demux/mp4/mp4.h | 1 +
3 files changed, 34 insertions(+), 11 deletions(-)
diff --git a/modules/demux/mp4/essetup.c b/modules/demux/mp4/essetup.c
index 5ba3950..bdceefd 100644
--- a/modules/demux/mp4/essetup.c
+++ b/modules/demux/mp4/essetup.c
@@ -154,6 +154,8 @@ static void SetupESDS( demux_t *p_demux, mp4_track_t *p_track, const MP4_descrip
int SetupVideoES( demux_t *p_demux, mp4_track_t *p_track, MP4_Box_t *p_sample )
{
MP4_Box_data_sample_vide_t *p_vide = p_sample->data.p_sample_vide;
+ if(!p_vide)
+ return 0;
p_track->fmt.video.i_width = p_vide->i_width;
p_track->fmt.video.i_height = p_vide->i_height;
@@ -386,6 +388,8 @@ int SetupVideoES( demux_t *p_demux, mp4_track_t *p_track, MP4_Box_t *p_sample )
int SetupAudioES( demux_t *p_demux, mp4_track_t *p_track, MP4_Box_t *p_sample )
{
MP4_Box_data_sample_soun_t *p_soun = p_sample->data.p_sample_soun;
+ if(!p_soun)
+ return 0;
p_track->fmt.audio.i_channels = p_soun->i_channelcount;
p_track->fmt.audio.i_rate = p_soun->i_sampleratehi;
@@ -746,12 +750,10 @@ int SetupAudioES( demux_t *p_demux, mp4_track_t *p_track, MP4_Box_t *p_sample )
return 1;
}
-
-int SetupSpuES( demux_t *p_demux, mp4_track_t *p_track, MP4_Box_t *p_sample )
+int SetupCCES( demux_t *p_demux, mp4_track_t *p_track, MP4_Box_t *p_sample )
{
- MP4_Box_data_sample_text_t *p_text = p_sample->data.p_sample_text;
+ VLC_UNUSED(p_demux);
- /* It's a little ugly but .. there are special cases */
switch( p_sample->i_type )
{
case( ATOM_c608 ): /* EIA608 closed captions */
@@ -759,7 +761,22 @@ int SetupSpuES( demux_t *p_demux, mp4_track_t *p_track, MP4_Box_t *p_sample )
p_track->fmt.i_codec = VLC_CODEC_EIA608_1;
p_track->fmt.i_cat = SPU_ES;
break;
+ default:
+ return 0;
+ }
+
+ return 1;
+}
+
+int SetupSpuES( demux_t *p_demux, mp4_track_t *p_track, MP4_Box_t *p_sample )
+{
+ MP4_Box_data_sample_text_t *p_text = p_sample->data.p_sample_text;
+ if(!p_text)
+ return 0;
+ /* It's a little ugly but .. there are special cases */
+ switch( p_sample->i_type )
+ {
case( VLC_FOURCC( 't', 'e', 'x', 't' ) ):
case( VLC_FOURCC( 't', 'x', '3', 'g' ) ):
{
diff --git a/modules/demux/mp4/mp4.c b/modules/demux/mp4/mp4.c
index 6c6c3f4..b368471 100644
--- a/modules/demux/mp4/mp4.c
+++ b/modules/demux/mp4/mp4.c
@@ -2381,9 +2381,8 @@ static int TrackCreateES( demux_t *p_demux, mp4_track_t *p_track,
switch( p_track->fmt.i_cat )
{
case VIDEO_ES:
- if ( !p_sample->data.p_sample_vide )
+ if ( !SetupVideoES( p_demux, p_track, p_sample ) )
return VLC_EGENERIC;
- SetupVideoES( p_demux, p_track, p_sample );
/* Set frame rate */
TrackGetESSampleRate( p_demux,
@@ -2397,15 +2396,21 @@ static int TrackCreateES( demux_t *p_demux, mp4_track_t *p_track,
break;
case AUDIO_ES:
- if ( !p_sample->data.p_sample_soun )
+ if ( !SetupAudioES( p_demux, p_track, p_sample ) )
return VLC_EGENERIC;
- SetupAudioES( p_demux, p_track, p_sample );
break;
case SPU_ES:
- if ( !p_sample->data.p_sample_text )
- return VLC_EGENERIC;
- SetupSpuES( p_demux, p_track, p_sample );
+ switch( p_sample->i_handler )
+ {
+ case ATOM_clcp:
+ if ( !SetupCCES( p_demux, p_track, p_sample ) )
+ return VLC_EGENERIC;
+ break;
+ default:
+ if ( !SetupSpuES( p_demux, p_track, p_sample ) )
+ return VLC_EGENERIC;
+ }
default:
break;
diff --git a/modules/demux/mp4/mp4.h b/modules/demux/mp4/mp4.h
index 5f9ce35..b74464a 100644
--- a/modules/demux/mp4/mp4.h
+++ b/modules/demux/mp4/mp4.h
@@ -162,5 +162,6 @@ struct mp4_fragment_t
int SetupVideoES( demux_t *p_demux, mp4_track_t *p_track, MP4_Box_t *p_sample );
int SetupAudioES( demux_t *p_demux, mp4_track_t *p_track, MP4_Box_t *p_sample );
int SetupSpuES( demux_t *p_demux, mp4_track_t *p_track, MP4_Box_t *p_sample );
+int SetupCCES( demux_t *p_demux, mp4_track_t *p_track, MP4_Box_t *p_sample );
void SetupMeta( vlc_meta_t *p_meta, MP4_Box_t *p_udta );
#endif
More information about the vlc-commits
mailing list