From af15bd01e97ada62e47f8d27bb667cb567a961f0 Mon Sep 17 00:00:00 2001 From: Dan Dennedy Date: Thu, 21 Apr 2011 14:24:44 -0700 Subject: [PATCH] Fix avformat compile warns on const and 64-bit string formatting. --- src/modules/avformat/consumer_avformat.c | 10 +++---- src/modules/avformat/filter_avcolour_space.c | 11 ++++---- src/modules/avformat/filter_swscale.c | 4 +-- src/modules/avformat/producer_avformat.c | 29 ++++++++++---------- 4 files changed, 28 insertions(+), 26 deletions(-) diff --git a/src/modules/avformat/consumer_avformat.c b/src/modules/avformat/consumer_avformat.c index 986050c3..a348568e 100644 --- a/src/modules/avformat/consumer_avformat.c +++ b/src/modules/avformat/consumer_avformat.c @@ -1392,7 +1392,7 @@ static void *consumer_thread( void *arg ) if ( codec->coded_frame && codec->coded_frame->pts != AV_NOPTS_VALUE ) { pkt.pts = av_rescale_q( codec->coded_frame->pts, codec->time_base, stream->time_base ); - mlt_log_debug( MLT_CONSUMER_SERVICE( consumer ), "audio stream %d pkt pts %lld frame pts %lld", + mlt_log_debug( MLT_CONSUMER_SERVICE( consumer ), "audio stream %d pkt pts %"PRId64" frame pts %"PRId64, stream->index, pkt.pts, codec->coded_frame->pts ); } pkt.flags |= PKT_FLAG_KEY; @@ -1463,7 +1463,7 @@ static void *consumer_thread( void *arg ) #endif struct SwsContext *context = sws_getContext( width, height, PIX_FMT_YUYV422, width, height, video_st->codec->pix_fmt, flags, NULL, NULL, NULL); - sws_scale( context, input->data, input->linesize, 0, height, + sws_scale( context, (const uint8_t* const*) input->data, input->linesize, 0, height, output->data, output->linesize); sws_freeContext( context ); #else @@ -1535,7 +1535,7 @@ static void *consumer_thread( void *arg ) if ( c->coded_frame && c->coded_frame->pts != AV_NOPTS_VALUE ) pkt.pts= av_rescale_q( c->coded_frame->pts, c->time_base, video_st->time_base ); - mlt_log_debug( MLT_CONSUMER_SERVICE( consumer ), "video pkt pts %lld frame pts %lld", pkt.pts, c->coded_frame->pts ); + mlt_log_debug( MLT_CONSUMER_SERVICE( consumer ), "video pkt pts %"PRId64" frame pts %"PRId64, pkt.pts, c->coded_frame->pts ); if( c->coded_frame && c->coded_frame->key_frame ) pkt.flags |= PKT_FLAG_KEY; pkt.stream_index= video_st->index; @@ -1571,9 +1571,9 @@ static void *consumer_thread( void *arg ) } } if ( audio_st[0] ) - mlt_log_debug( MLT_CONSUMER_SERVICE( consumer ), "audio pts %lld (%f) ", audio_st[0]->pts.val, audio_pts ); + mlt_log_debug( MLT_CONSUMER_SERVICE( consumer ), "audio pts %"PRId64" (%f) ", audio_st[0]->pts.val, audio_pts ); if ( video_st ) - mlt_log_debug( MLT_CONSUMER_SERVICE( consumer ), "video pts %lld (%f) ", video_st->pts.val, video_pts ); + mlt_log_debug( MLT_CONSUMER_SERVICE( consumer ), "video pts %"PRId64" (%f) ", video_st->pts.val, video_pts ); mlt_log_debug( MLT_CONSUMER_SERVICE( consumer ), "\n" ); } diff --git a/src/modules/avformat/filter_avcolour_space.c b/src/modules/avformat/filter_avcolour_space.c index 2656e910..37f0db15 100644 --- a/src/modules/avformat/filter_avcolour_space.c +++ b/src/modules/avformat/filter_avcolour_space.c @@ -77,6 +77,7 @@ static void set_luma_transfer( struct SwsContext *context, int colorspace, int u { #if defined(SWSCALE) && (LIBSWSCALE_VERSION_INT >= ((0<<16)+(7<<8)+2)) int *coefficients; + const int *new_coefficients = coefficients; int full_range; int brightness, contrast, saturation; @@ -92,16 +93,16 @@ static void set_luma_transfer( struct SwsContext *context, int colorspace, int u case 470: case 601: case 624: - coefficients = sws_getCoefficients( SWS_CS_ITU601 ); + new_coefficients = sws_getCoefficients( SWS_CS_ITU601 ); break; case 240: - coefficients = sws_getCoefficients( SWS_CS_SMPTE240M ); + new_coefficients = sws_getCoefficients( SWS_CS_SMPTE240M ); break; case 709: - coefficients = sws_getCoefficients( SWS_CS_ITU709 ); + new_coefficients = sws_getCoefficients( SWS_CS_ITU709 ); break; } - sws_setColorspaceDetails( context, coefficients, full_range, coefficients, full_range, + sws_setColorspaceDetails( context, new_coefficients, full_range, new_coefficients, full_range, brightness, contrast, saturation ); } #endif @@ -133,7 +134,7 @@ static void av_convert_image( uint8_t *out, uint8_t *in, int out_fmt, int in_fmt struct SwsContext *context = sws_getContext( width, height, in_fmt, width, height, out_fmt, flags, NULL, NULL, NULL); set_luma_transfer( context, colorspace, use_full_range ); - sws_scale( context, input.data, input.linesize, 0, height, + sws_scale( context, (const uint8_t* const*) input.data, input.linesize, 0, height, output.data, output.linesize); sws_freeContext( context ); #else diff --git a/src/modules/avformat/filter_swscale.c b/src/modules/avformat/filter_swscale.c index 5d5853ba..ac7840f4 100644 --- a/src/modules/avformat/filter_swscale.c +++ b/src/modules/avformat/filter_swscale.c @@ -142,7 +142,7 @@ static int filter_scale( mlt_frame frame, uint8_t **image, mlt_image_format *for if ( context ) { // Perform the scaling - sws_scale( context, input.data, input.linesize, 0, iheight, output.data, output.linesize); + sws_scale( context, (const uint8_t* const*) input.data, input.linesize, 0, iheight, output.data, output.linesize); sws_freeContext( context ); // Now update the frame @@ -167,7 +167,7 @@ static int filter_scale( mlt_frame frame, uint8_t **image, mlt_image_format *for avpicture_fill( &output, outbuf, avformat, owidth, oheight ); // Perform the scaling - sws_scale( context, input.data, input.linesize, 0, iheight, output.data, output.linesize); + sws_scale( context, (const uint8_t* const*) input.data, input.linesize, 0, iheight, output.data, output.linesize); sws_freeContext( context ); // Set it back on the frame diff --git a/src/modules/avformat/producer_avformat.c b/src/modules/avformat/producer_avformat.c index a2756c23..ba85233d 100644 --- a/src/modules/avformat/producer_avformat.c +++ b/src/modules/avformat/producer_avformat.c @@ -868,6 +868,7 @@ static void set_luma_transfer( struct SwsContext *context, int colorspace, int u { #if defined(SWSCALE) && (LIBSWSCALE_VERSION_INT >= ((0<<16)+(7<<8)+2)) int *coefficients; + const int *new_coefficients = coefficients; int full_range; int brightness, contrast, saturation; @@ -883,16 +884,16 @@ static void set_luma_transfer( struct SwsContext *context, int colorspace, int u case 470: case 601: case 624: - coefficients = sws_getCoefficients( SWS_CS_ITU601 ); + new_coefficients = sws_getCoefficients( SWS_CS_ITU601 ); break; case 240: - coefficients = sws_getCoefficients( SWS_CS_SMPTE240M ); + new_coefficients = sws_getCoefficients( SWS_CS_SMPTE240M ); break; case 709: - coefficients = sws_getCoefficients( SWS_CS_ITU709 ); + new_coefficients = sws_getCoefficients( SWS_CS_ITU709 ); break; } - sws_setColorspaceDetails( context, coefficients, full_range, coefficients, full_range, + sws_setColorspaceDetails( context, new_coefficients, full_range, new_coefficients, full_range, brightness, contrast, saturation ); } #endif @@ -920,7 +921,7 @@ static inline void convert_image( AVFrame *frame, uint8_t *buffer, int pix_fmt, AVPicture output; avpicture_fill( &output, buffer, PIX_FMT_RGBA, width, height ); set_luma_transfer( context, colorspace, full_range ); - sws_scale( context, frame->data, frame->linesize, 0, height, + sws_scale( context, (const uint8_t* const*) frame->data, frame->linesize, 0, height, output.data, output.linesize); sws_freeContext( context ); } @@ -936,7 +937,7 @@ static inline void convert_image( AVFrame *frame, uint8_t *buffer, int pix_fmt, output.linesize[1] = width >> 1; output.linesize[2] = width >> 1; set_luma_transfer( context, colorspace, full_range ); - sws_scale( context, frame->data, frame->linesize, 0, height, + sws_scale( context, (const uint8_t* const*) frame->data, frame->linesize, 0, height, output.data, output.linesize); sws_freeContext( context ); } @@ -947,7 +948,7 @@ static inline void convert_image( AVFrame *frame, uint8_t *buffer, int pix_fmt, AVPicture output; avpicture_fill( &output, buffer, PIX_FMT_RGB24, width, height ); set_luma_transfer( context, colorspace, full_range ); - sws_scale( context, frame->data, frame->linesize, 0, height, + sws_scale( context, (const uint8_t* const*) frame->data, frame->linesize, 0, height, output.data, output.linesize); sws_freeContext( context ); } @@ -958,7 +959,7 @@ static inline void convert_image( AVFrame *frame, uint8_t *buffer, int pix_fmt, AVPicture output; avpicture_fill( &output, buffer, PIX_FMT_RGBA, width, height ); set_luma_transfer( context, colorspace, full_range ); - sws_scale( context, frame->data, frame->linesize, 0, height, + sws_scale( context, (const uint8_t* const*) frame->data, frame->linesize, 0, height, output.data, output.linesize); sws_freeContext( context ); } @@ -969,7 +970,7 @@ static inline void convert_image( AVFrame *frame, uint8_t *buffer, int pix_fmt, AVPicture output; avpicture_fill( &output, buffer, PIX_FMT_YUYV422, width, height ); set_luma_transfer( context, colorspace, full_range ); - sws_scale( context, frame->data, frame->linesize, 0, height, + sws_scale( context, (const uint8_t* const*) frame->data, frame->linesize, 0, height, output.data, output.linesize); sws_freeContext( context ); } @@ -1152,7 +1153,7 @@ static int producer_get_image( mlt_frame frame, uint8_t **buffer, mlt_image_form ret = av_read_frame( context, &pkt ); if ( ret >= 0 && ( pkt.flags & PKT_FLAG_KEY ) && pkt.stream_index == self->video_index ) { - mlt_log_verbose( MLT_PRODUCER_SERVICE(producer), "first_pts %lld dts %lld pts_dts_delta %d\n", pkt.pts, pkt.dts, (int)(pkt.pts - pkt.dts) ); + mlt_log_verbose( MLT_PRODUCER_SERVICE(producer), "first_pts %"PRId64" dts %"PRId64" pts_dts_delta %d\n", pkt.pts, pkt.dts, (int)(pkt.pts - pkt.dts) ); self->first_pts = pkt.pts; toscan = 0; } @@ -1168,7 +1169,7 @@ static int producer_get_image( mlt_frame frame, uint8_t **buffer, mlt_image_form { timestamp = ( req_position - 0.1 / source_fps ) / ( av_q2d( stream->time_base ) * source_fps ); - mlt_log_verbose( MLT_PRODUCER_SERVICE(producer), "pos %d pts %lld ", req_position, timestamp ); + mlt_log_verbose( MLT_PRODUCER_SERVICE(producer), "pos %d pts %"PRId64" ", req_position, timestamp ); if ( self->first_pts > 0 ) timestamp += self->first_pts; else if ( context->start_time != AV_NOPTS_VALUE ) @@ -1184,7 +1185,7 @@ static int producer_get_image( mlt_frame frame, uint8_t **buffer, mlt_image_form timestamp -= AV_TIME_BASE; if ( timestamp < 0 ) timestamp = 0; - mlt_log_debug( MLT_PRODUCER_SERVICE(producer), "seeking timestamp %lld position %d expected %d last_pos %d\n", + mlt_log_debug( MLT_PRODUCER_SERVICE(producer), "seeking timestamp %"PRId64" position %d expected %d last_pos %d\n", timestamp, position, self->video_expected, last_position ); // Seek to the timestamp @@ -1299,7 +1300,7 @@ static int producer_get_image( mlt_frame frame, uint8_t **buffer, mlt_image_form { self->invalid_pts_counter = 0; } - mlt_log_debug( MLT_PRODUCER_SERVICE(producer), "pkt.pts %llu req_pos %d cur_pos %d pkt_pos %d\n", + mlt_log_debug( MLT_PRODUCER_SERVICE(producer), "pkt.pts %"PRId64" req_pos %d cur_pos %d pkt_pos %d\n", pkt.pts, req_position, self->current_position, int_position ); } else @@ -1317,7 +1318,7 @@ static int producer_get_image( mlt_frame frame, uint8_t **buffer, mlt_image_form { int_position = req_position; } - mlt_log_debug( MLT_PRODUCER_SERVICE(producer), "pkt.dts %llu req_pos %d cur_pos %d pkt_pos %d\n", + mlt_log_debug( MLT_PRODUCER_SERVICE(producer), "pkt.dts %"PRId64" req_pos %d cur_pos %d pkt_pos %d\n", pkt.dts, req_position, self->current_position, int_position ); // Make a dumb assumption on streams that contain wild timestamps if ( abs( req_position - int_position ) > 999 ) -- 2.39.2