X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libavformat%2Finternal.h;h=16475800d9ab80c0fe5cb12881299449de15eb04;hb=ca6b544ac9d07dcd4d151d5729f0bf52f4f8653d;hp=7413b0906a814af711d5d3b637d3c6e314bbce37;hpb=0558e266a267b5d90d3be1d8d86e60db2c303773;p=ffmpeg diff --git a/libavformat/internal.h b/libavformat/internal.h index 7413b0906a8..16475800d9a 100644 --- a/libavformat/internal.h +++ b/libavformat/internal.h @@ -33,10 +33,15 @@ #endif typedef struct AVCodecTag { - enum CodecID id; + enum AVCodecID id; unsigned int tag; } AVCodecTag; +typedef struct CodecMime{ + char str[32]; + enum AVCodecID id; +} CodecMime; + void ff_dynarray_add(intptr_t **tab_ptr, int *nb_ptr, intptr_t elem); #ifdef __GNUC__ @@ -54,7 +59,7 @@ do {\ } while(0) #endif -struct tm *brktimegm(time_t secs, struct tm *tm); +struct tm *ff_brktimegm(time_t secs, struct tm *tm); char *ff_data_to_hex(char *buf, const uint8_t *src, int size, int lowercase); @@ -108,7 +113,7 @@ uint64_t ff_ntp_time(void); */ int ff_url_join(char *str, int size, const char *proto, const char *authorization, const char *hostname, - int port, const char *fmt, ...); + int port, const char *fmt, ...) av_printf_format(7, 8); /** * Append the media-specific SDP fragment for the media stream c @@ -157,14 +162,14 @@ void ff_put_v(AVIOContext *bc, uint64_t val); /** * Read a whole line of text from AVIOContext. Stop reading after reaching - * either a \n, a \0 or EOF. The returned string is always \0 terminated, + * either a \\n, a \\0 or EOF. The returned string is always \\0-terminated, * and may be truncated if the buffer is too small. * * @param s the read-only AVIOContext * @param buf buffer to store the read line * @param maxlen size of the buffer * @return the length of the string written in the buffer, not including the - * final \0 + * final \\0 */ int ff_get_line(AVIOContext *s, char *buf, int maxlen); @@ -225,8 +230,8 @@ int ff_add_index_entry(AVIndexEntry **index_entries, * * @return AVChapter or NULL on error */ -AVChapter *ff_new_chapter(AVFormatContext *s, int id, AVRational time_base, - int64_t start, int64_t end, const char *title); +AVChapter *avpriv_new_chapter(AVFormatContext *s, int id, AVRational time_base, + int64_t start, int64_t end, const char *title); /** * Ensure the index uses less memory than the maximum specified in @@ -246,6 +251,98 @@ void ff_reduce_index(AVFormatContext *s, int stream_index); void ff_make_absolute_url(char *buf, int size, const char *base, const char *rel); -enum CodecID ff_guess_image2_codec(const char *filename); +enum AVCodecID ff_guess_image2_codec(const char *filename); + +/** + * Convert a date string in ISO8601 format to Unix timestamp. + */ +int64_t ff_iso8601_to_unix_time(const char *datestr); + +/** + * Perform a binary search using av_index_search_timestamp() and + * AVInputFormat.read_timestamp(). + * + * @param target_ts target timestamp in the time base of the given stream + * @param stream_index stream number + */ +int ff_seek_frame_binary(AVFormatContext *s, int stream_index, + int64_t target_ts, int flags); + +/** + * Update cur_dts of all streams based on the given timestamp and AVStream. + * + * Stream ref_st unchanged, others set cur_dts in their native time base. + * Only needed for timestamp wrapping or if (dts not set and pts!=dts). + * @param timestamp new dts expressed in time_base of param ref_st + * @param ref_st reference stream giving time_base of param timestamp + */ +void ff_update_cur_dts(AVFormatContext *s, AVStream *ref_st, int64_t timestamp); + +/** + * Perform a binary search using read_timestamp(). + * + * @param target_ts target timestamp in the time base of the given stream + * @param stream_index stream number + */ +int64_t ff_gen_search(AVFormatContext *s, int stream_index, + int64_t target_ts, int64_t pos_min, + int64_t pos_max, int64_t pos_limit, + int64_t ts_min, int64_t ts_max, + int flags, int64_t *ts_ret, + int64_t (*read_timestamp)(struct AVFormatContext *, int , int64_t *, int64_t )); + +/** + * Set the pts for a given stream. If the new values would be invalid + * (<= 0), it leaves the AVStream unchanged. + * + * @param s stream + * @param pts_wrap_bits number of bits effectively used by the pts + * (used for wrap control, 33 is the value for MPEG) + * @param pts_num numerator to convert to seconds (MPEG: 1) + * @param pts_den denominator to convert to seconds (MPEG: 90000) + */ +void avpriv_set_pts_info(AVStream *s, int pts_wrap_bits, + unsigned int pts_num, unsigned int pts_den); + +/** + * Add side data to a packet for changing parameters to the given values. + * Parameters set to 0 aren't included in the change. + */ +int ff_add_param_change(AVPacket *pkt, int32_t channels, + uint64_t channel_layout, int32_t sample_rate, + int32_t width, int32_t height); + +/** + * Set the timebase for each stream from the corresponding codec timebase and + * print it. + */ +int ff_framehash_write_header(AVFormatContext *s); + +/** + * Read a transport packet from a media file. + * + * @param s media file handle + * @param pkt is filled + * @return 0 if OK, AVERROR_xxx on error + */ +int ff_read_packet(AVFormatContext *s, AVPacket *pkt); + +/** + * Interleave a packet per dts in an output media file. + * + * Packets with pkt->destruct == av_destruct_packet will be freed inside this + * function, so they cannot be used after it. Note that calling av_free_packet() + * on them is still safe. + * + * @param s media file handle + * @param out the interleaved packet will be output here + * @param pkt the input packet + * @param flush 1 if no further packets are available as input and all + * remaining packets should be output + * @return 1 if a packet was output, 0 if no packet could be output, + * < 0 if an error occurred + */ +int ff_interleave_packet_per_dts(AVFormatContext *s, AVPacket *out, + AVPacket *pkt, int flush); #endif /* AVFORMAT_INTERNAL_H */