# include "config.h"
#endif
-#include <vlc/vlc.h>
+#include <vlc_common.h>
+#include <vlc_plugin.h>
#include <vlc_sout.h>
#include <vlc_block.h>
-#include <vlc_codecs.h>
#ifdef HAVE_TIME_H
#include <time.h>
#endif
-#include "iso_lang.h"
+#include <vlc_iso_lang.h>
#include "vlc_meta.h"
/*****************************************************************************
#define SOUT_CFG_PREFIX "sout-mp4-"
vlc_module_begin();
- set_description( _("MP4/MOV muxer") );
+ set_description( N_("MP4/MOV muxer") );
set_category( CAT_SOUT );
set_subcategory( SUBCAT_SOUT_MUX );
set_shortname( "MP4" );
/*****************************************************************************
* Exported prototypes
*****************************************************************************/
-static const char *ppsz_sout_options[] = {
+static const char *const ppsz_sout_options[] = {
"faststart", NULL
};
p_mux->pf_delstream = DelStream;
p_mux->pf_mux = Mux;
p_mux->p_sys = p_sys = malloc( sizeof( sout_mux_sys_t ) );
+ if( !p_sys )
+ return VLC_ENOMEM;
p_sys->i_pos = 0;
p_sys->i_nb_streams = 0;
p_sys->pp_streams = NULL;
}
p_stream = malloc( sizeof( mp4_stream_t ) );
+ if( !p_stream )
+ return VLC_ENOMEM;
es_format_Copy( &p_stream->fmt, p_input->p_fmt );
p_stream->i_track_id = p_sys->i_nb_streams + 1;
p_stream->i_length_neg = 0;
block_t *p_next = block_FifoShow( p_input->p_fifo );
int64_t i_diff = p_next->i_dts - p_data->i_dts;
- if( i_diff < I64C(1000000 ) ) /* protection */
+ if( i_diff < INT64_C(1000000 ) ) /* protection */
{
p_data->i_length = i_diff;
}
i_bitrate_avg += p_stream->entry[i].i_size;
if( p_stream->entry[i].i_length > 0)
{
- int64_t i_bitrate = I64C(8000000) * p_stream->entry[i].i_size / p_stream->entry[i].i_length;
+ int64_t i_bitrate = INT64_C(8000000) * p_stream->entry[i].i_size / p_stream->entry[i].i_length;
if( i_bitrate > i_bitrate_max )
i_bitrate_max = i_bitrate;
}
}
if( p_stream->i_duration > 0 )
- i_bitrate_avg = I64C(8000000) * i_bitrate_avg / p_stream->i_duration;
+ i_bitrate_avg = INT64_C(8000000) * i_bitrate_avg / p_stream->i_duration;
else
i_bitrate_avg = 0;
if( i_bitrate_max <= 1 )
/* first, create quantified length */
for( i = 0, i_dts = 0, i_dts_q = 0; i < p_stream->i_entry_count; i++ )
{
- int64_t i_dts_deq = i_dts_q * I64C(1000000) / (int64_t)i_timescale;
+ int64_t i_dts_deq = i_dts_q * INT64_C(1000000) / (int64_t)i_timescale;
int64_t i_delta = p_stream->entry[i].i_length + i_dts - i_dts_deq;
i_dts += p_stream->entry[i].i_length;
p_stream->entry[i].i_length =
- i_delta * (int64_t)i_timescale / I64C(1000000);
+ i_delta * (int64_t)i_timescale / INT64_C(1000000);
i_dts_q += p_stream->entry[i].i_length;
}
static int64_t get_timestamp(void);
-static uint32_t mvhd_matrix[9] =
+static const uint32_t mvhd_matrix[9] =
{ 0x10000, 0, 0, 0, 0x10000, 0, 0, 0, 0x40000000 };
static bo_t *GetMoovBox( sout_mux_t *p_mux )
if( p_sys->b_64_ext )
{
bo_add_64be( elst, (p_stream->i_dts_start-p_sys->i_dts_start) *
- i_movie_timescale / I64C(1000000) );
+ i_movie_timescale / INT64_C(1000000) );
bo_add_64be( elst, -1 );
}
else
{
bo_add_32be( elst, (p_stream->i_dts_start-p_sys->i_dts_start) *
- i_movie_timescale / I64C(1000000) );
+ i_movie_timescale / INT64_C(1000000) );
bo_add_32be( elst, -1 );
}
bo_add_16be( elst, 1 );
if( p_sys->b_64_ext )
{
bo_add_64be( elst, p_stream->i_duration *
- i_movie_timescale / I64C(1000000) );
+ i_movie_timescale / INT64_C(1000000) );
bo_add_64be( elst, 0 );
}
else
{
bo_add_32be( elst, p_stream->i_duration *
- i_movie_timescale / I64C(1000000) );
+ i_movie_timescale / INT64_C(1000000) );
bo_add_32be( elst, 0 );
}
bo_add_16be( elst, 1 );
static block_t * bo_to_sout( sout_instance_t *p_sout, bo_t *box )
{
+ (void)p_sout;
block_t *p_buf;
p_buf = block_New( p_sout, box->i_buffer );