You've already forked FFmpeg
mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-08-04 22:03:09 +02:00
ogg/flac: implement header packet skip in chained ogg bitstreams.
This commit is contained in:
@@ -27,6 +27,8 @@
|
|||||||
#include "oggdec.h"
|
#include "oggdec.h"
|
||||||
|
|
||||||
#define OGG_FLAC_METADATA_TYPE_STREAMINFO 0x7F
|
#define OGG_FLAC_METADATA_TYPE_STREAMINFO 0x7F
|
||||||
|
#define OGG_FLAC_MAGIC "\177FLAC"
|
||||||
|
#define OGG_FLAC_MAGIC_SIZE sizeof(OGG_FLAC_MAGIC)-1
|
||||||
|
|
||||||
static int
|
static int
|
||||||
flac_header (AVFormatContext * s, int idx)
|
flac_header (AVFormatContext * s, int idx)
|
||||||
@@ -78,6 +80,27 @@ flac_header (AVFormatContext * s, int idx)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
flac_packet (AVFormatContext * s, int idx)
|
||||||
|
{
|
||||||
|
struct ogg *ogg = s->priv_data;
|
||||||
|
struct ogg_stream *os = ogg->streams + idx;
|
||||||
|
|
||||||
|
if (os->psize > OGG_FLAC_MAGIC_SIZE &&
|
||||||
|
!memcmp(
|
||||||
|
os->buf + os->pstart,
|
||||||
|
OGG_FLAC_MAGIC,
|
||||||
|
OGG_FLAC_MAGIC_SIZE))
|
||||||
|
return 1;
|
||||||
|
|
||||||
|
if (os->psize > 0 &&
|
||||||
|
((os->buf[os->pstart] & 0x7F) == FLAC_METADATA_TYPE_VORBIS_COMMENT)) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
old_flac_header (AVFormatContext * s, int idx)
|
old_flac_header (AVFormatContext * s, int idx)
|
||||||
{
|
{
|
||||||
@@ -127,10 +150,11 @@ fail:
|
|||||||
}
|
}
|
||||||
|
|
||||||
const struct ogg_codec ff_flac_codec = {
|
const struct ogg_codec ff_flac_codec = {
|
||||||
.magic = "\177FLAC",
|
.magic = OGG_FLAC_MAGIC,
|
||||||
.magicsize = 5,
|
.magicsize = OGG_FLAC_MAGIC_SIZE,
|
||||||
.header = flac_header,
|
.header = flac_header,
|
||||||
.nb_header = 2,
|
.nb_header = 2,
|
||||||
|
.packet = flac_packet,
|
||||||
};
|
};
|
||||||
|
|
||||||
const struct ogg_codec ff_old_flac_codec = {
|
const struct ogg_codec ff_old_flac_codec = {
|
||||||
|
@@ -5,8 +5,6 @@ Stream ID: 0, frame PTS: 0, metadata: N/A
|
|||||||
Stream ID: 0, packet PTS: 4608, packet DTS: 4608
|
Stream ID: 0, packet PTS: 4608, packet DTS: 4608
|
||||||
Stream ID: 0, frame PTS: 4608, metadata: N/A
|
Stream ID: 0, frame PTS: 4608, metadata: N/A
|
||||||
Stream ID: 0, packet PTS: 0, packet DTS: 0
|
Stream ID: 0, packet PTS: 0, packet DTS: 0
|
||||||
Stream ID: 0, packet PTS: 0, packet DTS: 0
|
|
||||||
Stream ID: 0, packet PTS: 0, packet DTS: 0
|
|
||||||
Stream ID: 0, frame PTS: 0, metadata: N/A
|
Stream ID: 0, frame PTS: 0, metadata: N/A
|
||||||
Stream ID: 0, packet PTS: 4608, packet DTS: 4608
|
Stream ID: 0, packet PTS: 4608, packet DTS: 4608
|
||||||
Stream ID: 0, frame PTS: 4608, metadata: N/A
|
Stream ID: 0, frame PTS: 4608, metadata: N/A
|
||||||
|
Reference in New Issue
Block a user