yading@11: /* yading@11: * FFM (ffserver live feed) common header yading@11: * Copyright (c) 2001 Fabrice Bellard yading@11: * yading@11: * This file is part of FFmpeg. yading@11: * yading@11: * FFmpeg is free software; you can redistribute it and/or yading@11: * modify it under the terms of the GNU Lesser General Public yading@11: * License as published by the Free Software Foundation; either yading@11: * version 2.1 of the License, or (at your option) any later version. yading@11: * yading@11: * FFmpeg is distributed in the hope that it will be useful, yading@11: * but WITHOUT ANY WARRANTY; without even the implied warranty of yading@11: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU yading@11: * Lesser General Public License for more details. yading@11: * yading@11: * You should have received a copy of the GNU Lesser General Public yading@11: * License along with FFmpeg; if not, write to the Free Software yading@11: * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA yading@11: */ yading@11: yading@11: #ifndef AVFORMAT_FFM_H yading@11: #define AVFORMAT_FFM_H yading@11: yading@11: #include yading@11: #include "avformat.h" yading@11: #include "avio.h" yading@11: yading@11: /* The FFM file is made of blocks of fixed size */ yading@11: #define FFM_HEADER_SIZE 14 yading@11: #define FFM_PACKET_SIZE 4096 yading@11: #define PACKET_ID 0x666d yading@11: yading@11: /* each packet contains frames (which can span several packets */ yading@11: #define FRAME_HEADER_SIZE 16 yading@11: #define FLAG_KEY_FRAME 0x01 yading@11: #define FLAG_DTS 0x02 yading@11: yading@11: enum { yading@11: READ_HEADER, yading@11: READ_DATA, yading@11: }; yading@11: yading@11: typedef struct FFMContext { yading@11: /* only reading mode */ yading@11: int64_t write_index, file_size; yading@11: int read_state; yading@11: uint8_t header[FRAME_HEADER_SIZE+4]; yading@11: yading@11: /* read and write */ yading@11: int first_packet; /* true if first packet, needed to set the discontinuity tag */ yading@11: int packet_size; yading@11: int frame_offset; yading@11: int64_t dts; yading@11: uint8_t *packet_ptr, *packet_end; yading@11: uint8_t packet[FFM_PACKET_SIZE]; yading@11: int64_t start_time; yading@11: } FFMContext; yading@11: yading@11: #endif /* AVFORMAT_FFM_H */