aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat/img2.c
diff options
context:
space:
mode:
authorPeter Ross <pross@xvid.org>2011-03-30 18:03:40 +1100
committerMichael Niedermayer <michaelni@gmx.at>2011-03-31 23:26:18 +0200
commit0bb240acb39428fb418835e5d43534bb2959e20d (patch)
treedd5d49d8c7878cff58491880b28c26bad79fb305 /libavformat/img2.c
parent1e96d4c71e68fdefc284d7dfb9701d1378a024c8 (diff)
downloadffmpeg-0bb240acb39428fb418835e5d43534bb2959e20d.tar.gz
img2: stop using CODEC_ID_RAWVIDEO to trigger processing of independant y/u/v image files
This is requireed, as img2 will be modified soon to support .raw image file sequences. Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat/img2.c')
-rw-r--r--libavformat/img2.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/libavformat/img2.c b/libavformat/img2.c
index f9c71b97f2..ed90d5067b 100644
--- a/libavformat/img2.c
+++ b/libavformat/img2.c
@@ -32,6 +32,7 @@ typedef struct {
int img_number;
int img_count;
int is_pipe;
+ int split_planes; /**< use independent file for each Y, U, V plane */
char path[1024];
} VideoData;
@@ -241,6 +242,8 @@ static int read_header(AVFormatContext *s1, AVFormatParameters *ap)
st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
st->codec->codec_id = s1->audio_codec_id;
}else{
+ const char *str= strrchr(s->path, '.');
+ s->split_planes = str && !strcasecmp(str + 1, "y");
st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
st->codec->codec_id = av_str2id(img_tags, s->path);
}
@@ -278,7 +281,7 @@ static int read_packet(AVFormatContext *s1, AVPacket *pkt)
}
size[i]= avio_size(f[i]);
- if(codec->codec_id != CODEC_ID_RAWVIDEO)
+ if(!s->split_planes)
break;
filename[ strlen(filename) - 1 ]= 'U' + i;
}
@@ -324,6 +327,7 @@ static int read_packet(AVFormatContext *s1, AVPacket *pkt)
static int write_header(AVFormatContext *s)
{
VideoData *img = s->priv_data;
+ const char *str;
img->img_number = 1;
av_strlcpy(img->path, s->filename, sizeof(img->path));
@@ -334,6 +338,8 @@ static int write_header(AVFormatContext *s)
else
img->is_pipe = 1;
+ str = strrchr(img->path, '.');
+ img->split_planes = str && !strcasecmp(str + 1, "y");
return 0;
}
@@ -359,7 +365,7 @@ static int write_packet(AVFormatContext *s, AVPacket *pkt)
return AVERROR(EIO);
}
- if(codec->codec_id != CODEC_ID_RAWVIDEO)
+ if(!img->split_planes)
break;
filename[ strlen(filename) - 1 ]= 'U' + i;
}
@@ -367,7 +373,7 @@ static int write_packet(AVFormatContext *s, AVPacket *pkt)
pb[0] = s->pb;
}
- if(codec->codec_id == CODEC_ID_RAWVIDEO){
+ if(img->split_planes){
int ysize = codec->width * codec->height;
avio_write(pb[0], pkt->data , ysize);
avio_write(pb[1], pkt->data + ysize, (pkt->size - ysize)/2);