Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
F
ffmpeg
Project
Project
Details
Activity
Releases
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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Stefan Westerfeld
ffmpeg
Commits
78f787c2
Commit
78f787c2
authored
Jun 15, 2020
by
Limin Wang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avcodec/hevc_sei: support HEVC timecode decode
Signed-off-by:
Limin Wang
<
lance.lmwang@gmail.com
>
parent
acca2aec
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
70 additions
and
0 deletions
+70
-0
hevc_sei.c
libavcodec/hevc_sei.c
+49
-0
hevc_sei.h
libavcodec/hevc_sei.h
+21
-0
No files found.
libavcodec/hevc_sei.c
View file @
78f787c2
...
...
@@ -306,6 +306,53 @@ static int decode_nal_sei_alternative_transfer(HEVCSEIAlternativeTransfer *s, Ge
return
0
;
}
static
int
decode_nal_sei_timecode
(
HEVCSEITimeCode
*
s
,
GetBitContext
*
gb
)
{
s
->
num_clock_ts
=
get_bits
(
gb
,
2
);
for
(
int
i
=
0
;
i
<
s
->
num_clock_ts
;
i
++
)
{
s
->
clock_timestamp_flag
[
i
]
=
get_bits
(
gb
,
1
);
if
(
s
->
clock_timestamp_flag
[
i
])
{
s
->
units_field_based_flag
[
i
]
=
get_bits
(
gb
,
1
);
s
->
counting_type
[
i
]
=
get_bits
(
gb
,
5
);
s
->
full_timestamp_flag
[
i
]
=
get_bits
(
gb
,
1
);
s
->
discontinuity_flag
[
i
]
=
get_bits
(
gb
,
1
);
s
->
cnt_dropped_flag
[
i
]
=
get_bits
(
gb
,
1
);
s
->
n_frames
[
i
]
=
get_bits
(
gb
,
9
);
if
(
s
->
full_timestamp_flag
[
i
])
{
s
->
seconds_value
[
i
]
=
av_clip
(
get_bits
(
gb
,
6
),
0
,
59
);
s
->
minutes_value
[
i
]
=
av_clip
(
get_bits
(
gb
,
6
),
0
,
59
);
s
->
hours_value
[
i
]
=
av_clip
(
get_bits
(
gb
,
5
),
0
,
23
);
}
else
{
s
->
seconds_flag
[
i
]
=
get_bits
(
gb
,
1
);
if
(
s
->
seconds_flag
[
i
])
{
s
->
seconds_value
[
i
]
=
av_clip
(
get_bits
(
gb
,
6
),
0
,
59
);
s
->
minutes_flag
[
i
]
=
get_bits
(
gb
,
1
);
if
(
s
->
minutes_flag
[
i
])
{
s
->
minutes_value
[
i
]
=
av_clip
(
get_bits
(
gb
,
6
),
0
,
59
);
s
->
hours_flag
[
i
]
=
get_bits
(
gb
,
1
);
if
(
s
->
hours_flag
[
i
])
{
s
->
hours_value
[
i
]
=
av_clip
(
get_bits
(
gb
,
5
),
0
,
23
);
}
}
}
}
s
->
time_offset_length
[
i
]
=
get_bits
(
gb
,
5
);
if
(
s
->
time_offset_length
[
i
]
>
0
)
{
s
->
time_offset_value
[
i
]
=
get_bits
(
gb
,
s
->
time_offset_length
[
i
]);
}
}
}
s
->
present
=
1
;
return
0
;
}
static
int
decode_nal_sei_prefix
(
GetBitContext
*
gb
,
void
*
logctx
,
HEVCSEI
*
s
,
const
HEVCParamSets
*
ps
,
int
type
,
int
size
)
{
...
...
@@ -330,6 +377,8 @@ static int decode_nal_sei_prefix(GetBitContext *gb, void *logctx, HEVCSEI *s,
return
decode_nal_sei_user_data_unregistered
(
&
s
->
unregistered
,
gb
,
size
);
case
HEVC_SEI_TYPE_ALTERNATIVE_TRANSFER_CHARACTERISTICS
:
return
decode_nal_sei_alternative_transfer
(
&
s
->
alternative_transfer
,
gb
);
case
HEVC_SEI_TYPE_TIME_CODE
:
return
decode_nal_sei_timecode
(
&
s
->
timecode
,
gb
);
default:
av_log
(
logctx
,
AV_LOG_DEBUG
,
"Skipped PREFIX SEI %d
\n
"
,
type
);
skip_bits_long
(
gb
,
8
*
size
);
...
...
libavcodec/hevc_sei.h
View file @
78f787c2
...
...
@@ -115,6 +115,26 @@ typedef struct HEVCSEIAlternativeTransfer {
int
preferred_transfer_characteristics
;
}
HEVCSEIAlternativeTransfer
;
typedef
struct
HEVCSEITimeCode
{
int
present
;
uint8_t
num_clock_ts
;
uint8_t
clock_timestamp_flag
[
3
];
uint8_t
units_field_based_flag
[
3
];
uint8_t
counting_type
[
3
];
uint8_t
full_timestamp_flag
[
3
];
uint8_t
discontinuity_flag
[
3
];
uint8_t
cnt_dropped_flag
[
3
];
uint16_t
n_frames
[
3
];
uint8_t
seconds_value
[
3
];
uint8_t
minutes_value
[
3
];
uint8_t
hours_value
[
3
];
uint8_t
seconds_flag
[
3
];
uint8_t
minutes_flag
[
3
];
uint8_t
hours_flag
[
3
];
uint8_t
time_offset_length
[
3
];
int32_t
time_offset_value
[
3
];
}
HEVCSEITimeCode
;
typedef
struct
HEVCSEI
{
HEVCSEIPictureHash
picture_hash
;
HEVCSEIFramePacking
frame_packing
;
...
...
@@ -126,6 +146,7 @@ typedef struct HEVCSEI {
HEVCSEIContentLight
content_light
;
int
active_seq_parameter_set_id
;
HEVCSEIAlternativeTransfer
alternative_transfer
;
HEVCSEITimeCode
timecode
;
}
HEVCSEI
;
struct
HEVCParamSets
;
...
...
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