Mageia Bugzilla – Attachment 2798 Details for
Bug 6647
mediatomb segfaults on avutil - probably mga2 patch was not ported over
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
New Account
|
Forgot Password
[patch]
libav_0_7 with patch for ffmpeg
libav_0.7_support.patch (text/plain), 2.75 KB, created by
Joseph Wang
on 2012-09-15 18:42:17 CEST
(
hide
)
Description:
libav_0_7 with patch for ffmpeg
Filename:
MIME Type:
Creator:
Joseph Wang
Created:
2012-09-15 18:42:17 CEST
Size:
2.75 KB
patch
obsolete
>--- mediatomb-0.12.1/src/metadata/ffmpeg_handler.cc.ffmpeg 2010-03-25 22:58:10.000000000 +0800 >+++ mediatomb-0.12.1/src/metadata/ffmpeg_handler.cc 2012-09-16 00:29:00.285771465 +0800 >@@ -89,6 +89,33 @@ > > Ref<StringConverter> sc = StringConverter::m2i(); > >+ /* Tabs are 4 characters here */ >+ typedef struct {const char *avname; metadata_fields_t field;} mapping_t; >+ static const mapping_t mapping[] = >+ { >+ {"title", M_TITLE}, >+ {"artist", M_ARTIST}, >+ {"album", M_ALBUM}, >+ {"date", M_DATE}, >+ {"genre", M_GENRE}, >+ {"comment", M_DESCRIPTION}, >+ {"track", M_TRACKNUMBER}, >+ {NULL, M_MAX}, >+ }; >+ >+ if (!pFormatCtx->metadata) >+ return; >+ for (const mapping_t *m = mapping; m->avname != NULL; m++) >+ { >+ AVDictionaryEntry *tag = NULL; >+ tag = av_dict_get(pFormatCtx->metadata, m->avname, NULL, 0); >+ if (tag && tag->value && tag->value[0]) >+ { >+ log_debug("Added metadata %s: %s\n", m->avname, tag->value); >+ item->setMetadata(MT_KEYS[m->field].upnp, sc->convert(tag->value)); >+ } >+ } >+ /* Old algorithm (doesn't work with libav >= 0.7) > if (strlen(pFormatCtx->title) > 0) > { > log_debug("Added metadata title: %s\n", pFormatCtx->title); >@@ -131,6 +158,7 @@ > item->setMetadata(MT_KEYS[M_TRACKNUMBER].upnp, > sc->convert(String::from(pFormatCtx->track))); > } >+ */ > } > > // ffmpeg library calls >@@ -178,7 +206,7 @@ > for(i=0; i<pFormatCtx->nb_streams; i++) > { > AVStream *st = pFormatCtx->streams[i]; >- if((st != NULL) && (videoset == false) && (st->codec->codec_type == CODEC_TYPE_VIDEO)) >+ if((st != NULL) && (videoset == false) && (st->codec->codec_type == AVMEDIA_TYPE_VIDEO)) > { > if (st->codec->codec_tag > 0) > { >@@ -209,7 +237,7 @@ > *y = st->codec->height; > } > } >- if(st->codec->codec_type == CODEC_TYPE_AUDIO) >+ if(st->codec->codec_type == AVMEDIA_TYPE_AUDIO) > { > // Increase number of audiochannels > audioch++; >@@ -251,7 +279,7 @@ > int x = 0; > int y = 0; > >- AVFormatContext *pFormatCtx; >+ AVFormatContext *pFormatCtx = avformat_alloc_context(); > > // Suppress all log messages > av_log_set_callback(FfmpegNoOutputStub); >@@ -260,8 +288,8 @@ > av_register_all(); > > // Open video file >- if (av_open_input_file(&pFormatCtx, >- item->getLocation().c_str(), NULL, 0, NULL) != 0) >+ if (avformat_open_input(&pFormatCtx, >+ item->getLocation().c_str(), NULL, NULL) != 0) > return; // Couldn't open file > > // Retrieve stream information >@@ -277,6 +305,7 @@ > > // Close the video file > av_close_input_file(pFormatCtx); >+ avformat_free_context(pFormatCtx); > } > > Ref<IOHandler> FfmpegHandler::serveContent(Ref<CdsItem> item, int resNum, off_t *data_size)
--- mediatomb-0.12.1/src/metadata/ffmpeg_handler.cc.ffmpeg 2010-03-25 22:58:10.000000000 +0800 +++ mediatomb-0.12.1/src/metadata/ffmpeg_handler.cc 2012-09-16 00:29:00.285771465 +0800 @@ -89,6 +89,33 @@ Ref<StringConverter> sc = StringConverter::m2i(); + /* Tabs are 4 characters here */ + typedef struct {const char *avname; metadata_fields_t field;} mapping_t; + static const mapping_t mapping[] = + { + {"title", M_TITLE}, + {"artist", M_ARTIST}, + {"album", M_ALBUM}, + {"date", M_DATE}, + {"genre", M_GENRE}, + {"comment", M_DESCRIPTION}, + {"track", M_TRACKNUMBER}, + {NULL, M_MAX}, + }; + + if (!pFormatCtx->metadata) + return; + for (const mapping_t *m = mapping; m->avname != NULL; m++) + { + AVDictionaryEntry *tag = NULL; + tag = av_dict_get(pFormatCtx->metadata, m->avname, NULL, 0); + if (tag && tag->value && tag->value[0]) + { + log_debug("Added metadata %s: %s\n", m->avname, tag->value); + item->setMetadata(MT_KEYS[m->field].upnp, sc->convert(tag->value)); + } + } + /* Old algorithm (doesn't work with libav >= 0.7) if (strlen(pFormatCtx->title) > 0) { log_debug("Added metadata title: %s\n", pFormatCtx->title); @@ -131,6 +158,7 @@ item->setMetadata(MT_KEYS[M_TRACKNUMBER].upnp, sc->convert(String::from(pFormatCtx->track))); } + */ } // ffmpeg library calls @@ -178,7 +206,7 @@ for(i=0; i<pFormatCtx->nb_streams; i++) { AVStream *st = pFormatCtx->streams[i]; - if((st != NULL) && (videoset == false) && (st->codec->codec_type == CODEC_TYPE_VIDEO)) + if((st != NULL) && (videoset == false) && (st->codec->codec_type == AVMEDIA_TYPE_VIDEO)) { if (st->codec->codec_tag > 0) { @@ -209,7 +237,7 @@ *y = st->codec->height; } } - if(st->codec->codec_type == CODEC_TYPE_AUDIO) + if(st->codec->codec_type == AVMEDIA_TYPE_AUDIO) { // Increase number of audiochannels audioch++; @@ -251,7 +279,7 @@ int x = 0; int y = 0; - AVFormatContext *pFormatCtx; + AVFormatContext *pFormatCtx = avformat_alloc_context(); // Suppress all log messages av_log_set_callback(FfmpegNoOutputStub); @@ -260,8 +288,8 @@ av_register_all(); // Open video file - if (av_open_input_file(&pFormatCtx, - item->getLocation().c_str(), NULL, 0, NULL) != 0) + if (avformat_open_input(&pFormatCtx, + item->getLocation().c_str(), NULL, NULL) != 0) return; // Couldn't open file // Retrieve stream information @@ -277,6 +305,7 @@ // Close the video file av_close_input_file(pFormatCtx); + avformat_free_context(pFormatCtx); } Ref<IOHandler> FfmpegHandler::serveContent(Ref<CdsItem> item, int resNum, off_t *data_size)
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 6647
:
2771
|
2772
|
2793
| 2798