Merge remote-tracking branch 'stephenbasile/dash' into dash

This commit is contained in:
Roman Arutyunyan 2013-11-10 09:31:31 +04:00
commit 6067ac21e0
4 changed files with 2582 additions and 0 deletions

4
config
View file

@ -20,6 +20,7 @@ CORE_MODULES="$CORE_MODULES
ngx_rtmp_log_module \
ngx_rtmp_limit_module \
ngx_rtmp_hls_module \
ngx_rtmp_dash_module \
"
@ -44,6 +45,7 @@ NGX_ADDON_DEPS="$NGX_ADDON_DEPS \
$ngx_addon_dir/ngx_rtmp_relay_module.h \
$ngx_addon_dir/ngx_rtmp_streams.h \
$ngx_addon_dir/hls/ngx_rtmp_mpegts.h \
$ngx_addon_dir/dash/ngx_rtmp_mp4.h \
"
@ -78,7 +80,9 @@ NGX_ADDON_SRCS="$NGX_ADDON_SRCS \
$ngx_addon_dir/ngx_rtmp_log_module.c \
$ngx_addon_dir/ngx_rtmp_limit_module.c \
$ngx_addon_dir/hls/ngx_rtmp_hls_module.c \
$ngx_addon_dir/dash/ngx_rtmp_dash_module.c \
$ngx_addon_dir/hls/ngx_rtmp_mpegts.c \
$ngx_addon_dir/dash/ngx_rtmp_mp4.c \
"
CFLAGS="$CFLAGS -I$ngx_addon_dir"

1373
dash/ngx_rtmp_dash_module.c Normal file

File diff suppressed because it is too large Load diff

1149
dash/ngx_rtmp_mp4.c Normal file

File diff suppressed because it is too large Load diff

56
dash/ngx_rtmp_mp4.h Normal file
View file

@ -0,0 +1,56 @@
#ifndef _NGX_RTMP_MP4_H_INCLUDED_
#define _NGX_RTMP_MP4_H_INCLUDED_
#include <ngx_config.h>
#include <ngx_core.h>
#include <ngx_rtmp.h>
typedef struct {
ngx_uint_t width;
ngx_uint_t height;
ngx_uint_t audio;
ngx_uint_t video;
ngx_uint_t sample_rate;
ngx_uint_t frame_rate;
ngx_uint_t audio_codec;
} ngx_rtmp_mp4_metadata_t;
enum {
NGX_RTMP_MP4_FILETYPE_INIT = 0,
NGX_RTMP_MP4_FILETYPE_SEG = 1
};
/* divide all times by this value. this is the same resolution as RTMP so it
is convenient */
#define NGX_RTMP_MP4_TIMESCALE 1000
/* normal forward playback as defined by spec */
#define NGX_RTMP_MP4_PREFERRED_RATE 0x00010000
/* full volume as defined by spec */
#define NGX_RTMP_MP4_PREFERRED_VOLUME 0x0100
ngx_int_t ngx_rtmp_mp4_write_ftyp(ngx_buf_t *b, int type,
ngx_rtmp_mp4_metadata_t metadata);
ngx_int_t ngx_rtmp_mp4_write_moov(ngx_rtmp_session_t *s, ngx_buf_t *b,
ngx_rtmp_mp4_metadata_t metadata);
ngx_int_t ngx_rtmp_mp4_write_moof(ngx_buf_t *b,
ngx_uint_t earliest_pres_time,
uint32_t sample_count,
uint32_t sample_sizes[128], uint32_t index,
ngx_uint_t sample_rate);
ngx_int_t ngx_rtmp_mp4_write_sidx(ngx_rtmp_session_t *s, ngx_buf_t *b,
ngx_uint_t reference_size,
ngx_uint_t earliest_pres_time,
ngx_uint_t latest_pres_time,
ngx_uint_t sample_rate);
ngx_uint_t ngx_rtmp_mp4_write_mdat(ngx_buf_t *b, ngx_uint_t size);
uint32_t ngx_rtmp_mp4_write_data(ngx_rtmp_session_t *s, ngx_file_t *file,
ngx_buf_t *b);
#endif /* _NGX_RTMP_MP4_H_INCLUDED_ */