static int debug = 0;
static int debug_mv = 0;
static int step = 0;
+static int thread_count = 1;
+static int workaround_bugs = 1;
/* current context */
static int is_full_screen;
len1 = avcodec_decode_video(&is->video_st->codec,
frame, &got_picture,
pkt->data, pkt->size);
- if (len1 < 0)
- break;
+// if (len1 < 0)
+// break;
if (got_picture) {
if (output_picture2(is, frame, pts) < 0)
goto the_end;
}
codec = avcodec_find_decoder(enc->codec_id);
+ enc->debug_mv = debug_mv;
+ enc->debug = debug;
+ enc->workaround_bugs = workaround_bugs;
if (!codec ||
avcodec_open(enc, codec) < 0)
return -1;
+#if defined(HAVE_PTHREADS) || defined(HAVE_W32THREADS)
+ if(thread_count>1)
+ avcodec_thread_init(enc, thread_count);
+#endif
+ enc->thread_count= thread_count;
switch(enc->codec_type) {
case CODEC_TYPE_AUDIO:
is->audio_stream = stream_index;
packet_queue_init(&is->videoq);
is->video_tid = SDL_CreateThread(video_thread, is);
- enc->debug = debug;
- enc->debug_mv = debug_mv;
break;
default:
break;
}
if (is->video_stream >= 0) {
packet_queue_flush(&is->videoq);
+ avcodec_flush_buffers(&ic->streams[video_index]->codec);
}
}
is->seek_req = 0;
/* if the queue are full, no need to read more */
if (is->audioq.size > MAX_AUDIOQ_SIZE ||
- is->videoq.size > MAX_VIDEOQ_SIZE) {
+ is->videoq.size > MAX_VIDEOQ_SIZE ||
+ url_feof(&ic->pb)) {
/* wait 10 ms */
SDL_Delay(10);
continue;
{
debug_mv = atoi(arg);
}
+
+static void opt_thread_count(const char *arg)
+{
+ thread_count= atoi(arg);
+#if !defined(HAVE_PTHREADS) && !defined(HAVE_W32THREADS)
+ fprintf(stderr, "Warning: not compiled with thread support, using thread emulation\n");
+#endif
+}
const OptionDef options[] = {
{ "h", 0, {(void*)show_help}, "show help" },
{ "img", HAS_ARG, {(void*)opt_image_format}, "force image format", "img_fmt" },
{ "stats", OPT_BOOL | OPT_EXPERT, {(void*)&show_status}, "show status", "" },
{ "debug", HAS_ARG | OPT_EXPERT, {(void*)opt_debug}, "print specific debug info", "" },
+ { "bug", OPT_INT | HAS_ARG | OPT_EXPERT, {(void*)&workaround_bugs}, "workaround bugs", "" },
{ "vismv", HAS_ARG | OPT_EXPERT, {(void*)opt_vismv}, "visualize motion vectors", "" },
#ifdef CONFIG_NETWORK
{ "rtp_tcp", OPT_EXPERT, {(void*)&opt_rtp_tcp}, "force RTP/TCP protocol usage", "" },
#endif
- { "sync", HAS_ARG | OPT_EXPERT, {(void*)&opt_sync}, "set audio-video sync. type (type=audio/video/ext)", "type" },
+ { "sync", HAS_ARG | OPT_EXPERT, {(void*)opt_sync}, "set audio-video sync. type (type=audio/video/ext)", "type" },
+ { "threads", HAS_ARG | OPT_EXPERT, {(void*)opt_thread_count}, "thread count", "count" },
{ NULL, },
};