Commit 169dd181 authored by François Cartegnie's avatar François Cartegnie 🤞

stream_filter: smooth: remove legacy smooth filter

Deprecated by adaptative, which is also now jammed by filter.
Drops specific MP4 forged smoo/stra hacks.
parent 30819e5d
......@@ -70,8 +70,8 @@ Demuxers:
* Support for Creative ADPCM/alaw/ulaw/S16L in VOC files
* Support for Creative ADPCM in AVI
* Directory Demux can now sort items, ignore extensions and hidden files
* Replaced httplive stream filter with new HLS demuxer, using the same core
as the DASH module
* Replaced httplive stream filter with new HLS demuxer, replaced smooth
stream filter with new Smooth demuxer, both using unified adaptive module
Stream filter:
* Added ARIB STD-B25 TS streams decoder
......@@ -177,6 +177,7 @@ Removed modules
* Atmo video filter
* QTCapture access module (use AVCapture instead)
* httplive (use adaptive instead)
* smooth (use adaptive instead)
* Gnome-VFS access module (i.e. Gnome 2.x)
......
......@@ -342,7 +342,6 @@ $Id$
* skins2: Skinnable interface, new generation
* smb: SMB shares access module
* smf: Standard MIDI file demuxer
* smooth: Microsoft Smooth Streaming input
* sndio: OpenBSD sndio audio output
* soxr: SoX Resampler library audio filter
* spatializer: A spatializer audio filter
......
......@@ -675,66 +675,12 @@ static int MP4_ReadBox_tfrf( stream_t *p_stream, MP4_Box_t *p_box )
MP4_READBOX_EXIT( 1 );
}
static void MP4_FreeBox_stra( MP4_Box_t *p_box )
{
FREENULL( p_box->data.p_stra->CodecPrivateData );
}
static int MP4_ReadBox_stra( stream_t *p_stream, MP4_Box_t *p_box )
{
MP4_READBOX_ENTER( MP4_Box_data_stra_t, MP4_FreeBox_stra );
MP4_Box_data_stra_t *p_stra = p_box->data.p_stra;
uint8_t i_reserved;
VLC_UNUSED(i_reserved);
MP4_GET1BYTE( p_stra->i_es_cat );
MP4_GET1BYTE( i_reserved );
MP4_GET2BYTES( p_stra->i_track_ID );
MP4_GET4BYTES( p_stra->i_timescale );
MP4_GET8BYTES( p_stra->i_duration );
MP4_GET4BYTES( p_stra->FourCC );
MP4_GET4BYTES( p_stra->Bitrate );
MP4_GET4BYTES( p_stra->MaxWidth );
MP4_GET4BYTES( p_stra->MaxHeight );
MP4_GET4BYTES( p_stra->SamplingRate );
MP4_GET4BYTES( p_stra->Channels );
MP4_GET4BYTES( p_stra->BitsPerSample );
MP4_GET4BYTES( p_stra->AudioTag );
MP4_GET2BYTES( p_stra->nBlockAlign );
MP4_GET1BYTE( i_reserved );
MP4_GET1BYTE( i_reserved );
MP4_GET1BYTE( i_reserved );
MP4_GET1BYTE( p_stra->cpd_len );
if( p_stra->cpd_len > i_read )
goto error;
p_stra->CodecPrivateData = malloc( p_stra->cpd_len );
if( unlikely( p_stra->CodecPrivateData == NULL ) )
goto error;
memcpy( p_stra->CodecPrivateData, p_peek, p_stra->cpd_len );
#ifdef MP4_VERBOSE
msg_Dbg( p_stream, "es_cat is %"PRIu8", birate is %"PRIu32,
p_stra->i_es_cat, p_stra->Bitrate );
#endif
MP4_READBOX_EXIT( 1 );
error:
MP4_READBOX_EXIT( 0 );
}
static int MP4_ReadBox_uuid( stream_t *p_stream, MP4_Box_t *p_box )
{
if( !CmpUUID( &p_box->i_uuid, &TfrfBoxUUID ) )
return MP4_ReadBox_tfrf( p_stream, p_box );
if( !CmpUUID( &p_box->i_uuid, &TfxdBoxUUID ) )
return MP4_ReadBox_tfxd( p_stream, p_box );
if( !CmpUUID( &p_box->i_uuid, &SmooBoxUUID ) )
return MP4_ReadBoxContainer( p_stream, p_box );
if( !CmpUUID( &p_box->i_uuid, &StraBoxUUID ) )
return MP4_ReadBox_stra( p_stream, p_box );
msg_Warn( p_stream, "Unknown uuid type box" );
return 1;
......@@ -4102,39 +4048,6 @@ void MP4_BoxFree( MP4_Box_t *p_box )
free( p_box );
}
/* SmooBox is a very simple MP4 box, VLC specific, used only for the stream_filter to
* send information to the demux. SmooBox is actually a simplified moov box (we wanted
* to avoid the hassle of building a moov box at the stream_filter level) */
MP4_Box_t *MP4_BoxGetSmooBox( stream_t *s )
{
/* p_chunk is a virtual root container for the smoo box */
MP4_Box_t *p_chunk;
MP4_Box_t *p_smoo;
p_chunk = calloc( 1, sizeof( MP4_Box_t ) );
if( unlikely( p_chunk == NULL ) )
return NULL;
p_chunk->i_type = ATOM_root;
p_chunk->i_shortsize = 1;
p_smoo = MP4_ReadBox( s, p_chunk );
if( !p_smoo || p_smoo->i_type != ATOM_uuid || CmpUUID( &p_smoo->i_uuid, &SmooBoxUUID ) )
{
msg_Warn( s, "no smoo box found!");
goto error;
}
p_chunk->p_first = p_smoo;
p_chunk->p_last = p_smoo;
return p_chunk;
error:
free( p_chunk );
return NULL;
}
MP4_Box_t *MP4_BoxGetNextChunk( stream_t *s )
{
/* p_chunk is a virtual root container for the moof and mdat boxes */
......@@ -4148,12 +4061,7 @@ MP4_Box_t *MP4_BoxGetNextChunk( stream_t *s )
/* We might get a ftyp box or a SmooBox */
MP4_PeekBoxHeader( s, p_tmp_box );
if( (p_tmp_box->i_type == ATOM_uuid && !CmpUUID( &p_tmp_box->i_uuid, &SmooBoxUUID )) )
{
free( p_tmp_box );
return MP4_BoxGetSmooBox( s );
}
else if( p_tmp_box->i_type == ATOM_ftyp )
if( p_tmp_box->i_type == ATOM_ftyp )
{
free( p_tmp_box );
return MP4_BoxGetRoot( s );
......
......@@ -1358,26 +1358,6 @@ typedef struct
uint8_t *p_sample_number;
} MP4_Box_data_tfra_t;
typedef struct
{
uint64_t i_duration;
uint32_t i_timescale;
uint16_t i_track_ID;
uint8_t i_es_cat;
uint32_t FourCC;
uint32_t Bitrate;
uint32_t MaxWidth;
uint32_t MaxHeight;
uint32_t SamplingRate;
uint32_t Channels;
uint32_t BitsPerSample;
uint32_t AudioTag;
uint16_t nBlockAlign;
uint8_t cpd_len;
uint8_t *CodecPrivateData;
} MP4_Box_data_stra_t;
typedef struct
{
enum
......@@ -1462,7 +1442,6 @@ typedef union MP4_Box_data_s
MP4_Box_data_tfra_t *p_tfra;
MP4_Box_data_mfro_t *p_mfro;
MP4_Box_data_stra_t *p_stra;
MP4_Box_data_stsz_t *p_stsz;
MP4_Box_data_stz2_t *p_stz2;
......@@ -1666,16 +1645,6 @@ static const UUID_t TfxdBoxUUID = {
{ 0x6d, 0x1d, 0x9b, 0x05, 0x42, 0xd5, 0x44, 0xe6,
0x80, 0xe2, 0x14, 0x1d, 0xaf, 0xf7, 0x57, 0xb2 } };
static const UUID_t SmooBoxUUID = {
{ 0xe1, 0xda, 0x72, 0xba, 0x24, 0xd7, 0x43, 0xc3,
0xa6, 0xa5, 0x1b, 0x57, 0x59, 0xa1, 0xa9, 0x2c } };
static const UUID_t StraBoxUUID = {
{ 0xb0, 0x3e, 0xf7, 0x70, 0x33, 0xbd, 0x4b, 0xac,
0x96, 0xc7, 0xbf, 0x25, 0xf9, 0x7e, 0x24, 0x47 } };
MP4_Box_t *MP4_BoxGetSmooBox( stream_t * );
/*****************************************************************************
* MP4_BoxGetNextChunk : Parse the entire moof box.
*****************************************************************************
......
......@@ -83,7 +83,6 @@ struct demux_sys_t
bool b_seekable;
bool b_fastseekable;
bool b_seekmode;
bool b_smooth; /* Is it Smooth Streaming? (streamfilter) */
bool b_index_probed;
bool b_fragments_probed;
......@@ -114,8 +113,6 @@ struct demux_sys_t
* Declaration of local function
*****************************************************************************/
static void MP4_TrackCreate ( demux_t *, mp4_track_t *, MP4_Box_t *, bool, bool );
static int MP4_SmoothTrackCreate( demux_t *, mp4_track_t *, const mp4_chunk_t *,
const MP4_Box_t *, bool );
static void MP4_TrackDestroy( demux_t *, mp4_track_t * );
static block_t * MP4_Block_Read( demux_t *, const mp4_track_t *, int );
......@@ -311,49 +308,12 @@ static int LoadInitFrag( demux_t *p_demux )
{
demux_sys_t *p_sys = p_demux->p_sys;
if( p_sys->b_smooth ) /* Smooth Streaming */
/* Load all boxes ( except raw data ) */
if( ( p_sys->p_root = MP4_BoxGetRoot( p_demux->s ) ) == NULL )
{
if( ( p_sys->p_root = MP4_BoxGetSmooBox( p_demux->s ) ) == NULL )
{
goto LoadInitFragError;
}
else
{
MP4_Box_t *p_smoo = MP4_BoxGet( p_sys->p_root, "uuid" );
if( !p_smoo || CmpUUID( &p_smoo->i_uuid, &SmooBoxUUID ) )
goto LoadInitFragError;
/* Get number of tracks */
p_sys->i_tracks = 0;
for( int i = 0; i < 3; i++ )
{
MP4_Box_t *p_stra = MP4_BoxGet( p_smoo, "uuid[%d]", i );
if( p_stra && BOXDATA(p_stra) && BOXDATA(p_stra)->i_track_ID )
p_sys->i_tracks++;
/* Get timescale and duration of the video track; */
if( p_sys->i_timescale == 0 )
{
if ( p_stra && BOXDATA(p_stra) )
{
p_sys->i_timescale = BOXDATA(p_stra)->i_timescale;
p_sys->i_overall_duration = BOXDATA(p_stra)->i_duration;
}
if( p_sys->i_timescale == 0 )
{
msg_Err( p_demux, "bad timescale" );
goto LoadInitFragError;
}
}
}
}
}
else
{
/* Load all boxes ( except raw data ) */
if( ( p_sys->p_root = MP4_BoxGetRoot( p_demux->s ) ) == NULL )
{
goto LoadInitFragError;
}
goto LoadInitFragError;
}
return VLC_SUCCESS;
LoadInitFragError:
......@@ -383,36 +343,6 @@ static int AllocateTracks( demux_t *p_demux, unsigned i_tracks )
return VLC_SUCCESS;
}
static int CreateTracksFromSmooBox( demux_t *p_demux )
{
demux_sys_t *p_sys = p_demux->p_sys;
MP4_Box_t *p_smoo = MP4_BoxGet( p_sys->p_root, "uuid" );
if( CmpUUID( &p_smoo->i_uuid, &SmooBoxUUID ) )
return VLC_EGENERIC;
/* Smooth tracks are stra UUID box below smooth UUID box */
const unsigned i_tracks = MP4_BoxCount( p_smoo, "uuid" );
if( AllocateTracks( p_demux, i_tracks ) != VLC_SUCCESS )
return VLC_EGENERIC;
unsigned j = 0;
MP4_Box_t *p_stra = MP4_BoxGet( p_smoo, "uuid" );
while( p_stra && j < p_sys->i_tracks )
{
if( !CmpUUID( &p_stra->i_uuid, &StraBoxUUID ) &&
BOXDATA(p_stra) && BOXDATA(p_stra)->i_track_ID > 0 )
{
mp4_track_t *p_track = &p_sys->track[j++];
MP4_SmoothTrackCreate( p_demux, p_track, p_track->cchunk, p_stra, true );
}
p_stra = p_stra->p_next;
}
return VLC_SUCCESS;
}
static block_t * MP4_EIA608_Convert( block_t * p_block )
{
/* Rebuild codec data from encap */
......@@ -595,13 +525,6 @@ static int Open( vlc_object_t * p_this )
p_demux->p_sys = p_sys;
if( stream_Peek( p_demux->s, &p_peek, 24 ) < 24 ) return VLC_EGENERIC;
if( !CmpUUID( (UUID_t *)(p_peek + 8), &SmooBoxUUID ) )
{
p_sys->b_smooth = true;
p_sys->b_fragmented = true;
}
if( LoadInitFrag( p_demux ) != VLC_SUCCESS )
goto error;
......@@ -662,7 +585,7 @@ static int Open( vlc_object_t * p_this )
if( MP4_BoxCount( p_sys->p_root, "/moov/mvex" ) > 0 )
{
if ( p_sys->b_seekable && !p_sys->b_smooth )
if ( p_sys->b_seekable )
{
/* Probe remaining to check if there's really fragments
or if that file is just ready to append fragments */
......@@ -686,22 +609,12 @@ static int Open( vlc_object_t * p_this )
if ( !MP4_Fragment_Moov(&p_sys->fragments)->p_moox )
AddFragment( p_demux, MP4_BoxGet( p_sys->p_root, "/moov" ) );
/* we always need a moov entry, but smooth has a workaround */
if ( !MP4_Fragment_Moov(&p_sys->fragments)->p_moox && !p_sys->b_smooth )
if ( !MP4_Fragment_Moov(&p_sys->fragments)->p_moox )
goto error;
MP4_BoxDumpStructure( p_demux->s, p_sys->p_root );
if( p_sys->b_smooth )
{
if( CreateTracksFromSmooBox( p_demux ) != VLC_SUCCESS )
goto error;
p_demux->pf_demux = DemuxFrg;
msg_Dbg( p_demux, "Set DemuxFrg mode" );
return VLC_SUCCESS;
}
else if( p_sys->b_fragmented )
if( p_sys->b_fragmented )
{
p_demux->pf_demux = DemuxAsLeaf;
msg_Dbg( p_demux, "Set experimental DemuxLeaf mode" );
......@@ -2682,16 +2595,8 @@ static void MP4_TrackRestart( demux_t *p_demux, mp4_track_t *p_track,
MP4_TrackDestroy( p_demux, p_track );
memset( p_track, 0, sizeof(*p_track) );
if( p_demux->p_sys->b_smooth )
{
assert(p_params_box->i_type == ATOM_uuid && !CmpUUID( &p_params_box->i_uuid, &StraBoxUUID ) );
MP4_SmoothTrackCreate( p_demux, p_track, cchunk_backup, p_params_box, false );
}
else
{
assert(p_params_box->i_type == ATOM_trak);
MP4_TrackCreate( p_demux, p_track, p_params_box, false, true );
}
assert(p_params_box->i_type == ATOM_trak);
MP4_TrackCreate( p_demux, p_track, p_params_box, false, true );
if( p_track->b_ok )
{
......@@ -3415,221 +3320,6 @@ static void MP4_TrackSetELST( demux_t *p_demux, mp4_track_t *tk,
* Here are the functions used for fragmented MP4
*****************************************************************************/
/**
* It computes the sample rate for a video track using current video chunk
*/
static void ChunkGetESSampleRate( unsigned *pi_num, unsigned *pi_den,
const mp4_chunk_t *p_cchunk,
uint32_t i_timescale )
{
if( !p_cchunk || p_cchunk->i_last_dts == 0 || i_timescale == 0 )
return;
*pi_num = 0;
*pi_den = 0;
uint32_t i_sample = p_cchunk->i_sample_count;
uint64_t i_first_dts = p_cchunk->i_first_dts;
uint64_t i_last_dts = p_cchunk->i_last_dts;
if( i_sample > 1 && i_first_dts < i_last_dts )
vlc_ureduce( pi_num, pi_den,
( i_sample - 1) * i_timescale,
i_last_dts - i_first_dts,
UINT16_MAX);
}
/**
* Build raw avcC box (without the 8 bytes header)
* \return The size of the box.
*/
static int build_raw_avcC( uint8_t **p_extra, const uint8_t *CodecPrivateData,
const unsigned cpd_len )
{
uint8_t *avcC;
unsigned sps_len = 0, pps_len = 0;
const uint32_t mark = 0x00000001;
assert( CodecPrivateData[0] == 0 );
assert( CodecPrivateData[1] == 0 );
assert( CodecPrivateData[2] == 0 );
assert( CodecPrivateData[3] == 1 );
uint32_t length = cpd_len + 3;
avcC = calloc( length, 1 );
if( unlikely( avcC == NULL ) )
return 0;
uint8_t *sps = avcC + 8;
uint32_t candidate = ~mark;
CodecPrivateData += 4;
for( unsigned i = 0; i < cpd_len - 4; i++ )
{
sps[i] = CodecPrivateData[i];
candidate = (candidate << 8) | CodecPrivateData[i];
if( candidate == mark )
{
sps_len = i - 3;
break;
}
}
if( sps_len == 0 )
{
free( avcC );
return 0;
}
uint8_t *pps = sps + sps_len + 3;
pps_len = cpd_len - sps_len - 4 * 2;
memcpy( pps, CodecPrivateData + sps_len + 4, pps_len );
/* XXX */
uint8_t AVCProfileIndication = 0x64;
uint8_t profile_compatibility = 0x40;
uint8_t AVCLevelIndication = 0x1f;
uint8_t lengthSizeMinusOne = 0x03;
avcC[0] = 1;
avcC[1] = AVCProfileIndication;
avcC[2] = profile_compatibility;
avcC[3] = AVCLevelIndication;
avcC[4] = 0xfc + lengthSizeMinusOne;
avcC[5] = 0xe0 + 1;
avcC[6] = (sps_len & 0xff00)>>8;
avcC[7] = sps_len & 0xff;
avcC[8+sps_len] = 1;
avcC[9+sps_len] = (pps_len & 0xff00) >> 8;
avcC[10+sps_len] = pps_len & 0xff;
*p_extra = avcC;
return length;
}
/**
* Build a mp4_track_t from a StraBox
*/
static inline int MP4_SetCodecExtraData( es_format_t *fmt, const MP4_Box_data_stra_t *p_data )
{
fmt->p_extra = malloc( p_data->cpd_len );
if( unlikely( !fmt->p_extra ) )
return VLC_ENOMEM;
fmt->i_extra = p_data->cpd_len;
memcpy( fmt->p_extra, p_data->CodecPrivateData, p_data->cpd_len );
return VLC_SUCCESS;
}
static int MP4_SmoothFormatFill( const MP4_Box_data_stra_t *p_data,
es_format_t *fmt )
{
/* Set language FIXME */
fmt->psz_language = strdup( "en" );
fmt->i_cat = p_data->i_es_cat;
fmt->i_original_fourcc = p_data->FourCC;
fmt->i_codec = vlc_fourcc_GetCodec( fmt->i_cat, p_data->FourCC );
uint8_t **p_extra = (uint8_t **)&fmt->p_extra;
/* See http://msdn.microsoft.com/en-us/library/ff728116%28v=vs.90%29.aspx
* for MS weird use of FourCC*/
switch( fmt->i_cat )
{
case VIDEO_ES:
if( p_data->FourCC == VLC_FOURCC( 'A', 'V', 'C', '1' ) ||
p_data->FourCC == VLC_FOURCC( 'A', 'V', 'C', 'B' ) ||
p_data->FourCC == VLC_FOURCC( 'H', '2', '6', '4' ) )
{
fmt->i_extra = build_raw_avcC( p_extra,
p_data->CodecPrivateData, p_data->cpd_len );
}
else
{
if ( MP4_SetCodecExtraData( fmt, p_data ) != VLC_SUCCESS )
return VLC_EGENERIC;
}
fmt->video.i_width = p_data->MaxWidth;
fmt->video.i_height = p_data->MaxHeight;
fmt->video.i_bits_per_pixel = 0x18;
fmt->video.i_visible_width = p_data->MaxWidth;
fmt->video.i_visible_height = p_data->MaxHeight;
break;
case AUDIO_ES:
fmt->audio.i_channels = p_data->Channels;
fmt->audio.i_rate = p_data->SamplingRate;
fmt->audio.i_bitspersample = p_data->BitsPerSample;
fmt->audio.i_blockalign = p_data->nBlockAlign;
fmt->i_bitrate = p_data->Bitrate;
if ( MP4_SetCodecExtraData( fmt, p_data ) != VLC_SUCCESS )
return VLC_EGENERIC;
break;
default:
break;
}
return VLC_SUCCESS;
}
static int MP4_SmoothTrackCreate( demux_t *p_demux, mp4_track_t *p_track,
const mp4_chunk_t *p_cchunk,
const MP4_Box_t *p_stra, bool b_create_es )
{
demux_sys_t *p_sys = p_demux->p_sys;
es_format_t *fmt = &p_track->fmt;
MP4_Box_data_stra_t *p_data = BOXDATA(p_stra);
if( !p_data )
return VLC_EGENERIC;
p_track->i_sample_count = UINT32_MAX;
p_track->i_timescale = p_sys->i_timescale;
p_track->i_track_ID = p_data->i_track_ID;
p_track->i_width = 0;
p_track->i_height = 0;
es_format_Init( fmt, p_data->i_es_cat, 0 );
if( MP4_SmoothFormatFill( p_data, fmt ) != VLC_SUCCESS )
return VLC_EGENERIC;
if( fmt->i_cat == VIDEO_ES )
{
p_track->i_width = fmt->video.i_visible_width;
p_track->i_height = fmt->video.i_visible_height;
/* Frame rate */
ChunkGetESSampleRate( &fmt->video.i_frame_rate,
&fmt->video.i_frame_rate_base,
p_cchunk, p_track->i_timescale );
if( fmt->video.i_frame_rate_base != 0 )
{
p_demux->p_sys->f_fps = (float)fmt->video.i_frame_rate /
(float)fmt->video.i_frame_rate_base;
}
else
p_demux->p_sys->f_fps = 24;
}
if( b_create_es )
{
p_track->p_es = es_out_Add( p_demux->out, fmt );
if( !p_track->p_es )
return VLC_EGENERIC;
}
p_track->b_ok = true;
return VLC_SUCCESS;
}
/**
* Return the track identified by tid
*/
......@@ -3695,21 +3385,9 @@ static void FlushChunk( demux_t *p_demux, mp4_track_t *tk )
static int ReInitDecoder( demux_t *p_demux, const MP4_Box_t *p_root,
mp4_track_t *p_track )
{
demux_sys_t *p_sys = p_demux->p_sys;
MP4_Box_t *p_paramsbox; /* trak or stra */
if( p_sys->b_smooth )
{
p_paramsbox = MP4_BoxGet( p_root, "uuid/uuid[0]" );
if( !p_paramsbox || CmpUUID( &p_paramsbox->i_uuid, &StraBoxUUID ) )
return VLC_EGENERIC;
}
else /* DASH */
{
p_paramsbox = MP4_BoxGet( p_root, "/moov/trak[0]" );
if( !p_paramsbox )
return VLC_EGENERIC;
}
MP4_Box_t *p_paramsbox = MP4_BoxGet( p_root, "/moov/trak[0]" );
if( !p_paramsbox )
return VLC_EGENERIC;
MP4_TrackRestart( p_demux, p_track, p_paramsbox );
......@@ -3919,32 +3597,18 @@ static int MP4_frg_GetChunks( demux_t *p_demux, const unsigned i_tk_id )
goto MP4_frg_GetChunks_Error;
uint32_t i_type = p_chunk->p_first->i_type;
uint32_t tid = 0;
if( i_type == ATOM_uuid || i_type == ATOM_ftyp )
if( i_type == ATOM_ftyp )
{
MP4_BoxFree( p_sys->p_root );
p_sys->p_root = p_chunk;
if( i_type == ATOM_ftyp ) /* DASH */
{
MP4_Box_t *p_tkhd = MP4_BoxGet( p_chunk, "/moov/trak[0]/tkhd" );
if( !p_tkhd )
{
msg_Warn( p_demux, "No tkhd found!" );
goto MP4_frg_GetChunks_Error;
}
tid = p_tkhd->data.p_tkhd->i_track_ID;
}
else /* Smooth Streaming */
MP4_Box_t *p_tkhd = MP4_BoxGet( p_chunk, "/moov/trak[0]/tkhd" );
if( !p_tkhd )
{
assert( !CmpUUID( &p_chunk->p_first->i_uuid, &SmooBoxUUID ) );
MP4_Box_t *p_stra = MP4_BoxGet( p_chunk, "/uuid/uuid[0]" );
if( !p_stra || CmpUUID( &p_stra->i_uuid, &StraBoxUUID ) )
{
msg_Warn( p_demux, "No StraBox found!" );
goto MP4_frg_GetChunks_Error;
}
tid = p_stra->data.p_stra->i_track_ID;
msg_Warn( p_demux, "No tkhd found!" );
goto MP4_frg_GetChunks_Error;
}
tid = p_tkhd->data.p_tkhd->i_track_ID;
p_track = MP4_frg_GetTrackByID( p_demux, tid );
if( !p_track )
......@@ -4249,29 +3913,20 @@ static bool AddFragment( demux_t *p_demux, MP4_Box_t *p_moox )
uint32_t i_track_timescale = 0;
uint32_t i_track_defaultsamplesize = 0;
uint32_t i_track_defaultsampleduration = 0;
if ( p_sys->b_smooth )
/* set trex for defaults */
MP4_Box_t *p_trex = MP4_GetTrexByTrackID( p_moovfragment->p_moox, BOXDATA(p_tfhd)->i_track_ID );
if ( p_trex )
{
/* stra sets identical timescales */
i_track_timescale = p_sys->i_timescale;
i_track_defaultsamplesize = 1;
i_track_defaultsampleduration = 1;
i_track_defaultsamplesize = BOXDATA(p_trex)->i_default_sample_size;
i_track_defaultsampleduration = BOXDATA(p_trex)->i_default_sample_duration;
}
else
{
/* set trex for defaults */
MP4_Box_t *p_trex = MP4_GetTrexByTrackID( p_moovfragment->p_moox, BOXDATA(p_tfhd)->i_track_ID );
if ( p_trex )
{
i_track_defaultsamplesize = BOXDATA(p_trex)->i_default_sample_size;
i_track_defaultsampleduration = BOXDATA(p_trex)->i_default_sample_duration;
}
MP4_Box_t *p_trak = MP4_GetTrakByTrackID( p_moovfragment->p_moox, BOXDATA(p_tfhd)->i_track_ID );
if ( p_trak )
{
MP4_Box_t *p_mdhd = MP4_BoxGet( p_trak, "mdia/mdhd" );
if ( p_mdhd ) i_track_timescale = BOXDATA(p_mdhd)->i_timescale;
}
MP4_Box_t *p_trak = MP4_GetTrakByTrackID( p_moovfragment->p_moox, BOXDATA(p_tfhd)->i_track_ID );
if ( p_trak )
{
MP4_Box_t *p_mdhd = MP4_BoxGet( p_trak, "mdia/mdhd" );
if ( p_mdhd ) i_track_timescale = BOXDATA(p_mdhd)->i_timescale;
}
if ( !i_track_timescale )
......@@ -5044,8 +4699,7 @@ static int LeafParseMDATwithMOOF( demux_t *p_demux, MP4_Box_t *p_moof )
if ( !MP4_stream_Tell( p_demux->s, &i_pos ) )
return VLC_EGENERIC;
if ( p_sys->b_smooth )
i_pos -= p_moof->i_pos;
mp4_track_t *p_track = LeafGetTrackByTrunPos( p_demux, i_pos, p_moof->i_pos, p_moof->i_size );
if( p_track )
{
......
......@@ -20,19 +20,6 @@ libprefetch_plugin_la_SOURCES = stream_filter/prefetch.c
libprefetch_plugin_la_LIBADD = $(LIBPTHREAD)
stream_filter_LTLIBRARIES += libprefetch_plugin.la
libsmooth_plugin_la_SOURCES = \
stream_filter/smooth/smooth.c \
stream_filter/smooth/utils.c \
stream_filter/smooth/downloader.c \
stream_filter/smooth/smooth.h \
demux/mp4/libmp4.c demux/mp4/libmp4.h
libsmooth_plugin_la_CFLAGS = $(AM_CFLAGS)
libsmooth_plugin_la_LIBADD = $(LIBM)
if HAVE_ZLIB
libsmooth_plugin_la_LIBADD += -lz
endif
stream_filter_LTLIBRARIES += libsmooth_plugin.la
libhds_plugin_la_SOURCES = \
stream_filter/hds/hds.c
......