blob: 8f47559a36dfcbefc418617df16e37aad02e1184 [file] [log] [blame]
Aurelien Jacobs7b2a2ce2007-05-30 09:44:161/*
2 * "Real" compatible muxer and demuxer.
Diego Biurrun406792e2009-01-19 15:46:403 * Copyright (c) 2000, 2001 Fabrice Bellard
Aurelien Jacobs7b2a2ce2007-05-30 09:44:164 *
5 * This file is part of FFmpeg.
6 *
7 * FFmpeg is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
11 *
12 * FFmpeg is distributed in the hope that it will be useful,
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
18 * License along with FFmpeg; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 */
21
Stefano Sabatini98790382008-08-31 07:39:4722#ifndef AVFORMAT_RM_H
23#define AVFORMAT_RM_H
Aurelien Jacobs7b2a2ce2007-05-30 09:44:1624
25#include "avformat.h"
Francesco Lavra74e8cca2010-05-28 18:18:3326#include "internal.h"
Aurelien Jacobs7b2a2ce2007-05-30 09:44:1627
Reimar Döffinger88e70e12009-09-06 08:57:1928extern const char * const ff_rm_metadata[4];
Francesco Lavra74e8cca2010-05-28 18:18:3329extern const AVCodecTag ff_rm_codec_tags[];
Aurelien Jacobs7379d5b2009-02-17 21:40:3830
Ronald S. Bultjeba614722008-12-28 00:18:3831typedef struct RMStream RMStream;
32
33RMStream *ff_rm_alloc_rmstream (void);
34void ff_rm_free_rmstream (RMStream *rms);
35
Ronald S. Bultjeff13ba92008-09-07 01:21:2436/*< input format for Realmedia-style RTSP streams */
Andreas Rheinhardtbc706842021-04-19 17:45:2437extern const AVInputFormat ff_rdt_demuxer;
Ronald S. Bultjeff13ba92008-09-07 01:21:2438
Ronald S. Bultje0fd36362008-01-04 13:00:4739/**
40 * Read the MDPR chunk, which contains stream-specific codec initialization
41 * parameters.
42 *
Anton Khirnov471fe572011-02-20 10:04:1243 * @param s context containing RMContext and AVIOContext for stream reading
Ronald S. Bultjefcc995a2008-11-17 14:20:0044 * @param pb context to read the data from
Ronald S. Bultje0fd36362008-01-04 13:00:4745 * @param st the stream that the MDPR chunk belongs to and where to store the
46 * parameters read from the chunk into
Ronald S. Bultje886e89d2008-12-28 00:21:1147 * @param rst real-specific stream information
Ronald S. Bultje79d50452008-09-03 00:05:5548 * @param codec_data_size size of the MDPR chunk
Ronald S. Bultje0fd36362008-01-04 13:00:4749 * @return 0 on success, errno codes on error
50 */
Anton Khirnov471fe572011-02-20 10:04:1251int ff_rm_read_mdpr_codecdata (AVFormatContext *s, AVIOContext *pb,
Ronald S. Bultje886e89d2008-12-28 00:21:1152 AVStream *st, RMStream *rst,
Michael Niedermayeref2f9072014-12-05 23:41:0053 unsigned int codec_data_size, const uint8_t *mime);
Ronald S. Bultje0fd36362008-01-04 13:00:4754
55/**
56 * Parse one rm-stream packet from the input bytestream.
57 *
Anton Khirnov471fe572011-02-20 10:04:1258 * @param s context containing RMContext and AVIOContext for stream reading
Ronald S. Bultjefcc995a2008-11-17 14:20:0059 * @param pb context to read the data from
Ronald S. Bultje0fd36362008-01-04 13:00:4760 * @param st stream to which the packet to be read belongs
Ronald S. Bultje886e89d2008-12-28 00:21:1161 * @param rst Real-specific stream information
Ronald S. Bultje0fd36362008-01-04 13:00:4762 * @param len packet length to read from the input
63 * @param pkt packet location to store the parsed packet data
64 * @param seq pointer to an integer containing the sequence number, may be
65 * updated
Ronald S. Bultje34bddc32009-07-30 15:04:1966 * @param flags the packet flags
67 * @param ts timestamp of the current packet
Stefano Sabatinibf7e7992009-06-06 09:35:1568 * @return <0 on error, 0 if a packet was placed in the pkt pointer. A
69 * value >0 means that no data was placed in pkt, but that cached
Ronald S. Bultjec5efef72009-03-16 12:57:4970 * data is available by calling ff_rm_retrieve_cache().
Ronald S. Bultje0fd36362008-01-04 13:00:4771 */
Anton Khirnov471fe572011-02-20 10:04:1272int ff_rm_parse_packet (AVFormatContext *s, AVIOContext *pb,
Ronald S. Bultje886e89d2008-12-28 00:21:1173 AVStream *st, RMStream *rst, int len,
Ronald S. Bultje34bddc32009-07-30 15:04:1974 AVPacket *pkt, int *seq, int flags, int64_t ts);
Ronald S. Bultje0fd36362008-01-04 13:00:4775
76/**
77 * Retrieve one cached packet from the rm-context. The real container can
78 * store several packets (as interpreted by the codec) in a single container
79 * packet, which means the demuxer holds some back when the first container
80 * packet is parsed and returned. The result is that rm->audio_pkt_cnt is
81 * a positive number, the amount of cached packets. Using this function, each
82 * of those packets can be retrieved sequentially.
83 *
Anton Khirnov471fe572011-02-20 10:04:1284 * @param s context containing RMContext and AVIOContext for stream reading
Ronald S. Bultjefcc995a2008-11-17 14:20:0085 * @param pb context to read the data from
Ronald S. Bultje0fd36362008-01-04 13:00:4786 * @param st stream that this packet belongs to
Ronald S. Bultje886e89d2008-12-28 00:21:1187 * @param rst Real-specific stream information
Ronald S. Bultje0fd36362008-01-04 13:00:4788 * @param pkt location to store the packet data
Benoit Fouet32e543f2010-03-30 15:50:5789 * @return the number of samples left for subsequent calls to this same
Ronald S. Bultjea9f84822008-12-28 05:58:2390 * function, or 0 if all samples have been retrieved.
Ronald S. Bultje0fd36362008-01-04 13:00:4791 */
Anton Khirnov471fe572011-02-20 10:04:1292int ff_rm_retrieve_cache (AVFormatContext *s, AVIOContext *pb,
Ronald S. Bultjeade8fb42008-12-28 05:59:1193 AVStream *st, RMStream *rst, AVPacket *pkt);
Ronald S. Bultje0fd36362008-01-04 13:00:4794
Stefano Sabatini98790382008-08-31 07:39:4795#endif /* AVFORMAT_RM_H */