X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libavformat%2Finternal.h;h=7d0eab44acf5612deb9a53512f53d2382fa004a3;hb=3a3e8c35b63a40c4d59161097dc8652c15d13779;hp=12105aa7d0b17ab1ed0dd0427e181e2886b828af;hpb=456b170bd747ea7181c7305fd45278ea251f45ab;p=ffmpeg diff --git a/libavformat/internal.h b/libavformat/internal.h index 12105aa7d0b..7d0eab44acf 100644 --- a/libavformat/internal.h +++ b/libavformat/internal.h @@ -73,8 +73,8 @@ struct AVFormatInternal { * not decoded, for example to get the codec parameters in MPEG * streams. */ - struct AVPacketList *packet_buffer; - struct AVPacketList *packet_buffer_end; + struct PacketList *packet_buffer; + struct PacketList *packet_buffer_end; /* av_seek_frame() support */ int64_t data_offset; /**< offset of the first packet */ @@ -85,13 +85,31 @@ struct AVFormatInternal { * be identified, as parsing cannot be done without knowing the * codec. */ - struct AVPacketList *raw_packet_buffer; - struct AVPacketList *raw_packet_buffer_end; + struct PacketList *raw_packet_buffer; + struct PacketList *raw_packet_buffer_end; /** * Packets split by the parser get queued here. */ - struct AVPacketList *parse_queue; - struct AVPacketList *parse_queue_end; + struct PacketList *parse_queue; + struct PacketList *parse_queue_end; + /** + * The generic code uses this as a temporary packet + * to parse packets; it may also be used for other means + * for short periods that are guaranteed not to overlap + * with calls to av_read_frame() (or ff_read_packet()) + * or with each other. + * It may be used by demuxers as a replacement for + * stack packets (unless they call one of the aforementioned + * functions with their own AVFormatContext). + * Every user has to ensure that this packet is blank + * after using it. + */ + AVPacket *parse_pkt; + + /** + * Used to hold temporary packets. + */ + AVPacket *pkt; /** * Remaining size available for raw_packet_buffer, in bytes. */ @@ -142,6 +160,11 @@ struct AVFormatInternal { * Prefer the codec framerate for avg_frame_rate computation. */ int prefer_codec_framerate; + + /** + * Set if chapter ids are strictly monotonic. + */ + int chapter_ids_monotonic; }; struct AVStreamInternal { @@ -179,7 +202,6 @@ struct AVStreamInternal { * supported) */ struct { AVBSFContext *bsf; - AVPacket *pkt; int inited; } extract_extradata; @@ -225,6 +247,27 @@ struct AVStreamInternal { } *info; + AVIndexEntry *index_entries; /**< Only used if the format does not + support seeking natively. */ + int nb_index_entries; + unsigned int index_entries_allocated_size; + + int64_t interleaver_chunk_size; + int64_t interleaver_chunk_duration; + + /** + * stream probing state + * -1 -> probing finished + * 0 -> no probing requested + * rest -> perform probing with request_probe being the minimum score to accept. + */ + int request_probe; + /** + * Indicates that everything up to the next keyframe + * should be discarded. + */ + int skip_to_keyframe; + /** * Number of samples to skip at the start of the frame decoded from the next packet. */ @@ -287,12 +330,16 @@ struct AVStreamInternal { */ int update_initial_durations_done; +#define MAX_REORDER_DELAY 16 + /** * Internal data to generate dts from pts */ int64_t pts_reorder_error[MAX_REORDER_DELAY+1]; uint8_t pts_reorder_error_count[MAX_REORDER_DELAY+1]; + int64_t pts_buffer[MAX_REORDER_DELAY+1]; + /** * Internal data to analyze DTS and detect faulty mpeg streams */ @@ -311,6 +358,13 @@ struct AVStreamInternal { * - decoding: Set by libavformat to calculate sample_aspect_ratio internally */ AVRational display_aspect_ratio; + + AVProbeData probe_data; + + /** + * last packet in packet_buffer for this stream when muxing. + */ + struct PacketList *last_in_packet_buffer; }; #ifdef __GNUC__ @@ -328,8 +382,6 @@ do {\ } while(0) #endif -struct tm *ff_brktimegm(time_t secs, struct tm *tm); - /** * Automatically create sub-directories * @@ -374,6 +426,14 @@ uint64_t ff_ntp_time(void); */ uint64_t ff_get_formatted_ntp_time(uint64_t ntp_time_us); +/** + * Parse the NTP time in micro seconds (since NTP epoch). + * + * @param ntp_ts NTP time stamp formatted as per the RFC-5905. + * @return the time in micro seconds (since NTP epoch) + */ +uint64_t ff_parse_ntp_time(uint64_t ntp_ts); + /** * Append the media-specific SDP fragment for the media stream c * to the buffer buff. @@ -519,7 +579,7 @@ void ff_configure_buffers_for_index(AVFormatContext *s, int64_t time_tolerance); * * @return AVChapter or NULL on error */ -AVChapter *avpriv_new_chapter(AVFormatContext *s, int id, AVRational time_base, +AVChapter *avpriv_new_chapter(AVFormatContext *s, int64_t id, AVRational time_base, int64_t start, int64_t end, const char *title); /** @@ -605,6 +665,22 @@ int ff_framehash_write_header(AVFormatContext *s); */ int ff_read_packet(AVFormatContext *s, AVPacket *pkt); +/** + * Add an attached pic to an AVStream. + * + * @param st if set, the stream to add the attached pic to; + * if unset, a new stream will be added to s. + * @param pb AVIOContext to read data from if buf is unset. + * @param buf if set, it contains the data and size information to be used + * for the attached pic; if unset, data is read from pb. + * @param size the size of the data to read if buf is unset. + * + * @return 0 on success, < 0 on error. On error, this function removes + * the stream it has added (if any). + */ +int ff_add_attached_pic(AVFormatContext *s, AVStream *st, AVIOContext *pb, + AVBufferRef **buf, int size); + /** * Interleave an AVPacket per dts so it can be muxed. * @@ -830,15 +906,12 @@ int ff_bprint_to_codecpar_extradata(AVCodecParameters *par, struct AVBPrint *buf /** * Find the next packet in the interleaving queue for the given stream. - * The pkt parameter is filled in with the queued packet, including - * references to the data (which the caller is not allowed to keep or - * modify). * - * @return 0 if a packet was found, a negative value if no packet was found + * @return a pointer to a packet if one was found, NULL otherwise. */ -int ff_interleaved_peek(AVFormatContext *s, int stream, - AVPacket *pkt, int add_offset); +const AVPacket *ff_interleaved_peek(AVFormatContext *s, int stream); +int ff_get_muxer_ts_offset(AVFormatContext *s, int stream_index, int64_t *offset); int ff_lock_avformat(void); int ff_unlock_avformat(void);