From: Devin Heitmueller <devin.heitmueller@ltnglobal.com> To: ffmpeg-devel@ffmpeg.org Cc: Devin Heitmueller <dheitmueller@ltnglobal.com> Subject: [FFmpeg-devel] [PATCH v2 2/4] decklink: rename AVPacketQueue to DecklinkPacketQueue Date: Fri, 28 Apr 2023 14:40:52 -0400 Message-ID: <1682707254-27604-3-git-send-email-dheitmueller@ltnglobal.com> (raw) In-Reply-To: <1682707254-27604-1-git-send-email-dheitmueller@ltnglobal.com> The threadsafe queue used within the decklink module was named "AVPacketQueue" which implies that it is part of the public API, which it is not. Rename the functions and the name of the queue struct to make clear it is used exclusively by decklink, per Marton Balint's suggestion. Signed-off-by: Devin Heitmueller <dheitmueller@ltnglobal.com> --- libavdevice/decklink_common.cpp | 18 +++++++++--------- libavdevice/decklink_common.h | 18 +++++++++--------- libavdevice/decklink_dec.cpp | 16 ++++++++-------- 3 files changed, 26 insertions(+), 26 deletions(-) diff --git a/libavdevice/decklink_common.cpp b/libavdevice/decklink_common.cpp index 31ab249..74e26e9 100644 --- a/libavdevice/decklink_common.cpp +++ b/libavdevice/decklink_common.cpp @@ -390,17 +390,17 @@ int ff_decklink_set_format(AVFormatContext *avctx, decklink_direction_t directio return ff_decklink_set_format(avctx, 0, 0, 0, 0, AV_FIELD_UNKNOWN, direction); } -void avpacket_queue_init(AVFormatContext *avctx, AVPacketQueue *q) +void ff_decklink_packet_queue_init(AVFormatContext *avctx, DecklinkPacketQueue *q) { struct decklink_cctx *ctx = (struct decklink_cctx *)avctx->priv_data; - memset(q, 0, sizeof(AVPacketQueue)); + memset(q, 0, sizeof(DecklinkPacketQueue)); pthread_mutex_init(&q->mutex, NULL); pthread_cond_init(&q->cond, NULL); q->avctx = avctx; q->max_q_size = ctx->queue_size; } -void avpacket_queue_flush(AVPacketQueue *q) +void ff_decklink_packet_queue_flush(DecklinkPacketQueue *q) { PacketListEntry *pkt, *pkt1; @@ -417,14 +417,14 @@ void avpacket_queue_flush(AVPacketQueue *q) pthread_mutex_unlock(&q->mutex); } -void avpacket_queue_end(AVPacketQueue *q) +void ff_decklink_packet_queue_end(DecklinkPacketQueue *q) { - avpacket_queue_flush(q); + ff_decklink_packet_queue_flush(q); pthread_mutex_destroy(&q->mutex); pthread_cond_destroy(&q->cond); } -unsigned long long avpacket_queue_size(AVPacketQueue *q) +unsigned long long ff_decklink_packet_queue_size(DecklinkPacketQueue *q) { unsigned long long size; pthread_mutex_lock(&q->mutex); @@ -433,12 +433,12 @@ unsigned long long avpacket_queue_size(AVPacketQueue *q) return size; } -int avpacket_queue_put(AVPacketQueue *q, AVPacket *pkt) +int ff_decklink_packet_queue_put(DecklinkPacketQueue *q, AVPacket *pkt) { PacketListEntry *pkt1; // Drop Packet if queue size is > maximum queue size - if (avpacket_queue_size(q) > (uint64_t)q->max_q_size) { + if (ff_decklink_packet_queue_size(q) > (uint64_t)q->max_q_size) { av_packet_unref(pkt); av_log(q->avctx, AV_LOG_WARNING, "Decklink input buffer overrun!\n"); return -1; @@ -475,7 +475,7 @@ int avpacket_queue_put(AVPacketQueue *q, AVPacket *pkt) return 0; } -int avpacket_queue_get(AVPacketQueue *q, AVPacket *pkt, int block) +int ff_decklink_packet_queue_get(DecklinkPacketQueue *q, AVPacket *pkt, int block) { int ret; diff --git a/libavdevice/decklink_common.h b/libavdevice/decklink_common.h index 56cc759..1cc6d9c 100644 --- a/libavdevice/decklink_common.h +++ b/libavdevice/decklink_common.h @@ -78,7 +78,7 @@ static char *dup_cfstring_to_utf8(CFStringRef w) class decklink_output_callback; class decklink_input_callback; -typedef struct AVPacketQueue { +typedef struct DecklinkPacketQueue { PacketList pkt_list; int nb_packets; unsigned long long size; @@ -87,7 +87,7 @@ typedef struct AVPacketQueue { pthread_cond_t cond; AVFormatContext *avctx; int64_t max_q_size; -} AVPacketQueue; +} DecklinkPacketQueue; struct decklink_ctx { /* DeckLink SDK interfaces */ @@ -111,7 +111,7 @@ struct decklink_ctx { int supports_vanc; /* Capture buffer queue */ - AVPacketQueue queue; + DecklinkPacketQueue queue; AVCCFifo *cc_fifo; ///< closed captions @@ -235,11 +235,11 @@ int ff_decklink_list_formats(AVFormatContext *avctx, decklink_direction_t direct void ff_decklink_cleanup(AVFormatContext *avctx); int ff_decklink_init_device(AVFormatContext *avctx, const char* name); -void avpacket_queue_init(AVFormatContext *avctx, AVPacketQueue *q); -void avpacket_queue_flush(AVPacketQueue *q); -void avpacket_queue_end(AVPacketQueue *q); -unsigned long long avpacket_queue_size(AVPacketQueue *q); -int avpacket_queue_put(AVPacketQueue *q, AVPacket *pkt); -int avpacket_queue_get(AVPacketQueue *q, AVPacket *pkt, int block); +void ff_decklink_packet_queue_init(AVFormatContext *avctx, DecklinkPacketQueue *q); +void ff_decklink_packet_queue_flush(DecklinkPacketQueue *q); +void ff_decklink_packet_queue_end(DecklinkPacketQueue *q); +unsigned long long ff_decklink_packet_queue_size(DecklinkPacketQueue *q); +int ff_decklink_packet_queue_put(DecklinkPacketQueue *q, AVPacket *pkt); +int ff_decklink_packet_queue_get(DecklinkPacketQueue *q, AVPacket *pkt, int block); #endif /* AVDEVICE_DECKLINK_COMMON_H */ diff --git a/libavdevice/decklink_dec.cpp b/libavdevice/decklink_dec.cpp index b3ff2b0..66abee1 100644 --- a/libavdevice/decklink_dec.cpp +++ b/libavdevice/decklink_dec.cpp @@ -568,7 +568,7 @@ static void handle_klv(AVFormatContext *avctx, decklink_ctx *ctx, IDeckLinkVideo klv_packet.data = klv.data(); klv_packet.size = klv.size(); - if (avpacket_queue_put(&ctx->queue, &klv_packet) < 0) { + if (ff_decklink_packet_queue_put(&ctx->queue, &klv_packet) < 0) { ++ctx->dropped; } } @@ -760,7 +760,7 @@ HRESULT decklink_input_callback::VideoInputFrameArrived( if (videoFrame) { AVPacket pkt = { 0 }; if (ctx->frameCount % 25 == 0) { - unsigned long long qsize = avpacket_queue_size(&ctx->queue); + unsigned long long qsize = ff_decklink_packet_queue_size(&ctx->queue); av_log(avctx, AV_LOG_DEBUG, "Frame received (#%lu) - Valid (%liB) - QSize %fMB\n", ctx->frameCount, @@ -924,7 +924,7 @@ HRESULT decklink_input_callback::VideoInputFrameArrived( txt_pkt.stream_index = ctx->teletext_st->index; txt_pkt.data = txt_buf0; txt_pkt.size = txt_buf - txt_buf0; - if (avpacket_queue_put(&ctx->queue, &txt_pkt) < 0) { + if (ff_decklink_packet_queue_put(&ctx->queue, &txt_pkt) < 0) { ++ctx->dropped; } } @@ -935,7 +935,7 @@ HRESULT decklink_input_callback::VideoInputFrameArrived( if (pkt.buf) videoFrame->AddRef(); - if (avpacket_queue_put(&ctx->queue, &pkt) < 0) { + if (ff_decklink_packet_queue_put(&ctx->queue, &pkt) < 0) { ++ctx->dropped; } } @@ -957,7 +957,7 @@ HRESULT decklink_input_callback::VideoInputFrameArrived( pkt.stream_index = ctx->audio_st->index; pkt.data = (uint8_t *)audioFrameBytes; - if (avpacket_queue_put(&ctx->queue, &pkt) < 0) { + if (ff_decklink_packet_queue_put(&ctx->queue, &pkt) < 0) { ++ctx->dropped; } } @@ -1039,7 +1039,7 @@ av_cold int ff_decklink_read_close(AVFormatContext *avctx) } ff_decklink_cleanup(avctx); - avpacket_queue_end(&ctx->queue); + ff_decklink_packet_queue_end(&ctx->queue); av_freep(&cctx->ctx); @@ -1297,7 +1297,7 @@ av_cold int ff_decklink_read_header(AVFormatContext *avctx) goto error; } - avpacket_queue_init (avctx, &ctx->queue); + ff_decklink_packet_queue_init(avctx, &ctx->queue); if (ctx->dli->StartStreams() != S_OK) { av_log(avctx, AV_LOG_ERROR, "Cannot start input stream\n"); @@ -1317,7 +1317,7 @@ int ff_decklink_read_packet(AVFormatContext *avctx, AVPacket *pkt) struct decklink_cctx *cctx = (struct decklink_cctx *)avctx->priv_data; struct decklink_ctx *ctx = (struct decklink_ctx *)cctx->ctx; - avpacket_queue_get(&ctx->queue, pkt, 1); + ff_decklink_packet_queue_get(&ctx->queue, pkt, 1); if (ctx->tc_format && !(av_dict_get(ctx->video_st->metadata, "timecode", NULL, 0))) { size_t size; -- 1.8.3.1 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
next prev parent reply other threads:[~2023-04-28 17:45 UTC|newest] Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top 2023-04-28 18:40 [FFmpeg-devel] [PATCH v2 0/4] Implement SMPTE 2038 output support over Decklink SDI Devin Heitmueller 2023-04-28 18:40 ` [FFmpeg-devel] [PATCH v2 1/4] decklink: Move AVPacketQueue into decklink_common Devin Heitmueller 2023-04-28 18:40 ` Devin Heitmueller [this message] 2023-04-28 18:40 ` [FFmpeg-devel] [PATCH v2 3/4] decklink: Convert to using avpriv_packet_list functions Devin Heitmueller 2023-05-11 21:34 ` Marton Balint 2023-04-28 18:40 ` [FFmpeg-devel] [PATCH v2 4/4] decklink_enc: add support for SMPTE 2038 VANC packet output Devin Heitmueller 2023-06-06 18:56 ` Devin Heitmueller 2023-06-22 11:54 ` Devin Heitmueller 2023-06-26 7:07 ` Marton Balint 2023-05-11 14:36 ` [FFmpeg-devel] [PATCH v2 0/4] Implement SMPTE 2038 output support over Decklink SDI Devin Heitmueller 2023-05-11 21:18 ` Marton Balint 2023-05-11 21:26 ` Devin Heitmueller
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=1682707254-27604-3-git-send-email-dheitmueller@ltnglobal.com \ --to=devin.heitmueller@ltnglobal.com \ --cc=dheitmueller@ltnglobal.com \ --cc=ffmpeg-devel@ffmpeg.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel This inbox may be cloned and mirrored by anyone: git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git # If you have public-inbox 1.1+ installed, you may # initialize and index your mirror using the following commands: public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \ ffmpegdev@gitmailbox.com public-inbox-index ffmpegdev Example config snippet for mirrors. AGPL code for this site: git clone https://public-inbox.org/public-inbox.git