Magellan Linux

Contents of /trunk/strigi/patches/strigi-0.7.5-ffmpeg.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1489 - (show annotations) (download)
Sat Aug 6 17:09:48 2011 UTC (12 years, 8 months ago) by niro
File size: 7263 byte(s)
-fix build against newer ffmpeg
1 From: Tirtha Chatterjee <tirtha.p.chatterjee@gmail.com>
2 Date: Tue, 21 Jun 2011 19:16:55 +0000
3 Subject: used the new API of ffmpeg, fixes a build issue with ffmpeg from git.
4 X-Git-Tag: v0.7.6
5 X-Git-Url: http://quickgit.kde.org/?p=libstreamanalyzer.git&amp;a=commitdiff&amp;h=4cfbe1fe673b48797bbea0b98c81d7ccf05a1d72
6 ---
7 used the new API of ffmpeg, fixes a build issue with ffmpeg from git.
8 ---
9
10
11 --- a/plugins/endplugins/ffmpegendanalyzer.cpp
12 +++ b/plugins/endplugins/ffmpegendanalyzer.cpp
13 @@ -348,7 +348,7 @@ FFMPEGEndAnalyzer::analyze(AnalysisResul
14 if ((size = in->size()) >= 0)
15 ar.addValue(factory->durationProperty, (uint32_t)(size/(fc->bit_rate/8)));
16 }
17 - if(fc->nb_streams==1 && fc->streams[0]->codec->codec_type == CODEC_TYPE_AUDIO) {
18 + if(fc->nb_streams==1 && fc->streams[0]->codec->codec_type == AVMEDIA_TYPE_AUDIO) {
19 ar.addValue(factory->typeProperty, NFO "Audio");
20 ar.addValue(factory->typeProperty, NMM_DRAFT "MusicPiece");
21 } else {
22 @@ -359,7 +359,7 @@ FFMPEGEndAnalyzer::analyze(AnalysisResul
23 const AVStream &stream = *fc->streams[i];
24 const AVCodecContext &codec = *stream.codec;
25
26 - if (codec.codec_type == CODEC_TYPE_AUDIO || codec.codec_type == CODEC_TYPE_VIDEO) {
27 + if (codec.codec_type == AVMEDIA_TYPE_AUDIO || codec.codec_type == AVMEDIA_TYPE_VIDEO) {
28 const string streamuri = ar.newAnonymousUri();
29 ar.addValue(factory->hasPartProperty, streamuri);
30 ar.addTriplet(streamuri, partOfPropertyName, ar.path());
31 @@ -370,8 +370,16 @@ FFMPEGEndAnalyzer::analyze(AnalysisResul
32 outs << (stream.duration * stream.time_base.num / stream.time_base.den);
33 ar.addTriplet(streamuri, durationPropertyName,outs.str());
34 }
35 - if (size_t len = strlen(stream.language)) {
36 - ar.addTriplet(streamuri, languagePropertyName, string(stream.language, len));
37 +#if FF_API_OLD_METADATA2
38 + AVMetadataTag *entry = av_metadata_get(stream.metadata, "language", NULL, 0);
39 +#else
40 + AVDictionaryEntry *entry = av_dict_get(stream.metadata, "language", NULL, 0);
41 +#endif
42 + if (entry != NULL) {
43 + const char *languageValue = entry->value;
44 + if (size_t len = strlen(languageValue)) {
45 + ar.addTriplet(streamuri, languagePropertyName, string(languageValue, len));
46 + }
47 }
48 const AVCodec *p = avcodec_find_decoder(codec.codec_id);
49 if (p) {
50 @@ -408,7 +416,7 @@ FFMPEGEndAnalyzer::analyze(AnalysisResul
51 ar.addTriplet(streamuri, bitratePropertyName, outs.str());
52 }
53
54 - if (codec.codec_type == CODEC_TYPE_AUDIO) {
55 + if (codec.codec_type == AVMEDIA_TYPE_AUDIO) {
56
57 ar.addTriplet(streamuri, typePropertyName, audioClassName);
58 if (codec.channels) {
59 @@ -458,36 +466,107 @@ FFMPEGEndAnalyzer::analyze(AnalysisResul
60 }
61
62 // Tags
63 -
64 - if (int32_t len = strlen(fc->title)) {
65 - ar.addValue(factory->titleProperty, string(fc->title, len) );
66 - }
67 - if (int32_t len = strlen(fc->author)) {
68 - const string creatoruri = ar.newAnonymousUri();
69 - ar.addValue(factory->creatorProperty, creatoruri);
70 - ar.addTriplet(creatoruri, typePropertyName, contactClassName);
71 - ar.addTriplet(creatoruri, fullnamePropertyName, string(fc->author, len) );
72 - }
73 - if (int32_t len = strlen(fc->copyright)) {
74 - ar.addValue(factory->copyrightProperty, string(fc->copyright, len) );
75 - }
76 - if (int32_t len = strlen(fc->comment)) {
77 - ar.addValue(factory->commentProperty, string(fc->comment, len) );
78 - }
79 - if (int32_t len = strlen(fc->album)) {
80 - const string album = ar.newAnonymousUri();
81 - ar.addValue(factory->albumProperty, album);
82 +#if FF_API_OLD_METADATA2
83 + AVMetadataTag *entry = av_metadata_get(fc->metadata, "title", NULL, 0);
84 +#else
85 + AVDictionaryEntry *entry = av_dict_get(fc->metadata, "title", NULL, 0);
86 +#endif
87 + if (entry != NULL)
88 + {
89 + const char *titleValue = entry->value;
90 + if (int32_t len = strlen(titleValue)) {
91 + ar.addValue(factory->titleProperty, string(titleValue, len) );
92 + }
93 + }
94 +#if FF_API_OLD_METADATA2
95 + entry = av_metadata_get(fc->metadata, "author", NULL, 0);
96 +#else
97 + entry = av_dict_get(fc->metadata, "author", NULL, 0);
98 +#endif
99 + if (entry != NULL)
100 + {
101 + const char *authorValue = entry->value;
102 + if (int32_t len = strlen(authorValue)) {
103 + const string creatoruri = ar.newAnonymousUri();
104 + ar.addValue(factory->creatorProperty, creatoruri);
105 + ar.addTriplet(creatoruri, typePropertyName, contactClassName);
106 + ar.addTriplet(creatoruri, fullnamePropertyName, string(authorValue, len) );
107 + }
108 + }
109 +#if FF_API_OLD_METADATA2
110 + entry = av_metadata_get(fc->metadata, "copyright", NULL, 0);
111 +#else
112 + entry = av_dict_get(fc->metadata, "copyright", NULL, 0);
113 +#endif
114 + if (entry != NULL)
115 + {
116 + const char *copyrightValue = entry->value;
117 + if (int32_t len = strlen(copyrightValue)) {
118 + ar.addValue(factory->copyrightProperty, string(copyrightValue, len) );
119 + }
120 + }
121 +#if FF_API_OLD_METADATA2
122 + entry = av_metadata_get(fc->metadata, "comment", NULL, 0);
123 +#else
124 + entry = av_dict_get(fc->metadata, "comment", NULL, 0);
125 +#endif
126 + if (entry != NULL)
127 + {
128 + const char *commentValue = entry->value;
129 + if (int32_t len = strlen(commentValue)) {
130 + ar.addValue(factory->commentProperty, string(commentValue, len) );
131 + }
132 + }
133 +#if FF_API_OLD_METADATA2
134 + entry = av_metadata_get(fc->metadata, "album", NULL, 0);
135 +#else
136 + entry = av_dict_get(fc->metadata, "album", NULL, 0);
137 +#endif
138 + if (entry != NULL)
139 + {
140 + const char *albumValue = entry->value;
141 + if (int32_t len = strlen(albumValue)) {
142 + const string album = ar.newAnonymousUri();
143 + ar.addValue(factory->albumProperty, album);
144 ar.addTriplet(album, typePropertyName, albumClassName);
145 - ar.addTriplet(album, titlePropertyName, string(fc->album, len) );
146 + ar.addTriplet(album, titlePropertyName, string(albumValue, len) );
147 + }
148 }
149 - if (int32_t len = strlen(fc->genre)) {
150 - ar.addValue(factory->genreProperty, string(fc->genre, len) );
151 +#if FF_API_OLD_METADATA2
152 + entry = av_metadata_get(fc->metadata, "genre", NULL, 0);
153 +#else
154 + entry = av_dict_get(fc->metadata, "genre", NULL, 0);
155 +#endif
156 + if (entry != NULL)
157 + {
158 + const char *genreValue = entry->value;
159 + if (int32_t len = strlen(genreValue)) {
160 + ar.addValue(factory->genreProperty, string(genreValue, len) );
161 + }
162 }
163 - if (fc->track) {
164 - ar.addValue(factory->trackProperty, fc->track);
165 +#if FF_API_OLD_METADATA2
166 + entry = av_metadata_get(fc->metadata, "track", NULL, 0);
167 +#else
168 + entry = av_dict_get(fc->metadata, "track", NULL, 0);
169 +#endif
170 + if (entry != NULL)
171 + {
172 + const char *trackValue = entry->value;
173 + if (int32_t len = strlen(trackValue)) {
174 + ar.addValue(factory->trackProperty, string(trackValue, len) );
175 + }
176 }
177 - if (fc->year) {
178 - ar.addValue(factory->createdProperty, fc->year);
179 +#if FF_API_OLD_METADATA2
180 + entry = av_metadata_get(fc->metadata, "year", NULL, 0);
181 +#else
182 + entry = av_dict_get(fc->metadata, "year", NULL, 0);
183 +#endif
184 + if (entry != NULL)
185 + {
186 + const char *yearValue = entry->value;
187 + if (int32_t len = strlen(yearValue)) {
188 + ar.addValue(factory->createdProperty, string(yearValue, len) );
189 + }
190 }
191
192 av_close_input_stream(fc);
193