History

avdevice/decklink_dec: export timecode with s12m side data

Limin Wang committed 6 years ago

Commit a54b3671 parent 448a9aa1 file · +14 −0Browse files

Showing the changes to libavdevice/decklink_dec.cpp (1 of 1 file). Show all

Unified · Split

libavdevice/decklink_dec.cpp+14−0
@@ -42,6 +42,7 @@ extern "C" { · 41 unmodified lines
4242 #include "libavutil/imgutils.h"
4343 #include "libavutil/intreadwrite.h"
4444 #include "libavutil/time.h"
45+#include "libavutil/timecode.h"
4546 #include "libavutil/mathematics.h"
4647 #include "libavutil/reverse.h"
4748 #include "avdevice.h"
@@ -882,6 +883,19 @@ HRESULT decklink_input_callback::VideoInputFrameArrived( · 834 unmodified lines
882883 AVDictionary* metadata_dict = NULL;
883884 int metadata_len;
884885 uint8_t* packed_metadata;
886+ AVTimecode tcr;
887+
888+ if (av_timecode_init_from_string(&tcr, ctx->video_st->r_frame_rate, tc, ctx) >= 0) {
889+ uint32_t tc_data = av_timecode_get_smpte_from_framenum(&tcr, 0);
890+ int size = sizeof(uint32_t) * 4;
891+ uint32_t *sd = (uint32_t *)av_packet_new_side_data(&pkt, AV_PKT_DATA_S12M_TIMECODE, size);
892+
893+ if (sd) {
894+ *sd = 1; // one TC
895+ *(sd + 1) = tc_data; // TC
896+ }
897+ }
898+
885899 if (av_dict_set(&metadata_dict, "timecode", tc, AV_DICT_DONT_STRDUP_VAL) >= 0) {
886900 packed_metadata = av_packet_pack_dictionary(metadata_dict, &metadata_len);
887901 av_dict_free(&metadata_dict);

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t