]> git.sesse.net Git - ffmpeg/blobdiff - libavutil/samplefmt.c
log: fix compilation failure on mingw due to reference to undefined set_color256
[ffmpeg] / libavutil / samplefmt.c
index b6e785cb67af3751b22ed39dc3e68a8841033fbe..ae192ff3d46996d2d37eace3e21608f3b2442f16 100644 (file)
@@ -1,18 +1,18 @@
 /*
- * This file is part of Libav.
+ * This file is part of FFmpeg.
  *
- * Libav is free software; you can redistribute it and/or
+ * 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.
  *
- * Libav is distributed in the hope that it will be useful,
+ * 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 Libav; if not, write to the Free Software
+ * License along with FFmpeg; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -23,7 +23,7 @@
 #include <string.h>
 
 typedef struct SampleFmtInfo {
-    const char *name;
+    char name[8];
     int bits;
     int planar;
     enum AVSampleFormat altform; ///< planar<->packed alternative form
@@ -60,6 +60,15 @@ enum AVSampleFormat av_get_sample_fmt(const char *name)
     return AV_SAMPLE_FMT_NONE;
 }
 
+enum AVSampleFormat av_get_alt_sample_fmt(enum AVSampleFormat sample_fmt, int planar)
+{
+    if (sample_fmt < 0 || sample_fmt >= AV_SAMPLE_FMT_NB)
+        return AV_SAMPLE_FMT_NONE;
+    if (sample_fmt_info[sample_fmt].planar == planar)
+        return sample_fmt;
+    return sample_fmt_info[sample_fmt].altform;
+}
+
 enum AVSampleFormat av_get_packed_sample_fmt(enum AVSampleFormat sample_fmt)
 {
     if (sample_fmt < 0 || sample_fmt >= AV_SAMPLE_FMT_NB)