| OLD | NEW | 
|---|
| 1 /* | 1 /* | 
| 2  * various utility functions for use within FFmpeg | 2  * various utility functions for use within FFmpeg | 
| 3  * Copyright (c) 2000, 2001, 2002 Fabrice Bellard | 3  * Copyright (c) 2000, 2001, 2002 Fabrice Bellard | 
| 4  * | 4  * | 
| 5  * This file is part of FFmpeg. | 5  * This file is part of FFmpeg. | 
| 6  * | 6  * | 
| 7  * FFmpeg is free software; you can redistribute it and/or | 7  * FFmpeg is free software; you can redistribute it and/or | 
| 8  * modify it under the terms of the GNU Lesser General Public | 8  * modify it under the terms of the GNU Lesser General Public | 
| 9  * License as published by the Free Software Foundation; either | 9  * License as published by the Free Software Foundation; either | 
| 10  * version 2.1 of the License, or (at your option) any later version. | 10  * version 2.1 of the License, or (at your option) any later version. | 
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 103             f->val--; | 103             f->val--; | 
| 104         } | 104         } | 
| 105     } else if (num >= den) { | 105     } else if (num >= den) { | 
| 106         f->val += num / den; | 106         f->val += num / den; | 
| 107         num = num % den; | 107         num = num % den; | 
| 108     } | 108     } | 
| 109     f->num = num; | 109     f->num = num; | 
| 110 } | 110 } | 
| 111 | 111 | 
| 112 /** head of registered input format linked list */ | 112 /** head of registered input format linked list */ | 
|  | 113 #if !FF_API_FIRST_FORMAT | 
|  | 114 static | 
|  | 115 #endif | 
| 113 AVInputFormat *first_iformat = NULL; | 116 AVInputFormat *first_iformat = NULL; | 
| 114 /** head of registered output format linked list */ | 117 /** head of registered output format linked list */ | 
|  | 118 #if !FF_API_FIRST_FORMAT | 
|  | 119 static | 
|  | 120 #endif | 
| 115 AVOutputFormat *first_oformat = NULL; | 121 AVOutputFormat *first_oformat = NULL; | 
| 116 | 122 | 
| 117 AVInputFormat  *av_iformat_next(AVInputFormat  *f) | 123 AVInputFormat  *av_iformat_next(AVInputFormat  *f) | 
| 118 { | 124 { | 
| 119     if(f) return f->next; | 125     if(f) return f->next; | 
| 120     else  return first_iformat; | 126     else  return first_iformat; | 
| 121 } | 127 } | 
| 122 | 128 | 
| 123 AVOutputFormat *av_oformat_next(AVOutputFormat *f) | 129 AVOutputFormat *av_oformat_next(AVOutputFormat *f) | 
| 124 { | 130 { | 
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 182     namelen = strlen(name); | 188     namelen = strlen(name); | 
| 183     while ((p = strchr(names, ','))) { | 189     while ((p = strchr(names, ','))) { | 
| 184         len = FFMAX(p - names, namelen); | 190         len = FFMAX(p - names, namelen); | 
| 185         if (!strncasecmp(name, names, len)) | 191         if (!strncasecmp(name, names, len)) | 
| 186             return 1; | 192             return 1; | 
| 187         names = p+1; | 193         names = p+1; | 
| 188     } | 194     } | 
| 189     return !strcasecmp(name, names); | 195     return !strcasecmp(name, names); | 
| 190 } | 196 } | 
| 191 | 197 | 
| 192 #if LIBAVFORMAT_VERSION_MAJOR < 53 | 198 #if FF_API_GUESS_FORMAT | 
| 193 AVOutputFormat *guess_format(const char *short_name, const char *filename, | 199 AVOutputFormat *guess_format(const char *short_name, const char *filename, | 
| 194                              const char *mime_type) | 200                              const char *mime_type) | 
| 195 { | 201 { | 
| 196     return av_guess_format(short_name, filename, mime_type); | 202     return av_guess_format(short_name, filename, mime_type); | 
| 197 } | 203 } | 
| 198 #endif | 204 #endif | 
| 199 | 205 | 
| 200 AVOutputFormat *av_guess_format(const char *short_name, const char *filename, | 206 AVOutputFormat *av_guess_format(const char *short_name, const char *filename, | 
| 201                                 const char *mime_type) | 207                                 const char *mime_type) | 
| 202 { | 208 { | 
| (...skipping 24 matching lines...) Expand all  Loading... | 
| 227         } | 233         } | 
| 228         if (score > score_max) { | 234         if (score > score_max) { | 
| 229             score_max = score; | 235             score_max = score; | 
| 230             fmt_found = fmt; | 236             fmt_found = fmt; | 
| 231         } | 237         } | 
| 232         fmt = fmt->next; | 238         fmt = fmt->next; | 
| 233     } | 239     } | 
| 234     return fmt_found; | 240     return fmt_found; | 
| 235 } | 241 } | 
| 236 | 242 | 
| 237 #if LIBAVFORMAT_VERSION_MAJOR < 53 | 243 #if FF_API_GUESS_FORMAT | 
| 238 AVOutputFormat *guess_stream_format(const char *short_name, const char *filename
      , | 244 AVOutputFormat *guess_stream_format(const char *short_name, const char *filename
      , | 
| 239                              const char *mime_type) | 245                              const char *mime_type) | 
| 240 { | 246 { | 
| 241     AVOutputFormat *fmt = av_guess_format(short_name, filename, mime_type); | 247     AVOutputFormat *fmt = av_guess_format(short_name, filename, mime_type); | 
| 242 | 248 | 
| 243     if (fmt) { | 249     if (fmt) { | 
| 244         AVOutputFormat *stream_fmt; | 250         AVOutputFormat *stream_fmt; | 
| 245         char stream_format_name[64]; | 251         char stream_format_name[64]; | 
| 246 | 252 | 
| 247         snprintf(stream_format_name, sizeof(stream_format_name), "%s_stream", fm
      t->name); | 253         snprintf(stream_format_name, sizeof(stream_format_name), "%s_stream", fm
      t->name); | 
| (...skipping 29 matching lines...) Expand all  Loading... | 
| 277 AVInputFormat *av_find_input_format(const char *short_name) | 283 AVInputFormat *av_find_input_format(const char *short_name) | 
| 278 { | 284 { | 
| 279     AVInputFormat *fmt; | 285     AVInputFormat *fmt; | 
| 280     for(fmt = first_iformat; fmt != NULL; fmt = fmt->next) { | 286     for(fmt = first_iformat; fmt != NULL; fmt = fmt->next) { | 
| 281         if (match_format(short_name, fmt->name)) | 287         if (match_format(short_name, fmt->name)) | 
| 282             return fmt; | 288             return fmt; | 
| 283     } | 289     } | 
| 284     return NULL; | 290     return NULL; | 
| 285 } | 291 } | 
| 286 | 292 | 
| 287 #if LIBAVFORMAT_VERSION_MAJOR < 53 && CONFIG_SHARED && HAVE_SYMVER | 293 #if FF_API_SYMVER && CONFIG_SHARED && HAVE_SYMVER | 
| 288 FF_SYMVER(void, av_destruct_packet_nofree, (AVPacket *pkt), "LIBAVFORMAT_52") | 294 FF_SYMVER(void, av_destruct_packet_nofree, (AVPacket *pkt), "LIBAVFORMAT_52") | 
| 289 { | 295 { | 
| 290     av_destruct_packet_nofree(pkt); | 296     av_destruct_packet_nofree(pkt); | 
| 291 } | 297 } | 
| 292 | 298 | 
| 293 FF_SYMVER(void, av_destruct_packet, (AVPacket *pkt), "LIBAVFORMAT_52") | 299 FF_SYMVER(void, av_destruct_packet, (AVPacket *pkt), "LIBAVFORMAT_52") | 
| 294 { | 300 { | 
| 295     av_destruct_packet(pkt); | 301     av_destruct_packet(pkt); | 
| 296 } | 302 } | 
| 297 | 303 | 
| (...skipping 2449 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 2747         if (!s->priv_data) | 2753         if (!s->priv_data) | 
| 2748             return AVERROR(ENOMEM); | 2754             return AVERROR(ENOMEM); | 
| 2749     } | 2755     } | 
| 2750 | 2756 | 
| 2751 #if FF_API_OLD_METADATA | 2757 #if FF_API_OLD_METADATA | 
| 2752     ff_metadata_mux_compat(s); | 2758     ff_metadata_mux_compat(s); | 
| 2753 #endif | 2759 #endif | 
| 2754 | 2760 | 
| 2755     /* set muxer identification string */ | 2761     /* set muxer identification string */ | 
| 2756     if (!(s->streams[0]->codec->flags & CODEC_FLAG_BITEXACT)) { | 2762     if (!(s->streams[0]->codec->flags & CODEC_FLAG_BITEXACT)) { | 
| 2757         AVMetadata *m; | 2763         av_metadata_set2(&s->metadata, "encoder", LIBAVFORMAT_IDENT, 0); | 
| 2758         AVMetadataTag *t; |  | 
| 2759 |  | 
| 2760         if (!(m = av_mallocz(sizeof(AVMetadata)))) |  | 
| 2761             return AVERROR(ENOMEM); |  | 
| 2762         av_metadata_set2(&m, "encoder", LIBAVFORMAT_IDENT, 0); |  | 
| 2763         metadata_conv(&m, s->oformat->metadata_conv, NULL); |  | 
| 2764         if ((t = av_metadata_get(m, "", NULL, AV_METADATA_IGNORE_SUFFIX))) |  | 
| 2765             av_metadata_set2(&s->metadata, t->key, t->value, 0); |  | 
| 2766         av_metadata_free(&m); |  | 
| 2767     } | 2764     } | 
| 2768 | 2765 | 
| 2769     if(s->oformat->write_header){ | 2766     if(s->oformat->write_header){ | 
| 2770         ret = s->oformat->write_header(s); | 2767         ret = s->oformat->write_header(s); | 
| 2771         if (ret < 0) | 2768         if (ret < 0) | 
| 2772             return ret; | 2769             return ret; | 
| 2773     } | 2770     } | 
| 2774 | 2771 | 
| 2775     /* init PTS generation */ | 2772     /* init PTS generation */ | 
| 2776     for(i=0;i<s->nb_streams;i++) { | 2773     for(i=0;i<s->nb_streams;i++) { | 
| (...skipping 428 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 3205         if (total < ic->nb_streams) | 3202         if (total < ic->nb_streams) | 
| 3206             av_log(NULL, AV_LOG_INFO, "  No Program\n"); | 3203             av_log(NULL, AV_LOG_INFO, "  No Program\n"); | 
| 3207     } | 3204     } | 
| 3208     for(i=0;i<ic->nb_streams;i++) | 3205     for(i=0;i<ic->nb_streams;i++) | 
| 3209         if (!printed[i]) | 3206         if (!printed[i]) | 
| 3210             dump_stream_format(ic, i, index, is_output); | 3207             dump_stream_format(ic, i, index, is_output); | 
| 3211 | 3208 | 
| 3212     av_free(printed); | 3209     av_free(printed); | 
| 3213 } | 3210 } | 
| 3214 | 3211 | 
| 3215 #if LIBAVFORMAT_VERSION_MAJOR < 53 | 3212 #if FF_API_PARSE_FRAME_PARAM | 
| 3216 #include "libavcore/parseutils.h" | 3213 #include "libavcore/parseutils.h" | 
| 3217 | 3214 | 
| 3218 int parse_image_size(int *width_ptr, int *height_ptr, const char *str) | 3215 int parse_image_size(int *width_ptr, int *height_ptr, const char *str) | 
| 3219 { | 3216 { | 
| 3220     return av_parse_video_size(width_ptr, height_ptr, str); | 3217     return av_parse_video_size(width_ptr, height_ptr, str); | 
| 3221 } | 3218 } | 
| 3222 | 3219 | 
| 3223 int parse_frame_rate(int *frame_rate_num, int *frame_rate_den, const char *arg) | 3220 int parse_frame_rate(int *frame_rate_num, int *frame_rate_den, const char *arg) | 
| 3224 { | 3221 { | 
| 3225     AVRational frame_rate; | 3222     AVRational frame_rate; | 
| (...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 3524 void av_pkt_dump(FILE *f, AVPacket *pkt, int dump_payload) | 3521 void av_pkt_dump(FILE *f, AVPacket *pkt, int dump_payload) | 
| 3525 { | 3522 { | 
| 3526     pkt_dump_internal(NULL, f, 0, pkt, dump_payload); | 3523     pkt_dump_internal(NULL, f, 0, pkt, dump_payload); | 
| 3527 } | 3524 } | 
| 3528 | 3525 | 
| 3529 void av_pkt_dump_log(void *avcl, int level, AVPacket *pkt, int dump_payload) | 3526 void av_pkt_dump_log(void *avcl, int level, AVPacket *pkt, int dump_payload) | 
| 3530 { | 3527 { | 
| 3531     pkt_dump_internal(avcl, NULL, level, pkt, dump_payload); | 3528     pkt_dump_internal(avcl, NULL, level, pkt, dump_payload); | 
| 3532 } | 3529 } | 
| 3533 | 3530 | 
| 3534 #if LIBAVFORMAT_VERSION_MAJOR < 53 | 3531 #if FF_API_URL_SPLIT | 
| 3535 attribute_deprecated | 3532 attribute_deprecated | 
| 3536 void ff_url_split(char *proto, int proto_size, | 3533 void ff_url_split(char *proto, int proto_size, | 
| 3537                   char *authorization, int authorization_size, | 3534                   char *authorization, int authorization_size, | 
| 3538                   char *hostname, int hostname_size, | 3535                   char *hostname, int hostname_size, | 
| 3539                   int *port_ptr, | 3536                   int *port_ptr, | 
| 3540                   char *path, int path_size, | 3537                   char *path, int path_size, | 
| 3541                   const char *url) | 3538                   const char *url) | 
| 3542 { | 3539 { | 
| 3543     av_url_split(proto, proto_size, | 3540     av_url_split(proto, proto_size, | 
| 3544                  authorization, authorization_size, | 3541                  authorization, authorization_size, | 
| (...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 3784         } else { | 3781         } else { | 
| 3785             for (; *ptr && !(isspace(*ptr) || *ptr == ','); ptr++) | 3782             for (; *ptr && !(isspace(*ptr) || *ptr == ','); ptr++) | 
| 3786                 if (dest && dest < dest_end) | 3783                 if (dest && dest < dest_end) | 
| 3787                     *dest++ = *ptr; | 3784                     *dest++ = *ptr; | 
| 3788         } | 3785         } | 
| 3789         if (dest) | 3786         if (dest) | 
| 3790             *dest = 0; | 3787             *dest = 0; | 
| 3791     } | 3788     } | 
| 3792 } | 3789 } | 
| 3793 | 3790 | 
| OLD | NEW | 
|---|