Author: glen Date: Wed Jan 5 19:52:38 2011 GMT Module: packages Tag: HEAD ---- Log message: - use new ffmpeg metadata api to get id3 tags
---- Files affected: packages/php-ffmpeg: php-ffmpeg.spec (1.28 -> 1.29) , tests-metadata-api.patch (NONE -> 1.1) (NEW) ---- Diffs: ================================================================ Index: packages/php-ffmpeg/php-ffmpeg.spec diff -u packages/php-ffmpeg/php-ffmpeg.spec:1.28 packages/php-ffmpeg/php-ffmpeg.spec:1.29 --- packages/php-ffmpeg/php-ffmpeg.spec:1.28 Wed Jan 5 19:14:19 2011 +++ packages/php-ffmpeg/php-ffmpeg.spec Wed Jan 5 20:52:33 2011 @@ -23,6 +23,7 @@ Patch6: allow_persistent_on_persistentMovie.phpt.patch Patch7: test_fixes.patch Patch8: tests-frame_md5.patch +Patch9: tests-metadata-api.patch URL: http://ffmpeg-php.sourceforge.net/ %if %{with tests} BuildRequires: /usr/bin/php @@ -69,13 +70,11 @@ %patch6 -p1 %patch7 -p1 %patch8 -p1 +%patch9 -p1 # empty file rm tests/getFramesBackwards.phpt -# failing tests -mv tests/getID3Info.phpt{,.broken} - %build phpize CPPFLAGS="%{rpmcppflags} -Werror" @@ -130,6 +129,9 @@ All persons listed below can be reached at <cvs_login>@pld-linux.org $Log$ +Revision 1.29 2011/01/05 19:52:33 glen +- use new ffmpeg metadata api to get id3 tags + Revision 1.28 2011/01/05 18:14:19 glen - update md5 of frame dump tests (checksums against ffmpeg 0.6.1) ================================================================ Index: packages/php-ffmpeg/tests-metadata-api.patch diff -u /dev/null packages/php-ffmpeg/tests-metadata-api.patch:1.1 --- /dev/null Wed Jan 5 20:52:38 2011 +++ packages/php-ffmpeg/tests-metadata-api.patch Wed Jan 5 20:52:33 2011 @@ -0,0 +1,216 @@ +http://cakebox.homeunix.net/doc/ffmpeg/APIchanges + +2009-03-01 - r17682 - lavf 52.31.0 - Generic metadata API + Introduce a new metadata API (see av_metadata_get() and friends). + The old API is now deprecated and should not be used anymore. This especially + includes the following structure fields: + - AVFormatContext.title + - AVFormatContext.author + - AVFormatContext.copyright + - AVFormatContext.comment + - AVFormatContext.album + - AVFormatContext.year + - AVFormatContext.track + - AVFormatContext.genre + - AVStream.language + - AVStream.filename + - AVProgram.provider_name + - AVProgram.name + - AVChapter.title + +/usr/include/libavformat/avformat.h : +#if LIBAVFORMAT_VERSION_INT < (53<<16) + char title[512]; + char author[512]; + char copyright[512]; + char comment[512]; + char album[512]; + int year; /**< ID3 year, 0 if none */ + int track; /**< track number, 0 if none */ + char genre[32]; /**< ID3 genre */ +#endif + +// to dump tags: +AVMetadataTag *tag = NULL; +while((tag=av_metadata_get(m, "", tag, AV_METADATA_IGNORE_SUFFIX))) { + printf(" %-16s: %s\n", tag->key, tag->value); +} + +--- ffmpeg-php-0.6.0//ffmpeg_movie.c 2011-01-05 21:48:29.247659645 +0200 ++++ ffmpeg-php-metadata_api/ffmpeg_movie.c 2011-01-05 21:47:10.709759988 +0200 +@@ -71,6 +71,7 @@ + + typedef struct { + AVFormatContext *fmt_ctx; ++ AVMetadata *metadata; + AVCodecContext *codec_ctx[MAX_STREAMS]; + int64_t last_pts; + int frame_number; +@@ -200,6 +201,7 @@ + ffmovie_ctx = persistent ? malloc(sizeof(ff_movie_context)) : + emalloc(sizeof(ff_movie_context)); + ffmovie_ctx->fmt_ctx = NULL; ++ ffmovie_ctx->metadata = NULL; + ffmovie_ctx->frame_number = 0; + + for (i = 0; i < MAX_STREAMS; i++) { +@@ -268,6 +270,29 @@ + } + /* }}} */ + ++#if LIBAVFORMAT_VERSION_INT >= AV_VERSION_INT(52, 31, 0) ++/* {{{ _php_get_metadata() ++ */ ++static const char* _php_get_metadata_tag(ff_movie_context *ffmovie_ctx, const char *key) ++{ ++ // on first access do av_metadata_conv ++ if (ffmovie_ctx->metadata == NULL) { ++ av_metadata_conv(ffmovie_ctx->fmt_ctx, NULL, ffmovie_ctx->fmt_ctx->iformat->metadata_conv); ++ ffmovie_ctx->metadata = ffmovie_ctx->fmt_ctx->metadata; ++ } ++ ++ // can metadata be missing? ++ if (!ffmovie_ctx->metadata) { ++ return NULL; ++ } ++ ++ // get from metadata ++ AVMetadataTag *tag = av_metadata_get(ffmovie_ctx->metadata, key, NULL, 0); ++ return tag ? tag->value : NULL; ++} ++#endif ++ ++/* }}} */ + + /* {{{ proto object ffmpeg_movie(string filename) + Constructor for ffmpeg_movie objects +@@ -529,9 +554,16 @@ + ff_movie_context *ffmovie_ctx; + + GET_MOVIE_RESOURCE(ffmovie_ctx); +- ++ ++#if LIBAVFORMAT_VERSION_INT >= AV_VERSION_INT(52, 31, 0) ++ const char *tag = _php_get_metadata_tag(ffmovie_ctx, "comment"); ++ if (tag && *tag) { ++ RETURN_STRINGL(tag, strlen(tag), 1); ++ } ++#else + RETURN_STRINGL(ffmovie_ctx->fmt_ctx->comment, + strlen(ffmovie_ctx->fmt_ctx->comment), 1); ++#endif + } + /* }}} */ + +@@ -545,8 +577,15 @@ + + GET_MOVIE_RESOURCE(ffmovie_ctx); + ++#if LIBAVFORMAT_VERSION_INT >= AV_VERSION_INT(52, 31, 0) ++ const char *tag = _php_get_metadata_tag(ffmovie_ctx, "title"); ++ if (tag && *tag) { ++ RETURN_STRINGL(tag, strlen(tag), 1); ++ } ++#else + RETURN_STRINGL(ffmovie_ctx->fmt_ctx->title, + strlen(ffmovie_ctx->fmt_ctx->title), 1); ++#endif + } + /* }}} */ + +@@ -560,8 +599,15 @@ + + GET_MOVIE_RESOURCE(ffmovie_ctx); + ++#if LIBAVFORMAT_VERSION_INT >= AV_VERSION_INT(52, 31, 0) ++ const char *tag = _php_get_metadata_tag(ffmovie_ctx, "artist"); ++ if (tag && *tag) { ++ RETURN_STRINGL(tag, strlen(tag), 1); ++ } ++#else + RETURN_STRINGL(ffmovie_ctx->fmt_ctx->author, + strlen(ffmovie_ctx->fmt_ctx->author), 1); ++#endif + } + /* }}} */ + +@@ -574,8 +620,15 @@ + + GET_MOVIE_RESOURCE(ffmovie_ctx); + ++#if LIBAVFORMAT_VERSION_INT >= AV_VERSION_INT(52, 31, 0) ++ const char *tag = _php_get_metadata_tag(ffmovie_ctx, "copyright"); ++ if (tag && *tag) { ++ RETURN_STRINGL(tag, strlen(tag), 1); ++ } ++#else + RETURN_STRINGL(ffmovie_ctx->fmt_ctx->copyright, + strlen(ffmovie_ctx->fmt_ctx->copyright), 1); ++#endif + } + /* }}} */ + +@@ -589,8 +642,15 @@ + + GET_MOVIE_RESOURCE(ffmovie_ctx); + ++#if LIBAVFORMAT_VERSION_INT >= AV_VERSION_INT(52, 31, 0) ++ const char *tag = _php_get_metadata_tag(ffmovie_ctx, "album"); ++ if (tag && *tag) { ++ RETURN_STRINGL(tag, strlen(tag), 1); ++ } ++#else + RETURN_STRINGL(ffmovie_ctx->fmt_ctx->album, + strlen(ffmovie_ctx->fmt_ctx->album), 1); ++#endif + } + /* }}} */ + +@@ -603,8 +663,15 @@ + + GET_MOVIE_RESOURCE(ffmovie_ctx); + ++#if LIBAVFORMAT_VERSION_INT >= AV_VERSION_INT(52, 31, 0) ++ const char *tag = _php_get_metadata_tag(ffmovie_ctx, "genre"); ++ if (tag && *tag) { ++ RETURN_STRINGL(tag, strlen(tag), 1); ++ } ++#else + RETURN_STRINGL(ffmovie_ctx->fmt_ctx->genre, + strlen(ffmovie_ctx->fmt_ctx->genre), 1); ++#endif + } + /* }}} */ + +@@ -618,7 +685,14 @@ + + GET_MOVIE_RESOURCE(ffmovie_ctx); + ++#if LIBAVFORMAT_VERSION_INT >= AV_VERSION_INT(52, 31, 0) ++ const char *tag = _php_get_metadata_tag(ffmovie_ctx, "track"); ++ if (tag && *tag) { ++ RETURN_STRINGL(tag, strlen(tag), 1); ++ } ++#else + RETURN_LONG(ffmovie_ctx->fmt_ctx->track); ++#endif + } + /* }}} */ + +@@ -631,7 +705,16 @@ + + GET_MOVIE_RESOURCE(ffmovie_ctx); + ++#if LIBAVFORMAT_VERSION_INT >= AV_VERSION_INT(52, 31, 0) ++ // "id3v2 tag TYER is not considered in generic format ++ // ideally "date" should be used here and extract year from it for full compatability ++ const char *tag = _php_get_metadata_tag(ffmovie_ctx, "TYER"); ++ if (tag && *tag) { ++ RETURN_STRINGL(tag, strlen(tag), 1); ++ } ++#else + RETURN_LONG(ffmovie_ctx->fmt_ctx->year); ++#endif + } + /* }}} */ + ================================================================ ---- CVS-web: http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/packages/php-ffmpeg/php-ffmpeg.spec?r1=1.28&r2=1.29&f=u _______________________________________________ pld-cvs-commit mailing list [email protected] http://lists.pld-linux.org/mailman/listinfo/pld-cvs-commit
