2013-11-03 20:11:37 +01:00
|
|
|
|
2012-08-27 16:58:28 +02:00
|
|
|
/*
|
2013-11-03 20:11:37 +01:00
|
|
|
* Copyright (C) Roman Arutyunyan
|
2012-08-27 16:58:28 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef _NGX_RTMP_PLAY_H_INCLUDED_
|
|
|
|
#define _NGX_RTMP_PLAY_H_INCLUDED_
|
|
|
|
|
|
|
|
|
2013-06-11 19:00:39 +02:00
|
|
|
#include <ngx_config.h>
|
|
|
|
#include <ngx_core.h>
|
2012-08-27 16:58:28 +02:00
|
|
|
#include "ngx_rtmp.h"
|
2013-04-22 18:20:19 +02:00
|
|
|
#include "ngx_rtmp_cmd_module.h"
|
2012-08-27 16:58:28 +02:00
|
|
|
|
|
|
|
|
2013-11-30 08:21:53 +01:00
|
|
|
typedef ngx_int_t (*ngx_rtmp_play_init_pt) (ngx_rtmp_session_t *s,
|
2013-01-26 07:06:04 +01:00
|
|
|
ngx_file_t *f, ngx_int_t aindex, ngx_int_t vindex);
|
2012-08-27 16:58:28 +02:00
|
|
|
typedef ngx_int_t (*ngx_rtmp_play_done_pt) (ngx_rtmp_session_t *s,
|
|
|
|
ngx_file_t *f);
|
2013-11-30 08:21:53 +01:00
|
|
|
typedef ngx_int_t (*ngx_rtmp_play_start_pt) (ngx_rtmp_session_t *s,
|
2012-10-05 13:36:05 +02:00
|
|
|
ngx_file_t *f);
|
2013-11-30 08:21:53 +01:00
|
|
|
typedef ngx_int_t (*ngx_rtmp_play_seek_pt) (ngx_rtmp_session_t *s,
|
2012-08-27 16:58:28 +02:00
|
|
|
ngx_file_t *f, ngx_uint_t offs);
|
|
|
|
typedef ngx_int_t (*ngx_rtmp_play_stop_pt) (ngx_rtmp_session_t *s,
|
|
|
|
ngx_file_t *f);
|
|
|
|
typedef ngx_int_t (*ngx_rtmp_play_send_pt) (ngx_rtmp_session_t *s,
|
2012-10-05 13:36:05 +02:00
|
|
|
ngx_file_t *f, ngx_uint_t *ts);
|
2012-08-27 16:58:28 +02:00
|
|
|
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
ngx_str_t name;
|
|
|
|
ngx_str_t pfx;
|
|
|
|
ngx_str_t sfx;
|
|
|
|
|
|
|
|
ngx_rtmp_play_init_pt init;
|
|
|
|
ngx_rtmp_play_done_pt done;
|
|
|
|
ngx_rtmp_play_start_pt start;
|
2012-10-05 13:36:05 +02:00
|
|
|
ngx_rtmp_play_seek_pt seek;
|
2012-08-27 16:58:28 +02:00
|
|
|
ngx_rtmp_play_stop_pt stop;
|
|
|
|
ngx_rtmp_play_send_pt send;
|
|
|
|
} ngx_rtmp_play_fmt_t;
|
|
|
|
|
|
|
|
|
2013-04-22 18:20:19 +02:00
|
|
|
typedef struct ngx_rtmp_play_ctx_s ngx_rtmp_play_ctx_t;
|
|
|
|
|
|
|
|
|
|
|
|
struct ngx_rtmp_play_ctx_s {
|
|
|
|
ngx_rtmp_session_t *session;
|
2012-08-27 16:58:28 +02:00
|
|
|
ngx_file_t file;
|
|
|
|
ngx_rtmp_play_fmt_t *fmt;
|
|
|
|
ngx_event_t send_evt;
|
2012-10-05 13:36:05 +02:00
|
|
|
unsigned playing:1;
|
2013-03-20 12:20:08 +01:00
|
|
|
unsigned opened:1;
|
2013-04-22 18:20:19 +02:00
|
|
|
unsigned joined:1;
|
2012-10-23 18:21:24 +02:00
|
|
|
ngx_uint_t ncrs;
|
2013-03-03 15:00:06 +01:00
|
|
|
ngx_uint_t nheader;
|
2013-02-13 16:35:34 +01:00
|
|
|
ngx_uint_t nbody;
|
|
|
|
size_t pfx_size;
|
|
|
|
ngx_str_t sfx;
|
|
|
|
ngx_uint_t file_id;
|
2013-01-26 07:06:04 +01:00
|
|
|
ngx_int_t aindex, vindex;
|
2013-02-13 16:35:34 +01:00
|
|
|
ngx_uint_t nentry;
|
2013-03-20 12:20:08 +01:00
|
|
|
ngx_uint_t post_seek;
|
2013-04-22 18:20:19 +02:00
|
|
|
u_char name[NGX_RTMP_MAX_NAME];
|
|
|
|
ngx_rtmp_play_ctx_t *next;
|
|
|
|
};
|
2012-08-27 16:58:28 +02:00
|
|
|
|
|
|
|
|
|
|
|
typedef struct {
|
2013-02-13 16:35:34 +01:00
|
|
|
ngx_str_t *root;
|
2012-10-23 18:21:24 +02:00
|
|
|
ngx_url_t *url;
|
2013-02-13 16:35:34 +01:00
|
|
|
} ngx_rtmp_play_entry_t;
|
|
|
|
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
ngx_str_t temp_path;
|
|
|
|
ngx_str_t local_path;
|
|
|
|
ngx_array_t entries; /* ngx_rtmp_play_entry_t * */
|
2013-04-22 18:20:19 +02:00
|
|
|
ngx_uint_t nbuckets;
|
|
|
|
ngx_rtmp_play_ctx_t **ctx;
|
2012-08-27 16:58:28 +02:00
|
|
|
} ngx_rtmp_play_app_conf_t;
|
|
|
|
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
ngx_array_t fmts; /* ngx_rtmp_play_fmt_t * */
|
|
|
|
} ngx_rtmp_play_main_conf_t;
|
|
|
|
|
|
|
|
|
|
|
|
extern ngx_module_t ngx_rtmp_play_module;
|
|
|
|
|
|
|
|
|
|
|
|
#endif /* _NGX_RTMP_PLAY_H_INCLUDED_ */
|