Mercurial > libavformat.hg
changeset 498:7c8687cb7f27 libavformat
support single images, remove copy/paste junk
author | michael |
---|---|
date | Thu, 15 Jul 2004 20:15:40 +0000 |
parents | d95e74ef39e0 |
children | 3e85b3d73cda |
files | img2.c |
diffstat | 1 files changed, 9 insertions(+), 22 deletions(-) [+] |
line wrap: on
line diff
--- a/img2.c Thu Jul 15 18:32:54 2004 +0000 +++ b/img2.c Thu Jul 15 20:15:40 2004 +0000 @@ -80,8 +80,11 @@ /* find the first image */ for(first_index = 0; first_index < 5; first_index++) { - if (get_frame_filename(buf, sizeof(buf), path, first_index) < 0) - goto fail; + if (get_frame_filename(buf, sizeof(buf), path, first_index) < 0){ + *pfirst_index = + *plast_index = 1; + return 0; + } if (url_exist(buf)) break; } @@ -132,8 +135,6 @@ { VideoData *s = s1->priv_data; int first_index, last_index; - char buf[1024]; - ByteIOContext pb1, *f = &pb1; AVStream *st; s1->ctx_flags |= AVFMTCTX_NOHEADER; @@ -173,18 +174,6 @@ st->duration = ((int64_t)AV_TIME_BASE * (last_index - first_index + 1) * st->codec.frame_rate_base) / st->codec.frame_rate; - if (get_frame_filename(buf, sizeof(buf), s->path, s->img_number) < 0) - goto fail; - if (url_fopen(f, buf, URL_RDONLY) < 0) - goto fail; - } else { - f = &s1->pb; - } - - if (!s->is_pipe) { - url_fclose(f); - } else { - url_fseek(f, 0, SEEK_SET); } st->codec.codec_type = CODEC_TYPE_VIDEO; @@ -192,8 +181,6 @@ return 0; - if (!s->is_pipe) - url_fclose(f); fail: av_free(s); return AVERROR_IO; @@ -212,7 +199,7 @@ s->img_number = s->img_first; }*/ if (get_frame_filename(filename, sizeof(filename), - s->path, s->img_number) < 0) + s->path, s->img_number)<0 && s->img_number > 1) return AVERROR_IO; f = &f1; if (url_fopen(f, filename, URL_RDONLY) < 0) @@ -278,7 +265,7 @@ if (!img->is_pipe) { if (get_frame_filename(filename, sizeof(filename), - img->path, img->img_number) < 0) + img->path, img->img_number) < 0 && img->img_number>1) return AVERROR_IO; pb = &pb1; if (url_fopen(pb, filename, URL_WRONLY) < 0) @@ -314,7 +301,7 @@ img_read_close, NULL, NULL, - AVFMT_NOFILE | AVFMT_NEEDNUMBER, + AVFMT_NOFILE, }; static AVInputFormat image2pipe_iformat = { @@ -342,7 +329,7 @@ img_write_header, img_write_packet, img_write_trailer, - AVFMT_NOFILE | AVFMT_NEEDNUMBER, + AVFMT_NOFILE, }; static AVOutputFormat image2pipe_oformat = {