Mercurial > libavformat.hg
annotate librtmp.c @ 5926:e4080988d1b2 libavformat
Another uninitialized value.
See http://tranquillity.ath.cx/clang/2010-03-30-1/report-e6KUTb.html#EndPath
author | rbultje |
---|---|
date | Fri, 02 Apr 2010 14:58:55 +0000 |
parents | 5564d7f2ed5a |
children | 28103c669f01 |
rev | line source |
---|---|
5904
5564d7f2ed5a
Implement support to RTMP, RTMPT, RTMPE, RTMPTE, RTMPS protocols via
stefano
parents:
diff
changeset
|
1 /* |
5564d7f2ed5a
Implement support to RTMP, RTMPT, RTMPE, RTMPTE, RTMPS protocols via
stefano
parents:
diff
changeset
|
2 * RTMP network protocol |
5564d7f2ed5a
Implement support to RTMP, RTMPT, RTMPE, RTMPTE, RTMPS protocols via
stefano
parents:
diff
changeset
|
3 * Copyright (c) 2010 Howard Chu |
5564d7f2ed5a
Implement support to RTMP, RTMPT, RTMPE, RTMPTE, RTMPS protocols via
stefano
parents:
diff
changeset
|
4 * |
5564d7f2ed5a
Implement support to RTMP, RTMPT, RTMPE, RTMPTE, RTMPS protocols via
stefano
parents:
diff
changeset
|
5 * This file is part of FFmpeg. |
5564d7f2ed5a
Implement support to RTMP, RTMPT, RTMPE, RTMPTE, RTMPS protocols via
stefano
parents:
diff
changeset
|
6 * |
5564d7f2ed5a
Implement support to RTMP, RTMPT, RTMPE, RTMPTE, RTMPS protocols via
stefano
parents:
diff
changeset
|
7 * FFmpeg is free software; you can redistribute it and/or |
5564d7f2ed5a
Implement support to RTMP, RTMPT, RTMPE, RTMPTE, RTMPS protocols via
stefano
parents:
diff
changeset
|
8 * modify it under the terms of the GNU Lesser General Public |
5564d7f2ed5a
Implement support to RTMP, RTMPT, RTMPE, RTMPTE, RTMPS protocols via
stefano
parents:
diff
changeset
|
9 * License as published by the Free Software Foundation; either |
5564d7f2ed5a
Implement support to RTMP, RTMPT, RTMPE, RTMPTE, RTMPS protocols via
stefano
parents:
diff
changeset
|
10 * version 2.1 of the License, or (at your option) any later version. |
5564d7f2ed5a
Implement support to RTMP, RTMPT, RTMPE, RTMPTE, RTMPS protocols via
stefano
parents:
diff
changeset
|
11 * |
5564d7f2ed5a
Implement support to RTMP, RTMPT, RTMPE, RTMPTE, RTMPS protocols via
stefano
parents:
diff
changeset
|
12 * FFmpeg is distributed in the hope that it will be useful, |
5564d7f2ed5a
Implement support to RTMP, RTMPT, RTMPE, RTMPTE, RTMPS protocols via
stefano
parents:
diff
changeset
|
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
5564d7f2ed5a
Implement support to RTMP, RTMPT, RTMPE, RTMPTE, RTMPS protocols via
stefano
parents:
diff
changeset
|
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
5564d7f2ed5a
Implement support to RTMP, RTMPT, RTMPE, RTMPTE, RTMPS protocols via
stefano
parents:
diff
changeset
|
15 * Lesser General Public License for more details. |
5564d7f2ed5a
Implement support to RTMP, RTMPT, RTMPE, RTMPTE, RTMPS protocols via
stefano
parents:
diff
changeset
|
16 * |
5564d7f2ed5a
Implement support to RTMP, RTMPT, RTMPE, RTMPTE, RTMPS protocols via
stefano
parents:
diff
changeset
|
17 * You should have received a copy of the GNU Lesser General Public |
5564d7f2ed5a
Implement support to RTMP, RTMPT, RTMPE, RTMPTE, RTMPS protocols via
stefano
parents:
diff
changeset
|
18 * License along with FFmpeg; if not, write to the Free Software |
5564d7f2ed5a
Implement support to RTMP, RTMPT, RTMPE, RTMPTE, RTMPS protocols via
stefano
parents:
diff
changeset
|
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
5564d7f2ed5a
Implement support to RTMP, RTMPT, RTMPE, RTMPTE, RTMPS protocols via
stefano
parents:
diff
changeset
|
20 */ |
5564d7f2ed5a
Implement support to RTMP, RTMPT, RTMPE, RTMPTE, RTMPS protocols via
stefano
parents:
diff
changeset
|
21 |
5564d7f2ed5a
Implement support to RTMP, RTMPT, RTMPE, RTMPTE, RTMPS protocols via
stefano
parents:
diff
changeset
|
22 /** |
5564d7f2ed5a
Implement support to RTMP, RTMPT, RTMPE, RTMPTE, RTMPS protocols via
stefano
parents:
diff
changeset
|
23 * @file libavformat/librtmp.c |
5564d7f2ed5a
Implement support to RTMP, RTMPT, RTMPE, RTMPTE, RTMPS protocols via
stefano
parents:
diff
changeset
|
24 * RTMP protocol based on http://rtmpdump.mplayerhq.hu librtmp |
5564d7f2ed5a
Implement support to RTMP, RTMPT, RTMPE, RTMPTE, RTMPS protocols via
stefano
parents:
diff
changeset
|
25 */ |
5564d7f2ed5a
Implement support to RTMP, RTMPT, RTMPE, RTMPTE, RTMPS protocols via
stefano
parents:
diff
changeset
|
26 |
5564d7f2ed5a
Implement support to RTMP, RTMPT, RTMPE, RTMPTE, RTMPS protocols via
stefano
parents:
diff
changeset
|
27 #include "avformat.h" |
5564d7f2ed5a
Implement support to RTMP, RTMPT, RTMPE, RTMPTE, RTMPS protocols via
stefano
parents:
diff
changeset
|
28 |
5564d7f2ed5a
Implement support to RTMP, RTMPT, RTMPE, RTMPTE, RTMPS protocols via
stefano
parents:
diff
changeset
|
29 #include <librtmp/rtmp.h> |
5564d7f2ed5a
Implement support to RTMP, RTMPT, RTMPE, RTMPTE, RTMPS protocols via
stefano
parents:
diff
changeset
|
30 #include <librtmp/log.h> |
5564d7f2ed5a
Implement support to RTMP, RTMPT, RTMPE, RTMPTE, RTMPS protocols via
stefano
parents:
diff
changeset
|
31 |
5564d7f2ed5a
Implement support to RTMP, RTMPT, RTMPE, RTMPTE, RTMPS protocols via
stefano
parents:
diff
changeset
|
32 static int rtmp_close(URLContext *s) |
5564d7f2ed5a
Implement support to RTMP, RTMPT, RTMPE, RTMPTE, RTMPS protocols via
stefano
parents:
diff
changeset
|
33 { |
5564d7f2ed5a
Implement support to RTMP, RTMPT, RTMPE, RTMPTE, RTMPS protocols via
stefano
parents:
diff
changeset
|
34 RTMP *r = s->priv_data; |
5564d7f2ed5a
Implement support to RTMP, RTMPT, RTMPE, RTMPTE, RTMPS protocols via
stefano
parents:
diff
changeset
|
35 |
5564d7f2ed5a
Implement support to RTMP, RTMPT, RTMPE, RTMPTE, RTMPS protocols via
stefano
parents:
diff
changeset
|
36 RTMP_Close(r); |
5564d7f2ed5a
Implement support to RTMP, RTMPT, RTMPE, RTMPTE, RTMPS protocols via
stefano
parents:
diff
changeset
|
37 av_free(r); |
5564d7f2ed5a
Implement support to RTMP, RTMPT, RTMPE, RTMPTE, RTMPS protocols via
stefano
parents:
diff
changeset
|
38 return 0; |
5564d7f2ed5a
Implement support to RTMP, RTMPT, RTMPE, RTMPTE, RTMPS protocols via
stefano
parents:
diff
changeset
|
39 } |
5564d7f2ed5a
Implement support to RTMP, RTMPT, RTMPE, RTMPTE, RTMPS protocols via
stefano
parents:
diff
changeset
|
40 |
5564d7f2ed5a
Implement support to RTMP, RTMPT, RTMPE, RTMPTE, RTMPS protocols via
stefano
parents:
diff
changeset
|
41 /** |
5564d7f2ed5a
Implement support to RTMP, RTMPT, RTMPE, RTMPTE, RTMPS protocols via
stefano
parents:
diff
changeset
|
42 * Opens RTMP connection and verifies that the stream can be played. |
5564d7f2ed5a
Implement support to RTMP, RTMPT, RTMPE, RTMPTE, RTMPS protocols via
stefano
parents:
diff
changeset
|
43 * |
5564d7f2ed5a
Implement support to RTMP, RTMPT, RTMPE, RTMPTE, RTMPS protocols via
stefano
parents:
diff
changeset
|
44 * URL syntax: rtmp://server[:port][/app][/playpath][ keyword=value]... |
5564d7f2ed5a
Implement support to RTMP, RTMPT, RTMPE, RTMPTE, RTMPS protocols via
stefano
parents:
diff
changeset
|
45 * where 'app' is first one or two directories in the path |
5564d7f2ed5a
Implement support to RTMP, RTMPT, RTMPE, RTMPTE, RTMPS protocols via
stefano
parents:
diff
changeset
|
46 * (e.g. /ondemand/, /flash/live/, etc.) |
5564d7f2ed5a
Implement support to RTMP, RTMPT, RTMPE, RTMPTE, RTMPS protocols via
stefano
parents:
diff
changeset
|
47 * and 'playpath' is a file name (the rest of the path, |
5564d7f2ed5a
Implement support to RTMP, RTMPT, RTMPE, RTMPTE, RTMPS protocols via
stefano
parents:
diff
changeset
|
48 * may be prefixed with "mp4:") |
5564d7f2ed5a
Implement support to RTMP, RTMPT, RTMPE, RTMPTE, RTMPS protocols via
stefano
parents:
diff
changeset
|
49 * |
5564d7f2ed5a
Implement support to RTMP, RTMPT, RTMPE, RTMPTE, RTMPS protocols via
stefano
parents:
diff
changeset
|
50 * Additional RTMP library options may be appended as |
5564d7f2ed5a
Implement support to RTMP, RTMPT, RTMPE, RTMPTE, RTMPS protocols via
stefano
parents:
diff
changeset
|
51 * space-separated key-value pairs. |
5564d7f2ed5a
Implement support to RTMP, RTMPT, RTMPE, RTMPTE, RTMPS protocols via
stefano
parents:
diff
changeset
|
52 */ |
5564d7f2ed5a
Implement support to RTMP, RTMPT, RTMPE, RTMPTE, RTMPS protocols via
stefano
parents:
diff
changeset
|
53 static int rtmp_open(URLContext *s, const char *uri, int flags) |
5564d7f2ed5a
Implement support to RTMP, RTMPT, RTMPE, RTMPTE, RTMPS protocols via
stefano
parents:
diff
changeset
|
54 { |
5564d7f2ed5a
Implement support to RTMP, RTMPT, RTMPE, RTMPTE, RTMPS protocols via
stefano
parents:
diff
changeset
|
55 RTMP *r; |
5564d7f2ed5a
Implement support to RTMP, RTMPT, RTMPE, RTMPTE, RTMPS protocols via
stefano
parents:
diff
changeset
|
56 int rc; |
5564d7f2ed5a
Implement support to RTMP, RTMPT, RTMPE, RTMPTE, RTMPS protocols via
stefano
parents:
diff
changeset
|
57 |
5564d7f2ed5a
Implement support to RTMP, RTMPT, RTMPE, RTMPTE, RTMPS protocols via
stefano
parents:
diff
changeset
|
58 r = av_mallocz(sizeof(RTMP)); |
5564d7f2ed5a
Implement support to RTMP, RTMPT, RTMPE, RTMPTE, RTMPS protocols via
stefano
parents:
diff
changeset
|
59 if (!r) |
5564d7f2ed5a
Implement support to RTMP, RTMPT, RTMPE, RTMPTE, RTMPS protocols via
stefano
parents:
diff
changeset
|
60 return AVERROR(ENOMEM); |
5564d7f2ed5a
Implement support to RTMP, RTMPT, RTMPE, RTMPTE, RTMPS protocols via
stefano
parents:
diff
changeset
|
61 |
5564d7f2ed5a
Implement support to RTMP, RTMPT, RTMPE, RTMPTE, RTMPS protocols via
stefano
parents:
diff
changeset
|
62 switch(av_log_get_level()) { |
5564d7f2ed5a
Implement support to RTMP, RTMPT, RTMPE, RTMPTE, RTMPS protocols via
stefano
parents:
diff
changeset
|
63 default: |
5564d7f2ed5a
Implement support to RTMP, RTMPT, RTMPE, RTMPTE, RTMPS protocols via
stefano
parents:
diff
changeset
|
64 case AV_LOG_FATAL: rc = RTMP_LOGCRIT; break; |
5564d7f2ed5a
Implement support to RTMP, RTMPT, RTMPE, RTMPTE, RTMPS protocols via
stefano
parents:
diff
changeset
|
65 case AV_LOG_ERROR: rc = RTMP_LOGERROR; break; |
5564d7f2ed5a
Implement support to RTMP, RTMPT, RTMPE, RTMPTE, RTMPS protocols via
stefano
parents:
diff
changeset
|
66 case AV_LOG_WARNING: rc = RTMP_LOGWARNING; break; |
5564d7f2ed5a
Implement support to RTMP, RTMPT, RTMPE, RTMPTE, RTMPS protocols via
stefano
parents:
diff
changeset
|
67 case AV_LOG_INFO: rc = RTMP_LOGINFO; break; |
5564d7f2ed5a
Implement support to RTMP, RTMPT, RTMPE, RTMPTE, RTMPS protocols via
stefano
parents:
diff
changeset
|
68 case AV_LOG_VERBOSE: rc = RTMP_LOGDEBUG; break; |
5564d7f2ed5a
Implement support to RTMP, RTMPT, RTMPE, RTMPTE, RTMPS protocols via
stefano
parents:
diff
changeset
|
69 case AV_LOG_DEBUG: rc = RTMP_LOGDEBUG2; break; |
5564d7f2ed5a
Implement support to RTMP, RTMPT, RTMPE, RTMPTE, RTMPS protocols via
stefano
parents:
diff
changeset
|
70 } |
5564d7f2ed5a
Implement support to RTMP, RTMPT, RTMPE, RTMPTE, RTMPS protocols via
stefano
parents:
diff
changeset
|
71 RTMP_LogSetLevel(rc); |
5564d7f2ed5a
Implement support to RTMP, RTMPT, RTMPE, RTMPTE, RTMPS protocols via
stefano
parents:
diff
changeset
|
72 |
5564d7f2ed5a
Implement support to RTMP, RTMPT, RTMPE, RTMPTE, RTMPS protocols via
stefano
parents:
diff
changeset
|
73 RTMP_Init(r); |
5564d7f2ed5a
Implement support to RTMP, RTMPT, RTMPE, RTMPTE, RTMPS protocols via
stefano
parents:
diff
changeset
|
74 if (!RTMP_SetupURL(r, s->filename)) { |
5564d7f2ed5a
Implement support to RTMP, RTMPT, RTMPE, RTMPTE, RTMPS protocols via
stefano
parents:
diff
changeset
|
75 rc = -1; |
5564d7f2ed5a
Implement support to RTMP, RTMPT, RTMPE, RTMPTE, RTMPS protocols via
stefano
parents:
diff
changeset
|
76 goto fail; |
5564d7f2ed5a
Implement support to RTMP, RTMPT, RTMPE, RTMPTE, RTMPS protocols via
stefano
parents:
diff
changeset
|
77 } |
5564d7f2ed5a
Implement support to RTMP, RTMPT, RTMPE, RTMPTE, RTMPS protocols via
stefano
parents:
diff
changeset
|
78 |
5564d7f2ed5a
Implement support to RTMP, RTMPT, RTMPE, RTMPTE, RTMPS protocols via
stefano
parents:
diff
changeset
|
79 if (flags & URL_WRONLY) |
5564d7f2ed5a
Implement support to RTMP, RTMPT, RTMPE, RTMPTE, RTMPS protocols via
stefano
parents:
diff
changeset
|
80 r->Link.protocol |= RTMP_FEATURE_WRITE; |
5564d7f2ed5a
Implement support to RTMP, RTMPT, RTMPE, RTMPTE, RTMPS protocols via
stefano
parents:
diff
changeset
|
81 |
5564d7f2ed5a
Implement support to RTMP, RTMPT, RTMPE, RTMPTE, RTMPS protocols via
stefano
parents:
diff
changeset
|
82 if (!RTMP_Connect(r, NULL) || !RTMP_ConnectStream(r, 0)) { |
5564d7f2ed5a
Implement support to RTMP, RTMPT, RTMPE, RTMPTE, RTMPS protocols via
stefano
parents:
diff
changeset
|
83 rc = -1; |
5564d7f2ed5a
Implement support to RTMP, RTMPT, RTMPE, RTMPTE, RTMPS protocols via
stefano
parents:
diff
changeset
|
84 goto fail; |
5564d7f2ed5a
Implement support to RTMP, RTMPT, RTMPE, RTMPTE, RTMPS protocols via
stefano
parents:
diff
changeset
|
85 } |
5564d7f2ed5a
Implement support to RTMP, RTMPT, RTMPE, RTMPTE, RTMPS protocols via
stefano
parents:
diff
changeset
|
86 |
5564d7f2ed5a
Implement support to RTMP, RTMPT, RTMPE, RTMPTE, RTMPS protocols via
stefano
parents:
diff
changeset
|
87 s->priv_data = r; |
5564d7f2ed5a
Implement support to RTMP, RTMPT, RTMPE, RTMPTE, RTMPS protocols via
stefano
parents:
diff
changeset
|
88 s->is_streamed = 1; |
5564d7f2ed5a
Implement support to RTMP, RTMPT, RTMPE, RTMPTE, RTMPS protocols via
stefano
parents:
diff
changeset
|
89 return 0; |
5564d7f2ed5a
Implement support to RTMP, RTMPT, RTMPE, RTMPTE, RTMPS protocols via
stefano
parents:
diff
changeset
|
90 fail: |
5564d7f2ed5a
Implement support to RTMP, RTMPT, RTMPE, RTMPTE, RTMPS protocols via
stefano
parents:
diff
changeset
|
91 av_free(r); |
5564d7f2ed5a
Implement support to RTMP, RTMPT, RTMPE, RTMPTE, RTMPS protocols via
stefano
parents:
diff
changeset
|
92 return rc; |
5564d7f2ed5a
Implement support to RTMP, RTMPT, RTMPE, RTMPTE, RTMPS protocols via
stefano
parents:
diff
changeset
|
93 } |
5564d7f2ed5a
Implement support to RTMP, RTMPT, RTMPE, RTMPTE, RTMPS protocols via
stefano
parents:
diff
changeset
|
94 |
5564d7f2ed5a
Implement support to RTMP, RTMPT, RTMPE, RTMPTE, RTMPS protocols via
stefano
parents:
diff
changeset
|
95 static int rtmp_write(URLContext *s, uint8_t *buf, int size) |
5564d7f2ed5a
Implement support to RTMP, RTMPT, RTMPE, RTMPTE, RTMPS protocols via
stefano
parents:
diff
changeset
|
96 { |
5564d7f2ed5a
Implement support to RTMP, RTMPT, RTMPE, RTMPTE, RTMPS protocols via
stefano
parents:
diff
changeset
|
97 RTMP *r = s->priv_data; |
5564d7f2ed5a
Implement support to RTMP, RTMPT, RTMPE, RTMPTE, RTMPS protocols via
stefano
parents:
diff
changeset
|
98 |
5564d7f2ed5a
Implement support to RTMP, RTMPT, RTMPE, RTMPTE, RTMPS protocols via
stefano
parents:
diff
changeset
|
99 return RTMP_Write(r, buf, size); |
5564d7f2ed5a
Implement support to RTMP, RTMPT, RTMPE, RTMPTE, RTMPS protocols via
stefano
parents:
diff
changeset
|
100 } |
5564d7f2ed5a
Implement support to RTMP, RTMPT, RTMPE, RTMPTE, RTMPS protocols via
stefano
parents:
diff
changeset
|
101 |
5564d7f2ed5a
Implement support to RTMP, RTMPT, RTMPE, RTMPTE, RTMPS protocols via
stefano
parents:
diff
changeset
|
102 static int rtmp_read(URLContext *s, uint8_t *buf, int size) |
5564d7f2ed5a
Implement support to RTMP, RTMPT, RTMPE, RTMPTE, RTMPS protocols via
stefano
parents:
diff
changeset
|
103 { |
5564d7f2ed5a
Implement support to RTMP, RTMPT, RTMPE, RTMPTE, RTMPS protocols via
stefano
parents:
diff
changeset
|
104 RTMP *r = s->priv_data; |
5564d7f2ed5a
Implement support to RTMP, RTMPT, RTMPE, RTMPTE, RTMPS protocols via
stefano
parents:
diff
changeset
|
105 |
5564d7f2ed5a
Implement support to RTMP, RTMPT, RTMPE, RTMPTE, RTMPS protocols via
stefano
parents:
diff
changeset
|
106 return RTMP_Read(r, buf, size); |
5564d7f2ed5a
Implement support to RTMP, RTMPT, RTMPE, RTMPTE, RTMPS protocols via
stefano
parents:
diff
changeset
|
107 } |
5564d7f2ed5a
Implement support to RTMP, RTMPT, RTMPE, RTMPTE, RTMPS protocols via
stefano
parents:
diff
changeset
|
108 |
5564d7f2ed5a
Implement support to RTMP, RTMPT, RTMPE, RTMPTE, RTMPS protocols via
stefano
parents:
diff
changeset
|
109 static int rtmp_read_pause(URLContext *s, int pause) |
5564d7f2ed5a
Implement support to RTMP, RTMPT, RTMPE, RTMPTE, RTMPS protocols via
stefano
parents:
diff
changeset
|
110 { |
5564d7f2ed5a
Implement support to RTMP, RTMPT, RTMPE, RTMPTE, RTMPS protocols via
stefano
parents:
diff
changeset
|
111 RTMP *r = s->priv_data; |
5564d7f2ed5a
Implement support to RTMP, RTMPT, RTMPE, RTMPTE, RTMPS protocols via
stefano
parents:
diff
changeset
|
112 |
5564d7f2ed5a
Implement support to RTMP, RTMPT, RTMPE, RTMPTE, RTMPS protocols via
stefano
parents:
diff
changeset
|
113 if (pause) |
5564d7f2ed5a
Implement support to RTMP, RTMPT, RTMPE, RTMPTE, RTMPS protocols via
stefano
parents:
diff
changeset
|
114 r->m_pauseStamp = |
5564d7f2ed5a
Implement support to RTMP, RTMPT, RTMPE, RTMPTE, RTMPS protocols via
stefano
parents:
diff
changeset
|
115 r->m_channelTimestamp[r->m_mediaChannel]; |
5564d7f2ed5a
Implement support to RTMP, RTMPT, RTMPE, RTMPTE, RTMPS protocols via
stefano
parents:
diff
changeset
|
116 if (!RTMP_SendPause(r, pause, r->m_pauseStamp)) |
5564d7f2ed5a
Implement support to RTMP, RTMPT, RTMPE, RTMPTE, RTMPS protocols via
stefano
parents:
diff
changeset
|
117 return -1; |
5564d7f2ed5a
Implement support to RTMP, RTMPT, RTMPE, RTMPTE, RTMPS protocols via
stefano
parents:
diff
changeset
|
118 return 0; |
5564d7f2ed5a
Implement support to RTMP, RTMPT, RTMPE, RTMPTE, RTMPS protocols via
stefano
parents:
diff
changeset
|
119 } |
5564d7f2ed5a
Implement support to RTMP, RTMPT, RTMPE, RTMPTE, RTMPS protocols via
stefano
parents:
diff
changeset
|
120 |
5564d7f2ed5a
Implement support to RTMP, RTMPT, RTMPE, RTMPTE, RTMPS protocols via
stefano
parents:
diff
changeset
|
121 static int64_t rtmp_read_seek(URLContext *s, int stream_index, |
5564d7f2ed5a
Implement support to RTMP, RTMPT, RTMPE, RTMPTE, RTMPS protocols via
stefano
parents:
diff
changeset
|
122 int64_t timestamp, int flags) |
5564d7f2ed5a
Implement support to RTMP, RTMPT, RTMPE, RTMPTE, RTMPS protocols via
stefano
parents:
diff
changeset
|
123 { |
5564d7f2ed5a
Implement support to RTMP, RTMPT, RTMPE, RTMPTE, RTMPS protocols via
stefano
parents:
diff
changeset
|
124 RTMP *r = s->priv_data; |
5564d7f2ed5a
Implement support to RTMP, RTMPT, RTMPE, RTMPTE, RTMPS protocols via
stefano
parents:
diff
changeset
|
125 |
5564d7f2ed5a
Implement support to RTMP, RTMPT, RTMPE, RTMPTE, RTMPS protocols via
stefano
parents:
diff
changeset
|
126 if (flags & AVSEEK_FLAG_BYTE) |
5564d7f2ed5a
Implement support to RTMP, RTMPT, RTMPE, RTMPTE, RTMPS protocols via
stefano
parents:
diff
changeset
|
127 return AVERROR_NOTSUPP; |
5564d7f2ed5a
Implement support to RTMP, RTMPT, RTMPE, RTMPTE, RTMPS protocols via
stefano
parents:
diff
changeset
|
128 |
5564d7f2ed5a
Implement support to RTMP, RTMPT, RTMPE, RTMPTE, RTMPS protocols via
stefano
parents:
diff
changeset
|
129 /* seeks are in milliseconds */ |
5564d7f2ed5a
Implement support to RTMP, RTMPT, RTMPE, RTMPTE, RTMPS protocols via
stefano
parents:
diff
changeset
|
130 timestamp = av_rescale(timestamp, AV_TIME_BASE, 1000); |
5564d7f2ed5a
Implement support to RTMP, RTMPT, RTMPE, RTMPTE, RTMPS protocols via
stefano
parents:
diff
changeset
|
131 if (!RTMP_SendSeek(r, timestamp)) |
5564d7f2ed5a
Implement support to RTMP, RTMPT, RTMPE, RTMPTE, RTMPS protocols via
stefano
parents:
diff
changeset
|
132 return -1; |
5564d7f2ed5a
Implement support to RTMP, RTMPT, RTMPE, RTMPTE, RTMPS protocols via
stefano
parents:
diff
changeset
|
133 return timestamp; |
5564d7f2ed5a
Implement support to RTMP, RTMPT, RTMPE, RTMPTE, RTMPS protocols via
stefano
parents:
diff
changeset
|
134 } |
5564d7f2ed5a
Implement support to RTMP, RTMPT, RTMPE, RTMPTE, RTMPS protocols via
stefano
parents:
diff
changeset
|
135 |
5564d7f2ed5a
Implement support to RTMP, RTMPT, RTMPE, RTMPTE, RTMPS protocols via
stefano
parents:
diff
changeset
|
136 static int rtmp_get_file_handle(URLContext *s) |
5564d7f2ed5a
Implement support to RTMP, RTMPT, RTMPE, RTMPTE, RTMPS protocols via
stefano
parents:
diff
changeset
|
137 { |
5564d7f2ed5a
Implement support to RTMP, RTMPT, RTMPE, RTMPTE, RTMPS protocols via
stefano
parents:
diff
changeset
|
138 RTMP *r = s->priv_data; |
5564d7f2ed5a
Implement support to RTMP, RTMPT, RTMPE, RTMPTE, RTMPS protocols via
stefano
parents:
diff
changeset
|
139 |
5564d7f2ed5a
Implement support to RTMP, RTMPT, RTMPE, RTMPTE, RTMPS protocols via
stefano
parents:
diff
changeset
|
140 return r->m_sb.sb_socket; |
5564d7f2ed5a
Implement support to RTMP, RTMPT, RTMPE, RTMPTE, RTMPS protocols via
stefano
parents:
diff
changeset
|
141 } |
5564d7f2ed5a
Implement support to RTMP, RTMPT, RTMPE, RTMPTE, RTMPS protocols via
stefano
parents:
diff
changeset
|
142 |
5564d7f2ed5a
Implement support to RTMP, RTMPT, RTMPE, RTMPTE, RTMPS protocols via
stefano
parents:
diff
changeset
|
143 URLProtocol rtmp_protocol = { |
5564d7f2ed5a
Implement support to RTMP, RTMPT, RTMPE, RTMPTE, RTMPS protocols via
stefano
parents:
diff
changeset
|
144 "rtmp", |
5564d7f2ed5a
Implement support to RTMP, RTMPT, RTMPE, RTMPTE, RTMPS protocols via
stefano
parents:
diff
changeset
|
145 rtmp_open, |
5564d7f2ed5a
Implement support to RTMP, RTMPT, RTMPE, RTMPTE, RTMPS protocols via
stefano
parents:
diff
changeset
|
146 rtmp_read, |
5564d7f2ed5a
Implement support to RTMP, RTMPT, RTMPE, RTMPTE, RTMPS protocols via
stefano
parents:
diff
changeset
|
147 rtmp_write, |
5564d7f2ed5a
Implement support to RTMP, RTMPT, RTMPE, RTMPTE, RTMPS protocols via
stefano
parents:
diff
changeset
|
148 NULL, /* seek */ |
5564d7f2ed5a
Implement support to RTMP, RTMPT, RTMPE, RTMPTE, RTMPS protocols via
stefano
parents:
diff
changeset
|
149 rtmp_close, |
5564d7f2ed5a
Implement support to RTMP, RTMPT, RTMPE, RTMPTE, RTMPS protocols via
stefano
parents:
diff
changeset
|
150 NULL, /* next */ |
5564d7f2ed5a
Implement support to RTMP, RTMPT, RTMPE, RTMPTE, RTMPS protocols via
stefano
parents:
diff
changeset
|
151 rtmp_read_pause, |
5564d7f2ed5a
Implement support to RTMP, RTMPT, RTMPE, RTMPTE, RTMPS protocols via
stefano
parents:
diff
changeset
|
152 rtmp_read_seek, |
5564d7f2ed5a
Implement support to RTMP, RTMPT, RTMPE, RTMPTE, RTMPS protocols via
stefano
parents:
diff
changeset
|
153 rtmp_get_file_handle |
5564d7f2ed5a
Implement support to RTMP, RTMPT, RTMPE, RTMPTE, RTMPS protocols via
stefano
parents:
diff
changeset
|
154 }; |
5564d7f2ed5a
Implement support to RTMP, RTMPT, RTMPE, RTMPTE, RTMPS protocols via
stefano
parents:
diff
changeset
|
155 |
5564d7f2ed5a
Implement support to RTMP, RTMPT, RTMPE, RTMPTE, RTMPS protocols via
stefano
parents:
diff
changeset
|
156 URLProtocol rtmpt_protocol = { |
5564d7f2ed5a
Implement support to RTMP, RTMPT, RTMPE, RTMPTE, RTMPS protocols via
stefano
parents:
diff
changeset
|
157 "rtmpt", |
5564d7f2ed5a
Implement support to RTMP, RTMPT, RTMPE, RTMPTE, RTMPS protocols via
stefano
parents:
diff
changeset
|
158 rtmp_open, |
5564d7f2ed5a
Implement support to RTMP, RTMPT, RTMPE, RTMPTE, RTMPS protocols via
stefano
parents:
diff
changeset
|
159 rtmp_read, |
5564d7f2ed5a
Implement support to RTMP, RTMPT, RTMPE, RTMPTE, RTMPS protocols via
stefano
parents:
diff
changeset
|
160 rtmp_write, |
5564d7f2ed5a
Implement support to RTMP, RTMPT, RTMPE, RTMPTE, RTMPS protocols via
stefano
parents:
diff
changeset
|
161 NULL, /* seek */ |
5564d7f2ed5a
Implement support to RTMP, RTMPT, RTMPE, RTMPTE, RTMPS protocols via
stefano
parents:
diff
changeset
|
162 rtmp_close, |
5564d7f2ed5a
Implement support to RTMP, RTMPT, RTMPE, RTMPTE, RTMPS protocols via
stefano
parents:
diff
changeset
|
163 NULL, /* next */ |
5564d7f2ed5a
Implement support to RTMP, RTMPT, RTMPE, RTMPTE, RTMPS protocols via
stefano
parents:
diff
changeset
|
164 rtmp_read_pause, |
5564d7f2ed5a
Implement support to RTMP, RTMPT, RTMPE, RTMPTE, RTMPS protocols via
stefano
parents:
diff
changeset
|
165 rtmp_read_seek, |
5564d7f2ed5a
Implement support to RTMP, RTMPT, RTMPE, RTMPTE, RTMPS protocols via
stefano
parents:
diff
changeset
|
166 rtmp_get_file_handle |
5564d7f2ed5a
Implement support to RTMP, RTMPT, RTMPE, RTMPTE, RTMPS protocols via
stefano
parents:
diff
changeset
|
167 }; |
5564d7f2ed5a
Implement support to RTMP, RTMPT, RTMPE, RTMPTE, RTMPS protocols via
stefano
parents:
diff
changeset
|
168 |
5564d7f2ed5a
Implement support to RTMP, RTMPT, RTMPE, RTMPTE, RTMPS protocols via
stefano
parents:
diff
changeset
|
169 URLProtocol rtmpe_protocol = { |
5564d7f2ed5a
Implement support to RTMP, RTMPT, RTMPE, RTMPTE, RTMPS protocols via
stefano
parents:
diff
changeset
|
170 "rtmpe", |
5564d7f2ed5a
Implement support to RTMP, RTMPT, RTMPE, RTMPTE, RTMPS protocols via
stefano
parents:
diff
changeset
|
171 rtmp_open, |
5564d7f2ed5a
Implement support to RTMP, RTMPT, RTMPE, RTMPTE, RTMPS protocols via
stefano
parents:
diff
changeset
|
172 rtmp_read, |
5564d7f2ed5a
Implement support to RTMP, RTMPT, RTMPE, RTMPTE, RTMPS protocols via
stefano
parents:
diff
changeset
|
173 rtmp_write, |
5564d7f2ed5a
Implement support to RTMP, RTMPT, RTMPE, RTMPTE, RTMPS protocols via
stefano
parents:
diff
changeset
|
174 NULL, /* seek */ |
5564d7f2ed5a
Implement support to RTMP, RTMPT, RTMPE, RTMPTE, RTMPS protocols via
stefano
parents:
diff
changeset
|
175 rtmp_close, |
5564d7f2ed5a
Implement support to RTMP, RTMPT, RTMPE, RTMPTE, RTMPS protocols via
stefano
parents:
diff
changeset
|
176 NULL, /* next */ |
5564d7f2ed5a
Implement support to RTMP, RTMPT, RTMPE, RTMPTE, RTMPS protocols via
stefano
parents:
diff
changeset
|
177 rtmp_read_pause, |
5564d7f2ed5a
Implement support to RTMP, RTMPT, RTMPE, RTMPTE, RTMPS protocols via
stefano
parents:
diff
changeset
|
178 rtmp_read_seek, |
5564d7f2ed5a
Implement support to RTMP, RTMPT, RTMPE, RTMPTE, RTMPS protocols via
stefano
parents:
diff
changeset
|
179 rtmp_get_file_handle |
5564d7f2ed5a
Implement support to RTMP, RTMPT, RTMPE, RTMPTE, RTMPS protocols via
stefano
parents:
diff
changeset
|
180 }; |
5564d7f2ed5a
Implement support to RTMP, RTMPT, RTMPE, RTMPTE, RTMPS protocols via
stefano
parents:
diff
changeset
|
181 |
5564d7f2ed5a
Implement support to RTMP, RTMPT, RTMPE, RTMPTE, RTMPS protocols via
stefano
parents:
diff
changeset
|
182 URLProtocol rtmpte_protocol = { |
5564d7f2ed5a
Implement support to RTMP, RTMPT, RTMPE, RTMPTE, RTMPS protocols via
stefano
parents:
diff
changeset
|
183 "rtmpte", |
5564d7f2ed5a
Implement support to RTMP, RTMPT, RTMPE, RTMPTE, RTMPS protocols via
stefano
parents:
diff
changeset
|
184 rtmp_open, |
5564d7f2ed5a
Implement support to RTMP, RTMPT, RTMPE, RTMPTE, RTMPS protocols via
stefano
parents:
diff
changeset
|
185 rtmp_read, |
5564d7f2ed5a
Implement support to RTMP, RTMPT, RTMPE, RTMPTE, RTMPS protocols via
stefano
parents:
diff
changeset
|
186 rtmp_write, |
5564d7f2ed5a
Implement support to RTMP, RTMPT, RTMPE, RTMPTE, RTMPS protocols via
stefano
parents:
diff
changeset
|
187 NULL, /* seek */ |
5564d7f2ed5a
Implement support to RTMP, RTMPT, RTMPE, RTMPTE, RTMPS protocols via
stefano
parents:
diff
changeset
|
188 rtmp_close, |
5564d7f2ed5a
Implement support to RTMP, RTMPT, RTMPE, RTMPTE, RTMPS protocols via
stefano
parents:
diff
changeset
|
189 NULL, /* next */ |
5564d7f2ed5a
Implement support to RTMP, RTMPT, RTMPE, RTMPTE, RTMPS protocols via
stefano
parents:
diff
changeset
|
190 rtmp_read_pause, |
5564d7f2ed5a
Implement support to RTMP, RTMPT, RTMPE, RTMPTE, RTMPS protocols via
stefano
parents:
diff
changeset
|
191 rtmp_read_seek, |
5564d7f2ed5a
Implement support to RTMP, RTMPT, RTMPE, RTMPTE, RTMPS protocols via
stefano
parents:
diff
changeset
|
192 rtmp_get_file_handle |
5564d7f2ed5a
Implement support to RTMP, RTMPT, RTMPE, RTMPTE, RTMPS protocols via
stefano
parents:
diff
changeset
|
193 }; |
5564d7f2ed5a
Implement support to RTMP, RTMPT, RTMPE, RTMPTE, RTMPS protocols via
stefano
parents:
diff
changeset
|
194 |
5564d7f2ed5a
Implement support to RTMP, RTMPT, RTMPE, RTMPTE, RTMPS protocols via
stefano
parents:
diff
changeset
|
195 URLProtocol rtmps_protocol = { |
5564d7f2ed5a
Implement support to RTMP, RTMPT, RTMPE, RTMPTE, RTMPS protocols via
stefano
parents:
diff
changeset
|
196 "rtmps", |
5564d7f2ed5a
Implement support to RTMP, RTMPT, RTMPE, RTMPTE, RTMPS protocols via
stefano
parents:
diff
changeset
|
197 rtmp_open, |
5564d7f2ed5a
Implement support to RTMP, RTMPT, RTMPE, RTMPTE, RTMPS protocols via
stefano
parents:
diff
changeset
|
198 rtmp_read, |
5564d7f2ed5a
Implement support to RTMP, RTMPT, RTMPE, RTMPTE, RTMPS protocols via
stefano
parents:
diff
changeset
|
199 rtmp_write, |
5564d7f2ed5a
Implement support to RTMP, RTMPT, RTMPE, RTMPTE, RTMPS protocols via
stefano
parents:
diff
changeset
|
200 NULL, /* seek */ |
5564d7f2ed5a
Implement support to RTMP, RTMPT, RTMPE, RTMPTE, RTMPS protocols via
stefano
parents:
diff
changeset
|
201 rtmp_close, |
5564d7f2ed5a
Implement support to RTMP, RTMPT, RTMPE, RTMPTE, RTMPS protocols via
stefano
parents:
diff
changeset
|
202 NULL, /* next */ |
5564d7f2ed5a
Implement support to RTMP, RTMPT, RTMPE, RTMPTE, RTMPS protocols via
stefano
parents:
diff
changeset
|
203 rtmp_read_pause, |
5564d7f2ed5a
Implement support to RTMP, RTMPT, RTMPE, RTMPTE, RTMPS protocols via
stefano
parents:
diff
changeset
|
204 rtmp_read_seek, |
5564d7f2ed5a
Implement support to RTMP, RTMPT, RTMPE, RTMPTE, RTMPS protocols via
stefano
parents:
diff
changeset
|
205 rtmp_get_file_handle |
5564d7f2ed5a
Implement support to RTMP, RTMPT, RTMPE, RTMPTE, RTMPS protocols via
stefano
parents:
diff
changeset
|
206 }; |