Skip to content

Commit

Permalink
removed legacy constants
Browse files Browse the repository at this point in the history
  • Loading branch information
arut committed Oct 20, 2012
1 parent a3fde6e commit cb4623a
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 43 deletions.
44 changes: 22 additions & 22 deletions ngx_rtmp_cmd_module.c
Expand Up @@ -214,7 +214,7 @@ ngx_rtmp_cmd_connect(ngx_rtmp_session_t *s, ngx_rtmp_connect_t *v)
s->connected = 1; s->connected = 1;


ngx_memzero(&h, sizeof(h)); ngx_memzero(&h, sizeof(h));
h.csid = NGX_RTMP_CMD_CSID_AMF_INI; h.csid = NGX_RTMP_CSID_AMF_INI;
h.type = NGX_RTMP_MSG_AMF_CMD; h.type = NGX_RTMP_MSG_AMF_CMD;




Expand Down Expand Up @@ -321,10 +321,10 @@ ngx_rtmp_cmd_create_stream(ngx_rtmp_session_t *s, ngx_rtmp_create_stream_t *v)
}; };


trans = v->trans; trans = v->trans;
stream = NGX_RTMP_CMD_MSID; stream = NGX_RTMP_MSID;


ngx_memzero(&h, sizeof(h)); ngx_memzero(&h, sizeof(h));
h.csid = NGX_RTMP_CMD_CSID_AMF_INI; h.csid = NGX_RTMP_CSID_AMF_INI;
h.type = NGX_RTMP_MSG_AMF_CMD; h.type = NGX_RTMP_MSG_AMF_CMD;


ngx_log_error(NGX_LOG_INFO, s->connection->log, 0, ngx_log_error(NGX_LOG_INFO, s->connection->log, 0,
Expand Down Expand Up @@ -369,7 +369,7 @@ ngx_rtmp_cmd_close_stream_init(ngx_rtmp_session_t *s, ngx_rtmp_header_t *h,
static ngx_int_t static ngx_int_t
ngx_rtmp_cmd_close_stream(ngx_rtmp_session_t *s, ngx_rtmp_close_stream_t *v) ngx_rtmp_cmd_close_stream(ngx_rtmp_session_t *s, ngx_rtmp_close_stream_t *v)
{ {
ngx_rtmp_send_user_stream_eof(s, NGX_RTMP_CMD_MSID); ngx_rtmp_send_user_stream_eof(s, NGX_RTMP_MSID);


/* Whatever happens return OK /* Whatever happens return OK
* since we should be careful with destruction */ * since we should be careful with destruction */
Expand Down Expand Up @@ -537,8 +537,8 @@ ngx_rtmp_cmd_publish(ngx_rtmp_session_t *s, ngx_rtmp_publish_t *v)
/* send onStatus reply */ /* send onStatus reply */
memset(&h, 0, sizeof(h)); memset(&h, 0, sizeof(h));
h.type = NGX_RTMP_MSG_AMF_CMD; h.type = NGX_RTMP_MSG_AMF_CMD;
h.csid = NGX_RTMP_CMD_CSID_AMF; h.csid = NGX_RTMP_CSID_AMF;
h.msid = NGX_RTMP_CMD_MSID; h.msid = NGX_RTMP_MSID;


if (ngx_rtmp_send_amf(s, &h, out_elts, if (ngx_rtmp_send_amf(s, &h, out_elts,
sizeof(out_elts) / sizeof(out_elts[0])) != NGX_OK) sizeof(out_elts) / sizeof(out_elts[0])) != NGX_OK)
Expand Down Expand Up @@ -630,8 +630,8 @@ ngx_rtmp_cmd_fcpublish(ngx_rtmp_session_t *s, ngx_rtmp_fcpublish_t *v)
/* send onFCPublish reply */ /* send onFCPublish reply */
memset(&h, 0, sizeof(h)); memset(&h, 0, sizeof(h));
h.type = NGX_RTMP_MSG_AMF_CMD; h.type = NGX_RTMP_MSG_AMF_CMD;
h.csid = NGX_RTMP_CMD_CSID_AMF; h.csid = NGX_RTMP_CSID_AMF;
h.msid = NGX_RTMP_CMD_MSID; h.msid = NGX_RTMP_MSID;


if (ngx_rtmp_send_amf(s, &h, out_elts, if (ngx_rtmp_send_amf(s, &h, out_elts,
sizeof(out_elts) / sizeof(out_elts[0])) != NGX_OK) sizeof(out_elts) / sizeof(out_elts[0])) != NGX_OK)
Expand Down Expand Up @@ -818,15 +818,15 @@ ngx_rtmp_cmd_play(ngx_rtmp_session_t *s, ngx_rtmp_play_t *v)
/* send onStatus reply */ /* send onStatus reply */
memset(&h, 0, sizeof(h)); memset(&h, 0, sizeof(h));
h.type = NGX_RTMP_MSG_AMF_CMD; h.type = NGX_RTMP_MSG_AMF_CMD;
h.csid = NGX_RTMP_CMD_CSID_AMF; h.csid = NGX_RTMP_CSID_AMF;
h.msid = NGX_RTMP_CMD_MSID; h.msid = NGX_RTMP_MSID;


/* /*
if (ngx_rtmp_send_user_recorded(s, NGX_RTMP_CMD_MSID) != NGX_OK) { if (ngx_rtmp_send_user_recorded(s, NGX_RTMP_MSID) != NGX_OK) {
return NGX_ERROR; return NGX_ERROR;
}*/ }*/


if (ngx_rtmp_send_user_stream_begin(s, NGX_RTMP_CMD_MSID) != NGX_OK) { if (ngx_rtmp_send_user_stream_begin(s, NGX_RTMP_MSID) != NGX_OK) {
return NGX_ERROR; return NGX_ERROR;
} }


Expand Down Expand Up @@ -943,8 +943,8 @@ ngx_rtmp_cmd_fcsubscribe(ngx_rtmp_session_t *s, ngx_rtmp_fcsubscribe_t *v)
/* send onFCSubscribe reply */ /* send onFCSubscribe reply */
memset(&h, 0, sizeof(h)); memset(&h, 0, sizeof(h));
h.type = NGX_RTMP_MSG_AMF_CMD; h.type = NGX_RTMP_MSG_AMF_CMD;
h.csid = NGX_RTMP_CMD_CSID_AMF; h.csid = NGX_RTMP_CSID_AMF;
h.msid = NGX_RTMP_CMD_MSID; h.msid = NGX_RTMP_MSID;


if (ngx_rtmp_send_amf(s, &h, out_elts, if (ngx_rtmp_send_amf(s, &h, out_elts,
sizeof(out_elts) / sizeof(out_elts[0])) != NGX_OK) sizeof(out_elts) / sizeof(out_elts[0])) != NGX_OK)
Expand Down Expand Up @@ -1048,13 +1048,13 @@ ngx_rtmp_cmd_pause(ngx_rtmp_session_t *s, ngx_rtmp_pause_t *v)
/* send onStatus reply */ /* send onStatus reply */
ngx_memzero(&h, sizeof(h)); ngx_memzero(&h, sizeof(h));
h.type = NGX_RTMP_MSG_AMF_CMD; h.type = NGX_RTMP_MSG_AMF_CMD;
h.csid = NGX_RTMP_CMD_CSID_AMF; h.csid = NGX_RTMP_CSID_AMF;
h.msid = NGX_RTMP_CMD_MSID; h.msid = NGX_RTMP_MSID;


if (v->pause) { if (v->pause) {
out_inf[0].data = "NetStream.Pause.Notify"; out_inf[0].data = "NetStream.Pause.Notify";
out_inf[2].data = "Paused."; out_inf[2].data = "Paused.";
return ngx_rtmp_send_user_stream_eof(s, NGX_RTMP_CMD_MSID) != NGX_OK return ngx_rtmp_send_user_stream_eof(s, NGX_RTMP_MSID) != NGX_OK
|| ngx_rtmp_send_amf(s, &h, out_elts, || ngx_rtmp_send_amf(s, &h, out_elts,
sizeof(out_elts) / sizeof(out_elts[0])) != NGX_OK sizeof(out_elts) / sizeof(out_elts[0])) != NGX_OK
? NGX_ERROR ? NGX_ERROR
Expand All @@ -1063,7 +1063,7 @@ ngx_rtmp_cmd_pause(ngx_rtmp_session_t *s, ngx_rtmp_pause_t *v)


out_inf[0].data = "NetStream.Unpause.Notify"; out_inf[0].data = "NetStream.Unpause.Notify";
out_inf[2].data = "Unpaused."; out_inf[2].data = "Unpaused.";
return ngx_rtmp_send_user_stream_begin(s, NGX_RTMP_CMD_MSID) != NGX_OK return ngx_rtmp_send_user_stream_begin(s, NGX_RTMP_MSID) != NGX_OK
|| ngx_rtmp_send_amf(s, &h, out_elts, || ngx_rtmp_send_amf(s, &h, out_elts,
sizeof(out_elts) / sizeof(out_elts[0])) != NGX_OK sizeof(out_elts) / sizeof(out_elts[0])) != NGX_OK
? NGX_ERROR ? NGX_ERROR
Expand Down Expand Up @@ -1168,11 +1168,11 @@ ngx_rtmp_cmd_seek(ngx_rtmp_session_t *s, ngx_rtmp_seek_t *v)
/* send onStatus reply */ /* send onStatus reply */
ngx_memzero(&h, sizeof(h)); ngx_memzero(&h, sizeof(h));
h.type = NGX_RTMP_MSG_AMF_CMD; h.type = NGX_RTMP_MSG_AMF_CMD;
h.csid = NGX_RTMP_CMD_CSID_AMF; h.csid = NGX_RTMP_CSID_AMF;
h.msid = NGX_RTMP_CMD_MSID; h.msid = NGX_RTMP_MSID;


return (ngx_rtmp_send_user_stream_eof(s, NGX_RTMP_CMD_MSID) != NGX_OK return (ngx_rtmp_send_user_stream_eof(s, NGX_RTMP_MSID) != NGX_OK
|| ngx_rtmp_send_user_stream_begin(s, NGX_RTMP_CMD_MSID) != NGX_OK || ngx_rtmp_send_user_stream_begin(s, NGX_RTMP_MSID) != NGX_OK
|| ngx_rtmp_send_amf(s, &h, out_elts, || ngx_rtmp_send_amf(s, &h, out_elts,
sizeof(out_elts) / sizeof(out_elts[0])) != NGX_OK) sizeof(out_elts) / sizeof(out_elts[0])) != NGX_OK)
? NGX_ERROR ? NGX_ERROR
Expand Down
10 changes: 5 additions & 5 deletions ngx_rtmp_codec_module.c
Expand Up @@ -290,11 +290,11 @@ ngx_rtmp_codec_av(ngx_rtmp_session_t *s, ngx_rtmp_header_t *h,


/* equal headers; timeout diff is zero */ /* equal headers; timeout diff is zero */
ngx_memzero(&ch, sizeof(ch)); ngx_memzero(&ch, sizeof(ch));
ch.msid = NGX_RTMP_LIVE_MSID; ch.msid = NGX_RTMP_MSID;
ch.type = h->type; ch.type = h->type;
ch.csid = (h->type == NGX_RTMP_MSG_VIDEO ch.csid = (h->type == NGX_RTMP_MSG_VIDEO
? NGX_RTMP_LIVE_CSID_VIDEO ? NGX_RTMP_CSID_VIDEO
: NGX_RTMP_LIVE_CSID_AUDIO); : NGX_RTMP_CSID_AUDIO);
lh = ch; lh = ch;
*header = ngx_rtmp_append_shared_bufs(cscf, NULL, in); *header = ngx_rtmp_append_shared_bufs(cscf, NULL, in);
*pheader = ngx_rtmp_append_shared_bufs(cscf, NULL, in); *pheader = ngx_rtmp_append_shared_bufs(cscf, NULL, in);
Expand Down Expand Up @@ -428,8 +428,8 @@ ngx_rtmp_codec_update_meta(ngx_rtmp_session_t *s)
} }


ngx_memzero(&h, sizeof(h)); ngx_memzero(&h, sizeof(h));
h.csid = NGX_RTMP_LIVE_CSID_META; h.csid = NGX_RTMP_CSID_AMF;
h.msid = NGX_RTMP_LIVE_MSID; h.msid = NGX_RTMP_MSID;
h.type = NGX_RTMP_MSG_AMF_META; h.type = NGX_RTMP_MSG_AMF_META;
ngx_rtmp_prepare_message(s, &h, NULL, ctx->meta); ngx_rtmp_prepare_message(s, &h, NULL, ctx->meta);


Expand Down
6 changes: 3 additions & 3 deletions ngx_rtmp_flv_module.c
Expand Up @@ -343,8 +343,8 @@ ngx_rtmp_flv_read_meta(ngx_rtmp_session_t *s, ngx_file_t *f)
ngx_memzero(&h, sizeof(h)); ngx_memzero(&h, sizeof(h));


h.type = NGX_RTMP_MSG_AMF_META; h.type = NGX_RTMP_MSG_AMF_META;
h.msid = NGX_RTMP_LIVE_MSID; h.msid = NGX_RTMP_MSID;
h.csid = NGX_RTMP_LIVE_CSID_META; h.csid = NGX_RTMP_CSID_AMF;


size = 0; size = 0;
ngx_rtmp_rmemcpy(&size, ngx_rtmp_flv_header + 1, 3); ngx_rtmp_rmemcpy(&size, ngx_rtmp_flv_header + 1, 3);
Expand Down Expand Up @@ -431,7 +431,7 @@ ngx_rtmp_flv_send(ngx_rtmp_session_t *s, ngx_file_t *f)
/* parse header fields */ /* parse header fields */
ngx_memzero(&h, sizeof(h)); ngx_memzero(&h, sizeof(h));


h.msid = NGX_RTMP_LIVE_MSID; h.msid = NGX_RTMP_MSID;
h.type = ngx_rtmp_flv_header[0]; h.type = ngx_rtmp_flv_header[0];


size = 0; size = 0;
Expand Down
6 changes: 3 additions & 3 deletions ngx_rtmp_live_module.c
Expand Up @@ -337,18 +337,18 @@ ngx_rtmp_live_av(ngx_rtmp_session_t *s, ngx_rtmp_header_t *h,
ngx_memzero(&ch, sizeof(ch)); ngx_memzero(&ch, sizeof(ch));
ngx_memzero(&lh, sizeof(lh)); ngx_memzero(&lh, sizeof(lh));
ch.timestamp = h->timestamp; ch.timestamp = h->timestamp;
ch.msid = NGX_RTMP_LIVE_MSID; ch.msid = NGX_RTMP_MSID;
ch.type = h->type; ch.type = h->type;
lh.msid = ch.msid; lh.msid = ch.msid;
if (h->type == NGX_RTMP_MSG_VIDEO) { if (h->type == NGX_RTMP_MSG_VIDEO) {
prio = ngx_rtmp_get_video_frame_type(in); prio = ngx_rtmp_get_video_frame_type(in);
ch.csid = NGX_RTMP_LIVE_CSID_VIDEO; ch.csid = NGX_RTMP_CSID_VIDEO;
lh.timestamp = ctx->last_video; lh.timestamp = ctx->last_video;
ctx->last_video = ch.timestamp; ctx->last_video = ch.timestamp;
} else { } else {
/* audio priority is the same as video key frame's */ /* audio priority is the same as video key frame's */
prio = NGX_RTMP_VIDEO_KEY_FRAME; prio = NGX_RTMP_VIDEO_KEY_FRAME;
ch.csid = NGX_RTMP_LIVE_CSID_AUDIO; ch.csid = NGX_RTMP_CSID_AUDIO;
lh.timestamp = ctx->last_audio; lh.timestamp = ctx->last_audio;
ctx->last_audio = ch.timestamp; ctx->last_audio = ch.timestamp;
} }
Expand Down
10 changes: 0 additions & 10 deletions ngx_rtmp_streams.h
Expand Up @@ -15,14 +15,4 @@
#define NGX_RTMP_CSID_VIDEO 7 #define NGX_RTMP_CSID_VIDEO 7




/*legacy*/
#define NGX_RTMP_CMD_CSID_AMF_INI NGX_RTMP_CSID_AMF_INI
#define NGX_RTMP_CMD_CSID_AMF NGX_RTMP_CSID_AMF
#define NGX_RTMP_CMD_MSID NGX_RTMP_MSID
#define NGX_RTMP_LIVE_CSID_META NGX_RTMP_CSID_AMF
#define NGX_RTMP_LIVE_CSID_AUDIO NGX_RTMP_CSID_AUDIO
#define NGX_RTMP_LIVE_CSID_VIDEO NGX_RTMP_CSID_VIDEO
#define NGX_RTMP_LIVE_MSID NGX_RTMP_MSID


#endif /* _NGX_RTMP_STREAMS_H_INCLUDED_ */ #endif /* _NGX_RTMP_STREAMS_H_INCLUDED_ */

0 comments on commit cb4623a

Please sign in to comment.