mirror of
https://github.com/game-stop/veejay.git
synced 2025-12-22 07:40:00 +01:00
cleanup
fix norm setting better video standard handling
This commit is contained in:
@@ -1,12 +1,12 @@
|
|||||||
dnl Process this file with autoconf to produce a configure script.
|
dnl Process this file with autoconf to produce a configure script.
|
||||||
dnl AC_INIT
|
dnl AC_INIT
|
||||||
AC_INIT([veejay],[1.5.11],[veejay-users@lists.sourceforge.net])
|
AC_INIT([veejay],[1.5.12],[veejay-users@lists.sourceforge.net])
|
||||||
AC_PREREQ(2.57)
|
AC_PREREQ(2.57)
|
||||||
AC_CONFIG_SRCDIR([veejay/veejay.c])
|
AC_CONFIG_SRCDIR([veejay/veejay.c])
|
||||||
|
|
||||||
VEEJAY_MAJOR_VERSION=1
|
VEEJAY_MAJOR_VERSION=1
|
||||||
VEEJAY_MINOR_VERSION=5
|
VEEJAY_MINOR_VERSION=5
|
||||||
VEEJAY_MICRO_VERSION=11
|
VEEJAY_MICRO_VERSION=12
|
||||||
VEEJAY_VERSION=$VEEJAY_MAJOR_VERSION.$VEEJAY_MINOR_VERSION.$VEEJAY_MICRO_VERSION
|
VEEJAY_VERSION=$VEEJAY_MAJOR_VERSION.$VEEJAY_MINOR_VERSION.$VEEJAY_MICRO_VERSION
|
||||||
VEEJAY_CODENAME="Veejay Classic - build $VEEJAY_MINOR_VERSION $VEEJAY_MICRO_VERSION"
|
VEEJAY_CODENAME="Veejay Classic - build $VEEJAY_MINOR_VERSION $VEEJAY_MICRO_VERSION"
|
||||||
AC_CONFIG_HEADERS([config.h])
|
AC_CONFIG_HEADERS([config.h])
|
||||||
|
|||||||
@@ -1826,7 +1826,6 @@ editlist *vj_el_init_with_args(char **filename, int num_files, int flags, int de
|
|||||||
uint64_t n =0;
|
uint64_t n =0;
|
||||||
bzero(line,1024);
|
bzero(line,1024);
|
||||||
if(!el) return NULL;
|
if(!el) return NULL;
|
||||||
veejay_memset( el, 0, sizeof(editlist) );
|
|
||||||
|
|
||||||
el->has_video = 1; //assume we get it
|
el->has_video = 1; //assume we get it
|
||||||
el->MJPG_chroma = CHROMA420;
|
el->MJPG_chroma = CHROMA420;
|
||||||
@@ -1838,13 +1837,12 @@ editlist *vj_el_init_with_args(char **filename, int num_files, int flags, int de
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( norm == 'p' || norm == 'n' )
|
if(strcmp(filename[0], "+p" ) == 0 || strcmp(filename[0], "+n") == 0 ) {
|
||||||
{
|
el->video_norm = filename[0][1];
|
||||||
el->video_norm = n;
|
|
||||||
nf = 1;
|
nf = 1;
|
||||||
veejay_msg(VEEJAY_MSG_DEBUG,"Norm set to %s", el->video_norm == 'n' ? "NTSC" : "PAL");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if(force)
|
if(force)
|
||||||
{
|
{
|
||||||
veejay_msg(VEEJAY_MSG_WARNING, "Forcing load on interlacing and gop_size");
|
veejay_msg(VEEJAY_MSG_WARNING, "Forcing load on interlacing and gop_size");
|
||||||
|
|||||||
@@ -133,6 +133,53 @@ typedef struct
|
|||||||
int threaded;
|
int threaded;
|
||||||
} v4l2info;
|
} v4l2info;
|
||||||
|
|
||||||
|
static struct {
|
||||||
|
const uint64_t std;
|
||||||
|
const char *descr;
|
||||||
|
} v4l2_video_standards[] =
|
||||||
|
{
|
||||||
|
{ V4L2_STD_NTSC, "NTSC" },
|
||||||
|
{ V4L2_STD_NTSC_M, "NTSC-M" },
|
||||||
|
{ V4L2_STD_NTSC_M_JP, "NTSC-M-JP" },
|
||||||
|
{ V4L2_STD_NTSC_M_KR, "NTSC-M-KR" },
|
||||||
|
{ V4L2_STD_NTSC_443, "NTSC-443" },
|
||||||
|
{ V4L2_STD_PAL, "PAL" },
|
||||||
|
{ V4L2_STD_PAL_BG, "PAL-BG" },
|
||||||
|
{ V4L2_STD_PAL_B, "PAL-B" },
|
||||||
|
{ V4L2_STD_PAL_B1, "PAL-B1" },
|
||||||
|
{ V4L2_STD_PAL_G, "PAL-G" },
|
||||||
|
{ V4L2_STD_PAL_H, "PAL-H" },
|
||||||
|
{ V4L2_STD_PAL_I, "PAL-I" },
|
||||||
|
{ V4L2_STD_PAL_DK, "PAL-DK" },
|
||||||
|
{ V4L2_STD_PAL_D, "PAL-D" },
|
||||||
|
{ V4L2_STD_PAL_D1, "PAL-D1" },
|
||||||
|
{ V4L2_STD_PAL_K, "PAL-K" },
|
||||||
|
{ V4L2_STD_PAL_M, "PAL-M" },
|
||||||
|
{ V4L2_STD_PAL_N, "PAL-N" },
|
||||||
|
{ V4L2_STD_PAL_Nc, "PAL-Nc" },
|
||||||
|
{ V4L2_STD_PAL_60, "PAL-60" },
|
||||||
|
{ V4L2_STD_SECAM, "SECAM" },
|
||||||
|
{ V4L2_STD_SECAM_B, "SECAM-B" },
|
||||||
|
{ V4L2_STD_SECAM_G, "SECAM-G" },
|
||||||
|
{ V4L2_STD_SECAM_H, "SECAM-H" },
|
||||||
|
{ V4L2_STD_SECAM_DK, "SECAM-DK" },
|
||||||
|
{ V4L2_STD_SECAM_D, "SECAM-D" },
|
||||||
|
{ V4L2_STD_SECAM_K, "SECAM-K" },
|
||||||
|
{ V4L2_STD_SECAM_K1, "SECAM-K1" },
|
||||||
|
{ V4L2_STD_SECAM_L, "SECAM-L" },
|
||||||
|
{ V4L2_STD_SECAM_LC, "SECAM-Lc" },
|
||||||
|
{ 0, "Unknown" }
|
||||||
|
};
|
||||||
|
|
||||||
|
static const char *v4l2_get_std(int std) {
|
||||||
|
unsigned int i;
|
||||||
|
for(i=0; v4l2_video_standards[i].std != 0 ; i ++ ) {
|
||||||
|
if( v4l2_video_standards[i].std == std )
|
||||||
|
return v4l2_video_standards[i].descr;
|
||||||
|
}
|
||||||
|
return v4l2_video_standards[i].descr;
|
||||||
|
}
|
||||||
|
|
||||||
static void lock_( v4l2_thread_info *i ) {
|
static void lock_( v4l2_thread_info *i ) {
|
||||||
int res = pthread_mutex_lock(&(i->mutex));
|
int res = pthread_mutex_lock(&(i->mutex));
|
||||||
if( res < 0 ) {
|
if( res < 0 ) {
|
||||||
@@ -297,17 +344,21 @@ static int v4l2_enum_video_standards( v4l2info *v, char norm )
|
|||||||
{
|
{
|
||||||
struct v4l2_input input;
|
struct v4l2_input input;
|
||||||
struct v4l2_standard standard;
|
struct v4l2_standard standard;
|
||||||
|
v4l2_std_id current;
|
||||||
|
|
||||||
memset( &input, 0,sizeof(input));
|
memset( &input, 0,sizeof(input));
|
||||||
if( -1 == vioctl( v->fd, VIDIOC_G_INPUT, &input.index )) {
|
if( -1 == vioctl( v->fd, VIDIOC_G_INPUT, &input.index )) {
|
||||||
return 0;
|
veejay_msg(VEEJAY_MSG_WARNING, "v4l2: VIDIOC_G_INPUT failed with %s",
|
||||||
|
strerror(errno));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if( -1 == vioctl( v->fd, VIDIOC_ENUMINPUT, &input )) {
|
if( -1 == vioctl( v->fd, VIDIOC_ENUMINPUT, &input )) {
|
||||||
return 0;
|
veejay_msg(VEEJAY_MSG_WARNING, "v4l2: VIDIOC_ENUMINPUT failed with %s",
|
||||||
|
strerror(errno));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* memset( &standard, 0,sizeof(standard));
|
memset( &standard, 0,sizeof(standard));
|
||||||
standard.index = 0;
|
standard.index = 0;
|
||||||
|
|
||||||
while( 0 == vioctl( v->fd, VIDIOC_ENUMSTD, &standard )) {
|
while( 0 == vioctl( v->fd, VIDIOC_ENUMSTD, &standard )) {
|
||||||
@@ -327,15 +378,33 @@ static int v4l2_enum_video_standards( v4l2info *v, char norm )
|
|||||||
standard.index ++;
|
standard.index ++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( standard.index == 0 )
|
|
||||||
return 0;*/
|
|
||||||
int std_id = (norm == 'p' ? V4L2_STD_PAL: V4L2_STD_NTSC);
|
int std_id = (norm == 'p' ? V4L2_STD_PAL: V4L2_STD_NTSC);
|
||||||
|
|
||||||
|
if( -1 == ioctl( v->fd, VIDIOC_G_STD, ¤t ) ) {
|
||||||
|
veejay_msg(VEEJAY_MSG_WARNING, "v4l2: unable to get video standard from video device:%s",
|
||||||
|
strerror(errno));
|
||||||
|
}
|
||||||
|
|
||||||
|
if( norm == 'n' ) {
|
||||||
|
if( current & V4L2_STD_PAL ) {
|
||||||
|
veejay_msg(VEEJAY_MSG_WARNING,"v4l2: running in NTSC but device in norm %x",
|
||||||
|
current );
|
||||||
|
std_id = V4L2_STD_NTSC;
|
||||||
|
}
|
||||||
|
} else if (norm == 'p' ) {
|
||||||
|
if( current & V4L2_STD_NTSC ) {
|
||||||
|
veejay_msg(VEEJAY_MSG_WARNING,"v4l2: running in PAL but device in norm %x",
|
||||||
|
current );
|
||||||
|
std_id = V4L2_STD_PAL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if (-1 == ioctl (v->fd, VIDIOC_S_STD, &std_id)) {
|
if (-1 == ioctl (v->fd, VIDIOC_S_STD, &std_id)) {
|
||||||
veejay_msg(VEEJAY_MSG_WARNING, "v4l2: unable to set video standard.");
|
veejay_msg(VEEJAY_MSG_WARNING, "v4l2: unable to set video standard: %s", strerror(errno));
|
||||||
return 1;//@ show must go on
|
return 1;//@ show must go on
|
||||||
} else {
|
} else {
|
||||||
veejay_msg(VEEJAY_MSG_INFO,"v4l2: set video standard PAL");
|
veejay_msg(VEEJAY_MSG_INFO,"v4l2: set video standard %s", v4l2_get_std(std_id));
|
||||||
}
|
}
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
@@ -354,6 +423,8 @@ static void v4l2_enum_frame_sizes( v4l2info *v )
|
|||||||
//@clear mem
|
//@clear mem
|
||||||
memset( &fmtdesc, 0, sizeof( fmtdesc ));
|
memset( &fmtdesc, 0, sizeof( fmtdesc ));
|
||||||
|
|
||||||
|
int loop_limit = 64;
|
||||||
|
|
||||||
for( fmtdesc.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
|
for( fmtdesc.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
|
||||||
fmtdesc.type < V4L2_BUF_TYPE_VIDEO_OVERLAY;
|
fmtdesc.type < V4L2_BUF_TYPE_VIDEO_OVERLAY;
|
||||||
fmtdesc.type ++ ) {
|
fmtdesc.type ++ ) {
|
||||||
@@ -389,6 +460,10 @@ static void v4l2_enum_frame_sizes( v4l2info *v )
|
|||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
fmtdesc.index ++;
|
fmtdesc.index ++;
|
||||||
|
|
||||||
|
loop_limit --; //@ endless loop in enumerating video formats
|
||||||
|
if( loop_limit == 0 )
|
||||||
|
return; //@ give up
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -405,7 +480,7 @@ static int v4l2_try_pix_format( v4l2info *v, int pixelformat, int wid, int hei,
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
veejay_msg(VEEJAY_MSG_DEBUG, "v4l2: Current configuration is in %s (%dx%d)",
|
veejay_msg(VEEJAY_MSG_DEBUG, "v4l2: Current configuration is in %s (%dx%d), trying more formats ...",
|
||||||
(char*) &v->format.fmt.pix.pixelformat,
|
(char*) &v->format.fmt.pix.pixelformat,
|
||||||
v->format.fmt.pix.width,
|
v->format.fmt.pix.width,
|
||||||
v->format.fmt.pix.height );
|
v->format.fmt.pix.height );
|
||||||
|
|||||||
Reference in New Issue
Block a user