| @@ -10,7 +10,6 @@ OBJS = allformats.o \ | |||
| id3v1.o \ | |||
| id3v2.o \ | |||
| metadata.o \ | |||
| metadata_compat.o \ | |||
| options.o \ | |||
| os_support.o \ | |||
| sdp.o \ | |||
| @@ -133,20 +133,6 @@ typedef struct AVMetadataConv AVMetadataConv; | |||
| AVMetadataTag * | |||
| av_metadata_get(AVMetadata *m, const char *key, const AVMetadataTag *prev, int flags); | |||
| #if FF_API_OLD_METADATA | |||
| /** | |||
| * Set the given tag in *pm, overwriting an existing tag. | |||
| * | |||
| * @param pm pointer to a pointer to a metadata struct. If *pm is NULL | |||
| * a metadata struct is allocated and put in *pm. | |||
| * @param key tag key to add to *pm (will be av_strduped) | |||
| * @param value tag value to add to *pm (will be av_strduped) | |||
| * @return >= 0 on success otherwise an error code <0 | |||
| * @deprecated Use av_metadata_set2() instead. | |||
| */ | |||
| attribute_deprecated int av_metadata_set(AVMetadata **pm, const char *key, const char *value); | |||
| #endif | |||
| /** | |||
| * Set the given tag in *pm, overwriting an existing tag. | |||
| * | |||
| @@ -544,10 +530,6 @@ typedef struct AVStream { | |||
| */ | |||
| int64_t duration; | |||
| #if FF_API_OLD_METADATA | |||
| attribute_deprecated char language[4]; /**< ISO 639-2/B 3-letter language code (empty string if undefined) */ | |||
| #endif | |||
| /* av_read_frame() support */ | |||
| enum AVStreamParseType need_parsing; | |||
| struct AVCodecParserContext *parser; | |||
| @@ -567,10 +549,6 @@ typedef struct AVStream { | |||
| attribute_deprecated int64_t unused[4+1]; | |||
| #endif | |||
| #if FF_API_OLD_METADATA | |||
| attribute_deprecated char *filename; /**< source filename of the stream */ | |||
| #endif | |||
| int disposition; /**< AV_DISPOSITION_* bit field */ | |||
| AVProbeData probe_data; | |||
| @@ -648,10 +626,6 @@ typedef struct AVStream { | |||
| */ | |||
| typedef struct AVProgram { | |||
| int id; | |||
| #if FF_API_OLD_METADATA | |||
| attribute_deprecated char *provider_name; ///< network name for DVB streams | |||
| attribute_deprecated char *name; ///< service name for DVB streams | |||
| #endif | |||
| int flags; | |||
| enum AVDiscard discard; ///< selects which program to discard and which to feed to the caller | |||
| unsigned int *stream_index; | |||
| @@ -666,9 +640,6 @@ typedef struct AVChapter { | |||
| int id; ///< unique ID to identify the chapter | |||
| AVRational time_base; ///< time base in which the start/end timestamps are specified | |||
| int64_t start, end; ///< chapter start/end time in time_base units | |||
| #if FF_API_OLD_METADATA | |||
| attribute_deprecated char *title; ///< chapter title | |||
| #endif | |||
| AVMetadata *metadata; | |||
| } AVChapter; | |||
| @@ -691,16 +662,6 @@ typedef struct AVFormatContext { | |||
| char filename[1024]; /**< input or output filename */ | |||
| /* stream info */ | |||
| int64_t timestamp; | |||
| #if FF_API_OLD_METADATA | |||
| attribute_deprecated char title[512]; | |||
| attribute_deprecated char author[512]; | |||
| attribute_deprecated char copyright[512]; | |||
| attribute_deprecated char comment[512]; | |||
| attribute_deprecated char album[512]; | |||
| attribute_deprecated int year; /**< ID3 year, 0 if none */ | |||
| attribute_deprecated int track; /**< track number, 0 if none */ | |||
| attribute_deprecated char genre[32]; /**< ID3 genre */ | |||
| #endif | |||
| int ctx_flags; /**< Format-specific flags, see AVFMTCTX_xx */ | |||
| /* private data for pts handling (do not modify directly). */ | |||
| @@ -86,13 +86,6 @@ int av_metadata_set2(AVMetadata **pm, const char *key, const char *value, int fl | |||
| return 0; | |||
| } | |||
| #if FF_API_OLD_METADATA | |||
| int av_metadata_set(AVMetadata **pm, const char *key, const char *value) | |||
| { | |||
| return av_metadata_set2(pm, key, value, 0); | |||
| } | |||
| #endif | |||
| #if FF_API_OLD_METADATA2 | |||
| void av_metadata_conv(AVFormatContext *ctx, const AVMetadataConv *d_conv, | |||
| const AVMetadataConv *s_conv) | |||
| @@ -43,11 +43,6 @@ struct AVMetadataConv{ | |||
| typedef struct AVMetadataConv AVMetadataConv; | |||
| #endif | |||
| #if FF_API_OLD_METADATA | |||
| void ff_metadata_demux_compat(AVFormatContext *s); | |||
| void ff_metadata_mux_compat(AVFormatContext *s); | |||
| #endif | |||
| void ff_metadata_conv(AVMetadata **pm, const AVMetadataConv *d_conv, | |||
| const AVMetadataConv *s_conv); | |||
| void ff_metadata_conv_ctx(AVFormatContext *ctx, const AVMetadataConv *d_conv, | |||
| @@ -1,148 +0,0 @@ | |||
| /* | |||
| * Copyright (c) 2009 Aurelien Jacobs <aurel@gnuage.org> | |||
| * | |||
| * This file is part of Libav. | |||
| * | |||
| * Libav is free software; you can redistribute it and/or | |||
| * modify it under the terms of the GNU Lesser General Public | |||
| * License as published by the Free Software Foundation; either | |||
| * version 2.1 of the License, or (at your option) any later version. | |||
| * | |||
| * Libav is distributed in the hope that it will be useful, | |||
| * but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
| * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |||
| * Lesser General Public License for more details. | |||
| * | |||
| * You should have received a copy of the GNU Lesser General Public | |||
| * License along with Libav; if not, write to the Free Software | |||
| * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | |||
| */ | |||
| #include <strings.h> | |||
| #include "avformat.h" | |||
| #include "metadata.h" | |||
| #include "libavutil/avstring.h" | |||
| #if FF_API_OLD_METADATA | |||
| #define SIZE_OFFSET(x) sizeof(((AVFormatContext*)0)->x),offsetof(AVFormatContext,x) | |||
| static const struct { | |||
| const char name[16]; | |||
| int size; | |||
| int offset; | |||
| } compat_tab[] = { | |||
| { "title", SIZE_OFFSET(title) }, | |||
| { "author", SIZE_OFFSET(author) }, | |||
| { "copyright", SIZE_OFFSET(copyright) }, | |||
| { "comment", SIZE_OFFSET(comment) }, | |||
| { "album", SIZE_OFFSET(album) }, | |||
| { "year", SIZE_OFFSET(year) }, | |||
| { "track", SIZE_OFFSET(track) }, | |||
| { "genre", SIZE_OFFSET(genre) }, | |||
| { "artist", SIZE_OFFSET(author) }, | |||
| { "creator", SIZE_OFFSET(author) }, | |||
| { "written_by", SIZE_OFFSET(author) }, | |||
| { "lead_performer", SIZE_OFFSET(author) }, | |||
| { "composer", SIZE_OFFSET(author) }, | |||
| { "performer", SIZE_OFFSET(author) }, | |||
| { "description", SIZE_OFFSET(comment) }, | |||
| { "albumtitle", SIZE_OFFSET(album) }, | |||
| { "date", SIZE_OFFSET(year) }, | |||
| { "date_written", SIZE_OFFSET(year) }, | |||
| { "date_released", SIZE_OFFSET(year) }, | |||
| { "tracknumber", SIZE_OFFSET(track) }, | |||
| { "part_number", SIZE_OFFSET(track) }, | |||
| }; | |||
| void ff_metadata_demux_compat(AVFormatContext *ctx) | |||
| { | |||
| AVMetadata *m; | |||
| int i, j; | |||
| if ((m = ctx->metadata)) | |||
| for (j=0; j<m->count; j++) | |||
| for (i=0; i<FF_ARRAY_ELEMS(compat_tab); i++) | |||
| if (!strcasecmp(m->elems[j].key, compat_tab[i].name)) { | |||
| int *ptr = (int *)((char *)ctx+compat_tab[i].offset); | |||
| if (*ptr) continue; | |||
| if (compat_tab[i].size > sizeof(int)) | |||
| av_strlcpy((char *)ptr, m->elems[j].value, compat_tab[i].size); | |||
| else | |||
| *ptr = atoi(m->elems[j].value); | |||
| } | |||
| for (i=0; i<ctx->nb_chapters; i++) | |||
| if ((m = ctx->chapters[i]->metadata)) | |||
| for (j=0; j<m->count; j++) | |||
| if (!strcasecmp(m->elems[j].key, "title")) { | |||
| av_free(ctx->chapters[i]->title); | |||
| ctx->chapters[i]->title = av_strdup(m->elems[j].value); | |||
| } | |||
| for (i=0; i<ctx->nb_programs; i++) | |||
| if ((m = ctx->programs[i]->metadata)) | |||
| for (j=0; j<m->count; j++) { | |||
| if (!strcasecmp(m->elems[j].key, "name")) { | |||
| av_free(ctx->programs[i]->name); | |||
| ctx->programs[i]->name = av_strdup(m->elems[j].value); | |||
| } | |||
| if (!strcasecmp(m->elems[j].key, "provider_name")) { | |||
| av_free(ctx->programs[i]->provider_name); | |||
| ctx->programs[i]->provider_name = av_strdup(m->elems[j].value); | |||
| } | |||
| } | |||
| for (i=0; i<ctx->nb_streams; i++) | |||
| if ((m = ctx->streams[i]->metadata)) | |||
| for (j=0; j<m->count; j++) { | |||
| if (!strcasecmp(m->elems[j].key, "language")) | |||
| av_strlcpy(ctx->streams[i]->language, m->elems[j].value, 4); | |||
| if (!strcasecmp(m->elems[j].key, "filename")) { | |||
| av_free(ctx->streams[i]->filename); | |||
| ctx->streams[i]->filename= av_strdup(m->elems[j].value); | |||
| } | |||
| } | |||
| } | |||
| #define FILL_METADATA(s, key, value) { \ | |||
| if (!av_metadata_get(s->metadata, #key, NULL, 0)) \ | |||
| av_metadata_set2(&s->metadata, #key, value, 0); \ | |||
| } | |||
| #define FILL_METADATA_STR(s, key) { \ | |||
| if (s->key && *s->key) FILL_METADATA(s, key, s->key); } | |||
| #define FILL_METADATA_INT(s, key) { \ | |||
| char number[10]; \ | |||
| snprintf(number, sizeof(number), "%d", s->key); \ | |||
| if(s->key) FILL_METADATA(s, key, number) } | |||
| void ff_metadata_mux_compat(AVFormatContext *ctx) | |||
| { | |||
| int i; | |||
| if (ctx->metadata && ctx->metadata->count > 0) | |||
| return; | |||
| FILL_METADATA_STR(ctx, title); | |||
| FILL_METADATA_STR(ctx, author); | |||
| FILL_METADATA_STR(ctx, copyright); | |||
| FILL_METADATA_STR(ctx, comment); | |||
| FILL_METADATA_STR(ctx, album); | |||
| FILL_METADATA_INT(ctx, year); | |||
| FILL_METADATA_INT(ctx, track); | |||
| FILL_METADATA_STR(ctx, genre); | |||
| for (i=0; i<ctx->nb_chapters; i++) | |||
| FILL_METADATA_STR(ctx->chapters[i], title); | |||
| for (i=0; i<ctx->nb_programs; i++) { | |||
| FILL_METADATA_STR(ctx->programs[i], name); | |||
| FILL_METADATA_STR(ctx->programs[i], provider_name); | |||
| } | |||
| for (i=0; i<ctx->nb_streams; i++) { | |||
| FILL_METADATA_STR(ctx->streams[i], language); | |||
| FILL_METADATA_STR(ctx->streams[i], filename); | |||
| } | |||
| } | |||
| #endif /* FF_API_OLD_METADATA */ | |||
| @@ -50,10 +50,6 @@ static const AVOption options[]={ | |||
| {"noparse", "disable AVParsers, this needs nofillin too", 0, FF_OPT_TYPE_CONST, AVFMT_FLAG_NOPARSE, INT_MIN, INT_MAX, D, "fflags"}, | |||
| {"igndts", "ignore dts", 0, FF_OPT_TYPE_CONST, AVFMT_FLAG_IGNDTS, INT_MIN, INT_MAX, D, "fflags"}, | |||
| {"rtphint", "add rtp hinting", 0, FF_OPT_TYPE_CONST, AVFMT_FLAG_RTP_HINT, INT_MIN, INT_MAX, E, "fflags"}, | |||
| #if FF_API_OLD_METADATA | |||
| {"track", " set the track number", OFFSET(track), FF_OPT_TYPE_INT, DEFAULT, 0, INT_MAX, E}, | |||
| {"year", "set the year", OFFSET(year), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, E}, | |||
| #endif | |||
| {"analyzeduration", "how many microseconds are analyzed to estimate duration", OFFSET(max_analyze_duration), FF_OPT_TYPE_INT, 5*AV_TIME_BASE, 0, INT_MAX, D}, | |||
| {"cryptokey", "decryption key", OFFSET(key), FF_OPT_TYPE_BINARY, 0, 0, 0, D}, | |||
| {"indexmem", "max memory used for timestamp index (per stream)", OFFSET(max_index_size), FF_OPT_TYPE_INT, 1<<20, 0, INT_MAX, D}, | |||
| @@ -508,10 +508,6 @@ int av_open_input_stream(AVFormatContext **ic_ptr, | |||
| if (pb && !ic->data_offset) | |||
| ic->data_offset = avio_tell(ic->pb); | |||
| #if FF_API_OLD_METADATA | |||
| ff_metadata_demux_compat(ic); | |||
| #endif | |||
| ic->raw_packet_buffer_remaining_size = RAW_PACKET_BUFFER_SIZE; | |||
| *ic_ptr = ic; | |||
| @@ -2617,18 +2613,11 @@ void avformat_free_context(AVFormatContext *s) | |||
| av_free(st->codec->extradata); | |||
| av_free(st->codec->subtitle_header); | |||
| av_free(st->codec); | |||
| #if FF_API_OLD_METADATA | |||
| av_free(st->filename); | |||
| #endif | |||
| av_free(st->priv_data); | |||
| av_free(st->info); | |||
| av_free(st); | |||
| } | |||
| for(i=s->nb_programs-1; i>=0; i--) { | |||
| #if FF_API_OLD_METADATA | |||
| av_freep(&s->programs[i]->provider_name); | |||
| av_freep(&s->programs[i]->name); | |||
| #endif | |||
| av_metadata_free(&s->programs[i]->metadata); | |||
| av_freep(&s->programs[i]->stream_index); | |||
| av_freep(&s->programs[i]); | |||
| @@ -2636,9 +2625,6 @@ void avformat_free_context(AVFormatContext *s) | |||
| av_freep(&s->programs); | |||
| av_freep(&s->priv_data); | |||
| while(s->nb_chapters--) { | |||
| #if FF_API_OLD_METADATA | |||
| av_free(s->chapters[s->nb_chapters]->title); | |||
| #endif | |||
| av_metadata_free(&s->chapters[s->nb_chapters]->metadata); | |||
| av_free(s->chapters[s->nb_chapters]); | |||
| } | |||
| @@ -2747,9 +2733,6 @@ AVChapter *ff_new_chapter(AVFormatContext *s, int id, AVRational time_base, int6 | |||
| return NULL; | |||
| dynarray_add(&s->chapters, &s->nb_chapters, chapter); | |||
| } | |||
| #if FF_API_OLD_METADATA | |||
| av_free(chapter->title); | |||
| #endif | |||
| av_metadata_set2(&chapter->metadata, "title", title, 0); | |||
| chapter->id = id; | |||
| chapter->time_base= time_base; | |||
| @@ -2887,10 +2870,6 @@ int av_write_header(AVFormatContext *s) | |||
| return AVERROR(ENOMEM); | |||
| } | |||
| #if FF_API_OLD_METADATA | |||
| ff_metadata_mux_compat(s); | |||
| #endif | |||
| /* set muxer identification string */ | |||
| if (s->nb_streams && !(s->streams[0]->codec->flags & CODEC_FLAG_BITEXACT)) { | |||
| av_metadata_set2(&s->metadata, "encoder", LIBAVFORMAT_IDENT, 0); | |||
| @@ -41,9 +41,6 @@ | |||
| * Those FF_API_* defines are not part of public API. | |||
| * They may change, break or disappear at any time. | |||
| */ | |||
| #ifndef FF_API_OLD_METADATA | |||
| #define FF_API_OLD_METADATA (LIBAVFORMAT_VERSION_MAJOR < 53) | |||
| #endif | |||
| #ifndef FF_API_OLD_METADATA2 | |||
| #define FF_API_OLD_METADATA2 (LIBAVFORMAT_VERSION_MAJOR < 54) | |||
| #endif | |||