Commit 00798e45 authored by Aurelien Jacobs's avatar Aurelien Jacobs

use new metadata API in nut demuxer

Originally committed as revision 17652 to svn://svn.ffmpeg.org/ffmpeg/trunk
parent c2751600
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/ */
#include <strings.h>
#include "libavutil/avstring.h" #include "libavutil/avstring.h"
#include "libavutil/bswap.h" #include "libavutil/bswap.h"
#include "libavutil/tree.h" #include "libavutil/tree.h"
...@@ -395,6 +396,7 @@ static int decode_info_header(NUTContext *nut){ ...@@ -395,6 +396,7 @@ static int decode_info_header(NUTContext *nut){
char name[256], str_value[1024], type_str[256]; char name[256], str_value[1024], type_str[256];
const char *type; const char *type;
AVChapter *chapter= NULL; AVChapter *chapter= NULL;
AVStream *st= NULL;
end= get_packetheader(nut, bc, 1, INFO_STARTCODE); end= get_packetheader(nut, bc, 1, INFO_STARTCODE);
end += url_ftell(bc); end += url_ftell(bc);
...@@ -410,7 +412,8 @@ static int decode_info_header(NUTContext *nut){ ...@@ -410,7 +412,8 @@ static int decode_info_header(NUTContext *nut){
chapter= ff_new_chapter(s, chapter_id, chapter= ff_new_chapter(s, chapter_id,
nut->time_base[chapter_start % nut->time_base_count], nut->time_base[chapter_start % nut->time_base_count],
start, start + chapter_len, NULL); start, start + chapter_len, NULL);
} } else if(stream_id_plus1)
st= s->streams[stream_id_plus1 - 1];
for(i=0; i<count; i++){ for(i=0; i<count; i++){
get_str(bc, name, sizeof(name)); get_str(bc, name, sizeof(name));
...@@ -440,21 +443,16 @@ static int decode_info_header(NUTContext *nut){ ...@@ -440,21 +443,16 @@ static int decode_info_header(NUTContext *nut){
continue; continue;
} }
if(chapter_id==0 && !strcmp(type, "UTF-8")){ if(!strcmp(type, "UTF-8")){
if (!strcmp(name, "Author")) AVMetadata **metadata = NULL;
av_strlcpy(s->author , str_value, sizeof(s->author)); if(chapter_id==0 && !strcmp(name, "Disposition"))
else if(!strcmp(name, "Title"))
av_strlcpy(s->title , str_value, sizeof(s->title));
else if(!strcmp(name, "Copyright"))
av_strlcpy(s->copyright, str_value, sizeof(s->copyright));
else if(!strcmp(name, "Description"))
av_strlcpy(s->comment , str_value, sizeof(s->comment));
else if(!strcmp(name, "Disposition"))
set_disposition_bits(s, str_value, stream_id_plus1 - 1); set_disposition_bits(s, str_value, stream_id_plus1 - 1);
} else if(chapter) metadata= &chapter->metadata;
if(chapter && !strcmp(type, "UTF-8")){ else if(stream_id_plus1) metadata= &st->metadata;
if(!strcmp(name, "Title")) else metadata= &s->metadata;
chapter->title= av_strdup(str_value); if(metadata && strcasecmp(name,"Uses")
&& strcasecmp(name,"Depends") && strcasecmp(name,"Replaces"))
av_metadata_set(metadata, name, str_value);
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment