Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
F
ffmpeg
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
ffmpeg
Commits
0c4468dc
Commit
0c4468dc
authored
Apr 21, 2016
by
Vittorio Giovara
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
stereo3d: Add API to get name from value or value from name
Use it in av_dump_format() instead of a huge switch case.
parent
d621b2f7
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
57 additions
and
30 deletions
+57
-30
APIchanges
doc/APIchanges
+3
-0
dump.c
libavformat/dump.c
+2
-29
stereo3d.c
libavutil/stereo3d.c
+33
-0
stereo3d.h
libavutil/stereo3d.h
+18
-0
version.h
libavutil/version.h
+1
-1
No files found.
doc/APIchanges
View file @
0c4468dc
...
@@ -13,6 +13,9 @@ libavutil: 2015-08-28
...
@@ -13,6 +13,9 @@ libavutil: 2015-08-28
API changes, most recent first:
API changes, most recent first:
2016-xx-xx - xxxxxxx - lavu 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-xx-xx - xxxxxxx - lavu 55.11.0 - hwcontext_dxva2.h
Add new installed header with DXVA2-specific hwcontext definitions.
Add new installed header with DXVA2-specific hwcontext definitions.
...
...
libavformat/dump.c
View file @
0c4468dc
...
@@ -233,6 +233,7 @@ static void dump_replaygain(void *ctx, AVPacketSideData *sd)
...
@@ -233,6 +233,7 @@ static void dump_replaygain(void *ctx, AVPacketSideData *sd)
static
void
dump_stereo3d
(
void
*
ctx
,
AVPacketSideData
*
sd
)
static
void
dump_stereo3d
(
void
*
ctx
,
AVPacketSideData
*
sd
)
{
{
AVStereo3D
*
stereo
;
AVStereo3D
*
stereo
;
const
char
*
name
;
if
(
sd
->
size
<
sizeof
(
*
stereo
))
{
if
(
sd
->
size
<
sizeof
(
*
stereo
))
{
av_log
(
ctx
,
AV_LOG_INFO
,
"invalid data"
);
av_log
(
ctx
,
AV_LOG_INFO
,
"invalid data"
);
...
@@ -241,35 +242,7 @@ static void dump_stereo3d(void *ctx, AVPacketSideData *sd)
...
@@ -241,35 +242,7 @@ static void dump_stereo3d(void *ctx, AVPacketSideData *sd)
stereo
=
(
AVStereo3D
*
)
sd
->
data
;
stereo
=
(
AVStereo3D
*
)
sd
->
data
;
switch
(
stereo
->
type
)
{
av_log
(
ctx
,
AV_LOG_INFO
,
"%s"
,
av_stereo3d_type_name
(
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
;
}
if
(
stereo
->
flags
&
AV_STEREO3D_FLAG_INVERT
)
if
(
stereo
->
flags
&
AV_STEREO3D_FLAG_INVERT
)
av_log
(
ctx
,
AV_LOG_INFO
,
" (inverted)"
);
av_log
(
ctx
,
AV_LOG_INFO
,
" (inverted)"
);
...
...
libavutil/stereo3d.c
View file @
0c4468dc
...
@@ -21,6 +21,7 @@
...
@@ -21,6 +21,7 @@
#include <stdint.h>
#include <stdint.h>
#include <string.h>
#include <string.h>
#include "common.h"
#include "mem.h"
#include "mem.h"
#include "stereo3d.h"
#include "stereo3d.h"
...
@@ -41,3 +42,35 @@ AVStereo3D *av_stereo3d_create_side_data(AVFrame *frame)
...
@@ -41,3 +42,35 @@ AVStereo3D *av_stereo3d_create_side_data(AVFrame *frame)
return
(
AVStereo3D
*
)
side_data
->
data
;
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
;
}
libavutil/stereo3d.h
View file @
0c4468dc
...
@@ -149,4 +149,22 @@ AVStereo3D *av_stereo3d_alloc(void);
...
@@ -149,4 +149,22 @@ AVStereo3D *av_stereo3d_alloc(void);
*/
*/
AVStereo3D
*
av_stereo3d_create_side_data
(
AVFrame
*
frame
);
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 */
#endif
/* AVUTIL_STEREO3D_H */
libavutil/version.h
View file @
0c4468dc
...
@@ -54,7 +54,7 @@
...
@@ -54,7 +54,7 @@
*/
*/
#define LIBAVUTIL_VERSION_MAJOR 55
#define LIBAVUTIL_VERSION_MAJOR 55
#define LIBAVUTIL_VERSION_MINOR 1
1
#define LIBAVUTIL_VERSION_MINOR 1
2
#define LIBAVUTIL_VERSION_MICRO 0
#define LIBAVUTIL_VERSION_MICRO 0
#define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \
#define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment