Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
F
ffmpeg.wasm-core
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
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Linshizhi
ffmpeg.wasm-core
Commits
24cc0a53
Commit
24cc0a53
authored
Oct 25, 2017
by
Mark Thompson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lavc: Add codec metadata to indicate hardware support
parent
2779d33e
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
109 additions
and
2 deletions
+109
-2
APIchanges
doc/APIchanges
+3
-0
avcodec.h
libavcodec/avcodec.h
+74
-0
hwaccel.h
libavcodec/hwaccel.h
+18
-0
utils.c
libavcodec/utils.c
+12
-0
version.h
libavcodec/version.h
+2
-2
No files found.
doc/APIchanges
View file @
24cc0a53
...
...
@@ -15,6 +15,9 @@ libavutil: 2017-10-21
API changes, most recent first:
2017-11-xx - xxxxxxx - lavc 58.4.100 - avcodec.h
Add AVCodecHWConfig and avcodec_get_hw_config().
2017-11-22 - 3650cb2dfa - lavu 55.3.100 - opencl.h
Remove experimental OpenCL API (av_opencl_*).
...
...
libavcodec/avcodec.h
View file @
24cc0a53
...
...
@@ -36,6 +36,7 @@
#include "libavutil/channel_layout.h"
#include "libavutil/dict.h"
#include "libavutil/frame.h"
#include "libavutil/hwcontext.h"
#include "libavutil/log.h"
#include "libavutil/pixfmt.h"
#include "libavutil/rational.h"
...
...
@@ -3279,6 +3280,61 @@ typedef struct AVProfile {
const
char
*
name
;
///< short name for the profile
}
AVProfile
;
enum
{
/**
* The codec supports this format via the hw_device_ctx interface.
*
* When selecting this format, AVCodecContext.hw_device_ctx should
* have been set to a device of the specified type before calling
* avcodec_open2().
*/
AV_CODEC_HW_CONFIG_METHOD_HW_DEVICE_CTX
=
0x01
,
/**
* The codec supports this format via the hw_frames_ctx interface.
*
* When selecting this format for a decoder,
* AVCodecContext.hw_frames_ctx should be set to a suitable frames
* context inside the get_format() callback. The frames context
* must have been created on a device of the specified type.
*/
AV_CODEC_HW_CONFIG_METHOD_HW_FRAMES_CTX
=
0x02
,
/**
* The codec supports this format by some internal method.
*
* This format can be selected without any additional configuration -
* no device or frames context is required.
*/
AV_CODEC_HW_CONFIG_METHOD_INTERNAL
=
0x04
,
/**
* The codec supports this format by some ad-hoc method.
*
* Additional settings and/or function calls are required. See the
* codec-specific documentation for details. (Methods requiring
* this sort of configuration are deprecated and others should be
* used in preference.)
*/
AV_CODEC_HW_CONFIG_METHOD_AD_HOC
=
0x08
,
};
typedef
struct
AVCodecHWConfig
{
/**
* A hardware pixel format which the codec can use.
*/
enum
AVPixelFormat
pix_fmt
;
/**
* Bit set of AV_CODEC_HW_CONFIG_METHOD_* flags, describing the possible
* setup methods which can be used with this configuration.
*/
int
methods
;
/**
* The device type associated with the configuration.
*
* Must be set for AV_CODEC_HW_CONFIG_METHOD_HW_DEVICE_CTX and
* AV_CODEC_HW_CONFIG_METHOD_HW_FRAMES_CTX, otherwise unused.
*/
enum
AVHWDeviceType
device_type
;
}
AVCodecHWConfig
;
typedef
struct
AVCodecDefault
AVCodecDefault
;
struct
AVSubtitle
;
...
...
@@ -3404,6 +3460,15 @@ typedef struct AVCodec {
* packets before decoding.
*/
const
char
*
bsfs
;
/**
* Array of pointers to hardware configurations supported by the codec,
* or NULL if no hardware supported. The array is terminated by a NULL
* pointer.
*
* The user can only access this field via avcodec_get_hw_config().
*/
const
struct
AVCodecHWConfigInternal
**
hw_configs
;
}
AVCodec
;
#if FF_API_CODEC_GET_SET
...
...
@@ -3413,6 +3478,15 @@ int av_codec_get_max_lowres(const AVCodec *codec);
struct
MpegEncContext
;
/**
* Retrieve supported hardware configurations for a codec.
*
* Values of index from zero to some maximum return the indexed configuration
* descriptor; all other values return NULL. If the codec does not support
* any hardware configurations then it will always return NULL.
*/
const
AVCodecHWConfig
*
avcodec_get_hw_config
(
const
AVCodec
*
codec
,
int
index
);
/**
* @defgroup lavc_hwaccel AVHWAccel
* @{
...
...
libavcodec/hwaccel.h
View file @
24cc0a53
...
...
@@ -19,6 +19,24 @@
#ifndef AVCODEC_HWACCEL_H
#define AVCODEC_HWACCEL_H
#include "avcodec.h"
#define HWACCEL_CAP_ASYNC_SAFE (1 << 0)
typedef
struct
AVCodecHWConfigInternal
{
/**
* This is the structure which will be returned to the user by
* avcodec_get_hw_config().
*/
AVCodecHWConfig
public
;
/**
* If this configuration uses a hwaccel, a pointer to it.
* If not, NULL.
*/
const
AVHWAccel
*
hwaccel
;
}
AVCodecHWConfigInternal
;
#endif
/* AVCODEC_HWACCEL_H */
libavcodec/utils.c
View file @
24cc0a53
...
...
@@ -45,6 +45,7 @@
#include "libavutil/thread.h"
#include "avcodec.h"
#include "decode.h"
#include "hwaccel.h"
#include "libavutil/opt.h"
#include "me_cmp.h"
#include "mpegvideo.h"
...
...
@@ -1886,6 +1887,17 @@ int ff_match_2uint16(const uint16_t(*tab)[2], int size, int a, int b)
return
i
;
}
const
AVCodecHWConfig
*
avcodec_get_hw_config
(
const
AVCodec
*
codec
,
int
index
)
{
int
i
;
if
(
!
codec
->
hw_configs
||
index
<
0
)
return
NULL
;
for
(
i
=
0
;
i
<=
index
;
i
++
)
if
(
!
codec
->
hw_configs
[
i
])
return
NULL
;
return
&
codec
->
hw_configs
[
index
]
->
public
;
}
static
AVHWAccel
*
first_hwaccel
=
NULL
;
static
AVHWAccel
**
last_hwaccel
=
&
first_hwaccel
;
...
...
libavcodec/version.h
View file @
24cc0a53
...
...
@@ -28,8 +28,8 @@
#include "libavutil/version.h"
#define LIBAVCODEC_VERSION_MAJOR 58
#define LIBAVCODEC_VERSION_MINOR
3
#define LIBAVCODEC_VERSION_MICRO 10
5
#define LIBAVCODEC_VERSION_MINOR
4
#define LIBAVCODEC_VERSION_MICRO 10
0
#define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
LIBAVCODEC_VERSION_MINOR, \
...
...
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