Revision 86074ce3 libavformat/mxf.c

View differences:

libavformat/mxf.c
141 141
    UID content_storage_uid;
142 142
    MXFMetadataSet **metadata_sets;
143 143
    int metadata_sets_count;
144
    uint8_t *sync_key;
144 145
    AVFormatContext *fc;
145 146
} MXFContext;
146 147

  
......
174 175
/* partial keys to match */
175 176
static const uint8_t mxf_header_partition_pack_key[]       = { 0x06,0x0e,0x2b,0x34,0x02,0x05,0x01,0x01,0x0d,0x01,0x02,0x01,0x01,0x02 };
176 177
static const uint8_t mxf_essence_element_key[]             = { 0x06,0x0e,0x2b,0x34,0x01,0x02,0x01,0x01,0x0d,0x01,0x03,0x01 };
178
/* complete keys to match */
179
static const uint8_t mxf_encrypted_triplet_key[]           = { 0x06,0x0e,0x2b,0x34,0x02,0x04,0x01,0x07,0x0d,0x01,0x03,0x01,0x02,0x7e,0x01,0x00 };
177 180

  
178 181
#define IS_KLV_KEY(x, y) (!memcmp(x, y, sizeof(y)))
179 182

  
......
248 251

  
249 252
static int mxf_read_packet(AVFormatContext *s, AVPacket *pkt)
250 253
{
254
    MXFContext *mxf = s->priv_data;
251 255
    KLVPacket klv;
252 256

  
253 257
    while (!url_feof(&s->pb)) {
......
258 262
#ifdef DEBUG
259 263
        PRINT_KEY("read packet", klv.key);
260 264
#endif
265
        if (IS_KLV_KEY(klv.key, mxf_encrypted_triplet_key)) {
266
            mxf->sync_key = mxf_encrypted_triplet_key;
267
            av_log(s, AV_LOG_ERROR, "encrypted triplet not supported\n");
268
            return -1;
269
        }
261 270
        if (IS_KLV_KEY(klv.key, mxf_essence_element_key)) {
262 271
            int index = mxf_get_stream_index(s, &klv);
263 272
            if (index < 0) {
......
856 865
    MXFContext *mxf = s->priv_data;
857 866
    KLVPacket klv;
858 867

  
868
    mxf->sync_key = mxf_essence_element_key;
859 869
    if (!mxf_read_sync(&s->pb, mxf_header_partition_pack_key, 14)) {
860 870
        av_log(s, AV_LOG_ERROR, "could not find header partition pack key\n");
861 871
        return -1;
......
942 952
/* XXX: use MXF Index */
943 953
static int mxf_read_seek(AVFormatContext *s, int stream_index, int64_t sample_time, int flags)
944 954
{
955
    MXFContext *mxf = s->priv_data;
945 956
    AVStream *st = s->streams[stream_index];
946 957
    int64_t seconds;
947 958

  
......
951 962
        sample_time = 0;
952 963
    seconds = av_rescale(sample_time, st->time_base.num, st->time_base.den);
953 964
    url_fseek(&s->pb, (s->bit_rate * seconds) >> 3, SEEK_SET);
954
    if (!mxf_read_sync(&s->pb, mxf_essence_element_key, 12))
965
    if (!mxf_read_sync(&s->pb, mxf->sync_key, 12))
955 966
        return -1;
956 967

  
957 968
    /* found KLV key */

Also available in: Unified diff