extern "C" {
#include "config.h"
+#include "libavcodec/packet_internal.h"
#include "libavformat/avformat.h"
#include "libavutil/avassert.h"
#include "libavutil/avutil.h"
#include "libavutil/common.h"
+#include "libavutil/internal.h"
#include "libavutil/imgutils.h"
#include "libavutil/intreadwrite.h"
#include "libavutil/time.h"
static void avpacket_queue_flush(AVPacketQueue *q)
{
- AVPacketList *pkt, *pkt1;
+ PacketList *pkt, *pkt1;
pthread_mutex_lock(&q->mutex);
for (pkt = q->first_pkt; pkt != NULL; pkt = pkt1) {
static int avpacket_queue_put(AVPacketQueue *q, AVPacket *pkt)
{
- AVPacketList *pkt1;
+ PacketList *pkt1;
// Drop Packet if queue size is > maximum queue size
if (avpacket_queue_size(q) > (uint64_t)q->max_q_size) {
return -1;
}
- pkt1 = (AVPacketList *)av_malloc(sizeof(AVPacketList));
+ pkt1 = (PacketList *)av_malloc(sizeof(PacketList));
if (!pkt1) {
av_packet_unref(pkt);
return -1;
static int avpacket_queue_get(AVPacketQueue *q, AVPacket *pkt, int block)
{
- AVPacketList *pkt1;
+ PacketList *pkt1;
int ret;
pthread_mutex_lock(&q->mutex);
klv.insert(klv.end(), packet.data.begin(), packet.data.end());
}
- AVPacket klv_packet;
- av_init_packet(&klv_packet);
+ AVPacket klv_packet = { 0 };
klv_packet.pts = pts;
klv_packet.dts = pts;
klv_packet.flags |= AV_PKT_FLAG_KEY;
return pts;
}
-int get_bmd_timecode(AVFormatContext *avctx, AVTimecode *tc, AVRational frame_rate, BMDTimecodeFormat tc_format, IDeckLinkVideoInputFrame *videoFrame)
+static int get_bmd_timecode(AVFormatContext *avctx, AVTimecode *tc, AVRational frame_rate, BMDTimecodeFormat tc_format, IDeckLinkVideoInputFrame *videoFrame)
{
IDeckLinkTimecode *timecode;
int ret = AVERROR(ENOENT);
return ret;
}
-int get_frame_timecode(AVFormatContext *avctx, decklink_ctx *ctx, AVTimecode *tc, IDeckLinkVideoInputFrame *videoFrame)
+static int get_frame_timecode(AVFormatContext *avctx, decklink_ctx *ctx, AVTimecode *tc, IDeckLinkVideoInputFrame *videoFrame)
{
AVRational frame_rate = ctx->video_st->r_frame_rate;
int ret;
// Handle Video Frame
if (videoFrame) {
- AVPacket pkt;
- av_init_packet(&pkt);
+ AVPacket pkt = { 0 };
if (ctx->frameCount % 25 == 0) {
unsigned long long qsize = avpacket_queue_size(&ctx->queue);
av_log(avctx, AV_LOG_DEBUG,
const char *tc = av_timecode_make_string(&tcr, tcstr, 0);
if (tc) {
AVDictionary* metadata_dict = NULL;
- int metadata_len;
uint8_t* packed_metadata;
if (av_cmp_q(ctx->video_st->r_frame_rate, av_make_q(60, 1)) < 1) {
}
if (av_dict_set(&metadata_dict, "timecode", tc, 0) >= 0) {
+ size_t metadata_len;
packed_metadata = av_packet_pack_dictionary(metadata_dict, &metadata_len);
av_dict_free(&metadata_dict);
if (packed_metadata) {
if (!no_video) {
IDeckLinkVideoFrameAncillary *vanc;
- AVPacket txt_pkt;
+ AVPacket txt_pkt = { 0 };
uint8_t txt_buf0[3531]; // 35 * 46 bytes decoded teletext lines + 1 byte data_identifier + 1920 bytes OP47 decode buffer
uint8_t *txt_buf = txt_buf0;
txt_buf[1] = 0x2c; // data_unit_length
txt_buf += 46;
}
- av_init_packet(&txt_pkt);
txt_pkt.pts = pkt.pts;
txt_pkt.dts = pkt.dts;
txt_pkt.stream_index = ctx->teletext_st->index;
// Handle Audio Frame
if (audioFrame) {
- AVPacket pkt;
+ AVPacket pkt = { 0 };
BMDTimeValue audio_pts;
- av_init_packet(&pkt);
//hack among hacks
pkt.size = audioFrame->GetSampleFrameCount() * ctx->audio_st->codecpar->channels * (ctx->audio_depth / 8);
avpacket_queue_get(&ctx->queue, pkt, 1);
if (ctx->tc_format && !(av_dict_get(ctx->video_st->metadata, "timecode", NULL, 0))) {
- int size;
+ size_t size;
const uint8_t *side_metadata = av_packet_get_side_data(pkt, AV_PKT_DATA_STRINGS_METADATA, &size);
if (side_metadata) {
if (av_packet_unpack_dictionary(side_metadata, size, &ctx->video_st->metadata) < 0)