Commit db29a7c7 authored by Michael Niedermayer's avatar Michael Niedermayer

Merge commit '9d46eaec'

* commit '9d46eaec':
  build: The FLAC encoder also depends on the flacdsp code
  img2: K&R formatting cosmetics
  h264: check context state before decoding slice data partitions
  flashsv: make sure data for zlib priming is available

Conflicts:
	libavcodec/Makefile
	libavformat/img2.c
	libavformat/img2dec.c
	libavformat/img2enc.c
Merged-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parents 8119d8b0 9d46eaec
...@@ -193,7 +193,7 @@ OBJS-$(CONFIG_FFVHUFF_DECODER) += huffyuv.o ...@@ -193,7 +193,7 @@ OBJS-$(CONFIG_FFVHUFF_DECODER) += huffyuv.o
OBJS-$(CONFIG_FFVHUFF_ENCODER) += huffyuv.o OBJS-$(CONFIG_FFVHUFF_ENCODER) += huffyuv.o
OBJS-$(CONFIG_FFWAVESYNTH_DECODER) += ffwavesynth.o OBJS-$(CONFIG_FFWAVESYNTH_DECODER) += ffwavesynth.o
OBJS-$(CONFIG_FLAC_DECODER) += flacdec.o flacdata.o flac.o flacdsp.o OBJS-$(CONFIG_FLAC_DECODER) += flacdec.o flacdata.o flac.o flacdsp.o
OBJS-$(CONFIG_FLAC_ENCODER) += flacenc.o flacdata.o flac.o vorbis_data.o OBJS-$(CONFIG_FLAC_ENCODER) += flacenc.o flacdata.o flac.o flacdsp.o vorbis_data.o
OBJS-$(CONFIG_FLASHSV_DECODER) += flashsv.o OBJS-$(CONFIG_FLASHSV_DECODER) += flashsv.o
OBJS-$(CONFIG_FLASHSV_ENCODER) += flashsvenc.o OBJS-$(CONFIG_FLASHSV_ENCODER) += flashsvenc.o
OBJS-$(CONFIG_FLASHSV2_ENCODER) += flashsv2enc.o OBJS-$(CONFIG_FLASHSV2_ENCODER) += flashsv2enc.o
......
...@@ -403,6 +403,11 @@ static int flashsv_decode_frame(AVCodecContext *avctx, void *data, ...@@ -403,6 +403,11 @@ static int flashsv_decode_frame(AVCodecContext *avctx, void *data,
av_log_missing_feature(avctx, "zlibprime_curr", 1); av_log_missing_feature(avctx, "zlibprime_curr", 1);
return AVERROR_PATCHWELCOME; return AVERROR_PATCHWELCOME;
} }
if (!s->blocks && (s->zlibprime_curr || s->zlibprime_prev)) {
av_log(avctx, AV_LOG_ERROR, "no data available for zlib "
"priming\n");
return AVERROR_INVALIDDATA;
}
size--; // account for flags byte size--; // account for flags byte
} }
......
...@@ -3989,6 +3989,7 @@ again: ...@@ -3989,6 +3989,7 @@ again:
if (hx->redundant_pic_count == 0 && if (hx->redundant_pic_count == 0 &&
hx->intra_gb_ptr && hx->intra_gb_ptr &&
hx->s.data_partitioning && hx->s.data_partitioning &&
s->current_picture_ptr &&
s->context_initialized && s->context_initialized &&
(avctx->skip_frame < AVDISCARD_NONREF || hx->nal_ref_idc) && (avctx->skip_frame < AVDISCARD_NONREF || hx->nal_ref_idc) &&
(avctx->skip_frame < AVDISCARD_BIDIR || (avctx->skip_frame < AVDISCARD_BIDIR ||
......
...@@ -29,61 +29,62 @@ typedef struct { ...@@ -29,61 +29,62 @@ typedef struct {
} IdStrMap; } IdStrMap;
static const IdStrMap img_tags[] = { static const IdStrMap img_tags[] = {
{ AV_CODEC_ID_MJPEG , "jpeg"}, { AV_CODEC_ID_MJPEG, "jpeg" },
{ AV_CODEC_ID_MJPEG , "jpg"}, { AV_CODEC_ID_MJPEG, "jpg" },
{ AV_CODEC_ID_MJPEG , "jps"}, { AV_CODEC_ID_MJPEG, "jps" },
{ AV_CODEC_ID_LJPEG , "ljpg"}, { AV_CODEC_ID_LJPEG, "ljpg" },
{ AV_CODEC_ID_JPEGLS , "jls"}, { AV_CODEC_ID_JPEGLS, "jls" },
{ AV_CODEC_ID_PNG , "png"}, { AV_CODEC_ID_PNG, "png" },
{ AV_CODEC_ID_PNG , "pns"}, { AV_CODEC_ID_PNG, "pns" },
{ AV_CODEC_ID_PNG , "mng"}, { AV_CODEC_ID_PNG, "mng" },
{ AV_CODEC_ID_PPM , "ppm"}, { AV_CODEC_ID_PPM, "ppm" },
{ AV_CODEC_ID_PPM , "pnm"}, { AV_CODEC_ID_PPM, "pnm" },
{ AV_CODEC_ID_PGM , "pgm"}, { AV_CODEC_ID_PGM, "pgm" },
{ AV_CODEC_ID_PGMYUV , "pgmyuv"}, { AV_CODEC_ID_PGMYUV, "pgmyuv" },
{ AV_CODEC_ID_PBM , "pbm"}, { AV_CODEC_ID_PBM, "pbm" },
{ AV_CODEC_ID_PAM , "pam"}, { AV_CODEC_ID_PAM, "pam" },
{ AV_CODEC_ID_MPEG1VIDEO, "mpg1-img"}, { AV_CODEC_ID_MPEG1VIDEO, "mpg1-img" },
{ AV_CODEC_ID_MPEG2VIDEO, "mpg2-img"}, { AV_CODEC_ID_MPEG2VIDEO, "mpg2-img" },
{ AV_CODEC_ID_MPEG4 , "mpg4-img"}, { AV_CODEC_ID_MPEG4, "mpg4-img" },
{ AV_CODEC_ID_FFV1 , "ffv1-img"}, { AV_CODEC_ID_FFV1, "ffv1-img" },
{ AV_CODEC_ID_RAWVIDEO , "y"}, { AV_CODEC_ID_RAWVIDEO, "y" },
{ AV_CODEC_ID_RAWVIDEO , "raw"}, { AV_CODEC_ID_RAWVIDEO, "raw" },
{ AV_CODEC_ID_BMP , "bmp"}, { AV_CODEC_ID_BMP, "bmp" },
{ AV_CODEC_ID_GIF , "gif"}, { AV_CODEC_ID_GIF, "gif" },
{ AV_CODEC_ID_TARGA , "tga"}, { AV_CODEC_ID_TARGA, "tga" },
{ AV_CODEC_ID_TIFF , "tiff"}, { AV_CODEC_ID_TIFF, "tiff" },
{ AV_CODEC_ID_TIFF , "tif"}, { AV_CODEC_ID_TIFF, "tif" },
{ AV_CODEC_ID_SGI , "sgi"}, { AV_CODEC_ID_SGI, "sgi" },
{ AV_CODEC_ID_PTX , "ptx"}, { AV_CODEC_ID_PTX, "ptx" },
{ AV_CODEC_ID_PCX , "pcx"}, { AV_CODEC_ID_PCX, "pcx" },
{ AV_CODEC_ID_BRENDER_PIX, "pix"}, { AV_CODEC_ID_BRENDER_PIX, "pix" },
{ AV_CODEC_ID_SUNRAST , "sun"}, { AV_CODEC_ID_SUNRAST, "sun" },
{ AV_CODEC_ID_SUNRAST , "ras"}, { AV_CODEC_ID_SUNRAST, "ras" },
{ AV_CODEC_ID_SUNRAST , "rs"}, { AV_CODEC_ID_SUNRAST, "rs" },
{ AV_CODEC_ID_SUNRAST , "im1"}, { AV_CODEC_ID_SUNRAST, "im1" },
{ AV_CODEC_ID_SUNRAST , "im8"}, { AV_CODEC_ID_SUNRAST, "im8" },
{ AV_CODEC_ID_SUNRAST , "im24"}, { AV_CODEC_ID_SUNRAST, "im24" },
{ AV_CODEC_ID_SUNRAST , "im32"}, { AV_CODEC_ID_SUNRAST, "im32" },
{ AV_CODEC_ID_SUNRAST , "sunras"}, { AV_CODEC_ID_SUNRAST, "sunras" },
{ AV_CODEC_ID_JPEG2000 , "j2c"}, { AV_CODEC_ID_JPEG2000, "j2c" },
{ AV_CODEC_ID_JPEG2000 , "j2k"}, { AV_CODEC_ID_JPEG2000, "j2k" },
{ AV_CODEC_ID_JPEG2000 , "jp2"}, { AV_CODEC_ID_JPEG2000, "jp2" },
{ AV_CODEC_ID_JPEG2000 , "jpc"}, { AV_CODEC_ID_JPEG2000, "jpc" },
{ AV_CODEC_ID_DPX , "dpx"}, { AV_CODEC_ID_DPX, "dpx" },
{ AV_CODEC_ID_EXR , "exr"}, { AV_CODEC_ID_EXR, "exr" },
{ AV_CODEC_ID_PICTOR , "pic"}, { AV_CODEC_ID_PICTOR, "pic" },
{ AV_CODEC_ID_V210X , "yuv10"}, { AV_CODEC_ID_V210X, "yuv10" },
{ AV_CODEC_ID_XBM , "xbm"}, { AV_CODEC_ID_XBM, "xbm" },
{ AV_CODEC_ID_XFACE , "xface"}, { AV_CODEC_ID_XFACE, "xface" },
{ AV_CODEC_ID_XWD , "xwd"}, { AV_CODEC_ID_XWD, "xwd" },
{ AV_CODEC_ID_NONE , NULL} { AV_CODEC_ID_NONE, NULL }
}; };
static enum AVCodecID av_str2id(const IdStrMap *tags, const char *str) static enum AVCodecID av_str2id(const IdStrMap *tags, const char *str)
{ {
str= strrchr(str, '.'); str = strrchr(str, '.');
if(!str) return AV_CODEC_ID_NONE; if (!str)
return AV_CODEC_ID_NONE;
str++; str++;
while (tags->id) { while (tags->id) {
......
This diff is collapsed.
...@@ -70,41 +70,41 @@ static int write_packet(AVFormatContext *s, AVPacket *pkt) ...@@ -70,41 +70,41 @@ static int write_packet(AVFormatContext *s, AVPacket *pkt)
VideoMuxData *img = s->priv_data; VideoMuxData *img = s->priv_data;
AVIOContext *pb[4]; AVIOContext *pb[4];
char filename[1024]; char filename[1024];
AVCodecContext *codec= s->streams[ pkt->stream_index ]->codec; AVCodecContext *codec = s->streams[pkt->stream_index]->codec;
const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(codec->pix_fmt); const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(codec->pix_fmt);
int i; int i;
if (!img->is_pipe) { if (!img->is_pipe) {
if (av_get_frame_filename(filename, sizeof(filename), if (av_get_frame_filename(filename, sizeof(filename),
img->path, img->img_number) < 0 && img->img_number>1 && !img->updatefirst) { img->path, img->img_number) < 0 && img->img_number > 1 && !img->updatefirst) {
av_log(s, AV_LOG_ERROR, av_log(s, AV_LOG_ERROR,
"Could not get frame filename number %d from pattern '%s'\n", "Could not get frame filename number %d from pattern '%s'\n",
img->img_number, img->path); img->img_number, img->path);
return AVERROR(EINVAL); return AVERROR(EINVAL);
} }
for(i=0; i<4; i++){ for (i = 0; i < 4; i++) {
if (avio_open2(&pb[i], filename, AVIO_FLAG_WRITE, if (avio_open2(&pb[i], filename, AVIO_FLAG_WRITE,
&s->interrupt_callback, NULL) < 0) { &s->interrupt_callback, NULL) < 0) {
av_log(s, AV_LOG_ERROR, "Could not open file : %s\n",filename); av_log(s, AV_LOG_ERROR, "Could not open file : %s\n", filename);
return AVERROR(EIO); return AVERROR(EIO);
} }
if(!img->split_planes || i+1 >= desc->nb_components) if (!img->split_planes || i+1 >= desc->nb_components)
break; break;
filename[ strlen(filename) - 1 ]= ((int[]){'U','V','A','x'})[i]; filename[strlen(filename) - 1] = ((int[]){'U','V','A','x'})[i];
} }
} else { } else {
pb[0] = s->pb; pb[0] = s->pb;
} }
if(img->split_planes){ if (img->split_planes) {
int ysize = codec->width * codec->height; int ysize = codec->width * codec->height;
int usize = ((-codec->width)>>desc->log2_chroma_w) * ((-codec->height)>>desc->log2_chroma_h); int usize = ((-codec->width)>>desc->log2_chroma_w) * ((-codec->height)>>desc->log2_chroma_h);
if (desc->comp[0].depth_minus1 >= 8) { if (desc->comp[0].depth_minus1 >= 8) {
ysize *= 2; ysize *= 2;
usize *= 2; usize *= 2;
} }
avio_write(pb[0], pkt->data , ysize); avio_write(pb[0], pkt->data , ysize);
avio_write(pb[1], pkt->data + ysize , usize); avio_write(pb[1], pkt->data + ysize , usize);
avio_write(pb[2], pkt->data + ysize + usize, usize); avio_write(pb[2], pkt->data + ysize + usize, usize);
avio_close(pb[1]); avio_close(pb[1]);
...@@ -113,7 +113,7 @@ static int write_packet(AVFormatContext *s, AVPacket *pkt) ...@@ -113,7 +113,7 @@ static int write_packet(AVFormatContext *s, AVPacket *pkt)
avio_write(pb[3], pkt->data + ysize + 2*usize, ysize); avio_write(pb[3], pkt->data + ysize + 2*usize, ysize);
avio_close(pb[3]); avio_close(pb[3]);
} }
}else{ } else {
avio_write(pb[0], pkt->data, pkt->size); avio_write(pb[0], pkt->data, pkt->size);
} }
avio_flush(pb[0]); avio_flush(pb[0]);
...@@ -128,8 +128,8 @@ static int write_packet(AVFormatContext *s, AVPacket *pkt) ...@@ -128,8 +128,8 @@ static int write_packet(AVFormatContext *s, AVPacket *pkt)
#define OFFSET(x) offsetof(VideoMuxData, x) #define OFFSET(x) offsetof(VideoMuxData, x)
#define ENC AV_OPT_FLAG_ENCODING_PARAM #define ENC AV_OPT_FLAG_ENCODING_PARAM
static const AVOption muxoptions[] = { static const AVOption muxoptions[] = {
{ "updatefirst", "", OFFSET(updatefirst), AV_OPT_TYPE_INT, {.i64 = 0}, 0, 1, ENC }, { "updatefirst", "", OFFSET(updatefirst), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, ENC },
{ "start_number", "first number in the sequence", OFFSET(img_number), AV_OPT_TYPE_INT, {.i64 = 1}, 1, INT_MAX, ENC }, { "start_number", "first number in the sequence", OFFSET(img_number), AV_OPT_TYPE_INT, { .i64 = 1 }, 1, INT_MAX, ENC },
{ NULL }, { NULL },
}; };
......
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