|
|
|
@ -99,6 +99,9 @@ struct media_submit_ctx { |
|
|
|
uint8_t msg_data[4096]; |
|
|
|
uint8_t msg_data[4096]; |
|
|
|
uint32_t msg_data_len; |
|
|
|
uint32_t msg_data_len; |
|
|
|
uint64_t timestamp; |
|
|
|
uint64_t timestamp; |
|
|
|
|
|
|
|
int64_t duration_ms; /* видео: длительность после транскода */ |
|
|
|
|
|
|
|
int width; /* видео: размеры после транскода */ |
|
|
|
|
|
|
|
int height; |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
static void on_media_registered(void* arg, int err, const struct media_index_result* result) { |
|
|
|
static void on_media_registered(void* arg, int err, const struct media_index_result* result) { |
|
|
|
@ -147,6 +150,11 @@ static void on_media_registered(void* arg, int err, const struct media_index_res |
|
|
|
for (int i = 0; i < 64; i++) |
|
|
|
for (int i = 0; i < 64; i++) |
|
|
|
off += snprintf(full_data + off, fdcap - off, "%02x", result->block_sigs[n * 64 + i]); |
|
|
|
off += snprintf(full_data + off, fdcap - off, "%02x", result->block_sigs[n * 64 + i]); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
/* для видео дописываем длительность/размеры в конец (хвост игнорируется старыми парсерами) */ |
|
|
|
|
|
|
|
if (mctx->content_type[0] && strcmp(mctx->content_type, "video/mp4") == 0 && mctx->duration_ms > 0) { |
|
|
|
|
|
|
|
off += snprintf(full_data + off, fdcap - off, "|dur=%lld|w=%d|h=%d", |
|
|
|
|
|
|
|
(long long)mctx->duration_ms, mctx->width, mctx->height); |
|
|
|
|
|
|
|
} |
|
|
|
size_t full_data_len = off; |
|
|
|
size_t full_data_len = off; |
|
|
|
|
|
|
|
|
|
|
|
size_t json_cap = full_data_len + 256; |
|
|
|
size_t json_cap = full_data_len + 256; |
|
|
|
@ -203,6 +211,16 @@ static void on_video_prepared(void* arg, int err) { |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* после транскода знаем итоговую длительность и размеры — для тела сообщения */ |
|
|
|
|
|
|
|
struct video_info vi; |
|
|
|
|
|
|
|
if (video_get_info(mctx->media_dest, &vi) == 0 && vi.is_video) { |
|
|
|
|
|
|
|
mctx->duration_ms = vi.duration_ms; |
|
|
|
|
|
|
|
mctx->width = vi.width; |
|
|
|
|
|
|
|
mctx->height = vi.height; |
|
|
|
|
|
|
|
DEBUG_INFO(DEBUG_CATEGORY_CHAT_SYNC, "%s: video prepared %dx%d dur=%lldms", |
|
|
|
|
|
|
|
CC_ID, vi.width, vi.height, (long long)vi.duration_ms); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
char media_base[1024]; |
|
|
|
char media_base[1024]; |
|
|
|
{ |
|
|
|
{ |
|
|
|
const char* last_slash = strrchr(g_cc.db_path, '/'); |
|
|
|
const char* last_slash = strrchr(g_cc.db_path, '/'); |
|
|
|
|