Mercurial > libavformat.hg
annotate rm.h @ 3902:5f9bec099c69 libavformat
Add dynamic payload handlers to rdt.c. These follow the same API as the ones
in rtpdec.c, so that they can be shared and used in the same way in rtsp.c.
The handlers, since they are specific for RDT, are registered in rdt.c and
a new registration function is thus called from allformats.c.
The dynamic payload handler also implements RDT-specific SDP-line parsing for
OpaqueData and StartTime, which are specific for RDT and needed for proper
playback. OpaqueData contains one or a list ("MLTI") of "MDPR" chunks that
can be parsed by the rmdec.c function ff_rm_read_mdpr_codecdata(). To use
this function, we create a new rdt_demuxer, which has the same private data
as the rm_demuxer. The resulting AVFormatContext created with _open_stream()
can thus be used to call functions in the RM demuxer.
See discussion in "Realmedia patch" thread on ML.
author | rbultje |
---|---|
date | Sun, 07 Sep 2008 01:21:24 +0000 |
parents | 9a589ae59655 |
children | 1349c277efbd |
rev | line source |
---|---|
0 | 1 /* |
1415
3b00fb8ef8e4
replace coder/decoder file description in libavformat by muxer/demuxer
aurel
parents:
1358
diff
changeset
|
2 * "Real" compatible muxer and demuxer. |
0 | 3 * Copyright (c) 2000, 2001 Fabrice Bellard. |
4 * | |
1358
0899bfe4105c
Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents:
1350
diff
changeset
|
5 * This file is part of FFmpeg. |
0899bfe4105c
Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents:
1350
diff
changeset
|
6 * |
0899bfe4105c
Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents:
1350
diff
changeset
|
7 * FFmpeg is free software; you can redistribute it and/or |
0 | 8 * modify it under the terms of the GNU Lesser General Public |
9 * License as published by the Free Software Foundation; either | |
1358
0899bfe4105c
Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents:
1350
diff
changeset
|
10 * version 2.1 of the License, or (at your option) any later version. |
0 | 11 * |
1358
0899bfe4105c
Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents:
1350
diff
changeset
|
12 * FFmpeg is distributed in the hope that it will be useful, |
0 | 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
15 * Lesser General Public License for more details. | |
16 * | |
17 * You should have received a copy of the GNU Lesser General Public | |
1358
0899bfe4105c
Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents:
1350
diff
changeset
|
18 * License along with FFmpeg; if not, write to the Free Software |
896
edbe5c3717f9
Update licensing information: The FSF changed postal address.
diego
parents:
888
diff
changeset
|
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
0 | 20 */ |
2103 | 21 |
3852 | 22 #ifndef AVFORMAT_RM_H |
23 #define AVFORMAT_RM_H | |
2103 | 24 |
0 | 25 #include "avformat.h" |
26 | |
27 | |
28 typedef struct { | |
29 int nb_packets; | |
30 int packet_total_size; | |
31 int packet_max_size; | |
32 /* codec related output */ | |
33 int bit_rate; | |
34 float frame_rate; | |
35 int nb_frames; /* current frame number */ | |
36 int total_frames; /* total number of frames */ | |
37 int num; | |
38 AVCodecContext *enc; | |
39 } StreamInfo; | |
40 | |
41 typedef struct { | |
42 StreamInfo streams[2]; | |
43 StreamInfo *audio_stream, *video_stream; | |
44 int data_pos; /* position of the data after the header */ | |
45 int nb_packets; | |
194 | 46 int old_format; |
609 | 47 int current_stream; |
48 int remaining_len; | |
2653 | 49 uint8_t *videobuf; ///< place to store merged video frame |
50 int videobufsize; ///< current assembled frame size | |
51 int videobufpos; ///< position for the next slice in the video buffer | |
52 int curpic_num; ///< picture number of current frame | |
53 int cur_slice, slices; | |
2696 | 54 int64_t pktpos; ///< first slice position in file |
879 | 55 /// Audio descrambling matrix parameters |
56 uint8_t *audiobuf; ///< place to store reordered audio data | |
57 int64_t audiotimestamp; ///< Audio packet timestamp | |
58 int sub_packet_cnt; // Subpacket counter, used while reading | |
59 int sub_packet_size, sub_packet_h, coded_framesize; ///< Descrambling parameters from container | |
60 int audio_stream_num; ///< Stream number for audio packets | |
61 int audio_pkt_cnt; ///< Output packet counter | |
62 int audio_framesize; /// Audio frame size from container | |
1105 | 63 int sub_packet_lengths[16]; /// Length of each aac subpacket |
0 | 64 } RMContext; |
65 | |
3902
5f9bec099c69
Add dynamic payload handlers to rdt.c. These follow the same API as the ones
rbultje
parents:
3873
diff
changeset
|
66 /*< input format for Realmedia-style RTSP streams */ |
5f9bec099c69
Add dynamic payload handlers to rdt.c. These follow the same API as the ones
rbultje
parents:
3873
diff
changeset
|
67 extern AVInputFormat rdt_demuxer; |
5f9bec099c69
Add dynamic payload handlers to rdt.c. These follow the same API as the ones
rbultje
parents:
3873
diff
changeset
|
68 |
2889 | 69 /** |
70 * Read the MDPR chunk, which contains stream-specific codec initialization | |
71 * parameters. | |
72 * | |
73 * @param s context containing RMContext and ByteIOContext for stream reading | |
74 * @param st the stream that the MDPR chunk belongs to and where to store the | |
75 * parameters read from the chunk into | |
3873
9a589ae59655
Use chunk-size in function calling mdpr_read_codecdata() rather than in the
rbultje
parents:
3852
diff
changeset
|
76 * @param codec_data_size size of the MDPR chunk |
2889 | 77 * @return 0 on success, errno codes on error |
78 */ | |
3873
9a589ae59655
Use chunk-size in function calling mdpr_read_codecdata() rather than in the
rbultje
parents:
3852
diff
changeset
|
79 int ff_rm_read_mdpr_codecdata (AVFormatContext *s, AVStream *st, int codec_data_size); |
2889 | 80 |
81 /** | |
82 * Parse one rm-stream packet from the input bytestream. | |
83 * | |
84 * @param s context containing RMContext and ByteIOContext for stream reading | |
85 * @param st stream to which the packet to be read belongs | |
86 * @param len packet length to read from the input | |
87 * @param pkt packet location to store the parsed packet data | |
88 * @param seq pointer to an integer containing the sequence number, may be | |
89 * updated | |
90 * @param flags pointer to an integer containing the packet flags, may be | |
91 updated | |
92 * @param ts pointer to timestamp, may be updated | |
93 * @return 0 on success, errno codes on error | |
94 */ | |
95 int ff_rm_parse_packet (AVFormatContext *s, AVStream *st, int len, | |
96 AVPacket *pkt, int *seq, int *flags, int64_t *ts); | |
97 | |
98 /** | |
99 * Retrieve one cached packet from the rm-context. The real container can | |
100 * store several packets (as interpreted by the codec) in a single container | |
101 * packet, which means the demuxer holds some back when the first container | |
102 * packet is parsed and returned. The result is that rm->audio_pkt_cnt is | |
103 * a positive number, the amount of cached packets. Using this function, each | |
104 * of those packets can be retrieved sequentially. | |
105 * | |
106 * @param s context containing RMContext and ByteIOContext for stream reading | |
107 * @param st stream that this packet belongs to | |
108 * @param pkt location to store the packet data | |
109 */ | |
110 void ff_rm_retrieve_cache (AVFormatContext *s, AVStream *st, AVPacket *pkt); | |
111 | |
3852 | 112 #endif /* AVFORMAT_RM_H */ |