Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-1.1
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc-1.1
Commits
dc3f43d3
Commit
dc3f43d3
authored
Jun 07, 2005
by
Gildas Bazin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
* modules/codec/x264.c: backport of 11329.
parent
338f5aa9
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
36 additions
and
2 deletions
+36
-2
modules/codec/x264.c
modules/codec/x264.c
+36
-2
No files found.
modules/codec/x264.c
View file @
dc3f43d3
...
...
@@ -209,6 +209,8 @@ struct encoder_sys_t
int
i_buffer
;
uint8_t
*
p_buffer
;
mtime_t
i_last_ref_pts
;
};
/*****************************************************************************
...
...
@@ -253,6 +255,7 @@ static int Open ( vlc_object_t *p_this )
p_enc
->
pf_encode_video
=
Encode
;
p_enc
->
pf_encode_audio
=
NULL
;
p_enc
->
p_sys
=
p_sys
=
malloc
(
sizeof
(
encoder_sys_t
)
);
p_sys
->
i_last_ref_pts
=
0
;
x264_param_default
(
&
p_sys
->
param
);
p_sys
->
param
.
i_width
=
p_enc
->
fmt_in
.
video
.
i_width
>>
4
<<
4
;
...
...
@@ -460,6 +463,7 @@ static block_t *Encode( encoder_t *p_enc, picture_t *p_pict )
/* init pic */
memset
(
&
pic
,
0
,
sizeof
(
x264_picture_t
)
);
pic
.
i_pts
=
p_pict
->
date
;
pic
.
img
.
i_csp
=
X264_CSP_I420
;
pic
.
img
.
i_plane
=
p_pict
->
i_planes
;
for
(
i
=
0
;
i
<
p_pict
->
i_planes
;
i
++
)
...
...
@@ -473,6 +477,9 @@ static block_t *Encode( encoder_t *p_enc, picture_t *p_pict )
#else
x264_encoder_encode
(
p_sys
->
h
,
&
nal
,
&
i_nal
,
&
pic
);
#endif
if
(
!
i_nal
)
return
NULL
;
for
(
i
=
0
,
i_out
=
0
;
i
<
i_nal
;
i
++
)
{
int
i_size
=
p_sys
->
i_buffer
-
i_out
;
...
...
@@ -482,8 +489,6 @@ static block_t *Encode( encoder_t *p_enc, picture_t *p_pict )
}
p_block
=
block_New
(
p_enc
,
i_out
);
p_block
->
i_dts
=
p_pict
->
date
;
p_block
->
i_pts
=
p_pict
->
date
;
memcpy
(
p_block
->
p_buffer
,
p_sys
->
p_buffer
,
i_out
);
if
(
pic
.
i_type
==
X264_TYPE_IDR
||
pic
.
i_type
==
X264_TYPE_I
)
...
...
@@ -493,6 +498,35 @@ static block_t *Encode( encoder_t *p_enc, picture_t *p_pict )
else
if
(
pic
.
i_type
==
X264_TYPE_B
)
p_block
->
i_flags
|=
BLOCK_FLAG_TYPE_B
;
/* This isn't really valid for streams with B-frames */
p_block
->
i_length
=
I64C
(
1000000
)
*
p_enc
->
fmt_in
.
video
.
i_frame_rate_base
/
p_enc
->
fmt_in
.
video
.
i_frame_rate
;
p_block
->
i_dts
=
p_block
->
i_pts
=
pic
.
i_pts
;
if
(
p_sys
->
param
.
i_bframe
>
0
)
{
if
(
p_block
->
i_flags
&
BLOCK_FLAG_TYPE_B
)
{
p_block
->
i_dts
=
p_block
->
i_pts
;
}
else
{
if
(
p_sys
->
i_last_ref_pts
)
{
p_block
->
i_dts
=
p_sys
->
i_last_ref_pts
;
}
else
{
/* Let's put something sensible */
p_block
->
i_dts
=
p_block
->
i_pts
;
}
p_sys
->
i_last_ref_pts
=
p_block
->
i_pts
;
}
}
return
p_block
;
}
...
...
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