SWITCH_CODEC_FLAG_AAL2 = (1 << 6),
SWITCH_CODEC_FLAG_PASSTHROUGH = (1 << 7),
SWITCH_CODEC_FLAG_READY = (1 << 8),
- SWITCH_CODEC_FLAG_HAS_PLC = (1 << 15)
+ SWITCH_CODEC_FLAG_HAS_PLC = (1 << 15),
+ SWITCH_CODEC_FLAG_VIDEO_PATCHING = (1 << 16)
} switch_codec_flag_enum_t;
typedef uint32_t switch_codec_flag_t;
SMBF_WRITE_VIDEO_STREAM = (1 << 20),
SMBF_VIDEO_PATCH = (1 << 21),
SMBF_SPY_VIDEO_STREAM = (1 << 22),
- SMBF_SPY_VIDEO_STREAM_BLEG = (1 << 23)
+ SMBF_SPY_VIDEO_STREAM_BLEG = (1 << 23),
+ SMBF_READ_VIDEO_PATCH = (1 << 24)
} switch_media_bug_flag_enum_t;
typedef uint32_t switch_media_bug_flag_t;
int x, n;
char *argv[25] = { 0 };
int argc;
- switch_media_bug_flag_t flags = SMBF_READ_VIDEO_PING;
+ switch_media_bug_flag_t flags = SMBF_READ_VIDEO_PING | SMBF_READ_VIDEO_PATCH;
const char *function = "mod_cv";
if ((bug = (switch_media_bug_t *) switch_channel_get_private(channel, "_cv_bug_"))) {
char *nested_cascade_path = NULL;
char *lbuf = NULL;
int x, n, i;
- switch_media_bug_flag_t flags = SMBF_READ_VIDEO_PING;
+ switch_media_bug_flag_t flags = SMBF_READ_VIDEO_PING | SMBF_READ_VIDEO_PATCH;
const char *function = "mod_cv";
if (zstr(cmd)) {
switch_io_event_hook_video_read_frame_t *ptr;
uint32_t loops = 0;
switch_media_handle_t *smh;
+ int patchers = 0;
switch_assert(session != NULL);
if (bp->callback && switch_test_flag(bp, SMBF_READ_VIDEO_PING)) {
+ if (switch_test_flag(bp, SMBF_READ_VIDEO_PATCH)) {
+ patchers++;
+ }
+
bp->video_ping_frame = *frame;
+
if (bp->callback(bp, bp->user_data, SWITCH_ABC_TYPE_READ_VIDEO_PING) == SWITCH_FALSE
|| (bp->stop_time && bp->stop_time <= switch_epoch_time_now(NULL))) {
ok = SWITCH_FALSE;
}
}
-
+ if (patchers) {
+ switch_set_flag((*frame)->codec, SWITCH_CODEC_FLAG_VIDEO_PATCHING);
+ } else {
+ switch_clear_flag((*frame)->codec, SWITCH_CODEC_FLAG_VIDEO_PATCHING);
+ }
if (status == SWITCH_STATUS_SUCCESS) {
switch_core_session_video_read_callback(session, *frame);
switch_memory_pool_t *pool;
switch_buffer_t *pbuffer;
switch_time_t start_time;
+ switch_image_t *patch_img;
};
typedef struct vpx_context vpx_context_t;
switch_set_flag(frame, SFF_WAIT_KEY_FRAME);
}
+ if (frame->img && (codec->flags & SWITCH_CODEC_FLAG_VIDEO_PATCHING)) {
+ switch_img_free(&context->patch_img);
+ switch_img_copy(frame->img, &context->patch_img);
+ frame->img = context->patch_img;
+ }
+
return status;
}
vpx_context_t *context = (vpx_context_t *)codec->private_info;
if (context) {
+
+ switch_img_free(&context->patch_img);
+
if ((codec->flags & SWITCH_CODEC_FLAG_ENCODE)) {
vpx_codec_destroy(&context->encoder);
}