comparison mov.c @ 4561:86bbca6f1738 libavformat

check av_get_packet return value
author bcoudurier
date Sun, 22 Feb 2009 01:07:46 +0000
parents 284c22e8f739
children f1a4622fc4e1
comparison
equal deleted inserted replaced
4560:284c22e8f739 4561:86bbca6f1738
1940 { 1940 {
1941 MOVContext *mov = s->priv_data; 1941 MOVContext *mov = s->priv_data;
1942 MOVStreamContext *sc = 0; 1942 MOVStreamContext *sc = 0;
1943 AVIndexEntry *sample = 0; 1943 AVIndexEntry *sample = 0;
1944 int64_t best_dts = INT64_MAX; 1944 int64_t best_dts = INT64_MAX;
1945 int i; 1945 int i, ret;
1946 retry: 1946 retry:
1947 for (i = 0; i < s->nb_streams; i++) { 1947 for (i = 0; i < s->nb_streams; i++) {
1948 AVStream *st = s->streams[i]; 1948 AVStream *st = s->streams[i];
1949 MOVStreamContext *msc = st->priv_data; 1949 MOVStreamContext *msc = st->priv_data;
1950 if (st->discard != AVDISCARD_ALL && msc->pb && msc->current_sample < msc->sample_count) { 1950 if (st->discard != AVDISCARD_ALL && msc->pb && msc->current_sample < msc->sample_count) {
1977 if (url_fseek(sc->pb, sample->pos, SEEK_SET) != sample->pos) { 1977 if (url_fseek(sc->pb, sample->pos, SEEK_SET) != sample->pos) {
1978 av_log(mov->fc, AV_LOG_ERROR, "stream %d, offset 0x%"PRIx64": partial file\n", 1978 av_log(mov->fc, AV_LOG_ERROR, "stream %d, offset 0x%"PRIx64": partial file\n",
1979 sc->ffindex, sample->pos); 1979 sc->ffindex, sample->pos);
1980 return -1; 1980 return -1;
1981 } 1981 }
1982 av_get_packet(sc->pb, pkt, sample->size); 1982 ret = av_get_packet(sc->pb, pkt, sample->size);
1983 if (ret < 0)
1984 return ret;
1983 #if CONFIG_DV_DEMUXER 1985 #if CONFIG_DV_DEMUXER
1984 if (mov->dv_demux && sc->dv_audio_container) { 1986 if (mov->dv_demux && sc->dv_audio_container) {
1985 dv_produce_packet(mov->dv_demux, pkt, pkt->data, pkt->size); 1987 dv_produce_packet(mov->dv_demux, pkt, pkt->data, pkt->size);
1986 av_free(pkt->data); 1988 av_free(pkt->data);
1987 pkt->size = 0; 1989 pkt->size = 0;