Skip to content

Commit

Permalink
removed trailing spaces
Browse files Browse the repository at this point in the history
  • Loading branch information
arut committed Nov 30, 2013
1 parent 96e60a4 commit b9fcf7d
Show file tree
Hide file tree
Showing 43 changed files with 791 additions and 792 deletions.
6 changes: 3 additions & 3 deletions LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ Copyright (c) 2012-2013, Roman Arutyunyan
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
modification, are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
and/or other materials provided with the distribution.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
Expand Down
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@

* Proved to work with Wirecast,FMS,Wowza,
JWPlayer,FlowPlayer,StrobeMediaPlayback,
ffmpeg,avconv,rtmpdump,flvstreamer
ffmpeg,avconv,rtmpdump,flvstreamer
and many more

* Statistics in XML/XSL in machine- & human-
Expand Down Expand Up @@ -165,7 +165,7 @@ rtmp_auto_push directive.
live on;

# Every stream published here
# is automatically pushed to
# is automatically pushed to
# these two machines
push rtmp1.example.com;
push rtmp2.example.com:1934;
Expand All @@ -178,7 +178,7 @@ rtmp_auto_push directive.
# and play locally
pull rtmp://rtmp3.example.com pageUrl=www.example.com/index.html;
}

application mystaticpull {
live on;

Expand All @@ -201,8 +201,8 @@ rtmp_auto_push directive.

live on;

# The following notifications receive all
# the session variables as well as
# The following notifications receive all
# the session variables as well as
# particular call arguments in HTTP POST
# request

Expand All @@ -218,7 +218,7 @@ rtmp_auto_push directive.
on_done http://localhost:8080/done;

# All above mentioned notifications receive
# standard connect() arguments as well as
# standard connect() arguments as well as
# play/publish ones. If any arguments are sent
# with GET-style syntax to play & publish
# these are also included.
Expand Down Expand Up @@ -247,8 +247,8 @@ rtmp_auto_push directive.
# profile (see ffmpeg example).
# This example creates RTMP stream from movie ready for HLS:
#
# ffmpeg -loglevel verbose -re -i movie.avi -vcodec libx264
# -vprofile baseline -acodec libmp3lame -ar 44100 -ac 1
# ffmpeg -loglevel verbose -re -i movie.avi -vcodec libx264
# -vprofile baseline -acodec libmp3lame -ar 44100 -ac 1
# -f flv rtmp://localhost:1935/hls/movie
#
# If you need to transcode live stream use 'exec' feature.
Expand Down
2 changes: 1 addition & 1 deletion config
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
ngx_addon_name="ngx_rtmp_module"

CORE_MODULES="$CORE_MODULES
CORE_MODULES="$CORE_MODULES
ngx_rtmp_module \
ngx_rtmp_core_module \
ngx_rtmp_cmd_module \
Expand Down
58 changes: 29 additions & 29 deletions dash/ngx_rtmp_dash_module.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ static ngx_rtmp_stream_eof_pt next_stream_eof;

static ngx_int_t ngx_rtmp_dash_postconfiguration(ngx_conf_t *cf);
static void * ngx_rtmp_dash_create_app_conf(ngx_conf_t *cf);
static char * ngx_rtmp_dash_merge_app_conf(ngx_conf_t *cf,
static char * ngx_rtmp_dash_merge_app_conf(ngx_conf_t *cf,
void *parent, void *child);
static ngx_int_t ngx_rtmp_dash_write_init_segments(ngx_rtmp_session_t *s);

Expand Down Expand Up @@ -230,7 +230,7 @@ ngx_rtmp_dash_write_playlist(ngx_rtmp_session_t *s)
static u_char buffer[NGX_RTMP_DASH_BUFSIZE];
static u_char start_time[sizeof("1970-09-28T12:00:00+06:00")];
static u_char end_time[sizeof("1970-09-28T12:00:00+06:00")];

dacf = ngx_rtmp_get_module_app_conf(s, ngx_rtmp_dash_module);
ctx = ngx_rtmp_get_module_ctx(s, ngx_rtmp_dash_module);
codec_ctx = ngx_rtmp_get_module_ctx(s, ngx_rtmp_codec_module);
Expand All @@ -243,7 +243,7 @@ ngx_rtmp_dash_write_playlist(ngx_rtmp_session_t *s)
ngx_rtmp_dash_write_init_segments(s);
}

fd = ngx_open_file(ctx->playlist_bak.data, NGX_FILE_WRONLY,
fd = ngx_open_file(ctx->playlist_bak.data, NGX_FILE_WRONLY,
NGX_FILE_TRUNCATE, NGX_FILE_DEFAULT_ACCESS);

if (fd == NGX_INVALID_FILE) {
Expand Down Expand Up @@ -343,7 +343,7 @@ ngx_rtmp_dash_write_playlist(ngx_rtmp_session_t *s)

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.tm_year + 1900, tm.tm_mon + 1,
tm.tm_mday, tm.tm_hour,
Expand All @@ -354,9 +354,9 @@ ngx_rtmp_dash_write_playlist(ngx_rtmp_session_t *s)

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) /
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.tm_year + 1900, tm.tm_mon + 1,
tm.tm_mday, tm.tm_hour,
Expand All @@ -383,14 +383,14 @@ ngx_rtmp_dash_write_playlist(ngx_rtmp_session_t *s)

if (ctx->has_video) {
p = ngx_slprintf(buffer, last, NGX_RTMP_DASH_MANIFEST_VIDEO,
codec_ctx->width,
codec_ctx->width,
codec_ctx->height,
codec_ctx->frame_rate,
&ctx->name,
codec_ctx->avc_profile,
codec_ctx->avc_compat,
codec_ctx->avc_level,
codec_ctx->width,
codec_ctx->width,
codec_ctx->height,
codec_ctx->frame_rate,
(ngx_uint_t) (codec_ctx->video_data_rate * 1000),
Expand All @@ -402,10 +402,10 @@ ngx_rtmp_dash_write_playlist(ngx_rtmp_session_t *s)
p = ngx_slprintf(p, last, NGX_RTMP_DASH_MANIFEST_TIME,
f->timestamp, f->duration);
}

p = ngx_slprintf(p, last, NGX_RTMP_DASH_MANIFEST_VIDEO_FOOTER);

n = ngx_write_fd(fd, buffer, p - buffer);
n = ngx_write_fd(fd, buffer, p - buffer);
}

if (ctx->has_audio) {
Expand All @@ -425,13 +425,13 @@ ngx_rtmp_dash_write_playlist(ngx_rtmp_session_t *s)
}

p = ngx_slprintf(p, last, NGX_RTMP_DASH_MANIFEST_AUDIO_FOOTER);

n = ngx_write_fd(fd, buffer, p - buffer);
}

p = ngx_slprintf(buffer, last, NGX_RTMP_DASH_MANIFEST_FOOTER);
n = ngx_write_fd(fd, buffer, p - buffer);

if (n < 0) {
ngx_log_error(NGX_LOG_ERR, s->connection->log, ngx_errno,
"dash: write failed: '%V'", &ctx->playlist_bak);
Expand All @@ -445,7 +445,7 @@ ngx_rtmp_dash_write_playlist(ngx_rtmp_session_t *s)
== NGX_FILE_ERROR)
{
ngx_log_error(NGX_LOG_ERR, s->connection->log, ngx_errno,
"dash: rename failed: '%V'->'%V'",
"dash: rename failed: '%V'->'%V'",
&ctx->playlist_bak, &ctx->playlist);
return NGX_ERROR;
}
Expand Down Expand Up @@ -493,7 +493,7 @@ ngx_rtmp_dash_write_init_segments(ngx_rtmp_session_t *s)
NGX_RTMP_MP4_VIDEO_TRACK);
ngx_rtmp_mp4_write_moov(s, &b, NGX_RTMP_MP4_VIDEO_TRACK);

rc = ngx_write_fd(fd, b.start, (size_t) (b.last - b.start));
rc = ngx_write_fd(fd, b.start, (size_t) (b.last - b.start));
if (rc == NGX_ERROR) {
ngx_log_error(NGX_LOG_ERR, s->connection->log, ngx_errno,
"dash: writing video init failed");
Expand Down Expand Up @@ -528,7 +528,7 @@ ngx_rtmp_dash_write_init_segments(ngx_rtmp_session_t *s)

ngx_close_file(fd);

return NGX_OK;
return NGX_OK;
}


Expand Down Expand Up @@ -640,7 +640,7 @@ ngx_rtmp_dash_close_fragment(ngx_rtmp_session_t *s, ngx_rtmp_dash_track_t *t)
}


static ngx_int_t
static ngx_int_t
ngx_rtmp_dash_close_fragments(ngx_rtmp_session_t *s)
{
ngx_rtmp_dash_ctx_t *ctx;
Expand Down Expand Up @@ -698,7 +698,7 @@ ngx_rtmp_dash_open_fragment(ngx_rtmp_session_t *s, ngx_rtmp_dash_track_t *t,
t->sample_count = 0;
t->earliest_pres_time = 0;
t->latest_pres_time = 0;
t->mdat_size = 0;
t->mdat_size = 0;
t->opened = 1;

if (type == 'v') {
Expand Down Expand Up @@ -895,7 +895,7 @@ ngx_rtmp_dash_publish(ngx_rtmp_session_t *s, ngx_rtmp_publish_t *v)

ctx->name.len = ngx_strlen(v->name);
ctx->name.data = ngx_palloc(s->connection->pool, ctx->name.len + 1);

if (ctx->name.data == NULL) {
return NGX_ERROR;
}
Expand All @@ -916,8 +916,8 @@ ngx_rtmp_dash_publish(ngx_rtmp_session_t *s, ngx_rtmp_publish_t *v)

p = ngx_cpymem(p, ctx->name.data, ctx->name.len);

/*
* ctx->stream holds initial part of stream file path
/*
* ctx->stream holds initial part of stream file path
* however the space for the whole stream path
* is allocated
*/
Expand All @@ -942,9 +942,9 @@ ngx_rtmp_dash_publish(ngx_rtmp_session_t *s, ngx_rtmp_publish_t *v)

/* playlist bak (new playlist) path */

ctx->playlist_bak.data = ngx_palloc(s->connection->pool,
ctx->playlist_bak.data = ngx_palloc(s->connection->pool,
ctx->playlist.len + sizeof(".bak"));
p = ngx_cpymem(ctx->playlist_bak.data, ctx->playlist.data,
p = ngx_cpymem(ctx->playlist_bak.data, ctx->playlist.data,
ctx->playlist.len);
p = ngx_cpymem(p, ".bak", sizeof(".bak") - 1);

Expand Down Expand Up @@ -992,7 +992,7 @@ ngx_rtmp_dash_close_stream(ngx_rtmp_session_t *s, ngx_rtmp_close_stream_t *v)


static void
ngx_rtmp_dash_update_fragments(ngx_rtmp_session_t *s, ngx_int_t boundary,
ngx_rtmp_dash_update_fragments(ngx_rtmp_session_t *s, ngx_int_t boundary,
uint32_t timestamp)
{
ngx_int_t hit;
Expand Down Expand Up @@ -1028,7 +1028,7 @@ ngx_rtmp_dash_update_fragments(ngx_rtmp_session_t *s, ngx_int_t boundary,

f->duration = (timestamp - f->timestamp);

if (boundary) {
if (boundary) {
ngx_rtmp_dash_close_fragments(s);
ngx_rtmp_dash_open_fragments(s);

Expand Down Expand Up @@ -1100,7 +1100,7 @@ ngx_rtmp_dash_append(ngx_rtmp_session_t *s, ngx_chain_t *in,


static ngx_int_t
ngx_rtmp_dash_audio(ngx_rtmp_session_t *s, ngx_rtmp_header_t *h,
ngx_rtmp_dash_audio(ngx_rtmp_session_t *s, ngx_rtmp_header_t *h,
ngx_chain_t *in)
{
u_char htype;
Expand All @@ -1111,9 +1111,9 @@ ngx_rtmp_dash_audio(ngx_rtmp_session_t *s, ngx_rtmp_header_t *h,
dacf = ngx_rtmp_get_module_app_conf(s, ngx_rtmp_dash_module);
ctx = ngx_rtmp_get_module_ctx(s, ngx_rtmp_dash_module);
codec_ctx = ngx_rtmp_get_module_ctx(s, ngx_rtmp_codec_module);

if (dacf == NULL || !dacf->dash || ctx == NULL ||
codec_ctx == NULL || h->mlen < 2)
codec_ctx == NULL || h->mlen < 2)
{
return NGX_OK;
}
Expand Down Expand Up @@ -1148,7 +1148,7 @@ ngx_rtmp_dash_audio(ngx_rtmp_session_t *s, ngx_rtmp_header_t *h,


static ngx_int_t
ngx_rtmp_dash_video(ngx_rtmp_session_t *s, ngx_rtmp_header_t *h,
ngx_rtmp_dash_video(ngx_rtmp_session_t *s, ngx_rtmp_header_t *h,
ngx_chain_t *in)
{
u_char *p;
Expand Down Expand Up @@ -1296,7 +1296,7 @@ ngx_rtmp_dash_cleanup_dir(ngx_str_t *ppath, ngx_msec_t playlen)
ngx_log_debug1(NGX_LOG_DEBUG_RTMP, ngx_cycle->log, 0,
"dash: cleanup dir '%V'", &name);

/*
/*
* null-termination gets spoiled in win32
* version of ngx_open_dir
*/
Expand Down
Loading

0 comments on commit b9fcf7d

Please sign in to comment.