* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "avformat.h"
+#include "avstring.h"
typedef struct {
int img_first;
{ CODEC_ID_GIF , "gif"},
{ CODEC_ID_TARGA , "tga"},
{ CODEC_ID_TIFF , "tiff"},
+ { CODEC_ID_SGI , "sgi"},
+ { CODEC_ID_PTX , "ptx"},
{0, NULL}
};
static int image_probe(AVProbeData *p)
{
- if (av_str2id(img_tags, p->filename)) {
+ if (p->filename && av_str2id(img_tags, p->filename)) {
if (av_filename_number_test(p->filename))
return AVPROBE_SCORE_MAX;
else
st = av_new_stream(s1, 0);
if (!st) {
- return -ENOMEM;
+ return AVERROR(ENOMEM);
}
- pstrcpy(s->path, sizeof(s->path), s1->filename);
+ av_strlcpy(s->path, s1->filename, sizeof(s->path));
s->img_number = 0;
s->img_count = 0;
s->is_pipe = 0;
else{
s->is_pipe = 1;
- st->need_parsing= 1;
+ st->need_parsing = AVSTREAM_PARSE_FULL;
}
if (!ap->time_base.num) {
if (!s->is_pipe) {
if (find_image_range(&first_index, &last_index, s->path) < 0)
- return AVERROR_IO;
+ return AVERROR(EIO);
s->img_first = first_index;
s->img_last = last_index;
s->img_number = first_index;
}
if (av_get_frame_filename(filename, sizeof(filename),
s->path, s->img_number)<0 && s->img_number > 1)
- return AVERROR_IO;
+ return AVERROR(EIO);
for(i=0; i<3; i++){
if (url_fopen(f[i], filename, URL_RDONLY) < 0)
- return AVERROR_IO;
+ return AVERROR(EIO);
size[i]= url_fsize(f[i]);
if(codec->codec_id != CODEC_ID_RAWVIDEO)
} else {
f[0] = &s1->pb;
if (url_feof(f[0]))
- return AVERROR_IO;
+ return AVERROR(EIO);
size[0]= 4096;
}
if (ret[0] <= 0 || ret[1]<0 || ret[2]<0) {
av_free_packet(pkt);
- return AVERROR_IO; /* signal EOF */
+ return AVERROR(EIO); /* signal EOF */
} else {
s->img_count++;
s->img_number++;
VideoData *img = s->priv_data;
img->img_number = 1;
- pstrcpy(img->path, sizeof(img->path), s->filename);
+ av_strlcpy(img->path, s->filename, sizeof(img->path));
/* find format */
if (s->oformat->flags & AVFMT_NOFILE)
if (!img->is_pipe) {
if (av_get_frame_filename(filename, sizeof(filename),
img->path, img->img_number) < 0 && img->img_number>1)
- return AVERROR_IO;
+ return AVERROR(EIO);
for(i=0; i<3; i++){
if (url_fopen(pb[i], filename, URL_WRONLY) < 0)
- return AVERROR_IO;
+ return AVERROR(EIO);
if(codec->codec_id != CODEC_ID_RAWVIDEO)
break;