X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=modules%2Fpacketizer%2Fmpeg4video.c;h=c9136efd34f0bf2a87bd718edb22c2b37246912b;hb=c00159b78ec079ccb8d9c5ae5e27653f82a27bf6;hp=3465980a30bcc520c2450c59d5dfec135b777f29;hpb=ab1b0ebec326fae87388c7904c952e827acffe50;p=vlc diff --git a/modules/packetizer/mpeg4video.c b/modules/packetizer/mpeg4video.c index 3465980a30..c9136efd34 100644 --- a/modules/packetizer/mpeg4video.c +++ b/modules/packetizer/mpeg4video.c @@ -26,9 +26,13 @@ /***************************************************************************** * Preamble *****************************************************************************/ -#include /* malloc(), free() */ -#include +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + +#include +#include #include #include #include @@ -46,7 +50,7 @@ static void Close( vlc_object_t * ); vlc_module_begin(); set_category( CAT_SOUT ); set_subcategory( SUBCAT_SOUT_PACKETIZER ); - set_description( _("MPEG4 video packetizer") ); + set_description( N_("MPEG4 video packetizer") ); set_capability( "packetizer", 50 ); set_callbacks( Open, Close ); vlc_module_end(); @@ -63,7 +67,7 @@ struct decoder_sys_t */ block_bytestream_t bytestream; int i_state; - int i_offset; + size_t i_offset; uint8_t p_startcode[3]; /* @@ -84,7 +88,7 @@ struct decoder_sys_t int i_last_incr; int i_last_incr_diff; - vlc_bool_t b_frame; + bool b_frame; /* Current frame being built */ block_t *p_frame; @@ -156,15 +160,12 @@ static int Open( vlc_object_t *p_this ) /* Allocate the memory needed to store the decoder's structure */ if( ( p_dec->p_sys = p_sys = malloc( sizeof(decoder_sys_t) ) ) == NULL ) - { - msg_Err( p_dec, "out of memory" ); - return VLC_EGENERIC; - } + return VLC_ENOMEM; memset( p_sys, 0, sizeof(decoder_sys_t) ); /* Misc init */ p_sys->i_state = STATE_NOSYNC; - p_sys->bytestream = block_BytestreamInit( p_dec ); + p_sys->bytestream = block_BytestreamInit(); p_sys->p_startcode[0] = 0; p_sys->p_startcode[1] = 0; p_sys->p_startcode[2] = 1; @@ -364,7 +365,7 @@ static block_t *ParseMPEGBlock( decoder_t *p_dec, block_t *p_frag ) if( p_frag->p_buffer[3] >= 0x20 && p_frag->p_buffer[3] <= 0x2f ) { /* Copy the complete VOL */ - if( p_dec->fmt_out.i_extra != p_frag->i_buffer ) + if( (size_t)p_dec->fmt_out.i_extra != p_frag->i_buffer ) { p_dec->fmt_out.p_extra = realloc( p_dec->fmt_out.p_extra, p_frag->i_buffer ); @@ -402,6 +403,7 @@ static block_t *ParseMPEGBlock( decoder_t *p_dec, block_t *p_frag ) { /* We are dealing with a VOP */ p_pic = block_ChainGather( p_sys->p_frame ); + p_pic->i_flags = p_sys->i_flags; p_pic->i_pts = p_sys->i_interpolated_pts; p_pic->i_dts = p_sys->i_interpolated_dts; @@ -527,7 +529,7 @@ static int ParseVOP( decoder_t *p_dec, block_t *p_vop ) break; case 2: p_sys->i_flags = BLOCK_FLAG_TYPE_B; - p_sys->b_frame = VLC_TRUE; + p_sys->b_frame = true; break; case 3: /* gni ? */ p_sys->i_flags = BLOCK_FLAG_TYPE_PB; @@ -566,14 +568,14 @@ static int ParseVOP( decoder_t *p_dec, block_t *p_vop ) p_dec->fmt_in.video.i_frame_rate > 0 && p_dec->fmt_in.video.i_frame_rate_base > 0 ) { - p_sys->i_interpolated_pts += I64C(1000000) * + p_sys->i_interpolated_pts += INT64_C(1000000) * p_dec->fmt_in.video.i_frame_rate_base * p_vop->i_rate / INPUT_RATE_DEFAULT / p_dec->fmt_in.video.i_frame_rate; } else if( p_dec->p_sys->i_fps_num ) p_sys->i_interpolated_pts += - ( I64C(1000000) * (i_time_ref + i_time_increment - + ( INT64_C(1000000) * (i_time_ref + i_time_increment - p_sys->i_last_time - p_sys->i_last_timeincr) * p_vop->i_rate / INPUT_RATE_DEFAULT / p_dec->p_sys->i_fps_num );