|
From: Bill F. <bil...@mi...> - 2002-06-20 05:08:58
|
On Wed, 19 Jun 2002, Bill Fink wrote:
> On 19 Jun 2002, Dan Dennedy wrote:
>
> > On Wed, 2002-06-19 at 14:49, Bill Fink wrote:
> > > Also related to the audio, how difficult would it be to add an option
> > > --skip-video=n that would only decode and display every nth video frame,
> > > since at the moment if I try and do both audio and video, the audio is
> > > very stuttery and not understandable because my processor can't keep up
> > > with the demands of decoding the full frame rate video?
> >
> > Do you care to contribute that yourself? Currently, we are trying to
> > release libdv 0.9.6, and I thought we were ready until these issues
> > popped up--particularly the endian detection issues. So, this is a lower
> > priority right now.
>
> I'll take a look at it. I admit that this part's not a high priority
> though.
OK. I'm attaching a patch that implements the --skip-video option.
It didn't work quite as well as I had hoped, but I still think it's
useful (you can also use it to control how much CPU playdv consumes).
I guess you really need separate audio and video threads to do this
properly, but that's a much larger task.
-Bill
playdv-skip-video.patch:
--------------------------------------------------------------------------------
--- .orig/playdv.c Sun May 26 17:02:42 2002
+++ .mod/playdv.c Thu Jun 20 00:25:14 2002
@@ -56,13 +56,14 @@
#define DV_PLAYER_OPT_DISABLE_AUDIO 1
#define DV_PLAYER_OPT_DISABLE_VIDEO 2
#define DV_PLAYER_OPT_NUM_FRAMES 3
-#define DV_PLAYER_OPT_OSS_INCLUDE 4
-#define DV_PLAYER_OPT_DISPLAY_INCLUDE 5
-#define DV_PLAYER_OPT_DECODER_INCLUDE 6
-#define DV_PLAYER_OPT_AUTOHELP 7
-#define DV_PLAYER_OPT_DUMP_FRAMES 8
-#define DV_PLAYER_OPT_NO_MMAP 9
-#define DV_PLAYER_NUM_OPTS 10
+#define DV_PLAYER_OPT_SKIP_VIDEO 4
+#define DV_PLAYER_OPT_OSS_INCLUDE 5
+#define DV_PLAYER_OPT_DISPLAY_INCLUDE 6
+#define DV_PLAYER_OPT_DECODER_INCLUDE 7
+#define DV_PLAYER_OPT_AUTOHELP 8
+#define DV_PLAYER_OPT_DUMP_FRAMES 9
+#define DV_PLAYER_OPT_NO_MMAP 10
+#define DV_PLAYER_NUM_OPTS 11
/* Book-keeping for mmap */
typedef struct dv_mmap_region_s {
@@ -82,6 +83,7 @@
gint arg_disable_video;
gint no_mmap;
gint arg_num_frames;
+ gint arg_skip_video;
char* arg_dump_frames;
#if HAVE_LIBPOPT
struct poptOption option_table[DV_PLAYER_NUM_OPTS+1];
@@ -127,6 +129,15 @@
descrip: "stop after <count> frames",
}; /* number of frames */
+ result->option_table[DV_PLAYER_OPT_SKIP_VIDEO] = (struct poptOption) {
+ longName: "skip-video",
+ shortName: 's',
+ argInfo: POPT_ARG_INT,
+ arg: &result->arg_skip_video,
+ argDescrip: "n",
+ descrip: "only process every <n>th video frame",
+ }; /* number of video frames to skip */
+
result->option_table[DV_PLAYER_OPT_DUMP_FRAMES] = (struct poptOption) {
longName: "dump-frames",
argInfo: POPT_ARG_STRING,
@@ -368,6 +379,9 @@
if(!(audio_buffers[i] = malloc(DV_AUDIO_MAX_SAMPLES*sizeof(gint16)))) goto no_mem;
} /* if */
+ if (!dv_player->arg_skip_video)
+ dv_player->arg_skip_video = 1;
+
gettimeofday(dv_player->tv+0,NULL);
dv_player->decoder->prev_frame_decoded = 0;
@@ -412,7 +426,7 @@
} /* if */
} /* if */
- if(!dv_player->arg_disable_video) {
+ if((!dv_player->arg_disable_video) && ((frame_count % dv_player->arg_skip_video) == 0)) {
#if 0
if (dv_format_wide (dv_player->decoder))
fprintf (stderr, "format 16:9\n");
|