X-Git-Url: http://git.cinelerra-gg.org/git/?a=blobdiff_plain;f=cinelerra-5.0%2Fcinelerra%2Fffmpeg.C;h=68ff296d0013581d695f2bb713d75d4554f764eb;hb=91efd376233a15f6572e6f68d28a5bee69797e87;hp=4ae746f90536f8cec0ae867bdc51702ae73ebbe3;hpb=8b5736be1905481027c2f1dcb23d34020c52d7cc;p=goodguy%2Fhistory.git diff --git a/cinelerra-5.0/cinelerra/ffmpeg.C b/cinelerra-5.0/cinelerra/ffmpeg.C index 4ae746f9..68ff296d 100644 --- a/cinelerra-5.0/cinelerra/ffmpeg.C +++ b/cinelerra-5.0/cinelerra/ffmpeg.C @@ -39,7 +39,7 @@ static void ff_err(int ret, const char *fmt, ...) va_end(ap); char errmsg[BCSTRLEN]; av_strerror(ret, errmsg, sizeof(errmsg)); - fprintf(stderr,"%s err: %s\n",msg, errmsg); + fprintf(stderr,_("%s err: %s\n"),msg, errmsg); } FFPacket::FFPacket() @@ -626,12 +626,12 @@ int FFVideoStream::decode_frame(AVFrame *frame, int &got_frame) int FFVideoStream::load(VFrame *vframe, int64_t pos) { - if( video_seek(pos) < 0 ) return -1; + int ret = video_seek(pos); + if( ret < 0 ) return -1; if( !frame && !(frame=av_frame_alloc()) ) { fprintf(stderr, "FFVideoStream::load: av_frame_alloc failed\n"); return -1; } - int ret = 0; for( int i=0; ret>=0 && !flushed && curr_pos<=pos && i<1000; ++i ) { ret = read_frame(frame); } @@ -653,6 +653,7 @@ int FFVideoStream::video_seek(int64_t pos) if( gop < 4 ) gop = 4; if( gop > 64 ) gop = 64; if( pos >= curr_pos && pos <= curr_pos + gop ) return 0; + if( pos == curr_pos-1 && curr_pos > seek_pos ) return 1; if( !st->codec || !st->codec->codec ) return -1; avcodec_flush_buffers(st->codec); // back up a few frames to read up to current to help repair damages @@ -957,8 +958,6 @@ AVRational FFMPEG::to_time_base(int sample_rate) return (AVRational){1, sample_rate}; } -extern void get_exe_path(char *result); // from main.C - void FFMPEG::set_option_path(char *path, const char *fmt, ...) { get_exe_path(path); @@ -1043,8 +1042,8 @@ int FFMPEG::get_encoder(const char *options, return 1; } if( get_encoder(fp, format, codec, bsfilter, bsargs) ) - eprintf("FFMPEG::get_encoder:" - " err: format/codec not found %s\n", options); + eprintf(_("FFMPEG::get_encoder:" + " err: format/codec not found %s\n"), options); fclose(fp); return 0; } @@ -1074,12 +1073,14 @@ int FFMPEG::read_options(const char *options, AVDictionary *&opts) return ret; } -int FFMPEG::scan_options(const char *options, AVDictionary *&opts) +int FFMPEG::scan_options(const char *options, AVDictionary *&opts, AVStream *st) { FILE *fp = fmemopen((void *)options,strlen(options),"r"); if( !fp ) return 0; int ret = read_options(fp, options, opts); fclose(fp); + AVDictionaryEntry *tag = av_dict_get(opts, "id", NULL, 0); + if( tag ) st->id = strtol(tag->value,0,0); return ret; } @@ -1094,8 +1095,8 @@ int FFMPEG::read_options(FILE *fp, const char *options, AVDictionary *&opts) if( line[0] == '\n' ) continue; char key[BCSTRLEN], val[BCTEXTLEN]; if( scan_option_line(line, key, val) ) { - eprintf("FFMPEG::read_options:" - " err reading %s: line %d\n", options, no); + eprintf(_("FFMPEG::read_options:" + " err reading %s: line %d\n"), options, no); ret = 1; } if( !ret ) { @@ -1174,7 +1175,7 @@ int FFMPEG::info(char *text, int len) for( int i=0; i<(int)fmt_ctx->nb_streams; ++i ) { AVStream *st = fmt_ctx->streams[i]; AVCodecContext *avctx = st->codec; - report("stream %d, id 0x%06x:\n", i, avctx->codec_id); + report(_("stream %d, id 0x%06x:\n"), i, avctx->codec_id); const AVCodecDescriptor *desc = avcodec_descriptor_get(avctx->codec_id); if( avctx->codec_type == AVMEDIA_TYPE_VIDEO ) { AVRational framerate = av_guess_frame_rate(fmt_ctx, st, 0); @@ -1206,7 +1207,7 @@ int FFMPEG::info(char *text, int len) report(" %d:%02d:%05.2f\n", hrs, mins, secs); } else - report(" codec_type unknown\n"); + report(_(" codec_type unknown\n")); } report("\n"); for( int i=0; i<(int)fmt_ctx->nb_programs; ++i ) { @@ -1436,7 +1437,7 @@ int FFMPEG::open_encoder(const char *type, const char *spec) break; } has_audio = 1; - if( scan_options(asset->ff_audio_options, sopts) ) { + if( scan_options(asset->ff_audio_options, sopts, st) ) { eprintf("FFMPEG::open_encoder: bad audio options %s:%s\n", codec_name, filename); ret = 1; @@ -1482,7 +1483,7 @@ int FFMPEG::open_encoder(const char *type, const char *spec) break; } has_video = 1; - if( scan_options(asset->ff_video_options, sopts) ) { + if( scan_options(asset->ff_video_options, sopts, st) ) { eprintf("FFMPEG::open_encoder: bad video options %s:%s\n", codec_name, filename); ret = 1;