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
44e065d5
Commit
44e065d5
authored
Jan 12, 2013
by
Rémi Denis-Courmont
Committed by
Diego Biurrun
Jan 13, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
vdpau: Add context and common helpers for hwaccel support
Signed-off-by:
Diego Biurrun
<
diego@biurrun.de
>
parent
22c436c8
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
131 additions
and
7 deletions
+131
-7
Changelog
Changelog
+1
-0
APIchanges
doc/APIchanges
+3
-0
vdpau.c
libavcodec/vdpau.c
+49
-0
vdpau.h
libavcodec/vdpau.h
+63
-6
vdpau_internal.h
libavcodec/vdpau_internal.h
+14
-0
version.h
libavcodec/version.h
+1
-1
No files found.
Changelog
View file @
44e065d5
...
...
@@ -4,6 +4,7 @@ releases are sorted from youngest to oldest.
version 9:
- av_basename and av_dirname
- adobe and limelight publisher authentication in RTMP
- VDPAU hardware acceleration through normal hwaccel
version 9_beta3:
...
...
doc/APIchanges
View file @
44e065d5
...
...
@@ -13,6 +13,9 @@ libavutil: 2012-10-22
API changes, most recent first:
2013-01-13 - xxxxxxx - lavc 54.36.0 - vdpau.h
Add AVVDPAUContext struct for VDPAU hardware-accelerated decoding.
2013-01-12 - 169fb94 - lavu 52.4.0 - pixdesc.h
Add AV_PIX_FMT_VDPAU flag.
...
...
libavcodec/vdpau.c
View file @
44e065d5
...
...
@@ -38,6 +38,55 @@
* @{
*/
int
ff_vdpau_common_start_frame
(
AVCodecContext
*
avctx
,
av_unused
const
uint8_t
*
buffer
,
av_unused
uint32_t
size
)
{
AVVDPAUContext
*
hwctx
=
avctx
->
hwaccel_context
;
hwctx
->
bitstream_buffers_used
=
0
;
return
0
;
}
int
ff_vdpau_common_end_frame
(
AVCodecContext
*
avctx
)
{
MpegEncContext
*
const
s
=
avctx
->
priv_data
;
AVVDPAUContext
*
hwctx
=
avctx
->
hwaccel_context
;
if
(
hwctx
->
bitstream_buffers_used
)
{
VdpVideoSurface
surf
=
ff_vdpau_get_surface_id
(
s
->
current_picture_ptr
);
hwctx
->
render
(
hwctx
->
decoder
,
surf
,
(
void
*
)
&
hwctx
->
info
,
hwctx
->
bitstream_buffers_used
,
hwctx
->
bitstream_buffers
);
ff_draw_horiz_band
(
s
,
0
,
s
->
avctx
->
height
);
hwctx
->
bitstream_buffers_used
=
0
;
}
return
0
;
}
int
ff_vdpau_add_buffer
(
AVCodecContext
*
avctx
,
const
uint8_t
*
buf
,
uint32_t
size
)
{
AVVDPAUContext
*
hwctx
=
avctx
->
hwaccel_context
;
VdpBitstreamBuffer
*
buffers
=
hwctx
->
bitstream_buffers
;
buffers
=
av_fast_realloc
(
buffers
,
&
hwctx
->
bitstream_buffers_allocated
,
(
hwctx
->
bitstream_buffers_used
+
1
)
*
sizeof
(
*
buffers
));
if
(
!
buffers
)
return
AVERROR
(
ENOMEM
);
hwctx
->
bitstream_buffers
=
buffers
;
buffers
+=
hwctx
->
bitstream_buffers_used
++
;
buffers
->
struct_version
=
VDP_BITSTREAM_BUFFER_VERSION
;
buffers
->
bitstream
=
buf
;
buffers
->
bitstream_bytes
=
size
;
return
0
;
}
/* Obsolete non-hwaccel VDPAU support below... */
void
ff_vdpau_h264_set_reference_frames
(
MpegEncContext
*
s
)
{
H264Context
*
h
=
s
->
avctx
->
priv_data
;
...
...
libavcodec/vdpau.h
View file @
44e065d5
...
...
@@ -52,6 +52,68 @@
#include <vdpau/vdpau.h>
#include <vdpau/vdpau_x11.h>
union
VdpPictureInfo
{
VdpPictureInfoH264
h264
;
VdpPictureInfoMPEG1Or2
mpeg
;
VdpPictureInfoVC1
vc1
;
VdpPictureInfoMPEG4Part2
mpeg4
;
};
/**
* This structure is used to share data between the libavcodec library and
* the client video application.
* The user shall zero-allocate the structure and make it available as
* AVCodecContext.hwaccel_context. Members can be set by the user once
* during initialization or through each AVCodecContext.get_buffer()
* function call. In any case, they must be valid prior to calling
* decoding functions.
*/
typedef
struct
AVVDPAUContext
{
/**
* VDPAU decoder handle
*
* Set by user.
*/
VdpDecoder
decoder
;
/**
* VDPAU decoder render callback
*
* Set by the user.
*/
VdpDecoderRender
*
render
;
/**
* VDPAU picture information
*
* Set by libavcodec.
*/
union
VdpPictureInfo
info
;
/**
* Allocated size of the bitstream_buffers table.
*
* Set by libavcodec.
*/
int
bitstream_buffers_allocated
;
/**
* Useful bitstream buffers in the bitstream buffers table.
*
* Set by libavcodec.
*/
int
bitstream_buffers_used
;
/**
* Table of bitstream buffers.
* The user is responsible for freeing this buffer using av_freep().
*
* Set by libavcodec.
*/
VdpBitstreamBuffer
*
bitstream_buffers
;
}
AVVDPAUContext
;
/** @brief The videoSurface is used for rendering. */
#define FF_VDPAU_STATE_USED_FOR_RENDER 1
...
...
@@ -74,12 +136,7 @@ struct vdpau_render_state {
int
state
;
///< Holds FF_VDPAU_STATE_* values.
/** picture parameter information for all supported codecs */
union
VdpPictureInfo
{
VdpPictureInfoH264
h264
;
VdpPictureInfoMPEG1Or2
mpeg
;
VdpPictureInfoVC1
vc1
;
VdpPictureInfoMPEG4Part2
mpeg4
;
}
info
;
union
VdpPictureInfo
info
;
/** Describe size/location of the compressed video data.
Set to 0 when freeing bitstream_buffers. */
...
...
libavcodec/vdpau_internal.h
View file @
44e065d5
...
...
@@ -27,6 +27,20 @@
#include <stdint.h>
#include "mpegvideo.h"
/** Extract VdpVideoSurface from a Picture */
static
inline
uintptr_t
ff_vdpau_get_surface_id
(
Picture
*
pic
)
{
return
(
uintptr_t
)
pic
->
f
.
data
[
3
];
}
int
ff_vdpau_common_start_frame
(
AVCodecContext
*
avctx
,
av_unused
const
uint8_t
*
buffer
,
av_unused
uint32_t
size
);
int
ff_vdpau_common_end_frame
(
AVCodecContext
*
avctx
);
int
ff_vdpau_add_buffer
(
AVCodecContext
*
avctx
,
const
uint8_t
*
buf
,
uint32_t
buf_size
);
void
ff_vdpau_add_data_chunk
(
MpegEncContext
*
s
,
const
uint8_t
*
buf
,
int
buf_size
);
...
...
libavcodec/version.h
View file @
44e065d5
...
...
@@ -27,7 +27,7 @@
*/
#define LIBAVCODEC_VERSION_MAJOR 54
#define LIBAVCODEC_VERSION_MINOR 3
5
#define LIBAVCODEC_VERSION_MINOR 3
6
#define LIBAVCODEC_VERSION_MICRO 0
#define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_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