Aurelien Jacobs | 7b2a2ce | 2007-05-30 09:44:16 | [diff] [blame] | 1 | /* |
| 2 | * "Real" compatible muxer and demuxer. |
Diego Biurrun | 406792e | 2009-01-19 15:46:40 | [diff] [blame] | 3 | * Copyright (c) 2000, 2001 Fabrice Bellard |
Aurelien Jacobs | 7b2a2ce | 2007-05-30 09:44:16 | [diff] [blame] | 4 | * |
| 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 Sabatini | 9879038 | 2008-08-31 07:39:47 | [diff] [blame] | 22 | #ifndef AVFORMAT_RM_H |
| 23 | #define AVFORMAT_RM_H |
Aurelien Jacobs | 7b2a2ce | 2007-05-30 09:44:16 | [diff] [blame] | 24 | |
| 25 | #include "avformat.h" |
Francesco Lavra | 74e8cca | 2010-05-28 18:18:33 | [diff] [blame] | 26 | #include "internal.h" |
Aurelien Jacobs | 7b2a2ce | 2007-05-30 09:44:16 | [diff] [blame] | 27 | |
Reimar Döffinger | 88e70e1 | 2009-09-06 08:57:19 | [diff] [blame] | 28 | extern const char * const ff_rm_metadata[4]; |
Francesco Lavra | 74e8cca | 2010-05-28 18:18:33 | [diff] [blame] | 29 | extern const AVCodecTag ff_rm_codec_tags[]; |
Aurelien Jacobs | 7379d5b | 2009-02-17 21:40:38 | [diff] [blame] | 30 | |
Ronald S. Bultje | ba61472 | 2008-12-28 00:18:38 | [diff] [blame] | 31 | typedef struct RMStream RMStream; |
| 32 | |
| 33 | RMStream *ff_rm_alloc_rmstream (void); |
| 34 | void ff_rm_free_rmstream (RMStream *rms); |
| 35 | |
Ronald S. Bultje | ff13ba9 | 2008-09-07 01:21:24 | [diff] [blame] | 36 | /*< input format for Realmedia-style RTSP streams */ |
Andreas Rheinhardt | bc70684 | 2021-04-19 17:45:24 | [diff] [blame] | 37 | extern const AVInputFormat ff_rdt_demuxer; |
Ronald S. Bultje | ff13ba9 | 2008-09-07 01:21:24 | [diff] [blame] | 38 | |
Ronald S. Bultje | 0fd3636 | 2008-01-04 13:00:47 | [diff] [blame] | 39 | /** |
| 40 | * Read the MDPR chunk, which contains stream-specific codec initialization |
| 41 | * parameters. |
| 42 | * |
Anton Khirnov | 471fe57 | 2011-02-20 10:04:12 | [diff] [blame] | 43 | * @param s context containing RMContext and AVIOContext for stream reading |
Ronald S. Bultje | fcc995a | 2008-11-17 14:20:00 | [diff] [blame] | 44 | * @param pb context to read the data from |
Ronald S. Bultje | 0fd3636 | 2008-01-04 13:00:47 | [diff] [blame] | 45 | * @param st the stream that the MDPR chunk belongs to and where to store the |
| 46 | * parameters read from the chunk into |
Ronald S. Bultje | 886e89d | 2008-12-28 00:21:11 | [diff] [blame] | 47 | * @param rst real-specific stream information |
Ronald S. Bultje | 79d5045 | 2008-09-03 00:05:55 | [diff] [blame] | 48 | * @param codec_data_size size of the MDPR chunk |
Ronald S. Bultje | 0fd3636 | 2008-01-04 13:00:47 | [diff] [blame] | 49 | * @return 0 on success, errno codes on error |
| 50 | */ |
Anton Khirnov | 471fe57 | 2011-02-20 10:04:12 | [diff] [blame] | 51 | int ff_rm_read_mdpr_codecdata (AVFormatContext *s, AVIOContext *pb, |
Ronald S. Bultje | 886e89d | 2008-12-28 00:21:11 | [diff] [blame] | 52 | AVStream *st, RMStream *rst, |
Michael Niedermayer | ef2f907 | 2014-12-05 23:41:00 | [diff] [blame] | 53 | unsigned int codec_data_size, const uint8_t *mime); |
Ronald S. Bultje | 0fd3636 | 2008-01-04 13:00:47 | [diff] [blame] | 54 | |
| 55 | /** |
| 56 | * Parse one rm-stream packet from the input bytestream. |
| 57 | * |
Anton Khirnov | 471fe57 | 2011-02-20 10:04:12 | [diff] [blame] | 58 | * @param s context containing RMContext and AVIOContext for stream reading |
Ronald S. Bultje | fcc995a | 2008-11-17 14:20:00 | [diff] [blame] | 59 | * @param pb context to read the data from |
Ronald S. Bultje | 0fd3636 | 2008-01-04 13:00:47 | [diff] [blame] | 60 | * @param st stream to which the packet to be read belongs |
Ronald S. Bultje | 886e89d | 2008-12-28 00:21:11 | [diff] [blame] | 61 | * @param rst Real-specific stream information |
Ronald S. Bultje | 0fd3636 | 2008-01-04 13:00:47 | [diff] [blame] | 62 | * @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. Bultje | 34bddc3 | 2009-07-30 15:04:19 | [diff] [blame] | 66 | * @param flags the packet flags |
| 67 | * @param ts timestamp of the current packet |
Stefano Sabatini | bf7e799 | 2009-06-06 09:35:15 | [diff] [blame] | 68 | * @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. Bultje | c5efef7 | 2009-03-16 12:57:49 | [diff] [blame] | 70 | * data is available by calling ff_rm_retrieve_cache(). |
Ronald S. Bultje | 0fd3636 | 2008-01-04 13:00:47 | [diff] [blame] | 71 | */ |
Anton Khirnov | 471fe57 | 2011-02-20 10:04:12 | [diff] [blame] | 72 | int ff_rm_parse_packet (AVFormatContext *s, AVIOContext *pb, |
Ronald S. Bultje | 886e89d | 2008-12-28 00:21:11 | [diff] [blame] | 73 | AVStream *st, RMStream *rst, int len, |
Ronald S. Bultje | 34bddc3 | 2009-07-30 15:04:19 | [diff] [blame] | 74 | AVPacket *pkt, int *seq, int flags, int64_t ts); |
Ronald S. Bultje | 0fd3636 | 2008-01-04 13:00:47 | [diff] [blame] | 75 | |
| 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 Khirnov | 471fe57 | 2011-02-20 10:04:12 | [diff] [blame] | 84 | * @param s context containing RMContext and AVIOContext for stream reading |
Ronald S. Bultje | fcc995a | 2008-11-17 14:20:00 | [diff] [blame] | 85 | * @param pb context to read the data from |
Ronald S. Bultje | 0fd3636 | 2008-01-04 13:00:47 | [diff] [blame] | 86 | * @param st stream that this packet belongs to |
Ronald S. Bultje | 886e89d | 2008-12-28 00:21:11 | [diff] [blame] | 87 | * @param rst Real-specific stream information |
Ronald S. Bultje | 0fd3636 | 2008-01-04 13:00:47 | [diff] [blame] | 88 | * @param pkt location to store the packet data |
Benoit Fouet | 32e543f | 2010-03-30 15:50:57 | [diff] [blame] | 89 | * @return the number of samples left for subsequent calls to this same |
Ronald S. Bultje | a9f8482 | 2008-12-28 05:58:23 | [diff] [blame] | 90 | * function, or 0 if all samples have been retrieved. |
Ronald S. Bultje | 0fd3636 | 2008-01-04 13:00:47 | [diff] [blame] | 91 | */ |
Anton Khirnov | 471fe57 | 2011-02-20 10:04:12 | [diff] [blame] | 92 | int ff_rm_retrieve_cache (AVFormatContext *s, AVIOContext *pb, |
Ronald S. Bultje | ade8fb4 | 2008-12-28 05:59:11 | [diff] [blame] | 93 | AVStream *st, RMStream *rst, AVPacket *pkt); |
Ronald S. Bultje | 0fd3636 | 2008-01-04 13:00:47 | [diff] [blame] | 94 | |
Stefano Sabatini | 9879038 | 2008-08-31 07:39:47 | [diff] [blame] | 95 | #endif /* AVFORMAT_RM_H */ |