mirror of
https://github.com/gentoo-mirror/gentoo.git
synced 2026-09-24 04:59:14 -07:00
media-video/vdr2jpeg: remove unused patch(es)
Closes: https://github.com/gentoo/gentoo/pull/17321 Package-Manager: Portage-3.0.4, Repoman-3.0.1 Signed-off-by: Michael Mair-Keimberger <m.mairkeimberger@gmail.com> Signed-off-by: Conrad Kostecki <conikost@gentoo.org>
This commit is contained in:
committed by
Conrad Kostecki
parent
d97eb7668e
commit
d7a13d7265
@@ -1,326 +0,0 @@
|
||||
diff -urN vdr2jpeg-0.1.9.old/ffm.cpp vdr2jpeg-0.1.9/ffm.cpp
|
||||
--- vdr2jpeg-0.1.9.old/ffm.cpp 2012-04-21 09:53:26.727892390 +0200
|
||||
+++ vdr2jpeg-0.1.9/ffm.cpp 2012-04-21 09:57:25.555890271 +0200
|
||||
@@ -21,6 +21,7 @@
|
||||
|
||||
extern "C" {
|
||||
#include <libavutil/avutil.h>
|
||||
+#include <libavutil/mathematics.h>
|
||||
#include <libavcodec/avcodec.h>
|
||||
#include <libavformat/avformat.h>
|
||||
#include <libswscale/swscale.h>
|
||||
@@ -185,7 +186,7 @@
|
||||
}else
|
||||
ost->sync_opts= lrintf(get_sync_ipts(ost) / av_q2d(enc->time_base));
|
||||
|
||||
- nb_frames= FFMIN(nb_frames, max_frames[CODEC_TYPE_VIDEO] - ost->frame_number);
|
||||
+ nb_frames= FFMIN(nb_frames, max_frames[AVMEDIA_TYPE_VIDEO] - ost->frame_number);
|
||||
if (nb_frames <= 0)
|
||||
return true;
|
||||
|
||||
@@ -221,7 +222,7 @@
|
||||
if(dec->coded_frame && enc->coded_frame->pts != AV_NOPTS_VALUE)
|
||||
pkt.pts= av_rescale_q(enc->coded_frame->pts, enc->time_base, ost->st->time_base);
|
||||
if(dec->coded_frame && dec->coded_frame->key_frame)
|
||||
- pkt.flags |= PKT_FLAG_KEY;
|
||||
+ pkt.flags |= AV_PKT_FLAG_KEY;
|
||||
|
||||
av_interleaved_write_frame(s, &pkt);
|
||||
enc->coded_frame = old_frame;
|
||||
@@ -245,7 +246,7 @@
|
||||
big_picture.quality = (int)ist->st->quality;
|
||||
}else
|
||||
big_picture.quality = (int)ost->st->quality;
|
||||
- big_picture.pict_type = 0;
|
||||
+ big_picture.pict_type = (AVPictureType) 0;
|
||||
// big_picture.pts = AV_NOPTS_VALUE;
|
||||
big_picture.pts= ost->sync_opts;
|
||||
// big_picture.pts= av_rescale(ost->sync_opts, AV_TIME_BASE*(int64_t)enc->time_base.num, enc->time_base.den);
|
||||
@@ -268,7 +269,7 @@
|
||||
pkt.dts != AV_NOPTS_VALUE ? av_rescale(pkt.dts, enc->time_base.den, AV_TIME_BASE*(int64_t)enc->time_base.num) : -1);*/
|
||||
|
||||
if(enc->coded_frame && enc->coded_frame->key_frame)
|
||||
- pkt.flags |= PKT_FLAG_KEY;
|
||||
+ pkt.flags |= AV_PKT_FLAG_KEY;
|
||||
av_interleaved_write_frame(s, &pkt);
|
||||
*frame_size = ret;
|
||||
}
|
||||
@@ -316,13 +317,17 @@
|
||||
data_size = 0;
|
||||
if (ist->decoding_needed) {
|
||||
switch(ist->st->codec->codec_type) {
|
||||
- case CODEC_TYPE_VIDEO:
|
||||
+ case AVMEDIA_TYPE_VIDEO:
|
||||
data_size = (ist->st->codec->width * ist->st->codec->height * 3) / 2;
|
||||
/* XXX: allocate picture correctly */
|
||||
avcodec_get_frame_defaults(&picture);
|
||||
+ AVPacket pkt;
|
||||
+ av_init_packet( &pkt );
|
||||
+ pkt.data = ptr;
|
||||
+ pkt.size = len;
|
||||
|
||||
- ret = avcodec_decode_video(ist->st->codec,
|
||||
- &picture, &got_picture, ptr, len);
|
||||
+ ret = avcodec_decode_video2(ist->st->codec,
|
||||
+ &picture, &got_picture, &pkt);
|
||||
ist->st->quality= picture.quality;
|
||||
if (ret < 0)
|
||||
goto fail_decode;
|
||||
@@ -341,7 +346,7 @@
|
||||
goto fail_decode;
|
||||
}
|
||||
} else {
|
||||
- if(ist->st->codec->codec_type == CODEC_TYPE_VIDEO) {
|
||||
+ if(ist->st->codec->codec_type == AVMEDIA_TYPE_VIDEO) {
|
||||
if (ist->st->codec->time_base.num != 0) {
|
||||
ist->next_pts += ((int64_t)AV_TIME_BASE *
|
||||
ist->st->codec->time_base.num) /
|
||||
@@ -354,16 +359,6 @@
|
||||
len = 0;
|
||||
}
|
||||
|
||||
- /* frame rate emulation */
|
||||
- if (ist->st->codec->rate_emu) {
|
||||
- int64_t pts = av_rescale((int64_t) ist->frame * ist->st->codec->time_base.num, 1000000, ist->st->codec->time_base.den);
|
||||
- int64_t now = av_gettime() - ist->start;
|
||||
- if (pts > now)
|
||||
- usleep(pts - now);
|
||||
-
|
||||
- ist->frame++;
|
||||
- }
|
||||
-
|
||||
#if 0
|
||||
/* mpeg PTS deordering : if it is a P or I frame, the PTS
|
||||
is the one of the next displayed one */
|
||||
@@ -398,7 +393,7 @@
|
||||
|
||||
if (ost->encoding_needed) {
|
||||
switch(ost->st->codec->codec_type) {
|
||||
- case CODEC_TYPE_VIDEO:
|
||||
+ case AVMEDIA_TYPE_VIDEO:
|
||||
if(!do_video_out(os, ost, ist, &picture, &frame_size))
|
||||
return -1;
|
||||
break;
|
||||
@@ -415,9 +410,9 @@
|
||||
|
||||
avcodec_get_frame_defaults(&avframe);
|
||||
ost->st->codec->coded_frame= &avframe;
|
||||
- avframe.key_frame = pkt->flags & PKT_FLAG_KEY;
|
||||
+ avframe.key_frame = pkt->flags & AV_PKT_FLAG_KEY;
|
||||
|
||||
- if (ost->st->codec->codec_type == CODEC_TYPE_VIDEO) {
|
||||
+ if (ost->st->codec->codec_type == AVMEDIA_TYPE_VIDEO) {
|
||||
ost->sync_opts++;
|
||||
}
|
||||
|
||||
@@ -438,7 +433,7 @@
|
||||
opkt.flags= pkt->flags;
|
||||
|
||||
//FIXME remove the following 2 lines they shall be replaced by the bitstream filters
|
||||
- if(av_parser_change(ist->st->parser, ost->st->codec, &opkt.data, &opkt.size, data_buf, data_size, pkt->flags & PKT_FLAG_KEY))
|
||||
+ if(av_parser_change(ist->st->parser, ost->st->codec, &opkt.data, &opkt.size, data_buf, data_size, pkt->flags & AV_PKT_FLAG_KEY))
|
||||
opkt.destruct= av_destruct_packet;
|
||||
|
||||
av_interleaved_write_frame(os, &opkt);
|
||||
@@ -459,7 +454,7 @@
|
||||
AVCodecContext *enc= ost->st->codec;
|
||||
os = output_files[ost->file_index];
|
||||
|
||||
- if(ost->st->codec->codec_type == CODEC_TYPE_VIDEO && (os->oformat->flags & AVFMT_RAWPICTURE))
|
||||
+ if(ost->st->codec->codec_type == AVMEDIA_TYPE_VIDEO && (os->oformat->flags & AVFMT_RAWPICTURE))
|
||||
continue;
|
||||
|
||||
if (ost->encoding_needed) {
|
||||
@@ -469,10 +464,10 @@
|
||||
pkt.stream_index= ost->index;
|
||||
|
||||
switch(ost->st->codec->codec_type) {
|
||||
- case CODEC_TYPE_VIDEO:
|
||||
+ case AVMEDIA_TYPE_VIDEO:
|
||||
ret = avcodec_encode_video(enc, bit_buffer, bit_buffer_size, NULL);
|
||||
if(enc->coded_frame && enc->coded_frame->key_frame)
|
||||
- pkt.flags |= PKT_FLAG_KEY;
|
||||
+ pkt.flags |= AV_PKT_FLAG_KEY;
|
||||
break;
|
||||
default:
|
||||
ret=-1;
|
||||
@@ -547,11 +542,6 @@
|
||||
ist->index = k;
|
||||
ist->discard = 1; /* the stream is discarded by default
|
||||
(changed later) */
|
||||
-
|
||||
- if (ist->st->codec->rate_emu) {
|
||||
- ist->start = av_gettime();
|
||||
- ist->frame = 0;
|
||||
- }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -641,20 +631,20 @@
|
||||
else
|
||||
codec->time_base = ist->st->time_base;
|
||||
switch(codec->codec_type) {
|
||||
- case CODEC_TYPE_VIDEO:
|
||||
+ case AVMEDIA_TYPE_VIDEO:
|
||||
codec->pix_fmt = icodec->pix_fmt;
|
||||
codec->width = icodec->width;
|
||||
codec->height = icodec->height;
|
||||
codec->has_b_frames = icodec->has_b_frames;
|
||||
break;
|
||||
- case CODEC_TYPE_SUBTITLE:
|
||||
+ case AVMEDIA_TYPE_SUBTITLE:
|
||||
break;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
switch(codec->codec_type) {
|
||||
- case CODEC_TYPE_VIDEO:
|
||||
+ case AVMEDIA_TYPE_VIDEO:
|
||||
ost->video_resample = ((codec->width != icodec->width) ||
|
||||
(codec->height != icodec->height) ||
|
||||
(codec->pix_fmt != icodec->pix_fmt));
|
||||
@@ -686,7 +676,7 @@
|
||||
return false;
|
||||
}
|
||||
}
|
||||
- if(codec->codec_type == CODEC_TYPE_VIDEO){
|
||||
+ if(codec->codec_type == AVMEDIA_TYPE_VIDEO){
|
||||
int size= codec->width * codec->height;
|
||||
bit_buffer_size= FFMAX(bit_buffer_size, 4*size);
|
||||
}
|
||||
@@ -738,7 +728,7 @@
|
||||
ist->file_index, ist->index);
|
||||
return false;
|
||||
}
|
||||
- //if (ist->st->codec->codec_type == CODEC_TYPE_VIDEO)
|
||||
+ //if (ist->st->codec->codec_type == AVMEDIA_TYPE_VIDEO)
|
||||
// ist->st->codec->flags |= CODEC_FLAG_REPEAT_FIELD;
|
||||
}
|
||||
}
|
||||
@@ -786,7 +776,7 @@
|
||||
ost = ost_table[i];
|
||||
os = output_files[ost->file_index];
|
||||
ist = ist_table[ost->source_index];
|
||||
- if(ost->st->codec->codec_type == CODEC_TYPE_VIDEO)
|
||||
+ if(ost->st->codec->codec_type == AVMEDIA_TYPE_VIDEO)
|
||||
opts = ost->sync_opts * av_q2d(ost->st->codec->time_base);
|
||||
else
|
||||
opts = ost->st->pts.val * av_q2d(ost->st->time_base);
|
||||
@@ -924,22 +914,22 @@
|
||||
void print_error(const char *filename, int err)
|
||||
{
|
||||
switch(err) {
|
||||
- case AVERROR_NUMEXPECTED:
|
||||
+ case AVERROR(EINVAL):
|
||||
fprintf(stderr, "%s: Incorrect image filename syntax.\n",
|
||||
filename);
|
||||
break;
|
||||
case AVERROR_INVALIDDATA:
|
||||
fprintf(stderr, "%s: Error while parsing header\n", filename);
|
||||
break;
|
||||
- case AVERROR_NOFMT:
|
||||
+ case AVERROR(EILSEQ):
|
||||
fprintf(stderr, "%s: Unknown format\n", filename);
|
||||
break;
|
||||
- case AVERROR_IO:
|
||||
+ case AVERROR(EIO):
|
||||
fprintf(stderr, "%s: I/O error occured\n"
|
||||
"Usually that means that input file is truncated and/or corrupted.\n",
|
||||
filename);
|
||||
break;
|
||||
- case AVERROR_NOMEM:
|
||||
+ case AVERROR(ENOMEM):
|
||||
fprintf(stderr, "%s: memory allocation error occured\n", filename);
|
||||
break;
|
||||
default:
|
||||
@@ -968,9 +958,9 @@
|
||||
ap->pix_fmt = frame_pix_fmt;
|
||||
ap->channel = 0;
|
||||
ap->standard = 0;
|
||||
- ap->video_codec_id = CODEC_ID_NONE;
|
||||
+ ic->video_codec_id = CODEC_ID_NONE;
|
||||
if(pgmyuv_compatibility_hack)
|
||||
- ap->video_codec_id= CODEC_ID_PGMYUV;
|
||||
+ ic->video_codec_id= CODEC_ID_PGMYUV;
|
||||
|
||||
/* open the input file with generic libav function */
|
||||
err = av_open_input_file(&ic, filename, file_iformat, 0, ap);
|
||||
@@ -999,7 +989,7 @@
|
||||
AVCodecContext *enc = ic->streams[i]->codec;
|
||||
enc->thread_count= 1;
|
||||
switch(enc->codec_type) {
|
||||
- case CODEC_TYPE_VIDEO:
|
||||
+ case AVMEDIA_TYPE_VIDEO:
|
||||
frame_height = enc->height;
|
||||
frame_width = enc->width;
|
||||
frame_aspect_ratio = av_q2d(enc->sample_aspect_ratio) * enc->width / enc->height;
|
||||
@@ -1020,13 +1010,12 @@
|
||||
frame_rate = rfps;
|
||||
frame_rate_base = rfps_base;
|
||||
|
||||
- enc->rate_emu = 0;
|
||||
break;
|
||||
- case CODEC_TYPE_DATA:
|
||||
+ case AVMEDIA_TYPE_DATA:
|
||||
break;
|
||||
- case CODEC_TYPE_SUBTITLE:
|
||||
+ case AVMEDIA_TYPE_SUBTITLE:
|
||||
break;
|
||||
- case CODEC_TYPE_UNKNOWN:
|
||||
+ case AVMEDIA_TYPE_UNKNOWN:
|
||||
break;
|
||||
default:
|
||||
//av_abort();
|
||||
@@ -1058,12 +1047,12 @@
|
||||
for(i=0;i<ic->nb_streams;i++) {
|
||||
AVCodecContext *enc = ic->streams[i]->codec;
|
||||
switch(enc->codec_type) {
|
||||
- case CODEC_TYPE_VIDEO:
|
||||
+ case AVMEDIA_TYPE_VIDEO:
|
||||
has_video = 1;
|
||||
break;
|
||||
- case CODEC_TYPE_DATA:
|
||||
- case CODEC_TYPE_UNKNOWN:
|
||||
- case CODEC_TYPE_SUBTITLE:
|
||||
+ case AVMEDIA_TYPE_DATA:
|
||||
+ case AVMEDIA_TYPE_UNKNOWN:
|
||||
+ case AVMEDIA_TYPE_SUBTITLE:
|
||||
break;
|
||||
default:
|
||||
//av_abort();
|
||||
@@ -1086,14 +1075,14 @@
|
||||
fprintf(stderr, "Could not alloc stream\n");
|
||||
return false;
|
||||
}
|
||||
- avcodec_get_context_defaults2(st->codec, CODEC_TYPE_VIDEO);
|
||||
+ avcodec_get_context_defaults2(st->codec, AVMEDIA_TYPE_VIDEO);
|
||||
|
||||
video_enc = st->codec;
|
||||
|
||||
{
|
||||
AVCodec *codec;
|
||||
|
||||
- codec_id = av_guess_codec(oc->oformat, NULL, oc->filename, NULL, CODEC_TYPE_VIDEO);
|
||||
+ codec_id = av_guess_codec(oc->oformat, NULL, oc->filename, NULL, AVMEDIA_TYPE_VIDEO);
|
||||
|
||||
video_enc->codec_id = codec_id;
|
||||
codec = avcodec_find_encoder(codec_id);
|
||||
@@ -1203,7 +1192,7 @@
|
||||
oc = avformat_alloc_context();
|
||||
|
||||
if (!file_oformat) {
|
||||
- file_oformat = guess_format(NULL, filename, NULL);
|
||||
+ file_oformat = av_guess_format(NULL, filename, NULL);
|
||||
if (!file_oformat) {
|
||||
fprintf(stderr, "Unable for find a suitable output format for '%s'\n",
|
||||
filename);
|
||||
@@ -1239,7 +1228,7 @@
|
||||
/* check filename in case of an image number is expected */
|
||||
if (oc->oformat->flags & AVFMT_NEEDNUMBER) {
|
||||
if (!av_filename_number_test(oc->filename)) {
|
||||
- print_error(oc->filename, AVERROR_NUMEXPECTED);
|
||||
+ print_error(oc->filename, AVERROR(EINVAL));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -1,238 +0,0 @@
|
||||
Index: vdr2jpeg-0.1.9/ffm.cpp
|
||||
===================================================================
|
||||
--- vdr2jpeg-0.1.9.orig/ffm.cpp
|
||||
+++ vdr2jpeg-0.1.9/ffm.cpp
|
||||
@@ -22,6 +22,7 @@
|
||||
extern "C" {
|
||||
#include <libavutil/avutil.h>
|
||||
#include <libavutil/mathematics.h>
|
||||
+#include <libavutil/pixdesc.h>
|
||||
#include <libavcodec/avcodec.h>
|
||||
#include <libavformat/avformat.h>
|
||||
#include <libswscale/swscale.h>
|
||||
@@ -55,14 +56,12 @@ static int video_qdiff = 3;
|
||||
static const char *video_rc_eq="tex^qComp";
|
||||
static int me_method = ME_EPZS;
|
||||
|
||||
-static int same_quality = 1;
|
||||
|
||||
static int top_field_first = -1;
|
||||
|
||||
|
||||
|
||||
|
||||
-static float mux_preload= 0.5;
|
||||
static float mux_max_delay= 0.7;
|
||||
|
||||
static int64_t input_ts_offset = 0;
|
||||
@@ -150,7 +149,7 @@ static bool do_video_out(AVFormatContext
|
||||
int *frame_size)
|
||||
{
|
||||
int nb_frames, i, ret;
|
||||
- AVFrame *final_picture, *formatted_picture, *resampling_dst, *padding_src;
|
||||
+ AVFrame *final_picture, *formatted_picture, *resampling_dst;
|
||||
AVFrame picture_crop_temp, picture_pad_temp;
|
||||
AVCodecContext *enc, *dec;
|
||||
|
||||
@@ -195,11 +194,9 @@ static bool do_video_out(AVFormatContext
|
||||
}
|
||||
|
||||
final_picture = formatted_picture;
|
||||
- padding_src = formatted_picture;
|
||||
resampling_dst = &ost->pict_tmp;
|
||||
|
||||
if (ost->video_resample) {
|
||||
- padding_src = NULL;
|
||||
final_picture = &ost->pict_tmp;
|
||||
sws_scale(ost->img_resample_ctx, formatted_picture->data, formatted_picture->linesize,
|
||||
0, ost->resample_height, resampling_dst->data, resampling_dst->linesize);
|
||||
@@ -242,10 +239,7 @@ static bool do_video_out(AVFormatContext
|
||||
|
||||
/* handles sameq here. This is not correct because it may
|
||||
not be a global option */
|
||||
- if (same_quality) {
|
||||
- big_picture.quality = (int)ist->st->quality;
|
||||
- }else
|
||||
- big_picture.quality = (int)ost->st->quality;
|
||||
+ big_picture.quality = ist->st->codec->global_quality;
|
||||
big_picture.pict_type = (AVPictureType) 0;
|
||||
// big_picture.pts = AV_NOPTS_VALUE;
|
||||
big_picture.pts= ost->sync_opts;
|
||||
@@ -328,7 +322,7 @@ static int output_packet(AVInputStream *
|
||||
|
||||
ret = avcodec_decode_video2(ist->st->codec,
|
||||
&picture, &got_picture, &pkt);
|
||||
- ist->st->quality= picture.quality;
|
||||
+ ist->st->codec->global_quality= picture.quality;
|
||||
if (ret < 0)
|
||||
goto fail_decode;
|
||||
if (!got_picture) {
|
||||
@@ -618,31 +612,6 @@ static bool av_encode(AVFormatContext **
|
||||
codec = ost->st->codec;
|
||||
icodec = ist->st->codec;
|
||||
|
||||
- if (ost->st->stream_copy) {
|
||||
- /* if stream_copy is selected, no need to decode or encode */
|
||||
- codec->codec_id = icodec->codec_id;
|
||||
- codec->codec_type = icodec->codec_type;
|
||||
- if(!codec->codec_tag) codec->codec_tag = icodec->codec_tag;
|
||||
- codec->bit_rate = icodec->bit_rate;
|
||||
- codec->extradata= icodec->extradata;
|
||||
- codec->extradata_size= icodec->extradata_size;
|
||||
- if(av_q2d(icodec->time_base) > av_q2d(ist->st->time_base) && av_q2d(ist->st->time_base) < 1.0/1000)
|
||||
- codec->time_base = icodec->time_base;
|
||||
- else
|
||||
- codec->time_base = ist->st->time_base;
|
||||
- switch(codec->codec_type) {
|
||||
- case AVMEDIA_TYPE_VIDEO:
|
||||
- codec->pix_fmt = icodec->pix_fmt;
|
||||
- codec->width = icodec->width;
|
||||
- codec->height = icodec->height;
|
||||
- codec->has_b_frames = icodec->has_b_frames;
|
||||
- break;
|
||||
- case AVMEDIA_TYPE_SUBTITLE:
|
||||
- break;
|
||||
- default:
|
||||
- return false;
|
||||
- }
|
||||
- } else {
|
||||
switch(codec->codec_type) {
|
||||
case AVMEDIA_TYPE_VIDEO:
|
||||
ost->video_resample = ((codec->width != icodec->width) ||
|
||||
@@ -675,7 +644,6 @@ static bool av_encode(AVFormatContext **
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
- }
|
||||
if(codec->codec_type == AVMEDIA_TYPE_VIDEO){
|
||||
int size= codec->width * codec->height;
|
||||
bit_buffer_size= FFMAX(bit_buffer_size, 4*size);
|
||||
@@ -690,7 +658,7 @@ static bool av_encode(AVFormatContext **
|
||||
/* dump the file output parameters - cannot be done before in case
|
||||
of stream copy */
|
||||
for(i=0;i<nb_output_files;i++) {
|
||||
- dump_format(output_files[i], i, output_files[i]->filename, 1);
|
||||
+ av_dump_format(output_files[i], i, output_files[i]->filename, 1);
|
||||
}
|
||||
|
||||
/* open each encoder */
|
||||
@@ -749,7 +717,7 @@ static bool av_encode(AVFormatContext **
|
||||
/* open files and write file headers */
|
||||
for(i=0;i<nb_output_files;i++) {
|
||||
os = output_files[i];
|
||||
- if (av_write_header(os) < 0) {
|
||||
+ if (avformat_write_header(os,NULL) < 0) {
|
||||
fprintf(stderr, "Could not write header for output file #%d (incorrect codec parameters ?)\n", i);
|
||||
ret = false; //AVERROR(EINVAL);
|
||||
goto fail;
|
||||
@@ -941,36 +909,32 @@ void print_error(const char *filename, i
|
||||
static bool opt_input_file(const char *filename)
|
||||
{
|
||||
AVFormatContext *ic;
|
||||
- AVFormatParameters params, *ap = ¶ms;
|
||||
int err, ret, rfps, rfps_base;
|
||||
unsigned int i;
|
||||
int64_t timestamp;
|
||||
+ AVDictionary *opts = NULL;
|
||||
+ char buf[1024];
|
||||
|
||||
/* get default parameters from command line */
|
||||
ic = avformat_alloc_context();
|
||||
|
||||
- memset(ap, 0, sizeof(*ap));
|
||||
- ap->prealloced_context = 1;
|
||||
- ap->time_base.den = frame_rate;
|
||||
- ap->time_base.num = frame_rate_base;
|
||||
- ap->width = frame_width + 0 + 0;
|
||||
- ap->height = frame_height + 0 + 0;
|
||||
- ap->pix_fmt = frame_pix_fmt;
|
||||
- ap->channel = 0;
|
||||
- ap->standard = 0;
|
||||
+ snprintf(buf, sizeof(buf), "%d/%d", frame_rate, frame_rate_base);
|
||||
+ av_dict_set(&opts, "framerate", buf, 0);
|
||||
+ snprintf(buf, sizeof(buf), "%dx%d", frame_width, frame_height);
|
||||
+ av_dict_set(&opts, "video_size", buf, 0);
|
||||
+ av_dict_set(&opts, "pixel_format", av_get_pix_fmt_name(frame_pix_fmt), 0);
|
||||
+
|
||||
ic->video_codec_id = CODEC_ID_NONE;
|
||||
if(pgmyuv_compatibility_hack)
|
||||
ic->video_codec_id= CODEC_ID_PGMYUV;
|
||||
|
||||
/* open the input file with generic libav function */
|
||||
- err = av_open_input_file(&ic, filename, file_iformat, 0, ap);
|
||||
+ err = avformat_open_input(&ic, filename, file_iformat, &opts);
|
||||
if (err < 0) {
|
||||
print_error(filename, err);
|
||||
return 0;
|
||||
}
|
||||
|
||||
- ic->loop_input = 0;
|
||||
-
|
||||
/* If not enough info to get the stream parameters, we decode the
|
||||
first frames to get it. (used in mpeg case for example) */
|
||||
ret = av_find_stream_info(ic);
|
||||
@@ -1027,7 +991,7 @@ static bool opt_input_file(const char *f
|
||||
input_files_ts_offset[nb_input_files] = input_ts_offset - timestamp;
|
||||
/* dump the file content */
|
||||
if (verbose >= 0)
|
||||
- dump_format(ic, nb_input_files, filename, 0);
|
||||
+ av_dump_format(ic, nb_input_files, filename, 0);
|
||||
|
||||
nb_input_files++;
|
||||
file_iformat = NULL;
|
||||
@@ -1133,11 +1097,8 @@ static bool new_video_stream(AVFormatCon
|
||||
|
||||
/* if (intra_only)
|
||||
video_enc->gop_size = 0;*/
|
||||
- if (same_quality) {
|
||||
video_enc->flags |= CODEC_FLAG_QSCALE;
|
||||
- st->quality = FF_QP2LAMBDA;
|
||||
- video_enc->global_quality= (int)st->quality;
|
||||
- }
|
||||
+ video_enc->global_quality= FF_QP2LAMBDA;
|
||||
|
||||
video_enc->max_qdiff = video_qdiff;
|
||||
video_enc->rc_eq = video_rc_eq;
|
||||
@@ -1187,7 +1148,6 @@ static bool opt_output_file(const char *
|
||||
{
|
||||
AVFormatContext *oc;
|
||||
int use_video, input_has_video = 0;
|
||||
- AVFormatParameters params, *ap = ¶ms;
|
||||
|
||||
oc = avformat_alloc_context();
|
||||
|
||||
@@ -1219,8 +1179,6 @@ static bool opt_output_file(const char *
|
||||
return false;
|
||||
}
|
||||
|
||||
- oc->timestamp = 0;
|
||||
-
|
||||
}
|
||||
|
||||
output_files[nb_output_files++] = oc;
|
||||
@@ -1233,16 +1191,7 @@ static bool opt_output_file(const char *
|
||||
}
|
||||
}
|
||||
|
||||
- memset(ap, 0, sizeof(*ap));
|
||||
- if (av_set_parameters(oc, ap) < 0) {
|
||||
- fprintf(stderr, "%s: Invalid encoding parameters\n",
|
||||
- oc->filename);
|
||||
- return false;
|
||||
- }
|
||||
-
|
||||
- oc->preload= (int)(mux_preload*AV_TIME_BASE);
|
||||
oc->max_delay= (int)(mux_max_delay*AV_TIME_BASE);
|
||||
- oc->loop_output = AVFMT_NOOUTPUTLOOP;
|
||||
|
||||
/* reset some options */
|
||||
file_oformat = NULL;
|
||||
@@ -1323,7 +1272,7 @@ bool decode (const char* szMPVfile, /* c
|
||||
AVFormatContext *s = output_files[i];
|
||||
|
||||
if (!(s->oformat->flags & AVFMT_NOFILE))
|
||||
- url_fclose(s->pb);
|
||||
+ avio_close(s->pb);
|
||||
for(j=0;j<s->nb_streams;j++)
|
||||
av_free(s->streams[j]);
|
||||
av_free(s);
|
||||
@@ -1,54 +0,0 @@
|
||||
--- ffm.cpp.old 2013-06-22 20:12:27.972712290 +0200
|
||||
+++ ffm.cpp 2013-06-22 20:13:33.586709956 +0200
|
||||
@@ -672,7 +672,7 @@
|
||||
ost->file_index, ost->index);
|
||||
return false;
|
||||
}
|
||||
- if (avcodec_open(ost->st->codec, codec) < 0) {
|
||||
+ if (avcodec_open2(ost->st->codec, codec, NULL) < 0) {
|
||||
fprintf(stderr, "Error while opening codec for output stream #%d.%d - maybe incorrect parameters such as bit_rate, rate, width or height\n",
|
||||
ost->file_index, ost->index);
|
||||
return false;
|
||||
@@ -691,7 +691,7 @@
|
||||
ist->st->codec->codec_id, ist->file_index, ist->index);
|
||||
return false;
|
||||
}
|
||||
- if (avcodec_open(ist->st->codec, codec) < 0) {
|
||||
+ if (avcodec_open2(ist->st->codec, codec, NULL) < 0) {
|
||||
fprintf(stderr, "Error while opening codec for input stream #%d.%d\n",
|
||||
ist->file_index, ist->index);
|
||||
return false;
|
||||
@@ -937,7 +937,7 @@
|
||||
|
||||
/* If not enough info to get the stream parameters, we decode the
|
||||
first frames to get it. (used in mpeg case for example) */
|
||||
- ret = av_find_stream_info(ic);
|
||||
+ ret = avformat_find_stream_info(ic, NULL);
|
||||
if (ret < 0 && verbose >= 0) {
|
||||
fprintf(stderr, "%s: could not find codec parameters\n", filename);
|
||||
return false;
|
||||
@@ -1034,12 +1034,13 @@
|
||||
AVCodecContext *video_enc;
|
||||
CodecID codec_id;
|
||||
|
||||
- st = av_new_stream(oc, oc->nb_streams);
|
||||
+ st = avformat_new_stream(oc, NULL);
|
||||
if (!st) {
|
||||
fprintf(stderr, "Could not alloc stream\n");
|
||||
return false;
|
||||
}
|
||||
- avcodec_get_context_defaults2(st->codec, AVMEDIA_TYPE_VIDEO);
|
||||
+ st->id = oc->nb_streams;
|
||||
+ avcodec_get_context_defaults3(st->codec, NULL);
|
||||
|
||||
video_enc = st->codec;
|
||||
|
||||
@@ -1204,7 +1205,7 @@
|
||||
{
|
||||
av_log_set_level(verbose);
|
||||
av_register_all();
|
||||
- avctx_opts= avcodec_alloc_context();
|
||||
+ avctx_opts= avcodec_alloc_context3(NULL);
|
||||
}
|
||||
|
||||
void ffm_deinitalize(void)
|
||||
Reference in New Issue
Block a user