Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/FFmpeg/FFmpeg.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDevin Heitmueller <dheitmueller@ltnglobal.com>2018-06-29 21:57:13 +0300
committerKieran Kunhya <kierank@obe.tv>2018-10-23 17:46:30 +0300
commit4241e44a3c0193d182d3d614e7b4977c00c0225c (patch)
tree6162e908a5b8480a31ebd6f002c4520f529b38be /libavcodec/h264_sei.c
parent92c25963e8b68c47055b813334eaf76599936a90 (diff)
lavc/h264: create AVFrame side data from H.264 timecodes
Create SMPTE ST 12-1 timecodes based on H.264 SEI picture timing info. For framerates > 30 FPS, the field flag is used in conjunction with pairs of frames which contain the same frame timestamp in S12M. Ensure the field is properly set per the spec.
Diffstat (limited to 'libavcodec/h264_sei.c')
-rw-r--r--libavcodec/h264_sei.c37
1 files changed, 20 insertions, 17 deletions
diff --git a/libavcodec/h264_sei.c b/libavcodec/h264_sei.c
index 43593d34d2..275224eabe 100644
--- a/libavcodec/h264_sei.c
+++ b/libavcodec/h264_sei.c
@@ -84,32 +84,35 @@ static int decode_picture_timing(H264SEIPictureTiming *h, GetBitContext *gb,
return AVERROR_INVALIDDATA;
num_clock_ts = sei_num_clock_ts_table[h->pic_struct];
-
for (i = 0; i < num_clock_ts; i++) {
- if (get_bits(gb, 1)) { /* clock_timestamp_flag */
+ if (get_bits(gb, 1)) { /* clock_timestamp_flag */
unsigned int full_timestamp_flag;
-
+ unsigned int counting_type, cnt_dropped_flag;
h->ct_type |= 1 << get_bits(gb, 2);
- skip_bits(gb, 1); /* nuit_field_based_flag */
- skip_bits(gb, 5); /* counting_type */
+ skip_bits(gb, 1); /* nuit_field_based_flag */
+ counting_type = get_bits(gb, 5); /* counting_type */
full_timestamp_flag = get_bits(gb, 1);
- skip_bits(gb, 1); /* discontinuity_flag */
- skip_bits(gb, 1); /* cnt_dropped_flag */
- skip_bits(gb, 8); /* n_frames */
+ skip_bits(gb, 1); /* discontinuity_flag */
+ cnt_dropped_flag = get_bits(gb, 1); /* cnt_dropped_flag */
+ if (cnt_dropped_flag && counting_type > 1 && counting_type < 7)
+ h->tc_dropframe = 1;
+ h->tc_frames = get_bits(gb, 8); /* n_frames */
if (full_timestamp_flag) {
- skip_bits(gb, 6); /* seconds_value 0..59 */
- skip_bits(gb, 6); /* minutes_value 0..59 */
- skip_bits(gb, 5); /* hours_value 0..23 */
+ h->fulltc_received = 1;
+ h->tc_seconds = get_bits(gb, 6); /* seconds_value 0..59 */
+ h->tc_minutes = get_bits(gb, 6); /* minutes_value 0..59 */
+ h->tc_hours = get_bits(gb, 5); /* hours_value 0..23 */
} else {
- if (get_bits(gb, 1)) { /* seconds_flag */
- skip_bits(gb, 6); /* seconds_value range 0..59 */
- if (get_bits(gb, 1)) { /* minutes_flag */
- skip_bits(gb, 6); /* minutes_value 0..59 */
- if (get_bits(gb, 1)) /* hours_flag */
- skip_bits(gb, 5); /* hours_value 0..23 */
+ if (get_bits(gb, 1)) { /* seconds_flag */
+ h->tc_seconds = get_bits(gb, 6);
+ if (get_bits(gb, 1)) { /* minutes_flag */
+ h->tc_minutes = get_bits(gb, 6);
+ if (get_bits(gb, 1)) /* hours_flag */
+ h->tc_minutes = get_bits(gb, 5);
}
}
}
+
if (sps->time_offset_length > 0)
skip_bits(gb,
sps->time_offset_length); /* time_offset */