1cabdff1aSopenharmony_ci/* 2cabdff1aSopenharmony_ci * Realmedia RTSP (RDT) definitions 3cabdff1aSopenharmony_ci * Copyright (c) 2007 Ronald S. Bultje <rbultje@ronald.bitfreak.net> 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_RDT_H 23cabdff1aSopenharmony_ci#define AVFORMAT_RDT_H 24cabdff1aSopenharmony_ci 25cabdff1aSopenharmony_ci#include <stdint.h> 26cabdff1aSopenharmony_ci#include "avformat.h" 27cabdff1aSopenharmony_ci#include "rtpdec.h" 28cabdff1aSopenharmony_ci 29cabdff1aSopenharmony_citypedef struct RDTDemuxContext RDTDemuxContext; 30cabdff1aSopenharmony_ci 31cabdff1aSopenharmony_ci/** 32cabdff1aSopenharmony_ci * Allocate and init the RDT parsing context. 33cabdff1aSopenharmony_ci * @param ic the containing RTSP demuxer context 34cabdff1aSopenharmony_ci * @param first_stream_of_set_idx index to the first AVStream in the RTSP 35cabdff1aSopenharmony_ci * demuxer context's ic->streams array that is part of this 36cabdff1aSopenharmony_ci * particular stream's set of streams (with identical content) 37cabdff1aSopenharmony_ci * @param priv_data private data of the payload data handler context 38cabdff1aSopenharmony_ci * @param handler pointer to the parse_packet() payload parsing function 39cabdff1aSopenharmony_ci * @return a newly allocated RDTDemuxContext. Free with ff_rdt_parse_close(). 40cabdff1aSopenharmony_ci */ 41cabdff1aSopenharmony_ciRDTDemuxContext *ff_rdt_parse_open(AVFormatContext *ic, 42cabdff1aSopenharmony_ci int first_stream_of_set_idx, 43cabdff1aSopenharmony_ci void *priv_data, 44cabdff1aSopenharmony_ci const RTPDynamicProtocolHandler *handler); 45cabdff1aSopenharmony_civoid ff_rdt_parse_close(RDTDemuxContext *s); 46cabdff1aSopenharmony_ci 47cabdff1aSopenharmony_ci/** 48cabdff1aSopenharmony_ci * Calculate the response (RealChallenge2 in the RTSP header) to the 49cabdff1aSopenharmony_ci * challenge (RealChallenge1 in the RTSP header from the Real/Helix 50cabdff1aSopenharmony_ci * server), which is used as some sort of client validation. 51cabdff1aSopenharmony_ci * 52cabdff1aSopenharmony_ci * @param response pointer to response buffer, it should be at least 41 bytes 53cabdff1aSopenharmony_ci * (40 data + 1 zero) bytes long. 54cabdff1aSopenharmony_ci * @param chksum pointer to buffer containing a checksum of the response, 55cabdff1aSopenharmony_ci * it should be at least 9 (8 data + 1 zero) bytes long. 56cabdff1aSopenharmony_ci * @param challenge pointer to the RealChallenge1 value provided by the 57cabdff1aSopenharmony_ci * server. 58cabdff1aSopenharmony_ci */ 59cabdff1aSopenharmony_civoid ff_rdt_calc_response_and_checksum(char response[41], char chksum[9], 60cabdff1aSopenharmony_ci const char *challenge); 61cabdff1aSopenharmony_ci 62cabdff1aSopenharmony_ci/** 63cabdff1aSopenharmony_ci * Add subscription information to Subscribe parameter string. 64cabdff1aSopenharmony_ci * 65cabdff1aSopenharmony_ci * @param cmd string to write the subscription information into. 66cabdff1aSopenharmony_ci * @param size size of cmd. 67cabdff1aSopenharmony_ci * @param stream_nr stream number. 68cabdff1aSopenharmony_ci * @param rule_nr rule number to conform to. 69cabdff1aSopenharmony_ci */ 70cabdff1aSopenharmony_civoid ff_rdt_subscribe_rule(char *cmd, int size, 71cabdff1aSopenharmony_ci int stream_nr, int rule_nr); 72cabdff1aSopenharmony_ci 73cabdff1aSopenharmony_ci/** 74cabdff1aSopenharmony_ci * Parse RDT-style packet header. 75cabdff1aSopenharmony_ci * 76cabdff1aSopenharmony_ci * @param buf input buffer 77cabdff1aSopenharmony_ci * @param len length of input buffer 78cabdff1aSopenharmony_ci * @param pset_id will be set to the set ID this packet belongs to 79cabdff1aSopenharmony_ci * @param pseq_no will be set to the sequence number of the packet 80cabdff1aSopenharmony_ci * @param pstream_id will be set to the stream ID this packet belongs to 81cabdff1aSopenharmony_ci * @param pis_keyframe will be whether this packet belongs to a keyframe 82cabdff1aSopenharmony_ci * @param ptimestamp will be set to the timestamp of the packet 83cabdff1aSopenharmony_ci * @return the amount of bytes consumed, or negative on error 84cabdff1aSopenharmony_ci */ 85cabdff1aSopenharmony_ciint ff_rdt_parse_header(const uint8_t *buf, int len, 86cabdff1aSopenharmony_ci int *pset_id, int *pseq_no, int *pstream_id, 87cabdff1aSopenharmony_ci int *pis_keyframe, uint32_t *ptimestamp); 88cabdff1aSopenharmony_ci 89cabdff1aSopenharmony_ci/** 90cabdff1aSopenharmony_ci * Parse RDT-style packet data (header + media data). 91cabdff1aSopenharmony_ci * Usage similar to rtp_parse_packet(). 92cabdff1aSopenharmony_ci */ 93cabdff1aSopenharmony_ciint ff_rdt_parse_packet(RDTDemuxContext *s, AVPacket *pkt, 94cabdff1aSopenharmony_ci uint8_t **buf, int len); 95cabdff1aSopenharmony_ci 96cabdff1aSopenharmony_ci/** 97cabdff1aSopenharmony_ci * Parse a server-related SDP line. 98cabdff1aSopenharmony_ci * 99cabdff1aSopenharmony_ci * @param s the RTSP AVFormatContext 100cabdff1aSopenharmony_ci * @param stream_index the index of the first stream in the set represented 101cabdff1aSopenharmony_ci * by the SDP m= line (in s->streams) 102cabdff1aSopenharmony_ci * @param buf the SDP line 103cabdff1aSopenharmony_ci */ 104cabdff1aSopenharmony_civoid ff_real_parse_sdp_a_line(AVFormatContext *s, int stream_index, 105cabdff1aSopenharmony_ci const char *buf); 106cabdff1aSopenharmony_ci 107cabdff1aSopenharmony_ci#endif /* AVFORMAT_RDT_H */ 108