summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefano Sabatini <stefano.sabatini-lala@poste.it>2010-07-26 23:12:28 +0000
committerStefano Sabatini <stefano.sabatini-lala@poste.it>2010-07-26 23:12:28 +0000
commit126b638ea0c7838fde13850a0ad833170a269253 (patch)
tree7b47bf6060b6b8d8a45d23c49ca3aede2945132e
parentdb9cc3a55a130349667f78f3ad337285c831312b (diff)
Deprecate av_parse_video_frame_size() and av_parse_video_frame_rate()
in favor of the newly added corresponding functions av_parse_video_size() and av_parse_video_rate() defined in libavcore/parseutils.h. This change also adds a linking-time dependency of libavcodec and of libavfilter on libavcore. Originally committed as revision 24518 to svn://svn.ffmpeg.org/ffmpeg/trunk
-rwxr-xr-xconfigure4
-rw-r--r--ffmpeg.c5
-rw-r--r--ffplay.c3
-rw-r--r--ffserver.c5
-rw-r--r--libavcodec/Makefile2
-rw-r--r--libavcodec/avcodec.h22
-rw-r--r--libavcodec/utils.c123
-rw-r--r--libavcore/Makefile4
-rw-r--r--libavcore/avcore.h2
-rw-r--r--libavcore/parseutils.c150
-rw-r--r--libavcore/parseutils.h53
-rw-r--r--libavfilter/Makefile2
-rw-r--r--libavfilter/vf_pad.c6
-rw-r--r--libavformat/utils.c6
14 files changed, 238 insertions, 149 deletions
diff --git a/configure b/configure
index 5d4f90b30d..48d0086f24 100755
--- a/configure
+++ b/configure
@@ -3207,11 +3207,11 @@ EOF
pkgconfig_generate libavutil "FFmpeg utility library" "$LIBAVUTIL_VERSION"
pkgconfig_generate libavcore "FFmpeg multimedia shared core utilities library" "$LIBAVCORE_VERSION" "" "libavutil = $LIBAVUTIL_VERSION"
-pkgconfig_generate libavcodec "FFmpeg codec library" "$LIBAVCODEC_VERSION" "$extralibs" "libavutil = $LIBAVUTIL_VERSION"
+pkgconfig_generate libavcodec "FFmpeg codec library" "$LIBAVCODEC_VERSION" "$extralibs" "libavcore = $LIBAVCORE_VERSION"
pkgconfig_generate libavformat "FFmpeg container format library" "$LIBAVFORMAT_VERSION" "$extralibs" "libavcodec = $LIBAVCODEC_VERSION"
pkgconfig_generate libavdevice "FFmpeg device handling library" "$LIBAVDEVICE_VERSION" "$extralibs" "libavformat = $LIBAVFORMAT_VERSION"
enabled avfilter &&
- pkgconfig_generate libavfilter "FFmpeg video filtering library" "$LIBAVFILTER_VERSION" "$extralibs" "libavutil = $LIBAVUTIL_VERSION"
+ pkgconfig_generate libavfilter "FFmpeg video filtering library" "$LIBAVFILTER_VERSION" "$extralibs" "libavcore = $LIBAVCORE_VERSION"
enabled postproc &&
pkgconfig_generate libpostproc "FFmpeg post processing library" "$LIBPOSTPROC_VERSION"
pkgconfig_generate libswscale "FFmpeg image rescaling library" "$LIBSWSCALE_VERSION" "" "libavutil = $LIBAVUTIL_VERSION"
diff --git a/ffmpeg.c b/ffmpeg.c
index 7400be4231..6f70516f1c 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -36,6 +36,7 @@
#include "libswscale/swscale.h"
#include "libavcodec/opt.h"
#include "libavcodec/audioconvert.h"
+#include "libavcore/parseutils.h"
#include "libavutil/colorspace.h"
#include "libavutil/fifo.h"
#include "libavutil/pixdesc.h"
@@ -2738,7 +2739,7 @@ static int opt_verbose(const char *opt, const char *arg)
static int opt_frame_rate(const char *opt, const char *arg)
{
- if (av_parse_video_frame_rate(&frame_rate, arg) < 0) {
+ if (av_parse_video_rate(&frame_rate, arg) < 0) {
fprintf(stderr, "Incorrect value for %s: %s\n", opt, arg);
ffmpeg_exit(1);
}
@@ -2819,7 +2820,7 @@ static void opt_frame_crop_right(const char *arg)
static void opt_frame_size(const char *arg)
{
- if (av_parse_video_frame_size(&frame_width, &frame_height, arg) < 0) {
+ if (av_parse_video_size(&frame_width, &frame_height, arg) < 0) {
fprintf(stderr, "Incorrect frame size\n");
ffmpeg_exit(1);
}
diff --git a/ffplay.c b/ffplay.c
index 4f254dfc8c..c200119722 100644
--- a/ffplay.c
+++ b/ffplay.c
@@ -26,6 +26,7 @@
#include "libavutil/avstring.h"
#include "libavutil/colorspace.h"
#include "libavutil/pixdesc.h"
+#include "libavcore/parseutils.h"
#include "libavformat/avformat.h"
#include "libavdevice/avdevice.h"
#include "libswscale/swscale.h"
@@ -2949,7 +2950,7 @@ static void event_loop(void)
static void opt_frame_size(const char *arg)
{
- if (av_parse_video_frame_size(&frame_width, &frame_height, arg) < 0) {
+ if (av_parse_video_size(&frame_width, &frame_height, arg) < 0) {
fprintf(stderr, "Incorrect frame size\n");
exit(1);
}
diff --git a/ffserver.c b/ffserver.c
index 8f073fe365..d5d841768d 100644
--- a/ffserver.c
+++ b/ffserver.c
@@ -36,6 +36,7 @@
#include "libavutil/avstring.h"
#include "libavutil/lfg.h"
#include "libavutil/random_seed.h"
+#include "libavcore/parseutils.h"
#include "libavcodec/opt.h"
#include <stdarg.h>
#include <unistd.h>
@@ -4410,7 +4411,7 @@ static int parse_ffconfig(const char *filename)
} else if (!strcasecmp(cmd, "VideoSize")) {
get_arg(arg, sizeof(arg), &p);
if (stream) {
- av_parse_video_frame_size(&video_enc.width, &video_enc.height, arg);
+ av_parse_video_size(&video_enc.width, &video_enc.height, arg);
if ((video_enc.width % 16) != 0 ||
(video_enc.height % 16) != 0) {
ERROR("Image size must be a multiple of 16\n");
@@ -4420,7 +4421,7 @@ static int parse_ffconfig(const char *filename)
get_arg(arg, sizeof(arg), &p);
if (stream) {
AVRational frame_rate;
- if (av_parse_video_frame_rate(&frame_rate, arg) < 0) {
+ if (av_parse_video_rate(&frame_rate, arg) < 0) {
ERROR("Incorrect frame rate: %s\n", arg);
} else {
video_enc.time_base.num = frame_rate.den;
diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index 36a7dc533f..eb22e9d58d 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -1,7 +1,7 @@
include $(SUBDIR)../config.mak
NAME = avcodec
-FFLIBS = avutil
+FFLIBS = avutil avcore
HEADERS = avcodec.h avfft.h dxva2.h opt.h vaapi.h vdpau.h xvmc.h
diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index 14e049d134..196d0cbbc4 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -31,7 +31,7 @@
#define LIBAVCODEC_VERSION_MAJOR 52
#define LIBAVCODEC_VERSION_MINOR 84
-#define LIBAVCODEC_VERSION_MICRO 0
+#define LIBAVCODEC_VERSION_MICRO 1
#define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
LIBAVCODEC_VERSION_MINOR, \
@@ -3964,29 +3964,21 @@ int av_picture_pad(AVPicture *dst, const AVPicture *src, int height, int width,
*/
unsigned int av_xiphlacing(unsigned char *s, unsigned int v);
+#if LIBAVCODEC_VERSION_MAJOR < 53
/**
* Parse str and put in width_ptr and height_ptr the detected values.
*
- * @return 0 in case of a successful parsing, a negative value otherwise
- * @param[in] str the string to parse: it has to be a string in the format
- * width x height or a valid video frame size abbreviation.
- * @param[in,out] width_ptr pointer to the variable which will contain the detected
- * frame width value
- * @param[in,out] height_ptr pointer to the variable which will contain the detected
- * frame height value
+ * @deprecated Deprecated in favor of av_parse_video_size().
*/
-int av_parse_video_frame_size(int *width_ptr, int *height_ptr, const char *str);
+attribute_deprecated int av_parse_video_frame_size(int *width_ptr, int *height_ptr, const char *str);
/**
* Parse str and store the detected values in *frame_rate.
*
- * @return 0 in case of a successful parsing, a negative value otherwise
- * @param[in] str the string to parse: it has to be a string in the format
- * frame_rate_num / frame_rate_den, a float number or a valid video rate abbreviation
- * @param[in,out] frame_rate pointer to the AVRational which will contain the detected
- * frame rate
+ * @deprecated Deprecated in favor of av_parse_video_rate().
*/
-int av_parse_video_frame_rate(AVRational *frame_rate, const char *str);
+attribute_deprecated int av_parse_video_frame_rate(AVRational *frame_rate, const char *str);
+#endif
/**
* Logs a generic warning message about a missing feature. This function is
diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index f21e9eda7b..e01b516751 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -1092,132 +1092,19 @@ unsigned int av_xiphlacing(unsigned char *s, unsigned int v)
return n;
}
-typedef struct {
- const char *abbr;
- int width, height;
-} VideoFrameSizeAbbr;
-
-typedef struct {
- const char *abbr;
- int rate_num, rate_den;
-} VideoFrameRateAbbr;
-
-static const VideoFrameSizeAbbr video_frame_size_abbrs[] = {
- { "ntsc", 720, 480 },
- { "pal", 720, 576 },
- { "qntsc", 352, 240 }, /* VCD compliant NTSC */
- { "qpal", 352, 288 }, /* VCD compliant PAL */
- { "sntsc", 640, 480 }, /* square pixel NTSC */
- { "spal", 768, 576 }, /* square pixel PAL */
- { "film", 352, 240 },
- { "ntsc-film", 352, 240 },
- { "sqcif", 128, 96 },
- { "qcif", 176, 144 },
- { "cif", 352, 288 },
- { "4cif", 704, 576 },
- { "16cif", 1408,1152 },
- { "qqvga", 160, 120 },
- { "qvga", 320, 240 },
- { "vga", 640, 480 },
- { "svga", 800, 600 },
- { "xga", 1024, 768 },
- { "uxga", 1600,1200 },
- { "qxga", 2048,1536 },
- { "sxga", 1280,1024 },
- { "qsxga", 2560,2048 },
- { "hsxga", 5120,4096 },
- { "wvga", 852, 480 },
- { "wxga", 1366, 768 },
- { "wsxga", 1600,1024 },
- { "wuxga", 1920,1200 },
- { "woxga", 2560,1600 },
- { "wqsxga", 3200,2048 },
- { "wquxga", 3840,2400 },
- { "whsxga", 6400,4096 },
- { "whuxga", 7680,4800 },
- { "cga", 320, 200 },
- { "ega", 640, 350 },
- { "hd480", 852, 480 },
- { "hd720", 1280, 720 },
- { "hd1080", 1920,1080 },
-};
-
-static const VideoFrameRateAbbr video_frame_rate_abbrs[]= {
- { "ntsc", 30000, 1001 },
- { "pal", 25, 1 },
- { "qntsc", 30000, 1001 }, /* VCD compliant NTSC */
- { "qpal", 25, 1 }, /* VCD compliant PAL */
- { "sntsc", 30000, 1001 }, /* square pixel NTSC */
- { "spal", 25, 1 }, /* square pixel PAL */
- { "film", 24, 1 },
- { "ntsc-film", 24000, 1001 },
-};
+#if LIBAVCODEC_VERSION_MAJOR < 53
+#include "libavcore/parseutils.h"
int av_parse_video_frame_size(int *width_ptr, int *height_ptr, const char *str)
{
- int i;
- int n = FF_ARRAY_ELEMS(video_frame_size_abbrs);
- char *p;
- int frame_width = 0, frame_height = 0;
-
- for(i=0;i<n;i++) {
- if (!strcmp(video_frame_size_abbrs[i].abbr, str)) {
- frame_width = video_frame_size_abbrs[i].width;
- frame_height = video_frame_size_abbrs[i].height;
- break;
- }
- }
- if (i == n) {
- p = str;
- frame_width = strtol(p, &p, 10);
- if (*p)
- p++;
- frame_height = strtol(p, &p, 10);
- }
- if (frame_width <= 0 || frame_height <= 0)
- return -1;
- *width_ptr = frame_width;
- *height_ptr = frame_height;
- return 0;
+ return av_parse_video_size(width_ptr, height_ptr, str);
}
int av_parse_video_frame_rate(AVRational *frame_rate, const char *arg)
{
- int i;
- int n = FF_ARRAY_ELEMS(video_frame_rate_abbrs);
- char* cp;
-
- /* First, we check our abbreviation table */
- for (i = 0; i < n; ++i)
- if (!strcmp(video_frame_rate_abbrs[i].abbr, arg)) {
- frame_rate->num = video_frame_rate_abbrs[i].rate_num;
- frame_rate->den = video_frame_rate_abbrs[i].rate_den;
- return 0;
- }
-
- /* Then, we try to parse it as fraction */
- cp = strchr(arg, '/');
- if (!cp)
- cp = strchr(arg, ':');
- if (cp) {
- char* cpp;
- frame_rate->num = strtol(arg, &cpp, 10);
- if (cpp != arg || cpp == cp)
- frame_rate->den = strtol(cp+1, &cpp, 10);
- else
- frame_rate->num = 0;
- }
- else {
- /* Finally we give up and parse it as double */
- AVRational time_base = av_d2q(strtod(arg, 0), 1001000);
- frame_rate->den = time_base.den;
- frame_rate->num = time_base.num;
- }
- if (!frame_rate->num || !frame_rate->den)
- return -1;
- else
- return 0;
+ return av_parse_video_rate(frame_rate, arg);
}
+#endif
int ff_match_2uint16(const uint16_t (*tab)[2], int size, int a, int b){
int i;
diff --git a/libavcore/Makefile b/libavcore/Makefile
index c5140c4ecd..f719a72e03 100644
--- a/libavcore/Makefile
+++ b/libavcore/Makefile
@@ -3,7 +3,9 @@ include $(SUBDIR)../config.mak
NAME = avcore
HEADERS = avcore.h \
+ parseutils.h \
-OBJS = utils.o \
+OBJS = parseutils.o \
+ utils.o \
include $(SUBDIR)../subdir.mak
diff --git a/libavcore/avcore.h b/libavcore/avcore.h
index 2c803b9bb5..4b35a603ec 100644
--- a/libavcore/avcore.h
+++ b/libavcore/avcore.h
@@ -27,7 +27,7 @@
#include <libavutil/avutil.h>
#define LIBAVCORE_VERSION_MAJOR 0
-#define LIBAVCORE_VERSION_MINOR 0
+#define LIBAVCORE_VERSION_MINOR 1
#define LIBAVCORE_VERSION_MICRO 0
#define LIBAVCORE_VERSION_INT AV_VERSION_INT(LIBAVCORE_VERSION_MAJOR, \
diff --git a/libavcore/parseutils.c b/libavcore/parseutils.c
new file mode 100644
index 0000000000..1267369b76
--- /dev/null
+++ b/libavcore/parseutils.c
@@ -0,0 +1,150 @@
+/*
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+/**
+ * @file
+ * misc parsing utilities for libavcore
+ */
+
+#include "parseutils.h"
+#include "libavutil/avutil.h"
+
+typedef struct {
+ const char *abbr;
+ int width, height;
+} VideoFrameSizeAbbr;
+
+typedef struct {
+ const char *abbr;
+ int rate_num, rate_den;
+} VideoFrameRateAbbr;
+
+static const VideoFrameSizeAbbr video_frame_size_abbrs[] = {
+ { "ntsc", 720, 480 },
+ { "pal", 720, 576 },
+ { "qntsc", 352, 240 }, /* VCD compliant NTSC */
+ { "qpal", 352, 288 }, /* VCD compliant PAL */
+ { "sntsc", 640, 480 }, /* square pixel NTSC */
+ { "spal", 768, 576 }, /* square pixel PAL */
+ { "film", 352, 240 },
+ { "ntsc-film", 352, 240 },
+ { "sqcif", 128, 96 },
+ { "qcif", 176, 144 },
+ { "cif", 352, 288 },
+ { "4cif", 704, 576 },
+ { "16cif", 1408,1152 },
+ { "qqvga", 160, 120 },
+ { "qvga", 320, 240 },
+ { "vga", 640, 480 },
+ { "svga", 800, 600 },
+ { "xga", 1024, 768 },
+ { "uxga", 1600,1200 },
+ { "qxga", 2048,1536 },
+ { "sxga", 1280,1024 },
+ { "qsxga", 2560,2048 },
+ { "hsxga", 5120,4096 },
+ { "wvga", 852, 480 },
+ { "wxga", 1366, 768 },
+ { "wsxga", 1600,1024 },
+ { "wuxga", 1920,1200 },
+ { "woxga", 2560,1600 },
+ { "wqsxga", 3200,2048 },
+ { "wquxga", 3840,2400 },
+ { "whsxga", 6400,4096 },
+ { "whuxga", 7680,4800 },
+ { "cga", 320, 200 },
+ { "ega", 640, 350 },
+ { "hd480", 852, 480 },
+ { "hd720", 1280, 720 },
+ { "hd1080", 1920,1080 },
+};
+
+static const VideoFrameRateAbbr video_frame_rate_abbrs[]= {
+ { "ntsc", 30000, 1001 },
+ { "pal", 25, 1 },
+ { "qntsc", 30000, 1001 }, /* VCD compliant NTSC */
+ { "qpal", 25, 1 }, /* VCD compliant PAL */
+ { "sntsc", 30000, 1001 }, /* square pixel NTSC */
+ { "spal", 25, 1 }, /* square pixel PAL */
+ { "film", 24, 1 },
+ { "ntsc-film", 24000, 1001 },
+};
+
+int av_parse_video_size(int *width_ptr, int *height_ptr, const char *str)
+{
+ int i;
+ int n = FF_ARRAY_ELEMS(video_frame_size_abbrs);
+ char *p;
+ int frame_width = 0, frame_height = 0;
+
+ for (i = 0; i < n; i++) {
+ if (!strcmp(video_frame_size_abbrs[i].abbr, str)) {
+ frame_width = video_frame_size_abbrs[i].width;
+ frame_height = video_frame_size_abbrs[i].height;
+ break;
+ }
+ }
+ if (i == n) {
+ p = str;
+ frame_width = strtol(p, &p, 10);
+ if (*p)
+ p++;
+ frame_height = strtol(p, &p, 10);
+ }
+ if (frame_width <= 0 || frame_height <= 0)
+ return -1;
+ *width_ptr = frame_width;
+ *height_ptr = frame_height;
+ return 0;
+}
+
+int av_parse_video_rate(AVRational *frame_rate, const char *arg)
+{
+ int i;
+ int n = FF_ARRAY_ELEMS(video_frame_rate_abbrs);
+ char *cp;
+
+ /* First, we check our abbreviation table */
+ for (i = 0; i < n; ++i)
+ if (!strcmp(video_frame_rate_abbrs[i].abbr, arg)) {
+ frame_rate->num = video_frame_rate_abbrs[i].rate_num;
+ frame_rate->den = video_frame_rate_abbrs[i].rate_den;
+ return 0;
+ }
+
+ /* Then, we try to parse it as fraction */
+ cp = strchr(arg, '/');
+ if (!cp)
+ cp = strchr(arg, ':');
+ if (cp) {
+ char *cpp;
+ frame_rate->num = strtol(arg, &cpp, 10);
+ if (cpp != arg || cpp == cp)
+ frame_rate->den = strtol(cp+1, &cpp, 10);
+ else
+ frame_rate->num = 0;
+ } else {
+ /* Finally we give up and parse it as double */
+ AVRational time_base = av_d2q(strtod(arg, 0), 1001000);
+ frame_rate->den = time_base.den;
+ frame_rate->num = time_base.num;
+ }
+ if (frame_rate->num <= 0 || frame_rate->den <= 0)
+ return -1;
+ return 0;
+}
diff --git a/libavcore/parseutils.h b/libavcore/parseutils.h
new file mode 100644
index 0000000000..ceaf09785f
--- /dev/null
+++ b/libavcore/parseutils.h
@@ -0,0 +1,53 @@
+/*
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifndef AVCORE_PARSEUTILS_H
+#define AVCORE_PARSEUTILS_H
+
+#include <libavutil/rational.h>
+
+/**
+ * @file
+ * misc parsing utilities for libavcore
+ */
+
+/**
+ * Parse str and put in width_ptr and height_ptr the detected values.
+ *
+ * @param[in,out] width_ptr pointer to the variable which will contain the detected
+ * frame width value
+ * @param[in,out] height_ptr pointer to the variable which will contain the detected
+ * frame height value
+ * @param[in] str the string to parse: it has to be a string in the format
+ * width x height or a valid video frame size abbreviation.
+ * @return >= 0 on success, a negative error code otherwise
+ */
+int av_parse_video_size(int *width_ptr, int *height_ptr, const char *str);
+
+/**
+ * Parse str and store the detected values in *frame_rate.
+ *
+ * @param[in,out] frame_rate pointer to the AVRational which will contain the detected
+ * frame rate
+ * @param[in] str the string to parse: it has to be a string in the format
+ * frame_rate_num / frame_rate_den, a float number or a valid video rate abbreviation
+ * @return >= 0 on success, a negative error code otherwise
+ */
+int av_parse_video_rate(AVRational *frame_rate, const char *str);
+
+#endif /* AVCORE_PARSEUTILS_H */
diff --git a/libavfilter/Makefile b/libavfilter/Makefile
index c2c1a2124d..33cd2ab6f5 100644
--- a/libavfilter/Makefile
+++ b/libavfilter/Makefile
@@ -1,7 +1,7 @@
include $(SUBDIR)../config.mak
NAME = avfilter
-FFLIBS = avcodec avutil swscale
+FFLIBS = avcodec avcore avutil swscale
FFLIBS-$(CONFIG_AVFILTER_LAVF) += avformat
HEADERS = avfilter.h
diff --git a/libavfilter/vf_pad.c b/libavfilter/vf_pad.c
index 8224c7d776..bfa2dd532a 100644
--- a/libavfilter/vf_pad.c
+++ b/libavfilter/vf_pad.c
@@ -28,7 +28,7 @@
#include "parseutils.h"
#include "libavutil/pixdesc.h"
#include "libavutil/colorspace.h"
-#include "libavcodec/avcodec.h"
+#include "libavcore/parseutils.h"
enum { RED = 0, GREEN, BLUE, ALPHA };
@@ -363,12 +363,12 @@ static av_cold int color_init(AVFilterContext *ctx, const char *args, void *opaq
if (args)
sscanf(args, "%127[^:]:%127[^:]:%127s", color_string, frame_size, frame_rate);
- if (av_parse_video_frame_size(&color->w, &color->h, frame_size) < 0) {
+ if (av_parse_video_size(&color->w, &color->h, frame_size) < 0) {
av_log(ctx, AV_LOG_ERROR, "Invalid frame size: %s\n", frame_size);
return AVERROR(EINVAL);
}
- if (av_parse_video_frame_rate(&frame_rate_q, frame_rate) < 0 ||
+ if (av_parse_video_rate(&frame_rate_q, frame_rate) < 0 ||
frame_rate_q.den <= 0 || frame_rate_q.num <= 0) {
av_log(ctx, AV_LOG_ERROR, "Invalid frame rate: %s\n", frame_rate);
return AVERROR(EINVAL);
diff --git a/libavformat/utils.c b/libavformat/utils.c
index 6fa4dff419..1aa965c59b 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -3182,15 +3182,17 @@ void dump_format(AVFormatContext *ic,
}
#if LIBAVFORMAT_VERSION_MAJOR < 53
+#include "libavcore/parseutils.h"
+
int parse_image_size(int *width_ptr, int *height_ptr, const char *str)
{
- return av_parse_video_frame_size(width_ptr, height_ptr, str);
+ return av_parse_video_size(width_ptr, height_ptr, str);
}
int parse_frame_rate(int *frame_rate_num, int *frame_rate_den, const char *arg)
{
AVRational frame_rate;
- int ret = av_parse_video_frame_rate(&frame_rate, arg);
+ int ret = av_parse_video_rate(&frame_rate, arg);
*frame_rate_num= frame_rate.num;
*frame_rate_den= frame_rate.den;
return ret;