Initial import of ffmpeg-devel-0.4.9pre1 from pkgsrc-wip, packaged
by zul at netbsd-fr dot org. Development version of ffmpeg, required in some new packages or updates.
This commit is contained in:
parent
5960b18c7e
commit
64a00a48a3
15 changed files with 1064 additions and 0 deletions
10
multimedia/ffmpeg-devel/DESCR
Normal file
10
multimedia/ffmpeg-devel/DESCR
Normal file
|
@ -0,0 +1,10 @@
|
|||
FFmpeg is the first complete and free Internet Live Audio and Video
|
||||
Broadcasting solution. FFMpeg aims at being the command line tool to
|
||||
handle audio and video. It is a "three-in-one" solution.
|
||||
|
||||
FFmpeg includes a soft VCR capable of encoding in many different
|
||||
formats simultaneously, a streaming server for Netcasting multimedia
|
||||
and is available under the GNU General Public License.
|
||||
|
||||
FFmpeg generates streaming files, in many popular formats
|
||||
simultaneously, faster than any other solution.
|
53
multimedia/ffmpeg-devel/Makefile
Normal file
53
multimedia/ffmpeg-devel/Makefile
Normal file
|
@ -0,0 +1,53 @@
|
|||
# $NetBSD: Makefile,v 1.1.1.1 2006/01/24 04:00:37 xtraeme Exp $
|
||||
|
||||
DISTNAME= ffmpeg-0.4.9-pre1
|
||||
PKGNAME= ffmpeg-devel-0.4.9pre1
|
||||
CATEGORIES= multimedia
|
||||
MASTER_SITES= ${MASTER_SITE_SOURCEFORGE:=ffmpeg/}
|
||||
|
||||
MAINTAINER= zul@NetBSD-fr.org
|
||||
HOMEPAGE= http://ffmpeg.sourceforge.net/
|
||||
COMMENT= MPEG decoding, encoding and streaming software
|
||||
|
||||
HAS_CONFIGURE= YES
|
||||
USE_TOOLS+= gmake
|
||||
USE_LIBTOOL= YES
|
||||
|
||||
CONFLICTS+= ffmpeg-[0-9]*
|
||||
|
||||
REPLACE_PERL= doc/texi2pod.pl
|
||||
|
||||
CONF_FILES= ${PREFIX}/share/examples/ffmpeg/ffserver.conf \
|
||||
${PKG_SYSCONFDIR}/ffserver.conf
|
||||
|
||||
MAKE_ENV+= EXTRA_LIBS=${LIBGETOPT:Q} \
|
||||
FFSERVER_CONF=${PKG_SYSCONFDIR}/ffserver.conf \
|
||||
LOCALBASE=${LOCALBASE:Q}
|
||||
|
||||
CONFIGURE_ARGS= --cc=${CC:Q} --prefix=${PREFIX:Q}
|
||||
CONFIGURE_ARGS+= --enable-pp --disable-vhook --disable-debug
|
||||
CONFIGURE_ARGS+= --enable-gpl
|
||||
CONFIGURE_ARGS+= --enable-ffplay
|
||||
|
||||
.include "options.mk"
|
||||
|
||||
post-install:
|
||||
${INSTALL_DATA_DIR} ${PREFIX}/share/examples/ffmpeg \
|
||||
${PREFIX}/share/doc/ffmpeg \
|
||||
${PREFIX}/include/ffmpeg/libpostproc
|
||||
${INSTALL_DATA} ${WRKSRC}/libavcodec/apiexample.c \
|
||||
${PREFIX}/share/doc/ffmpeg
|
||||
${INSTALL_DATA} ${WRKSRC}/README ${WRKSRC}/doc/TODO \
|
||||
${PREFIX}/share/doc/ffmpeg
|
||||
${INSTALL_DATA} ${WRKSRC}/doc/*.txt ${PREFIX}/share/doc/ffmpeg
|
||||
${INSTALL_DATA} ${WRKSRC}/doc/ffserver.conf \
|
||||
${PREFIX}/share/examples/ffmpeg
|
||||
# ffplay not installed
|
||||
if [ -f ${PREFIX}/man/man1/ffplay.1 ]; then \
|
||||
${RM} ${PREFIX}/man/man1/ffplay.1 ; \
|
||||
fi
|
||||
${INSTALL_DATA} ${WRKSRC}/libavcodec/libpostproc/postprocess.h \
|
||||
${PREFIX}/include/ffmpeg/libpostproc
|
||||
|
||||
.include "../../devel/libgetopt/buildlink3.mk"
|
||||
.include "../../mk/bsd.pkg.mk"
|
24
multimedia/ffmpeg-devel/PLIST
Normal file
24
multimedia/ffmpeg-devel/PLIST
Normal file
|
@ -0,0 +1,24 @@
|
|||
@comment $NetBSD: PLIST,v 1.1.1.1 2006/01/24 04:00:37 xtraeme Exp $
|
||||
bin/ffmpeg
|
||||
bin/ffserver
|
||||
include/ffmpeg/avcodec.h
|
||||
include/ffmpeg/avformat.h
|
||||
include/ffmpeg/avio.h
|
||||
include/ffmpeg/common.h
|
||||
include/ffmpeg/libpostproc/postprocess.h
|
||||
include/ffmpeg/rational.h
|
||||
include/ffmpeg/rtp.h
|
||||
include/ffmpeg/rtsp.h
|
||||
include/ffmpeg/rtspcodes.h
|
||||
lib/libavcodec.la
|
||||
lib/libavformat.la
|
||||
share/doc/ffmpeg/README
|
||||
share/doc/ffmpeg/TODO
|
||||
share/doc/ffmpeg/apiexample.c
|
||||
share/doc/ffmpeg/ffmpeg_powerpc_performance_evaluation_howto.txt
|
||||
share/doc/ffmpeg/optimization.txt
|
||||
share/examples/ffmpeg/ffserver.conf
|
||||
@dirrm share/examples/ffmpeg
|
||||
@dirrm share/doc/ffmpeg
|
||||
@dirrm include/ffmpeg/libpostproc
|
||||
@dirrm include/ffmpeg
|
18
multimedia/ffmpeg-devel/buildlink3.mk
Normal file
18
multimedia/ffmpeg-devel/buildlink3.mk
Normal file
|
@ -0,0 +1,18 @@
|
|||
# $NetBSD: buildlink3.mk,v 1.1.1.1 2006/01/24 04:00:37 xtraeme Exp $
|
||||
|
||||
BUILDLINK_DEPTH:= ${BUILDLINK_DEPTH}+
|
||||
FFMPEG_DEVEL_BUILDLINK3_MK:= ${FFMPEG_DEVEL_BUILDLINK3_MK}+
|
||||
|
||||
.if !empty(BUILDLINK_DEPTH:M+)
|
||||
BUILDLINK_DEPENDS+= ffmpeg-devel
|
||||
.endif
|
||||
|
||||
BUILDLINK_PACKAGES:= ${BUILDLINK_PACKAGES:Nffmpeg-devel}
|
||||
BUILDLINK_PACKAGES+= ffmpeg-devel
|
||||
|
||||
.if !empty(FFMPEG_DEVEL_BUILDLINK3_MK:M+)
|
||||
BUILDLINK_DEPENDS.ffmpeg-devel+= ffmpeg-devel>=0.4.9pre1
|
||||
BUILDLINK_PKGSRCDIR.ffmpeg-devel?= ../../multimedia/ffmpeg-devel
|
||||
.endif # FFMPEG_BUILDLINK3_MK
|
||||
|
||||
BUILDLINK_DEPTH:= ${BUILDLINK_DEPTH:S/+$//}
|
11
multimedia/ffmpeg-devel/distinfo
Normal file
11
multimedia/ffmpeg-devel/distinfo
Normal file
|
@ -0,0 +1,11 @@
|
|||
$NetBSD: distinfo,v 1.1.1.1 2006/01/24 04:00:37 xtraeme Exp $
|
||||
|
||||
SHA1 (ffmpeg-0.4.9-pre1.tar.gz) = aad00445137520bec19e56bcb042e75a10c53bb3
|
||||
RMD160 (ffmpeg-0.4.9-pre1.tar.gz) = fd682846f97ada32951af7844e185c42783189a4
|
||||
Size (ffmpeg-0.4.9-pre1.tar.gz) = 1611332 bytes
|
||||
SHA1 (patch-aa) = 012e6330303c023884e8d9ab44d1d265c1e765f4
|
||||
SHA1 (patch-ab) = f596db3c555ab772eae2da5b8144c23fb4f2eaa0
|
||||
SHA1 (patch-ac) = 2e7aa9021ddfe46cda35a9399e59f63848610d83
|
||||
SHA1 (patch-ad) = 95eea8ef74a270a0c60243eff740aa3346efaaaf
|
||||
SHA1 (patch-ae) = 7223978301c95de96d19610afb332f10764c4de0
|
||||
SHA1 (patch-ag) = 69656d16d44d3321bdf9b790e6263db1529d2c99
|
22
multimedia/ffmpeg-devel/files/bktr.diff
Normal file
22
multimedia/ffmpeg-devel/files/bktr.diff
Normal file
|
@ -0,0 +1,22 @@
|
|||
--- libavformat/Makefile.orig 2004-08-14 14:51:47.000000000 +0200
|
||||
+++ libavformat/Makefile 2004-08-14 14:52:43.000000000 +0200
|
||||
@@ -32,7 +32,7 @@
|
||||
OBJS+= framehook.o
|
||||
|
||||
ifeq ($(CONFIG_VIDEO4LINUX),yes)
|
||||
-OBJS+= grab.o
|
||||
+OBJS+= grab_bsdbktr.o
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_DV1394),yes)
|
||||
--- configure.org 2004-07-31 17:12:40.000000000 +0200
|
||||
+++ configure 2004-07-31 17:12:54.000000000 +0200
|
||||
@@ -231,6 +231,8 @@
|
||||
*) ;;
|
||||
esac
|
||||
|
||||
+v4l="yes"
|
||||
+
|
||||
# From mplayer configure. We need TARGET_OS available
|
||||
# to the Makefile, so it can distinguish between flavors
|
||||
# of AltiVec on PowerPC
|
61
multimedia/ffmpeg-devel/files/ffmpeg.1.diff
Normal file
61
multimedia/ffmpeg-devel/files/ffmpeg.1.diff
Normal file
|
@ -0,0 +1,61 @@
|
|||
--- doc/ffmpeg.1.orig 2004-08-29 12:38:34.000000000 +0200
|
||||
+++ doc/ffmpeg.1 2004-08-29 13:03:08.000000000 +0200
|
||||
@@ -505,21 +505,49 @@
|
||||
tell that the raw codec data must be copied as is.
|
||||
.Sh "Audio/Video grab options"
|
||||
.IX Subsection "Audio/Video grab options"
|
||||
-.IP "\fB\-vd device\fR" 4
|
||||
-.IX Item "-vd device"
|
||||
-set video grab device (e.g. \fI/dev/video0\fR)
|
||||
-.IP "\fB\-vc channel\fR" 4
|
||||
-.IX Item "-vc channel"
|
||||
-set video grab channel (\s-1DV1394\s0 only)
|
||||
.IP "\fB\-tvstd standard\fR" 4
|
||||
.IX Item "-tvstd standard"
|
||||
set television standard (\s-1NTSC\s0, \s-1PAL\s0 (\s-1SECAM\s0))
|
||||
-.IP "\fB\-dv1394\fR" 4
|
||||
-.IX Item "-dv1394"
|
||||
-set \s-1DV1394\s0 grab
|
||||
.IP "\fB\-ad device\fR" 4
|
||||
.IX Item "-ad device"
|
||||
set audio device (e.g. \fI/dev/dsp\fR)
|
||||
+.PP
|
||||
+This build of ffmpeg includes NetBSD-specific patches that change the
|
||||
+video-grabbing semantics. Recording from bktr(4) can be controlled via the
|
||||
+following environment variables:
|
||||
+.PP
|
||||
+.RS
|
||||
+.B BKTR_DEV
|
||||
+(0\-4): which of the devices on the bktr should provide the signal (tuner,
|
||||
+video-in,...)
|
||||
+.PP
|
||||
+.B BKTR_FORMAT
|
||||
+(1\-6): TV format, 1 PAL 2 NTSC 3 SECAM 4 PALN 5 PALM 6 NTSCJ
|
||||
+.PP
|
||||
+.B BKTR_FREQUENCY
|
||||
+(float): frequency to which the tuner should be set.
|
||||
+.PP
|
||||
+.B BKTR_CHANNEL
|
||||
+(int): channel to which the tuner should be set, overrides BKTR_FREQUENCY
|
||||
+.RE
|
||||
+.PP
|
||||
+If you set the channel or frequency with a different program such as xawtv
|
||||
+or fxtv you might not get audio; try to use the environment variables in
|
||||
+that case. Do not forget to set the following mixerctl variables to useful
|
||||
+values:
|
||||
+.PP
|
||||
+.RS
|
||||
+record.source=line
|
||||
+.PP
|
||||
+record.volume=255,255
|
||||
+.PP
|
||||
+inputs.line=255,255
|
||||
+.RE
|
||||
+.PP
|
||||
+One possible command line would then be:
|
||||
+.PP
|
||||
+ffmpeg -y -intra -tvstd pal -vcodec mpeg2video -s 768x576 -b 9600 -ab 128 -ad
|
||||
+/dev/audio -ac 2 -ar 44100 /tmp/file.mpg
|
||||
.Sh "Advanced options"
|
||||
.IX Subsection "Advanced options"
|
||||
.IP "\fB\-map file:stream\fR" 4
|
325
multimedia/ffmpeg-devel/files/grab_bsdbktr.c
Normal file
325
multimedia/ffmpeg-devel/files/grab_bsdbktr.c
Normal file
|
@ -0,0 +1,325 @@
|
|||
/*
|
||||
* FreeBSD video grab interface
|
||||
* Copyright (c) 2002 Steve O'Hara-Smith
|
||||
* based on
|
||||
* Linux video grab interface
|
||||
* Copyright (c) 2000,2001 Gerard Lantau.
|
||||
* and
|
||||
* simple_grab.c Copyright (c) 1999 Roger Hardiman
|
||||
*
|
||||
* GPL virus inherited:
|
||||
*
|
||||
* 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 "avformat.h"
|
||||
#include <dev/ic/bt8xx.h>
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/mman.h>
|
||||
#include <sys/time.h>
|
||||
#include <signal.h>
|
||||
|
||||
typedef struct {
|
||||
int fd;
|
||||
int tuner_fd;
|
||||
int frame_format; /* see VIDEO_PALETTE_xxx */
|
||||
int width, height;
|
||||
int frame_rate;
|
||||
int frame_rate_base;
|
||||
int64_t per_frame;
|
||||
} VideoData;
|
||||
|
||||
const char *video_device = "/dev/bktr0";
|
||||
|
||||
#define PAL 1
|
||||
#define PALBDGHI 1
|
||||
#define NTSC 2
|
||||
#define NTSCM 2
|
||||
#define SECAM 3
|
||||
#define PALN 4
|
||||
#define PALM 5
|
||||
#define NTSCJ 6
|
||||
|
||||
/* PAL is 768 x 576. NTSC is 640 x 480 */
|
||||
#define PAL_HEIGHT 576
|
||||
#define SECAM_HEIGHT 576
|
||||
#define NTSC_HEIGHT 480
|
||||
|
||||
#ifndef VIDEO_FORMAT
|
||||
#define VIDEO_FORMAT NTSC
|
||||
#endif
|
||||
|
||||
static int bktr_dev[] = { METEOR_DEV0, METEOR_DEV1, METEOR_DEV2,
|
||||
METEOR_DEV3, METEOR_DEV_SVIDEO };
|
||||
|
||||
static u_int8_t *video_buf;
|
||||
static int nsignals = 0;
|
||||
static void catchsignal(int signal)
|
||||
{
|
||||
nsignals++;
|
||||
return;
|
||||
}
|
||||
|
||||
static int bktr_init (const char *video_device, int width, int height,
|
||||
int format, u_int8_t **video_buf, int *video_fd, int *tuner_fd,
|
||||
int idev, double frequency)
|
||||
{
|
||||
struct meteor_geomet geo;
|
||||
int h_max;
|
||||
long ioctl_frequency;
|
||||
char *arg;
|
||||
int c;
|
||||
int channel = 0;
|
||||
struct sigaction act,old;
|
||||
|
||||
if (idev < 0 || idev > 4)
|
||||
{
|
||||
arg = getenv ("BKTR_DEV");
|
||||
if (arg)
|
||||
idev = atoi (arg);
|
||||
if (idev < 0 || idev > 4)
|
||||
idev = 0;
|
||||
}
|
||||
|
||||
if (format < 1 || format > 6)
|
||||
{
|
||||
arg = getenv ("BKTR_FORMAT");
|
||||
if (arg)
|
||||
format = atoi (arg);
|
||||
if (format < 1 || format > 6)
|
||||
format = VIDEO_FORMAT;
|
||||
}
|
||||
|
||||
if (frequency <= 0)
|
||||
{
|
||||
arg = getenv ("BKTR_FREQUENCY");
|
||||
if (arg)
|
||||
frequency = atof (arg);
|
||||
if (frequency <= 0)
|
||||
frequency = 0.0;
|
||||
}
|
||||
|
||||
arg = getenv ("BKTR_CHANNEL");
|
||||
if (arg)
|
||||
channel = atoi (arg);
|
||||
if (channel < 0)
|
||||
channel = 0;
|
||||
|
||||
memset(&act,0,sizeof(act));
|
||||
sigemptyset(&act.sa_mask);
|
||||
act.sa_handler = catchsignal;
|
||||
sigaction(SIGUSR1,&act,&old);
|
||||
|
||||
*tuner_fd = open ("/dev/tuner0", O_RDONLY);
|
||||
if (*tuner_fd < 0) {
|
||||
perror("Warning: Tuner not opened continuing");
|
||||
}
|
||||
|
||||
*video_fd = open (video_device, O_RDONLY);
|
||||
if (*video_fd < 0) {
|
||||
perror (video_device);
|
||||
return -1;
|
||||
}
|
||||
|
||||
geo.rows = height;
|
||||
geo.columns = width;
|
||||
geo.frames = 1;
|
||||
// geo.oformat = METEOR_GEO_YUV_422 | METEOR_GEO_YUV_12;
|
||||
geo.oformat = METEOR_GEO_YUV_PACKED;
|
||||
|
||||
switch (format) {
|
||||
case PAL: h_max = PAL_HEIGHT; c = BT848_IFORM_F_PALBDGHI; break;
|
||||
case PALN: h_max = PAL_HEIGHT; c = BT848_IFORM_F_PALN; break;
|
||||
case PALM: h_max = PAL_HEIGHT; c = BT848_IFORM_F_PALM; break;
|
||||
case SECAM: h_max = SECAM_HEIGHT; c = BT848_IFORM_F_SECAM; break;
|
||||
case NTSC: h_max = NTSC_HEIGHT; c = BT848_IFORM_F_NTSCM; break;
|
||||
case NTSCJ: h_max = NTSC_HEIGHT; c = BT848_IFORM_F_NTSCJ; break;
|
||||
default: h_max = PAL_HEIGHT; c = BT848_IFORM_F_PALBDGHI; break;
|
||||
}
|
||||
if (height <= h_max/2) {
|
||||
geo.oformat |= METEOR_GEO_EVEN_ONLY;
|
||||
}
|
||||
|
||||
if (ioctl(*video_fd, METEORSETGEO, &geo) < 0) {
|
||||
perror ("METEORSETGEO");
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (ioctl(*video_fd, BT848SFMT, &c) < 0) {
|
||||
perror ("BT848SFMT");
|
||||
return -1;
|
||||
}
|
||||
|
||||
c = bktr_dev[idev];
|
||||
if (ioctl(*video_fd, METEORSINPUT, &c) < 0) {
|
||||
perror ("METEORSINPUT");
|
||||
return -1;
|
||||
}
|
||||
*video_buf = (u_int8_t *) mmap((caddr_t)0, width*height*2,
|
||||
PROT_READ, MAP_SHARED, *video_fd, (off_t) 0);
|
||||
if (*video_buf == MAP_FAILED) {
|
||||
perror ("mmap");
|
||||
return -1;
|
||||
}
|
||||
if (frequency != 0.0) {
|
||||
ioctl_frequency = (unsigned long)(frequency*16);
|
||||
if (ioctl(*tuner_fd, TVTUNER_SETFREQ, &ioctl_frequency)<0)
|
||||
perror("TVTUNER_SETFREQ");
|
||||
}
|
||||
if (channel != 0) {
|
||||
if (ioctl(*tuner_fd, TVTUNER_SETCHNL, &channel) < 0)
|
||||
perror("TVTUNER_SETCHNL");
|
||||
}
|
||||
c = METEOR_CAP_CONTINOUS;
|
||||
ioctl(*video_fd, METEORCAPTUR, &c);
|
||||
c = SIGUSR1;
|
||||
ioctl (*video_fd, METEORSSIGNAL, &c);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void bktr_getframe(u_int64_t per_frame)
|
||||
{
|
||||
u_int64_t curtime;
|
||||
static u_int64_t last_frame_time = 0;
|
||||
|
||||
curtime = av_gettime();
|
||||
if (!last_frame_time
|
||||
|| ((last_frame_time + per_frame) > curtime)) {
|
||||
if (!usleep (last_frame_time + per_frame + per_frame/8 - curtime)) {
|
||||
if (!nsignals)
|
||||
printf ("\nSLEPT NO signals - %d microseconds late\n",
|
||||
(int) (av_gettime() - last_frame_time - per_frame));
|
||||
}
|
||||
}
|
||||
nsignals = 0;
|
||||
|
||||
last_frame_time = curtime;
|
||||
}
|
||||
|
||||
void bf_memcpy (char *dest, char *src, int size)
|
||||
{
|
||||
while (size -= 2)
|
||||
{
|
||||
dest[0] = src[1];
|
||||
dest[1] = src[0];
|
||||
dest += 2;
|
||||
src += 2;
|
||||
}
|
||||
}
|
||||
|
||||
/* note: we support only one picture read at a time */
|
||||
static int grab_read_packet(AVFormatContext *s1, AVPacket *pkt)
|
||||
{
|
||||
VideoData *s = s1->priv_data;
|
||||
int size, halfsize;
|
||||
|
||||
size = s->width * s->height;
|
||||
halfsize = size << 1;
|
||||
|
||||
// if (av_new_packet(pkt, size + halfsize) < 0)
|
||||
if (av_new_packet(pkt, size + size) < 0)
|
||||
return -EIO;
|
||||
|
||||
bktr_getframe (s->per_frame);
|
||||
pkt->pts = av_gettime() & ((1LL << 48) - 1);
|
||||
bf_memcpy (pkt->data, video_buf, size + size);
|
||||
// bf_memcpy (pkt->data, video_buf, size + halfsize);
|
||||
|
||||
// return size + halfsize;
|
||||
return size + size;
|
||||
}
|
||||
|
||||
static int grab_read_header (AVFormatContext *s1, AVFormatParameters *ap)
|
||||
{
|
||||
VideoData *s = s1->priv_data;
|
||||
AVStream *st;
|
||||
int width, height;
|
||||
int frame_rate;
|
||||
int frame_rate_base;
|
||||
int format = -1;
|
||||
|
||||
if (!ap || ap->width <= 0 || ap->height <= 0 || ap->frame_rate <= 0)
|
||||
return -1;
|
||||
|
||||
width = ap->width;
|
||||
height = ap->height;
|
||||
frame_rate = ap->frame_rate;
|
||||
frame_rate_base = ap->frame_rate_base;
|
||||
|
||||
st = av_new_stream(s1, 0);
|
||||
if (!st)
|
||||
return -ENOMEM;
|
||||
|
||||
s->width = width;
|
||||
s->height = height;
|
||||
s->frame_rate = frame_rate;
|
||||
s->frame_rate_base = frame_rate_base;
|
||||
s->per_frame = ((int64_t)1000000 * s->frame_rate_base) / s->frame_rate;
|
||||
|
||||
st->codec.codec_type = CODEC_TYPE_VIDEO;
|
||||
// st->codec.pix_fmt = PIX_FMT_YUV420P;
|
||||
st->codec.pix_fmt = PIX_FMT_YUV422;
|
||||
st->codec.codec_id = CODEC_ID_RAWVIDEO;
|
||||
st->codec.width = width;
|
||||
st->codec.height = height;
|
||||
st->codec.frame_rate = frame_rate;
|
||||
st->codec.frame_rate_base = frame_rate_base;
|
||||
|
||||
av_set_pts_info(s1, 48, 1, 1000000); /* 48 bits pts in use */
|
||||
|
||||
if (ap->standard) {
|
||||
if (!strcasecmp(ap->standard, "pal"))
|
||||
format = PAL;
|
||||
if (!strcasecmp(ap->standard, "secam"))
|
||||
format = SECAM;
|
||||
if (!strcasecmp(ap->standard, "ntsc"))
|
||||
format = NTSC;
|
||||
}
|
||||
|
||||
if (bktr_init (video_device, width, height, format, &video_buf,
|
||||
&(s->fd), &(s->tuner_fd), -1, 0.0) < 0)
|
||||
return -EIO;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int grab_read_close (AVFormatContext *s1)
|
||||
{
|
||||
VideoData *s = s1->priv_data;
|
||||
|
||||
int c = METEOR_CAP_STOP_CONT;
|
||||
ioctl(s->fd, METEORCAPTUR, &c);
|
||||
close(s->fd);
|
||||
close(s->tuner_fd);
|
||||
av_free(s);
|
||||
return 0;
|
||||
}
|
||||
|
||||
AVInputFormat video_grab_device_format = {
|
||||
"video4linux",
|
||||
"video grab",
|
||||
sizeof(VideoData),
|
||||
NULL,
|
||||
grab_read_header,
|
||||
grab_read_packet,
|
||||
grab_read_close,
|
||||
flags: AVFMT_NOFILE,
|
||||
};
|
||||
|
||||
int video_grab_init(void)
|
||||
{
|
||||
av_register_input_format(&video_grab_device_format);
|
||||
return 0;
|
||||
}
|
96
multimedia/ffmpeg-devel/options.mk
Normal file
96
multimedia/ffmpeg-devel/options.mk
Normal file
|
@ -0,0 +1,96 @@
|
|||
# $NetBSD options.mk $
|
||||
|
||||
# Global and legacy options
|
||||
|
||||
PKG_OPTIONS_VAR= PKG_OPTIONS.ffmpeg-devel
|
||||
PKG_SUPPORTED_OPTIONS= bktr lame mmx vorbis faac faad a52
|
||||
|
||||
.include "../../mk/bsd.options.mk"
|
||||
|
||||
.include "../../mk/bsd.prefs.mk"
|
||||
|
||||
###
|
||||
### MMX support
|
||||
###
|
||||
|
||||
.include "../../mk/compiler.mk"
|
||||
|
||||
.if !empty(MACHINE_ARCH:Mi386)
|
||||
. if !empty(PKG_OPTIONS:Mmmx) && !empty(CC_VERSION:Mgcc*)
|
||||
CFLAGS+= -fomit-frame-pointer
|
||||
. else
|
||||
CONFIGURE_ARGS+= --disable-mmx
|
||||
. endif
|
||||
.else
|
||||
CONFIGURE_ARGS+= --disable-mmx
|
||||
.endif
|
||||
|
||||
###
|
||||
### bktr options
|
||||
###
|
||||
|
||||
.if !empty(PKG_OPTIONS:Mbktr)
|
||||
post-extract:
|
||||
${CP} ${FILESDIR}/grab_bsdbktr.c ${WRKSRC}/libavformat
|
||||
|
||||
post-patch:
|
||||
${PATCH} --quiet -d ${WRKSRC} < ${FILESDIR}/bktr.diff
|
||||
#TODO
|
||||
#Update the documentation
|
||||
# ${PATCH} --quiet -d ${WRKSRC} < ${FILESDIR}/ffmpeg.1.diff
|
||||
.endif
|
||||
|
||||
###
|
||||
### using lame option
|
||||
###
|
||||
|
||||
.if !empty(PKG_OPTIONS:Mlame)
|
||||
CONFIGURE_ARGS+= --enable-mp3lame
|
||||
.include "../../audio/lame/buildlink3.mk"
|
||||
.else
|
||||
CONFIGURE_ARGS+= --disable-mp3lame
|
||||
.endif
|
||||
|
||||
###
|
||||
### using vorbis option
|
||||
###
|
||||
|
||||
.if !empty(PKG_OPTIONS:Mvorbis)
|
||||
CONFIGURE_ARGS+= --enable-vorbis
|
||||
.include "../../audio/libvorbis/buildlink3.mk"
|
||||
.else
|
||||
CONFIGURE_ARGS+= --disable-vorbis
|
||||
.endif
|
||||
|
||||
###
|
||||
### faad option
|
||||
###
|
||||
|
||||
.if !empty(PKG_OPTIONS:Mfaad)
|
||||
CONFIGURE_ARGS+= --enable-faad
|
||||
.include "../../audio/faad2/buildlink3.mk"
|
||||
.else
|
||||
CONFIGURE_ARGS+= --disable-faad
|
||||
.endif
|
||||
|
||||
###
|
||||
### faac option
|
||||
###
|
||||
|
||||
.if !empty(PKG_OPTIONS:Mfaac)
|
||||
CONFIGURE_ARGS+= --enable-faac
|
||||
.include "../../audio/faac/buildlink3.mk"
|
||||
.else
|
||||
CONFIGURE_ARGS+= --disable-faac
|
||||
.endif
|
||||
|
||||
###
|
||||
### a52 option
|
||||
###
|
||||
|
||||
.if !empty(PKG_OPTIONS:Ma52)
|
||||
CONFIGURE_ARGS+= --enable-a52
|
||||
.include "../../audio/liba52/buildlink3.mk"
|
||||
.else
|
||||
CONFIGURE_ARGS+= --disable-a52
|
||||
.endif
|
17
multimedia/ffmpeg-devel/patches/patch-aa
Normal file
17
multimedia/ffmpeg-devel/patches/patch-aa
Normal file
|
@ -0,0 +1,17 @@
|
|||
$NetBSD: patch-aa,v 1.1.1.1 2006/01/24 04:00:37 xtraeme Exp $
|
||||
|
||||
--- configure.orig 2004-11-28 16:56:25.000000000 +0100
|
||||
+++ configure
|
||||
@@ -224,11 +224,10 @@ FFSLDFLAGS=""
|
||||
need_inet_aton="yes"
|
||||
extralibs="$extralibs -lsocket -lnsl"
|
||||
;;
|
||||
-FreeBSD)
|
||||
+FreeBSD|NetBSD)
|
||||
v4l="no"
|
||||
audio_oss="yes"
|
||||
dv1394="no"
|
||||
-make="gmake"
|
||||
CFLAGS="-pthread"
|
||||
LDFLAGS="$LDFLAGS -export-dynamic -pthread"
|
||||
;;
|
22
multimedia/ffmpeg-devel/patches/patch-ab
Normal file
22
multimedia/ffmpeg-devel/patches/patch-ab
Normal file
|
@ -0,0 +1,22 @@
|
|||
$NetBSD: patch-ab,v 1.1.1.1 2006/01/24 04:00:37 xtraeme Exp $
|
||||
|
||||
--- ffserver.c.orig 2003-09-28 17:26:39.000000000 +0200
|
||||
+++ ffserver.c
|
||||
@@ -4488,7 +4488,7 @@ static void show_help(void)
|
||||
"\n"
|
||||
"-L : print the LICENSE\n"
|
||||
"-h : this help\n"
|
||||
- "-f configfile : use configfile instead of /etc/ffserver.conf\n"
|
||||
+ "-f configfile : use configfile instead of " FFSERVER_CONF "\n"
|
||||
);
|
||||
}
|
||||
|
||||
@@ -4546,7 +4546,7 @@ int main(int argc, char **argv)
|
||||
|
||||
av_register_all();
|
||||
|
||||
- config_filename = "/etc/ffserver.conf";
|
||||
+ config_filename = FFSERVER_CONF;
|
||||
|
||||
my_program_name = argv[0];
|
||||
my_program_dir = getcwd(0, 0);
|
113
multimedia/ffmpeg-devel/patches/patch-ac
Normal file
113
multimedia/ffmpeg-devel/patches/patch-ac
Normal file
|
@ -0,0 +1,113 @@
|
|||
$NetBSD: patch-ac,v 1.1.1.1 2006/01/24 04:00:37 xtraeme Exp $
|
||||
|
||||
--- Makefile.orig 2004-07-08 13:02:04.000000000 +0200
|
||||
+++ Makefile
|
||||
@@ -5,9 +5,7 @@
|
||||
include config.mak
|
||||
|
||||
VPATH=$(SRC_PATH)
|
||||
-
|
||||
-CFLAGS=$(OPTFLAGS) -I. -I$(SRC_PATH) -I$(SRC_PATH)/libavcodec -I$(SRC_PATH)/libavformat -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_GNU_SOURCE
|
||||
-LDFLAGS+= -g
|
||||
+CFLAGS= $(OPTFLAGS) -Wall -I. -I$(SRC_PATH) -I$(SRC_PATH)/libavcodec -I$(SRC_PATH)/libavformat -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_GNU_SOURCE
|
||||
|
||||
ifeq ($(TARGET_GPROF),yes)
|
||||
CFLAGS+=-p
|
||||
@@ -46,6 +44,8 @@ ifeq ($(CONFIG_VORBIS),yes)
|
||||
EXTRALIBS+=-logg -lvorbis -lvorbisenc
|
||||
endif
|
||||
|
||||
+EXTRALIBS+=${LIBOSSAUDIO}
|
||||
+
|
||||
ifeq ($(CONFIG_FAAD),yes)
|
||||
ifeq ($(CONFIG_FAADBIN),yes)
|
||||
# no libs needed
|
||||
@@ -76,7 +76,7 @@ endif
|
||||
|
||||
OBJS = ffmpeg.o ffserver.o cmdutils.o ffplay.o
|
||||
SRCS = $(OBJS:.o=.c) $(ASM_OBJS:.o=.s)
|
||||
-FFLIBS = -L./libavformat -lavformat -L./libavcodec -lavcodec
|
||||
+FFLIBS = libavformat/libavformat.la libavcodec/libavcodec.la
|
||||
|
||||
all: lib $(PROG) $(PROGTEST) $(VHOOK) $(QTFASTSTART) $(DOC)
|
||||
|
||||
@@ -84,25 +84,18 @@ lib:
|
||||
$(MAKE) -C libavcodec all
|
||||
$(MAKE) -C libavformat all
|
||||
|
||||
-ffmpeg_g$(EXESUF): ffmpeg.o cmdutils.o .libs
|
||||
- $(CC) $(LDFLAGS) -o $@ ffmpeg.o cmdutils.o $(FFLIBS) $(EXTRALIBS)
|
||||
-
|
||||
-ffmpeg$(EXESUF): ffmpeg_g$(EXESUF)
|
||||
- cp -p $< $@
|
||||
- $(STRIP) $@
|
||||
+ffmpeg$(EXESUF): ffmpeg.o cmdutils.o .ffmpeglibs
|
||||
+ $(LIBTOOL) --mode=link $(CC) $(LDFLAGS) -o $@ ffmpeg.o cmdutils.o $(FFLIBS) $(EXTRALIBS)
|
||||
|
||||
-ffserver$(EXESUF): ffserver.o .libs
|
||||
- $(CC) $(LDFLAGS) $(FFSLDFLAGS) -o $@ ffserver.o $(FFLIBS) $(EXTRALIBS)
|
||||
+ffserver$(EXESUF): ffserver.o .ffmpeglibs
|
||||
+ $(LIBTOOL) --mode=link $(CC) $(LDFLAGS) $(FFSLDFLAGS) -o $@ ffserver.o $(FFLIBS) $(EXTRALIBS)
|
||||
|
||||
-ffplay_g$(EXESUF): ffplay.o cmdutils.o .libs
|
||||
- $(CC) $(LDFLAGS) -o $@ ffplay.o cmdutils.o $(FFLIBS) $(EXTRALIBS) $(SDL_LIBS)
|
||||
|
||||
-ffplay$(EXESUF): ffplay_g$(EXESUF)
|
||||
- cp -p $< $@
|
||||
- $(STRIP) $@
|
||||
+ffplay$(EXESUF): ffplay.o cmdutils.o .ffmpeglibs
|
||||
+ $(LIBTOOL) --mode=link $(CC) $(LDFLAGS) -o $@ ffplay.o cmdutils.o $(FFLIBS) $(EXTRALIBS) $(SDL_LIBS)
|
||||
|
||||
-output_example$(EXESUF): output_example.o .libs
|
||||
- $(CC) $(LDFLAGS) -o $@ output_example.o $(FFLIBS) $(EXTRALIBS)
|
||||
+output_example$(EXESUF): output_example.o .ffmpeglibs
|
||||
+ $(LIBTOOL) --mode=link $(CC) $(LDFLAGS) -o $@ output_example.o $(FFLIBS) $(EXTRALIBS)
|
||||
|
||||
qt-faststart$(EXESUF): qt-faststart.c
|
||||
$(CC) qt-faststart.c -o qt-faststart$(EXESUF)
|
||||
@@ -111,9 +104,9 @@ ffplay.o: ffplay.c
|
||||
$(CC) $(CFLAGS) $(SDL_CFLAGS) -c -o $@ $<
|
||||
|
||||
%.o: %.c
|
||||
- $(CC) $(CFLAGS) -c -o $@ $<
|
||||
+ $(CC) -DFFSERVER_CONF=\"$(FFSERVER_CONF)\" $(CFLAGS) -c -o $@ $<
|
||||
|
||||
-videohook: .libs
|
||||
+videohook: .ffmpeglibs
|
||||
$(MAKE) -C vhook all
|
||||
|
||||
documentation:
|
||||
@@ -122,10 +115,10 @@ documentation:
|
||||
.PHONY: install
|
||||
|
||||
install: all install-man $(INSTALLVHOOK)
|
||||
- $(MAKE) -C libavcodec install
|
||||
- $(MAKE) -C libavformat install
|
||||
+ $(MAKE) -C libavcodec install install-headers
|
||||
+ $(MAKE) -C libavformat install install-headers
|
||||
install -d "$(bindir)"
|
||||
- install -c -s -m 755 $(PROG) "$(bindir)"
|
||||
+ $(LIBTOOL) --mode=install $(BSD_INSTALL_PROGRAM) $(PROG) "$(bindir)"
|
||||
|
||||
# create the window installer
|
||||
wininstaller: all install
|
||||
@@ -159,15 +152,15 @@ endif
|
||||
.depend: $(SRCS)
|
||||
$(CC) -MM $(CFLAGS) $(SDL_CFLAGS) $^ 1>.depend
|
||||
|
||||
-.libs: lib
|
||||
- @test -f .libs || touch .libs
|
||||
- @for i in $(DEP_LIBS) ; do if $(TEST) $$i -nt .libs ; then touch .libs; fi ; done
|
||||
+.ffmpeglibs: lib
|
||||
+ @test -f .ffmpeglibs || touch .ffmpeglibs
|
||||
+ @for i in $(DEP_LIBS) ; do if $(TEST) $$i -nt .ffmpeglibs ; then touch .ffmpeglibs; fi ; done
|
||||
|
||||
clean: $(CLEANVHOOK)
|
||||
$(MAKE) -C libavcodec clean
|
||||
$(MAKE) -C libavformat clean
|
||||
$(MAKE) -C tests clean
|
||||
- rm -f *.o *.d *~ .libs .depend gmon.out TAGS ffmpeg_g$(EXESUF) ffplay_g$(EXESUF) $(PROG) $(PROGTEST)
|
||||
+ rm -f *.o *.d *~ .ffmpeglibs .depend gmon.out TAGS ffmpeg_g$(EXESUF) ffplay_g$(EXESUF) $(PROG) $(PROGTEST)
|
||||
|
||||
clean-vhook:
|
||||
$(MAKE) -C vhook clean
|
57
multimedia/ffmpeg-devel/patches/patch-ad
Normal file
57
multimedia/ffmpeg-devel/patches/patch-ad
Normal file
|
@ -0,0 +1,57 @@
|
|||
$NetBSD: patch-ad,v 1.1.1.1 2006/01/24 04:00:37 xtraeme Exp $
|
||||
|
||||
--- libavformat/Makefile.orig 2004-04-24 17:16:23.000000000 +0200
|
||||
+++ libavformat/Makefile
|
||||
@@ -68,6 +68,11 @@ endif
|
||||
|
||||
ifeq ($(CONFIG_VORBIS),yes)
|
||||
OBJS+= ogg.o
|
||||
+EXTRALIBS+= -lvorbis -lvorbisenc
|
||||
+endif
|
||||
+
|
||||
+ifeq ($(CONFIG_MP3LAME),yes)
|
||||
+EXTRALIBS += -lmp3lame
|
||||
endif
|
||||
|
||||
ifeq ($(TARGET_ARCH_SPARC64),yes)
|
||||
@@ -81,12 +86,14 @@ endif
|
||||
|
||||
SRCS := $(OBJS:.o=.c) $(PPOBJS:.o=.cpp)
|
||||
|
||||
+install: all
|
||||
+ $(LIBTOOL) --mode=install $(BSD_INSTALL_DATA) $(LIB:.a=.la) $(prefix)/lib
|
||||
+
|
||||
all: $(LIB) $(SLIB)
|
||||
|
||||
$(LIB): $(OBJS) $(PPOBJS)
|
||||
rm -f $@
|
||||
- $(AR) rc $@ $(OBJS) $(PPOBJS)
|
||||
- $(RANLIB) $@
|
||||
+ $(LIBTOOL) --mode=link $(CC) -o $(LIB:.a=.la) $(OBJS:.o=.lo) $(PPOBJS:.o=.lo) -rpath $(prefix)/lib $(LIBOSSAUDIO) $(EXTRALIBS)
|
||||
|
||||
$(SLIB): $(OBJS)
|
||||
ifeq ($(CONFIG_WIN32),yes)
|
||||
@@ -96,9 +103,6 @@ else
|
||||
$(CC) $(SHFLAGS) -o $@ $(OBJS) $(PPOBJS) $(EXTRALIBS)
|
||||
endif
|
||||
|
||||
-depend: $(SRCS)
|
||||
- $(CC) -MM $(CFLAGS) $^ 1>.depend
|
||||
-
|
||||
ifeq ($(BUILD_SHARED),yes)
|
||||
install: all install-headers
|
||||
ifeq ($(CONFIG_WIN32),yes)
|
||||
@@ -124,11 +128,11 @@ install-headers:
|
||||
"$(prefix)/include/ffmpeg"
|
||||
|
||||
%.o: %.c
|
||||
- $(CC) $(CFLAGS) -c -o $@ $<
|
||||
+ $(LIBTOOL) --mode=compile $(CC) $(CFLAGS) -c -o $@ $<
|
||||
|
||||
# BeOS: remove -Wall to get rid of all the "multibyte constant" warnings
|
||||
%.o: %.cpp
|
||||
- g++ $(subst -Wall,,$(CFLAGS)) -c -o $@ $<
|
||||
+ $(LIBTOOL) --mode=compile $(CXX) $(subst -Wall,,$(CFLAGS)) -c -o $@ $<
|
||||
|
||||
distclean clean:
|
||||
rm -f *.o *.d .depend *~ *.a $(LIB)
|
41
multimedia/ffmpeg-devel/patches/patch-ae
Normal file
41
multimedia/ffmpeg-devel/patches/patch-ae
Normal file
|
@ -0,0 +1,41 @@
|
|||
$NetBSD: patch-ae,v 1.1.1.1 2006/01/24 04:00:37 xtraeme Exp $
|
||||
|
||||
--- libavcodec/Makefile.orig 2003-09-28 17:26:39.000000000 +0200
|
||||
+++ libavcodec/Makefile
|
||||
@@ -145,6 +145,9 @@ SLIB= $(SLIBPREF)avcodec$(SLIBSUF)
|
||||
endif
|
||||
TESTS= imgresample-test dct-test motion-test fft-test
|
||||
|
||||
+install: all
|
||||
+ $(LIBTOOL) --mode=install $(BSD_INSTALL_DATA) $(LIB:.a=.la) $(prefix)/lib
|
||||
+
|
||||
all: $(LIB) $(SLIB)
|
||||
|
||||
amrlibs:
|
||||
@@ -154,8 +157,8 @@ tests: apiexample cpuid_test $(TESTS)
|
||||
|
||||
$(LIB): $(OBJS) $(AMRLIBS)
|
||||
rm -f $@
|
||||
- $(AR) rc $@ $(OBJS) $(AMREXTRALIBS)
|
||||
- $(RANLIB) $@
|
||||
+ $(LIBTOOL) --mode=link $(CC) -o $(LIB:.a=.la) $(OBJS:.o=.lo) -rpath $(prefix)/lib $(EXTRALIBS) $(AMREXTRALIBS)
|
||||
+
|
||||
|
||||
$(SLIB): $(OBJS)
|
||||
ifeq ($(CONFIG_WIN32),yes)
|
||||
@@ -171,13 +174,10 @@ libpostproc/libpostproc.a:
|
||||
$(MAKE) -C libpostproc
|
||||
|
||||
%.o: %.c
|
||||
- $(CC) $(CFLAGS) -c -o $@ $<
|
||||
+ $(LIBTOOL) --mode=compile $(CC) $(CFLAGS) -c -o $@ $<
|
||||
|
||||
%.o: %.S
|
||||
- $(CC) $(CFLAGS) -c -o $@ $<
|
||||
-
|
||||
-depend: $(SRCS)
|
||||
- $(CC) -MM $(CFLAGS) $^ 1>.depend
|
||||
+ $(LIBTOOL) --mode=compile $(CC) $(CFLAGS) -c -o $@ $<
|
||||
|
||||
dep: depend
|
||||
|
194
multimedia/ffmpeg-devel/patches/patch-ag
Normal file
194
multimedia/ffmpeg-devel/patches/patch-ag
Normal file
|
@ -0,0 +1,194 @@
|
|||
$NetBSD: patch-ag,v 1.1.1.1 2006/01/24 04:00:37 xtraeme Exp $
|
||||
|
||||
--- libavformat/audio.c.orig 2004-06-19 05:59:34.000000000 +0200
|
||||
+++ libavformat/audio.c
|
||||
@@ -18,10 +18,19 @@
|
||||
*/
|
||||
#include "avformat.h"
|
||||
|
||||
+#ifdef __NetBSD__
|
||||
+#define USE_SUNAUDIO
|
||||
+#endif
|
||||
+
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
+#ifndef USE_SUNAUDIO
|
||||
#include <sys/soundcard.h>
|
||||
+#else
|
||||
+#include <sys/types.h>
|
||||
+#include <sys/audioio.h>
|
||||
+#endif
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/ioctl.h>
|
||||
@@ -47,9 +56,18 @@ static int audio_open(AudioData *s, int
|
||||
int tmp, err;
|
||||
char *flip = getenv("AUDIO_FLIP_LEFT");
|
||||
|
||||
+#ifdef USE_SUNAUDIO
|
||||
+ audio_info_t info;
|
||||
+ struct audio_prinfo *settings;
|
||||
+ int mixer_fd;
|
||||
+
|
||||
+ if (!audio_device)
|
||||
+ audio_device = "/dev/audio";
|
||||
+#else
|
||||
/* open linux audio device */
|
||||
if (!audio_device)
|
||||
audio_device = "/dev/dsp";
|
||||
+#endif
|
||||
|
||||
if (is_output)
|
||||
audio_fd = open(audio_device, O_WRONLY);
|
||||
@@ -77,6 +95,7 @@ static int audio_open(AudioData *s, int
|
||||
}
|
||||
#endif
|
||||
|
||||
+#ifndef USE_SUNAUDIO
|
||||
/* select format : favour native format */
|
||||
err = ioctl(audio_fd, SNDCTL_DSP_GETFMTS, &tmp);
|
||||
|
||||
@@ -124,14 +143,114 @@ static int audio_open(AudioData *s, int
|
||||
}
|
||||
if (tmp)
|
||||
s->channels = 2;
|
||||
+#else /* USE_SUNAUDIO */
|
||||
+ AUDIO_INITINFO(&info);
|
||||
+ if (!is_output) {
|
||||
+ info.mode = AUMODE_RECORD;
|
||||
+ settings = &info.record;
|
||||
+ } else {
|
||||
+ info.mode = AUMODE_PLAY;
|
||||
+ settings = &info.play;
|
||||
+ }
|
||||
+
|
||||
+ /* select format */
|
||||
+ /* Try native 16 bit format first */
|
||||
+#ifdef WORDS_BIGENDIAN
|
||||
+ settings->encoding = AUDIO_ENCODING_SLINEAR_BE;
|
||||
+ s->codec_id = CODEC_ID_PCM_S16BE;
|
||||
+#else
|
||||
+ settings->encoding = AUDIO_ENCODING_SLINEAR_LE;
|
||||
+ s->codec_id = CODEC_ID_PCM_S16LE;
|
||||
+#endif
|
||||
+ settings->precision = 16;
|
||||
+ err = ioctl(audio_fd, AUDIO_SETINFO, &info);
|
||||
+ if (err < 0) {
|
||||
+ fprintf(stderr, "Soundcard does not support signed 16 bit sample format\n");
|
||||
+ close(audio_fd);
|
||||
+ return -EIO;
|
||||
+ }
|
||||
|
||||
+ /* set channels */
|
||||
+ AUDIO_INITINFO(&info);
|
||||
+ settings->channels = s->channels;
|
||||
+ err = ioctl(audio_fd, AUDIO_SETINFO, &info);
|
||||
+ if (err < 0) {
|
||||
+ fprintf(stderr, "stereo not supported, using mono");
|
||||
+ }
|
||||
+
|
||||
+ /* set gain */
|
||||
+ AUDIO_INITINFO(&info);
|
||||
+ settings->gain = AUDIO_MAX_GAIN;
|
||||
+ err = ioctl(audio_fd, AUDIO_SETINFO, &info);
|
||||
+ if (err < 0) {
|
||||
+ fprintf(stderr, "setting gain to %d failed", AUDIO_MAX_GAIN);
|
||||
+ }
|
||||
+
|
||||
+#ifndef MIXER_DEVICE
|
||||
+#define MIXER_DEVICE "/dev/mixer"
|
||||
+#endif
|
||||
+ if ((mixer_fd=open(MIXER_DEVICE, O_RDONLY)) == -1)
|
||||
+ fprintf(stderr, "can't open %s\n", MIXER_DEVICE);
|
||||
+ else {
|
||||
+ int n;
|
||||
+ mixer_devinfo_t mdt;
|
||||
+ /* get debuggin information about all mixer devices */
|
||||
+ mdt.index = n = 0;
|
||||
+ while (ioctl(mixer_fd, AUDIO_MIXER_DEVINFO, &mdt) != -1) {
|
||||
+ if (strcasecmp(mdt.label.name, "inputs") == 0) {
|
||||
+ while (mdt.next != -1) {
|
||||
+ printf("Mixer device %d: `%s' has type %d, class %d\n",
|
||||
+ mdt.index, mdt.label.name, mdt.type,
|
||||
+ mdt.mixer_class);
|
||||
+ mdt.index = mdt.next;
|
||||
+ if (ioctl(mixer_fd, AUDIO_MIXER_DEVINFO, &mdt) == -1) {
|
||||
+ fprintf(stderr, "getting next mixer device "
|
||||
+ "failed (%d)", mdt.index);
|
||||
+ break;
|
||||
+ }
|
||||
+ printf("next device: ");
|
||||
+ }
|
||||
+ printf("Mixer device %d: `%s' has type %d, class %d\n",
|
||||
+ mdt.index, mdt.label.name, mdt.type,
|
||||
+ mdt.mixer_class);
|
||||
+ }
|
||||
+ n++;
|
||||
+ mdt.index = n;
|
||||
+ }
|
||||
+ /* set input to line-in */
|
||||
+ AUDIO_INITINFO(&info);
|
||||
+ settings->port = AUDIO_LINE_IN;
|
||||
+ err = ioctl(audio_fd, AUDIO_SETINFO, &info);
|
||||
+ if (err < 0) {
|
||||
+ fprintf(stderr, "setting input to line-in failed");
|
||||
+ }
|
||||
+ }
|
||||
+ close(mixer_fd);
|
||||
+#endif
|
||||
+
|
||||
+#ifndef USE_SUNAUDIO
|
||||
tmp = s->sample_rate;
|
||||
err = ioctl(audio_fd, SNDCTL_DSP_SPEED, &tmp);
|
||||
if (err < 0) {
|
||||
perror("SNDCTL_DSP_SPEED");
|
||||
goto fail;
|
||||
}
|
||||
+
|
||||
s->sample_rate = tmp; /* store real sample rate */
|
||||
+#else
|
||||
+ AUDIO_INITINFO(&info);
|
||||
+ settings->sample_rate = s->sample_rate;
|
||||
+ err = ioctl(audio_fd, AUDIO_SETINFO, &info);
|
||||
+ if (err < 0) {
|
||||
+ fprintf(stderr, "setting sample rate to %d failed", s->sample_rate);
|
||||
+ err = ioctl(audio_fd, AUDIO_GETINFO, &info);
|
||||
+ if (err < 0) {
|
||||
+ perror("AUDIO_GETINFO");
|
||||
+ goto fail;
|
||||
+ }
|
||||
+ s->sample_rate = settings->sample_rate;
|
||||
+ }
|
||||
+#endif
|
||||
s->fd = audio_fd;
|
||||
|
||||
return 0;
|
||||
@@ -240,7 +359,11 @@ static int audio_read_packet(AVFormatCon
|
||||
AudioData *s = s1->priv_data;
|
||||
int ret, bdelay;
|
||||
int64_t cur_time;
|
||||
+#ifndef USE_SUNAUDIO
|
||||
struct audio_buf_info abufi;
|
||||
+#else
|
||||
+ audio_info_t info;
|
||||
+#endif
|
||||
|
||||
if (av_new_packet(pkt, s->frame_size) < 0)
|
||||
return AVERROR_IO;
|
||||
@@ -276,9 +399,15 @@ static int audio_read_packet(AVFormatCon
|
||||
/* compute pts of the start of the packet */
|
||||
cur_time = av_gettime();
|
||||
bdelay = ret;
|
||||
+#ifndef USE_SUNAUDIO
|
||||
if (ioctl(s->fd, SNDCTL_DSP_GETISPACE, &abufi) == 0) {
|
||||
bdelay += abufi.bytes;
|
||||
}
|
||||
+#else
|
||||
+ if (ioctl(s->fd, AUDIO_GETINFO, &info) == 0) {
|
||||
+ bdelay += info.record.seek * (info.record.precision/8);
|
||||
+ }
|
||||
+#endif
|
||||
/* substract time represented by the number of bytes in the audio fifo */
|
||||
cur_time -= (bdelay * 1000000LL) / (s->sample_rate * s->channels);
|
||||
|
Loading…
Reference in a new issue