Commit e88f3927 authored by Michael Niedermayer's avatar Michael Niedermayer

Merge commit '81726a4f'

* commit '81726a4f':
  FATE: add tests for additional flavors of asf cover art
  asfdec: do not assume every AVStream has a corresponding ASFStream
Merged-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parents 9a714d87 81726a4f
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
//#define DEBUG //#define DEBUG
#include "libavutil/attributes.h" #include "libavutil/attributes.h"
#include "libavutil/avassert.h"
#include "libavutil/avstring.h" #include "libavutil/avstring.h"
#include "libavutil/bswap.h" #include "libavutil/bswap.h"
#include "libavutil/common.h" #include "libavutil/common.h"
...@@ -183,7 +184,6 @@ static int asf_read_picture(AVFormatContext *s, int len) ...@@ -183,7 +184,6 @@ static int asf_read_picture(AVFormatContext *s, int len)
enum AVCodecID id = AV_CODEC_ID_NONE; enum AVCodecID id = AV_CODEC_ID_NONE;
char mimetype[64]; char mimetype[64];
uint8_t *desc = NULL; uint8_t *desc = NULL;
ASFStream *ast = NULL;
AVStream *st = NULL; AVStream *st = NULL;
int ret, type, picsize, desc_len; int ret, type, picsize, desc_len;
...@@ -238,12 +238,10 @@ static int asf_read_picture(AVFormatContext *s, int len) ...@@ -238,12 +238,10 @@ static int asf_read_picture(AVFormatContext *s, int len)
goto fail; goto fail;
st = avformat_new_stream(s, NULL); st = avformat_new_stream(s, NULL);
ast = av_mallocz(sizeof(*ast)); if (!st) {
if (!st || !ast) {
ret = AVERROR(ENOMEM); ret = AVERROR(ENOMEM);
goto fail; goto fail;
} }
st->priv_data = ast;
st->disposition |= AV_DISPOSITION_ATTACHED_PIC; st->disposition |= AV_DISPOSITION_ATTACHED_PIC;
st->codec->codec_type = AVMEDIA_TYPE_VIDEO; st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
st->codec->codec_id = id; st->codec->codec_id = id;
...@@ -261,7 +259,6 @@ static int asf_read_picture(AVFormatContext *s, int len) ...@@ -261,7 +259,6 @@ static int asf_read_picture(AVFormatContext *s, int len)
return 0; return 0;
fail: fail:
av_freep(&ast);
av_freep(&desc); av_freep(&desc);
av_free_packet(&pkt); av_free_packet(&pkt);
return ret; return ret;
...@@ -1155,6 +1152,7 @@ static int ff_asf_parse_packet(AVFormatContext *s, AVIOContext *pb, AVPacket *pk ...@@ -1155,6 +1152,7 @@ static int ff_asf_parse_packet(AVFormatContext *s, AVIOContext *pb, AVPacket *pk
asf->asf_st = s->streams[asf->stream_index]->priv_data; asf->asf_st = s->streams[asf->stream_index]->priv_data;
} }
asf_st = asf->asf_st; asf_st = asf->asf_st;
av_assert0(asf_st);
if (asf->packet_replic_size == 1) { if (asf->packet_replic_size == 1) {
// frag_offset is here used as the beginning timestamp // frag_offset is here used as the beginning timestamp
...@@ -1364,6 +1362,8 @@ static void asf_reset_header(AVFormatContext *s) ...@@ -1364,6 +1362,8 @@ static void asf_reset_header(AVFormatContext *s)
for (i = 0; i < s->nb_streams; i++) { for (i = 0; i < s->nb_streams; i++) {
asf_st = s->streams[i]->priv_data; asf_st = s->streams[i]->priv_data;
if (!asf_st)
continue;
av_free_packet(&asf_st->pkt); av_free_packet(&asf_st->pkt);
asf_st->frag_offset = 0; asf_st->frag_offset = 0;
asf_st->seq = 0; asf_st->seq = 0;
...@@ -1413,6 +1413,7 @@ static int64_t asf_read_pts(AVFormatContext *s, int stream_index, ...@@ -1413,6 +1413,7 @@ static int64_t asf_read_pts(AVFormatContext *s, int stream_index,
i = pkt->stream_index; i = pkt->stream_index;
asf_st = s->streams[i]->priv_data; asf_st = s->streams[i]->priv_data;
av_assert0(asf_st);
// assert((asf_st->packet_pos - s->data_offset) % s->packet_size == 0); // assert((asf_st->packet_pos - s->data_offset) % s->packet_size == 0);
pos = asf_st->packet_pos; pos = asf_st->packet_pos;
......
...@@ -14,6 +14,14 @@ FATE_COVER_ART += fate-cover-art-wma ...@@ -14,6 +14,14 @@ FATE_COVER_ART += fate-cover-art-wma
fate-cover-art-wma: CMD = md5 -i $(SAMPLES)/cover_art/Californication_cover.wma -an -c:v copy -f rawvideo fate-cover-art-wma: CMD = md5 -i $(SAMPLES)/cover_art/Californication_cover.wma -an -c:v copy -f rawvideo
fate-cover-art-wma: REF = 0808bd0e1b61542a16e1906812dd924b fate-cover-art-wma: REF = 0808bd0e1b61542a16e1906812dd924b
FATE_COVER_ART += fate-cover-art-wma-id3
fate-cover-art-wma-id3: CMD = md5 -i $(SAMPLES)/cover_art/wma_with_ID3_APIC_trimmed.wma -an -c:v copy -f rawvideo
fate-cover-art-wma-id3: REF = e6a8dd03687d5178bc13fc7d3316696e
FATE_COVER_ART += fate-cover-art-wma-metadatalib
fate-cover-art-wma-metadatalib: CMD = md5 -i $(SAMPLES)/cover_art/wma_with_metadata_library_object_tag_trimmed.wma -map 0:v -c:v copy -f rawvideo
fate-cover-art-wma-metadatalib: REF = 32e8bd4fad546f63d881a0256f083aea
FATE_COVER_ART += fate-cover-art-wv FATE_COVER_ART += fate-cover-art-wv
fate-cover-art-wv: CMD = md5 -i $(SAMPLES)/cover_art/luckynight_cover.wv -an -c:v copy -f rawvideo fate-cover-art-wv: CMD = md5 -i $(SAMPLES)/cover_art/luckynight_cover.wv -an -c:v copy -f rawvideo
fate-cover-art-wv: REF = 45333c983c45af54449dff10af144317 fate-cover-art-wv: REF = 45333c983c45af54449dff10af144317
......
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