Mercurial > libavformat.hg
annotate psxstr.c @ 3512:5a60e9f9f5d6 libavformat
unused var
author | michael |
---|---|
date | Thu, 26 Jun 2008 22:23:57 +0000 |
parents | 34a5e6f576fd |
children | cfd3815774ad |
rev | line source |
---|---|
209
7414bbf64011
first pass at PSX STR demuxer; does not yet interact correctly with MDEC
tmmm
parents:
diff
changeset
|
1 /* |
7414bbf64011
first pass at PSX STR demuxer; does not yet interact correctly with MDEC
tmmm
parents:
diff
changeset
|
2 * Sony Playstation (PSX) STR File Demuxer |
7414bbf64011
first pass at PSX STR demuxer; does not yet interact correctly with MDEC
tmmm
parents:
diff
changeset
|
3 * Copyright (c) 2003 The ffmpeg Project |
7414bbf64011
first pass at PSX STR demuxer; does not yet interact correctly with MDEC
tmmm
parents:
diff
changeset
|
4 * |
1358
0899bfe4105c
Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents:
1242
diff
changeset
|
5 * This file is part of FFmpeg. |
0899bfe4105c
Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents:
1242
diff
changeset
|
6 * |
0899bfe4105c
Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents:
1242
diff
changeset
|
7 * FFmpeg is free software; you can redistribute it and/or |
209
7414bbf64011
first pass at PSX STR demuxer; does not yet interact correctly with MDEC
tmmm
parents:
diff
changeset
|
8 * modify it under the terms of the GNU Lesser General Public |
7414bbf64011
first pass at PSX STR demuxer; does not yet interact correctly with MDEC
tmmm
parents:
diff
changeset
|
9 * License as published by the Free Software Foundation; either |
1358
0899bfe4105c
Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents:
1242
diff
changeset
|
10 * version 2.1 of the License, or (at your option) any later version. |
209
7414bbf64011
first pass at PSX STR demuxer; does not yet interact correctly with MDEC
tmmm
parents:
diff
changeset
|
11 * |
1358
0899bfe4105c
Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents:
1242
diff
changeset
|
12 * FFmpeg is distributed in the hope that it will be useful, |
209
7414bbf64011
first pass at PSX STR demuxer; does not yet interact correctly with MDEC
tmmm
parents:
diff
changeset
|
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
7414bbf64011
first pass at PSX STR demuxer; does not yet interact correctly with MDEC
tmmm
parents:
diff
changeset
|
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
7414bbf64011
first pass at PSX STR demuxer; does not yet interact correctly with MDEC
tmmm
parents:
diff
changeset
|
15 * Lesser General Public License for more details. |
7414bbf64011
first pass at PSX STR demuxer; does not yet interact correctly with MDEC
tmmm
parents:
diff
changeset
|
16 * |
7414bbf64011
first pass at PSX STR demuxer; does not yet interact correctly with MDEC
tmmm
parents:
diff
changeset
|
17 * You should have received a copy of the GNU Lesser General Public |
1358
0899bfe4105c
Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents:
1242
diff
changeset
|
18 * License along with FFmpeg; if not, write to the Free Software |
896
edbe5c3717f9
Update licensing information: The FSF changed postal address.
diego
parents:
885
diff
changeset
|
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
209
7414bbf64011
first pass at PSX STR demuxer; does not yet interact correctly with MDEC
tmmm
parents:
diff
changeset
|
20 */ |
7414bbf64011
first pass at PSX STR demuxer; does not yet interact correctly with MDEC
tmmm
parents:
diff
changeset
|
21 |
7414bbf64011
first pass at PSX STR demuxer; does not yet interact correctly with MDEC
tmmm
parents:
diff
changeset
|
22 /** |
7414bbf64011
first pass at PSX STR demuxer; does not yet interact correctly with MDEC
tmmm
parents:
diff
changeset
|
23 * @file psxstr.c |
7414bbf64011
first pass at PSX STR demuxer; does not yet interact correctly with MDEC
tmmm
parents:
diff
changeset
|
24 * PSX STR file demuxer |
7414bbf64011
first pass at PSX STR demuxer; does not yet interact correctly with MDEC
tmmm
parents:
diff
changeset
|
25 * by Mike Melanson (melanson@pcisys.net) |
7414bbf64011
first pass at PSX STR demuxer; does not yet interact correctly with MDEC
tmmm
parents:
diff
changeset
|
26 * This module handles streams that have been ripped from Sony Playstation |
7414bbf64011
first pass at PSX STR demuxer; does not yet interact correctly with MDEC
tmmm
parents:
diff
changeset
|
27 * CD games. This demuxer can handle either raw STR files (which are just |
7414bbf64011
first pass at PSX STR demuxer; does not yet interact correctly with MDEC
tmmm
parents:
diff
changeset
|
28 * concatenations of raw compact disc sectors) or STR files with 0x2C-byte |
7414bbf64011
first pass at PSX STR demuxer; does not yet interact correctly with MDEC
tmmm
parents:
diff
changeset
|
29 * RIFF headers, followed by CD sectors. |
7414bbf64011
first pass at PSX STR demuxer; does not yet interact correctly with MDEC
tmmm
parents:
diff
changeset
|
30 */ |
7414bbf64011
first pass at PSX STR demuxer; does not yet interact correctly with MDEC
tmmm
parents:
diff
changeset
|
31 |
7414bbf64011
first pass at PSX STR demuxer; does not yet interact correctly with MDEC
tmmm
parents:
diff
changeset
|
32 #include "avformat.h" |
7414bbf64011
first pass at PSX STR demuxer; does not yet interact correctly with MDEC
tmmm
parents:
diff
changeset
|
33 |
7414bbf64011
first pass at PSX STR demuxer; does not yet interact correctly with MDEC
tmmm
parents:
diff
changeset
|
34 //#define PRINTSTUFF |
7414bbf64011
first pass at PSX STR demuxer; does not yet interact correctly with MDEC
tmmm
parents:
diff
changeset
|
35 |
386
c152849ee643
remove numerous definitions of BE_*/LE_* macros; convert FOURCC_TAG ->
melanson
parents:
370
diff
changeset
|
36 #define RIFF_TAG MKTAG('R', 'I', 'F', 'F') |
c152849ee643
remove numerous definitions of BE_*/LE_* macros; convert FOURCC_TAG ->
melanson
parents:
370
diff
changeset
|
37 #define CDXA_TAG MKTAG('C', 'D', 'X', 'A') |
209
7414bbf64011
first pass at PSX STR demuxer; does not yet interact correctly with MDEC
tmmm
parents:
diff
changeset
|
38 |
7414bbf64011
first pass at PSX STR demuxer; does not yet interact correctly with MDEC
tmmm
parents:
diff
changeset
|
39 #define RAW_CD_SECTOR_SIZE 2352 |
7414bbf64011
first pass at PSX STR demuxer; does not yet interact correctly with MDEC
tmmm
parents:
diff
changeset
|
40 #define RAW_CD_SECTOR_DATA_SIZE 2304 |
7414bbf64011
first pass at PSX STR demuxer; does not yet interact correctly with MDEC
tmmm
parents:
diff
changeset
|
41 #define VIDEO_DATA_CHUNK_SIZE 0x7E0 |
7414bbf64011
first pass at PSX STR demuxer; does not yet interact correctly with MDEC
tmmm
parents:
diff
changeset
|
42 #define VIDEO_DATA_HEADER_SIZE 0x38 |
7414bbf64011
first pass at PSX STR demuxer; does not yet interact correctly with MDEC
tmmm
parents:
diff
changeset
|
43 #define RIFF_HEADER_SIZE 0x2C |
7414bbf64011
first pass at PSX STR demuxer; does not yet interact correctly with MDEC
tmmm
parents:
diff
changeset
|
44 |
7414bbf64011
first pass at PSX STR demuxer; does not yet interact correctly with MDEC
tmmm
parents:
diff
changeset
|
45 #define CDXA_TYPE_MASK 0x0E |
7414bbf64011
first pass at PSX STR demuxer; does not yet interact correctly with MDEC
tmmm
parents:
diff
changeset
|
46 #define CDXA_TYPE_DATA 0x08 |
7414bbf64011
first pass at PSX STR demuxer; does not yet interact correctly with MDEC
tmmm
parents:
diff
changeset
|
47 #define CDXA_TYPE_AUDIO 0x04 |
7414bbf64011
first pass at PSX STR demuxer; does not yet interact correctly with MDEC
tmmm
parents:
diff
changeset
|
48 #define CDXA_TYPE_VIDEO 0x02 |
7414bbf64011
first pass at PSX STR demuxer; does not yet interact correctly with MDEC
tmmm
parents:
diff
changeset
|
49 |
7414bbf64011
first pass at PSX STR demuxer; does not yet interact correctly with MDEC
tmmm
parents:
diff
changeset
|
50 #define STR_MAGIC (0x80010160) |
7414bbf64011
first pass at PSX STR demuxer; does not yet interact correctly with MDEC
tmmm
parents:
diff
changeset
|
51 |
7414bbf64011
first pass at PSX STR demuxer; does not yet interact correctly with MDEC
tmmm
parents:
diff
changeset
|
52 typedef struct StrChannel { |
7414bbf64011
first pass at PSX STR demuxer; does not yet interact correctly with MDEC
tmmm
parents:
diff
changeset
|
53 |
7414bbf64011
first pass at PSX STR demuxer; does not yet interact correctly with MDEC
tmmm
parents:
diff
changeset
|
54 int type; |
7414bbf64011
first pass at PSX STR demuxer; does not yet interact correctly with MDEC
tmmm
parents:
diff
changeset
|
55 #define STR_AUDIO 0 |
7414bbf64011
first pass at PSX STR demuxer; does not yet interact correctly with MDEC
tmmm
parents:
diff
changeset
|
56 #define STR_VIDEO 1 |
7414bbf64011
first pass at PSX STR demuxer; does not yet interact correctly with MDEC
tmmm
parents:
diff
changeset
|
57 |
7414bbf64011
first pass at PSX STR demuxer; does not yet interact correctly with MDEC
tmmm
parents:
diff
changeset
|
58 /* video parameters */ |
7414bbf64011
first pass at PSX STR demuxer; does not yet interact correctly with MDEC
tmmm
parents:
diff
changeset
|
59 int width; |
7414bbf64011
first pass at PSX STR demuxer; does not yet interact correctly with MDEC
tmmm
parents:
diff
changeset
|
60 int height; |
7414bbf64011
first pass at PSX STR demuxer; does not yet interact correctly with MDEC
tmmm
parents:
diff
changeset
|
61 int video_stream_index; |
7414bbf64011
first pass at PSX STR demuxer; does not yet interact correctly with MDEC
tmmm
parents:
diff
changeset
|
62 |
7414bbf64011
first pass at PSX STR demuxer; does not yet interact correctly with MDEC
tmmm
parents:
diff
changeset
|
63 /* audio parameters */ |
7414bbf64011
first pass at PSX STR demuxer; does not yet interact correctly with MDEC
tmmm
parents:
diff
changeset
|
64 int sample_rate; |
7414bbf64011
first pass at PSX STR demuxer; does not yet interact correctly with MDEC
tmmm
parents:
diff
changeset
|
65 int channels; |
7414bbf64011
first pass at PSX STR demuxer; does not yet interact correctly with MDEC
tmmm
parents:
diff
changeset
|
66 int bits; |
7414bbf64011
first pass at PSX STR demuxer; does not yet interact correctly with MDEC
tmmm
parents:
diff
changeset
|
67 int audio_stream_index; |
7414bbf64011
first pass at PSX STR demuxer; does not yet interact correctly with MDEC
tmmm
parents:
diff
changeset
|
68 } StrChannel; |
7414bbf64011
first pass at PSX STR demuxer; does not yet interact correctly with MDEC
tmmm
parents:
diff
changeset
|
69 |
7414bbf64011
first pass at PSX STR demuxer; does not yet interact correctly with MDEC
tmmm
parents:
diff
changeset
|
70 typedef struct StrDemuxContext { |
7414bbf64011
first pass at PSX STR demuxer; does not yet interact correctly with MDEC
tmmm
parents:
diff
changeset
|
71 |
7414bbf64011
first pass at PSX STR demuxer; does not yet interact correctly with MDEC
tmmm
parents:
diff
changeset
|
72 /* a STR file can contain up to 32 channels of data */ |
7414bbf64011
first pass at PSX STR demuxer; does not yet interact correctly with MDEC
tmmm
parents:
diff
changeset
|
73 StrChannel channels[32]; |
7414bbf64011
first pass at PSX STR demuxer; does not yet interact correctly with MDEC
tmmm
parents:
diff
changeset
|
74 |
7414bbf64011
first pass at PSX STR demuxer; does not yet interact correctly with MDEC
tmmm
parents:
diff
changeset
|
75 /* only decode the first audio and video channels encountered */ |
7414bbf64011
first pass at PSX STR demuxer; does not yet interact correctly with MDEC
tmmm
parents:
diff
changeset
|
76 int video_channel; |
7414bbf64011
first pass at PSX STR demuxer; does not yet interact correctly with MDEC
tmmm
parents:
diff
changeset
|
77 int audio_channel; |
7414bbf64011
first pass at PSX STR demuxer; does not yet interact correctly with MDEC
tmmm
parents:
diff
changeset
|
78 |
7414bbf64011
first pass at PSX STR demuxer; does not yet interact correctly with MDEC
tmmm
parents:
diff
changeset
|
79 int64_t pts; |
7414bbf64011
first pass at PSX STR demuxer; does not yet interact correctly with MDEC
tmmm
parents:
diff
changeset
|
80 |
281 | 81 AVPacket tmp_pkt; |
209
7414bbf64011
first pass at PSX STR demuxer; does not yet interact correctly with MDEC
tmmm
parents:
diff
changeset
|
82 } StrDemuxContext; |
7414bbf64011
first pass at PSX STR demuxer; does not yet interact correctly with MDEC
tmmm
parents:
diff
changeset
|
83 |
1242
996ce2a68147
Fix some "'static' is not at beginning of declaration" warnings.
diego
parents:
1169
diff
changeset
|
84 static const char sync_header[12] = {0x00,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x00}; |
281 | 85 |
209
7414bbf64011
first pass at PSX STR demuxer; does not yet interact correctly with MDEC
tmmm
parents:
diff
changeset
|
86 static int str_probe(AVProbeData *p) |
7414bbf64011
first pass at PSX STR demuxer; does not yet interact correctly with MDEC
tmmm
parents:
diff
changeset
|
87 { |
7414bbf64011
first pass at PSX STR demuxer; does not yet interact correctly with MDEC
tmmm
parents:
diff
changeset
|
88 int start; |
7414bbf64011
first pass at PSX STR demuxer; does not yet interact correctly with MDEC
tmmm
parents:
diff
changeset
|
89 |
7414bbf64011
first pass at PSX STR demuxer; does not yet interact correctly with MDEC
tmmm
parents:
diff
changeset
|
90 /* need at least 0x38 bytes to validate */ |
7414bbf64011
first pass at PSX STR demuxer; does not yet interact correctly with MDEC
tmmm
parents:
diff
changeset
|
91 if (p->buf_size < 0x38) |
7414bbf64011
first pass at PSX STR demuxer; does not yet interact correctly with MDEC
tmmm
parents:
diff
changeset
|
92 return 0; |
7414bbf64011
first pass at PSX STR demuxer; does not yet interact correctly with MDEC
tmmm
parents:
diff
changeset
|
93 |
1673 | 94 if ((AV_RL32(&p->buf[0]) == RIFF_TAG) && |
95 (AV_RL32(&p->buf[8]) == CDXA_TAG)) { | |
209
7414bbf64011
first pass at PSX STR demuxer; does not yet interact correctly with MDEC
tmmm
parents:
diff
changeset
|
96 |
7414bbf64011
first pass at PSX STR demuxer; does not yet interact correctly with MDEC
tmmm
parents:
diff
changeset
|
97 /* RIFF header seen; skip 0x2C bytes */ |
7414bbf64011
first pass at PSX STR demuxer; does not yet interact correctly with MDEC
tmmm
parents:
diff
changeset
|
98 start = RIFF_HEADER_SIZE; |
7414bbf64011
first pass at PSX STR demuxer; does not yet interact correctly with MDEC
tmmm
parents:
diff
changeset
|
99 } else |
7414bbf64011
first pass at PSX STR demuxer; does not yet interact correctly with MDEC
tmmm
parents:
diff
changeset
|
100 start = 0; |
7414bbf64011
first pass at PSX STR demuxer; does not yet interact correctly with MDEC
tmmm
parents:
diff
changeset
|
101 |
7414bbf64011
first pass at PSX STR demuxer; does not yet interact correctly with MDEC
tmmm
parents:
diff
changeset
|
102 /* look for CD sync header (00, 0xFF x 10, 00) */ |
281 | 103 if (memcmp(p->buf+start,sync_header,sizeof(sync_header))) |
209
7414bbf64011
first pass at PSX STR demuxer; does not yet interact correctly with MDEC
tmmm
parents:
diff
changeset
|
104 return 0; |
7414bbf64011
first pass at PSX STR demuxer; does not yet interact correctly with MDEC
tmmm
parents:
diff
changeset
|
105 |
7414bbf64011
first pass at PSX STR demuxer; does not yet interact correctly with MDEC
tmmm
parents:
diff
changeset
|
106 /* MPEG files (like those ripped from VCDs) can also look like this; |
7414bbf64011
first pass at PSX STR demuxer; does not yet interact correctly with MDEC
tmmm
parents:
diff
changeset
|
107 * only return half certainty */ |
7414bbf64011
first pass at PSX STR demuxer; does not yet interact correctly with MDEC
tmmm
parents:
diff
changeset
|
108 return 50; |
7414bbf64011
first pass at PSX STR demuxer; does not yet interact correctly with MDEC
tmmm
parents:
diff
changeset
|
109 } |
7414bbf64011
first pass at PSX STR demuxer; does not yet interact correctly with MDEC
tmmm
parents:
diff
changeset
|
110 |
683
095009fc2f35
kill warnings patch by (M«©ns Rullg«©rd <mru inprovide com>)
michael
parents:
482
diff
changeset
|
111 #if 0 |
281 | 112 static void dump(unsigned char *buf,size_t len) |
113 { | |
114 int i; | |
115 for(i=0;i<len;i++) { | |
370
845f9de2c883
av_log() patch by (Michel Bardiaux <mbardiaux at peaktime dot be>)
michael
parents:
281
diff
changeset
|
116 if ((i&15)==0) av_log(NULL, AV_LOG_DEBUG, "%04x ",i); |
845f9de2c883
av_log() patch by (Michel Bardiaux <mbardiaux at peaktime dot be>)
michael
parents:
281
diff
changeset
|
117 av_log(NULL, AV_LOG_DEBUG, "%02x ",buf[i]); |
845f9de2c883
av_log() patch by (Michel Bardiaux <mbardiaux at peaktime dot be>)
michael
parents:
281
diff
changeset
|
118 if ((i&15)==15) av_log(NULL, AV_LOG_DEBUG, "\n"); |
281 | 119 } |
370
845f9de2c883
av_log() patch by (Michel Bardiaux <mbardiaux at peaktime dot be>)
michael
parents:
281
diff
changeset
|
120 av_log(NULL, AV_LOG_DEBUG, "\n"); |
281 | 121 } |
683
095009fc2f35
kill warnings patch by (M«©ns Rullg«©rd <mru inprovide com>)
michael
parents:
482
diff
changeset
|
122 #endif |
281 | 123 |
209
7414bbf64011
first pass at PSX STR demuxer; does not yet interact correctly with MDEC
tmmm
parents:
diff
changeset
|
124 static int str_read_header(AVFormatContext *s, |
7414bbf64011
first pass at PSX STR demuxer; does not yet interact correctly with MDEC
tmmm
parents:
diff
changeset
|
125 AVFormatParameters *ap) |
7414bbf64011
first pass at PSX STR demuxer; does not yet interact correctly with MDEC
tmmm
parents:
diff
changeset
|
126 { |
2771
d52c718e83f9
Use dynamically allocated ByteIOContext in AVFormatContext
andoma
parents:
2274
diff
changeset
|
127 ByteIOContext *pb = s->pb; |
2006 | 128 StrDemuxContext *str = s->priv_data; |
209
7414bbf64011
first pass at PSX STR demuxer; does not yet interact correctly with MDEC
tmmm
parents:
diff
changeset
|
129 AVStream *st; |
7414bbf64011
first pass at PSX STR demuxer; does not yet interact correctly with MDEC
tmmm
parents:
diff
changeset
|
130 unsigned char sector[RAW_CD_SECTOR_SIZE]; |
7414bbf64011
first pass at PSX STR demuxer; does not yet interact correctly with MDEC
tmmm
parents:
diff
changeset
|
131 int start; |
7414bbf64011
first pass at PSX STR demuxer; does not yet interact correctly with MDEC
tmmm
parents:
diff
changeset
|
132 int i; |
7414bbf64011
first pass at PSX STR demuxer; does not yet interact correctly with MDEC
tmmm
parents:
diff
changeset
|
133 int channel; |
7414bbf64011
first pass at PSX STR demuxer; does not yet interact correctly with MDEC
tmmm
parents:
diff
changeset
|
134 |
7414bbf64011
first pass at PSX STR demuxer; does not yet interact correctly with MDEC
tmmm
parents:
diff
changeset
|
135 /* initialize context members */ |
7414bbf64011
first pass at PSX STR demuxer; does not yet interact correctly with MDEC
tmmm
parents:
diff
changeset
|
136 str->pts = 0; |
7414bbf64011
first pass at PSX STR demuxer; does not yet interact correctly with MDEC
tmmm
parents:
diff
changeset
|
137 str->audio_channel = -1; /* assume to audio or video */ |
7414bbf64011
first pass at PSX STR demuxer; does not yet interact correctly with MDEC
tmmm
parents:
diff
changeset
|
138 str->video_channel = -1; |
7414bbf64011
first pass at PSX STR demuxer; does not yet interact correctly with MDEC
tmmm
parents:
diff
changeset
|
139 |
7414bbf64011
first pass at PSX STR demuxer; does not yet interact correctly with MDEC
tmmm
parents:
diff
changeset
|
140 |
7414bbf64011
first pass at PSX STR demuxer; does not yet interact correctly with MDEC
tmmm
parents:
diff
changeset
|
141 /* skip over any RIFF header */ |
7414bbf64011
first pass at PSX STR demuxer; does not yet interact correctly with MDEC
tmmm
parents:
diff
changeset
|
142 if (get_buffer(pb, sector, RIFF_HEADER_SIZE) != RIFF_HEADER_SIZE) |
2274
b21c2af60bc9
Replace all occurrences of AVERROR_IO with AVERROR(EIO).
takis
parents:
2273
diff
changeset
|
143 return AVERROR(EIO); |
1673 | 144 if (AV_RL32(§or[0]) == RIFF_TAG) |
209
7414bbf64011
first pass at PSX STR demuxer; does not yet interact correctly with MDEC
tmmm
parents:
diff
changeset
|
145 start = RIFF_HEADER_SIZE; |
7414bbf64011
first pass at PSX STR demuxer; does not yet interact correctly with MDEC
tmmm
parents:
diff
changeset
|
146 else |
7414bbf64011
first pass at PSX STR demuxer; does not yet interact correctly with MDEC
tmmm
parents:
diff
changeset
|
147 start = 0; |
7414bbf64011
first pass at PSX STR demuxer; does not yet interact correctly with MDEC
tmmm
parents:
diff
changeset
|
148 |
7414bbf64011
first pass at PSX STR demuxer; does not yet interact correctly with MDEC
tmmm
parents:
diff
changeset
|
149 url_fseek(pb, start, SEEK_SET); |
7414bbf64011
first pass at PSX STR demuxer; does not yet interact correctly with MDEC
tmmm
parents:
diff
changeset
|
150 |
7414bbf64011
first pass at PSX STR demuxer; does not yet interact correctly with MDEC
tmmm
parents:
diff
changeset
|
151 /* check through the first 32 sectors for individual channels */ |
7414bbf64011
first pass at PSX STR demuxer; does not yet interact correctly with MDEC
tmmm
parents:
diff
changeset
|
152 for (i = 0; i < 32; i++) { |
7414bbf64011
first pass at PSX STR demuxer; does not yet interact correctly with MDEC
tmmm
parents:
diff
changeset
|
153 if (get_buffer(pb, sector, RAW_CD_SECTOR_SIZE) != RAW_CD_SECTOR_SIZE) |
2274
b21c2af60bc9
Replace all occurrences of AVERROR_IO with AVERROR(EIO).
takis
parents:
2273
diff
changeset
|
154 return AVERROR(EIO); |
209
7414bbf64011
first pass at PSX STR demuxer; does not yet interact correctly with MDEC
tmmm
parents:
diff
changeset
|
155 |
281 | 156 //printf("%02x %02x %02x %02x\n",sector[0x10],sector[0x11],sector[0x12],sector[0x13]); |
157 | |
209
7414bbf64011
first pass at PSX STR demuxer; does not yet interact correctly with MDEC
tmmm
parents:
diff
changeset
|
158 channel = sector[0x11]; |
7414bbf64011
first pass at PSX STR demuxer; does not yet interact correctly with MDEC
tmmm
parents:
diff
changeset
|
159 if (channel >= 32) |
7414bbf64011
first pass at PSX STR demuxer; does not yet interact correctly with MDEC
tmmm
parents:
diff
changeset
|
160 return AVERROR_INVALIDDATA; |
7414bbf64011
first pass at PSX STR demuxer; does not yet interact correctly with MDEC
tmmm
parents:
diff
changeset
|
161 |
7414bbf64011
first pass at PSX STR demuxer; does not yet interact correctly with MDEC
tmmm
parents:
diff
changeset
|
162 switch (sector[0x12] & CDXA_TYPE_MASK) { |
7414bbf64011
first pass at PSX STR demuxer; does not yet interact correctly with MDEC
tmmm
parents:
diff
changeset
|
163 |
7414bbf64011
first pass at PSX STR demuxer; does not yet interact correctly with MDEC
tmmm
parents:
diff
changeset
|
164 case CDXA_TYPE_DATA: |
7414bbf64011
first pass at PSX STR demuxer; does not yet interact correctly with MDEC
tmmm
parents:
diff
changeset
|
165 case CDXA_TYPE_VIDEO: |
7414bbf64011
first pass at PSX STR demuxer; does not yet interact correctly with MDEC
tmmm
parents:
diff
changeset
|
166 /* check if this channel gets to be the dominant video channel */ |
7414bbf64011
first pass at PSX STR demuxer; does not yet interact correctly with MDEC
tmmm
parents:
diff
changeset
|
167 if (str->video_channel == -1) { |
7414bbf64011
first pass at PSX STR demuxer; does not yet interact correctly with MDEC
tmmm
parents:
diff
changeset
|
168 /* qualify the magic number */ |
1673 | 169 if (AV_RL32(§or[0x18]) != STR_MAGIC) |
209
7414bbf64011
first pass at PSX STR demuxer; does not yet interact correctly with MDEC
tmmm
parents:
diff
changeset
|
170 break; |
7414bbf64011
first pass at PSX STR demuxer; does not yet interact correctly with MDEC
tmmm
parents:
diff
changeset
|
171 str->video_channel = channel; |
7414bbf64011
first pass at PSX STR demuxer; does not yet interact correctly with MDEC
tmmm
parents:
diff
changeset
|
172 str->channels[channel].type = STR_VIDEO; |
1673 | 173 str->channels[channel].width = AV_RL16(§or[0x28]); |
174 str->channels[channel].height = AV_RL16(§or[0x2A]); | |
209
7414bbf64011
first pass at PSX STR demuxer; does not yet interact correctly with MDEC
tmmm
parents:
diff
changeset
|
175 |
7414bbf64011
first pass at PSX STR demuxer; does not yet interact correctly with MDEC
tmmm
parents:
diff
changeset
|
176 /* allocate a new AVStream */ |
7414bbf64011
first pass at PSX STR demuxer; does not yet interact correctly with MDEC
tmmm
parents:
diff
changeset
|
177 st = av_new_stream(s, 0); |
7414bbf64011
first pass at PSX STR demuxer; does not yet interact correctly with MDEC
tmmm
parents:
diff
changeset
|
178 if (!st) |
2273
7eb456c4ed8a
Replace all occurrences of AVERROR_NOMEM with AVERROR(ENOMEM).
takis
parents:
2006
diff
changeset
|
179 return AVERROR(ENOMEM); |
837
4cf524326a1a
set timebase correctly? this thing is always 15fps?
michael
parents:
820
diff
changeset
|
180 av_set_pts_info(st, 64, 1, 15); |
209
7414bbf64011
first pass at PSX STR demuxer; does not yet interact correctly with MDEC
tmmm
parents:
diff
changeset
|
181 |
7414bbf64011
first pass at PSX STR demuxer; does not yet interact correctly with MDEC
tmmm
parents:
diff
changeset
|
182 str->channels[channel].video_stream_index = st->index; |
7414bbf64011
first pass at PSX STR demuxer; does not yet interact correctly with MDEC
tmmm
parents:
diff
changeset
|
183 |
820
feca73904e67
changing AVCodecContext codec -> *codec in AVStream so additions to AVCodecContext dont randomize AVStream and break binary compatibility
michael
parents:
775
diff
changeset
|
184 st->codec->codec_type = CODEC_TYPE_VIDEO; |
885 | 185 st->codec->codec_id = CODEC_ID_MDEC; |
820
feca73904e67
changing AVCodecContext codec -> *codec in AVStream so additions to AVCodecContext dont randomize AVStream and break binary compatibility
michael
parents:
775
diff
changeset
|
186 st->codec->codec_tag = 0; /* no fourcc */ |
feca73904e67
changing AVCodecContext codec -> *codec in AVStream so additions to AVCodecContext dont randomize AVStream and break binary compatibility
michael
parents:
775
diff
changeset
|
187 st->codec->width = str->channels[channel].width; |
feca73904e67
changing AVCodecContext codec -> *codec in AVStream so additions to AVCodecContext dont randomize AVStream and break binary compatibility
michael
parents:
775
diff
changeset
|
188 st->codec->height = str->channels[channel].height; |
209
7414bbf64011
first pass at PSX STR demuxer; does not yet interact correctly with MDEC
tmmm
parents:
diff
changeset
|
189 } |
7414bbf64011
first pass at PSX STR demuxer; does not yet interact correctly with MDEC
tmmm
parents:
diff
changeset
|
190 break; |
7414bbf64011
first pass at PSX STR demuxer; does not yet interact correctly with MDEC
tmmm
parents:
diff
changeset
|
191 |
7414bbf64011
first pass at PSX STR demuxer; does not yet interact correctly with MDEC
tmmm
parents:
diff
changeset
|
192 case CDXA_TYPE_AUDIO: |
7414bbf64011
first pass at PSX STR demuxer; does not yet interact correctly with MDEC
tmmm
parents:
diff
changeset
|
193 /* check if this channel gets to be the dominant audio channel */ |
7414bbf64011
first pass at PSX STR demuxer; does not yet interact correctly with MDEC
tmmm
parents:
diff
changeset
|
194 if (str->audio_channel == -1) { |
281 | 195 int fmt; |
209
7414bbf64011
first pass at PSX STR demuxer; does not yet interact correctly with MDEC
tmmm
parents:
diff
changeset
|
196 str->audio_channel = channel; |
7414bbf64011
first pass at PSX STR demuxer; does not yet interact correctly with MDEC
tmmm
parents:
diff
changeset
|
197 str->channels[channel].type = STR_AUDIO; |
885 | 198 str->channels[channel].channels = |
209
7414bbf64011
first pass at PSX STR demuxer; does not yet interact correctly with MDEC
tmmm
parents:
diff
changeset
|
199 (sector[0x13] & 0x01) ? 2 : 1; |
885 | 200 str->channels[channel].sample_rate = |
209
7414bbf64011
first pass at PSX STR demuxer; does not yet interact correctly with MDEC
tmmm
parents:
diff
changeset
|
201 (sector[0x13] & 0x04) ? 18900 : 37800; |
885 | 202 str->channels[channel].bits = |
209
7414bbf64011
first pass at PSX STR demuxer; does not yet interact correctly with MDEC
tmmm
parents:
diff
changeset
|
203 (sector[0x13] & 0x10) ? 8 : 4; |
281 | 204 |
205 /* allocate a new AVStream */ | |
206 st = av_new_stream(s, 0); | |
207 if (!st) | |
2273
7eb456c4ed8a
Replace all occurrences of AVERROR_NOMEM with AVERROR(ENOMEM).
takis
parents:
2006
diff
changeset
|
208 return AVERROR(ENOMEM); |
837
4cf524326a1a
set timebase correctly? this thing is always 15fps?
michael
parents:
820
diff
changeset
|
209 av_set_pts_info(st, 64, 128, str->channels[channel].sample_rate); |
281 | 210 |
211 str->channels[channel].audio_stream_index = st->index; | |
212 | |
213 fmt = sector[0x13]; | |
820
feca73904e67
changing AVCodecContext codec -> *codec in AVStream so additions to AVCodecContext dont randomize AVStream and break binary compatibility
michael
parents:
775
diff
changeset
|
214 st->codec->codec_type = CODEC_TYPE_AUDIO; |
885 | 215 st->codec->codec_id = CODEC_ID_ADPCM_XA; |
820
feca73904e67
changing AVCodecContext codec -> *codec in AVStream so additions to AVCodecContext dont randomize AVStream and break binary compatibility
michael
parents:
775
diff
changeset
|
216 st->codec->codec_tag = 0; /* no fourcc */ |
feca73904e67
changing AVCodecContext codec -> *codec in AVStream so additions to AVCodecContext dont randomize AVStream and break binary compatibility
michael
parents:
775
diff
changeset
|
217 st->codec->channels = (fmt&1)?2:1; |
feca73904e67
changing AVCodecContext codec -> *codec in AVStream so additions to AVCodecContext dont randomize AVStream and break binary compatibility
michael
parents:
775
diff
changeset
|
218 st->codec->sample_rate = (fmt&4)?18900:37800; |
feca73904e67
changing AVCodecContext codec -> *codec in AVStream so additions to AVCodecContext dont randomize AVStream and break binary compatibility
michael
parents:
775
diff
changeset
|
219 // st->codec->bit_rate = 0; //FIXME; |
feca73904e67
changing AVCodecContext codec -> *codec in AVStream so additions to AVCodecContext dont randomize AVStream and break binary compatibility
michael
parents:
775
diff
changeset
|
220 st->codec->block_align = 128; |
209
7414bbf64011
first pass at PSX STR demuxer; does not yet interact correctly with MDEC
tmmm
parents:
diff
changeset
|
221 } |
7414bbf64011
first pass at PSX STR demuxer; does not yet interact correctly with MDEC
tmmm
parents:
diff
changeset
|
222 break; |
7414bbf64011
first pass at PSX STR demuxer; does not yet interact correctly with MDEC
tmmm
parents:
diff
changeset
|
223 |
7414bbf64011
first pass at PSX STR demuxer; does not yet interact correctly with MDEC
tmmm
parents:
diff
changeset
|
224 default: |
7414bbf64011
first pass at PSX STR demuxer; does not yet interact correctly with MDEC
tmmm
parents:
diff
changeset
|
225 /* ignore */ |
7414bbf64011
first pass at PSX STR demuxer; does not yet interact correctly with MDEC
tmmm
parents:
diff
changeset
|
226 break; |
7414bbf64011
first pass at PSX STR demuxer; does not yet interact correctly with MDEC
tmmm
parents:
diff
changeset
|
227 } |
7414bbf64011
first pass at PSX STR demuxer; does not yet interact correctly with MDEC
tmmm
parents:
diff
changeset
|
228 } |
7414bbf64011
first pass at PSX STR demuxer; does not yet interact correctly with MDEC
tmmm
parents:
diff
changeset
|
229 |
7414bbf64011
first pass at PSX STR demuxer; does not yet interact correctly with MDEC
tmmm
parents:
diff
changeset
|
230 if (str->video_channel != -1) |
370
845f9de2c883
av_log() patch by (Michel Bardiaux <mbardiaux at peaktime dot be>)
michael
parents:
281
diff
changeset
|
231 av_log (s, AV_LOG_DEBUG, " video channel = %d, %d x %d %d\n", str->video_channel, |
209
7414bbf64011
first pass at PSX STR demuxer; does not yet interact correctly with MDEC
tmmm
parents:
diff
changeset
|
232 str->channels[str->video_channel].width, |
281 | 233 str->channels[str->video_channel].height,str->channels[str->video_channel].video_stream_index); |
209
7414bbf64011
first pass at PSX STR demuxer; does not yet interact correctly with MDEC
tmmm
parents:
diff
changeset
|
234 if (str->audio_channel != -1) |
885 | 235 av_log (s, AV_LOG_DEBUG, " audio channel = %d, %d Hz, %d channels, %d bits/sample %d\n", |
281 | 236 str->audio_channel, |
237 str->channels[str->audio_channel].sample_rate, | |
238 str->channels[str->audio_channel].channels, | |
239 str->channels[str->audio_channel].bits,str->channels[str->audio_channel].audio_stream_index); | |
209
7414bbf64011
first pass at PSX STR demuxer; does not yet interact correctly with MDEC
tmmm
parents:
diff
changeset
|
240 |
7414bbf64011
first pass at PSX STR demuxer; does not yet interact correctly with MDEC
tmmm
parents:
diff
changeset
|
241 /* back to the start */ |
7414bbf64011
first pass at PSX STR demuxer; does not yet interact correctly with MDEC
tmmm
parents:
diff
changeset
|
242 url_fseek(pb, start, SEEK_SET); |
7414bbf64011
first pass at PSX STR demuxer; does not yet interact correctly with MDEC
tmmm
parents:
diff
changeset
|
243 |
7414bbf64011
first pass at PSX STR demuxer; does not yet interact correctly with MDEC
tmmm
parents:
diff
changeset
|
244 return 0; |
7414bbf64011
first pass at PSX STR demuxer; does not yet interact correctly with MDEC
tmmm
parents:
diff
changeset
|
245 } |
7414bbf64011
first pass at PSX STR demuxer; does not yet interact correctly with MDEC
tmmm
parents:
diff
changeset
|
246 |
7414bbf64011
first pass at PSX STR demuxer; does not yet interact correctly with MDEC
tmmm
parents:
diff
changeset
|
247 static int str_read_packet(AVFormatContext *s, |
281 | 248 AVPacket *ret_pkt) |
209
7414bbf64011
first pass at PSX STR demuxer; does not yet interact correctly with MDEC
tmmm
parents:
diff
changeset
|
249 { |
2771
d52c718e83f9
Use dynamically allocated ByteIOContext in AVFormatContext
andoma
parents:
2274
diff
changeset
|
250 ByteIOContext *pb = s->pb; |
2006 | 251 StrDemuxContext *str = s->priv_data; |
209
7414bbf64011
first pass at PSX STR demuxer; does not yet interact correctly with MDEC
tmmm
parents:
diff
changeset
|
252 unsigned char sector[RAW_CD_SECTOR_SIZE]; |
7414bbf64011
first pass at PSX STR demuxer; does not yet interact correctly with MDEC
tmmm
parents:
diff
changeset
|
253 int channel; |
281 | 254 AVPacket *pkt; |
209
7414bbf64011
first pass at PSX STR demuxer; does not yet interact correctly with MDEC
tmmm
parents:
diff
changeset
|
255 |
3390 | 256 while (1) { |
209
7414bbf64011
first pass at PSX STR demuxer; does not yet interact correctly with MDEC
tmmm
parents:
diff
changeset
|
257 |
7414bbf64011
first pass at PSX STR demuxer; does not yet interact correctly with MDEC
tmmm
parents:
diff
changeset
|
258 if (get_buffer(pb, sector, RAW_CD_SECTOR_SIZE) != RAW_CD_SECTOR_SIZE) |
2274
b21c2af60bc9
Replace all occurrences of AVERROR_IO with AVERROR(EIO).
takis
parents:
2273
diff
changeset
|
259 return AVERROR(EIO); |
209
7414bbf64011
first pass at PSX STR demuxer; does not yet interact correctly with MDEC
tmmm
parents:
diff
changeset
|
260 |
7414bbf64011
first pass at PSX STR demuxer; does not yet interact correctly with MDEC
tmmm
parents:
diff
changeset
|
261 channel = sector[0x11]; |
7414bbf64011
first pass at PSX STR demuxer; does not yet interact correctly with MDEC
tmmm
parents:
diff
changeset
|
262 if (channel >= 32) |
7414bbf64011
first pass at PSX STR demuxer; does not yet interact correctly with MDEC
tmmm
parents:
diff
changeset
|
263 return AVERROR_INVALIDDATA; |
7414bbf64011
first pass at PSX STR demuxer; does not yet interact correctly with MDEC
tmmm
parents:
diff
changeset
|
264 |
7414bbf64011
first pass at PSX STR demuxer; does not yet interact correctly with MDEC
tmmm
parents:
diff
changeset
|
265 switch (sector[0x12] & CDXA_TYPE_MASK) { |
7414bbf64011
first pass at PSX STR demuxer; does not yet interact correctly with MDEC
tmmm
parents:
diff
changeset
|
266 |
7414bbf64011
first pass at PSX STR demuxer; does not yet interact correctly with MDEC
tmmm
parents:
diff
changeset
|
267 case CDXA_TYPE_DATA: |
7414bbf64011
first pass at PSX STR demuxer; does not yet interact correctly with MDEC
tmmm
parents:
diff
changeset
|
268 case CDXA_TYPE_VIDEO: |
7414bbf64011
first pass at PSX STR demuxer; does not yet interact correctly with MDEC
tmmm
parents:
diff
changeset
|
269 /* check if this the video channel we care about */ |
7414bbf64011
first pass at PSX STR demuxer; does not yet interact correctly with MDEC
tmmm
parents:
diff
changeset
|
270 if (channel == str->video_channel) { |
7414bbf64011
first pass at PSX STR demuxer; does not yet interact correctly with MDEC
tmmm
parents:
diff
changeset
|
271 |
1673 | 272 int current_sector = AV_RL16(§or[0x1C]); |
273 int sector_count = AV_RL16(§or[0x1E]); | |
274 int frame_size = AV_RL32(§or[0x24]); | |
3511 | 275 |
276 if(!( frame_size>=0 | |
277 && current_sector < sector_count | |
278 && sector_count*VIDEO_DATA_CHUNK_SIZE >=frame_size)){ | |
279 av_log(s, AV_LOG_ERROR, "Invalid parameters %d %d %d\n", current_sector, sector_count, frame_size); | |
280 return AVERROR_INVALIDDATA; | |
281 } | |
282 | |
281 | 283 // printf("%d %d %d\n",current_sector,sector_count,frame_size); |
209
7414bbf64011
first pass at PSX STR demuxer; does not yet interact correctly with MDEC
tmmm
parents:
diff
changeset
|
284 /* if this is the first sector of the frame, allocate a pkt */ |
281 | 285 pkt = &str->tmp_pkt; |
3511 | 286 |
287 if(pkt->size != sector_count*VIDEO_DATA_CHUNK_SIZE){ | |
288 if(pkt->data) | |
289 av_log(s, AV_LOG_ERROR, "missmatching sector_count\n"); | |
290 av_free_packet(pkt); | |
291 if (av_new_packet(pkt, sector_count*VIDEO_DATA_CHUNK_SIZE)) | |
2274
b21c2af60bc9
Replace all occurrences of AVERROR_IO with AVERROR(EIO).
takis
parents:
2273
diff
changeset
|
292 return AVERROR(EIO); |
209
7414bbf64011
first pass at PSX STR demuxer; does not yet interact correctly with MDEC
tmmm
parents:
diff
changeset
|
293 |
775 | 294 pkt->pos= url_ftell(pb) - RAW_CD_SECTOR_SIZE; |
885 | 295 pkt->stream_index = |
209
7414bbf64011
first pass at PSX STR demuxer; does not yet interact correctly with MDEC
tmmm
parents:
diff
changeset
|
296 str->channels[channel].video_stream_index; |
281 | 297 // pkt->pts = str->pts; |
209
7414bbf64011
first pass at PSX STR demuxer; does not yet interact correctly with MDEC
tmmm
parents:
diff
changeset
|
298 |
7414bbf64011
first pass at PSX STR demuxer; does not yet interact correctly with MDEC
tmmm
parents:
diff
changeset
|
299 /* if there is no audio, adjust the pts after every video |
7414bbf64011
first pass at PSX STR demuxer; does not yet interact correctly with MDEC
tmmm
parents:
diff
changeset
|
300 * frame; assume 15 fps */ |
7414bbf64011
first pass at PSX STR demuxer; does not yet interact correctly with MDEC
tmmm
parents:
diff
changeset
|
301 if (str->audio_channel != -1) |
7414bbf64011
first pass at PSX STR demuxer; does not yet interact correctly with MDEC
tmmm
parents:
diff
changeset
|
302 str->pts += (90000 / 15); |
7414bbf64011
first pass at PSX STR demuxer; does not yet interact correctly with MDEC
tmmm
parents:
diff
changeset
|
303 } |
7414bbf64011
first pass at PSX STR demuxer; does not yet interact correctly with MDEC
tmmm
parents:
diff
changeset
|
304 |
3511 | 305 memcpy(pkt->data + current_sector*VIDEO_DATA_CHUNK_SIZE, |
306 sector + VIDEO_DATA_HEADER_SIZE, | |
307 VIDEO_DATA_CHUNK_SIZE); | |
308 | |
281 | 309 if (current_sector == sector_count-1) { |
3511 | 310 pkt->size= frame_size; |
281 | 311 *ret_pkt = *pkt; |
3511 | 312 pkt->data= NULL; |
313 pkt->size= -1; | |
281 | 314 return 0; |
315 } | |
209
7414bbf64011
first pass at PSX STR demuxer; does not yet interact correctly with MDEC
tmmm
parents:
diff
changeset
|
316 |
7414bbf64011
first pass at PSX STR demuxer; does not yet interact correctly with MDEC
tmmm
parents:
diff
changeset
|
317 } |
7414bbf64011
first pass at PSX STR demuxer; does not yet interact correctly with MDEC
tmmm
parents:
diff
changeset
|
318 break; |
7414bbf64011
first pass at PSX STR demuxer; does not yet interact correctly with MDEC
tmmm
parents:
diff
changeset
|
319 |
7414bbf64011
first pass at PSX STR demuxer; does not yet interact correctly with MDEC
tmmm
parents:
diff
changeset
|
320 case CDXA_TYPE_AUDIO: |
7414bbf64011
first pass at PSX STR demuxer; does not yet interact correctly with MDEC
tmmm
parents:
diff
changeset
|
321 #ifdef PRINTSTUFF |
7414bbf64011
first pass at PSX STR demuxer; does not yet interact correctly with MDEC
tmmm
parents:
diff
changeset
|
322 printf (" dropping audio sector\n"); |
7414bbf64011
first pass at PSX STR demuxer; does not yet interact correctly with MDEC
tmmm
parents:
diff
changeset
|
323 #endif |
281 | 324 #if 1 |
325 /* check if this the video channel we care about */ | |
326 if (channel == str->audio_channel) { | |
327 pkt = ret_pkt; | |
328 if (av_new_packet(pkt, 2304)) | |
2274
b21c2af60bc9
Replace all occurrences of AVERROR_IO with AVERROR(EIO).
takis
parents:
2273
diff
changeset
|
329 return AVERROR(EIO); |
281 | 330 memcpy(pkt->data,sector+24,2304); |
331 | |
885 | 332 pkt->stream_index = |
281 | 333 str->channels[channel].audio_stream_index; |
334 //pkt->pts = str->pts; | |
335 return 0; | |
336 } | |
337 #endif | |
338 break; | |
209
7414bbf64011
first pass at PSX STR demuxer; does not yet interact correctly with MDEC
tmmm
parents:
diff
changeset
|
339 default: |
7414bbf64011
first pass at PSX STR demuxer; does not yet interact correctly with MDEC
tmmm
parents:
diff
changeset
|
340 /* drop the sector and move on */ |
7414bbf64011
first pass at PSX STR demuxer; does not yet interact correctly with MDEC
tmmm
parents:
diff
changeset
|
341 #ifdef PRINTSTUFF |
7414bbf64011
first pass at PSX STR demuxer; does not yet interact correctly with MDEC
tmmm
parents:
diff
changeset
|
342 printf (" dropping other sector\n"); |
7414bbf64011
first pass at PSX STR demuxer; does not yet interact correctly with MDEC
tmmm
parents:
diff
changeset
|
343 #endif |
7414bbf64011
first pass at PSX STR demuxer; does not yet interact correctly with MDEC
tmmm
parents:
diff
changeset
|
344 break; |
7414bbf64011
first pass at PSX STR demuxer; does not yet interact correctly with MDEC
tmmm
parents:
diff
changeset
|
345 } |
7414bbf64011
first pass at PSX STR demuxer; does not yet interact correctly with MDEC
tmmm
parents:
diff
changeset
|
346 |
7414bbf64011
first pass at PSX STR demuxer; does not yet interact correctly with MDEC
tmmm
parents:
diff
changeset
|
347 if (url_feof(pb)) |
2274
b21c2af60bc9
Replace all occurrences of AVERROR_IO with AVERROR(EIO).
takis
parents:
2273
diff
changeset
|
348 return AVERROR(EIO); |
209
7414bbf64011
first pass at PSX STR demuxer; does not yet interact correctly with MDEC
tmmm
parents:
diff
changeset
|
349 } |
7414bbf64011
first pass at PSX STR demuxer; does not yet interact correctly with MDEC
tmmm
parents:
diff
changeset
|
350 } |
7414bbf64011
first pass at PSX STR demuxer; does not yet interact correctly with MDEC
tmmm
parents:
diff
changeset
|
351 |
7414bbf64011
first pass at PSX STR demuxer; does not yet interact correctly with MDEC
tmmm
parents:
diff
changeset
|
352 static int str_read_close(AVFormatContext *s) |
7414bbf64011
first pass at PSX STR demuxer; does not yet interact correctly with MDEC
tmmm
parents:
diff
changeset
|
353 { |
2006 | 354 StrDemuxContext *str = s->priv_data; |
209
7414bbf64011
first pass at PSX STR demuxer; does not yet interact correctly with MDEC
tmmm
parents:
diff
changeset
|
355 |
7414bbf64011
first pass at PSX STR demuxer; does not yet interact correctly with MDEC
tmmm
parents:
diff
changeset
|
356 return 0; |
7414bbf64011
first pass at PSX STR demuxer; does not yet interact correctly with MDEC
tmmm
parents:
diff
changeset
|
357 } |
7414bbf64011
first pass at PSX STR demuxer; does not yet interact correctly with MDEC
tmmm
parents:
diff
changeset
|
358 |
1169 | 359 AVInputFormat str_demuxer = { |
209
7414bbf64011
first pass at PSX STR demuxer; does not yet interact correctly with MDEC
tmmm
parents:
diff
changeset
|
360 "psxstr", |
3424
7a0230981402
Make long_names in lavf/lavdev optional depending on CONFIG_SMALL.
diego
parents:
3390
diff
changeset
|
361 NULL_IF_CONFIG_SMALL("Sony Playstation STR format"), |
209
7414bbf64011
first pass at PSX STR demuxer; does not yet interact correctly with MDEC
tmmm
parents:
diff
changeset
|
362 sizeof(StrDemuxContext), |
7414bbf64011
first pass at PSX STR demuxer; does not yet interact correctly with MDEC
tmmm
parents:
diff
changeset
|
363 str_probe, |
7414bbf64011
first pass at PSX STR demuxer; does not yet interact correctly with MDEC
tmmm
parents:
diff
changeset
|
364 str_read_header, |
7414bbf64011
first pass at PSX STR demuxer; does not yet interact correctly with MDEC
tmmm
parents:
diff
changeset
|
365 str_read_packet, |
7414bbf64011
first pass at PSX STR demuxer; does not yet interact correctly with MDEC
tmmm
parents:
diff
changeset
|
366 str_read_close, |
7414bbf64011
first pass at PSX STR demuxer; does not yet interact correctly with MDEC
tmmm
parents:
diff
changeset
|
367 }; |