* commit '0c4468dc185fa8b9e7d6add914595c5e928b24fd': stereo3d: Add API to get name from value or value from name
Unified · Split
| @@ -15,6 +15,9 @@ libavutil: 2015-08-28 · 14 unmodified lines | |||
| 15 | 15 | ||
| 16 | API changes, most recent first: | 16 | API changes, most recent first: |
| 17 | 17 | ||
| 18 | 2016-xx-xx - xxxxxxx / 0c4468d - lavu 55.26.100 / 55.12.0 - opt.h | ||
| 19 | Add av_stereo3d_type_name() and av_stereo3d_from_name(). | ||
| 20 | |||
| 18 | 2016-06-22 - xxxxxxx - lavu 55.25.100 - hwcontext_dxva2.h | 21 | 2016-06-22 - xxxxxxx - lavu 55.25.100 - hwcontext_dxva2.h |
| 19 | Add new installed header with DXVA2-specific hwcontext definitions. | 22 | Add new installed header with DXVA2-specific hwcontext definitions. |
| 20 | 23 | ||
| @@ -252,6 +252,7 @@ static void dump_replaygain(void *ctx, AVPacketSideData *sd) · 251 unmodified lines | |||
| 252 | static void dump_stereo3d(void *ctx, AVPacketSideData *sd) | 252 | static void dump_stereo3d(void *ctx, AVPacketSideData *sd) |
| 253 | { | 253 | { |
| 254 | AVStereo3D *stereo; | 254 | AVStereo3D *stereo; |
| 255 | const char *name; | ||
| 255 | 256 | ||
| 256 | if (sd->size < sizeof(*stereo)) { | 257 | if (sd->size < sizeof(*stereo)) { |
| 257 | av_log(ctx, AV_LOG_INFO, "invalid data"); | 258 | av_log(ctx, AV_LOG_INFO, "invalid data"); |
| @@ -260,35 +261,7 @@ static void dump_stereo3d(void *ctx, AVPacketSideData *sd) · 2 unmodified lines | |||
| 260 | 261 | ||
| 261 | stereo = (AVStereo3D *)sd->data; | 262 | stereo = (AVStereo3D *)sd->data; |
| 262 | 263 | ||
| 263 | switch (stereo->type) { | 264 | av_log(ctx, AV_LOG_INFO, "%s", av_stereo3d_type_name(stereo->type)); |
| 264 | case AV_STEREO3D_2D: | ||
| 265 | av_log(ctx, AV_LOG_INFO, "2D"); | ||
| 266 | break; | ||
| 267 | case AV_STEREO3D_SIDEBYSIDE: | ||
| 268 | av_log(ctx, AV_LOG_INFO, "side by side"); | ||
| 269 | break; | ||
| 270 | case AV_STEREO3D_TOPBOTTOM: | ||
| 271 | av_log(ctx, AV_LOG_INFO, "top and bottom"); | ||
| 272 | break; | ||
| 273 | case AV_STEREO3D_FRAMESEQUENCE: | ||
| 274 | av_log(ctx, AV_LOG_INFO, "frame alternate"); | ||
| 275 | break; | ||
| 276 | case AV_STEREO3D_CHECKERBOARD: | ||
| 277 | av_log(ctx, AV_LOG_INFO, "checkerboard"); | ||
| 278 | break; | ||
| 279 | case AV_STEREO3D_LINES: | ||
| 280 | av_log(ctx, AV_LOG_INFO, "interleaved lines"); | ||
| 281 | break; | ||
| 282 | case AV_STEREO3D_COLUMNS: | ||
| 283 | av_log(ctx, AV_LOG_INFO, "interleaved columns"); | ||
| 284 | break; | ||
| 285 | case AV_STEREO3D_SIDEBYSIDE_QUINCUNX: | ||
| 286 | av_log(ctx, AV_LOG_INFO, "side by side (quincunx subsampling)"); | ||
| 287 | break; | ||
| 288 | default: | ||
| 289 | av_log(ctx, AV_LOG_WARNING, "unknown"); | ||
| 290 | break; | ||
| 291 | } | ||
| 292 | 265 | ||
| 293 | if (stereo->flags & AV_STEREO3D_FLAG_INVERT) | 266 | if (stereo->flags & AV_STEREO3D_FLAG_INVERT) |
| 294 | av_log(ctx, AV_LOG_INFO, " (inverted)"); | 267 | av_log(ctx, AV_LOG_INFO, " (inverted)"); |
| @@ -21,6 +21,7 @@ · 20 unmodified lines | |||
| 21 | #include <stdint.h> | 21 | #include <stdint.h> |
| 22 | #include <string.h> | 22 | #include <string.h> |
| 23 | 23 | ||
| 24 | #include "common.h" | ||
| 24 | #include "mem.h" | 25 | #include "mem.h" |
| 25 | #include "stereo3d.h" | 26 | #include "stereo3d.h" |
| 26 | 27 | ||
| @@ -41,3 +42,35 @@ AVStereo3D *av_stereo3d_create_side_data(AVFrame *frame) · 14 unmodified lines | |||
| 41 | 42 | ||
| 42 | return (AVStereo3D *)side_data->data; | 43 | return (AVStereo3D *)side_data->data; |
| 43 | } | 44 | } |
| 45 | |||
| 46 | static const char *stereo3d_type_names[] = { | ||
| 47 | [AV_STEREO3D_2D] = "2D", | ||
| 48 | [AV_STEREO3D_SIDEBYSIDE] = "side by side", | ||
| 49 | [AV_STEREO3D_TOPBOTTOM] = "top and bottom", | ||
| 50 | [AV_STEREO3D_FRAMESEQUENCE] = "frame alternate", | ||
| 51 | [AV_STEREO3D_CHECKERBOARD] = "checkerboard", | ||
| 52 | [AV_STEREO3D_SIDEBYSIDE_QUINCUNX] = "side by side (quincunx subsampling)", | ||
| 53 | [AV_STEREO3D_LINES] = "interleaved lines", | ||
| 54 | [AV_STEREO3D_COLUMNS] = "interleaved columns", | ||
| 55 | }; | ||
| 56 | |||
| 57 | const char *av_stereo3d_type_name(unsigned int type) | ||
| 58 | { | ||
| 59 | if (type >= FF_ARRAY_ELEMS(stereo3d_type_names)) | ||
| 60 | return "unknown"; | ||
| 61 | |||
| 62 | return stereo3d_type_names[type]; | ||
| 63 | } | ||
| 64 | |||
| 65 | int av_stereo3d_from_name(const char *name) | ||
| 66 | { | ||
| 67 | int i; | ||
| 68 | |||
| 69 | for (i = 0; i < FF_ARRAY_ELEMS(stereo3d_type_names); i++) { | ||
| 70 | size_t len = strlen(stereo3d_type_names[i]); | ||
| 71 | if (!strncmp(stereo3d_type_names[i], name, len)) | ||
| 72 | return i; | ||
| 73 | } | ||
| 74 | |||
| 75 | return -1; | ||
| 76 | } | ||
| @@ -149,4 +149,22 @@ AVStereo3D *av_stereo3d_alloc(void); · 148 unmodified lines | |||
| 149 | */ | 149 | */ |
| 150 | AVStereo3D *av_stereo3d_create_side_data(AVFrame *frame); | 150 | AVStereo3D *av_stereo3d_create_side_data(AVFrame *frame); |
| 151 | 151 | ||
| 152 | /** | ||
| 153 | * Provide a human-readable name of a given stereo3d type. | ||
| 154 | * | ||
| 155 | * @param type The input stereo3d type value. | ||
| 156 | * | ||
| 157 | * @return The name of the stereo3d value, or "unknown". | ||
| 158 | */ | ||
| 159 | const char *av_stereo3d_type_name(unsigned int type); | ||
| 160 | |||
| 161 | /** | ||
| 162 | * Get the AVStereo3DType form a human-readable name. | ||
| 163 | * | ||
| 164 | * @param type The input string. | ||
| 165 | * | ||
| 166 | * @return The AVStereo3DType value, or -1 if not found. | ||
| 167 | */ | ||
| 168 | int av_stereo3d_from_name(const char *name); | ||
| 169 | |||
| 152 | #endif /* AVUTIL_STEREO3D_H */ | 170 | #endif /* AVUTIL_STEREO3D_H */ |
| @@ -64,7 +64,7 @@ · 63 unmodified lines | |||
| 64 | */ | 64 | */ |
| 65 | 65 | ||
| 66 | #define LIBAVUTIL_VERSION_MAJOR 55 | 66 | #define LIBAVUTIL_VERSION_MAJOR 55 |
| 67 | #define LIBAVUTIL_VERSION_MINOR 25 | 67 | #define LIBAVUTIL_VERSION_MINOR 26 |
| 68 | #define LIBAVUTIL_VERSION_MICRO 100 | 68 | #define LIBAVUTIL_VERSION_MICRO 100 |
| 69 | 69 | ||
| 70 | #define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \ | 70 | #define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \ |