~medibuntu-maintainers/mplayer/medibuntu.precise

« back to all changes in this revision

Viewing changes to ffmpeg/libavformat/wtv.c

  • Committer: Package Import Robot
  • Author(s): Reinhard Tartler
  • Date: 2012-01-12 22:23:28 UTC
  • mfrom: (0.4.7 sid)
  • mto: This revision was merged to the branch mainline in revision 76.
  • Revision ID: package-import@ubuntu.com-20120112222328-8jqdyodym3p84ygu
Tags: 2:1.0~rc4.dfsg1+svn34540-1
* New upstream snapshot
* upload to unstable

Show diffs side-by-side

added added

removed removed

Lines of Context:
26
26
 */
27
27
 
28
28
#include "libavutil/intreadwrite.h"
29
 
#include "libavutil/intfloat_readwrite.h"
 
29
#include "libavutil/intfloat.h"
30
30
#include "libavutil/dict.h"
31
31
#include "avformat.h"
32
32
#include "internal.h"
33
33
#include "riff.h"
34
34
#include "asf.h"
35
35
#include "mpegts.h"
36
 
#include <strings.h>
37
36
 
38
37
/* Macros for formating GUIDs */
39
38
#define PRI_GUID \
303
302
{
304
303
    WtvFile *wf = pb->opaque;
305
304
    av_free(wf->sectors);
 
305
    av_free(wf);
 
306
    av_free(pb->buffer);
306
307
    av_free(pb);
307
308
}
308
309
 
459
460
 */
460
461
static void oledate_to_iso8601(char *buf, int buf_size, int64_t value)
461
462
{
462
 
    time_t t = 631112400LL + 86400*av_int2dbl(value);
 
463
    time_t t = 631112400LL + 86400*av_int2double(value);
463
464
    strftime(buf, buf_size, "%Y-%m-%d %H:%M:%S", gmtime(&t));
464
465
}
465
466
 
481
482
    if (!filesize)
482
483
        goto done;
483
484
 
484
 
    st = av_new_stream(s, 0);
 
485
    st = avformat_new_stream(s, NULL);
485
486
    if (!st)
486
487
        goto done;
487
488
    av_dict_set(&st->metadata, "title", description, 0);
524
525
        else if (!strcmp(key, "WM/WMRVExpirationDate"))
525
526
            oledate_to_iso8601(buf, buf_size, num);
526
527
        else if (!strcmp(key, "WM/WMRVBitrate"))
527
 
            snprintf(buf, buf_size, "%f", av_int2dbl(num));
 
528
            snprintf(buf, buf_size, "%f", av_int2double(num));
528
529
        else
529
530
            snprintf(buf, buf_size, "%"PRIi64, num);
530
531
    } else if (type == 5 && length == 2) {
626
627
        WtvStream *wst = av_mallocz(sizeof(WtvStream));
627
628
        if (!wst)
628
629
            return NULL;
629
 
        st = av_new_stream(s, sid);
 
630
        st = avformat_new_stream(s, NULL);
630
631
        if (!st)
631
632
            return NULL;
 
633
        st->id = sid;
632
634
        st->priv_data = wst;
633
635
    }
634
636
    st->codec->codec_type = codec_type;
635
637
    st->need_parsing      = AVSTREAM_PARSE_FULL;
636
 
    av_set_pts_info(st, 64, 1, 10000000);
 
638
    avpriv_set_pts_info(st, 64, 1, 10000000);
637
639
    return st;
638
640
}
639
641
 
766
768
 * Parse WTV chunks
767
769
 * @param mode SEEK_TO_DATA or SEEK_TO_PTS
768
770
 * @param seekts timestamp
769
 
 * @param[out] len Length of data chunk
 
771
 * @param[out] len_ptr Length of data chunk
770
772
 * @return stream index of data chunk, or <0 on error
771
773
 */
772
774
static int parse_chunks(AVFormatContext *s, int mode, int64_t seekts, int *len_ptr)
836
838
                buf_size = FFMIN(len - consumed, sizeof(buf));
837
839
                avio_read(pb, buf, buf_size);
838
840
                consumed += buf_size;
839
 
                ff_parse_mpeg2_descriptor(s, st, 0, &pbuf, buf + buf_size, 0, 0, 0, 0);
 
841
                ff_parse_mpeg2_descriptor(s, st, 0, &pbuf, buf + buf_size, NULL, 0, 0, NULL);
840
842
            }
841
843
        } else if (!ff_guidcmp(g, EVENTID_AudioTypeSpanningEvent)) {
842
844
            int stream_index = ff_find_stream_index(s, sid);
1093
1095
static int read_close(AVFormatContext *s)
1094
1096
{
1095
1097
    WtvContext *wtv = s->priv_data;
 
1098
    av_free(wtv->index_entries);
1096
1099
    wtvfile_close(wtv->pb);
1097
1100
    return 0;
1098
1101
}