librified

git-svn-id: svn://code.dyne.org/veejay/trunk@162 eb8d1916-c9e9-0310-b8de-cf0c9472ead5
This commit is contained in:
Niels Elburg
2005-01-31 15:36:31 +00:00
parent 3e15fbc3ab
commit 1115507122
44 changed files with 3150 additions and 320 deletions

View File

@@ -17,6 +17,7 @@
+ revisited OSC implementation ( use veejay -u -n |less ) + revisited OSC implementation ( use veejay -u -n |less )
+ updated documentation (Howto, MAN pages, etc) + updated documentation (Howto, MAN pages, etc)
+ removed obsolete VIMS messages + removed obsolete VIMS messages
+ librified editlist,stream and yuv functions
+ removed any references on dropped vloopback support + removed any references on dropped vloopback support
0.7.1 0.7.1

View File

@@ -1,6 +1,6 @@
# Process with automake to produce Makefile.in # Process with automake to produce Makefile.in
SUBDIRS = ffmpeg utils bio2jack libOSC libvjmsg libvjmem libvje libsample libvjnet plugins veejay tools man SUBDIRS = ffmpeg utils bio2jack libOSC libvjmsg libvjmem libvje libsample libvjnet libyuv libel libstream plugins veejay tools man
#bin_SCRIPTS = veejay-config #bin_SCRIPTS = veejay-config

View File

@@ -21739,7 +21739,7 @@ subdirs="$subdirs ffmpeg/ffmpeg"
ac_config_files="$ac_config_files Makefile ffmpeg/Makefile libOSC/Makefile libvjmsg/Makefile libvjmem/Makefile libvje/Makefile libsample/Makefile libvjnet/Makefile utils/Makefile bio2jack/Makefile plugins/Makefile veejay/Makefile man/Makefile tools/Makefile veejay-config veejay.pc" ac_config_files="$ac_config_files Makefile ffmpeg/Makefile libOSC/Makefile libvjmsg/Makefile libvjmem/Makefile libvje/Makefile libsample/Makefile libvjnet/Makefile libyuv/Makefile libel/Makefile libstream/Makefile utils/Makefile bio2jack/Makefile plugins/Makefile veejay/Makefile man/Makefile tools/Makefile veejay-config veejay.pc"
cat >confcache <<\_ACEOF cat >confcache <<\_ACEOF
# This file is a shell script that caches the results of configure # This file is a shell script that caches the results of configure
@@ -22479,6 +22479,9 @@ do
"libvje/Makefile" ) CONFIG_FILES="$CONFIG_FILES libvje/Makefile" ;; "libvje/Makefile" ) CONFIG_FILES="$CONFIG_FILES libvje/Makefile" ;;
"libsample/Makefile" ) CONFIG_FILES="$CONFIG_FILES libsample/Makefile" ;; "libsample/Makefile" ) CONFIG_FILES="$CONFIG_FILES libsample/Makefile" ;;
"libvjnet/Makefile" ) CONFIG_FILES="$CONFIG_FILES libvjnet/Makefile" ;; "libvjnet/Makefile" ) CONFIG_FILES="$CONFIG_FILES libvjnet/Makefile" ;;
"libyuv/Makefile" ) CONFIG_FILES="$CONFIG_FILES libyuv/Makefile" ;;
"libel/Makefile" ) CONFIG_FILES="$CONFIG_FILES libel/Makefile" ;;
"libstream/Makefile" ) CONFIG_FILES="$CONFIG_FILES libstream/Makefile" ;;
"utils/Makefile" ) CONFIG_FILES="$CONFIG_FILES utils/Makefile" ;; "utils/Makefile" ) CONFIG_FILES="$CONFIG_FILES utils/Makefile" ;;
"bio2jack/Makefile" ) CONFIG_FILES="$CONFIG_FILES bio2jack/Makefile" ;; "bio2jack/Makefile" ) CONFIG_FILES="$CONFIG_FILES bio2jack/Makefile" ;;
"plugins/Makefile" ) CONFIG_FILES="$CONFIG_FILES plugins/Makefile" ;; "plugins/Makefile" ) CONFIG_FILES="$CONFIG_FILES plugins/Makefile" ;;

View File

@@ -946,6 +946,9 @@ libvjmem/Makefile
libvje/Makefile libvje/Makefile
libsample/Makefile libsample/Makefile
libvjnet/Makefile libvjnet/Makefile
libyuv/Makefile
libel/Makefile
libstream/Makefile
utils/Makefile utils/Makefile
bio2jack/Makefile bio2jack/Makefile
plugins/Makefile plugins/Makefile

View File

@@ -0,0 +1,25 @@
# Makefile for veejay
MAINTAINERCLEANFILES = Makefile.in
INCLUDES = -I$(top_srcdir) -I$(includedir) -I$(top_srcdir)/vjmem \
-I$(top_srcdir)/vjmsg \
-I$(top_srcdir)/ffmpeg/ffmpeg/libavcodec \
-I$(top_srcdir)/ffmpeg/ffmpeg/libavformat \
-I$(top_srcdir)/utils
VJEL_LIB_OPTS = -export-dynamic
VJEL_LIB_FILE = libel.la
noinst_LTLIBRARIES = $(VJEL_LIB_FILE)
libel_la_SOURCES = avilib.c lav_io.c vj-dv.c vj-avcodec.c vj-avformat.c vj-el.c
libel_la_LDFLAGS = $(VJEL_LIB_OPTS) \
-L$(top_builddir)/ffmpeg/ffmpeg/libavcodec -lavcodec \
-L$(top_builddir)/ffmpeg/ffmpeg/libavformat -lavformat \
-L$(top_builddir)/libvjmem -lvjmem \
-L$(top_builddir)/libvjmsg -lvjmsg \
-DDYNAMIC -O3 -Wall

View File

@@ -17,7 +17,7 @@
#ifndef AVILIB_H #ifndef AVILIB_H
#define AVILIB_H #define AVILIB_H
#include <mjpeg_types.h> #include <utils/mjpeg_types.h>
typedef struct typedef struct
{ {

View File

@@ -28,8 +28,8 @@
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h> #include <stdio.h>
#include <fcntl.h> #include <fcntl.h>
#include <veejay/lav_io.h> #include <libel/lav_io.h>
#include <veejay/vj-lib.h> //#include <veejay/vj-lib.h>
#include <libvjmsg/vj-common.h> #include <libvjmsg/vj-common.h>
extern int AVI_errno; extern int AVI_errno;

View File

@@ -23,12 +23,12 @@
#include <mlt/framework/mlt.h> #include <mlt/framework/mlt.h>
#endif #endif
#include <avilib.h> #include <libel/avilib.h>
// play with mlt here, avformat producer/several consumers (we can write to) // play with mlt here, avformat producer/several consumers (we can write to)
// for normalized output (720x576/480) , dv1394 capture and playback // for normalized output (720x576/480) , dv1394 capture and playback
#include "yuv4mpeg.h" #include <utils/yuv4mpeg.h>
#define LAV_INTER_UNKNOWN Y4M_UNKNOWN #define LAV_INTER_UNKNOWN Y4M_UNKNOWN
#define LAV_NOT_INTERLACED Y4M_ILACE_NONE #define LAV_NOT_INTERLACED Y4M_ILACE_NONE

View File

@@ -17,18 +17,16 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ */
#include <config.h> #include <config.h>
#include <veejay/vj-misc.h> #include <libel/vj-avcodec.h>
#include <veejay/vj-avcodec.h> #include <libel/vj-el.h>
#include <veejay/vj-el.h>
#include <veejay/vj-lib.h>
#include <libvjmsg/vj-common.h> #include <libvjmsg/vj-common.h>
#include <libvjmem/vjmem.h> #include <libvjmem/vjmem.h>
#include <string.h> #include <string.h>
#include <libyuv/yuvconv.h>
#define __FALLBACK_LIBDV 1 #define __FALLBACK_LIBDV 1
#ifdef __FALLBACK_LIBDV #ifdef __FALLBACK_LIBDV
#include <veejay/vj-dv.h> #include <libel/vj-dv.h>
#endif #endif
static int out_pixel_format = FMT_420; static int out_pixel_format = FMT_420;
@@ -198,153 +196,6 @@ int vj_avcodec_free()
return 1; return 1;
} }
/* this routine is the same as frame_YUV422_to_YUV420P , unpack
* libdv's 4:2:2-packed into 4:2:0 planar
* See http://mjpeg.sourceforge.net/ (MJPEG Tools) (lav-common.c)
*/
void yuy2toyv12(uint8_t * _y, uint8_t * _u, uint8_t * _v, uint8_t * input,
int width, int height)
{
int i, j, w2;
uint8_t *y, *u, *v;
w2 = width / 2;
//I420
y = _y;
v = _v;
u = _u;
for (i = 0; i < height; i += 4) {
/* top field scanline */
for (j = 0; j < w2; j++) {
/* packed YUV 422 is: Y[i] U[i] Y[i+1] V[i] */
*(y++) = *(input++);
*(u++) = *(input++);
*(y++) = *(input++);
*(v++) = *(input++);
}
for (j = 0; j < w2; j++)
{
*(y++) = *(input++);
*(u++) = *(input++);
*(y++) = *(input++);
*(v++) = *(input++);
}
/* next two scanlines, one frome each field , interleaved */
for (j = 0; j < w2; j++) {
/* skip every second line for U and V */
*(y++) = *(input++);
input++;
*(y++) = *(input++);
input++;
}
/* bottom field scanline*/
for (j = 0; j < w2; j++) {
/* skip every second line for U and V */
*(y++) = *(input++);
input++;
*(y++) = *(input++);
input++;
}
}
}
/* convert 4:2:0 to yuv 4:2:2 packed */
void yuv422p_to_yuv422(uint8_t * yuv420[3], uint8_t * dest, int width,
int height)
{
unsigned int x, y;
for (y = 0; y < height; ++y) {
uint8_t *Y = yuv420[0] + y * width;
uint8_t *Cb = yuv420[1] + (y / 2) * (width);
uint8_t *Cr = yuv420[2] + (y / 2) * (width);
for (x = 0; x < width; x +=2) {
*(dest + 0) = Y[0];
*(dest + 1) = Cb[0];
*(dest + 2) = Y[1];
*(dest + 3) = Cr[0];
dest += 4;
Y += 2;
++Cb;
++Cr;
}
}
}
/* convert 4:2:0 to yuv 4:2:2 */
void yuv420p_to_yuv422(uint8_t * yuv420[3], uint8_t * dest, int width,
int height)
{
unsigned int x, y;
for (y = 0; y < height; ++y) {
uint8_t *Y = yuv420[0] + y * width;
uint8_t *Cb = yuv420[1] + (y >> 1) * (width >> 1);
uint8_t *Cr = yuv420[2] + (y >> 1) * (width >> 1);
for (x = 0; x < width; x += 2) {
*(dest + 0) = Y[0];
*(dest + 1) = Cb[0];
*(dest + 2) = Y[1];
*(dest + 3) = Cr[0];
dest += 4;
Y += 2;
++Cb;
++Cr;
}
}
}
/* convert yuv422 planar to YUYV */
void yuv422_to_yuyv(uint8_t *yuv422[3], uint8_t *pixels, int w, int h)
{
int x,y;
uint8_t *Y = yuv422[0];
uint8_t *U = yuv422[1];
uint8_t *V = yuv422[2]; // U Y V Y
for(y = 0; y < h; y ++ )
{
Y = yuv422[0] + y * w;
U = yuv422[1] + (y>>1) * w;
V = yuv422[2] + (y>>1) * w;
/* for(x=0; x < w; x+= 2)
{
*(pixels + 0) = Y[0];
*(pixels + 1) = U[0];
*(pixels + 2) = Y[1];
*(pixels + 3) = V[0];
pixels += 4;
Y+=2;
++U;
++V;
}
*/
for( x = 0 ; x < w ; x += 4 )
{
*(pixels + 0) = Y[0];
*(pixels + 1) = U[0];
*(pixels + 2) = Y[1];
*(pixels + 3) = V[0];
*(pixels + 4) = Y[2];
*(pixels + 5) = U[1];
*(pixels + 6) = Y[3];
*(pixels + 7) = V[1];
pixels += 8;
Y+=4;
U+=2;
V+=2;
}
}
}
void yuv422p_to_yuv420p2( uint8_t *src[3], uint8_t *dst[3], int w, int h) void yuv422p_to_yuv420p2( uint8_t *src[3], uint8_t *dst[3], int w, int h)
{ {
int len = w* h ; int len = w* h ;

View File

@@ -55,26 +55,12 @@ int vj_avcodec_free();
*/ */
// from yuv 4:2:2 packed to yuv 4:2:0 planar
void yuy2toyv12(uint8_t * _y, uint8_t * _u, uint8_t * _v, uint8_t * input, int w, int h);
// from yuv 4:2:2 planar to yuv 4:2:2 packed
void yuv422p_to_yuv422(uint8_t * yuv420[3], uint8_t * dest, int w, int h);
// from yuv 4:2:0 planar to yuv 4:2:2 packed
void yuv420p_to_yuv422(uint8_t * yuv420[3], uint8_t * dest, int w, int h );
// from yuv 4:2:2 planar to yuv 4:2:0 planar
int yuv422p_to_yuv420p( uint8_t *src[3], uint8_t *dst, int w, int h);
// from yuv 4:2:0 planar to yuv 4:2:2 planar // from yuv 4:2:0 planar to yuv 4:2:2 planar
int yuv420p_to_yuv422p( uint8_t *Y, uint8_t *Cb, uint8_t *Cr, uint8_t *dst[3], int w, int h ); int yuv420p_to_yuv422p( uint8_t *Y, uint8_t *Cb, uint8_t *Cr, uint8_t *dst[3], int w, int h );
void yuv422p_to_yuv420p2( uint8_t *src[3], uint8_t *dst[3], int w, int h ); void yuv422p_to_yuv420p2( uint8_t *src[3], uint8_t *dst[3], int w, int h );
// from yuv 4:2:0 planar to YUYV
void yuv422_to_yuyv( uint8_t *yuv422[3], uint8_t *pixels, int w, int h );
int yuv420p_to_yuv422p2( uint8_t *sY,uint8_t *sCb, uint8_t *sCr, uint8_t *dst[3], int w, int h ); int yuv420p_to_yuv422p2( uint8_t *sY,uint8_t *sCb, uint8_t *sCr, uint8_t *dst[3], int w, int h );

View File

@@ -17,10 +17,11 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ */
#include <config.h> #include <config.h>
#include <veejay/vj-avformat.h> #include <stdint.h>
#include <veejay/vj-misc.h> #include <libel/vj-avformat.h>
#include <libvjmsg/vj-common.h> #include <libvjmsg/vj-common.h>
#include <string.h> #include <string.h>
#include <libel/vj-el.h>
#if LIBAVFORMAT_BUILD >= 4620 #if LIBAVFORMAT_BUILD >= 4620
#define m_av_seek_frame( a,b,c,d ) \ #define m_av_seek_frame( a,b,c,d ) \
( av_seek_frame( a,b,c,d ) ) ( av_seek_frame( a,b,c,d ) )

View File

@@ -18,8 +18,10 @@
*/ */
#ifndef VJ_AV_FORMAT_H #ifndef VJ_AV_FORMAT_H
#define VJ_AV_FORMAT_H #define VJ_AV_FORMAT_H
#include "avcodec.h" #include <libyuv/yuvconv.h>
#include "avformat.h" #include <ffmpeg/ffmpeg/libavcodec/avcodec.h>
#include <ffmpeg/ffmpeg/libavformat/avformat.h>
typedef struct vj_avformat_t typedef struct vj_avformat_t
{ {

View File

@@ -21,8 +21,8 @@
#ifdef SUPPORT_READ_DV2 #ifdef SUPPORT_READ_DV2
#include <libdv/dv.h> #include <libdv/dv.h>
#include <stdint.h> #include <stdint.h>
#include <veejay/vj-dv.h> #include <libel/vj-dv.h>
#include <veejay/vj-avcodec.h> #include <libel/vj-avcodec.h>
#include <string.h> #include <string.h>
#define NTSC_W 720 #define NTSC_W 720
@@ -72,33 +72,6 @@ void vj_dv_init_encoder(editlist * el, int pixel_format)
isPAL ? DV_PAL_SIZE : DV_NTSC_SIZE))); isPAL ? DV_PAL_SIZE : DV_NTSC_SIZE)));
} }
/* convert 4:2:0 to yuv 4:2:2
static void convert_yuv420p_to_yuv422(uint8_t * yuv_in[3],
uint8_t * yuv422, int width,
int height)
{
unsigned int x, y;
unsigned int i = 0;
for (y = 0; y < height; ++y) {
uint8_t *Y = yuv_in[0] + y * width;
uint8_t *Cb = yuv_in[1] + (y / 2) * (width / 2);
uint8_t *Cr = yuv_in[2] + (y / 2) * (width / 2);
for (x = 0; x < width; x += 2) {
*(yuv422 + i) = Y[0];
*(yuv422 + i + 1) = Cb[0];
*(yuv422 + i + 2) = Y[1];
*(yuv422 + i + 3) = Cr[0];
i += 4;
Y += 2;
++Cb;
++Cr;
}
}
}
*/
/* encode frame to dv format, dv frame will be in output_buf */ /* encode frame to dv format, dv frame will be in output_buf */
int vj_dv_encode_frame(uint8_t * input_buf[3], uint8_t * output_buf) int vj_dv_encode_frame(uint8_t * input_buf[3], uint8_t * output_buf)
{ {

1302
veejay-current/libel/vj-el.c Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,100 @@
/* veejay - Linux VeeJay
* (C) 2002-2004 Niels Elburg <nelburg@looze.net>
*
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef VJ_MLT_EL_H
#define VJ_MLT_EL_H
#include <config.h>
#include <veejay/vj-global.h>
#include <libel/vj-avformat.h>
#include <libel/lav_io.h>
#include <libvje/vje.h>
#define N_EL_FRAME(x) ( (x)&0xfffffffffffffLLU )
#define N_EL_FILE(x) (int) ( ((x)>>52)&0xfff )
/* ((file)&0xfff<<52) */
#define EL_ENTRY(file,frame) ( ((file)<<52) | ((frame)& 0xfffffffffffffLLU) )
//#define FMT_420 0
//#define FMT_422 1
//#define MAX_EDITLIST_FILES 4096
typedef struct
{
int has_video;
int video_width;
int video_height;
int video_inter;
float video_fps;
int video_sar_width;
int video_sar_height;
char video_norm;
int has_audio;
long audio_rate;
int audio_chans;
int audio_bits;
int audio_bps;
int play_rate;
long video_frames;
long num_video_files;
long max_frame_size;
int MJPG_chroma;
char *(video_file_list[MAX_EDIT_LIST_FILES]);
lav_file_t *(lav_fd[MAX_EDIT_LIST_FILES]);
long num_frames[MAX_EDIT_LIST_FILES];
uint64_t *frame_list;
int last_afile;
long last_apos;
int auto_deinter;
int pixel_format;
} editlist;
editlist *vj_el_init_with_args(char **filenames, int n, int flags, int deinter, int force);
editlist *vj_el_probe_from_file( char *filename );
void vj_el_free(editlist *el);
int vj_el_get_audio_frame_at(editlist *el, uint32_t nframe, uint8_t *dst, int speed );
int vj_el_append_video_file(editlist *el, char *filename);
int vj_el_write_editlist( char *filename, long start, long end, editlist *el );
int vj_el_get_video_frame(editlist *el, long nframe, uint8_t *dst[3], int pix_fmt);
int vj_el_get_audio_frame(editlist *el, uint32_t nframe, uint8_t *dst);
void vj_el_print(editlist *el);
int vj_el_init_420_frame(editlist *el, VJFrame *frame);
int vj_el_init_422_frame(editlist *el, VJFrame *frame);
editlist *vj_el_dummy(int flags, int deinterlace, int chroma, char norm, int width, int height, float fps);
#endif

View File

@@ -0,0 +1,28 @@
# Makefile for veejay
MAINTAINERCLEANFILES = Makefile.in
INCLUDES = -I$(top_srcdir) -I$(includedir) -I$(top_srcdir)/vjmem \
-I$(top_srcdir)/vjmsg \
-I$(top_srcdir)/ffmpeg/ffmpeg/libavcodec \
-I$(top_srcdir)/ffmpeg/ffmpeg/libavformat \
-I$(top_srcdir)/libvjnet/ \
-I$(top_srcdir)/utils \
${XML_CFLAGS} ${XML_CPPFLAGS}
STREAM_LIB_OPTS = -export-dynamic
STREAM_LIB_FILE = libstream.la
noinst_LTLIBRARIES = $(STREAM_LIB_FILE)
libstream_la_SOURCES = hash.c v4lutils.c vj-v4lvideo.c vj-yuv4mpeg.c vj-shm.c vj-tag.c
libstream_la_LDFLAGS = $(STREAM_LIB_OPTS) \
-L$(top_builddir)/ffmpeg/ffmpeg/libavcodec -lavcodec \
-L$(top_builddir)/ffmpeg/ffmpeg/libavformat -lavformat \
-L$(top_builddir)/libvjmem -lvjmem \
-L$(top_builddir)/libvjmsg -lvjmsg \
-L$(top_builddir)/libvjnet -lvjnet \
-DDYNAMIC -O3 -Wall

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,240 @@
/*
* Hash Table Data Type
* Copyright (C) 1997 Kaz Kylheku <kaz@ashi.footprints.net>
*
* Free Software License:
*
* All rights are reserved by the author, with the following exceptions:
* Permission is granted to freely reproduce and distribute this software,
* possibly in exchange for a fee, provided that this copyright notice appears
* intact. Permission is also granted to adapt this software to produce
* derivative works, as long as the modified versions carry this copyright
* notice and additional notices stating that the work has been modified.
* This source code may be translated into executable form and incorporated
* into proprietary software; there is no requirement for such software to
* contain a copyright notice related to this source.
*
* $Id: hash.h,v 1.1.1.1 2004/10/27 23:48:59 niels Exp $
* $Name: $
*/
#ifndef HASH_H
#define HASH_H
#include <limits.h>
#ifdef KAZLIB_SIDEEFFECT_DEBUG
#include "sfx.h"
#endif
/*
* Blurb for inclusion into C++ translation units
*/
#ifdef __cplusplus
extern "C" {
#endif
typedef unsigned long hashcount_t;
#define HASHCOUNT_T_MAX ULONG_MAX
typedef unsigned long hash_val_t;
#define HASH_VAL_T_MAX ULONG_MAX
extern int hash_val_t_bit;
#ifndef HASH_VAL_T_BIT
#define HASH_VAL_T_BIT ((int) hash_val_t_bit)
#endif
/*
* Hash chain node structure.
* Notes:
* 1. This preprocessing directive is for debugging purposes. The effect is
* that if the preprocessor symbol KAZLIB_OPAQUE_DEBUG is defined prior to the
* inclusion of this header, then the structure shall be declared as having
* the single member int __OPAQUE__. This way, any attempts by the
* client code to violate the principles of information hiding (by accessing
* the structure directly) can be diagnosed at translation time. However,
* note the resulting compiled unit is not suitable for linking.
* 2. This is a pointer to the next node in the chain. In the last node of a
* chain, this pointer is null.
* 3. The key is a pointer to some user supplied data that contains a unique
* identifier for each hash node in a given table. The interpretation of
* the data is up to the user. When creating or initializing a hash table,
* the user must supply a pointer to a function for comparing two keys,
* and a pointer to a function for hashing a key into a numeric value.
* 4. The value is a user-supplied pointer to void which may refer to
* any data object. It is not interpreted in any way by the hashing
* module.
* 5. The hashed key is stored in each node so that we don't have to rehash
* each key when the table must grow or shrink.
*/
typedef struct hnode_t {
#if defined(HASH_IMPLEMENTATION) || !defined(KAZLIB_OPAQUE_DEBUG) /* 1 */
struct hnode_t *hash_next; /* 2 */
const void *hash_key; /* 3 */
void *hash_data; /* 4 */
hash_val_t hash_hkey; /* 5 */
#else
int hash_dummy;
#endif
} hnode_t;
/*
* The comparison function pointer type. A comparison function takes two keys
* and produces a value of -1 if the left key is less than the right key, a
* value of 0 if the keys are equal, and a value of 1 if the left key is
* greater than the right key.
*/
typedef int (*hash_comp_t)(const void *, const void *);
/*
* The hashing function performs some computation on a key and produces an
* integral value of type hash_val_t based on that key. For best results, the
* function should have a good randomness properties in *all* significant bits
* over the set of keys that are being inserted into a given hash table. In
* particular, the most significant bits of hash_val_t are most significant to
* the hash module. Only as the hash table expands are less significant bits
* examined. Thus a function that has good distribution in its upper bits but
* not lower is preferrable to one that has poor distribution in the upper bits
* but not the lower ones.
*/
typedef hash_val_t (*hash_fun_t)(const void *);
/*
* allocator functions
*/
typedef hnode_t *(*hnode_alloc_t)(void *);
typedef void (*hnode_free_t)(hnode_t *, void *);
/*
* This is the hash table control structure. It keeps track of information
* about a hash table, as well as the hash table itself.
* Notes:
* 1. Pointer to the hash table proper. The table is an array of pointers to
* hash nodes (of type hnode_t). If the table is empty, every element of
* this table is a null pointer. A non-null entry points to the first
* element of a chain of nodes.
* 2. This member keeps track of the size of the hash table---that is, the
* number of chain pointers.
* 3. The count member maintains the number of elements that are presently
* in the hash table.
* 4. The maximum count is the greatest number of nodes that can populate this
* table. If the table contains this many nodes, no more can be inserted,
* and the hash_isfull() function returns true.
* 5. The high mark is a population threshold, measured as a number of nodes,
* which, if exceeded, will trigger a table expansion. Only dynamic hash
* tables are subject to this expansion.
* 6. The low mark is a minimum population threshold, measured as a number of
* nodes. If the table population drops below this value, a table shrinkage
* will occur. Only dynamic tables are subject to this reduction. No table
* will shrink beneath a certain absolute minimum number of nodes.
* 7. This is the a pointer to the hash table's comparison function. The
* function is set once at initialization or creation time.
* 8. Pointer to the table's hashing function, set once at creation or
* initialization time.
* 9. The current hash table mask. If the size of the hash table is 2^N,
* this value has its low N bits set to 1, and the others clear. It is used
* to select bits from the result of the hashing function to compute an
* index into the table.
* 10. A flag which indicates whether the table is to be dynamically resized. It
* is set to 1 in dynamically allocated tables, 0 in tables that are
* statically allocated.
*/
typedef struct hash_t {
#if defined(HASH_IMPLEMENTATION) || !defined(KAZLIB_OPAQUE_DEBUG)
struct hnode_t **hash_table; /* 1 */
hashcount_t hash_nchains; /* 2 */
hashcount_t hash_nodecount; /* 3 */
hashcount_t hash_maxcount; /* 4 */
hashcount_t hash_highmark; /* 5 */
hashcount_t hash_lowmark; /* 6 */
hash_comp_t hash_compare; /* 7 */
hash_fun_t hash_function; /* 8 */
hnode_alloc_t hash_allocnode;
hnode_free_t hash_freenode;
void *hash_context;
hash_val_t hash_mask; /* 9 */
int hash_dynamic; /* 10 */
#else
int hash_dummy;
#endif
} hash_t;
/*
* Hash scanner structure, used for traversals of the data structure.
* Notes:
* 1. Pointer to the hash table that is being traversed.
* 2. Reference to the current chain in the table being traversed (the chain
* that contains the next node that shall be retrieved).
* 3. Pointer to the node that will be retrieved by the subsequent call to
* hash_scan_next().
*/
typedef struct hscan_t {
#if defined(HASH_IMPLEMENTATION) || !defined(KAZLIB_OPAQUE_DEBUG)
hash_t *hash_table; /* 1 */
hash_val_t hash_chain; /* 2 */
hnode_t *hash_next; /* 3 */
#else
int hash_dummy;
#endif
} hscan_t;
extern hash_t *hash_create(hashcount_t, hash_comp_t, hash_fun_t);
extern void hash_set_allocator(hash_t *, hnode_alloc_t, hnode_free_t, void *);
extern void hash_destroy(hash_t *);
extern void hash_free_nodes(hash_t *);
extern void hash_free(hash_t *);
extern hash_t *hash_init(hash_t *, hashcount_t, hash_comp_t,
hash_fun_t, hnode_t **, hashcount_t);
extern void hash_insert(hash_t *, hnode_t *, const void *);
extern hnode_t *hash_lookup(hash_t *, const void *);
extern hnode_t *hash_delete(hash_t *, hnode_t *);
extern int hash_alloc_insert(hash_t *, const void *, void *);
extern void hash_delete_free(hash_t *, hnode_t *);
extern void hnode_put(hnode_t *, void *);
extern void *hnode_get(hnode_t *);
extern const void *hnode_getkey(hnode_t *);
extern hashcount_t hash_count(hash_t *);
extern hashcount_t hash_size(hash_t *);
extern int hash_isfull(hash_t *);
extern int hash_isempty(hash_t *);
extern void hash_scan_begin(hscan_t *, hash_t *);
extern hnode_t *hash_scan_next(hscan_t *);
extern hnode_t *hash_scan_delete(hash_t *, hnode_t *);
extern void hash_scan_delfree(hash_t *, hnode_t *);
extern int hash_verify(hash_t *);
extern hnode_t *hnode_create(void *);
extern hnode_t *hnode_init(hnode_t *, void *);
extern void hnode_destroy(hnode_t *);
#if defined(HASH_IMPLEMENTATION) || !defined(KAZLIB_OPAQUE_DEBUG)
#ifdef KAZLIB_SIDEEFFECT_DEBUG
#define hash_isfull(H) (SFX_CHECK(H)->hash_nodecount == (H)->hash_maxcount)
#else
#define hash_isfull(H) ((H)->hash_nodecount == (H)->hash_maxcount)
#endif
#define hash_isempty(H) ((H)->hash_nodecount == 0)
#define hash_count(H) ((H)->hash_nodecount)
#define hash_size(H) ((H)->hash_nchains)
#define hnode_get(N) ((N)->hash_data)
#define hnode_getkey(N) ((N)->hash_key)
#define hnode_put(N, V) ((N)->hash_data = (V))
#endif
#ifdef __cplusplus
}
#endif
#endif

View File

@@ -36,8 +36,8 @@
#include <pthread.h> #include <pthread.h>
#include <errno.h> #include <errno.h>
#include <libvjmsg/vj-common.h> #include <libvjmsg/vj-common.h>
#include <veejay/vj-lib.h> //#include <veejay/vj-lib.h>
#include <veejay/v4lutils.h> #include <libstream/v4lutils.h>
#ifdef V4L_DEBUG #ifdef V4L_DEBUG
#undef V4L_DEBUG #undef V4L_DEBUG
#endif #endif

View File

@@ -27,7 +27,7 @@
#include <sys/time.h> #include <sys/time.h>
#include <stdint.h> #include <stdint.h>
#include <libvjmsg/vj-common.h> #include <libvjmsg/vj-common.h>
#include <veejay/vj-shm.h> #include <libstream/vj-shm.h>
#include <libvjmem/vjmem.h> #include <libvjmem/vjmem.h>
#include <stdlib.h> #include <stdlib.h>

View File

@@ -25,19 +25,17 @@
*/ */
#include <config.h> #include <config.h>
#include <string.h> #include <string.h>
#include <veejay/vj-tag.h> #include <libstream/vj-tag.h>
#include <veejay/hash.h> #include <libstream/hash.h>
#include <libvje/vje.h> #include <libvje/vje.h>
#ifdef HAVE_V4L #ifdef HAVE_V4L
#include <veejay/vj-v4lvideo.h> #include <libstream/vj-v4lvideo.h>
#include <linux/videodev.h> #include <linux/videodev.h>
#endif #endif
#include <veejay/libveejay.h>
#include <libvjmsg/vj-common.h> #include <libvjmsg/vj-common.h>
#include <veejay/vj-shm.h> #include <libstream/vj-shm.h>
#include <veejay/vj-dv.h> #include <libel/vj-avformat.h>
#include <veejay/vj-avformat.h> #include <libel/vj-avcodec.h>
#include <veejay/vj-avcodec.h>
#include <libvjnet/vj-client.h> #include <libvjnet/vj-client.h>
#include <libvjnet/common.h> #include <libvjnet/common.h>
#include <veejay/vims.h> #include <veejay/vims.h>
@@ -87,8 +85,8 @@ int vj_tag_size()
return this_tag_id; return this_tag_id;
} }
void vj_tag_set_veejay_t(veejay_t *info) { void vj_tag_set_veejay_t(void *info) {
_tag_info = info; _tag_info = (veejay_t*)info;
} }
static inline hash_val_t int_tag_hash(const void *key) static inline hash_val_t int_tag_hash(const void *key)

View File

@@ -39,9 +39,10 @@
#include <config.h> #include <config.h>
#include <libsample/sampleadm.h> #include <libsample/sampleadm.h>
#include <veejay/vj-yuv4mpeg.h> #include <libstream/vj-yuv4mpeg.h>
#include <veejay/vj-v4lvideo.h> #include <libstream/vj-v4lvideo.h>
#include <veejay/vj-lib.h> #include <libvjnet/vj-client.h>
#include <libel/vj-avformat.h>
typedef struct { typedef struct {
v4l_video *v4l[VJ_TAG_MAX_V4L]; v4l_video *v4l[VJ_TAG_MAX_V4L];
@@ -222,7 +223,7 @@ int vj_tag_set_contrast(int t1, int value);
int vj_tag_set_color(int t1, int value); int vj_tag_set_color(int t1, int value);
int vj_tag_set_hue(int t1, int value); int vj_tag_set_hue(int t1, int value);
void vj_tag_set_veejay_t(veejay_t *info); void vj_tag_set_veejay_t(void *info);
int vj_tag_set_manual_fader(int t1, int value ); int vj_tag_set_manual_fader(int t1, int value );

View File

@@ -20,15 +20,14 @@
#ifdef HAVE_V4L #ifdef HAVE_V4L
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <veejay/vj-v4lvideo.h> #include <libstream/vj-v4lvideo.h>
#include <veejay/v4lutils.h> #include <libstream/v4lutils.h>
#include <veejay/vj-global.h> #include <veejay/vj-global.h>
#include <string.h> #include <string.h>
#include <libvjmsg/vj-common.h> #include <libvjmsg/vj-common.h>
#include <veejay/vj-lib.h> #include <veejay/vj-lib.h>
#include <veejay/vj-tag.h> #include <libstream/vj-tag.h>
#include <libvjmem/vjmem.h> #include <libvjmem/vjmem.h>
#include <veejay/vj-v4lvideo.h>
#define VJ_V4L_DEBUG #define VJ_V4L_DEBUG

View File

@@ -23,8 +23,7 @@
#include <sys/stat.h> #include <sys/stat.h>
#include <sys/types.h> #include <sys/types.h>
#include <libvjmsg/vj-common.h> #include <libvjmsg/vj-common.h>
#include <veejay/vj-lib.h> #include <libstream/vj-yuv4mpeg.h>
#include "vj-yuv4mpeg.h"
#include <string.h> #include <string.h>
/* see vj-v4lvideo for details about structure */ /* see vj-v4lvideo for details about structure */

View File

@@ -18,8 +18,9 @@
*/ */
#ifndef VJ_YUV4MPEG_H #ifndef VJ_YUV4MPEG_H
#define VJ_YUV4MPEG_H #define VJ_YUV4MPEG_H
#include <veejay/vj-el.h> #include <libel/vj-el.h>
#include "mpegconsts.h" #include <utils/mpegconsts.h>
typedef struct { typedef struct {
y4m_stream_info_t streaminfo; y4m_stream_info_t streaminfo;
y4m_frame_info_t frameinfo; y4m_frame_info_t frameinfo;

View File

@@ -17,12 +17,3 @@ libvjnet_la_LDFLAGS = $(VJNET_LIB_OPTS) \
-L$(top_builddir)/libvjmem -lvjmem \ -L$(top_builddir)/libvjmem -lvjmem \
-L$(top_builddir)/libvjmsg -lvjmsg \ -L$(top_builddir)/libvjmsg -lvjmsg \
-DDYNAMIC -O3 -Wall -DDYNAMIC -O3 -Wall
SERVER_BIN = dummy
check_PROGRAMS = $(SERVER_BIN)
dummy_SOURCES = dummy.c
dummy_LDADD = libvjnet.la \
$(top_builddir)/libvjmsg/libvjmsg.la \
$(top_builddir)/libvjmem/libvjmem.la

View File

@@ -247,16 +247,6 @@ libvjnet_la_LDFLAGS = $(VJNET_LIB_OPTS) \
-L$(top_builddir)/libvjmsg -lvjmsg \ -L$(top_builddir)/libvjmsg -lvjmsg \
-DDYNAMIC -O3 -Wall -DDYNAMIC -O3 -Wall
SERVER_BIN = dummy
check_PROGRAMS = $(SERVER_BIN)
dummy_SOURCES = dummy.c
dummy_LDADD = libvjnet.la \
$(top_builddir)/libvjmsg/libvjmsg.la \
$(top_builddir)/libvjmem/libvjmem.la
subdir = libvjnet subdir = libvjnet
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
@@ -268,17 +258,11 @@ libvjnet_la_LIBADD =
am_libvjnet_la_OBJECTS = packet.lo mcastsender.lo mcastreceiver.lo \ am_libvjnet_la_OBJECTS = packet.lo mcastsender.lo mcastreceiver.lo \
cmd.lo vj-server.lo vj-client.lo cmd.lo vj-server.lo vj-client.lo
libvjnet_la_OBJECTS = $(am_libvjnet_la_OBJECTS) libvjnet_la_OBJECTS = $(am_libvjnet_la_OBJECTS)
check_PROGRAMS = dummy$(EXEEXT)
am_dummy_OBJECTS = dummy.$(OBJEXT)
dummy_OBJECTS = $(am_dummy_OBJECTS)
dummy_DEPENDENCIES = libvjnet.la $(top_builddir)/libvjmsg/libvjmsg.la \
$(top_builddir)/libvjmem/libvjmem.la
dummy_LDFLAGS =
DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)
depcomp = $(SHELL) $(top_srcdir)/depcomp depcomp = $(SHELL) $(top_srcdir)/depcomp
am__depfiles_maybe = depfiles am__depfiles_maybe = depfiles
@AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/cmd.Plo ./$(DEPDIR)/dummy.Po \ @AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/cmd.Plo \
@AMDEP_TRUE@ ./$(DEPDIR)/mcastreceiver.Plo \ @AMDEP_TRUE@ ./$(DEPDIR)/mcastreceiver.Plo \
@AMDEP_TRUE@ ./$(DEPDIR)/mcastsender.Plo ./$(DEPDIR)/packet.Plo \ @AMDEP_TRUE@ ./$(DEPDIR)/mcastsender.Plo ./$(DEPDIR)/packet.Plo \
@AMDEP_TRUE@ ./$(DEPDIR)/vj-client.Plo ./$(DEPDIR)/vj-server.Plo @AMDEP_TRUE@ ./$(DEPDIR)/vj-client.Plo ./$(DEPDIR)/vj-server.Plo
@@ -289,9 +273,9 @@ LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) \
CCLD = $(CC) CCLD = $(CC)
LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
$(AM_LDFLAGS) $(LDFLAGS) -o $@ $(AM_LDFLAGS) $(LDFLAGS) -o $@
DIST_SOURCES = $(libvjnet_la_SOURCES) $(dummy_SOURCES) DIST_SOURCES = $(libvjnet_la_SOURCES)
DIST_COMMON = $(srcdir)/Makefile.in Makefile.am DIST_COMMON = $(srcdir)/Makefile.in Makefile.am
SOURCES = $(libvjnet_la_SOURCES) $(dummy_SOURCES) SOURCES = $(libvjnet_la_SOURCES)
all: all-am all: all-am
@@ -314,16 +298,6 @@ clean-noinstLTLIBRARIES:
libvjnet.la: $(libvjnet_la_OBJECTS) $(libvjnet_la_DEPENDENCIES) libvjnet.la: $(libvjnet_la_OBJECTS) $(libvjnet_la_DEPENDENCIES)
$(LINK) $(libvjnet_la_LDFLAGS) $(libvjnet_la_OBJECTS) $(libvjnet_la_LIBADD) $(LIBS) $(LINK) $(libvjnet_la_LDFLAGS) $(libvjnet_la_OBJECTS) $(libvjnet_la_LIBADD) $(LIBS)
clean-checkPROGRAMS:
@list='$(check_PROGRAMS)'; for p in $$list; do \
f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
echo " rm -f $$p $$f"; \
rm -f $$p $$f ; \
done
dummy$(EXEEXT): $(dummy_OBJECTS) $(dummy_DEPENDENCIES)
@rm -f dummy$(EXEEXT)
$(LINK) $(dummy_LDFLAGS) $(dummy_OBJECTS) $(dummy_LDADD) $(LIBS)
mostlyclean-compile: mostlyclean-compile:
-rm -f *.$(OBJEXT) core *.core -rm -f *.$(OBJEXT) core *.core
@@ -331,7 +305,6 @@ distclean-compile:
-rm -f *.tab.c -rm -f *.tab.c
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cmd.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cmd.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dummy.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mcastreceiver.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mcastreceiver.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mcastsender.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mcastsender.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/packet.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/packet.Plo@am__quote@
@@ -467,7 +440,6 @@ distdir: $(DISTFILES)
fi; \ fi; \
done done
check-am: all-am check-am: all-am
$(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS)
check: check-am check: check-am
all-am: Makefile $(LTLIBRARIES) all-am: Makefile $(LTLIBRARIES)
@@ -499,8 +471,8 @@ maintainer-clean-generic:
-test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
clean: clean-am clean: clean-am
clean-am: clean-checkPROGRAMS clean-generic clean-libtool \ clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \
clean-noinstLTLIBRARIES mostlyclean-am mostlyclean-am
distclean: distclean-am distclean: distclean-am
-rm -rf ./$(DEPDIR) -rm -rf ./$(DEPDIR)
@@ -548,9 +520,9 @@ ps-am:
uninstall-am: uninstall-info-am uninstall-am: uninstall-info-am
.PHONY: CTAGS GTAGS all all-am check check-am clean clean-checkPROGRAMS \ .PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
clean-generic clean-libtool clean-noinstLTLIBRARIES ctags \ clean-libtool clean-noinstLTLIBRARIES ctags distclean \
distclean distclean-compile distclean-generic distclean-libtool \ distclean-compile distclean-generic distclean-libtool \
distclean-tags distdir dvi dvi-am info info-am install \ distclean-tags distdir dvi dvi-am info info-am install \
install-am install-data install-data-am install-exec \ install-am install-data install-data-am install-exec \
install-exec-am install-info install-info-am install-man \ install-exec-am install-info install-info-am install-man \

View File

@@ -33,17 +33,22 @@ packet_header_t packet_construct_header(uint8_t flag)
gettimeofday(&tv, NULL); gettimeofday(&tv, NULL);
packet_header_t header; packet_header_t header;
header.flag = flag; header.flag = flag;
header.seq_num = 0; // not set header.seq_num = htons(0); // not set
header.sec = tv.tv_sec; header.sec = htonl(tv.tv_sec);
header.usec = tv.tv_usec; header.usec = htonl(tv.tv_usec);
header.timeout = 50000; header.timeout = htonl(40000);
return header; return header;
} }
packet_header_t packet_get_header(const void *data) packet_header_t packet_get_header(const void *data)
{ {
packet_header_t h; packet_header_t h,tmp;
veejay_memcpy( &h, data, sizeof(packet_header_t) ); veejay_memcpy( &tmp, data, sizeof(packet_header_t) );
h.flag = tmp.flag;
h.seq_num = ntohs( tmp.seq_num );
h.sec = ntohl( tmp.sec );
h.usec = ntohl( tmp.usec );
h.timeout = ntohl( tmp.timeout );
return h; return h;
} }
@@ -66,6 +71,7 @@ int packet_put_data(packet_header_t *h, frame_info_t *i , void *payload, const
size_t len = sizeof( packet_header_t ); size_t len = sizeof( packet_header_t );
veejay_memcpy( payload, h , len ); veejay_memcpy( payload, h , len );
if(h->flag) if(h->flag)
{ {
veejay_memcpy( payload + len, i , sizeof( frame_info_t )); veejay_memcpy( payload + len, i , sizeof( frame_info_t ));

View File

@@ -0,0 +1,19 @@
# Makefile for veejay
MAINTAINERCLEANFILES = Makefile.in
INCLUDES = -I$(top_srcdir) -I$(includedir) -I$(top_srcdir)/vjmem -I$(top_srcdir)/vjmsg
YUV_LIB_OPTS = -export-dynamic
YUV_LIB_FILE = libyuv.la
noinst_LTLIBRARIES = $(YUV_LIB_FILE)
libyuv_la_SOURCES = subsample.c yuvconv.c
libyuv_la_LDFLAGS = $(YUV_LIB_OPTS) \
-L$(top_builddir)/libvjmem -lvjmem \
-L$(top_builddir)/libvjmsg -lvjmsg \
-DDYNAMIC -O3 -Wall

View File

@@ -28,11 +28,11 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <assert.h> #include <assert.h>
#include <mjpeg_types.h> #include <utils/mjpeg_types.h>
#include <libvjmem/vjmem.h> #include <libvjmem/vjmem.h>
#include <libvjmsg/vj-common.h> #include <libvjmsg/vj-common.h>
#include <veejay/subsample.h> #include <libyuv/yuvconv.h>
const char *ssm_id[SSM_COUNT] = { const char *ssm_id[SSM_COUNT] = {

View File

@@ -0,0 +1,224 @@
/* veejay - Linux VeeJay
* (C) 2002-2004 Niels Elburg <nelburg@looze.net>
*
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <config.h>
#include <stdint.h>
#include <libyuv/yuvconv.h>
/* this routine is the same as frame_YUV422_to_YUV420P , unpack
* libdv's 4:2:2-packed into 4:2:0 planar
* See http://mjpeg.sourceforge.net/ (MJPEG Tools) (lav-common.c)
*/
void yuy2toyv12(uint8_t * _y, uint8_t * _u, uint8_t * _v, uint8_t * input,
int width, int height)
{
int i, j, w2;
uint8_t *y, *u, *v;
w2 = width / 2;
//I420
y = _y;
v = _v;
u = _u;
for (i = 0; i < height; i += 4) {
/* top field scanline */
for (j = 0; j < w2; j++) {
/* packed YUV 422 is: Y[i] U[i] Y[i+1] V[i] */
*(y++) = *(input++);
*(u++) = *(input++);
*(y++) = *(input++);
*(v++) = *(input++);
}
for (j = 0; j < w2; j++)
{
*(y++) = *(input++);
*(u++) = *(input++);
*(y++) = *(input++);
*(v++) = *(input++);
}
/* next two scanlines, one frome each field , interleaved */
for (j = 0; j < w2; j++) {
/* skip every second line for U and V */
*(y++) = *(input++);
input++;
*(y++) = *(input++);
input++;
}
/* bottom field scanline*/
for (j = 0; j < w2; j++) {
/* skip every second line for U and V */
*(y++) = *(input++);
input++;
*(y++) = *(input++);
input++;
}
}
}
/* convert 4:2:0 to yuv 4:2:2 packed */
void yuv422p_to_yuv422(uint8_t * yuv420[3], uint8_t * dest, int width,
int height)
{
unsigned int x, y;
for (y = 0; y < height; ++y) {
uint8_t *Y = yuv420[0] + y * width;
uint8_t *Cb = yuv420[1] + (y / 2) * (width);
uint8_t *Cr = yuv420[2] + (y / 2) * (width);
for (x = 0; x < width; x +=2) {
*(dest + 0) = Y[0];
*(dest + 1) = Cb[0];
*(dest + 2) = Y[1];
*(dest + 3) = Cr[0];
dest += 4;
Y += 2;
++Cb;
++Cr;
}
}
}
/* convert 4:2:0 to yuv 4:2:2 */
void yuv420p_to_yuv422(uint8_t * yuv420[3], uint8_t * dest, int width,
int height)
{
unsigned int x, y;
for (y = 0; y < height; ++y) {
uint8_t *Y = yuv420[0] + y * width;
uint8_t *Cb = yuv420[1] + (y >> 1) * (width >> 1);
uint8_t *Cr = yuv420[2] + (y >> 1) * (width >> 1);
for (x = 0; x < width; x += 2) {
*(dest + 0) = Y[0];
*(dest + 1) = Cb[0];
*(dest + 2) = Y[1];
*(dest + 3) = Cr[0];
dest += 4;
Y += 2;
++Cb;
++Cr;
}
}
}
/* convert yuv422 planar to YUYV */
void yuv422_to_yuyv(uint8_t *yuv422[3], uint8_t *pixels, int w, int h)
{
int x,y;
uint8_t *Y = yuv422[0];
uint8_t *U = yuv422[1];
uint8_t *V = yuv422[2]; // U Y V Y
for(y = 0; y < h; y ++ )
{
Y = yuv422[0] + y * w;
U = yuv422[1] + (y>>1) * w;
V = yuv422[2] + (y>>1) * w;
/* for(x=0; x < w; x+= 2)
{
*(pixels + 0) = Y[0];
*(pixels + 1) = U[0];
*(pixels + 2) = Y[1];
*(pixels + 3) = V[0];
pixels += 4;
Y+=2;
++U;
++V;
}
*/
for( x = 0 ; x < w ; x += 4 )
{
*(pixels + 0) = Y[0];
*(pixels + 1) = U[0];
*(pixels + 2) = Y[1];
*(pixels + 3) = V[0];
*(pixels + 4) = Y[2];
*(pixels + 5) = U[1];
*(pixels + 6) = Y[3];
*(pixels + 7) = V[1];
pixels += 8;
Y+=4;
U+=2;
V+=2;
}
}
}
/* lav_common - some general utility functionality used by multiple
lavtool utilities. */
/* Copyright (C) 2000, Rainer Johanni, Andrew Stevens */
/* - added scene change detection code 2001, pHilipp Zabel */
/* - broke some code out to lav_common.h and lav_common.c
* July 2001, Shawn Sulma <lavtools@athos.cx>. In doing this,
* I replaced the large number of globals with a handful of structs
* that are passed into the appropriate methods. Check lav_common.h
* for the structs. I'm sure some of what I've done is inefficient,
* subtly incorrect or just plain Wrong. Feedback is welcome.
*/
/***********************
*
* Take a random(ish) clipd mean of a frame luma and chroma
* Its intended as a rough and ready hash of frame content.
* The idea is that changes above a certain threshold are treated as
* scene changes.
*
**********************/
int luminance_mean(uint8_t * frame[], int w, int h)
{
uint8_t *p;
uint8_t *lim;
int sum = 0;
int count = 0;
p = frame[0];
lim = frame[0] + w * (h - 1);
while (p < lim) {
sum += (p[0] + p[1]) + (p[w - 3] + p[w - 2]);
p += 31;
count += 4;
}
w = w / 2;
h = h / 2;
p = frame[1];
lim = frame[1] + w * (h - 1);
while (p < lim) {
sum += (p[0] + p[1]) + (p[w - 3] + p[w - 2]);
p += 31;
count += 4;
}
p = frame[2];
lim = frame[2] + w * (h - 1);
while (p < lim) {
sum += (p[0] + p[1]) + (p[w - 3] + p[w - 2]);
p += 31;
count += 4;
}
return sum / count;
}

View File

@@ -0,0 +1,64 @@
#ifndef YUVCONF_H
#define YUVCONF_H
/*
* subsample.h: Routines to do chroma subsampling. ("Work In Progress")
*
*
* Copyright (C) 2001 Matthew J. Marjanovic <maddog@mir.com>
* 2004 Niels Elburg <nelburg@looze.net>
*
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
*/
typedef enum subsample_mode {
SSM_UNKNOWN = 0,
SSM_420_JPEG_TR = 1,
SSM_420_JPEG_BOX = 2,
SSM_420_MPEG2 = 3,
SSM_422_444 = 4,
SSM_420_422 = 5,
SSM_COUNT = 6,
} subsample_mode_t;
extern const char *ssm_id[SSM_COUNT];
extern const char *ssm_description[SSM_COUNT];
void subsample_init(void);
void chroma_subsample(subsample_mode_t mode, uint8_t * ycbcr[],
int width, int height);
void chroma_supersample(subsample_mode_t mode, uint8_t * ycbcr[],
int width, int height);
// yuv 4:2:2 packed to yuv 4:2:0 planar
void yuy2toyv12( uint8_t *y, uint8_t *u, uint8_t *v, uint8_t *in, int w, int h);
// yuv 4:2:2 planar to yuv 4:2:2 packed
void yuv422p_to_yuv422( uint8_t *yuv422[3], uint8_t *dst, int w, int h );
// yuv 4:2:2 planar to yuv 4:2:0 planar
void yuv420p_to_yuv422( uint8_t *yuv420[3], uint8_t *dst, int w, int h );
// yuv 4:2:2 planar to YUYV
void yuv422_to_yuyv( uint8_t *yuv422[3], uint8_t *dst, int w, int h );
// scene detection
int luminance_mean(uint8_t * frame[], int w, int h);
#endif

View File

@@ -2,14 +2,18 @@
MAINTAINERCLEANFILES = Makefile.in MAINTAINERCLEANFILES = Makefile.in
INCLUDES = -I$(top_srcdir)/ffmpeg/ffmpeg/libavcodec -I$(top_srcdir)/ffmpeg/ffmpeg/libavformat \ INCLUDES = -I$(top_srcdir) -I$(includedir) \
-I$(top_srcdir) -I$(includedir) \
-DG_LOG_DOMAIN=\"veejay\" -DVEEJAY_VERSION=\"$(VERSION)\" \ -DG_LOG_DOMAIN=\"veejay\" -DVEEJAY_VERSION=\"$(VERSION)\" \
-I /usr/X11R6/include -I$(top_srcdir)/libOSC -I$(top_srcdir)/utils \ -I /usr/X11R6/include -I$(top_srcdir)/libOSC -I$(top_srcdir)/utils \
-I$(top_srcdir)/libvje \ -I$(top_srcdir)/libvje \
-I$(top_srcdir)/libvjmem \ -I$(top_srcdir)/libvjmem \
-I$(top_srcdir)/libvjmsg \ -I$(top_srcdir)/libvjmsg \
-I$(top_srcdir)/libvjnet \ -I$(top_srcdir)/libvjnet \
-I$(top_srcdir)/libel \
-I$(top_srcdir)/libstream \
-I$(top_scrdir)/libyuv \
-I$(top_srcdir)/ffmpeg/ffmpeg/libavcodec \
-I$(top_srcdir)/ffmpeg/ffmpeg/libavformat \
$(AVIPLAY_CFLAGS) ${XML_CFLAGS} ${GTK_CFLAGS} ${DV_FLAGS} ${X_CFLAGS} ${XML_CPPFLAGS} \ $(AVIPLAY_CFLAGS) ${XML_CFLAGS} ${GTK_CFLAGS} ${DV_FLAGS} ${X_CFLAGS} ${XML_CPPFLAGS} \
$(DIRECTFB_CFLAGS) ${SDL_CFLAGS} ${JPEG_CFLAGS} ${PTHREAD_CFLAGS} ${SAMPLERATE_CFLAGS} $(DIRECTFB_CFLAGS) ${SDL_CFLAGS} ${JPEG_CFLAGS} ${PTHREAD_CFLAGS} ${SAMPLERATE_CFLAGS}
@@ -29,16 +33,15 @@ VEEJAY_ALL_LIB_OPTS = \
liblavjpeg_la_SOURCES = jpegutils.c liblavjpeg_la_SOURCES = jpegutils.c
liblavjpeg_la_LDFLAGS = $(VEEJAY_ALL_LIB_OPTS) $(JPEG_LIBS) liblavjpeg_la_LDFLAGS = $(VEEJAY_ALL_LIB_OPTS) $(JPEG_LIBS)
libveejay_la_SOURCES = vj-misc.c subsample.c hash.c avilib.c vj-shm.c lav_io.c \ libveejay_la_SOURCES = vj-misc.c hash.c \
v4lutils.c vj-plugin.c vj-osc.c vj-event.c vj-pjack.c vj-perform.c \ vj-plugin.c vj-osc.c vj-event.c vj-pjack.c vj-perform.c \
vj-sdl.c vj-dfb.c samplerecord.c \ vj-sdl.c vj-dfb.c samplerecord.c \
vj-yuv4mpeg.c vj-v4lvideo.c vj-dv.c vj-avcodec.c vj-tag.c vj-avformat.c vj-el.c \
liblavplayvj.c liblavplayvj.c
libveejay_la_LDFLAGS = $(VEEJAY_ALL_LIB_OPTS) \ libveejay_la_LDFLAGS = $(VEEJAY_ALL_LIB_OPTS) \
-L$(top_builddir)/ffmpeg/ffmpeg/libavcodec/ -lavcodec \ -L$(top_builddir)/ffmpeg/ffmpeg/libavcodec -lavcodec \
-L$(top_builddir)/ffmpeg/ffmpeg/libavformat/ -lavformat \ -L$(top_builddir)/ffmpeg/ffmpeg/libavformat -lavformat \
-L$(top_builddir)/libOSC / -lOSC \ -L$(top_builddir)/libOSC / -lOSC \
-L$(top_builddir)/utils/ -lmjpegutils \ -L$(top_builddir)/utils/ -lmjpegutils \
-L$(top_builddir)/bio2jack/ -lbio2jack \ -L$(top_builddir)/bio2jack/ -lbio2jack \
@@ -47,8 +50,12 @@ libveejay_la_LDFLAGS = $(VEEJAY_ALL_LIB_OPTS) \
-L$(top_builddir)/libvje -lvje \ -L$(top_builddir)/libvje -lvje \
-L$(top_builddir)/libsample -lsample \ -L$(top_builddir)/libsample -lsample \
-L$(top_builddir)/libvjnet -lvjnet \ -L$(top_builddir)/libvjnet -lvjnet \
-L$(top_builddir)/libel -lel \
-L$(top_builddir)/libstream -lstream \
-L$(top_builddir)/libyuv -lyuv \
-L$(top_builddir)/veejay/ -llavjpeg \
${SDL_LIBS} ${DIRECTFB_LIBS} ${PTHREAD_LIBS} ${X_LIBS} \ ${SDL_LIBS} ${DIRECTFB_LIBS} ${PTHREAD_LIBS} ${X_LIBS} \
${XML_LIBS} ${JPEG_LIBS} \ ${XML_LIBS} ${JPEG_LIBS} ${JACK_LIBS} \
${DV_LIBS} ${SAMPLERATE_LIBS} \ ${DV_LIBS} ${SAMPLERATE_LIBS} \
-DDYNAMIC -O3 -Wall -rdynamic -DDYNAMIC -O3 -Wall -rdynamic
@@ -58,7 +65,7 @@ VEEJAY_BIN = veejay
bin_PROGRAMS = $(VEEJAY_BIN) bin_PROGRAMS = $(VEEJAY_BIN)
veejay_headers = vj-lib.h vj-event.h libveejay.h vj-misc.h veejay_headers = vims.h
veejay_SOURCES = veejay.c ${veejay_headers} veejay_SOURCES = veejay.c ${veejay_headers}
veejay_LDADD = libveejay.la liblavjpeg.la @LIBGETOPT_LIB@ @JACK_LIBS@ veejay_LDADD = libveejay.la @LIBGETOPT_LIB@ -L$(top_builddir)/libvjnet -lvjnet -L$(top_builddir)/ffmpeg/ffmpeg/libavcodec -lavcodec

View File

@@ -62,7 +62,7 @@
#include <linux/rtc.h> #include <linux/rtc.h>
#include "jpegutils.h" #include "jpegutils.h"
#include "vj-event.h" #include "vj-event.h"
#include "vj-shm.h" #include <libstream/vj-shm.h>
#ifndef X_DISPLAY_MISSING #ifndef X_DISPLAY_MISSING
#include <X11/Xlib.h> #include <X11/Xlib.h>
#include <X11/Xutil.h> #include <X11/Xutil.h>
@@ -85,8 +85,8 @@
#include <veejay/vj-plugin.h> #include <veejay/vj-plugin.h>
#include <veejay/vj-plug.h> #include <veejay/vj-plug.h>
#include <veejay/vj-lib.h> #include <veejay/vj-lib.h>
#include <veejay/vj-avcodec.h> #include <libel/vj-avcodec.h>
#include <libyuv/yuvconv.h>
// following struct copied from ../utils/videodev.h // following struct copied from ../utils/videodev.h
/* This is identical with the mgavideo internal params struct, /* This is identical with the mgavideo internal params struct,
@@ -178,9 +178,9 @@ struct mjpeg_params
#include <mpegconsts.h> #include <mpegconsts.h>
#include <mpegtimecode.h> #include <mpegtimecode.h>
//#include "vj-common.h" //#include "vj-common.h"
#include "vj-tag.h" #include <libstream/vj-tag.h>
#include "libveejay.h" #include "libveejay.h"
#include "mjpeg_types.h" #include <utils/mjpeg_types.h>
#include "vj-perform.h" #include "vj-perform.h"
#include <libvjnet/vj-server.h> #include <libvjnet/vj-server.h>
#include "mjpeg_types.h" #include "mjpeg_types.h"
@@ -188,7 +188,7 @@ struct mjpeg_params
#ifdef HAVE_DIRECTFB #ifdef HAVE_DIRECTFB
#include "vj-dfb.h" #include "vj-dfb.h"
#endif #endif
#include "subsample.h"
/* TODO: set_clip and clip_action clean up; important items need more updates */ /* TODO: set_clip and clip_action clean up; important items need more updates */
/* On some systems MAP_FAILED seems to be missing */ /* On some systems MAP_FAILED seems to be missing */
@@ -199,7 +199,7 @@ struct mjpeg_params
#define HZ 100 #define HZ 100
#include <veejay/vj-el.h> #include <libel/vj-el.h>
#define VALUE_NOT_FILLED -10000 #define VALUE_NOT_FILLED -10000
static float time_frame = 0; static float time_frame = 0;

View File

@@ -20,7 +20,7 @@
#include <string.h> #include <string.h>
#include <libsample/sampleadm.h> #include <libsample/sampleadm.h>
#include <veejay/vj-misc.h> #include <veejay/vj-misc.h>
#include <veejay/vj-avcodec.h> #include <libel/vj-avcodec.h>
#include <libvjmsg/vj-common.h> #include <libvjmsg/vj-common.h>
#include <veejay/vj-lib.h> #include <veejay/vj-lib.h>
#include <veejay/samplerecord.h> #include <veejay/samplerecord.h>

View File

@@ -33,13 +33,13 @@
#include <veejay/vj-perform.h> #include <veejay/vj-perform.h>
#include <veejay/hash.h> #include <veejay/hash.h>
#include <veejay/libveejay.h> #include <veejay/libveejay.h>
#include <veejay/vj-avcodec.h> #include <libel/vj-avcodec.h>
#include <veejay/samplerecord.h> #include <veejay/samplerecord.h>
#include <mpegconsts.h> #include <utils/mpegconsts.h>
#include <mpegtimecode.h> #include <utils/mpegtimecode.h>
#include <veejay/vims.h> #include <veejay/vims.h>
#include <veejay/vj-event.h> #include <veejay/vj-event.h>
#include <veejay/vj-tag.h> #include <libstream/vj-tag.h>
#include <veejay/vj-plugin.h> #include <veejay/vj-plugin.h>
/* Highest possible SDL Key identifier */ /* Highest possible SDL Key identifier */
#define MAX_SDL_KEY 350 #define MAX_SDL_KEY 350

View File

@@ -24,17 +24,17 @@
#include <libsample/sampleadm.h> #include <libsample/sampleadm.h>
#include <libvjnet/vj-server.h> #include <libvjnet/vj-server.h>
#include <libvjnet/vj-client.h> #include <libvjnet/vj-client.h>
#include <libyuv/yuvconv.h>
#ifdef HAVE_V4L #ifdef HAVE_V4L
#include "vj-v4lvideo.h" #include <libstream/vj-v4lvideo.h>
#endif #endif
#include "vj-yuv4mpeg.h" #include <libstream/vj-yuv4mpeg.h>
#include "vj-dfb.h" #include "vj-dfb.h"
#include "vj-sdl.h" #include "vj-sdl.h"
#include "vj-OSC.h" #include "vj-OSC.h"
#include "lav_io.h" #include <libel/lav_io.h>
#include "vj-shm.h" #include <libstream/vj-shm.h>
#include "subsample.h" #include <libel/vj-el.h>
#include "vj-el.h"
enum { enum {
NO_AUDIO = 0, NO_AUDIO = 0,

View File

@@ -24,25 +24,24 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <libsample/sampleadm.h> #include <libsample/sampleadm.h>
#include <veejay/vj-tag.h> #include <libstream/vj-tag.h>
#include <libvjnet/vj-server.h> #include <libvjnet/vj-server.h>
#include <libvje/vje.h> #include <libvje/vje.h>
#include <veejay/vj-lib.h> #include <veejay/vj-lib.h>
#include <veejay/vj-el.h> #include <libel/vj-el.h>
#include <math.h> #include <math.h>
#include <veejay/vj-avcodec.h> #include <libel/vj-avcodec.h>
#include <veejay/vj-event.h> #include <veejay/vj-event.h>
//#ifdef SUPPORT_READ_DV2 //#ifdef SUPPORT_READ_DV2
//#include "vj-dv.h" //#include "vj-dv.h"
//#endif //#endif
#include <veejay/jpegutils.h> #include <veejay/jpegutils.h>
#include <veejay/subsample.h> #include <libyuv/yuvconv.h>
#include <libvjmsg/vj-common.h> #include <libvjmsg/vj-common.h>
#include <veejay/vj-perform.h> #include <veejay/vj-perform.h>
#include <veejay/libveejay.h> #include <veejay/libveejay.h>
#include <veejay/samplerecord.h> #include <veejay/samplerecord.h>
#include <jpeglib.h> #include <jpeglib.h>
//#include <avcodec.h>
#ifdef HAVE_SAMPLERATE #ifdef HAVE_SAMPLERATE
#include <samplerate.h> #include <samplerate.h>
#endif #endif

View File

@@ -23,7 +23,7 @@
#include <libvjmsg/vj-common.h> #include <libvjmsg/vj-common.h>
#include <veejay/vj-global.h> #include <veejay/vj-global.h>
#include <libvjmem/vjmem.h> #include <libvjmem/vjmem.h>
#include <veejay/vj-avcodec.h> #include <libel/vj-avcodec.h>
#include <string.h> #include <string.h>
#include <stdlib.h> #include <stdlib.h>
//extern void *(* veejay_memcpy)(void *to, const void *from, size_t len) ; //extern void *(* veejay_memcpy)(void *to, const void *from, size_t len) ;