lavf: Replace the ASF demuxer

The old one is the result of the reverse engineering and guesswork.
The new one has been written following the now-available specification.

This work is part of Outreach Program for Women Summer 2014 activities
for the Libav project.

The fate references had to be changed because the old demuxer truncates
the last frame in some cases, the new one handles it properly.
The seek-test reference is changed because seeking works differently
in the new demuxer. When seeking, the packet is not read from the stream
directly, but it is rather constructed by the demuxer. That is why
position is -1 now in the reference.

Signed-off-by: Anton Khirnov <anton@khirnov.net>
pull/227/head
Alexandra Hájková 10 years ago committed by Anton Khirnov
parent 441e8ae5ef
commit b08569a239
  1. 1
      Changelog
  2. 21
      libavformat/asf.h
  3. 2530
      libavformat/asfdec.c
  4. 21
      libavformat/asfenc.c
  5. 4
      libavformat/version.h
  6. 1
      tests/ref/fate/wmv8-drm-nodec
  7. 54
      tests/ref/seek/lavf-asf

@ -36,6 +36,7 @@ version <next>:
- Support the extended vp9 profiles in the libvpx wrapper - Support the extended vp9 profiles in the libvpx wrapper
- Hap decoder and encoder - Hap decoder and encoder
- DirectDraw Surface image/texture decoder - DirectDraw Surface image/texture decoder
- rewritten ASF demuxer
version 11: version 11:

@ -28,27 +28,6 @@
#define PACKET_SIZE 3200 #define PACKET_SIZE 3200
typedef struct ASFStream {
int num;
unsigned char seq;
/* use for reading */
AVPacket pkt;
int frag_offset;
int timestamp;
int64_t duration;
int ds_span; /* descrambling */
int ds_packet_size;
int ds_chunk_size;
int64_t packet_pos;
uint16_t stream_language_index;
int palette_changed;
uint32_t palette[256];
} ASFStream;
typedef struct ASFMainHeader { typedef struct ASFMainHeader {
ff_asf_guid guid; ///< generated by client computer ff_asf_guid guid; ///< generated by client computer
uint64_t file_size; /**< in bytes uint64_t file_size; /**< in bytes

File diff suppressed because it is too large Load Diff

@ -185,6 +185,27 @@
#define DATA_HEADER_SIZE 50 #define DATA_HEADER_SIZE 50
typedef struct ASFStream {
int num;
unsigned char seq;
/* use for reading */
AVPacket pkt;
int frag_offset;
int timestamp;
int64_t duration;
int ds_span; /* descrambling */
int ds_packet_size;
int ds_chunk_size;
int64_t packet_pos;
uint16_t stream_language_index;
int palette_changed;
uint32_t palette[256];
} ASFStream;
typedef struct ASFContext { typedef struct ASFContext {
uint32_t seqno; uint32_t seqno;
int is_streamed; int is_streamed;

@ -30,8 +30,8 @@
#include "libavutil/version.h" #include "libavutil/version.h"
#define LIBAVFORMAT_VERSION_MAJOR 56 #define LIBAVFORMAT_VERSION_MAJOR 56
#define LIBAVFORMAT_VERSION_MINOR 20 #define LIBAVFORMAT_VERSION_MINOR 21
#define LIBAVFORMAT_VERSION_MICRO 1 #define LIBAVFORMAT_VERSION_MICRO 0
#define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \ #define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \
LIBAVFORMAT_VERSION_MINOR, \ LIBAVFORMAT_VERSION_MINOR, \

@ -146,7 +146,6 @@
0, 6666, 6666, 41, 1349, 0x02adaaf3 0, 6666, 6666, 41, 1349, 0x02adaaf3
0, 6708, 6708, 41, 1464, 0x20d7cfd2 0, 6708, 6708, 41, 1464, 0x20d7cfd2
0, 6750, 6750, 41, 1377, 0x78e0b1f4 0, 6750, 6750, 41, 1377, 0x78e0b1f4
0, 6791, 6791, 41, 289, 0x1f2e9246
1, 6878, 6878, 0, 1088, 0x678f20fd 1, 6878, 6878, 0, 1088, 0x678f20fd
1, 7161, 7161, 0, 1088, 0x718afa20 1, 7161, 7161, 0, 1088, 0x718afa20
1, 7444, 7444, 0, 1088, 0x758f0939 1, 7444, 7444, 0, 1088, 0x758f0939

@ -1,53 +1,53 @@
ret: 0 st: 1 flags:1 dts: 0.000000 pts: 0.000000 pos: 579 size: 208 ret: 0 st: 1 flags:1 dts: 0.000000 pts: 0.000000 pos: -1 size: 208
ret: 0 st:-1 flags:0 ts:-1.000000 ret: 0 st:-1 flags:0 ts:-1.000000
ret: 0 st: 1 flags:1 dts: 0.470000 pts: 0.470000 pos: 147779 size: 209 ret: 0 st: 1 flags:1 dts: 0.261000 pts: 0.261000 pos: -1 size: 209
ret: 0 st:-1 flags:1 ts: 1.894167 ret: 0 st:-1 flags:1 ts: 1.894167
ret: 0 st: 1 flags:1 dts: 0.941000 pts: 0.941000 pos: 301379 size: 209 ret: 0 st: 1 flags:1 dts: 0.941000 pts: 0.941000 pos: -1 size: 209
ret: 0 st: 0 flags:0 ts: 0.788000 ret: 0 st: 0 flags:0 ts: 0.788000
ret: 0 st: 1 flags:1 dts: 0.941000 pts: 0.941000 pos: 301379 size: 209 ret: 0 st: 1 flags:1 dts: 0.732000 pts: 0.732000 pos: -1 size: 209
ret: 0 st: 0 flags:1 ts:-0.317000 ret: 0 st: 0 flags:1 ts:-0.317000
ret: 0 st: 1 flags:1 dts: 0.000000 pts: 0.000000 pos: 579 size: 208 ret: 0 st: 1 flags:1 dts: 0.000000 pts: 0.000000 pos: -1 size: 208
ret: 0 st: 1 flags:0 ts: 2.577000 ret: 0 st: 1 flags:0 ts: 2.577000
ret: 0 st: 1 flags:1 dts: 0.993000 pts: 0.993000 pos: 330179 size: 209 ret: 0 st: 1 flags:1 dts: 0.941000 pts: 0.941000 pos: -1 size: 209
ret: 0 st: 1 flags:1 ts: 1.471000 ret: 0 st: 1 flags:1 ts: 1.471000
ret: 0 st: 1 flags:1 dts: 0.993000 pts: 0.993000 pos: 330179 size: 209 ret: 0 st: 1 flags:1 dts: 0.941000 pts: 0.941000 pos: -1 size: 209
ret: 0 st:-1 flags:0 ts: 0.365002 ret: 0 st:-1 flags:0 ts: 0.365002
ret: 0 st: 1 flags:1 dts: 0.470000 pts: 0.470000 pos: 147779 size: 209 ret: 0 st: 1 flags:1 dts: 0.261000 pts: 0.261000 pos: -1 size: 209
ret: 0 st:-1 flags:1 ts:-0.740831 ret: 0 st:-1 flags:1 ts:-0.740831
ret: 0 st: 1 flags:1 dts: 0.000000 pts: 0.000000 pos: 579 size: 208 ret: 0 st: 1 flags:1 dts: 0.000000 pts: 0.000000 pos: -1 size: 208
ret: 0 st: 0 flags:0 ts: 2.153000 ret: 0 st: 0 flags:0 ts: 2.153000
ret: 0 st: 1 flags:1 dts: 0.941000 pts: 0.941000 pos: 301379 size: 209 ret: 0 st: 1 flags:1 dts: 0.941000 pts: 0.941000 pos: -1 size: 209
ret: 0 st: 0 flags:1 ts: 1.048000 ret: 0 st: 0 flags:1 ts: 1.048000
ret: 0 st: 1 flags:1 dts: 0.941000 pts: 0.941000 pos: 301379 size: 209 ret: 0 st: 1 flags:1 dts: 0.941000 pts: 0.941000 pos: -1 size: 209
ret: 0 st: 1 flags:0 ts:-0.058000 ret: 0 st: 1 flags:0 ts:-0.058000
ret: 0 st: 1 flags:1 dts: 0.000000 pts: 0.000000 pos: 579 size: 208 ret: 0 st: 1 flags:1 dts: 0.261000 pts: 0.261000 pos: -1 size: 209
ret: 0 st: 1 flags:1 ts: 2.836000 ret: 0 st: 1 flags:1 ts: 2.836000
ret: 0 st: 1 flags:1 dts: 0.993000 pts: 0.993000 pos: 330179 size: 209 ret: 0 st: 1 flags:1 dts: 0.941000 pts: 0.941000 pos: -1 size: 209
ret: 0 st:-1 flags:0 ts: 1.730004 ret: 0 st:-1 flags:0 ts: 1.730004
ret: 0 st: 1 flags:1 dts: 0.941000 pts: 0.941000 pos: 301379 size: 209 ret: 0 st: 1 flags:1 dts: 0.941000 pts: 0.941000 pos: -1 size: 209
ret: 0 st:-1 flags:1 ts: 0.624171 ret: 0 st:-1 flags:1 ts: 0.624171
ret: 0 st: 1 flags:1 dts: 0.470000 pts: 0.470000 pos: 147779 size: 209 ret: 0 st: 1 flags:1 dts: 0.470000 pts: 0.470000 pos: -1 size: 209
ret: 0 st: 0 flags:0 ts:-0.482000 ret: 0 st: 0 flags:0 ts:-0.482000
ret: 0 st: 1 flags:1 dts: 0.000000 pts: 0.000000 pos: 579 size: 208 ret: 0 st: 1 flags:1 dts: 0.000000 pts: 0.000000 pos: -1 size: 208
ret: 0 st: 0 flags:1 ts: 2.413000 ret: 0 st: 0 flags:1 ts: 2.413000
ret: 0 st: 1 flags:1 dts: 0.941000 pts: 0.941000 pos: 301379 size: 209 ret: 0 st: 1 flags:1 dts: 0.732000 pts: 0.732000 pos: -1 size: 209
ret: 0 st: 1 flags:0 ts: 1.307000 ret: 0 st: 1 flags:0 ts: 1.307000
ret: 0 st: 1 flags:1 dts: 0.993000 pts: 0.993000 pos: 330179 size: 209 ret: 0 st: 1 flags:1 dts: 0.941000 pts: 0.941000 pos: -1 size: 209
ret: 0 st: 1 flags:1 ts: 0.201000 ret: 0 st: 1 flags:1 ts: 0.201000
ret: 0 st: 1 flags:1 dts: 0.183000 pts: 0.183000 pos: 70979 size: 209 ret: 0 st: 1 flags:1 dts: 0.000000 pts: 0.000000 pos: -1 size: 208
ret: 0 st:-1 flags:0 ts:-0.904994 ret: 0 st:-1 flags:0 ts:-0.904994
ret: 0 st: 1 flags:1 dts: 0.000000 pts: 0.000000 pos: 579 size: 208 ret: 0 st: 1 flags:1 dts: 0.000000 pts: 0.000000 pos: -1 size: 208
ret: 0 st:-1 flags:1 ts: 1.989173 ret: 0 st:-1 flags:1 ts: 1.989173
ret: 0 st: 1 flags:1 dts: 0.941000 pts: 0.941000 pos: 301379 size: 209 ret: 0 st: 1 flags:1 dts: 0.941000 pts: 0.941000 pos: -1 size: 209
ret: 0 st: 0 flags:0 ts: 0.883000 ret: 0 st: 0 flags:0 ts: 0.883000
ret: 0 st: 1 flags:1 dts: 0.941000 pts: 0.941000 pos: 301379 size: 209 ret: 0 st: 1 flags:1 dts: 0.732000 pts: 0.732000 pos: -1 size: 209
ret: 0 st: 0 flags:1 ts:-0.222000 ret: 0 st: 0 flags:1 ts:-0.222000
ret: 0 st: 1 flags:1 dts: 0.000000 pts: 0.000000 pos: 579 size: 208 ret: 0 st: 1 flags:1 dts: 0.000000 pts: 0.000000 pos: -1 size: 208
ret: 0 st: 1 flags:0 ts: 2.672000 ret: 0 st: 1 flags:0 ts: 2.672000
ret: 0 st: 1 flags:1 dts: 0.993000 pts: 0.993000 pos: 330179 size: 209 ret: 0 st: 1 flags:1 dts: 0.941000 pts: 0.941000 pos: -1 size: 209
ret: 0 st: 1 flags:1 ts: 1.566000 ret: 0 st: 1 flags:1 ts: 1.566000
ret: 0 st: 1 flags:1 dts: 0.993000 pts: 0.993000 pos: 330179 size: 209 ret: 0 st: 1 flags:1 dts: 0.941000 pts: 0.941000 pos: -1 size: 209
ret: 0 st:-1 flags:0 ts: 0.460008 ret: 0 st:-1 flags:0 ts: 0.460008
ret: 0 st: 1 flags:1 dts: 0.470000 pts: 0.470000 pos: 147779 size: 209 ret: 0 st: 1 flags:1 dts: 0.261000 pts: 0.261000 pos: -1 size: 209
ret: 0 st:-1 flags:1 ts:-0.645825 ret: 0 st:-1 flags:1 ts:-0.645825
ret: 0 st: 1 flags:1 dts: 0.000000 pts: 0.000000 pos: 579 size: 208 ret: 0 st: 1 flags:1 dts: 0.000000 pts: 0.000000 pos: -1 size: 208

Loading…
Cancel
Save