diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2012-11-30 17:49:13 +0400 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2012-11-30 17:49:13 +0400 |
commit | db29a7c7c2822a2f2e9804988e279a9fe7d88c11 (patch) | |
tree | 04fb612effd1e808baf292466197027e8b68b924 /libavformat/img2enc.c | |
parent | 8119d8b01f8391f11c447802782e9017ad419d99 (diff) | |
parent | 9d46eaec7a90bd8f5cd9e45398c6d17804182320 (diff) |
Merge commit '9d46eaec7a90bd8f5cd9e45398c6d17804182320'
* commit '9d46eaec7a90bd8f5cd9e45398c6d17804182320':
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: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat/img2enc.c')
-rw-r--r-- | libavformat/img2enc.c | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/libavformat/img2enc.c b/libavformat/img2enc.c index bbdb640491..9621d3c0ea 100644 --- a/libavformat/img2enc.c +++ b/libavformat/img2enc.c @@ -70,41 +70,41 @@ static int write_packet(AVFormatContext *s, AVPacket *pkt) VideoMuxData *img = s->priv_data; AVIOContext *pb[4]; 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); int i; if (!img->is_pipe) { 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, "Could not get frame filename number %d from pattern '%s'\n", img->img_number, img->path); return AVERROR(EINVAL); } - for(i=0; i<4; i++){ + for (i = 0; i < 4; i++) { if (avio_open2(&pb[i], filename, AVIO_FLAG_WRITE, &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); } - if(!img->split_planes || i+1 >= desc->nb_components) + if (!img->split_planes || i+1 >= desc->nb_components) break; - filename[ strlen(filename) - 1 ]= ((int[]){'U','V','A','x'})[i]; + filename[strlen(filename) - 1] = ((int[]){'U','V','A','x'})[i]; } } else { pb[0] = s->pb; } - if(img->split_planes){ + if (img->split_planes) { int ysize = codec->width * codec->height; int usize = ((-codec->width)>>desc->log2_chroma_w) * ((-codec->height)>>desc->log2_chroma_h); if (desc->comp[0].depth_minus1 >= 8) { ysize *= 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[2], pkt->data + ysize + usize, usize); avio_close(pb[1]); @@ -113,7 +113,7 @@ static int write_packet(AVFormatContext *s, AVPacket *pkt) avio_write(pb[3], pkt->data + ysize + 2*usize, ysize); avio_close(pb[3]); } - }else{ + } else { avio_write(pb[0], pkt->data, pkt->size); } avio_flush(pb[0]); @@ -128,8 +128,8 @@ static int write_packet(AVFormatContext *s, AVPacket *pkt) #define OFFSET(x) offsetof(VideoMuxData, x) #define ENC AV_OPT_FLAG_ENCODING_PARAM static const AVOption muxoptions[] = { - { "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 }, + { "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 }, { NULL }, }; |