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
d201a0f0
Commit
d201a0f0
authored
Jan 01, 2014
by
Nicolas George
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lavd/xv: preliminary support of uncoded frame.
parent
62106fcc
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
6 deletions
+22
-6
xv.c
libavdevice/xv.c
+22
-6
No files found.
libavdevice/xv.c
View file @
d201a0f0
...
...
@@ -36,6 +36,7 @@
#include "libavutil/opt.h"
#include "libavutil/pixdesc.h"
#include "libavutil/imgutils.h"
#include "libavformat/internal.h"
#include "avdevice.h"
typedef
struct
{
...
...
@@ -197,23 +198,19 @@ static int xv_write_header(AVFormatContext *s)
return
ret
;
}
static
int
xv_write_packet
(
AVFormatContext
*
s
,
AVPacket
*
pk
t
)
static
int
write_picture
(
AVFormatContext
*
s
,
AVPicture
*
pic
t
)
{
XVContext
*
xv
=
s
->
priv_data
;
XvImage
*
img
=
xv
->
yuv_image
;
XWindowAttributes
window_attrs
;
AVPicture
pict
;
AVCodecContext
*
ctx
=
s
->
streams
[
0
]
->
codec
;
uint8_t
*
data
[
3
]
=
{
img
->
data
+
img
->
offsets
[
0
],
img
->
data
+
img
->
offsets
[
1
],
img
->
data
+
img
->
offsets
[
2
]
};
avpicture_fill
(
&
pict
,
pkt
->
data
,
ctx
->
pix_fmt
,
ctx
->
width
,
ctx
->
height
);
av_image_copy
(
data
,
img
->
pitches
,
(
const
uint8_t
**
)
pict
.
data
,
pict
.
linesize
,
av_image_copy
(
data
,
img
->
pitches
,
(
const
uint8_t
**
)
pict
->
data
,
pict
->
linesize
,
xv
->
image_format
,
img
->
width
,
img
->
height
);
XGetWindowAttributes
(
xv
->
display
,
xv
->
window
,
&
window_attrs
);
if
(
XvShmPutImage
(
xv
->
display
,
xv
->
xv_port
,
xv
->
window
,
xv
->
gc
,
xv
->
yuv_image
,
0
,
0
,
xv
->
image_width
,
xv
->
image_height
,
0
,
0
,
...
...
@@ -224,6 +221,24 @@ static int xv_write_packet(AVFormatContext *s, AVPacket *pkt)
return
0
;
}
static
int
xv_write_packet
(
AVFormatContext
*
s
,
AVPacket
*
pkt
)
{
AVPicture
pict
;
AVCodecContext
*
ctx
=
s
->
streams
[
0
]
->
codec
;
avpicture_fill
(
&
pict
,
pkt
->
data
,
ctx
->
pix_fmt
,
ctx
->
width
,
ctx
->
height
);
return
write_picture
(
s
,
&
pict
);
}
static
int
xv_write_frame
(
AVFormatContext
*
s
,
int
stream_index
,
AVFrame
**
frame
,
unsigned
flags
)
{
/* xv_write_header() should have accepted only supported formats */
if
((
flags
&
AV_WRITE_UNCODED_FRAME_QUERY
))
return
0
;
return
write_picture
(
s
,
(
AVPicture
*
)
*
frame
);
}
#define OFFSET(x) offsetof(XVContext, x)
static
const
AVOption
options
[]
=
{
{
"display_name"
,
"set display name"
,
OFFSET
(
display_name
),
AV_OPT_TYPE_STRING
,
{.
str
=
NULL
},
0
,
0
,
AV_OPT_FLAG_ENCODING_PARAM
},
...
...
@@ -250,6 +265,7 @@ AVOutputFormat ff_xv_muxer = {
.
video_codec
=
AV_CODEC_ID_RAWVIDEO
,
.
write_header
=
xv_write_header
,
.
write_packet
=
xv_write_packet
,
.
write_uncoded_frame
=
xv_write_frame
,
.
write_trailer
=
xv_write_trailer
,
.
flags
=
AVFMT_NOFILE
|
AVFMT_VARIABLE_FPS
|
AVFMT_NOTIMESTAMPS
,
.
priv_class
=
&
xv_class
,
...
...
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