X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=modules%2Fcodec%2Fquicktime.c;h=ae154fa3c04a46d93b586335652d760544c32e1f;hb=7feb1ed4d07a586f4b4e796421f0ae87843c51d1;hp=976c8c7202dca3f04868620ca86af5816be0fe05;hpb=174f75debc6ff4b0b3a7037bc21e7b77bfe2a9d8;p=vlc diff --git a/modules/codec/quicktime.c b/modules/codec/quicktime.c index 976c8c7202..ae154fa3c0 100644 --- a/modules/codec/quicktime.c +++ b/modules/codec/quicktime.c @@ -33,7 +33,6 @@ #include #include #include -#include #include #if !defined (__APPLE__) && !defined(WIN32) @@ -81,7 +80,9 @@ static int OpenAudio( decoder_t * ); static int OpenVideo( decoder_t * ); static aout_buffer_t *DecodeAudio( decoder_t *, block_t ** ); +#ifndef WIN32 static picture_t *DecodeVideo( decoder_t *, block_t ** ); +#endif #define FCC( a, b , c, d ) \ ((uint32_t)( ((a)<<24)|((b)<<16)|((c)<<8)|(d))) @@ -188,7 +189,7 @@ struct decoder_sys_t /* Output properties */ uint8_t * plane; mtime_t pts; - audio_date_t date; + date_t date; int i_late; /* video */ @@ -215,7 +216,9 @@ static const int pi_channels_maps[6] = }; static int QTAudioInit( decoder_t * ); +#ifndef WIN32 static int QTVideoInit( decoder_t * ); +#endif /***************************************************************************** * Open: probe the decoder and return score @@ -230,7 +233,7 @@ static int Open( vlc_object_t *p_this ) #ifdef __APPLE__ OSErr err; SInt32 qtVersion, macosversion; - + err = Gestalt(gestaltQuickTimeVersion, &qtVersion); err = Gestalt(gestaltSystemVersion, &macosversion); #ifndef NDEBUG @@ -493,7 +496,7 @@ static int OpenAudio( decoder_t *p_dec ) p_dec->fmt_out.audio.i_original_channels = pi_channels_maps[p_sys->OutputFormatInfo.numChannels]; - aout_DateInit( &p_sys->date, p_dec->fmt_out.audio.i_rate ); + date_Init( &p_sys->date, p_dec->fmt_out.audio.i_rate, 1 ); p_sys->i_buffer = 0; p_sys->i_buffer_size = 100*1000; @@ -579,7 +582,7 @@ static aout_buffer_t *DecodeAudio( decoder_t *p_dec, block_t **pp_block ) if( p_sys->i_buffer_size < p_sys->i_buffer + p_block->i_buffer ) { p_sys->i_buffer_size = p_sys->i_buffer + p_block->i_buffer + 1024; - p_sys->p_buffer = realloc( p_sys->p_buffer, p_sys->i_buffer_size ); + p_sys->p_buffer = xrealloc( p_sys->p_buffer, p_sys->i_buffer_size ); } memcpy( &p_sys->p_buffer[p_sys->i_buffer], p_block->p_buffer, p_block->i_buffer ); @@ -615,12 +618,12 @@ static aout_buffer_t *DecodeAudio( decoder_t *p_dec, block_t **pp_block ) p_sys->i_buffer ); } - if( p_sys->pts != 0 && - p_sys->pts != aout_DateGet( &p_sys->date ) ) + if( p_sys->pts > VLC_TS_INVALID && + p_sys->pts != date_Get( &p_sys->date ) ) { - aout_DateSet( &p_sys->date, p_sys->pts ); + date_Set( &p_sys->date, p_sys->pts ); } - else if( !aout_DateGet( &p_sys->date ) ) + else if( !date_Get( &p_sys->date ) ) { return NULL; } @@ -643,12 +646,13 @@ static aout_buffer_t *DecodeAudio( decoder_t *p_dec, block_t **pp_block ) if( p_out ) { - p_out->start_date = aout_DateGet( &p_sys->date ); - p_out->end_date = aout_DateIncrement( &p_sys->date, i_frames ); + p_out->i_pts = date_Get( &p_sys->date ); + p_out->i_length = date_Increment( &p_sys->date, i_frames ) + - p_out->i_pts; memcpy( p_out->p_buffer, &p_sys->out_buffer[2 * p_sys->i_out * p_dec->fmt_out.audio.i_channels], - p_out->i_nb_bytes ); + p_out->i_buffer ); p_sys->i_out += i_frames; } @@ -840,8 +844,9 @@ static int OpenVideo( decoder_t *p_dec ) es_format_Init( &p_dec->fmt_out, VIDEO_ES, VLC_CODEC_YUYV); p_dec->fmt_out.video.i_width = p_dec->fmt_in.video.i_width; p_dec->fmt_out.video.i_height= p_dec->fmt_in.video.i_height; - p_dec->fmt_out.video.i_aspect = VOUT_ASPECT_FACTOR * p_dec->fmt_in.video.i_width / p_dec->fmt_in.video.i_height; - + p_dec->fmt_out.video.i_sar_num = 1; + p_dec->fmt_out.video.i_sar_den = 1; + vlc_mutex_unlock( &qt_mutex ); return VLC_SUCCESS; @@ -851,6 +856,8 @@ exit_error: #endif vlc_mutex_unlock( &qt_mutex ); +#else + VLC_UNUSED( p_dec ); #endif /* !WIN32 */ return VLC_EGENERIC; @@ -891,7 +898,7 @@ static picture_t *DecodeVideo( decoder_t *p_dec, block_t **pp_block ) p_block = *pp_block; *pp_block = NULL; - i_pts = p_block->i_pts ? p_block->i_pts : p_block->i_dts; + i_pts = p_block->i_pts > VLC_TS_INVALID ? p_block->i_pts : p_block->i_dts; mtime_t i_display_date = 0; if( !(p_block->i_flags & BLOCK_FLAG_PREROLL) )