From de5e2536a4b2a80d16c524e602f23c33c8fef457 Mon Sep 17 00:00:00 2001 From: benoit Date: Mon, 18 Jun 2007 08:08:43 +0000 Subject: [PATCH] replace calls to deprecated parsing functions to calls to new ones patch by Stefano Sabatini: [stefano sabatini-lala poste it] git-svn-id: file:///var/local/repositories/ffmpeg/trunk@9359 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b --- ffmpeg.c | 23 +++++++++++------------ ffplay.c | 2 +- ffserver.c | 2 +- 3 files changed, 13 insertions(+), 14 deletions(-) diff --git a/ffmpeg.c b/ffmpeg.c index 8336ea9f2..09acf8ad2 100644 --- a/ffmpeg.c +++ b/ffmpeg.c @@ -108,8 +108,7 @@ static int frame_bottomBand = 0; static int frame_leftBand = 0; static int frame_rightBand = 0; static int max_frames[4] = {INT_MAX, INT_MAX, INT_MAX, INT_MAX}; -static int frame_rate = 25; -static int frame_rate_base = 1; +static AVRational frame_rate = (AVRational) {25,1}; static float video_qscale = 0; static int video_qdiff = 3; static uint16_t *intra_matrix = NULL; @@ -2067,7 +2066,7 @@ static void opt_verbose(const char *arg) static void opt_frame_rate(const char *arg) { - if (parse_frame_rate(&frame_rate, &frame_rate_base, arg) < 0) { + if (av_parse_video_frame_rate(&frame_rate, arg) < 0) { fprintf(stderr, "Incorrect frame rate\n"); exit(1); } @@ -2147,7 +2146,7 @@ static void opt_frame_crop_right(const char *arg) static void opt_frame_size(const char *arg) { - if (parse_image_size(&frame_width, &frame_height, arg) < 0) { + if (av_parse_video_frame_size(&frame_width, &frame_height, arg) < 0) { fprintf(stderr, "Incorrect frame size\n"); exit(1); } @@ -2531,8 +2530,8 @@ static void opt_input_file(const char *filename) ap->prealloced_context = 1; ap->sample_rate = audio_sample_rate; ap->channels = audio_channels; - ap->time_base.den = frame_rate; - ap->time_base.num = frame_rate_base; + ap->time_base.den = frame_rate.num; + ap->time_base.num = frame_rate.den; ap->width = frame_width + frame_padleft + frame_padright; ap->height = frame_height + frame_padtop + frame_padbottom; ap->pix_fmt = frame_pix_fmt; @@ -2629,8 +2628,8 @@ static void opt_input_file(const char *filename) (float)rfps / rfps_base, rfps, rfps_base); } /* update the current frame rate to match the stream frame rate */ - frame_rate = rfps; - frame_rate_base = rfps_base; + frame_rate.num = rfps; + frame_rate.den = rfps_base; enc->rate_emu = rate_emu; if(video_disable) @@ -2750,11 +2749,11 @@ static void new_video_stream(AVFormatContext *oc) av_set_double(video_enc, opt_names[i], d); } - video_enc->time_base.den = frame_rate; - video_enc->time_base.num = frame_rate_base; + video_enc->time_base.den = frame_rate.num; + video_enc->time_base.num = frame_rate.den; if(codec && codec->supported_framerates){ const AVRational *p= codec->supported_framerates; - AVRational req= (AVRational){frame_rate, frame_rate_base}; + AVRational req= (AVRational){frame_rate.num, frame_rate.den}; const AVRational *best=NULL; AVRational best_error= (AVRational){INT_MAX, 1}; for(; p->den!=0; p++){ @@ -3331,7 +3330,7 @@ static void opt_target(const char *arg) } else { int fr; /* Calculate FR via float to avoid int overflow */ - fr = (int)(frame_rate * 1000.0 / frame_rate_base); + fr = (int)(frame_rate.num * 1000.0 / frame_rate.den); if(fr == 25000) { norm = 0; } else if((fr == 29970) || (fr == 23976)) { diff --git a/ffplay.c b/ffplay.c index 22709f8f7..574ef26d5 100644 --- a/ffplay.c +++ b/ffplay.c @@ -2368,7 +2368,7 @@ static void event_loop(void) static void opt_frame_size(const char *arg) { - if (parse_image_size(&frame_width, &frame_height, arg) < 0) { + if (av_parse_video_frame_size(&frame_width, &frame_height, arg) < 0) { fprintf(stderr, "Incorrect frame size\n"); exit(1); } diff --git a/ffserver.c b/ffserver.c index 7886c202a..98e7e7886 100644 --- a/ffserver.c +++ b/ffserver.c @@ -4160,7 +4160,7 @@ static int parse_ffconfig(const char *filename) } else if (!strcasecmp(cmd, "VideoSize")) { get_arg(arg, sizeof(arg), &p); if (stream) { - parse_image_size(&video_enc.width, &video_enc.height, arg); + av_parse_video_frame_size(&video_enc.width, &video_enc.height, arg); if ((video_enc.width % 16) != 0 || (video_enc.height % 16) != 0) { fprintf(stderr, "%s:%d: Image size must be a multiple of 16\n", -- 2.39.2