X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libavformat%2Finternal.h;h=17a6ab07d350da644f8c9f53ede9c185e6af04c2;hb=af9e622776c9268fd473cc23a0fd6b29f0017f64;hp=0b8120b8424659f02a1c9a958648dc9a84c96e21;hpb=14fe81b3a88dfe4dbac12e8715f9a3f05b5ef1bf;p=ffmpeg diff --git a/libavformat/internal.h b/libavformat/internal.h index 0b8120b8424..17a6ab07d35 100644 --- a/libavformat/internal.h +++ b/libavformat/internal.h @@ -33,8 +33,6 @@ #define PROBE_BUF_MIN 2048 #define PROBE_BUF_MAX (1 << 20) -#define MAX_PROBE_PACKETS 2500 - #ifdef DEBUG # define hex_dump_debug(class, buf, size) av_hex_dump_log(class, AV_LOG_DEBUG, buf, size) #else @@ -154,12 +152,11 @@ struct AVStreamInternal { int reorder; /** - * bitstream filters to run on stream + * bitstream filter to run on stream * - encoding: Set by muxer using ff_stream_add_bitstream_filter * - decoding: unused */ - AVBSFContext **bsfcs; - int nb_bsfcs; + AVBSFContext *bsfc; /** * Whether or not check_bitstream should still be run on each packet @@ -191,6 +188,8 @@ struct AVStreamInternal { */ int need_context_update; + int is_intra_only; + FFFrac *priv_pts; }; @@ -211,6 +210,14 @@ do {\ struct tm *ff_brktimegm(time_t secs, struct tm *tm); +/** + * Automatically create sub-directories + * + * @param path will create sub-directories by path + * @return 0, or < 0 on error + */ +int ff_mkdir_p(const char *path); + char *ff_data_to_hex(char *buf, const uint8_t *src, int size, int lowercase); /** @@ -224,12 +231,12 @@ char *ff_data_to_hex(char *buf, const uint8_t *src, int size, int lowercase); int ff_hex_to_data(uint8_t *data, const char *p); /** - * Add packet to AVFormatContext->packet_buffer list, determining its + * Add packet to an AVFormatContext's packet_buffer list, determining its * interleaved position using compare() function argument. - * @return 0, or < 0 on error + * @return 0 on success, < 0 on error. pkt will always be blank on return. */ int ff_interleave_add_packet(AVFormatContext *s, AVPacket *pkt, - int (*compare)(AVFormatContext *, AVPacket *, AVPacket *)); + int (*compare)(AVFormatContext *, const AVPacket *, const AVPacket *)); void ff_read_frame_flush(AVFormatContext *s); @@ -284,16 +291,6 @@ void ff_sdp_write_media(char *buff, int size, AVStream *st, int idx, int ff_write_chained(AVFormatContext *dst, int dst_stream, AVPacket *pkt, AVFormatContext *src, int interleave); -/** - * Get the length in bytes which is needed to store val as v. - */ -int ff_get_v_length(uint64_t val); - -/** - * Put val using a variable number of bytes. - */ -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, @@ -489,19 +486,16 @@ int ff_framehash_write_header(AVFormatContext *s); int ff_read_packet(AVFormatContext *s, AVPacket *pkt); /** - * Interleave a packet per dts in an output media file. + * Interleave an AVPacket per dts so it can be muxed. * - * Packets with pkt->destruct == av_destruct_packet will be freed inside this - * function, so they cannot be used after it. Note that calling av_packet_unref() - * on them is still safe. - * - * @param s media file handle + * @param s an AVFormatContext for output. pkt resp. out will be added to + * resp. taken from its packet buffer. * @param out the interleaved packet will be output here - * @param pkt the input packet + * @param pkt the input packet; will be blank on return if not NULL * @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 + * @return 1 if a packet was output, 0 if no packet could be output + * (in which case out may be uninitialized), < 0 if an error occurred */ int ff_interleave_packet_per_dts(AVFormatContext *s, AVPacket *out, AVPacket *pkt, int flush); @@ -518,6 +512,8 @@ unsigned int ff_codec_get_tag(const AVCodecTag *tags, enum AVCodecID id); enum AVCodecID ff_codec_get_id(const AVCodecTag *tags, unsigned int tag); +int ff_is_intra_only(enum AVCodecID id); + /** * Select a PCM codec based on the given parameters. * @@ -574,25 +570,13 @@ int ff_stream_add_bitstream_filter(AVStream *st, const char *name, const char *a int ff_stream_encode_params_copy(AVStream *dst, const AVStream *src); /** - * Wrap errno on rename() error. + * Wrap avpriv_io_move and log if error happens. * - * @param oldpath source path - * @param newpath destination path + * @param url_src source path + * @param url_dst destination path * @return 0 or AVERROR on failure */ -static inline int ff_rename(const char *oldpath, const char *newpath, void *logctx) -{ - int ret = 0; - if (rename(oldpath, newpath) == -1) { - ret = AVERROR(errno); - if (logctx) { - char err[AV_ERROR_MAX_STRING_SIZE] = {0}; - av_make_error_string(err, AV_ERROR_MAX_STRING_SIZE, ret); - av_log(logctx, AV_LOG_ERROR, "failed to rename file %s to %s: %s\n", oldpath, newpath, err); - } - } - return ret; -} +int ff_rename(const char *url_src, const char *url_dst, void *logctx); /** * Allocate extradata with additional AV_INPUT_BUFFER_PADDING_SIZE at end @@ -642,9 +626,6 @@ enum AVWriteUncodedFrameFlags { */ int ff_copy_whiteblacklists(AVFormatContext *dst, const AVFormatContext *src); -int ffio_open2_wrapper(struct AVFormatContext *s, AVIOContext **pb, const char *url, int flags, - const AVIOInterruptCB *int_cb, AVDictionary **options); - /** * Returned by demuxers to indicate that data was consumed but discarded * (ignored streams or junk data). The framework will re-call the demuxer. @@ -758,7 +739,8 @@ void ff_format_set_url(AVFormatContext *s, char *url); * * @param head List head element * @param tail List tail element - * @param pkt The packet being appended + * @param pkt The packet being appended. The data described in it will + * be made reference counted if it isn't already. * @param flags Any combination of FF_PACKETLIST_FLAG_* flags * @return 0 on success, negative AVERROR value on failure. On failure, the list is unchanged @@ -768,13 +750,16 @@ int ff_packet_list_put(AVPacketList **head, AVPacketList **tail, /** * Remove the oldest AVPacket in the list and return it. + * The behaviour is undefined if the packet list is empty. * * @note The pkt will be overwritten completely. The caller owns the * packet and must unref it by itself. * * @param head List head element * @param tail List tail element - * @param pkt Pointer to an initialized AVPacket struct + * @param pkt Pointer to an AVPacket struct + * @return 0 on success. Success is guaranteed + * if the packet list is not empty. */ int ff_packet_list_get(AVPacketList **head, AVPacketList **tail, AVPacket *pkt);