1cabdff1aSopenharmony_ci/*
2cabdff1aSopenharmony_ci * "Real" compatible muxer and demuxer.
3cabdff1aSopenharmony_ci * Copyright (c) 2000, 2001 Fabrice Bellard
4cabdff1aSopenharmony_ci *
5cabdff1aSopenharmony_ci * This file is part of FFmpeg.
6cabdff1aSopenharmony_ci *
7cabdff1aSopenharmony_ci * FFmpeg is free software; you can redistribute it and/or
8cabdff1aSopenharmony_ci * modify it under the terms of the GNU Lesser General Public
9cabdff1aSopenharmony_ci * License as published by the Free Software Foundation; either
10cabdff1aSopenharmony_ci * version 2.1 of the License, or (at your option) any later version.
11cabdff1aSopenharmony_ci *
12cabdff1aSopenharmony_ci * FFmpeg is distributed in the hope that it will be useful,
13cabdff1aSopenharmony_ci * but WITHOUT ANY WARRANTY; without even the implied warranty of
14cabdff1aSopenharmony_ci * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15cabdff1aSopenharmony_ci * Lesser General Public License for more details.
16cabdff1aSopenharmony_ci *
17cabdff1aSopenharmony_ci * You should have received a copy of the GNU Lesser General Public
18cabdff1aSopenharmony_ci * License along with FFmpeg; if not, write to the Free Software
19cabdff1aSopenharmony_ci * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20cabdff1aSopenharmony_ci */
21cabdff1aSopenharmony_ci
22cabdff1aSopenharmony_ci#ifndef AVFORMAT_RM_H
23cabdff1aSopenharmony_ci#define AVFORMAT_RM_H
24cabdff1aSopenharmony_ci
25cabdff1aSopenharmony_ci#include "avformat.h"
26cabdff1aSopenharmony_ci#include "internal.h"
27cabdff1aSopenharmony_ci
28cabdff1aSopenharmony_ciextern const char * const ff_rm_metadata[4];
29cabdff1aSopenharmony_ciextern const AVCodecTag ff_rm_codec_tags[];
30cabdff1aSopenharmony_ci
31cabdff1aSopenharmony_citypedef struct RMStream RMStream;
32cabdff1aSopenharmony_ci
33cabdff1aSopenharmony_ciRMStream *ff_rm_alloc_rmstream (void);
34cabdff1aSopenharmony_civoid      ff_rm_free_rmstream  (RMStream *rms);
35cabdff1aSopenharmony_ci
36cabdff1aSopenharmony_ci/*< input format for Realmedia-style RTSP streams */
37cabdff1aSopenharmony_ciextern const AVInputFormat ff_rdt_demuxer;
38cabdff1aSopenharmony_ci
39cabdff1aSopenharmony_ci/**
40cabdff1aSopenharmony_ci * Read the MDPR chunk, which contains stream-specific codec initialization
41cabdff1aSopenharmony_ci * parameters.
42cabdff1aSopenharmony_ci *
43cabdff1aSopenharmony_ci * @param s context containing RMContext and AVIOContext for stream reading
44cabdff1aSopenharmony_ci * @param pb context to read the data from
45cabdff1aSopenharmony_ci * @param st the stream that the MDPR chunk belongs to and where to store the
46cabdff1aSopenharmony_ci *           parameters read from the chunk into
47cabdff1aSopenharmony_ci * @param rst real-specific stream information
48cabdff1aSopenharmony_ci * @param codec_data_size size of the MDPR chunk
49cabdff1aSopenharmony_ci * @return 0 on success, errno codes on error
50cabdff1aSopenharmony_ci */
51cabdff1aSopenharmony_ciint ff_rm_read_mdpr_codecdata (AVFormatContext *s, AVIOContext *pb,
52cabdff1aSopenharmony_ci                               AVStream *st, RMStream *rst,
53cabdff1aSopenharmony_ci                               unsigned int codec_data_size, const uint8_t *mime);
54cabdff1aSopenharmony_ci
55cabdff1aSopenharmony_ci/**
56cabdff1aSopenharmony_ci * Parse one rm-stream packet from the input bytestream.
57cabdff1aSopenharmony_ci *
58cabdff1aSopenharmony_ci * @param s context containing RMContext and AVIOContext for stream reading
59cabdff1aSopenharmony_ci * @param pb context to read the data from
60cabdff1aSopenharmony_ci * @param st stream to which the packet to be read belongs
61cabdff1aSopenharmony_ci * @param rst Real-specific stream information
62cabdff1aSopenharmony_ci * @param len packet length to read from the input
63cabdff1aSopenharmony_ci * @param pkt packet location to store the parsed packet data
64cabdff1aSopenharmony_ci * @param seq pointer to an integer containing the sequence number, may be
65cabdff1aSopenharmony_ci *            updated
66cabdff1aSopenharmony_ci * @param flags the packet flags
67cabdff1aSopenharmony_ci * @param ts timestamp of the current packet
68cabdff1aSopenharmony_ci * @return <0 on error, 0 if a packet was placed in the pkt pointer. A
69cabdff1aSopenharmony_ci *         value >0 means that no data was placed in pkt, but that cached
70cabdff1aSopenharmony_ci *         data is available by calling ff_rm_retrieve_cache().
71cabdff1aSopenharmony_ci */
72cabdff1aSopenharmony_ciint ff_rm_parse_packet (AVFormatContext *s, AVIOContext *pb,
73cabdff1aSopenharmony_ci                        AVStream *st, RMStream *rst, int len,
74cabdff1aSopenharmony_ci                        AVPacket *pkt, int *seq, int flags, int64_t ts);
75cabdff1aSopenharmony_ci
76cabdff1aSopenharmony_ci/**
77cabdff1aSopenharmony_ci * Retrieve one cached packet from the rm-context. The real container can
78cabdff1aSopenharmony_ci * store several packets (as interpreted by the codec) in a single container
79cabdff1aSopenharmony_ci * packet, which means the demuxer holds some back when the first container
80cabdff1aSopenharmony_ci * packet is parsed and returned. The result is that rm->audio_pkt_cnt is
81cabdff1aSopenharmony_ci * a positive number, the amount of cached packets. Using this function, each
82cabdff1aSopenharmony_ci * of those packets can be retrieved sequentially.
83cabdff1aSopenharmony_ci *
84cabdff1aSopenharmony_ci * @param s context containing RMContext and AVIOContext for stream reading
85cabdff1aSopenharmony_ci * @param pb context to read the data from
86cabdff1aSopenharmony_ci * @param st stream that this packet belongs to
87cabdff1aSopenharmony_ci * @param rst Real-specific stream information
88cabdff1aSopenharmony_ci * @param pkt location to store the packet data
89cabdff1aSopenharmony_ci * @return the number of samples left for subsequent calls to this same
90cabdff1aSopenharmony_ci *          function, or 0 if all samples have been retrieved.
91cabdff1aSopenharmony_ci */
92cabdff1aSopenharmony_ciint ff_rm_retrieve_cache (AVFormatContext *s, AVIOContext *pb,
93cabdff1aSopenharmony_ci                          AVStream *st, RMStream *rst, AVPacket *pkt);
94cabdff1aSopenharmony_ci
95cabdff1aSopenharmony_ci#endif /* AVFORMAT_RM_H */
96