[Ffmpeg-devel] [PATCH] - fix for missing audio stream in dvr-ms asf files
John Donaghy
johnfdonaghy
Fri Jan 20 20:17:29 CET 2006
The attached patch is for asf.c/asf.h and enables the code to find the
audio stream in dvr-ms files. The audio stream is embedded in the
header extension object (head1_guid) so I took out the '#if 0' like
that causes that whole section to be skipped. It took a bit of
guesswork to discover the audio stream but I knew it had to be there
somewhere. The associated guids for it have not been published so the
names I gave the new guids may not properly convey their meaning.
A dvr-ms file has a couple of extended stream properties objects
embedded in the header extension object. One is the audio and the
other is probably the subtitles but this code only recognises the
audio. Once an extended stream properties is parsed there is a
optional stream object immediately following. Hence I included some
code to just parse the extended stream properties object up to the
start of the optional stream object. That way the stream object gets
picked up on the next iteration if it is present. Since the guid is
not the regular audio guid I added code to process it as an audio
stream header if it matched the right guid.
It all seems to work fine in mplayer and I've also used mencoder to
successfully convert these files into a couple of other formats. I did
all development in mingw and I havent test it in any other
environment. I also havent checked if the changes didnt break regular
asf files cause I dont have any but I can do some of this if required
later.
John
-------------- next part --------------
SW5kZXg6IGxpYmF2Zm9ybWF0L2FzZi5jDQo9PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09DQpSQ1MgZmlsZTogL2N2c3Jvb3QvZmZtcGVnL2ZmbXBlZy9saWJhdmZvcm1hdC9hc2YuYyx2DQpyZXRyaWV2aW5nIHJldmlzaW9uIDEuOTANCmRpZmYgLXUgLXIxLjkwIGFzZi5jDQotLS0gbGliYXZmb3JtYXQvYXNmLmMJMTIgSmFuIDIwMDYgMjI6NDM6MjIgLTAwMDAJMS45MA0KKysrIGxpYmF2Zm9ybWF0L2FzZi5jCTIwIEphbiAyMDA2IDE4OjM5OjI3IC0wMDAwDQpAQCAtNjAsNiArNjAsMTAgQEANCiAgICAgZWxzZSBQUklOVF9JRl9HVUlEKGcsIGhlYWQxX2d1aWQpOw0KICAgICBlbHNlIFBSSU5UX0lGX0dVSUQoZywgaGVhZDJfZ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ENPREVDX1RZUEVfVklERU87DQogICAgICAgICAgICAgfSBlbHNlIGlmICghbWVtY21wKCZnLCAmY29tbWFuZF9zdHJlYW0sIHNpemVvZihHVUlEKSkpIHsNCiAgICAgICAgICAgICAgICAgdHlwZSA9IENPREVDX1RZUEVfVU5LTk9XTjsNCisgICAgICAgICAgICB9IGVsc2UgaWYgKCFtZW1jbXAoJmcsICZleHRfc3RyZWFtX2VtYmVkX3N0cmVhbV9oZWFkZXIsIHNpemVvZihHVUlEKSkpIHsNCisgICAgICAgICAgICAgICAgdGVzdF9mb3JfZXh0X3N0cmVhbV9hdWRpbyA9IDE7DQorICAgICAgICAgICAgICAgIHR5cGUgPSBDT0RFQ19UWVBFX1VOS05PV047DQogICAgICAgICAgICAgfSBlbHNlIHsNCiAgICAgICAgICAgICAgICAgZ290byBmYWlsOw0KICAgICAgICAgICAgIH0NCkBAIC0yMTksNiArMjI5LDIwIEBADQogICAgICAgICAgICAgYXNmLT5hc2ZpZDJhdmlkW3N0LT5pZF0gPSBzLT5uYl9zdHJlYW1zIC0gMTsNCiANCiAgICAgICAgICAgICBnZXRfbGUzMihwYik7DQorDQorICAgICAgICAgICAgaWYgKHRlc3RfZm9yX2V4dF9zdHJlYW1fYXVkaW8pIHsNCisgICAgICAgICAgICAgICAgZ2V0X2d1aWQocGIsICZnKTsNCisgICAgICAgICAgICAgICAgaWYgKCFtZW1jbXAoJmcsICZleHRfc3RyZWFtX2F1ZGlvX3N0cmVhbSwgc2l6ZW9mKEdVSUQpKSkgeyAgICAgICAgICAgIA0KKyAgICAgICAgICAgICAgICAgICAgdHlwZSA9IENPREVDX1RZUEVfQVVESU87DQorICAgICAgICAgICAgICAgICAgICBnZXRfZ3VpZChwYiwgJmcpOw0KKyAgICAgICAgICAgICAgICAgICAgZ2V0X2xlMzIocGIpOw0KKyAgICAgICAgICAgICAgICAgICAgZ2V0X2xlMzIocGIpOw0KKyAgICAgICAgICAgICAgICAgICAgZ2V0X2xlMzIocGIpOw0KKyAgICAgICAgICAgICAgICAgICAgZ2V0X2d1aWQocGIsICZnKTsgICAgICAgICAgICAgICAgDQorICAgICAgICAgICAgICAgICAgICBnZXRfbGUzMihwYik7ICAgICAgICAgICAgICAgICAgICANCisgICAgICAgICAgICAgICAgfQ0KKyAgICAgICAgICAgIH0NCisNCiAgICAgICAgICAgICBzdC0+Y29kZWMtPmNvZGVjX3R5cGUgPSB0eXBlOw0KICAgICAgICAgICAgIGlmICh0eXBlID09IENPREVDX1RZUEVfQVVESU8pIHsNCiAgICAgICAgICAgICAgICAgZ2V0X3dhdl9oZWFkZXIocGIsIHN0LT5jb2RlYywgdHlwZV9zcGVjaWZpY19zaXplKTsNCkBAIC0yNTksNyArMjgzLDcgQEANCiAgICAgICAgICAgICAgICAgICAgIHN0LT5jb2RlYy0+ZnJhbWVfc2l6ZSA9IDE7DQogICAgICAgICAgICAgICAgICAgICBicmVhazsNCiAgICAgICAgICAgICAgICAgfQ0KLSAgICAgICAgICAgIH0gZWxzZSB7DQorICAgICAgICAgICAgfSBlbHNlIGlmICh0eXBlID09IENPREVDX1RZUEVfVklERU8pIHsNCiAgICAgICAgICAgICAgICAgZ2V0X2xlMzIocGIpOw0KICAgICAgICAgICAgICAgICBnZXRfbGUzMihwYik7DQogICAgICAgICAgICAgICAgIGdldF9ieXRlKHBiKTsNCkBAIC0zNDksMTIgKzM3Myw0OSBAQA0KICAgICAgICAgICAgICAgICAgICAgICAgIH0NCiAgICAgICAgICAgICAgICAgICAgICAgICBhdl9mcmVlKG5hbWUpOw0KICAgICAgICAgICAgICAgICB9DQotI2lmIDANCisgICAgICAgIH0gZWxzZSBpZiAoIW1lbWNtcCgmZywgJmV4dF9zdHJlYW1faGVhZGVyLCBzaXplb2YoR1VJRCkpKSB7DQorICAgICAgICAgICAgaW50IGV4dF9sZW4sIHBheWxvYWRfZXh0X2N0LCBzdHJlYW1fY3Q7DQorICAgICAgICAgICAgdWludDMyX3QgZXh0X2Q7DQorICAgICAgICAgICAgaW50NjRfdCBwb3NfZXhfc3QsIHBvc19jdXJyOw0KKyAgICAgICAgICAgIHBvc19leF9zdCA9IHVybF9mdGVsbChwYik7DQorICAgICAgICAgICAgDQorICAgICAgICAgICAgZ2V0X2xlNjQocGIpOw0KKyAgICAgICAgICAgIGdldF9sZTY0KHBiKTsNCisgICAgICAgICAgICBnZXRfbGUzMihwYik7DQorICAgICAgICAgICAgZ2V0X2xlMzIocGIpOw0KKyAgICAgICAgICAgIGdldF9sZTMyKHBiKTsNCisgICAgICAgICAgICBnZXRfbGUzMihwYik7DQorICAgICAgICAgICAgZ2V0X2xlMzIocGIpOw0KKyAgICAgICAgICAgIGdldF9sZTMyKHBiKTsNCisgICAgICAgICAgICBnZXRfbGUzMihwYik7DQorICAgICAgICAgICAgZ2V0X2xlMzIocGIpOw0KKyAgICAgICAgICAgIGdldF9sZTE2KHBiKTsNCisgICAgICAgICAgICBnZXRfbGUxNihwYik7DQorICAgICAgICAgICAgZ2V0X2xlNjQocGIpOw0KKyAgICAgICAgICAgIHN0cmVhbV9jdCA9IGdldF9sZTE2KHBiKTsNCisgICAgICAgICAgICBwYXlsb2FkX2V4dF9jdCA9IGdldF9sZTE2KHBiKTsNCisgICAgICAgICAgICANCisgICAgICAgICAgICBmb3IgKGk9MDsgaTxzdHJlYW1fY3Q7IGkrKyl7DQorICAgICAgICAgICAgICAgIGdldF9sZTE2KHBiKTsNCisgICAgICAgICAgICAgICAgZXh0X2xlbiA9IGdldF9sZTE2KHBiKTsNCisgICAgICAgICAgICAgICAgdXJsX2ZzZWVrKHBiLCBleHRfbGVuLCBTRUVLX0NVUik7DQorICAgICAgICAgICAgfQ0KKyAgICAgICAgICAgIA0KKyAgICAgICAgICAgIGZvciAoaT0wOyBpPHBheWxvYWRfZXh0X2N0OyBpKyspew0KKyAgICAgICAgICAgICAgICBnZXRfZ3VpZChwYiwgJmcpOw0KKyAgICAgICAgICAgICAgICBleHRfZD1nZXRfbGUxNihwYik7DQorICAgICAgICAgICAgICAgIGV4dF9sZW49Z2V0X2xlMzIocGIpOw0KKyAgICAgICAgICAgICAgICB1cmxfZnNlZWsocGIsIGV4dF9sZW4sIFNFRUtfQ1VSKTsNCisgICAgICAgICAgICB9DQorDQorICAgICAgICAgICAgLy8gdGhlcmUgY291bGQgYmUgYSBvcHRpb25hbCBzdHJlYW0gcHJvcGVydGllcyBvYmplY3QgdG8gZm9sbG93DQorICAgICAgICAgICAgLy8gaWYgc28gdGhlIG5leHQgaXRlcmF0aW9uIHdpbGwgcGljayBpdCB1cA0KICAgICAgICAgfSBlbHNlIGlmICghbWVtY21wKCZnLCAmaGVhZDFfZ3VpZCwgc2l6ZW9mKEdVSUQpKSkgew0KICAgICAgICAgICAgIGludCB2MSwgdjI7DQogICAgICAgICAgICAgZ2V0X2d1aWQocGIsICZnKTsNCiAgICAgICAgICAgICB2MSA9IGdldF9sZTMyKHBiKTsNCiAgICAgICAgICAgICB2MiA9IGdldF9sZTE2KHBiKTsNCisjaWYgMA0KICAgICAgICAgfSBlbHNlIGlmICghbWVtY21wKCZnLCAmY29kZWNfY29tbWVudF9oZWFkZXIsIHNpemVvZihHVUlEKSkpIHsNCiAgICAgICAgICAgICBpbnQgbGVuLCB2MSwgbiwgbnVtOw0KICAgICAgICAgICAgIGNoYXIgc3RyWzI1Nl0sICpxOw0KSW5kZXg6IGxpYmF2Zm9ybWF0L2FzZi5oDQo9PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09DQpSQ1MgZmlsZTogL2N2c3Jvb3QvZmZtcGVnL2ZmbXBlZy9saWJhdmZvcm1hdC9hc2YuaCx2DQpyZXRyaWV2aW5nIHJldmlzaW9uIDEuNjkNCmRpZmYgLXUgLXIxLjY5IGFzZi5oDQotLS0gbGliYXZmb3JtYXQvYXNmLmgJMTIgSmFuIDIwMDYgMjI6NDM6MjIgLTAwMDAJMS42OQ0KKysrIGxpYmF2Zm9ybWF0L2FzZi5oCTIwIEphbiAyMD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