mirror of
https://github.com/zotanmew/nginx-rtmp-module.git
synced 2024-05-19 09:41:07 +02:00
fixed windows compilation
This commit is contained in:
parent
29dfda882a
commit
fcbd18c7f7
|
@ -219,7 +219,7 @@ ngx_rtmp_dash_write_playlist(ngx_rtmp_session_t *s)
|
|||
u_char *p, *last;
|
||||
ssize_t n;
|
||||
ngx_fd_t fd;
|
||||
ngx_tm_t tm;
|
||||
struct tm tm;
|
||||
ngx_str_t playlist, playlist_bak, noname, *name;
|
||||
ngx_uint_t i;
|
||||
ngx_rtmp_dash_ctx_t *ctx;
|
||||
|
@ -336,26 +336,26 @@ ngx_rtmp_dash_write_playlist(ngx_rtmp_session_t *s)
|
|||
" </Period>\n" \
|
||||
"</MPD>\n"
|
||||
|
||||
ngx_localtime(ctx->start_time.sec +
|
||||
ngx_rtmp_dash_get_frag(s, 0)->timestamp / 1000, &tm);
|
||||
ngx_libc_localtime(ctx->start_time.sec +
|
||||
ngx_rtmp_dash_get_frag(s, 0)->timestamp / 1000, &tm);
|
||||
|
||||
*ngx_sprintf(start_time, "%4d-%02d-%02dT%02d:%02d:%02d%c%02d:%02d",
|
||||
tm.ngx_tm_year, tm.ngx_tm_mon,
|
||||
tm.ngx_tm_mday, tm.ngx_tm_hour,
|
||||
tm.ngx_tm_min, tm.ngx_tm_sec,
|
||||
tm.tm_year, tm.tm_mon,
|
||||
tm.tm_mday, tm.tm_hour,
|
||||
tm.tm_min, tm.tm_sec,
|
||||
ctx->start_time.gmtoff < 0 ? '-' : '+',
|
||||
ngx_abs(ctx->start_time.gmtoff / 60),
|
||||
ngx_abs(ctx->start_time.gmtoff % 60)) = 0;
|
||||
|
||||
ngx_localtime(ctx->start_time.sec +
|
||||
(ngx_rtmp_dash_get_frag(s, ctx->nfrags - 1)->timestamp +
|
||||
ngx_rtmp_dash_get_frag(s, ctx->nfrags - 1)->duration) / 1000,
|
||||
&tm);
|
||||
ngx_libc_localtime(ctx->start_time.sec +
|
||||
(ngx_rtmp_dash_get_frag(s, ctx->nfrags - 1)->timestamp +
|
||||
ngx_rtmp_dash_get_frag(s, ctx->nfrags - 1)->duration) /
|
||||
1000, &tm);
|
||||
|
||||
*ngx_sprintf(end_time, "%4d-%02d-%02dT%02d:%02d:%02d%c%02d:%02d",
|
||||
tm.ngx_tm_year, tm.ngx_tm_mon,
|
||||
tm.ngx_tm_mday, tm.ngx_tm_hour,
|
||||
tm.ngx_tm_min, tm.ngx_tm_sec,
|
||||
tm.tm_year, tm.tm_mon,
|
||||
tm.tm_mday, tm.tm_hour,
|
||||
tm.tm_min, tm.tm_sec,
|
||||
ctx->start_time.gmtoff < 0 ? '-' : '+',
|
||||
ngx_abs(ctx->start_time.gmtoff / 60),
|
||||
ngx_abs(ctx->start_time.gmtoff % 60)) = 0;
|
||||
|
@ -597,11 +597,19 @@ ngx_rtmp_dash_close_fragment(ngx_rtmp_session_t *s, ngx_rtmp_dash_track_t *t)
|
|||
|
||||
left = (size_t) t->mdat_size;
|
||||
|
||||
#if (NGX_WIN32)
|
||||
if (SetFilePointer(t->fd, 0, 0, FILE_BEGIN) == INVALID_SET_FILE_POINTER) {
|
||||
ngx_log_error(NGX_LOG_ERR, s->connection->log, 0,
|
||||
"dash: SetFilePointer error");
|
||||
goto done;
|
||||
}
|
||||
#else
|
||||
if (lseek(t->fd, 0, SEEK_SET) == -1) {
|
||||
ngx_log_error(NGX_LOG_ERR, s->connection->log, ngx_errno,
|
||||
"dash: lseek error");
|
||||
goto done;
|
||||
}
|
||||
#endif
|
||||
|
||||
while (left > 0) {
|
||||
|
||||
|
|
|
@ -108,7 +108,7 @@ ngx_rtmp_mp4_field_8(ngx_buf_t *b, uint8_t n)
|
|||
static ngx_int_t
|
||||
ngx_rtmp_mp4_put_descr(ngx_buf_t *b, int tag, unsigned int size)
|
||||
{
|
||||
ngx_rtmp_mp4_field_8(b, tag);
|
||||
ngx_rtmp_mp4_field_8(b, (uint8_t) tag);
|
||||
ngx_rtmp_mp4_field_8(b, size & 0x7F);
|
||||
|
||||
return NGX_OK;
|
||||
|
@ -182,8 +182,8 @@ ngx_rtmp_mp4_update_box_size(ngx_buf_t *b, u_char *p)
|
|||
|
||||
|
||||
static ngx_int_t
|
||||
ngx_rtmp_mp4_write_matrix(ngx_buf_t *buf, int16_t a, int16_t b, int16_t c,
|
||||
int16_t d, int16_t tx, int16_t ty)
|
||||
ngx_rtmp_mp4_write_matrix(ngx_buf_t *buf, uint32_t a, uint32_t b, uint32_t c,
|
||||
uint32_t d, uint32_t tx, uint32_t ty)
|
||||
{
|
||||
|
||||
/*
|
||||
|
@ -543,8 +543,8 @@ ngx_rtmp_mp4_write_video(ngx_rtmp_session_t *s, ngx_buf_t *b,
|
|||
ngx_rtmp_mp4_field_32(b, 0);
|
||||
|
||||
/* width & height */
|
||||
ngx_rtmp_mp4_field_16(b, metadata->width);
|
||||
ngx_rtmp_mp4_field_16(b, metadata->height);
|
||||
ngx_rtmp_mp4_field_16(b, (uint16_t) metadata->width);
|
||||
ngx_rtmp_mp4_field_16(b, (uint16_t) metadata->height);
|
||||
|
||||
/* horizontal & vertical resolutions 72 dpi */
|
||||
ngx_rtmp_mp4_field_32(b, 0x00480000);
|
||||
|
@ -653,7 +653,7 @@ ngx_rtmp_mp4_write_audio(ngx_rtmp_session_t *s, ngx_buf_t *b,
|
|||
ngx_rtmp_mp4_field_16(b, 16); /* something mp4 specific */
|
||||
ngx_rtmp_mp4_field_16(b, 0); /* something mp4 specific */
|
||||
ngx_rtmp_mp4_field_16(b, 0); /* packet size (=0) */
|
||||
ngx_rtmp_mp4_field_16(b, metadata->sample_rate); /* sample rate */
|
||||
ngx_rtmp_mp4_field_16(b, (uint16_t) metadata->sample_rate);
|
||||
ngx_rtmp_mp4_field_16(b, 0); /* reserved */
|
||||
|
||||
ngx_rtmp_mp4_write_esds(s, b, metadata);
|
||||
|
|
Loading…
Reference in a new issue