mirror of https://git.ffmpeg.org/ffmpeg.git
avdevice/decklink_dec: do not copy video data
Create a buffer from the data instead and use the buffer destructor to free the DeckLink frame. This avoids a memcpy of the frame data. Signed-off-by: Marton Balint <cus@passwd.hu>
This commit is contained in:
parent
7033654f7f
commit
75d1529c6e
|
@ -98,6 +98,14 @@ static VANCLineNumber vanc_line_numbers[] = {
|
||||||
{bmdModeUnknown, 0, -1, -1, -1}
|
{bmdModeUnknown, 0, -1, -1, -1}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
extern "C" {
|
||||||
|
static void decklink_object_free(void *opaque, uint8_t *data)
|
||||||
|
{
|
||||||
|
IUnknown *obj = (class IUnknown *)opaque;
|
||||||
|
obj->Release();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static int get_vanc_line_idx(BMDDisplayMode mode)
|
static int get_vanc_line_idx(BMDDisplayMode mode)
|
||||||
{
|
{
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
@ -797,6 +805,10 @@ HRESULT decklink_input_callback::VideoInputFrameArrived(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pkt.buf = av_buffer_create(pkt.data, pkt.size, decklink_object_free, videoFrame, 0);
|
||||||
|
if (pkt.buf)
|
||||||
|
videoFrame->AddRef();
|
||||||
|
|
||||||
if (avpacket_queue_put(&ctx->queue, &pkt) < 0) {
|
if (avpacket_queue_put(&ctx->queue, &pkt) < 0) {
|
||||||
++ctx->dropped;
|
++ctx->dropped;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue