2007-03-22 10:44:33 +00:00
|
|
|
/* mpeg.c
|
|
|
|
*
|
|
|
|
* MPEG file format decoder for the Wiretap library.
|
|
|
|
* Written by Shaun Jackman <sjackman@gmail.com>
|
|
|
|
* Copyright 2007 Shaun Jackman
|
|
|
|
*
|
|
|
|
* $Id$
|
|
|
|
*
|
|
|
|
* Wiretap Library
|
|
|
|
* 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
|
2012-06-28 22:56:06 +00:00
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
2007-03-22 10:44:33 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
|
2007-03-22 11:33:18 +00:00
|
|
|
#ifdef HAVE_SYS_TYPES_H
|
|
|
|
#include <sys/types.h>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef HAVE_UNISTD_H
|
|
|
|
#include <unistd.h>
|
|
|
|
#endif
|
|
|
|
|
2007-03-22 10:44:33 +00:00
|
|
|
#include "mpeg.h"
|
2008-05-20 21:51:01 +00:00
|
|
|
#include "wsutil/mpeg-audio.h"
|
2007-03-22 10:44:33 +00:00
|
|
|
|
|
|
|
#include "wtap-int.h"
|
|
|
|
#include "buffer.h"
|
|
|
|
#include "file_wrappers.h"
|
|
|
|
#include <errno.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <time.h>
|
|
|
|
|
|
|
|
#define PES_PREFIX 1
|
|
|
|
#define PES_VALID(n) (((n) >> 8 & 0xffffff) == PES_PREFIX)
|
|
|
|
|
2010-02-26 07:59:54 +00:00
|
|
|
typedef struct {
|
|
|
|
struct wtap_nstime now;
|
|
|
|
time_t t0;
|
|
|
|
} mpeg_t;
|
|
|
|
|
2009-03-09 21:18:55 +00:00
|
|
|
static int
|
2007-03-22 10:44:33 +00:00
|
|
|
mpeg_resync(wtap *wth, int *err, gchar **err_info _U_)
|
|
|
|
{
|
2007-03-22 11:59:39 +00:00
|
|
|
gint64 offset = file_tell(wth->fh);
|
2009-03-09 21:18:55 +00:00
|
|
|
int count = 0;
|
2008-06-23 20:06:20 +00:00
|
|
|
int byte = file_getc(wth->fh);
|
2007-03-22 10:44:33 +00:00
|
|
|
|
2008-06-23 20:06:20 +00:00
|
|
|
while (byte != EOF) {
|
|
|
|
if (byte == 0xff && count > 0) {
|
|
|
|
byte = file_getc(wth->fh);
|
|
|
|
if (byte != EOF && (byte & 0xe0) == 0xe0)
|
2007-03-22 10:44:33 +00:00
|
|
|
break;
|
|
|
|
} else
|
2008-06-23 20:06:20 +00:00
|
|
|
byte = file_getc(wth->fh);
|
2007-03-22 10:44:33 +00:00
|
|
|
count++;
|
|
|
|
}
|
2011-03-31 18:28:52 +00:00
|
|
|
if (file_seek(wth->fh, offset, SEEK_SET, err) == -1)
|
|
|
|
return 0;
|
2007-03-22 10:44:33 +00:00
|
|
|
return count;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2011-04-21 09:41:52 +00:00
|
|
|
mpeg_read_header(wtap *wth, int *err, gchar **err_info, guint32 *n)
|
2007-03-22 10:44:33 +00:00
|
|
|
{
|
|
|
|
int bytes_read;
|
|
|
|
|
|
|
|
errno = WTAP_ERR_CANT_READ;
|
2011-04-06 06:51:19 +00:00
|
|
|
bytes_read = file_read(n, sizeof *n, wth->fh);
|
2007-03-22 10:44:33 +00:00
|
|
|
if (bytes_read != sizeof *n) {
|
2011-04-21 09:41:52 +00:00
|
|
|
*err = file_error(wth->fh, err_info);
|
2007-03-22 10:44:33 +00:00
|
|
|
if (*err == 0 && bytes_read != 0)
|
|
|
|
*err = WTAP_ERR_SHORT_READ;
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
*n = g_ntohl(*n);
|
2007-03-22 11:59:39 +00:00
|
|
|
if (file_seek(wth->fh, -(gint64)(sizeof *n), SEEK_CUR, err) == -1)
|
2007-03-22 10:44:33 +00:00
|
|
|
return -1;
|
|
|
|
return bytes_read;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
2011-09-01 09:43:10 +00:00
|
|
|
mpeg_read_rec_data(FILE_T fh, guint8 *pd, int length, int *err,
|
2011-04-21 09:41:52 +00:00
|
|
|
gchar **err_info)
|
2007-03-22 10:44:33 +00:00
|
|
|
{
|
|
|
|
int bytes_read;
|
|
|
|
|
|
|
|
errno = WTAP_ERR_CANT_READ;
|
2011-04-06 06:51:19 +00:00
|
|
|
bytes_read = file_read(pd, length, fh);
|
2007-03-22 10:44:33 +00:00
|
|
|
|
|
|
|
if (bytes_read != length) {
|
2011-04-21 09:41:52 +00:00
|
|
|
*err = file_error(fh, err_info);
|
2007-03-22 10:44:33 +00:00
|
|
|
if (*err == 0)
|
|
|
|
*err = WTAP_ERR_SHORT_READ;
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2007-08-21 22:00:06 +00:00
|
|
|
#define SCRHZ 27000000
|
|
|
|
|
2007-03-22 10:44:33 +00:00
|
|
|
static gboolean
|
2011-04-21 09:41:52 +00:00
|
|
|
mpeg_read(wtap *wth, int *err, gchar **err_info, gint64 *data_offset)
|
2007-03-22 10:44:33 +00:00
|
|
|
{
|
2010-02-26 07:59:54 +00:00
|
|
|
mpeg_t *mpeg = (mpeg_t *)wth->priv;
|
2007-03-22 10:44:33 +00:00
|
|
|
guint32 n;
|
|
|
|
int bytes_read = mpeg_read_header(wth, err, err_info, &n);
|
2009-03-09 21:18:55 +00:00
|
|
|
unsigned int packet_size;
|
2010-02-26 07:59:54 +00:00
|
|
|
struct wtap_nstime ts = mpeg->now;
|
2007-03-22 10:44:33 +00:00
|
|
|
|
|
|
|
if (bytes_read == -1)
|
|
|
|
return FALSE;
|
|
|
|
if (PES_VALID(n)) {
|
2007-03-22 11:59:39 +00:00
|
|
|
gint64 offset = file_tell(wth->fh);
|
2007-03-22 10:44:33 +00:00
|
|
|
guint8 stream;
|
|
|
|
|
|
|
|
if (offset == -1)
|
|
|
|
return -1;
|
|
|
|
if (file_seek(wth->fh, 3, SEEK_CUR, err) == -1)
|
|
|
|
return FALSE;
|
|
|
|
|
2011-04-06 06:51:19 +00:00
|
|
|
bytes_read = file_read(&stream, sizeof stream, wth->fh);
|
2007-03-22 10:44:33 +00:00
|
|
|
if (bytes_read != sizeof stream) {
|
2011-04-21 09:41:52 +00:00
|
|
|
*err = file_error(wth->fh, err_info);
|
2007-03-22 10:44:33 +00:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (stream == 0xba) {
|
|
|
|
guint32 pack1;
|
|
|
|
guint32 pack0;
|
|
|
|
guint64 pack;
|
|
|
|
guint8 stuffing;
|
|
|
|
|
2011-04-06 06:51:19 +00:00
|
|
|
bytes_read = file_read(&pack1, sizeof pack1, wth->fh);
|
2007-03-22 10:44:33 +00:00
|
|
|
if (bytes_read != sizeof pack1) {
|
2011-04-21 09:41:52 +00:00
|
|
|
*err = file_error(wth->fh, err_info);
|
2007-03-22 10:44:33 +00:00
|
|
|
if (*err == 0 && bytes_read != 0)
|
|
|
|
*err = WTAP_ERR_SHORT_READ;
|
|
|
|
return FALSE;
|
|
|
|
}
|
2011-04-06 06:51:19 +00:00
|
|
|
bytes_read = file_read(&pack0, sizeof pack0, wth->fh);
|
2007-03-22 10:44:33 +00:00
|
|
|
if (bytes_read != sizeof pack0) {
|
2011-04-21 09:41:52 +00:00
|
|
|
*err = file_error(wth->fh, err_info);
|
2007-03-22 10:44:33 +00:00
|
|
|
if (*err == 0 && bytes_read != 0)
|
|
|
|
*err = WTAP_ERR_SHORT_READ;
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
pack = (guint64)g_ntohl(pack1) << 32 | g_ntohl(pack0);
|
|
|
|
|
|
|
|
switch (pack >> 62) {
|
|
|
|
case 1:
|
|
|
|
if (file_seek(wth->fh, 1, SEEK_CUR, err) == -1)
|
|
|
|
return FALSE;
|
|
|
|
bytes_read = file_read(&stuffing,
|
2011-04-06 06:51:19 +00:00
|
|
|
sizeof stuffing, wth->fh);
|
2007-03-22 10:44:33 +00:00
|
|
|
if (bytes_read != sizeof stuffing) {
|
2011-04-21 09:41:52 +00:00
|
|
|
*err = file_error(wth->fh, err_info);
|
2007-03-22 10:44:33 +00:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
stuffing &= 0x07;
|
|
|
|
packet_size = 14 + stuffing;
|
|
|
|
|
2007-08-21 22:00:06 +00:00
|
|
|
{
|
|
|
|
guint64 bytes = pack >> 16;
|
2008-06-23 20:06:20 +00:00
|
|
|
guint64 ts_val =
|
2007-08-21 22:00:06 +00:00
|
|
|
(bytes >> 43 & 0x0007) << 30 |
|
|
|
|
(bytes >> 27 & 0x7fff) << 15 |
|
|
|
|
(bytes >> 11 & 0x7fff) << 0;
|
2013-01-04 05:22:43 +00:00
|
|
|
guint ext = (guint)((bytes >> 1) & 0x1ff);
|
2008-06-23 20:06:20 +00:00
|
|
|
guint64 cr = 300 * ts_val + ext;
|
2013-01-04 05:22:43 +00:00
|
|
|
guint rem = (guint)(cr % SCRHZ);
|
2010-02-26 07:59:54 +00:00
|
|
|
mpeg->now.secs
|
|
|
|
= mpeg->t0 + (time_t)(cr / SCRHZ);
|
|
|
|
mpeg->now.nsecs
|
2007-08-22 02:45:42 +00:00
|
|
|
= (int)(G_GINT64_CONSTANT(1000000000) * rem / SCRHZ);
|
2007-08-21 22:00:06 +00:00
|
|
|
}
|
2010-02-26 07:59:54 +00:00
|
|
|
ts = mpeg->now;
|
2007-03-22 10:44:33 +00:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
packet_size = 12;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
guint16 length;
|
2011-04-06 06:51:19 +00:00
|
|
|
bytes_read = file_read(&length, sizeof length, wth->fh);
|
2007-03-22 10:44:33 +00:00
|
|
|
if (bytes_read != sizeof length) {
|
2011-04-21 09:41:52 +00:00
|
|
|
*err = file_error(wth->fh, err_info);
|
2007-03-22 10:44:33 +00:00
|
|
|
if (*err == 0 && bytes_read != 0)
|
|
|
|
*err = WTAP_ERR_SHORT_READ;
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
length = g_ntohs(length);
|
|
|
|
packet_size = 6 + length;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (file_seek(wth->fh, offset, SEEK_SET, err) == -1)
|
|
|
|
return FALSE;
|
|
|
|
} else {
|
|
|
|
struct mpa mpa;
|
|
|
|
|
|
|
|
MPA_UNMARSHAL(&mpa, n);
|
|
|
|
if (MPA_VALID(&mpa)) {
|
|
|
|
packet_size = MPA_BYTES(&mpa);
|
2010-02-26 07:59:54 +00:00
|
|
|
mpeg->now.nsecs += MPA_DURATION_NS(&mpa);
|
|
|
|
if (mpeg->now.nsecs >= 1000000000) {
|
|
|
|
mpeg->now.secs++;
|
|
|
|
mpeg->now.nsecs -= 1000000000;
|
2007-03-22 10:44:33 +00:00
|
|
|
}
|
|
|
|
} else {
|
|
|
|
packet_size = mpeg_resync(wth, err, err_info);
|
|
|
|
if (packet_size == 0)
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
}
|
2012-05-04 16:56:18 +00:00
|
|
|
*data_offset = file_tell(wth->fh);
|
2007-03-22 10:44:33 +00:00
|
|
|
|
|
|
|
buffer_assure_space(wth->frame_buffer, packet_size);
|
|
|
|
if (!mpeg_read_rec_data(wth->fh, buffer_start_ptr(wth->frame_buffer),
|
2011-04-21 09:41:52 +00:00
|
|
|
packet_size, err, err_info))
|
2007-03-22 10:44:33 +00:00
|
|
|
return FALSE;
|
2012-03-02 10:17:36 +00:00
|
|
|
/* XXX - relative, not absolute, time stamps */
|
|
|
|
wth->phdr.presence_flags = WTAP_HAS_TS;
|
2007-03-22 10:44:33 +00:00
|
|
|
wth->phdr.ts = ts;
|
|
|
|
wth->phdr.caplen = packet_size;
|
|
|
|
wth->phdr.len = packet_size;
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
mpeg_seek_read(wtap *wth, gint64 seek_off,
|
2012-10-16 21:50:57 +00:00
|
|
|
struct wtap_pkthdr *phdr _U_, guint8 *pd, int length,
|
2011-04-21 09:41:52 +00:00
|
|
|
int *err, gchar **err_info)
|
2007-03-22 10:44:33 +00:00
|
|
|
{
|
|
|
|
if (file_seek(wth->random_fh, seek_off, SEEK_SET, err) == -1)
|
|
|
|
return FALSE;
|
2011-04-21 09:41:52 +00:00
|
|
|
return mpeg_read_rec_data(wth->random_fh, pd, length, err, err_info);
|
2007-03-22 10:44:33 +00:00
|
|
|
}
|
|
|
|
|
2007-03-25 19:00:59 +00:00
|
|
|
struct _mpeg_magic {
|
|
|
|
size_t len;
|
2007-04-21 22:58:03 +00:00
|
|
|
const gchar* match;
|
2007-03-25 19:00:59 +00:00
|
|
|
} magic[] = {
|
2007-08-06 22:34:26 +00:00
|
|
|
{ 3, "TAG" }, /* ID3v1 */
|
|
|
|
{ 3, "ID3" }, /* ID3v2 */
|
|
|
|
{ 3, "\0\0\1" }, /* MPEG PES */
|
2008-07-09 19:15:50 +00:00
|
|
|
{ 2, "\xff\xfb" }, /* MP3, taken from http://en.wikipedia.org/wiki/MP3#File_structure */
|
2007-08-06 22:34:26 +00:00
|
|
|
{ 0, NULL }
|
2007-03-25 19:00:59 +00:00
|
|
|
};
|
|
|
|
|
2007-03-22 10:44:33 +00:00
|
|
|
int
|
2011-04-21 09:41:52 +00:00
|
|
|
mpeg_open(wtap *wth, int *err, gchar **err_info)
|
2007-03-22 10:44:33 +00:00
|
|
|
{
|
All private data for a capture in a Wiretap module must be per-file, not
static to the module.
Add the older(?) ID tag for MPEG audio.
Just use the ID at the beginning to identify MPEG audio files; don't
check the file any further.
If the read of the magic number doesn't work, get the error, and, if
there is no error (i.e., it's a short read), just return 0 (meaning "no
error, but this isn't that type of file).
Similarly, if the magic number doesn't match, just return 0, so other
types of file are tried.
svn path=/trunk/; revision=21192
2007-03-25 22:07:40 +00:00
|
|
|
int bytes_read;
|
2007-03-25 19:00:59 +00:00
|
|
|
char magic_buf[16];
|
All private data for a capture in a Wiretap module must be per-file, not
static to the module.
Add the older(?) ID tag for MPEG audio.
Just use the ID at the beginning to identify MPEG audio files; don't
check the file any further.
If the read of the magic number doesn't work, get the error, and, if
there is no error (i.e., it's a short read), just return 0 (meaning "no
error, but this isn't that type of file).
Similarly, if the magic number doesn't match, just return 0, so other
types of file are tried.
svn path=/trunk/; revision=21192
2007-03-25 22:07:40 +00:00
|
|
|
struct _mpeg_magic* m;
|
2010-02-26 07:59:54 +00:00
|
|
|
mpeg_t *mpeg;
|
2007-03-25 19:00:59 +00:00
|
|
|
|
All private data for a capture in a Wiretap module must be per-file, not
static to the module.
Add the older(?) ID tag for MPEG audio.
Just use the ID at the beginning to identify MPEG audio files; don't
check the file any further.
If the read of the magic number doesn't work, get the error, and, if
there is no error (i.e., it's a short read), just return 0 (meaning "no
error, but this isn't that type of file).
Similarly, if the magic number doesn't match, just return 0, so other
types of file are tried.
svn path=/trunk/; revision=21192
2007-03-25 22:07:40 +00:00
|
|
|
errno = WTAP_ERR_CANT_READ;
|
2011-04-06 06:51:19 +00:00
|
|
|
bytes_read = file_read(magic_buf, sizeof magic_buf, wth->fh);
|
All private data for a capture in a Wiretap module must be per-file, not
static to the module.
Add the older(?) ID tag for MPEG audio.
Just use the ID at the beginning to identify MPEG audio files; don't
check the file any further.
If the read of the magic number doesn't work, get the error, and, if
there is no error (i.e., it's a short read), just return 0 (meaning "no
error, but this isn't that type of file).
Similarly, if the magic number doesn't match, just return 0, so other
types of file are tried.
svn path=/trunk/; revision=21192
2007-03-25 22:07:40 +00:00
|
|
|
if (bytes_read != (int) sizeof magic_buf) {
|
2011-04-21 09:41:52 +00:00
|
|
|
*err = file_error(wth->fh, err_info);
|
Do not call wtap_file_read_unknown_bytes() or
wtap_file_read_expected_bytes() from an open routine - open routines are
supposed to return -1 on error, 0 if the file doesn't appear to be a
file of the specified type, or 1 if the file does appear to be a file of
the specified type, but those macros will cause the caller to return
FALSE on errors (so that, even if there's an I/O error, it reports "the
file isn't a file of the specified type" rather than "we got an error
trying to read the file").
When doing reads in an open routine before we've concluded that the file
is probably of the right type, return 0, rather than -1, if we get
WTAP_ERR_SHORT_READ - if we don't have enough data to check whether a
file is of a given type, we should keep trying other types, not give up.
For reads done *after* we've concluded the file is probably of the right
type, if a read doesn't return the number of bytes we asked for, but
returns an error of 0, return WTAP_ERR_SHORT_READ - the file is
apparently cut short.
For NetMon and NetXRay/Windows Sniffer files, use a #define for the
magic number size, and use that for both magic numbers.
svn path=/trunk/; revision=46803
2012-12-27 12:19:25 +00:00
|
|
|
if (*err != 0 && *err != WTAP_ERR_SHORT_READ)
|
2007-03-25 19:00:59 +00:00
|
|
|
return -1;
|
All private data for a capture in a Wiretap module must be per-file, not
static to the module.
Add the older(?) ID tag for MPEG audio.
Just use the ID at the beginning to identify MPEG audio files; don't
check the file any further.
If the read of the magic number doesn't work, get the error, and, if
there is no error (i.e., it's a short read), just return 0 (meaning "no
error, but this isn't that type of file).
Similarly, if the magic number doesn't match, just return 0, so other
types of file are tried.
svn path=/trunk/; revision=21192
2007-03-25 22:07:40 +00:00
|
|
|
return 0;
|
2007-03-25 19:00:59 +00:00
|
|
|
}
|
|
|
|
|
2008-07-09 19:15:50 +00:00
|
|
|
for (m=magic; m->match; m++) {
|
|
|
|
if (memcmp(magic_buf, m->match, m->len) == 0)
|
2007-03-25 19:00:59 +00:00
|
|
|
goto good_magic;
|
|
|
|
}
|
|
|
|
|
All private data for a capture in a Wiretap module must be per-file, not
static to the module.
Add the older(?) ID tag for MPEG audio.
Just use the ID at the beginning to identify MPEG audio files; don't
check the file any further.
If the read of the magic number doesn't work, get the error, and, if
there is no error (i.e., it's a short read), just return 0 (meaning "no
error, but this isn't that type of file).
Similarly, if the magic number doesn't match, just return 0, so other
types of file are tried.
svn path=/trunk/; revision=21192
2007-03-25 22:07:40 +00:00
|
|
|
return 0;
|
|
|
|
|
2007-03-25 19:00:59 +00:00
|
|
|
good_magic:
|
All private data for a capture in a Wiretap module must be per-file, not
static to the module.
Add the older(?) ID tag for MPEG audio.
Just use the ID at the beginning to identify MPEG audio files; don't
check the file any further.
If the read of the magic number doesn't work, get the error, and, if
there is no error (i.e., it's a short read), just return 0 (meaning "no
error, but this isn't that type of file).
Similarly, if the magic number doesn't match, just return 0, so other
types of file are tried.
svn path=/trunk/; revision=21192
2007-03-25 22:07:40 +00:00
|
|
|
/* This appears to be a file with MPEG data. */
|
|
|
|
if (file_seek(wth->fh, 0, SEEK_SET, err) == -1)
|
2007-03-22 10:44:33 +00:00
|
|
|
return -1;
|
|
|
|
|
|
|
|
wth->file_type = WTAP_FILE_MPEG;
|
|
|
|
wth->file_encap = WTAP_ENCAP_MPEG;
|
|
|
|
wth->tsprecision = WTAP_FILE_TSPREC_NSEC;
|
|
|
|
wth->subtype_read = mpeg_read;
|
|
|
|
wth->subtype_seek_read = mpeg_seek_read;
|
|
|
|
wth->snapshot_length = 0;
|
All private data for a capture in a Wiretap module must be per-file, not
static to the module.
Add the older(?) ID tag for MPEG audio.
Just use the ID at the beginning to identify MPEG audio files; don't
check the file any further.
If the read of the magic number doesn't work, get the error, and, if
there is no error (i.e., it's a short read), just return 0 (meaning "no
error, but this isn't that type of file).
Similarly, if the magic number doesn't match, just return 0, so other
types of file are tried.
svn path=/trunk/; revision=21192
2007-03-25 22:07:40 +00:00
|
|
|
|
2010-02-26 07:59:54 +00:00
|
|
|
mpeg = (mpeg_t *)g_malloc(sizeof(mpeg_t));
|
|
|
|
wth->priv = (void *)mpeg;
|
2012-02-25 23:24:34 +00:00
|
|
|
mpeg->now.secs = 0;
|
2010-02-26 07:59:54 +00:00
|
|
|
mpeg->now.nsecs = 0;
|
|
|
|
mpeg->t0 = mpeg->now.secs;
|
All private data for a capture in a Wiretap module must be per-file, not
static to the module.
Add the older(?) ID tag for MPEG audio.
Just use the ID at the beginning to identify MPEG audio files; don't
check the file any further.
If the read of the magic number doesn't work, get the error, and, if
there is no error (i.e., it's a short read), just return 0 (meaning "no
error, but this isn't that type of file).
Similarly, if the magic number doesn't match, just return 0, so other
types of file are tried.
svn path=/trunk/; revision=21192
2007-03-25 22:07:40 +00:00
|
|
|
|
2007-03-22 10:44:33 +00:00
|
|
|
return 1;
|
|
|
|
}
|