• Main Page
  • Related Pages
  • Modules
  • Data Structures
  • Files
  • File List
  • Globals

libavformat/rtmppkt.h

Go to the documentation of this file.
00001 /*
00002  * RTMP packet utilities
00003  * Copyright (c) 2009 Kostya Shishkov
00004  *
00005  * This file is part of FFmpeg.
00006  *
00007  * FFmpeg is free software; you can redistribute it and/or
00008  * modify it under the terms of the GNU Lesser General Public
00009  * License as published by the Free Software Foundation; either
00010  * version 2.1 of the License, or (at your option) any later version.
00011  *
00012  * FFmpeg is distributed in the hope that it will be useful,
00013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00015  * Lesser General Public License for more details.
00016  *
00017  * You should have received a copy of the GNU Lesser General Public
00018  * License along with FFmpeg; if not, write to the Free Software
00019  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
00020  */
00021 
00022 #ifndef AVFORMAT_RTMPPKT_H
00023 #define AVFORMAT_RTMPPKT_H
00024 
00025 #include "avformat.h"
00026 
00028 #define RTMP_CHANNELS 65599
00029 
00034 enum RTMPChannel {
00035     RTMP_NETWORK_CHANNEL = 2,   
00036     RTMP_SYSTEM_CHANNEL,        
00037     RTMP_SOURCE_CHANNEL,        
00038     RTMP_VIDEO_CHANNEL = 8,     
00039     RTMP_AUDIO_CHANNEL,         
00040 };
00041 
00045 typedef enum RTMPPacketType {
00046     RTMP_PT_CHUNK_SIZE   =  1,  
00047     RTMP_PT_BYTES_READ   =  3,  
00048     RTMP_PT_PING,               
00049     RTMP_PT_SERVER_BW,          
00050     RTMP_PT_CLIENT_BW,          
00051     RTMP_PT_AUDIO        =  8,  
00052     RTMP_PT_VIDEO,              
00053     RTMP_PT_FLEX_STREAM  = 15,  
00054     RTMP_PT_FLEX_OBJECT,        
00055     RTMP_PT_FLEX_MESSAGE,       
00056     RTMP_PT_NOTIFY,             
00057     RTMP_PT_SHARED_OBJ,         
00058     RTMP_PT_INVOKE,             
00059     RTMP_PT_METADATA     = 22,  
00060 } RTMPPacketType;
00061 
00065 enum RTMPPacketSize {
00066     RTMP_PS_TWELVEBYTES = 0, 
00067     RTMP_PS_EIGHTBYTES,      
00068     RTMP_PS_FOURBYTES,       
00069     RTMP_PS_ONEBYTE          
00070 };
00071 
00075 typedef struct RTMPPacket {
00076     int            channel_id; 
00077     RTMPPacketType type;       
00078     uint32_t       timestamp;  
00079     uint32_t       ts_delta;   
00080     uint32_t       extra;      
00081     uint8_t        *data;      
00082     int            data_size;  
00083 } RTMPPacket;
00084 
00095 int ff_rtmp_packet_create(RTMPPacket *pkt, int channel_id, RTMPPacketType type,
00096                           int timestamp, int size);
00097 
00103 void ff_rtmp_packet_destroy(RTMPPacket *pkt);
00104 
00115 int ff_rtmp_packet_read(URLContext *h, RTMPPacket *p,
00116                         int chunk_size, RTMPPacket *prev_pkt);
00117 
00128 int ff_rtmp_packet_write(URLContext *h, RTMPPacket *p,
00129                          int chunk_size, RTMPPacket *prev_pkt);
00130 
00137 void ff_rtmp_packet_dump(void *ctx, RTMPPacket *p);
00138 
00152 int ff_amf_tag_size(const uint8_t *data, const uint8_t *data_end);
00153 
00164 int ff_amf_get_field_value(const uint8_t *data, const uint8_t *data_end,
00165                            const uint8_t *name, uint8_t *dst, int dst_size);
00166 
00173 void ff_amf_write_bool(uint8_t **dst, int val);
00174 
00181 void ff_amf_write_number(uint8_t **dst, double num);
00182 
00189 void ff_amf_write_string(uint8_t **dst, const char *str);
00190 
00196 void ff_amf_write_null(uint8_t **dst);
00197 
00203 void ff_amf_write_object_start(uint8_t **dst);
00204 
00211 void ff_amf_write_field_name(uint8_t **dst, const char *str);
00212 
00218 void ff_amf_write_object_end(uint8_t **dst);
00219  // AMF funcs
00221 
00222 #endif /* AVFORMAT_RTMPPKT_H */

Generated on Fri Sep 16 2011 17:17:50 for FFmpeg by  doxygen 1.7.1