summaryrefslogtreecommitdiff
path: root/libavformat/mpeg.c
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <kde@carewolf.com>2006-08-29 12:03:07 +0000
committerGuillaume Poirier <gpoirier@mplayerhq.hu>2006-08-29 12:03:07 +0000
commitc5e331155c35fac218e723a43a6df26e3291b16d (patch)
treedcfe7f4a39f38bac702bebb019aea3c12443756c /libavformat/mpeg.c
parent9dc5607b3cbdad80f2b63a6090c23b2ac9e0e593 (diff)
add support for information in CDXA format
patch by Allan Sandfeld Jensen % kde A carewolf P com % Original thread: Date: Aug 18, 2006 6:33 PM Subject: [Ffmpeg-devel] CDXA in libavformat [patch] Originally committed as revision 6124 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavformat/mpeg.c')
-rw-r--r--libavformat/mpeg.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/libavformat/mpeg.c b/libavformat/mpeg.c
index 1b77b64afa..8846a59fe3 100644
--- a/libavformat/mpeg.c
+++ b/libavformat/mpeg.c
@@ -1260,6 +1260,20 @@ static int mpeg_mux_end(AVFormatContext *ctx)
#define MAX_SYNC_SIZE 100000
+static int cdxa_probe(AVProbeData *p)
+{
+ /* check file header */
+ if (p->buf_size <= 32)
+ return 0;
+ if (p->buf[0] == 'R' && p->buf[1] == 'I' &&
+ p->buf[2] == 'F' && p->buf[3] == 'F' &&
+ p->buf[8] == 'C' && p->buf[9] == 'D' &&
+ p->buf[10] == 'X' && p->buf[11] == 'A')
+ return AVPROBE_SCORE_MAX;
+ else
+ return 0;
+}
+
static int mpegps_probe(AVProbeData *p)
{
uint32_t code= -1;
@@ -1267,6 +1281,10 @@ static int mpegps_probe(AVProbeData *p)
int i;
int score=0;
+ score = cdxa_probe(p);
+ if (score > 0) return score;
+
+ /* Search for MPEG stream */
for(i=0; i<p->buf_size; i++){
code = (code<<8) + p->buf[i];
if ((code & 0xffffff00) == 0x100) {