annotate rm.h @ 4036:1349c277efbd libavformat

Add ByteIOContext argument to public ff_rm_* functions so that we can specify the data source as function argument instead of in s->pb before calling the function. Discussed in ML thread "[PATCH] fix small memleak in rdt.c".
author rbultje
date Mon, 17 Nov 2008 14:20:00 +0000
parents 5f9bec099c69
children 233ba738a68e
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
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
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
3 * Copyright (c) 2000, 2001 Fabrice Bellard.
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
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
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
8 * modify it under the terms of the GNU Lesser General Public
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
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
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
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
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
15 * Lesser General Public License for more details.
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
16 *
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
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
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
20 */
2103
95139f2053a9 split rm muxer and demuxer in their own files
aurel
parents: 2024
diff changeset
21
3852
1b6245500d8c Globally rename the header inclusion guard names.
stefano
parents: 3617
diff changeset
22 #ifndef AVFORMAT_RM_H
1b6245500d8c Globally rename the header inclusion guard names.
stefano
parents: 3617
diff changeset
23 #define AVFORMAT_RM_H
2103
95139f2053a9 split rm muxer and demuxer in their own files
aurel
parents: 2024
diff changeset
24
0
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
25 #include "avformat.h"
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
26
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
27
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
28 typedef struct {
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
29 int nb_packets;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
30 int packet_total_size;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
31 int packet_max_size;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
32 /* codec related output */
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
33 int bit_rate;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
34 float frame_rate;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
35 int nb_frames; /* current frame number */
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
36 int total_frames; /* total number of frames */
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
37 int num;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
38 AVCodecContext *enc;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
39 } StreamInfo;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
40
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
41 typedef struct {
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
42 StreamInfo streams[2];
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
43 StreamInfo *audio_stream, *video_stream;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
44 int data_pos; /* position of the data after the header */
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
45 int nb_packets;
194
37e7cd3d544d support for older real audio files (<= version 3)
bellard
parents: 188
diff changeset
46 int old_format;
609
2f0de265bc5e various demuxer fixes
michael
parents: 608
diff changeset
47 int current_stream;
2f0de265bc5e various demuxer fixes
michael
parents: 608
diff changeset
48 int remaining_len;
2653
67667d13bab5 Demux full frames instead of sliced for RealVideo.
kostya
parents: 2620
diff changeset
49 uint8_t *videobuf; ///< place to store merged video frame
67667d13bab5 Demux full frames instead of sliced for RealVideo.
kostya
parents: 2620
diff changeset
50 int videobufsize; ///< current assembled frame size
67667d13bab5 Demux full frames instead of sliced for RealVideo.
kostya
parents: 2620
diff changeset
51 int videobufpos; ///< position for the next slice in the video buffer
67667d13bab5 Demux full frames instead of sliced for RealVideo.
kostya
parents: 2620
diff changeset
52 int curpic_num; ///< picture number of current frame
67667d13bab5 Demux full frames instead of sliced for RealVideo.
kostya
parents: 2620
diff changeset
53 int cur_slice, slices;
2696
7671acabd99c Seek regression for RM demuxer fix
kostya
parents: 2653
diff changeset
54 int64_t pktpos; ///< first slice position in file
879
1f093ae472d8 Cook compatibe decoder, patch by Benjamin Larsson
rtognimp
parents: 858
diff changeset
55 /// Audio descrambling matrix parameters
1f093ae472d8 Cook compatibe decoder, patch by Benjamin Larsson
rtognimp
parents: 858
diff changeset
56 uint8_t *audiobuf; ///< place to store reordered audio data
1f093ae472d8 Cook compatibe decoder, patch by Benjamin Larsson
rtognimp
parents: 858
diff changeset
57 int64_t audiotimestamp; ///< Audio packet timestamp
1f093ae472d8 Cook compatibe decoder, patch by Benjamin Larsson
rtognimp
parents: 858
diff changeset
58 int sub_packet_cnt; // Subpacket counter, used while reading
1f093ae472d8 Cook compatibe decoder, patch by Benjamin Larsson
rtognimp
parents: 858
diff changeset
59 int sub_packet_size, sub_packet_h, coded_framesize; ///< Descrambling parameters from container
1f093ae472d8 Cook compatibe decoder, patch by Benjamin Larsson
rtognimp
parents: 858
diff changeset
60 int audio_stream_num; ///< Stream number for audio packets
1f093ae472d8 Cook compatibe decoder, patch by Benjamin Larsson
rtognimp
parents: 858
diff changeset
61 int audio_pkt_cnt; ///< Output packet counter
1f093ae472d8 Cook compatibe decoder, patch by Benjamin Larsson
rtognimp
parents: 858
diff changeset
62 int audio_framesize; /// Audio frame size from container
1105
d187ac890c0e Support for AAC (fourcc raac and racp) in rm files
rtogni
parents: 1079
diff changeset
63 int sub_packet_lengths[16]; /// Length of each aac subpacket
0
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
64 } RMContext;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
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
60275d3b2e42 Make three rm demuxer functions non static.
benoit
parents: 2696
diff changeset
69 /**
60275d3b2e42 Make three rm demuxer functions non static.
benoit
parents: 2696
diff changeset
70 * Read the MDPR chunk, which contains stream-specific codec initialization
60275d3b2e42 Make three rm demuxer functions non static.
benoit
parents: 2696
diff changeset
71 * parameters.
60275d3b2e42 Make three rm demuxer functions non static.
benoit
parents: 2696
diff changeset
72 *
60275d3b2e42 Make three rm demuxer functions non static.
benoit
parents: 2696
diff changeset
73 * @param s context containing RMContext and ByteIOContext for stream reading
4036
1349c277efbd Add ByteIOContext argument to public ff_rm_* functions so that we can
rbultje
parents: 3902
diff changeset
74 * @param pb context to read the data from
2889
60275d3b2e42 Make three rm demuxer functions non static.
benoit
parents: 2696
diff changeset
75 * @param st the stream that the MDPR chunk belongs to and where to store the
60275d3b2e42 Make three rm demuxer functions non static.
benoit
parents: 2696
diff changeset
76 * 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
77 * @param codec_data_size size of the MDPR chunk
2889
60275d3b2e42 Make three rm demuxer functions non static.
benoit
parents: 2696
diff changeset
78 * @return 0 on success, errno codes on error
60275d3b2e42 Make three rm demuxer functions non static.
benoit
parents: 2696
diff changeset
79 */
4036
1349c277efbd Add ByteIOContext argument to public ff_rm_* functions so that we can
rbultje
parents: 3902
diff changeset
80 int ff_rm_read_mdpr_codecdata (AVFormatContext *s, ByteIOContext *pb,
1349c277efbd Add ByteIOContext argument to public ff_rm_* functions so that we can
rbultje
parents: 3902
diff changeset
81 AVStream *st, int codec_data_size);
2889
60275d3b2e42 Make three rm demuxer functions non static.
benoit
parents: 2696
diff changeset
82
60275d3b2e42 Make three rm demuxer functions non static.
benoit
parents: 2696
diff changeset
83 /**
60275d3b2e42 Make three rm demuxer functions non static.
benoit
parents: 2696
diff changeset
84 * Parse one rm-stream packet from the input bytestream.
60275d3b2e42 Make three rm demuxer functions non static.
benoit
parents: 2696
diff changeset
85 *
60275d3b2e42 Make three rm demuxer functions non static.
benoit
parents: 2696
diff changeset
86 * @param s context containing RMContext and ByteIOContext for stream reading
4036
1349c277efbd Add ByteIOContext argument to public ff_rm_* functions so that we can
rbultje
parents: 3902
diff changeset
87 * @param pb context to read the data from
2889
60275d3b2e42 Make three rm demuxer functions non static.
benoit
parents: 2696
diff changeset
88 * @param st stream to which the packet to be read belongs
60275d3b2e42 Make three rm demuxer functions non static.
benoit
parents: 2696
diff changeset
89 * @param len packet length to read from the input
60275d3b2e42 Make three rm demuxer functions non static.
benoit
parents: 2696
diff changeset
90 * @param pkt packet location to store the parsed packet data
60275d3b2e42 Make three rm demuxer functions non static.
benoit
parents: 2696
diff changeset
91 * @param seq pointer to an integer containing the sequence number, may be
60275d3b2e42 Make three rm demuxer functions non static.
benoit
parents: 2696
diff changeset
92 * updated
60275d3b2e42 Make three rm demuxer functions non static.
benoit
parents: 2696
diff changeset
93 * @param flags pointer to an integer containing the packet flags, may be
60275d3b2e42 Make three rm demuxer functions non static.
benoit
parents: 2696
diff changeset
94 updated
60275d3b2e42 Make three rm demuxer functions non static.
benoit
parents: 2696
diff changeset
95 * @param ts pointer to timestamp, may be updated
60275d3b2e42 Make three rm demuxer functions non static.
benoit
parents: 2696
diff changeset
96 * @return 0 on success, errno codes on error
60275d3b2e42 Make three rm demuxer functions non static.
benoit
parents: 2696
diff changeset
97 */
4036
1349c277efbd Add ByteIOContext argument to public ff_rm_* functions so that we can
rbultje
parents: 3902
diff changeset
98 int ff_rm_parse_packet (AVFormatContext *s, ByteIOContext *pb,
1349c277efbd Add ByteIOContext argument to public ff_rm_* functions so that we can
rbultje
parents: 3902
diff changeset
99 AVStream *st, int len,
2889
60275d3b2e42 Make three rm demuxer functions non static.
benoit
parents: 2696
diff changeset
100 AVPacket *pkt, int *seq, int *flags, int64_t *ts);
60275d3b2e42 Make three rm demuxer functions non static.
benoit
parents: 2696
diff changeset
101
60275d3b2e42 Make three rm demuxer functions non static.
benoit
parents: 2696
diff changeset
102 /**
60275d3b2e42 Make three rm demuxer functions non static.
benoit
parents: 2696
diff changeset
103 * Retrieve one cached packet from the rm-context. The real container can
60275d3b2e42 Make three rm demuxer functions non static.
benoit
parents: 2696
diff changeset
104 * store several packets (as interpreted by the codec) in a single container
60275d3b2e42 Make three rm demuxer functions non static.
benoit
parents: 2696
diff changeset
105 * packet, which means the demuxer holds some back when the first container
60275d3b2e42 Make three rm demuxer functions non static.
benoit
parents: 2696
diff changeset
106 * packet is parsed and returned. The result is that rm->audio_pkt_cnt is
60275d3b2e42 Make three rm demuxer functions non static.
benoit
parents: 2696
diff changeset
107 * a positive number, the amount of cached packets. Using this function, each
60275d3b2e42 Make three rm demuxer functions non static.
benoit
parents: 2696
diff changeset
108 * of those packets can be retrieved sequentially.
60275d3b2e42 Make three rm demuxer functions non static.
benoit
parents: 2696
diff changeset
109 *
60275d3b2e42 Make three rm demuxer functions non static.
benoit
parents: 2696
diff changeset
110 * @param s context containing RMContext and ByteIOContext for stream reading
4036
1349c277efbd Add ByteIOContext argument to public ff_rm_* functions so that we can
rbultje
parents: 3902
diff changeset
111 * @param pb context to read the data from
2889
60275d3b2e42 Make three rm demuxer functions non static.
benoit
parents: 2696
diff changeset
112 * @param st stream that this packet belongs to
60275d3b2e42 Make three rm demuxer functions non static.
benoit
parents: 2696
diff changeset
113 * @param pkt location to store the packet data
60275d3b2e42 Make three rm demuxer functions non static.
benoit
parents: 2696
diff changeset
114 */
4036
1349c277efbd Add ByteIOContext argument to public ff_rm_* functions so that we can
rbultje
parents: 3902
diff changeset
115 void ff_rm_retrieve_cache (AVFormatContext *s, ByteIOContext *pb,
1349c277efbd Add ByteIOContext argument to public ff_rm_* functions so that we can
rbultje
parents: 3902
diff changeset
116 AVStream *st, AVPacket *pkt);
2889
60275d3b2e42 Make three rm demuxer functions non static.
benoit
parents: 2696
diff changeset
117
3852
1b6245500d8c Globally rename the header inclusion guard names.
stefano
parents: 3617
diff changeset
118 #endif /* AVFORMAT_RM_H */