X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libavformat%2Fnsvdec.c;h=e15d6e283a3ed5a7b025e0b3e4fc9f7c27857044;hb=b351baa070beede5d110974544782ac80e21bc90;hp=61a21ae178e7fcdc628bb85f7e0e8807e0187b84;hpb=1a40491ef212869077278b46f74ee92a66809d20;p=ffmpeg diff --git a/libavformat/nsvdec.c b/libavformat/nsvdec.c index 61a21ae178e..e15d6e283a3 100644 --- a/libavformat/nsvdec.c +++ b/libavformat/nsvdec.c @@ -201,7 +201,7 @@ static const AVCodecTag nsv_codec_video_tags[] = { */ { CODEC_ID_MPEG4, MKTAG('X', 'V', 'I', 'D') }, /* cf sample xvid decoder from nsv_codec_sdk.zip */ { CODEC_ID_RAWVIDEO, MKTAG('R', 'G', 'B', '3') }, - { 0, 0 }, + { CODEC_ID_NONE, 0 }, }; static const AVCodecTag nsv_codec_audio_tags[] = { @@ -210,7 +210,7 @@ static const AVCodecTag nsv_codec_audio_tags[] = { { CODEC_ID_AAC, MKTAG('A', 'A', 'C', 'P') }, { CODEC_ID_SPEEX, MKTAG('S', 'P', 'X', ' ') }, { CODEC_ID_PCM_U16LE, MKTAG('P', 'C', 'M', ' ') }, - { 0, 0 }, + { CODEC_ID_NONE, 0 }, }; //static int nsv_load_index(AVFormatContext *s); @@ -339,7 +339,7 @@ static int nsv_parse_NSVf_header(AVFormatContext *s, AVFormatParameters *ap) break; *p++ = '\0'; PRINT(("NSV NSVf INFO: %s='%s'\n", token, value)); - av_metadata_set(&s->metadata, token, value); + av_metadata_set2(&s->metadata, token, value, 0); } av_free(strings); } @@ -456,7 +456,7 @@ static int nsv_parse_NSVs_header(AVFormatContext *s, AVFormatParameters *ap) if (!nst) goto fail; st->priv_data = nst; - st->codec->codec_type = CODEC_TYPE_VIDEO; + st->codec->codec_type = AVMEDIA_TYPE_VIDEO; st->codec->codec_tag = vtag; st->codec->codec_id = ff_codec_get_id(nsv_codec_video_tags, vtag); st->codec->width = vwidth; @@ -487,7 +487,7 @@ static int nsv_parse_NSVs_header(AVFormatContext *s, AVFormatParameters *ap) if (!nst) goto fail; st->priv_data = nst; - st->codec->codec_type = CODEC_TYPE_AUDIO; + st->codec->codec_type = AVMEDIA_TYPE_AUDIO; st->codec->codec_tag = atag; st->codec->codec_id = ff_codec_get_id(nsv_codec_audio_tags, atag); @@ -620,7 +620,7 @@ null_chunk_retry: av_get_packet(pb, pkt, vsize); pkt->stream_index = st[NSV_ST_VIDEO]->index;//NSV_ST_VIDEO; pkt->dts = nst->frame_offset; - pkt->flags |= nsv->state == NSV_HAS_READ_NSVS ? PKT_FLAG_KEY : 0; /* keyframe only likely on a sync frame */ + pkt->flags |= nsv->state == NSV_HAS_READ_NSVS ? AV_PKT_FLAG_KEY : 0; /* keyframe only likely on a sync frame */ /* for (i = 0; i < MIN(8, vsize); i++) PRINT(("NSV video: [%d] = %02x\n", i, pkt->data[i])); @@ -660,7 +660,7 @@ null_chunk_retry: } av_get_packet(pb, pkt, asize); pkt->stream_index = st[NSV_ST_AUDIO]->index;//NSV_ST_AUDIO; - pkt->flags |= nsv->state == NSV_HAS_READ_NSVS ? PKT_FLAG_KEY : 0; /* keyframe only likely on a sync frame */ + pkt->flags |= nsv->state == NSV_HAS_READ_NSVS ? AV_PKT_FLAG_KEY : 0; /* keyframe only likely on a sync frame */ if( nsv->state == NSV_HAS_READ_NSVS && st[NSV_ST_VIDEO] ) { /* on a nsvs frame we have new information on a/v sync */ pkt->dts = (((NSVStream*)st[NSV_ST_VIDEO]->priv_data)->frame_offset-1); @@ -728,6 +728,10 @@ static int nsv_read_close(AVFormatContext *s) av_freep(&nsv->nsvs_file_offset); av_freep(&nsv->nsvs_timestamps); + if (nsv->ahead[0].data) + av_free_packet(&nsv->ahead[0]); + if (nsv->ahead[1].data) + av_free_packet(&nsv->ahead[1]); #if 0 @@ -764,13 +768,13 @@ static int nsv_probe(AVProbeData *p) return AVPROBE_SCORE_MAX-20; } /* so we'll have more luck on extension... */ - if (match_ext(p->filename, "nsv")) + if (av_match_ext(p->filename, "nsv")) return AVPROBE_SCORE_MAX/2; /* FIXME: add mime-type check */ return 0; } -AVInputFormat nsv_demuxer = { +AVInputFormat ff_nsv_demuxer = { "nsv", NULL_IF_CONFIG_SMALL("Nullsoft Streaming Video"), sizeof(NSVContext),