]> git.sesse.net Git - ffmpeg/blobdiff - libavfilter/formats.c
rtpproto: Check for the right feature when reading a sockaddr_in6
[ffmpeg] / libavfilter / formats.c
index 83bdcd7a7af25a7fb604bf8834665ef64c00bf56..1441161daa44f018e86b4c89d43bd9682326528a 100644 (file)
@@ -19,6 +19,7 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
+#include "libavutil/common.h"
 #include "libavutil/pixdesc.h"
 #include "avfilter.h"
 #include "internal.h"
@@ -83,7 +84,7 @@ AVFilterFormats *ff_merge_formats(AVFilterFormats *a, AVFilterFormats *b)
     if (a == b)
         return a;
 
-    MERGE_FORMATS(ret, a, b, formats, format_count, AVFilterFormats, fail);
+    MERGE_FORMATS(ret, a, b, formats, nb_formats, AVFilterFormats, fail);
 
     return ret;
 fail:
@@ -102,9 +103,9 @@ AVFilterFormats *ff_merge_samplerates(AVFilterFormats *a,
 
     if (a == b) return a;
 
-    if (a->format_count && b->format_count) {
-        MERGE_FORMATS(ret, a, b, formats, format_count, AVFilterFormats, fail);
-    } else if (a->format_count) {
+    if (a->nb_formats && b->nb_formats) {
+        MERGE_FORMATS(ret, a, b, formats, nb_formats, AVFilterFormats, fail);
+    } else if (a->nb_formats) {
         MERGE_REF(a, b, formats, AVFilterFormats, fail);
         ret = a;
     } else {
@@ -154,7 +155,7 @@ int ff_fmt_is_in(int fmt, const int *fmts)
 {
     const int *p;
 
-    for (p = fmts; *p != PIX_FMT_NONE; p++) {
+    for (p = fmts; *p != AV_PIX_FMT_NONE; p++) {
         if (fmt == *p)
             return 1;
     }
@@ -172,7 +173,7 @@ AVFilterFormats *ff_make_format_list(const int *fmts)
     formats               = av_mallocz(sizeof(*formats));
     if (count)
         formats->formats  = av_malloc(sizeof(*formats->formats) * count);
-    formats->format_count = count;
+    formats->nb_formats = count;
     memcpy(formats->formats, fmts, sizeof(*formats->formats) * count);
 
     return formats;
@@ -197,7 +198,7 @@ do {                                                        \
 
 int ff_add_format(AVFilterFormats **avff, int fmt)
 {
-    ADD_FORMAT(avff, fmt, int, formats, format_count);
+    ADD_FORMAT(avff, fmt, int, formats, nb_formats);
 }
 
 int ff_add_channel_layout(AVFilterChannelLayouts **l, uint64_t channel_layout)
@@ -209,12 +210,26 @@ AVFilterFormats *ff_all_formats(enum AVMediaType type)
 {
     AVFilterFormats *ret = NULL;
     int fmt;
-    int num_formats = type == AVMEDIA_TYPE_VIDEO ? PIX_FMT_NB    :
+    int num_formats = type == AVMEDIA_TYPE_VIDEO ? AV_PIX_FMT_NB    :
                       type == AVMEDIA_TYPE_AUDIO ? AV_SAMPLE_FMT_NB : 0;
 
-    for (fmt = 0; fmt < num_formats; fmt++)
+    for (fmt = 0; fmt < num_formats; fmt++) {
+        const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(fmt);
         if ((type != AVMEDIA_TYPE_VIDEO) ||
-            (type == AVMEDIA_TYPE_VIDEO && !(av_pix_fmt_descriptors[fmt].flags & PIX_FMT_HWACCEL)))
+            (type == AVMEDIA_TYPE_VIDEO && !(desc->flags & AV_PIX_FMT_FLAG_HWACCEL)))
+            ff_add_format(&ret, fmt);
+    }
+
+    return ret;
+}
+
+AVFilterFormats *ff_planar_sample_fmts(void)
+{
+    AVFilterFormats *ret = NULL;
+    int fmt;
+
+    for (fmt = 0; fmt < AV_SAMPLE_FMT_NB; fmt++)
+        if (av_sample_fmt_is_planar(fmt))
             ff_add_format(&ret, fmt);
 
     return ret;
@@ -318,13 +333,13 @@ void ff_formats_changeref(AVFilterFormats **oldref, AVFilterFormats **newref)
 {                                                                   \
     int count = 0, i;                                               \
                                                                     \
-    for (i = 0; i < ctx->input_count; i++) {                        \
+    for (i = 0; i < ctx->nb_inputs; i++) {                          \
         if (ctx->inputs[i]) {                                       \
             ref(fmts, &ctx->inputs[i]->out_fmts);                   \
             count++;                                                \
         }                                                           \
     }                                                               \
-    for (i = 0; i < ctx->output_count; i++) {                       \
+    for (i = 0; i < ctx->nb_outputs; i++) {                         \
         if (ctx->outputs[i]) {                                      \
             ref(fmts, &ctx->outputs[i]->in_fmts);                   \
             count++;                                                \
@@ -377,43 +392,3 @@ int ff_default_query_formats(AVFilterContext *ctx)
 
     return 0;
 }
-
-#if FF_API_FILTERS_PUBLIC
-int avfilter_default_query_formats(AVFilterContext *ctx)
-{
-    return ff_default_query_formats(ctx);
-}
-void avfilter_set_common_formats(AVFilterContext *ctx, AVFilterFormats *formats)
-{
-    ff_set_common_formats(ctx, formats);
-}
-AVFilterFormats *avfilter_make_format_list(const int *fmts)
-{
-    return ff_make_format_list(fmts);
-}
-int avfilter_add_format(AVFilterFormats **avff, int fmt)
-{
-    return ff_add_format(avff, fmt);
-}
-AVFilterFormats *avfilter_all_formats(enum AVMediaType type)
-{
-    return ff_all_formats(type);
-}
-AVFilterFormats *avfilter_merge_formats(AVFilterFormats *a, AVFilterFormats *b)
-{
-    return ff_merge_formats(a, b);
-}
-void avfilter_formats_ref(AVFilterFormats *f, AVFilterFormats **ref)
-{
-    ff_formats_ref(f, ref);
-}
-void avfilter_formats_unref(AVFilterFormats **ref)
-{
-    ff_formats_unref(ref);
-}
-void avfilter_formats_changeref(AVFilterFormats **oldref,
-                                AVFilterFormats **newref)
-{
-    ff_formats_changeref(oldref, newref);
-}
-#endif