~ubuntu-branches/ubuntu/edgy/gstreamer0.10-ffmpeg/edgy

« back to all changes in this revision

Viewing changes to gst-libs/ext/ffmpeg/libavformat/img.c

  • Committer: Bazaar Package Importer
  • Author(s): Sebastian Dröge
  • Date: 2006-04-01 16:13:43 UTC
  • mto: This revision was merged to the branch mainline in revision 5.
  • Revision ID: james.westby@ubuntu.com-20060401161343-n621cgjlujio0otg
Tags: upstream-0.10.1
Import upstream version 0.10.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
14
14
 *
15
15
 * You should have received a copy of the GNU Lesser General Public
16
16
 * License along with this library; if not, write to the Free Software
17
 
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
17
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18
18
 */
19
19
#include "avformat.h"
20
20
 
39
39
 
40
40
 
41
41
/* return -1 if no image found */
42
 
static int find_image_range(int *pfirst_index, int *plast_index, 
 
42
static int find_image_range(int *pfirst_index, int *plast_index,
43
43
                            const char *path)
44
44
{
45
45
    char buf[1024];
54
54
    }
55
55
    if (first_index == 5)
56
56
        goto fail;
57
 
    
 
57
 
58
58
    /* find the last image */
59
59
    last_index = first_index;
60
60
    for(;;) {
64
64
                range1 = 1;
65
65
            else
66
66
                range1 = 2 * range;
67
 
            if (get_frame_filename(buf, sizeof(buf), path, 
 
67
            if (get_frame_filename(buf, sizeof(buf), path,
68
68
                                   last_index + range1) < 0)
69
69
                goto fail;
70
70
            if (!url_exist(buf))
126
126
    pstrcpy(s->path, sizeof(s->path), s1->filename);
127
127
    s->img_number = 0;
128
128
    s->img_count = 0;
129
 
    
 
129
 
130
130
    /* find format */
131
131
    if (s1->iformat->flags & AVFMT_NOFILE)
132
132
        s->is_pipe = 0;
138
138
    } else {
139
139
        st->codec->time_base= ap->time_base;
140
140
    }
141
 
 
 
141
 
142
142
    if (!s->is_pipe) {
143
143
        if (find_image_range(&first_index, &last_index, s->path) < 0)
144
144
            goto fail;
155
155
    } else {
156
156
        f = &s1->pb;
157
157
    }
158
 
    
 
158
 
159
159
    ret = av_read_image(f, s1->filename, s->img_fmt, read_header_alloc_cb, s);
160
160
    if (ret < 0)
161
161
        goto fail1;
165
165
    } else {
166
166
        url_fseek(f, 0, SEEK_SET);
167
167
    }
168
 
    
 
168
 
169
169
    st->codec->codec_type = CODEC_TYPE_VIDEO;
170
170
    st->codec->codec_id = CODEC_ID_RAWVIDEO;
171
171
    st->codec->width = s->width;
265
265
 
266
266
    if (s->nb_streams != 1)
267
267
        return -1;
268
 
    
 
268
 
269
269
    st = s->streams[0];
270
270
    /* we select the first matching format */
271
271
    for(i=0;i<PIX_FMT_NB;i++) {
292
292
        img->is_pipe = 0;
293
293
    else
294
294
        img->is_pipe = 1;
295
 
        
 
295
 
296
296
    return 0;
297
297
}
298
298
 
308
308
 
309
309
    width = st->codec->width;
310
310
    height = st->codec->height;
311
 
    
 
311
 
312
312
    picture = (AVPicture *)pkt->data;
313
313
 
314
314
    if (!img->is_pipe) {
315
 
        if (get_frame_filename(filename, sizeof(filename), 
 
315
        if (get_frame_filename(filename, sizeof(filename),
316
316
                               img->path, img->img_number) < 0)
317
317
            return AVERROR_IO;
318
318
        pb = &pb1;
406
406
 
407
407
    av_register_input_format(&imagepipe_iformat);
408
408
    av_register_output_format(&imagepipe_oformat);
409
 
    
 
409
 
410
410
    return 0;
411
411
}