How can I take control of the rendering of a file entity when inlined in text? There are excellent instructions for how to allow embedding Media into text fields here Setting up WYSIWYG and CKEditor to include Media Browser / Embed Media button.

Now I'm trying to control the output of that embedding process, specifically I'm trying to render a text field for a caption next to an image. I started out by adding a new view mode to the file entity with hook_entity_info_alter, configured this View mode to display the correct fields, and thought that would output as expected.

However, this by itself does nothing unless "File display" settings are also added, and I can't seem to figure out how to make them respect field settings. I've done a fair amount of debugging and hacking by now, and can't get this right. I could fill the question with a great deal of more details, but given that I can't make heads or tails out of the problem, it's unlikely to be very useful.

The question How do I control the file appearance using File Entity? is definitely related, and possibly even a duplicate, but as this one concerns specifically inline media, it may be different enough that open this separate question.
Your best bet is http://drupal.org/sandbox/DevinCarlson/1823634 - which is an add on to media, but I'm not certain whether or not it can also display fields that are attached to a file entity.

As per http://drupal.org/node/1792738 this functionality is planned to be rolled into the media module at some stage.