[FFmpeg-cvslog] Merge commit '0c4468dc185fa8b9e7d6add914595c5e928b24fd'
Clément Bœsch
git at videolan.org
Thu Jun 23 12:42:54 CEST 2016
ffmpeg | branch: master | Clément Bœsch <clement at stupeflix.com> | Thu Jun 23 12:38:51 2016 +0200| [abb3cc46d595dcb186ae30ec7339a56cd9803f45] | committer: Clément Bœsch
Merge commit '0c4468dc185fa8b9e7d6add914595c5e928b24fd'
* commit '0c4468dc185fa8b9e7d6add914595c5e928b24fd':
stereo3d: Add API to get name from value or value from name
Merged-by: Clément Bœsch <clement at stupeflix.com>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=abb3cc46d595dcb186ae30ec7339a56cd9803f45
---
doc/APIchanges | 3 +++
libavformat/dump.c | 31 ++-----------------------------
libavutil/stereo3d.c | 33 +++++++++++++++++++++++++++++++++
libavutil/stereo3d.h | 18 ++++++++++++++++++
libavutil/version.h | 2 +-
5 files changed, 57 insertions(+), 30 deletions(-)
diff --git a/doc/APIchanges b/doc/APIchanges
index 4b93596..5c7d21a 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -15,6 +15,9 @@ libavutil: 2015-08-28
API changes, most recent first:
+2016-xx-xx - xxxxxxx / 0c4468d - lavu 55.26.100 / 55.12.0 - opt.h
+ Add av_stereo3d_type_name() and av_stereo3d_from_name().
+
2016-06-22 - xxxxxxx - lavu 55.25.100 - hwcontext_dxva2.h
Add new installed header with DXVA2-specific hwcontext definitions.
diff --git a/libavformat/dump.c b/libavformat/dump.c
index bf61fdc..d86792d 100644
--- a/libavformat/dump.c
+++ b/libavformat/dump.c
@@ -252,6 +252,7 @@ static void dump_replaygain(void *ctx, AVPacketSideData *sd)
static void dump_stereo3d(void *ctx, AVPacketSideData *sd)
{
AVStereo3D *stereo;
+ const char *name;
if (sd->size < sizeof(*stereo)) {
av_log(ctx, AV_LOG_INFO, "invalid data");
@@ -260,35 +261,7 @@ static void dump_stereo3d(void *ctx, AVPacketSideData *sd)
stereo = (AVStereo3D *)sd->data;
- switch (stereo->type) {
- case AV_STEREO3D_2D:
- av_log(ctx, AV_LOG_INFO, "2D");
- break;
- case AV_STEREO3D_SIDEBYSIDE:
- av_log(ctx, AV_LOG_INFO, "side by side");
- break;
- case AV_STEREO3D_TOPBOTTOM:
- av_log(ctx, AV_LOG_INFO, "top and bottom");
- break;
- case AV_STEREO3D_FRAMESEQUENCE:
- av_log(ctx, AV_LOG_INFO, "frame alternate");
- break;
- case AV_STEREO3D_CHECKERBOARD:
- av_log(ctx, AV_LOG_INFO, "checkerboard");
- break;
- case AV_STEREO3D_LINES:
- av_log(ctx, AV_LOG_INFO, "interleaved lines");
- break;
- case AV_STEREO3D_COLUMNS:
- av_log(ctx, AV_LOG_INFO, "interleaved columns");
- break;
- case AV_STEREO3D_SIDEBYSIDE_QUINCUNX:
- av_log(ctx, AV_LOG_INFO, "side by side (quincunx subsampling)");
- break;
- default:
- av_log(ctx, AV_LOG_WARNING, "unknown");
- break;
- }
+ av_log(ctx, AV_LOG_INFO, "%s", av_stereo3d_type_name(stereo->type));
if (stereo->flags & AV_STEREO3D_FLAG_INVERT)
av_log(ctx, AV_LOG_INFO, " (inverted)");
diff --git a/libavutil/stereo3d.c b/libavutil/stereo3d.c
index 50cd928..a538364 100644
--- a/libavutil/stereo3d.c
+++ b/libavutil/stereo3d.c
@@ -21,6 +21,7 @@
#include <stdint.h>
#include <string.h>
+#include "common.h"
#include "mem.h"
#include "stereo3d.h"
@@ -41,3 +42,35 @@ AVStereo3D *av_stereo3d_create_side_data(AVFrame *frame)
return (AVStereo3D *)side_data->data;
}
+
+static const char *stereo3d_type_names[] = {
+ [AV_STEREO3D_2D] = "2D",
+ [AV_STEREO3D_SIDEBYSIDE] = "side by side",
+ [AV_STEREO3D_TOPBOTTOM] = "top and bottom",
+ [AV_STEREO3D_FRAMESEQUENCE] = "frame alternate",
+ [AV_STEREO3D_CHECKERBOARD] = "checkerboard",
+ [AV_STEREO3D_SIDEBYSIDE_QUINCUNX] = "side by side (quincunx subsampling)",
+ [AV_STEREO3D_LINES] = "interleaved lines",
+ [AV_STEREO3D_COLUMNS] = "interleaved columns",
+};
+
+const char *av_stereo3d_type_name(unsigned int type)
+{
+ if (type >= FF_ARRAY_ELEMS(stereo3d_type_names))
+ return "unknown";
+
+ return stereo3d_type_names[type];
+}
+
+int av_stereo3d_from_name(const char *name)
+{
+ int i;
+
+ for (i = 0; i < FF_ARRAY_ELEMS(stereo3d_type_names); i++) {
+ size_t len = strlen(stereo3d_type_names[i]);
+ if (!strncmp(stereo3d_type_names[i], name, len))
+ return i;
+ }
+
+ return -1;
+}
diff --git a/libavutil/stereo3d.h b/libavutil/stereo3d.h
index 1135dc9..19c5416 100644
--- a/libavutil/stereo3d.h
+++ b/libavutil/stereo3d.h
@@ -149,4 +149,22 @@ AVStereo3D *av_stereo3d_alloc(void);
*/
AVStereo3D *av_stereo3d_create_side_data(AVFrame *frame);
+/**
+ * Provide a human-readable name of a given stereo3d type.
+ *
+ * @param type The input stereo3d type value.
+ *
+ * @return The name of the stereo3d value, or "unknown".
+ */
+const char *av_stereo3d_type_name(unsigned int type);
+
+/**
+ * Get the AVStereo3DType form a human-readable name.
+ *
+ * @param type The input string.
+ *
+ * @return The AVStereo3DType value, or -1 if not found.
+ */
+int av_stereo3d_from_name(const char *name);
+
#endif /* AVUTIL_STEREO3D_H */
diff --git a/libavutil/version.h b/libavutil/version.h
index 588ab5a..a282fa8 100644
--- a/libavutil/version.h
+++ b/libavutil/version.h
@@ -64,7 +64,7 @@
*/
#define LIBAVUTIL_VERSION_MAJOR 55
-#define LIBAVUTIL_VERSION_MINOR 25
+#define LIBAVUTIL_VERSION_MINOR 26
#define LIBAVUTIL_VERSION_MICRO 100
#define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \
======================================================================
diff --cc doc/APIchanges
index 4b93596,eae92c5..5c7d21a
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@@ -15,14 -13,16 +15,17 @@@ libavutil: 2015-08-2
API changes, most recent first:
-2016-xx-xx - xxxxxxx - lavu 55.12.0 - opt.h
++2016-xx-xx - xxxxxxx / 0c4468d - lavu 55.26.100 / 55.12.0 - opt.h
+ Add av_stereo3d_type_name() and av_stereo3d_from_name().
+
-2016-xx-xx - xxxxxxx - lavu 55.11.0 - hwcontext_dxva2.h
+2016-06-22 - xxxxxxx - lavu 55.25.100 - hwcontext_dxva2.h
Add new installed header with DXVA2-specific hwcontext definitions.
-2016-xx-xx - xxxxxxx - lavu 55.10.0 - opt.h
- Add av_opt_copy().
+2016-04-27 - fb91871 - lavu 55.23.100 - log.h
+ Add a new function av_log_format_line2() which returns number of bytes
+ written to the target buffer.
-2016-xx-xx - xxxxxxx - lavc 57.16.0 - avcodec.h
+2016-04-21 - 7fc329e - lavc 57.37.100 - avcodec.h
Add a new audio/video encoding and decoding API with decoupled input
and output -- avcodec_send_packet(), avcodec_receive_frame(),
avcodec_send_frame() and avcodec_receive_packet().
diff --cc libavutil/version.h
index 588ab5a,4cee2b0..a282fa8
--- a/libavutil/version.h
+++ b/libavutil/version.h
@@@ -63,9 -53,9 +63,9 @@@
* @{
*/
-#define LIBAVUTIL_VERSION_MAJOR 55
-#define LIBAVUTIL_VERSION_MINOR 12
-#define LIBAVUTIL_VERSION_MICRO 0
+#define LIBAVUTIL_VERSION_MAJOR 55
- #define LIBAVUTIL_VERSION_MINOR 25
++#define LIBAVUTIL_VERSION_MINOR 26
+#define LIBAVUTIL_VERSION_MICRO 100
#define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \
LIBAVUTIL_VERSION_MINOR, \
More information about the ffmpeg-cvslog
mailing list